at91_pmc.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. #ifndef _ARCH_ARM_AT91_PMC_H_
  2. #define _ARCH_ARM_AT91_PMC_H_
  3. /*
  4. * Copyright (C) 2005-2006 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 EGNITE SOFTWARE GMBH 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 EGNITE
  23. * SOFTWARE GMBH 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_pmc.h
  36. * \brief AT91 peripherals.
  37. *
  38. * \verbatim
  39. *
  40. * $Log: at91_pmc.h,v $
  41. * Revision 1.6 2006/09/29 12:43:44 haraldkipp
  42. * Excluded second PLL from SAM7X builds. Corrected USB divider names.
  43. *
  44. * Revision 1.5 2006/08/31 19:08:14 haraldkipp
  45. * Defining register offsets simplifies assembly programming.
  46. *
  47. * Revision 1.4 2006/08/05 11:59:23 haraldkipp
  48. * Wrong PMC register offsets fixed.
  49. *
  50. * Revision 1.3 2006/07/26 11:22:05 haraldkipp
  51. * Added shift values for multi-bit parameters.
  52. *
  53. * Revision 1.2 2006/07/18 14:05:26 haraldkipp
  54. * Changed coding style to follow existing headers.
  55. *
  56. * Revision 1.1 2006/07/05 07:45:28 haraldkipp
  57. * Split on-chip interface definitions.
  58. *
  59. *
  60. * \endverbatim
  61. */
  62. /*!
  63. * \addtogroup xgNutArchArmAt91Pmc
  64. */
  65. /*@{*/
  66. /*! \name System Clock Enable, Disable and Status Register */
  67. /*@{*/
  68. #define PMC_SCER_OFF 0x00000000 /*!< \brief System clock enable register offset. */
  69. #define PMC_SCER (PMC_BASE + PMC_SCER_OFF) /*!< \brief System clock enable register address. */
  70. #define PMC_SCDR_OFF 0x00000004 /*!< \brief System clock disable register offset. */
  71. #define PMC_SCDR (PMC_BASE + PMC_SCDR_OFF) /*!< \brief System clock disable register address. */
  72. #define PMC_SCSR_OFF 0x00000008 /*!< \brief System clock status register offset. */
  73. #define PMC_SCSR (PMC_BASE + PMC_SCSR_OFF) /*!< \brief System clock status register address. */
  74. #define PMC_PCK 0x00000001 /*!< \brief Processor clock. */
  75. #define PMC_UHP 0x00000040 /*!< \brief USB host port clock. */
  76. #define PMC_UDP 0x00000080 /*!< \brief USB device port clock. */
  77. #define PMC_PCK0 0x00000100 /*!< \brief Programmable clock 0 output. */
  78. #define PMC_PCK1 0x00000200 /*!< \brief Programmable clock 1 output. */
  79. #define PMC_PCK2 0x00000400 /*!< \brief Programmable clock 2 output. */
  80. #define PMC_PCK3 0x00000800 /*!< \brief Programmable clock 3 output. */
  81. /*@}*/
  82. /*! \name Peripheral Clock Enable, Disable and Status Register */
  83. /*@{*/
  84. #define PMC_PCER_OFF 0x00000010 /*!< \brief Peripheral clock enable register offset. */
  85. #define PMC_PCER (PMC_BASE + PMC_PCER_OFF) /*!< \brief Peripheral clock enable register address. */
  86. #define PMC_PCDR_OFF 0x00000014 /*!< \brief Peripheral clock disable register offset. */
  87. #define PMC_PCDR (PMC_BASE + PMC_PCDR_OFF) /*!< \brief Peripheral clock disable register address. */
  88. #define PMC_PCSR_OFF 0x00000018 /*!< \brief Peripheral clock status register offset. */
  89. #define PMC_PCSR (PMC_BASE + PMC_PCSR_OFF) /*!< \brief Peripheral clock status register address. */
  90. /*@}*/
  91. /*! \name Clock Generator Main Oscillator Register */
  92. /*@{*/
  93. #define CKGR_MOR_OFF 0x00000020 /*!< \brief Main oscillator register offset. */
  94. #define CKGR_MOR (PMC_BASE + CKGR_MOR_OFF) /*!< \brief Main oscillator register address. */
  95. #define CKGR_MOSCEN 0x00000001 /*!< \brief Main oscillator enable. */
  96. #define CKGR_OSCBYPASS 0x00000002 /*!< \brief Main oscillator bypass. */
  97. #define CKGR_OSCOUNT 0x0000FF00 /*!< \brief Main oscillator start-up time mask. */
  98. #define CKGR_OSCOUNT_LSB 8 /*!< \brief Main oscillator start-up time LSB. */
  99. /*@}*/
  100. /*! \name Clock Generator Main Clock Frequency Register */
  101. /*@{*/
  102. #define CKGR_MCFR_OFF 0x00000024 /*!< \brief Main clock frequency register offset. */
  103. #define CKGR_MCFR (PMC_BASE + CKGR_MCFR_OFF) /*!< \brief Main clock frequency register address. */
  104. #define CKGR_MAINF 0x0000FFFF /*!< \brief Main clock frequency mask mask. */
  105. #define CKGR_MAINF_OFF 0 /*!< \brief Main clock frequency mask LSB. */
  106. #define CKGR_MAINRDY 0x00010000 /*!< \brief Main clock ready. */
  107. /*@}*/
  108. /*! \name PLL Registers */
  109. /*@{*/
  110. #if defined (MCU_AT91SAM9260)
  111. #define CKGR_PLLAR_OFF 0x00000028 /*!< \brief Clock generator PLL register offset. */
  112. #define CKGR_PLLAR (PMC_BASE + CKGR_PLLAR_OFF) /*!< \brief Clock generator PLL register address. */
  113. #define CKGR_PLLBR_OFF 0x0000002C /*!< \brief Clock generator PLL register offset. */
  114. #define CKGR_PLLBR (PMC_BASE + CKGR_PLLBR_OFF) /*!< \brief Clock generator PLL register address. */
  115. #elif defined (MCU_AT91SAM7X256)
  116. #define CKGR_PLLR_OFF 0x0000002C /*!< \brief Clock generator PLL register offset. */
  117. #define CKGR_PLLR (PMC_BASE + CKGR_PLLR_OFF) /*!< \brief Clock generator PLL register address. */
  118. #endif
  119. #define CKGR_DIV 0x000000FF /*!< \brief Divider. */
  120. #define CKGR_DIV_LSB 0 /*!< \brief Least significant bit of the divider. */
  121. #define CKGR_DIV_0 0x00000000 /*!< \brief Divider output is 0. */
  122. #define CKGR_DIV_BYPASS 0x00000001 /*!< \brief Divider is bypassed. */
  123. #define CKGR_PLLCOUNT 0x00003F00 /*!< \brief PLL counter mask. */
  124. #define CKGR_PLLCOUNT_LSB 8 /*!< \brief PLL counter LSB. */
  125. #define CKGR_OUT 0x0000C000 /*!< \brief PLL output frequency range. */
  126. #define CKGR_OUT_0 0x00000000 /*!< \brief Please refer to the PLL datasheet. */
  127. #define CKGR_OUT_1 0x00004000 /*!< \brief Please refer to the PLL datasheet. */
  128. #define CKGR_OUT_2 0x00008000 /*!< \brief Please refer to the PLL datasheet. */
  129. #define CKGR_OUT_3 0x0000C000 /*!< \brief Please refer to the PLL datasheet. */
  130. #define CKGR_MUL 0x07FF0000 /*!< \brief PLL multiplier. */
  131. #define CKGR_MUL_LSB 16 /*!< \brief Least significant bit of the PLL multiplier. */
  132. #define CKGR_USBDIV 0x30000000 /*!< \brief Divider for USB clocks. */
  133. #define CKGR_USBDIV_1 0x00000000 /*!< \brief Divider output is PLL clock output. */
  134. #define CKGR_USBDIV_2 0x10000000 /*!< \brief Divider output is PLL clock output divided by 2. */
  135. #define CKGR_USBDIV_4 0x20000000 /*!< \brief Divider output is PLL clock output divided by 4. */
  136. /*@}*/
  137. /*! \name Master Clock Register */
  138. /*@{*/
  139. #define PMC_MCKR_OFF 0x00000030 /*!< \brief Master clock register offset. */
  140. #define PMC_MCKR (PMC_BASE + PMC_MCKR_OFF) /*!< \brief Master clock register address. */
  141. #define PMC_ACKR_OFF 0x00000034 /*!< \brief Application clock register offset. */
  142. #define PMC_ACKR (PMC_BASE + PMC_ACKR_OFF) /*!< \brief Application clock register address. */
  143. #define PMC_PCKR0_OFF 0x00000040 /*!< \brief Programmable clock 0 register offset. */
  144. #define PMC_PCKR0 (PMC_BASE + PMC_PCKR0_OFF) /*!< \brief Programmable clock 0 register address. */
  145. #define PMC_PCKR1_OFF 0x00000044 /*!< \brief Programmable clock 1 register offset. */
  146. #define PMC_PCKR1 (PMC_BASE + PMC_PCKR1_OFF) /*!< \brief Programmable clock 1 register address. */
  147. #define PMC_PCKR2_OFF 0x00000048 /*!< \brief Programmable clock 2 register offset. */
  148. #define PMC_PCKR2 (PMC_BASE + PMC_PCKR2_OFF) /*!< \brief Programmable clock 2 register address. */
  149. #define PMC_PCKR3_OFF 0x0000004C /*!< \brief Programmable clock 3 register offset. */
  150. #define PMC_PCKR3 (PMC_BASE + PMC_PCKR3_OFF) /*!< \brief Programmable clock 3 register address. */
  151. #define PMC_CSS 0x00000003 /*!< \brief Clock selection mask. */
  152. #define PMC_CSS_SLOW_CLK 0x00000000 /*!< \brief Slow clock selected. */
  153. #define PMC_CSS_MAIN_CLK 0x00000001 /*!< \brief Main clock selected. */
  154. #if defined (MCU_AT91SAM9260)
  155. #define PMC_CSS_PLLA_CLK 0x00000002 /*!< \brief PLL A clock selected. */
  156. #define PMC_CSS_PLLB_CLK 0x00000003 /*!< \brief PLL B clock selected. */
  157. #elif defined (MCU_AT91SAM7X256)
  158. #define PMC_CSS_PLL_CLK 0x00000003 /*!< \brief PLL clock selected. */
  159. #endif
  160. #define PMC_PRES 0x0000001C /*!< \brief Clock prescaler mask. */
  161. #define PMC_PRES_LSB 2 /*!< \brief Clock prescaler LSB. */
  162. #define PMC_PRES_CLK 0x00000000 /*!< \brief Selected clock, not divided. */
  163. #define PMC_PRES_CLK_2 0x00000004 /*!< \brief Selected clock divided by 2. */
  164. #define PMC_PRES_CLK_4 0x00000008 /*!< \brief Selected clock divided by 4. */
  165. #define PMC_PRES_CLK_8 0x0000000C /*!< \brief Selected clock divided by 8. */
  166. #define PMC_PRES_CLK_16 0x00000010 /*!< \brief Selected clock divided by 16. */
  167. #define PMC_PRES_CLK_32 0x00000014 /*!< \brief Selected clock divided by 32. */
  168. #define PMC_PRES_CLK_64 0x00000018 /*!< \brief Selected clock divided by 64. */
  169. #if defined (MCU_AT91SAM9260)
  170. #define PMC_MDIV 0x00000300 /*!< \brief Master clock division mask. */
  171. #define PMC_MDIV_1 0x00000000 /*!< \brief Processor clock, not divided. */
  172. #define PMC_MDIV_2 0x00000100 /*!< \brief Processor clock divided by 2. */
  173. #define PMC_MDIV_4 0x00000200 /*!< \brief Processor clock divided by 4. */
  174. #endif
  175. /*@}*/
  176. /*! \name Power Management Status and Interrupt Registers */
  177. /*@{*/
  178. #define PMC_IER_OFF 0x00000060 /*!< \brief Interrupt enable register offset. */
  179. #define PMC_IER (PMC_BASE + PMC_IER_OFF) /*!< \brief Interrupt enable register address. */
  180. #define PMC_IDR_OFF 0x00000064 /*!< \brief Interrupt disable register offset. */
  181. #define PMC_IDR (PMC_BASE + PMC_IDR_OFF) /*!< \brief Interrupt disable register address. */
  182. #define PMC_SR_OFF 0x00000068 /*!< \brief Status register offset. */
  183. #define PMC_SR (PMC_BASE + PMC_SR_OFF) /*!< \brief Status register address. */
  184. #define PMC_IMR_OFF 0x0000006C /*!< \brief Interrupt mask register offset. */
  185. #define PMC_IMR (PMC_BASE + PMC_IMR_OFF) /*!< \brief Interrupt mask register address. */
  186. #define PMC_MOSCS 0x00000001 /*!< \brief Main oscillator. */
  187. #if defined (MCU_AT91SAM9260)
  188. #define PMC_LOCKA 0x00000002 /*!< \brief PLL A lock. */
  189. #define PMC_LOCKB 0x00000004 /*!< \brief PLL B lock. */
  190. #elif defined (MCU_AT91SAM7X256)
  191. #define PMC_LOCK 0x00000004 /*!< \brief PLL lock. */
  192. #endif
  193. #define PMC_MCKRDY 0x00000008 /*!< \brief Master clock ready. */
  194. #define PMC_OSC_SEL 0x00000080 /*!< \brief Slow clock oscillator selection. */
  195. #define PMC_PCKRDY0 0x00000100 /*!< \brief Programmable clock 0 ready. */
  196. #define PMC_PCKRDY1 0x00000200 /*!< \brief Programmable clock 1 ready. */
  197. #define PMC_PCKRDY2 0x00000400 /*!< \brief Programmable clock 2 ready. */
  198. #define PMC_PCKRDY3 0x00000800 /*!< \brief Programmable clock 3 ready. */
  199. /*@}*/
  200. /*@} xgNutArchArmAt91Pmc */
  201. #endif /* _ARCH_ARM_AT91_PMC_H_ */