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

📄 pc_eep.lst

📁 车载DVD osdIC TW8816原厂代码
💻 LST
字号:
C51 COMPILER V7.50   PC_EEP                                                                04/01/2008 15:02:29 PAGE 1   


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

line level    source

   1          //pc_eep.c
   2          //=========================================================================
   3          //      EEPROM structure
   4          
   5          //      0x80    ----------- PC Color Temp Data --------------------------------
   6          //                      0       PC Color Temp Mode
   7          //                      1       R G B for Mode 1
   8          //                      4       R G B for Mode 2
   9          //                      7   R G B for Mode 3
  10          //                      A       R G B for User Mode
  11          //
  12          //      0x90    ----------- PC Input ------------------------------------------
  13          //
  14          //                      0       ADC Coarse
  15          //                      1       ADC Phase
  16          //                      2       Vertical Active Start
  17          //                      3       Horizontal Active Start
  18          //
  19          
  20          #include "Config.h"
  21          
  22          #if defined( SUPPORT_PC ) || defined( SUPPORT_DTV )
  23          
  24          #include "typedefs.h"
  25          #include "main.h"
  26          #include "i2c.h"
  27          #include "pc_eep.h"
  28          #include "printf.h"
  29          #include "TW88.h"
  30          #include "measure.h"
  31          #include "adc.h"
  32          #include "osdmenu.h"
  33          #include "etc_eep.h"
  34          #include "panel.h"
  35          
  36          extern  CODE struct _PCMDATA  PCMDATA[];
  37          extern     CODE struct _PANELDATA PanelData; // Hans
  38          
  39          extern  IDATA BYTE  PcMode, PcModeLast;
  40          extern  IDATA WORD  IVF;
  41          extern  IDATA DWORD     IHF;
  42          
  43          ///extern       IDATA BYTE      CurrentADC;
  44          
  45          WORD GetVactiveStartEE(BYTE mode)
  46          {
  47   1              WORD index;
  48   1              WORD start;
  49   1      
  50   1              index = EE_PCDATA + mode*LEN_PCDATA + 2;
  51   1              start = PCMDATA[mode].Vstart + (char)ReadEEP(index);
  52   1      
  53   1              return start;
  54   1      }
