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

📄 lcd.c

📁 MBA2440(s3c2440)的 源代码文件 ARM920T内核。
💻 C
📖 第 1 页 / 共 4 页
字号:
    Uart_Printf("TFT Mono mode test 1. Press any key!\n");
    Uart_Getch();  	

    rTPAL = 0; // Disable TPAL
    Glib_FilledRectangle(0,0,LCD_XSIZE_TFT_800600-1,LCD_YSIZE_TFT_800600-1,1);
    Uart_Printf("TFT Mono mode test 2. Press any key!\n");
    Uart_Getch();  	

    Glib_FilledRectangle(200,200,LCD_XSIZE_TFT_800600-201,LCD_YSIZE_TFT_800600-201,0);   
    Uart_Printf("TFT Mono mode test 3. Press any key!\n");
    Uart_Getch();  	

    Glib_ClearScr(0, MODE_TFT_1BIT_800600);
    Glib_Rectangle(200,200,SCR_XSIZE_TFT_800600-201,SCR_YSIZE_TFT_800600-201,1);
    
    // #0		    
    // 00		    
    Glib_Rectangle(0,0,LCD_XSIZE_TFT_800600-1,LCD_YSIZE_TFT_800600-1,1);   
    Glib_Line(0,0,LCD_XSIZE_TFT_800600-1,LCD_YSIZE_TFT_800600-1,1);        
    Glib_Line(0,LCD_YSIZE_TFT_800600-1,LCD_XSIZE_TFT_800600-1,0,1);

    // 0#
    // 00
    Glib_Rectangle(LCD_XSIZE_TFT_800600,0,SCR_XSIZE_TFT_800600-1,LCD_YSIZE_TFT_800600-1,1);   
    Glib_Rectangle(LCD_XSIZE_TFT_800600+100,100,SCR_XSIZE_TFT_800600-101,LCD_YSIZE_TFT_800600-101,1);   
    
    // 00
    // #0
    Glib_Rectangle(0,LCD_YSIZE_TFT_800600,LCD_XSIZE_TFT_800600-1,SCR_YSIZE_TFT_800600-1,1);   
    Glib_Rectangle(200,LCD_YSIZE_TFT_800600+200,LCD_XSIZE_TFT_800600-201,SCR_YSIZE_TFT_800600-201,1);   

    // 00
    // 0#
    Glib_Rectangle(LCD_XSIZE_TFT_800600,LCD_YSIZE_TFT_800600,SCR_XSIZE_TFT_800600-1,SCR_YSIZE_TFT_800600-1,1);   
    Glib_Line(LCD_XSIZE_TFT_800600,LCD_YSIZE_TFT_800600,SCR_XSIZE_TFT_800600-1,SCR_YSIZE_TFT_800600-1,1);        
    Glib_Line(LCD_XSIZE_TFT_800600,SCR_YSIZE_TFT_800600-1,SCR_XSIZE_TFT_800600-1,LCD_YSIZE_TFT_800600,1);

    Uart_Printf("Virtual Screen Test(Mono). Press any key[ijkm\\r]!\n");
    MoveViewPort(MODE_TFT_1BIT_800600);
    Lcd_MoveViewPort(0,0,MODE_TFT_1BIT_800600);
//--------LCD FIFO interrupt test---------------------------------------------------START
    rLCDINTMSK|=3; // Mask LCD SUB Interrupt
    rINTMSK|=(BIT_LCD); // Mask LCD INT
//--------LCD FIFO interrupt test-----------------------------------------------------END   
    Lcd_EnvidOnOff(0);
    Lcd_Port_Return();
}


