📄 rtl8019.h
字号:
/*------------------------------------------------------------------------ . rtl8019.h - macros for the RTL8019AS Ethernet Driver . . (C) Copyright 2003
. TCE Inc., Changzhou China
. lu weixi <lu_weixi@163.com> ---------------------------------------------------------------------------*/#ifndef _RTL8019_H_#define _RTL8019_H_#include "types.h"#include "config.h"/* * This function may be called by the board specific initialisation code * in order to override the default mac address. */void rtl_set_mac_addr(const unsigned char *addr);typedef unsigned char byte;static byte RTL_inb( unsigned int regxx ){ byte regvalue,*pt; pt = (byte*)(RTL_BASE_ADDRESS + regxx); regvalue = *pt; return(regvalue);}static void RTL_outb(byte regvalue , unsigned int regxx){ byte *pt; pt = (byte*)(RTL_BASE_ADDRESS + regxx); *pt = regvalue;}/* select a register bank, 0 to 3 */#define RTL_SELECT_BANK(x) {\ byte temp;\ temp = RTL_inb(0);\ temp = (temp&0x03b)|(x<<6);\ RTL_outb(temp,0);\}/* RTL8019*/ #define RWPORT (0x10) /* dma read write address, form 0x10 - 0x17 */
#define RstAddr (0x18) /* reset register, 0x18, 0x1a, 0x1c, 0x1e even address is recommanded */
/* page 0 */#define RCPORT (0)
#define Pstart (1) /* page start */
#define Pstop (2) /* page stop */
#define BNRY (3)
#define TPSR (4) /* transmit page start */
#define TBCR0 (5)
#define TBCR1 (6)
#define ISR (7) /* interrupt status register */
#define RSAR0 (8) /* dma read address */
#define RSAR1 (9)
#define RBCR0 (10) /* dma read byte count */
#define RBCR1 (11)
#define RCR (12) /* receive config */
#define TCR (13) /* transmit config */
#define DCR (14) /* data config */
#define IMR (15) /* interrupt mask */
#define ID8019L (10)
#define ID8019H (11)
/* page 1 */
#define PAR0 (1)
#define PAR1 (2)
#define PAR2 (3)
#define PAR3 (4)
#define PAR4 (5)
#define PAR6 (6)
#define CURR (7)
#define MAR0 (8)
#define MAR1 (9)
#define MAR2 (10)
#define MAR3 (11)
#define MAR4 (12)
#define MAR5 (13)
#define MAR6 (14)
#define MAR7 (15)
/* page 2 */
/* page 3 */
#define CR9346 (1)
#define CONFIG0 (3)
#define CONFIG1 (4)
#define CONFIG2 (5)
#define CONFIG3 (6)
/* * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble * and FCS/CRC (frame check sequence). */#define ETH_ALEN 6 /* Octets in one ethernet addr */#define ETH_HLEN 14 /* Total octets in header. */#define ETH_ZLEN 60 /* Min. octets in frame sans FCS */#define ETH_DATA_LEN 1500 /* Max. octets in payload */#define ETH_FRAME_LEN 1514 /* Max. octets in frame sans FCS *//* * These are the defined Ethernet Protocol ID's. */#define ETH_P_LOOP 0x0060 /* Ethernet Loopback packet */#define ETH_P_ECHO 0x0200 /* Ethernet Echo packet */#define ETH_P_PUP 0x0400 /* Xerox PUP packet */#define ETH_P_IP 0x0800 /* Internet Protocol packet */#define ETH_P_X25 0x0805 /* CCITT X.25 */#define ETH_P_ARP 0x0806 /* Address Resolution packet */#define ETH_P_BPQ 0x08FF /* G8BPQ AX.25 Ethernet Packet [ NOT AN OFFICIALLY REGISTERED ID ] */#define ETH_P_DEC 0x6000 /* DEC Assigned proto */#define ETH_P_DNA_DL 0x6001 /* DEC DNA Dump/Load */#define ETH_P_DNA_RC 0x6002 /* DEC DNA Remote Console */#define ETH_P_DNA_RT 0x6003 /* DEC DNA Routing */#define ETH_P_LAT 0x6004 /* DEC LAT */#define ETH_P_DIAG 0x6005 /* DEC Diagnostics */#define ETH_P_CUST 0x6006 /* DEC Customer use */#define ETH_P_SCA 0x6007 /* DEC Systems Comms Arch */#define ETH_P_RARP 0x8035 /* Reverse Addr Res packet */#define ETH_P_ATALK 0x809B /* Appletalk DDP */#define ETH_P_AARP 0x80F3 /* Appletalk AARP */#define ETH_P_IPX 0x8137 /* IPX over DIX */#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */
// Receive status bits#define RS_ALGNERR 0x8000#define RS_BRODCAST 0x4000#define RS_BADCRC 0x2000#define RS_ODDFRAME 0x1000 #define RS_TOOLONG 0x0800#define RS_TOOSHORT 0x0400#define RS_MULTICAST 0x0001#define RS_ERRORS (RS_ALGNERR | RS_BADCRC | RS_TOOLONG | RS_TOOSHORT) #endif /* _RTL8019_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -