Driver for nonvolatile external memory on GDx devices, by now only supporting retrieval of calibration parameters

replace/efc2acb318dcadcdd7a09b2b41e00e56350ef621
Silvano Seva 2020-12-29 17:18:16 +01:00
rodzic ff7216e9cd
commit 206daec861
6 zmienionych plików z 494 dodań i 6 usunięć

Wyświetl plik

@ -259,6 +259,7 @@ dm1801_src = src + mk22fn512_src + ['platform/targets/DM-1801/platform.c',
'platform/drivers/NVM/W25Qx.c',
'platform/drivers/NVM/AT24Cx_GDx.c',
'platform/drivers/NVM/spiFlash_GDx.c',
'platform/drivers/NVM/nvmem_GDx.c',
'platform/drivers/ADC/ADC0_GDx.c',
'platform/drivers/baseband/rtx_GDx.c']

Wyświetl plik

@ -0,0 +1,92 @@
/***************************************************************************
* Copyright (C) 2020 by Federico Amedeo Izzo IU2NUO, *
* Niccolò Izzo IU2KIN *
* Frederik Saraci IU2NRO *
* 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_GDX_H
#define CALIBINFO_GDX_H
#include <datatypes.h>
#include <stdint.h>
/**
* \brief Calibration data for GDx platforms.
*/
typedef struct
{
uint16_t _DigitalRxGainNarrowband; // 0x000 IF Gain, RX Fine
uint16_t _DigitalTxGainNarrowband; // 0x002 IF Gain, TX Fine
uint16_t _DigitalRxGainWideband; // 0x004 IF Gain, RX Coarse
uint16_t _DigitalTxGainWideband; // 0x006 IF Gain, TX Coarse
uint16_t mod1Bias; // 0x008
uint8_t mod2Offset; // 0x00A
uint8_t txLowPower[16]; // 0x00B - 0x02A
uint8_t txHighPower[16]; // 0x00B - 0x02A
uint8_t analogSqlThresh[8]; // 0x03F
uint8_t noise1_HighTsh_Wb; // 0x047
uint8_t noise1_LowTsh_Wb; // 0x048
uint8_t noise2_HighTsh_Wb; // 0x049
uint8_t noise2_LowTsh_Wb; // 0x04A
uint8_t rssi_HighTsh_Wb; // 0x04B
uint8_t rssi_LowTsh_Wb; // 0x04C
uint8_t noise1_HighTsh_Nb; // 0x04D
uint8_t noise1_LowTsh_Nb; // 0x04E
uint8_t noise2_HighTsh_Nb; // 0x04F
uint8_t noise2_LowTsh_Nb; // 0x050
uint8_t rssi_HighTsh_Nb; // 0x051
uint8_t rssi_LowTsh_Nb; // 0x052
uint8_t RSSILowerThreshold; // 0x053
uint8_t RSSIUpperThreshold; // 0x054
uint8_t mod1Amplitude[8]; // 0x055
uint8_t dacDataRange; // 0x05D
uint8_t txDev_DTMF; // 0x05E
uint8_t txDev_tone; // 0x05F
uint8_t txDev_CTCSS_wb; // 0x060
uint8_t txDev_CTCSS_nb; // 0x061
uint8_t txDev_DCS_wb; // 0x062
uint8_t txDev_DCS_nb; // 0x063
uint8_t PA_drv; // 0x064
uint8_t PGA_gain; // 0x065
uint8_t analogMicGain; // 0x066
uint8_t rxAGCgain; // 0x067
uint16_t mixGainWideband; // 0x068
uint16_t mixGainNarrowband; // 0x06A
uint8_t rxAudioGainWideband; // 0x06C
uint8_t rxAudioGainNarrowband; // 0x06D
}
bandCalData_t;
typedef struct
{
bandCalData_t vhfCal;
bandCalData_t uhfCal;
freq_t vhfCalPoints[8]; // VHF calibration points for both TX power and mod1Amplitude
freq_t uhfPwrCalPoints[16]; // UHF calibration points for TX power
freq_t uhfMod1CalPoints[8]; // UHF calibration points for mod1Amplitude
}
gdxCalibration_t;
#endif /* CALIBINFO_GDX_H */

Wyświetl plik

