Просмотр исходного кода

Merge branch 'bugfix/coverity_driver_issue_clean' into 'master'

fix driver issue found by coverity

See merge request espressif/esp-idf!19145
morris 3 лет назад
Родитель
Сommit
a56f68acd9
56 измененных файлов с 203 добавлено и 339 удалено
  1. 7 5
      components/bootloader_support/include/bootloader_util.h
  2. 4 10
      components/driver/CMakeLists.txt
  3. 2 1
      components/driver/include/driver/can.h
  4. 0 2
      components/driver/include/driver/mcpwm.h
  5. 2 2
      components/driver/include/driver/rmt_types.h
  6. 8 3
      components/driver/include/driver/sdmmc_defs.h
  7. 8 3
      components/driver/include/driver/sdmmc_types.h
  8. 4 0
      components/driver/include/driver/touch_pad.h
  9. 2 0
      components/driver/mcpwm.c
  10. 1 1
      components/driver/test_apps/rmt/main/test_rmt_rx.c
  11. 3 3
      components/driver/test_apps/rmt/main/test_rmt_tx.c
  12. 1 1
      components/esp_adc/adc_continuous.c
  13. 9 9
      components/esp_adc/adc_lock.c
  14. 6 6
      components/esp_adc/include/esp_private/adc_lock.h
  15. 4 4
      components/esp_common/include/esp_compiler.h
  16. 3 5
      components/esp_hw_support/include/esp_sleep.h
  17. 3 3
      components/esp_hw_support/sleep_modes.c
  18. 5 13
      components/hal/include/hal/can_types.h
  19. 1 1
      components/hal/include/hal/dac_types.h
  20. 9 0
      components/hal/include/hal/mcpwm_types.h
  21. 7 13
      components/heap/include/esp_heap_task_info.h
  22. 4 0
      components/soc/esp32/include/soc/Kconfig.soc_caps.in
  23. 1 0
      components/soc/esp32/include/soc/soc_caps.h
  24. 6 14
      components/soc/esp32/touch_sensor_periph.c
  25. 0 4
      components/soc/esp32c2/include/soc/Kconfig.soc_caps.in
  26. 0 3
      components/soc/esp32c2/include/soc/soc_caps.h
  27. 2 6
      components/soc/esp32c2/include/soc/uart_struct.h
  28. 0 4
      components/soc/esp32c3/include/soc/Kconfig.soc_caps.in
  29. 10 17
      components/soc/esp32c3/include/soc/apb_saradc_struct.h
  30. 0 3
      components/soc/esp32c3/include/soc/soc_caps.h
  31. 0 4
      components/soc/esp32h2/include/soc/Kconfig.soc_caps.in
  32. 0 3
      components/soc/esp32h2/include/soc/soc_caps.h
  33. 4 0
      components/soc/esp32s2/include/soc/Kconfig.soc_caps.in
  34. 10 17
      components/soc/esp32s2/include/soc/apb_saradc_struct.h
  35. 9 16
      components/soc/esp32s2/include/soc/i2c_struct.h
  36. 1 0
      components/soc/esp32s2/include/soc/soc_caps.h
  37. 10 17
      components/soc/esp32s2/include/soc/spi_mem_struct.h
  38. 10 17
      components/soc/esp32s2/include/soc/spi_struct.h
  39. 6 14
      components/soc/esp32s2/touch_sensor_periph.c
  40. 4 0
      components/soc/esp32s3/include/soc/Kconfig.soc_caps.in
  41. 1 1
      components/soc/esp32s3/include/soc/soc_caps.h
  42. 1 1
      components/soc/esp32s3/touch_sensor_periph.c
  43. 0 37
      components/soc/esp32s3/usb_periph.h
  44. 6 14
      components/soc/include/soc/touch_sensor_periph.h
  45. 1 1
      docs/conf_common.py
  46. 1 1
      docs/en/api-reference/peripherals/index.rst
  47. 8 8
      docs/en/api-reference/peripherals/rmt.rst
  48. 2 2
      docs/en/api-reference/system/sleep_modes.rst
  49. 1 1
      docs/zh_CN/api-reference/peripherals/index.rst
  50. 6 6
      docs/zh_CN/api-reference/system/sleep_modes.rst
  51. 1 1
      examples/peripherals/.build-test-rules.yml
  52. 1 1
      examples/peripherals/rmt/ir_nec_transceiver/main/ir_nec_transceiver_main.c
  53. 5 5
      examples/peripherals/rmt/onewire_ds18b20/components/onewire_bus/onewire_bus_rmt.c
  54. 1 1
      examples/system/deep_sleep/main/deep_sleep_example_main.c
  55. 0 9
      tools/ci/check_copyright_ignore.txt
  56. 2 26
      tools/ci/check_public_headers_exceptions.txt

+ 7 - 5
components/bootloader_support/include/bootloader_util.h

@@ -6,7 +6,9 @@
 
 #pragma once
 
-#include <stddef.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <assert.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -22,11 +24,11 @@ extern "C" {
  * @return true iff [start1; end1) overlaps [start2; end2)
  */
 static inline bool bootloader_util_regions_overlap(
-        const intptr_t start1, const intptr_t end1,
-        const intptr_t start2, const intptr_t end2)
+    const intptr_t start1, const intptr_t end1,
+    const intptr_t start2, const intptr_t end2)
 {
-    assert(end1>start1);
-    assert(end2>start2);
+    assert(end1 > start1);
+    assert(end2 > start2);
     return (end1 > start2 && end2 > start1);
 }
 

+ 4 - 10
components/driver/CMakeLists.txt

@@ -84,28 +84,22 @@ if(CONFIG_SOC_SPI_SUPPORT_SLAVE_HD_VER2)
     list(APPEND srcs "spi_slave_hd.c")
 endif()
 
+if(CONFIG_SOC_TOUCH_SENSOR_SUPPORTED)
+    list(APPEND srcs "touch_sensor_common.c" "${target}/touch_sensor.c")
+endif()
+
 if(${target} STREQUAL "esp32")
     list(APPEND srcs "dac_common.c"
                      "sdio_slave.c"
-                     "touch_sensor_common.c"
-                     "esp32/touch_sensor.c"
                      "deprecated/adc_i2s_deprecated.c"
                      "esp32/dac.c")
 endif()
 
 if(${target} STREQUAL "esp32s2")
     list(APPEND srcs "dac_common.c"
-                     "touch_sensor_common.c"
-                     "esp32s2/touch_sensor.c"
                      "esp32s2/dac.c")
 endif()
 
-if(${target} STREQUAL "esp32s3")
-    list(APPEND srcs "touch_sensor_common.c"
-                     "esp32s3/touch_sensor.c")
-endif()
-
-
 if(BOOTLOADER_BUILD)
     # Bootloader shall NOT depend on the drivers
     idf_component_register()

+ 2 - 1
components/driver/include/driver/can.h

