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

📄 8019.h.svn-base

📁 数字广播系统的开发源码
💻 SVN-BASE
字号:
#ifndef _8019_H
#define _8019_H

#define	ETH_ADDRESS_LEN	6

#define RTLBaseAddr 0x8000

/* Protocol Constants	*/

#define	ETH_HEADER_LEN		14
#define ETH_CHIP_HEADER_LEN	4
#define	ETH_MTU				1500

#define	PROTOCOL_IP		0x0800			/**< IP over Ethernet	*/
#define   PROTOCOL_ARP		0x0806			/**< ARP over Ethernet 	*/

/* Buffer addresses */  //change by xmr
#define   RXBUF_START	0x4D	/**< 3328 byte Rx Buffer 	 	 */
#define	RXBUF_END	0x80	/**< (2 max packets	   		 */
#define	ARP_BUFFER	0x40	/**< 256 byte Tx for ARP 		 */
#define	ICMP_BUF	0x4D	/**< 1536 byte Tx for ICMP	 */
#define	TCP_BUF	0x53	/**< 1536 byte Tx for TCP		 */
#define	UDP_BUF	0x59	/**< 1536 byte Tx for UDP		 */


struct ethernet
{
 unsigned char status;          //接收状态
 unsigned char nextpage;        //下一页
 unsigned char length;          //以太网长度,以字节为单位
 unsigned char destnodeid[3];   //Dst Address
 unsigned char sourcenodeid[3]; //Src Address
 unsigned char protocal;        //下层协议
 unsigned char packet[1500];    //
};

struct ethernet_frame
{
	unsigned char destination[ETH_ADDRESS_LEN];	/**destination hardware address */
	unsigned char source[ETH_ADDRESS_LEN];		/**source hardware address*/
	unsigned int frame_size;			/** size of the receive	 Ethernet packet*/
	unsigned int protocol;				/**< protocol field:IP	- 0x0800;ARP - 0x0806*/
	unsigned int buf_index;				/**< Address in the Ethernet*/

};


/* reset port */
#define RESET_PORT (ADDRESS_SHIFT * 0x1F) /* any of 0x18 - 0x1F. write to this port reset the rtl8019 */

/* phisical adress(MAC address) register */
#define PRA0_WPAGE1	(ADDRESS_SHIFT * 0x01)
#define PRA1_WPAGE1	(ADDRESS_SHIFT * 0x02)
#define PRA2_WPAGE1	(ADDRESS_SHIFT * 0x03)
#define PRA3_WPAGE1	(ADDRESS_SHIFT * 0x04)
#define PRA4_WPAGE1	(ADDRESS_SHIFT * 0x05)
#define PRA5_WPAGE1	(ADDRESS_SHIFT * 0x06)

/*	RTL config register 1
	bit7: IRQEN:set IRQ low level enable or high level enable
	bit6-4: IRQS2-0: which IRQ pins is selected as interrupt
	bit3-0: which base address is selected */
#define CONFIG1_RPAGE3 (ADDRESS_SHIFT * 0x04)
#define CONFIG1_WPAGE3 (ADDRESS_SHIFT * 0x04)

void RTL8019Init(unsigned char *MACAddr) reentrant;
unsigned char RTLSendPacket(unsigned char xdata * buffer,unsigned int size) reentrant;
struct SMemHead xdata * RTLReceivePacket() reentrant;
unsigned char ReadReg(unsigned char chPort) reentrant;
//void WriteReg(unsigned char chPort,unsigned char chValue) reentrant;
void RTLPage(unsigned char chPageNum) reentrant;
void RTL8019SendPacketTest();
void RTL8019RegTest();

#endif // _8019_H

⌨️ 快捷键说明

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