Prusa MINI Firmware overview
task.h File Reference
#include "list.h"

Go to the source code of this file.

Classes

struct  xTIME_OUT
 
struct  xMEMORY_REGION
 
struct  xTASK_PARAMETERS
 
struct  xTASK_STATUS
 

Macros

#define tskKERNEL_VERSION_NUMBER   "V9.0.0"
 
#define tskKERNEL_VERSION_MAJOR   9
 
#define tskKERNEL_VERSION_MINOR   0
 
#define tskKERNEL_VERSION_BUILD   0
 
#define tskIDLE_PRIORITY   ( ( UBaseType_t ) 0U )
 
#define taskYIELD()   portYIELD()
 
#define taskENTER_CRITICAL()   portENTER_CRITICAL()
 
#define taskENTER_CRITICAL_FROM_ISR()   portSET_INTERRUPT_MASK_FROM_ISR()
 
#define taskEXIT_CRITICAL()   portEXIT_CRITICAL()
 
#define taskEXIT_CRITICAL_FROM_ISR(x)   portCLEAR_INTERRUPT_MASK_FROM_ISR( x )
 
#define taskDISABLE_INTERRUPTS()   portDISABLE_INTERRUPTS()
 
#define taskENABLE_INTERRUPTS()   portENABLE_INTERRUPTS()
 
#define taskSCHEDULER_SUSPENDED   ( ( BaseType_t ) 0 )
 
#define taskSCHEDULER_NOT_STARTED   ( ( BaseType_t ) 1 )
 
#define taskSCHEDULER_RUNNING   ( ( BaseType_t ) 2 )
 
#define xTaskNotify(xTaskToNotify, ulValue, eAction)   xTaskGenericNotify( ( xTaskToNotify ), ( ulValue ), ( eAction ), NULL )
 
#define xTaskNotifyAndQuery(xTaskToNotify, ulValue, eAction, pulPreviousNotifyValue)   xTaskGenericNotify( ( xTaskToNotify ), ( ulValue ), ( eAction ), ( pulPreviousNotifyValue ) )
 
#define xTaskNotifyFromISR(xTaskToNotify, ulValue, eAction, pxHigherPriorityTaskWoken)   xTaskGenericNotifyFromISR( ( xTaskToNotify ), ( ulValue ), ( eAction ), NULL, ( pxHigherPriorityTaskWoken ) )
 
#define xTaskNotifyAndQueryFromISR(xTaskToNotify, ulValue, eAction, pulPreviousNotificationValue, pxHigherPriorityTaskWoken)   xTaskGenericNotifyFromISR( ( xTaskToNotify ), ( ulValue ), ( eAction ), ( pulPreviousNotificationValue ), ( pxHigherPriorityTaskWoken ) )
 
#define xTaskNotifyGive(xTaskToNotify)   xTaskGenericNotify( ( xTaskToNotify ), ( 0 ), eIncrement, NULL )
 

Typedefs

typedef voidTaskHandle_t
 
typedef BaseType_t(* TaskHookFunction_t) (void *)
 
typedef struct xTIME_OUT TimeOut_t
 
typedef struct xMEMORY_REGION MemoryRegion_t
 
typedef struct xTASK_PARAMETERS TaskParameters_t
 
typedef struct xTASK_STATUS TaskStatus_t
 

Enumerations

enum  eTaskState {
  eRunning = 0, eReady, eBlocked, eSuspended,
  eDeleted, eInvalid
}
 
enum  eNotifyAction {
  eNoAction = 0, eSetBits, eIncrement, eSetValueWithOverwrite,
  eSetValueWithoutOverwrite
}
 
enum  eSleepModeStatus { eAbortSleep = 0, eStandardSleep, eNoTasksWaitingTimeout }
 

Functions

PRIVILEGED_FUNCTION void vTaskAllocateMPURegions (TaskHandle_t xTask, const MemoryRegion_t *const pxRegions)
 
PRIVILEGED_FUNCTION void vTaskDelete (TaskHandle_t xTaskToDelete)
 
PRIVILEGED_FUNCTION void vTaskDelay (const TickType_t xTicksToDelay)
 
PRIVILEGED_FUNCTION void vTaskDelayUntil (TickType_t *const pxPreviousWakeTime, const TickType_t xTimeIncrement)
 
