 |
Xyris
0.5
|
Go to the documentation of this file.
14 static void timer_callback(
struct registers *regs);
19 #define MAX_CALLBACKS 8
20 static size_t _callback_count = 0;
35 uint32_t divisor = 1193180 / freq;
36 uint8_t low = (uint8_t)(divisor & 0xFF);
37 uint8_t high = (uint8_t)((divisor >> 8) & 0xFF);
44 static void timer_callback(
struct registers *regs) {
47 for (
size_t i = 0; i < _callback_count; i++) {
54 uint32_t
final = start + ms;
63 _callbacks[_callback_count] = func;
void timer_register_callback(void(*func)())
void sleep(uint32_t ms)
Sleeps for a certain length of time.
volatile uint32_t timer_tick
void timer_init(uint32_t freq)
Initialize the CPU timer with the given frequency.
A structure definining values for all x86 registers. Cannot be namespaced due to C linkage and ASM in...
void registerHandler(uint8_t interrupt, InterruptHandler_t handler)
void writeByte(uint16_t port, uint8_t data)
Writes a byte (8 bits) to the CPU bus at a given port address.
Interrupt Service Routine header.
#define TIMER_COMMAND_PORT