📄 main.lis
字号:
00EE ; //串口接收处理
00EE ; if (flg_Received )
00EE ; {
00EE ; DoWithUart();
00EE ; }
00EE ; }
00EE ;
00EE ; //read the interrupt status register
00EE ; read_rtl(ISR);
00EE ;
00EE ; //if the receive buffer has been overrun
00EE ; if(byte_read & OVW)
00EE ; overrun();
00EE ;
00EE ; //if the receive buffer holds a good packet
00EE ; if(byte_read & PRX)
00EE ; get_frame();
00EE ;
00EE ; //make sure the receive buffer ring is empty
00EE ; //if BNRY = CURR, the buffer is empty
00EE ; read_rtl(BNRY);
00EE ; data_L = byte_read;
00EE ; write_rtl(CR,0x62);
00EE ; read_rtl(CURR);
00EE ; data_H = byte_read;
00EE ; write_rtl(CR,0x22);
00EE ; //buffer is not empty.. get next packet
00EE ;
00EE ; if(data_L != data_H)
00EE ; get_frame();
00EE ;
00EE ; //reset the interrupt bits
00EE ; write_rtl(ISR,0xFF);
00EE ; */
00EE ; }
00EE L68:
00EE .dbline 102
00EE FACF xjmp L67
00F0 X1:
00F0 .dbline -2
00F0 L16:
00F0 .dbline 0 ; func end
00F0 0895 ret
00F2 .dbend
00F2 .dbfunc e DoWithUart _DoWithUart fV
.even
00F2 _DoWithUart::
00F2 .dbline -1
00F2 .dbline 162
00F2 ;
00F2 ; }
00F2 ;
00F2 ; void DoWithUart(void)
00F2 ; {
00F2 .dbline 163
00F2 ; UART1_Puts("uart in ok");
00F2 00E0 ldi R16,<L73
00F4 10E0 ldi R17,>L73
00F6 0E940000 xcall _UART1_Puts
00FA .dbline 164
00FA ; Delay_nus(5);
00FA 05E0 ldi R16,5
00FC 10E0 ldi R17,0
00FE 0E940000 xcall _Delay_nus
0102 .dbline 168
0102 ;
0102 ; //UdpSendoutStr("12345",5);
0102 ;
0102 ; Delay_nus(5);
0102 05E0 ldi R16,5
0104 10E0 ldi R17,0
0106 0E940000 xcall _Delay_nus
010A .dbline 169
010A ; flg_Received=0;
010A 2224 clr R2
010C 20920000 sts _flg_Received,R2
0110 .dbline -2
0110 L72:
0110 .dbline 0 ; func end
0110 0895 ret
0112 .dbend
.area bss(ram, con, rel)
0000 .dbfile E:\__test\_RTL8019_M128_struct_Test\Main.c
0000 _flg_arp::
0000 .blkb 1
0001 .dbsym e flg_arp _flg_arp c
.area data(ram, con, rel)
0018 .dbfile E:\__test\_RTL8019_M128_struct_Test\Main.c
0018 L73:
0018 .blkb 11
.area idata
0018 7561727420696E206F6B00 .byte 'u,'a,'r,'t,32,'i,'n,32,'o,'k,0
.area data(ram, con, rel)
0023 .dbfile E:\__test\_RTL8019_M128_struct_Test\Main.c
0023 L66:
0023 .blkb 9
.area idata
0023 313233343561626300 .byte 49,50,51,52,53,'a,'b,'c,0
.area data(ram, con, rel)
002C .dbfile E:\__test\_RTL8019_M128_struct_Test\Main.c
002C L65:
002C .blkb 16
.area idata
002C 57616E20747374203038303132334200 .byte 'W,'a,'n,32,'t,'s,'t,32,48,56,48,49,50,51,'B,0
.area data(ram, con, rel)
003C .dbfile E:\__test\_RTL8019_M128_struct_Test\Main.c
003C ; }
003C ;
003C ;
003C ; /*
003C ; void sendarp()
003C ; {
003C ; packet[enetpacketDest0+0] = 0xff;
003C ; packet[enetpacketDest0+1] = 0xff;
003C ; packet[enetpacketDest0+2] = 0xff;
003C ; packet[enetpacketDest0+3] = 0xff;
003C ; packet[enetpacketDest0+4] = 0xff;
003C ; packet[enetpacketDest0+5] = 0xff;
003C ;
003C ; packet[enetpacketSrc0+0] = MY_MAC[0];
003C ; packet[enetpacketSrc0+1] = MY_MAC[1];
003C ; packet[enetpacketSrc0+2] = MY_MAC[2];
003C ; packet[enetpacketSrc0+3] = MY_MAC[3];
003C ; packet[enetpacketSrc0+4] = MY_MAC[4];
003C ; packet[enetpacketSrc0+5] = MY_MAC[5];
003C ;
003C ; packet[enetpacketType0]=0x08;
003C ; packet[enetpacketType1]=0x06;
003C ;
003C ; packet[arp_hwtype+0] =0x00;
003C ; packet[arp_hwtype+1] =0x01;
003C ; packet[arp_prtype] =0x08;
003C ; packet[arp_prtype+1] =0x00;
003C ; packet[arp_hwlen] =0x06;
003C ; packet[arp_prlen] =0x04;
003C ; packet[arp_op] =0x00;
003C ; packet[arp_op+1] =0x01;
003C ;
003C ; packet[arp_shaddr+0] = MY_MAC[0];
003C ; packet[arp_shaddr+1] = MY_MAC[1];
003C ; packet[arp_shaddr+2] = MY_MAC[2];
003C ; packet[arp_shaddr+3] = MY_MAC[3];
003C ; packet[arp_shaddr+4] = MY_MAC[4];
003C ; packet[arp_shaddr+5] = MY_MAC[5];
003C ;
003C ; packet[arp_sipaddr+0] =MY_IP[0];
003C ; packet[arp_sipaddr+1] =MY_IP[1];
003C ; packet[arp_sipaddr+2] =MY_IP[2];
003C ; packet[arp_sipaddr+3] =MY_IP[3];
003C ;
003C ; packet[arp_thaddr+0] = 0xff;
003C ; packet[arp_thaddr+1] = 0xff;
003C ; packet[arp_thaddr+2] = 0xff;
003C ; packet[arp_thaddr+3] = 0xff;
003C ; packet[arp_thaddr+4] = 0xff;
003C ; packet[arp_thaddr+5] = 0xff;
003C ;
003C ; packet[arp_tipaddr+0] =0xc0;
003C ; packet[arp_tipaddr+1] =0xa8;
003C ; packet[arp_tipaddr+2] =0x01;
003C ; packet[arp_tipaddr+3] =0xa0;
003C ;
003C ; for (i=0;i<0x12;i++)
003C ; packet[arp_tipaddr+4+i] =0x0;
003C ;
003C ; arpreq();
003C ; }
003C ;
003C ; void arpreq()
003C ; {
003C ; //start the NIC
003C ; write_rtl(CR,0x22);
003C ;
003C ; //load beginning page for transmit buffer
003C ; write_rtl(TPSR,txstart);
003C ;
003C ; //set start address for remote DMA operation
003C ; write_rtl(RSAR0,0x00);
003C ; write_rtl(RSAR1,0x40);
003C ;
003C ; //clear the Interrupts
003C ; write_rtl(ISR,0xFF);
003C ;
003C ; //load data byte count for remote DMA
003C ; write_rtl(RBCR0,0x3C);
003C ; write_rtl(RBCR1,0x00);
003C ;
003C ; //do remote write operation
003C ; write_rtl(CR,0x12);
003C ;
003C ; //write packet
003C ; for(i=0;i<60;++i)
003C ; //write_rtl(RDMAPORT,packet[enetpacketDest0+i]);
003C ; write_rtl(RDMAPORT,packet[i]);
003C ;
003C ; //make sure the DMA operation has successfully completed
003C ; byte_read = 0;
003C ; while(!(byte_read & RDC))
003C ; read_rtl(ISR);
003C ;
003C ; //***UART1_PutBytes((unsigned char *)&packet, 60);
003C ; //udpsendoutstr((unsigned char *)&packet, 60);
003C ; //udpsendoutstr("arp out", 7);
003C ;
003C ; //load number of bytes to be transmitted
003C ; write_rtl(TBCR0,0x3C);
003C ; write_rtl(TBCR1,0x00);
003C ;
003C ; //send the contents of the transmit buffer onto the network
003C ; write_rtl(CR,0x24);
003C ; }
003C ;
003C ; //******************************************************************
003C ; //* Write to NIC Control Register
003C ; //******************************************************************
003C ; void write_rtl(unsigned int regaddr, unsigned int regdata)
003C ; {
003C ; rtladdr = regaddr;
003C ; rtldata = regdata;
003C ; tortl;
003C ; nop;
003C ; clr_iow_pin;
003C ; nop;
003C ; set_iow_pin;
003C ; nop;
003C ; fromrtl;
003C ; PORTA = 0xFF;
003C ; }
003C ;
003C ; //******************************************************************
003C ; //* Read From NIC Control Register
003C ; //******************************************************************
003C ; void read_rtl(unsigned int regaddr)
003C ; {
003C ; fromrtl;
003C ; PORTA = 0xFF;
003C ; rtladdr = regaddr;
003C ; clr_ior_pin;
003C ; nop;
003C ; byte_read = PINA;
003C ; nop;
003C ; set_ior_pin;
003C ; nop;
003C ; }
003C ;
003C ; //******************************************************************
003C ; //* Handle Receive Ring Buffer Overrun
003C ; //* No packets are recovered
003C ; //******************************************************************
003C ; void overrun()
003C ; {
003C ; read_rtl(CR);
003C ; data_L = byte_read;
003C ; write_rtl(CR,0x21);
003C ; delay_ms(2);
003C ; write_rtl(RBCR0,0x00);
003C ; write_rtl(RBCR1,0x00);
003C ; if(!(data_L & 0x04))
003C ; resend = 0;
003C ; else if(data_L & 0x04)
003C ; {
003C ; read_rtl(ISR);
003C ; data_L = byte_read;
003C ; if((data_L & 0x02) || (data_L & 0x08))
003C ; resend = 0;
003C ; else
003C ; resend = 1;
003C ; }
003C ;
003C ; write_rtl(TCR,0x02);
003C ; write_rtl(CR,0x22);
003C ; write_rtl(BNRY,rxstart);
003C ; write_rtl(CR,0x62);
003C ; write_rtl(CURR,rxstart);
003C ; write_rtl(CR,0x22);
003C ; write_rtl(ISR,0x10);
003C ; write_rtl(TCR,tcrval);
003C ; }
003C ;
003C ; //******************************************************************
003C ; //* Echo Packet Function
003C ; //* This routine does not modify the incoming packet size and
003C ; //* thus echoes the original packet structure.
003C ; //******************************************************************
003C ; void SendNetPacket()
003C ; {
003C ; write_rtl(CR,0x22);
003C ; write_rtl(TPSR,txstart);
003C ; write_rtl(RSAR0,0x00);
003C ; write_rtl(RSAR1,0x40);
003C ; write_rtl(ISR,0xFF);
003C ; write_rtl(RBCR0,pageheader[enetpacketLenL] - 4 );
003C ; write_rtl(RBCR1,pageheader[enetpacketLenH]);
003C ; write_rtl(CR,0x12);
003C ;
003C ; txlen = make16(pageheader[enetpacketLenH],pageheader[enetpacketLenL]) - 4;
003C ; for(i=0;i<txlen;++i)
003C ; write_rtl(RDMAPORT,packet[enetpacketDest0+i]);
003C ;
003C ; byte_read = 0;
003C ; while(!(byte_read & RDC))
003C ; read_rtl(ISR);
003C ;
003C ; write_rtl(TBCR0,pageheader[enetpacketLenL] - 4);
003C ; write_rtl(TBCR1,pageheader[enetpacketLenH]);
003C ; write_rtl(CR,0x24);
003C ; }
003C ;
003C ; //******************************************************************
003C ; //* 功能:从以太网络取得数据包 ()
003C ; //* 包括UDP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -