Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Timer Class Reference

The following class defines a hardware timer. More...

#include <timer.h>

Inheritance diagram for Timer::

CallBackObj List of all members.

Public Methods

 Timer (bool doRandom, CallBackObj *toCall)
 Initialize the timer, and callback to "toCall" every time slice. More...

virtual ~Timer ()
void Disable ()
 Turn timer device off, so it doesn't generate any more interrupts. More...


Private Methods

void CallBack ()
 called internally when the hardware timer generates an interrupt. More...

void SetInterrupt ()
 cause an interrupt to occur in the the future after a fixed or random delay. More...


Private Attributes

bool randomize
 set if we need to use a random timeout delay. More...

CallBackObjcallPeriodically
 call this every TimerTicks time units. More...

bool disable
 turn off the timer device after next interrupt. More...


Detailed Description

The following class defines a hardware timer.

Definition at line 28 of file timer.h.


Constructor & Destructor Documentation

Timer::Timer ( bool doRandom,
CallBackObj * toCall )
 

Initialize the timer, and callback to "toCall" every time slice.

Timer::Timer Initialize a hardware timer device. Save the place to call on each interrupt, and then arrange for the timer to start generating interrupts.

"doRandom" -- if true, arrange for the interrupts to occur at random, instead of fixed, intervals. "toCall" is the interrupt handler to call when the timer expires.

Definition at line 38 of file timer.cc.

Timer::~Timer ( ) [inline, virtual]
 

Definition at line 33 of file timer.h.


Member Function Documentation

void Timer::CallBack ( ) [private, virtual]
 

called internally when the hardware timer generates an interrupt.

Timer::CallBack Routine called when interrupt is generated by the hardware timer device. Schedule the next interrupt, and invoke the interrupt handler.

Reimplemented from CallBackObj.

Definition at line 53 of file timer.cc.

void Timer::Disable ( ) [inline]
 

Turn timer device off, so it doesn't generate any more interrupts.

Definition at line 35 of file timer.h.

Referenced by Alarm::CallBack().

void Timer::SetInterrupt ( ) [private]
 

cause an interrupt to occur in the the future after a fixed or random delay.

Timer::SetInterrupt Cause a timer interrupt to occur in the future, unless future interrupts have been disabled. The delay is either fixed or random.

Definition at line 70 of file timer.cc.

Referenced by CallBack(), and Timer().


Member Data Documentation

CallBackObj * Timer::callPeriodically [private]
 

call this every TimerTicks time units.

Definition at line 41 of file timer.h.

bool Timer::disable [private]
 

turn off the timer device after next interrupt.

Definition at line 42 of file timer.h.

bool Timer::randomize [private]
 

set if we need to use a random timeout delay.

Definition at line 40 of file timer.h.


The documentation for this class was generated from the following files:
Generated at Wed Jul 4 11:32:24 2001 for Nachos by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001