Convert some ports to use xTaskIncrementTick() in place of vTaskIncrementTick().

Move DSB instructions to before WFI instructions in line with ARM recommendations.
This commit is contained in:
Richard Barry 2013-06-06 15:46:40 +00:00
parent 4e9374ad90
commit 686d190798
27 changed files with 128 additions and 142 deletions

View File

@ -195,10 +195,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. */
portRESET_PIC(); portRESET_PIC();
@ -208,7 +209,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();
portRESET_PIC(); portRESET_PIC();
} }
#endif #endif

View File

@ -216,10 +216,11 @@ scheduler 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();
@ -229,7 +230,7 @@ scheduler 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

View File

@ -57,7 +57,7 @@
.include data_model.h .include data_model.h
.global vTaskIncrementTick .global xTaskIncrementTick
.global vTaskSwitchContext .global vTaskSwitchContext
.global vPortSetupTimerInterrupt .global vPortSetupTimerInterrupt
.global pxCurrentTCB .global pxCurrentTCB
@ -112,7 +112,7 @@ vPortPreemptiveTickISR: .asmfunc
push.w sr push.w sr
portSAVE_CONTEXT portSAVE_CONTEXT
call_x #vTaskIncrementTick call_x #xTaskIncrementTick
call_x #vTaskSwitchContext call_x #vTaskSwitchContext
portRESTORE_CONTEXT portRESTORE_CONTEXT
@ -128,7 +128,7 @@ vPortCooperativeTickISR: .asmfunc
push.w sr push.w sr
portSAVE_CONTEXT portSAVE_CONTEXT
call_x #vTaskIncrementTick call_x #xTaskIncrementTick
portRESTORE_CONTEXT portRESTORE_CONTEXT

View File

@ -220,16 +220,11 @@ unsigned long ulSavedInterruptMask;
/* Increment the RTOS tick. */ /* Increment the RTOS tick. */
ulSavedInterruptMask = portSET_INTERRUPT_MASK_FROM_ISR(); ulSavedInterruptMask = portSET_INTERRUPT_MASK_FROM_ISR();
{ {
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
}
portCLEAR_INTERRUPT_MASK_FROM_ISR( ulSavedInterruptMask );
/* If we are using the pre-emptive scheduler then also request a
context switch as incrementing the tick could have unblocked a task. */
#if configUSE_PREEMPTION == 1
{ {
taskYIELD(); taskYIELD();
} }
#endif }
portCLEAR_INTERRUPT_MASK_FROM_ISR( ulSavedInterruptMask );
} }

View File

@ -260,11 +260,10 @@ void interrupt vPortTickInterrupt( void )
portSAVE_CONTEXT(); portSAVE_CONTEXT();
/* Increment the tick ... */ /* Increment the tick ... */
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
{
/* ... then see if the new tick value has necessitated a
context switch. */
vTaskSwitchContext(); vTaskSwitchContext();
}
TFLG1 = 1; TFLG1 = 1;
@ -274,7 +273,7 @@ void interrupt vPortTickInterrupt( void )
} }
#else #else
{ {
vTaskIncrementTick(); xTaskIncrementTick();
TFLG1 = 1; TFLG1 = 1;
} }
#endif #endif

View File

@ -161,7 +161,7 @@ void vPortYieldProcessor( void )
/* Clear tick timer interrupt indication. */ /* Clear tick timer interrupt indication. */
ulDummy = portTIMER_REG_BASE_PTR->TC_SR; ulDummy = portTIMER_REG_BASE_PTR->TC_SR;
vTaskIncrementTick(); xTaskIncrementTick();
/* Acknowledge the interrupt at AIC level... */ /* Acknowledge the interrupt at AIC level... */
AT91C_BASE_AIC->AIC_EOICR = portCLEAR_AIC_INTERRUPT; AT91C_BASE_AIC->AIC_EOICR = portCLEAR_AIC_INTERRUPT;
@ -186,8 +186,10 @@ void vPortYieldProcessor( void )
/* Increment the RTOS tick count, then look for the highest priority /* Increment the RTOS tick count, then look for the highest priority
task that is ready to run. */ task that is ready to run. */
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
{
vTaskSwitchContext(); vTaskSwitchContext();
}
/* Acknowledge the interrupt at AIC level... */ /* Acknowledge the interrupt at AIC level... */
AT91C_BASE_AIC->AIC_EOICR = portCLEAR_AIC_INTERRUPT; AT91C_BASE_AIC->AIC_EOICR = portCLEAR_AIC_INTERRUPT;

