GenQTest.h File Reference

Go to the source code of this file.

Functions

void vStartGenericQueueTasks (unsigned portBASE_TYPE uxPriority)
portBASE_TYPE xAreGenericQueueTasksStillRunning (void)


Function Documentation

void vStartGenericQueueTasks ( unsigned portBASE_TYPE  uxPriority  ) 

Definition at line 132 of file GenQTest.c.

References configMINIMAL_STACK_SIZE, genqMUTEX_HIGH_PRIORITY, genqMUTEX_LOW_PRIORITY, genqMUTEX_MEDIUM_PRIORITY, genqQUEUE_LENGTH, portCHAR, portLONG, prvHighPriorityMutexTask(), prvLowPriorityMutexTask(), prvMediumPriorityMutexTask(), prvSendFrontAndBackTest(), vQueueAddToRegistry, xHighPriorityMutexTask, xMediumPriorityMutexTask, xMutex, xQueueCreate(), xSemaphoreCreateMutex, and xTaskCreate.

00133 {
00134 xQueueHandle xQueue;
00135 xSemaphoreHandle xMutex;
00136 
00137     /* Create the queue that we are going to use for the
00138     prvSendFrontAndBackTest demo. */
00139     xQueue = xQueueCreate( genqQUEUE_LENGTH, sizeof( unsigned portLONG ) );
00140 
00141     /* vQueueAddToRegistry() adds the queue to the queue registry, if one is
00142     in use.  The queue registry is provided as a means for kernel aware 
00143     debuggers to locate queues and has no purpose if a kernel aware debugger
00144     is not being used.  The call to vQueueAddToRegistry() will be removed
00145     by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is 
00146     defined to be less than 1. */
00147     vQueueAddToRegistry( xQueue, ( signed portCHAR * ) "Gen_Queue_Test" );
00148 
00149     /* Create the demo task and pass it the queue just created.  We are
00150     passing the queue handle by value so it does not matter that it is
00151     declared on the stack here. */
00152     xTaskCreate( prvSendFrontAndBackTest, ( signed portCHAR * )"GenQ", configMINIMAL_STACK_SIZE, ( void * ) xQueue, uxPriority, NULL );
00153 
00154     /* Create the mutex used by the prvMutexTest task. */
00155     xMutex = xSemaphoreCreateMutex();
00156 
00157     /* vQueueAddToRegistry() adds the mutex to the registry, if one is
00158     in use.  The registry is provided as a means for kernel aware 
00159     debuggers to locate mutexes and has no purpose if a kernel aware debugger
00160     is not being used.  The call to vQueueAddToRegistry() will be removed
00161     by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is 
00162     defined to be less than 1. */
00163     vQueueAddToRegistry( ( xQueueHandle ) xMutex, ( signed portCHAR * ) "Gen_Queue_Mutex" );
00164 
00165     /* Create the mutex demo tasks and pass it the mutex just created.  We are
00166     passing the mutex handle by value so it does not matter that it is declared
00167     on the stack here. */
00168     xTaskCreate( prvLowPriorityMutexTask, ( signed portCHAR * )"MuLow", configMINIMAL_STACK_SIZE, ( void * ) xMutex, genqMUTEX_LOW_PRIORITY, NULL );
00169     xTaskCreate( prvMediumPriorityMutexTask, ( signed portCHAR * )"MuMed", configMINIMAL_STACK_SIZE, NULL, genqMUTEX_MEDIUM_PRIORITY, &xMediumPriorityMutexTask );
00170     xTaskCreate( prvHighPriorityMutexTask, ( signed portCHAR * )"MuHigh", configMINIMAL_STACK_SIZE, ( void * ) xMutex, genqMUTEX_HIGH_PRIORITY, &xHighPriorityMutexTask );
00171 }

portBASE_TYPE xAreGenericQueueTasksStillRunning ( void   ) 

Definition at line 547 of file GenQTest.c.

References pdTRUE, portLONG, ulLoopCounter, ulLoopCounter2, and xErrorDetected.

00548 {
00549 static unsigned portLONG ulLastLoopCounter = 0, ulLastLoopCounter2 = 0;
00550 
00551     /* If the demo task is still running then we expect the loopcounters to
00552     have incremented since this function was last called. */
00553     if( ulLastLoopCounter == ulLoopCounter )
00554     {
00555         xErrorDetected = pdTRUE;
00556     }
00557 
00558     if( ulLastLoopCounter2 == ulLoopCounter2 )
00559     {
00560         xErrorDetected = pdTRUE;
00561     }
00562 
00563     ulLastLoopCounter = ulLoopCounter;
00564     ulLastLoopCounter2 = ulLoopCounter2;    
00565 
00566     /* Errors detected in the task itself will have latched xErrorDetected
00567     to true. */
00568 
00569     return !xErrorDetected;
00570 }


Generated on Thu Dec 17 20:02:01 2009 for AVR32 UC3 - FreeRTOS Real Time Kernel by  doxygen 1.5.5