+#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )\r
+ BaseType_t xTaskCreate( TaskFunction_t pxTaskCode,\r
+ const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+ const configSTACK_DEPTH_TYPE usStackDepth,\r
+ void * const pvParameters,\r
+ UBaseType_t uxPriority,\r
+ TaskHandle_t * const pxCreatedTask ) PRIVILEGED_FUNCTION;\r
+#endif\r
+\r
+/**\r
+ * task. h\r
+ *<pre>\r
+ TaskHandle_t xTaskCreateStatic( TaskFunction_t pvTaskCode,\r
+ const char * const pcName,\r
+ uint32_t ulStackDepth,\r
+ void *pvParameters,\r
+ UBaseType_t uxPriority,\r
+ StackType_t *pxStackBuffer,\r
+ StaticTask_t *pxTaskBuffer );</pre>\r
+ *\r
+ * Create a new task and add it to the list of tasks that are ready to run.\r
+ *\r
+ * Internally, within the FreeRTOS implementation, tasks use two blocks of\r
+ * memory. The first block is used to hold the task's data structures. The\r
+ * second block is used by the task as its stack. If a task is created using\r
+ * xTaskCreate() then both blocks of memory are automatically dynamically\r
+ * allocated inside the xTaskCreate() function. (see\r
+ * http://www.freertos.org/a00111.html). If a task is created using\r
+ * xTaskCreateStatic() then the application writer must provide the required\r
+ * memory. xTaskCreateStatic() therefore allows a task to be created without\r
+ * using any dynamic memory allocation.\r
+ *\r
+ * @param pvTaskCode Pointer to the task entry function. Tasks\r
+ * must be implemented to never return (i.e. continuous loop).\r
+ *\r
+ * @param pcName A descriptive name for the task. This is mainly used to\r
+ * facilitate debugging. The maximum length of the string is defined by\r
+ * configMAX_TASK_NAME_LEN in FreeRTOSConfig.h.\r
+ *\r
+ * @param ulStackDepth The size of the task stack specified as the number of\r
+ * variables the stack can hold - not the number of bytes. For example, if\r
+ * the stack is 32-bits wide and ulStackDepth is defined as 100 then 400 bytes\r
+ * will be allocated for stack storage.\r
+ *\r
+ * @param pvParameters Pointer that will be used as the parameter for the task\r
+ * being created.\r
+ *\r
+ * @param uxPriority The priority at which the task will run.\r
+ *\r
+ * @param pxStackBuffer Must point to a StackType_t array that has at least\r
+ * ulStackDepth indexes - the array will then be used as the task's stack,\r
+ * removing the need for the stack to be allocated dynamically.\r
+ *\r
+ * @param pxTaskBuffer Must point to a variable of type StaticTask_t, which will\r
+ * then be used to hold the task's data structures, removing the need for the\r
+ * memory to be allocated dynamically.\r
+ *\r
+ * @return If neither pxStackBuffer or pxTaskBuffer are NULL, then the task will\r
+ * be created and pdPASS is returned. If either pxStackBuffer or pxTaskBuffer\r
+ * are NULL then the task will not be created and\r
+ * errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY is returned.\r
+ *\r
+ * Example usage:\r
+ <pre>\r
+\r
+ // Dimensions the buffer that the task being created will use as its stack.\r
+ // NOTE: This is the number of words the stack will hold, not the number of\r
+ // bytes. For example, if each stack item is 32-bits, and this is set to 100,\r
+ // then 400 bytes (100 * 32-bits) will be allocated.\r
+ #define STACK_SIZE 200\r
+\r
+ // Structure that will hold the TCB of the task being created.\r
+ StaticTask_t xTaskBuffer;\r
+\r
+ // Buffer that the task being created will use as its stack. Note this is\r
+ // an array of StackType_t variables. The size of StackType_t is dependent on\r
+ // the RTOS port.\r
+ StackType_t xStack[ STACK_SIZE ];\r
+\r
+ // Function that implements the task being created.\r
+ void vTaskCode( void * pvParameters )\r
+ {\r
+ // The parameter value is expected to be 1 as 1 is passed in the\r
+ // pvParameters value in the call to xTaskCreateStatic().\r
+ configASSERT( ( uint32_t ) pvParameters == 1UL );\r
+\r
+ for( ;; )\r
+ {\r
+ // Task code goes here.\r
+ }\r
+ }\r
+\r
+ // Function that creates a task.\r
+ void vOtherFunction( void )\r
+ {\r
+ TaskHandle_t xHandle = NULL;\r
+\r
+ // Create the task without using any dynamic memory allocation.\r
+ xHandle = xTaskCreateStatic(\r
+ vTaskCode, // Function that implements the task.\r
+ "NAME", // Text name for the task.\r
+ STACK_SIZE, // Stack size in words, not bytes.\r
+ ( void * ) 1, // Parameter passed into the task.\r
+ tskIDLE_PRIORITY,// Priority at which the task is created.\r
+ xStack, // Array to use as the task's stack.\r
+ &xTaskBuffer ); // Variable to hold the task's data structure.\r
+\r
+ // puxStackBuffer and pxTaskBuffer were not NULL, so the task will have\r
+ // been created, and xHandle will be the task's handle. Use the handle\r
+ // to suspend the task.\r
+ vTaskSuspend( xHandle );\r
+ }\r
+ </pre>\r
+ * \defgroup xTaskCreateStatic xTaskCreateStatic\r
+ * \ingroup Tasks\r
+ */\r
+#if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
+ TaskHandle_t xTaskCreateStatic( TaskFunction_t pxTaskCode,\r
+ const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+ const uint32_t ulStackDepth,\r
+ void * const pvParameters,\r
+ UBaseType_t uxPriority,\r
+ StackType_t * const puxStackBuffer,\r
+ StaticTask_t * const pxTaskBuffer ) PRIVILEGED_FUNCTION;\r
+#endif /* configSUPPORT_STATIC_ALLOCATION */\r