2 FreeRTOS V9.0.0 - 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
74 /* TriCore specific includes. */
\r
76 #include <machine/intrinsics.h>
\r
77 #include <machine/cint.h>
\r
78 #include <machine/wdtcon.h>
\r
80 /* Kernel includes. */
\r
81 #include "FreeRTOS.h"
\r
85 #if configCHECK_FOR_STACK_OVERFLOW > 0
\r
86 #error "Stack checking cannot be used with this port, as, unlike most ports, the pxTopOfStack member of the TCB is consumed CSA. CSA starvation, loosely equivalent to stack overflow, will result in a trap exception."
\r
87 /* The stack pointer is accessible using portCSA_TO_ADDRESS( portCSA_TO_ADDRESS( pxCurrentTCB->pxTopOfStack )[ 0 ] )[ 2 ]; */
\r
88 #endif /* configCHECK_FOR_STACK_OVERFLOW */
\r
91 /*-----------------------------------------------------------*/
\r
93 /* System register Definitions. */
\r
94 #define portSYSTEM_PROGRAM_STATUS_WORD ( 0x000008FFUL ) /* Supervisor Mode, MPU Register Set 0 and Call Depth Counting disabled. */
\r
95 #define portINITIAL_PRIVILEGED_PROGRAM_STATUS_WORD ( 0x000014FFUL ) /* IO Level 1, MPU Register Set 1 and Call Depth Counting disabled. */
\r
96 #define portINITIAL_UNPRIVILEGED_PROGRAM_STATUS_WORD ( 0x000010FFUL ) /* IO Level 0, MPU Register Set 1 and Call Depth Counting disabled. */
\r
97 #define portINITIAL_PCXI_UPPER_CONTEXT_WORD ( 0x00C00000UL ) /* The lower 20 bits identify the CSA address. */
\r
98 #define portINITIAL_SYSCON ( 0x00000000UL ) /* MPU Disable. */
\r
100 /* CSA manipulation macros. */
\r
101 #define portCSA_FCX_MASK ( 0x000FFFFFUL )
\r
103 /* OS Interrupt and Trap mechanisms. */
\r
104 #define portRESTORE_PSW_MASK ( ~( 0x000000FFUL ) )
\r
105 #define portSYSCALL_TRAP ( 6 )
\r
107 /* Each CSA contains 16 words of data. */
\r
108 #define portNUM_WORDS_IN_CSA ( 16 )
\r
110 /* The interrupt enable bit in the PCP_SRC register. */
\r
111 #define portENABLE_CPU_INTERRUPT ( 1U << 12U )
\r
112 /*-----------------------------------------------------------*/
\r
115 * Perform any hardware configuration necessary to generate the tick interrupt.
\r
117 static void prvSystemTickHandler( int ) __attribute__((longcall));
\r
118 static void prvSetupTimerInterrupt( void );
\r
121 * Trap handler for yields.
\r
123 static void prvTrapYield( int iTrapIdentification );
\r
126 * Priority 1 interrupt handler for yields pended from an interrupt.
\r
128 static void prvInterruptYield( int iTrapIdentification );
\r
130 /*-----------------------------------------------------------*/
\r
132 /* This reference is required by the save/restore context macros. */
\r
133 extern volatile uint32_t *pxCurrentTCB;
\r
135 /* Precalculate the compare match value at compile time. */
\r
136 static const uint32_t ulCompareMatchValue = ( configPERIPHERAL_CLOCK_HZ / configTICK_RATE_HZ );
\r
138 /*-----------------------------------------------------------*/
\r
140 StackType_t *pxPortInitialiseStack( StackType_t * pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )
\r
142 uint32_t *pulUpperCSA = NULL;
\r
143 uint32_t *pulLowerCSA = NULL;
\r
145 /* 16 Address Registers (4 Address registers are global), 16 Data
\r
146 Registers, and 3 System Registers.
\r
148 There are 3 registers that track the CSAs.
\r
149 FCX points to the head of globally free set of CSAs.
\r
150 PCX for the task needs to point to Lower->Upper->NULL arrangement.
\r
151 LCX points to the last free CSA so that corrective action can be taken.
\r
153 Need two CSAs to store the context of a task.
\r
154 The upper context contains D8-D15, A10-A15, PSW and PCXI->NULL.
\r
155 The lower context contains D0-D7, A2-A7, A11 and PCXI->UpperContext.
\r
156 The pxCurrentTCB->pxTopOfStack points to the Lower Context RSLCX matching the initial BISR.
\r
157 The Lower Context points to the Upper Context ready for the return from the interrupt handler.
\r
159 The Real stack pointer for the task is stored in the A10 which is restored
\r
160 with the upper context. */
\r
162 /* Have to disable interrupts here because the CSAs are going to be
\r
164 portENTER_CRITICAL();
\r
166 /* DSync to ensure that buffering is not a problem. */
\r
169 /* Consume two free CSAs. */
\r
170 pulLowerCSA = portCSA_TO_ADDRESS( _mfcr( $FCX ) );
\r
171 if( NULL != pulLowerCSA )
\r
173 /* The Lower Links to the Upper. */
\r
174 pulUpperCSA = portCSA_TO_ADDRESS( pulLowerCSA[ 0 ] );
\r
177 /* Check that we have successfully reserved two CSAs. */
\r
178 if( ( NULL != pulLowerCSA ) && ( NULL != pulUpperCSA ) )
\r
180 /* Remove the two consumed CSAs from the free CSA list. */
\r
183 _mtcr( $FCX, pulUpperCSA[ 0 ] );
\r
189 /* Simply trigger a context list depletion trap. */
\r
193 portEXIT_CRITICAL();
\r
195 /* Clear the upper CSA. */
\r
196 memset( pulUpperCSA, 0, portNUM_WORDS_IN_CSA * sizeof( uint32_t ) );
\r
198 /* Upper Context. */
\r
199 pulUpperCSA[ 2 ] = ( uint32_t )pxTopOfStack; /* A10; Stack Return aka Stack Pointer */
\r
200 pulUpperCSA[ 1 ] = portSYSTEM_PROGRAM_STATUS_WORD; /* PSW */
\r
202 /* Clear the lower CSA. */
\r
203 memset( pulLowerCSA, 0, portNUM_WORDS_IN_CSA * sizeof( uint32_t ) );
\r
205 /* Lower Context. */
\r
206 pulLowerCSA[ 8 ] = ( uint32_t ) pvParameters; /* A4; Address Type Parameter Register */
\r
207 pulLowerCSA[ 1 ] = ( uint32_t ) pxCode; /* A11; Return Address aka RA */
\r
209 /* PCXI pointing to the Upper context. */
\r
210 pulLowerCSA[ 0 ] = ( portINITIAL_PCXI_UPPER_CONTEXT_WORD | ( uint32_t ) portADDRESS_TO_CSA( pulUpperCSA ) );
\r
212 /* Save the link to the CSA in the top of stack. */
\r
213 pxTopOfStack = (uint32_t * ) portADDRESS_TO_CSA( pulLowerCSA );
\r
215 /* DSync to ensure that buffering is not a problem. */
\r
218 return pxTopOfStack;
\r
220 /*-----------------------------------------------------------*/
\r
222 int32_t xPortStartScheduler( void )
\r
224 extern void vTrapInstallHandlers( void );
\r
225 uint32_t ulMFCR = 0UL;
\r
226 uint32_t *pulUpperCSA = NULL;
\r
227 uint32_t *pulLowerCSA = NULL;
\r
229 /* Interrupts at or below configMAX_SYSCALL_INTERRUPT_PRIORITY are disable
\r
230 when this function is called. */
\r
232 /* Set-up the timer interrupt. */
\r
233 prvSetupTimerInterrupt();
\r
235 /* Install the Trap Handlers. */
\r
236 vTrapInstallHandlers();
\r
238 /* Install the Syscall Handler for yield calls. */
\r
239 if( 0 == _install_trap_handler( portSYSCALL_TRAP, prvTrapYield ) )
\r
241 /* Failed to install the yield handler, force an assert. */
\r
242 configASSERT( ( ( volatile void * ) NULL ) );
\r
245 /* Enable then install the priority 1 interrupt for pending context
\r
246 switches from an ISR. See mod_SRC in the TriCore manual. */
\r
247 CPU_SRC0.reg = ( portENABLE_CPU_INTERRUPT ) | ( configKERNEL_YIELD_PRIORITY );
\r
248 if( 0 == _install_int_handler( configKERNEL_YIELD_PRIORITY, prvInterruptYield, 0 ) )
\r
250 /* Failed to install the yield handler, force an assert. */
\r
251 configASSERT( ( ( volatile void * ) NULL ) );
\r
256 /* Load the initial SYSCON. */
\r
257 _mtcr( $SYSCON, portINITIAL_SYSCON );
\r
260 /* ENDINIT has already been applied in the 'cstart.c' code. */
\r
262 /* Clear the PSW.CDC to enable the use of an RFE without it generating an
\r
263 exception because this code is not genuinely in an exception. */
\r
264 ulMFCR = _mfcr( $PSW );
\r
265 ulMFCR &= portRESTORE_PSW_MASK;
\r
267 _mtcr( $PSW, ulMFCR );
\r
270 /* Finally, perform the equivalent of a portRESTORE_CONTEXT() */
\r
271 pulLowerCSA = portCSA_TO_ADDRESS( ( *pxCurrentTCB ) );
\r
272 pulUpperCSA = portCSA_TO_ADDRESS( pulLowerCSA[0] );
\r
274 _mtcr( $PCXI, *pxCurrentTCB );
\r
280 /* Return to the first task selected to execute. */
\r
281 __asm volatile( "rfe" );
\r
283 /* Will not get here. */
\r
286 /*-----------------------------------------------------------*/
\r
288 static void prvSetupTimerInterrupt( void )
\r
290 /* Set-up the clock divider. */
\r
293 /* Wait until access to Endint protected register is enabled. */
\r
294 while( 0 != ( WDT_CON0.reg & 0x1UL ) );
\r
296 /* RMC == 1 so STM Clock == FPI */
\r
297 STM_CLC.reg = ( 1UL << 8 );
\r
301 /* Determine how many bits are used without changing other bits in the CMCON register. */
\r
302 STM_CMCON.reg &= ~( 0x1fUL );
\r
303 STM_CMCON.reg |= ( 0x1fUL - __CLZ( configPERIPHERAL_CLOCK_HZ / configTICK_RATE_HZ ) );
\r
305 /* Take into account the current time so a tick doesn't happen immediately. */
\r
306 STM_CMP0.reg = ulCompareMatchValue + STM_TIM0.reg;
\r
308 if( 0 != _install_int_handler( configKERNEL_INTERRUPT_PRIORITY, prvSystemTickHandler, 0 ) )
\r
310 /* Set-up the interrupt. */
\r
311 STM_SRC0.reg = ( configKERNEL_INTERRUPT_PRIORITY | 0x00005000UL );
\r
313 /* Enable the Interrupt. */
\r
314 STM_ISRR.reg &= ~( 0x03UL );
\r
315 STM_ISRR.reg |= 0x1UL;
\r
316 STM_ISRR.reg &= ~( 0x07UL );
\r
317 STM_ICR.reg |= 0x1UL;
\r
321 /* Failed to install the Tick Interrupt. */
\r
322 configASSERT( ( ( volatile void * ) NULL ) );
\r
325 /*-----------------------------------------------------------*/
\r
327 static void prvSystemTickHandler( int iArg )
\r
329 uint32_t ulSavedInterruptMask;
\r
330 uint32_t *pxUpperCSA = NULL;
\r
331 uint32_t xUpperCSA = 0UL;
\r
332 extern volatile uint32_t *pxCurrentTCB;
\r
333 int32_t lYieldRequired;
\r
335 /* Just to avoid compiler warnings about unused parameters. */
\r
338 /* Clear the interrupt source. */
\r
339 STM_ISRR.reg = 1UL;
\r
341 /* Reload the Compare Match register for X ticks into the future.
\r
343 If critical section or interrupt nesting budgets are exceeded, then
\r
344 it is possible that the calculated next compare match value is in the
\r
345 past. If this occurs (unlikely), it is possible that the resulting
\r
346 time slippage will exceed a single tick period. Any adverse effect of
\r
347 this is time bounded by the fact that only the first n bits of the 56 bit
\r
348 STM timer are being used for a compare match, so another compare match
\r
349 will occur after an overflow in just those n bits (not the entire 56 bits).
\r
350 As an example, if the peripheral clock is 75MHz, and the tick rate is 1KHz,
\r
351 a missed tick could result in the next tick interrupt occurring within a
\r
352 time that is 1.7 times the desired period. The fact that this is greater
\r
353 than a single tick period is an effect of using a timer that cannot be
\r
354 automatically reset, in hardware, by the occurrence of a tick interrupt.
\r
355 Changing the tick source to a timer that has an automatic reset on compare
\r
356 match (such as a GPTA timer) will reduce the maximum possible additional
\r
357 period to exactly 1 times the desired period. */
\r
358 STM_CMP0.reg += ulCompareMatchValue;
\r
360 /* Kernel API calls require Critical Sections. */
\r
361 ulSavedInterruptMask = portSET_INTERRUPT_MASK_FROM_ISR();
\r
363 /* Increment the Tick. */
\r
364 lYieldRequired = xTaskIncrementTick();
\r
366 portCLEAR_INTERRUPT_MASK_FROM_ISR( ulSavedInterruptMask );
\r
368 if( lYieldRequired != pdFALSE )
\r
370 /* Save the context of a task.
\r
371 The upper context is automatically saved when entering a trap or interrupt.
\r
372 Need to save the lower context as well and copy the PCXI CSA ID into
\r
373 pxCurrentTCB->pxTopOfStack. Only Lower Context CSA IDs may be saved to the
\r
376 Call vTaskSwitchContext to select the next task, note that this changes the
\r
377 value of pxCurrentTCB so that it needs to be reloaded.
\r
379 Call vPortSetMPURegisterSetOne to change the MPU mapping for the task
\r
380 that has just been switched in.
\r
382 Load the context of the task.
\r
383 Need to restore the lower context by loading the CSA from
\r
384 pxCurrentTCB->pxTopOfStack into PCXI (effectively changing the call stack).
\r
385 In the Interrupt handler post-amble, RSLCX will restore the lower context
\r
386 of the task. RFE will restore the upper context of the task, jump to the
\r
387 return address and restore the previous state of interrupts being
\r
388 enabled/disabled. */
\r
391 xUpperCSA = _mfcr( $PCXI );
\r
392 pxUpperCSA = portCSA_TO_ADDRESS( xUpperCSA );
\r
393 *pxCurrentTCB = pxUpperCSA[ 0 ];
\r
394 vTaskSwitchContext();
\r
395 pxUpperCSA[ 0 ] = *pxCurrentTCB;
\r
396 CPU_SRC0.bits.SETR = 0;
\r
400 /*-----------------------------------------------------------*/
\r
403 * When a task is deleted, it is yielded permanently until the IDLE task
\r
404 * has an opportunity to reclaim the memory that that task was using.
\r
405 * Typically, the memory used by a task is the TCB and Stack but in the
\r
406 * TriCore this includes the CSAs that were consumed as part of the Call
\r
407 * Stack. These CSAs can only be returned to the Globally Free Pool when
\r
408 * they are not part of the current Call Stack, hence, delaying the
\r
409 * reclamation until the IDLE task is freeing the task's other resources.
\r
410 * This function uses the head of the linked list of CSAs (from when the
\r
411 * task yielded for the last time) and finds the tail (the very bottom of
\r
412 * the call stack) and inserts this list at the head of the Free list,
\r
413 * attaching the existing Free List to the tail of the reclaimed call stack.
\r
415 * NOTE: the IDLE task needs processing time to complete this function
\r
416 * and in heavily loaded systems, the Free CSAs may be consumed faster
\r
417 * than they can be freed assuming that tasks are being spawned and
\r
418 * deleted frequently.
\r
420 void vPortReclaimCSA( uint32_t *pxTCB )
\r
422 uint32_t pxHeadCSA, pxTailCSA, pxFreeCSA;
\r
423 uint32_t *pulNextCSA;
\r
425 /* A pointer to the first CSA in the list of CSAs consumed by the task is
\r
426 stored in the first element of the tasks TCB structure (where the stack
\r
427 pointer would be on a traditional stack based architecture). */
\r
428 pxHeadCSA = ( *pxTCB ) & portCSA_FCX_MASK;
\r
430 /* Mask off everything in the CSA link field other than the address. If
\r
431 the address is NULL, then the CSA is not linking anywhere and there is
\r
433 pxTailCSA = pxHeadCSA;
\r
435 /* Convert the link value to contain just a raw address and store this
\r
436 in a local variable. */
\r
437 pulNextCSA = portCSA_TO_ADDRESS( pxTailCSA );
\r
439 /* Iterate over the CSAs that were consumed as part of the task. The
\r
440 first field in the CSA is the pointer to then next CSA. Mask off
\r
441 everything in the pointer to the next CSA, other than the link address.
\r
442 If this is NULL, then the CSA currently being pointed to is the last in
\r
444 while( 0UL != ( pulNextCSA[ 0 ] & portCSA_FCX_MASK ) )
\r
446 /* Clear all bits of the pointer to the next in the chain, other
\r
447 than the address bits themselves. */
\r
448 pulNextCSA[ 0 ] = pulNextCSA[ 0 ] & portCSA_FCX_MASK;
\r
450 /* Move the pointer to point to the next CSA in the list. */
\r
451 pxTailCSA = pulNextCSA[ 0 ];
\r
453 /* Update the local pointer to the CSA. */
\r
454 pulNextCSA = portCSA_TO_ADDRESS( pxTailCSA );
\r
459 /* Look up the current free CSA head. */
\r
461 pxFreeCSA = _mfcr( $FCX );
\r
463 /* Join the current Free onto the Tail of what is being reclaimed. */
\r
464 portCSA_TO_ADDRESS( pxTailCSA )[ 0 ] = pxFreeCSA;
\r
466 /* Move the head of the reclaimed into the Free. */
\r
468 _mtcr( $FCX, pxHeadCSA );
\r
473 /*-----------------------------------------------------------*/
\r
475 void vPortEndScheduler( void )
\r
477 /* Nothing to do. Unlikely to want to end. */
\r
479 /*-----------------------------------------------------------*/
\r
481 static void prvTrapYield( int iTrapIdentification )
\r
483 uint32_t *pxUpperCSA = NULL;
\r
484 uint32_t xUpperCSA = 0UL;
\r
485 extern volatile uint32_t *pxCurrentTCB;
\r
487 switch( iTrapIdentification )
\r
489 case portSYSCALL_TASK_YIELD:
\r
490 /* Save the context of a task.
\r
491 The upper context is automatically saved when entering a trap or interrupt.
\r
492 Need to save the lower context as well and copy the PCXI CSA ID into
\r
493 pxCurrentTCB->pxTopOfStack. Only Lower Context CSA IDs may be saved to the
\r
496 Call vTaskSwitchContext to select the next task, note that this changes the
\r
497 value of pxCurrentTCB so that it needs to be reloaded.
\r
499 Call vPortSetMPURegisterSetOne to change the MPU mapping for the task
\r
500 that has just been switched in.
\r
502 Load the context of the task.
\r
503 Need to restore the lower context by loading the CSA from
\r
504 pxCurrentTCB->pxTopOfStack into PCXI (effectively changing the call stack).
\r
505 In the Interrupt handler post-amble, RSLCX will restore the lower context
\r
506 of the task. RFE will restore the upper context of the task, jump to the
\r
507 return address and restore the previous state of interrupts being
\r
508 enabled/disabled. */
\r
511 xUpperCSA = _mfcr( $PCXI );
\r
512 pxUpperCSA = portCSA_TO_ADDRESS( xUpperCSA );
\r
513 *pxCurrentTCB = pxUpperCSA[ 0 ];
\r
514 vTaskSwitchContext();
\r
515 pxUpperCSA[ 0 ] = *pxCurrentTCB;
\r
516 CPU_SRC0.bits.SETR = 0;
\r
521 /* Unimplemented trap called. */
\r
522 configASSERT( ( ( volatile void * ) NULL ) );
\r
526 /*-----------------------------------------------------------*/
\r
528 static void prvInterruptYield( int iId )
\r
530 uint32_t *pxUpperCSA = NULL;
\r
531 uint32_t xUpperCSA = 0UL;
\r
532 extern volatile uint32_t *pxCurrentTCB;
\r
534 /* Just to remove compiler warnings. */
\r
537 /* Save the context of a task.
\r
538 The upper context is automatically saved when entering a trap or interrupt.
\r
539 Need to save the lower context as well and copy the PCXI CSA ID into
\r
540 pxCurrentTCB->pxTopOfStack. Only Lower Context CSA IDs may be saved to the
\r
543 Call vTaskSwitchContext to select the next task, note that this changes the
\r
544 value of pxCurrentTCB so that it needs to be reloaded.
\r
546 Call vPortSetMPURegisterSetOne to change the MPU mapping for the task
\r
547 that has just been switched in.
\r
549 Load the context of the task.
\r
550 Need to restore the lower context by loading the CSA from
\r
551 pxCurrentTCB->pxTopOfStack into PCXI (effectively changing the call stack).
\r
552 In the Interrupt handler post-amble, RSLCX will restore the lower context
\r
553 of the task. RFE will restore the upper context of the task, jump to the
\r
554 return address and restore the previous state of interrupts being
\r
555 enabled/disabled. */
\r
558 xUpperCSA = _mfcr( $PCXI );
\r
559 pxUpperCSA = portCSA_TO_ADDRESS( xUpperCSA );
\r
560 *pxCurrentTCB = pxUpperCSA[ 0 ];
\r
561 vTaskSwitchContext();
\r
562 pxUpperCSA[ 0 ] = *pxCurrentTCB;
\r
563 CPU_SRC0.bits.SETR = 0;
\r
566 /*-----------------------------------------------------------*/
\r
568 uint32_t uxPortSetInterruptMaskFromISR( void )
\r
570 uint32_t uxReturn = 0UL;
\r
573 uxReturn = _mfcr( $ICR );
\r
574 _mtcr( $ICR, ( ( uxReturn & ~portCCPN_MASK ) | configMAX_SYSCALL_INTERRUPT_PRIORITY ) );
\r
578 /* Return just the interrupt mask bits. */
\r
579 return ( uxReturn & portCCPN_MASK );
\r
581 /*-----------------------------------------------------------*/
\r