interrupt.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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. #ifndef __DRIVERLIB_INTERRUPT_H__
  38. #define __DRIVERLIB_INTERRUPT_H__
  39. #include <stdint.h>
  40. #include <stdbool.h>
  41. //*****************************************************************************
  42. //
  43. // If building with a C++ compiler, make all of the definitions in this header
  44. // have a C binding.
  45. //
  46. //*****************************************************************************
  47. #ifdef __cplusplus
  48. extern "C"
  49. {
  50. #endif
  51. //*****************************************************************************
  52. //
  53. // The following are defines for the fault assignments.
  54. //
  55. //*****************************************************************************
  56. #define FAULT_NMI 2 // NMI fault
  57. #define FAULT_HARD 3 // Hard fault
  58. #define FAULT_MPU 4 // MPU fault
  59. #define FAULT_BUS 5 // Bus fault
  60. #define FAULT_USAGE 6 // Usage fault
  61. #define FAULT_SVCALL 11 // SVCall
  62. #define FAULT_DEBUG 12 // Debug monitor
  63. #define FAULT_PENDSV 14 // PendSV
  64. #define FAULT_SYSTICK 15 // System Tick
  65. //*****************************************************************************
  66. //
  67. // MSP432E4 Interrupts
  68. //
  69. //*****************************************************************************
  70. #define INT_GPIOA 16 // GPIO Port A
  71. #define INT_GPIOB 17 // GPIO Port B
  72. #define INT_GPIOC 18 // GPIO Port C
  73. #define INT_GPIOD 19 // GPIO Port D
  74. #define INT_GPIOE 20 // GPIO Port E
  75. #define INT_UART0 21 // UART0
  76. #define INT_UART1 22 // UART1
  77. #define INT_SSI0 23 // SSI0
  78. #define INT_I2C0 24 // I2C0
  79. #define INT_PWM0_FAULT 25 // PWM Fault
  80. #define INT_PWM0_0 26 // PWM Generator 0
  81. #define INT_PWM0_1 27 // PWM Generator 1
  82. #define INT_PWM0_2 28 // PWM Generator 2
  83. #define INT_QEI0 29 // QEI0
  84. #define INT_ADC0SS0 30 // ADC0 Sequence 0
  85. #define INT_ADC0SS1 31 // ADC0 Sequence 1
  86. #define INT_ADC0SS2 32 // ADC0 Sequence 2
  87. #define INT_ADC0SS3 33 // ADC0 Sequence 3
  88. #define INT_WATCHDOG 34 // Watchdog Timers 0 and 1
  89. #define INT_TIMER0A 35 // 16/32-Bit Timer 0A
  90. #define INT_TIMER0B 36 // 16/32-Bit Timer 0B
  91. #define INT_TIMER1A 37 // 16/32-Bit Timer 1A
  92. #define INT_TIMER1B 38 // 16/32-Bit Timer 1B
  93. #define INT_TIMER2A 39 // 16/32-Bit Timer 2A
  94. #define INT_TIMER2B 40 // 16/32-Bit Timer 2B
  95. #define INT_COMP0 41 // Analog Comparator 0
  96. #define INT_COMP1 42 // Analog Comparator 1
  97. #define INT_COMP2 43 // Analog Comparator 2
  98. #define INT_SYSCTL 44 // System Control
  99. #define INT_FLASH 45 // Flash Memory Control
  100. #define INT_GPIOF 46 // GPIO Port F
  101. #define INT_GPIOG 47 // GPIO Port G
  102. #define INT_GPIOH 48 // GPIO Port H
  103. #define INT_UART2 49 // UART2
  104. #define INT_SSI1 50 // SSI1
  105. #define INT_TIMER3A 51 // 16/32-Bit Timer 3A
  106. #define INT_TIMER3B 52 // 16/32-Bit Timer 3B
  107. #define INT_I2C1 53 // I2C1
  108. #define INT_CAN0 54 // CAN 0
  109. #define INT_CAN1 55 // CAN1
  110. #define INT_EMAC0 56 // Ethernet MAC
  111. #define INT_HIBERNATE 57 // HIB
  112. #define INT_USB0 58 // USB MAC
  113. #define INT_PWM0_3 59 // PWM Generator 3
  114. #define INT_UDMA 60 // uDMA 0 Software
  115. #define INT_UDMAERR 61 // uDMA 0 Error
  116. #define INT_ADC1SS0 62 // ADC1 Sequence 0
  117. #define INT_ADC1SS1 63 // ADC1 Sequence 1
  118. #define INT_ADC1SS2 64 // ADC1 Sequence 2
  119. #define INT_ADC1SS3 65 // ADC1 Sequence 3
  120. #define INT_EPI0 66 // EPI 0
  121. #define INT_GPIOJ 67 // GPIO Port J
  122. #define INT_GPIOK 68 // GPIO Port K
  123. #define INT_GPIOL 69 // GPIO Port L
  124. #define INT_SSI2 70 // SSI 2
  125. #define INT_SSI3 71 // SSI 3
  126. #define INT_UART3 72 // UART 3
  127. #define INT_UART4 73 // UART 4
  128. #define INT_UART5 74 // UART 5
  129. #define INT_UART6 75 // UART 6
  130. #define INT_UART7 76 // UART 7
  131. #define INT_I2C2 77 // I2C 2
  132. #define INT_I2C3 78 // I2C 3
  133. #define INT_TIMER4A 79 // Timer 4A
  134. #define INT_TIMER4B 80 // Timer 4B
  135. #define INT_TIMER5A 81 // Timer 5A
  136. #define INT_TIMER5B 82 // Timer 5B
  137. #define INT_SYSEXC 83 // Floating-Point Exception
  138. // (imprecise)
  139. #define INT_I2C4 86 // I2C 4
  140. #define INT_I2C5 87 // I2C 5
  141. #define INT_GPIOM 88 // GPIO Port M
  142. #define INT_GPION 89 // GPIO Port N
  143. #define INT_TAMPER0 91 // Tamper
  144. #define INT_GPIOP0 92 // GPIO Port P (Summary or P0)
  145. #define INT_GPIOP1 93 // GPIO Port P1
  146. #define INT_GPIOP2 94 // GPIO Port P2
  147. #define INT_GPIOP3 95 // GPIO Port P3
  148. #define INT_GPIOP4 96 // GPIO Port P4
  149. #define INT_GPIOP5 97 // GPIO Port P5
  150. #define INT_GPIOP6 98 // GPIO Port P6
  151. #define INT_GPIOP7 99 // GPIO Port P7
  152. #define INT_GPIOQ0 100 // GPIO Port Q (Summary or Q0)
  153. #define INT_GPIOQ1 101 // GPIO Port Q1
  154. #define INT_GPIOQ2 102 // GPIO Port Q2
  155. #define INT_GPIOQ3 103 // GPIO Port Q3
  156. #define INT_GPIOQ4 104 // GPIO Port Q4
  157. #define INT_GPIOQ5 105 // GPIO Port Q5
  158. #define INT_GPIOQ6 106 // GPIO Port Q6
  159. #define INT_GPIOQ7 107 // GPIO Port Q7
  160. #define INT_GPIOR 108 // GPIO Port R
  161. #define INT_GPIOS 109 // GPIO Port S
  162. #define INT_SHA0 110 // SHA/MD5
  163. #define INT_AES0 111 // AES
  164. #define INT_DES0 112 // DES
  165. #define INT_LCD0 113 // LCD
  166. #define INT_TIMER6A 114 // 16/32-Bit Timer 6A
  167. #define INT_TIMER6B 115 // 16/32-Bit Timer 6B
  168. #define INT_TIMER7A 116 // 16/32-Bit Timer 7A
  169. #define INT_TIMER7B 117 // 16/32-Bit Timer 7B
  170. #define INT_I2C6 118 // I2C 6
  171. #define INT_I2C7 119 // I2C 7
  172. #define INT_ONEWIRE0 121 // 1-Wire
  173. #define INT_I2C8 125 // I2C 8
  174. #define INT_I2C9 126 // I2C 9
  175. #define INT_GPIOT 127 // GPIO T
  176. #define NUM_INTERRUPTS 129
  177. //*****************************************************************************
  178. //
  179. // The following are defines for the total number of priority levels.
  180. //
  181. //*****************************************************************************
  182. #define NUM_PRIORITY 8
  183. #define NUM_PRIORITY_BITS 3
  184. //*****************************************************************************
  185. //
  186. // Macro to generate an interrupt priority mask based on the number of bits
  187. // of priority supported by the hardware.
  188. //
  189. //*****************************************************************************
  190. #define INT_PRIORITY_MASK ((0xFF << (8 - NUM_PRIORITY_BITS)) & 0xFF)
  191. //*****************************************************************************
  192. //
  193. // Prototypes for the APIs.
  194. //
  195. //*****************************************************************************
  196. extern bool IntMasterEnable(void);
  197. extern bool IntMasterDisable(void);
  198. extern void IntRegister(uint32_t ui32Interrupt, void (*pfnHandler)(void));
  199. extern void IntUnregister(uint32_t ui32Interrupt);
  200. extern void IntPriorityGroupingSet(uint32_t ui32Bits);
  201. extern uint32_t IntPriorityGroupingGet(void);
  202. extern void IntPrioritySet(uint32_t ui32Interrupt,
  203. uint8_t ui8Priority);
  204. extern int32_t IntPriorityGet(uint32_t ui32Interrupt);
  205. extern void IntEnable(uint32_t ui32Interrupt);
  206. extern void IntDisable(uint32_t ui32Interrupt);
  207. extern uint32_t IntIsEnabled(uint32_t ui32Interrupt);
  208. extern void IntPendSet(uint32_t ui32Interrupt);
  209. extern void IntPendClear(uint32_t ui32Interrupt);
  210. extern void IntPriorityMaskSet(uint32_t ui32PriorityMask);
  211. extern uint32_t IntPriorityMaskGet(void);
  212. extern void IntTrigger(uint32_t ui32Interrupt);
  213. //*****************************************************************************
  214. //
  215. // Mark the end of the C bindings section for C++ compilers.
  216. //
  217. //*****************************************************************************
  218. #ifdef __cplusplus
  219. }
  220. #endif
  221. #endif // __DRIVERLIB_INTERRUPT_H__