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

📄 main.s

📁 网卡驱动程序
💻 S
📖 第 1 页 / 共 2 页
字号:
; 	     //串口接收处理
;          if (flg_Received )   
; 	     {
; 	        DoWithUart();	  
; 	     }   
; 	  }
; 
;       //read the interrupt status register
;       read_rtl(ISR);
; 
;       //if the receive buffer has been overrun
;       if(byte_read & OVW)
;          overrun();
; 
;       //if the receive buffer holds a good packet
;       if(byte_read & PRX)
;          get_frame();
; 
;       //make sure the receive buffer ring is empty
;       //if BNRY = CURR, the buffer is empty
;          read_rtl(BNRY);
;          data_L = byte_read;
;          write_rtl(CR,0x62);
;          read_rtl(CURR);
;          data_H = byte_read;
;          write_rtl(CR,0x22);
;       //buffer is not empty.. get next packet
; 	  
;          if(data_L != data_H)
;             get_frame();
; 
;       //reset the interrupt bits
;       write_rtl(ISR,0xFF);	 
; 	  */ 
;    }
L68:
	.dbline 102
	xjmp L67
X1:
	.dbline -2
L16:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e DoWithUart _DoWithUart fV
	.even
_DoWithUart::
	.dbline -1
	.dbline 162
; 
; }
; 
; void DoWithUart(void)
; {
	.dbline 163
;    UART1_Puts("uart in ok");
	ldi R16,<L73
	ldi R17,>L73
	xcall _UART1_Puts
	.dbline 164
;    Delay_nus(5);   
	ldi R16,5
	ldi R17,0
	xcall _Delay_nus
	.dbline 168
;   
;    //UdpSendoutStr("12345",5);
; 		 
;    Delay_nus(5);   
	ldi R16,5
	ldi R17,0
	xcall _Delay_nus
	.dbline 169
;    flg_Received=0;   
	clr R2
	sts _flg_Received,R2
	.dbline -2
L72:
	.dbline 0 ; func end
	ret
	.dbend
	.area bss(ram, con, rel)
	.dbfile E:\__test\_RTL8019_M128_struct_Test\Main.c
_flg_arp::
	.blkb 1
	.dbsym e flg_arp _flg_arp c
	.area data(ram, con, rel)
	.dbfile E:\__test\_RTL8019_M128_struct_Test\Main.c
L73:
	.blkb 11
	.area idata
	.byte 'u,'a,'r,'t,32,'i,'n,32,'o,'k,0
	.area data(ram, con, rel)
	.dbfile E:\__test\_RTL8019_M128_struct_Test\Main.c
L66:
	.blkb 9
	.area idata
	.byte 49,50,51,52,53,'a,'b,'c,0
	.area data(ram, con, rel)
	.dbfile E:\__test\_RTL8019_M128_struct_Test\Main.c
L65:
	.blkb 16
	.area idata
	.byte 'W,'a,'n,32,'t,'s,'t,32,48,56,48,49,50,51,'B,0
	.area data(ram, con, rel)
	.dbfile E:\__test\_RTL8019_M128_struct_Test\Main.c
; }
; 
; 
; /*
; 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);
; }
;  
; //******************************************************************
; //*	Write to NIC Control Register
; //******************************************************************
; void write_rtl(unsigned int regaddr, unsigned int regdata)
; {
;     rtladdr = regaddr;
;     rtldata = regdata;
;     tortl;
; 	nop;
;     clr_iow_pin;
; 	nop;
;     set_iow_pin;
; 	nop;
;     fromrtl;
; 	PORTA = 0xFF; 
; }
; 
; //******************************************************************
; //*	Read From NIC Control Register
; //******************************************************************
; void read_rtl(unsigned int regaddr)
; {
;    fromrtl;
;    PORTA = 0xFF; 
;    rtladdr = regaddr;
;    clr_ior_pin;
;    nop;
;    byte_read = PINA;
;    nop;
;    set_ior_pin;
;    nop;   
; }
; 
; //******************************************************************
; //*	Handle Receive Ring Buffer Overrun
; //*   No packets are recovered
; //******************************************************************
; void overrun()
; {
;    read_rtl(CR);
;    data_L = byte_read;
;    write_rtl(CR,0x21);
;    delay_ms(2);
;    write_rtl(RBCR0,0x00);
;    write_rtl(RBCR1,0x00);
;    if(!(data_L & 0x04))
;       resend = 0;
;    else if(data_L & 0x04)
;       {
;          read_rtl(ISR);
;          data_L = byte_read;
;          if((data_L & 0x02) || (data_L & 0x08))
;             resend = 0;
;          else
;             resend = 1;
;       }
; 
;    write_rtl(TCR,0x02);
;    write_rtl(CR,0x22);
;    write_rtl(BNRY,rxstart);
;    write_rtl(CR,0x62);
;    write_rtl(CURR,rxstart);
;    write_rtl(CR,0x22);
;    write_rtl(ISR,0x10);
;    write_rtl(TCR,tcrval);
; }
; 
; //******************************************************************
; //*	Echo Packet Function
; //*   This routine does not modify the incoming packet size and
; //*   thus echoes the original packet structure.
; //******************************************************************
; void SendNetPacket()
; {
;    write_rtl(CR,0x22);
;    write_rtl(TPSR,txstart);
;    write_rtl(RSAR0,0x00);
;    write_rtl(RSAR1,0x40);
;    write_rtl(ISR,0xFF);
;    write_rtl(RBCR0,pageheader[enetpacketLenL] - 4 );
;    write_rtl(RBCR1,pageheader[enetpacketLenH]);
;    write_rtl(CR,0x12);
; 
;    txlen = make16(pageheader[enetpacketLenH],pageheader[enetpacketLenL]) - 4;
;    for(i=0;i<txlen;++i)
;       write_rtl(RDMAPORT,packet[enetpacketDest0+i]);
; 
;    byte_read = 0;
;    while(!(byte_read & RDC))
;       read_rtl(ISR);
; 
;    write_rtl(TBCR0,pageheader[enetpacketLenL] - 4);
;    write_rtl(TBCR1,pageheader[enetpacketLenH]);
;    write_rtl(CR,0x24);   
; }
; 
; //******************************************************************
; //*	功能:从以太网络取得数据包 ()
; //* 包括UDP

⌨️ 快捷键说明

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