stm32_isr.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. /*
  2. ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. /**
  14. * @file STM32F3xx/stm32_isr.h
  15. * @brief STM32F3xx ISR handler header.
  16. *
  17. * @addtogroup STM32F3xx_ISR
  18. * @{
  19. */
  20. #ifndef STM32_ISR_H
  21. #define STM32_ISR_H
  22. /*===========================================================================*/
  23. /* Driver constants. */
  24. /*===========================================================================*/
  25. /**
  26. * @name ISRs suppressed in standard drivers
  27. * @{
  28. */
  29. #define STM32_TIM1_SUPPRESS_ISR
  30. #define STM32_TIM15_SUPPRESS_ISR
  31. #define STM32_TIM16_SUPPRESS_ISR
  32. #define STM32_TIM17_SUPPRESS_ISR
  33. /** @} */
  34. /**
  35. * @name ISR names and numbers remapping
  36. * @{
  37. */
  38. /*
  39. * CAN units.
  40. */
  41. #define STM32_CAN1_TX_HANDLER Vector8C
  42. #define STM32_CAN1_RX0_HANDLER Vector90
  43. #define STM32_CAN1_RX1_HANDLER Vector94
  44. #define STM32_CAN1_SCE_HANDLER Vector98
  45. #define STM32_CAN1_TX_NUMBER 19
  46. #define STM32_CAN1_RX0_NUMBER 20
  47. #define STM32_CAN1_RX1_NUMBER 21
  48. #define STM32_CAN1_SCE_NUMBER 22
  49. /*
  50. * I2C units.
  51. */
  52. #define STM32_I2C1_EVENT_HANDLER VectorBC
  53. #define STM32_I2C1_ERROR_HANDLER VectorC0
  54. #define STM32_I2C1_EVENT_NUMBER 31
  55. #define STM32_I2C1_ERROR_NUMBER 32
  56. #define STM32_I2C2_EVENT_HANDLER VectorC4
  57. #define STM32_I2C2_ERROR_HANDLER VectorC8
  58. #define STM32_I2C2_EVENT_NUMBER 33
  59. #define STM32_I2C2_ERROR_NUMBER 34
  60. #define STM32_I2C3_EVENT_HANDLER Vector160
  61. #define STM32_I2C3_ERROR_HANDLER Vector164
  62. #define STM32_I2C3_EVENT_NUMBER 72
  63. #define STM32_I2C3_ERROR_NUMBER 73
  64. /*
  65. * TIM units.
  66. */
  67. #define STM32_TIM1_UP_HANDLER VectorA4
  68. #define STM32_TIM1_CC_HANDLER VectorAC
  69. #define STM32_TIM2_HANDLER VectorB0
  70. #define STM32_TIM3_HANDLER VectorB4
  71. #define STM32_TIM4_HANDLER VectorB8
  72. #define STM32_TIM6_HANDLER Vector118
  73. #define STM32_TIM7_HANDLER Vector11C
  74. #define STM32_TIM8_UP_HANDLER VectorF0
  75. #define STM32_TIM8_CC_HANDLER VectorF8
  76. #define STM32_TIM15_HANDLER VectorA0 /* Note: same as STM32_TIM1_BRK */
  77. #define STM32_TIM16_HANDLER VectorA4 /* Note: same as STM32_TIM1_UP */
  78. #define STM32_TIM17_HANDLER VectorA8 /* Note: same as STM32_TIM1_TRG_COM */
  79. #define STM32_TIM20_UP_HANDLER Vector178
  80. #define STM32_TIM20_CC_HANDLER Vector180
  81. #define STM32_TIM1_UP_NUMBER 25
  82. #define STM32_TIM1_CC_NUMBER 27
  83. #define STM32_TIM2_NUMBER 28
  84. #define STM32_TIM3_NUMBER 29
  85. #define STM32_TIM4_NUMBER 30
  86. #define STM32_TIM6_NUMBER 54
  87. #define STM32_TIM7_NUMBER 55
  88. #define STM32_TIM8_UP_NUMBER 44
  89. #define STM32_TIM8_CC_NUMBER 46
  90. #define STM32_TIM15_NUMBER 24 /* Note: same as STM32_TIM1_BRK */
  91. #define STM32_TIM16_NUMBER 25 /* Note: same as STM32_TIM1_UP */
  92. #define STM32_TIM17_NUMBER 26 /* Note: same as STM32_TIM1_TRG_COM */
  93. #define STM32_TIM20_UP_NUMBER 78
  94. #define STM32_TIM20_CC_NUMBER 80
  95. /*
  96. * HRTIM units (F334)
  97. */
  98. #define STM32_HRTIM_MASTER_HANDLER Vector14C
  99. #define STM32_HRTIM_TIMA_HANDLER Vector150
  100. #define STM32_HRTIM_TIMB_HANDLER Vector154
  101. #define STM32_HRTIM_TIMC_HANDLER Vector158
  102. #define STM32_HRTIM_TIMD_HANDLER Vector15C
  103. #define STM32_HRTIM_TIME_HANDLER Vector160
  104. #define STM32_HRTIM_FLT_HANDLER Vector164
  105. #define STM32_HRTIM_MASTER_NUMBER 67
  106. #define STM32_HRTIM_TIMA_NUMBER 68
  107. #define STM32_HRTIM_TIMB_NUMBER 69
  108. #define STM32_HRTIM_TIMC_NUMBER 70
  109. #define STM32_HRTIM_TIMD_NUMBER 71
  110. #define STM32_HRTIM_TIME_NUMBER 72
  111. #define STM32_HRTIM_FLT_NUMBER 73
  112. /*
  113. * USART units.
  114. */
  115. #define STM32_USART1_HANDLER VectorD4
  116. #define STM32_USART2_HANDLER VectorD8
  117. #define STM32_USART3_HANDLER VectorDC
  118. #define STM32_UART4_HANDLER Vector110
  119. #define STM32_UART5_HANDLER Vector114
  120. #define STM32_USART1_NUMBER 37
  121. #define STM32_USART2_NUMBER 38
  122. #define STM32_USART3_NUMBER 39
  123. #define STM32_UART4_NUMBER 52
  124. #define STM32_UART5_NUMBER 53
  125. /*
  126. * USB units.
  127. */
  128. #define STM32_USB1_HP_HANDLER Vector168
  129. #define STM32_USB1_LP_HANDLER Vector16C
  130. #define STM32_USB1_HP_NUMBER 74
  131. #define STM32_USB1_LP_NUMBER 75
  132. /** @} */
  133. /*===========================================================================*/
  134. /* Driver pre-compile time settings. */
  135. /*===========================================================================*/
  136. /**
  137. * @name Configuration options
  138. * @{
  139. */
  140. /**
  141. * @brief EXTI0 interrupt priority level setting.
  142. */
  143. #if !defined(STM32_IRQ_EXTI0_PRIORITY) || defined(__DOXYGEN__)
  144. #define STM32_IRQ_EXTI0_PRIORITY 6
  145. #endif
  146. /**
  147. * @brief EXTI1 interrupt priority level setting.
  148. */
  149. #if !defined(STM32_IRQ_EXTI1_PRIORITY) || defined(__DOXYGEN__)
  150. #define STM32_IRQ_EXTI1_PRIORITY 6
  151. #endif
  152. /**
  153. * @brief EXTI2 interrupt priority level setting.
  154. */
  155. #if !defined(STM32_IRQ_EXTI2_PRIORITY) || defined(__DOXYGEN__)
  156. #define STM32_IRQ_EXTI2_PRIORITY 6
  157. #endif
  158. /**
  159. * @brief EXTI3 interrupt priority level setting.
  160. */
  161. #if !defined(STM32_IRQ_EXTI3_PRIORITY) || defined(__DOXYGEN__)
  162. #define STM32_IRQ_EXTI3_PRIORITY 6
  163. #endif
  164. /**
  165. * @brief EXTI4 interrupt priority level setting.
  166. */
  167. #if !defined(STM32_IRQ_EXTI4_PRIORITY) || defined(__DOXYGEN__)
  168. #define STM32_IRQ_EXTI4_PRIORITY 6
  169. #endif
  170. /**
  171. * @brief EXTI5..9 interrupt priority level setting.
  172. */
  173. #if !defined(STM32_IRQ_EXTI5_9_PRIORITY) || defined(__DOXYGEN__)
  174. #define STM32_IRQ_EXTI5_9_PRIORITY 6
  175. #endif
  176. /**
  177. * @brief EXTI10..15 interrupt priority level setting.
  178. */
  179. #if !defined(STM32_IRQ_EXTI10_15_PRIORITY) || defined(__DOXYGEN__)
  180. #define STM32_IRQ_EXTI10_15_PRIORITY 6
  181. #endif
  182. /**
  183. * @brief EXTI16 interrupt priority level setting.
  184. */
  185. #if !defined(STM32_IRQ_EXTI16_PRIORITY) || defined(__DOXYGEN__)
  186. #define STM32_IRQ_EXTI16_PRIORITY 6
  187. #endif
  188. /**
  189. * @brief EXTI17 interrupt priority level setting.
  190. */
  191. #if !defined(STM32_IRQ_EXTI17_PRIORITY) || defined(__DOXYGEN__)
  192. #define STM32_IRQ_EXTI17_PRIORITY 6
  193. #endif
  194. /**
  195. * @brief EXTI18 interrupt priority level setting.
  196. */
  197. #if !defined(STM32_IRQ_EXTI18_PRIORITY) || defined(__DOXYGEN__)
  198. #define STM32_IRQ_EXTI18_PRIORITY 6
  199. #endif
  200. /**
  201. * @brief EXTI19 interrupt priority level setting.
  202. */
  203. #if !defined(STM32_IRQ_EXTI19_PRIORITY) || defined(__DOXYGEN__)
  204. #define STM32_IRQ_EXTI19_PRIORITY 6
  205. #endif
  206. /**
  207. * @brief EXTI20 interrupt priority level setting.
  208. */
  209. #if !defined(STM32_IRQ_EXTI20_PRIORITY) || defined(__DOXYGEN__)
  210. #define STM32_IRQ_EXTI20_PRIORITY 6
  211. #endif
  212. /**
  213. * @brief EXTI21,22,29 interrupt priority level setting.
  214. */
  215. #if !defined(STM32_IRQ_EXTI21_22_29_PRIORITY) || defined(__DOXYGEN__)
  216. #define STM32_IRQ_EXTI21_22_29_PRIORITY 6
  217. #endif
  218. /**
  219. * @brief EXTI30..32 interrupt priority level setting.
  220. */
  221. #if !defined(STM32_IRQ_EXTI30_32_PRIORITY) || defined(__DOXYGEN__)
  222. #define STM32_IRQ_EXTI30_32_PRIORITY 6
  223. #endif
  224. /**
  225. * @brief EXTI33 interrupt priority level setting.
  226. */
  227. #if !defined(STM32_IRQ_EXTI33_PRIORITY) || defined(__DOXYGEN__)
  228. #define STM32_IRQ_EXTI33_PRIORITY 6
  229. #endif
  230. /**
  231. * @brief TIM1-BRK, TIM15 interrupt priority level setting.
  232. */
  233. #if !defined(STM32_IRQ_TIM1_BRK_TIM15_PRIORITY) || defined(__DOXYGEN__)
  234. #define STM32_IRQ_TIM1_BRK_TIM15_PRIORITY 7
  235. #endif
  236. /**
  237. * @brief TIM1-UP, TIM16 interrupt priority level setting.
  238. */
  239. #if !defined(STM32_IRQ_TIM1_UP_TIM16_PRIORITY) || defined(__DOXYGEN__)
  240. #define STM32_IRQ_TIM1_UP_TIM16_PRIORITY 7
  241. #endif
  242. /**
  243. * @brief TIM1-TRG-COM, TIM17 interrupt priority level setting.
  244. */
  245. #if !defined(STM32_IRQ_TIM1_TRGCO_TIM17_PRIORITY) || defined(__DOXYGEN__)
  246. #define STM32_IRQ_TIM1_TRGCO_TIM17_PRIORITY 7
  247. #endif
  248. /**
  249. * @brief TIM1-CC interrupt priority level setting.
  250. */
  251. #if !defined(STM32_IRQ_TIM1_CC_PRIORITY) || defined(__DOXYGEN__)
  252. #define STM32_IRQ_TIM1_CC_PRIORITY 7
  253. #endif
  254. /** @} */
  255. /*===========================================================================*/
  256. /* Derived constants and error checks. */
  257. /*===========================================================================*/
  258. /* IRQ priority checks.*/
  259. #if !OSAL_IRQ_IS_VALID_PRIORITY(STM32_IRQ_EXTI0_PRIORITY)
  260. #error "Invalid IRQ priority assigned to STM32_IRQ_EXTI0_PRIORITY"
  261. #endif
  262. #if !OSAL_IRQ_IS_VALID_PRIORITY(STM32_IRQ_EXTI1_PRIORITY)
  263. #error "Invalid IRQ priority assigned to STM32_IRQ_EXTI1_PRIORITY"
  264. #endif
  265. #if !OSAL_IRQ_IS_VALID_PRIORITY(STM32_IRQ_EXTI2_PRIORITY)
  266. #error "Invalid IRQ priority assigned to STM32_IRQ_EXTI2_PRIORITY"
  267. #endif
  268. #if !OSAL_IRQ_IS_VALID_PRIORITY(STM32_IRQ_EXTI3_PRIORITY)
  269. #error "Invalid IRQ priority assigned to STM32_IRQ_EXTI3_PRIORITY"
  270. #endif
  271. #if !OSAL_IRQ_IS_VALID_PRIORITY(STM32_IRQ_EXTI4_PRIORITY)
  272. #error "Invalid IRQ priority assigned to STM32_IRQ_EXTI4_PRIORITY"
  273. #endif
  274. #if !OSAL_IRQ_IS_VALID_PRIORITY(STM32_IRQ_EXTI5_9_PRIORITY)
  275. #error "Invalid IRQ priority assigned to STM32_IRQ_EXTI5_9_PRIORITY"
  276. #endif
  277. #if !OSAL_IRQ_IS_VALID_PRIORITY(STM32_IRQ_EXTI10_15_PRIORITY)
  278. #error "Invalid IRQ priority assigned to STM32_IRQ_EXTI10_15_PRIORITY"
  279. #endif
  280. #if !OSAL_IRQ_IS_VALID_PRIORITY(STM32_IRQ_EXTI16_PRIORITY)
  281. #error "Invalid IRQ priority assigned to STM32_IRQ_EXTI16_PRIORITY"
  282. #endif
  283. #if !OSAL_IRQ_IS_VALID_PRIORITY(STM32_IRQ_EXTI17_PRIORITY)
  284. #error "Invalid IRQ priority assigned to STM32_IRQ_EXTI17_PRIORITY"
  285. #endif
  286. #if !OSAL_IRQ_IS_VALID_PRIORITY(STM32_IRQ_EXTI18_PRIORITY)
  287. #error "Invalid IRQ priority assigned to STM32_IRQ_EXTI18_PRIORITY"
  288. #endif
  289. #if !OSAL_IRQ_IS_VALID_PRIORITY(STM32_IRQ_EXTI19_PRIORITY)
  290. #error "Invalid IRQ priority assigned to STM32_IRQ_EXTI19_PRIORITY"
  291. #endif
  292. #if !OSAL_IRQ_IS_VALID_PRIORITY(STM32_IRQ_EXTI20_PRIORITY)
  293. #error "Invalid IRQ priority assigned to STM32_IRQ_EXTI20_PRIORITY"
  294. #endif
  295. #if !OSAL_IRQ_IS_VALID_PRIORITY(STM32_IRQ_EXTI21_22_29_PRIORITY)
  296. #error "Invalid IRQ priority assigned to STM32_IRQ_EXTI21_22_29_PRIORITY"
  297. #endif
  298. #if !OSAL_IRQ_IS_VALID_PRIORITY(STM32_IRQ_EXTI30_32_PRIORITY)
  299. #error "Invalid IRQ priority assigned to STM32_IRQ_EXTI30_32_PRIORITY"
  300. #endif
  301. #if !OSAL_IRQ_IS_VALID_PRIORITY(STM32_IRQ_EXTI33_PRIORITY)
  302. #error "Invalid IRQ priority assigned to STM32_IRQ_EXTI33_PRIORITY"
  303. #endif
  304. #if !OSAL_IRQ_IS_VALID_PRIORITY(STM32_IRQ_TIM1_BRK_TIM15_PRIORITY)
  305. #error "Invalid IRQ priority assigned to STM32_IRQ_TIM1_BRK_TIM15_PRIORITY"
  306. #endif
  307. #if !OSAL_IRQ_IS_VALID_PRIORITY(STM32_IRQ_TIM1_UP_TIM16_PRIORITY)
  308. #error "Invalid IRQ priority assigned to STM32_IRQ_TIM1_UP_TIM16_PRIORITY"
  309. #endif
  310. #if !OSAL_IRQ_IS_VALID_PRIORITY(STM32_IRQ_TIM1_TRGCO_TIM17_PRIORITY)
  311. #error "Invalid IRQ priority assigned to STM32_IRQ_TIM1_TRGCO_TIM17_PRIORITY"
  312. #endif
  313. #if !OSAL_IRQ_IS_VALID_PRIORITY(STM32_IRQ_TIM1_CC_PRIORITY)
  314. #error "Invalid IRQ priority assigned to STM32_IRQ_TIM1_CC_PRIORITY"
  315. #endif
  316. /*===========================================================================*/
  317. /* Driver data structures and types. */
  318. /*===========================================================================*/
  319. /*===========================================================================*/
  320. /* Driver macros. */
  321. /*===========================================================================*/
  322. /*===========================================================================*/
  323. /* External declarations. */
  324. /*===========================================================================*/
  325. #ifdef __cplusplus
  326. extern "C" {
  327. #endif
  328. void irqInit(void);
  329. void irqDeinit(void);
  330. #ifdef __cplusplus
  331. }
  332. #endif
  333. #endif /* STM32_ISR_H */
  334. /** @} */