コード例 #1
0
ファイル: QueueSet.c プロジェクト: peterliu2/FreeRTOS
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++;
            }
        }
    }
}
コード例 #2
0
ファイル: QueueSet.c プロジェクト: InSoonPark/FreeRTOS
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++;
		}
	}
}
コード例 #3
0
ファイル: QueueSet.c プロジェクト: peterliu2/FreeRTOS
static void prvReceiveFromQueueInSetFromISR( void )
{
    QueueSetMemberHandle_t xActivatedQueue;
    uint32_t ulReceived;

    /* See if any of the queues in the set contain data. */
    xActivatedQueue = xQueueSelectFromSetFromISR( xQueueSet );

    if( xActivatedQueue != NULL ) {
        /* Reading from the queue for test purposes only. */
        if( xQueueReceiveFromISR( xActivatedQueue, &ulReceived, NULL ) != pdPASS ) {
            /* Data should have been available as the handle was returned from
            xQueueSelectFromSetFromISR(). */
            xQueueSetTasksStatus = pdFAIL;
        }

        /* Ensure the value received was the value expected. */
        prvCheckReceivedValue( ulReceived );
    }
}