at91sam7s.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. #ifndef _ARCH_ARM_SAM7S_H_
  2. #define _ARCH_ARM_SAM7S_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. * Change to sam7s.h
  36. * By Justin Bennett, 2007/09/12
  37. *
  38. * \file arch/arm/at91sam7s.h
  39. * \brief AT91 peripherals.
  40. *
  41. * \verbatim
  42. *
  43. * Revision 1.2 2010/12/15 21:46:28 ve2yag
  44. * Add PWM interrupt support for AT91SAM7S and SE.
  45. *
  46. * Revision 1.1 2007/09/12 jbennett
  47. * Branched from at91sam7x.h version 1.7
  48. *
  49. *
  50. * \endverbatim
  51. */
  52. #define FLASH_BASE 0x100000UL
  53. #define RAM_BASE 0x200000UL
  54. #define TC_BASE 0xFFFA0000 /*!< \brief Timer/counter base address. */
  55. #define UDP_BASE 0xFFFB0000 /*!< \brief USB device port base address. */
  56. #define TWI_BASE 0xFFFB8000 /*!< \brief Two-wire interface base address. */
  57. #define USART0_BASE 0xFFFC0000 /*!< \brief USART 0 base address. */
  58. #define USART1_BASE 0xFFFC4000 /*!< \brief USART 1 base address. */
  59. #define PWMC_BASE 0xFFFCC000 /*!< \brief PWM controller base address. */
  60. #define SSC_BASE 0xFFFD4000 /*!< \brief Serial synchronous controller base address. */
  61. #define ADC_BASE 0xFFFD8000 /*!< \brief ADC base address. */
  62. #define SPI0_BASE 0xFFFE0000 /*!< \brief SPI0 base address. */
  63. #define AIC_BASE 0xFFFFF000 /*!< \brief AIC base address. */
  64. #define DBGU_BASE 0xFFFFF200 /*!< \brief DBGU base address. */
  65. #define PIOA_BASE 0xFFFFF400 /*!< \brief PIO A base address. */
  66. #define PMC_BASE 0xFFFFFC00 /*!< \brief PMC base address. */
  67. #define RSTC_BASE 0xFFFFFD00 /*!< \brief Resect controller register base address. */
  68. #define RTT_BASE 0xFFFFFD20 /*!< \brief Realtime timer base address. */
  69. #define PIT_BASE 0xFFFFFD30 /*!< \brief Periodic interval timer base address. */
  70. #define WDT_BASE 0xFFFFFD40 /*!< \brief Watch Dog register base address. */
  71. #define VREG_BASE 0xFFFFFD60 /*!< \brief Voltage regulator mode controller base address. */
  72. #define MC_BASE 0xFFFFFF00 /*!< \brief Memory controller base. */
  73. #define PERIPH_RPR_OFF 0x00000100 /*!< \brief Receive pointer register offset. */
  74. #define PERIPH_RCR_OFF 0x00000104 /*!< \brief Receive counter register offset. */
  75. #define PERIPH_TPR_OFF 0x00000108 /*!< \brief Transmit pointer register offset. */
  76. #define PERIPH_TCR_OFF 0x0000010C /*!< \brief Transmit counter register offset. */
  77. #define PERIPH_RNPR_OFF 0x00000110 /*!< \brief Receive next pointer register offset. */
  78. #define PERIPH_RNCR_OFF 0x00000114 /*!< \brief Receive next counter register offset. */
  79. #define PERIPH_TNPR_OFF 0x00000118 /*!< \brief Transmit next pointer register offset. */
  80. #define PERIPH_TNCR_OFF 0x0000011C /*!< \brief Transmit next counter register offset. */
  81. #define PERIPH_PTCR_OFF 0x00000120 /*!< \brief PDC transfer control register offset. */
  82. #define PERIPH_PTSR_OFF 0x00000124 /*!< \brief PDC transfer status register offset. */
  83. #define PDC_RXTEN 0x00000001 /*!< \brief Receiver transfer enable. */
  84. #define PDC_RXTDIS 0x00000002 /*!< \brief Receiver transfer disable. */
  85. #define PDC_TXTEN 0x00000100 /*!< \brief Transmitter transfer enable. */
  86. #define PDC_TXTDIS 0x00000200 /*!< \brief Transmitter transfer disable. */
  87. #define DBGU_HAS_PDC
  88. #define SPI_HAS_PDC
  89. #define SSC_HAS_PDC
  90. #define USART_HAS_PDC
  91. #define USART_HAS_MODE
  92. #define PIO_HAS_MULTIDRIVER
  93. #define PIO_HAS_PULLUP
  94. #define PIO_HAS_PERIPHERALSELECT
  95. #define PIO_HAS_OUTPUTWRITEENABLE
  96. #include <arch/arm/atmel/at91_tc.h>
  97. #include <arch/arm/atmel/at91_pwmc.h>
  98. #include <arch/arm/atmel/at91_us.h>
  99. #include <arch/arm/atmel/at91_dbgu.h>
  100. #include <arch/arm/atmel/at91_spi.h>
  101. #include <arch/arm/atmel/at91_aic.h>
  102. #include <arch/arm/atmel/at91_pio.h>
  103. #include <arch/arm/atmel/at91_pmc.h>
  104. #include <arch/arm/atmel/at91_rstc.h>
  105. #include <arch/arm/atmel/at91_wdt.h>
  106. #include <arch/arm/atmel/at91_pit.h>
  107. #include <arch/arm/atmel/at91_mc.h>
  108. #include <arch/arm/atmel/at91_ssc.h>
  109. #include <arch/arm/atmel/at91_twi.h>
  110. #include <arch/arm/atmel/at91_adc.h>
  111. /*! \addtogroup xgNutArchArmAt91Sam7x */
  112. /*@{*/
  113. /*! \name Peripheral Identifiers and Interrupts */
  114. /*@{*/
  115. #define FIQ_ID 0 /*!< \brief Fast interrupt ID. */
  116. #define SYSC_ID 1 /*!< \brief System interrupt ID. */
  117. #define PIOA_ID 2 /*!< \brief Parallel I/O controller ID. */
  118. /* Reserved 3*/
  119. #define ADC_ID 4 /*!< \brief Analog to digital converter ID. */
  120. #define SPI0_ID 5 /*!< \brief Serial peripheral interface 0 ID. */
  121. #define US0_ID 6 /*!< \brief USART 0 ID. */
  122. #define US1_ID 7 /*!< \brief USART 1 ID. */
  123. #define SSC_ID 8 /*!< \brief Synchronous serial controller ID. */
  124. #define TWI_ID 9 /*!< \brief Two-wire interface ID. */
  125. #define PWMC_ID 10 /*!< \brief PWM controller ID. */
  126. #define UDP_ID 11 /*!< \brief USB device port ID. */
  127. #define TC0_ID 12 /*!< \brief Timer 0 ID. */
  128. #define TC1_ID 13 /*!< \brief Timer 1 ID. */
  129. #define TC2_ID 14 /*!< \brief Timer 2 ID. */
  130. /* Reserved 15-29*/
  131. #define IRQ0_ID 30 /*!< \brief External interrupt 0 ID. */
  132. #define IRQ1_ID 31 /*!< \brief External interrupt 1 ID. */
  133. /*@}*/
  134. /*! \name Historical SPI0 Peripheral Multiplexing Names */
  135. /*@{*/
  136. #define SPI0_NPCS0_PA11A 11 /*!< \brief Port bit number on PIO-A Perpheral A. */
  137. #define SPI0_NPCS1_PA09B 9 /*!< \brief Port bit number on PIO-A Perpheral B. */
  138. #define SPI0_NPCS1_PA31A 31 /*!< \brief Port bit number on PIO-A Perpheral A. */
  139. #define SPI0_NPCS2_PA10B 10 /*!< \brief Port bit number on PIO-A Perpheral B. */
  140. #define SPI0_NPCS2_PA30B 30 /*!< \brief Port bit number on PIO-A Perpheral B. */
  141. #define SPI0_NPCS3_PA03B 3 /*!< \brief Port bit number on PIO-A Perpheral B. */
  142. #define SPI0_NPCS3_PA05B 5 /*!< \brief Port bit number on PIO-A Perpheral B. */
  143. #define SPI0_NPCS3_PA22B 22 /*!< \brief Port bit number on PIO-A Perpheral B. */
  144. #define SPI0_MISO_PA12A 12 /*!< \brief Port bit number on PIO-A Perpheral A. */
  145. #define SPI0_MOSI_PA13A 13 /*!< \brief Port bit number on PIO-A Perpheral A. */
  146. #define SPI0_SPCK_PA14A 14 /*!< \brief Port bit number on PIO-A Perpheral A. */
  147. /*@}*/
  148. /*! \name USART Peripheral Multiplexing */
  149. /*@{*/
  150. #define PA5_RXD0_A 5
  151. #define PA6_TXD0_A 6
  152. #define PA2_SCK0_B 2
  153. #define PA7_RTS0_A 7
  154. #define PA8_CTS0_A 8
  155. #define PA21_RXD1_A 21
  156. #define PA22_TXD1_A 22
  157. #define PA23_SCK1_A 23
  158. #define PA24_RTS1_A 24
  159. #define PA25_CTS1_A 25
  160. #define PB26_DCD1_A 26
  161. #define PB28_DSR1_A 28
  162. #define PB27_DTR1_A 27
  163. #define PB29_RI1_A 29
  164. /*@}*/
  165. /*! \name SPI Peripheral Multiplexing */
  166. /*@{*/
  167. #define PA12_SPI0_MISO_A 12
  168. #define PA13_SPI0_MOSI_A 13
  169. #define PA14_SPI0_SPCK_A 14
  170. #define PA11_SPI0_NPCS0_A 11
  171. #define PA9_SPI0_NPCS1_B 9
  172. #define PA31_SPI0_NPCS1_A 31
  173. #define PA10_SPI0_NPCS2_B 10
  174. #define PB30_SPI0_NPCS2_B 30
  175. #define PA3_SPI0_NPCS3_B 3
  176. #define PA5_SPI0_NPCS3_B 5
  177. #define PA22_SPI0_NPCS3_B 22
  178. #define SPI0_PINS _BV(PA12_SPI0_MISO_A) | _BV(PA13_SPI0_MOSI_A) | _BV(PA14_SPI0_SPCK_A)
  179. #define SPI0_PIO_BASE PIOA_BASE
  180. #define SPI0_PSR_OFF PIO_ASR_OFF
  181. #define SPI0_CS0_PIN _BV(PA11_SPI0_NPCS0_A)
  182. #define SPI0_CS0_PIO_BASE PIOA_BASE
  183. #define SPI0_CS0_PSR_OFF PIO_ASR_OFF
  184. #ifndef SPI0_CS1_PIN
  185. #define SPI0_CS1_PIN _BV(PA9_SPI0_NPCS1_B)
  186. #define SPI0_CS1_PIO_BASE PIOA_BASE
  187. #define SPI0_CS1_PSR_OFF PIO_ASR_OFF
  188. #endif
  189. #ifndef SPI0_CS2_PIN
  190. #define SPI0_CS2_PIN _BV(PA10_SPI0_NPCS2_B)
  191. #define SPI0_CS2_PIO_BASE PIOA_BASE
  192. #define SPI0_CS2_PSR_OFF PIO_ASR_OFF
  193. #endif
  194. #ifndef SPI0_CS3_PIN
  195. #define SPI0_CS3_PIN _BV(PA3_SPI0_NPCS3_B)
  196. #define SPI0_CS3_PIO_BASE PIOA_BASE
  197. #define SPI0_CS3_PSR_OFF PIO_ASR_OFF
  198. #endif
  199. /*@}*/
  200. /*! \name Debug Unit Peripheral Multiplexing */
  201. /*@{*/
  202. #define PA9_DRXD_A 9
  203. #define PA10_DTXD_A 10
  204. /*@}*/
  205. /*! \name Synchronous Serial Controller Peripheral Multiplexing */
  206. /*@{*/
  207. #define PA17_TD_A 17 /*!< \brief Transmit data pin. */
  208. #define PA18_RD_A 18 /*!< \brief Receive data pin. */
  209. #define PA16_TK_A 16 /*!< \brief Transmit clock pin. */
  210. #define PA19_RK_A 19 /*!< \brief Receive clock pin. */
  211. #define PA15_TF_A 15 /*!< \brief Transmit frame sync. pin. */
  212. #define PA20_RF_A 20 /*!< \brief Receive frame sync. pin. */
  213. /*@}*/
  214. /*! \name Two Wire Interface Peripheral Multiplexing */
  215. /*@{*/
  216. #define PA3_TWD_A 3 /*!< \brief Two wire serial data pin. */
  217. #define PA4_TWCK_A 4 /*!< \brief Two wire serial clock pin. */
  218. /*@}*/
  219. /*! \name Timer/Counter Peripheral Multiplexing */
  220. /*@{*/
  221. #define PA0_TIOA0_B 0
  222. #define PA1_TIOB0_B 1
  223. #define PA4_TCLK0_B 4
  224. #define PA15_TIOA1_B 15
  225. #define PA16_TIOB1_B 16
  226. #define PA28_TCLK1_B 28
  227. #define PA26_TIOA2_B 26
  228. #define PA27_TIOB2_B 27
  229. #define PA29_TCLK2_B 29
  230. /*@}*/
  231. /*! \name Clocks, Oscillators and PLLs Peripheral Multiplexing */
  232. /*@{*/
  233. #define PA6_PCK0_B 6
  234. #define PA17_PCK1_B 17
  235. #define PA21_PCK1_B 21
  236. #define PA18_PCK2_B 18
  237. #define PA31_PCK2_B 31
  238. /*@}*/
  239. /*! \name Advanced Interrupt Controller Peripheral Multiplexing */
  240. /*@{*/
  241. #define PA19_FIQ_B 19
  242. #define PA20_IRQ0_B 20
  243. #define PA30_IRQ1_A 30
  244. /*@}*/
  245. /*! \name ADC Interface Peripheral Multiplexing */
  246. /*@{*/
  247. #define PA8_ADTRG_B 8 /*!< \brief ADC trigger pin. */
  248. /*@}*/
  249. /*! \name PWM Peripheral Multiplexing */
  250. /*@{*/
  251. #define PA0_PWM0_A 0
  252. #define PA23_PWM0_B 23
  253. #define PA1_PWM1_A 1
  254. #define PA24_PWM1_B 24
  255. #define PA2_PWM2_A 2
  256. #define PA13_PWM2_B 13
  257. #define PA25_PWM2_B 25
  258. #define PA7_PWM3_B 7
  259. #define PA14_PWM3_B 14
  260. /*@}*/
  261. /*@} xgNutArchArmAt91 */
  262. #endif /* _ARCH_ARM_AT91SAM7S_H_ */