Merge branch 'bugfix/unused_tag_string_warnings' into 'master'

Fix build warnings when CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT is set to true

Closes IDFGH-6608

See merge request espressif/esp-idf!16827
This commit is contained in:
morris 2022-01-18 05:57:52 +00:00
commit a416b13d4c
17 changed files with 73 additions and 87 deletions

View File

@ -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 * 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. 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 DAC

View File

@ -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 * 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_DEFAULT (4) // Increase computing accuracy.
#define TOUCH_PAD_SHIFT_ROUND_DEFAULT (8) // ROUND = 2^(n-1); rounding off for fractional. #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_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") #define TOUCH_NULL_POINTER_CHECK(p, name) ESP_RETURN_ON_FALSE((p), ESP_ERR_INVALID_ARG, TOUCH_TAG, "input param '"name"' is NULL")

View File

@ -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 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -18,7 +18,7 @@
#include "soc/dac_periph.h" #include "soc/dac_periph.h"
#include "hal/dac_hal.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. 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) #define DAC_ENTER_CRITICAL() portENTER_CRITICAL(&rtc_spinlock)

View File

@ -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 * 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_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 #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 { \ #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"); \ ESP_RETURN_ON_FALSE(channel < SOC_TOUCH_SENSOR_NUM && channel >= 0, ESP_ERR_INVALID_ARG, TOUCH_TAG, "Touch channel error"); \

View File

@ -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 * 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_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 #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 { \ #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"); \ ESP_RETURN_ON_FALSE(channel < SOC_TOUCH_SENSOR_NUM && channel >= 0, ESP_ERR_INVALID_ARG, TOUCH_TAG, "Touch channel error"); \

View File

@ -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 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -34,12 +34,6 @@ static const char *TAG = "gdma";
#define GDMA_MEM_ALLOC_CAPS MALLOC_CAP_DEFAULT #define GDMA_MEM_ALLOC_CAPS MALLOC_CAP_DEFAULT
#endif // CONFIG_GDMA_ISR_IRAM_SAFE #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 GDMA_INVALID_PERIPH_TRIG (0x3F)
#define SEARCH_REQUEST_RX_CHANNEL (1 << 0) #define SEARCH_REQUEST_RX_CHANNEL (1 << 0)
#define SEARCH_REQUEST_TX_CHANNEL (1 << 1) #define SEARCH_REQUEST_TX_CHANNEL (1 << 1)
@ -452,7 +446,7 @@ err:
return ret; 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; esp_err_t ret = ESP_OK;
gdma_pair_t *pair = NULL; gdma_pair_t *pair = NULL;
@ -473,7 +467,7 @@ err:
return ret; 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; esp_err_t ret = ESP_OK;
gdma_pair_t *pair = NULL; gdma_pair_t *pair = NULL;
@ -492,7 +486,7 @@ err:
return ret; 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; esp_err_t ret = ESP_OK;
gdma_pair_t *pair = NULL; gdma_pair_t *pair = NULL;
@ -511,7 +505,7 @@ err:
return ret; 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; esp_err_t ret = ESP_OK;
gdma_pair_t *pair = NULL; gdma_pair_t *pair = NULL;

View File

