Merge branch 'bugfix/eventfd_example_deprecated_fn' into 'master'

examples: eventfd: remove use of deprecated timer_spinlock functions

See merge request espressif/esp-idf!13215
This commit is contained in:
Michael (XIAO Xufeng) 2021-04-20 02:29:01 +00:00
commit dad3c26bc2
4 changed files with 5 additions and 13 deletions

View File

@ -1,3 +1,2 @@
idf_component_register(SRCS "eventfd_example.c"
LDFRAGMENTS linker.lf
INCLUDE_DIRS ".")

View File

@ -2,5 +2,3 @@
# "main" pseudo-component makefile.
#
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
COMPONENT_ADD_LDFRAGMENTS += linker.lf

View File

@ -34,10 +34,9 @@ static const char *TAG = "eventfd_example";
int s_timer_fd;
int s_progress_fd;
static void eventfd_timer_group0_isr(void *para)
static bool eventfd_timer_isr_callback(void *arg)
{
timer_spinlock_take(TIMER_GROUP_0);
int timer_idx = (int) para;
int timer_idx = (int) arg;
uint32_t timer_intr = timer_group_get_intr_status_in_isr(TIMER_GROUP_0);
uint64_t timer_counter_value = timer_group_get_counter_value_in_isr(TIMER_GROUP_0, timer_idx);
@ -53,7 +52,8 @@ static void eventfd_timer_group0_isr(void *para)
uint64_t signal = TIMER_SIGNAL;
ssize_t val = write(s_timer_fd, &signal, sizeof(signal));
assert(val == sizeof(signal));
timer_spinlock_give(TIMER_GROUP_0);
return true;
}
static void eventfd_timer_init(int timer_idx, double timer_interval_sec)
@ -71,8 +71,7 @@ static void eventfd_timer_init(int timer_idx, double timer_interval_sec)
ESP_ERROR_CHECK(timer_set_alarm_value(TIMER_GROUP_0, timer_idx, timer_interval_sec * TIMER_SCALE));
ESP_ERROR_CHECK(timer_enable_intr(TIMER_GROUP_0, timer_idx));
ESP_ERROR_CHECK(timer_isr_register(TIMER_GROUP_0, timer_idx, eventfd_timer_group0_isr,
NULL, ESP_INTR_FLAG_IRAM, NULL));
ESP_ERROR_CHECK(timer_isr_callback_add(TIMER_GROUP_0, timer_idx, &eventfd_timer_isr_callback, (void*) timer_idx, 0));
ESP_ERROR_CHECK(timer_start(TIMER_GROUP_0, timer_idx));
}

View File

@ -1,4 +0,0 @@
[mapping:main]
archive: libmain.a
entries:
eventfd_example:eventfd_timer_group0_isr (noflash)