OpenMPTL - STM32F10X
C++ Microprocessor Template Library
nvic.hpp
Go to the documentation of this file.
1 /*
2  * OpenMPTL - C++ Microprocessor Template Library
3  *
4  * Copyright (C) 2012-2017 Axel Burri <axel@tty0.ch>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 #ifndef ARCH_NVIC_HPP_INCLUDED
22 #define ARCH_NVIC_HPP_INCLUDED
23 
24 #include "../../../../common/nvic.hpp"
25 
26 namespace mptl { namespace irq {
27 
28 using wwdg = irq_channel<0>; /**< Window WatchDog Interrupt */
29 using pvd = irq_channel<1>; /**< PVD through EXTI Line detection Interrupt */
30 using tamper = irq_channel<2>; /**< Tamper Interrupt */
31 using rtc = irq_channel<3>; /**< RTC global Interrupt */
32 using flash = irq_channel<4>; /**< FLASH global Interrupt */
33 using rcc = irq_channel<5>; /**< RCC global Interrupt */
34 using exti0 = irq_channel<6>; /**< EXTI Line0 Interrupt */
35 using exti1 = irq_channel<7>; /**< EXTI Line1 Interrupt */
36 using exti2 = irq_channel<8>; /**< EXTI Line2 Interrupt */
37 using exti3 = irq_channel<9>; /**< EXTI Line3 Interrupt */
38 using exti4 = irq_channel<10>; /**< EXTI Line4 Interrupt */
39 using dma1_channel1 = irq_channel<11>; /**< DMA1 Channel 1 global Interrupt */
40 using dma1_channel2 = irq_channel<12>; /**< DMA1 Channel 2 global Interrupt */
41 using dma1_channel3 = irq_channel<13>; /**< DMA1 Channel 3 global Interrupt */
42 using dma1_channel4 = irq_channel<14>; /**< DMA1 Channel 4 global Interrupt */
43 using dma1_channel5 = irq_channel<15>; /**< DMA1 Channel 5 global Interrupt */
44 using dma1_channel6 = irq_channel<16>; /**< DMA1 Channel 6 global Interrupt */
45 using dma1_channel7 = irq_channel<17>; /**< DMA1 Channel 7 global Interrupt */
46 
47 #ifdef STM32F10X_LD
48 using adc1_2 = irq_channel<18>; /**< ADC1 and ADC2 global Interrupt */
49 using usb_hp_can1_tx = irq_channel<19>; /**< USB Device High Priority or CAN1 TX Interrupts */
50 using usb_lp_can1_rx0 = irq_channel<20>; /**< USB Device Low Priority or CAN1 RX0 Interrupts */
51 using can1_rx1 = irq_channel<21>; /**< CAN1 RX1 Interrupt */
52 using can1_sce = irq_channel<22>; /**< CAN1 SCE Interrupt */
53 using exti9_5 = irq_channel<23>; /**< External Line[9:5] Interrupts */
54 using tim1_brk = irq_channel<24>; /**< TIM1 Break Interrupt */
55 using tim1_up = irq_channel<25>; /**< TIM1 Update Interrupt */
56 using tim1_trg_com = irq_channel<26>; /**< TIM1 Trigger and Commutation Interrupt */
57 using tim1_cc = irq_channel<27>; /**< TIM1 Capture Compare Interrupt */
58 using tim2 = irq_channel<28>; /**< TIM2 global Interrupt */
59 using tim3 = irq_channel<29>; /**< TIM3 global Interrupt */
60 using i2c1_ev = irq_channel<31>; /**< I2C1 Event Interrupt */
61 using i2c1_er = irq_channel<32>; /**< I2C1 Error Interrupt */
62 using spi1 = irq_channel<35>; /**< SPI1 global Interrupt */
63 using usart1 = irq_channel<37>; /**< USART1 global Interrupt */
64 using usart2 = irq_channel<38>; /**< USART2 global Interrupt */
65 using exti15_10 = irq_channel<40>; /**< External Line[15:10] Interrupts */
66 using rtc_alarm = irq_channel<41>; /**< RTC Alarm through EXTI Line Interrupt */
67 using usb_wakeup = irq_channel<42>; /**< USB Device WakeUp from suspend through EXTI Line Interrupt */
68 static constexpr int numof_interrupt_channels = 43;
69 #endif // STM32F10X_LD
70 
71 #ifdef STM32F10X_LD_VL
72 using adc1 = irq_channel<18>; /**< ADC1 global Interrupt */
73 using exti9_5 = irq_channel<23>; /**< External Line[9:5] Interrupts */
74 using tim1_brk_tim15 = irq_channel<24>; /**< TIM1 Break and TIM15 Interrupts */
75 using tim1_up_tim16 = irq_channel<25>; /**< TIM1 Update and TIM16 Interrupts */
76 using tim1_trg_com_tim17 = irq_channel<26>; /**< TIM1 Trigger and Commutation and TIM17 Interrupt */
77 using tim1_cc = irq_channel<27>; /**< TIM1 Capture Compare Interrupt */
78 using tim2 = irq_channel<28>; /**< TIM2 global Interrupt */
79 using tim3 = irq_channel<29>; /**< TIM3 global Interrupt */
80 using i2c1_ev = irq_channel<31>; /**< I2C1 Event Interrupt */
81 using i2c1_er = irq_channel<32>; /**< I2C1 Error Interrupt */
82 using spi1 = irq_channel<35>; /**< SPI1 global Interrupt */
83 using usart1 = irq_channel<37>; /**< USART1 global Interrupt */
84 using usart2 = irq_channel<38>; /**< USART2 global Interrupt */
85 using exti15_10 = irq_channel<40>; /**< External Line[15:10] Interrupts */
86 using rtc_alarm = irq_channel<41>; /**< RTC Alarm through EXTI Line Interrupt */
87 using cec = irq_channel<42>; /**< HDMI-CEC Interrupt */
88 using tim6_dac = irq_channel<54>; /**< TIM6 and DAC underrun Interrupt */
89 using tim7 = irq_channel<55>; /**< TIM7 Interrupt */
90 static constexpr int numof_interrupt_channels = 56;
91 #endif // STM32F10X_LD_VL
92 
93 #ifdef STM32F10X_MD
94 using adc1_2 = irq_channel<18>; /**< ADC1 and ADC2 global Interrupt */
95 using usb_hp_can1_tx = irq_channel<19>; /**< USB Device High Priority or CAN1 TX Interrupts */
96 using usb_lp_can1_rx0 = irq_channel<20>; /**< USB Device Low Priority or CAN1 RX0 Interrupts */
97 using can1_rx1 = irq_channel<21>; /**< CAN1 RX1 Interrupt */
98 using can1_sce = irq_channel<22>; /**< CAN1 SCE Interrupt */
99 using exti9_5 = irq_channel<23>; /**< External Line[9:5] Interrupts */
100 using tim1_brk = irq_channel<24>; /**< TIM1 Break Interrupt */
101 using tim1_up = irq_channel<25>; /**< TIM1 Update Interrupt */
102 using tim1_trg_com = irq_channel<26>; /**< TIM1 Trigger and Commutation Interrupt */
103 using tim1_cc = irq_channel<27>; /**< TIM1 Capture Compare Interrupt */
104 using tim2 = irq_channel<28>; /**< TIM2 global Interrupt */
105 using tim3 = irq_channel<29>; /**< TIM3 global Interrupt */
106 using tim4 = irq_channel<30>; /**< TIM4 global Interrupt */
107 using i2c1_ev = irq_channel<31>; /**< I2C1 Event Interrupt */
108 using i2c1_er = irq_channel<32>; /**< I2C1 Error Interrupt */
109 using i2c2_ev = irq_channel<33>; /**< I2C2 Event Interrupt */
110 using i2c2_er = irq_channel<34>; /**< I2C2 Error Interrupt */
111 using spi1 = irq_channel<35>; /**< SPI1 global Interrupt */
112 using spi2 = irq_channel<36>; /**< SPI2 global Interrupt */
113 using usart1 = irq_channel<37>; /**< USART1 global Interrupt */
114 using usart2 = irq_channel<38>; /**< USART2 global Interrupt */
115 using usart3 = irq_channel<39>; /**< USART3 global Interrupt */
116 using exti15_10 = irq_channel<40>; /**< External Line[15:10] Interrupts */
117 using rtc_alarm = irq_channel<41>; /**< RTC Alarm through EXTI Line Interrupt */
118 using usb_wakeup = irq_channel<42>; /**< USB Device WakeUp from suspend through EXTI Line Interrupt */
119 static constexpr int numof_interrupt_channels = 43;
120 #endif // STM32F10X_MD
121 
122 #ifdef STM32F10X_MD_VL
123 using adc1 = irq_channel<18>; /**< ADC1 global Interrupt */
124 using exti9_5 = irq_channel<23>; /**< External Line[9:5] Interrupts */
125 using tim1_brk_tim15 = irq_channel<24>; /**< TIM1 Break and TIM15 Interrupts */
126 using tim1_up_tim16 = irq_channel<25>; /**< TIM1 Update and TIM16 Interrupts */
127 using tim1_trg_com_tim17 = irq_channel<26>; /**< TIM1 Trigger and Commutation and TIM17 Interrupt */
128 using tim1_cc = irq_channel<27>; /**< TIM1 Capture Compare Interrupt */
129 using tim2 = irq_channel<28>; /**< TIM2 global Interrupt */
130 using tim3 = irq_channel<29>; /**< TIM3 global Interrupt */
131 using tim4 = irq_channel<30>; /**< TIM4 global Interrupt */
132 using i2c1_ev = irq_channel<31>; /**< I2C1 Event Interrupt */
133 using i2c1_er = irq_channel<32>; /**< I2C1 Error Interrupt */
134 using i2c2_ev = irq_channel<33>; /**< I2C2 Event Interrupt */
135 using i2c2_er = irq_channel<34>; /**< I2C2 Error Interrupt */
136 using spi1 = irq_channel<35>; /**< SPI1 global Interrupt */
137 using spi2 = irq_channel<36>; /**< SPI2 global Interrupt */
138 using usart1 = irq_channel<37>; /**< USART1 global Interrupt */
139 using usart2 = irq_channel<38>; /**< USART2 global Interrupt */
140 using usart3 = irq_channel<39>; /**< USART3 global Interrupt */
141 using exti15_10 = irq_channel<40>; /**< External Line[15:10] Interrupts */
142 using rtc_alarm = irq_channel<41>; /**< RTC Alarm through EXTI Line Interrupt */
143 using cec = irq_channel<42>; /**< HDMI-CEC Interrupt */
144 using tim6_dac = irq_channel<54>; /**< TIM6 and DAC underrun Interrupt */
145 using tim7 = irq_channel<55>; /**< TIM7 Interrupt */
146 static constexpr int numof_interrupt_channels = 56;
147 #endif // STM32F10X_MD_VL
148 
149 #ifdef STM32F10X_HD
150 using adc1_2 = irq_channel<18>; /**< ADC1 and ADC2 global Interrupt */
151 using usb_hp_can1_tx = irq_channel<19>; /**< USB Device High Priority or CAN1 TX Interrupts */
152 using usb_lp_can1_rx0 = irq_channel<20>; /**< USB Device Low Priority or CAN1 RX0 Interrupts */
153 using can1_rx1 = irq_channel<21>; /**< CAN1 RX1 Interrupt */
154 using can1_sce = irq_channel<22>; /**< CAN1 SCE Interrupt */
155 using exti9_5 = irq_channel<23>; /**< External Line[9:5] Interrupts */
156 using tim1_brk = irq_channel<24>; /**< TIM1 Break Interrupt */
157 using tim1_up = irq_channel<25>; /**< TIM1 Update Interrupt */
158 using tim1_trg_com = irq_channel<26>; /**< TIM1 Trigger and Commutation Interrupt */
159 using tim1_cc = irq_channel<27>; /**< TIM1 Capture Compare Interrupt */
160 using tim2 = irq_channel<28>; /**< TIM2 global Interrupt */
161 using tim3 = irq_channel<29>; /**< TIM3 global Interrupt */
162 using tim4 = irq_channel<30>; /**< TIM4 global Interrupt */
163 using i2c1_ev = irq_channel<31>; /**< I2C1 Event Interrupt */
164 using i2c1_er = irq_channel<32>; /**< I2C1 Error Interrupt */
165 using i2c2_ev = irq_channel<33>; /**< I2C2 Event Interrupt */
166 using i2c2_er = irq_channel<34>; /**< I2C2 Error Interrupt */
167 using spi1 = irq_channel<35>; /**< SPI1 global Interrupt */
168 using spi2 = irq_channel<36>; /**< SPI2 global Interrupt */
169 using usart1 = irq_channel<37>; /**< USART1 global Interrupt */
170 using usart2 = irq_channel<38>; /**< USART2 global Interrupt */
171 using usart3 = irq_channel<39>; /**< USART3 global Interrupt */
172 using exti15_10 = irq_channel<40>; /**< External Line[15:10] Interrupts */
173 using rtc_alarm = irq_channel<41>; /**< RTC Alarm through EXTI Line Interrupt */
174 using usb_wakeup = irq_channel<42>; /**< USB Device WakeUp from suspend through EXTI Line Interrupt */
175 using tim8_brk = irq_channel<43>; /**< TIM8 Break Interrupt */
176 using tim8_up = irq_channel<44>; /**< TIM8 Update Interrupt */
177 using tim8_trg_com = irq_channel<45>; /**< TIM8 Trigger and Commutation Interrupt */
178 using tim8_cc = irq_channel<46>; /**< TIM8 Capture Compare Interrupt */
179 using adc3 = irq_channel<47>; /**< ADC3 global Interrupt */
180 using fsmc = irq_channel<48>; /**< FSMC global Interrupt */
181 using sdio = irq_channel<49>; /**< SDIO global Interrupt */
182 using tim5 = irq_channel<50>; /**< TIM5 global Interrupt */
183 using spi3 = irq_channel<51>; /**< SPI3 global Interrupt */
184 using uart4 = irq_channel<52>; /**< UART4 global Interrupt */
185 using uart5 = irq_channel<53>; /**< UART5 global Interrupt */
186 using tim6 = irq_channel<54>; /**< TIM6 global Interrupt */
187 using tim7 = irq_channel<55>; /**< TIM7 global Interrupt */
188 using dma2_channel1 = irq_channel<56>; /**< DMA2 Channel 1 global Interrupt */
189 using dma2_channel2 = irq_channel<57>; /**< DMA2 Channel 2 global Interrupt */
190 using dma2_channel3 = irq_channel<58>; /**< DMA2 Channel 3 global Interrupt */
191 using dma2_channel4_5 = irq_channel<59>; /**< DMA2 Channel 4 and Channel 5 global Interrupt */
192 static constexpr int numof_interrupt_channels = 60;
193 #endif // STM32F10X_HD
194 
195 #ifdef STM32F10X_XL
196 using adc1_2 = irq_channel<18>; /**< ADC1 and ADC2 global Interrupt */
197 using usb_hp_can1_tx = irq_channel<19>; /**< USB Device High Priority or CAN1 TX Interrupts */
198 using usb_lp_can1_rx0 = irq_channel<20>; /**< USB Device Low Priority or CAN1 RX0 Interrupts */
199 using can1_rx1 = irq_channel<21>; /**< CAN1 RX1 Interrupt */
200 using can1_sce = irq_channel<22>; /**< CAN1 SCE Interrupt */
201 using exti9_5 = irq_channel<23>; /**< External Line[9:5] Interrupts */
202 using tim1_brk_tim9 = irq_channel<24>; /**< TIM1 Break Interrupt and TIM9 global Interrupt */
203 using tim1_up_tim10 = irq_channel<25>; /**< TIM1 Update Interrupt and TIM10 global Interrupt */
204 using tim1_trg_com_tim11 = irq_channel<26>; /**< TIM1 Trigger and Commutation Interrupt and TIM11 global interrupt */
205 using tim1_cc = irq_channel<27>; /**< TIM1 Capture Compare Interrupt */
206 using tim2 = irq_channel<28>; /**< TIM2 global Interrupt */
207 using tim3 = irq_channel<29>; /**< TIM3 global Interrupt */
208 using tim4 = irq_channel<30>; /**< TIM4 global Interrupt */
209 using i2c1_ev = irq_channel<31>; /**< I2C1 Event Interrupt */
210 using i2c1_er = irq_channel<32>; /**< I2C1 Error Interrupt */
211 using i2c2_ev = irq_channel<33>; /**< I2C2 Event Interrupt */
212 using i2c2_er = irq_channel<34>; /**< I2C2 Error Interrupt */
213 using spi1 = irq_channel<35>; /**< SPI1 global Interrupt */
214 using spi2 = irq_channel<36>; /**< SPI2 global Interrupt */
215 using usart1 = irq_channel<37>; /**< USART1 global Interrupt */
216 using usart2 = irq_channel<38>; /**< USART2 global Interrupt */
217 using usart3 = irq_channel<39>; /**< USART3 global Interrupt */
218 using exti15_10 = irq_channel<40>; /**< External Line[15:10] Interrupts */
219 using rtc_alarm = irq_channel<41>; /**< RTC Alarm through EXTI Line Interrupt */
220 using usb_wakeup = irq_channel<42>; /**< USB Device WakeUp from suspend through EXTI Line Interrupt */
221 using tim8_brk_tim12 = irq_channel<43>; /**< TIM8 Break Interrupt and TIM12 global Interrupt */
222 using tim8_up_tim13 = irq_channel<44>; /**< TIM8 Update Interrupt and TIM13 global Interrupt */
223 using tim8_trg_com_tim14 = irq_channel<45>; /**< TIM8 Trigger and Commutation Interrupt and TIM14 global interrupt */
224 using tim8_cc = irq_channel<46>; /**< TIM8 Capture Compare Interrupt */
225 using adc3 = irq_channel<47>; /**< ADC3 global Interrupt */
226 using fsmc = irq_channel<48>; /**< FSMC global Interrupt */
227 using sdio = irq_channel<49>; /**< SDIO global Interrupt */
228 using tim5 = irq_channel<50>; /**< TIM5 global Interrupt */
229 using spi3 = irq_channel<51>; /**< SPI3 global Interrupt */
230 using uart4 = irq_channel<52>; /**< UART4 global Interrupt */
231 using uart5 = irq_channel<53>; /**< UART5 global Interrupt */
232 using tim6 = irq_channel<54>; /**< TIM6 global Interrupt */
233 using tim7 = irq_channel<55>; /**< TIM7 global Interrupt */
234 using dma2_channel1 = irq_channel<56>; /**< DMA2 Channel 1 global Interrupt */
235 using dma2_channel2 = irq_channel<57>; /**< DMA2 Channel 2 global Interrupt */
236 using dma2_channel3 = irq_channel<58>; /**< DMA2 Channel 3 global Interrupt */
237 using dma2_channel4_5 = irq_channel<59>; /**< DMA2 Channel 4 and Channel 5 global Interrupt */
238 static constexpr int numof_interrupt_channels = 60;
239 #endif // STM32F10X_XL
240 
241 #ifdef STM32F10X_CL
242 using adc1_2 = irq_channel<18>; /**< ADC1 and ADC2 global Interrupt */
243 using can1_tx = irq_channel<19>; /**< USB Device High Priority or CAN1 TX Interrupts */
244 using can1_rx0 = irq_channel<20>; /**< USB Device Low Priority or CAN1 RX0 Interrupts */
245 using can1_rx1 = irq_channel<21>; /**< CAN1 RX1 Interrupt */
246 using can1_sce = irq_channel<22>; /**< CAN1 SCE Interrupt */
247 using exti9_5 = irq_channel<23>; /**< External Line[9:5] Interrupts */
248 using tim1_brk = irq_channel<24>; /**< TIM1 Break Interrupt */
249 using tim1_up = irq_channel<25>; /**< TIM1 Update Interrupt */
250 using tim1_trg_com = irq_channel<26>; /**< TIM1 Trigger and Commutation Interrupt */
251 using tim1_cc = irq_channel<27>; /**< TIM1 Capture Compare Interrupt */
252 using tim2 = irq_channel<28>; /**< TIM2 global Interrupt */
253 using tim3 = irq_channel<29>; /**< TIM3 global Interrupt */
254 using tim4 = irq_channel<30>; /**< TIM4 global Interrupt */
255 using i2c1_ev = irq_channel<31>; /**< I2C1 Event Interrupt */
256 using i2c1_er = irq_channel<32>; /**< I2C1 Error Interrupt */
257 using i2c2_ev = irq_channel<33>; /**< I2C2 Event Interrupt */
258 using i2c2_er = irq_channel<34>; /**< I2C2 Error Interrupt */
259 using spi1 = irq_channel<35>; /**< SPI1 global Interrupt */
260 using spi2 = irq_channel<36>; /**< SPI2 global Interrupt */
261 using usart1 = irq_channel<37>; /**< USART1 global Interrupt */
262 using usart2 = irq_channel<38>; /**< USART2 global Interrupt */
263 using usart3 = irq_channel<39>; /**< USART3 global Interrupt */
264 using exti15_10 = irq_channel<40>; /**< External Line[15:10] Interrupts */
265 using rtc_alarm = irq_channel<41>; /**< RTC Alarm through EXTI Line Interrupt */
266 using otg_fs_wkup = irq_channel<42>; /**< USB OTG FS WakeUp from suspend through EXTI Line Interrupt */
267 using tim5 = irq_channel<50>; /**< TIM5 global Interrupt */
268 using spi3 = irq_channel<51>; /**< SPI3 global Interrupt */
269 using uart4 = irq_channel<52>; /**< UART4 global Interrupt */
270 using uart5 = irq_channel<53>; /**< UART5 global Interrupt */
271 using tim6 = irq_channel<54>; /**< TIM6 global Interrupt */
272 using tim7 = irq_channel<55>; /**< TIM7 global Interrupt */
273 using dma2_channel1 = irq_channel<56>; /**< DMA2 Channel 1 global Interrupt */
274 using dma2_channel2 = irq_channel<57>; /**< DMA2 Channel 2 global Interrupt */
275 using dma2_channel3 = irq_channel<58>; /**< DMA2 Channel 3 global Interrupt */
276 using dma2_channel4 = irq_channel<59>; /**< DMA2 Channel 4 global Interrupt */
277 using dma2_channel5 = irq_channel<60>; /**< DMA2 Channel 5 global Interrupt */
278 using eth = irq_channel<61>; /**< Ethernet global Interrupt */
279 using eth_wkup = irq_channel<62>; /**< Ethernet Wakeup through EXTI line Interrupt */
280 using can2_tx = irq_channel<63>; /**< CAN2 TX Interrupt */
281 using can2_rx0 = irq_channel<64>; /**< CAN2 RX0 Interrupt */
282 using can2_rx1 = irq_channel<65>; /**< CAN2 RX1 Interrupt */
283 using can2_sce = irq_channel<66>; /**< CAN2 SCE Interrupt */
284 using otg_fs = irq_channel<67>; /**< USB OTG FS global Interrupt */
285 static constexpr int numof_interrupt_channels = 68;
286 #endif // STM32F10X_CL
287 
288 
289 template<unsigned usart_no> class usart;
290 template<> class usart<1> : public usart1 { };
291 template<> class usart<2> : public usart2 { };
292 template<> class usart<3> : public usart3 { };
293 
294 template<unsigned usart_no> class spi;
295 template<> class spi<1> : public spi1 { };
296 template<> class spi<2> : public spi2 { };
297 // template<> class spi<3> : public spi3 { };
298 
299 } } // namespace mptl::irq
300 
301 #endif // ARCH_NVIC_HPP_INCLUDED
static constexpr int numof_interrupt_channels
Definition: nvic.hpp:285
Definition: nvic.hpp:294
Definition: nvic.hpp:289