diff options
author | Vic Yang <victoryang@chromium.org> | 2014-05-19 15:03:27 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-05-21 20:32:17 +0000 |
commit | ffac23c0ea1bd4ff4568f5bd709a98f912b833a7 (patch) | |
tree | 362dd0ba205731aa07be97dd35b44b237799b23b /chip/stm32/usb_pd_phy.c | |
parent | 478361de694b1fb45abf3c38dafbbf7fd1aa5f71 (diff) | |
download | chrome-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/stm32/usb_pd_phy.c')
-rw-r--r-- | chip/stm32/usb_pd_phy.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/chip/stm32/usb_pd_phy.c b/chip/stm32/usb_pd_phy.c index bb402ee703..39f898d84c 100644 --- a/chip/stm32/usb_pd_phy.c +++ b/chip/stm32/usb_pd_phy.c @@ -20,8 +20,10 @@ #ifdef CONFIG_COMMON_RUNTIME #define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args) +#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args) #else #define CPRINTF(format, args...) +#define CPRINTS(format, args...) #endif #define PD_DATARATE 300000 /* Hz */ @@ -84,7 +86,7 @@ static int wait_bits(int nb) && !(STM32_TIM_SR(TIM_RX) & 4)) ; /* optimized for latency, not CPU usage ... */ if (dma_bytes_done(rx, PD_MAX_RAW_SIZE) < nb) { - CPRINTF("[%T PD TMOUT RX %d/%d]\n", + CPRINTS("PD TMOUT RX %d/%d", dma_bytes_done(rx, PD_MAX_RAW_SIZE), nb); return -1; } @@ -131,7 +133,7 @@ int pd_dequeue_bits(void *ctxt, int off, int len, uint32_t *val) return -1; } stream_err: - CPRINTF("[%T PD Invalid %d @%d]\n", cnt, off); + CPRINTS("PD Invalid %d @%d", cnt, off); return -1; } @@ -155,7 +157,7 @@ int pd_find_preamble(void *ctxt) !(STM32_TIM_SR(TIM_RX) & 4)) ; if (STM32_TIM_SR(TIM_RX) & 4) { - CPRINTF("[%T PD TMOUT RX %d/%d]\n", + CPRINTS("PD TMOUT RX %d/%d", PD_MAX_RAW_SIZE - rx->cndtr, bit); return -1; } @@ -524,7 +526,7 @@ void *pd_hw_init(void) STM32_EXTI_IMR |= EXTI_COMP_MASK; task_enable_irq(IRQ_COMP); - CPRINTF("[%T USB PD initialized]\n"); + CPRINTS("USB PD initialized"); return raw_samples; } |