#define portINITIAL_PSW ( ( portSTACK_TYPE ) 0x00030000 )\r
#define portINITIAL_FPSW ( ( portSTACK_TYPE ) 0x00000100 )\r
\r
+/* These macros allow a critical section to be added around the call to\r
+vTaskIncrementTick(), which is only ever called from interrupts at the kernel \r
+priority - ie a known priority. Therefore these local macros are a slight \r
+optimisation compared to calling the global SET/CLEAR_INTERRUPT_MASK macros, \r
+which would require the old IPL to be read first and stored in a local variable. */\r
+#define portDISABLE_INTERRUPTS_FROM_KERNEL_ISR() __asm volatile ( "MVTIPL %0" ::"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY) )\r
+#define portENABLE_INTERRUPTS_FROM_KERNEL_ISR() __asm volatile ( "MVTIPL %0" ::"i"(configKERNEL_INTERRUPT_PRIORITY) )\r
+\r
/*-----------------------------------------------------------*/\r
\r
/*\r
__asm volatile( "SETPSW I" );\r
\r
/* Increment the tick, and perform any processing the new tick value\r
- necessitates. */\r
- vTaskIncrementTick(); \r
+ necessitates. Ensure IPL is at the max syscall value first. */\r
+ portDISABLE_INTERRUPTS_FROM_KERNEL_ISR();\r
+ {\r
+ vTaskIncrementTick(); \r
+ }\r
+ portENABLE_INTERRUPTS_FROM_KERNEL_ISR();\r
\r
/* Only select a new task if the preemptive scheduler is being used. */\r
#if( configUSE_PREEMPTION == 1 )\r
\r
/* Increment the tick, and perform any processing the new tick value\r
necessitates. */\r
- vTaskIncrementTick();\r
+ __set_interrupt_level( configMAX_SYSCALL_INTERRUPT_PRIORITY );\r
+ {\r
+ vTaskIncrementTick();\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
/* Increment the tick, and perform any processing the new tick value\r
necessitates. */\r
- vTaskIncrementTick();\r
+ set_ipl( configMAX_SYSCALL_INTERRUPT_PRIORITY );\r
+ {\r
+ vTaskIncrementTick();\r
+ }\r
+ set_ipl( configKERNEL_INTERRUPT_PRIORITY );\r
\r
/* Only select a new task if the preemptive scheduler is being used. */\r
#if( configUSE_PREEMPTION == 1 )\r