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

📄 tw88.lst

📁 此程序为twell8806驱动程序
💻 LST
📖 第 1 页 / 共 5 页
字号:
C51 COMPILER V7.50   TW88                                                                  08/20/2007 10:23:35 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE TW88
OBJECT MODULE PLACED IN TW88.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE TW88.c COMPACT OPTIMIZE(9,SIZE)

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 "cc.h"
   9          #include "debug.h"
  10          #include "etc_eep.h"
  11          #include "pc_eep.h"
  12          #include "measure.h"
  13          #include "adc.h"
  14          #include "Printf.h"
  15          #include "rgbmix.h"             // for TW8801
  16          #include "panel.h"
  17          #include "osdmenu.h"
  18          #include "osdbasic.h"
  19          
  20          ///extern IDATA BYTE adc_i2c_address, CurrentADC;
  21          extern  BYTE  CheckBuf;
  22          
  23          //=============================================================================
  24          //                                              Auto Detect
  25          //=============================================================================
  26          void SetAutoDetectStd(void)
  27          {
  28   1              BYTE val;
  29   1      
  30   1      //      if( GetInputSelection()==COMPONENT ) return;
  31   1      
  32   1              dPuts("\r\nSetAutoDetectStd");
  33   1              val = 0x80 | GetPossibleAutoDetectStdEE();              //AutoDetectStd
  34   1              WriteDecoder(SDTR, val);                // SDTR
  35   1              val = ReadDecoder(SDT);                 // SDT
  36   1              WriteDecoder(SDT,  val | 0x07); // SDT
  37   1      }
  38          
  39          void ClearAutoDetectStd(BYTE std)
  40          {
  41   1              BYTE val;
  42   1      
  43   1      //      if( GetInputSelection()==COMPONENT ) return;
  44   1      
  45   1              dPuts("\r\nClearAutoDetectStd");
  46   1      
  47   1              val = ReadDecoder(SDT); // SDT
  48   1              val = (val & 0xf8) | std;
  49   1              WriteDecoder(SDT,  val );
  50   1      }
  51          //=============================================================================
  52          //                                              Auto Panel H Period Control
  53          //=============================================================================
  54          void AutoPHPCalEnable(void)
  55          {
C51 COMPILER V7.50   TW88                                                                  08/20/2007 10:23:35 PAGE 2   

  56   1              dPuts("\r\n +++++++++++++++++=>Auto PHP Enable");
  57   1              WriteDecoder( 0xb6, (ReadDecoder(0xb6) & 0x7f) );       // Auto PHP Enable
  58   1              WriteDecoder( 0xb2, ReadDecoder(0xb2) );
  59   1      
  60   1      }
  61          
  62          void AutoPHPCalDisable(void)
  63          {
  64   1              dPuts("\r\n +++++++++++++++++=>Auto PHP Disable");
  65   1              WriteDecoder( 0xb6, (ReadDecoder(0xb6) | 0x80) );       // Auto PHP Disable
  66   1              WriteDecoder( 0xb2, (ReadDecoder(0xb2)));
  67   1      
  68   1      }
  69          
  70          
  71          //=============================================================================
  72          //                              Video Input Functions   
  73          //=============================================================================
  74          #ifdef SUPPORT_TV
              BYTE IsVideoInput(void)
              {
                      if( ( ReadDecoder(CSTATUS) & 0xc0 )==0x40 ) 
                              return 1;
                      return 0;
              }
              
              #endif
  83          //=============================================================================
  84          //                              Detect Video System by Decoder
  85          //=============================================================================
  86          #ifndef ID_CHECK_BY_FW
  87          BYTE DetectDecoderInput(void)
  88          {
  89   1              BYTE std;
  90   1              BYTE val;
  91   1      
  92   1              //----- Check No Input
  93   1              val = ReadDecoder(CSTATUS);             // Decoder status Register
  94   1              if( (val & 0xc0) != 0x40 ) {    // no decoder input
  95   2                      std = NOINPUT;
  96   2                      return std;
  97   2              }
  98   1              //----- Check Color System by decoder
  99   1              val = ReadDecoder(SDT);                         // SDT
 100   1              if( val & 0x80 ) {                                      // Detection in proress
 101   2                      std = UNKNOWN;
 102   2              }
 103   1              else {
 104   2                      val >>= 4;
 105   2                      if( val==0x07 ) std = UNKNOWN;
 106   2                      else            std = val + 1;
 107   2              }
 108   1      
 109   1              return std;
 110   1      }
 111          #endif  // ID_CHECK_BY_FW
 112          
 113          //=============================================================================
 114          //                              Change Input 
 115          //=============================================================================
 116          #ifdef TW8804
 117          #define REG06           0x00
