[Cryptech-Commits] [sw/libhal] 03/03: Add core address to debug output
git at cryptech.is
git at cryptech.is
Tue May 24 22:04:33 UTC 2016
This is an automated email from the git hooks/post-receive script.
paul at psgd.org pushed a commit to branch master
in repository sw/libhal.
commit 8cfa94fa781db53a7de380eb694a84cf5f546410
Author: Paul Selkirk <paul at psgd.org>
AuthorDate: Tue May 24 15:59:56 2016 -0400
Add core address to debug output
---
hal_io_fmc.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/hal_io_fmc.c b/hal_io_fmc.c
index 712d9c2..9dd3578 100644
--- a/hal_io_fmc.c
+++ b/hal_io_fmc.c
@@ -75,11 +75,11 @@ void hal_io_set_debug(int onoff)
debug = onoff;
}
-static void dump(char *label, const uint8_t *buf, size_t len)
+static void dump(char *label, hal_addr_t offset, const uint8_t *buf, size_t len)
{
if (debug) {
size_t i;
- printf("%s [", label);
+ printf("%s %04x [", label, (unsigned int)offset);
for (i = 0; i < len; ++i)
printf(" %02x", buf[i]);
printf(" ]\n");
@@ -99,7 +99,7 @@ hal_error_t hal_io_write(const hal_core_t *core, hal_addr_t offset, const uint8_
if ((err = init()) != HAL_OK)
return err;
- dump("write ", buf, len);
+ dump("write ", offset + hal_core_base(core), buf, len);
offset = fmc_offset(offset + hal_core_base(core));
for (; len > 0; offset += 4, buf += 4, len -= 4) {
@@ -115,6 +115,7 @@ hal_error_t hal_io_read(const hal_core_t *core, hal_addr_t offset, uint8_t *buf,
{
uint8_t *rbuf = buf;
int rlen = len;
+ hal_addr_t orig_offset = offset;
hal_error_t err;
if (core == NULL)
@@ -133,7 +134,7 @@ hal_error_t hal_io_read(const hal_core_t *core, hal_addr_t offset, uint8_t *buf,
*(uint32_t *)rbuf = ntohl(val);
}
- dump("read ", buf, len);
+ dump("read ", orig_offset + hal_core_base(core), buf, len);
return HAL_OK;
}
More information about the Commits
mailing list