Main Page   Compound List   File List   Compound Members   File Members  

Timer Class Reference

#include <timer.h>

List of all members.

Public Methods

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

Private Attributes

bool randomize
VoidFunctionPtr handler
int arg


Constructor & Destructor Documentation

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

Definition at line 44 of file timer.cc.

References arg, handler, randomize, TimeOfNextInterrupt, TimerHandler, 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 TimeOfNextInterrupt, TimerHandler, and TimerInt.

Referenced by TimerHandler.

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 }


Member Data Documentation

int Timer::arg [private]
 

Definition at line 45 of file timer.h.

Referenced by Timer.

VoidFunctionPtr Timer::handler [private]
 

Definition at line 44 of file timer.h.

Referenced by Timer.

bool Timer::randomize [private]
 

Definition at line 43 of file timer.h.

Referenced by Timer.


The documentation for this class was generated from the following files:
Generated on Mon Feb 10 09:54:59 2003 for nachos by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002
The University of Southern California does not screen or control the content on this website and thus does not guarantee the accuracy, integrity, or quality of such content. All content on this website is provided by and is the sole responsibility of the person from which such content originated, and such content does not necessarily reflect the opinions of the University administration or the Board of Trustees