Main Page | Data Structures | File List | Globals | Related Pages

timer.c File Reference

Provides the implementantion of scheduler related functions. More...

#include <timer.h>
#include <interrupt.h>
#include <scheduler.h>
#include <timer_defines.h>
#include <x86/irq_list.h>
#include <x86/proc_reg.h>
#include <x86/pio.h>
#include <stdlib.h>
#include <malloc.h>

Functions

void timer_handler (InterruptVector vector, Registers *registers)
int timer_initialize (void)
 Initialize timer facilities.

unsigned int get_ticks (void)
 The number of ticks since boot.

Timer * timer_create (unsigned int delta)
 Create a new timer.

void timer_activate (Timer *timer)
 Activate a timer.

void timer_destroy (Timer *timer)
 Destroy a timer.


Variables

unsigned int ticks = 0
List timers


Detailed Description

Provides the implementantion of scheduler related functions.

Author:
Lee Salzman (lsalzman)

Hassaan Moin Khan (hkhan)

Bug:
No known bugs.

Function Documentation

unsigned int get_ticks void   ) 
 

The number of ticks since boot.

Return the number of ticks elapsed since initializing the timer.

Returns:
the number of ticks

void timer_activate Timer *  timer  ) 
 

Activate a timer.

Install the timer so that it will expire at its deadline.

Parameters:
timer the timer to activate
Returns:
Void

Timer* timer_create unsigned int  delta  ) 
 

Create a new timer.

Create a new timer to expire a certain number of ticks from now. The timer must be activated after threads have been suspended on the resource before it will wait for expiration.

Parameters:
delta the number of ticks that should elapse from now till expiration
Returns:
a timer on success NULL on failure

void timer_destroy Timer *  timer  ) 
 

Destroy a timer.

Free any memory resources associated with a timer.

Parameters:
timer the timer to destroy
Returns:
Void

int timer_initialize void   ) 
 

Initialize timer facilities.

Initialize the timer facilities and start up the timer.

Returns:
0 on success -1 on failure


Generated on Fri Apr 9 21:59:16 2004 for 15-410 Project 3 by doxygen 1.3.2