Skip to content

Commit c12ce7e

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 <dong.d.wang@intel.com>
1 parent 5438459 commit c12ce7e

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2023 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+
#if !defined(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: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,10 @@ 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+
#if !defined(CONFIG_SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN)
61+
62+
static struct shell_uart_polling *sh_uart;
6163

6264
void iut_shell_suspend(void)
6365
{
@@ -71,21 +73,21 @@ void iut_shell_suspend(void)
7173
}
7274

7375
/*get shell uart backend*/
74-
sh_uart = (const struct shell_uart *)shell_ptr->iface->ctx;
76+
sh_uart = (struct shell_uart_polling *)shell_ptr->iface->ctx;
7577

7678
if (sh_uart == NULL) {
7779
iut_print("get shell UART pointer error!!!\n");
7880
return;
7981
}
8082
}
8183

82-
k_timer_stop(sh_uart->timer);
84+
k_timer_stop(&sh_uart->rx_timer);
8385
}
8486

8587
void iut_shell_resume(void)
8688
{
8789
if (sh_uart) {
88-
k_timer_start(sh_uart->timer, K_NO_WAIT,
90+
k_timer_start(&sh_uart->rx_timer, K_NO_WAIT,
8991
K_MSEC(CONFIG_SHELL_BACKEND_SERIAL_RX_POLL_PERIOD));
9092
}
9193
}

0 commit comments

Comments
 (0)