ncn26000_driver.h
Go to the documentation of this file.
1 /**
2  * @file ncn26000_driver.h
3  * @brief NCN26000 10Base-T1S 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 _NCN26000_DRIVER_H
32 #define _NCN26000_DRIVER_H
33 
34 //Dependencies
35 #include "core/nic.h"
36 
37 //PHY address
38 #ifndef NCN26000_PHY_ADDR
39  #define NCN26000_PHY_ADDR 0
40 #elif (NCN26000_PHY_ADDR < 0 || NCN26000_PHY_ADDR > 31)
41  #error NCN26000_PHY_ADDR parameter is not valid
42 #endif
43 
44 //PLCA support
45 #ifndef NCN26000_PLCA_SUPPORT
46  #define NCN26000_PLCA_SUPPORT ENABLED
47 #elif (NCN26000_PLCA_SUPPORT != ENABLED && NCN26000_PLCA_SUPPORT != DISABLED)
48  #error NCN26000_PLCA_SUPPORT parameter is not valid
49 #endif
50 
51 //Node count
52 #ifndef NCN26000_NODE_COUNT
53  #define NCN26000_NODE_COUNT 8
54 #elif (NCN26000_NODE_COUNT < 0 || NCN26000_NODE_COUNT > 255)
55  #error NCN26000_NODE_COUNT parameter is not valid
56 #endif
57 
58 //Local ID
59 #ifndef NCN26000_LOCAL_ID
60  #define NCN26000_LOCAL_ID 1
61 #elif (NCN26000_LOCAL_ID < 0 || NCN26000_LOCAL_ID > 255)
62  #error NCN26000_LOCAL_ID parameter is not valid
63 #endif
64 
65 //NCN26000 PHY registers
66 #define NCN26000_CTRL 0x00
67 #define NCN26000_STATUS 0x01
68 #define NCN26000_PHYID1 0x02
69 #define NCN26000_PHYID2 0x03
70 #define NCN26000_MACR 0x0D
71 #define NCN26000_MAADR 0x0E
72 #define NCN26000_MIIM_IRQ_CTRL 0x10
73 #define NCN26000_MIIM_IRQ_STATUS 0x11
74 #define NCN26000_DIO_CONFIG 0x12
75 
76 //NCN26000 MMD registers
77 #define NCN26000_MMD1_DEV_IN_PACKAGE1 0x01, 0x0005
78 #define NCN26000_MMD1_DEV_IN_PACKAGE2 0x01, 0x0006
79 #define NCN26000_BASE_T1_EXTENDED_ABILITY 0x01, 0x0012
80 #define NCN26000_10BASE_T1S_PMA_CTRL 0x01, 0x08F9
81 #define NCN26000_10BASE_T1S_PMA_STATUS 0x01, 0x08FA
82 #define NCN26000_10BASE_T1S_TEST_MODE 0x01, 0x08FB
83 #define NCN26000_MMD3_DEV_IN_PACKAGE1 0x03, 0x0005
84 #define NCN26000_MMD3_DEV_IN_PACKAGE2 0x03, 0x0006
85 #define NCN26000_10BASE_T1S_PCS_CTRL 0x03, 0x08F3
86 #define NCN26000_10BASE_T1S_PCS_STATUS 0x03, 0x08F4
87 #define NCN26000_10BASE_T1S_PCS_DIAG1 0x03, 0x08F5
88 #define NCN26000_10BASE_T1S_PCS_DIAG2 0x03, 0x08F6
89 #define NCN26000_CHIP_REVISION 0x1E, 0x1000
90 #define NCN26000_PHY_TWEAKS 0x1E, 0x1001
91 #define NCN26000_CHIP_INFO 0x1E, 0x1004
92 #define NCN26000_NVM_HEALTH 0x1E, 0x1005
93 #define NCN26000_PHY_REVISION 0x1F, 0x8000
94 #define NCN26000_PHY_CONFIG1 0x1F, 0x8001
95 #define NCN26000_PLCA_EXTENSIONS 0x1F, 0x8002
96 #define NCN26000_PMA_TUNE0 0x1F, 0x8003
97 #define NCN26000_PMA_TUNE1 0x1F, 0x8004
98 #define NCN26000_PLCIDVER 0x1F, 0xCA00
99 #define NCN26000_PLCA_CTRL0 0x1F, 0xCA01
100 #define NCN26000_PLCA_CTRL1 0x1F, 0xCA02
101 #define NCN26000_PLCA_STATUS 0x1F, 0xCA03
102 #define NCN26000_PLCA_TX_OPPORTUNITY_TMR 0x1F, 0xCA04
103 #define NCN26000_PLCA_BURST_MODE 0x1F, 0xCA05
104 
105 //Control register
106 #define NCN26000_CTRL_RESET 0x8000
107 #define NCN26000_CTRL_LOOPBACK 0x4000
108 #define NCN26000_CTRL_SPEED_LSB 0x2000
109 #define NCN26000_CTRL_LINK_CTRL 0x1000
110 #define NCN26000_CTRL_LOW_POWER 0x0800
111 #define NCN26000_CTRL_ISOLATE 0x0400
112 #define NCN26000_CTRL_LINK_RESET 0x0200
113 #define NCN26000_CTRL_DUPLEX_MODE 0x0100
114 #define NCN26000_CTRL_COL_TEST 0x0080
115 #define NCN26000_CTRL_SPEED_MSB 0x0040
116 #define NCN26000_CTRL_UNIDIRECTIONAL_EN 0x0020
117 
118 //Status register
119 #define NCN26000_STATUS_10MBPS_HD 0x0800
120 #define NCN26000_STATUS_UNIDIRECTIONAL_ABLE 0x0080
121 #define NCN26000_STATUS_MF_PREAMBLE_SUPPR 0x0040
122 #define NCN26000_STATUS_LINK_NEGOTIATION_COMPLETE 0x0020
123 #define NCN26000_STATUS_REMOTE_FAULT 0x0010
124 #define NCN26000_STATUS_AN_ABLE 0x0008
125 #define NCN26000_STATUS_LINK_STATUS 0x0004
126 #define NCN26000_STATUS_JABBER_DETECT 0x0002
127 #define NCN26000_STATUS_EXTENDED_CAPABLE 0x0001
128 
129 //PHY Identifier 1 register
130 #define NCN26000_PHYID1_OUI_MSB 0xFFFF
131 #define NCN26000_PHYID1_OUI_MSB_DEFAULT 0x180F
132 
133 //PHY Identifier 2 register
134 #define NCN26000_PHYID2_OUI_LSB 0xFC00
135 #define NCN26000_PHYID2_OUI_LSB_DEFAULT 0xF400
136 #define NCN26000_PHYID2_IC_MODEL_NUM 0x03F0
137 #define NCN26000_PHYID2_IC_MODEL_NUM_DEFAULT 0x01A0
138 #define NCN26000_PHYID2_CHIP_REV_NUM 0x000F
139 #define NCN26000_PHYID2_CHIP_REV_NUM_DEFAULT 0x0001
140 
141 //MMD Access Control register
142 #define NCN26000_MACR_FUNC 0xC000
143 #define NCN26000_MACR_FUNC_ADDR 0x0000
144 #define NCN26000_MACR_FUNC_DATA_NO_POST_INC 0x4000
145 #define NCN26000_MACR_FUNC_DATA_POST_INC_RW 0x8000
146 #define NCN26000_MACR_FUNC_DATA_POST_INC_W 0xC000
147 #define NCN26000_MACR_DEVADD 0x001F
148 
149 //MIIM IRQ Control register
150 #define NCN26000_MIIM_IRQ_CTRL_PHY_COL 0x0020
151 #define NCN26000_MIIM_IRQ_CTRL_PLCA_RECOVERY 0x0010
152 #define NCN26000_MIIM_IRQ_CTRL_REMOTE_JABBER 0x0008
153 #define NCN26000_MIIM_IRQ_CTRL_LOCAL_JABBER 0x0004
154 #define NCN26000_MIIM_IRQ_CTRL_PLCA_STATUS_CHANGE 0x0002
155 #define NCN26000_MIIM_IRQ_CTRL_LINK_STATUS 0x0001
156 
157 //MIIM IRQ Status register
158 #define NCN26000_MIIM_IRQ_STATUS_RESET 0x8000
159 #define NCN26000_MIIM_IRQ_STATUS_PHY_COL 0x0020
160 #define NCN26000_MIIM_IRQ_STATUS_PLCA_RECOVERY 0x0010
161 #define NCN26000_MIIM_IRQ_STATUS_REMOTE_JABBER 0x0008
162 #define NCN26000_MIIM_IRQ_STATUS_LOCAL_JABBER 0x0004
163 #define NCN26000_MIIM_IRQ_STATUS_PLCA_STATUS_CHANGE 0x0002
164 #define NCN26000_MIIM_IRQ_STATUS_LINK_STATUS 0x0001
165 
166 //DIO Configuration register
167 #define NCN26000_DIO_CONFIG_SLEW_RATE1 0x8000
168 #define NCN26000_DIO_CONFIG_SLEW_RATE1_FAST 0x0000
169 #define NCN26000_DIO_CONFIG_SLEW_RATE1_SLOW 0x8000
170 #define NCN26000_DIO_CONFIG_PULL_EN1 0x4000
171 #define NCN26000_DIO_CONFIG_PULL_RES_TYPE1 0x2000
172 #define NCN26000_DIO_CONFIG_PULL_RES_TYPE1_PU 0x0000
173 #define NCN26000_DIO_CONFIG_PULL_RES_TYPE1_PD 0x2000
174 #define NCN26000_DIO_CONFIG_FN1 0x1E00
175 #define NCN26000_DIO_CONFIG_VAL1 0x0100
176 #define NCN26000_DIO_CONFIG_VAL1_DISABLE 0x0000
177 #define NCN26000_DIO_CONFIG_VAL1_GPIO 0x0100
178 #define NCN26000_DIO_CONFIG_VAL1_SFD_TX 0x0200
179 #define NCN26000_DIO_CONFIG_VAL1_SFD_RX 0x0300
180 #define NCN26000_DIO_CONFIG_VAL1_LED_LINK_CTRL 0x0400
181 #define NCN26000_DIO_CONFIG_VAL1_LED_PLCA_STATUS 0x0500
182 #define NCN26000_DIO_CONFIG_VAL1_LED_TX 0x0600
183 #define NCN26000_DIO_CONFIG_VAL1_LED_RX 0x0700
184 #define NCN26000_DIO_CONFIG_VAL1_CLK25M 0x0800
185 #define NCN26000_DIO_CONFIG_VAL1_SFD_RX_TX 0x0B00
186 #define NCN26000_DIO_CONFIG_VAL1_LED_TX_RX 0x0F00
187 #define NCN26000_DIO_CONFIG_SLEW_RATE0 0x0080
188 #define NCN26000_DIO_CONFIG_PULL_EN0 0x0040
189 #define NCN26000_DIO_CONFIG_PULL_RES_TYPE0 0x0020
190 #define NCN26000_DIO_CONFIG_FN0 0x001E
191 #define NCN26000_DIO_CONFIG_VAL0 0x0001
192 #define NCN26000_DIO_CONFIG_VAL0_DISABLE 0x0000
193 #define NCN26000_DIO_CONFIG_VAL0_GPIO 0x0001
194 #define NCN26000_DIO_CONFIG_VAL0_SFD_TX 0x0002
195 #define NCN26000_DIO_CONFIG_VAL0_SFD_RX 0x0003
196 #define NCN26000_DIO_CONFIG_VAL0_LED_LINK_CTRL 0x0004
197 #define NCN26000_DIO_CONFIG_VAL0_LED_PLCA_STATUS 0x0005
198 #define NCN26000_DIO_CONFIG_VAL0_LED_TX 0x0006
199 #define NCN26000_DIO_CONFIG_VAL0_LED_RX 0x0007
200 #define NCN26000_DIO_CONFIG_VAL0_CLK25M 0x0008
201 #define NCN26000_DIO_CONFIG_VAL0_SFD_RX_TX 0x000B
202 #define NCN26000_DIO_CONFIG_VAL0_LED_TX_RX 0x000F
203 
204 //Devices in Package 1 register
205 #define NCN26000_MMD1_DEV_IN_PACKAGE1_PCS_PRESENT 0x0008
206 #define NCN26000_MMD1_DEV_IN_PACKAGE1_PMA_PRESENT 0x0002
207 #define NCN26000_MMD1_DEV_IN_PACKAGE1_C22_REGS_PRESENT 0x0001
208 
209 //BASE−T1 Extended Ability register
210 #define NCN26000_BASE_T1_EXTENDED_ABILITY_10BASE_T1S 0x0008
211 
212 //10BASE−T1S PMA Control register
213 #define NCN26000_10BASE_T1S_PMA_CTRL_PMA_RESET 0x8000
214 #define NCN26000_10BASE_T1S_PMA_CTRL_TRANSMIT_DIS 0x4000
215 #define NCN26000_10BASE_T1S_PMA_CTRL_LOW_POWER_MODE 0x0800
216 #define NCN26000_10BASE_T1S_PMA_CTRL_MULTI_DROP_EN 0x0400
217 #define NCN26000_10BASE_T1S_PMA_CTRL_LOOPBACK_MODE 0x0001
218 
219 //10BASE−T1S PMA Status register
220 #define NCN26000_10BASE_T1S_PMA_STATUS_LOOPBACK_ABILITY 0x2000
221 #define NCN26000_10BASE_T1S_PMA_STATUS_LOW_POWER_ABILITY 0x0800
222 #define NCN26000_10BASE_T1S_PMA_STATUS_MULTI_DROP_ABILITY 0x0400
223 #define NCN26000_10BASE_T1S_PMA_STATUS_RECEIVE_FAULT_ABILITY 0x0200
224 #define NCN26000_10BASE_T1S_PMA_STATUS_REMOTE_JABBER 0x0002
225 
226 //10BASE−T1S Test Mode register
227 #define NCN26000_10BASE_T1S_TEST_MODE_TEST_MODE 0xE000
228 #define NCN26000_10BASE_T1S_TEST_MODE_TEST_MODE_NORMAL 0x0000
229 #define NCN26000_10BASE_T1S_TEST_MODE_TEST_MODE_TX_OUT_VOLTAGE 0x2000
230 #define NCN26000_10BASE_T1S_TEST_MODE_TEST_MODE_TX_OUT_DROOP 0x4000
231 #define NCN26000_10BASE_T1S_TEST_MODE_TEST_MODE_TX_PSD_MASK 0x6000
232 #define NCN26000_10BASE_T1S_TEST_MODE_TEST_MODE_TX_HI_Z 0x8000
233 
234 //Devices in Package 1 register
235 #define NCN26000_MMD3_DEV_IN_PACKAGE1_PCS_PRESENT 0x0008
236 #define NCN26000_MMD3_DEV_IN_PACKAGE1_PMA_PRESENT 0x0002
237 #define NCN26000_MMD3_DEV_IN_PACKAGE1_C22_REGS_PRESENT 0x0001
238 
239 //10BASE−T1S PCS Control register
240 #define NCN26000_10BASE_T1S_PCS_CTRL_PCS_RESET 0x8000
241 #define NCN26000_10BASE_T1S_PCS_CTRL_LOOPBACK 0x4000
242 
243 //10BASE−T1S PCS Status register
244 #define NCN26000_10BASE_T1S_PCS_STATUS_FAULT 0x0080
245 
246 //10BASE−T1S PCS Diagnostic 1 register
247 #define NCN26000_10BASE_T1S_PCS_DIAG1_PCS_REMOTE_JABBER_COUNT 0xFFFF
248 
249 //10BASE−T1S PCS Diagnostic 2 register
250 #define NCN26000_10BASE_T1S_PCS_DIAG2_PCS_PHY_COL_COUNT 0xFFFF
251 
252 //Chip Revision register
253 #define NCN26000_CHIP_REVISION_MAJOR_REV 0xF000
254 #define NCN26000_CHIP_REVISION_MINOR_REV 0x0F00
255 #define NCN26000_CHIP_REVISION_STAGE 0x00C0
256 #define NCN26000_CHIP_REVISION_PATCH 0x003F
257 
258 //PHY Tweaks register
259 #define NCN26000_PHY_TWEAKS_CD_THRESHOLD 0x3C00
260 #define NCN26000_PHY_TWEAKS_CD_THRESHOLD_150MVPP 0x0000
261 #define NCN26000_PHY_TWEAKS_CD_THRESHOLD_200MVPP 0x0400
262 #define NCN26000_PHY_TWEAKS_CD_THRESHOLD_250MVPP 0x0800
263 #define NCN26000_PHY_TWEAKS_CD_THRESHOLD_300MVPP 0x0C00
264 #define NCN26000_PHY_TWEAKS_CD_THRESHOLD_350MVPP 0x1000
265 #define NCN26000_PHY_TWEAKS_CD_THRESHOLD_400MVPP 0x1400
266 #define NCN26000_PHY_TWEAKS_CD_THRESHOLD_450MVPP 0x1800
267 #define NCN26000_PHY_TWEAKS_CD_THRESHOLD_500MVPP 0x1C00
268 #define NCN26000_PHY_TWEAKS_CD_THRESHOLD_550MVPP 0x2000
269 #define NCN26000_PHY_TWEAKS_CD_THRESHOLD_600MVPP 0x2400
270 #define NCN26000_PHY_TWEAKS_CD_THRESHOLD_650MVPP 0x2800
271 #define NCN26000_PHY_TWEAKS_CD_THRESHOLD_700MVPP 0x2C00
272 #define NCN26000_PHY_TWEAKS_CD_THRESHOLD_750MVPP 0x3000
273 #define NCN26000_PHY_TWEAKS_CD_THRESHOLD_800MVPP 0x3400
274 #define NCN26000_PHY_TWEAKS_CD_THRESHOLD_850MVPP 0x3800
275 #define NCN26000_PHY_TWEAKS_CD_THRESHOLD_900MVPP 0x3C00
276 #define NCN26000_PHY_TWEAKS_RX_ED_THRESHOLD 0x03C0
277 #define NCN26000_PHY_TWEAKS_RX_ED_THRESHOLD_150MVPP 0x0000
278 #define NCN26000_PHY_TWEAKS_RX_ED_THRESHOLD_200MVPP 0x0040
279 #define NCN26000_PHY_TWEAKS_RX_ED_THRESHOLD_250MVPP 0x0080
280 #define NCN26000_PHY_TWEAKS_RX_ED_THRESHOLD_300MVPP 0x00C0
281 #define NCN26000_PHY_TWEAKS_RX_ED_THRESHOLD_350MVPP 0x0100
282 #define NCN26000_PHY_TWEAKS_RX_ED_THRESHOLD_400MVPP 0x0140
283 #define NCN26000_PHY_TWEAKS_RX_ED_THRESHOLD_450MVPP 0x0180
284 #define NCN26000_PHY_TWEAKS_RX_ED_THRESHOLD_500MVPP 0x01C0
285 #define NCN26000_PHY_TWEAKS_RX_ED_THRESHOLD_550MVPP 0x0200
286 #define NCN26000_PHY_TWEAKS_RX_ED_THRESHOLD_600MVPP 0x0240
287 #define NCN26000_PHY_TWEAKS_RX_ED_THRESHOLD_650MVPP 0x0280
288 #define NCN26000_PHY_TWEAKS_RX_ED_THRESHOLD_700MVPP 0x02C0
289 #define NCN26000_PHY_TWEAKS_RX_ED_THRESHOLD_750MVPP 0x0300
290 #define NCN26000_PHY_TWEAKS_RX_ED_THRESHOLD_800MVPP 0x0340
291 #define NCN26000_PHY_TWEAKS_RX_ED_THRESHOLD_850MVPP 0x0380
292 #define NCN26000_PHY_TWEAKS_RX_ED_THRESHOLD_900MVPP 0x03C0
293 #define NCN26000_PHY_TWEAKS_DIGITAL_SLEW_RATE 0x0020
294 #define NCN26000_PHY_TWEAKS_DIGITAL_SLEW_RATE_SLOW 0x0000
295 #define NCN26000_PHY_TWEAKS_DIGITAL_SLEW_RATE_FAST 0x0020
296 #define NCN26000_PHY_TWEAKS_CMC_COMP 0x0018
297 #define NCN26000_PHY_TWEAKS_CMC_COMP_0R_0_5R 0x0000
298 #define NCN26000_PHY_TWEAKS_CMC_COMP_0_5R_2_25R 0x0008
299 #define NCN26000_PHY_TWEAKS_CMC_COMP_2_25R_3_75R 0x0010
300 #define NCN26000_PHY_TWEAKS_CMC_COMP_3_75R_5R 0x0018
301 #define NCN26000_PHY_TWEAKS_TX_SLEW 0x0004
302 #define NCN26000_PHY_TWEAKS_TX_SLEW_SLOW 0x0000
303 #define NCN26000_PHY_TWEAKS_TX_SLEW_FAST 0x0004
304 
305 //Chip Info register
306 #define NCN26000_CHIP_INFO_WAFER_Y 0x7F00
307 #define NCN26000_CHIP_INFO_WAFER_X 0x007F
308 
309 //NVM Health register
310 #define NCN26000_NVM_HEALTH_RED_ZONE_NVM_WARNING 0x8000
311 #define NCN26000_NVM_HEALTH_RED_ZONE_NVM_ERROR 0x4000
312 #define NCN26000_NVM_HEALTH_YELLOW_ZONE_NVM_WARNING 0x2000
313 #define NCN26000_NVM_HEALTH_YELLOW_ZONE_NVM_ERROR 0x1000
314 #define NCN26000_NVM_HEALTH_GREEN_ZONE_NVM_WARNING 0x0800
315 #define NCN26000_NVM_HEALTH_GREEN_ZONE_NVM_ERROR 0x0400
316 
317 //PHY Revision register
318 #define NCN26000_PHY_REVISION_MAJOR_REV 0xF000
319 #define NCN26000_PHY_REVISION_MINOR_REV 0x0F00
320 #define NCN26000_PHY_REVISION_STAGE 0x00C0
321 #define NCN26000_PHY_REVISION_PATCH 0x003F
322 
323 //PHY Configuration 1 register
324 #define NCN26000_PHY_CONFIG1_PKT_LOOP 0x8000
325 #define NCN26000_PHY_CONFIG1_ENHANCED_NOISE_IMMUNITY 0x0080
326 #define NCN26000_PHY_CONFIG1_UNJAB_TMR_EN 0x0040
327 #define NCN26000_PHY_CONFIG1_SCRAMBLER_DIS 0x0004
328 #define NCN26000_PHY_CONFIG1_NO_COL_MASKING 0x0002
329 #define NCN26000_PHY_CONFIG1_RX_DELAYED 0x0001
330 
331 //PLCA Extensions register
332 #define NCN26000_PLCA_EXTENSIONS_PLCA_PRECEDENCE 0x8000
333 #define NCN26000_PLCA_EXTENSIONS_MII_EXTENSIONS_DIS 0x0800
334 #define NCN26000_PLCA_EXTENSIONS_COORDINATOR_MODE 0x0002
335 #define NCN26000_PLCA_EXTENSIONS_COORDINATOR_ROLE 0x0001
336 
337 //PMA Tune 0 register
338 #define NCN26000_PMA_TUNE0_PLCA_BEACON_DETECT_THRESH 0x3F00
339 #define NCN26000_PMA_TUNE0_PLCA_BEACON_DETECT_THRESH_DEFAULT 0x2000
340 #define NCN26000_PMA_TUNE0_DRIFT_COMP_WINDOW_SELECT 0x0007
341 #define NCN26000_PMA_TUNE0_DRIFT_COMP_WINDOW_SELECT_31BITS 0x0002
342 #define NCN26000_PMA_TUNE0_DRIFT_COMP_WINDOW_SELECT_63BITS 0x0003
343 #define NCN26000_PMA_TUNE0_DRIFT_COMP_WINDOW_SELECT_127BITS 0x0004
344 #define NCN26000_PMA_TUNE0_DRIFT_COMP_WINDOW_SELECT_OPTIMIZED 0x0005
345 
346 //PMA Tune 1 register
347 #define NCN26000_PMA_TUNE1_PKT_PREAMBLE_DETECT_THRESH 0x3F00
348 #define NCN26000_PMA_TUNE1_PKT_PREAMBLE_DETECT_THRESH_DEFAULT 0x3500
349 #define NCN26000_PMA_TUNE1_COMMIT_DETECT_THRESH 0x003F
350 #define NCN26000_PMA_TUNE1_COMMIT_DETECT_THRESH_DEFAULT 0x0020
351 
352 //PLCA Register Map and Identification (PLCIDVER) register
353 #define NCN26000_PLCIDVER_MAPID 0xFF00
354 #define NCN26000_PLCIDVER_MAPVER 0x00FF
355 
356 //PLCA Control 0 register
357 #define NCN26000_PLCA_CTRL0_EN 0x8000
358 #define NCN26000_PLCA_CTRL0_RESET 0x4000
359 
360 //PLCA Control 1 register
361 #define NCN26000_PLCA_CTRL1_NCNT 0xFF00
362 #define NCN26000_PLCA_CTRL1_ID 0x00FF
363 
364 //PLCA Status register
365 #define NCN26000_PLCA_STATUS_PST 0x8000
366 
367 //PLCA Transmit Opportunity Timer register
368 #define NCN26000_PLCA_TX_OPPORTUNITY_TMR_TOTMR 0x00FF
369 
370 //PLCA Burst Mode register
371 #define NCN26000_PLCA_BURST_MODE_MAX_BURST_COUNT 0xFF00
372 #define NCN26000_PLCA_BURST_MODE_MAX_BURST_COUNT_DEFAULT 0x0000
373 #define NCN26000_PLCA_BURST_MODE_IFG_COMP_TMR 0x00FF
374 #define NCN26000_PLCA_BURST_MODE_IFG_COMP_TMR_DEFAULT 0x0080
375 
376 //C++ guard
377 #ifdef __cplusplus
378 extern "C" {
379 #endif
380 
381 //NCN26000 Ethernet PHY driver
382 extern const PhyDriver ncn26000PhyDriver;
383 
384 //NCN26000 related functions
385 error_t ncn26000Init(NetInterface *interface);
386 void ncn26000InitHook(NetInterface *interface);
387 
388 void ncn26000Tick(NetInterface *interface);
389 
390 void ncn26000EnableIrq(NetInterface *interface);
391 void ncn26000DisableIrq(NetInterface *interface);
392 
393 void ncn26000EventHandler(NetInterface *interface);
394 
395 void ncn26000WritePhyReg(NetInterface *interface, uint8_t address,
396  uint16_t data);
397 
398 uint16_t ncn26000ReadPhyReg(NetInterface *interface, uint8_t address);
399 
400 void ncn26000DumpPhyReg(NetInterface *interface);
401 
402 void ncn26000WriteMmdReg(NetInterface *interface, uint8_t devAddr,
403  uint16_t regAddr, uint16_t data);
404 
405 uint16_t ncn26000ReadMmdReg(NetInterface *interface, uint8_t devAddr,
406  uint16_t regAddr);
407 
408 void ncn26000ModifyMmdReg(NetInterface *interface, uint8_t devAddr,
409  uint16_t regAddr, uint16_t mask, uint16_t data);
410 
411 //C++ guard
412 #ifdef __cplusplus
413 }
414 #endif
415 
416 #endif
error_t ncn26000Init(NetInterface *interface)
NCN26000 PHY transceiver initialization.
uint16_t ncn26000ReadPhyReg(NetInterface *interface, uint8_t address)
Read PHY register.
void ncn26000EventHandler(NetInterface *interface)
NCN26000 event handler.
void ncn26000DisableIrq(NetInterface *interface)
Disable interrupts.
Ethernet PHY driver.
Definition: nic.h:311
uint8_t data[]
Definition: ethernet.h:222
void ncn26000WriteMmdReg(NetInterface *interface, uint8_t devAddr, uint16_t regAddr, uint16_t data)
Write MMD register.
void ncn26000EnableIrq(NetInterface *interface)
Enable interrupts.
void ncn26000WritePhyReg(NetInterface *interface, uint8_t address, uint16_t data)
Write PHY register.
error_t
Error codes.
Definition: error.h:43
#define NetInterface
Definition: net.h:36
void ncn26000InitHook(NetInterface *interface)
NCN26000 custom configuration.
uint8_t mask
Definition: web_socket.h:319
void ncn26000ModifyMmdReg(NetInterface *interface, uint8_t devAddr, uint16_t regAddr, uint16_t mask, uint16_t data)
Modify MMD register.
void ncn26000DumpPhyReg(NetInterface *interface)
Dump PHY registers for debugging purpose.
uint16_t regAddr
uint16_t ncn26000ReadMmdReg(NetInterface *interface, uint8_t devAddr, uint16_t regAddr)
Read MMD register.
Ipv6Addr address[]
Definition: ipv6.h:325
Network interface controller abstraction layer.
void ncn26000Tick(NetInterface *interface)
NCN26000 timer handler.
const PhyDriver ncn26000PhyDriver
NCN26000 Ethernet PHY driver.