X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/37fb1e9cee287c9ae8c065ff517c508eb5f9d7dd..946c3fdd31300074cc78841795bd47af908ddddb:/lunaix-os/includes/hal/rtc.h?ds=sidebyside diff --git a/lunaix-os/includes/hal/rtc.h b/lunaix-os/includes/hal/rtc.h index 69bf38e..46283d0 100644 --- a/lunaix-os/includes/hal/rtc.h +++ b/lunaix-os/includes/hal/rtc.h @@ -23,25 +23,31 @@ #define RTC_REG_C 0xC #define RTC_REG_D 0xD -#define RTC_BIN_ENCODED(reg) (reg & 0x04) -#define RTC_24HRS_ENCODED(reg) (reg & 0x02) - -typedef struct -{ - uint32_t year; // use int32 as we need to store the 4-digit year - uint8_t month; - uint8_t day; - uint8_t weekday; - uint8_t hour; - uint8_t minute; - uint8_t second; -} rtc_datetime; - - -uint8_t -rtc_read_reg(uint8_t reg_selector); - -void -rtc_get_datetime(rtc_datetime* datetime); +#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) + +void +rtc_init(); + +u8_t +rtc_read_reg(u8_t reg_selector); + +u8_t +bcd2dec(u8_t bcd); + +void +rtc_write_reg(u8_t reg_selector, u8_t val); + +void +rtc_enable_timer(); + +void +rtc_disable_timer(); #endif /* __LUNAIX_RTC_H */