MCPcopy Create free account
hub / github.com/FreeRTOS/FreeRTOS-Kernel / prvProcessReceivedCommands

Function prvProcessReceivedCommands

timers.c:781–928  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

779/*-----------------------------------------------------------*/
780
781 static void prvProcessReceivedCommands( void )
782 {
783 DaemonTaskMessage_t xMessage;
784 Timer_t * pxTimer;
785 BaseType_t xTimerListsWereSwitched, xResult;
786 TickType_t xTimeNow;
787
788 while( xQueueReceive( xTimerQueue, &xMessage, tmrNO_DELAY ) != pdFAIL ) /*lint !e603 xMessage does not have to be initialised as it is passed out, not in, and it is not used unless xQueueReceive() returns pdTRUE. */
789 {
790 #if ( INCLUDE_xTimerPendFunctionCall == 1 )
791 {
792 /* Negative commands are pended function calls rather than timer
793 * commands. */
794 if( xMessage.xMessageID < ( BaseType_t ) 0 )
795 {
796 const CallbackParameters_t * const pxCallback = &( xMessage.u.xCallbackParameters );
797
798 /* The timer uses the xCallbackParameters member to request a
799 * callback be executed. Check the callback is not NULL. */
800 configASSERT( pxCallback );
801
802 /* Call the function. */
803 pxCallback->pxCallbackFunction( pxCallback->pvParameter1, pxCallback->ulParameter2 );
804 }
805 else
806 {
807 mtCOVERAGE_TEST_MARKER();
808 }
809 }
810 #endif /* INCLUDE_xTimerPendFunctionCall */
811
812 /* Commands that are positive are timer commands rather than pended
813 * function calls. */
814 if( xMessage.xMessageID >= ( BaseType_t ) 0 )
815 {
816 /* The messages uses the xTimerParameters member to work on a
817 * software timer. */
818 pxTimer = xMessage.u.xTimerParameters.pxTimer;
819
820 if( listIS_CONTAINED_WITHIN( NULL, &( pxTimer->xTimerListItem ) ) == pdFALSE ) /*lint !e961. The cast is only redundant when NULL is passed into the macro. */
821 {
822 /* The timer is in a list, remove it. */
823 ( void ) uxListRemove( &( pxTimer->xTimerListItem ) );
824 }
825 else
826 {
827 mtCOVERAGE_TEST_MARKER();
828 }
829
830 traceTIMER_COMMAND_RECEIVED( pxTimer, xMessage.xMessageID, xMessage.u.xTimerParameters.xMessageValue );
831
832 /* In this case the xTimerListsWereSwitched parameter is not used, but
833 * it must be present in the function call. prvSampleTimeNow() must be
834 * called after the message is received from xTimerQueue so there is no
835 * possibility of a higher priority task adding a message to the message
836 * queue with a time that is ahead of the timer daemon task (because it
837 * pre-empted the timer daemon task after the xTimeNow value was set). */
838 xTimeNow = prvSampleTimeNow( &xTimerListsWereSwitched );

Callers 1

timers.cFile · 0.85

Calls 5

xQueueReceiveFunction · 0.85
uxListRemoveFunction · 0.85
prvSampleTimeNowFunction · 0.85
vPortFreeFunction · 0.50

Tested by

no test coverage detected