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

📄 system.lst

📁 cs8900 c51应用
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.06   SYSTEM                                                                11/26/2004 11:32:44 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE SYSTEM
OBJECT MODULE PLACED IN .\8052-obj\system.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\system.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\system.lst) PREPRINT(.
                    -\8052-lst\system.i) OBJECT(.\8052-obj\system.obj)

stmt level    source

   1          /*
   2           *Copyright (c) 2000-2002 Viola Systems Ltd.
   3           *All rights reserved.
   4           *
   5           *Redistribution and use in source and binary forms, with or without 
   6           *modification, are permitted provided that the following conditions 
   7           *are met:
   8           *
   9           *1. Redistributions of source code must retain the above copyright 
  10           *notice, this list of conditions and the following disclaimer.
  11           *
  12           *2. Redistributions in binary form must reproduce the above copyright 
  13           *notice, this list of conditions and the following disclaimer in the 
  14           *documentation and/or other materials provided with the distribution.
  15           *
  16           *3. The end-user documentation included with the redistribution, if 
  17           *any, must include the following acknowledgment:
  18           *      "This product includes software developed by Viola 
  19           *      Systems (http://www.violasystems.com/)."
  20           *
  21           *Alternately, this acknowledgment may appear in the software itself, 
  22           *if and wherever such third-party acknowledgments normally appear.
  23           *
  24           *4. The names "OpenTCP" and "Viola Systems" must not be used to 
  25           *endorse or promote products derived from this software without prior 
  26           *written permission. For written permission, please contact 
  27           *opentcp@opentcp.org.
  28           *
  29           *5. Products derived from this software may not be called "OpenTCP", 
  30           *nor may "OpenTCP" appear in their name, without prior written 
  31           *permission of the Viola Systems Ltd.
  32           *
  33           *THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 
  34           *WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
  35           *MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
  36           *IN NO EVENT SHALL VIOLA SYSTEMS LTD. OR ITS CONTRIBUTORS BE LIABLE 
  37           *FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
  38           *CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
  39           *SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 
  40           *BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
  41           *WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
  42           *OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
  43           *EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  44           *====================================================================
  45           *
  46           *OpenTCP is the unified open source TCP/IP stack available on a series 
  47           *of 8/16-bit microcontrollers, please see <http://www.opentcp.org>.
  48           *
  49           *For more information on how to network-enable your devices, or how to 
  50           *obtain commercial technical support for OpenTCP, please see 
  51           *<http://www.violasystems.com/>.
  52           */
  53          
C51 COMPILER V7.06   SYSTEM                                                                11/26/2004 11:32:44 PAGE 2   

  54          /** \file system.c
  55           *      \brief Various OpenTCP system functions
  56           *      \author 
  57           *              \li Jari Lahti (jari.lahti@violasystems.com)
  58           *      \version 1.0
  59           *      \date 23.6.2002
  60           *      \bug
  61           *      \warning
  62           *      \todo
  63           *  
  64           *      This file contains system related functions and variables. See
  65           *      system.h for a list of function declarations, constants, etc.
  66           *
  67           */
  68          
  69          #include <inet/arch/config.h>
*** WARNING C318 IN LINE 69 OF ..\system.c: can't open file 'inet/arch/config.h'
  70          #include <inet/datatypes.h>
*** WARNING C318 IN LINE 70 OF ..\system.c: can't open file 'inet/datatypes.h'
  71          #include <inet/system.h>
*** WARNING C318 IN LINE 71 OF ..\system.c: can't open file 'inet/system.h'
  72          #include <inet/debug.h>
*** WARNING C318 IN LINE 72 OF ..\system.c: can't open file 'inet/debug.h'
  73          #include <inet/arch/at89s8252/serial-io.h>
*** WARNING C318 IN LINE 73 OF ..\system.c: can't open file 'inet/arch/at89s8252/serial-io.h'
  74          UINT32 base_timer;              /**< System 1.024 msec timer    */
