summaryrefslogtreecommitdiff
path: root/libhw_cr/w5500_ll.h
diff options
context:
space:
mode:
Diffstat (limited to 'libhw_cr/w5500_ll.h')
-rw-r--r--libhw_cr/w5500_ll.h37
1 files changed, 23 insertions, 14 deletions
diff --git a/libhw_cr/w5500_ll.h b/libhw_cr/w5500_ll.h
index 738a7f1..aa41e7a 100644
--- a/libhw_cr/w5500_ll.h
+++ b/libhw_cr/w5500_ll.h
@@ -54,14 +54,15 @@
#define CTL_OM_FDM4 0b11 /* fixed-length data mode: 4 byte data length */
#if CONFIG_W5500_LL_DEBUG
-static char *_ctl_block_part_strs[] = {
- "RES",
- "REG",
- "TX",
- "RX",
-};
-#define PRI_ctl_block "CTL_BLOCK_SOCK(%d, %s)"
-#define ARG_ctl_block(b) (((b)>>5) & 0b111), _ctl_block_part_strs[((b)>>3)&0b11]
+static void fmt_print_ctl_block(lo_interface fmt_dest, uint8_t b) {
+ static char *strs[] = {
+ "RES",
+ "REG",
+ "TX",
+ "RX",
+ };
+ fmt_print("CTL_BLOCK_SOCK(", (base10, (((b)>>5) & 0b111)), ", ", strs[((b)>>3)&0b11], ")");
+}
#endif
/* Even though SPI is a full-duplex protocol, the W5500's spiframe on top of it is only half-duplex.
@@ -83,9 +84,13 @@ w5500ll_writev(
assert(iov);
assert(iovcnt > 0);
#if CONFIG_W5500_LL_DEBUG
- log_n_debugf(W5500_LL,
- "%s(): w5500ll_write(spidev, addr=%#04x, block="PRI_ctl_block", iov, iovcnt=%d)",
- func, addr, ARG_ctl_block(block), iovcnt);
+ log_n_debugln(W5500_LL,
+ func, "(): w5500ll_write(spidev",
+ ", addr=", (base16_u16_, addr),
+ ", block=", (ctl_block, block),
+ ", iov",
+ ", iovcnt=", iovcnt,
+ ")");
#endif
uint8_t header[] = {
@@ -120,9 +125,13 @@ w5500ll_readv(
assert(iov);
assert(iovcnt > 0);
#if CONFIG_W5500_LL_DEBUG
- log_n_debugf(W5500_LL,
- "%s(): w5500ll_read(spidev, addr=%#04x, block="PRI_ctl_block", iov, iovcnt=%d)",
- func, addr, ARG_ctl_block(block), iovcnt);
+ log_n_debugln(W5500_LL,
+ func, "(): w5500ll_read(spidev",
+ ", addr=", (base16_u16_, addr),
+ ", block=", (ctl_block, block),
+ ", iov",
+ ", iovcnt=", iovcnt,
+ ")");
#endif
uint8_t header[] = {