recmutex.h File Reference

Go to the source code of this file.

Functions

void vStartRecursiveMutexTasks (void)
portBASE_TYPE xAreRecursiveMutexTasksStillRunning (void)


Function Documentation

void vStartRecursiveMutexTasks ( void   ) 

Definition at line 129 of file recmutex.c.

References configMINIMAL_STACK_SIZE, portCHAR, prvRecursiveMutexBlockingTask(), prvRecursiveMutexControllingTask(), prvRecursiveMutexPollingTask(), recmuBLOCKING_TASK_PRIORITY, recmuCONTROLLING_TASK_PRIORITY, recmuPOLLING_TASK_PRIORITY, vQueueAddToRegistry, xBlockingTaskHandle, xControllingTaskHandle, xMutex, xSemaphoreCreateRecursiveMutex, and xTaskCreate.

00130 {
00131     /* Just creates the mutex and the three tasks. */
00132 
00133     xMutex = xSemaphoreCreateRecursiveMutex();
00134 
00135     /* vQueueAddToRegistry() adds the mutex to the registry, if one is
00136     in use.  The registry is provided as a means for kernel aware 
00137     debuggers to locate mutex and has no purpose if a kernel aware debugger
00138     is not being used.  The call to vQueueAddToRegistry() will be removed
00139     by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is 
00140     defined to be less than 1. */
00141     vQueueAddToRegistry( ( xQueueHandle ) xMutex, ( signed portCHAR * ) "Recursive_Mutex" );
00142 
00143 
00144     if( xMutex != NULL )
00145     {
00146         xTaskCreate( prvRecursiveMutexControllingTask, ( signed portCHAR * ) "Rec1", configMINIMAL_STACK_SIZE, NULL, recmuCONTROLLING_TASK_PRIORITY, &xControllingTaskHandle );
00147         xTaskCreate( prvRecursiveMutexBlockingTask, ( signed portCHAR * ) "Rec2", configMINIMAL_STACK_SIZE, NULL, recmuBLOCKING_TASK_PRIORITY, &xBlockingTaskHandle );
00148         xTaskCreate( prvRecursiveMutexPollingTask, ( signed portCHAR * ) "Rec3", configMINIMAL_STACK_SIZE, NULL, recmuPOLLING_TASK_PRIORITY, NULL );
00149     }
00150 }

portBASE_TYPE xAreRecursiveMutexTasksStillRunning ( void   ) 

Definition at line 320 of file recmutex.c.

References pdFAIL, pdTRUE, portBASE_TYPE, uxBlockingCycles, uxControllingCycles, uxPollingCycles, and xErrorOccurred.

00321 {
00322 portBASE_TYPE xReturn;
00323 static unsigned portBASE_TYPE uxLastControllingCycles = 0, uxLastBlockingCycles = 0, uxLastPollingCycles = 0;
00324 
00325     /* Is the controlling task still cycling? */
00326     if( uxLastControllingCycles == uxControllingCycles )
00327     {
00328         xErrorOccurred = pdTRUE;
00329     }
00330     else
00331     {
00332         uxLastControllingCycles = uxControllingCycles;
00333     }
00334 
00335     /* Is the blocking task still cycling? */
00336     if( uxLastBlockingCycles == uxBlockingCycles )
00337     {
00338         xErrorOccurred = pdTRUE;
00339     }
00340     else
00341     {
00342         uxLastBlockingCycles = uxBlockingCycles;
00343     }
00344 
00345     /* Is the polling task still cycling? */
00346     if( uxLastPollingCycles == uxPollingCycles )
00347     {
00348         xErrorOccurred = pdTRUE;
00349     }
00350     else
00351     {
00352         uxLastPollingCycles = uxPollingCycles;
00353     }
00354 
00355     if( xErrorOccurred == pdTRUE )
00356     {
00357         xReturn = pdFAIL;
00358     }
00359     else
00360     {
00361         xReturn = pdTRUE;
00362     }
00363 
00364     return xReturn;
00365 }


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