summaryrefslogtreecommitdiff
path: root/chip/lm4/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/lm4/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/lm4/system.c')
-rw-r--r--chip/lm4/system.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/chip/lm4/system.c b/chip/lm4/system.c
index 26cd0f2967..3f39da0a32 100644
--- a/chip/lm4/system.c
+++ b/chip/lm4/system.c
@@ -624,13 +624,19 @@ const char *system_get_chip_revision(void)
/*****************************************************************************/
/* Console commands */
-
#ifdef CONFIG_CMD_RTC
-static int command_system_rtc(int argc, char **argv)
+void print_system_rtc(enum console_channel ch)
{
uint32_t rtc;
uint32_t rtcss;
+ rtc = system_get_rtc_sec_subsec(&rtcss);
+ cprintf(ch, "RTC: 0x%08x.%04x (%d.%06d s)\n",
+ rtc, rtcss, rtc, HIB_RTC_SUBSEC_TO_USEC(rtcss));
+}
+
+static int command_system_rtc(int argc, char **argv)
+{
if (argc == 3 && !strcasecmp(argv[1], "set")) {
char *e;
uint32_t t = strtoi(argv[2], &e, 0);
@@ -642,9 +648,7 @@ static int command_system_rtc(int argc, char **argv)
return EC_ERROR_INVAL;
}
- rtc = system_get_rtc_sec_subsec(&rtcss);
- ccprintf("RTC: 0x%08x.%04x (%d.%06d s)\n",
- rtc, rtcss, rtc, HIB_RTC_SUBSEC_TO_USEC(rtcss));
+ print_system_rtc(CC_COMMAND);
return EC_SUCCESS;
}