***************************************************************************\r
\r
\r
- http://www.FreeRTOS.org - Documentation, books, training, latest versions, \r
+ http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
license and Real Time Engineers Ltd. contact details.\r
\r
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
including FreeRTOS+Trace - an indispensable productivity tool, and our new\r
fully thread aware and reentrant UDP/IP stack.\r
\r
- http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High \r
- Integrity Systems, who sell the code with commercial support, \r
+ http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
+ Integrity Systems, who sell the code with commercial support,\r
indemnification and middleware, under the OpenRTOS brand.\r
- \r
- http://www.SafeRTOS.com - High Integrity Systems also provide a safety \r
- engineered and independently SIL3 certified version for use in safety and \r
+\r
+ http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+ engineered and independently SIL3 certified version for use in safety and\r
mission critical applications that require provable dependability.\r
*/\r
\r
hardware call stack which uses the AVR stack pointer. Second there is the\r
software stack (local variables, parameter passing, etc.) which uses the\r
AVR Y register.\r
- \r
+\r
This function places both stacks within the memory block passed in as the\r
first parameter. The hardware stack is placed at the bottom of the memory\r
block. A gap is then left for the hardware stack to grow. Next the software\r
vPortYieldFromTick();\r
asm( "reti" );\r
}\r
- \r
+\r
#else\r
\r
/*\r
*\r
* THE INTERRUPT VECTOR IS POPULATED IN portmacro.s90. DO NOT INSTALL\r
* IT HERE USING THE USUAL PRAGMA.\r
- */ \r
+ */\r
__interrupt void SIG_OUTPUT_COMPARE1A( void )\r
{\r
- vTaskIncrementTick();\r
+ xTaskIncrementTick();\r
}\r
#endif\r
/*-----------------------------------------------------------*/\r
}\r
}\r
\r
- \r
+\r
; ---------------------------\r
EXTERN vTaskSwitchContext\r
EXTERN pxCurrentTCB\r
-EXTERN vTaskIncrementTick\r
+EXTERN xTaskIncrementTick\r
EXTERN uxCriticalNesting\r
\r
; Functions implemented in this file\r
\r
vPortYieldFromTick:\r
portSAVE_CONTEXT ; Save the context of the current task.\r
- call vTaskIncrementTick ; Call the timer tick function.\r
+ call xTaskIncrementTick ; Call the timer tick function.\r
call vTaskSwitchContext ; Call the scheduler.\r
portRESTORE_CONTEXT ; Restore the context of whichever task the ...\r
ret ; ... scheduler decided should run.\r
/* Because FreeRTOS is not supposed to run with nested interrupts, put all OS\r
calls in a critical section . */\r
portENTER_CRITICAL();\r
- vTaskIncrementTick();\r
+ xTaskIncrementTick();\r
portEXIT_CRITICAL();\r
\r
/* Restore the context of the "elected task". */\r
/* Increment the tick count - which may wake some tasks but as the\r
preemptive scheduler is not being used any woken task is not given\r
processor time no matter what its priority. */\r
- vTaskIncrementTick();\r
+ xTaskIncrementTick();\r
\r
/* Clear the PIT interrupt. */\r
ulDummy = AT91C_BASE_PITC->PITC_PIVR;\r
CODE32\r
\r
EXTERN vTaskSwitchContext\r
- EXTERN vTaskIncrementTick\r
+ EXTERN xTaskIncrementTick\r
\r
PUBLIC vPortYieldProcessor\r
PUBLIC vPortPreemptiveTick\r
vPortPreemptiveTick:\r
portSAVE_CONTEXT ; Save the context of the current task.\r
\r
- LDR R0, =vTaskIncrementTick ; Increment the tick count - this may wake a task.\r
+ LDR R0, =xTaskIncrementTick ; Increment the tick count - this may wake a task.\r
mov lr, pc\r
BX R0\r
LDR R0, =vTaskSwitchContext ; Select the next task to execute.\r
/* Increment the tick count - which may wake some tasks but as the\r
preemptive scheduler is not being used any woken task is not given\r
processor time no matter what its priority. */\r
- vTaskIncrementTick();\r
-\r
- #if configUSE_PREEMPTION == 1\r
+ if( xTaskIncrementTick() != pdFALSE )\r
+ {\r
vTaskSwitchContext();\r
- #endif \r
+ }\r
\r
/* Clear the PIT interrupt. */\r
ulDummy = AT91C_BASE_PITC->PITC_PIVR;\r
/* Increment the tick count - which may wake some tasks but as the\r
preemptive scheduler is not being used any woken task is not given\r
processor time no matter what its priority. */\r
- vTaskIncrementTick();\r
+ xTaskIncrementTick();\r
\r
/* Ready for the next interrupt. */\r
T0IR = portTIMER_MATCH_ISR_BIT;\r
void vPortPreemptiveTick( void )\r
{\r
/* Increment the tick counter. */\r
- vTaskIncrementTick();\r
- \r
- /* The new tick value might unblock a task. Ensure the highest task that\r
- is ready to execute is the task that will execute when the tick ISR\r
- exits. */\r
- vTaskSwitchContext();\r
+ if( xTaskIncrementTick() != pdFALSE )\r
+ { \r
+ /* The new tick value might unblock a task. Ensure the highest task that\r
+ is ready to execute is the task that will execute when the tick ISR\r
+ exits. */\r
+ vTaskSwitchContext();\r
+ }\r
\r
/* Ready for the next interrupt. */\r
T0IR = portTIMER_MATCH_ISR_BIT;\r
CODE32\r
\r
EXTERN vTaskSwitchContext\r
- EXTERN vTaskIncrementTick\r
EXTERN vPortPreemptiveTick\r
\r
PUBLIC vPortPreemptiveTickEntry\r
#include "FreeRTOSConfig.h"\r
#include "portasm.h"\r
\r
- IMPORT vTaskIncrementTick\r
+ IMPORT xTaskIncrementTick\r
IMPORT vTaskSwitchContext\r
IMPORT vPortSetupTimerInterrupt\r
\r
vTickISR:\r
portSAVE_CONTEXT\r
\r
- call #vTaskIncrementTick\r
+ call #xTaskIncrementTick\r
\r
#if configUSE_PREEMPTION == 1\r
call #vTaskSwitchContext\r
#include "FreeRTOSConfig.h"\r
#include "data_model.h"\r
\r
- IMPORT vTaskIncrementTick\r
+ IMPORT xTaskIncrementTick\r
IMPORT vTaskSwitchContext\r
IMPORT vPortSetupTimerInterrupt\r
IMPORT pxCurrentTCB\r
push.w sr\r
portSAVE_CONTEXT\r
\r
- calla #vTaskIncrementTick\r
+ calla #xTaskIncrementTick\r
\r
#if configUSE_PREEMPTION == 1\r
calla #vTaskSwitchContext\r
PUBLIC vPortTickISR\r
\r
EXTERN vTaskSwitchContext\r
- EXTERN vTaskIncrementTick\r
+ EXTERN xTaskIncrementTick\r
\r
; FreeRTOS yield handler. This is installed as the BRK software interrupt\r
; handler.\r
vPortTickISR:\r
\r
portSAVE_CONTEXT ; Save the context of the current task.\r
- call vTaskIncrementTick ; Call the timer tick function.\r
+ call xTaskIncrementTick ; Call the timer tick function.\r
#if configUSE_PREEMPTION == 1\r
call vTaskSwitchContext ; Call the scheduler to select the next task.\r
#endif\r
necessitates. */\r
__set_interrupt_level( configMAX_SYSCALL_INTERRUPT_PRIORITY );\r
{\r
- vTaskIncrementTick();\r
+ if( xTaskIncrementTick() != pdFALSE )\r
+ {\r
+ taskYIELD();\r
+ }\r
}\r
__set_interrupt_level( configKERNEL_INTERRUPT_PRIORITY );\r
\r
- /* Only select a new task if the preemptive scheduler is being used. */\r
- #if( configUSE_PREEMPTION == 1 )\r
- {\r
- taskYIELD();\r
- }\r
- #endif\r
-\r
#if configUSE_TICKLESS_IDLE == 1\r
{\r
/* The CPU woke because of a tick. */\r
/* Increment the tick count - which may wake some tasks but as the\r
preemptive scheduler is not being used any woken task is not given\r
processor time no matter what its priority. */\r
- vTaskIncrementTick();\r
+ xTaskIncrementTick();\r
\r
/* Clear the interrupt in the watchdog and EIC. */\r
WDG->SR = 0x0000;\r
void vPortPreemptiveTick( void )\r
{\r
/* Increment the tick counter. */\r
- vTaskIncrementTick();\r
-\r
- /* The new tick value might unblock a task. Ensure the highest task that\r
- is ready to execute is the task that will execute when the tick ISR\r
- exits. */\r
- vTaskSwitchContext();\r
+ if( xTaskIncrementTick() != pdFALSE )\r
+ {\r
+ /* Select a new task to execute. */\r
+ vTaskSwitchContext();\r
+ }\r
\r
/* Clear the interrupt in the watchdog and EIC. */\r
WDG->SR = 0x0000;\r
__arm void vPortPreemptiveTick( void )\r
{\r
/* Increment the tick counter. */\r
- vTaskIncrementTick();\r
-\r
- /* The new tick value might unblock a task. Ensure the highest task that\r
- is ready to execute is the task that will execute when the tick ISR\r
- exits. */\r
- #if configUSE_PREEMPTION == 1\r
+ if( xTaskIncrementTick() != pdFALSE )\r
+ {\r
+ /* Select a new task to execute. */\r
vTaskSwitchContext();\r
- #endif\r
-\r
+ }\r
+ \r
TB_ClearITPendingBit( TB_IT_Update );\r
}\r
/*-----------------------------------------------------------*/\r
{\r
{\r
/* Increment the tick counter. */\r
- vTaskIncrementTick();\r
- \r
- #if configUSE_PREEMPTION == 1\r
- {\r
- /* The new tick value might unblock a task. Ensure the highest task that\r
- is ready to execute is the task that will execute when the tick ISR\r
- exits. */\r
+ if( xTaskIncrementTick() != pdFALSE )\r
+ { \r
+ /* Select a new task to execute. */\r
vTaskSwitchContext();\r
}\r
- #endif /* configUSE_PREEMPTION. */\r
\r
/* Clear the interrupt in the watchdog. */\r
WDG->SR &= ~0x0001;\r
; Functions used by scheduler\r
;------------------------------------------------------------------------------\r
EXTERN vTaskSwitchContext\r
- EXTERN vTaskIncrementTick\r
+ EXTERN xTaskIncrementTick\r
\r
; Variables used by scheduler\r
;------------------------------------------------------------------------------\r
stsr 1,lp\r
st.w lp,0[sp] ; store EIPSW to stack\r
portSAVE_CONTEXT ; Save the context of the current task.\r
- jarl vTaskIncrementTick,lp ; Call the timer tick function.\r
+ jarl xTaskIncrementTick,lp ; Call the timer tick function.\r
jarl vTaskSwitchContext,lp ; Call the scheduler.\r
portRESTORE_CONTEXT ; Restore the context of whichever task the ...\r
; ... scheduler decided should run.\r
prepare {lp,ep},8,sp\r
sst.w r1,4[ep]\r
sst.w r5,0[ep]\r
- jarl vTaskIncrementTick,lp ; Call the timer tick function.\r
+ jarl xTaskIncrementTick,lp ; Call the timer tick function.\r
sld.w 0[ep],r5\r
sld.w 4[ep],r1\r
dispose 8,{lp,ep}\r
; Functions used by scheduler\r
;------------------------------------------------------------------------------\r
EXTERN vTaskSwitchContext\r
- EXTERN vTaskIncrementTick\r
+ EXTERN xTaskIncrementTick\r
\r
; Variables used by scheduler\r
;------------------------------------------------------------------------------\r
stsr 1,lp\r
st.w lp,0[sp] ; store EIPSW to stack\r
portSAVE_CONTEXT ; Save the context of the current task.\r
- jarl vTaskIncrementTick,lp ; Call the timer tick function.\r
+ jarl xTaskIncrementTick,lp ; Call the timer tick function.\r
jarl vTaskSwitchContext,lp ; Call the scheduler.\r
portRESTORE_CONTEXT ; Restore the context of whichever task the ...\r
; ... scheduler decided should run.\r
prepare {lp,ep},8,sp\r
sst.w r1,4[ep]\r
sst.w r5,0[ep]\r
- jarl vTaskIncrementTick,lp ; Call the timer tick function.\r
+ jarl xTaskIncrementTick,lp ; Call the timer tick function.\r
sld.w 0[ep],r5\r
sld.w 4[ep],r1\r
dispose 8,{lp,ep}\r
; Functions used by scheduler\r
;------------------------------------------------------------------------------\r
EXTERN vTaskSwitchContext\r
- EXTERN vTaskIncrementTick\r
+ EXTERN xTaskIncrementTick\r
\r
; Variables used by scheduler\r
;------------------------------------------------------------------------------\r
stsr 1,lp\r
st.w lp,0[sp] ; store EIPSW to stack\r
portSAVE_CONTEXT ; Save the context of the current task.\r
- jarl vTaskIncrementTick,lp ; Call the timer tick function.\r
+ jarl xTaskIncrementTick,lp ; Call the timer tick function.\r
jarl vTaskSwitchContext,lp ; Call the scheduler.\r
portRESTORE_CONTEXT ; Restore the context of whichever task the ...\r
; ... scheduler decided should run.\r
prepare {lp,ep},8,sp\r
sst.w r1,4[ep]\r
sst.w r5,0[ep]\r
- jarl vTaskIncrementTick,lp ; Call the timer tick function.\r
+ jarl xTaskIncrementTick,lp ; Call the timer tick function.\r
sld.w 0[ep],r5\r
sld.w 4[ep],r1\r
dispose 8,{lp,ep}\r