📄 t101_util.c
字号:
LEFT_RIGHT = LEFT;
UP_DOWN =DOWN;
I2CWriteByte(TW101,0xE1, (STV1|STH2)&0xFF);
break;
case BOTTOM_LEFT: //Start from bottom-left
LEFT_RIGHT = RIGHT;
UP_DOWN =UP;
I2CWriteByte(TW101,0xE1, (STV2|STH1)&0xFF);
break;
case BOTTOM_RIGHT: //Start from bottom-right
LEFT_RIGHT = LEFT;
UP_DOWN =UP;
I2CWriteByte(TW101,0xE1, (STV2|STH2)&0xFF);
break;
}
return;
}
#endif
bit IRScaleratioCtrl(void)
{
uCHAR Hcut=10;
switch(m_cScaleratio)
{
case ScaleFULL:
#ifdef KVGA
if(m_cStandard)
I2CWriteByte(TW101+4,0x2E,0x8A); //0x82); //setup video decoder h start == 130
else
I2CWriteByte(TW101+4,0x2E,0x8a); //0x82); //setup video decoder h start == 130
#endif
#ifdef WVGA
I2CWriteByte(TW101+4,0x2E,0x88); //0x82); //setup video decoder h start == 130
#endif
#ifdef WXGA
#ifdef AU_12
I2CWriteByte(TW101+4,0x2E,0x94);//Kuo 0x88 0x94
#else
I2CWriteByte(TW101+4,0x2E,0x76);
#endif
#endif
#ifdef AU_12
I2CWriteByte(TW101+4,0x2F,0x3a); //0x50); //Setup video decoder h active 720
#else
I2CWriteByte(TW101+4,0x2F,0x4a); //0x50); //Setup video decoder h active 720 玡狠
#endif
I2CWriteByte(TW101,0xDC, (H_Size&0xFF));//Kuo
I2CWriteByte(TW101,0xDD, (H_Size>>8));
// if(!m_cStandard)
I2CWriteByte(TW101,0xDE, ((V_Size)&0xFF));
// else
// I2CWriteByte(TW101,0xDE, ((MV_Size)&0xFF));
I2CWriteByte(TW101,0xDF, (V_Size>>8));
if(!m_cStandard)
{
m_wVRes=236; //230 //ruby 2004-08-18
Hcut=20;
m_wHRes=720-2*Hcut;
#ifdef AU_12
m_wHRes=698;
#endif
}
else
{
m_wVRes=280; //ruby 2004-08-18
Hcut=16;
m_wHRes=720-2*Hcut;
#ifdef AU_12
m_wHRes=698;
#endif
}
I2CWriteByte(TW101,0x40,Hcut); //Hcut put picture position in center 2004-10-16 //For Foxconn
I2CWriteByte(TW101,0xD8,0x00);//Kuo Horizontal Main Display Start
break;
case Scale4_3:
#ifdef KVGA
I2CWriteByte(TW101+4,0x2E,0x82);
I2CWriteByte(TW101+4,0x2F,0x50); //0x50); //Setup video decoder h active 720
#else
I2CWriteByte(TW101+4,0x2E,0x82); //0x82); //setup video decoder h start == 130
I2CWriteByte(TW101+4,0x2F,0x50); //0x50); //Setup video decoder h active 720
#endif
//Black Diaplay
I2CWriteByte(TW101, 0x9d, 0x10);
I2CWriteByte(TW101, 0x9e, 0x80);
I2CWriteByte(TW101, 0x9f, 0x80);
//Kuo
I2CWriteByte(TW101,0xDC, (H_Size43));
I2CWriteByte(TW101,0xDD, (H_Size43>>8));
// if(!m_cStandard)
I2CWriteByte(TW101,0xDE, ((V_Size)&0xFF));
// else
// I2CWriteByte(TW101,0xDE, ((MV_Size)&0xFF));
I2CWriteByte(TW101,0xDF, (V_Size>>8));
if(!m_cStandard)
{
#ifdef KVGA
Hcut=10;
#else
Hcut=10;
#endif
m_wVRes=230; //ruby 2004-08-18
m_wHRes=720-2*Hcut-6;
#ifdef AU_12
m_wHRes=698;
#endif
}
else
{
#ifdef KVGA
Hcut=10;
#else
Hcut=10;
#endif
m_wVRes=280; //ruby 2004-08-18
m_wHRes=720-2*Hcut;
#ifdef AU_12
m_wHRes=698;
#endif
}
I2CWriteByte(TW101,0x40,Hcut); //Ruby 2004-08-23 0x00);
I2CWriteByte(TW101,0xD8,((H_Size-H_Size43)/2)); // 0x53);//Kuo Horizontal Main Display Start
#ifdef T515
case Scale1_1:
#ifdef KVGA
if(m_cStandard)
I2CWriteByte(TW101+4,0x2E,0x8A); //0x82); //setup video decoder h start == 130
else
I2CWriteByte(TW101+4,0x2E,0x84); //0x82); //setup video decoder h start == 130
#endif
#ifdef WVGA
I2CWriteByte(TW101+4,0x2E,0x88); //0x82); //setup video decoder h start == 130
#endif
#ifdef WXGA
#ifdef AU_12
I2CWriteByte(TW101+4,0x2E,0x94);//Kuo 0x88 0x94
#else
I2CWriteByte(TW101+4,0x2E,0x76);
#endif
#endif
#ifdef AU_12
I2CWriteByte(TW101+4,0x2F,0x3a); //0x50); //Setup video decoder h active 720
#else
I2CWriteByte(TW101+4,0x2F,0x50); //0x50); //Setup video decoder h active 720 玡狠
#endif
// I2CWriteByte(TW101+4,0x30, 0x24); //setup video decoder v start
// I2CWriteByte(TW101+4,0x31, 0x61); //Setup video decoder v active 480
if(!m_cStandard)
{
m_wVRes=240-2*DELAY_LINES;
#ifdef AU_12
m_wHRes=698;
#endif
#ifdef KVGA
m_wVRes=240; //ruby 2004-08-18
Hcut=10;
m_wHRes=720-2*Hcut;
#else
m_wHRes=706;
#endif
}
else
{
m_wVRes=240;
#ifdef AU_12
m_wHRes=698;
#endif
#ifdef KVGA
m_wVRes=280; //ruby 2004-08-18
Hcut=10;
m_wHRes=720-2*Hcut;
#else
m_wHRes=704;
#endif
}
I2CWriteByte(TW101,0xDC, (m_wHRes));//Kuo
I2CWriteByte(TW101,0xDD, (m_wHRes)>>8);
// if(!m_cStandard)
I2CWriteByte(TW101,0xDE, ((V_Size)&0xFF));
// else
// I2CWriteByte(TW101,0xDE, ((MV_Size)&0xff));
I2CWriteByte(TW101,0xDF, (V_Size>>8));
#ifdef T100
I2CWriteByte(TW101,0x30,0x8b);
I2CWriteByte(TW101,0x40,Hcut); //Ruby 2004-08-23 0x00);
I2CWriteByte(TW101,0x70,0x90);
#endif
I2CWriteByte(TW101,0xB2, 0x23);
break;
#endif
}
I2CWriteByte(TW101,0x54,m_wHRes);
I2CWriteByte(TW101,0x55,m_wHRes>>8);
I2CWriteByte(TW101,0x56,m_wVRes);
I2CWriteByte(TW101,0x57,m_wVRes>>8);
SetNTSC_PAL();
#ifdef T515
if((m_cScaleratio== Scale1_1)&&((m_cSource&0x0F)>=isrc_T515_CVIDEO1))
I2CWriteByte(TW101,0xB2, 0x23);
#endif
return 1;
}
extern uCHAR cPAL_Dot,cNTSC_Dot;
void SetNTSC_PAL(void)//0:NTSC
{
if(!m_cStandard)
{
I2CWriteByte(TW101+4,0x01, 0x0d);// 2004-10-16 0x03); //0x03
I2CWriteByte(TW101+4,0x0c, 0x8a);
I2CWriteByte(TW101+4,0x18, 0x21);
I2CWriteByte(TW101+4,0x19, 0xf0);
I2CWriteByte(TW101+4,0x1a, 0x7c);
I2CWriteByte(TW101+4,0x1b, 0x1f);
I2CWriteByte(TW101+4,0x30, 0x28);// 2004-10-16 0x24);// 0x22);//+DELAY_LINES);
I2CWriteByte(TW101+4,0x31, 0x61);
I2CWriteByte(TW101+4,0x82, 0x42);
#ifndef DISPLAY_FUNC
I2CWriteByte(TW101,0x84, 0x00);
I2CWriteByte(TW101,0x85, 0x01);
I2CWriteByte(TW101,0xb8, 0x10);
I2CWriteByte(TW101,0xb9, 0x05);
#endif
#ifdef T100
if((m_cSource&0x0F)==isrcSVIDEO)
{
I2CWriteByte(TW101+4,0x0F,0x0f); // for color bar clear 2004-10-07 01 --> color bar clear 0C --> player clear
}
else
{
I2CWriteByte(TW101+4,0x0F,0x0f); // for color bar clear 2004-10-07 01 --> color bar clear 0C --> player clear
}
#endif
}
else
{
I2CWriteByte(TW101+4,0x01,0x0c );//Color
// I2CWriteByte(TW101+4,0x01, 0x00);
I2CWriteByte(TW101+4,0x0c, 0x67);
I2CWriteByte(TW101+4,0x18, 0x2a);
I2CWriteByte(TW101+4,0x19, 0x09);
I2CWriteByte(TW101+4,0x1a, 0x8a);
I2CWriteByte(TW101+4,0x1b, 0xcb);
I2CWriteByte(TW101+4,0x30,0x2E);// 0x2a);//+DELAY_LINES);
#ifdef WVGA
I2CWriteByte(TW101+4,0x30,0x30);
#endif
I2CWriteByte(TW101+4,0x31, 0xc1);
I2CWriteByte(TW101+4,0x82, 0x52);
#ifndef DISPLAY_FUNC
I2CWriteByte(TW101,0x84, 0xff);
I2CWriteByte(TW101,0x85, 0x0f);
I2CWriteByte(TW101,0xb8, 0x10);
I2CWriteByte(TW101,0xb9, 0x06);
#endif
#ifdef T100
if((m_cSource&0x0F)==isrcSVIDEO)
{
I2CWriteByte(TW101+4,0x0F,0x0f); // for color bar clear 2004-10-07 01 --> color bar clear 0C --> player clear
}
else
{
I2CWriteByte(TW101+4,0x0F,0x0f); // for color bar clear 2004-10-07 01 --> color bar clear 0C --> player clear
}
#endif
}
Scaling(); //??
#ifdef DISPLAY_FUNC
DisplayProcess(); //????
if(m_cStandard)
{
I2CWriteByte(TW101, 0xb8, (I2CReadByte(TW101, 0xb8)-cPAL_Dot));
}
else
{
I2CWriteByte(TW101, 0xb8, (I2CReadByte(TW101, 0xb8)-cNTSC_Dot));
}
#endif
#ifdef T515
if((m_cScaleratio== Scale1_1)&&((m_cSource&0x0F)>=isrc_T515_CVIDEO1))
{
I2CWriteByte(TW101,0xB2, 0x23);
}
#endif
}
void Scaling(void)
{
switch(m_cScaleratio)
{
case ScaleFULL:
//Horizontal
m_wBuff[0] = (float)m_wHRes/DWHSZ * 0x8000;
I2CWriteByte(TW101, SC_HOR_H1, (uCHAR)m_wBuff[0]);
I2CWriteByte(TW101, SC_HOR_H2, (uCHAR)(m_wBuff[0]>>8));
//Vertical
m_wBuff[0] = (float)m_wVRes/DWVSZ * 0x8000;
I2CWriteByte(TW101, SC_VER_V1, (uCHAR)m_wBuff[0]);
I2CWriteByte(TW101, SC_VER_V2, (uCHAR)(m_wBuff[0]>>8));
break;
case Scale4_3:
//Horizontal
m_wBuff[0] = (float)m_wHRes/H_Size43 * 0x8000;
I2CWriteByte(TW101, SC_HOR_H1, (uCHAR)m_wBuff[0]);
I2CWriteByte(TW101, SC_HOR_H2, (uCHAR)(m_wBuff[0]>>8));
//Vertical
m_wBuff[0] = (float)m_wVRes/DWVSZ * 0x8000;
I2CWriteByte(TW101, SC_VER_V1, (uCHAR)m_wBuff[0]);
I2CWriteByte(TW101, SC_VER_V2, (uCHAR)(m_wBuff[0]>>8));
break;
#ifdef T515
case Scale1_1:
//Horizontal
//Horizontal
m_wBuff[0] = 0x7fff;
I2CWriteByte(TW101, SC_HOR_H1, (uCHAR)m_wBuff[0]);
I2CWriteByte(TW101, SC_HOR_H2, (uCHAR)(m_wBuff[0]>>8));
//Vertical
m_wBuff[0] = (float)m_wVRes/DWVSZ * 0x8000;
I2CWriteByte(TW101, SC_VER_V1, (uCHAR)m_wBuff[0]);
I2CWriteByte(TW101, SC_VER_V2, (uCHAR)(m_wBuff[0]>>8));
break;
#endif
}
}
void Set_Reslolution(void)
{
if(!m_cStandard)
{
I2CWriteByte(TW101+4,0x00, cSVideo&0x01);
I2CWriteByte(TW101+4,0x03, cSVideo&0x03);
#ifdef KVGA
m_wVTotal=525;
#endif
#ifdef WVGA
m_wVTotal=((525/3)*82)/27;
#endif
#ifdef WXGA
m_wVTotal=525;
#endif
}
else
{
#ifdef KVGA
m_wVTotal=625;
#endif
#ifdef WVGA
m_wVTotal=(625*45)/44;
#endif
#ifdef WXGA
m_wVTotal=625;
#endif
if(cSVideo)
{
I2CWriteByte(TW101+4,0x00, 0x33);
I2CWriteByte(TW101+4,0x03, 0x03);
}
else
{
I2CWriteByte(TW101+4,0x00, 0x32);
I2CWriteByte(TW101+4,0x03, 0x00);
}
}
}
void Detect_NTSCPAL(void)
{
//PAL_NTSC Changed Detect----2004.5.11
uCHAR j=0x0f;
//Kuo
m_wBuff[2]+=1;
// if(m_wBuff[2]==DETECT_TIMER)
{
m_wBuff[2]=0x00;
// for(m_cBuff[1]=0;m_cBuff[1]<1;m_cBuff[1]++)
{
//temp=I2CReadByte(TW515, 0x5c);
#ifdef T515
if((m_cSource&0x0f) >= isrc_T515_CVIDEO1)
{
m_cBuff[0] = I2CReadByte(TW515, 0x5c);
m_cBuff[0] = m_cBuff[0]&0x04;//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -