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

📄 monitor.lst

📁 车载DVD osdIC TW8816原厂代码
💻 LST
📖 第 1 页 / 共 4 页
字号:
C51 COMPILER V7.50   MONITOR                                                               04/01/2008 15:02:20 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE MONITOR
OBJECT MODULE PLACED IN .\Output\monitor.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE monitor.c COMPACT OPTIMIZE(9,SIZE) BROWSE MODDP2 INCDIR(.\Include\) DEFINE(
                    -INTERNAL_MCU) DEBUG OBJECTEXTEND PRINT(.\Source\monitor.lst) OBJECT(.\Output\monitor.obj)

line level    source

   1          /* Monitor.c */
   2          
   3          #include "config.h"
   4          
   5          #ifdef SERIAL
   6          
   7          #include "typedefs.h"
   8          #include "main.h"
   9          #include "i2c.h"
  10          #include "dispinfo.h"
  11          #include "reg.h"
  12          #include "printf.h"
  13          //#include "dispinfo.h"
  14          //#include "video.h"
  15          //#include "eeprom.h"
  16          //#include "measure.h"
  17          #include "tw88.h"
  18          #include "etc_eep.h"
  19          #include "osdbasic.h"
  20          #include "monitor.h"
  21          #include "cpu.h"
  22          #include "Measure.h"
  23          
  24          #include "spi.h"
  25          
  26                  IDATA BYTE MonAddress = 0x8a;           // initialize value should be placed to IDATA area
  27                  BYTE MonIndex;
  28                  BYTE MonRdata, MonWdata;
  29          
  30          xdata BYTE monstr[30];          // buffer for input string
  31          BYTE *argv[7];
  32          BYTE argc=0;
  33          bit     echo=1;
  34          
  35          static bit indirect=0;
  36          
  37          extern            bit   AutoDetect;
  38          extern IDATA  BYTE InputSelection;
  39          extern        BYTE      DebugLevel;
  40          extern  CODE  struct struct_IdName struct_InputSelection[];
  41          
  42          void Loader(BYTE);
  43          
  44          //=============================================================================
  45          //
  46          //=============================================================================
  47          void Prompt(void)
  48          {
  49   1      #ifdef INTERNAL_MCU
  50   1      #ifdef BANKING
                      if ( MonAddress == TW88I2CAddress )
                              Printf("\r\n[B%1x]MCU_I2C[%02x]>", (WORD)BANKREG, (WORD)MonAddress);
                      else
              #else
C51 COMPILER V7.50   MONITOR                                                               04/01/2008 15:02:20 PAGE 2   

  55   1              if ( MonAddress == TW88I2CAddress )
  56   1                      Printf("\r\nMCU_I2C[%02x]>", (WORD)MonAddress);
  57   1              else
  58   1      #endif
  59   1      #endif
  60   1                      Printf("\r\nI2C[%02x]>", (WORD)MonAddress);
  61   1      }
  62          
  63          void Mon_tx(BYTE ch)
  64          {
  65   1              RS_tx(ch);
  66   1      }
  67          
  68          
  69          
  70          //=============================================================================
  71          //              Convert ASCII to Binery                                             
  72          //=============================================================================
  73          DWORD a2i(BYTE *str)
  74          {
  75   1              DWORD num=0;
  76   1              BYTE i;
  77   1      
  78   1              for(i=0; ; i++, str++) {
  79   2                      if( *str=='\0' || *str==' ' ) break;
  80   2                      num = num*10 + *str - '0';
  81   2              }
  82   1              return num;
  83   1      }
  84          
  85          BYTE Asc1Bin(BYTE asc)
  86          {
  87   1              if(asc>='0' && asc <='9') return (asc - '0');
  88   1              if(asc>='a' && asc <='f') return (asc - 'a' + 0x0a);
  89   1              if(asc>='A' && asc <='F') return (asc - 'A' + 0x0a);
  90   1      }
  91          
  92          BYTE Asc2Bin(PDATA_P BYTE *s)
  93          {
  94   1              BYTE bin;
  95   1      
  96   1              bin = 0;
  97   1              while(*s != '\0' && *s !=' ') {
  98   2                      bin = bin<<4;
  99   2                      bin = bin + Asc1Bin(*s);
 100   2                      s++;
 101   2              }
 102   1              return (bin);
 103   1      }
 104          
 105          //=============================================================================
 106          BYTE toupper(BYTE ch)
 107          {
 108   1              if( ch>='a' && ch<='z' )
 109   1                      return (ch - 'a' + 'A');
 110   1      }
 111          
 112          int stricmp(BYTE *ptr1, BYTE *ptr2)
 113          {
 114   1              int             i;
 115   1              int             ret;
 116   1              
C51 COMPILER V7.50   MONITOR                                                               04/01/2008 15:02:20 PAGE 3   

 117   1              for(i=0; *ptr1; i++) {
 118   2                      ret = toupper(*ptr1++) - toupper(*ptr2++);
 119   2                      if( ret ) return ret;
 120   2              }
 121   1              return 0;
 122   1      }
 123          
 124          //=============================================================================
 125          //
 126          //=============================================================================
 127          
 128          void SetMonAddress(BYTE addr)
 129          {
 130   1              MonAddress = addr;
 131   1      }
 132          
 133          void MonReadI2C(void)
 134          {
 135   1              if( argc>=2 ) MonIndex = Asc2Bin( argv[1] );
 136   1              else    {
 137   2                      Printf("   --> Missing parameter !!!");
 138   2                      return;
 139   2              }
 140   1      
 141   1              if ( MonAddress == TW88I2CAddress )
 142   1                      MonRdata = ReadTW88(MonIndex);
 143   1              else
 144   1                      MonRdata = ReadI2C(MonAddress, MonIndex);
 145   1      
 146   1              if( echo )
 147   1                      Printf("\r\nRead %2xh:%2xh", (WORD)MonIndex, (WORD)MonRdata);   
 148   1              
 149   1              MonWdata = MonRdata;
 150   1      }
 151          
 152          
 153          void MonWriteI2C(void)
 154          {
 155   1              if( argc<3 ) {
 156   2                      Printf("   --> Missing parameter !!!");
 157   2                      return;
 158   2              }
 159   1              
 160   1              MonIndex = Asc2Bin( argv[1] );
 161   1              MonWdata = Asc2Bin( argv[2] );
 162   1              
 163   1              if( echo ) {
 164   2                      Printf("\r\nWrite %2xh:%2xh ", (WORD)MonIndex, (WORD)MonWdata);
 165   2                      if ( MonAddress == TW88I2CAddress ) {
 166   3                              WriteTW88(MonIndex, MonWdata);
 167   3                              MonRdata = ReadTW88(MonIndex);
 168   3                      }
 169   2                      else {
 170   3                              WriteI2C(MonAddress, MonIndex, MonWdata);
 171   3                              MonRdata = ReadI2C(MonAddress, MonIndex);
 172   3                      }
 173   2                      Printf("==> Read %2xh:%2xh", (WORD)MonIndex, (WORD)MonRdata);
 174   2              }
 175   1              else {
 176   2                      if ( MonAddress == TW88I2CAddress ) {
 177   3                              WriteTW88(MonIndex, MonWdata);
 178   3                      }
C51 COMPILER V7.50   MONITOR                                                               04/01/2008 15:02:20 PAGE 4   

 179   2                      else {
 180   3                              WriteI2C(MonAddress, MonIndex, MonWdata);
 181   3                      }
 182   2              }
 183   1      }
 184          
 185          
 186          void MonIncDecI2C(BYTE inc)
 187          {
 188   1      
 189   1              switch(inc){
 190   2              case 0:  MonWdata--;    break;
 191   2              case 1:  MonWdata++;    break;
 192   2              case 10: MonWdata-=0x10;        break;
 193   2              case 11: MonWdata+=0x10;        break;
 194   2              }
 195   1      
 196   1      
 197   1              if ( MonAddress == TW88I2CAddress ) {
 198   2                      WriteTW88(MonIndex, MonWdata);
 199   2                      MonRdata = ReadTW88(MonIndex);
 200   2              }
 201   1              else {
 202   2                      WriteI2C(MonAddress, MonIndex, MonWdata);
 203   2                      MonRdata = ReadI2C(MonAddress, MonIndex);
 204   2              }
 205   1      
 206   1              if( echo ) {
 207   2                      Printf("Write %2xh:%2xh ", (WORD)MonIndex, (WORD)MonWdata);
 208   2                      Printf("==> Read %2xh:%2xh", (WORD)MonIndex, (WORD)MonRdata);
 209   2              }
 210   1      
 211   1              Prompt();
 212   1      
 213   1      }
 214          
 215          void MonDumpI2C(void)
 216          {
 217   1              BYTE ToMonIndex;
 218   1              int  cnt=8;
 219   1      
 220   1              if( argc>=2 ) MonIndex = Asc2Bin(argv[1]);
 221   1              if( argc>=3 ) ToMonIndex = Asc2Bin(argv[2]);
 222   1              else ToMonIndex = MonIndex+cnt;
 223   1              if ( ToMonIndex < MonIndex ) ToMonIndex = 0xFF;
 224   1              cnt = ToMonIndex - MonIndex + 1;
 225   1      
 226   1              if( echo ) {
 227   2                      if ( MonAddress == TW88I2CAddress ) {
 228   3                              for ( ; cnt > 0; cnt-- ) {
 229   4                                      MonRdata = ReadTW88(MonIndex);
 230   4                                      Printf("\r\n==> Read %2xh:%2xh", (WORD)MonIndex, (WORD)MonRdata);
 231   4                                      MonIndex++;
 232   4                              }
 233   3                      }
 234   2                      else {
 235   3                              for ( ; cnt > 0; cnt-- ) {
 236   4                                      MonRdata = ReadI2C(MonAddress, MonIndex);
 237   4                                      Printf("\r\n==> Read %2xh:%2xh", (WORD)MonIndex, (WORD)MonRdata);
 238   4                                      MonIndex++;
 239   4                              }
 240   3                      }
C51 COMPILER V7.50   MONITOR                                                               04/01/2008 15:02:20 PAGE 5   

 241   2              }
 242   1              else {
 243   2                      if ( MonAddress == TW88I2CAddress ) {
 244   3                              for ( ; cnt > 0; cnt-- ) {
 245   4                                      MonRdata = ReadTW88(MonIndex);
 246   4                                      MonIndex++;
 247   4                              }
 248   3                      }
 249   2                      else {
 250   3                              for ( ; cnt > 0; cnt-- ) {
 251   4                                      MonRdata = ReadI2C(MonAddress, MonIndex);
 252   4                                      MonIndex++;
 253   4                              }
 254   3                      }
 255   2              }
 256   1      }
 257          
 258          //-----------------------------------------------------------------------------
 259          
 260          void MonNewReadI2C(void)
 261          {
 262   1              BYTE Slave;
 263   1      
 264   1              if( argc>=3 ) MonIndex = Asc2Bin( argv[2] );
 265   1              else    {
 266   2                      Printf("   --> Missing parameter !!!");
 267   2                      return;
 268   2              }
 269   1              Slave = Asc2Bin(argv[1]);
 270   1      
 271   1              if ( Slave == TW88I2CAddress )
 272   1                      MonRdata = ReadTW88(MonIndex);
 273   1              else
 274   1                      MonRdata = ReadI2C(Slave, MonIndex);
 275   1      
 276   1              if( echo )
 277   1                      Printf("\r\n<R>%2x[%2x]=%2x", (WORD)Slave, (WORD)MonIndex, (WORD)MonRdata);

⌨️ 快捷键说明

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