18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * enc28j60_hw.h: EDTP FrameThrower style enc28j60 registers 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * $Id: enc28j60_hw.h,v 1.9 2007/12/14 11:59:16 claudio Exp $ 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef _ENC28J60_HW_H 98c2ecf20Sopenharmony_ci#define _ENC28J60_HW_H 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci/* 128c2ecf20Sopenharmony_ci * ENC28J60 Control Registers 138c2ecf20Sopenharmony_ci * Control register definitions are a combination of address, 148c2ecf20Sopenharmony_ci * bank number, and Ethernet/MAC/PHY indicator bits. 158c2ecf20Sopenharmony_ci * - Register address (bits 0-4) 168c2ecf20Sopenharmony_ci * - Bank number (bits 5-6) 178c2ecf20Sopenharmony_ci * - MAC/MII indicator (bit 7) 188c2ecf20Sopenharmony_ci */ 198c2ecf20Sopenharmony_ci#define ADDR_MASK 0x1F 208c2ecf20Sopenharmony_ci#define BANK_MASK 0x60 218c2ecf20Sopenharmony_ci#define SPRD_MASK 0x80 228c2ecf20Sopenharmony_ci/* All-bank registers */ 238c2ecf20Sopenharmony_ci#define EIE 0x1B 248c2ecf20Sopenharmony_ci#define EIR 0x1C 258c2ecf20Sopenharmony_ci#define ESTAT 0x1D 268c2ecf20Sopenharmony_ci#define ECON2 0x1E 278c2ecf20Sopenharmony_ci#define ECON1 0x1F 288c2ecf20Sopenharmony_ci/* Bank 0 registers */ 298c2ecf20Sopenharmony_ci#define ERDPTL (0x00|0x00) 308c2ecf20Sopenharmony_ci#define ERDPTH (0x01|0x00) 318c2ecf20Sopenharmony_ci#define EWRPTL (0x02|0x00) 328c2ecf20Sopenharmony_ci#define EWRPTH (0x03|0x00) 338c2ecf20Sopenharmony_ci#define ETXSTL (0x04|0x00) 348c2ecf20Sopenharmony_ci#define ETXSTH (0x05|0x00) 358c2ecf20Sopenharmony_ci#define ETXNDL (0x06|0x00) 368c2ecf20Sopenharmony_ci#define ETXNDH (0x07|0x00) 378c2ecf20Sopenharmony_ci#define ERXSTL (0x08|0x00) 388c2ecf20Sopenharmony_ci#define ERXSTH (0x09|0x00) 398c2ecf20Sopenharmony_ci#define ERXNDL (0x0A|0x00) 408c2ecf20Sopenharmony_ci#define ERXNDH (0x0B|0x00) 418c2ecf20Sopenharmony_ci#define ERXRDPTL (0x0C|0x00) 428c2ecf20Sopenharmony_ci#define ERXRDPTH (0x0D|0x00) 438c2ecf20Sopenharmony_ci#define ERXWRPTL (0x0E|0x00) 448c2ecf20Sopenharmony_ci#define ERXWRPTH (0x0F|0x00) 458c2ecf20Sopenharmony_ci#define EDMASTL (0x10|0x00) 468c2ecf20Sopenharmony_ci#define EDMASTH (0x11|0x00) 478c2ecf20Sopenharmony_ci#define EDMANDL (0x12|0x00) 488c2ecf20Sopenharmony_ci#define EDMANDH (0x13|0x00) 498c2ecf20Sopenharmony_ci#define EDMADSTL (0x14|0x00) 508c2ecf20Sopenharmony_ci#define EDMADSTH (0x15|0x00) 518c2ecf20Sopenharmony_ci#define EDMACSL (0x16|0x00) 528c2ecf20Sopenharmony_ci#define EDMACSH (0x17|0x00) 538c2ecf20Sopenharmony_ci/* Bank 1 registers */ 548c2ecf20Sopenharmony_ci#define EHT0 (0x00|0x20) 558c2ecf20Sopenharmony_ci#define EHT1 (0x01|0x20) 568c2ecf20Sopenharmony_ci#define EHT2 (0x02|0x20) 578c2ecf20Sopenharmony_ci#define EHT3 (0x03|0x20) 588c2ecf20Sopenharmony_ci#define EHT4 (0x04|0x20) 598c2ecf20Sopenharmony_ci#define EHT5 (0x05|0x20) 608c2ecf20Sopenharmony_ci#define EHT6 (0x06|0x20) 618c2ecf20Sopenharmony_ci#define EHT7 (0x07|0x20) 628c2ecf20Sopenharmony_ci#define EPMM0 (0x08|0x20) 638c2ecf20Sopenharmony_ci#define EPMM1 (0x09|0x20) 648c2ecf20Sopenharmony_ci#define EPMM2 (0x0A|0x20) 658c2ecf20Sopenharmony_ci#define EPMM3 (0x0B|0x20) 668c2ecf20Sopenharmony_ci#define EPMM4 (0x0C|0x20) 678c2ecf20Sopenharmony_ci#define EPMM5 (0x0D|0x20) 688c2ecf20Sopenharmony_ci#define EPMM6 (0x0E|0x20) 698c2ecf20Sopenharmony_ci#define EPMM7 (0x0F|0x20) 708c2ecf20Sopenharmony_ci#define EPMCSL (0x10|0x20) 718c2ecf20Sopenharmony_ci#define EPMCSH (0x11|0x20) 728c2ecf20Sopenharmony_ci#define EPMOL (0x14|0x20) 738c2ecf20Sopenharmony_ci#define EPMOH (0x15|0x20) 748c2ecf20Sopenharmony_ci#define EWOLIE (0x16|0x20) 758c2ecf20Sopenharmony_ci#define EWOLIR (0x17|0x20) 768c2ecf20Sopenharmony_ci#define ERXFCON (0x18|0x20) 778c2ecf20Sopenharmony_ci#define EPKTCNT (0x19|0x20) 788c2ecf20Sopenharmony_ci/* Bank 2 registers */ 798c2ecf20Sopenharmony_ci#define MACON1 (0x00|0x40|SPRD_MASK) 808c2ecf20Sopenharmony_ci/* #define MACON2 (0x01|0x40|SPRD_MASK) */ 818c2ecf20Sopenharmony_ci#define MACON3 (0x02|0x40|SPRD_MASK) 828c2ecf20Sopenharmony_ci#define MACON4 (0x03|0x40|SPRD_MASK) 838c2ecf20Sopenharmony_ci#define MABBIPG (0x04|0x40|SPRD_MASK) 848c2ecf20Sopenharmony_ci#define MAIPGL (0x06|0x40|SPRD_MASK) 858c2ecf20Sopenharmony_ci#define MAIPGH (0x07|0x40|SPRD_MASK) 868c2ecf20Sopenharmony_ci#define MACLCON1 (0x08|0x40|SPRD_MASK) 878c2ecf20Sopenharmony_ci#define MACLCON2 (0x09|0x40|SPRD_MASK) 888c2ecf20Sopenharmony_ci#define MAMXFLL (0x0A|0x40|SPRD_MASK) 898c2ecf20Sopenharmony_ci#define MAMXFLH (0x0B|0x40|SPRD_MASK) 908c2ecf20Sopenharmony_ci#define MAPHSUP (0x0D|0x40|SPRD_MASK) 918c2ecf20Sopenharmony_ci#define MICON (0x11|0x40|SPRD_MASK) 928c2ecf20Sopenharmony_ci#define MICMD (0x12|0x40|SPRD_MASK) 938c2ecf20Sopenharmony_ci#define MIREGADR (0x14|0x40|SPRD_MASK) 948c2ecf20Sopenharmony_ci#define MIWRL (0x16|0x40|SPRD_MASK) 958c2ecf20Sopenharmony_ci#define MIWRH (0x17|0x40|SPRD_MASK) 968c2ecf20Sopenharmony_ci#define MIRDL (0x18|0x40|SPRD_MASK) 978c2ecf20Sopenharmony_ci#define MIRDH (0x19|0x40|SPRD_MASK) 988c2ecf20Sopenharmony_ci/* Bank 3 registers */ 998c2ecf20Sopenharmony_ci#define MAADR1 (0x00|0x60|SPRD_MASK) 1008c2ecf20Sopenharmony_ci#define MAADR0 (0x01|0x60|SPRD_MASK) 1018c2ecf20Sopenharmony_ci#define MAADR3 (0x02|0x60|SPRD_MASK) 1028c2ecf20Sopenharmony_ci#define MAADR2 (0x03|0x60|SPRD_MASK) 1038c2ecf20Sopenharmony_ci#define MAADR5 (0x04|0x60|SPRD_MASK) 1048c2ecf20Sopenharmony_ci#define MAADR4 (0x05|0x60|SPRD_MASK) 1058c2ecf20Sopenharmony_ci#define EBSTSD (0x06|0x60) 1068c2ecf20Sopenharmony_ci#define EBSTCON (0x07|0x60) 1078c2ecf20Sopenharmony_ci#define EBSTCSL (0x08|0x60) 1088c2ecf20Sopenharmony_ci#define EBSTCSH (0x09|0x60) 1098c2ecf20Sopenharmony_ci#define MISTAT (0x0A|0x60|SPRD_MASK) 1108c2ecf20Sopenharmony_ci#define EREVID (0x12|0x60) 1118c2ecf20Sopenharmony_ci#define ECOCON (0x15|0x60) 1128c2ecf20Sopenharmony_ci#define EFLOCON (0x17|0x60) 1138c2ecf20Sopenharmony_ci#define EPAUSL (0x18|0x60) 1148c2ecf20Sopenharmony_ci#define EPAUSH (0x19|0x60) 1158c2ecf20Sopenharmony_ci/* PHY registers */ 1168c2ecf20Sopenharmony_ci#define PHCON1 0x00 1178c2ecf20Sopenharmony_ci#define PHSTAT1 0x01 1188c2ecf20Sopenharmony_ci#define PHHID1 0x02 1198c2ecf20Sopenharmony_ci#define PHHID2 0x03 1208c2ecf20Sopenharmony_ci#define PHCON2 0x10 1218c2ecf20Sopenharmony_ci#define PHSTAT2 0x11 1228c2ecf20Sopenharmony_ci#define PHIE 0x12 1238c2ecf20Sopenharmony_ci#define PHIR 0x13 1248c2ecf20Sopenharmony_ci#define PHLCON 0x14 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci/* ENC28J60 EIE Register Bit Definitions */ 1278c2ecf20Sopenharmony_ci#define EIE_INTIE 0x80 1288c2ecf20Sopenharmony_ci#define EIE_PKTIE 0x40 1298c2ecf20Sopenharmony_ci#define EIE_DMAIE 0x20 1308c2ecf20Sopenharmony_ci#define EIE_LINKIE 0x10 1318c2ecf20Sopenharmony_ci#define EIE_TXIE 0x08 1328c2ecf20Sopenharmony_ci/* #define EIE_WOLIE 0x04 (reserved) */ 1338c2ecf20Sopenharmony_ci#define EIE_TXERIE 0x02 1348c2ecf20Sopenharmony_ci#define EIE_RXERIE 0x01 1358c2ecf20Sopenharmony_ci/* ENC28J60 EIR Register Bit Definitions */ 1368c2ecf20Sopenharmony_ci#define EIR_PKTIF 0x40 1378c2ecf20Sopenharmony_ci#define EIR_DMAIF 0x20 1388c2ecf20Sopenharmony_ci#define EIR_LINKIF 0x10 1398c2ecf20Sopenharmony_ci#define EIR_TXIF 0x08 1408c2ecf20Sopenharmony_ci/* #define EIR_WOLIF 0x04 (reserved) */ 1418c2ecf20Sopenharmony_ci#define EIR_TXERIF 0x02 1428c2ecf20Sopenharmony_ci#define EIR_RXERIF 0x01 1438c2ecf20Sopenharmony_ci/* ENC28J60 ESTAT Register Bit Definitions */ 1448c2ecf20Sopenharmony_ci#define ESTAT_INT 0x80 1458c2ecf20Sopenharmony_ci#define ESTAT_LATECOL 0x10 1468c2ecf20Sopenharmony_ci#define ESTAT_RXBUSY 0x04 1478c2ecf20Sopenharmony_ci#define ESTAT_TXABRT 0x02 1488c2ecf20Sopenharmony_ci#define ESTAT_CLKRDY 0x01 1498c2ecf20Sopenharmony_ci/* ENC28J60 ECON2 Register Bit Definitions */ 1508c2ecf20Sopenharmony_ci#define ECON2_AUTOINC 0x80 1518c2ecf20Sopenharmony_ci#define ECON2_PKTDEC 0x40 1528c2ecf20Sopenharmony_ci#define ECON2_PWRSV 0x20 1538c2ecf20Sopenharmony_ci#define ECON2_VRPS 0x08 1548c2ecf20Sopenharmony_ci/* ENC28J60 ECON1 Register Bit Definitions */ 1558c2ecf20Sopenharmony_ci#define ECON1_TXRST 0x80 1568c2ecf20Sopenharmony_ci#define ECON1_RXRST 0x40 1578c2ecf20Sopenharmony_ci#define ECON1_DMAST 0x20 1588c2ecf20Sopenharmony_ci#define ECON1_CSUMEN 0x10 1598c2ecf20Sopenharmony_ci#define ECON1_TXRTS 0x08 1608c2ecf20Sopenharmony_ci#define ECON1_RXEN 0x04 1618c2ecf20Sopenharmony_ci#define ECON1_BSEL1 0x02 1628c2ecf20Sopenharmony_ci#define ECON1_BSEL0 0x01 1638c2ecf20Sopenharmony_ci/* ENC28J60 MACON1 Register Bit Definitions */ 1648c2ecf20Sopenharmony_ci#define MACON1_LOOPBK 0x10 1658c2ecf20Sopenharmony_ci#define MACON1_TXPAUS 0x08 1668c2ecf20Sopenharmony_ci#define MACON1_RXPAUS 0x04 1678c2ecf20Sopenharmony_ci#define MACON1_PASSALL 0x02 1688c2ecf20Sopenharmony_ci#define MACON1_MARXEN 0x01 1698c2ecf20Sopenharmony_ci/* ENC28J60 MACON2 Register Bit Definitions */ 1708c2ecf20Sopenharmony_ci#define MACON2_MARST 0x80 1718c2ecf20Sopenharmony_ci#define MACON2_RNDRST 0x40 1728c2ecf20Sopenharmony_ci#define MACON2_MARXRST 0x08 1738c2ecf20Sopenharmony_ci#define MACON2_RFUNRST 0x04 1748c2ecf20Sopenharmony_ci#define MACON2_MATXRST 0x02 1758c2ecf20Sopenharmony_ci#define MACON2_TFUNRST 0x01 1768c2ecf20Sopenharmony_ci/* ENC28J60 MACON3 Register Bit Definitions */ 1778c2ecf20Sopenharmony_ci#define MACON3_PADCFG2 0x80 1788c2ecf20Sopenharmony_ci#define MACON3_PADCFG1 0x40 1798c2ecf20Sopenharmony_ci#define MACON3_PADCFG0 0x20 1808c2ecf20Sopenharmony_ci#define MACON3_TXCRCEN 0x10 1818c2ecf20Sopenharmony_ci#define MACON3_PHDRLEN 0x08 1828c2ecf20Sopenharmony_ci#define MACON3_HFRMLEN 0x04 1838c2ecf20Sopenharmony_ci#define MACON3_FRMLNEN 0x02 1848c2ecf20Sopenharmony_ci#define MACON3_FULDPX 0x01 1858c2ecf20Sopenharmony_ci/* ENC28J60 MICMD Register Bit Definitions */ 1868c2ecf20Sopenharmony_ci#define MICMD_MIISCAN 0x02 1878c2ecf20Sopenharmony_ci#define MICMD_MIIRD 0x01 1888c2ecf20Sopenharmony_ci/* ENC28J60 MISTAT Register Bit Definitions */ 1898c2ecf20Sopenharmony_ci#define MISTAT_NVALID 0x04 1908c2ecf20Sopenharmony_ci#define MISTAT_SCAN 0x02 1918c2ecf20Sopenharmony_ci#define MISTAT_BUSY 0x01 1928c2ecf20Sopenharmony_ci/* ENC28J60 ERXFCON Register Bit Definitions */ 1938c2ecf20Sopenharmony_ci#define ERXFCON_UCEN 0x80 1948c2ecf20Sopenharmony_ci#define ERXFCON_ANDOR 0x40 1958c2ecf20Sopenharmony_ci#define ERXFCON_CRCEN 0x20 1968c2ecf20Sopenharmony_ci#define ERXFCON_PMEN 0x10 1978c2ecf20Sopenharmony_ci#define ERXFCON_MPEN 0x08 1988c2ecf20Sopenharmony_ci#define ERXFCON_HTEN 0x04 1998c2ecf20Sopenharmony_ci#define ERXFCON_MCEN 0x02 2008c2ecf20Sopenharmony_ci#define ERXFCON_BCEN 0x01 2018c2ecf20Sopenharmony_ci 2028c2ecf20Sopenharmony_ci/* ENC28J60 PHY PHCON1 Register Bit Definitions */ 2038c2ecf20Sopenharmony_ci#define PHCON1_PRST 0x8000 2048c2ecf20Sopenharmony_ci#define PHCON1_PLOOPBK 0x4000 2058c2ecf20Sopenharmony_ci#define PHCON1_PPWRSV 0x0800 2068c2ecf20Sopenharmony_ci#define PHCON1_PDPXMD 0x0100 2078c2ecf20Sopenharmony_ci/* ENC28J60 PHY PHSTAT1 Register Bit Definitions */ 2088c2ecf20Sopenharmony_ci#define PHSTAT1_PFDPX 0x1000 2098c2ecf20Sopenharmony_ci#define PHSTAT1_PHDPX 0x0800 2108c2ecf20Sopenharmony_ci#define PHSTAT1_LLSTAT 0x0004 2118c2ecf20Sopenharmony_ci#define PHSTAT1_JBSTAT 0x0002 2128c2ecf20Sopenharmony_ci/* ENC28J60 PHY PHSTAT2 Register Bit Definitions */ 2138c2ecf20Sopenharmony_ci#define PHSTAT2_TXSTAT (1 << 13) 2148c2ecf20Sopenharmony_ci#define PHSTAT2_RXSTAT (1 << 12) 2158c2ecf20Sopenharmony_ci#define PHSTAT2_COLSTAT (1 << 11) 2168c2ecf20Sopenharmony_ci#define PHSTAT2_LSTAT (1 << 10) 2178c2ecf20Sopenharmony_ci#define PHSTAT2_DPXSTAT (1 << 9) 2188c2ecf20Sopenharmony_ci#define PHSTAT2_PLRITY (1 << 5) 2198c2ecf20Sopenharmony_ci/* ENC28J60 PHY PHCON2 Register Bit Definitions */ 2208c2ecf20Sopenharmony_ci#define PHCON2_FRCLINK 0x4000 2218c2ecf20Sopenharmony_ci#define PHCON2_TXDIS 0x2000 2228c2ecf20Sopenharmony_ci#define PHCON2_JABBER 0x0400 2238c2ecf20Sopenharmony_ci#define PHCON2_HDLDIS 0x0100 2248c2ecf20Sopenharmony_ci/* ENC28J60 PHY PHIE Register Bit Definitions */ 2258c2ecf20Sopenharmony_ci#define PHIE_PLNKIE (1 << 4) 2268c2ecf20Sopenharmony_ci#define PHIE_PGEIE (1 << 1) 2278c2ecf20Sopenharmony_ci/* ENC28J60 PHY PHIR Register Bit Definitions */ 2288c2ecf20Sopenharmony_ci#define PHIR_PLNKIF (1 << 4) 2298c2ecf20Sopenharmony_ci#define PHIR_PGEIF (1 << 1) 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_ci/* ENC28J60 Packet Control Byte Bit Definitions */ 2328c2ecf20Sopenharmony_ci#define PKTCTRL_PHUGEEN 0x08 2338c2ecf20Sopenharmony_ci#define PKTCTRL_PPADEN 0x04 2348c2ecf20Sopenharmony_ci#define PKTCTRL_PCRCEN 0x02 2358c2ecf20Sopenharmony_ci#define PKTCTRL_POVERRIDE 0x01 2368c2ecf20Sopenharmony_ci 2378c2ecf20Sopenharmony_ci/* ENC28J60 Transmit Status Vector */ 2388c2ecf20Sopenharmony_ci#define TSV_TXBYTECNT 0 2398c2ecf20Sopenharmony_ci#define TSV_TXCOLLISIONCNT 16 2408c2ecf20Sopenharmony_ci#define TSV_TXCRCERROR 20 2418c2ecf20Sopenharmony_ci#define TSV_TXLENCHKERROR 21 2428c2ecf20Sopenharmony_ci#define TSV_TXLENOUTOFRANGE 22 2438c2ecf20Sopenharmony_ci#define TSV_TXDONE 23 2448c2ecf20Sopenharmony_ci#define TSV_TXMULTICAST 24 2458c2ecf20Sopenharmony_ci#define TSV_TXBROADCAST 25 2468c2ecf20Sopenharmony_ci#define TSV_TXPACKETDEFER 26 2478c2ecf20Sopenharmony_ci#define TSV_TXEXDEFER 27 2488c2ecf20Sopenharmony_ci#define TSV_TXEXCOLLISION 28 2498c2ecf20Sopenharmony_ci#define TSV_TXLATECOLLISION 29 2508c2ecf20Sopenharmony_ci#define TSV_TXGIANT 30 2518c2ecf20Sopenharmony_ci#define TSV_TXUNDERRUN 31 2528c2ecf20Sopenharmony_ci#define TSV_TOTBYTETXONWIRE 32 2538c2ecf20Sopenharmony_ci#define TSV_TXCONTROLFRAME 48 2548c2ecf20Sopenharmony_ci#define TSV_TXPAUSEFRAME 49 2558c2ecf20Sopenharmony_ci#define TSV_BACKPRESSUREAPP 50 2568c2ecf20Sopenharmony_ci#define TSV_TXVLANTAGFRAME 51 2578c2ecf20Sopenharmony_ci 2588c2ecf20Sopenharmony_ci#define TSV_SIZE 7 2598c2ecf20Sopenharmony_ci#define TSV_BYTEOF(x) ((x) / 8) 2608c2ecf20Sopenharmony_ci#define TSV_BITMASK(x) (1 << ((x) % 8)) 2618c2ecf20Sopenharmony_ci#define TSV_GETBIT(x, y) (((x)[TSV_BYTEOF(y)] & TSV_BITMASK(y)) ? 1 : 0) 2628c2ecf20Sopenharmony_ci 2638c2ecf20Sopenharmony_ci/* ENC28J60 Receive Status Vector */ 2648c2ecf20Sopenharmony_ci#define RSV_RXLONGEVDROPEV 16 2658c2ecf20Sopenharmony_ci#define RSV_CARRIEREV 18 2668c2ecf20Sopenharmony_ci#define RSV_CRCERROR 20 2678c2ecf20Sopenharmony_ci#define RSV_LENCHECKERR 21 2688c2ecf20Sopenharmony_ci#define RSV_LENOUTOFRANGE 22 2698c2ecf20Sopenharmony_ci#define RSV_RXOK 23 2708c2ecf20Sopenharmony_ci#define RSV_RXMULTICAST 24 2718c2ecf20Sopenharmony_ci#define RSV_RXBROADCAST 25 2728c2ecf20Sopenharmony_ci#define RSV_DRIBBLENIBBLE 26 2738c2ecf20Sopenharmony_ci#define RSV_RXCONTROLFRAME 27 2748c2ecf20Sopenharmony_ci#define RSV_RXPAUSEFRAME 28 2758c2ecf20Sopenharmony_ci#define RSV_RXUNKNOWNOPCODE 29 2768c2ecf20Sopenharmony_ci#define RSV_RXTYPEVLAN 30 2778c2ecf20Sopenharmony_ci 2788c2ecf20Sopenharmony_ci#define RSV_SIZE 6 2798c2ecf20Sopenharmony_ci#define RSV_BITMASK(x) (1 << ((x) - 16)) 2808c2ecf20Sopenharmony_ci#define RSV_GETBIT(x, y) (((x) & RSV_BITMASK(y)) ? 1 : 0) 2818c2ecf20Sopenharmony_ci 2828c2ecf20Sopenharmony_ci 2838c2ecf20Sopenharmony_ci/* SPI operation codes */ 2848c2ecf20Sopenharmony_ci#define ENC28J60_READ_CTRL_REG 0x00 2858c2ecf20Sopenharmony_ci#define ENC28J60_READ_BUF_MEM 0x3A 2868c2ecf20Sopenharmony_ci#define ENC28J60_WRITE_CTRL_REG 0x40 2878c2ecf20Sopenharmony_ci#define ENC28J60_WRITE_BUF_MEM 0x7A 2888c2ecf20Sopenharmony_ci#define ENC28J60_BIT_FIELD_SET 0x80 2898c2ecf20Sopenharmony_ci#define ENC28J60_BIT_FIELD_CLR 0xA0 2908c2ecf20Sopenharmony_ci#define ENC28J60_SOFT_RESET 0xFF 2918c2ecf20Sopenharmony_ci 2928c2ecf20Sopenharmony_ci 2938c2ecf20Sopenharmony_ci/* buffer boundaries applied to internal 8K ram 2948c2ecf20Sopenharmony_ci * entire available packet buffer space is allocated. 2958c2ecf20Sopenharmony_ci * Give TX buffer space for one full ethernet frame (~1500 bytes) 2968c2ecf20Sopenharmony_ci * receive buffer gets the rest */ 2978c2ecf20Sopenharmony_ci#define TXSTART_INIT 0x1A00 2988c2ecf20Sopenharmony_ci#define TXEND_INIT 0x1FFF 2998c2ecf20Sopenharmony_ci 3008c2ecf20Sopenharmony_ci/* Put RX buffer at 0 as suggested by the Errata datasheet */ 3018c2ecf20Sopenharmony_ci#define RXSTART_INIT 0x0000 3028c2ecf20Sopenharmony_ci#define RXEND_INIT 0x19FF 3038c2ecf20Sopenharmony_ci 3048c2ecf20Sopenharmony_ci/* maximum ethernet frame length */ 3058c2ecf20Sopenharmony_ci#define MAX_FRAMELEN 1518 3068c2ecf20Sopenharmony_ci 3078c2ecf20Sopenharmony_ci/* Preferred half duplex: LEDA: Link status LEDB: Rx/Tx activity */ 3088c2ecf20Sopenharmony_ci#define ENC28J60_LAMPS_MODE 0x3476 3098c2ecf20Sopenharmony_ci 3108c2ecf20Sopenharmony_ci#endif 311