]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/WIN32-MSVC/main_full.c
Add the event group interrupt tests to the Win32 demo projects.
[freertos] / FreeRTOS / Demo / WIN32-MSVC / main_full.c
index 11ac892ae06d7fd3b97ff2456d784034d3498fe5..d7ac74fc8d136a4397e96c12fc2b6da8a0787977 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+    FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
  * application.  It is provided as a convenient development and demonstration\r
  * test bed only.  This was tested using Windows XP on a dual core laptop.\r
  *\r
- * Windows will not be running the FreeRTOS simulator threads continuously, so \r
- * the timing information in the FreeRTOS+Trace logs have no meaningful units.  \r
- * See the documentation page for the Windows simulator for an explanation of \r
+ * Windows will not be running the FreeRTOS simulator threads continuously, so\r
+ * the timing information in the FreeRTOS+Trace logs have no meaningful units.\r
+ * See the documentation page for the Windows simulator for an explanation of\r
  * the slow timing:\r
  * http://www.freertos.org/FreeRTOS-Windows-Simulator-Emulator-for-Visual-Studio-and-Eclipse-MingW.html\r
  * - READ THE WEB DOCUMENTATION FOR THIS PORT FOR MORE INFORMATION ON USING IT -\r
  *\r
  * NOTE 2:  This project provides two demo applications.  A simple blinky style\r
  * project, and a more comprehensive test and demo application.  The\r
- * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select \r
- * between the two.  See the notes on using mainCREATE_SIMPLE_BLINKY_DEMO_ONLY \r
+ * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select\r
+ * between the two.  See the notes on using mainCREATE_SIMPLE_BLINKY_DEMO_ONLY\r
  * in main.c.  This file implements the comprehensive test and demo version.\r
  *\r
  * NOTE 3:  This file only contains the source code that is specific to the\r
- * basic demo.  Generic functions, such FreeRTOS hook functions, are defined in \r
+ * basic demo.  Generic functions, such FreeRTOS hook functions, are defined in\r
  * main.c.\r
  *******************************************************************************\r
  *\r
- * main() creates all the demo application tasks, then starts the scheduler.  \r
- * The web documentation provides more details of the standard demo application \r
- * tasks, which provide no particular functionality but do provide a good \r
+ * main() creates all the demo application tasks, then starts the scheduler.\r
+ * The web documentation provides more details of the standard demo application\r
+ * tasks, which provide no particular functionality but do provide a good\r
  * example of how to use the FreeRTOS API.\r
  *\r
  * In addition to the standard demo tasks, the following tasks and tests are\r
 /* Task function prototypes. */\r
 static void prvCheckTask( void *pvParameters );\r
 \r
-/* A task that is created from the idle task to test the functionality of \r
+/* A task that is created from the idle task to test the functionality of\r
 eTaskStateGet(). */\r
 static void prvTestTask( void *pvParameters );\r
 \r
@@ -181,7 +181,7 @@ static xSemaphoreHandle xMutexToDelete = NULL;
 int main_full( void )\r
 {\r
        /* Start the check task as described at the top of this file. */\r
-       xTaskCreate( prvCheckTask, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
+       xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
 \r
        /* Create the standard demo tasks. */\r
        vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );\r
@@ -191,12 +191,12 @@ int main_full( void )
        vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );\r
        vStartQueuePeekTasks();\r
        vStartMathTasks( mainFLOP_TASK_PRIORITY );\r
-       vStartRecursiveMutexTasks();    \r
+       vStartRecursiveMutexTasks();\r
        vStartCountingSemaphoreTasks();\r
        vStartDynamicPriorityTasks();\r
        vStartQueueSetTasks();\r
-       vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY );       \r
-       xTaskCreate( prvDemoQueueSpaceFunctions, ( signed char * ) "QSpace", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
+       vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY );\r
+       xTaskCreate( prvDemoQueueSpaceFunctions, "QSpace", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
        vStartEventGroupTasks();\r
 \r
        #if( configUSE_PREEMPTION != 0  )\r
@@ -207,8 +207,8 @@ int main_full( void )
        #endif\r
 \r
        /* The suicide tasks must be created last as they need to know how many\r
-       tasks were running prior to their creation.  This then allows them to \r
-       ascertain whether or not the correct/expected number of tasks are running at \r
+       tasks were running prior to their creation.  This then allows them to\r
+       ascertain whether or not the correct/expected number of tasks are running at\r
        any given time. */\r
        vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );\r
 \r
@@ -219,7 +219,7 @@ 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
 }\r
@@ -259,9 +259,9 @@ const portTickType xCycleFrequency = 2500 / portTICK_RATE_MS;
            else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )\r
            {\r
                        pcStatusMessage = "Error: IntMath";\r
-           }   \r
+           }\r
                else if( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
-               {                       \r
+               {\r
                        pcStatusMessage = "Error: GenQueue";\r
                }\r
                else if( xAreQueuePeekTasksStillRunning() != pdTRUE )\r
@@ -309,7 +309,7 @@ const portTickType xCycleFrequency = 2500 / portTICK_RATE_MS;
                        pcStatusMessage = "Error: Queue overwrite";\r
                }\r
 \r
-               /* This is the only task that uses stdout so its ok to call printf() \r
+               /* This is the only task that uses stdout so its ok to call printf()\r
                directly. */\r
                printf( "%s - %d\r\n", pcStatusMessage, xTaskGetTickCount() );\r
        }\r
