Prusa MINI Firmware overview
tasks.c File Reference
#include <stdlib.h>
#include <string.h>
#include "FreeRTOS.h"
#include "task.h"
#include "timers.h"
#include "StackMacros.h"

Classes

struct  tskTaskControlBlock
 

Macros

#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
 
#define taskYIELD_IF_USING_PREEMPTION()
 
#define taskNOT_WAITING_NOTIFICATION   ( ( uint8_t ) 0 )
 
#define taskWAITING_NOTIFICATION   ( ( uint8_t ) 1 )
 
#define taskNOTIFICATION_RECEIVED   ( ( uint8_t ) 2 )
 
#define tskSTACK_FILL_BYTE   ( 0xa5U )
 
#define tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE   ( ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) || ( portUSING_MPU_WRAPPERS == 1 ) )
 
#define tskDYNAMICALLY_ALLOCATED_STACK_AND_TCB   ( ( uint8_t ) 0 )
 
#define tskSTATICALLY_ALLOCATED_STACK_ONLY   ( ( uint8_t ) 1 )
 
#define tskSTATICALLY_ALLOCATED_STACK_AND_TCB   ( ( uint8_t ) 2 )
 
#define tskBLOCKED_CHAR   ( 'B' )
 
#define tskREADY_CHAR   ( 'R' )
 
#define tskDELETED_CHAR   ( 'D' )
 
#define tskSUSPENDED_CHAR   ( 'S' )
 
#define taskRECORD_READY_PRIORITY(uxPriority)
 
#define taskSELECT_HIGHEST_PRIORITY_TASK()
 
#define taskRESET_READY_PRIORITY(uxPriority)
 
#define portRESET_READY_PRIORITY(uxPriority, uxTopReadyPriority)
 
#define taskSWITCH_DELAYED_LISTS()
 
#define prvAddTaskToReadyList(pxTCB)
 
#define prvGetTCBFromHandle(pxHandle)   ( ( ( pxHandle ) == NULL ) ? ( TCB_t * ) pxCurrentTCB : ( TCB_t * ) ( pxHandle ) )
 
#define taskEVENT_LIST_ITEM_VALUE_IN_USE   0x80000000UL
 

Typedefs

typedef struct tskTaskControlBlock tskTCB
 
typedef tskTCB TCB_t
 

Functions

static PRIVILEGED_FUNCTION void prvInitialiseTaskLists (void)
 
static portTASK_FUNCTION_PROTO (prvIdleTask, pvParameters)
 
static PRIVILEGED_FUNCTION void prvCheckTasksWaitingTermination (void)
 
static PRIVILEGED_FUNCTION void prvAddCurrentTaskToDelayedList (TickType_t xTicksToWait, const BaseType_t xCanBlockIndefinitely)
 
static void prvResetNextTaskUnblockTime (void)
 
static PRIVILEGED_FUNCTION void prvInitialiseNewTask (TaskFunction_t pxTaskCode, const char *const pcName, const uint32_t ulStackDepth, void *const pvParameters, UBaseType_t uxPriority, TaskHandle_t *const pxCreatedTask, TCB_t *pxNewTCB, const MemoryRegion_t *const xRegions)
 
static PRIVILEGED_FUNCTION void prvAddNewTaskToReadyList (TCB_t *pxNewTCB)
 
void vTaskStartScheduler (void)
 
void vTaskEndScheduler (void)
 
void vTaskSuspendAll (void)
 
BaseType_t xTaskResumeAll (void)
 
TickType_t xTaskGetTickCount (void)
 
TickType_t xTaskGetTickCountFromISR (void)
 
UBaseType_t uxTaskGetNumberOfTasks (void)
 
char * pcTaskGetName (TaskHandle_t xTaskToQuery)
 
BaseType_t xTaskIncrementTick (void)
 
void vTaskSwitchContext (void)
 
void vTaskPlaceOnEventList (List_t *const pxEventList, const TickType_t xTicksToWait)
 
void vTaskPlaceOnUnorderedEventList (List_t *pxEventList, const TickType_t xItemValue, const TickType_t xTicksToWait)
 
BaseType_t xTaskRemoveFromEventList (const List_t *const pxEventList)
 
BaseType_t xTaskRemoveFromUnorderedEventList (ListItem_t *pxEventListItem, const TickType_t xItemValue)
 
void vTaskSetTimeOutState (TimeOut_t *const pxTimeOut)
 
BaseType_t xTaskCheckForTimeOut (TimeOut_t *const pxTimeOut, TickType_t *const pxTicksToWait)
 
void vTaskMissedYield (void)
 
static portTASK_FUNCTION (prvIdleTask, pvParameters)
 
TickType_t uxTaskResetEventItemValue (void)
 

Variables

PRIVILEGED_INITIALIZED_DATA TCB_t *volatile pxCurrentTCB = NULL
 
static PRIVILEGED_DATA List_t pxReadyTasksLists [configMAX_PRIORITIES]
 
static PRIVILEGED_DATA List_t xDelayedTaskList1
 
static PRIVILEGED_DATA List_t xDelayedTaskList2
 
static PRIVILEGED_DATA List_t *volatile pxDelayedTaskList
 
static PRIVILEGED_DATA List_t *volatile pxOverflowDelayedTaskList
 
static PRIVILEGED_DATA List_t xPendingReadyList
 
static PRIVILEGED_INITIALIZED_DATA volatile UBaseType_t uxCurrentNumberOfTasks = ( UBaseType_t ) 0U
 
static PRIVILEGED_INITIALIZED_DATA volatile TickType_t xTickCount = ( TickType_t ) 0U
 
static PRIVILEGED_INITIALIZED_DATA volatile UBaseType_t uxTopReadyPriority = tskIDLE_PRIORITY
 
static PRIVILEGED_INITIALIZED_DATA volatile BaseType_t xSchedulerRunning = pdFALSE
 
static PRIVILEGED_INITIALIZED_DATA volatile UBaseType_t uxPendedTicks = ( UBaseType_t ) 0U
 
static PRIVILEGED_INITIALIZED_DATA volatile BaseType_t xYieldPending = pdFALSE
 
static PRIVILEGED_INITIALIZED_DATA volatile BaseType_t xNumOfOverflows = ( BaseType_t ) 0
 
static PRIVILEGED_INITIALIZED_DATA UBaseType_t uxTaskNumber = ( UBaseType_t ) 0U
 
static PRIVILEGED_INITIALIZED_DATA volatile TickType_t xNextTaskUnblockTime = ( TickType_t ) 0U
 
static PRIVILEGED_INITIALIZED_DATA TaskHandle_t xIdleTaskHandle = NULL
 
static PRIVILEGED_INITIALIZED_DATA volatile UBaseType_t uxSchedulerSuspended = ( UBaseType_t ) pdFALSE
 

Macro Definition Documentation

◆ MPU_WRAPPERS_INCLUDED_FROM_API_FILE

#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE

◆ taskYIELD_IF_USING_PREEMPTION

#define taskYIELD_IF_USING_PREEMPTION ( )

◆ taskNOT_WAITING_NOTIFICATION

#define taskNOT_WAITING_NOTIFICATION   ( ( uint8_t ) 0 )

◆ taskWAITING_NOTIFICATION

#define taskWAITING_NOTIFICATION   ( ( uint8_t ) 1 )

◆ taskNOTIFICATION_RECEIVED

#define taskNOTIFICATION_RECEIVED   ( ( uint8_t ) 2 )

◆ tskSTACK_FILL_BYTE

#define tskSTACK_FILL_BYTE   ( 0xa5U )

◆ tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE

#define tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE   ( ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) || ( portUSING_MPU_WRAPPERS == 1 ) )

◆ tskDYNAMICALLY_ALLOCATED_STACK_AND_TCB

#define tskDYNAMICALLY_ALLOCATED_STACK_AND_TCB   ( ( uint8_t ) 0 )

◆ tskSTATICALLY_ALLOCATED_STACK_ONLY

#define tskSTATICALLY_ALLOCATED_STACK_ONLY   ( ( uint8_t ) 1 )

◆ tskSTATICALLY_ALLOCATED_STACK_AND_TCB

#define tskSTATICALLY_ALLOCATED_STACK_AND_TCB   ( ( uint8_t ) 2 )

◆ tskBLOCKED_CHAR

#define tskBLOCKED_CHAR   ( 'B' )

◆ tskREADY_CHAR

#define tskREADY_CHAR   ( 'R' )

◆ tskDELETED_CHAR

#define tskDELETED_CHAR   ( 'D' )

◆ tskSUSPENDED_CHAR

#define tskSUSPENDED_CHAR   ( 'S' )

◆ taskRECORD_READY_PRIORITY

#define taskRECORD_READY_PRIORITY (   uxPriority)
Value:
{ \
if( ( uxPriority ) > uxTopReadyPriority ) \
{ \
uxTopReadyPriority = ( uxPriority ); \
} \
} /* taskRECORD_READY_PRIORITY */

◆ taskSELECT_HIGHEST_PRIORITY_TASK

#define taskSELECT_HIGHEST_PRIORITY_TASK ( )
Value:
{ \
UBaseType_t uxTopPriority = uxTopReadyPriority; \
\
/* Find the highest priority queue that contains ready tasks. */ \
while( listLIST_IS_EMPTY( &( pxReadyTasksLists[ uxTopPriority ] ) ) ) \
{ \
configASSERT( uxTopPriority ); \
--uxTopPriority; \
} \
\
/* listGET_OWNER_OF_NEXT_ENTRY indexes through the list, so the tasks of \
the same priority get an equal share of the processor time. */ \
listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopPriority ] ) ); \
uxTopReadyPriority = uxTopPriority; \
} /* taskSELECT_HIGHEST_PRIORITY_TASK */