@ -35,12 +35,6 @@
#define GPTIMER_MEM_ALLOC_CAPS MALLOC_CAP_DEFAULT #define GPTIMER_MEM_ALLOC_CAPS MALLOC_CAP_DEFAULT
#endif //CONFIG_GPTIMER_ISR_IRAM_SAFE #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 #define GPTIMER_PM_LOCK_NAME_LEN_MAX 16
static const char *TAG = "gptimer"; static const char *TAG = "gptimer";
@ -76,7 +70,6 @@ struct gptimer_t {
timer_hal_context_t hal; 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 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; 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 portMUX_TYPE spinlock; // to protect per-timer resources concurent accessed by task and ISR handler
gptimer_alarm_cb_t on_alarm; gptimer_alarm_cb_t on_alarm;
void *user_ctx; 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 gptimer_group_t *gptimer_acquire_group_handle(int group_id);
static void gptimer_release_group_handle(gptimer_group_t *group); 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_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); 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) 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++) { for (int i = 0; (i < SOC_TIMER_GROUPS) && (timer_id < 0); i++) {
group = gptimer_acquire_group_handle(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 // loop to search free timer in the group
portENTER_CRITICAL(&group->spinlock); portENTER_CRITICAL(&group->spinlock);
for (int j = 0; j < SOC_TIMER_GROUP_TIMERS_PER_GROUP; j++) { 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->fsm = GPTIMER_FSM_STOP;
timer->direction = config->direction; timer->direction = config->direction;
timer->flags.intr_shared = config->flags.intr_shared; 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); ESP_LOGD(TAG, "new gptimer (%d,%d) at %p, resolution=%uHz", group_id, timer_id, timer, timer->resolution_hz);
*ret_timer = timer; *ret_timer = timer;
return ESP_OK; 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_pm_lock_delete(timer->pm_lock);
ESP_LOGD(TAG, "uninstall APB_FREQ_MAX lock for timer (%d,%d)", group_id, timer_id); ESP_LOGD(TAG, "uninstall APB_FREQ_MAX lock for timer (%d,%d)", group_id, timer_id);
} }
_lock_close(&timer->mutex);
free(timer); free(timer);
ESP_LOGD(TAG, "del timer (%d,%d)", group_id, timer_id); 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; return ESP_OK;
} }
GPTIMER_CTRL_FUNC_ATTR
esp_err_t gptimer_set_raw_count(gptimer_handle_t timer, unsigned long long value) 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"); 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; return ESP_OK;
} }
GPTIMER_CTRL_FUNC_ATTR
esp_err_t gptimer_get_raw_count(gptimer_handle_t timer, unsigned long long *value) 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"); 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; gptimer_group_t *group = NULL;
ESP_RETURN_ON_FALSE(timer && cbs, ESP_ERR_INVALID_ARG, TAG, "invalid argument"); ESP_RETURN_ON_FALSE(timer && cbs, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
group = timer->group; group = timer->group;
int group_id = group->group_id;
int timer_id = timer->timer_id;
#if CONFIG_GPTIMER_ISR_IRAM_SAFE #if CONFIG_GPTIMER_ISR_IRAM_SAFE
if (cbs->on_alarm) { if (cbs->on_alarm) {
@ -253,11 +243,17 @@ esp_err_t gptimer_register_event_callbacks(gptimer_handle_t timer, const gptimer
#endif #endif
// lazy install interrupt service // 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 // enable/disable GPTimer interrupt events
portENTER_CRITICAL_SAFE(&group->spinlock); 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); portEXIT_CRITICAL_SAFE(&group->spinlock);
timer->on_alarm = cbs->on_alarm; 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; 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_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"); 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; return ESP_OK;
} }
GPTIMER_CTRL_FUNC_ATTR
esp_err_t gptimer_start(gptimer_handle_t timer) esp_err_t gptimer_start(gptimer_handle_t timer)
{ {
ESP_RETURN_ON_FALSE(timer, ESP_ERR_INVALID_ARG, TAG, "invalid argument"); 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; return ESP_OK;
} }
GPTIMER_CTRL_FUNC_ATTR
esp_err_t gptimer_stop(gptimer_handle_t timer) esp_err_t gptimer_stop(gptimer_handle_t timer)
{ {
ESP_RETURN_ON_FALSE(timer, ESP_ERR_INVALID_ARG, TAG, "invalid argument"); 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 { } else {
group = s_platform.groups[group_id]; group = s_platform.groups[group_id];
} }
// someone acquired the group handle means we have a new object that refer to this group if (group) {
s_platform.group_ref_counts[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]++;
}
_lock_release(&s_platform.mutex); _lock_release(&s_platform.mutex);
if (new_group) { if (new_group) {
@ -433,34 +428,6 @@ static esp_err_t gptimer_select_periph_clock(gptimer_t *timer, gptimer_clock_sou
return ret; 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 // Put the default ISR handler in the IRAM for better performance
IRAM_ATTR static void gptimer_default_isr(void *args) IRAM_ATTR static void gptimer_default_isr(void *args)
{ {

View File

@ -21,7 +21,7 @@ extern "C" {
typedef struct gptimer_t *gptimer_handle_t; typedef struct gptimer_t *gptimer_handle_t;
/** /**
* @brief GPTimer event data * @brief GPTimer alarm event data
*/ */
typedef struct { typedef struct {
uint64_t count_value; /*!< Current count value */ 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] timer Timer handle created by `gptimer_new_timer()`
* @param[in] edata Alarm event data, fed by driver * @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 * @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); typedef bool (*gptimer_alarm_cb_t) (gptimer_handle_t timer, const gptimer_alarm_event_data_t *edata, void *user_ctx);

View File

@ -21,7 +21,7 @@
#include "soc/clk_ctrl_os.h" #include "soc/clk_ctrl_os.h"
#include "esp_private/periph_ctrl.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_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") #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 DIM(array) (sizeof(array)/sizeof(*array))
#define LEDC_IS_DIV_INVALID(div) ((div) <= LEDC_LL_FRACTIONAL_MAX || (div) > LEDC_TIMER_DIV_NUM_MAX) #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 __attribute__((unused)) const char *LEDC_NOT_INIT = "LEDC is not initialized";
static const char *LEDC_FADE_SERVICE_ERR_STR = "LEDC fade service not installed"; static __attribute__((unused)) 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_FADE_INIT_ERROR_STR = "LEDC fade channel init error, not enough memory or service not installed";
//This value will be calibrated when in use. //This value will be calibrated when in use.
static uint32_t s_ledc_slow_clk_8M = 0; static uint32_t s_ledc_slow_clk_8M = 0;

View File

@ -7,3 +7,14 @@ entries:
# placed in flash. # placed in flash.
if TWAI_ISR_IN_IRAM = y && (TWAI_ERRATA_FIX_RX_FRAME_INVALID = y || TWAI_ERRATA_FIX_RX_FIFO_CORRUPT = y): 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) 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)

View File

@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake) include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(gptimer_test) project(gptimer_test)
if(CONFIG_GPTIMER_ISR_IRAM_SAFE) if(CONFIG_COMPILER_DUMP_RTL_FILES)
add_custom_target(check_test_app_sections ALL add_custom_target(check_test_app_sections ALL
COMMAND ${PYTHON} $ENV{IDF_PATH}/tools/ci/check_callgraph.py COMMAND ${PYTHON} $ENV{IDF_PATH}/tools/ci/check_callgraph.py
--rtl-dir ${CMAKE_BINARY_DIR}/esp-idf/driver/ --rtl-dir ${CMAKE_BINARY_DIR}/esp-idf/driver/

View File

@ -1,5 +1,5 @@
CONFIG_COMPILER_DUMP_RTL_FILES=y CONFIG_COMPILER_DUMP_RTL_FILES=y
CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM=y CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM=y
CONFIG_GPTIMER_ISR_IRAM_SAFE=y CONFIG_GPTIMER_ISR_IRAM_SAFE=y
# disable log as most of log access rodata string on error, causing RTL check failure # silent the error check, as the error string are stored in rodata, causing RTL check failure
CONFIG_LOG_DEFAULT_LEVEL_NONE=y CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y

View File

@ -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 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -14,7 +14,7 @@
#include "hal/adc_types.h" #include "hal/adc_types.h"
#include "esp_adc_cal.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, esp_err_t esp_adc_cal_get_voltage(adc_channel_t channel,
const esp_adc_cal_characteristics_t *chars, const esp_adc_cal_characteristics_t *chars,

View File

@ -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 * 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); ret = async_memcpy_impl_init(&mcp_hdl->mcp_impl);
ESP_GOTO_ON_ERROR(ret, err, TAG, "DMA M2M init failed"); 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; *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); async_memcpy_impl_start(&mcp_hdl->mcp_impl, (intptr_t)&mcp_hdl->out_streams[0].desc, (intptr_t)&mcp_hdl->in_streams[0].desc);

View File

@ -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 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -8,7 +8,7 @@
#include "esp_lcd_panel_io.h" #include "esp_lcd_panel_io.h"
#include "esp_lcd_panel_io_interface.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) 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)
{ {

View File

@ -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 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -8,7 +8,7 @@
#include "esp_lcd_panel_ops.h" #include "esp_lcd_panel_ops.h"
#include "esp_lcd_panel_interface.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) esp_err_t esp_lcd_panel_reset(esp_lcd_panel_handle_t panel)
{ {

View File

@ -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. - `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. - `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 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_raw_count`
- :cpp:func:`gptimer_set_alarm_action` - :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 Application Examples
-------------------- --------------------