dp83tc811_driver.h
Go to the documentation of this file.
1 /**
2  * @file dp83tc811_driver.h
3  * @brief DP83TC811 100Base-T1 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 _DP83TC811_DRIVER_H
32 #define _DP83TC811_DRIVER_H
33 
34 //Dependencies
35 #include "core/nic.h"
36 
37 //PHY address
38 #ifndef DP83TC811_PHY_ADDR
39  #define DP83TC811_PHY_ADDR 0
40 #elif (DP83TC811_PHY_ADDR < 0 || DP83TC811_PHY_ADDR > 31)
41  #error DP83TC811_PHY_ADDR parameter is not valid
42 #endif
43 
44 //DP83TC811 PHY registers
45 #define DP83TC811_BMCR 0x00
46 #define DP83TC811_BMSR 0x01
47 #define DP83TC811_PHYID1 0x02
48 #define DP83TC811_PHYID2 0x03
49 #define DP83TC811_TDR_AUTO 0x09
50 #define DP83TC811_REGCR 0x0D
51 #define DP83TC811_ADDAR 0x0E
52 #define DP83TC811_INT_TEST 0x11
53 #define DP83TC811_INT_STAT1 0x12
54 #define DP83TC811_INT_STAT2 0x13
55 #define DP83TC811_FCSCR 0x14
56 #define DP83TC811_RECR 0x15
57 #define DP83TC811_BISTCR 0x16
58 #define DP83TC811_XMII_CTRL 0x17
59 #define DP83TC811_INT_STAT3 0x18
60 #define DP83TC811_BICTSR1 0x1B
61 #define DP83TC811_BICTSR2 0x1C
62 #define DP83TC811_TDR 0x1E
63 #define DP83TC811_PHYRCR 0x1F
64 
65 //DP83TC811 MMD registers
66 #define DP83TC811_PMA_CTRL1 0x01, 0x0007
67 #define DP83TC811_PMA_EXT1 0x01, 0x000B
68 #define DP83TC811_PMA_EXT2 0x01, 0x0012
69 #define DP83TC811_PMA_CTRL2 0x01, 0x0834
70 #define DP83TC811_TEST_CTRL 0x01, 0x0836
71 #define DP83TC811_LSR 0x1F, 0x0133
72 #define DP83TC811_TDRR 0x1F, 0x016B
73 #define DP83TC811_TDRLR1 0x1F, 0x0180
74 #define DP83TC811_TDRLR2 0x1F, 0x0181
75 #define DP83TC811_TDRPT 0x1F, 0x018A
76 #define DP83TC811_AUTO_PHY 0x1F, 0x018B
77 #define DP83TC811_PWRM 0x1F, 0x018C
78 #define DP83TC811_SNR 0x1F, 0x0197
79 #define DP83TC811_SQI 0x1F, 0x0198
80 #define DP83TC811_LD_CTRL 0x1F, 0x0400
81 #define DP83TC811_LDG_CTRL1 0x1F, 0x0401
82 #define DP83TC811_DLL_CTRL 0x1F, 0x0446
83 #define DP83TC811_ESDS 0x1F, 0x0448
84 #define DP83TC811_LED_CFG1 0x1F, 0x0460
85 #define DP83TC811_XMII_IMP_CTRL 0x1F, 0x0461
86 #define DP83TC811_IO_CTRL1 0x1F, 0x0462
87 #define DP83TC811_IO_CTRL2 0x1F, 0x0463
88 #define DP83TC811_STRAP 0x1F, 0x0467
89 #define DP83TC811_LED_CFG2 0x1F, 0x0469
90 #define DP83TC811_PLR_CFG 0x1F, 0x0475
91 #define DP83TC811_MON_CFG1 0x1F, 0x0480
92 #define DP83TC811_MON_CFG2 0x1F, 0x0481
93 #define DP83TC811_MON_CFG3 0x1F, 0x0482
94 #define DP83TC811_MON_STAT1 0x1F, 0x0483
95 #define DP83TC811_MON_STAT2 0x1F, 0x0484
96 #define DP83TC811_PCS_CTRL1 0x1F, 0x0485
97 #define DP83TC811_PCS_CTRL2 0x1F, 0x0486
98 #define DP83TC811_LPS_CTRL2 0x1F, 0x0487
99 #define DP83TC811_INTER_CFG 0x1F, 0x0489
100 #define DP83TC811_LPS_CTRL3 0x1F, 0x0493
101 #define DP83TC811_LPS_CTRL3 0x1F, 0x0493
102 #define DP83TC811_JAB_CFG 0x1F, 0x0496
103 #define DP83TC811_TEST_MODE_CTRL 0x1F, 0x0497
104 #define DP83TC811_WOL_CFG 0x1F, 0x04A0
105 #define DP83TC811_WOL_STAT 0x1F, 0x04A1
106 #define DP83TC811_WOL_DA1 0x1F, 0x04A2
107 #define DP83TC811_WOL_DA2 0x1F, 0x04A3
108 #define DP83TC811_WOL_DA3 0x1F, 0x04A4
109 #define DP83TC811_RXSOP1 0x1F, 0x04A5
110 #define DP83TC811_RXSOP2 0x1F, 0x04A6
111 #define DP83TC811_RXSOP3 0x1F, 0x04A7
112 #define DP83TC811_RXPAT1 0x1F, 0x04A8
113 #define DP83TC811_RXPAT2 0x1F, 0x04A9
114 #define DP83TC811_RXPAT3 0x1F, 0x04AA
115 #define DP83TC811_RXPAT4 0x1F, 0x04AB
116 #define DP83TC811_RXPAT5 0x1F, 0x04AC
117 #define DP83TC811_RXPAT6 0x1F, 0x04AD
118 #define DP83TC811_RXPAT7 0x1F, 0x04AE
119 #define DP83TC811_RXPAT8 0x1F, 0x04AF
120 #define DP83TC811_RXPAT9 0x1F, 0x04B0
121 #define DP83TC811_RXPAT10 0x1F, 0x04B1
122 #define DP83TC811_RXPAT11 0x1F, 0x04B2
123 #define DP83TC811_RXPAT12 0x1F, 0x04B3
124 #define DP83TC811_RXPAT13 0x1F, 0x04B4
125 #define DP83TC811_RXPAT14 0x1F, 0x04B5
126 #define DP83TC811_RXPAT15 0x1F, 0x04B6
127 #define DP83TC811_RXPAT16 0x1F, 0x04B7
128 #define DP83TC811_RXPAT17 0x1F, 0x04B8
129 #define DP83TC811_RXPAT18 0x1F, 0x04B9
130 #define DP83TC811_RXPAT19 0x1F, 0x04BA
131 #define DP83TC811_RXPAT20 0x1F, 0x04BB
132 #define DP83TC811_RXPAT21 0x1F, 0x04BC
133 #define DP83TC811_RXPAT22 0x1F, 0x04BD
134 #define DP83TC811_RXPAT23 0x1F, 0x04BE
135 #define DP83TC811_RXPAT24 0x1F, 0x04BF
136 #define DP83TC811_RXPAT25 0x1F, 0x04C0
137 #define DP83TC811_RXPAT26 0x1F, 0x04C1
138 #define DP83TC811_RXPAT27 0x1F, 0x04C2
139 #define DP83TC811_RXPAT28 0x1F, 0x04C3
140 #define DP83TC811_RXPAT29 0x1F, 0x04C4
141 #define DP83TC811_RXPAT30 0x1F, 0x04C5
142 #define DP83TC811_RXPAT31 0x1F, 0x04C6
143 #define DP83TC811_RXPAT32 0x1F, 0x04C7
144 #define DP83TC811_RXPBM1 0x1F, 0x04C8
145 #define DP83TC811_RXPBM2 0x1F, 0x04C9
146 #define DP83TC811_RXPBM3 0x1F, 0x04CA
147 #define DP83TC811_RXPBM4 0x1F, 0x04CB
148 #define DP83TC811_RXPATC 0x1F, 0x04CC
149 #define DP83TC811_RXD3CLK 0x1F, 0x04E0
150 #define DP83TC811_LPS_CFG 0x1F, 0x04E5
151 
152 //Basic Mode Control register
153 #define DP83TC811_BMCR_RESET 0x8000
154 #define DP83TC811_BMCR_LOOPBACK 0x4000
155 #define DP83TC811_BMCR_SPEED_SEL 0x2000
156 #define DP83TC811_BMCR_AN_EN 0x1000
157 #define DP83TC811_BMCR_POWER_DOWN 0x0800
158 #define DP83TC811_BMCR_ISOLATE 0x0400
159 
160 //Basic Mode Status register
161 #define DP83TC811_BMSR_100BT4 0x8000
162 #define DP83TC811_BMSR_100BTX_FD 0x4000
163 #define DP83TC811_BMSR_100BTX_HD 0x2000
164 #define DP83TC811_BMSR_10BT_FD 0x1000
165 #define DP83TC811_BMSR_10BT_HD 0x0800
166 #define DP83TC811_BMSR_SMI_PREAMBLE_SUPPR 0x0040
167 #define DP83TC811_BMSR_AN_COMPLETE 0x0020
168 #define DP83TC811_BMSR_REMOTE_FAULT 0x0010
169 #define DP83TC811_BMSR_AN_CAPABLE 0x0008
170 #define DP83TC811_BMSR_LINK_STATUS 0x0004
171 #define DP83TC811_BMSR_JABBER_DETECT 0x0002
172 #define DP83TC811_BMSR_EXTENDED_CAPABLE 0x0001
173 
174 //PHY Identifier 1 register
175 #define DP83TC811_PHYID1_OUI_MSB 0xFFFF
176 #define DP83TC811_PHYID1_OUI_MSB_DEFAULT 0x2000
177 
178 //PHY Identifier 2 register
179 #define DP83TC811_PHYID2_OUI_LSB 0xFC00
180 #define DP83TC811_PHYID2_OUI_LSB_DEFAULT 0xA000
181 #define DP83TC811_PHYID2_MODEL_NUM 0x03F0
182 #define DP83TC811_PHYID2_MODEL_NUM_DEFAULT 0x0250
183 #define DP83TC811_PHYID2_REVISION_NUM 0x000F
184 
185 //TDR Auto-Run register
186 #define DP83TC811_TDR_AUTO_TDR_AUTO_RUN 0x0100
187 
188 //Register Control register
189 #define DP83TC811_REGCR_CMD 0xC000
190 #define DP83TC811_REGCR_CMD_ADDR 0x0000
191 #define DP83TC811_REGCR_CMD_DATA_NO_POST_INC 0x4000
192 #define DP83TC811_REGCR_CMD_DATA_POST_INC_RW 0x8000
193 #define DP83TC811_REGCR_CMD_DATA_POST_INC_W 0xC000
194 #define DP83TC811_REGCR_DEVAD 0x001F
195 
196 //Interrupt Test register
197 #define DP83TC811_INT_TEST_INTERRUPT_POLARITY 0x0008
198 #define DP83TC811_INT_TEST_TEST_INTERRUPT 0x0004
199 
200 //Interrupt Status 1 register
201 #define DP83TC811_INT_STAT1_LINK_QUALITY_IF 0x8000
202 #define DP83TC811_INT_STAT1_ENERGY_DETECT_IF 0x4000
203 #define DP83TC811_INT_STAT1_LINK_STATUS_CHANGED_IF 0x2000
204 #define DP83TC811_INT_STAT1_WOL_IF 0x1000
205 #define DP83TC811_INT_STAT1_ESD_EVENT_IF 0x0800
206 #define DP83TC811_INT_STAT1_MS_TRAINING_COMPLETE_IF 0x0400
207 #define DP83TC811_INT_STAT1_FALSE_CARRIER_CNT_HF_IF 0x0200
208 #define DP83TC811_INT_STAT1_RECEIVE_ERROR_CNT_HF_IF 0x0100
209 #define DP83TC811_INT_STAT1_LINK_QUALITY_IE 0x0080
210 #define DP83TC811_INT_STAT1_ENERGY_DETECT_IE 0x0040
211 #define DP83TC811_INT_STAT1_LINK_STATUS_CHANGED_IE 0x0020
212 #define DP83TC811_INT_STAT1_WOL_IE 0x0010
213 #define DP83TC811_INT_STAT1_ESD_EVENT_IE 0x0008
214 #define DP83TC811_INT_STAT1_MS_TRAINING_COMPLETE_IE 0x0004
215 #define DP83TC811_INT_STAT1_FALSE_CARRIER_CNT_HF_IE 0x0002
216 #define DP83TC811_INT_STAT1_RECEIVE_ERROR_CNT_HF_IE 0x0001
217 
218 //Interrupt Status 2 register
219 #define DP83TC811_INT_STAT2_UNDERVOLTAGE_IF 0x8000
220 #define DP83TC811_INT_STAT2_OVERVOLTAGE_IF 0x4000
221 #define DP83TC811_INT_STAT2_OVERTEMPERATURE_IF 0x0800
222 #define DP83TC811_INT_STAT2_SLEEP_MODE_IF 0x0400
223 #define DP83TC811_INT_STAT2_POLARITY_CHANGE_IF 0x0200
224 #define DP83TC811_INT_STAT2_JABBER_DETECT_IF 0x0100
225 #define DP83TC811_INT_STAT2_UNDERVOLTAGE_IE 0x0080
226 #define DP83TC811_INT_STAT2_OVERVOLTAGE_IE 0x0040
227 #define DP83TC811_INT_STAT2_OVERTEMPERATURE_IE 0x0008
228 #define DP83TC811_INT_STAT2_SLEEP_MODE_IE 0x0004
229 #define DP83TC811_INT_STAT2_POLARITY_CHANGE_IE 0x0002
230 #define DP83TC811_INT_STAT2_JABBER_DETECT_IE 0x0001
231 
232 //False Carrier Sense Counter register
233 #define DP83TC811_FCSCR_FALSE_CARRIER_EVENT_CNT 0x00FF
234 
235 //BIST Control register
236 #define DP83TC811_BISTCR_BIST_ERROR_COUNTER_MODE 0x4000
237 #define DP83TC811_BISTCR_PRBS_PACKET_TYPE 0x2000
238 #define DP83TC811_BISTCR_PACKET_GENERATION_EN 0x1000
239 #define DP83TC811_BISTCR_PRBS_CHECKER_LOCK_SYNC 0x0800
240 #define DP83TC811_BISTCR_PRBS_CHECKER_SYNC_LOSS 0x0400
241 #define DP83TC811_BISTCR_PACKET_GENERATOR_STATUS 0x0200
242 #define DP83TC811_BISTCR_LOOPBACK_SELECT 0x007C
243 
244 //xMII Control register
245 #define DP83TC811_XMII_CTRL_RGMII_RX_CLOCK_DELAY 0x1000
246 #define DP83TC811_XMII_CTRL_RGMII_TX_CLOCK_DELAY 0x0800
247 #define DP83TC811_XMII_CTRL_RGMII_MODE 0x0200
248 #define DP83TC811_XMII_CTRL_CLOCK_SELECT 0x0080
249 #define DP83TC811_XMII_CTRL_RMII_MODE 0x0020
250 #define DP83TC811_XMII_CTRL_RMII_REV_SELECT 0x0010
251 #define DP83TC811_XMII_CTRL_RMII_OVERFLOW_STATUS 0x0008
252 #define DP83TC811_XMII_CTRL_RMII_UNDERFLOW_STATUS 0x0004
253 #define DP83TC811_XMII_CTRL_RMII_RX_ELASTICITY_BUFFER_SIZE 0x0002
254 
255 //Interrupt Status 3 register
256 #define DP83TC811_INT_STAT3_POR_DONE_IF 0x1000
257 #define DP83TC811_INT_STAT3_NO_FRAME_DETECTED_IF 0x0800
258 #define DP83TC811_INT_STAT3_LPS_IF 0x0100
259 #define DP83TC811_INT_STAT3_POR_DONE_IE 0x0010
260 #define DP83TC811_INT_STAT3_NO_FRAME_DETECTED_IE 0x0008
261 #define DP83TC811_INT_STAT3_LPS_IE 0x0001
262 
263 //BIST Control and Status 1 register
264 #define DP83TC811_BICTSR1_BIST_ERROR_CNT 0xFF00
265 #define DP83TC811_BICTSR1_BIST_IPG_LENGTH 0x00FF
266 
267 //BIST Control and Status 2 register
268 #define DP83TC811_BICTSR2_BIST_PACKET_LENGTH 0x07FF
269 
270 //Time Domain Reflectometry register
271 #define DP83TC811_TDR_START 0x8000
272 #define DP83TC811_TDR_STATUS 0x0002
273 #define DP83TC811_TDR_TEST_FAIL 0x0001
274 
275 //PHY Reset Control register
276 #define DP83TC811_PHYRCR_HARDWARE_RESET 0x8000
277 #define DP83TC811_PHYRCR_SOFTWARE_RESET 0x4000
278 #define DP83TC811_PHYRCR_STANDBY_MODE 0x0080
279 
280 //Link Status Results register
281 #define DP83TC811_LSR_LINK_STATUS 0x1000
282 #define DP83TC811_LSR_SCRAMBLER_LOCK 0x0004
283 #define DP83TC811_LSR_LOCAL_RECEIVER_STATUS 0x0002
284 #define DP83TC811_LSR_REMOTE_RECEIVER_STATUS 0x0001
285 
286 //TDR Results register
287 #define DP83TC811_TDRR_FAULT_STATUS 0x0200
288 #define DP83TC811_TDRR_FAULT_TYPE 0x0100
289 #define DP83TC811_TDRR_FAULT_LOCATION 0x00FF
290 
291 //TDR Location Result 1 register
292 #define DP83TC811_TDRLR1_LOCATION_2 0xFF00
293 #define DP83TC811_TDRLR1_LOCATION_1 0x00FF
294 
295 //TDR Location Result 2 register
296 #define DP83TC811_TDRLR2_LOCATION_4 0xFF00
297 #define DP83TC811_TDRLR2_LOCATION_3 0x00FF
298 
299 //TDR Peak Type register
300 #define DP83TC811_TDRPT_PEAK_4_TYPE 0x4000
301 #define DP83TC811_TDRPT_PEAK_3_TYPE 0x2000
302 #define DP83TC811_TDRPT_PEAK_2_TYPE 0x1000
303 #define DP83TC811_TDRPT_PEAK_1_TYPE 0x0800
304 
305 //Autonomous PHY Control register
306 #define DP83TC811_AUTO_PHY_AUTONOMOUS_COMMAND 0x0040
307 #define DP83TC811_AUTO_PHY_SLEEP_EN 0x0002
308 #define DP83TC811_AUTO_PHY_LPS_TRANSMISSION_EN 0x0001
309 
310 //Power Mode Register register
311 #define DP83TC811_PWRM_SLEEP_REQUEST_COMMAND 0x0002
312 #define DP83TC811_PWRM_NORMAL_COMMAND 0x0001
313 
314 //Signal-to-Noise Ratio Result register
315 #define DP83TC811_SNR_SNR 0x01FF
316 
317 //Signal Quality Indication register
318 #define DP83TC811_SQI_SQS 0x0300
319 #define DP83TC811_SQI_SQI 0x00FF
320 
321 //Line Driver Control register
322 #define DP83TC811_LD_CTRL_LINE_DRIVER_SERIES_TERM 0x1F00
323 
324 //Line Driver Gain Control 1 register
325 #define DP83TC811_LDG_CTRL1_FINE_GAIN_CONTROL_MDI 0x000F
326 
327 //RGMII DLL Control register
328 #define DP83TC811_DLL_CTRL_DLL_TX_DELAY_CONTROL 0x00F0
329 #define DP83TC811_DLL_CTRL_DLL_RX_DELAY_CONTROL 0x000F
330 
331 //Electrostatic Discharge Status register
332 #define DP83TC811_ESDS_XMII_ESD_EVENT_CNT 0x3F00
333 #define DP83TC811_ESDS_MDI_ESD_EVENT_CNT 0x003F
334 
335 //LED Configuration 1 register
336 #define DP83TC811_LED_CFG1_LED_BLINK_RATE_CTRL 0x3000
337 #define DP83TC811_LED_CFG1_LED_BLINK_RATE_CTRL_20HZ 0x0000
338 #define DP83TC811_LED_CFG1_LED_BLINK_RATE_CTRL_10HZ 0x1000
339 #define DP83TC811_LED_CFG1_LED_BLINK_RATE_CTRL_5HZ 0x2000
340 #define DP83TC811_LED_CFG1_LED_BLINK_RATE_CTRL_2HZ 0x3000
341 #define DP83TC811_LED_CFG1_LED_2_CTRL 0x0F00
342 #define DP83TC811_LED_CFG1_LED_2_CTRL_LINK_OK 0x0000
343 #define DP83TC811_LED_CFG1_LED_2_CTRL_LINK_OK_TX_RX_ACT 0x0100
344 #define DP83TC811_LED_CFG1_LED_2_CTRL_LINK_OK_TX_ACT 0x0200
345 #define DP83TC811_LED_CFG1_LED_2_CTRL_LINK_OK_RX_ACT 0x0300
346 #define DP83TC811_LED_CFG1_LED_2_CTRL_LINK_OK_MASTER 0x0400
347 #define DP83TC811_LED_CFG1_LED_2_CTRL_LINK_OK_SLAVE 0x0500
348 #define DP83TC811_LED_CFG1_LED_2_CTRL_TX_RX_ACT 0x0600
349 #define DP83TC811_LED_CFG1_LED_2_CTRL_LINK_LOST 0x0900
350 #define DP83TC811_LED_CFG1_LED_2_CTRL_PRBS_ERR 0x0A00
351 #define DP83TC811_LED_CFG1_LED_1_CTRL 0x00F0
352 #define DP83TC811_LED_CFG1_LED_1_CTRL_LINK_OK 0x0000
353 #define DP83TC811_LED_CFG1_LED_1_CTRL_LINK_OK_TX_RX_ACT 0x0010
354 #define DP83TC811_LED_CFG1_LED_1_CTRL_LINK_OK_TX_ACT 0x0020
355 #define DP83TC811_LED_CFG1_LED_1_CTRL_LINK_OK_RX_ACT 0x0030
356 #define DP83TC811_LED_CFG1_LED_1_CTRL_LINK_OK_MASTER 0x0040
357 #define DP83TC811_LED_CFG1_LED_1_CTRL_LINK_OK_SLAVE 0x0050
358 #define DP83TC811_LED_CFG1_LED_1_CTRL_TX_RX_ACT 0x0060
359 #define DP83TC811_LED_CFG1_LED_1_CTRL_LINK_LOST 0x0090
360 #define DP83TC811_LED_CFG1_LED_1_CTRL_PRBS_ERR 0x00A0
361 #define DP83TC811_LED_CFG1_LED_0_CTRL 0x000F
362 #define DP83TC811_LED_CFG1_LED_0_CTRL_LINK_OK 0x0000
363 #define DP83TC811_LED_CFG1_LED_0_CTRL_LINK_OK_TX_RX_ACT 0x0001
364 #define DP83TC811_LED_CFG1_LED_0_CTRL_LINK_OK_TX_ACT 0x0002
365 #define DP83TC811_LED_CFG1_LED_0_CTRL_LINK_OK_RX_ACT 0x0003
366 #define DP83TC811_LED_CFG1_LED_0_CTRL_LINK_OK_MASTER 0x0004
367 #define DP83TC811_LED_CFG1_LED_0_CTRL_LINK_OK_SLAVE 0x0005
368 #define DP83TC811_LED_CFG1_LED_0_CTRL_TX_RX_ACT 0x0006
369 #define DP83TC811_LED_CFG1_LED_0_CTRL_LINK_LOST 0x0009
370 #define DP83TC811_LED_CFG1_LED_0_CTRL_PRBS_ERR 0x000A
371 
372 //xMII Impedance Control register
373 #define DP83TC811_XMII_IMP_CTRL_IMP_CTRL 0x001E
374 #define DP83TC811_XMII_IMP_CTRL_IMP_CTRL_99R 0x0000
375 #define DP83TC811_XMII_IMP_CTRL_IMP_CTRL_91R 0x0002
376 #define DP83TC811_XMII_IMP_CTRL_IMP_CTRL_84R 0x0004
377 #define DP83TC811_XMII_IMP_CTRL_IMP_CTRL_78R 0x0006
378 #define DP83TC811_XMII_IMP_CTRL_IMP_CTRL_73R 0x0008
379 #define DP83TC811_XMII_IMP_CTRL_IMP_CTRL_69R 0x000A
380 #define DP83TC811_XMII_IMP_CTRL_IMP_CTRL_65R 0x000C
381 #define DP83TC811_XMII_IMP_CTRL_IMP_CTRL_61R 0x000E
382 #define DP83TC811_XMII_IMP_CTRL_IMP_CTRL_58R 0x0010
383 #define DP83TC811_XMII_IMP_CTRL_IMP_CTRL_55R 0x0012
384 #define DP83TC811_XMII_IMP_CTRL_IMP_CTRL_53R 0x0014
385 #define DP83TC811_XMII_IMP_CTRL_IMP_CTRL_50R 0x0016
386 #define DP83TC811_XMII_IMP_CTRL_IMP_CTRL_48R 0x0018
387 #define DP83TC811_XMII_IMP_CTRL_IMP_CTRL_46R 0x001A
388 #define DP83TC811_XMII_IMP_CTRL_IMP_CTRL_44R 0x001C
389 #define DP83TC811_XMII_IMP_CTRL_IMP_CTRL_42R 0x001E
390 
391 //GPIO Control 1 register
392 #define DP83TC811_IO_CTRL1_LED_1_CLOCK_SEL 0x7000
393 #define DP83TC811_IO_CTRL1_LED_1_CLOCK_SEL_XI 0x0000
394 #define DP83TC811_IO_CTRL1_LED_1_CLOCK_SEL_TX_TCLK 0x1000
395 #define DP83TC811_IO_CTRL1_LED_1_GPIO_SEL 0x0700
396 #define DP83TC811_IO_CTRL1_LED_1_GPIO_SEL_LED_1 0x0000
397 #define DP83TC811_IO_CTRL1_LED_1_GPIO_SEL_CLOCK 0x0100
398 #define DP83TC811_IO_CTRL1_LED_1_GPIO_SEL_WOL 0x0200
399 #define DP83TC811_IO_CTRL1_LED_1_GPIO_SEL_UNDERVOLTAGE 0x0300
400 #define DP83TC811_IO_CTRL1_LED_1_GPIO_SEL_TRANSMIT 0x0400
401 #define DP83TC811_IO_CTRL1_LED_1_GPIO_SEL_RECEIVE 0x0500
402 #define DP83TC811_IO_CTRL1_LED_1_GPIO_SEL_CONST_LOW 0x0600
403 #define DP83TC811_IO_CTRL1_LED_1_GPIO_SEL_CONST_HIGH 0x0700
404 #define DP83TC811_IO_CTRL1_LED_0_CLOCK_SEL 0x0070
405 #define DP83TC811_IO_CTRL1_LED_0_CLOCK_SEL_XI 0x0000
406 #define DP83TC811_IO_CTRL1_LED_0_CLOCK_SEL_TX_TCLK 0x0010
407 #define DP83TC811_IO_CTRL1_LED_0_GPIO_SEL 0x0007
408 #define DP83TC811_IO_CTRL1_LED_0_GPIO_SEL_LED_0 0x0000
409 #define DP83TC811_IO_CTRL1_LED_0_GPIO_SEL_CLOCK 0x0001
410 #define DP83TC811_IO_CTRL1_LED_0_GPIO_SEL_WOL 0x0002
411 #define DP83TC811_IO_CTRL1_LED_0_GPIO_SEL_UNDERVOLTAGE 0x0003
412 #define DP83TC811_IO_CTRL1_LED_0_GPIO_SEL_TRANSMIT 0x0004
413 #define DP83TC811_IO_CTRL1_LED_0_GPIO_SEL_RECEIVE 0x0005
414 #define DP83TC811_IO_CTRL1_LED_0_GPIO_SEL_CONST_LOW 0x0006
415 #define DP83TC811_IO_CTRL1_LED_0_GPIO_SEL_CONST_HIGH 0x0007
416 
417 //GPIO Control 2 register
418 #define DP83TC811_IO_CTRL2_CLKOUT_CLOCK_SEL 0x00F0
419 #define DP83TC811_IO_CTRL2_CLKOUT_CLOCK_SEL_XI 0x0000
420 #define DP83TC811_IO_CTRL2_CLKOUT_CLOCK_SEL_TX_TCLK 0x0010
421 #define DP83TC811_IO_CTRL2_CLKOUT_GPIO_SEL 0x0007
422 #define DP83TC811_IO_CTRL2_CLKOUT_GPIO_SEL_LED_2 0x0000
423 #define DP83TC811_IO_CTRL2_CLKOUT_GPIO_SEL_CLOCK 0x0001
424 #define DP83TC811_IO_CTRL2_CLKOUT_GPIO_SEL_WOL 0x0002
425 #define DP83TC811_IO_CTRL2_CLKOUT_GPIO_SEL_UNDERVOLTAGE 0x0003
426 #define DP83TC811_IO_CTRL2_CLKOUT_GPIO_SEL_TRANSMIT 0x0004
427 #define DP83TC811_IO_CTRL2_CLKOUT_GPIO_SEL_RECEIVE 0x0005
428 #define DP83TC811_IO_CTRL2_CLKOUT_GPIO_SEL_CONST_LOW 0x0006
429 #define DP83TC811_IO_CTRL2_CLKOUT_GPIO_SEL_CONST_HIGH 0x0007
430 
431 //Strap Configuration register
432 #define DP83TC811_STRAP_LED_1 0xC000
433 #define DP83TC811_STRAP_LED_1_MODE1 0x0000
434 #define DP83TC811_STRAP_LED_1_MODE2 0x4000
435 #define DP83TC811_STRAP_LED_1_MODE3 0x8000
436 #define DP83TC811_STRAP_LED_1_MODE4 0xC000
437 #define DP83TC811_STRAP_RX_DV 0x3000
438 #define DP83TC811_STRAP_RX_DV_MODE1 0x0000
439 #define DP83TC811_STRAP_RX_DV_MODE2 0x1000
440 #define DP83TC811_STRAP_RX_DV_MODE3 0x2000
441 #define DP83TC811_STRAP_RX_DV_MODE4 0x3000
442 #define DP83TC811_STRAP_RX_ER 0x0C00
443 #define DP83TC811_STRAP_RX_ER_MODE1 0x0000
444 #define DP83TC811_STRAP_RX_ER_MODE2 0x0400
445 #define DP83TC811_STRAP_RX_ER_MODE3 0x0800
446 #define DP83TC811_STRAP_RX_ER_MODE4 0x0C00
447 #define DP83TC811_STRAP_LED_0 0x0300
448 #define DP83TC811_STRAP_LED_0_MODE1 0x0000
449 #define DP83TC811_STRAP_LED_0_MODE2 0x0100
450 #define DP83TC811_STRAP_LED_0_MODE3 0x0200
451 #define DP83TC811_STRAP_LED_0_MODE4 0x0300
452 #define DP83TC811_STRAP_RX_D0 0x00C0
453 #define DP83TC811_STRAP_RX_D0_MODE1 0x0000
454 #define DP83TC811_STRAP_RX_D0_MODE2 0x0040
455 #define DP83TC811_STRAP_RX_D0_MODE3 0x0080
456 #define DP83TC811_STRAP_RX_D0_MODE4 0x00C0
457 #define DP83TC811_STRAP_RX_D1 0x0030
458 #define DP83TC811_STRAP_RX_D1_MODE1 0x0000
459 #define DP83TC811_STRAP_RX_D1_MODE2 0x0010
460 #define DP83TC811_STRAP_RX_D1_MODE3 0x0020
461 #define DP83TC811_STRAP_RX_D1_MODE4 0x0030
462 #define DP83TC811_STRAP_RX_D2 0x000C
463 #define DP83TC811_STRAP_RX_D2_MODE1 0x0000
464 #define DP83TC811_STRAP_RX_D2_MODE2 0x0004
465 #define DP83TC811_STRAP_RX_D2_MODE3 0x0008
466 #define DP83TC811_STRAP_RX_D2_MODE4 0x000C
467 #define DP83TC811_STRAP_RX_D3 0x0003
468 #define DP83TC811_STRAP_RX_D3_MODE1 0x0000
469 #define DP83TC811_STRAP_RX_D3_MODE2 0x0001
470 #define DP83TC811_STRAP_RX_D3_MODE3 0x0002
471 #define DP83TC811_STRAP_RX_D3_MODE4 0x0003
472 
473 //LED Configuration 2 register
474 #define DP83TC811_LED_CFG2_LED_2_POL 0x0400
475 #define DP83TC811_LED_CFG2_LED_2_OVERRIDE_VAL 0x0200
476 #define DP83TC811_LED_CFG2_LED_2_OVERRIDE_EN 0x0100
477 #define DP83TC811_LED_CFG2_LED_1_POL 0x0040
478 #define DP83TC811_LED_CFG2_LED_1_OVERRIDE_VAL 0x0020
479 #define DP83TC811_LED_CFG2_LED_1_OVERRIDE_EN 0x0010
480 #define DP83TC811_LED_CFG2_LED_0_POL 0x0004
481 #define DP83TC811_LED_CFG2_LED_0_OVERRIDE_VAL 0x0002
482 #define DP83TC811_LED_CFG2_LED_0_OVERRIDE_EN 0x0001
483 
484 //Polarity Auto-Correction Configuration register
485 #define DP83TC811_PLR_CFG_POL_VALUE 0x2000
486 #define DP83TC811_PLR_CFG_FORCE_POL_EN 0x1000
487 
488 //C++ guard
489 #ifdef __cplusplus
490 extern "C" {
491 #endif
492 
493 //DP83TC811 Ethernet PHY driver
494 extern const PhyDriver dp83tc811PhyDriver;
495 
496 //DP83TC811 related functions
498 void dp83tc811InitHook(NetInterface *interface);
499 
500 void dp83tc811Tick(NetInterface *interface);
501 
502 void dp83tc811EnableIrq(NetInterface *interface);
503 void dp83tc811DisableIrq(NetInterface *interface);
504 
505 void dp83tc811EventHandler(NetInterface *interface);
506 
507 void dp83tc811WritePhyReg(NetInterface *interface, uint8_t address,
508  uint16_t data);
509 
510 uint16_t dp83tc811ReadPhyReg(NetInterface *interface, uint8_t address);
511 
512 void dp83tc811DumpPhyReg(NetInterface *interface);
513 
514 void dp83tc811WriteMmdReg(NetInterface *interface, uint8_t devAddr,
515  uint16_t regAddr, uint16_t data);
516 
517 uint16_t dp83tc811ReadMmdReg(NetInterface *interface, uint8_t devAddr,
518  uint16_t regAddr);
519 
520 //C++ guard
521 #ifdef __cplusplus
522 }
523 #endif
524 
525 #endif
uint16_t dp83tc811ReadPhyReg(NetInterface *interface, uint8_t address)
Read PHY register.
uint16_t dp83tc811ReadMmdReg(NetInterface *interface, uint8_t devAddr, uint16_t regAddr)
Read MMD register.
void dp83tc811InitHook(NetInterface *interface)
DP83TC811 custom configuration.
void dp83tc811Tick(NetInterface *interface)
DP83TC811 timer handler.
void dp83tc811WritePhyReg(NetInterface *interface, uint8_t address, uint16_t data)
Write PHY register.
void dp83tc811DumpPhyReg(NetInterface *interface)
Dump PHY registers for debugging purpose.
void dp83tc811DisableIrq(NetInterface *interface)
Disable interrupts.
void dp83tc811EnableIrq(NetInterface *interface)
Enable interrupts.
const PhyDriver dp83tc811PhyDriver
DP83TC811 Ethernet PHY driver.
void dp83tc811WriteMmdReg(NetInterface *interface, uint8_t devAddr, uint16_t regAddr, uint16_t data)
Write MMD register.
error_t dp83tc811Init(NetInterface *interface)
DP83TC811 PHY transceiver initialization.
void dp83tc811EventHandler(NetInterface *interface)
DP83TC811 event handler.
error_t
Error codes.
Definition: error.h:43
uint8_t data[]
Definition: ethernet.h:222
Ipv6Addr address[]
Definition: ipv6.h:316
uint16_t regAddr
#define NetInterface
Definition: net.h:36
Network interface controller abstraction layer.
Ethernet PHY driver.
Definition: nic.h:308