summaryrefslogtreecommitdiff
path: root/cmd/sbc_harness/hw/w5500.h
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/sbc_harness/hw/w5500.h')
-rw-r--r--cmd/sbc_harness/hw/w5500.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/cmd/sbc_harness/hw/w5500.h b/cmd/sbc_harness/hw/w5500.h
index 4f02152..d0c8d48 100644
--- a/cmd/sbc_harness/hw/w5500.h
+++ b/cmd/sbc_harness/hw/w5500.h
@@ -7,6 +7,8 @@
#ifndef _HW_W5500_H_
#define _HW_W5500_H_
+#include <libcr_ipc/sema.h>
+#include <libcr_ipc/mutex.h>
#include <libmisc/net.h>
#include "hw/spi.h"
@@ -29,22 +31,26 @@ struct _w5500_listener {
/* mutable */
uint16_t port;
+ cr_mutex_t cmd_mu;
+ cr_sema_t listen_sema, read_sema;
};
struct w5500 {
/* const-after-init */
struct spi *spidev;
+ uint pin_intr;
uint pin_reset;
/* mutable */
uint16_t next_local_port;
struct _w5500_listener listeners[8];
+ cr_sema_t intr;
};
/**
* Initialize a WIZnet W5500 Ethernet-and-TCP/IP-offload chip.
*
- * The W5500 has 3 channels of communication with the MCU:
+ * The W5500 has 3 lines of communication with the MCU:
*
* - An SPI-based RPC protocol:
* + mode: mode 0 or mode 3
@@ -67,7 +73,12 @@ void _w5500_init(struct w5500 *self,
/**
* TODO.
*/
-void w5500_reset(struct w5500 *self, struct net_eth_addr addr);
+void w5500_hard_reset(struct w5500 *self, struct net_eth_addr addr);
+
+/**
+ * TODO.
+ */
+void w5500_soft_reset(struct w5500 *self, struct net_eth_addr addr);
struct w5500_netcfg {
struct net_ip4_addr gateway_addr;