wm_rtc.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /**
  2. * @file wm_rtc.h
  3. *
  4. * @brief rtc Driver Module
  5. *
  6. * @author dave
  7. *
  8. * Copyright (c) 2014 Winner Microelectronics Co., Ltd.
  9. */
  10. #ifndef WM_RTC_H
  11. #define WM_RTC_H
  12. #include <time.h>
  13. #include "wm_type_def.h"
  14. /** rtc interrupt callback */
  15. typedef void (*tls_rtc_irq_callback)(void *arg);
  16. /**
  17. * @defgroup Driver_APIs Driver APIs
  18. * @brief Driver APIs
  19. */
  20. /**
  21. * @addtogroup Driver_APIs
  22. * @{
  23. */
  24. /**
  25. * @defgroup RTC_Driver_APIs RTC Driver APIs
  26. * @brief RTC driver APIs
  27. */
  28. /**
  29. * @addtogroup RTC_Driver_APIs
  30. * @{
  31. */
  32. /**
  33. * @brief This function is used to set pmu rtc time
  34. *
  35. * @param[in] tblock time value
  36. *
  37. * @return None
  38. *
  39. * @note None
  40. */
  41. void tls_set_rtc(struct tm *tblock);
  42. /**
  43. * @brief This function is used to get pmu rtc time
  44. *
  45. * @param[out] tblock time value
  46. *
  47. * @return None
  48. *
  49. * @note None
  50. */
  51. void tls_get_rtc(struct tm *tblock);
  52. /**
  53. * @brief This function is used to register pmu rtc interrupt
  54. *
  55. * @param[in] callback the rtc interrupt call back function
  56. * @param[in] arg parameter of call back function
  57. *
  58. * @return None
  59. *
  60. * @note
  61. * User does not need to clear the interrupt flag.
  62. * Rtc callback function is called in interrupt,
  63. * so do not operate the critical data in the callback fuuction.
  64. * Sending messages to other tasks to handle is recommended.
  65. */
  66. void tls_rtc_isr_register(tls_rtc_irq_callback callback, void *arg);
  67. /**
  68. * @brief This function is used to start pmu rtc timer
  69. *
  70. * @param[in] tblock timer value
  71. *
  72. * @return None
  73. *
  74. * @note None
  75. */
  76. void tls_rtc_timer_start(struct tm *tblock);
  77. /**
  78. * @brief This function is used to stop pmu rtc timer
  79. *
  80. * @param None
  81. *
  82. * @return None
  83. *
  84. * @note This function also is used to clear rtc timer interrupt
  85. */
  86. void tls_rtc_timer_stop(void);
  87. /**
  88. * @}
  89. */
  90. /**
  91. * @}
  92. */
  93. #endif