]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/event_groups.c
Update version numbers ready for release.
[freertos] / FreeRTOS / Source / event_groups.c
index 4d0ba5b8ad0705627a699e3a44a363972569a652..37e6f1f41e9f68c3ccf5bf858202e0abe03e46d6 100644 (file)
@@ -1,71 +1,29 @@
 /*\r
-    FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.\r
-    All rights reserved\r
-\r
-    VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
-\r
-    This file is part of the FreeRTOS distribution.\r
-\r
-    FreeRTOS is free software; you can redistribute it and/or modify it under\r
-    the terms of the GNU General Public License (version 2) as published by the\r
-    Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.\r
-\r
-    ***************************************************************************\r
-    >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
-    >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
-    >>!   obliged to provide the source code for proprietary components     !<<\r
-    >>!   outside of the FreeRTOS kernel.                                   !<<\r
-    ***************************************************************************\r
-\r
-    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
-    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
-    FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
-    link: http://www.freertos.org/a00114.html\r
-\r
-    ***************************************************************************\r
-     *                                                                       *\r
-     *    FreeRTOS provides completely free yet professionally developed,    *\r
-     *    robust, strictly quality controlled, supported, and cross          *\r
-     *    platform software that is more than just the market leader, it     *\r
-     *    is the industry's de facto standard.                               *\r
-     *                                                                       *\r
-     *    Help yourself get started quickly while simultaneously helping     *\r
-     *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
-     *    tutorial book, reference manual, or both:                          *\r
-     *    http://www.FreeRTOS.org/Documentation                              *\r
-     *                                                                       *\r
-    ***************************************************************************\r
-\r
-    http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading\r
-    the FAQ page "My application does not run, what could be wrong?".  Have you\r
-    defined configASSERT()?\r
-\r
-    http://www.FreeRTOS.org/support - In return for receiving this top quality\r
-    embedded software for free we request you assist our global community by\r
-    participating in the support forum.\r
-\r
-    http://www.FreeRTOS.org/training - Investing in training allows your team to\r
-    be as productive as possible as early as possible.  Now you can receive\r
-    FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
-    Ltd, and the world's leading authority on the world's leading RTOS.\r
-\r
-    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
-    including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
-    compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
-\r
-    http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
-    Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
-\r
-    http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
-    Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
-    licenses offer ticketed support, indemnification and commercial middleware.\r
-\r
-    http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
-    engineered and independently SIL3 certified version for use in safety and\r
-    mission critical applications that require provable dependability.\r
-\r
-    1 tab == 4 spaces!\r
-*/\r
+ * FreeRTOS Kernel V10.1.1\r
+ * Copyright (C) 2018 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ *\r
+ * http://www.FreeRTOS.org\r
+ * http://aws.amazon.com/freertos\r
+ *\r
+ * 1 tab == 4 spaces!\r
+ */\r
 \r
 /* Standard includes. */\r
 #include <stdlib.h>\r
@@ -81,11 +39,11 @@ task.h is included from an application file. */
 #include "timers.h"\r
 #include "event_groups.h"\r
 \r
-/* Lint e961 and e750 are suppressed as a MISRA exception justified because the\r
-MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be defined for the\r
-header files above, but not in this file, in order to generate the correct\r
-privileged Vs unprivileged linkage and placement. */\r
-#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e961 !e750. */\r
+/* Lint e961, e750 and e9021 are suppressed as a MISRA exception justified\r
+because the MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be defined\r
+for the header files above, but not in this file, in order to generate the\r
+correct privileged Vs unprivileged linkage and placement. */\r
+#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e961 !e750 !e9021 See comment above. */\r
 \r
 /* The following bit fields convey control information in a task's event list\r
 item value.  It is important they don't clash with the\r
@@ -102,7 +60,7 @@ taskEVENT_LIST_ITEM_VALUE_IN_USE definition. */
        #define eventEVENT_BITS_CONTROL_BYTES   0xff000000UL\r
 #endif\r
 \r