@ -69,7 +69,7 @@ void W25Qx_sleep()
gpio_setPin(FLASH_CS);
}
ssize_t W25Qx_readSecurityRegister(uint32_t addr, uint8_t* buf, size_t len)
ssize_t W25Qx_readSecurityRegister(uint32_t addr, void* buf, size_t len)
{
uint32_t addrBase = addr & 0x3000;
uint32_t addrRange = addr & 0xCFFF;
@ -92,7 +92,7 @@ ssize_t W25Qx_readSecurityRegister(uint32_t addr, uint8_t* buf, size_t len)
for(size_t i = 0; i < readLen; i++)
{
buf[i] = spiFlash_SendRecv(0x00);
((uint8_t *) buf)[i] = spiFlash_SendRecv(0x00);
}
gpio_setPin(FLASH_CS);
@ -100,7 +100,7 @@ ssize_t W25Qx_readSecurityRegister(uint32_t addr, uint8_t* buf, size_t len)
return ((ssize_t) readLen);
}
void W25Qx_readData(uint32_t addr, uint8_t* buf, size_t len)
void W25Qx_readData(uint32_t addr, void* buf, size_t len)
{
gpio_clearPin(FLASH_CS);
(void) spiFlash_SendRecv(CMD_READ); /* Command */
@ -110,7 +110,7 @@ void W25Qx_readData(uint32_t addr, uint8_t* buf, size_t len)
for(size_t i = 0; i < len; i++)
{
buf[i] = spiFlash_SendRecv(0x00);
((uint8_t *) buf)[i] = spiFlash_SendRecv(0x00);
}
gpio_setPin(FLASH_CS);

Wyświetl plik

@ -65,7 +65,7 @@ void W25Qx_sleep();
* @return: -1 if address is not whithin security registers address range, the
* number of bytes effectively read otherwise.
*/
ssize_t W25Qx_readSecurityRegister(uint32_t addr, uint8_t *buf, size_t len);
ssize_t W25Qx_readSecurityRegister(uint32_t addr, void *buf, size_t len);
/**
* Read data from flash memory.
@ -74,6 +74,6 @@ ssize_t W25Qx_readSecurityRegister(uint32_t addr, uint8_t *buf, size_t len);
* @param buf: pointer to a buffer where data is written to.
* @param len: number of bytes to read.
*/
void W25Qx_readData(uint32_t addr, uint8_t *buf, size_t len);
void W25Qx_readData(uint32_t addr, void *buf, size_t len);
#endif /* W25Qx_H */

Wyświetl plik

@ -0,0 +1,272 @@
/***************************************************************************
* Copyright (C) 2020 by Federico Amedeo Izzo IU2NUO, *
* Niccolò Izzo IU2KIN *
* Frederik Saraci IU2NRO *
* 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/> *
***************************************************************************/
#include <nvmem.h>
#include <delays.h>
#include <calibInfo_GDx.h>
#include "AT24Cx.h"
#include "W25Qx.h"
/**
* \internal Data structure matching the one used by original GDx firmware to
* manage channel data inside nonvolatile memory.
*
* Taken by dmrconfig repository: https://github.com/sergev/dmrconfig/blob/master/gd77.c
*/
typedef struct
{
// Bytes 0-15
uint8_t name[16];
// Bytes 16-23
uint32_t rx_frequency;
uint32_t tx_frequency;
// Byte 24
uint8_t channel_mode;
// Bytes 25-26
uint8_t _unused25[2];
// Bytes 27-28
uint8_t tot;
uint8_t tot_rekey_delay;
// Byte 29
uint8_t admit_criteria;
// Bytes 30-31
uint8_t _unused30;
uint8_t scan_list_index;
// Bytes 32-35
uint16_t ctcss_dcs_receive;
uint16_t ctcss_dcs_transmit;
// Bytes 36-39
uint8_t _unused36;
uint8_t tx_signaling_syst;
uint8_t _unused38;
uint8_t rx_signaling_syst;
// Bytes 40-43
uint8_t _unused40;
uint8_t privacy_group;
uint8_t colorcode_tx;
uint8_t group_list_index;
// Bytes 44-47
uint8_t colorcode_rx;
uint8_t emergency_system_index;
uint16_t contact_name_index;
// Byte 48
uint8_t _unused48 : 6,
emergency_alarm_ack : 1,
data_call_conf : 1;
// Byte 49
uint8_t private_call_conf : 1,
_unused49_1 : 3,
privacy : 1,
_unused49_5 : 1,
repeater_slot2 : 1,
_unused49_7 : 1;
// Byte 50
uint8_t dcdm : 1,
_unused50_1 : 4,
non_ste_frequency : 1,
_unused50_6 : 2;
// Byte 51
uint8_t squelch : 1,
bandwidth : 1,
rx_only : 1,
talkaround : 1,
_unused51_4 : 2,
vox : 1,
power : 1;
// Bytes 52-55
uint8_t _unused52[4];
}
gdxChannel_t;
#if defined(PLATFORM_GD77)
static const uint32_t UHF_CAL_BASE = 0x8F000;
static const uint32_t VHF_CAL_BASE = 0x8F070;
#elif defined(PLATFORM_DM1801)
static const uint32_t UHF_CAL_BASE = 0x6F000;
static const uint32_t VHF_CAL_BASE = 0x6F070;
#else
#warning GDx calibration: platform not supported
#endif
/**
* \internal Utility function to convert 4 byte BCD values into a 32-bit
* unsigned integer ones.
*/
uint32_t _bcd2bin(uint32_t bcd)
{
return ((bcd >> 28) & 0x0F) * 10000000 +
((bcd >> 24) & 0x0F) * 1000000 +
((bcd >> 20) & 0x0F) * 100000 +
((bcd >> 16) & 0x0F) * 10000 +
((bcd >> 12) & 0x0F) * 1000 +
((bcd >> 8) & 0x0F) * 100 +
((bcd >> 4) & 0x0F) * 10 +
(bcd & 0x0F);
}
void nvm_init()
{
W25Qx_init();
AT24Cx_init();
}
void nvm_terminate()
{
W25Qx_terminate();
AT24Cx_terminate();
}
void nvm_readCalibData(void *buf)
{
W25Qx_wakeup();
delayUs(5);
gdxCalibration_t *calib = ((gdxCalibration_t *) buf);
/* Load UHF band calibration data */
W25Qx_readData(UHF_CAL_BASE + 0x08, &(calib->uhfCal.mod1Bias), 2);
W25Qx_readData(UHF_CAL_BASE + 0x0A, &(calib->uhfCal.mod2Offset), 1);
W25Qx_readData(UHF_CAL_BASE + 0x3F, calib->uhfCal.analogSqlThresh, 8);
W25Qx_readData(UHF_CAL_BASE + 0x47, &(calib->uhfCal.noise1_HighTsh_Wb), 1);
W25Qx_readData(UHF_CAL_BASE + 0x48, &(calib->uhfCal.noise1_LowTsh_Wb), 1);
W25Qx_readData(UHF_CAL_BASE + 0x49, &(calib->uhfCal.noise2_HighTsh_Wb), 1);
W25Qx_readData(UHF_CAL_BASE + 0x4A, &(calib->uhfCal.noise2_LowTsh_Wb), 1);
W25Qx_readData(UHF_CAL_BASE + 0x4B, &(calib->uhfCal.rssi_HighTsh_Wb), 1);
W25Qx_readData(UHF_CAL_BASE + 0x4C, &(calib->uhfCal.rssi_LowTsh_Wb), 1);
W25Qx_readData(UHF_CAL_BASE + 0x4D, &(calib->uhfCal.noise1_HighTsh_Nb), 1);
W25Qx_readData(UHF_CAL_BASE + 0x4E, &(calib->uhfCal.noise1_LowTsh_Nb), 1);
W25Qx_readData(UHF_CAL_BASE + 0x4F, &(calib->uhfCal.noise2_HighTsh_Nb), 1);
W25Qx_readData(UHF_CAL_BASE + 0x50, &(calib->uhfCal.noise2_LowTsh_Nb), 1);
W25Qx_readData(UHF_CAL_BASE + 0x51, &(calib->uhfCal.rssi_HighTsh_Nb), 1);
W25Qx_readData(UHF_CAL_BASE + 0x52, &(calib->uhfCal.rssi_LowTsh_Nb), 1);
W25Qx_readData(UHF_CAL_BASE + 0x53, &(calib->uhfCal.RSSILowerThreshold), 1);
W25Qx_readData(UHF_CAL_BASE + 0x54, &(calib->uhfCal.RSSIUpperThreshold), 1);
W25Qx_readData(UHF_CAL_BASE + 0x55, calib->uhfCal.mod1Amplitude, 8);
W25Qx_readData(UHF_CAL_BASE + 0x5D, &(calib->uhfCal.dacDataRange), 1);
W25Qx_readData(UHF_CAL_BASE + 0x5E, &(calib->uhfCal.txDev_DTMF), 1);
W25Qx_readData(UHF_CAL_BASE + 0x5F, &(calib->uhfCal.txDev_tone), 1);
W25Qx_readData(UHF_CAL_BASE + 0x60, &(calib->uhfCal.txDev_CTCSS_wb), 1);
W25Qx_readData(UHF_CAL_BASE + 0x61, &(calib->uhfCal.txDev_CTCSS_nb), 1);
W25Qx_readData(UHF_CAL_BASE + 0x62, &(calib->uhfCal.txDev_DCS_wb), 1);
W25Qx_readData(UHF_CAL_BASE + 0x63, &(calib->uhfCal.txDev_DCS_nb), 1);
W25Qx_readData(UHF_CAL_BASE + 0x64, &(calib->uhfCal.PA_drv), 1);
W25Qx_readData(UHF_CAL_BASE + 0x65, &(calib->uhfCal.PGA_gain), 1);
W25Qx_readData(UHF_CAL_BASE + 0x66, &(calib->uhfCal.analogMicGain), 1);
W25Qx_readData(UHF_CAL_BASE + 0x67, &(calib->uhfCal.rxAGCgain), 1);
W25Qx_readData(UHF_CAL_BASE + 0x68, &(calib->uhfCal.mixGainWideband), 2);
W25Qx_readData(UHF_CAL_BASE + 0x6A, &(calib->uhfCal.mixGainNarrowband), 2);
W25Qx_readData(UHF_CAL_BASE + 0x6C, &(calib->uhfCal.rxAudioGainWideband), 1);
W25Qx_readData(UHF_CAL_BASE + 0x6D, &(calib->uhfCal.rxAudioGainNarrowband), 1);
uint8_t txPwr[32] = {0};
W25Qx_readData(UHF_CAL_BASE + 0x0B, txPwr, 32);
for(uint8_t i = 0; i < 16; i++)
{
calib->uhfCal.txLowPower[i] = txPwr[2*i];
calib->uhfCal.txHighPower[i] = txPwr[2*i+1];
}
/* Load VHF band calibration data */
W25Qx_readData(VHF_CAL_BASE + 0x08, &(calib->vhfCal.mod1Bias), 2);
W25Qx_readData(VHF_CAL_BASE + 0x0A, &(calib->vhfCal.mod2Offset), 1);
W25Qx_readData(VHF_CAL_BASE + 0x3F, calib->vhfCal.analogSqlThresh, 8);
W25Qx_readData(VHF_CAL_BASE + 0x47, &(calib->vhfCal.noise1_HighTsh_Wb), 1);
W25Qx_readData(VHF_CAL_BASE + 0x48, &(calib->vhfCal.noise1_LowTsh_Wb), 1);
W25Qx_readData(VHF_CAL_BASE + 0x49, &(calib->vhfCal.noise2_HighTsh_Wb), 1);
W25Qx_readData(VHF_CAL_BASE + 0x4A, &(calib->vhfCal.noise2_LowTsh_Wb), 1);
W25Qx_readData(VHF_CAL_BASE + 0x4B, &(calib->vhfCal.rssi_HighTsh_Wb), 1);
W25Qx_readData(VHF_CAL_BASE + 0x4C, &(calib->vhfCal.rssi_LowTsh_Wb), 1);
W25Qx_readData(VHF_CAL_BASE + 0x4D, &(calib->vhfCal.noise1_HighTsh_Nb), 1);
W25Qx_readData(VHF_CAL_BASE + 0x4E, &(calib->vhfCal.noise1_LowTsh_Nb), 1);
W25Qx_readData(VHF_CAL_BASE + 0x4F, &(calib->vhfCal.noise2_HighTsh_Nb), 1);
W25Qx_readData(VHF_CAL_BASE + 0x50, &(calib->vhfCal.noise2_LowTsh_Nb), 1);
W25Qx_readData(VHF_CAL_BASE + 0x51, &(calib->vhfCal.rssi_HighTsh_Nb), 1);
W25Qx_readData(VHF_CAL_BASE + 0x52, &(calib->vhfCal.rssi_LowTsh_Nb), 1);
W25Qx_readData(VHF_CAL_BASE + 0x53, &(calib->vhfCal.RSSILowerThreshold), 1);
W25Qx_readData(VHF_CAL_BASE + 0x54, &(calib->vhfCal.RSSIUpperThreshold), 1);
W25Qx_readData(VHF_CAL_BASE + 0x55, calib->vhfCal.mod1Amplitude, 8);
W25Qx_readData(VHF_CAL_BASE + 0x5D, &(calib->vhfCal.dacDataRange), 1);
W25Qx_readData(VHF_CAL_BASE + 0x5E, &(calib->vhfCal.txDev_DTMF), 1);
W25Qx_readData(VHF_CAL_BASE + 0x5F, &(calib->vhfCal.txDev_tone), 1);
W25Qx_readData(VHF_CAL_BASE + 0x60, &(calib->vhfCal.txDev_CTCSS_wb), 1);
W25Qx_readData(VHF_CAL_BASE + 0x61, &(calib->vhfCal.txDev_CTCSS_nb), 1);
W25Qx_readData(VHF_CAL_BASE + 0x62, &(calib->vhfCal.txDev_DCS_wb), 1);
W25Qx_readData(VHF_CAL_BASE + 0x63, &(calib->vhfCal.txDev_DCS_nb), 1);
W25Qx_readData(VHF_CAL_BASE + 0x64, &(calib->vhfCal.PA_drv), 1);
W25Qx_readData(VHF_CAL_BASE + 0x65, &(calib->vhfCal.PGA_gain), 1);
W25Qx_readData(VHF_CAL_BASE + 0x66, &(calib->vhfCal.analogMicGain), 1);
W25Qx_readData(VHF_CAL_BASE + 0x67, &(calib->vhfCal.rxAGCgain), 1);
W25Qx_readData(VHF_CAL_BASE + 0x68, &(calib->vhfCal.mixGainWideband), 2);
W25Qx_readData(VHF_CAL_BASE + 0x6A, &(calib->vhfCal.mixGainNarrowband), 2);
W25Qx_readData(VHF_CAL_BASE + 0x6C, &(calib->vhfCal.rxAudioGainWideband), 1);
W25Qx_readData(VHF_CAL_BASE + 0x6D, &(calib->vhfCal.rxAudioGainNarrowband), 1);
W25Qx_readData(VHF_CAL_BASE + 0x0B, txPwr, 32);
W25Qx_sleep();
for(uint8_t i = 0; i < 16; i++)
{
calib->vhfCal.txLowPower[i] = txPwr[2*i];
calib->vhfCal.txHighPower[i] = txPwr[2*i+1];
}
/*
* Finally, load calibration points. These are common among all the GDx
* devices.
* VHF calibration head and tail are not equally spaced as the other points,
* so we manually override the values.
*/
for(uint8_t i = 0; i < 16; i++)
{
uint8_t ii = i/2;
calib->uhfMod1CalPoints[ii] = 405000000 + (5000000 * ii);
calib->uhfPwrCalPoints[i] = 400000000 + (5000000 * i);
}
for(uint8_t i = 0; i < 8; i++)
{
calib->vhfCalPoints[i] = 135000000 + (5000000 * i);
}
calib->vhfCalPoints[0] = 136000000;
calib->vhfCalPoints[7] = 172000000;
}
int nvm_readChannelData(channel_t *channel, uint16_t pos)
{
return -1;
}

Wyświetl plik

@ -0,0 +1,123 @@
/***************************************************************************
* Copyright (C) 2020 by Federico Amedeo Izzo IU2NUO, *
* Niccolò Izzo IU2KIN, *
* Frederik Saraci IU2NRO, *
* 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/> *
***************************************************************************/
#include <stdio.h>
#include <stdint.h>
#include <sys/types.h>
#include <nvmem.h>
#include <calibInfo_GDx.h>
void printCalibration()
{
uint8_t i;
gdxCalibration_t cal;
nvm_readCalibData(&cal);
puts("\r\nUHF band:\r");
printf("mod1Bias %03d", cal.uhfCal.mod1Bias);
printf("\r\nmod2Offset %03d", cal.uhfCal.mod2Offset);
printf("\r\ntxHighPower: "); for(i = 0; i < 16; i++) printf("%03d ", cal.uhfCal.txHighPower[i]);
printf("\r\ntxLowPower: "); for(i = 0; i < 16; i++) printf("%03d ", cal.uhfCal.txLowPower[i]);
printf("\r\nanalogSqlThresh: "); for(i = 0; i < 8; i++) printf("%03d ", cal.uhfCal.analogSqlThresh[i]);
printf("\r\nnoise1_HighTsh_Wb %03d", cal.uhfCal.noise1_HighTsh_Wb);
printf("\r\nnoise1_LowTsh_Wb %03d", cal.uhfCal.noise1_LowTsh_Wb);
printf("\r\nnoise2_HighTsh_Wb %03d", cal.uhfCal.noise2_HighTsh_Wb);
printf("\r\nnoise2_LowTsh_Wb %03d", cal.uhfCal.noise2_LowTsh_Wb);
printf("\r\nrssi_HighTsh_Wb %03d", cal.uhfCal.rssi_HighTsh_Wb);
printf("\r\nrssi_LowTsh_Wb %03d", cal.uhfCal.rssi_LowTsh_Wb);
printf("\r\nnoise1_HighTsh_Nb %03d", cal.uhfCal.noise1_HighTsh_Nb);
printf("\r\nnoise1_LowTsh_Nb %03d", cal.uhfCal.noise1_LowTsh_Nb);
printf("\r\nnoise2_HighTsh_Nb %03d", cal.uhfCal.noise2_HighTsh_Nb);
printf("\r\nnoise2_LowTsh_Nb %03d", cal.uhfCal.noise2_LowTsh_Nb);
printf("\r\nrssi_HighTsh_Nb %03d", cal.uhfCal.rssi_HighTsh_Nb);
printf("\r\nrssi_LowTsh_Nb %03d", cal.uhfCal.rssi_LowTsh_Nb);
printf("\r\nRSSILowerThreshold %03d", cal.uhfCal.RSSILowerThreshold);
printf("\r\nRSSIUpperThreshold %03d", cal.uhfCal.RSSIUpperThreshold);
printf("\r\nmod1Amplitude: "); for(i = 0; i < 8; i++) printf("%03d ", cal.uhfCal.mod1Amplitude[i]);
printf("\r\ndacDataRange %03d", cal.uhfCal.dacDataRange);
printf("\r\ntxDev_DTMF %03d", cal.uhfCal.txDev_DTMF);
printf("\r\ntxDev_tone %03d", cal.uhfCal.txDev_tone);
printf("\r\ntxDev_CTCSS_wb %03d", cal.uhfCal.txDev_CTCSS_wb);
printf("\r\ntxDev_CTCSS_nb %03d", cal.uhfCal.txDev_CTCSS_nb);
printf("\r\ntxDev_DCS_wb %03d", cal.uhfCal.txDev_DCS_wb);
printf("\r\ntxDev_DCS_nb %03d", cal.uhfCal.txDev_DCS_nb);
printf("\r\nPA_drv %03d", cal.uhfCal.PA_drv);
printf("\r\nPGA_gain %03d", cal.uhfCal.PGA_gain);
printf("\r\nanalogMicGain %03d", cal.uhfCal.analogMicGain);
printf("\r\nrxAGCgain %03d", cal.uhfCal.rxAGCgain);
printf("\r\nmixGainWideband %03d", cal.uhfCal.mixGainWideband);
printf("\r\nmixGainNarrowband %03d", cal.uhfCal.mixGainNarrowband);
printf("\r\nrxAudioGainWideband %03d", cal.uhfCal.rxAudioGainWideband);
printf("\r\nrxAudioGainNarrowband %03d", cal.uhfCal.rxAudioGainNarrowband);
printf("\r\nuhfPwrCalPoints: "); for(i = 0; i < 16; i++) printf("%ld ", cal.uhfPwrCalPoints[i]);
printf("\r\nuhfMod1CalPoints: "); for(i = 0; i < 8; i++) printf("%ld ", cal.uhfMod1CalPoints[i]);
puts("\r\nVHF band:\r");
printf("mod1Bias %03d", cal.vhfCal.mod1Bias);
printf("\r\nmod2Offset %03d", cal.vhfCal.mod2Offset);
printf("\r\ntxHighPower: "); for(i = 0; i < 8; i++) printf("%03d ", cal.vhfCal.txHighPower[i]);
printf("\r\ntxLowPower: "); for(i = 0; i < 8; i++) printf("%03d ", cal.vhfCal.txLowPower[i]);
printf("\r\nanalogSqlThresh: "); for(i = 0; i < 8; i++) printf("%03d ", cal.vhfCal.analogSqlThresh[i]);
printf("\r\nnoise1_HighTsh_Wb %03d", cal.vhfCal.noise1_HighTsh_Wb);
printf("\r\nnoise1_LowTsh_Wb %03d", cal.vhfCal.noise1_LowTsh_Wb);
printf("\r\nnoise2_HighTsh_Wb %03d", cal.vhfCal.noise2_HighTsh_Wb);
printf("\r\nnoise2_LowTsh_Wb %03d", cal.vhfCal.noise2_LowTsh_Wb);
printf("\r\nrssi_HighTsh_Wb %03d", cal.vhfCal.rssi_HighTsh_Wb);
printf("\r\nrssi_LowTsh_Wb %03d", cal.vhfCal.rssi_LowTsh_Wb);
printf("\r\nnoise1_HighTsh_Nb %03d", cal.vhfCal.noise1_HighTsh_Nb);
printf("\r\nnoise1_LowTsh_Nb %03d", cal.vhfCal.noise1_LowTsh_Nb);
printf("\r\nnoise2_HighTsh_Nb %03d", cal.vhfCal.noise2_HighTsh_Nb);
printf("\r\nnoise2_LowTsh_Nb %03d", cal.vhfCal.noise2_LowTsh_Nb);
printf("\r\nrssi_HighTsh_Nb %03d", cal.vhfCal.rssi_HighTsh_Nb);
printf("\r\nrssi_LowTsh_Nb %03d", cal.vhfCal.rssi_LowTsh_Nb);
printf("\r\nRSSILowerThreshold %03d", cal.vhfCal.RSSILowerThreshold);
printf("\r\nRSSIUpperThreshold %03d", cal.vhfCal.RSSIUpperThreshold);
printf("\r\nmod1Amplitude: "); for(i = 0; i < 8; i++) printf("%03d ", cal.vhfCal.mod1Amplitude[i]);
printf("\r\ndacDataRange %03d", cal.vhfCal.dacDataRange);
printf("\r\ntxDev_DTMF %03d", cal.vhfCal.txDev_DTMF);
printf("\r\ntxDev_tone %03d", cal.vhfCal.txDev_tone);
printf("\r\ntxDev_CTCSS_wb %03d", cal.vhfCal.txDev_CTCSS_wb);
printf("\r\ntxDev_CTCSS_nb %03d", cal.vhfCal.txDev_CTCSS_nb);
printf("\r\ntxDev_DCS_wb %03d", cal.vhfCal.txDev_DCS_wb);
printf("\r\ntxDev_DCS_nb %03d", cal.vhfCal.txDev_DCS_nb);
printf("\r\nPA_drv %03d", cal.vhfCal.PA_drv);
printf("\r\nPGA_gain %03d", cal.vhfCal.PGA_gain);
printf("\r\nanalogMicGain %03d", cal.vhfCal.analogMicGain);
printf("\r\nrxAGCgain %03d", cal.vhfCal.rxAGCgain);
printf("\r\nmixGainWideband %03d", cal.vhfCal.mixGainWideband);
printf("\r\nmixGainNarrowband %03d", cal.vhfCal.mixGainNarrowband);
printf("\r\nrxAudioGainWideband %03d", cal.vhfCal.rxAudioGainWideband);
printf("\r\nrxAudioGainNarrowband %03d", cal.vhfCal.rxAudioGainNarrowband);
printf("\r\nvhfCalPoints: "); for(i = 0; i < 8; i++) printf("%ld ", cal.vhfCalPoints[i]);
}
int main()
{
nvm_init();
while(1)
{
getchar();
printCalibration();
}
return 0;
}