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

📄 netconf.lst

📁 W3100是WIZnet公司专门为以太网互联和嵌入式设备推出的硬件TCP/IP协议栈芯片
💻 LST
📖 第 1 页 / 共 2 页
字号:
 147          * Note       :  
 148          ********************************************************************************
 149          */
 150          void Config_Menu(void)
 151          {
 152   1              PutStringLn("================================================");
 153   1              PutStringLn("(D)isplay network configuration");
 154   1              PutStringLn("(G)ateway IP address update - Deciaml");
 155   1              PutStringLn("(S)ubnet mask update        - Decimal");
 156   1              PutStringLn("(I)p address update         - Decimal");
 157   1              PutStringLn("(H)ardware address update   - HexaDeciaml Format");
 158   1              PutStringLn("(E)xit network configuration mode");
 159   1              PutStringLn("------------------------------------------------");
 160   1              PutStringLn("E(r)ase EEPROM with 0x00");
 161   1              PutStringLn("================================================");
 162   1      }
 163          
 164          /*
 165          ********************************************************************************
 166          * Description:  Load Network Information stored in EEPROM to Register referring to W3100A's Network. 
 167          * Arguments  :  
 168          * Returns    : success = 1, fail = 0
 169          * Note       :  
 170          ********************************************************************************
 171          */
 172          char Config_Load(void)
 173          {
 174   1              if(EEP_ReadBytes(GIPADDR,GATEWAY_PTR,4)==0) return 0;                   // Load Gateway information from EEPROM to W310
             -0A
 175   1      
 176   1              if(EEP_ReadBytes(SNET,SUBNET_MASK_PTR,4)==0) return 0;                  // Load Subnet Mask from EEPROM to W3100A
 177   1      
C51 COMPILER V8.02   NETCONF                                                               10/17/2006 16:52:41 PAGE 4   

 178   1              if(EEP_ReadBytes(LIPADDR,SRC_IP_PTR,4)==0) return 0;                    // Load Source IP Address information from EEPRO
             -M to W3100A
 179   1      
 180   1              if(EEP_ReadBytes(MADDR,SRC_HA_PTR,6)==0) return 0;                      // Load Mac Address information from EEPROM to W31
             -00A
 181   1      }
 182          
 183          
 184          
 185          /*
 186          ********************************************************************************
 187          * Description:  Load Network Information stored in EEPROM to Register referring to W3100A's Network. 
 188          * Arguments  : Select - 'G' - G/W , 'S'- S/N , 'I' - IP, 'H' - Mac Address, 'A' - All Update (INPUT)
 189          * Returns    : success = 1, fail = 0
 190          * Note       :  
 191          ********************************************************************************
 192          */
 193          char Config_Save(UCHAR Select)                                            
 194          {                                                                         
 195   1              if(Select == 'A' || Select == 'G')                                      //  Load Gateway information from W3100A to EEPROM .
 196   1                      if(EEP_WriteBytes(GIPADDR,GATEWAY_PTR,4)==0) return 0;    
 197   1              if(Select == 'A' || Select == 'S')                                      // Load Subnetmask information from W3100A to EEPROM .
 198   1                      if(EEP_WriteBytes(SNET,SUBNET_MASK_PTR,4)==0) return 0;
 199   1              if(Select == 'A' || Select == 'I')                                      // Load Source IP Address information from W3100A to EEPROM. 
 200   1                      if(EEP_WriteBytes(LIPADDR,SRC_IP_PTR,4)==0) return 0;           
 201   1              if(Select == 'A' || Select == 'H')                                      // Source  Mac Address information from W3100A to EEPROM.
 202   1                      if(EEP_WriteBytes(MADDR,SRC_HA_PTR,6)==0) return 0;
 203   1      }
 204          
 205          /*
 206          ********************************************************************************
 207          * Description:Input appropriate Network Information with Serial and selected menu by User.And then Store i
             -n W3100A Register.
 208          * Arguments  : Select - 'G' - G/W , 'S'- S/N , 'I' - IP, 'H' - Mac Address  (INPUT)
 209          * Returns    : success = 1, fail = 0
 210          * Note       :  
 211          ********************************************************************************
 212          */
 213          char Config_Edit(UCHAR Select)
 214          {
 215   1              u_char Addr[6];
 216   1              char ret; 
 217   1              if(Select == 'H')       ret = GetDotNotationAddr(Addr,16,6);            // Read Mac Address into Dotted HexaDecimal forma
             -t through RS232C.
 218   1              else                    ret = GetDotNotationAddr(Addr,10,4);            
 219   1              if(ret == -1)
 220   1              {
 221   2                      PutStringLn("\r\nConfiguration Update Failed");
 222   2                      return 0;
 223   2              }
 224   1              switch (Select) 
 225   1              {
 226   2                      case 'G' :
 227   2                              setgateway(Addr);
 228   2                              break;
 229   2                      case 'S' :
 230   2                              setsubmask(Addr);
 231   2                              break;
 232   2                      case 'I' :
 233   2                              setIP(Addr);
 234   2                              break;
 235   2                      case 'H' :
C51 COMPILER V8.02   NETCONF                                                               10/17/2006 16:52:41 PAGE 5   

 236   2                              setMACAddr(Addr);
 237   2                              break;                                                  
 238   2              }                                                                       
 239   1              return Config_Save(Select);                                             // Store each Network informations.
 240   1      }
 241          
 242          
 243          /*
 244          ###############################################################################
 245          Unused Function Implementation Part
 246          ###############################################################################
 247          */
 248          
 249          #ifndef __UNUSED_EEPROM
              
              /*
              ********************************************************************************
              * Description: Store src in appointed address.
              * Arguments  : Addr   - EEPROM storage address ( 0x00 - 0xFF)  (INPUT)
                             src    - Source Information to be stored  (INPUT)
                             len    - Byte unit length  of Source Information (INPUT)
              * Returns    : success = 1, fail = 0
              * Note       :  
              ********************************************************************************
              */
              char SaveInfo(UCHAR addr, char* src, int len)
              {
                      return EEP_WriteBytes(addr, src, len);
              }
              
              /*
              ********************************************************************************
              * Description: Store information of appointed address in dst.
              * Arguments  : Addr   - EEPROM storage address( 0x00 - 0xFF)  (INPUT)
                             src    - Starting address of storage (INPUT)
                             len    - Byte unit length  of Source Information(INPUT)
              * Returns    : success = 1, fail = 0
              * Note       :  
              ********************************************************************************
              */
              char LoadInfo(UCHAR addr, char* src, int len)
              {
                      return EEP_ReadBytes(addr, src, len);
              }
              
              #endif
 282          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    671    ----
   CONSTANT SIZE    =    642    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----      12
   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 + -