View File

@ -163,7 +163,7 @@ void vPortYieldProcessor( void )
/* Increment the tick count - which may wake some tasks but as the /* Increment the tick count - which may wake some tasks but as the
preemptive scheduler is not being used any woken task is not given preemptive scheduler is not being used any woken task is not given
processor time no matter what its priority. */ processor time no matter what its priority. */
vTaskIncrementTick(); xTaskIncrementTick();
/* Clear the PIT interrupt. */ /* Clear the PIT interrupt. */
ulDummy = AT91C_BASE_PITC->PITC_PIVR; ulDummy = AT91C_BASE_PITC->PITC_PIVR;
@ -183,10 +183,11 @@ void vPortYieldProcessor( void )
portSAVE_CONTEXT(); portSAVE_CONTEXT();
/* Increment the tick count - this may wake a task. */ /* Increment the tick count - this may wake a task. */
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
{
/* Find the highest priority task that is ready to run. */ /* Find the highest priority task that is ready to run. */
vTaskSwitchContext(); vTaskSwitchContext();
}
/* End the interrupt in the AIC. */ /* End the interrupt in the AIC. */
AT91C_BASE_AIC->AIC_EOICR = AT91C_BASE_PITC->PITC_PIVR;; AT91C_BASE_AIC->AIC_EOICR = AT91C_BASE_PITC->PITC_PIVR;;

View File

@ -166,7 +166,7 @@ void vTickISR( void )
/* Increment the RTOS tick count, then look for the highest priority /* Increment the RTOS tick count, then look for the highest priority
task that is ready to run. */ task that is ready to run. */
__asm volatile( "bl vTaskIncrementTick" ); __asm volatile( "bl xTaskIncrementTick" );
#if configUSE_PREEMPTION == 1 #if configUSE_PREEMPTION == 1
__asm volatile( "bl vTaskSwitchContext" ); __asm volatile( "bl vTaskSwitchContext" );

View File

@ -150,7 +150,7 @@ void vPortYieldProcessor( void )
void vNonPreemptiveTick( void ) __attribute__ ((interrupt ("IRQ"))); void vNonPreemptiveTick( void ) __attribute__ ((interrupt ("IRQ")));
void vNonPreemptiveTick( void ) void vNonPreemptiveTick( void )
{ {
vTaskIncrementTick(); xTaskIncrementTick();
T0IR = 2; T0IR = 2;
VICVectAddr = portCLEAR_VIC_INTERRUPT; VICVectAddr = portCLEAR_VIC_INTERRUPT;
} }
@ -167,7 +167,7 @@ void vPortYieldProcessor( void )
/* Increment the RTOS tick count, then look for the highest priority /* Increment the RTOS tick count, then look for the highest priority
task that is ready to run. */ task that is ready to run. */
__asm volatile( "bl vTaskIncrementTick" ); __asm volatile( "bl xTaskIncrementTick" );
__asm volatile( "bl vTaskSwitchContext" ); __asm volatile( "bl vTaskSwitchContext" );
/* Ready for the next interrupt. */ /* Ready for the next interrupt. */

View File

@ -293,14 +293,14 @@ void xPortSysTickHandler( 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(); /* Increment the RTOS tick. */
if( xTaskIncrementTick() != pdFALSE )
{
/* Pend a context switch. */
*(portNVIC_INT_CTRL) = portNVIC_PENDSVSET;
}
} }
portCLEAR_INTERRUPT_MASK_FROM_ISR( ulDummy ); portCLEAR_INTERRUPT_MASK_FROM_ISR( ulDummy );
} }

View File

