/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an\r
implementation of vApplicationGetIdleTaskMemory() to provide the memory that is\r
used by the Idle task. */\r
-void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint16_t *pusIdleTaskStackSize )\r
+void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize )\r
{\r
/* If the buffers to be provided to the Idle task are declared inside this\r
function then they must be declared static - otherwise they will be allocated on\r
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.\r
Note that, as the array is necessarily of type StackType_t,\r
configMINIMAL_STACK_SIZE is specified in words, not bytes. */\r
- *pusIdleTaskStackSize = configMINIMAL_STACK_SIZE;\r
+ *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;\r
}\r
/*-----------------------------------------------------------*/\r
\r
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the\r
application must provide an implementation of vApplicationGetTimerTaskMemory()\r
to provide the memory that is used by the Timer service task. */\r
-void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint16_t *pusTimerTaskStackSize )\r
+void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize )\r
{\r
/* If the buffers to be provided to the Timer task are declared inside this\r
function then they must be declared static - otherwise they will be allocated on\r
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.\r
Note that, as the array is necessarily of type StackType_t,\r
configMINIMAL_STACK_SIZE is specified in words, not bytes. */\r
- *pusTimerTaskStackSize = configMINIMAL_STACK_SIZE;\r
+ *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;\r
}\r
\r
\r
*/\r
\r
/******************************************************************************\r
+ * See http://www.freertos.org/EFM32-Giant-Gecko-Pearl-Gecko-tickless-RTOS-demo.html\r
+ *\r
* This project provides two demo applications. A simple blinky style project\r
* that demonstrates low power tickless functionality, and a more comprehensive\r
* test and demo application. The configCREATE_LOW_POWER_DEMO setting, which is\r
#include "bsp_trace.h"\r
#include "sleep.h"\r
\r
-/* Set mainCREATE_LOW_POWER_DEMO to one to run the simple blinky demo, or 0 to\r
-run the more comprehensive test and demo application. */\r
-#define mainCREATE_LOW_POWER_DEMO 0\r
-\r
/*-----------------------------------------------------------*/\r
\r
/*\r
\r
int main( void )\r
{\r
+ /*\r
+ * See the following link for instructions:\r
+ * http://www.freertos.org/EFM32-Giant-Gecko-Pearl-Gecko-tickless-RTOS-demo.html\r
+ */\r
+\r
/* Configure the hardware ready to run the demo. */\r
prvSetupHardware();\r
\r
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an\r
implementation of vApplicationGetIdleTaskMemory() to provide the memory that is\r
used by the Idle task. */\r
-void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint16_t *pusIdleTaskStackSize )\r
+void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize )\r
{\r
/* If the buffers to be provided to the Idle task are declared inside this\r
function then they must be declared static - otherwise they will be allocated on\r
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.\r
Note that, as the array is necessarily of type StackType_t,\r
configMINIMAL_STACK_SIZE is specified in words, not bytes. */\r
- *pusIdleTaskStackSize = configMINIMAL_STACK_SIZE;\r
+ *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;\r
}\r
/*-----------------------------------------------------------*/\r
\r
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the\r
application must provide an implementation of vApplicationGetTimerTaskMemory()\r
to provide the memory that is used by the Timer service task. */\r
-void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint16_t *pusTimerTaskStackSize )\r
+void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize )\r
{\r
/* If the buffers to be provided to the Timer task are declared inside this\r
function then they must be declared static - otherwise they will be allocated on\r
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.\r
Note that, as the array is necessarily of type StackType_t,\r
configMINIMAL_STACK_SIZE is specified in words, not bytes. */\r
- *pusTimerTaskStackSize = configMINIMAL_STACK_SIZE;\r
+ *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;\r
}\r
\r
*/\r
\r
/******************************************************************************\r
+ * See http://www.freertos.org/EFM32-Giant-Gecko-Pearl-Gecko-tickless-RTOS-demo.html\r
+ *\r
* This project provides two demo applications. A simple blinky style project\r
* that demonstrates low power tickless functionality, and a more comprehensive\r
* test and demo application. The configCREATE_LOW_POWER_DEMO setting, which is\r
\r
int main( void )\r
{\r
+ /*\r
+ * See the following link for instructions:\r
+ * http://www.freertos.org/EFM32-Giant-Gecko-Pearl-Gecko-tickless-RTOS-demo.html\r
+ */\r
+\r
/* Configure the hardware ready to run the demo. */\r
prvSetupHardware();\r
\r
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an\r
implementation of vApplicationGetIdleTaskMemory() to provide the memory that is\r
used by the Idle task. */\r
-void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint16_t *pusIdleTaskStackSize )\r
+void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize )\r
{\r
/* If the buffers to be provided to the Idle task are declared inside this\r
function then they must be declared static - otherwise they will be allocated on\r
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.\r
Note that, as the array is necessarily of type StackType_t,\r
configMINIMAL_STACK_SIZE is specified in words, not bytes. */\r
- *pusIdleTaskStackSize = configMINIMAL_STACK_SIZE;\r
+ *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;\r
}\r
/*-----------------------------------------------------------*/\r
\r
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the\r
application must provide an implementation of vApplicationGetTimerTaskMemory()\r
to provide the memory that is used by the Timer service task. */\r
-void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint16_t *pusTimerTaskStackSize )\r
+void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize )\r
{\r
/* If the buffers to be provided to the Timer task are declared inside this\r
function then they must be declared static - otherwise they will be allocated on\r
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.\r
Note that, as the array is necessarily of type StackType_t,\r
configMINIMAL_STACK_SIZE is specified in words, not bytes. */\r
- *pusTimerTaskStackSize = configMINIMAL_STACK_SIZE;\r
+ *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;\r
}\r
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an\r
implementation of vApplicationGetIdleTaskMemory() to provide the memory that is\r
used by the Idle task. */\r
-void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint16_t *pusIdleTaskStackSize )\r
+void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize )\r
{\r
/* If the buffers to be provided to the Idle task are declared inside this\r
function then they must be declared static - otherwise they will be allocated on\r
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.\r
Note that, as the array is necessarily of type StackType_t,\r
configMINIMAL_STACK_SIZE is specified in words, not bytes. */\r
- *pusIdleTaskStackSize = configMINIMAL_STACK_SIZE;\r
+ *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;\r
}\r
/*-----------------------------------------------------------*/\r
\r
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the\r
application must provide an implementation of vApplicationGetTimerTaskMemory()\r
to provide the memory that is used by the Timer service task. */\r
-void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint16_t *pusTimerTaskStackSize )\r
+void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize )\r
{\r
/* If the buffers to be provided to the Timer task are declared inside this\r
function then they must be declared static - otherwise they will be allocated on\r
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.\r
Note that, as the array is necessarily of type StackType_t,\r
configMINIMAL_STACK_SIZE is specified in words, not bytes. */\r
- *pusTimerTaskStackSize = configMINIMAL_STACK_SIZE;\r
+ *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;\r
}\r
\r
\r
staticCREATOR_TASK_STACK_SIZE, /* Size of the buffer passed in as the stack - in words, not bytes! */\r
NULL, /* Parameter passed into the task - not used in this case. */\r
staticTASK_PRIORITY, /* Priority of the task. */\r
- NULL, /* Handle of the task being created, not used in this case. */\r
&( uxCreatorTaskStackBuffer[ 0 ] ), /* The buffer to use as the task's stack. */\r
&xCreatorTaskTCBBuffer ); /* The variable that will hold the task's TCB. */\r
\r
static void prvCreateAndDeleteStaticallyAllocatedTasks( void )\r
{\r
TaskHandle_t xCreatedTask;\r
-BaseType_t xReturned;\r
\r
/* The variable that will hold the TCB of tasks created by this function. See\r
the comments above the declaration of the xCreatorTaskTCBBuffer variable for\r
StaticTask_t structure that will hold the task's TCB. If both pointers are\r
passed as NULL then the respective object will be allocated dynamically as\r
if xTaskCreate() had been called. */\r
- xReturned = xTaskCreateStatic(\r
+ xCreatedTask = xTaskCreateStatic(\r
prvStaticallyAllocatedTask, /* Function that implements the task. */\r
"Static", /* Human readable name for the task. */\r
configMINIMAL_STACK_SIZE, /* Task's stack size, in words (not bytes!). */\r
NULL, /* Parameter to pass into the task. */\r
uxTaskPriorityGet( NULL ) + 1, /* The priority of the task. */\r
- &xCreatedTask, /* Handle of the task being created. */\r
&( uxStackBuffer[ 0 ] ), /* The buffer to use as the task's stack. */\r
&xTCBBuffer ); /* The variable that will hold that task's TCB. */\r
\r
- /* The created task had a higher priority so should have executed and\r
- suspended itself by now. */\r
- if( eTaskGetState( xCreatedTask ) != eSuspended )\r
+ /* Check the task was created correctly, then delete the task. */\r
+ if( xCreatedTask == NULL )\r
{\r
xErrorOccurred = pdTRUE;\r
}\r
-\r
- /* Check the task was created correctly, then delete the task. */\r
- configASSERT( xReturned == pdPASS );\r
- if( xReturned != pdPASS )\r
+ else if( eTaskGetState( xCreatedTask ) != eSuspended )\r
{\r
+ /* The created task had a higher priority so should have executed and\r
+ suspended itself by now. */\r
xErrorOccurred = pdTRUE;\r
}\r
- vTaskDelete( xCreatedTask );\r
+ else\r
+ {\r
+ vTaskDelete( xCreatedTask );\r
+ }\r
\r
/* Now do the same using a dynamically allocated task to ensure the delete\r
function is working correctly in both the static and dynamic allocation\r
cases. */\r
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )\r
{\r
+ BaseType_t xReturned;\r
+\r
xReturned = xTaskCreate(\r
- prvStaticallyAllocatedTask, /* Function that implements the task. */\r
+ prvStaticallyAllocatedTask, /* Function that implements the task - the same function is used but is actually dynamically allocated this time. */\r
"Static", /* Human readable name for the task. */\r
configMINIMAL_STACK_SIZE, /* Task's stack size, in words (not bytes!). */\r
NULL, /* Parameter to pass into the task. */\r
* application callback function must be provided to supply the RAM that will\r
* get used for the Idle task data structures and stack.\r
*/\r
-void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint16_t *pusIdleTaskStackSize );\r
+void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize );\r
\r
/*\r
* This demo has configSUPPORT_STATIC_ALLOCATION set to 1 and configUSE_TIMERS\r
* supply the RAM that will get used for the Timer task data structures and\r
* stack.\r
*/\r
-void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint16_t *pusTimerTaskStackSize );\r
+void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize );\r
\r
/* This demo only uses the standard demo tasks that use statically allocated\r
RAM. A 'check' task is also created to periodically inspect the demo tasks to\r
\r
/* Create the task, which will use the RAM allocated by the linker to the\r
variables declared in this function. */\r
- xTaskCreateStatic( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL, ucTaskStack, &xCheckTask );\r
+ xTaskCreateStatic( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, ucTaskStack, &xCheckTask );\r
}\r
/*-----------------------------------------------------------*/\r
\r
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an\r
implementation of vApplicationGetIdleTaskMemory() to provide the memory that is\r
used by the Idle task. */\r
-void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint16_t *pusIdleTaskStackSize )\r
+void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize )\r
{\r
/* If the buffers to be provided to the Idle task are declared inside this\r
function then they must be declared static - otherwise they will be allocated on\r
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.\r
Note that, as the array is necessarily of type StackType_t,\r
configMINIMAL_STACK_SIZE is specified in words, not bytes. */\r
- *pusIdleTaskStackSize = configMINIMAL_STACK_SIZE;\r
+ *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;\r
}\r
/*-----------------------------------------------------------*/\r
\r
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the\r
application must provide an implementation of vApplicationGetTimerTaskMemory()\r
to provide the memory that is used by the Timer service task. */\r
-void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint16_t *pusTimerTaskStackSize )\r
+void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize )\r
{\r
/* If the buffers to be provided to the Timer task are declared inside this\r
function then they must be declared static - otherwise they will be allocated on\r
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.\r
Note that, as the array is necessarily of type StackType_t,\r
configMINIMAL_STACK_SIZE is specified in words, not bytes. */\r
- *pusTimerTaskStackSize = configMINIMAL_STACK_SIZE;\r
+ *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;\r
}\r
\r
void vApplicationIdleHook( void );\r
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName );\r
void vApplicationTickHook( void );\r
-void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint16_t *pusIdleTaskStackSize );\r
-void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint16_t *pusTimerTaskStackSize );\r
+void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize );\r
+void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize );\r
\r
/*\r
* Writes trace data to a disk file when the trace recording is stopped.\r
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an\r
implementation of vApplicationGetIdleTaskMemory() to provide the memory that is\r
used by the Idle task. */\r
-void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint16_t *pusIdleTaskStackSize )\r
+void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize )\r
{\r
/* If the buffers to be provided to the Idle task are declared inside this\r
function then they must be declared static - otherwise they will be allocated on\r
/* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.\r
Note that, as the array is necessarily of type StackType_t,\r
configMINIMAL_STACK_SIZE is specified in words, not bytes. */\r
- *pusIdleTaskStackSize = configMINIMAL_STACK_SIZE;\r
+ *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;\r
}\r
/*-----------------------------------------------------------*/\r
\r
/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the\r
application must provide an implementation of vApplicationGetTimerTaskMemory()\r
to provide the memory that is used by the Timer service task. */\r
-void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint16_t *pusTimerTaskStackSize )\r
+void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize )\r
{\r
/* If the buffers to be provided to the Timer task are declared inside this\r
function then they must be declared static - otherwise they will be allocated on\r
/* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.\r
Note that, as the array is necessarily of type StackType_t,\r
configMINIMAL_STACK_SIZE is specified in words, not bytes. */\r
- *pusTimerTaskStackSize = configMINIMAL_STACK_SIZE;\r
+ *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;\r
}\r
\r
*/\r
#if( portUSING_MPU_WRAPPERS == 1 )\r
struct xMEMORY_REGION;\r
- void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint16_t usStackDepth ) PRIVILEGED_FUNCTION;\r
+ void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint32_t ulStackDepth ) PRIVILEGED_FUNCTION;\r
#endif\r
\r
#ifdef __cplusplus\r
/**\r
* task. h\r
*<pre>\r
- BaseType_t xTaskCreateStatic(\r
- TaskFunction_t pvTaskCode,\r
- const char * const pcName,\r
- uint16_t usStackDepth,\r
- void *pvParameters,\r
- UBaseType_t uxPriority,\r
- TaskHandle_t *pvCreatedTask,\r
- StackType_t *pxStackBuffer,\r
- StaticTask_t *pxTaskBuffer\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
* facilitate debugging. The maximum length of the string is defined by\r
* configMAX_TASK_NAME_LEN in FreeRTOSConfig.h.\r
*\r
- * @param usStackDepth The size of the task stack specified as the number of\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 usStackDepth is defined as 100 then 400 bytes\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
*\r
* @param uxPriority The priority at which the task will run.\r
*\r
- * @param pvCreatedTask Used to pass back a handle by which the created task\r
- * can be referenced. Pass as NULL if the handle is not required.\r
- *\r
* @param pxStackBuffer Must point to a StackType_t array that has at least\r
- * usStackDepth indexes - the array will then be used as the task's stack,\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
* 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.\r
- StackType_t xStack[ STACK_SIZE ];\r
-\r
- // Task to be created.\r
- void vTaskCode( void * pvParameters )\r
- {\r
- for( ;; )\r
- {\r
- // Task code goes here.\r
- }\r
- }\r
-\r
- // Function that creates a task.\r
- void vOtherFunction( void )\r
- {\r
- static uint8_t ucParameterToPass;\r
- TaskHandle_t xHandle = NULL;\r
-\r
- // Create the task without using any dynamic memory allocation.\r
- xTaskCreateStatic( vTaskCode, // As per xTaskCreate() parameter.\r
- "NAME", // As per xTaskCreate() parameter.\r
- STACK_SIZE, // As per xTaskCreate() parameter.\r
- &ucParameterToPass, // As per xTaskCreate() parameter.\r
- tskIDLE_PRIORITY, // As per xTaskCreate() parameter.\r
- &xHandle, // As per xTaskCreate() parameter.\r
- xStack, // Pointer to the buffer that the task being created will use as its stack.\r
- &xTaskBuffer ); // Pointer to a StaticTask_t structure for use as the memory require by the task.\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
- BaseType_t xTaskCreateStatic( TaskFunction_t pxTaskCode, const char * const pcName, const uint16_t usStackDepth, void * const pvParameters, UBaseType_t uxPriority, TaskHandle_t * const pxCreatedTask, StackType_t * const puxStackBuffer, StaticTask_t * const pxTaskBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+ TaskHandle_t xTaskCreateStatic( TaskFunction_t pxTaskCode, const char * const pcName, const uint32_t ulStackDepth, void * const pvParameters, UBaseType_t uxPriority, StackType_t * const puxStackBuffer, StaticTask_t * const pxTaskBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
#endif /* configSUPPORT_STATIC_ALLOCATION */\r
\r
/**\r
*----------------------------------------------------------*/\r
\r
#error This port is not supported in this V9.0.0 pre-release revision, but will be supported in the final release. For now use V8.2.3 instead.\r
- \r
+\r
/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining\r
all the API functions to use the MPU wrappers. That should only be done when\r
task.h is included from an application file. */\r
}\r
/*-----------------------------------------------------------*/\r
\r
-void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint16_t usStackDepth )\r
+void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint32_t ulStackDepth )\r
{\r
extern uint32_t __SRAM_segment_start__[];\r
extern uint32_t __SRAM_segment_end__[];\r
which case the stack region parameters will be valid. At all other\r
times the stack parameters will not be valid and it is assumed that the\r
stack region has already been configured. */\r
- if( usStackDepth > 0 )\r
+ if( ulStackDepth > 0 )\r
{\r
/* Define the region that allows access to the stack. */\r
xMPUSettings->xRegion[ 0 ].ulRegionBaseAddress =\r
\r
xMPUSettings->xRegion[ 0 ].ulRegionAttribute =\r
( portMPU_REGION_READ_WRITE ) | /* Read and write. */\r
- ( prvGetMPURegionSizeSetting( ( uint32_t ) usStackDepth * ( uint32_t ) sizeof( StackType_t ) ) ) |\r
+ ( prvGetMPURegionSizeSetting( ulStackDepth * ( uint32_t ) sizeof( StackType_t ) ) ) |\r
( portMPU_REGION_CACHEABLE_BUFFERABLE ) |\r
( portMPU_REGION_ENABLE );\r
}\r
/*-----------------------------------------------------------*/\r
\r
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )\r
- \r
+\r
void *MPU_pvPortMalloc( size_t xSize )\r
{\r
void *pvReturn;\r
\r
return pvReturn;\r
}\r
- \r
+\r
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */\r
/*-----------------------------------------------------------*/\r
\r
\r
portRESET_PRIVILEGE( xRunningPrivileged );\r
}\r
- \r
+\r
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */\r
/*-----------------------------------------------------------*/\r
\r
* queue is created, then prvInitialiseMutex() is called to configure the queue\r
* as a mutex.\r
*/\r
-static void prvInitialiseMutex( Queue_t *pxNewQueue );\r
+#if( configUSE_MUTEXES == 1 )\r
+ static void prvInitialiseMutex( Queue_t *pxNewQueue ) PRIVILEGED_FUNCTION;\r
+#endif\r
\r
/*-----------------------------------------------------------*/\r
\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static void prvInitialiseMutex( Queue_t *pxNewQueue )\r
-{\r
- if( pxNewQueue != NULL )\r
+#if( configUSE_MUTEXES == 1 )\r
+\r
+ static void prvInitialiseMutex( Queue_t *pxNewQueue )\r
{\r
- /* The queue create function will set all the queue structure members\r
- correctly for a generic queue, but this function is creating a\r
- mutex. Overwrite those members that need to be set differently -\r
- in particular the information required for priority inheritance. */\r
- pxNewQueue->pxMutexHolder = NULL;\r
- pxNewQueue->uxQueueType = queueQUEUE_IS_MUTEX;\r
+ if( pxNewQueue != NULL )\r
+ {\r
+ /* The queue create function will set all the queue structure members\r
+ correctly for a generic queue, but this function is creating a\r
+ mutex. Overwrite those members that need to be set differently -\r
+ in particular the information required for priority inheritance. */\r
+ pxNewQueue->pxMutexHolder = NULL;\r
+ pxNewQueue->uxQueueType = queueQUEUE_IS_MUTEX;\r
\r
- /* In case this is a recursive mutex. */\r
- pxNewQueue->u.uxRecursiveCallCount = 0;\r
+ /* In case this is a recursive mutex. */\r
+ pxNewQueue->u.uxRecursiveCallCount = 0;\r
\r
- traceCREATE_MUTEX( pxNewQueue );\r
+ traceCREATE_MUTEX( pxNewQueue );\r
\r
- /* Start with the semaphore in the expected state. */\r
- ( void ) xQueueGenericSend( pxNewQueue, NULL, ( TickType_t ) 0U, queueSEND_TO_BACK );\r
- }\r
- else\r
- {\r
- traceCREATE_MUTEX_FAILED();\r
+ /* Start with the semaphore in the expected state. */\r
+ ( void ) xQueueGenericSend( pxNewQueue, NULL, ( TickType_t ) 0U, queueSEND_TO_BACK );\r
+ }\r
+ else\r
+ {\r
+ traceCREATE_MUTEX_FAILED();\r
+ }\r
}\r
-}\r
+\r
+#endif /* configUSE_MUTEXES */\r
/*-----------------------------------------------------------*/\r
\r
#if( ( configUSE_MUTEXES == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )\r
#endif\r
\r
#if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
- extern void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint16_t *pusIdleTaskStackSize );\r
+ extern void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize );\r
#endif\r
\r
/* File private functions. --------------------------------*/\r
* Called after a Task_t structure has been allocated either statically or\r
* dynamically to fill in the structure's members.\r
*/\r
-static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, const char * const pcName, const uint16_t usStackDepth, void * const pvParameters, UBaseType_t uxPriority, TaskHandle_t * const pxCreatedTask, TCB_t *pxNewTCB ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, const char * const pcName, const uint32_t ulStackDepth, void * const pvParameters, UBaseType_t uxPriority, TaskHandle_t * const pxCreatedTask, TCB_t *pxNewTCB ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
\r
/*\r
* Called after a new task has been created and initialised to place the task\r
\r
#if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
\r
- BaseType_t xTaskCreateStatic( TaskFunction_t pxTaskCode, const char * const pcName, const uint16_t usStackDepth, void * const pvParameters, UBaseType_t uxPriority, TaskHandle_t * const pxCreatedTask, StackType_t * const puxStackBuffer, StaticTask_t * const pxTaskBuffer ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+ TaskHandle_t xTaskCreateStatic( TaskFunction_t pxTaskCode, const char * const pcName, const uint32_t ulStackDepth, void * const pvParameters, UBaseType_t uxPriority, StackType_t * const puxStackBuffer, StaticTask_t * const pxTaskBuffer ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
{\r
TCB_t *pxNewTCB;\r
- BaseType_t xReturn;\r
+ TaskHandle_t xReturn;\r
\r
configASSERT( puxStackBuffer != NULL );\r
configASSERT( pxTaskBuffer != NULL );\r
}\r
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */\r
\r
- prvInitialiseNewTask( pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask, pxNewTCB );\r
+ prvInitialiseNewTask( pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, &xReturn, pxNewTCB );\r
prvAddNewTaskToReadyList( pxNewTCB );\r
- xReturn = pdPASS;\r
}\r
else\r
{\r
- xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;\r
+ xReturn = NULL;\r
}\r
\r
return xReturn;\r
}\r
#endif /* configSUPPORT_STATIC_ALLOCATION */\r
\r
- prvInitialiseNewTask( pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask, pxNewTCB );\r
+ prvInitialiseNewTask( pxTaskCode, pcName, ( uint32_t ) usStackDepth, pvParameters, uxPriority, pxCreatedTask, pxNewTCB );\r
prvAddNewTaskToReadyList( pxNewTCB );\r
xReturn = pdPASS;\r
}\r
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */\r
/*-----------------------------------------------------------*/\r
\r
-static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, const char * const pcName, const uint16_t usStackDepth, void * const pvParameters, UBaseType_t uxPriority, TaskHandle_t * const pxCreatedTask, TCB_t *pxNewTCB ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, const char * const pcName, const uint32_t ulStackDepth, void * const pvParameters, UBaseType_t uxPriority, TaskHandle_t * const pxCreatedTask, TCB_t *pxNewTCB ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
{\r
StackType_t *pxTopOfStack;\r
UBaseType_t x;\r
#if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) || ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) )\r
{\r
/* Fill the stack with a known value to assist debugging. */\r
- ( void ) memset( pxNewTCB->pxStack, ( int ) tskSTACK_FILL_BYTE, ( size_t ) usStackDepth * sizeof( StackType_t ) );\r
+ ( void ) memset( pxNewTCB->pxStack, ( int ) tskSTACK_FILL_BYTE, ( size_t ) ulStackDepth * sizeof( StackType_t ) );\r
}\r
#endif /* ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) || ( ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) ) ) */\r
\r
by the port. */\r
#if( portSTACK_GROWTH < 0 )\r
{\r
- pxTopOfStack = pxNewTCB->pxStack + ( usStackDepth - ( uint16_t ) 1 );\r
+ pxTopOfStack = pxNewTCB->pxStack + ( ulStackDepth - ( uint32_t ) 1 );\r
pxTopOfStack = ( StackType_t * ) ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) ); /*lint !e923 MISRA exception. Avoiding casts between pointers and integers is not practical. Size differences accounted for using portPOINTER_SIZE_TYPE type. */\r
\r
/* Check the alignment of the calculated top of stack is correct. */\r
\r
/* The other extreme of the stack space is required if stack checking is\r
performed. */\r
- pxNewTCB->pxEndOfStack = pxNewTCB->pxStack + ( usStackDepth - ( uint16_t ) 1 );\r
+ pxNewTCB->pxEndOfStack = pxNewTCB->pxStack + ( ulStackDepth - ( uint32_t ) 1 );\r
}\r
#endif /* portSTACK_GROWTH */\r
\r
\r
#if ( portUSING_MPU_WRAPPERS == 1 )\r
{\r
- vPortStoreTaskMPUSettings( &( pxNewTCB->xMPUSettings ), xRegions, pxNewTCB->pxStack, usStackDepth );\r
+ vPortStoreTaskMPUSettings( &( pxNewTCB->xMPUSettings ), xRegions, pxNewTCB->pxStack, ulStackDepth );\r
}\r
#endif\r
\r
void vTaskStartScheduler( void )\r
{\r
BaseType_t xReturn;\r
-uint16_t usIdleTaskStackSize = configMINIMAL_STACK_SIZE;\r
\r
/* Add the idle task at the lowest priority. */\r
#if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
{\r
StaticTask_t *pxIdleTaskTCBBuffer = NULL;\r
StackType_t *pxIdleTaskStackBuffer = NULL;\r
+ uint32_t ulIdleTaskStackSize;\r
\r
/* The Idle task is created using user provided RAM - obtain the\r
address of the RAM then create the idle task. */\r
- vApplicationGetIdleTaskMemory( &pxIdleTaskTCBBuffer, &pxIdleTaskStackBuffer, &usIdleTaskStackSize );\r
- xReturn = xTaskCreateStatic( prvIdleTask, "IDLE", usIdleTaskStackSize, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), &xIdleTaskHandle, pxIdleTaskStackBuffer, pxIdleTaskTCBBuffer ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */\r
+ vApplicationGetIdleTaskMemory( &pxIdleTaskTCBBuffer, &pxIdleTaskStackBuffer, &ulIdleTaskStackSize );\r
+ xIdleTaskHandle = xTaskCreateStatic( prvIdleTask, "IDLE", ulIdleTaskStackSize, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), pxIdleTaskStackBuffer, pxIdleTaskTCBBuffer ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */\r
+\r
+ if( xIdleTaskHandle != NULL )\r
+ {\r
+ xReturn = pdPASS;\r
+ }\r
+ else\r
+ {\r
+ xReturn = pdFAIL;\r
+ }\r
}\r
#else\r
{\r
/* The Idle task is being created using dynamically allocated RAM. */\r
- xReturn = xTaskCreate( prvIdleTask, "IDLE", usIdleTaskStackSize, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), &xIdleTaskHandle ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */\r
+ xReturn = xTaskCreate( prvIdleTask, "IDLE", configMINIMAL_STACK_SIZE, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), &xIdleTaskHandle ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */\r
}\r
#endif /* configSUPPORT_STATIC_ALLOCATION */\r
\r
following callback function - which enables the application to optionally\r
provide the memory that will be used by the timer task as the task's stack\r
and TCB. */\r
- extern void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint16_t *pusTimerTaskStackSize );\r
+ extern void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize );\r
\r
#endif\r
\r
BaseType_t xTimerCreateTimerTask( void )\r
{\r
BaseType_t xReturn = pdFAIL;\r
-uint16_t usTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;\r
-\r
\r
/* This function is called when the scheduler is started if\r
configUSE_TIMERS is set to 1. Check that the infrastructure used by the\r
{\r
StaticTask_t *pxTimerTaskTCBBuffer = NULL;\r
StackType_t *pxTimerTaskStackBuffer = NULL;\r
+ uint32_t ulTimerTaskStackSize;\r
+\r
+ vApplicationGetTimerTaskMemory( &pxTimerTaskTCBBuffer, &pxTimerTaskStackBuffer, &ulTimerTaskStackSize );\r
+ xTimerTaskHandle = xTaskCreateStatic( prvTimerTask, "Tmr Svc", ulTimerTaskStackSize, NULL, ( ( UBaseType_t ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, pxTimerTaskStackBuffer, pxTimerTaskTCBBuffer );\r
\r
- vApplicationGetTimerTaskMemory( &pxTimerTaskTCBBuffer, &pxTimerTaskStackBuffer, &usTimerTaskStackSize );\r
- xReturn = xTaskCreateStatic( prvTimerTask, "Tmr Svc", usTimerTaskStackSize, NULL, ( ( UBaseType_t ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, &xTimerTaskHandle, pxTimerTaskStackBuffer, pxTimerTaskTCBBuffer );\r
+ if( xTimerTaskHandle != NULL )\r
+ {\r
+ xReturn = pdPASS;\r
+ }\r
}\r
#else\r
{\r
- xReturn = xTaskCreate( prvTimerTask, "Tmr Svc", usTimerTaskStackSize, NULL, ( ( UBaseType_t ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, &xTimerTaskHandle );\r
+ xReturn = xTaskCreate( prvTimerTask, "Tmr Svc", configTIMER_TASK_STACK_DEPTH, NULL, ( ( UBaseType_t ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, &xTimerTaskHandle );\r
}\r
#endif /* configSUPPORT_STATIC_ALLOCATION */\r
}\r