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

📄 tw88.lst

📁 此程序为twell8806驱动程序
💻 LST
📖 第 1 页 / 共 5 页
字号:

 304   1              #else
                      BYTE val;
                      val = ReadDecoder(0x4e);
                      WriteDecoder(0x4e, val|0x10);   // GPIO0 En
              
                      val = ReadDecoder(0x4f) & 0xf9;
                      WriteDecoder(0x4f, val | 0x08);         // GPIO0 = 1
                      dPuts("\r\n--ON_LVDS"); 
                      #endif
 313   1      }
 314          
 315          void OFF_LVDS(void)
 316          {
 317   1              #if (defined WVGA) || (defined WQVGA)
 318   1      
 319   1              #else
                      BYTE val;
                      val = ReadDecoder(0x4e);
                      WriteDecoder(0x4e, val&0x10);   // GPIO0 En
              
                      val = ReadDecoder(0x4f) & 0xf9;
                      WriteDecoder(0x4f, val & 0xf7);         // GPIO1 = 0
                      dPuts("\r\n--OFF_LVDS");        
                      #endif
 328   1      }
 329          
 330          void LCDPowerON(BYTE mute)
 331          {
 332   1              dPuts("\r\n------> LCD on");
 333   1      
 334   1              PowerLED(ON);
 335   1      
 336   1              if( GetLCDPowerState()!=POWER_ON ) {
 337   2                      PanelMute(mute);
 338   2              ON_LVDS();
 339   2                      delay(1);
 340   2      
 341   2                      WriteDecoder(0xd5, 0x09);       // Standby      Panel:1  Signal:0  Back:0
 342   2                      delay(1);
 343   2      
 344   2                      WriteDecoder(0xd5, 0x0b);       // Suspend      Panel:1  Signal:1  Back:0
 345   2      //              delay(1);
 346   2      
 347   2       //     ON_LVDS();
 348   2      //              PanelMute(mute);
 349   2                      delay(10);
 350   2      
 351   2                      WriteDecoder(0xd5, 0x0f);       // On           Panel:1  Signal:1  Back:1
 352   2                      delay(5);
 353   2      
 354   2              }
 355   1              else    
 356   1                      PanelMute(mute);
 357   1      }
 358          /*
 359          void LCDPowerOFF(void)
 360          {
 361                  dPuts("\r\n------> LCD off");
 362                  
 363                  PanelMute(1);
 364          //      OFF_LVDS();
 365          
C51 COMPILER V7.50   TW88                                                                  08/20/2007 10:23:35 PAGE 7   

 366                  SetLCDPowerState(POWER_OFF);
 367                  OFF_LVDS();
 368          
 369                  delay(10);
 370          }
 371          */
 372          
 373          void LCDPowerOFF(void)
 374          {
 375   1      //      if( GetLCDPowerState()==POWER_OFF ) return;
 376   1      
 377   1              PanelMute(1);
 378   1      
 379   1              WriteDecoder(0xd5, 0x0b);       // Suspend      Panel:1  Signal:1  Back:0
 380   1              delay(1);
 381   1              WriteDecoder(0xd5, 0x09);       // Standby      Panel:1  Signal:0  Back:0
 382   1              delay(1);
 383   1              WriteDecoder(0xd5, 0x08);       // Off          Panel:0  Signal:0  Back:0
 384   1      
 385   1              OFF_LVDS();
 386   1      //      delay(10);
 387   1      
 388   1      }
 389          
 390          
 391          #ifdef SERIAL
 392          void LCDPower(void)
 393          {
 394   1              BYTE state;
 395   1      
 396   1              state = GetLCDPowerState();
 397   1              if( state==POWER_ON ){
 398   2                      LCDPowerOFF();
 399   2      //              PowerDown_XTAL(1);
 400   2              }
 401   1              else if( state==POWER_OFF )
 402   1              {
 403   2      //              PowerDown_XTAL(1);
 404   2      //              delay(10);
 405   2                      LCDPowerON(0);
 406   2              }
 407   1      
 408   1      }
 409          #endif // SERIAL
 410          
 411          #if defined( SUPPORT_PC ) || defined( SUPPORT_DTV )
 412          void DPMSmodeOFF(void)
 413          {
 414   1              //WriteDecoder(ACNTL, ReadDecoder(ACNTL) | 0x0f);       // HHY 1.44 power down 27M clock, ADC
 415   1      }
 416          
 417          void DPMSmodeON(void)
 418          {
 419   1              WriteDecoder(ACNTL, ReadDecoder(ACNTL) & 0xf0); // HHY 1.44 power on 27M clock, ADC
 420   1              delay(5);
 421   1      }
 422          #endif  // SUPPORT_PC
 423          /***
 424          void SetPanelBitOrder(BYTE swap)
 425          {
 426                  BYTE val;
 427                  val = ReadDecoder(0xf7);
C51 COMPILER V7.50   TW88                                                                  08/20/2007 10:23:35 PAGE 8   

 428                  if( swap ) val = val | 0x01;
 429                  else       val = val & 0xfe;
 430                  WriteDecoder(0xf7, val);
 431          }
 432          ***/
 433          /***
 434          void SetPanelSingleDouble(BYTE single)
 435          {
 436                  BYTE val;
 437                  val = ReadDecoder(0xb0);
 438                  if( single ) val = val & 0x7f;
 439                  else         val = val | 0x80;
 440                  WriteDecoder(0xb0, val);
 441          }
 442          ***/
 443          //=============================================================================
 444          //                          Measurement Functions
 445          //=============================================================================
 446          BYTE MeasureAndWait(BYTE flag)
 447          {
 448   1              BYTE val;
 449   1              WORD i;
 450   1      
 451   1              // StartMeasurement
 452   1              val = ( (flag & 0x03) << 2 ) | 0x01;                    //flag : choose field for measurement
 453   1              WriteDecoder(0x5b, val);
 454   1      
 455   1              // WaitMeasurementDataReady
 456   1              for(i=0; i<200; i++) {
 457   2                      val = ReadDecoder(0x5b) & 0x01;
 458   2                      if( !val ) return 1;
 459   2                      //delay(1);
 460   2              }
 461   1      
 462   1              // ClearMeasurement
 463   1              WriteDecoder(0x5b, 0);
 464   1              wPuts(" ? ");
 465   1              return 0;
 466   1      }
 467          //=============================================================================
 468          //            Interrupt / SW Reset Control Functions
 469          //=============================================================================
 470          /**** Not used
 471          void SetInt(void)
 472          {
 473                  WriteDecoder(0xb2, 0xec);       //IRQ mask, MASK OFF all
 474          }
 475          ****/
 476          
 477          //void ClearInt(void)
 478          //{
 479          //      dPuts("\r\nClear Int(b2:0xff)");
 480          //      WriteDecoder(0xb2, 0xff);
 481          //}
 482          
 483          /*
 484          //#ifdef SUPPORT_TV
 485          void SWReset(void)
 486          {
 487                  BYTE val;
 488                  BYTE state;
 489          
C51 COMPILER V7.50   TW88                                                                  08/20/2007 10:23:35 PAGE 9   

 490                  state = GetLCDPowerState();
 491                  if( state==POWER_ON )   
 492                          OFF_LVDS();
 493          
 494                  val = ReadDecoder(ACNTL);
 495                  val |= 0x80;    // Software Reset
 496                  WriteDecoder(ACNTL, val);
 497                  
 498                  if( state==POWER_ON )   {
 499                          while( GetLCDPowerState()!=POWER_ON )
 500                                  ;
 501                          ON_LVDS();
 502                  }
 503          }
 504          #endif
 505          
 506          //=============================================================================
 507          //                                                              MISC2 for decoder
 508          //=============================================================================
 509          #ifdef SUPPORT_CCD_VCHIP
 510          void ForceDecoderOutput(BYTE color)
 511          {
 512                  color = BLACK_DECODER;
 513                  PanelBlack(1);
 514                  return 1;
 515          }
 516          
 517          void ClearForcedDecoderOutput(void)
 518          {
 519                  PanelBlack(0);
 520          }       
 521          #endif
 522          */
 523          //=============================================================================
 524          //                                                              CC and EDS
 525          //=============================================================================
 526          #ifdef SUPPORT_TW88_CC_DECODER
              BYTE GetCCStatus()
              {
                      return ReadDecoder(CC_STATUS);
              }
              
              void DisableCC()
              {
                      BYTE ccs;
              
                      ccs = ReadDecoder(CC_STATUS);
                      ccs &= 0xdf;
                      WriteDecoder(CC_STATUS, ccs);
              }
              
              void EnableCC()
              {
                      BYTE ccs;
              
                      ccs = ReadDecoder(CC_STATUS);
                      ccs |= 0x20;
                      WriteDecoder(CC_STATUS, ccs);
              }
              
              BYTE GetCCData()
              {
C51 COMPILER V7.50   TW88                                                                  08/20/2007 10:23:35 PAGE 10  

                      return ReadDecoder(CC_DATA);
              }
              
              void EnableEDS(void)
              {
                      BYTE ccs;
              
                      ccs = ReadDecoder(CC_STATUS);
                      ccs |= 0x40;
                      WriteDecoder(CC_STATUS, ccs);
              }
              
              void DisableEDS(void)
              {
                      BYTE ccs;
              
                      ccs = ReadDecoder(CC_STATUS);
                      ccs &= 0xbf;
                      WriteDecoder(CC_STATUS,ccs);
              }
              
              void RecoverCCOverflow(void)
              {
                      BYTE ccs, i;
              
                      ccs = ReadDecoder(CC_STATUS);
                      WriteDecoder(CC_STATUS,ccs & 0x9f);             //clear bit6:5
              
                      for(i=0; i<16; i++) GetCCData();
              
                      WriteDecoder(CC_STATUS,ccs);                    //reset bit6:5
              }
              #endif // SUPPORT_TW88_CC_DECODER
 585          
 586          //=================================================================================================
 587          //
 588          //=================================================================================================
 589          #if defined( SUPPORT_PC ) || defined( SUPPORT_DTV ) || defined( DEBUG_SETPANEL)
 590          void SetEnDet(void)
 591          {
 592   1              BYTE val;
 593   1      
 594   1              val = ReadDecoder(0x5c);
 595   1              val |= 0x01;            //Enable Input HSYNC/VSYNC period change/loss detection.
 596   1              WriteDecoder(0x5c, val);
 597   1      
 598   1              val = ReadDecoder(0x5c);
 599   1      }
 600          
 601          void ClearEnDet(void)
 602          {
 603   1              BYTE val;
 604   1      
 605   1              val = ReadDecoder(0x5c);
 606   1              val &= 0xfe;            //Disable Input HSYNC/VSYNC period change/loss detection.
 607   1              WriteDecoder(0x5c, val);
 608   1      
 609   1              val = ReadDecoder(0x5c);
 610   1      }
 611          #endif // SUPPORT_PC || SUPPORT_DTV || DEBUG_SETPANEL
 612          
 613          //=============================================================================
C51 COMPILER V7.50   TW88                                                                  08/20/2007 10:23:35 PAGE 11  

⌨️ 快捷键说明

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