Main Page | Alphabetical List | Class List | File List | Class Members | File Members

Timer Class Reference

#include <timer.h>

List of all members.

Public Member Functions

 Timer (VoidFunctionPtr timerHandler, int callArg, bool doRandom)
 ~Timer ()
void TimerExpired ()
int TimeOfNextInterrupt ()


Constructor & Destructor Documentation

Timer::Timer VoidFunctionPtr  timerHandler,
int  callArg,
bool  doRandom
 

Definition at line 44 of file timer.cc.

References interrupt, Interrupt::Schedule(), TimeOfNextInterrupt(), TimerInt, and VoidFunctionPtr.

00045 { 00046 randomize = doRandom; 00047 handler = timerHandler; 00048 arg = callArg; 00049 00050 // schedule the first interrupt from the timer device 00051 interrupt->Schedule(TimerHandler, (int) this, TimeOfNextInterrupt(), 00052 TimerInt); 00053 }

Timer::~Timer  )  [inline]
 

Definition at line 32 of file timer.h.

00032 {}


Member Function Documentation

int Timer::TimeOfNextInterrupt  ) 
 

Definition at line 79 of file timer.cc.

References Random(), and TimerTicks.

Referenced by Timer(), and TimerExpired().

00080 { 00081 if (randomize) 00082 return 1 + (Random() % (TimerTicks * 2)); 00083 else 00084 return TimerTicks; 00085 }

void Timer::TimerExpired  ) 
 

Definition at line 62 of file timer.cc.

References interrupt, Interrupt::Schedule(), TimeOfNextInterrupt(), and TimerInt.

00063 { 00064 // schedule the next timer device interrupt 00065 interrupt->Schedule(TimerHandler, (int) this, TimeOfNextInterrupt(), 00066 TimerInt); 00067 00068 // invoke the Nachos interrupt handler for this device 00069 (*handler)(arg); 00070 }


The documentation for this class was generated from the following files:
Generated on Thu Sep 16 12:33:49 2004 for NachOS by doxygen 1.3.8