#include <Arch/i686/Arch.i686.hpp>
#include <stdint.h>
Go to the source code of this file.
- Author
- Keeton Feavel (keeto.nosp@m.nfea.nosp@m.vel@c.nosp@m.edar.nosp@m.ville.nosp@m..edu)
- Version
- 0.3
- Date
- 2019-11-15
- Copyright
- Copyright the Xyris Contributors (c) 2019
Definition in file timer.hpp.
◆ TIMER_COMMAND_PORT
#define TIMER_COMMAND_PORT 0x43 |
◆ TIMER_DATA_PORT
#define TIMER_DATA_PORT 0x40 |
◆ sleep()
void sleep |
( |
uint32_t |
ms | ) |
|
Sleeps for a certain length of time.
- Parameters
-
ms | Sleep length in milliseconds |
Definition at line 52 of file timer.cpp.
54 uint32_t
final = start + ms;
◆ timer_init()
void timer_init |
( |
uint32_t |
freq | ) |
|
Initialize the CPU timer with the given frequency.
- Parameters
-
Sleep Timer Non-Busy Waiting Idea: Create a struct that contains the end time and the callback function pointer that should be called when timer_tick = end After each timer_tick we check our end time and call the function if we're equal.
Definition at line 31 of file timer.cpp.
35 uint32_t divisor = 1193180 / freq;
36 uint8_t low = (uint8_t)(divisor & 0xFF);
37 uint8_t high = (uint8_t)((divisor >> 8) & 0xFF);
◆ timer_register_callback()
void timer_register_callback |
( |
void(*)() |
func | ) |
|
Definition at line 61 of file timer.cpp.
63 _callbacks[_callback_count] = func;
◆ timer_tick
volatile uint32_t timer_tick |