feat: (iso9660) finishing up unmount
[lunaix-os.git] / lunaix-os / includes / hal / rtc.h
1 #ifndef __LUNAIX_RTC_H
2 #define __LUNAIX_RTC_H
3
4 #include "io.h"
5
6 #define RTC_INDEX_PORT 0x70
7 #define RTC_TARGET_PORT 0x71
8
9 #define WITH_NMI_DISABLED 0x80
10
11 #define RTC_CURRENT_CENTRY 20
12
13 #define RTC_REG_YRS 0x9
14 #define RTC_REG_MTH 0x8
15 #define RTC_REG_DAY 0x7
16 #define RTC_REG_WDY 0x6
17 #define RTC_REG_HRS 0x4
18 #define RTC_REG_MIN 0x2
19 #define RTC_REG_SEC 0x0
20
21 #define RTC_REG_A 0xA
22 #define RTC_REG_B 0xB
23 #define RTC_REG_C 0xC
24 #define RTC_REG_D 0xD
25
26 #define RTC_BIN_ENCODED(reg)    (reg & 0x04)
27 #define RTC_24HRS_ENCODED(reg)  (reg & 0x02)
28
29 #define RTC_TIMER_BASE_FREQUENCY    1024
30 #define RTC_TIMER_ON                0x40
31
32 #define RTC_FREQUENCY_1024HZ    0b110
33 #define RTC_DIVIDER_33KHZ       (0b010 << 4)
34
35 void
36 rtc_init();
37
38 uint8_t
39 rtc_read_reg(uint8_t reg_selector);
40
41 void
42 rtc_write_reg(uint8_t reg_selector, uint8_t val);
43
44 void
45 rtc_enable_timer();
46
47 void
48 rtc_disable_timer();
49
50 #endif /* __LUNAIX_RTC_H */