Skip to content

Commit 1f3ef8b

Browse files
committed
iut: Make shell suspend/resume work with Zephyr 4.2
They're previously developed against zephyr 3.7 and out of date. Expose them in header file iut_zephyr.h. They'll be used in incoming pm tests. Signed-off-by: Dong Wang <[email protected]>
1 parent 5438459 commit 1f3ef8b

File tree

2 files changed

+36
-5
lines changed

2 files changed

+36
-5
lines changed

zephyr/iut_test/include/iut_zephyr.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2025 Intel Corporation.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/* IUT help functions for Zephyr */
8+
9+
#include <zephyr/kernel.h>
10+
11+
#ifndef _IUT_ZEPHYR_H_
12+
#define _IUT_ZEPHYR_H_
13+
14+
#ifndef CONFIG_SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN
15+
void iut_shell_suspend(void);
16+
void iut_shell_resume(void);
17+
#else
18+
static inline void iut_shell_suspend(void)
19+
{
20+
}
21+
22+
static inline void iut_shell_resume(void)
23+
{
24+
}
25+
#endif
26+
27+
#endif /* _IUT_ZEPHYR_H_ */

zephyr/iut_test/src/shell_iut.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,11 @@ SHELL_STATIC_SUBCMD_SET_CREATE(sub_iut,
5656

5757
SHELL_CMD_REGISTER(iut, &sub_iut, "IUT commands", NULL);
5858

59-
#ifdef _CONFIG_PM
60-
static const struct shell_uart *sh_uart;
59+
60+
#ifndef CONFIG_SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN
61+
/* The following code could only work when the shell backend is not interrupt-driven. */
62+
63+
static struct shell_uart_polling *sh_uart;
6164

6265
void iut_shell_suspend(void)
6366
{
@@ -71,22 +74,23 @@ void iut_shell_suspend(void)
7174
}
7275

7376
/*get shell uart backend*/
74-
sh_uart = (const struct shell_uart *)shell_ptr->iface->ctx;
77+
sh_uart = (struct shell_uart_polling *)shell_ptr->iface->ctx;
7578

7679
if (sh_uart == NULL) {
7780
iut_print("get shell UART pointer error!!!\n");
7881
return;
7982
}
8083
}
8184

82-
k_timer_stop(sh_uart->timer);
85+
k_timer_stop(&sh_uart->rx_timer);
8386
}
8487

8588
void iut_shell_resume(void)
8689
{
8790
if (sh_uart) {
88-
k_timer_start(sh_uart->timer, K_NO_WAIT,
91+
k_timer_start(&sh_uart->rx_timer, K_NO_WAIT,
8992
K_MSEC(CONFIG_SHELL_BACKEND_SERIAL_RX_POLL_PERIOD));
9093
}
9194
}
95+
9296
#endif

0 commit comments

Comments
 (0)