mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 17:25:20 +03:00
NVIC priority change
Use 'better' macros to handle priority. This simplifies passing priority to function and new ATOMIC_BLOCK macro
This commit is contained in:
parent
503e7a0817
commit
bf50cbb1a8
11 changed files with 50 additions and 79 deletions
|
@ -3,54 +3,25 @@
|
|||
|
||||
#define NVIC_PRIORITY_GROUPING NVIC_PriorityGroup_2
|
||||
|
||||
// can't use 0
|
||||
#define MAX_IRQ_PRIORITY 0
|
||||
#define MAX_IRQ_SUBPRIORITY 1
|
||||
|
||||
#define TIMER_IRQ_PRIORITY 1
|
||||
#define TIMER_IRQ_SUBPRIORITY 1
|
||||
|
||||
#define BARO_EXTIRQ_PRIORITY 0x0f
|
||||
#define BARO_EXTIRQ_SUBPRIORITY 0x0f
|
||||
|
||||
#define WS2811_DMA_IRQ_PRIORITY 1 // TODO - is there some reason to use high priority? (or to use DMA IRQ at all?)
|
||||
#define WS2811_DMA_IRQ_SUBPRIORITY 2
|
||||
|
||||
#define SERIALUART1_TXDMA_IRQ_PRIORITY 1
|
||||
#define SERIALUART1_TXDMA_IRQ_SUBPRIORITY 1
|
||||
|
||||
#define SERIALUART1_RXDMA_IRQ_PRIORITY 1
|
||||
#define SERIALUART1_RXDMA_IRQ_SUBPRIORITY 1
|
||||
|
||||
#define SERIALUART1_IRQ_PRIORITY 1
|
||||
#define SERIALUART1_IRQ_SUBPRIORITY 1
|
||||
|
||||
#define SERIALUART2_TXDMA_IRQ_PRIORITY 1
|
||||
#define SERIALUART2_TXDMA_IRQ_SUBPRIORITY 0
|
||||
|
||||
#define SERIALUART2_RXDMA_IRQ_PRIORITY 1
|
||||
#define SERIALUART2_RXDMA_IRQ_SUBPRIORITY 1
|
||||
|
||||
#define SERIALUART2_IRQ_PRIORITY 1
|
||||
#define SERIALUART2_IRQ_SUBPRIORITY 2
|
||||
|
||||
#define SERIALUART3_IRQ_PRIORITY 1
|
||||
#define SERIALUART3_IRQ_SUBPRIORITY 2
|
||||
|
||||
#define I2C_ER_IRQ_PRIORITY 0
|
||||
#define I2C_ER_IRQ_SUBPRIORITY 0
|
||||
#define I2C_EV_IRQ_PRIORITY 0
|
||||
#define I2C_EV_IRQ_SUBPRIORITY 0
|
||||
|
||||
#define USB_IRQ_PRIORITY 2
|
||||
#define USB_IRQ_SUBPRIORITY 0
|
||||
#define USB_WUP_IRQ_PRIORITY 1
|
||||
#define USB_WUP_IRQ_SUBPRIORITY 0
|
||||
|
||||
#define CALLBACK_IRQ_PRIORITY 0x0f
|
||||
#define CALLBACK_IRQ_SUBPRIORITY 0x0f
|
||||
// can't use 0
|
||||
#define NVIC_PRIO_MAX NVIC_BUILD_PRIORITY(0, 1)
|
||||
#define NVIC_PRIO_TIMER NVIC_BUILD_PRIORITY(1, 1)
|
||||
#define NVIC_PRIO_BARO_EXT NVIC_BUILD_PRIORITY(0x0f, 0x0f)
|
||||
#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?)
|
||||
#define NVIC_PRIO_SERIALUART1_TXDMA NVIC_BUILD_PRIORITY(1, 1)
|
||||
#define NVIC_PRIO_SERIALUART1_RXDMA NVIC_BUILD_PRIORITY(1, 1)
|
||||
#define NVIC_PRIO_SERIALUART1 NVIC_BUILD_PRIORITY(1, 1)
|
||||
#define NVIC_PRIO_SERIALUART2_TXDMA NVIC_BUILD_PRIORITY(1, 0)
|
||||
#define NVIC_PRIO_SERIALUART2_RXDMA NVIC_BUILD_PRIORITY(1, 1)
|
||||
#define NVIC_PRIO_SERIALUART2 NVIC_BUILD_PRIORITY(1, 2)
|
||||
#define NVIC_PRIO_SERIALUART3 NVIC_BUILD_PRIORITY(1, 2)
|
||||
#define NVIC_PRIO_I2C_ER NVIC_BUILD_PRIORITY(0, 0)
|
||||
#define NVIC_PRIO_I2C_EV NVIC_BUILD_PRIORITY(0, 0)
|
||||
#define NVIC_PRIO_USB NVIC_BUILD_PRIORITY(2, 0)
|
||||
#define NVIC_PRIO_USB_WUP NVIC_BUILD_PRIORITY(1, 0)
|
||||
#define NVIC_PRIO_CALLBACK NVIC_BUILD_PRIORITY(0x0f, 0x0f)
|
||||
|
||||
// utility macros to join/split priority
|
||||
#define NVIC_BUILD_PRIORITY(base,sub) ((((base)<<(4-(7-(NVIC_PRIORITY_GROUPING>>8))))|((sub)&(0x0f>>(7-(NVIC_PRIORITY_GROUPING>>8)))))<<4)
|
||||
#define NVIC_SPLIT_PRIORITY_BASE(prio) (((prio)>>(4-(7-(NVIC_PRIORITY_GROUPING>>8))))>>4)
|
||||
#define NVIC_SPLIT_PRIORITY_SUB(prio) (((prio)&(0x0f>>(7-(NVIC_PRIORITY_GROUPING>>8))))>>4)
|
||||
#define NVIC_BUILD_PRIORITY(base,sub) (((((base)<<(4-(7-(NVIC_PRIORITY_GROUPING>>8))))|((sub)&(0x0f>>(7-(NVIC_PRIORITY_GROUPING>>8)))))<<4)&0xf0)
|
||||
#define NVIC_PRIORITY_BASE(prio) (((prio)>>(4-(7-(NVIC_PRIORITY_GROUPING>>8))))>>4)
|
||||
#define NVIC_PRIORITY_SUB(prio) (((prio)&(0x0f>>(7-(NVIC_PRIORITY_GROUPING>>8))))>>4)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue