Explorar el Código

Merge branch 'bugfix/add_adc-dma_for_esp32' into 'master'

driver(adc): add adc-dma code for esp32

Closes IDF-1407

See merge request espressif/esp-idf!9139

(cherry picked from commit 7876d7f5a6eb899a6c92194412372d7eabf8d823)

bd92e951 driver(adc): add adc-dma code for esp32
Michael (XIAO Xufeng) hace 5 años
padre
commit
f3705832fd

+ 28 - 6
components/driver/esp32/adc.c

@@ -42,7 +42,6 @@
 
 #define ADC_MAX_MEAS_NUM_DEFAULT      (255)
 #define ADC_MEAS_NUM_LIM_DEFAULT      (1)
-#define SAR_ADC_CLK_DIV_DEFUALT       (2)
 
 #define DIG_ADC_OUTPUT_FORMAT_DEFUALT (ADC_DIGI_FORMAT_12BIT)
 #define DIG_ADC_ATTEN_DEFUALT         (ADC_ATTEN_DB_11)
@@ -96,14 +95,13 @@ esp_err_t adc_i2s_mode_init(adc_unit_t adc_unit, adc_channel_t channel)
         ADC_CHANNEL_CHECK(ADC_NUM_2, channel);
     }
 
-    adc_hal_digi_pattern_table_t adc1_pattern[1];
-    adc_hal_digi_pattern_table_t adc2_pattern[1];
-    adc_hal_digi_config_t dig_cfg = {
+    adc_digi_pattern_table_t adc1_pattern[1];
+    adc_digi_pattern_table_t adc2_pattern[1];
+    adc_digi_config_t dig_cfg = {
         .conv_limit_en = ADC_MEAS_NUM_LIM_DEFAULT,
         .conv_limit_num = ADC_MAX_MEAS_NUM_DEFAULT,
-        .clk_div = SAR_ADC_CLK_DIV_DEFUALT,
         .format = DIG_ADC_OUTPUT_FORMAT_DEFUALT,
-        .conv_mode = (adc_hal_digi_convert_mode_t)adc_unit,
+        .conv_mode = (adc_digi_convert_mode_t)adc_unit,
     };
 
     if (adc_unit & ADC_UNIT_1) {
@@ -129,6 +127,30 @@ esp_err_t adc_i2s_mode_init(adc_unit_t adc_unit, adc_channel_t channel)
     return ESP_OK;
 }
 
+esp_err_t adc_digi_init(void)
+{
+    ADC_ENTER_CRITICAL();
+    adc_hal_digi_init();
+    ADC_EXIT_CRITICAL();
+    return ESP_OK;
+}
+
+esp_err_t adc_digi_deinit(void)
+{
+    ADC_ENTER_CRITICAL();
+    adc_hal_digi_deinit();
+    ADC_EXIT_CRITICAL();
+    return ESP_OK;
+}
+
+esp_err_t adc_digi_controller_config(const adc_digi_config_t *config)
+{
+    ADC_ENTER_CRITICAL();
+    adc_hal_digi_controller_config(config);
+    ADC_EXIT_CRITICAL();
+    return ESP_OK;
+}
+
 /*---------------------------------------------------------------
                     RTC controller setting
 ---------------------------------------------------------------*/

+ 1 - 1
components/driver/esp32s2/adc.c

@@ -73,7 +73,7 @@ esp_err_t adc_digi_init(void)
 esp_err_t adc_digi_deinit(void)
 {
     ADC_ENTER_CRITICAL();
-    adc_hal_digi_init();
+    adc_hal_digi_deinit();
     ADC_EXIT_CRITICAL();
     return ESP_OK;
 }

+ 0 - 23
components/driver/esp32s2/include/driver/adc.h

@@ -44,29 +44,6 @@ esp_err_t adc_arbiter_config(adc_unit_t adc_unit, adc_arbiter_t *config);
 /*---------------------------------------------------------------
                     Digital controller setting
 ---------------------------------------------------------------*/
-/**
- * @brief ADC digital controller initialization.
- * @return
- *      - ESP_OK Success
- */
-esp_err_t adc_digi_init(void);
-
-/**
- * @brief ADC digital controller deinitialization.
- * @return
- *      - ESP_OK Success
- */
-esp_err_t adc_digi_deinit(void);
-
-/**
- * @brief Setting the digital controller.
- *
- * @param config Pointer to digital controller paramter. Refer to `adc_digi_config_t`.
- *
- * @return
- *      - ESP_OK Success
- */
-esp_err_t adc_digi_controller_config(const adc_digi_config_t *config);
 
 /**
  * @brief Enable digital controller to trigger the measurement.

+ 56 - 21
components/driver/include/driver/adc_common.h

@@ -84,6 +84,35 @@ typedef enum {
     ADC_ENCODE_MAX,
 } adc_i2s_encode_t;
 
+/*---------------------------------------------------------------
+                    Common setting
+---------------------------------------------------------------*/
+
+/**
+ * @brief Enable ADC power
+ */
+void adc_power_on(void);
+
+/**
+ * @brief Power off SAR ADC
+ * This function will force power down for ADC
+ */
+void adc_power_off(void);
+
+/**
+ * @brief Initialize ADC pad
+ * @param adc_unit ADC unit index
+ * @param channel ADC channel index
+ * @return
+ *     - ESP_OK success
+ *     - ESP_ERR_INVALID_ARG Parameter error
+ */
+esp_err_t adc_gpio_init(adc_unit_t adc_unit, adc_channel_t channel);
+
+/*---------------------------------------------------------------
+                    RTC controller setting
+---------------------------------------------------------------*/
+
 /**
  * @brief Get the GPIO number of a specific ADC1 channel.
  *
@@ -173,27 +202,6 @@ esp_err_t adc1_config_width(adc_bits_width_t width_bit);
  */
 int adc1_get_raw(adc1_channel_t channel);
 
-/**
- * @brief Enable ADC power
- */
-void adc_power_on(void);
-
-/**
- * @brief Power off SAR ADC
- * This function will force power down for ADC
- */
-void adc_power_off(void);
-
-/**
- * @brief Initialize ADC pad
- * @param adc_unit ADC unit index
- * @param channel ADC channel index
- * @return
- *     - ESP_OK success
- *     - ESP_ERR_INVALID_ARG Parameter error
- */
-esp_err_t adc_gpio_init(adc_unit_t adc_unit, adc_channel_t channel);
-
 /**
  * @brief Set ADC data invert
  * @param adc_unit ADC unit index
@@ -345,6 +353,33 @@ esp_err_t adc_vref_to_gpio(adc_unit_t adc_unit, gpio_num_t gpio);
  *                  - ESP_ERR_INVALID_ARG: Unsupported GPIO
  */
 esp_err_t adc2_vref_to_gpio(gpio_num_t gpio) __attribute__((deprecated));
+/*---------------------------------------------------------------
+                    Digital controller setting
+---------------------------------------------------------------*/
+
+/**
+ * @brief ADC digital controller initialization.
+ * @return
+ *      - ESP_OK Success
+ */
+esp_err_t adc_digi_init(void);
+
+/**
+ * @brief ADC digital controller deinitialization.
+ * @return
+ *      - ESP_OK Success
+ */
+esp_err_t adc_digi_deinit(void);
+
+/**
+ * @brief Setting the digital controller.
+ *
+ * @param config Pointer to digital controller paramter. Refer to `adc_digi_config_t`.
+ *
+ * @return
+ *      - ESP_OK Success
+ */
+esp_err_t adc_digi_controller_config(const adc_digi_config_t *config);
 
 #ifdef __cplusplus
 }

