diff options
author | Evan Green <evgreen@chromium.org> | 2019-09-23 11:02:41 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-10-05 00:47:44 +0000 |
commit | e34fca3e01d75552ad8d712879c3ccd6a6168584 (patch) | |
tree | e2a71c2fa4dd52ffe459d10156276fbb0b5aa597 /common | |
parent | a1216326c5d58af300b7c6f24c8597a232ced131 (diff) | |
download | chrome-ec-e34fca3e01d75552ad8d712879c3ccd6a6168584.tar.gz |
builtin: Introduce and use inttypes.h
In order to pass the right printf format specifiers for certain types
that are compiled both in 32-bit EC and 64-bit host environments,
standard macros PRIx64 and PRId64 must be introduced. These specify
the correct printf format specifier in the given compilation environment
for printing a 64-bit value.
On the host, inttypes.h already exists. Add an inttypes.h for the EC
codebase so that these macros can be used where they're needed.
BUG=chromium:984041
TEST=make -j buildall
BRANCH=none
Change-Id: I76e3bdc88aef7da6e5234d5b86b595f7138ea9a1
Signed-off-by: Evan Green <evgreen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1819642
Reviewed-by: caveh jalali <caveh@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/charge_state_v2.c | 2 | ||||
-rw-r--r-- | common/keyboard_8042.c | 4 | ||||
-rw-r--r-- | common/usb_pd_protocol.c | 3 |
3 files changed, 5 insertions, 4 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c index 11d11d1aa7..b02b6ca819 100644 --- a/common/charge_state_v2.c +++ b/common/charge_state_v2.c @@ -172,7 +172,7 @@ static void problem(enum problem_type p, int v) if (last_prob_val[p] != v) { t_now = get_time(); t_diff.val = t_now.val - last_prob_time[p].val; - CPRINTS("charge problem: %s, 0x%x -> 0x%x after %.6lds", + CPRINTS("charge problem: %s, 0x%x -> 0x%x after %.6" PRId64 "s", prob_text[p], last_prob_val[p], v, t_diff.val); last_prob_val[p] = v; last_prob_time[p] = t_now; diff --git a/common/keyboard_8042.c b/common/keyboard_8042.c index 596c66d317..69669a740a 100644 --- a/common/keyboard_8042.c +++ b/common/keyboard_8042.c @@ -916,8 +916,8 @@ static int command_typematic(int argc, char **argv) ccprintf("From host: 0x%02x\n", typematic_value_from_host); ccprintf("First delay: %3d ms\n", typematic_first_delay / 1000); ccprintf("Inter delay: %3d ms\n", typematic_inter_delay / 1000); - ccprintf("Now: %.6ld\n", get_time().val); - ccprintf("Deadline: %.6ld\n", typematic_deadline.val); + ccprintf("Now: %.6" PRId64 "\n", get_time().val); + ccprintf("Deadline: %.6" PRId64 "\n", typematic_deadline.val); ccputs("Repeat scan code: {"); for (i = 0; i < typematic_len; ++i) diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 9885bc6540..f554630870 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -2898,7 +2898,8 @@ void pd_task(void *u) if (tcpm_get_chip_info(port, 0, &info) == EC_SUCCESS) { - CPRINTS("TCPC p%d VID:0x%x PID:0x%x DID:0x%x FWV:0x%lx", + CPRINTS("TCPC p%d VID:0x%x PID:0x%x DID:0x%x " + "FWV:0x%" PRIx64, port, info->vendor_id, info->product_id, info->device_id, info->fw_version_number); } |