-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: drivers: uart: Add test for async API using two instance
Add test which is using two independent UART devices. Validate behavior of asynchronous API. Signed-off-by: Krzysztof Chruściński <[email protected]>
- Loading branch information
1 parent
fd5ecef
commit b9f3391
Showing
8 changed files
with
843 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
cmake_minimum_required(VERSION 3.20.0) | ||
|
||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
project(uart_async_dual) | ||
|
||
target_sources(app PRIVATE src/main.c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright (c) 2024 Nordic Semiconductor ASA | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config UART_ASYNC_DUAL_TEST_TIMEOUT | ||
int "Single test case length (in milliseconds)" | ||
# For the simulated devices, which are run by default in CI, we set it to less to not spend too | ||
# much CI time | ||
default 500 if SOC_SERIES_BSIM_NRFXX | ||
default 3000 | ||
help | ||
For how many loops will the stress test run. The higher this number the longer the | ||
test and therefore the higher likelihood an unlikely race/event will be triggered. | ||
|
||
# Include Zephyr's Kconfig | ||
source "Kconfig" |
70 changes: 70 additions & 0 deletions
70
tests/drivers/uart/uart_async_dual/boards/nrf54h20dk_nrf54h20_common.dtsi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* SPDX-License-Identifier: Apache-2.0 */ | ||
|
||
&pinctrl { | ||
uart134_alt_default: uart134_alt_default { | ||
group1 { | ||
psels = <NRF_PSEL(UART_RX, 0, 6)>; | ||
bias-pull-up; | ||
}; | ||
group2 { | ||
psels = <NRF_PSEL(UART_RTS, 0, 8)>; | ||
}; | ||
}; | ||
|
||
uart134_alt_sleep: uart134_alt_sleep { | ||
group1 { | ||
psels = <NRF_PSEL(UART_RX, 0, 6)>, | ||
<NRF_PSEL(UART_RTS, 0, 8)>; | ||
low-power-enable; | ||
}; | ||
}; | ||
|
||
uart137_alt_default: uart137_alt_default { | ||
group1 { | ||
psels = <NRF_PSEL(UART_TX, 0, 7)>; | ||
}; | ||
group2 { | ||
psels = <NRF_PSEL(UART_CTS, 0, 9)>; | ||
bias-pull-up; | ||
}; | ||
}; | ||
|
||
uart137_alt_sleep: uart137_alt_sleep { | ||
group1 { | ||
psels = <NRF_PSEL(UART_TX, 0, 7)>, | ||
<NRF_PSEL(UART_CTS, 0, 9)>; | ||
low-power-enable; | ||
}; | ||
}; | ||
}; | ||
|
||
dut: &uart134 { | ||
status = "okay"; | ||
current-speed = <115200>; | ||
pinctrl-0 = <&uart134_alt_default>; | ||
pinctrl-1 = <&uart134_alt_sleep>; | ||
pinctrl-names = "default", "sleep"; | ||
hw-flow-control; | ||
}; | ||
|
||
dut_aux: &uart137 { | ||
status = "okay"; | ||
current-speed = <115200>; | ||
pinctrl-0 = <&uart137_alt_default>; | ||
pinctrl-1 = <&uart137_alt_sleep>; | ||
pinctrl-names = "default", "sleep"; | ||
hw-flow-control; | ||
}; | ||
|
||
&timer137 { | ||
status = "okay"; | ||
interrupts = <467 0>; | ||
}; | ||
|
||
/ { | ||
busy-sim { | ||
compatible = "vnd,busy-sim"; | ||
status = "okay"; | ||
counter = <&timer137>; | ||
}; | ||
}; |
11 changes: 11 additions & 0 deletions
11
tests/drivers/uart/uart_async_dual/boards/nrf54h20dk_nrf54h20_cpuapp.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* SPDX-License-Identifier: Apache-2.0 */ | ||
|
||
#include "nrf54h20dk_nrf54h20_common.dtsi" | ||
|
||
&dut { | ||
memory-regions = <&cpuapp_dma_region>; | ||
}; | ||
|
||
&dut_aux { | ||
memory-regions = <&cpuapp_dma_region>; | ||
}; |
70 changes: 70 additions & 0 deletions
70
tests/drivers/uart/uart_async_dual/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* SPDX-License-Identifier: Apache-2.0 */ | ||
|
||
&pinctrl { | ||
uart21_default: uart21_default { | ||
group1 { | ||
psels = <NRF_PSEL(UART_RX, 1, 8)>; | ||
bias-pull-up; | ||
}; | ||
group2 { | ||
psels = <NRF_PSEL(UART_RTS, 1, 10)>; | ||
}; | ||
}; | ||
|
||
uart21_sleep: uart21_sleep { | ||
group1 { | ||
psels = <NRF_PSEL(UART_RX, 1, 8)>, | ||
<NRF_PSEL(UART_RTS, 1, 10)>; | ||
low-power-enable; | ||
}; | ||
}; | ||
|
||
uart22_default: uart22_default { | ||
group1 { | ||
psels = <NRF_PSEL(UART_TX, 1, 9)>; | ||
}; | ||
group2 { | ||
psels = <NRF_PSEL(UART_CTS, 1, 11)>; | ||
bias-pull-up; | ||
}; | ||
}; | ||
|
||
uart22_sleep: uart22_sleep { | ||
group1 { | ||
psels = <NRF_PSEL(UART_TX, 1, 9)>, | ||
<NRF_PSEL(UART_CTS, 1, 11)>; | ||
low-power-enable; | ||
}; | ||
}; | ||
}; | ||
|
||
dut: &uart21 { | ||
status = "okay"; | ||
current-speed = <115200>; | ||
pinctrl-0 = <&uart21_default>; | ||
pinctrl-1 = <&uart21_sleep>; | ||
pinctrl-names = "default", "sleep"; | ||
hw-flow-control; | ||
}; | ||
|
||
dut_aux: &uart22 { | ||
status = "okay"; | ||
current-speed = <115200>; | ||
pinctrl-0 = <&uart22_default>; | ||
pinctrl-1 = <&uart22_sleep>; | ||
pinctrl-names = "default", "sleep"; | ||
hw-flow-control; | ||
}; | ||
|
||
&timer20 { | ||
status = "okay"; | ||
interrupts = <202 0>; | ||
}; | ||
|
||
/ { | ||
busy-sim { | ||
compatible = "vnd,busy-sim"; | ||
status = "okay"; | ||
counter = <&timer20>; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CONFIG_ZTEST=y | ||
CONFIG_TEST_BUSY_SIM=y | ||
CONFIG_RING_BUFFER=y | ||
CONFIG_TEST_RANDOM_GENERATOR=y | ||
CONFIG_SERIAL=y | ||
CONFIG_UART_ASYNC_API=y | ||
CONFIG_UART_USE_RUNTIME_CONFIGURE=y |
Oops, something went wrong.