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

📄 rtl8019as_arp_m128.c

📁 网卡驱动程序
💻 C
字号:
#include "Rtl8019as_Arp_M128.h"

/*
void sendarp()
{ 
packet[enetpacketDest0+0] = 0xff; 
packet[enetpacketDest0+1] = 0xff; 
packet[enetpacketDest0+2] = 0xff; 
packet[enetpacketDest0+3] = 0xff;   
packet[enetpacketDest0+4] = 0xff; 
packet[enetpacketDest0+5] = 0xff;  

packet[enetpacketSrc0+0] = MY_MAC[0]; 
packet[enetpacketSrc0+1] = MY_MAC[1];
packet[enetpacketSrc0+2] = MY_MAC[2]; 
packet[enetpacketSrc0+3] = MY_MAC[3]; 
packet[enetpacketSrc0+4] = MY_MAC[4];
packet[enetpacketSrc0+5] = MY_MAC[5]; 

packet[enetpacketType0]=0x08;
packet[enetpacketType1]=0x06;

packet[arp_hwtype+0] =0x00;   
packet[arp_hwtype+1] =0x01;   
packet[arp_prtype] =0x08;   
packet[arp_prtype+1] =0x00;   
packet[arp_hwlen] =0x06;   
packet[arp_prlen] =0x04; 
packet[arp_op] =0x00; 
packet[arp_op+1] =0x01; 

packet[arp_shaddr+0] = MY_MAC[0]; 
packet[arp_shaddr+1] = MY_MAC[1];
packet[arp_shaddr+2] = MY_MAC[2]; 
packet[arp_shaddr+3] = MY_MAC[3]; 
packet[arp_shaddr+4] = MY_MAC[4];
packet[arp_shaddr+5] = MY_MAC[5]; 

packet[arp_sipaddr+0] =MY_IP[0];   
packet[arp_sipaddr+1] =MY_IP[1];   
packet[arp_sipaddr+2] =MY_IP[2];   
packet[arp_sipaddr+3] =MY_IP[3];  

packet[arp_thaddr+0] = 0xff; 
packet[arp_thaddr+1] = 0xff;  
packet[arp_thaddr+2] = 0xff; 
packet[arp_thaddr+3] = 0xff;  
packet[arp_thaddr+4] = 0xff; 
packet[arp_thaddr+5] = 0xff;

packet[arp_tipaddr+0] =0xc0;   
packet[arp_tipaddr+1] =0xa8;   
packet[arp_tipaddr+2] =0x01;   
packet[arp_tipaddr+3] =0xa0;  

for (i=0;i<0x12;i++) 
   packet[arp_tipaddr+4+i] =0x0;  

arpreq(); 
}

void arpreq()
{
   //start the NIC
   write_rtl(CR,0x22);

   //load beginning page for transmit buffer
   write_rtl(TPSR,txstart);

   //set start address for remote DMA operation
   write_rtl(RSAR0,0x00);
   write_rtl(RSAR1,0x40);

   //clear the Interrupts
   write_rtl(ISR,0xFF);

   //load data byte count for remote DMA
   write_rtl(RBCR0,0x3C);
   write_rtl(RBCR1,0x00);

   //do remote write operation
   write_rtl(CR,0x12);

   //write packet
   for(i=0;i<60;++i)
      //write_rtl(RDMAPORT,packet[enetpacketDest0+i]);
      write_rtl(RDMAPORT,packet[i]);

   //make sure the DMA operation has successfully completed
   byte_read = 0;
   while(!(byte_read & RDC))
       	 read_rtl(ISR);  

//***UART1_PutBytes((unsigned char *)&packet, 60);
//udpsendoutstr((unsigned char *)&packet, 60);
//udpsendoutstr("arp out", 7);
		 
   //load number of bytes to be transmitted
   write_rtl(TBCR0,0x3C);
   write_rtl(TBCR1,0x00);

   //send the contents of the transmit buffer onto the network
   write_rtl(CR,0x24);
}

*/

⌨️ 快捷键说明

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