@@ -345,7 +345,7 @@ void *pvAllocated;
 direct use from application code, hence their prototypes are not in queue.h. */\r
 extern void vQueueSetQueueNumber( xQueueHandle pxQueue, unsigned portBASE_TYPE uxQueueNumber );\r
 extern unsigned portBASE_TYPE uxQueueGetQueueNumber( xQueueHandle pxQueue );\r
-extern unsigned char ucQueueGetQueueType( xQueueHandle pxQueue );\r
+extern uint8_t ucQueueGetQueueType( xQueueHandle pxQueue );\r
 extern void vTaskSetTaskNumber( xTaskHandle xTask, unsigned portBASE_TYPE uxHandle );\r
 extern unsigned portBASE_TYPE uxTaskGetTaskNumber( xTaskHandle xTask );\r
 \r
@@ -358,7 +358,7 @@ extern unsigned portBASE_TYPE uxTaskGetTaskNumber( xTaskHandle xTask );
        prvDemonstrateTaskStateAndHandleGetFunctions();\r
 \r
        /* If xMutexToDelete has not already been deleted, then delete it now.\r
-       This is done purely to demonstrate the use of, and test, the \r
+       This is done purely to demonstrate the use of, and test, the\r
        vSemaphoreDelete() macro.  Care must be taken not to delete a semaphore\r
        that has tasks blocked on it. */\r
        if( xMutexToDelete != NULL )\r
@@ -377,7 +377,7 @@ extern unsigned portBASE_TYPE uxTaskGetTaskNumber( xTaskHandle xTask );
                xMutexToDelete = NULL;\r
        }\r
 \r
-       /* Exercise heap_4 a bit.  The malloc failed hook will trap failed \r
+       /* Exercise heap_4 a bit.  The malloc failed hook will trap failed\r
        allocations so there is no need to test here. */\r
        pvAllocated = pvPortMalloc( ( rand() % 100 ) + 1 );\r
        vPortFree( pvAllocated );\r
@@ -399,9 +399,12 @@ void vFullDemoTickHookFunction( void )
        /* Call the periodic queue overwrite from ISR demo. */\r
        vQueueOverwritePeriodicISRDemo();\r
 \r
-       /* Write to a queue that is in use as part of the queue set demo to \r
+       /* Write to a queue that is in use as part of the queue set demo to\r
        demonstrate using queue sets from an ISR. */\r
        vQueueSetAccessQueueSetFromISR();\r
+\r
+       /* Exercise event groups from interrupts. */\r
+       vPeriodicEventGroupsProcessing();\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -413,7 +416,7 @@ signed char *pcTaskName;
 static portBASE_TYPE xPerformedOneShotTests = pdFALSE;\r
 xTaskHandle xTestTask;\r
 \r
-       /* Demonstrate the use of the xTimerGetTimerDaemonTaskHandle() and \r
+       /* Demonstrate the use of the xTimerGetTimerDaemonTaskHandle() and\r
        xTaskGetIdleTaskHandle() functions.  Also try using the function that sets\r
        the task number. */\r
        xIdleTaskHandle = xTaskGetIdleTaskHandle();\r
@@ -421,7 +424,7 @@ xTaskHandle xTestTask;
        vTaskSetTaskNumber( xIdleTaskHandle, ( unsigned long ) ucConstTaskNumber );\r
        configASSERT( uxTaskGetTaskNumber( xIdleTaskHandle ) == ucConstTaskNumber );\r
 \r
-       /* This is the idle hook, so the current task handle should equal the \r
+       /* This is the idle hook, so the current task handle should equal the\r
        returned idle task handle. */\r
        if( xTaskGetCurrentTaskHandle() != xIdleTaskHandle )\r
        {\r
@@ -502,7 +505,7 @@ unsigned portBASE_TYPE uxReturn, x;
                {\r
                        /* Ask how many messages are available... */\r
                        uxReturn = uxQueueMessagesWaiting( xQueue );\r
-                       \r
+\r
                        /* Check the number of messages being reported as being available\r
                        is as expected, and force an assert if not. */\r
                        if( uxReturn != x )\r
@@ -514,7 +517,7 @@ unsigned portBASE_TYPE uxReturn, x;
 \r
                        /* Ask how many spaces remain in the queue... */\r
                        uxReturn = uxQueueSpacesAvailable( xQueue );\r
-                       \r
+\r
                        /* Check the number of spaces being reported as being available\r
                        is as expected, and force an assert if not. */\r
                        if( uxReturn != ( uxQueueLength - x ) )\r
@@ -536,7 +539,7 @@ unsigned portBASE_TYPE uxReturn, x;
                }\r
 \r
                uxReturn = uxQueueSpacesAvailable( xQueue );\r
-                       \r
+\r
                if( uxReturn != 0 )\r
                {\r
                        configASSERT( xQueue == NULL );\r