diff --git a/zephyr/iut_test/include/iut_zephyr.h b/zephyr/iut_test/include/iut_zephyr.h new file mode 100644 index 0000000..5b35e2b --- /dev/null +++ b/zephyr/iut_test/include/iut_zephyr.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2025 Intel Corporation. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* IUT help functions for Zephyr */ + +#include + +#ifndef _IUT_ZEPHYR_H_ +#define _IUT_ZEPHYR_H_ + +#ifndef CONFIG_SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN +void iut_shell_suspend(void); +void iut_shell_resume(void); +#else +static inline void iut_shell_suspend(void) +{ +} + +static inline void iut_shell_resume(void) +{ +} +#endif + +#endif /* _IUT_ZEPHYR_H_ */ diff --git a/zephyr/iut_test/src/shell_iut.c b/zephyr/iut_test/src/shell_iut.c index 55a0bc8..6ceec82 100644 --- a/zephyr/iut_test/src/shell_iut.c +++ b/zephyr/iut_test/src/shell_iut.c @@ -56,8 +56,11 @@ SHELL_STATIC_SUBCMD_SET_CREATE(sub_iut, SHELL_CMD_REGISTER(iut, &sub_iut, "IUT commands", NULL); -#ifdef _CONFIG_PM -static const struct shell_uart *sh_uart; + +#ifndef CONFIG_SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN +/* The following code could only work when the shell backend is not interrupt-driven. */ + +static struct shell_uart_polling *sh_uart; void iut_shell_suspend(void) { @@ -71,7 +74,7 @@ void iut_shell_suspend(void) } /*get shell uart backend*/ - sh_uart = (const struct shell_uart *)shell_ptr->iface->ctx; + sh_uart = (struct shell_uart_polling *)shell_ptr->iface->ctx; if (sh_uart == NULL) { iut_print("get shell UART pointer error!!!\n"); @@ -79,14 +82,15 @@ void iut_shell_suspend(void) } } - k_timer_stop(sh_uart->timer); + k_timer_stop(&sh_uart->rx_timer); } void iut_shell_resume(void) { if (sh_uart) { - k_timer_start(sh_uart->timer, K_NO_WAIT, + k_timer_start(&sh_uart->rx_timer, K_NO_WAIT, K_MSEC(CONFIG_SHELL_BACKEND_SERIAL_RX_POLL_PERIOD)); } } + #endif