1.最好是用ADS写个测试程序,把TFT屏的有关参数确定下来.

2.platform\smdk2410\inc\s2410.h,更改成如下定义

#define VBPD ((15)&0xff)
#define VFPD ((15)&0xff)
#define VSPW ((15)&0x3f)

#define HBPD ((32)&0x7f)
#define HFPD ((32)&0xff)
#define HSPW ((96)&0xff)

#define CLKVAL_TFT (1)

3.platform\smdk2410\kernel\hal\cfw.c

/*
// Define some values for TFT 16bpp
// LCDTYPE 定义在s2410.h文件中,#define LCDTYPE TFT16BPP
//by xiaoyunsoft @2007-11-04
//#if(LCDTYPE == TFT16BPP) // TFT 640*480 / 16bpp
//#define FR_WIDTH 240
//#define FR_HEIGHT 320
//#define PhysicalVmemSize FR_HEIGHT*FR_WIDTH*LCDTYPE


#if(LCDTYPE == TFT16BPP) // TFT 640*480 / 16bpp
#define FR_WIDTH 640
#define FR_HEIGHT 480
#define PhysicalVmemSize FR_HEIGHT*FR_WIDTH*LCDTYPE

struct FrameBuffer {
unsigned short pixel[FR_HEIGHT][FR_WIDTH];
};

#else if(LCDTYPE == STN8BPP)// STN 320*240 / 8bpp
#define FR_WIDTH 320
#define FR_HEIGHT 240
#define PhysicalVmemSize FR_HEIGHT*FR_WIDTH

struct FrameBuffer {
unsigned char pixel[FR_HEIGHT][FR_WIDTH];
};
#endif
*/

struct FrameBuffer *FBuf;

static void InitDisplay()
{
//int i, j;
volatile IOPreg *s2410IOP;
volatile LCDreg *s2410LCD;

s2410IOP = (IOPreg *)IOP_BASE;
s2410LCD = (LCDreg *)LCD_BASE;

// LCD port initialize.
s2410IOP->rGPCUP = 0xFFFFFFFF;
s2410IOP->rGPCCON = 0xAAAAAAAA;

s2410IOP->rGPCCON = 0xAAAAAAAA;

s2410IOP->rGPDUP = 0xFFFFFFFF;
s2410IOP->rGPDCON = 0xAAAAAAAA;

s2410IOP->rGPGCON &= ~(3 << 8); /* Set LCD_PWREN as output */
s2410IOP->rGPGCON |= (1 << 8);

s2410IOP->rGPGDAT |= (1 << 4); /* Backlight ON */




//s2410LCD->rLCDCON1=(3<<8)|(MVAL_USED<<7)|(3<<5)|(12<<1)|0;
// TFT LCD panel,16bpp TFT,ENVID=off

s2410LCD->rLCDCON1=(CLKVAL_TFT<<8)|(MVAL_USED<<7)|(3<<5)|(12<<1)|0;
s2410LCD->rLCDCON2=(VBPD<<24)|(LINEVAL_TFT<<14)|(VFPD<<6)|(VSPW);
s2410LCD->rLCDCON3=(HBPD<<19)|(HOZVAL_TFT<<8)|(HFPD);
s2410LCD->rLCDCON4=(MVAL<<8)|(HSPW);
s2410LCD->rLCDCON5=(1<<11)|(1<<9)|(1<<8)|(1<<3)|(1<<0); //FRM5:6:5,HSYNC and VSYNC are inverted
s2410LCD->rLCDSADDR1=((FRAMEBUF_DMA_BASE>>22)<<21)|M5D(FRAMEBUF_DMA_BASE>>1);
s2410LCD->rLCDSADDR2=M5D( (FRAMEBUF_DMA_BASE+(LCD_XSIZE_TFT*LCD_YSIZE_TFT*2))>>1 );
s2410LCD->rLCDSADDR3=(((LCD_XSIZE_TFT-LCD_XSIZE_TFT)/1)<<11)|(LCD_XSIZE_TFT/1);
s2410LCD->rLCDINTMSK|=(3); // MASK LCD Sub Interrupt
s2410LCD->rLPCSEL&=(~7); // Disable LPC3600
s2410LCD->rTPAL=0; // Disable Temp Palette

s2410LCD->rLCDCON1 |= 1;

RETAILMSG(1,(TEXT("LCD 640*480 Initialize(by xiaoyunsoft 2007-11-04)...\r\n")));

}

4.platform\smdk2410\drivers\display\S3C2410LCD\s3c2410disp.cpp

S3C2410DISP::S3C2410DISP (void)
{
RETAILMSG(1, (TEXT("++S3C2410DISP::S3C2410DISP\r\n")));

// setup up display mode related constants
// m_nScreenWidth = 240;// xiaoyunsoft @ 2007-11-05
// m_nScreenHeight = 320;
m_nScreenWidth = 640;
m_nScreenHeight = 480;
m_colorDepth = 16;
m_cbScanLineLength = m_nScreenWidth * 2;
m_FrameBufferSize = m_nScreenHeight * m_cbScanLineLength;

// memory map register access window, frame buffer, and program LCD controller
InitializeHardware();

...
}