+ 16 - 0
components/soc/include/hal/adc_hal.h

@@ -185,6 +185,22 @@ int adc_hal_convert(adc_ll_num_t adc_n, int channel, int *value);
 /*---------------------------------------------------------------
                     Digital controller setting
 ---------------------------------------------------------------*/
+/**
+ * Digital controller initialization.
+ */
+void adc_hal_digi_init(void);
+
+/**
+ * Digital controller deinitialization.
+ */
+void adc_hal_digi_deinit(void);
+
+/**
+ * Setting the digital controller.
+ *
+ * @param cfg Pointer to digital controller paramter.
+ */
+void adc_hal_digi_controller_config(const adc_digi_config_t *cfg);
 
 /**
  * Reset the pattern table pointer, then take the measurement rule from table header in next measurement.

+ 95 - 81
components/soc/include/hal/adc_types.h

@@ -75,6 +75,49 @@ typedef enum {
     ADC_WIDTH_MAX,
 } adc_bits_width_t;
 
+/**
+ * @brief ADC digital controller (DMA mode) work mode.
+ *
+ * @note  The conversion mode affects the sampling frequency:
+ *        SINGLE_UNIT_1: When the measurement is triggered, only ADC1 is sampled once.
+ *        SINGLE_UNIT_2: When the measurement is triggered, only ADC2 is sampled once.
+ *        BOTH_UNIT    : When the measurement is triggered, ADC1 and ADC2 are sampled at the same time.
+ *        ALTER_UNIT   : When the measurement is triggered, ADC1 or ADC2 samples alternately.
+ */
+typedef enum {
+    ADC_CONV_SINGLE_UNIT_1 = 1, /*!< SAR ADC 1. */
+    ADC_CONV_SINGLE_UNIT_2 = 2, /*!< SAR ADC 2. */
+    ADC_CONV_BOTH_UNIT     = 3, /*!< SAR ADC 1 and 2. */
+    ADC_CONV_ALTER_UNIT    = 7, /*!< SAR ADC 1 and 2 alternative mode. */
+    ADC_CONV_UNIT_MAX,
+} adc_digi_convert_mode_t;
+
+/**
+ * @brief ADC digital controller (DMA mode) conversion rules setting.
+ */
+typedef struct {
+    union {
+        struct {
+            uint8_t atten:     2;   /*!< ADC sampling voltage attenuation configuration.
+                                         0: input voltage * 1;
+                                         1: input voltage * 1/1.34;
+                                         2: input voltage * 1/2;
+                                         3: input voltage * 1/3.6. */
+#ifdef CONFIG_IDF_TARGET_ESP32
+            uint8_t bit_width: 2;   /*!< ADC resolution.
+-                                         0: 9 bit;
+-                                         1: 10 bit;
+-                                         2: 11 bit;
+-                                         3: 12 bit. */
+#elif CONFIG_IDF_TARGET_ESP32S2
+            uint8_t reserved:  2;   /*!< reserved0 */
+#endif
+            uint8_t channel:   4;   /*!< ADC channel index. */
+        };
+        uint8_t val;
+    };
+} adc_digi_pattern_table_t;
+
 /**
  * @brief ADC digital controller (DMA mode) output data format option.
  */
