summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2019-02-06 16:19:42 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-02-15 01:55:24 -0800
commit751fb79680b3477ad0f6c7530cdc673b015d0673 (patch)
treee70a7ad326f2b58e7358a0316fc5178b33770a98 /include
parent0aa79f950b0532da5952e9e70e6a1f5f62069684 (diff)
downloadchrome-ec-751fb79680b3477ad0f6c7530cdc673b015d0673.tar.gz
Util: Add hexdump API
This patch adds the hexdump API, which prints binary data in hex and ASCII. Sample output of hexdump(image_data.version, 30): 6e 61 6d 69 5f 76 32 2e 30 2e 37 37 34 2d 63 66 |nami_v2.0.774-cf| 34 62 64 33 34 38 30 00 00 00 00 00 00 00 |4bd3480....... | Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=none BRANCH=none TEST=Verify image_data.version is printed as expected on Nami Change-Id: I8a10a9ac4d329657bf65b64117448cb9b3e75a52 Reviewed-on: https://chromium-review.googlesource.com/1457577 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/util.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/util.h b/include/util.h
index aa15ba4fa8..edef7d9b38 100644
--- a/include/util.h
+++ b/include/util.h
@@ -210,6 +210,19 @@ static inline int cond_went_true(cond_t *c) { return cond_went(c, 1); }
int parse_offset_size(int argc, char **argv, int shift,
int *offset, int *size);
+/**
+ * Print binary in hex and ASCII
+ *
+ * Sample output of hexdump(image_data.version, 30):
+ *
+ * 6e 61 6d 69 5f 76 32 2e 30 2e 37 37 34 2d 63 66 |nami_v2.0.774-cf|
+ * 34 62 64 33 34 38 30 00 00 00 00 00 00 00 |4bd3480....... |
+ *
+ * @param data Data to be dumped
+ * @param len Size of data
+ */
+void hexdump(const uint8_t *data, int len);
+
#ifdef CONFIG_ASSEMBLY_MULA32
/*
* Compute (a*b)+c[+d], where a, b, c[, d] are 32-bit integers, and the result