Ejemplo n.º 1
0
static void prvQueueSetReceivingTask( void *pvParameters )
{
    uint32_t ulReceived;
    QueueHandle_t xActivatedQueue;
    TickType_t xBlockTime;

    /* Remove compiler warnings. */
    ( void ) pvParameters;

    /* Create the queues and add them to the queue set before resuming the Tx
    task. */
    prvSetupTest();

    for( ;; ) {
        /* For test coverage reasons, the block time is dependent on the
        priority of this task - which changes during the test.  When the task
        is at the idle priority it polls the queue set. */
        if( uxTaskPriorityGet( NULL ) == tskIDLE_PRIORITY ) {
            xBlockTime = 0;
        } else {
            xBlockTime = portMAX_DELAY;
        }

        /* Wait for a message to arrive on one of the queues in the set. */
        xActivatedQueue = xQueueSelectFromSet( xQueueSet, portMAX_DELAY );

        if( xActivatedQueue == NULL ) {
            if( xBlockTime != 0 ) {
                /* This should not happen as an infinite delay was used. */
                xQueueSetTasksStatus = pdFAIL;
            }
        } else {
            /* Reading from the queue should pass with a zero block time as
            this task will only run when something has been posted to a task
            in the queue set. */
            if( xQueueReceive( xActivatedQueue, &ulReceived, queuesetDONT_BLOCK ) != pdPASS ) {
                xQueueSetTasksStatus = pdFAIL;
            }

            /* Ensure the value received was the value expected.  This function
            manipulates file scope data and is also called from an ISR, hence
            the critical section. */
            taskENTER_CRITICAL();
            {
                prvCheckReceivedValue( ulReceived );
            }
            taskEXIT_CRITICAL();

            if( xQueueSetTasksStatus == pdPASS ) {
                ulCycleCounter++;
            }
        }
    }
}
Ejemplo n.º 2
0
static void prvQueueSetReceivingTask( void *pvParameters )
{
unsigned long ulReceived;
xQueueHandle xActivatedQueue;
xTaskHandle xQueueSetSendingTask;

	/* The handle to the sending task is passed in using the task parameter. */
	xQueueSetSendingTask = ( xTaskHandle ) pvParameters;

	/* Create the queues and add them to the queue set before resuming the Tx
	task. */
	prvSetupTest( xQueueSetSendingTask );

	for( ;; )
	{
		/* Wait for a message to arrive on one of the queues in the set. */
		xActivatedQueue = xQueueSelectFromSet( xQueueSet, portMAX_DELAY );
		configASSERT( xActivatedQueue );

		if( xActivatedQueue == NULL )
		{
			/* This should not happen as an infinite delay was used. */
			xQueueSetTasksStatus = pdFAIL;
		}
		else
		{
			/* Reading from the queue should pass with a zero block time as
			this task will only run when something has been posted to a task
			in the queue set. */
			if( xQueueReceive( xActivatedQueue, &ulReceived, queuesetDONT_BLOCK ) != pdPASS )
			{
				xQueueSetTasksStatus = pdFAIL;
			}

			/* Ensure the value received was the value expected.  This function
			manipulates file scope data and is also called from an ISR, hence
			the critical section. */
			taskENTER_CRITICAL();
			{
				prvCheckReceivedValue( ulReceived );
			}
			taskEXIT_CRITICAL();
		}

		if( xQueueSetTasksStatus == pdPASS )
		{
			ulCycleCounter++;
		}
	}
}