mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-09 17:11:42 +00:00
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>
This commit is contained in:
committed by
chrome-bot
parent
050ea02268
commit
eb2e38ec56
@@ -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
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
/*
|
||||
|
||||
@@ -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 {
|
||||
|
||||
25
common/sensor_common.c
Normal file
25
common/sensor_common.c
Normal file
@@ -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
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -319,8 +319,7 @@ static int init(const struct motion_sensor_t *s)
|
||||
if (ret != EC_SUCCESS)
|
||||
return ret;
|
||||
|
||||
CPRINTF("[%T %s: Done Init type:0x%X range:%d]\n",
|
||||
s->name, s->type, get_range(s));
|
||||
sensor_init_done(s, get_range(s));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -531,8 +531,7 @@ static int init(const struct motion_sensor_t *s)
|
||||
if (ret != EC_SUCCESS)
|
||||
return ret;
|
||||
|
||||
CPRINTF("[%T %s: Done Init type:0x%X range:%d]\n",
|
||||
s->name, s->type, get_range(s));
|
||||
sensor_init_done(s, get_range(s));
|
||||
|
||||
mutex_unlock(s->mutex);
|
||||
return ret;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2016 The Chromium OS Authors. All rights reserved.
|
||||
/* Copyright 2016 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.
|
||||
*/
|
||||
@@ -381,8 +381,7 @@ static int init(const struct motion_sensor_t *s)
|
||||
ret = config_interrupt(s);
|
||||
#endif
|
||||
|
||||
CPRINTF("[%T %s: MS Done Init type:0x%X range:%d]\n",
|
||||
s->name, s->type, get_range(s));
|
||||
sensor_init_done(s, get_range(s));
|
||||
return ret;
|
||||
|
||||
err_unlock:
|
||||
|
||||
@@ -1227,8 +1227,8 @@ static int init(const struct motion_sensor_t *s)
|
||||
ret = config_interrupt(s);
|
||||
#endif
|
||||
}
|
||||
CPRINTF("[%T %s: MS Done Init type:0x%X range:%d]\n",
|
||||
s->name, s->type, get_range(s));
|
||||
|
||||
sensor_init_done(s, get_range(s));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -431,8 +431,7 @@ static int init(const struct motion_sensor_t *s)
|
||||
return EC_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
CPRINTF("[%T %s: MS Done Init type:0x%X range:%d]\n",
|
||||
s->name, s->type, get_range(s));
|
||||
sensor_init_done(s, get_range(s));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -327,8 +327,7 @@ static int init(const struct motion_sensor_t *s)
|
||||
|
||||
ret = set_range(s, s->default_range, 1);
|
||||
|
||||
CPRINTF("[%T %s: MS Done Init type:0x%X range:%d]\n",
|
||||
s->name, s->type, get_range(s));
|
||||
sensor_init_done(s, get_range(s));
|
||||
return ret;
|
||||
|
||||
err_unlock:
|
||||
|
||||
@@ -550,8 +550,8 @@ static int init(const struct motion_sensor_t *s)
|
||||
*/
|
||||
set_resolution(s, resol, 0);
|
||||
|
||||
CPRINTF("[%T %s: MS Done Init type:0x%X range:%d]\n",
|
||||
s->name, s->type, get_range(s));
|
||||
sensor_init_done(s, get_range(s));
|
||||
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -406,8 +406,7 @@ static int init(const struct motion_sensor_t *s)
|
||||
if (ret)
|
||||
return EC_ERROR_UNKNOWN;
|
||||
|
||||
CPRINTF("[%T %s: MS Done Init type:0x%X range:%d]\n",
|
||||
s->name, s->type, get_range(s));
|
||||
sensor_init_done(s, get_range(s));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -766,6 +766,9 @@
|
||||
/* Max length of a single line of input */
|
||||
#define CONFIG_CONSOLE_INPUT_LINE_SIZE 80
|
||||
|
||||
/* Enable verbose output to UART console and extra timestamp print precision. */
|
||||
#define CONFIG_CONSOLE_VERBOSE
|
||||
|
||||
/*
|
||||
* Enable the experimental console.
|
||||
*
|
||||
|
||||
@@ -172,6 +172,15 @@ void motion_sense_fifo_add_unit(struct ec_response_motion_sensor_data *data,
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Take actions at end of sensor initialization (currently only printing
|
||||
* init done status to console).
|
||||
*
|
||||
* @param sensor sensor which was just initialized
|
||||
* @param range range of sensor
|
||||
*/
|
||||
void sensor_init_done(const struct motion_sensor_t *sensor, int range);
|
||||
|
||||
#ifdef CONFIG_GESTURE_HOST_DETECTION
|
||||
/* Add an extra sensor. We may need to add more */
|
||||
#define MOTION_SENSE_ACTIVITY_SENSOR_ID (motion_sensor_count)
|
||||
|
||||
Reference in New Issue
Block a user