@@ -373,6 +373,8 @@ static inline NRF_UARTE_Type *get_uarte_instance(const struct device *dev)
373
373
return config -> uarte_regs ;
374
374
}
375
375
376
+ #if !defined(CONFIG_UART_NRFX_UARTE_NO_IRQ )
377
+
376
378
static void endtx_isr (const struct device * dev )
377
379
{
378
380
NRF_UARTE_Type * uarte = get_uarte_instance (dev );
@@ -388,6 +390,8 @@ static void endtx_isr(const struct device *dev)
388
390
389
391
}
390
392
393
+ #endif
394
+
391
395
/** @brief Disable UARTE peripheral is not used by RX or TX.
392
396
*
393
397
* It must be called with interrupts locked so that deciding if no direction is
@@ -426,7 +430,7 @@ static void uarte_disable_locked(const struct device *dev, uint32_t dis_mask)
426
430
nrf_uarte_disable (get_uarte_instance (dev ));
427
431
}
428
432
429
- #ifdef UARTE_ANY_NONE_ASYNC
433
+ #if defined( UARTE_ANY_NONE_ASYNC ) && !defined( CONFIG_UART_NRFX_UARTE_NO_IRQ )
430
434
/**
431
435
* @brief Interrupt service routine.
432
436
*
@@ -503,7 +507,7 @@ static void uarte_nrfx_isr_int(const void *arg)
503
507
}
504
508
#endif /* UARTE_INTERRUPT_DRIVEN */
505
509
}
506
- #endif /* UARTE_ANY_NONE_ASYNC */
510
+ #endif /* UARTE_ANY_NONE_ASYNC && !CONFIG_UART_NRFX_UARTE_NO_IRQ */
507
511
508
512
#ifdef CONFIG_UART_USE_RUNTIME_CONFIGURE
509
513
/**
@@ -1978,14 +1982,36 @@ static void uarte_nrfx_poll_out(const struct device *dev, unsigned char c)
1978
1982
}
1979
1983
}
1980
1984
1981
- if (IS_ENABLED (CONFIG_PM_DEVICE_RUNTIME ) || LOW_POWER_ENABLED (config )) {
1985
+ if (!IS_ENABLED (CONFIG_UART_NRFX_UARTE_NO_IRQ ) &&
1986
+ (IS_ENABLED (CONFIG_PM_DEVICE_RUNTIME ) || LOW_POWER_ENABLED (config ))) {
1982
1987
nrf_uarte_int_enable (uarte , NRF_UARTE_INT_TXSTOPPED_MASK );
1983
1988
}
1984
1989
1985
1990
* config -> poll_out_byte = c ;
1986
1991
tx_start (dev , config -> poll_out_byte , 1 );
1987
1992
1988
1993
irq_unlock (key );
1994
+
1995
+ if (IS_ENABLED (CONFIG_UART_NRFX_UARTE_NO_IRQ )) {
1996
+ key = wait_tx_ready (dev );
1997
+ if (!IS_ENABLED (UARTE_HAS_ENDTX_STOPTX_SHORT ) &&
1998
+ !(config -> flags & UARTE_CFG_FLAG_PPI_ENDTX )) {
1999
+ nrf_uarte_task_trigger (uarte , NRF_UARTE_TASK_STOPTX );
2000
+ nrf_uarte_event_clear (uarte , NRF_UARTE_EVENT_TXSTOPPED );
2001
+ while (!nrf_uarte_event_check (uarte , NRF_UARTE_EVENT_TXSTOPPED )) {
2002
+ }
2003
+ }
2004
+
2005
+ if (IS_ENABLED (CONFIG_PM_DEVICE_RUNTIME )) {
2006
+ if (!(data -> flags & UARTE_FLAG_POLL_OUT )) {
2007
+ data -> flags &= ~UARTE_FLAG_POLL_OUT ;
2008
+ pm_device_runtime_put (dev );
2009
+ }
2010
+ } else if (LOW_POWER_ENABLED (config )) {
2011
+ uarte_disable_locked (dev , UARTE_FLAG_LOW_POWER_TX );
2012
+ }
2013
+ irq_unlock (key );
2014
+ }
1989
2015
}
1990
2016
1991
2017
@@ -2253,7 +2279,7 @@ static void wait_for_tx_stopped(const struct device *dev)
2253
2279
NRFX_WAIT_FOR (nrf_uarte_event_check (uarte , NRF_UARTE_EVENT_TXSTOPPED ),
2254
2280
1000 , 1 , res );
2255
2281
2256
- if (!ppi_endtx ) {
2282
+ if (!ppi_endtx && ! IS_ENABLED ( CONFIG_UART_NRFX_UARTE_NO_IRQ ) ) {
2257
2283
nrf_uarte_int_enable (uarte , NRF_UARTE_INT_ENDTX_MASK );
2258
2284
}
2259
2285
}
@@ -2398,7 +2424,9 @@ static int uarte_tx_path_init(const struct device *dev)
2398
2424
}
2399
2425
nrf_uarte_event_clear (uarte , NRF_UARTE_EVENT_ENDTX );
2400
2426
nrf_uarte_task_trigger (uarte , NRF_UARTE_TASK_STOPTX );
2401
- nrf_uarte_int_enable (uarte , NRF_UARTE_INT_ENDTX_MASK );
2427
+ if (!IS_ENABLED (CONFIG_UART_NRFX_UARTE_NO_IRQ )) {
2428
+ nrf_uarte_int_enable (uarte , NRF_UARTE_INT_ENDTX_MASK );
2429
+ }
2402
2430
}
2403
2431
while (!nrf_uarte_event_check (uarte , NRF_UARTE_EVENT_TXSTOPPED )) {
2404
2432
}
@@ -2465,9 +2493,10 @@ static int uarte_instance_init(const struct device *dev,
2465
2493
2466
2494
/* Depending on configuration standard or direct IRQ is connected. */
2467
2495
#define UARTE_IRQ_CONNECT (idx , irqn , prio ) \
2468
- COND_CODE_1(CONFIG_UART_NRFX_UARTE_DIRECT_ISR, \
2469
- (IRQ_DIRECT_CONNECT(irqn, prio, uarte_##idx##_direct_isr, 0)), \
2470
- (IRQ_CONNECT(irqn, prio, UARTE_GET_ISR(idx), DEVICE_DT_GET(UARTE(idx)), 0)))
2496
+ COND_CODE_1(CONFIG_UART_NRFX_UARTE_NO_IRQ, (), \
2497
+ (COND_CODE_1(CONFIG_UART_NRFX_UARTE_DIRECT_ISR, \
2498
+ (IRQ_DIRECT_CONNECT(irqn, prio, uarte_##idx##_direct_isr, 0)), \
2499
+ (IRQ_CONNECT(irqn, prio, UARTE_GET_ISR(idx), DEVICE_DT_GET(UARTE(idx)), 0)))))
2471
2500
2472
2501
#define UARTE_IRQ_CONFIGURE (idx ) \
2473
2502
do { \
0 commit comments