defined to be less than 1. */\r
vQueueAddToRegistry( xNormallyFullQueue, ( signed portCHAR * ) "NormallyFull" );\r
vQueueAddToRegistry( xNormallyEmptyQueue, ( signed portCHAR * ) "NormallyEmpty" );\r
-\r
}\r
/*-----------------------------------------------------------*/\r
\r
{\r
prvQueueAccessLogError( __LINE__ );\r
}\r
- \r
+\r
/* Log that this value has been received. */\r
ucNormallyFullReceivedValues[ uxValue ] = uxSource;\r
}\r
{\r
prvQueueAccessLogError( __LINE__ );\r
}\r
- \r
+\r
/* Log that this value has been received. */\r
ucNormallyEmptyReceivedValues[ uxValue ] = uxSource;\r
}\r
values are received and no values are duplicated. */\r
prvRecordValue_NormallyEmpty( uxRxed, ( unsigned portBASE_TYPE ) pvParameters );\r
}\r
- \r
+\r
/* Ensure the other task running this code gets a chance to execute. */\r
taskYIELD();\r
- \r
+\r
if( ( unsigned portBASE_TYPE ) pvParameters == intqHIGH_PRIORITY_TASK1 )\r
{\r
/* Have we received all the expected values? */\r
if( uxValueForNormallyEmptyQueue > ( intqNUM_VALUES_TO_LOG + intqVALUE_OVERRUN ) )\r
{\r
vTaskSuspend( xHighPriorityNormallyEmptyTask2 );\r
- \r
+\r
uxTask1 = 0;\r
uxTask2 = 0;\r
- \r
+\r
/* Loop through the array, checking that both tasks have\r
placed values into the array, and that no values are missing. */\r
for( ux = 0; ux < intqNUM_VALUES_TO_LOG; ux++ )\r
}\r
}\r
}\r
- \r
+\r
if( uxTask1 < intqMIN_ACCEPTABLE_TASK_COUNT )\r
{\r
/* Only task 2 seemed to log any values. */\r
prvQueueAccessLogError( __LINE__ );\r
}\r
- \r
+\r
if( uxTask2 < intqMIN_ACCEPTABLE_TASK_COUNT )\r
{\r
/* Only task 1 seemed to log any values. */\r
prvQueueAccessLogError( __LINE__ );\r
}\r
- \r
+\r
/* Clear the array again, ready to start a new cycle. */\r
memset( ucNormallyEmptyReceivedValues, 0x00, sizeof( ucNormallyEmptyReceivedValues ) );\r
- \r
+\r
uxHighPriorityLoops1++;\r
uxValueForNormallyEmptyQueue = 0;\r
\r
priority tasks. The lower priority task will resume us\r
if it receives something. We will then resume the other\r
higher priority task. */\r
- vTaskSuspend( NULL ); \r
+ vTaskSuspend( NULL );\r
vTaskResume( xHighPriorityNormallyEmptyTask2 );\r
}\r
}\r
\r
/* The parameters are not being used so avoid compiler warnings. */\r
( void ) pvParameters;\r
- \r
+\r
for( ;; )\r
- { \r
+ {\r
if( ( xQueueStatus = xQueueReceive( xNormallyEmptyQueue, &uxRxed, intqONE_TICK_DELAY ) ) != errQUEUE_EMPTY )\r
{\r
/* We should only obtain a value when the high priority task is\r
}\r
\r
prvRecordValue_NormallyEmpty( uxRxed, intqLOW_PRIORITY_TASK );\r
- \r
+\r
/* Wake the higher priority task again. */\r
vTaskResume( xHighPriorityNormallyEmptyTask1 );\r
uxLowPriorityLoops1++;\r
/* Raise our priority while we send so we can preempt the higher\r
priority task, and ensure we get the Tx value into the queue. */\r
vTaskPrioritySet( NULL, intqHIGHER_PRIORITY + 1 );\r
- \r
+\r
portENTER_CRITICAL();\r
{\r
uxValue = uxValueForNormallyEmptyQueue;\r
uxValueForNormallyEmptyQueue++;\r
}\r
portEXIT_CRITICAL();\r
- \r
+\r
if( xQueueSend( xNormallyEmptyQueue, &uxValue, portMAX_DELAY ) != pdPASS )\r
{\r
prvQueueAccessLogError( __LINE__ );\r
}\r
- \r
+\r
vTaskPrioritySet( NULL, intqLOWER_PRIORITY );\r
}\r
}\r
\r
/* The parameters are not being used so avoid compiler warnings. */\r
( void ) pvParameters;\r
- \r
+\r
/* Make sure the queue starts full or near full. >> 1 as there are two\r
high priority tasks. */\r
for( ux = 0; ux < ( intqQUEUE_LENGTH >> 1 ); ux++ )\r
}\r
portEXIT_CRITICAL();\r
\r
- xQueueSend( xNormallyFullQueue, &uxValueToTx, intqSHORT_DELAY ); \r
+ xQueueSend( xNormallyFullQueue, &uxValueToTx, intqSHORT_DELAY );\r
}\r
\r
for( ;; )\r
\r
/* Allow the other task running this code to run. */\r
taskYIELD();\r
- \r
+\r
/* Have all the expected values been sent to the queue? */\r
if( uxValueToTx > ( intqNUM_VALUES_TO_LOG + intqVALUE_OVERRUN ) )\r
{\r
/* Make sure the other high priority task completes its send of\r
any values below intqNUM_VALUE_TO_LOG. */\r
vTaskDelay( intqSHORT_DELAY );\r
- \r
+\r
vTaskSuspend( xHighPriorityNormallyFullTask2 );\r
- \r
+\r
if( xWasSuspended == pdTRUE )\r
{\r
/* We would have expected the other high priority task to have\r
set this back to false by now. */\r
prvQueueAccessLogError( __LINE__ );\r
}\r
- \r
+\r
/* Set the suspended flag so an error is not logged if the other\r
task recognises a time out when it is unsuspended. */\r
xWasSuspended = pdTRUE;\r
- \r
+\r
for( ux = 0; ux < intqNUM_VALUES_TO_LOG; ux++ )\r
{\r
if( ucNormallyFullReceivedValues[ ux ] == 0 )\r
/* A value was missing. */\r
prvQueueAccessLogError( __LINE__ );\r
}\r
- } \r
+ }\r
\r
/* Reset the array ready for the next cycle. */\r
- memset( ucNormallyFullReceivedValues, 0x00, sizeof( ucNormallyFullReceivedValues ) ); \r
- \r
+ memset( ucNormallyFullReceivedValues, 0x00, sizeof( ucNormallyFullReceivedValues ) );\r
+\r
uxHighPriorityLoops2++;\r
uxValueForNormallyFullQueue = 0;\r
\r
priority tasks. The lower priority task will resume us\r
if it receives something. We will then resume the other\r
higher priority task. */\r
- vTaskSuspend( NULL ); \r
+ vTaskSuspend( NULL );\r
vTaskResume( xHighPriorityNormallyFullTask2 );\r
}\r
}\r
\r
/* The parameters are not being used so avoid compiler warnings. */\r
( void ) pvParameters;\r
- \r
+\r
/* Make sure the queue starts full or near full. >> 1 as there are two\r
high priority tasks. */\r
for( ux = 0; ux < ( intqQUEUE_LENGTH >> 1 ); ux++ )\r
}\r
portEXIT_CRITICAL();\r
\r
- xQueueSend( xNormallyFullQueue, &uxValueToTx, intqSHORT_DELAY ); \r
+ xQueueSend( xNormallyFullQueue, &uxValueToTx, intqSHORT_DELAY );\r
}\r
\r
for( ;; )\r
}\r
\r
xWasSuspended = pdFALSE;\r
- \r
+\r
taskYIELD();\r
}\r
}\r
\r
/* The parameters are not being used so avoid compiler warnings. */\r
( void ) pvParameters;\r
- \r
+\r
for( ;; )\r
- { \r
+ {\r
if( ( xQueueStatus = xQueueSend( xNormallyFullQueue, &uxTxed, intqONE_TICK_DELAY ) ) != errQUEUE_FULL )\r
{\r
/* We would only expect to succeed when the higher priority task\r
/* Raise our priority while we receive so we can preempt the higher\r
priority task, and ensure we get the value from the queue. */\r
vTaskPrioritySet( NULL, intqHIGHER_PRIORITY + 1 );\r
- \r
+\r
if( xQueueReceive( xNormallyFullQueue, &uxValue, portMAX_DELAY ) != pdPASS )\r
{\r
prvQueueAccessLogError( __LINE__ );\r
{\r
prvRecordValue_NormallyFull( uxValue, intqLOW_PRIORITY_TASK );\r
}\r
- \r
+\r
vTaskPrioritySet( NULL, intqLOWER_PRIORITY );\r
}\r
}\r
accesses on the queues. */\r
\r
uxNextOperation++;\r
- \r
+\r
if( uxNextOperation & ( unsigned portBASE_TYPE ) 0x01 )\r
{\r
timerNORMALLY_EMPTY_TX();\r
- timerNORMALLY_EMPTY_TX(); \r
+ timerNORMALLY_EMPTY_TX();\r
timerNORMALLY_EMPTY_TX();\r
}\r
else\r
timerNORMALLY_FULL_RX();\r
timerNORMALLY_FULL_RX();\r
}\r
- \r
+\r
return xHigherPriorityTaskWoken;\r
}\r
/*-----------------------------------------------------------*/\r
accesses on the queues. */\r
\r
uxNextOperation++;\r
- \r
+\r
if( uxNextOperation & ( unsigned portBASE_TYPE ) 0x01 )\r
{\r
timerNORMALLY_EMPTY_TX();\r
timerNORMALLY_EMPTY_RX();\r
}\r
else\r
- { \r
+ {\r
timerNORMALLY_FULL_RX();\r
timerNORMALLY_FULL_TX();\r
timerNORMALLY_FULL_TX();\r
timerNORMALLY_FULL_TX();\r
timerNORMALLY_FULL_TX();\r
}\r
- \r
+\r
return xHigherPriorityTaskWoken;\r
}\r
/*-----------------------------------------------------------*/\r
portBASE_TYPE xAreIntQueueTasksStillRunning( void )\r
{\r
static unsigned portBASE_TYPE uxLastHighPriorityLoops1 = 0, uxLastHighPriorityLoops2 = 0, uxLastLowPriorityLoops1 = 0, uxLastLowPriorityLoops2 = 0;\r
- \r
+\r
/* xErrorStatus can be set outside of this function. This function just\r
checks that all the tasks are still cycling. */\r
\r
/* The high priority 1 task has stalled. */\r
prvQueueAccessLogError( __LINE__ );\r
}\r
- \r
+\r
uxLastHighPriorityLoops1 = uxHighPriorityLoops1;\r
- \r
+\r
if( uxHighPriorityLoops2 == uxLastHighPriorityLoops2 )\r
{\r
/* The high priority 2 task has stalled. */\r
prvQueueAccessLogError( __LINE__ );\r
}\r
- \r
+\r
uxLastHighPriorityLoops2 = uxHighPriorityLoops2;\r
- \r
+\r
if( uxLowPriorityLoops1 == uxLastLowPriorityLoops1 )\r
{\r
/* The low priority 1 task has stalled. */\r