summaryrefslogtreecommitdiff
path: root/chip/npcx/system.c
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2016-09-23 10:48:35 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-09-23 21:08:54 -0700
commit0567596eb109ee95ac6564e73c79b4761219785d (patch)
treeedc744ae5163f57abae2632df60d27341e5e4f70 /chip/npcx/system.c
parentf9272713da615e51ea14f70872fec46fbd88e938 (diff)
downloadchrome-ec-0567596eb109ee95ac6564e73c79b4761219785d.tar.gz
system: Add print_system_rtc().
This commit adds a function that allows the real-time clock to be printed on the EC console. This could be helpful in trying to correlate events between the EC's log and the kernel's. BUG=chrome-os-partner:57731 BRANCH=gru TEST=make -j buildall Change-Id: I5e20692a173bddea3dc5c20cc0f2061cc170ce7d Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/388856 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'chip/npcx/system.c')
-rw-r--r--chip/npcx/system.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/chip/npcx/system.c b/chip/npcx/system.c
index d8ff38f0f4..9123d52896 100644
--- a/chip/npcx/system.c
+++ b/chip/npcx/system.c
@@ -742,9 +742,15 @@ int system_is_reboot_warm(void)
/*****************************************************************************/
/* Console commands */
#ifdef CONFIG_CMD_RTC
+void print_system_rtc(enum console_channel ch)
+{
+ uint32_t sec = system_get_rtc_sec();
+
+ cprintf(ch, "RTC: 0x%08x (%d.00 s)\n", sec, sec);
+}
+
static int command_system_rtc(int argc, char **argv)
{
- uint32_t sec;
if (argc == 3 && !strcasecmp(argv[1], "set")) {
char *e;
uint32_t t = strtoi(argv[2], &e, 0);
@@ -756,8 +762,7 @@ static int command_system_rtc(int argc, char **argv)
return EC_ERROR_INVAL;
}
- sec = system_get_rtc_sec();
- ccprintf("RTC: 0x%08x (%d.00 s)\n", sec, sec);
+ print_system_rtc(CC_COMMAND);
return EC_SUCCESS;
}