C51 COMPILER V7.50   TW88                                                                  08/20/2007 10:23:35 PAGE 3   

 118          #elif defined TW9908
              #define REG06           0x40
              #endif
 121          
 122          void COMPOSITEInput(void)
 123          {
 124   1              WriteDecoder(0x38, 0x8e);       // Test for new chip
 125   1      
 126   1              WriteDecoder(INFORM, 0x40);                     // 01 00 00 x x         27M, COMPOSITE, Y0, C-, V-
 127   1              
 128   1              WriteDecoder(ACNTL, REG06|0x03);        // CLK-on, Y-on, C-off, V(FB)-off       
 129   1      }
 130          
 131          #ifdef SUPPORT_SVIDEO
 132          void SVIDEOInput(void)
 133          {
 134   1              WriteDecoder(0x38, 0x8e);       // Test for new chip
 135   1              WriteDecoder(INFORM, 0x54);                     // 01 01 01 0 x         27M, S-VIDEO,   Y1, C0, --
 136   1              WriteDecoder(ACNTL, REG06|0x01);        // CLK-on, Y-on, C-on, V(FB)-off
 137   1      
 138   1      }
 139          #endif
 140          
 141          #ifdef SUPPORT_COMPONENT
 142          void COMPONENTInput(void)
 143          {
 144   1              WriteDecoder(0x38, 0x8e);       // Test for new chip
 145   1              WriteDecoder(INFORM, 0x7a);                     // 0 1 11 10 1 0                27M, COMPONENT, Y2, C1, V0
 146   1              WriteDecoder(ACNTL, REG06|0x00);        // CLK-on, Y-on, C-on, V(FB)-on
 147   1      
 148   1      //      WriteDecoder(0x35, 0x00);               //      V clamp Enable
 149   1      //      WriteDecoder(SDTR, 0x03);               
 150   1      }
 151          #endif
 152          
 153          #ifdef SUPPORT_TV
              void TVInput(void)
              {
                      BYTE val;
              
                      WriteDecoder(0x38, 0x8e);       // Test for new chip
                      WriteDecoder(INFORM, 0x48);                     // 01 00 11 x x         27M, COMPOSITE, Y2, C-, V-
                      WriteDecoder(ACNTL, REG06|0x03);        // CLK-on, Y-on, C-off, V(FB)-off
              
                      val = ReadDecoder(MISC3);                       // clear blue screen
                      val &= 0xf9;                                            // xxxx x00x
                      WriteDecoder(MISC3, val);
              
                      //WriteDecoder(RGBMISC, 0x05 );                                                 // 39: 0000 0101 Select RGB, FB control
                      //WriteDecoder(FBCONTRL, 0x00);         // FB Type: Analog 
              
              }
              #endif  // SUPPORT_TV
 171          
 172          #ifdef SUPPORT_PC
 173          void AVGAInput(void)
 174          {
 175   1              MakeStartInt();
 176   1      
 177   1              WriteDecoder(ACNTL, REG06|0x00);        // CLK-on, Y-on, C-on, V(FB)-on
 178   1              WriteDecoder(INFORM, 0xed);     // Y3,C2,V1
 179   1      
C51 COMPILER V7.50   TW88                                                                  08/20/2007 10:23:35 PAGE 4   

 180   1              SetADCMode(PC);                         // Load Inital Data
 181   1      
 182   1              //GetADCGainOffsetEE();                 // ADC gain & offset
 183   1              GetInitPanelAttribute1();               // Panel Brightness / Contrast
 184   1      
 185   1              SelectPanelAttrRegGroup(GROUP_RGB);
 186   1              WriteDecoder(0x77, 0x00);                       // Panel sharpness=0
 187   1              WriteDecoder(0x78, 0x00);                       // 
 188   1      
 189   1              WriteDecoder(0x86, 0x00);                       // Black/White stretsh Disable
 190   1              WriteDecoder(0x87, 0xff);                       // 
 191   1      
 192   1              //SelectADCmux(PC);
 193   1      }
 194          #endif // SUPPORT_PC
 195          
 196          #ifdef SUPPORT_DTV
              void DTVInput(void)
              {
                      MakeStartInt();
              
                      WriteDecoder(ACNTL, REG06|0x00);        // CLK-on, Y-on, C-on, V(FB)-on
                      WriteDecoder(INFORM, 0xed);     // Y3,C2,V1
                      SetADCMode(DTV);
              
                      //GetADCGainOffsetForDTVEE();           // ADC gain & offset
                      //GetInitPanelAttribute1();             // Panel Brightness / Contrast
                      //GetInitPanelAttribute2();             // Panel Hue / Sharpness / Saturation
              
                      SelectPanelAttrRegGroup(GROUP_YCbCr);
                      //WriteDecoder(0x77, 0x30);                     // Panel sharpness=0
                      SetVideoMode( GetVideoModeEE());
              
                      //SelectADCmux(DTV);
              }
              #endif  // SUPPORT_DTV
 216          
 217          //=============================================================================
 218          //                                   Power Functions   
 219          //=============================================================================
 220          BYTE GetLCDPowerState(void)
 221          {
 222   1              BYTE val;
 223   1      
 224   1              val = ReadDecoder(0xd5);
 225   1              val &= 0x30;
 226   1              val >>= 4;
 227   1              return val;
 228   1      }
 229          
 230          void SetLCDPowerState(BYTE dat)
 231          {
 232   1              WriteDecoder( 0xd4, 0x01 );     // timer prescaler
 233   1              WriteDecoder( 0xd6, 0x11 );     // suspend->standby             on->suspend 
 234   1              WriteDecoder( 0xd7, 0x11 );     // off->standby(!)              standby->off
 235   1              WriteDecoder( 0xd8, 0x11 );     // standby->suspend(*)  suspend->on                     
 236   1              
 237   1              WriteDecoder( 0xd5, dat );              // Auto Power
 238   1      }
 239          
 240          /*
 241          BYTE IsFreeRun(void)
C51 COMPILER V7.50   TW88                                                                  08/20/2007 10:23:35 PAGE 5   

 242          {
 243                  BYTE val;
 244          
 245                  val = ReadDecoder(0xbe);
 246                  if( val & 0x04 ) return 1;
 247                  else             return 0;
 248          }
 249          */
 250          
 251          void PanelFreeRun(BYTE on)
 252          {
 253   1              BYTE val;
 254   1              #ifndef QVGA
 255   1              if( on ) AutoPHPCalDisable();
 256   1              else AutoPHPCalEnable();
 257   1              #endif
 258   1      
 259   1              val = ReadDecoder(0xbe);
 260   1              if( on ) val |= 0x04;
 261   1              else     val &= 0xfb;
 262   1      
 263   1              WriteDecoder(0xbe, val);
 264   1      
 265   1      }
 266          
 267          void PanelBlack(BYTE on)
 268          {
 269   1              BYTE val, tmp;
 270   1      
 271   1              tmp = ReadDecoder(0xff);
 272   1              WriteDecoder(0xff, 0x01);
 273   1      
 274   1              val = ReadDecoder(0xf3);
 275   1              if( on ) val |= 0x20;
 276   1              else     val &= 0xdf;
 277   1      
 278   1              WaitEndofDisplayArea(); 
 279   1              WriteDecoder(0xf3, val);
 280   1      
 281   1              WriteDecoder(0xff, tmp);
 282   1      }
 283          
 284          void PanelMute(BYTE on)
 285          {
 286   1              if( on ){       // Mute
 287   2                      PanelBlack(on);
 288   2                      PanelFreeRun(on);
 289   2              }
 290   1              else
 291   1              {       // Recover
 292   2                      PanelFreeRun(on);
 293   2                      PanelBlack(on);
 294   2              }
 295   1      }
 296          
 297          // TW8806 Board : Control LVDS En by GPIO2.
 298          // TW8806B Board : Control LVDS En by GPIO0.
 299          
 300          void ON_LVDS(void)
 301          {
 302   1              #if (defined WVGA) || (defined WQVGA)
 303   1      
C51 COMPILER V7.50   TW88                                                                  08/20/2007 10:23:35 PAGE 6   

⌨️ 快捷键说明

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