summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2017-02-07 16:38:26 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-02-11 13:06:38 -0800
commiteb2e38ec56c5701a1d9bcc3618957b4d4dee50f6 (patch)
treec842f3e693bb70eec8309558034ae6021c97c8b9 /common
parent050ea0226844252d33285461b490372fe8c02f8e (diff)
downloadchrome-ec-eb2e38ec56c5701a1d9bcc3618957b4d4dee50f6.tar.gz
console: Add non-verbose print config option
Shorten certain long prints and reduce the precision of timestamp prints when CONFIG_CONSOLE_VERBOSE is undef'd. BUG=chromium:688743 BRANCH=gru TEST=On kevin, cold reset the EC, boot to OS, and verify cros_ec.log contains all data since sysjump and is < 2K bytes (~1500 bytes). Change-Id: Ia9390867788d0ab3087f827b0296107b4e9d4bca Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/438932 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/build.mk3
-rw-r--r--common/button.c2
-rw-r--r--common/keyboard_mkbp.c2
-rw-r--r--common/motion_sense.c6
-rw-r--r--common/printf.c5
-rw-r--r--common/sensor_common.c25
-rw-r--r--common/vboot_hash.c8
7 files changed, 47 insertions, 4 deletions
diff --git a/common/build.mk b/common/build.mk
index ca2da65de7..a34ef11d3b 100644
--- a/common/build.mk
+++ b/common/build.mk
@@ -111,7 +111,7 @@ common-$(HAS_TASK_HOSTCMD)+=host_command.o
common-$(HAS_TASK_PDCMD)+=host_command_pd.o
common-$(HAS_TASK_KEYSCAN)+=keyboard_scan.o
common-$(HAS_TASK_LIGHTBAR)+=lb_common.o lightbar.o
-common-$(HAS_TASK_MOTIONSENSE)+=motion_sense.o
+common-$(HAS_TASK_MOTIONSENSE)+=motion_sense.o sensor_common.o
common-$(HAS_TASK_TPM)+=tpm_registers.o
ifeq ($(CONFIG_MALLOC),y)
@@ -125,3 +125,4 @@ common-$(TEST_BUILD)+=test_util.o
else
common-y+=test_util.o
endif
+common-$(TEST_BUILD)+=sensor_common.o
diff --git a/common/button.c b/common/button.c
index a9fcca7904..278ac36ffc 100644
--- a/common/button.c
+++ b/common/button.c
@@ -63,7 +63,7 @@ void button_init(void)
{
int i;
- CPRINTS("(re)initializing buttons and interrupts");
+ CPRINTS("init buttons");
next_deferred_time = 0;
for (i = 0; i < CONFIG_BUTTON_COUNT; i++) {
state[i].debounced_pressed = raw_button_pressed(&buttons[i]);
diff --git a/common/keyboard_mkbp.c b/common/keyboard_mkbp.c
index e687bf2966..6839cef707 100644
--- a/common/keyboard_mkbp.c
+++ b/common/keyboard_mkbp.c
@@ -145,7 +145,7 @@ void mkbp_clear_fifo(void)
{
int i;
- CPRINTS("clearing MKBP common fifo");
+ CPRINTS("clear MKBP fifo");
fifo_start = 0;
fifo_end = 0;
diff --git a/common/motion_sense.c b/common/motion_sense.c
index 3411f7c421..442e957540 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -235,9 +235,15 @@ int motion_sense_set_data_rate(struct motion_sensor_t *sensor)
if (ret)
return ret;
+#ifdef CONFIG_CONSOLE_VERBOSE
CPRINTS("%s ODR: %d - roundup %d from config %d [AP %d]",
sensor->name, odr, roundup, config_id,
BASE_ODR(sensor->config[SENSOR_CONFIG_AP].odr));
+#else
+ CPRINTS("%c%d ODR %d rup %d cfg %d AP %d",
+ sensor->name[0], sensor->type, odr, roundup, config_id,
+ BASE_ODR(sensor->config[SENSOR_CONFIG_AP].odr));
+#endif
mutex_lock(&g_sensor_mutex);
if (ap_odr_mhz)
/*
diff --git a/common/printf.c b/common/printf.c
index f22233c855..ef3800c585 100644
--- a/common/printf.c
+++ b/common/printf.c
@@ -193,7 +193,12 @@ int vfnprintf(int (*addchar)(void *context, int c), void *context,
if (c == 'T') {
v = get_time().val;
flags |= PF_64BIT;
+#ifdef CONFIG_CONSOLE_VERBOSE
precision = 6;
+#else
+ precision = 3;
+ v /= 1000;
+#endif
} else if (flags & PF_64BIT) {
v = va_arg(args, uint64_t);
} else {
diff --git a/common/sensor_common.c b/common/sensor_common.c
new file mode 100644
index 0000000000..b80fd69366
--- /dev/null
+++ b/common/sensor_common.c
@@ -0,0 +1,25 @@
+/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Sensor common routines. */
+
+#include "common.h"
+#include "console.h"
+#include "motion_sense.h"
+
+/* Console output macros */
+#define CPUTS(outstr) cputs(CC_MOTION_SENSE, outstr)
+#define CPRINTS(format, args...) cprints(CC_MOTION_SENSE, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_MOTION_SENSE, format, ## args)
+
+void sensor_init_done(const struct motion_sensor_t *s, int range)
+{
+#ifdef CONFIG_CONSOLE_VERBOSE
+ CPRINTS("%s: MS Done Init type:0x%X range:%d",
+ s->name, s->type, range);
+#else
+ CPRINTS("%c%d InitDone r:%d", s->name[0], s->type, range);
+#endif
+}
diff --git a/common/vboot_hash.c b/common/vboot_hash.c
index 136efe942a..0148d88fe7 100644
--- a/common/vboot_hash.c
+++ b/common/vboot_hash.c
@@ -99,6 +99,12 @@ static int read_and_hash_chunk(int offset, int size)
#endif
+#ifdef CONFIG_CONSOLE_VERBOSE
+#define SHA256_PRINT_SIZE SHA256_DIGEST_SIZE
+#else
+#define SHA256_PRINT_SIZE 4
+#endif
+
/**
* Do next chunk of hashing work, if any.
*/
@@ -130,7 +136,7 @@ static void vboot_hash_next_chunk(void)
if (curr_pos >= data_size) {
/* Store the final hash */
hash = SHA256_final(&ctx);
- CPRINTS("hash done %.*h", SHA256_DIGEST_SIZE, hash);
+ CPRINTS("hash done %.*h", SHA256_PRINT_SIZE, hash);
in_progress = 0;