请教为什么下面程序在s3c2440的板子上不能够正常显示800*600的起始画面
[复制链接]
各位大侠,
请教为什么下面程序在s3c2440的板子上不能够正常显示800*600的起始画面
代码如下:
#include
#include
#include "option.h"
#include "def.h"
#include "2440addr.h"
#include "2440lib.h"
#include "2440slib.h"
#include "2440addr.h"
#include "nand.h"
#include "loader.h"
#include "k.h"
// == Params == //
#define CLKVAL_TFT_800600 (0)
#define MVAL (13)
#define MVAL_USED (0)
//Timing parameter for LTS350Q1(SAMSUNG)
#define VBPD_800600 ((23-1)&0xff) //(23) //Vsync blanck porch: 23
#define VFPD_800600 ((12-1)&0xff) //(12) //Vsync front porch: 12
#define VSPW_800600 ((10-1)&0xff) //(10) //Vsync pulse width: 10
#define HBPD_800600 ((46-1)&0xff) //(46) //Hsync blanck porch: 46
#define HFPD_800600 ((210-1)&0xff) //(210) //Hsync front porch: 210
#define HSPW_800600 ((6-1)&0xff) //(6) //Hsync pulse width: 6
#define M5D(n) ((n) & 0x1fffff) // To get lower 21bits
//TFT800600
#define LCD_XSIZE_TFT_800600 (800)//800
#define LCD_YSIZE_TFT_800600 (600)//600
#define HOZVAL_TFT_800600 (LCD_XSIZE_TFT_800600-1)//800-1=799
#define LINEVAL_TFT_800600 (LCD_YSIZE_TFT_800600-1)//600-1=599
#define SCR_XSIZE_TFT_800600 (LCD_XSIZE_TFT_800600*2)//800*2=1600
#define SCR_YSIZE_TFT_800600 (LCD_YSIZE_TFT_800600*2)//600*2=1200
// LCD Params
U32 (*frameBuffer8BitTft800600)[SCR_XSIZE_TFT_800600/4];//800
#define PALETTE 0x4d000400 //Palette start address
#define LCDFRAMEBUFFER 0x33800000 //_NONCACHE_STARTADDRESS
// 1. The LCD frame buffer should be write-through or non-cachable.
// 2. The total frame memory should be inside 4MB.
// 3. To meet above 2 conditions, the frame buffer should be
// inside the following regions.
// 0x31000000~0x313ffffff,
// 0x31400000~0x317ffffff,
// 0x31800000~0x31bffffff,
// .....
// 0x33800000~0x33bffffff
// ===== _PutTft8Bit_800600 ===== //
void PutPixel(U32 x,U32 y,U32 c)
{
if(x
frameBuffer8BitTft800600[(y)][(x)/4]=(frameBuffer8BitTft800600[(y)][x/4]
& ~(0xff000000>>((x)%4)*8) ) | ( (c&0x000000ff)<<((4-1-((x)%4))*8) );
}
void lcdplay(void)
{
int i,j,k,m,n;
int x0,y0;
U32* palette;
//======PWM timer init ======//
rTCFG0 =24;
rTCFG1 &=~(0xf);
rTCMPB0 =2500;
rTCNTB0 =5000;
rTCON &=~(0xf);
rTCON |=0xa;
rTCON &=~(0xf);
rTCON |=0x9;
//===========Lcd port init==========//
rGPCUP=0xffffffff; // Disable Pull-up register
rGPCCON=0xaaaaaaa9; //Initialize VD[7:0],LCDVF[2:0],VM,VFRAME,VLINE,VCLK,LEND
rGPDUP=0xffffffff; // Disable Pull-up register
rGPDCON=0xaaaaaaaa; //Initialize VD[23:8]
/*==========Lcd_Palette8Bit_Init==========*/
rLCDCON5|=(1<<11); // 5:6:5 Palette Setting
palette=(U32 *)(PALETTE);
//*palette++=Colorsk;
*palette++=0; //black
for(i=0;i<256;i++)
{
unsigned char cdata, p_red, p_green, p_blue;
p_red=(i & 0xe0);
p_green=(i & 0x1c);
p_blue=(i & 0x03);
*palette++=((U32)((p_red<<8)|(p_green<<6)|(p_blue<<3)));
}
*palette=0xffff; //white
//===========Lcd init==========//
frameBuffer8BitTft800600=(U32(*)[SCR_XSIZE_TFT_800600/4])LCDFRAMEBUFFER;
rLCDCON1=(CLKVAL_TFT_800600<<8)|(MVAL_USED<<7)|(3<<5)|(11<<1)|0;
// TFT LCD panel,8bpp TFT,ENVID=off
rLCDCON2=(VBPD_800600<<24)|(LINEVAL_TFT_800600<<14)|(VFPD_800600<<6)|(VSPW_800600);
rLCDCON3=(HBPD_800600<<19)|(HOZVAL_TFT_800600<<8)|(HFPD_800600);
rLCDCON4=(MVAL<<8)|(HSPW_800600);
rLCDCON5=(1<<9)|(1<<8); //FRM5:6:5,HSYNC and VSYNC are inverted//(1<<11)|
rLCDSADDR1=(((U32)frameBuffer8BitTft800600>>22)<<21)|M5D((U32)frameBuffer8BitTft800600>>1);
rLCDSADDR2=M5D(((U32)frameBuffer8BitTft800600+(SCR_XSIZE_TFT_800600*LCD_YSIZE_TFT_800600/1))>>1 );
rLCDSADDR3=(((SCR_XSIZE_TFT_800600-LCD_XSIZE_TFT_800600)/2)<<11)|(LCD_XSIZE_TFT_800600/2);
rLCDINTMSK|=(3); // MASK LCD Sub Interrupt
rLPCSEL&=(~7); // Disable LPC3600
rTPAL=0; // Disable Temp Palette
//rTPAL = (1<<24)|((0xff)<<0); // Enable Temporary Palette : blue
//============Lcd PowerEnable===========//
//GPG4 is setted as LCD_PWREN
rGPGUP=rGPGUP&(~(1<<4))|(1<<4); // Pull-up disable
rGPGCON=rGPGCON&(~(3<<8))|(3<<8); //GPG4=LCD_PWREN
//Enable LCD POWER ENABLE Function
rLCDCON5=rLCDCON5&(~(1<<3))|(1<<3); // PWREN
rLCDCON5=rLCDCON5&(~(1<<5))|(0<<5); // INVPWREN
// ENVID=ON,enable the LCD output
rLCDCON1|=1;
// ============ Show Map ============= //显示开机图片
for(k=0,j=0;j<600;j++)
for(i=0;i<800;i++)
{
ackj[k++]//PutPixel(i,j,ackj[k++]);
}
}
// ======== Draw Process Bar ======== //进度条
int currWidth=0;
int const bar_height=LCD_YSIZE_TFT_800600*0.07;
int bar_base =LCD_YSIZE_TFT_800600-bar_height;
void drawProcessBar(DWORD total,int current)
{
int i,j;
if(total != -1)
{
// Bar Dimension
int bar_width =LCD_XSIZE_TFT_800600*(current*1.0/total);
// will be very fast
if(bar_width>currWidth)
{
for(j=0;j
PutPixel(bar_width,j+bar_base,(int)(255-16+1));
currWidth=bar_width;
//Uart_SendString("#");
}
}
}