summaryrefslogtreecommitdiff
path: root/cmd/sbc_harness/hw/w5500.h
blob: 0f37797f3588678c83d3156f9a6971b54f14e92e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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_ */