1 /* 2 * Copyright (c) 2018 Makaio GmbH 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef ZEPHYR_INCLUDE_SHELL_RTT_H_ 8 #define ZEPHYR_INCLUDE_SHELL_RTT_H_ 9 10 #include <zephyr/shell/shell.h> 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 extern const struct shell_transport_api shell_rtt_transport_api; 17 18 struct shell_rtt { 19 shell_transport_handler_t handler; 20 struct k_timer timer; 21 void *context; 22 }; 23 24 #define SHELL_RTT_DEFINE(_name) \ 25 static struct shell_rtt _name##_shell_rtt; \ 26 struct shell_transport _name = { \ 27 .api = &shell_rtt_transport_api, \ 28 .ctx = (struct shell_rtt *)&_name##_shell_rtt \ 29 } 30 31 /** 32 * @brief Function provides pointer to shell rtt backend instance. 33 * 34 * Function returns pointer to the shell rtt instance. This instance can be 35 * next used with shell_execute_cmd function in order to test commands behavior. 36 * 37 * @returns Pointer to the shell instance. 38 */ 39 const struct shell *shell_backend_rtt_get_ptr(void); 40 #ifdef __cplusplus 41 } 42 #endif 43 44 #endif /* ZEPHYR_INCLUDE_SHELL_RTT_H_ */ 45