1
6
7
8
14
15
16
17
18
19
20
21
27
28
29
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
129
130
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
168
169
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
207
208
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
/* ... */
#pragma once
#include <stdbool.h>
#include "soc/soc_caps.h"
#include "esp_eth_com.h"
#include "esp_eth_mac.h"
#include "sdkconfig.h"
#include "driver/spi_master.h"6 includes
#ifdef __cplusplus
extern "C" {
#endif
#if CONFIG_ETH_USE_SPI_ETHERNET
/* ... */
typedef struct
{
/* ... */
void *config;
/* ... */
void *(*init)(const void *spi_config);
/* ... */
esp_err_t (*deinit)(void *spi_ctx);
/* ... */
esp_err_t (*read)(void *spi_ctx, uint32_t cmd, uint32_t addr, void *data, uint32_t data_len);
/* ... */
esp_err_t (*write)(void *spi_ctx, uint32_t cmd, uint32_t addr, const void *data, uint32_t data_len);
}{ ... } eth_spi_custom_driver_config_t;
/* ... */
#define ETH_DEFAULT_SPI \
{ \
.config = NULL, \
.init = NULL, \
.deinit = NULL, \
.read = NULL, \
.write = NULL \
}{...}
...#endif/* ... */
#if CONFIG_ETH_SPI_ETHERNET_DM9051
/* ... */
typedef struct {
int int_gpio_num;
uint32_t poll_period_ms;
spi_host_device_t spi_host_id;
spi_device_interface_config_t *spi_devcfg;
eth_spi_custom_driver_config_t custom_spi_driver;
}{...} eth_dm9051_config_t;
/* ... */
#define ETH_DM9051_DEFAULT_CONFIG(spi_host, spi_devcfg_p) \
{ \
.int_gpio_num = 4, \
.poll_period_ms = 0, \
.spi_host_id = spi_host, \
.spi_devcfg = spi_devcfg_p, \
.custom_spi_driver = ETH_DEFAULT_SPI, \
}{...}
...
/* ... */
esp_eth_mac_t *esp_eth_mac_new_dm9051(const eth_dm9051_config_t *dm9051_config, const eth_mac_config_t *mac_config);/* ... */
#endif
#if CONFIG_ETH_SPI_ETHERNET_W5500
/* ... */
typedef struct {
int int_gpio_num;
uint32_t poll_period_ms;
spi_host_device_t spi_host_id;
spi_device_interface_config_t *spi_devcfg;
eth_spi_custom_driver_config_t custom_spi_driver;
}{...} eth_w5500_config_t;
/* ... */
#define ETH_W5500_DEFAULT_CONFIG(spi_host, spi_devcfg_p) \
{ \
.int_gpio_num = 4, \
.poll_period_ms = 0, \
.spi_host_id = spi_host, \
.spi_devcfg = spi_devcfg_p, \
.custom_spi_driver = ETH_DEFAULT_SPI, \
}{...}
...
/* ... */
esp_eth_mac_t *esp_eth_mac_new_w5500(const eth_w5500_config_t *w5500_config, const eth_mac_config_t *mac_config);/* ... */
#endif
#if CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL
/* ... */
typedef struct {
int int_gpio_num;
uint32_t poll_period_ms;
spi_host_device_t spi_host_id;
spi_device_interface_config_t *spi_devcfg;
eth_spi_custom_driver_config_t custom_spi_driver;
}{...} eth_ksz8851snl_config_t;
/* ... */
#define ETH_KSZ8851SNL_DEFAULT_CONFIG(spi_host, spi_devcfg_p) \
{ \
.int_gpio_num = 4, \
.poll_period_ms = 0, \
.spi_host_id = spi_host, \
.spi_devcfg = spi_devcfg_p, \
.custom_spi_driver = ETH_DEFAULT_SPI, \
}{...}
...
/* ... */
esp_eth_mac_t *esp_eth_mac_new_ksz8851snl(const eth_ksz8851snl_config_t *ksz8851snl_config, const eth_mac_config_t *mac_config);/* ... */
#endif
#ifdef __cplusplus
}{...}
#endif