interrupt.h
Go to the documentation of this file.
1 #ifndef __INTERRUPT_H__
2 #define __INTERRUPT_H__
3 
4 //*****************************************************************************
5 //
8 //
9 //*****************************************************************************
10 
11 
12 //*****************************************************************************
13 //
14 // If building with a C++ compiler, make all of the definitions in this header
15 // have a C binding.
16 //
17 //*****************************************************************************
18 #ifdef __cplusplus
19 extern "C"
20 {
21 #endif
22 
23 #include <stdint.h>
24 #include <stdbool.h>
25 #include <msp.h>
26 
27 /******************************************************************************
28 * NVIC interrupts *
29 ******************************************************************************/
30 /* System exceptions */
31 #define FAULT_NMI ( 2) /* NMI fault */
32 #define FAULT_HARD ( 3) /* Hard fault */
33 #define FAULT_MPU ( 4) /* MPU fault */
34 #define FAULT_BUS ( 5) /* Bus fault */
35 #define FAULT_USAGE ( 6) /* Usage fault */
36 #define FAULT_SVCALL (11) /* SVCall */
37 #define FAULT_DEBUG (12) /* Debug monitor */
38 #define FAULT_PENDSV (14) /* PendSV */
39 #define FAULT_SYSTICK (15) /* System Tick */
40 
41 /* External interrupts */
42 #define INT_PSS (16) /* PSS IRQ */
43 #define INT_CS (17) /* CS IRQ */
44 #define INT_PCM (18) /* PCM IRQ */
45 #define INT_WDT_A (19) /* WDT_A IRQ */
46 #define INT_FPU (20) /* FPU IRQ */
47 #define INT_FLCTL (21) /* FLCTL IRQ */
48 #define INT_COMP_E0 (22) /* COMP_E0 IRQ */
49 #define INT_COMP_E1 (23) /* COMP_E1 IRQ */
50 #define INT_TA0_0 (24) /* TA0_0 IRQ */
51 #define INT_TA0_N (25) /* TA0_N IRQ */
52 #define INT_TA1_0 (26) /* TA1_0 IRQ */
53 #define INT_TA1_N (27) /* TA1_N IRQ */
54 #define INT_TA2_0 (28) /* TA2_0 IRQ */
55 #define INT_TA2_N (29) /* TA2_N IRQ */
56 #define INT_TA3_0 (30) /* TA3_0 IRQ */
57 #define INT_TA3_N (31) /* TA3_N IRQ */
58 #define INT_EUSCIA0 (32) /* EUSCIA0 IRQ */
59 #define INT_EUSCIA1 (33) /* EUSCIA1 IRQ */
60 #define INT_EUSCIA2 (34) /* EUSCIA2 IRQ */
61 #define INT_EUSCIA3 (35) /* EUSCIA3 IRQ */
62 #define INT_EUSCIB0 (36) /* EUSCIB0 IRQ */
63 #define INT_EUSCIB1 (37) /* EUSCIB1 IRQ */
64 #define INT_EUSCIB2 (38) /* EUSCIB2 IRQ */
65 #define INT_EUSCIB3 (39) /* EUSCIB3 IRQ */
66 #define INT_ADC14 (40) /* ADC14 IRQ */
67 #define INT_T32_INT1 (41) /* T32_INT1 IRQ */
68 #define INT_T32_INT2 (42) /* T32_INT2 IRQ */
69 #define INT_T32_INTC (43) /* T32_INTC IRQ */
70 #define INT_AES256 (44) /* AES256 IRQ */
71 #define INT_RTC_C (45) /* RTC_C IRQ */
72 #define INT_DMA_ERR (46) /* DMA_ERR IRQ */
73 #define INT_DMA_INT3 (47) /* DMA_INT3 IRQ */
74 #define INT_DMA_INT2 (48) /* DMA_INT2 IRQ */
75 #define INT_DMA_INT1 (49) /* DMA_INT1 IRQ */
76 #define INT_DMA_INT0 (50) /* DMA_INT0 IRQ */
77 #define INT_PORT1 (51) /* PORT1 IRQ */
78 #define INT_PORT2 (52) /* PORT2 IRQ */
79 #define INT_PORT3 (53) /* PORT3 IRQ */
80 #define INT_PORT4 (54) /* PORT4 IRQ */
81 #define INT_PORT5 (55) /* PORT5 IRQ */
82 #define INT_PORT6 (56) /* PORT6 IRQ */
83 
84 #define NUM_INTERRUPTS (56)
85 //*****************************************************************************
86 //
87 // Macro to generate an interrupt priority mask based on the number of bits
88 // of priority supported by the hardware.
89 //
90 //*****************************************************************************
91 #define INT_PRIORITY_MASK ((0xFF << (8 - NUM_PRIORITY_BITS)) & 0xFF)
92 #define NUM_PRIORITY 8
93 
94 #define NVIC_APINT_PRIGROUP_M 0x00000700 // Interrupt Priority Grouping
95 #define NVIC_APINT_PRIGROUP_7_1 0x00000000 // Priority group 7.1 split
96 #define NVIC_APINT_PRIGROUP_6_2 0x00000100 // Priority group 6.2 split
97 #define NVIC_APINT_PRIGROUP_5_3 0x00000200 // Priority group 5.3 split
98 #define NVIC_APINT_PRIGROUP_4_4 0x00000300 // Priority group 4.4 split
99 #define NVIC_APINT_PRIGROUP_3_5 0x00000400 // Priority group 3.5 split
100 #define NVIC_APINT_PRIGROUP_2_6 0x00000500 // Priority group 2.6 split
101 #define NVIC_APINT_PRIGROUP_1_7 0x00000600 // Priority group 1.7 split
102 #define NVIC_APINT_PRIGROUP_0_8 0x00000700 // Priority group 0.8 split
103 #define NVIC_SYS_PRI1_R 0xE000ED18 // System Handler Priority 1
104 #define NVIC_SYS_PRI2_R 0xE000ED1C // System Handler Priority 2
105 #define NVIC_SYS_PRI3_R 0xE000ED20 // System Handler Priority 3
106 #define NVIC_PRI0_R 0xE000E400 // Interrupt 0-3 Priority
107 #define NVIC_PRI1_R 0xE000E404 // Interrupt 4-7 Priority
108 #define NVIC_PRI2_R 0xE000E408 // Interrupt 8-11 Priority
109 #define NVIC_PRI3_R 0xE000E40C // Interrupt 12-15 Priority
110 #define NVIC_PRI4_R 0xE000E410 // Interrupt 16-19 Priority
111 #define NVIC_PRI5_R 0xE000E414 // Interrupt 20-23 Priority
112 #define NVIC_PRI6_R 0xE000E418 // Interrupt 24-27 Priority
113 #define NVIC_PRI7_R 0xE000E41C // Interrupt 28-31 Priority
114 #define NVIC_PRI8_R 0xE000E420 // Interrupt 32-35 Priority
115 #define NVIC_PRI9_R 0xE000E424 // Interrupt 36-39 Priority
116 #define NVIC_PRI10_R 0xE000E428 // Interrupt 40-43 Priority
117 #define NVIC_PRI11_R 0xE000E42C // Interrupt 44-47 Priority
118 #define NVIC_PRI12_R 0xE000E430 // Interrupt 48-51 Priority
119 #define NVIC_PRI13_R 0xE000E434 // Interrupt 52-55 Priority
120 #define NVIC_PRI14_R 0xE000E438 // Interrupt 56-59 Priority
121 #define NVIC_PRI15_R 0xE000E43C // Interrupt 60-63 Priority
122 #define NVIC_EN0_R 0xE000E100 // Interrupt 0-31 Set Enable
123 #define NVIC_EN1_R 0xE000E104 // Interrupt 32-54 Set Enable
124 #define NVIC_DIS0_R 0xE000E180 // Interrupt 0-31 Clear Enable
125 #define NVIC_DIS1_R 0xE000E184 // Interrupt 32-54 Clear Enable
126 #define NVIC_PEND0_R 0xE000E200 // Interrupt 0-31 Set Pending
127 #define NVIC_PEND1_R 0xE000E204 // Interrupt 32-54 Set Pending
128 #define NVIC_UNPEND0_R 0xE000E280 // Interrupt 0-31 Clear Pending
129 #define NVIC_UNPEND1_R 0xE000E284 // Interrupt 32-54 Clear Pending
130 //*****************************************************************************
131 //
132 // Prototypes for the APIs.
133 //
134 //*****************************************************************************
135 
136 //*****************************************************************************
137 //
146 //
147 //*****************************************************************************
148 extern bool Interrupt_enableMaster(void);
149 
150 //*****************************************************************************
151 //
161 //
162 //*****************************************************************************
163 extern bool Interrupt_disableMaster(void);
164 
165 //*****************************************************************************
166 //
191 //
192 //*****************************************************************************
193 extern void Interrupt_registerInterrupt(uint32_t interruptNumber,
194  void (*intHandler)(void));
195 
196 //*****************************************************************************
197 //
213 //
214 //*****************************************************************************
215 extern void Interrupt_unregisterInterrupt(uint32_t interruptNumber);
216 
217 //*****************************************************************************
218 //
231 //
232 //*****************************************************************************
233 extern void Interrupt_setPriorityGrouping(uint32_t bits);
234 
235 //*****************************************************************************
236 //
243 //
244 //*****************************************************************************
245 extern uint32_t Interrupt_getPriorityGrouping(void);
246 
247 //*****************************************************************************
248 //
272 //
273 //*****************************************************************************
274 extern void Interrupt_setPriority(uint32_t interruptNumber, uint8_t priority);
275 
276 //*****************************************************************************
277 //
290 //
291 //*****************************************************************************
292 extern uint8_t Interrupt_getPriority(uint32_t interruptNumber);
293 
294 //*****************************************************************************
295 //
359 //
360 //*****************************************************************************
361 extern void Interrupt_enableInterrupt(uint32_t interruptNumber);
362 
363 //*****************************************************************************
364 //
377 //
378 //*****************************************************************************
379 extern void Interrupt_disableInterrupt(uint32_t interruptNumber);
380 
381 //*****************************************************************************
382 //
394 //
395 //*****************************************************************************
396 extern bool Interrupt_isEnabled(uint32_t interruptNumber);
397 
398 //*****************************************************************************
399 //
416 //
417 //*****************************************************************************
418 extern void Interrupt_pendInterrupt(uint32_t interruptNumber);
419 
420 //*****************************************************************************
421 //
435 //
436 //*****************************************************************************
437 extern void Interrupt_unpendInterrupt(uint32_t interruptNumber);
438 
439 //*****************************************************************************
440 //
460 //
461 //*****************************************************************************
462 extern void Interrupt_setPriorityMask(uint8_t priorityMask);
463 
464 //*****************************************************************************
465 //
482 //
483 //*****************************************************************************
484 extern uint8_t Interrupt_getPriorityMask(void);
485 
486 //*****************************************************************************
487 //
495 //
496 //*****************************************************************************
497 extern void Interrupt_setVectorTableAddress(uint32_t addr);
498 
499 //*****************************************************************************
500 //
504 //
505 //*****************************************************************************
506 extern uint32_t Interrupt_getVectorTableAddress(void);
507 
508 //*****************************************************************************
509 //
515 //
516 //*****************************************************************************
517 extern void Interrupt_enableSleepOnIsrExit(void);
518 
519 //*****************************************************************************
520 //
524 //
525 //*****************************************************************************
526 extern void Interrupt_disableSleepOnIsrExit(void);
527 
528 //*****************************************************************************
529 //
530 // Mark the end of the C bindings section for C++ compilers.
531 //
532 //*****************************************************************************
533 #ifdef __cplusplus
534 }
535 #endif
536 
537 //*****************************************************************************
538 //
539 // Close the Doxygen group.
541 //
542 //*****************************************************************************
543 
544 #endif // __INTERRUPT_H__
bool Interrupt_enableMaster(void)
void Interrupt_setVectorTableAddress(uint32_t addr)
Definition: interrupt.c:484
void Interrupt_enableSleepOnIsrExit(void)
Definition: interrupt.c:494
void Interrupt_disableSleepOnIsrExit(void)
Definition: interrupt.c:499
void Interrupt_enableInterrupt(uint32_t interruptNumber)
Definition: interrupt.c:264
uint32_t Interrupt_getVectorTableAddress(void)
Definition: interrupt.c:489
void Interrupt_unpendInterrupt(uint32_t interruptNumber)
Definition: interrupt.c:442
uint8_t Interrupt_getPriorityMask(void)
Definition: interrupt.c:479
bool Interrupt_disableMaster(void)
Definition: interrupt.c:126
void Interrupt_registerInterrupt(uint32_t interruptNumber, void(*intHandler)(void))
Definition: interrupt.c:134
bool Interrupt_isEnabled(uint32_t interruptNumber)
Definition: interrupt.c:352
void Interrupt_setPriorityMask(uint8_t priorityMask)
Definition: interrupt.c:474
void Interrupt_setPriority(uint32_t interruptNumber, uint8_t priority)
Definition: interrupt.c:232
void Interrupt_pendInterrupt(uint32_t interruptNumber)
Definition: interrupt.c:404
void Interrupt_disableInterrupt(uint32_t interruptNumber)
Definition: interrupt.c:308
uint8_t Interrupt_getPriority(uint32_t interruptNumber)
Definition: interrupt.c:250
uint32_t Interrupt_getPriorityGrouping(void)
Definition: interrupt.c:203
void Interrupt_setPriorityGrouping(uint32_t bits)
Definition: interrupt.c:190
void Interrupt_unregisterInterrupt(uint32_t interruptNumber)
Definition: interrupt.c:177

Copyright 2016, Texas Instruments Incorporated