Skip to content

iut: Make shell suspend/resume work with latest Zephyr #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
15 changes: 10 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,13 @@ 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;
#ifdef CONFIG_SHELL

#if defined(CONFIG_SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN)
BUILD_ASSERT(0, "CONFIG_SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN must be disabled");
#endif

static struct shell_uart_polling *sh_uart;

void iut_shell_suspend(void)
{
Expand All @@ -71,21 +76,21 @@ 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));
}
}
Expand Down
2 changes: 2 additions & 0 deletions zephyr/iut_test/test_zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# SPDX-License-Identifier: Apache-2.0
#

target_include_directories(app PRIVATE ./include)

if(CONFIG_DMA_SEDI)
target_sources(app PRIVATE dma/test_dma_m2m.c)
endif()
Expand Down
36 changes: 36 additions & 0 deletions zephyr/iut_test/test_zephyr/include/iut_zephyr.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (c) 2025 Intel Corporation. All Rights Reserved.
*
* This software and the related documents are Intel copyrighted materials,
* and your use of them is governed by the express license under which they
* were provided to you ("License"). Unless the License provides otherwise,
* you may not use, modify, copy, publish, distribute, disclose or transmit
* this software or the related documents without Intel's prior written
* permission.
*
* This software and the related documents are provided as is, with no express
* or implied warranties, other than those that are expressly stated in the
* License.
*/

/* IUT help functions for Zephyr */

#include <zephyr/kernel.h>

#ifndef _IUT_ZEPHYR_H_
#define _IUT_ZEPHYR_H_

#ifdef CONFIG_SHELL
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_ */