Skip to content

Commit 2cd2374

Browse files
committed
tests: drivers: uart: mix_fifo_poll: Add nrf54h20 cpuppr
Add configuration for nrf54h20dk/nrf54h20/cpuppr. Signed-off-by: Krzysztof Chruściński <[email protected]>
1 parent 247ea3d commit 2cd2374

File tree

6 files changed

+63
-54
lines changed

6 files changed

+63
-54
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* SPDX-License-Identifier: Apache-2.0 */
2+
3+
#include "nrf54h20dk_nrf54h20_common.dtsi"
4+
5+
&timer137 {
6+
interrupts = <467 (NRF_DEFAULT_IRQ_PRIORITY + 1)>;
7+
};
8+
9+
&dut {
10+
interrupts = <470 (NRF_DEFAULT_IRQ_PRIORITY + 1)>;
11+
};
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
CONFIG_SERIAL=y
22
CONFIG_ZTEST=y
3-
CONFIG_TEST_USERSPACE=y
3+
CONFIG_TEST_USERSPACE=n
44
CONFIG_ZTEST_THREAD_PRIORITY=5
55
CONFIG_MAIN_STACK_SIZE=2048
66
CONFIG_ZTEST_STACK_SIZE=2048
77
CONFIG_TEST_RANDOM_GENERATOR=y
88
CONFIG_COUNTER=y
99

10-
# CONFIG_NO_OPTIMIZATIONS=y
10+
CONFIG_OUTPUT_DISASSEMBLY=y
11+
#CONFIG_NO_OPTIMIZATIONS=y
1112
# CONFIG_LOG_MODE_MINIMAL=n
13+
#CONFIG_LOG=y
14+
#CONFIG_LOG_BUFFER_SIZE=16384
15+
#CONFIG_TEST_LOGGING_DEFAULTS=n
16+
17+
CONFIG_TEST_EXTRA_STACK_SIZE=2048

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

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#include <zephyr/ztest.h>
1616
#include <zephyr/drivers/counter.h>
1717
#include <zephyr/random/random.h>
18+
#include <zephyr/logging/log.h>
19+
LOG_MODULE_REGISTER(test, 0);
1820
/* RX and TX pins have to be connected together*/
1921

2022
#if DT_NODE_EXISTS(DT_NODELABEL(dut))
@@ -71,6 +73,7 @@ static const struct device *const uart_dev =
7173

7274
static bool async;
7375
static bool int_driven;
76+
static volatile bool error_found;
7477
static volatile bool async_rx_enabled;
7578
static struct k_sem async_tx_sem;
7679

@@ -84,6 +87,10 @@ static void process_byte(uint8_t b)
8487
struct rx_source *src = &source[base];
8588
bool ok;
8689

90+
if (error_found) {
91+
return;
92+
}
93+
8794
b &= 0x0F;
8895
src->cnt++;
8996

@@ -94,6 +101,12 @@ static void process_byte(uint8_t b)
94101

95102
ok = ((b - src->prev) == 1) || (!b && (src->prev == 0x0F));
96103

104+
if (!ok) {
105+
error_found = true;
106+
LOG_ERR("Unexpected byte received:0x%02x, prev:0x%02x",
107+
(base << 4) | b, (base << 4) | src->prev);
108+
};
109+
97110
zassert_true(ok, "Unexpected byte received:0x%02x, prev:0x%02x",
98111
(base << 4) | b, (base << 4) | src->prev);
99112
src->prev = b;
@@ -224,6 +237,10 @@ static void bulk_poll_out(struct test_data *data, int wait_base, int wait_range)
224237
{
225238
for (int i = 0; i < data->max; i++) {
226239

240+
if (error_found) {
241+
goto bail;
242+
}
243+
227244
data->cnt++;
228245
uart_poll_out(uart_dev, data->buf[i % BUF_SIZE]);
229246
if (wait_base) {
@@ -232,7 +249,7 @@ static void bulk_poll_out(struct test_data *data, int wait_base, int wait_range)
232249
k_sleep(K_USEC(wait_base + (r % wait_range)));
233250
}
234251
}
235-
252+
bail:
236253
k_sem_give(&data->sem);
237254
}
238255

@@ -241,10 +258,10 @@ static void poll_out_thread(void *data, void *unused0, void *unused1)
241258
bulk_poll_out((struct test_data *)data, 200, 600);
242259
}
243260

244-
K_THREAD_STACK_DEFINE(high_poll_out_thread_stack, 1024);
261+
K_THREAD_STACK_DEFINE(high_poll_out_thread_stack, 2048);
245262
static struct k_thread high_poll_out_thread;
246263

247-
K_THREAD_STACK_DEFINE(int_async_thread_stack, 1024);
264+
K_THREAD_STACK_DEFINE(int_async_thread_stack, 2048);
248265
static struct k_thread int_async_thread;
249266

250267
static void int_async_thread_func(void *p_data, void *base, void *range)
@@ -255,7 +272,7 @@ static void int_async_thread_func(void *p_data, void *base, void *range)
255272

256273
k_sem_init(&async_tx_sem, 1, 1);
257274

