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

📄 lcd.c

📁 S3C2410平台下的LCD固件程序
💻 C
📖 第 1 页 / 共 4 页
字号:
    *palette=0x0;    
    uart_getch();
    Lcd_EnvidOnOff(0);
    Lcd_Port_Return();
}

/*********************************************************************************************
* name:		Test_Lcd_Tft_8Bit_640480_Bswp()
* func:		test 8bpp 640480 TFT Bswp
* para:		none
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
void Test_Lcd_Tft_8Bit_640480_Bswp(void)
{
    int k;
    Lcd_Palette8Bit_Init();
    Lcd_port_init();
    Lcd_Init(MODE_TFT_8BIT_640480);
    Glib_Init(MODE_TFT_8BIT_640480);
    Lcd_EnvidOnOff(1);
    Lcd_PowerEnable(0, 1);
    rLCDCON5 &= 0x1ffffd;    //BSWP Disable
    uart_printf("[TFT 256 COLOR(16bit/1pixel) BSWP TEST]\n");

    Glib_ClearScr(0, MODE_TFT_8BIT_640480);
    Glib_Rectangle(0,0,639,479,0xff);
    Glib_Rectangle(1,1,638,478,0x03);
    Glib_Rectangle(0+100,0+100,639-100,479-100,0xff);
    Glib_Rectangle(1+100,1+100,638-100,478-100,0x03);
    Glib_Line(0,0,639,479,0xe0);     
    Glib_Line(639,0,0,479,0x1c);
    uart_printf("TFT 256 color BSWP test. Press any key excet return!\n");

    while(uart_getch()!='\r')
    {
        rLCDCON5 &= 0x1ffffd;    //BSWP Disable
        rLCDCON5 |= ((k%2)<<1);  //BSWP Enable
        k++;
    }

    Lcd_EnvidOnOff(0);
    Lcd_Port_Return();
}

/*********************************************************************************************
* name:		Test_Lcd_Tft_16Bit_640480()
* func:		test 16bpp 640480 TFT  
* para:		none
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
void Test_Lcd_Tft_16Bit_640480(void)
{
    int i,j,k;
    Lcd_port_init();
    Lcd_Init(MODE_TFT_16BIT_640480);
    Glib_Init(MODE_TFT_16BIT_640480);
    Lcd_PowerEnable(0, 1);
    Lcd_EnvidOnOff(1);
    uart_printf("[TFT 64K COLOR(16bit/1pixel) LCD TEST]\n");

    Glib_ClearScr(0, MODE_TFT_16BIT_640480);
    Glib_FilledRectangle(0,0,639,479,0xf800);    
    //uart_printf("TFT 64K color mode test 1. Press any key!\n");
    //uart_getch();  	

    Glib_ClearScr(0, MODE_TFT_16BIT_640480);
    Glib_Rectangle(0,0,639,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_640480);
    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_640480);
    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_640480);
    Lcd_MoveViewPort(0,0,MODE_TFT_16BIT_640480);
    Lcd_EnvidOnOff(0);
    Lcd_Port_Return();
}

/*********************************************************************************************
* name:		Test_Lcd_Tft_16Bit_640480_Hwswp()
* func:		test 16bpp 640480 TFT Hwswp
* para:		none
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
void Test_Lcd_Tft_16Bit_640480_Hwswp(void)
{
    int k;
    Lcd_port_init();
    Lcd_Init(MODE_TFT_16BIT_640480);
    Glib_Init(MODE_TFT_16BIT_640480);
    Lcd_PowerEnable(0, 1);
    Lcd_EnvidOnOff(1);
    rLCDCON5 &= 0x1ffffe;    //HWSWP Disable
    uart_printf("[TFT 64K COLOR(16bit/1pixel) HWSWP TEST]\n");

    Glib_ClearScr(0, MODE_TFT_16BIT_640480);
    Glib_Rectangle(0,0,639,479,0xffff);
    Glib_Rectangle(1,1,638,478,0xf800);
    Glib_Rectangle(0+100,0+100,639-100,479-100,0xffff);
    Glib_Rectangle(1+100,1+100,638-100,478-100,0xf800);
    Glib_Line(0,0,639,479,0x7e0);     
    Glib_Line(639,0,0,479,0x1f);
    uart_printf("TFT 64K color HWSWP test. Press Enter key excet return!\n");

    while(uart_getch()!='\r')
    {
        rLCDCON5 &= 0x1ffffe;    //HWSWP Disable
        rLCDCON5 |= (k%2);       //HWSWP Enable
        k++;
    }

    Lcd_EnvidOnOff(0);
    Lcd_Port_Return();
}

/*********************************************************************************************
* name:		Test_Lcd_Tft_1Bit_800600()
* func:		test 1bpp 800600 TFT  
* para:		none
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
void Test_Lcd_Tft_1Bit_800600(void)
{
    int i,j;
    Lcd_port_init();
    Lcd_Palette1Bit_Init(); 
    Lcd_Init(MODE_TFT_1BIT_800600);
    Glib_Init(MODE_TFT_1BIT_800600);
    uart_printf("[TFT Mono(1bit/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_Fifo_640480;
	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 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();
}

/*********************************************************************************************
* name:		Test_Lcd_Tft_8Bit_800600()
* func:		test 8bpp 800600 TFT  
* para:		none
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
void Test_Lcd_Tft_8Bit_800600(void)
{
    int i,j,k;
    Lcd_port_init();
    Lcd_Palette8Bit_Init();
    Lcd_Init(MODE_TFT_8BIT_800600);
    Glib_Init(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_Fifo_640480;
	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();
}


⌨️ 快捷键说明

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