void Test_Lcd_Tft_8Bit_800600(void)
{
    int i,j,k;

    Lcd_Palette8Bit_Init();
	Lcd_Start(MODE_TFT_8BIT_800600);

    Uart_Printf("[TFT 256 COLOR(8bit/1pixel) LCD TEST]\n");

    rTPAL = (1<<24)|((0xff)<<0); // Enable Temporary Palette : Blue
//--------LCD FIFO interrupt test---------------------------------------------------START
	Lcd_EnvidOnOff(1); // Enable ENVID   
	//The content of GPG4 is changed to OUTPUT('01'). 
	//We will check the frame interrupt with using Logic Analyzer. 
	rGPGUP=rGPGUP&(~(1<<4))|(1<<4); // Pull-up disable
	rGPGDAT=rGPGDAT&(~(1<<4))|(1<<4); // GPG4=High
	rGPGCON=rGPGCON&(~(3<<8))|(1<<8); // GPG4=Output

	pISR_LCD=(unsigned)Lcd_Int_Frame;
	rINTMSK=~(BIT_LCD);
	rLCDINTMSK=(0<<2)|(1<<1)|(0); // 4Words Trigger Level,Mask Frame int,Unmask Fifo int
//        rLCDINTMSK=(1<<2)|(1<<1)|(0); // 8Words Trigger Level,Mask Frame int,Unmask Fifo int    
//        Lcd_EnvidOnOff(1); // Enable ENVID       
//--------LCD FIFO interrupt test-----------------------------------------------------END
    Uart_Printf("TFT 256 color mode test 1. Press any key!\n");
    Uart_Getch();  	

    Glib_ClearScr(0, MODE_TFT_8BIT_800600);
    rTPAL = 0;
    k=0;
    for(i=0;i<LCD_XSIZE_TFT_800600;i+=40)
		for(j=0;j<LCD_YSIZE_TFT_800600;j+=30)
		{ 
		    Glib_FilledRectangle(i,j,i+39,j+29,(k%256));
		    k++;
		}

    Uart_Printf("TFT 256 color mode test 2. Press any key!\n");
    Uart_Getch();  	

    Glib_ClearScr(0xff, MODE_TFT_8BIT_800600);
    Uart_Printf("TFT 256 color mode test 3. Press any key!\n");
    Uart_Getch();  	

    Glib_ClearScr(0, MODE_TFT_8BIT_800600);
    k=0;
    for(i=(SCR_XSIZE_TFT_800600/4);i<(SCR_XSIZE_TFT_800600*(3/4));i+=40)
    	for(j=SCR_YSIZE_TFT_800600/4;j<(SCR_YSIZE_TFT_800600*(3/4));j+=30)
    	{
    	    Glib_FilledRectangle(i,j,i+39,j+29,(k%256));
    	    k++;
    	}

    // #0		    
    // 00		    
    Glib_Rectangle(0,0,LCD_XSIZE_TFT_800600-1,LCD_YSIZE_TFT_800600-1,0xff);   
    Glib_Line(0,0,LCD_XSIZE_TFT_800600-1,LCD_YSIZE_TFT_800600-1,0xff);        
    Glib_Line(0,LCD_YSIZE_TFT_800600-1,LCD_XSIZE_TFT_800600-1,0,0xff);

    // 0#
    // 00
    Glib_Rectangle(LCD_XSIZE_TFT_800600,0,SCR_XSIZE_TFT_800600-1,LCD_YSIZE_TFT_800600-1,0xf0);   
    Glib_Rectangle(LCD_XSIZE_TFT_800600+100,100,SCR_XSIZE_TFT_800600-101,LCD_YSIZE_TFT_800600-101,0xf0);   
    
    // 00
    // #0
    Glib_Rectangle(0,LCD_YSIZE_TFT_800600,LCD_XSIZE_TFT_800600-1,SCR_YSIZE_TFT_800600-1,0x0f);   
    Glib_Rectangle(200,LCD_YSIZE_TFT_800600+200,LCD_XSIZE_TFT_800600-201,SCR_YSIZE_TFT_800600-201,0x0f);   

    // 00
    // 0#
    Glib_Rectangle(LCD_XSIZE_TFT_800600,LCD_YSIZE_TFT_800600,SCR_XSIZE_TFT_800600-1,SCR_YSIZE_TFT_800600-1,0xff);   
    Glib_Line(LCD_XSIZE_TFT_800600,LCD_YSIZE_TFT_800600,SCR_XSIZE_TFT_800600-1,SCR_YSIZE_TFT_800600-1,0xff);        
    Glib_Line(LCD_XSIZE_TFT_800600,SCR_YSIZE_TFT_800600-1,SCR_XSIZE_TFT_800600-1,LCD_YSIZE_TFT_800600,0xff);

    Uart_Printf("Virtual Screen Test(TFT 256 color). Press any key[ijkm\\r]!\n");
    MoveViewPort(MODE_TFT_8BIT_800600);
    Lcd_MoveViewPort(0,0,MODE_TFT_8BIT_800600);
//--------LCD FIFO interrupt test---------------------------------------------------START
    rLCDINTMSK|=3; // Mask LCD SUB Interrupt
    rINTMSK|=(BIT_LCD); // Mask LCD INT
//--------LCD FIFO interrupt test-----------------------------------------------------END
    Lcd_EnvidOnOff(0);
    Lcd_Port_Return();
}


