|
|
|
@ -340,6 +340,9 @@ SYSTEM_INFO xSystemInfo;
|
|
|
|
|
/* Start the first task. */
|
|
|
|
|
ResumeThread( pxThreadState->pvThread );
|
|
|
|
|
|
|
|
|
|
/* The scheduler is now running. */
|
|
|
|
|
xPortRunning = pdTRUE;
|
|
|
|
|
|
|
|
|
|
/* Handle all simulated interrupts - including yield requests and
|
|
|
|
|
simulated ticks. */
|
|
|
|
|
prvProcessSimulatedInterrupts();
|
|
|
|
@ -376,6 +379,8 @@ uint32_t ulSwitchRequired, i;
|
|
|
|
|
ThreadState_t *pxThreadState;
|
|
|
|
|
void *pvObjectList[ 2 ];
|
|
|
|
|
CONTEXT xContext;
|
|
|
|
|
DWORD xWinApiResult;
|
|
|
|
|
const DWORD xTimeoutMilliseconds = 1000;
|
|
|
|
|
|
|
|
|
|
/* Going to block on the mutex that ensured exclusive access to the simulated
|
|
|
|
|
interrupt objects, and the event that signals that a simulated interrupt
|
|
|
|
@ -388,13 +393,16 @@ CONTEXT xContext;
|
|
|
|
|
ulPendingInterrupts |= ( 1 << portINTERRUPT_TICK );
|
|
|
|
|
SetEvent( pvInterruptEvent );
|
|
|
|
|
|
|
|
|
|
xPortRunning = pdTRUE;
|
|
|
|
|
|
|
|
|
|
for(;;)
|
|
|
|
|
while( xPortRunning == pdTRUE )
|
|
|
|
|
{
|
|
|
|
|
xInsideInterrupt = pdFALSE;
|
|
|
|
|
WaitForMultipleObjects( sizeof( pvObjectList ) / sizeof( void * ), pvObjectList, TRUE, INFINITE );
|
|
|
|
|
|
|
|
|
|
/* Wait with timeout so that we can exit from this loop when
|
|
|
|
|
* the scheduler is stopped by calling vPortEndScheduler. */
|
|
|
|
|
xWinApiResult = WaitForMultipleObjects( sizeof( pvObjectList ) / sizeof( void * ), pvObjectList, TRUE, xTimeoutMilliseconds );
|
|
|
|
|
|
|
|
|
|
if( xWinApiResult != WAIT_TIMEOUT )
|
|
|
|
|
{
|
|
|
|
|
/* Cannot be in a critical section to get here. Tasks that exit a
|
|
|
|
|
critical section will block on a yield mutex to wait for an interrupt to
|
|
|
|
|
process if an interrupt was set pending while the task was inside the
|
|
|
|
@ -488,6 +496,7 @@ CONTEXT xContext;
|
|
|
|
|
SetEvent( pxThreadState->pvYieldEvent );
|
|
|
|
|
ReleaseMutex( pvInterruptEventMutex );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/*-----------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|