/* Re-enable interrupts - see comments above the cpsid instruction()\r
above. */\r
__asm volatile ( "cpsie i" );\r
+ __asm volatile ( "dsb" );\r
+ __asm volatile ( "isb" );\r
}\r
else\r
{\r
pxEventBits->uxEventBits = 0;\r
vListInitialise( &( pxEventBits->xTasksWaitingForBits ) );\r
\r
- if( pxStaticEventGroup == NULL )\r
+ #if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
{\r
- pxEventBits->ucStaticallyAllocated = pdFALSE;\r
- }\r
- else\r
- {\r
- pxEventBits->ucStaticallyAllocated = pdTRUE;\r
+ if( pxStaticEventGroup == NULL )\r
+ {\r
+ pxEventBits->ucStaticallyAllocated = pdFALSE;\r
+ }\r
+ else\r
+ {\r
+ pxEventBits->ucStaticallyAllocated = pdTRUE;\r
+ }\r
}\r
+ #endif /* configSUPPORT_STATIC_ALLOCATION */\r
\r
traceEVENT_GROUP_CREATE( pxEventBits );\r
}\r
}\r
\r
/* Only free the memory if it was allocated dynamically. */\r
- if( pxEventBits->ucStaticallyAllocated == pdFALSE )\r
+ #if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
+ {\r
+ if( pxEventBits->ucStaticallyAllocated == pdFALSE )\r
+ {\r
+ vPortFree( pxEventBits );\r
+ }\r
+ }\r
+ #else\r
{\r
vPortFree( pxEventBits );\r
}\r
+ #endif /* configSUPPORT_STATIC_ALLOCATION */\r
}\r
( void ) xTaskResumeAll();\r
}\r
);\r
* </pre>\r
*\r
- * Creates a new queue instance. This allocates the storage required by the\r
- * new queue and returns a handle for the queue.\r
+ * Creates a new queue instance, and returns a handle by which the new queue\r
+ * can be referenced.\r
+ *\r
+ * Internally, within the FreeRTOS implementation, queue's use two blocks of\r
+ * memory. The first block is used to hold the queue's data structures. The\r
+ * second block is used to hold items placed into the queue. If a queue is\r
+ * created using xQueueCreate() then both blocks of memory are automatically\r
+ * dynamically allocated inside the xQueueCreate() function. (see\r
+ * http://www.freertos.org/a00111.html). If a queue is created using\r
+ * xQueueCreateStatic() then the application writer can instead optionally\r
+ * provide the memory that will get used by the queue. xQueueCreateStatic()\r
+ * therefore allows a queue to be created without using any dynamic memory\r
+ * allocation.\r
*\r
* @param uxQueueLength The maximum number of items that the queue can contain.\r
*\r
*/\r
#define xQueueCreate( uxQueueLength, uxItemSize ) xQueueGenericCreate( uxQueueLength, uxItemSize, NULL, NULL, queueQUEUE_TYPE_BASE )\r
\r
+/**\r
+ * queue. h\r
+ * <pre>\r
+ QueueHandle_t xQueueCreateStatic(\r
+ UBaseType_t uxQueueLength,\r
+ UBaseType_t uxItemSize,\r
+ uint8_t *pucQueueStorageBuffer,\r
+ StaticQueue_t *pxQueueBuffer\r
+ );\r
+ * </pre>\r
+ *\r
+ * Creates a new queue instance, and returns a handle by which the new queue\r
+ * can be referenced.\r
+ *\r
+ * Internally, within the FreeRTOS implementation, queue's use two blocks of\r
+ * memory. The first block is used to hold the queue's data structures. The\r
+ * second block is used to hold items placed into the queue. If a queue is\r
+ * created using xQueueCreate() then both blocks of memory are automatically\r
+ * dynamically allocated inside the xQueueCreate() function. (see\r
+ * http://www.freertos.org/a00111.html). If a queue is created using\r
+ * xQueueCreateStatic() then the application writer can instead optionally\r
+ * provide the memory that will get used by the queue. xQueueCreateStatic()\r
+ * therefore allows a queue to be created without using any dynamic memory\r
+ * allocation.\r
+ *\r
+ * @param uxQueueLength The maximum number of items that the queue can contain.\r
+ *\r
+ * @param uxItemSize The number of bytes each item in the queue will require.\r
+ * Items are queued by copy, not by reference, so this is the number of bytes\r
+ * that will be copied for each posted item. Each item on the queue must be\r
+ * the same size.\r
+ *\r
+ * @param pucQueueStorageBuffer If pucQueueStorageBuffer is NULL then the memory\r
+ * used to hold items stored in the queue will be allocated dynamically, just as\r
+ * when a queue is created using xQueueCreate(). If pxQueueStorageBuffer is not\r
+ * NULL then it must point to a uint8_t array that is at least large enough to\r
+ * hold the maximum number of items that can be in the queue at any one time -\r
+ * which is ( uxQueueLength * uxItemsSize ) bytes.\r
+ *\r
+ * @param pxQueueBuffer If pxQueueBuffer is NULL then the memory required to\r
+ * hold the queue's data structures will be allocated dynamically, just as when\r
+ * a queue is created using xQueueCreate(). If pxQueueBuffer is not NULL then\r
+ * it must point to a variable of type StaticQueue_t, which will then be used to\r
+ * hold the queue's data structure, removing the need for the memory to be\r
+ * allocated dynamically.\r
+ *\r
+ * @return If the queue is successfully create then a handle to the newly\r
+ * created queue is returned. If the queue cannot be created then 0 is\r
+ * returned.\r
+ *\r
+ * Example usage:\r
+ <pre>\r
+ struct AMessage\r
+ {\r
+ char ucMessageID;\r
+ char ucData[ 20 ];\r
+ };\r
+\r
+ #define QUEUE_LENGTH 10\r
+ #define ITEM_SIZE sizeof( uint32_t )\r
+\r
+ // xQueueBuffer will hold the queue structure.\r
+ StaticQueue_t xQueueBuffer; \r
+\r
+ // ucQueueStorage will hold the items posted to the queue. Must be at least\r
+ // [(queue length) * ( queue item size)] bytes long.\r
+ uint8_t ucQueueStorage[ QUEUE_LENGTH * ITEM_SIZE ];\r
+\r
+ void vATask( void *pvParameters )\r
+ {\r
+ QueueHandle_t xQueue1;\r
+\r
+ // Create a queue capable of containing 10 uint32_t values.\r
+ xQueue1 = xQueueCreate( QUEUE_LENGTH, // The number of items the queue can hold.\r
+ ITEM_SIZE // The size of each item in the queue\r
+ &( ucQueueStorage[ 0 ] ), // The buffer that will hold the items in the queue.\r
+ &xQueueBuffer ); // The buffer that will hold the queue structure.\r
+\r
+ // The queue is guaranteed to be created successfully as no dynamic memory\r
+ // allocation was used. Therefore xQueue1 is now a handle to a valid queue.\r
+\r
+ // ... Rest of task code.\r
+ }\r
+ </pre>\r
+ * \defgroup xQueueCreate xQueueCreate\r
+ * \ingroup QueueManagement\r
+ */\r
#if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
- #define xQueueCreateStatic( uxQueueLength, uxItemSize, pucQueueStorage, pxStaticQueue ) xQueueGenericCreate( uxQueueLength, uxItemSize, pucQueueStorage, pxStaticQueue, queueQUEUE_TYPE_BASE )\r
+ #define xQueueCreateStatic( uxQueueLength, uxItemSize, pucQueueStorage, pxQueueBuffer ) xQueueGenericCreate( ( uxQueueLength ), ( uxItemSize ), ( pucQueueStorage ), ( pxQueueBuffer ), ( queueQUEUE_TYPE_BASE ) )\r
#endif /* configSUPPORT_STATIC_ALLOCATION */\r
\r
/**\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's use two blocks of\r
+ * memory. The first block is used to hold the tasks'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 can instead optionally\r
+ * provide the memory that will get used by the task. xTaskCreateStatic()\r
+ * therefore allows a task to be created without using any dynamic memory\r
+ * allocation.\r
+ *\r
+ * See xTaskCreateStatic() for a version that does not use any dynamic memory\r
+ * allocation.\r
+ *\r
* xTaskCreate() can only be used to create a task that has unrestricted\r
* access to the entire microcontroller memory map. Systems that include MPU\r
* support can alternatively create an MPU constrained task using\r
UBaseType_t uxPriority,\r
TaskHandle_t *pvCreatedTask,\r
StackType_t *pxStackBuffer,\r
- StaticTask_t *pxTCBBuffer\r
+ StaticTask_t *pxTaskBuffer\r
);</pre>\r
*\r
* Create a new task and add it to the list of tasks that are ready to run.\r
- * If a task is created using xTaskCreate() then the stack and task control\r
- * block (TCB) used by the task are allocated dynamically. If a task is created\r
- * using xTaskCreateStatic() then the application writer can optionally provide\r
- * the buffers that will hold the task stack and TCB respectively.\r
- * xTaskCreateStatic() therefore allows tasks to be created without any dynamic\r
- * memory allocation.\r
+ *\r
+ * Internally, within the FreeRTOS implementation, tasks's use two blocks of\r
+ * memory. The first block is used to hold the tasks'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 can instead optionally\r
+ * provide the memory that will get used by the task. xTaskCreateStatic()\r
+ * therefore allows a task to be created without using any dynamic memory\r
+ * 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 pxStackBuffer If pxStackBuffer is NULL then the stack used by the\r
* task will be allocated dynamically, just as if the task was created using\r
- * xTaskCreate(). if pxStackBuffer is not NULL then it must point to a\r
+ * xTaskCreate(). If pxStackBuffer is not NULL then it must point to a\r
* StackType_t array that has at least usStackDepth indexes - the array will\r
- * then be used as the task's stack.\r
+ * then be used as the task's stack, removing the need for the stack to be\r
+ * allocated dynamically.\r
*\r
- * @param pxTCBBuffer If pxTCBBuffer is NULL then the TCB (which is the\r
- * structures used internally within FreeRTOS to hold information on the task)\r
- * will be allocated dynamically, just as when xTaskCreate() is used. If\r
- * pxTCBBuffer is not NULL then it must point to a variable of type StaticTask_t,\r
- * which will then be used as the TCB of the task being created.\r
+ * @param pxTaskBuffer If pxTaskBuffer is NULL then the memory used to hold the\r
+ * task's data structures will be allocated dynamically, just as when a task is\r
+ * created using xTaskCreate(). If pxTaskBuffer is not NULL then it must point\r
+ * to a variable of type StaticTask_t, which will then be used to hold the\r
+ * task's data structures, removing the need for the memory to be allocated\r
+ * dynamically.\r
*\r
* @return pdPASS if the task was successfully created and added to a ready\r
* list, otherwise an error code defined in the file projdefs.h\r
#define STACK_SIZE 200\r
\r
// Structure that will hold the TCB of the task being created.\r
- StaticTask_t xTCB;\r
+ StaticTask_t xTaskBuffer;\r
\r
// Buffer that the task being created will use as its stack.\r
StackType_t xStack[ STACK_SIZE ];\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
- &xTCB ); // Pointer to a structure in which the TCB of the task being created will be stored.\r
+ &xTaskBuffer ); // Pointer to a StaticTask_t structure for use as the memory require by the task.\r
}\r
</pre>\r
* \defgroup xTaskCreateStatic xTaskCreateStatic\r
* \ingroup Tasks\r
*/\r
#if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
- #define xTaskCreateStatic( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask, puxStackBuffer, pxDummyTCB ) xTaskGenericCreate( ( pvTaskCode ), ( pcName ), ( usStackDepth ), ( pvParameters ), ( uxPriority ), ( pxCreatedTask ), ( puxStackBuffer ), ( pxDummyTCB ), ( NULL ) )\r
+ #define xTaskCreateStatic( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask, puxStackBuffer, pxTaskBuffer ) xTaskGenericCreate( ( pvTaskCode ), ( pcName ), ( usStackDepth ), ( pvParameters ), ( uxPriority ), ( pxCreatedTask ), ( puxStackBuffer ), ( pxTaskBuffer ), ( NULL ) )\r
#endif /* configSUPPORT_STATIC_ALLOCATION */\r
\r
/**\r
* Generic version of the task creation function which is in turn called by the\r
* xTaskCreate() and xTaskCreateRestricted() macros.\r
*/\r
-BaseType_t xTaskGenericCreate( 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 pxTCBBuffer, const MemoryRegion_t * const xRegions ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+BaseType_t xTaskGenericCreate( 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, const MemoryRegion_t * const xRegions ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
\r
/*\r
* Get the uxTCBNumber assigned to the task referenced by the xTask parameter.\r
* void * pvTimerID,\r
* TimerCallbackFunction_t pxCallbackFunction );\r
*\r
- * Creates a new software timer instance. This allocates the storage required\r
- * by the new timer, initialises the new timers internal state, and returns a\r
- * handle by which the new timer can be referenced.\r
+ * Creates a new software timer instance, and returns a handle by which the\r
+ * created software timer can be referenced.\r
+ *\r
+ * Internally, within the FreeRTOS implementation, software timer's use a block\r
+ * of memory, in which the timer data structure is stored. If a software timer\r
+ * is created using xTimerCreate() then the required memory is automatically\r
+ * dynamically allocated inside the xTimerCreate() function. (see\r
+ * http://www.freertos.org/a00111.html). If a software timer is created using\r
+ * xTimerCreateStatic() then the application writer can instead optionally\r
+ * provide the memory that will get used by the software timer.\r
+ * xTimerCreateStatic() therefore allows a software to be created without using\r
+ * any dynamic memory allocation.\r
*\r
* Timers are created in the dormant state. The xTimerStart(), xTimerReset(),\r
* xTimerStartFromISR(), xTimerResetFromISR(), xTimerChangePeriod() and\r
*/\r
#define xTimerCreate( pcTimerName, xTimerPeriodInTicks, uxAutoReload, pvTimerID, pxCallbackFunction ) xTimerGenericCreate( ( pcTimerName ), ( xTimerPeriodInTicks ), ( uxAutoReload ), ( pvTimerID ), ( pxCallbackFunction ), NULL )\r
\r
+/**\r
+ * TimerHandle_t xTimerCreateStatic(const char * const pcTimerName,\r
+ * TickType_t xTimerPeriodInTicks,\r
+ * UBaseType_t uxAutoReload,\r
+ * void * pvTimerID,\r
+ * TimerCallbackFunction_t pxCallbackFunction,\r
+ * StaticTimer_t *pxTimerBuffer );\r
+ *\r
+ * Creates a new software timer instance, and returns a handle by which the\r
+ * created software timer can be referenced.\r
+ *\r
+ * Internally, within the FreeRTOS implementation, software timer's use a block\r
+ * of memory, in which the timer data structure is stored. If a software timer\r
+ * is created using xTimerCreate() then the required memory is automatically\r
+ * dynamically allocated inside the xTimerCreate() function. (see\r
+ * http://www.freertos.org/a00111.html). If a software timer is created using\r
+ * xTimerCreateStatic() then the application writer can instead optionally\r
+ * provide the memory that will get used by the software timer.\r
+ * xTimerCreateStatic() therefore allows a software to be created without using\r
+ * any dynamic memory allocation.\r
+ *\r
+ * Timers are created in the dormant state. The xTimerStart(), xTimerReset(),\r
+ * xTimerStartFromISR(), xTimerResetFromISR(), xTimerChangePeriod() and\r
+ * xTimerChangePeriodFromISR() API functions can all be used to transition a\r
+ * timer into the active state.\r
+ *\r
+ * @param pcTimerName A text name that is assigned to the timer. This is done\r
+ * purely to assist debugging. The kernel itself only ever references a timer\r
+ * by its handle, and never by its name.\r
+ *\r
+ * @param xTimerPeriodInTicks The timer period. The time is defined in tick\r
+ * periods so the constant portTICK_PERIOD_MS can be used to convert a time that\r
+ * has been specified in milliseconds. For example, if the timer must expire\r
+ * after 100 ticks, then xTimerPeriodInTicks should be set to 100.\r
+ * Alternatively, if the timer must expire after 500ms, then xPeriod can be set\r
+ * to ( 500 / portTICK_PERIOD_MS ) provided configTICK_RATE_HZ is less than or\r
+ * equal to 1000.\r
+ *\r
+ * @param uxAutoReload If uxAutoReload is set to pdTRUE then the timer will\r
+ * expire repeatedly with a frequency set by the xTimerPeriodInTicks parameter.\r
+ * If uxAutoReload is set to pdFALSE then the timer will be a one-shot timer and\r
+ * enter the dormant state after it expires.\r
+ *\r
+ * @param pvTimerID An identifier that is assigned to the timer being created.\r
+ * Typically this would be used in the timer callback function to identify which\r
+ * timer expired when the same callback function is assigned to more than one\r
+ * timer.\r
+ *\r
+ * @param pxCallbackFunction The function to call when the timer expires.\r
+ * Callback functions must have the prototype defined by TimerCallbackFunction_t,\r
+ * which is "void vCallbackFunction( TimerHandle_t xTimer );".\r
+ *\r
+ * @param pxTimerBuffer If pxTimerBuffer is NULL then the memory required to\r
+ * hold the software timer's data structure will be allocated dynamically, just\r
+ * as when a software timer is created using xTimerCreate(). If pxTimerBuffer\r
+ * is not NULL then it must point to a variable of type StaticTimer_t, which\r
+ * will be then be used to hold the software timer's data structures, removing\r
+ * the need for the memory to be allocated dynamically.\r
+ *\r
+ * @return If the timer is successfully created then a handle to the newly\r
+ * created timer is returned. If the timer cannot be created (because either\r
+ * there is insufficient FreeRTOS heap remaining to allocate the timer\r
+ * structures, or the timer period was set to 0) then NULL is returned.\r
+ *\r
+ * Example usage:\r
+ * @verbatim\r
+ *\r
+ * // The buffer used to hold the software timer's data structure.\r
+ * static StaticTimer_t xTimerBuffer;\r
+ *\r
+ * // A variable that will be incremented by the software timer's callback\r
+ * // function.\r
+ * UBaseType_t uxVariableToIncrement = 0;\r
+ *\r
+ * // A software timer callback function that increments a variable passed to\r
+ * // it when the software timer was created. After the 5th increment the\r
+ * // callback function stops the software timer.\r
+ * static void prvTimerCallback( TimerHandle_t xExpiredTimer )\r
+ * {\r
+ * UBaseType_t *puxVariableToIncrement;\r
+ * BaseType_t xReturned;\r
+ *\r
+ * // Obtain the address of the variable to increment from the timer ID.\r
+ * puxVariableToIncrement = ( UBaseType_t * ) pvTimerGetTimerID( xExpiredTimer );\r
+ *\r
+ * // Increment the variable to show the timer callback has executed.\r
+ * ( *puxVariableToIncrement )++;\r
+ *\r
+ * // If this callback has executed the required number of times, stop the\r
+ * // timer.\r
+ * if( *puxVariableToIncrement == 5 )\r
+ * {\r
+ * // This is called from a timer callback so must not block.\r
+ * xTimerStop( xExpiredTimer, staticDONT_BLOCK );\r
+ * }\r
+ * }\r
+ *\r
+ *\r
+ * void main( void )\r
+ * {\r
+ * // Create the software time. xTimerCreateStatic() has an extra parameter\r
+ * // than the normal xTimerCreate() API function. The parameter is a pointer\r
+ * // to the StaticTimer_t structure that will hold the software timer\r
+ * // structure. If the parameter is passed as NULL then the structure will be\r
+ * // allocated dynamically, just as if xTimerCreate() had been called.\r
+ * xTimer = xTimerCreateStatic( "T1", // Text name for the task. Helps debugging only. Not used by FreeRTOS.\r
+ * xTimerPeriod, // The period of the timer in ticks.\r
+ * pdTRUE, // This is an auto-reload timer.\r
+ * ( void * ) &uxVariableToIncrement, // A variable incremented by the software timer's callback function\r
+ * prvTimerCallback, // The function to execute when the timer expires.\r
+ * &xTimerBuffer ); // The buffer that will hold the software timer structure.\r
+ *\r
+ * // The scheduler has not started yet so a block time is not used.\r
+ * xReturned = xTimerStart( xTimer, 0 );\r
+ *\r
+ * // ...\r
+ * // Create tasks here.\r
+ * // ...\r
+ *\r
+ * // Starting the scheduler will start the timers running as they have already\r
+ * // been set into the active state.\r
+ * xTaskStartScheduler();\r
+ *\r
+ * // Should not reach here.\r
+ * for( ;; );\r
+ * }\r
+ * @endverbatim\r
+ */\r
#if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
- #define xTimerCreateStatic( pcTimerName, xTimerPeriodInTicks, uxAutoReload, pvTimerID, pxCallbackFunction, pxStaticTimer ) xTimerGenericCreate( ( pcTimerName ), ( xTimerPeriodInTicks ), ( uxAutoReload ), ( pvTimerID ), ( pxCallbackFunction ), pxStaticTimer )\r
+ #define xTimerCreateStatic( pcTimerName, xTimerPeriodInTicks, uxAutoReload, pvTimerID, pxCallbackFunction, pxTimerBuffer ) xTimerGenericCreate( ( pcTimerName ), ( xTimerPeriodInTicks ), ( uxAutoReload ), ( pvTimerID ), ( pxCallbackFunction ), ( pxTimerBuffer ) )\r
#endif /* configSUPPORT_STATIC_ALLOCATION */\r
\r
/**\r
*/\r
BaseType_t xTimerCreateTimerTask( void ) PRIVILEGED_FUNCTION;\r
BaseType_t xTimerGenericCommand( TimerHandle_t xTimer, const BaseType_t xCommandID, const TickType_t xOptionalValue, BaseType_t * const pxHigherPriorityTaskWoken, const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;\r
-TimerHandle_t xTimerGenericCreate( const char * const pcTimerName, const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void * const pvTimerID, TimerCallbackFunction_t pxCallbackFunction, StaticTimer_t *pxStaticTimer ) PRIVILEGED_FUNCTION;\r
+TimerHandle_t xTimerGenericCreate( const char * const pcTimerName, const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void * const pvTimerID, TimerCallbackFunction_t pxCallbackFunction, StaticTimer_t *pxTimerBuffer ) PRIVILEGED_FUNCTION;\r
\r
#ifdef __cplusplus\r
}\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
-BaseType_t xTaskGenericCreate( 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 pxTCBBuffer, const MemoryRegion_t * const xRegions ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+BaseType_t xTaskGenericCreate( 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, const MemoryRegion_t * const xRegions ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
{\r
BaseType_t xReturn;\r
TCB_t * pxNewTCB;\r
\r
/* Allocate the memory required by the TCB and stack for the new task,\r
checking that the allocation was successful. */\r
- pxNewTCB = prvAllocateTCBAndStack( usStackDepth, puxStackBuffer, ( TCB_t* ) pxTCBBuffer ); /*lint !e740 Unusual cast is ok as the structures are designed to have the same alignment, and the size is checked by an assert. */\r
+ pxNewTCB = prvAllocateTCBAndStack( usStackDepth, puxStackBuffer, ( TCB_t* ) pxTaskBuffer ); /*lint !e740 Unusual cast is ok as the structures are designed to have the same alignment, and the size is checked by an assert. */\r
\r
if( pxNewTCB != NULL )\r
{\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static TCB_t *prvAllocateTCBAndStack( const uint16_t usStackDepth, StackType_t * const puxStackBuffer, TCB_t * const pxTCBBuffer )\r
+static TCB_t *prvAllocateTCBAndStack( const uint16_t usStackDepth, StackType_t * const puxStackBuffer, TCB_t * const pxTaskBuffer )\r
{\r
TCB_t *pxNewTCB;\r
\r
{\r
/* Allocate space for the TCB. Where the memory comes from depends on\r
the implementation of the port malloc function. */\r
- pxNewTCB = ( TCB_t * ) pvPortMallocAligned( sizeof( TCB_t ), pxTCBBuffer );\r
+ pxNewTCB = ( TCB_t * ) pvPortMallocAligned( sizeof( TCB_t ), pxTaskBuffer );\r
\r
if( pxNewTCB != NULL )\r
{\r
{\r
/* Could not allocate the stack. Delete the allocated TCB - if\r
it was allocated dynamically. */\r
- if( pxTCBBuffer == NULL )\r
+ if( pxTaskBuffer == NULL )\r
{\r
vPortFree( pxNewTCB );\r
}\r
if( pxStack != NULL )\r
{\r
/* Allocate space for the TCB. */\r
- pxNewTCB = ( TCB_t * ) pvPortMallocAligned( sizeof( TCB_t ), pxTCBBuffer ); /*lint !e961 MISRA exception as the casts are only redundant for some paths. */\r
+ pxNewTCB = ( TCB_t * ) pvPortMallocAligned( sizeof( TCB_t ), pxTaskBuffer ); /*lint !e961 MISRA exception as the casts are only redundant for some paths. */\r
\r
if( pxNewTCB != NULL )\r
{\r
mtCOVERAGE_TEST_MARKER();\r
}\r
\r
- if( pxTCBBuffer != NULL )\r
+ if( pxTaskBuffer != NULL )\r
{\r
/* The application provided its own TCB. Note the fact so no\r
attempt is made to delete the TCB if the task is deleted. */\r
}\r
/*-----------------------------------------------------------*/\r
\r
-TimerHandle_t xTimerGenericCreate( const char * const pcTimerName, const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void * const pvTimerID, TimerCallbackFunction_t pxCallbackFunction, StaticTimer_t *pxStaticTimer ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+TimerHandle_t xTimerGenericCreate( const char * const pcTimerName, const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void * const pvTimerID, TimerCallbackFunction_t pxCallbackFunction, StaticTimer_t *pxTimerBuffer ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
{\r
Timer_t *pxNewTimer;\r
\r
{\r
/* If the user passed in a statically allocated timer structure then use\r
it, otherwise allocate the structure dynamically. */\r
- if( pxStaticTimer == NULL )\r
+ if( pxTimerBuffer == NULL )\r
{\r
pxNewTimer = ( Timer_t * ) pvPortMalloc( sizeof( Timer_t ) );\r
}\r
else\r
{\r
- pxNewTimer = ( Timer_t * ) pxStaticTimer;\r
+ pxNewTimer = ( Timer_t * ) pxTimerBuffer;\r
}\r
\r
if( pxNewTimer != NULL )\r
pxNewTimer->pxCallbackFunction = pxCallbackFunction;\r
vListInitialiseItem( &( pxNewTimer->xTimerListItem ) );\r
\r
- if( pxStaticTimer == NULL )\r
+ #if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
{\r
- pxNewTimer->ucStaticallyAllocated = pdFALSE;\r
- }\r
- else\r
- {\r
- pxNewTimer->ucStaticallyAllocated = pdTRUE;\r
+ if( pxTimerBuffer == NULL )\r
+ {\r
+ pxNewTimer->ucStaticallyAllocated = pdFALSE;\r
+ }\r
+ else\r
+ {\r
+ pxNewTimer->ucStaticallyAllocated = pdTRUE;\r
+ }\r
}\r
+ #endif /* configSUPPORT_STATIC_ALLOCATION */\r
\r
traceTIMER_CREATE( pxNewTimer );\r
}\r
/* The timer has already been removed from the active list,\r
just free up the memory if the memory was dynamically\r
allocated. */\r
- if( pxTimer->ucStaticallyAllocated == pdFALSE )\r
+ #if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
{\r
- vPortFree( pxTimer );\r
+ if( pxTimer->ucStaticallyAllocated == pdFALSE )\r
+ {\r
+ vPortFree( pxTimer );\r
+ }\r
+ else\r
+ {\r
+ mtCOVERAGE_TEST_MARKER();\r
+ }\r
}\r
- else\r
+ #else\r
{\r
- mtCOVERAGE_TEST_MARKER();\r
+ vPortFree( pxTimer );\r
}\r
+ #endif /* configSUPPORT_STATIC_ALLOCATION */\r
break;\r
\r
default :\r