tests: uart: remove CONFIG_UART_CONSOLE_ON_DEV_NAME usage

Use DT_CHOSEN(zephyr_console) instead of
CONFIG_UART_CONSOLE_ON_DEV_NAME Kconfig option.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This commit is contained in:
Johann Fischer 2021-07-22 15:45:38 +02:00 committed by Christopher Friedt
commit d6ca3fd4da
7 changed files with 32 additions and 19 deletions

View file

@ -44,7 +44,7 @@
#elif defined(CONFIG_BOARD_NUCLEO_H723ZG)
#define UART_DEVICE_NAME DT_LABEL(DT_NODELABEL(usart2))
#else
#define UART_DEVICE_NAME CONFIG_UART_CONSOLE_ON_DEV_NAME
#define UART_DEVICE_NAME DT_LABEL(DT_CHOSEN(zephyr_console))
#endif
void init_test(void);

View file

@ -18,8 +18,6 @@
#include <drivers/uart.h>
#include <ztest.h>
#define UART_DEVICE_NAME CONFIG_UART_CONSOLE_ON_DEV_NAME
void test_uart_configure(void);
void test_uart_config_get(void);
void test_uart_poll_out(void);

View file

@ -36,10 +36,10 @@ const struct uart_config uart_cfg = {
static int test_configure(void)
{
const struct device *uart_dev = device_get_binding(UART_DEVICE_NAME);
const struct device *uart_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
if (!uart_dev) {
TC_PRINT("Cannot get UART device\n");
if (!device_is_ready(uart_dev)) {
TC_PRINT("UART device not ready\n");
return TC_FAIL;
}
@ -58,10 +58,10 @@ static int test_configure(void)
/* test UART configure get (retrieve configuration) */
static int test_config_get(void)
{
const struct device *uart_dev = device_get_binding(UART_DEVICE_NAME);
const struct device *uart_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
if (!uart_dev) {
TC_PRINT("Cannot get UART device\n");
if (!device_is_ready(uart_dev)) {
TC_PRINT("UART device not ready\n");
return TC_FAIL;
}

View file

@ -92,7 +92,12 @@ static void uart_fifo_callback(const struct device *dev, void *user_data)
static int test_fifo_read(void)
{
const struct device *uart_dev = device_get_binding(UART_DEVICE_NAME);
const struct device *uart_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
if (!device_is_ready(uart_dev)) {
TC_PRINT("UART device not ready\n");
return TC_FAIL;
}
/* Verify uart_irq_callback_set() */
uart_irq_callback_set(uart_dev, uart_fifo_callback);
@ -115,7 +120,12 @@ static int test_fifo_read(void)
static int test_fifo_fill(void)
{
const struct device *uart_dev = device_get_binding(UART_DEVICE_NAME);
const struct device *uart_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
if (!device_is_ready(uart_dev)) {
TC_PRINT("UART device not ready\n");
return TC_FAIL;
}
char_sent = 0;

View file

@ -93,7 +93,12 @@ static void uart_pending_callback(const struct device *dev, void *user_data)
static int test_pending(void)
{
const struct device *uart_dev = device_get_binding(UART_DEVICE_NAME);
const struct device *uart_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
if (!device_is_ready(uart_dev)) {
TC_PRINT("UART device not ready\n");
return TC_FAIL;
}
/*
* Set IRQ callback function to handle RX IRQ.

View file

@ -11,10 +11,10 @@ static const char *poll_data = "This is a POLL test.\r\n";
static int test_poll_in(void)
{
unsigned char recv_char;
const struct device *uart_dev = device_get_binding(UART_DEVICE_NAME);
const struct device *uart_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
if (!uart_dev) {
TC_PRINT("Cannot get UART device\n");
if (!device_is_ready(uart_dev)) {
TC_PRINT("UART device not ready\n");
return TC_FAIL;
}
@ -38,10 +38,10 @@ static int test_poll_in(void)
static int test_poll_out(void)
{
int i;
const struct device *uart_dev = device_get_binding(UART_DEVICE_NAME);
const struct device *uart_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
if (!uart_dev) {
TC_PRINT("Cannot get UART device\n");
if (!device_is_ready(uart_dev)) {
TC_PRINT("UART device not ready\n");
return TC_FAIL;
}

View file

@ -28,7 +28,7 @@
#elif defined(CONFIG_BOARD_ATSAME54_XPRO)
#define UART_DEVICE_NAME DT_LABEL(DT_NODELABEL(sercom1))
#else
#define UART_DEVICE_NAME CONFIG_UART_CONSOLE_ON_DEV_NAME
#define UART_DEVICE_NAME DT_LABEL(DT_CHOSEN(zephyr_console))
#endif
struct rx_source {