kopia lustrzana https://github.com/OpenRTX/OpenRTX
CS7000: NVM: added reading of calibration data
rodzic
e4b64fbef2
commit
135bf562f1
|
@ -0,0 +1,43 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2024 by Silvano Seva IU2KWO *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/> *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef CALIBINFO_CS7000_H
|
||||
#define CALIBINFO_CS7000_H
|
||||
|
||||
#include <datatypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
/**
|
||||
* \brief Calibration data for Connect Systems CS7000.
|
||||
*/
|
||||
struct CS7000Calib
|
||||
{
|
||||
uint32_t txCalFreq[8]; // 0x000
|
||||
uint32_t rxCalFreq[8]; // 0x024
|
||||
uint8_t rxSensitivity[8]; // 0x044
|
||||
uint8_t txHighPwr[8]; // 0x06C
|
||||
uint8_t txMiddlePwr[8]; // 0x074
|
||||
uint8_t mskFreqOffset[8]; // 0x0B4
|
||||
uint8_t txDigitalPathI[8]; // 0x0BC
|
||||
uint8_t txDigitalPathQ[8]; // 0x0C4
|
||||
uint8_t txAnalogPathI[8]; // 0x0CC
|
||||
uint8_t txAnalogPathQ[8]; // 0x0D4
|
||||
uint8_t errorRate[8]; // 0x0DC
|
||||
};
|
||||
|
||||
#endif /* CALIBINFO_CS7000_H */
|
|
@ -17,14 +17,15 @@
|
|||
|
||||
#include <interfaces/nvmem.h>
|
||||
#include <interfaces/delays.h>
|
||||
#include <calibInfo_CS760.h>
|
||||
#include <nvmem_access.h>
|
||||
#include <spi_bitbang.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <utils.h>
|
||||
#include <crc.h>
|
||||
#include "W25Qx.h"
|
||||
#include "eeep.h"
|
||||
#include <W25Qx.h>
|
||||
#include <eeep.h>
|
||||
|
||||
static const struct W25QxCfg cfg =
|
||||
{
|
||||
|
@ -94,7 +95,22 @@ const struct nvmDescriptor *nvm_getDesc(const size_t index)
|
|||
|
||||
void nvm_readCalibData(void *buf)
|
||||
{
|
||||
(void) buf;
|
||||
struct CS760Calib *calData = (struct CS7000 *) buf;
|
||||
|
||||
nvm_read(0, 0, 0x1000, &(calData->txCalFreq), sizeof(calData.txCalFreq));
|
||||
nvm_read(0, 0, 0x1020, &(calData->rxCalFreq), sizeof(calData.rxCalFreq));
|
||||
nvm_read(0, 0, 0x1044, &(calData->rxSensitivity), sizeof(calData.rxSensitivity));
|
||||
nvm_read(0, 0, 0x106C, &(calData->txHighPwr), sizeof(calData.txHighPwr));
|
||||
nvm_read(0, 0, 0x1074, &(calData->txMiddlePwr), sizeof(calData.txMiddlePwr));
|
||||
nvm_read(0, 0, 0x10C4, &(calData->txDigitalPathQ), sizeof(calData.txDigitalPathQ));
|
||||
nvm_read(0, 0, 0x10CC, &(calData->txAnalogPathI), sizeof(calData.txAnalogPathI));
|
||||
nvm_read(0, 0, 0x10DC, &(calData->errorRate), sizeof(calData.errorRate));
|
||||
|
||||
for(int i = 0; i < 8; i++)
|
||||
{
|
||||
calData->txCalFreq[i] = __builtin_bswap32(calData->txCalFreq[i]);
|
||||
calData->rxCalFreq[i] = __builtin_bswap32(calData->rxCalFreq[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void nvm_readHwInfo(hwInfo_t *info)
|
||||
|
|
Ładowanie…
Reference in New Issue