]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/CORTEX_M4_ATSAM4E_Atmel_Studio/src/main_full.c
Add event groups demo to SAM4E demo.
[freertos] / FreeRTOS / Demo / CORTEX_M4_ATSAM4E_Atmel_Studio / src / main_full.c
index 4274014c87c7923f10f27806a9ecae55537ffb31..1f4840c00aa38f74bb88a91f03eef7fa71ac4e9b 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
+    FreeRTOS V8.0.0:rc1 - Copyright (C) 2014 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
 #include "QueueOverwrite.h"\r
 #include "QueueSet.h"\r
 #include "recmutex.h"\r
+#include "EventGroupsDemo.h"\r
 \r
 /* The period after which the check timer will expire, in ms, provided no errors\r
 have been reported by any of the standard demo tasks.  ms are converted to the\r
-equivalent in ticks using the portTICK_RATE_MS constant. */\r
-#define mainCHECK_TIMER_PERIOD_MS                      ( 3000UL / portTICK_RATE_MS )\r
+equivalent in ticks using the portTICK_PERIOD_MS constant. */\r
+#define mainCHECK_TIMER_PERIOD_MS                      ( 3000UL / portTICK_PERIOD_MS )\r
 \r
 /* The period at which the check timer will expire, in ms, if an error has been\r
 reported in one of the standard demo tasks.  ms are converted to the equivalent\r
-in ticks using the portTICK_RATE_MS constant. */\r
-#define mainERROR_CHECK_TIMER_PERIOD_MS        ( 200UL / portTICK_RATE_MS )\r
+in ticks using the portTICK_PERIOD_MS constant. */\r
+#define mainERROR_CHECK_TIMER_PERIOD_MS        ( 200UL / portTICK_PERIOD_MS )\r
 \r
 /* The priorities of the various demo application tasks. */\r
 #define mainSEM_TEST_PRIORITY                          ( tskIDLE_PRIORITY + 1 )\r
@@ -178,10 +179,11 @@ http://www.FreeRTOS.org/udp */
 #define mainCONNECTED_IP_TASK_PRIORITY         ( configMAX_PRIORITIES - 1 )\r
 #define mainDISCONNECTED_IP_TASK_PRIORITY      ( tskIDLE_PRIORITY )\r
 \r
-/* UDP command server task parameters. */\r
+/* UDP command server and echo task parameters. */\r
 #define mainUDP_CLI_TASK_PRIORITY                      ( tskIDLE_PRIORITY )\r
 #define mainUDP_CLI_PORT_NUMBER                                ( 5001UL )\r
 #define mainUDP_CLI_TASK_STACK_SIZE                    ( configMINIMAL_STACK_SIZE * 2U )\r
+#define mainECHO_CLIENT_STACK_SIZE                     ( configMINIMAL_STACK_SIZE + 30 )\r
 \r
 /* Set to 1 to include the UDP echo client tasks in the build.  The echo clients\r
 require the IP address of the echo server to be defined using the\r
@@ -194,7 +196,7 @@ FreeRTOSConfig.h. */
 /*\r
  * The check timer callback function, as described at the top of this file.\r
  */\r
-static void prvCheckTimerCallback( xTimerHandle xTimer );\r
+static void prvCheckTimerCallback( TimerHandle_t xTimer );\r
 \r
 /*\r
  * Creates a set of sample files on a RAM disk.  http://www.FreeRTOS.org/fat_sl\r
@@ -243,7 +245,7 @@ const uint8_t ucMACAddress[ 6 ] = { configMAC_ADDR0, configMAC_ADDR1, configMAC_
 \r
 int main_full( void )\r
 {\r
-xTimerHandle xTimer = NULL;\r
+TimerHandle_t xTimer = NULL;\r
 \r
        /* Usage instructions on http://www.FreeRTOS.org/Atmel_SAM4E_RTOS_Demo.html */\r
 \r
@@ -293,14 +295,15 @@ xTimerHandle xTimer = NULL;
        vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_TASK_PRIORITY );\r
        vStartQueueSetTasks();\r
        vStartRecursiveMutexTasks();\r
+       vStartEventGroupTasks();\r
 \r
        /* Create the software timer that performs the 'check' functionality, as\r
        described at the top of this file. */\r
-       xTimer = xTimerCreate(  ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */\r
-                                                       ( mainCHECK_TIMER_PERIOD_MS ),          /* The timer period, in this case 3000ms (3s). */\r
-                                                       pdTRUE,                                                         /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */\r
-                                                       ( void * ) 0,                                           /* The ID is not used, so can be set to anything. */\r
-                                                       prvCheckTimerCallback );                        /* The callback function that inspects the status of all the other tasks. */\r
+       xTimer = xTimerCreate(  "CheckTimer",                                   /* A text name, purely to help debugging. */\r
+                                                       ( mainCHECK_TIMER_PERIOD_MS ),  /* The timer period, in this case 3000ms (3s). */\r
+                                                       pdTRUE,                                                 /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */\r
+                                                       ( void * ) 0,                                   /* The ID is not used, so can be set to anything. */\r
+                                                       prvCheckTimerCallback );                /* The callback function that inspects the status of all the other tasks. */\r
 \r
        if( xTimer != NULL )\r
        {\r
@@ -319,7 +322,7 @@ xTimerHandle xTimer = NULL;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-static void prvCheckTimerCallback( xTimerHandle xTimer )\r
+static void prvCheckTimerCallback( TimerHandle_t xTimer )\r
 {\r
 static long lChangedTimerPeriodAlready = pdFALSE;\r
 unsigned long ulErrorOccurred = pdFALSE;\r
@@ -365,6 +368,10 @@ unsigned long ulErrorOccurred = pdFALSE;
        {\r
                ulErrorOccurred |= ( 0x01UL << 12UL );\r
        }\r
+       else if( xAreEventGroupTasksStillRunning() != pdTRUE )\r
+       {\r
+               ulErrorOccurred |= ( 0x01UL << 13UL );\r
+       }\r
 \r
        if( ulErrorOccurred != pdFALSE )\r
        {\r
@@ -422,7 +429,7 @@ char cIPAddress[ 20 ];
                                address of the echo server to be defined using the\r
                                configECHO_SERVER_ADDR0 to configECHO_SERVER_ADDR3 constants in\r
                                FreeRTOSConfig.h. */\r
-                               vStartEchoClientTasks( configMINIMAL_STACK_SIZE, tskIDLE_PRIORITY );\r
+                               vStartEchoClientTasks( mainECHO_CLIENT_STACK_SIZE, tskIDLE_PRIORITY );\r
                        }\r
                        #endif\r
                }\r
@@ -448,7 +455,7 @@ char cIPAddress[ 20 ];
                for a new connection by lowering the priority of the IP task to that of\r
                the Idle task. */\r
                vTaskPrioritySet( NULL, tskIDLE_PRIORITY );\r
-               \r
+\r
                /* Disconnected - so no IP address. */\r
                ili93xx_draw_string( ulXCoord, ulYCoord, ( uint8_t * ) "IP:                  " );\r
        }\r
@@ -487,6 +494,9 @@ void vFullDemoTickHook( void )
 \r
        /* Call the periodic queue set ISR test function. */\r
        vQueueSetAccessQueueSetFromISR();\r
+       \r
+       /* Call the event group ISR tests. */\r
+       vPeriodicEventGroupsProcessing();\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r