mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 05:21:59 -04:00
Update some standard demo task implementations so they can be used with the cooperative scheduler.
This commit is contained in:
parent
5aabe4f8fb
commit
40d2e74417
|
@ -234,6 +234,10 @@ short sErrorEverOccurred = pdFALSE;
|
||||||
/* Increment the variable we are going to post next time round. The
|
/* Increment the variable we are going to post next time round. The
|
||||||
consumer will expect the numbers to follow in numerical order. */
|
consumer will expect the numbers to follow in numerical order. */
|
||||||
++usValue;
|
++usValue;
|
||||||
|
|
||||||
|
#if configUSE_PREEMPTION == 0
|
||||||
|
taskYIELD();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -271,6 +275,15 @@ short sErrorEverOccurred = pdFALSE;
|
||||||
round. */
|
round. */
|
||||||
++usExpectedValue;
|
++usExpectedValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if configUSE_PREEMPTION == 0
|
||||||
|
{
|
||||||
|
if( pxQueueParameters->xBlockTime == 0 )
|
||||||
|
{
|
||||||
|
taskYIELD();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -446,6 +446,10 @@ xSemaphoreHandle xMutex = ( xSemaphoreHandle ) pvParameters;
|
||||||
mutex, and block when it finds it cannot obtain it. */
|
mutex, and block when it finds it cannot obtain it. */
|
||||||
vTaskResume( xHighPriorityMutexTask );
|
vTaskResume( xHighPriorityMutexTask );
|
||||||
|
|
||||||
|
#if configUSE_PREEMPTION == 0
|
||||||
|
taskYIELD();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Ensure the task is reporting it priority as blocked and not
|
/* Ensure the task is reporting it priority as blocked and not
|
||||||
suspended (as it would have done in versions up to V7.5.3). */
|
suspended (as it would have done in versions up to V7.5.3). */
|
||||||
#if( INCLUDE_eTaskGetState == 1 )
|
#if( INCLUDE_eTaskGetState == 1 )
|
||||||
|
@ -490,6 +494,10 @@ xSemaphoreHandle xMutex = ( xSemaphoreHandle ) pvParameters;
|
||||||
xErrorDetected = pdTRUE;
|
xErrorDetected = pdTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if configUSE_PREEMPTION == 0
|
||||||
|
taskYIELD();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Check that the guarded variable did indeed increment... */
|
/* Check that the guarded variable did indeed increment... */
|
||||||
if( ulGuardedVariable != 1 )
|
if( ulGuardedVariable != 1 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -363,6 +363,10 @@ unsigned portLONG ulValue;
|
||||||
xErrorDetected = pdTRUE;
|
xErrorDetected = pdTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if configUSE_PREEMPTION == 0
|
||||||
|
taskYIELD();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* By the time we get here the data should have been removed from
|
/* By the time we get here the data should have been removed from
|
||||||
the queue. */
|
the queue. */
|
||||||
if( uxQueueMessagesWaiting( xQueue ) != 0 )
|
if( uxQueueMessagesWaiting( xQueue ) != 0 )
|
||||||
|
@ -380,6 +384,10 @@ unsigned portLONG ulValue;
|
||||||
xErrorDetected = pdTRUE;
|
xErrorDetected = pdTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if configUSE_PREEMPTION == 0
|
||||||
|
taskYIELD();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* All the other tasks should now have successfully peeked the data.
|
/* All the other tasks should now have successfully peeked the data.
|
||||||
The data is still in the queue so we should be able to receive it. */
|
The data is still in the queue so we should be able to receive it. */
|
||||||
ulValue = 0;
|
ulValue = 0;
|
||||||
|
@ -407,6 +415,10 @@ unsigned portLONG ulValue;
|
||||||
vTaskResume( xHighPriorityTask );
|
vTaskResume( xHighPriorityTask );
|
||||||
vTaskResume( xHighestPriorityTask );
|
vTaskResume( xHighestPriorityTask );
|
||||||
|
|
||||||
|
#if( configUSE_PREEMPTION == 0 )
|
||||||
|
taskYIELD();
|
||||||
|
#endif
|
||||||
|
|
||||||
ulValue = 0xaabbaabb;
|
ulValue = 0xaabbaabb;
|
||||||
if( xQueueSendToFront( xQueue, &ulValue, qpeekNO_BLOCK ) != pdPASS )
|
if( xQueueSendToFront( xQueue, &ulValue, qpeekNO_BLOCK ) != pdPASS )
|
||||||
{
|
{
|
||||||
|
@ -415,6 +427,10 @@ unsigned portLONG ulValue;
|
||||||
xErrorDetected = pdTRUE;
|
xErrorDetected = pdTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if configUSE_PREEMPTION == 0
|
||||||
|
taskYIELD();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This time we should find that the queue is empty. The high priority
|
/* This time we should find that the queue is empty. The high priority
|
||||||
task actually removed the data rather than just peeking it. */
|
task actually removed the data rather than just peeking it. */
|
||||||
if( xQueuePeek( xQueue, &ulValue, qpeekNO_BLOCK ) != errQUEUE_EMPTY )
|
if( xQueuePeek( xQueue, &ulValue, qpeekNO_BLOCK ) != errQUEUE_EMPTY )
|
||||||
|
|
|
@ -178,6 +178,10 @@ unsigned long ulValue, ulStatus = pdPASS, x;
|
||||||
error. */
|
error. */
|
||||||
ulLoopCounter++;
|
ulLoopCounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if( configUSE_PREEMPTION == 0 )
|
||||||
|
taskYIELD();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -319,6 +319,10 @@ xQueueHandle xQueueInUse;
|
||||||
xQueueSetTasksStatus = pdFAIL;
|
xQueueSetTasksStatus = pdFAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if( configUSE_PREEMPTION == 0 )
|
||||||
|
taskYIELD();
|
||||||
|
#endif
|
||||||
|
|
||||||
ulTaskTxValue++;
|
ulTaskTxValue++;
|
||||||
|
|
||||||
/* If the Tx value has reached the range used by the ISR then set it
|
/* If the Tx value has reached the range used by the ISR then set it
|
||||||
|
|
|
@ -257,6 +257,11 @@ unsigned portBASE_TYPE uxOurPriority;
|
||||||
( *pulCounter )++;
|
( *pulCounter )++;
|
||||||
}
|
}
|
||||||
vTaskPrioritySet( NULL, uxOurPriority );
|
vTaskPrioritySet( NULL, uxOurPriority );
|
||||||
|
|
||||||
|
#if( configUSE_PREEMPTION == 0 )
|
||||||
|
taskYIELD();
|
||||||
|
#endif
|
||||||
|
|
||||||
configASSERT( ( uxTaskPriorityGet( NULL ) == uxOurPriority ) );
|
configASSERT( ( uxTaskPriorityGet( NULL ) == uxOurPriority ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -300,6 +305,10 @@ short sError = pdFALSE;
|
||||||
}
|
}
|
||||||
vTaskResume( xContinuousIncrementHandle );
|
vTaskResume( xContinuousIncrementHandle );
|
||||||
|
|
||||||
|
#if( configUSE_PREEMPTION == 0 )
|
||||||
|
taskYIELD();
|
||||||
|
#endif
|
||||||
|
|
||||||
#if( INCLUDE_eTaskGetState == 1 )
|
#if( INCLUDE_eTaskGetState == 1 )
|
||||||
{
|
{
|
||||||
configASSERT( eTaskGetState( xContinuousIncrementHandle ) == eReady );
|
configASSERT( eTaskGetState( xContinuousIncrementHandle ) == eReady );
|
||||||
|
@ -344,6 +353,10 @@ short sError = pdFALSE;
|
||||||
task has suspended itself with a known value in the counter variable. */
|
task has suspended itself with a known value in the counter variable. */
|
||||||
vTaskResume( xLimitedIncrementHandle );
|
vTaskResume( xLimitedIncrementHandle );
|
||||||
|
|
||||||
|
#if( configUSE_PREEMPTION == 0 )
|
||||||
|
taskYIELD();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This task should not run again until xLimitedIncrementHandle has
|
/* This task should not run again until xLimitedIncrementHandle has
|
||||||
suspended itself. */
|
suspended itself. */
|
||||||
#if( INCLUDE_eTaskGetState == 1 )
|
#if( INCLUDE_eTaskGetState == 1 )
|
||||||
|
@ -368,6 +381,10 @@ short sError = pdFALSE;
|
||||||
|
|
||||||
/* Resume the continuous count task and do it all again. */
|
/* Resume the continuous count task and do it all again. */
|
||||||
vTaskResume( xContinuousIncrementHandle );
|
vTaskResume( xContinuousIncrementHandle );
|
||||||
|
|
||||||
|
#if( configUSE_PREEMPTION == 0 )
|
||||||
|
taskYIELD();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
Loading…
Reference in a new issue