at91sam7x.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. #ifndef _ARCH_ARM_SAM7X_H_
  2. #define _ARCH_ARM_SAM7X_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 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. * Change to sam7x.h
  36. * By HU Daoxu, 2006/05/26
  37. *
  38. * \file arch/arm/at91sam7x.h
  39. * \brief AT91 peripherals.
  40. *
  41. * \verbatim
  42. *
  43. * $Log: at91sam7x.h,v $
  44. * Revision 1.8 2007/02/15 16:11:14 haraldkipp
  45. * Support for system controller interrupts added.
  46. *
  47. * Revision 1.7 2006/10/08 16:48:09 haraldkipp
  48. * Documentation fixed
  49. *
  50. * Revision 1.6 2006/09/29 12:45:08 haraldkipp
  51. * Added PIO features and SPI peripheral selections.
  52. *
  53. * Revision 1.5 2006/09/07 09:09:06 haraldkipp
  54. * Added missing definitions for peripheral multiplexing. Now following the
  55. * same naming conventions like those for the SAM9260.
  56. *
  57. * Revision 1.4 2006/08/05 11:57:38 haraldkipp
  58. * PDC register configuration added.
  59. * Added register definitions for synchronous serial controller.
  60. *
  61. * Revision 1.3 2006/07/21 09:03:56 haraldkipp
  62. * Added SPI support, kindly contributed by Andras Albert.
  63. *
  64. * Revision 1.2 2006/07/15 11:14:45 haraldkipp
  65. * Missing base addresses and peripheral IDs added.
  66. *
  67. * Revision 1.1 2006/07/05 07:45:28 haraldkipp
  68. * Split on-chip interface definitions.
  69. *
  70. * Revision 1.3 2006/01/05 16:52:49 haraldkipp
  71. * Baudrate calculation is now based on NutGetCpuClock().
  72. * The AT91_US_BAUD macro had been marked deprecated.
  73. *
  74. * Revision 1.2 2005/11/20 14:44:14 haraldkipp
  75. * Register offsets added.
  76. *
  77. * Revision 1.1 2005/10/24 10:31:13 haraldkipp
  78. * Moved from parent directory.
  79. *
  80. *
  81. * \endverbatim
  82. */
  83. #define FLASH_BASE 0x100000UL
  84. #define RAM_BASE 0x200000UL
  85. #define TC_BASE 0xFFFA0000 /*!< \brief Timer/counter base address. */
  86. #define UDP_BASE 0xFFFB0000 /*!< \brief USB device port base address. */
  87. #define TWI_BASE 0xFFFB8000 /*!< \brief Two-wire interface base address. */
  88. #define USART0_BASE 0xFFFC0000 /*!< \brief USART 0 base address. */
  89. #define USART1_BASE 0xFFFC4000 /*!< \brief USART 1 base address. */
  90. #define PWMC_BASE 0xFFFCC000 /*!< \brief PWM controller base address. */
  91. #define CAN_BASE 0xFFFD0000 /*!< \brief CAN controller base address. */
  92. #define SSC_BASE 0xFFFD4000 /*!< \brief Serial synchronous controller base address. */
  93. #define ADC_BASE 0xFFFD8000 /*!< \brief ADC base address. */
  94. #define EMAC_BASE 0xFFFDC000 /*!< \brief EMAC base address. */
  95. #define SPI0_BASE 0xFFFE0000 /*!< \brief SPI0 base address. */
  96. #define SPI1_BASE 0xFFFE4000 /*!< \brief SPI0 base address. */
  97. #define AIC_BASE 0xFFFFF000 /*!< \brief AIC base address. */
  98. #define DBGU_BASE 0xFFFFF200 /*!< \brief DBGU base address. */
  99. #define PIOA_BASE 0xFFFFF400 /*!< \brief PIO A base address. */
  100. #define PIOB_BASE 0xFFFFF600 /*!< \brief PIO B base address. */
  101. #define PMC_BASE 0xFFFFFC00 /*!< \brief PMC base address. */
  102. #define RSTC_BASE 0xFFFFFD00 /*!< \brief Resect controller register base address. */
  103. #define RTT_BASE 0xFFFFFD20 /*!< \brief Realtime timer base address. */
  104. #define PIT_BASE 0xFFFFFD30 /*!< \brief Periodic interval timer base address. */
  105. #define WDT_BASE 0xFFFFFD40 /*!< \brief Watch Dog register base address. */
  106. #define VREG_BASE 0xFFFFFD60 /*!< \brief Voltage regulator mode controller base address. */
  107. #define MC_BASE 0xFFFFFF00 /*!< \brief Memory controller base. */
  108. #define PERIPH_RPR_OFF 0x00000100 /*!< \brief Receive pointer register offset. */
  109. #define PERIPH_RCR_OFF 0x00000104 /*!< \brief Receive counter register offset. */
  110. #define PERIPH_TPR_OFF 0x00000108 /*!< \brief Transmit pointer register offset. */
  111. #define PERIPH_TCR_OFF 0x0000010C /*!< \brief Transmit counter register offset. */
  112. #define PERIPH_RNPR_OFF 0x00000110 /*!< \brief Receive next pointer register offset. */
  113. #define PERIPH_RNCR_OFF 0x00000114 /*!< \brief Receive next counter register offset. */
  114. #define PERIPH_TNPR_OFF 0x00000118 /*!< \brief Transmit next pointer register offset. */
  115. #define PERIPH_TNCR_OFF 0x0000011C /*!< \brief Transmit next counter register offset. */
  116. #define PERIPH_PTCR_OFF 0x00000120 /*!< \brief PDC transfer control register offset. */
  117. #define PERIPH_PTSR_OFF 0x00000124 /*!< \brief PDC transfer status register offset. */
  118. #define PDC_RXTEN 0x00000001 /*!< \brief Receiver transfer enable. */
  119. #define PDC_RXTDIS 0x00000002 /*!< \brief Receiver transfer disable. */
  120. #define PDC_TXTEN 0x00000100 /*!< \brief Transmitter transfer enable. */
  121. #define PDC_TXTDIS 0x00000200 /*!< \brief Transmitter transfer disable. */
  122. #define DBGU_HAS_PDC
  123. #define SPI_HAS_PDC
  124. #define SSC_HAS_PDC
  125. #define USART_HAS_PDC
  126. #define PIO_HAS_MULTIDRIVER
  127. #define PIO_HAS_PULLUP
  128. #define PIO_HAS_PERIPHERALSELECT
  129. #define PIO_HAS_OUTPUTWRITEENABLE
  130. #include <arch/arm/at91_tc.h>
  131. #include <arch/arm/at91_us.h>
  132. #include <arch/arm/at91_dbgu.h>
  133. #include <arch/arm/at91_emac.h>
  134. #include <arch/arm/at91_spi.h>
  135. #include <arch/arm/at91_aic.h>
  136. #include <arch/arm/at91_pio.h>
  137. #include <arch/arm/at91_pmc.h>
  138. #include <arch/arm/at91_rstc.h>
  139. #include <arch/arm/at91_wdt.h>
  140. #include <arch/arm/at91_pit.h>
  141. #include <arch/arm/at91_mc.h>
  142. #include <arch/arm/at91_ssc.h>
  143. /*! \addtogroup xgNutArchArmAt91Sam7x */
  144. /*@{*/
  145. /*! \name Peripheral Identifiers and Interrupts */
  146. /*@{*/
  147. #define FIQ_ID 0 /*!< \brief Fast interrupt ID. */
  148. #define SYSC_ID 1 /*!< \brief System controller interrupt. */
  149. #define PIOA_ID 2 /*!< \brief Parallel I/O controller ID. */
  150. #define PIOB_ID 3 /*!< \brief Parallel I/O controller ID. */
  151. #define SPI0_ID 4 /*!< \brief Serial peripheral interface 0 ID. */
  152. #define SPI1_ID 5 /*!< \brief Serial peripheral interface 1 ID. */
  153. #define US0_ID 6 /*!< \brief USART 0 ID. */
  154. #define US1_ID 7 /*!< \brief USART 1 ID. */
  155. #define SSC_ID 8 /*!< \brief Synchronous serial controller ID. */
  156. #define TWI_ID 9 /*!< \brief Two-wire interface ID. */
  157. #define PWMC_ID 10 /*!< \brief PWM controller ID. */
  158. #define UDP_ID 11 /*!< \brief USB device port ID. */
  159. #define TC0_ID 12 /*!< \brief Timer 0 ID. */
  160. #define TC1_ID 13 /*!< \brief Timer 1 ID. */
  161. #define TC2_ID 14 /*!< \brief Timer 2 ID. */
  162. #define CAN_ID 15 /*!< \brief CAN controller ID. */
  163. #define EMAC_ID 16 /*!< \brief Ethernet MAC ID. */
  164. #define ADC_ID 17 /*!< \brief Analog to digital converter ID. */
  165. #define IRQ0_ID 30 /*!< \brief External interrupt 0 ID. */
  166. #define IRQ1_ID 31 /*!< \brief External interrupt 1 ID. */
  167. /*@}*/
  168. /*! \name Historical SPI0 Peripheral Multiplexing Names */
  169. /*@{*/
  170. #define SPI0_NPCS0_PA12A 12 /*!< \brief Port bit number on PIO-A Perpheral A. */
  171. #define SPI0_NPCS1_PA13A 13 /*!< \brief Port bit number on PIO-A Perpheral A. */
  172. #define SPI0_NPCS1_PA07B 7 /*!< \brief Port bit number on PIO-A Perpheral B. */
  173. #define SPI0_NPCS1_PB13B 13 /*!< \brief Port bit number on PIO-B Perpheral B. */
  174. #define SPI0_NPCS2_PA14A 14 /*!< \brief Port bit number on PIO-A Perpheral A. */
  175. #define SPI0_NPCS2_PA08B 8 /*!< \brief Port bit number on PIO-A Perpheral B. */
  176. #define SPI0_NPCS2_PB14B 14 /*!< \brief Port bit number on PIO-B Perpheral B. */
  177. #define SPI0_NPCS3_PA15A 15 /*!< \brief Port bit number on PIO-A Perpheral A. */
  178. #define SPI0_NPCS3_PA09B 9 /*!< \brief Port bit number on PIO-A Perpheral B. */
  179. #define SPI0_NPCS3_PB17B 17 /*!< \brief Port bit number on PIO-B Perpheral B. */
  180. #define SPI0_MISO_PA16A 16 /*!< \brief Port bit number on PIO-A Perpheral A. */
  181. #define SPI0_MOSI_PA17A 17 /*!< \brief Port bit number on PIO-A Perpheral A. */
  182. #define SPI0_SPCK_PA18A 18 /*!< \brief Port bit number on PIO-A Perpheral A. */
  183. /*@}*/
  184. /*! \name USART Peripheral Multiplexing */
  185. /*@{*/
  186. #define PA0_RXD0_A 0
  187. #define PA1_TXD0_A 1
  188. #define PA2_SCK0_A 2
  189. #define PA3_RTS0_A 3
  190. #define PA4_CTS0_A 4
  191. #define PA5_RXD1_A 5
  192. #define PA6_TXD1_A 6
  193. #define PA7_SCK1_A 7
  194. #define PA8_RTS1_A 8
  195. #define PA9_CTS1_A 9
  196. #define PB23_DCD1_B 23
  197. #define PB24_DSR1_B 24
  198. #define PB25_DTR1_B 25
  199. #define PB26_RI1_B 26
  200. /*@}*/
  201. /*! \name SPI Peripheral Multiplexing */
  202. /*@{*/
  203. #define PA16_SPI0_MISO_A 16
  204. #define PA17_SPI0_MOSI_A 17
  205. #define PA18_SPI0_SPCK_A 18
  206. #define PA12_SPI0_NPCS0_A 12
  207. #define PA13_SPI0_NPCS1_A 13
  208. #define PA7_SPI0_NPCS1_B 7
  209. #define PA14_SPI0_NPCS2_A 14
  210. #define PB14_SPI0_NPCS2_B 14
  211. #define PA8_SPI0_NPCS2_B 8
  212. #define PA15_SPI0_NPCS3_A 15
  213. #define PA9_SPI0_NPCS3_B 9
  214. #define SPI0_PINS _BV(PA16_SPI0_MISO_A) | _BV(PA17_SPI0_MOSI_A) | _BV(PA18_SPI0_SPCK_A)
  215. #define SPI0_PIO_BASE PIOA_BASE
  216. #define SPI0_PSR_OFF PIO_ASR_OFF
  217. #define SPI0_CS0_PIN _BV(PA12_SPI0_NPCS0_A)
  218. #define SPI0_CS0_PIO_BASE PIOA_BASE
  219. #define SPI0_CS0_PSR_OFF PIO_ASR_OFF
  220. #ifndef SPI0_CS1_PIN
  221. #define SPI0_CS1_PIN _BV(PA13_SPI0_NPCS1_A)
  222. #define SPI0_CS1_PIO_BASE PIOA_BASE
  223. #define SPI0_CS1_PSR_OFF PIO_ASR_OFF
  224. #endif
  225. #ifndef SPI0_CS2_PIN
  226. #define SPI0_CS2_PIN _BV(PA14_SPI0_NPCS2_A)
  227. #define SPI0_CS2_PIO_BASE PIOA_BASE
  228. #define SPI0_CS2_PSR_OFF PIO_ASR_OFF
  229. #endif
  230. #ifndef SPI0_CS3_PIN
  231. #define SPI0_CS3_PIN _BV(PA15_SPI0_NPCS3_A)
  232. #define SPI0_CS3_PIO_BASE PIOA_BASE
  233. #define SPI0_CS3_PSR_OFF PIO_ASR_OFF
  234. #endif
  235. #define PA24_SPI1_MISO_B 24
  236. #define PA23_SPI1_MOSI_B 23
  237. #define PA22_SPI1_SPCK_B 22
  238. #define PA21_SPI1_NPCS0_B 21
  239. #define PA25_SPI1_NPCS1_B 25
  240. #define PB13_SPI0_NPCS1_B 13
  241. #define PA2_SPI1_NPCS1_B 2
  242. #define PB10_SPI1_NPCS1_B 10
  243. #define PA26_SPI1_NPCS2_B 26
  244. #define PA3_SPI1_NPCS2_B 3
  245. #define PB11_SPI1_NPCS2_B 11
  246. #define PB17_SPI0_NPCS3_B 17
  247. #define PA4_SPI1_NPCS3_B 4
  248. #define PA29_SPI1_NPCS3_B 29
  249. #define PB16_SPI1_NPCS3_B 16
  250. #define SPI1_PINS _BV(PA24_SPI1_MISO_B) | _BV(PA23_SPI1_MOSI_B) | _BV(PA22_SPI1_SPCK_B)
  251. #define SPI1_PIO_BASE PIOA_BASE
  252. #define SPI1_PSR_OFF PIO_BSR_OFF
  253. #define SPI1_CS0_PIN _BV(PA21_SPI1_NPCS0_B)
  254. #define SPI1_CS0_PIO_BASE PIOA_BASE
  255. #define SPI1_CS0_PSR_OFF PIO_BSR_OFF
  256. #ifndef SPI1_CS1_PIN
  257. #define SPI1_CS1_PIN _BV(PA25_SPI1_NPCS1_B)
  258. #define SPI1_CS1_PIO_BASE PIOA_BASE
  259. #define SPI1_CS1_PSR_OFF PIO_BSR_OFF
  260. #endif
  261. #ifndef SPI1_CS2_PIN
  262. #define SPI1_CS2_PIN _BV(PA26_SPI1_NPCS2_B)
  263. #define SPI1_CS2_PIO_BASE PIOA_BASE
  264. #define SPI1_CS2_PSR_OFF PIO_BSR_OFF
  265. #endif
  266. #ifndef SPI1_CS3_PIN
  267. #define SPI1_CS3_PIN _BV(PA29_SPI1_NPCS3_B)
  268. #define SPI1_CS3_PIO_BASE PIOA_BASE
  269. #define SPI1_CS3_PSR_OFF PIO_BSR_OFF
  270. #endif
  271. /*@}*/
  272. /*! \name EMAC Interface Peripheral Multiplexing */
  273. /*@{*/
  274. #define PB0_ETXCK_EREFCK_A 0
  275. #define PB1_ETXEN_A 1
  276. #define PB2_ETX0_A 2
  277. #define PB3_ETX1_A 3
  278. #define PB4_ECRS_A 4
  279. #define PB5_ERX0_A 5
  280. #define PB6_ERX1_A 6
  281. #define PB7_ERXER_A 7
  282. #define PB8_EMDC_A 8
  283. #define PB9_EMDIO_A 9
  284. #define PB10_ETX2_A 10
  285. #define PB11_ETX3_A 11
  286. #define PB12_ETXER_A 12
  287. #define PB13_ERX2_A 13
  288. #define PB14_ERX3_A 14
  289. #define PB15_ERXDV_ECRSDV_A 15
  290. #define PB16_ECOL_A 16
  291. #define PB17_ERXCK_A 17
  292. #define PB18_EF100_A 18
  293. /*@}*/
  294. /*! \name Debug Unit Peripheral Multiplexing */
  295. /*@{*/
  296. #define PA27_DRXD_A 27
  297. #define PA28_DTXD_A 28
  298. /*@}*/
  299. /*! \name Synchronous Serial Controller Peripheral Multiplexing */
  300. /*@{*/
  301. #define PA23_TD_A 23 /*!< \brief Transmit data pin. */
  302. #define PA24_RD_A 24 /*!< \brief Receive data pin. */
  303. #define PA22_TK_A 22 /*!< \brief Transmit clock pin. */
  304. #define PA25_RK_A 25 /*!< \brief Receive clock pin. */
  305. #define PA21_TF_A 21 /*!< \brief Transmit frame sync. pin. */
  306. #define PA26_RF_A 26 /*!< \brief Receive frame sync. pin. */
  307. /*@}*/
  308. /*! \name Two Wire Interface Peripheral Multiplexing */
  309. /*@{*/
  310. #define PA10_TWD_A 10 /*!< \brief Two wire serial data pin. */
  311. #define PA11_TWCK_A 11 /*!< \brief Two wire serial clock pin. */
  312. /*@}*/
  313. /*! \name Timer/Counter Peripheral Multiplexing */
  314. /*@{*/
  315. #define PB23_TIOA0_A 23
  316. #define PB24_TIOB0_A 24
  317. #define PB12_TCLK0_B 12
  318. #define PB25_TIOA1_A 25
  319. #define PB26_TIOB1_A 26
  320. #define PB19_TCLK1_B 19
  321. #define PB27_TIOA2_A 27
  322. #define PB28_TIOB2_A 28
  323. #define PA15_TCLK2_B 15
  324. /*@}*/
  325. /*! \name Clocks, Oscillators and PLLs Peripheral Multiplexing */
  326. /*@{*/
  327. #define PB0_PCK0_B 0
  328. #define PB20_PCK0_B 20
  329. #define PA13_PCK1_B 13
  330. #define PB29_PCK1_A 29
  331. #define PB21_PCK1_B 21
  332. #define PA30_PCK2_B 30
  333. #define PB30_PCK2_A 30
  334. #define PB22_PCK2_B 22
  335. #define PA27_PCK3_B 27
  336. /*@}*/
  337. /*! \name Advanced Interrupt Controller Peripheral Multiplexing */
  338. /*@{*/
  339. #define PA29_FIQ_A 29
  340. #define PA30_IRQ0_A 30
  341. #define PA14_IRQ1_B 14
  342. /*@}*/
  343. /*! \name ADC Interface Peripheral Multiplexing */
  344. /*@{*/
  345. #define PB18_ADTRG_B 18 /*!< \brief ADC trigger pin. */
  346. /*@}*/
  347. /*! \name CAN Interface Peripheral Multiplexing */
  348. /*@{*/
  349. #define PA19_CANRX_A 19
  350. #define PA20_CANTX_A 20
  351. /*@}*/
  352. /*! \name PWM Peripheral Multiplexing */
  353. /*@{*/
  354. #define PB19_PWM0_A 19
  355. #define PB27_PWM0_B 27
  356. #define PB20_PWM1_A 20
  357. #define PB28_PWM1_B 28
  358. #define PB21_PWM2_A 21
  359. #define PB29_PWM2_B 29
  360. #define PB22_PWM3_A 22
  361. #define PB30_PWM3_B 30
  362. /*@}*/
  363. /*@} xgNutArchArmAt91 */
  364. #endif /* _ARCH_ARM_AT91SAM7X_H_ */