Convert the remaining ports to use xTaskIncrementTick() in place of vTaskIncremenTick().

pull/4/head
Richard Barry 12 years ago
parent 2fc9d033c6
commit c04b074707

@ -415,16 +415,11 @@ keyword. */
TIM2->OC1R += s_nPulseLength; TIM2->OC1R += s_nPulseLength;
/* Increment the tick counter. */ /* Increment the tick counter. */
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
#if configUSE_PREEMPTION == 1
{ {
/* The new tick value might unblock a task. Ensure the highest task that /* Select a new task to run. */
is ready to execute is the task that will execute when the tick ISR
exits. */
vTaskSwitchContext(); vTaskSwitchContext();
} }
#endif
/* Clear the interrupt in the watchdog. */ /* Clear the interrupt in the watchdog. */
TIM2->SR &= ~TIM_FLAG_OC1; TIM2->SR &= ~TIM_FLAG_OC1;

@ -611,14 +611,11 @@ static void prvTickISR( void )
PIR1bits.CCP1IF = 0; PIR1bits.CCP1IF = 0;
/* Maintain the tick count. */ /* Maintain the tick count. */
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
#if configUSE_PREEMPTION == 1
{ {
/* Switch to the highest priority task that is ready to run. */ /* Switch to the highest priority task that is ready to run. */
vTaskSwitchContext(); vTaskSwitchContext();
} }
#endif
portRESTORE_CONTEXT(); portRESTORE_CONTEXT();
} }

@ -358,9 +358,9 @@ void __attribute__((__interrupt__, auto_psv)) _T1Interrupt( void )
/* Clear the timer interrupt. */ /* Clear the timer interrupt. */
IFS0bits.T1IF = 0; IFS0bits.T1IF = 0;
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
{
#if configUSE_PREEMPTION == 1
portYIELD(); portYIELD();
#endif }
} }

