mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Convert mpre ports to use xTaskIncrementTick() in place of vTaskIncrementTick().
This commit is contained in:
parent
686d190798
commit
15ec6c87f7
|
@ -348,8 +348,10 @@ static void prvSetupTimerInterrupt( 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();
|
||||||
|
}
|
||||||
|
|
||||||
/* Restore the context of the new task. */
|
/* Restore the context of the new task. */
|
||||||
portRESTORE_CONTEXT();
|
portRESTORE_CONTEXT();
|
||||||
|
@ -365,7 +367,7 @@ static void prvSetupTimerInterrupt( void )
|
||||||
interrupt (TIMERA0_VECTOR) prvTickISR( void );
|
interrupt (TIMERA0_VECTOR) prvTickISR( void );
|
||||||
interrupt (TIMERA0_VECTOR) prvTickISR( void )
|
interrupt (TIMERA0_VECTOR) prvTickISR( void )
|
||||||
{
|
{
|
||||||
vTaskIncrementTick();
|
xTaskIncrementTick();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -204,14 +204,12 @@ void prvSetupTimerInterrupt( void )
|
||||||
|
|
||||||
void vPortSysTickHandler( void * context, alt_u32 id )
|
void vPortSysTickHandler( void * context, alt_u32 id )
|
||||||
{
|
{
|
||||||
/* Increment the Kernel Tick. */
|
/* Increment the kernel tick. */
|
||||||
vTaskIncrementTick();
|
if( xTaskIncrementTick() != pdFALSE )
|
||||||
|
{
|
||||||
/* If using preemption, also force a context switch. */
|
|
||||||
#if configUSE_PREEMPTION == 1
|
|
||||||
vTaskSwitchContext();
|
vTaskSwitchContext();
|
||||||
#endif
|
}
|
||||||
|
|
||||||
/* Clear the interrupt. */
|
/* Clear the interrupt. */
|
||||||
IOWR_ALTERA_AVALON_TIMER_STATUS( SYS_CLK_BASE, ~ALTERA_AVALON_TIMER_STATUS_TO_MSK );
|
IOWR_ALTERA_AVALON_TIMER_STATUS( SYS_CLK_BASE, ~ALTERA_AVALON_TIMER_STATUS_TO_MSK );
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@
|
||||||
|
|
||||||
.extern pxCurrentTCB
|
.extern pxCurrentTCB
|
||||||
.extern vTaskSwitchContext
|
.extern vTaskSwitchContext
|
||||||
.extern vTaskIncrementTick
|
.extern xTaskIncrementTick
|
||||||
.extern vPortISRHandler
|
.extern vPortISRHandler
|
||||||
|
|
||||||
.global vPortStartFirstTask
|
.global vPortStartFirstTask
|
||||||
|
@ -203,7 +203,7 @@ vPortYield:
|
||||||
vPortTickISR:
|
vPortTickISR:
|
||||||
|
|
||||||
portSAVE_STACK_POINTER_AND_LR
|
portSAVE_STACK_POINTER_AND_LR
|
||||||
bl vTaskIncrementTick
|
bl xTaskIncrementTick
|
||||||
|
|
||||||
#if configUSE_PREEMPTION == 1
|
#if configUSE_PREEMPTION == 1
|
||||||
bl vTaskSwitchContext
|
bl vTaskSwitchContext
|
||||||
|
|
|
@ -76,7 +76,7 @@
|
||||||
|
|
||||||
.extern pxCurrentTCB
|
.extern pxCurrentTCB
|
||||||
.extern vTaskSwitchContext
|
.extern vTaskSwitchContext
|
||||||
.extern vTaskIncrementTick
|
.extern xTaskIncrementTick
|
||||||
.extern vPortISRHandler
|
.extern vPortISRHandler
|
||||||
|
|
||||||
.global vPortStartFirstTask
|
.global vPortStartFirstTask
|
||||||
|
@ -203,7 +203,7 @@ vPortYield:
|
||||||
vPortTickISR:
|
vPortTickISR:
|
||||||
|
|
||||||
portSAVE_STACK_POINTER_AND_LR
|
portSAVE_STACK_POINTER_AND_LR
|
||||||
bl vTaskIncrementTick
|
bl xTaskIncrementTick
|
||||||
|
|
||||||
#if configUSE_PREEMPTION == 1
|
#if configUSE_PREEMPTION == 1
|
||||||
bl vTaskSwitchContext
|
bl vTaskSwitchContext
|
||||||
|
|
|
@ -111,7 +111,7 @@ CMT. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* These macros allow a critical section to be added around the call to
|
/* 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
|
priority - ie a known priority. Therefore these local macros are a slight
|
||||||
optimisation compared to calling the global SET/CLEAR_INTERRUPT_MASK macros,
|
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. */
|
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. */
|
necessitates. Ensure IPL is at the max syscall value first. */
|
||||||
portDISABLE_INTERRUPTS_FROM_KERNEL_ISR();
|
portDISABLE_INTERRUPTS_FROM_KERNEL_ISR();
|
||||||
{
|
{
|
||||||
vTaskIncrementTick();
|
if( xTaskIncrementTick() != pdFALSE )
|
||||||
|
{
|
||||||
|
taskYIELD();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
portENABLE_INTERRUPTS_FROM_KERNEL_ISR();
|
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
|
#if configUSE_TICKLESS_IDLE == 1
|
||||||
{
|
{
|
||||||
/* The CPU woke because of a tick. */
|
/* The CPU woke because of a tick. */
|
||||||
|
|
|
@ -94,7 +94,7 @@ PSW is set with U and I set, and PM and IPL clear. */
|
||||||
#define portINITIAL_FPSW ( ( portSTACK_TYPE ) 0x00000100 )
|
#define portINITIAL_FPSW ( ( portSTACK_TYPE ) 0x00000100 )
|
||||||
|
|
||||||
/* These macros allow a critical section to be added around the call to
|
/* 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
|
priority - ie a known priority. Therefore these local macros are a slight
|
||||||
optimisation compared to calling the global SET/CLEAR_INTERRUPT_MASK macros,
|
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. */
|
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. */
|
necessitates. Ensure IPL is at the max syscall value first. */
|
||||||
portDISABLE_INTERRUPTS_FROM_KERNEL_ISR();
|
portDISABLE_INTERRUPTS_FROM_KERNEL_ISR();
|
||||||
{
|
{
|
||||||
vTaskIncrementTick();
|
if( TaskIncrementTick() != pdFALSE )
|
||||||
|
{
|
||||||
|
taskYIELD();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
portENABLE_INTERRUPTS_FROM_KERNEL_ISR();
|
portENABLE_INTERRUPTS_FROM_KERNEL_ISR();
|
||||||
|
|
||||||
/* Only select a new task if the preemptive scheduler is being used. */
|
|
||||||
#if( configUSE_PREEMPTION == 1 )
|
|
||||||
taskYIELD();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -137,11 +137,10 @@ void vPortTickISR( 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 )
|
||||||
|
{
|
||||||
#if configUSE_PREEMPTION == 1
|
|
||||||
vTaskSwitchContext();
|
vTaskSwitchContext();
|
||||||
#endif
|
}
|
||||||
|
|
||||||
/* Ready for the next interrupt. */
|
/* Ready for the next interrupt. */
|
||||||
TB_ClearITPendingBit( TB_IT_Update );
|
TB_ClearITPendingBit( TB_IT_Update );
|
||||||
|
|
|
@ -335,6 +335,7 @@ unsigned long ulSavedInterruptMask;
|
||||||
unsigned long *pxUpperCSA = NULL;
|
unsigned long *pxUpperCSA = NULL;
|
||||||
unsigned long xUpperCSA = 0UL;
|
unsigned long xUpperCSA = 0UL;
|
||||||
extern volatile unsigned long *pxCurrentTCB;
|
extern volatile unsigned long *pxCurrentTCB;
|
||||||
|
long lYieldRequired;
|
||||||
|
|
||||||
/* Just to avoid compiler warnings about unused parameters. */
|
/* Just to avoid compiler warnings about unused parameters. */
|
||||||
( void ) iArg;
|
( void ) iArg;
|
||||||
|
@ -365,11 +366,11 @@ extern volatile unsigned long *pxCurrentTCB;
|
||||||
ulSavedInterruptMask = portSET_INTERRUPT_MASK_FROM_ISR();
|
ulSavedInterruptMask = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||||
{
|
{
|
||||||
/* Increment the Tick. */
|
/* Increment the Tick. */
|
||||||
vTaskIncrementTick();
|
lYieldRequired = xTaskIncrementTick();
|
||||||
}
|
}
|
||||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( ulSavedInterruptMask );
|
portCLEAR_INTERRUPT_MASK_FROM_ISR( ulSavedInterruptMask );
|
||||||
|
|
||||||
#if configUSE_PREEMPTION == 1
|
if( lYieldRequired != pdFALSE )
|
||||||
{
|
{
|
||||||
/* Save the context of a task.
|
/* Save the context of a task.
|
||||||
The upper context is automatically saved when entering a trap or interrupt.
|
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;
|
CPU_SRC0.bits.SETR = 0;
|
||||||
_isync();
|
_isync();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
; Functions used by scheduler
|
; Functions used by scheduler
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
EXTERN vTaskSwitchContext
|
EXTERN vTaskSwitchContext
|
||||||
EXTERN vTaskIncrementTick
|
EXTERN xTaskIncrementTick
|
||||||
|
|
||||||
; Tick ISR Prototype
|
; Tick ISR Prototype
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
|
@ -133,7 +133,7 @@ vPortStart:
|
||||||
MD_INTTM05:
|
MD_INTTM05:
|
||||||
|
|
||||||
portSAVE_CONTEXT ; Save the context of the current task.
|
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
|
#if configUSE_PREEMPTION == 1
|
||||||
call vTaskSwitchContext ; Call the scheduler to select the next task.
|
call vTaskSwitchContext ; Call the scheduler to select the next task.
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -210,14 +210,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 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,11 +275,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
|
||||||
|
@ -290,7 +285,12 @@ void xPortSysTickHandler( void )
|
||||||
|
|
||||||
( void ) portSET_INTERRUPT_MASK_FROM_ISR();
|
( 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 );
|
portCLEAR_INTERRUPT_MASK_FROM_ISR( 0 );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue