StuBS
|
Local Timer (for each LAPIC / CPU) More...
Classes | |
struct | ControlRegister.__unnamed45__ |
Enumerations | |
enum | DeliveryStatus { IDLE = 0 , SEND_PENDING = 1 } |
Timer Delivery Status. More... | |
enum | TimerMode { ONE_SHOT = 0 , PERIODIC = 1 , DEADLINE = 2 } |
Timer Mode. More... | |
enum | Mask { NOT_MASKED = 0 , MASKED = 1 } |
Timer Mask. More... | |
Functions | |
uint32_t | ticks (void) |
Determines the LAPIC timer frequency. | |
void | set (uint32_t counter, uint8_t divide, uint8_t vector, bool periodic, bool masked=false) |
Set the LAPIC timer. | |
Register | getClockDiv (uint8_t div) |
Calculate the bit mask for the LAPIC-timer divider. | |
Constants | |
static const Register | INVALID_DIV = 0xff |
static const Register | div_masks [] |
LAPIC timer divider table. | |
Local Timer (for each LAPIC / CPU)
struct LAPIC::Timer::ControlRegister.__unnamed45__ |
enum LAPIC::Timer::Mask |
uint32_t LAPIC::Timer::ticks | ( | void | ) |
Determines the LAPIC timer frequency.
This function will calculate the number of LAPIC-timer ticks passing in the course of one millisecond. To do so, this function will rely on PIT timer functionality and measure the tick delta between start and end of waiting for a predefined period.
For measurement, the LAPIC-timer single-shot mode (without interrupts) is used; after measurement, the timer is disabled again.
void LAPIC::Timer::set | ( | uint32_t | counter, |
uint8_t | divide, | ||
uint8_t | vector, | ||
bool | periodic, | ||
bool | masked = false |
||
) |
Set the LAPIC timer.
counter | Initial counter value; decremented on every LAPIC timer tick |
divide | Divider (power of 2, i.e., 1 2 4 8 16 32...) used as prescaler between bus frequency and LAPIC timer frequency: LAPIC timer frequency = divide * bus frequency . divide is a numerical parameter, the conversion to the corresponding bit mask is done internally by calling getClockDiv(). |
vector | Interrupt vector number to be triggered on counter expiry |
periodic | If set, the interrupt will be issued periodically |
masked | If set, interrupts on counter expiry are suppressed |
Calculate the bit mask for the LAPIC-timer divider.
div | Divider, must be power of two: 1, 2, 4, 8, 16, 32, 64, 128 |
0xff
if div
is invalid.
|
static |
|
static |
LAPIC timer divider table.