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

📄 main_demo.lst

📁 cs8900 c51应用
💻 LST
字号:
C51 COMPILER V7.06   MAIN_DEMO                                                             11/26/2004 11:32:43 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE MAIN_DEMO
OBJECT MODULE PLACED IN .\8052-obj\main_demo.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE main_demo.c LARGE OPTIMIZE(SIZE) BROWSE INTVECTOR(0X2000) INCDIR(D:\Work\op
                    -entcp\1-0-2\src\include\) DEFINE(MONITOR,CS8900) DEBUG OBJECTEXTEND CODE SYMBOLS PRINT(.\8052-lst\main_demo.lst) PREPRIN
                    -T(.\8052-lst\main_demo.i) OBJECT(.\8052-obj\main_demo.obj)

stmt level    source

   1          /** \file main_demo.c
   2           *      \ingroup opentcp_example
   3           *      \brief This file shows an example of main loop of an app using OpenTCP
   4           *      \author Vladan Jovanovic (vladan.jovanovic@violasystems.com)
   5           *      \version 1.0
   6           *      \date 11.6.2002
   7           *      \bug
   8           *      \warning
   9           *      \todo
  10           *  
  11           *      This file shows an example main loop of an application using
  12           *      OpenTCP TCP/IP stack. This file should be used together with
  13           *      corresponding tcp_client_demo.c, tcp_server_demo.c and udp_demo.c
  14           *      files.
  15           */
  16          #include <inet/debug.h>
*** WARNING C318 IN LINE 16 OF main_demo.c: can't open file 'inet/debug.h'
  17          #include <inet/debug.h>
*** WARNING C318 IN LINE 17 OF main_demo.c: can't open file 'inet/debug.h'
  18          #include <inet/arch/config.h>
*** WARNING C318 IN LINE 18 OF main_demo.c: can't open file 'inet/arch/config.h'
  19          #include <inet/datatypes.h>
*** WARNING C318 IN LINE 19 OF main_demo.c: can't open file 'inet/datatypes.h'
  20          #include <inet/timers.h>
*** WARNING C318 IN LINE 20 OF main_demo.c: can't open file 'inet/timers.h'
  21          #include <inet/system.h>
*** WARNING C318 IN LINE 21 OF main_demo.c: can't open file 'inet/system.h'
  22          #include <inet/ethernet.h>
*** WARNING C318 IN LINE 22 OF main_demo.c: can't open file 'inet/ethernet.h'
  23          #include <inet/ip.h>
*** WARNING C318 IN LINE 23 OF main_demo.c: can't open file 'inet/ip.h'
  24          #include <inet/tcp_ip.h>
*** WARNING C318 IN LINE 24 OF main_demo.c: can't open file 'inet/tcp_ip.h'
  25          #include <inet/arp.h>
*** WARNING C318 IN LINE 25 OF main_demo.c: can't open file 'inet/arp.h'
  26          #include <inet/arch/at89s8252/serial-io.h>
*** WARNING C318 IN LINE 26 OF main_demo.c: can't open file 'inet/arch/at89s8252/serial-io.h'
  27          #include <inet/bootp/bootp.h>
*** WARNING C318 IN LINE 27 OF main_demo.c: can't open file 'inet/bootp/bootp.h'
  28          
  29          extern void udp_demo_init(void);
  30          extern void udp_demo_run(void);
  31          
  32          extern void tcps_demo_init(void);
  33          extern void tcps_demo_run(void);
  34          
  35          extern void tcpc_demo_init(void);
  36          extern void tcpc_demo_run(void);
  37          
  38          extern INT8 https_init(void);
*** ERROR C129 IN LINE 38 OF MAIN_DEMO.C: missing ';' before 'https_init'
  39          extern void https_run(void);
  40          
