Go to the documentation of this file.
31 #ifndef _RTL8201_DRIVER_H
32 #define _RTL8201_DRIVER_H
38 #ifndef RTL8201_PHY_ADDR
39 #define RTL8201_PHY_ADDR 1
40 #elif (RTL8201_PHY_ADDR < 0 || RTL8201_PHY_ADDR > 31)
41 #error RTL8201_PHY_ADDR parameter is not valid
45 #define RTL8201_BMCR 0x00
46 #define RTL8201_BMSR 0x01
47 #define RTL8201_PHYID1 0x02
48 #define RTL8201_PHYID2 0x03
49 #define RTL8201_ANAR 0x04
50 #define RTL8201_ANLPAR 0x05
51 #define RTL8201_ANER 0x06
52 #define RTL8201_MACR 0x0D
53 #define RTL8201_MAADR 0x0E
54 #define RTL8201_PSMR 0x18
55 #define RTL8201_FMLR 0x1C
56 #define RTL8201_IISDR 0x1E
57 #define RTL8201_PDR 0x1F
60 #define RTL8201_EEECER 0x10
61 #define RTL8201_EEECR 0x15
64 #define RTL8201_RMSR 0x10
65 #define RTL8201_CLSR 0x11
66 #define RTL8201_EEELER 0x12
67 #define RTL8201_IWELFR 0x13
68 #define RTL8201_MTIR 0x14
69 #define RTL8201_SSCR 0x18
72 #define RTL8201_EEEPC1R 0x03, 0x00
73 #define RTL8201_EEEPS1R 0x03, 0x01
74 #define RTL8201_EEECR2 0x03, 0x14
75 #define RTL8201_EEEWER 0x03, 0x16
76 #define RTL8201_EEEAR 0x07, 0x3C
77 #define RTL8201_EEELPAR 0x07, 0x3D
80 #define RTL8201_BMCR_RESET 0x8000
81 #define RTL8201_BMCR_LOOPBACK 0x4000
82 #define RTL8201_BMCR_SPEED_SEL_LSB 0x2000
83 #define RTL8201_BMCR_AN_EN 0x1000
84 #define RTL8201_BMCR_POWER_DOWN 0x0800
85 #define RTL8201_BMCR_ISOLATE 0x0400
86 #define RTL8201_BMCR_RESTART_AN 0x0200
87 #define RTL8201_BMCR_DUPLEX_MODE 0x0100
88 #define RTL8201_BMCR_COL_TEST 0x0080
89 #define RTL8201_BMCR_SPEED_SEL_MSB 0x0040
92 #define RTL8201_BMSR_100BT4 0x8000
93 #define RTL8201_BMSR_100BTX_FD 0x4000
94 #define RTL8201_BMSR_100BTX_HD 0x2000
95 #define RTL8201_BMSR_10BT_FD 0x1000
96 #define RTL8201_BMSR_10BT_HD 0x0800
97 #define RTL8201_BMSR_MF_PREAMBLE_SUPPR 0x0040
98 #define RTL8201_BMSR_AN_COMPLETE 0x0020
99 #define RTL8201_BMSR_REMOTE_FAULT 0x0010
100 #define RTL8201_BMSR_AN_CAPABLE 0x0008
101 #define RTL8201_BMSR_LINK_STATUS 0x0004
102 #define RTL8201_BMSR_JABBER_DETECT 0x0002
103 #define RTL8201_BMSR_EXTENDED_CAPABLE 0x0001
106 #define RTL8201_PHYID1_OUI_MSB 0xFFFF
107 #define RTL8201_PHYID1_OUI_MSB_DEFAULT 0x001C
110 #define RTL8201_PHYID2_OUI_LSB 0xFC00
111 #define RTL8201_PHYID2_OUI_LSB_DEFAULT 0xC800
112 #define RTL8201_PHYID2_MODEL_NUM 0x03F0
113 #define RTL8201_PHYID2_MODEL_NUM_DEFAULT 0x0010
114 #define RTL8201_PHYID2_REVISION_NUM 0x000F
115 #define RTL8201_PHYID2_REVISION_NUM_DEFAULT 0x0006
118 #define RTL8201_ANAR_NEXT_PAGE 0x8000
119 #define RTL8201_ANAR_ACK 0x4000
120 #define RTL8201_ANAR_REMOTE_FAULT 0x2000
121 #define RTL8201_ANAR_ASYM_PAUSE 0x0800
122 #define RTL8201_ANAR_PAUSE 0x0400
123 #define RTL8201_ANAR_100BT4 0x0200
124 #define RTL8201_ANAR_100BTX_FD 0x0100
125 #define RTL8201_ANAR_100BTX_HD 0x0080
126 #define RTL8201_ANAR_10BT_FD 0x0040
127 #define RTL8201_ANAR_10BT_HD 0x0020
128 #define RTL8201_ANAR_SELECTOR 0x001F
129 #define RTL8201_ANAR_SELECTOR_DEFAULT 0x0001
132 #define RTL8201_ANLPAR_NEXT_PAGE 0x8000
133 #define RTL8201_ANLPAR_ACK 0x4000
134 #define RTL8201_ANLPAR_REMOTE_FAULT 0x2000
135 #define RTL8201_ANLPAR_ASYM_PAUSE 0x0800
136 #define RTL8201_ANLPAR_PAUSE 0x0400
137 #define RTL8201_ANLPAR_100BT4 0x0200
138 #define RTL8201_ANLPAR_100BTX_FD 0x0100
139 #define RTL8201_ANLPAR_100BTX_HD 0x0080
140 #define RTL8201_ANLPAR_10BT_FD 0x0040
141 #define RTL8201_ANLPAR_10BT_HD 0x0020
142 #define RTL8201_ANLPAR_SELECTOR 0x001F
143 #define RTL8201_ANLPAR_SELECTOR_DEFAULT 0x0001
146 #define RTL8201_ANER_PAR_DETECT_FAULT 0x0010
147 #define RTL8201_ANER_LP_NEXT_PAGE_ABLE 0x0008
148 #define RTL8201_ANER_NEXT_PAGE_ABLE 0x0004
149 #define RTL8201_ANER_PAGE_RECEIVED 0x0002
150 #define RTL8201_ANER_LP_AN_ABLE 0x0001
153 #define RTL8201_MACR_FUNC 0xC000
154 #define RTL8201_MACR_FUNC_ADDR 0x0000
155 #define RTL8201_MACR_FUNC_DATA_NO_POST_INC 0x4000
156 #define RTL8201_MACR_FUNC_DATA_POST_INC_RW 0x8000
157 #define RTL8201_MACR_FUNC_DATA_POST_INC_W 0xC000
158 #define RTL8201_MACR_DEVAD 0x001F
161 #define RTL8201_PSMR_EN_PWR_SAVE 0x8000
164 #define RTL8201_FMLR_FX_MODE 0x0020
165 #define RTL8201_FMLR_EN_AUTO_MDIX 0x0004
166 #define RTL8201_FMLR_FORCE_MDI 0x0002
169 #define RTL8201_IISDR_AN_ERR 0x8000
170 #define RTL8201_IISDR_SPD_CHG 0x4000
171 #define RTL8201_IISDR_DUPLEX_CHG 0x2000
172 #define RTL8201_IISDR_LINK_STATUS_CHG 0x0800
173 #define RTL8201_IISDR_SNR_O 0x000F
176 #define RTL8201_PDR_PAGE_SEL 0x00FF
179 #define RTL8201_EEECER_EEE_10_CAP 0x2000
180 #define RTL8201_EEECER_EEE_NWAY_EN 0x1000
181 #define RTL8201_EEECER_TX_QUIET_EN 0x0200
182 #define RTL8201_EEECER_RX_QUIET_EN 0x0100
185 #define RTL8201_EEECR_RG_DIS_LDVT 0x1000
186 #define RTL8201_EEECR_EEE_100_CAP 0x0001
189 #define RTL8201_RMSR_RG_RMII_CLKDIR 0x1000
190 #define RTL8201_RMSR_RG_RMII_TX_OFFSET 0x0F00
191 #define RTL8201_RMSR_RG_RMII_RX_OFFSET 0x00F0
192 #define RTL8201_RMSR_RG_RMII_RXDV_SEL 0x0004
193 #define RTL8201_RMSR_RG_RMII_RXDSEL 0x0002
196 #define RTL8201_CLSR_LED_SEL1 0x00F0
197 #define RTL8201_CLSR_LED_SEL1_ACT 0x0080
198 #define RTL8201_CLSR_LED_SEL1_LINK_100M 0x0020
199 #define RTL8201_CLSR_LED_SEL1_LINK_10M 0x0010
200 #define RTL8201_CLSR_LED_SEL0 0x000F
201 #define RTL8201_CLSR_LED_SEL0_ACT 0x0008
202 #define RTL8201_CLSR_LED_SEL0_LINK_100M 0x0002
203 #define RTL8201_CLSR_LED_SEL0_LINK_10M 0x0001
206 #define RTL8201_EEELER_EEE_LED_EN1 0x0002
207 #define RTL8201_EEELER_EEE_LED_EN0 0x0001
210 #define RTL8201_IWELFR_INT_LINK_CHG 0x2000
211 #define RTL8201_IWELFR_INT_DUP_CHG 0x1000
212 #define RTL8201_IWELFR_INT_AN_ERR 0x0800
213 #define RTL8201_IWELFR_RG_LED0_WOL_SEL 0x0400
214 #define RTL8201_IWELFR_LED_SEL 0x0030
215 #define RTL8201_IWELFR_CUSTOMIZED_LED 0x0008
216 #define RTL8201_IWELFR_EN_10M_LPI 0x0001
219 #define RTL8201_MTIR_RG_TX_ISOLATE_EN 0x8000
222 #define RTL8201_SSCR_RG_DIS_SSC 0x0001
225 #define RTL8201_EEEPC1R_CLOCK_STOP_EN 0x0400
228 #define RTL8201_EEEPS1R_TX_LPI_RCVD 0x0800
229 #define RTL8201_EEEPS1R_RX_LPI_RCVD 0x0400
230 #define RTL8201_EEEPS1R_TX_LPI_IND 0x0200
231 #define RTL8201_EEEPS1R_RX_LPI_IND 0x0100
232 #define RTL8201_EEEPS1R_CLK_STOP_CAPABLE 0x0040
235 #define RTL8201_EEECR2_100BTX_EEE 0x0002
238 #define RTL8201_EEEWER_EEE_WAKE_ERROR_COUNTER 0xFFFF
241 #define RTL8201_EEEAR_100BTX_EEE 0x0002
244 #define RTL8201_EEELPAR_LP_100BTX_EEE 0x0002
void rtl8201Tick(NetInterface *interface)
RTL8201 timer handler.
void rtl8201EnableIrq(NetInterface *interface)
Enable interrupts.
error_t rtl8201Init(NetInterface *interface)
RTL8201 PHY transceiver initialization.
void rtl8201DumpPhyReg(NetInterface *interface)
Dump PHY registers for debugging purpose.
void rtl8201WriteMmdReg(NetInterface *interface, uint8_t devAddr, uint16_t regAddr, uint16_t data)
Write MMD register.
void rtl8201DisableIrq(NetInterface *interface)
Disable interrupts.
void rtl8201EventHandler(NetInterface *interface)
RTL8201 event handler.
const PhyDriver rtl8201PhyDriver
RTL8201 Ethernet PHY driver.
void rtl8201InitHook(NetInterface *interface)
RTL8201 custom configuration.
Network interface controller abstraction layer.
void rtl8201WritePhyReg(NetInterface *interface, uint8_t address, uint16_t data)
Write PHY register.
uint16_t rtl8201ReadPhyReg(NetInterface *interface, uint8_t address)
Read PHY register.
uint16_t rtl8201ReadMmdReg(NetInterface *interface, uint8_t devAddr, uint16_t regAddr)
Read MMD register.