/*\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
/*\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
*/\r
\r
\r
-/* \r
- * Tests the extra queue functionality introduced in FreeRTOS.org V4.5.0 - \r
- * including xQueueSendToFront(), xQueueSendToBack(), xQueuePeek() and \r
- * mutex behaviour. \r
+/*\r
+ * Tests the extra queue functionality introduced in FreeRTOS.org V4.5.0 -\r
+ * including xQueueSendToFront(), xQueueSendToBack(), xQueuePeek() and\r
+ * mutex behaviour.\r
*\r
- * See the comments above the prvSendFrontAndBackTest() and \r
+ * See the comments above the prvSendFrontAndBackTest() and\r
* prvLowPriorityMutexTask() prototypes below for more information.\r
*/\r
\r
xQueue = xQueueCreate( genqQUEUE_LENGTH, sizeof( unsigned portLONG ) );\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( xQueue, ( signed portCHAR * ) "Gen_Queue_Test" );\r
\r
xMutex = xSemaphoreCreateMutex();\r
\r
/* vQueueAddToRegistry() adds the mutex to the registry, if one is\r
- in use. The registry is provided as a means for kernel aware \r
+ in use. The registry is provided as a means for kernel aware\r
debuggers to locate mutexes 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( ( xQueueHandle ) xMutex, ( signed portCHAR * ) "Gen_Queue_Mutex" );\r
\r
\r
#ifdef USE_STDIO\r
void vPrintDisplayMessage( const portCHAR * const * ppcMessageToSend );\r
- \r
+\r
const portCHAR * const pcTaskStartMsg = "Queue SendToFront/SendToBack/Peek test started.\r\n";\r
\r
/* Queue a message for printing to say the task has started. */\r
{\r
xErrorDetected = pdTRUE;\r
}\r
- \r
+\r
\r
/* Now try receiving the data for real. The value should be the\r
same. Clobber the value first so we know we really received it. */\r
\r
#ifdef USE_STDIO\r
void vPrintDisplayMessage( const portCHAR * const * ppcMessageToSend );\r
- \r
+\r
const portCHAR * const pcTaskStartMsg = "Mutex with priority inheritance test started.\r\n";\r
\r
/* Queue a message for printing to say the task has started. */\r
mutex, and block when it finds it cannot obtain it. */\r
vTaskResume( xHighPriorityMutexTask );\r
\r
+ #if configUSE_PREEMPTION == 0\r
+ taskYIELD();\r
+ #endif\r
+\r
/* Ensure the task is reporting it priority as blocked and not\r
suspended (as it would have done in versions up to V7.5.3). */\r
#if( INCLUDE_eTaskGetState == 1 )\r
xErrorDetected = pdTRUE;\r
}\r
\r
+ #if configUSE_PREEMPTION == 0\r
+ taskYIELD();\r
+ #endif\r
+\r
/* Check that the guarded variable did indeed increment... */\r
if( ulGuardedVariable != 1 )\r
{\r
\r
#if configUSE_PREEMPTION == 0\r
taskYIELD();\r
- #endif \r
+ #endif\r
}\r
}\r
/*-----------------------------------------------------------*/\r
if( xSemaphoreGive( xMutex ) != pdPASS )\r
{\r
xErrorDetected = pdTRUE;\r
- } \r
+ }\r
}\r
}\r
/*-----------------------------------------------------------*/\r
}\r
\r
ulLastLoopCounter = ulLoopCounter;\r
- ulLastLoopCounter2 = ulLoopCounter2; \r
+ ulLastLoopCounter2 = ulLoopCounter2;\r
\r
/* Errors detected in the task itself will have latched xErrorDetected\r
to true. */\r
/*\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
*/\r
\r
\r
-/* \r
+/*\r
* Tests the behaviour when data is peeked from a queue when there are\r
* multiple tasks blocked on the queue.\r
*/\r
xQueue = xQueueCreate( qpeekQUEUE_LENGTH, sizeof( unsigned portLONG ) );\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( xQueue, ( signed portCHAR * ) "QPeek_Test_Queue" );\r
\r
#ifdef USE_STDIO\r
{\r
void vPrintDisplayMessage( const portCHAR * const * ppcMessageToSend );\r
- \r
+\r
const portCHAR * const pcTaskStartMsg = "Queue peek test started.\r\n";\r
\r
/* Queue a message for printing to say the task has started. */\r
xErrorDetected = pdTRUE;\r
}\r
\r
- /* Now we will block again as the queue is once more empty. The low \r
+ /* Now we will block again as the queue is once more empty. The low\r
priority task can then execute again. */\r
if( xQueuePeek( xQueue, &ulValue, portMAX_DELAY ) != pdPASS )\r
{\r
xErrorDetected = pdTRUE;\r
}\r
\r
- vTaskSuspend( NULL ); \r
+ vTaskSuspend( NULL );\r
}\r
}\r
/*-----------------------------------------------------------*/\r
xErrorDetected = pdTRUE;\r
}\r
\r
- vTaskSuspend( NULL ); \r
+ vTaskSuspend( NULL );\r
}\r
}\r
/*-----------------------------------------------------------*/\r
\r
for( ;; )\r
{\r
- /* Write some data to the queue. This should unblock the highest \r
+ /* Write some data to the queue. This should unblock the highest\r
priority task that is waiting to peek data from the queue. */\r
ulValue = 0x11223344;\r
if( xQueueSendToBack( xQueue, &ulValue, qpeekNO_BLOCK ) != pdPASS )\r
xErrorDetected = pdTRUE;\r
}\r
\r
+ #if configUSE_PREEMPTION == 0\r
+ taskYIELD();\r
+ #endif\r
+\r
/* By the time we get here the data should have been removed from\r
the queue. */\r
if( uxQueueMessagesWaiting( xQueue ) != 0 )\r
xErrorDetected = pdTRUE;\r
}\r
\r
+ #if configUSE_PREEMPTION == 0\r
+ taskYIELD();\r
+ #endif\r
+\r
/* All the other tasks should now have successfully peeked the data.\r
The data is still in the queue so we should be able to receive it. */\r
ulValue = 0;\r
{\r
/* We did not receive the expected value. */\r
}\r
- \r
+\r
/* Lets just delay a while as this is an intensive test as we don't\r
want to starve other tests of processing time. */\r
vTaskDelay( qpeekSHORT_DELAY );\r
vTaskResume( xHighPriorityTask );\r
vTaskResume( xHighestPriorityTask );\r
\r
+ #if( configUSE_PREEMPTION == 0 )\r
+ taskYIELD();\r
+ #endif\r
+\r
ulValue = 0xaabbaabb;\r
if( xQueueSendToFront( xQueue, &ulValue, qpeekNO_BLOCK ) != pdPASS )\r
{\r
xErrorDetected = pdTRUE;\r
}\r
\r
+ #if configUSE_PREEMPTION == 0\r
+ taskYIELD();\r
+ #endif\r
+\r
/* This time we should find that the queue is empty. The high priority\r
task actually removed the data rather than just peeking it. */\r
if( xQueuePeek( xQueue, &ulValue, qpeekNO_BLOCK ) != errQUEUE_EMPTY )\r
and repeat the whole thing. The medium priority task should not be\r
suspended as it was not able to peek the data in this last case. */\r
vTaskResume( xHighPriorityTask );\r
- vTaskResume( xHighestPriorityTask ); \r
+ vTaskResume( xHighestPriorityTask );\r
\r
/* Lets just delay a while as this is an intensive test as we don't\r
want to starve other tests of processing time. */\r
/*\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
error. */\r
ulLoopCounter++;\r
}\r
+\r
+ #if( configUSE_PREEMPTION == 0 )\r
+ taskYIELD();\r
+ #endif\r
}\r
}\r
/*-----------------------------------------------------------*/\r
case 1:\r
/* The queue already holds ulTx1. Overwrite the value in the queue\r
with ulTx2. */\r
- xQueueOverwriteFromISR( xISRQueue, &ulTx2, NULL ); \r
+ xQueueOverwriteFromISR( xISRQueue, &ulTx2, NULL );\r
break;\r
\r
case 2:\r
xQueueSetTasksStatus = pdFAIL;\r
}\r
\r
+ #if( configUSE_PREEMPTION == 0 )\r
+ taskYIELD();\r
+ #endif\r
+\r
ulTaskTxValue++;\r
\r
/* If the Tx value has reached the range used by the ISR then set it\r
/*\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
( *pulCounter )++;\r
}\r
vTaskPrioritySet( NULL, uxOurPriority );\r
+\r
+ #if( configUSE_PREEMPTION == 0 )\r
+ taskYIELD();\r
+ #endif\r
+\r
configASSERT( ( uxTaskPriorityGet( NULL ) == uxOurPriority ) );\r
}\r
}\r
}\r
vTaskResume( xContinuousIncrementHandle );\r
\r
+ #if( configUSE_PREEMPTION == 0 )\r
+ taskYIELD();\r
+ #endif\r
+\r
#if( INCLUDE_eTaskGetState == 1 )\r
{\r
configASSERT( eTaskGetState( xContinuousIncrementHandle ) == eReady );\r
task has suspended itself with a known value in the counter variable. */\r
vTaskResume( xLimitedIncrementHandle );\r
\r
+ #if( configUSE_PREEMPTION == 0 )\r
+ taskYIELD();\r
+ #endif\r
+\r
/* This task should not run again until xLimitedIncrementHandle has\r
suspended itself. */\r
#if( INCLUDE_eTaskGetState == 1 )\r
\r
/* Resume the continuous count task and do it all again. */\r
vTaskResume( xContinuousIncrementHandle );\r
+\r
+ #if( configUSE_PREEMPTION == 0 )\r
+ taskYIELD();\r
+ #endif\r
}\r
}\r
/*-----------------------------------------------------------*/\r
/*\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