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

📄 main.s

📁 网卡驱动程序
💻 S
📖 第 1 页 / 共 2 页
字号:
	.module Main.c
	.area text(rom, con, rel)
	.dbfile E:\__test\_RTL8019_M128_struct_Test\Main.c
	.area data(ram, con, rel)
	.dbfile E:\__test\_RTL8019_M128_struct_Test\Main.c
_MY_IP::
	.blkb 2
	.area idata
	.byte 192,168
	.area data(ram, con, rel)
	.dbfile E:\__test\_RTL8019_M128_struct_Test\Main.c
	.blkb 2
	.area idata
	.byte 1,201
	.area data(ram, con, rel)
	.dbfile E:\__test\_RTL8019_M128_struct_Test\Main.c
	.dbsym e MY_IP _MY_IP A[4:4]c
_MY_PORT::
	.blkb 2
	.area idata
	.byte 35,40
	.area data(ram, con, rel)
	.dbfile E:\__test\_RTL8019_M128_struct_Test\Main.c
	.dbsym e MY_PORT _MY_PORT A[2:2]c
_MY_MAC::
	.blkb 2
	.area idata
	.byte 0,0
	.area data(ram, con, rel)
	.dbfile E:\__test\_RTL8019_M128_struct_Test\Main.c
	.blkb 2
	.area idata
	.byte 'a,'b
	.area data(ram, con, rel)
	.dbfile E:\__test\_RTL8019_M128_struct_Test\Main.c
	.blkb 2
	.area idata
	.byte 'c,'d
	.area data(ram, con, rel)
	.dbfile E:\__test\_RTL8019_M128_struct_Test\Main.c
	.dbsym e MY_MAC _MY_MAC A[6:6]c
_REMOTE_IP::
	.blkb 2
	.area idata
	.byte 192,168
	.area data(ram, con, rel)
	.dbfile E:\__test\_RTL8019_M128_struct_Test\Main.c
	.blkb 2
	.area idata
	.byte 1,160
	.area data(ram, con, rel)
	.dbfile E:\__test\_RTL8019_M128_struct_Test\Main.c
	.dbsym e REMOTE_IP _REMOTE_IP A[4:4]c
_REMOTE_PORT::
	.blkb 2
	.area idata
	.byte 35,40
	.area data(ram, con, rel)
	.dbfile E:\__test\_RTL8019_M128_struct_Test\Main.c
	.dbsym e REMOTE_PORT _REMOTE_PORT A[2:2]c
_REMOTE_MAC::
	.blkb 2
	.area idata
	.byte 0,16
	.area data(ram, con, rel)
	.dbfile E:\__test\_RTL8019_M128_struct_Test\Main.c
	.blkb 2
	.area idata
	.byte 181,172
	.area data(ram, con, rel)
	.dbfile E:\__test\_RTL8019_M128_struct_Test\Main.c
	.blkb 2
	.area idata
	.byte 241,49
	.area data(ram, con, rel)
	.dbfile E:\__test\_RTL8019_M128_struct_Test\Main.c
	.dbsym e REMOTE_MAC _REMOTE_MAC A[6:6]c
	.area text(rom, con, rel)
	.dbfile E:\__test\_RTL8019_M128_struct_Test\Main.c
	.dbfunc e main _main fV
	.even
_main::
	.dbline -1
	.dbline 53
