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

📄 t101_util.~c

📁 t102 驱动AU 7 屏的OSD原代码,我找了好久才找到的,有一定的参考价值.
💻 ~C
📖 第 1 页 / 共 2 页
字号:
	0x08		, 0x70,													// Change by Sherman for Gamma Adjustment 05'12'19
	0x09		, 0x28,
	0x80		, 0x03,
#endif	
	0x2d		, 0x48,		// Add by Sherman 06'01'10s
	0x3f		, 0x01,				        //ADC_ROFF		// Change by Sherman 06'01'10
	0xff		, 0x00,		// End of register settings, bruce, 2006/01/09
};      

static uCHAR cSVideo=0;
static uCHAR cYPbPr=0;  // add by Sherman 06'01'12
/****************************************************************************
*                           Public Global Variable                          *
****************************************************************************/
uDWORD 	m_dwTemp[2];
uWORD 	m_wDWHSZ=DWHSZ;
uCHAR 	NoSignal=0;
#ifdef ROTATE
    #if (defined T101A)|(defined T101)     
    uCHAR Dis_Mode=BOTTOM_RIGHT;
    #else
    uCHAR Dis_Mode=TOP_LEFT;
    #endif
#endif

/****************************************************************************
*                              Public Function                              *
****************************************************************************/
void InitT10x(void)
{	
	uCHAR RegIndex,RegAdr;

	RegIndex=0;
	RegAdr=stInitT10xP0[0].ucRegAdr;
	while (RegAdr != 0xFF)		// bruce, 2006/01/09
	{
		if(RegAdr==0x30){
			I2CWriteByte(TW101,RegAdr,(I2CReadByte(TW101,0x30)|0x01));  // enable Shadow
			I2CWriteByte(TW101,RegAdr,(I2CReadByte(TW101,0x30)&(~0x02))| DEINTERLACE); //Bruce, 2006/01/10
		}
		else{
			I2CWriteByte(TW101,RegAdr,stInitT10xP0[RegIndex].ucRegVal);
		}	
		RegAdr=stInitT10xP0[++RegIndex].ucRegAdr;
	}
	RegIndex=0;
	RegAdr=stInitT10xP2[0].ucRegAdr;
	while (RegAdr != 0xFF)		// bruce, 2006/01/09
	{
		if(RegAdr==0x01)   
			I2CWriteByte(TW101+4,RegAdr,(I2CReadByte(TW101+4,0x01)|0x01));// enable black level correction for 10 blank-to-black pedestal
		else
			I2CWriteByte(TW101+4,RegAdr,stInitT10xP2[RegIndex].ucRegVal);
		RegAdr=stInitT10xP2[++RegIndex].ucRegAdr;
	}
	//=========================================================================
	// Panel specified register settings
	//=========================================================================
//#if (EMPTY_ARRAY)
	for(RegIndex=0;RegIndex < PanelSpecP0Cnt;RegIndex++)
	{
		I2CWriteByte(TW101,ucaPanelSpecAdrP0[RegIndex],ucaPanelSpecDataP0[RegIndex]);
    }
//#endif

   	for(RegIndex=0;RegIndex < PanelSpecP2Cnt;RegIndex++)
	{
		I2CWriteByte(TW101+4,ucaPanelSpecAdrP2[RegIndex],ucaPanelSpecDataP2[RegIndex]);
    }

	#ifdef ROTATE
   		SET_Dismod();
	#endif				
}

#ifdef TCON
void TconInit(void)
{
	uCHAR TconIndex;
	
	for(TconIndex=0;TconIndex < P1TconCnt;TconIndex++)
	       	I2CWriteByte(TW101+2, TconAddress+TconIndex, TconP1Data[TconIndex]);
}
#endif