PRIVILEGED_FUNCTION BaseType_t xTaskAbortDelay (TaskHandle_t xTask)
 
PRIVILEGED_FUNCTION UBaseType_t uxTaskPriorityGet (TaskHandle_t xTask)
 
PRIVILEGED_FUNCTION UBaseType_t uxTaskPriorityGetFromISR (TaskHandle_t xTask)
 
PRIVILEGED_FUNCTION eTaskState eTaskGetState (TaskHandle_t xTask)
 
PRIVILEGED_FUNCTION void vTaskGetInfo (TaskHandle_t xTask, TaskStatus_t *pxTaskStatus, BaseType_t xGetFreeStackSpace, eTaskState eState)
 
PRIVILEGED_FUNCTION void vTaskPrioritySet (TaskHandle_t xTask, UBaseType_t uxNewPriority)
 
PRIVILEGED_FUNCTION void vTaskSuspend (TaskHandle_t xTaskToSuspend)
 
PRIVILEGED_FUNCTION void vTaskResume (TaskHandle_t xTaskToResume)
 
PRIVILEGED_FUNCTION BaseType_t xTaskResumeFromISR (TaskHandle_t xTaskToResume)
 
PRIVILEGED_FUNCTION void vTaskStartScheduler (void)
 
PRIVILEGED_FUNCTION void vTaskEndScheduler (void)
 
PRIVILEGED_FUNCTION void vTaskSuspendAll (void)
 
PRIVILEGED_FUNCTION BaseType_t xTaskResumeAll (void)
 
PRIVILEGED_FUNCTION TickType_t xTaskGetTickCount (void)
 
PRIVILEGED_FUNCTION TickType_t xTaskGetTickCountFromISR (void)
 
PRIVILEGED_FUNCTION UBaseType_t uxTaskGetNumberOfTasks (void)
 
PRIVILEGED_FUNCTION char * pcTaskGetName (TaskHandle_t xTaskToQuery)
 
PRIVILEGED_FUNCTION TaskHandle_t xTaskGetHandle (const char *pcNameToQuery)
 
PRIVILEGED_FUNCTION UBaseType_t uxTaskGetStackHighWaterMark (TaskHandle_t xTask)
 
PRIVILEGED_FUNCTION BaseType_t xTaskCallApplicationTaskHook (TaskHandle_t xTask, void *pvParameter)
 
PRIVILEGED_FUNCTION TaskHandle_t xTaskGetIdleTaskHandle (void)
 
PRIVILEGED_FUNCTION UBaseType_t uxTaskGetSystemState (TaskStatus_t *const pxTaskStatusArray, const UBaseType_t uxArraySize, uint32_t *const pulTotalRunTime)
 
PRIVILEGED_FUNCTION void vTaskList (char *pcWriteBuffer)
 
PRIVILEGED_FUNCTION void vTaskGetRunTimeStats (char *pcWriteBuffer)
 
PRIVILEGED_FUNCTION BaseType_t xTaskGenericNotify (TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue)
 
PRIVILEGED_FUNCTION BaseType_t xTaskGenericNotifyFromISR (TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue, BaseType_t *pxHigherPriorityTaskWoken)
 
PRIVILEGED_FUNCTION BaseType_t xTaskNotifyWait (uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait)
 
PRIVILEGED_FUNCTION void vTaskNotifyGiveFromISR (TaskHandle_t xTaskToNotify, BaseType_t *pxHigherPriorityTaskWoken)
 
PRIVILEGED_FUNCTION uint32_t ulTaskNotifyTake (BaseType_t xClearCountOnExit, TickType_t xTicksToWait)
 
BaseType_t xTaskNotifyStateClear (TaskHandle_t xTask)
 
PRIVILEGED_FUNCTION BaseType_t xTaskIncrementTick (void)
 
PRIVILEGED_FUNCTION void vTaskPlaceOnEventList (List_t *const pxEventList, const TickType_t xTicksToWait)
 
PRIVILEGED_FUNCTION void vTaskPlaceOnUnorderedEventList (List_t *pxEventList, const TickType_t xItemValue, const TickType_t xTicksToWait)
 
