]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/WIN32-MSVC/main_full.c
Prepare for a FreeRTOS V9 release candidate:
[freertos] / FreeRTOS / Demo / WIN32-MSVC / main_full.c
index d01969926523604c74107dbc09086b62e38d2a87..86c866c17e884975e1be76c909c5365168460178 100644 (file)
 #include "TaskNotify.h"\r
 #include "QueueSetPolling.h"\r
 #include "StaticAllocation.h"\r
+#include "blocktim.h"\r
+#include "AbortDelay.h"\r
 \r
 /* Priorities at which the tasks are created. */\r
 #define mainCHECK_TASK_PRIORITY                        ( configMAX_PRIORITIES - 2 )\r
@@ -181,6 +183,12 @@ static void prvPendedFunction( void *pvParameter1, uint32_t ulParameter2 );
  */\r
 static void prvDemoQueueSpaceFunctions( void *pvParameters );\r
 \r
+/*\r
+ * Tasks that ensure indefinite delays are truly indefinite.\r
+ */\r
+static void prvPermanentlyBlockingSemaphoreTask( void *pvParameters );\r
+static void prvPermanentlyBlockingNotificationTask( void *pvParameters );\r
+\r
 /*-----------------------------------------------------------*/\r
 \r
 /* The variable into which error messages are latched. */\r
@@ -214,7 +222,11 @@ int main_full( void )
        vStartEventGroupTasks();\r
        vStartInterruptSemaphoreTasks();\r
        vStartQueueSetPollingTask();\r
+       vCreateBlockTimeTasks();\r
+       vCreateAbortDelayTasks();\r
        xTaskCreate( prvDemoQueueSpaceFunctions, "QSpace", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
+       xTaskCreate( prvPermanentlyBlockingSemaphoreTask, "BlockSem", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
+       xTaskCreate( prvPermanentlyBlockingNotificationTask, "BlockNoti", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
 \r
        #if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
        {\r
@@ -242,9 +254,9 @@ int main_full( void )
        /* Start the scheduler itself. */\r
        vTaskStartScheduler();\r
 \r
-    /* Should never get here unless there was not enough heap space to create\r
+       /* Should never get here unless there was not enough heap space to create\r
        the idle and other system tasks. */\r
-    return 0;\r
+       return 0;\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -344,6 +356,14 @@ const TickType_t xCycleFrequency = pdMS_TO_TICKS( 2500UL );
                {\r
                        pcStatusMessage = "Error: Queue set polling";\r
                }\r
+               else if( xAreBlockTimeTestTasksStillRunning() != pdPASS )\r
+               {\r
+                       pcStatusMessage = "Error: Block time";\r
+               }\r
+               else if( xAreAbortDelayTestTasksStillRunning() != pdPASS )\r
+               {\r
+                       pcStatusMessage = "Error: Abort delay";\r
+               }\r
 \r
                #if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
                        else if( xAreStaticAllocationTasksStillRunning() != pdPASS )\r
@@ -671,5 +691,35 @@ unsigned portBASE_TYPE uxReturn, x;
                #endif\r
        }\r
 }\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvPermanentlyBlockingSemaphoreTask( void *pvParameters )\r
+{\r
+SemaphoreHandle_t xSemaphore;\r
+\r
+       /* This task should block on a semaphore, and never return. */\r
+       xSemaphore = xSemaphoreCreateBinary();\r
+       configASSERT( xSemaphore );\r
+\r
+       xSemaphoreTake( xSemaphore, portMAX_DELAY );\r
+\r
+       /* The above xSemaphoreTake() call should never return, force an assert if\r
+       it does. */\r
+       configASSERT( pvParameters != NULL );\r
+       vTaskDelete( NULL );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvPermanentlyBlockingNotificationTask( void *pvParameters )\r
+{\r
+       /* This task should block on a task notification, and never return. */\r
+       ulTaskNotifyTake( pdTRUE, portMAX_DELAY );\r
+\r
+       /* The above ulTaskNotifyTake() call should never return, force an assert\r
+       if it does. */\r
+       configASSERT( pvParameters != NULL );\r
+       vTaskDelete( NULL );\r
+}\r
+\r
 \r
 \r