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

📄 slipdev.lst

📁 我修改的可以用串口访问的webserver(51平台)
💻 LST
字号:
C51 COMPILER V7.10   SLIPDEV                                                               09/03/2004 14:37:31 PAGE 1   


C51 COMPILER V7.10, COMPILATION OF MODULE SLIPDEV
OBJECT MODULE PLACED IN Slipdev.OBJ
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE Slipdev.c LARGE BROWSE DEBUG OBJECTEXTEND

line level    source

   1          
   2          #include "uip.h"
   3          #include "uip_arp.h" 
   4          #include "uipopt.h"
   5          #include "my.h"  
   6          #include "serial.h"
   7          
   8          #define SLIP_END     0xc0
   9          #define SLIP_ESC     0xdb
  10          #define SLIP_ESC_END 0xdc
  11          #define SLIP_ESC_ESC 0xdd
  12          
  13          #define MAX_SIZE UIP_BUFSIZE
  14          
  15          #define SIO_RECV(c)  while( getchar(&c)==0)
  16          #define SIO_SEND(c)  while( putchar(c) ==0)
  17          
  18          u8_t modermflag;
  19          
  20          void 
  21          slipdev_send(void)
  22          {
  23   1      #if MAX_SIZE >= 256
  24   1              u16_t i;
  25   1      #else
                      u8_t i;
              #endif /* MAX_SIZE >= 256 */
  28   1              u8_t *ptr;
  29   1              u8_t c;
  30   1      
  31   1              SIO_SEND(SLIP_END);
  32   1              ptr = uip_buf;
  33   1              for(i = 0; i < uip_len; i++) 
  34   1              {
  35   2                      if(i == 40) 
  36   2                              ptr = uip_appdata;
  37   2      
  38   2                      c = *ptr++;
  39   2                      switch(c) 
  40   2                      {
  41   3                      case SLIP_END:
  42   3                              SIO_SEND(SLIP_ESC);
  43   3                              SIO_SEND(SLIP_ESC_END);
  44   3                              break;
  45   3                      case SLIP_ESC:
  46   3                              SIO_SEND(SLIP_ESC);
  47   3                              SIO_SEND(SLIP_ESC_ESC);
  48   3                              break;
  49   3                      default:
  50   3                              SIO_SEND(c);
  51   3                              break;
  52   3                      }
  53   2              }
  54   1      
  55   1              SIO_SEND(SLIP_END);
C51 COMPILER V7.10   SLIPDEV                                                               09/03/2004 14:37:31 PAGE 2   

  56   1      }
  57          /*-----------------------------------------------------------------------------------*/
  58          u16_t 
  59          slipdev_read(void)
  60          {
  61   1        u8_t c,i;
  62   1      
  63   1        unsigned char buf[6]={' ',' ',' ',' ',' ',' '};
  64   1      
  65   1      start: 
  66   1        uip_len = 0;
  67   1        while(1) {
  68   2          if(uip_len >= MAX_SIZE) {
  69   3            goto start;
  70   3          }
  71   2          SIO_RECV(c);
  72   2              /*
  73   2              buf[5]=buf[4];
  74   2              buf[4]=buf[3];
  75   2              buf[3]=buf[2];
  76   2              buf[2]=buf[1];
  77   2              buf[1]=buf[0];
  78   2              */
  79   2              for(i=5;i>0;i--)buf[i]=buf[i-1];
  80   2              buf[0]=c;
  81   2              if(buf[0]=='T' && buf[5]=='C'){modermflag = 1;return 0;}
  82   2      
  83   2          switch(c) {
  84   3          case SLIP_END:
  85   3            if(uip_len > 0) {
  86   4              return uip_len;
  87   4            } else {
  88   4                      goto start;
  89   4            }
  90   3            break;
  91   3          case SLIP_ESC:
  92   3            SIO_RECV(c);
  93   3            switch(c) {
  94   4            case SLIP_ESC_END:
  95   4              c = SLIP_END;
  96   4              break;
  97   4            case SLIP_ESC_ESC:
  98   4              c = SLIP_ESC;
  99   4              break;
 100   4            }
 101   3            /* FALLTHROUGH */
 102   3          default:
 103   3            if(uip_len < MAX_SIZE) {
 104   4                  uip_buf[uip_len] = c;
 105   4              uip_len++;
 106   4            }
 107   3            break;
 108   3          }
 109   2        }
 110   1        return 0;
 111   1      }
 112          /*-----------------------------------------------------------------------------------*/
 113          void
 114          slipdev_init(void)
 115          {
 116   1      
 117   1      }
C51 COMPILER V7.10   SLIPDEV                                                               09/03/2004 14:37:31 PAGE 3   

 118          
 119          void modem_request(void)
 120          {
 121   1        u8_t c;
 122   1        do {
 123   2          SIO_RECV(c);
 124   2          if (c != 'C')
 125   2            continue;
 126   2          SIO_RECV(c);
 127   2          if (c != 'L')
 128   2            continue;
 129   2          SIO_RECV(c);
 130   2          if (c != 'I')
 131   2            continue;
 132   2          SIO_RECV(c);
 133   2          if (c != 'E')
 134   2            continue;
 135   2          SIO_RECV(c);
 136   2          if (c != 'N')
 137   2            continue;
 138   2          SIO_RECV(c);
 139   2        } while (c != 'T');
 140   1      //  modermflag = 1;
 141   1      }
 142          
 143          void modem_reply(void)
 144          {
 145   1        putstring("CLIENTSERVER");
 146   1        modermflag = 0;
 147   1      }
 148          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    543    ----
   CONSTANT SIZE    =     19    ----
   XDATA SIZE       =      1      14
   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 + -