#ifndef __BSP_RTC_H_ #define __BSP_RTC_H_ typedef struct t_rtc { uint32_t day; uint32_t hour; uint32_t minute; uint32_t second; uint32_t week; uint32_t week_alarm; uint32_t interrupt; } rtc_t; extern void Init_rtc(rtc_t *rtc); extern void rtc_Current_VAL(rtc_t *rtc); extern void rtc_Alarm_Init(uint32_t no, rtc_t *rtc); extern void Init_rtc_gpio(uint32_t num, uint32_t level); #define RTC_INT_DAY (1 << 0) #define RTC_INT_HOUR (1 << 1) #define RTC_INT_MIN (1 << 2) #define RTC_INT_SEC (1 << 3) #define RTC_INT_T1 (1 << 5) #define RTC_INT_T2 (1 << 4) #define RTC_INT_T3 (1 << 6) #define RTC_ALARM_SUN (1 << 17) #define RTC_ALARM_MON (1 << 18) #define RTC_ALARM_TUES (1 << 19) #define RTC_ALARM_WED (1 << 20) #define RTC_ALARM_THUR (1 << 21) #define RTC_ALARM_FRI (1 << 22) #define RTC_ALARM_SAT (1 << 23) #define PWRKEY_CTRL0 ((volatile unsigned *)(RTC_BASE + 0x005C)) #define PWRKEY_CTRL1 ((volatile unsigned *)(RTC_BASE + 0x0060)) #define PWRKEY_CTRL2 ((volatile unsigned *)(RTC_BASE + 0x0064)) #define PWRKEY_SOFT_CTL0 ((volatile unsigned *)(RTC_BASE + 0x0068)) #define PWRKEY_SOFT_CTL1 ((volatile unsigned *)(RTC_BASE + 0x006C)) typedef struct { uint32_t AO_TIMER_VALUE : 16; uint32_t AO_TIMER_CLR : 1; uint32_t AO_TIMER_EN : 1; uint32_t FREQ_TIMER_EN : 1; uint32_t RESERVED : 13; } AO_TIMER_CTL_T; /* 3fff 3044 --50K 2fff 4132 --39K 1fff 5229 --31K 0fff 6326 --25K */ #define MAX_LPO_RTM 0x3fff #define MIN_LPO_RTM 0x0 #define MID_LPO_RTM 0x1fff #define RANGE_LPO_RTM 0x400 #define GEARS_HZ 1.56 #define _32K_STAND_HZ 32000 // #define CALIB_STEP_CYCLE_32K 32 //32 cycle = 1ms // #define COUNT_16M 16000 // #define CALIB_STEP_CYCLE_32K 320 // 320 cycle = 10ms #define COUNT_16M 160000 // #endif