@@ -127,90 +170,12 @@ typedef struct {
     uint32_t div_a;     /*!<Division factor. Range: 0 ~ 63. */
 } adc_digi_clk_t;
 
-/**
- * @brief ADC arbiter work mode option.
- *
- * @note ESP32S2: Only ADC2 support arbiter.
- */
-typedef enum {
-    ADC_ARB_MODE_SHIELD,/*!<Force shield arbiter, Select the highest priority controller to work. */
-    ADC_ARB_MODE_FIX,   /*!<Fixed priority switch controller mode. */
-    ADC_ARB_MODE_LOOP,  /*!<Loop priority switch controller mode. Each controller has the same priority,
-                            and the arbiter will switch to the next controller after the measurement is completed. */
-} adc_arbiter_mode_t;
-
-/**
- * @brief ADC arbiter work mode and priority setting.
- *
- * @note ESP32S2: Only ADC2 support arbiter.
- */
-typedef struct {
-    adc_arbiter_mode_t mode; /*!<Refer to ``adc_arbiter_mode_t``. Note: only support ADC2. */
-    uint8_t rtc_pri;        /*!<RTC controller priority. Range: 0 ~ 2. */
-    uint8_t dig_pri;        /*!<Digital controller priority. Range: 0 ~ 2. */
-    uint8_t pwdet_pri;      /*!<Wi-Fi controller priority. Range: 0 ~ 2. */
-} adc_arbiter_t;
-
-/**
- * @brief ADC arbiter default configuration.
- *
- * @note ESP32S2: Only ADC2 support arbiter.
- */
-#define ADC_ARBITER_CONFIG_DEFAULT() { \
-    .mode = ADC_ARB_MODE_FIX, \
-    .rtc_pri = 1, \
-    .dig_pri = 0, \
-    .pwdet_pri = 2, \
-}
-
-/**
- * @brief ADC digital controller (DMA mode) work mode.
- *
- * @note  The conversion mode affects the sampling frequency:
- *        SINGLE_UNIT_1: When the measurement is triggered, only ADC1 is sampled once.
- *        SINGLE_UNIT_2: When the measurement is triggered, only ADC2 is sampled once.
- *        BOTH_UNIT    : When the measurement is triggered, ADC1 and ADC2 are sampled at the same time.
- *        ALTER_UNIT   : When the measurement is triggered, ADC1 or ADC2 samples alternately.
- */
-typedef enum {
-    ADC_CONV_SINGLE_UNIT_1 = 1, /*!< SAR ADC 1. */
-    ADC_CONV_SINGLE_UNIT_2 = 2, /*!< SAR ADC 2. */
-    ADC_CONV_BOTH_UNIT     = 3, /*!< SAR ADC 1 and 2. */
-    ADC_CONV_ALTER_UNIT    = 7, /*!< SAR ADC 1 and 2 alternative mode. */
-    ADC_CONV_UNIT_MAX,
-} adc_digi_convert_mode_t;
-
-/**
- * @brief ADC digital controller (DMA mode) conversion rules setting.
- */
-typedef struct {
-    union {
-        struct {
-            uint8_t atten:     2;   /*!< ADC sampling voltage attenuation configuration.
-                                         0: input voltage * 1;
-                                         1: input voltage * 1/1.34;
-                                         2: input voltage * 1/2;
-                                         3: input voltage * 1/3.6. */
-            uint8_t reserved:  2;   /*!< reserved0 */
-            uint8_t channel:   4;   /*!< ADC channel index. */
-        };
-        uint8_t val;                /*!< Raw entry value */
-    };
-} adc_digi_pattern_table_t;
-
-/**
- * @brief ADC digital controller (DMA mode) interrupt type options.
- */
-typedef enum {
-    ADC_DIGI_INTR_MASK_MONITOR = 0x1,
-    ADC_DIGI_INTR_MASK_MEAS_DONE = 0x2,
-    ADC_DIGI_INTR_MASK_ALL = 0x3,
-} adc_digi_intr_t;
+#endif //CONFIG_IDF_TARGET_ESP32S2
 
 /**
  * @brief ADC digital controller (DMA mode) configuration parameters.
  *
- * Example setting: Use ADC1 channel0 to measure voltage, the sampling rate is required to be 1KHz:
+ * ESP32S2: Example setting: Use ADC1 channel0 to measure voltage, the sampling rate is required to be 1KHz:
  *     +---------------------+--------+--------+--------+
  *     | sample rate         |  1KHz  |  1KHz  |  1KHz  |
  *     +---------------------+--------+--------+--------+
@@ -225,7 +190,7 @@ typedef enum {
  *     | `trigger_meas_freq` |  1KHz  |  1KHz  |  2KHz  |
  *     +---------------------+--------+--------+--------+
  *
- * Explain the relationship between `conv_limit_num`, `dma_eof_num` and the number of DMA output:
+ * ESP32S2: Explain the relationship between `conv_limit_num`, `dma_eof_num` and the number of DMA output:
  *     +---------------------+--------+--------+--------+
  *     | conv_mode           | single |  both  |  alter |
  *     +---------------------+--------+--------+--------+
@@ -249,6 +214,7 @@ typedef struct {
     adc_digi_pattern_table_t *adc2_pattern;  /*!<Refer to ``adc1_pattern`` */
     adc_digi_convert_mode_t conv_mode;       /*!<ADC conversion mode for digital controller. See ``adc_digi_convert_mode_t``. */
     adc_digi_output_format_t format;         /*!<ADC output data format for digital controller. See ``adc_digi_output_format_t``. */
