Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

Timer Class Reference

The Timer class is responsible for managing the hardware timer and all timer callback events. More...

#include <timer.h>

Collaboration diagram for Timer:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void init ()
void schedule (Timer_callback &callback, unsigned milliseconds, void *argument=NULL)
void unschedule (Timer_callback &callback)
void reschedule (Timer_callback &callback, unsigned milliseconds)
unsigned system_time ()
void print ()

Public Attributes

Int_handler handler
List< Timer_callbackcallbacks
unsigned volatile cycles_per_millisecond

Static Public Attributes

const unsigned TIMER_HZ = 1000

Detailed Description

The Timer class is responsible for managing the hardware timer and all timer callback events.


Member Function Documentation

void Timer::init  ) 
 

Reprogram the timer to tick at TIMER_HZ and enable the timer handler.

void Timer::print  ) 
 

Print information about this timer.

void Timer::reschedule Timer_callback callback,
unsigned  milliseconds
 

Reschedule the given callback so that its countdown starts again with the given number of milliseconds per cycle.

void Timer::schedule Timer_callback callback,
unsigned  milliseconds,
void *  argument = NULL
 

Schedule the provided callback for invocation every given number of milliseconds.

schedule() does not block but instead returns immediately. The callback will be invoked with the provided argument.

unsigned Timer::system_time  ) 
 

Return the current system time as milliseconds since initialization.

void Timer::unschedule Timer_callback callback  ) 
 

Unschedule the given callback.


Member Data Documentation

List<Timer_callback> Timer::callbacks
 

list of scheduled callbacks

unsigned volatile Timer::cycles_per_millisecond
 

the speed of this processor

Int_handler Timer::handler
 

timer handler

const unsigned Timer::TIMER_HZ = 1000 [static]
 

handler called this many times/sec


The documentation for this class was generated from the following files:

Torsion Operating System, Copyright (C) 2000-2004 Dan Helfman