rtc.h 775 B

1234567891011121314151617181920212223
  1. #ifndef __RTC_H
  2. #define __RTC_H
  3. #include "cst92f2x.h"
  4. #include "OSAL_Clock.h"
  5. #define REG_RTC_CC2 (*((volatile unsigned int *)(0x4000f034)))
  6. #define RTCCNT (*((volatile unsigned int *)(0x4000f028)))
  7. #define RTC_TIMEBASE (*((volatile uint64_t *) (0x1ffffff0))) //RTC Timebase,64BIT,uint:s
  8. #define RTC_CNT_RANGE 0xFFFFFFFF //rtc counter is 32bits
  9. #define RTC_CLK_FREQ 32768 //rtc clock frequency is 32.768KHz
  10. #define US_OF_S 1000000 //1S
  11. void HalRtcGetTime(UTCTimeStruct *getTime); //HalRtcUpdate or HalRtcGetTime function should be called periodically, the periodic time < 512s, recommend 60s
  12. void HalRtcSetTime(UTCTimeStruct *setTime);
  13. UTCTime HalRtcGet_Utc(void);
  14. void HalRtcSet_Utc(UTCTime utc);
  15. void HalRtcInit(void);
  16. #endif