PRIVILEGED_FUNCTION void vTaskPlaceOnEventListRestricted (List_t *const pxEventList, TickType_t xTicksToWait, const BaseType_t xWaitIndefinitely)
 
PRIVILEGED_FUNCTION BaseType_t xTaskRemoveFromEventList (const List_t *const pxEventList)
 
PRIVILEGED_FUNCTION BaseType_t xTaskRemoveFromUnorderedEventList (ListItem_t *pxEventListItem, const TickType_t xItemValue)
 
PRIVILEGED_FUNCTION void vTaskSwitchContext (void)
 
PRIVILEGED_FUNCTION TickType_t uxTaskResetEventItemValue (void)
 
PRIVILEGED_FUNCTION TaskHandle_t xTaskGetCurrentTaskHandle (void)
 
PRIVILEGED_FUNCTION void vTaskSetTimeOutState (TimeOut_t *const pxTimeOut)
 
PRIVILEGED_FUNCTION BaseType_t xTaskCheckForTimeOut (TimeOut_t *const pxTimeOut, TickType_t *const pxTicksToWait)
 
PRIVILEGED_FUNCTION void vTaskMissedYield (void)
 
PRIVILEGED_FUNCTION BaseType_t xTaskGetSchedulerState (void)
 
PRIVILEGED_FUNCTION void vTaskPriorityInherit (TaskHandle_t const pxMutexHolder)
 
PRIVILEGED_FUNCTION BaseType_t xTaskPriorityDisinherit (TaskHandle_t const pxMutexHolder)
 
PRIVILEGED_FUNCTION UBaseType_t uxTaskGetTaskNumber (TaskHandle_t xTask)
 
PRIVILEGED_FUNCTION void vTaskSetTaskNumber (TaskHandle_t xTask, const UBaseType_t uxHandle)
 
PRIVILEGED_FUNCTION void vTaskStepTick (const TickType_t xTicksToJump)
 
PRIVILEGED_FUNCTION eSleepModeStatus eTaskConfirmSleepModeStatus (void)
 
PRIVILEGED_FUNCTION voidpvTaskIncrementMutexHeldCount (void)
 

Macro Definition Documentation

◆ tskKERNEL_VERSION_NUMBER

#define tskKERNEL_VERSION_NUMBER   "V9.0.0"

◆ tskKERNEL_VERSION_MAJOR

#define tskKERNEL_VERSION_MAJOR   9

◆ tskKERNEL_VERSION_MINOR

#define tskKERNEL_VERSION_MINOR   0

◆ tskKERNEL_VERSION_BUILD

#define tskKERNEL_VERSION_BUILD   0

◆ tskIDLE_PRIORITY

#define tskIDLE_PRIORITY   ( ( UBaseType_t ) 0U )

Defines the priority used by the idle task. This must not be modified.

◆ taskYIELD

#define taskYIELD ( )    portYIELD()

◆ taskENTER_CRITICAL

#define taskENTER_CRITICAL ( )    portENTER_CRITICAL()

◆ taskENTER_CRITICAL_FROM_ISR

#define taskENTER_CRITICAL_FROM_ISR ( )    portSET_INTERRUPT_MASK_FROM_ISR()

◆ taskEXIT_CRITICAL

#define taskEXIT_CRITICAL ( )    portEXIT_CRITICAL()

◆ taskEXIT_CRITICAL_FROM_ISR

#define taskEXIT_CRITICAL_FROM_ISR (   x)    portCLEAR_INTERRUPT_MASK_FROM_ISR( x )

◆ taskDISABLE_INTERRUPTS

#define taskDISABLE_INTERRUPTS ( )    portDISABLE_INTERRUPTS()

◆ taskENABLE_INTERRUPTS

#define taskENABLE_INTERRUPTS ( )    portENABLE_INTERRUPTS()

◆ taskSCHEDULER_SUSPENDED

#define taskSCHEDULER_SUSPENDED   ( ( BaseType_t ) 0 )

◆ taskSCHEDULER_NOT_STARTED

#define taskSCHEDULER_NOT_STARTED   ( ( BaseType_t ) 1 )

◆ taskSCHEDULER_RUNNING

#define taskSCHEDULER_RUNNING   ( ( BaseType_t ) 2 )

◆ xTaskNotify

