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

📄 tw88.lst

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


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

line level    source

   1          #include "Config.h"
   2          
   3          #include "reg.h"
   4          #include "typedefs.h"
   5          #include "i2c.h"
   6          #include "main.h"
   7          #include "tw88.h"
   8          #include "etc_eep.h"
   9          #include "pc_eep.h"
  10          #include "measure.h"
  11          #include "adc.h"
  12          #include "CPU.h"
  13          #include "Printf.h"
  14          #include "rgbmix.h"             // for TW8801
  15          #include "panel.h"
  16          #include "osdmenu.h"
  17          #include "osdbasic.h"
  18          #include "Dispinfo.h"
  19          #include "Tuner.h"
  20          #include "Audio.h"
  21          
  22          ///extern IDATA BYTE adc_i2c_address, CurrentADC;
  23          extern  BYTE  CheckBuf;
  24          extern     CODE struct _PANELDATA PanelData; // Hans
  25          extern            BYTE  VInputStdDetectMode; // Hans
  26          extern            BYTE  DebugLevel;
  27          extern  IDATA BYTE  PcMode;
  28          extern  CODE struct _PCMDATA  PCMDATA[];
  29          extern     IDATA BYTE InputSelection;
  30          
  31          CODE BYTE cModeIndex[] =
  32          {
  33          EE_YPbPr_480I,
  34          EE_YPbPr_576I,
  35          EE_YPbPr_480P,
  36          EE_YPbPr_576P,
  37          };
  38          
  39          // UNKNOWN                              0
  40          // COMPOSITE                    1
  41          // SVIDEO                               2
  42          // COMPONENT                    3
  43          // DTV                                  4
  44          // TV                                   5
  45          // SCART                                6
  46          // PC                                   7
  47          // DIGITALVGA                   8
  48          CODE struct _INPUT_MATRIX InputMatrix[] = 
  49          {
  50          // cYSEL,     cCSEL,     cVSEL,     cIFSEL,                cDataOrder,             cDataFormat,   cInputRo
             -ute
  51          {    YIN0,      NOTUSE,  NOTUSE,  D_VIDEO,            ORDER_RGB_YPbPr,  IF_YUV_444,    IS_DECODER}, // unk
             -nown  default to COMPOSITE
  52          {    YIN0,      NOTUSE,  NOTUSE,  D_VIDEO,            ORDER_RGB_YPbPr,  IF_YUV_444,    IS_DECODER}, // COM
C51 COMPILER V7.50   TW88                                                                  04/01/2008 15:02:37 PAGE 2   

             -POSITE
  53          {    YIN1,      CIN0,       NOTUSE,  D_SVIDEO,          ORDER_RGB_YPbPr,  IF_YUV_444,    IS_DECODER}, // S
             -VIDEO
  54          {    YIN2,      CIN1,       VIN0,      D_COMPONENT_P, ORDER_RGB_YPbPr,  IF_YUV_444,    IS_DECODER}, // COM
             -PONENT
  55          {    NOTUSE, NOTUSE,  NOTUSE,  D_UNUSED,           ORDER_GBR_PbPrY,  IF_ITU656,      IS_DTV},          // 
             -DTV
  56          {    YIN1,      NOTUSE,  NOTUSE,  D_VIDEO,             ORDER_RGB_YPbPr,  IF_YUV_444,    IS_DECODER}, // TV
  57          {    NOTUSE, NOTUSE,  NOTUSE,  D_VIDEO,             ORDER_RGB_YPbPr,  IF_YUV_444,    IS_DECODER}, // SCART
             -  //not used
  58          {    YIN3,      CIN2,       VIN1,      D_UNUSED,           ORDER_RGB_YPbPr,  IF_RGB_444,    IS_ADC},      
             -   // PC
  59          {    NOTUSE, NOTUSE,  NOTUSE,  D_UNUSED,           ORDER_GBR_PbPrY,  IF_RGB_444,    IS_DTV},          // D
             -IGITALVGA  //not used
  60          };
  61          
  62          CODE struct _DECODER_FORMAT DecoderFormat[] = {
  63          //ScaleWidth, ScaleHeight, HActive, VActive, HDelay, VDelay
  64          { 690,          228,                    720,     240,      0x16,     0x15},  // 480i  
  65          { 690,          278,                    720,     288,      0x16,     0x16},  // 576i
  66          { 622,          460,                    720,     480,      0x40,     0x2A},  // 480P  
  67          { 630,          538,                    720,     576,      0x3f,     0x31},  // 576P
  68          };
  69          
  70          BYTE IsDecoderSource(void)
  71          {
  72   1              BYTE Temp = ReadTW88(0x44);
  73   1      
  74   1              if ((Temp & 0x03) == 0)
  75   1                      return TRUE; //Internal analog video decoder
  76   1              else
  77   1                      return FALSE;
  78   1      }
  79          //=============================================================================
  80          //                                              Auto Detect
  81          //=============================================================================
  82          void SetAutoDetectStd(void)
  83          {
  84   1              BYTE val;
  85   1      
  86   1      //      if( GetInputSelection()==COMPONENT ) return;
  87   1      
  88   1              dPuts("\r\nSetAutoDetectStd");
  89   1              val = 0x80 | GetPossibleAutoDetectStdEE();              //AutoDetectStd
  90   1              WriteDecoder(SDTR, val);                // SDTR
  91   1              val = ReadDecoder(SDT);                 // SDT
  92   1              WriteDecoder(SDT,  val | 0x07); // SDT
  93   1      }
  94          
  95          #ifdef SUPPORT_TV
  96          void ClearAutoDetectStd(BYTE std)
  97          {
  98   1              BYTE val;
  99   1      
 100   1      //      if( GetInputSelection()==COMPONENT ) return;
 101   1      
 102   1              dPuts("\r\nClearAutoDetectStd");
 103   1      
 104   1              val = ReadDecoder(SDT); // SDT
 105   1              val = (val & 0xf8) | std;
 106   1              WriteDecoder(SDT,  val );
 107   1      }
