rtc.h 1016 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef RTC_H
  7. #define RTC_H
  8. /* RTC registers */
  9. enum {
  10. RTC_BBPU = 0xE000,
  11. RTC_IRQ_STA = 0xE002,
  12. RTC_IRQ_EN = 0xE004,
  13. RTC_CII_EN = 0xE006
  14. };
  15. enum {
  16. RTC_OSC32CON = 0xE026,
  17. RTC_CON = 0xE03E,
  18. RTC_WRTGR = 0xE03C
  19. };
  20. enum {
  21. RTC_PDN1 = 0xE02C,
  22. RTC_PDN2 = 0xE02E,
  23. RTC_SPAR0 = 0xE030,
  24. RTC_SPAR1 = 0xE032,
  25. RTC_PROT = 0xE036,
  26. RTC_DIFF = 0xE038,
  27. RTC_CALI = 0xE03A
  28. };
  29. enum {
  30. RTC_PROT_UNLOCK1 = 0x586A,
  31. RTC_PROT_UNLOCK2 = 0x9136
  32. };
  33. enum {
  34. RTC_BBPU_PWREN = 1U << 0,
  35. RTC_BBPU_BBPU = 1U << 2,
  36. RTC_BBPU_AUTO = 1U << 3,
  37. RTC_BBPU_CLRPKY = 1U << 4,
  38. RTC_BBPU_RELOAD = 1U << 5,
  39. RTC_BBPU_CBUSY = 1U << 6
  40. };
  41. enum {
  42. RTC_BBPU_KEY = 0x43 << 8
  43. };
  44. /* external API */
  45. uint16_t RTC_Read(uint32_t addr);
  46. void RTC_Write(uint32_t addr, uint16_t data);
  47. int32_t rtc_busy_wait(void);
  48. int32_t RTC_Write_Trigger(void);
  49. int32_t Writeif_unlock(void);
  50. void rtc_bbpu_power_down(void);
  51. #endif /* RTC_H */