#define xTaskNotify (   xTaskToNotify,
  ulValue,
  eAction 
)    xTaskGenericNotify( ( xTaskToNotify ), ( ulValue ), ( eAction ), NULL )

◆ xTaskNotifyAndQuery

#define xTaskNotifyAndQuery (   xTaskToNotify,
  ulValue,
  eAction,
  pulPreviousNotifyValue 
)    xTaskGenericNotify( ( xTaskToNotify ), ( ulValue ), ( eAction ), ( pulPreviousNotifyValue ) )

◆ xTaskNotifyFromISR

#define xTaskNotifyFromISR (   xTaskToNotify,
  ulValue,
  eAction,
  pxHigherPriorityTaskWoken 
)    xTaskGenericNotifyFromISR( ( xTaskToNotify ), ( ulValue ), ( eAction ), NULL, ( pxHigherPriorityTaskWoken ) )

◆ xTaskNotifyAndQueryFromISR

#define xTaskNotifyAndQueryFromISR (   xTaskToNotify,
  ulValue,
  eAction,
  pulPreviousNotificationValue,
  pxHigherPriorityTaskWoken 
)    xTaskGenericNotifyFromISR( ( xTaskToNotify ), ( ulValue ), ( eAction ), ( pulPreviousNotificationValue ), ( pxHigherPriorityTaskWoken ) )

◆ xTaskNotifyGive

#define xTaskNotifyGive (   xTaskToNotify)    xTaskGenericNotify( ( xTaskToNotify ), ( 0 ), eIncrement, NULL )

Typedef Documentation

◆ TaskHandle_t

typedef void* TaskHandle_t

◆ TaskHookFunction_t

typedef BaseType_t(* TaskHookFunction_t) (void *)

◆ TimeOut_t

typedef struct xTIME_OUT TimeOut_t

◆ MemoryRegion_t

◆ TaskParameters_t

◆ TaskStatus_t

typedef struct xTASK_STATUS TaskStatus_t

Enumeration Type Documentation

◆ eTaskState

enum eTaskState
Enumerator
eRunning 
eReady 
eBlocked 
eSuspended 
eDeleted 
eInvalid 
113 {
114  eRunning = 0, /* A task is querying the state of itself, so must be running. */
115  eReady, /* The task being queried is in a read or pending ready list. */
116  eBlocked, /* The task being queried is in the Blocked state. */
117  eSuspended, /* The task being queried is in the Suspended state, or is in the Blocked state with an infinite time out. */
118  eDeleted, /* The task being queried has been deleted, but its TCB has not yet been freed. */
119  eInvalid /* Used as an 'invalid state' value. */
120 } eTaskState;

◆ eNotifyAction

Enumerator
eNoAction 
eSetBits 
eIncrement 
eSetValueWithOverwrite 
eSetValueWithoutOverwrite 
124 {
125  eNoAction = 0, /* Notify the task without updating its notify value. */
126  eSetBits, /* Set bits in the task's notification value. */
127  eIncrement, /* Increment the task's notification value. */
128  eSetValueWithOverwrite, /* Set the task's notification value to a specific value even if the previous value has not yet been read by the task. */
129  eSetValueWithoutOverwrite /* Set the task's notification value if the previous value has been read by the task. */
130 } eNotifyAction;

◆ eSleepModeStatus

