diff --git a/subsys/sip_svc/sip_svc_agilex_mailbox_shell.c b/subsys/sip_svc/sip_svc_agilex_mailbox_shell.c index ea6e237e777..7657b3b8d09 100644 --- a/subsys/sip_svc/sip_svc_agilex_mailbox_shell.c +++ b/subsys/sip_svc/sip_svc_agilex_mailbox_shell.c @@ -15,7 +15,7 @@ #include #include -#define MAX_TIMEOUT_SECS (10 * 60UL) +#define MAX_TIMEOUT_MSECS (1 * 1000UL) struct private_data { struct k_sem semaphore; @@ -76,10 +76,10 @@ static int cmd_unreg(const struct shell *sh, size_t argc, char **argv) static int cmd_open(const struct shell *sh, size_t argc, char **argv) { - unsigned long seconds = 0; + unsigned long mseconds = 0; int err; char *endptr; - k_timeout_t timeout = K_FOREVER; + k_timeout_t timeout = K_MSEC(MAX_TIMEOUT_MSECS); if (!mb_smc_ctrl) { shell_print(sh, "Mailbox client is not registered"); @@ -88,18 +88,18 @@ static int cmd_open(const struct shell *sh, size_t argc, char **argv) if (argc > 1) { errno = 0; - seconds = strtoul(argv[1], &endptr, 10); + mseconds = strtoul(argv[1], &endptr, 10); if (errno == ERANGE) { shell_error(sh, "out of range value"); return -ERANGE; } else if (errno || endptr == argv[1] || *endptr) { return -errno; - } else if (seconds <= MAX_TIMEOUT_SECS) { - timeout = K_SECONDS(seconds); + } else if (mseconds <= MAX_TIMEOUT_MSECS) { + timeout = K_MSEC(mseconds); } else { - timeout = K_SECONDS(MAX_TIMEOUT_SECS); - shell_error(sh, "Setting timeout value to %lu seconds", - MAX_TIMEOUT_SECS); + timeout = K_MSEC(MAX_TIMEOUT_MSECS); + shell_error(sh, "Setting timeout value to %lu milliseconds", + MAX_TIMEOUT_MSECS); } } @@ -281,11 +281,11 @@ static int cmd_send(const struct shell *sh, size_t argc, char **argv) } else if (errno || endptr == argv[2] || *endptr) { shell_error(sh, "Invalid argument"); return -EINVAL; - } else if (msecond <= (MSEC_PER_SEC * MAX_TIMEOUT_SECS)) { + } else if (msecond <= (MSEC_PER_SEC * MAX_TIMEOUT_MSECS)) { timeout = K_MSEC(msecond); } else { - timeout = K_SECONDS(MAX_TIMEOUT_SECS); - shell_error(sh, "Setting timeout value to %lu seconds", MAX_TIMEOUT_SECS); + timeout = K_SECONDS(MAX_TIMEOUT_MSECS); + shell_error(sh, "Setting timeout value to %lu seconds", MAX_TIMEOUT_MSECS); } } @@ -337,7 +337,7 @@ static int cmd_send(const struct shell *sh, size_t argc, char **argv) SHELL_STATIC_SUBCMD_SET_CREATE( sub_mailbox, SHELL_CMD_ARG(reg, NULL, "", cmd_reg, 2, 0), SHELL_CMD_ARG(unreg, NULL, NULL, cmd_unreg, 1, 0), - SHELL_CMD_ARG(open, NULL, "[]", cmd_open, 1, 1), + SHELL_CMD_ARG(open, NULL, "[]", cmd_open, 1, 1), SHELL_CMD_ARG(close, NULL, NULL, cmd_close, 1, 0), SHELL_CMD_ARG(send, NULL, " []", diff --git a/subsys/sip_svc/sip_svc_shell.c b/subsys/sip_svc/sip_svc_shell.c index a291ad54558..c0d64495206 100644 --- a/subsys/sip_svc/sip_svc_shell.c +++ b/subsys/sip_svc/sip_svc_shell.c @@ -12,7 +12,7 @@ #include #include -#define MAX_TIMEOUT_SECS (10 * 60UL) +#define MAX_TIMEOUT_MSECS (1 * 1000UL) struct private_data { struct k_sem semaphore; @@ -98,10 +98,10 @@ static int cmd_open(const struct shell *sh, size_t argc, char **argv) { struct sip_svc_controller *ctrl; uint32_t c_token; - unsigned long seconds = 0; + unsigned long mseconds = 0; int err; char *endptr; - k_timeout_t timeout = K_FOREVER; + k_timeout_t timeout = K_MSEC(MAX_TIMEOUT_MSECS); err = parse_common_args(sh, argv, (void **)&ctrl); if (err < 0) { @@ -120,18 +120,19 @@ static int cmd_open(const struct shell *sh, size_t argc, char **argv) if (argc > 3) { errno = 0; - seconds = strtoul(argv[3], &endptr, 10); + mseconds = strtoul(argv[3], &endptr, 10); if (errno == ERANGE) { shell_error(sh, "Out of range value"); return -ERANGE; } else if (errno || endptr == argv[3] || *endptr) { shell_error(sh, "Invalid Argument"); return -EINVAL; - } else if (seconds <= MAX_TIMEOUT_SECS) { - timeout = K_SECONDS(seconds); + } else if (mseconds <= MAX_TIMEOUT_MSECS) { + timeout = K_MSEC(mseconds); } else { - timeout = K_SECONDS(MAX_TIMEOUT_SECS); - shell_error(sh, "Setting timeout value to %lu", MAX_TIMEOUT_SECS); + timeout = K_MSEC(MAX_TIMEOUT_MSECS); + shell_error(sh, "Setting timeout value to %lu milliseconds", + MAX_TIMEOUT_MSECS); } } @@ -376,7 +377,7 @@ static int cmd_info(const struct shell *sh, size_t argc, char **argv) SHELL_STATIC_SUBCMD_SET_CREATE( sub_sip_svc, SHELL_CMD_ARG(reg, NULL, "", cmd_reg, 2, 0), SHELL_CMD_ARG(unreg, NULL, " ", cmd_unreg, 3, 0), - SHELL_CMD_ARG(open, NULL, " <[timeout_sec]>", cmd_open, 3, 1), + SHELL_CMD_ARG(open, NULL, " <[timeout_msec]>", cmd_open, 3, 1), SHELL_CMD_ARG(close, NULL, " ", cmd_close, 3, 0), SHELL_CMD_ARG(send, NULL, " [ ... ]", cmd_send, 4, 7), SHELL_CMD_ARG(info, NULL, "", cmd_info, 2, 0), SHELL_SUBCMD_SET_END);