tests: uart_mix_fifo_poll: Use "counter_dev" node label

This test needs a counter device. Introduce a node label that allows
selecting one in dts overlays instead of using hard-coded `timer0`.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
Andrzej Głąbek 2023-03-22 15:14:30 +01:00 committed by Carles Cufí
commit 28d0789c37
4 changed files with 10 additions and 4 deletions

View file

@ -64,6 +64,6 @@
interrupts = <17 2>; interrupts = <17 2>;
}; };
&timer0 { counter_dev: &timer0 {
status = "okay"; status = "okay";
}; };

View file

@ -35,6 +35,6 @@
interrupts = <21 2>; interrupts = <21 2>;
}; };
&timer0 { counter_dev: &timer0 {
status = "okay"; status = "okay";
}; };

View file

@ -35,6 +35,6 @@
interrupts = <21 2>; interrupts = <21 2>;
}; };
&timer0 { counter_dev: &timer0 {
status = "okay"; status = "okay";
}; };

View file

@ -33,6 +33,12 @@
#define UART_DEVICE_DEV DT_CHOSEN(zephyr_console) #define UART_DEVICE_DEV DT_CHOSEN(zephyr_console)
#endif #endif
#if DT_NODE_EXISTS(DT_NODELABEL(counter_dev))
#define COUNTER_NODE DT_NODELABEL(counter_dev)
#else
#define COUNTER_NODE DT_NODELABEL(timer0)
#endif
struct rx_source { struct rx_source {
int cnt; int cnt;
uint8_t prev; uint8_t prev;
@ -63,7 +69,7 @@ static struct test_data test_data[3];
static struct test_data int_async_data; static struct test_data int_async_data;
static const struct device *const counter_dev = static const struct device *const counter_dev =
DEVICE_DT_GET(DT_NODELABEL(timer0)); DEVICE_DT_GET(COUNTER_NODE);
static const struct device *const uart_dev = static const struct device *const uart_dev =
DEVICE_DT_GET(UART_DEVICE_DEV); DEVICE_DT_GET(UART_DEVICE_DEV);