+#ifdef CONFIG_IDF_TARGET_ESP32S2
     uint32_t interval;          /*!<The number of interval clock cycles for the digital controller to trigger the measurement.
                                     The unit is the divided clock. Range: 40 ~ 4095.
                                     Expression: `trigger_meas_freq` = `controller_clk` / 2 / interval. Refer to ``adc_digi_clk_t``.
@@ -257,8 +223,56 @@ typedef struct {
     uint32_t dma_eof_num;       /*!<DMA eof num of adc digital controller.
                                     If the number of measurements reaches `dma_eof_num`, then `dma_in_suc_eof` signal is generated in DMA.
                                     Note: The converted data in the DMA in link buffer will be multiple of two bytes. */
+#endif
 } adc_digi_config_t;
 
+#ifdef CONFIG_IDF_TARGET_ESP32S2
+
+/**
+ * @brief ADC arbiter work mode option.
+ *
+ * @note ESP32S2: Only ADC2 support arbiter.
+ */
+typedef enum {
+    ADC_ARB_MODE_SHIELD,/*!<Force shield arbiter, Select the highest priority controller to work. */
+    ADC_ARB_MODE_FIX,   /*!<Fixed priority switch controller mode. */
+    ADC_ARB_MODE_LOOP,  /*!<Loop priority switch controller mode. Each controller has the same priority,
+                            and the arbiter will switch to the next controller after the measurement is completed. */
+} adc_arbiter_mode_t;
+
+/**
+ * @brief ADC arbiter work mode and priority setting.
+ *
+ * @note ESP32S2: Only ADC2 support arbiter.
+ */
+typedef struct {
+    adc_arbiter_mode_t mode; /*!<Refer to ``adc_arbiter_mode_t``. Note: only support ADC2. */
+    uint8_t rtc_pri;        /*!<RTC controller priority. Range: 0 ~ 2. */
+    uint8_t dig_pri;        /*!<Digital controller priority. Range: 0 ~ 2. */
+    uint8_t pwdet_pri;      /*!<Wi-Fi controller priority. Range: 0 ~ 2. */
+} adc_arbiter_t;
+
+/**
+ * @brief ADC arbiter default configuration.
+ *
+ * @note ESP32S2: Only ADC2 support arbiter.
+ */
+#define ADC_ARBITER_CONFIG_DEFAULT() { \
+    .mode = ADC_ARB_MODE_FIX, \
+    .rtc_pri = 1, \
+    .dig_pri = 0, \
+    .pwdet_pri = 2, \
+}
+
+/**
+ * @brief ADC digital controller (DMA mode) interrupt type options.
+ */
+typedef enum {
+    ADC_DIGI_INTR_MASK_MONITOR = 0x1,
+    ADC_DIGI_INTR_MASK_MEAS_DONE = 0x2,
+    ADC_DIGI_INTR_MASK_ALL = 0x3,
+} adc_digi_intr_t;
+
 /**
  * @brief ADC digital controller (DMA mode) filter index options.
  *

+ 3 - 1
components/soc/soc/esp32/include/soc/adc_caps.h

@@ -26,4 +26,6 @@
 
 #define SOC_ADC_PWDET_CCT_DEFAULT           (4)
 
-#define SOC_ADC_SAR_CLK_DIV_DEFAULT(PERIPH_NUM) (2)
+#define SOC_ADC_SAR_CLK_DIV_DEFAULT(PERIPH_NUM) (2)
+
+#define SOC_ADC_DIGI_SAR_CLK_DIV_DEFAULT    (2)

+ 2 - 4
components/soc/src/esp32/adc_hal.c

@@ -20,8 +20,7 @@
 void adc_hal_digi_init(void)
 {
     adc_hal_init();
-    adc_hal_set_sar_clk_div(ADC_NUM_1, SOC_ADC_SAR_CLK_DIV_DEFAULT(ADC_NUM_1));
-    adc_hal_set_sar_clk_div(ADC_NUM_2, SOC_ADC_SAR_CLK_DIV_DEFAULT(ADC_NUM_2));
+    adc_ll_digi_set_clk_div(SOC_ADC_DIGI_SAR_CLK_DIV_DEFAULT);
 }
 
 void adc_hal_digi_deinit(void)
@@ -31,11 +30,10 @@ void adc_hal_digi_deinit(void)
     adc_hal_deinit();
 }
 
-void adc_hal_digi_controller_config(const adc_hal_digi_config_t *cfg)
+void adc_hal_digi_controller_config(const adc_digi_config_t *cfg)
 {
     /* If enable digital controller, adc xpd should always on. */
     adc_ll_set_power_manage(ADC_POWER_SW_ON);
