components/freertos/event_groups.c
/*lint !e818 EventGroupHandle_t is a typedef used in other functions to so can't be pointer to const. */
/*-----------------------------------------------------------*/
lint !e818 EventGroupHandle_t is a typedef used in other functions to so can't be pointer to const.
lint !e818 EventGroupHandle_t is a typedef used in other functions to so can ' t be pointer to const .
EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup,
                                const EventBits_t uxBitsToSet )
{
    ListItem_t * pxListItem, * pxNext;
    ListItem_t const * pxListEnd;
    List_t const * pxList;
    EventBits_t uxBitsToClear = 0, uxBitsWaitedFor, uxControlBits;
    EventGroup_t * pxEventBits = xEventGroup;
    BaseType_t xMatchFound = pdFALSE;
    configASSERT( xEventGroup );
    configASSERT( ( uxBitsToSet & eventEVENT_BITS_CONTROL_BYTES ) == 0 );
    pxList = &( pxEventBits->xTasksWaitingForBits );
    pxListEnd = listGET_END_MARKER( pxList ); 
#ifdef ESP_PLATFORM 
    taskENTER_CRITICAL();
#else
    vTaskSuspendAll();
#endif 
    {
        traceEVENT_GROUP_SET_BITS( xEventGroup, uxBitsToSet );
        pxListItem = listGET_HEAD_ENTRY( pxList );
        pxEventBits->uxEventBits |= uxBitsToSet;
        while( pxListItem != pxListEnd )
        {
            pxNext = listGET_NEXT( pxListItem );
            uxBitsWaitedFor = listGET_LIST_ITEM_VALUE( pxListItem );
            xMatchFound = pdFALSE;
            uxControlBits = uxBitsWaitedFor & eventEVENT_BITS_CONTROL_BYTES;
            uxBitsWaitedFor &= ~eventEVENT_BITS_CONTROL_BYTES;
            if( ( uxControlBits & eventWAIT_FOR_ALL_BITS ) == ( EventBits_t ) 0 )
            {
                if( ( uxBitsWaitedFor & pxEventBits->uxEventBits ) != ( EventBits_t ) 0 )
                {
                    xMatchFound = pdTRUE;
                }
                else
                {
                    mtCOVERAGE_TEST_MARKER();
                }
            }
            else if( ( uxBitsWaitedFor & pxEventBits->uxEventBits ) == uxBitsWaitedFor )
            {
                xMatchFound = pdTRUE;
            }
            else
            {
            }
            if( xMatchFound != pdFALSE )
            {
                if( ( uxControlBits & eventCLEAR_EVENTS_ON_EXIT_BIT ) != ( EventBits_t ) 0 )
                {
                    uxBitsToClear |= uxBitsWaitedFor;
                }
                else
                {
                    mtCOVERAGE_TEST_MARKER();
                }
                vTaskRemoveFromUnorderedEventList( pxListItem, pxEventBits->uxEventBits | eventUNBLOCKED_DUE_TO_BIT_SET );
            }
            pxListItem = pxNext;
        }
        pxEventBits->uxEventBits &= ~uxBitsToClear;
    }
#ifdef ESP_PLATFORM 
    taskEXIT_CRITICAL();
#else
    ( void ) xTaskResumeAll();
#endif 
    return pxEventBits->uxEventBits;
}
EventBits_t xEventGroupSetBits ( EventGroupHandle_t xEventGroup , const EventBits_t uxBitsToSet ) { ListItem_t * pxListItem , * pxNext ; ListItem_t const * pxListEnd ; List_t const * pxList ; EventBits_t uxBitsToClear = 0 , uxBitsWaitedFor , uxControlBits ; EventGroup_t * pxEventBits = xEventGroup ; BaseType_t xMatchFound = pdFALSE ; configASSERT ( xEventGroup ) ; configASSERT ( ( uxBitsToSet & eventEVENT_BITS_CONTROL_BYTES ) == 0 ) ; pxList = & ( pxEventBits -> xTasksWaitingForBits ) ; pxListEnd = listGET_END_MARKER ( pxList ) ; #ifdef ESP_PLATFORM taskENTER_CRITICAL ( ) ; #else vTaskSuspendAll ( ) ; #endif { traceEVENT_GROUP_SET_BITS ( xEventGroup , uxBitsToSet ) ; pxListItem = listGET_HEAD_ENTRY ( pxList ) ; pxEventBits -> uxEventBits |= uxBitsToSet ; while ( pxListItem != pxListEnd ) { pxNext = listGET_NEXT ( pxListItem ) ; uxBitsWaitedFor = listGET_LIST_ITEM_VALUE ( pxListItem ) ; xMatchFound = pdFALSE ; uxControlBits = uxBitsWaitedFor & eventEVENT_BITS_CONTROL_BYTES ; uxBitsWaitedFor &= ~ eventEVENT_BITS_CONTROL_BYTES ; if ( ( uxControlBits & eventWAIT_FOR_ALL_BITS ) == ( EventBits_t ) 0 ) { if ( ( uxBitsWaitedFor & pxEventBits -> uxEventBits ) != ( EventBits_t ) 0 ) { xMatchFound = pdTRUE ; } else { mtCOVERAGE_TEST_MARKER ( ) ; } } else if ( ( uxBitsWaitedFor & pxEventBits -> uxEventBits ) == uxBitsWaitedFor ) { xMatchFound = pdTRUE ; } else { } if ( xMatchFound != pdFALSE ) { if ( ( uxControlBits & eventCLEAR_EVENTS_ON_EXIT_BIT ) != ( EventBits_t ) 0 ) { uxBitsToClear |= uxBitsWaitedFor ; } else { mtCOVERAGE_TEST_MARKER ( ) ; } vTaskRemoveFromUnorderedEventList ( pxListItem , pxEventBits -> uxEventBits | eventUNBLOCKED_DUE_TO_BIT_SET ) ; } pxListItem = pxNext ; } pxEventBits -> uxEventBits &= ~ uxBitsToClear ; } #ifdef ESP_PLATFORM taskEXIT_CRITICAL ( ) ; #else ( void ) xTaskResumeAll ( ) ; #endif return pxEventBits -> uxEventBits ; }
lint !e818 EventGroupHandle_t is a typedef used in other functions to so can't be pointer to const.
lint !e818 EventGroupHandle_t is a typedef used in other functions to so can ' t be pointer to const .
/* Check the user is not attempting to set the bits used by the kernel
     * itself. */ /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM.  This is checked and valid. */ // IDF-3755 // ESP_PLATFORM /* Set the bits. */ /* See if the new bit value should unblock any tasks. */ /* Split the bits waited for from the control bits. */ /* Just looking for single bit being set. */ /* All bits are set. */ /* Need all bits to be set, but not all the bits were set. */ /* The bits match.  Should the bits be cleared on exit? */ /* Store the actual event flag value in the task's event list
                 * item before removing the task from the event list.  The
                 * eventUNBLOCKED_DUE_TO_BIT_SET bit is set so the task knows
                 * that is was unblocked due to its required bits matching, rather
                 * than because it timed out. */ /* Move onto the next list item.  Note pxListItem->pxNext is not
             * used here as the list item may have been removed from the event list
             * and inserted into the ready/pending reading list. */ /* Clear any bits that matched when the eventCLEAR_EVENTS_ON_EXIT_BIT
         * bit was set in the control word. */ // IDF-3755 // ESP_PLATFORM