#ifdef ROTATE
void SET_Dismod(void)
{
	switch (Dis_Mode){ 
		case  TOP_LEFT: //Start from top-left
			#ifdef ANALOG_PANEL
				I2CWriteByte(TW101,0xE1, ScanMode[0]);
			#else
				UP_DOWN	   = DigiPanlScanMode[0]>>1;   
				LEFT_RIGHT = DigiPanlScanMode[0]&0x01; 
				I2CWriteByte(TW101,0xE1, ScanMode[0]&0xF0);
			#endif				
			break;	
		case  TOP_RIGHT: //Start from top-right
			#ifdef ANALOG_PANEL
				I2CWriteByte(TW101,0xE1, ScanMode[1]);
			#else
				UP_DOWN	   = DigiPanlScanMode[1]>>1;   
				LEFT_RIGHT = DigiPanlScanMode[1]&0x01; 
				I2CWriteByte(TW101,0xE1, ScanMode[1]&0xF0);
			#endif
			break;
		case  BOTTOM_RIGHT:  //Start from bottom-right
			#ifdef ANALOG_PANEL
				I2CWriteByte(TW101,0xE1, ScanMode[2]);
			#else
				UP_DOWN	   = DigiPanlScanMode[2]>>1;   
				LEFT_RIGHT = DigiPanlScanMode[2]&0x01; 
				I2CWriteByte(TW101,0xE1, ScanMode[2]&0xF0);
			#endif
			break;									
		case  BOTTOM_LEFT: //Start from bottom-left
			#ifdef ANALOG_PANEL
				I2CWriteByte(TW101,0xE1, ScanMode[3]);
			#else
				UP_DOWN	   = DigiPanlScanMode[3]>>1;   
				LEFT_RIGHT = DigiPanlScanMode[3]&0x01; 
				I2CWriteByte(TW101,0xE1, ScanMode[3]&0xF0);
			#endif
			break;
	}
	#ifdef OUT_PIN_CONF
	I2CWriteByte(TW101,0xE1, OUT_PIN_CONF);
	#endif	
	return;
}
#endif

