tw88.lst

来自「显示屏驱动源代码」· LST 代码 · 共 1,576 行 · 第 1/5 页

LST
1,576
字号
 290   1      #ifdef INTERNAL_MCU
                     P2_0 = 0;
              #endif
 293   1              dPuts("\r\n--OFF_LVDS");        
C51 COMPILER V7.06   TW88                                                                  02/21/2008 14:00:30 PAGE 6   

 294   1              #endif
 295   1      }
 296          
 297          void LCDPowerON(BYTE mute)
 298          {
 299   1              dPuts("\r\n------> LCD on");
 300   1      
 301   1              PowerLED(ON);
 302   1      
 303   1             WriteTW88(0xff, 0); // Page 0
 304   1              if( GetLCDPowerState()!=POWER_ON ) {
 305   2                      PanelMute(mute);
 306   2              ON_LVDS();
 307   2      #if 0 // removed for CCFL control  //Hans
                              delay(1);
              
                              WriteDecoder(0xd5, 0x09);       // Standby      Panel:1  Signal:0  Back:0
                              delay(1);
              
                              WriteDecoder(0xd5, 0x0b);       // Suspend      Panel:1  Signal:1  Back:0
              //              delay(1);
              
              //      ON_LVDS();
              //              PanelMute(mute);
                              delay(10);
              #endif
 320   2      
 321   2                      WriteDecoder(0xd5, 0x0f);       // On           Panel:1  Signal:1  Back:1
 322   2                      delay(5);
 323   2      
 324   2              }
 325   1              else    
 326   1                      PanelMute(mute);
 327   1      }
 328          /*
 329          void LCDPowerOFF(void)
 330          {
 331                  dPuts("\r\n------> LCD off");
 332                  
 333                  PanelMute(1);
 334          //      OFF_LVDS();
 335          
 336                  SetLCDPowerState(POWER_OFF);
 337                  OFF_LVDS();
 338          
 339                  delay(10);
 340          }
 341          */
 342          
 343          void LCDPowerOFF(void)
 344          {
 345   1      //      if( GetLCDPowerState()==POWER_OFF ) return;
 346   1      
 347   1              dPuts("\r\n------> LCD off");
 348   1      
 349   1              PanelMute(1);
 350   1      
 351   1      #if 0 // removed for CCFL control  //Hans
                      WriteDecoder(0xd5, 0x0b);       // Suspend      Panel:1  Signal:1  Back:0
                      delay(1);
                      WriteDecoder(0xd5, 0x09);       // Standby      Panel:1  Signal:0  Back:0
                      delay(1);
C51 COMPILER V7.06   TW88                                                                  02/21/2008 14:00:30 PAGE 7   

              #endif  
 357   1              WriteDecoder(0xd5, 0x08);       // Off          Panel:0  Signal:0  Back:0
 358   1      
 359   1              OFF_LVDS();
 360   1      //      delay(10);
 361   1      
 362   1      }
 363          
 364          
 365          #ifdef SERIAL
 366          void LCDPower(void)
 367          {
 368   1              extern IDATA BYTE InputSelection;
 369   1              static BYTE state=0;
 370   1      
 371   1              //state = GetLCDPowerState();
 372   1              if( state==POWER_ON ){
 373   2                      state = POWER_OFF;
 374   2                      LCDPowerOFF();
 375   2                      PowerDown_XTAL(1);
 376   2      
 377   2                      Printf("\nPower Off!!");
 378   2              }
 379   1              else //if( state==POWER_OFF )
 380   1              {
 381   2      //              reset = 0;
 382   2                      PowerDown_XTAL(0);
 383   2                      delay(10);
 384   2      /*              reset = 1;
 385   2                      delay(10);
 386   2                      InputSelection = 0xff;
 387   2                      ChangeInput( GetInputSelectionEE() );
 388   2                      LCDPowerON(0);
 389   2      */
 390   2                      state = POWER_ON;
 391   2                      LCDPowerON(0);
 392   2      
 393   2                      Printf("\nPower On!!");
 394   2      
 395   2              }
 396   1      
 397   1      }
 398          #endif // SERIAL
 399          /*
 400          #if defined( SUPPORT_PC ) || defined( SUPPORT_DTV )
 401          void DPMSmodeOFF(void)
 402          {
 403                  //WriteDecoder(ACNTL, ReadDecoder(ACNTL) | 0x0f);       // HHY 1.44 power down 27M clock, ADC
 404          }
 405          
 406          void DPMSmodeON(void)
 407          {
 408                  //WriteDecoder(ACNTL, ReadDecoder(ACNTL) & 0xf0);       // HHY 1.44 power on 27M clock, ADC
 409                  //delay(5);
 410          }
 411          #endif  // SUPPORT_PC
 412          */
 413          /***
 414          void SetPanelBitOrder(BYTE swap)
 415          {
 416                  BYTE val;
 417                  val = ReadDecoder(0xf7);
C51 COMPILER V7.06   TW88                                                                  02/21/2008 14:00:30 PAGE 8   

 418                  if( swap ) val = val | 0x01;
 419                  else       val = val & 0xfe;
 420                  WriteDecoder(0xf7, val);
 421          }
 422          ***/
 423          /***
 424          void SetPanelSingleDouble(BYTE single)
 425          {
 426                  BYTE val;
 427                  val = ReadDecoder(0xb0);
 428                  if( single ) val = val & 0x7f;
 429                  else         val = val | 0x80;
 430                  WriteDecoder(0xb0, val);
 431          }
 432          ***/
 433          //=============================================================================
 434          //                          Measurement Functions
 435          //=============================================================================
 436          #if defined( SUPPORT_PC ) || defined( SUPPORT_DTV ) || defined( DEBUG_SETPANEL)
 437          BYTE MeasureAndWait(BYTE field)
 438          {
 439   1              BYTE val;
 440   1              BYTE i;
 441   1      
 442   1              // StartMeasurement
 443   1              val = ( (field & 0x03) << 2 ) | 0x01;                   // flag : choose field for measurement
 444   1              WriteDecoder(0x5b, val);
 445   1      
 446   1              // WaitMeasurementDataReady
 447   1              for(i=0; i<50; i++) {                   // make more delay
 448   2                      delay(1);
 449   2                      val = ReadDecoder(0x5b);
 450   2                      val &= 0x01;
 451   2                      if( val == 0 ) return 1;
 452   2              }
 453   1      
 454   1              #ifdef DEBUG_PC
                      dPrintf("\r\n ReadDecoder(0x5b) = %2x", ReadDecoder(0x5b));
                      #endif
 457   1              // ClearMeasurement
 458   1              WriteDecoder(0x5b, 0);
 459   1              wPuts(" ? ");
 460   1              return 0;
 461   1      }
 462          #endif
 463          
 464          //=================================================================================================
 465          //
 466          //=================================================================================================
 467          #if defined( SUPPORT_PC ) || defined( SUPPORT_DTV ) || defined( DEBUG_SETPANEL)
 468          void SetEnDet(void)
 469          {
 470   1              BYTE val;
 471   1      
 472   1              val = ReadDecoder(0x5c);
 473   1              val |= 0x01;            //Enable Input HSYNC/VSYNC period change/loss detection.
 474   1              WriteDecoder(0x5c, val);
 475   1      
 476   1              val = ReadDecoder(0x5c);
 477   1      }
 478          
 479          void ClearEnDet(void)