Enumerator
eAbortSleep 
eStandardSleep 
eNoTasksWaitingTimeout 
182 {
183  eAbortSleep = 0, /* A task has been made ready or a context switch pended since portSUPPORESS_TICKS_AND_SLEEP() was called - abort entering a sleep mode. */
184  eStandardSleep, /* Enter a sleep mode that will not last any longer than the expected idle time. */
185  eNoTasksWaitingTimeout /* No tasks are waiting for a timeout so it is safe to enter a sleep mode that can only be exited by an external interrupt. */

Function Documentation

◆ vTaskAllocateMPURegions()

PRIVILEGED_FUNCTION void vTaskAllocateMPURegions ( TaskHandle_t  xTask,
const MemoryRegion_t *const  pxRegions 
)

◆ vTaskDelete()

PRIVILEGED_FUNCTION void vTaskDelete ( TaskHandle_t  xTaskToDelete)
Here is the caller graph for this function:

◆ vTaskDelay()

PRIVILEGED_FUNCTION void vTaskDelay ( const TickType_t  xTicksToDelay)
Here is the caller graph for this function:

◆ vTaskDelayUntil()

PRIVILEGED_FUNCTION void vTaskDelayUntil ( TickType_t *const  pxPreviousWakeTime,
const TickType_t  xTimeIncrement 
)
Here is the caller graph for this function:

◆ xTaskAbortDelay()

PRIVILEGED_FUNCTION BaseType_t xTaskAbortDelay ( TaskHandle_t  xTask)
Here is the caller graph for this function:

◆ uxTaskPriorityGet()

PRIVILEGED_FUNCTION UBaseType_t uxTaskPriorityGet ( TaskHandle_t  xTask)
Here is the caller graph for this function:

◆ uxTaskPriorityGetFromISR()

PRIVILEGED_FUNCTION UBaseType_t uxTaskPriorityGetFromISR ( TaskHandle_t  xTask)

task. h

UBaseType_t uxTaskPriorityGetFromISR( TaskHandle_t xTask );

A version of uxTaskPriorityGet() that can be used from an ISR.

Here is the caller graph for this function:

◆ eTaskGetState()

PRIVILEGED_FUNCTION eTaskState eTaskGetState ( TaskHandle_t  xTask)

task. h

eTaskState eTaskGetState( TaskHandle_t xTask );

INCLUDE_eTaskGetState must be defined as 1 for this function to be available. See the configuration section for more information.

Obtain the state of any task. States are encoded by the eTaskState enumerated type.

Parameters
xTaskHandle of the task to be queried.
Returns
The state of xTask at the time the function was called. Note the state of the task might change between the function being called, and the functions return value being tested by the calling task.

◆ vTaskGetInfo()

PRIVILEGED_FUNCTION void vTaskGetInfo ( TaskHandle_t  xTask,
TaskStatus_t pxTaskStatus,
BaseType_t  xGetFreeStackSpace,
eTaskState  eState 
)

◆ vTaskPrioritySet()

PRIVILEGED_FUNCTION void vTaskPrioritySet ( TaskHandle_t  xTask,
UBaseType_t  uxNewPriority 
)
Here is the caller graph for this function:

◆ vTaskSuspend()

PRIVILEGED_FUNCTION void vTaskSuspend ( TaskHandle_t  xTaskToSuspend)
Here is the caller graph for this function:

◆ vTaskResume()

PRIVILEGED_FUNCTION void vTaskResume ( TaskHandle_t  xTaskToResume)
Here is the caller graph for this function:

◆ xTaskResumeFromISR()

PRIVILEGED_FUNCTION BaseType_t xTaskResumeFromISR ( TaskHandle_t  xTaskToResume)
Here is the caller graph for this function:

◆ vTaskStartScheduler()

PRIVILEGED_FUNCTION 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()

PRIVILEGED_FUNCTION 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()

PRIVILEGED_FUNCTION 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()

PRIVILEGED_FUNCTION 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()

PRIVILEGED_FUNCTION 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()

PRIVILEGED_FUNCTION 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()

PRIVILEGED_FUNCTION 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()

PRIVILEGED_FUNCTION 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 }

◆ xTaskGetHandle()

PRIVILEGED_FUNCTION TaskHandle_t xTaskGetHandle ( const char *  pcNameToQuery)

◆ uxTaskGetStackHighWaterMark()

PRIVILEGED_FUNCTION UBaseType_t uxTaskGetStackHighWaterMark ( TaskHandle_t  xTask)

task.h

UBaseType_t uxTaskGetStackHighWaterMark( TaskHandle_t xTask );

INCLUDE_uxTaskGetStackHighWaterMark must be set to 1 in FreeRTOSConfig.h for this function to be available.

Returns the high water mark of the stack associated with xTask. That is, the minimum free stack space there has been (in words, so on a 32 bit machine a value of 1 means 4 bytes) since the task started. The smaller the returned number the closer the task has come to overflowing its stack.

Parameters
xTaskHandle of the task associated with the stack to be checked. Set xTask to NULL to check the stack of the calling task.
Returns
The smallest amount of free stack space there has been (in words, so actual spaces on the stack rather than bytes) since the task referenced by xTask was created.

