/*\r
- FreeRTOS V7.5.3 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ FreeRTOS V7.5.3 - Copyright (C) 2013 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
const portTickType xDontBlock = ( portTickType ) 0;\r
\r
/* Create the first two tasks as described at the top of the file. */\r
- \r
+\r
/* First create the structure used to pass parameters to the consumer tasks. */\r
pxQueueParameters1 = ( xBlockingQueueParameters * ) pvPortMalloc( sizeof( xBlockingQueueParameters ) );\r
\r
/* Pass in the variable that this task is going to increment so we can check it\r
is still running. */\r
pxQueueParameters1->psCheckVariable = &( sBlockingConsumerCount[ 0 ] );\r
- \r
+\r
/* Create the structure used to pass parameters to the producer task. */\r
pxQueueParameters2 = ( xBlockingQueueParameters * ) pvPortMalloc( sizeof( xBlockingQueueParameters ) );\r
\r
xTaskCreate( vBlockingQueueConsumer, ( signed char * ) "QConsB1", blckqSTACK_SIZE, ( void * ) pxQueueParameters1, uxPriority, NULL );\r
xTaskCreate( vBlockingQueueProducer, ( signed char * ) "QProdB2", blckqSTACK_SIZE, ( void * ) pxQueueParameters2, tskIDLE_PRIORITY, NULL );\r
\r
- \r
+\r
\r
/* Create the second two tasks as described at the top of the file. This uses\r
the same mechanism but reverses the task priorities. */\r
pxQueueParameters6 = ( xBlockingQueueParameters * ) pvPortMalloc( sizeof( xBlockingQueueParameters ) );\r
pxQueueParameters6->xQueue = pxQueueParameters5->xQueue;\r
pxQueueParameters6->xBlockTime = xBlockTime;\r
- pxQueueParameters6->psCheckVariable = &( sBlockingConsumerCount[ 2 ] ); \r
+ pxQueueParameters6->psCheckVariable = &( sBlockingConsumerCount[ 2 ] );\r
\r
xTaskCreate( vBlockingQueueProducer, ( signed char * ) "QProdB5", blckqSTACK_SIZE, ( void * ) pxQueueParameters5, tskIDLE_PRIORITY, NULL );\r
xTaskCreate( vBlockingQueueConsumer, ( signed char * ) "QConsB6", blckqSTACK_SIZE, ( void * ) pxQueueParameters6, tskIDLE_PRIORITY, NULL );\r
pxQueueParameters = ( xBlockingQueueParameters * ) pvParameters;\r
\r
for( ;; )\r
- { \r
+ {\r
if( xQueueSend( pxQueueParameters->xQueue, ( void * ) &usValue, pxQueueParameters->xBlockTime ) != pdPASS )\r
{\r
sErrorEverOccurred = pdTRUE;\r
/* Increment the variable we are going to post next time round. The\r
consumer will expect the numbers to follow in numerical order. */\r
++usValue;\r
+\r
+ #if configUSE_PREEMPTION == 0\r
+ taskYIELD();\r
+ #endif\r
}\r
}\r
}\r
pxQueueParameters = ( xBlockingQueueParameters * ) pvParameters;\r
\r
for( ;; )\r
- { \r
+ {\r
if( xQueueReceive( pxQueueParameters->xQueue, &usData, pxQueueParameters->xBlockTime ) == pdPASS )\r
{\r
if( usData != usExpectedValue )\r
else\r
{\r
/* We have successfully received a message, so increment the\r
- variable used to check we are still running. */ \r
+ variable used to check we are still running. */\r
if( sErrorEverOccurred == pdFALSE )\r
{\r
( *pxQueueParameters->psCheckVariable )++;\r
}\r
- \r
+\r
/* Increment the value we expect to remove from the queue next time\r
round. */\r
++usExpectedValue;\r
- } \r
- } \r
+ }\r
+\r
+ #if configUSE_PREEMPTION == 0\r
+ {\r
+ if( pxQueueParameters->xBlockTime == 0 )\r
+ {\r
+ taskYIELD();\r
+ }\r
+ }\r
+ #endif\r
+ }\r
}\r
}\r
/*-----------------------------------------------------------*/\r
/* Not too worried about mutual exclusion on these variables as they are 16\r
bits and we are only reading them. We also only care to see if they have\r
changed or not.\r
- \r
+\r
Loop through each check variable to and return pdFALSE if any are found not\r
to have changed since the last call. */\r
\r