31#ifndef _RTL8211F_DRIVER_H
32#define _RTL8211F_DRIVER_H
38#ifndef RTL8211F_PHY_ADDR
39 #define RTL8211F_PHY_ADDR 1
40#elif (RTL8211F_PHY_ADDR < 0 || RTL8211F_PHY_ADDR > 31)
41 #error RTL8211F_PHY_ADDR parameter is not valid
45#define RTL8211F_BMCR 0x00
46#define RTL8211F_BMSR 0x01
47#define RTL8211F_PHYID1 0x02
48#define RTL8211F_PHYID2 0x03
49#define RTL8211F_ANAR 0x04
50#define RTL8211F_ANLPAR 0x05
51#define RTL8211F_ANER 0x06
52#define RTL8211F_ANNPTR 0x07
53#define RTL8211F_ANNPRR 0x08
54#define RTL8211F_GBCR 0x09
55#define RTL8211F_GBSR 0x0A
56#define RTL8211F_MMDACR 0x0D
57#define RTL8211F_MMDAADR 0x0E
58#define RTL8211F_GBESR 0x0F
59#define RTL8211F_INER 0x12
60#define RTL8211F_PHYCR1 0x18
61#define RTL8211F_PHYCR2 0x19
62#define RTL8211F_PHYSR 0x1A
63#define RTL8211F_INSR 0x1D
64#define RTL8211F_PAGSR 0x1F
67#define RTL8211F_PC1R 0x03, 0x00
68#define RTL8211F_PS1R 0x03, 0x01
69#define RTL8211F_EEECR 0x03, 0x14
70#define RTL8211F_EEEWER 0x03, 0x16
71#define RTL8211F_EEEAR 0x07, 0x3C
72#define RTL8211F_EEELPAR 0x07, 0x3D
75#define RTL8211F_BMCR_RESET 0x8000
76#define RTL8211F_BMCR_LOOPBACK 0x4000
77#define RTL8211F_BMCR_SPEED_SEL_LSB 0x2000
78#define RTL8211F_BMCR_AN_EN 0x1000
79#define RTL8211F_BMCR_POWER_DOWN 0x0800
80#define RTL8211F_BMCR_ISOLATE 0x0400
81#define RTL8211F_BMCR_RESTART_AN 0x0200
82#define RTL8211F_BMCR_DUPLEX_MODE 0x0100
83#define RTL8211F_BMCR_COL_TEST 0x0080
84#define RTL8211F_BMCR_SPEED_SEL_MSB 0x0040
85#define RTL8211F_BMCR_UNI_DIR_EN 0x0020
88#define RTL8211F_BMSR_100BT4 0x8000
89#define RTL8211F_BMSR_100BTX_FD 0x4000
90#define RTL8211F_BMSR_100BTX_HD 0x2000
91#define RTL8211F_BMSR_10BT_FD 0x1000
92#define RTL8211F_BMSR_10BT_HD 0x0800
93#define RTL8211F_BMSR_100BT2_FD 0x0400
94#define RTL8211F_BMSR_100BT2_HD 0x0200
95#define RTL8211F_BMSR_EXTENDED_STATUS 0x0100
96#define RTL8211F_BMSR_UNI_DIR_CAPABLE 0x0080
97#define RTL8211F_BMSR_PREAMBLE_SUPPR 0x0040
98#define RTL8211F_BMSR_AN_COMPLETE 0x0020
99#define RTL8211F_BMSR_REMOTE_FAULT 0x0010
100#define RTL8211F_BMSR_AN_CAPABLE 0x0008
101#define RTL8211F_BMSR_LINK_STATUS 0x0004
102#define RTL8211F_BMSR_JABBER_DETECT 0x0002
103#define RTL8211F_BMSR_EXTENDED_CAPABLE 0x0001
106#define RTL8211F_PHYID1_OUI_MSB 0xFFFF
107#define RTL8211F_PHYID1_OUI_MSB_DEFAULT 0x001C
110#define RTL8211F_PHYID2_OUI_LSB 0xFC00
111#define RTL8211F_PHYID2_OUI_LSB_DEFAULT 0xC800
112#define RTL8211F_PHYID2_MODEL_NUM 0x03F0
113#define RTL8211F_PHYID2_MODEL_NUM_DEFAULT 0x0110
114#define RTL8211F_PHYID2_REVISION_NUM 0x000F
115#define RTL8211F_PHYID2_REVISION_NUM_DEFAULT 0x0006
118#define RTL8211F_ANAR_NEXT_PAGE 0x8000
119#define RTL8211F_ANAR_REMOTE_FAULT 0x2000
120#define RTL8211F_ANAR_ASYM_PAUSE 0x0800
121#define RTL8211F_ANAR_PAUSE 0x0400
122#define RTL8211F_ANAR_100BT4 0x0200
123#define RTL8211F_ANAR_100BTX_FD 0x0100
124#define RTL8211F_ANAR_100BTX_HD 0x0080
125#define RTL8211F_ANAR_10BT_FD 0x0040
126#define RTL8211F_ANAR_10BT_HD 0x0020
127#define RTL8211F_ANAR_SELECTOR 0x001F
128#define RTL8211F_ANAR_SELECTOR_DEFAULT 0x0001
131#define RTL8211F_ANLPAR_NEXT_PAGE 0x8000
132#define RTL8211F_ANLPAR_ACK 0x4000
133#define RTL8211F_ANLPAR_REMOTE_FAULT 0x2000
134#define RTL8211F_ANLPAR_ASYM_PAUSE 0x0800
135#define RTL8211F_ANLPAR_PAUSE 0x0400
136#define RTL8211F_ANLPAR_100BT4 0x0200
137#define RTL8211F_ANLPAR_100BTX_FD 0x0100
138#define RTL8211F_ANLPAR_100BTX_HD 0x0080
139#define RTL8211F_ANLPAR_10BT_FD 0x0040
140#define RTL8211F_ANLPAR_10BT_HD 0x0020
141#define RTL8211F_ANLPAR_SELECTOR 0x001F
142#define RTL8211F_ANLPAR_SELECTOR_DEFAULT 0x0001
145#define RTL8211F_ANER_RX_NP_LOCATION_ABLE 0x0040
146#define RTL8211F_ANER_RX_NP_LOCATION 0x0020
147#define RTL8211F_ANER_PAR_DETECT_FAULT 0x0010
148#define RTL8211F_ANER_LP_NEXT_PAGE_ABLE 0x0008
149#define RTL8211F_ANER_NEXT_PAGE_ABLE 0x0004
150#define RTL8211F_ANER_PAGE_RECEIVED 0x0002
151#define RTL8211F_ANER_LP_AN_ABLE 0x0001
154#define RTL8211F_ANNPTR_NEXT_PAGE 0x8000
155#define RTL8211F_ANNPTR_MSG_PAGE 0x2000
156#define RTL8211F_ANNPTR_ACK2 0x1000
157#define RTL8211F_ANNPTR_TOGGLE 0x0800
158#define RTL8211F_ANNPTR_MESSAGE 0x07FF
161#define RTL8211F_ANNPRR_NEXT_PAGE 0x8000
162#define RTL8211F_ANNPRR_ACK 0x4000
163#define RTL8211F_ANNPRR_MSG_PAGE 0x2000
164#define RTL8211F_ANNPRR_ACK2 0x1000
165#define RTL8211F_ANNPRR_TOGGLE 0x0800
166#define RTL8211F_ANNPRR_MESSAGE 0x07FF
169#define RTL8211F_GBCR_TEST_MODE 0xE000
170#define RTL8211F_GBCR_MS_MAN_CONF_EN 0x1000
171#define RTL8211F_GBCR_MS_MAN_CONF_VAL 0x0800
172#define RTL8211F_GBCR_PORT_TYPE 0x0400
173#define RTL8211F_GBCR_1000BT_FD 0x0200
176#define RTL8211F_GBSR_MS_CONF_FAULT 0x8000
177#define RTL8211F_GBSR_MS_CONF_RES 0x4000
178#define RTL8211F_GBSR_LOCAL_RECEIVER_STATUS 0x2000
179#define RTL8211F_GBSR_REMOTE_RECEIVER_STATUS 0x1000
180#define RTL8211F_GBSR_LP_1000BT_FD 0x0800
181#define RTL8211F_GBSR_LP_1000BT_HD 0x0400
182#define RTL8211F_GBSR_IDLE_ERR_COUNT 0x00FF
185#define RTL8211F_MMDACR_FUNC 0xC000
186#define RTL8211F_MMDACR_FUNC_ADDR 0x0000
187#define RTL8211F_MMDACR_FUNC_DATA_NO_POST_INC 0x4000
188#define RTL8211F_MMDACR_FUNC_DATA_POST_INC_RW 0x8000
189#define RTL8211F_MMDACR_FUNC_DATA_POST_INC_W 0xC000
190#define RTL8211F_MMDACR_DEVAD 0x001F
193#define RTL8211F_GBESR_1000BX_FD 0x8000
194#define RTL8211F_GBESR_1000BX_HD 0x4000
195#define RTL8211F_GBESR_1000BT_FD 0x2000
196#define RTL8211F_GBESR_1000BT_HD 0x1000
199#define RTL8211F_INER_JABBER 0x0400
200#define RTL8211F_INER_ALDPS_STATE 0x0200
201#define RTL8211F_INER_PME 0x0080
202#define RTL8211F_INER_PHY_REG_ACCESS 0x0020
203#define RTL8211F_INER_LINK_STATUS 0x0010
204#define RTL8211F_INER_AN_COMPLETE 0x0008
205#define RTL8211F_INER_PAGE_RECEIVED 0x0004
206#define RTL8211F_INER_AN_ERROR 0x0001
209#define RTL8211F_PHYCR1_PHYAD_0_EN 0x2000
210#define RTL8211F_PHYCR1_MDI_MODE_MANUAL_CONFIG 0x0200
211#define RTL8211F_PHYCR1_MDI_MODE 0x0100
212#define RTL8211F_PHYCR1_TX_CRS_EN 0x0080
213#define RTL8211F_PHYCR1_PHYAD_NON_ZERO_DETECT 0x0040
214#define RTL8211F_PHYCR1_PREAMBLE_CHECK_EN 0x0010
215#define RTL8211F_PHYCR1_JABBER_DETECT_EN 0x0008
216#define RTL8211F_PHYCR1_ALDPS_EN 0x0004
219#define RTL8211F_PHYCR2_CLKOUT_FREQ_SEL 0x0800
220#define RTL8211F_PHYCR2_CLKOUT_SSC_EN 0x0080
221#define RTL8211F_PHYCR2_RXC_SSC_EN 0x0008
222#define RTL8211F_PHYCR2_RXC_EN 0x0002
223#define RTL8211F_PHYCR2_CLKOUT_EN 0x0001
226#define RTL8211F_PHYSR_ALDPS_STATE 0x4000
227#define RTL8211F_PHYSR_MDI_PLUG 0x2000
228#define RTL8211F_PHYSR_NWAY_EN 0x1000
229#define RTL8211F_PHYSR_MASTER_MODE 0x0800
230#define RTL8211F_PHYSR_EEE_CAPABLE 0x0100
231#define RTL8211F_PHYSR_RX_FLOW_EN 0x0080
232#define RTL8211F_PHYSR_TX_FLOW_EN 0x0040
233#define RTL8211F_PHYSR_SPEED 0x0030
234#define RTL8211F_PHYSR_SPEED_10MBPS 0x0000
235#define RTL8211F_PHYSR_SPEED_100MBPS 0x0010
236#define RTL8211F_PHYSR_SPEED_1000MBPS 0x0020
237#define RTL8211F_PHYSR_DUPLEX 0x0008
238#define RTL8211F_PHYSR_LINK 0x0004
239#define RTL8211F_PHYSR_MDI_CROSSOVER_STATUS 0x0002
240#define RTL8211F_PHYSR_JABBER 0x0001
243#define RTL8211F_INSR_JABBER 0x0400
244#define RTL8211F_INSR_ALDPS_STATE 0x0200
245#define RTL8211F_INSR_PME 0x0080
246#define RTL8211F_INSR_PHY_REG_ACCESS 0x0020
247#define RTL8211F_INSR_LINK_STATUS 0x0010
248#define RTL8211F_INSR_AN_COMPLETE 0x0008
249#define RTL8211F_INSR_PAGE_RECEIVED 0x0004
250#define RTL8211F_INSR_AN_ERROR 0x0001
253#define RTL8211F_PAGSR_PAGE_SEL 0x0007
256#define RTL8211F_PC1R_CLK_STOP_EN 0x0400
259#define RTL8211F_PS1R_TX_LPI_RCVD 0x0800
260#define RTL8211F_PS1R_RX_LPI_RCVD 0x0400
261#define RTL8211F_PS1R_TX_LPI_IND 0x0200
262#define RTL8211F_PS1R_RX_LPI_IND 0x0100
263#define RTL8211F_PS1R_CLK_STOP_CAPABLE 0x0040
266#define RTL8211F_EEECR_1000BT_EEE 0x0004
267#define RTL8211F_EEECR_100BTX_EEE 0x0002
270#define RTL8211F_EEEAR_1000BT_EEE 0x0004
271#define RTL8211F_EEEAR_100BTX_EEE 0x0002
274#define RTL8211F_EEELPAR_LP_1000BT_EEE 0x0004
275#define RTL8211F_EEELPAR_LP_100BTX_EEE 0x0002
286error_t rtl8211fInit(NetInterface *interface);
287void rtl8211fInitHook(NetInterface *interface);
289void rtl8211fTick(NetInterface *interface);
291void rtl8211fEnableIrq(NetInterface *interface);
292void rtl8211fDisableIrq(NetInterface *interface);
294void rtl8211fEventHandler(NetInterface *interface);
296void rtl8211fWritePhyReg(NetInterface *interface, uint8_t address,
299uint16_t rtl8211fReadPhyReg(NetInterface *interface, uint8_t address);
301void rtl8211fDumpPhyReg(NetInterface *interface);
303void rtl8211fWriteMmdReg(NetInterface *interface, uint8_t devAddr,
304 uint16_t regAddr, uint16_t data);
306uint16_t rtl8211fReadMmdReg(NetInterface *interface, uint8_t devAddr,
error_t
Error codes.
Definition error.h:43
Network interface controller abstraction layer.
Ethernet PHY driver.
Definition nic.h:308