1 /** 2 ****************************************************************************** 3 * @file lib_LoadNVR.h 4 * @author Application Team 5 * @version V1.1.0 6 * @date 2019-10-28 7 * @brief Load information from NVR. 8 ****************************************************************************** 9 * @attention 10 * 11 ****************************************************************************** 12 */ 13 14 #ifndef __LIB_LOADNVR_H 15 #define __LIB_LOADNVR_H 16 17 #ifdef __cplusplus 18 extern "C" { 19 #endif 20 21 /* Includes ------------------------------------------------------------------*/ 22 #include "target.h" 23 24 /* Power Measure Result */ 25 typedef struct 26 { 27 uint32_t AVCCMEAResult; // LDO33 Measure Result 28 uint32_t DVCCMEAResult; // LDO15 Measure Result 29 uint32_t BGPMEAResult; // BGP Measure Result 30 uint32_t RCLMEAResult; // RCL Measure Result 31 uint32_t RCHMEAResult; // RCH Measure Result 32 } NVR_MISCGain; 33 34 /* Chip ID */ 35 typedef struct 36 { 37 uint32_t ChipID0; // ID word 0 38 uint32_t ChipID1; // ID word 1 39 } NVR_CHIPID; 40 41 /* Temperature information */ 42 typedef struct 43 { 44 float TempOffset; 45 } NVR_TEMPINFO; 46 47 /* LCD information */ 48 typedef struct 49 { 50 uint32_t MEALCDLDO; // Measure LCD LDO pre trim value 51 uint32_t MEALCDVol; // VLCD setting 52 } NVR_LCDINFO; 53 54 /* RTC(temp) information */ 55 typedef struct 56 { 57 int16_t RTCTempP0; //P0 58 int16_t RTCTempP1; //P1 59 int32_t RTCTempP2; //P2 60 int16_t RTCTempP4; //P4 61 int16_t RTCTempP5; //P5 62 int16_t RTCTempP6; //P6 63 int16_t RTCTempP7; //P7 64 int16_t RTCTempK0; //K0 65 int16_t RTCTempK1; //K1 66 int16_t RTCTempK2; //K2 67 int16_t RTCTempK3; //K3 68 int16_t RTCTempK4; //K4 69 int16_t RTCACTI; //Center temperature 70 uint32_t RTCACKTemp; //section X temperature 71 int32_t RTCTempDelta; //Temperature delta 72 uint32_t RTCACF200; //RTC_ACF200 73 } NVR_RTCINFO; 74 75 /* RTC(temp) information */ 76 typedef struct 77 { 78 int16_t RTCTempP0; //P0 79 int16_t RTCTempP1; //P1 80 int32_t RTCTempP2; //P2 81 } NVR_TempParams; 82 83 /* ADC Voltage Parameters */ 84 typedef struct 85 { 86 float aParameter; 87 float bParameter; 88 float OffsetParameter; 89 } NVR_ADCVOLPARA; 90 //Mode 91 #define NVR_3V_EXTERNAL_NODIV (0x000UL) // Power supply: 3.3V; Channel: External; Divider modeL: None 92 #define NVR_3V_EXTERNAL_RESDIV (0x001UL) // Power supply: 3.3V; Channel: External; Divider modeL: Resistive 93 #define NVR_3V_BAT1_RESDIV (0x002UL) // Power supply: 3.3V; Channel: VDD; Divider modeL: Resistive 94 #define NVR_3V_BATRTC_RESDIV (0x003UL) // Power supply: 3.3V; Channel: BATRTC; Divider modeL: Resistive 95 #define NVR_5V_EXTERNAL_NODIV (0x100UL) // Power supply: 5V; Channel: External; Divider modeL: None 96 #define NVR_5V_EXTERNAL_RESDIV (0x101UL) // Power supply: 5V; Channel: External; Divider modeL: Resistive 97 #define NVR_5V_BAT1_RESDIV (0x102UL) // Power supply: 5V; Channel: VDD; Divider modeL: Resistive 98 #define NVR_5V_BATRTC_RESDIV (0x103UL) // Power supply: 5V; Channel: BATRTC; Divider modeL: Resistive 99 #define IS_NVR_ADCVOL_MODE(__MODE__) (((__MODE__) == NVR_3V_EXTERNAL_NODIV) ||\ 100 ((__MODE__) == NVR_3V_EXTERNAL_RESDIV) ||\ 101 ((__MODE__) == NVR_3V_BAT1_RESDIV) ||\ 102 ((__MODE__) == NVR_3V_BATRTC_RESDIV) ||\ 103 ((__MODE__) == NVR_5V_EXTERNAL_NODIV) ||\ 104 ((__MODE__) == NVR_5V_EXTERNAL_RESDIV) ||\ 105 ((__MODE__) == NVR_5V_BAT1_RESDIV) ||\ 106 ((__MODE__) == NVR_5V_BATRTC_RESDIV)) 107 108 //VOLMode 109 #define NVR_MEARES_3V 0 110 #define NVR_MEARES_5V 1 111 #define IS_MEARES(__VOLMODE__) (((__VOLMODE__) == NVR_MEARES_3V) ||\ 112 ((__VOLMODE__) == NVR_MEARES_5V)) 113 /********** NVR Address **********/ 114 //ADC Voltage Parameters 115 #define NVR_3VPARA_BASEADDR1 (__IO uint32_t *)(0x80C48) 116 #define NVR_3VPARA_BASEADDR2 (__IO uint32_t *)(0x80C6C) 117 #define NVR_5VPARA_BASEADDR1 (__IO uint32_t *)(0x80C00) 118 #define NVR_5VPARA_BASEADDR2 (__IO uint32_t *)(0x80C24) 119 //RTC DATA 120 //P4 121 #define NVR_RTC1_P4 (__IO uint32_t *)(0x80800) 122 #define NVR_RTC1_P4_CHKSUM (__IO uint32_t *)(0x80804) 123 #define NVR_RTC2_P4 (__IO uint32_t *)(0x80808) 124 #define NVR_RTC2_P4_CHKSUM (__IO uint32_t *)(0x8080C) 125 //ACK1~ACK5 126 #define NVR_RTC1_ACK0 (__IO uint32_t *)(0x80810) 127 #define NVR_RTC1_ACK1 (__IO uint32_t *)(0x80814) 128 #define NVR_RTC1_ACK2 (__IO uint32_t *)(0x80818) 129 #define NVR_RTC1_ACK3 (__IO uint32_t *)(0x8081C) 130 #define NVR_RTC1_ACK4 (__IO uint32_t *)(0x80820) 131 #define NVR_RTC1_ACK_CHKSUM (__IO uint32_t *)(0x80824) 132 #define NVR_RTC2_ACK0 (__IO uint32_t *)(0x80828) 133 #define NVR_RTC2_ACK1 (__IO uint32_t *)(0x8082C) 134 #define NVR_RTC2_ACK2 (__IO uint32_t *)(0x80830) 135 #define NVR_RTC2_ACK3 (__IO uint32_t *)(0x80834) 136 #define NVR_RTC2_ACK4 (__IO uint32_t *)(0x80838) 137 #define NVR_RTC2_ACK_CHKSUM (__IO uint32_t *)(0x8083C) 138 //ACTI 139 #define NVR_RTC1_ACTI (__IO uint32_t *)(0x80840) 140 #define NVR_RTC1_ACTI_CHKSUM (__IO uint32_t *)(0x80844) 141 #define NVR_RTC2_ACTI (__IO uint32_t *)(0x80848) 142 #define NVR_RTC2_ACTI_CHKSUM (__IO uint32_t *)(0x8084C) 143 //ACKTEMP 144 #define NVR_RTC1_ACKTEMP (__IO uint32_t *)(0x80850) 145 #define NVR_RTC1_ACKTEMP_CHKSUM (__IO uint32_t *)(0x80854) 146 #define NVR_RTC2_ACKTEMP (__IO uint32_t *)(0x80858) 147 #define NVR_RTC2_ACKTEMP_CHKSUM (__IO uint32_t *)(0x8085C) 148 //Analog trim data 149 #define NVR_ANA_TRIMDATA1 (__IO uint32_t *)(0x80DC0) 150 #define NVR_ANA_OPREG1 (__IO uint32_t *)(0x80DC4) 151 #define NVR_ANA_KEYREG1 (__IO uint32_t *)(0x80DC8) 152 #define NVR_ANA_CHECKSUM1 (__IO uint32_t *)(0x80DCC) 153 #define NVR_ANA_TRIMDATA2 (__IO uint32_t *)(0x80DD0) 154 #define NVR_ANA_OPREG2 (__IO uint32_t *)(0x80DD4) 155 #define NVR_ANA_KEYREG2 (__IO uint32_t *)(0x80DD8) 156 #define NVR_ANA_CHECKSUM2 (__IO uint32_t *)(0x80DDC) 157 #define NVR_ANA1_REG10 (__IO uint32_t *)(0x80DE0) 158 #define NVR_ANA1_REG10_CHKSUM (__IO uint32_t *)(0x80DE4) 159 #define NVR_ANA2_REG10 (__IO uint32_t *)(0x80DE8) 160 #define NVR_ANA2_REG10_CHKSUM (__IO uint32_t *)(0x80DEC) 161 //ADC_CHx 162 #define NVR_5VADCCHx_NODIV1 (__IO uint32_t *)(0x80C90) 163 #define NVR_5VADCCHx_RESDIV1 (__IO uint32_t *)(0x80C94) 164 #define NVR_5VADCCHx_NODIV2 (__IO uint32_t *)(0x80CA4) 165 #define NVR_5VADCCHx_RESDIV2 (__IO uint32_t *)(0x80CA8) 166 #define NVR_3VADCCHx_NODIV1 (__IO uint32_t *)(0x80CB8) 167 #define NVR_3VADCCHx_RESDIV1 (__IO uint32_t *)(0x80CBC) 168 #define NVR_3VADCCHx_NODIV2 (__IO uint32_t *)(0x80CCC) 169 #define NVR_3VADCCHx_RESDIV2 (__IO uint32_t *)(0x80CD0) 170 //BAT Measure Result 171 #define NVR_5VBAT1 (__IO uint32_t *)(0x80C98) 172 #define NVR_5VBATRTC1 (__IO uint32_t *)(0x80C9C) 173 #define NVR_5VBATCHKSUM1 (__IO uint32_t *)(0x80CA0) 174 #define NVR_5VBAT2 (__IO uint32_t *)(0x80CAC) 175 #define NVR_5VBATRTC2 (__IO uint32_t *)(0x80CB0) 176 #define NVR_5VBATCHKSUM2 (__IO uint32_t *)(0x80CB4) 177 #define NVR_3VBAT1 (__IO uint32_t *)(0x80CC0) 178 #define NVR_3VBATRTC1 (__IO uint32_t *)(0x80CC4) 179 #define NVR_3VBATCHKSUM1 (__IO uint32_t *)(0x80CC8) 180 #define NVR_3VBAT2 (__IO uint32_t *)(0x80CD4) 181 #define NVR_3VBATRTC2 (__IO uint32_t *)(0x80CD8) 182 #define NVR_3VBATCHKSUM2 (__IO uint32_t *)(0x80CDC) 183 //RTC AutoCal Px pramameters 184 #define NVR_RTC1_P1_P0 (__IO uint32_t *)(0x80D10) 185 #define NVR_RTC1_P2 (__IO uint32_t *)(0x80D14) 186 #define NVR_RTC1_P5_P4 (__IO uint32_t *)(0x80D18) 187 #define NVR_RTC1_P7_P6 (__IO uint32_t *)(0x80D1C) 188 #define NVR_RTC1_PCHECHSUM (__IO uint32_t *)(0x80D20) 189 #define NVR_RTC2_P1_P0 (__IO uint32_t *)(0x80D24) 190 #define NVR_RTC2_P2 (__IO uint32_t *)(0x80D28) 191 #define NVR_RTC2_P5_P4 (__IO uint32_t *)(0x80D2C) 192 #define NVR_RTC2_P7_P6 (__IO uint32_t *)(0x80D30) 193 #define NVR_RTC2_PCHECHSUM (__IO uint32_t *)(0x80D34) 194 //Power Measure Result 195 #define NVR_AVCC_MEA1 (__IO uint32_t *)(0x80D38) 196 #define NVR_DVCC_MEA1 (__IO uint32_t *)(0x80D3C) 197 #define NVR_BGP_MEA1 (__IO uint32_t *)(0x80D40) 198 #define NVR_RCL_MEA1 (__IO uint32_t *)(0x80D44) 199 #define NVR_RCH_MEA1 (__IO uint32_t *)(0x80D48) 200 #define NVR_PWR_CHECKSUM1 (__IO uint32_t *)(0x80D4C) 201 #define NVR_AVCC_MEA2 (__IO uint32_t *)(0x80D50) 202 #define NVR_DVCC_MEA2 (__IO uint32_t *)(0x80D54) 203 #define NVR_BGP_MEA2 (__IO uint32_t *)(0x80D58) 204 #define NVR_RCL_MEA2 (__IO uint32_t *)(0x80D5C) 205 #define NVR_RCH_MEA2 (__IO uint32_t *)(0x80D60) 206 #define NVR_PWR_CHECKSUM2 (__IO uint32_t *)(0x80D64) 207 //Chip ID 208 #define NVR_CHIP1_ID0 (__IO uint32_t *)(0x80D68) 209 #define NVR_CHIP1_ID1 (__IO uint32_t *)(0x80D6C) 210 #define NVR_CHIP1_CHECKSUM (__IO uint32_t *)(0x80D70) 211 #define NVR_CHIP2_ID0 (__IO uint32_t *)(0x80D74) 212 #define NVR_CHIP2_ID1 (__IO uint32_t *)(0x80D78) 213 #define NVR_CHIP2_CHECKSUM (__IO uint32_t *)(0x80D7C) 214 //Temperature information 215 #define NVR_REALTEMP1 (__IO uint32_t *)(0x80D80) 216 #define NVR_MEATEMP1 (__IO uint32_t *)(0x80D84) 217 #define NVR_TEMP_CHECKSUM1 (__IO uint32_t *)(0x80D88) 218 #define NVR_REALTEMP2 (__IO uint32_t *)(0x80D9C) 219 #define NVR_MEATEMP2 (__IO uint32_t *)(0x80D90) 220 #define NVR_TEMP_CHECKSUM2 (__IO uint32_t *)(0x80D94) 221 222 uint32_t NVR_LoadANADataManual(void); 223 uint32_t NVR_GetInfo_LoadRTCData(NVR_RTCINFO *RTCTempData, uint32_t DivCLKSource); 224 uint32_t NVR_GetVoltageParameters(uint32_t Mode, NVR_ADCVOLPARA *Parameter); 225 uint32_t NVR_GetTempParameters(NVR_TempParams *TempParams); 226 uint32_t NVR_GetMISCGain(NVR_MISCGain *MEAResult); 227 uint32_t NVR_GetChipID(NVR_CHIPID *ChipID); 228 229 #ifdef __cplusplus 230 } 231 #endif 232 233 #endif /* __LIB_LOADNVR_H */ 234 235 /*********************************** END OF FILE ******************************/ 236