@@ -43,10 +43,11 @@ extern "C" {
 #define CAN_STATE_BUS_OFF               TWAI_STATE_BUS_OFF
 #define CAN_STATE_RECOVERING            TWAI_STATE_RECOVERING
 
+#if SOC_TWAI_SUPPORTED
 typedef twai_state_t                    can_state_t;
 typedef twai_general_config_t           can_general_config_t;
 typedef twai_status_info_t              can_status_info_t;
-
+#endif // SOC_TWAI_SUPPORTED
 
 #define can_driver_install(g_config, t_config, f_config)        twai_driver_install(g_config, t_config, f_config)
 #define can_driver_uninstall()                                  twai_driver_uninstall()

+ 0 - 2
components/driver/include/driver/mcpwm.h

@@ -74,8 +74,6 @@ typedef enum {
     MCPWM_UNIT_MAX, /*!<Max number of MCPWM units*/
 } mcpwm_unit_t;
 
-_Static_assert(MCPWM_UNIT_MAX == SOC_MCPWM_GROUPS, "MCPWM unit number not equal to chip capabilities");
-
 /**
  * @brief Select MCPWM timer
  */

+ 2 - 2
components/driver/include/driver/rmt_types.h

@@ -46,7 +46,7 @@ typedef struct {
  *
  * @return Whether a high priority task has been waken up by this callback function
  */
-typedef bool (*rmt_tx_done_callback_t)(rmt_channel_handle_t tx_chan, rmt_tx_done_event_data_t *edata, void *user_ctx);
+typedef bool (*rmt_tx_done_callback_t)(rmt_channel_handle_t tx_chan, const rmt_tx_done_event_data_t *edata, void *user_ctx);
 
 /**
  * @brief Type of RMT RX done event data
@@ -65,7 +65,7 @@ typedef struct {
  * @param[in] user_ctx User registered context, passed from `rmt_rx_register_event_callbacks()`
  * @return Whether a high priority task has been waken up by this function
  */
-typedef bool (*rmt_rx_done_callback_t)(rmt_channel_handle_t rx_chan, rmt_rx_done_event_data_t *edata, void *user_ctx);
+typedef bool (*rmt_rx_done_callback_t)(rmt_channel_handle_t rx_chan, const rmt_rx_done_event_data_t *edata, void *user_ctx);
 
 #ifdef __cplusplus
 }

+ 8 - 3
components/driver/include/driver/sdmmc_defs.h

@@ -21,12 +21,15 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#ifndef _SDMMC_DEFS_H_
-#define _SDMMC_DEFS_H_
+#pragma once
 
 #include <stdint.h>
 #include <limits.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* MMC commands */                              /* response type */
 #define MMC_GO_IDLE_STATE               0       /* R0 */
 #define MMC_SEND_OP_COND                1       /* R3 */
@@ -531,4 +534,6 @@ static inline uint32_t MMC_RSP_BITS(uint32_t *src, int start, int len)
 #define SDMMC_TIMING_HIGHSPEED 1
 #define SDMMC_TIMING_MMC_DDR52 2
 
-#endif //_SDMMC_DEFS_H_
+#ifdef __cplusplus
+}
+#endif

+ 8 - 3
components/driver/include/driver/sdmmc_types.h

@@ -21,14 +21,17 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#ifndef _SDMMC_TYPES_H_
-#define _SDMMC_TYPES_H_
+#pragma once
 
 #include <stdint.h>
 #include <stddef.h>
 #include "esp_err.h"
 #include "freertos/FreeRTOS.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * Decoded values from SD card Card Specific Data register
  */
@@ -232,4 +235,6 @@ typedef enum {
     SDMMC_DISCARD_ARG = 1,    /*!< Discard operation for SD/MMC */
 } sdmmc_erase_arg_t;
 
-#endif // _SDMMC_TYPES_H_
+#ifdef __cplusplus
+}
+#endif

+ 4 - 0
components/driver/include/driver/touch_pad.h

@@ -6,4 +6,8 @@
 
 #pragma once
 
+#include "soc/soc_caps.h"
+
+#if SOC_TOUCH_SENSOR_SUPPORTED
 #include "driver/touch_sensor.h"
+#endif

+ 2 - 0
components/driver/mcpwm.c

@@ -25,6 +25,8 @@
 
 static const char *TAG = "mcpwm";
 
+_Static_assert(MCPWM_UNIT_MAX == SOC_MCPWM_GROUPS, "MCPWM unit number not equal to chip capabilities");
+
 #define MCPWM_DRIVER_INIT_ERROR "MCPWM DRIVER NOT INITIALIZED"
 #define MCPWM_GROUP_NUM_ERROR   "MCPWM GROUP NUM ERROR"
 #define MCPWM_PRESCALE_ERROR    "MCPWM PRESCALE ERROR"

+ 1 - 1
components/driver/test_apps/rmt/main/test_rmt_rx.c

@@ -26,7 +26,7 @@ typedef struct {
 } test_nec_rx_user_data_t;
 
 TEST_RMT_CALLBACK_ATTR