void Test_Lcd_Tft_16Bit_800600(void)
{
    int i,j,k;

	Lcd_Start(MODE_TFT_16BIT_800600);
    Uart_Printf("[TFT 64K COLOR(16bit/1pixel) LCD TEST]\n");

    Glib_ClearScr(0, MODE_TFT_16BIT_800600);
    Glib_FilledRectangle(0,0,799,599,0xf800);    
    Uart_Printf("TFT 64K color mode test 1. Press any key!\n");
    Uart_Getch();  	

    Glib_ClearScr(0, MODE_TFT_16BIT_800600);
    Glib_Rectangle(0,0,799,479,0x07e0);   
    Glib_FilledRectangle(0,0,20,20,65535);   
    Glib_Rectangle(620,460,639,479,65535);   
    Glib_Line(0,0,639,479,0x1f);        
    Glib_Line(639,0,0,479,0xf800);
    Uart_Printf("TFT 64K color mode test 2. Press any key!\n");
    Uart_Getch();  	

    Glib_ClearScr(0, MODE_TFT_16BIT_800600);
    k=0;
    for(i=160;i<480;i+=20)
    	for(j=120;j<360;j+=15)
    	{
	    	while((rLCDCON5>>19)==2);
    	    Glib_FilledRectangle(i,j,i+19,j+14,k);
    	    k+=500;
    	}

    // #0		    
    // 00		    
    Glib_Rectangle(0,0,319,239,65535);   
    Glib_Line(0,0,319,239,65535);        
    Glib_Line(0,239,319,0,65535);

    // 0#
    // 00
    Glib_Rectangle(0+320,0,319+320,239,255);
    Glib_Line(0+320,0,319+320,239,255);        
    Glib_Line(0+320,239,319+320,0,255);

    // 00
    // #0
    Glib_Rectangle(0,0+240,319,239+240,255);
    Glib_Line(0,0+240,319,239+240,255);        
    Glib_Line(0,239+240,319,0+240,255);

    // 00
    // 0#
    Glib_Rectangle(0+320,0+240,319+320,239+240,255);
    Glib_Line(0+320,0+240,319+320,239+240,255);     
    Glib_Line(0+320,239+240,319+320,0+240,255);
    Glib_Rectangle(50+320,50+240,269+320,189+240,255);

    Uart_Printf("TFT 64K color mode test 3. Press any key!\n");
    Uart_Getch();  	

    Glib_ClearScr(0, MODE_TFT_16BIT_800600);
    k=0;
    for(i=320;i<960;i+=40)
    	for(j=240;j<720;j+=30)
    	{
    	    Glib_FilledRectangle(i,j,i+39,j+29,k);
    	    k+=500;
    	}

    // #0		    
    // 00		    
    Glib_Rectangle(0,0,639,479,65535);   
    Glib_Line(0,0,639,479,65535);        
    Glib_Line(0,479,639,0,65535);

    // 0#
    // 00
    Glib_Rectangle(0+640,0,639+640,479,65535);   
    Glib_Line(0+640,0,639+640,479,65535);        
    Glib_Line(0+640,479,639+640,0,65535);

    // 00
    // #0
    Glib_Rectangle(0,0+480,639,479+480,65535);   
    Glib_Line(0,0+480,639,479+480,65535);        
    Glib_Line(0,479+480,639,0+480,65535);

    // 00
    // 0#
    Glib_Rectangle(0+640,0+480,639+640,479+480,65535);   
    Glib_Line(0+640,0+480,639+640,479+480,65535);        
    Glib_Line(0+640,479+480,639+640,0+480,65535);
    Glib_Rectangle(50+640,50+480,639+640-50,479+480-50,65535);   

    Uart_Printf("Virtual Screen Test(TFT 64K color). Press any key[ijkm\\r]!\n");
    MoveViewPort(MODE_TFT_16BIT_800600);
    Lcd_MoveViewPort(0,0,MODE_TFT_16BIT_800600);
    Lcd_EnvidOnOff(0);
    Lcd_Port_Return();
}


