2 FreeRTOS V7.3.0 - Copyright (C) 2012 Real Time Engineers Ltd.
\r
5 ***************************************************************************
\r
7 * FreeRTOS tutorial books are available in pdf and paperback. *
\r
8 * Complete, revised, and edited pdf reference manuals are also *
\r
11 * Purchasing FreeRTOS documentation will not only help you, by *
\r
12 * ensuring you get running as quickly as possible and with an *
\r
13 * in-depth knowledge of how to use FreeRTOS, it will also help *
\r
14 * the FreeRTOS project to continue with its mission of providing *
\r
15 * professional grade, cross platform, de facto standard solutions *
\r
16 * for microcontrollers - completely free of charge! *
\r
18 * >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
\r
20 * Thank you for using FreeRTOS, and thank you for your support! *
\r
22 ***************************************************************************
\r
25 This file is part of the FreeRTOS distribution.
\r
27 FreeRTOS is free software; you can redistribute it and/or modify it under
\r
28 the terms of the GNU General Public License (version 2) as published by the
\r
29 Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
\r
30 >>>NOTE<<< The modification to the GPL is included to allow you to
\r
31 distribute a combined work that includes FreeRTOS without being obliged to
\r
32 provide the source code for proprietary components outside of the FreeRTOS
\r
33 kernel. FreeRTOS is distributed in the hope that it will be useful, but
\r
34 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
\r
35 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
\r
36 more details. You should have received a copy of the GNU General Public
\r
37 License and the FreeRTOS license exception along with FreeRTOS; if not it
\r
38 can be viewed here: http://www.freertos.org/a00114.html and also obtained
\r
39 by writing to Richard Barry, contact details for whom are available on the
\r
45 ***************************************************************************
\r
47 * Having a problem? Start by reading the FAQ "My application does *
\r
48 * not run, what could be wrong? *
\r
50 * http://www.FreeRTOS.org/FAQHelp.html *
\r
52 ***************************************************************************
\r
55 http://www.FreeRTOS.org - Documentation, training, latest information,
\r
56 license and contact details.
\r
58 http://www.FreeRTOS.org/plus - Selection of FreeRTOS ecosystem products,
\r
59 including FreeRTOS+Trace - an indispensable productivity tool.
\r
61 Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell
\r
62 the code with commercial support, indemnification, and middleware, under
\r
63 the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also
\r
64 provide a safety engineered and independently SIL3 certified version under
\r
65 the SafeRTOS brand: http://www.SafeRTOS.com.
\r
72 #ifndef INC_FREERTOS_H
\r
73 #error "include FreeRTOS.h must appear in source files before include task.h"
\r
76 #include "portable.h"
\r
83 /*-----------------------------------------------------------
\r
84 * MACROS AND DEFINITIONS
\r
85 *----------------------------------------------------------*/
\r
87 #define tskKERNEL_VERSION_NUMBER "V7.3.0"
\r
92 * Type by which tasks are referenced. For example, a call to xTaskCreate
\r
93 * returns (via a pointer parameter) an xTaskHandle variable that can then
\r
94 * be used as a parameter to vTaskDelete to delete the task.
\r
96 * \page xTaskHandle xTaskHandle
\r
99 typedef void * xTaskHandle;
\r
102 * Used internally only.
\r
104 typedef struct xTIME_OUT
\r
106 portBASE_TYPE xOverflowCount;
\r
107 portTickType xTimeOnEntering;
\r
111 * Defines the memory ranges allocated to the task when an MPU is used.
\r
113 typedef struct xMEMORY_REGION
\r
115 void *pvBaseAddress;
\r
116 unsigned long ulLengthInBytes;
\r
117 unsigned long ulParameters;
\r
121 * Parameters required to create an MPU protected task.
\r
123 typedef struct xTASK_PARAMTERS
\r
125 pdTASK_CODE pvTaskCode;
\r
126 const signed char * const pcName;
\r
127 unsigned short usStackDepth;
\r
128 void *pvParameters;
\r
129 unsigned portBASE_TYPE uxPriority;
\r
130 portSTACK_TYPE *puxStackBuffer;
\r
131 xMemoryRegion xRegions[ portNUM_CONFIGURABLE_REGIONS ];
\r
134 /* Task states returned by eTaskGetState. */
\r
137 eRunning = 0, /* A task is querying the state of itself, so must be running. */
\r
138 eReady, /* The task being queried is in a read or pending ready list. */
\r
139 eBlocked, /* The task being queried is in the Blocked state. */
\r
140 eSuspended, /* The task being queried is in the Suspended state, or is in the Blocked state with an infinite time out. */
\r
141 eDeleted /* The task being queried has been deleted, but its TCB has not yet been freed. */
\r
145 * Defines the priority used by the idle task. This must not be modified.
\r
147 * \ingroup TaskUtils
\r
149 #define tskIDLE_PRIORITY ( ( unsigned portBASE_TYPE ) 0U )
\r
154 * Macro for forcing a context switch.
\r
156 * \page taskYIELD taskYIELD
\r
157 * \ingroup SchedulerControl
\r
159 #define taskYIELD() portYIELD()
\r
164 * Macro to mark the start of a critical code region. Preemptive context
\r
165 * switches cannot occur when in a critical region.
\r
167 * NOTE: This may alter the stack (depending on the portable implementation)
\r
168 * so must be used with care!
\r
170 * \page taskENTER_CRITICAL taskENTER_CRITICAL
\r
171 * \ingroup SchedulerControl
\r
173 #define taskENTER_CRITICAL() portENTER_CRITICAL()
\r
178 * Macro to mark the end of a critical code region. Preemptive context
\r
179 * switches cannot occur when in a critical region.
\r
181 * NOTE: This may alter the stack (depending on the portable implementation)
\r
182 * so must be used with care!
\r
184 * \page taskEXIT_CRITICAL taskEXIT_CRITICAL
\r
185 * \ingroup SchedulerControl
\r
187 #define taskEXIT_CRITICAL() portEXIT_CRITICAL()
\r
192 * Macro to disable all maskable interrupts.
\r
194 * \page taskDISABLE_INTERRUPTS taskDISABLE_INTERRUPTS
\r
195 * \ingroup SchedulerControl
\r
197 #define taskDISABLE_INTERRUPTS() portDISABLE_INTERRUPTS()
\r
202 * Macro to enable microcontroller interrupts.
\r
204 * \page taskENABLE_INTERRUPTS taskENABLE_INTERRUPTS
\r
205 * \ingroup SchedulerControl
\r
207 #define taskENABLE_INTERRUPTS() portENABLE_INTERRUPTS()
\r
209 /* Definitions returned by xTaskGetSchedulerState(). */
\r
210 #define taskSCHEDULER_NOT_STARTED 0
\r
211 #define taskSCHEDULER_RUNNING 1
\r
212 #define taskSCHEDULER_SUSPENDED 2
\r
214 /*-----------------------------------------------------------
\r
215 * TASK CREATION API
\r
216 *----------------------------------------------------------*/
\r
221 portBASE_TYPE xTaskCreate(
\r
222 pdTASK_CODE pvTaskCode,
\r
223 const char * const pcName,
\r
224 unsigned short usStackDepth,
\r
225 void *pvParameters,
\r
226 unsigned portBASE_TYPE uxPriority,
\r
227 xTaskHandle *pvCreatedTask
\r
230 * Create a new task and add it to the list of tasks that are ready to run.
\r
232 * xTaskCreate() can only be used to create a task that has unrestricted
\r
233 * access to the entire microcontroller memory map. Systems that include MPU
\r
234 * support can alternatively create an MPU constrained task using
\r
235 * xTaskCreateRestricted().
\r
237 * @param pvTaskCode Pointer to the task entry function. Tasks
\r
238 * must be implemented to never return (i.e. continuous loop).
\r
240 * @param pcName A descriptive name for the task. This is mainly used to
\r
241 * facilitate debugging. Max length defined by tskMAX_TASK_NAME_LEN - default
\r
244 * @param usStackDepth The size of the task stack specified as the number of
\r
245 * variables the stack can hold - not the number of bytes. For example, if
\r
246 * the stack is 16 bits wide and usStackDepth is defined as 100, 200 bytes
\r
247 * will be allocated for stack storage.
\r
249 * @param pvParameters Pointer that will be used as the parameter for the task
\r
252 * @param uxPriority The priority at which the task should run. Systems that
\r
253 * include MPU support can optionally create tasks in a privileged (system)
\r
254 * mode by setting bit portPRIVILEGE_BIT of the priority parameter. For
\r
255 * example, to create a privileged task at priority 2 the uxPriority parameter
\r
256 * should be set to ( 2 | portPRIVILEGE_BIT ).
\r
258 * @param pvCreatedTask Used to pass back a handle by which the created task
\r
259 * can be referenced.
\r
261 * @return pdPASS if the task was successfully created and added to a ready
\r
262 * list, otherwise an error code defined in the file errors. h
\r
266 // Task to be created.
\r
267 void vTaskCode( void * pvParameters )
\r
271 // Task code goes here.
\r
275 // Function that creates a task.
\r
276 void vOtherFunction( void )
\r
278 static unsigned char ucParameterToPass;
\r
279 xTaskHandle xHandle;
\r
281 // Create the task, storing the handle. Note that the passed parameter ucParameterToPass
\r
282 // must exist for the lifetime of the task, so in this case is declared static. If it was just an
\r
283 // an automatic stack variable it might no longer exist, or at least have been corrupted, by the time
\r
284 // the new task attempts to access it.
\r
285 xTaskCreate( vTaskCode, "NAME", STACK_SIZE, &ucParameterToPass, tskIDLE_PRIORITY, &xHandle );
\r
287 // Use the handle to delete the task.
\r
288 vTaskDelete( xHandle );
\r
291 * \defgroup xTaskCreate xTaskCreate
\r
294 #define xTaskCreate( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask ) xTaskGenericCreate( ( pvTaskCode ), ( pcName ), ( usStackDepth ), ( pvParameters ), ( uxPriority ), ( pxCreatedTask ), ( NULL ), ( NULL ) )
\r
299 portBASE_TYPE xTaskCreateRestricted( xTaskParameters *pxTaskDefinition, xTaskHandle *pxCreatedTask );</pre>
\r
301 * xTaskCreateRestricted() should only be used in systems that include an MPU
\r
304 * Create a new task and add it to the list of tasks that are ready to run.
\r
305 * The function parameters define the memory regions and associated access
\r
306 * permissions allocated to the task.
\r
308 * @param pxTaskDefinition Pointer to a structure that contains a member
\r
309 * for each of the normal xTaskCreate() parameters (see the xTaskCreate() API
\r
310 * documentation) plus an optional stack buffer and the memory region
\r
313 * @param pxCreatedTask Used to pass back a handle by which the created task
\r
314 * can be referenced.
\r
316 * @return pdPASS if the task was successfully created and added to a ready
\r
317 * list, otherwise an error code defined in the file errors. h
\r
321 // Create an xTaskParameters structure that defines the task to be created.
\r
322 static const xTaskParameters xCheckTaskParameters =
\r
324 vATask, // pvTaskCode - the function that implements the task.
\r
325 "ATask", // pcName - just a text name for the task to assist debugging.
\r
326 100, // usStackDepth - the stack size DEFINED IN WORDS.
\r
327 NULL, // pvParameters - passed into the task function as the function parameters.
\r
328 ( 1UL | portPRIVILEGE_BIT ),// uxPriority - task priority, set the portPRIVILEGE_BIT if the task should run in a privileged state.
\r
329 cStackBuffer,// puxStackBuffer - the buffer to be used as the task stack.
\r
331 // xRegions - Allocate up to three separate memory regions for access by
\r
332 // the task, with appropriate access permissions. Different processors have
\r
333 // different memory alignment requirements - refer to the FreeRTOS documentation
\r
334 // for full information.
\r
336 // Base address Length Parameters
\r
337 { cReadWriteArray, 32, portMPU_REGION_READ_WRITE },
\r
338 { cReadOnlyArray, 32, portMPU_REGION_READ_ONLY },
\r
339 { cPrivilegedOnlyAccessArray, 128, portMPU_REGION_PRIVILEGED_READ_WRITE }
\r
345 xTaskHandle xHandle;
\r
347 // Create a task from the const structure defined above. The task handle
\r
348 // is requested (the second parameter is not NULL) but in this case just for
\r
349 // demonstration purposes as its not actually used.
\r
350 xTaskCreateRestricted( &xRegTest1Parameters, &xHandle );
\r
352 // Start the scheduler.
\r
353 vTaskStartScheduler();
\r
355 // Will only get here if there was insufficient memory to create the idle
\r
360 * \defgroup xTaskCreateRestricted xTaskCreateRestricted
\r
363 #define xTaskCreateRestricted( x, pxCreatedTask ) xTaskGenericCreate( ((x)->pvTaskCode), ((x)->pcName), ((x)->usStackDepth), ((x)->pvParameters), ((x)->uxPriority), (pxCreatedTask), ((x)->puxStackBuffer), ((x)->xRegions) )
\r
368 void vTaskAllocateMPURegions( xTaskHandle xTask, const xMemoryRegion * const pxRegions );</pre>
\r
370 * Memory regions are assigned to a restricted task when the task is created by
\r
371 * a call to xTaskCreateRestricted(). These regions can be redefined using
\r
372 * vTaskAllocateMPURegions().
\r
374 * @param xTask The handle of the task being updated.
\r
376 * @param xRegions A pointer to an xMemoryRegion structure that contains the
\r
377 * new memory region definitions.
\r
381 // Define an array of xMemoryRegion structures that configures an MPU region
\r
382 // allowing read/write access for 1024 bytes starting at the beginning of the
\r
383 // ucOneKByte array. The other two of the maximum 3 definable regions are
\r
384 // unused so set to zero.
\r
385 static const xMemoryRegion xAltRegions[ portNUM_CONFIGURABLE_REGIONS ] =
\r
387 // Base address Length Parameters
\r
388 { ucOneKByte, 1024, portMPU_REGION_READ_WRITE },
\r
393 void vATask( void *pvParameters )
\r
395 // This task was created such that it has access to certain regions of
\r
396 // memory as defined by the MPU configuration. At some point it is
\r
397 // desired that these MPU regions are replaced with that defined in the
\r
398 // xAltRegions const struct above. Use a call to vTaskAllocateMPURegions()
\r
399 // for this purpose. NULL is used as the task handle to indicate that this
\r
400 // function should modify the MPU regions of the calling task.
\r
401 vTaskAllocateMPURegions( NULL, xAltRegions );
\r
403 // Now the task can continue its function, but from this point on can only
\r
404 // access its stack and the ucOneKByte array (unless any other statically
\r
405 // defined or shared regions have been declared elsewhere).
\r
408 * \defgroup xTaskCreateRestricted xTaskCreateRestricted
\r
411 void vTaskAllocateMPURegions( xTaskHandle xTask, const xMemoryRegion * const pxRegions ) PRIVILEGED_FUNCTION;
\r
415 * <pre>void vTaskDelete( xTaskHandle pxTask );</pre>
\r
417 * INCLUDE_vTaskDelete must be defined as 1 for this function to be available.
\r
418 * See the configuration section for more information.
\r
420 * Remove a task from the RTOS real time kernels management. The task being
\r
421 * deleted will be removed from all ready, blocked, suspended and event lists.
\r
423 * NOTE: The idle task is responsible for freeing the kernel allocated
\r
424 * memory from tasks that have been deleted. It is therefore important that
\r
425 * the idle task is not starved of microcontroller processing time if your
\r
426 * application makes any calls to vTaskDelete (). Memory allocated by the
\r
427 * task code is not automatically freed, and should be freed before the task
\r
430 * See the demo application file death.c for sample code that utilises
\r
433 * @param pxTask The handle of the task to be deleted. Passing NULL will
\r
434 * cause the calling task to be deleted.
\r
438 void vOtherFunction( void )
\r
440 xTaskHandle xHandle;
\r
442 // Create the task, storing the handle.
\r
443 xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );
\r
445 // Use the handle to delete the task.
\r
446 vTaskDelete( xHandle );
\r
449 * \defgroup vTaskDelete vTaskDelete
\r
452 void vTaskDelete( xTaskHandle pxTaskToDelete ) PRIVILEGED_FUNCTION;
\r
454 /*-----------------------------------------------------------
\r
456 *----------------------------------------------------------*/
\r
460 * <pre>void vTaskDelay( portTickType xTicksToDelay );</pre>
\r
462 * Delay a task for a given number of ticks. The actual time that the
\r
463 * task remains blocked depends on the tick rate. The constant
\r
464 * portTICK_RATE_MS can be used to calculate real time from the tick
\r
465 * rate - with the resolution of one tick period.
\r
467 * INCLUDE_vTaskDelay must be defined as 1 for this function to be available.
\r
468 * See the configuration section for more information.
\r
471 * vTaskDelay() specifies a time at which the task wishes to unblock relative to
\r
472 * the time at which vTaskDelay() is called. For example, specifying a block
\r
473 * period of 100 ticks will cause the task to unblock 100 ticks after
\r
474 * vTaskDelay() is called. vTaskDelay() does not therefore provide a good method
\r
475 * of controlling the frequency of a cyclical task as the path taken through the
\r
476 * code, as well as other task and interrupt activity, will effect the frequency
\r
477 * at which vTaskDelay() gets called and therefore the time at which the task
\r
478 * next executes. See vTaskDelayUntil() for an alternative API function designed
\r
479 * to facilitate fixed frequency execution. It does this by specifying an
\r
480 * absolute time (rather than a relative time) at which the calling task should
\r
483 * @param xTicksToDelay The amount of time, in tick periods, that
\r
484 * the calling task should block.
\r
488 void vTaskFunction( void * pvParameters )
\r
490 void vTaskFunction( void * pvParameters )
\r
492 // Block for 500ms.
\r
493 const portTickType xDelay = 500 / portTICK_RATE_MS;
\r
497 // Simply toggle the LED every 500ms, blocking between each toggle.
\r
499 vTaskDelay( xDelay );
\r
503 * \defgroup vTaskDelay vTaskDelay
\r
504 * \ingroup TaskCtrl
\r
506 void vTaskDelay( portTickType xTicksToDelay ) PRIVILEGED_FUNCTION;
\r
510 * <pre>void vTaskDelayUntil( portTickType *pxPreviousWakeTime, portTickType xTimeIncrement );</pre>
\r
512 * INCLUDE_vTaskDelayUntil must be defined as 1 for this function to be available.
\r
513 * See the configuration section for more information.
\r
515 * Delay a task until a specified time. This function can be used by cyclical
\r
516 * tasks to ensure a constant execution frequency.
\r
518 * This function differs from vTaskDelay () in one important aspect: vTaskDelay () will
\r
519 * cause a task to block for the specified number of ticks from the time vTaskDelay () is
\r
520 * called. It is therefore difficult to use vTaskDelay () by itself to generate a fixed
\r
521 * execution frequency as the time between a task starting to execute and that task
\r
522 * calling vTaskDelay () may not be fixed [the task may take a different path though the
\r
523 * code between calls, or may get interrupted or preempted a different number of times
\r
524 * each time it executes].
\r
526 * Whereas vTaskDelay () specifies a wake time relative to the time at which the function
\r
527 * is called, vTaskDelayUntil () specifies the absolute (exact) time at which it wishes to
\r
530 * The constant portTICK_RATE_MS can be used to calculate real time from the tick
\r
531 * rate - with the resolution of one tick period.
\r
533 * @param pxPreviousWakeTime Pointer to a variable that holds the time at which the
\r
534 * task was last unblocked. The variable must be initialised with the current time
\r
535 * prior to its first use (see the example below). Following this the variable is
\r
536 * automatically updated within vTaskDelayUntil ().
\r
538 * @param xTimeIncrement The cycle time period. The task will be unblocked at
\r
539 * time *pxPreviousWakeTime + xTimeIncrement. Calling vTaskDelayUntil with the
\r
540 * same xTimeIncrement parameter value will cause the task to execute with
\r
541 * a fixed interface period.
\r
545 // Perform an action every 10 ticks.
\r
546 void vTaskFunction( void * pvParameters )
\r
548 portTickType xLastWakeTime;
\r
549 const portTickType xFrequency = 10;
\r
551 // Initialise the xLastWakeTime variable with the current time.
\r
552 xLastWakeTime = xTaskGetTickCount ();
\r
555 // Wait for the next cycle.
\r
556 vTaskDelayUntil( &xLastWakeTime, xFrequency );
\r
558 // Perform action here.
\r
562 * \defgroup vTaskDelayUntil vTaskDelayUntil
\r
563 * \ingroup TaskCtrl
\r
565 void vTaskDelayUntil( portTickType * const pxPreviousWakeTime, portTickType xTimeIncrement ) PRIVILEGED_FUNCTION;
\r
569 * <pre>unsigned portBASE_TYPE uxTaskPriorityGet( xTaskHandle pxTask );</pre>
\r
571 * INCLUDE_xTaskPriorityGet must be defined as 1 for this function to be available.
\r
572 * See the configuration section for more information.
\r
574 * Obtain the priority of any task.
\r
576 * @param pxTask Handle of the task to be queried. Passing a NULL
\r
577 * handle results in the priority of the calling task being returned.
\r
579 * @return The priority of pxTask.
\r
583 void vAFunction( void )
\r
585 xTaskHandle xHandle;
\r
587 // Create a task, storing the handle.
\r
588 xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );
\r
592 // Use the handle to obtain the priority of the created task.
\r
593 // It was created with tskIDLE_PRIORITY, but may have changed
\r
595 if( uxTaskPriorityGet( xHandle ) != tskIDLE_PRIORITY )
\r
597 // The task has changed it's priority.
\r
602 // Is our priority higher than the created task?
\r
603 if( uxTaskPriorityGet( xHandle ) < uxTaskPriorityGet( NULL ) )
\r
605 // Our priority (obtained using NULL handle) is higher.
\r
609 * \defgroup uxTaskPriorityGet uxTaskPriorityGet
\r
610 * \ingroup TaskCtrl
\r
612 unsigned portBASE_TYPE uxTaskPriorityGet( xTaskHandle pxTask ) PRIVILEGED_FUNCTION;
\r
616 * <pre>eTaskState eTaskGetState( xTaskHandle pxTask );</pre>
\r
618 * INCLUDE_eTaskGetState must be defined as 1 for this function to be available.
\r
619 * See the configuration section for more information.
\r
621 * Obtain the state of any task. States are encoded by the eTaskState
\r
624 * @param pxTask Handle of the task to be queried.
\r
626 * @return The state of pxTask at the time the function was called. Note the
\r
627 * state of the task might change between the function being called, and the
\r
628 * functions return value being tested by the calling task.
\r
630 eTaskState eTaskGetState( xTaskHandle pxTask ) PRIVILEGED_FUNCTION;
\r
634 * <pre>void vTaskPrioritySet( xTaskHandle pxTask, unsigned portBASE_TYPE uxNewPriority );</pre>
\r
636 * INCLUDE_vTaskPrioritySet must be defined as 1 for this function to be available.
\r
637 * See the configuration section for more information.
\r
639 * Set the priority of any task.
\r
641 * A context switch will occur before the function returns if the priority
\r
642 * being set is higher than the currently executing task.
\r
644 * @param pxTask Handle to the task for which the priority is being set.
\r
645 * Passing a NULL handle results in the priority of the calling task being set.
\r
647 * @param uxNewPriority The priority to which the task will be set.
\r
651 void vAFunction( void )
\r
653 xTaskHandle xHandle;
\r
655 // Create a task, storing the handle.
\r
656 xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );
\r
660 // Use the handle to raise the priority of the created task.
\r
661 vTaskPrioritySet( xHandle, tskIDLE_PRIORITY + 1 );
\r
665 // Use a NULL handle to raise our priority to the same value.
\r
666 vTaskPrioritySet( NULL, tskIDLE_PRIORITY + 1 );
\r
669 * \defgroup vTaskPrioritySet vTaskPrioritySet
\r
670 * \ingroup TaskCtrl
\r
672 void vTaskPrioritySet( xTaskHandle pxTask, unsigned portBASE_TYPE uxNewPriority ) PRIVILEGED_FUNCTION;
\r
676 * <pre>void vTaskSuspend( xTaskHandle pxTaskToSuspend );</pre>
\r
678 * INCLUDE_vTaskSuspend must be defined as 1 for this function to be available.
\r
679 * See the configuration section for more information.
\r
681 * Suspend any task. When suspended a task will never get any microcontroller
\r
682 * processing time, no matter what its priority.
\r
684 * Calls to vTaskSuspend are not accumulative -
\r
685 * i.e. calling vTaskSuspend () twice on the same task still only requires one
\r
686 * call to vTaskResume () to ready the suspended task.
\r
688 * @param pxTaskToSuspend Handle to the task being suspended. Passing a NULL
\r
689 * handle will cause the calling task to be suspended.
\r
693 void vAFunction( void )
\r
695 xTaskHandle xHandle;
\r
697 // Create a task, storing the handle.
\r
698 xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );
\r
702 // Use the handle to suspend the created task.
\r
703 vTaskSuspend( xHandle );
\r
707 // The created task will not run during this period, unless
\r
708 // another task calls vTaskResume( xHandle ).
\r
713 // Suspend ourselves.
\r
714 vTaskSuspend( NULL );
\r
716 // We cannot get here unless another task calls vTaskResume
\r
717 // with our handle as the parameter.
\r
720 * \defgroup vTaskSuspend vTaskSuspend
\r
721 * \ingroup TaskCtrl
\r
723 void vTaskSuspend( xTaskHandle pxTaskToSuspend ) PRIVILEGED_FUNCTION;
\r
727 * <pre>void vTaskResume( xTaskHandle pxTaskToResume );</pre>
\r
729 * INCLUDE_vTaskSuspend must be defined as 1 for this function to be available.
\r
730 * See the configuration section for more information.
\r
732 * Resumes a suspended task.
\r
734 * A task that has been suspended by one of more calls to vTaskSuspend ()
\r
735 * will be made available for running again by a single call to
\r
738 * @param pxTaskToResume Handle to the task being readied.
\r
742 void vAFunction( void )
\r
744 xTaskHandle xHandle;
\r
746 // Create a task, storing the handle.
\r
747 xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );
\r
751 // Use the handle to suspend the created task.
\r
752 vTaskSuspend( xHandle );
\r
756 // The created task will not run during this period, unless
\r
757 // another task calls vTaskResume( xHandle ).
\r
762 // Resume the suspended task ourselves.
\r
763 vTaskResume( xHandle );
\r
765 // The created task will once again get microcontroller processing
\r
766 // time in accordance with it priority within the system.
\r
769 * \defgroup vTaskResume vTaskResume
\r
770 * \ingroup TaskCtrl
\r
772 void vTaskResume( xTaskHandle pxTaskToResume ) PRIVILEGED_FUNCTION;
\r
776 * <pre>void xTaskResumeFromISR( xTaskHandle pxTaskToResume );</pre>
\r
778 * INCLUDE_xTaskResumeFromISR must be defined as 1 for this function to be
\r
779 * available. See the configuration section for more information.
\r
781 * An implementation of vTaskResume() that can be called from within an ISR.
\r
783 * A task that has been suspended by one of more calls to vTaskSuspend ()
\r
784 * will be made available for running again by a single call to
\r
785 * xTaskResumeFromISR ().
\r
787 * @param pxTaskToResume Handle to the task being readied.
\r
789 * \defgroup vTaskResumeFromISR vTaskResumeFromISR
\r
790 * \ingroup TaskCtrl
\r
792 portBASE_TYPE xTaskResumeFromISR( xTaskHandle pxTaskToResume ) PRIVILEGED_FUNCTION;
\r
794 /*-----------------------------------------------------------
\r
795 * SCHEDULER CONTROL
\r
796 *----------------------------------------------------------*/
\r
800 * <pre>void vTaskStartScheduler( void );</pre>
\r
802 * Starts the real time kernel tick processing. After calling the kernel
\r
803 * has control over which tasks are executed and when. This function
\r
804 * does not return until an executing task calls vTaskEndScheduler ().
\r
806 * At least one task should be created via a call to xTaskCreate ()
\r
807 * before calling vTaskStartScheduler (). The idle task is created
\r
808 * automatically when the first application task is created.
\r
810 * See the demo application file main.c for an example of creating
\r
811 * tasks and starting the kernel.
\r
815 void vAFunction( void )
\r
817 // Create at least one task before starting the kernel.
\r
818 xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
\r
820 // Start the real time kernel with preemption.
\r
821 vTaskStartScheduler ();
\r
823 // Will not get here unless a task calls vTaskEndScheduler ()
\r
827 * \defgroup vTaskStartScheduler vTaskStartScheduler
\r
828 * \ingroup SchedulerControl
\r
830 void vTaskStartScheduler( void ) PRIVILEGED_FUNCTION;
\r
834 * <pre>void vTaskEndScheduler( void );</pre>
\r
836 * Stops the real time kernel tick. All created tasks will be automatically
\r
837 * deleted and multitasking (either preemptive or cooperative) will
\r
838 * stop. Execution then resumes from the point where vTaskStartScheduler ()
\r
839 * was called, as if vTaskStartScheduler () had just returned.
\r
841 * See the demo application file main. c in the demo/PC directory for an
\r
842 * example that uses vTaskEndScheduler ().
\r
844 * vTaskEndScheduler () requires an exit function to be defined within the
\r
845 * portable layer (see vPortEndScheduler () in port. c for the PC port). This
\r
846 * performs hardware specific operations such as stopping the kernel tick.
\r
848 * vTaskEndScheduler () will cause all of the resources allocated by the
\r
849 * kernel to be freed - but will not free resources allocated by application
\r
854 void vTaskCode( void * pvParameters )
\r
858 // Task code goes here.
\r
860 // At some point we want to end the real time kernel processing
\r
862 vTaskEndScheduler ();
\r
866 void vAFunction( void )
\r
868 // Create at least one task before starting the kernel.
\r
869 xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
\r
871 // Start the real time kernel with preemption.
\r
872 vTaskStartScheduler ();
\r
874 // Will only get here when the vTaskCode () task has called
\r
875 // vTaskEndScheduler (). When we get here we are back to single task
\r
880 * \defgroup vTaskEndScheduler vTaskEndScheduler
\r
881 * \ingroup SchedulerControl
\r
883 void vTaskEndScheduler( void ) PRIVILEGED_FUNCTION;
\r
887 * <pre>void vTaskSuspendAll( void );</pre>
\r
889 * Suspends all real time kernel activity while keeping interrupts (including the
\r
890 * kernel tick) enabled.
\r
892 * After calling vTaskSuspendAll () the calling task will continue to execute
\r
893 * without risk of being swapped out until a call to xTaskResumeAll () has been
\r
896 * API functions that have the potential to cause a context switch (for example,
\r
897 * vTaskDelayUntil(), xQueueSend(), etc.) must not be called while the scheduler
\r
902 void vTask1( void * pvParameters )
\r
906 // Task code goes here.
\r
910 // At some point the task wants to perform a long operation during
\r
911 // which it does not want to get swapped out. It cannot use
\r
912 // taskENTER_CRITICAL ()/taskEXIT_CRITICAL () as the length of the
\r
913 // operation may cause interrupts to be missed - including the
\r
916 // Prevent the real time kernel swapping out the task.
\r
917 vTaskSuspendAll ();
\r
919 // Perform the operation here. There is no need to use critical
\r
920 // sections as we have all the microcontroller processing time.
\r
921 // During this time interrupts will still operate and the kernel
\r
922 // tick count will be maintained.
\r
926 // The operation is complete. Restart the kernel.
\r
931 * \defgroup vTaskSuspendAll vTaskSuspendAll
\r
932 * \ingroup SchedulerControl
\r
934 void vTaskSuspendAll( void ) PRIVILEGED_FUNCTION;
\r
938 * <pre>char xTaskResumeAll( void );</pre>
\r
940 * Resumes real time kernel activity following a call to vTaskSuspendAll ().
\r
941 * After a call to vTaskSuspendAll () the kernel will take control of which
\r
942 * task is executing at any time.
\r
944 * @return If resuming the scheduler caused a context switch then pdTRUE is
\r
945 * returned, otherwise pdFALSE is returned.
\r
949 void vTask1( void * pvParameters )
\r
953 // Task code goes here.
\r
957 // At some point the task wants to perform a long operation during
\r
958 // which it does not want to get swapped out. It cannot use
\r
959 // taskENTER_CRITICAL ()/taskEXIT_CRITICAL () as the length of the
\r
960 // operation may cause interrupts to be missed - including the
\r
963 // Prevent the real time kernel swapping out the task.
\r
964 vTaskSuspendAll ();
\r
966 // Perform the operation here. There is no need to use critical
\r
967 // sections as we have all the microcontroller processing time.
\r
968 // During this time interrupts will still operate and the real
\r
969 // time kernel tick count will be maintained.
\r
973 // The operation is complete. Restart the kernel. We want to force
\r
974 // a context switch - but there is no point if resuming the scheduler
\r
975 // caused a context switch already.
\r
976 if( !xTaskResumeAll () )
\r
983 * \defgroup xTaskResumeAll xTaskResumeAll
\r
984 * \ingroup SchedulerControl
\r
986 signed portBASE_TYPE xTaskResumeAll( void ) PRIVILEGED_FUNCTION;
\r
990 * <pre>signed portBASE_TYPE xTaskIsTaskSuspended( xTaskHandle xTask );</pre>
\r
992 * Utility task that simply returns pdTRUE if the task referenced by xTask is
\r
993 * currently in the Suspended state, or pdFALSE if the task referenced by xTask
\r
994 * is in any other state.
\r
997 signed portBASE_TYPE xTaskIsTaskSuspended( xTaskHandle xTask ) PRIVILEGED_FUNCTION;
\r
999 /*-----------------------------------------------------------
\r
1001 *----------------------------------------------------------*/
\r
1005 * <PRE>portTickType xTaskGetTickCount( void );</PRE>
\r
1007 * @return The count of ticks since vTaskStartScheduler was called.
\r
1009 * \page xTaskGetTickCount xTaskGetTickCount
\r
1010 * \ingroup TaskUtils
\r
1012 portTickType xTaskGetTickCount( void ) PRIVILEGED_FUNCTION;
\r
1016 * <PRE>portTickType xTaskGetTickCountFromISR( void );</PRE>
\r
1018 * @return The count of ticks since vTaskStartScheduler was called.
\r
1020 * This is a version of xTaskGetTickCount() that is safe to be called from an
\r
1021 * ISR - provided that portTickType is the natural word size of the
\r
1022 * microcontroller being used or interrupt nesting is either not supported or
\r
1025 * \page xTaskGetTickCount xTaskGetTickCount
\r
1026 * \ingroup TaskUtils
\r
1028 portTickType xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION;
\r
1032 * <PRE>unsigned short uxTaskGetNumberOfTasks( void );</PRE>
\r
1034 * @return The number of tasks that the real time kernel is currently managing.
\r
1035 * This includes all ready, blocked and suspended tasks. A task that
\r
1036 * has been deleted but not yet freed by the idle task will also be
\r
1037 * included in the count.
\r
1039 * \page uxTaskGetNumberOfTasks uxTaskGetNumberOfTasks
\r
1040 * \ingroup TaskUtils
\r
1042 unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION;
\r
1046 * <PRE>signed char *pcTaskGetTaskName( xTaskHandle xTaskToQuery );</PRE>
\r
1048 * @return The text (human readable) name of the task referenced by the handle
\r
1049 * xTaskToQueury. A task can query its own name by either passing in its own
\r
1050 * handle, or by setting xTaskToQuery to NULL. INCLUDE_pcTaskGetTaskName must be
\r
1051 * set to 1 in FreeRTOSConfig.h for pcTaskGetTaskName() to be available.
\r
1053 * \page pcTaskGetTaskName pcTaskGetTaskName
\r
1054 * \ingroup TaskUtils
\r
1056 signed char *pcTaskGetTaskName( xTaskHandle xTaskToQuery );
\r
1060 * <PRE>void vTaskList( char *pcWriteBuffer );</PRE>
\r
1062 * configUSE_TRACE_FACILITY must be defined as 1 for this function to be
\r
1063 * available. See the configuration section for more information.
\r
1065 * NOTE: This function will disable interrupts for its duration. It is
\r
1066 * not intended for normal application runtime use but as a debug aid.
\r
1068 * Lists all the current tasks, along with their current state and stack
\r
1069 * usage high water mark.
\r
1071 * Tasks are reported as blocked ('B'), ready ('R'), deleted ('D') or
\r
1072 * suspended ('S').
\r
1074 * @param pcWriteBuffer A buffer into which the above mentioned details
\r
1075 * will be written, in ascii form. This buffer is assumed to be large
\r
1076 * enough to contain the generated report. Approximately 40 bytes per
\r
1077 * task should be sufficient.
\r
1079 * \page vTaskList vTaskList
\r
1080 * \ingroup TaskUtils
\r
1082 void vTaskList( signed char *pcWriteBuffer ) PRIVILEGED_FUNCTION;
\r
1086 * <PRE>void vTaskGetRunTimeStats( char *pcWriteBuffer );</PRE>
\r
1088 * configGENERATE_RUN_TIME_STATS must be defined as 1 for this function
\r
1089 * to be available. The application must also then provide definitions
\r
1090 * for portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() and
\r
1091 * portGET_RUN_TIME_COUNTER_VALUE to configure a peripheral timer/counter
\r
1092 * and return the timers current count value respectively. The counter
\r
1093 * should be at least 10 times the frequency of the tick count.
\r
1095 * NOTE: This function will disable interrupts for its duration. It is
\r
1096 * not intended for normal application runtime use but as a debug aid.
\r
1098 * Setting configGENERATE_RUN_TIME_STATS to 1 will result in a total
\r
1099 * accumulated execution time being stored for each task. The resolution
\r
1100 * of the accumulated time value depends on the frequency of the timer
\r
1101 * configured by the portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() macro.
\r
1102 * Calling vTaskGetRunTimeStats() writes the total execution time of each
\r
1103 * task into a buffer, both as an absolute count value and as a percentage
\r
1104 * of the total system execution time.
\r
1106 * @param pcWriteBuffer A buffer into which the execution times will be
\r
1107 * written, in ascii form. This buffer is assumed to be large enough to
\r
1108 * contain the generated report. Approximately 40 bytes per task should
\r
1111 * \page vTaskGetRunTimeStats vTaskGetRunTimeStats
\r
1112 * \ingroup TaskUtils
\r
1114 void vTaskGetRunTimeStats( signed char *pcWriteBuffer ) PRIVILEGED_FUNCTION;
\r
1118 * <PRE>unsigned portBASE_TYPE uxTaskGetStackHighWaterMark( xTaskHandle xTask );</PRE>
\r
1120 * INCLUDE_uxTaskGetStackHighWaterMark must be set to 1 in FreeRTOSConfig.h for
\r
1121 * this function to be available.
\r
1123 * Returns the high water mark of the stack associated with xTask. That is,
\r
1124 * the minimum free stack space there has been (in words, so on a 32 bit machine
\r
1125 * a value of 1 means 4 bytes) since the task started. The smaller the returned
\r
1126 * number the closer the task has come to overflowing its stack.
\r
1128 * @param xTask Handle of the task associated with the stack to be checked.
\r
1129 * Set xTask to NULL to check the stack of the calling task.
\r
1131 * @return The smallest amount of free stack space there has been (in bytes)
\r
1132 * since the task referenced by xTask was created.
\r
1134 unsigned portBASE_TYPE uxTaskGetStackHighWaterMark( xTaskHandle xTask ) PRIVILEGED_FUNCTION;
\r
1136 /* When using trace macros it is sometimes necessary to include tasks.h before
\r
1137 FreeRTOS.h. When this is done pdTASK_HOOK_CODE will not yet have been defined,
\r
1138 so the following two prototypes will cause a compilation error. This can be
\r
1139 fixed by simply guarding against the inclusion of these two prototypes unless
\r
1140 they are explicitly required by the configUSE_APPLICATION_TASK_TAG configuration
\r
1142 #ifdef configUSE_APPLICATION_TASK_TAG
\r
1143 #if configUSE_APPLICATION_TASK_TAG == 1
\r
1146 * <pre>void vTaskSetApplicationTaskTag( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction );</pre>
\r
1148 * Sets pxHookFunction to be the task hook function used by the task xTask.
\r
1149 * Passing xTask as NULL has the effect of setting the calling tasks hook
\r
1152 void vTaskSetApplicationTaskTag( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction ) PRIVILEGED_FUNCTION;
\r
1156 * <pre>void xTaskGetApplicationTaskTag( xTaskHandle xTask );</pre>
\r
1158 * Returns the pxHookFunction value assigned to the task xTask.
\r
1160 pdTASK_HOOK_CODE xTaskGetApplicationTaskTag( xTaskHandle xTask ) PRIVILEGED_FUNCTION;
\r
1161 #endif /* configUSE_APPLICATION_TASK_TAG ==1 */
\r
1162 #endif /* ifdef configUSE_APPLICATION_TASK_TAG */
\r
1166 * <pre>portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction );</pre>
\r
1168 * Calls the hook function associated with xTask. Passing xTask as NULL has
\r
1169 * the effect of calling the Running tasks (the calling task) hook function.
\r
1171 * pvParameter is passed to the hook function for the task to interpret as it
\r
1174 portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter ) PRIVILEGED_FUNCTION;
\r
1177 * xTaskGetIdleTaskHandle() is only available if
\r
1178 * INCLUDE_xTaskGetIdleTaskHandle is set to 1 in FreeRTOSConfig.h.
\r
1180 * Simply returns the handle of the idle task. It is not valid to call
\r
1181 * xTaskGetIdleTaskHandle() before the scheduler has been started.
\r
1183 xTaskHandle xTaskGetIdleTaskHandle( void );
\r
1185 /*-----------------------------------------------------------
\r
1186 * SCHEDULER INTERNALS AVAILABLE FOR PORTING PURPOSES
\r
1187 *----------------------------------------------------------*/
\r
1190 * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS ONLY
\r
1191 * INTENDED FOR USE WHEN IMPLEMENTING A PORT OF THE SCHEDULER AND IS
\r
1192 * AN INTERFACE WHICH IS FOR THE EXCLUSIVE USE OF THE SCHEDULER.
\r
1194 * Called from the real time kernel tick (either preemptive or cooperative),
\r
1195 * this increments the tick count and checks if any tasks that are blocked
\r
1196 * for a finite period required removing from a blocked list and placing on
\r
1199 void vTaskIncrementTick( void ) PRIVILEGED_FUNCTION;
\r
1202 * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS AN
\r
1203 * INTERFACE WHICH IS FOR THE EXCLUSIVE USE OF THE SCHEDULER.
\r
1205 * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED.
\r
1207 * Removes the calling task from the ready list and places it both
\r
1208 * on the list of tasks waiting for a particular event, and the
\r
1209 * list of delayed tasks. The task will be removed from both lists
\r
1210 * and replaced on the ready list should either the event occur (and
\r
1211 * there be no higher priority tasks waiting on the same event) or
\r
1212 * the delay period expires.
\r
1214 * @param pxEventList The list containing tasks that are blocked waiting
\r
1215 * for the event to occur.
\r
1217 * @param xTicksToWait The maximum amount of time that the task should wait
\r
1218 * for the event to occur. This is specified in kernel ticks,the constant
\r
1219 * portTICK_RATE_MS can be used to convert kernel ticks into a real time
\r
1222 void vTaskPlaceOnEventList( const xList * const pxEventList, portTickType xTicksToWait ) PRIVILEGED_FUNCTION;
\r
1225 * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS AN
\r
1226 * INTERFACE WHICH IS FOR THE EXCLUSIVE USE OF THE SCHEDULER.
\r
1228 * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED.
\r
1230 * This function performs nearly the same function as vTaskPlaceOnEventList().
\r
1231 * The difference being that this function does not permit tasks to block
\r
1232 * indefinitely, whereas vTaskPlaceOnEventList() does.
\r
1234 * @return pdTRUE if the task being removed has a higher priority than the task
\r
1235 * making the call, otherwise pdFALSE.
\r
1237 void vTaskPlaceOnEventListRestricted( const xList * const pxEventList, portTickType xTicksToWait ) PRIVILEGED_FUNCTION;
\r
1240 * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS AN
\r
1241 * INTERFACE WHICH IS FOR THE EXCLUSIVE USE OF THE SCHEDULER.
\r
1243 * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED.
\r
1245 * Removes a task from both the specified event list and the list of blocked
\r
1246 * tasks, and places it on a ready queue.
\r
1248 * xTaskRemoveFromEventList () will be called if either an event occurs to
\r
1249 * unblock a task, or the block timeout period expires.
\r
1251 * @return pdTRUE if the task being removed has a higher priority than the task
\r
1252 * making the call, otherwise pdFALSE.
\r
1254 signed portBASE_TYPE xTaskRemoveFromEventList( const xList * const pxEventList ) PRIVILEGED_FUNCTION;
\r
1257 * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS ONLY
\r
1258 * INTENDED FOR USE WHEN IMPLEMENTING A PORT OF THE SCHEDULER AND IS
\r
1259 * AN INTERFACE WHICH IS FOR THE EXCLUSIVE USE OF THE SCHEDULER.
\r
1261 * Sets the pointer to the current TCB to the TCB of the highest priority task
\r
1262 * that is ready to run.
\r
1264 void vTaskSwitchContext( void ) PRIVILEGED_FUNCTION;
\r
1267 * Return the handle of the calling task.
\r
1269 xTaskHandle xTaskGetCurrentTaskHandle( void ) PRIVILEGED_FUNCTION;
\r
1272 * Capture the current time status for future reference.
\r
1274 void vTaskSetTimeOutState( xTimeOutType * const pxTimeOut ) PRIVILEGED_FUNCTION;
\r
1277 * Compare the time status now with that previously captured to see if the
\r
1278 * timeout has expired.
\r
1280 portBASE_TYPE xTaskCheckForTimeOut( xTimeOutType * const pxTimeOut, portTickType * const pxTicksToWait ) PRIVILEGED_FUNCTION;
\r
1283 * Shortcut used by the queue implementation to prevent unnecessary call to
\r
1286 void vTaskMissedYield( void ) PRIVILEGED_FUNCTION;
\r
1289 * Returns the scheduler state as taskSCHEDULER_RUNNING,
\r
1290 * taskSCHEDULER_NOT_STARTED or taskSCHEDULER_SUSPENDED.
\r
1292 portBASE_TYPE xTaskGetSchedulerState( void ) PRIVILEGED_FUNCTION;
\r
1295 * Raises the priority of the mutex holder to that of the calling task should
\r
1296 * the mutex holder have a priority less than the calling task.
\r
1298 void vTaskPriorityInherit( xTaskHandle * const pxMutexHolder ) PRIVILEGED_FUNCTION;
\r
1301 * Set the priority of a task back to its proper priority in the case that it
\r
1302 * inherited a higher priority while it was holding a semaphore.
\r
1304 void vTaskPriorityDisinherit( xTaskHandle * const pxMutexHolder ) PRIVILEGED_FUNCTION;
\r
1307 * Generic version of the task creation function which is in turn called by the
\r
1308 * xTaskCreate() and xTaskCreateRestricted() macros.
\r
1310 signed portBASE_TYPE xTaskGenericCreate( pdTASK_CODE pxTaskCode, const signed char * const pcName, unsigned short usStackDepth, void *pvParameters, unsigned portBASE_TYPE uxPriority, xTaskHandle *pxCreatedTask, portSTACK_TYPE *puxStackBuffer, const xMemoryRegion * const xRegions ) PRIVILEGED_FUNCTION;
\r
1313 * Get the uxTCBNumber assigned to the task referenced by the xTask parameter.
\r
1315 unsigned portBASE_TYPE uxTaskGetTaskNumber( xTaskHandle xTask );
\r
1318 * Set the uxTCBNumber of the task referenced by the xTask parameter to
\r
1321 void vTaskSetTaskNumber( xTaskHandle xTask, unsigned portBASE_TYPE uxHandle );
\r
1324 * If tickless mode is being used, or a low power mode is implemented, then
\r
1325 * the tick interrupt will not execute during idle periods. When this is the
\r
1326 * case, the tick count value maintained by the scheduler needs to be kept up
\r
1327 * to date with the actual execution time by being skipped forward by the by
\r
1328 * a time equal to the idle period.
\r
1330 void vTaskStepTick( portTickType xTicksToJump );
\r
1332 #ifdef __cplusplus
\r
1335 #endif /* TASK_H */
\r