summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Yung-Chieh Lo <yjlou@chromium.org>2014-05-19 12:28:39 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-05-20 07:34:10 +0000
commitb287e7b3441227e384c7a9fd4e438480a515541b (patch)
treee4134aece9b8c188fb0d40838dca6f62a1ac934f
parent8b428e293620f47bdeb4ca1315b096b241b7b729 (diff)
downloadchrome-ec-b287e7b3441227e384c7a9fd4e438480a515541b.tar.gz
reduced the charge v2 debug message size
Remove redudant struct names. Replace 2 spaces with a tab char. This reduces 128 bytes in flash size. BUG=chromium:374575 BRANCH=tot,nyan TEST=Built and verified on big % grep hey build/big/ec.RO.map 0x000000000000ef48 After shrink: 0x000000000000eec8 The output still is easy to read. > chg state = charge ac = 1 chg.*: voltage = 13040mV current = 256mA input_current = 2048mA status = 0x10 option = 0xf912 flags = 0x0 batt.*: temperature = 20C state_of_charge = 0% voltage = 8253mV current = 274mA desired_voltage = 13050mV desired_current = 256mA flags = 0x3 remaining_capacity = 0mAh full_capacity = 4026mAh is_present = YES requested_voltage = 13040mV requested_current = 256mA force_idle = 0 manual_mode = 0 user_current_limit = -1mA battery_seems_to_be_dead = 0 debug output = off Change-Id: I82a3a5cda3fa96e247355dc90431691015eece6c Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200470 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r--common/charge_state_v2.c50
1 files changed, 27 insertions, 23 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index 3109f23363..57a05af672 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -220,33 +220,37 @@ static const char * const batt_pres[] = {
static void dump_charge_state(void)
{
-#define DUMP(FLD, FMT) ccprintf(" " #FLD " = " FMT "\n", curr.FLD)
- ccprintf(" state = %s\n", state_list[curr.state]);
+#define DUMP(FLD, FMT) ccprintf(#FLD " = " FMT "\n", curr.FLD)
+#define DUMP_CHG(FLD, FMT) ccprintf("\t" #FLD " = " FMT "\n", curr.chg. FLD)
+#define DUMP_BATT(FLD, FMT) ccprintf("\t" #FLD " = " FMT "\n", curr.batt. FLD)
+ ccprintf("state = %s\n", state_list[curr.state]);
DUMP(ac, "%d");
- DUMP(chg.voltage, "%dmV");
- DUMP(chg.current, "%dmA");
- DUMP(chg.input_current, "%dmA");
- DUMP(chg.status, "0x%x");
- DUMP(chg.option, "0x%x");
- DUMP(chg.flags, "0x%x");
- ccprintf(" batt.temperature = %dC\n",
+ ccprintf("chg.*:\n");
+ DUMP_CHG(voltage, "%dmV");
+ DUMP_CHG(current, "%dmA");
+ DUMP_CHG(input_current, "%dmA");
+ DUMP_CHG(status, "0x%x");
+ DUMP_CHG(option, "0x%x");
+ DUMP_CHG(flags, "0x%x");
+ ccprintf("batt.*:\n");
+ ccprintf("\ttemperature = %dC\n",
DECI_KELVIN_TO_CELSIUS(curr.batt.temperature));
- DUMP(batt.state_of_charge, "%d%%");
- DUMP(batt.voltage, "%dmV");
- DUMP(batt.current, "%dmA");
- DUMP(batt.desired_voltage, "%dmV");
- DUMP(batt.desired_current, "%dmA");
- DUMP(batt.flags, "0x%x");
- DUMP(batt.remaining_capacity, "%dmAh");
- DUMP(batt.full_capacity, "%dmAh");
- ccprintf(" batt.is_present = %s\n", batt_pres[curr.batt.is_present]);
+ DUMP_BATT(state_of_charge, "%d%%");
+ DUMP_BATT(voltage, "%dmV");
+ DUMP_BATT(current, "%dmA");
+ DUMP_BATT(desired_voltage, "%dmV");
+ DUMP_BATT(desired_current, "%dmA");
+ DUMP_BATT(flags, "0x%x");
+ DUMP_BATT(remaining_capacity, "%dmAh");
+ DUMP_BATT(full_capacity, "%dmAh");
+ ccprintf("\tis_present = %s\n", batt_pres[curr.batt.is_present]);
DUMP(requested_voltage, "%dmV");
DUMP(requested_current, "%dmA");
- ccprintf(" force_idle = %d\n", state_machine_force_idle);
- ccprintf(" manual_mode = %d\n", manual_mode);
- ccprintf(" user_current_limit = %dmA\n", user_current_limit);
- ccprintf(" battery_seems_to_be_dead = %d\n", battery_seems_to_be_dead);
- ccprintf(" debug output = %s\n", debugging ? "on" : "off");
+ ccprintf("force_idle = %d\n", state_machine_force_idle);
+ ccprintf("manual_mode = %d\n", manual_mode);
+ ccprintf("user_current_limit = %dmA\n", user_current_limit);
+ ccprintf("battery_seems_to_be_dead = %d\n", battery_seems_to_be_dead);
+ ccprintf("debug output = %s\n", debugging ? "on" : "off");
#undef DUMP
}