-    adc_ll_digi_set_clk_div(cfg->clk_div);
     /* Single channel mode or multi channel mode. */
     adc_ll_digi_set_convert_mode(cfg->conv_mode);
     if (cfg->conv_mode & ADC_CONV_SINGLE_UNIT_1) {

+ 0 - 33
components/soc/src/esp32/include/hal/adc_hal.h

@@ -31,22 +31,6 @@
 extern "C" {
 #endif
 
-typedef struct {
-    bool conv_limit_en;         /*!<Enable max conversion number detection for digital controller.
-                                    If the number of ADC conversion is equal to the `limit_num`, the conversion is stopped. */
-    uint32_t conv_limit_num;    /*!<ADC max conversion number for digital controller. */
-    uint32_t adc1_pattern_len;  /*!<Pattern table length for digital controller. Range: 0 ~ 16.
-                                    The pattern table that defines the conversion rules for each SAR ADC. Each table has 16 items, in which channel selection,
-                                    resolution and attenuation are stored. When the conversion is started, the controller reads conversion rules from the
-                                    pattern table one by one. For each controller the scan sequence has at most 16 different rules before repeating itself. */
-    uint32_t adc2_pattern_len;  /*!<Refer to `adc1_pattern_len` */
-    adc_hal_digi_pattern_table_t *adc1_pattern;   /*!<Pointer to pattern table for digital controller. The table size defined by `adc1_pattern_len`. */
-    adc_hal_digi_pattern_table_t *adc2_pattern;   /*!<Refer to `adc1_pattern` */
-    adc_hal_digi_convert_mode_t conv_mode;        /*!<ADC conversion mode for digital controller. ESP32 only support ADC1 single mode. */
-    adc_digi_output_format_t format;      /*!<ADC output data format for digital controller. */
-    uint32_t clk_div;           /*!< ADC module clock division factor. ADC clock divided from APB clock.*/
-} adc_hal_digi_config_t;
-
 /*---------------------------------------------------------------
                     Digital controller setting
 ---------------------------------------------------------------*/
@@ -58,27 +42,10 @@ typedef struct {
  */
 #define adc_hal_digi_set_data_source(src) adc_ll_digi_set_data_source(src)
 
-/**
- * Setting the digital controller.
- *
- * @prarm adc_digi_config_t cfg Pointer to digital controller paramter.
- */
-void adc_hal_digi_controller_config(const adc_hal_digi_config_t *cfg);
-
 /*---------------------------------------------------------------
                     Common setting
 ---------------------------------------------------------------*/
 
-/**
- * @brief ADC digital controller initialization.
- */
-void adc_hal_digi_init(void);
-
-/**
- * @brief ADC digital controller deinitialization.
- */
-void adc_hal_digi_deinit(void);
-
 /*---------------------------------------------------------------
                     Hall sensor setting
 ---------------------------------------------------------------*/

+ 4 - 31
components/soc/src/esp32/include/hal/adc_ll.h

@@ -8,39 +8,12 @@
 extern "C" {
 #endif
 
-typedef enum {
-    ADC_CONV_SINGLE_UNIT_1 = 1, /*!< SAR ADC 1*/
-    ADC_CONV_SINGLE_UNIT_2 = 2, /*!< SAR ADC 2, not supported yet*/
-    ADC_CONV_BOTH_UNIT     = 3, /*!< SAR ADC 1 and 2, not supported yet */
-    ADC_CONV_ALTER_UNIT    = 7, /*!< SAR ADC 1 and 2 alternative mode, not supported yet */
-    ADC_CONV_UNIT_MAX,
-} adc_hal_digi_convert_mode_t;
-
 typedef enum {
     ADC_NUM_1 = 0,          /*!< SAR ADC 1 */
     ADC_NUM_2 = 1,          /*!< SAR ADC 2 */
     ADC_NUM_MAX,
 } adc_ll_num_t;
 
-typedef struct {
-    union {
-        struct {
-            uint8_t atten:     2;   /*!< ADC sampling voltage attenuation configuration.
-                                         0: input voltage * 1;
-                                         1: input voltage * 1/1.34;
-                                         2: input voltage * 1/2;
-                                         3: input voltage * 1/3.6. */
-            uint8_t bit_width: 2;   /*!< ADC resolution.
-                                         0: 9 bit;
-                                         1: 10 bit;
-                                         2: 11 bit;
-                                         3: 12 bit. */
-            uint8_t channel:   4;   /*!< ADC channel index. */
-        };
-        uint8_t val;
-    };
-} adc_hal_digi_pattern_table_t;
-
 typedef enum {
     ADC_POWER_BY_FSM,   /*!< ADC XPD controlled by FSM. Used for polling mode */
     ADC_POWER_SW_ON,    /*!< ADC XPD controlled by SW. power on. Used for DMA mode */
@@ -151,9 +124,9 @@ static inline void adc_ll_digi_convert_limit_disable(void)
  *
  * @note ESP32 only support ADC1 single mode.
  *
- * @param mode Conversion mode select, see ``adc_hal_digi_convert_mode_t``.
+ * @param mode Conversion mode select, see ``adc_digi_convert_mode_t``.
  */
-static inline void adc_ll_digi_set_convert_mode(adc_hal_digi_convert_mode_t mode)
+static inline void adc_ll_digi_set_convert_mode(adc_digi_convert_mode_t mode)
 {
     if (mode == ADC_CONV_SINGLE_UNIT_1) {
         SYSCON.saradc_ctrl.work_mode = 0;
@@ -219,9 +192,9 @@ static inline void adc_ll_digi_set_pattern_table_len(adc_ll_num_t adc_n, uint32_
  *
  * @param adc_n ADC unit.
  * @param pattern_index Items index. Range: 0 ~ 15.
- * @param pattern Stored conversion rules, see ``adc_hal_digi_pattern_table_t``.
+ * @param pattern Stored conversion rules, see ``adc_digi_pattern_table_t``.
  */
-static inline void adc_ll_digi_set_pattern_table(adc_ll_num_t adc_n, uint32_t pattern_index, adc_hal_digi_pattern_table_t pattern)
+static inline void adc_ll_digi_set_pattern_table(adc_ll_num_t adc_n, uint32_t pattern_index, adc_digi_pattern_table_t pattern)
 {
     uint32_t tab;
     uint8_t index = pattern_index / 4;

+ 0 - 17
components/soc/src/esp32s2/include/hal/adc_hal.h

@@ -34,23 +34,6 @@ extern "C" {
 /*---------------------------------------------------------------
                     Digital controller setting
 ---------------------------------------------------------------*/
-/**
- * Digital controller initialization.
- */
-void adc_hal_digi_init(void);
-
-/**
- * Digital controller deinitialization.
- */
-void adc_hal_digi_deinit(void);
-
-/**
- * Setting the digital controller.
- *
- * @param cfg Pointer to digital controller paramter.
- */
-void adc_hal_digi_controller_config(const adc_digi_config_t *cfg);
-
 /**
  * ADC Digital controller output data invert or not.
  *