ksz9031_driver.h
Go to the documentation of this file.
1 /**
2  * @file ksz9031_driver.h
3  * @brief KSZ9031 Gigabit Ethernet PHY driver
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.0
29  **/
30 
31 #ifndef _KSZ9031_DRIVER_H
32 #define _KSZ9031_DRIVER_H
33 
34 //Dependencies
35 #include "core/nic.h"
36 
37 //PHY address
38 #ifndef KSZ9031_PHY_ADDR
39  #define KSZ9031_PHY_ADDR 7
40 #elif (KSZ9031_PHY_ADDR < 0 || KSZ9031_PHY_ADDR > 31)
41  #error KSZ9031_PHY_ADDR parameter is not valid
42 #endif
43 
44 //KSZ9031 PHY registers
45 #define KSZ9031_BMCR 0x00
46 #define KSZ9031_BMSR 0x01
47 #define KSZ9031_PHYID1 0x02
48 #define KSZ9031_PHYID2 0x03
49 #define KSZ9031_ANAR 0x04
50 #define KSZ9031_ANLPAR 0x05
51 #define KSZ9031_ANER 0x06
52 #define KSZ9031_ANNPR 0x07
53 #define KSZ9031_ANLPNPR 0x08
54 #define KSZ9031_GBCR 0x09
55 #define KSZ9031_GBSR 0x0A
56 #define KSZ9031_MMDACR 0x0D
57 #define KSZ9031_MMDAADR 0x0E
58 #define KSZ9031_GBESR 0x0F
59 #define KSZ9031_RLB 0x11
60 #define KSZ9031_LINKMD 0x12
61 #define KSZ9031_DPMAPCSS 0x13
62 #define KSZ9031_RXERCTR 0x15
63 #define KSZ9031_ICSR 0x1B
64 #define KSZ9031_AUTOMDI 0x1C
65 #define KSZ9031_PHYCON 0x1F
66 
67 //KSZ9031 MMD registers
68 #define KSZ9031_AN_FLP_BURST_TRANSMIT_LO 0x00, 0x03
69 #define KSZ9031_AN_FLP_BURST_TRANSMIT_HI 0x00, 0x04
70 #define KSZ9031_1000BASE_T_LINK_UP_TIME_CTRL 0x01, 0x5A
71 #define KSZ9031_COMMON_CTRL 0x02, 0x00
72 #define KSZ9031_STRAP_STAT 0x02, 0x01
73 #define KSZ9031_OP_MODE_STRAP_OVERRIDE 0x02, 0x02
74 #define KSZ9031_OP_MODE_STRAP_STAT 0x02, 0x03
75 #define KSZ9031_RGMII_CTRL_SIGNAL_PAD_SKEW 0x02, 0x04
76 #define KSZ9031_RGMII_RX_DATA_PAD_SKEW 0x02, 0x05
77 #define KSZ9031_RGMII_TX_DATA_PAD_SKEW 0x02, 0x06
78 #define KSZ9031_GMII_CLK_PAD_SKEW 0x02, 0x08
79 #define KSZ9031_WOL_CTRL 0x02, 0x10
80 #define KSZ9031_WOL_MAGIC_PKT_MAC_DA0 0x02, 0x11
81 #define KSZ9031_WOL_MAGIC_PKT_MAC_DA1 0x02, 0x12
82 #define KSZ9031_WOL_MAGIC_PKT_MAC_DA2 0x02, 0x13
83 #define KSZ9031_WOL_CUSTOM_PKT_TYPE0_CRC0 0x02, 0x14
84 #define KSZ9031_WOL_CUSTOM_PKT_TYPE0_CRC1 0x02, 0x15
85 #define KSZ9031_WOL_CUSTOM_PKT_TYPE1_CRC0 0x02, 0x16
86 #define KSZ9031_WOL_CUSTOM_PKT_TYPE1_CRC1 0x02, 0x17
87 #define KSZ9031_WOL_CUSTOM_PKT_TYPE2_CRC0 0x02, 0x18
88 #define KSZ9031_WOL_CUSTOM_PKT_TYPE2_CRC1 0x02, 0x19
89 #define KSZ9031_WOL_CUSTOM_PKT_TYPE3_CRC0 0x02, 0x1A
90 #define KSZ9031_WOL_CUSTOM_PKT_TYPE3_CRC1 0x02, 0x1B
91 #define KSZ9031_WOL_CUSTOM_PKT_TYPE0_MASK0 0x02, 0x1C
92 #define KSZ9031_WOL_CUSTOM_PKT_TYPE0_MASK1 0x02, 0x1D
93 #define KSZ9031_WOL_CUSTOM_PKT_TYPE0_MASK2 0x02, 0x1E
94 #define KSZ9031_WOL_CUSTOM_PKT_TYPE0_MASK3 0x02, 0x1F
95 #define KSZ9031_WOL_CUSTOM_PKT_TYPE1_MASK0 0x02, 0x20
96 #define KSZ9031_WOL_CUSTOM_PKT_TYPE1_MASK1 0x02, 0x21
97 #define KSZ9031_WOL_CUSTOM_PKT_TYPE1_MASK2 0x02, 0x22
98 #define KSZ9031_WOL_CUSTOM_PKT_TYPE1_MASK3 0x02, 0x23
99 #define KSZ9031_WOL_CUSTOM_PKT_TYPE2_MASK0 0x02, 0x24
100 #define KSZ9031_WOL_CUSTOM_PKT_TYPE2_MASK1 0x02, 0x25
101 #define KSZ9031_WOL_CUSTOM_PKT_TYPE2_MASK2 0x02, 0x26
102 #define KSZ9031_WOL_CUSTOM_PKT_TYPE2_MASK3 0x02, 0x27
103 #define KSZ9031_WOL_CUSTOM_PKT_TYPE3_MASK0 0x02, 0x28
104 #define KSZ9031_WOL_CUSTOM_PKT_TYPE3_MASK1 0x02, 0x29
105 #define KSZ9031_WOL_CUSTOM_PKT_TYPE3_MASK2 0x02, 0x2A
106 #define KSZ9031_WOL_CUSTOM_PKT_TYPE3_MASK3 0x02, 0x2B
107 #define KSZ9031_ANALOG_CTRL4 0x1C, 0x04
108 #define KSZ9031_EDPD_CTRL 0x1C, 0x23
109 
110 //Basic Control register
111 #define KSZ9031_BMCR_RESET 0x8000
112 #define KSZ9031_BMCR_LOOPBACK 0x4000
113 #define KSZ9031_BMCR_SPEED_SEL_LSB 0x2000
114 #define KSZ9031_BMCR_AN_EN 0x1000
115 #define KSZ9031_BMCR_POWER_DOWN 0x0800
116 #define KSZ9031_BMCR_ISOLATE 0x0400
117 #define KSZ9031_BMCR_RESTART_AN 0x0200
118 #define KSZ9031_BMCR_DUPLEX_MODE 0x0100
119 #define KSZ9031_BMCR_SPEED_SEL_MSB 0x0040
120 
121 //Basic Status register
122 #define KSZ9031_BMSR_100BT4 0x8000
123 #define KSZ9031_BMSR_100BTX_FD 0x4000
124 #define KSZ9031_BMSR_100BTX_HD 0x2000
125 #define KSZ9031_BMSR_10BT_FD 0x1000
126 #define KSZ9031_BMSR_10BT_HD 0x0800
127 #define KSZ9031_BMSR_EXTENDED_STATUS 0x0100
128 #define KSZ9031_BMSR_NO_PREAMBLE 0x0040
129 #define KSZ9031_BMSR_AN_COMPLETE 0x0020
130 #define KSZ9031_BMSR_REMOTE_FAULT 0x0010
131 #define KSZ9031_BMSR_AN_CAPABLE 0x0008
132 #define KSZ9031_BMSR_LINK_STATUS 0x0004
133 #define KSZ9031_BMSR_JABBER_DETECT 0x0002
134 #define KSZ9031_BMSR_EXTENDED_CAPABLE 0x0001
135 
136 //PHY Identifier 1 register
137 #define KSZ9031_PHYID1_PHY_ID_MSB 0xFFFF
138 #define KSZ9031_PHYID1_PHY_ID_MSB_DEFAULT 0x0022
139 
140 //PHY Identifier 2 register
141 #define KSZ9031_PHYID2_PHY_ID_LSB 0xFC00
142 #define KSZ9031_PHYID2_PHY_ID_LSB_DEFAULT 0x1400
143 #define KSZ9031_PHYID2_MODEL_NUM 0x03F0
144 #define KSZ9031_PHYID2_MODEL_NUM_DEFAULT 0x0220
145 #define KSZ9031_PHYID2_REVISION_NUM 0x000F
146 
147 //Auto-Negotiation Advertisement register
148 #define KSZ9031_ANAR_NEXT_PAGE 0x8000
149 #define KSZ9031_ANAR_REMOTE_FAULT 0x2000
150 #define KSZ9031_ANAR_PAUSE 0x0C00
151 #define KSZ9031_ANAR_100BT4 0x0200
152 #define KSZ9031_ANAR_100BTX_FD 0x0100
153 #define KSZ9031_ANAR_100BTX_HD 0x0080
154 #define KSZ9031_ANAR_10BT_FD 0x0040
155 #define KSZ9031_ANAR_10BT_HD 0x0020
156 #define KSZ9031_ANAR_SELECTOR 0x001F
157 #define KSZ9031_ANAR_SELECTOR_DEFAULT 0x0001
158 
159 //Auto-Negotiation Link Partner Ability register
160 #define KSZ9031_ANLPAR_NEXT_PAGE 0x8000
161 #define KSZ9031_ANLPAR_ACK 0x4000
162 #define KSZ9031_ANLPAR_REMOTE_FAULT 0x2000
163 #define KSZ9031_ANLPAR_PAUSE 0x0C00
164 #define KSZ9031_ANLPAR_100BT4 0x0200
165 #define KSZ9031_ANLPAR_100BTX_FD 0x0100
166 #define KSZ9031_ANLPAR_100BTX_HD 0x0080
167 #define KSZ9031_ANLPAR_10BT_FD 0x0040
168 #define KSZ9031_ANLPAR_10BT_HD 0x0020
169 #define KSZ9031_ANLPAR_SELECTOR 0x001F
170 #define KSZ9031_ANLPAR_SELECTOR_DEFAULT 0x0001
171 
172 //Auto-Negotiation Expansion register
173 #define KSZ9031_ANER_PAR_DETECT_FAULT 0x0010
174 #define KSZ9031_ANER_LP_NEXT_PAGE_ABLE 0x0008
175 #define KSZ9031_ANER_NEXT_PAGE_ABLE 0x0004
176 #define KSZ9031_ANER_PAGE_RECEIVED 0x0002
177 #define KSZ9031_ANER_LP_AN_ABLE 0x0001
178 
179 //Auto-Negotiation Next Page register
180 #define KSZ9031_ANNPR_NEXT_PAGE 0x8000
181 #define KSZ9031_ANNPR_MSG_PAGE 0x2000
182 #define KSZ9031_ANNPR_ACK2 0x1000
183 #define KSZ9031_ANNPR_TOGGLE 0x0800
184 #define KSZ9031_ANNPR_MESSAGE 0x07FF
185 
186 //Link Partner Next Page Ability register
187 #define KSZ9031_ANLPNPR_NEXT_PAGE 0x8000
188 #define KSZ9031_ANLPNPR_ACK 0x4000
189 #define KSZ9031_ANLPNPR_MSG_PAGE 0x2000
190 #define KSZ9031_ANLPNPR_ACK2 0x1000
191 #define KSZ9031_ANLPNPR_TOGGLE 0x0800
192 #define KSZ9031_ANLPNPR_MESSAGE 0x07FF
193 
194 //1000BASE-T Control register
195 #define KSZ9031_GBCR_TEST_MODE 0xE000
196 #define KSZ9031_GBCR_MS_MAN_CONF_EN 0x1000
197 #define KSZ9031_GBCR_MS_MAN_CONF_VAL 0x0800
198 #define KSZ9031_GBCR_PORT_TYPE 0x0400
199 #define KSZ9031_GBCR_1000BT_FD 0x0200
200 #define KSZ9031_GBCR_1000BT_HD 0x0100
201 
202 //1000BASE-T Status register
203 #define KSZ9031_GBSR_MS_CONF_FAULT 0x8000
204 #define KSZ9031_GBSR_MS_CONF_RES 0x4000
205 #define KSZ9031_GBSR_LOCAL_RECEIVER_STATUS 0x2000
206 #define KSZ9031_GBSR_REMOTE_RECEIVER_STATUS 0x1000
207 #define KSZ9031_GBSR_LP_1000BT_FD 0x0800
208 #define KSZ9031_GBSR_LP_1000BT_HD 0x0400
209 #define KSZ9031_GBSR_IDLE_ERR_COUNT 0x00FF
210 
211 //MMD Access Control register
212 #define KSZ9031_MMDACR_FUNC 0xC000
213 #define KSZ9031_MMDACR_FUNC_ADDR 0x0000
214 #define KSZ9031_MMDACR_FUNC_DATA_NO_POST_INC 0x4000
215 #define KSZ9031_MMDACR_FUNC_DATA_POST_INC_RW 0x8000
216 #define KSZ9031_MMDACR_FUNC_DATA_POST_INC_W 0xC000
217 #define KSZ9031_MMDACR_DEVAD 0x001F
218 
219 //Extended Status register
220 #define KSZ9031_GBESR_1000BX_FD 0x8000
221 #define KSZ9031_GBESR_1000BX_HD 0x4000
222 #define KSZ9031_GBESR_1000BT_FD 0x2000
223 #define KSZ9031_GBESR_1000BT_HD 0x1000
224 
225 //Remote Loopback register
226 #define KSZ9031_RLB_REMOTE_LOOPBACK 0x0100
227 
228 //LinkMD Cable Diagnostic register
229 #define KSZ9031_LINKMD_TEST_EN 0x8000
230 #define KSZ9031_LINKMD_PAIR 0x3000
231 #define KSZ9031_LINKMD_PAIR_A 0x0000
232 #define KSZ9031_LINKMD_PAIR_B 0x1000
233 #define KSZ9031_LINKMD_PAIR_C 0x2000
234 #define KSZ9031_LINKMD_PAIR_D 0x3000
235 #define KSZ9031_LINKMD_STATUS 0x0300
236 #define KSZ9031_LINKMD_STATUS_NORMAL 0x0000
237 #define KSZ9031_LINKMD_STATUS_OPEN 0x0100
238 #define KSZ9031_LINKMD_STATUS_SHORT 0x0200
239 #define KSZ9031_LINKMD_FAULT_DATA 0x00FF
240 
241 //Digital PMA/PCS Status register
242 #define KSZ9031_DPMAPCSS_1000BT_LINK_STATUS 0x0004
243 #define KSZ9031_DPMAPCSS_100BTX_LINK_STATUS 0x0002
244 
245 //Interrupt Control/Status register
246 #define KSZ9031_ICSR_JABBER_IE 0x8000
247 #define KSZ9031_ICSR_RECEIVE_ERROR_IE 0x4000
248 #define KSZ9031_ICSR_PAGE_RECEIVED_IE 0x2000
249 #define KSZ9031_ICSR_PAR_DETECT_FAULT_IE 0x1000
250 #define KSZ9031_ICSR_LP_ACK_IE 0x0800
251 #define KSZ9031_ICSR_LINK_DOWN_IE 0x0400
252 #define KSZ9031_ICSR_REMOTE_FAULT_IE 0x0200
253 #define KSZ9031_ICSR_LINK_UP_IE 0x0100
254 #define KSZ9031_ICSR_JABBER_IF 0x0080
255 #define KSZ9031_ICSR_RECEIVE_ERROR_IF 0x0040
256 #define KSZ9031_ICSR_PAGE_RECEIVED_IF 0x0020
257 #define KSZ9031_ICSR_PAR_DETECT_FAULT_IF 0x0010
258 #define KSZ9031_ICSR_LP_ACK_IF 0x0008
259 #define KSZ9031_ICSR_LINK_DOWN_IF 0x0004
260 #define KSZ9031_ICSR_REMOTE_FAULT_IF 0x0002
261 #define KSZ9031_ICSR_LINK_UP_IF 0x0001
262 
263 //Auto MDI/MDI-X register
264 #define KSZ9031_AUTOMDI_MDI_SET 0x0080
265 #define KSZ9031_AUTOMDI_SWAP_OFF 0x0040
266 
267 //PHY Control register
268 #define KSZ9031_PHYCON_INT_LEVEL 0x4000
269 #define KSZ9031_PHYCON_JABBER_EN 0x0200
270 #define KSZ9031_PHYCON_SPEED_1000BT 0x0040
271 #define KSZ9031_PHYCON_SPEED_100BTX 0x0020
272 #define KSZ9031_PHYCON_SPEED_10BT 0x0010
273 #define KSZ9031_PHYCON_DUPLEX_STATUS 0x0008
274 #define KSZ9031_PHYCON_1000BT_MS_STATUS 0x0004
275 #define KSZ9031_PHYCON_LINK_STATUS_CHECK_FAIL 0x0001
276 
277 //1000BASE-T Link-Up Time Control register
278 #define KSZ9031_1000BASE_T_LINK_UP_TIME_CTRL_1000BASE_T_LINK_UP_TIME 0x000E
279 
280 //Common Control register
281 #define KSZ9031_COMMON_CTRL_LED_MODE_OVERRIDE 0x0010
282 #define KSZ9031_COMMON_CTRL_LED_MODE 0x0008
283 #define KSZ9031_COMMON_CTRL_CLK125_EN_STATUS 0x0002
284 
285 //Strap Status register
286 #define KSZ9031_STRAP_STAT_LED_MODE_STARP_IN_STATUS 0x0080
287 #define KSZ9031_STRAP_STAT_CLK125_EN_STRAP_IN_STATUS 0x0020
288 #define KSZ9031_STRAP_STAT_PHYAD_STRAP_IN_VALUE 0x0007
289 
290 //Operation Mode Strap Override register
291 #define KSZ9031_OP_MODE_STRAP_OVERRIDE_PME_N2_OUT_EN 0x0400
292 #define KSZ9031_OP_MODE_STRAP_OVERRIDE_PME_N1_OUT_EN 0x0100
293 #define KSZ9031_OP_MODE_STRAP_OVERRIDE_CHIP_PD_OVERRIDE 0x0080
294 #define KSZ9031_OP_MODE_STRAP_OVERRIDE_NAND_TREE_OVERRIDE 0x0010
295 #define KSZ9031_OP_MODE_STRAP_OVERRIDE_GMII_MII_OVERRIDE 0x0002
296 
297 //Operation Mode Strap Status register
298 #define KSZ9031_OP_MODE_STRAP_STAT_CHIP_PD_STRAP_IN_STATUS 0x0080
299 #define KSZ9031_OP_MODE_STRAP_STAT_NAND_TREE_STRAP_IN_STATUS 0x0010
300 #define KSZ9031_OP_MODE_STRAP_STAT_GMII_MII_STRAP_IN_STATUS 0x0002
301 
302 //RGMII Control Signal Pad Skew register
303 #define KSZ9031_RGMII_CTRL_SIGNAL_PAD_SKEW_RX_DV 0x00F0
304 #define KSZ9031_RGMII_CTRL_SIGNAL_PAD_SKEW_RX_DV_DEFAULT 0x0070
305 #define KSZ9031_RGMII_CTRL_SIGNAL_PAD_SKEW_TX_EN 0x000F
306 #define KSZ9031_RGMII_CTRL_SIGNAL_PAD_SKEW_TX_EN_DEFAULT 0x0007
307 
308 //RGMII RX Data Pad Skew register
309 #define KSZ9031_RGMII_RX_DATA_PAD_SKEW_RXD3 0xF000
310 #define KSZ9031_RGMII_RX_DATA_PAD_SKEW_RXD3_DEFAULT 0x7000
311 #define KSZ9031_RGMII_RX_DATA_PAD_SKEW_RXD2 0x0F00
312 #define KSZ9031_RGMII_RX_DATA_PAD_SKEW_RXD2_DEFAULT 0x0700
313 #define KSZ9031_RGMII_RX_DATA_PAD_SKEW_RXD1 0x00F0
314 #define KSZ9031_RGMII_RX_DATA_PAD_SKEW_RXD1_DEFAULT 0x0070
315 #define KSZ9031_RGMII_RX_DATA_PAD_SKEW_RXD0 0x000F
316 #define KSZ9031_RGMII_RX_DATA_PAD_SKEW_RXD0_DEFAULT 0x0007
317 
318 //RGMII TX Data Pad Skew register
319 #define KSZ9031_RGMII_TX_DATA_PAD_SKEW_TXD3 0xF000
320 #define KSZ9031_RGMII_TX_DATA_PAD_SKEW_TXD3_DEFAULT 0x7000
321 #define KSZ9031_RGMII_TX_DATA_PAD_SKEW_TXD2 0x0F00
322 #define KSZ9031_RGMII_TX_DATA_PAD_SKEW_TXD2_DEFAULT 0x0700
323 #define KSZ9031_RGMII_TX_DATA_PAD_SKEW_TXD1 0x00F0
324 #define KSZ9031_RGMII_TX_DATA_PAD_SKEW_TXD1_DEFAULT 0x0070
325 #define KSZ9031_RGMII_TX_DATA_PAD_SKEW_TXD0 0x000F
326 #define KSZ9031_RGMII_TX_DATA_PAD_SKEW_TXD0_DEFAULT 0x0007
327 
328 //GMII Clock Pad Skew register
329 #define KSZ9031_GMII_CLK_PAD_SKEW_GTX_CLK 0x03E0
330 #define KSZ9031_GMII_CLK_PAD_SKEW_GTX_CLK_DEFAULT 0x01E0
331 #define KSZ9031_GMII_CLK_PAD_SKEW_RX_CLK 0x001F
332 #define KSZ9031_GMII_CLK_PAD_SKEW_RX_CLK_DEFAULT 0x000F
333 
334 //Wake-On-LAN Control register
335 #define KSZ9031_WOL_CTRL_PME_OUT_SEL 0xC000
336 #define KSZ9031_WOL_CTRL_MAGIC_PKT_DETECT_EN 0x0040
337 #define KSZ9031_WOL_CTRL_CUSTOM_PKT_TYPE_3_DETECT_EN 0x0020
338 #define KSZ9031_WOL_CTRL_CUSTOM_PKT_TYPE_2_DETECT_EN 0x0010
339 #define KSZ9031_WOL_CTRL_CUSTOM_PKT_TYPE_1_DETECT_EN 0x0008
340 #define KSZ9031_WOL_CTRL_CUSTOM_PKT_TYPE_0_DETECT_EN 0x0004
341 #define KSZ9031_WOL_CTRL_LINK_DOWN_DETECT_EN 0x0002
342 #define KSZ9031_WOL_CTRL_LINK_UP_DETECT_EN 0x0001
343 
344 //Analog Control 4 register
345 #define KSZ9031_ANALOG_CTRL4_10BASE_TE_MODE 0x0400
346 
347 //EDPD Control register
348 #define KSZ9031_EDPD_CTRL_EDPD_MODE_EN 0x0001
349 
350 //C++ guard
351 #ifdef __cplusplus
352 extern "C" {
353 #endif
354 
355 //KSZ9031 Ethernet PHY driver
356 extern const PhyDriver ksz9031PhyDriver;
357 
358 //KSZ9031 related functions
359 error_t ksz9031Init(NetInterface *interface);
360 void ksz9031InitHook(NetInterface *interface);
361 
362 void ksz9031Tick(NetInterface *interface);
363 
364 void ksz9031EnableIrq(NetInterface *interface);
365 void ksz9031DisableIrq(NetInterface *interface);
366 
367 void ksz9031EventHandler(NetInterface *interface);
368 
369 void ksz9031WritePhyReg(NetInterface *interface, uint8_t address,
370  uint16_t data);
371 
372 uint16_t ksz9031ReadPhyReg(NetInterface *interface, uint8_t address);
373 
374 void ksz9031DumpPhyReg(NetInterface *interface);
375 
376 void ksz9031WriteMmdReg(NetInterface *interface, uint8_t devAddr,
377  uint16_t regAddr, uint16_t data);
378 
379 uint16_t ksz9031ReadMmdReg(NetInterface *interface, uint8_t devAddr,
380  uint16_t regAddr);
381 
382 //C++ guard
383 #ifdef __cplusplus
384 }
385 #endif
386 
387 #endif
error_t
Error codes.
Definition: error.h:43
uint8_t data[]
Definition: ethernet.h:222
Ipv6Addr address[]
Definition: ipv6.h:316
void ksz9031InitHook(NetInterface *interface)
KSZ9031 custom configuration.
void ksz9031DisableIrq(NetInterface *interface)
Disable interrupts.
void ksz9031Tick(NetInterface *interface)
KSZ9031 timer handler.
uint16_t ksz9031ReadPhyReg(NetInterface *interface, uint8_t address)
Read PHY register.
void ksz9031EnableIrq(NetInterface *interface)
Enable interrupts.
void ksz9031WriteMmdReg(NetInterface *interface, uint8_t devAddr, uint16_t regAddr, uint16_t data)
Write MMD register.
uint16_t ksz9031ReadMmdReg(NetInterface *interface, uint8_t devAddr, uint16_t regAddr)
Read MMD register.
void ksz9031DumpPhyReg(NetInterface *interface)
Dump PHY registers for debugging purpose.
const PhyDriver ksz9031PhyDriver
KSZ9031 Ethernet PHY driver.
void ksz9031WritePhyReg(NetInterface *interface, uint8_t address, uint16_t data)
Write PHY register.
error_t ksz9031Init(NetInterface *interface)
KSZ9031 PHY transceiver initialization.
void ksz9031EventHandler(NetInterface *interface)
KSZ9031 event handler.
uint16_t regAddr
#define NetInterface
Definition: net.h:36
Network interface controller abstraction layer.
Ethernet PHY driver.
Definition: nic.h:308