]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/Common/Minimal/EventGroupsDemo.c
Import the code coverage test additions from the (unpublished) Visual Studio project...
[freertos] / FreeRTOS / Demo / Common / Minimal / EventGroupsDemo.c
index 22b7fb81d659c5a39347bbbe63770dc4aca878c1..abd72e878673ab80a567200a8ec8e2e4a10b021d 100644 (file)
@@ -78,6 +78,7 @@ that synchronise with the xEventGroupSync() function. */
 \r
 /* A block time of zero simply means "don't block". */\r
 #define ebDONT_BLOCK   ( 0 )\r
+#define ebONE_TICK             ( ( TickType_t ) 1 )\r
 \r
 /* A 5ms delay. */\r
 #define ebSHORT_DELAY  pdMS_TO_TICKS( ( TickType_t ) 5 )\r
@@ -281,7 +282,29 @@ EventBits_t uxSynchronisationBit, uxReturned;
                /* Set the bit that indicates this task is at the synchronisation\r
                point.  The first time this is done the 'test master' task has a lower\r
                priority than this task so this task will get to the sync point before\r
-               the set bits task. */\r
+               the set bits task - test this by first calling xEventGroupSync() with\r
+               a zero block time, and a block time that is too short for the other\r
+               task, before calling again with a max delay - the first two calls should\r
+               return before the rendezvous completes, the third only after the\r
+               rendezvous is complete. */\r
+               uxReturned = xEventGroupSync( xEventGroup,      /* The event group used for the synchronisation. */\r
+                                                                         uxSynchronisationBit, /* The bit to set in the event group to indicate this task is at the sync point. */\r
+                                                                         ebALL_SYNC_BITS,/* The bits to wait for - these bits are set by the other tasks taking part in the sync. */\r
+                                                                         ebDONT_BLOCK ); /* The maximum time to wait for the sync condition to be met before giving up. */\r
+\r
+               /* No block time was specified, so as per the comments above, the\r
+               rendezvous is not expected to have completed yet. */\r
+               configASSERT( ( uxReturned & ebALL_SYNC_BITS ) != ebALL_SYNC_BITS );\r
+\r
+               uxReturned = xEventGroupSync( xEventGroup,      /* The event group used for the synchronisation. */\r
+                                                                         uxSynchronisationBit, /* The bit to set in the event group to indicate this task is at the sync point. */\r
+                                                                         ebALL_SYNC_BITS, /* The bits to wait for - these bits are set by the other tasks taking part in the sync. */\r
+                                                                         ebONE_TICK ); /* The maximum time to wait for the sync condition to be met before giving up. */\r
+\r
+               /* A short block time was specified, so as per the comments above, the\r
+               rendezvous is not expected to have completed yet. */\r
+               configASSERT( ( uxReturned & ebALL_SYNC_BITS ) != ebALL_SYNC_BITS );\r
+\r
                uxReturned = xEventGroupSync( xEventGroup,      /* The event group used for the synchronisation. */\r
                                                                        uxSynchronisationBit, /* The bit to set in the event group to indicate this task is at the sync point. */\r
                                                                        ebALL_SYNC_BITS,/* The bits to wait for - these bits are set by the other tasks taking part in the sync. */\r