void Test_Lcd_Tft_16Bit_800600_On(void)
{
    int i,j,k=0;

    Lcd_Start(MODE_TFT_16BIT_800600);

    Uart_Printf("\n[TFT LCD(800x600 ,16bpp) WILL BE TURNED ON EVEN DURING OTHER TEST]\n");
    Uart_Printf("If you'd like to off the TFT LCD, then excute other LCD test program,\n");     

    for(i=0;i<LCD_XSIZE_TFT_800600;i+=40)
		for(j=0;j<LCD_YSIZE_TFT_800600;j+=30)
		{ 
		    Glib_FilledRectangle(i,j,i+39,j+29,(k%65535));
		    k+=150;
		}
}

void Test_Lcd_Palette_Ram(void)
{
    int i;	
    U32 *palette;

    Uart_Printf("Palette ram test has started.\n");
    Uart_Printf("LCD Display may be stopped.\n");
    Lcd_EnvidOnOff(0);
//    Uart_Printf("VSTATUS : %x, HSTATUS : %x \n", (rLCDCON5&(15<<3))>>15, (rLCDCON5&(13<<3))>>13);
	
    palette=(U32 *)PALETTE;
    for(i=0;i<256;i++)
    {
		*palette++=i;
    }	
	
    palette=(U32 *)PALETTE;
    for(i=0;i<256;i++)
    {
		if(((*palette++)&0xffff) != i)
		Uart_Printf("Error is occured during palette ram testing at [0x%x]\n", i);
    }	

    Uart_Printf("Palette Ram Test OK!!!\n");
    Uart_Printf("Press any key to continue.\n");
    Uart_Getch();
}


void Test_Lcd_Underrun(void)
{
	Uart_Printf("Test heavy bus access by write buffer!!\n");

	Uart_Printf("Select LCD : 1-240x320(LCC3600)[D]   2-800x600(General)\n");
	if (Uart_Getch() == '2')
		Test_Lcd_Tft_16Bit_800600_On();	
	else Test_Lcd_Tft_8Bit_240320_On();	

	Uart_Printf("If you want to stop test and continue test, then Press any key!\n");
	
	while(1){
		    SDRAMtest();
		if(Uart_GetKey()) break;
   	}

}

