|
My Kernel v0.1.0
|
We use the PIT channel 0 for our internal timer. More...

Enumerations | |
| enum | pit_channel |
| The different PIT channels available. | |
| enum | pit_mode |
| The different programmable modes for a channel. | |
Functions | |
| error_t | pit_config_channel (pit_channel, u32 frequency, pit_mode) |
| Configure a single PIT channel. More... | |
| u16 | pit_read_channel (pit_channel) |
| Read the current value inside the channel's counter. | |
Variables | |
| volatile clock_t | timer_ticks_counter = 0 |
| This is where we keep track of the number of intervals reported by the timer. More... | |
| volatile u32 | timer_kernel_frequency = 0 |
| Frequency of the global timekeeping timer. | |
Any interaction done with the PIT should be done through the functions defined inside this header.
The i8254 PIT has an internal frequency of 1.19 MHz, and 3 separate counters. Each counter must be configured with one of 7 modes, and a frequency. To be more accurate we can only specify the divider, which applied to the internal PIT frequency (1.9MHz), computes the actual frequency fo the timer. Each time the counter reaches the computed limit, it triggers an IRQ_TIMER
We keep track of the number of IRQ_TIMER recieved, each one representing a kernel timer 'tick'.
| error_t pit_config_channel | ( | pit_channel | channel, |
| u32 | frequency, | ||
| pit_mode | mode | ||
| ) |
We can only specify the channel's frequency, and the interrupt trigger condition. The read/write policy is forcefully set to 16bits.
| volatile clock_t timer_ticks_counter = 0 |
This MUST be incremented EACH time we recieve an interrupt from the global timer.