summaryrefslogtreecommitdiff
path: root/chip/lm4
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 /chip/lm4
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 'chip/lm4')
-rw-r--r--chip/lm4/clock.c10
-rw-r--r--chip/lm4/i2c.c6
-rw-r--r--chip/lm4/lpc.c8
-rw-r--r--chip/lm4/spi.c2
4 files changed, 13 insertions, 13 deletions
diff --git a/chip/lm4/clock.c b/chip/lm4/clock.c
index 04b86fae92..05027e0d95 100644
--- a/chip/lm4/clock.c
+++ b/chip/lm4/clock.c
@@ -22,7 +22,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_CLOCK, outstr)
-#define CPRINTF(format, args...) cprintf(CC_CLOCK, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CLOCK, format, ## args)
#define PLL_CLOCK 66666667 /* System clock = 200MHz PLL/3 = 66.667MHz */
@@ -250,7 +250,7 @@ void __idle(void)
* so this only starts once all other tasks have gotten a chance to do
* their task inits and have gone to sleep.
*/
- CPRINTF("[%T low power idle task started]\n");
+ CPRINTS("low power idle task started");
while (1) {
/*
@@ -286,8 +286,8 @@ void __idle(void)
clock_wait_cycles(1);
if (LOW_SPEED_DEEP_SLEEP_ALLOWED)
- CPRINTF("[%T Disabling console in "
- "deep sleep]\n");
+ CPRINTS("Disabling console in "
+ "deep sleep");
}
/*
@@ -361,7 +361,7 @@ void __idle(void)
/* Calculate how close we were to missing deadline */
margin_us = next_delay - (int)(rtc_t1.val - rtc_t0.val);
if (margin_us < 0)
- CPRINTF("[%T overslept by %dus]\n", -margin_us);
+ CPRINTS("overslept by %dus", -margin_us);
/* Record the closest to missing a deadline. */
if (margin_us < dsleep_recovery_margin_us)
diff --git a/chip/lm4/i2c.c b/chip/lm4/i2c.c
index 57359646dc..457236cc93 100644
--- a/chip/lm4/i2c.c
+++ b/chip/lm4/i2c.c
@@ -17,7 +17,7 @@
#include "util.h"
#define CPUTS(outstr) cputs(CC_I2C, outstr)
-#define CPRINTF(format, args...) cprintf(CC_I2C, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_I2C, format, ## args)
/* Flags for writes to MCS */
#define LM4_I2C_MCS_RUN (1 << 0)
@@ -186,7 +186,7 @@ int i2c_xfer(int port, int slave_addr, const uint8_t *out, int out_size,
(i2c_get_line_levels(port) != I2C_LINE_IDLE))) {
uint32_t tpr = LM4_I2C_MTPR(port);
- CPRINTF("[%T I2C%d bad status 0x%02x, SCL=%d, SDA=%d]\n", port,
+ CPRINTS("I2C%d bad status 0x%02x, SCL=%d, SDA=%d", port,
reg_mcs,
i2c_get_line_levels(port) & I2C_LINE_SCL_HIGH,
i2c_get_line_levels(port) & I2C_LINE_SDA_HIGH);
@@ -352,7 +352,7 @@ static void i2c_freq_changed(void)
#ifdef PRINT_I2C_SPEEDS
const int f = freq / (2 * (1 + tpr) * (6 + 4));
- CPRINTF("[%T I2C%d clk=%d tpr=%d freq=%d]\n",
+ CPRINTS("I2C%d clk=%d tpr=%d freq=%d",
i2c_ports[i].port, freq, tpr, f);
#endif
diff --git a/chip/lm4/lpc.c b/chip/lm4/lpc.c
index ef273be8b8..8f8c5434a4 100644
--- a/chip/lm4/lpc.c
+++ b/chip/lm4/lpc.c
@@ -52,7 +52,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_LPC, outstr)
-#define CPRINTF(format, args...) cprintf(CC_LPC, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_LPC, format, ## args)
#define LPC_SYSJUMP_TAG 0x4c50 /* "LP" */
@@ -158,7 +158,7 @@ static void lpc_generate_smi(void)
gpio_set_level(GPIO_PCH_SMI_L, 1);
if (host_events & event_mask[LPC_HOST_EVENT_SMI])
- CPRINTF("[%T smi 0x%08x]\n",
+ CPRINTS("smi 0x%08x",
host_events & event_mask[LPC_HOST_EVENT_SMI]);
}
@@ -181,7 +181,7 @@ static void lpc_generate_sci(void)
#endif
if (host_events & event_mask[LPC_HOST_EVENT_SCI])
- CPRINTF("[%T sci 0x%08x]\n",
+ CPRINTS("sci 0x%08x",
host_events & event_mask[LPC_HOST_EVENT_SCI]);
}
@@ -622,7 +622,7 @@ void lpc_interrupt(void)
LM4_LPC_ST(i) &= ~LM4_LPC_ST_FRMH;
}
- CPRINTF("[%T LPC RESET# %sasserted]\n",
+ CPRINTS("LPC RESET# %sasserted",
lpc_get_pltrst_asserted() ? "" : "de");
}
}
diff --git a/chip/lm4/spi.c b/chip/lm4/spi.c
index aa8785ed0e..f6afd7cbd8 100644
--- a/chip/lm4/spi.c
+++ b/chip/lm4/spi.c
@@ -16,7 +16,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_SPI, outstr)
-#define CPRINTF(format, args...) cprintf(CC_SPI, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SPI, format, ## args)
int spi_enable(int enable)