void SourceSelect(void)
{

	I2CWriteByte(TW101, 0xC2, I2CReadByte(TW101, 0xC2)|(PSYNC_STR|IGNORE_VSYNC));
	I2CWriteByte(TW101, 0x9d, 0x10);
	I2CWriteByte(TW101, 0x9e, 0xff);
	I2CWriteByte(TW101, 0x9f, 0x40);
	I2CWriteByte(TW101, PATTERN_CTRL, 0x87);
	I2CWriteByte(TW101,0x0f,0x70);  //2005-03030 for position shift

	I2CWriteByte(TW101,0x0f,0x00);  //2005-03030 for position shift
	I2CWriteByte(TW101,0x31,0x00);
	I2CWriteByte(TW101,0x1a, 0x87);
	I2CWriteByte(TW101,0x18, uiaSrcMux[(m_cSource&0x0F)*2]>>8);  // cMux1);
	I2CWriteByte(TW101,0x19, uiaSrcMux[(m_cSource&0x0F)*2]&0xFF);  // cMux2);	
	if(uiaSrcMux[(m_cSource&0x0F)*2+1]==itypeSVIDEO)   
	{
		#ifdef T112
		I2CWriteByte(TW101,0x11, 0x22);	 
		#else
 		I2CWriteByte(TW101,0x11, 0x05);	 
		#endif
		I2CWriteByte(TW101+4,0x07, 0x24);//0x05|0x22);
		I2CWriteByte(TW101+4,0x00, I2CReadByte(TW101+4,0x00)|0x01);
		I2CWriteByte(TW101+4,0x01, I2CReadByte(TW101+4,0x01)&~ENYPbPr);
 		I2CWriteByte(TW101+4,0x03, I2CReadByte(TW101+4,0x03)|0x03);			
	}
	else if (uiaSrcMux[(m_cSource&0x0F)*2+1]==itypeCVBS)
	{
 		I2CWriteByte(TW101,0x11, 0x00);	 
		I2CWriteByte(TW101+4,0x07, 0x21);//0x05|0x22);
		I2CWriteByte(TW101+4,0x00, I2CReadByte(TW101+4,0x00)&0xfe);
		I2CWriteByte(TW101+4,0x01, I2CReadByte(TW101+4,0x01)&~ENYPbPr);
		#ifdef OtherSignals
		if(m_cChroma==S_NTSC_4)  // temporarily add by Sherman 06'01'27
			I2CWriteByte(TW101+4,0x03, I2CReadByte(TW101+4,0x03)&0xf8|0x03);			
		else 	
		#endif
			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
	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){//  For no chroma case
			//twdDelay1(50);
		//~~~~~~~ set OPTiming ~~~~~~~~~~~~~~~~~~~//
			if(I2CReadByte(TW101,0x59) <= 0xd6){
				line_525=1;
				m_cBuff[0]=S_NTSC;  
			}else{ 	
				line_525=0;
				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 
			m_cStandard=m_cBuff[0];			
			SetOPTiming();
    	}
		
		//~~~~~~~ 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);//25);	
			// Set Chroma lock configration
			if(I2CReadByte(TW101,0x59) <= 0x39)//d6)
				I2CWriteByte(SlaveAddr, 0x83+RegAddrShift, 0x6f);  // NTSC
			else 	
				I2CWriteByte(SlaveAddr, 0x83+RegAddrShift, 0x39);  // PAL
			twdDelay1(50);//50);	
			
			//if(I2CReadByte(TW101,0x59) <= 0xd6) { // NTSC-M,NTSC-4,PAL-M
			if(line_525==1){
				m_wBuff[2]=0;
				m_cBuff[1]=m_cChroma;	// Preserve previous status for signal std	
				twdDelay1(150);	  		// add by Sherman 06'01'16
				//while(!(tmp=I2CReadByte(SlaveAddr, 0x3a+RegAddrShift)&0x08)){	// If chroma not locked, change PAL/SECAM
				while (1){	// NTSC-M=1,NTSC-4=4,PAL-M=5	
					//if ((m_cChroma == S_NTSC)|(m_cChroma == S_PAL_M)){
					if (m_cChroma == S_NTSC_4){
						if ((I2CReadByte(SlaveAddr, 0x3a+RegAddrShift)&0x08)&&(I2CReadByte(SlaveAddr, 0x7a+RegAddrShift)<0x80)) {					
							break;
						}
					}	
					if ((m_cChroma == S_NTSC_4)|(m_cChroma == S_NTSC)|(m_cChroma == S_PAL_M)  ){													
					if ((I2CReadByte(SlaveAddr, 0x3a+RegAddrShift)&0x08)){// && (I2CReadByte(SlaveAddr, 0x7d+RegAddrShift)>0xf0)) {					
						break;
					}
					}
					//}	
								 
					if (m_cChroma == S_NTSC)
						m_cChroma=S_NTSC_4;
					else if (m_cChroma == S_NTSC_4)
						m_cChroma=S_PAL_M;						
					else //if (m_cChroma == S_PAL_M)
						m_cChroma=S_NTSC;
					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(!(tmp=I2CReadByte(SlaveAddr, 0x3a+RegAddrShift)&0x08)){	// If chroma not locked, change PAL/SECAM
					while (1){	// PAL-BD=2,PAL-CN=6,SECAM=3 	
						if (m_cChroma == S_PAL){
							if ((I2CReadByte(SlaveAddr, 0x3a+RegAddrShift)&0x08) && (I2CReadByte(SlaveAddr, 0x3c+RegAddrShift)&0x01==0)) {							
									break;
							}	
						}
						if (m_cChroma == S_PAL_CN){
							if ((I2CReadByte(SlaveAddr, 0x3a+RegAddrShift)&0x08) && (I2CReadByte(SlaveAddr, 0x3c+RegAddrShift)&0x01==1)) {							
									break;
							}	
						}				
						if ((m_cChroma == S_PAL)|(m_cChroma == S_SECAM)|(m_cChroma == S_PAL_CN)  ){							
						if ((I2CReadByte(SlaveAddr, 0x3a+RegAddrShift)&0x08) && (I2CReadByte(SlaveAddr, 0x7d+RegAddrShift)>0xf0)) {							
								break;
						}					 
						}
						if (m_cChroma == S_PAL)
							m_cChroma=S_SECAM;
						else if (m_cChroma == S_SECAM)
							m_cChroma=S_PAL_CN;						
						else //if (m_cChroma == S_PAL_CN)
							m_cChroma=S_PAL;
						SetSignalStd();					// Set Signal flag and DTO


						twdDelay1(50);
						if ((++m_wBuff[2]) >4) 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];	
    	}

		// temporarily add by Sherman 06'01'27
		if(	m_cChroma == S_SECAM)
			m_cStandard=S_SECAM;		

	}// 癹伴い

⌨️ 快捷键说明

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