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

📄 ethernet.lst

📁 此代码是实现将lwip协议移植于51单片机的测试程序
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.02b   ETHERNET                                                             08/25/2006 12:00:06 PAGE 1   


C51 COMPILER V7.02b, COMPILATION OF MODULE ETHERNET
OBJECT MODULE PLACED IN ethernet.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE mywork\ethernet\ethernet.c LARGE INCDIR(c:\t\inc;c:\t\inc) DEBUG OBJECTEXTE
                    -ND PRINT(.\ethernet.lst) OBJECT(ethernet.obj)

stmt level    source

   1          //****test ram 0xFDF0-0xFE0F ,write and read, compare two value so that test 8019as physical circuit.
   2          //****mac ---txdnet(source MAC)   init8019as;add mask command
   3          //****host ---txdnet
   4          //****initNIC ---txdnet(source MAC/IP)
   5          //SNMP==UDP?
   6          //****add lc/ls command to display host mask mac.../arp table
   7          //****arp_process ---force to write to some location when table full.
   8          //****ping_echo ---print IP answer.and set pinganswerd flag.
   9          //****subnet/net/self.(ping/udp)
  10          //****add ping/udp command.
  11          //findmacadr add index parameter
  12          //****Don't set global varible before read.(Host/Mac...)
  13          //开始时发ARP包;主动更新ARP缓存;不是给自己的ARP广播也用于刷新缓存;收到ARP应答
  14          //则更新定时器。
  15          //
  16          //extern long int secondtimer;
  17          #include <general.h>
*** WARNING C318 IN LINE 17 OF mywork\ethernet\ethernet.c: can't open file 'general.h'
  18          //#include <serial.h>
  19          //#include <snmp.h>
  20          //#include <word.h>
  21          //#include <ethernet.h>
  22          //#include <SerEEROM.h>
  23          //#include <convert.h>
  24          //#include <string.h>
  25          //#include <mystring.h>
  26          
  27          //extern long int secondtimer;
  28          static long int secondtimer=0;
  29          
  30          xdata union ethernet_address_type my_ethernet_address;          //本机的以太网地址
  31          xdata union ethernet_address_type gateway_ethernet_address; //网关的以太网地址
  32          xdata union ethernet_address_type ping_ethernet_address;        //用来ping的以太网地址
  33          
  34          xdata union ip_address_type my_ip_address;              //本机的ip地址
  35          xdata union ip_address_type gateway_ip_address; //网关的ip地址
  36          xdata union ip_address_type mask_ip_address;    //子网掩码
  37          xdata union ip_address_type SNMP_ip_address;    //网管SNMP主机的ip地址
  38          xdata union ip_address_type ping_ip_address;    //用于ping命令
  39          xdata union ip_address_type temp_ip_address;    //临时变量
  40          
  41          xdata union arp_table_type arp_tab[MaxLenARPtable];
*** ERROR C202 IN LINE 41 OF MYWORK\ETHERNET\ETHERNET.C: 'MaxLenARPtable': undefined identifier
*** ERROR C136 IN LINE 41 OF MYWORK\ETHERNET\ETHERNET.C: invalid dimension size: [0]
  42          
  43          bit txd_buffer_select=0;                //选择网卡的发送缓冲区
  44          unsigned char ping_count;               //ping的次数
  45          unsigned char udp_count;                //udp的次数
  46          
  47          xdata union netcard rxdnet;
  48          xdata union netcard txdnet;
  49          
  50          unsigned char index=0;                  //ARP table 循环加入点
  51          unsigned int frameindex=0;              //IP包的序列号
C51 COMPILER V7.02b   ETHERNET                                                             08/25/2006 12:00:06 PAGE 2   

  52          
  53          struct TXBUF{
  54                  unsigned char status;
  55                  unsigned char ttl;
  56                  union ip_address_type ip;
  57                  unsigned char type;
  58                  unsigned char pinganswerd;
  59                  unsigned int length;
  60                  union netcard pack;
  61          } txdbuf[MaxLenTxBuf];