@ -354,11 +354,6 @@ void xPortPendSVHandler( void )
void xPortSysTickHandler( 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 /* 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
@ -367,9 +362,18 @@ void xPortSysTickHandler( void )
portNVIC_SYSTICK_LOAD_REG = ulTimerReloadValueForOneTick; portNVIC_SYSTICK_LOAD_REG = ulTimerReloadValueForOneTick;
#endif #endif
/* The SysTick runs at the lowest interrupt priority, so when this interrupt
executes all interrupts must be unmasked. There is therefore no need to
save and then restore the interrupt mask value as its value is already
known. */
( void ) portSET_INTERRUPT_MASK_FROM_ISR(); ( void ) portSET_INTERRUPT_MASK_FROM_ISR();
{ {
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
{
/* A context switch is required. Context switching is performed in
the PendSV interrupt. Pend the PendSV interrupt. */
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
}
} }
portCLEAR_INTERRUPT_MASK_FROM_ISR( 0 ); portCLEAR_INTERRUPT_MASK_FROM_ISR( 0 );
} }
@ -444,8 +448,8 @@ void xPortSysTickHandler( void )
configPRE_SLEEP_PROCESSING( xModifiableIdleTime ); configPRE_SLEEP_PROCESSING( xModifiableIdleTime );
if( xModifiableIdleTime > 0 ) if( xModifiableIdleTime > 0 )
{ {
__asm volatile( "wfi" );
__asm volatile( "dsb" ); __asm volatile( "dsb" );
__asm volatile( "wfi" );
__asm volatile( "isb" ); __asm volatile( "isb" );
} }
configPOST_SLEEP_PROCESSING( xExpectedIdleTime ); configPOST_SLEEP_PROCESSING( xExpectedIdleTime );

View File

@ -452,14 +452,14 @@ void xPortSysTickHandler( 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(); /* Increment the RTOS tick. */
if( xTaskIncrementTick() != pdFALSE )
{
/* Pend a context switch. */
*(portNVIC_INT_CTRL) = portNVIC_PENDSVSET;
}
} }
portCLEAR_INTERRUPT_MASK_FROM_ISR( ulDummy ); portCLEAR_INTERRUPT_MASK_FROM_ISR( ulDummy );
} }

View File

@ -387,11 +387,6 @@ void xPortPendSVHandler( void )
void xPortSysTickHandler( 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 /* 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
@ -402,7 +397,12 @@ void xPortSysTickHandler( void )
( void ) portSET_INTERRUPT_MASK_FROM_ISR(); ( void ) portSET_INTERRUPT_MASK_FROM_ISR();
{ {
vTaskIncrementTick(); /* Increment the RTOS tick count. */
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 );
} }
@ -477,8 +477,8 @@ void xPortSysTickHandler( void )
configPRE_SLEEP_PROCESSING( xModifiableIdleTime ); configPRE_SLEEP_PROCESSING( xModifiableIdleTime );
if( xModifiableIdleTime > 0 ) if( xModifiableIdleTime > 0 )
{ {
__asm volatile( "wfi" );
__asm volatile( "dsb" ); __asm volatile( "dsb" );
__asm volatile( "wfi" );
__asm volatile( "isb" ); __asm volatile( "isb" );
} }
configPOST_SLEEP_PROCESSING( xExpectedIdleTime ); configPOST_SLEEP_PROCESSING( xExpectedIdleTime );

View File

