From: richardbarry Date: Thu, 6 Jun 2013 16:06:48 +0000 (+0000) Subject: Convert mpre ports to use xTaskIncrementTick() in place of vTaskIncrementTick(). X-Git-Tag: V7.5.0~74 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=44c065f844dcd5016758b00b28c21a4f160aed09;p=freertos Convert mpre ports to use xTaskIncrementTick() in place of vTaskIncrementTick(). git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1916 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/FreeRTOS/Source/portable/GCC/MSP430F449/port.c b/FreeRTOS/Source/portable/GCC/MSP430F449/port.c index 2f5eb42f9..3c7d94ddf 100644 --- a/FreeRTOS/Source/portable/GCC/MSP430F449/port.c +++ b/FreeRTOS/Source/portable/GCC/MSP430F449/port.c @@ -348,8 +348,10 @@ static void prvSetupTimerInterrupt( void ) /* Increment the tick count then switch to the highest priority task that is ready to run. */ - vTaskIncrementTick(); - vTaskSwitchContext(); + if( xTaskIncrementTick() != pdFALSE ) + { + vTaskSwitchContext(); + } /* Restore the context of the new task. */ portRESTORE_CONTEXT(); @@ -365,7 +367,7 @@ static void prvSetupTimerInterrupt( void ) interrupt (TIMERA0_VECTOR) prvTickISR( void ); interrupt (TIMERA0_VECTOR) prvTickISR( void ) { - vTaskIncrementTick(); + xTaskIncrementTick(); } #endif diff --git a/FreeRTOS/Source/portable/GCC/NiosII/port.c b/FreeRTOS/Source/portable/GCC/NiosII/port.c index 1c29c4bce..c5f12792a 100644 --- a/FreeRTOS/Source/portable/GCC/NiosII/port.c +++ b/FreeRTOS/Source/portable/GCC/NiosII/port.c @@ -204,14 +204,12 @@ void prvSetupTimerInterrupt( void ) void vPortSysTickHandler( void * context, alt_u32 id ) { - /* Increment the Kernel Tick. */ - vTaskIncrementTick(); - - /* If using preemption, also force a context switch. */ - #if configUSE_PREEMPTION == 1 + /* Increment the kernel tick. */ + if( xTaskIncrementTick() != pdFALSE ) + { vTaskSwitchContext(); - #endif - + } + /* Clear the interrupt. */ IOWR_ALTERA_AVALON_TIMER_STATUS( SYS_CLK_BASE, ~ALTERA_AVALON_TIMER_STATUS_TO_MSK ); } diff --git a/FreeRTOS/Source/portable/GCC/PPC405_Xilinx/portasm.S b/FreeRTOS/Source/portable/GCC/PPC405_Xilinx/portasm.S index 65ad8b2c0..ee686a363 100644 --- a/FreeRTOS/Source/portable/GCC/PPC405_Xilinx/portasm.S +++ b/FreeRTOS/Source/portable/GCC/PPC405_Xilinx/portasm.S @@ -76,7 +76,7 @@ .extern pxCurrentTCB .extern vTaskSwitchContext - .extern vTaskIncrementTick + .extern xTaskIncrementTick .extern vPortISRHandler .global vPortStartFirstTask @@ -203,7 +203,7 @@ vPortYield: vPortTickISR: portSAVE_STACK_POINTER_AND_LR - bl vTaskIncrementTick + bl xTaskIncrementTick #if configUSE_PREEMPTION == 1 bl vTaskSwitchContext diff --git a/FreeRTOS/Source/portable/GCC/PPC440_Xilinx/portasm.S b/FreeRTOS/Source/portable/GCC/PPC440_Xilinx/portasm.S index 65ad8b2c0..ee686a363 100644 --- a/FreeRTOS/Source/portable/GCC/PPC440_Xilinx/portasm.S +++ b/FreeRTOS/Source/portable/GCC/PPC440_Xilinx/portasm.S @@ -76,7 +76,7 @@ .extern pxCurrentTCB .extern vTaskSwitchContext - .extern vTaskIncrementTick + .extern xTaskIncrementTick .extern vPortISRHandler .global vPortStartFirstTask @@ -203,7 +203,7 @@ vPortYield: vPortTickISR: portSAVE_STACK_POINTER_AND_LR - bl vTaskIncrementTick + bl xTaskIncrementTick #if configUSE_PREEMPTION == 1 bl vTaskSwitchContext diff --git a/FreeRTOS/Source/portable/GCC/RX100/port.c b/FreeRTOS/Source/portable/GCC/RX100/port.c index 3180202fc..dbd8a5b4e 100644 --- a/FreeRTOS/Source/portable/GCC/RX100/port.c +++ b/FreeRTOS/Source/portable/GCC/RX100/port.c @@ -111,7 +111,7 @@ CMT. */ #endif /* These macros allow a critical section to be added around the call to -vTaskIncrementTick(), which is only ever called from interrupts at the kernel +xTaskIncrementTick(), 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. */ @@ -439,15 +439,13 @@ void vPortTickISR( void ) necessitates. Ensure IPL is at the max syscall value first. */ portDISABLE_INTERRUPTS_FROM_KERNEL_ISR(); { - vTaskIncrementTick(); + if( xTaskIncrementTick() != pdFALSE ) + { + taskYIELD(); + } } portENABLE_INTERRUPTS_FROM_KERNEL_ISR(); - /* Only select a new task if the preemptive scheduler is being used. */ - #if( configUSE_PREEMPTION == 1 ) - taskYIELD(); - #endif - #if configUSE_TICKLESS_IDLE == 1 { /* The CPU woke because of a tick. */ diff --git a/FreeRTOS/Source/portable/GCC/RX600/port.c b/FreeRTOS/Source/portable/GCC/RX600/port.c index fe6bd1949..29731368b 100644 --- a/FreeRTOS/Source/portable/GCC/RX600/port.c +++ b/FreeRTOS/Source/portable/GCC/RX600/port.c @@ -94,7 +94,7 @@ PSW is set with U and I set, and PM and IPL clear. */ #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 +xTaskIncrementTick(), 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. */ @@ -364,14 +364,12 @@ void vTickISR( void ) necessitates. Ensure IPL is at the max syscall value first. */ portDISABLE_INTERRUPTS_FROM_KERNEL_ISR(); { - vTaskIncrementTick(); + if( TaskIncrementTick() != pdFALSE ) + { + taskYIELD(); + } } portENABLE_INTERRUPTS_FROM_KERNEL_ISR(); - - /* Only select a new task if the preemptive scheduler is being used. */ - #if( configUSE_PREEMPTION == 1 ) - taskYIELD(); - #endif } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/STR75x/portISR.c b/FreeRTOS/Source/portable/GCC/STR75x/portISR.c index f08069b02..dd1b9b5d1 100644 --- a/FreeRTOS/Source/portable/GCC/STR75x/portISR.c +++ b/FreeRTOS/Source/portable/GCC/STR75x/portISR.c @@ -137,11 +137,10 @@ void vPortTickISR( void ) { /* Increment the RTOS tick count, then look for the highest priority task that is ready to run. */ - vTaskIncrementTick(); - - #if configUSE_PREEMPTION == 1 + if( xTaskIncrementTick() != pdFALSE ) + { vTaskSwitchContext(); - #endif + } /* Ready for the next interrupt. */ TB_ClearITPendingBit( TB_IT_Update ); diff --git a/FreeRTOS/Source/portable/GCC/TriCore_1782/port.c b/FreeRTOS/Source/portable/GCC/TriCore_1782/port.c index 9616d4ab9..f66016e24 100644 --- a/FreeRTOS/Source/portable/GCC/TriCore_1782/port.c +++ b/FreeRTOS/Source/portable/GCC/TriCore_1782/port.c @@ -335,6 +335,7 @@ unsigned long ulSavedInterruptMask; unsigned long *pxUpperCSA = NULL; unsigned long xUpperCSA = 0UL; extern volatile unsigned long *pxCurrentTCB; +long lYieldRequired; /* Just to avoid compiler warnings about unused parameters. */ ( void ) iArg; @@ -365,11 +366,11 @@ extern volatile unsigned long *pxCurrentTCB; ulSavedInterruptMask = portSET_INTERRUPT_MASK_FROM_ISR(); { /* Increment the Tick. */ - vTaskIncrementTick(); + lYieldRequired = xTaskIncrementTick(); } portCLEAR_INTERRUPT_MASK_FROM_ISR( ulSavedInterruptMask ); - #if configUSE_PREEMPTION == 1 + if( lYieldRequired != pdFALSE ) { /* Save the context of a task. The upper context is automatically saved when entering a trap or interrupt. @@ -400,7 +401,6 @@ extern volatile unsigned long *pxCurrentTCB; CPU_SRC0.bits.SETR = 0; _isync(); } - #endif } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/78K0R/portasm.s26 b/FreeRTOS/Source/portable/IAR/78K0R/portasm.s26 index 536f91f89..30255ee8f 100644 --- a/FreeRTOS/Source/portable/IAR/78K0R/portasm.s26 +++ b/FreeRTOS/Source/portable/IAR/78K0R/portasm.s26 @@ -68,7 +68,7 @@ ; Functions used by scheduler ;------------------------------------------------------------------------------ EXTERN vTaskSwitchContext - EXTERN vTaskIncrementTick + EXTERN xTaskIncrementTick ; Tick ISR Prototype ;------------------------------------------------------------------------------ @@ -133,7 +133,7 @@ vPortStart: MD_INTTM05: portSAVE_CONTEXT ; Save the context of the current task. - call vTaskIncrementTick ; Call the timer tick function. + call xTaskIncrementTick ; Call the timer tick function. #if configUSE_PREEMPTION == 1 call vTaskSwitchContext ; Call the scheduler to select the next task. #endif diff --git a/FreeRTOS/Source/portable/IAR/ARM_CM0/port.c b/FreeRTOS/Source/portable/IAR/ARM_CM0/port.c index 93c415d03..c5a1ff085 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CM0/port.c +++ b/FreeRTOS/Source/portable/IAR/ARM_CM0/port.c @@ -210,14 +210,14 @@ void xPortSysTickHandler( void ) { unsigned long ulDummy; - /* If using preemption, also force a context switch. */ - #if configUSE_PREEMPTION == 1 - *(portNVIC_INT_CTRL) = portNVIC_PENDSVSET; - #endif - ulDummy = portSET_INTERRUPT_MASK_FROM_ISR(); { - vTaskIncrementTick(); + /* Increment the RTOS tick. */ + if( xTaskIncrementTick() != pdFALSE ) + { + /* Pend a context switch. */ + *(portNVIC_INT_CTRL) = portNVIC_PENDSVSET; + } } portCLEAR_INTERRUPT_MASK_FROM_ISR( ulDummy ); } diff --git a/FreeRTOS/Source/portable/IAR/ARM_CM4F/port.c b/FreeRTOS/Source/portable/IAR/ARM_CM4F/port.c index a9264f3fc..a7e28ce30 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CM4F/port.c +++ b/FreeRTOS/Source/portable/IAR/ARM_CM4F/port.c @@ -275,11 +275,6 @@ void vPortExitCritical( void ) void xPortSysTickHandler( void ) { - /* If using preemption, also force a context switch. */ - #if configUSE_PREEMPTION == 1 - portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; - #endif - /* Only reset the systick load register if configUSE_TICKLESS_IDLE is set to 1. If it is set to 0 tickless idle is not being used. If it is set to a value other than 0 or 1 then a timer other than the SysTick is being used @@ -290,7 +285,12 @@ void xPortSysTickHandler( void ) ( void ) portSET_INTERRUPT_MASK_FROM_ISR(); { - vTaskIncrementTick(); + /* Increment the RTOS tick. */ + if( xTaskIncrementTick() != pdFALSE ) + { + /* Pend a context switch. */ + portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; + } } portCLEAR_INTERRUPT_MASK_FROM_ISR( 0 ); }