◆ taskRESET_READY_PRIORITY

#define taskRESET_READY_PRIORITY (   uxPriority)

◆ portRESET_READY_PRIORITY

#define portRESET_READY_PRIORITY (   uxPriority,
  uxTopReadyPriority 
)

◆ taskSWITCH_DELAYED_LISTS

#define taskSWITCH_DELAYED_LISTS ( )
Value:
{ \
List_t *pxTemp; \
\
/* The delayed tasks list should be empty when the lists are switched. */ \
configASSERT( ( listLIST_IS_EMPTY( pxDelayedTaskList ) ) ); \
\
pxTemp = pxDelayedTaskList; \
pxDelayedTaskList = pxOverflowDelayedTaskList; \
pxOverflowDelayedTaskList = pxTemp; \
xNumOfOverflows++; \
prvResetNextTaskUnblockTime(); \
}

◆ prvAddTaskToReadyList

#define prvAddTaskToReadyList (   pxTCB)
Value:
taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \
vListInsertEnd( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xStateListItem ) ); \
tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )

◆ prvGetTCBFromHandle

#define prvGetTCBFromHandle (   pxHandle)    ( ( ( pxHandle ) == NULL ) ? ( TCB_t * ) pxCurrentTCB : ( TCB_t * ) ( pxHandle ) )

◆ taskEVENT_LIST_ITEM_VALUE_IN_USE

#define taskEVENT_LIST_ITEM_VALUE_IN_USE   0x80000000UL

Typedef Documentation

◆ tskTCB

typedef struct tskTaskControlBlock tskTCB

◆ TCB_t

typedef tskTCB TCB_t

Function Documentation

◆ prvInitialiseTaskLists()

static void prvInitialiseTaskLists ( void  )
static

Utility task that simply returns pdTRUE if the task referenced by xTask is currently in the Suspended state, or pdFALSE if the task referenced by xTask is in any other state.

