Example #1
0
void BT656OutputEnable(BYTE fOn, BYTE clear_port)
{
	DECLARE_LOCAL_page

	ReadTW88Page(page);
	WriteTW88Page(PAGE0_INPUT);
	if (fOn)
	{
#ifdef SUPPORT_UART1
		Printf("\nBUGBUG:BT656 and UART1..");
#else
		WriteTW88(REG007, ReadTW88(REG007) | 0x08);	 
#endif
	}
	else
	{
		WriteTW88(REG007, ReadTW88(REG007) & ~0x08);	//DataInitNTSC clear it. 
		//clear port
		if (clear_port)
		{
			if (P1_6 == 0)
				P1_6 = 1;
		}
	}
	WriteTW88Page(page);
}
Example #2
0
void ClearLogo(void)
{
	DECLARE_LOCAL_page
	BYTE i, j;

	ReadTW88Page(page);
	WriteTW88Page(PAGE3_FOSD );
	//=============================== Fade OUT ======================================
	for ( i=0; i<9; i++ ) {
		delay1ms(30);
		for ( j=0; j<16; j++ ) {
			WriteTW88(REG_FOSD_ALPHA_SEL, j );
			WriteTW88(FOSDWinBase[TECHWELLOGO_OSDWIN]  +1, i );
			WriteTW88(FOSDWinBase[TECHWELLOGO_OSDWIN+2]+1, i );
		}
	}
	//============ Disable window and recover Trans value ============================
	FOsdOnOff(OFF, 1);	//with vdelay 1
	FOsdWinEnable(TECHWELLOGO_OSDWIN,FALSE);
	FOsdWinEnable(TECHWELLOGO_OSDWIN+2,FALSE);
	//assume page3
	for ( j=0; j<16; j++ ) {
		WriteTW88(REG_FOSD_ALPHA_SEL, j );
		WriteTW88(FOSDWinBase[TECHWELLOGO_OSDWIN]  +1, 0 );
		WriteTW88(FOSDWinBase[TECHWELLOGO_OSDWIN+2]+1, 0 );
	}

	WriteTW88Page(page );
}
Example #3
0
void SetDefaultPClock(void)
{
	WriteTW88Page(PAGE0_SSPLL);
	WriteTW88(REG0F9, 0x50);	  	//SSPLL 70MKz. 0x50:70MHz, 0x3C:66.6MHz..Pls use SspllSetFreqReg(0x015000);
	WriteTW88(REG0F6, 0x00); 		//PCLK div:1. SPI CLK div:1

	WriteTW88Page(PAGE2_SCALER);
	WriteTW88(REG20D, 0x81 );	// PCLKO div by 2. ??Polarity
}
Example #4
0
/**
* Is it a video Loss State
*
* @return
*	- 1:If no Input
*	- 0:Found Input
*/
BYTE DecoderIsNoInput(void)
{
	DECLARE_LOCAL_page
	BYTE ret;
	
	ReadTW88Page(page);
	WriteTW88Page(PAGE1_DECODER);
	ret = TW8835_R101;	
	WriteTW88Page(page);
	
	if(ret & 0x80)
		return 1;	//No Input
	return 0;		//found Input
}
Example #5
0
BYTE LEDCOn(BYTE step)
{
	BYTE i;

	WriteTW88Page(PAGE0_LEDC);

	switch(step)
	{
	case 0:
		WriteTW88(REG0E0, 0x72);	//default. & disable OverVoltage
		WriteTW88(REG0E5, 0x80);	//LEDC digital output enable.
		WriteTW88(REG0E0, 0x12);	//Off OverCurrent. Disable Protection
		WriteTW88(REG0E0, 0x13);	//LEDC digital block enable
		break;
	case 1:
		WriteTW88(REG0E0, 0x11);	//Analog block powerup
		break;
	case 2:
		WriteTW88(REG0E0, 0x71);	//enable OverCurrent, enable Protection control
		break;
	//default:
	//	ePuts("\nBUG");
	//	return;
	}
	for(i=0; i < 10; i++) {
		if((ReadTW88(REG0E2) & 0x30)==0x30) {	//wait normal
			//dPrintf("\nLEDC(%bd):%bd",step,i);
			return ERR_SUCCESS;	//break;
		}
		delay1ms(2);
	}
	dPrintf("\nLEDC(%bd) FAIL",step);
	return ERR_FAIL;
}
Example #6
0
void ChipTest_GPIO(void)
{
	DECLARE_LOCAL_page
	BYTE prev_en,prev_oe,prev_od;
	BYTE value;
	BYTE i;
	BYTE result;

	ReadTW88Page(page);
	WriteTW88Page(0);
	//GPIO0~6
	for(i=0; i < 7; i++) {
		result = ERR_SUCCESS;
		Printf("\nGPIO_%01bxx ",i);
		//read previous value
		prev_en = ReadTW88(REG080+i);
		prev_oe = ReadTW88(REG088+i);
		prev_od = ReadTW88(REG090+i);
		value = ReadTW88(REG098+i);
		Printf("PREV EN:%02X OE:%02X OD:%02X ID:%02X ", prev_en,prev_oe,prev_od,value);

		WriteTW88(REG080+i, 0xFF & GPIO_mask[i]);  		//enable GPIO
		WriteTW88(REG088+i, 0xFF & GPIO_mask[i]);  		//output enable
		WriteTW88(REG090+i, 0xFF & GPIO_mask[i]);  		//output data
		value= ReadTW88(REG098+i) & GPIO_mask[i];		//read input
		Printf(" W:%02bx R:%02bx ",0xFF & GPIO_mask[i], value);
		if((0xFF & GPIO_mask[i]) != (value & GPIO_mask[i])) 
			result = ERR_FAIL;


		WriteTW88(REG090+i, 0x00);  					//output data
		value=ReadTW88(REG098+i) & GPIO_mask[i];		//read input
		Printf(" W:00 R:%02bx ",value);
		if((value & GPIO_mask[i])) 
			result = ERR_FAIL;

		if(result==ERR_SUCCESS)
			Puts(" Pass");

		//restore orginal value
		WriteTW88(REG080+i, prev_en);
		WriteTW88(REG088+i, prev_oe);
		WriteTW88(REG090+i, prev_od);
	}
	WriteTW88Page(page);
}
Example #7
0
/**
* control LEDC digital block
*/
void LedBackLight(BYTE on)
{
	WaitVBlank(1);
	WriteTW88Page(PAGE0_LEDC);
	if (on)
		WriteTW88(REG0E0, ReadTW88(REG0E0 ) | 1 );
	else
		WriteTW88(REG0E0, ReadTW88(REG0E0 ) & ~0x01 );
}
Example #8
0
/*
DMA for SPI LUT needs a PCLK divider 2 on the TW8835.
LutOffset
size
address: LUT data location at SPIFlash.
example: ctest sosdlut 1 0 100 410010	 <--logo
         ctest sosdlut 1 0 100 41e081    <- setup menu, main background
*/
void ChipTest_SOsdLut(BYTE winno, WORD LutOffset, WORD size,DWORD address)
{
	WORD ii;
	BYTE j;
	BYTE bgra[4], value;
	volatile BYTE B0;
	BYTE rcount;
	WORD error=0;

	//write LUT	by DMA
	SpiOsdLoadLUT(winno, /*type=*/1, LutOffset, size*4, address, 0xFF);

	//read back test
	for(ii=LutOffset; ii < (LutOffset+size); ii++) {

		//read BGRA data at REG4D0~REG4D3
		//SpiFlashDmaRead(DMA_DEST_CHIPREG, DMA_BUFF_REG_ADDR, address+(ii-LutOffset)*4, 4);
		SpiFlashDmaRead2XMem(bgra, address+(ii-LutOffset)*4, 4);

		//read LUT data & compare
		for(j=0; j < 4; j++) {
			WriteTW88Page(PAGE4_SOSD );
			value = 0xa0 + j;						//?BGRA
			if(ii & 0x100) value += 0x08; 			//high
#ifdef MODEL_TW8836
			if(winno==1 || winno==2) value += 0x04;	//Group B
#endif
			WriteTW88(REG410,value);		
			WriteTW88(REG411,(BYTE)ii);				//addr 0
		
			//read twice or three times.
			value=ReadTW88(REG412);
			rcount=1;
			while(1) {		
				B0=ReadTW88(REG412);
				rcount++;
				if(B0 == value)
					break;
				value = B0;
			} 
			if(rcount > 3) {
				Printf("\n %d:%bd rcount:%bd",ii,j, rcount);
			}

			//bgra = ReadTW88(REG4D0+j);			

			if(B0 != bgra[j]) {
				error++;
				if(error <= 10)
					Printf("\nfail %d+%bd R:%bx Wrote:%bx", ii,j, B0, bgra[j]);
			}
		}
	}
	if(error==0)
		Printf("\n==>Success");		
}
Example #9
0
void DecoderSetAFE(BYTE input_mode)
{
	WriteTW88Page(PAGE1_DECODER );	
	if(input_mode==0) {
		WriteTW88(REG105, (ReadTW88(REG105) & 0xF0) | 0x04);	//? C is for decoder, not RGB	
	}
	else {
		WriteTW88(REG105, (ReadTW88(REG105) | 0x0F));	
	}
}
Example #10
0
void McuSpiClkSelect(BYTE McuSpiClkSel)
{
#ifdef PANEL_AUO_B133EW01
	//I will use SSPLL. Do not change MCU clock.
	BYTE value=McuSpiClkSel;
#else
	BYTE value;
	WriteTW88Page(PAGE4_CLOCK);
	value = ReadTW88(REG4E1) & 0x0F;
	WriteTW88(REG4E1, (McuSpiClkSel << 4) | value);
#endif
} 
Example #11
0
//code WORD LOGO_COLOR_8[16] = {
//     0xFFFF,0x0020,0xDEDB,0xA534,0x6B6D,0xC826,0x4A49,0xDCD5,
//     0xFFFF,0xC806,0xC98C,0xCB31,0xFE79,0xFCD9,0xCCD4,0xE71C
//};
//-------------------------------------------------------------------
// Display/Clear FOSD LOGO
//-------------------------------------------------------------------
void DisplayLogo(void)
{
#ifdef SUPPORT_8BIT_CHIP_ACCESS
	BYTE page;
#endif
	BYTE i;

	ReadTW88Page(page);

 	InitFOsdMenuWindow(Init_Osd_DisplayLogo);
	#ifdef ADD_ANALOGPANEL
	if(IsAnalogOn())
		InitFOsdMenuWindow(Init_Osd_DisplayLogo_A);
	#endif
	
	InitFontRamByNum(FONT_NUM_LOGO, 0);	//FOsdDownloadFont(2);

	FOsdSetPaletteColorArray(0, LOGO_COLOR_8, 16, 1);

	WriteTW88Page(PAGE4_CLOCK);
	dPrintf("\nDisplayLogo-Current MCU SPI Clock select : [0x4E0]=0x%02bx, [0x4E1]=0x%02bx", ReadTW88(REG4E0), ReadTW88(REG4E1));

	WriteTW88Page(PAGE3_FOSD );
	WriteTW88(REG304, ReadTW88(REG304)&0xFE); // OSD RAM Auto Access Enable
	WriteTW88(REG304, (ReadTW88(REG304)&0xF3)); // Normal

	for ( i=0; i<70; i++ ) {
		WriteTW88(REG306, i );
		WriteTW88(REG307, i*3 );
		WriteTW88(REG308, (i / 42)*2 );
	}

	WriteTW88(REG30B, 0 );						// 2bit multi color start = 0
	WriteTW88(REG_FOSD_MADD3, 0 );				// 3bit multi color start = 0
	WriteTW88(REG_FOSD_MADD4, 0xff );			// 4bit multi color start = 0

	FOsdWinEnable(TECHWELLOGO_OSDWIN,TRUE);
	FOsdWinEnable(TECHWELLOGO_OSDWIN+1,FALSE);
	FOsdWinEnable(TECHWELLOGO_OSDWIN+2,TRUE);
}
Example #12
0
/**
* set input mux format
*
* register
*	R102 - input format.
*	R105.
*	R106.
* @param InputMode
*/
void InMuxSetInput(BYTE InputMode)
{
	BYTE r102, r105, r106;
	WriteTW88Page(PAGE1_DECODER );

	r105 = ReadTW88(REG105) & 0xF0;
	r106 = ReadTW88(REG106) & ~0x03;	//Do not change Y.

	switch(InputMode) {
	case INPUT_CVBS:
		r102 = 0x40;		// 0x40 - FC27:27MHz, IFSEL:Composite, YSEL:YIN0 
		r105 |= 0x0F;		//decoder mode
		r106 |= 0x03;		// C,V adc in Power Down.
		break;
	case INPUT_SVIDEO:
		r102 = 0x54;		// 0x54	- FC27:27MHz, IFSEL:S-Video, YSEL:YIN1, CSEL:CIN0 
		r105 |= 0x0F;		//decoder mode
		r106 |= 0x01;		// V in PowerDown
		break;
	case INPUT_COMP:	//target r102:4A,r105:04 r016:00
						//     ->     4A      00      00		  

		r102 = 0x4A ;		// 0x4A - 	FC27:27MHz, 
							//		  	IFSEL:Composite, We are using aRGB. So composite is a correct value 
							//			YSEL:YIN2, CSEL:CIN1, VSEL:VIN0
		//r105 |= 0x04;		//??? ? someone overwrite as 00. R105[2]=0b is a correct
		//r106 				//C & V adc in normal(not Power Down)

		break;
	case INPUT_PC:	//target r102:4A r105:04 r106:00
		r102 = 0x4A;		// 0x4A - 	FC27:27MHz, 
							//		  	IFSEL:Composite, We are using aRGB. So composite is a correct value 
							//			YSEL:YIN2, CSEL:CIN1, VSEL:VIN0

		//r105 = 			//RGB mode
							//?? I think R105[2] have to be 0. not 1b.
		//r106 				//C & V adc in normal(not Power Down)
		break;
	case INPUT_DVI:			//target ? don't care
	case INPUT_HDMIPC:
	case INPUT_HDMITV:
	case INPUT_BT656:
		//digital. don't care.
		r102 = 0x00;
		break;
	}
	if(r102) {	//need update?
		WriteTW88(REG102, r102 );
		WriteTW88(REG105, r105 );
		WriteTW88(REG106, r106 );
	}
}
Example #13
0
File: Util.c Project: lgnq/tw8836
void WaitVBlank(BYTE cnt)
{
	XDATA	BYTE i;
	WORD loop;
	DECLARE_LOCAL_page

	ReadTW88Page(page);
	WriteTW88Page(PAGE0_GENERAL );

	for ( i=0; i<cnt; i++ ) {
		WriteTW88(REG002, 0xff );
		loop = 0;
		while (!( ReadTW88(REG002 ) & 0x40 ) ) {
			// wait VBlank
			loop++;
			if(loop > VBLANK_WAIT_VALUE  ) {
				wPrintf("\nERR:WaitVBlank");
				break;
			}
		}		
	}
	WriteTW88Page(page);
}
Example #14
0
/**
* enable Output pin
*
* DataOut need EnableOutputPin(ON,ON)
* target R008 = 0x89
*/
void OutputEnablePin(BYTE fFPDataPin, BYTE fOutputPin)
{
	BYTE value;

	Printf("\nFP_Data:%s OutputPin:%s", fFPDataPin ? "On" : "Off", fOutputPin ? "On" : "Off");

	WriteTW88Page(PAGE0_GENERAL);
//	WriteTW88(REG008, 0x80 | (ReadTW88(REG008) & 0x0F));	//Output enable......BUGBUG
	value = ReadTW88(REG008) & ~0x30;
	if (fFPDataPin == 0)
		value |= 0x20;
	if (fOutputPin == 0)
		value |= 0x10;
	WriteTW88(REG008, value);
}
Example #15
0
/**
* set FP_PWC
*/
void FP_PWC_OnOff(BYTE fOn)
{
	Printf("\nFP_PWC %s",fOn ? "On" : "Off");
		I2C_delay_base = 3;									//assume 108/1.5.

	WriteTW88Page(PAGE0_GENERAL);
	WriteTW88(REG084, 0x01);											//disable
	if(fOn) {
		WriteI2CByte( I2CID_SX1504, 1, 0 );									// output enable
		WriteI2CByte( I2CID_SX1504, 0, ReadI2CByte(I2CID_SX1504, 0) & 0xFE );	// FPPWC enable
	}
	else {
		WriteI2CByte( I2CID_SX1504, 1, 0 );									// output enable
		WriteI2CByte( I2CID_SX1504, 0, ReadI2CByte(I2CID_SX1504, 0) | 0x01 );	// FPPWC disable
	}
}
Example #16
0
/**
* set GPIO for FP
*/
void FP_GpioDefault(void)
{
	WriteTW88Page(PAGE0_GPIO);
	//IR uses PORT1_4(GPIO40). To disable TCPOLN output, we need to enable it as GPIO and uses it as input port with INT11.
	WriteTW88(REG084, 0x01);	//GPIO 4x Enable     	- GPIO40 enable
	WriteTW88(REG08C, 0x00);	//GPIO 4x direction		- GPIO40 input
	WriteTW88(REG094, 0x00);	//GPIO 4x output data	- GPIO40 outdata as 0.


	if(access) {
		//turn off FPPWC & FPBias. make default
		//	0x40 R0 R1 is related with FP_PWC_OnOff
		WriteI2CByte( I2CID_SX1504, 1, 0/*3*/ );	//RegDir:	input 
		WriteI2CByte( I2CID_SX1504, 0, 0xFF/*3*/ );	//RegData:	FPBias OFF. FPPWC disable.
		//WriteI2CByte( I2CID_SX1504, 1, 0xFF/*3*/ );	//RegDir:	input 
		Printf("\nI2CID_SX1504 0:%02bx 1:%bx",ReadI2CByte(I2CID_SX1504, 0), ReadI2CByte(I2CID_SX1504, 1));
	}
}
Example #17
0
BYTE DCDC_On(BYTE step)
{
	BYTE i;

//	dPrintf("\nDCDC_On(%bx)",step);

	//-------------
	//DCDC ON
	WriteTW88Page(PAGE0_DCDC);
	switch(step) {
	case 0:
#if 0
		WriteTW88(REG0E8, 0x72);	//default. & disable OverVoltage
		WriteTW88(REG0E8, 0x12);	//disable OverCurrent, disable UnderCurrent
		WriteTW88(REG0E8, 0x13);	//enable DC convert digital block
#endif
		WriteTW88(REG0E8, 0xF2);	//Printf("\nREG0E8:F2[%bd]",ReadTW88(REG0EA)>>4);
		WriteTW88(REG0E8, 0x02);	//Printf("\nREG0E8:02[%bd]",ReadTW88(REG0EA)>>4);
		WriteTW88(REG0E8, 0x03);	//Printf("\nREG0E8:03[%bd]",ReadTW88(REG0EA)>>4);
		WriteTW88(REG0E8, 0x01);	//Printf("\nREG0E8:01[%bd]",ReadTW88(REG0EA)>>4);
		break;
	case 1:
		WriteTW88(REG0E8, 0x11);	//powerup DC sense block
		break;
	case 2:
		WriteTW88(REG0E8, 0x71);	//turn on under current feedback control
									//0x11->0x51->0x71
		break;
	//default:
	//	ePuts("\nBUG");
	//	return;
	}
	for(i=0; i < 10; i++) {
		if((ReadTW88(REG0EA) & 0x30)==0x30) {
			//dPrintf("\nDCDC(%bd):%bd",step,i);
			return ERR_SUCCESS;	//break;
		}
		delay1ms(2);
	}
//	Printf("\nDCDC_On(%bd) FAIL",step);
	return ERR_FAIL;
}
Example #18
0
/**
* check Video Loss
*
* register
*	R101[0]
*
* oldname: CheckDecoderVDLOSS().
*
* @param n: wait counter
* @return
*	0:Video detected
*	1:Video not present. Video Loss
*/ 
BYTE DecoderCheckVDLOSS( BYTE n )
{
	volatile BYTE	mode;
	BYTE start;

	dPrintf("\nDecoderCheckVDLOSS(%d) start",(WORD)n);
	start = n;

	WriteTW88Page(PAGE1_DECODER );
	while (n--) {
		mode = ReadTW88(REG101);		//read Chip Status
		if (( mode & 0x80 ) == 0 ) {
			dPrintf("->end%bd",start - n);
			return ( 0 );				//check video detect flag
		}
		delay1ms(10);
	}
	ePrintf("\nDecoderCheckVDLOSS->fail");
	return ( 1 );						//fail. We loss the Video
}
Example #19
0
void DecoderSetPath(BYTE path)
{
	WriteTW88Page(PAGE1_DECODER );	
	WriteTW88(REG102, path );   		
}
Example #20
0
void ChipTest_SPIDMA(BYTE wait)
{
/*
	WriteTW88Page(4);						 
	SpiFlashDmaDestType(DMA_DEST_CHIPREG, 0);
	SpiFlashDmaBuffAddr(DMA_BUFF_REG_ADDR);
	SpiFlashDmaReadLen(0);	//clear high & middle bytes 
	SpiFlashCmd(SPICMD_RDID, 1);	
	SpiFlashDmaReadLenByte(3);
	SpiFlashDmaStart(SPIDMA_READ,0, __LINE__);
	vid  = ReadTW88(REG4D0);
	dat0 = ReadTW88(REG4D1);
	cid  = ReadTW88(REG4D2);
*/
	BYTE r4c1, i;
	volatile BYTE value;

	WriteTW88Page(4);
	r4c1 = ReadTW88(REG4C1);	//save
	Printf("\nREG4C1:%02bx ",r4c1);
	Printf("  REG4C5:%02bx ",ReadTW88(REG4C5));
	Printf("  REG4D8:%02bx ",ReadTW88(REG4D8));
	Printf("  REG4D9:%02bx ",ReadTW88(REG4D9));



	WriteTW88(REG4C1, 1);		//1:At vertical blank
	WriteTW88(REG4C3, (DMA_DEST_CHIPREG << 6) | 1);
	WriteTW88(REG4C5, 0x80);	
	WriteTW88(REG4C6, 0x04);	//0x04D0 chip register address
	WriteTW88(REG4C7, 0xD0);
	WriteTW88(REG4CA, 0x00);	//dma length 3
	WriteTW88(REG4C8, 0x00);
	WriteTW88(REG4C9, 0x03);
	WriteTW88(REG4CA, 0x9F);	//cmd read JEDEC id
	WriteTW88(REG4D0, 0x00);	//clear buffer
	WriteTW88(REG4D1, 0x00);
	WriteTW88(REG4C2, 0x00);
	if(wait) {
		WriteTW88(REG4C4, 1);
		for(i=0; i < wait; i++) ;
	}
	else {
		//NO WAIT
		WriteTW88(REG4C4, 1);
	}
	//=========================
	// check REG4C4
	//=========================
	value=ReadTW88(REG4C4);
	if(value & 0x01) {
		for(i=0; i < 127; i++) {
			delay1ms(1);
			value=ReadTW88(REG4C4);
			if((value & 0x01)==0)
				break;
		}
		Printf("\nREG4C4:%02bx wait:%bd",value, i);
	}
	else
		Printf("\nREG4C4:%02bx",value);

	Printf("\nRead ID: %02bx %02bx %02bx",ReadTW88(REG4D0),ReadTW88(REG4D1),ReadTW88(REG4D2));
	WriteTW88(REG4C1, r4c1);	//restore
}
Example #21
0
//-------------------------------------------------------------------
// Display/Clear DisplayInput
//-------------------------------------------------------------------
void FOsdDisplayInput(void)
{
	BYTE	inputs, len1, len2,i, SystemAddr;
	#ifdef SUPPORT_COMPONENT
	BYTE CODE 	*Str;
	#endif

	SystemAddr=INPUTINFO1_ADDR;

	if( (DisplayedOSD & FOSD_INPUTINFO ) && DisplayInputHold ) return;

	ClearOSDInfo();


	inputs = InputMain;

	#ifdef DEBUG_OSD
 	dPrintf("\r\n++(DisplayInput) : %d", (WORD)inputs);
	#endif

	#if 0
	#if defined( SUPPORT_PC ) || defined( SUPPORT_BT656 )
	if( inputs==PC || inputs==DTV )
		len2 = TWstrlen( GetPCInputSourceName() );
	else
	#endif
	#endif

	#ifdef SUPPORT_COMPONENT
	if( inputs==INPUT_COMP ){
		WriteTW88Page(1 );
		i = ReadTW88(REG1C1) & 7;
		Str = COMPONENT_STR[i];
		len2 = TWstrlen(Str);
	}
	else
	#endif
		len2 = TWstrlen( struct_VInputStd[GetVInputStdInx()].Name );


	for (i=1; ;i++)
		if( struct_InputSelection[i].Id==inputs )  break;

	len1 = TWstrlen(struct_InputSelection[i].Name);

	InitFOsdMenuWindow(Init_Osd_DisplayInput);
	#ifdef ADD_ANALOGPANEL
	if(IsAnalogOn())
		InitFOsdMenuWindow(Init_Osd_DisplayInput_A);
	#endif
	FOsdRamMemset(INPUTINFO_ADDR, 0x020, DEFAULT_COLOR, 51 );	// Total 42 Char.	
	WriteStringToAddr(INPUTINFO_ADDR, struct_InputSelection[i].Name, len1); 

	#if 0
	#if defined( SUPPORT_PC ) || defined( SUPPORT_BT656 )
	if( inputs==PC || inputs==DTV )
		WriteStringToAddr(SystemAddr, GetPCInputSourceName(), len2); 
	else
	#endif
	#endif
	#ifdef SUPPORT_COMPONENT
	if( inputs==INPUT_COMP ){
		//i = DecoderIsNoInput();
		//Printf("\r\n Display Info==> Component Noinutcheck: %d ", (WORD)i );
		//if( DecoderIsNoInput() == 0 ) WriteStringToAddr(SystemAddr, Str, len2); 
		WriteStringToAddr(SystemAddr, Str, len2); 
	}
	else
	#endif
	{
		if( DecoderIsNoInput() == 0 ) 
		WriteStringToAddr(SystemAddr, struct_VInputStd[GetVInputStdInx()].Name, len2); 
	}

	FOsdWinEnable(OSD_Win_Num(INPUTINFO_OSDWIN),TRUE);
	FOsdWinEnable(OSD_Win_Num(INPUTINFO_OSDWIN+1),TRUE);
	FOsdOnOff(ON, 1); //with vdelay 1

	DisplayedOSD |= FOSD_INPUTINFO;
	OSDDisplayedTime = GetTime_ms();	
}
Example #22
0
//=============================================================================
//
//=============================================================================
void MonitorOSD(BYTE wbits)
{
	BYTE i;
	WORD dat[10];
	BYTE duration=6, ch;

	for(i=0; i<argc; i++)
		dat[i] = a2i(argv[i+2]);	
	

#ifdef MODEL_TW88TEMP
	WriteTW88Page(OSD_PAGE);
#endif

	if( !stricmp(argv[1], "?") ) {
		MonOsdHelp();
	}
	//---------- Initialize ------------------
	else if( !stricmp(argv[1], "0") ) {
		OsdInit(0);
		OsdInit(1);
		OsdInit(4);
		
		OsdLoadDefaultLUT(0);
		OsdLoadDefaultLUT(1);

		OsdWinEnable(0, 1);
	}
	//---------- Block Fill -------------------
	else if( !stricmp(argv[1], "1") ) {
		if( argc<=2 ) {
			dat[0]=0; dat[1]=0; dat[2]=800; dat[3]=480; dat[4]=0;
		}
		Printf("\nOsdBlockFill(%04x %04x %04x %04x ", dat[0], dat[1], dat[2], dat[3]);
		Printf("%04x)", dat[4]);
		OsdWriteMode( BLOCKFILL | BLT_NO | CONV_DIS | wbits | SOURCE0 );
		OsdBlockFill( dat[0], dat[1], dat[2], dat[3], dat[4]);
	}
	//---------- Block Fill 16 -----------------
	else if( !stricmp(argv[1], "11") ) {
		Printf("\nOsdBlockFill(%04x %04x %04x %04x ", dat[0], dat[1], dat[2], dat[3]);
		Printf("%04x)", dat[4]);
		OsdWriteMode( BLOCKFILL | BLT_NO | CONV_DIS | wbits | SOURCE0 );
		OsdBlockFill( dat[0], dat[1], dat[2], dat[3], dat[4]);
	}
	//---------- Block Transfer ----------------
	else if( !stricmp(argv[1], "2") ) {
		Printf("\nOsdBlockTransfer (%04x %04x ", dat[0], dat[1]);
		Printf("%04x %04x %04x %04x)", dat[2], dat[3], dat[4], dat[5]);
		OsdWriteMode( BLOCKTRANS | BLT_NO | CONV_DIS | wbits | SOURCE0 );
		OsdBlockTransfer( dat[0], dat[1], dat[2], dat[3], dat[4], dat[5]);
	}
	//---------- Block Transfer Linear ---------
	else if( !stricmp(argv[1], "btl") ) {
		Printf("\nOsdBlockTransfer (%04x %04x ", dat[0], dat[1]);
		Printf("%04x %04x %04x %04x)", dat[2], dat[3], dat[4], dat[5]);
		OsdWriteMode( BLOCKTRANSL | BLT_NO | CONV_DIS | wbits | SOURCE0 );
		OsdBlockTransfer( dat[0], dat[1], dat[2], dat[3], dat[4], dat[5]);
	}
	//---------- Bitmap Test "Ford" ------------
	else if( !stricmp(argv[1], "ford") ) {
		WORD sx=0, sy=0;
		if( argc>=3 ) sx=dat[0];
		if( argc>=4 ) sy=dat[1];
		Printf("\nFord Logo Display");
//		OsdLoadBmpXY( wbits, fordlogo_half_Header, sx, sy );
//		OsdLoadLUT( 0, fordlogo_half_LUT );
	}
/*
	//---------- Bitmap Test "Pigeon" ----------

	else if( !stricmp(argv[1], "pigeon") ) {
		WORD sx=0, sy=0, d=4;
		if( argc>=3 ) sx=dat[0];
		if( argc>=4 ) sy=dat[1];
		if( argc>=5 ) d = dat[2];
//		MonOsdPigeon(sx,sy, d);
	}
	//---------- Bitmap Test "Pigeon Linear" ----------
	else if( !stricmp(argv[1], "pigeonL") ) {
		WORD sx=0, sy=0, d=4;
		if( argc>=3 ) sx=dat[0];
		if( argc>=4 ) sy=dat[1];
		if( argc>=5 ) d = dat[2];
		MonOsdPigeonLinear(sx,sy, d);
	}
*/
	//---------- Bitmap Test "Rose Linear from SPI" ----------
	else if( !stricmp(argv[1], "Rose") ) {
		//RoseDisplay();
	}

	//---------- Bitmap Test "Pigeon Linear from SPI" ----------
	else if( !stricmp(argv[1], "PigeonL") ) {
		//PigeonDisplay();
	}

	//---------- Load Font -----------------------------
	else if( !stricmp(argv[1], "Font") ) {

		OsdLoadFont(wbits);

	}

	//---------- Load Font -----------------------------
	else if( !stricmp(argv[1], "FontMV") ) {

		OsdLoadFontMV(wbits);

	}

	//---------- Load Font -----------------------------
	else if( !stricmp(argv[1], "FontTP") ) {			// transparent test

		OsdLoadFontTransparent(wbits);

	}

	//---------- Load 16bit expansion -----------------------------
	else if( !stricmp(argv[1], "EXP16") ) {			// transparent test

		Osd16bitTransparent(wbits);

	}

	//---------- Load Font -----------------------------
	else if( !stricmp(argv[1], "FontTest") ) {

		//OsdLoadTransBmpXYFromSPI(TestFont8bit_Header, OSDFONT8_SPI_START, 0, 0);

	}

	//---------- Load Font -----------------------------
	else if( !stricmp(argv[1], "TestAll") ) {
	/*
		DWORD ddraddr=HARRY_DDR_START, spiaddr=HARRY_SPI_START;
		WORD x=0, y=0;

		OsdInit(0);
		OsdInit(1);
		OsdInit(4);
		
		OsdLoadDefaultLUT(0);
		OsdLoadDefaultLUT(1);

		OsdWinEnable(0, 1);

		if( argc<=2 ) {
			dat[0]=0; dat[1]=0; dat[2]=800; dat[3]=480; dat[4]=0;
		}
		Printf("\nOsdBlockFill(%04x %04x %04x %04x ", dat[0], dat[1], dat[2], dat[3]);
		Printf("%04x)", dat[4]);
		OsdWriteMode( BLOCKFILL | BLT_NO | CONV_DIS | wbits | SOURCE0 );
		OsdBlockFill( dat[0], dat[1], dat[2], dat[3], dat[4]);

		//---------- Bitmap Test "Pigeon Linear from SPI" ----------
		PigeonDisplay();
		ch = 0;
	    //------------------------- TEST ROSE -----------------------------------------------------------------
		RoseDisplay();
		ch = 0;

	    //------------------------- TEST Harry 16bit -----------------------------------------------------------------

		//DWORD ddraddr=0L, spiaddr=0x100000L;

		if( argc>=3 ) x=a2h(argv[2]);
		if( argc>=4 ) y=a2h(argv[3]);
		//if( argc>=3 ) ddraddr=a2h(argv[2]);
		//if( argc>=4 ) spiaddr=a2h(argv[3]);
		
		OsdWriteMode( CPUWRITE | BLT_NO | CONV_DIS | PIXEL16 );
		OsdLoadBmpXYFromSPI(  Harry_Header, spiaddr, x, x );
//		OsdLoadBmpLinearFromSPI( Harry_Header, spiaddr, ddraddr);

//		OsdBltSourceMemoryW64( Harry_Header->w/64 );
//		OsdBltDestMemoryW64  ( Harry_Header->w/64 );

//		OsdWinBuffer( 4, ddraddr, Harry_Header->w/64, Harry_Header->h/64 + 1 );
		OsdWinEnable(0, 0);
		OsdWinEnable(1, 0);
		OsdWinEnable(4, 1);
		Osd16Format(OSD16_YCBCR422);		// 00=YCbCr422, 01=RGB565, 10=RGB4444, 11=RGB1444
		Printf("\nPress ESC to display 8bit to 16bit expansion with transparent");
		while(1) {
				if( RS_ready() ) {
					ch = RS_rx();
					if ( ch == 27 ) break;
				}
		}


		Osd16bitTransparent(wbits);

		Printf("\nPress ESC to display LUT16");
		while(1) {
				if( RS_ready() ) {
					ch = RS_rx();
					if ( ch == 27 ) break;
				}
		}

		MonOsdLutTest16();
	*/
	}

#define COLOR_BLACK		0x00
#define COLOR_WHITE		0xff
#define COLOR_RED		0xe0
#define COLOR_GREEN		0x18
#define COLOR_BLUE		0x07

	//---------- Display String ------------------------
	else if( !stricmp(argv[1], "S") ) {
		BYTE fore=COLOR_WHITE, back=COLOR_BLACK;
		WORD x=0, y=0;
		
		if( argc>=4 ) fore = a2h( argv[3] );
		if( argc>=5 ) back = a2h( argv[4] );
		if( argc>=6 ) x    = a2h( argv[5] );
		if( argc>=7 ) y    = a2h( argv[6] );

		OsdDisplayString( 0, x, y, argv[2], fore, back );
	}

	//---------- Display String ------------------------
	else if( !stricmp(argv[1], "ST") ) {
		BYTE fore=COLOR_WHITE, back=COLOR_BLACK;
		WORD x=0, y=0;
		
		if( argc>=4 ) fore = a2h( argv[3] );
		if( argc>=5 ) back = a2h( argv[4] );
		if( argc>=6 ) x    = a2h( argv[5] );
		if( argc>=7 ) y    = a2h( argv[6] );

		OsdDisplayStringT( 0, x, y, argv[2], fore );
	}

	//---------- Display String ------------------------
	else if( !stricmp(argv[1], "SMV") ) {
		BYTE fore=COLOR_WHITE, back=COLOR_BLACK;
		WORD x=0, y=0;
		
		if( argc>=4 ) fore = a2h( argv[3] );
		if( argc>=5 ) back = a2h( argv[4] );
		if( argc>=6 ) x    = a2h( argv[5] );
		if( argc>=7 ) y    = a2h( argv[6] );

		OsdDisplayStringLinear( x, y, argv[2], fore, back );
	}

	//---------- Display String ------------------------
	else if( !stricmp(argv[1], "STMV") ) {
		BYTE fore=COLOR_WHITE, back=COLOR_BLACK;
		WORD x=0, y=0;
		
		if( argc>=4 ) fore = a2h( argv[3] );
		if( argc>=5 ) back = a2h( argv[4] );
		if( argc>=6 ) x    = a2h( argv[5] );
		if( argc>=7 ) y    = a2h( argv[6] );

		OsdDisplayStringTLinear( x, y, argv[2], fore );
	}

	//---------- Bitmap Test "Harry(OSD422(YCb YCr)) from SPI" ----------
	else if( !stricmp(argv[1], "Harry") ) {	
	/*				 			
		//DWORD ddraddr=0L, spiaddr=0x100000L;
		DWORD ddraddr=HARRY_DDR_START, spiaddr=HARRY_SPI_START;
		WORD x=0, y=0;

		if( argc>=3 ) x=a2h(argv[2]);
		if( argc>=4 ) y=a2h(argv[3]);
		//if( argc>=3 ) ddraddr=a2h(argv[2]);
		//if( argc>=4 ) spiaddr=a2h(argv[3]);
		
		OsdWriteMode( CPUWRITE | BLT_NO | CONV_DIS | PIXEL16 );
		OsdLoadBmpXYFromSPI(  Harry_Header, spiaddr, x, x );
//		OsdLoadBmpLinearFromSPI( Harry_Header, spiaddr, ddraddr);

//		OsdBltSourceMemoryW64( Harry_Header->w/64 );
//		OsdBltDestMemoryW64  ( Harry_Header->w/64 );

//		OsdWinBuffer( 4, ddraddr, Harry_Header->w/64, Harry_Header->h/64 + 1 );
		OsdWinEnable(0, 0);
		OsdWinEnable(1, 0);
		OsdWinEnable(4, 1);
		Osd16Format(OSD16_YCBCR422);		// 00=YCbCr422, 01=RGB565, 10=RGB4444, 11=RGB1444
	*/
	}
	/*
	//---------- Bitmap Test "OSD444(YCbCr:655) from SPI" ----------
	else if( !stricmp(argv[1], "OSD444") ) {
		//DWORD ddraddr=0L, spiaddr=0x100000L;
		DWORD ddraddr=OSD444_DDR_START, spiaddr=OSD444_SPI_START;
		if( argc>=3 ) ddraddr=a2h(argv[2]);
		if( argc>=4 ) spiaddr=a2h(argv[3]);
		
		OsdWriteMode( CPUWRITE | BLT_NO | CONV_DIS | PIXEL16 );
		OsdLoadBmpLinearFromSPI( Harry_Header, spiaddr, ddraddr);

		OsdBltSourceMemoryW64( OSD444_Header->w/64 );
		OsdBltDestMemoryW64  ( OSD444_Header->w/64 );

		OsdWinBuffer( 4, ddraddr, OSD444_Header->w/64, OSD444_Header->h/64 + 1 );
		OsdWinEnable(0, 0);
		OsdWinEnable(1, 0);
		OsdWinEnable(4, 1);
		Osd16Format(OSD16_YCBCR422);		// 00=YCbCr422, 01=RGB565, 10=RGB4444, 11=RGB1444

	}
	*/
	//---------- Bitmap Test "OSDRGB(565) from SPI" ----------
	/*
	else if( !stricmp(argv[1], "RGBn") ) {
		//DWORD ddraddr=0L, spiaddr=0x100000L;
		DWORD ddraddr=OSDRGBn_DDR_START, spiaddr=OSDRGBn_SPI_START;
		WORD x=0, y=0;

		if( argc>=3 ) x=a2h(argv[2]);
		if( argc>=4 ) y=a2h(argv[3]);
		
		OsdWriteMode( CPUWRITE | BLT_NO | CONV_DIS | PIXEL16 );
		OsdLoadBmpXYFromSPI( osdRGBn_Header, spiaddr, x, y );

		OsdWinEnable(0, 0);
		OsdWinEnable(1, 0);
		OsdWinEnable(4, 1);
		Osd16Format(OSD16_RGB565);		// 00=YCbCr422, 01=RGB565, 10=RGB4444, 11=RGB1444

	}
	//---------- Bitmap Test "OSDRGB(565) from SPI" ----------
	else if( !stricmp(argv[1], "RGB") ) {
		//DWORD ddraddr=0L, spiaddr=0x100000L;
		DWORD ddraddr=OSDRGB_DDR_START, spiaddr=OSDRGB_SPI_START;
		WORD x=0, y=0;

		if( argc>=3 ) x=a2h(argv[2]);
		if( argc>=4 ) y=a2h(argv[3]);
		
		OsdWriteMode( CPUWRITE | BLT_NO | CONV_DIS | PIXEL16 );
		OsdLoadBmpXYFromSPI( osdRGB_Header, spiaddr, x, y );

		OsdWinEnable(0, 0);
		OsdWinEnable(1, 0);
		OsdWinEnable(4, 1);
		Osd16Format(OSD16_RGB565);		// 00=YCbCr422, 01=RGB565, 10=RGB4444, 11=RGB1444

	}
	//---------- Bitmap Test "OSDaRGB(4444) from SPI" ----------
	else if( !stricmp(argv[1], "aRGBn") ) {
		//DWORD ddraddr=0L, spiaddr=0x100000L;
		DWORD ddraddr=OSDaRGBn_DDR_START, spiaddr=OSDaRGBn_SPI_START;
		WORD x=0, y=0;

		if( argc>=3 ) x=a2h(argv[2]);
		if( argc>=4 ) y=a2h(argv[3]);
		
		OsdWriteMode( CPUWRITE | BLT_NO | CONV_DIS | PIXEL16 );
		OsdLoadBmpXYFromSPI( osdaRGBn_Header, spiaddr, x, y );

		OsdWinEnable(0, 0);
		OsdWinEnable(1, 0);
		OsdWinEnable(4, 1);
		Osd16Format(OSD16_RGB4444);		// 00=YCbCr422, 01=RGB565, 10=RGB4444, 11=RGB1444

	}
	else if( !stricmp(argv[1], "aRGB") ) {
		//DWORD ddraddr=0L, spiaddr=0x100000L;
		DWORD ddraddr=OSDaRGB_DDR_START, spiaddr=OSDaRGB_SPI_START;
		WORD x=0, y=0;

		if( argc>=3 ) x=a2h(argv[2]);
		if( argc>=4 ) y=a2h(argv[3]);
		
		OsdWriteMode( CPUWRITE | BLT_NO | CONV_DIS | PIXEL16 );
		OsdLoadBmpXYFromSPI( osdaRGB_Header, spiaddr, x, y );

		OsdWinEnable(0, 0);
		OsdWinEnable(1, 0);
		OsdWinEnable(4, 1);
		Osd16Format(OSD16_RGB4444);		// 00=YCbCr422, 01=RGB565, 10=RGB4444, 11=RGB1444

	}
	//---------- Bitmap Test "OSDbRGB(1555) from SPI" ----------
	else if( !stricmp(argv[1], "bRGBn") ) {
		//DWORD ddraddr=0L, spiaddr=0x100000L;
		DWORD ddraddr=OSDbRGBn_DDR_START, spiaddr=OSDbRGBn_SPI_START;
		WORD x=0, y=0;

		if( argc>=3 ) x=a2h(argv[2]);
		if( argc>=4 ) y=a2h(argv[3]);
		
		OsdWriteMode( CPUWRITE | BLT_NO | CONV_DIS | PIXEL16 );
		OsdLoadBmpXYFromSPI( osdbRGBn_Header, spiaddr, x, y );

		OsdWinEnable(0, 0);
		OsdWinEnable(1, 0);
		OsdWinEnable(4, 1);
		Osd16Format(OSD16_RGB1555);		// 00=YCbCr422, 01=RGB565, 10=RGB4444, 11=RGB1444

	}
	else if( !stricmp(argv[1], "bRGB") ) {
		//DWORD ddraddr=0L, spiaddr=0x100000L;
		DWORD ddraddr=OSDbRGB_DDR_START, spiaddr=OSDbRGB_SPI_START;
		WORD x=0, y=0;

		if( argc>=3 ) x=a2h(argv[2]);
		if( argc>=4 ) y=a2h(argv[3]);
		
		OsdWriteMode( CPUWRITE | BLT_NO | CONV_DIS | PIXEL16 );
		OsdLoadBmpXYFromSPI( osdbRGB_Header, spiaddr, x, y );

		OsdWinEnable(0, 0);
		OsdWinEnable(1, 0);
		OsdWinEnable(4, 1);
		Osd16Format(OSD16_RGB1555);		// 00=YCbCr422, 01=RGB565, 10=RGB4444, 11=RGB1444

	}
	*/
	//---------- Animation ---------------------
	else if( !stricmp(argv[1], "ani") ) {
		BYTE en=0;
		if( argc>=3 ) en=dat[0];
		if( en ) {
//			AnimationPigeon();
			AnimationON=1;
		}
		else {
			for(en=0; en<MAX_ANIMATION; en++) AnimationData[en].active = 0;
			AnimationON=0;
		}
	}



	//---------- LUT Test-----------------------
	else if( !stricmp(argv[1], "ATTR") ) {
		Printf("\nChange Attribute in LUT: Window %d = %02x", dat[0], dat[1]);
		MonOsdChangeAttr(dat[0], dat[1]);
	}
	//---------- LUT Test-----------------------
	else if( !stricmp(argv[1], "LUTx") ) {
		Printf("\nset Transparent LUT: Window %d, R:%d, G:%d, B:%d", dat[0], dat[1], dat[2], dat[3]);
		OsdLoadTranparentLUT( dat[0], dat[1], dat[2], dat[3] );
	}
	//---------- LUT Test-----------------------
	else if( !stricmp(argv[1], "LUT") ) {
		BYTE xcnt=16, size=10;
		WORD sx=0, sy=0;
		if( argc>=3 ) size=dat[0];
		if( argc>=4 ) xcnt=dat[1];
		if( argc>=5 ) sx=dat[2];
		if( argc>=6 ) sy=dat[3];
		Printf("\nMonOsdLutTest");
		MonOsdLutTest(size, xcnt, sx, sy);
	}
	//---------- LUT Test 16 -------------------
	else if( !stricmp(argv[1], "LUT16") ) {
		Printf("\nMonOsdLutTest16");
		MonOsdLutTest16();
	}
	//---------- LUT Test 565 -------------------
	else if( !stricmp(argv[1], "LUT565") ) {
		Printf("\nMonOsdLutTestRGB");
		MonOsdLutTest565();
		MonOsdLutTest565_2();
	}
	//---------- LUT Test 555 -------------------
	else if( !stricmp(argv[1], "LUT555") ) {
		Printf("\nMonOsdLutTestbRGB");
		MonOsdLutTest555();
		MonOsdLutTest555_2();
	}
	//---------- LUT Test 444 -------------------
	else if( !stricmp(argv[1], "LUT444") ) {
		Printf("\nMonOsdLutTestaRGB");
		MonOsdLutTest444();
	}
	//---------- LUT Test YCbYCr -------------------
	else if( !stricmp(argv[1], "LUTYUV") ) {
		Printf("\nMonOsdLutTestYCbYCr");
		MonOsdLutTestYUV();
	}
	//---------- DDR  Test ---------------------
	else if( !stricmp(argv[1], "t") ) {
		Printf("\nMonOsdTestDDR");
		MonOsdTestDDR();
	}
	else {
		Printf("\nInvalid command...");
	}
}