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

📄 yyshell.lst

📁 UCOS在C51上实现的两个例子
💻 LST
字号:
C51 COMPILER V7.50   YYSHELL                                                               04/11/2006 17:11:50 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE YYSHELL
OBJECT MODULE PLACED IN yyshell.OBJ
COMPILER INVOKED BY: D:\Keil C\C51\BIN\C51.EXE yyshell.c LARGE BROWSE DEBUG OBJECTEXTEND

line level    source

   1          //**********************************************************************************
   2          //杨屹    2002/08/21    第一版
   3          //我的主程序(SNMP网管板)
   4          //联系方法:gdtyy@ri.gdt.com.cn(2003/07/31以前有效)
   5          //**********************************************************************************
   6          
   7          #include   <includes.h>
   8          
   9          static unsigned char ComTable[MaxComNum][MaxLenCom+1]={"lt","kill","ping","udp","host","mask","gateway","e
             -xit","ipcfg","clr","help"};                   
  10                                  
  11          int State=StatInputCom;
  12          unsigned char ch;
  13          int ShellEnd=0;         /*Shell end flag*/
  14          unsigned char ComBuf[MaxLenComBuf+1];   /*store '\0'*/
  15          int i=-1;                       /*ComBuf pointer*/
  16          int tem;                        /*Temp variable*/
  17          int ComMatchFlag=0;             /*Command match flag*/
  18          
  19          WORDTABLE WordTable;
  20                  
  21          int Matched=0;  /*Match flag*/
  22          
  23          OS_STK yyshellStk[MaxStkSize];//注意:我在ASM文件中设置?STACK空间为40H即64,不要超出范围。用户栈多一个字节
             -存长度
  24                  
  25          xdata union ip_address_type my_ip_address;      //本机的ip地址
  26          xdata union ip_address_type temp_ip_address;    //临时变量
  27          xdata union ip_address_type mask_ip_address;    //子网掩码
  28          xdata union ip_address_type gateway_ip_address; //网关的ip地址
  29          xdata union ip_address_type ping_ip_address;    //用于ping命令
  30          
  31          void main(void)
  32          {
  33   1          OSInit();
  34   1          
  35   1          InitTimer0();
  36   1          InitSerial();
  37   1          InitSerialBuffer();
  38   1          
  39   1          //初始化网络参数
  40   1          IPadrToHEX("172.18.92.87",&my_ip_address.bytes[0]);
*** WARNING C182 IN LINE 40 OF YYSHELL.C: pointer to different objects
  41   1          IPadrToHEX("255.255.255.0",&mask_ip_address.bytes[0]);
*** WARNING C182 IN LINE 41 OF YYSHELL.C: pointer to different objects
  42   1          IPadrToHEX("172.18.91.5",&gateway_ip_address.bytes[0]);    
*** WARNING C182 IN LINE 42 OF YYSHELL.C: pointer to different objects
  43   1          
  44   1          OSTaskCreate(yyshell, (void *)0, &yyshellStk[0],8);    
  45   1          
  46   1          OSStart();
  47   1      }
  48          
  49          void yyshell(void *yydata) reentrant
  50          {
C51 COMPILER V7.50   YYSHELL                                                               04/11/2006 17:11:50 PAGE 2   

  51   1              yydata=yydata;
  52   1              clrscr();
  53   1              PrintStr("\t\t***********************************************\n");
  54   1              PrintStr("\t\t*         Welcom to use this program          *\n");
  55   1              PrintStr("\t\t*                   Author:YangYi 20020715    *\n");
  56   1              PrintStr("\t\t***********************************************\n\n\n");
  57   1                      
  58   1              /*Login & Password*/
  59   1      
  60   1              PrintStr("% ");
  61   1              while(!ShellEnd){
  62   2      
  63   2                      switch(State){
  64   3                              case StatInputCom:{
  65   4                                      if(yygetch(&ch)){
  66   5                                              if(ch==13)      /*Enter return key*/
  67   5                                              {
  68   6                                                      PrintStr("\n");
  69   6                                                      ComBuf[i+1]='\0';                                       
  70   6                                                      if(i+1==0) PrintStr("% ");
  71   6                                                      else                                    
  72   6                                                      State=StatExeCom;
  73   6                                              }
  74   5                                              else{
  75   6                                                      i=i+1;
  76   6                                                      if((i>=MaxLenComBuf)&&(ch!=8)){
  77   7                                                              PrintChar(7);
  78   7                                                              i=MaxLenComBuf-1;
  79   7                                                      }
  80   6                                                      else{
  81   7                                                              if(ch==8){
  82   8                                                                      i=i-2;
  83   8                                                                      if(i<-1) {i=-1;PrintChar(7);}
  84   8                                                                      else{
  85   9                                                                              PrintChar(8);
  86   9                                                                              PrintChar(' ');
  87   9                                                                              PrintChar(8);
  88   9                                                                      }
  89   8                                                              }
  90   7                                                              else{
  91   8                                                                      PrintChar(ch);
  92   8                                                                      ComBuf[i]=ch;
  93   8                                                              }
  94   7                                                      }
  95   6                                              }
  96   5                                              break;
  97   5                                      }
  98   4                                      else{
  99   5                                              //OSTimeDly(10);
 100   5                                              break;
 101   5                                      }
 102   4                              }
 103   3                              case StatExeCom:{
 104   4                                      if(GetWord(ComBuf,&WordTable)==1&&WordTable.Num!=0){
 105   5                                              yystrlwr(WordTable.wt[0].Str);
 106   5                                              for(tem=0;tem<MaxComNum&&!ComMatchFlag;tem++)
 107   5                                                      if(yystrcmp(WordTable.wt[0].Str,ComTable[tem])==0) ComMatchFlag=1;
 108   5                                              if(ComMatchFlag){
 109   6                                                      tem--;
 110   6                                                      switch(tem){
 111   7                                                              case 0:{DisplayTask(&WordTable);break;}
 112   7                                                              case 1:{Kill(&WordTable);break;}
C51 COMPILER V7.50   YYSHELL                                                               04/11/2006 17:11:50 PAGE 3   

 113   7                                                              case 2:{PingCommand(&WordTable);break;}
 114   7                                                              case 3:{UDPCommand(&WordTable);break;}
 115   7                                                              case 4:{CfgHost(&WordTable);break;}
 116   7                                                              case 5:{CfgMask(&WordTable);break;}
 117   7                                                              case 6:{CfgGateway(&WordTable);break;}                                                  
 118   7                                                              case 7:{
 119   8                                                                      //ShellEnd=1;
 120   8                                                                      PrintStr("\n\tThis Command is limited!\n\n");
 121   8                                                                      break;
 122   8                                                              }
 123   7                                                              case 8:{PrintConfig(&WordTable);break;}
 124   7                                                              case 9:{clrscr();break;}
 125   7                                                              case 10:{DisplayHelpMenu(&WordTable);break;}
 126   7                                                      }                                                       
 127   6                                              }
 128   5                                              else
 129   5                                                      PrintStr("    Bad command!\n\n");
 130   5                                      }
 131   4                                      else{
 132   5                                              if(WordTable.Num) PrintStr("    Bad command!\n\n");
 133   5                                      }
 134   4      
 135   4                                      ComMatchFlag=0;
 136   4                                      State=StatInputCom;
 137   4                                      if(ShellEnd) {PrintStr("\n\n");}
 138   4                                      else PrintStr("% ");
 139   4                                      i=-1;
 140   4                                      break;
 141   4                              }
 142   3                              default:{
 143   4                                      //ShellEnd=1;
 144   4                                      PrintStr("System fatal error!\n");
 145   4                                      PrintChar(7);PrintChar(7);PrintChar(7);
 146   4                              }
 147   3                      }
 148   2              }
 149   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    944    ----
   CONSTANT SIZE    =    322    ----
   XDATA SIZE       =  21026    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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