-typedef struct xEventGroupDefinition\r
+typedef struct EventGroupDef_t\r
 {\r
        EventBits_t uxEventBits;\r
        List_t xTasksWaitingForBits;            /*< List of tasks waiting for a bit to be set. */\r
@@ -111,8 +69,8 @@ typedef struct xEventGroupDefinition
                UBaseType_t uxEventGroupNumber;\r
        #endif\r
 \r
-       #if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
-               uint8_t ucStaticallyAllocated;\r
+       #if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )\r
+               uint8_t ucStaticallyAllocated; /*< Set to pdTRUE if the event group is statically allocated to ensure no attempt is made to free the memory. */\r
        #endif\r
 } EventGroup_t;\r
 \r
@@ -126,55 +84,114 @@ typedef struct xEventGroupDefinition
  * wait condition is met if any of the bits set in uxBitsToWait for are also set\r
  * in uxCurrentEventBits.\r
  */\r
-static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits, const EventBits_t uxBitsToWaitFor, const BaseType_t xWaitForAllBits );\r
+static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits, const EventBits_t uxBitsToWaitFor, const BaseType_t xWaitForAllBits ) PRIVILEGED_FUNCTION;\r
 \r
 /*-----------------------------------------------------------*/\r
 \r
-EventGroupHandle_t xEventGroupGenericCreate( StaticEventGroup_t *pxStaticEventGroup )\r
-{\r
-EventGroup_t *pxEventBits;\r
+#if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
 \r
-       if( pxStaticEventGroup == NULL )\r
+       EventGroupHandle_t xEventGroupCreateStatic( StaticEventGroup_t *pxEventGroupBuffer )\r
        {\r
-               /* The user has not provided a statically allocated event group, so\r
-               create on dynamically. */\r
-               pxEventBits = ( EventGroup_t * ) pvPortMalloc( sizeof( EventGroup_t ) );\r
-       }\r
-       else\r
-       {\r
-               /* The user has provided a statically allocated event group - use it. */\r
-               pxEventBits = ( EventGroup_t * ) pxStaticEventGroup;\r
-       }\r
+       EventGroup_t *pxEventBits;\r
 \r
-       if( pxEventBits != NULL )\r
-       {\r
-               pxEventBits->uxEventBits = 0;\r
-               vListInitialise( &( pxEventBits->xTasksWaitingForBits ) );\r
+               /* A StaticEventGroup_t object must be provided. */\r
+               configASSERT( pxEventGroupBuffer );\r
 \r
-               if( pxStaticEventGroup == NULL )\r
+               #if( configASSERT_DEFINED == 1 )\r
                {\r
-                       pxEventBits->ucStaticallyAllocated = pdFALSE;\r
+                       /* Sanity check that the size of the structure used to declare a\r
+                       variable of type StaticEventGroup_t equals the size of the real\r
+                       event group structure. */\r
+                       volatile size_t xSize = sizeof( StaticEventGroup_t );\r
+                       configASSERT( xSize == sizeof( EventGroup_t ) );\r
+               } /*lint !e529 xSize is referenced if configASSERT() is defined. */\r
+               #endif /* configASSERT_DEFINED */\r
+\r
+               /* The user has provided a statically allocated event group - use it. */\r
+               pxEventBits = ( EventGroup_t * ) pxEventGroupBuffer; /*lint !e740 !e9087 EventGroup_t and StaticEventGroup_t are deliberately aliased for data hiding purposes and guaranteed to have the same size and alignment requirement - checked by configASSERT(). */\r
+\r
+               if( pxEventBits != NULL )\r
+               {\r
+                       pxEventBits->uxEventBits = 0;\r
+                       vListInitialise( &( pxEventBits->xTasksWaitingForBits ) );\r
+\r
+                       #if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )\r
+                       {\r
+                               /* Both static and dynamic allocation can be used, so note that\r
+                               this event group was created statically in case the event group\r
+                               is later deleted. */\r
+                               pxEventBits->ucStaticallyAllocated = pdTRUE;\r
+                       }\r
+                       #endif /* configSUPPORT_DYNAMIC_ALLOCATION */\r
+\r
+                       traceEVENT_GROUP_CREATE( pxEventBits );\r
                }\r
                else\r
                {\r
-                       pxEventBits->ucStaticallyAllocated = pdTRUE;\r
+                       /* xEventGroupCreateStatic should only ever be called with\r
+                       pxEventGroupBuffer pointing to a pre-allocated (compile time\r
+                       allocated) StaticEventGroup_t variable. */\r
+                       traceEVENT_GROUP_CREATE_FAILED();\r
                }\r
 \r
-               traceEVENT_GROUP_CREATE( pxEventBits );\r
+               return pxEventBits;\r
        }\r
-       else\r
+\r
+#endif /* configSUPPORT_STATIC_ALLOCATION */\r
+/*-----------------------------------------------------------*/\r
+\r
+#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )\r
+\r
+       EventGroupHandle_t xEventGroupCreate( void )\r
        {\r
-               traceEVENT_GROUP_CREATE_FAILED();\r
+       EventGroup_t *pxEventBits;\r
+\r
+               /* Allocate the event group.  Justification for MISRA deviation as\r
+               follows:  pvPortMalloc() always ensures returned memory blocks are\r
+               aligned per the requirements of the MCU stack.  In this case\r
+               pvPortMalloc() must return a pointer that is guaranteed to meet the\r
+               alignment requirements of the EventGroup_t structure - which (if you\r
+               follow it through) is the alignment requirements of the TickType_t type\r
+               (EventBits_t being of TickType_t itself).  Therefore, whenever the\r
+               stack alignment requirements are greater than or equal to the\r
+               TickType_t alignment requirements the cast is safe.  In other cases,\r
+               where the natural word size of the architecture is less than\r
+               sizeof( TickType_t ), the TickType_t variables will be accessed in two\r
+               or more reads operations, and the alignment requirements is only that\r
+               of each individual read. */\r
+               pxEventBits = ( EventGroup_t * ) pvPortMalloc( sizeof( EventGroup_t ) ); /*lint !e9087 !e9079 see comment above. */\r
+\r
+               if( pxEventBits != NULL )\r
+               {\r
+                       pxEventBits->uxEventBits = 0;\r
+                       vListInitialise( &( pxEventBits->xTasksWaitingForBits ) );\r
+\r
+                       #if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
+                       {\r
+                               /* Both static and dynamic allocation can be used, so note this\r
+                               event group was allocated statically in case the event group is\r
+                               later deleted. */\r
+                               pxEventBits->ucStaticallyAllocated = pdFALSE;\r
+                       }\r
+                       #endif /* configSUPPORT_STATIC_ALLOCATION */\r
+\r
+                       traceEVENT_GROUP_CREATE( pxEventBits );\r
+               }\r
+               else\r
+               {\r
+                       traceEVENT_GROUP_CREATE_FAILED(); /*lint !e9063 Else branch only exists to allow tracing and does not generate code if trace macros are not defined. */\r
+               }\r
+\r
+               return pxEventBits;\r
        }\r
 \r
-       return ( EventGroupHandle_t ) pxEventBits;\r
-}\r
+#endif /* configSUPPORT_DYNAMIC_ALLOCATION */\r
 /*-----------------------------------------------------------*/\r
 \r
 EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, const EventBits_t uxBitsToWaitFor, TickType_t xTicksToWait )\r
 {\r
 EventBits_t uxOriginalBitValue, uxReturn;\r
-EventGroup_t *pxEventBits = ( EventGroup_t * ) xEventGroup;\r
+EventGroup_t *pxEventBits = xEventGroup;\r
 BaseType_t xAlreadyYielded;\r
 BaseType_t xTimeoutOccurred = pdFALSE;\r
 \r
@@ -225,6 +242,7 @@ BaseType_t xTimeoutOccurred = pdFALSE;
                                /* The rendezvous bits were not set, but no block time was\r
                                specified - just return the current event bit value. */\r
                                uxReturn = pxEventBits->uxEventBits;\r
+                               xTimeoutOccurred = pdTRUE;\r
                        }\r
                }\r
        }\r
