Go to the documentation of this file.
31 #ifndef _LAN8742_DRIVER_H
32 #define _LAN8742_DRIVER_H
38 #ifndef LAN8742_PHY_ADDR
39 #define LAN8742_PHY_ADDR 0
40 #elif (LAN8742_PHY_ADDR < 0 || LAN8742_PHY_ADDR > 31)
41 #error LAN8742_PHY_ADDR parameter is not valid
45 #define LAN8742_BMCR 0x00
46 #define LAN8742_BMSR 0x01
47 #define LAN8742_PHYID1 0x02
48 #define LAN8742_PHYID2 0x03
49 #define LAN8742_ANAR 0x04
50 #define LAN8742_ANLPAR 0x05
51 #define LAN8742_ANER 0x06
52 #define LAN8742_ANNPTR 0x07
53 #define LAN8742_ANNPRR 0x08
54 #define LAN8742_MMDACR 0x0D
55 #define LAN8742_MMDAADR 0x0E
56 #define LAN8742_ENCTR 0x10
57 #define LAN8742_MCSR 0x11
58 #define LAN8742_SMR 0x12
59 #define LAN8742_TDRPDCR 0x18
60 #define LAN8742_TDRCSR 0x19
61 #define LAN8742_SECR 0x1A
62 #define LAN8742_SCSIR 0x1B
63 #define LAN8742_CLR 0x1C
64 #define LAN8742_ISR 0x1D
65 #define LAN8742_IMR 0x1E
66 #define LAN8742_PSCSR 0x1F
69 #define LAN8742_PCS_MMD_DEV_PRES1 0x03, 0x0005
70 #define LAN8742_PCS_MMD_DEV_PRES2 0x03, 0x0006
71 #define LAN8742_WUCSR 0x03, 0x8010
72 #define LAN8742_WUF_CFGA 0x03, 0x8011
73 #define LAN8742_WUF_CFGB 0x03, 0x8012
74 #define LAN8742_WUF_MASK 0x03, 0x8021
75 #define LAN8742_RX_ADDRA 0x03, 0x8061
76 #define LAN8742_RX_ADDRB 0x03, 0x8062
77 #define LAN8742_RX_ADDRC 0x03, 0x8063
78 #define LAN8742_MCFGR 0x03, 0x8064
79 #define LAN8742_VENDOR_SPECIFIC_MMD1_DEV_ID1 0x1E, 0x0002
80 #define LAN8742_VENDOR_SPECIFIC_MMD1_DEV_ID2 0x1E, 0x0003
81 #define LAN8742_VENDOR_SPECIFIC_MMD1_DEV_PRES1 0x1E, 0x0005
82 #define LAN8742_VENDOR_SPECIFIC_MMD1_DEV_PRES2 0x1E, 0x0006
83 #define LAN8742_VENDOR_SPECIFIC_MMD1_STAT 0x1E, 0x0008
84 #define LAN8742_TDR_MATCH_THRESHOLD 0x1E, 0x000B
85 #define LAN8742_TDR_SHORT_OPEN_THRESHOLD 0x1E, 0x000C
86 #define LAN8742_VENDOR_SPECIFIC_MMD1_PKG_ID1 0x1E, 0x000E
87 #define LAN8742_VENDOR_SPECIFIC_MMD1_PKG_ID2 0x1E, 0x000F
90 #define LAN8742_BMCR_RESET 0x8000
91 #define LAN8742_BMCR_LOOPBACK 0x4000
92 #define LAN8742_BMCR_SPEED_SEL 0x2000
93 #define LAN8742_BMCR_AN_EN 0x1000
94 #define LAN8742_BMCR_POWER_DOWN 0x0800
95 #define LAN8742_BMCR_ISOLATE 0x0400
96 #define LAN8742_BMCR_RESTART_AN 0x0200
97 #define LAN8742_BMCR_DUPLEX_MODE 0x0100
100 #define LAN8742_BMSR_100BT4 0x8000
101 #define LAN8742_BMSR_100BTX_FD 0x4000
102 #define LAN8742_BMSR_100BTX_HD 0x2000
103 #define LAN8742_BMSR_10BT_FD 0x1000
104 #define LAN8742_BMSR_10BT_HD 0x0800
105 #define LAN8742_BMSR_100BT2_FD 0x0400
106 #define LAN8742_BMSR_100BT2_HD 0x0200
107 #define LAN8742_BMSR_EXTENDED_STATUS 0x0100
108 #define LAN8742_BMSR_AN_COMPLETE 0x0020
109 #define LAN8742_BMSR_REMOTE_FAULT 0x0010
110 #define LAN8742_BMSR_AN_CAPABLE 0x0008
111 #define LAN8742_BMSR_LINK_STATUS 0x0004
112 #define LAN8742_BMSR_JABBER_DETECT 0x0002
113 #define LAN8742_BMSR_EXTENDED_CAPABLE 0x0001
116 #define LAN8742_PHYID1_PHY_ID_MSB 0xFFFF
117 #define LAN8742_PHYID1_PHY_ID_MSB_DEFAULT 0x0007
120 #define LAN8742_PHYID2_PHY_ID_LSB 0xFC00
121 #define LAN8742_PHYID2_PHY_ID_LSB_DEFAULT 0xC000
122 #define LAN8742_PHYID2_MODEL_NUM 0x03F0
123 #define LAN8742_PHYID2_MODEL_NUM_DEFAULT 0x0130
124 #define LAN8742_PHYID2_REVISION_NUM 0x000F
127 #define LAN8742_ANAR_NEXT_PAGE 0x8000
128 #define LAN8742_ANAR_REMOTE_FAULT 0x2000
129 #define LAN8742_ANAR_PAUSE 0x0C00
130 #define LAN8742_ANAR_100BTX_FD 0x0100
131 #define LAN8742_ANAR_100BTX_HD 0x0080
132 #define LAN8742_ANAR_10BT_FD 0x0040
133 #define LAN8742_ANAR_10BT_HD 0x0020
134 #define LAN8742_ANAR_SELECTOR 0x001F
135 #define LAN8742_ANAR_SELECTOR_DEFAULT 0x0001
138 #define LAN8742_ANLPAR_NEXT_PAGE 0x8000
139 #define LAN8742_ANLPAR_ACK 0x4000
140 #define LAN8742_ANLPAR_REMOTE_FAULT 0x2000
141 #define LAN8742_ANLPAR_PAUSE 0x0400
142 #define LAN8742_ANLPAR_100BT4 0x0200
143 #define LAN8742_ANLPAR_100BTX_FD 0x0100
144 #define LAN8742_ANLPAR_100BTX_HD 0x0080
145 #define LAN8742_ANLPAR_10BT_FD 0x0040
146 #define LAN8742_ANLPAR_10BT_HD 0x0020
147 #define LAN8742_ANLPAR_SELECTOR 0x001F
148 #define LAN8742_ANLPAR_SELECTOR_DEFAULT 0x0001
151 #define LAN8742_ANER_RECEIVE_NP_LOC_ABLE 0x0040
152 #define LAN8742_ANER_RECEIVE_NP_STOR_LOC 0x0020
153 #define LAN8742_ANER_PAR_DETECT_FAULT 0x0010
154 #define LAN8742_ANER_LP_NEXT_PAGE_ABLE 0x0008
155 #define LAN8742_ANER_NEXT_PAGE_ABLE 0x0004
156 #define LAN8742_ANER_PAGE_RECEIVED 0x0002
157 #define LAN8742_ANER_LP_AN_ABLE 0x0001
160 #define LAN8742_ANNPTR_NEXT_PAGE 0x8000
161 #define LAN8742_ANNPTR_MSG_PAGE 0x2000
162 #define LAN8742_ANNPTR_ACK2 0x1000
163 #define LAN8742_ANNPTR_TOGGLE 0x0800
164 #define LAN8742_ANNPTR_MESSAGE 0x07FF
167 #define LAN8742_ANNPRR_NEXT_PAGE 0x8000
168 #define LAN8742_ANNPRR_ACK 0x4000
169 #define LAN8742_ANNPRR_MSG_PAGE 0x2000
170 #define LAN8742_ANNPRR_ACK2 0x1000
171 #define LAN8742_ANNPRR_TOGGLE 0x0800
172 #define LAN8742_ANNPRR_MESSAGE 0x07FF
175 #define LAN8742_MMDACR_FUNC 0xC000
176 #define LAN8742_MMDACR_FUNC_ADDR 0x0000
177 #define LAN8742_MMDACR_FUNC_DATA_NO_POST_INC 0x4000
178 #define LAN8742_MMDACR_DEVAD 0x001F
181 #define LAN8742_ENCTR_EDPD_TX_NLP_EN 0x8000
182 #define LAN8742_ENCTR_EDPD_TX_NLP_ITS 0x6000
183 #define LAN8742_ENCTR_EDPD_RX_NLP_WAKE_EN 0x1000
184 #define LAN8742_ENCTR_EDPD_RX_NLP_MIDS 0x0C00
185 #define LAN8742_ENCTR_EDPD_EXT_CROSSOVER 0x0002
186 #define LAN8742_ENCTR_EXT_CROSSOVER_TIME 0x0001
189 #define LAN8742_MCSR_EDPWRDOWN 0x2000
190 #define LAN8742_MCSR_FARLOOPBACK 0x0200
191 #define LAN8742_MCSR_ALTINT 0x0040
192 #define LAN8742_MCSR_ENERGYON 0x0002
195 #define LAN8742_SMR_MODE 0x00E0
196 #define LAN8742_SMR_PHYAD 0x001F
199 #define LAN8742_TDRPDCR_DELAY_IN 0x8000
200 #define LAN8742_TDRPDCR_LINE_BREAK_COUNT 0x7000
201 #define LAN8742_TDRPDCR_PATTERN_HIGH 0x0FC0
202 #define LAN8742_TDRPDCR_PATTERN_LOW 0x003F
205 #define LAN8742_TDRCSR_TDR_EN 0x8000
206 #define LAN8742_TDRCSR_AD_FILTER_EN 0x4000
207 #define LAN8742_TDRCSR_CH_CABLE_TYPE 0x0600
208 #define LAN8742_TDRCSR_CH_STATUS 0x0100
209 #define LAN8742_TDRCSR_CH_LENGTH 0x00FF
212 #define LAN8742_SECR_SYM_ERR_CNT 0xFFFF
215 #define LAN8742_SCSIR_AMDIXCTRL 0x8000
216 #define LAN8742_SCSIR_CH_SELECT 0x2000
217 #define LAN8742_SCSIR_SQEOFF 0x0800
218 #define LAN8742_SCSIR_XPOL 0x0010
221 #define LAN8742_CLR_CBLN 0xF000
224 #define LAN8742_ISR_WOL 0x0100
225 #define LAN8742_ISR_ENERGYON 0x0080
226 #define LAN8742_ISR_AN_COMPLETE 0x0040
227 #define LAN8742_ISR_REMOTE_FAULT 0x0020
228 #define LAN8742_ISR_LINK_DOWN 0x0010
229 #define LAN8742_ISR_AN_LP_ACK 0x0008
230 #define LAN8742_ISR_PAR_DETECT_FAULT 0x0004
231 #define LAN8742_ISR_AN_PAGE_RECEIVED 0x0002
234 #define LAN8742_IMR_WOL 0x0100
235 #define LAN8742_IMR_ENERGYON 0x0080
236 #define LAN8742_IMR_AN_COMPLETE 0x0040
237 #define LAN8742_IMR_REMOTE_FAULT 0x0020
238 #define LAN8742_IMR_LINK_DOWN 0x0010
239 #define LAN8742_IMR_AN_LP_ACK 0x0008
240 #define LAN8742_IMR_PAR_DETECT_FAULT 0x0004
241 #define LAN8742_IMR_AN_PAGE_RECEIVED 0x0002
244 #define LAN8742_PSCSR_AUTODONE 0x1000
245 #define LAN8742_PSCSR_HCDSPEED 0x001C
246 #define LAN8742_PSCSR_HCDSPEED_10BT_HD 0x0004
247 #define LAN8742_PSCSR_HCDSPEED_100BTX_HD 0x0008
248 #define LAN8742_PSCSR_HCDSPEED_10BT_FD 0x0014
249 #define LAN8742_PSCSR_HCDSPEED_100BTX_FD 0x0018
const PhyDriver lan8742PhyDriver
LAN8742 Ethernet PHY driver.
void lan8742DisableIrq(NetInterface *interface)
Disable interrupts.
void lan8742WriteMmdReg(NetInterface *interface, uint8_t devAddr, uint16_t regAddr, uint16_t data)
Write MMD register.
void lan8742EnableIrq(NetInterface *interface)
Enable interrupts.
uint16_t lan8742ReadMmdReg(NetInterface *interface, uint8_t devAddr, uint16_t regAddr)
Read MMD register.
void lan8742DumpPhyReg(NetInterface *interface)
Dump PHY registers for debugging purpose.
uint16_t lan8742ReadPhyReg(NetInterface *interface, uint8_t address)
Read PHY register.
void lan8742WritePhyReg(NetInterface *interface, uint8_t address, uint16_t data)
Write PHY register.
error_t lan8742Init(NetInterface *interface)
LAN8742 PHY transceiver initialization.
void lan8742EventHandler(NetInterface *interface)
LAN8742 event handler.
Network interface controller abstraction layer.
void lan8742Tick(NetInterface *interface)
LAN8742 timer handler.
void lan8742InitHook(NetInterface *interface)
LAN8742 custom configuration.