Ensure the Win32 demo runs in co-operative mode.

pull/4/head
Richard Barry 12 years ago
parent b1b4b15353
commit c44d12dadb

@ -137,7 +137,7 @@ static volatile unsigned portBASE_TYPE uxControllingCycles = 0, uxBlockingCycles
/* Handles of the two higher priority tasks, required so they can be resumed
(unsuspended). */
static xTaskHandle xControllingTaskHandle, xBlockingTaskHandle;
static xTaskHandle xControllingTaskHandle, xBlockingTaskHandle, xPollingTaskHandle;
/*-----------------------------------------------------------*/
@ -160,7 +160,7 @@ void vStartRecursiveMutexTasks( void )
{
xTaskCreate( prvRecursiveMutexControllingTask, ( signed portCHAR * ) "Rec1Ctrl", configMINIMAL_STACK_SIZE, NULL, recmuCONTROLLING_TASK_PRIORITY, &xControllingTaskHandle );
xTaskCreate( prvRecursiveMutexBlockingTask, ( signed portCHAR * ) "Rec2Blck", configMINIMAL_STACK_SIZE, NULL, recmuBLOCKING_TASK_PRIORITY, &xBlockingTaskHandle );
xTaskCreate( prvRecursiveMutexPollingTask, ( signed portCHAR * ) "Rec3Poll", configMINIMAL_STACK_SIZE, NULL, recmuPOLLING_TASK_PRIORITY, NULL );
xTaskCreate( prvRecursiveMutexPollingTask, ( signed portCHAR * ) "Rec3Poll", configMINIMAL_STACK_SIZE, NULL, recmuPOLLING_TASK_PRIORITY, &xPollingTaskHandle );
}
}
/*-----------------------------------------------------------*/
@ -223,6 +223,10 @@ unsigned portBASE_TYPE ux;
{
xErrorOccurred = pdTRUE;
}
#if configUSE_PREEMPTION == 0
taskYIELD();
#endif
}
/* Having given it back the same number of times as it was taken, we
@ -329,10 +333,17 @@ static void prvRecursiveMutexPollingTask( void *pvParameters )
block indefinitely when it attempts to obtain the mutex, the
Controlling task will only block for a fixed period and an
error will be latched if the polling task has not returned the
mutex by the time this fixed period has expired. */
mutex by the time this fixed period has expired. */
vTaskResume( xBlockingTaskHandle );
vTaskResume( xControllingTaskHandle );
#if configUSE_PREEMPTION == 0
taskYIELD();
#endif
vTaskResume( xControllingTaskHandle );
#if configUSE_PREEMPTION == 0
taskYIELD();
#endif
/* The other two tasks should now have executed and no longer
be suspended. */
if( ( xBlockingIsSuspended == pdTRUE ) || ( xControllingIsSuspended == pdTRUE ) )
@ -345,6 +356,10 @@ static void prvRecursiveMutexPollingTask( void *pvParameters )
{
xErrorOccurred = pdTRUE;
}
#if configUSE_PREEMPTION == 0
taskYIELD();
#endif
}
}

@ -191,6 +191,10 @@ static void prvQueueSendTask( void *pvParameters )
portTickType xNextWakeTime;
const unsigned long ulValueToSend = 100UL;
/* Remove compiler warning in the case that configASSERT() is not
defined. */
( void ) pvParameters;
/* Check the task parameter is as expected. */
configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_SEND_PARAMETER );
@ -218,6 +222,10 @@ static void prvQueueReceiveTask( void *pvParameters )
{
unsigned long ulReceivedValue;
/* Remove compiler warning in the case that configASSERT() is not
defined. */
( void ) pvParameters;
/* Check the task parameter is as expected. */
configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_RECEIVE_PARAMETER );

@ -190,14 +190,20 @@ int main_full( void )
vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );
vStartQueuePeekTasks();
vStartMathTasks( mainFLOP_TASK_PRIORITY );
vStartRecursiveMutexTasks();
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
vStartRecursiveMutexTasks();
vStartCountingSemaphoreTasks();
vStartDynamicPriorityTasks();
vStartQueueSetTasks();
vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY );
xTaskCreate( prvDemoQueueSpaceFunctions, ( signed char * ) "QSpace", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
#if( configUSE_PREEMPTION != 0 )
{
/* Don't expect these tasks to pass when preemption is not used. */
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
}
#endif
/* The suicide tasks must be created last as they need to know how many
tasks were running prior to their creation. This then allows them to
ascertain whether or not the correct/expected number of tasks are running at
@ -234,11 +240,17 @@ const portTickType xCycleFrequency = 2500 / portTICK_RATE_MS;
vTaskDelayUntil( &xNextWakeTime, xCycleFrequency );
/* Check the standard demo tasks are running without error. */
if( xAreTimerDemoTasksStillRunning( xCycleFrequency ) != pdTRUE )
#if( configUSE_PREEMPTION != 0 )
{
pcStatusMessage = "Error: TimerDemo";
/* These tasks are only created when preemption is used. */
if( xAreTimerDemoTasksStillRunning( xCycleFrequency ) != pdTRUE )
{
pcStatusMessage = "Error: TimerDemo";
}
}
else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
#endif
if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: IntMath";
}
@ -280,15 +292,15 @@ const portTickType xCycleFrequency = 2500 / portTICK_RATE_MS;
}
else if( xAreDynamicPriorityTasksStillRunning() != pdPASS )
{
pcStatusMessage = "Error: Dynamic\r\n";
pcStatusMessage = "Error: Dynamic";
}
else if( xAreQueueSetTasksStillRunning() != pdPASS )
{
pcStatusMessage = "Error: Queue set\r\n";
pcStatusMessage = "Error: Queue set";
}
else if( xIsQueueOverwriteTaskStillRunning() != pdPASS )
{
pcStatusMessage = "Error: Queue overwrite\r\n";
pcStatusMessage = "Error: Queue overwrite";
}
/* This is the only task that uses stdout so its ok to call printf()
@ -371,7 +383,12 @@ void vFullDemoTickHookFunction( void )
{
/* Call the periodic timer test, which tests the timer API functions that
can be called from an ISR. */
vTimerPeriodicISRTests();
#if( configUSE_PREEMPTION != 0 )
{
/* Only created when preemption is used. */
vTimerPeriodicISRTests();
}
#endif
/* Call the periodic queue overwrite from ISR demo. */
vQueueOverwritePeriodicISRDemo();
@ -521,6 +538,10 @@ unsigned portBASE_TYPE uxReturn, x;
/* The queue is full, start again. */
xQueueReset( xQueue );
#if( configUSE_PREEMPTION == 0 )
taskYIELD();
#endif
}
}

Loading…
Cancel
Save