◆ xTaskCallApplicationTaskHook()

PRIVILEGED_FUNCTION BaseType_t xTaskCallApplicationTaskHook ( TaskHandle_t  xTask,
void pvParameter 
)

task.h

BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter );

Calls the hook function associated with xTask. Passing xTask as NULL has the effect of calling the Running tasks (the calling task) hook function.

pvParameter is passed to the hook function for the task to interpret as it wants. The return value is the value returned by the task hook function registered by the user.

◆ xTaskGetIdleTaskHandle()

PRIVILEGED_FUNCTION TaskHandle_t xTaskGetIdleTaskHandle ( void  )

xTaskGetIdleTaskHandle() is only available if INCLUDE_xTaskGetIdleTaskHandle is set to 1 in FreeRTOSConfig.h.

Simply returns the handle of the idle task. It is not valid to call xTaskGetIdleTaskHandle() before the scheduler has been started.

◆ uxTaskGetSystemState()

PRIVILEGED_FUNCTION UBaseType_t uxTaskGetSystemState ( TaskStatus_t *const  pxTaskStatusArray,
const UBaseType_t  uxArraySize,
uint32_t *const  pulTotalRunTime 
)

configUSE_TRACE_FACILITY must be defined as 1 in FreeRTOSConfig.h for uxTaskGetSystemState() to be available.

uxTaskGetSystemState() populates an TaskStatus_t structure for each task in the system. TaskStatus_t structures contain, among other things, members for the task handle, task name, task priority, task state, and total amount of run time consumed by the task. See the TaskStatus_t structure definition in this file for the full member list.

NOTE: This function is intended for debugging use only as its use results in the scheduler remaining suspended for an extended period.