@ -220,10 +220,11 @@ is being used. */
static void __interrupt __far prvPreemptiveTick( void ) static void __interrupt __far prvPreemptiveTick( void )
{ {
/* Get the scheduler to update the task states following the tick. */ /* Get the scheduler to update the task states following the tick. */
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
{
/* Switch in the context of the next task to be run. */ /* Switch in the context of the next task to be run. */
portSWITCH_CONTEXT(); portSWITCH_CONTEXT();
}
/* Reset interrupt. */ /* Reset interrupt. */
outport( portEIO_REGISTER, portCLEAR_INTERRUPT ); outport( portEIO_REGISTER, portCLEAR_INTERRUPT );
@ -233,7 +234,8 @@ is being used. */
{ {
/* Same as preemptive tick, but the cooperative scheduler is being used /* Same as preemptive tick, but the cooperative scheduler is being used
so we don't have to switch in the context of the next task. */ so we don't have to switch in the context of the next task. */
vTaskIncrementTick(); xTaskIncrementTick();
/* Reset interrupt. */ /* Reset interrupt. */
outport( portEIO_REGISTER, portCLEAR_INTERRUPT ); outport( portEIO_REGISTER, portCLEAR_INTERRUPT );
} }

@ -204,10 +204,11 @@ is being used. */
static void __interrupt __far prvPreemptiveTick( void ) static void __interrupt __far prvPreemptiveTick( void )
{ {
/* Get the scheduler to update the task states following the tick. */ /* Get the scheduler to update the task states following the tick. */
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
{
/* Switch in the context of the next task to be run. */ /* Switch in the context of the next task to be run. */
portEND_SWITCHING_ISR(); portEND_SWITCHING_ISR();
}
/* Reset interrupt. */ /* Reset interrupt. */
outport( portEIO_REGISTER, portCLEAR_INTERRUPT ); outport( portEIO_REGISTER, portCLEAR_INTERRUPT );
@ -217,7 +218,8 @@ is being used. */
{ {
/* Same as preemptive tick, but the cooperative scheduler is being used /* Same as preemptive tick, but the cooperative scheduler is being used
so we don't have to switch in the context of the next task. */ so we don't have to switch in the context of the next task. */
vTaskIncrementTick(); xTaskIncrementTick();
/* Reset interrupt. */ /* Reset interrupt. */
outport( portEIO_REGISTER, portCLEAR_INTERRUPT ); outport( portEIO_REGISTER, portCLEAR_INTERRUPT );
} }

@ -236,7 +236,7 @@ void vPortEndScheduler( void )
{ {
/* Increment the tick count - this may make a delaying task ready /* Increment the tick count - this may make a delaying task ready
to run - but a context switch is not performed. */ to run - but a context switch is not performed. */
vTaskIncrementTick(); xTaskIncrementTick();
T0IR = portTIMER_MATCH_ISR_BIT; /* Clear the timer event */ T0IR = portTIMER_MATCH_ISR_BIT; /* Clear the timer event */
VICVectAddr = portCLEAR_VIC_INTERRUPT; /* Acknowledge the Interrupt */ VICVectAddr = portCLEAR_VIC_INTERRUPT; /* Acknowledge the Interrupt */

@ -54,7 +54,7 @@
INCLUDE portmacro.inc INCLUDE portmacro.inc
IMPORT vTaskSwitchContext IMPORT vTaskSwitchContext
IMPORT vTaskIncrementTick IMPORT xTaskIncrementTick
EXPORT vPortYieldProcessor EXPORT vPortYieldProcessor
EXPORT vPortStartFirstTask EXPORT vPortStartFirstTask
@ -127,7 +127,7 @@ vPreemptiveTick
portSAVE_CONTEXT ; Save the context of the current task. portSAVE_CONTEXT ; Save the context of the current task.
LDR R0, =vTaskIncrementTick ; Increment the tick count. LDR R0, =xTaskIncrementTick ; Increment the tick count.
MOV LR, PC ; This may make a delayed task ready MOV LR, PC ; This may make a delayed task ready
BX R0 ; to run. BX R0 ; to run.

@ -325,13 +325,6 @@ __asm void xPortPendSVHandler( void )
void xPortSysTickHandler( void ) void xPortSysTickHandler( void )
{ {
#if configUSE_PREEMPTION == 1
{
/* If using preemption, also force a context switch. */
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
}
#endif
/* Only reset the systick load register if configUSE_TICKLESS_IDLE is set to /* 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 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 value other than 0 or 1 then a timer other than the SysTick is being used
@ -342,7 +335,11 @@ void xPortSysTickHandler( void )
( void ) portSET_INTERRUPT_MASK_FROM_ISR(); ( void ) portSET_INTERRUPT_MASK_FROM_ISR();
{ {
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
{
/* Pend a context switch. */
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
}
} }
portCLEAR_INTERRUPT_MASK_FROM_ISR( 0 ); portCLEAR_INTERRUPT_MASK_FROM_ISR( 0 );
} }

@ -388,13 +388,6 @@ __asm void xPortPendSVHandler( void )
void xPortSysTickHandler( void ) void xPortSysTickHandler( void )
{ {
#if configUSE_PREEMPTION == 1
{
/* If using preemption, also force a context switch. */
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
}
#endif
/* Only reset the systick load register if configUSE_TICKLESS_IDLE is set to /* 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 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 value other than 0 or 1 then a timer other than the SysTick is being used
@ -405,7 +398,11 @@ void xPortSysTickHandler( void )
( void ) portSET_INTERRUPT_MASK_FROM_ISR(); ( void ) portSET_INTERRUPT_MASK_FROM_ISR();
{ {
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
{
/* Pend a context switch. */
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
}
} }
portCLEAR_INTERRUPT_MASK_FROM_ISR( 0 ); portCLEAR_INTERRUPT_MASK_FROM_ISR( 0 );
} }

