diff options
Diffstat (limited to 'cmd/sbc_harness/hw/w5500.h')
-rw-r--r-- | cmd/sbc_harness/hw/w5500.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/cmd/sbc_harness/hw/w5500.h b/cmd/sbc_harness/hw/w5500.h new file mode 100644 index 0000000..0f37797 --- /dev/null +++ b/cmd/sbc_harness/hw/w5500.h @@ -0,0 +1,29 @@ +#ifndef _HW_W5500_H_ +#define _HW_W5500_H_ + +#include "hw/spi.h" + +struct w5500 { + struct spi *spidev; +}; + +/** + * Initialize a WIZnet W5500 Ethernet and TCP/IP-offload chip. + * + * The W5500 has 2 channels of communication with the MCU: + * + * - An SPI-based RPC protocol: + * + mode: mode 0 or mode 3 + * + bit-order: MSB-first + * + clock frequency: 33.3MHz - 80MHz + * - An interrupt pin that it pulls low when an event happens (to let + * the MCU know that it should do an SPI RPC "get" to see what + * happened.) + */ +#define w5500_init(self, name, spi, pin_intr) do { \ + bi_decl(bi_1_pin_with_name(pin_intr, name" interrupt")); \ + _w5500_init(self, spi, pin_intr); \ + } while (0) +void _w5500_init(struct w5500 *self, struct spi* spi, uint pin_intr); + +#endif /* _HW_W5500_H_ */ |