Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions zephyr/iut_test/include/iut_zephyr.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2025 Intel Corporation.
*
* SPDX-License-Identifier: Apache-2.0
*/

/* IUT help functions for Zephyr */

#include <zephyr/kernel.h>

#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_ */
14 changes: 9 additions & 5 deletions zephyr/iut_test/src/shell_iut.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -71,22 +74,23 @@ 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");
return;
}
}

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