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 ** This function is used to yield (please note that the function name 00020 ** is misspelled on purpose, there is a Yield funciton somewhere in the 00021 ** IAR library) control of the processor to another task, but only if 00022 ** we are at the task level. We cannot yield if we are in an interrupt 00023 ** routine 00024 *********************************************************************/ 00025 00026 void Yeild(void) 00027 { 00028 char sr; 00029 00030 if(!InterruptCount) 00031 { 00032 sr = Disable(); 00033 CurrentTask->TimeStamp = TStamp; 00034 Replace(&ActiveTasks,(void **)&NextTask,(void *)CurrentTask); 00035 NextTask->TcbSwaps++; 00036 DoSwap(); 00037 Enable(sr); 00038 } 00039 }