dp83826_driver.h
Go to the documentation of this file.
1 /**
2  * @file dp83826_driver.h
3  * @brief DP83826 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.4
29  **/
30 
31 #ifndef _DP83826_DRIVER_H
32 #define _DP83826_DRIVER_H
33 
34 //Dependencies
35 #include "core/nic.h"
36 
37 //PHY address
38 #ifndef DP83826_PHY_ADDR
39  #define DP83826_PHY_ADDR 0
40 #elif (DP83826_PHY_ADDR < 0 || DP83826_PHY_ADDR > 31)
41  #error DP83826_PHY_ADDR parameter is not valid
42 #endif
43 
44 //DP83826 PHY registers
45 #define DP83826_BMCR 0x00
46 #define DP83826_BMSR 0x01
47 #define DP83826_PHYIDR1 0x02
48 #define DP83826_PHYIDR2 0x03
49 #define DP83826_ANAR 0x04
50 #define DP83826_ANLPAR 0x05
51 #define DP83826_ANER 0x06
52 #define DP83826_ANNPTR 0x07
53 #define DP83826_ANLNPTR 0x08
54 #define DP83826_CR1 0x09
55 #define DP83826_CR2 0x0A
56 #define DP83826_CR3 0x0B
57 #define DP83826_REG_12 0x0C
58 #define DP83826_REGCR 0x0D
59 #define DP83826_ADDAR 0x0E
60 #define DP83826_FLDS 0x0F
61 #define DP83826_PHYSTS 0x10
62 #define DP83826_PHYSCR 0x11
63 #define DP83826_MISR1 0x12
64 #define DP83826_MISR2 0x13
65 #define DP83826_FCSCR 0x14
66 #define DP83826_RECR 0x15
67 #define DP83826_BISCR 0x16
68 #define DP83826_RCSR 0x17
69 #define DP83826_LEDCR 0x18
70 #define DP83826_PHYCR 0x19
71 #define DP83826_10BTSCR 0x1A
72 #define DP83826_BICSR1 0x1B
73 #define DP83826_BICSR2 0x1C
74 #define DP83826_CDCR 0x1E
75 #define DP83826_PHYRCR 0x1F
76 
77 //DP83826 MMD registers
78 #define DP83826_MMD7_EEE_ADVERTISEMENT 0x07, 0x203C
79 #define DP83826_MLEDCR 0x1F, 0x0025
80 #define DP83826_COMPT 0x1F, 0x0027
81 #define DP83826_10M_CFG 0x1F, 0x002A
82 #define DP83826_FLD_CFG1 0x1F, 0x0117
83 #define DP83826_REG_123 0x1F, 0x0123
84 #define DP83826_FLD_CFG2 0x1F, 0x0131
85 #define DP83826_CDSCR 0x1F, 0x0170
86 #define DP83826_CDSCR2 0x1F, 0x0171
87 #define DP83826_TDR_172 0x1F, 0x0172
88 #define DP83826_CDSCR3 0x1F, 0x0173
89 #define DP83826_TDR_174 0x1F, 0x0174
90 #define DP83826_TDR_175 0x1F, 0x0175
91 #define DP83826_TDR_176 0x1F, 0x0176
92 #define DP83826_CDSCR4 0x1F, 0x0177
93 #define DP83826_TDR_178 0x1F, 0x0178
94 #define DP83826_CDLRR1 0x1F, 0x0180
95 #define DP83826_CDLRR2 0x1F, 0x0181
96 #define DP83826_CDLRR3 0x1F, 0x0182
97 #define DP83826_CDLRR4 0x1F, 0x0183
98 #define DP83826_CDLRR5 0x1F, 0x0184
99 #define DP83826_CDLAR1 0x1F, 0x0185
100 #define DP83826_CDLAR2 0x1F, 0x0186
101 #define DP83826_CDLAR3 0x1F, 0x0187
102 #define DP83826_CDLAR4 0x1F, 0x0188
103 #define DP83826_CDLAR5 0x1F, 0x0189
104 #define DP83826_CDLAR6 0x1F, 0x018A
105 #define DP83826_IO_CFG1 0x1F, 0x0302
106 #define DP83826_LED0_GPIO_CFG 0x1F, 0x0303
107 #define DP83826_LED1_GPIO_CFG 0x1F, 0x0304
108 #define DP83826_LED2_GPIO_CFG 0x1F, 0x0305
109 #define DP83826_LED3_GPIO_CFG 0x1F, 0x0306
110 #define DP83826_CLK_OUT_LED_STATUS 0x1F, 0x0308
111 #define DP83826_VOD_CFG1 0x1F, 0x030B
112 #define DP83826_VOD_CFG2 0x1F, 0x030C
113 #define DP83826_VOD_CFG3 0x1F, 0x030E
114 #define DP83826_DSP_CFG_12 0x1F, 0x031B
115 #define DP83826_DSP_CFG_16 0x1F, 0x031F
116 #define DP83826_DSP_CFG_27 0x1F, 0x033E
117 #define DP83826_DSP_CFG_28 0x1F, 0x033F
118 #define DP83826_ANA_LD_PROG_SL 0x1F, 0x0404
119 #define DP83826_ANA_RX10BT_CTRL 0x1F, 0x040D
120 #define DP83826_REG_416 0x1F, 0x0416
121 #define DP83826_GENCFG 0x1F, 0x0456
122 #define DP83826_LEDCFG 0x1F, 0x0460
123 #define DP83826_IOCTRL 0x1F, 0x0461
124 #define DP83826_REG_466 0x1F, 0x0466
125 #define DP83826_SOR1 0x1F, 0x0467
126 #define DP83826_SOR2 0x1F, 0x0468
127 #define DP83826_LEDCFG2 0x1F, 0x0469
128 #define DP83826_RXFCFG1 0x1F, 0x04A0
129 #define DP83826_RXFS 0x1F, 0x04A1
130 #define DP83826_RXFPMD1 0x1F, 0x04A2
131 #define DP83826_RXFPMD2 0x1F, 0x04A3
132 #define DP83826_RXFPMD3 0x1F, 0x04A4
133 #define DP83826_RXFSOP1 0x1F, 0x04A5
134 #define DP83826_RXFSOP2 0x1F, 0x04A6
135 #define DP83826_RXFSOP3 0x1F, 0x04A7
136 #define DP83826_REG_4CF 0x1F, 0x04CF
137 #define DP83826_EEECFG3 0x1F, 0x04D1
138 #define DP83826_REG_4DF 0x1F, 0x04DF
139 #define DP83826_REG_4E0 0x1F, 0x04E0
140 #define DP83826_REG_4F3 0x1F, 0x04F3
141 #define DP83826_REG_4F4 0x1F, 0x04F4
142 #define DP83826_REG_4F5 0x1F, 0x04F5
143 
144 //BMCR register
145 #define DP83826_BMCR_RESET 0x8000
146 #define DP83826_BMCR_LOOPBACK 0x4000
147 #define DP83826_BMCR_SPEED_SEL 0x2000
148 #define DP83826_BMCR_AN_EN 0x1000
149 #define DP83826_BMCR_POWER_DOWN 0x0800
150 #define DP83826_BMCR_ISOLATE 0x0400
151 #define DP83826_BMCR_RESTART_AN 0x0200
152 #define DP83826_BMCR_DUPLEX_MODE 0x0100
153 #define DP83826_BMCR_COL_TEST 0x0080
154 
155 //BMSR register
156 #define DP83826_BMSR_100BT4 0x8000
157 #define DP83826_BMSR_100BTX_FD 0x4000
158 #define DP83826_BMSR_100BTX_HD 0x2000
159 #define DP83826_BMSR_10BT_FD 0x1000
160 #define DP83826_BMSR_10BT_HD 0x0800
161 #define DP83826_BMSR_SMI_PREAMBLE_SUPPR 0x0040
162 #define DP83826_BMSR_AN_COMPLETE 0x0020
163 #define DP83826_BMSR_REMOTE_FAULT 0x0010
164 #define DP83826_BMSR_AN_CAPABLE 0x0008
165 #define DP83826_BMSR_LINK_STATUS 0x0004
166 #define DP83826_BMSR_JABBER_DETECT 0x0002
167 #define DP83826_BMSR_EXTENDED_CAPABLE 0x0001
168 
169 //PHYIDR1 register
170 #define DP83826_PHYIDR1_OUI_MSB 0xFFFF
171 #define DP83826_PHYIDR1_OUI_MSB_DEFAULT 0x2000
172 
173 //PHYIDR2 register
174 #define DP83826_PHYIDR2_OUI_LSB 0xFC00
175 #define DP83826_PHYIDR2_OUI_LSB_DEFAULT 0xA000
176 #define DP83826_PHYIDR2_MODEL_NUMBER 0x03F0
177 #define DP83826_PHYIDR2_MODEL_NUMBER_DEFAULT 0x0130
178 #define DP83826_PHYIDR2_REV_NUMBER 0x000F
179 
180 //ANAR register
181 #define DP83826_ANAR_NEXT_PAGE 0x8000
182 #define DP83826_ANAR_REMOTE_FAULT 0x2000
183 #define DP83826_ANAR_ASYM_DIR 0x0800
184 #define DP83826_ANAR_PAUSE 0x0400
185 #define DP83826_ANAR_100BT4 0x0200
186 #define DP83826_ANAR_100BTX_FD 0x0100
187 #define DP83826_ANAR_100BTX_HD 0x0080
188 #define DP83826_ANAR_10BT_FD 0x0040
189 #define DP83826_ANAR_10BT_HD 0x0020
190 #define DP83826_ANAR_SELECTOR 0x001F
191 #define DP83826_ANAR_SELECTOR_DEFAULT 0x0001
192 
193 //ANLPAR register
194 #define DP83826_ANLPAR_NEXT_PAGE 0x8000
195 #define DP83826_ANLPAR_ACK 0x4000
196 #define DP83826_ANLPAR_REMOTE_FAULT 0x2000
197 #define DP83826_ANLPAR_ASYM_DIR 0x0800
198 #define DP83826_ANLPAR_PAUSE 0x0400
199 #define DP83826_ANLPAR_100BT4 0x0200
200 #define DP83826_ANLPAR_100BTX_FD 0x0100
201 #define DP83826_ANLPAR_100BTX_HD 0x0080
202 #define DP83826_ANLPAR_10BT_FD 0x0040
203 #define DP83826_ANLPAR_10BT_HD 0x0020
204 #define DP83826_ANLPAR_SELECTOR 0x001F
205 #define DP83826_ANLPAR_SELECTOR_DEFAULT 0x0001
206 
207 //ANER register
208 #define DP83826_ANER_PAR_DETECT_FAULT 0x0010
209 #define DP83826_ANER_LP_NEXT_PAGE_ABLE 0x0008
210 #define DP83826_ANER_NEXT_PAGE_ABLE 0x0004
211 #define DP83826_ANER_PAGE_RECEIVED 0x0002
212 #define DP83826_ANER_LP_AN_ABLE 0x0001
213 
214 //ANNPTR register
215 #define DP83826_ANNPTR_NEXT_PAGE 0x8000
216 #define DP83826_ANNPTR_MSG_PAGE 0x2000
217 #define DP83826_ANNPTR_ACK2 0x1000
218 #define DP83826_ANNPTR_TOGGLE 0x0800
219 #define DP83826_ANNPTR_CODE 0x07FF
220 
221 //ANLNPTR register
222 #define DP83826_ANLNPTR_NEXT_PAGE 0x8000
223 #define DP83826_ANLNPTR_ACK 0x4000
224 #define DP83826_ANLNPTR_MSG_PAGE 0x2000
225 #define DP83826_ANLNPTR_ACK2 0x1000
226 #define DP83826_ANLNPTR_TOGGLE 0x0800
227 #define DP83826_ANLNPTR_MESSAGE 0x07FF
228 
229 //CR1 register
230 #define DP83826_CR1_TDR_AUTO_RUN 0x0100
231 #define DP83826_CR1_ROBUST_AUTO_MDIX 0x0020
232 #define DP83826_CR1_FAST_RX_DV_DETECT 0x0002
233 
234 //CR2 register
235 #define DP83826_CR2_EXTENDED_FD_ABLE 0x0020
236 #define DP83826_CR2_RX_ER_DURING_IDLE 0x0004
237 #define DP83826_CR2_ODD_NIBBLE_DETECT_DIS 0x0002
238 
239 //CR3 register
240 #define DP83826_CR3_DESCRAMBLER_FAST_LINK_DOWN 0x0400
241 #define DP83826_CR3_POLARITY_SWAP 0x0040
242 #define DP83826_CR3_MDIX_SWAP 0x0020
243 #define DP83826_CR3_FAST_LINK_DOWN_MODE 0x000F
244 
245 //REGCR register
246 #define DP83826_REGCR_CMD 0xC000
247 #define DP83826_REGCR_CMD_ADDR 0x0000
248 #define DP83826_REGCR_CMD_DATA_NO_POST_INC 0x4000
249 #define DP83826_REGCR_CMD_DATA_POST_INC_RW 0x8000
250 #define DP83826_REGCR_CMD_DATA_POST_INC_W 0xC000
251 #define DP83826_REGCR_DEVAD 0x001F
252 
253 //FLDS register
254 #define DP83826_FLDS_FAST_LINK_DOWN_STATUS 0x01F0
255 
256 //PHYSTS register
257 #define DP83826_PHYSTS_MDIX_MODE 0x4000
258 #define DP83826_PHYSTS_RECEIVE_ERROR_LATCH 0x2000
259 #define DP83826_PHYSTS_POLARITY_STATUS 0x1000
260 #define DP83826_PHYSTS_FALSE_CARRIER_SENSE_LATCH 0x0800
261 #define DP83826_PHYSTS_SIGNAL_DETECT 0x0400
262 #define DP83826_PHYSTS_DESCRAMBLER_LOCK 0x0200
263 #define DP83826_PHYSTS_PAGE_RECEIVED 0x0100
264 #define DP83826_PHYSTS_MII_INTERRUPT 0x0080
265 #define DP83826_PHYSTS_REMOTE_FAULT 0x0040
266 #define DP83826_PHYSTS_JABBER_DETECT 0x0020
267 #define DP83826_PHYSTS_AN_STATUS 0x0010
268 #define DP83826_PHYSTS_LOOPBACK_STATUS 0x0008
269 #define DP83826_PHYSTS_DUPLEX_STATUS 0x0004
270 #define DP83826_PHYSTS_SPEED_STATUS 0x0002
271 #define DP83826_PHYSTS_LINK_STATUS 0x0001
272 
273 //PHYSCR register
274 #define DP83826_PHYSCR_PLL_DIS 0x8000
275 #define DP83826_PHYSCR_POWER_SAVE_MODE_EN 0x4000
276 #define DP83826_PHYSCR_POWER_SAVE_MODE 0x3000
277 #define DP83826_PHYSCR_SCRAMBLER_BYPASS 0x0800
278 #define DP83826_PHYSCR_LOOPBACK_FIFO_DEPTH 0x0300
279 #define DP83826_PHYSCR_COL_FD_EN 0x0010
280 #define DP83826_PHYSCR_INT_POLARITY 0x0008
281 #define DP83826_PHYSCR_TEST_INT 0x0004
282 #define DP83826_PHYSCR_INT_EN 0x0002
283 #define DP83826_PHYSCR_INT_OE 0x0001
284 
285 //MISR1 register
286 #define DP83826_MISR1_LQ_INT 0x8000
287 #define DP83826_MISR1_ED_INT 0x4000
288 #define DP83826_MISR1_LINK_INT 0x2000
289 #define DP83826_MISR1_SPD_INT 0x1000
290 #define DP83826_MISR1_DUP_INT 0x0800
291 #define DP83826_MISR1_ANC_INT 0x0400
292 #define DP83826_MISR1_FHF_INT 0x0200
293 #define DP83826_MISR1_RHF_INT 0x0100
294 #define DP83826_MISR1_LQ_INT_EN 0x0080
295 #define DP83826_MISR1_ED_INT_EN 0x0040
296 #define DP83826_MISR1_LINK_INT_EN 0x0020
297 #define DP83826_MISR1_SPD_INT_EN 0x0010
298 #define DP83826_MISR1_DUP_INT_EN 0x0008
299 #define DP83826_MISR1_ANC_INT_EN 0x0004
300 #define DP83826_MISR1_FHF_INT_EN 0x0002
301 #define DP83826_MISR1_RHF_INT_EN 0x0001
302 
303 //MISR2 register
304 #define DP83826_MISR2_EEE_ERROR_INT 0x8000
305 #define DP83826_MISR2_AN_ERROR_INT 0x4000
306 #define DP83826_MISR2_PR_INT 0x2000
307 #define DP83826_MISR2_FIFO_OF_UF_INT 0x1000
308 #define DP83826_MISR2_MDI_CHANGE_INT 0x0800
309 #define DP83826_MISR2_SLEEP_MODE_INT 0x0400
310 #define DP83826_MISR2_POL_CHANGE_INT 0x0200
311 #define DP83826_MISR2_JABBER_DETECT_INT 0x0100
312 #define DP83826_MISR2_EEE_ERROR_INT_EN 0x0080
313 #define DP83826_MISR2_AN_ERROR_INT_EN 0x0040
314 #define DP83826_MISR2_PR_INT_EN 0x0020
315 #define DP83826_MISR2_FIFO_OF_UF_INT_EN 0x0010
316 #define DP83826_MISR2_MDI_CHANGE_INT_EN 0x0008
317 #define DP83826_MISR2_SLEEP_MODE_INT_EN 0x0004
318 #define DP83826_MISR2_POL_CHANGE_INT_EN 0x0002
319 #define DP83826_MISR2_JABBER_DETECT_INT_EN 0x0001
320 
321 //FCSCR register
322 #define DP83826_FCSCR_FCSCNT 0x00FF
323 
324 //RECR register
325 #define DP83826_RECR_RXERCNT 0xFFFF
326 
327 //BISCR register
328 #define DP83826_BISCR_ERROR_COUNTER_MODE 0x4000
329 #define DP83826_BISCR_PRBS_CHECKER 0x2000
330 #define DP83826_BISCR_PACKET_GEN_EN 0x1000
331 #define DP83826_BISCR_PRBS_CHECKER_LOCK_SYNC 0x0800
332 #define DP83826_BISCR_PRBS_CHECKER_SYNC_LOSS 0x0400
333 #define DP83826_BISCR_PACKET_GEN_STATUS 0x0200
334 #define DP83826_BISCR_POWER_MODE 0x0100
335 #define DP83826_BISCR_TX_MII_LOOPBACK 0x0040
336 #define DP83826_BISCR_LOOPBACK_MODE 0x001F
337 #define DP83826_BISCR_LOOPBACK_MODE_PCS_INPUT 0x0001
338 #define DP83826_BISCR_LOOPBACK_MODE_PCS_OUTPUT 0x0002
339 #define DP83826_BISCR_LOOPBACK_MODE_DIGITAL 0x0004
340 #define DP83826_BISCR_LOOPBACK_MODE_ANALOG 0x0008
341 #define DP83826_BISCR_LOOPBACK_MODE_REVERSE 0x0010
342 
343 //RCSR register
344 #define DP83826_RCSR_RMII_TX_CLOCK_SHIFT 0x0100
345 #define DP83826_RCSR_RMII_CLK_SEL 0x0080
346 #define DP83826_RCSR_RMII_REV_SEL 0x0010
347 #define DP83826_RCSR_RMII_OVF_STATUS 0x0008
348 #define DP83826_RCSR_RMII_UNF_STATUS 0x0004
349 #define DP83826_RCSR_RX_ELAST_BUFFER_SIZE 0x0003
350 #define DP83826_RCSR_RX_ELAST_BUFFER_SIZE_14_BITS 0x0000
351 #define DP83826_RCSR_RX_ELAST_BUFFER_SIZE_2_BITS 0x0001
352 #define DP83826_RCSR_RX_ELAST_BUFFER_SIZE_6_BITS 0x0002
353 #define DP83826_RCSR_RX_ELAST_BUFFER_SIZE_10_BITS 0x0003
354 
355 //LEDCR register
356 #define DP83826_LEDCR_BLINK_RATE 0x0600
357 #define DP83826_LEDCR_BLINK_RATE_20MHZ 0x0000
358 #define DP83826_LEDCR_BLINK_RATE_10MHZ 0x0200
359 #define DP83826_LEDCR_BLINK_RATE_5MHZ 0x0400
360 #define DP83826_LEDCR_BLINK_RATE_2MHZ 0x0600
361 #define DP83826_LEDCR_LED_LINK_POLARITY 0x0080
362 #define DP83826_LEDCR_DRIVE_LINK_LED 0x0010
363 #define DP83826_LEDCR_LINK_LED_ON_OFF 0x0002
364 
365 //PHYCR register
366 #define DP83826_PHYCR_MDIX_EN 0x8000
367 #define DP83826_PHYCR_FORCE_MDIX 0x4000
368 #define DP83826_PHYCR_PAUSE_RX_STATUS 0x2000
369 #define DP83826_PHYCR_PAUSE_TX_STATUS 0x1000
370 #define DP83826_PHYCR_MII_LINK_STATUS 0x0800
371 #define DP83826_PHYCR_BYPASS_LED_STRETCH 0x0080
372 #define DP83826_PHYCR_LED_CONFIG 0x0020
373 #define DP83826_PHYCR_PHY_ADDR 0x001F
374 
375 //10BTSCR register
376 #define DP83826_10BTSCR_RX_THRESHOLD_EN 0x2000
377 #define DP83826_10BTSCR_SQUELCH 0x1E00
378 #define DP83826_10BTSCR_SQUELCH_200MV 0x0000
379 #define DP83826_10BTSCR_SQUELCH_250MV 0x0200
380 #define DP83826_10BTSCR_SQUELCH_300MV 0x0400
381 #define DP83826_10BTSCR_SQUELCH_350MV 0x0600
382 #define DP83826_10BTSCR_SQUELCH_400MV 0x0800
383 #define DP83826_10BTSCR_SQUELCH_450MV 0x0A00
384 #define DP83826_10BTSCR_SQUELCH_500MV 0x0C00
385 #define DP83826_10BTSCR_SQUELCH_550MV 0x0E00
386 #define DP83826_10BTSCR_SQUELCH_600MV 0x1000
387 #define DP83826_10BTSCR_NLP_DIS 0x0080
388 #define DP83826_10BTSCR_POLARITY_STATUS 0x0010
389 #define DP83826_10BTSCR_JABBER_DIS 0x0001
390 
391 //BICSR1 register
392 #define DP83826_BICSR1_BIST_ERROR_COUNT 0xFF00
393 #define DP83826_BICSR1_BIST_IPG_LENGTH 0x00FF
394 
395 //BICSR2 register
396 #define DP83826_BICSR2_BIST_PACKET_LENGTH 0x07FF
397 
398 //CDCR register
399 #define DP83826_CDCR_CABLE_DIAG_START 0x8000
400 #define DP83826_CDCR_CFG_RESCAL_EN 0x4000
401 #define DP83826_CDCR_CDCR_CABLE_DIAG_STATUS 0x0002
402 #define DP83826_CDCR_CDCR_CABLE_DIAG_TEST_FAIL 0x0001
403 
404 //PHYRCR register
405 #define DP83826_PHYRCR_SOFT_HARD_RESET 0x8000
406 #define DP83826_PHYRCR_DIGITAL_RESET 0x4000
407 
408 //MLEDCR register
409 #define DP83826_MLEDCR_MLED_POLARITY_SWAP 0x0200
410 #define DP83826_MLEDCR_LED0_CONFIG 0x0078
411 #define DP83826_MLEDCR_LED0_CONFIG_LINK 0x0000
412 #define DP83826_MLEDCR_LED0_CONFIG_ACT 0x0008
413 #define DP83826_MLEDCR_LED0_CONFIG_TX_ACT 0x0010
414 #define DP83826_MLEDCR_LED0_CONFIG_RX_ACT 0x0018
415 #define DP83826_MLEDCR_LED0_CONFIG_COL 0x0020
416 #define DP83826_MLEDCR_LED0_CONFIG_SPEED_100 0x0028
417 #define DP83826_MLEDCR_LED0_CONFIG_SPEED_10 0x0030
418 #define DP83826_MLEDCR_LED0_CONFIG_FD 0x0038
419 #define DP83826_MLEDCR_LED0_CONFIG_LINK_ACT 0x0040
420 #define DP83826_MLEDCR_LED0_CONFIG_ACT_STRETCH_SIG 0x0048
421 #define DP83826_MLEDCR_LED0_CONFIG_MII_LINK 0x0050
422 #define DP83826_MLEDCR_LED0_CONFIG_LPI_MODE 0x0058
423 #define DP83826_MLEDCR_LED0_CONFIG_MII_ERR 0x0060
424 #define DP83826_MLEDCR_LED0_CONFIG_LINK_LOST 0x0068
425 #define DP83826_MLEDCR_LED0_CONFIG_PRBS_ERR 0x0070
426 #define DP83826_MLEDCR_CFG_MLED_EN 0x0001
427 
428 //C++ guard
429 #ifdef __cplusplus
430 extern "C" {
431 #endif
432 
433 //DP83826 Ethernet PHY driver
434 extern const PhyDriver dp83826PhyDriver;
435 
436 //DP83826 related functions
437 error_t dp83826Init(NetInterface *interface);
438 void dp83826InitHook(NetInterface *interface);
439 
440 void dp83826Tick(NetInterface *interface);
441 
442 void dp83826EnableIrq(NetInterface *interface);
443 void dp83826DisableIrq(NetInterface *interface);
444 
445 void dp83826EventHandler(NetInterface *interface);
446 
447 void dp83826WritePhyReg(NetInterface *interface, uint8_t address,
448  uint16_t data);
449 
450 uint16_t dp83826ReadPhyReg(NetInterface *interface, uint8_t address);
451 
452 void dp83826DumpPhyReg(NetInterface *interface);
453 
454 void dp83826WriteMmdReg(NetInterface *interface, uint8_t devAddr,
455  uint16_t regAddr, uint16_t data);
456 
457 uint16_t dp83826ReadMmdReg(NetInterface *interface, uint8_t devAddr,
458  uint16_t regAddr);
459 
460 //C++ guard
461 #ifdef __cplusplus
462 }
463 #endif
464 
465 #endif
uint16_t dp83826ReadMmdReg(NetInterface *interface, uint8_t devAddr, uint16_t regAddr)
Read MMD register.
Ethernet PHY driver.
Definition: nic.h:311
uint8_t data[]
Definition: ethernet.h:222
void dp83826WritePhyReg(NetInterface *interface, uint8_t address, uint16_t data)
Write PHY register.
error_t
Error codes.
Definition: error.h:43
void dp83826DumpPhyReg(NetInterface *interface)
Dump PHY registers for debugging purpose.
uint16_t dp83826ReadPhyReg(NetInterface *interface, uint8_t address)
Read PHY register.
#define NetInterface
Definition: net.h:36
void dp83826WriteMmdReg(NetInterface *interface, uint8_t devAddr, uint16_t regAddr, uint16_t data)
Write MMD register.
void dp83826Tick(NetInterface *interface)
DP83826 timer handler.
const PhyDriver dp83826PhyDriver
DP83826 Ethernet PHY driver.
uint16_t regAddr
void dp83826DisableIrq(NetInterface *interface)
Disable interrupts.
void dp83826InitHook(NetInterface *interface)
DP83826 custom configuration.
error_t dp83826Init(NetInterface *interface)
DP83826 PHY transceiver initialization.
Ipv6Addr address[]
Definition: ipv6.h:325
Network interface controller abstraction layer.
void dp83826EnableIrq(NetInterface *interface)
Enable interrupts.
void dp83826EventHandler(NetInterface *interface)
DP83826 event handler.