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
+ 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
+ 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
+ http://www.OpenRTOS.com - Commercial support, development, porting,\r
licensing and training services.\r
*/\r
\r
/* Demo includes. */\r
#include "blocktim.h"\r
\r
-/* Task priorities. */\r
-#define bktPRIMARY_PRIORITY ( 3 )\r
-#define bktSECONDARY_PRIORITY ( 2 )\r
+/* Task priorities. Allow these to be overridden. */\r
+#ifndef bktPRIMARY_PRIORITY\r
+ #define bktPRIMARY_PRIORITY ( 3 )\r
+#endif\r
+\r
+#ifndef bktSECONDARY_PRIORITY\r
+ #define bktSECONDARY_PRIORITY ( 2 )\r
+#endif\r
\r
/* Task behaviour. */\r
#define bktQUEUE_LENGTH ( 5 )\r
xTestQueue = xQueueCreate( bktQUEUE_LENGTH, sizeof( portBASE_TYPE ) );\r
\r
/* vQueueAddToRegistry() adds the queue to the queue registry, if one is\r
- in use. The queue registry is provided as a means for kernel aware \r
+ in use. The queue registry is provided as a means for kernel aware\r
debuggers to locate queues 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
+ by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is\r
defined to be less than 1. */\r
vQueueAddToRegistry( xTestQueue, ( signed portCHAR * ) "Block_Time_Queue" );\r
\r
xTimeToBlock = bktPRIMARY_BLOCK_TIME << xItem;\r
\r
xTimeWhenBlocking = xTaskGetTickCount();\r
- \r
+\r
/* We should unblock after xTimeToBlock having not received\r
anything on the queue. */\r
if( xQueueReceive( xTestQueue, &xData, xTimeToBlock ) != errQUEUE_EMPTY )\r
xTimeToBlock = bktPRIMARY_BLOCK_TIME << xItem;\r
\r
xTimeWhenBlocking = xTaskGetTickCount();\r
- \r
+\r
/* We should unblock after xTimeToBlock having not received\r
anything on the queue. */\r
if( xQueueSend( xTestQueue, &xItem, xTimeToBlock ) != errQUEUE_FULL )\r
for( xItem = 0; xItem < bktQUEUE_LENGTH; xItem++ )\r
{\r
/* Now when we make space on the queue the other task should wake\r
- but not execute as this task has higher priority. */ \r
+ but not execute as this task has higher priority. */\r
if( xQueueReceive( xTestQueue, &xData, bktDONT_BLOCK ) != pdPASS )\r
{\r
xErrorOccurred = pdTRUE;\r
}\r
\r
/* Set the priority back down. */\r
- vTaskPrioritySet( xSecondary, bktSECONDARY_PRIORITY ); \r
+ vTaskPrioritySet( xSecondary, bktSECONDARY_PRIORITY );\r
}\r
\r
/* Let the other task timeout. When it unblockes it will check that it\r
xErrorOccurred = pdTRUE;\r
}\r
}\r
- \r
+\r
/* Wake the other task so it blocks attempting to read from the\r
already empty queue. */\r
vTaskResume( xSecondary );\r
for( xItem = 0; xItem < bktQUEUE_LENGTH; xItem++ )\r
{\r
/* Now when we place an item on the queue the other task should\r
- wake but not execute as this task has higher priority. */ \r
+ wake but not execute as this task has higher priority. */\r
if( xQueueSend( xTestQueue, &xItem, bktDONT_BLOCK ) != pdPASS )\r
{\r
xErrorOccurred = pdTRUE;\r
queue function. */\r
xErrorOccurred = pdTRUE;\r
}\r
- vTaskPrioritySet( xSecondary, bktSECONDARY_PRIORITY ); \r
+ vTaskPrioritySet( xSecondary, bktSECONDARY_PRIORITY );\r
}\r
\r
/* Let the other task timeout. When it unblockes it will check that it\r
full so we block. Note the time before we block so we can check the\r
wake time is as per that expected. */\r
xTimeWhenBlocking = xTaskGetTickCount();\r
- \r
+\r
/* We should unblock after bktTIME_TO_BLOCK having not received\r
anything on the queue. */\r
xData = 0;\r
\r
As per test three, but with the send and receive reversed. */\r
xTimeWhenBlocking = xTaskGetTickCount();\r
- \r
+\r
/* We should unblock after bktTIME_TO_BLOCK having not received\r
anything on the queue. */\r
xRunIndicator = bktRUN_INDICATOR;\r