2 FreeRTOS V6.1.0 - Copyright (C) 2010 Real Time Engineers Ltd.
\r
4 ***************************************************************************
\r
8 * + New to FreeRTOS, *
\r
9 * + Wanting to learn FreeRTOS or multitasking in general quickly *
\r
10 * + Looking for basic training, *
\r
11 * + Wanting to improve your FreeRTOS skills and productivity *
\r
13 * then take a look at the FreeRTOS books - available as PDF or paperback *
\r
15 * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
\r
16 * http://www.FreeRTOS.org/Documentation *
\r
18 * A pdf reference manual is also available. Both are usually delivered *
\r
19 * to your inbox within 20 minutes to two hours when purchased between 8am *
\r
20 * and 8pm GMT (although please allow up to 24 hours in case of *
\r
21 * exceptional circumstances). Thank you for your support! *
\r
23 ***************************************************************************
\r
25 This file is part of the FreeRTOS distribution.
\r
27 FreeRTOS is free software; you can redistribute it and/or modify it under
\r
28 the terms of the GNU General Public License (version 2) as published by the
\r
29 Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
\r
30 ***NOTE*** The exception to the GPL is included to allow you to distribute
\r
31 a combined work that includes FreeRTOS without being obliged to provide the
\r
32 source code for proprietary components outside of the FreeRTOS kernel.
\r
33 FreeRTOS is distributed in the hope that it will be useful, but WITHOUT
\r
34 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
\r
35 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
\r
36 more details. You should have received a copy of the GNU General Public
\r
37 License and the FreeRTOS license exception along with FreeRTOS; if not it
\r
38 can be viewed here: http://www.freertos.org/a00114.html and also obtained
\r
39 by writing to Richard Barry, contact details for whom are available on the
\r
44 http://www.FreeRTOS.org - Documentation, latest information, license and
\r
47 http://www.SafeRTOS.com - A version that is certified for use in safety
\r
50 http://www.OpenRTOS.com - Commercial support, development, porting,
\r
51 licensing and training services.
\r
54 /* Scheduler includes. */
\r
55 #include "FreeRTOS.h"
\r
63 typedef struct xTaskControlBlock
\r
65 volatile portSTACK_TYPE *pxTopOfStack; /*< Points to the location of the last item placed on the tasks stack. THIS MUST BE THE FIRST MEMBER OF THE STRUCT. */
\r
67 #if ( portUSING_MPU_WRAPPERS == 1 )
\r
68 xMPU_SETTINGS xMPUSettings; /*< The MPU settings are defined as part of the port layer. THIS MUST BE THE SECOND MEMBER OF THE STRUCT. */
\r
71 xListItem xGenericListItem; /*< List item used to place the TCB in ready and blocked queues. */
\r
72 xListItem xEventListItem; /*< List item used to place the TCB in event lists. */
\r
73 unsigned portBASE_TYPE uxPriority; /*< The priority of the task where 0 is the lowest priority. */
\r
74 portSTACK_TYPE *pxStack; /*< Points to the start of the stack. */
\r
75 signed char pcTaskName[ configMAX_TASK_NAME_LEN ];/*< Descriptive name given to the task when created. Facilitates debugging only. */
\r
77 #if ( portSTACK_GROWTH > 0 )
\r
78 portSTACK_TYPE *pxEndOfStack; /*< Used for stack overflow checking on architectures where the stack grows up from low memory. */
\r
81 #if ( portCRITICAL_NESTING_IN_TCB == 1 )
\r
82 unsigned portBASE_TYPE uxCriticalNesting;
\r
85 #if ( configUSE_TRACE_FACILITY == 1 )
\r
86 unsigned portBASE_TYPE uxTCBNumber; /*< This is used for tracing the scheduler and making debugging easier only. */
\r
89 #if ( configUSE_MUTEXES == 1 )
\r
90 unsigned portBASE_TYPE uxBasePriority; /*< The priority last assigned to the task - used by the priority inheritance mechanism. */
\r
93 #if ( configUSE_APPLICATION_TASK_TAG == 1 )
\r
94 pdTASK_HOOK_CODE pxTaskTag;
\r
97 #if ( configGENERATE_RUN_TIME_STATS == 1 )
\r
98 unsigned long ulRunTimeCounter; /*< Used for calculating how much CPU time each task is utilising. */
\r
111 FILE *pfTraceFile = NULL;
\r
112 //#define vPortTrace( x ) if( pfTraceFile == NULL ) pfTraceFile = fopen( "c:/temp/trace.txt", "w" ); if( pfTraceFile != NULL ) fprintf( pfTraceFile, x )
\r
113 #define vPortTrace( x ) ( void ) x
\r
115 #define portMAX_INTERRUPTS ( ( unsigned long ) sizeof( unsigned long ) * 8UL ) /* The number of bits in an unsigned long. */
\r
116 #define portNO_CRITICAL_NESTING ( ( unsigned long ) 0 )
\r
119 * Created as a high priority thread, this function uses a timer to simulate
\r
120 * a tick interrupt being generated on an embedded target. In this Windows
\r
121 * environment the timer does not achieve real time performance though.
\r
123 static DWORD WINAPI prvSimulatedPeripheralTimer( LPVOID lpParameter );
\r
126 * Process all the simulated interrupts - each represented by a bit in
\r
127 * ulPendingInterrupts variable.
\r
129 static void prvProcessEvents( void );
\r
131 /*-----------------------------------------------------------*/
\r
133 /* The WIN32 simulator runs each task in a thread. The context switching is
\r
134 managed by the threads, so the task stack does not have to be managed directly,
\r
135 although the task stack is still used to hold an xThreadState structure this is
\r
136 the only thing it will ever hold. The structure indirectly maps the task handle
\r
137 to a thread handle. */
\r
140 portSTACK_TYPE ulCriticalNesting; /* Critical nesting count of the task. */
\r
141 void * pvThread; /* Handle of the thread that executes the task. */
\r
144 /* The parameters passed to a thread when it is created. */
\r
145 typedef struct XPARAMS
\r
147 pdTASK_CODE pxCode; /* The entry point of the task (rather than thread) code. */
\r
148 void *pvParameters; /* The parameters that are passed to the task (rather than thread. */
\r
151 /* Pseudo interrupts waiting to be processed. This is a bit mask where each
\r
152 bit represents one interrupt, so a maximum of 32 interrupts can be simulated. */
\r
153 static volatile unsigned long ulPendingInterrupts = 0UL;
\r
155 /* An event used to inform the interrupt dispatch thread (a high priority thread
\r
156 that simulated interrupt processing) that an IRQ or SWI type interrupt is
\r
158 static void *pvInterruptEvent = NULL;
\r
160 /* Mutex used to protect all the pseudo interrupt variables that are accessed by
\r
161 multiple threads. */
\r
162 static void *pvInterruptEventMutex = NULL;
\r
164 /* The main thread, which also acts as the pseudo interrupt handler. */
\r
165 static void *pvMainThreadAndInterrupHandler;
\r
167 /* Events used to manage sequencing. */
\r
168 static void *pvTickAcknowledgeEvent = NULL, *pvInterruptAcknowledgeEvent = NULL;
\r
170 /* The critical nesting count for the currently executing task. This is
\r
171 initialised to a non-zero value so interrupts do not become enabled during
\r
172 the initialisation phase. As each task has its own critical nesting value
\r
173 ulCriticalNesting will get set to zero when the first task runs. This
\r
174 initialisation is probably not critical in this simulated environment as the
\r
175 pseudo interrupt handlers/dispatchers do not get created until the FreeRTOS
\r
176 scheduler is started. */
\r
177 static unsigned portLONG ulCriticalNesting = 9999UL;
\r
179 /* Handlers for all the simulated software interrupts. The first two positions
\r
180 are used for the Yield and Tick interrupts so are handled slightly differently,
\r
181 all the other interrupts can be user defined. */
\r
182 static void (*vIsrHandler[ portMAX_INTERRUPTS ])( void ) = { 0 };
\r
184 /* Pointer to the TCB of the currently executing task. */
\r
185 extern void *pxCurrentTCB;
\r
187 /*-----------------------------------------------------------*/
\r
189 static DWORD WINAPI prvSimulatedPeripheralTimer( LPVOID lpParameter )
\r
192 LARGE_INTEGER liDueTime;
\r
193 void *pvObjectList[ 2 ];
\r
194 const long long ll_ms_In_100ns_units = ( long long ) -1000;
\r
195 extern volatile unsigned long ulTicks;
\r
197 /* Just to prevent compiler warnings. */
\r
198 ( void ) lpParameter;
\r
200 /* The timer is created as a one shot timer even though we want it to repeat
\r
201 at a given frequency. This is because Windows is not a real time environment,
\r
202 and attempting to set a high frequency periodic timer will result in event
\r
203 overruns. Therefore the timer is just reset after each time the pseudo
\r
204 interrupt handler has processed each tick event. */
\r
205 pvTimer = CreateWaitableTimer( NULL, TRUE, NULL );
\r
207 liDueTime.QuadPart = ( long long ) portTICK_RATE_MS * ll_ms_In_100ns_units;
\r
209 /* Block on the timer itself and the event mutex that grants access to the
\r
210 interrupt variables. */
\r
211 pvObjectList[ 0 ] = pvInterruptEventMutex;
\r
212 pvObjectList[ 1 ] = pvTimer;
\r
218 /* The timer is reset on each itteration of this loop rather than being set
\r
219 to function periodicallys - this is for the reasons stated in the comments
\r
220 where the timer is created. */
\r
221 vPortTrace( "prvSimulatedPeripheralTimer: Tick acked, setting new tick timer\r\n" );
\r
222 SetWaitableTimer( pvTimer, &liDueTime, 0, NULL, NULL, TRUE );
\r
224 /* Wait until the timer expires and we can access the pseudo interrupt
\r
226 //WaitForMultipleObjects( ( sizeof( pvObjectList ) / sizeof( void * ) ), pvObjectList, TRUE, INFINITE );
\r
227 WaitForSingleObject( pvTimer, INFINITE );
\r
228 vPortTrace( "prvSimulatedPeripheralTimer: Timer signalled, waiting interrupt event mutex\r\n" );
\r
229 WaitForSingleObject( pvInterruptEventMutex, INFINITE );
\r
230 vPortTrace( "prvSimulatedPeripheralTimer: Got interrupt event mutex\r\n" );
\r
232 /* The timer has expired, generate the simulated tick event. */
\r
233 ulPendingInterrupts |= ( 1 << portINTERRUPT_TICK );
\r
234 if( pvInterruptEvent != NULL )
\r
236 vPortTrace( "prvSimulatedPeripheralTimer: Setting interrupt event to signal tick\r\n" );
\r
237 SetEvent( pvInterruptEvent );
\r
240 /* Give back the mutex so the pseudo interrupt handler unblocks and can
\r
241 access the interrupt handler variables. This high priority task will then
\r
242 loop back round to wait for the lower priority psuedo interrupt handler
\r
243 thread to acknowledge the tick. */
\r
244 if( pvInterruptEventMutex != NULL )
\r
246 vPortTrace( "prvSimulatedPeripheralTimer: Releasing interrupt event mutex so tick can be processed\r\n" );
\r
247 ReleaseMutex( pvInterruptEventMutex );
\r
250 /* Wait for the previous tick to be acknowledged before resetting the timer.
\r
251 As mentioned above this is done to prevent timer overruns in the non real-
\r
252 time environment. THIS IS NOT HOW A REAL PORT SHOULD USE TIMERS! */
\r
253 WaitForSingleObject( pvTickAcknowledgeEvent, INFINITE );
\r
256 /*-----------------------------------------------------------*/
\r
258 portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
\r
260 xThreadState *pxThreadState = NULL;
\r
261 xParams *pxThreadParams = ( void * ) pvPortMalloc( sizeof( xParams ) );
\r
263 if( pxThreadParams != NULL )
\r
265 /* In this simulated case a stack is not initialised, but instead a thread
\r
266 is created that will execute the task being created. The thread handles
\r
267 the context switching itself. The xThreadState object is placed onto
\r
268 the stack that was created for the task - so the stack buffer is still
\r
269 used, just not in the conventional way. It will not be used for anything
\r
270 other than holding this structure. */
\r
271 pxThreadState = ( xThreadState * ) ( pxTopOfStack - sizeof( xThreadState ) );
\r
273 /* The parameters that are passed into the thread so it knows how to
\r
274 start the task executing. */
\r
275 pxThreadParams->pxCode = pxCode;
\r
276 pxThreadParams->pvParameters = pvParameters;
\r
278 /* Create the thread itself. */
\r
279 //pxThreadState->pvThread = ( void * ) CreateThread( NULL, 0, ( LPTHREAD_START_ROUTINE ) prvThreadEntryPoint, pxThreadParams, CREATE_SUSPENDED, NULL );
\r
280 pxThreadState->pvThread = ( void * ) CreateThread( NULL, 0, ( LPTHREAD_START_ROUTINE ) pxCode, pvParameters, CREATE_SUSPENDED, NULL );
\r
281 pxThreadState->ulCriticalNesting = portNO_CRITICAL_NESTING;
\r
282 SetThreadPriority( pxThreadState->pvThread, THREAD_PRIORITY_IDLE );
\r
285 return ( portSTACK_TYPE * ) pxThreadState;
\r
287 /*-----------------------------------------------------------*/
\r
289 portBASE_TYPE xPortStartScheduler( void )
\r
292 long lSuccess = pdPASS;
\r
293 xThreadState *pxThreadState;
\r
295 /* Set the priority of this thread such that it is above the priority of the
\r
296 threads that run tasks, but below the priority of the thread that generates
\r
297 the pseudo tick interrupts. This priority is chosen because this is the
\r
298 thread that actually handles the psuedo interrupts. */
\r
299 pvHandle = GetCurrentThread();
\r
300 if( pvHandle == NULL )
\r
305 if( lSuccess == pdPASS )
\r
307 if( SetThreadPriority( pvHandle, THREAD_PRIORITY_BELOW_NORMAL ) == 0 )
\r
313 if( lSuccess == pdPASS )
\r
315 /* Create the events and mutexes that are used to synchronise all the
\r
317 pvInterruptEventMutex = CreateMutex( NULL, FALSE, NULL );
\r
318 pvInterruptEvent = CreateEvent( NULL, FALSE, FALSE, NULL );
\r
319 pvTickAcknowledgeEvent = CreateEvent( NULL, FALSE, FALSE, NULL );
\r
320 pvInterruptAcknowledgeEvent = CreateEvent( NULL, FALSE, FALSE, NULL );
\r
322 /* Start the thread that simulates the timer peripheral to generate
\r
323 tick interrupts. */
\r
324 pvHandle = CreateThread( NULL, 0, prvSimulatedPeripheralTimer, NULL, 0, NULL );
\r
325 if( pvHandle != NULL )
\r
327 SetThreadPriority( pvHandle, THREAD_PRIORITY_ABOVE_NORMAL );
\r
330 /* Start the highest priority task by obtaining its associated thread state
\r
331 structure, in which is stored the thread handle. */
\r
332 pxThreadState = ( xThreadState * ) *( ( unsigned long * ) pxCurrentTCB );
\r
333 ulCriticalNesting = portNO_CRITICAL_NESTING;
\r
335 vPortTrace( "Created system threads, starting task" );
\r
337 ResumeThread( pxThreadState->pvThread );
\r
340 /* Handle all pseudo interrupts - including yield requests and simulated ticks. */
\r
341 prvProcessEvents();
\r
343 /* Would not expect to return from prvProcessEvents(), so should not get here. */
\r
346 /*-----------------------------------------------------------*/
\r
348 static void prvProcessEvents( void )
\r
350 long lSwitchRequired, lAcknowledgeTick, lAcknowledgeInterrupt;
\r
351 xThreadState *pxThreadState;
\r
352 void *pvObjectList[ 2 ];
\r
354 char cTraceBuffer[ 256 ];
\r
356 vPortTrace( "Entering prvProcessEvents\r\n" );
\r
358 /* Going to block on the mutex that ensured exclusive access to the pdeudo
\r
359 interrupt objects, and the event that signals that an interrupt is waiting
\r
360 to be processed. */
\r
361 pvObjectList[ 0 ] = pvInterruptEventMutex;
\r
362 pvObjectList[ 1 ] = pvInterruptEvent;
\r
366 vPortTrace( "prvProcessEvents: Waiting for next interrupt event\r\n" );
\r
367 WaitForMultipleObjects( sizeof( pvObjectList ) / sizeof( void * ), pvObjectList, TRUE, INFINITE );
\r
368 vPortTrace( "prvProcessEvents: Got interrupt event and mutex\r\n" );
\r
369 //vPortTrace( "prvProcessEvents: Waiting for next interrupt event\r\n" );
\r
370 //WaitForSingleObject( pvInterruptEvent, INFINITE );
\r
371 //vPortTrace( "prvProcessEvents: Waiting interrupt event mutex to access interrupt data\r\n" );
\r
372 //WaitForSingleObject( pvInterruptEventMutex, INFINITE );
\r
374 lSwitchRequired = pdFALSE;
\r
375 lAcknowledgeTick = pdFALSE;
\r
376 lAcknowledgeInterrupt = pdFALSE;
\r
378 /* For each interrupt we are interested in processing, each of which is
\r
379 represented by a bit in the 32bit ulPendingInterrupts variable. */
\r
380 for( i = 0; i < portMAX_INTERRUPTS; i++ )
\r
382 /* Is the pseudo interrupt pending? */
\r
383 if( ulPendingInterrupts & ( 1UL << i ) )
\r
387 case portINTERRUPT_YIELD:
\r
389 vPortTrace( "prvProcessEvents: Processing Yield\r\n" );
\r
390 /* Yield interrupts occur no matter what the critical nesting count. */
\r
391 lSwitchRequired = pdTRUE;
\r
393 /* Clear the interrupt pending bit. */
\r
394 ulPendingInterrupts &= ~( 1UL << portINTERRUPT_YIELD );
\r
396 lAcknowledgeInterrupt = pdTRUE;
\r
399 case portINTERRUPT_TICK:
\r
401 /* Tick interrupts should only be processed if the critical nesting count
\r
402 is zero. The critical nesting count represents the interrupt mask on
\r
403 real target hardware. */
\r
404 vPortTrace( "prvProcessEvents: Processing tick event\r\n" );
\r
405 if( ulCriticalNesting == 0 )
\r
407 /* Process the tick itself. */
\r
408 vPortTrace( "prvProcessEvents: Incrementing tick\r\n" );
\r
409 vTaskIncrementTick();
\r
410 #if( configUSE_PREEMPTION != 0 )
\r
412 /* A context switch is only automatically performed from the tick
\r
413 interrupt if the pre-emptive scheduler is being used. */
\r
414 lSwitchRequired = pdTRUE;
\r
418 lAcknowledgeTick = pdTRUE;
\r
420 /* Clear the interrupt pending bit. */
\r
421 ulPendingInterrupts &= ~( 1UL << portINTERRUPT_TICK );
\r
427 /* Is a handler installed? */
\r
428 if( vIsrHandler[ i ] != NULL )
\r
430 lSwitchRequired = pdTRUE;
\r
432 /* Run the actual handler. */
\r
433 vIsrHandler[ i ]();
\r
435 /* Clear the interrupt pending bit. */
\r
436 ulPendingInterrupts &= ~( 1UL << i );
\r
438 lAcknowledgeInterrupt = pdTRUE;
\r
445 if( lSwitchRequired != pdFALSE )
\r
447 void *pvOldCurrentTCB;
\r
449 pvOldCurrentTCB = pxCurrentTCB;
\r
451 /* Save the state of the current thread before suspending it. */
\r
452 pxThreadState = ( xThreadState *) *( ( unsigned long * ) pxCurrentTCB );
\r
453 pxThreadState->ulCriticalNesting = ulCriticalNesting ;
\r
455 /* Select the next task to run. */
\r
456 vTaskSwitchContext();
\r
458 /* If the task selected to enter the running state is not the task
\r
459 that is already in the running state. */
\r
460 if( pvOldCurrentTCB != pxCurrentTCB )
\r
462 /* Suspend the old thread. */
\r
463 SuspendThread( pxThreadState->pvThread );
\r
464 sprintf( cTraceBuffer, "Event processor: suspending %s, resuming %s\r\n", ((xTCB*)pvOldCurrentTCB)->pcTaskName, ((xTCB*)pxCurrentTCB)->pcTaskName );
\r
465 vPortTrace( cTraceBuffer );
\r
467 /* Obtain the state of the task now selected to enter the Running state. */
\r
468 pxThreadState = ( xThreadState * ) ( *( unsigned long *) pxCurrentTCB );
\r
469 ulCriticalNesting = pxThreadState->ulCriticalNesting;
\r
470 ResumeThread( pxThreadState->pvThread );
\r
474 /* Was a tick processed? */
\r
475 if( lAcknowledgeTick != pdFALSE )
\r
477 vPortTrace( "prvProcessEvents: Acking tick\r\n" );
\r
478 SetEvent( pvTickAcknowledgeEvent );
\r
481 if( lAcknowledgeInterrupt != pdFALSE )
\r
483 vPortTrace( "prvProcessEvents: Acking interrupt\r\n" );
\r
484 SetEvent( pvInterruptAcknowledgeEvent );
\r
487 ReleaseMutex( pvInterruptEventMutex );
\r
490 /*-----------------------------------------------------------*/
\r
492 void vPortEndScheduler( void )
\r
495 /*-----------------------------------------------------------*/
\r
497 void vPortGeneratePseudoInterrupt( unsigned long ulInterruptNumber )
\r
499 if( ( ulInterruptNumber < portMAX_INTERRUPTS ) && ( pvInterruptEventMutex != NULL ) )
\r
501 /* Yield interrupts are processed even when critical nesting is non-zero. */
\r
502 if( ( ulCriticalNesting == 0 ) || ( ulInterruptNumber == portINTERRUPT_YIELD ) )
\r
504 /* In case this task has just started running, reset the interrupt
\r
505 acknowledge event as it might have been set due to the activities
\r
506 of a thread that has already been executed and suspended. */
\r
507 ResetEvent( pvInterruptAcknowledgeEvent );
\r
509 WaitForSingleObject( pvInterruptEventMutex, INFINITE );
\r
510 ulPendingInterrupts |= ( 1 << ulInterruptNumber );
\r
511 vPortTrace( "vPortGeneratePseudoInterrupt: Got interrupt mutex, about to signal interrupt event\r\n" );
\r
512 SetEvent( pvInterruptEvent );
\r
513 vPortTrace( "vPortGeneratePseudoInterrupt: About to release interrupt event mutex\r\n" );
\r
514 ReleaseMutex( pvInterruptEventMutex );
\r
515 vPortTrace( "vPortGeneratePseudoInterrupt: Interrupt event mutex released, going to wait for next interrupt input\r\n" );
\r
517 WaitForSingleObject( pvInterruptAcknowledgeEvent, INFINITE );
\r
518 vPortTrace( "vPortGeneratePseudoInterrupt: Interrupt acknowledged, leaving vPortGeneratePseudoInterrupt()\r\n" );
\r
522 /*-----------------------------------------------------------*/
\r
524 void vPortSetInterruptHandler( unsigned long ulInterruptNumber, void (*pvHandler)( void ) )
\r
526 if( ulInterruptNumber < portMAX_INTERRUPTS )
\r
528 if( pvInterruptEventMutex != NULL )
\r
530 WaitForSingleObject( pvInterruptEventMutex, INFINITE );
\r
531 vIsrHandler[ ulInterruptNumber ] = pvHandler;
\r
532 ReleaseMutex( pvInterruptEventMutex );
\r
536 vIsrHandler[ ulInterruptNumber ] = pvHandler;
\r
540 /*-----------------------------------------------------------*/
\r
542 void vPortEnterCritical( void )
\r
544 ulCriticalNesting++;
\r
546 /*-----------------------------------------------------------*/
\r
548 void vPortExitCritical( void )
\r
550 if( ulCriticalNesting > portNO_CRITICAL_NESTING )
\r
552 ulCriticalNesting--;
\r
554 if( ulCriticalNesting == 0 )
\r
556 /* Were any interrupts set to pending while interrupts were
\r
557 (pseudo) disabled? */
\r
558 if( ulPendingInterrupts != 0UL )
\r
560 WaitForSingleObject( pvInterruptEventMutex, INFINITE );
\r
561 vPortTrace( "vPortExitCritical: Setting interrupt event\r\n" );
\r
562 SetEvent( pvInterruptEvent );
\r
563 ReleaseMutex( pvInterruptEventMutex );
\r
565 vPortTrace( "vPortExitCritical: Waiting interrupt ack\r\n" );
\r
566 WaitForSingleObject( pvInterruptAcknowledgeEvent, INFINITE );
\r
567 vPortTrace( "vPortExitCritical: Interrupt acknowledged, leaving critical section code\r\n" );
\r
569 /* Just in case the Yield does not happen immediately. This
\r
570 line could be dangerious if not all interrupts are being
\r
572 // while( ulPendingInterrupts != 0UL );
\r