Lab3
Functions

timer

Functions

int timer_set_rate (unsigned long timer, unsigned long rate)
 Configures a timer to generate a square wave.
int timer_get_status (unsigned long timer, u8_t *st)
 Reads the the mode in which a timer was programmed.
int timer_show_status (unsigned long timer)
 Shows the mode in which a timer was programmed.
unsigned long timer_subscribe_int (void)
 Subscribes and enables Timer 0 interrupts.
int timer_unsubscribe_int ()
 Unsubscribes Timer 0 interrupts.

Detailed Description

Functions for using the i8254 timers


Function Documentation

int timer_set_rate ( unsigned long  timer,
unsigned long  rate 
)

Configures a timer to generate a square wave.

Parameters:
timerTimer to configure. (Ranges from 0 to 2)
rateFrequency of the square wave to generate
Returns:
Return 0 upon success and non-zero otherwise
int timer_get_status ( unsigned long  timer,
u8_t *  st 
)

Reads the the mode in which a timer was programmed.

Parameters:
timerTimer whose status to read (Ranges from 0 to 2)
stAddress of memory position to be filled with the timer status
Returns:
Return 0 upon success and non-zero otherwise
int timer_show_status ( unsigned long  timer)

Shows the mode in which a timer was programmed.

Displays in a human friendly way, the configuration of the input timer, by providing the values (and meanings) of the different components of a timer status information

Parameters:
timerTimer whose status to read (Ranges from 0 to 2)
Returns:
Return 0 upon success and non-zero otherwise
unsigned long timer_subscribe_int ( void  )

Subscribes and enables Timer 0 interrupts.

Returns:
Returns bitmask for this interrupt, upon success, 0 upon failure
int timer_unsubscribe_int ( )

Unsubscribes Timer 0 interrupts.

Returns:
Return 0 upon success and non-zero otherwise