@@ -283,13 +301,16 @@ BaseType_t xTimeoutOccurred = pdFALSE;
 \r
        traceEVENT_GROUP_SYNC_END( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTimeoutOccurred );\r
 \r
+       /* Prevent compiler warnings when trace macros are not used. */\r
+       ( void ) xTimeoutOccurred;\r
+\r
        return uxReturn;\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
 EventBits_t xEventGroupWaitBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToWaitFor, const BaseType_t xClearOnExit, const BaseType_t xWaitForAllBits, TickType_t xTicksToWait )\r
 {\r
-EventGroup_t *pxEventBits = ( EventGroup_t * ) xEventGroup;\r
+EventGroup_t *pxEventBits = xEventGroup;\r
 EventBits_t uxReturn, uxControlBits = 0;\r
 BaseType_t xWaitConditionMet, xAlreadyYielded;\r
 BaseType_t xTimeoutOccurred = pdFALSE;\r
@@ -334,6 +355,7 @@ BaseType_t xTimeoutOccurred = pdFALSE;
                        /* The wait condition has not been met, but no block time was\r
                        specified, so just return the current value. */\r
                        uxReturn = uxCurrentEventBits;\r
+                       xTimeoutOccurred = pdTRUE;\r
                }\r
                else\r
                {\r
@@ -415,11 +437,9 @@ BaseType_t xTimeoutOccurred = pdFALSE;
                                {\r
                                        mtCOVERAGE_TEST_MARKER();\r
                                }\r
+                               xTimeoutOccurred = pdTRUE;\r
                        }\r
                        taskEXIT_CRITICAL();\r
