Implement APIC, RTC, basic ACPI parser and timer support
[lunaix-os.git] / lunaix-os / includes / hal / rtc.h
index 69bf38e96fcf0434cf17691984d1db2b80a700aa..0092171230650eb3c4527082ea95bc2a112750eb 100644 (file)
 #define RTC_BIN_ENCODED(reg)    (reg & 0x04)
 #define RTC_24HRS_ENCODED(reg)  (reg & 0x02)
 
+#define RTC_TIMER_BASE_FREQUENCY    1024
+#define RTC_TIMER_ON                0x40
+
+#define RTC_FREQUENCY_1024HZ    0b110
+#define RTC_DIVIDER_33KHZ       (0b010 << 4)
+
 typedef struct
 {
     uint32_t year;      // use int32 as we need to store the 4-digit year
@@ -37,11 +43,22 @@ typedef struct
     uint8_t second;
 } rtc_datetime;
 
+void
+rtc_init();
 
 uint8_t
 rtc_read_reg(uint8_t reg_selector);
 
+void
+rtc_write_reg(uint8_t reg_selector, uint8_t val);
+
 void 
 rtc_get_datetime(rtc_datetime* datetime);
 
+void
+rtc_enable_timer();
+
+void
+rtc_disable_timer();
+
 #endif /* __LUNAIX_RTC_H */