+#pragma interrupt (vTickISR(vect=configTICK_VECTOR,enable))\r
+void vTickISR( void )\r
+{\r
+ /* Restore previous IPL on exit. */\r
+ //set_ipl( configMAX_SYSCALL_INTERRUPT_PRIORITY );\r
+ \r
+ /* Clear the interrupt. */\r
+ vTaskIncrementTick();\r
+ \r
+ #if( configUSE_PREEMPTION == 1 )\r
+ taskYIELD();\r
+ #endif\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vPortSetInterruptMask( void )\r
+{\r
+unsigned char ucPreviousIPL;\r
+\r
+ /* Store the current IPL to ensure it is restored correctly later if it is\r
+ not currently 0. This is a stack variable, so there should not be a race\r
+ condition even if there is an interrupt or context switch before the new\r
+ IPL value gets set. */\r
+ ucPreviousIPL = get_ipl();\r
+ \r
+ /* Set the mask up to the max syscall priority. */\r
+ set_ipl( configMAX_SYSCALL_INTERRUPT_PRIORITY );\r
+ \r
+ /* Now the mask is set there will not be a context switch, so the previous\r
+ and current IPL values can be compared. This ensures against the IPL being\r
+ set back to zero too early when critical sections nest. */\r
+ if( ucPreviousIPL < configMAX_SYSCALL_INTERRUPT_PRIORITY )\r
+ {\r
+ ucIPLToRestore = ucPreviousIPL;\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+#pragma inline_asm prvStartFirstTask\r
+static void prvStartFirstTask( void )\r
+{\r
+ /* When starting the scheduler there is nothing that needs moving to the\r
+ interrupt stack because the function is not called from an interrupt.\r
+ Just ensure the current stack is the user stack. */\r
+ SETPSW U\r
+\r
+ /* Obtain the location of the stack associated with which ever task \r
+ pxCurrentTCB is currently pointing to. */\r
+ MOV.L #_pxCurrentTCB,R15\r
+ MOV.L [R15],R15\r
+ MOV.L [R15],R0\r
+\r
+ /* Restore the registers from the stack of the task pointed to by \r
+ pxCurrentTCB. */\r
+ POP R15\r
+ MVTACLO R15 /* Accumulator low 32 bits. */\r
+ POP R15\r
+ MVTACHI R15 /* Accumulator high 32 bits. */\r
+ POP R15\r
+ MVTC R15,FPSW /* Floating point status word. */\r
+ POPM R1-R15 /* R1 to R15 - R0 is not included as it is the SP. */\r
+ RTE /* This pops the remaining registers. */\r
+ NOP\r
+ NOP\r
+}\r