Go to the documentation of this file.
31 #ifndef _DM9162_DRIVER_H
32 #define _DM9162_DRIVER_H
38 #ifndef DM9162_PHY_ADDR
39 #define DM9162_PHY_ADDR 0
40 #elif (DM9162_PHY_ADDR < 0 || DM9162_PHY_ADDR > 31)
41 #error DM9162_PHY_ADDR parameter is not valid
45 #define DM9162_BMCR 0x00
46 #define DM9162_BMSR 0x01
47 #define DM9162_PHYID1 0x02
48 #define DM9162_PHYID2 0x03
49 #define DM9162_ANAR 0x04
50 #define DM9162_ANLPAR 0x05
51 #define DM9162_ANER 0x06
52 #define DM9162_DSCR 0x10
53 #define DM9162_DSCSR 0x11
54 #define DM9162_10BTCSR 0x12
55 #define DM9162_PWDOR 0x13
56 #define DM9162_SCR 0x14
57 #define DM9162_MDINTR 0x15
58 #define DM9162_RECR 0x16
59 #define DM9162_DISCR 0x17
60 #define DM9162_RLSR 0x18
61 #define DM9162_PSCR 0x1D
64 #define DM9162_BMCR_RESET 0x8000
65 #define DM9162_BMCR_LOOPBACK 0x4000
66 #define DM9162_BMCR_SPEED_SEL 0x2000
67 #define DM9162_BMCR_AN_EN 0x1000
68 #define DM9162_BMCR_POWER_DOWN 0x0800
69 #define DM9162_BMCR_ISOLATE 0x0400
70 #define DM9162_BMCR_RESTART_AN 0x0200
71 #define DM9162_BMCR_DUPLEX_MODE 0x0100
72 #define DM9162_BMCR_COL_TEST 0x0080
75 #define DM9162_BMSR_100BT4 0x8000
76 #define DM9162_BMSR_100BTX_FD 0x4000
77 #define DM9162_BMSR_100BTX_HD 0x2000
78 #define DM9162_BMSR_10BT_FD 0x1000
79 #define DM9162_BMSR_10BT_HD 0x0800
80 #define DM9162_BMSR_MF_PREAMBLE_SUPPR 0x0040
81 #define DM9162_BMSR_AN_COMPLETE 0x0020
82 #define DM9162_BMSR_REMOTE_FAULT 0x0010
83 #define DM9162_BMSR_AN_CAPABLE 0x0008
84 #define DM9162_BMSR_LINK_STATUS 0x0004
85 #define DM9162_BMSR_JABBER_DETECT 0x0002
86 #define DM9162_BMSR_EXTENDED_CAPABLE 0x0001
89 #define DM9162_PHYID1_OUI_MSB 0xFFFF
90 #define DM9162_PHYID1_OUI_MSB_DEFAULT 0x0181
93 #define DM9162_PHYID2_OUI_LSB 0xFC00
94 #define DM9162_PHYID2_OUI_LSB_DEFAULT 0xB800
95 #define DM9162_PHYID2_VNDR_MDL 0x03F0
96 #define DM9162_PHYID2_VNDR_MDL_DEFAULT 0x00A0
97 #define DM9162_PHYID2_MDL_REV 0x000F
100 #define DM9162_ANAR_NEXT_PAGE 0x8000
101 #define DM9162_ANAR_ACK 0x4000
102 #define DM9162_ANAR_REMOTE_FAULT 0x2000
103 #define DM9162_ANAR_FCS 0x0400
104 #define DM9162_ANAR_100BT4 0x0200
105 #define DM9162_ANAR_100BTX_FD 0x0100
106 #define DM9162_ANAR_100BTX_HD 0x0080
107 #define DM9162_ANAR_10BT_FD 0x0040
108 #define DM9162_ANAR_10BT_HD 0x0020
109 #define DM9162_ANAR_SELECTOR 0x001F
110 #define DM9162_ANAR_SELECTOR_DEFAULT 0x0001
113 #define DM9162_ANLPAR_NEXT_PAGE 0x8000
114 #define DM9162_ANLPAR_ACK 0x4000
115 #define DM9162_ANLPAR_REMOTE_FAULT 0x2000
116 #define DM9162_ANLPAR_FCS 0x0400
117 #define DM9162_ANLPAR_100BT4 0x0200
118 #define DM9162_ANLPAR_100BTX_FD 0x0100
119 #define DM9162_ANLPAR_100BTX_HD 0x0080
120 #define DM9162_ANLPAR_10BT_FD 0x0040
121 #define DM9162_ANLPAR_10BT_HD 0x0020
122 #define DM9162_ANLPAR_SELECTOR 0x001F
123 #define DM9162_ANLPAR_SELECTOR_DEFAULT 0x0000
126 #define DM9162_ANER_PAR_DETECT_FAULT 0x0010
127 #define DM9162_ANER_LP_NP_ABLE 0x0008
128 #define DM9162_ANER_NP_ABLE 0x0004
129 #define DM9162_ANER_PAGE_RX 0x0002
130 #define DM9162_ANER_LP_AN_ABLE 0x0001
133 #define DM9162_DSCR_BP_4B5B 0x8000
134 #define DM9162_DSCR_BP_SCR 0x4000
135 #define DM9162_DSCR_BP_ALIGN 0x2000
136 #define DM9162_DSCR_BP_ADPOK 0x1000
137 #define DM9162_DSCR_REPEATER 0x0800
138 #define DM9162_DSCR_TX 0x0400
139 #define DM9162_DSCR_RMII_EN 0x0100
140 #define DM9162_DSCR_F_LINK_100 0x0080
141 #define DM9162_DSCR_SPLED_CTL 0x0040
142 #define DM9162_DSCR_COLLED_CTL 0x0020
143 #define DM9162_DSCR_RPDCTR_EN 0x0010
144 #define DM9162_DSCR_SMRST 0x0008
145 #define DM9162_DSCR_MFPSC 0x0004
146 #define DM9162_DSCR_SLEEP 0x0002
147 #define DM9162_DSCR_RLOUT 0x0001
150 #define DM9162_DSCSR_100FDX 0x8000
151 #define DM9162_DSCSR_100HDX 0x4000
152 #define DM9162_DSCSR_10FDX 0x2000
153 #define DM9162_DSCSR_10HDX 0x1000
154 #define DM9162_DSCSR_PHYADR 0x01F0
155 #define DM9162_DSCSR_ANMB 0x000F
156 #define DM9162_DSCSR_ANMB_IDLE 0x0000
157 #define DM9162_DSCSR_ANMB_ABILITY_MATCH 0x0001
158 #define DM9162_DSCSR_ANMB_ACK_MATCH 0x0002
159 #define DM9162_DSCSR_ANMB_ACK_MATCH_FAIL 0x0003
160 #define DM9162_DSCSR_ANMB_CONSIST_MATCH 0x0004
161 #define DM9162_DSCSR_ANMB_CONSIST_MATCH_FAIL 0x0005
162 #define DM9162_DSCSR_ANMB_LINK_READY 0x0006
163 #define DM9162_DSCSR_ANMB_LINK_READY_FAIL 0x0007
164 #define DM9162_DSCSR_ANMB_AN_COMPLETE 0x0008
167 #define DM9162_10BTCSR_LP_EN 0x4000
168 #define DM9162_10BTCSR_HBE 0x2000
169 #define DM9162_10BTCSR_SQUELCH 0x1000
170 #define DM9162_10BTCSR_JABEN 0x0800
171 #define DM9162_10BTCSR_10BT_SER 0x0400
172 #define DM9162_10BTCSR_POLR 0x0001
175 #define DM9162_PWDOR_PD_10DRV 0x0100
176 #define DM9162_PWDOR_PD_100DL 0x0080
177 #define DM9162_PWDOR_PD_CHIP 0x0040
178 #define DM9162_PWDOR_PD_COM 0x0020
179 #define DM9162_PWDOR_PD_AEQ 0x0010
180 #define DM9162_PWDOR_PD_DRV 0x0008
181 #define DM9162_PWDOR_PD_EDI 0x0004
182 #define DM9162_PWDOR_PD_EDO 0x0002
183 #define DM9162_PWDOR_PD_10 0x0001
186 #define DM9162_SCR_TSTSE1 0x8000
187 #define DM9162_SCR_TSTSE2 0x4000
188 #define DM9162_SCR_STSEL3 0x1000
189 #define DM9162_SCR_PREAMBLEX 0x0800
190 #define DM9162_SCR_TX10M_PWR 0x0400
191 #define DM9162_SCR_NWAY_PWR 0x0200
192 #define DM9162_SCR_MDIX_CNTL 0x0080
193 #define DM9162_SCR_AUTONEG_DPBK 0x0040
194 #define DM9162_SCR_MDIX_FIX_VALUE 0x0020
195 #define DM9162_SCR_MDIX_DOWN 0x0010
196 #define DM9162_SCR_MONSEL1 0x0008
197 #define DM9162_SCR_MONSEL0 0x0004
198 #define DM9162_SCR_RMII_VER 0x0002
199 #define DM9162_SCR_PD_VALUE 0x0001
202 #define DM9162_MDINTR_INTR_PEND 0x8000
203 #define DM9162_MDINTR_FDX_MASK 0x0800
204 #define DM9162_MDINTR_SPD_MASK 0x0400
205 #define DM9162_MDINTR_LINK_MASK 0x0200
206 #define DM9162_MDINTR_INTR_MASK 0x0100
207 #define DM9162_MDINTR_FDX_CHANGE 0x0010
208 #define DM9162_MDINTR_SPD_CHANGE 0x0008
209 #define DM9162_MDINTR_LINK_CHANGE 0x0004
210 #define DM9162_MDINTR_INTR_STATUS 0x0001
213 #define DM9162_RECR_RCV_ERR_CNT 0xFFFF
216 #define DM9162_DISCR_DISCONNECT_COUNT 0x00FF
219 #define DM9162_RLSR_LH_LEDMODE 0x8000
220 #define DM9162_RLSR_LH_MDINTR 0x4000
221 #define DM9162_RLSR_LH_CSTS 0x2000
222 #define DM9162_RLSR_LH_ISO 0x1000
223 #define DM9162_RLSR_LH_RMII 0x0800
224 #define DM9162_RLSR_LH_TP10SER 0x0400
225 #define DM9162_RLSR_LH_REPTR 0x0200
226 #define DM9162_RLSR_LH_TSTMOD 0x0100
227 #define DM9162_RLSR_LH_OP 0x00E0
228 #define DM9162_RLSR_LH_PH 0x001F
231 #define DM9162_PSCR_PREAMBLEX 0x0800
232 #define DM9162_PSCR_TX_PWR 0x0200
void dm9162Tick(NetInterface *interface)
DM9162 timer handler.
const PhyDriver dm9162PhyDriver
DM9162 Ethernet PHY driver.
void dm9162DumpPhyReg(NetInterface *interface)
Dump PHY registers for debugging purpose.
void dm9162WritePhyReg(NetInterface *interface, uint8_t address, uint16_t data)
Write PHY register.
void dm9162DisableIrq(NetInterface *interface)
Disable interrupts.
error_t dm9162Init(NetInterface *interface)
DM9162 PHY transceiver initialization.
Network interface controller abstraction layer.
void dm9162EnableIrq(NetInterface *interface)
Enable interrupts.
void dm9162InitHook(NetInterface *interface)
DM9162 custom configuration.
void dm9162EventHandler(NetInterface *interface)
DM9162 event handler.
uint16_t dm9162ReadPhyReg(NetInterface *interface, uint8_t address)
Read PHY register.