-\r
-                       /* Prevent compiler warnings when trace macros are not used. */\r
-                       xTimeoutOccurred = pdFALSE;\r
                }\r
                else\r
                {\r
@@ -431,13 +451,16 @@ BaseType_t xTimeoutOccurred = pdFALSE;
        }\r
        traceEVENT_GROUP_WAIT_BITS_END( xEventGroup, uxBitsToWaitFor, xTimeoutOccurred );\r
 \r
+       /* Prevent compiler warnings when trace macros are not used. */\r
+       ( void ) xTimeoutOccurred;\r
+\r
        return uxReturn;\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
 EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear )\r
 {\r
-EventGroup_t *pxEventBits = ( EventGroup_t * ) xEventGroup;\r
+EventGroup_t *pxEventBits = xEventGroup;\r
 EventBits_t uxReturn;\r
 \r
        /* Check the user is not attempting to clear the bits used by the kernel\r
@@ -469,7 +492,7 @@ EventBits_t uxReturn;
                BaseType_t xReturn;\r
 \r
                traceEVENT_GROUP_CLEAR_BITS_FROM_ISR( xEventGroup, uxBitsToClear );\r
-               xReturn = xTimerPendFunctionCallFromISR( vEventGroupClearBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToClear, NULL );\r
+               xReturn = xTimerPendFunctionCallFromISR( vEventGroupClearBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToClear, NULL ); /*lint !e9087 Can't avoid cast to void* as a generic callback function not specific to this use case. Callback casts back to original type so safe. */\r
 \r
                return xReturn;\r
        }\r
@@ -480,7 +503,7 @@ EventBits_t uxReturn;
 EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup )\r
 {\r
 UBaseType_t uxSavedInterruptStatus;\r
-EventGroup_t *pxEventBits = ( EventGroup_t * ) xEventGroup;\r
+EventGroup_t const * const pxEventBits = xEventGroup;\r
 EventBits_t uxReturn;\r
 \r
        uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();\r
@@ -490,16 +513,16 @@ EventBits_t uxReturn;
        portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );\r
 \r
        return uxReturn;\r
