mikroSDK Reference Manual
pef7071_driver.h
Go to the documentation of this file.
1
31#ifndef _PEF7071_DRIVER_H
32#define _PEF7071_DRIVER_H
33
34//Dependencies
35#include "core/nic.h"
36
37//PHY address
38#ifndef PEF7071_PHY_ADDR
39 #define PEF7071_PHY_ADDR 0
40#elif (PEF7071_PHY_ADDR < 0 || PEF7071_PHY_ADDR > 31)
41 #error PEF7071_PHY_ADDR parameter is not valid
42#endif
43
44//PEF7071 PHY registers
45#define PEF7071_CTRL 0x00
46#define PEF7071_STAT 0x01
47#define PEF7071_PHYID1 0x02
48#define PEF7071_PHYID2 0x03
49#define PEF7071_AN_ADV 0x04
50#define PEF7071_AN_LPA 0x05
51#define PEF7071_AN_EXP 0x06
52#define PEF7071_AN_NPTX 0x07
53#define PEF7071_AN_NPRX 0x08
54#define PEF7071_GCTRL 0x09
55#define PEF7071_GSTAT 0x0A
56#define PEF7071_RES11 0x0B
57#define PEF7071_RES12 0x0C
58#define PEF7071_MMDCTRL 0x0D
59#define PEF7071_MMDDATA 0x0E
60#define PEF7071_XSTAT 0x0F
61#define PEF7071_PHYPHYPERF 0x10
62#define PEF7071_PHYSTAT1 0x11
63#define PEF7071_PHYSTAT2 0x12
64#define PEF7071_PHYCTL1 0x13
65#define PEF7071_PHYCTL2 0x14
66#define PEF7071_ERRCNT 0x15
67#define PEF7071_EECTRL 0x16
68#define PEF7071_MIICTRL 0x17
69#define PEF7071_MIISTAT 0x18
70#define PEF7071_IMASK 0x19
71#define PEF7071_ISTAT 0x1A
72#define PEF7071_LED 0x1B
73#define PEF7071_TPGCTRL 0x1C
74#define PEF7071_TPGDATA 0x1D
75#define PEF7071_FWV 0x1E
76#define PEF7071_RES1F 0x1F
77
78//PEF7071 MMD registers
79#define PEF7071_EEE_CTRL1 0x03, 0x0000
80#define PEF7071_EEE_STAT1 0x03, 0x0001
81#define PEF7071_EEE_CAP 0x03, 0x0014
82#define PEF7071_EEE_WAKERR 0x03, 0x0016
83#define PEF7071_ANEGEEE_AN_ADV 0x07, 0x003C
84#define PEF7071_EEE_AN_LPADV 0x07, 0x003D
85#define PEF7071_EEPROM 0x1E, 0x0000
86#define PEF7071_LEDCH 0x1F, 0x01E0
87#define PEF7071_LEDCL 0x1F, 0x01E1
88#define PEF7071_LED0H 0x1F, 0x01E2
89#define PEF7071_LED0L 0x1F, 0x01E3
90#define PEF7071_LED1H 0x1F, 0x01E4
91#define PEF7071_LED1L 0x1F, 0x01E5
92#define PEF7071_LED2H 0x1F, 0x01E6
93#define PEF7071_LED2L 0x1F, 0x01E7
94#define PEF7071_EEE_RXERR_LINK_FAIL_H 0x1F, 0x01EA
95#define PEF7071_EEE_RXERR_LINK_FAIL_L 0x1F, 0x01EB
96#define PEF7071_MII2CTRL 0x1F, 0x01EC
97#define PEF7071_LEG_LPI_CFG0 0x1F, 0x01ED
98#define PEF7071_LEG_LPI_CFG1 0x1F, 0x01EE
99#define PEF7071_WOLCTRL 0x1F, 0x0781
100#define PEF7071_WOLAD0 0x1F, 0x0783
101#define PEF7071_WOLAD1 0x1F, 0x0784
102#define PEF7071_WOLAD2 0x1F, 0x0785
103#define PEF7071_WOLAD3 0x1F, 0x0786
104#define PEF7071_WOLAD4 0x1F, 0x0787
105#define PEF7071_WOLAD5 0x1F, 0x0788
106#define PEF7071_WOLPW0 0x1F, 0x0789
107#define PEF7071_WOLPW1 0x1F, 0x078A
108#define PEF7071_WOLPW2 0x1F, 0x078B
109#define PEF7071_WOLPW3 0x1F, 0x078C
110#define PEF7071_WOLPW4 0x1F, 0x078D
111#define PEF7071_WOLPW5 0x1F, 0x078E
112#define PEF7071_LEG_LPI_CFG2 0x1F, 0x0EB5
113#define PEF7071_LEG_LPI_CFG3 0x1F, 0x0EB7
114
115//Control register
116#define PEF7071_CTRL_RST 0x8000
117#define PEF7071_CTRL_LB 0x4000
118#define PEF7071_CTRL_SSL 0x2000
119#define PEF7071_CTRL_ANEN 0x1000
120#define PEF7071_CTRL_PD 0x0800
121#define PEF7071_CTRL_ISOL 0x0400
122#define PEF7071_CTRL_ANRS 0x0200
123#define PEF7071_CTRL_DPLX 0x0100
124#define PEF7071_CTRL_COL 0x0080
125#define PEF7071_CTRL_SSM 0x0040
126
127//Status register
128#define PEF7071_STAT_CBT4 0x8000
129#define PEF7071_STAT_CBTXF 0x4000
130#define PEF7071_STAT_CBTXH 0x2000
131#define PEF7071_STAT_XBTF 0x1000
132#define PEF7071_STAT_XBTH 0x0800
133#define PEF7071_STAT_CBT2F 0x0400
134#define PEF7071_STAT_CBT2H 0x0200
135#define PEF7071_STAT_EXT 0x0100
136#define PEF7071_STAT_MFPS 0x0040
137#define PEF7071_STAT_ANOK 0x0020
138#define PEF7071_STAT_RF 0x0010
139#define PEF7071_STAT_ANAB 0x0008
140#define PEF7071_STAT_LS 0x0004
141#define PEF7071_STAT_JD 0x0002
142#define PEF7071_STAT_XCAP 0x0001
143
144//PHY Identifier 1 register
145#define PEF7071_PHYID1_OUI_MSB 0xFFFF
146#define PEF7071_PHYID1_OUI_MSB_DEFAULT 0x0000
147
148//PHY Identifier 2 register
149#define PEF7071_PHYID2_OUI_LSB 0xFC00
150#define PEF7071_PHYID2_OUI_LSB_DEFAULT 0x0000
151#define PEF7071_PHYID2_LDN 0x03F0
152#define PEF7071_PHYID2_LDN_DEFAULT 0x0000
153#define PEF7071_PHYID2_LDRN 0x000F
154
155//Auto-Negotiation Advertisement register
156#define PEF7071_AN_ADV_NP 0x8000
157#define PEF7071_AN_ADV_RF 0x2000
158#define PEF7071_AN_ADV_TAF 0x1FE0
159#define PEF7071_AN_ADV_TAF_XBT_HDX 0x0020
160#define PEF7071_AN_ADV_TAF_XBT_FDX 0x0040
161#define PEF7071_AN_ADV_TAF_DBT_HDX 0x0080
162#define PEF7071_AN_ADV_TAF_DBT_FDX 0x0100
163#define PEF7071_AN_ADV_TAF_DBT4 0x0200
164#define PEF7071_AN_ADV_TAF_PS_SYM 0x0400
165#define PEF7071_AN_ADV_TAF_PS_ASYM 0x0800
166#define PEF7071_AN_ADV_TAF_RES 0x1000
167#define PEF7071_AN_ADV_SF 0x001F
168#define PEF7071_AN_ADV_SF_DEFAULT 0x0001
169
170//Auto-Negotiation Link-Partner Ability register
171#define PEF7071_AN_LPA_NP 0x8000
172#define PEF7071_AN_LPA_ACK 0x4000
173#define PEF7071_AN_LPA_RF 0x2000
174#define PEF7071_AN_LPA_TAF 0x1FE0
175#define PEF7071_AN_LPA_TAF_XBT_HDX 0x0020
176#define PEF7071_AN_LPA_TAF_XBT_FDX 0x0040
177#define PEF7071_AN_LPA_TAF_DBT_HDX 0x0080
178#define PEF7071_AN_LPA_TAF_DBT_FDX 0x0100
179#define PEF7071_AN_LPA_TAF_DBT4 0x0200
180#define PEF7071_AN_LPA_TAF_PS_SYM 0x0400
181#define PEF7071_AN_LPA_TAF_PS_ASYM 0x0800
182#define PEF7071_AN_LPA_TAF_RES 0x1000
183#define PEF7071_AN_LPA_SF 0x001F
184#define PEF7071_AN_LPA_SF_DEFAULT 0x0001
185
186//Auto-Negotiation Expansion register
187#define PEF7071_AN_EXP_RESD 0xFFE0
188#define PEF7071_AN_EXP_PDF 0x0010
189#define PEF7071_AN_EXP_LPNPC 0x0008
190#define PEF7071_AN_EXP_NPC 0x0004
191#define PEF7071_AN_EXP_PR 0x0002
192#define PEF7071_AN_EXP_LPANC 0x0001
193
194//Auto-Negotiation Next-Page Transmit register
195#define PEF7071_AN_NPTX_NP 0x8000
196#define PEF7071_AN_NPTX_MP 0x2000
197#define PEF7071_AN_NPTX_ACK2 0x1000
198#define PEF7071_AN_NPTX_TOGG 0x0800
199#define PEF7071_AN_NPTX_MCF 0x07FF
200
201//Auto-Negotiation Link-Partner Received Next-Page register
202#define PEF7071_AN_NPRX_NP 0x8000
203#define PEF7071_AN_NPRX_ACK 0x4000
204#define PEF7071_AN_NPRX_MP 0x2000
205#define PEF7071_AN_NPRX_ACK2 0x1000
206#define PEF7071_AN_NPRX_TOGG 0x0800
207#define PEF7071_AN_NPRX_MCF 0x07FF
208
209//Gigabit Control register
210#define PEF7071_GCTRL_TM 0xE000
211#define PEF7071_GCTRL_MSEN 0x1000
212#define PEF7071_GCTRL_MS 0x0800
213#define PEF7071_GCTRL_MSPT 0x0400
214#define PEF7071_GCTRL_MBTFD 0x0200
215#define PEF7071_GCTRL_MBTHD 0x0100
216
217//Gigabit Status register
218#define PEF7071_GSTAT_MSFAULT 0x8000
219#define PEF7071_GSTAT_MSRES 0x4000
220#define PEF7071_GSTAT_LRXSTAT 0x2000
221#define PEF7071_GSTAT_RRXSTAT 0x1000
222#define PEF7071_GSTAT_MBTFD 0x0800
223#define PEF7071_GSTAT_MBTHD 0x0400
224#define PEF7071_GSTAT_IEC 0x00FF
225
226//MMD Access Control register
227#define PEF7071_MMDCTRL_ACTYPE 0xC000
228#define PEF7071_MMDCTRL_ACTYPE_ADDR 0x0000
229#define PEF7071_MMDCTRL_ACTYPE_DATA 0x4000
230#define PEF7071_MMDCTRL_ACTYPE_DATA_PI 0x8000
231#define PEF7071_MMDCTRL_ACTYPE_DATA_PIWR 0xC000
232#define PEF7071_MMDCTRL_RESH 0x3F00
233#define PEF7071_MMDCTRL_RESL 0x00E0
234#define PEF7071_MMDCTRL_DEVAD 0x001F
235
236//MMD Access Data register
237#define PEF7071_MMDDATA_ADDR_DATA 0xFFFF
238
239//Extended Status register
240#define PEF7071_XSTAT_MBXF 0x8000
241#define PEF7071_XSTAT_MBXH 0x4000
242#define PEF7071_XSTAT_MBTF 0x2000
243#define PEF7071_XSTAT_MBTH 0x1000
244#define PEF7071_XSTAT_RESH 0x0F00
245#define PEF7071_XSTAT_RESL 0x00FF
246
247//Physical Layer Performance Status register
248#define PEF7071_PHYPHYPERF_FREQ 0xFF00
249#define PEF7071_PHYPHYPERF_SNR 0x00F0
250#define PEF7071_PHYPHYPERF_LEN 0x000F
251
252//Physical Layer Status 1 register
253#define PEF7071_PHYSTAT1_RESH 0xFE00
254#define PEF7071_PHYSTAT1_LSADS 0x0100
255#define PEF7071_PHYSTAT1_POLD 0x0080
256#define PEF7071_PHYSTAT1_POLC 0x0040
257#define PEF7071_PHYSTAT1_POLB 0x0020
258#define PEF7071_PHYSTAT1_POLA 0x0010
259#define PEF7071_PHYSTAT1_MDICD 0x0008
260#define PEF7071_PHYSTAT1_MDIAB 0x0004
261#define PEF7071_PHYSTAT1_RESL 0x0003
262
263//Physical Layer Status 2 register
264#define PEF7071_PHYSTAT2_RESD 0x8000
265#define PEF7071_PHYSTAT2_SKEWD 0x7000
266#define PEF7071_PHYSTAT2_RESC 0x0800
267#define PEF7071_PHYSTAT2_SKEWC 0x0700
268#define PEF7071_PHYSTAT2_RESB 0x0080
269#define PEF7071_PHYSTAT2_SKEWB 0x0070
270#define PEF7071_PHYSTAT2_RESA 0x0008
271#define PEF7071_PHYSTAT2_SKEWA 0x0007
272
273//Physical Layer Control 1 register
274#define PEF7071_PHYCTL1_TLOOP 0xE000
275#define PEF7071_PHYCTL1_TXOFF 0x1000
276#define PEF7071_PHYCTL1_TXADJ 0x0F00
277#define PEF7071_PHYCTL1_POLD 0x0080
278#define PEF7071_PHYCTL1_POLC 0x0040
279#define PEF7071_PHYCTL1_POLB 0x0020
280#define PEF7071_PHYCTL1_POLA 0x0010
281#define PEF7071_PHYCTL1_MDICD 0x0008
282#define PEF7071_PHYCTL1_MDIAB 0x0004
283#define PEF7071_PHYCTL1_TXEEE10 0x0002
284#define PEF7071_PHYCTL1_AMDIX 0x0001
285
286//Physical Layer Control 2 register
287#define PEF7071_PHYCTL2_LSADS 0xC000
288#define PEF7071_PHYCTL2_LSADS_OFF 0x0000
289#define PEF7071_PHYCTL2_LSADS_ADS2 0x4000
290#define PEF7071_PHYCTL2_LSADS_ADS3 0x8000
291#define PEF7071_PHYCTL2_LSADS_ADS4 0xC000
292#define PEF7071_PHYCTL2_RESH 0x3800
293#define PEF7071_PHYCTL2_CLKSEL 0x0400
294#define PEF7071_PHYCTL2_CLKSEL_CLK25M 0x0000
295#define PEF7071_PHYCTL2_CLKSEL_CLK125M 0x0400
296#define PEF7071_PHYCTL2_SDETP 0x0200
297#define PEF7071_PHYCTL2_SDETP_LOWACTIVE 0x0000
298#define PEF7071_PHYCTL2_SDETP_HIGHACTIVE 0x0200
299#define PEF7071_PHYCTL2_STICKY 0x0100
300#define PEF7071_PHYCTL2_RESL 0x00F0
301#define PEF7071_PHYCTL2_ADCR 0x0008
302#define PEF7071_PHYCTL2_ADCR_DEFAULT 0x0000
303#define PEF7071_PHYCTL2_ADCR_BOOST 0x0008
304#define PEF7071_PHYCTL2_PSCL 0x0004
305#define PEF7071_PHYCTL2_ANPD 0x0002
306#define PEF7071_PHYCTL2_LPI 0x0001
307
308//Error Counter register
309#define PEF7071_ERRCNT_SEL 0x0F00
310#define PEF7071_ERRCNT_SEL_RXERR 0x0000
311#define PEF7071_ERRCNT_SEL_RXACT 0x0100
312#define PEF7071_ERRCNT_SEL_ESDERR 0x0200
313#define PEF7071_ERRCNT_SEL_SSDERR 0x0300
314#define PEF7071_ERRCNT_SEL_TXERR 0x0400
315#define PEF7071_ERRCNT_SEL_TXACT 0x0500
316#define PEF7071_ERRCNT_SEL_COL 0x0600
317#define PEF7071_ERRCNT_COUNT 0x00FF
318
319//EEPROM Control register
320#define PEF7071_EECTRL_EESCAN 0x8000
321#define PEF7071_EECTRL_EEAF 0x4000
322#define PEF7071_EECTRL_CSRDET 0x2000
323#define PEF7071_EECTRL_EEDET 0x1000
324#define PEF7071_EECTRL_SIZE 0x0F00
325#define PEF7071_EECTRL_SIZE_SIZE1K 0x0000
326#define PEF7071_EECTRL_SIZE_SIZE2K 0x0100
327#define PEF7071_EECTRL_SIZE_SIZE4K 0x0200
328#define PEF7071_EECTRL_SIZE_SIZE8K 0x0300
329#define PEF7071_EECTRL_SIZE_SIZE16K 0x0400
330#define PEF7071_EECTRL_SIZE_SIZE32K 0x0500
331#define PEF7071_EECTRL_SIZE_SIZE64K 0x0600
332#define PEF7071_EECTRL_SIZE_SIZE128K 0x0700
333#define PEF7071_EECTRL_SIZE_SIZE256K 0x0800
334#define PEF7071_EECTRL_SIZE_SIZE512K 0x0900
335#define PEF7071_EECTRL_SIZE_SIZE1024K 0x0A00
336#define PEF7071_EECTRL_ADRMODE 0x0080
337#define PEF7071_EECTRL_ADRMODE_MODE11 0x0000
338#define PEF7071_EECTRL_ADRMODE_MODE16 0x0080
339#define PEF7071_EECTRL_DADR 0x0070
340#define PEF7071_EECTRL_SPEED 0x000C
341#define PEF7071_EECTRL_SPEED_FRQ_100KHZ 0x0000
342#define PEF7071_EECTRL_SPEED_FRQ_400KHZ 0x0004
343#define PEF7071_EECTRL_SPEED_FRQ_1_0MHZ 0x0008
344#define PEF7071_EECTRL_SPEED_FRQ_3_4MHZ 0x000C
345#define PEF7071_EECTRL_RDWR 0x0002
346#define PEF7071_EECTRL_EXEC 0x0001
347
348//Media-Independent Interface Control register
349#define PEF7071_MIICTRL_RXCOFF 0x8000
350#define PEF7071_MIICTRL_RXSKEW 0x7000
351#define PEF7071_MIICTRL_RXSKEW_SKEW_0N0 0x0000
352#define PEF7071_MIICTRL_RXSKEW_SKEW_0N5 0x1000
353#define PEF7071_MIICTRL_RXSKEW_SKEW_1N0 0x2000
354#define PEF7071_MIICTRL_RXSKEW_SKEW_1N5 0x3000
355#define PEF7071_MIICTRL_RXSKEW_SKEW_2N0 0x4000
356#define PEF7071_MIICTRL_RXSKEW_SKEW_2N5 0x5000
357#define PEF7071_MIICTRL_RXSKEW_SKEW_3N0 0x6000
358#define PEF7071_MIICTRL_RXSKEW_SKEW_3N5 0x7000
359#define PEF7071_MIICTRL_V25_33 0x0800
360#define PEF7071_MIICTRL_TXSKEW 0x0700
361#define PEF7071_MIICTRL_TXSKEW_SKEW_0N0 0x0000
362#define PEF7071_MIICTRL_TXSKEW_SKEW_0N5 0x0100
363#define PEF7071_MIICTRL_TXSKEW_SKEW_1N0 0x0200
364#define PEF7071_MIICTRL_TXSKEW_SKEW_1N5 0x0300
365#define PEF7071_MIICTRL_TXSKEW_SKEW_2N0 0x0400
366#define PEF7071_MIICTRL_TXSKEW_SKEW_2N5 0x0500
367#define PEF7071_MIICTRL_TXSKEW_SKEW_3N0 0x0600
368#define PEF7071_MIICTRL_TXSKEW_SKEW_3N5 0x0700
369#define PEF7071_MIICTRL_CRS 0x00C0
370#define PEF7071_MIICTRL_FLOW 0x0030
371#define PEF7071_MIICTRL_FLOW_COPPER 0x0000
372#define PEF7071_MIICTRL_FLOW_CONVERTER 0x0030
373#define PEF7071_MIICTRL_MODE 0x000F
374#define PEF7071_MIICTRL_MODE_RGMII 0x0000
375#define PEF7071_MIICTRL_MODE_SGMII 0x0001
376#define PEF7071_MIICTRL_MODE_RMII 0x0002
377#define PEF7071_MIICTRL_MODE_RTBI 0x0003
378#define PEF7071_MIICTRL_MODE_GMII 0x0004
379#define PEF7071_MIICTRL_MODE_TBI 0x0005
380#define PEF7071_MIICTRL_MODE_SGMIINC 0x0006
381#define PEF7071_MIICTRL_MODE_TEST 0x000F
382#define PEF7071_MIICTRL_MODE_CONV_X2T1000 0x0000
383#define PEF7071_MIICTRL_MODE_CONV_X2T1000A 0x0001
384
385//Media-Independent Interface Status register
386#define PEF7071_MIISTAT_RESH 0xFF00
387#define PEF7071_MIISTAT_PHY 0x00C0
388#define PEF7071_MIISTAT_PHY_TP 0x0000
389#define PEF7071_MIISTAT_PHY_FIBER 0x0040
390#define PEF7071_MIISTAT_PHY_MII2 0x0080
391#define PEF7071_MIISTAT_PHY_SGMII 0x00C0
392#define PEF7071_MIISTAT_PS 0x0030
393#define PEF7071_MIISTAT_PS_NONE 0x0000
394#define PEF7071_MIISTAT_PS_TX 0x0010
395#define PEF7071_MIISTAT_PS_RX 0x0020
396#define PEF7071_MIISTAT_PS_TXRX 0x0030
397#define PEF7071_MIISTAT_DPX 0x0008
398#define PEF7071_MIISTAT_EEE 0x0004
399#define PEF7071_MIISTAT_EEE_OFF 0x0000
400#define PEF7071_MIISTAT_EEE_ON 0x0004
401#define PEF7071_MIISTAT_SPEED 0x0003
402#define PEF7071_MIISTAT_SPEED_TEN 0x0000
403#define PEF7071_MIISTAT_SPEED_FAST 0x0001
404#define PEF7071_MIISTAT_SPEED_GIGA 0x0002
405#define PEF7071_MIISTAT_SPEED_RES 0x0003
406
407//Interrupt Mask register
408#define PEF7071_IMASK_WOL 0x8000
409#define PEF7071_IMASK_MSRE 0x4000
410#define PEF7071_IMASK_NPRX 0x2000
411#define PEF7071_IMASK_NPTX 0x1000
412#define PEF7071_IMASK_ANE 0x0800
413#define PEF7071_IMASK_ANC 0x0400
414#define PEF7071_IMASK_RESH 0x0300
415#define PEF7071_IMASK_RESL 0x00C0
416#define PEF7071_IMASK_ADSC 0x0020
417#define PEF7071_IMASK_MDIPC 0x0010
418#define PEF7071_IMASK_MDIXC 0x0008
419#define PEF7071_IMASK_DXMC 0x0004
420#define PEF7071_IMASK_LSPC 0x0002
421#define PEF7071_IMASK_LSTC 0x0001
422
423//Interrupt Status register
424#define PEF7071_ISTAT_WOL 0x8000
425#define PEF7071_ISTAT_MSRE 0x4000
426#define PEF7071_ISTAT_NPRX 0x2000
427#define PEF7071_ISTAT_NPTX 0x1000
428#define PEF7071_ISTAT_ANE 0x0800
429#define PEF7071_ISTAT_ANC 0x0400
430#define PEF7071_ISTAT_RESH 0x0300
431#define PEF7071_ISTAT_RESL 0x00C0
432#define PEF7071_ISTAT_ADSC 0x0020
433#define PEF7071_ISTAT_MDIPC 0x0010
434#define PEF7071_ISTAT_MDIXC 0x0008
435#define PEF7071_ISTAT_DXMC 0x0004
436#define PEF7071_ISTAT_LSPC 0x0002
437#define PEF7071_ISTAT_LSTC 0x0001
438
439//LED Control register
440#define PEF7071_LED_RESH 0xF000
441#define PEF7071_LED_LED3EN 0x0800
442#define PEF7071_LED_LED2EN 0x0400
443#define PEF7071_LED_LED1EN 0x0200
444#define PEF7071_LED_LED0EN 0x0100
445#define PEF7071_LED_RESL 0x00F0
446#define PEF7071_LED_LED3DA 0x0008
447#define PEF7071_LED_LED3DA_OFF 0x0000
448#define PEF7071_LED_LED3DA_ON 0x0008
449#define PEF7071_LED_LED2DA 0x0004
450#define PEF7071_LED_LED2DA_OFF 0x0000
451#define PEF7071_LED_LED2DA_ON 0x0004
452#define PEF7071_LED_LED1DA 0x0002
453#define PEF7071_LED_LED1DA_OFF 0x0000
454#define PEF7071_LED_LED1DA_ON 0x0002
455#define PEF7071_LED_LED0DA 0x0001
456#define PEF7071_LED_LED0DA_OFF 0x0000
457#define PEF7071_LED_LED0DA_ON 0x0001
458
459//Test-Packet Generator Control register
460#define PEF7071_TPGCTRL_RESH1 0xC000
461#define PEF7071_TPGCTRL_MODE 0x2000
462#define PEF7071_TPGCTRL_MODE_BURST 0x0000
463#define PEF7071_TPGCTRL_MODE_SINGLE 0x2000
464#define PEF7071_TPGCTRL_RESH0 0x1000
465#define PEF7071_TPGCTRL_IPGL 0x0C00
466#define PEF7071_TPGCTRL_IPGL_BT48 0x0000
467#define PEF7071_TPGCTRL_IPGL_BT96 0x0400
468#define PEF7071_TPGCTRL_IPGL_BT960 0x0800
469#define PEF7071_TPGCTRL_IPGL_BT9600 0x0C00
470#define PEF7071_TPGCTRL_TYPE 0x0300
471#define PEF7071_TPGCTRL_TYPE_RANDOM 0x0000
472#define PEF7071_TPGCTRL_TYPE_BYTEINC 0x0100
473#define PEF7071_TPGCTRL_TYPE_PREDEF 0x0200
474#define PEF7071_TPGCTRL_RESL1 0x0080
475#define PEF7071_TPGCTRL_SIZE 0x0070
476#define PEF7071_TPGCTRL_SIZE_B64 0x0000
477#define PEF7071_TPGCTRL_SIZE_B128 0x0010
478#define PEF7071_TPGCTRL_SIZE_B256 0x0020
479#define PEF7071_TPGCTRL_SIZE_B512 0x0030
480#define PEF7071_TPGCTRL_SIZE_B1024 0x0040
481#define PEF7071_TPGCTRL_SIZE_B1518 0x0050
482#define PEF7071_TPGCTRL_SIZE_B9600 0x0060
483#define PEF7071_TPGCTRL_RESL0 0x000C
484#define PEF7071_TPGCTRL_START 0x0002
485#define PEF7071_TPGCTRL_EN 0x0001
486
487//Test-Packet Generator Data register
488#define PEF7071_TPGDATA_DA 0xF000
489#define PEF7071_TPGDATA_SA 0x0F00
490#define PEF7071_TPGDATA_DATA 0x00FF
491
492//Firmware Version register
493#define PEF7071_FWV_REL 0x8000
494#define PEF7071_FWV_REL_TEST 0x0000
495#define PEF7071_FWV_REL_RELEASE 0x8000
496#define PEF7071_FWV_MAJOR 0x7F00
497#define PEF7071_FWV_MINOR 0x00FF
498
499//EEE Control 1 register
500#define PEF7071_EEE_CTRL1_RXCKST 0x0400
501
502//EEE Status 1 register
503#define PEF7071_EEE_STAT1_TXLPI_RCVD 0x0800
504#define PEF7071_EEE_STAT1_TXLPI_IND 0x0200
505#define PEF7071_EEE_STAT1_RXLPI_IND 0x0100
506#define PEF7071_EEE_STAT1_TXCKST 0x0040
507
508//EEE Capability register
509#define PEF7071_EEE_CAP_EEE_10GBKR 0x0040
510#define PEF7071_EEE_CAP_EEE_10GBKX4 0x0020
511#define PEF7071_EEE_CAP_EEE_1000BKX 0x0010
512#define PEF7071_EEE_CAP_EEE_10GBT 0x0008
513#define PEF7071_EEE_CAP_EEE_1000BT 0x0004
514#define PEF7071_EEE_CAP_EEE_100BTX 0x0002
515
516//EEE Wake Time Fault Count register
517#define PEF7071_EEE_WAKERR_ERRCNT 0xFFFF
518
519//EEE Auto-Negotiation Advertisement register
520#define PEF7071_ANEGEEE_AN_ADV_EEE_10GBKR 0x0040
521#define PEF7071_ANEGEEE_AN_ADV_EEE_10GBKX4 0x0020
522#define PEF7071_ANEGEEE_AN_ADV_EEE_1000BKX 0x0010
523#define PEF7071_ANEGEEE_AN_ADV_EEE_10GBT 0x0008
524#define PEF7071_ANEGEEE_AN_ADV_EEE_1000BT 0x0004
525#define PEF7071_ANEGEEE_AN_ADV_EEE_100BTX 0x0002
526
527//EEE Auto-Negotiation Link-Partner Advertisement register
528#define PEF7071_EEE_AN_LPADV_EEE_10GBKR 0x0040
529#define PEF7071_EEE_AN_LPADV_EEE_10GBKX4 0x0020
530#define PEF7071_EEE_AN_LPADV_EEE_1000BKX 0x0010
531#define PEF7071_EEE_AN_LPADV_EEE_10GBT 0x0008
532#define PEF7071_EEE_AN_LPADV_EEE_1000BT 0x0004
533#define PEF7071_EEE_AN_LPADV_EEE_100BTX 0x0002
534
535//EEPROM Content register
536#define PEF7071_EEPROM_DATA 0x00FF
537
538//LED Configuration H register
539#define PEF7071_LEDCH_FBF 0x00C0
540#define PEF7071_LEDCH_FBF_F02HZ 0x0000
541#define PEF7071_LEDCH_FBF_F04HZ 0x0040
542#define PEF7071_LEDCH_FBF_F08HZ 0x0080
543#define PEF7071_LEDCH_FBF_F16HZ 0x00C0
544#define PEF7071_LEDCH_SBF 0x0030
545#define PEF7071_LEDCH_SBF_F02HZ 0x0000
546#define PEF7071_LEDCH_SBF_F04HZ 0x0010
547#define PEF7071_LEDCH_SBF_F08HZ 0x0020
548#define PEF7071_LEDCH_SBF_F16HZ 0x0030
549#define PEF7071_LEDCH_NACS 0x0007
550#define PEF7071_LEDCH_NACS_NONE 0x0000
551#define PEF7071_LEDCH_NACS_LINK 0x0001
552#define PEF7071_LEDCH_NACS_PDOWN 0x0002
553#define PEF7071_LEDCH_NACS_EEE 0x0003
554#define PEF7071_LEDCH_NACS_ANEG 0x0004
555#define PEF7071_LEDCH_NACS_ABIST 0x0005
556#define PEF7071_LEDCH_NACS_CDIAG 0x0006
557#define PEF7071_LEDCH_NACS_TEST 0x0007
558
559//LED Configuration L register
560#define PEF7071_LEDCL_SCAN 0x0070
561#define PEF7071_LEDCL_SCAN_NONE 0x0000
562#define PEF7071_LEDCL_SCAN_LINK 0x0010
563#define PEF7071_LEDCL_SCAN_PDOWN 0x0020
564#define PEF7071_LEDCL_SCAN_EEE 0x0030
565#define PEF7071_LEDCL_SCAN_ANEG 0x0040
566#define PEF7071_LEDCL_SCAN_ABIST 0x0050
567#define PEF7071_LEDCL_SCAN_CDIAG 0x0060
568#define PEF7071_LEDCL_SCAN_TEST 0x0070
569#define PEF7071_LEDCL_CBLINK 0x0007
570#define PEF7071_LEDCL_CBLINK_NONE 0x0000
571#define PEF7071_LEDCL_CBLINK_LINK 0x0001
572#define PEF7071_LEDCL_CBLINK_PDOWN 0x0002
573#define PEF7071_LEDCL_CBLINK_EEE 0x0003
574#define PEF7071_LEDCL_CBLINK_ANEG 0x0004
575#define PEF7071_LEDCL_CBLINK_ABIST 0x0005
576#define PEF7071_LEDCL_CBLINK_CDIAG 0x0006
577#define PEF7071_LEDCL_CBLINK_TEST 0x0007
578
579//Configuration for LED Pin 0 H register
580#define PEF7071_LED0H_CON 0x00F0
581#define PEF7071_LED0H_CON_NONE 0x0000
582#define PEF7071_LED0H_CON_LINK10 0x0010
583#define PEF7071_LED0H_CON_LINK100 0x0020
584#define PEF7071_LED0H_CON_LINK10X 0x0030
585#define PEF7071_LED0H_CON_LINK1000 0x0040
586#define PEF7071_LED0H_CON_LINK10_0 0x0050
587#define PEF7071_LED0H_CON_LINK100X 0x0060
588#define PEF7071_LED0H_CON_LINK10XX 0x0070
589#define PEF7071_LED0H_CON_PDOWN 0x0080
590#define PEF7071_LED0H_CON_EEE 0x0090
591#define PEF7071_LED0H_CON_ANEG 0x00A0
592#define PEF7071_LED0H_CON_ABIST 0x00B0
593#define PEF7071_LED0H_CON_CDIAG 0x00C0
594#define PEF7071_LED0H_CON_COPPER 0x00D0
595#define PEF7071_LED0H_CON_FIBER 0x00E0
596#define PEF7071_LED0H_BLINKF 0x000F
597#define PEF7071_LED0H_BLINKF_NONE 0x0000
598#define PEF7071_LED0H_BLINKF_LINK10 0x0001
599#define PEF7071_LED0H_BLINKF_LINK100 0x0002
600#define PEF7071_LED0H_BLINKF_LINK10X 0x0003
601#define PEF7071_LED0H_BLINKF_LINK1000 0x0004
602#define PEF7071_LED0H_BLINKF_LINK10_0 0x0005
603#define PEF7071_LED0H_BLINKF_LINK100X 0x0006
604#define PEF7071_LED0H_BLINKF_LINK10XX 0x0007
605#define PEF7071_LED0H_BLINKF_PDOWN 0x0008
606#define PEF7071_LED0H_BLINKF_EEE 0x0009
607#define PEF7071_LED0H_BLINKF_ANEG 0x000A
608#define PEF7071_LED0H_BLINKF_ABIST 0x000B
609#define PEF7071_LED0H_BLINKF_CDIAG 0x000C
610
611//Configuration for LED Pin 0 L register
612#define PEF7071_LED0L_BLINKS 0x00F0
613#define PEF7071_LED0L_BLINKS_NONE 0x0000
614#define PEF7071_LED0L_BLINKS_LINK10 0x0010
615#define PEF7071_LED0L_BLINKS_LINK100 0x0020
616#define PEF7071_LED0L_BLINKS_LINK10X 0x0030
617#define PEF7071_LED0L_BLINKS_LINK1000 0x0040
618#define PEF7071_LED0L_BLINKS_LINK10_0 0x0050
619#define PEF7071_LED0L_BLINKS_LINK100X 0x0060
620#define PEF7071_LED0L_BLINKS_LINK10XX 0x0070
621#define PEF7071_LED0L_BLINKS_PDOWN 0x0080
622#define PEF7071_LED0L_BLINKS_EEE 0x0090
623#define PEF7071_LED0L_BLINKS_ANEG 0x00A0
624#define PEF7071_LED0L_BLINKS_ABIST 0x00B0
625#define PEF7071_LED0L_BLINKS_CDIAG 0x00C0
626#define PEF7071_LED0L_PULSE 0x000F
627#define PEF7071_LED0L_PULSE_NONE 0x0000
628#define PEF7071_LED0L_PULSE_TXACT 0x0001
629#define PEF7071_LED0L_PULSE_RXACT 0x0002
630#define PEF7071_LED0L_PULSE_COL 0x0004
631
632//Configuration for LED Pin 1 H register
633#define PEF7071_LED1H_CON 0x00F0
634#define PEF7071_LED1H_CON_NONE 0x0000
635#define PEF7071_LED1H_CON_LINK10 0x0010
636#define PEF7071_LED1H_CON_LINK100 0x0020
637#define PEF7071_LED1H_CON_LINK10X 0x0030
638#define PEF7071_LED1H_CON_LINK1000 0x0040
639#define PEF7071_LED1H_CON_LINK10_0 0x0050
640#define PEF7071_LED1H_CON_LINK100X 0x0060
641#define PEF7071_LED1H_CON_LINK10XX 0x0070
642#define PEF7071_LED1H_CON_PDOWN 0x0080
643#define PEF7071_LED1H_CON_EEE 0x0090
644#define PEF7071_LED1H_CON_ANEG 0x00A0
645#define PEF7071_LED1H_CON_ABIST 0x00B0
646#define PEF7071_LED1H_CON_CDIAG 0x00C0
647#define PEF7071_LED1H_CON_COPPER 0x00D0
648#define PEF7071_LED1H_CON_FIBER 0x00E0
649#define PEF7071_LED1H_BLINKF 0x000F
650#define PEF7071_LED1H_BLINKF_NONE 0x0000
651#define PEF7071_LED1H_BLINKF_LINK10 0x0001
652#define PEF7071_LED1H_BLINKF_LINK100 0x0002
653#define PEF7071_LED1H_BLINKF_LINK10X 0x0003
654#define PEF7071_LED1H_BLINKF_LINK1000 0x0004
655#define PEF7071_LED1H_BLINKF_LINK10_0 0x0005
656#define PEF7071_LED1H_BLINKF_LINK100X 0x0006
657#define PEF7071_LED1H_BLINKF_LINK10XX 0x0007
658#define PEF7071_LED1H_BLINKF_PDOWN 0x0008
659#define PEF7071_LED1H_BLINKF_EEE 0x0009
660#define PEF7071_LED1H_BLINKF_ANEG 0x000A
661#define PEF7071_LED1H_BLINKF_ABIST 0x000B
662#define PEF7071_LED1H_BLINKF_CDIAG 0x000C
663
664//Configuration for LED Pin 1 L register
665#define PEF7071_LED1L_BLINKS 0x00F0
666#define PEF7071_LED1L_BLINKS_NONE 0x0000
667#define PEF7071_LED1L_BLINKS_LINK10 0x0010
668#define PEF7071_LED1L_BLINKS_LINK100 0x0020
669#define PEF7071_LED1L_BLINKS_LINK10X 0x0030
670#define PEF7071_LED1L_BLINKS_LINK1000 0x0040
671#define PEF7071_LED1L_BLINKS_LINK10_0 0x0050
672#define PEF7071_LED1L_BLINKS_LINK100X 0x0060
673#define PEF7071_LED1L_BLINKS_LINK10XX 0x0070
674#define PEF7071_LED1L_BLINKS_PDOWN 0x0080
675#define PEF7071_LED1L_BLINKS_EEE 0x0090
676#define PEF7071_LED1L_BLINKS_ANEG 0x00A0
677#define PEF7071_LED1L_BLINKS_ABIST 0x00B0
678#define PEF7071_LED1L_BLINKS_CDIAG 0x00C0
679#define PEF7071_LED1L_PULSE 0x000F
680#define PEF7071_LED1L_PULSE_NONE 0x0000
681#define PEF7071_LED1L_PULSE_TXACT 0x0001
682#define PEF7071_LED1L_PULSE_RXACT 0x0002
683#define PEF7071_LED1L_PULSE_COL 0x0004
684
685//Configuration for LED Pin 2 H register
686#define PEF7071_LED2H_CON 0x00F0
687#define PEF7071_LED2H_CON_NONE 0x0000
688#define PEF7071_LED2H_CON_LINK10 0x0010
689#define PEF7071_LED2H_CON_LINK100 0x0020
690#define PEF7071_LED2H_CON_LINK10X 0x0030
691#define PEF7071_LED2H_CON_LINK1000 0x0040
692#define PEF7071_LED2H_CON_LINK10_0 0x0050
693#define PEF7071_LED2H_CON_LINK100X 0x0060
694#define PEF7071_LED2H_CON_LINK10XX 0x0070
695#define PEF7071_LED2H_CON_PDOWN 0x0080
696#define PEF7071_LED2H_CON_EEE 0x0090
697#define PEF7071_LED2H_CON_ANEG 0x00A0
698#define PEF7071_LED2H_CON_ABIST 0x00B0
699#define PEF7071_LED2H_CON_CDIAG 0x00C0
700#define PEF7071_LED2H_CON_COPPER 0x00D0
701#define PEF7071_LED2H_CON_FIBER 0x00E0
702#define PEF7071_LED2H_BLINKF 0x000F
703#define PEF7071_LED2H_BLINKF_NONE 0x0000
704#define PEF7071_LED2H_BLINKF_LINK10 0x0001
705#define PEF7071_LED2H_BLINKF_LINK100 0x0002
706#define PEF7071_LED2H_BLINKF_LINK10X 0x0003
707#define PEF7071_LED2H_BLINKF_LINK1000 0x0004
708#define PEF7071_LED2H_BLINKF_LINK10_0 0x0005
709#define PEF7071_LED2H_BLINKF_LINK100X 0x0006
710#define PEF7071_LED2H_BLINKF_LINK10XX 0x0007
711#define PEF7071_LED2H_BLINKF_PDOWN 0x0008
712#define PEF7071_LED2H_BLINKF_EEE 0x0009
713#define PEF7071_LED2H_BLINKF_ANEG 0x000A
714#define PEF7071_LED2H_BLINKF_ABIST 0x000B
715#define PEF7071_LED2H_BLINKF_CDIAG 0x000C
716
717//Configuration for LED Pin 2 L register
718#define PEF7071_LED2L_BLINKS 0x00F0
719#define PEF7071_LED2L_BLINKS_NONE 0x0000
720#define PEF7071_LED2L_BLINKS_LINK10 0x0010
721#define PEF7071_LED2L_BLINKS_LINK100 0x0020
722#define PEF7071_LED2L_BLINKS_LINK10X 0x0030
723#define PEF7071_LED2L_BLINKS_LINK1000 0x0040
724#define PEF7071_LED2L_BLINKS_LINK10_0 0x0050
725#define PEF7071_LED2L_BLINKS_LINK100X 0x0060
726#define PEF7071_LED2L_BLINKS_LINK10XX 0x0070
727#define PEF7071_LED2L_BLINKS_PDOWN 0x0080
728#define PEF7071_LED2L_BLINKS_EEE 0x0090
729#define PEF7071_LED2L_BLINKS_ANEG 0x00A0
730#define PEF7071_LED2L_BLINKS_ABIST 0x00B0
731#define PEF7071_LED2L_BLINKS_CDIAG 0x00C0
732#define PEF7071_LED2L_PULSE 0x000F
733#define PEF7071_LED2L_PULSE_NONE 0x0000
734#define PEF7071_LED2L_PULSE_TXACT 0x0001
735#define PEF7071_LED2L_PULSE_RXACT 0x0002
736#define PEF7071_LED2L_PULSE_COL 0x0004
737
738//EEE Link-Fail Counter H register
739#define PEF7071_EEE_RXERR_LINK_FAIL_H_VAL 0x00FF
740
741//EEE Link-Fail Counter L register
742#define PEF7071_EEE_RXERR_LINK_FAIL_L_VAL 0x00FF
743
744//MII2 Control register
745#define PEF7071_MII2CTRL_RXSKEW 0x0070
746#define PEF7071_MII2CTRL_RXSKEW_SKEW_0N0 0x0000
747#define PEF7071_MII2CTRL_RXSKEW_SKEW_0N5 0x0010
748#define PEF7071_MII2CTRL_RXSKEW_SKEW_1N0 0x0020
749#define PEF7071_MII2CTRL_RXSKEW_SKEW_1N5 0x0030
750#define PEF7071_MII2CTRL_RXSKEW_SKEW_2N0 0x0040
751#define PEF7071_MII2CTRL_RXSKEW_SKEW_2N5 0x0050
752#define PEF7071_MII2CTRL_RXSKEW_SKEW_3N0 0x0060
753#define PEF7071_MII2CTRL_RXSKEW_SKEW_3N5 0x0070
754#define PEF7071_MII2CTRL_TXSKEW 0x0007
755#define PEF7071_MII2CTRL_TXSKEW_SKEW_0N0 0x0000
756#define PEF7071_MII2CTRL_TXSKEW_SKEW_0N5 0x0001
757#define PEF7071_MII2CTRL_TXSKEW_SKEW_1N0 0x0002
758#define PEF7071_MII2CTRL_TXSKEW_SKEW_1N5 0x0003
759#define PEF7071_MII2CTRL_TXSKEW_SKEW_2N0 0x0004
760#define PEF7071_MII2CTRL_TXSKEW_SKEW_2N5 0x0005
761#define PEF7071_MII2CTRL_TXSKEW_SKEW_3N0 0x0006
762#define PEF7071_MII2CTRL_TXSKEW_SKEW_3N5 0x0007
763
764//Legacy LPI Configuration 0 register
765#define PEF7071_LEG_LPI_CFG0_HOLDOFF_100BT 0x00FF
766
767//Legacy LPI Configuration 1 register
768#define PEF7071_LEG_LPI_CFG1_HOLDOFF_1000BT 0x00FF
769
770//Wake-On-LAN Control register
771#define PEF7071_WOLCTRL_SPWD_EN 0x0004
772#define PEF7071_WOLCTRL_RES 0x0002
773#define PEF7071_WOLCTRL_EN 0x0001
774
775//Wake-On-LAN Address Byte 0 register
776#define PEF7071_WOLAD0_VAL 0x00FF
777
778//Wake-On-LAN Address Byte 1 register
779#define PEF7071_WOLAD1_VAL 0x00FF
780
781//Wake-On-LAN Address Byte 2 register
782#define PEF7071_WOLAD2_VAL 0x00FF
783
784//Wake-On-LAN Address Byte 3 register
785#define PEF7071_WOLAD3_VAL 0x00FF
786
787//Wake-On-LAN Address Byte 4 register
788#define PEF7071_WOLAD4_VAL 0x00FF
789
790//Wake-On-LAN Address Byte 5 register
791#define PEF7071_WOLAD5_VAL 0x00FF
792
793//Wake-On-LAN SecureON Password Byte 0 register
794#define PEF7071_WOLPW0_VAL 0x00FF
795
796//Wake-On-LAN SecureON Password Byte 1 register
797#define PEF7071_WOLPW1_VAL 0x00FF
798
799//Wake-On-LAN SecureON Password Byte 2 register
800#define PEF7071_WOLPW2_VAL 0x00FF
801
802//Wake-On-LAN SecureON Password Byte 3 register
803#define PEF7071_WOLPW3_VAL 0x00FF
804
805//Wake-On-LAN SecureON Password Byte 4 register
806#define PEF7071_WOLPW4_VAL 0x00FF
807
808//Wake-On-LAN SecureON Password Byte 5 register
809#define PEF7071_WOLPW5_VAL 0x00FF
810
811//Legacy LPI Configuration 2 register
812#define PEF7071_LEG_LPI_CFG2_IPG 0x00FF
813#define PEF7071_LEG_LPI_CFG2_IPG_DEFAULT 0x000E
814
815//Legacy LPI Configuration 3 register
816#define PEF7071_LEG_LPI_CFG3_IDLE 0x00FF
817#define PEF7071_LEG_LPI_CFG3_IDLE_DEFAULT 0x0040
818
819//C++ guard
820#ifdef __cplusplus
821extern "C" {
822#endif
823
824//PEF7071 Ethernet PHY driver
825extern const PhyDriver pef7071PhyDriver;
826
827//PEF7071 related functions
828error_t pef7071Init(NetInterface *interface);
829void pef7071InitHook(NetInterface *interface);
830
831void pef7071Tick(NetInterface *interface);
832
833void pef7071EnableIrq(NetInterface *interface);
834void pef7071DisableIrq(NetInterface *interface);
835
836void pef7071EventHandler(NetInterface *interface);
837
838void pef7071WritePhyReg(NetInterface *interface, uint8_t address,
839 uint16_t data);
840
841uint16_t pef7071ReadPhyReg(NetInterface *interface, uint8_t address);
842
843void pef7071DumpPhyReg(NetInterface *interface);
844
845void pef7071WriteMmdReg(NetInterface *interface, uint8_t devAddr,
846 uint16_t regAddr, uint16_t data);
847
848uint16_t pef7071ReadMmdReg(NetInterface *interface, uint8_t devAddr,
849 uint16_t regAddr);
850
851//C++ guard
852#ifdef __cplusplus
853}
854#endif
855
856#endif
error_t
Error codes.
Definition error.h:43
Network interface controller abstraction layer.
Ethernet PHY driver.
Definition nic.h:308