/*-----------------------------------------------------------*/ \r
\r
/* Critical section management. */\r
+#if configKERNEL_INTERRUPT_PRIORITY != 30\r
+ #error configKERNEL_INTERRUPT_PRIORITY (set in FreeRTOSConfig.h) must match the ILM value set in the following line - 30 (1Eh) being the default.\r
+#endif\r
+#define portDISABLE_INTERRUPTS() __asm(" STILM #1Eh ")\r
+#define portENABLE_INTERRUPTS() __asm(" MOVL ILM, #1Fh ")\r
+\r
#define portENTER_CRITICAL() \\r
__asm(" ST PS,@-R15 "); \\r
__asm(" ANDCCR #0xef "); \\r
#define portEXIT_CRITICAL() \\r
__asm(" LD @R15+,PS "); \\r
\r
-#define portDISABLE_INTERRUPTS() __DI();\r
-#define portENABLE_INTERRUPTS() __EI();\r
-\r
/*-----------------------------------------------------------*/\r
\r
/* Architecture specifics. */\r
typedef void tskTCB;\r
extern volatile tskTCB * volatile pxCurrentTCB;\r
\r
-/* Constants required to handle critical sections. */\r
-#define portNO_CRITICAL_NESTING ( ( unsigned portBASE_TYPE ) 0 )\r
-volatile unsigned portBASE_TYPE uxCriticalNesting = 9999UL;\r
-\r
/*-----------------------------------------------------------*/\r
\r
/* \r
__asm(" AND CCR,#H'DF "); \\r
__asm(" PUSHW A "); \\r
__asm(" PUSHW (RW0,RW1,RW2,RW3,RW4,RW5,RW6,RW7) "); \\r
- \\r
- /* Save the critical nesting count to the stack. */ \\r
- __asm(" MOVW RW0, _uxCriticalNesting "); \\r
- __asm(" PUSHW (RW0) "); \\r
- \\r
__asm(" MOVW A, _pxCurrentTCB "); \\r
__asm(" MOVW A, SP "); \\r
__asm(" SWAPW "); \\r
__asm(" MOVW A, @A "); \\r
__asm(" AND CCR,#H'DF "); \\r
__asm(" MOVW SP, A "); \\r
- \\r
- /* Load the saved uxCriticalNesting value into RW0. */ \\r
- __asm(" POPW (RW0) "); \\r
- \\r
- /* Save the loaded value into the uxCriticalNesting variable. */ \\r
- __asm(" MOVW _uxCriticalNesting, RW0 "); \\r
- \\r
__asm(" POPW (RW0,RW1,RW2,RW3,RW4,RW5,RW6,RW7) "); \\r
__asm(" POPW A "); \\r
__asm(" OR CCR,#H'20 "); \\r
__asm(" AND CCR,#H'DF "); \\r
__asm(" PUSHW A "); \\r
__asm(" PUSHW (RW0,RW1,RW2,RW3,RW4,RW5,RW6,RW7) "); \\r
- \\r
- /* Save the critical nesting count to the stack. */ \\r
- __asm(" MOVW RW0, _uxCriticalNesting "); \\r
- __asm(" PUSHW (RW0) "); \\r
- \\r
__asm(" MOVL A, _pxCurrentTCB "); \\r
__asm(" MOVL RL2, A "); \\r
__asm(" MOVW A, SP "); \\r
__asm(" MOVW SP, A "); \\r
__asm(" MOV A, @RL2+2 "); \\r
__asm(" MOV USB, A "); \\r
- \\r
- /* Load the saved uxCriticalNesting value into RW0. */ \\r
- __asm(" POPW (RW0) "); \\r
- \\r
- /* Save the loaded value into the uxCriticalNesting variable. */ \\r
- __asm(" MOVW _uxCriticalNesting, RW0 "); \\r
- \\r
__asm(" POPW (RW0,RW1,RW2,RW3,RW4,RW5,RW6,RW7) "); \\r
__asm(" POPW A "); \\r
__asm(" OR CCR,#H'20 "); \\r
*pxTopOfStack = ( portSTACK_TYPE ) 0x1111; /* RW1 */\r
pxTopOfStack--;\r
*pxTopOfStack = ( portSTACK_TYPE ) 0x8888; /* RW0 */\r
- pxTopOfStack--;\r
-\r
- /* The task starts with its uxCriticalNesting variable set to 0, interrupts\r
- being enabled. */\r
- *pxTopOfStack = portNO_CRITICAL_NESTING;\r
\r
return pxTopOfStack;\r
}\r
} \r
/*-----------------------------------------------------------*/\r
\r
-void vPortEnterCritical( void )\r
-{\r
- /* Disable interrupts */\r
- portDISABLE_INTERRUPTS();\r
-\r
- /* Now interrupts are disabled uxCriticalNesting can be accessed\r
- directly. Increment uxCriticalNesting to keep a count of how many times\r
- portENTER_CRITICAL() has been called. */\r
- uxCriticalNesting++;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-void vPortExitCritical( void )\r
-{\r
- if( uxCriticalNesting > portNO_CRITICAL_NESTING )\r
- {\r
- uxCriticalNesting--;\r
- if( uxCriticalNesting == portNO_CRITICAL_NESTING )\r
- {\r
- /* Enable all interrupt/exception. */\r
- portENABLE_INTERRUPTS();\r
- }\r
- }\r
-}\r
-/*-----------------------------------------------------------*/\r
/*-----------------------------------------------------------*/ \r
\r
/* Critical section handling. */\r
-#define portDISABLE_INTERRUPTS() __DI();\r
-#define portENABLE_INTERRUPTS() __EI();\r
-#define portENTER_CRITICAL() vPortEnterCritical()\r
-#define portEXIT_CRITICAL() vPortExitCritical()\r
+#if configKERNEL_INTERRUPT_PRIORITY != 6\r
+ #error configKERNEL_INTERRUPT_PRIORITY (set in FreeRTOSConfig.h) must match the ILM value set in the following line - #06H being the default.\r
+#endif\r
+#define portENABLE_INTERRUPTS() __asm(" MOV ILM, #06h ")\r
+#define portDISABLE_INTERRUPTS() __asm(" MOV ILM, #07h ")\r
+\r
+#define portENTER_CRITICAL() \\r
+ { __asm(" PUSHW PS "); \\r
+ portDISABLE_INTERRUPTS(); \\r
+ }\r
+\r
+#define portEXIT_CRITICAL() \\r
+ { __asm(" POPW PS "); \\r
+ }\r
\r
/*-----------------------------------------------------------*/\r
\r