interrupt.h
Go to the documentation of this file.
1 //*****************************************************************************
2 //
3 // interrupt.h - Prototypes for the NVIC Interrupt Controller Driver.
4 //
5 // Copyright (c) 2005-2017 Texas Instruments Incorporated. All rights reserved.
6 // Software License Agreement
7 //
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions
10 // are met:
11 //
12 // Redistributions of source code must retain the above copyright
13 // notice, this list of conditions and the following disclaimer.
14 //
15 // Redistributions in binary form must reproduce the above copyright
16 // notice, this list of conditions and the following disclaimer in the
17 // documentation and/or other materials provided with the
18 // distribution.
19 //
20 // Neither the name of Texas Instruments Incorporated nor the names of
21 // its contributors may be used to endorse or promote products derived
22 // from this software without specific prior written permission.
23 //
24 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 //
36 //*****************************************************************************
37 
38 #ifndef __DRIVERLIB_INTERRUPT_H__
39 #define __DRIVERLIB_INTERRUPT_H__
40 
41 #include <stdint.h>
42 #include <stdbool.h>
43 
44 //*****************************************************************************
45 //
46 // If building with a C++ compiler, make all of the definitions in this header
47 // have a C binding.
48 //
49 //*****************************************************************************
50 #ifdef __cplusplus
51 extern "C"
52 {
53 #endif
54 
55 //*****************************************************************************
56 //
57 // The following are defines for the fault assignments.
58 //
59 //*****************************************************************************
60 #define FAULT_NMI 2 // NMI fault
61 #define FAULT_HARD 3 // Hard fault
62 #define FAULT_MPU 4 // MPU fault
63 #define FAULT_BUS 5 // Bus fault
64 #define FAULT_USAGE 6 // Usage fault
65 #define FAULT_SVCALL 11 // SVCall
66 #define FAULT_DEBUG 12 // Debug monitor
67 #define FAULT_PENDSV 14 // PendSV
68 #define FAULT_SYSTICK 15 // System Tick
69 
70 //*****************************************************************************
71 //
72 // MSP432E4 Interrupts
73 //
74 //*****************************************************************************
75 #define INT_GPIOA 16 // GPIO Port A
76 #define INT_GPIOB 17 // GPIO Port B
77 #define INT_GPIOC 18 // GPIO Port C
78 #define INT_GPIOD 19 // GPIO Port D
79 #define INT_GPIOE 20 // GPIO Port E
80 #define INT_UART0 21 // UART0
81 #define INT_UART1 22 // UART1
82 #define INT_SSI0 23 // SSI0
83 #define INT_I2C0 24 // I2C0
84 #define INT_PWM0_FAULT 25 // PWM Fault
85 #define INT_PWM0_0 26 // PWM Generator 0
86 #define INT_PWM0_1 27 // PWM Generator 1
87 #define INT_PWM0_2 28 // PWM Generator 2
88 #define INT_QEI0 29 // QEI0
89 #define INT_ADC0SS0 30 // ADC0 Sequence 0
90 #define INT_ADC0SS1 31 // ADC0 Sequence 1
91 #define INT_ADC0SS2 32 // ADC0 Sequence 2
92 #define INT_ADC0SS3 33 // ADC0 Sequence 3
93 #define INT_WATCHDOG 34 // Watchdog Timers 0 and 1
94 #define INT_TIMER0A 35 // 16/32-Bit Timer 0A
95 #define INT_TIMER0B 36 // 16/32-Bit Timer 0B
96 #define INT_TIMER1A 37 // 16/32-Bit Timer 1A
97 #define INT_TIMER1B 38 // 16/32-Bit Timer 1B
98 #define INT_TIMER2A 39 // 16/32-Bit Timer 2A
99 #define INT_TIMER2B 40 // 16/32-Bit Timer 2B
100 #define INT_COMP0 41 // Analog Comparator 0
101 #define INT_COMP1 42 // Analog Comparator 1
102 #define INT_COMP2 43 // Analog Comparator 2
103 #define INT_SYSCTL 44 // System Control
104 #define INT_FLASH 45 // Flash Memory Control
105 #define INT_GPIOF 46 // GPIO Port F
106 #define INT_GPIOG 47 // GPIO Port G
107 #define INT_GPIOH 48 // GPIO Port H
108 #define INT_UART2 49 // UART2
109 #define INT_SSI1 50 // SSI1
110 #define INT_TIMER3A 51 // 16/32-Bit Timer 3A
111 #define INT_TIMER3B 52 // 16/32-Bit Timer 3B
112 #define INT_I2C1 53 // I2C1
113 #define INT_CAN0 54 // CAN 0
114 #define INT_CAN1 55 // CAN1
115 #define INT_EMAC0 56 // Ethernet MAC
116 #define INT_HIBERNATE 57 // HIB
117 #define INT_USB0 58 // USB MAC
118 #define INT_PWM0_3 59 // PWM Generator 3
119 #define INT_UDMA 60 // uDMA 0 Software
120 #define INT_UDMAERR 61 // uDMA 0 Error
121 #define INT_ADC1SS0 62 // ADC1 Sequence 0
122 #define INT_ADC1SS1 63 // ADC1 Sequence 1
123 #define INT_ADC1SS2 64 // ADC1 Sequence 2
124 #define INT_ADC1SS3 65 // ADC1 Sequence 3
125 #define INT_EPI0 66 // EPI 0
126 #define INT_GPIOJ 67 // GPIO Port J
127 #define INT_GPIOK 68 // GPIO Port K
128 #define INT_GPIOL 69 // GPIO Port L
129 #define INT_SSI2 70 // SSI 2
130 #define INT_SSI3 71 // SSI 3
131 #define INT_UART3 72 // UART 3
132 #define INT_UART4 73 // UART 4
133 #define INT_UART5 74 // UART 5
134 #define INT_UART6 75 // UART 6
135 #define INT_UART7 76 // UART 7
136 #define INT_I2C2 77 // I2C 2
137 #define INT_I2C3 78 // I2C 3
138 #define INT_TIMER4A 79 // Timer 4A
139 #define INT_TIMER4B 80 // Timer 4B
140 #define INT_TIMER5A 81 // Timer 5A
141 #define INT_TIMER5B 82 // Timer 5B
142 #define INT_SYSEXC 83 // Floating-Point Exception
143  // (imprecise)
144 #define INT_I2C4 86 // I2C 4
145 #define INT_I2C5 87 // I2C 5
146 #define INT_GPIOM 88 // GPIO Port M
147 #define INT_GPION 89 // GPIO Port N
148 #define INT_TAMPER0 91 // Tamper
149 #define INT_GPIOP0 92 // GPIO Port P (Summary or P0)
150 #define INT_GPIOP1 93 // GPIO Port P1
151 #define INT_GPIOP2 94 // GPIO Port P2
152 #define INT_GPIOP3 95 // GPIO Port P3
153 #define INT_GPIOP4 96 // GPIO Port P4
154 #define INT_GPIOP5 97 // GPIO Port P5
155 #define INT_GPIOP6 98 // GPIO Port P6
156 #define INT_GPIOP7 99 // GPIO Port P7
157 #define INT_GPIOQ0 100 // GPIO Port Q (Summary or Q0)
158 #define INT_GPIOQ1 101 // GPIO Port Q1
159 #define INT_GPIOQ2 102 // GPIO Port Q2
160 #define INT_GPIOQ3 103 // GPIO Port Q3
161 #define INT_GPIOQ4 104 // GPIO Port Q4
162 #define INT_GPIOQ5 105 // GPIO Port Q5
163 #define INT_GPIOQ6 106 // GPIO Port Q6
164 #define INT_GPIOQ7 107 // GPIO Port Q7
165 #define INT_GPIOR 108 // GPIO Port R
166 #define INT_GPIOS 109 // GPIO Port S
167 #define INT_SHA0 110 // SHA/MD5
168 #define INT_AES0 111 // AES
169 #define INT_DES0 112 // DES
170 #define INT_LCD0 113 // LCD
171 #define INT_TIMER6A 114 // 16/32-Bit Timer 6A
172 #define INT_TIMER6B 115 // 16/32-Bit Timer 6B
173 #define INT_TIMER7A 116 // 16/32-Bit Timer 7A
174 #define INT_TIMER7B 117 // 16/32-Bit Timer 7B
175 #define INT_I2C6 118 // I2C 6
176 #define INT_I2C7 119 // I2C 7
177 #define INT_ONEWIRE0 121 // 1-Wire
178 #define INT_I2C8 125 // I2C 8
179 #define INT_I2C9 126 // I2C 9
180 #define INT_GPIOT 127 // GPIO T
181 #define NUM_INTERRUPTS 129
182 
183 //*****************************************************************************
184 //
185 // The following are defines for the total number of priority levels.
186 //
187 //*****************************************************************************
188 #define NUM_PRIORITY 8
189 #define NUM_PRIORITY_BITS 3
190 
191 //*****************************************************************************
192 //
193 // Macro to generate an interrupt priority mask based on the number of bits
194 // of priority supported by the hardware.
195 //
196 //*****************************************************************************
197 #define INT_PRIORITY_MASK ((0xFF << (8 - NUM_PRIORITY_BITS)) & 0xFF)
198 
199 //*****************************************************************************
200 //
201 // Prototypes for the APIs.
202 //
203 //*****************************************************************************
204 extern bool IntMasterEnable(void);
205 extern bool IntMasterDisable(void);
206 extern void IntRegister(uint32_t ui32Interrupt, void (*pfnHandler)(void));
207 extern void IntUnregister(uint32_t ui32Interrupt);
208 extern void IntPriorityGroupingSet(uint32_t ui32Bits);
209 extern uint32_t IntPriorityGroupingGet(void);
210 extern void IntPrioritySet(uint32_t ui32Interrupt,
211  uint8_t ui8Priority);
212 extern int32_t IntPriorityGet(uint32_t ui32Interrupt);
213 extern void IntEnable(uint32_t ui32Interrupt);
214 extern void IntDisable(uint32_t ui32Interrupt);
215 extern uint32_t IntIsEnabled(uint32_t ui32Interrupt);
216 extern void IntPendSet(uint32_t ui32Interrupt);
217 extern void IntPendClear(uint32_t ui32Interrupt);
218 extern void IntPriorityMaskSet(uint32_t ui32PriorityMask);
219 extern uint32_t IntPriorityMaskGet(void);
220 extern void IntTrigger(uint32_t ui32Interrupt);
221 
222 //*****************************************************************************
223 //
224 // Mark the end of the C bindings section for C++ compilers.
225 //
226 //*****************************************************************************
227 #ifdef __cplusplus
228 }
229 #endif
230 
231 #endif // __DRIVERLIB_INTERRUPT_H__
int32_t IntPriorityGet(uint32_t ui32Interrupt)
Definition: interrupt.c:565
void IntPendClear(uint32_t ui32Interrupt)
Definition: interrupt.c:903
void IntPriorityGroupingSet(uint32_t ui32Bits)
Definition: interrupt.c:416
void IntPriorityMaskSet(uint32_t ui32PriorityMask)
Definition: interrupt.c:969
uint32_t IntPriorityGroupingGet(void)
Definition: interrupt.c:450
void IntPendSet(uint32_t ui32Interrupt)
Definition: interrupt.c:836
void IntTrigger(uint32_t ui32Interrupt)
Definition: interrupt.c:1032
bool IntMasterDisable(void)
Definition: interrupt.c:246
bool IntMasterEnable(void)
void IntUnregister(uint32_t ui32Interrupt)
Definition: interrupt.c:378
void IntPrioritySet(uint32_t ui32Interrupt, uint8_t ui8Priority)
Definition: interrupt.c:522
uint32_t IntIsEnabled(uint32_t ui32Interrupt)
Definition: interrupt.c:752
uint32_t IntPriorityMaskGet(void)
Definition: interrupt.c:1006
void IntDisable(uint32_t ui32Interrupt)
Definition: interrupt.c:678
void IntRegister(uint32_t ui32Interrupt, void(*pfnHandler)(void))
Definition: interrupt.c:306
void IntEnable(uint32_t ui32Interrupt)
Definition: interrupt.c:605
Copyright 2017, Texas Instruments Incorporated