1
0

ls1c_rtc.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) 2006-2018, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2018-05-06 sundm75 first version
  9. */
  10. #ifndef __OPENLOONGSON_RTC_H
  11. #define __OPENLOONGSON_RTC_H
  12. #define RTC ( (RTC_TypeDef* )LS1C_RTC_BASE)
  13. typedef struct
  14. {
  15. unsigned char Year; /*0 ~ 99 */
  16. unsigned char Month; /*1 ~ 12 */
  17. unsigned char Date; /*1 ~ 31 */
  18. unsigned char Hours; /*0 ~ 23 */
  19. unsigned char Minutes; /*0 ~ 59 */
  20. unsigned char Seconds; /*0 ~ 59 */
  21. }RTC_TimeTypeDef;
  22. typedef struct
  23. {
  24. unsigned long SYS_TOYWRITE0;
  25. unsigned long SYS_TOYWRITE1;
  26. unsigned long SYS_TOYREAD0;
  27. unsigned long SYS_TOYREAD1;
  28. } RTC_TypeDef;
  29. int RTC_SetTime(RTC_TypeDef *hrtc, RTC_TimeTypeDef *sTime);
  30. int RTC_GetTime(RTC_TypeDef *hrtc, RTC_TimeTypeDef *sTime);
  31. unsigned char RTC_IsLeapYear(unsigned int nYear);
  32. unsigned char RTC_WeekDayNum(unsigned long nYear, unsigned char nMonth, unsigned char nDay);
  33. #endif