Xyris  0.5
timer.hpp
Go to the documentation of this file.
1 /**
2  * @file timer.hpp
3  * @author Keeton Feavel ([email protected])
4  * @brief
5  * @version 0.3
6  * @date 2019-11-15
7  *
8  * @copyright Copyright the Xyris Contributors (c) 2019
9  *
10  */
11 #pragma once
12 #include <Arch/i686/Arch.i686.hpp>
13 #include <stdint.h>
14 
15 #define TIMER_COMMAND_PORT 0x43
16 #define TIMER_DATA_PORT 0x40
17 
18 extern volatile uint32_t timer_tick;
19 
20 /**
21  * @brief Initialize the CPU timer with the given frequency.
22  *
23  * @param freq Timer frequency
24  */
25 void timer_init(uint32_t freq);
26 /**
27  * @brief Sleeps for a certain length of time.
28  *
29  * @param ms Sleep length in milliseconds
30  */
31 void sleep(uint32_t ms);
32 
33 void timer_register_callback(void (*func)());
sleep
void sleep(uint32_t ms)
Sleeps for a certain length of time.
Definition: timer.cpp:52
timer_register_callback
void timer_register_callback(void(*func)())
Definition: timer.cpp:61
timer_tick
volatile uint32_t timer_tick
Definition: timer.cpp:15
Arch.i686.hpp
i686 architecture implementation of Arch.hpp
timer_init
void timer_init(uint32_t freq)
Initialize the CPU timer with the given frequency.
Definition: timer.cpp:31