C51 COMPILER V7.50   TW88                                                                  04/01/2008 15:02:37 PAGE 3   

 108          #endif
 109          //=============================================================================
 110          //                                              Auto Panel H Period Control
 111          //=============================================================================
 112          void AutoPHPCalEnable(void)
 113          {
 114   1              dPuts("\r\n +++++++++++++++++=>Auto PHP Enable");
 115   1              WriteDecoder( 0xb6, (ReadDecoder(0xb6) & 0x7f) );       // Auto PHP Enable
 116   1              WriteDecoder( 0xb2, ReadDecoder(0xb2) );
 117   1      
 118   1      }
 119          
 120          void AutoPHPCalDisable(void)
 121          {
 122   1      #if 1
 123   1              BYTE cTemp = ReadDecoder(0xb6);
 124   1              dPuts("\r\n +++++++++++++++++=>Auto PHP Disable");
 125   1             cTemp |= 0x80; // Auto PHP Disable
 126   1             cTemp &= 0xf0; // clear High four bits of hperiod
 127   1             cTemp |= (BYTE)((PanelData.HPeriod & 0xf00) >> 8);
 128   1              WriteTW88(0xb6, cTemp);
 129   1              WriteTW88(0xb2, (PanelData.HPeriod & 0xff));    
 130   1      #else   
                      dPuts("\r\n +++++++++++++++++=>Auto PHP Disable");
                      WriteDecoder( 0xb6, (ReadDecoder(0xb6) | 0x80) );       // Auto PHP Disable
                      WriteDecoder( 0xb2, (ReadDecoder(0xb2)));
              #endif  
 135   1      
 136   1      }
 137          
 138          
 139          //=============================================================================
 140          //                              Video Input Functions   
 141          //=============================================================================
 142          #ifdef SUPPORT_TV
 143          BYTE IsVideoInput(void)
 144          {
 145   1              if( ( ReadDecoder(CSTATUS) & 0xc0 )==0x40 ) 
 146   1                      return 1;
 147   1              return 0;
 148   1      }
 149          #endif
 150          
 151          //=============================================================================
 152          //                              Detect Video System by Decoder
 153          //=============================================================================
 154          #ifndef ID_CHECK_BY_FW
 155          BYTE DetectDecoderInput(void)
 156          {
 157   1              BYTE std;
 158   1              BYTE val;
 159   1      
 160   1              //----- Check No Input
 161   1              val = ReadDecoder(CSTATUS);             // Decoder status Register
 162   1              if( (val & 0xc0) != 0x40 ) {    // no decoder input
 163   2                      std = NOINPUT;
 164   2                      return std;
 165   2              }
 166   1              //----- Check Color System by decoder
 167   1              val = ReadDecoder(SDT);                         // SDT
 168   1              if( val & 0x80 ) {                                      // Detection in proress
 169   2                      std = UNKNOWN;
C51 COMPILER V7.50   TW88                                                                  04/01/2008 15:02:37 PAGE 4   

 170   2              }
 171   1              else {
 172   2                      val >>= 4;
 173   2                      if( val==0x07 ) std = UNKNOWN;
 174   2                      else            std = val + 1;
 175   2              }
 176   1      
 177   1              return std;
 178   1      }
 179          #endif  // ID_CHECK_BY_FW
 180          
 181          //=============================================================================
 182          //                                   Power Functions   
 183          //=============================================================================
 184          BYTE GetLCDPowerState(void)
 185          {
 186   1              BYTE val;
 187   1      
 188   1              val = ReadDecoder(0xd5);
 189   1              val &= 0x30;
 190   1              val >>= 4;
 191   1              return val;
 192   1      }
 193          
 194          void PanelFreeRun(BYTE on)
 195          {
 196   1              BYTE val;
 197   1              #ifndef QVGA
 198   1              if( on ) AutoPHPCalDisable();
 199   1              else AutoPHPCalEnable();
 200   1              #endif
 201   1      
 202   1              val = ReadDecoder(0xbe);
 203   1              if( on ) val |= 0x04;
 204   1              else     val &= 0xfb;
 205   1      
 206   1              WriteDecoder(0xbe, val);
 207   1      
 208   1      }
 209          
 210          void PanelBlack(BYTE on)
 211          {
 212   1              BYTE val, tmp;
 213   1      
 214   1              tmp = ReadDecoder(0xff);
 215   1              WriteDecoder(0xff, 0x01);
 216   1      
 217   1              val = ReadDecoder(0xf3);
 218   1      //      val = ReadDecoder(0xB4);
 219   1              if( on ) val |= 0x20;
 220   1              else     val &= 0xdf;
 221   1      
 222   1              WaitEndofDisplayArea(); 
 223   1              WriteDecoder(0xf3, val);
 224   1      //      WriteDecoder(0xB4, val);
 225   1      
 226   1              WriteDecoder(0xff, tmp);
 227   1      }
 228          
 229          void PanelMute(BYTE on)
 230          {
 231   1              if( on ){       // Mute
C51 COMPILER V7.50   TW88                                                                  04/01/2008 15:02:37 PAGE 5   

 232   2                      PanelBlack(on);
 233   2                      PanelFreeRun(on);
 234   2              }
 235   1              else
 236   1              {       // Recover
 237   2                      PanelFreeRun(on);
 238   2                      PanelBlack(on);
 239   2              }
 240   1      }
 241          
 242          void ON_LVDS(void)
 243          {
 244   1              #ifdef TICONLESS
              
                      #else
 247   1              BYTE val;
 248   1              val = ReadDecoder(0x4e);
 249   1              WriteDecoder(0x4e, val|0x10);   // GPIO0 En
 250   1      
 251   1              val = ReadDecoder(0x4f) & 0xf9;
 252   1              WriteDecoder(0x4f, val | 0x08);         // GPIO0 = 1
 253   1      #ifdef INTERNAL_MCU
 254   1             P2_0 = 1;
 255   1      #endif
 256   1              dPuts("\r\n--ON_LVDS"); 
 257   1              #endif
 258   1      }
 259          
 260          void OFF_LVDS(void)
 261          {
 262   1              #ifdef TICONLESS
              
                      #else
 265   1              BYTE val;
 266   1              val = ReadDecoder(0x4e);
 267   1              WriteDecoder(0x4e, val&~(0x10));        // GPIO0 En
 268   1      
 269   1              val = ReadDecoder(0x4f) & 0xf0;//0xf9;
 270   1              WriteDecoder(0x4f, val | 0x09);         // GPIO0 = 0
 271   1      #ifdef INTERNAL_MCU
 272   1             P2_0 = 0;
 273   1      #endif
 274   1              dPuts("\r\n--OFF_LVDS");        
 275   1              #endif

⌨️ 快捷键说明

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