1 /**
2  * \file
3  *
4  * \brief SAM D20 System Interrupt Driver
5  *
6  * Copyright (C) 2013-2015 Atmel Corporation. All rights reserved.
7  *
8  * \asf_license_start
9  *
10  * \page License
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions are met:
14  *
15  * 1. Redistributions of source code must retain the above copyright notice,
16  *    this list of conditions and the following disclaimer.
17  *
18  * 2. Redistributions in binary form must reproduce the above copyright notice,
19  *    this list of conditions and the following disclaimer in the documentation
20  *    and/or other materials provided with the distribution.
21  *
22  * 3. The name of Atmel may not be used to endorse or promote products derived
23  *    from this software without specific prior written permission.
24  *
25  * 4. This software may only be redistributed and used in connection with an
26  *    Atmel microcontroller product.
27  *
28  * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
29  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
31  * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
32  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
36  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38  * POSSIBILITY OF SUCH DAMAGE.
39  *
40  * \asf_license_stop
41  *
42  */
43 /*
44  * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
45  */
46 
47 #ifndef SYSTEM_INTERRUPT_FEATURES_H_INCLUDED
48 #define SYSTEM_INTERRUPT_FEATURES_H_INCLUDED
49 
50 #if !defined(__DOXYGEN__)
51 
52 /* Generates a interrupt vector table enum list entry for a given module type
53    and index (e.g. "SYSTEM_INTERRUPT_MODULE_TC0 = TC0_IRQn,"). */
54 #  define _MODULE_IRQn(n, module) \
55 		SYSTEM_INTERRUPT_MODULE_##module##n = module##n##_IRQn,
56 
57 /* Generates interrupt vector table enum list entries for all instances of a
58    given module type on the selected device. */
59 #  define _SYSTEM_INTERRUPT_MODULES(name) \
60 		MREPEAT(name##_INST_NUM, _MODULE_IRQn, name)
61 
62 #  define _SYSTEM_INTERRUPT_IPSR_MASK              0x0000003f
63 #  define _SYSTEM_INTERRUPT_PRIORITY_MASK          0x00000003
64 
65 #  define _SYSTEM_INTERRUPT_EXTERNAL_VECTOR_START  0
66 
67 #  define _SYSTEM_INTERRUPT_SYSTICK_PRI_POS        30
68 #endif
69 
70 /**
71  * \addtogroup asfdoc_sam0_system_interrupt_group
72  * @{
73  */
74 
75 /**
76  * \brief Table of possible system interrupt/exception vector numbers.
77  *
78  * Table of all possible interrupt and exception vector indexes within the
79  * SAM D20 device.
80  */
81 #if defined(__DOXYGEN__)
82 /** \note The actual enumeration name is "system_interrupt_vector". */
83 enum system_interrupt_vector_samd20 {
84 #else
85 enum system_interrupt_vector {
86 #endif
87 	/** Interrupt vector index for a NMI interrupt */
88 	SYSTEM_INTERRUPT_NON_MASKABLE      = NonMaskableInt_IRQn,
89 	/** Interrupt vector index for a Hard Fault memory access exception */
90 	SYSTEM_INTERRUPT_HARD_FAULT        = HardFault_IRQn,
91 	/** Interrupt vector index for a Supervisor Call exception */
92 	SYSTEM_INTERRUPT_SV_CALL           = SVCall_IRQn,
93 	/** Interrupt vector index for a Pending Supervisor interrupt */
94 	SYSTEM_INTERRUPT_PENDING_SV        = PendSV_IRQn,
95 	/** Interrupt vector index for a System Tick interrupt */
96 	SYSTEM_INTERRUPT_SYSTICK           = SysTick_IRQn,
97 
98 	/** Interrupt vector index for a Power Manager peripheral interrupt */
99 	SYSTEM_INTERRUPT_MODULE_PM         = PM_IRQn,
100 	/** Interrupt vector index for a System Control peripheral interrupt */
101 	SYSTEM_INTERRUPT_MODULE_SYSCTRL    = SYSCTRL_IRQn,
102 	/** Interrupt vector index for a Watch Dog peripheral interrupt */
103 	SYSTEM_INTERRUPT_MODULE_WDT        = WDT_IRQn,
104 	/** Interrupt vector index for a Real Time Clock peripheral interrupt */
105 	SYSTEM_INTERRUPT_MODULE_RTC        = RTC_IRQn,
106 	/** Interrupt vector index for an External Interrupt peripheral interrupt */
107 	SYSTEM_INTERRUPT_MODULE_EIC        = EIC_IRQn,
108 	/** Interrupt vector index for a Non Volatile Memory Controller interrupt */
109 	SYSTEM_INTERRUPT_MODULE_NVMCTRL    = NVMCTRL_IRQn,
110 	/** Interrupt vector index for an Event System interrupt */
111 	SYSTEM_INTERRUPT_MODULE_EVSYS      = EVSYS_IRQn,
112 #if defined(__DOXYGEN__)
113 	/** Interrupt vector index for a SERCOM peripheral interrupt.
114 	 *
115 	 *  Each specific device may contain several SERCOM peripherals; each module
116 	 *  instance will have its own entry in the table, with the instance number
117 	 *  substituted for "n" in the entry name (e.g.
118 	 *  \c SYSTEM_INTERRUPT_MODULE_SERCOM0).
119 	 */
120 	SYSTEM_INTERRUPT_MODULE_SERCOMn    = SERCOMn_IRQn,
121 	/** Interrupt vector index for a Timer/Counter peripheral interrupt.
122 	 *
123 	 *  Each specific device may contain several TC peripherals; each module
124 	 *  instance will have its own entry in the table, with the instance number
125 	 *  substituted for "n" in the entry name (e.g.
126 	 *  \c SYSTEM_INTERRUPT_MODULE_TC0).
127 	 */
128 	SYSTEM_INTERRUPT_MODULE_TCn        = TCn_IRQn,
129 #else
130 	_SYSTEM_INTERRUPT_MODULES(SERCOM)
131 	_SYSTEM_INTERRUPT_MODULES(TC)
132 #endif
133 	/** Interrupt vector index for an Analog Comparator peripheral interrupt */
134 	SYSTEM_INTERRUPT_MODULE_AC         = AC_IRQn,
135 	/** Interrupt vector index for an Analog-to-Digital peripheral interrupt */
136 	SYSTEM_INTERRUPT_MODULE_ADC        = ADC_IRQn,
137 	/** Interrupt vector index for a Digital-to-Analog peripheral interrupt */
138 	SYSTEM_INTERRUPT_MODULE_DAC        = DAC_IRQn,
139 };
140 
141 /** @} */
142 
143 #endif
144