⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rtl8019.h

📁 s3c44b0+sl811读写u盘程序
💻 H
字号:
/*
#define		Reg00		port2000
#define		Reg01		port2001
#define		Reg02		port2002
#define		Reg03		port2003
#define		Reg04		port2004
#define		Reg05		port2005
#define		Reg06		port2006
#define		Reg07		port2007
#define		Reg08		port2008
#define		Reg09		port2009
#define		Reg0a		port200a
#define		Reg0b		port200b
#define		Reg0c		port200c
#define		Reg0d		port200d
#define		Reg0e		port200e
#define		Reg0f		port200f
#define		Reg10		port2010

ioport		Uint16		Reg00;
ioport		Uint16		Reg01;
ioport		Uint16		Reg02;
ioport		Uint16		Reg03;
ioport		Uint16		Reg04;
ioport		Uint16		Reg05;
ioport		Uint16		Reg06;
ioport		Uint16		Reg07;
ioport		Uint16		Reg08;
ioport		Uint16		Reg09;
ioport		Uint16		Reg0a;
ioport		Uint16		Reg0b;
ioport		Uint16		Reg0c;
ioport		Uint16		Reg0d;
ioport		Uint16		Reg0e;
ioport		Uint16		Reg0f;
ioport		Uint16		Reg10;
*/

#define RTL8019_Base	0x06000000//Bank3 0x06000000~0x08000000
#define	Reg00	(*(volatile unsigned char*)(RTL8019_Base+0x00))
#define	Reg01	(*(volatile unsigned char*)(RTL8019_Base+0x01))
#define	Reg02	(*(volatile unsigned char*)(RTL8019_Base+0x02))
#define	Reg03	(*(volatile unsigned char*)(RTL8019_Base+0x03))
#define	Reg04	(*(volatile unsigned char*)(RTL8019_Base+0x04))
#define	Reg05	(*(volatile unsigned char*)(RTL8019_Base+0x05))
#define	Reg06	(*(volatile unsigned char*)(RTL8019_Base+0x06))
#define	Reg07	(*(volatile unsigned char*)(RTL8019_Base+0x07))
#define	Reg08	(*(volatile unsigned char*)(RTL8019_Base+0x08))
#define	Reg09	(*(volatile unsigned char*)(RTL8019_Base+0x09))
#define	Reg0a	(*(volatile unsigned char*)(RTL8019_Base+0x0a))
#define	Reg0b	(*(volatile unsigned char*)(RTL8019_Base+0x0b))
#define	Reg0c	(*(volatile unsigned char*)(RTL8019_Base+0x0c))
#define	Reg0d	(*(volatile unsigned char*)(RTL8019_Base+0x0d))
#define	Reg0e	(*(volatile unsigned char*)(RTL8019_Base+0x0e))
#define	Reg0f	(*(volatile unsigned char*)(RTL8019_Base+0x0f))
#define	Reg10	(*(volatile unsigned char*)(RTL8019_Base+0x10))

#define 	BroadCast     1
#define 	RequestArp    2
#define		AnswerArp	  3
#define 	Nod           4
#define 	ARP	    	  1
#define 	UDP     	  2
#define 	IGMP    	  3
#define 	LSS           4
#define		TCP			  5
#define		ICMP		  6

#define		IP_FRAME	0X0800
#define		ARP_FRAME	0X0806
#define MY_TCP_PORT    	     1024
#define MY_UDP_PORT  	     1025

#define ETH_HEADER_START     0
#define IP_HEADER_START      7
#define ARP_HEADER_START     7
#define TCP_HEADER_START     17
#define UDP_HEADER_START     17
#define ICMP_HEADER_START    17
#define USER_DATA_START      27

#define RTL8019_HEADER_SIZE  2 
#define ETH_HEADER_SIZE      7
#define IP_HEADER_SIZE       10
#define TCP_HEADER_SIZE      10
#define UDP_HEADER_SIZE      4
#define ARP_FRAME_SIZE       14
#define ICMP_HEADER_SIZE     2
#define DUMMY_HEADER_SIZE    6
#define MY_MAX_SEG_SIZE      1460

#define Frame_ARP            0x0806
#define Frame_IP             0x0800
#define Ip_Edition           0x4500              //Ip 版本和IP首部长度
#define DEFUALT_TTL          128
#define ICMP_ECHO            8
#define ICMP_ECHO_REPLY      0
//ARP

#define HARDW_ETH            1
#define IP_HLEN_PLEN         0x0604
#define OP_ARP_REQUEST       1
#define OP_ARP_ANSWER        2

#define PROTOCOL_ICMP        1
#define PROTOCOL_TCP         6
#define PROTOCOL_UDP         17

/////TCP define

#define TCP_MAX_RE_TXDNUM    8

#define TCP_CODE_FIN         0x0001
#define TCP_CODE_SYN         0x0002
#define TCP_CODE_RST         0x0004
#define TCP_CODE_PSH         0x0008
#define TCP_CODE_ACK         0x0010
#define TCP_CODE_URG         0x0020

#define 	TCP_STATE_LISTEN        0
#define 	TCP_STATE_SYN_RCVD      1
#define 	TCP_STATE_SYN_SENT      2
#define 	TCP_STATE_ESTABLISHED   3
#define 	TCP_STATE_FIN_WAIT1     4
#define 	TCP_STATE_FIN_WAIT2     5
#define 	TCP_STATE_CLOSING       6
#define 	TCP_STATE_CLOSE_WAIT    7
#define 	TCP_STATE_LAST_ACK      8
#define 	TCP_STATE_CLOSED        9
#define 	TCP_STATE_TIME_WAIT     10

typedef	unsigned	int		Uint16;
typedef	unsigned	long	Uint32;

extern	void	SendFrame(Uint16 *buf,Uint16	len);
extern	Uint16	SwapByte(Uint16	value);

struct	ipaddr
		{
  			Uint16 	addr2_1;
  			Uint16	addr4_3;	
		};
struct 	mac
		{
  			Uint16	addr2_1;
  			Uint16	addr4_3;
  			Uint16 	addr6_5;
		};

struct 	iphdr
		{
  			Uint16  tos_version;
  			Uint16 	tol_len;
  			Uint16 	id;
  			Uint16	frag_off;
  			Uint16 	protocal_ttl;
  			Uint16	chksum;
  			struct 	ipaddr saddr;
  			struct 	ipaddr daddr;
		};
struct 	udphdr
		{
  			Uint16 	sport;
  			Uint16 	dport;
  			Uint16 	length;
  			Uint16 	chksum;
		};

struct 	igmphdr
		{
  			Uint16	type_mrt;
  			Uint16  chksum;
  			struct  ipaddr groupaddr;
		};
struct 	pre_udphdr
		{
  			struct 	ipaddr saddr;
  			struct 	ipaddr daddr;
  			Uint16	protocal_value;
  			Uint16  length;
};
struct 	arp
		{
  			Uint16	hard_type;				//硬件类型		
  			Uint16 	proto_type;				//协议类型
  			Uint16 	proto_hard_length;		//硬件及协议地址长度
  			Uint16 	op_code;				//操作字段
  			struct 	mac    send_macaddr;	//发送端以太网地址	
  			struct 	ipaddr send_ipaddr;		//发送断IP地址
  			struct 	mac    rec_macaddr;		//接收端以太网地址
  			struct 	ipaddr rec_ipaddr;		//接收端IP地址
};



//========================== end ==========================

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -