Go to the documentation of this file.
31 #ifndef _AR8035_DRIVER_H
32 #define _AR8035_DRIVER_H
38 #ifndef AR8035_PHY_ADDR
39 #define AR8035_PHY_ADDR 0
40 #elif (AR8035_PHY_ADDR < 0 || AR8035_PHY_ADDR > 31)
41 #error AR8035_PHY_ADDR parameter is not valid
45 #define AR8035_BMCR 0x00
46 #define AR8035_BMSR 0x01
47 #define AR8035_PHYID1 0x02
48 #define AR8035_PHYID2 0x03
49 #define AR8035_ANAR 0x04
50 #define AR8035_ANLPAR 0x05
51 #define AR8035_ANER 0x06
52 #define AR8035_ANNPTR 0x07
53 #define AR8035_ANLPNPR 0x08
54 #define AR8035_GBCR 0x09
55 #define AR8035_GBSR 0x0A
56 #define AR8035_MMDACR 0x0D
57 #define AR8035_MMDAADR 0x0E
58 #define AR8035_GBESR 0x0F
59 #define AR8035_FUNC_CTRL 0x10
60 #define AR8035_PHY_STATUS 0x11
61 #define AR8035_INT_EN 0x12
62 #define AR8035_INT_STATUS 0x13
63 #define AR8035_SMART_SPEED 0x14
64 #define AR8035_CDT_CTRL 0x16
65 #define AR8035_LED_CTRL 0x18
66 #define AR8035_CDT_STATUS 0x1C
67 #define AR8035_DBG_PORT_ADDR_OFFSET 0x1D
68 #define AR8035_DBG_PORT_DATA 0x1E
71 #define AR8035_PCS_CTRL 0x03, 0x0000
72 #define AR8035_PCS_STAT 0x03, 0x0001
73 #define AR8035_EEE_CAPABILITY 0x03, 0x0014
74 #define AR8035_EEE_WAKE_ERROR_COUNTER 0x03, 0x0016
75 #define AR8035_AN_CTRL 0x07, 0x0000
76 #define AR8035_AN_STAT 0x07, 0x0001
77 #define AR8035_AN_XNP_TRANSMIT 0x07, 0x0016
78 #define AR8035_AN_XNP_TRANSMIT1 0x07, 0x0017
79 #define AR8035_AN_XNP_TRANSMIT2 0x07, 0x0018
80 #define AR8035_AN_XNP_ABILITY 0x07, 0x0019
81 #define AR8035_AN_XNP_ABILITY1 0x07, 0x001A
82 #define AR8035_AN_XNP_ABILITY2 0x07, 0x001B
83 #define AR8035_EEE_ADV 0x07, 0x003C
84 #define AR8035_EEE_LP_ADV 0x07, 0x003D
85 #define AR8035_EEE_ABILITY_AN_RES 0x07, 0x8000
88 #define AR8035_BMCR_RESET 0x8000
89 #define AR8035_BMCR_LOOPBACK 0x4000
90 #define AR8035_BMCR_SPEED_SEL_LSB 0x2000
91 #define AR8035_BMCR_AN_EN 0x1000
92 #define AR8035_BMCR_POWER_DOWN 0x0800
93 #define AR8035_BMCR_ISOLATE 0x0400
94 #define AR8035_BMCR_RESTART_AN 0x0200
95 #define AR8035_BMCR_DUPLEX_MODE 0x0100
96 #define AR8035_BMCR_COL_TEST 0x0080
97 #define AR8035_BMCR_SPEED_SEL_MSB 0x0040
100 #define AR8035_BMSR_100BT4 0x8000
101 #define AR8035_BMSR_100BTX_FD 0x4000
102 #define AR8035_BMSR_100BTX_HD 0x2000
103 #define AR8035_BMSR_10BT_FD 0x1000
104 #define AR8035_BMSR_10BT_HD 0x0800
105 #define AR8035_BMSR_100BT2_FD 0x0400
106 #define AR8035_BMSR_100BT2_HD 0x0200
107 #define AR8035_BMSR_EXTENDED_STATUS 0x0100
108 #define AR8035_BMSR_MF_PREAMBLE_SUPPR 0x0040
109 #define AR8035_BMSR_AN_COMPLETE 0x0020
110 #define AR8035_BMSR_REMOTE_FAULT 0x0010
111 #define AR8035_BMSR_AN_CAPABLE 0x0008
112 #define AR8035_BMSR_LINK_STATUS 0x0004
113 #define AR8035_BMSR_JABBER_DETECT 0x0002
114 #define AR8035_BMSR_EXTENDED_CAPABLE 0x0001
117 #define AR8035_PHYID1_OUI_MSB 0xFFFF
118 #define AR8035_PHYID1_OUI_MSB_DEFAULT 0x004D
121 #define AR8035_PHYID2_OUI_LSB 0xFC00
122 #define AR8035_PHYID2_OUI_LSB_DEFAULT 0xD000
123 #define AR8035_PHYID2_MODEL_NUM 0x03F0
124 #define AR8035_PHYID2_MODEL_NUM_DEFAULT 0x0070
125 #define AR8035_PHYID2_REVISION_NUM 0x000F
128 #define AR8035_ANAR_NEXT_PAGE 0x8000
129 #define AR8035_ANAR_ACK 0x4000
130 #define AR8035_ANAR_REMOTE_FAULT 0x2000
131 #define AR8035_ANAR_XNP_ABLE 0x1000
132 #define AR8035_ANAR_ASYM_PAUSE 0x0800
133 #define AR8035_ANAR_PAUSE 0x0400
134 #define AR8035_ANAR_100BT4 0x0200
135 #define AR8035_ANAR_100BTX_FD 0x0100
136 #define AR8035_ANAR_100BTX_HD 0x0080
137 #define AR8035_ANAR_10BT_FD 0x0040
138 #define AR8035_ANAR_10BT_HD 0x0020
139 #define AR8035_ANAR_SELECTOR 0x001F
140 #define AR8035_ANAR_SELECTOR_DEFAULT 0x0001
143 #define AR8035_ANLPAR_NEXT_PAGE 0x8000
144 #define AR8035_ANLPAR_ACK 0x4000
145 #define AR8035_ANLPAR_REMOTE_FAULT 0x2000
146 #define AR8035_ANLPAR_ASYM_PAUSE 0x0800
147 #define AR8035_ANLPAR_PAUSE 0x0400
148 #define AR8035_ANLPAR_100BT4 0x0200
149 #define AR8035_ANLPAR_100BTX_FD 0x0100
150 #define AR8035_ANLPAR_100BTX_HD 0x0080
151 #define AR8035_ANLPAR_10BT_FD 0x0040
152 #define AR8035_ANLPAR_10BT_HD 0x0020
153 #define AR8035_ANLPAR_SELECTOR 0x001F
154 #define AR8035_ANLPAR_SELECTOR_DEFAULT 0x0001
157 #define AR8035_ANER_PAR_DETECT_FAULT 0x0010
158 #define AR8035_ANER_LP_NEXT_PAGE_ABLE 0x0008
159 #define AR8035_ANER_NEXT_PAGE_ABLE 0x0004
160 #define AR8035_ANER_PAGE_RECEIVED 0x0002
161 #define AR8035_ANER_LP_AN_ABLE 0x0001
164 #define AR8035_ANNPTR_NEXT_PAGE 0x8000
165 #define AR8035_ANNPTR_MSG_PAGE 0x2000
166 #define AR8035_ANNPTR_ACK2 0x1000
167 #define AR8035_ANNPTR_TOGGLE 0x0800
168 #define AR8035_ANNPTR_MESSAGE 0x07FF
171 #define AR8035_ANLPNPR_NEXT_PAGE 0x8000
172 #define AR8035_ANLPNPR_ACK 0x4000
173 #define AR8035_ANLPNPR_MSG_PAGE 0x2000
174 #define AR8035_ANLPNPR_ACK2 0x1000
175 #define AR8035_ANLPNPR_TOGGLE 0x0800
176 #define AR8035_ANLPNPR_MESSAGE 0x07FF
179 #define AR8035_GBCR_TEST_MODE 0xE000
180 #define AR8035_GBCR_MS_MAN_CONF_EN 0x1000
181 #define AR8035_GBCR_MS_MAN_CONF_VAL 0x0800
182 #define AR8035_GBCR_PORT_TYPE 0x0400
183 #define AR8035_GBCR_1000BT_FD 0x0200
184 #define AR8035_GBCR_1000BT_HD 0x0100
187 #define AR8035_GBSR_MS_CONF_FAULT 0x8000
188 #define AR8035_GBSR_MS_CONF_RES 0x4000
189 #define AR8035_GBSR_LOCAL_RECEIVER_STATUS 0x2000
190 #define AR8035_GBSR_REMOTE_RECEIVER_STATUS 0x1000
191 #define AR8035_GBSR_LP_1000BT_FD 0x0800
192 #define AR8035_GBSR_LP_1000BT_HD 0x0400
193 #define AR8035_GBSR_IDLE_ERR_COUNT 0x00FF
196 #define AR8035_MMDACR_FUNC 0xC000
197 #define AR8035_MMDACR_FUNC_ADDR 0x0000
198 #define AR8035_MMDACR_FUNC_DATA_NO_POST_INC 0x4000
199 #define AR8035_MMDACR_FUNC_DATA_POST_INC_RW 0x8000
200 #define AR8035_MMDACR_FUNC_DATA_POST_INC_W 0xC000
201 #define AR8035_MMDACR_DEVAD 0x001F
204 #define AR8035_GBESR_1000BX_FD 0x8000
205 #define AR8035_GBESR_1000BX_HD 0x4000
206 #define AR8035_GBESR_1000BT_FD 0x2000
207 #define AR8035_GBESR_1000BT_HD 0x1000
210 #define AR8035_FUNC_CTRL_ASSERT_CRS_ON_TX 0x0800
211 #define AR8035_FUNC_CTRL_MDIX_MODE 0x0060
212 #define AR8035_FUNC_CTRL_MDIX_MODE_MANUAL_MDI 0x0000
213 #define AR8035_FUNC_CTRL_MDIX_MODE_MANUAL_MDIX 0x0020
214 #define AR8035_FUNC_CTRL_MDIX_MODE_AUTO 0x0060
215 #define AR8035_FUNC_CTRL_SQE_TEST 0x0004
216 #define AR8035_FUNC_CTRL_POLARITY_REVERSAL 0x0002
217 #define AR8035_FUNC_CTRL_JABBER_DIS 0x0001
220 #define AR8035_PHY_STATUS_SPEED 0xC000
221 #define AR8035_PHY_STATUS_SPEED_10MBPS 0x0000
222 #define AR8035_PHY_STATUS_SPEED_100MBPS 0x4000
223 #define AR8035_PHY_STATUS_SPEED_1000MBPS 0x8000
224 #define AR8035_PHY_STATUS_DUPLEX 0x2000
225 #define AR8035_PHY_STATUS_PAGE_RECEIVED 0x1000
226 #define AR8035_PHY_STATUS_SPEED_DUPLEX_RESOLVED 0x0800
227 #define AR8035_PHY_STATUS_LINK 0x0400
228 #define AR8035_PHY_STATUS_MDI_CROSSOVER_STATUS 0x0040
229 #define AR8035_PHY_STATUS_WIRESPEED_DOWNGRADE 0x0020
230 #define AR8035_PHY_STATUS_TX_PAUSE_EN 0x0008
231 #define AR8035_PHY_STATUS_RX_PAUSE_EN 0x0004
232 #define AR8035_PHY_STATUS_POLARITY 0x0002
233 #define AR8035_PHY_STATUS_JABBER 0x0001
236 #define AR8035_INT_EN_AN_ERROR 0x8000
237 #define AR8035_INT_EN_SPEED_CHANGED 0x4000
238 #define AR8035_INT_EN_DUPLEX_CHANGED 0x2000
239 #define AR8035_INT_EN_PAGE_RECEIVED 0x1000
240 #define AR8035_INT_EN_LINK_FAIL 0x0800
241 #define AR8035_INT_EN_LINK_SUCCESS 0x0400
242 #define AR8035_INT_EN_WIRESPEED_DOWNGRADE 0x0020
243 #define AR8035_INT_EN_POLARITY_CHANGED 0x0002
244 #define AR8035_INT_EN_WOL_PTP 0x0001
247 #define AR8035_INT_STATUS_AN_ERROR 0x8000
248 #define AR8035_INT_STATUS_SPEED_CHANGED 0x4000
249 #define AR8035_INT_STATUS_DUPLEX_CHANGED 0x2000
250 #define AR8035_INT_STATUS_PAGE_RECEIVED 0x1000
251 #define AR8035_INT_STATUS_LINK_FAIL 0x0800
252 #define AR8035_INT_STATUS_LINK_SUCCESS 0x0400
253 #define AR8035_INT_STATUS_WIRESPEED_DOWNGRADE 0x0020
254 #define AR8035_INT_STATUS_POLARITY_CHANGED 0x0002
255 #define AR8035_INT_STATUS_WOL_PTP 0x0001
258 #define AR8035_SMART_SPEED_EN 0x0020
259 #define AR8035_SMART_SPEED_RETRY_LIMIT 0x001C
260 #define AR8035_SMART_SPEED_BYPASS_TIMER 0x0002
263 #define AR8035_CDT_CTRL_MDI_PAIR_SELECT 0x0300
264 #define AR8035_CDT_CTRL_TEST_EN 0x0001
267 #define AR8035_LED_CTRL_LED_ON_TIME 0x7000
268 #define AR8035_LED_CTRL_LED_OFF_TIME 0x0700
271 #define AR8035_CDT_STATUS_STATUS 0x0300
272 #define AR8035_CDT_STATUS_DELTA_TIME 0x00FF
error_t ar8035Init(NetInterface *interface)
AR8035 PHY transceiver initialization.
void ar8035EventHandler(NetInterface *interface)
AR8035 event handler.
void ar8035EnableIrq(NetInterface *interface)
Enable interrupts.
uint16_t ar8035ReadMmdReg(NetInterface *interface, uint8_t devAddr, uint16_t regAddr)
Read MMD register.
void ar8035InitHook(NetInterface *interface)
AR8035 custom configuration.
void ar8035DumpPhyReg(NetInterface *interface)
Dump PHY registers for debugging purpose.
void ar8035WritePhyReg(NetInterface *interface, uint8_t address, uint16_t data)
Write PHY register.
void ar8035Tick(NetInterface *interface)
AR8035 timer handler.
uint16_t ar8035ReadPhyReg(NetInterface *interface, uint8_t address)
Read PHY register.
Network interface controller abstraction layer.
void ar8035DisableIrq(NetInterface *interface)
Disable interrupts.
const PhyDriver ar8035PhyDriver
AR8035 Ethernet PHY driver.
void ar8035WriteMmdReg(NetInterface *interface, uint8_t devAddr, uint16_t regAddr, uint16_t data)
Write MMD register.