mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 19:24:33 +02:00
Merge branch 'feature/cleanup_freertos_hooks' into 'master'
Cleanup freertos idle/tick hooks functionality See merge request idf/esp-idf!3131
This commit is contained in:
@@ -23,6 +23,6 @@ set(COMPONENT_SRCS "can.c"
|
||||
set(COMPONENT_ADD_INCLUDEDIRS "include")
|
||||
set(COMPONENT_PRIV_INCLUDEDIRS "include/driver")
|
||||
|
||||
set(COMPONENT_REQUIRES)
|
||||
set(COMPONENT_REQUIRES esp_ringbuf)
|
||||
|
||||
register_component()
|
||||
|
@@ -59,11 +59,10 @@ void esp_vApplicationIdleHook()
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
esp_pm_impl_idle_hook();
|
||||
#endif
|
||||
}
|
||||
|
||||
extern void esp_vApplicationWaitiHook( void )
|
||||
{
|
||||
#ifndef CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
asm("waiti 0");
|
||||
#endif
|
||||
}
|
||||
|
||||
esp_err_t esp_register_freertos_idle_hook_for_cpu(esp_freertos_idle_cb_t new_idle_cb, UBaseType_t cpuid)
|
||||
|
@@ -455,7 +455,7 @@ void IRAM_ATTR esp_pm_impl_isr_hook()
|
||||
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
|
||||
bool IRAM_ATTR vApplicationSleep( TickType_t xExpectedIdleTime )
|
||||
void IRAM_ATTR vApplicationSleep( TickType_t xExpectedIdleTime )
|
||||
{
|
||||
bool result = false;
|
||||
portENTER_CRITICAL(&s_switch_lock);
|
||||
@@ -499,7 +499,11 @@ bool IRAM_ATTR vApplicationSleep( TickType_t xExpectedIdleTime )
|
||||
}
|
||||
}
|
||||
portEXIT_CRITICAL(&s_switch_lock);
|
||||
return result;
|
||||
|
||||
/* Tick less idle was not successful, can block till next interrupt here */
|
||||
if (!result) {
|
||||
asm("waiti 0");
|
||||
}
|
||||
}
|
||||
#endif //CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
|
||||
|
@@ -135,7 +135,7 @@ void __attribute__((weak)) esp_task_wdt_isr_user_handler(void)
|
||||
*/
|
||||
static void task_wdt_isr(void *arg)
|
||||
{
|
||||
portENTER_CRITICAL(&twdt_spinlock);
|
||||
portENTER_CRITICAL_ISR(&twdt_spinlock);
|
||||
twdt_task_t *twdttask;
|
||||
const char *cpu;
|
||||
//Reset hardware timer so that 2nd stage timeout is not reached (will trigger system reset)
|
||||
@@ -169,12 +169,12 @@ static void task_wdt_isr(void *arg)
|
||||
esp_task_wdt_isr_user_handler();
|
||||
if (twdt_config->panic){ //Trigger Panic if configured to do so
|
||||
ESP_EARLY_LOGE(TAG, "Aborting.");
|
||||
portEXIT_CRITICAL(&twdt_spinlock);
|
||||
portEXIT_CRITICAL_ISR(&twdt_spinlock);
|
||||
esp_reset_reason_set_hint(ESP_RST_TASK_WDT);
|
||||
abort();
|
||||
}
|
||||
|
||||
portEXIT_CRITICAL(&twdt_spinlock);
|
||||
portEXIT_CRITICAL_ISR(&twdt_spinlock);
|
||||
}
|
||||
|
||||
/*
|
||||
|
6
components/esp_ringbuf/CMakeLists.txt
Normal file
6
components/esp_ringbuf/CMakeLists.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
set(COMPONENT_ADD_INCLUDEDIRS "include")
|
||||
set(COMPONENT_SRCS "ringbuf.c")
|
||||
|
||||
set(COMPONENT_REQUIRES)
|
||||
|
||||
register_component()
|
0
components/esp_ringbuf/component.mk
Normal file
0
components/esp_ringbuf/component.mk
Normal file
@@ -14,10 +14,10 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "semphr.h"
|
||||
#include "ringbuf.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/semphr.h"
|
||||
#include "freertos/ringbuf.h"
|
||||
|
||||
//32-bit alignment macros
|
||||
#define rbALIGN_SIZE( xSize ) ( ( xSize + portBYTE_ALIGNMENT_MASK ) & ~portBYTE_ALIGNMENT_MASK )
|
||||
@@ -566,7 +566,7 @@ static BaseType_t prvReceiveGeneric(Ringbuffer_t *pxRingbuffer, void **pvItem1,
|
||||
}
|
||||
|
||||
//Semaphore obtained, check if item can be retrieved
|
||||
taskENTER_CRITICAL(&pxRingbuffer->mux);
|
||||
portENTER_CRITICAL(&pxRingbuffer->mux);
|
||||
if (prvCheckItemAvail(pxRingbuffer) == pdTRUE) {
|
||||
//Item is available for retrieval
|
||||
BaseType_t xIsSplit;
|
||||
@@ -591,14 +591,14 @@ static BaseType_t prvReceiveGeneric(Ringbuffer_t *pxRingbuffer, void **pvItem1,
|
||||
if (pxRingbuffer->xItemsWaiting > 0) {
|
||||
xReturnSemaphore = pdTRUE;
|
||||
}
|
||||
taskEXIT_CRITICAL(&pxRingbuffer->mux);
|
||||
portEXIT_CRITICAL(&pxRingbuffer->mux);
|
||||
break;
|
||||
}
|
||||
//No item available for retrieval, adjust ticks and take the semaphore again
|
||||
if (xTicksToWait != portMAX_DELAY) {
|
||||
xTicksRemaining = xTicksEnd - xTaskGetTickCount();
|
||||
}
|
||||
taskEXIT_CRITICAL(&pxRingbuffer->mux);
|
||||
portEXIT_CRITICAL(&pxRingbuffer->mux);
|
||||
/*
|
||||
* Gap between critical section and re-acquiring of the semaphore. If
|
||||
* semaphore is given now, priority inversion might occur (see docs)
|
||||
@@ -616,7 +616,7 @@ static BaseType_t prvReceiveGenericFromISR(Ringbuffer_t *pxRingbuffer, void **pv
|
||||
BaseType_t xReturn = pdFALSE;
|
||||
BaseType_t xReturnSemaphore = pdFALSE;
|
||||
|
||||
taskENTER_CRITICAL_ISR(&pxRingbuffer->mux);
|
||||
portENTER_CRITICAL_ISR(&pxRingbuffer->mux);
|
||||
if(prvCheckItemAvail(pxRingbuffer) == pdTRUE) {
|
||||
BaseType_t xIsSplit;
|
||||
if (pxRingbuffer->uxRingbufferFlags & rbBYTE_BUFFER_FLAG) {
|
||||
@@ -641,7 +641,7 @@ static BaseType_t prvReceiveGenericFromISR(Ringbuffer_t *pxRingbuffer, void **pv
|
||||
xReturnSemaphore = pdTRUE;
|
||||
}
|
||||
}
|
||||
taskEXIT_CRITICAL_ISR(&pxRingbuffer->mux);
|
||||
portEXIT_CRITICAL_ISR(&pxRingbuffer->mux);
|
||||
|
||||
if (xReturnSemaphore == pdTRUE) {
|
||||
xSemaphoreGiveFromISR(pxRingbuffer->xItemsBufferedSemaphore, NULL); //Give semaphore back so other tasks can retrieve
|
||||
@@ -766,7 +766,7 @@ BaseType_t xRingbufferSend(RingbufHandle_t xRingbuffer, const void *pvItem, size
|
||||
break;
|
||||
}
|
||||
//Semaphore obtained, check if item can fit
|
||||
taskENTER_CRITICAL(&pxRingbuffer->mux);
|
||||
portENTER_CRITICAL(&pxRingbuffer->mux);
|
||||
if(pxRingbuffer->xCheckItemFits(pxRingbuffer, xItemSize) == pdTRUE) {
|
||||
//Item will fit, copy item
|
||||
pxRingbuffer->vCopyItem(pxRingbuffer, pvItem, xItemSize);
|
||||
@@ -775,14 +775,14 @@ BaseType_t xRingbufferSend(RingbufHandle_t xRingbuffer, const void *pvItem, size
|
||||
if (prvGetFreeSize(pxRingbuffer) > 0) {
|
||||
xReturnSemaphore = pdTRUE;
|
||||
}
|
||||
taskEXIT_CRITICAL(&pxRingbuffer->mux);
|
||||
portEXIT_CRITICAL(&pxRingbuffer->mux);
|
||||
break;
|
||||
}
|
||||
//Item doesn't fit, adjust ticks and take the semaphore again
|
||||
if (xTicksToWait != portMAX_DELAY) {
|
||||
xTicksRemaining = xTicksEnd - xTaskGetTickCount();
|
||||
}
|
||||
taskEXIT_CRITICAL(&pxRingbuffer->mux);
|
||||
portEXIT_CRITICAL(&pxRingbuffer->mux);
|
||||
/*
|
||||
* Gap between critical section and re-acquiring of the semaphore. If
|
||||
* semaphore is given now, priority inversion might occur (see docs)
|
||||
@@ -815,7 +815,7 @@ BaseType_t xRingbufferSendFromISR(RingbufHandle_t xRingbuffer, const void *pvIte
|
||||
//Attempt to send an item
|
||||
BaseType_t xReturn;
|
||||
BaseType_t xReturnSemaphore = pdFALSE;
|
||||
taskENTER_CRITICAL_ISR(&pxRingbuffer->mux);
|
||||
portENTER_CRITICAL_ISR(&pxRingbuffer->mux);
|
||||
if (pxRingbuffer->xCheckItemFits(xRingbuffer, xItemSize) == pdTRUE) {
|
||||
pxRingbuffer->vCopyItem(xRingbuffer, pvItem, xItemSize);
|
||||
xReturn = pdTRUE;
|
||||
@@ -826,7 +826,7 @@ BaseType_t xRingbufferSendFromISR(RingbufHandle_t xRingbuffer, const void *pvIte
|
||||
} else {
|
||||
xReturn = pdFALSE;
|
||||
}
|
||||
taskEXIT_CRITICAL_ISR(&pxRingbuffer->mux);
|
||||
portEXIT_CRITICAL_ISR(&pxRingbuffer->mux);
|
||||
|
||||
if (xReturn == pdTRUE) {
|
||||
//Indicate item was successfully sent
|
||||
@@ -997,9 +997,9 @@ void vRingbufferReturnItem(RingbufHandle_t xRingbuffer, void *pvItem)
|
||||
configASSERT(pxRingbuffer);
|
||||
configASSERT(pvItem != NULL);
|
||||
|
||||
taskENTER_CRITICAL(&pxRingbuffer->mux);
|
||||
portENTER_CRITICAL(&pxRingbuffer->mux);
|
||||
pxRingbuffer->vReturnItem(pxRingbuffer, (uint8_t *)pvItem);
|
||||
taskEXIT_CRITICAL(&pxRingbuffer->mux);
|
||||
portEXIT_CRITICAL(&pxRingbuffer->mux);
|
||||
xSemaphoreGive(pxRingbuffer->xFreeSpaceSemaphore);
|
||||
}
|
||||
|
||||
@@ -1009,9 +1009,9 @@ void vRingbufferReturnItemFromISR(RingbufHandle_t xRingbuffer, void *pvItem, Bas
|
||||
configASSERT(pxRingbuffer);
|
||||
configASSERT(pvItem != NULL);
|
||||
|
||||
taskENTER_CRITICAL_ISR(&pxRingbuffer->mux);
|
||||
portENTER_CRITICAL_ISR(&pxRingbuffer->mux);
|
||||
pxRingbuffer->vReturnItem(pxRingbuffer, (uint8_t *)pvItem);
|
||||
taskEXIT_CRITICAL_ISR(&pxRingbuffer->mux);
|
||||
portEXIT_CRITICAL_ISR(&pxRingbuffer->mux);
|
||||
xSemaphoreGiveFromISR(pxRingbuffer->xFreeSpaceSemaphore, pxHigherPriorityTaskWoken);
|
||||
}
|
||||
|
||||
@@ -1045,9 +1045,9 @@ size_t xRingbufferGetCurFreeSize(RingbufHandle_t xRingbuffer)
|
||||
configASSERT(pxRingbuffer);
|
||||
|
||||
size_t xFreeSize;
|
||||
taskENTER_CRITICAL(&pxRingbuffer->mux);
|
||||
portENTER_CRITICAL(&pxRingbuffer->mux);
|
||||
xFreeSize = pxRingbuffer->xGetCurMaxSize(pxRingbuffer);
|
||||
taskEXIT_CRITICAL(&pxRingbuffer->mux);
|
||||
portEXIT_CRITICAL(&pxRingbuffer->mux);
|
||||
return xFreeSize;
|
||||
}
|
||||
|
||||
@@ -1057,7 +1057,7 @@ BaseType_t xRingbufferAddToQueueSetRead(RingbufHandle_t xRingbuffer, QueueSetHan
|
||||
configASSERT(pxRingbuffer);
|
||||
|
||||
BaseType_t xReturn;
|
||||
taskENTER_CRITICAL(&pxRingbuffer->mux);
|
||||
portENTER_CRITICAL(&pxRingbuffer->mux);
|
||||
//Cannot add semaphore to queue set if semaphore is not empty. Temporarily hold semaphore
|
||||
BaseType_t xHoldSemaphore = xSemaphoreTake(pxRingbuffer->xItemsBufferedSemaphore, 0);
|
||||
xReturn = xQueueAddToSet(pxRingbuffer->xItemsBufferedSemaphore, xQueueSet);
|
||||
@@ -1065,7 +1065,7 @@ BaseType_t xRingbufferAddToQueueSetRead(RingbufHandle_t xRingbuffer, QueueSetHan
|
||||
//Return semaphore if temporarily held
|
||||
configASSERT(xSemaphoreGive(pxRingbuffer->xItemsBufferedSemaphore) == pdTRUE);
|
||||
}
|
||||
taskEXIT_CRITICAL(&pxRingbuffer->mux);
|
||||
portEXIT_CRITICAL(&pxRingbuffer->mux);
|
||||
return xReturn;
|
||||
}
|
||||
|
||||
@@ -1083,7 +1083,7 @@ BaseType_t xRingbufferRemoveFromQueueSetRead(RingbufHandle_t xRingbuffer, QueueS
|
||||
configASSERT(pxRingbuffer);
|
||||
|
||||
BaseType_t xReturn;
|
||||
taskENTER_CRITICAL(&pxRingbuffer->mux);
|
||||
portENTER_CRITICAL(&pxRingbuffer->mux);
|
||||
//Cannot remove semaphore from queue set if semaphore is not empty. Temporarily hold semaphore
|
||||
BaseType_t xHoldSemaphore = xSemaphoreTake(pxRingbuffer->xItemsBufferedSemaphore, 0);
|
||||
xReturn = xQueueRemoveFromSet(pxRingbuffer->xItemsBufferedSemaphore, xQueueSet);
|
||||
@@ -1091,7 +1091,7 @@ BaseType_t xRingbufferRemoveFromQueueSetRead(RingbufHandle_t xRingbuffer, QueueS
|
||||
//Return semaphore if temporarily held
|
||||
configASSERT(xSemaphoreGive(pxRingbuffer->xItemsBufferedSemaphore) == pdTRUE);
|
||||
}
|
||||
taskEXIT_CRITICAL(&pxRingbuffer->mux);
|
||||
portEXIT_CRITICAL(&pxRingbuffer->mux);
|
||||
return xReturn;
|
||||
}
|
||||
|
||||
@@ -1100,7 +1100,7 @@ void vRingbufferGetInfo(RingbufHandle_t xRingbuffer, UBaseType_t *uxFree, UBaseT
|
||||
Ringbuffer_t *pxRingbuffer = (Ringbuffer_t *)xRingbuffer;
|
||||
configASSERT(pxRingbuffer);
|
||||
|
||||
taskENTER_CRITICAL(&pxRingbuffer->mux);
|
||||
portENTER_CRITICAL(&pxRingbuffer->mux);
|
||||
if (uxFree != NULL) {
|
||||
*uxFree = (UBaseType_t)(pxRingbuffer->pucFree - pxRingbuffer->pucHead);
|
||||
}
|
||||
@@ -1113,7 +1113,7 @@ void vRingbufferGetInfo(RingbufHandle_t xRingbuffer, UBaseType_t *uxFree, UBaseT
|
||||
if (uxItemsWaiting != NULL) {
|
||||
*uxItemsWaiting = (UBaseType_t)(pxRingbuffer->xItemsWaiting);
|
||||
}
|
||||
taskEXIT_CRITICAL(&pxRingbuffer->mux);
|
||||
portEXIT_CRITICAL(&pxRingbuffer->mux);
|
||||
}
|
||||
|
||||
void xRingbufferPrintInfo(RingbufHandle_t xRingbuffer)
|
5
components/esp_ringbuf/test/component.mk
Normal file
5
components/esp_ringbuf/test/component.mk
Normal file
@@ -0,0 +1,5 @@
|
||||
#
|
||||
#Component Makefile
|
||||
#
|
||||
|
||||
COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive
|
@@ -7,7 +7,6 @@ set(COMPONENT_SRCS "FreeRTOS-openocd.c"
|
||||
"port.c"
|
||||
"portasm.S"
|
||||
"queue.c"
|
||||
"ringbuf.c"
|
||||
"tasks.c"
|
||||
"timers.c"
|
||||
"xtensa_context.S"
|
||||
@@ -28,7 +27,6 @@ set_source_files_properties(
|
||||
event_groups.c
|
||||
timers.c
|
||||
queue.c
|
||||
ringbuf.c
|
||||
PROPERTIES COMPILE_DEFINITIONS
|
||||
_ESP_FREERTOS_INTERNAL
|
||||
)
|
||||
|
@@ -173,24 +173,6 @@ config FREERTOS_LEGACY_HOOKS
|
||||
hooks can also still be enabled. Please enable this only if you have code that for some
|
||||
reason can't be migrated to the esp_register_freertos_xxx_hook system.
|
||||
|
||||
if FREERTOS_LEGACY_HOOKS
|
||||
|
||||
config FREERTOS_LEGACY_IDLE_HOOK
|
||||
bool "Enable legacy idle hook"
|
||||
default n
|
||||
help
|
||||
If enabled, FreeRTOS will call a function called vApplicationIdleHook when the idle thread
|
||||
on a CPU is running. Please make sure your code defines such a function.
|
||||
|
||||
config FREERTOS_LEGACY_TICK_HOOK
|
||||
bool "Enable legacy tick hook"
|
||||
default n
|
||||
help
|
||||
If enabled, FreeRTOS will call a function called vApplicationTickHook when a FreeRTOS
|
||||
tick is executed. Please make sure your code defines such a function.
|
||||
|
||||
endif #FREERTOS_LEGACY_HOOKS
|
||||
|
||||
config FREERTOS_MAX_TASK_NAME_LEN
|
||||
int "Maximum task name length"
|
||||
range 1 256
|
||||
|
@@ -159,9 +159,8 @@ int xt_clock_freq(void) __attribute__((deprecated));
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_IDLE_HOOK ( CONFIG_FREERTOS_LEGACY_IDLE_HOOK )
|
||||
|
||||
#define configUSE_TICK_HOOK ( CONFIG_FREERTOS_LEGACY_TICK_HOOK )
|
||||
#define configUSE_IDLE_HOOK 1
|
||||
#define configUSE_TICK_HOOK 1
|
||||
|
||||
#define configTICK_RATE_HZ ( CONFIG_FREERTOS_HZ )
|
||||
|
||||
|
@@ -368,10 +368,15 @@ typedef struct {
|
||||
#endif
|
||||
|
||||
extern void esp_vApplicationIdleHook( void );
|
||||
extern void esp_vApplicationWaitiHook( void );
|
||||
extern void esp_vApplicationTickHook( void );
|
||||
|
||||
#ifndef CONFIG_FREERTOS_LEGACY_HOOKS
|
||||
#define vApplicationIdleHook esp_vApplicationIdleHook
|
||||
#define vApplicationTickHook esp_vApplicationTickHook
|
||||
#endif /* !CONFIG_FREERTOS_LEGACY_HOOKS */
|
||||
|
||||
void _xt_coproc_release(volatile void * coproc_sa_base);
|
||||
bool vApplicationSleep( TickType_t xExpectedIdleTime );
|
||||
void vApplicationSleep( TickType_t xExpectedIdleTime );
|
||||
|
||||
#define portSUPPRESS_TICKS_AND_SLEEP( idleTime ) vApplicationSleep( idleTime )
|
||||
|
||||
|
@@ -489,7 +489,6 @@ to its original value when it is released. */
|
||||
#if configUSE_TICK_HOOK > 0
|
||||
extern void vApplicationTickHook( void );
|
||||
#endif
|
||||
extern void esp_vApplicationTickHook( void );
|
||||
|
||||
#if portFIRST_TASK_HOOK
|
||||
extern void vPortFirstTaskHook(TaskFunction_t taskfn);
|
||||
@@ -2497,7 +2496,9 @@ BaseType_t xSwitchRequired = pdFALSE;
|
||||
#if ( configUSE_TICK_HOOK == 1 )
|
||||
vApplicationTickHook();
|
||||
#endif /* configUSE_TICK_HOOK */
|
||||
#if ( CONFIG_FREERTOS_LEGACY_HOOKS == 1 )
|
||||
esp_vApplicationTickHook();
|
||||
#endif /* CONFIG_FREERTOS_LEGACY_HOOKS */
|
||||
|
||||
/*
|
||||
We can't really calculate what we need, that's done on core 0... just assume we need a switch.
|
||||
@@ -2640,7 +2641,9 @@ BaseType_t xSwitchRequired = pdFALSE;
|
||||
#if ( configUSE_TICK_HOOK == 1 )
|
||||
vApplicationTickHook();
|
||||
#endif /* configUSE_TICK_HOOK */
|
||||
#if ( CONFIG_FREERTOS_LEGACY_HOOKS == 1 )
|
||||
esp_vApplicationTickHook();
|
||||
#endif /* CONFIG_FREERTOS_LEGACY_HOOKS */
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2660,7 +2663,9 @@ BaseType_t xSwitchRequired = pdFALSE;
|
||||
vApplicationTickHook();
|
||||
}
|
||||
#endif
|
||||
#if ( CONFIG_FREERTOS_LEGACY_HOOKS == 1 )
|
||||
esp_vApplicationTickHook();
|
||||
#endif /* CONFIG_FREERTOS_LEGACY_HOOKS */
|
||||
}
|
||||
|
||||
#if ( configUSE_PREEMPTION == 1 )
|
||||
@@ -3434,10 +3439,12 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
|
||||
vApplicationIdleHook();
|
||||
}
|
||||
#endif /* configUSE_IDLE_HOOK */
|
||||
#if ( CONFIG_FREERTOS_LEGACY_HOOKS == 1 )
|
||||
{
|
||||
/* Call the esp-idf hook system */
|
||||
esp_vApplicationIdleHook();
|
||||
}
|
||||
#endif /* CONFIG_FREERTOS_LEGACY_HOOKS */
|
||||
|
||||
|
||||
/* This conditional compilation should use inequality to 0, not equality
|
||||
@@ -3447,7 +3454,6 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
|
||||
#if ( configUSE_TICKLESS_IDLE != 0 )
|
||||
{
|
||||
TickType_t xExpectedIdleTime;
|
||||
BaseType_t xEnteredSleep = pdFALSE;
|
||||
|
||||
/* It is not desirable to suspend then resume the scheduler on
|
||||
each iteration of the idle task. Therefore, a preliminary
|
||||
@@ -3469,7 +3475,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
|
||||
if( xExpectedIdleTime >= configEXPECTED_IDLE_TIME_BEFORE_SLEEP )
|
||||
{
|
||||
traceLOW_POWER_IDLE_BEGIN();
|
||||
xEnteredSleep = portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime );
|
||||
portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime );
|
||||
traceLOW_POWER_IDLE_END();
|
||||
}
|
||||
else
|
||||
@@ -3483,16 +3489,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
|
||||
{
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
/* It might be possible to enter tickless idle again, so skip
|
||||
* the fallback sleep hook if tickless idle was successful
|
||||
*/
|
||||
if ( !xEnteredSleep )
|
||||
{
|
||||
esp_vApplicationWaitiHook();
|
||||
}
|
||||
}
|
||||
#else
|
||||
esp_vApplicationWaitiHook();
|
||||
#endif /* configUSE_TICKLESS_IDLE */
|
||||
}
|
||||
}
|
||||
|
@@ -179,7 +179,8 @@ INPUT = \
|
||||
../../components/freertos/include/freertos/semphr.h \
|
||||
../../components/freertos/include/freertos/timers.h \
|
||||
../../components/freertos/include/freertos/event_groups.h \
|
||||
../../components/freertos/include/freertos/ringbuf.h \
|
||||
### Ringbuffer
|
||||
../../components/esp_ringbuf/include/freertos/ringbuf.h \
|
||||
### Helper functions for error codes
|
||||
../../components/esp32/include/esp_err.h \
|
||||
### System APIs
|
||||
|
@@ -374,9 +374,8 @@ defined Idle Hook and Tick Hook on every iteration of the Idle Task and Tick
|
||||
Interrupt respectively.
|
||||
|
||||
Vanilla FreeRTOS hooks are referred to as **Legacy Hooks** in ESP-IDF FreeRTOS.
|
||||
To enable legacy hooks, :envvar:`CONFIG_FREERTOS_LEGACY_HOOKS`,
|
||||
:envvar:`CONFIG_FREERTOS_LEGACY_IDLE_HOOK`, and :envvar:`CONFIG_FREERTOS_LEGACY_TICK_HOOK`
|
||||
should all be enabled in ``make menuconfig``.
|
||||
To enable legacy hooks, :envvar:`CONFIG_FREERTOS_LEGACY_HOOKS` should be enabled
|
||||
in ``make menuconfig``.
|
||||
|
||||
Due to vanilla FreeRTOS being designed for single core, ``vApplicationIdleHook()``
|
||||
and ``vApplicationTickHook()`` can only be defined once. However, the ESP32 is dual core
|
||||
|
Reference in New Issue
Block a user