2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
25 #define NVIC_PRIO_MAX NVIC_BUILD_PRIORITY(0, 1)
26 #define NVIC_PRIO_TIMER NVIC_BUILD_PRIORITY(1, 1)
27 #define NVIC_PRIO_BARO_EXTI NVIC_BUILD_PRIORITY(0x0f, 0x0f)
28 #define NVIC_PRIO_SONAR_EXTI NVIC_BUILD_PRIORITY(2, 0) // maybe increase slightly
29 #define NVIC_PRIO_DSHOT_DMA NVIC_BUILD_PRIORITY(2, 1)
30 #define NVIC_PRIO_TRANSPONDER_DMA NVIC_BUILD_PRIORITY(3, 0)
31 #define NVIC_PRIO_MPU_INT_EXTI NVIC_BUILD_PRIORITY(0x0f, 0x0f)
32 #define NVIC_PRIO_MAG_INT_EXTI NVIC_BUILD_PRIORITY(0x0f, 0x0f)
33 #define NVIC_PRIO_WS2811_DMA NVIC_BUILD_PRIORITY(1, 2) // TODO - is there some reason to use high priority? (or to use DMA IRQ at all?)
34 #define NVIC_PRIO_SERIALUART_TXDMA NVIC_BUILD_PRIORITY(1, 1) // Highest of all SERIALUARTx_TXDMA
35 #define NVIC_PRIO_SERIALUART1_TXDMA NVIC_BUILD_PRIORITY(1, 1)
36 #define NVIC_PRIO_SERIALUART1_RXDMA NVIC_BUILD_PRIORITY(1, 1)
37 #define NVIC_PRIO_SERIALUART1 NVIC_BUILD_PRIORITY(1, 1)
38 #define NVIC_PRIO_SERIALUART2_TXDMA NVIC_BUILD_PRIORITY(1, 0)
39 #define NVIC_PRIO_SERIALUART2_RXDMA NVIC_BUILD_PRIORITY(1, 1)
40 #define NVIC_PRIO_SERIALUART2 NVIC_BUILD_PRIORITY(1, 2)
41 #define NVIC_PRIO_SERIALUART3_TXDMA NVIC_BUILD_PRIORITY(1, 0)
42 #define NVIC_PRIO_SERIALUART3_RXDMA NVIC_BUILD_PRIORITY(1, 1)
43 #define NVIC_PRIO_SERIALUART3 NVIC_BUILD_PRIORITY(1, 2)
44 #define NVIC_PRIO_SERIALUART4_TXDMA NVIC_BUILD_PRIORITY(1, 0)
45 #define NVIC_PRIO_SERIALUART4_RXDMA NVIC_BUILD_PRIORITY(1, 1)
46 #define NVIC_PRIO_SERIALUART4 NVIC_BUILD_PRIORITY(1, 2)
47 #define NVIC_PRIO_SERIALUART5_TXDMA NVIC_BUILD_PRIORITY(1, 0)
48 #define NVIC_PRIO_SERIALUART5_RXDMA NVIC_BUILD_PRIORITY(1, 1)
49 #define NVIC_PRIO_SERIALUART5 NVIC_BUILD_PRIORITY(1, 2)
50 #define NVIC_PRIO_SERIALUART6_TXDMA NVIC_BUILD_PRIORITY(1, 0)
51 #define NVIC_PRIO_SERIALUART6_RXDMA NVIC_BUILD_PRIORITY(1, 1)
52 #define NVIC_PRIO_SERIALUART6 NVIC_BUILD_PRIORITY(1, 2)
53 #define NVIC_PRIO_SERIALUART7_TXDMA NVIC_BUILD_PRIORITY(1, 0)
54 #define NVIC_PRIO_SERIALUART7_RXDMA NVIC_BUILD_PRIORITY(1, 1)
55 #define NVIC_PRIO_SERIALUART7 NVIC_BUILD_PRIORITY(1, 2)
56 #define NVIC_PRIO_SERIALUART8_TXDMA NVIC_BUILD_PRIORITY(1, 0)
57 #define NVIC_PRIO_SERIALUART8_RXDMA NVIC_BUILD_PRIORITY(1, 1)
58 #define NVIC_PRIO_SERIALUART8 NVIC_BUILD_PRIORITY(1, 2)
59 #define NVIC_PRIO_SERIALUART9_TXDMA NVIC_BUILD_PRIORITY(1, 0)
60 #define NVIC_PRIO_SERIALUART9_RXDMA NVIC_BUILD_PRIORITY(1, 1)
61 #define NVIC_PRIO_SERIALUART9 NVIC_BUILD_PRIORITY(1, 2)
62 #define NVIC_PRIO_SERIALUART10_TXDMA NVIC_BUILD_PRIORITY(1, 0)
63 #define NVIC_PRIO_SERIALUART10_RXDMA NVIC_BUILD_PRIORITY(1, 1)
64 #define NVIC_PRIO_SERIALUART10 NVIC_BUILD_PRIORITY(1, 2)
65 #define NVIC_PRIO_SERIALLPUART1_TXDMA NVIC_BUILD_PRIORITY(1, 0)
66 #define NVIC_PRIO_SERIALLPUART1_RXDMA NVIC_BUILD_PRIORITY(1, 1)
67 #define NVIC_PRIO_SERIALLPUART1 NVIC_BUILD_PRIORITY(1, 2)
68 #define NVIC_PRIO_I2C_ER NVIC_BUILD_PRIORITY(0, 0)
69 #define NVIC_PRIO_I2C_EV NVIC_BUILD_PRIORITY(0, 0)
70 #define NVIC_PRIO_USB NVIC_BUILD_PRIORITY(2, 0)
71 #define NVIC_PRIO_USB_WUP NVIC_BUILD_PRIORITY(1, 0)
72 #define NVIC_PRIO_SONAR_ECHO NVIC_BUILD_PRIORITY(0x0f, 0x0f)
73 #define NVIC_PRIO_MPU_DATA_READY NVIC_BUILD_PRIORITY(0, 1)
74 #define NVIC_PRIO_MAG_DATA_READY NVIC_BUILD_PRIORITY(0x0f, 0x0f)
75 #define NVIC_PRIO_CALLBACK NVIC_BUILD_PRIORITY(0x0f, 0x0f)
76 #define NVIC_PRIO_MAX7456_DMA NVIC_BUILD_PRIORITY(3, 0)
77 #define NVIC_PRIO_SPI_DMA NVIC_BUILD_PRIORITY(0, 0)
78 #define NVIC_PRIO_SDIO_DMA NVIC_BUILD_PRIORITY(0, 0)
81 // utility macros to join/split priority
82 #define NVIC_PRIORITY_GROUPING NVIC_PRIORITYGROUP_2
83 #define NVIC_BUILD_PRIORITY(base,sub) (((((base)<<(4-(7-(NVIC_PRIORITY_GROUPING))))|((sub)&(0x0f>>(7-(NVIC_PRIORITY_GROUPING)))))<<4)&0xf0)
84 #define NVIC_PRIORITY_BASE(prio) (((prio)>>(4-(7-(NVIC_PRIORITY_GROUPING))))>>4)
85 #define NVIC_PRIORITY_SUB(prio) (((prio)&(0x0f>>(7-(NVIC_PRIORITY_GROUPING))))>>4)
87 // utility macros to join/split priority
88 #define NVIC_PRIORITY_GROUPING NVIC_PriorityGroup_2
89 #define NVIC_BUILD_PRIORITY(base,sub) (((((base)<<(4-(7-(NVIC_PRIORITY_GROUPING>>8))))|((sub)&(0x0f>>(7-(NVIC_PRIORITY_GROUPING>>8)))))<<4)&0xf0)
90 #define NVIC_PRIORITY_BASE(prio) (((prio)>>(4-(7-(NVIC_PRIORITY_GROUPING>>8))))>>4)
91 #define NVIC_PRIORITY_SUB(prio) (((prio)&(0x0f>>(7-(NVIC_PRIORITY_GROUPING>>8))))>>4)