-}\r
+} /*lint !e818 EventGroupHandle_t is a typedef used in other functions to so can't be pointer to const. */\r
 /*-----------------------------------------------------------*/\r
 \r
 EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet )\r
 {\r
 ListItem_t *pxListItem, *pxNext;\r
 ListItem_t const *pxListEnd;\r
-List_t *pxList;\r
+List_t const * pxList;\r
 EventBits_t uxBitsToClear = 0, uxBitsWaitedFor, uxControlBits;\r
-EventGroup_t *pxEventBits = ( EventGroup_t * ) xEventGroup;\r
+EventGroup_t *pxEventBits = xEventGroup;\r
 BaseType_t xMatchFound = pdFALSE;\r
 \r
        /* Check the user is not attempting to set the bits used by the kernel\r
@@ -508,7 +531,7 @@ BaseType_t xMatchFound = pdFALSE;
        configASSERT( ( uxBitsToSet & eventEVENT_BITS_CONTROL_BYTES ) == 0 );\r
 \r
        pxList = &( pxEventBits->xTasksWaitingForBits );\r
-       pxListEnd = listGET_END_MARKER( pxList ); /*lint !e826 !e740 The mini list structure is used as the list end to save RAM.  This is checked and valid. */\r
+       pxListEnd = listGET_END_MARKER( pxList ); /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM.  This is checked and valid. */\r
        vTaskSuspendAll();\r
        {\r
                traceEVENT_GROUP_SET_BITS( xEventGroup, uxBitsToSet );\r
@@ -568,7 +591,7 @@ BaseType_t xMatchFound = pdFALSE;
                                eventUNBLOCKED_DUE_TO_BIT_SET bit is set so the task knows\r
                                that is was unblocked due to its required bits matching, rather\r
                                than because it timed out. */\r
-                               ( void ) xTaskRemoveFromUnorderedEventList( pxListItem, pxEventBits->uxEventBits | eventUNBLOCKED_DUE_TO_BIT_SET );\r
+                               vTaskRemoveFromUnorderedEventList( pxListItem, pxEventBits->uxEventBits | eventUNBLOCKED_DUE_TO_BIT_SET );\r
                        }\r
 \r
                        /* Move onto the next list item.  Note pxListItem->pxNext is not\r
@@ -589,7 +612,7 @@ BaseType_t xMatchFound = pdFALSE;
 \r
 void vEventGroupDelete( EventGroupHandle_t xEventGroup )\r
 {\r
-EventGroup_t *pxEventBits = ( EventGroup_t * ) xEventGroup;\r
+EventGroup_t *pxEventBits = xEventGroup;\r
 const List_t *pxTasksWaitingForBits = &( pxEventBits->xTasksWaitingForBits );\r
 \r
        vTaskSuspendAll();\r
@@ -599,16 +622,31 @@ const List_t *pxTasksWaitingForBits = &( pxEventBits->xTasksWaitingForBits );
                while( listCURRENT_LIST_LENGTH( pxTasksWaitingForBits ) > ( UBaseType_t ) 0 )\r
                {\r
                        /* Unblock the task, returning 0 as the event list is being deleted\r
-                       and     cannot therefore have any bits set. */\r
-                       configASSERT( pxTasksWaitingForBits->xListEnd.pxNext != ( ListItem_t * ) &( pxTasksWaitingForBits->xListEnd ) );\r
-                       ( void ) xTaskRemoveFromUnorderedEventList( pxTasksWaitingForBits->xListEnd.pxNext, eventUNBLOCKED_DUE_TO_BIT_SET );\r
+                       and cannot therefore have any bits set. */\r
+                       configASSERT( pxTasksWaitingForBits->xListEnd.pxNext != ( const ListItem_t * ) &( pxTasksWaitingForBits->xListEnd ) );\r
+                       vTaskRemoveFromUnorderedEventList( pxTasksWaitingForBits->xListEnd.pxNext, eventUNBLOCKED_DUE_TO_BIT_SET );\r
                }\r
 \r
-               /* Only free the memory if it was allocated dynamically. */\r
-               if( pxEventBits->ucStaticallyAllocated == pdFALSE )\r
+               #if( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 0 ) )\r
                {\r
+                       /* The event group can only have been allocated dynamically - free\r
+                       it again. */\r
                        vPortFree( pxEventBits );\r
                }\r
