00001 00002 // This file is compiled with WinAVR version 4.1.2 00003 // 00004 // These routines mess with the stack 00005 // 00006 // you must use either of these optimizations: 00007 // -O1 00008 // -O3 00009 // -O2 00010 // 00011 // Whatever you do, do NOT use -O0....it will NOT work 00012 // 00013 // ///////////////////////////////////////////////////////////////////////////////////////// 00014 00015 #include "task.h" 00016 #include "pq.h" 00017 00018 00019 //---------------------------------------------------------------------------- 00020 // Start the operating system 00021 //---------------------------------------------------------------------------- 00022 void StartOS(void) __attribute__ ( ( naked ) ); 00023 00024 void StartOS(void) 00025 { 00026 //--------------------------------------- 00027 // This is where we get the ball rolling 00028 // Remove task from priorty queue 00029 // Restore its context 00030 // and then jump to the first task using 00031 // return from subroutine 00032 //--------------------------------------- 00033 Delete(&ActiveTasks,(void **)&NextTask); 00034 CurrentTask = NextTask; 00035 RESTORE_CONTEXT(); 00036 }