C51 COMPILER V7.06   MAIN_DEMO                                                             11/26/2004 11:32:43 PAGE 2   

  41          /* Network Interface definition. Must be somewhere so why not here? :-)*/
  42          struct netif localmachine;
  43          
  44          /* main stuff */
  45          void main(void)
  46          {
  47                  UINT16 len;
  48                  
  49                  /* initialize processor-dependant stuff (I/O ports, timers...).
  50                   * This will normally be some function under the arch/xxxMCU dir. Most
  51                   * important things to do in this function as far as the TCP/IP stack
  52                   * is concerned is to:
  53                   *  - initialize some timer so it executes decrement_timers
  54                   *      on every 10ms (TODO: Throw out this dependency from several files
  55                   *      so that frequency can be adjusted more freely!!!)
  56                   *  - not mess too much with ports allocated for Ethernet controller
  57                   */
  58                  init();
  59                   
  60                  /* Set our network information. This is for static configuration.
  61                  * if using BOOTP or DHCP this will be a bit different.
  62                  */
  63          
  64          
  65                  /* IP address, set to 0 to use BOOTP */
  66                          localmachine.localip = 0xC7C72901;      /* 199.199.41.1*/
  67                  /* Default gateway */
  68                          localmachine.defgw =   0xC0A80039; /* 192.168.0.57      */
  69                          /* Subnet mask */
  70                          localmachine.netmask = 0xFFFFFF00;
  71                  /* Ethernet (MAC) address */
  72          #ifdef SLIP
                              /* Ethernet (MAC) address */
                              localmachine.localHW[5] = 0x44;
                              localmachine.localHW[4] = 0x45;
                              localmachine.localHW[3] = 0x53;
                              localmachine.localHW[2] = 0x54;
                              localmachine.localHW[1] = 0x00;
                              localmachine.localHW[0] = 0x00;
              #endif
  81          #ifdef CS8900
  82                          localmachine.localHW[5] = 0x00;
  83                          localmachine.localHW[4] = 0x00;
  84                          localmachine.localHW[3] = 0x11;
  85                          localmachine.localHW[2] = 0x11;
  86                          localmachine.localHW[1] = 0x22;
  87                          localmachine.localHW[0] = 0x22;
  88          #endif
  89                  /* Init system services         */    
  90                  timer_pool_init();
  91                          
  92                  /*interrupts can be enabled AFTER timer pool has been initialized */
  93                  /* Initialize all network layers        */
  94          
  95          /*
  96          * 0. No hardware (except PC) is needed to run OpenTCP port (SLIP target).
  97          * You can redirect serial I/O in Keil simulator to PC hardware COM-port:
  98          * MODE COM2 115200 ,0 ,8 , 1 ; ASSIGN COM2 < SIN > SOUT;
  99          * OpenTCP targets were tested with Keil 7.03 and 7.04.
 100          * The real hardware with CS8900A and AT89S8252(or any 8052) is needed to
 101          * run CS8900 target. You should modify system.h to add support for other
 102          * Ethernet chips (RTL80xx).
C51 COMPILER V7.06   MAIN_DEMO                                                             11/26/2004 11:32:43 PAGE 3   

 103          *
 104          * 1. There is not enough memory (32K SRAM) to debug both UDP and TCP using MONITOR :(
 105          * Select target SLIP or CS8900 as current target before build the project.
 106          *
 107          * 2. Lines #ifdef CS8900 and #ifdef SLIP were added to separate target-specific 
 108          * code. For example, ARP code usless in SLIP target; serial I/O code is incompatible
 109          * with MONITOR51, that is used in CS8900 target. Targets are defined in the project options.
 110          */
 111          #ifdef CS8900
 112                  CSInit(&localmachine.localHW[0]);
 113                  arp_init();
 114          #endif
 115          #ifdef SLIP
                              com_initialize();
                              mputs("CLIENTSERVER");
                              while (base_timer < 50000) ;
              #endif
 120          
 121          
 122          /*
 123          * 3. All UDP and TCP DEMOs are working. SLIP target has more code memory, some
 124          * demos temporary moved to SLIP target.
 125          */
 126                  tcp_init();
 127          #ifdef SLIP
                      udp_init();
              /*
              * 4. BOOTP demonstration is working.
              * Uncomment to use bootp. it works. dont forget to build bootp.c
              */
              /*      bootpc_init(0);
                      bootpc_enable();*/
              
                      /* Initialize applications      */
                      udp_demo_init();
              #endif    
 139                  tcpc_demo_init();
 140                  tcps_demo_init();
 141                  https_init();
 142                  DEBUGOUT(">>>>>>>>>Entering to MAIN LOOP>>>>>>>>>\n\r");
 143            
 144                  /***    MAIN LOOP       ***/
 145              
 146                  while(1) {
 147                          /* take care of watchdog stuff */
 148                                  
 149                          /* do some stuff here
 150                          * .........
 151                          */
 152                   
 153                       
 154                          /* Try to receive Ethernet Frame        */
 155                  
 156                          if( NETWORK_CHECK_IF_RECEIVED() == TRUE )       {
 157                                          
 158                                  switch( received_frame.protocol) {
 159                                  
 160                                          case PROTOCOL_ARP:
 161                                                  process_arp(&received_frame);   
 162                                                  break;
 163                                  
 164                                  
C51 COMPILER V7.06   MAIN_DEMO                                                             11/26/2004 11:32:43 PAGE 4   

 165                                          case PROTOCOL_IP:                       
 166                                                  len = process_ip_in(&received_frame);
 167                                          
 168                                                  if(len < 0)
 169                                                          break;
 170                                          
 171                                                  switch(received_ip_packet.protocol){
 172                                                          case IP_ICMP:
 173                                                                  process_icmp_in (&received_ip_packet, len);                                     
 174                                                                  break;
 175          #ifdef SLIP
                                                                      case IP_UDP:
                                                                      process_udp_in (&received_ip_packet,len);
                                                                      break;
              #endif
 180                                                          case IP_TCP:
 181                                                                  process_tcp_in (&received_ip_packet, len);                              
 182                                                                          break;
 183                                                          default:
 184                                                                  break;
 185                                                  }
 186                                  break;
 187          
 188                                  default:
 189                                  
 190                                          break;
 191                          }
 192                          
 193                          /* discard received frame */                    
 194                          NETWORK_RECEIVE_END();
 195                  }
 196                   
 197                  /* Application main loops */
 198                  /* Do not forget this!!! These don't get invoked magically :-) */
 199          
 200                          tcps_demo_run();
 201                  tcpc_demo_run();
 202                          https_run();
 203          //              bootpc_run(); //uncomment to use bootp.
 204          #ifdef SLIP
                      udp_demo_run();
              #endif
 207          
 208                  /* TCP/IP stack Periodic tasks  */
 209                  /* Check possible overflow in Ethernet controller */
 210          //      NE2000CheckOverFlow(); //I don't have ne2000, nothing to check ;)
 211                  /* manage arp cache tables */
 212          #ifdef CS8900
 213                  arp_manage();
 214          #endif
 215                  /* manage opened TCP connections (retransmissions, timeouts,...)*/
 216          
 217          
 218                          tcp_poll();
 219              }
 220          }
 221          

C51 COMPILATION COMPLETE.  12 WARNING(S),  1 ERROR(S)

⌨️ 快捷键说明

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