*** ERROR C129 IN LINE 74 OF ..\SYSTEM.C: missing ';' before 'base_timer'
  75          
  76          UINT8 sleep_mode = 0;   /**< Used to store information about power-saving state we're in (if any) */
  77          
  78          /** \brief Transmit buffer used by all OpenTCP applications
  79           *
  80           *      This buffer is the transmit buffer used by all OpenTCP applications
  81           *      for sending of data. Please note the warnings below for correct usage
  82           *      of this buffer that ensures proper operation of the applications.
  83           *
  84           *      \warning
  85           *              \li <b>Transmit buffer start</b> - to avoid data copying, the TCP/IP
  86           *              stack will use first part of the net_buf buffer to add it's data. This
  87           *              means that applications using TCP and/or UDP <b>must not</b> write
  88           *              application-level data from the beginning of the buffer but from certain
  89           *              offset. This offset depends on the transport-layer protocol (it's
  90           *              header size that is). For TCP this value is defined by the
  91           *              TCP_APP_OFFSET and for the UDP it is UDP_APP_OFFSET.
  92           *              \li <b>Buffer sharing</b> - since all applications share this buffer among each other, 
  93           *              and with the TCP/IP stack as well, care must be taken not to
  94           *              overwrite other applications' data before it is sent. This is best
  95           *              achieved if all applications work in the main loop and when they
  96           *              wish to send data they fill in the buffer and send it immediately.
  97           *
  98           */
  99          UINT8 net_buf[NETWORK_TX_BUFFER_SIZE];  /* Network transmit buffer      */
 100          
 101          /********************************************************************************
 102          Function:               strlen
 103          
 104          Parameters:             UINT8* str - start address of string buffer
 105                                          UINT16 len - buffer length
 106                                          
 107          Return val:             INT16 - (-1) Not a string
 108                                                          (>=0) Length of string
 109                                          
C51 COMPILER V7.06   SYSTEM                                                                11/26/2004 11:32:44 PAGE 3   

 110          Date:                   12.8.2002
 111          
 112          Desc:                   Calculates the length of given string
 113          *********************************************************************************/
 114          
 115          
 116          INT16 strlen (UINT8* buf, UINT16 len)
 117          {
 118                  UINT16 i;
 119                  
 120                  for(i=0; i<len; i++) {
 121                          if(*buf == '\0')
 122                                  return( i );
 123                          
 124                          buf++;
 125                  }
 126                  
 127                  /* Not found    */
 128                  
 129                  return(-1);
 130          
 131          
 132          }
 133          
 134          
 135          /********************************************************************************
 136          Function:               bufsearch
 137          
 138          Parameters:             UINT8* startadr - start address of given buffer
 139                                          UINT16 len - buffer length
 140                                          UINT8* str - given searchstring
 141                                          
 142          Return val:             INT16 - (-1) Not found
 143                                                          (>=0) Start of matched string from startadr
 144                                          
 145          Date:                   12.7.2002
 146          
 147          Desc:                   Seeks given string from given buffer
 148          *********************************************************************************/
 149          
 150          INT16 bufsearch (UINT8* startadr, UINT16 len, UINT8* str)
 151          {
 152                  UINT16 i;
 153                  INT16 position;
 154                  UINT8 matchesneeded;
 155                  UINT8 matchesnow;
 156                  UINT8* target;
 157                  UINT8* key;
 158                  
 159                  target = startadr;
 160                  position = -1;
 161                  key = str;
 162                  matchesnow = 0;
 163                  matchesneeded = 0;
 164                  
 165                  /* How many matches we need?    */
 166                  
 167                  while( *key++ != '\0' ) {
 168                          /* Break possible deadlock      */
 169                          
 170                          matchesneeded++;
 171                          if(matchesneeded > 30)
C51 COMPILER V7.06   SYSTEM                                                                11/26/2004 11:32:44 PAGE 4   

 172                                  return(-1);
 173                  }
 174                  
 175                  /* Search for first mark and continue searching if found        */
 176                  
 177                  key = str;
 178                  
 179                  for(i=0; i<len; i++) {
 180                          if( *target == *key) {
 181                                  /* We found matching character          */
 182                                  
 183                                  matchesnow++;
 184                                  
 185                                  /* Move to next character of key        */
 186                                  
 187                                  key++;
 188                                  target++;
 189                                  
 190                                  if(matchesnow == 1) {
 191                                          /* First character match        */
 192                                          
 193                                          position = i;
 194                                  }
 195                                  
 196                                  if(matchesneeded == matchesnow) {
 197                                          /* Whole string matched */
 198                                          
 199                                          return(position);
 200                                  }
 201                                  
 202                          } else {
 203                          
 204                                  if( matchesnow != 0) {
 205                                          /* It wasn't a complete match...                                */
 206                                          /* Initialize counters and start again                  */
 207                                  
 208                                          matchesnow = 0;
 209                                          key = str;
 210                                  
 211                                          /* Move to next character of target after               */
 212                                          /* previous matching character                                  */
 213                                  
 214                                          target = startadr;
 215                                          target += position;
 216                                          target += 1;
 217                                  
 218                                          i = position;
 219                                  } else {
 220                                          /* Just continue searching the first match              */
 221                                          target++;
 222                                  }
 223                          }
 224                  
 225                  }
 226                  
 227                  /* No matches found...  */
 228                  
 229                  return(-1);
 230                  
 231          }
 232          
 233          
C51 COMPILER V7.06   SYSTEM                                                                11/26/2004 11:32:44 PAGE 5   

 234          /********************************************************************************
 235          Function:               tolower
 236          
 237          Parameters:             UINT8 ch - ASCII character to be converted lowercase
 238                                          
 239          Return val:             UINT8 - converted character
 240                                          
 241          Date:                   21.8.2002
 242          
 243          Desc:                   If ch is UPPERCASE letter it is converted to lowercase and 
 244                                          returned. Otherwise original character is returned
 245          *********************************************************************************/
 246          
 247          UINT8 tolower (UINT8 ch)
 248          {
 249                  if( (ch < 91) && (ch > 64) )
 250                          return(ch + 32);
 251                  
 252                  return(ch); 
 253          
 254          }
 255          
 256          
 257          /********************************************************************************
 258          Function:               toupper
 259          
 260          Parameters:             UINT8 ch - ASCII character to be converted UPPERCASE
 261                                          
 262          Return val:             UINT8 - converted character
 263                                          
 264          Date:                   21.8.2002
 265          
 266          Desc:                   If ch is lowercase letter it is converted to UPPERCASE and 
 267                                          returned. Otherwise original character is returned
 268          *********************************************************************************/
 269          
 270          UINT8 toupper (UINT8 ch)
 271          {
 272                  if( (ch < 123) && (ch > 96) )
 273                          return(ch - 32);
 274                  
 275                  return(ch); 
 276          
 277          }
 278          
 279          /* Is the given ASCII code numerical    */
 280          /* e.g. '0','1','2' ... '9'                             */
 281          
 282          UINT8 isnumeric (UINT8 ch)
 283          {
 284                  if( (ch < 58) && (ch > 47) )
 285                          return(1);
 286                  return(0);
 287          }

⌨️ 快捷键说明

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