Go to the documentation of this file.
31 #ifndef _LAN8741_DRIVER_H
32 #define _LAN8741_DRIVER_H
38 #ifndef LAN8741_PHY_ADDR
39 #define LAN8741_PHY_ADDR 0
40 #elif (LAN8741_PHY_ADDR < 0 || LAN8741_PHY_ADDR > 31)
41 #error LAN8741_PHY_ADDR parameter is not valid
45 #define LAN8741_BMCR 0x00
46 #define LAN8741_BMSR 0x01
47 #define LAN8741_PHYID1 0x02
48 #define LAN8741_PHYID2 0x03
49 #define LAN8741_ANAR 0x04
50 #define LAN8741_ANLPAR 0x05
51 #define LAN8741_ANER 0x06
52 #define LAN8741_ANNPTR 0x07
53 #define LAN8741_ANNPRR 0x08
54 #define LAN8741_MMDACR 0x0D
55 #define LAN8741_MMDAADR 0x0E
56 #define LAN8741_ENCTECR 0x10
57 #define LAN8741_MCSR 0x11
58 #define LAN8741_SMR 0x12
59 #define LAN8741_SECR 0x1A
60 #define LAN8741_SCSIR 0x1B
61 #define LAN8741_ISR 0x1D
62 #define LAN8741_IMR 0x1E
63 #define LAN8741_PSCSR 0x1F
66 #define LAN8741_PCS_CTRL1 0x03, 0x00
67 #define LAN8741_PCS_STAT1 0x03, 0x01
68 #define LAN8741_PCS_MMD_DEV_PRES1 0x03, 0x05
69 #define LAN8741_PCS_MMD_DEV_PRES2 0x03, 0x06
70 #define LAN8741_EEE_CAPABILITY 0x03, 0x14
71 #define LAN8741_EEE_WAKE_ERROR 0x03, 0x16
72 #define LAN8741_AN_MMD_DEV_PRES1 0x07, 0x05
73 #define LAN8741_AN_MMD_DEV_PRES2 0x07, 0x06
74 #define LAN8741_EEE_ADV 0x07, 0x3C
75 #define LAN8741_EEE_LP_ADV 0x07, 0x3D
76 #define LAN8741_VENDOR_SPECIFIC_MMD1_DEV_ID1 0x1E, 0x02
77 #define LAN8741_VENDOR_SPECIFIC_MMD1_DEV_ID2 0x1E, 0x03
78 #define LAN8741_VENDOR_SPECIFIC_MMD1_DEV_PRES1 0x1E, 0x05
79 #define LAN8741_VENDOR_SPECIFIC_MMD1_DEV_PRES2 0x1E, 0x06
80 #define LAN8741_VENDOR_SPECIFIC_MMD1_STAT 0x1E, 0x08
81 #define LAN8741_TDR_MATCH_THRESHOLD 0x1E, 0x0B
82 #define LAN8741_TDR_SHORT_OPEN_THRESHOLD 0x1E, 0x0C
83 #define LAN8741_VENDOR_SPECIFIC_MMD1_PKG_ID1 0x1E, 0x0E
84 #define LAN8741_VENDOR_SPECIFIC_MMD1_PKG_ID2 0x1E, 0x0F
87 #define LAN8741_BMCR_RESET 0x8000
88 #define LAN8741_BMCR_LOOPBACK 0x4000
89 #define LAN8741_BMCR_SPEED_SEL 0x2000
90 #define LAN8741_BMCR_AN_EN 0x1000
91 #define LAN8741_BMCR_POWER_DOWN 0x0800
92 #define LAN8741_BMCR_ISOLATE 0x0400
93 #define LAN8741_BMCR_RESTART_AN 0x0200
94 #define LAN8741_BMCR_DUPLEX_MODE 0x0100
95 #define LAN8741_BMCR_COL_TEST 0x0080
98 #define LAN8741_BMSR_100BT4 0x8000
99 #define LAN8741_BMSR_100BTX_FD 0x4000
100 #define LAN8741_BMSR_100BTX_HD 0x2000
101 #define LAN8741_BMSR_10BT_FD 0x1000
102 #define LAN8741_BMSR_10BT_HD 0x0800
103 #define LAN8741_BMSR_100BT2_FD 0x0400
104 #define LAN8741_BMSR_100BT2_HD 0x0200
105 #define LAN8741_BMSR_EXTENDED_STATUS 0x0100
106 #define LAN8741_BMSR_AN_COMPLETE 0x0020
107 #define LAN8741_BMSR_REMOTE_FAULT 0x0010
108 #define LAN8741_BMSR_AN_CAPABLE 0x0008
109 #define LAN8741_BMSR_LINK_STATUS 0x0004
110 #define LAN8741_BMSR_JABBER_DETECT 0x0002
111 #define LAN8741_BMSR_EXTENDED_CAPABLE 0x0001
114 #define LAN8741_PHYID1_PHY_ID_MSB 0xFFFF
115 #define LAN8741_PHYID1_PHY_ID_MSB_DEFAULT 0x0007
118 #define LAN8741_PHYID2_PHY_ID_LSB 0xFC00
119 #define LAN8741_PHYID2_PHY_ID_LSB_DEFAULT 0xC000
120 #define LAN8741_PHYID2_MODEL_NUM 0x03F0
121 #define LAN8741_PHYID2_MODEL_NUM_DEFAULT 0x0120
122 #define LAN8741_PHYID2_REVISION_NUM 0x000F
125 #define LAN8741_ANAR_NEXT_PAGE 0x8000
126 #define LAN8741_ANAR_REMOTE_FAULT 0x2000
127 #define LAN8741_ANAR_PAUSE 0x0C00
128 #define LAN8741_ANAR_100BTX_FD 0x0100
129 #define LAN8741_ANAR_100BTX_HD 0x0080
130 #define LAN8741_ANAR_10BT_FD 0x0040
131 #define LAN8741_ANAR_10BT_HD 0x0020
132 #define LAN8741_ANAR_SELECTOR 0x001F
133 #define LAN8741_ANAR_SELECTOR_DEFAULT 0x0001
136 #define LAN8741_ANLPAR_NEXT_PAGE 0x8000
137 #define LAN8741_ANLPAR_ACK 0x4000
138 #define LAN8741_ANLPAR_REMOTE_FAULT 0x2000
139 #define LAN8741_ANLPAR_PAUSE 0x0400
140 #define LAN8741_ANLPAR_100BT4 0x0200
141 #define LAN8741_ANLPAR_100BTX_FD 0x0100
142 #define LAN8741_ANLPAR_100BTX_HD 0x0080
143 #define LAN8741_ANLPAR_10BT_FD 0x0040
144 #define LAN8741_ANLPAR_10BT_HD 0x0020
145 #define LAN8741_ANLPAR_SELECTOR 0x001F
146 #define LAN8741_ANLPAR_SELECTOR_DEFAULT 0x0001
149 #define LAN8741_ANER_RECEIVE_NP_LOC_ABLE 0x0040
150 #define LAN8741_ANER_RECEIVE_NP_STOR_LOC 0x0020
151 #define LAN8741_ANER_PAR_DETECT_FAULT 0x0010
152 #define LAN8741_ANER_LP_NEXT_PAGE_ABLE 0x0008
153 #define LAN8741_ANER_NEXT_PAGE_ABLE 0x0004
154 #define LAN8741_ANER_PAGE_RECEIVED 0x0002
155 #define LAN8741_ANER_LP_AN_ABLE 0x0001
158 #define LAN8741_ANNPTR_NEXT_PAGE 0x8000
159 #define LAN8741_ANNPTR_MSG_PAGE 0x2000
160 #define LAN8741_ANNPTR_ACK2 0x1000
161 #define LAN8741_ANNPTR_TOGGLE 0x0800
162 #define LAN8741_ANNPTR_MESSAGE 0x07FF
165 #define LAN8741_ANNPRR_NEXT_PAGE 0x8000
166 #define LAN8741_ANNPRR_ACK 0x4000
167 #define LAN8741_ANNPRR_MSG_PAGE 0x2000
168 #define LAN8741_ANNPRR_ACK2 0x1000
169 #define LAN8741_ANNPRR_TOGGLE 0x0800
170 #define LAN8741_ANNPRR_MESSAGE 0x07FF
173 #define LAN8741_MMDACR_FUNC 0xC000
174 #define LAN8741_MMDACR_FUNC_ADDR 0x0000
175 #define LAN8741_MMDACR_FUNC_DATA_NO_POST_INC 0x4000
176 #define LAN8741_MMDACR_DEVAD 0x001F
179 #define LAN8741_ENCTECR_EDPD_TX_NLP_EN 0x8000
180 #define LAN8741_ENCTECR_EDPD_TX_NLP_ITS 0x6000
181 #define LAN8741_ENCTECR_EDPD_RX_NLP_WAKE_EN 0x1000
182 #define LAN8741_ENCTECR_EDPD_RX_NLP_MIDS 0x0C00
183 #define LAN8741_ENCTECR_PHY_EEE_EN 0x0004
184 #define LAN8741_ENCTECR_EDPD_EXT_CROSSOVER 0x0002
185 #define LAN8741_ENCTECR_EXT_CROSSOVER_TIME 0x0001
188 #define LAN8741_MCSR_EDPWRDOWN 0x2000
189 #define LAN8741_MCSR_FARLOOPBACK 0x0200
190 #define LAN8741_MCSR_ALTINT 0x0040
191 #define LAN8741_MCSR_ENERGYON 0x0002
194 #define LAN8741_SMR_MIIMODE 0x4000
195 #define LAN8741_SMR_MODE 0x00E0
196 #define LAN8741_SMR_PHYAD 0x001F
199 #define LAN8741_SECR_SYM_ERR_CNT 0xFFFF
202 #define LAN8741_SCSIR_AMDIXCTRL 0x8000
203 #define LAN8741_SCSIR_CH_SELECT 0x2000
204 #define LAN8741_SCSIR_SQEOFF 0x0800
205 #define LAN8741_SCSIR_XPOL 0x0010
208 #define LAN8741_ISR_ENERGYON 0x0080
209 #define LAN8741_ISR_AN_COMPLETE 0x0040
210 #define LAN8741_ISR_REMOTE_FAULT 0x0020
211 #define LAN8741_ISR_LINK_DOWN 0x0010
212 #define LAN8741_ISR_AN_LP_ACK 0x0008
213 #define LAN8741_ISR_PAR_DETECT_FAULT 0x0004
214 #define LAN8741_ISR_AN_PAGE_RECEIVED 0x0002
217 #define LAN8741_IMR_ENERGYON 0x0080
218 #define LAN8741_IMR_AN_COMPLETE 0x0040
219 #define LAN8741_IMR_REMOTE_FAULT 0x0020
220 #define LAN8741_IMR_LINK_DOWN 0x0010
221 #define LAN8741_IMR_AN_LP_ACK 0x0008
222 #define LAN8741_IMR_PAR_DETECT_FAULT 0x0004
223 #define LAN8741_IMR_AN_PAGE_RECEIVED 0x0002
226 #define LAN8741_PSCSR_AUTODONE 0x1000
227 #define LAN8741_PSCSR_4B5B_EN 0x0040
228 #define LAN8741_PSCSR_HCDSPEED 0x001C
229 #define LAN8741_PSCSR_HCDSPEED_10BT_HD 0x0004
230 #define LAN8741_PSCSR_HCDSPEED_100BTX_HD 0x0008
231 #define LAN8741_PSCSR_HCDSPEED_10BT_FD 0x0014
232 #define LAN8741_PSCSR_HCDSPEED_100BTX_FD 0x0018
void lan8741DisableIrq(NetInterface *interface)
Disable interrupts.
uint16_t lan8741ReadPhyReg(NetInterface *interface, uint8_t address)
Read PHY register.
void lan8741EnableIrq(NetInterface *interface)
Enable interrupts.
void lan8741WritePhyReg(NetInterface *interface, uint8_t address, uint16_t data)
Write PHY register.
void lan8741DumpPhyReg(NetInterface *interface)
Dump PHY registers for debugging purpose.
void lan8741InitHook(NetInterface *interface)
LAN8741 custom configuration.
error_t lan8741Init(NetInterface *interface)
LAN8741 PHY transceiver initialization.
void lan8741Tick(NetInterface *interface)
LAN8741 timer handler.
void lan8741WriteMmdReg(NetInterface *interface, uint8_t devAddr, uint16_t regAddr, uint16_t data)
Write MMD register.
void lan8741EventHandler(NetInterface *interface)
LAN8741 event handler.
const PhyDriver lan8741PhyDriver
LAN8741 Ethernet PHY driver.
Network interface controller abstraction layer.
uint16_t lan8741ReadMmdReg(NetInterface *interface, uint8_t devAddr, uint16_t regAddr)
Read MMD register.