📄 t101_util.c
字号:
if(m_cSource==1)
I2CWriteByte(TW101,0x11, 0x08);
else if(m_cSource==2)
I2CWriteByte(TW101,0x11, 0x04);
else if(m_cSource==3)
I2CWriteByte(TW101,0x11, 0x00);
#else
I2CWriteByte(TW101,0x11, 0x00);
#endif
I2CWriteByte(TW101+4,0x07, 0x20);//0x05|0x22);
I2CWriteByte(TW101+4,0x00, I2CReadByte(TW101+4,0x00)&0xfe);
I2CWriteByte(TW101+4,0x01, I2CReadByte(TW101+4,0x01)&~ENYPbPr);
if(m_cChroma==S_NTSC_4) // temporarily add by Sherman 06'01'27
I2CWriteByte(TW101+4,0x03, I2CReadByte(TW101+4,0x03)&0xf8|0x03);
else
I2CWriteByte(TW101+4,0x03, I2CReadByte(TW101+4,0x03)&0xfc);
}
else if (uiaSrcMux[(m_cSource&0x0F)*2+1]==itypeYPBPR)
{
I2CWriteByte(TW101,0x11, 0x55);
I2CWriteByte(TW101+4,0x07, 0x20);
I2CWriteByte(TW101+4,0x01, I2CReadByte(TW101+4,0x01)|ENYPbPr);
}
#ifdef T515
if ( (m_cSource&0x0F)< isrc_T515_CVIDEO1){
if(cSVideo)
I2CWriteByte(TW101+4,0x07, 0x06|0x02);//|0x22
else
I2CWriteByte(TW101+4,0x07, 0x02);// 930729//|0x20
}else{
DetectSignalStd(); // add by Sherman 06'01'03
SRC_656();
}
if((m_cSource&0x0F)>=isrcSVIDEO){
I2CWriteByte(TW101+4,0x02, 0x4B);
I2CWriteByte(TW101,0x1a, 0x87);
}
twdDelay(300);
if((m_cSource&0x0F)>=isrc_T515_CVIDEO1){
NoSignal=0;
I2CWriteByte(TW101, 0xC2, I2CReadByte(TW101, 0xC2)&~(PSYNC_STR|IGNORE_VSYNC));
I2CWriteByte(TW101, PATTERN_CTRL, 0x00);
}else{
if(I2CReadByte(TW101+4, 0x3A)&0x06){
NoSignal=0;
I2CWriteByte(TW101, 0xC2, I2CReadByte(TW101, 0xC2)&~(PSYNC_STR|IGNORE_VSYNC));
I2CWriteByte(TW101, PATTERN_CTRL, 0x00);
}
}
#else
twdDelay(500);
if(I2CReadByte(TW101+4, 0x3A)&0x06){
NoSignal=0;
I2CWriteByte(TW101, 0xC2, I2CReadByte(TW101, 0xC2)&~(PSYNC_STR|IGNORE_VSYNC));
I2CWriteByte(TW101, PATTERN_CTRL, 0x00);
}
#endif
//SetSignalStd(); // kenny 20060628
I2CWriteByte(TW101, 0xE2, 0x11);
}
void DetectSignalStd(void)
{
uCHAR index=0,SlaveAddr,RegAddrShift;//,line_525;//,tmp;
#ifdef T515
if(m_cSource >= isrc_T515_CVIDEO1){
SlaveAddr=0xb8;
RegAddrShift=0x20;
}else{
SlaveAddr=0x54;
RegAddrShift=0x00;
}
#else
SlaveAddr=0x54;
RegAddrShift=0x00;
#endif
m_cBuff[0]=m_cStandard;
if(I2CReadByte(SlaveAddr, 0x3A+RegAddrShift)&0x06) // Judge vlock and hlock
{
if((I2CReadByte(SlaveAddr, 0x7B+RegAddrShift)>0x10)){//&& (I2CReadByte(SlaveAddr, 0x7c+RegAddrShift)!=0x51)&&(I2CReadByte(SlaveAddr, 0x7c+RegAddrShift)!=0x52)){// For no chroma case
if(I2CReadByte(TW101,0x59) <= 0xd6)
m_cBuff[0]=S_NTSC;
//else if (I2CReadByte(TW101,0x59) >= 0xd8 && I2CReadByte(TW101,0x58) > 0x2E ) // kenny 20060628
// m_cBuff[0]=S_NTSC; // kenny 20060628
else
m_cBuff[0]=S_PAL;
/* #ifdef T515
if((m_cSource&0x0f) >= isrc_T515_CVIDEO1){
m_cBuff[0] = I2CReadByte(TW515, 0x5c)&0x04;
if((I2CReadByte(TW515, 0x5c)&0x07)==0)
m_cBuff[0]=S_NTSC;
else if(I2CReadByte(TW515, 0x5c)&0x02)
m_cBuff[0]=S_SECAM;
else if(I2CReadByte(TW515, 0x5c)&0x04)
m_cBuff[0]=S_PAL;
else
m_cBuff[0]=0xff;
}
#endif
*/ if((m_cStandard!=m_cBuff[0]))//||m_bPanelClose == 1){ // signal std was changed,and output timing must be set again
{
m_cStandard=m_cBuff[0];
m_cChroma=m_cBuff[0];
SetOPTiming();
SetSignalStd();
twdDelay1(50);
OpenPanel();
twdDelay1(50);
}
}
else{
//~~~~~~~ set OPTiming ~~~~~~~~~~~~~~~~~~~//
if(I2CReadByte(TW101,0x59) <= 0xd6)
m_cBuff[0]=S_NTSC;
else if (I2CReadByte(TW101,0x59) >= 0xd8 && I2CReadByte(TW101,0x58) > 0x2E ) // kenny 20060628
m_cBuff[0]=S_NTSC; // kenny 20060628
else
m_cBuff[0]=S_PAL;
/* #ifdef T515
if((m_cSource&0x0f) >= isrc_T515_CVIDEO1){
m_cBuff[0] = I2CReadByte(TW515, 0x5c)&0x04;
if((I2CReadByte(TW515, 0x5c)&0x07)==0)
m_cBuff[0]=S_NTSC;
else if(I2CReadByte(TW515, 0x5c)&0x02)
m_cBuff[0]=S_SECAM;
else if(I2CReadByte(TW515, 0x5c)&0x04)
m_cBuff[0]=S_PAL;
else
m_cBuff[0]=0xff;
}
#endif
*/ if((m_cStandard!=m_cBuff[0])){ // signal std was changed,and output timing must be set again
//ClosePanel(0x00,0x40,0x8a); // sm 06'04'07
twdDelay(10); // sm 06'04'07
m_cStandard=m_cBuff[0];
SetOPTiming();
}
//~~~~~~~ End of set OPTiming ~~~~~~~~~~~~~~~~~~~//
//~~~~~~~ set Chroma ~~~~~~~~~~~~~~~~~~~//
m_cBuff[4]=m_cChroma;
#ifdef T515
if((m_cSource&0x0f) >= isrc_T515_CVIDEO1){
m_cBuff[4] = I2CReadByte(TW515, 0x5c)&0x04;
//else if((m_cSource&0x0f) >= isrc_T515_CVIDEO1){
if((I2CReadByte(TW515, 0x5c)&0x07)==0)
m_cBuff[4]=S_NTSC;
else if(I2CReadByte(TW515, 0x5c)&0x02)
m_cBuff[4]=S_SECAM;
else if(I2CReadByte(TW515, 0x5c)&0x04)
m_cBuff[4]=S_PAL;
else
m_cBuff[4]=0xff;
}
#endif
twdDelay1(25);
// Set Chroma lock configration
if(I2CReadByte(TW101,0x59) <= 0xd6)
I2CWriteByte(SlaveAddr, 0x83+RegAddrShift, 0x37);//6f); // NTSC // change by Sherman 06'02'07
else if (I2CReadByte(TW101,0x59) >= 0xd8 && I2CReadByte(TW101,0x58) > 0x2E ) // kenny 20060628
I2CWriteByte(SlaveAddr, 0x83+RegAddrShift, 0x37); // kenny 20060628
else
I2CWriteByte(SlaveAddr, 0x83+RegAddrShift, 0x39); // PAL
twdDelay1(50);
// kenny 20060628
if(I2CReadByte(TW101,0x59) <= 0xd6 || (I2CReadByte(TW101,0x59) >= 0xd8 && I2CReadByte(TW101,0x58) > 0x2E)) { // NTSC-M,NTSC-4,PAL-M
m_wBuff[2]=0;
m_cBuff[1]=m_cChroma; // Preserve previous status for signal std
twdDelay1(150); // add by Sherman 06'01'16
while (1){ // NTSC-M=1,NTSC-4=4,PAL-M=5
if (m_cChroma == S_NTSC_4){
if ((I2CReadByte(SlaveAddr, 0x3a+RegAddrShift)&0x08)&&(I2CReadByte(SlaveAddr, 0x7a+RegAddrShift)<0x80))
break;
}
if ((m_cChroma == S_NTSC)|(m_cChroma == S_PAL_M)){
if ((I2CReadByte(SlaveAddr, 0x3a+RegAddrShift)&0x08))
break;
}
if (m_cChroma == S_NTSC)
#ifndef Signal_NTSC_4
#ifndef Signal_PAL_M
m_cChroma=S_NTSC;
#else
m_cChroma=S_PAL_M;
#endif
#else
m_cChroma=S_NTSC_4;
#endif
else if (m_cChroma == S_NTSC_4)
#ifndef Signal_PAL_M
m_cChroma=S_NTSC;
#else
m_cChroma=S_PAL_M;
#endif
else //if (m_cChroma == S_PAL_M)
m_cChroma=S_NTSC;
//ClosePanel(0x00,0x40,0x8a); // sm 06'04'07
twdDelay(10); // sm 06'04'07
SetSignalStd(); // Set Signal flag and DTO
twdDelay1(50);
if ((++m_wBuff[2]) >4) break; // Avoid while setting, input switch to NTSC
}
}else{ // PAL-BD,PAL-CN,SECAM
#if ((defined T100A)|(defined T101A)|(defined T101))&(defined YPbPr)
if(m_cSource == isrYPbPr)
m_cBuff[4]=S_PAL;
else {
#endif
m_wBuff[2]=0;
m_cBuff[1]=m_cChroma; // Preserve previous status for signal std
twdDelay1(150); // add by Sherman 06'01'16
while (1){ // PAL-BD=2,PAL-CN=6,SECAM=3
if ((m_cChroma == S_PAL)|(m_cChroma == S_PAL_CN)){
if ((I2CReadByte(SlaveAddr, 0x3a+RegAddrShift)&0x08) && (I2CReadByte(SlaveAddr, 0x3c+RegAddrShift)&0x01==1))//&& (I2CReadByte(SlaveAddr, 0x7d+RegAddrShift)>0xf0))
break;
}
if (m_cChroma == S_SECAM){
if ((I2CReadByte(SlaveAddr, 0x3a+RegAddrShift)&0x08) && (I2CReadByte(SlaveAddr, 0x7d+RegAddrShift)>0xf0))
break;
}
if (m_cChroma == S_PAL)
#ifndef Signal_SECAM
#ifndef Signal_PAL_CN
m_cChroma=S_PAL;
#else
m_cChroma=S_PAL_CN;
#endif
#else
m_cChroma=S_SECAM;
#endif
else if (m_cChroma == S_SECAM)
#ifndef Signal_PAL_CN
m_cChroma=S_PAL;
#else
m_cChroma=S_PAL_CN;
#endif
else //if (m_cChroma == S_PAL_CN)
m_cChroma=S_PAL;
//ClosePanel(0x00,0x40,0x8a); // sm 06'04'07
twdDelay(10); // sm 06'04'07
SetSignalStd(); // Set Signal flag and DTO
twdDelay1(50);
if ((++m_wBuff[2]) >3) break; // Avoid while setting, input switch to NTSC
}
#if ((defined T100A)|(defined T101A)|(defined T101))&(defined YPbPr)
}
#endif
}
if (m_cBuff[1] != m_cChroma){
if ((I2CReadByte(SlaveAddr, 0x3a+RegAddrShift)&0x08))
m_cBuff[4] = m_cChroma;
m_cChroma=m_cBuff[1] ;
}
if((m_cChroma!=m_cBuff[4])){
m_cChroma=m_cBuff[4];
// judge output timing again for black pattern
// add by sm 06'04'07
m_cBuff[0]=m_cStandard;
if(I2CReadByte(TW101,0x59) <= 0xd6)
m_cBuff[0]=S_NTSC;
else if (I2CReadByte(TW101,0x59) >= 0xd8 && I2CReadByte(TW101,0x58) > 0x2E )
m_cBuff[0]=S_NTSC;
else
m_cBuff[0]=S_PAL;
if((m_cStandard!=m_cBuff[0])){ // signal std was changed,and output timing must be set again
m_cStandard=m_cBuff[0];
SetOPTiming();
}
//if ((I2CReadByte(SlaveAddr, 0x3a+RegAddrShift)&0x08)){
OpenPanel();
//}
// end of add by sm 06'04'07
}
}
}// 癹伴い
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -