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

📄 main.lst

📁 车载DVD osdIC TW8816原厂代码
💻 LST
📖 第 1 页 / 共 2 页
字号:
 286   2                      if( struct_VInputStd[i].Id ==0 )
 287   2                              break;
 288   2              }
 289   1              return 0;
 290   1      }
 291          
 292          void SetVInputStd(BYTE newd)
 293          {
 294   1              VInputStd = newd;
 295   1      
 296   1              #ifdef DEBUG
 297   1              ePrintf("\r\n(SetVInputStd) VInputStd:(%s)", struct_VInputStd[GetVInputStdInx()].Name);
 298   1              #endif
 299   1      
 300   1              switch( VInputStd ) {
 301   2      
 302   2              #ifdef SUPPORT_NTSC4
C51 COMPILER V7.50   MAIN                                                                  04/01/2008 15:02:15 PAGE 6   

 303   2              case NTSC4:
 304   2              #endif
 305   2              #ifdef SUPPORT_PALM
 306   2              case PALM:
 307   2              #endif
 308   2              #ifdef SUPPORT_PAL60
 309   2              case PAL60:
 310   2              #endif
 311   2              case NTSC:              IVF = 60;               IHF = 15723;    break;  // 15734
 312   2      
 313   2              #ifdef SUPPORT_SECAM
 314   2              case SECAM:
 315   2              #endif
 316   2              #ifdef SUPPORT_PALN
 317   2              case PALN:
 318   2              #endif
 319   2              #ifdef SUPPORT_PAL
 320   2              case PAL:               IVF = 50;               IHF = 15723;    break;  // 15625
 321   2              #endif
 322   2      
 323   2              default:                IVF = 0;                IHF = 0;                break;
 324   2              }
 325   1      }
 326          
 327          BYTE GetInputSelection(void)
 328          {
 329   1              return InputSelection;
 330   1      }
 331          
 332          BYTE GetNextInputSelection(void)
 333          {
 334   1              BYTE i;
 335   1      
 336   1              for (i=1; ;i++)
 337   1                      if( struct_InputSelection[i].Id==InputSelection )  break;
 338   1              i++;
 339   1              if( struct_InputSelection[i].Id == 0 ) i=1;
 340   1      
 341   1              return struct_InputSelection[i].Id;
 342   1      }
 343          
 344          void PowerDown_XTAL(bit flag)
 345          {
 346   1              if( flag ) P3_7 = 1;
 347   1              else      P3_7 = 0;
 348   1      }
 349          
 350          void ChangeInput(BYTE newsel)
 351          {
 352   1              #ifdef DEBUG
 353   1              BYTE i;
 354   1              #endif
 355   1      
 356   1              if( InputSelection==newsel ) return;
 357   1      
 358   1              DisplayInputHold = 0; // Refresh Input info.
 359   1              ClearOSDInfo();
 360   1      
 361   1              //PanelMute(1);
 362   1      
 363   1              InputSelection = newsel;
 364   1      
C51 COMPILER V7.50   MAIN                                                                  04/01/2008 15:02:15 PAGE 7   

 365   1             cSourceState = ssInputSetup; // start input setup
 366   1      
 367   1              #ifdef DEBUG
 368   1              for (i=1; ;i++)
 369   1                      if( struct_InputSelection[i].Id==InputSelection )  break;
 370   1              Printf("\r\n ->->->->->->->->->->-> Changed Input: %s(%02x)", struct_InputSelection[i].Name, (WORD)InputS
             -election);
 371   1              #endif
 372   1      
 373   1      }
 374          
 375          void PowerOff(void)
 376          {
 377   1              dPuts("\r\n++(PowerOff)__");
 378   1      //      PowerMode = OFF;
 379   1      
 380   1              AudioOff();
 381   1              
 382   1              ClearOSDInfo();
 383   1              LCDPowerOFF();
 384   1              PowerLED(OFF);
 385   1      }
 386          
 387          void WaitPowerOn(void)
 388          {
 389   1      
 390   1              BYTE ikey;
 391   1              BYTE AutoKey, _RemoDataCode;
 392   1      
 393   1              while(1) {
 394   2                      if( (ikey = GetKey(0)) ) {
 395   3                              #ifdef POWERKEY
 396   3                              if( ikey==POWERKEY ) 
 397   3                                      break;          //poweron
 398   3                              #endif
 399   3                      }
 400   2                      if( IsRemoDataReady(&_RemoDataCode, &AutoKey) ) {
 401   3                              if( _RemoDataCode==REMO_STANDBY && !AutoKey )           //POWERON
 402   3                                      break;          //poweron
 403   3                      }
 404   2      
 405   2              }
 406   1      
 407   1              #ifdef DEBUG_MAIN
                      dPuts("\r\n++(PowerOn)__");
                      #endif
 410   1      //      PowerMode = ON;
 411   1              PowerLED(ON);
 412   1      
 413   1              AudioOn();                      //SetMSPVol();
 414   1              LCDPowerON(0);
 415   1      
 416   1      }
 417          
 418          void SetOSDLastKeyInTime(void)
 419          {
 420   1              OSDLastKeyInTime = GetTime_ms();
 421   1      }
 422          
 423          WORD GetOSDLastKeyInTime(void)
 424          {
 425   1              return OSDLastKeyInTime ;
C51 COMPILER V7.50   MAIN                                                                  04/01/2008 15:02:15 PAGE 8   

 426   1      }
 427          
 428          //=============================================================================
 429          //
 430          //=============================================================================
 431                          
 432          void main_loop(void)
 433          {
 434   1              //---------------------------------------------------------------
 435   1              //                                   Main Loop
 436   1              //---------------------------------------------------------------
 437   1              while(1) {
 438   2                      
 439   2                      //-------------- Check Serial Port -----------------
 440   2                      #ifdef SERIAL
 441   2                      while( RS_ready() ) 
 442   2                              Monitor();                              // for new monitor functions
 443   2                      #endif // SERIAL
 444   2      
 445   2                      //-------------- Check Key in --------------------------
 446   2                      if( !CheckKeyIn() ) break;                      // POWEROFF
 447   2      
 448   2                      //-------------- Check Remote Controller ---------------
 449   2                      if( !CheckRemo() ) break;                       // POWEROFF
 450   2                              
 451   2                      //-------------- Check OSD timer -----------------------
 452   2                      CheckAndClearOSD();
 453   2      
 454   2                      //-------------- Check OFF timer -----------------------
 455   2                      if( OKSleepTime() ) break;
 456   2      
 457   2                    SourceProcess(); // Hans
 458   2      
 459   2              }
 460   1      
 461   1      }
 462          
 463          void main(void)
 464          {
 465   1              TW88HWReset = 0;                        //TW88 HW reset by port pin, internal MCU no meaning
 466   1              
 467   1      
 468   1              InitCPU();
 469   1      
 470   1              SetMonAddress(TW88I2CAddress);
 471   1      
 472   1              InitVars();
 473   1      
 474   1              InitTechwell();
 475   1      
 476   1              while(1) {
 477   2                      main_loop();            //exit when power off
 478   2                      
 479   2                      PowerOff();
 480   2                      WaitPowerOn();
 481   2                      ChangeInput( GetInputSelectionEE() );
 482   2              }
 483   1      }
 484          
 485          #if defined SUPPORT_TV
 486          BYTE WantToStopTVScan(void)
 487          {
C51 COMPILER V7.50   MAIN                                                                  04/01/2008 15:02:15 PAGE 9   

 488   1              BYTE AutoKey=0, ret=0, _RemoDataCode=0;
 489   1      
 490   1              ret = GetKey(1); 
 491   1      
 492   1              if( ret == MENUKEY ) {
 493   2                      //Printf("\r\n(WantToStopTVScan) Pushed Menu Key!!");
 494   2                      return 1;
 495   2              }
 496   1      
 497   1              if( !ret )
 498   1                      ret = IsRemoDataReady(&_RemoDataCode, &AutoKey);
 499   1      
 500   1              if( _RemoDataCode==REMO_MENU  ) ret = 1;
 501   1              else    ret = 0;
 502   1      
 503   1              #if defined DEBUG_KEYREMO || defined DEBUG_TV
                      dPrintf("\r\n(WantToStopTVScan) ret:0x%x, RemoDataCode:0x%x", (WORD)ret, (WORD)_RemoDataCode);
                      #endif
 506   1      
 507   1              return ret;
 508   1      }
 509          
 510          void ChangeVInputStdDetectMode(BYTE val)
 511          {
 512   1              #ifndef WIDE_SCREEN
                      BYTE cIndex;
                      DWORD scale;
                      #endif
 516   1              
 517   1              VInputStdDetectMode = val;
 518   1              SaveVInputStdDetectModeEE(val);
 519   1              
 520   1              if( VInputStdDetectMode ==AUTO )        
 521   1                      SetAutoDetectStd();
 522   1              else {
 523   2                      SetVInputStd(val);
 524   2                      ClearAutoDetectStd(val-1);
 525   2              }       
 526   1      #ifdef PAL_TV
 527   1              SetTVIFStd(IF_I);
 528   1             if (VInputStdDetectMode == AUTO || VInputStdDetectMode == PAL ||
 529   1                      VInputStdDetectMode == SECAM || VInputStdDetectMode == PALN)
 530   1                      PcMode = EE_YPbPr_576I;
 531   1             else 
 532   1                      PcMode = EE_YPbPr_480I;
 533   1              #ifdef WIDE_SCREEN
 534   1                      Set4WideScreen(GetWideModeEE());
 535   1              #else
                            cIndex =  FindDecodeSettingIndex(PcMode);    
                             // scaler config
                              scale = DecoderFormat[cIndex].ScaleWidth;    // scale = (65536 * hactive + panel.hative / 2) / panel.hat
             -ive
                              scale *= 0x10000L;
                              scale += PanelData.HActive / 2;
                              scale /= PanelData.HActive;
                              XScale2(scale);
                              #ifdef DEBUG
                              dPrintf("\r\nH scale: %xh - %xh", (WORD)(scale>>8), (WORD)(scale & 0xff));
                              #endif
                              scale = DecoderFormat[cIndex].ScaleHeight;    // scale = (65536 * vactive + panel.vative / 2) / panel.va
             -tive
                              scale *= 0x10000L;
C51 COMPILER V7.50   MAIN                                                                  04/01/2008 15:02:15 PAGE 10  

                              scale += PanelData.VActive / 2;
                              scale /= PanelData.VActive;
                              YScale2(scale);
                              #ifdef DEBUG
                              dPrintf("\r\nV scale: %xh - %xh", (WORD)(scale>>8), (WORD)(scale & 0xff));
                              #endif
                      #endif
 555   1                      
 556   1      #endif
 557   1      }
 558          #endif          //SUPPORT_TV
 559          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    750    ----
   CONSTANT SIZE    =    371    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =      6      12
   DATA SIZE        =      9    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =      6       1
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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