00001 // alarm.cc 00002 // Routines to use a hardware timer device to provide a 00003 // software alarm clock. For now, we just provide time-slicing. 00004 // 00005 // Not completely implemented. 00006 // 00007 // Copyright (c) 1992-1996 The Regents of the University of California. 00008 // All rights reserved. See copyright.h for copyright notice and limitation 00009 // of liability and disclaimer of warranty provisions. 00010 00011 #include "copyright.h" 00012 #include "alarm.h" 00013 #include "main.h" 00014 00023 Alarm::Alarm(bool doRandom) 00024 { 00025 timer = new Timer(doRandom, this); 00026 } 00027 00049 void 00050 Alarm::CallBack() 00051 { 00052 Interrupt *interrupt = kernel->interrupt; 00053 MachineStatus status = interrupt->getStatus(); 00054 00055 if (status == IdleMode) { 00056 if (!interrupt->AnyFutureInterrupts()) { 00057 timer->Disable(); 00058 } 00059 } else { 00060 interrupt->YieldOnReturn(); 00061 } 00062 }
1.2.8.1 written by Dimitri van Heesch,
© 1997-2001