mirror of
https://github.com/espressif/esp-idf.git
synced 2025-12-16 04:22:22 +00:00
components/esp_common: added esp_macros.h that aims to hold useful macros
esp_common/esp_compiler: renamed esp_macros file to a more specific one esp_common/esp_compiler: removed CONTAINER_OF macro, it was a duplicate components/freertos: placed likely macros around port and critical sections component/freertos: placed likely macros on lists module components/freertos: placed unlikely macros inside of assertion points, they likely wont fail components/freertos: added likely macros on queue modules FreeRTOS queues are one of most hot code path, because to queues itself tend to be used a lot by the applications, besides that, queues are the basic primitive to form both mutexes and semaphores, The focus here is to place likely macros inside lowest level send and receive routines, since they're common from all kobjects: semaphores, queues, mutexes and FR internals (like timer queue) components/lwip: placed likely/unlikey on net-interfaces code components/fatfs: added unlikely macros on disk drivers code components/spiffs: added unlikely macros on low level fs driver components/freertos: added likely/unlikely macros on timers and ticker freertos/event_group: placed likely/unlikely macros on hot event group code paths components/sdmmc: placed likely / unlikely macros on lower level path of sdmmc components/bt: placed unlikely macros around bt HCI functions calling components/lwip: added likely/unlikely macros on OS port code section components/freertos: fix code style on tick handler
This commit is contained in:
@@ -77,6 +77,7 @@ all the API functions to use the MPU wrappers. That should only be done when
|
||||
task.h is included from an application file. */
|
||||
#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
||||
#include "esp_newlib.h"
|
||||
#include "esp_compiler.h"
|
||||
|
||||
/* FreeRTOS includes. */
|
||||
#include "FreeRTOS.h"
|
||||
@@ -2466,7 +2467,7 @@ BaseType_t xSwitchRequired = pdFALSE;
|
||||
/* Only allow core 0 increase the tick count in the case of xPortSysTickHandler processing. */
|
||||
/* And allow core 0 and core 1 to unwind uxPendedTicks during xTaskResumeAll. */
|
||||
|
||||
if ( xPortInIsrContext() )
|
||||
if (likely(xPortInIsrContext()))
|
||||
{
|
||||
#if ( configUSE_TICK_HOOK == 1 )
|
||||
vApplicationTickHook();
|
||||
@@ -4187,7 +4188,7 @@ For ESP32 FreeRTOS, vTaskEnterCritical implements both portENTER_CRITICAL and po
|
||||
{
|
||||
BaseType_t oldInterruptLevel=0;
|
||||
BaseType_t schedulerRunning = xSchedulerRunning;
|
||||
if( schedulerRunning != pdFALSE )
|
||||
if(likely(schedulerRunning != pdFALSE))
|
||||
{
|
||||
//Interrupts may already be disabled (because we're doing this recursively) but we can't get the interrupt level after
|
||||
//vPortCPUAquireMutex, because it also may mess with interrupts. Get it here first, then later figure out if we're nesting
|
||||
@@ -4200,7 +4201,7 @@ For ESP32 FreeRTOS, vTaskEnterCritical implements both portENTER_CRITICAL and po
|
||||
vPortCPUAcquireMutexIntsDisabled( mux, portMUX_NO_TIMEOUT );
|
||||
#endif
|
||||
|
||||
if( schedulerRunning != pdFALSE )
|
||||
if(likely(schedulerRunning != pdFALSE))
|
||||
{
|
||||
TCB_t *tcb = pxCurrentTCB[xPortGetCoreID()];
|
||||
BaseType_t newNesting = tcb->uxCriticalNesting + 1;
|
||||
@@ -4259,11 +4260,11 @@ For ESP32 FreeRTOS, vTaskExitCritical implements both portEXIT_CRITICAL and port
|
||||
#else
|
||||
vPortCPUReleaseMutexIntsDisabled( mux );
|
||||
#endif
|
||||
if( xSchedulerRunning != pdFALSE )
|
||||
if(likely(xSchedulerRunning != pdFALSE))
|
||||
{
|
||||
TCB_t *tcb = pxCurrentTCB[xPortGetCoreID()];
|
||||
BaseType_t nesting = tcb->uxCriticalNesting;
|
||||
if( nesting > 0U )
|
||||
if(likely(nesting > 0U))
|
||||
{
|
||||
nesting--;
|
||||
tcb->uxCriticalNesting = nesting;
|
||||
|
||||
Reference in New Issue
Block a user