]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/event_groups.c
Update version numbers ready for release.
[freertos] / FreeRTOS / Source / event_groups.c
index 0ff6b53957af5a51a2964c328aac3618d5fa3212..37e6f1f41e9f68c3ccf5bf858202e0abe03e46d6 100644 (file)
@@ -1,67 +1,29 @@
 /*\r
-    FreeRTOS V8.0.1 - 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
-\r
-    ***************************************************************************\r
-     *                                                                       *\r
-     *    FreeRTOS provides completely free yet professionally developed,    *\r
-     *    robust, strictly quality controlled, supported, and cross          *\r
-     *    platform software that has become a de facto standard.             *\r
-     *                                                                       *\r
-     *    Help yourself get started quickly and support the FreeRTOS         *\r
-     *    project by purchasing a FreeRTOS tutorial book, reference          *\r
-     *    manual, or both from: http://www.FreeRTOS.org/Documentation        *\r
-     *                                                                       *\r
-     *    Thank you!                                                         *\r
-     *                                                                       *\r
-    ***************************************************************************\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
-    >>!   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
-    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 from the following\r
-    link: http://www.freertos.org/a00114.html\r
-\r
-    1 tab == 4 spaces!\r
-\r
-    ***************************************************************************\r
-     *                                                                       *\r
-     *    Having a problem?  Start by reading the FAQ "My application does   *\r
-     *    not run, what could be wrong?"                                     *\r
-     *                                                                       *\r
-     *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
-     *                                                                       *\r
-    ***************************************************************************\r
-\r
-    http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
-    license and Real Time Engineers Ltd. contact details.\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.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
-    Integrity Systems to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
-    licenses offer ticketed support, indemnification and 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
@@ -77,19 +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
-\r
-#if ( INCLUDE_xEventGroupSetBitFromISR == 1 ) && ( configUSE_TIMERS == 0 )\r
-       #error configUSE_TIMERS must be set to 1 to make the xEventGroupSetBitFromISR() function available.\r
-#endif\r
-\r
-#if ( INCLUDE_xEventGroupSetBitFromISR == 1 ) && ( INCLUDE_xTimerPendFunctionCall == 0 )\r
-       #error INCLUDE_xTimerPendFunctionCall must also be set to one to make the xEventGroupSetBitFromISR() function available.\r
-#endif\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
@@ -106,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
@@ -115,6 +69,9 @@ typedef struct xEventGroupDefinition
                UBaseType_t uxEventGroupNumber;\r
        #endif\r
 \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
 /*-----------------------------------------------------------*/\r
@@ -127,34 +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 xEventGroupCreate( void )\r
-{\r
-EventGroup_t *pxEventBits;\r
+#if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
 \r
-       pxEventBits = pvPortMalloc( sizeof( EventGroup_t ) );\r
-       if( pxEventBits != NULL )\r
+       EventGroupHandle_t xEventGroupCreateStatic( StaticEventGroup_t *pxEventGroupBuffer )\r
        {\r
-               pxEventBits->uxEventBits = 0;\r
-               vListInitialise( &( pxEventBits->xTasksWaitingForBits ) );\r
-               traceEVENT_GROUP_CREATE( pxEventBits );\r
+       EventGroup_t *pxEventBits;\r
+\r
+               /* A StaticEventGroup_t object must be provided. */\r
+               configASSERT( pxEventGroupBuffer );\r
+\r
+               #if( configASSERT_DEFINED == 1 )\r
+               {\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
+                       /* 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
+               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
@@ -205,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
@@ -263,19 +301,23 @@ 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
 \r
        /* Check the user is not attempting to wait on the bits used by the kernel\r
        itself, and that at least one bit is being requested. */\r
+       configASSERT( xEventGroup );\r
        configASSERT( ( uxBitsToWaitFor & eventEVENT_BITS_CONTROL_BYTES ) == 0 );\r
        configASSERT( uxBitsToWaitFor != 0 );\r
        #if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) )\r
@@ -313,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
@@ -394,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
@@ -410,17 +451,21 @@ 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
        itself. */\r
+       configASSERT( xEventGroup );\r
        configASSERT( ( uxBitsToClear & eventEVENT_BITS_CONTROL_BYTES ) == 0 );\r
 \r
        taskENTER_CRITICAL();\r
@@ -447,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
@@ -458,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
@@ -468,24 +513,25 @@ 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
        itself. */\r
+       configASSERT( xEventGroup );\r
        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
@@ -545,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
@@ -566,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
@@ -576,12 +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
-               vPortFree( pxEventBits );\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
@@ -591,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
@@ -599,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
@@ -645,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
@@ -658,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
@@ -672,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