@ -350,17 +350,13 @@ void prvTickISR( void )
necessitates. */ necessitates. */
set_ipl( configMAX_SYSCALL_INTERRUPT_PRIORITY ); set_ipl( configMAX_SYSCALL_INTERRUPT_PRIORITY );
{ {
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
{
taskYIELD();
}
} }
set_ipl( configKERNEL_INTERRUPT_PRIORITY ); set_ipl( configKERNEL_INTERRUPT_PRIORITY );
/* Only select a new task if the preemptive scheduler is being used. */
#if( configUSE_PREEMPTION == 1 )
{
taskYIELD();
}
#endif
#if configUSE_TICKLESS_IDLE == 1 #if configUSE_TICKLESS_IDLE == 1
{ {
/* The CPU woke because of a tick. */ /* The CPU woke because of a tick. */

@ -267,16 +267,12 @@ void vTickISR( void )
necessitates. */ necessitates. */
set_ipl( configMAX_SYSCALL_INTERRUPT_PRIORITY ); set_ipl( configMAX_SYSCALL_INTERRUPT_PRIORITY );
{ {
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
{
taskYIELD();
}
} }
set_ipl( configKERNEL_INTERRUPT_PRIORITY ); set_ipl( configKERNEL_INTERRUPT_PRIORITY );
/* Only select a new task if the preemptive scheduler is being used. */
#if( configUSE_PREEMPTION == 1 )
{
taskYIELD();
}
#endif
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

@ -268,14 +268,12 @@ void vTickISR( void )
necessitates. */ necessitates. */
set_ipl( configMAX_SYSCALL_INTERRUPT_PRIORITY ); set_ipl( configMAX_SYSCALL_INTERRUPT_PRIORITY );
{ {
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
{
taskYIELD();
}
} }
set_ipl( configKERNEL_INTERRUPT_PRIORITY ); set_ipl( configKERNEL_INTERRUPT_PRIORITY );
/* Only select a new task if the preemptive scheduler is being used. */
#if( configUSE_PREEMPTION == 1 )
taskYIELD();
#endif
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

@ -53,7 +53,7 @@
.import _pxCurrentTCB .import _pxCurrentTCB
.import _vTaskSwitchContext .import _vTaskSwitchContext
.import _vTaskIncrementTick .import _xTaskIncrementTick
.export _vPortStartFirstTask .export _vPortStartFirstTask
.export _ulPortGetGBR .export _ulPortGetGBR
@ -89,7 +89,7 @@ _vPortPreemptiveTick
portSAVE_CONTEXT portSAVE_CONTEXT
mov.l #_vTaskIncrementTick, r0 mov.l #_xTaskIncrementTick, r0
jsr @r0 jsr @r0
nop nop
@ -105,7 +105,7 @@ _vPortCooperativeTick
portSAVE_CONTEXT portSAVE_CONTEXT
mov.l #_vTaskIncrementTick, r0 mov.l #_xTaskIncrementTick, r0
jsr @r0 jsr @r0
nop nop

@ -89,7 +89,7 @@
_vTickISR: _vTickISR:
portSAVE_CONTEXT portSAVE_CONTEXT
call #_vTaskIncrementTick call #_xTaskIncrementTick
#if configUSE_PREEMPTION == 1 #if configUSE_PREEMPTION == 1
call #_vTaskSwitchContext call #_vTaskSwitchContext

@ -405,8 +405,10 @@ void vPortYield( void ) _naked
portSAVE_CONTEXT(); portSAVE_CONTEXT();
portCOPY_STACK_TO_XRAM(); portCOPY_STACK_TO_XRAM();
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
vTaskSwitchContext(); {
vTaskSwitchContext();
}
portCLEAR_INTERRUPT_FLAG(); portCLEAR_INTERRUPT_FLAG();
portCOPY_XRAM_TO_STACK(); portCOPY_XRAM_TO_STACK();
@ -418,7 +420,7 @@ void vPortYield( void ) _naked
/* When using the cooperative scheduler the timer 2 ISR is only /* When using the cooperative scheduler the timer 2 ISR is only
required to increment the RTOS tick count. */ required to increment the RTOS tick count. */
vTaskIncrementTick(); xTaskIncrementTick();
portCLEAR_INTERRUPT_FLAG(); portCLEAR_INTERRUPT_FLAG();
} }
#endif #endif

