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

📄 display.c

📁 samsung 最新芯片2450 的测试程序.
💻 C
📖 第 1 页 / 共 3 页
字号:
/*********************************************************************
;* Project Name : S3C2450X
;*
;* Copyright 2008 by Samsung Electronics, Inc.
;* All rights reserved.
;*
;* Project Description :
;* This software is only for verifying functions of the S3C2450X
;* Anybody can use this code without our permission.
;**********************************************************************/


#include "System.h"
#include "Display.h"
#include "DisplaySample.h"
#include "DisplaySample_240_320.h"	// snail16bpp
#include "DisplaySample_320_240.h"	// prayer16bpp
#include "sjy_320_240.h"
#include "WVGA_SmileAgain.h"
#include "colorkey800_480.h"
#include "colorkey320_240.h"
#include "colorkey240_320.h"
#include "adcts.h"

int8 lcd_type=0;	// Portrait:0 Landscpe:1
int8 lcd_size=0;	// QVGA:0, WVGA:1, ...
int8 lcd_if=0;		// Parallel:0, Serial:1, i80:2
int8 lcd_module=0; 	// 0: LTE480WV-800x480(WVGA, 4.80\", Landscape)
					// 1: LTV350  -320x240(QVGA, 3.50\", Landscape)
					// 2: LTS222  -240x320(QVGA, 2.22\", Portrait) RGB Parallel I/F
					// 3: LTS222  -240x320(QVGA, 2.22\", Portrait) RGB Serial I/F
					// 4: LTS222  -240x320(QVGA, 2.22\", Portrait) i80 I/F
uint32 lcd_bpp;
uint32 uFrameCount;
uint16 lcd_horizon_value=0,lcd_line_value=0;
uint8 lcd_vbpd=0,lcd_vfpd=0,lcd_vspw=0,lcd_hbpd=0,lcd_hfpd=0,lcd_hspw=0;
uint8 lcd_cs_setup=0,lcd_wr_setup=0,lcd_wr_act=0,lcd_wr_hold=0;
uint8 lcd_frame_rate=0;
uint8 lcd_burst_mode=WINCONx_16WORD_BURST;
uint8 lcd_burst_size[3]=
{
	16,8,4
};
uint16 screen_width, screen_height;
uint32 *lcd_framebuffer=0;

uint8 lcd_bit_order[]=
{
	1,2,4,8,8,16,16,16,32,32,32,32,32,32
};

uint8 lcd_bit_convert[]=
{
	32,16,8,4,4,2,2,2,1,1,1,1,1,1
};

uint8 lcd_burst_in_byte[]=
{
	64,32,16
};

uint32 lcd_frame_buffer[][2]=
{
	{LCD_WIN0_FRAME_BUFFER0, LCD_WIN0_FRAME_BUFFER1},
	{LCD_WIN1_FRAME_BUFFER, NULL}
};

volatile uint32 *WINCONx_Reg_Addr[]=
{
	&rWINCON0,	&rWINCON1 
};

volatile uint32 *VIDOSDxA_Reg_Addr[]=
{
	&rVIDOSD0A, &rVIDOSD1A
};

volatile uint32 *VIDOSDxB_Reg_Addr[]=
{
	&rVIDOSD0B, &rVIDOSD1B
};

volatile uint32 *VIDOSDxC_Reg_Addr[]=
{
	NULL, &rVIDOSD1C
};


volatile uint32 *VIDWxADD0_Reg_Addr[][2]=
{
	{&rVIDW00ADD0B0, &rVIDW00ADD0B1},
	{&rVIDW01ADD0, NULL}
};

volatile uint32 *VIDWxADD1_Reg_Addr[][2]=
{
	{&rVIDW00ADD1B0, &rVIDW00ADD1B1},
	{&rVIDW01ADD1, NULL}
};

volatile uint32 *VIDWxADD2_Reg_Addr[][2]=
{
	{&rVIDW00ADD2B0, &rVIDW00ADD2B1},
	{&rVIDW01ADD2, NULL}
};

volatile uint32 *WxKEYCON0_Reg_Addr[]=
{
	0, &rW1KEYCON0
};

volatile uint32 *WxKEYCON1_Reg_Addr[]=
{
	0, &rW1KEYCON1
};

volatile uint32 *WINxMAP_Reg_Addr[]=
{
	&rWIN0MAP, &rWIN1MAP
};


vuint32 *WINxPalletBase[]=
{
	(vuint32 *)WIN0_PALETTE_START, (vuint32 *)WIN1_PALETTE_START
};