C51 COMPILER V7.50   PC_EEP                                                                04/01/2008 15:02:29 PAGE 2   

  55          
  56          WORD GetHactiveStartEE(BYTE mode)
  57          {
  58   1              WORD index;
  59   1              WORD start;
  60   1      
  61   1              index = EE_PCDATA + mode*LEN_PCDATA + 4;
  62   1              start = PCMDATA[mode].Hstart + (char)ReadEEP(index);
  63   1      
  64   1              return start;
  65   1      }
  66          
  67          // check whether the mode was saved
  68          BYTE IsModeSaved(BYTE mode)
  69          {
  70   1              WORD index;
  71   1              BYTE   cTemp;
  72   1      
  73   1              index = EE_PCDATA + mode*LEN_PCDATA + 1; // share the storage byte with phase
  74   1              cTemp = ReadEEP(index);
  75   1              cTemp &= 0xE0; // mode save identify value is saved in bit5-bit7 
  76   1      #ifdef DEBUG_PC
  77   1              dPrintf("\r\n IsModeSaved flag ----------%02x", (WORD)cTemp);
  78   1      #endif
  79   1              if (cTemp == 0x40)
  80   1                      return TRUE;
  81   1              else
  82   1                      return FALSE;
  83   1      }
  84          
  85          //-----------------------------------------------------------------------------
  86          //                      Get PC Function Data from EEPROM
  87          //-----------------------------------------------------------------------------
  88          void GetPCDataEE(BYTE mode)
  89          {
  90   1              char dat=0;                     // must be signed char
  91   1              WORD index, temp;
  92   1      #ifndef WIDE_SCREEN
                      DWORD scale, pres;
              #endif
  95   1              extern bit Flag4Bypass;
  96   1              WORD hstart, vstart;
  97   1      
  98   1              vstart = PCMDATA[mode].Vstart;
  99   1              hstart = PCMDATA[mode].Hstart;
 100   1      
 101   1              index = EE_PCDATA + mode*LEN_PCDATA;
 102   1      
 103   1              //--------------------------------------------
 104   1      
 105   1              // PPF
 106   1      //      ChangeInternPLL(PCMDATA[mode].PPF * 100000L);
 107   1      
 108   1              // ADC PLL-----(0)
 109   1              if( !IsDTVInput() ) dat = ReadEEP(index);
 110   1      
 111   1              if(GetInputSelection()==PC) WriteADC(0xc1, 0x30);
 112   1             // pll of ADC
 113   1              SetCoarse( dat + PCMDATA[mode].CLOCK );
 114   1      
 115   1              if(GetInputSelection()==PC) WriteADC(0xc1, 0x20);
 116   1      
C51 COMPILER V7.50   PC_EEP                                                                04/01/2008 15:02:29 PAGE 3   

 117   1              // ADC Phase---(1)
 118   1              dat = ReadEEP(index+1);
 119   1              dat &= 0x1F; //  phase was saved in bit0 t0 bit4
 120   1              if( !IsDTVInput() ) 
 121   1              SetPhase( dat );
 122   1      
 123   1              // Vertical----(2)
 124   1              #ifdef DEBUG_PC
 125   1              dPrintf("\r\n  vstart(before add ReadEEP): %d", (WORD)vstart);
 126   1              #endif
 127   1              if( !IsDTVInput() ) 
 128   1              vstart += (char)ReadEEP(index+2);
 129   1              #ifdef DEBUG_PC
 130   1              dPrintf("\r\n  vstart(after add ReadEEP): %d", (WORD)vstart);
 131   1              #endif
 132   1              
 133   1              SetVactiveStart( vstart );
 134   1              if( IsDTVInput() ) {
 135   2                      SetVactiveLen( PCMDATA[mode].VAN+20 );
 136   2              }
 137   1              else
 138   1                      SetVactiveLen( PCMDATA[mode].VAN );
 139   1      
 140   1              SetVValueForPanel(vstart);                      // Vstart
 141   1      
 142   1              dat=0;
 143   1              // VBackPorch--(3)
 144   1              if( !IsDTVInput() ) 
 145   1              dat = (char)ReadEEP(index+3);
 146   1              dat += PCMDATA[mode].VBack;
 147   1              dat -= ReadTW88(0xb8);                          // VOsync value compensation
 148   1              #ifdef DEBUG_PC
 149   1              dPrintf("\r\nSetVBackPorch( %d )", (WORD)dat);
 150   1              #endif
 151   1       #ifdef WQVGA
 152   1              SetVBackPorch(PanelData.VBackporch);
 153   1      #else
                      SetVBackPorch( dat );
              #endif
 156   1      
 157   1              // Horizontal--(4)
 158   1              if( !IsDTVInput() ) 
 159   1                      hstart += (char)ReadEEP(index+4);
 160   1              temp = hstart + PCMDATA[mode].HAN + 20;
 161   1      
 162   1              #ifdef DEBUG_PC
 163   1              dPrintf("\r\n  hstart(after add ReadEEP): %d,  pcmode: %d ", (WORD)hstart, (WORD)mode);
 164   1              #endif
 165   1      
 166   1              SetHactiveStart( hstart );
 167   1      
 168   1              if( IsDTVInput() ) temp += 3;
 169   1      
 170   1              SetHactiveEnd( temp );
 171   1              SetHValueForPanel();
 172   1      
 173   1      #ifdef WIDE_SCREEN
 174   1              Set4WideScreen(GetWideModeEE());
 175   1      #else
                      pres=(DWORD)PVR_;
                      scale = (PCMDATA[mode].VAN * 0x10000L) / pres;
                      
C51 COMPILER V7.50   PC_EEP                                                                04/01/2008 15:02:29 PAGE 4   

                      if( scale==0x10000 && Flag4Bypass )             // Bypass
                              BypassZoom();
                      else {
                              Clear_bypass();
                              YScale2(scale);                                         // save V Scale Up Factor
                      }
              
                      if( (PCMDATA[mode].VAN != GetPVR()) || !Flag4Bypass) {
                              pres = GetPHR();
                              scale = (PCMDATA[mode].HAN * 0x10000L + pres/2) / pres; // 256*han/phr
              
                              #ifdef DEBUG_EEP
                              dPrintf("\r\nXscaleFactor:%04x(%d)", scale, scale);
                              #endif
              
                              if( PCMDATA[mode].HAN > 1024 ) {
                                      scale = (PCMDATA[mode].HAN * 0x80L ) / 1024 + 1;                // (HAN/1024)*256
                                      XscaleD(scale);
                      
                                      #ifdef DEBUG_EEP
                                      dPrintf("\r\nXscaleFactorD:%04x(%d)", scale, scale);
                                      #endif
              
                                      scale = (1024 * 0x10000L ) / 1280;                                              // (1024/PHR)*256
                                      XscaleU(scale);
              
                                      #ifdef DEBUG_EEP
                                      dPrintf("\r\nXscaleFactorU:%04x(%d)", scale, scale);
                                      #endif
                              }
                              else
                                      XScale2(scale);
              
                      }
              #endif  
 214   1      
 215   1              AutoPHPCalEnable();
 216   1      
 217   1              DisplayResultAndSetActiveRange();
 218   1              
 219   1      }
 220          //=============================================================================
 221          //                      Save PC Function Data to EEPROM
 222          //=============================================================================
 223          
 224          void SavePCDataEE(BYTE mode)
 225          {
 226   1              WORD index;
 227   1             BYTE   cTemp = 0;
 228   1                 
 229   1              index = EE_PCDATA + mode*LEN_PCDATA ;
 230   1      
 231   1              #ifdef DEBUG_EEP
                      dPrintf("\r\nSave PC DATA mode(%d) index(%04x) IHF(%ld)", (WORD)mode, (WORD)index, IHF );
                      dPrintf(" IVF(%d) PPF(%dM)", IVF, (WORD)(GetPPF()/1000000) ); 
                      #endif
 235   1      
 236   1              cTemp = GetPhaseCurrent();
 237   1              cTemp &= 0x1F; // clear bit5-bit7 for mode saved flag
 238   1              cTemp |= 0x40; // set mode saved flag;
 239   1              WriteEEP( index++, (char)( GetCoarse() - PCMDATA[mode].CLOCK) );
 240   1              WriteEEP( index++,         cTemp);
C51 COMPILER V7.50   PC_EEP                                                                04/01/2008 15:02:29 PAGE 5   

 241   1              WriteEEP( index++, (char)( GetVactiveStart() - PCMDATA[mode].Vstart) );
 242   1              WriteEEP( index++, (char)( ReadTW88(0xb8) + GetVBackPorch()  - PCMDATA[mode].VBack) );  //VOsync compensat
             -ion
 243   1              WriteEEP( index++, (char)( GetHactiveStart() - PCMDATA[mode].Hstart) );
 244   1      }
 245          
 246          //=============================================================================
 247          void SaveDefaultPCDataEE(void)
 248          {
 249   1              WORD    index, i;
 250   1      
 251   1              index = EE_PCDATA + PcMode*LEN_PCDATA;
 252   1      
 253   1              for(i=0; i<LEN_PCDATA; i++) {
 254   2                      WriteEEP( index++, 0 );
 255   2                      delay(1);
 256   2              }
 257   1      }
 258          
 259          void SaveDefaultPCDataAllEE(void)
 260          {
 261   1              for(PcMode=0; PcMode<EE_PC_MAX; PcMode++)
 262   1                      SaveDefaultPCDataEE();
 263   1      }
 264          
 265          void SaveCoarseEE(BYTE mode)
 266          {
 267   1              WORD    index;
 268   1      
 269   1              index = EE_PCDATA + mode*LEN_PCDATA + 0;
 270   1              WriteEEP( index, (char)(GetCoarse() - PCMDATA[mode].CLOCK) );
 271   1      }
 272          
 273          void SavePhaseEE(BYTE mode)
 274          {
 275   1              WORD    index;
 276   1              BYTE       cTemp;
 277   1      
 278   1              index = EE_PCDATA + mode*LEN_PCDATA + 1;
 279   1              cTemp = ReadEEP(index);
 280   1              cTemp &= 0xE0; // clear bit0-bit4 for phase save
 281   1              cTemp |= GetPhaseCurrent();
 282   1              WriteEEP( index,  cTemp);
 283   1      }
 284          
 285          //=============================================================================
 286          
 287          void SaveVactiveEE(BYTE mode)
 288          {
 289   1              WORD    index;
 290   1      
 291   1              index = EE_PCDATA + mode*LEN_PCDATA + 2;
 292   1              WriteEEP( index, (char)(GetVactiveStart() - PCMDATA[mode].Vstart) );
 293   1      }
 294          
 295          void SaveVBackPorchEE(BYTE mode)
 296          {
 297   1              WORD    index;
 298   1      
 299   1              index = EE_PCDATA + mode*LEN_PCDATA + 3;
 300   1              WriteEEP( index, (char)(GetVBackPorch() - PCMDATA[mode].VBack) );
 301   1      
C51 COMPILER V7.50   PC_EEP                                                                04/01/2008 15:02:29 PAGE 6   

 302   1      }
 303          
 304          void SaveHactiveEE(BYTE mode)
 305          {
 306   1              WORD    index;
 307   1       
 308   1              index = EE_PCDATA + mode*LEN_PCDATA + 4;
 309   1              WriteEEP( index, (char)(GetHactiveStart() - PCMDATA[mode].Hstart));
 310   1      }
 311          
 312          #endif // SUPPORT_PC
 313          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   1093    ----
   CONSTANT SIZE    =    174    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----      36
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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