...

void S3C2410DISP::InitializeHardware (void)
{
WORD *ptr;
DWORD index;
HKEY hkDisplay = NULL;
DWORD dwLCDPhysicalFrameBase;
DWORD dwStatus, dwType, dwSize;

RETAILMSG(1, (_T("++S3C2410DISP::InitializeHardware\r\n")));

// open the registry key and read our configuration
dwStatus = RegOpenKeyEx(HKEY_LOCAL_MACHINE, gszBaseInstance, 0, 0, &hkDisplay);
dwType = REG_DWORD;

if(dwStatus == ERROR_SUCCESS && dwType == REG_DWORD) {
dwSize = sizeof(DWORD);
dwStatus = RegQueryValueEx(hkDisplay, _T("LCDVirtualFrameBase"), NULL, &dwType,
(LPBYTE) &gdwLCDVirtualFrameBase, &dwSize);
}
if(dwStatus == ERROR_SUCCESS && dwType == REG_DWORD) {
dwSize = sizeof(DWORD);
dwStatus = RegQueryValueEx(hkDisplay, _T("LCDPhysicalFrameBase"), NULL, &dwType,
(LPBYTE) &dwLCDPhysicalFrameBase, &dwSize);
}

// close the registry key
if(hkDisplay != NULL) {
RegCloseKey(hkDisplay);
}

// did we get everything?
if(dwStatus != ERROR_SUCCESS) {
RETAILMSG(0, (_T("SALCD2: InitializeHardware: couldn't get registry configuration\r\n")));
return;
}

// map frame buffer into process space memory
/* by xiaoyunsoft @ 2007-11-05

//这里被我注释了,主要是改了它显示的缓存大上,原来是240*320定义了0x40000大小的缓存,现在不够用了.重新定义了0xA0000
m_VirtualFrameBuffer = (DWORD)VirtualAlloc(0, (0x40000), MEM_RESERVE, PAGE_NOACCESS);
if (m_VirtualFrameBuffer == NULL)
{
RETAILMSG(0,(TEXT("m_VirtualFrameBuffer is not allocated\n\r")));
return;
}
else if (!VirtualCopy((PVOID)m_VirtualFrameBuffer, (PVOID)gdwLCDVirtualFrameBase, (0x40000), PAGE_READWRITE | PAGE_NOCACHE))
{
RETAILMSG(0, (TEXT("m_VirtualFrameBuffer is not mapped\n\r")));
VirtualFree((PVOID)m_VirtualFrameBuffer, 0, MEM_RELEASE);
return;
}
*/

//这里要注意,它的缓存大小也许不能随意定义大小,要看它是否超过了PB工程中的config.bib文件中定义的display区的大小,这里没有超过,config.bib中定义的大小是0x00100000
m_VirtualFrameBuffer = (DWORD)VirtualAlloc(0, (0xA0000), MEM_RESERVE, PAGE_NOACCESS);
if (m_VirtualFrameBuffer == NULL)
{
RETAILMSG(0,(TEXT("m_VirtualFrameBuffer is not allocated\n\r")));
return;
}
else if (!VirtualCopy((PVOID)m_VirtualFrameBuffer, (PVOID)gdwLCDVirtualFrameBase, (0xA0000), PAGE_READWRITE | PAGE_NOCACHE))
{
RETAILMSG(0, (TEXT("m_VirtualFrameBuffer is not mapped\n\r")));
VirtualFree((PVOID)m_VirtualFrameBuffer, 0, MEM_RELEASE);
return;
}

RETAILMSG(1, (TEXT("m_VirtualFrameBuffer is mapped at %x(PHY : %x)\n\r"), m_VirtualFrameBuffer, gdwLCDVirtualFrameBase));
RETAILMSG(1, (TEXT("Clearing frame buffer !!!\n\r")));

ptr = (WORD *)m_VirtualFrameBuffer;
 

//这里昌往缓存里填初始化数据,不填也可以.
// clear rest of frame buffer out
//for (index = 0; index < 320*240; index++)
for (index = 0; index < 640*480; index++)
{
if(index < 76800)//3200
{
ptr[index] = 0xf800;
}
else if(index < 153600)//6400
{
ptr[index] = 0x07e0;
}
else if(index < 230400)//9600
{
ptr[index] = 0x001f;
}
else
{
ptr[index] = 0xffff;
}
}

RETAILMSG(1, (_T("Initialize Display by xiaoyunsoft @ 2007-11-06\r\n")));
RETAILMSG(1, (_T("--S3C2410DISP::InitializeHardware\r\n")));
}

单独编译后重新生成bin文件即可