mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
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:
commit
dad3c26bc2
@ -1,3 +1,2 @@
|
|||||||
idf_component_register(SRCS "eventfd_example.c"
|
idf_component_register(SRCS "eventfd_example.c"
|
||||||
LDFRAGMENTS linker.lf
|
|
||||||
INCLUDE_DIRS ".")
|
INCLUDE_DIRS ".")
|
||||||
|
@ -2,5 +2,3 @@
|
|||||||
# "main" pseudo-component makefile.
|
# "main" pseudo-component makefile.
|
||||||
#
|
#
|
||||||
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
|
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
|
||||||
|
|
||||||
COMPONENT_ADD_LDFRAGMENTS += linker.lf
|
|
||||||
|
@ -34,10 +34,9 @@ static const char *TAG = "eventfd_example";
|
|||||||
int s_timer_fd;
|
int s_timer_fd;
|
||||||
int s_progress_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) arg;
|
||||||
int timer_idx = (int) para;
|
|
||||||
|
|
||||||
uint32_t timer_intr = timer_group_get_intr_status_in_isr(TIMER_GROUP_0);
|
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);
|
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;
|
uint64_t signal = TIMER_SIGNAL;
|
||||||
ssize_t val = write(s_timer_fd, &signal, sizeof(signal));
|
ssize_t val = write(s_timer_fd, &signal, sizeof(signal));
|
||||||
assert(val == 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)
|
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_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_enable_intr(TIMER_GROUP_0, timer_idx));
|
||||||
ESP_ERROR_CHECK(timer_isr_register(TIMER_GROUP_0, timer_idx, eventfd_timer_group0_isr,
|
ESP_ERROR_CHECK(timer_isr_callback_add(TIMER_GROUP_0, timer_idx, &eventfd_timer_isr_callback, (void*) timer_idx, 0));
|
||||||
NULL, ESP_INTR_FLAG_IRAM, NULL));
|
|
||||||
|
|
||||||
ESP_ERROR_CHECK(timer_start(TIMER_GROUP_0, timer_idx));
|
ESP_ERROR_CHECK(timer_start(TIMER_GROUP_0, timer_idx));
|
||||||
}
|
}
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
[mapping:main]
|
|
||||||
archive: libmain.a
|
|
||||||
entries:
|
|
||||||
eventfd_example:eventfd_timer_group0_isr (noflash)
|
|
Loading…
Reference in New Issue
Block a user