void *lcd_function[][2] =
{  //  										"12345678901234567890123456789"
	(void *)Basic_Display,					"Basic Display Test           ",
	(void *)Test_EachWindow_EachBPP,		"Each Window/ BPP Test        ",
	(void *)Test_Blending_Win01,			"Blending(plane/pixel) Test   ",
	(void *)Test_ColorKey,					"ColorKey Test(One Windows)   ",
	(void *)Test_ColorMap,					"ColorMap Test                ",
	(void *)Test_Virtual_Screen,			"Virtual Screen Test          ",
	(void *)Test_Interrupt,					"Interrupt Test               ",
	(void *)Test_Buffer_Autochange,			"Buffer auto change(i80 I/F only)",
	0,0
};

void *lcd_bpp_mode[]=
{
	"1bpp(palletized)",		//0000
	"2bpp(palletized)",		//0001
	"4bpp(palletized)",		//0010
	"8bpp(palletized)",		//0011
	"8bpp(A232)",			//0100
	"16bpp(565)",			//0101
	"16bpp(A555)",			//0110
	"16bpp(1555)",			//0111
	"18bpp(666)",			//1000
	"18bpp(A665)",			//1001
	"19bpp(A666)",			//1010
	"24bpp(888)",			//1011
	"24bpp(A887)",			//1100
	"25bpp(A888)"			//1101	
};

//==========================================
// LCD Test main function
//==========================================
void Test_LCD(void)
{
	int i=0;

	SetLcdPort();

	printf("\nSelect LCD module for test\n");
	printf("0: LTE480WV-800x480(WVGA, 4.80\", Landscape)\n");
	printf("1: LTV350  -320x240(QVGA, 3.50\", Landscape)\n");
	printf("2: LTS222  -240x320(QVGA, 2.22\", Portrait) RGB Parallel I/F\n");
	printf("3: LTS222  -240x320(QVGA, 2.22\", Portrait) RGB Serial I/F\n");
	printf("4: LTS222  -240x320(QVGA, 2.22\", Portrait) i80 I/F\n");
	lcd_module = GetIntNum();
	if((lcd_type<0)||(lcd_type>4))
		return;

	switch(lcd_module)
	{
		case LCD_MODULE_LTE480WV:	// LTE480WV parallel
 			lcd_type=LANDSCAPE;		// Portrait:0 Landscpe:1
 			lcd_size=WVGA;			// QVGA:0, WVGA:1, ...
 			lcd_if  =PARALLEL_IF;	// Parallel:0, Serial:1, i80:2
			break;			
		case LCD_MODULE_LTV350: 	// LTV350 parallel
			lcd_type=LANDSCAPE;		// Portrait:0 Landscpe:1
 			lcd_size=QVGA;			// QVGA:0, WVGA:1, ...
 			lcd_if  =PARALLEL_IF;	// Parallel:0, Serial:1, i80:2
 			break;
		case LCD_MODULE_LTS222: 	// LTS222 parallel
			lcd_type=PORTRAIT;		// Portrait:0 Landscpe:1
 			lcd_size=QVGA;			// QVGA:0, WVGA:1, ...
 			lcd_if  =PARALLEL_IF;	// Parallel:0, Serial:1, i80:2
 			break;
 		case LCD_MODULE_LTS222_SERIAL: 	// LTS222 serial
 			lcd_type=PORTRAIT;			// Portrait:0 Landscpe:1
 			lcd_size=QVGA;				// QVGA:0, WVGA:1, ...
 			lcd_if  =SERIAL_IF;			// Parallel:0, Serial:1, i80:2
 			break;
 		case LCD_MODULE_LTS222_CPUIF: 	// LTS222 i80 i/f
 			lcd_type=PORTRAIT;			// Portrait:0 Landscpe:1
 			lcd_size=QVGA;				// QVGA:0, WVGA:1, ...
 			lcd_if  =I80_IF;			// Parallel:0, Serial:1, i80:2
 			break;
	}
	Init_LDI();
	
	while(1)
	{	
		i=0;
		
		printf("************************************************************\n");
		while(1) {
		    printf("%2d:%s",i,lcd_function[i][1]);
		    i++;
		    if((int)(lcd_function[i][0])==0) {
				printf("\n");
				break;
		    }
		    printf("\n");
		}
		
		printf("************************************************************\n");
		printf("\nSelect(Press Enter key to exit): ");
		i = GetIntNum();
		if( i<0 ) break;
				
		if( i>=0 && (i<(sizeof(lcd_function)/8-1) )) 
		   ( (void (*)(void)) (lcd_function[i][0]) )();	
		
		printf("\n");
	}		
	
	return;
		
}

