irq.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  1. /****************************************************************************
  2. * arch/avr/include/at32uc3/irq.h
  3. *
  4. * Copyright (C) 2010 Gregory Nutt. All rights reserved.
  5. * Author: Gregory Nutt <gnutt@nuttx.org>
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. *
  11. * 1. Redistributions of source code must retain the above copyright
  12. * notice, this list of conditions and the following disclaimer.
  13. * 2. Redistributions in binary form must reproduce the above copyright
  14. * notice, this list of conditions and the following disclaimer in
  15. * the documentation and/or other materials provided with the
  16. * distribution.
  17. * 3. Neither the name NuttX nor the names of its contributors may be
  18. * used to endorse or promote products derived from this software
  19. * without specific prior written permission.
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  24. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  25. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  26. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  27. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  28. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  29. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  30. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  31. * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  32. * POSSIBILITY OF SUCH DAMAGE.
  33. *
  34. ****************************************************************************/
  35. /* This file should never be included directly but, rather,
  36. * only indirectly through nuttx/irq.h
  37. */
  38. #ifndef __ARCH_AVR_INCLUDE_AT32UC3_IRQ_H
  39. #define __ARCH_AVR_INCLUDE_AT32UC3_IRQ_H
  40. /****************************************************************************
  41. * Included Files
  42. ****************************************************************************/
  43. #ifndef __ASSEMBLY__
  44. # include <stdint.h>
  45. #endif
  46. /****************************************************************************
  47. * Pre-processor Definitions
  48. ****************************************************************************/
  49. /* Configuration ************************************************************/
  50. /* Configuration CONFIG_AVR32_GPIOIRQ must be selected to enable the overall
  51. * GPIO IRQ feature and CONFIG_AVR32_GPIOIRQSETA and/or
  52. * CONFIG_AVR32_GPIOIRQSETB must be enabled to select GPIOs to support
  53. * interrupts on.
  54. */
  55. #ifndef CONFIG_AVR32_GPIOIRQ
  56. # undef CONFIG_AVR32_GPIOIRQSETA
  57. # undef CONFIG_AVR32_GPIOIRQSETB
  58. #endif
  59. /* IRQ numbers **************************************************************/
  60. /* Events. These exclude:
  61. *
  62. * - The Reset event which vectors directly either to 0x8000:0000 (uc3a) or
  63. * to 0xa000:0000 (uc3b).
  64. * - The OCD stop from the OSD system
  65. * - Autovectored interrupt requests
  66. *
  67. * Others vector relative to the contents of the EVBA register.
  68. */
  69. #define AVR32_IRQ_UNREC 0 /* EVBA+0x00 Unrecoverable exception */
  70. #define AVR32_IRQ_TLBMULT 1 /* EVBA+0x04 TLB multiple hit */
  71. #define AVR32_IRQ_BUSDATA 2 /* EVBA+0x08 Bus error data fetch */
  72. #define AVR32_IRQ_BUSINST 3 /* EVBA+0x0c Bus error instruction fetch */
  73. #define AVR32_IRQ_NMI 4 /* EVBA+0x10 NMI */
  74. #define AVR32_IRQ_INSTADDR 5 /* EVBA+0x14 Instruction Address */
  75. #define AVR32_IRQ_ITLBPROT 6 /* EVBA+0x18 ITLB Protection */
  76. #define AVR32_IRQ_BP 7 /* EVBA+0x1c Breakpoint */
  77. #define AVR32_IRQ_INVINST 8 /* EVBA+0x20 Illegal Opcode */
  78. #define AVR32_IRQ_UNIMPINST 9 /* EVBA+0x24 Unimplemented instruction */
  79. #define AVR32_IRQ_PRIV 10 /* EVBA+0x28 Privilege violation */
  80. #define AVR32_IRQ_FP 11 /* EVBA+0x2c Floating-point */
  81. #define AVR32_IRQ_COP 12 /* EVBA+0x30 Coprocessor absent */
  82. #define AVR32_IRQ_RDDATA 13 /* EVBA+0x34 Data Address (Read) */
  83. #define AVR32_IRQ_WRDATA 14 /* EVBA+0x38 Data Address (Write) */
  84. #define AVR32_IRQ_RDDTLBPROT 15 /* EVBA+0x3c DTLB Protection (Read) */
  85. #define AVR32_IRQ_WRDTLBPROT 16 /* EVBA+0x40 DTLB Protection (Write) */
  86. #define AVR32_IRQ_DLTBMOD 17 /* EVBA+0x44 DTLB Modified */
  87. #define AVR32_IRQ_ITLBMISS 18 /* EVBA+0x50 ITLB Miss */
  88. #define AVR32_IRQ_RDDTLB 19 /* EVBA+0x60 DTLB Miss (Read) */
  89. #define AVR32_IRQ_WRDTLB 20 /* EVBA+0x70 DTLB Miss (Write) */
  90. #define AVR32_IRQ_SUPER 21 /* EVBA+0x100 Supervisor call */
  91. #define AVR32_IRQ_NEVENTS 22
  92. /* "The INTC collects interrupt requests from the peripherals, prioritizes
  93. * them, and delivers an interrupt request and an autovector to the CPU. The
  94. * AVR32 architecture supports 4 priority levels for regular, maskable
  95. * interrupts, and a Non-Maskable Interrupt (NMI)."
  96. *
  97. * "The INTC supports up to 64 groups of interrupts. Each group can have up
  98. * to 32 interrupt request lines, these lines are connected to the peripherals.
  99. * Each group has an Interrupt Priority Register (IPR) and an Interrupt Request
  100. * Register (IRR). The IPRs are used to assign a priority level and an autovector
  101. * to each group, and the IRRs are used to identify the active interrupt request
  102. * within each group. If a group has only one interrupt request line, an active
  103. * interrupt group uniquely identifies the active interrupt request line, and
  104. * the corresponding IRR is not needed. The INTC also provides one Interrupt
  105. * Cause Register (ICR) per priority level. These registers identify the group
  106. * that has a pending interrupt of the corresponding priority level. If several
  107. * groups have a pending interrupt of the same level, the group with the lowest
  108. * number takes priority."
  109. */
  110. /* Only 19 groups (0-18) are used with the AT32UC3A/B: */
  111. #define AVR32_IRQ_INTPRIOS 4 /* 4 interrupt priorities */
  112. #define AVR32_IRQ_MAXGROUPS 64 /* Architecture supports up to 64 groups */
  113. #define AVR32_IRQ_NGROUPS 19 /* UC3 A/B support only 19 */
  114. /* Group 0 */
  115. #define AVR32_IRQ_BASEIRQGRP0 22
  116. #define AVR32_IRQ_NREQGRP0 1
  117. #define AVR32_IRQ_UC 22 /* 0 AVR32 UC CPU */
  118. /* Group 1 */
  119. #define AVR32_IRQ_BASEIRQGRP1 23
  120. #define AVR32_IRQ_NREQGRP1 10
  121. #define AVR32_IRQ_EIC0 23 /* 0 External Interrupt Controller 0 */
  122. #define AVR32_IRQ_EIC1 24 /* 1 External Interrupt Controller 1 */
  123. #define AVR32_IRQ_EIC2 25 /* 2 External Interrupt Controller 2 */
  124. #define AVR32_IRQ_EIC3 26 /* 3 External Interrupt Controller 3 */
  125. #define AVR32_IRQ_EIC4 27 /* 4 External Interrupt Controller 4 */
  126. #define AVR32_IRQ_EIC5 28 /* 5 External Interrupt Controller 5 */
  127. #define AVR32_IRQ_EIC6 29 /* 6 External Interrupt Controller 6 */
  128. #define AVR32_IRQ_EIC7 30 /* 7 External Interrupt Controller 7 */
  129. #define AVR32_IRQ_RTC 31 /* 8 Real Time Counter RTC */
  130. #define AVR32_IRQ_PM 32 /* 9 Power Manager PM */
  131. /* Group 2 */
  132. #define AVR32_IRQ_BASEIRQGRP2 33
  133. #define AVR32_IRQ_NREQGRP2 6
  134. #define AVR32_IRQ_GPIO0 33 /* 0 General Purpose Input/Output Controller 0 */
  135. #define AVR32_IRQ_GPIO1 34 /* 1 General Purpose Input/Output Controller 1 */
  136. #define AVR32_IRQ_GPIO2 35 /* 2 General Purpose Input/Output Controller 2 */
  137. #define AVR32_IRQ_GPIO3 36 /* 3 General Purpose Input/Output Controller 3 */
  138. #define AVR32_IRQ_GPIO4 37 /* 4 General Purpose Input/Output Controller 4 */
  139. #define AVR32_IRQ_GPIO5 38 /* 5 General Purpose Input/Output Controller 5 */
  140. /* Group 3 */
  141. #define AVR32_IRQ_BASEIRQGRP3 39
  142. #define AVR32_IRQ_NREQGRP3 7
  143. #define AVR32_IRQ_PDCA0 39 /* 0 Peripheral DMA Controller 0 */
  144. #define AVR32_IRQ_PDCA1 40 /* 1 Peripheral DMA Controller 1 */
  145. #define AVR32_IRQ_PDCA2 41 /* 2 Peripheral DMA Controller 2 */
  146. #define AVR32_IRQ_PDCA3 42 /* 3 Peripheral DMA Controller 3 */
  147. #define AVR32_IRQ_PDCA4 43 /* 4 Peripheral DMA Controller 4 */
  148. #define AVR32_IRQ_PDCA5 44 /* 5 Peripheral DMA Controller 5 */
  149. #define AVR32_IRQ_PDCA6 45 /* 6 Peripheral DMA Controller 6 */
  150. /* Group 4 */
  151. #define AVR32_IRQ_BASEIRQGRP4 46
  152. #define AVR32_IRQ_NREQGRP4 1
  153. #define AVR32_IRQ_FLASHC 46 /* 0 Flash Controller */
  154. /* Group 5 */
  155. #define AVR32_IRQ_BASEIRQGRP5 47
  156. #define AVR32_IRQ_NREQGRP5 1
  157. #define AVR32_IRQ_USART0 47 /* 0 Universal Synchronous/Asynchronous
  158. * Receiver/Transmitter 0 */
  159. /* Group 6 */
  160. #define AVR32_IRQ_BASEIRQGRP6 48
  161. #define AVR32_IRQ_NREQGRP6 1
  162. #define AVR32_IRQ_USART1 48 /* 0 Universal Synchronous/Asynchronous
  163. * Receiver/Transmitter 1 */
  164. /* Group 7 */
  165. #define AVR32_IRQ_BASEIRQGRP7 49
  166. #define AVR32_IRQ_NREQGRP7 1
  167. #define AVR32_IRQ_USART2 49 /* 0 Universal Synchronous/Asynchronous
  168. * Receiver/Transmitter 2 */
  169. #define AVR32_IRQ_BASEIRQGRP8 50
  170. #define AVR32_IRQ_NREQGRP8 0
  171. /* Group 9 */
  172. #define AVR32_IRQ_BASEIRQGRP9 50
  173. #define AVR32_IRQ_NREQGRP9 1
  174. #define AVR32_IRQ_SPI 50 /* 0 Serial Peripheral Interface */
  175. #define AVR32_IRQ_BASEIRQGRP10 51
  176. #define AVR32_IRQ_NREQGRP10 0
  177. /* Group 11 */
  178. #define AVR32_IRQ_BASEIRQGRP11 51
  179. #define AVR32_IRQ_NREQGRP11 1
  180. #define AVR32_IRQ_TWI 51 /* 0 Two-wire Interface TWI */
  181. /* Group 12 */
  182. #define AVR32_IRQ_BASEIRQGRP12 52
  183. #define AVR32_IRQ_NREQGRP12 1
  184. #define AVR32_IRQ_PWM 52 /* 0 Pulse Width Modulation Controller */
  185. /* Group 13 */
  186. #define AVR32_IRQ_BASEIRQGRP13 53
  187. #define AVR32_IRQ_NREQGRP13 1
  188. #define AVR32_IRQ_SSC 53 /* 0 Synchronous Serial Controller */
  189. /* Group 14 */
  190. #define AVR32_IRQ_BASEIRQGRP14 54
  191. #define AVR32_IRQ_NREQGRP14 3
  192. #define AVR32_IRQ_TC0 54 /* 0 Timer/Counter 0 */
  193. #define AVR32_IRQ_TC1 55 /* 1 Timer/Counter 1 */
  194. #define AVR32_IRQ_TC2 56 /* 2 Timer/Counter 2 */
  195. /* Group 15 */
  196. #define AVR32_IRQ_BASEIRQGRP15 57
  197. #define AVR32_IRQ_NREQGRP15 1
  198. #define AVR32_IRQ_ADC 57 /* 0 Analog to Digital Converter */
  199. #define AVR32_IRQ_BASEIRQGRP16 58
  200. #define AVR32_IRQ_NREQGRP16 0
  201. /* Group 17 */
  202. #define AVR32_IRQ_BASEIRQGRP17 58
  203. #define AVR32_IRQ_NREQGRP17 1
  204. #define AVR32_IRQ_USBB 58 /* 0 USB 2.0 Interface USBB */
  205. /* Group 18 */
  206. #define AVR32_IRQ_BASEIRQGRP18 59
  207. #define AVR32_IRQ_NREQGRP18 1
  208. #define AVR32_IRQ_ABDAC 59 /* 0 Audio Bitstream DAC */
  209. /* Total number of IRQ numbers */
  210. #define AVR32_IRQ_BADVECTOR 60 /* Not a real IRQ number */
  211. #define NR_IRQS 60
  212. /* GPIO IRQ Numbers *********************************************************/
  213. /* These numbers correspond to GPIO port numbers that have interrupts
  214. * enabled. These are all decoded by the AVR32_IRQ_GPIO interrupt handler.
  215. * A lot of effort was made here to keep the number of IRQs to a minimum
  216. * since it will correspond to various, internal table sizes.
  217. */
  218. /* Up to 32 GPIO interrupts in PORTA0-31 */
  219. #define __IRQ_GPPIO_PA0 0
  220. #if (CONFIG_AVR32_GPIOIRQSETA & 0x00000001) != 0
  221. # define AVR32_IRQ_GPIO_PA0 __IRQ_GPPIO_PA0
  222. # define __IRQ_GPIO_PA1 (__IRQ_GPPIO_PA0+1)
  223. #else
  224. # define __IRQ_GPIO_PA1 __IRQ_GPPIO_PA0
  225. #endif
  226. #if (CONFIG_AVR32_GPIOIRQSETA & 0x00000002) != 0
  227. # define AVR32_IRQ_GPIO_PA1 __IRQ_GPIO_PA1
  228. # define __IRQ_GPIO_PA2 (__IRQ_GPIO_PA1+1)
  229. #else
  230. # define __IRQ_GPIO_PA2 __IRQ_GPIO_PA1
  231. #endif
  232. #if (CONFIG_AVR32_GPIOIRQSETA & 0x00000004) != 0
  233. # define AVR32_IRQ_GPIO_PA2 __IRQ_GPIO_PA2
  234. # define __IRQ_GPIO_PA3 (__IRQ_GPIO_PA2+1)
  235. #else
  236. # define __IRQ_GPIO_PA3 __IRQ_GPIO_PA2
  237. #endif
  238. #if (CONFIG_AVR32_GPIOIRQSETA & 0x00000008) != 0
  239. # define AVR32_IRQ_GPIO_PA3 __IRQ_GPIO_PA3
  240. # define __IRQ_GPIO_PA4 (__IRQ_GPIO_PA3+1)
  241. #else
  242. # define __IRQ_GPIO_PA4 __IRQ_GPIO_PA3
  243. #endif
  244. #if (CONFIG_AVR32_GPIOIRQSETA & 0x00000010) != 0
  245. # define AVR32_IRQ_GPIO_PA4 __IRQ_GPIO_PA4
  246. # define __IRQ_GPIO_PA5 (__IRQ_GPIO_PA4+1)
  247. #else
  248. # define __IRQ_GPIO_PA5 __IRQ_GPIO_PA4
  249. #endif
  250. #if (CONFIG_AVR32_GPIOIRQSETA & 0x00000020) != 0
  251. # define AVR32_IRQ_GPIO_PA5 __IRQ_GPIO_PA5
  252. # define __IRQ_GPIO_PA6 (__IRQ_GPIO_PA5+1)
  253. #else
  254. # define __IRQ_GPIO_PA6 __IRQ_GPIO_PA5
  255. #endif
  256. #if (CONFIG_AVR32_GPIOIRQSETA & 0x00000040) != 0
  257. # define AVR32_IRQ_GPIO_PA6 __IRQ_GPIO_PA6
  258. # define __IRQ_GPIO_PA7 (__IRQ_GPIO_PA6+1)
  259. #else
  260. # define __IRQ_GPIO_PA7 __IRQ_GPIO_PA6
  261. #endif
  262. #if (CONFIG_AVR32_GPIOIRQSETA & 0x00000080) != 0
  263. # define AVR32_IRQ_GPIO_PA7 __IRQ_GPIO_PA7
  264. # define __IRQ_GPIO_PA8 (__IRQ_GPIO_PA7+1)
  265. #else
  266. # define __IRQ_GPIO_PA8 __IRQ_GPIO_PA7
  267. #endif
  268. #if (CONFIG_AVR32_GPIOIRQSETA & 0x00000100) != 0
  269. # define AVR32_IRQ_GPIO_PA8 __IRQ_GPIO_PA8
  270. # define __IRQ_GPIO_PA9 (__IRQ_GPIO_PA8+1)
  271. #else
  272. # define __IRQ_GPIO_PA9 __IRQ_GPIO_PA8
  273. #endif
  274. #if (CONFIG_AVR32_GPIOIRQSETA & 0x00000200) != 0
  275. # define AVR32_IRQ_GPIO_PA9 __IRQ_GPIO_PA9
  276. # define __IRQ_GPIO_PA10 (__IRQ_GPIO_PA9+1)
  277. #else
  278. # define __IRQ_GPIO_PA10 __IRQ_GPIO_PA9
  279. #endif
  280. #if (CONFIG_AVR32_GPIOIRQSETA & 0x00000400) != 0
  281. # define AVR32_IRQ_GPIO_PA10 __IRQ_GPIO_PA10
  282. # define __IRQ_GPIO_PA11 (__IRQ_GPIO_PA10+1)
  283. #else
  284. # define __IRQ_GPIO_PA11 __IRQ_GPIO_PA10
  285. #endif
  286. #if (CONFIG_AVR32_GPIOIRQSETA & 0x00000800) != 0
  287. # define AVR32_IRQ_GPIO_PA11 __IRQ_GPIO_PA11
  288. # define __IRQ_GPIO_PA12 (__IRQ_GPIO_PA11+1)
  289. #else
  290. # define __IRQ_GPIO_PA12 __IRQ_GPIO_PA11
  291. #endif
  292. #if (CONFIG_AVR32_GPIOIRQSETA & 0x00001000) != 0
  293. # define AVR32_IRQ_GPIO_PA12 __IRQ_GPIO_PA12
  294. # define __IRQ_GPIO_PA13 (__IRQ_GPIO_PA12+1)
  295. #else
  296. # define __IRQ_GPIO_PA13 __IRQ_GPIO_PA12
  297. #endif
  298. #if (CONFIG_AVR32_GPIOIRQSETA & 0x00002000) != 0
  299. # define AVR32_IRQ_GPIO_PA13 __IRQ_GPIO_PA13
  300. # define __IRQ_GPIO_PA14 (__IRQ_GPIO_PA13+1)
  301. #else
  302. # define __IRQ_GPIO_PA14 __IRQ_GPIO_PA13
  303. #endif
  304. #if (CONFIG_AVR32_GPIOIRQSETA & 0x00004000) != 0
  305. # define AVR32_IRQ_GPIO_PA14 __IRQ_GPIO_PA14
  306. # define __IRQ_GPIO_PA15 (__IRQ_GPIO_PA14+1)
  307. #else
  308. # define __IRQ_GPIO_PA15 __IRQ_GPIO_PA14
  309. #endif
  310. #if (CONFIG_AVR32_GPIOIRQSETA & 0x00008000) != 0
  311. # define AVR32_IRQ_GPIO_PA15 __IRQ_GPIO_PA15
  312. # define __IRQ_GPIO_PA16 (__IRQ_GPIO_PA15+1)
  313. #else
  314. # define __IRQ_GPIO_PA16 __IRQ_GPIO_PA15
  315. #endif
  316. #if (CONFIG_AVR32_GPIOIRQSETA & 0x00010000) != 0
  317. # define AVR32_IRQ_GPIO_PA16 __IRQ_GPIO_PA16
  318. # define __IRQ_GPIO_PA17 (__IRQ_GPIO_PA16+1)
  319. #else
  320. # define __IRQ_GPIO_PA17 __IRQ_GPIO_PA16
  321. #endif
  322. #if (CONFIG_AVR32_GPIOIRQSETA & 0x00020000) != 0
  323. # define AVR32_IRQ_GPIO_PA17 __IRQ_GPIO_PA17
  324. # define __IRQ_GPIO_PA18 (__IRQ_GPIO_PA17+1)
  325. #else
  326. # define __IRQ_GPIO_PA18 __IRQ_GPIO_PA17
  327. #endif
  328. #if (CONFIG_AVR32_GPIOIRQSETA & 0x00040000) != 0
  329. # define AVR32_IRQ_GPIO_PA18 __IRQ_GPIO_PA18
  330. # define __IRQ_GPIO_PA19 (__IRQ_GPIO_PA18+1)
  331. #else
  332. # define __IRQ_GPIO_PA19 __IRQ_GPIO_PA18
  333. #endif
  334. #if (CONFIG_AVR32_GPIOIRQSETA & 0x00080000) != 0
  335. # define AVR32_IRQ_GPIO_PA19 __IRQ_GPIO_PA19
  336. # define __IRQ_GPIO_PA20 (__IRQ_GPIO_PA19+1)
  337. #else
  338. # define __IRQ_GPIO_PA20 __IRQ_GPIO_PA19
  339. #endif
  340. #if (CONFIG_AVR32_GPIOIRQSETA & 0x00100000) != 0
  341. # define AVR32_IRQ_GPIO_PA20 __IRQ_GPIO_PA20
  342. # define __IRQ_GPIO_PA21 (__IRQ_GPIO_PA20+1)
  343. #else
  344. # define __IRQ_GPIO_PA21 __IRQ_GPIO_PA20
  345. #endif
  346. #if (CONFIG_AVR32_GPIOIRQSETA & 0x00200000) != 0
  347. # define AVR32_IRQ_GPIO_PA21 __IRQ_GPIO_PA21
  348. # define __IRQ_GPIO_PA22 (__IRQ_GPIO_PA21+1)
  349. #else
  350. # define __IRQ_GPIO_PA22 __IRQ_GPIO_PA21
  351. #endif
  352. #if (CONFIG_AVR32_GPIOIRQSETA & 0x00400000) != 0
  353. # define AVR32_IRQ_GPIO_PA22 __IRQ_GPIO_PA22
  354. # define __IRQ_GPIO_PA23 (__IRQ_GPIO_PA22+1)
  355. #else
  356. # define __IRQ_GPIO_PA23 __IRQ_GPIO_PA22
  357. #endif
  358. #if (CONFIG_AVR32_GPIOIRQSETA & 0x00800000) != 0
  359. # define AVR32_IRQ_GPIO_PA23 __IRQ_GPIO_PA23
  360. # define __IRQ_GPIO_PA24 (__IRQ_GPIO_PA23+1)
  361. #else
  362. # define __IRQ_GPIO_PA24 __IRQ_GPIO_PA23
  363. #endif
  364. #if (CONFIG_AVR32_GPIOIRQSETA & 0x01000000) != 0
  365. # define AVR32_IRQ_GPIO_PA24 __IRQ_GPIO_PA24
  366. # define __IRQ_GPIO_PA25 (__IRQ_GPIO_PA24+1)
  367. #else
  368. # define __IRQ_GPIO_PA25 __IRQ_GPIO_PA24
  369. #endif
  370. #if (CONFIG_AVR32_GPIOIRQSETA & 0x02000000) != 0
  371. # define AVR32_IRQ_GPIO_PA25 __IRQ_GPIO_PA25
  372. # define __IRQ_GPIO_PA26 (__IRQ_GPIO_PA25+1)
  373. #else
  374. # define __IRQ_GPIO_PA26 __IRQ_GPIO_PA25
  375. #endif
  376. #if (CONFIG_AVR32_GPIOIRQSETA & 0x04000000) != 0
  377. # define AVR32_IRQ_GPIO_PA26 __IRQ_GPIO_PA26
  378. # define __IRQ_GPIO_PA27 (__IRQ_GPIO_PA26+1)
  379. #else
  380. # define __IRQ_GPIO_PA27 __IRQ_GPIO_PA26
  381. #endif
  382. #if (CONFIG_AVR32_GPIOIRQSETA & 0x08000000) != 0
  383. # define AVR32_IRQ_GPIO_PA27 __IRQ_GPIO_PA27
  384. # define __IRQ_GPIO_PA28 (__IRQ_GPIO_PA27+1)
  385. #else
  386. # define __IRQ_GPIO_PA28 __IRQ_GPIO_PA27
  387. #endif
  388. #if (CONFIG_AVR32_GPIOIRQSETA & 0x10000000) != 0
  389. # define AVR32_IRQ_GPIO_PA28 __IRQ_GPIO_PA28
  390. # define __IRQ_GPIO_PA29 (__IRQ_GPIO_PA28+1)
  391. #else
  392. # define __IRQ_GPIO_PA29 __IRQ_GPIO_PA28
  393. #endif
  394. #if (CONFIG_AVR32_GPIOIRQSETA & 0x20000000) != 0
  395. # define AVR32_IRQ_GPIO_PA29 __IRQ_GPIO_PA29
  396. # define __IRQ_GPIO_PA30 (__IRQ_GPIO_PA29+1)
  397. #else
  398. # define __IRQ_GPIO_PA30 __IRQ_GPIO_PA29
  399. #endif
  400. #if (CONFIG_AVR32_GPIOIRQSETA & 0x40000000) != 0
  401. # define AVR32_IRQ_GPIO_PA30 __IRQ_GPIO_PA30
  402. # define __IRQ_GPIO_PA31 (__IRQ_GPIO_PA30+1)
  403. #else
  404. # define __IRQ_GPIO_PA31 __IRQ_GPIO_PA30
  405. #endif
  406. #if (CONFIG_AVR32_GPIOIRQSETA & 0x80000000) != 0
  407. # define AVR32_IRQ_GPIO_PA31 __IRQ_GPIO_PA31
  408. # define __IRQ_GPIO_PB0 (__IRQ_GPIO_PA31+1)
  409. #else
  410. # define __IRQ_GPIO_PB0 __IRQ_GPIO_PA31
  411. #endif
  412. /* Up to 12 GPIO interrupts in PORTB0-11 */
  413. #if (CONFIG_AVR32_GPIOIRQSETB & 0x00000001) != 0
  414. # define AVR32_IRQ_GPIO_PB0 __IRQ_GPIO_pb0
  415. # define __IRQ_GPIO_PB1 (__IRQ_GPIO_PB0+1)
  416. #else
  417. # define __IRQ_GPIO_PB1 __IRQ_GPIO_PB0
  418. #endif
  419. #if (CONFIG_AVR32_GPIOIRQSETB & 0x00000002) != 0
  420. # define AVR32_IRQ_GPIO_PB1 __IRQ_GPIO_PB1
  421. # define __IRQ_GPIO_PB2 (__IRQ_GPIO_PB1+1)
  422. #else
  423. # define __IRQ_GPIO_PB2 __IRQ_GPIO_PB1
  424. #endif
  425. #if (CONFIG_AVR32_GPIOIRQSETB & 0x00000004) != 0
  426. # define AVR32_IRQ_GPIO_PB2 __IRQ_GPIO_PB2
  427. # define __IRQ_GPIO_PB3 (__IRQ_GPIO_PB2+1)
  428. #else
  429. # define __IRQ_GPIO_PB3 __IRQ_GPIO_PB2
  430. #endif
  431. #if (CONFIG_AVR32_GPIOIRQSETB & 0x00000008) != 0
  432. # define AVR32_IRQ_GPIO_PB3 __IRQ_GPIO_PB3
  433. # define __IRQ_GPIO_PB4 (__IRQ_GPIO_PB3+1)
  434. #else
  435. # define __IRQ_GPIO_PB4 __IRQ_GPIO_PB3
  436. #endif
  437. #if (CONFIG_AVR32_GPIOIRQSETB & 0x00000010) != 0
  438. # define AVR32_IRQ_GPIO_PB4 __IRQ_GPIO_PB4
  439. # define __IRQ_GPIO_PB5 (__IRQ_GPIO_PB4+1)
  440. #else
  441. # define __IRQ_GPIO_PB5 __IRQ_GPIO_PB4
  442. #endif
  443. #if (CONFIG_AVR32_GPIOIRQSETB & 0x00000020) != 0
  444. # define AVR32_IRQ_GPIO_PB5 __IRQ_GPIO_PB5
  445. # define __IRQ_GPIO_PB6 (__IRQ_GPIO_PB5+1)
  446. #else
  447. # define __IRQ_GPIO_PB6 __IRQ_GPIO_PB5
  448. #endif
  449. #if (CONFIG_AVR32_GPIOIRQSETB & 0x00000040) != 0
  450. # define AVR32_IRQ_GPIO_PB6 __IRQ_GPIO_PB6
  451. # define __IRQ_GPIO_PB7 (__IRQ_GPIO_PB6+1)
  452. #else
  453. # define __IRQ_GPIO_PB7 __IRQ_GPIO_PB6
  454. #endif
  455. #if (CONFIG_AVR32_GPIOIRQSETB & 0x00000080) != 0
  456. # define AVR32_IRQ_GPIO_PB7 __IRQ_GPIO_PB7
  457. # define __IRQ_GPIO_PB8 (__IRQ_GPIO_PB7+1)
  458. #else
  459. # define __IRQ_GPIO_PB8 __IRQ_GPIO_PB7
  460. #endif
  461. #if (CONFIG_AVR32_GPIOIRQSETB & 0x00000100) != 0
  462. # define AVR32_IRQ_GPIO_PB8 __IRQ_GPIO_PB8
  463. # define __IRQ_GPIO_PB9 (__IRQ_GPIO_PB8+1)
  464. #else
  465. # define __IRQ_GPIO_PB9 __IRQ_GPIO_PB8
  466. #endif
  467. #if (CONFIG_AVR32_GPIOIRQSETB & 0x00000200) != 0
  468. # define AVR32_IRQ_GPIO_PB9 __IRQ_GPIO_PB9
  469. # define __IRQ_GPIO_PB10 (__IRQ_GPIO_PB9+1)
  470. #else
  471. # define __IRQ_GPIO_PB10 __IRQ_GPIO_PB9
  472. #endif
  473. #if (CONFIG_AVR32_GPIOIRQSETB & 0x00000400) != 0
  474. # define AVR32_IRQ_GPIO_PB10 __IRQ_GPIO_PB10
  475. # define __IRQ_GPIO_PB11 (__IRQ_GPIO_PB10+1)
  476. #else
  477. # define __IRQ_GPIO_PB11 __IRQ_GPIO_PB10
  478. #endif
  479. #if (CONFIG_AVR32_GPIOIRQSETB & 0x00000800) != 0
  480. # define AVR32_IRQ_GPIO_PB11 __IRQ_GPIO_PB11
  481. # define __IRQ_GPIO_PB12 (__IRQ_GPIO_PB11+1)
  482. #else
  483. # define __IRQ_GPIO_PB12 __IRQ_GPIO_PB11
  484. #endif
  485. #ifdef CONFIG_AVR32_GPIOIRQ
  486. # define NR_GPIO_IRQS __IRQ_GPIO_PB12
  487. #else
  488. # define NR_GPIO_IRQS 0
  489. #endif
  490. /****************************************************************************
  491. * Public Types
  492. ****************************************************************************/
  493. /****************************************************************************
  494. * Inline functions
  495. ****************************************************************************/
  496. /****************************************************************************
  497. * Public Data
  498. ****************************************************************************/
  499. /****************************************************************************
  500. * Public Function Prototypes
  501. ****************************************************************************/
  502. #ifndef __ASSEMBLY__
  503. #ifdef __cplusplus
  504. #define EXTERN extern "C"
  505. extern "C"
  506. {
  507. #else
  508. #define EXTERN extern
  509. #endif
  510. #undef EXTERN
  511. #ifdef __cplusplus
  512. }
  513. #endif
  514. #endif
  515. #endif /* __ARCH_AVR_INCLUDE_AT32UC3_IRQ_H */