From: richardbarry Date: Sun, 29 Aug 2010 17:57:32 +0000 (+0000) Subject: Added a critical section around the call to vTaskIncrementTick() in all the RX ports. X-Git-Tag: V6.1.0~63 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=222e491f335debc1aa8c3544887876caa6065155;p=freertos Added a critical section around the call to vTaskIncrementTick() in all the RX ports. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1072 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/Source/portable/GCC/RX600/port.c b/Source/portable/GCC/RX600/port.c index c5d4b69b4..e38964133 100644 --- a/Source/portable/GCC/RX600/port.c +++ b/Source/portable/GCC/RX600/port.c @@ -72,6 +72,14 @@ PSW is set with U and I set, and PM and IPL clear. */ #define portINITIAL_PSW ( ( portSTACK_TYPE ) 0x00030000 ) #define portINITIAL_FPSW ( ( portSTACK_TYPE ) 0x00000100 ) +/* These macros allow a critical section to be added around the call to +vTaskIncrementTick(), which is only ever called from interrupts at the kernel +priority - ie a known priority. Therefore these local macros are a slight +optimisation compared to calling the global SET/CLEAR_INTERRUPT_MASK macros, +which would require the old IPL to be read first and stored in a local variable. */ +#define portDISABLE_INTERRUPTS_FROM_KERNEL_ISR() __asm volatile ( "MVTIPL %0" ::"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY) ) +#define portENABLE_INTERRUPTS_FROM_KERNEL_ISR() __asm volatile ( "MVTIPL %0" ::"i"(configKERNEL_INTERRUPT_PRIORITY) ) + /*-----------------------------------------------------------*/ /* @@ -201,8 +209,12 @@ void vTickISR( void ) __asm volatile( "SETPSW I" ); /* Increment the tick, and perform any processing the new tick value - necessitates. */ - vTaskIncrementTick(); + necessitates. Ensure IPL is at the max syscall value first. */ + portDISABLE_INTERRUPTS_FROM_KERNEL_ISR(); + { + vTaskIncrementTick(); + } + portENABLE_INTERRUPTS_FROM_KERNEL_ISR(); /* Only select a new task if the preemptive scheduler is being used. */ #if( configUSE_PREEMPTION == 1 ) diff --git a/Source/portable/IAR/RX600/port.c b/Source/portable/IAR/RX600/port.c index 6b5701657..83453531c 100644 --- a/Source/portable/IAR/RX600/port.c +++ b/Source/portable/IAR/RX600/port.c @@ -196,7 +196,11 @@ __interrupt void vTickISR( void ) /* Increment the tick, and perform any processing the new tick value necessitates. */ - vTaskIncrementTick(); + __set_interrupt_level( configMAX_SYSCALL_INTERRUPT_PRIORITY ); + { + vTaskIncrementTick(); + } + __set_interrupt_level( configKERNEL_INTERRUPT_PRIORITY ); /* Only select a new task if the preemptive scheduler is being used. */ #if( configUSE_PREEMPTION == 1 ) diff --git a/Source/portable/Renesas/RX600/port.c b/Source/portable/Renesas/RX600/port.c index 294f6a067..bc063ad3b 100644 --- a/Source/portable/Renesas/RX600/port.c +++ b/Source/portable/Renesas/RX600/port.c @@ -237,7 +237,11 @@ void vTickISR( void ) { /* Increment the tick, and perform any processing the new tick value necessitates. */ - vTaskIncrementTick(); + set_ipl( configMAX_SYSCALL_INTERRUPT_PRIORITY ); + { + vTaskIncrementTick(); + } + set_ipl( configKERNEL_INTERRUPT_PRIORITY ); /* Only select a new task if the preemptive scheduler is being used. */ #if( configUSE_PREEMPTION == 1 )