*** ERROR C230 IN LINE 61 OF MYWORK\ETHERNET\ETHERNET.C: 'ip_address_type': unknown struct/union/enum tag
*** ERROR C202 IN LINE 61 OF MYWORK\ETHERNET\ETHERNET.C: 'MaxLenTxBuf': undefined identifier
*** ERROR C136 IN LINE 61 OF MYWORK\ETHERNET\ETHERNET.C: invalid dimension size: [0]
  62          
  63          void page(unsigned char pagenumber)//ne2000页选择
  64          {
  65   1              unsigned char data temp;
  66   1              temp=reg00&0x3B;//注意txp位不能要
*** ERROR C202 IN LINE 66 OF MYWORK\ETHERNET\ETHERNET.C: 'reg00': undefined identifier
  67   1              pagenumber=pagenumber <<6;
  68   1              temp=temp | pagenumber;
  69   1              reg00=temp;
*** ERROR C202 IN LINE 69 OF MYWORK\ETHERNET\ETHERNET.C: 'reg00': undefined identifier
  70   1      }
  71          
  72          void getadr(unsigned char id,unsigned char *bytes)//读取MAC地址参数
  73          {
  74   1              int len;
  75   1      
  76   1              if(id==MACADR) len=6;           //不是很安全,没有检测参数错误!
*** ERROR C202 IN LINE 76 OF MYWORK\ETHERNET\ETHERNET.C: 'MACADR': undefined identifier
  77   1              else len=4;     
  78   1              opx5045(READ,id,len,bytes);     //读出地址存到bytes[]里
*** ERROR C202 IN LINE 78 OF MYWORK\ETHERNET\ETHERNET.C: 'READ': undefined identifier
  79   1      }
  80          
  81          void setadr(unsigned char id,unsigned char *bytes)//设置MAC地址参数
  82          {
  83   1              int len;
  84   1              unsigned char i,WIP;
  85   1      
  86   1              if(id==MACADR) len=6;           //不是很安全,没有检测参数错误!
*** ERROR C202 IN LINE 86 OF MYWORK\ETHERNET\ETHERNET.C: 'MACADR': undefined identifier
  87   1              else len=4;     
  88   1              //                      
  89   1                      do{
  90   2                              opx5045(RDSR,0,0,&WIP);
*** ERROR C202 IN LINE 90 OF MYWORK\ETHERNET\ETHERNET.C: 'RDSR': undefined identifier
  91   2                      }while((WIP&0x1)==1);
  92   1              //
  93   1              for(i=0;i<len;i++,id++){        //将地址写入X5045.              
  94   2                      opx5045(WREN,id,1,&bytes[i]);
*** ERROR C202 IN LINE 94 OF MYWORK\ETHERNET\ETHERNET.C: 'WREN': undefined identifier
  95   2                      opx5045(WRITE,id,1,&bytes[i]);
*** ERROR C202 IN LINE 95 OF MYWORK\ETHERNET\ETHERNET.C: 'WRITE': undefined identifier
  96   2                      //                      
  97   2                      do{
  98   3                              opx5045(RDSR,0,0,&WIP);
*** ERROR C202 IN LINE 98 OF MYWORK\ETHERNET\ETHERNET.C: 'RDSR': undefined identifier
  99   3                      }while((WIP&0x1)==1);
 100   2                      //
 101   2              }       
C51 COMPILER V7.02b   ETHERNET                                                             08/25/2006 12:00:06 PAGE 3   

 102   1      }
 103          
 104          void initNIC(void)//初始化网卡配置参数
 105          {
 106   1              unsigned char i;
 107   1      
 108   1              getadr(MACADR,&my_ethernet_address.bytes[0]);//读出网卡的物理地址存到my_ethernet_address.bytes[6]里
*** ERROR C202 IN LINE 108 OF MYWORK\ETHERNET\ETHERNET.C: 'MACADR': undefined identifier
 109   1              
 110   1              page(1);//init 8019as PAR
 111   1              reg01=my_ethernet_address.bytes[0];
*** ERROR C202 IN LINE 111 OF MYWORK\ETHERNET\ETHERNET.C: 'reg01': undefined identifier
 112   1              reg02=my_ethernet_address.bytes[1];
*** ERROR C202 IN LINE 112 OF MYWORK\ETHERNET\ETHERNET.C: 'reg02': undefined identifier
 113   1              reg03=my_ethernet_address.bytes[2];
*** ERROR C202 IN LINE 113 OF MYWORK\ETHERNET\ETHERNET.C: 'reg03': undefined identifier
 114   1              reg04=my_ethernet_address.bytes[3];
*** ERROR C202 IN LINE 114 OF MYWORK\ETHERNET\ETHERNET.C: 'reg04': undefined identifier
 115   1              reg05=my_ethernet_address.bytes[4];
*** ERROR C202 IN LINE 115 OF MYWORK\ETHERNET\ETHERNET.C: 'reg05': undefined identifier
 116   1              reg06=my_ethernet_address.bytes[5];
*** ERROR C202 IN LINE 116 OF MYWORK\ETHERNET\ETHERNET.C: 'reg06': undefined identifier
 117   1      
 118   1              for(i=0;i<3;i++)
 119   1                      txdnet.etherframe.sourcenodeid[i]=my_ethernet_address.words[i];
*** ERROR C230 IN LINE 119 OF MYWORK\ETHERNET\ETHERNET.C: 'netcard': unknown struct/union/enum tag
*** ERROR C204 IN LINE 119 OF MYWORK\ETHERNET\ETHERNET.C: 'etherframe': undefined member
 120   1      
 121   1              getadr(HOST,&my_ip_address.bytes[0]);//读出本机IP地址存到my_ip_address.bytes[4]里
*** ERROR C202 IN LINE 121 OF MYWORK\ETHERNET\ETHERNET.C: 'HOST': undefined identifier
 122   1              getadr(MASK,&mask_ip_address.bytes[0]);//读出本机掩码存到mask_ip_address.bytes[4]里
*** ERROR C202 IN LINE 122 OF MYWORK\ETHERNET\ETHERNET.C: 'MASK': undefined identifier
 123   1              getadr(GATEWAY,&gateway_ip_address.bytes[0]);//读出网关IP地址存到gateway_ip_address.bytes[4]里  
*** ERROR C202 IN LINE 123 OF MYWORK\ETHERNET\ETHERNET.C: 'GATEWAY': undefined identifier
 124   1              getadr(SNMPHOST,&SNMP_ip_address.bytes[0]);//读出SNMP网管主机IP地址存到SNMP_ip_address.bytes[4]里       
*** ERROR C202 IN LINE 124 OF MYWORK\ETHERNET\ETHERNET.C: 'SNMPHOST': undefined identifier
 125   1      }
 126          
 127          void delay_ms(unsigned char ms_number)//延时
 128          {
 129   1      //延时子程序,延时时间单位为1毫秒,晶振使用22。1184兆赫,芯片使用mcs51兼容芯片
 130   1      //ms_number为需要延时的毫秒数,最大为255毫秒  误差小于1 % 
 131   1              unsigned int  i;
 132   1              unsigned char j;
 133   1              for(j=0;j<ms_number;j++)
 134   1                      for(i=0;i<229;i++);
 135   1      }
 136          
 137          void rtl8019as_rst()//RTL8019AS复位
 138          {       
 139   1              unsigned char temp;
 140   1              
 141   1              delay_ms(200);

⌨️ 快捷键说明

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