2 FreeRTOS V9.0.0rc1 - Copyright (C) 2016 Real Time Engineers Ltd.
\r
5 VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
\r
7 This file is part of the FreeRTOS distribution.
\r
9 FreeRTOS is free software; you can redistribute it and/or modify it under
\r
10 the terms of the GNU General Public License (version 2) as published by the
\r
11 Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
\r
13 ***************************************************************************
\r
14 >>! NOTE: The modification to the GPL is included to allow you to !<<
\r
15 >>! distribute a combined work that includes FreeRTOS without being !<<
\r
16 >>! obliged to provide the source code for proprietary components !<<
\r
17 >>! outside of the FreeRTOS kernel. !<<
\r
18 ***************************************************************************
\r
20 FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
\r
21 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
\r
22 FOR A PARTICULAR PURPOSE. Full license text is available on the following
\r
23 link: http://www.freertos.org/a00114.html
\r
25 ***************************************************************************
\r
27 * FreeRTOS provides completely free yet professionally developed, *
\r
28 * robust, strictly quality controlled, supported, and cross *
\r
29 * platform software that is more than just the market leader, it *
\r
30 * is the industry's de facto standard. *
\r
32 * Help yourself get started quickly while simultaneously helping *
\r
33 * to support the FreeRTOS project by purchasing a FreeRTOS *
\r
34 * tutorial book, reference manual, or both: *
\r
35 * http://www.FreeRTOS.org/Documentation *
\r
37 ***************************************************************************
\r
39 http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
\r
40 the FAQ page "My application does not run, what could be wrong?". Have you
\r
41 defined configASSERT()?
\r
43 http://www.FreeRTOS.org/support - In return for receiving this top quality
\r
44 embedded software for free we request you assist our global community by
\r
45 participating in the support forum.
\r
47 http://www.FreeRTOS.org/training - Investing in training allows your team to
\r
48 be as productive as possible as early as possible. Now you can receive
\r
49 FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
\r
50 Ltd, and the world's leading authority on the world's leading RTOS.
\r
52 http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
\r
53 including FreeRTOS+Trace - an indispensable productivity tool, a DOS
\r
54 compatible FAT file system, and our tiny thread aware UDP/IP stack.
\r
56 http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
\r
57 Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
\r
59 http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
\r
60 Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
\r
61 licenses offer ticketed support, indemnification and commercial middleware.
\r
63 http://www.SafeRTOS.com - High Integrity Systems also provide a safety
\r
64 engineered and independently SIL3 certified version for use in safety and
\r
65 mission critical applications that require provable dependability.
\r
70 /* Standard includes. */
\r
73 /* Scheduler includes. */
\r
74 #include "FreeRTOS.h"
\r
78 #include "mmsystem.h"
\r
80 #pragma comment(lib, "winmm.lib")
\r
83 #define portMAX_INTERRUPTS ( ( uint32_t ) sizeof( uint32_t ) * 8UL ) /* The number of bits in an uint32_t. */
\r
84 #define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 )
\r
86 /* The priorities at which the various components of the simulation execute.
\r
87 Priorities are higher when a soak test is performed to lessen the effect of
\r
88 Windows interfering with the timing. */
\r
89 #define portSOAK_TEST
\r
90 #ifndef portSOAK_TEST
\r
91 #define portSIMULATED_INTERRUPTS_THREAD_PRIORITY THREAD_PRIORITY_NORMAL
\r
92 #define portSIMULATED_TIMER_THREAD_PRIORITY THREAD_PRIORITY_BELOW_NORMAL
\r
93 #define portTASK_THREAD_PRIORITY THREAD_PRIORITY_IDLE
\r
95 #define portSIMULATED_INTERRUPTS_THREAD_PRIORITY THREAD_PRIORITY_TIME_CRITICAL
\r
96 #define portSIMULATED_TIMER_THREAD_PRIORITY THREAD_PRIORITY_HIGHEST
\r
97 #define portTASK_THREAD_PRIORITY THREAD_PRIORITY_ABOVE_NORMAL
\r
100 * Created as a high priority thread, this function uses a timer to simulate
\r
101 * a tick interrupt being generated on an embedded target. In this Windows
\r
102 * environment the timer does not achieve anything approaching real time
\r
103 * performance though.
\r
105 static DWORD WINAPI prvSimulatedPeripheralTimer( LPVOID lpParameter );
\r
108 * Process all the simulated interrupts - each represented by a bit in
\r
109 * ulPendingInterrupts variable.
\r
111 static void prvProcessSimulatedInterrupts( void );
\r
114 * Interrupt handlers used by the kernel itself. These are executed from the
\r
115 * simulated interrupt handler thread.
\r
117 static uint32_t prvProcessYieldInterrupt( void );
\r
118 static uint32_t prvProcessTickInterrupt( void );
\r
121 * Called when the process exits to let Windows know the high timer resolution
\r
122 * is no longer required.
\r
124 static BOOL WINAPI prvEndProcess( DWORD dwCtrlType );
\r
126 /*-----------------------------------------------------------*/
\r
128 /* The WIN32 simulator runs each task in a thread. The context switching is
\r
129 managed by the threads, so the task stack does not have to be managed directly,
\r
130 although the task stack is still used to hold an xThreadState structure this is
\r
131 the only thing it will ever hold. The structure indirectly maps the task handle
\r
132 to a thread handle. */
\r
135 /* Handle of the thread that executes the task. */
\r
140 /* Simulated interrupts waiting to be processed. This is a bit mask where each
\r
141 bit represents one interrupt, so a maximum of 32 interrupts can be simulated. */
\r
142 static volatile uint32_t ulPendingInterrupts = 0UL;
\r
144 /* An event used to inform the simulated interrupt processing thread (a high
\r
145 priority thread that simulated interrupt processing) that an interrupt is
\r
147 static void *pvInterruptEvent = NULL;
\r
149 /* Mutex used to protect all the simulated interrupt variables that are accessed
\r
150 by multiple threads. */
\r
151 static void *pvInterruptEventMutex = NULL;
\r
153 /* The critical nesting count for the currently executing task. This is
\r
154 initialised to a non-zero value so interrupts do not become enabled during
\r
155 the initialisation phase. As each task has its own critical nesting value
\r
156 ulCriticalNesting will get set to zero when the first task runs. This
\r
157 initialisation is probably not critical in this simulated environment as the
\r
158 simulated interrupt handlers do not get created until the FreeRTOS scheduler is
\r
160 static uint32_t ulCriticalNesting = 9999UL;
\r
162 /* Handlers for all the simulated software interrupts. The first two positions
\r
163 are used for the Yield and Tick interrupts so are handled slightly differently,
\r
164 all the other interrupts can be user defined. */
\r
165 static uint32_t (*ulIsrHandler[ portMAX_INTERRUPTS ])( void ) = { 0 };
\r
167 /* Pointer to the TCB of the currently executing task. */
\r
168 extern void *pxCurrentTCB;
\r
170 /* Used to ensure nothing is processed during the startup sequence. */
\r
171 static BaseType_t xPortRunning = pdFALSE;
\r
173 /*-----------------------------------------------------------*/
\r
175 static DWORD WINAPI prvSimulatedPeripheralTimer( LPVOID lpParameter )
\r
177 TickType_t xMinimumWindowsBlockTime;
\r
178 TIMECAPS xTimeCaps;
\r
180 /* Set the timer resolution to the maximum possible. */
\r
181 if( timeGetDevCaps( &xTimeCaps, sizeof( xTimeCaps ) ) == MMSYSERR_NOERROR )
\r
183 xMinimumWindowsBlockTime = ( TickType_t ) xTimeCaps.wPeriodMin;
\r
184 timeBeginPeriod( xTimeCaps.wPeriodMin );
\r
186 /* Register an exit handler so the timeBeginPeriod() function can be
\r
187 matched with a timeEndPeriod() when the application exits. */
\r
188 SetConsoleCtrlHandler( prvEndProcess, TRUE );
\r
192 xMinimumWindowsBlockTime = ( TickType_t ) 20;
\r
195 /* Just to prevent compiler warnings. */
\r
196 ( void ) lpParameter;
\r
200 /* Wait until the timer expires and we can access the simulated interrupt
\r
201 variables. *NOTE* this is not a 'real time' way of generating tick
\r
202 events as the next wake time should be relative to the previous wake
\r
203 time, not the time that Sleep() is called. It is done this way to
\r
204 prevent overruns in this very non real time simulated/emulated
\r
206 if( portTICK_PERIOD_MS < xMinimumWindowsBlockTime )
\r
208 Sleep( xMinimumWindowsBlockTime );
\r
212 Sleep( portTICK_PERIOD_MS );
\r
215 configASSERT( xPortRunning );
\r
217 WaitForSingleObject( pvInterruptEventMutex, INFINITE );
\r
219 /* The timer has expired, generate the simulated tick event. */
\r
220 ulPendingInterrupts |= ( 1 << portINTERRUPT_TICK );
\r
222 /* The interrupt is now pending - notify the simulated interrupt
\r
224 if( ulCriticalNesting == 0 )
\r
226 SetEvent( pvInterruptEvent );
\r
229 /* Give back the mutex so the simulated interrupt handler unblocks
\r
230 and can access the interrupt handler variables. */
\r
231 ReleaseMutex( pvInterruptEventMutex );
\r
235 /* Should never reach here - MingW complains if you leave this line out,
\r
236 MSVC complains if you put it in. */
\r
240 /*-----------------------------------------------------------*/
\r
242 static BOOL WINAPI prvEndProcess( DWORD dwCtrlType )
\r
244 TIMECAPS xTimeCaps;
\r
246 ( void ) dwCtrlType;
\r
248 if( timeGetDevCaps( &xTimeCaps, sizeof( xTimeCaps ) ) == MMSYSERR_NOERROR )
\r
250 /* Match the call to timeBeginPeriod( xTimeCaps.wPeriodMin ) made when
\r
251 the process started with a timeEndPeriod() as the process exits. */
\r
252 timeEndPeriod( xTimeCaps.wPeriodMin );
\r
257 /*-----------------------------------------------------------*/
\r
259 StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )
\r
261 xThreadState *pxThreadState = NULL;
\r
262 int8_t *pcTopOfStack = ( int8_t * ) pxTopOfStack;
\r
264 /* In this simulated case a stack is not initialised, but instead a thread
\r
265 is created that will execute the task being created. The thread handles
\r
266 the context switching itself. The xThreadState object is placed onto
\r
267 the stack that was created for the task - so the stack buffer is still
\r
268 used, just not in the conventional way. It will not be used for anything
\r
269 other than holding this structure. */
\r
270 pxThreadState = ( xThreadState * ) ( pcTopOfStack - sizeof( xThreadState ) );
\r
272 /* Create the thread itself. */
\r
273 pxThreadState->pvThread = CreateThread( NULL, 0, ( LPTHREAD_START_ROUTINE ) pxCode, pvParameters, CREATE_SUSPENDED, NULL );
\r
274 configASSERT( pxThreadState->pvThread );
\r
275 SetThreadAffinityMask( pxThreadState->pvThread, 0x01 );
\r
276 SetThreadPriorityBoost( pxThreadState->pvThread, TRUE );
\r
277 SetThreadPriority( pxThreadState->pvThread, portTASK_THREAD_PRIORITY );
\r
279 return ( StackType_t * ) pxThreadState;
\r
281 /*-----------------------------------------------------------*/
\r
283 BaseType_t xPortStartScheduler( void )
\r
286 int32_t lSuccess = pdPASS;
\r
287 xThreadState *pxThreadState;
\r
289 /* Install the interrupt handlers used by the scheduler itself. */
\r
290 vPortSetInterruptHandler( portINTERRUPT_YIELD, prvProcessYieldInterrupt );
\r
291 vPortSetInterruptHandler( portINTERRUPT_TICK, prvProcessTickInterrupt );
\r
293 /* Create the events and mutexes that are used to synchronise all the
\r
295 pvInterruptEventMutex = CreateMutex( NULL, FALSE, NULL );
\r
296 pvInterruptEvent = CreateEvent( NULL, FALSE, FALSE, NULL );
\r
298 if( ( pvInterruptEventMutex == NULL ) || ( pvInterruptEvent == NULL ) )
\r
303 /* Set the priority of this thread such that it is above the priority of
\r
304 the threads that run tasks. This higher priority is required to ensure
\r
305 simulated interrupts take priority over tasks. */
\r
306 pvHandle = GetCurrentThread();
\r
307 if( pvHandle == NULL )
\r
312 if( lSuccess == pdPASS )
\r
314 if( SetThreadPriority( pvHandle, portSIMULATED_INTERRUPTS_THREAD_PRIORITY ) == 0 )
\r
318 SetThreadPriorityBoost( pvHandle, TRUE );
\r
319 SetThreadAffinityMask( pvHandle, 0x01 );
\r
322 if( lSuccess == pdPASS )
\r
324 /* Start the thread that simulates the timer peripheral to generate
\r
325 tick interrupts. The priority is set below that of the simulated
\r
326 interrupt handler so the interrupt event mutex is used for the
\r
327 handshake / overrun protection. */
\r
328 pvHandle = CreateThread( NULL, 0, prvSimulatedPeripheralTimer, NULL, CREATE_SUSPENDED, NULL );
\r
329 if( pvHandle != NULL )
\r
331 SetThreadPriority( pvHandle, portSIMULATED_TIMER_THREAD_PRIORITY );
\r
332 SetThreadPriorityBoost( pvHandle, TRUE );
\r
333 SetThreadAffinityMask( pvHandle, 0x01 );
\r
334 ResumeThread( pvHandle );
\r
337 /* Start the highest priority task by obtaining its associated thread
\r
338 state structure, in which is stored the thread handle. */
\r
339 pxThreadState = ( xThreadState * ) *( ( size_t * ) pxCurrentTCB );
\r
340 ulCriticalNesting = portNO_CRITICAL_NESTING;
\r
342 /* Bump up the priority of the thread that is going to run, in the
\r
343 hope that this will assist in getting the Windows thread scheduler to
\r
344 behave as an embedded engineer might expect. */
\r
345 ResumeThread( pxThreadState->pvThread );
\r
347 /* Handle all simulated interrupts - including yield requests and
\r
348 simulated ticks. */
\r
349 prvProcessSimulatedInterrupts();
\r
352 /* Would not expect to return from prvProcessSimulatedInterrupts(), so should
\r
356 /*-----------------------------------------------------------*/
\r
358 static uint32_t prvProcessYieldInterrupt( void )
\r
362 /*-----------------------------------------------------------*/
\r
364 static uint32_t prvProcessTickInterrupt( void )
\r
366 uint32_t ulSwitchRequired;
\r
368 /* Process the tick itself. */
\r
369 configASSERT( xPortRunning );
\r
370 ulSwitchRequired = ( uint32_t ) xTaskIncrementTick();
\r
372 return ulSwitchRequired;
\r
374 /*-----------------------------------------------------------*/
\r
376 static void prvProcessSimulatedInterrupts( void )
\r
378 uint32_t ulSwitchRequired, i;
\r
379 xThreadState *pxThreadState;
\r
380 void *pvObjectList[ 2 ];
\r
383 /* Going to block on the mutex that ensured exclusive access to the simulated
\r
384 interrupt objects, and the event that signals that a simulated interrupt
\r
385 should be processed. */
\r
386 pvObjectList[ 0 ] = pvInterruptEventMutex;
\r
387 pvObjectList[ 1 ] = pvInterruptEvent;
\r
389 /* Create a pending tick to ensure the first task is started as soon as
\r
390 this thread pends. */
\r
391 ulPendingInterrupts |= ( 1 << portINTERRUPT_TICK );
\r
392 SetEvent( pvInterruptEvent );
\r
394 xPortRunning = pdTRUE;
\r
398 WaitForMultipleObjects( sizeof( pvObjectList ) / sizeof( void * ), pvObjectList, TRUE, INFINITE );
\r
400 /* Used to indicate whether the simulated interrupt processing has
\r
401 necessitated a context switch to another task/thread. */
\r
402 ulSwitchRequired = pdFALSE;
\r
404 /* For each interrupt we are interested in processing, each of which is
\r
405 represented by a bit in the 32bit ulPendingInterrupts variable. */
\r
406 for( i = 0; i < portMAX_INTERRUPTS; i++ )
\r
408 /* Is the simulated interrupt pending? */
\r
409 if( ulPendingInterrupts & ( 1UL << i ) )
\r
411 /* Is a handler installed? */
\r
412 if( ulIsrHandler[ i ] != NULL )
\r
414 /* Run the actual handler. */
\r
415 if( ulIsrHandler[ i ]() != pdFALSE )
\r
417 ulSwitchRequired |= ( 1 << i );
\r
421 /* Clear the interrupt pending bit. */
\r
422 ulPendingInterrupts &= ~( 1UL << i );
\r
426 if( ulSwitchRequired != pdFALSE )
\r
428 void *pvOldCurrentTCB;
\r
430 pvOldCurrentTCB = pxCurrentTCB;
\r
432 /* Select the next task to run. */
\r
433 vTaskSwitchContext();
\r
435 /* If the task selected to enter the running state is not the task
\r
436 that is already in the running state. */
\r
437 if( pvOldCurrentTCB != pxCurrentTCB )
\r
439 /* Suspend the old thread. */
\r
440 pxThreadState = ( xThreadState *) *( ( size_t * ) pvOldCurrentTCB );
\r
441 SuspendThread( pxThreadState->pvThread );
\r
443 /* Ensure the thread is actually suspended by performing a
\r
444 synchronous operation that can only complete when the thread is
\r
445 actually suspended. The below code asks for dummy register
\r
447 xContext.ContextFlags = CONTEXT_INTEGER;
\r
448 ( void ) GetThreadContext( pxThreadState->pvThread, &xContext );
\r
450 /* Obtain the state of the task now selected to enter the
\r
452 pxThreadState = ( xThreadState * ) ( *( size_t *) pxCurrentTCB );
\r
453 ResumeThread( pxThreadState->pvThread );
\r
457 ReleaseMutex( pvInterruptEventMutex );
\r
460 /*-----------------------------------------------------------*/
\r
462 void vPortDeleteThread( void *pvTaskToDelete )
\r
464 xThreadState *pxThreadState;
\r
465 uint32_t ulErrorCode;
\r
467 /* Remove compiler warnings if configASSERT() is not defined. */
\r
468 ( void ) ulErrorCode;
\r
470 /* Find the handle of the thread being deleted. */
\r
471 pxThreadState = ( xThreadState * ) ( *( size_t *) pvTaskToDelete );
\r
473 /* Check that the thread is still valid, it might have been closed by
\r
474 vPortCloseRunningThread() - which will be the case if the task associated
\r
475 with the thread originally deleted itself rather than being deleted by a
\r
477 if( pxThreadState->pvThread != NULL )
\r
479 WaitForSingleObject( pvInterruptEventMutex, INFINITE );
\r
481 ulErrorCode = TerminateThread( pxThreadState->pvThread, 0 );
\r
482 configASSERT( ulErrorCode );
\r
484 ulErrorCode = CloseHandle( pxThreadState->pvThread );
\r
485 configASSERT( ulErrorCode );
\r
487 ReleaseMutex( pvInterruptEventMutex );
\r
490 /*-----------------------------------------------------------*/
\r
492 void vPortCloseRunningThread( void *pvTaskToDelete, volatile BaseType_t *pxPendYield )
\r
494 xThreadState *pxThreadState;
\r
496 uint32_t ulErrorCode;
\r
498 /* Remove compiler warnings if configASSERT() is not defined. */
\r
499 ( void ) ulErrorCode;
\r
501 /* Find the handle of the thread being deleted. */
\r
502 pxThreadState = ( xThreadState * ) ( *( size_t *) pvTaskToDelete );
\r
503 pvThread = pxThreadState->pvThread;
\r
505 /* Raise the Windows priority of the thread to ensure the FreeRTOS scheduler
\r
506 does not run and swap it out before it is closed. If that were to happen
\r
507 the thread would never run again and effectively be a thread handle and
\r
509 SetThreadPriority( pvThread, THREAD_PRIORITY_HIGHEST );
\r
511 /* This function will not return, therefore a yield is set as pending to
\r
512 ensure a context switch occurs away from this thread on the next tick. */
\r
513 *pxPendYield = pdTRUE;
\r
515 /* Mark the thread associated with this task as invalid so
\r
516 vPortDeleteThread() does not try to terminate it. */
\r
517 pxThreadState->pvThread = NULL;
\r
519 /* Close the thread. */
\r
520 ulErrorCode = CloseHandle( pvThread );
\r
521 configASSERT( ulErrorCode );
\r
525 /*-----------------------------------------------------------*/
\r
527 void vPortEndScheduler( void )
\r
529 /* This function IS NOT TESTED! */
\r
530 TerminateProcess( GetCurrentProcess(), 0 );
\r
532 /*-----------------------------------------------------------*/
\r
534 void vPortGenerateSimulatedInterrupt( uint32_t ulInterruptNumber )
\r
536 configASSERT( xPortRunning );
\r
538 if( ( ulInterruptNumber < portMAX_INTERRUPTS ) && ( pvInterruptEventMutex != NULL ) )
\r
540 /* Yield interrupts are processed even when critical nesting is
\r
542 WaitForSingleObject( pvInterruptEventMutex, INFINITE );
\r
543 ulPendingInterrupts |= ( 1 << ulInterruptNumber );
\r
545 /* The simulated interrupt is now held pending, but don't actually
\r
546 process it yet if this call is within a critical section. It is
\r
547 possible for this to be in a critical section as calls to wait for
\r
548 mutexes are accumulative. */
\r
549 if( ulCriticalNesting == 0 )
\r
551 SetEvent( pvInterruptEvent );
\r
554 ReleaseMutex( pvInterruptEventMutex );
\r
557 /*-----------------------------------------------------------*/
\r
559 void vPortSetInterruptHandler( uint32_t ulInterruptNumber, uint32_t (*pvHandler)( void ) )
\r
561 if( ulInterruptNumber < portMAX_INTERRUPTS )
\r
563 if( pvInterruptEventMutex != NULL )
\r
565 WaitForSingleObject( pvInterruptEventMutex, INFINITE );
\r
566 ulIsrHandler[ ulInterruptNumber ] = pvHandler;
\r
567 ReleaseMutex( pvInterruptEventMutex );
\r
571 ulIsrHandler[ ulInterruptNumber ] = pvHandler;
\r
575 /*-----------------------------------------------------------*/
\r
577 void vPortEnterCritical( void )
\r
579 if( xPortRunning == pdTRUE )
\r
581 /* The interrupt event mutex is held for the entire critical section,
\r
582 effectively disabling (simulated) interrupts. */
\r
583 WaitForSingleObject( pvInterruptEventMutex, INFINITE );
\r
584 ulCriticalNesting++;
\r
588 ulCriticalNesting++;
\r
591 /*-----------------------------------------------------------*/
\r
593 void vPortExitCritical( void )
\r
595 int32_t lMutexNeedsReleasing;
\r
597 /* The interrupt event mutex should already be held by this thread as it was
\r
598 obtained on entry to the critical section. */
\r
600 lMutexNeedsReleasing = pdTRUE;
\r
602 if( ulCriticalNesting > portNO_CRITICAL_NESTING )
\r
604 if( ulCriticalNesting == ( portNO_CRITICAL_NESTING + 1 ) )
\r
606 ulCriticalNesting--;
\r
608 /* Were any interrupts set to pending while interrupts were
\r
609 (simulated) disabled? */
\r
610 if( ulPendingInterrupts != 0UL )
\r
612 configASSERT( xPortRunning );
\r
613 SetEvent( pvInterruptEvent );
\r
615 /* Mutex will be released now, so does not require releasing
\r
616 on function exit. */
\r
617 lMutexNeedsReleasing = pdFALSE;
\r
618 ReleaseMutex( pvInterruptEventMutex );
\r
623 /* Tick interrupts will still not be processed as the critical
\r
624 nesting depth will not be zero. */
\r
625 ulCriticalNesting--;
\r
629 if( pvInterruptEventMutex != NULL )
\r
631 if( lMutexNeedsReleasing == pdTRUE )
\r
633 configASSERT( xPortRunning );
\r
634 ReleaseMutex( pvInterruptEventMutex );
\r
638 /*-----------------------------------------------------------*/
\r