cantata
task.h
1 /*
2  * FreeRTOS Kernel V10.0.1
3  * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * http://www.FreeRTOS.org
23  * http://aws.amazon.com/freertos
24  *
25  * 1 tab == 4 spaces!
26  */
27 
28 
29 #ifndef INC_TASK_H
30 #define INC_TASK_H
31 
32 #ifndef INC_FREERTOS_H
33  #error "include FreeRTOS.h must appear in source files before include task.h"
34 #endif
35 
36 #include "list.h"
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 /*-----------------------------------------------------------
43  * MACROS AND DEFINITIONS
44  *----------------------------------------------------------*/
45 
46 #define tskKERNEL_VERSION_NUMBER "V10.0.1"
47 #define tskKERNEL_VERSION_MAJOR 10
48 #define tskKERNEL_VERSION_MINOR 0
49 #define tskKERNEL_VERSION_BUILD 1
50 
61 typedef void * TaskHandle_t;
62 
63 /*
64  * Defines the prototype to which the application task hook function must
65  * conform.
66  */
67 typedef BaseType_t (*TaskHookFunction_t)( void * );
68 
69 /* Task states returned by eTaskGetState. */
70 typedef enum
71 {
72  eRunning = 0, /* A task is querying the state of itself, so must be running. */
73  eReady, /* The task being queried is in a read or pending ready list. */
74  eBlocked, /* The task being queried is in the Blocked state. */
75  eSuspended, /* The task being queried is in the Suspended state, or is in the Blocked state with an infinite time out. */
76  eDeleted, /* The task being queried has been deleted, but its TCB has not yet been freed. */
77  eInvalid /* Used as an 'invalid state' value. */
78 } eTaskState;
79 
80 /* Actions that can be performed when vTaskNotify() is called. */
81 typedef enum
82 {
83  eNoAction = 0, /* Notify the task without updating its notify value. */
84  eSetBits, /* Set bits in the task's notification value. */
85  eIncrement, /* Increment the task's notification value. */
86  eSetValueWithOverwrite, /* Set the task's notification value to a specific value even if the previous value has not yet been read by the task. */
87  eSetValueWithoutOverwrite /* Set the task's notification value if the previous value has been read by the task. */
88 } eNotifyAction;
89 
90 /*
91  * Used internally only.
92  */
93 typedef struct xTIME_OUT
94 {
95  BaseType_t xOverflowCount;
96  TickType_t xTimeOnEntering;
97 } TimeOut_t;
98 
99 /*
100  * Defines the memory ranges allocated to the task when an MPU is used.
101  */
102 typedef struct xMEMORY_REGION
103 {
104  void *pvBaseAddress;
105  uint32_t ulLengthInBytes;
106  uint32_t ulParameters;
108 
109 /*
110  * Parameters required to create an MPU protected task.
111  */
112 typedef struct xTASK_PARAMETERS
113 {
114  TaskFunction_t pvTaskCode;
115  const char * const pcName; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
116  uint16_t usStackDepth;
117  void *pvParameters;
118  UBaseType_t uxPriority;
119  StackType_t *puxStackBuffer;
120  MemoryRegion_t xRegions[ portNUM_CONFIGURABLE_REGIONS ];
121  #if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )
122  StaticTask_t * const pxTaskBuffer;
123  #endif
125 
126 /* Used with the uxTaskGetSystemState() function to return the state of each task
127 in the system. */
128 typedef struct xTASK_STATUS
129 {
130  TaskHandle_t xHandle; /* The handle of the task to which the rest of the information in the structure relates. */
131  const char *pcTaskName; /* A pointer to the task's name. This value will be invalid if the task was deleted since the structure was populated! */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
132  UBaseType_t xTaskNumber; /* A number unique to the task. */
133  eTaskState eCurrentState; /* The state in which the task existed when the structure was populated. */
134  UBaseType_t uxCurrentPriority; /* The priority at which the task was running (may be inherited) when the structure was populated. */
135  UBaseType_t uxBasePriority; /* The priority to which the task will return if the task's current priority has been inherited to avoid unbounded priority inversion when obtaining a mutex. Only valid if configUSE_MUTEXES is defined as 1 in FreeRTOSConfig.h. */
136  uint32_t ulRunTimeCounter; /* The total run time allocated to the task so far, as defined by the run time stats clock. See http://www.freertos.org/rtos-run-time-stats.html. Only valid when configGENERATE_RUN_TIME_STATS is defined as 1 in FreeRTOSConfig.h. */
137  StackType_t *pxStackBase; /* Points to the lowest address of the task's stack area. */
138  uint16_t usStackHighWaterMark; /* The minimum amount of stack space that has remained for the task since the task was created. The closer this value is to zero the closer the task has come to overflowing its stack. */
139 } TaskStatus_t;
140 
141 /* Possible return values for eTaskConfirmSleepModeStatus(). */
142 typedef enum
143 {
144  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. */
145  eStandardSleep, /* Enter a sleep mode that will not last any longer than the expected idle time. */
146  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. */
147 } eSleepModeStatus;
148 
154 #define tskIDLE_PRIORITY ( ( UBaseType_t ) 0U )
155 
164 #define taskYIELD() portYIELD()
165 
178 #define taskENTER_CRITICAL() portENTER_CRITICAL()
179 #define taskENTER_CRITICAL_FROM_ISR() portSET_INTERRUPT_MASK_FROM_ISR()
180 
193 #define taskEXIT_CRITICAL() portEXIT_CRITICAL()
194 #define taskEXIT_CRITICAL_FROM_ISR( x ) portCLEAR_INTERRUPT_MASK_FROM_ISR( x )
195 
203 #define taskDISABLE_INTERRUPTS() portDISABLE_INTERRUPTS()
204 
213 #define taskENABLE_INTERRUPTS() portENABLE_INTERRUPTS()
214 
215 /* Definitions returned by xTaskGetSchedulerState(). taskSCHEDULER_SUSPENDED is
216 0 to generate more optimal code when configASSERT() is defined as the constant
217 is used in assert() statements. */
218 #define taskSCHEDULER_SUSPENDED ( ( BaseType_t ) 0 )
219 #define taskSCHEDULER_NOT_STARTED ( ( BaseType_t ) 1 )
220 #define taskSCHEDULER_RUNNING ( ( BaseType_t ) 2 )
221 
222 
223 /*-----------------------------------------------------------
224  * TASK CREATION API
225  *----------------------------------------------------------*/
226 
320 #if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
321  BaseType_t xTaskCreate( TaskFunction_t pxTaskCode,
322  const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
323  const configSTACK_DEPTH_TYPE usStackDepth,
324  void * const pvParameters,
325  UBaseType_t uxPriority,
326  TaskHandle_t * const pxCreatedTask ) PRIVILEGED_FUNCTION;
327 #endif
328 
436 #if( configSUPPORT_STATIC_ALLOCATION == 1 )
437  TaskHandle_t xTaskCreateStatic( TaskFunction_t pxTaskCode,
438  const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
439  const uint32_t ulStackDepth,
440  void * const pvParameters,
441  UBaseType_t uxPriority,
442  StackType_t * const puxStackBuffer,
443  StaticTask_t * const pxTaskBuffer ) PRIVILEGED_FUNCTION;
444 #endif /* configSUPPORT_STATIC_ALLOCATION */
445 
518 #if( portUSING_MPU_WRAPPERS == 1 )
519  BaseType_t xTaskCreateRestricted( const TaskParameters_t * const pxTaskDefinition, TaskHandle_t *pxCreatedTask ) PRIVILEGED_FUNCTION;
520 #endif
521 
606 #if( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )
607  BaseType_t xTaskCreateRestrictedStatic( const TaskParameters_t * const pxTaskDefinition, TaskHandle_t *pxCreatedTask ) PRIVILEGED_FUNCTION;
608 #endif
609 
656 void vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const pxRegions ) PRIVILEGED_FUNCTION;
657 
697 void vTaskDelete( TaskHandle_t xTaskToDelete ) PRIVILEGED_FUNCTION;
698 
699 /*-----------------------------------------------------------
700  * TASK CONTROL API
701  *----------------------------------------------------------*/
702 
749 void vTaskDelay( const TickType_t xTicksToDelay ) PRIVILEGED_FUNCTION;
750 
808 void vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, const TickType_t xTimeIncrement ) PRIVILEGED_FUNCTION;
809 
833 BaseType_t xTaskAbortDelay( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
834 
880 UBaseType_t uxTaskPriorityGet( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
881 
888 UBaseType_t uxTaskPriorityGetFromISR( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
889 
906 eTaskState eTaskGetState( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
907 
962 void vTaskGetInfo( TaskHandle_t xTask, TaskStatus_t *pxTaskStatus, BaseType_t xGetFreeStackSpace, eTaskState eState ) PRIVILEGED_FUNCTION;
963 
1004 void vTaskPrioritySet( TaskHandle_t xTask, UBaseType_t uxNewPriority ) PRIVILEGED_FUNCTION;
1005 
1055 void vTaskSuspend( TaskHandle_t xTaskToSuspend ) PRIVILEGED_FUNCTION;
1056 
1104 void vTaskResume( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION;
1105 
1133 BaseType_t xTaskResumeFromISR( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION;
1134 
1135 /*-----------------------------------------------------------
1136  * SCHEDULER CONTROL
1137  *----------------------------------------------------------*/
1138 
1166 void vTaskStartScheduler( void ) PRIVILEGED_FUNCTION;
1167 
1222 void vTaskEndScheduler( void ) PRIVILEGED_FUNCTION;
1223 
1273 void vTaskSuspendAll( void ) PRIVILEGED_FUNCTION;
1274 
1327 BaseType_t xTaskResumeAll( void ) PRIVILEGED_FUNCTION;
1328 
1329 /*-----------------------------------------------------------
1330  * TASK UTILITIES
1331  *----------------------------------------------------------*/
1332 
1342 TickType_t xTaskGetTickCount( void ) PRIVILEGED_FUNCTION;
1343 
1358 TickType_t xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION;
1359 
1372 UBaseType_t uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION;
1373 
1385 char *pcTaskGetName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
1386 
1401 TaskHandle_t xTaskGetHandle( const char *pcNameToQuery ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
1402 
1422 UBaseType_t uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
1423 
1424 /* When using trace macros it is sometimes necessary to include task.h before
1425 FreeRTOS.h. When this is done TaskHookFunction_t will not yet have been defined,
1426 so the following two prototypes will cause a compilation error. This can be
1427 fixed by simply guarding against the inclusion of these two prototypes unless
1428 they are explicitly required by the configUSE_APPLICATION_TASK_TAG configuration
1429 constant. */
1430 #ifdef configUSE_APPLICATION_TASK_TAG
1431  #if configUSE_APPLICATION_TASK_TAG == 1
1432 
1440  void vTaskSetApplicationTaskTag( TaskHandle_t xTask, TaskHookFunction_t pxHookFunction ) PRIVILEGED_FUNCTION;
1441 
1448  TaskHookFunction_t xTaskGetApplicationTaskTag( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
1449  #endif /* configUSE_APPLICATION_TASK_TAG ==1 */
1450 #endif /* ifdef configUSE_APPLICATION_TASK_TAG */
1451 
1452 #if( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
1453 
1454  /* Each task contains an array of pointers that is dimensioned by the
1455  configNUM_THREAD_LOCAL_STORAGE_POINTERS setting in FreeRTOSConfig.h. The
1456  kernel does not use the pointers itself, so the application writer can use
1457  the pointers for any purpose they wish. The following two functions are
1458  used to set and query a pointer respectively. */
1459  void vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet, BaseType_t xIndex, void *pvValue ) PRIVILEGED_FUNCTION;
1460  void *pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery, BaseType_t xIndex ) PRIVILEGED_FUNCTION;
1461 
1462 #endif
1463 
1475 BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter ) PRIVILEGED_FUNCTION;
1476 
1484 TaskHandle_t xTaskGetIdleTaskHandle( void ) PRIVILEGED_FUNCTION;
1485 
1583 UBaseType_t uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray, const UBaseType_t uxArraySize, uint32_t * const pulTotalRunTime ) PRIVILEGED_FUNCTION;
1584 
1630 void vTaskList( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
1631 
1684 void vTaskGetRunTimeStats( char *pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
1685 
1765 BaseType_t xTaskGenericNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue ) PRIVILEGED_FUNCTION;
1766 #define xTaskNotify( xTaskToNotify, ulValue, eAction ) xTaskGenericNotify( ( xTaskToNotify ), ( ulValue ), ( eAction ), NULL )
1767 #define xTaskNotifyAndQuery( xTaskToNotify, ulValue, eAction, pulPreviousNotifyValue ) xTaskGenericNotify( ( xTaskToNotify ), ( ulValue ), ( eAction ), ( pulPreviousNotifyValue ) )
1768 
1856 BaseType_t xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue, BaseType_t *pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
1857 #define xTaskNotifyFromISR( xTaskToNotify, ulValue, eAction, pxHigherPriorityTaskWoken ) xTaskGenericNotifyFromISR( ( xTaskToNotify ), ( ulValue ), ( eAction ), NULL, ( pxHigherPriorityTaskWoken ) )
1858 #define xTaskNotifyAndQueryFromISR( xTaskToNotify, ulValue, eAction, pulPreviousNotificationValue, pxHigherPriorityTaskWoken ) xTaskGenericNotifyFromISR( ( xTaskToNotify ), ( ulValue ), ( eAction ), ( pulPreviousNotificationValue ), ( pxHigherPriorityTaskWoken ) )
1859 
1933 BaseType_t xTaskNotifyWait( uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
1934 
1979 #define xTaskNotifyGive( xTaskToNotify ) xTaskGenericNotify( ( xTaskToNotify ), ( 0 ), eIncrement, NULL )
1980 
2034 void vTaskNotifyGiveFromISR( TaskHandle_t xTaskToNotify, BaseType_t *pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
2035 
2103 uint32_t ulTaskNotifyTake( BaseType_t xClearCountOnExit, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
2104 
2119 BaseType_t xTaskNotifyStateClear( TaskHandle_t xTask );
2120 
2121 /*-----------------------------------------------------------
2122  * SCHEDULER INTERNALS AVAILABLE FOR PORTING PURPOSES
2123  *----------------------------------------------------------*/
2124 
2125 /*
2126  * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS ONLY
2127  * INTENDED FOR USE WHEN IMPLEMENTING A PORT OF THE SCHEDULER AND IS
2128  * AN INTERFACE WHICH IS FOR THE EXCLUSIVE USE OF THE SCHEDULER.
2129  *
2130  * Called from the real time kernel tick (either preemptive or cooperative),
2131  * this increments the tick count and checks if any tasks that are blocked
2132  * for a finite period required removing from a blocked list and placing on
2133  * a ready list. If a non-zero value is returned then a context switch is
2134  * required because either:
2135  * + A task was removed from a blocked list because its timeout had expired,
2136  * or
2137  * + Time slicing is in use and there is a task of equal priority to the
2138  * currently running task.
2139  */
2140 BaseType_t xTaskIncrementTick( void ) PRIVILEGED_FUNCTION;
2141 
2142 /*
2143  * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS AN
2144  * INTERFACE WHICH IS FOR THE EXCLUSIVE USE OF THE SCHEDULER.
2145  *
2146  * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED.
2147  *
2148  * Removes the calling task from the ready list and places it both
2149  * on the list of tasks waiting for a particular event, and the
2150  * list of delayed tasks. The task will be removed from both lists
2151  * and replaced on the ready list should either the event occur (and
2152  * there be no higher priority tasks waiting on the same event) or
2153  * the delay period expires.
2154  *
2155  * The 'unordered' version replaces the event list item value with the
2156  * xItemValue value, and inserts the list item at the end of the list.
2157  *
2158  * The 'ordered' version uses the existing event list item value (which is the
2159  * owning tasks priority) to insert the list item into the event list is task
2160  * priority order.
2161  *
2162  * @param pxEventList The list containing tasks that are blocked waiting
2163  * for the event to occur.
2164  *
2165  * @param xItemValue The item value to use for the event list item when the
2166  * event list is not ordered by task priority.
2167  *
2168  * @param xTicksToWait The maximum amount of time that the task should wait
2169  * for the event to occur. This is specified in kernel ticks,the constant
2170  * portTICK_PERIOD_MS can be used to convert kernel ticks into a real time
2171  * period.
2172  */
2173 void vTaskPlaceOnEventList( List_t * const pxEventList, const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
2174 void vTaskPlaceOnUnorderedEventList( List_t * pxEventList, const TickType_t xItemValue, const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
2175 
2176 /*
2177  * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS AN
2178  * INTERFACE WHICH IS FOR THE EXCLUSIVE USE OF THE SCHEDULER.
2179  *
2180  * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED.
2181  *
2182  * This function performs nearly the same function as vTaskPlaceOnEventList().
2183  * The difference being that this function does not permit tasks to block
2184  * indefinitely, whereas vTaskPlaceOnEventList() does.
2185  *
2186  */
2187 void vTaskPlaceOnEventListRestricted( List_t * const pxEventList, TickType_t xTicksToWait, const BaseType_t xWaitIndefinitely ) PRIVILEGED_FUNCTION;
2188 
2189 /*
2190  * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS AN
2191  * INTERFACE WHICH IS FOR THE EXCLUSIVE USE OF THE SCHEDULER.
2192  *
2193  * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED.
2194  *
2195  * Removes a task from both the specified event list and the list of blocked
2196  * tasks, and places it on a ready queue.
2197  *
2198  * xTaskRemoveFromEventList()/vTaskRemoveFromUnorderedEventList() will be called
2199  * if either an event occurs to unblock a task, or the block timeout period
2200  * expires.
2201  *
2202  * xTaskRemoveFromEventList() is used when the event list is in task priority
2203  * order. It removes the list item from the head of the event list as that will
2204  * have the highest priority owning task of all the tasks on the event list.
2205  * vTaskRemoveFromUnorderedEventList() is used when the event list is not
2206  * ordered and the event list items hold something other than the owning tasks
2207  * priority. In this case the event list item value is updated to the value
2208  * passed in the xItemValue parameter.
2209  *
2210  * @return pdTRUE if the task being removed has a higher priority than the task
2211  * making the call, otherwise pdFALSE.
2212  */
2213 BaseType_t xTaskRemoveFromEventList( const List_t * const pxEventList ) PRIVILEGED_FUNCTION;
2214 void vTaskRemoveFromUnorderedEventList( ListItem_t * pxEventListItem, const TickType_t xItemValue ) PRIVILEGED_FUNCTION;
2215 
2216 /*
2217  * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS ONLY
2218  * INTENDED FOR USE WHEN IMPLEMENTING A PORT OF THE SCHEDULER AND IS
2219  * AN INTERFACE WHICH IS FOR THE EXCLUSIVE USE OF THE SCHEDULER.
2220  *
2221  * Sets the pointer to the current TCB to the TCB of the highest priority task
2222  * that is ready to run.
2223  */
2224 void vTaskSwitchContext( void ) PRIVILEGED_FUNCTION;
2225 
2226 /*
2227  * THESE FUNCTIONS MUST NOT BE USED FROM APPLICATION CODE. THEY ARE USED BY
2228  * THE EVENT BITS MODULE.
2229  */
2230 TickType_t uxTaskResetEventItemValue( void ) PRIVILEGED_FUNCTION;
2231 
2232 /*
2233  * Return the handle of the calling task.
2234  */
2235 TaskHandle_t xTaskGetCurrentTaskHandle( void ) PRIVILEGED_FUNCTION;
2236 
2237 /*
2238  * Capture the current time status for future reference.
2239  */
2240 void vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) PRIVILEGED_FUNCTION;
2241 
2242 /*
2243  * Compare the time status now with that previously captured to see if the
2244  * timeout has expired.
2245  */
2246 BaseType_t xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, TickType_t * const pxTicksToWait ) PRIVILEGED_FUNCTION;
2247 
2248 /*
2249  * Shortcut used by the queue implementation to prevent unnecessary call to
2250  * taskYIELD();
2251  */
2252 void vTaskMissedYield( void ) PRIVILEGED_FUNCTION;
2253 
2254 /*
2255  * Returns the scheduler state as taskSCHEDULER_RUNNING,
2256  * taskSCHEDULER_NOT_STARTED or taskSCHEDULER_SUSPENDED.
2257  */
2258 BaseType_t xTaskGetSchedulerState( void ) PRIVILEGED_FUNCTION;
2259 
2260 /*
2261  * Raises the priority of the mutex holder to that of the calling task should
2262  * the mutex holder have a priority less than the calling task.
2263  */
2264 BaseType_t xTaskPriorityInherit( TaskHandle_t const pxMutexHolder ) PRIVILEGED_FUNCTION;
2265 
2266 /*
2267  * Set the priority of a task back to its proper priority in the case that it
2268  * inherited a higher priority while it was holding a semaphore.
2269  */
2270 BaseType_t xTaskPriorityDisinherit( TaskHandle_t const pxMutexHolder ) PRIVILEGED_FUNCTION;
2271 
2272 /*
2273  * If a higher priority task attempting to obtain a mutex caused a lower
2274  * priority task to inherit the higher priority task's priority - but the higher
2275  * priority task then timed out without obtaining the mutex, then the lower
2276  * priority task will disinherit the priority again - but only down as far as
2277  * the highest priority task that is still waiting for the mutex (if there were
2278  * more than one task waiting for the mutex).
2279  */
2280 void vTaskPriorityDisinheritAfterTimeout( TaskHandle_t const pxMutexHolder, UBaseType_t uxHighestPriorityWaitingTask ) PRIVILEGED_FUNCTION;
2281 
2282 /*
2283  * Get the uxTCBNumber assigned to the task referenced by the xTask parameter.
2284  */
2285 UBaseType_t uxTaskGetTaskNumber( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
2286 
2287 /*
2288  * Set the uxTaskNumber of the task referenced by the xTask parameter to
2289  * uxHandle.
2290  */
2291 void vTaskSetTaskNumber( TaskHandle_t xTask, const UBaseType_t uxHandle ) PRIVILEGED_FUNCTION;
2292 
2293 /*
2294  * Only available when configUSE_TICKLESS_IDLE is set to 1.
2295  * If tickless mode is being used, or a low power mode is implemented, then
2296  * the tick interrupt will not execute during idle periods. When this is the
2297  * case, the tick count value maintained by the scheduler needs to be kept up
2298  * to date with the actual execution time by being skipped forward by a time
2299  * equal to the idle period.
2300  */
2301 void vTaskStepTick( const TickType_t xTicksToJump ) PRIVILEGED_FUNCTION;
2302 
2303 /*
2304  * Only avilable when configUSE_TICKLESS_IDLE is set to 1.
2305  * Provided for use within portSUPPRESS_TICKS_AND_SLEEP() to allow the port
2306  * specific sleep function to determine if it is ok to proceed with the sleep,
2307  * and if it is ok to proceed, if it is ok to sleep indefinitely.
2308  *
2309  * This function is necessary because portSUPPRESS_TICKS_AND_SLEEP() is only
2310  * called with the scheduler suspended, not from within a critical section. It
2311  * is therefore possible for an interrupt to request a context switch between
2312  * portSUPPRESS_TICKS_AND_SLEEP() and the low power mode actually being
2313  * entered. eTaskConfirmSleepModeStatus() should be called from a short
2314  * critical section between the timer being stopped and the sleep mode being
2315  * entered to ensure it is ok to proceed into the sleep mode.
2316  */
2317 eSleepModeStatus eTaskConfirmSleepModeStatus( void ) PRIVILEGED_FUNCTION;
2318 
2319 /*
2320  * For internal use only. Increment the mutex held count when a mutex is
2321  * taken and return the handle of the task that has taken the mutex.
2322  */
2323 void *pvTaskIncrementMutexHeldCount( void ) PRIVILEGED_FUNCTION;
2324 
2325 /*
2326  * For internal use only. Same as vTaskSetTimeOutState(), but without a critial
2327  * section.
2328  */
2329 void vTaskInternalSetTimeOutState( TimeOut_t * const pxTimeOut ) PRIVILEGED_FUNCTION;
2330 
2331 
2332 #ifdef __cplusplus
2333 }
2334 #endif
2335 #endif /* INC_TASK_H */
2336 
2337 
2338 
Definition: list.h:139
Definition: list.h:163
Definition: task.h:128
Definition: task.h:93
Definition: FreeRTOS.h:984
Definition: task.h:102
Definition: task.h:112