File tree Expand file tree Collapse file tree 4 files changed +45
-0
lines changed
tests/drivers/uart/uart_basic_api Expand file tree Collapse file tree 4 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ CONFIG_USB_DEVICE_STACK=y
2+ CONFIG_USB_DEVICE_PRODUCT="Zephyr CDC ACM UART"
3+ CONFIG_USB_UART_CONSOLE=y
4+ CONFIG_UART_LINE_CTRL=y
5+ CONFIG_TEST_LOGGING_DEFAULTS=n
Original file line number Diff line number Diff line change 1111 * @}
1212 */
1313
14+ #include <usb/usb_device.h>
1415#include "test_uart.h"
1516
1617#ifdef CONFIG_SHELL
@@ -57,6 +58,20 @@ void test_uart_pending(void)
5758
5859void test_main (void )
5960{
61+ #if defined(CONFIG_USB_UART_CONSOLE )
62+ const struct device * dev ;
63+ uint32_t dtr = 0 ;
64+
65+ dev = DEVICE_DT_GET (DT_CHOSEN (zephyr_console ));
66+ if (!device_is_ready (dev ) || usb_enable (NULL )) {
67+ return ;
68+ }
69+
70+ while (!dtr ) {
71+ uart_line_ctrl_get (dev , UART_LINE_CTRL_DTR , & dtr );
72+ k_sleep (K_MSEC (100 ));
73+ }
74+ #endif
6075#ifndef CONFIG_SHELL
6176 ztest_test_suite (uart_basic_test ,
6277 ztest_unit_test (test_uart_configure ),
Original file line number Diff line number Diff line change @@ -18,3 +18,10 @@ tests:
1818 tags : drivers
1919 filter : CONFIG_UART_CONSOLE
2020 harness : keyboard
21+ drivers.uart.cdc_acm :
22+ extra_args : OVERLAY_CONFIG="overlay-usb.conf"
23+ DTC_OVERLAY_FILE="usb.overlay"
24+ tags : drivers usb
25+ filter : CONFIG_UART_CONSOLE
26+ depends_on : usb_device
27+ harness : keyboard
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2021 Nordic Semiconductor ASA
3+ *
4+ * SPDX-License-Identifier: Apache-2.0
5+ */
6+
7+ / {
8+ chosen {
9+ zephyr,console = &cdc_acm_uart0;
10+ };
11+ };
12+
13+ &zephyr_udc0 {
14+ cdc_acm_uart0: cdc_acm_uart0 {
15+ compatible = "zephyr,cdc-acm-uart";
16+ label = "CDC_ACM_0";
17+ };
18+ };
You can’t perform that action at this time.
0 commit comments