-static bool test_rmt_rx_done_callback(rmt_channel_handle_t channel, rmt_rx_done_event_data_t *edata, void *user_data)
+static bool test_rmt_rx_done_callback(rmt_channel_handle_t channel, const rmt_rx_done_event_data_t *edata, void *user_data)
 {
     BaseType_t high_task_wakeup = pdFALSE;
     test_nec_rx_user_data_t *test_user_data = (test_nec_rx_user_data_t *)user_data;

+ 3 - 3
components/driver/test_apps/rmt/main/test_rmt_tx.c

@@ -160,7 +160,7 @@ TEST_CASE("rmt_ping_pong_trans_with_dma", "[rmt]")
 #endif
 
 TEST_RMT_CALLBACK_ATTR
-static bool test_rmt_tx_done_cb_check_event_data(rmt_channel_handle_t channel, rmt_tx_done_event_data_t *edata, void *user_data)
+static bool test_rmt_tx_done_cb_check_event_data(rmt_channel_handle_t channel, const rmt_tx_done_event_data_t *edata, void *user_data)
 {
     uint32_t *p_expected_encoded_size = (uint32_t *)user_data;
     TEST_ASSERT_EQUAL(*p_expected_encoded_size, edata->num_symbols);
@@ -237,7 +237,7 @@ TEST_CASE("rmt_trans_done_event_callback_with_dma", "[rmt]")
 #if SOC_RMT_SUPPORT_TX_LOOP_COUNT
 
 TEST_RMT_CALLBACK_ATTR
-static bool test_rmt_loop_done_cb_check_event_data(rmt_channel_handle_t channel, rmt_tx_done_event_data_t *edata, void *user_data)
+static bool test_rmt_loop_done_cb_check_event_data(rmt_channel_handle_t channel, const rmt_tx_done_event_data_t *edata, void *user_data)
 {
     uint32_t *p_expected_encoded_size = (uint32_t *)user_data;
     TEST_ASSERT_EQUAL(*p_expected_encoded_size, edata->num_symbols);
@@ -454,7 +454,7 @@ TEST_CASE("rmt_tx_nec_carrier_with_dma", "[rmt]")
 #endif
 
 TEST_RMT_CALLBACK_ATTR
-static bool test_rmt_tx_done_cb_record_time(rmt_channel_handle_t channel, rmt_tx_done_event_data_t *edata, void *user_data)
+static bool test_rmt_tx_done_cb_record_time(rmt_channel_handle_t channel, const rmt_tx_done_event_data_t *edata, void *user_data)
 {
     int64_t *record_time = (int64_t *)user_data;
     *record_time = esp_timer_get_time();

+ 1 - 1
components/esp_adc/adc_continuous.c

@@ -346,7 +346,7 @@ static IRAM_ATTR bool s_adc_dma_intr(adc_continuous_ctx_t *adc_digi_ctx)
             //ringbuffer overflow
             if (adc_digi_ctx->cbs.on_pool_ovf) {
                 adc_continuous_evt_data_t edata = {};
-                if (adc_digi_ctx->cbs.on_conv_done(adc_digi_ctx, &edata, adc_digi_ctx->user_data)) {
+                if (adc_digi_ctx->cbs.on_pool_ovf(adc_digi_ctx, &edata, adc_digi_ctx->user_data)) {
                     need_yield |= true;
                 }
             }

+ 9 - 9
components/esp_adc/adc_lock.c

@@ -21,27 +21,27 @@ static const char *TAG = "adc_lock";
 static _lock_t adc1_lock;
 static _lock_t adc2_lock;
 
-esp_err_t adc_lock_acquire(adc_unit_t unit_mask)
+esp_err_t adc_lock_acquire(adc_unit_t adc_unit)
 {
-    if (unit_mask & ADC_UNIT_1) {
+    if (adc_unit == ADC_UNIT_1) {
         _lock_acquire(&adc1_lock);
     }
 
-    if (unit_mask & ADC_UNIT_2) {
+    if (adc_unit == ADC_UNIT_2) {
         _lock_acquire(&adc2_lock);
     }
 
     return ESP_OK;
 }
 
-esp_err_t adc_lock_release(adc_unit_t unit_mask)
+esp_err_t adc_lock_release(adc_unit_t adc_unit)
 {
-    if (unit_mask & ADC_UNIT_2) {
+    if (adc_unit == ADC_UNIT_2) {
         ESP_RETURN_ON_FALSE(((uint32_t *)adc2_lock != NULL), ESP_ERR_INVALID_STATE, TAG, "adc2 lock release without acquiring");
         _lock_release(&adc2_lock);
     }
 
-    if (unit_mask & ADC_UNIT_1) {
+    if (adc_unit == ADC_UNIT_1) {
         ESP_RETURN_ON_FALSE(((uint32_t *)adc1_lock != NULL), ESP_ERR_INVALID_STATE, TAG, "adc1 lock release without acquiring");
         _lock_release(&adc1_lock);
     }
@@ -49,15 +49,15 @@ esp_err_t adc_lock_release(adc_unit_t unit_mask)
     return ESP_OK;
 }
 
-esp_err_t adc_lock_try_acquire(adc_unit_t unit_mask)
+esp_err_t adc_lock_try_acquire(adc_unit_t adc_unit)
 {
-    if (unit_mask & ADC_UNIT_1) {
+    if (adc_unit == ADC_UNIT_1) {
         if (_lock_try_acquire(&adc1_lock) == -1) {
             return ESP_ERR_TIMEOUT;
         }
     }
 
-    if (unit_mask & ADC_UNIT_2) {
+    if (adc_unit == ADC_UNIT_2) {
         if (_lock_try_acquire(&adc2_lock) == -1) {
             return ESP_ERR_TIMEOUT;
         }

+ 6 - 6
components/esp_adc/include/esp_private/adc_lock.h

@@ -20,25 +20,25 @@ extern "C" {
  *
  * @note If any of the locks are taken, this API will wait until the lock is successfully acquired.
  *
- * @param[in] unit_mask    ADC unit mask
+ * @param[in] adc_unit ADC unit ID
  *
  * @return
  *        - ESP_OK: On success
  */
-esp_err_t adc_lock_acquire(adc_unit_t unit_mask);
+esp_err_t adc_lock_acquire(adc_unit_t adc_unit);
 
 /**
  * @brief Release ADC lock by unit
  *
  * The lock releasing sequence will be: ..., ADC2, ADC1
  *
- * @param[in] unit_mask    ADC unit mask
+ * @param[in] adc_unit ADC unit ID
  *
  * @return
  *        - ESP_OK:                On success
  *        - ESP_ERR_INVALID_STATE: The lock(s) isn't acquired yet
  */
-esp_err_t adc_lock_release(adc_unit_t unit_mask);
+esp_err_t adc_lock_release(adc_unit_t adc_unit);
 
 /**
  * @brief Try to acquire ADC lock by unit
@@ -47,13 +47,13 @@ esp_err_t adc_lock_release(adc_unit_t unit_mask);
  *
  * @note If any of the locks are taken, this API will return immediately with an error `ESP_ERR_TIMEOUT`
  *
- * @param[in] unit_mask    ADC unit mask
+ * @param[in] adc_unit ADC unit ID
  *
  * @return
  *        - ESP_OK:          On success
  *        - ESP_ERR_TIMEOUT: Lock(s) is taken already
  */
-esp_err_t adc_lock_try_acquire(adc_unit_t unit_mask);
+esp_err_t adc_lock_try_acquire(adc_unit_t adc_unit);
 
 #ifdef __cplusplus
 }

+ 4 - 4
components/esp_common/include/esp_compiler.h

@@ -3,8 +3,10 @@
  *
  * SPDX-License-Identifier: Apache-2.0
  */
-#ifndef __ESP_COMPILER_H
-#define __ESP_COMPILER_H
+
+#pragma once
+
+#include "sdkconfig.h"
 
 /*
  * The likely and unlikely macro pairs:
@@ -50,5 +52,3 @@
 #define ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_STR(member, value)  .member = value,
 #define ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_EMPTY(member)
 #endif
-
-#endif

+ 3 - 5
components/esp_hw_support/include/esp_sleep.h

@@ -129,8 +129,7 @@ esp_err_t esp_sleep_enable_ulp_wakeup(void);
  */
 esp_err_t esp_sleep_enable_timer_wakeup(uint64_t time_in_us);
 
-#if SOC_TOUCH_SENSOR_NUM > 0
-
+#if SOC_TOUCH_SENSOR_SUPPORTED
 /**
  * @brief Enable wakeup by touch sensor
  *
@@ -157,8 +156,7 @@ esp_err_t esp_sleep_enable_touchpad_wakeup(void);
  * @return touch pad which caused wakeup
  */
 touch_pad_t esp_sleep_get_touchpad_wakeup_status(void);
-
-#endif // SOC_TOUCH_SENSOR_NUM > 0
+#endif // SOC_TOUCH_SENSOR_SUPPORTED
 
 /**
  * @brief Returns true if a GPIO number is valid for use as wakeup source.
@@ -360,7 +358,7 @@ uint64_t esp_sleep_get_gpio_wakeup_status(void);
  *      - ESP_ERR_INVALID_ARG if either of the arguments is out of range
  */
 esp_err_t esp_sleep_pd_config(esp_sleep_pd_domain_t domain,
-                                   esp_sleep_pd_option_t option);
+                              esp_sleep_pd_option_t option);
 
 /**
  * @brief Enter deep sleep with the configured wakeup options

+ 3 - 3
components/esp_hw_support/sleep_modes.c

@@ -32,7 +32,7 @@
 #include "hal/wdt_hal.h"
 #include "hal/rtc_hal.h"
 #include "hal/uart_hal.h"
-#if SOC_TOUCH_SENSOR_NUM > 0
+#if SOC_TOUCH_SENSOR_SUPPORTED
 #include "hal/touch_sensor_hal.h"
 #include "driver/touch_sensor.h"
 #include "driver/touch_sensor_common.h"
@@ -899,7 +899,7 @@ static void touch_wakeup_prepare(void)
 }
 #endif
 
-#if SOC_TOUCH_SENSOR_NUM > 0
+#if SOC_TOUCH_SENSOR_SUPPORTED
 
 esp_err_t esp_sleep_enable_touchpad_wakeup(void)
 {
@@ -926,7 +926,7 @@ touch_pad_t esp_sleep_get_touchpad_wakeup_status(void)
     return (ret == ESP_OK) ? pad_num : TOUCH_PAD_MAX;
 }
 
-#endif // SOC_TOUCH_SENSOR_NUM > 0
+#endif // SOC_TOUCH_SENSOR_SUPPORTED
 
 bool esp_sleep_is_valid_wakeup_gpio(gpio_num_t gpio_num)
 {

+ 5 - 13
components/hal/esp32/include/hal/can_types.h → components/hal/include/hal/can_types.h

@@ -1,16 +1,8 @@
-// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
+/*
+ * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
 
 #pragma once
 

+ 1 - 1
components/hal/include/hal/dac_types.h

@@ -40,7 +40,7 @@ typedef struct {
                                  Note: Unreasonable settings can cause waveform to be oversaturated. Range: -128 ~ 127. */
 } dac_cw_config_t;
 
-#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
+#if CONFIG_IDF_TARGET_ESP32S2
 
 /**
  * @brief DAC digital controller (DMA mode) work mode.

+ 9 - 0
components/hal/include/hal/mcpwm_types.h

@@ -7,6 +7,7 @@
 #pragma once
 
 #include "soc/clk_tree_defs.h"
+#include "soc/soc_caps.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -15,12 +16,20 @@ extern "C" {
 /**
  * @brief MCPWM timer clock source
  */
+#if SOC_MCPWM_SUPPORTED
 typedef soc_periph_mcpwm_timer_clk_src_t mcpwm_timer_clock_source_t;
+#else
+typedef int mcpwm_timer_clock_source_t;
+#endif // SOC_MCPWM_SUPPORTED
 
 /**
  * @brief MCPWM capture clock source
  */
+#if SOC_MCPWM_SUPPORTED
 typedef soc_periph_mcpwm_capture_clk_src_t mcpwm_capture_clock_source_t;
+#else
+typedef int mcpwm_capture_clock_source_t;
+#endif // SOC_MCPWM_SUPPORTED
 
 /**
  * @brief MCPWM timer count direction

+ 7 - 13
components/heap/include/esp_heap_task_info.h

@@ -1,18 +1,12 @@
-// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
+/*
+ * SPDX-FileCopyrightText: 2018-2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
 #pragma once
 
+#include "sdkconfig.h"
+
 #ifdef CONFIG_HEAP_TASK_TRACKING
 
 #ifdef __cplusplus

+ 4 - 0
components/soc/esp32/include/soc/Kconfig.soc_caps.in

@@ -119,6 +119,10 @@ config SOC_SECURE_BOOT_SUPPORTED
     bool
     default y
 
+config SOC_TOUCH_SENSOR_SUPPORTED
+    bool
+    default y
+
 config SOC_DPORT_WORKAROUND_DIS_INTERRUPT_LVL
     int
     default 5

+ 1 - 0
components/soc/esp32/include/soc/soc_caps.h

@@ -89,6 +89,7 @@
 #define SOC_SHA_SUPPORTED           1
 #define SOC_FLASH_ENC_SUPPORTED     1
 #define SOC_SECURE_BOOT_SUPPORTED   1
+#define SOC_TOUCH_SENSOR_SUPPORTED  1
 
 #if SOC_CAPS_ECO_VER < 2
 #define SOC_DPORT_WORKAROUND                   1

+ 6 - 14
components/soc/esp32/touch_sensor_periph.c

@@ -1,21 +1,13 @@
-// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
+/*
+ * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
 
 #include "soc/touch_sensor_periph.h"
 
 /* Store IO number corresponding to the Touch Sensor channel number. */
-const int touch_sensor_channel_io_map[SOC_TOUCH_SENSOR_NUM] = {
+const int touch_sensor_channel_io_map[] = {
     TOUCH_PAD_NUM0_GPIO_NUM,
     TOUCH_PAD_NUM1_GPIO_NUM,
     TOUCH_PAD_NUM2_GPIO_NUM,

+ 0 - 4
components/soc/esp32c2/include/soc/Kconfig.soc_caps.in

@@ -447,10 +447,6 @@ config SOC_TIMER_GROUP_TOTAL_TIMERS
     int
     default 1
 
-config SOC_TOUCH_SENSOR_NUM
-    int
-    default 0
-
 config SOC_SECURE_BOOT_V2_ECC
     bool
     default y

+ 0 - 3
components/soc/esp32c2/include/soc/soc_caps.h

@@ -220,9 +220,6 @@
 #define SOC_TIMER_GROUP_SUPPORT_PLL_F40M  (1)
 #define SOC_TIMER_GROUP_TOTAL_TIMERS      (1U)
 
-/*-------------------------- TOUCH SENSOR CAPS -------------------------------*/
-#define SOC_TOUCH_SENSOR_NUM            (0U)    /*! No touch sensors on ESP32-C2 */
-
 /*-------------------------- Secure Boot CAPS----------------------------*/
 #define SOC_SECURE_BOOT_V2_ECC              1
 #define SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS   (1U)

+ 2 - 6
components/soc/esp32c2/include/soc/uart_struct.h

@@ -3,9 +3,9 @@
  *
  * SPDX-License-Identifier: Apache-2.0
  */
-#ifndef _SOC_UART_STRUCT_H_
-#define _SOC_UART_STRUCT_H_
+#pragma once
 
+#include <stdint.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -396,7 +396,3 @@ extern uart_dev_t UART1;
 #ifdef __cplusplus
 }
 #endif
-
-
-
-#endif /*_SOC_UART_STRUCT_H_ */

+ 0 - 4
components/soc/esp32c3/include/soc/Kconfig.soc_caps.in

@@ -659,10 +659,6 @@ config SOC_TIMER_GROUP_TOTAL_TIMERS
     int
     default 2
 
-config SOC_TOUCH_SENSOR_NUM
-    bool
-    default n
-
 config SOC_TWAI_BRP_MIN
     int
     default 2

+ 10 - 17
components/soc/esp32c3/include/soc/apb_saradc_struct.h

@@ -1,18 +1,13 @@
-// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-#ifndef _SOC_APB_SARADC_STRUCT_H_
-#define _SOC_APB_SARADC_STRUCT_H_
+/*
+ * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#pragma once
+
+#include <stdint.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -486,5 +481,3 @@ extern apb_saradc_dev_t APB_SARADC;
 #ifdef __cplusplus
 }
 #endif
-
-#endif  /* _SOC_APB_SARADC_STRUCT_H_ */

+ 0 - 3
components/soc/esp32c3/include/soc/soc_caps.h

@@ -305,9 +305,6 @@
 #define SOC_TIMER_GROUP_SUPPORT_APB       (1)
 #define SOC_TIMER_GROUP_TOTAL_TIMERS      (2)
 
-/*-------------------------- TOUCH SENSOR CAPS -------------------------------*/
-#define SOC_TOUCH_SENSOR_NUM            (0)    /*! No touch sensors on ESP32-C3 */
-
 /*-------------------------- TWAI CAPS ---------------------------------------*/
 #define SOC_TWAI_BRP_MIN                2
 #define SOC_TWAI_BRP_MAX                16384

+ 0 - 4
components/soc/esp32h2/include/soc/Kconfig.soc_caps.in

@@ -635,10 +635,6 @@ config SOC_TIMER_GROUP_TOTAL_TIMERS
     int
     default 2
 
-config SOC_TOUCH_SENSOR_NUM
-    bool
-    default n
-
 config SOC_TWAI_BRP_MIN
     int
     default 2

+ 0 - 3
components/soc/esp32h2/include/soc/soc_caps.h

@@ -310,9 +310,6 @@
 #define SOC_TIMER_GROUP_SUPPORT_AHB       (1)
 #define SOC_TIMER_GROUP_TOTAL_TIMERS      (2)
 
-/*-------------------------- TOUCH SENSOR CAPS -------------------------------*/
-#define SOC_TOUCH_SENSOR_NUM            (0)    /*! No touch sensors on ESP32-H2 */
-
 /*-------------------------- TWAI CAPS ---------------------------------------*/
 #define SOC_TWAI_BRP_MIN                2
 #define SOC_TWAI_BRP_MAX                16384

+ 4 - 0
components/soc/esp32s2/include/soc/Kconfig.soc_caps.in

@@ -135,6 +135,10 @@ config SOC_MEMPROT_SUPPORTED
     bool
     default y
 
+config SOC_TOUCH_SENSOR_SUPPORTED
+    bool
+    default y
+
 config SOC_ADC_RTC_CTRL_SUPPORTED
     bool
     default y

+ 10 - 17
components/soc/esp32s2/include/soc/apb_saradc_struct.h

@@ -1,18 +1,13 @@
-// Copyright 2017-2018 Espressif Systems (Shanghai) PTE LTD
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-#ifndef _SOC_APB_SARADC_STRUCT_H_
-#define _SOC_APB_SARADC_STRUCT_H_
+/*
+ * SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#pragma once
+
+#include <stdint.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -428,5 +423,3 @@ extern apb_saradc_dev_t APB_SARADC;
 #ifdef __cplusplus
 }
 #endif
-
-#endif  /* _SOC_APB_SARADC_STRUCT_H_ */

+ 9 - 16
components/soc/esp32s2/include/soc/i2c_struct.h

@@ -1,18 +1,13 @@
-// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
+/*
+ * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#pragma once
+
+#include <stdint.h>
 
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-#ifndef _SOC_I2C_STRUCT_H_
-#define _SOC_I2C_STRUCT_H_
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -379,5 +374,3 @@ extern i2c_dev_t I2C1;
 #ifdef __cplusplus
 }
 #endif
-
-#endif  /* _SOC_I2C_STRUCT_H_ */

+ 1 - 0
components/soc/esp32s2/include/soc/soc_caps.h

@@ -72,6 +72,7 @@
 #define SOC_FLASH_ENC_SUPPORTED         1
 #define SOC_SECURE_BOOT_SUPPORTED       1
 #define SOC_MEMPROT_SUPPORTED           1
+#define SOC_TOUCH_SENSOR_SUPPORTED      1
 
 
 /*-------------------------- ADC CAPS ----------------------------------------*/

+ 10 - 17
components/soc/esp32s2/include/soc/spi_mem_struct.h

@@ -1,18 +1,13 @@
-// Copyright 2017-2018 Espressif Systems (Shanghai) PTE LTD
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-#ifndef _SOC_SPI_MEM_STRUCT_H_
-#define _SOC_SPI_MEM_STRUCT_H_
+/*
+ * SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#pragma once
+
+#include <stdint.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -705,5 +700,3 @@ extern spi_mem_dev_t SPIMEM1;
 #ifdef __cplusplus
 }
 #endif
-
-#endif  /* _SOC_SPI_MEM_STRUCT_H_ */

+ 10 - 17
components/soc/esp32s2/include/soc/spi_struct.h

@@ -1,18 +1,13 @@
-// Copyright 2017-2018 Espressif Systems (Shanghai) PTE LTD
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-#ifndef _SOC_SPI_STRUCT_H_
-#define _SOC_SPI_STRUCT_H_
+/*
+ * SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#pragma once
+
+#include <stdint.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -761,5 +756,3 @@ _Static_assert(sizeof(spi_dev_t)==0x400, "***invalid spi");
 #ifdef __cplusplus
 }
 #endif
-
-#endif  /* _SOC_SPI_STRUCT_H_ */

+ 6 - 14
components/soc/esp32s2/touch_sensor_periph.c

@@ -1,22 +1,14 @@
-// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
+/*
+ * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
 
 #include "soc/touch_sensor_periph.h"
 
 /* Store IO number corresponding to the Touch Sensor channel number. */
 /* Note: T0 is an internal channel that does not have a corresponding external GPIO. */
-const int touch_sensor_channel_io_map[SOC_TOUCH_SENSOR_NUM] = {
+const int touch_sensor_channel_io_map[] = {
     -1,
     TOUCH_PAD_NUM1_GPIO_NUM,
     TOUCH_PAD_NUM2_GPIO_NUM,

+ 4 - 0
components/soc/esp32s3/include/soc/Kconfig.soc_caps.in

@@ -191,6 +191,10 @@ config SOC_MEMPROT_SUPPORTED
     bool
     default y
 
+config SOC_TOUCH_SENSOR_SUPPORTED
+    bool
+    default y
+
 config SOC_APPCPU_HAS_CLOCK_GATING_BUG
     bool
     default y

+ 1 - 1
components/soc/esp32s3/include/soc/soc_caps.h

@@ -62,7 +62,7 @@
 #define SOC_FLASH_ENC_SUPPORTED         1
 #define SOC_SECURE_BOOT_SUPPORTED       1
 #define SOC_MEMPROT_SUPPORTED           1
-
+#define SOC_TOUCH_SENSOR_SUPPORTED      1
 
 /*-------------------------- SOC CAPS ----------------------------------------*/
 #define SOC_APPCPU_HAS_CLOCK_GATING_BUG (1)

+ 1 - 1
components/soc/esp32s3/touch_sensor_periph.c

@@ -8,7 +8,7 @@
 
 /* Store IO number corresponding to the Touch Sensor channel number. */
 /* Note: T0 is an internal channel that does not have a corresponding external GPIO. */
-const int touch_sensor_channel_io_map[SOC_TOUCH_SENSOR_NUM] = {
+const int touch_sensor_channel_io_map[] = {
     -1,
     TOUCH_PAD_NUM1_GPIO_NUM,
     TOUCH_PAD_NUM2_GPIO_NUM,

+ 0 - 37
components/soc/esp32s3/usb_periph.h

@@ -1,37 +0,0 @@
-// Copyright 2020 Espressif Systems (Shanghai) PTE LTD
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#pragma once
-
-#include <stdint.h>
-#include <stdbool.h>
-#include "soc/usb_pins.h"
-#include "soc/gpio_sig_map.h"
-#include "soc/usb_reg.h"
-#include "soc/usb_types.h"
-#include "soc/usb_struct.h"
-#include "soc/usb_wrap_reg.h"
-#include "soc/usb_wrap_struct.h"
-
-/**
- * @brief A pin descriptor for init
- */
-typedef struct {
-    const int pin;
-    const int func;
-    const bool is_output;
-    const int ext_phy_only;
-} usb_iopin_dsc_t;
-
-extern const usb_iopin_dsc_t usb_periph_iopins[];

+ 6 - 14
components/soc/include/soc/touch_sensor_periph.h

@@ -1,16 +1,8 @@
-// Copyright 2019 Espressif Systems (Shanghai) PTE LTD
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
+/*
+ * SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
 
 #pragma once
 
@@ -28,7 +20,7 @@
 extern "C" {
 #endif
 
-extern const int touch_sensor_channel_io_map[SOC_TOUCH_SENSOR_NUM];
+extern const int touch_sensor_channel_io_map[];
 
 #ifdef __cplusplus
 }

+ 1 - 1
docs/conf_common.py

@@ -156,7 +156,7 @@ conditional_include_dict = {'SOC_BT_SUPPORTED':BT_DOCS,
                             'SOC_PCNT_SUPPORTED':PCNT_DOCS,
                             'SOC_RMT_SUPPORTED':RMT_DOCS,
                             'SOC_DAC_SUPPORTED':DAC_DOCS,
-                            'SOC_TOUCH_SENSOR_NUM':TOUCH_SENSOR_DOCS,
+                            'SOC_TOUCH_SENSOR_SUPPORTED':TOUCH_SENSOR_DOCS,
                             'SOC_ULP_SUPPORTED':ULP_DOCS,
                             'SOC_RISCV_COPROC_SUPPORTED':RISCV_COPROC_DOCS,
                             'SOC_DIG_SIGN_SUPPORTED':['api-reference/peripherals/ds.rst'],

+ 1 - 1
docs/en/api-reference/peripherals/index.rst

@@ -33,7 +33,7 @@ Peripherals API
     :esp32: secure_element
     :esp32s2: spi_slave_hd
     :SOC_TEMP_SENSOR_SUPPORTED: temp_sensor
-    :SOC_TOUCH_SENSOR_NUM: touch_pad
+    :SOC_TOUCH_SENSOR_SUPPORTED: touch_pad
     :esp32s2: touch_element
     :SOC_TWAI_SUPPORTED: twai
     uart

+ 8 - 8
docs/en/api-reference/peripherals/rmt.rst

@@ -304,21 +304,21 @@ The receiver will be stopped by the driver when it finishes working (i.e. receiv
 
 .. code:: c
 
-    static bool example_rmt_rx_done_callback(rmt_channel_handle_t channel, rmt_rx_done_event_data_t *edata, void *user_data)
+    static bool example_rmt_rx_done_callback(rmt_channel_handle_t channel, const rmt_rx_done_event_data_t *edata, void *user_data)
     {
         BaseType_t high_task_wakeup = pdFALSE;
-        TaskHandle_t task_to_notify = (TaskHandle_t)user_data;
+        QueueHandle_t receive_queue = (QueueHandle_t)user_data;
         // send the received RMT symbols to the parser task
-        xTaskNotifyFromISR(task_to_notify, (uint32_t)edata, eSetValueWithOverwrite, &high_task_wakeup);
+        xQueueSendFromISR(receive_queue, edata, &high_task_wakeup);
         // return whether any task is woken up
         return high_task_wakeup == pdTRUE;
     }
 
-    TaskHandle_t cur_task = xTaskGetCurrentTaskHandle();
+    QueueHandle_t receive_queue = xQueueCreate(1, sizeof(rmt_rx_done_event_data_t));
     rmt_rx_event_callbacks_t cbs = {
         .on_recv_done = example_rmt_rx_done_callback,
     };
-    ESP_ERROR_CHECK(rmt_rx_register_event_callbacks(rx_channel, &cbs, cur_task));
+    ESP_ERROR_CHECK(rmt_rx_register_event_callbacks(rx_channel, &cbs, receive_queue));
 
     // the following timing requirement is based on NEC protocol
     rmt_receive_config_t receive_config = {
@@ -330,10 +330,10 @@ The receiver will be stopped by the driver when it finishes working (i.e. receiv
     // ready to receive
     ESP_ERROR_CHECK(rmt_receive(rx_channel, raw_symbols, sizeof(raw_symbols), &receive_config));
     // wait for RX done signal
-    rmt_rx_done_event_data_t *rx_data = NULL;
-    xTaskNotifyWait(0x00, ULONG_MAX, (uint32_t *)&rx_data, portMAX_DELAY);
+    rmt_rx_done_event_data_t rx_data;
+    xQueueReceive(receive_queue, &rx_data, portMAX_DELAY);
     // parse the receive symbols
-    example_parse_nec_frame(rx_data->received_symbols, rx_data->num_symbols);
+    example_parse_nec_frame(rx_data.received_symbols, rx_data.num_symbols);
 
 RMT Encoder
 ^^^^^^^^^^^

+ 2 - 2
docs/en/api-reference/system/sleep_modes.rst

@@ -181,7 +181,7 @@ So, in theory, it's ok if you only wake up the system after the flash is complet
 Therefore, it's recommended not to power down flash when using ESP-IDF. For power-sensitive applications, it's recommended to use Kconfig option :ref:`CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND` to reduce the power consumption of the flash during light sleep, instead of powering down the flash.
 
 .. only:: SOC_SPIRAM_SUPPORTED
-    
+
     It is worth mentioning that PSRAM has a similar Kconfig option :ref:`CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND`.
 
 However, for those who have fully understood the risk and are still willing to power down the flash to further reduce the power consumption, please check the following mechanisms:
@@ -243,7 +243,7 @@ Checking Sleep Wakeup Cause
 
 :cpp:func:`esp_sleep_get_wakeup_cause` function can be used to check which wakeup source has triggered wakeup from sleep mode.
 
-.. only:: SOC_TOUCH_SENSOR_NUM
+.. only:: SOC_TOUCH_SENSOR_SUPPORTED
 
     For touchpad, it is possible to identify which touch pin has caused wakeup using :cpp:func:`esp_sleep_get_touchpad_wakeup_status` functions.
 

+ 1 - 1
docs/zh_CN/api-reference/peripherals/index.rst

@@ -33,7 +33,7 @@
     :esp32: secure_element
     :esp32s2: spi_slave_hd
     :SOC_TEMP_SENSOR_SUPPORTED: temp_sensor
-    :SOC_TOUCH_SENSOR_NUM: touch_pad
+    :SOC_TOUCH_SENSOR_SUPPORTED: touch_pad
     :esp32s2: touch_element
     :SOC_TWAI_SUPPORTED: twai
     uart

+ 6 - 6
docs/zh_CN/api-reference/system/sleep_modes.rst

@@ -67,7 +67,7 @@ RTC 控制器中内嵌定时器,可用于在预定义的时间到达后唤醒
     RTC IO 模块中包含这样一个逻辑——当发生触摸传感器中断时,触发唤醒。要启用此唤醒源,用户需要在芯片进入睡眠模式前配置触摸传感器中断功能。
 
     .. only:: esp32
-    
+
         ESP32 修订版 0 和 1 仅在 RTC 外设没有被强制供电时支持该唤醒源(即 ESP_PD_DOMAIN_RTC_PERIPH 应被设置为 ESP_PD_OPTION_AUTO)。
 
     可调用 :cpp:func:`esp_sleep_enable_touchpad_wakeup` 函数来启用该唤醒源。
@@ -78,7 +78,7 @@ RTC 控制器中内嵌定时器,可用于在预定义的时间到达后唤醒
     ^^^^^^^^^^^^^^^^^^^^^^
 
     RTC IO 模块中包含这样一个逻辑——当某个 RTC GPIO 被设置为预定义的逻辑值时,触发唤醒。RTC IO 是 RTC 外设电源域的一部分,因此如果该唤醒源被请求,RTC 外设将在 Deep-sleep 模式期间保持供电。
-    
+
     在此模式下,RTC IO 模块被使能,因此也可以使用内部上拉或下拉电阻。配置时,应用程序需要在调用函数 :cpp:func:`esp_deep_sleep_start` 前先调用函数 :cpp:func:`rtc_gpio_pullup_en` 和 :cpp:func:`rtc_gpio_pulldown_en`。
 
     .. only:: esp32
@@ -115,7 +115,7 @@ RTC 控制器中内嵌定时器,可用于在预定义的时间到达后唤醒
     当芯片处于睡眠模式时,ULP 协处理器仍然运行,可用于轮询传感器、监视 ADC 或触摸传感器的值,并在检测到特殊事件时唤醒芯片。ULP 协处理器是 RTC 外设电源域的一部分,运行存储在 RTC 低速内存中的程序。如果这一唤醒源被请求,RTC 低速内存将会在睡眠期间保持供电状态。RTC 外设会在 ULP 协处理器开始运行程序前自动上电;一旦程序停止运行,RTC 外设会再次自动断电。
 
     .. only:: esp32
-    
+
         ESP32 修订版 0 和 1 仅在 RTC 外设没有被强制供电时支持该唤醒(即 ESP_PD_DOMAIN_RTC_PERIPH 应被设置为 ESP_PD_OPTION_AUTO)。
 
     可调用 :cpp:func:`esp_sleep_enable_ulp_wakeup` 函数来启用此唤醒源。
@@ -179,7 +179,7 @@ Flash 断电
 因为这些不可控的因素,ESP-IDF 很难保证 flash断电的绝对安全。因此 ESP-IDF 不推荐用户断电 flash。对于一些功耗敏感型应用,可以通过设置 Kconfig 配置项 :ref:`CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND` 来减少 light sleep 期间 flash 的功耗。这种方式在几乎所有场景下都要比断电 flash 更好,兼顾了安全性和功耗。
 
 .. only:: SOC_SPIRAM_SUPPORTED
-    
+
     值得一提的是,PSRAM 也有一个类似的 Kconfig 配置项 :ref:`CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND`。
 
 考虑到有些用户能够充分评估断电 flash 的风险,并希望通过断电 flash 来获得更低的功耗,因此 ESP-IDF 提供了两种断电 flash 的机制:
@@ -224,7 +224,7 @@ Flash 断电
 .. only:: esp32c3
 
     在 Deep-sleep 模式中:
-        - 数字 GPIO (GPIO6 ~ 21) 处于高阻态。 
+        - 数字 GPIO (GPIO6 ~ 21) 处于高阻态。
         - RTC GPIO (GPIO0 ~ 5) 可能处于以下状态:
             - 如果未启用保持 (hold) 功能,RTC GPIO 将处于高阻态。
             - 如果启用保持功能,RTC GPIO 管脚将会在保持功能开启时处于锁存状态。
@@ -241,7 +241,7 @@ UART 输出处理
 
 :cpp:func:`esp_sleep_get_wakeup_cause` 函数可用于检测是何种唤醒源在睡眠期间被触发。
 
-.. only:: SOC_TOUCH_SENSOR_NUM
+.. only:: SOC_TOUCH_SENSOR_SUPPORTED
 
     对于触摸传感器唤醒源,可以调用函数 :cpp:func:`esp_sleep_get_touchpad_wakeup_status` 来确认触发唤醒的触摸管脚。
 

+ 1 - 1
examples/peripherals/.build-test-rules.yml

@@ -166,7 +166,7 @@ examples/peripherals/temp_sensor:
 
 examples/peripherals/touch_sensor:
   disable:
-    - if: SOC_TOUCH_SENSOR_NUM == 0
+    - if: SOC_TOUCH_SENSOR_SUPPORTED != 1
 
 examples/peripherals/touch_sensor/touch_element:
   enable:

+ 1 - 1
examples/peripherals/rmt/ir_nec_transceiver/main/ir_nec_transceiver_main.c

@@ -142,7 +142,7 @@ static void example_parse_nec_frame(rmt_symbol_word_t *rmt_nec_symbols, size_t s
     }
 }
 
-static bool example_rmt_rx_done_callback(rmt_channel_handle_t channel, rmt_rx_done_event_data_t *edata, void *user_data)
+static bool example_rmt_rx_done_callback(rmt_channel_handle_t channel, const rmt_rx_done_event_data_t *edata, void *user_data)
 {
     BaseType_t high_task_wakeup = pdFALSE;
     QueueHandle_t receive_queue = (QueueHandle_t)user_data;

+ 5 - 5
examples/peripherals/rmt/onewire_ds18b20/components/onewire_bus/onewire_bus_rmt.c

@@ -144,7 +144,7 @@ const static rmt_receive_config_t onewire_rmt_rx_config = {
     .signal_range_max_ns = (ONEWIRE_RESET_PULSE_DURATION + ONEWIRE_RESET_WAIT_DURATION) * 1000
 };
 
-static bool onewire_rmt_rx_done_callback(rmt_channel_handle_t channel, rmt_rx_done_event_data_t *edata, void *user_data)
+static bool onewire_rmt_rx_done_callback(rmt_channel_handle_t channel, const rmt_rx_done_event_data_t *edata, void *user_data)
 {
     BaseType_t task_woken = pdFALSE;
     struct onewire_bus_t *handle = (struct onewire_bus_t *)user_data;
@@ -190,12 +190,12 @@ static bool onewire_rmt_check_presence_pulse(rmt_symbol_word_t *rmt_symbols, siz
     if (symbol_num >= 2) { // there should be at lease 2 symbols(3 or 4 edges)
         if (rmt_symbols[0].level1 == 1) { // bus is high before reset pulse
             if (rmt_symbols[0].duration1 > ONEWIRE_RESET_PRESENSE_WAIT_DURATION_MIN &&
-                rmt_symbols[1].duration0 > ONEWIRE_RESET_PRESENSE_DURATION_MIN) {
+                    rmt_symbols[1].duration0 > ONEWIRE_RESET_PRESENSE_DURATION_MIN) {
                 return true;
             }
         } else { // bus is low before reset pulse(first pulse after rmt channel init)
             if (rmt_symbols[0].duration0 > ONEWIRE_RESET_PRESENSE_WAIT_DURATION_MIN &&
-                rmt_symbols[1].duration1 > ONEWIRE_RESET_PRESENSE_DURATION_MIN) {
+                    rmt_symbols[1].duration1 > ONEWIRE_RESET_PRESENSE_DURATION_MIN) {
                 return true;
             }
         }
@@ -324,7 +324,7 @@ esp_err_t onewire_del_bus(onewire_bus_handle_t handle)
         rmt_disable(handle->tx_channel);
         rmt_del_channel(handle->tx_channel);
     }
-    if(handle->receive_queue) {
+    if (handle->receive_queue) {
         vQueueDelete(handle->receive_queue);
     }
     if (handle->rx_symbols) {
@@ -340,7 +340,7 @@ esp_err_t onewire_bus_reset(onewire_bus_handle_t handle)
     ESP_RETURN_ON_FALSE(handle, ESP_ERR_INVALID_ARG, TAG, "invalid 1-wire handle");
 
     // send reset pulse while receive presence pulse
-    ESP_RETURN_ON_ERROR(rmt_receive(handle->rx_channel, handle->rx_symbols, sizeof(rmt_symbol_word_t)*2, &onewire_rmt_rx_config),
+    ESP_RETURN_ON_ERROR(rmt_receive(handle->rx_channel, handle->rx_symbols, sizeof(rmt_symbol_word_t) * 2, &onewire_rmt_rx_config),
                         TAG, "1-wire reset pulse receive failed");
     ESP_RETURN_ON_ERROR(rmt_transmit(handle->tx_channel, handle->tx_copy_encoder, &onewire_reset_pulse_symbol, sizeof(onewire_reset_pulse_symbol), &onewire_rmt_tx_config),
                         TAG, "1-wire reset pulse transmit failed");

+ 1 - 1
examples/system/deep_sleep/main/deep_sleep_example_main.c

@@ -21,7 +21,7 @@
 #include "driver/rtc_io.h"
 #include "soc/rtc.h"
 
-#if SOC_TOUCH_SENSOR_NUM > 0
+#if SOC_TOUCH_SENSOR_SUPPORTED
 #include "soc/sens_periph.h"
 #include "driver/touch_pad.h"
 #endif

+ 0 - 9
tools/ci/check_copyright_ignore.txt

@@ -828,7 +828,6 @@ components/heap/heap_tlsf.h
 components/heap/heap_tlsf_block_functions.h
 components/heap/heap_tlsf_config.h
 components/heap/heap_trace_standalone.c
-components/heap/include/esp_heap_task_info.h
 components/heap/include/esp_heap_trace.h
 components/heap/include/heap_memory_layout.h
 components/heap/multi_heap_config.h
@@ -1055,14 +1054,12 @@ components/soc/esp32/ledc_periph.c
 components/soc/esp32/sdio_slave_periph.c
 components/soc/esp32/sdmmc_periph.c
 components/soc/esp32/spi_periph.c
-components/soc/esp32/touch_sensor_periph.c
 components/soc/esp32/uart_periph.c
 components/soc/esp32c3/i2c_bbpll.h
 components/soc/esp32c3/i2c_periph.c
 components/soc/esp32c3/include/soc/apb_ctrl_reg.h
 components/soc/esp32c3/include/soc/apb_ctrl_struct.h
 components/soc/esp32c3/include/soc/apb_saradc_reg.h
-components/soc/esp32c3/include/soc/apb_saradc_struct.h
 components/soc/esp32c3/include/soc/assist_debug_reg.h
 components/soc/esp32c3/include/soc/bb_reg.h
 components/soc/esp32c3/include/soc/boot_mode.h
@@ -1154,7 +1151,6 @@ components/soc/esp32s2/i2c_periph.c
 components/soc/esp32s2/include/soc/apb_ctrl_reg.h
 components/soc/esp32s2/include/soc/apb_ctrl_struct.h
 components/soc/esp32s2/include/soc/apb_saradc_reg.h
-components/soc/esp32s2/include/soc/apb_saradc_struct.h
 components/soc/esp32s2/include/soc/assist_debug_reg.h
 components/soc/esp32s2/include/soc/bb_reg.h
 components/soc/esp32s2/include/soc/boot_mode.h
@@ -1171,7 +1167,6 @@ components/soc/esp32s2/include/soc/gpio_sig_map.h
 components/soc/esp32s2/include/soc/gpio_struct.h
 components/soc/esp32s2/include/soc/hwcrypto_reg.h
 components/soc/esp32s2/include/soc/i2c_reg.h
-components/soc/esp32s2/include/soc/i2c_struct.h
 components/soc/esp32s2/include/soc/interrupt_reg.h
 components/soc/esp32s2/include/soc/ledc_reg.h
 components/soc/esp32s2/include/soc/ledc_struct.h
@@ -1192,10 +1187,8 @@ components/soc/esp32s2/include/soc/sensitive_reg.h
 components/soc/esp32s2/include/soc/soc_pins.h
 components/soc/esp32s2/include/soc/soc_ulp.h
 components/soc/esp32s2/include/soc/spi_mem_reg.h
-components/soc/esp32s2/include/soc/spi_mem_struct.h
 components/soc/esp32s2/include/soc/spi_pins.h
 components/soc/esp32s2/include/soc/spi_reg.h
-components/soc/esp32s2/include/soc/spi_struct.h
 components/soc/esp32s2/include/soc/syscon_reg.h
 components/soc/esp32s2/include/soc/syscon_struct.h
 components/soc/esp32s2/include/soc/systimer_reg.h
@@ -1218,7 +1211,6 @@ components/soc/esp32s2/include/soc/wdev_reg.h
 components/soc/esp32s2/interrupts.c
 components/soc/esp32s2/ledc_periph.c
 components/soc/esp32s2/spi_periph.c
-components/soc/esp32s2/touch_sensor_periph.c
 components/soc/esp32s2/uart_periph.c
 components/soc/esp32s2/usb_periph.c
 components/soc/esp32s3/dedic_gpio_periph.c
@@ -1326,7 +1318,6 @@ components/soc/include/soc/sdmmc_periph.h
 components/soc/include/soc/sens_periph.h
 components/soc/include/soc/spi_periph.h
 components/soc/include/soc/syscon_periph.h
-components/soc/include/soc/touch_sensor_periph.h
 components/soc/include/soc/twai_periph.h
 components/soc/include/soc/uart_periph.h
 components/soc/include/soc/uhci_periph.h

+ 2 - 26
tools/ci/check_public_headers_exceptions.txt

@@ -27,9 +27,6 @@ components/esp_common/include/esp_private/
 components/esp32/include/esp32/brownout.h
 components/esp32/include/esp32/cache_err_int.h
 
-components/driver/include/driver/sdmmc_defs.h
-components/driver/include/driver/sdmmc_types.h
-
 # LWIP: sockets.h uses #include_next<>, which doesn't work correctly with the checker
 # memp_std.h is supposed to be included multiple times with different settings
 components/lwip/lwip/src/include/lwip/priv/memp_std.h
@@ -103,14 +100,9 @@ components/esp_hw_support/include/esp_private/esp_memprot_internal.h
 
 ### Here are the files that use CONFIG_XXX values but don't include sdkconfig.h
 #
-components/heap/include/esp_heap_task_info.h
 components/esp_wifi/include/esp_private/wifi_os_adapter.h
-components/asio/port/include/esp_exception.h
-components/esp_common/include/esp_compiler.h
-
 ### To be fixed: headers that rely on implicit inclusion
 #
-components/soc/src/esp32/rtc_clk_common.h
 components/esp_rom/include/esp32/rom/sha.h
 components/esp_rom/include/esp32/rom/secure_boot.h
 components/esp_rom/include/esp32c3/rom/spi_flash.h
@@ -127,7 +119,6 @@ components/esp_rom/include/esp32c2/rom/rtc.h
 components/esp32/include/esp32/dport_access.h
 components/esp32/include/rom/sha.h
 components/esp32/include/rom/secure_boot.h
-components/driver/esp32/include/touch_sensor.h
 components/esp_ringbuf/include/freertos/ringbuf.h
 components/efuse/esp32/include/esp_efuse_table.h
 components/esp_wifi/include/esp_wifi_crypto_types.h
@@ -141,7 +132,6 @@ components/esp_netif/include/esp_netif_sta_list.h
 components/esp_netif/include/esp_netif_defaults.h
 components/esp_netif/include/esp_netif_net_stack.h
 components/esp_netif/include/esp_netif_ppp.h
-components/bootloader_support/include/bootloader_util.h
 components/console/linenoise/linenoise.h
 components/protocomm/include/transports/protocomm_httpd.h
 components/fatfs/src/diskio.h
@@ -151,45 +141,34 @@ components/ulp/include/ulp_common.h
 components/ulp/include/esp32s2/ulp_riscv.h
 components/mbedtls/esp_crt_bundle/include/esp_crt_bundle.h
 components/wifi_provisioning/include/wifi_provisioning/scheme_softap.h
+components/usb/include/esp_private/usb_phy.h
+components/usb/include/usb/usb_types_stack.h
 
 ### To be fixed: files which don't compile for esp32s2 target:
 
-components/driver/deprecated/driver/adc_deprecated.h
-components/driver/include/driver/can.h
-components/driver/include/driver/mcpwm.h
 components/efuse/esp32s2/include/esp_efuse_table.h
 components/esp_psram/include/esp32/himem.h
 components/esp_rom/include/esp32/rom/ets_sys.h
 components/esp_rom/include/esp32/rom/rtc.h
 components/esp_rom/include/esp32/rom/uart.h
 components/soc/esp32s2/include/soc/apb_ctrl_struct.h
-components/soc/esp32s2/include/soc/apb_saradc_struct.h
 components/soc/esp32s2/include/soc/efuse_struct.h
-components/soc/esp32s2/include/soc/gpio_sd_struct.h
 components/soc/esp32s2/include/soc/gpio_struct.h
-components/soc/esp32s2/include/soc/i2c_struct.h
 components/soc/esp32s2/include/soc/ledc_struct.h
 components/soc/esp32s2/include/soc/rtc_i2c_struct.h
 components/soc/esp32s2/include/soc/rtc_io_struct.h
 components/soc/esp32s2/include/soc/sens_struct.h
-components/soc/esp32s2/include/soc/spi_mem_struct.h
-components/soc/esp32s2/include/soc/spi_struct.h
 components/soc/esp32s2/include/soc/syscon_struct.h
 components/soc/esp32s2/include/soc/uart_struct.h
 components/soc/esp32s2/include/soc/uhci_struct.h
-components/usb/include/esp_private/usb_phy.h
-components/usb/include/usb/usb_types_stack.h
 
 ### To be fixed: files which don't compile for esp32s3 target:
 
-components/driver/include/driver/dac_common.h
 components/efuse/esp32s3/include/esp_efuse_table.h
 components/soc/esp32s3/include/soc/world_controller_struct.h
-components/soc/esp32s3/usb_periph.h
 
 ### To be fixed: files which don't compile for esp32c3 target:
 
-components/driver/include/driver/touch_pad.h
 components/efuse/esp32c3/include/esp_efuse_table.h
 components/esp_system/port/include/private/esp_private/trax.h
 components/espcoredump/include/port/xtensa/esp_core_dump_summary_port.h
@@ -197,9 +176,7 @@ components/riscv/include/esp_private/panic_reason.h
 components/riscv/include/riscv/interrupt.h
 components/riscv/include/riscv/rvruntime-frames.h
 components/soc/esp32c3/include/soc/apb_ctrl_struct.h
-components/soc/esp32c3/include/soc/apb_saradc_struct.h
 components/soc/esp32c3/include/soc/efuse_struct.h
-components/soc/esp32c3/include/soc/gpio_sd_struct.h
 components/soc/esp32c3/include/soc/ledc_struct.h
 components/soc/esp32c3/include/soc/rtc_cntl_struct.h
 components/soc/esp32c3/include/soc/rtc_i2c_struct.h
@@ -215,4 +192,3 @@ components/efuse/esp32c2/include/esp_efuse_table.h
 components/soc/esp32c2/include/soc/rtc_cntl_struct.h
 components/soc/esp32c2/include/soc/spi_mem_struct.h
 components/soc/esp32c2/include/soc/syscon_struct.h
-components/soc/esp32c2/include/soc/uart_struct.h