//==========================================
// Basic Display Test function
//==========================================
void Basic_Display(void)
{	
	int8 image,window,buffer;
	int8* winbuf;

	winbuf=Select_Win_Buf();
	window=*winbuf;
	buffer=*(winbuf+1);
	if( window<0 || window>1 || buffer<0 || buffer>1)
		return;

	printf("\nSelect the image which you want to display\n");  
	printf(" 0: RGB bar display(24bpp)");
	if(lcd_module==LCD_MODULE_LTE480WV)
		printf("   1: 24bpp Landscape(Valley in Jeju island)\n");
	else if(lcd_module==LCD_MODULE_LTV350)
		printf("   1: 16bpp QVGA Landscape Picture(Girl)\n");
	else
		printf("   1: 16bpp QVGA Portrait Picture(Snail)\n");

	image = GetIntNum();
	if( image<0 && image>1)
		return;	

 	printf("\n >>> Display Window: %d, Buffer: %d\n",window,buffer);
 	Make_Image(window, buffer, image);

	pISR_LCD = (unsigned)Display_ISR;
	rINTMSK &= ~(1<<16);

	if(lcd_if==I80_IF)
	{
		rVIDINTCON = (0x3f<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<0); //Main & Sub Sending complete
		rINTSUBMSK &= ~(1<<17);//i80 I/F
	}
	else
	{
		rVIDINTCON = (0x3f<<20)|(1<<15)|(1<<12)|(1<<0); //Frame(VSYNC)
		rINTSUBMSK &= ~(1<<16);//RGB I/F Frame int.
		//rVIDINTCON = (0x3f<<20)|(1<<5)|(3<<2)|(1<<1)|(1<<0); //Win0/1 FIFO(empty)
		//rINTSUBMSK &= ~(1<<15);//RGB I/F FIFO int.
	}

	Display_Start(window);	

	Display_End(window);
	rVIDINTCON = (0x3f<<20)|0;
	rINTMSK |= (1<<16);

	return;
}


//==========================================
// Each Window and Each BPP Test function
//==========================================
void Test_EachWindow_EachBPP(void)
{
	int32 window,bpp;
	int8 *winbuf;
	uint32 i=0;

	while(1)
	{
		winbuf=Select_Win_Buf();//using buffer0
		window=*winbuf;
		if ((window<0)||(window>1)) break;

		while(1)
		{
			printf("\nSelect the bpp type which you want to test\n");
			printf("(If you want to exit, press enter key)\n");

			for(i=0;i<14;i++)
			{
				printf("   %2d:%s\n",i,lcd_bpp_mode[i]);
			}

			bpp = GetIntNum();
			if( (bpp<0)||(bpp>14) )	break;

			LcdWindowOnOff(LCD_WIN_ALL,LCD_OFF);
			LcdEnvidOnOff(LCD_OFF);
				
			Basic_Display_Setting(window,LCD_BUF_0,bpp,lcd_horizon_value,lcd_line_value);	
			LCD_ClearScr(0);

			Prepare_Image(window,bpp);

			Display_Start(window);
			Display_End(window);
		}
	}
}

//==========================================
// Blending(per-plane or per-pixel) Test
//==========================================
#if 1
void PlaneBlendingTest(void)
{
	uint32 i,j;
	int32 alpha_sel;

	printf("\nSelect the alpha type which you want to test\n");
	printf(" 0: alpha 0   1: alpha 1\n");
	alpha_sel = GetIntNum();
	if ((alpha_sel<0)||(alpha_sel>1))
		alpha_sel=0;

	LcdWindowOnOff(LCD_WIN_ALL,LCD_OFF);
	LcdEnvidOnOff(LCD_OFF);
			
	// Setting Window 0(16bpp)
	Basic_Display_Setting(LCD_WIN_0,LCD_BUF_0,WINCONx_16BPP_565,lcd_horizon_value,lcd_line_value);	
	//printf("Sart:0x%x, End:0x%x, Ver:0x%x\n",*(int *)0x4c800064,*(int *)0x4c80007c,*(int *)0x4c800094);
	for(i=0;i<screen_height/8;i++)
		LCD_FilledRectangle(0,i*8, screen_width-1, i*8+3,0x7e0);	// Green
	for(i=0;i<screen_height/8;i++)
		LCD_FilledRectangle(0,i*8+4, screen_width-1, i*8+7,0xffff);	// White

	lprintf((screen_width-64)/2,screen_height*2/3,0x0,"Window 0");	

	pISR_LCD = (unsigned)Display_ISR;
	rINTMSK &= ~(1<<16);

	if(lcd_if==I80_IF)
	{
		rVIDINTCON = (0x3f<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<0); //Main & Sub Sending complete

⌨️ 快捷键说明

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