Parameters
pxTaskStatusArrayA pointer to an array of TaskStatus_t structures. The array must contain at least one TaskStatus_t structure for each task that is under the control of the RTOS. The number of tasks under the control of the RTOS can be determined using the uxTaskGetNumberOfTasks() API function.
uxArraySizeThe size of the array pointed to by the pxTaskStatusArray parameter. The size is specified as the number of indexes in the array, or the number of TaskStatus_t structures contained in the array, not by the number of bytes in the array.
pulTotalRunTimeIf configGENERATE_RUN_TIME_STATS is set to 1 in FreeRTOSConfig.h then *pulTotalRunTime is set by uxTaskGetSystemState() to the total run time (as defined by the run time stats clock, see http://www.freertos.org/rtos-run-time-stats.html) since the target booted. pulTotalRunTime can be set to NULL to omit the total run time information.
Returns
The number of TaskStatus_t structures that were populated by uxTaskGetSystemState(). This should equal the number returned by the uxTaskGetNumberOfTasks() API function, but will be zero if the value passed in the uxArraySize parameter was too small.

Example usage:

 // This example demonstrates how a human readable table of run time stats
 // information is generated from raw data provided by uxTaskGetSystemState().
 // The human readable table is written to pcWriteBuffer
 void vTaskGetRunTimeStats( char *pcWriteBuffer )
 {
 TaskStatus_t *pxTaskStatusArray;
 volatile UBaseType_t uxArraySize, x;
 uint32_t ulTotalRunTime, ulStatsAsPercentage;
    // Make sure the write buffer does not contain a string.
    *pcWriteBuffer = 0x00;
    // Take a snapshot of the number of tasks in case it changes while this
    // function is executing.
    uxArraySize = uxTaskGetNumberOfTasks();
    // Allocate a TaskStatus_t structure for each task.  An array could be
    // allocated statically at compile time.
    pxTaskStatusArray = pvPortMalloc( uxArraySize * sizeof( TaskStatus_t ) );
    if( pxTaskStatusArray != NULL )
    {
        // Generate raw status information about each task.
        uxArraySize = uxTaskGetSystemState( pxTaskStatusArray, uxArraySize, &ulTotalRunTime );
        // For percentage calculations.
        ulTotalRunTime /= 100UL;
        // Avoid divide by zero errors.
        if( ulTotalRunTime > 0 )
        {
            // For each populated position in the pxTaskStatusArray array,
            // format the raw data as human readable ASCII data
            for( x = 0; x < uxArraySize; x++ )
            {
                // What percentage of the total run time has the task used?
                // This will always be rounded down to the nearest integer.
                // ulTotalRunTimeDiv100 has already been divided by 100.
                ulStatsAsPercentage = pxTaskStatusArray[ x ].ulRunTimeCounter / ulTotalRunTime;
                if( ulStatsAsPercentage > 0UL )
                {
                    sprintf( pcWriteBuffer, "%s\t\t%lu\t\t%lu%%\r\n", pxTaskStatusArray[ x ].pcTaskName, pxTaskStatusArray[ x ].ulRunTimeCounter, ulStatsAsPercentage );
                }
                else
                {
                    // If the percentage is zero here then the task has
                    // consumed less than 1% of the total run time.
                    sprintf( pcWriteBuffer, "%s\t\t%lu\t\t<1%%\r\n", pxTaskStatusArray[ x ].pcTaskName, pxTaskStatusArray[ x ].ulRunTimeCounter );
                }
                pcWriteBuffer += strlen( ( char * ) pcWriteBuffer );
            }
        }
        // The array is no longer needed, free the memory it consumes.
        vPortFree( pxTaskStatusArray );
    }
 }
 

◆ vTaskList()

PRIVILEGED_FUNCTION void vTaskList ( char *  pcWriteBuffer)
Here is the caller graph for this function:

◆ vTaskGetRunTimeStats()

PRIVILEGED_FUNCTION void vTaskGetRunTimeStats ( char *  pcWriteBuffer)

◆ xTaskGenericNotify()

PRIVILEGED_FUNCTION BaseType_t xTaskGenericNotify ( TaskHandle_t  xTaskToNotify,
uint32_t  ulValue,
eNotifyAction  eAction,
uint32_t *  pulPreviousNotificationValue 
)
Here is the caller graph for this function:

◆ xTaskGenericNotifyFromISR()

PRIVILEGED_FUNCTION BaseType_t xTaskGenericNotifyFromISR ( TaskHandle_t  xTaskToNotify,
uint32_t  ulValue,
eNotifyAction  eAction,
uint32_t *  pulPreviousNotificationValue,
BaseType_t pxHigherPriorityTaskWoken 
)
Here is the caller graph for this function:

◆ xTaskNotifyWait()

PRIVILEGED_FUNCTION BaseType_t xTaskNotifyWait ( uint32_t  ulBitsToClearOnEntry,
uint32_t  ulBitsToClearOnExit,
uint32_t *  pulNotificationValue,
TickType_t  xTicksToWait 
)
Here is the caller graph for this function:

◆ vTaskNotifyGiveFromISR()

PRIVILEGED_FUNCTION void vTaskNotifyGiveFromISR ( TaskHandle_t  xTaskToNotify,
BaseType_t pxHigherPriorityTaskWoken 
)

◆ ulTaskNotifyTake()

PRIVILEGED_FUNCTION uint32_t ulTaskNotifyTake ( BaseType_t  xClearCountOnExit,
TickType_t  xTicksToWait 
)

◆ xTaskNotifyStateClear()

BaseType_t xTaskNotifyStateClear ( TaskHandle_t  xTask)

◆ xTaskIncrementTick()

PRIVILEGED_FUNCTION 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:

◆ vTaskPlaceOnEventList()

PRIVILEGED_FUNCTION 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()

PRIVILEGED_FUNCTION 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:

◆ vTaskPlaceOnEventListRestricted()

PRIVILEGED_FUNCTION void vTaskPlaceOnEventListRestricted ( List_t *const  pxEventList,
TickType_t  xTicksToWait,
const BaseType_t  xWaitIndefinitely 
)

◆ xTaskRemoveFromEventList()

PRIVILEGED_FUNCTION 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()

PRIVILEGED_FUNCTION 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:

◆ vTaskSwitchContext()

PRIVILEGED_FUNCTION 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 }

◆ uxTaskResetEventItemValue()

PRIVILEGED_FUNCTION 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:

◆ xTaskGetCurrentTaskHandle()

PRIVILEGED_FUNCTION TaskHandle_t xTaskGetCurrentTaskHandle ( void  )
Here is the caller graph for this function:

◆ vTaskSetTimeOutState()

PRIVILEGED_FUNCTION 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()

PRIVILEGED_FUNCTION 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()

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

