-
Notifications
You must be signed in to change notification settings - Fork 1
/
Cp0.hpp
46 lines (34 loc) · 1.13 KB
/
Cp0.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#pragma once
//Coprocessor0 Count, Compare
//32bit Count in CP0 increments at Fosc/2
#include <cstdint>
struct Cp0 {
//get cp0 count
static auto
count () -> uint32_t;
//get cp0 compare
static auto
compare () -> uint32_t;
//set cp0 count
static auto
count (uint32_t) -> void;
//set cp0 compare
static auto
compare (uint32_t) -> void;
//add to count the calculated value previously set with
//compare_us/ms, and store into compare
//(can set compare_us/ms, enable irq, in irq just use compare_reload())
static auto
compare_reload () -> void;
//enable/disable the core timer irq
static auto
compare_irq (bool) -> void;
//calculate/store the value into compare
//so that a count/compare match occurs in n us
static auto
compare_us (uint32_t) -> void;
//calculate/store the value into compare
//so that a count/compare match occurs in n ms
static auto
compare_ms (uint16_t) -> void;
};