\r
/* Handles of the two higher priority tasks, required so they can be resumed \r
(unsuspended). */\r
-static xTaskHandle xControllingTaskHandle, xBlockingTaskHandle;\r
+static xTaskHandle xControllingTaskHandle, xBlockingTaskHandle, xPollingTaskHandle;\r
\r
/*-----------------------------------------------------------*/\r
\r
{\r
xTaskCreate( prvRecursiveMutexControllingTask, ( signed portCHAR * ) "Rec1Ctrl", configMINIMAL_STACK_SIZE, NULL, recmuCONTROLLING_TASK_PRIORITY, &xControllingTaskHandle );\r
xTaskCreate( prvRecursiveMutexBlockingTask, ( signed portCHAR * ) "Rec2Blck", configMINIMAL_STACK_SIZE, NULL, recmuBLOCKING_TASK_PRIORITY, &xBlockingTaskHandle );\r
- xTaskCreate( prvRecursiveMutexPollingTask, ( signed portCHAR * ) "Rec3Poll", configMINIMAL_STACK_SIZE, NULL, recmuPOLLING_TASK_PRIORITY, NULL );\r
+ xTaskCreate( prvRecursiveMutexPollingTask, ( signed portCHAR * ) "Rec3Poll", configMINIMAL_STACK_SIZE, NULL, recmuPOLLING_TASK_PRIORITY, &xPollingTaskHandle );\r
}\r
}\r
/*-----------------------------------------------------------*/\r
{\r
xErrorOccurred = pdTRUE;\r
}\r
+\r
+ #if configUSE_PREEMPTION == 0\r
+ taskYIELD();\r
+ #endif\r
}\r
\r
/* Having given it back the same number of times as it was taken, we\r
block indefinitely when it attempts to obtain the mutex, the\r
Controlling task will only block for a fixed period and an\r
error will be latched if the polling task has not returned the\r
- mutex by the time this fixed period has expired. */\r
+ mutex by the time this fixed period has expired. */ \r
vTaskResume( xBlockingTaskHandle );\r
- vTaskResume( xControllingTaskHandle );\r
- \r
+ #if configUSE_PREEMPTION == 0\r
+ taskYIELD();\r
+ #endif\r
+\r
+ vTaskResume( xControllingTaskHandle );\r
+ #if configUSE_PREEMPTION == 0\r
+ taskYIELD();\r
+ #endif\r
+\r
/* The other two tasks should now have executed and no longer\r
be suspended. */\r
if( ( xBlockingIsSuspended == pdTRUE ) || ( xControllingIsSuspended == pdTRUE ) )\r
{\r
xErrorOccurred = pdTRUE;\r
}\r
+\r
+ #if configUSE_PREEMPTION == 0\r
+ taskYIELD();\r
+ #endif\r
}\r
}\r
\r
portTickType xNextWakeTime;\r
const unsigned long ulValueToSend = 100UL;\r
\r
+ /* Remove compiler warning in the case that configASSERT() is not \r
+ defined. */\r
+ ( void ) pvParameters;\r
+\r
/* Check the task parameter is as expected. */\r
configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_SEND_PARAMETER );\r
\r
{\r
unsigned long ulReceivedValue;\r
\r
+ /* Remove compiler warning in the case that configASSERT() is not \r
+ defined. */\r
+ ( void ) pvParameters;\r
+\r
/* Check the task parameter is as expected. */\r
configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_RECEIVE_PARAMETER );\r
\r
vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );\r
vStartQueuePeekTasks();\r
vStartMathTasks( mainFLOP_TASK_PRIORITY );\r
- vStartRecursiveMutexTasks();\r
- vStartTimerDemoTask( mainTIMER_TEST_PERIOD );\r
+ vStartRecursiveMutexTasks(); \r
vStartCountingSemaphoreTasks();\r
vStartDynamicPriorityTasks();\r
vStartQueueSetTasks();\r
vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY ); \r
xTaskCreate( prvDemoQueueSpaceFunctions, ( signed char * ) "QSpace", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
\r
+ #if( configUSE_PREEMPTION != 0 )\r
+ {\r
+ /* Don't expect these tasks to pass when preemption is not used. */\r
+ vStartTimerDemoTask( mainTIMER_TEST_PERIOD );\r
+ }\r
+ #endif\r
+\r
/* The suicide tasks must be created last as they need to know how many\r
tasks were running prior to their creation. This then allows them to \r
ascertain whether or not the correct/expected number of tasks are running at \r
vTaskDelayUntil( &xNextWakeTime, xCycleFrequency );\r
\r
/* Check the standard demo tasks are running without error. */\r
- if( xAreTimerDemoTasksStillRunning( xCycleFrequency ) != pdTRUE )\r
+ #if( configUSE_PREEMPTION != 0 )\r
{\r
- pcStatusMessage = "Error: TimerDemo";\r
+ /* These tasks are only created when preemption is used. */\r
+ if( xAreTimerDemoTasksStillRunning( xCycleFrequency ) != pdTRUE )\r
+ {\r
+ pcStatusMessage = "Error: TimerDemo";\r
+ }\r
}\r
- else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )\r
+ #endif\r
+\r
+ if( xAreIntegerMathsTaskStillRunning() != pdTRUE )\r
{\r
pcStatusMessage = "Error: IntMath";\r
} \r
}\r
else if( xAreDynamicPriorityTasksStillRunning() != pdPASS )\r
{\r
- pcStatusMessage = "Error: Dynamic\r\n";\r
+ pcStatusMessage = "Error: Dynamic";\r
}\r
else if( xAreQueueSetTasksStillRunning() != pdPASS )\r
{\r
- pcStatusMessage = "Error: Queue set\r\n";\r
+ pcStatusMessage = "Error: Queue set";\r
}\r
else if( xIsQueueOverwriteTaskStillRunning() != pdPASS )\r
{\r
- pcStatusMessage = "Error: Queue overwrite\r\n";\r
+ pcStatusMessage = "Error: Queue overwrite";\r
}\r
\r
/* This is the only task that uses stdout so its ok to call printf() \r
{\r
/* Call the periodic timer test, which tests the timer API functions that\r
can be called from an ISR. */\r
- vTimerPeriodicISRTests();\r
+ #if( configUSE_PREEMPTION != 0 )\r
+ {\r
+ /* Only created when preemption is used. */\r
+ vTimerPeriodicISRTests();\r
+ }\r
+ #endif\r
\r
/* Call the periodic queue overwrite from ISR demo. */\r
vQueueOverwritePeriodicISRDemo();\r
\r
/* The queue is full, start again. */\r
xQueueReset( xQueue );\r
+\r
+ #if( configUSE_PREEMPTION == 0 )\r
+ taskYIELD();\r
+ #endif\r
}\r
}\r
\r