Merge branch 'zim-marking-vtasksuspendall' into 'master'

freertos: clearly marking vTaskSuspendAll and a few other small cleanups

See merge request espressif/esp-idf!15048
This commit is contained in:
Zim Kalinowski
2021-09-06 06:01:28 +00:00
9 changed files with 472 additions and 53 deletions

View File

@@ -217,6 +217,9 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup,
{
EventBits_t uxOriginalBitValue, uxReturn;
EventGroup_t * pxEventBits = xEventGroup;
#ifndef ESP_PLATFORM
BaseType_t xAlreadyYielded;
#endif // ESP_PLATFORM
BaseType_t xTimeoutOccurred = pdFALSE;
configASSERT( ( uxBitsToWaitFor & eventEVENT_BITS_CONTROL_BYTES ) == 0 );
@@ -227,7 +230,11 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup,
}
#endif
#ifdef ESP_PLATFORM // IDF-3755
taskENTER_CRITICAL();
#else
vTaskSuspendAll();
#endif // ESP_PLATFORM
{
uxOriginalBitValue = pxEventBits->uxEventBits;
@@ -270,11 +277,26 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup,
}
}
}
#ifdef ESP_PLATFORM // IDF-3755
taskEXIT_CRITICAL();
#else
xAlreadyYielded = xTaskResumeAll();
#endif // ESP_PLATFORM
if( xTicksToWait != ( TickType_t ) 0 )
{
#ifdef ESP_PLATFORM
portYIELD_WITHIN_API();
#else
if( xAlreadyYielded == pdFALSE )
{
portYIELD_WITHIN_API();
}
else
{
mtCOVERAGE_TEST_MARKER();
}
#endif // ESP_PLATFORM
/* The task blocked to wait for its required bits to be set - at this
* point either the required bits were set or the block time expired. If
@@ -333,7 +355,11 @@ EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup,
{
EventGroup_t * pxEventBits = xEventGroup;
EventBits_t uxReturn, uxControlBits = 0;
#ifdef ESP_PLATFORM
BaseType_t xWaitConditionMet;
#else
BaseType_t xWaitConditionMet, xAlreadyYielded;
#endif // ESP_PLATFORM
BaseType_t xTimeoutOccurred = pdFALSE;
/* Check the user is not attempting to wait on the bits used by the kernel
@@ -347,7 +373,11 @@ EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup,
}
#endif
#ifdef ESP_PLATFORM // IDF-3755
taskENTER_CRITICAL();
#else
vTaskSuspendAll();
#endif // ESP_PLATFORM
{
const EventBits_t uxCurrentEventBits = pxEventBits->uxEventBits;
@@ -415,11 +445,26 @@ EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup,
traceEVENT_GROUP_WAIT_BITS_BLOCK( xEventGroup, uxBitsToWaitFor );
}
}
#ifdef ESP_PLATFORM // IDF-3755
taskEXIT_CRITICAL();
#else
xAlreadyYielded = xTaskResumeAll();
#endif // ESP_PLATFORM
if( xTicksToWait != ( TickType_t ) 0 )
{
#ifdef ESP_PLATFORM
portYIELD_WITHIN_API();
#else
if( xAlreadyYielded == pdFALSE )
{
portYIELD_WITHIN_API();
}
else
{
mtCOVERAGE_TEST_MARKER();
}
#endif // ESP_PLATFORM
/* The task blocked to wait for its required bits to be set - at this
* point either the required bits were set or the block time expired. If
@@ -551,7 +596,11 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup,
pxList = &( pxEventBits->xTasksWaitingForBits );
pxListEnd = listGET_END_MARKER( pxList ); /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM. This is checked and valid. */
#ifdef ESP_PLATFORM // IDF-3755
taskENTER_CRITICAL();
#else
vTaskSuspendAll();
#endif // ESP_PLATFORM
{
traceEVENT_GROUP_SET_BITS( xEventGroup, uxBitsToSet );
@@ -623,7 +672,11 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup,
* bit was set in the control word. */
pxEventBits->uxEventBits &= ~uxBitsToClear;
}
#ifdef ESP_PLATFORM // IDF-3755
taskEXIT_CRITICAL();
#else
( void ) xTaskResumeAll();
#endif // ESP_PLATFORM
return pxEventBits->uxEventBits;
}
@@ -636,6 +689,7 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup )
traceEVENT_GROUP_DELETE( xEventGroup );
// IDF-3755
taskENTER_CRITICAL();
{
while( listCURRENT_LIST_LENGTH( pxTasksWaitingForBits ) > ( UBaseType_t ) 0 )