mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-22 17:02:25 +00:00
freertos(IDF): Use common macros for SMP specific critical sections
In IDF FreeRTOS, when building for SMP, there are numerous functions which require different critical sections when compared to single-core. This commit encapsulates those difference into a common set of macros whose behavior depends on "configNUM_CORES > 1". As such... - Vanilla behavior has been restored for some functions when building for single core (i.e., used to call taskENTER_CRITICAL, now disables interrupts mactching vanilla behavior). - Reduces number of "#ifdef (configNUM_CORES > 1)" in functions - Any SMP only critical sections are now wrapped by "#ifdef (configNUM_CORES > 1)" and properly documented via comments.
This commit is contained in:
@@ -606,11 +606,7 @@
|
||||
TickType_t xTimeNow;
|
||||
BaseType_t xTimerListsWereSwitched;
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
taskENTER_CRITICAL( &xTimerLock );
|
||||
#else
|
||||
vTaskSuspendAll();
|
||||
#endif // ESP_PLATFORM
|
||||
prvENTER_CRITICAL_OR_SUSPEND_ALL( &xTimerLock );
|
||||
{
|
||||
/* Obtain the time now to make an assessment as to whether the timer
|
||||
* has expired or not. If obtaining the time causes the lists to switch
|
||||
@@ -624,11 +620,7 @@
|
||||
/* The tick count has not overflowed, has the timer expired? */
|
||||
if( ( xListWasEmpty == pdFALSE ) && ( xNextExpireTime <= xTimeNow ) )
|
||||
{
|
||||
#ifdef ESP_PLATFORM
|
||||
taskEXIT_CRITICAL( &xTimerLock );
|
||||
#else
|
||||
( void ) xTaskResumeAll();
|
||||
#endif // ESP_PLATFORM
|
||||
( void ) prvEXIT_CRITICAL_OR_RESUME_ALL( &xTimerLock );
|
||||
prvProcessExpiredTimer( xNextExpireTime, xTimeNow );
|
||||
}
|
||||
else
|
||||
@@ -648,11 +640,7 @@
|
||||
|
||||
vQueueWaitForMessageRestricted( xTimerQueue, ( xNextExpireTime - xTimeNow ), xListWasEmpty );
|
||||
|
||||
#ifdef ESP_PLATFORM /* IDF-3755 */
|
||||
taskEXIT_CRITICAL( &xTimerLock );
|
||||
#else
|
||||
if( xTaskResumeAll() == pdFALSE )
|
||||
#endif // ESP_PLATFORM
|
||||
if( prvEXIT_CRITICAL_OR_RESUME_ALL( &xTimerLock ) == pdFALSE )
|
||||
{
|
||||
/* Yield to wait for either a command to arrive, or the
|
||||
* block time to expire. If a command arrived between the
|
||||
@@ -660,22 +648,15 @@
|
||||
* will not cause the task to block. */
|
||||
portYIELD_WITHIN_API();
|
||||
}
|
||||
|
||||
#ifndef ESP_PLATFORM /* IDF-3755 */
|
||||
else
|
||||
{
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
#endif // ESP_PLATFORM
|
||||
else
|
||||
{
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef ESP_PLATFORM /* IDF-3755 */
|
||||
taskEXIT_CRITICAL( &xTimerLock );
|
||||
#else
|
||||
( void ) xTaskResumeAll();
|
||||
#endif // ESP_PLATFORM
|
||||
( void ) prvEXIT_CRITICAL_OR_RESUME_ALL( &xTimerLock );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user