diff --git a/components/driver/dac_common.c b/components/driver/dac_common.c index 791926b0fc..9ccf89ada2 100644 --- a/components/driver/dac_common.c +++ b/components/driver/dac_common.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -19,7 +19,7 @@ extern portMUX_TYPE rtc_spinlock; //TODO: Will be placed in the appropriate position after the rtc module is finished. -static const char *TAG = "DAC"; +static __attribute__((unused)) const char *TAG = "DAC"; /*--------------------------------------------------------------- DAC diff --git a/components/driver/esp32/touch_sensor.c b/components/driver/esp32/touch_sensor.c index b7781a4780..3b0a8f95a9 100644 --- a/components/driver/esp32/touch_sensor.c +++ b/components/driver/esp32/touch_sensor.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2016-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2016-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -49,7 +49,7 @@ static SemaphoreHandle_t rtc_touch_mux = NULL; #define TOUCH_PAD_SHIFT_DEFAULT (4) // Increase computing accuracy. #define TOUCH_PAD_SHIFT_ROUND_DEFAULT (8) // ROUND = 2^(n-1); rounding off for fractional. -static const char *TOUCH_TAG = "TOUCH_SENSOR"; +static __attribute__((unused)) const char *TOUCH_TAG = "TOUCH_SENSOR"; #define TOUCH_CHANNEL_CHECK(channel) ESP_RETURN_ON_FALSE(channel < SOC_TOUCH_SENSOR_NUM, ESP_ERR_INVALID_ARG, TOUCH_TAG, "Touch channel error"); #define TOUCH_NULL_POINTER_CHECK(p, name) ESP_RETURN_ON_FALSE((p), ESP_ERR_INVALID_ARG, TOUCH_TAG, "input param '"name"' is NULL") diff --git a/components/driver/esp32s2/dac.c b/components/driver/esp32s2/dac.c index 16f8742a90..a6815dfd79 100644 --- a/components/driver/esp32s2/dac.c +++ b/components/driver/esp32s2/dac.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -18,7 +18,7 @@ #include "soc/dac_periph.h" #include "hal/dac_hal.h" -static const char *TAG = "DAC"; +static __attribute__((unused)) const char *TAG = "DAC"; extern portMUX_TYPE rtc_spinlock; //TODO: Will be placed in the appropriate position after the rtc module is finished. #define DAC_ENTER_CRITICAL() portENTER_CRITICAL(&rtc_spinlock) diff --git a/components/driver/esp32s2/touch_sensor.c b/components/driver/esp32s2/touch_sensor.c index 5b6203c9e4..4cf4f639d6 100644 --- a/components/driver/esp32s2/touch_sensor.c +++ b/components/driver/esp32s2/touch_sensor.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2016-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2016-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -36,7 +36,7 @@ #define TOUCH_PAD_SHIFT_ROUND_DEFAULT (8) // ROUND = 2^(n-1); rounding off for fractional. #define TOUCH_PAD_MEASURE_WAIT_DEFAULT (0xFF) // The timer frequency is 8Mhz, the max value is 0xff -static const char *TOUCH_TAG = "TOUCH_SENSOR"; +static __attribute__((unused)) const char *TOUCH_TAG = "TOUCH_SENSOR"; #define TOUCH_CHANNEL_CHECK(channel) do { \ ESP_RETURN_ON_FALSE(channel < SOC_TOUCH_SENSOR_NUM && channel >= 0, ESP_ERR_INVALID_ARG, TOUCH_TAG, "Touch channel error"); \ diff --git a/components/driver/esp32s3/touch_sensor.c b/components/driver/esp32s3/touch_sensor.c index c120a1c580..3b1aebaac7 100644 --- a/components/driver/esp32s3/touch_sensor.c +++ b/components/driver/esp32s3/touch_sensor.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2016-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2016-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -36,7 +36,7 @@ #define TOUCH_PAD_SHIFT_ROUND_DEFAULT (8) // ROUND = 2^(n-1); rounding off for fractional. #define TOUCH_PAD_MEASURE_WAIT_DEFAULT (0xFF) // The timer frequency is 8Mhz, the max value is 0xff -static const char *TOUCH_TAG = "TOUCH_SENSOR"; +static __attribute__((unused)) const char *TOUCH_TAG = "TOUCH_SENSOR"; #define TOUCH_CHANNEL_CHECK(channel) do { \ ESP_RETURN_ON_FALSE(channel < SOC_TOUCH_SENSOR_NUM && channel >= 0, ESP_ERR_INVALID_ARG, TOUCH_TAG, "Touch channel error"); \ diff --git a/components/driver/gdma.c b/components/driver/gdma.c index 4532d5527f..1d0c49a0d5 100644 --- a/components/driver/gdma.c +++ b/components/driver/gdma.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -34,12 +34,6 @@ static const char *TAG = "gdma"; #define GDMA_MEM_ALLOC_CAPS MALLOC_CAP_DEFAULT #endif // CONFIG_GDMA_ISR_IRAM_SAFE -#if CONFIG_GDMA_CTRL_FUNC_IN_IRAM -#define GDMA_CTRL_FUNC_ATTR IRAM_ATTR -#else -#define GDMA_CTRL_FUNC_ATTR -#endif // CONFIG_GDMA_CTRL_FUNC_IN_IRAM - #define GDMA_INVALID_PERIPH_TRIG (0x3F) #define SEARCH_REQUEST_RX_CHANNEL (1 << 0) #define SEARCH_REQUEST_TX_CHANNEL (1 << 1) @@ -452,7 +446,7 @@ err: return ret; } -GDMA_CTRL_FUNC_ATTR esp_err_t gdma_start(gdma_channel_handle_t dma_chan, intptr_t desc_base_addr) +esp_err_t gdma_start(gdma_channel_handle_t dma_chan, intptr_t desc_base_addr) { esp_err_t ret = ESP_OK; gdma_pair_t *pair = NULL; @@ -473,7 +467,7 @@ err: return ret; } -GDMA_CTRL_FUNC_ATTR esp_err_t gdma_stop(gdma_channel_handle_t dma_chan) +esp_err_t gdma_stop(gdma_channel_handle_t dma_chan) { esp_err_t ret = ESP_OK; gdma_pair_t *pair = NULL; @@ -492,7 +486,7 @@ err: return ret; } -GDMA_CTRL_FUNC_ATTR esp_err_t gdma_append(gdma_channel_handle_t dma_chan) +esp_err_t gdma_append(gdma_channel_handle_t dma_chan) { esp_err_t ret = ESP_OK; gdma_pair_t *pair = NULL; @@ -511,7 +505,7 @@ err: return ret; } -GDMA_CTRL_FUNC_ATTR esp_err_t gdma_reset(gdma_channel_handle_t dma_chan) +esp_err_t gdma_reset(gdma_channel_handle_t dma_chan) { esp_err_t ret = ESP_OK; gdma_pair_t *pair = NULL; diff --git a/components/driver/gptimer.c b/components/driver/gptimer.c index 52535ec9a4..9c816260be 100644 --- a/components/driver/gptimer.c +++ b/components/driver/gptimer.c @@ -35,12 +35,6 @@ #define GPTIMER_MEM_ALLOC_CAPS MALLOC_CAP_DEFAULT #endif //CONFIG_GPTIMER_ISR_IRAM_SAFE -#if CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM -#define GPTIMER_CTRL_FUNC_ATTR IRAM_ATTR -#else -#define GPTIMER_CTRL_FUNC_ATTR -#endif // CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM - #define GPTIMER_PM_LOCK_NAME_LEN_MAX 16 static const char *TAG = "gptimer"; @@ -76,7 +70,6 @@ struct gptimer_t { timer_hal_context_t hal; gptimer_lifecycle_fsm_t fsm; // access to fsm should be protect by spinlock, as fsm is also accessed from ISR handler intr_handle_t intr; - _lock_t mutex; // to protect other resource allocation, like interrupt handle portMUX_TYPE spinlock; // to protect per-timer resources concurent accessed by task and ISR handler gptimer_alarm_cb_t on_alarm; void *user_ctx; @@ -97,7 +90,6 @@ static gptimer_platform_t s_platform; static gptimer_group_t *gptimer_acquire_group_handle(int group_id); static void gptimer_release_group_handle(gptimer_group_t *group); static esp_err_t gptimer_select_periph_clock(gptimer_t *timer, gptimer_clock_source_t src_clk, uint32_t resolution_hz); -static esp_err_t gptimer_install_interrupt(gptimer_t *timer); IRAM_ATTR static void gptimer_default_isr(void *args); esp_err_t gptimer_new_timer(const gptimer_config_t *config, gptimer_handle_t *ret_timer) @@ -115,7 +107,7 @@ esp_err_t gptimer_new_timer(const gptimer_config_t *config, gptimer_handle_t *re for (int i = 0; (i < SOC_TIMER_GROUPS) && (timer_id < 0); i++) { group = gptimer_acquire_group_handle(i); - ESP_GOTO_ON_FALSE(group, ESP_ERR_NO_MEM, err, TAG, "no mem for group (%d)", group_id); + ESP_GOTO_ON_FALSE(group, ESP_ERR_NO_MEM, err, TAG, "no mem for group (%d)", i); // loop to search free timer in the group portENTER_CRITICAL(&group->spinlock); for (int j = 0; j < SOC_TIMER_GROUP_TIMERS_PER_GROUP; j++) { @@ -159,7 +151,6 @@ esp_err_t gptimer_new_timer(const gptimer_config_t *config, gptimer_handle_t *re timer->fsm = GPTIMER_FSM_STOP; timer->direction = config->direction; timer->flags.intr_shared = config->flags.intr_shared; - _lock_init(&timer->mutex); ESP_LOGD(TAG, "new gptimer (%d,%d) at %p, resolution=%uHz", group_id, timer_id, timer, timer->resolution_hz); *ret_timer = timer; return ESP_OK; @@ -200,7 +191,6 @@ esp_err_t gptimer_del_timer(gptimer_handle_t timer) esp_pm_lock_delete(timer->pm_lock); ESP_LOGD(TAG, "uninstall APB_FREQ_MAX lock for timer (%d,%d)", group_id, timer_id); } - _lock_close(&timer->mutex); free(timer); ESP_LOGD(TAG, "del timer (%d,%d)", group_id, timer_id); @@ -213,7 +203,6 @@ esp_err_t gptimer_del_timer(gptimer_handle_t timer) return ESP_OK; } -GPTIMER_CTRL_FUNC_ATTR esp_err_t gptimer_set_raw_count(gptimer_handle_t timer, unsigned long long value) { ESP_RETURN_ON_FALSE(timer, ESP_ERR_INVALID_ARG, TAG, "invalid argument"); @@ -224,7 +213,6 @@ esp_err_t gptimer_set_raw_count(gptimer_handle_t timer, unsigned long long value return ESP_OK; } -GPTIMER_CTRL_FUNC_ATTR esp_err_t gptimer_get_raw_count(gptimer_handle_t timer, unsigned long long *value) { ESP_RETURN_ON_FALSE(timer && value, ESP_ERR_INVALID_ARG, TAG, "invalid argument"); @@ -240,6 +228,8 @@ esp_err_t gptimer_register_event_callbacks(gptimer_handle_t timer, const gptimer gptimer_group_t *group = NULL; ESP_RETURN_ON_FALSE(timer && cbs, ESP_ERR_INVALID_ARG, TAG, "invalid argument"); group = timer->group; + int group_id = group->group_id; + int timer_id = timer->timer_id; #if CONFIG_GPTIMER_ISR_IRAM_SAFE if (cbs->on_alarm) { @@ -253,11 +243,17 @@ esp_err_t gptimer_register_event_callbacks(gptimer_handle_t timer, const gptimer #endif // lazy install interrupt service - ESP_RETURN_ON_ERROR(gptimer_install_interrupt(timer), TAG, "install interrupt service failed"); + if (!timer->intr) { + // if user wants to control the interrupt allocation more precisely, we can expose more flags in `gptimer_config_t` + int isr_flags = timer->flags.intr_shared ? ESP_INTR_FLAG_SHARED | GPTIMER_INTR_ALLOC_FLAGS : GPTIMER_INTR_ALLOC_FLAGS; + ESP_RETURN_ON_ERROR(esp_intr_alloc_intrstatus(timer_group_periph_signals.groups[group_id].timer_irq_id[timer_id], isr_flags, + (uint32_t)timer_ll_get_intr_status_reg(timer->hal.dev), TIMER_LL_EVENT_ALARM(timer_id), + gptimer_default_isr, timer, &timer->intr), TAG, "install interrupt service failed"); + } // enable/disable GPTimer interrupt events portENTER_CRITICAL_SAFE(&group->spinlock); - timer_ll_enable_intr(timer->hal.dev, TIMER_LL_EVENT_ALARM(timer->timer_id), cbs->on_alarm); // enable timer interrupt + timer_ll_enable_intr(timer->hal.dev, TIMER_LL_EVENT_ALARM(timer->timer_id), cbs->on_alarm != NULL); // enable timer interrupt portEXIT_CRITICAL_SAFE(&group->spinlock); timer->on_alarm = cbs->on_alarm; @@ -265,7 +261,6 @@ esp_err_t gptimer_register_event_callbacks(gptimer_handle_t timer, const gptimer return ESP_OK; } -GPTIMER_CTRL_FUNC_ATTR esp_err_t gptimer_set_alarm_action(gptimer_handle_t timer, const gptimer_alarm_config_t *config) { ESP_RETURN_ON_FALSE(timer, ESP_ERR_INVALID_ARG, TAG, "invalid argument"); @@ -295,7 +290,6 @@ esp_err_t gptimer_set_alarm_action(gptimer_handle_t timer, const gptimer_alarm_c return ESP_OK; } -GPTIMER_CTRL_FUNC_ATTR esp_err_t gptimer_start(gptimer_handle_t timer) { ESP_RETURN_ON_FALSE(timer, ESP_ERR_INVALID_ARG, TAG, "invalid argument"); @@ -318,7 +312,6 @@ esp_err_t gptimer_start(gptimer_handle_t timer) return ESP_OK; } -GPTIMER_CTRL_FUNC_ATTR esp_err_t gptimer_stop(gptimer_handle_t timer) { ESP_RETURN_ON_FALSE(timer, ESP_ERR_INVALID_ARG, TAG, "invalid argument"); @@ -364,8 +357,10 @@ static gptimer_group_t *gptimer_acquire_group_handle(int group_id) } else { group = s_platform.groups[group_id]; } - // someone acquired the group handle means we have a new object that refer to this group - s_platform.group_ref_counts[group_id]++; + if (group) { + // someone acquired the group handle means we have a new object that refer to this group + s_platform.group_ref_counts[group_id]++; + } _lock_release(&s_platform.mutex); if (new_group) { @@ -433,34 +428,6 @@ static esp_err_t gptimer_select_periph_clock(gptimer_t *timer, gptimer_clock_sou return ret; } -static esp_err_t gptimer_install_interrupt(gptimer_t *timer) -{ - esp_err_t ret = ESP_OK; - gptimer_group_t *group = timer->group; - int group_id = group->group_id; - int timer_id = timer->timer_id; - bool new_isr = false; - - if (!timer->intr) { - _lock_acquire(&timer->mutex); - if (!timer->intr) { - // if user wants to control the interrupt allocation more precisely, we can expose more flags in `gptimer_config_t` - int extra_isr_flags = timer->flags.intr_shared ? ESP_INTR_FLAG_SHARED : 0; - ret = esp_intr_alloc_intrstatus(timer_group_periph_signals.groups[group_id].timer_irq_id[timer_id], extra_isr_flags | GPTIMER_INTR_ALLOC_FLAGS, - (uint32_t)timer_ll_get_intr_status_reg(timer->hal.dev), TIMER_LL_EVENT_ALARM(timer_id), - gptimer_default_isr, timer, &timer->intr); - new_isr = (ret == ESP_OK); - } - _lock_release(&timer->mutex); - } - - if (new_isr) { - ESP_LOGD(TAG, "install interrupt service for timer (%d,%d)", group_id, timer_id); - } - - return ret; -} - // Put the default ISR handler in the IRAM for better performance IRAM_ATTR static void gptimer_default_isr(void *args) { diff --git a/components/driver/include/driver/gptimer.h b/components/driver/include/driver/gptimer.h index 1902e9e917..7e52696346 100644 --- a/components/driver/include/driver/gptimer.h +++ b/components/driver/include/driver/gptimer.h @@ -21,7 +21,7 @@ extern "C" { typedef struct gptimer_t *gptimer_handle_t; /** - * @brief GPTimer event data + * @brief GPTimer alarm event data */ typedef struct { uint64_t count_value; /*!< Current count value */ @@ -33,7 +33,7 @@ typedef struct { * * @param[in] timer Timer handle created by `gptimer_new_timer()` * @param[in] edata Alarm event data, fed by driver - * @param[in] user_ctx User data, passed from `gptimer_config_t` + * @param[in] user_ctx User data, passed from `gptimer_register_event_callbacks()` * @return Whether a high priority task has been waken up by this function */ typedef bool (*gptimer_alarm_cb_t) (gptimer_handle_t timer, const gptimer_alarm_event_data_t *edata, void *user_ctx); diff --git a/components/driver/ledc.c b/components/driver/ledc.c index 91f57ec05a..5c69bddb58 100644 --- a/components/driver/ledc.c +++ b/components/driver/ledc.c @@ -21,7 +21,7 @@ #include "soc/clk_ctrl_os.h" #include "esp_private/periph_ctrl.h" -static const char *LEDC_TAG = "ledc"; +static __attribute__((unused)) const char *LEDC_TAG = "ledc"; #define LEDC_CHECK(a, str, ret_val) ESP_RETURN_ON_FALSE(a, ret_val, LEDC_TAG, "%s", str) #define LEDC_ARG_CHECK(a, param) ESP_RETURN_ON_FALSE(a, ESP_ERR_INVALID_ARG, LEDC_TAG, param " argument is invalid") @@ -66,9 +66,9 @@ static portMUX_TYPE ledc_spinlock = portMUX_INITIALIZER_UNLOCKED; #define DIM(array) (sizeof(array)/sizeof(*array)) #define LEDC_IS_DIV_INVALID(div) ((div) <= LEDC_LL_FRACTIONAL_MAX || (div) > LEDC_TIMER_DIV_NUM_MAX) -static const char *LEDC_NOT_INIT = "LEDC is not initialized"; -static const char *LEDC_FADE_SERVICE_ERR_STR = "LEDC fade service not installed"; -static const char *LEDC_FADE_INIT_ERROR_STR = "LEDC fade channel init error, not enough memory or service not installed"; +static __attribute__((unused)) const char *LEDC_NOT_INIT = "LEDC is not initialized"; +static __attribute__((unused)) const char *LEDC_FADE_SERVICE_ERR_STR = "LEDC fade service not installed"; +static __attribute__((unused)) const char *LEDC_FADE_INIT_ERROR_STR = "LEDC fade channel init error, not enough memory or service not installed"; //This value will be calibrated when in use. static uint32_t s_ledc_slow_clk_8M = 0; diff --git a/components/driver/linker.lf b/components/driver/linker.lf index f260c79cf7..eb3eea8506 100644 --- a/components/driver/linker.lf +++ b/components/driver/linker.lf @@ -7,3 +7,14 @@ entries: # placed in flash. if TWAI_ISR_IN_IRAM = y && (TWAI_ERRATA_FIX_RX_FRAME_INVALID = y || TWAI_ERRATA_FIX_RX_FIFO_CORRUPT = y): periph_ctrl: periph_module_reset (noflash) + if GPTIMER_CTRL_FUNC_IN_IRAM = y: + gptimer: gptimer_set_raw_count (noflash) + gptimer: gptimer_get_raw_count (noflash) + gptimer: gptimer_set_alarm_action (noflash) + gptimer: gptimer_start (noflash) + gptimer: gptimer_stop (noflash) + if GDMA_CTRL_FUNC_IN_IRAM = y: + gdma: gdma_start (noflash) + gdma: gdma_stop (noflash) + gdma: gdma_append (noflash) + gdma: gdma_reset (noflash) diff --git a/components/driver/test_apps/gptimer/CMakeLists.txt b/components/driver/test_apps/gptimer/CMakeLists.txt index 897e67221c..9b8072e4cc 100644 --- a/components/driver/test_apps/gptimer/CMakeLists.txt +++ b/components/driver/test_apps/gptimer/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.5) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(gptimer_test) -if(CONFIG_GPTIMER_ISR_IRAM_SAFE) +if(CONFIG_COMPILER_DUMP_RTL_FILES) add_custom_target(check_test_app_sections ALL COMMAND ${PYTHON} $ENV{IDF_PATH}/tools/ci/check_callgraph.py --rtl-dir ${CMAKE_BINARY_DIR}/esp-idf/driver/ diff --git a/components/driver/test_apps/gptimer/sdkconfig.ci.iram_safe b/components/driver/test_apps/gptimer/sdkconfig.ci.iram_safe index 3979b28af4..5dbcade839 100644 --- a/components/driver/test_apps/gptimer/sdkconfig.ci.iram_safe +++ b/components/driver/test_apps/gptimer/sdkconfig.ci.iram_safe @@ -1,5 +1,5 @@ CONFIG_COMPILER_DUMP_RTL_FILES=y CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM=y CONFIG_GPTIMER_ISR_IRAM_SAFE=y -# disable log as most of log access rodata string on error, causing RTL check failure -CONFIG_LOG_DEFAULT_LEVEL_NONE=y +# silent the error check, as the error string are stored in rodata, causing RTL check failure +CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y diff --git a/components/esp_adc_cal/esp_adc_cal_common.c b/components/esp_adc_cal/esp_adc_cal_common.c index 809c001625..0835656ca1 100644 --- a/components/esp_adc_cal/esp_adc_cal_common.c +++ b/components/esp_adc_cal/esp_adc_cal_common.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -14,7 +14,7 @@ #include "hal/adc_types.h" #include "esp_adc_cal.h" -const static char *TAG = "ADC_CALI"; +const __attribute__((unused)) static char *TAG = "ADC_CALI"; esp_err_t esp_adc_cal_get_voltage(adc_channel_t channel, const esp_adc_cal_characteristics_t *chars, diff --git a/components/esp_hw_support/esp_async_memcpy.c b/components/esp_hw_support/esp_async_memcpy.c index dda8c6cca9..6b245f2d7e 100644 --- a/components/esp_hw_support/esp_async_memcpy.c +++ b/components/esp_hw_support/esp_async_memcpy.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -88,6 +88,8 @@ esp_err_t esp_async_memcpy_install(const async_memcpy_config_t *config, async_me ret = async_memcpy_impl_init(&mcp_hdl->mcp_impl); ESP_GOTO_ON_ERROR(ret, err, TAG, "DMA M2M init failed"); + ESP_LOGD(TAG, "installed memory to memory copy channel at %p", mcp_hdl); + *asmcp = mcp_hdl; async_memcpy_impl_start(&mcp_hdl->mcp_impl, (intptr_t)&mcp_hdl->out_streams[0].desc, (intptr_t)&mcp_hdl->in_streams[0].desc); diff --git a/components/esp_lcd/src/esp_lcd_panel_io.c b/components/esp_lcd/src/esp_lcd_panel_io.c index 1c45c65a0a..aabbd5f950 100644 --- a/components/esp_lcd/src/esp_lcd_panel_io.c +++ b/components/esp_lcd/src/esp_lcd_panel_io.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -8,7 +8,7 @@ #include "esp_lcd_panel_io.h" #include "esp_lcd_panel_io_interface.h" -static const char *TAG = "lcd_panel.io"; +static __attribute__((unused)) const char *TAG = "lcd_panel.io"; esp_err_t esp_lcd_panel_io_tx_param(esp_lcd_panel_io_handle_t io, int lcd_cmd, const void *param, size_t param_size) { diff --git a/components/esp_lcd/src/esp_lcd_panel_ops.c b/components/esp_lcd/src/esp_lcd_panel_ops.c index aae00a82b3..d077fdeae8 100644 --- a/components/esp_lcd/src/esp_lcd_panel_ops.c +++ b/components/esp_lcd/src/esp_lcd_panel_ops.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -8,7 +8,7 @@ #include "esp_lcd_panel_ops.h" #include "esp_lcd_panel_interface.h" -static const char *TAG = "lcd_panel"; +static __attribute__((unused)) const char *TAG = "lcd_panel"; esp_err_t esp_lcd_panel_reset(esp_lcd_panel_handle_t panel) { diff --git a/docs/en/api-reference/peripherals/gptimer.rst b/docs/en/api-reference/peripherals/gptimer.rst index 1d491b045c..f43ec300f0 100644 --- a/docs/en/api-reference/peripherals/gptimer.rst +++ b/docs/en/api-reference/peripherals/gptimer.rst @@ -23,11 +23,17 @@ The following sections of this document cover the typical steps to install and o - `Set and Get count value <#set-and-get-count-value>`__ - covers how to force the timer counting from a start point and how to get the count value at anytime. -- `Start and Stop timer <#start-and-stop-timer>`__ - covers which parameters should be set up to start the timer with specific alarm event behavior. +- `Set Up Alarm Action <#set-up-alarm-action>`__ - covers the parameters that should be set up to enable the alarm event. + +- `Register Event Callbacks <#register-event-callbacks>`__ - covers how to hook user specific code to the alarm event callback function. + +- `Start and Stop timer <#start-and-stop-timer>`__ - shows some typical use cases that start the timer with different alarm behavior. - `Power Management <#power-management>`__ - describes how different source clock selections can affect power consumption. -- `IRAM safe <#iram-safe>`__ - describes tips on how to make the timer interrupt and IO control functions work better along with a disabled cache. +- `IRAM Safe <#iram-safe>`__ - describes tips on how to make the timer interrupt and IO control functions work better along with a disabled cache. + +- `Thread Safety <#thread-safety>`__ - lists which APIs are guaranteed to be thread safe by the driver. Resource Allocation ^^^^^^^^^^^^^^^^^^^ @@ -260,6 +266,12 @@ There's another Kconfig option :ref:`CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM` that can - :cpp:func:`gptimer_set_raw_count` - :cpp:func:`gptimer_set_alarm_action` +Thread Safety +^^^^^^^^^^^^^ + +The factory function :cpp:func:`gptimer_new_timer` is guaranteed to be thread safe by the driver, which means, user can call it from different RTOS tasks without protection by extra locks. +Other functions that take the :cpp:type:`gptimer_handle_t` as the first positional parameter, are not thread safe. The lifecycle of the gptimer handle is maintained by the user. So user should avoid calling them concurrently. If it has to, then one should introduce another mutex to prevent the gptimer handle being accessed concurrently. + Application Examples --------------------