EventGroupHandle_t xEventGroupCreate( void ) { EventGroup_t *pxEventBits; pxEventBits = ( EventGroup_t * ) pvPortMalloc( sizeof( EventGroup_t ) ); if( pxEventBits != NULL ) { pxEventBits->uxEventBits = 0; vListInitialise( &( pxEventBits->xTasksWaitingForBits ) ); traceEVENT_GROUP_CREATE( pxEventBits ); } else { traceEVENT_GROUP_CREATE_FAILED(); } return ( EventGroupHandle_t ) pxEventBits; }
EventGroupHandle_t xEventGroupGenericCreate( StaticEventGroup_t *pxStaticEventGroup ) { EventGroup_t *pxEventBits; if( pxStaticEventGroup == NULL ) { /* The user has not provided a statically allocated event group, so create on dynamically. */ pxEventBits = ( EventGroup_t * ) pvPortMalloc( sizeof( EventGroup_t ) ); } else { /* The user has provided a statically allocated event group - use it. */ pxEventBits = ( EventGroup_t * ) pxStaticEventGroup; /*lint !e740 EventGroup_t and StaticEventGroup_t are guaranteed to have the same size and alignment requirement - checked by configASSERT(). */ } if( pxEventBits != NULL ) { pxEventBits->uxEventBits = 0; vListInitialise( &( pxEventBits->xTasksWaitingForBits ) ); #if( configSUPPORT_STATIC_ALLOCATION == 1 ) { if( pxStaticEventGroup == NULL ) { pxEventBits->ucStaticallyAllocated = pdFALSE; } else { pxEventBits->ucStaticallyAllocated = pdTRUE; } } #endif /* configSUPPORT_STATIC_ALLOCATION */ traceEVENT_GROUP_CREATE( pxEventBits ); } else { traceEVENT_GROUP_CREATE_FAILED(); } return ( EventGroupHandle_t ) pxEventBits; }