From a5a4c561fb9c9c5c9af0013f2c3b8901a176b956 Mon Sep 17 00:00:00 2001 From: zhuyanlin Date: Wed, 20 Apr 2022 12:26:27 +0800 Subject: [PATCH] pmconfig: add mulit domain support pmconfig [domain] pmconfig relax/stay state [domain] Signed-off-by: zhuyanlin --- nshlib/nsh_command.c | 4 ++-- nshlib/nsh_syscmds.c | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/nshlib/nsh_command.c b/nshlib/nsh_command.c index 61fef3d18..99af79b22 100644 --- a/nshlib/nsh_command.c +++ b/nshlib/nsh_command.c @@ -402,8 +402,8 @@ static const struct cmdmap_s g_cmdmap[] = #endif #if defined(CONFIG_PM) && !defined(CONFIG_NSH_DISABLE_PMCONFIG) - { "pmconfig", cmd_pmconfig, 1, 3, - "[stay|relax] [normal|idle|standby|sleep]" }, + { "pmconfig", cmd_pmconfig, 1, 4, + "[stay|relax] [normal|idle|standby|sleep] [domain]" }, #endif #if defined(CONFIG_BOARDCTL_POWEROFF) && !defined(CONFIG_NSH_DISABLE_POWEROFF) diff --git a/nshlib/nsh_syscmds.c b/nshlib/nsh_syscmds.c index dcad16d26..40a449113 100644 --- a/nshlib/nsh_syscmds.c +++ b/nshlib/nsh_syscmds.c @@ -178,7 +178,7 @@ int cmd_pmconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { }; - if (argc == 1) + if (argc <= 2) { int current_state; int normal_count; @@ -186,6 +186,11 @@ int cmd_pmconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) int standby_count; int sleep_count; + if (argc == 2) + { + ctrl.domain = atoi(argv[1]); + } + ctrl.action = BOARDIOC_PM_QUERYSTATE; boardctl(BOARDIOC_PM_CONTROL, (uintptr_t)&ctrl); current_state = ctrl.state; @@ -210,8 +215,13 @@ int cmd_pmconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) nsh_output(vtbl, "Current state %d, PM stay [%d, %d, %d, %d]\n", current_state, normal_count, idle_count, standby_count, sleep_count); } - else if (argc == 3) + else if (argc <= 4) { + if (argc == 4) + { + ctrl.domain = atoi(argv[3]); + } + if (strcmp(argv[1], "stay") == 0) { ctrl.action = BOARDIOC_PM_STAY;