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

📄 main.lst

📁 移植uIP1.0到51单片机上的版本mcu_netV1.00 uIP ARP / ICMP / TCP协议的完全移植
💻 LST
字号:
C51 COMPILER V7.06   MAIN                                                                  05/02/2009 15:51:22 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN .\main.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\src\main.c LARGE BROWSE DEBUG OBJECTEXTEND PRINT(.\main.lst) OBJECT(.\ma
                    -in.obj)

stmt level    source

   1          /****************************************************************************
   2          【文  件  名  称】main.c
   3          【功  能  描  述】TCP/IP处理主程序
   4          【程  序  版  本】V1.0
   5          ****************************************************************************/
   6          
   7          #include "main.h"
   8          #include<absacc.H>
   9          
  10          extern void example1_init(void);
  11          
  12          /************ 定时器0用来做TCP连接计时和ARP更新使用*******/
  13          clock_time_t tick_cnt;
  14          
  15          /*定时器0初始化函数*/
  16          void init_Timer()
  17          {
  18   1              TMOD = 0x21;      /*定时器0用于定时*/
  19   1              TH0 = 0x7D;       /*20M晶振下,定时20ms*/
  20   1              TL0 = 0xCB;
  21   1              EA = 1;           /*允许中断*/
  22   1              ET0 = 1;          /*允许时间0中断*/
  23   1              TR0 = 1;          /*启动TR0*/
  24   1      }
  25          
  26          /*定时器0中断服务函数*/
  27          void  timer0()  interrupt 1
  28          {
  29   1              tick_cnt ++;
  30   1              TH0 = 0x7D;
  31   1              TL0 = 0xCB;
  32   1              TR0 = 1;
  33   1      }
  34          
  35          /*时间戳*/
  36          clock_time_t clock_time(void)
  37          {
  38   1          return tick_cnt;
  39   1      }
  40          /**************************************************/
  41          
  42          void main(void)
  43          { 
  44   1          u8_t i;
  45   1          uip_ipaddr_t ipaddr;
  46   1              struct timer periodic_timer, arp_timer;
  47   1      
  48   1          timer_set(&periodic_timer, CLOCK_CONF_SECOND / 2);
  49   1          timer_set(&arp_timer, CLOCK_CONF_SECOND * 10);
  50   1      
  51   1          init_Timer();
  52   1          uip_init();
  53   1          example1_init();
  54   1          etherdev_init();
C51 COMPILER V7.06   MAIN                                                                  05/02/2009 15:51:22 PAGE 2   

  55   1          uip_arp_init();
  56   1          uip_ipaddr(ipaddr, 192,168,1,9);
  57   1          uip_sethostaddr(ipaddr);
  58   1          uip_ipaddr(ipaddr, 192,168,1,16);
  59   1          uip_setdraddr(ipaddr);
  60   1          uip_ipaddr(ipaddr, 255,255,255,0);
  61   1          uip_setnetmask(ipaddr);
  62   1          
  63   1          while(1)
  64   1          {
  65   2          uip_len = etherdev_read();
  66   2          if(uip_len > 0)
  67   2          {
  68   3              if(BUF->type == htons(UIP_ETHTYPE_IP)) 
  69   3              {
  70   4                      uip_arp_ipin();
  71   4                      uip_input();
  72   4                      /* If the above function invocation resulted in data that
  73   4                         should be sent out on the network, the global variable
  74   4                         uip_len is set to a value > 0. */
  75   4                      if(uip_len > 0) 
  76   4                  {
  77   5                          uip_arp_out();
  78   5                          etherdev_send();
  79   5                      }
  80   4              } 
  81   3              else if(BUF->type == htons(UIP_ETHTYPE_ARP)) {
  82   4              uip_arp_arpin();
  83   4              /* If the above function invocation resulted in data that
  84   4                 should be sent out on the network, the global variable
  85   4                 uip_len is set to a value > 0. */
  86   4                       if(uip_len > 0) 
  87   4                   {
  88   5                           etherdev_send();
  89   5                       }
  90   4                }
  91   3              }
  92   2              else if(timer_expired(&periodic_timer)) 
  93   2              {
  94   3                  timer_reset(&periodic_timer);
  95   3                  for(i = 0; i < UIP_CONNS; i++) 
  96   3                  {
  97   4                      uip_periodic(i);
  98   4                      /* If the above function invocation resulted in data that
  99   4                         should be sent out on the network, the global variable
 100   4                         uip_len is set to a value > 0. */
 101   4                      if(uip_len > 0)
 102   4                      {
 103   5                         uip_arp_out();
 104   5                         etherdev_send();
 105   5                          }
 106   4                    }
 107   3      
 108   3                   #if UIP_UDP
                            for(i = 0; i < UIP_UDP_CONNS; i++) 
                            {
                                    uip_udp_periodic(i);
                                   /* If the above function invocation resulted in data that
                                   should be sent out on the network, the global variable
                                   uip_len is set to a value > 0. */
                                   if(uip_len > 0) 
                               {
C51 COMPILER V7.06   MAIN                                                                  05/02/2009 15:51:22 PAGE 3   

                                        uip_arp_out();
                                        etherdev_send();
                               }
                             }
                            #endif /* UIP_UDP */
 122   3                    
 123   3                    /* Call the ARP timer function every 10 seconds. */
 124   3                    if(timer_expired(&arp_timer)) 
 125   3                    {
 126   4                        timer_reset(&arp_timer);
 127   4                        uip_arp_timer();
 128   4                    }
 129   3              }
 130   2        }
 131   1        return;
 132   1      }
 133          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    437    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =      2      13
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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