mirror of
https://github.com/espressif/esp-idf.git
synced 2025-12-02 15:23:21 +00:00
Rename Kconfig options (components/esp_event)
This commit is contained in:
@@ -23,13 +23,13 @@
|
||||
#include "esp_event_internal.h"
|
||||
#include "esp_event_private.h"
|
||||
|
||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
||||
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||
#include "esp_timer.h"
|
||||
#endif
|
||||
|
||||
/* ---------------------------- Definitions --------------------------------- */
|
||||
|
||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
||||
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||
// LOOP @<address, name> rx:<recieved events no.> dr:<dropped events no.>
|
||||
#define LOOP_DUMP_FORMAT "LOOP @%p,%s rx:%u dr:%u\n"
|
||||
// handler @<address> ev:<base, id> inv:<times invoked> time:<runtime>
|
||||
@@ -47,7 +47,7 @@
|
||||
static const char* TAG = "event";
|
||||
static const char* esp_event_any_base = "any";
|
||||
|
||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
||||
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||
static SLIST_HEAD(esp_event_loop_instance_list_t, esp_event_loop_instance) s_event_loops =
|
||||
SLIST_HEAD_INITIALIZER(s_event_loops);
|
||||
|
||||
@@ -57,7 +57,7 @@ static portMUX_TYPE s_event_loops_spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
|
||||
/* ------------------------- Static Functions ------------------------------- */
|
||||
|
||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
||||
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||
|
||||
|
||||
static int esp_event_dump_prepare()
|
||||
@@ -126,18 +126,18 @@ static void handler_execute(esp_event_loop_instance_t* loop, esp_event_handler_i
|
||||
{
|
||||
ESP_LOGD(TAG, "running post %s:%d with handler %p on loop %p", post.base, post.id, handler->handler, loop);
|
||||
|
||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
||||
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||
int64_t start, diff;
|
||||
start = esp_timer_get_time();
|
||||
#endif
|
||||
// Execute the handler
|
||||
#if CONFIG_POST_EVENTS_FROM_ISR
|
||||
#if CONFIG_ESP_EVENT_POST_FROM_ISR
|
||||
(*(handler->handler))(handler->arg, post.base, post.id, post.data_allocd ? post.data.ptr : &post.data.val);
|
||||
#else
|
||||
(*(handler->handler))(handler->arg, post.base, post.id, post.data);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
||||
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||
diff = esp_timer_get_time() - start;
|
||||
|
||||
xSemaphoreTake(loop->profiling_mutex, portMAX_DELAY);
|
||||
@@ -379,7 +379,7 @@ static void loop_node_remove_all_handler(esp_event_loop_node_t* loop_node)
|
||||
|
||||
static void inline __attribute__((always_inline)) post_instance_delete(esp_event_post_instance_t* post)
|
||||
{
|
||||
#if CONFIG_POST_EVENTS_FROM_ISR
|
||||
#if CONFIG_ESP_EVENT_POST_FROM_ISR
|
||||
if (post->data_allocd && post->data.ptr) {
|
||||
free(post->data.ptr);
|
||||
}
|
||||
@@ -418,7 +418,7 @@ esp_err_t esp_event_loop_create(const esp_event_loop_args_t* event_loop_args, es
|
||||
goto on_err;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
||||
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||
loop->profiling_mutex = xSemaphoreCreateMutex();
|
||||
if (loop->profiling_mutex == NULL) {
|
||||
ESP_LOGE(TAG, "create event loop profiling mutex failed");
|
||||
@@ -450,7 +450,7 @@ esp_err_t esp_event_loop_create(const esp_event_loop_args_t* event_loop_args, es
|
||||
|
||||
loop->running_task = NULL;
|
||||
|
||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
||||
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||
portENTER_CRITICAL(&s_event_loops_spinlock);
|
||||
SLIST_INSERT_HEAD(&s_event_loops, loop, next);
|
||||
portEXIT_CRITICAL(&s_event_loops_spinlock);
|
||||
@@ -471,7 +471,7 @@ on_err:
|
||||
vSemaphoreDelete(loop->mutex);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
||||
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||
if(loop->profiling_mutex != NULL) {
|
||||
vSemaphoreDelete(loop->profiling_mutex);
|
||||
}
|
||||
@@ -582,13 +582,13 @@ esp_err_t esp_event_loop_delete(esp_event_loop_handle_t event_loop)
|
||||
|
||||
esp_event_loop_instance_t* loop = (esp_event_loop_instance_t*) event_loop;
|
||||
SemaphoreHandle_t loop_mutex = loop->mutex;
|
||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
||||
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||
SemaphoreHandle_t loop_profiling_mutex = loop->profiling_mutex;
|
||||
#endif
|
||||
|
||||
xSemaphoreTakeRecursive(loop->mutex, portMAX_DELAY);
|
||||
|
||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
||||
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||
xSemaphoreTakeRecursive(loop->profiling_mutex, portMAX_DELAY);
|
||||
portENTER_CRITICAL(&s_event_loops_spinlock);
|
||||
SLIST_REMOVE(&s_event_loops, loop, esp_event_loop_instance, next);
|
||||
@@ -619,7 +619,7 @@ esp_err_t esp_event_loop_delete(esp_event_loop_handle_t event_loop)
|
||||
free(loop);
|
||||
// Free loop mutex before deleting
|
||||
xSemaphoreGiveRecursive(loop_mutex);
|
||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
||||
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||
xSemaphoreGiveRecursive(loop_profiling_mutex);
|
||||
vSemaphoreDelete(loop_profiling_mutex);
|
||||
#endif
|
||||
@@ -751,7 +751,7 @@ esp_err_t esp_event_post_to(esp_event_loop_handle_t event_loop, esp_event_base_t
|
||||
}
|
||||
|
||||
memcpy(event_data_copy, event_data, event_data_size);
|
||||
#if CONFIG_POST_EVENTS_FROM_ISR
|
||||
#if CONFIG_ESP_EVENT_POST_FROM_ISR
|
||||
post.data.ptr = event_data_copy;
|
||||
post.data_allocd = true;
|
||||
#else
|
||||
@@ -790,20 +790,20 @@ esp_err_t esp_event_post_to(esp_event_loop_handle_t event_loop, esp_event_base_t
|
||||
if (result != pdTRUE) {
|
||||
post_instance_delete(&post);
|
||||
|
||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
||||
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||
atomic_fetch_add(&loop->events_dropped, 1);
|
||||
#endif
|
||||
return ESP_ERR_TIMEOUT;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
||||
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||
atomic_fetch_add(&loop->events_recieved, 1);
|
||||
#endif
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#if CONFIG_POST_EVENTS_FROM_ISR
|
||||
#if CONFIG_ESP_EVENT_POST_FROM_ISR
|
||||
esp_err_t esp_event_isr_post_to(esp_event_loop_handle_t event_loop, esp_event_base_t event_base, int32_t event_id,
|
||||
void* event_data, size_t event_data_size, BaseType_t* task_unblocked)
|
||||
{
|
||||
@@ -837,13 +837,13 @@ esp_err_t esp_event_isr_post_to(esp_event_loop_handle_t event_loop, esp_event_ba
|
||||
if (result != pdTRUE) {
|
||||
post_instance_delete(&post);
|
||||
|
||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
||||
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||
atomic_fetch_add(&loop->events_dropped, 1);
|
||||
#endif
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
||||
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||
atomic_fetch_add(&loop->events_recieved, 1);
|
||||
#endif
|
||||
|
||||
@@ -853,7 +853,7 @@ esp_err_t esp_event_isr_post_to(esp_event_loop_handle_t event_loop, esp_event_ba
|
||||
|
||||
esp_err_t esp_event_dump(FILE* file)
|
||||
{
|
||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
||||
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||
assert(file);
|
||||
|
||||
esp_event_loop_instance_t* loop_it;
|
||||
|
||||
Reference in New Issue
Block a user