258-
while (data->cnt < data->max) {
275+
while (!error_found && (data->cnt < data->max)) {
259276
if (async) {
260277
int err;
261278

@@ -287,7 +304,9 @@ static void poll_out_timer_handler(struct k_timer *timer)
287304
{
288305
struct test_data *data = k_timer_user_data_get(timer);
289306

290-
uart_poll_out(uart_dev, data->buf[data->cnt % BUF_SIZE]);
307+
if (!error_found) {
308+
uart_poll_out(uart_dev, data->buf[data->cnt % BUF_SIZE]);
309+
}
291310

292311
data->cnt++;
293312
if (data->cnt == data->max) {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* SPDX-License-Identifier: Apache-2.0 */
2+
3+
#include "../../../boards/nrf54h20dk_nrf54h20_common.dtsi"
4+
5+
&dut {
6+
status = "reserved";
7+
interrupt-parent = <&cpuppr_clic>;
8+
};
9+
10+
&timer137 {
11+
status = "reserved";
12+
interrupt-parent = <&cpuppr_clic>;
13+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# nothing here

tests/drivers/uart/uart_mix_fifo_poll/testcase.yaml

Lines changed: 6 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -22,92 +22,51 @@ tests:
2222
- CONFIG_UART_INTERRUPT_DRIVEN=n
2323
- CONFIG_UART_ASYNC_API=n
2424
- CONFIG_UART_0_ENHANCED_POLL_OUT=n
25-
- CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=n
2625

2726
drivers.uart.uart_mix_poll_fifo:
2827
extra_configs:
2928
- CONFIG_UART_INTERRUPT_DRIVEN=y
30-
- CONFIG_UART_0_INTERRUPT_DRIVEN=y
3129
- CONFIG_UART_0_ENHANCED_POLL_OUT=n
32-
- CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=n
3330

3431
drivers.uart.uart_mix_poll_async_api:
3532
extra_configs:
3633
- CONFIG_UART_ASYNC_API=y
37-
- CONFIG_UART_0_INTERRUPT_DRIVEN=n
38-
- CONFIG_UART_0_ASYNC=y
3934
- CONFIG_UART_0_ENHANCED_POLL_OUT=n
40-
- CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=n
4135

4236
drivers.uart.uart_mix_poll_async_api_const:
4337
extra_args: TEST_CONST_BUFFER=1
4438
extra_configs:
4539
- CONFIG_UART_ASYNC_API=y
46-
- CONFIG_UART_0_INTERRUPT_DRIVEN=n
47-
- CONFIG_UART_0_ASYNC=y
4840
- CONFIG_UART_0_ENHANCED_POLL_OUT=n
49-
- CONFIG_UART_0_TX_CACHE_SIZE=2
50-
- CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=n
5141
tags: bsim_skip_CI # We skip a few tests to save CI time, as they give little extra coverage
5242

5343
drivers.uart.uart_mix_poll_with_ppi:
5444
extra_configs:
5545
- CONFIG_UART_INTERRUPT_DRIVEN=n
5646
- CONFIG_UART_ASYNC_API=n
5747
- CONFIG_UART_0_ENHANCED_POLL_OUT=y
58-
- CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=n
5948
tags: bsim_skip_CI
60-
61-
drivers.uart.uart_mix_poll_fifo_with_ppi:
62-
extra_configs:
63-
- CONFIG_UART_INTERRUPT_DRIVEN=y
64-
- CONFIG_UART_0_INTERRUPT_DRIVEN=y
65-
- CONFIG_UART_0_ENHANCED_POLL_OUT=y
66-
- CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=n
67-
tags: bsim_skip_CI
68-
69-
drivers.uart.uart_mix_poll_async_api_with_ppi:
70-
extra_configs:
71-
- CONFIG_UART_ASYNC_API=y
72-
- CONFIG_UART_0_INTERRUPT_DRIVEN=n
73-
- CONFIG_UART_0_ASYNC=y
74-
- CONFIG_UART_0_ENHANCED_POLL_OUT=y
75-
- CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=n
76-
tags: bsim_skip_CI
77-
78-
drivers.uart.legacy.uart_mix_poll:
79-
extra_configs:
80-
- CONFIG_UART_INTERRUPT_DRIVEN=n
81-
- CONFIG_UART_ASYNC_API=n
82-
- CONFIG_UART_0_ENHANCED_POLL_OUT=n
83-
- CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y
8449
platform_exclude:
85-
- nrf54l15dk/nrf54l15/cpuapp
8650
- nrf54h20dk/nrf54h20/cpuapp
8751
- nrf54h20dk/nrf54h20/cpurad
8852

89-
drivers.uart.legacy.uart_mix_poll_fifo:
53+
drivers.uart.uart_mix_poll_fifo_with_ppi:
9054
extra_configs:
9155
- CONFIG_UART_INTERRUPT_DRIVEN=y
9256
- CONFIG_UART_0_INTERRUPT_DRIVEN=y
93-
- CONFIG_UART_0_ENHANCED_POLL_OUT=n
94-
- CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y
57+
- CONFIG_UART_0_ENHANCED_POLL_OUT=y
58+
tags: bsim_skip_CI
9559
platform_exclude:
96-
- nrf54l15dk/nrf54l15/cpuapp
9760
- nrf54h20dk/nrf54h20/cpuapp
9861
- nrf54h20dk/nrf54h20/cpurad
9962

100-
drivers.uart.legacy.uart_mix_poll_async_api:
63+
drivers.uart.uart_mix_poll_async_api_with_ppi:
10164
extra_configs:
10265
- CONFIG_UART_ASYNC_API=y
10366
- CONFIG_UART_0_INTERRUPT_DRIVEN=n
10467
- CONFIG_UART_0_ASYNC=y
105-
- CONFIG_UART_0_ENHANCED_POLL_OUT=n
106-
- CONFIG_UART_0_NRF_HW_ASYNC=y
107-
- CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2
108-
- CONFIG_NRFX_TIMER2=y
109-
- CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=y
68+
- CONFIG_UART_0_ENHANCED_POLL_OUT=y
69+
tags: bsim_skip_CI
11070
platform_exclude:
111-
- nrf54l15dk/nrf54l15/cpuapp
11271
- nrf54h20dk/nrf54h20/cpuapp
11372
- nrf54h20dk/nrf54h20/cpurad

0 commit comments

Comments
 (0)