C51 COMPILER V7.06   TW88                                                                  02/21/2008 14:00:30 PAGE 9   

 480          {
 481   1              BYTE val;
 482   1      
 483   1              val = ReadDecoder(0x5c);
 484   1              val &= 0xfe;            //Disable Input HSYNC/VSYNC period change/loss detection.
 485   1              WriteDecoder(0x5c, val);
 486   1      
 487   1              val = ReadDecoder(0x5c);
 488   1      }
 489          #endif // SUPPORT_PC || SUPPORT_DTV || DEBUG_SETPANEL
 490          
 491          //=============================================================================
 492          //                              Panel Setting
 493          //=============================================================================
 494          #if defined( SUPPORT_PC ) || defined( SUPPORT_DTV )
 495          
 496          BYTE IsBypassmode(void)
 497          {
 498   1              BYTE dat;
 499   1      
 500   1              dat = ReadDecoder(TW88_XYSCALEHI) & 0x10;       // Zoom by-pass
 501   1              return dat;
 502   1      }
 503          /*
 504          BYTE IsInteraced(void)
 505          {
 506                  if( ReadDecoder(0x42) & 0x80 ) return 1;
 507                  return 0;
 508          }
 509          */
 510          WORD GetHstart(void)
 511          {
 512   1              WORD hstart;
 513   1      
 514   1              WriteDecoder(0x5b, 0x80);
 515   1              hstart = (WORD)ReadDecoder(0x58) << 8;
 516   1              hstart += ReadDecoder(0x57);
 517   1      
 518   1              #ifdef DEBUG_PC
                      dPrintf("\r\n === GetHstart(%d)", hstart);
                      #endif
 521   1              return hstart;
 522   1      }
 523          
 524          #ifdef AUTO_TUNE_CLOCK
              WORD GetHend(void)
              {
                      WORD hend;
              
                      WriteDecoder(0x5b, 0x98);
                      hend = (WORD)ReadDecoder(0x58) << 8;
                      hend += ReadDecoder(0x57);
              
                      #ifdef DEBUG_PC
                      dPrintf("\r\n === GetHend(%d)", hend);
                      #endif
                      return hend;
              }
              #endif
 539          
 540          WORD GetVstart(void)
 541          {
C51 COMPILER V7.06   TW88                                                                  02/21/2008 14:00:30 PAGE 10  

 542   1              WORD vstart;
 543   1      
 544   1              WriteDecoder(0x5b, 0xa0);
 545   1              vstart = (WORD)ReadDecoder(0x58) << 8;
 546   1              vstart += ReadDecoder(0x57);
 547   1      
 548   1              #ifdef DEBUG_PC
                      dPrintf("\r\n === GetVstart(%d)", vstart);
                      #endif
 551   1              return vstart;
 552   1      }
 553          
 554          
 555          
 556          WORD GetVend(void)
 557          {
 558   1              WORD vend;
 559   1      
 560   1              WriteDecoder(0x5b, 0xb0);
 561   1              vend = (WORD)ReadDecoder(0x5a) << 8;
 562   1              vend += ReadDecoder(0x59);
 563   1      
 564   1              #ifdef DEBUG_PC
                      dPrintf("\r\n === GetVend(%d)", vend);
                      #endif
 567   1              return vend;
 568   1      }
 569          
 570          /**** Not used
 571          void MaskOnSYNCInt()
 572          {
 573                  BYTE val;
 574          
 575                  val = 0xfc;
 576                  WriteDecoder(0xb2, val);        //IRQ mask
 577                  dPrintf("\r\nDisableSYNCint:->%02x", val);
 578          }
 579          ****/
 580          /*
 581          void MaskOffSYNCInt()
 582          {
 583                  BYTE val;
 584          
 585                  val = 0xfc;
 586                  WriteDecoder(0xd2, val);        //IRQ mask
 587                  
 588                  #ifdef DEBUG_TW88
 589                  dPrintf("\r\nEnableSYNCint:->%02x", (WORD)val);
 590                  #endif
 591          
 592                  WriteDecoder(0xd2, 0xcc);
 593          
 594                  #ifdef DEBUG_TW88
 595                  dPrintf("\r\nEnableSYNCint:->%02x", (WORD)0xcc);

⌨️ 快捷键说明

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