@ -292,7 +292,7 @@ const unsigned short usReloadValue = ( unsigned short ) ( ( ( configPER_CLOCK_HZ
LDI #_tmcsr0, R0 LDI #_tmcsr0, R0
AND R1,@R0 ;Clear RLT0 interrupt flag AND R1,@R0 ;Clear RLT0 interrupt flag
CALL32 _vTaskIncrementTick,R12 ;Increment Tick CALL32 _xTaskIncrementTick,R12 ;Increment Tick
CALL32 _vTaskSwitchContext,R12 ;Switch context if required CALL32 _vTaskSwitchContext,R12 ;Switch context if required
ANDCCR #0xEF ;Disable Interrupts ANDCCR #0xEF ;Disable Interrupts
@ -314,7 +314,7 @@ const unsigned short usReloadValue = ( unsigned short ) ( ( ( configPER_CLOCK_HZ
{ {
/* Clear RLT0 interrupt flag */ /* Clear RLT0 interrupt flag */
TMCSR0_UF = 0; TMCSR0_UF = 0;
vTaskIncrementTick(); xTaskIncrementTick();
} }
#endif #endif

@ -474,8 +474,10 @@ void vPortEndScheduler( void )
/* Increment the tick count then switch to the highest priority task /* Increment the tick count then switch to the highest priority task
that is ready to run. */ that is ready to run. */
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
vTaskSwitchContext(); {
vTaskSwitchContext();
}
/* Disable interrupts so that portRESTORE_CONTEXT() is not interrupted */ /* Disable interrupts so that portRESTORE_CONTEXT() is not interrupted */
__DI(); __DI();
@ -499,7 +501,7 @@ void vPortEndScheduler( void )
/* Clear RLT0 interrupt flag */ /* Clear RLT0 interrupt flag */
TMCSR0_UF = 0; TMCSR0_UF = 0;
vTaskIncrementTick(); xTaskIncrementTick();
} }
#endif #endif

@ -237,14 +237,13 @@ void SysTick_Handler( void )
{ {
unsigned long ulDummy; 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(); ulDummy = portSET_INTERRUPT_MASK_FROM_ISR();
{ {
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
{
/* Pend a context switch. */
*(portNVIC_INT_CTRL) = portNVIC_PENDSVSET;
}
} }
portCLEAR_INTERRUPT_MASK_FROM_ISR( ulDummy ); portCLEAR_INTERRUPT_MASK_FROM_ISR( ulDummy );
} }

@ -109,9 +109,7 @@ Changes from V3.0.1
/* /*
* Maintain the tick count. * Maintain the tick count.
*/ */
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
#if configUSE_PREEMPTION == 1
{ {
/* /*
* Ask for a switch to the highest priority task * Ask for a switch to the highest priority task
@ -119,7 +117,6 @@ Changes from V3.0.1
*/ */
uxSwitchRequested = pdTRUE; uxSwitchRequested = pdTRUE;
} }
#endif
} }
} }

@ -197,10 +197,11 @@ kernel is being used. */
static void __interrupt __far prvPreemptiveTick( void ) static void __interrupt __far prvPreemptiveTick( void )
{ {
/* Get the scheduler to update the task states following the tick. */ /* Get the scheduler to update the task states following the tick. */
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
{
/* Switch in the context of the next task to be run. */ /* Switch in the context of the next task to be run. */
portSWITCH_CONTEXT(); portSWITCH_CONTEXT();
}
/* Reset the PIC ready for the next time. */ /* Reset the PIC ready for the next time. */
portRESET_PIC(); portRESET_PIC();
@ -210,7 +211,7 @@ kernel is being used. */
{ {
/* Same as preemptive tick, but the cooperative scheduler is being used /* Same as preemptive tick, but the cooperative scheduler is being used
so we don't have to switch in the context of the next task. */ so we don't have to switch in the context of the next task. */
vTaskIncrementTick(); xTaskIncrementTick();
portRESET_PIC(); portRESET_PIC();
} }
#endif #endif

@ -228,10 +228,11 @@ is being used. */
static void __interrupt __far prvPreemptiveTick( void ) static void __interrupt __far prvPreemptiveTick( void )
{ {
/* Get the scheduler to update the task states following the tick. */ /* Get the scheduler to update the task states following the tick. */
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
{
/* Switch in the context of the next task to be run. */ /* Switch in the context of the next task to be run. */
portSWITCH_CONTEXT(); portSWITCH_CONTEXT();
}
/* Reset the PIC ready for the next time. */ /* Reset the PIC ready for the next time. */
prvPortResetPIC(); prvPortResetPIC();
@ -241,7 +242,7 @@ is being used. */
{ {
/* Same as preemptive tick, but the cooperative scheduler is being used /* Same as preemptive tick, but the cooperative scheduler is being used
so we don't have to switch in the context of the next task. */ so we don't have to switch in the context of the next task. */
vTaskIncrementTick(); xTaskIncrementTick();
prvPortResetPIC(); prvPortResetPIC();
} }
#endif #endif

Loading…
Cancel
Save