Skip to content

Commit 377569c

Browse files
authored
remove checks for exclusive irq
This is already handled by add_shared_irq_handler() and i think it is more confusing to have it here
1 parent 5c461c0 commit 377569c

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

pio/uart_pio_dma/uart_pio_dma.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -126,24 +126,14 @@ int main()
126126
gpio_set_function(GPIO_TX, GPIO_FUNC_UART);
127127
#endif
128128

129-
#if USE_PIO_FOR_RX
130-
// check the pio irq is available
131-
if (irq_get_exclusive_handler(pio_get_irq_num(pio_hw_rx, PIO_IRQ_TO_USE))) {
132-
panic("PIO IRQ in use");
133-
}
134-
#if USE_DMA_FOR_RX
135-
// add a shared pio handler
129+
#if USE_PIO_FOR_RX && USE_DMA_FOR_RX
130+
// add a shared pio handler to print some status
136131
irq_add_shared_handler(pio_get_irq_num(pio_hw_rx, PIO_IRQ_TO_USE), pio_irq_handler, PIO_IRQ_PRIORITY);
137-
pio_set_irqn_source_enabled(pio_hw_rx, PIO_IRQ_TO_USE, pis_sm0_rx_fifo_not_empty + pio_sm_rx, true);
132+
pio_set_irqn_source_enabled(pio_hw_rx, PIO_IRQ_TO_USE, pio_get_rx_fifo_not_empty_interrupt_source(pio_sm_rx), true);
138133
irq_set_enabled(pio_get_irq_num(pio_hw_rx, PIO_IRQ_TO_USE), true);
139134
#endif
140-
#endif
141135

142136
#if USE_DMA_FOR_RX || USE_DMA_FOR_TX
143-
// check the dma irq is available
144-
if (irq_get_exclusive_handler(dma_get_irq_num(DMA_IRQ_TO_USE))) {
145-
panic("DMA IRQ in use");
146-
}
147137
// add a shared dma handler
148138
irq_add_shared_handler(dma_get_irq_num(DMA_IRQ_TO_USE), dma_irq_handler, DMA_IRQ_PRIORITY);
149139
irq_set_enabled(dma_get_irq_num(DMA_IRQ_TO_USE), true);

0 commit comments

Comments
 (0)