mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-08-05 22:11:04 +08:00
feat(freertos): Cleanup tick/idle hook functionality
Closes https://github.com/espressif/ESP8266_RTOS_SDK/issues/500
This commit is contained in:
@ -22,6 +22,8 @@
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifdef CONFIG_FREERTOS_EXTENED_HOOKS
|
||||
|
||||
//We use just a static array here because it's not expected many components will need
|
||||
//an idle or tick hook.
|
||||
#define MAX_HOOKS CONFIG_FREERTOS_MAX_HOOK
|
||||
@ -158,3 +160,4 @@ void esp_deregister_freertos_tick_hook(esp_freertos_tick_cb_t old_tick_cb)
|
||||
portEXIT_CRITICAL(&hooks_spinlock);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_FREERTOS_EXTENED_HOOKS */
|
||||
|
@ -50,8 +50,10 @@
|
||||
|
||||
#define portNUM_PROCESSORS 1
|
||||
#define configUSE_PREEMPTION 1
|
||||
|
||||
#define configUSE_IDLE_HOOK 1
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configUSE_TICK_HOOK 1
|
||||
|
||||
#define configUSE_TICKLESS_IDLE 1
|
||||
#define configCPU_CLOCK_HZ ( ( unsigned long ) 80000000 )
|
||||
#define configTICK_RATE_HZ ( ( portTickType ) CONFIG_FREERTOS_HZ )
|
||||
|
@ -15,6 +15,10 @@
|
||||
#ifndef __ESP_FREERTOS_HOOKS_H__
|
||||
#define __ESP_FREERTOS_HOOKS_H__
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifdef CONFIG_FREERTOS_EXTENED_HOOKS
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "esp_err.h"
|
||||
|
||||
@ -127,5 +131,6 @@ void esp_deregister_freertos_tick_hook(esp_freertos_tick_cb_t old_tick_cb);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_FREERTOS_EXTENED_HOOKS */
|
||||
|
||||
#endif
|
||||
|
@ -205,6 +205,9 @@ void _xt_enter_first_task(void);
|
||||
#define xTaskCreatePinnedToCore(pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pvCreatedTask, tskNO_AFFINITY) \
|
||||
xTaskCreate(pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pvCreatedTask)
|
||||
|
||||
extern void esp_vApplicationIdleHook( void );
|
||||
extern void esp_vApplicationTickHook( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -344,15 +344,29 @@ BaseType_t xQueueGenericReceive(QueueHandle_t xQueue, void * const pvBuffer,
|
||||
return xQueueReceive(xQueue, pvBuffer, xTicksToWait);
|
||||
}
|
||||
|
||||
void vApplicationIdleHook(void)
|
||||
void esp_internal_idle_hook(void)
|
||||
{
|
||||
extern void pmIdleHook(void);
|
||||
extern void esp_task_wdt_reset(void);
|
||||
|
||||
pmIdleHook();
|
||||
esp_task_wdt_reset();
|
||||
pmIdleHook();
|
||||
}
|
||||
|
||||
#if configUSE_IDLE_HOOK == 1
|
||||
void __attribute__((weak)) vApplicationIdleHook(void)
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#if configUSE_TICK_HOOK == 1
|
||||
void __attribute__((weak)) vApplicationTickHook(void)
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
uint32_t xPortGetTickRateHz(void)
|
||||
{
|
||||
return (uint32_t)configTICK_RATE_HZ;
|
||||
|
Reference in New Issue
Block a user