Exemplo n.º 1
0
//=============================================================================
//
//=============================================================================
void MonitorChipTest(void)
{

	if(!stricmp( argv[1], "?")) {
		MonitorChipTest_Info();
		return;
	}
	//-------<<reg>>-----------------------------
	else if(!stricmp( argv[1], "reg")) {
		ChipTest_Register_ReadWrite();
	}
	//-------<<gpio>>-----------------------------
	else if(!stricmp( argv[1], "gpio")) {
		ChipTest_GPIO();
	}
	//-------<<power suspend & resume>>-----------------------------
	else if(!stricmp( argv[1], "resume")) {
//		SystemPowerSave(1);
//		SystemPowerResume(1);
	}
	//-------<<SPIOSD LUT test>>-----------------------------
	else if(!stricmp( argv[1], "sosdlut")) {
		BYTE winno;
		WORD LutOffset,size;
		DWORD address;

		if(argc < 6) {
			Printf("\nUsage:CTest sosdlut winno LutOffset size address");
			return;
		}
		winno = a2h(argv[2]);
		LutOffset = a2h(argv[3]);
		size = a2h(argv[4]);
		address = a2h(argv[5]);

		ChipTest_SOsdLut(winno, LutOffset, size, address);
	}
	//-------<<img6 win# lut#>>-----------------------------
	else if(!stricmp( argv[1], "dma")) {
		BYTE wait;
		if(argc < 3)	wait=0;
		else			wait = a2h(argv[2]);
		ChipTest_SPIDMA(wait);
	}
	//-------<<img7 win# lut#>>-----------------------------
	else if(!stricmp( argv[1], "??")) {
	}
	//-------<<??>>-----------------------------
	else if(!stricmp( argv[1], "??")) {
	}
	else
		Printf("\nInvalid command...");	
}
Exemplo n.º 2
0
static void *write_memory(unsigned char *buffer, void *addr, int size)
{
  unsigned char c;
  unsigned char *cp = addr;
  int i;

  for (i = 0; i < size; i++) {
    c  = a2h(*(buffer++)) << 4;
    c |= a2h(*(buffer++));
    *(cp++) = c;
  }

  return cp;
}
Exemplo n.º 3
0
static int a2val(unsigned char **pp, long *valp)
{
  int size = 0;
  long v, val = 0;
  unsigned char *p;

  p = *pp;
  while (1) {
    v = a2h(*p);
    if (v < 0) break;
    val = (val << 4) | v;
    p++;
    size++;
  }
  *valp = val;
  *pp = p;

  return size;
}
Exemplo n.º 4
0
//=============================================================================
//
//=============================================================================
void MonitorMCU(void)
{
	BYTE ret, i, j;
	BYTE idx;
	 
	BYTE argv_num1, argv_num2; //, argv_num3;

	//if ( argc>2) {						 BKFYI: It will hurt a speed
	//	argv_num1 = a2h( argv[2] );
	//	if ( argc>3 ) {
	//		argv_num2 = a2h( argv[3] );
	//		if (argc > 4) {
	//			argv_num3 = a2h( argv[4] );
	//		}
	//	}
	//}

	//---------------------- Write SFR -----------------------
	if( !stricmp( argv[1], "Ws" ) ) {
		if( argc < 4 ) {
			Printf(" ----> Missing parameter !!!");
			return;
		}
		argv_num1 = a2h( argv[2] );
		argv_num2 = a2h( argv[3] );
		ret = WriteSFR(argv_num1, argv_num2);
		if( echo ) {
			Printf("\nMCU SFR Write: %02bx=%02bx (%02bx) ", argv_num1, argv_num2, ret);
			for(i=0; i<8; i++) {
				if( ret & 0x80 ) Puts("1"); else Puts("0");
				ret <<=1;
			}
		}
	}

	//---------------------- Read SFR ------------------------
	else if( !stricmp( argv[1], "Rs" ) ) {
		if( argc < 3 ) {
			Printf(" ----> Missing parameter !!!");
			return;
		}
		argv_num1 = a2h( argv[2] );
		ret = ReadSFR(argv_num1);
		if( echo ) {
			Printf("\nMCU SFR Read: %02bx=%02bx ", argv_num1, ret);
			for(i=0; i<8; i++) {
				if( ret & 0x80 ) Puts("1"); else Puts("0");
				ret <<=1;
			}
		}
	}

	//---------------------- Dump SFR ------------------------
	else if( !stricmp( argv[1], "Ds" ) ) {

		Printf("\nDump DP8051 SFR");
		for (j=0x8; j<=0x0f; j++) {
			Printf("\nSFR %02bx: ", j*0x10);
			for(i=0; i<8; i++) Printf("%02bx ", ReadSFR(j*0x10+i) );
			Printf("- ");
			for(; i<16; i++) Printf("%02bx ", ReadSFR(j*0x10+i) );
		}

	}
	//---------------------- Bitwise SFR control---------------------
	else if( !stricmp( argv[1], "Bs" ) ) {
		Printf("\nSorry!!");
	}
	//---------------------- Dump SFR map---------------------
	else if( !stricmp( argv[1], "SFR" ) ) {
		BYTE len;

		DWORD UsedTime;
		UsedTime = SystemClock;

		Printf("\nDump DP80390 SFR");



		for(j=0x00; j < 0x80; j++) {
			idx = j+0x80;
			for(i=0; i < 0x80; i++) {
				if(SFR_map[i].idx == idx)
					break;	//success
				if(SFR_map[i].idx == 0) {
					i = 0x80;
					break;  //fail
				}
			}
			if((j&0x07) == 0)
				Puts("\n");
			if(i != 0x80) {
				Printf("%02bx:%05s",SFR_map[i].idx, SFR_map[i].name);
				len = TWstrlen(SFR_map[i].name);
				len = 5-len;  //max 5.
				for(i=0; i < len; i++)
					Puts(" ");
				Printf(":%02bx ",ReadSFR(idx));
			}
			else {
			  //Printf("--:-----:--_");   
			  //Printf("            ");   
				Printf("   .....    ");   
			}
		}
		UsedTime = SystemClock - UsedTime;
		Printf("\nUsedTime:%ld.%ldsec", UsedTime/100, UsedTime%100 );

	}
	//---------------------- Dump xdata ----------------------
	else if( !stricmp( argv[1], "Wx" ) ) {

		WORD addr;

		if( argc < 4 ) {
			Printf(" ----> Missing parameter !!!");
			return;
		}
		addr      = a2h( argv[2] );
		argv_num2 = a2h( argv[3] );
		
		*(BYTE xdata *)(addr) = argv_num2;
		ret = *(BYTE xdata *)(addr);
		
		if( echo ) {
			Printf("\nMCU XDATA Write: %04x=%02bx (%02bx) ", addr, argv_num2, ret);
		}
	}

	//---------------------- Dump xdata ----------------------
	else if( !stricmp( argv[1], "Rx" ) ) {

		WORD addr;

		if( argc < 3 ) {
			Printf(" ----> Missing parameter !!!");
			return;
		}
		addr = a2h(argv[2]);

		ret = *(BYTE xdata *)(addr);

		if( echo ) {
			Printf("\nMCU XDATA Read: %04x=%02bx ", addr, ret);
		}
	}

	//---------------------- Dump xdata ----------------------
	else if( !stricmp( argv[1], "Dx" ) ) {

		//data BYTE xdata *osddata = (BYTE xdata *)0xc002;

		WORD addr=0x0000, len=0x100;

		if( argc>=3 ) addr = a2h(argv[2]);
		if( argc>=4 ) len  = a2h(argv[3]);

		Printf("\nDump DP8051 XDATA 0x%04x ", addr);
		for (j=0; j<len/0x10; j++) {
			Printf("\nXDATA %04x: ", (WORD)(addr+j*0x10) );
			for(i=0; i<8; i++) Printf("%02bx ", *(BYTE xdata *)(addr + j*0x10+i) );
			Printf("- ");
			for(; i<16; i++) Printf("%02bx ", *(BYTE xdata *)(addr + j*0x10+i) );
		}

	}

	//---------------------- Enable WDT ------------------------
#if defined(SUPPORT_WATCHDOG) || defined(DEBUG_WATCHDOG)
	else if( !stricmp( argv[1], "WDT" ) ) {
		if(argc > 2) {
			if( argv[2][0]=='1' ) {
				BYTE mode;
				if(argc > 3) 
					mode=a2h(argv[3]);
				else	
					mode = 0;

				EnableWatchdog(mode);
				Printf("\nWatchdog Timer is enabled. mode:%bx", mode);
			}
			else if( argv[2][0]=='2' ) {
				Puts("Watchdog test....");
				RestartWatchdog();
				Puts("start....");
				SFR_EWDI = 0;

				delay1s(1,__LINE__);
				delay1s(1,__LINE__);
				delay1s(1,__LINE__);
				delay1s(1,__LINE__);
				delay1s(1,__LINE__);
				delay1s(1,__LINE__);
				delay1s(1,__LINE__);
				//system reset before you here.
				Puts("..FAIL");
			}
			else {
				DisableWatchdog();
				Printf("\nWatchdog Timer is disabled.");
			}
		}
		else {
			Puts("\nWatchdog ");
			if(SFR_WDCON & 0x02) Puts("On");
			else                 Puts("Off");
#ifdef SUPPORT_WATCHDOG
			Puts(" with SUPPORT_WATCH");
#endif
#ifdef DEBUG_WATCHDOG
			Puts(" with DEBUG_WATCH");
#endif
		}

	}
#endif
	//---------------------- Enable INT ------------------------
	else if( !stricmp( argv[1], "IE" ) ) {
		if ( argc < 3 ) {
			Puts("\nMCU IE n 1/0 - MCU interrupt en/disable #n ");
			return;
		}
		argv_num1 = a2h( argv[2] );

		if( argv[3][0]=='1' ) {
			EnableExtInterrupt( argv_num1 );
			Printf("\nInterrupt #%d is enabled.", argv_num1);
		}
		else {
			DisableExtInterrupt( argv_num1 );
			Printf("\nInterrupt #%d is disabled.", argv_num1);
		}
	}
	//---------------------- Extended INT ------------------------
	else if( !stricmp( argv[1], "DE" ) ) {
		Printf("\nEnable DE-end Interrupt");
		SFR_IE1 = 0;	// Clear Pending Interrupt
		SFR_EX1 = 1;	// Enable Interrupt
	}
	//---------------------- Extended INT ------------------------
	else if( !stricmp( argv[1], "EI" ) ) {
	extern DWORD ExtIntCount;
		if( argc < 3 ) {
			Printf("\nMCU extend Interrupt Status: %02bx, count: %ld", EXINT_STATUS, ExtIntCount );
			ExtIntCount = 0;
#ifdef DEBUG_ISR
			Printf(" MCU %04x", MCU_INT_STATUS);
			MCU_INT_STATUS = 0;
#endif
			return;
		}
		argv_num1 = a2h( argv[2] );

		EXINT_STATUS &= argv_num1;
		
	}
	//---------------------- INTERRUPT Counter---------------------
#ifdef DEBUG_ISR
	else if( !stricmp( argv[1], "INTC" ) ) {
		BYTE i;
		WORD counter;
		for(i=0; i <= 20; i++) {
			SFR_EA=0;
			counter = INTR_counter[i];	//read
			INTR_counter[i]=0;			//clear
			SFR_EA=1;
			
			if(counter) {
				Printf("\n%02bd:%d",i,counter);
			}
		}
	}
#endif
#ifdef DEBUG_UART
	else if( !stricmp( argv[1], "UART" ) )
		DEBUG_dump_uart0();
#if 0
		 {
		BYTE i;
		if(UART0_OVERFLOW_counter) {
			Printf("\nUART0 Overflow:%bd",UART0_OVERFLOW_counter);
			UART0_OVERFLOW_counter = 0;  //clear
		}
		if(UART0_MAX_counter) {
			Printf("\nUART0 Max:%bd",UART0_MAX_counter);
			UART0_MAX_counter = 0;  //clear
		}
		Printf("\nRS_buf[%bd], RS_in:%bd RS_out:%bd",RS_BUF_MAX,RS_in,RS_out);
		for(i=0; i <  RS_BUF_MAX; i++)
			Printf(" %02bx", RS_buf[i]);
	}
#endif
#endif

	//---------------------- Interrupt Help ------------------------
	else if( !stricmp( argv[1], "INT" ) ) {
Exemplo n.º 5
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...");
	}
}
Exemplo n.º 6
0
static unsigned char *stub_gets(unsigned char *buffer)
{
  int i = 0;
  unsigned char c = 0, sum = 0, datasum = 0;
  enum {
    GETS_STATUS_WAIT_DOLLAR,
    GETS_STATUS_READY_READ,
    GETS_STATUS_READ_DATA,
    GETS_STATUS_READ_SUM_UPPER,
    GETS_STATUS_READ_SUM_LOWER,
    GETS_STATUS_END,
  } status;

  status = GETS_STATUS_WAIT_DOLLAR;

  while (status != GETS_STATUS_END) {
    if (status != GETS_STATUS_READY_READ)
      c = getDebugChar();
    switch (status) {
    case GETS_STATUS_WAIT_DOLLAR:
      if (c == '$') status = GETS_STATUS_READY_READ;
      break;
    case GETS_STATUS_READY_READ:
      i = 0;
      sum = datasum = 0;
      status = GETS_STATUS_READ_DATA;
      break;
    case GETS_STATUS_READ_DATA:
      if (c == '$') {
	status = GETS_STATUS_READY_READ;
	break;
      }
      if (c == '#') {
	buffer[i] = '\0';
	status = GETS_STATUS_READ_SUM_UPPER;
	break;
      }
      sum += c;
      buffer[i++] = c;
      break;
    case GETS_STATUS_READ_SUM_UPPER:
      datasum = a2h(c) << 4;
      status = GETS_STATUS_READ_SUM_LOWER;
      break;
    case GETS_STATUS_READ_SUM_LOWER:
      datasum |= a2h(c);
      if (sum != datasum) {
	putDebugChar('-');
	status = GETS_STATUS_WAIT_DOLLAR;
      } else {
	status = GETS_STATUS_END;
      }
      break;
    default:
      break;
    }
  }

  putDebugChar('+');
  if ((i > 2) && (buffer[2] == ':')) {
    putDebugChar(buffer[0]);
    putDebugChar(buffer[1]);
    return &buffer[3];
  }
  return buffer;
}