Update to V5.0.2

pull/4/head
Richard Barry 17 years ago
parent cd38538425
commit 4fcb98ef1d

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS distribution. This file is part of the FreeRTOS distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS distribution. This file is part of the FreeRTOS distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS distribution. This file is part of the FreeRTOS distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS distribution. This file is part of the FreeRTOS distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -30,7 +30,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.
@ -97,9 +97,9 @@ coverage. */
/* Each task and interrupt is given a unique identifier. This value is used to /* Each task and interrupt is given a unique identifier. This value is used to
identify which task sent or received each value. The identifier is also used identify which task sent or received each value. The identifier is also used
to distinguish between two tasks that are running the same task function. */ to distinguish between two tasks that are running the same task function. */
#define intqHIGH_PRIROITY_TASK1 ( ( unsigned portBASE_TYPE ) 1 ) #define intqHIGH_PRIORITY_TASK1 ( ( unsigned portBASE_TYPE ) 1 )
#define intqHIGH_PRIROITY_TASK2 ( ( unsigned portBASE_TYPE ) 2 ) #define intqHIGH_PRIORITY_TASK2 ( ( unsigned portBASE_TYPE ) 2 )
#define intqLOW_PRIROITY_TASK ( ( unsigned portBASE_TYPE ) 3 ) #define intqLOW_PRIORITY_TASK ( ( unsigned portBASE_TYPE ) 3 )
#define intqFIRST_INTERRUPT ( ( unsigned portBASE_TYPE ) 4 ) #define intqFIRST_INTERRUPT ( ( unsigned portBASE_TYPE ) 4 )
#define intqSECOND_INTERRUPT ( ( unsigned portBASE_TYPE ) 5 ) #define intqSECOND_INTERRUPT ( ( unsigned portBASE_TYPE ) 5 )
#define intqQUEUE_LENGTH ( ( unsigned portBASE_TYPE ) 10 ) #define intqQUEUE_LENGTH ( ( unsigned portBASE_TYPE ) 10 )
@ -207,11 +207,11 @@ static void prvQueueAccessLogError( unsigned portBASE_TYPE uxLine );
void vStartInterruptQueueTasks( void ) void vStartInterruptQueueTasks( void )
{ {
/* Start the test tasks. */ /* Start the test tasks. */
xTaskCreate( prvHigherPriorityNormallyEmptyTask, ( signed portCHAR * ) "H1QRx", configMINIMAL_STACK_SIZE, ( void * ) intqHIGH_PRIROITY_TASK1, intqHIGHER_PRIORITY, &xHighPriorityNormallyEmptyTask1 ); xTaskCreate( prvHigherPriorityNormallyEmptyTask, ( signed portCHAR * ) "H1QRx", configMINIMAL_STACK_SIZE, ( void * ) intqHIGH_PRIORITY_TASK1, intqHIGHER_PRIORITY, &xHighPriorityNormallyEmptyTask1 );
xTaskCreate( prvHigherPriorityNormallyEmptyTask, ( signed portCHAR * ) "H2QRx", configMINIMAL_STACK_SIZE, ( void * ) intqHIGH_PRIROITY_TASK2, intqHIGHER_PRIORITY, &xHighPriorityNormallyEmptyTask2 ); xTaskCreate( prvHigherPriorityNormallyEmptyTask, ( signed portCHAR * ) "H2QRx", configMINIMAL_STACK_SIZE, ( void * ) intqHIGH_PRIORITY_TASK2, intqHIGHER_PRIORITY, &xHighPriorityNormallyEmptyTask2 );
xTaskCreate( prvLowerPriorityNormallyEmptyTask, ( signed portCHAR * ) "LQRx", configMINIMAL_STACK_SIZE, NULL, intqLOWER_PRIORITY, NULL ); xTaskCreate( prvLowerPriorityNormallyEmptyTask, ( signed portCHAR * ) "LQRx", configMINIMAL_STACK_SIZE, NULL, intqLOWER_PRIORITY, NULL );
xTaskCreate( prv1stHigherPriorityNormallyFullTask, ( signed portCHAR * ) "H1QTx", configMINIMAL_STACK_SIZE, ( void * ) intqHIGH_PRIROITY_TASK1, intqHIGHER_PRIORITY, &xHighPriorityNormallyFullTask1 ); xTaskCreate( prv1stHigherPriorityNormallyFullTask, ( signed portCHAR * ) "H1QTx", configMINIMAL_STACK_SIZE, ( void * ) intqHIGH_PRIORITY_TASK1, intqHIGHER_PRIORITY, &xHighPriorityNormallyFullTask1 );
xTaskCreate( prv2ndHigherPriorityNormallyFullTask, ( signed portCHAR * ) "H1QTx", configMINIMAL_STACK_SIZE, ( void * ) intqHIGH_PRIROITY_TASK2, intqHIGHER_PRIORITY, &xHighPriorityNormallyFullTask2 ); xTaskCreate( prv2ndHigherPriorityNormallyFullTask, ( signed portCHAR * ) "H1QTx", configMINIMAL_STACK_SIZE, ( void * ) intqHIGH_PRIORITY_TASK2, intqHIGHER_PRIORITY, &xHighPriorityNormallyFullTask2 );
xTaskCreate( prvLowerPriorityNormallyFullTask, ( signed portCHAR * ) "LQRx", configMINIMAL_STACK_SIZE, NULL, intqLOWER_PRIORITY, NULL ); xTaskCreate( prvLowerPriorityNormallyFullTask, ( signed portCHAR * ) "LQRx", configMINIMAL_STACK_SIZE, NULL, intqLOWER_PRIORITY, NULL );
/* Create the queues that are accessed by multiple tasks and multiple /* Create the queues that are accessed by multiple tasks and multiple
@ -280,7 +280,7 @@ unsigned portBASE_TYPE uxRxed, ux, uxTask1, uxTask2;
/* The timer should not be started until after the scheduler has started. /* The timer should not be started until after the scheduler has started.
More than one task is running this code so we check the parameter value More than one task is running this code so we check the parameter value
to determine which task should start the timer. */ to determine which task should start the timer. */
if( ( unsigned portBASE_TYPE ) pvParameters == intqHIGH_PRIROITY_TASK1 ) if( ( unsigned portBASE_TYPE ) pvParameters == intqHIGH_PRIORITY_TASK1 )
{ {
vInitialiseTimerForIntQueueTest(); vInitialiseTimerForIntQueueTest();
} }
@ -303,7 +303,7 @@ unsigned portBASE_TYPE uxRxed, ux, uxTask1, uxTask2;
/* Ensure the other task running this code gets a chance to execute. */ /* Ensure the other task running this code gets a chance to execute. */
taskYIELD(); taskYIELD();
if( ( unsigned portBASE_TYPE ) pvParameters == intqHIGH_PRIROITY_TASK1 ) if( ( unsigned portBASE_TYPE ) pvParameters == intqHIGH_PRIORITY_TASK1 )
{ {
/* Have we received all the expected values? */ /* Have we received all the expected values? */
if( uxValueForNormallyEmptyQueue > ( intqNUM_VALUES_TO_LOG + intqVALUE_OVERRUN ) ) if( uxValueForNormallyEmptyQueue > ( intqNUM_VALUES_TO_LOG + intqVALUE_OVERRUN ) )
@ -324,12 +324,12 @@ unsigned portBASE_TYPE uxRxed, ux, uxTask1, uxTask2;
} }
else else
{ {
if( ucNormallyEmptyReceivedValues[ ux ] == intqHIGH_PRIROITY_TASK1 ) if( ucNormallyEmptyReceivedValues[ ux ] == intqHIGH_PRIORITY_TASK1 )
{ {
/* Value was placed into the array by task 1. */ /* Value was placed into the array by task 1. */
uxTask1++; uxTask1++;
} }
else if( ucNormallyEmptyReceivedValues[ ux ] == intqHIGH_PRIROITY_TASK2 ) else if( ucNormallyEmptyReceivedValues[ ux ] == intqHIGH_PRIORITY_TASK2 )
{ {
/* Value was placed into the array by task 2. */ /* Value was placed into the array by task 2. */
uxTask2++; uxTask2++;
@ -388,7 +388,7 @@ portBASE_TYPE xQueueStatus;
prvQueueAccessLogError( __LINE__ ); prvQueueAccessLogError( __LINE__ );
} }
prvRecordValue_NormallyEmpty( uxRxed, intqLOW_PRIROITY_TASK ); prvRecordValue_NormallyEmpty( uxRxed, intqLOW_PRIORITY_TASK );
/* Wake the higher priority task again. */ /* Wake the higher priority task again. */
vTaskResume( xHighPriorityNormallyEmptyTask1 ); vTaskResume( xHighPriorityNormallyEmptyTask1 );
@ -451,7 +451,7 @@ portBASE_TYPE xQueueStatus;
if( ( xQueueStatus = xQueueSend( xNormallyFullQueue, &uxValueToTx, intqSHORT_DELAY ) ) != pdPASS ) if( ( xQueueStatus = xQueueSend( xNormallyFullQueue, &uxValueToTx, intqSHORT_DELAY ) ) != pdPASS )
{ {
/* intqHIGH_PRIROITY_TASK2 is never suspended so we would not /* intqHIGH_PRIORITY_TASK2 is never suspended so we would not
expect it to ever time out. */ expect it to ever time out. */
prvQueueAccessLogError( __LINE__ ); prvQueueAccessLogError( __LINE__ );
} }
@ -588,7 +588,7 @@ portBASE_TYPE xQueueStatus;
} }
else else
{ {
prvRecordValue_NormallyFull( uxValue, intqLOW_PRIROITY_TASK ); prvRecordValue_NormallyFull( uxValue, intqLOW_PRIORITY_TASK );
} }
vTaskPrioritySet( NULL, intqLOWER_PRIORITY ); vTaskPrioritySet( NULL, intqLOWER_PRIORITY );

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,143 +1,143 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.
FreeRTOS.org is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
FreeRTOS.org is distributed in the hope that it will be useful, FreeRTOS.org is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with FreeRTOS.org; if not, write to the Free Software along with FreeRTOS.org; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 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 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 a combined work that includes FreeRTOS.org, without being obliged to provide
the source code for any proprietary components. See the licensing section 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 of http://www.FreeRTOS.org for full details of how and when the exception
can be applied. can be applied.
*************************************************************************** ***************************************************************************
*************************************************************************** ***************************************************************************
* * * *
* SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, * * 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. * * 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 * * See http://www.OpenRTOS.com for details of the services we provide to *
* expedite your project. * * expedite your project. *
* * * *
*************************************************************************** ***************************************************************************
*************************************************************************** ***************************************************************************
Please ensure to read the configuration and relevant port sections of the Please ensure to read the configuration and relevant port sections of the
online documentation. online documentation.
http://www.FreeRTOS.org - Documentation, latest information, license and http://www.FreeRTOS.org - Documentation, latest information, license and
contact details. contact details.
http://www.SafeRTOS.com - A version that is certified for use in safety http://www.SafeRTOS.com - A version that is certified for use in safety
critical systems. critical systems.
http://www.OpenRTOS.com - Commercial support, development, porting, http://www.OpenRTOS.com - Commercial support, development, porting,
licensing and training services. licensing and training services.
*/ */
/* /*
* Simple demonstration of the usage of counting semaphore. * Simple demonstration of the usage of counting semaphore.
*/ */
/* Scheduler include files. */ /* Scheduler include files. */
#include "FreeRTOS.h" #include "FreeRTOS.h"
#include "task.h" #include "task.h"
#include "semphr.h" #include "semphr.h"
/* Demo program include files. */ /* Demo program include files. */
#include "countsem.h" #include "countsem.h"
/* The maximum count value that the semaphore used for the demo can hold. */ /* The maximum count value that the semaphore used for the demo can hold. */
#define countMAX_COUNT_VALUE ( 200 ) #define countMAX_COUNT_VALUE ( 200 )
/* Constants used to indicate whether or not the semaphore should have been /* Constants used to indicate whether or not the semaphore should have been
created with its maximum count value, or its minimum count value. These 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 numbers are used to ensure that the pointers passed in as the task parameters
are valid. */ are valid. */
#define countSTART_AT_MAX_COUNT ( 0xaa ) #define countSTART_AT_MAX_COUNT ( 0xaa )
#define countSTART_AT_ZERO ( 0x55 ) #define countSTART_AT_ZERO ( 0x55 )
/* Two tasks are created for the test. One uses a semaphore created with its /* 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. */ count value set to the maximum, and one with the count value set to zero. */
#define countNUM_TEST_TASKS ( 2 ) #define countNUM_TEST_TASKS ( 2 )
#define countDONT_BLOCK ( 0 ) #define countDONT_BLOCK ( 0 )
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* Flag that will be latched to pdTRUE should any unexpected behaviour be /* Flag that will be latched to pdTRUE should any unexpected behaviour be
detected in any of the tasks. */ detected in any of the tasks. */
static volatile portBASE_TYPE xErrorDetected = pdFALSE; static volatile portBASE_TYPE xErrorDetected = pdFALSE;
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* /*
* The demo task. This simply counts the semaphore up to its maximum value, * 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 * 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 * 'take' is inspected, with an error being flagged if it is found not to be
* the expected result. * the expected result.
*/ */
static void prvCountingSemaphoreTask( void *pvParameters ); static void prvCountingSemaphoreTask( void *pvParameters );
/* /*
* Utility function to increment the semaphore count value up from zero to * Utility function to increment the semaphore count value up from zero to
* countMAX_COUNT_VALUE. * countMAX_COUNT_VALUE.
*/ */
static void prvIncrementSemaphoreCount( xSemaphoreHandle xSemaphore, unsigned portBASE_TYPE *puxLoopCounter ); static void prvIncrementSemaphoreCount( xSemaphoreHandle xSemaphore, unsigned portBASE_TYPE *puxLoopCounter );
/* /*
* Utility function to decrement the semaphore count value up from * Utility function to decrement the semaphore count value up from
* countMAX_COUNT_VALUE to zero. * countMAX_COUNT_VALUE to zero.
*/ */
static void prvDecrementSemaphoreCount( xSemaphoreHandle xSemaphore, unsigned portBASE_TYPE *puxLoopCounter ); static void prvDecrementSemaphoreCount( xSemaphoreHandle xSemaphore, unsigned portBASE_TYPE *puxLoopCounter );
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* The structure that is passed into the task as the task parameter. */ /* The structure that is passed into the task as the task parameter. */
typedef struct COUNT_SEM_STRUCT typedef struct COUNT_SEM_STRUCT
{ {
/* The semaphore to be used for the demo. */ /* The semaphore to be used for the demo. */
xSemaphoreHandle xSemaphore; xSemaphoreHandle xSemaphore;
/* Set to countSTART_AT_MAX_COUNT if the semaphore should be created with /* 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 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. */ should have been created with its count value set to 0. */
unsigned portBASE_TYPE uxExpectedStartCount; unsigned portBASE_TYPE uxExpectedStartCount;
/* Incremented on each cycle of the demo task. Used to detect a stalled /* Incremented on each cycle of the demo task. Used to detect a stalled
task. */ task. */
unsigned portBASE_TYPE uxLoopCounter; unsigned portBASE_TYPE uxLoopCounter;
} xCountSemStruct; } xCountSemStruct;
/* Two structures are defined, one is passed to each test task. */ /* Two structures are defined, one is passed to each test task. */
static volatile xCountSemStruct xParameters[ countNUM_TEST_TASKS ]; static volatile xCountSemStruct xParameters[ countNUM_TEST_TASKS ];
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void vStartCountingSemaphoreTasks( void ) void vStartCountingSemaphoreTasks( void )
{ {
/* Create the semaphores that we are going to use for the test/demo. The /* 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, 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. */ 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 ].xSemaphore = xSemaphoreCreateCounting( countMAX_COUNT_VALUE, countMAX_COUNT_VALUE );
xParameters[ 0 ].uxExpectedStartCount = countSTART_AT_MAX_COUNT; xParameters[ 0 ].uxExpectedStartCount = countSTART_AT_MAX_COUNT;
xParameters[ 0 ].uxLoopCounter = 0; xParameters[ 0 ].uxLoopCounter = 0;
xParameters[ 1 ].xSemaphore = xSemaphoreCreateCounting( countMAX_COUNT_VALUE, 0 ); xParameters[ 1 ].xSemaphore = xSemaphoreCreateCounting( countMAX_COUNT_VALUE, 0 );
xParameters[ 1 ].uxExpectedStartCount = 0; xParameters[ 1 ].uxExpectedStartCount = 0;
xParameters[ 1 ].uxLoopCounter = 0; xParameters[ 1 ].uxLoopCounter = 0;
/* vQueueAddToRegistry() adds the semaphore to the registry, if one is /* vQueueAddToRegistry() adds the semaphore to the registry, if one is
in use. The registry is provided as a means for kernel aware in use. The registry is provided as a means for kernel aware
@ -148,159 +148,159 @@ void vStartCountingSemaphoreTasks( void )
vQueueAddToRegistry( ( xQueueHandle ) xParameters[ 0 ].xSemaphore, ( signed portCHAR * ) "Counting_Sem_1" ); vQueueAddToRegistry( ( xQueueHandle ) xParameters[ 0 ].xSemaphore, ( signed portCHAR * ) "Counting_Sem_1" );
vQueueAddToRegistry( ( xQueueHandle ) xParameters[ 1 ].xSemaphore, ( signed portCHAR * ) "Counting_Sem_2" ); vQueueAddToRegistry( ( xQueueHandle ) xParameters[ 1 ].xSemaphore, ( signed portCHAR * ) "Counting_Sem_2" );
/* Were the semaphores created? */ /* Were the semaphores created? */
if( ( xParameters[ 0 ].xSemaphore != NULL ) || ( xParameters[ 1 ].xSemaphore != NULL ) ) if( ( xParameters[ 0 ].xSemaphore != NULL ) || ( xParameters[ 1 ].xSemaphore != NULL ) )
{ {
/* Create the demo tasks, passing in the semaphore to use as the parameter. */ /* 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 * ) "CNT1", configMINIMAL_STACK_SIZE, ( void * ) &( xParameters[ 0 ] ), tskIDLE_PRIORITY, NULL );
xTaskCreate( prvCountingSemaphoreTask, ( signed portCHAR * ) "CNT2", configMINIMAL_STACK_SIZE, ( void * ) &( xParameters[ 1 ] ), 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 ) static void prvDecrementSemaphoreCount( xSemaphoreHandle xSemaphore, unsigned portBASE_TYPE *puxLoopCounter )
{ {
unsigned portBASE_TYPE ux; unsigned portBASE_TYPE ux;
/* If the semaphore count is at its maximum then we should not be able to /* If the semaphore count is at its maximum then we should not be able to
'give' the semaphore. */ 'give' the semaphore. */
if( xSemaphoreGive( xSemaphore ) == pdPASS ) if( xSemaphoreGive( xSemaphore ) == pdPASS )
{ {
xErrorDetected = pdTRUE; xErrorDetected = pdTRUE;
} }
/* We should be able to 'take' the semaphore countMAX_COUNT_VALUE times. */ /* We should be able to 'take' the semaphore countMAX_COUNT_VALUE times. */
for( ux = 0; ux < countMAX_COUNT_VALUE; ux++ ) for( ux = 0; ux < countMAX_COUNT_VALUE; ux++ )
{ {
if( xSemaphoreTake( xSemaphore, countDONT_BLOCK ) != pdPASS ) if( xSemaphoreTake( xSemaphore, countDONT_BLOCK ) != pdPASS )
{ {
/* We expected to be able to take the semaphore. */ /* We expected to be able to take the semaphore. */
xErrorDetected = pdTRUE; xErrorDetected = pdTRUE;
} }
( *puxLoopCounter )++; ( *puxLoopCounter )++;
} }
#if configUSE_PREEMPTION == 0 #if configUSE_PREEMPTION == 0
taskYIELD(); taskYIELD();
#endif #endif
/* If the semaphore count is zero then we should not be able to 'take' /* If the semaphore count is zero then we should not be able to 'take'
the semaphore. */ the semaphore. */
if( xSemaphoreTake( xSemaphore, countDONT_BLOCK ) == pdPASS ) if( xSemaphoreTake( xSemaphore, countDONT_BLOCK ) == pdPASS )
{ {
xErrorDetected = pdTRUE; xErrorDetected = pdTRUE;
} }
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvIncrementSemaphoreCount( xSemaphoreHandle xSemaphore, unsigned portBASE_TYPE *puxLoopCounter ) static void prvIncrementSemaphoreCount( xSemaphoreHandle xSemaphore, unsigned portBASE_TYPE *puxLoopCounter )
{ {
unsigned portBASE_TYPE ux; unsigned portBASE_TYPE ux;
/* If the semaphore count is zero then we should not be able to 'take' /* If the semaphore count is zero then we should not be able to 'take'
the semaphore. */ the semaphore. */
if( xSemaphoreTake( xSemaphore, countDONT_BLOCK ) == pdPASS ) if( xSemaphoreTake( xSemaphore, countDONT_BLOCK ) == pdPASS )
{ {
xErrorDetected = pdTRUE; xErrorDetected = pdTRUE;
} }
/* We should be able to 'give' the semaphore countMAX_COUNT_VALUE times. */ /* We should be able to 'give' the semaphore countMAX_COUNT_VALUE times. */
for( ux = 0; ux < countMAX_COUNT_VALUE; ux++ ) for( ux = 0; ux < countMAX_COUNT_VALUE; ux++ )
{ {
if( xSemaphoreGive( xSemaphore ) != pdPASS ) if( xSemaphoreGive( xSemaphore ) != pdPASS )
{ {
/* We expected to be able to take the semaphore. */ /* We expected to be able to take the semaphore. */
xErrorDetected = pdTRUE; xErrorDetected = pdTRUE;
} }
( *puxLoopCounter )++; ( *puxLoopCounter )++;
} }
#if configUSE_PREEMPTION == 0 #if configUSE_PREEMPTION == 0
taskYIELD(); taskYIELD();
#endif #endif
/* If the semaphore count is at its maximum then we should not be able to /* If the semaphore count is at its maximum then we should not be able to
'give' the semaphore. */ 'give' the semaphore. */
if( xSemaphoreGive( xSemaphore ) == pdPASS ) if( xSemaphoreGive( xSemaphore ) == pdPASS )
{ {
xErrorDetected = pdTRUE; xErrorDetected = pdTRUE;
} }
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvCountingSemaphoreTask( void *pvParameters ) static void prvCountingSemaphoreTask( void *pvParameters )
{ {
xCountSemStruct *pxParameter; xCountSemStruct *pxParameter;
#ifdef USE_STDIO #ifdef USE_STDIO
void vPrintDisplayMessage( const portCHAR * const * ppcMessageToSend ); void vPrintDisplayMessage( const portCHAR * const * ppcMessageToSend );
const portCHAR * const pcTaskStartMsg = "Counting semaphore demo started.\r\n"; const portCHAR * const pcTaskStartMsg = "Counting semaphore demo started.\r\n";
/* Queue a message for printing to say the task has started. */ /* Queue a message for printing to say the task has started. */
vPrintDisplayMessage( &pcTaskStartMsg ); vPrintDisplayMessage( &pcTaskStartMsg );
#endif #endif
/* The semaphore to be used was passed as the parameter. */ /* The semaphore to be used was passed as the parameter. */
pxParameter = ( xCountSemStruct * ) pvParameters; pxParameter = ( xCountSemStruct * ) pvParameters;
/* Did we expect to find the semaphore already at its max count value, or /* Did we expect to find the semaphore already at its max count value, or
at zero? */ at zero? */
if( pxParameter->uxExpectedStartCount == countSTART_AT_MAX_COUNT ) if( pxParameter->uxExpectedStartCount == countSTART_AT_MAX_COUNT )
{ {
prvDecrementSemaphoreCount( pxParameter->xSemaphore, &( pxParameter->uxLoopCounter ) ); prvDecrementSemaphoreCount( pxParameter->xSemaphore, &( pxParameter->uxLoopCounter ) );
} }
/* Now we expect the semaphore count to be 0, so this time there is an /* Now we expect the semaphore count to be 0, so this time there is an
error if we can take the semaphore. */ error if we can take the semaphore. */
if( xSemaphoreTake( pxParameter->xSemaphore, 0 ) == pdPASS ) if( xSemaphoreTake( pxParameter->xSemaphore, 0 ) == pdPASS )
{ {
xErrorDetected = pdTRUE; xErrorDetected = pdTRUE;
} }
for( ;; ) for( ;; )
{ {
prvIncrementSemaphoreCount( pxParameter->xSemaphore, &( pxParameter->uxLoopCounter ) ); prvIncrementSemaphoreCount( pxParameter->xSemaphore, &( pxParameter->uxLoopCounter ) );
prvDecrementSemaphoreCount( pxParameter->xSemaphore, &( pxParameter->uxLoopCounter ) ); prvDecrementSemaphoreCount( pxParameter->xSemaphore, &( pxParameter->uxLoopCounter ) );
} }
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
portBASE_TYPE xAreCountingSemaphoreTasksStillRunning( void ) portBASE_TYPE xAreCountingSemaphoreTasksStillRunning( void )
{ {
static unsigned portBASE_TYPE uxLastCount0 = 0, uxLastCount1 = 0; static unsigned portBASE_TYPE uxLastCount0 = 0, uxLastCount1 = 0;
portBASE_TYPE xReturn = pdPASS; portBASE_TYPE xReturn = pdPASS;
/* Return fail if any 'give' or 'take' did not result in the expected /* Return fail if any 'give' or 'take' did not result in the expected
behaviour. */ behaviour. */
if( xErrorDetected != pdFALSE ) if( xErrorDetected != pdFALSE )
{ {
xReturn = pdFAIL; xReturn = pdFAIL;
} }
/* Return fail if either task is not still incrementing its loop counter. */ /* Return fail if either task is not still incrementing its loop counter. */
if( uxLastCount0 == xParameters[ 0 ].uxLoopCounter ) if( uxLastCount0 == xParameters[ 0 ].uxLoopCounter )
{ {
xReturn = pdFAIL; xReturn = pdFAIL;
} }
else else
{ {
uxLastCount0 = xParameters[ 0 ].uxLoopCounter; uxLastCount0 = xParameters[ 0 ].uxLoopCounter;
} }
if( uxLastCount1 == xParameters[ 1 ].uxLoopCounter ) if( uxLastCount1 == xParameters[ 1 ].uxLoopCounter )
{ {
xReturn = pdFAIL; xReturn = pdFAIL;
} }
else else
{ {
uxLastCount1 = xParameters[ 1 ].uxLoopCounter; uxLastCount1 = xParameters[ 1 ].uxLoopCounter;
} }
return xReturn; return xReturn;
} }

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,131 +1,131 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.
FreeRTOS.org is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
FreeRTOS.org is distributed in the hope that it will be useful, FreeRTOS.org is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with FreeRTOS.org; if not, write to the Free Software along with FreeRTOS.org; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 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 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 a combined work that includes FreeRTOS.org, without being obliged to provide
the source code for any proprietary components. See the licensing section 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 of http://www.FreeRTOS.org for full details of how and when the exception
can be applied. can be applied.
*************************************************************************** ***************************************************************************
*************************************************************************** ***************************************************************************
* * * *
* SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, * * 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. * * 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 * * See http://www.OpenRTOS.com for details of the services we provide to *
* expedite your project. * * expedite your project. *
* * * *
*************************************************************************** ***************************************************************************
*************************************************************************** ***************************************************************************
Please ensure to read the configuration and relevant port sections of the Please ensure to read the configuration and relevant port sections of the
online documentation. online documentation.
http://www.FreeRTOS.org - Documentation, latest information, license and http://www.FreeRTOS.org - Documentation, latest information, license and
contact details. contact details.
http://www.SafeRTOS.com - A version that is certified for use in safety http://www.SafeRTOS.com - A version that is certified for use in safety
critical systems. critical systems.
http://www.OpenRTOS.com - Commercial support, development, porting, http://www.OpenRTOS.com - Commercial support, development, porting,
licensing and training services. licensing and training services.
*/ */
/* /*
The tasks defined on this page demonstrate the use of recursive mutexes. The tasks defined on this page demonstrate the use of recursive mutexes.
For recursive mutex functionality the created mutex should be created using For recursive mutex functionality the created mutex should be created using
xSemaphoreCreateRecursiveMutex(), then be manipulated xSemaphoreCreateRecursiveMutex(), then be manipulated
using the xSemaphoreTakeRecursive() and xSemaphoreGiveRecursive() API using the xSemaphoreTakeRecursive() and xSemaphoreGiveRecursive() API
functions. functions.
This demo creates three tasks all of which access the same recursive mutex: This demo creates three tasks all of which access the same recursive mutex:
prvRecursiveMutexControllingTask() has the highest priority so executes prvRecursiveMutexControllingTask() has the highest priority so executes
first and grabs the mutex. It then performs some recursive accesses - 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 between each of which it sleeps for a short period to let the lower
priority tasks execute. When it has completed its demo functionality priority tasks execute. When it has completed its demo functionality
it gives the mutex back before suspending itself. it gives the mutex back before suspending itself.
prvRecursiveMutexBlockingTask() attempts to access the mutex by performing prvRecursiveMutexBlockingTask() attempts to access the mutex by performing
a blocking 'take'. The blocking task has a lower priority than the 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 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 taken by the controlling task, causing the blocking task to block. It
does not unblock until the controlling task has given the mutex back, does not unblock until the controlling task has given the mutex back,
and it does not actually run until the controlling task has suspended and it does not actually run until the controlling task has suspended
itself (due to the relative priorities). When it eventually does obtain 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 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 itself. At this point both the controlling task and the blocking task are
suspended. suspended.
prvRecursiveMutexPollingTask() runs at the idle priority. It spins round prvRecursiveMutexPollingTask() runs at the idle priority. It spins round
a tight loop attempting to obtain the mutex with a non-blocking call. As 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 the lowest priority task it will not successfully obtain the mutex until
both the controlling and blocking tasks are suspended. Once it eventually both the controlling and blocking tasks are suspended. Once it eventually
does obtain the mutex it first unsuspends both the controlling task and does obtain the mutex it first unsuspends both the controlling task and
blocking task prior to giving the mutex back - resulting in the polling blocking task prior to giving the mutex back - resulting in the polling
task temporarily inheriting the controlling tasks priority. task temporarily inheriting the controlling tasks priority.
*/ */
/* Scheduler include files. */ /* Scheduler include files. */
#include "FreeRTOS.h" #include "FreeRTOS.h"
#include "task.h" #include "task.h"
#include "semphr.h" #include "semphr.h"
/* Demo app include files. */ /* Demo app include files. */
#include "recmutex.h" #include "recmutex.h"
/* Priorities assigned to the three tasks. */ /* Priorities assigned to the three tasks. */
#define recmuCONTROLLING_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) #define recmuCONTROLLING_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
#define recmuBLOCKING_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) #define recmuBLOCKING_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
#define recmuPOLLING_TASK_PRIORITY ( tskIDLE_PRIORITY + 0 ) #define recmuPOLLING_TASK_PRIORITY ( tskIDLE_PRIORITY + 0 )
/* The recursive call depth. */ /* The recursive call depth. */
#define recmuMAX_COUNT ( 10 ) #define recmuMAX_COUNT ( 10 )
/* Misc. */ /* Misc. */
#define recmuSHORT_DELAY ( 20 / portTICK_RATE_MS ) #define recmuSHORT_DELAY ( 20 / portTICK_RATE_MS )
#define recmuNO_DELAY ( ( portTickType ) 0 ) #define recmuNO_DELAY ( ( portTickType ) 0 )
#define recmuTWO_TICK_DELAY ( ( portTickType ) 2 ) #define recmuTWO_TICK_DELAY ( ( portTickType ) 2 )
/* The three tasks as described at the top of this file. */ /* The three tasks as described at the top of this file. */
static void prvRecursiveMutexControllingTask( void *pvParameters ); static void prvRecursiveMutexControllingTask( void *pvParameters );
static void prvRecursiveMutexBlockingTask( void *pvParameters ); static void prvRecursiveMutexBlockingTask( void *pvParameters );
static void prvRecursiveMutexPollingTask( void *pvParameters ); static void prvRecursiveMutexPollingTask( void *pvParameters );
/* The mutex used by the demo. */ /* The mutex used by the demo. */
static xSemaphoreHandle xMutex; static xSemaphoreHandle xMutex;
/* Variables used to detect and latch errors. */ /* Variables used to detect and latch errors. */
static volatile portBASE_TYPE xErrorOccurred = pdFALSE, xControllingIsSuspended = pdFALSE, xBlockingIsSuspended = pdFALSE; static volatile portBASE_TYPE xErrorOccurred = pdFALSE, xControllingIsSuspended = pdFALSE, xBlockingIsSuspended = pdFALSE;
static volatile unsigned portBASE_TYPE uxControllingCycles = 0, uxBlockingCycles, uxPollingCycles = 0; static volatile unsigned portBASE_TYPE uxControllingCycles = 0, uxBlockingCycles, uxPollingCycles = 0;
/* Handles of the two higher priority tasks, required so they can be resumed /* Handles of the two higher priority tasks, required so they can be resumed
(unsuspended). */ (unsuspended). */
static xTaskHandle xControllingTaskHandle, xBlockingTaskHandle; static xTaskHandle xControllingTaskHandle, xBlockingTaskHandle;
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void vStartRecursiveMutexTasks( void ) void vStartRecursiveMutexTasks( void )
{ {
/* Just creates the mutex and the three tasks. */ /* Just creates the mutex and the three tasks. */
xMutex = xSemaphoreCreateRecursiveMutex(); xMutex = xSemaphoreCreateRecursiveMutex();
/* vQueueAddToRegistry() adds the mutex to the registry, if one is /* vQueueAddToRegistry() adds the mutex to the registry, if one is
@ -135,231 +135,231 @@ void vStartRecursiveMutexTasks( void )
by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is
defined to be less than 1. */ defined to be less than 1. */
vQueueAddToRegistry( ( xQueueHandle ) xMutex, ( signed portCHAR * ) "Recursive_Mutex" ); vQueueAddToRegistry( ( xQueueHandle ) xMutex, ( signed portCHAR * ) "Recursive_Mutex" );
if( xMutex != NULL ) if( xMutex != NULL )
{ {
xTaskCreate( prvRecursiveMutexControllingTask, ( signed portCHAR * ) "Rec1", configMINIMAL_STACK_SIZE, NULL, recmuCONTROLLING_TASK_PRIORITY, &xControllingTaskHandle ); 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( 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 ); xTaskCreate( prvRecursiveMutexPollingTask, ( signed portCHAR * ) "Rec3", configMINIMAL_STACK_SIZE, NULL, recmuPOLLING_TASK_PRIORITY, NULL );
} }
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvRecursiveMutexControllingTask( void *pvParameters ) static void prvRecursiveMutexControllingTask( void *pvParameters )
{ {
unsigned portBASE_TYPE ux; unsigned portBASE_TYPE ux;
/* Just to remove compiler warning. */ /* Just to remove compiler warning. */
( void ) pvParameters; ( void ) pvParameters;
for( ;; ) for( ;; )
{ {
/* Should not be able to 'give' the mutex, as we have not yet 'taken' /* Should not be able to 'give' the mutex, as we have not yet 'taken'
it. */ it. */
if( xSemaphoreGiveRecursive( xMutex ) == pdPASS ) if( xSemaphoreGiveRecursive( xMutex ) == pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = pdTRUE;
} }
for( ux = 0; ux < recmuMAX_COUNT; ux++ ) for( ux = 0; ux < recmuMAX_COUNT; ux++ )
{ {
/* We should now be able to take the mutex as many times as /* 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 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. inherit our priority on all but the first cycle of this task.
If we did not block attempting to receive the mutex then no If we did not block attempting to receive the mutex then no
priority inheritance would occur. */ priority inheritance would occur. */
if( xSemaphoreTakeRecursive( xMutex, recmuTWO_TICK_DELAY ) != pdPASS ) if( xSemaphoreTakeRecursive( xMutex, recmuTWO_TICK_DELAY ) != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = pdTRUE;
} }
/* Ensure the other task attempting to access the mutex (and the /* Ensure the other task attempting to access the mutex (and the
other demo tasks) are able to execute. */ other demo tasks) are able to execute. */
vTaskDelay( recmuSHORT_DELAY ); vTaskDelay( recmuSHORT_DELAY );
} }
/* For each time we took the mutex, give it back. */ /* For each time we took the mutex, give it back. */
for( ux = 0; ux < recmuMAX_COUNT; ux++ ) for( ux = 0; ux < recmuMAX_COUNT; ux++ )
{ {
/* Ensure the other task attempting to access the mutex (and the /* Ensure the other task attempting to access the mutex (and the
other demo tasks) are able to execute. */ other demo tasks) are able to execute. */
vTaskDelay( recmuSHORT_DELAY ); vTaskDelay( recmuSHORT_DELAY );
/* We should now be able to give the mutex as many times as we /* We should now be able to give the mutex as many times as we
took it. */ took it. */
if( xSemaphoreGiveRecursive( xMutex ) != pdPASS ) if( xSemaphoreGiveRecursive( xMutex ) != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = pdTRUE;
} }
} }
/* Having given it back the same number of times as it was taken, we /* 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. */ should no longer be the mutex owner, so the next give sh ould fail. */
if( xSemaphoreGiveRecursive( xMutex ) == pdPASS ) if( xSemaphoreGiveRecursive( xMutex ) == pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = pdTRUE;
} }
/* Keep count of the number of cycles this task has performed so a /* Keep count of the number of cycles this task has performed so a
stall can be detected. */ stall can be detected. */
uxControllingCycles++; uxControllingCycles++;
/* Suspend ourselves to the blocking task can execute. */ /* Suspend ourselves to the blocking task can execute. */
xControllingIsSuspended = pdTRUE; xControllingIsSuspended = pdTRUE;
vTaskSuspend( NULL ); vTaskSuspend( NULL );
xControllingIsSuspended = pdFALSE; xControllingIsSuspended = pdFALSE;
} }
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvRecursiveMutexBlockingTask( void *pvParameters ) static void prvRecursiveMutexBlockingTask( void *pvParameters )
{ {
/* Just to remove compiler warning. */ /* Just to remove compiler warning. */
( void ) pvParameters; ( void ) pvParameters;
for( ;; ) for( ;; )
{ {
/* Attempt to obtain the mutex. We should block until the /* Attempt to obtain the mutex. We should block until the
controlling task has given up the mutex, and not actually execute controlling task has given up the mutex, and not actually execute
past this call until the controlling task is suspended. */ past this call until the controlling task is suspended. */
if( xSemaphoreTakeRecursive( xMutex, portMAX_DELAY ) == pdPASS ) if( xSemaphoreTakeRecursive( xMutex, portMAX_DELAY ) == pdPASS )
{ {
if( xControllingIsSuspended != pdTRUE ) if( xControllingIsSuspended != pdTRUE )
{ {
/* Did not expect to execute until the controlling task was /* Did not expect to execute until the controlling task was
suspended. */ suspended. */
xErrorOccurred = pdTRUE; xErrorOccurred = pdTRUE;
} }
else else
{ {
/* Give the mutex back before suspending ourselves to allow /* Give the mutex back before suspending ourselves to allow
the polling task to obtain the mutex. */ the polling task to obtain the mutex. */
if( xSemaphoreGiveRecursive( xMutex ) != pdPASS ) if( xSemaphoreGiveRecursive( xMutex ) != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = pdTRUE;
} }
xBlockingIsSuspended = pdTRUE; xBlockingIsSuspended = pdTRUE;
vTaskSuspend( NULL ); vTaskSuspend( NULL );
xBlockingIsSuspended = pdFALSE; xBlockingIsSuspended = pdFALSE;
} }
} }
else else
{ {
/* We should not leave the xSemaphoreTakeRecursive() function /* We should not leave the xSemaphoreTakeRecursive() function
until the mutex was obtained. */ until the mutex was obtained. */
xErrorOccurred = pdTRUE; xErrorOccurred = pdTRUE;
} }
/* The controlling and blocking tasks should be in lock step. */ /* The controlling and blocking tasks should be in lock step. */
if( uxControllingCycles != ( uxBlockingCycles + 1 ) ) if( uxControllingCycles != ( uxBlockingCycles + 1 ) )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = pdTRUE;
} }
/* Keep count of the number of cycles this task has performed so a /* Keep count of the number of cycles this task has performed so a
stall can be detected. */ stall can be detected. */
uxBlockingCycles++; uxBlockingCycles++;
} }
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvRecursiveMutexPollingTask( void *pvParameters ) static void prvRecursiveMutexPollingTask( void *pvParameters )
{ {
/* Just to remove compiler warning. */ /* Just to remove compiler warning. */
( void ) pvParameters; ( void ) pvParameters;
for( ;; ) for( ;; )
{ {
/* Keep attempting to obtain the mutex. We should only obtain it when /* Keep attempting to obtain the mutex. We should only obtain it when
the blocking task has suspended itself. */ the blocking task has suspended itself. */
if( xSemaphoreTakeRecursive( xMutex, recmuNO_DELAY ) == pdPASS ) if( xSemaphoreTakeRecursive( xMutex, recmuNO_DELAY ) == pdPASS )
{ {
/* Is the blocking task suspended? */ /* Is the blocking task suspended? */
if( xBlockingIsSuspended != pdTRUE ) if( xBlockingIsSuspended != pdTRUE )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = pdTRUE;
} }
else else
{ {
/* Keep count of the number of cycles this task has performed so /* Keep count of the number of cycles this task has performed so
a stall can be detected. */ a stall can be detected. */
uxPollingCycles++; uxPollingCycles++;
/* We can resume the other tasks here even though they have a /* We can resume the other tasks here even though they have a
higher priority than the polling task. When they execute they higher priority than the polling task. When they execute they
will attempt to obtain the mutex but fail because the polling will attempt to obtain the mutex but fail because the polling
task is still the mutex holder. The polling task (this task) task is still the mutex holder. The polling task (this task)
will then inherit the higher priority. */ will then inherit the higher priority. */
vTaskResume( xBlockingTaskHandle ); vTaskResume( xBlockingTaskHandle );
vTaskResume( xControllingTaskHandle ); vTaskResume( xControllingTaskHandle );
/* Release the mutex, disinheriting the higher priority again. */ /* Release the mutex, disinheriting the higher priority again. */
if( xSemaphoreGiveRecursive( xMutex ) != pdPASS ) if( xSemaphoreGiveRecursive( xMutex ) != pdPASS )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = pdTRUE;
} }
} }
} }
#if configUSE_PREEMPTION == 0 #if configUSE_PREEMPTION == 0
{ {
taskYIELD(); taskYIELD();
} }
#endif #endif
} }
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/* This is called to check that all the created tasks are still running. */ /* This is called to check that all the created tasks are still running. */
portBASE_TYPE xAreRecursiveMutexTasksStillRunning( void ) portBASE_TYPE xAreRecursiveMutexTasksStillRunning( void )
{ {
portBASE_TYPE xReturn; portBASE_TYPE xReturn;
static unsigned portBASE_TYPE uxLastControllingCycles = 0, uxLastBlockingCycles = 0, uxLastPollingCycles = 0; static unsigned portBASE_TYPE uxLastControllingCycles = 0, uxLastBlockingCycles = 0, uxLastPollingCycles = 0;
/* Is the controlling task still cycling? */ /* Is the controlling task still cycling? */
if( uxLastControllingCycles == uxControllingCycles ) if( uxLastControllingCycles == uxControllingCycles )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = pdTRUE;
} }
else else
{ {
uxLastControllingCycles = uxControllingCycles; uxLastControllingCycles = uxControllingCycles;
} }
/* Is the blocking task still cycling? */ /* Is the blocking task still cycling? */
if( uxLastBlockingCycles == uxBlockingCycles ) if( uxLastBlockingCycles == uxBlockingCycles )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = pdTRUE;
} }
else else
{ {
uxLastBlockingCycles = uxBlockingCycles; uxLastBlockingCycles = uxBlockingCycles;
} }
/* Is the polling task still cycling? */ /* Is the polling task still cycling? */
if( uxLastPollingCycles == uxPollingCycles ) if( uxLastPollingCycles == uxPollingCycles )
{ {
xErrorOccurred = pdTRUE; xErrorOccurred = pdTRUE;
} }
else else
{ {
uxLastPollingCycles = uxPollingCycles; uxLastPollingCycles = uxPollingCycles;
} }
if( xErrorOccurred == pdTRUE ) if( xErrorOccurred == pdTRUE )
{ {
xReturn = pdFAIL; xReturn = pdFAIL;
} }
else else
{ {
xReturn = pdTRUE; xReturn = pdTRUE;
} }
return xReturn; return xReturn;
} }

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.
@ -155,6 +155,15 @@ const portTickType xBlockTime = ( portTickType ) 100;
xTaskCreate( prvSemaphoreTest, ( signed portCHAR * ) "BlkSEM2", semtstSTACK_SIZE, ( void * ) pxSecondSemaphoreParameters, uxPriority, ( xTaskHandle * ) NULL ); xTaskCreate( prvSemaphoreTest, ( signed portCHAR * ) "BlkSEM2", semtstSTACK_SIZE, ( void * ) pxSecondSemaphoreParameters, uxPriority, ( xTaskHandle * ) NULL );
} }
} }
/* vQueueAddToRegistry() adds the semaphore to the registry, if one is
in use. The registry is provided as a means for kernel aware
debuggers to locate semaphores and has no purpose if a kernel aware debugger
is not being used. The call to vQueueAddToRegistry() will be removed
by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is
defined to be less than 1. */
vQueueAddToRegistry( ( xQueueHandle ) pxFirstSemaphoreParameters->xSemaphore, ( signed portCHAR * ) "Counting_Sem_1" );
vQueueAddToRegistry( ( xQueueHandle ) pxSecondSemaphoreParameters->xSemaphore, ( signed portCHAR * ) "Counting_Sem_2" );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

@ -1,5 +1,5 @@
/* /*
FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry. FreeRTOS.org V5.0.2 - Copyright (C) 2003-2008 Richard Barry.
This file is part of the FreeRTOS.org distribution. This file is part of the FreeRTOS.org distribution.

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save