◆ xTaskGetSchedulerState()

PRIVILEGED_FUNCTION BaseType_t xTaskGetSchedulerState ( void  )
Here is the caller graph for this function:

◆ vTaskPriorityInherit()

PRIVILEGED_FUNCTION void vTaskPriorityInherit ( TaskHandle_t const  pxMutexHolder)
Here is the caller graph for this function:

◆ xTaskPriorityDisinherit()

PRIVILEGED_FUNCTION BaseType_t xTaskPriorityDisinherit ( TaskHandle_t const  pxMutexHolder)
Here is the caller graph for this function:

◆ uxTaskGetTaskNumber()

PRIVILEGED_FUNCTION UBaseType_t uxTaskGetTaskNumber ( TaskHandle_t  xTask)

◆ vTaskSetTaskNumber()

PRIVILEGED_FUNCTION void vTaskSetTaskNumber ( TaskHandle_t  xTask,
const UBaseType_t  uxHandle 
)

◆ vTaskStepTick()

PRIVILEGED_FUNCTION void vTaskStepTick ( const TickType_t  xTicksToJump)

◆ eTaskConfirmSleepModeStatus()

PRIVILEGED_FUNCTION eSleepModeStatus eTaskConfirmSleepModeStatus ( void  )

◆ pvTaskIncrementMutexHeldCount()

PRIVILEGED_FUNCTION void* pvTaskIncrementMutexHeldCount ( void  )
Here is the caller graph for this function:
eIncrement
Definition: task.h:127
taskYIELD_IF_USING_PREEMPTION
#define taskYIELD_IF_USING_PREEMPTION()
Definition: tasks.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
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
eNotifyAction
eNotifyAction
Definition: task.h:123
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
eTaskState
eTaskState
Definition: task.h:112
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
eNoAction
Definition: task.h:125
portTICK_TYPE_EXIT_CRITICAL
#define portTICK_TYPE_EXIT_CRITICAL()
Definition: FreeRTOS.h:805
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
eInvalid
Definition: task.h:119
eSetBits
Definition: task.h:126
vListInsertEnd
PRIVILEGED_FUNCTION void vListInsertEnd(List_t *const pxList, ListItem_t *const pxNewListItem)
Definition: list.c:116
eRunning
Definition: task.h:114
NULL
#define NULL
Definition: usbd_def.h:53
pdPASS
#define pdPASS
Definition: projdefs.h:89
eDeleted
Definition: task.h:118
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
listGET_LIST_ITEM_VALUE
#define listGET_LIST_ITEM_VALUE(pxListItem)
Definition: list.h:249
eSetValueWithOverwrite
Definition: task.h:128
listSET_LIST_ITEM_VALUE
#define listSET_LIST_ITEM_VALUE(pxListItem, xValue)
Definition: list.h:239
eStandardSleep
Definition: task.h:184
taskENTER_CRITICAL
#define taskENTER_CRITICAL()
Definition: task.h:217
xIdleTaskHandle
static PRIVILEGED_INITIALIZED_DATA TaskHandle_t xIdleTaskHandle
Definition: tasks.c:405
eReady
Definition: task.h:115
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
UBaseType_t
unsigned long UBaseType_t
Definition: portmacro.h:99
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
eAbortSleep
Definition: task.h:183
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
eSleepModeStatus
eSleepModeStatus
Definition: task.h:181
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
eNoTasksWaitingTimeout
Definition: task.h:185
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
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
uxCurrentNumberOfTasks
static PRIVILEGED_INITIALIZED_DATA volatile UBaseType_t uxCurrentNumberOfTasks
Definition: tasks.c:396
eSuspended
Definition: task.h:117
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
xTIME_OUT::xOverflowCount
BaseType_t xOverflowCount
Definition: task.h:137
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
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
eSetValueWithoutOverwrite
Definition: task.h:129
xYieldPending
static PRIVILEGED_INITIALIZED_DATA volatile BaseType_t xYieldPending
Definition: tasks.c:401
tskIDLE_PRIORITY
#define tskIDLE_PRIORITY
Definition: task.h:193
eBlocked
Definition: task.h:116
mtCOVERAGE_TEST_MARKER
#define mtCOVERAGE_TEST_MARKER()
Definition: FreeRTOS.h:748