]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/Common/Minimal/AbortDelay.c
Notes:
[freertos] / FreeRTOS / Demo / Common / Minimal / AbortDelay.c
index ffef52174a3627af0e67980cc543453f6fcc7d7b..b38e94464da73510e460134eb28962a0c9732f2b 100644 (file)
@@ -398,13 +398,23 @@ uint32_t ulReturn;
 static void prvTestAbortingEventGroupWait( void )\r
 {\r
 TickType_t xTimeAtStart;\r
-static StaticEventGroup_t xEventGroupBuffer;\r
 EventGroupHandle_t xEventGroup;\r
 EventBits_t xBitsToWaitFor = ( EventBits_t ) 0x01, xReturn;\r
 \r
-       /* Create the event group.  Statically allocated memory is used so the\r
-       creation cannot fail. */\r
-       xEventGroup = xEventGroupCreateStatic( &xEventGroupBuffer );\r
+       #if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
+       {\r
+               static StaticEventGroup_t xEventGroupBuffer;\r
+\r
+               /* Create the event group.  Statically allocated memory is used so the\r
+               creation cannot fail. */\r
+               xEventGroup = xEventGroupCreateStatic( &xEventGroupBuffer );\r
+       }\r
+       #else\r
+       {\r
+               xEventGroup = xEventGroupCreate();\r
+               configASSERT( xEventGroup );\r
+       }\r
+       #endif\r
 \r
        /* Note the time before the delay so the length of the delay is known. */\r
        xTimeAtStart = xTaskGetTickCount();\r
@@ -449,14 +459,25 @@ static void prvTestAbortingQueueSend( void )
 {\r
 TickType_t xTimeAtStart;\r
 BaseType_t xReturn;\r
-static StaticQueue_t xQueueBuffer;\r
-static uint8_t ucQueueStorage[ sizeof( uint8_t ) ], ucItemToQueue;\r
 const UBaseType_t xQueueLength = ( UBaseType_t ) 1;\r
 QueueHandle_t xQueue;\r
+uint8_t ucItemToQueue;\r
 \r
-       /* Create the queue.  Statically allocated memory is used so the\r
-       creation cannot fail. */\r
-       xQueue = xQueueCreateStatic( xQueueLength, sizeof( uint8_t ), ucQueueStorage, &xQueueBuffer );\r
+       #if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
+       {\r
+               static StaticQueue_t xQueueBuffer;\r
+               static uint8_t ucQueueStorage[ sizeof( uint8_t ) ];\r
+\r
+               /* Create the queue.  Statically allocated memory is used so the\r
+               creation cannot fail. */\r
+               xQueue = xQueueCreateStatic( xQueueLength, sizeof( uint8_t ), ucQueueStorage, &xQueueBuffer );\r
+       }\r
+       #else\r
+       {\r
+               xQueue = xQueueCreate( xQueueLength, sizeof( uint8_t ) );\r
+               configASSERT( xQueue );\r
+       }\r
+       #endif\r
 \r
        /* This function tests aborting when in the blocked state waiting to send,\r
        so the queue must be full.  There is only one space in the queue. */\r
@@ -509,12 +530,21 @@ static void prvTestAbortingSemaphoreTake( void )
 {\r
 TickType_t xTimeAtStart;\r
 BaseType_t xReturn;\r
-static StaticSemaphore_t xSemaphoreBuffer;\r
 SemaphoreHandle_t xSemaphore;\r
 \r
-       /* Create the semaphore.  Statically allocated memory is used so the\r
-       creation cannot fail. */\r
-       xSemaphore = xSemaphoreCreateBinaryStatic( &xSemaphoreBuffer );\r
+       #if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
+       {\r
+               static StaticSemaphore_t xSemaphoreBuffer;\r
+\r
+               /* Create the semaphore.  Statically allocated memory is used so the\r
+               creation cannot fail. */\r
+               xSemaphore = xSemaphoreCreateBinaryStatic( &xSemaphoreBuffer );\r
+       }\r
+       #else\r
+       {\r
+               xSemaphore = xSemaphoreCreateBinary();\r
+       }\r
+       #endif\r
 \r
        /* Note the time before the delay so the length of the delay is known. */\r
        xTimeAtStart = xTaskGetTickCount();\r