/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
*****************************************************************************/\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/* Each task and interrupt is given a unique identifier. This value is used to \r
identify which task sent or received each value. The identifier is also used \r
to distinguish between two tasks that are running the same task function. */\r
-#define intqHIGH_PRIROITY_TASK1 ( ( unsigned portBASE_TYPE ) 1 )\r
-#define intqHIGH_PRIROITY_TASK2 ( ( unsigned portBASE_TYPE ) 2 )\r
-#define intqLOW_PRIROITY_TASK ( ( unsigned portBASE_TYPE ) 3 )\r
+#define intqHIGH_PRIORITY_TASK1 ( ( unsigned portBASE_TYPE ) 1 )\r
+#define intqHIGH_PRIORITY_TASK2 ( ( unsigned portBASE_TYPE ) 2 )\r
+#define intqLOW_PRIORITY_TASK ( ( unsigned portBASE_TYPE ) 3 )\r
#define intqFIRST_INTERRUPT ( ( unsigned portBASE_TYPE ) 4 )\r
#define intqSECOND_INTERRUPT ( ( unsigned portBASE_TYPE ) 5 )\r
#define intqQUEUE_LENGTH ( ( unsigned portBASE_TYPE ) 10 )\r
void vStartInterruptQueueTasks( void )\r
{\r
/* Start the test tasks. */\r
- xTaskCreate( prvHigherPriorityNormallyEmptyTask, ( signed portCHAR * ) "H1QRx", configMINIMAL_STACK_SIZE, ( void * ) intqHIGH_PRIROITY_TASK1, intqHIGHER_PRIORITY, &xHighPriorityNormallyEmptyTask1 );\r
- xTaskCreate( prvHigherPriorityNormallyEmptyTask, ( signed portCHAR * ) "H2QRx", configMINIMAL_STACK_SIZE, ( void * ) intqHIGH_PRIROITY_TASK2, intqHIGHER_PRIORITY, &xHighPriorityNormallyEmptyTask2 );\r
+ xTaskCreate( prvHigherPriorityNormallyEmptyTask, ( signed portCHAR * ) "H1QRx", configMINIMAL_STACK_SIZE, ( void * ) intqHIGH_PRIORITY_TASK1, intqHIGHER_PRIORITY, &xHighPriorityNormallyEmptyTask1 );\r
+ xTaskCreate( prvHigherPriorityNormallyEmptyTask, ( signed portCHAR * ) "H2QRx", configMINIMAL_STACK_SIZE, ( void * ) intqHIGH_PRIORITY_TASK2, intqHIGHER_PRIORITY, &xHighPriorityNormallyEmptyTask2 );\r
xTaskCreate( prvLowerPriorityNormallyEmptyTask, ( signed portCHAR * ) "LQRx", configMINIMAL_STACK_SIZE, NULL, intqLOWER_PRIORITY, NULL );\r
- xTaskCreate( prv1stHigherPriorityNormallyFullTask, ( signed portCHAR * ) "H1QTx", configMINIMAL_STACK_SIZE, ( void * ) intqHIGH_PRIROITY_TASK1, intqHIGHER_PRIORITY, &xHighPriorityNormallyFullTask1 );\r
- xTaskCreate( prv2ndHigherPriorityNormallyFullTask, ( signed portCHAR * ) "H1QTx", configMINIMAL_STACK_SIZE, ( void * ) intqHIGH_PRIROITY_TASK2, intqHIGHER_PRIORITY, &xHighPriorityNormallyFullTask2 );\r
+ xTaskCreate( prv1stHigherPriorityNormallyFullTask, ( signed portCHAR * ) "H1QTx", configMINIMAL_STACK_SIZE, ( void * ) intqHIGH_PRIORITY_TASK1, intqHIGHER_PRIORITY, &xHighPriorityNormallyFullTask1 );\r
+ xTaskCreate( prv2ndHigherPriorityNormallyFullTask, ( signed portCHAR * ) "H1QTx", configMINIMAL_STACK_SIZE, ( void * ) intqHIGH_PRIORITY_TASK2, intqHIGHER_PRIORITY, &xHighPriorityNormallyFullTask2 );\r
xTaskCreate( prvLowerPriorityNormallyFullTask, ( signed portCHAR * ) "LQRx", configMINIMAL_STACK_SIZE, NULL, intqLOWER_PRIORITY, NULL );\r
\r
/* Create the queues that are accessed by multiple tasks and multiple \r
/* The timer should not be started until after the scheduler has started. \r
More than one task is running this code so we check the parameter value\r
to determine which task should start the timer. */\r
- if( ( unsigned portBASE_TYPE ) pvParameters == intqHIGH_PRIROITY_TASK1 )\r
+ if( ( unsigned portBASE_TYPE ) pvParameters == intqHIGH_PRIORITY_TASK1 )\r
{\r
vInitialiseTimerForIntQueueTest();\r
}\r
/* Ensure the other task running this code gets a chance to execute. */\r
taskYIELD();\r
\r
- if( ( unsigned portBASE_TYPE ) pvParameters == intqHIGH_PRIROITY_TASK1 )\r
+ if( ( unsigned portBASE_TYPE ) pvParameters == intqHIGH_PRIORITY_TASK1 )\r
{\r
/* Have we received all the expected values? */\r
if( uxValueForNormallyEmptyQueue > ( intqNUM_VALUES_TO_LOG + intqVALUE_OVERRUN ) )\r
}\r
else\r
{\r
- if( ucNormallyEmptyReceivedValues[ ux ] == intqHIGH_PRIROITY_TASK1 )\r
+ if( ucNormallyEmptyReceivedValues[ ux ] == intqHIGH_PRIORITY_TASK1 )\r
{\r
/* Value was placed into the array by task 1. */\r
uxTask1++;\r
}\r
- else if( ucNormallyEmptyReceivedValues[ ux ] == intqHIGH_PRIROITY_TASK2 )\r
+ else if( ucNormallyEmptyReceivedValues[ ux ] == intqHIGH_PRIORITY_TASK2 )\r
{\r
/* Value was placed into the array by task 2. */\r
uxTask2++;\r
prvQueueAccessLogError( __LINE__ );\r
}\r
\r
- prvRecordValue_NormallyEmpty( uxRxed, intqLOW_PRIROITY_TASK );\r
+ prvRecordValue_NormallyEmpty( uxRxed, intqLOW_PRIORITY_TASK );\r
\r
/* Wake the higher priority task again. */\r
vTaskResume( xHighPriorityNormallyEmptyTask1 );\r
\r
if( ( xQueueStatus = xQueueSend( xNormallyFullQueue, &uxValueToTx, intqSHORT_DELAY ) ) != pdPASS )\r
{\r
- /* intqHIGH_PRIROITY_TASK2 is never suspended so we would not \r
+ /* intqHIGH_PRIORITY_TASK2 is never suspended so we would not \r
expect it to ever time out. */\r
prvQueueAccessLogError( __LINE__ );\r
}\r
}\r
else\r
{\r
- prvRecordValue_NormallyFull( uxValue, intqLOW_PRIROITY_TASK );\r
+ prvRecordValue_NormallyFull( uxValue, intqLOW_PRIORITY_TASK );\r
}\r
\r
vTaskPrioritySet( NULL, intqLOWER_PRIORITY );\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
-/*
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.
-
- This file is part of the FreeRTOS.org distribution.
-
- FreeRTOS.org is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- FreeRTOS.org is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with FreeRTOS.org; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- A special exception to the GPL can be applied should you wish to distribute
- a combined work that includes FreeRTOS.org, without being obliged to provide
- the source code for any proprietary components. See the licensing section
- of http://www.FreeRTOS.org for full details of how and when the exception
- can be applied.
-
- ***************************************************************************
- ***************************************************************************
- * *
- * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, *
- * and even write all or part of your application on your behalf. *
- * See http://www.OpenRTOS.com for details of the services we provide to *
- * expedite your project. *
- * *
- ***************************************************************************
- ***************************************************************************
-
- Please ensure to read the configuration and relevant port sections of the
- online documentation.
-
- http://www.FreeRTOS.org - Documentation, latest information, license and
- contact details.
-
- http://www.SafeRTOS.com - A version that is certified for use in safety
- critical systems.
-
- http://www.OpenRTOS.com - Commercial support, development, porting,
- licensing and training services.
-*/
-
-
-/*
- * Simple demonstration of the usage of counting semaphore.
- */
-
-/* Scheduler include files. */
-#include "FreeRTOS.h"
-#include "task.h"
-#include "semphr.h"
-
-/* Demo program include files. */
-#include "countsem.h"
-
-/* The maximum count value that the semaphore used for the demo can hold. */
-#define countMAX_COUNT_VALUE ( 200 )
-
-/* Constants used to indicate whether or not the semaphore should have been
-created with its maximum count value, or its minimum count value. These
-numbers are used to ensure that the pointers passed in as the task parameters
-are valid. */
-#define countSTART_AT_MAX_COUNT ( 0xaa )
-#define countSTART_AT_ZERO ( 0x55 )
-
-/* Two tasks are created for the test. One uses a semaphore created with its
-count value set to the maximum, and one with the count value set to zero. */
-#define countNUM_TEST_TASKS ( 2 )
-#define countDONT_BLOCK ( 0 )
-
-/*-----------------------------------------------------------*/
-
-/* Flag that will be latched to pdTRUE should any unexpected behaviour be
-detected in any of the tasks. */
-static volatile portBASE_TYPE xErrorDetected = pdFALSE;
-
-/*-----------------------------------------------------------*/
-
-/*
- * The demo task. This simply counts the semaphore up to its maximum value,
- * the counts it back down again. The result of each semaphore 'give' and
- * 'take' is inspected, with an error being flagged if it is found not to be
- * the expected result.
- */
-static void prvCountingSemaphoreTask( void *pvParameters );
-
-/*
- * Utility function to increment the semaphore count value up from zero to
- * countMAX_COUNT_VALUE.
- */
-static void prvIncrementSemaphoreCount( xSemaphoreHandle xSemaphore, unsigned portBASE_TYPE *puxLoopCounter );
-
-/*
- * Utility function to decrement the semaphore count value up from
- * countMAX_COUNT_VALUE to zero.
- */
-static void prvDecrementSemaphoreCount( xSemaphoreHandle xSemaphore, unsigned portBASE_TYPE *puxLoopCounter );
-
-/*-----------------------------------------------------------*/
-
-/* The structure that is passed into the task as the task parameter. */
-typedef struct COUNT_SEM_STRUCT
-{
- /* The semaphore to be used for the demo. */
- xSemaphoreHandle xSemaphore;
-
- /* Set to countSTART_AT_MAX_COUNT if the semaphore should be created with
- its count value set to its max count value, or countSTART_AT_ZERO if it
- should have been created with its count value set to 0. */
- unsigned portBASE_TYPE uxExpectedStartCount;
-
- /* Incremented on each cycle of the demo task. Used to detect a stalled
- task. */
- unsigned portBASE_TYPE uxLoopCounter;
-} xCountSemStruct;
-
-/* Two structures are defined, one is passed to each test task. */
-static volatile xCountSemStruct xParameters[ countNUM_TEST_TASKS ];
-
-/*-----------------------------------------------------------*/
-
-void vStartCountingSemaphoreTasks( void )
-{
- /* Create the semaphores that we are going to use for the test/demo. The
- first should be created such that it starts at its maximum count value,
- the second should be created such that it starts with a count value of zero. */
- xParameters[ 0 ].xSemaphore = xSemaphoreCreateCounting( countMAX_COUNT_VALUE, countMAX_COUNT_VALUE );
- xParameters[ 0 ].uxExpectedStartCount = countSTART_AT_MAX_COUNT;
- xParameters[ 0 ].uxLoopCounter = 0;
-
- xParameters[ 1 ].xSemaphore = xSemaphoreCreateCounting( countMAX_COUNT_VALUE, 0 );
- xParameters[ 1 ].uxExpectedStartCount = 0;
- xParameters[ 1 ].uxLoopCounter = 0;
+/*\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
+\r
+ This file is part of the FreeRTOS.org distribution.\r
+\r
+ FreeRTOS.org is free software; you can redistribute it and/or modify\r
+ it under the terms of the GNU General Public License as published by\r
+ the Free Software Foundation; either version 2 of the License, or\r
+ (at your option) any later version.\r
+\r
+ FreeRTOS.org is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ GNU General Public License for more details.\r
+\r
+ You should have received a copy of the GNU General Public License\r
+ along with FreeRTOS.org; if not, write to the Free Software\r
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+\r
+ A special exception to the GPL can be applied should you wish to distribute\r
+ a combined work that includes FreeRTOS.org, without being obliged to provide\r
+ the source code for any proprietary components. See the licensing section\r
+ of http://www.FreeRTOS.org for full details of how and when the exception\r
+ can be applied.\r
+\r
+ ***************************************************************************\r
+ ***************************************************************************\r
+ * *\r
+ * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, *\r
+ * and even write all or part of your application on your behalf. *\r
+ * See http://www.OpenRTOS.com for details of the services we provide to *\r
+ * expedite your project. *\r
+ * *\r
+ ***************************************************************************\r
+ ***************************************************************************\r
+\r
+ Please ensure to read the configuration and relevant port sections of the\r
+ online documentation.\r
+\r
+ http://www.FreeRTOS.org - Documentation, latest information, license and \r
+ contact details.\r
+\r
+ http://www.SafeRTOS.com - A version that is certified for use in safety \r
+ critical systems.\r
+\r
+ http://www.OpenRTOS.com - Commercial support, development, porting, \r
+ licensing and training services.\r
+*/\r
+\r
+\r
+/* \r
+ * Simple demonstration of the usage of counting semaphore.\r
+ */\r
+\r
+/* Scheduler include files. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+#include "semphr.h"\r
+\r
+/* Demo program include files. */\r
+#include "countsem.h"\r
+\r
+/* The maximum count value that the semaphore used for the demo can hold. */\r
+#define countMAX_COUNT_VALUE ( 200 )\r
+\r
+/* Constants used to indicate whether or not the semaphore should have been\r
+created with its maximum count value, or its minimum count value. These \r
+numbers are used to ensure that the pointers passed in as the task parameters\r
+are valid. */\r
+#define countSTART_AT_MAX_COUNT ( 0xaa )\r
+#define countSTART_AT_ZERO ( 0x55 )\r
+\r
+/* Two tasks are created for the test. One uses a semaphore created with its\r
+count value set to the maximum, and one with the count value set to zero. */\r
+#define countNUM_TEST_TASKS ( 2 )\r
+#define countDONT_BLOCK ( 0 )\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Flag that will be latched to pdTRUE should any unexpected behaviour be\r
+detected in any of the tasks. */\r
+static volatile portBASE_TYPE xErrorDetected = pdFALSE;\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+ * The demo task. This simply counts the semaphore up to its maximum value,\r
+ * the counts it back down again. The result of each semaphore 'give' and\r
+ * 'take' is inspected, with an error being flagged if it is found not to be\r
+ * the expected result.\r
+ */\r
+static void prvCountingSemaphoreTask( void *pvParameters );\r
+\r
+/*\r
+ * Utility function to increment the semaphore count value up from zero to\r
+ * countMAX_COUNT_VALUE.\r
+ */\r
+static void prvIncrementSemaphoreCount( xSemaphoreHandle xSemaphore, unsigned portBASE_TYPE *puxLoopCounter );\r
+\r
+/*\r
+ * Utility function to decrement the semaphore count value up from \r
+ * countMAX_COUNT_VALUE to zero.\r
+ */\r
+static void prvDecrementSemaphoreCount( xSemaphoreHandle xSemaphore, unsigned portBASE_TYPE *puxLoopCounter );\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/* The structure that is passed into the task as the task parameter. */\r
+typedef struct COUNT_SEM_STRUCT\r
+{\r
+ /* The semaphore to be used for the demo. */\r
+ xSemaphoreHandle xSemaphore;\r
+\r
+ /* Set to countSTART_AT_MAX_COUNT if the semaphore should be created with\r
+ its count value set to its max count value, or countSTART_AT_ZERO if it\r
+ should have been created with its count value set to 0. */\r
+ unsigned portBASE_TYPE uxExpectedStartCount; \r
+\r
+ /* Incremented on each cycle of the demo task. Used to detect a stalled\r
+ task. */\r
+ unsigned portBASE_TYPE uxLoopCounter; \r
+} xCountSemStruct;\r
+\r
+/* Two structures are defined, one is passed to each test task. */\r
+static volatile xCountSemStruct xParameters[ countNUM_TEST_TASKS ];\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+void vStartCountingSemaphoreTasks( void )\r
+{\r
+ /* Create the semaphores that we are going to use for the test/demo. The\r
+ first should be created such that it starts at its maximum count value,\r
+ the second should be created such that it starts with a count value of zero. */\r
+ xParameters[ 0 ].xSemaphore = xSemaphoreCreateCounting( countMAX_COUNT_VALUE, countMAX_COUNT_VALUE );\r
+ xParameters[ 0 ].uxExpectedStartCount = countSTART_AT_MAX_COUNT;\r
+ xParameters[ 0 ].uxLoopCounter = 0;\r
+\r
+ xParameters[ 1 ].xSemaphore = xSemaphoreCreateCounting( countMAX_COUNT_VALUE, 0 );\r
+ xParameters[ 1 ].uxExpectedStartCount = 0;\r
+ xParameters[ 1 ].uxLoopCounter = 0;\r
\r
/* vQueueAddToRegistry() adds the semaphore to the registry, if one is\r
in use. The registry is provided as a means for kernel aware \r
vQueueAddToRegistry( ( xQueueHandle ) xParameters[ 0 ].xSemaphore, ( signed portCHAR * ) "Counting_Sem_1" );\r
vQueueAddToRegistry( ( xQueueHandle ) xParameters[ 1 ].xSemaphore, ( signed portCHAR * ) "Counting_Sem_2" );\r
\r
-
- /* Were the semaphores created? */
- if( ( xParameters[ 0 ].xSemaphore != NULL ) || ( xParameters[ 1 ].xSemaphore != NULL ) )
- {
- /* Create the demo tasks, passing in the semaphore to use as the parameter. */
- xTaskCreate( prvCountingSemaphoreTask, ( signed portCHAR * ) "CNT1", configMINIMAL_STACK_SIZE, ( void * ) &( xParameters[ 0 ] ), tskIDLE_PRIORITY, NULL );
- xTaskCreate( prvCountingSemaphoreTask, ( signed portCHAR * ) "CNT2", configMINIMAL_STACK_SIZE, ( void * ) &( xParameters[ 1 ] ), tskIDLE_PRIORITY, NULL );
- }
-}
-/*-----------------------------------------------------------*/
-
-static void prvDecrementSemaphoreCount( xSemaphoreHandle xSemaphore, unsigned portBASE_TYPE *puxLoopCounter )
-{
-unsigned portBASE_TYPE ux;
-
- /* If the semaphore count is at its maximum then we should not be able to
- 'give' the semaphore. */
- if( xSemaphoreGive( xSemaphore ) == pdPASS )
- {
- xErrorDetected = pdTRUE;
- }
-
- /* We should be able to 'take' the semaphore countMAX_COUNT_VALUE times. */
- for( ux = 0; ux < countMAX_COUNT_VALUE; ux++ )
- {
- if( xSemaphoreTake( xSemaphore, countDONT_BLOCK ) != pdPASS )
- {
- /* We expected to be able to take the semaphore. */
- xErrorDetected = pdTRUE;
- }
-
- ( *puxLoopCounter )++;
- }
-
- #if configUSE_PREEMPTION == 0
- taskYIELD();
- #endif
-
- /* If the semaphore count is zero then we should not be able to 'take'
- the semaphore. */
- if( xSemaphoreTake( xSemaphore, countDONT_BLOCK ) == pdPASS )
- {
- xErrorDetected = pdTRUE;
- }
-}
-/*-----------------------------------------------------------*/
-
-static void prvIncrementSemaphoreCount( xSemaphoreHandle xSemaphore, unsigned portBASE_TYPE *puxLoopCounter )
-{
-unsigned portBASE_TYPE ux;
-
- /* If the semaphore count is zero then we should not be able to 'take'
- the semaphore. */
- if( xSemaphoreTake( xSemaphore, countDONT_BLOCK ) == pdPASS )
- {
- xErrorDetected = pdTRUE;
- }
-
- /* We should be able to 'give' the semaphore countMAX_COUNT_VALUE times. */
- for( ux = 0; ux < countMAX_COUNT_VALUE; ux++ )
- {
- if( xSemaphoreGive( xSemaphore ) != pdPASS )
- {
- /* We expected to be able to take the semaphore. */
- xErrorDetected = pdTRUE;
- }
-
- ( *puxLoopCounter )++;
- }
-
- #if configUSE_PREEMPTION == 0
- taskYIELD();
- #endif
-
- /* If the semaphore count is at its maximum then we should not be able to
- 'give' the semaphore. */
- if( xSemaphoreGive( xSemaphore ) == pdPASS )
- {
- xErrorDetected = pdTRUE;
- }
-}
-/*-----------------------------------------------------------*/
-
-static void prvCountingSemaphoreTask( void *pvParameters )
-{
-xCountSemStruct *pxParameter;
-
- #ifdef USE_STDIO
- void vPrintDisplayMessage( const portCHAR * const * ppcMessageToSend );
-
- const portCHAR * const pcTaskStartMsg = "Counting semaphore demo started.\r\n";
-
- /* Queue a message for printing to say the task has started. */
- vPrintDisplayMessage( &pcTaskStartMsg );
- #endif
-
- /* The semaphore to be used was passed as the parameter. */
- pxParameter = ( xCountSemStruct * ) pvParameters;
-
- /* Did we expect to find the semaphore already at its max count value, or
- at zero? */
- if( pxParameter->uxExpectedStartCount == countSTART_AT_MAX_COUNT )
- {
- prvDecrementSemaphoreCount( pxParameter->xSemaphore, &( pxParameter->uxLoopCounter ) );
- }
-
- /* Now we expect the semaphore count to be 0, so this time there is an
- error if we can take the semaphore. */
- if( xSemaphoreTake( pxParameter->xSemaphore, 0 ) == pdPASS )
- {
- xErrorDetected = pdTRUE;
- }
-
- for( ;; )
- {
- prvIncrementSemaphoreCount( pxParameter->xSemaphore, &( pxParameter->uxLoopCounter ) );
- prvDecrementSemaphoreCount( pxParameter->xSemaphore, &( pxParameter->uxLoopCounter ) );
- }
-}
-/*-----------------------------------------------------------*/
-
-portBASE_TYPE xAreCountingSemaphoreTasksStillRunning( void )
-{
-static unsigned portBASE_TYPE uxLastCount0 = 0, uxLastCount1 = 0;
-portBASE_TYPE xReturn = pdPASS;
-
- /* Return fail if any 'give' or 'take' did not result in the expected
- behaviour. */
- if( xErrorDetected != pdFALSE )
- {
- xReturn = pdFAIL;
- }
-
- /* Return fail if either task is not still incrementing its loop counter. */
- if( uxLastCount0 == xParameters[ 0 ].uxLoopCounter )
- {
- xReturn = pdFAIL;
- }
- else
- {
- uxLastCount0 = xParameters[ 0 ].uxLoopCounter;
- }
-
- if( uxLastCount1 == xParameters[ 1 ].uxLoopCounter )
- {
- xReturn = pdFAIL;
- }
- else
- {
- uxLastCount1 = xParameters[ 1 ].uxLoopCounter;
- }
-
- return xReturn;
-}
-
-
+\r
+ /* Were the semaphores created? */\r
+ if( ( xParameters[ 0 ].xSemaphore != NULL ) || ( xParameters[ 1 ].xSemaphore != NULL ) )\r
+ {\r
+ /* Create the demo tasks, passing in the semaphore to use as the parameter. */\r
+ xTaskCreate( prvCountingSemaphoreTask, ( signed portCHAR * ) "CNT1", configMINIMAL_STACK_SIZE, ( void * ) &( xParameters[ 0 ] ), tskIDLE_PRIORITY, NULL );\r
+ xTaskCreate( prvCountingSemaphoreTask, ( signed portCHAR * ) "CNT2", configMINIMAL_STACK_SIZE, ( void * ) &( xParameters[ 1 ] ), tskIDLE_PRIORITY, NULL ); \r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvDecrementSemaphoreCount( xSemaphoreHandle xSemaphore, unsigned portBASE_TYPE *puxLoopCounter )\r
+{\r
+unsigned portBASE_TYPE ux;\r
+\r
+ /* If the semaphore count is at its maximum then we should not be able to\r
+ 'give' the semaphore. */\r
+ if( xSemaphoreGive( xSemaphore ) == pdPASS )\r
+ {\r
+ xErrorDetected = pdTRUE;\r
+ }\r
+\r
+ /* We should be able to 'take' the semaphore countMAX_COUNT_VALUE times. */\r
+ for( ux = 0; ux < countMAX_COUNT_VALUE; ux++ )\r
+ {\r
+ if( xSemaphoreTake( xSemaphore, countDONT_BLOCK ) != pdPASS )\r
+ {\r
+ /* We expected to be able to take the semaphore. */\r
+ xErrorDetected = pdTRUE;\r
+ }\r
+\r
+ ( *puxLoopCounter )++;\r
+ }\r
+\r
+ #if configUSE_PREEMPTION == 0\r
+ taskYIELD();\r
+ #endif\r
+\r
+ /* If the semaphore count is zero then we should not be able to 'take' \r
+ the semaphore. */\r
+ if( xSemaphoreTake( xSemaphore, countDONT_BLOCK ) == pdPASS )\r
+ {\r
+ xErrorDetected = pdTRUE;\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvIncrementSemaphoreCount( xSemaphoreHandle xSemaphore, unsigned portBASE_TYPE *puxLoopCounter )\r
+{\r
+unsigned portBASE_TYPE ux;\r
+\r
+ /* If the semaphore count is zero then we should not be able to 'take' \r
+ the semaphore. */\r
+ if( xSemaphoreTake( xSemaphore, countDONT_BLOCK ) == pdPASS )\r
+ {\r
+ xErrorDetected = pdTRUE;\r
+ }\r
+\r
+ /* We should be able to 'give' the semaphore countMAX_COUNT_VALUE times. */\r
+ for( ux = 0; ux < countMAX_COUNT_VALUE; ux++ )\r
+ {\r
+ if( xSemaphoreGive( xSemaphore ) != pdPASS )\r
+ {\r
+ /* We expected to be able to take the semaphore. */\r
+ xErrorDetected = pdTRUE;\r
+ }\r
+\r
+ ( *puxLoopCounter )++;\r
+ }\r
+\r
+ #if configUSE_PREEMPTION == 0\r
+ taskYIELD();\r
+ #endif\r
+\r
+ /* If the semaphore count is at its maximum then we should not be able to\r
+ 'give' the semaphore. */\r
+ if( xSemaphoreGive( xSemaphore ) == pdPASS )\r
+ {\r
+ xErrorDetected = pdTRUE;\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvCountingSemaphoreTask( void *pvParameters )\r
+{\r
+xCountSemStruct *pxParameter;\r
+\r
+ #ifdef USE_STDIO\r
+ void vPrintDisplayMessage( const portCHAR * const * ppcMessageToSend );\r
+ \r
+ const portCHAR * const pcTaskStartMsg = "Counting semaphore demo started.\r\n";\r
+\r
+ /* Queue a message for printing to say the task has started. */\r
+ vPrintDisplayMessage( &pcTaskStartMsg );\r
+ #endif\r
+\r
+ /* The semaphore to be used was passed as the parameter. */\r
+ pxParameter = ( xCountSemStruct * ) pvParameters;\r
+\r
+ /* Did we expect to find the semaphore already at its max count value, or\r
+ at zero? */\r
+ if( pxParameter->uxExpectedStartCount == countSTART_AT_MAX_COUNT )\r
+ {\r
+ prvDecrementSemaphoreCount( pxParameter->xSemaphore, &( pxParameter->uxLoopCounter ) );\r
+ }\r
+\r
+ /* Now we expect the semaphore count to be 0, so this time there is an\r
+ error if we can take the semaphore. */\r
+ if( xSemaphoreTake( pxParameter->xSemaphore, 0 ) == pdPASS )\r
+ {\r
+ xErrorDetected = pdTRUE;\r
+ }\r
+\r
+ for( ;; )\r
+ {\r
+ prvIncrementSemaphoreCount( pxParameter->xSemaphore, &( pxParameter->uxLoopCounter ) );\r
+ prvDecrementSemaphoreCount( pxParameter->xSemaphore, &( pxParameter->uxLoopCounter ) );\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+portBASE_TYPE xAreCountingSemaphoreTasksStillRunning( void )\r
+{\r
+static unsigned portBASE_TYPE uxLastCount0 = 0, uxLastCount1 = 0;\r
+portBASE_TYPE xReturn = pdPASS;\r
+\r
+ /* Return fail if any 'give' or 'take' did not result in the expected\r
+ behaviour. */\r
+ if( xErrorDetected != pdFALSE )\r
+ {\r
+ xReturn = pdFAIL;\r
+ }\r
+\r
+ /* Return fail if either task is not still incrementing its loop counter. */\r
+ if( uxLastCount0 == xParameters[ 0 ].uxLoopCounter )\r
+ {\r
+ xReturn = pdFAIL;\r
+ }\r
+ else\r
+ {\r
+ uxLastCount0 = xParameters[ 0 ].uxLoopCounter;\r
+ }\r
+\r
+ if( uxLastCount1 == xParameters[ 1 ].uxLoopCounter )\r
+ {\r
+ xReturn = pdFAIL;\r
+ }\r
+ else\r
+ {\r
+ uxLastCount1 = xParameters[ 1 ].uxLoopCounter;\r
+ }\r
+\r
+ return xReturn;\r
+}\r
+\r
+\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
-/*
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.
-
- This file is part of the FreeRTOS.org distribution.
-
- FreeRTOS.org is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- FreeRTOS.org is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with FreeRTOS.org; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- A special exception to the GPL can be applied should you wish to distribute
- a combined work that includes FreeRTOS.org, without being obliged to provide
- the source code for any proprietary components. See the licensing section
- of http://www.FreeRTOS.org for full details of how and when the exception
- can be applied.
-
- ***************************************************************************
- ***************************************************************************
- * *
- * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, *
- * and even write all or part of your application on your behalf. *
- * See http://www.OpenRTOS.com for details of the services we provide to *
- * expedite your project. *
- * *
- ***************************************************************************
- ***************************************************************************
-
- Please ensure to read the configuration and relevant port sections of the
- online documentation.
-
- http://www.FreeRTOS.org - Documentation, latest information, license and
- contact details.
-
- http://www.SafeRTOS.com - A version that is certified for use in safety
- critical systems.
-
- http://www.OpenRTOS.com - Commercial support, development, porting,
- licensing and training services.
-*/
-
-/*
- The tasks defined on this page demonstrate the use of recursive mutexes.
-
- For recursive mutex functionality the created mutex should be created using
- xSemaphoreCreateRecursiveMutex(), then be manipulated
- using the xSemaphoreTakeRecursive() and xSemaphoreGiveRecursive() API
- functions.
-
- This demo creates three tasks all of which access the same recursive mutex:
-
- prvRecursiveMutexControllingTask() has the highest priority so executes
- first and grabs the mutex. It then performs some recursive accesses -
- between each of which it sleeps for a short period to let the lower
- priority tasks execute. When it has completed its demo functionality
- it gives the mutex back before suspending itself.
-
- prvRecursiveMutexBlockingTask() attempts to access the mutex by performing
- a blocking 'take'. The blocking task has a lower priority than the
- controlling task so by the time it executes the mutex has already been
- taken by the controlling task, causing the blocking task to block. It
- does not unblock until the controlling task has given the mutex back,
- and it does not actually run until the controlling task has suspended
- itself (due to the relative priorities). When it eventually does obtain
- the mutex all it does is give the mutex back prior to also suspending
- itself. At this point both the controlling task and the blocking task are
- suspended.
-
- prvRecursiveMutexPollingTask() runs at the idle priority. It spins round
- a tight loop attempting to obtain the mutex with a non-blocking call. As
- the lowest priority task it will not successfully obtain the mutex until
- both the controlling and blocking tasks are suspended. Once it eventually
- does obtain the mutex it first unsuspends both the controlling task and
- blocking task prior to giving the mutex back - resulting in the polling
- task temporarily inheriting the controlling tasks priority.
-*/
-
-/* Scheduler include files. */
-#include "FreeRTOS.h"
-#include "task.h"
-#include "semphr.h"
-
-/* Demo app include files. */
-#include "recmutex.h"
-
-/* Priorities assigned to the three tasks. */
-#define recmuCONTROLLING_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
-#define recmuBLOCKING_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
-#define recmuPOLLING_TASK_PRIORITY ( tskIDLE_PRIORITY + 0 )
-
-/* The recursive call depth. */
-#define recmuMAX_COUNT ( 10 )
-
-/* Misc. */
-#define recmuSHORT_DELAY ( 20 / portTICK_RATE_MS )
-#define recmuNO_DELAY ( ( portTickType ) 0 )
-#define recmuTWO_TICK_DELAY ( ( portTickType ) 2 )
-
-/* The three tasks as described at the top of this file. */
-static void prvRecursiveMutexControllingTask( void *pvParameters );
-static void prvRecursiveMutexBlockingTask( void *pvParameters );
-static void prvRecursiveMutexPollingTask( void *pvParameters );
-
-/* The mutex used by the demo. */
-static xSemaphoreHandle xMutex;
-
-/* Variables used to detect and latch errors. */
-static volatile portBASE_TYPE xErrorOccurred = pdFALSE, xControllingIsSuspended = pdFALSE, xBlockingIsSuspended = pdFALSE;
-static volatile unsigned portBASE_TYPE uxControllingCycles = 0, uxBlockingCycles, uxPollingCycles = 0;
-
-/* Handles of the two higher priority tasks, required so they can be resumed
-(unsuspended). */
-static xTaskHandle xControllingTaskHandle, xBlockingTaskHandle;
-
-/*-----------------------------------------------------------*/
-
-void vStartRecursiveMutexTasks( void )
-{
- /* Just creates the mutex and the three tasks. */
-
+/*\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
+\r
+ This file is part of the FreeRTOS.org distribution.\r
+\r
+ FreeRTOS.org is free software; you can redistribute it and/or modify\r
+ it under the terms of the GNU General Public License as published by\r
+ the Free Software Foundation; either version 2 of the License, or\r
+ (at your option) any later version.\r
+\r
+ FreeRTOS.org is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ GNU General Public License for more details.\r
+\r
+ You should have received a copy of the GNU General Public License\r
+ along with FreeRTOS.org; if not, write to the Free Software\r
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+\r
+ A special exception to the GPL can be applied should you wish to distribute\r
+ a combined work that includes FreeRTOS.org, without being obliged to provide\r
+ the source code for any proprietary components. See the licensing section \r
+ of http://www.FreeRTOS.org for full details of how and when the exception\r
+ can be applied.\r
+\r
+ ***************************************************************************\r
+ ***************************************************************************\r
+ * *\r
+ * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, *\r
+ * and even write all or part of your application on your behalf. *\r
+ * See http://www.OpenRTOS.com for details of the services we provide to *\r
+ * expedite your project. *\r
+ * *\r
+ ***************************************************************************\r
+ ***************************************************************************\r
+\r
+ Please ensure to read the configuration and relevant port sections of the\r
+ online documentation.\r
+\r
+ http://www.FreeRTOS.org - Documentation, latest information, license and \r
+ contact details.\r
+\r
+ http://www.SafeRTOS.com - A version that is certified for use in safety \r
+ critical systems.\r
+\r
+ http://www.OpenRTOS.com - Commercial support, development, porting, \r
+ licensing and training services.\r
+*/\r
+\r
+/*\r
+ The tasks defined on this page demonstrate the use of recursive mutexes.\r
+\r
+ For recursive mutex functionality the created mutex should be created using\r
+ xSemaphoreCreateRecursiveMutex(), then be manipulated\r
+ using the xSemaphoreTakeRecursive() and xSemaphoreGiveRecursive() API\r
+ functions.\r
+\r
+ This demo creates three tasks all of which access the same recursive mutex:\r
+\r
+ prvRecursiveMutexControllingTask() has the highest priority so executes \r
+ first and grabs the mutex. It then performs some recursive accesses - \r
+ between each of which it sleeps for a short period to let the lower \r
+ priority tasks execute. When it has completed its demo functionality\r
+ it gives the mutex back before suspending itself.\r
+\r
+ prvRecursiveMutexBlockingTask() attempts to access the mutex by performing\r
+ a blocking 'take'. The blocking task has a lower priority than the \r
+ controlling task so by the time it executes the mutex has already been\r
+ taken by the controlling task, causing the blocking task to block. It \r
+ does not unblock until the controlling task has given the mutex back, \r
+ and it does not actually run until the controlling task has suspended \r
+ itself (due to the relative priorities). When it eventually does obtain\r
+ the mutex all it does is give the mutex back prior to also suspending \r
+ itself. At this point both the controlling task and the blocking task are \r
+ suspended.\r
+\r
+ prvRecursiveMutexPollingTask() runs at the idle priority. It spins round\r
+ a tight loop attempting to obtain the mutex with a non-blocking call. As\r
+ the lowest priority task it will not successfully obtain the mutex until\r
+ both the controlling and blocking tasks are suspended. Once it eventually \r
+ does obtain the mutex it first unsuspends both the controlling task and\r
+ blocking task prior to giving the mutex back - resulting in the polling\r
+ task temporarily inheriting the controlling tasks priority.\r
+*/\r
+\r
+/* Scheduler include files. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+#include "semphr.h"\r
+\r
+/* Demo app include files. */\r
+#include "recmutex.h"\r
+\r
+/* Priorities assigned to the three tasks. */\r
+#define recmuCONTROLLING_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )\r
+#define recmuBLOCKING_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )\r
+#define recmuPOLLING_TASK_PRIORITY ( tskIDLE_PRIORITY + 0 )\r
+\r
+/* The recursive call depth. */\r
+#define recmuMAX_COUNT ( 10 )\r
+\r
+/* Misc. */\r
+#define recmuSHORT_DELAY ( 20 / portTICK_RATE_MS )\r
+#define recmuNO_DELAY ( ( portTickType ) 0 )\r
+#define recmuTWO_TICK_DELAY ( ( portTickType ) 2 )\r
+\r
+/* The three tasks as described at the top of this file. */\r
+static void prvRecursiveMutexControllingTask( void *pvParameters );\r
+static void prvRecursiveMutexBlockingTask( void *pvParameters );\r
+static void prvRecursiveMutexPollingTask( void *pvParameters );\r
+\r
+/* The mutex used by the demo. */\r
+static xSemaphoreHandle xMutex;\r
+\r
+/* Variables used to detect and latch errors. */\r
+static volatile portBASE_TYPE xErrorOccurred = pdFALSE, xControllingIsSuspended = pdFALSE, xBlockingIsSuspended = pdFALSE;\r
+static volatile unsigned portBASE_TYPE uxControllingCycles = 0, uxBlockingCycles, uxPollingCycles = 0;\r
+\r
+/* Handles of the two higher priority tasks, required so they can be resumed \r
+(unsuspended). */\r
+static xTaskHandle xControllingTaskHandle, xBlockingTaskHandle;\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+void vStartRecursiveMutexTasks( void )\r
+{\r
+ /* Just creates the mutex and the three tasks. */\r
+\r
xMutex = xSemaphoreCreateRecursiveMutex();\r
\r
/* vQueueAddToRegistry() adds the mutex to the registry, if one is\r
by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is \r
defined to be less than 1. */\r
vQueueAddToRegistry( ( xQueueHandle ) xMutex, ( signed portCHAR * ) "Recursive_Mutex" );\r
-
-
- if( xMutex != NULL )
- {
- xTaskCreate( prvRecursiveMutexControllingTask, ( signed portCHAR * ) "Rec1", configMINIMAL_STACK_SIZE, NULL, recmuCONTROLLING_TASK_PRIORITY, &xControllingTaskHandle );
- xTaskCreate( prvRecursiveMutexBlockingTask, ( signed portCHAR * ) "Rec2", configMINIMAL_STACK_SIZE, NULL, recmuBLOCKING_TASK_PRIORITY, &xBlockingTaskHandle );
- xTaskCreate( prvRecursiveMutexPollingTask, ( signed portCHAR * ) "Rec3", configMINIMAL_STACK_SIZE, NULL, recmuPOLLING_TASK_PRIORITY, NULL );
- }
-}
-/*-----------------------------------------------------------*/
-
-static void prvRecursiveMutexControllingTask( void *pvParameters )
-{
-unsigned portBASE_TYPE ux;
+\r
+\r
+ if( xMutex != NULL )\r
+ {\r
+ xTaskCreate( prvRecursiveMutexControllingTask, ( signed portCHAR * ) "Rec1", configMINIMAL_STACK_SIZE, NULL, recmuCONTROLLING_TASK_PRIORITY, &xControllingTaskHandle );\r
+ xTaskCreate( prvRecursiveMutexBlockingTask, ( signed portCHAR * ) "Rec2", configMINIMAL_STACK_SIZE, NULL, recmuBLOCKING_TASK_PRIORITY, &xBlockingTaskHandle );\r
+ xTaskCreate( prvRecursiveMutexPollingTask, ( signed portCHAR * ) "Rec3", configMINIMAL_STACK_SIZE, NULL, recmuPOLLING_TASK_PRIORITY, NULL );\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvRecursiveMutexControllingTask( void *pvParameters )\r
+{\r
+unsigned portBASE_TYPE ux;\r
\r
/* Just to remove compiler warning. */\r
( void ) pvParameters;\r
-
- for( ;; )
- {
- /* Should not be able to 'give' the mutex, as we have not yet 'taken'
- it. */
- if( xSemaphoreGiveRecursive( xMutex ) == pdPASS )
- {
- xErrorOccurred = pdTRUE;
- }
-
- for( ux = 0; ux < recmuMAX_COUNT; ux++ )
- {
- /* We should now be able to take the mutex as many times as
- we like. A one tick delay is used so the polling task will
- inherit our priority on all but the first cycle of this task.
- If we did not block attempting to receive the mutex then no
- priority inheritance would occur. */
- if( xSemaphoreTakeRecursive( xMutex, recmuTWO_TICK_DELAY ) != pdPASS )
- {
- xErrorOccurred = pdTRUE;
- }
-
- /* Ensure the other task attempting to access the mutex (and the
- other demo tasks) are able to execute. */
- vTaskDelay( recmuSHORT_DELAY );
- }
-
- /* For each time we took the mutex, give it back. */
- for( ux = 0; ux < recmuMAX_COUNT; ux++ )
- {
- /* Ensure the other task attempting to access the mutex (and the
- other demo tasks) are able to execute. */
- vTaskDelay( recmuSHORT_DELAY );
-
- /* We should now be able to give the mutex as many times as we
- took it. */
- if( xSemaphoreGiveRecursive( xMutex ) != pdPASS )
- {
- xErrorOccurred = pdTRUE;
- }
- }
-
- /* Having given it back the same number of times as it was taken, we
- should no longer be the mutex owner, so the next give sh ould fail. */
- if( xSemaphoreGiveRecursive( xMutex ) == pdPASS )
- {
- xErrorOccurred = pdTRUE;
- }
-
- /* Keep count of the number of cycles this task has performed so a
- stall can be detected. */
- uxControllingCycles++;
-
- /* Suspend ourselves to the blocking task can execute. */
- xControllingIsSuspended = pdTRUE;
- vTaskSuspend( NULL );
- xControllingIsSuspended = pdFALSE;
- }
-}
-/*-----------------------------------------------------------*/
-
-static void prvRecursiveMutexBlockingTask( void *pvParameters )
+\r
+ for( ;; )\r
+ {\r
+ /* Should not be able to 'give' the mutex, as we have not yet 'taken'\r
+ it. */\r
+ if( xSemaphoreGiveRecursive( xMutex ) == pdPASS )\r
+ {\r
+ xErrorOccurred = pdTRUE;\r
+ }\r
+\r
+ for( ux = 0; ux < recmuMAX_COUNT; ux++ )\r
+ {\r
+ /* We should now be able to take the mutex as many times as\r
+ we like. A one tick delay is used so the polling task will\r
+ inherit our priority on all but the first cycle of this task. \r
+ If we did not block attempting to receive the mutex then no\r
+ priority inheritance would occur. */\r
+ if( xSemaphoreTakeRecursive( xMutex, recmuTWO_TICK_DELAY ) != pdPASS )\r
+ {\r
+ xErrorOccurred = pdTRUE;\r
+ }\r
+\r
+ /* Ensure the other task attempting to access the mutex (and the\r
+ other demo tasks) are able to execute. */\r
+ vTaskDelay( recmuSHORT_DELAY );\r
+ }\r
+\r
+ /* For each time we took the mutex, give it back. */\r
+ for( ux = 0; ux < recmuMAX_COUNT; ux++ )\r
+ {\r
+ /* Ensure the other task attempting to access the mutex (and the\r
+ other demo tasks) are able to execute. */\r
+ vTaskDelay( recmuSHORT_DELAY );\r
+\r
+ /* We should now be able to give the mutex as many times as we\r
+ took it. */\r
+ if( xSemaphoreGiveRecursive( xMutex ) != pdPASS )\r
+ {\r
+ xErrorOccurred = pdTRUE;\r
+ }\r
+ }\r
+\r
+ /* Having given it back the same number of times as it was taken, we\r
+ should no longer be the mutex owner, so the next give sh ould fail. */\r
+ if( xSemaphoreGiveRecursive( xMutex ) == pdPASS )\r
+ {\r
+ xErrorOccurred = pdTRUE;\r
+ }\r
+\r
+ /* Keep count of the number of cycles this task has performed so a \r
+ stall can be detected. */\r
+ uxControllingCycles++;\r
+\r
+ /* Suspend ourselves to the blocking task can execute. */\r
+ xControllingIsSuspended = pdTRUE;\r
+ vTaskSuspend( NULL );\r
+ xControllingIsSuspended = pdFALSE;\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvRecursiveMutexBlockingTask( void *pvParameters )\r
{\r
/* Just to remove compiler warning. */\r
( void ) pvParameters;\r
-
- for( ;; )
- {
- /* Attempt to obtain the mutex. We should block until the
- controlling task has given up the mutex, and not actually execute
- past this call until the controlling task is suspended. */
- if( xSemaphoreTakeRecursive( xMutex, portMAX_DELAY ) == pdPASS )
- {
- if( xControllingIsSuspended != pdTRUE )
- {
- /* Did not expect to execute until the controlling task was
- suspended. */
- xErrorOccurred = pdTRUE;
- }
- else
- {
- /* Give the mutex back before suspending ourselves to allow
- the polling task to obtain the mutex. */
- if( xSemaphoreGiveRecursive( xMutex ) != pdPASS )
- {
- xErrorOccurred = pdTRUE;
- }
-
- xBlockingIsSuspended = pdTRUE;
- vTaskSuspend( NULL );
- xBlockingIsSuspended = pdFALSE;
- }
- }
- else
- {
- /* We should not leave the xSemaphoreTakeRecursive() function
- until the mutex was obtained. */
- xErrorOccurred = pdTRUE;
- }
-
- /* The controlling and blocking tasks should be in lock step. */
- if( uxControllingCycles != ( uxBlockingCycles + 1 ) )
- {
- xErrorOccurred = pdTRUE;
- }
-
- /* Keep count of the number of cycles this task has performed so a
- stall can be detected. */
- uxBlockingCycles++;
- }
-}
-/*-----------------------------------------------------------*/
-
-static void prvRecursiveMutexPollingTask( void *pvParameters )
+\r
+ for( ;; )\r
+ {\r
+ /* Attempt to obtain the mutex. We should block until the \r
+ controlling task has given up the mutex, and not actually execute\r
+ past this call until the controlling task is suspended. */\r
+ if( xSemaphoreTakeRecursive( xMutex, portMAX_DELAY ) == pdPASS )\r
+ {\r
+ if( xControllingIsSuspended != pdTRUE )\r
+ {\r
+ /* Did not expect to execute until the controlling task was\r
+ suspended. */\r
+ xErrorOccurred = pdTRUE;\r
+ }\r
+ else\r
+ {\r
+ /* Give the mutex back before suspending ourselves to allow\r
+ the polling task to obtain the mutex. */\r
+ if( xSemaphoreGiveRecursive( xMutex ) != pdPASS )\r
+ {\r
+ xErrorOccurred = pdTRUE;\r
+ }\r
+\r
+ xBlockingIsSuspended = pdTRUE;\r
+ vTaskSuspend( NULL );\r
+ xBlockingIsSuspended = pdFALSE;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ /* We should not leave the xSemaphoreTakeRecursive() function\r
+ until the mutex was obtained. */\r
+ xErrorOccurred = pdTRUE;\r
+ }\r
+\r
+ /* The controlling and blocking tasks should be in lock step. */\r
+ if( uxControllingCycles != ( uxBlockingCycles + 1 ) )\r
+ {\r
+ xErrorOccurred = pdTRUE;\r
+ }\r
+\r
+ /* Keep count of the number of cycles this task has performed so a \r
+ stall can be detected. */\r
+ uxBlockingCycles++;\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvRecursiveMutexPollingTask( void *pvParameters )\r
{\r
- /* Just to remove compiler warning. */
- ( void ) pvParameters;
-\r
- for( ;; )
- {
- /* Keep attempting to obtain the mutex. We should only obtain it when
- the blocking task has suspended itself. */
- if( xSemaphoreTakeRecursive( xMutex, recmuNO_DELAY ) == pdPASS )
- {
- /* Is the blocking task suspended? */
- if( xBlockingIsSuspended != pdTRUE )
- {
- xErrorOccurred = pdTRUE;
- }
- else
- {
- /* Keep count of the number of cycles this task has performed so
- a stall can be detected. */
- uxPollingCycles++;
-
- /* We can resume the other tasks here even though they have a
- higher priority than the polling task. When they execute they
- will attempt to obtain the mutex but fail because the polling
- task is still the mutex holder. The polling task (this task)
- will then inherit the higher priority. */
- vTaskResume( xBlockingTaskHandle );
- vTaskResume( xControllingTaskHandle );
-
- /* Release the mutex, disinheriting the higher priority again. */
- if( xSemaphoreGiveRecursive( xMutex ) != pdPASS )
- {
- xErrorOccurred = pdTRUE;
- }
- }
- }
-
- #if configUSE_PREEMPTION == 0
- {
- taskYIELD();
- }
- #endif
- }
-}
-/*-----------------------------------------------------------*/
-
-/* This is called to check that all the created tasks are still running. */
-portBASE_TYPE xAreRecursiveMutexTasksStillRunning( void )
-{
-portBASE_TYPE xReturn;
-static unsigned portBASE_TYPE uxLastControllingCycles = 0, uxLastBlockingCycles = 0, uxLastPollingCycles = 0;
-
- /* Is the controlling task still cycling? */
- if( uxLastControllingCycles == uxControllingCycles )
- {
- xErrorOccurred = pdTRUE;
- }
- else
- {
- uxLastControllingCycles = uxControllingCycles;
- }
-
- /* Is the blocking task still cycling? */
- if( uxLastBlockingCycles == uxBlockingCycles )
- {
- xErrorOccurred = pdTRUE;
- }
- else
- {
- uxLastBlockingCycles = uxBlockingCycles;
- }
-
- /* Is the polling task still cycling? */
- if( uxLastPollingCycles == uxPollingCycles )
- {
- xErrorOccurred = pdTRUE;
- }
- else
- {
- uxLastPollingCycles = uxPollingCycles;
- }
-
- if( xErrorOccurred == pdTRUE )
- {
- xReturn = pdFAIL;
- }
- else
- {
- xReturn = pdTRUE;
- }
-
- return xReturn;
-}
-
-
-
-
+ /* Just to remove compiler warning. */\r
+ ( void ) pvParameters;\r
+\r
+ for( ;; )\r
+ {\r
+ /* Keep attempting to obtain the mutex. We should only obtain it when\r
+ the blocking task has suspended itself. */\r
+ if( xSemaphoreTakeRecursive( xMutex, recmuNO_DELAY ) == pdPASS )\r
+ {\r
+ /* Is the blocking task suspended? */\r
+ if( xBlockingIsSuspended != pdTRUE )\r
+ {\r
+ xErrorOccurred = pdTRUE;\r
+ }\r
+ else\r
+ {\r
+ /* Keep count of the number of cycles this task has performed so \r
+ a stall can be detected. */\r
+ uxPollingCycles++;\r
+\r
+ /* We can resume the other tasks here even though they have a\r
+ higher priority than the polling task. When they execute they\r
+ will attempt to obtain the mutex but fail because the polling\r
+ task is still the mutex holder. The polling task (this task)\r
+ will then inherit the higher priority. */ \r
+ vTaskResume( xBlockingTaskHandle );\r
+ vTaskResume( xControllingTaskHandle );\r
+ \r
+ /* Release the mutex, disinheriting the higher priority again. */\r
+ if( xSemaphoreGiveRecursive( xMutex ) != pdPASS )\r
+ {\r
+ xErrorOccurred = pdTRUE;\r
+ }\r
+ }\r
+ }\r
+\r
+ #if configUSE_PREEMPTION == 0\r
+ {\r
+ taskYIELD();\r
+ }\r
+ #endif\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/* This is called to check that all the created tasks are still running. */\r
+portBASE_TYPE xAreRecursiveMutexTasksStillRunning( void )\r
+{\r
+portBASE_TYPE xReturn;\r
+static unsigned portBASE_TYPE uxLastControllingCycles = 0, uxLastBlockingCycles = 0, uxLastPollingCycles = 0;\r
+\r
+ /* Is the controlling task still cycling? */\r
+ if( uxLastControllingCycles == uxControllingCycles )\r
+ {\r
+ xErrorOccurred = pdTRUE;\r
+ }\r
+ else\r
+ {\r
+ uxLastControllingCycles = uxControllingCycles;\r
+ }\r
+\r
+ /* Is the blocking task still cycling? */\r
+ if( uxLastBlockingCycles == uxBlockingCycles )\r
+ {\r
+ xErrorOccurred = pdTRUE;\r
+ }\r
+ else\r
+ {\r
+ uxLastBlockingCycles = uxBlockingCycles;\r
+ }\r
+\r
+ /* Is the polling task still cycling? */\r
+ if( uxLastPollingCycles == uxPollingCycles )\r
+ {\r
+ xErrorOccurred = pdTRUE;\r
+ }\r
+ else\r
+ {\r
+ uxLastPollingCycles = uxPollingCycles;\r
+ }\r
+\r
+ if( xErrorOccurred == pdTRUE )\r
+ {\r
+ xReturn = pdFAIL;\r
+ }\r
+ else\r
+ {\r
+ xReturn = pdTRUE;\r
+ }\r
+\r
+ return xReturn;\r
+}\r
+\r
+\r
+\r
+\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
xTaskCreate( prvSemaphoreTest, ( signed portCHAR * ) "BlkSEM2", semtstSTACK_SIZE, ( void * ) pxSecondSemaphoreParameters, uxPriority, ( xTaskHandle * ) NULL );\r
}\r
}\r
+\r
+ /* vQueueAddToRegistry() adds the semaphore to the registry, if one is\r
+ in use. The registry is provided as a means for kernel aware \r
+ debuggers to locate semaphores and has no purpose if a kernel aware debugger\r
+ is not being used. The call to vQueueAddToRegistry() will be removed\r
+ by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is \r
+ defined to be less than 1. */\r
+ vQueueAddToRegistry( ( xQueueHandle ) pxFirstSemaphoreParameters->xSemaphore, ( signed portCHAR * ) "Counting_Sem_1" );\r
+ vQueueAddToRegistry( ( xQueueHandle ) pxSecondSemaphoreParameters->xSemaphore, ( signed portCHAR * ) "Counting_Sem_2" );\r
}\r
/*-----------------------------------------------------------*/\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.\r
+ FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r