summaryrefslogtreecommitdiff
path: root/common/lb_common.c
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2014-05-19 15:03:27 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-05-21 20:32:17 +0000
commitffac23c0ea1bd4ff4568f5bd709a98f912b833a7 (patch)
tree362dd0ba205731aa07be97dd35b44b237799b23b /common/lb_common.c
parent478361de694b1fb45abf3c38dafbbf7fd1aa5f71 (diff)
downloadchrome-ec-ffac23c0ea1bd4ff4568f5bd709a98f912b833a7.tar.gz
Add cprints() and ccprints()
Our code base contains a lot of debug messages in this pattern: CPRINTF("[%T xxx]\n") or ccprintf("[%T xxx]\n") The strings are taking up spaces in the EC binaries, so let's refactor this by adding cprints() and ccprints(). cprints() is just like cprintf(), except that it adds the brackets and the timestamp. ccprints() is equivalent to cprints(CC_CONSOLE, ...) This saves us hundreds of bytes in EC binaries. BUG=chromium:374575 TEST=Build and check flash size BRANCH=None Change-Id: Ifafe8dc1b80e698b28ed42b70518c7917b49ee51 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200490 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common/lb_common.c')
-rw-r--r--common/lb_common.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/common/lb_common.c b/common/lb_common.c
index 1cb49cd096..289421d3bd 100644
--- a/common/lb_common.c
+++ b/common/lb_common.c
@@ -14,7 +14,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_LIGHTBAR, outstr)
-#define CPRINTF(format, args...) cprintf(CC_LIGHTBAR, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_LIGHTBAR, format, ## args)
/******************************************************************************/
/* How to talk to the controller */
@@ -177,7 +177,7 @@ int lb_get_rgb(unsigned int led, uint8_t *red, uint8_t *green, uint8_t *blue)
void lb_set_brightness(unsigned int newval)
{
int i;
- CPRINTF("[%T LB_bright 0x%02x]\n", newval);
+ CPRINTS("LB_bright 0x%02x", newval);
brightness = newval;
for (i = 0; i < NUM_LEDS; i++)
setrgb(i, current[i][0], current[i][1], current[i][2]);
@@ -192,7 +192,7 @@ uint8_t lb_get_brightness(void)
/* Initialize the controller ICs after reset */
void lb_init(void)
{
- CPRINTF("[%T LB_init_vals]\n");
+ CPRINTS("LB_init_vals");
set_from_array(init_vals, ARRAY_SIZE(init_vals));
memset(current, 0, sizeof(current));
}
@@ -200,7 +200,7 @@ void lb_init(void)
/* Just go into standby mode. No register values should change. */
void lb_off(void)
{
- CPRINTF("[%T LB_off]\n");
+ CPRINTS("LB_off");
controller_write(0, 0x01, 0x00);
controller_write(1, 0x01, 0x00);
}
@@ -208,7 +208,7 @@ void lb_off(void)
/* Come out of standby mode. */
void lb_on(void)
{
- CPRINTF("[%T LB_on]\n");
+ CPRINTS("LB_on");
controller_write(0, 0x01, 0x20);
controller_write(1, 0x01, 0x20);
}