Go to the source code of this file.
Functions | |
void | vStartAltGenericQueueTasks (unsigned portBASE_TYPE uxPriority) |
portBASE_TYPE | xAreAltGenericQueueTasksStillRunning (void) |
void vStartAltGenericQueueTasks | ( | unsigned portBASE_TYPE | uxPriority | ) |
Definition at line 130 of file AltQTest.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.
00131 { 00132 xQueueHandle xQueue; 00133 xSemaphoreHandle xMutex; 00134 00135 /* Create the queue that we are going to use for the 00136 prvSendFrontAndBackTest demo. */ 00137 xQueue = xQueueCreate( genqQUEUE_LENGTH, sizeof( unsigned portLONG ) ); 00138 00139 /* vQueueAddToRegistry() adds the queue to the queue registry, if one is 00140 in use. The queue registry is provided as a means for kernel aware 00141 debuggers to locate queues and has no purpose if a kernel aware debugger 00142 is not being used. The call to vQueueAddToRegistry() will be removed 00143 by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is 00144 defined to be less than 1. */ 00145 vQueueAddToRegistry( xQueue, ( signed portCHAR * ) "Alt_Gen_Test_Queue" ); 00146 00147 /* Create the demo task and pass it the queue just created. We are 00148 passing the queue handle by value so it does not matter that it is 00149 declared on the stack here. */ 00150 xTaskCreate( prvSendFrontAndBackTest, ( signed portCHAR * ) "FGenQ", configMINIMAL_STACK_SIZE, ( void * ) xQueue, uxPriority, NULL ); 00151 00152 /* Create the mutex used by the prvMutexTest task. */ 00153 xMutex = xSemaphoreCreateMutex(); 00154 00155 /* vQueueAddToRegistry() adds the mutex to the registry, if one is 00156 in use. The registry is provided as a means for kernel aware 00157 debuggers to locate mutex and has no purpose if a kernel aware debugger 00158 is not being used. The call to vQueueAddToRegistry() will be removed 00159 by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is 00160 defined to be less than 1. */ 00161 vQueueAddToRegistry( ( xQueueHandle ) xMutex, ( signed portCHAR * ) "Alt_Q_Mutex" ); 00162 00163 /* Create the mutex demo tasks and pass it the mutex just created. We are 00164 passing the mutex handle by value so it does not matter that it is declared 00165 on the stack here. */ 00166 xTaskCreate( prvLowPriorityMutexTask, ( signed portCHAR * ) "FMuLow", configMINIMAL_STACK_SIZE, ( void * ) xMutex, genqMUTEX_LOW_PRIORITY, NULL ); 00167 xTaskCreate( prvMediumPriorityMutexTask, ( signed portCHAR * ) "FMuMed", configMINIMAL_STACK_SIZE, NULL, genqMUTEX_MEDIUM_PRIORITY, &xMediumPriorityMutexTask ); 00168 xTaskCreate( prvHighPriorityMutexTask, ( signed portCHAR * ) "FMuHigh", configMINIMAL_STACK_SIZE, ( void * ) xMutex, genqMUTEX_HIGH_PRIORITY, &xHighPriorityMutexTask ); 00169 }
portBASE_TYPE xAreAltGenericQueueTasksStillRunning | ( | void | ) |
Definition at line 550 of file AltQTest.c.
References pdTRUE, portLONG, ulLoopCounter, ulLoopCounter2, and xErrorDetected.
00551 { 00552 static unsigned portLONG ulLastLoopCounter = 0, ulLastLoopCounter2 = 0; 00553 00554 /* If the demo task is still running then we expect the loopcounters to 00555 have incremented since this function was last called. */ 00556 if( ulLastLoopCounter == ulLoopCounter ) 00557 { 00558 xErrorDetected = pdTRUE; 00559 } 00560 00561 if( ulLastLoopCounter2 == ulLoopCounter2 ) 00562 { 00563 xErrorDetected = pdTRUE; 00564 } 00565 00566 ulLastLoopCounter = ulLoopCounter; 00567 ulLastLoopCounter2 = ulLoopCounter2; 00568 00569 /* Errors detected in the task itself will have latched xErrorDetected 00570 to true. */ 00571 00572 return !xErrorDetected; 00573 }