diff --git a/openrtx/include/calibration/calibInfo_CS7000.h b/openrtx/include/calibration/calibInfo_CS7000.h new file mode 100644 index 00000000..ffcdc477 --- /dev/null +++ b/openrtx/include/calibration/calibInfo_CS7000.h @@ -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 * + ***************************************************************************/ + +#ifndef CALIBINFO_CS7000_H +#define CALIBINFO_CS7000_H + +#include +#include + + +/** + * \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 */ diff --git a/platform/drivers/NVM/nvmem_CS7000.c b/platform/drivers/NVM/nvmem_CS7000.c index b7bd13ed..ed0dd9ee 100644 --- a/platform/drivers/NVM/nvmem_CS7000.c +++ b/platform/drivers/NVM/nvmem_CS7000.c @@ -17,14 +17,15 @@ #include #include +#include #include #include #include #include #include #include -#include "W25Qx.h" -#include "eeep.h" +#include +#include 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)