3334 {
3335 UBaseType_t uxPriority;
3336 
3337  for( uxPriority = ( UBaseType_t ) 0U; uxPriority < ( UBaseType_t ) configMAX_PRIORITIES; uxPriority++ )
3338  {
3339  vListInitialise( &( pxReadyTasksLists[ uxPriority ] ) );
3340  }
3341 
3345 
3346  #if ( INCLUDE_vTaskDelete == 1 )
3347  {
3348  vListInitialise( &xTasksWaitingTermination );
3349  }
3350  #endif /* INCLUDE_vTaskDelete */
3351 
3352  #if ( INCLUDE_vTaskSuspend == 1 )
3353  {
3354  vListInitialise( &xSuspendedTaskList );
3355  }
3356  #endif /* INCLUDE_vTaskSuspend */
3357 
3358  /* Start with pxDelayedTaskList using list1 and the pxOverflowDelayedTaskList
3359  using list2. */
3362 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ portTASK_FUNCTION_PROTO()

static portTASK_FUNCTION_PROTO ( prvIdleTask  ,
pvParameters   
)
static

◆ prvCheckTasksWaitingTermination()

static void prvCheckTasksWaitingTermination ( void  )
static

THIS FUNCTION IS CALLED FROM THE RTOS IDLE TASK

3366 {
3367 
3368  /** THIS FUNCTION IS CALLED FROM THE RTOS IDLE TASK **/
3369 
3370  #if ( INCLUDE_vTaskDelete == 1 )
3371  {
3372  BaseType_t xListIsEmpty;
3373 
3374  /* ucTasksDeleted is used to prevent vTaskSuspendAll() being called
3375  too often in the idle task. */
3376  while( uxDeletedTasksWaitingCleanUp > ( UBaseType_t ) 0U )
3377  {
3378  vTaskSuspendAll();
3379  {
3380  xListIsEmpty = listLIST_IS_EMPTY( &xTasksWaitingTermination );
3381  }
3382  ( void ) xTaskResumeAll();
3383 
3384  if( xListIsEmpty == pdFALSE )
3385  {
3386  TCB_t *pxTCB;
3387 
3389  {
3390  pxTCB = ( TCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( ( &xTasksWaitingTermination ) );
3391  ( void ) uxListRemove( &( pxTCB->xStateListItem ) );
3393  --uxDeletedTasksWaitingCleanUp;
3394  }
3396 
3397  prvDeleteTCB( pxTCB );
3398  }
3399  else
3400  {
3402  }
3403  }
3404  }
3405  #endif /* INCLUDE_vTaskDelete */
3406 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ prvAddCurrentTaskToDelayedList()

static void prvAddCurrentTaskToDelayedList ( TickType_t  xTicksToWait,
const BaseType_t  xCanBlockIndefinitely 
)
static
4693 {
4694 TickType_t xTimeToWake;
4695 const TickType_t xConstTickCount = xTickCount;
4696 
4697  #if( INCLUDE_xTaskAbortDelay == 1 )
4698  {
4699  /* About to enter a delayed list, so ensure the ucDelayAborted flag is
4700  reset to pdFALSE so it can be detected as having been set to pdTRUE
4701  when the task leaves the Blocked state. */
4702  pxCurrentTCB->ucDelayAborted = pdFALSE;
4703  }
4704  #endif
4705 
4706  /* Remove the task from the ready list before adding it to the blocked list
4707  as the same list item is used for both lists. */
4708  if( uxListRemove( &( pxCurrentTCB->xStateListItem ) ) == ( UBaseType_t ) 0 )
4709  {
4710  /* The current task must be in a ready list, so there is no need to
4711  check, and the port reset macro can be called directly. */
4713  }
4714  else
4715  {
4717  }
4718 
4719  #if ( INCLUDE_vTaskSuspend == 1 )
4720  {
4721  if( ( xTicksToWait == portMAX_DELAY ) && ( xCanBlockIndefinitely != pdFALSE ) )
4722  {
4723  /* Add the task to the suspended task list instead of a delayed task
4724  list to ensure it is not woken by a timing event. It will block
4725  indefinitely. */
4726  vListInsertEnd( &xSuspendedTaskList, &( pxCurrentTCB->xStateListItem ) );
4727  }
4728  else
4729  {
4730  /* Calculate the time at which the task should be woken if the event
4731  does not occur. This may overflow but this doesn't matter, the
4732  kernel will manage it correctly. */
4733  xTimeToWake = xConstTickCount + xTicksToWait;
4734 
4735  /* The list item will be inserted in wake time order. */
4736  listSET_LIST_ITEM_VALUE( &( pxCurrentTCB->xStateListItem ), xTimeToWake );
4737 
4738  if( xTimeToWake < xConstTickCount )
4739  {
4740  /* Wake time has overflowed. Place this item in the overflow
4741  list. */
4743  }
4744  else
4745  {
4746  /* The wake time has not overflowed, so the current block list
4747  is used. */
4749 
4750  /* If the task entering the blocked state was placed at the
4751  head of the list of blocked tasks then xNextTaskUnblockTime
4752  needs to be updated too. */
4753  if( xTimeToWake < xNextTaskUnblockTime )
4754  {
4755  xNextTaskUnblockTime = xTimeToWake;
4756  }
4757  else
4758  {
4760  }
4761  }
4762  }
4763  }
4764  #else /* INCLUDE_vTaskSuspend */
4765  {
4766  /* Calculate the time at which the task should be woken if the event
4767  does not occur. This may overflow but this doesn't matter, the kernel
4768  will manage it correctly. */
4769  xTimeToWake = xConstTickCount + xTicksToWait;
4770 
4771  /* The list item will be inserted in wake time order. */
4772  listSET_LIST_ITEM_VALUE( &( pxCurrentTCB->xStateListItem ), xTimeToWake );
4773 
4774  if( xTimeToWake < xConstTickCount )
4775  {
4776  /* Wake time has overflowed. Place this item in the overflow list. */
4778  }
4779  else
4780  {
4781  /* The wake time has not overflowed, so the current block list is used. */
4783 
4784  /* If the task entering the blocked state was placed at the head of the
4785  list of blocked tasks then xNextTaskUnblockTime needs to be updated
4786  too. */
4787  if( xTimeToWake < xNextTaskUnblockTime )
4788  {
4789  xNextTaskUnblockTime = xTimeToWake;
4790  }
4791  else
4792  {
4794  }
4795  }
4796 
4797  /* Avoid compiler warning when INCLUDE_vTaskSuspend is not 1. */
4798  ( void ) xCanBlockIndefinitely;
4799  }
4800  #endif /* INCLUDE_vTaskSuspend */
4801 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ prvResetNextTaskUnblockTime()

static void prvResetNextTaskUnblockTime ( void  )
static
3636 {
3637 TCB_t *pxTCB;
3638 
3640  {
3641  /* The new current delayed list is empty. Set xNextTaskUnblockTime to
3642  the maximum possible value so it is extremely unlikely that the
3643  if( xTickCount >= xNextTaskUnblockTime ) test will pass until
3644  there is an item in the delayed list. */
3646  }
3647  else
3648  {
3649  /* The new current delayed list is not empty, get the value of
3650  the item at the head of the delayed list. This is the time at
3651  which the task at the head of the delayed list should be removed
3652  from the Blocked state. */
3654  xNextTaskUnblockTime = listGET_LIST_ITEM_VALUE( &( ( pxTCB )->xStateListItem ) );
3655  }
3656 }
Here is the caller graph for this function:

◆ prvInitialiseNewTask()

static void prvInitialiseNewTask ( TaskFunction_t  pxTaskCode,
const char *const  pcName,
const uint32_t  ulStackDepth,
void *const  pvParameters,
UBaseType_t  uxPriority,
TaskHandle_t *const  pxCreatedTask,
TCB_t pxNewTCB,
const MemoryRegion_t *const  xRegions 
)
static
775 {
776 StackType_t *pxTopOfStack;
777 UBaseType_t x;
778 
779  #if( portUSING_MPU_WRAPPERS == 1 )
780  /* Should the task be created in privileged mode? */
781  BaseType_t xRunPrivileged;
782  if( ( uxPriority & portPRIVILEGE_BIT ) != 0U )
783  {
784  xRunPrivileged = pdTRUE;
785  }
786  else
787  {
788  xRunPrivileged = pdFALSE;
789  }
790  uxPriority &= ~portPRIVILEGE_BIT;
791  #endif /* portUSING_MPU_WRAPPERS == 1 */
792 
793  /* Avoid dependency on memset() if it is not required. */
794  #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) || ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) )
795  {
796  /* Fill the stack with a known value to assist debugging. */
797  ( void ) memset( pxNewTCB->pxStack, ( int ) tskSTACK_FILL_BYTE, ( size_t ) ulStackDepth * sizeof( StackType_t ) );
798  }
799  #endif /* ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) || ( ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) ) ) */
800 
801  /* Calculate the top of stack address. This depends on whether the stack
802  grows from high memory to low (as per the 80x86) or vice versa.
803  portSTACK_GROWTH is used to make the result positive or negative as required
804  by the port. */
805  #if( portSTACK_GROWTH < 0 )
806  {
807  pxTopOfStack = pxNewTCB->pxStack + ( ulStackDepth - ( uint32_t ) 1 );
808  pxTopOfStack = ( StackType_t * ) ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) ); /*lint !e923 MISRA exception. Avoiding casts between pointers and integers is not practical. Size differences accounted for using portPOINTER_SIZE_TYPE type. */
809 
810  /* Check the alignment of the calculated top of stack is correct. */
811  configASSERT( ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack & ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) == 0UL ) );
812  }
813  #else /* portSTACK_GROWTH */
814  {
815  pxTopOfStack = pxNewTCB->pxStack;
816 
817  /* Check the alignment of the stack buffer is correct. */
818  configASSERT( ( ( ( portPOINTER_SIZE_TYPE ) pxNewTCB->pxStack & ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) == 0UL ) );
819 
820  /* The other extreme of the stack space is required if stack checking is
821  performed. */
822  pxNewTCB->pxEndOfStack = pxNewTCB->pxStack + ( ulStackDepth - ( uint32_t ) 1 );
823  }
824  #endif /* portSTACK_GROWTH */
825 
826  /* Store the task name in the TCB. */
827  for( x = ( UBaseType_t ) 0; x < ( UBaseType_t ) configMAX_TASK_NAME_LEN; x++ )
828  {
829  pxNewTCB->pcTaskName[ x ] = pcName[ x ];
830 
831  /* Don't copy all configMAX_TASK_NAME_LEN if the string is shorter than
832  configMAX_TASK_NAME_LEN characters just in case the memory after the
833  string is not accessible (extremely unlikely). */
834  if( pcName[ x ] == 0x00 )
835  {
836  break;
837  }
838  else
839  {
841  }
842  }
843 
844  /* Ensure the name string is terminated in the case that the string length
845  was greater or equal to configMAX_TASK_NAME_LEN. */
846  pxNewTCB->pcTaskName[ configMAX_TASK_NAME_LEN - 1 ] = '\0';
847 
848  /* This is used as an array index so must ensure it's not too large. First
849  remove the privilege bit if one is present. */
850  if( uxPriority >= ( UBaseType_t ) configMAX_PRIORITIES )
851  {
852  uxPriority = ( UBaseType_t ) configMAX_PRIORITIES - ( UBaseType_t ) 1U;
853  }
854  else
855  {
857  }
858 
859  pxNewTCB->uxPriority = uxPriority;
860  #if ( configUSE_MUTEXES == 1 )
861  {
862  pxNewTCB->uxBasePriority = uxPriority;
863  pxNewTCB->uxMutexesHeld = 0;
864  }
865  #endif /* configUSE_MUTEXES */
866 
867  vListInitialiseItem( &( pxNewTCB->xStateListItem ) );
868  vListInitialiseItem( &( pxNewTCB->xEventListItem ) );
869 
870  /* Set the pxNewTCB as a link back from the ListItem_t. This is so we can get
871  back to the containing TCB from a generic item in a list. */
872  listSET_LIST_ITEM_OWNER( &( pxNewTCB->xStateListItem ), pxNewTCB );
873 
874  /* Event lists are always in priority order. */
875  listSET_LIST_ITEM_VALUE( &( pxNewTCB->xEventListItem ), ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) uxPriority ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
876  listSET_LIST_ITEM_OWNER( &( pxNewTCB->xEventListItem ), pxNewTCB );
877 
878  #if ( portCRITICAL_NESTING_IN_TCB == 1 )
879  {
880  pxNewTCB->uxCriticalNesting = ( UBaseType_t ) 0U;
881  }
882  #endif /* portCRITICAL_NESTING_IN_TCB */
883 
884  #if ( configUSE_APPLICATION_TASK_TAG == 1 )
885  {
886  pxNewTCB->pxTaskTag = NULL;
887  }
888  #endif /* configUSE_APPLICATION_TASK_TAG */
889 
890  #if ( configGENERATE_RUN_TIME_STATS == 1 )
891  {
892  pxNewTCB->ulRunTimeCounter = 0UL;
893  }
894  #endif /* configGENERATE_RUN_TIME_STATS */
895 
896  #if ( portUSING_MPU_WRAPPERS == 1 )
897  {
898  vPortStoreTaskMPUSettings( &( pxNewTCB->xMPUSettings ), xRegions, pxNewTCB->pxStack, ulStackDepth );
899  }
900  #else
901  {
902  /* Avoid compiler warning about unreferenced parameter. */
903  ( void ) xRegions;
904  }
905  #endif
906 
907  #if( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 )
908  {
909  for( x = 0; x < ( UBaseType_t ) configNUM_THREAD_LOCAL_STORAGE_POINTERS; x++ )
910  {
911  pxNewTCB->pvThreadLocalStoragePointers[ x ] = NULL;
912  }
913  }
914  #endif
915 
916  #if ( configUSE_TASK_NOTIFICATIONS == 1 )
917  {
918  pxNewTCB->ulNotifiedValue = 0;
919  pxNewTCB->ucNotifyState = taskNOT_WAITING_NOTIFICATION;
920  }
921  #endif
922 
923  #if ( configUSE_NEWLIB_REENTRANT == 1 )
924  {
925  /* Initialise this task's Newlib reent structure. */
926  _REENT_INIT_PTR( ( &( pxNewTCB->xNewLib_reent ) ) );
927  }
928  #endif
929 
930  #if( INCLUDE_xTaskAbortDelay == 1 )
931  {
932  pxNewTCB->ucDelayAborted = pdFALSE;
933  }
934  #endif
935 
936  /* Initialize the TCB stack to look as if the task was already running,
937  but had been interrupted by the scheduler. The return address is set
938  to the start of the task function. Once the stack has been initialised
939  the top of stack variable is updated. */
940  #if( portUSING_MPU_WRAPPERS == 1 )
941  {
942  pxNewTCB->pxTopOfStack = pxPortInitialiseStack( pxTopOfStack, pxTaskCode, pvParameters, xRunPrivileged );
943  }
944  #else /* portUSING_MPU_WRAPPERS */
945  {
946  pxNewTCB->pxTopOfStack = pxPortInitialiseStack( pxTopOfStack, pxTaskCode, pvParameters );
947  }
948  #endif /* portUSING_MPU_WRAPPERS */
949 
950  if( ( void * ) pxCreatedTask != NULL )
951  {
952  /* Pass the handle out in an anonymous way. The handle can be used to
953  change the created task's priority, delete the created task, etc.*/
954  *pxCreatedTask = ( TaskHandle_t ) pxNewTCB;
955  }
956  else
957  {
959  }
960 }
Here is the call graph for this function:

◆ prvAddNewTaskToReadyList()

static void prvAddNewTaskToReadyList ( TCB_t pxNewTCB)
static
964 {
965  /* Ensure interrupts don't access the task lists while the lists are being
966  updated. */
968  {
970  if( pxCurrentTCB == NULL )
971  {
972  /* There are no other tasks, or all the other tasks are in
973  the suspended state - make this the current task. */
974  pxCurrentTCB = pxNewTCB;
975 
976  if( uxCurrentNumberOfTasks == ( UBaseType_t ) 1 )
977  {
978  /* This is the first task to be created so do the preliminary
979  initialisation required. We will not recover if this call
980  fails, but we will report the failure. */
982  }
983  else
984  {
986  }
987  }
988  else
989  {
990  /* If the scheduler is not already running, make this task the
991  current task if it is the highest priority task to be created
992  so far. */
993  if( xSchedulerRunning == pdFALSE )
994  {
995  if( pxCurrentTCB->uxPriority <= pxNewTCB->uxPriority )
996  {
997  pxCurrentTCB = pxNewTCB;
998  }
999  else
1000  {
1002  }
1003  }
1004  else
1005  {
1007  }
1008  }
1009 
1010  uxTaskNumber++;
1011 
1012  #if ( configUSE_TRACE_FACILITY == 1 )
1013  {
1014  /* Add a counter into the TCB for tracing only. */
1015  pxNewTCB->uxTCBNumber = uxTaskNumber;
1016  }
1017  #endif /* configUSE_TRACE_FACILITY */
1018  traceTASK_CREATE( pxNewTCB );
1019 
1020  prvAddTaskToReadyList( pxNewTCB );
1021 
1022  portSETUP_TCB( pxNewTCB );
1023  }
1025 
1026  if( xSchedulerRunning != pdFALSE )
1027  {
1028  /* If the created task is of a higher priority than the current task
1029  then it should run now. */
1030  if( pxCurrentTCB->uxPriority < pxNewTCB->uxPriority )
1031  {
1033  }
1034  else
1035  {
1037  }
1038  }
1039  else
1040  {
1042  }
1043 }
Here is the call graph for this function:

◆ vTaskStartScheduler()

void vTaskStartScheduler ( void  )
1827 {
1828 BaseType_t xReturn;
1829 
1830  /* Add the idle task at the lowest priority. */
1831  #if( configSUPPORT_STATIC_ALLOCATION == 1 )
1832  {
1833  StaticTask_t *pxIdleTaskTCBBuffer = NULL;
1834  StackType_t *pxIdleTaskStackBuffer = NULL;
1835  uint32_t ulIdleTaskStackSize;
1836 
1837  /* The Idle task is created using user provided RAM - obtain the
1838  address of the RAM then create the idle task. */
1839  vApplicationGetIdleTaskMemory( &pxIdleTaskTCBBuffer, &pxIdleTaskStackBuffer, &ulIdleTaskStackSize );
1840  xIdleTaskHandle = xTaskCreateStatic( prvIdleTask,
1841  "IDLE",
1842  ulIdleTaskStackSize,
1843  ( void * ) NULL,
1845  pxIdleTaskStackBuffer,
1846  pxIdleTaskTCBBuffer ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */
1847 
1848  if( xIdleTaskHandle != NULL )
1849  {
1850  xReturn = pdPASS;
1851  }
1852  else
1853  {
1854  xReturn = pdFAIL;
1855  }
1856  }
1857  #else
1858  {
1859  /* The Idle task is being created using dynamically allocated RAM. */
1860  xReturn = xTaskCreate( prvIdleTask,
1861  "IDLE", configMINIMAL_STACK_SIZE,
1862  ( void * ) NULL,
1864  &xIdleTaskHandle ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */
1865  }
1866  #endif /* configSUPPORT_STATIC_ALLOCATION */
1867 
1868  #if ( configUSE_TIMERS == 1 )
1869  {
1870  if( xReturn == pdPASS )
1871  {
1872  xReturn = xTimerCreateTimerTask();
1873  }
1874  else
1875  {
1877  }
1878  }
1879  #endif /* configUSE_TIMERS */
1880 
1881  if( xReturn == pdPASS )
1882  {
1883  /* Interrupts are turned off here, to ensure a tick does not occur
1884  before or during the call to xPortStartScheduler(). The stacks of
1885  the created tasks contain a status word with interrupts switched on
1886  so interrupts will automatically get re-enabled when the first task
1887  starts to run. */
1889 
1890  #if ( configUSE_NEWLIB_REENTRANT == 1 )
1891  {
1892  /* Switch Newlib's _impure_ptr variable to point to the _reent
1893  structure specific to the task that will run first. */
1894  _impure_ptr = &( pxCurrentTCB->xNewLib_reent );
1895  }
1896  #endif /* configUSE_NEWLIB_REENTRANT */
1897 
1900  xTickCount = ( TickType_t ) 0U;
1901 
1902  /* If configGENERATE_RUN_TIME_STATS is defined then the following
1903  macro must be defined to configure the timer/counter used to generate
1904  the run time counter time base. */
1906 
1907  /* Setting up the timer tick is hardware specific and thus in the
1908  portable interface. */
1909  if( xPortStartScheduler() != pdFALSE )
1910  {
1911  /* Should not reach here as if the scheduler is running the
1912  function will not return. */
1913  }
1914  else
1915  {
1916  /* Should only reach here if a task calls xTaskEndScheduler(). */
1917  }
1918  }
1919  else
1920  {
1921  /* This line will only be reached if the kernel could not be started,
1922  because there was not enough FreeRTOS heap to create the idle task
1923  or the timer task. */
1925  }
1926 
1927  /* Prevent compiler warnings if INCLUDE_xTaskGetIdleTaskHandle is set to 0,
1928  meaning xIdleTaskHandle is not used anywhere else. */
1929  ( void ) xIdleTaskHandle;
1930 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vTaskEndScheduler()

void vTaskEndScheduler ( void  )
1934 {
1935  /* Stop the scheduler interrupts and call the portable scheduler end
1936  routine so the original ISRs can be restored if necessary. The port
1937  layer must ensure interrupts enable bit is left in the correct state. */
1941 }
Here is the call graph for this function:

◆ vTaskSuspendAll()

void vTaskSuspendAll ( void  )
1945 {
1946  /* A critical section is not required as the variable is of type
1947  BaseType_t. Please read Richard Barry's reply in the following link to a
1948  post in the FreeRTOS support forum before reporting this as a bug! -
1949  http://goo.gl/wu4acr */
1951 }
Here is the caller graph for this function:

◆ xTaskResumeAll()

BaseType_t xTaskResumeAll ( void  )
2018 {
2019 TCB_t *pxTCB = NULL;
2020 BaseType_t xAlreadyYielded = pdFALSE;
2021 
2022  /* If uxSchedulerSuspended is zero then this function does not match a
2023  previous call to vTaskSuspendAll(). */
2025 
2026  /* It is possible that an ISR caused a task to be removed from an event
2027  list while the scheduler was suspended. If this was the case then the
2028  removed task will have been added to the xPendingReadyList. Once the
2029  scheduler has been resumed it is safe to move all the pending ready
2030  tasks from this list into their appropriate ready list. */
2032  {
2034 
2036  {
2037  if( uxCurrentNumberOfTasks > ( UBaseType_t ) 0U )
2038  {
2039  /* Move any readied tasks from the pending list into the
2040  appropriate ready list. */
2042  {
2043  pxTCB = ( TCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( ( &xPendingReadyList ) );
2044  ( void ) uxListRemove( &( pxTCB->xEventListItem ) );
2045  ( void ) uxListRemove( &( pxTCB->xStateListItem ) );
2046  prvAddTaskToReadyList( pxTCB );
2047 
2048  /* If the moved task has a priority higher than the current
2049  task then a yield must be performed. */
2050  if( pxTCB->uxPriority >= pxCurrentTCB->uxPriority )
2051  {
2053  }
2054  else
2055  {
2057  }
2058  }
2059 
2060  if( pxTCB != NULL )
2061  {
2062  /* A task was unblocked while the scheduler was suspended,
2063  which may have prevented the next unblock time from being
2064  re-calculated, in which case re-calculate it now. Mainly
2065  important for low power tickless implementations, where
2066  this can prevent an unnecessary exit from low power
2067  state. */
2069  }
2070 
2071  /* If any ticks occurred while the scheduler was suspended then
2072  they should be processed now. This ensures the tick count does
2073  not slip, and that any delayed tasks are resumed at the correct
2074  time. */
2075  {
2076  UBaseType_t uxPendedCounts = uxPendedTicks; /* Non-volatile copy. */
2077 
2078  if( uxPendedCounts > ( UBaseType_t ) 0U )
2079  {
2080  do
2081  {
2082  if( xTaskIncrementTick() != pdFALSE )
2083  {
2085  }
2086  else
2087  {
2089  }
2090  --uxPendedCounts;
2091  } while( uxPendedCounts > ( UBaseType_t ) 0U );
2092 
2093  uxPendedTicks = 0;
2094  }
2095  else
2096  {
2098  }
2099  }
2100 
2101  if( xYieldPending != pdFALSE )
2102  {
2103  #if( configUSE_PREEMPTION != 0 )
2104  {
2105  xAlreadyYielded = pdTRUE;
2106  }
2107  #endif
2109  }
2110  else
2111  {
2113  }
2114  }
2115  }
2116  else
2117  {
2119  }
2120  }
2122 
2123  return xAlreadyYielded;
2124 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xTaskGetTickCount()

TickType_t xTaskGetTickCount ( void  )
2128 {
2129 TickType_t xTicks;
2130 
2131  /* Critical section required if running on a 16 bit processor. */
2133  {
2134  xTicks = xTickCount;
2135  }
2137 
2138  return xTicks;
2139 }
Here is the caller graph for this function:

◆ xTaskGetTickCountFromISR()

TickType_t xTaskGetTickCountFromISR ( void  )
2143 {
2144 TickType_t xReturn;
2145 UBaseType_t uxSavedInterruptStatus;
2146 
2147  /* RTOS ports that support interrupt nesting have the concept of a maximum
2148  system call (or maximum API call) interrupt priority. Interrupts that are
2149  above the maximum system call priority are kept permanently enabled, even
2150  when the RTOS kernel is in a critical section, but cannot make any calls to
2151  FreeRTOS API functions. If configASSERT() is defined in FreeRTOSConfig.h
2152  then portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion
2153  failure if a FreeRTOS API function is called from an interrupt that has been
2154  assigned a priority above the configured maximum system call priority.
2155  Only FreeRTOS functions that end in FromISR can be called from interrupts
2156  that have been assigned a priority at or (logically) below the maximum
2157  system call interrupt priority. FreeRTOS maintains a separate interrupt
2158  safe API to ensure interrupt entry is as fast and as simple as possible.
2159  More information (albeit Cortex-M specific) is provided on the following
2160  link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */
2162 
2163  uxSavedInterruptStatus = portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR();
2164  {
2165  xReturn = xTickCount;
2166  }
2167  portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
2168 
2169  return xReturn;
2170 }
Here is the caller graph for this function:

◆ uxTaskGetNumberOfTasks()

UBaseType_t uxTaskGetNumberOfTasks ( void  )
2174 {
2175  /* A critical section is not required because the variables are of type
2176  BaseType_t. */
2177  return uxCurrentNumberOfTasks;
2178 }

◆ pcTaskGetName()

char* pcTaskGetName ( TaskHandle_t  xTaskToQuery)
2182 {
2183 TCB_t *pxTCB;
2184 
2185  /* If null is passed in here then the name of the calling task is being
2186  queried. */
2187  pxTCB = prvGetTCBFromHandle( xTaskToQuery );
2188  configASSERT( pxTCB );
2189  return &( pxTCB->pcTaskName[ 0 ] );
2190 }

◆ xTaskIncrementTick()

BaseType_t xTaskIncrementTick ( void  )
2500 {
2501 TCB_t * pxTCB;
2502 TickType_t xItemValue;
2503 BaseType_t xSwitchRequired = pdFALSE;
2504 
2505  /* Called by the portable layer each time a tick interrupt occurs.
2506  Increments the tick then checks to see if the new tick value will cause any
2507  tasks to be unblocked. */
2510  {
2511  /* Minor optimisation. The tick count cannot change in this
2512  block. */
2513  const TickType_t xConstTickCount = xTickCount + 1;
2514 
2515  /* Increment the RTOS tick, switching the delayed and overflowed
2516  delayed lists if it wraps to 0. */
2517  xTickCount = xConstTickCount;
2518 
2519  if( xConstTickCount == ( TickType_t ) 0U )
2520  {
2522  }
2523  else
2524  {
2526  }
2527 
2528  /* See if this tick has made a timeout expire. Tasks are stored in
2529  the queue in the order of their wake time - meaning once one task
2530  has been found whose block time has not expired there is no need to
2531  look any further down the list. */
2532  if( xConstTickCount >= xNextTaskUnblockTime )
2533  {
2534  for( ;; )
2535  {
2537  {
2538  /* The delayed list is empty. Set xNextTaskUnblockTime
2539  to the maximum possible value so it is extremely
2540  unlikely that the
2541  if( xTickCount >= xNextTaskUnblockTime ) test will pass
2542  next time through. */
2543  xNextTaskUnblockTime = portMAX_DELAY; /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
2544  break;
2545  }
2546  else
2547  {
2548  /* The delayed list is not empty, get the value of the
2549  item at the head of the delayed list. This is the time
2550  at which the task at the head of the delayed list must
2551  be removed from the Blocked state. */
2553  xItemValue = listGET_LIST_ITEM_VALUE( &( pxTCB->xStateListItem ) );
2554 
2555  if( xConstTickCount < xItemValue )
2556  {
2557  /* It is not time to unblock this item yet, but the
2558  item value is the time at which the task at the head
2559  of the blocked list must be removed from the Blocked
2560  state - so record the item value in
2561  xNextTaskUnblockTime. */
2562  xNextTaskUnblockTime = xItemValue;
2563  break;
2564  }
2565  else
2566  {
2568  }
2569 
2570  /* It is time to remove the item from the Blocked state. */
2571  ( void ) uxListRemove( &( pxTCB->xStateListItem ) );
2572 
2573  /* Is the task waiting on an event also? If so remove
2574  it from the event list. */
2575  if( listLIST_ITEM_CONTAINER( &( pxTCB->xEventListItem ) ) != NULL )
2576  {
2577  ( void ) uxListRemove( &( pxTCB->xEventListItem ) );
2578  }
2579  else
2580  {
2582  }
2583 
2584  /* Place the unblocked task into the appropriate ready
2585  list. */
2586  prvAddTaskToReadyList( pxTCB );
2587 
2588  /* A task being unblocked cannot cause an immediate
2589  context switch if preemption is turned off. */
2590  #if ( configUSE_PREEMPTION == 1 )
2591  {
2592  /* Preemption is on, but a context switch should
2593  only be performed if the unblocked task has a
2594  priority that is equal to or higher than the
2595  currently executing task. */
2596  if( pxTCB->uxPriority >= pxCurrentTCB->uxPriority )
2597  {
2598  xSwitchRequired = pdTRUE;
2599  }
2600  else
2601  {
2603  }
2604  }
2605  #endif /* configUSE_PREEMPTION */
2606  }
2607  }
2608  }
2609 
2610  /* Tasks of equal priority to the currently running task will share
2611  processing time (time slice) if preemption is on, and the application
2612  writer has not explicitly turned time slicing off. */
2613  #if ( ( configUSE_PREEMPTION == 1 ) && ( configUSE_TIME_SLICING == 1 ) )
2614  {
2616  {
2617  xSwitchRequired = pdTRUE;
2618  }
2619  else
2620  {
2622  }
2623  }
2624  #endif /* ( ( configUSE_PREEMPTION == 1 ) && ( configUSE_TIME_SLICING == 1 ) ) */
2625 
2626  #if ( configUSE_TICK_HOOK == 1 )
2627  {
2628  /* Guard against the tick hook being called when the pended tick
2629  count is being unwound (when the scheduler is being unlocked). */
2630  if( uxPendedTicks == ( UBaseType_t ) 0U )
2631  {
2633  }
2634  else
2635  {
2637  }
2638  }
2639  #endif /* configUSE_TICK_HOOK */
2640  }
2641  else
2642  {
2643  ++uxPendedTicks;
2644 
2645  /* The tick hook gets called at regular intervals, even if the
2646  scheduler is locked. */
2647  #if ( configUSE_TICK_HOOK == 1 )
2648  {
2650  }
2651  #endif
2652  }
2653 
2654  #if ( configUSE_PREEMPTION == 1 )
2655  {
2656  if( xYieldPending != pdFALSE )
2657  {
2658  xSwitchRequired = pdTRUE;
2659  }
2660  else
2661  {
2663  }
2664  }
2665  #endif /* configUSE_PREEMPTION */
2666 
2667  return xSwitchRequired;
2668 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vTaskSwitchContext()

void vTaskSwitchContext ( void  )
2762 {
2764  {
2765  /* The scheduler is currently suspended - do not allow a context
2766  switch. */
2768  }
2769  else
2770  {
2773 
2774  #if ( configGENERATE_RUN_TIME_STATS == 1 )
2775  {
2776  #ifdef portALT_GET_RUN_TIME_COUNTER_VALUE
2777  portALT_GET_RUN_TIME_COUNTER_VALUE( ulTotalRunTime );
2778  #else
2779  ulTotalRunTime = portGET_RUN_TIME_COUNTER_VALUE();
2780  #endif
2781 
2782  /* Add the amount of time the task has been running to the
2783  accumulated time so far. The time the task started running was
2784  stored in ulTaskSwitchedInTime. Note that there is no overflow
2785  protection here so count values are only valid until the timer
2786  overflows. The guard against negative values is to protect
2787  against suspect run time stat counter implementations - which
2788  are provided by the application, not the kernel. */
2789  if( ulTotalRunTime > ulTaskSwitchedInTime )
2790  {
2791  pxCurrentTCB->ulRunTimeCounter += ( ulTotalRunTime - ulTaskSwitchedInTime );
2792  }
2793  else
2794  {
2796  }
2797  ulTaskSwitchedInTime = ulTotalRunTime;
2798  }
2799  #endif /* configGENERATE_RUN_TIME_STATS */
2800 
2801  /* Check for stack overflow, if configured. */
2803 
2804  /* Select a new task to run using either the generic C or port
2805  optimised asm code. */
2808 
2809  #if ( configUSE_NEWLIB_REENTRANT == 1 )
2810  {
2811  /* Switch Newlib's _impure_ptr variable to point to the _reent
2812  structure specific to this task. */
2813  _impure_ptr = &( pxCurrentTCB->xNewLib_reent );
2814  }
2815  #endif /* configUSE_NEWLIB_REENTRANT */
2816  }
2817 }

◆ vTaskPlaceOnEventList()

void vTaskPlaceOnEventList ( List_t *const  pxEventList,
const TickType_t  xTicksToWait 
)
2821 {
2822  configASSERT( pxEventList );
2823 
2824  /* THIS FUNCTION MUST BE CALLED WITH EITHER INTERRUPTS DISABLED OR THE
2825  SCHEDULER SUSPENDED AND THE QUEUE BEING ACCESSED LOCKED. */
2826 
2827  /* Place the event list item of the TCB in the appropriate event list.
2828  This is placed in the list in priority order so the highest priority task
2829  is the first to be woken by the event. The queue that contains the event
2830  list is locked, preventing simultaneous access from interrupts. */
2831  vListInsert( pxEventList, &( pxCurrentTCB->xEventListItem ) );
2832 
2833  prvAddCurrentTaskToDelayedList( xTicksToWait, pdTRUE );
2834 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vTaskPlaceOnUnorderedEventList()

void vTaskPlaceOnUnorderedEventList ( List_t pxEventList,
const TickType_t  xItemValue,
const TickType_t  xTicksToWait 
)
2838 {
2839  configASSERT( pxEventList );
2840 
2841  /* THIS FUNCTION MUST BE CALLED WITH THE SCHEDULER SUSPENDED. It is used by
2842  the event groups implementation. */
2844 
2845  /* Store the item value in the event list item. It is safe to access the
2846  event list item here as interrupts won't access the event list item of a
2847  task that is not in the Blocked state. */
2849 
2850  /* Place the event list item of the TCB at the end of the appropriate event
2851  list. It is safe to access the event list here because it is part of an
2852  event group implementation - and interrupts don't access event groups
2853  directly (instead they access them indirectly by pending function calls to
2854  the task level). */
2855  vListInsertEnd( pxEventList, &( pxCurrentTCB->xEventListItem ) );
2856 
2857  prvAddCurrentTaskToDelayedList( xTicksToWait, pdTRUE );
2858 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xTaskRemoveFromEventList()

BaseType_t xTaskRemoveFromEventList ( const List_t *const  pxEventList)
2895 {
2896 TCB_t *pxUnblockedTCB;
2897 BaseType_t xReturn;
2898 
2899  /* THIS FUNCTION MUST BE CALLED FROM A CRITICAL SECTION. It can also be
2900  called from a critical section within an ISR. */
2901 
2902  /* The event list is sorted in priority order, so the first in the list can
2903  be removed as it is known to be the highest priority. Remove the TCB from
2904  the delayed list, and add it to the ready list.
2905 
2906  If an event is for a queue that is locked then this function will never
2907  get called - the lock count on the queue will get modified instead. This
2908  means exclusive access to the event list is guaranteed here.
2909 
2910  This function assumes that a check has already been made to ensure that
2911  pxEventList is not empty. */
2912  pxUnblockedTCB = ( TCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxEventList );
2913  configASSERT( pxUnblockedTCB );
2914  ( void ) uxListRemove( &( pxUnblockedTCB->xEventListItem ) );
2915 
2917  {
2918  ( void ) uxListRemove( &( pxUnblockedTCB->xStateListItem ) );
2919  prvAddTaskToReadyList( pxUnblockedTCB );
2920  }
2921  else
2922  {
2923  /* The delayed and ready lists cannot be accessed, so hold this task
2924  pending until the scheduler is resumed. */
2925  vListInsertEnd( &( xPendingReadyList ), &( pxUnblockedTCB->xEventListItem ) );
2926  }
2927 
2928  if( pxUnblockedTCB->uxPriority > pxCurrentTCB->uxPriority )
2929  {
2930  /* Return true if the task removed from the event list has a higher
2931  priority than the calling task. This allows the calling task to know if
2932  it should force a context switch now. */
2933  xReturn = pdTRUE;
2934 
2935  /* Mark that a yield is pending in case the user is not using the
2936  "xHigherPriorityTaskWoken" parameter to an ISR safe FreeRTOS function. */
2938  }
2939  else
2940  {
2941  xReturn = pdFALSE;
2942  }
2943 
2944  #if( configUSE_TICKLESS_IDLE != 0 )
2945  {
2946  /* If a task is blocked on a kernel object then xNextTaskUnblockTime
2947  might be set to the blocked task's time out time. If the task is
2948  unblocked for a reason other than a timeout xNextTaskUnblockTime is
2949  normally left unchanged, because it is automatically reset to a new
2950  value when the tick count equals xNextTaskUnblockTime. However if
2951  tickless idling is used it might be more important to enter sleep mode
2952  at the earliest possible time - so reset xNextTaskUnblockTime here to
2953  ensure it is updated at the earliest possible time. */
2955  }
2956  #endif
2957 
2958  return xReturn;
2959 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xTaskRemoveFromUnorderedEventList()

BaseType_t xTaskRemoveFromUnorderedEventList ( ListItem_t pxEventListItem,
const TickType_t  xItemValue 
)
2963 {
2964 TCB_t *pxUnblockedTCB;
2965 BaseType_t xReturn;
2966 
2967  /* THIS FUNCTION MUST BE CALLED WITH THE SCHEDULER SUSPENDED. It is used by
2968  the event flags implementation. */
2970 
2971  /* Store the new item value in the event list. */
2972  listSET_LIST_ITEM_VALUE( pxEventListItem, xItemValue | taskEVENT_LIST_ITEM_VALUE_IN_USE );
2973 
2974  /* Remove the event list form the event flag. Interrupts do not access
2975  event flags. */
2976  pxUnblockedTCB = ( TCB_t * ) listGET_LIST_ITEM_OWNER( pxEventListItem );
2977  configASSERT( pxUnblockedTCB );
2978  ( void ) uxListRemove( pxEventListItem );
2979 
2980  /* Remove the task from the delayed list and add it to the ready list. The
2981  scheduler is suspended so interrupts will not be accessing the ready
2982  lists. */
2983  ( void ) uxListRemove( &( pxUnblockedTCB->xStateListItem ) );
2984  prvAddTaskToReadyList( pxUnblockedTCB );
2985 
2986  if( pxUnblockedTCB->uxPriority > pxCurrentTCB->uxPriority )
2987  {
2988  /* Return true if the task removed from the event list has
2989  a higher priority than the calling task. This allows
2990  the calling task to know if it should force a context
2991  switch now. */
2992  xReturn = pdTRUE;
2993 
2994  /* Mark that a yield is pending in case the user is not using the
2995  "xHigherPriorityTaskWoken" parameter to an ISR safe FreeRTOS function. */
2997  }
2998  else
2999  {
3000  xReturn = pdFALSE;
3001  }
3002 
3003  return xReturn;
3004 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vTaskSetTimeOutState()

void vTaskSetTimeOutState ( TimeOut_t *const  pxTimeOut)
3008 {
3009  configASSERT( pxTimeOut );
3010  pxTimeOut->xOverflowCount = xNumOfOverflows;
3011  pxTimeOut->xTimeOnEntering = xTickCount;
3012 }
Here is the caller graph for this function:

◆ xTaskCheckForTimeOut()

BaseType_t xTaskCheckForTimeOut ( TimeOut_t *const  pxTimeOut,
TickType_t *const  pxTicksToWait 
)
3016 {
3017 BaseType_t xReturn;
3018 
3019  configASSERT( pxTimeOut );
3020  configASSERT( pxTicksToWait );
3021 
3023  {
3024  /* Minor optimisation. The tick count cannot change in this block. */
3025  const TickType_t xConstTickCount = xTickCount;
3026 
3027  #if( INCLUDE_xTaskAbortDelay == 1 )
3028  if( pxCurrentTCB->ucDelayAborted != pdFALSE )
3029  {
3030  /* The delay was aborted, which is not the same as a time out,
3031  but has the same result. */
3032  pxCurrentTCB->ucDelayAborted = pdFALSE;
3033  xReturn = pdTRUE;
3034  }
3035  else
3036  #endif
3037 
3038  #if ( INCLUDE_vTaskSuspend == 1 )
3039  if( *pxTicksToWait == portMAX_DELAY )
3040  {
3041  /* If INCLUDE_vTaskSuspend is set to 1 and the block time
3042  specified is the maximum block time then the task should block
3043  indefinitely, and therefore never time out. */
3044  xReturn = pdFALSE;
3045  }
3046  else
3047  #endif
3048 
3049  if( ( xNumOfOverflows != pxTimeOut->xOverflowCount ) && ( xConstTickCount >= pxTimeOut->xTimeOnEntering ) ) /*lint !e525 Indentation preferred as is to make code within pre-processor directives clearer. */
3050  {
3051  /* The tick count is greater than the time at which
3052  vTaskSetTimeout() was called, but has also overflowed since
3053  vTaskSetTimeOut() was called. It must have wrapped all the way
3054  around and gone past again. This passed since vTaskSetTimeout()
3055  was called. */
3056  xReturn = pdTRUE;
3057  }
3058  else if( ( ( TickType_t ) ( xConstTickCount - pxTimeOut->xTimeOnEntering ) ) < *pxTicksToWait ) /*lint !e961 Explicit casting is only redundant with some compilers, whereas others require it to prevent integer conversion errors. */
3059  {
3060  /* Not a genuine timeout. Adjust parameters for time remaining. */
3061  *pxTicksToWait -= ( xConstTickCount - pxTimeOut->xTimeOnEntering );
3062  vTaskSetTimeOutState( pxTimeOut );
3063  xReturn = pdFALSE;
3064  }
3065  else
3066  {
3067  xReturn = pdTRUE;
3068  }
3069  }
3071 
3072  return xReturn;
3073 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vTaskMissedYield()

void vTaskMissedYield ( void  )
3077 {
3079 }
Here is the caller graph for this function:

◆ portTASK_FUNCTION()

static portTASK_FUNCTION ( prvIdleTask  ,
pvParameters   
)
static

THIS IS THE RTOS IDLE TASK - WHICH IS CREATED AUTOMATICALLY WHEN THE SCHEDULER IS STARTED.

3132 {
3133  /* Stop warnings. */
3134  ( void ) pvParameters;
3135 
3136  /** THIS IS THE RTOS IDLE TASK - WHICH IS CREATED AUTOMATICALLY WHEN THE
3137  SCHEDULER IS STARTED. **/
3138 
3139  for( ;; )
3140  {
3141  /* See if any tasks have deleted themselves - if so then the idle task
3142  is responsible for freeing the deleted task's TCB and stack. */
3144 
3145  #if ( configUSE_PREEMPTION == 0 )
3146  {
3147  /* If we are not using preemption we keep forcing a task switch to
3148  see if any other task has become available. If we are using
3149  preemption we don't need to do this as any task becoming available
3150  will automatically get the processor anyway. */
3151  taskYIELD();
3152  }
3153  #endif /* configUSE_PREEMPTION */
3154 
3155  #if ( ( configUSE_PREEMPTION == 1 ) && ( configIDLE_SHOULD_YIELD == 1 ) )
3156  {
3157  /* When using preemption tasks of equal priority will be
3158  timesliced. If a task that is sharing the idle priority is ready
3159  to run then the idle task should yield before the end of the
3160  timeslice.
3161 
3162  A critical region is not required here as we are just reading from
3163  the list, and an occasional incorrect value will not matter. If
3164  the ready list at the idle priority contains more than one task
3165  then a task other than the idle task is ready to execute. */
3167  {
3168  taskYIELD();
3169  }
3170  else
3171  {
3173  }
3174  }
3175  #endif /* ( ( configUSE_PREEMPTION == 1 ) && ( configIDLE_SHOULD_YIELD == 1 ) ) */
3176 
3177  #if ( configUSE_IDLE_HOOK == 1 )
3178  {
3179  extern void vApplicationIdleHook( void );
3180 
3181  /* Call the user defined function from within the idle task. This
3182  allows the application designer to add background functionality
3183  without the overhead of a separate task.
3184  NOTE: vApplicationIdleHook() MUST NOT, UNDER ANY CIRCUMSTANCES,
3185  CALL A FUNCTION THAT MIGHT BLOCK. */
3187  }
3188  #endif /* configUSE_IDLE_HOOK */
3189 
3190  /* This conditional compilation should use inequality to 0, not equality
3191  to 1. This is to ensure portSUPPRESS_TICKS_AND_SLEEP() is called when
3192  user defined low power mode implementations require
3193  configUSE_TICKLESS_IDLE to be set to a value other than 1. */
3194  #if ( configUSE_TICKLESS_IDLE != 0 )
3195  {
3196  TickType_t xExpectedIdleTime;
3197 
3198  /* It is not desirable to suspend then resume the scheduler on
3199  each iteration of the idle task. Therefore, a preliminary
3200  test of the expected idle time is performed without the
3201  scheduler suspended. The result here is not necessarily
3202  valid. */
3203  xExpectedIdleTime = prvGetExpectedIdleTime();
3204 
3205  if( xExpectedIdleTime >= configEXPECTED_IDLE_TIME_BEFORE_SLEEP )
3206  {
3207  vTaskSuspendAll();
3208  {
3209  /* Now the scheduler is suspended, the expected idle
3210  time can be sampled again, and this time its value can
3211  be used. */
3213  xExpectedIdleTime = prvGetExpectedIdleTime();
3214 
3215  if( xExpectedIdleTime >= configEXPECTED_IDLE_TIME_BEFORE_SLEEP )
3216  {
3218  portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime );
3220  }
3221  else
3222  {
3224  }
3225  }
3226  ( void ) xTaskResumeAll();
3227  }
3228  else
3229  {
3231  }
3232  }
3233  #endif /* configUSE_TICKLESS_IDLE */
3234  }
3235 }
Here is the call graph for this function:

◆ uxTaskResetEventItemValue()

TickType_t uxTaskResetEventItemValue ( void  )
4163 {
4164 TickType_t uxReturn;
4165 
4167 
4168  /* Reset the event list item to its normal value - so it can be used with
4169  queues and semaphores. */
4170  listSET_LIST_ITEM_VALUE( &( pxCurrentTCB->xEventListItem ), ( ( TickType_t ) configMAX_PRIORITIES - ( TickType_t ) pxCurrentTCB->uxPriority ) ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
4171 
4172  return uxReturn;
4173 }
Here is the caller graph for this function:

Variable Documentation

◆ pxCurrentTCB

PRIVILEGED_INITIALIZED_DATA TCB_t* volatile pxCurrentTCB = NULL

◆ pxReadyTasksLists

PRIVILEGED_DATA List_t pxReadyTasksLists[configMAX_PRIORITIES]
static

◆ xDelayedTaskList1

PRIVILEGED_DATA List_t xDelayedTaskList1
static

◆ xDelayedTaskList2

PRIVILEGED_DATA List_t xDelayedTaskList2
static

◆ pxDelayedTaskList

PRIVILEGED_DATA List_t* volatile pxDelayedTaskList
static

◆ pxOverflowDelayedTaskList

PRIVILEGED_DATA List_t* volatile pxOverflowDelayedTaskList
static

◆ xPendingReadyList

PRIVILEGED_DATA List_t xPendingReadyList
static

◆ uxCurrentNumberOfTasks

PRIVILEGED_INITIALIZED_DATA volatile UBaseType_t uxCurrentNumberOfTasks = ( UBaseType_t ) 0U
static

◆ xTickCount

PRIVILEGED_INITIALIZED_DATA volatile TickType_t xTickCount = ( TickType_t ) 0U
static

◆ uxTopReadyPriority

PRIVILEGED_INITIALIZED_DATA volatile UBaseType_t uxTopReadyPriority = tskIDLE_PRIORITY
static

◆ xSchedulerRunning

PRIVILEGED_INITIALIZED_DATA volatile BaseType_t xSchedulerRunning = pdFALSE
static

◆ uxPendedTicks

PRIVILEGED_INITIALIZED_DATA volatile UBaseType_t uxPendedTicks = ( UBaseType_t ) 0U
static

◆ xYieldPending

PRIVILEGED_INITIALIZED_DATA volatile BaseType_t xYieldPending = pdFALSE
static

◆ xNumOfOverflows

PRIVILEGED_INITIALIZED_DATA volatile BaseType_t xNumOfOverflows = ( BaseType_t ) 0
static

◆ uxTaskNumber

PRIVILEGED_INITIALIZED_DATA UBaseType_t uxTaskNumber = ( UBaseType_t ) 0U
static

◆ xNextTaskUnblockTime

PRIVILEGED_INITIALIZED_DATA volatile TickType_t xNextTaskUnblockTime = ( TickType_t ) 0U
static

◆ xIdleTaskHandle

PRIVILEGED_INITIALIZED_DATA TaskHandle_t xIdleTaskHandle = NULL
static

◆ uxSchedulerSuspended

PRIVILEGED_INITIALIZED_DATA volatile UBaseType_t uxSchedulerSuspended = ( UBaseType_t ) pdFALSE
static
taskYIELD_IF_USING_PREEMPTION
#define taskYIELD_IF_USING_PREEMPTION()
Definition: tasks.c:104
uxTaskNumber
static PRIVILEGED_INITIALIZED_DATA UBaseType_t uxTaskNumber
Definition: tasks.c:403
vListInitialiseItem
PRIVILEGED_FUNCTION void vListInitialiseItem(ListItem_t *const pxItem)
Definition: list.c:104
taskSELECT_HIGHEST_PRIORITY_TASK
#define taskSELECT_HIGHEST_PRIORITY_TASK()
Definition: tasks.c:174
pxDelayedTaskList
static PRIVILEGED_DATA List_t *volatile pxDelayedTaskList
Definition: tasks.c:378
listSET_LIST_ITEM_OWNER
#define listSET_LIST_ITEM_OWNER(pxListItem, pxOwner)
Definition: list.h:221
xTaskResumeAll
BaseType_t xTaskResumeAll(void)
Definition: tasks.c:2017
portMAX_DELAY
#define portMAX_DELAY
Definition: portmacro.h:106
xPendingReadyList
static PRIVILEGED_DATA List_t xPendingReadyList
Definition: tasks.c:380
tskTaskControlBlock::xStateListItem
ListItem_t xStateListItem
Definition: tasks.c:301
vApplicationIdleHook
void vApplicationIdleHook(void)
Application Idle Hook.
Definition: cpu_utils.c:75
tskTaskControlBlock::uxPriority
UBaseType_t uxPriority
Definition: tasks.c:303
portPRIVILEGE_BIT
#define portPRIVILEGE_BIT
Definition: FreeRTOS.h:688
portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR
#define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR(x)
Definition: FreeRTOS.h:807
configASSERT
#define configASSERT(x)
Definition: FreeRTOSConfig.h:162
tskTaskControlBlock
Definition: tasks.c:293
xNextTaskUnblockTime
static PRIVILEGED_INITIALIZED_DATA volatile TickType_t xNextTaskUnblockTime
Definition: tasks.c:404
listCURRENT_LIST_LENGTH
#define listCURRENT_LIST_LENGTH(pxList)
Definition: list.h:296
taskSWITCH_DELAYED_LISTS
#define taskSWITCH_DELAYED_LISTS()
Definition: tasks.c:239
errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY
#define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY
Definition: projdefs.h:95
pdFAIL
#define pdFAIL
Definition: projdefs.h:90
vListInsert
PRIVILEGED_FUNCTION void vListInsert(List_t *const pxList, ListItem_t *const pxNewListItem)
Definition: list.c:145
tskSTACK_FILL_BYTE
#define tskSTACK_FILL_BYTE
Definition: tasks.c:118
portTICK_TYPE_EXIT_CRITICAL
#define portTICK_TYPE_EXIT_CRITICAL()
Definition: FreeRTOS.h:805
prvCheckTasksWaitingTermination
static PRIVILEGED_FUNCTION void prvCheckTasksWaitingTermination(void)
Definition: tasks.c:3365
configNUM_THREAD_LOCAL_STORAGE_POINTERS
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS
Definition: FreeRTOS.h:236
xSchedulerRunning
static PRIVILEGED_INITIALIZED_DATA volatile BaseType_t xSchedulerRunning
Definition: tasks.c:399
xTickCount
static PRIVILEGED_INITIALIZED_DATA volatile TickType_t xTickCount
Definition: tasks.c:397
listGET_OWNER_OF_HEAD_ENTRY
#define listGET_OWNER_OF_HEAD_ENTRY(pxList)
Definition: list.h:348
vListInitialise
PRIVILEGED_FUNCTION void vListInitialise(List_t *const pxList)
Definition: list.c:79
vListInsertEnd
PRIVILEGED_FUNCTION void vListInsertEnd(List_t *const pxList, ListItem_t *const pxNewListItem)
Definition: list.c:116
NULL
#define NULL
Definition: usbd_def.h:53
pdPASS
#define pdPASS
Definition: projdefs.h:89
portSUPPRESS_TICKS_AND_SLEEP
#define portSUPPRESS_TICKS_AND_SLEEP(xExpectedIdleTime)
Definition: FreeRTOS.h:696
portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
Definition: FreeRTOS.h:680
TickType_t
uint32_t TickType_t
Definition: portmacro.h:105
xDelayedTaskList2
static PRIVILEGED_DATA List_t xDelayedTaskList2
Definition: tasks.c:377
tskTaskControlBlock::pxStack
StackType_t * pxStack
Definition: tasks.c:304
listGET_LIST_ITEM_VALUE
#define listGET_LIST_ITEM_VALUE(pxListItem)
Definition: list.h:249
tskTaskControlBlock::pxTopOfStack
volatile StackType_t * pxTopOfStack
Definition: tasks.c:295
listSET_LIST_ITEM_VALUE
#define listSET_LIST_ITEM_VALUE(pxListItem, xValue)
Definition: list.h:239
taskENTER_CRITICAL
#define taskENTER_CRITICAL()
Definition: task.h:217
xIdleTaskHandle
static PRIVILEGED_INITIALIZED_DATA TaskHandle_t xIdleTaskHandle
Definition: tasks.c:405
TaskHandle_t
void * TaskHandle_t
Definition: task.h:103
pdFALSE
#define pdFALSE
Definition: projdefs.h:86
portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR
#define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR()
Definition: FreeRTOS.h:806
prvAddCurrentTaskToDelayedList
static PRIVILEGED_FUNCTION void prvAddCurrentTaskToDelayedList(TickType_t xTicksToWait, const BaseType_t xCanBlockIndefinitely)
Definition: tasks.c:4692
prvInitialiseTaskLists
static PRIVILEGED_FUNCTION void prvInitialiseTaskLists(void)
Definition: tasks.c:3333
UBaseType_t
unsigned long UBaseType_t
Definition: portmacro.h:99
traceLOW_POWER_IDLE_END
#define traceLOW_POWER_IDLE_END()
Definition: FreeRTOS.h:365
traceTASK_SWITCHED_OUT
#define traceTASK_SWITCHED_OUT()
Definition: FreeRTOSConfig.h:92
uxListRemove
PRIVILEGED_FUNCTION UBaseType_t uxListRemove(ListItem_t *const pxItemToRemove)
Definition: list.c:212
prvAddTaskToReadyList
#define prvAddTaskToReadyList(pxTCB)
Definition: tasks.c:259
listGET_LIST_ITEM_OWNER
#define listGET_LIST_ITEM_OWNER(pxListItem)
Definition: list.h:230
configMINIMAL_STACK_SIZE
#define configMINIMAL_STACK_SIZE
Definition: FreeRTOSConfig.h:111
configMAX_PRIORITIES
#define configMAX_PRIORITIES
Definition: FreeRTOSConfig.h:110
xPortStartScheduler
PRIVILEGED_FUNCTION BaseType_t xPortStartScheduler(void)
Definition: port.c:312
void
void
Definition: png.h:1083
uxSchedulerSuspended
static PRIVILEGED_INITIALIZED_DATA volatile UBaseType_t uxSchedulerSuspended
Definition: tasks.c:415
portDISABLE_INTERRUPTS
#define portDISABLE_INTERRUPTS()
Definition: portmacro.h:143
xDelayedTaskList1
static PRIVILEGED_DATA List_t xDelayedTaskList1
Definition: tasks.c:376
StackType_t
portSTACK_TYPE StackType_t
Definition: portmacro.h:97
xTimerCreateTimerTask
PRIVILEGED_FUNCTION BaseType_t xTimerCreateTimerTask(void)
traceTASK_SWITCHED_IN
#define traceTASK_SWITCHED_IN()
Definition: FreeRTOSConfig.h:89
listLIST_IS_EMPTY
#define listLIST_IS_EMPTY(pxList)
Definition: list.h:291
portRESET_READY_PRIORITY
#define portRESET_READY_PRIORITY(uxPriority, uxTopReadyPriority)
Definition: tasks.c:197
taskYIELD
#define taskYIELD()
Definition: task.h:203
portPOINTER_SIZE_TYPE
#define portPOINTER_SIZE_TYPE
Definition: FreeRTOS.h:330
xSTATIC_TCB
Definition: FreeRTOS.h:910
tskTaskControlBlock::xEventListItem
ListItem_t xEventListItem
Definition: tasks.c:302
tskTaskControlBlock::pcTaskName
char pcTaskName[configMAX_TASK_NAME_LEN]
Definition: tasks.c:305
vTaskSetTimeOutState
void vTaskSetTimeOutState(TimeOut_t *const pxTimeOut)
Definition: tasks.c:3007
pxCurrentTCB
PRIVILEGED_INITIALIZED_DATA TCB_t *volatile pxCurrentTCB
Definition: tasks.c:372
prvResetNextTaskUnblockTime
static void prvResetNextTaskUnblockTime(void)
Definition: tasks.c:3635
taskCHECK_FOR_STACK_OVERFLOW
#define taskCHECK_FOR_STACK_OVERFLOW()
Definition: StackMacros.h:165
prvGetTCBFromHandle
#define prvGetTCBFromHandle(pxHandle)
Definition: tasks.c:272
portASSERT_IF_INTERRUPT_PRIORITY_INVALID
#define portASSERT_IF_INTERRUPT_PRIORITY_INVALID()
Definition: FreeRTOS.h:740
taskNOT_WAITING_NOTIFICATION
#define taskNOT_WAITING_NOTIFICATION
Definition: tasks.c:110
uxCurrentNumberOfTasks
static PRIVILEGED_INITIALIZED_DATA volatile UBaseType_t uxCurrentNumberOfTasks
Definition: tasks.c:396
configMAX_TASK_NAME_LEN
#define configMAX_TASK_NAME_LEN
Definition: FreeRTOSConfig.h:113
vPortEndScheduler
PRIVILEGED_FUNCTION void vPortEndScheduler(void)
Definition: port.c:399
BaseType_t
long BaseType_t
Definition: portmacro.h:98
pdTRUE
#define pdTRUE
Definition: projdefs.h:87
xNumOfOverflows
static PRIVILEGED_INITIALIZED_DATA volatile BaseType_t xNumOfOverflows
Definition: tasks.c:402
uxPendedTicks
static PRIVILEGED_INITIALIZED_DATA volatile UBaseType_t uxPendedTicks
Definition: tasks.c:400
traceTASK_INCREMENT_TICK
#define traceTASK_INCREMENT_TICK(xTickCount)
Definition: FreeRTOS.h:546
vApplicationTickHook
void vApplicationTickHook(void)
Application Idle Hook.
Definition: cpu_utils.c:89
traceLOW_POWER_IDLE_BEGIN
#define traceLOW_POWER_IDLE_BEGIN()
Definition: FreeRTOS.h:360
xTIME_OUT::xOverflowCount
BaseType_t xOverflowCount
Definition: task.h:137
traceMOVED_TASK_TO_READY_STATE
#define traceMOVED_TASK_TO_READY_STATE(pxTCB)
Definition: FreeRTOS.h:414
taskEXIT_CRITICAL
#define taskEXIT_CRITICAL()
Definition: task.h:232
pxReadyTasksLists
static PRIVILEGED_DATA List_t pxReadyTasksLists[configMAX_PRIORITIES]
Definition: tasks.c:375
portTICK_TYPE_ENTER_CRITICAL
#define portTICK_TYPE_ENTER_CRITICAL()
Definition: FreeRTOS.h:804
listLIST_ITEM_CONTAINER
#define listLIST_ITEM_CONTAINER(pxListItem)
Definition: list.h:367
xTaskIncrementTick
BaseType_t xTaskIncrementTick(void)
Definition: tasks.c:2499
vTaskSuspendAll
void vTaskSuspendAll(void)
Definition: tasks.c:1944
pxPortInitialiseStack
PRIVILEGED_FUNCTION StackType_t * pxPortInitialiseStack(StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters)
portSETUP_TCB
#define portSETUP_TCB(pxTCB)
Definition: FreeRTOS.h:316
configEXPECTED_IDLE_TIME_BEFORE_SLEEP
#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP
Definition: FreeRTOS.h:700
uxTopReadyPriority
static PRIVILEGED_INITIALIZED_DATA volatile UBaseType_t uxTopReadyPriority
Definition: tasks.c:398
xTIME_OUT::xTimeOnEntering
TickType_t xTimeOnEntering
Definition: task.h:138
taskEVENT_LIST_ITEM_VALUE_IN_USE
#define taskEVENT_LIST_ITEM_VALUE_IN_USE
Definition: tasks.c:285
traceTASK_CREATE
#define traceTASK_CREATE(pxNewTCB)
Definition: FreeRTOS.h:510
xYieldPending
static PRIVILEGED_INITIALIZED_DATA volatile BaseType_t xYieldPending
Definition: tasks.c:401
tskIDLE_PRIORITY
#define tskIDLE_PRIORITY
Definition: task.h:193
pxOverflowDelayedTaskList
static PRIVILEGED_DATA List_t *volatile pxOverflowDelayedTaskList
Definition: tasks.c:379
mtCOVERAGE_TEST_MARKER
#define mtCOVERAGE_TEST_MARKER()
Definition: FreeRTOS.h:748