; //*01. 本程序的晶体为 7.3728mHz  ATMEGA128 
; //*02. 网卡板UDP的IP: 192.168.1.201          
; //*03. 网卡板UDP的端口: 9000                 
; //*04. 网卡板MAC: { 0, 0, 'a', 'b', 'c', 'd' }     
; //*05. 网卡板: 192.168.1.201  9000          
; //*06. 远程电脑IP: 192.168.1.160            
; //*07. 远程电脑端口: 9000                   
; //*08. 远程电脑MAC: { 0, 0x10, 0xB5, 0xAC, 0xF1, 0x31 }  
; //*09. 无网关(GATE)
; //*10. 无子网掩码(MASK)
; 
; //#include <string.h>
; //#include <stdio.h>
; #include <iom128v.h>
; #include <macros.h>
; 
; #include "Delay_7.37M.h"
; #include "Lcd7920.h"
; #include "Usart1_M128.h"
; #include "Rtl8019as_Ethernet_M128.h"
; #include "Rtl8019as_M128.h"
; 
; //设置网络默认值
; unsigned char MY_IP[4] = { 192,168,1,201 };
; unsigned char MY_PORT[2] = { 0x23,0x28 }; //端口9000
; unsigned char MY_MAC[6] = { 0,0,'a','b','c','d' };
; 
; unsigned char REMOTE_IP[4] = { 192,168,1,160};
; unsigned char REMOTE_PORT[2] = { 0x23,0x28 }; //端口9000
; unsigned char REMOTE_MAC[6] = { 0,0x10,0xB5,0xAC,0xF1,0x31 };
; 
; #define  set_packet32(d,s) packet[d] = make8(s,3);   \
;                            packet[d+1] = make8(s,2); \
;                            packet[d+2] = make8(s,1); \
;                            packet[d+3]= make8(s,0); 
; 						   
; #define make8(var,offset)	(var >> (offset * 8)) & 0xFF
; #define	make16(varhigh,varlow)	((varhigh & 0xFF)* 0x100) + (varlow & 0xFF)
; #define make32(var1,var2,var3,var4) \
; 		((unsigned long)var1<<24)+((unsigned long)var2<<16)+ \
; 		((unsigned long)var3<<8)+((unsigned long)var4)		
; 
; unsigned char  flg_arp;   
; 
; 
; void DoWithUart(void);     //处理串口接收
; 
; 
; 
; 
; 
; void main(void)
; {
	.dbline 54
;    CLI();
	cli
	.dbline 55
;    UART1_Init();   //串口初始化要放在8019初始化前面,以免向串口发空乱数据   
	xcall _UART1_Init
	.dbline 56
;    LCD_Init();
	xcall _LCD_Init
	.dbline 64
;   
;    ////init_RTL8019AS();
; 
;    ////clr_synflag;
;    ////clr_finflag;
;    
;    //网络数据初始化  (--以后改用memcpy)
;    nodRemote.cIp[0]= REMOTE_IP[0];
	lds R2,_REMOTE_IP
	sts _nodRemote+6,R2
	.dbline 65
;    nodRemote.cIp[1]= REMOTE_IP[1];
	lds R2,_REMOTE_IP+1
	sts _nodRemote+6+1,R2
	.dbline 66
;    nodRemote.cIp[2]= REMOTE_IP[2];
	lds R2,_REMOTE_IP+2
	sts _nodRemote+6+2,R2
	.dbline 67
;    nodRemote.cIp[3]= REMOTE_IP[3];   
	lds R2,_REMOTE_IP+3
	sts _nodRemote+6+3,R2
	.dbline 68
;    nodRemote.cPort[0]=REMOTE_PORT[0];
	lds R2,_REMOTE_PORT
	sts _nodRemote+10,R2
	.dbline 69
;    nodRemote.cPort[1]=REMOTE_PORT[1];   
	lds R2,_REMOTE_PORT+1
	sts _nodRemote+10+1,R2
	.dbline 70
;    nodRemote.cMac[0]= REMOTE_MAC[0];
	lds R2,_REMOTE_MAC
	sts _nodRemote,R2
	.dbline 71
;    nodRemote.cMac[1]= REMOTE_MAC[1];
	lds R2,_REMOTE_MAC+1
	sts _nodRemote+1,R2
	.dbline 72
;    nodRemote.cMac[2]= REMOTE_MAC[2];
	lds R2,_REMOTE_MAC+2
	sts _nodRemote+2,R2
	.dbline 73
;    nodRemote.cMac[3]= REMOTE_MAC[3];
	lds R2,_REMOTE_MAC+3
	sts _nodRemote+3,R2
	.dbline 74
;    nodRemote.cMac[4]= REMOTE_MAC[4];
	lds R2,_REMOTE_MAC+4
	sts _nodRemote+4,R2
	.dbline 75
;    nodRemote.cMac[5]= REMOTE_MAC[5];
	lds R2,_REMOTE_MAC+5
	sts _nodRemote+5,R2
	.dbline 77
;    
;    nodLoc.cIp[0]=MY_IP[0];
	lds R2,_MY_IP
	sts _nodLoc+6,R2
	.dbline 78
;    nodLoc.cIp[1]=MY_IP[1];
	lds R2,_MY_IP+1
	sts _nodLoc+6+1,R2
	.dbline 79
;    nodLoc.cIp[2]=MY_IP[2];
	lds R2,_MY_IP+2
	sts _nodLoc+6+2,R2
	.dbline 80
;    nodLoc.cIp[3]=MY_IP[3];
	lds R2,_MY_IP+3
	sts _nodLoc+6+3,R2
	.dbline 81
;    nodLoc.cPort[0]=MY_PORT[0];
	lds R2,_MY_PORT
	sts _nodLoc+10,R2
	.dbline 82
;    nodLoc.cPort[1]=MY_PORT[1];   
	lds R2,_MY_PORT+1
	sts _nodLoc+10+1,R2
	.dbline 83
;    nodLoc.cMac[0]= MY_MAC[0];
	lds R2,_MY_MAC
	sts _nodLoc,R2
	.dbline 84
;    nodLoc.cMac[1]= MY_MAC[1];
	lds R2,_MY_MAC+1
	sts _nodLoc+1,R2
	.dbline 85
;    nodLoc.cMac[2]= MY_MAC[2];
	lds R2,_MY_MAC+2
	sts _nodLoc+2,R2
	.dbline 86
;    nodLoc.cMac[3]= MY_MAC[3];
	lds R2,_MY_MAC+3
	sts _nodLoc+3,R2
	.dbline 87
;    nodLoc.cMac[4]= MY_MAC[4];
	lds R2,_MY_MAC+4
	sts _nodLoc+4,R2
	.dbline 88
;    nodLoc.cMac[5]= MY_MAC[5];
	lds R2,_MY_MAC+5
	sts _nodLoc+5,R2
	.dbline 90
;    
;    flg_arp='f';
	ldi R24,102
	sts _flg_arp,R24
	.dbline 94
;    
;    //delay_ms(1500);  //keep it, wait for arp 
;    
;    LCD_WriteStrAuto("Wan tst 080123B");
	ldi R16,<L65
	ldi R17,>L65
	xcall _LCD_WriteStrAuto
	.dbline 95
;    SEI();
	sei
	.dbline 97
;    
;    UART1_Puts("12345abc");
	ldi R16,<L66
	ldi R17,>L66
	xcall _UART1_Puts
	xjmp L68
L67:
	.dbline 103
;  
; //******************************************************************
; //*	Look for a packet in the receive buffer ring
; //******************************************************************
;    while(1)
;    {   
	.dbline 107
;       //Delay_nms_Preci(1500);  
; 	   
; 	     //串口接收处理
;          if (flg_Received )   
	lds R2,_flg_Received
	tst R2
	breq L70
X0:
	.dbline 108
; 	     {
	.dbline 109
; 	        DoWithUart();	  
	xcall _DoWithUart
	.dbline 110
; 	     }   
L70:
	.dbline 157
; 
; /*      //start the NIC
;       write_rtl(CR,0x22);		  
; 
;       //wait for a good packet
;       while(!(PIND & INT0_pin))  //循环, 直到INT0为高电平, 执行后面的程序
; 	  {
;          //if (flg_arp=='f')  
;          //{ 
;          //   sendarp(); delay_ms(350);
;          // }	 
; 		  

⌨️ 快捷键说明

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