at91_rtc.h 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. #ifndef _ARCH_ARM_RTC_H_
  2. #define _ARCH_ARM_RTC_H_
  3. /*
  4. * Copyright (C) 2006-2007 by egnite Software GmbH. All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. *
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * 3. Neither the name of the copyright holders nor the names of
  16. * contributors may be used to endorse or promote products derived
  17. * from this software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  22. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  23. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  24. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  25. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  26. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  27. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  28. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  29. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  30. * SUCH DAMAGE.
  31. *
  32. * For additional information see http://www.ethernut.de/
  33. */
  34. /*!
  35. * \file arch/arm/at91_rtc.h
  36. * \brief AT91 real time clock.
  37. *
  38. * \verbatim
  39. * $Id: $
  40. * \endverbatim
  41. */
  42. /*!
  43. * \addtogroup xgNutArchArmAt91Rtc
  44. */
  45. /*@{*/
  46. #ifdef RTC_BASE
  47. /*! \name RTC Control Register */
  48. /*@{*/
  49. #define RTC_CR (RTC_BASE + 0x00) /*!< \brief RTC controller control register address. */
  50. #define RTC_UPDTIM 0x00000001 /*!< \brief Update Request Time Register. */
  51. #define RTC_UPDCAL 0x00000002 /*!< \brief Peripheral reset. */
  52. #define RTC_TIMEVSEL_MIN 0x00000008 /*!< \brief Time Event Selection - Minute change. */
  53. #define RTC_TIMEVSEL_HR 0x00000008 /*!< \brief Time Event Selection - Hour change. */
  54. #define RTC_TIMEVSEL_MIDN 0x00000008 /*!< \brief Time Event Selection - Every day at midnight. */
  55. #define RTC_TIMEVSEL_NOON 0x00000008 /*!< \brief Time Event Selection - Every day at noon. */
  56. #define RTC_CALEVSEL_WEEK 0x00000000 /*!< \brief Calendar Event Selection - Week change (every Monday at time 00:00:00. */
  57. #define RTC_CALEVSEL_MONTH 0x00000001 /*!< \brief Calendar Event Selection - Month change (every 01 of each month at time 00:00:00. */
  58. #define RTC_CALEVSEL_YEAR 0x00000003 /*!< \brief Calendar Event Selection - Year change (every January 1 at time 00:00:00. */
  59. /*@}*/
  60. /*! \name RTC Mode Register */
  61. /*@{*/
  62. #define RTC_MR (RTC_BASE + 0x04) /*!< \brief RTC controller mode register address. */
  63. #define RTC_HRMOD_24 0x00000000 /*!< \brief 24-hour Mode. */
  64. #define RTC_HRMOD_12 0x00000001 /*!< \brief 12-hour Mode. */
  65. /*@}*/
  66. /*! \name RTC Time Register */
  67. /*@{*/
  68. #define RTC_TIMR (RTC_BASE + 0x08) /*!< \brief RTC controller time register address. */
  69. #define RTC_SEC 0x0000007F /*!< \brief Current second. */
  70. #define RTC_SEC_LSB 0 /*!< \brief Least significant bit of current second. */
  71. #define RTC_MIN 0x00007F00 /*!< \brief Current minute. */
  72. #define RTC_MIN_LSB 8 /*!< \brief Least significant bit of current minute. */
  73. #define RTC_HOUR 0x003F0000 /*!< \brief Current hour. */
  74. #define RTC_HOUR_LSB 16 /*!< \brief Least significant bit of current hour. */
  75. #define RTC_AM 0x00000000 /*!< \brief Ante Meridiem Post Meridiem Indicator: AM. */
  76. #define RTC_PM 0x00400000 /*!< \brief Ante Meridiem Post Meridiem Indicator: PM. */
  77. /*@}*/
  78. /*! \name RTC Calendar Register */
  79. /*@{*/
  80. #define RTC_CALR (RTC_BASE + 0x0C) /*!< \brief RTC controller calendar register address. */
  81. #define RTC_CENT 0x0000007F /*!< \brief Current century. */
  82. #define RTC_CENT_LSB 0 /*!< \brief Least significant bit of current century. */
  83. #define RTC_YEAR 0x0000FF00 /*!< \brief Current year. */
  84. #define RTC_YEAR_LSB 8 /*!< \brief Least significant bit of current year. */
  85. #define RTC_MONTH 0x001F0000 /*!< \brief Current month. */
  86. #define RTC_MONTH_LSB 16 /*!< \brief Least significant bit of current month. */
  87. #define RTC_DAY 0x00E00000 /*!< \brief Current day (1-7). */
  88. #define RTC_DAY_LSB 21 /*!< \brief Least significant bit of current day. */
  89. #define RTC_DATE 0x3F000000 /*!< \brief Current day in current month (1-31). */
  90. #define RTC_DATE_LSB 24 /*!< \brief Least significant bit of current day in current month (1-31). */
  91. /*@}*/
  92. /*! \name RTC Time Alarm Register */
  93. /*@{*/
  94. #define RTC_TIMALR (RTC_BASE + 0x10) /*!< \brief RTC controller time alarm register address. */
  95. #define RTC_SECEN 0x00000080 /*!< \brief Second alarm enable. */
  96. #define RTC_MINEN 0x00008000 /*!< \brief Minute alarm enable. */
  97. #define RTC_HOUREN 0x00800000 /*!< \brief Hour alarm enable. */
  98. /*@}*/
  99. /*! \name RTC Calendar Alarm Register */
  100. /*@{*/
  101. #define RTC_CALALR (RTC_BASE + 0x14) /*!< \brief RTC controller calendar alarm register address. */
  102. #define RTC_DATEEN 0x80000000 /*!< \brief Second alarm enable. */
  103. #define RTC_MTHEN 0x00800000 /*!< \brief Minute alarm enable. */
  104. /*@}*/
  105. /*! \name RTC Status Register */
  106. /*@{*/
  107. #define RTC_SR (RTC_BASE + 0x18) /*!< \brief RTC controller status register address. */
  108. #define RTC_ACKUPD 0x00000001 /*!< \brief Acknowledge for Update. */
  109. #define RTC_ALARM 0x00000002 /*!< \brief Alarm flag. */
  110. #define RTC_SECEV 0x00000004 /*!< \brief Second event. */
  111. #define RTC_TIMEV 0x00000008 /*!< \brief Time event. */
  112. #define RTC_CALEV 0x00000010 /*!< \brief Calendar event. */
  113. /*@}*/
  114. /*! \name RTC Status Clear Command Register */
  115. /*@{*/
  116. #define RTC_SCCR (RTC_BASE + 0x1C) /*!< \brief RTC controller status clear register address. */
  117. #define RTC_ACKCLR 0x00000001 /*!< \brief Acknowledge clear. */
  118. #define RTC_ALRCLR 0x00000002 /*!< \brief Alarm clear. */
  119. #define RTC_SECCLR 0x00000004 /*!< \brief Second clear. */
  120. #define RTC_TIMCLR 0x00000008 /*!< \brief Time clear. */
  121. #define RTC_CALCLR 0x00000010 /*!< \brief Calendar clear. */
  122. /*@}*/
  123. /*! \name RTC Interrupt Enable/Disable/Mask Register */
  124. /*@{*/
  125. #define RTC_IER (RTC_BASE + 0x20) /*!< \brief RTC controller interrupt enable register address. */
  126. #define RTC_IDR (RTC_BASE + 0x24) /*!< \brief RTC controller interrupt disable status register address. */
  127. #define RTC_IMR (RTC_BASE + 0x28) /*!< \brief RTC controller interrupt disable status register address. */
  128. #define RTC_ACKINT 0x00000001 /*!< \brief Acknowledge update interrupt enable. */
  129. #define RTC_ALRINT 0x00000002 /*!< \brief Alarm interrupt enable. */
  130. #define RTC_SECINT 0x00000004 /*!< \brief Second interrupt enable. */
  131. #define RTC_TIMINT 0x00000008 /*!< \brief Time interrupt enable. */
  132. #define RTC_CALINT 0x00000010 /*!< \brief Calendar interrupt enable. */
  133. /*@}*/
  134. /*! \name RTC Valid Entry Register */
  135. /*@{*/
  136. #define RTC_VER (RTC_BASE + 0x2C) /*!< \brief RTC controller valid entry register address. */
  137. #define RTC_NVTIM 0x00000001 /*!< \brief Non-Valid time. */
  138. #define RTC_NVCAL 0x00000002 /*!< \brief Non-Valid calendar. */
  139. #define RTC_NVTIMALR 0x00000004 /*!< \brief Non-Valid time alarm. */
  140. #define RTC_NVCALALR 0x00000008 /*!< \brief Non-Valid calendar alarm. */
  141. /*@}*/
  142. #endif
  143. /*@} xgNutArchArmAt91Rtc */
  144. #endif /* _ARCH_ARM_RTC_H_ */