freertos: Synchronize vTaskPlaceOnEventList...() functions to v10.4.3

This commit synchronizes the following vTaskPlaceOnEventList...() with
upstream v10.4.3.

The functions updated are:

- vTaskPlaceOnEventList()
- vTaskPlaceOnUnorderedEventList()
- vTaskPlaceOnEventListRestricted()

The traceTASK_DELAY_UNTIL() macro has also been updated.
This commit is contained in:
Darian Leung
2022-08-01 17:32:40 +08:00
parent 27c0120c18
commit fb960f42b3
2 changed files with 22 additions and 8 deletions

View File

@@ -263,7 +263,7 @@ define away all of the tracing macros.
#define traceTASK_NOTIFY_TAKE( uxIndexToWait ) SEGGER_SYSVIEW_RecordU32x2(apiFastID_OFFSET + apiID_ULTASKNOTIFYTAKE, xClearCountOnExit, xTicksToWait)
#define traceTASK_DELAY() SEGGER_SYSVIEW_RecordU32(apiFastID_OFFSET + apiID_VTASKDELAY, xTicksToDelay)
#define traceTASK_DELAY_UNTIL() SEGGER_SYSVIEW_RecordVoid(apiFastID_OFFSET + apiID_VTASKDELAYUNTIL)
#define traceTASK_DELAY_UNTIL( xTimeToWake ) SEGGER_SYSVIEW_RecordVoid(apiFastID_OFFSET + apiID_VTASKDELAYUNTIL)
#define traceTASK_DELETE( pxTCB ) if (pxTCB != NULL) { \
SEGGER_SYSVIEW_RecordU32(apiFastID_OFFSET + apiID_VTASKDELETE, \
SEGGER_SYSVIEW_ShrinkId((U32)pxTCB)); \

View File

@@ -1589,7 +1589,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
if( xShouldDelay != pdFALSE )
{
traceTASK_DELAY_UNTIL();
traceTASK_DELAY_UNTIL( xTimeToWake );
/* prvAddCurrentTaskToDelayedList() needs the block time, not
* the time to wake, so subtract the current tick count. */
@@ -3731,6 +3731,8 @@ void vTaskPlaceOnEventList( List_t * const pxEventList,
const TickType_t xTicksToWait )
{
configASSERT( pxEventList );
/* Take the kernel lock as we are about to access the task lists. */
taskENTER_CRITICAL( &xKernelLock );
/* THIS FUNCTION MUST BE CALLED WITH EITHER INTERRUPTS DISABLED OR THE
@@ -3743,6 +3745,7 @@ void vTaskPlaceOnEventList( List_t * const pxEventList,
vListInsert( pxEventList, &( pxCurrentTCB[ xPortGetCoreID() ]->xEventListItem ) );
prvAddCurrentTaskToDelayedList( xPortGetCoreID(), xTicksToWait);
taskEXIT_CRITICAL( &xKernelLock );
}
/*-----------------------------------------------------------*/
@@ -3752,8 +3755,15 @@ void vTaskPlaceOnUnorderedEventList( List_t * pxEventList,
const TickType_t xTicksToWait )
{
configASSERT( pxEventList );
/* Take the kernel lock as we are about to access the task lists. */
taskENTER_CRITICAL( &xKernelLock );
/* THIS FUNCTION MUST BE CALLED WITH THE SCHEDULER SUSPENDED. It is used by
* the event groups implementation. */
/* Note. We currently don't always suspend the scheduler. Todo: IDF-3755
* configASSERT( uxSchedulerSuspended[ xPortGetCoreID() ] != 0 ); */
/* Store the item value in the event list item. It is safe to access the
* event list item here as interrupts won't access the event list item of a
* task that is not in the Blocked state. */
@@ -3767,6 +3777,7 @@ void vTaskPlaceOnUnorderedEventList( List_t * pxEventList,
vListInsertEnd( pxEventList, &( pxCurrentTCB[ xPortGetCoreID() ]->xEventListItem ) );
prvAddCurrentTaskToDelayedList( xPortGetCoreID(), xTicksToWait );
taskEXIT_CRITICAL( &xKernelLock );
}
/*-----------------------------------------------------------*/
@@ -3775,9 +3786,11 @@ void vTaskPlaceOnUnorderedEventList( List_t * pxEventList,
void vTaskPlaceOnEventListRestricted( List_t * const pxEventList, TickType_t xTicksToWait, const BaseType_t xWaitIndefinitely )
{
taskENTER_CRITICAL( &xKernelLock );
configASSERT( pxEventList );
/* Take the kernel lock as we are about to access the task lists. */
taskENTER_CRITICAL( &xKernelLock );
/* This function should not be called by application code hence the
* 'Restricted' in its name. It is not part of the public API. It is
* designed for use by kernel code, and has special calling requirements -
@@ -3798,8 +3811,9 @@ void vTaskPlaceOnUnorderedEventList( List_t * pxEventList,
xTicksToWait = portMAX_DELAY;
}
traceTASK_DELAY_UNTIL( );
traceTASK_DELAY_UNTIL( ( xTickCount + xTicksToWait ) );
prvAddCurrentTaskToDelayedList( xPortGetCoreID(), xTicksToWait );
taskEXIT_CRITICAL( &xKernelLock );
}