summaryrefslogtreecommitdiff
path: root/cmd/sbc_harness/hw/w5500.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/sbc_harness/hw/w5500.c')
-rw-r--r--cmd/sbc_harness/hw/w5500.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/cmd/sbc_harness/hw/w5500.c b/cmd/sbc_harness/hw/w5500.c
index b868eaa..b95ad88 100644
--- a/cmd/sbc_harness/hw/w5500.c
+++ b/cmd/sbc_harness/hw/w5500.c
@@ -229,7 +229,7 @@ static inline void w5500_post_reset(struct w5500 *chip, struct net_eth_addr addr
* The hysteresis is (intlevel+1)*4/(150MHz) (if intlevel is
* non-zero), or (intlevel+1)*26.7ns; so even the shortest-possible
* hysteresis much larger than necessary for us. */
- w5500ll_write_common_reg(chip->spidev, intlevel, encode_u16be(1));
+ w5500ll_write_common_reg(chip->spidev, intlevel, uint16be_marshal(1));
/* This implementation does not care about any of the chip-level
* interrupts. */
@@ -328,7 +328,7 @@ static implements_net_conn *w5500_accept(implements_net_listener *_self) {
/* Mimics socket.c:socket(). */
w5500_listener_cmd_close(self);
w5500ll_write_sock_reg(chip->spidev, socknum, mode, SOCKMODE_TCP);
- w5500ll_write_sock_reg(chip->spidev, socknum, local_port, encode_u16be(self->port));
+ w5500ll_write_sock_reg(chip->spidev, socknum, local_port, uint16be_marshal(self->port));
w5500_listener_cmd(self, CMD_OPEN);
while (w5500ll_read_sock_reg(chip->spidev, socknum, state) != STATE_TCP_INIT)
cr_yield();
@@ -403,7 +403,7 @@ static ssize_t w5500_write(implements_net_conn *_self, void *buf, size_t count)
if (state != STATE_TCP_ESTABLISHED && state != STATE_TCP_CLOSE_WAIT)
return -1;
- uint16_t freesize = decode_u16be(w5500ll_read_sock_reg(chip->spidev, socknum, tx_free_size));
+ uint16_t freesize = uint16be_unmarshal(w5500ll_read_sock_reg(chip->spidev, socknum, tx_free_size));
if (freesize < count-done && freesize < min_free_space) {
/* Wait for more buffer space. */
cr_yield();
@@ -411,9 +411,9 @@ static ssize_t w5500_write(implements_net_conn *_self, void *buf, size_t count)
}
/* Queue data to be sent. */
- uint16_t ptr = decode_u16be(w5500ll_read_sock_reg(chip->spidev, socknum, tx_write_pointer));
+ uint16_t ptr = uint16be_unmarshal(w5500ll_read_sock_reg(chip->spidev, socknum, tx_write_pointer));
w5500ll_write(chip->spidev, ptr, CTL_BLOCK_SOCK(socknum, TX), &((char *)buf)[done], freesize);
- w5500ll_write_sock_reg(chip->spidev, socknum, tx_write_pointer, encode_u16be(ptr+freesize));
+ w5500ll_write_sock_reg(chip->spidev, socknum, tx_write_pointer, uint16be_marshal(ptr+freesize));
/* Submit the queue. */
w5500_listener_cmd(listener, CMD_SEND);
@@ -441,16 +441,16 @@ static ssize_t w5500_read(implements_net_conn *_self, void *buf, size_t count) {
return -1;
}
- uint16_t avail = decode_u16be(w5500ll_read_sock_reg(chip->spidev, socknum, rx_size));
+ uint16_t avail = uint16be_unmarshal(w5500ll_read_sock_reg(chip->spidev, socknum, rx_size));
if (!avail) {
cr_sema_wait(&listener->read_sema);
continue;
}
if ((size_t)avail > count)
avail = count;
- uint16_t ptr = decode_u16be(w5500ll_read_sock_reg(chip->spidev, socknum, rx_read_pointer));
+ uint16_t ptr = uint16be_unmarshal(w5500ll_read_sock_reg(chip->spidev, socknum, rx_read_pointer));
w5500ll_read(chip->spidev, ptr, CTL_BLOCK_SOCK(socknum, RX), &((char *)buf)[done], avail);
- w5500ll_write_sock_reg(chip->spidev, socknum, rx_read_pointer, encode_u16be(ptr+avail));
+ w5500ll_write_sock_reg(chip->spidev, socknum, rx_read_pointer, uint16be_marshal(ptr+avail));
w5500_listener_cmd(listener, CMD_RECV);
done += avail;