diff options
| author | Z8MAN8 <[email protected]> | 2024-08-05 15:48:30 +0800 |
|---|---|---|
| committer | Rbb666 <[email protected]> | 2024-08-07 11:15:37 +0800 |
| commit | dc95efe17cfe8a9bc9d0c2705545d839a9145836 (patch) | |
| tree | 3e73cbafecb354181bded12a40bcf8d13ef6f164 | |
| parent | 4633200e98ce9303295a0e7369ee78606afc49c7 (diff) | |
bsp: cvitek: add support for RTCSYS_SARADC
Cvitek adc dirver only supports one adc controller now,
but the other adc controller RTCSYS_SARADC is missing.
Signed-off-by: Shicheng Chu <[email protected]>
Reviewed-by: Chen Wang <[email protected]>
| -rw-r--r-- | bsp/cvitek/drivers/drv_adc.c | 18 | ||||
| -rw-r--r-- | bsp/cvitek/drivers/drv_adc.h | 1 |
2 files changed, 15 insertions, 4 deletions
diff --git a/bsp/cvitek/drivers/drv_adc.c b/bsp/cvitek/drivers/drv_adc.c index 86cde2aabb..7108de75a8 100644 --- a/bsp/cvitek/drivers/drv_adc.c +++ b/bsp/cvitek/drivers/drv_adc.c @@ -68,10 +68,18 @@ struct cvi_adc_dev static struct cvi_adc_dev adc_dev_config[] = { +#ifdef BSP_USING_ADC_ACTIVE { .name = "adc1", .base = SARADC_BASE }, +#endif /* BSP_USING_ADC_ACTIVE */ +#ifdef BSP_USING_ADC_NODIE + { + .name = "adc2", + .base = RTC_ADC_BASE + }, +#endif /* BSP_USING_ADC_NODIE */ }; static rt_err_t _adc_enabled(struct rt_adc_device *device, rt_int8_t channel, rt_bool_t enabled) @@ -151,8 +159,6 @@ static const struct rt_adc_ops _adc_ops = * cv180xb supports * - adc1 & adc2 for active domain * - adc3 for no-die domain - * - * FIXME: currnet adc driver only support adc1 in active domain */ #ifdef BSP_USING_ADC_ACTIVE static const char *pinname_whitelist_adc1_active[] = { @@ -169,12 +175,15 @@ static const char *pinname_whitelist_adc3_active[] = { #ifdef BSP_USING_ADC_NODIE static const char *pinname_whitelist_adc1_nodie[] = { + "PWR_GPIO2", NULL, }; static const char *pinname_whitelist_adc2_nodie[] = { + "PWR_GPIO1", NULL, }; static const char *pinname_whitelist_adc3_nodie[] = { + "PWR_VBAT_DET", NULL, }; #endif @@ -185,8 +194,6 @@ static const char *pinname_whitelist_adc3_nodie[] = { * sg2002 supports * - adc1 for active domain * - adc1/adc2/adc3 for no-die domain - * - * FIXME: currnet adc driver only support adc1 in active domain */ #ifdef BSP_USING_ADC_ACTIVE @@ -204,12 +211,15 @@ static const char *pinname_whitelist_adc3_active[] = { #ifdef BSP_USING_ADC_NODIE static const char *pinname_whitelist_adc1_nodie[] = { + "PWR_GPIO2", NULL, }; static const char *pinname_whitelist_adc2_nodie[] = { + "PWR_GPIO1", NULL, }; static const char *pinname_whitelist_adc3_nodie[] = { + "PWR_VBAT_DET", NULL, }; #endif diff --git a/bsp/cvitek/drivers/drv_adc.h b/bsp/cvitek/drivers/drv_adc.h index 8cbec51b48..a3cc63faa4 100644 --- a/bsp/cvitek/drivers/drv_adc.h +++ b/bsp/cvitek/drivers/drv_adc.h @@ -14,6 +14,7 @@ #include "mmio.h" #define SARADC_BASE 0x030F0000 +#define RTC_ADC_BASE 0x0502C000 #define SARADC_CH_MAX 3 #define SARADC_CTRL_OFFSET 0x04 |