// 320 x 240
void Test_Lcd_Tft_8Bit_320240(void)
{
	int i,j,k;

	Lcd_TconDisable();
	Spi_Lcd_Init();
	Lcd_Port_Init();
	Lcd_Palette8Bit_Init(); // Initialize 256 palette 
	Lcd_Init(MODE_TFT_8BIT_320240);
	Glib_Init(MODE_TFT_8BIT_320240);

//	Uart_Printf("[TFT 256 COLOR(8bit/1pixel) LCD TEST]\n");
//	Select_Tcon();
	
	Lcd_PowerEnable(0, 1);
	rTPAL = (1<<24)|((0xff)<<16); // Enable Temporary Palette : Red
	Lcd_EnvidOnOff(1); // Enable ENVID Bit
	Uart_Printf("\nTFT 256 color mode test 1. Press any key!\n");
	Uart_Getch(); 

	Glib_ClearScr(0, MODE_TFT_8BIT_320240); // Fill the LCD panel with Black Color
	k=0;
	for(i=0;i<320;i+=20)
		for(j=0;j<240;j+=15) { 
			Glib_FilledRectangle(j,i,j+14,i+19,(k%256));
			k++;
		}
	rTPAL = 0; // Disable Temporary Palette
	Uart_Printf("TFT 256 color mode test 2. Press any key!\n");
	Uart_Getch();  	

	Glib_ClearScr(0, MODE_TFT_8BIT_320240); // Fill the LCD panel with Black Color
	k=0;
	for(i=0;i<320;i+=10)
		for(j=0;j<240;j+=10) { 
			Glib_FilledRectangle(j,i,j+9,i+9,(k%256));
			k+=30;
		}
	Uart_Printf("TFT 256 color mode test 3. Press any key!\n");
	Uart_Getch();  	

	Glib_ClearScr(0, MODE_TFT_8BIT_320240);
	k=0;
	for(i=80;i<240;i+=10) {
		for(j=60;j<180;j+=10) {
			Glib_FilledRectangle(j,i,j+9,i+9,k);
			k++;
		}
	}
	Glib_Rectangle(0,0,239,319,255);   
	Glib_Line(0,0,239,319,255);        
	Glib_Line(0,319,239,0,255);
    
	Glib_Rectangle(0+240,0,239+240,319,255);
	Glib_Line(0+240,0,239+240,319,255);        
	Glib_Line(0+240,319,239+240,0,255);
    
	Glib_Rectangle(0,0+320,239,319+320,255);
	Glib_Line(0,0+320,239,319+320,255);        
	Glib_Line(0,319+320,239,0+320,255);
    
	Glib_Rectangle(0+240,0+320,239+240,319+320,255);
	Glib_Line(0+240,0+320,239+240,319+320,255);     
	Glib_Line(0+240,319+320,239+240,0+320,255);

	Glib_Rectangle(10+240,10+320,480-11,640-11,255);

	Uart_Printf("Virtual Screen Test(TFT 256 color). Press any key[ijkm\\r]!\n");
	MoveViewPort(MODE_TFT_8BIT_320240);
	Lcd_MoveViewPort(0,0,MODE_TFT_8BIT_320240);
	Glib_ClearScr(0, MODE_TFT_8BIT_320240);
	Lcd_EnvidOnOff(0);
	Lcd_PowerEnable(0, 0);
	Lcd_Port_Return();
}

void Test_Lcd_Tft_8Bit_320240_Bmp(void)
{
	int i,j,k=0;

	Lcd_TconDisable();
	Spi_Lcd_Init();
	Lcd_Port_Init();
	Lcd_Palette8Bit_Init();
	Lcd_Init(MODE_TFT_8BIT_320240);
	Glib_Init(MODE_TFT_8BIT_320240);
	Lcd_PowerEnable(0, 1);    // Enable LCD_PWREN

	for(j=0;j<320;j++)
		for(i=0;i<240;i++)
//			PutPixel(i,j,((int)DEMO256[k++]));
			PutPixel(319-j,i,((int)DEMO256[k++]));

	Lcd_EnvidOnOff(1); // Enable ENVID    

	Uart_Printf("Test palette & RGB format(5:6:5 ->5:5:5:1)..........\n");        
	Uart_Printf("then press any key\n");        
	Uart_Getch();
	Lcd_EnvidOnOff(0);
		
	rLCDCON5&=~(1<<11); // 5:5:5:1 Palette Setting & put pixel with 5551 format
	Lcd_Palette8Bit_Init(); //  palette change to 5:5:5:1 format..
    
	Uart_Printf("One more ,please...\n");
	Uart_Getch();    
	Lcd_EnvidOnOff(1);

	Uart_Printf("Press any key to quit!\n");        
	Uart_Getch();
	Glib_ClearScr(0, MODE_TFT_8BIT_320240);
	Delay(5000);
	Lcd_EnvidOnOff(0);
	rLCDCON5|=(1<<11); // 5:6:5 Palette Setting
	Lcd_Port_Return();
}

