diff options
Diffstat (limited to 'firmware/target/arm/imx233/lradc-imx233.h')
-rw-r--r-- | firmware/target/arm/imx233/lradc-imx233.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/firmware/target/arm/imx233/lradc-imx233.h b/firmware/target/arm/imx233/lradc-imx233.h index d79ebe0eff..b661fa8aa4 100644 --- a/firmware/target/arm/imx233/lradc-imx233.h +++ b/firmware/target/arm/imx233/lradc-imx233.h | |||
@@ -43,8 +43,14 @@ | |||
43 | #define HW_LRADC_CTRL2__TEMP_ISRC1_BM 0xf0 | 43 | #define HW_LRADC_CTRL2__TEMP_ISRC1_BM 0xf0 |
44 | #define HW_LRADC_CTRL2__TEMP_ISRC0_BP 0 | 44 | #define HW_LRADC_CTRL2__TEMP_ISRC0_BP 0 |
45 | #define HW_LRADC_CTRL2__TEMP_ISRC0_BM 0xf | 45 | #define HW_LRADC_CTRL2__TEMP_ISRC0_BM 0xf |
46 | #define HW_LRADC_CTRL2__TEMP_ISRCx_BP(x) (4 * (x)) | ||
47 | #define HW_LRADC_CTRL2__TEMP_ISRCx_BM(x) (0xf << (4 * (x))) | ||
48 | #define HW_LRADC_CTRL2__TEMP_ISRC__0uA 0 | ||
49 | #define HW_LRADC_CTRL2__TEMP_ISRC__20uA 1 | ||
50 | #define HW_LRADC_CTRL2__TEMP_ISRC__300uA 15 | ||
46 | #define HW_LRADC_CTRL2__TEMP_SENSOR_IENABLE0 (1 << 8) | 51 | #define HW_LRADC_CTRL2__TEMP_SENSOR_IENABLE0 (1 << 8) |
47 | #define HW_LRADC_CTRL2__TEMP_SENSOR_IENABLE1 (1 << 9) | 52 | #define HW_LRADC_CTRL2__TEMP_SENSOR_IENABLE1 (1 << 9) |
53 | #define HW_LRADC_CTRL2__TEMP_SENSOR_IENABLEx(x) (1 << (8 + (x))) | ||
48 | #define HW_LRADC_CTRL2__TEMPSENSE_PWD (1 << 15) | 54 | #define HW_LRADC_CTRL2__TEMPSENSE_PWD (1 << 15) |
49 | #define HW_LRADC_CTRL2__DIVIDE_BY_TWO(x) (1 << ((x) + 24)) | 55 | #define HW_LRADC_CTRL2__DIVIDE_BY_TWO(x) (1 << ((x) + 24)) |
50 | 56 | ||
@@ -59,7 +65,7 @@ | |||
59 | #define HW_LRADC_STATUS (*(volatile uint32_t *)(HW_LRADC_BASE + 0x40)) | 65 | #define HW_LRADC_STATUS (*(volatile uint32_t *)(HW_LRADC_BASE + 0x40)) |
60 | 66 | ||
61 | #define HW_LRADC_CHx(x) (*(volatile uint32_t *)(HW_LRADC_BASE + 0x50 + (x) * 0x10)) | 67 | #define HW_LRADC_CHx(x) (*(volatile uint32_t *)(HW_LRADC_BASE + 0x50 + (x) * 0x10)) |
62 | #define HW_LRADC_CHx__NUM_SAMPLES_BM (0xf << 24) | 68 | #define HW_LRADC_CHx__NUM_SAMPLES_BM (0x1f << 24) |
63 | #define HW_LRADC_CHx__NUM_SAMPLES_BP 24 | 69 | #define HW_LRADC_CHx__NUM_SAMPLES_BP 24 |
64 | #define HW_LRADC_CHx__ACCUMULATE 29 | 70 | #define HW_LRADC_CHx__ACCUMULATE 29 |
65 | #define HW_LRADC_CHx__VALUE_BM 0x3ffff | 71 | #define HW_LRADC_CHx__VALUE_BM 0x3ffff |
@@ -127,8 +133,11 @@ void imx233_lradc_reserve_delay(int dchannel); | |||
127 | void imx233_lradc_release_delay(int dchan); | 133 | void imx233_lradc_release_delay(int dchan); |
128 | 134 | ||
129 | /* enable sensing and return temperature in kelvin, | 135 | /* enable sensing and return temperature in kelvin, |
130 | * channels must already be configured as nmos and pmos */ | 136 | * channels needs not to be configured */ |
131 | int imx233_lradc_sense_die_temperature(int nmos_chan, int pmos_chan); | 137 | int imx233_lradc_sense_die_temperature(int nmos_chan, int pmos_chan); |
138 | /* return *raw* external temperature, might need some transformation | ||
139 | * channel needs not to be configured */ | ||
140 | int imx233_lradc_sense_ext_temperature(int chan, int sensor); | ||
132 | 141 | ||
133 | void imx233_lradc_setup_battery_conversion(bool automatic, unsigned long scale_factor); | 142 | void imx233_lradc_setup_battery_conversion(bool automatic, unsigned long scale_factor); |
134 | // read scaled voltage, only available after proper setup | 143 | // read scaled voltage, only available after proper setup |