@@ -2435,11 +2435,30 @@ static int uarte_instance_init(const struct device *dev,
2435
2435
return pm_device_driver_init (dev , uarte_nrfx_pm_action );
2436
2436
}
2437
2437
2438
- #define UARTE_IRQ_CONFIGURE (idx , isr_handler ) \
2439
- do { \
2440
- IRQ_CONNECT(DT_IRQN(UARTE(idx)), DT_IRQ(UARTE(idx), priority), \
2441
- isr_handler, DEVICE_DT_GET(UARTE(idx)), 0); \
2442
- irq_enable(DT_IRQN(UARTE(idx))); \
2438
+ #define UARTE_GET_ISR (idx ) \
2439
+ COND_CODE_1(CONFIG_UART_##idx##_ASYNC, (uarte_nrfx_isr_async), (uarte_nrfx_isr_int))
2440
+
2441
+ /* Declare interrupt handler for direct ISR. */
2442
+ #define UARTE_DIRECT_ISR_DECLARE (idx ) \
2443
+ IF_ENABLED(CONFIG_UART_NRFX_UARTE_DIRECT_ISR, ( \
2444
+ ISR_DIRECT_DECLARE(uarte_##idx##_direct_isr) \
2445
+ { \
2446
+ ISR_DIRECT_PM(); \
2447
+ UARTE_GET_ISR(idx)(DEVICE_DT_GET(UARTE(idx))); \
2448
+ return 1; \
2449
+ } \
2450
+ ))
2451
+
2452
+ /* Depending on configuration standard or direct IRQ is connected. */
2453
+ #define UARTE_IRQ_CONNECT (idx , irqn , prio ) \
2454
+ COND_CODE_1(CONFIG_UART_NRFX_UARTE_DIRECT_ISR, \
2455
+ (IRQ_DIRECT_CONNECT(irqn, prio, uarte_##idx##_direct_isr, 0)), \
2456
+ (IRQ_CONNECT(irqn, prio, UARTE_GET_ISR(idx), DEVICE_DT_GET(UARTE(idx)), 0)))
2457
+
2458
+ #define UARTE_IRQ_CONFIGURE (idx ) \
2459
+ do { \
2460
+ UARTE_IRQ_CONNECT(idx, DT_IRQN(UARTE(idx)), DT_IRQ(UARTE(idx), priority)); \
2461
+ irq_enable(DT_IRQN(UARTE(idx))); \
2443
2462
} while (false)
2444
2463
2445
2464
/* Low power mode is used when disable_rx is not defined or in async mode if
@@ -2585,11 +2604,10 @@ static int uarte_instance_init(const struct device *dev,
2585
2604
.precision = NRF_CLOCK_CONTROL_PRECISION_DEFAULT,\
2586
2605
},)) \
2587
2606
}; \
2607
+ UARTE_DIRECT_ISR_DECLARE(idx) \
2588
2608
static int uarte_##idx##_init(const struct device *dev) \
2589
2609
{ \
2590
- COND_CODE_1(CONFIG_UART_##idx##_ASYNC, \
2591
- (UARTE_IRQ_CONFIGURE(idx, uarte_nrfx_isr_async);), \
2592
- (UARTE_IRQ_CONFIGURE(idx, uarte_nrfx_isr_int);)) \
2610
+ UARTE_IRQ_CONFIGURE(idx); \
2593
2611
return uarte_instance_init( \
2594
2612
dev, \
2595
2613
IS_ENABLED(CONFIG_UART_##idx##_INTERRUPT_DRIVEN)); \
0 commit comments