Exemplo n.º 1
0
	BaseType_t MPU_xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet )
	{
	BaseType_t xReturn;
	BaseType_t xRunningPrivileged = prvRaisePrivilege();

		xReturn = xQueueAddToSet( xQueueOrSemaphore, xQueueSet );
		portRESET_PRIVILEGE( xRunningPrivileged );
		return xReturn;
	}
Exemplo n.º 2
0
	BaseType_t MPU_xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet )
	{
	BaseType_t xReturn;
	BaseType_t xRunningPrivileged = xPortRaisePrivilege();

		xReturn = xQueueAddToSet( xQueueOrSemaphore, xQueueSet );
		vPortResetPrivilege( xRunningPrivileged );
		return xReturn;
	}
Exemplo n.º 3
0
void vStartQueueSetPollingTask( void )
{
	/* Create the queue that is added to the set, the set, and add the queue to
	the set. */
	xQueue = xQueueCreate( setpollQUEUE_LENGTH, sizeof( uint32_t ) );
	xQueueSet = xQueueCreateSet( setpollQUEUE_LENGTH );
	xQueueAddToSet( xQueue, xQueueSet );

	/* Create the task. */
	xTaskCreate( prvQueueSetReceivingTask, "SetPoll", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
}
Exemplo n.º 4
0
/**
 * \brief	Gatekeeper task initialization. Generates the task and initialize
 * 			the hardware.
 */
void taskGatekeeperInit(void) {

	/* Initialize the serial interface */
	bsp_SerialInit();

	/* Generate the task */
	xTaskCreate(taskGatekeeper, TASK_GATEKEEPER_NAME, TASK_GATEKEEPER_STACKSIZE,
			NULL, TASK_GATEKEEPER_PRIORITY, &taskGatekeeperHandle);

	/* Generate the queue */
	queueMessage = xQueueCreate(Q_MESSAGE_LENGTH, sizeof(message_t));
	queueMessageData = xQueueCreate(Q_MESSAGE_DATA_LENGTH, sizeof(char[DATA_MESSAGE_STRING_LENGTH]));

	/* Create the message queue set */
	queueMessageSet = xQueueCreateSet(Q_MESSAGE_LENGTH + Q_MESSAGE_DATA_LENGTH);
	xQueueAddToSet(queueMessage, queueMessageSet);
	xQueueAddToSet(queueMessageData, queueMessageSet);

	/* Generate the mutual exclusion */
	mutexTxCircBuf = xSemaphoreCreateMutex();
	xSemaphoreGive(mutexTxCircBuf);
}
Exemplo n.º 5
0
void scheduler_task::initQueueSet(uint32_t queueSetSize, uint32_t count, ...)
{
    void *handle = 0;
    va_list vl;
    va_start(vl, count);

    mQueueSet = xQueueCreateSet(queueSetSize);
    while(count--) {
        handle = va_arg(vl, void*);
        xQueueAddToSet( handle, mQueueSet);
    }

    va_end(vl);
}
Exemplo n.º 6
0
static void prvSetupTest( void )
{
portBASE_TYPE x;
unsigned long ulValueToSend = 0;

	/* Ensure the queues are created and the queue set configured before the
	sending task is unsuspended.

	First Create the queue set such that it will be able to hold a message for
	every space in every queue in the set. */
	xQueueSet = xQueueCreateSet( queuesetNUM_QUEUES_IN_SET * queuesetQUEUE_LENGTH );

	for( x = 0; x < queuesetNUM_QUEUES_IN_SET; x++ )
	{
		/* Create the queue and add it to the set.  The queue is just holding
		unsigned long value. */
		xQueues[ x ] = xQueueCreate( queuesetQUEUE_LENGTH, sizeof( unsigned long ) );
		configASSERT( xQueues[ x ] );
		if( xQueueAddToSet( xQueues[ x ], xQueueSet ) != pdPASS )
		{
			xQueueSetTasksStatus = pdFAIL;
		}
		else
		{
			/* The queue has now been added to the queue set and cannot be added to
			another. */
			if( xQueueAddToSet( xQueues[ x ], xQueueSet ) != pdFAIL )
			{
				xQueueSetTasksStatus = pdFAIL;
			}
		}
	}

	/* Attempt to remove a queue from a queue set it does not belong
	to (NULL being passed as the queue set in this case). */
	if( xQueueRemoveFromSet( xQueues[ 0 ], NULL ) != pdFAIL )
	{
		/* It is not possible to successfully remove a queue from a queue
		set it does not belong to. */
		xQueueSetTasksStatus = pdFAIL;
	}

	/* Attempt to remove a queue from the queue set it does belong to. */
	if( xQueueRemoveFromSet( xQueues[ 0 ], xQueueSet ) != pdPASS )
	{
		/* It should be possible to remove the queue from the queue set it
		does belong to. */
		xQueueSetTasksStatus = pdFAIL;
	}

	/* Add an item to the queue before attempting to add it back into the
	set. */
	xQueueSend( xQueues[ 0 ], ( void * ) &ulValueToSend, 0 );
	if( xQueueAddToSet( xQueues[ 0 ], xQueueSet ) != pdFAIL )
	{
		/* Should not be able to add a non-empty queue to a set. */
		xQueueSetTasksStatus = pdFAIL;
	}

	/* Remove the item from the queue before adding the queue back into the
	set so the dynamic tests can begin. */
	xQueueReceive( xQueues[ 0 ], &ulValueToSend, 0 );
	if( xQueueAddToSet( xQueues[ 0 ], xQueueSet ) != pdPASS )
	{
		/* If the queue was successfully removed from the queue set then it
		should be possible to add it back in again. */
		xQueueSetTasksStatus = pdFAIL;
	}

	/* The task that sends to the queues is not running yet, so attempting to
	read from the queue set should fail. */
	if( xQueueSelectFromSet( xQueueSet, queuesetSHORT_DELAY ) != NULL )
	{
		xQueueSetTasksStatus = pdFAIL;
	}

	/* Resume the task that writes to the queues. */
	vTaskResume( xQueueSetSendingTask );

	/* Let the ISR access the queues also. */
	xSetupComplete = pdTRUE;
}