Rename Kconfig options (components/esp_event)
This commit is contained in:
parent
976d2a4b7f
commit
bf626f2aba
11 changed files with 57 additions and 51 deletions
|
@ -15,7 +15,7 @@ set(COMPONENT_ADD_LDFRAGMENTS linker.lf)
|
||||||
|
|
||||||
register_component()
|
register_component()
|
||||||
|
|
||||||
if(GCC_NOT_5_2_0 AND CONFIG_EVENT_LOOP_PROFILING)
|
if(GCC_NOT_5_2_0 AND CONFIG_ESP_EVENT_LOOP_PROFILING)
|
||||||
# uses C11 atomic feature
|
# uses C11 atomic feature
|
||||||
set_source_files_properties(esp_event.c PROPERTIES COMPILE_FLAGS -std=gnu11)
|
set_source_files_properties(esp_event.c PROPERTIES COMPILE_FLAGS -std=gnu11)
|
||||||
endif()
|
endif()
|
|
@ -1,6 +1,6 @@
|
||||||
menu "Event Loop Library"
|
menu "Event Loop Library"
|
||||||
|
|
||||||
config EVENT_LOOP_PROFILING
|
config ESP_EVENT_LOOP_PROFILING
|
||||||
bool "Enable event loop profiling"
|
bool "Enable event loop profiling"
|
||||||
default n
|
default n
|
||||||
help
|
help
|
||||||
|
@ -8,16 +8,16 @@ menu "Event Loop Library"
|
||||||
to/recieved by an event loop, number of callbacks involved, number of events dropped to to a full event
|
to/recieved by an event loop, number of callbacks involved, number of events dropped to to a full event
|
||||||
loop queue, run time of event handlers, and number of times/run time of each event handler.
|
loop queue, run time of event handlers, and number of times/run time of each event handler.
|
||||||
|
|
||||||
config POST_EVENTS_FROM_ISR
|
config ESP_EVENT_POST_FROM_ISR
|
||||||
bool "Support posting events from ISRs"
|
bool "Support posting events from ISRs"
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
Enable posting events from interrupt handlers.
|
Enable posting events from interrupt handlers.
|
||||||
|
|
||||||
config POST_EVENTS_FROM_IRAM_ISR
|
config ESP_EVENT_POST_FROM_IRAM_ISR
|
||||||
bool "Support posting events from ISRs placed in IRAM"
|
bool "Support posting events from ISRs placed in IRAM"
|
||||||
default y
|
default y
|
||||||
depends on POST_EVENTS_FROM_ISR
|
depends on ESP_EVENT_POST_FROM_ISR
|
||||||
help
|
help
|
||||||
Enable posting events from interrupt handlers placed in IRAM. Enabling this option places API functions
|
Enable posting events from interrupt handlers placed in IRAM. Enabling this option places API functions
|
||||||
esp_event_post and esp_event_post_to in IRAM.
|
esp_event_post and esp_event_post_to in IRAM.
|
||||||
|
|
|
@ -5,7 +5,7 @@ COMPONENT_ADD_INCLUDEDIRS := include
|
||||||
COMPONENT_PRIV_INCLUDEDIRS := private_include
|
COMPONENT_PRIV_INCLUDEDIRS := private_include
|
||||||
COMPONENT_SRCDIRS := .
|
COMPONENT_SRCDIRS := .
|
||||||
|
|
||||||
ifdef CONFIG_EVENT_LOOP_PROFILING
|
ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||||
PROFILING_ENABLED := 1
|
PROFILING_ENABLED := 1
|
||||||
else
|
else
|
||||||
PROFILING_ENABLED := 0
|
PROFILING_ENABLED := 0
|
||||||
|
|
|
@ -55,7 +55,7 @@ esp_err_t esp_event_post(esp_event_base_t event_base, int32_t event_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if CONFIG_POST_EVENTS_FROM_ISR
|
#if CONFIG_ESP_EVENT_POST_FROM_ISR
|
||||||
esp_err_t esp_event_isr_post(esp_event_base_t event_base, int32_t event_id,
|
esp_err_t esp_event_isr_post(esp_event_base_t event_base, int32_t event_id,
|
||||||
void* event_data, size_t event_data_size, BaseType_t* task_unblocked)
|
void* event_data, size_t event_data_size, BaseType_t* task_unblocked)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,13 +23,13 @@
|
||||||
#include "esp_event_internal.h"
|
#include "esp_event_internal.h"
|
||||||
#include "esp_event_private.h"
|
#include "esp_event_private.h"
|
||||||
|
|
||||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||||
#include "esp_timer.h"
|
#include "esp_timer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ---------------------------- Definitions --------------------------------- */
|
/* ---------------------------- Definitions --------------------------------- */
|
||||||
|
|
||||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||||
// LOOP @<address, name> rx:<recieved events no.> dr:<dropped events no.>
|
// LOOP @<address, name> rx:<recieved events no.> dr:<dropped events no.>
|
||||||
#define LOOP_DUMP_FORMAT "LOOP @%p,%s rx:%u dr:%u\n"
|
#define LOOP_DUMP_FORMAT "LOOP @%p,%s rx:%u dr:%u\n"
|
||||||
// handler @<address> ev:<base, id> inv:<times invoked> time:<runtime>
|
// handler @<address> ev:<base, id> inv:<times invoked> time:<runtime>
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
static const char* TAG = "event";
|
static const char* TAG = "event";
|
||||||
static const char* esp_event_any_base = "any";
|
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 =
|
static SLIST_HEAD(esp_event_loop_instance_list_t, esp_event_loop_instance) s_event_loops =
|
||||||
SLIST_HEAD_INITIALIZER(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 ------------------------------- */
|
/* ------------------------- Static Functions ------------------------------- */
|
||||||
|
|
||||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||||
|
|
||||||
|
|
||||||
static int esp_event_dump_prepare()
|
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);
|
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;
|
int64_t start, diff;
|
||||||
start = esp_timer_get_time();
|
start = esp_timer_get_time();
|
||||||
#endif
|
#endif
|
||||||
// Execute the handler
|
// 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);
|
(*(handler->handler))(handler->arg, post.base, post.id, post.data_allocd ? post.data.ptr : &post.data.val);
|
||||||
#else
|
#else
|
||||||
(*(handler->handler))(handler->arg, post.base, post.id, post.data);
|
(*(handler->handler))(handler->arg, post.base, post.id, post.data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||||
diff = esp_timer_get_time() - start;
|
diff = esp_timer_get_time() - start;
|
||||||
|
|
||||||
xSemaphoreTake(loop->profiling_mutex, portMAX_DELAY);
|
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)
|
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) {
|
if (post->data_allocd && post->data.ptr) {
|
||||||
free(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;
|
goto on_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||||
loop->profiling_mutex = xSemaphoreCreateMutex();
|
loop->profiling_mutex = xSemaphoreCreateMutex();
|
||||||
if (loop->profiling_mutex == NULL) {
|
if (loop->profiling_mutex == NULL) {
|
||||||
ESP_LOGE(TAG, "create event loop profiling mutex failed");
|
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;
|
loop->running_task = NULL;
|
||||||
|
|
||||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||||
portENTER_CRITICAL(&s_event_loops_spinlock);
|
portENTER_CRITICAL(&s_event_loops_spinlock);
|
||||||
SLIST_INSERT_HEAD(&s_event_loops, loop, next);
|
SLIST_INSERT_HEAD(&s_event_loops, loop, next);
|
||||||
portEXIT_CRITICAL(&s_event_loops_spinlock);
|
portEXIT_CRITICAL(&s_event_loops_spinlock);
|
||||||
|
@ -471,7 +471,7 @@ on_err:
|
||||||
vSemaphoreDelete(loop->mutex);
|
vSemaphoreDelete(loop->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||||
if(loop->profiling_mutex != NULL) {
|
if(loop->profiling_mutex != NULL) {
|
||||||
vSemaphoreDelete(loop->profiling_mutex);
|
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;
|
esp_event_loop_instance_t* loop = (esp_event_loop_instance_t*) event_loop;
|
||||||
SemaphoreHandle_t loop_mutex = loop->mutex;
|
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;
|
SemaphoreHandle_t loop_profiling_mutex = loop->profiling_mutex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
xSemaphoreTakeRecursive(loop->mutex, portMAX_DELAY);
|
xSemaphoreTakeRecursive(loop->mutex, portMAX_DELAY);
|
||||||
|
|
||||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||||
xSemaphoreTakeRecursive(loop->profiling_mutex, portMAX_DELAY);
|
xSemaphoreTakeRecursive(loop->profiling_mutex, portMAX_DELAY);
|
||||||
portENTER_CRITICAL(&s_event_loops_spinlock);
|
portENTER_CRITICAL(&s_event_loops_spinlock);
|
||||||
SLIST_REMOVE(&s_event_loops, loop, esp_event_loop_instance, next);
|
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);
|
||||||
// Free loop mutex before deleting
|
// Free loop mutex before deleting
|
||||||
xSemaphoreGiveRecursive(loop_mutex);
|
xSemaphoreGiveRecursive(loop_mutex);
|
||||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||||
xSemaphoreGiveRecursive(loop_profiling_mutex);
|
xSemaphoreGiveRecursive(loop_profiling_mutex);
|
||||||
vSemaphoreDelete(loop_profiling_mutex);
|
vSemaphoreDelete(loop_profiling_mutex);
|
||||||
#endif
|
#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);
|
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.ptr = event_data_copy;
|
||||||
post.data_allocd = true;
|
post.data_allocd = true;
|
||||||
#else
|
#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) {
|
if (result != pdTRUE) {
|
||||||
post_instance_delete(&post);
|
post_instance_delete(&post);
|
||||||
|
|
||||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||||
atomic_fetch_add(&loop->events_dropped, 1);
|
atomic_fetch_add(&loop->events_dropped, 1);
|
||||||
#endif
|
#endif
|
||||||
return ESP_ERR_TIMEOUT;
|
return ESP_ERR_TIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||||
atomic_fetch_add(&loop->events_recieved, 1);
|
atomic_fetch_add(&loop->events_recieved, 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ESP_OK;
|
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,
|
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)
|
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) {
|
if (result != pdTRUE) {
|
||||||
post_instance_delete(&post);
|
post_instance_delete(&post);
|
||||||
|
|
||||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||||
atomic_fetch_add(&loop->events_dropped, 1);
|
atomic_fetch_add(&loop->events_dropped, 1);
|
||||||
#endif
|
#endif
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||||
atomic_fetch_add(&loop->events_recieved, 1);
|
atomic_fetch_add(&loop->events_recieved, 1);
|
||||||
#endif
|
#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)
|
esp_err_t esp_event_dump(FILE* file)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||||
assert(file);
|
assert(file);
|
||||||
|
|
||||||
esp_event_loop_instance_t* loop_it;
|
esp_event_loop_instance_t* loop_it;
|
||||||
|
|
|
@ -270,7 +270,7 @@ esp_err_t esp_event_post_to(esp_event_loop_handle_t event_loop,
|
||||||
size_t event_data_size,
|
size_t event_data_size,
|
||||||
TickType_t ticks_to_wait);
|
TickType_t ticks_to_wait);
|
||||||
|
|
||||||
#if CONFIG_POST_EVENTS_FROM_ISR
|
#if CONFIG_ESP_EVENT_POST_FROM_ISR
|
||||||
/**
|
/**
|
||||||
* @brief Special variant of esp_event_post for posting events from interrupt handlers.
|
* @brief Special variant of esp_event_post for posting events from interrupt handlers.
|
||||||
*
|
*
|
||||||
|
@ -282,9 +282,9 @@ esp_err_t esp_event_post_to(esp_event_loop_handle_t event_loop,
|
||||||
* higher priority than currently running task has been unblocked by the posted event;
|
* higher priority than currently running task has been unblocked by the posted event;
|
||||||
* a context switch should be requested before the interrupt is existed.
|
* a context switch should be requested before the interrupt is existed.
|
||||||
*
|
*
|
||||||
* @note this function is only available when CONFIG_POST_EVENTS_FROM_ISR is enabled
|
* @note this function is only available when CONFIG_ESP_EVENT_POST_FROM_ISR is enabled
|
||||||
* @note when this function is called from an interrupt handler placed in IRAM, this function should
|
* @note when this function is called from an interrupt handler placed in IRAM, this function should
|
||||||
* be placed in IRAM as well by enabling CONFIG_POST_EVENTS_FROM_IRAM_ISR
|
* be placed in IRAM as well by enabling CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK: Success
|
* - ESP_OK: Success
|
||||||
|
@ -310,9 +310,9 @@ esp_err_t esp_event_isr_post(esp_event_base_t event_base,
|
||||||
* higher priority than currently running task has been unblocked by the posted event;
|
* higher priority than currently running task has been unblocked by the posted event;
|
||||||
* a context switch should be requested before the interrupt is existed.
|
* a context switch should be requested before the interrupt is existed.
|
||||||
*
|
*
|
||||||
* @note this function is only available when CONFIG_POST_EVENTS_FROM_ISR is enabled
|
* @note this function is only available when CONFIG_ESP_EVENT_POST_FROM_ISR is enabled
|
||||||
* @note when this function is called from an interrupt handler placed in IRAM, this function should
|
* @note when this function is called from an interrupt handler placed in IRAM, this function should
|
||||||
* be placed in IRAM as well by enabling CONFIG_POST_EVENTS_FROM_IRAM_ISR
|
* be placed in IRAM as well by enabling CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK: Success
|
* - ESP_OK: Success
|
||||||
|
@ -366,7 +366,7 @@ esp_err_t esp_event_isr_post_to(esp_event_loop_handle_t event_loop,
|
||||||
*
|
*
|
||||||
* @param[in] file the file stream to output to
|
* @param[in] file the file stream to output to
|
||||||
*
|
*
|
||||||
* @note this function is a noop when CONFIG_EVENT_LOOP_PROFILING is disabled
|
* @note this function is a noop when CONFIG_ESP_EVENT_LOOP_PROFILING is disabled
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK: Success
|
* - ESP_OK: Success
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
if POST_EVENTS_FROM_IRAM_ISR = y:
|
if ESP_EVENT_POST_FROM_IRAM_ISR = y:
|
||||||
[mapping:esp_event]
|
[mapping:esp_event]
|
||||||
archive: libesp_event.a
|
archive: libesp_event.a
|
||||||
entries:
|
entries:
|
||||||
|
|
|
@ -28,7 +28,7 @@ typedef SLIST_HEAD(base_nodes, base_node) base_nodes_t;
|
||||||
typedef struct esp_event_handler_instance {
|
typedef struct esp_event_handler_instance {
|
||||||
esp_event_handler_t handler; /**< event handler function*/
|
esp_event_handler_t handler; /**< event handler function*/
|
||||||
void* arg; /**< event handler argument */
|
void* arg; /**< event handler argument */
|
||||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||||
uint32_t invoked; /**< number of times this handler has been invoked */
|
uint32_t invoked; /**< number of times this handler has been invoked */
|
||||||
int64_t time; /**< total runtime of this handler across all calls */
|
int64_t time; /**< total runtime of this handler across all calls */
|
||||||
#endif
|
#endif
|
||||||
|
@ -77,7 +77,7 @@ typedef struct esp_event_loop_instance {
|
||||||
SemaphoreHandle_t mutex; /**< mutex for updating the events linked list */
|
SemaphoreHandle_t mutex; /**< mutex for updating the events linked list */
|
||||||
esp_event_loop_nodes_t loop_nodes; /**< set of linked lists containing the
|
esp_event_loop_nodes_t loop_nodes; /**< set of linked lists containing the
|
||||||
registered handlers for the loop */
|
registered handlers for the loop */
|
||||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||||
atomic_uint_least32_t events_recieved; /**< number of events successfully posted to the loop */
|
atomic_uint_least32_t events_recieved; /**< number of events successfully posted to the loop */
|
||||||
atomic_uint_least32_t events_dropped; /**< number of events dropped due to queue being full */
|
atomic_uint_least32_t events_dropped; /**< number of events dropped due to queue being full */
|
||||||
SemaphoreHandle_t profiling_mutex; /**< mutex used for profiliing */
|
SemaphoreHandle_t profiling_mutex; /**< mutex used for profiliing */
|
||||||
|
@ -85,7 +85,7 @@ typedef struct esp_event_loop_instance {
|
||||||
#endif
|
#endif
|
||||||
} esp_event_loop_instance_t;
|
} esp_event_loop_instance_t;
|
||||||
|
|
||||||
#if CONFIG_POST_EVENTS_FROM_ISR
|
#if CONFIG_ESP_EVENT_POST_FROM_ISR
|
||||||
typedef union esp_event_post_data {
|
typedef union esp_event_post_data {
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
@ -96,7 +96,7 @@ typedef void* esp_event_post_data_t;
|
||||||
|
|
||||||
/// Event posted to the event queue
|
/// Event posted to the event queue
|
||||||
typedef struct esp_event_post_instance {
|
typedef struct esp_event_post_instance {
|
||||||
#if CONFIG_POST_EVENTS_FROM_ISR
|
#if CONFIG_ESP_EVENT_POST_FROM_ISR
|
||||||
bool data_allocd; /**< indicates whether data is alloc'd */
|
bool data_allocd; /**< indicates whether data is alloc'd */
|
||||||
#endif
|
#endif
|
||||||
esp_event_base_t base; /**< the event base */
|
esp_event_base_t base; /**< the event base */
|
||||||
|
|
6
components/esp_event/sdkconfig.rename
Normal file
6
components/esp_event/sdkconfig.rename
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# sdkconfig replacement configurations for deprecated options formatted as
|
||||||
|
# CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION
|
||||||
|
|
||||||
|
CONFIG_EVENT_LOOP_PROFILING CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||||
|
CONFIG_POST_EVENTS_FROM_ISR CONFIG_ESP_EVENT_POST_FROM_ISR
|
||||||
|
CONFIG_POST_EVENTS_FROM_IRAM_ISR CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR
|
|
@ -276,7 +276,7 @@ static void test_teardown()
|
||||||
#define TIMER_SCALE (TIMER_BASE_CLK / TIMER_DIVIDER) // convert counter value to seconds
|
#define TIMER_SCALE (TIMER_BASE_CLK / TIMER_DIVIDER) // convert counter value to seconds
|
||||||
#define TIMER_INTERVAL0_SEC (2.0) // sample test interval for the first timer
|
#define TIMER_INTERVAL0_SEC (2.0) // sample test interval for the first timer
|
||||||
|
|
||||||
#if CONFIG_POST_EVENTS_FROM_ISR
|
#if CONFIG_ESP_EVENT_POST_FROM_ISR
|
||||||
static void test_handler_post_from_isr(void* event_handler_arg, esp_event_base_t event_base, int32_t event_id, void* event_data)
|
static void test_handler_post_from_isr(void* event_handler_arg, esp_event_base_t event_base, int32_t event_id, void* event_data)
|
||||||
{
|
{
|
||||||
SemaphoreHandle_t *sem = (SemaphoreHandle_t*) event_handler_arg;
|
SemaphoreHandle_t *sem = (SemaphoreHandle_t*) event_handler_arg;
|
||||||
|
@ -287,7 +287,7 @@ static void test_handler_post_from_isr(void* event_handler_arg, esp_event_base_t
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_POST_EVENTS_FROM_ISR
|
#if CONFIG_ESP_EVENT_POST_FROM_ISR
|
||||||
void IRAM_ATTR test_event_on_timer_alarm(void* para)
|
void IRAM_ATTR test_event_on_timer_alarm(void* para)
|
||||||
{
|
{
|
||||||
/* Retrieve the interrupt status and the counter value
|
/* Retrieve the interrupt status and the counter value
|
||||||
|
@ -313,7 +313,7 @@ void IRAM_ATTR test_event_on_timer_alarm(void* para)
|
||||||
portYIELD_FROM_ISR();
|
portYIELD_FROM_ISR();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif //CONFIG_POST_EVENTS_FROM_ISR
|
#endif //CONFIG_ESP_EVENT_POST_FROM_ISR
|
||||||
|
|
||||||
TEST_CASE("can create and delete event loops", "[event]")
|
TEST_CASE("can create and delete event loops", "[event]")
|
||||||
{
|
{
|
||||||
|
@ -850,7 +850,7 @@ static void performance_test(bool dedicated_task)
|
||||||
|
|
||||||
TEST_TEARDOWN();
|
TEST_TEARDOWN();
|
||||||
|
|
||||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||||
ESP_LOGI(TAG, "events dispatched/second with profiling enabled: %d", average);
|
ESP_LOGI(TAG, "events dispatched/second with profiling enabled: %d", average);
|
||||||
// Enabling profiling will slow down event dispatch, so the set threshold
|
// Enabling profiling will slow down event dispatch, so the set threshold
|
||||||
// is not valid when it is enabled.
|
// is not valid when it is enabled.
|
||||||
|
@ -860,7 +860,7 @@ static void performance_test(bool dedicated_task)
|
||||||
#else
|
#else
|
||||||
TEST_PERFORMANCE_GREATER_THAN(EVENT_DISPATCH_PSRAM, "%d", average);
|
TEST_PERFORMANCE_GREATER_THAN(EVENT_DISPATCH_PSRAM, "%d", average);
|
||||||
#endif // CONFIG_SPIRAM_SUPPORT
|
#endif // CONFIG_SPIRAM_SUPPORT
|
||||||
#endif // CONFIG_EVENT_LOOP_PROFILING
|
#endif // CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("performance test - dedicated task", "[event]")
|
TEST_CASE("performance test - dedicated task", "[event]")
|
||||||
|
@ -1148,7 +1148,7 @@ TEST_CASE("events are dispatched in the order they are registered", "[event]")
|
||||||
TEST_TEARDOWN();
|
TEST_TEARDOWN();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_POST_EVENTS_FROM_ISR
|
#if CONFIG_ESP_EVENT_POST_FROM_ISR
|
||||||
TEST_CASE("can post events from interrupt handler", "[event]")
|
TEST_CASE("can post events from interrupt handler", "[event]")
|
||||||
{
|
{
|
||||||
SemaphoreHandle_t sem = xSemaphoreCreateBinary();
|
SemaphoreHandle_t sem = xSemaphoreCreateBinary();
|
||||||
|
@ -1186,7 +1186,7 @@ TEST_CASE("can post events from interrupt handler", "[event]")
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_EVENT_LOOP_PROFILING
|
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
|
||||||
TEST_CASE("can dump event loop profile", "[event]")
|
TEST_CASE("can dump event loop profile", "[event]")
|
||||||
{
|
{
|
||||||
/* this test aims to verify that dumping event loop statistics succeed */
|
/* this test aims to verify that dumping event loop statistics succeed */
|
||||||
|
|
|
@ -200,7 +200,7 @@ handlers will also get executed in between.
|
||||||
Event loop profiling
|
Event loop profiling
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
A configuration option :ref:`CONFIG_EVENT_LOOP_PROFILING` can be enabled in order to activate statistics collection for all event loops created.
|
A configuration option :ref:`CONFIG_ESP_EVENT_LOOP_PROFILING` can be enabled in order to activate statistics collection for all event loops created.
|
||||||
The function :cpp:func:`esp_event_dump` can be used to output the collected statistics to a file stream. More details on the information included in the dump
|
The function :cpp:func:`esp_event_dump` can be used to output the collected statistics to a file stream. More details on the information included in the dump
|
||||||
can be found in the :cpp:func:`esp_event_dump` API Reference.
|
can be found in the :cpp:func:`esp_event_dump` API Reference.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue