#ifndef RTC_H #define RTC_H #ifdef __cplusplus extern "C" { #endif #define RTC_BASE 0x38027000 typedef union { unsigned int _val; struct { unsigned int_alarm_en : 1; unsigned int_it_en : 1; unsigned alrm_whup_en : 1; unsigned it_wkup_en : 1; unsigned used_cells : 4; unsigned : 24; }; } RRTC_CTRL_REG; typedef union { unsigned int _val; struct { unsigned sxth : 4; unsigned sec : 4; unsigned tsec : 3; unsigned min : 4; unsigned tmin : 3; unsigned hour : 4; unsigned thour : 2; unsigned dow : 3; unsigned msxth : 1; unsigned msec : 1; unsigned mmin : 1; unsigned mhour : 1; unsigned mdow : 1; }; } RRTC_TIME_REG; typedef union { unsigned int _val; struct { unsigned day : 4; unsigned tday : 2; unsigned mon : 4; unsigned tmon : 1; unsigned year : 4; unsigned tyear : 4; unsigned cen : 4; unsigned tcen : 4; unsigned mday : 1; unsigned mmon : 1; unsigned myear : 1; unsigned mcen : 1; unsigned : 1; }; } RRTC_DATE_REG; typedef union { unsigned int _val; struct { unsigned int_alarm : 1; unsigned int_it : 1; unsigned alrm_whup : 1; unsigned it_wkup : 1; unsigned rct_reset : 1; unsigned apb_reset : 1; unsigned : 26; }; } RRTC_STAT_REG; typedef volatile struct { volatile unsigned int ID; volatile unsigned int CTRL; volatile unsigned int TIME; volatile unsigned int DATE; volatile unsigned int TALRM; volatile unsigned int DALRM; volatile unsigned int STAT; volatile unsigned int TCNT; volatile unsigned int TCUR; volatile unsigned int skip[3]; } rtc_timer_t; rtc_timer_t *get_rtc_dev(); void get_rtc_time(RRTC_TIME_REG *time); void get_rtc_date(RRTC_DATE_REG *date); void set_rtc_alarm_time(RRTC_TIME_REG *time); void set_rtc_alarm_date(RRTC_DATE_REG *date); void enable_int_alarm(); void disable_int_alarm(); void clear_int_alarm(); #ifdef __cplusplus } #endif #endif /* UTIMERS_H */