+               #elif( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )\r
+               {\r
+                       /* The event group could have been allocated statically or\r
+                       dynamically, so check before attempting to free the memory. */\r
+                       if( pxEventBits->ucStaticallyAllocated == ( uint8_t ) pdFALSE )\r
+                       {\r
+                               vPortFree( pxEventBits );\r
+                       }\r
+                       else\r
+                       {\r
+                               mtCOVERAGE_TEST_MARKER();\r
+                       }\r
+               }\r
+               #endif /* configSUPPORT_DYNAMIC_ALLOCATION */\r
        }\r
        ( void ) xTaskResumeAll();\r
 }\r
@@ -618,7 +656,7 @@ const List_t *pxTasksWaitingForBits = &( pxEventBits->xTasksWaitingForBits );
 an interrupt. */\r
 void vEventGroupSetBitsCallback( void *pvEventGroup, const uint32_t ulBitsToSet )\r
 {\r
-       ( void ) xEventGroupSetBits( pvEventGroup, ( EventBits_t ) ulBitsToSet );\r
+       ( void ) xEventGroupSetBits( pvEventGroup, ( EventBits_t ) ulBitsToSet ); /*lint !e9079 Can't avoid cast to void* as a generic timer callback prototype. Callback casts back to original type so safe. */\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -626,7 +664,7 @@ void vEventGroupSetBitsCallback( void *pvEventGroup, const uint32_t ulBitsToSet
 an interrupt. */\r
 void vEventGroupClearBitsCallback( void *pvEventGroup, const uint32_t ulBitsToClear )\r
 {\r
-       ( void ) xEventGroupClearBits( pvEventGroup, ( EventBits_t ) ulBitsToClear );\r
+       ( void ) xEventGroupClearBits( pvEventGroup, ( EventBits_t ) ulBitsToClear ); /*lint !e9079 Can't avoid cast to void* as a generic timer callback prototype. Callback casts back to original type so safe. */\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -672,7 +710,7 @@ BaseType_t xWaitConditionMet = pdFALSE;
        BaseType_t xReturn;\r
 \r
                traceEVENT_GROUP_SET_BITS_FROM_ISR( xEventGroup, uxBitsToSet );\r
-               xReturn = xTimerPendFunctionCallFromISR( vEventGroupSetBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToSet, pxHigherPriorityTaskWoken );\r
+               xReturn = xTimerPendFunctionCallFromISR( vEventGroupSetBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToSet, pxHigherPriorityTaskWoken ); /*lint !e9087 Can't avoid cast to void* as a generic callback function not specific to this use case. Callback casts back to original type so safe. */\r
 \r
                return xReturn;\r
        }\r
@@ -685,7 +723,7 @@ BaseType_t xWaitConditionMet = pdFALSE;
        UBaseType_t uxEventGroupGetNumber( void* xEventGroup )\r
        {\r
        UBaseType_t xReturn;\r
-       EventGroup_t *pxEventBits = ( EventGroup_t * ) xEventGroup;\r
+       EventGroup_t const *pxEventBits = ( EventGroup_t * ) xEventGroup; /*lint !e9087 !e9079 EventGroupHandle_t is a pointer to an EventGroup_t, but EventGroupHandle_t is kept opaque outside of this file for data hiding purposes. */\r
 \r
                if( xEventGroup == NULL )\r
                {\r
@@ -699,5 +737,17 @@ BaseType_t xWaitConditionMet = pdFALSE;
                return xReturn;\r
        }\r
 \r
-#endif\r
+#endif /* configUSE_TRACE_FACILITY */\r
+/*-----------------------------------------------------------*/\r
+\r
+#if ( configUSE_TRACE_FACILITY == 1 )\r
+\r
+       void vEventGroupSetNumber( void * xEventGroup, UBaseType_t uxEventGroupNumber )\r
+       {\r
+               ( ( EventGroup_t * ) xEventGroup )->uxEventGroupNumber = uxEventGroupNumber; /*lint !e9087 !e9079 EventGroupHandle_t is a pointer to an EventGroup_t, but EventGroupHandle_t is kept opaque outside of this file for data hiding purposes. */\r
+       }\r
+\r
+#endif /* configUSE_TRACE_FACILITY */\r
+/*-----------------------------------------------------------*/\r
+\r
 \r