From: richardbarry Date: Fri, 15 Feb 2008 13:33:44 +0000 (+0000) Subject: Revert critical section handling back to the original method. X-Git-Tag: V4.7.2~24 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=005b6f912f1fadf8d4acf288150ca76ae445b553;p=freertos Revert critical section handling back to the original method. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@190 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/Source/portable/Softune/MB91460/portmacro.h b/Source/portable/Softune/MB91460/portmacro.h index 941471fff..6bff7a5cf 100644 --- a/Source/portable/Softune/MB91460/portmacro.h +++ b/Source/portable/Softune/MB91460/portmacro.h @@ -78,6 +78,12 @@ /*-----------------------------------------------------------*/ /* Critical section management. */ +#if configKERNEL_INTERRUPT_PRIORITY != 30 + #error configKERNEL_INTERRUPT_PRIORITY (set in FreeRTOSConfig.h) must match the ILM value set in the following line - 30 (1Eh) being the default. +#endif +#define portDISABLE_INTERRUPTS() __asm(" STILM #1Eh ") +#define portENABLE_INTERRUPTS() __asm(" MOVL ILM, #1Fh ") + #define portENTER_CRITICAL() \ __asm(" ST PS,@-R15 "); \ __asm(" ANDCCR #0xef "); \ @@ -86,9 +92,6 @@ #define portEXIT_CRITICAL() \ __asm(" LD @R15+,PS "); \ -#define portDISABLE_INTERRUPTS() __DI(); -#define portENABLE_INTERRUPTS() __EI(); - /*-----------------------------------------------------------*/ /* Architecture specifics. */ diff --git a/Source/portable/Softune/MB96340/port.c b/Source/portable/Softune/MB96340/port.c index ef6798e88..2b67f4e5e 100644 --- a/Source/portable/Softune/MB96340/port.c +++ b/Source/portable/Softune/MB96340/port.c @@ -73,10 +73,6 @@ static void prvSetupRLT0Interrupt( void ); typedef void tskTCB; extern volatile tskTCB * volatile pxCurrentTCB; -/* Constants required to handle critical sections. */ -#define portNO_CRITICAL_NESTING ( ( unsigned portBASE_TYPE ) 0 ) -volatile unsigned portBASE_TYPE uxCriticalNesting = 9999UL; - /*-----------------------------------------------------------*/ /* @@ -116,11 +112,6 @@ volatile unsigned portBASE_TYPE uxCriticalNesting = 9999UL; __asm(" AND CCR,#H'DF "); \ __asm(" PUSHW A "); \ __asm(" PUSHW (RW0,RW1,RW2,RW3,RW4,RW5,RW6,RW7) "); \ - \ - /* Save the critical nesting count to the stack. */ \ - __asm(" MOVW RW0, _uxCriticalNesting "); \ - __asm(" PUSHW (RW0) "); \ - \ __asm(" MOVW A, _pxCurrentTCB "); \ __asm(" MOVW A, SP "); \ __asm(" SWAPW "); \ @@ -143,13 +134,6 @@ volatile unsigned portBASE_TYPE uxCriticalNesting = 9999UL; __asm(" MOVW A, @A "); \ __asm(" AND CCR,#H'DF "); \ __asm(" MOVW SP, A "); \ - \ - /* Load the saved uxCriticalNesting value into RW0. */ \ - __asm(" POPW (RW0) "); \ - \ - /* Save the loaded value into the uxCriticalNesting variable. */ \ - __asm(" MOVW _uxCriticalNesting, RW0 "); \ - \ __asm(" POPW (RW0,RW1,RW2,RW3,RW4,RW5,RW6,RW7) "); \ __asm(" POPW A "); \ __asm(" OR CCR,#H'20 "); \ @@ -203,11 +187,6 @@ volatile unsigned portBASE_TYPE uxCriticalNesting = 9999UL; __asm(" AND CCR,#H'DF "); \ __asm(" PUSHW A "); \ __asm(" PUSHW (RW0,RW1,RW2,RW3,RW4,RW5,RW6,RW7) "); \ - \ - /* Save the critical nesting count to the stack. */ \ - __asm(" MOVW RW0, _uxCriticalNesting "); \ - __asm(" PUSHW (RW0) "); \ - \ __asm(" MOVL A, _pxCurrentTCB "); \ __asm(" MOVL RL2, A "); \ __asm(" MOVW A, SP "); \ @@ -224,13 +203,6 @@ volatile unsigned portBASE_TYPE uxCriticalNesting = 9999UL; __asm(" MOVW SP, A "); \ __asm(" MOV A, @RL2+2 "); \ __asm(" MOV USB, A "); \ - \ - /* Load the saved uxCriticalNesting value into RW0. */ \ - __asm(" POPW (RW0) "); \ - \ - /* Save the loaded value into the uxCriticalNesting variable. */ \ - __asm(" MOVW _uxCriticalNesting, RW0 "); \ - \ __asm(" POPW (RW0,RW1,RW2,RW3,RW4,RW5,RW6,RW7) "); \ __asm(" POPW A "); \ __asm(" OR CCR,#H'20 "); \ @@ -398,11 +370,6 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE *pxTopOfStack = ( portSTACK_TYPE ) 0x1111; /* RW1 */ pxTopOfStack--; *pxTopOfStack = ( portSTACK_TYPE ) 0x8888; /* RW0 */ - pxTopOfStack--; - - /* The task starts with its uxCriticalNesting variable set to 0, interrupts - being enabled. */ - *pxTopOfStack = portNO_CRITICAL_NESTING; return pxTopOfStack; } @@ -554,28 +521,3 @@ __nosavereg __interrupt void vPortYieldDelayed( void ) } /*-----------------------------------------------------------*/ -void vPortEnterCritical( void ) -{ - /* Disable interrupts */ - portDISABLE_INTERRUPTS(); - - /* Now interrupts are disabled uxCriticalNesting can be accessed - directly. Increment uxCriticalNesting to keep a count of how many times - portENTER_CRITICAL() has been called. */ - uxCriticalNesting++; -} -/*-----------------------------------------------------------*/ - -void vPortExitCritical( void ) -{ - if( uxCriticalNesting > portNO_CRITICAL_NESTING ) - { - uxCriticalNesting--; - if( uxCriticalNesting == portNO_CRITICAL_NESTING ) - { - /* Enable all interrupt/exception. */ - portENABLE_INTERRUPTS(); - } - } -} -/*-----------------------------------------------------------*/ diff --git a/Source/portable/Softune/MB96340/portmacro.h b/Source/portable/Softune/MB96340/portmacro.h index 86af68415..112bf380f 100644 --- a/Source/portable/Softune/MB96340/portmacro.h +++ b/Source/portable/Softune/MB96340/portmacro.h @@ -87,10 +87,20 @@ FreeRTOSConfig.h to set the configMEMMODEL value. */ /*-----------------------------------------------------------*/ /* Critical section handling. */ -#define portDISABLE_INTERRUPTS() __DI(); -#define portENABLE_INTERRUPTS() __EI(); -#define portENTER_CRITICAL() vPortEnterCritical() -#define portEXIT_CRITICAL() vPortExitCritical() +#if configKERNEL_INTERRUPT_PRIORITY != 6 + #error configKERNEL_INTERRUPT_PRIORITY (set in FreeRTOSConfig.h) must match the ILM value set in the following line - #06H being the default. +#endif +#define portENABLE_INTERRUPTS() __asm(" MOV ILM, #06h ") +#define portDISABLE_INTERRUPTS() __asm(" MOV ILM, #07h ") + +#define portENTER_CRITICAL() \ + { __asm(" PUSHW PS "); \ + portDISABLE_INTERRUPTS(); \ + } + +#define portEXIT_CRITICAL() \ + { __asm(" POPW PS "); \ + } /*-----------------------------------------------------------*/