Skip to content

Commit e60fa1e

Browse files
nordic-krchcfriedt
authored andcommitted
tests: drivers: uart: uart_errors: Use runtime PM if enabled
Use PM device runtime API is it is enabled to power up the receiving UART during the test. Signed-off-by: Krzysztof Chruściński <[email protected]>
1 parent 20425ec commit e60fa1e

File tree

1 file changed

+7
-0
lines changed
  • tests/drivers/uart/uart_errors/src

1 file changed

+7
-0
lines changed

tests/drivers/uart/uart_errors/src/main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include <zephyr/drivers/uart.h>
1515
#include <zephyr/pm/device.h>
16+
#include <zephyr/pm/device_runtime.h>
1617
#include <zephyr/ztest.h>
1718
#include <zephyr/logging/log.h>
1819
LOG_MODULE_REGISTER(test, LOG_LEVEL_NONE);
@@ -334,6 +335,9 @@ static void test_detect_error(bool hwfc, int err_byte)
334335
}
335336

336337
if (IS_ENABLED(CONFIG_UART_INTERRUPT_DRIVEN)) {
338+
if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) {
339+
pm_device_runtime_get(uart_dev);
340+
}
337341
uart_irq_err_enable(uart_dev);
338342
uart_irq_rx_enable(uart_dev);
339343
} else {
@@ -378,6 +382,9 @@ static void test_detect_error(bool hwfc, int err_byte)
378382
if (IS_ENABLED(CONFIG_UART_INTERRUPT_DRIVEN)) {
379383
uart_irq_err_disable(uart_dev);
380384
uart_irq_rx_disable(uart_dev);
385+
if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) {
386+
pm_device_runtime_put(uart_dev);
387+
}
381388
} else {
382389
rx_active = false;
383390
err = uart_rx_disable(uart_dev);

0 commit comments

Comments
 (0)