tests: drivers: uart: uart_elementary: Add runtime PM configuration
Add configuration that uses device runtime PM. Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
13ed9e4210
commit
eae3891303
3 changed files with 36 additions and 3 deletions
|
@ -30,6 +30,7 @@ dut: &uart135 {
|
|||
pinctrl-1 = <&uart135_sleep_alt>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
current-speed = <115200>;
|
||||
zephyr,pm-device-runtime-auto;
|
||||
};
|
||||
|
||||
&pinctrl {
|
||||
|
@ -59,4 +60,5 @@ dut_aux: &uart137 {
|
|||
pinctrl-1 = <&uart137_sleep_alt>;
|
||||
pinctrl-names = "default", "sleep";
|
||||
current-speed = <115200>;
|
||||
zephyr,pm-device-runtime-auto;
|
||||
};
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
*/
|
||||
|
||||
#include <zephyr/drivers/uart.h>
|
||||
#include <zephyr/pm/device_runtime.h>
|
||||
#include <zephyr/ztest.h>
|
||||
|
||||
#if DT_NODE_EXISTS(DT_NODELABEL(dut))
|
||||
|
@ -268,15 +269,25 @@ ZTEST(uart_elementary, test_uart_dual_port_transmission)
|
|||
(void *)test_buffer_aux);
|
||||
zassert_equal(err, 0, "Unexpected error when setting user data for UART1 callback %d", err);
|
||||
|
||||
if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) {
|
||||
int usage = pm_device_runtime_usage(uart_dev);
|
||||
int usage_aux = pm_device_runtime_usage(uart_dev_aux);
|
||||
|
||||
zassert_equal(usage, 0);
|
||||
zassert_equal(usage_aux, 0);
|
||||
pm_device_runtime_get(uart_dev);
|
||||
pm_device_runtime_get(uart_dev_aux);
|
||||
}
|
||||
|
||||
uart_irq_err_enable(uart_dev);
|
||||
uart_irq_err_enable(uart_dev_aux);
|
||||
|
||||
uart_irq_tx_enable(uart_dev);
|
||||
uart_irq_tx_enable(uart_dev_aux);
|
||||
|
||||
uart_irq_rx_enable(uart_dev);
|
||||
uart_irq_rx_enable(uart_dev_aux);
|
||||
|
||||
uart_irq_tx_enable(uart_dev);
|
||||
uart_irq_tx_enable(uart_dev_aux);
|
||||
|
||||
/* wait for the tramission to finish (no polling is intentional) */
|
||||
k_sleep(K_USEC(100 * SLEEP_TIME_US));
|
||||
|
||||
|
@ -287,6 +298,17 @@ ZTEST(uart_elementary, test_uart_dual_port_transmission)
|
|||
uart_irq_err_disable(uart_dev);
|
||||
uart_irq_err_disable(uart_dev_aux);
|
||||
|
||||
if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) {
|
||||
pm_device_runtime_put(uart_dev);
|
||||
pm_device_runtime_put(uart_dev_aux);
|
||||
|
||||
int usage = pm_device_runtime_usage(uart_dev);
|
||||
int usage_aux = pm_device_runtime_usage(uart_dev_aux);
|
||||
|
||||
zassert_equal(usage, 0);
|
||||
zassert_equal(usage_aux, 0);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_SETUP_MISMATCH_TEST)
|
||||
TC_PRINT("Mismatched configuration test\n");
|
||||
zassert_not_equal(uart_error_counter + aux_uart_error_counter, 0,
|
||||
|
|
|
@ -21,6 +21,15 @@ tests:
|
|||
extra_args: DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay"
|
||||
extra_configs:
|
||||
- CONFIG_DUAL_UART_TEST=y
|
||||
drivers.uart.uart_elementary_dual_nrf54h.pm:
|
||||
filter: CONFIG_SERIAL_SUPPORT_INTERRUPT
|
||||
platform_allow:
|
||||
- nrf54h20dk/nrf54h20/cpuapp
|
||||
extra_args: DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay"
|
||||
extra_configs:
|
||||
- CONFIG_DUAL_UART_TEST=y
|
||||
- CONFIG_PM_DEVICE=y
|
||||
- CONFIG_PM_DEVICE_RUNTIME=y
|
||||
drivers.uart.uart_elementary_dual_setup_mismatch_nrf54h:
|
||||
filter: CONFIG_SERIAL_SUPPORT_INTERRUPT
|
||||
platform_allow:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue