File tree Expand file tree Collapse file tree 8 files changed +410
-0
lines changed
tests/drivers/uart/uart_async_api Expand file tree Collapse file tree 8 files changed +410
-0
lines changed Original file line number Diff line number Diff line change 1+ cmake_minimum_required (VERSION 3.8.2)
2+
3+ macro (set_conf_file)
4+ if (EXISTS ${APPLICATION_SOURCE_DIR} /boards/${BOARD} .conf)
5+ set (CONF_FILE "prj.conf ${APPLICATION_SOURCE_DIR} /boards/${BOARD} .conf" )
6+ else ()
7+ set (CONF_FILE "prj.conf" )
8+ endif ()
9+ endmacro ()
10+
11+ include ($ENV{ZEPHYR_BASE} /cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
12+ project (uart_high_level_api)
13+
14+ target_sources (app PRIVATE
15+ src/main.c
16+ src/test_uart_async.c
17+ )
Original file line number Diff line number Diff line change 1+ CONFIG_UART_1_NRF_UARTE=y
Original file line number Diff line number Diff line change 1+ / {
2+ chosen {
3+ zephyr,console = &uart1;
4+ };
5+ };
6+
7+ &uart1 {
8+ current-speed = <115200>;
9+ status = "ok";
10+ tx-pin = <6>;
11+ rx-pin = <8>;
12+ rts-pin = <0>;
13+ cts-pin = <0>;
14+ };
15+
16+ &uart0 {
17+ compatible = "nordic,nrf-uart";
18+ current-speed = <115200>;
19+ status = "ok";
20+ tx-pin = <33>;
21+ rx-pin = <34>;
22+ rts-pin = <5>;
23+ cts-pin = <7>;
24+ };
Original file line number Diff line number Diff line change 1+ CONFIG_SERIAL=y
2+ CONFIG_UART_ASYNC_API=y
3+ CONFIG_ZTEST=y
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2019 Nordic Semiconductor ASA
3+ *
4+ * SPDX-License-Identifier: Apache-2.0
5+ */
6+
7+ /**
8+ * @addtogroup t_driver_uart
9+ * @{
10+ * @defgroup t_uart_async test_uart_async
11+ * @}
12+ */
13+
14+ #include "test_uart.h"
15+
16+ void test_main (void )
17+ {
18+ ztest_test_suite (uart_async_test ,
19+ ztest_unit_test (test_single_read ),
20+ ztest_unit_test (test_chained_read ),
21+ ztest_unit_test (test_double_buffer ),
22+ ztest_unit_test (test_read_abort ),
23+ ztest_unit_test (test_write_abort ));
24+
25+ ztest_run_test_suite (uart_async_test );
26+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2019 Nordic Semiconductor ASA
3+ *
4+ * SPDX-License-Identifier: Apache-2.0
5+ */
6+
7+ /**
8+ * @file
9+ * @brief UART cases header file
10+ *
11+ * Header file for UART cases
12+ */
13+
14+ #ifndef __TEST_UART_H__
15+ #define __TEST_UART_H__
16+
17+ #include <uart.h>
18+ #include <ztest.h>
19+
20+ /* RX and TX pins have to be connected together*/
21+
22+ #if defined(CONFIG_BOARD_NRF52840_PCA10056 )
23+ #define UART_DEVICE_NAME DT_UART_0_NAME
24+ #else
25+ #define UART_DEVICE_NAME CONFIG_UART_CONSOLE_ON_DEV_NAME
26+ #endif
27+
28+ void test_single_read (void );
29+ void test_chained_read (void );
30+ void test_double_buffer (void );
31+ void test_read_abort (void );
32+ void test_write_abort (void );
33+
34+ #endif /* __TEST_UART_H__ */
You can’t perform that action at this time.
0 commit comments