@ -393,8 +393,10 @@ void vPortYieldFromTick( void ) __attribute__ ( ( naked ) );
void vPortYieldFromTick( void ) void vPortYieldFromTick( void )
{ {
portSAVE_CONTEXT(); portSAVE_CONTEXT();
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
{
vTaskSwitchContext(); vTaskSwitchContext();
}
portRESTORE_CONTEXT(); portRESTORE_CONTEXT();
asm volatile ( "ret" ); asm volatile ( "ret" );
@ -463,7 +465,7 @@ unsigned char ucHighByte, ucLowByte;
void SIG_OUTPUT_COMPARE1A( void ) __attribute__ ( ( signal ) ); void SIG_OUTPUT_COMPARE1A( void ) __attribute__ ( ( signal ) );
void SIG_OUTPUT_COMPARE1A( void ) void SIG_OUTPUT_COMPARE1A( void )
{ {
vTaskIncrementTick(); xTaskIncrementTick();
} }
#endif #endif

View File

@ -254,7 +254,7 @@ __attribute__((__naked__)) static void vTick( void )
/* Because FreeRTOS is not supposed to run with nested interrupts, put all OS /* Because FreeRTOS is not supposed to run with nested interrupts, put all OS
calls in a critical section . */ calls in a critical section . */
portENTER_CRITICAL(); portENTER_CRITICAL();
vTaskIncrementTick(); xTaskIncrementTick();
portEXIT_CRITICAL(); portEXIT_CRITICAL();
/* Restore the context of the "elected task". */ /* Restore the context of the "elected task". */

View File

@ -170,11 +170,10 @@ void interrupt31_handler( void )
static void prvProcessTick( void ) __attribute__((noinline)); static void prvProcessTick( void ) __attribute__((noinline));
static void prvProcessTick( void ) static void prvProcessTick( void )
{ {
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
{
#if configUSE_PREEMPTION == 1
vTaskSwitchContext(); vTaskSwitchContext();
#endif }
/* Clear the Tick Interrupt. */ /* Clear the Tick Interrupt. */
counter1->expired = 0; counter1->expired = 0;

View File

@ -293,8 +293,10 @@ void vPortYield( void )
{ {
portSAVE_STACK_POINTER(); portSAVE_STACK_POINTER();
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
{
vTaskSwitchContext(); vTaskSwitchContext();
}
/* Clear the interrupt. */ /* Clear the interrupt. */
TSR1 &= ~0x01; TSR1 &= ~0x01;
@ -312,7 +314,7 @@ void vPortYield( void )
void vTickISR( void ) __attribute__ ( ( interrupt_handler ) ); void vTickISR( void ) __attribute__ ( ( interrupt_handler ) );
void vTickISR( void ) void vTickISR( void )
{ {
vTaskIncrementTick(); xTaskIncrementTick();
/* Clear the interrupt. */ /* Clear the interrupt. */
TSR1 &= ~0x01; TSR1 &= ~0x01;

View File

@ -263,11 +263,11 @@ void vPortTickInterrupt( void )
portSAVE_CONTEXT(); portSAVE_CONTEXT();
/* Increment the tick ... */ /* Increment the tick ... */
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
{
/* ... then see if the new tick value has necessitated a /* A context switch is necessary. */
context switch. */
vTaskSwitchContext(); vTaskSwitchContext();
}
/* Restore the context of a task - which may be a different task /* Restore the context of a task - which may be a different task
to that interrupted. */ to that interrupted. */
@ -275,7 +275,7 @@ void vPortTickInterrupt( void )
} }
#else #else
{ {
vTaskIncrementTick(); xTaskIncrementTick();
} }
#endif #endif

View File

@ -194,7 +194,7 @@ prvPortPreemptiveTick ( void )
* simply increment the system tick. * simply increment the system tick.
*/ */
vTaskIncrementTick( ); xTaskIncrementTick();
MCF_PIT_PCSR0 |= MCF_PIT_PCSR_PIF; MCF_PIT_PCSR0 |= MCF_PIT_PCSR_PIF;
} }
@ -209,8 +209,10 @@ prvPortPreemptiveTick( void )
#endif #endif
portSAVE_CONTEXT( ); portSAVE_CONTEXT( );
MCF_PIT_PCSR0 |= MCF_PIT_PCSR_PIF; MCF_PIT_PCSR0 |= MCF_PIT_PCSR_PIF;
vTaskIncrementTick( ); if( xTaskIncrementTick() != pdFALSE )
{
vTaskSwitchContext( ); vTaskSwitchContext( );
}
portRESTORE_CONTEXT( ); portRESTORE_CONTEXT( );
} }
#endif #endif

View File

@ -359,17 +359,14 @@ void vTickISR( void *pvBaseAddress )
unsigned long ulCSR; unsigned long ulCSR;
/* Increment the RTOS tick - this might cause a task to unblock. */ /* Increment the RTOS tick - this might cause a task to unblock. */
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
{
vTaskSwitchContext();
}
/* Clear the timer interrupt */ /* Clear the timer interrupt */
ulCSR = XTmrCtr_mGetControlStatusReg(XPAR_OPB_TIMER_1_BASEADDR, 0); ulCSR = XTmrCtr_mGetControlStatusReg(XPAR_OPB_TIMER_1_BASEADDR, 0);
XTmrCtr_mSetControlStatusReg( XPAR_OPB_TIMER_1_BASEADDR, portCOUNTER_0, ulCSR ); XTmrCtr_mSetControlStatusReg( XPAR_OPB_TIMER_1_BASEADDR, portCOUNTER_0, ulCSR );
/* If we are using the preemptive scheduler then we also need to determine
if this tick should cause a context switch. */
#if configUSE_PREEMPTION == 1
vTaskSwitchContext();
#endif
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View File

@ -433,15 +433,11 @@ extern void vApplicationClearTimerInterrupt( void );
vApplicationClearTimerInterrupt(); vApplicationClearTimerInterrupt();
/* Increment the RTOS tick - this might cause a task to unblock. */ /* Increment the RTOS tick - this might cause a task to unblock. */
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
{
/* If the preemptive scheduler is being used then a context switch should be
requested in case incrementing the tick unblocked a task, or a time slice
should cause another task to enter the Running state. */
#if configUSE_PREEMPTION == 1
/* Force vTaskSwitchContext() to be called as the interrupt exits. */ /* Force vTaskSwitchContext() to be called as the interrupt exits. */
ulTaskSwitchRequested = 1; ulTaskSwitchRequested = 1;
#endif }
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View File

@ -250,11 +250,6 @@ void vPortExitCritical( void )
void xPortSysTickHandler( 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 /* 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
@ -265,7 +260,10 @@ void xPortSysTickHandler( void )
( void ) portSET_INTERRUPT_MASK_FROM_ISR(); ( void ) portSET_INTERRUPT_MASK_FROM_ISR();
{ {
vTaskIncrementTick(); if( xTaskIncrementTick() != pdFALSE )
{
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
}
} }
portCLEAR_INTERRUPT_MASK_FROM_ISR( 0 ); portCLEAR_INTERRUPT_MASK_FROM_ISR( 0 );
} }
@ -340,8 +338,8 @@ void xPortSysTickHandler( void )
configPRE_SLEEP_PROCESSING( xModifiableIdleTime ); configPRE_SLEEP_PROCESSING( xModifiableIdleTime );
if( xModifiableIdleTime > 0 ) if( xModifiableIdleTime > 0 )
{ {
__WFI();
__DSB(); __DSB();
__WFI();
__ISB(); __ISB();
} }
configPOST_SLEEP_PROCESSING( xExpectedIdleTime ); configPOST_SLEEP_PROCESSING( xExpectedIdleTime );

View File

@ -365,8 +365,8 @@ void xPortSysTickHandler( void )
configPRE_SLEEP_PROCESSING( xModifiableIdleTime ); configPRE_SLEEP_PROCESSING( xModifiableIdleTime );
if( xModifiableIdleTime > 0 ) if( xModifiableIdleTime > 0 )
{ {
__WFI();
__DSB(); __DSB();
__WFI();
__ISB(); __ISB();
} }
configPOST_SLEEP_PROCESSING( xExpectedIdleTime ); configPOST_SLEEP_PROCESSING( xExpectedIdleTime );

View File

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

View File

@ -301,18 +301,7 @@ static unsigned long prvProcessTickInterrupt( void )
unsigned long ulSwitchRequired; unsigned long ulSwitchRequired;
/* Process the tick itself. */ /* Process the tick itself. */
vTaskIncrementTick(); ulSwitchRequired = ( unsigned long ) xTaskIncrementTick();
#if( configUSE_PREEMPTION != 0 )
{
/* A context switch is only automatically performed from the tick
interrupt if the pre-emptive scheduler is being used. */
ulSwitchRequired = pdTRUE;
}
#else
{
ulSwitchRequired = pdFALSE;
}
#endif
return ulSwitchRequired; return ulSwitchRequired;
} }

View File

@ -417,8 +417,8 @@ void xPortSysTickHandler( void )
configPRE_SLEEP_PROCESSING( xModifiableIdleTime ); configPRE_SLEEP_PROCESSING( xModifiableIdleTime );
if( xModifiableIdleTime > 0 ) if( xModifiableIdleTime > 0 )
{ {
__wfi();
__dsb( portSY_FULL_READ_WRITE ); __dsb( portSY_FULL_READ_WRITE );
__wfi();
__isb( portSY_FULL_READ_WRITE ); __isb( portSY_FULL_READ_WRITE );
} }
configPOST_SLEEP_PROCESSING( xExpectedIdleTime ); configPOST_SLEEP_PROCESSING( xExpectedIdleTime );

View File

@ -480,8 +480,8 @@ void xPortSysTickHandler( void )
configPRE_SLEEP_PROCESSING( xModifiableIdleTime ); configPRE_SLEEP_PROCESSING( xModifiableIdleTime );
if( xModifiableIdleTime > 0 ) if( xModifiableIdleTime > 0 )
{ {
__wfi();
__dsb( portSY_FULL_READ_WRITE ); __dsb( portSY_FULL_READ_WRITE );
__wfi();
__isb( portSY_FULL_READ_WRITE ); __isb( portSY_FULL_READ_WRITE );
} }
configPOST_SLEEP_PROCESSING( xExpectedIdleTime ); configPOST_SLEEP_PROCESSING( xExpectedIdleTime );