144 lines
4.7 KiB
C
144 lines
4.7 KiB
C
/**
|
|
* @copyright 2017 Indie Semiconductor.
|
|
*
|
|
* This file is proprietary to Indie Semiconductor.
|
|
* All rights reserved. Reproduction or distribution, in whole
|
|
* or in part, is forbidden except by express written permission
|
|
* of Indie Semiconductor.
|
|
*
|
|
* @file hwcfg.h
|
|
*/
|
|
|
|
#ifndef HWCFG_H__
|
|
#define HWCFG_H__
|
|
|
|
#include <meta.h>
|
|
|
|
/**
|
|
* @brief A structure to represent the data in hardware config block.
|
|
*/
|
|
typedef enum {
|
|
GAIN_05TIMES = 0x00U, /* 0.2V input */
|
|
GAIN_10TIMES, /* 0.1V input */
|
|
GAIN_20TIMES, /* 0.05V input */
|
|
GAIN_40TIMES, /* 0.025V input */
|
|
}CSA_GAIN_SEL_t;
|
|
|
|
|
|
|
|
typedef struct{
|
|
uint16_t V1_mV; /* mV */
|
|
uint16_t V2_mV; /* mV */
|
|
uint16_t V1_CODE; /* 2*ADC Code */
|
|
uint16_t V2_CODE; /* 2*ADC Code */
|
|
uint16_t GAIN; /* GAIN = real gain*1024 */
|
|
uint16_t RESVD;
|
|
}CSA_GainParam_t;
|
|
|
|
|
|
typedef union {
|
|
struct {
|
|
uint32_t OSC_TRIM;
|
|
uint32_t OSC_TRIM_RESVD;
|
|
|
|
uint16_t VDD3V3_LDO_TRIM;
|
|
uint16_t OCP_CTRL_3V3;
|
|
uint16_t VDD3V3EXT_LDO_TRIM;
|
|
uint16_t OCP_CTRL_3V3_EXT;
|
|
uint16_t VDD1V5_LDO_TRIM;
|
|
uint16_t OCP_CTRL_1V5;
|
|
uint16_t TRIM_BG;
|
|
uint16_t TRIM_VREF_BUF;
|
|
uint16_t TRIM_LF_RC; /* 250KHz trim code */
|
|
uint16_t TRIM_HF_RC; /* 16MHz trim code */
|
|
uint16_t TRIM_UHF_RC; /* 48MHz trim code */
|
|
uint16_t LINS_TX_DUTY;
|
|
uint16_t LINS_TX_SLOPE;
|
|
uint16_t LINS_TX_BIAS_BOOST;
|
|
uint16_t S_BOR_1P5V;
|
|
uint16_t S_BOR_3P3V;
|
|
uint16_t RESVD0[44];
|
|
|
|
uint16_t BANDGAP_2TIMES_VOLT_mV;
|
|
uint16_t ADC_CODE_2P0V; /* adc code *2 SARINPUTGAIN=0x1(31/32),SAR_INPUT_MODE=0x1(VINP buffered, VINN external)adc_vref=2*vbg */
|
|
uint16_t ADC_CODE_1P0V; /* adc code *2 SARINPUTGAIN=0x1(31/32),SAR_INPUT_MODE=0x1(VINP buffered, VINN external)adc_vref=2*vbg*/
|
|
uint16_t ADC_CODE_0P5V; /* adc code *2 SARINPUTGAIN=0x1(31/32),SAR_INPUT_MODE=0x1(VINP buffered, VINN external)adc_vref=2*vbg*/
|
|
uint16_t ADC_CODE_VBAT_13P5V; /* adc code *2 SARINPUTGAIN=0x1(31/32),SAR_INPUT_MODE=0x1(VINP buffered, VINN external)adc_vref=2*vbg gain=1/14*/
|
|
uint16_t ADC_CODE_VBAT_8P0V; /* adc code *2 SARINPUTGAIN=0x1(31/32),SAR_INPUT_MODE=0x1(VINP buffered, VINN external)adc_vref=2*vbg gain=1/14*/
|
|
uint16_t ADC_CODE_TEMPSENSOR_25C; /* adc code *2 SARINPUTGAIN=0x1(31/32),SAR_INPUT_MODE=0x1(VINP buffered, VINN external)adc_vref=2*vbg*/
|
|
uint16_t VOLTAGE_TEMPSENSOR_25C;
|
|
|
|
CSA_GainParam_t CSA_GAIN[4];
|
|
uint16_t RESVD1[32];
|
|
|
|
uint32_t CHIP_NAME;
|
|
uint32_t CHIP_VERSION;
|
|
uint32_t LOT_ID_L;
|
|
uint32_t LOT_ID_H;
|
|
uint32_t YEAR;
|
|
uint16_t MON;
|
|
uint16_t DAY;
|
|
uint32_t CHIP_ID;
|
|
uint16_t CHIP_ID_B;
|
|
uint16_t CHIP_ID_S;
|
|
uint32_t TEST_PROGRAM_VERSION;
|
|
uint32_t RESVD4;
|
|
uint32_t TEST_FACTORY_L;
|
|
uint32_t TEST_FACTORY_H;
|
|
uint8_t LOTID[32];
|
|
uint8_t RESVD2[168];
|
|
uint32_t CRC32;
|
|
uint32_t RESVD3;
|
|
};
|
|
uint8_t payload[512];
|
|
|
|
} HWCFG_SFRS_t;
|
|
|
|
/**
|
|
* @brief The starting address of hardware config block.
|
|
*/
|
|
#define HWCFG_SFRS ((__IO HWCFG_SFRS_t *) (0x00020000))
|
|
#define HWCFG_SFRS_START ((HWCFG_SFRS_t *) (0x00020000))
|
|
|
|
uint8_t HWCFG_Get3V3CalibValue(void);
|
|
uint8_t HWCFG_Get3V3_OCPValue(void);
|
|
uint8_t HWCFG_Get3V3_EXT_CalibValue(void);
|
|
uint8_t HWCFG_Get3V3_EXT_OCPValue(void);
|
|
uint8_t HWCFG_Get1V5_CalibValue(void);
|
|
uint8_t HWCFG_Get1V5_OCPValue(void);
|
|
|
|
uint8_t HWCFG_GetBGBUFFCalibValue(void);
|
|
|
|
uint8_t HWCFG_GetRCLFClockCalibValue(void);
|
|
uint8_t HWCFG_GetRCHFClockCalibValue(void);
|
|
|
|
uint8_t HWCFG_GetLINS_TxDuty(void);
|
|
uint8_t HWCFG_GetLINS_SlewRate(void);
|
|
uint8_t HWCFG_GetLINS_TxBiasBoost(void);
|
|
|
|
uint8_t HWCFG_Get1P5VBOR_Code(void);
|
|
uint8_t HWCFG_Get3P3VBOR_Code(void);
|
|
|
|
uint16_t HWCFG_Get2VBG(void);
|
|
uint16_t HWCFG_GetADCCode_GPIO2V0(void);
|
|
uint16_t HWCFG_GetADCCode_GPIO1V0(void);
|
|
uint16_t HWCFG_GetADCCode_GPIO0V5(void);
|
|
|
|
uint16_t HWCFG_GetADCCode_VBAT13V5(void);
|
|
uint16_t HWCFG_GetADCCode_VBAT8V0(void);
|
|
uint16_t HWCFG_GetADCCode_PTATLED(void);
|
|
|
|
uint16_t HWCFG_GetCSA_GAIN_VOLT_LOW_mV(CSA_GAIN_SEL_t gain);
|
|
uint16_t HWCFG_GetCSA_GAIN_VOLT_HIGH_mV(CSA_GAIN_SEL_t gain);
|
|
uint16_t HWCFG_GetCSA_GAIN_VOLT_LOW_CODE(CSA_GAIN_SEL_t gain);
|
|
uint16_t HWCFG_GetCSA_GAIN_VOLT_HIGH_CODE(CSA_GAIN_SEL_t gain);
|
|
uint16_t HWCFG_GetCSA_GAIN(CSA_GAIN_SEL_t gain);
|
|
|
|
uint32_t HWCFG_GetCalibrationVersion(void);
|
|
void HWCFG_TrimAccessUnlock(void);
|
|
void HWCFG_TrimAccessLockUntilReset(void);
|
|
|
|
|
|
#endif /* __HWCFG_H__ */
|
|
|