From: richardbarry Date: Fri, 15 Feb 2008 13:24:05 +0000 (+0000) Subject: Revert to original critical section handling method. X-Git-Tag: V4.7.2~25 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0e5a1241d7ed85d19e29f273bc1900c6a5474ab6;p=freertos Revert to original critical section handling method. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@189 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/Source/portable/Softune/MB91460/port.c b/Source/portable/Softune/MB91460/port.c index 90ad44802..5dd5398cb 100644 --- a/Source/portable/Softune/MB91460/port.c +++ b/Source/portable/Softune/MB91460/port.c @@ -51,10 +51,6 @@ any details of its type. */ typedef void tskTCB; extern volatile tskTCB * volatile pxCurrentTCB; -/* Constants required to handle critical sections. */ -#define portNO_CRITICAL_NESTING ( ( unsigned portBASE_TYPE ) 0 ) -volatile unsigned portLONG ulCriticalNesting = 9999UL; - /*-----------------------------------------------------------*/ #pragma asm @@ -65,10 +61,6 @@ volatile unsigned portLONG ulCriticalNesting = 9999UL; STM1 (R14,R13,R12,R11,R10,R9,R8) ;Store R14-R8 ST MDH, @-R15 ;Store MDH ST MDL, @-R15 ;Store MDL - - LDI #_ulCriticalNesting, R0 ;Get the address of the critical nesting counter - LD @R0, R0 ;Get the value of the critical nesting counter - ST R0, @-R15 ;Store the critical nesting value to the user stack. ANDCCR #0xDF ;Switch back to system stack LD @R15+,R0 ;Store PC to R0 @@ -104,10 +96,6 @@ volatile unsigned portLONG ulCriticalNesting = 9999UL; ORCCR #0x20 ;Switch back to retrieve the remaining context - LDI #_ulCriticalNesting, R0 ;Get the address of the critical nesting counter - LD @R15+, R1 ;Get the saved critical nesting value - ST R1, @R0 ;Save the critical nesting value into the ulCriticalNesting variable - LD @R15+, MDL ;Restore MDL LD @R15+, MDH ;Restore MDH LDM1 (R14,R13,R12,R11,R10,R9,R8) ;Restore R14-R8 @@ -192,11 +180,6 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE *pxTopOfStack = ( portSTACK_TYPE ) 0x22220000; /* MDL */ pxTopOfStack--; - /* The task starts with its ulCriticalNesting variable set to 0, - interrupts being enabled. */ - *pxTopOfStack = portNO_CRITICAL_NESTING; - pxTopOfStack--; - /* The start of the task code. */ *pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */ pxTopOfStack--; @@ -351,32 +334,3 @@ const unsigned portSHORT usReloadValue = ( unsigned portSHORT ) ( ( ( configPER_ #pragma endasm /*-----------------------------------------------------------*/ -void vPortEnterCritical( void ) -{ - /* Disable interrupts upto level 30. */ - #if configKERNEL_INTERRUPT_PRIORITY != 30 - #error configKERNEL_INTERRUPT_PRIORITY (set in FreeRTOSConfig.h) must match the ILM value set in the following line - 30 (0x1e) being the default. - #endif - - __asm(" STILM #1Eh "); - - - /* Now interrupts are disabled ulCriticalNesting can be accessed - directly. Increment ulCriticalNesting to keep a count of how many times - portENTER_CRITICAL() has been called. */ - ulCriticalNesting++; -} -/*-----------------------------------------------------------*/ - -void vPortExitCritical( void ) -{ - if( ulCriticalNesting > portNO_CRITICAL_NESTING ) - { - ulCriticalNesting--; - if( ulCriticalNesting == portNO_CRITICAL_NESTING ) - { - /* Enable all interrupts */ - __asm(" STILM #1Fh "); - } - } -} diff --git a/Source/portable/Softune/MB91460/portmacro.h b/Source/portable/Softune/MB91460/portmacro.h index 03a965f6e..941471fff 100644 --- a/Source/portable/Softune/MB91460/portmacro.h +++ b/Source/portable/Softune/MB91460/portmacro.h @@ -78,10 +78,14 @@ /*-----------------------------------------------------------*/ /* Critical section management. */ -void vPortEnterCritical( void ); -void vPortExitCritical( void ); -#define portENTER_CRITICAL() vPortEnterCritical() -#define portEXIT_CRITICAL() vPortExitCritical() +#define portENTER_CRITICAL() \ + __asm(" ST PS,@-R15 "); \ + __asm(" ANDCCR #0xef "); \ + + +#define portEXIT_CRITICAL() \ + __asm(" LD @R15+,PS "); \ + #define portDISABLE_INTERRUPTS() __DI(); #define portENABLE_INTERRUPTS() __EI();