Lab2
|
Functions | |
int | timer_set_square (unsigned long timer, unsigned long freq) |
Configures a timer to generate a square wave. | |
int | timer_subscribe_int (void) |
Subscribes and enables Timer 0 interrupts. | |
int | timer_unsubscribe_int () |
Unsubscribes Timer 0 interrupts. | |
void | timer_int_handler () |
Timer 0 interrupt handler. | |
int | timer_get_conf (unsigned long timer, unsigned char *st) |
Reads the input timer configuration via read-back command. | |
int | timer_display_conf (unsigned char conf) |
Shows timer configuration. | |
int | timer_test_square (unsigned long freq) |
Tests programming timer in square wave mode. | |
int | timer_test_int (unsigned long time) |
Tests Timer 0 interrupt handling. | |
int | timer_test_config (unsigned long timer) |
Tests display of timer config. |
Functions for using the i8254 timers
int timer_set_square | ( | unsigned long | timer, |
unsigned long | freq | ||
) |
Configures a timer to generate a square wave.
Does not change the LSB (BCD/binary) of the timer's control word.
timer | Timer to configure. (Ranges from 0 to 2) |
freq | Frequency of the square wave to generate |
int timer_subscribe_int | ( | void | ) |
Subscribes and enables Timer 0 interrupts.
int timer_unsubscribe_int | ( | ) |
Unsubscribes Timer 0 interrupts.
void timer_int_handler | ( | ) |
Timer 0 interrupt handler.
Increments counter
int timer_get_conf | ( | unsigned long | timer, |
unsigned char * | st | ||
) |
Reads the input timer configuration via read-back command.
timer | Timer whose config to read (Ranges from 0 to 2) |
st | Address of memory position to be filled with the timer config |
int timer_display_conf | ( | unsigned char | conf | ) |
Shows timer configuration.
Displays in a human friendly way, the configuration of a timer as read via the read-back command, by providing the values (and meanings) of the different components of a timer configuration
conf | configuration to display in human friendly way |
int timer_test_square | ( | unsigned long | freq | ) |
Tests programming timer in square wave mode.
Programs Timer 0 to generate square mode with input frequency
freq | Frequency of square wave to generate |
int timer_test_int | ( | unsigned long | time | ) |
Tests Timer 0 interrupt handling.
Subscribes Timer 0 interrupts and prints a message once per second for the specified time interval
time | Length of time interval while interrupts are subscribed |
int timer_test_config | ( | unsigned long | timer | ) |
Tests display of timer config.
Just calls timer_get_conf() followed by timer_display_conf()
timer | Timer whose config to read (Ranges from 0 to 2) |