mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Ensure the Win32 demo runs in co-operative mode.
This commit is contained in:
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
|
||||
|
@ -331,7 +335,14 @@ static void prvRecursiveMutexPollingTask( void *pvParameters )
|
|||
error will be latched if the polling task has not returned the
|
||||
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. */
|
||||
|
@ -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 );
|
||||
|
||||
|
|
|
@ -191,13 +191,19 @@ int main_full( void )
|
|||
vStartQueuePeekTasks();
|
||||
vStartMathTasks( mainFLOP_TASK_PRIORITY );
|
||||
vStartRecursiveMutexTasks();
|
||||
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
|
||||
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…
Reference in a new issue