esp_timer: Add ESP_TIMER_ISR dispatch method

Using own spinlock for each list (TASK and ISR disp method)
Reduced the dependency of ISR on the TASK dispatch method
This commit is contained in:
KonstantinKondrashov
2020-02-10 21:45:09 +08:00
parent bcbee89030
commit 63d4911cdb
11 changed files with 551 additions and 159 deletions

View File

@@ -43,6 +43,7 @@
#include <stdio.h>
#include <stdbool.h>
#include "esp_err.h"
#include "sdkconfig.h"
#ifdef __cplusplus
extern "C" {
@@ -65,13 +66,10 @@ typedef void (*esp_timer_cb_t)(void* arg);
*/
typedef enum {
ESP_TIMER_TASK, //!< Callback is called from timer task
/* Not supported for now, provision to allow callbacks to run directly
* from an ISR:
ESP_TIMER_ISR, //!< Callback is called from timer ISR
*/
#ifdef CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD
ESP_TIMER_ISR, //!< Callback is called from timer ISR
#endif
ESP_TIMER_MAX, //!< Count of the methods for dispatching timer callback
} esp_timer_dispatch_t;
/**
@@ -228,6 +226,16 @@ int64_t esp_timer_get_next_alarm(void);
*/
esp_err_t esp_timer_dump(FILE* stream);
#ifdef CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD
/**
* @brief Requests a context switch from a timer callback function.
*
* This only works for a timer that has an ISR dispatch method.
* The context switch will be called after all ISR dispatch timers have been processed.
*/
void esp_timer_isr_dispatch_need_yield(void);
#endif // CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD
#ifdef __cplusplus
}
#endif