73 #define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
85 #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
87 #if ( configUSE_STATS_FORMATTING_FUNCTIONS == 1 )
96 #if configUSE_TICKLESS_IDLE != 0
97 #if INCLUDE_vTaskSuspend != 1
98 #error INCLUDE_vTaskSuspend must be set to 1 if configUSE_TICKLESS_IDLE is not set to 0
105 #define tskIDLE_STACK_SIZE configMINIMAL_STACK_SIZE
116 #if ( portUSING_MPU_WRAPPERS == 1 )
117 xMPU_SETTINGS xMPUSettings;
126 #if ( portSTACK_GROWTH > 0 )
130 #if ( portCRITICAL_NESTING_IN_TCB == 1 )
134 #if ( configUSE_TRACE_FACILITY == 1 )
139 #if ( configUSE_MUTEXES == 1 )
143 #if ( configUSE_APPLICATION_TASK_TAG == 1 )
147 #if ( configGENERATE_RUN_TIME_STATS == 1 )
148 unsigned long ulRunTimeCounter;
151 #if ( configUSE_NEWLIB_REENTRANT == 1 )
159 struct _reent xNewLib_reent;
169 #ifdef portREMOVE_STATIC_QUALIFIER
186 #if ( INCLUDE_vTaskDelete == 1 )
193 #if ( INCLUDE_vTaskSuspend == 1 )
199 #if ( INCLUDE_xTaskGetIdleTaskHandle == 1 )
217 #if ( configGENERATE_RUN_TIME_STATS == 1 )
232 #define tskSTACK_FILL_BYTE ( 0xa5U )
237 #define tskBLOCKED_CHAR ( ( signed char ) 'B' )
238 #define tskREADY_CHAR ( ( signed char ) 'R' )
239 #define tskDELETED_CHAR ( ( signed char ) 'D' )
240 #define tskSUSPENDED_CHAR ( ( signed char ) 'S' )
244 #if ( configUSE_PORT_OPTIMISED_TASK_SELECTION == 0 )
252 #define taskRECORD_READY_PRIORITY( uxPriority ) \
254 if( ( uxPriority ) > uxTopReadyPriority ) \
256 uxTopReadyPriority = ( uxPriority ); \
262 #define taskSELECT_HIGHEST_PRIORITY_TASK() \
265 while( listLIST_IS_EMPTY( &( pxReadyTasksLists[ uxTopReadyPriority ] ) ) ) \
267 configASSERT( uxTopReadyPriority ); \
268 --uxTopReadyPriority; \
273 listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopReadyPriority ] ) ); \
281 #define taskRESET_READY_PRIORITY( uxPriority )
282 #define portRESET_READY_PRIORITY( uxPriority, uxTopReadyPriority )
291 #define taskRECORD_READY_PRIORITY( uxPriority ) portRECORD_READY_PRIORITY( uxPriority, uxTopReadyPriority )
295 #define taskSELECT_HIGHEST_PRIORITY_TASK() \
297 unsigned portBASE_TYPE uxTopPriority; \
300 portGET_HIGHEST_PRIORITY( uxTopPriority, uxTopReadyPriority ); \
301 configASSERT( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ uxTopPriority ] ) ) > 0 ); \
302 listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopPriority ] ) ); \
310 #define taskRESET_READY_PRIORITY( uxPriority ) \
312 if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ ( uxPriority ) ] ) ) == 0 ) \
314 portRESET_READY_PRIORITY( ( uxPriority ), ( uxTopReadyPriority ) ); \
324 #define taskSWITCH_DELAYED_LISTS() \
329 configASSERT( ( listLIST_IS_EMPTY( pxDelayedTaskList ) ) ); \
331 pxTemp = pxDelayedTaskList; \
332 pxDelayedTaskList = pxOverflowDelayedTaskList; \
333 pxOverflowDelayedTaskList = pxTemp; \
336 if( listLIST_IS_EMPTY( pxDelayedTaskList ) != pdFALSE ) \
343 xNextTaskUnblockTime = portMAX_DELAY; \
351 pxTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxDelayedTaskList ); \
352 xNextTaskUnblockTime = listGET_LIST_ITEM_VALUE( &( pxTCB->xGenericListItem ) ); \
362 #define prvAddTaskToReadyList( pxTCB ) \
363 traceMOVED_TASK_TO_READY_STATE( pxTCB ) \
364 taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \
365 vListInsertEnd( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xGenericListItem ) )
374 #define prvGetTCBFromHandle( pxHandle ) ( ( ( pxHandle ) == NULL ) ? ( tskTCB * ) pxCurrentTCB : ( tskTCB * ) ( pxHandle ) )
414 #if ( INCLUDE_vTaskDelete == 1 )
425 static void prvCheckTasksWaitingTermination(
void ) PRIVILEGED_FUNCTION;
431 static
void prvAddCurrentTaskToDelayedList(
portTickType xTimeToWake ) PRIVILEGED_FUNCTION;
437 static
tskTCB *prvAllocateTCBAndStack(
unsigned short usStackDepth,
portSTACK_TYPE *puxStackBuffer ) PRIVILEGED_FUNCTION;
447 #if ( configUSE_TRACE_FACILITY == 1 )
458 #if ( ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) )
460 static unsigned short prvTaskCheckFreeStackSpace(
const unsigned char * pucStackByte )
PRIVILEGED_FUNCTION;
473 #if ( configUSE_TICKLESS_IDLE != 0 )
475 static portTickType prvGetExpectedIdleTime(
void ) PRIVILEGED_FUNCTION;
489 pxNewTCB = prvAllocateTCBAndStack( usStackDepth, puxStackBuffer );
491 if( pxNewTCB !=
NULL )
495 #if( portUSING_MPU_WRAPPERS == 1 )
506 uxPriority &= ~portPRIVILEGE_BIT;
513 #if( portSTACK_GROWTH < 0 )
515 pxTopOfStack = pxNewTCB->
pxStack + ( usStackDepth - (
unsigned short ) 1 );
519 configASSERT( ( ( (
unsigned long ) pxTopOfStack & (
unsigned long ) portBYTE_ALIGNMENT_MASK ) == 0UL ) );
523 pxTopOfStack = pxNewTCB->
pxStack;
526 configASSERT( ( ( (
unsigned long ) pxNewTCB->
pxStack & (
unsigned long ) portBYTE_ALIGNMENT_MASK ) == 0UL ) );
531 pxNewTCB->pxEndOfStack = pxNewTCB->
pxStack + ( usStackDepth - 1 );
536 prvInitialiseTCBVariables( pxNewTCB, pcName, uxPriority, xRegions, usStackDepth );
542 #if( portUSING_MPU_WRAPPERS == 1 )
552 if( (
void * ) pxCreatedTask !=
NULL )
564 uxCurrentNumberOfTasks++;
576 prvInitialiseTaskLists();
584 if( xSchedulerRunning ==
pdFALSE )
595 #if ( configUSE_TRACE_FACILITY == 1 )
598 pxNewTCB->uxTCBNumber = uxTaskNumber;
618 if( xSchedulerRunning !=
pdFALSE )
633 #if ( INCLUDE_vTaskDelete == 1 )
675 if( xSchedulerRunning !=
pdFALSE )
687 #if ( INCLUDE_vTaskDelayUntil == 1 )
692 portBASE_TYPE xAlreadyYielded, xShouldDelay =
pdFALSE;
704 xTimeToWake = *pxPreviousWakeTime + xTimeIncrement;
706 if( xConstTickCount < *pxPreviousWakeTime )
713 if( ( xTimeToWake < *pxPreviousWakeTime ) && ( xTimeToWake > xConstTickCount ) )
723 if( ( xTimeToWake < *pxPreviousWakeTime ) || ( xTimeToWake > xConstTickCount ) )
730 *pxPreviousWakeTime = xTimeToWake;
747 prvAddCurrentTaskToDelayedList( xTimeToWake );
754 if( xAlreadyYielded ==
pdFALSE )
763 #if ( INCLUDE_vTaskDelay == 1 )
768 signed portBASE_TYPE xAlreadyYielded =
pdFALSE;
787 xTimeToWake = xTickCount + xTicksToDelay;
799 prvAddCurrentTaskToDelayedList( xTimeToWake );
806 if( xAlreadyYielded ==
pdFALSE )
815 #if ( INCLUDE_eTaskGetState == 1 )
836 if( ( pxStateList == pxDelayedTaskList ) || ( pxStateList == pxOverflowDelayedTaskList ) )
843 #if ( INCLUDE_vTaskSuspend == 1 )
844 else if( pxStateList == &xSuspendedTaskList )
852 #if ( INCLUDE_vTaskDelete == 1 )
853 else if( pxStateList == &xTasksWaitingTermination )
875 #if ( INCLUDE_uxTaskPriorityGet == 1 )
880 unsigned portBASE_TYPE uxReturn;
897 #if ( INCLUDE_vTaskPrioritySet == 1 )
902 unsigned portBASE_TYPE uxCurrentBasePriority, uxPriorityUsedOnEntry;
903 portBASE_TYPE xYieldRequired =
pdFALSE;
910 uxNewPriority = (
unsigned portBASE_TYPE ) configMAX_PRIORITIES - (
unsigned portBASE_TYPE ) 1U;
921 #if ( configUSE_MUTEXES == 1 )
923 uxCurrentBasePriority = pxTCB->uxBasePriority;
931 if( uxCurrentBasePriority != uxNewPriority )
935 if( uxNewPriority > uxCurrentBasePriority )
973 #if ( configUSE_MUTEXES == 1 )
977 if( pxTCB->uxBasePriority == pxTCB->
uxPriority )
983 pxTCB->uxBasePriority = uxNewPriority;
1012 if( xYieldRequired ==
pdTRUE )
1019 ( void ) uxPriorityUsedOnEntry;
1028 #if ( INCLUDE_vTaskSuspend == 1 )
1060 if( xSchedulerRunning !=
pdFALSE )
1089 #if ( INCLUDE_vTaskSuspend == 1 )
1093 portBASE_TYPE xReturn =
pdFALSE;
1123 #if ( INCLUDE_vTaskSuspend == 1 )
1164 #if ( ( INCLUDE_xTaskResumeFromISR == 1 ) && ( INCLUDE_vTaskSuspend == 1 ) )
1168 portBASE_TYPE xYieldRequired =
pdFALSE;
1170 unsigned portBASE_TYPE uxSavedInterruptStatus;
1198 if( uxSchedulerSuspended == (
unsigned portBASE_TYPE )
pdFALSE )
1219 return xYieldRequired;
1227 portBASE_TYPE xReturn;
1230 #if ( INCLUDE_xTaskGetIdleTaskHandle == 1 )
1243 #if ( configUSE_TIMERS == 1 )
1261 #if ( configUSE_NEWLIB_REENTRANT == 1 )
1269 xSchedulerRunning =
pdTRUE;
1314 ++uxSchedulerSuspended;
1318 #if ( configUSE_TICKLESS_IDLE != 0 )
1337 xReturn = xNextTaskUnblockTime - xTickCount;
1349 portBASE_TYPE xAlreadyYielded =
pdFALSE;
1362 --uxSchedulerSuspended;
1364 if( uxSchedulerSuspended == (
unsigned portBASE_TYPE ) pdFALSE )
1366 if( uxCurrentNumberOfTasks > (
unsigned portBASE_TYPE ) 0U )
1388 if( uxPendedTicks > (
unsigned portBASE_TYPE ) 0U )
1390 while( uxPendedTicks > (
unsigned portBASE_TYPE ) 0U )
1400 if( xYieldPending ==
pdTRUE )
1402 xAlreadyYielded =
pdTRUE;
1410 return xAlreadyYielded;
1421 xTicks = xTickCount;
1432 unsigned portBASE_TYPE uxSavedInterruptStatus;
1451 xReturn = xTickCount;
1462 return uxCurrentNumberOfTasks;
1466 #if ( INCLUDE_pcTaskGetTaskName == 1 )
1481 #if ( configUSE_TRACE_FACILITY == 1 )
1490 if( uxArraySize >= uxCurrentNumberOfTasks )
1497 uxTask += prvListTaskWithinSingleList( &( pxTaskStatusArray[ uxTask ] ), &( pxReadyTasksLists[ uxQueue ] ),
eReady );
1503 uxTask += prvListTaskWithinSingleList( &( pxTaskStatusArray[ uxTask ] ), (
xList * ) pxDelayedTaskList,
eBlocked );
1504 uxTask += prvListTaskWithinSingleList( &( pxTaskStatusArray[ uxTask ] ), (
xList * ) pxOverflowDelayedTaskList,
eBlocked );
1506 #if( INCLUDE_vTaskDelete == 1 )
1510 uxTask += prvListTaskWithinSingleList( &( pxTaskStatusArray[ uxTask ] ), &xTasksWaitingTermination,
eDeleted );
1514 #if ( INCLUDE_vTaskSuspend == 1 )
1518 uxTask += prvListTaskWithinSingleList( &( pxTaskStatusArray[ uxTask ] ), &xSuspendedTaskList,
eSuspended );
1522 #if ( configGENERATE_RUN_TIME_STATS == 1)
1524 if( pulTotalRunTime !=
NULL )
1526 #ifdef portALT_GET_RUN_TIME_COUNTER_VALUE
1527 portALT_GET_RUN_TIME_COUNTER_VALUE( ( *pulTotalRunTime ) );
1535 if( pulTotalRunTime !=
NULL )
1537 *pulTotalRunTime = 0;
1551 #if ( INCLUDE_xTaskGetIdleTaskHandle == 1 )
1558 return xIdleTaskHandle;
1568 #if ( configUSE_TICKLESS_IDLE != 0 )
1575 configASSERT( ( xTickCount + xTicksToJump ) <= xNextTaskUnblockTime );
1576 xTickCount += xTicksToJump;
1587 portBASE_TYPE xSwitchRequired =
pdFALSE;
1593 if( uxSchedulerSuspended == (
unsigned portBASE_TYPE ) pdFALSE )
1613 if( xConstTickCount >= xNextTaskUnblockTime )
1635 if( xConstTickCount < xItemValue )
1641 xNextTaskUnblockTime = xItemValue;
1661 #if ( configUSE_PREEMPTION == 1 )
1669 xSwitchRequired =
pdTRUE;
1681 #if ( ( configUSE_PREEMPTION == 1 ) && ( configUSE_TIME_SLICING == 1 ) )
1685 xSwitchRequired =
pdTRUE;
1690 #if ( configUSE_TICK_HOOK == 1 )
1694 if( uxPendedTicks == (
unsigned portBASE_TYPE ) 0U )
1707 #if ( configUSE_TICK_HOOK == 1 )
1714 #if ( configUSE_PREEMPTION == 1 )
1716 if( xYieldPending != pdFALSE )
1718 xSwitchRequired =
pdTRUE;
1723 return xSwitchRequired;
1727 #if ( configUSE_APPLICATION_TASK_TAG == 1 )
1740 xTCB = (
tskTCB * ) xTask;
1746 xTCB->pxTaskTag = pxHookFunction;
1753 #if ( configUSE_APPLICATION_TASK_TAG == 1 )
1767 xTCB = (
tskTCB * ) xTask;
1773 xReturn = xTCB->pxTaskTag;
1782 #if ( configUSE_APPLICATION_TASK_TAG == 1 )
1787 portBASE_TYPE xReturn;
1796 xTCB = (
tskTCB * ) xTask;
1799 if( xTCB->pxTaskTag !=
NULL )
1801 xReturn = xTCB->pxTaskTag( pvParameter );
1816 if( uxSchedulerSuspended != (
unsigned portBASE_TYPE ) pdFALSE )
1827 #if ( configGENERATE_RUN_TIME_STATS == 1 )
1829 #ifdef portALT_GET_RUN_TIME_COUNTER_VALUE
1830 portALT_GET_RUN_TIME_COUNTER_VALUE( ulTotalRunTime );
1842 if( ulTotalRunTime > ulTaskSwitchedInTime )
1844 pxCurrentTCB->ulRunTimeCounter += ( ulTotalRunTime - ulTaskSwitchedInTime );
1846 ulTaskSwitchedInTime = ulTotalRunTime;
1857 #if ( configUSE_NEWLIB_REENTRANT == 1 )
1892 #if ( INCLUDE_vTaskSuspend == 1 )
1905 xTimeToWake = xTickCount + xTicksToWait;
1906 prvAddCurrentTaskToDelayedList( xTimeToWake );
1913 xTimeToWake = xTickCount + xTicksToWait;
1914 prvAddCurrentTaskToDelayedList( xTimeToWake );
1920 #if configUSE_TIMERS == 1
1952 xTimeToWake = xTickCount + xTicksToWait;
1955 prvAddCurrentTaskToDelayedList( xTimeToWake );
1964 portBASE_TYPE xReturn;
1983 if( uxSchedulerSuspended == (
unsigned portBASE_TYPE )
pdFALSE )
2026 portBASE_TYPE xReturn;
2036 #if ( INCLUDE_vTaskSuspend == 1 )
2055 else if( ( xConstTickCount - pxTimeOut->
xTimeOnEntering ) < *pxTicksToWait )
2079 #if ( configUSE_TRACE_FACILITY == 1 )
2083 unsigned portBASE_TYPE uxReturn;
2088 pxTCB = (
tskTCB * ) xTask;
2089 uxReturn = pxTCB->uxTaskNumber;
2102 #if ( configUSE_TRACE_FACILITY == 1 )
2110 pxTCB = (
tskTCB * ) xTask;
2111 pxTCB->uxTaskNumber = uxHandle;
2131 ( void ) pvParameters;
2136 prvCheckTasksWaitingTermination();
2138 #if ( configUSE_PREEMPTION == 0 )
2148 #if ( ( configUSE_PREEMPTION == 1 ) && ( configIDLE_SHOULD_YIELD == 1 ) )
2166 #if ( configUSE_IDLE_HOOK == 1 )
2183 #if ( configUSE_TICKLESS_IDLE != 0 )
2192 xExpectedIdleTime = prvGetExpectedIdleTime();
2202 xExpectedIdleTime = prvGetExpectedIdleTime();
2219 #if configUSE_TICKLESS_IDLE != 0
2230 else if( xYieldPending != pdFALSE )
2237 #if configUSE_TIMERS == 0
2240 const unsigned portBASE_TYPE uxNonApplicationTasks = 1;
2259 static void prvInitialiseTCBVariables(
tskTCB *pxTCB,
const signed char *
const pcName,
unsigned portBASE_TYPE uxPriority,
const xMemoryRegion *
const xRegions,
unsigned short usStackDepth )
2261 unsigned portBASE_TYPE x;
2271 if( pcName[ x ] == 0x00 )
2285 uxPriority = (
unsigned portBASE_TYPE ) configMAX_PRIORITIES - (
unsigned portBASE_TYPE ) 1U;
2289 #if ( configUSE_MUTEXES == 1 )
2291 pxTCB->uxBasePriority = uxPriority;
2306 #if ( portCRITICAL_NESTING_IN_TCB == 1 )
2312 #if ( configUSE_APPLICATION_TASK_TAG == 1 )
2314 pxTCB->pxTaskTag =
NULL;
2318 #if ( configGENERATE_RUN_TIME_STATS == 1 )
2320 pxTCB->ulRunTimeCounter = 0UL;
2324 #if ( portUSING_MPU_WRAPPERS == 1 )
2326 vPortStoreTaskMPUSettings( &( pxTCB->xMPUSettings ), xRegions, pxTCB->
pxStack, usStackDepth );
2331 ( void ) usStackDepth;
2335 #if ( configUSE_NEWLIB_REENTRANT == 1 )
2338 _REENT_INIT_PTR( ( &( pxTCB->xNewLib_reent ) ) );
2344 #if ( portUSING_MPU_WRAPPERS == 1 )
2353 vPortStoreTaskMPUSettings( &( pxTCB->xMPUSettings ), xRegions,
NULL, 0 );
2359 static void prvInitialiseTaskLists(
void )
2361 unsigned portBASE_TYPE uxPriority;
2363 for( uxPriority = (
unsigned portBASE_TYPE ) 0U; uxPriority < (
unsigned portBASE_TYPE ) configMAX_PRIORITIES; uxPriority++ )
2372 #if ( INCLUDE_vTaskDelete == 1 )
2378 #if ( INCLUDE_vTaskSuspend == 1 )
2386 pxDelayedTaskList = &xDelayedTaskList1;
2387 pxOverflowDelayedTaskList = &xDelayedTaskList2;
2391 static void prvCheckTasksWaitingTermination(
void )
2393 #if ( INCLUDE_vTaskDelete == 1 )
2395 portBASE_TYPE xListIsEmpty;
2399 while( uxTasksDeleted > (
unsigned portBASE_TYPE ) 0U )
2405 if( xListIsEmpty == pdFALSE )
2413 --uxCurrentNumberOfTasks;
2418 prvDeleteTCB( pxTCB );
2426 static void prvAddCurrentTaskToDelayedList(
portTickType xTimeToWake )
2431 if( xTimeToWake < xTickCount )
2444 if( xTimeToWake < xNextTaskUnblockTime )
2446 xNextTaskUnblockTime = xTimeToWake;
2452 static tskTCB *prvAllocateTCBAndStack(
unsigned short usStackDepth,
portSTACK_TYPE *puxStackBuffer )
2460 if( pxNewTCB !=
NULL )
2484 #if ( configUSE_TRACE_FACILITY == 1 )
2488 volatile tskTCB *pxNextTCB, *pxFirstTCB;
2489 unsigned portBASE_TYPE uxTask = 0;
2504 pxTaskStatusArray[ uxTask ].
pcTaskName = (
const signed char * ) &( pxNextTCB->
pcTaskName [ 0 ] );
2505 pxTaskStatusArray[ uxTask ].
xTaskNumber = pxNextTCB->uxTCBNumber;
2509 #if ( configUSE_MUTEXES == 1 )
2511 pxTaskStatusArray[ uxTask ].
uxBasePriority = pxNextTCB->uxBasePriority;
2519 #if ( configGENERATE_RUN_TIME_STATS == 1 )
2521 pxTaskStatusArray[ uxTask ].
ulRunTimeCounter = pxNextTCB->ulRunTimeCounter;
2529 #if ( portSTACK_GROWTH > 0 )
2531 ppxTaskStatusArray[ uxTask ].usStackHighWaterMark = prvTaskCheckFreeStackSpace( (
unsigned char * ) pxNextTCB->pxEndOfStack );
2541 }
while( pxNextTCB != pxFirstTCB );
2550 #if ( ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) )
2552 static unsigned short prvTaskCheckFreeStackSpace(
const unsigned char * pucStackByte )
2554 unsigned short usCount = 0U;
2570 #if ( INCLUDE_uxTaskGetStackHighWaterMark == 1 )
2575 unsigned char *pcEndOfStack;
2576 unsigned portBASE_TYPE uxReturn;
2580 #if portSTACK_GROWTH < 0
2582 pcEndOfStack = (
unsigned char * ) pxTCB->
pxStack;
2586 pcEndOfStack = (
unsigned char * ) pxTCB->pxEndOfStack;
2590 uxReturn = (
unsigned portBASE_TYPE ) prvTaskCheckFreeStackSpace( pcEndOfStack );
2598 #if ( INCLUDE_vTaskDelete == 1 )
2600 static void prvDeleteTCB(
tskTCB *pxTCB )
2616 #if ( ( INCLUDE_xTaskGetCurrentTaskHandle == 1 ) || ( configUSE_MUTEXES == 1 ) )
2633 #if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) )
2637 portBASE_TYPE xReturn;
2639 if( xSchedulerRunning == pdFALSE )
2645 if( uxSchedulerSuspended == (
unsigned portBASE_TYPE ) pdFALSE )
2661 #if ( configUSE_MUTEXES == 1 )
2669 if( pxMutexHolder !=
NULL )
2703 #if ( configUSE_MUTEXES == 1 )
2709 if( pxMutexHolder !=
NULL )
2711 if( pxTCB->
uxPriority != pxTCB->uxBasePriority )
2733 #if ( portCRITICAL_NESTING_IN_TCB == 1 )
2739 if( xSchedulerRunning != pdFALSE )
2748 #if ( portCRITICAL_NESTING_IN_TCB == 1 )
2752 if( xSchedulerRunning != pdFALSE )
2769 #if ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS == 1 ) )
2771 void vTaskList(
signed char *pcWriteBuffer )
2774 volatile unsigned portBASE_TYPE uxArraySize, x;
2803 *pcWriteBuffer = 0x00;
2807 uxArraySize = uxCurrentNumberOfTasks;
2812 if( pxTaskStatusArray !=
NULL )
2818 for( x = 0; x < uxArraySize; x++ )
2820 switch( pxTaskStatusArray[ x ].eCurrentState )
2840 sprintf( (
char * ) pcWriteBuffer, (
char * )
"%s\t\t%c\t%u\t%u\t%u\r\n", pxTaskStatusArray[ x ].pcTaskName, cStatus, (
unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, (
unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, (
unsigned int ) pxTaskStatusArray[ x ].xTaskNumber );
2841 pcWriteBuffer += strlen( (
char * ) pcWriteBuffer );
2852 #if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS == 1 ) )
2857 volatile unsigned portBASE_TYPE uxArraySize, x;
2858 unsigned long ulTotalTime, ulStatsAsPercentage;
2886 *pcWriteBuffer = 0x00;
2890 uxArraySize = uxCurrentNumberOfTasks;
2895 if( pxTaskStatusArray !=
NULL )
2901 ulTotalTime /= 100UL;
2904 if( ulTotalTime > 0 )
2907 for( x = 0; x < uxArraySize; x++ )
2912 ulStatsAsPercentage = pxTaskStatusArray[ x ].
ulRunTimeCounter / ulTotalTime;
2914 if( ulStatsAsPercentage > 0UL )
2916 #ifdef portLU_PRINTF_SPECIFIER_REQUIRED
2918 sprintf( (
char * ) pcWriteBuffer, (
char * )
"%s\t\t%lu\t\t%lu%%\r\n", pxTaskStatusArray[ x ].pcTaskName, pxTaskStatusArray[ x ].ulRunTimeCounter, ulStatsAsPercentage );
2924 sprintf( (
char * ) pcWriteBuffer, (
char * )
"%s\t\t%u\t\t%u%%\r\n", pxTaskStatusArray[ x ].pcTaskName, (
unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter, (
unsigned int ) ulStatsAsPercentage );
2932 #ifdef portLU_PRINTF_SPECIFIER_REQUIRED
2934 sprintf( (
char * ) pcWriteBuffer, (
char * )
"%s\t\t%lu\t\t<1%%\r\n", pxTaskStatusArray[ x ].pcTaskName, pxTaskStatusArray[ x ].ulRunTimeCounter );
2940 sprintf( (
char * ) pcWriteBuffer, (
char * )
"%s\t\t%u\t\t<1%%\r\n", pxTaskStatusArray[ x ].pcTaskName, (
unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter );
2945 pcWriteBuffer += strlen( (
char * ) pcWriteBuffer );