]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/tasks.c
Rename DummyTCB_t to StaticTCB_t.
[freertos] / FreeRTOS / Source / tasks.c
index c3c343ab43bf4142b92c13a9b00ac9ae2bbbafa4..dcd1379232cf214b4ac4b3641559d3fcbe29dffb 100644 (file)
@@ -122,12 +122,12 @@ functions but without including stdio.h here. */
        #define taskYIELD_IF_USING_PREEMPTION() portYIELD_WITHIN_API()\r
 #endif\r
 \r
-/* Bits that can be set in tskTCB->uxStaticAllocationFlags to indicate that the\r
+/* Bits that can be set in tskTCB->ucStaticAllocationFlags to indicate that the\r
 stack and TCB were statically allocated respectively.  When these are statically\r
 allocated they won't be freed if the task using the stack and TCB gets\r
 deleted. */\r
-#define taskSTATICALLY_ALLOCATED_STACK ( ( UBaseType_t ) 0x01 )\r
-#define taskSTATICALLY_ALLOCATED_TCB   ( ( UBaseType_t ) 0x02 )\r
+#define taskSTATICALLY_ALLOCATED_STACK ( ( uint8_t ) 0x01 )\r
+#define taskSTATICALLY_ALLOCATED_TCB   ( ( uint8_t ) 0x02 )\r
 \r
 /*\r
  * Task control block.  A task control block (TCB) is allocated for each task,\r
@@ -195,7 +195,7 @@ typedef struct tskTaskControlBlock
        #endif\r
 \r
        #if ( configSUPPORT_STATIC_ALLOCATION == 1 )\r
-               UBaseType_t             uxStaticAllocationFlags; /* Set to pdTRUE if the stack is a statically allocated array, and pdFALSE if the stack is dynamically allocated. */\r
+               uint8_t         ucStaticAllocationFlags; /* Set to pdTRUE if the stack is a statically allocated array, and pdFALSE if the stack is dynamically allocated. */\r
        #endif\r
 \r
        } tskTCB;\r
@@ -426,7 +426,7 @@ to its original value when it is released. */
 #endif\r
 \r
 #if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
-       extern void vApplicationGetIdleTaskMemory( DummyTCB_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint16_t *pusIdleTaskStackSize );\r
+       extern void vApplicationGetIdleTaskMemory( StaticTCB_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint16_t *pusIdleTaskStackSize );\r
 #endif\r
 \r
 /* File private functions. --------------------------------*/\r
@@ -554,7 +554,7 @@ static void prvResetNextTaskUnblockTime( void );
 #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, DummyTCB_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, StaticTCB_t * const pxTCBBuffer, 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
@@ -1546,7 +1546,7 @@ StackType_t *pxTopOfStack;
 void vTaskStartScheduler( void )\r
 {\r
 BaseType_t xReturn;\r
-DummyTCB_t *pxIdleTaskTCBBuffer = NULL;\r
+StaticTCB_t *pxIdleTaskTCBBuffer = NULL;\r
 StackType_t *pxIdleTaskStackBuffer = NULL;\r
 uint16_t usIdleTaskStackSize = tskIDLE_STACK_SIZE;\r
 \r
@@ -3149,9 +3149,12 @@ static TCB_t *prvAllocateTCBAndStack( const uint16_t usStackDepth, StackType_t *
 {\r
 TCB_t *pxNewTCB;\r
 \r
-       #if( configASSERT_DEFINED == 1 )\r
+       #if( ( configASSERT_DEFINED == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )\r
        {\r
-               volatile size_t xSize = sizeof( DummyTCB_t );\r
+               /* Sanity check that the size of the structure used to declare a\r
+               variable of type StaticTCB_t matches the size of the actual TCB_t\r
+               structure. */\r
+               volatile size_t xSize = sizeof( StaticTCB_t );\r
                configASSERT( xSize == sizeof( TCB_t ) );\r
        }\r
        #endif /* configASSERT_DEFINED */\r
@@ -3234,13 +3237,13 @@ TCB_t *pxNewTCB;
 \r
                #if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
                {\r
-                       pxNewTCB->uxStaticAllocationFlags = 0;\r
+                       pxNewTCB->ucStaticAllocationFlags = 0;\r
 \r
                        if( puxStackBuffer != NULL )\r
                        {\r
                                /* The application provided its own stack - note the fact so no\r
                                attempt is made to delete the stack if the task is deleted. */\r
-                               pxNewTCB->uxStaticAllocationFlags |= taskSTATICALLY_ALLOCATED_STACK;\r
+                               pxNewTCB->ucStaticAllocationFlags |= taskSTATICALLY_ALLOCATED_STACK;\r
                        }\r
                        else\r
                        {\r
@@ -3251,7 +3254,7 @@ TCB_t *pxNewTCB;
                        {\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
-                               pxNewTCB->uxStaticAllocationFlags |= taskSTATICALLY_ALLOCATED_TCB;\r
+                               pxNewTCB->ucStaticAllocationFlags |= taskSTATICALLY_ALLOCATED_TCB;\r
                        }\r
                        else\r
                        {\r
@@ -3419,7 +3422,7 @@ TCB_t *pxNewTCB;
                {\r
                        /* Only free the stack and TCB if they were allocated dynamically in\r
                        the first place. */\r
-                       if( ( pxTCB->uxStaticAllocationFlags & taskSTATICALLY_ALLOCATED_STACK ) == ( UBaseType_t ) 0 )\r
+                       if( ( pxTCB->ucStaticAllocationFlags & taskSTATICALLY_ALLOCATED_STACK ) == ( UBaseType_t ) 0 )\r
                        {\r
                                vPortFreeAligned( pxTCB->pxStack );\r
                        }\r
@@ -3428,7 +3431,7 @@ TCB_t *pxNewTCB;
                                mtCOVERAGE_TEST_MARKER();\r
                        }\r
 \r
-                       if( ( pxTCB->uxStaticAllocationFlags & taskSTATICALLY_ALLOCATED_TCB ) == ( UBaseType_t ) 0 )\r
+                       if( ( pxTCB->ucStaticAllocationFlags & taskSTATICALLY_ALLOCATED_TCB ) == ( UBaseType_t ) 0 )\r
                        {\r
                                vPortFreeAligned( pxTCB );\r
                        }\r