hal_rtc_lld.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /*
  2. ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. /*
  14. Concepts and parts of this file have been contributed by Uladzimir Pylinsky
  15. aka barthess.
  16. */
  17. /**
  18. * @file hal_rtc_lld.c
  19. * @brief PLATFORM RTC subsystem low level driver source.
  20. *
  21. * @addtogroup RTC
  22. * @{
  23. */
  24. #include "hal.h"
  25. #if (HAL_USE_RTC == TRUE) || defined(__DOXYGEN__)
  26. /*===========================================================================*/
  27. /* Driver local definitions. */
  28. /*===========================================================================*/
  29. /*===========================================================================*/
  30. /* Driver exported variables. */
  31. /*===========================================================================*/
  32. /**
  33. * @brief RTC driver identifier.
  34. */
  35. #if (PLATFORM_RTC_USE_RTC1 == TRUE) && !defined(__DOXYGEN__)
  36. RTCDriver RTCD1;
  37. #endif
  38. /*===========================================================================*/
  39. /* Driver local variables and types. */
  40. /*===========================================================================*/
  41. /*===========================================================================*/
  42. /* Driver local functions. */
  43. /*===========================================================================*/
  44. /*===========================================================================*/
  45. /* Driver interrupt handlers. */
  46. /*===========================================================================*/
  47. /*===========================================================================*/
  48. /* Driver exported functions. */
  49. /*===========================================================================*/
  50. /**
  51. * @brief Enable access to registers.
  52. *
  53. * @notapi
  54. */
  55. void rtc_lld_init(void) {
  56. /* RTC object initialization.*/
  57. #if PLATFORM_RTC_USE_RTC1 == TRUE
  58. rtcObjectInit(&RTCD1);
  59. #endif
  60. }
  61. /**
  62. * @brief Set current time.
  63. * @note Fractional part will be silently ignored. There is no possibility
  64. * to set it on PLATFORM platform.
  65. * @note The function can be called from any context.
  66. *
  67. * @param[in] rtcp pointer to RTC driver structure
  68. * @param[in] timespec pointer to a @p RTCDateTime structure
  69. *
  70. * @notapi
  71. */
  72. void rtc_lld_set_time(RTCDriver *rtcp, const RTCDateTime *timespec) {
  73. (void)rtcp;
  74. (void)timespec;
  75. }
  76. /**
  77. * @brief Get current time.
  78. * @note The function can be called from any context.
  79. *
  80. * @param[in] rtcp pointer to RTC driver structure
  81. * @param[out] timespec pointer to a @p RTCDateTime structure
  82. *
  83. * @notapi
  84. */
  85. void rtc_lld_get_time(RTCDriver *rtcp, RTCDateTime *timespec) {
  86. (void)rtcp;
  87. (void)timespec;
  88. }
  89. #if (RTC_ALARMS > 0) || defined(__DOXYGEN__)
  90. /**
  91. * @brief Set alarm time.
  92. * @note Default value after BKP domain reset for both comparators is 0.
  93. * @note Function does not performs any checks of alarm time validity.
  94. * @note The function can be called from any context.
  95. *
  96. * @param[in] rtcp pointer to RTC driver structure.
  97. * @param[in] alarm alarm identifier. Can be 1 or 2.
  98. * @param[in] alarmspec pointer to a @p RTCAlarm structure.
  99. *
  100. * @notapi
  101. */
  102. void rtc_lld_set_alarm(RTCDriver *rtcp,
  103. rtcalarm_t alarm,
  104. const RTCAlarm *alarmspec) {
  105. (void)rtcp;
  106. (void)alarm;
  107. (void)alarmspec;
  108. }
  109. /**
  110. * @brief Get alarm time.
  111. * @note The function can be called from any context.
  112. *
  113. * @param[in] rtcp pointer to RTC driver structure
  114. * @param[in] alarm alarm identifier
  115. * @param[out] alarmspec pointer to a @p RTCAlarm structure
  116. *
  117. * @notapi
  118. */
  119. void rtc_lld_get_alarm(RTCDriver *rtcp,
  120. rtcalarm_t alarm,
  121. RTCAlarm *alarmspec) {
  122. (void)rtcp;
  123. (void)alarm;
  124. (void)alarmspec;
  125. }
  126. #endif /* RTC_ALARMS > 0 */
  127. #endif /* HAL_USE_RTC */
  128. /** @} */