mikroSDK Reference Manual
enc624j600_driver.h
Go to the documentation of this file.
1
31#ifndef _ENC624J600_DRIVER_H
32#define _ENC624J600_DRIVER_H
33
34//Dependencies
35#include "core/nic.h"
36
37//RX buffer size
38#ifndef ENC624J600_ETH_RX_BUFFER_SIZE
39 #define ENC624J600_ETH_RX_BUFFER_SIZE 1536
40#elif (ENC624J600_ETH_RX_BUFFER_SIZE != 1536)
41 #error ENC624J600_ETH_RX_BUFFER_SIZE parameter is not valid
42#endif
43
44//Receive and transmit buffers
45#define ENC624J600_TX_BUFFER_START 0x0000
46#define ENC624J600_TX_BUFFER_STOP 0x17FE
47#define ENC624J600_RX_BUFFER_START 0x1800
48#define ENC624J600_RX_BUFFER_STOP 0x5FFE
49
50//SPI command set
51#define ENC624J600_CMD_B0SEL 0xC0 //Bank 0 Select
52#define ENC624J600_CMD_B1SEL 0xC2 //Bank 1 Select
53#define ENC624J600_CMD_B2SEL 0xC4 //Bank 2 Select
54#define ENC624J600_CMD_B3SEL 0xC6 //Bank 3 Select
55#define ENC624J600_CMD_SETETHRST 0xCA //System Reset
56#define ENC624J600_CMD_FCDISABLE 0xE0 //Flow Control Disable
57#define ENC624J600_CMD_FCSINGLE 0xE2 //Flow Control Single
58#define ENC624J600_CMD_FCMULTIPLE 0xE4 //Flow Control Multiple
59#define ENC624J600_CMD_FCCLEAR 0xE6 //Flow Control Clear
60#define ENC624J600_CMD_SETPKTDEC 0xCC //Decrement Packet Counter
61#define ENC624J600_CMD_DMASTOP 0xD2 //DMA Stop
62#define ENC624J600_CMD_DMACKSUM 0xD8 //DMA Start Checksum
63#define ENC624J600_CMD_DMACKSUMS 0xDA //DMA Start Checksum with Seed
64#define ENC624J600_CMD_DMACOPY 0xDC //DMA Start Copy
65#define ENC624J600_CMD_DMACOPYS 0xDE //DMA Start Copy and Checksum with Seed
66#define ENC624J600_CMD_SETTXRTS 0xD4 //Request Packet Transmission
67#define ENC624J600_CMD_ENABLERX 0xE8 //Enable RX
68#define ENC624J600_CMD_DISABLERX 0xEA //Disable RX
69#define ENC624J600_CMD_SETEIE 0xEC //Enable Interrupts
70#define ENC624J600_CMD_CLREIE 0xEE //Disable Interrupts
71#define ENC624J600_CMD_RBSEL 0xC8 //Read Bank Select
72#define ENC624J600_CMD_WGPRDPT 0x60 //Write EGPRDPT
73#define ENC624J600_CMD_RGPRDPT 0x62 //Read EGPRDPT
74#define ENC624J600_CMD_WRXRDPT 0x64 //Write ERXRDPT
75#define ENC624J600_CMD_RRXRDPT 0x66 //Read ERXRDPT
76#define ENC624J600_CMD_WUDARDPT 0x68 //Write EUDARDPT
77#define ENC624J600_CMD_RUDARDPT 0x6A //Read EUDARDPT
78#define ENC624J600_CMD_WGPWRPT 0x6C //Write EGPWRPT
79#define ENC624J600_CMD_RGPWRPT 0x6E //Read EGPWRPT
80#define ENC624J600_CMD_WRXWRPT 0x70 //Write ERXWRPT
81#define ENC624J600_CMD_RRXWRPT 0x72 //Read ERXWRPT
82#define ENC624J600_CMD_WUDAWRPT 0x74 //Write EUDAWRPT
83#define ENC624J600_CMD_RUDAWRPT 0x76 //Read EUDAWRPT
84#define ENC624J600_CMD_RCR 0x00 //Read Control Register
85#define ENC624J600_CMD_WCR 0x40 //Write Control Register
86#define ENC624J600_CMD_RCRU 0x20 //Read Control Register Unbanked
87#define ENC624J600_CMD_WCRU 0x22 //Write Control Register Unbanked
88#define ENC624J600_CMD_BFS 0x80 //Bit Field Set
89#define ENC624J600_CMD_BFC 0xA0 //Bit Field Clear
90#define ENC624J600_CMD_BFSU 0x24 //Bit Field Set Unbanked
91#define ENC624J600_CMD_BFCU 0x26 //Bit Field Clear Unbanked
92#define ENC624J600_CMD_RGPDATA 0x28 //Read EGPDATA
93#define ENC624J600_CMD_WGPDATA 0x2A //Write EGPDATA
94#define ENC624J600_CMD_RRXDATA 0x2C //Read ERXDATA
95#define ENC624J600_CMD_WRXDATA 0x2E //Write ERXDATA
96#define ENC624J600_CMD_RUDADATA 0x30 //Read EUDADATA
97#define ENC624J600_CMD_WUDADATA 0x32 //Write EUDADATA
98
99//ENC624J600 registers
100#define ENC624J600_ETXST 0x00
101#define ENC624J600_ETXLEN 0x02
102#define ENC624J600_ERXST 0x04
103#define ENC624J600_ERXTAIL 0x06
104#define ENC624J600_ERXHEAD 0x08
105#define ENC624J600_EDMAST 0x0A
106#define ENC624J600_EDMALEN 0x0C
107#define ENC624J600_EDMADST 0x0E
108#define ENC624J600_EDMACS 0x10
109#define ENC624J600_ETXSTAT 0x12
110#define ENC624J600_ETXWIRE 0x14
111#define ENC624J600_EUDAST 0x16
112#define ENC624J600_EUDAND 0x18
113#define ENC624J600_ESTAT 0x1A
114#define ENC624J600_EIR 0x1C
115#define ENC624J600_ECON1 0x1E
116#define ENC624J600_EHT1 0x20
117#define ENC624J600_EHT2 0x22
118#define ENC624J600_EHT3 0x24
119#define ENC624J600_EHT4 0x26
120#define ENC624J600_EPMM1 0x28
121#define ENC624J600_EPMM2 0x2A
122#define ENC624J600_EPMM3 0x2C
123#define ENC624J600_EPMM4 0x2E
124#define ENC624J600_EPMCS 0x30
125#define ENC624J600_EPMO 0x32
126#define ENC624J600_ERXFCON 0x34
127#define ENC624J600_MACON1 0x40
128#define ENC624J600_MACON2 0x42
129#define ENC624J600_MABBIPG 0x44
130#define ENC624J600_MAIPG 0x46
131#define ENC624J600_MACLCON 0x48
132#define ENC624J600_MAMXFL 0x4A
133#define ENC624J600_MICMD 0x52
134#define ENC624J600_MIREGADR 0x54
135#define ENC624J600_MAADR3 0x60
136#define ENC624J600_MAADR2 0x62
137#define ENC624J600_MAADR1 0x64
138#define ENC624J600_MIWR 0x66
139#define ENC624J600_MIRD 0x68
140#define ENC624J600_MISTAT 0x6A
141#define ENC624J600_EPAUS 0x6C
142#define ENC624J600_ECON2 0x6E
143#define ENC624J600_ERXWM 0x70
144#define ENC624J600_EIE 0x72
145#define ENC624J600_EIDLED 0x74
146#define ENC624J600_EGPDATA 0x80
147#define ENC624J600_ERXDATA 0x82
148#define ENC624J600_EUDADATA 0x84
149#define ENC624J600_EGPRDPT 0x86
150#define ENC624J600_EGPWRPT 0x88
151#define ENC624J600_ERXRDPT 0x8A
152#define ENC624J600_ERXWRPT 0x8C
153#define ENC624J600_EUDARDPT 0x8E
154#define ENC624J600_EUDAWRPT 0x90
155
156//ENC624J600 PHY registers
157#define ENC624J600_PHCON1 0x00
158#define ENC624J600_PHSTAT1 0x01
159#define ENC624J600_PHANA 0x04
160#define ENC624J600_PHANLPA 0x05
161#define ENC624J600_PHANE 0x06
162#define ENC624J600_PHCON2 0x11
163#define ENC624J600_PHSTAT2 0x1B
164#define ENC624J600_PHSTAT3 0x1F
165
166//TX Start Address register
167#define ENC624J600_ETXST_VAL 0x7FFF
168
169//TX Length register
170#define ENC624J600_ETXLEN_VAL 0x7FFF
171
172//RX Buffer Start Address register
173#define ENC624J600_ERXST_VAL 0x7FFF
174
175//RX Tail Pointer register
176#define ENC624J600_ERXTAIL_VAL 0x7FFF
177
178//RX Head Pointer register
179#define ENC624J600_ERXHEAD_VAL 0x7FFF
180
181//DMA Start Address register
182#define ENC624J600_EDMAST_VAL 0x7FFF
183
184//DMA Length register
185#define ENC624J600_EDMALEN_VAL 0x7FFF
186
187//DMA Destination Address register
188#define ENC624J600_EDMADST_VAL 0x7FFF
189
190//Ethernet Transmit Status register
191#define ENC624J600_ETXSTAT_R12 0x1000
192#define ENC624J600_ETXSTAT_R11 0x0800
193#define ENC624J600_ETXSTAT_LATECOL 0x0400
194#define ENC624J600_ETXSTAT_MAXCOL 0x0200
195#define ENC624J600_ETXSTAT_EXDEFER 0x0100
196#define ENC624J600_ETXSTAT_DEFER 0x0080
197#define ENC624J600_ETXSTAT_R6 0x0040
198#define ENC624J600_ETXSTAT_R5 0x0020
199#define ENC624J600_ETXSTAT_CRCBAD 0x0010
200#define ENC624J600_ETXSTAT_COLCNT 0x000F
201
202//User-Defined Area Start Pointer register
203#define ENC624J600_EUDAST_VAL 0x7FFF
204
205//User-Defined Area End Pointer register
206#define ENC624J600_EUDAND_VAL 0x7FFF
207
208//Ethernet Status register
209#define ENC624J600_ESTAT_INT 0x8000
210#define ENC624J600_ESTAT_FCIDLE 0x4000
211#define ENC624J600_ESTAT_RXBUSY 0x2000
212#define ENC624J600_ESTAT_CLKRDY 0x1000
213#define ENC624J600_ESTAT_R11 0x0800
214#define ENC624J600_ESTAT_PHYDPX 0x0400
215#define ENC624J600_ESTAT_R9 0x0200
216#define ENC624J600_ESTAT_PHYLNK 0x0100
217#define ENC624J600_ESTAT_PKTCNT 0x00FF
218
219//Ethernet Interrupt Flag register
220#define ENC624J600_EIR_CRYPTEN 0x8000
221#define ENC624J600_EIR_MODEXIF 0x4000
222#define ENC624J600_EIR_HASHIF 0x2000
223#define ENC624J600_EIR_AESIF 0x1000
224#define ENC624J600_EIR_LINKIF 0x0800
225#define ENC624J600_EIR_R10 0x0400
226#define ENC624J600_EIR_R9 0x0200
227#define ENC624J600_EIR_R8 0x0100
228#define ENC624J600_EIR_R7 0x0080
229#define ENC624J600_EIR_PKTIF 0x0040
230#define ENC624J600_EIR_DMAIF 0x0020
231#define ENC624J600_EIR_R4 0x0010
232#define ENC624J600_EIR_TXIF 0x0008
233#define ENC624J600_EIR_TXABTIF 0x0004
234#define ENC624J600_EIR_RXABTIF 0x0002
235#define ENC624J600_EIR_PCFULIF 0x0001
236
237//Ethernet Control 1 register
238#define ENC624J600_ECON1_MODEXST 0x8000
239#define ENC624J600_ECON1_HASHEN 0x4000
240#define ENC624J600_ECON1_HASHOP 0x2000
241#define ENC624J600_ECON1_HASHLST 0x1000
242#define ENC624J600_ECON1_AESST 0x0800
243#define ENC624J600_ECON1_AESOP1 0x0400
244#define ENC624J600_ECON1_AESOP0 0x0200
245#define ENC624J600_ECON1_PKTDEC 0x0100
246#define ENC624J600_ECON1_FCOP1 0x0080
247#define ENC624J600_ECON1_FCOP0 0x0040
248#define ENC624J600_ECON1_DMAST 0x0020
249#define ENC624J600_ECON1_DMACPY 0x0010
250#define ENC624J600_ECON1_DMACSSD 0x0008
251#define ENC624J600_ECON1_DMANOCS 0x0004
252#define ENC624J600_ECON1_TXRTS 0x0002
253#define ENC624J600_ECON1_RXEN 0x0001
254
255//Ethernet RX Filter Control register
256#define ENC624J600_ERXFCON_HTEN 0x8000
257#define ENC624J600_ERXFCON_MPEN 0x4000
258#define ENC624J600_ERXFCON_NOTPM 0x1000
259#define ENC624J600_ERXFCON_PMEN 0x0F00
260#define ENC624J600_ERXFCON_PMEN_DISABLED 0x0000
261#define ENC624J600_ERXFCON_PMEN_CHECKSUM 0x0100
262#define ENC624J600_ERXFCON_PMEN_UNICAST 0x0200
263#define ENC624J600_ERXFCON_PMEN_NOT_UNICAST 0x0300
264#define ENC624J600_ERXFCON_PMEN_MULTICAST 0x0400
265#define ENC624J600_ERXFCON_PMEN_NOT_MULTICAST 0x0500
266#define ENC624J600_ERXFCON_PMEN_BROADCAST 0x0600
267#define ENC624J600_ERXFCON_PMEN_NOT_BROADCAST 0x0700
268#define ENC624J600_ERXFCON_PMEN_HASH 0x0800
269#define ENC624J600_ERXFCON_PMEN_MAGIC_PKT 0x0900
270#define ENC624J600_ERXFCON_CRCEEN 0x0080
271#define ENC624J600_ERXFCON_CRCEN 0x0040
272#define ENC624J600_ERXFCON_RUNTEEN 0x0020
273#define ENC624J600_ERXFCON_RUNTEN 0x0010
274#define ENC624J600_ERXFCON_UCEN 0x0008
275#define ENC624J600_ERXFCON_NOTMEEN 0x0004
276#define ENC624J600_ERXFCON_MCEN 0x0002
277#define ENC624J600_ERXFCON_BCEN 0x0001
278
279//MAC Control 1 register
280#define ENC624J600_MACON1_R15_14 0xC000
281#define ENC624J600_MACON1_R11_8 0x0F00
282#define ENC624J600_MACON1_LOOPBK 0x0010
283#define ENC624J600_MACON1_R3 0x0008
284#define ENC624J600_MACON1_R3_DEFAULT 0x0008
285#define ENC624J600_MACON1_RXPAUS 0x0004
286#define ENC624J600_MACON1_PASSALL 0x0002
287#define ENC624J600_MACON1_R0 0x0001
288#define ENC624J600_MACON1_R0_DEFAULT 0x0001
289
290//MAC Control 2 register
291#define ENC624J600_MACON2_DEFER 0x4000
292#define ENC624J600_MACON2_BPEN 0x2000
293#define ENC624J600_MACON2_NOBKOFF 0x1000
294#define ENC624J600_MACON2_R9_8 0x0300
295#define ENC624J600_MACON2_PADCFG 0x00E0
296#define ENC624J600_MACON2_PADCFG_NO 0x0000
297#define ENC624J600_MACON2_PADCFG_60_BYTES 0x0020
298#define ENC624J600_MACON2_PADCFG_64_BYTES 0x0060
299#define ENC624J600_MACON2_PADCFG_AUTO 0x00A0
300#define ENC624J600_MACON2_TXCRCEN 0x0010
301#define ENC624J600_MACON2_PHDREN 0x0008
302#define ENC624J600_MACON2_HFRMEN 0x0004
303#define ENC624J600_MACON2_R1 0x0002
304#define ENC624J600_MACON2_R1_DEFAULT 0x0002
305#define ENC624J600_MACON2_FULDPX 0x0001
306
307//MAC Back-To-Back Inter-Packet Gap register
308#define ENC624J600_MABBIPG_BBIPG 0x007F
309#define ENC624J600_MABBIPG_BBIPG_DEFAULT_HD 0x0012
310#define ENC624J600_MABBIPG_BBIPG_DEFAULT_FD 0x0015
311
312//MAC Inter-Packet Gap register
313#define ENC624J600_MAIPG_R14_8 0x7F00
314#define ENC624J600_MAIPG_R14_8_DEFAULT 0x0C00
315#define ENC624J600_MAIPG_IPG 0x007F
316#define ENC624J600_MAIPG_IPG_DEFAULT 0x0012
317
318//MAC Collision Control register
319#define ENC624J600_MACLCON_R13_8 0x3F00
320#define ENC624J600_MACLCON_R13_8_DEFAULT 0x3700
321#define ENC624J600_MACLCON_MAXRET 0x000F
322
323//MII Management Command register
324#define ENC624J600_MICMD_MIISCAN 0x0002
325#define ENC624J600_MICMD_MIIRD 0x0001
326
327//MII Management Address register
328#define ENC624J600_MIREGADR_R12_8 0x1F00
329#define ENC624J600_MIREGADR_R12_8_DEFAULT 0x0100
330#define ENC624J600_MIREGADR_PHREG 0x001F
331
332//MII Management Status register
333#define ENC624J600_MISTAT_R3 0x0008
334#define ENC624J600_MISTAT_NVALID 0x0004
335#define ENC624J600_MISTAT_SCAN 0x0002
336#define ENC624J600_MISTAT_BUSY 0x0001
337
338//Ethernet Control 2 register
339#define ENC624J600_ECON2_ETHEN 0x8000
340#define ENC624J600_ECON2_STRCH 0x4000
341#define ENC624J600_ECON2_TXMAC 0x2000
342#define ENC624J600_ECON2_SHA1MD5 0x1000
343#define ENC624J600_ECON2_COCON 0x0F00
344#define ENC624J600_ECON2_COCON_NONE 0x0000
345#define ENC624J600_ECON2_COCON_33_33_MHZ 0x0100
346#define ENC624J600_ECON2_COCON_25_00_MHZ 0x0200
347#define ENC624J600_ECON2_COCON_20_00_MHZ 0x0300
348#define ENC624J600_ECON2_COCON_16_67_MHZ 0x0400
349#define ENC624J600_ECON2_COCON_12_50_MHZ 0x0500
350#define ENC624J600_ECON2_COCON_10_00_MHZ 0x0600
351#define ENC624J600_ECON2_COCON_8_333_MHZ 0x0700
352#define ENC624J600_ECON2_COCON_8_000_MHZ 0x0800
353#define ENC624J600_ECON2_COCON_6_250_MHZ 0x0900
354#define ENC624J600_ECON2_COCON_5_000_MHZ 0x0A00
355#define ENC624J600_ECON2_COCON_4_000_MHZ 0x0B00
356#define ENC624J600_ECON2_COCON_3_125_MHZ 0x0C00
357#define ENC624J600_ECON2_COCON_100_KHZ 0x0E00
358#define ENC624J600_ECON2_COCON_50_KHZ 0x0F00
359#define ENC624J600_ECON2_AUTOFC 0x0080
360#define ENC624J600_ECON2_TXRST 0x0040
361#define ENC624J600_ECON2_RXRST 0x0020
362#define ENC624J600_ECON2_ETHRST 0x0010
363#define ENC624J600_ECON2_MODLEN 0x000C
364#define ENC624J600_ECON2_MODLEN_512_BITS 0x0000
365#define ENC624J600_ECON2_MODLEN_768_BITS 0x0004
366#define ENC624J600_ECON2_MODLEN_1024_BITS 0x0008
367#define ENC624J600_ECON2_AESLEN 0x0003
368#define ENC624J600_ECON2_AESLEN_128_BITS 0x0000
369#define ENC624J600_ECON2_AESLEN_192_BITS 0x0001
370#define ENC624J600_ECON2_AESLEN_256_BITS 0x0002
371
372//Receive Watermark register
373#define ENC624J600_ERXWM_RXFWM 0xFF00
374#define ENC624J600_ERXWM_RXEWM 0x00FF
375
376//Ethernet Interrupt Enable register
377#define ENC624J600_EIE_INTIE 0x8000
378#define ENC624J600_EIE_MODEXIE 0x4000
379#define ENC624J600_EIE_HASHIE 0x2000
380#define ENC624J600_EIE_AESIE 0x1000
381#define ENC624J600_EIE_LINKIE 0x0800
382#define ENC624J600_EIE_R10_7 0x0780
383#define ENC624J600_EIE_PKTIE 0x0040
384#define ENC624J600_EIE_DMAIE 0x0020
385#define ENC624J600_EIE_R4 0x0010
386#define ENC624J600_EIE_R4_DEFAULT 0x0010
387#define ENC624J600_EIE_TXIE 0x0008
388#define ENC624J600_EIE_TXABTIE 0x0004
389#define ENC624J600_EIE_RXABTIE 0x0002
390#define ENC624J600_EIE_PCFULIE 0x0001
391
392//Ethernet ID Status/LED Control register
393#define ENC624J600_EIDLED_LACFG 0xF000
394#define ENC624J600_EIDLED_LACFG_OFF 0x0000
395#define ENC624J600_EIDLED_LACFG_ON 0x1000
396#define ENC624J600_EIDLED_LACFG_LINK 0x2000
397#define ENC624J600_EIDLED_LACFG_COL 0x3000
398#define ENC624J600_EIDLED_LACFG_TX 0x4000
399#define ENC624J600_EIDLED_LACFG_RX 0x5000
400#define ENC624J600_EIDLED_LACFG_TX_RX 0x6000
401#define ENC624J600_EIDLED_LACFG_DUPLEX 0x7000
402#define ENC624J600_EIDLED_LACFG_SPEED 0x8000
403#define ENC624J600_EIDLED_LACFG_LINK_TX 0x9000
404#define ENC624J600_EIDLED_LACFG_LINK_RX 0xA000
405#define ENC624J600_EIDLED_LACFG_LINK_TX_RX 0xB000
406#define ENC624J600_EIDLED_LACFG_LINK_COL 0xC000
407#define ENC624J600_EIDLED_LACFG_LINK_DUPLEX_TX_RX 0xE000
408#define ENC624J600_EIDLED_LACFG_LINK_SPEED_TX_RX 0xF000
409#define ENC624J600_EIDLED_LBCFG 0x0F00
410#define ENC624J600_EIDLED_LBCFG_OFF 0x0000
411#define ENC624J600_EIDLED_LBCFG_ON 0x0100
412#define ENC624J600_EIDLED_LBCFG_LINK 0x0200
413#define ENC624J600_EIDLED_LBCFG_COL 0x0300
414#define ENC624J600_EIDLED_LBCFG_TX 0x0400
415#define ENC624J600_EIDLED_LBCFG_RX 0x0500
416#define ENC624J600_EIDLED_LBCFG_TX_RX 0x0600
417#define ENC624J600_EIDLED_LBCFG_DUPLEX 0x0700
418#define ENC624J600_EIDLED_LBCFG_SPEED 0x0800
419#define ENC624J600_EIDLED_LBCFG_LINK_TX 0x0900
420#define ENC624J600_EIDLED_LBCFG_LINK_RX 0x0A00
421#define ENC624J600_EIDLED_LBCFG_LINK_TX_RX 0x0B00
422#define ENC624J600_EIDLED_LBCFG_LINK_COL 0x0C00
423#define ENC624J600_EIDLED_LBCFG_LINK_DUPLEX_TX_RX 0x0E00
424#define ENC624J600_EIDLED_LBCFG_LINK_SPEED_TX_RX 0x0F00
425#define ENC624J600_EIDLED_DEVID 0x00E0
426#define ENC624J600_EIDLED_DEVID_DEFAULT 0x0020
427#define ENC624J600_EIDLED_REVID 0x001F
428
429//General Purpose Data Window register
430#define ENC624J600_EGPDATA_R15_8 0xFF00
431#define ENC624J600_EGPDATA_VAL 0x00FF
432
433//Ethernet RX Data Window register
434#define ENC624J600_ERXDATA_R15_8 0xFF00
435#define ENC624J600_ERXDATA_VAL 0x00FF
436
437//User-Defined Area Data Window register
438#define ENC624J600_EUDADATA_R15_8 0xFF00
439#define ENC624J600_EUDADATA_VAL 0x00FF
440
441//General Purpose Window Read Pointer register
442#define ENC624J600_EGPRDPT_VAL 0x7FFF
443
444//General Purpose Window Write Pointer register
445#define ENC624J600_EGPWRPT_VAL 0x7FFF
446
447//RX Window Read Pointer register
448#define ENC624J600_ERXRDPT_VAL 0x7FFF
449
450//RX Window Write Pointer register
451#define ENC624J600_ERXWRPT_VAL 0x7FFF
452
453//UDA Window Read Pointer register
454#define ENC624J600_EUDARDPT_VAL 0x7FFF
455
456//UDA Window Write Pointer register
457#define ENC624J600_EUDAWRPT_VAL 0x7FFF
458
459//PHY Control 1 register
460#define ENC624J600_PHCON1_PRST 0x8000
461#define ENC624J600_PHCON1_PLOOPBK 0x4000
462#define ENC624J600_PHCON1_SPD100 0x2000
463#define ENC624J600_PHCON1_ANEN 0x1000
464#define ENC624J600_PHCON1_PSLEEP 0x0800
465#define ENC624J600_PHCON1_RENEG 0x0200
466#define ENC624J600_PHCON1_PFULDPX 0x0100
467
468//PHY Status 1 register
469#define ENC624J600_PHSTAT1_FULL100 0x4000
470#define ENC624J600_PHSTAT1_HALF100 0x2000
471#define ENC624J600_PHSTAT1_FULL10 0x1000
472#define ENC624J600_PHSTAT1_HALF10 0x0800
473#define ENC624J600_PHSTAT1_ANDONE 0x0020
474#define ENC624J600_PHSTAT1_LRFAULT 0x0010
475#define ENC624J600_PHSTAT1_ANABLE 0x0008
476#define ENC624J600_PHSTAT1_LLSTAT 0x0004
477#define ENC624J600_PHSTAT1_EXTREGS 0x0001
478
479//PHY Auto-Negotiation Advertisement register
480#define ENC624J600_PHANA_ADNP 0x8000
481#define ENC624J600_PHANA_ADFAULT 0x2000
482#define ENC624J600_PHANA_ADPAUS1 0x0800
483#define ENC624J600_PHANA_ADPAUS0 0x0400
484#define ENC624J600_PHANA_AD100FD 0x0100
485#define ENC624J600_PHANA_AD100 0x0080
486#define ENC624J600_PHANA_AD10FD 0x0040
487#define ENC624J600_PHANA_AD10 0x0020
488#define ENC624J600_PHANA_ADIEEE 0x001F
489#define ENC624J600_PHANA_ADIEEE_DEFAULT 0x0001
490
491//PHY Auto-Negotiation Link Partner Ability register
492#define ENC624J600_PHANLPA_LPNP 0x8000
493#define ENC624J600_PHANLPA_LPACK 0x4000
494#define ENC624J600_PHANLPA_LPFAULT 0x2000
495#define ENC624J600_PHANLPA_LPPAUS1 0x0800
496#define ENC624J600_PHANLPA_LPPAUS0 0x0400
497#define ENC624J600_PHANLPA_LP100T4 0x0200
498#define ENC624J600_PHANLPA_LP100FD 0x0100
499#define ENC624J600_PHANLPA_LP100 0x0080
500#define ENC624J600_PHANLPA_LP10FD 0x0040
501#define ENC624J600_PHANLPA_LP10 0x0020
502#define ENC624J600_PHANLPA_LPIEEE 0x001F
503
504//PHY Auto-Negotiation Expansion register
505#define ENC624J600_PHANE_PDFLT 0x0010
506#define ENC624J600_PHANE_LPARCD 0x0002
507#define ENC624J600_PHANE_LPANABL 0x0001
508
509//PHY Control 2 register
510#define ENC624J600_PHCON2_EDPWRDN 0x2000
511#define ENC624J600_PHCON2_EDTHRES 0x0800
512#define ENC624J600_PHCON2_FRCLNK 0x0004
513#define ENC624J600_PHCON2_EDSTAT 0x0002
514
515//PHY Status 2 register
516#define ENC624J600_PHSTAT2_PLRITY 0x0010
517
518//PHY Status 3 register
519#define ENC624J600_PHSTAT3_R6 0x0040
520#define ENC624J600_PHSTAT3_R6_DEFAULT 0x0040
521#define ENC624J600_PHSTAT3_SPDDPX2 0x0010
522#define ENC624J600_PHSTAT3_SPDDPX1 0x0008
523#define ENC624J600_PHSTAT3_SPDDPX0 0x0004
524
525//Receive status vector
526#define ENC624J600_RSV_UNICAST_FILTER 0x00100000
527#define ENC624J600_RSV_PATTERN_MATCH_FILTER 0x00080000
528#define ENC624J600_RSV_MAGIC_PACKET_FILTER 0x00040000
529#define ENC624J600_RSV_HASH_FILTER 0x00020000
530#define ENC624J600_RSV_NOT_ME_FILTER 0x00010000
531#define ENC624J600_RSV_RUNT_FILTER 0x00008000
532#define ENC624J600_RSV_VLAN_TYPE 0x00004000
533#define ENC624J600_RSV_UNKNOWN_OPCODE 0x00002000
534#define ENC624J600_RSV_PAUSE_CONTROL_FRAME 0x00001000
535#define ENC624J600_RSV_CONTROL_FRAME 0x00000800
536#define ENC624J600_RSV_DRIBBLE_NIBBLE 0x00000400
537#define ENC624J600_RSV_BROADCAST_PACKET 0x00000200
538#define ENC624J600_RSV_MULTICAST_PACKET 0x00000100
539#define ENC624J600_RSV_RECEIVED_OK 0x00000080
540#define ENC624J600_RSV_LENGTH_OUT_OF_RANGE 0x00000040
541#define ENC624J600_RSV_LENGTH_CHECK_ERROR 0x00000020
542#define ENC624J600_RSV_CRC_ERROR 0x00000010
543#define ENC624J600_RSV_CARRIER_EVENT 0x00000004
544#define ENC624J600_RSV_PACKET_IGNORED 0x00000001
545
546//C++ guard
547#ifdef __cplusplus
548extern "C" {
549#endif
550
551
556typedef struct
557{
558 uint16_t nextPacket;
560
561
562//ENC624J600 driver
563extern const NicDriver enc624j600Driver;
564
565//ENC624J600 related functions
566error_t enc624j600Init(NetInterface *interface);
567
568void enc624j600Tick(NetInterface *interface);
569
570void enc624j600EnableIrq(NetInterface *interface);
571void enc624j600DisableIrq(NetInterface *interface);
572bool_t enc624j600IrqHandler(NetInterface *interface);
573void enc624j600EventHandler(NetInterface *interface);
574
575error_t enc624j600SendPacket(NetInterface *interface,
576 const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary);
577
578error_t enc624j600ReceivePacket(NetInterface *interface);
579
580error_t enc624j600UpdateMacAddrFilter(NetInterface *interface);
581void enc624j600UpdateMacConfig(NetInterface *interface);
582
583error_t enc624j600SoftReset(NetInterface *interface);
584
585void enc624j600WriteReg(NetInterface *interface, uint8_t address,
586 uint16_t data);
587
588uint16_t enc624j600ReadReg(NetInterface *interface, uint8_t address);
589
590void enc624j600WritePhyReg(NetInterface *interface, uint8_t address,
591 uint16_t data);
592
593uint16_t enc624j600ReadPhyReg(NetInterface *interface, uint8_t address);
594
595void enc624j600WriteBuffer(NetInterface *interface,
596 uint8_t opcode, const NetBuffer *buffer, size_t offset);
597
598void enc624j600ReadBuffer(NetInterface *interface,
599 uint8_t opcode, uint8_t *data, size_t length);
600
601void enc624j600SetBit(NetInterface *interface, uint8_t address,
602 uint16_t mask);
603
604void enc624j600ClearBit(NetInterface *interface, uint8_t address,
605 uint16_t mask);
606
607uint32_t enc624j600CalcCrc(const void *data, size_t length);
608
609void enc624j600DumpReg(NetInterface *interface);
610void enc624j600DumpPhyReg(NetInterface *interface);
611
612//C++ guard
613#ifdef __cplusplus
614}
615#endif
616
617#endif
error_t
Error codes.
Definition error.h:43
Network interface controller abstraction layer.
ENC424J600 driver context.
Definition enc424j600_driver.h:557
Structure describing a buffer that spans multiple chunks.
Definition net_mem.h:89
NIC driver.
Definition nic.h:283