void Test_Lcd_Tft_16Bit_320240(void)
{
	int i,j,k;

	Lcd_TconDisable();
	Spi_Lcd_Init();
	Lcd_Port_Init();
	Lcd_Init(MODE_TFT_16BIT_320240);
	Glib_Init(MODE_TFT_16BIT_320240);

	Uart_Printf("[TFT 64K COLOR(16bit/1pixel) LCD TEST]\n");

	Lcd_PowerEnable(0, 1);
	Lcd_EnvidOnOff(1);

	Glib_ClearScr(0x0, MODE_TFT_16BIT_320240);
	Glib_FilledRectangle(0,0,319,239,0xF800);
	if(0){
		for(i=0; i<320; i++) {
	//		Glib_FilledRectangle(i,0,i,239,0xFFFF);
//			Glib_Line(i,0,i,239,0xffff);
			{
				unsigned short *tmp = (unsigned short *)LCDFRAMEBUFFER;
				int l, m, n;
				for(l=0; l<240; l++) {
					for(m=0; m<l; m++) {
						*(tmp + m + (l*639)) = (U16)0xFFFF;
//						Uart_SendByte('.');
					}
					Uart_Printf("Addr(%x), Line(%d), Colume(%d)\n", tmp+m+(l*640), l, m); Uart_Getch();
				}
			}
			Uart_Printf("LCD X : %d\n", i);
			Uart_Getch();
			Glib_ClearScr(0x0, MODE_TFT_16BIT_320240);
			Uart_Getch();
		}
		for(i=1; i<240; i++) {
			Glib_FilledRectangle(0,i,319,i,0x07E0);
			Uart_Printf("LCD Y : %d\n", i);
			Uart_Getch();
			Glib_ClearScr(0x0, MODE_TFT_16BIT_320240);
		}
	}
	Uart_Printf("\nTFT 64K color mode test 1. Press any key!\n");
	Uart_Getch();
    
	Glib_ClearScr(0, MODE_TFT_16BIT_320240);
	Glib_Rectangle(0,0,319,239,0x07e0);
	Glib_FilledRectangle(0,0,31,23,0xFFFF);
	Glib_Rectangle(319-31,239-23,319,239,0xFFFF);
	Glib_Line(0,0,319,239,0x001f);
	Glib_Line(319,0,0,239,0xf800);
	Uart_Printf("TFT 64K color mode test 2. Press any key!\n");
	Uart_Getch();

	Glib_ClearScr(0, MODE_TFT_16BIT_320240);
	k=0;
	for(i=60;i<320;i+=10) {
		for(j=80;j<240;j+=10) {
			Glib_FilledRectangle(j,i,j+9,i+9,k);
			k+=0x0821;
		}
	}

	Glib_Rectangle(0,0,319,239,0xFFFF);   
	Glib_Line(0,0,319,239,0xFFFF);
	Glib_Line(0,239,319,0,0xFFFF);

	Glib_Rectangle(0+320,0,319+320,239,0xff);
	Glib_Line(0+320,0,319+320,239,0xff);
	Glib_Line(0+320,239,319+320,0,0xff);

	Glib_Rectangle(0,0+240,319,239+240,0xff);
	Glib_Line(0,0+240,319,239+240,0xff);
	Glib_Line(0,239+240,319,0+240,0xff);

	Glib_Rectangle(0+320,0+240,319+320,239+240,255);
	Glib_Line(0+320,0+240,319+320,239+240,255);     
	Glib_Line(0+320,239+240,319+320,0+240,255);
	Glib_Rectangle(50+320,50+240,269-41,640-41,0x1f);

	Uart_Printf("Virtual Screen Test(TFT 64K color). Press any key[ijkm\\r]!\n");
	MoveViewPort(MODE_TFT_16BIT_320240);
	Lcd_MoveViewPort(0,0,MODE_TFT_16BIT_320240);
	Glib_ClearScr(0, MODE_TFT_16BIT_320240);
	Lcd_EnvidOnOff(0);
	Lcd_PowerEnable(0, 0);
	Lcd_Port_Return();
}

⌨️ 快捷键说明

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