我在移置2440的Bootload中的lcd驱动时候,设置24bpp Mode显示,现在屏幕上显示的内容为屏幕的上半边水平依次显示了两个一摸一样的我欲显示的开机画面,下半部分无任何显示,请问应该调节那几个参数啊。
我显示16bpp mode时候可以正常显示并调试通过了。
好象问题在显示缓冲部分,你是以字还是以半字存取的?
你在EBOOT有改了LCD控制器变为24BPP了,那你申请的显存也要相应的变为原来的两倍,然后,在进入系统后,你的DISPLAY显示驱动,也要变为24位的驱动才行,其实是32位,因为CE系统里,24位和32位是一样的,
据体一点吧:
s2440LCD->rLCDSADDR2 = M5D((FRAMEBUF_DMA_BASE + (LCD_XSIZE_TFT * LCD_YSIZE_TFT * 2)) >> 1);
s2440LCD->rLCDSADDR3 = (((LCD_XSIZE_TFT - LCD_XSIZE_TFT) / 1) << 11) | (LCD_XSIZE_TFT / 1);
这两个寄存器,你要比原来16位的,乘以2
然后,你在找到DRIVERS 里面的display.cpp文件
m_ModeInfo.Bpp = m_colorDepth;//m_colorDepth;//要改为32BPP的,
m_ModeInfo.format = gpe32Bpp;
这几个参数你要改为32BPP的,因为三星的BSP里,对24位的支持就是对32位的支持,都是4个字节,然后,你要在CONFIG.BIB
文件里,看一下你分配的显存够不够,如果不够,你要加大一点
1.s2440LCD->LCDSADDR2=M5D( ((DWORD)IMAGE_FRAMEBUFFER_DMA_BASE+(LCD_XSIZE_TFT*LCD_YSIZE_TFT*4))>>1 );
2.Display Driver中:
ULONG gBitMasks[] = { 0xff0000,0x00ff00,0x0000ff};
S3C2440DISP::S3C2440DISP()函数中:
m_RedMaskSize = 8;
m_RedMaskPosition = 16;
m_GreenMaskSize = 8;
m_GreenMaskPosition = 8;
m_BlueMaskSize = 8;
m_BlueMaskPosition = 0;
m_colorDepth = 24;
m_cbScanLineLength = m_nScreenWidth * 4;
m_ModeInfo.format = gpe32Bpp;
首先,感谢ok138ok的详细解答。
我没用EBOOT,我是用ADS写的NandBootload,我在lcd.c文件中该为:
s2440LCD->rLCDSADDR2 = M5D((FRAMEBUF_DMA_BASE + (LCD_XSIZE_TFT * LCD_YSIZE_TFT * 2)) >> 1);
s2440LCD->rLCDSADDR3 = (((LCD_XSIZE_TFT - LCD_XSIZE_TFT) / 1) < < 11) | (LCD_XSIZE_TFT / 1); 后,屏幕上显示为4副一模一样的图片,还有就是
m_ModeInfo.Bpp = m_colorDepth;//m_colorDepth;//要改为32BPP的,
m_ModeInfo.format = gpe32Bpp;
这个参数在我的Bootload里面是没有的。我的代码如下:
void lcdplay(void)
{
unsigned int clkval_calc,i,j; // 040507
// Set up the LCD controller registers to display a power-on bitmap image.
//
rGPCUP = 0xFFFFFFFF;
rGPCCON = 0xAAAAAAA9;
rGPDUP = 0xFFFFFFFF;
rGPDCON = 0xAAAAAAAA;
clkval_calc = (WORD)((float)(S3C2440A_HCLK)/(2.0*5000000)+0.5)-1;
rLCDCON1 = (CLKVAL_TFT_240320 << 8) | /* VCLK = HCLK / ((CLKVAL + 1) * 2) -> About 7 Mhz */
(1 << 7) | /* 0 : Each Frame---------------------------------- */
(3 << 5) | /* TFT LCD Pannel */
//(12 << 1) | /* 16bpp Mode-------------------------------------------*/
(13 << 1) | /* 24bpp Mode */
(0 << 0) ; /* Disable LCD Output */
rLCDCON2 = (((VBPD_240320)&0xff) << 24) | /* VBPD : 1 */
((LCD_YSIZE_TFT_240320-1)<< 14) | /* Vertical Size : 320 - 1 */
(((VFPD_240320)&0xff) << 6) | /* VFPD : 2 */
(((VSPW_240320)&0x3f) << 0) ; /* VSPW : 1 */
rLCDCON3 = (((HBPD_240320)&0x7f) << 19) | /* HBPD : 6 */
((LCD_XSIZE_TFT_240320-1) << 8) | /* HOZVAL_TFT : 240 - 1 */
(((HFPD_240320)&0xff) << 0) ; /* HFPD : 2 */
rLCDCON4 = (13 << 8) | /* MVAL : 13 */
(((HSPW_240320)&0xff) << 0) ; /* HSPW : 4 */
rLCDCON5 = (0 << 12) | /* BPP24BL : LSB valid */
(1 << 11) | /* FRM565 MODE : 5:6:5 Format */
(1 << 10) | /* INVVCLK : VCLK Falling Edge */
//(0 << 10) | /* INVVCLK : VCLK Falling Edge */
(1 << 9) | /* INVVLINE : Inverted Polarity */
(1 << 8) | /* INVVFRAME : Inverted Polarity */
(0 << 7) | /* INVVD : Normal */
(0 << 6) | /* INVVDEN : Normal */
(0 << 5) | /* INVPWREN : Normal */
(0 << 4) | /* INVENDLINE : Normal */
(1 << 3) | /* PWREN : Enable PWREN */
(0 << 2) | /* ENLEND : Disable LEND signal */
(0 << 1) | /* BSWP : Swap Disable */
(1 << 0) ; /* HWSWP : Swap Enable */
rLCDSADDR1 = ((LCDFRAMEBUFFER >> 22) << 21) |
((M5D(LCDFRAMEBUFFER >> 1)) << 0);
rLCDSADDR2 = M5D((LCDFRAMEBUFFER + (SCR_XSIZE_TFT_240320 * LCD_YSIZE_TFT_240320 *4/2)) >> 1);
rLCDSADDR3 = ((0) << 11) | (LCD_XSIZE_TFT_240320 *2/2);
rLCDINTMSK|=(3); // MASK LCD Sub Interrupt
rTCONSEL&=~((1<<4)|1); // Disable LCC3600, LPC3600
rTPAL = 0x0; // Disable Temp Palette
rLCDCON1 |= 1;
rGPGUP=rGPGUP&(~(1<<4))|(1<<4); // Pull-up disable
rGPGCON=rGPGCON&(~(3<<8))|(3<<8); //GPG4=LCD_PWREN
}
#define LCD_XSIZE_TFT_240320 (320)
#define LCD_YSIZE_TFT_240320 (240)
#define SCR_XSIZE_TFT_240320 (LCD_XSIZE_TFT_240320)
#define SCR_YSIZE_TFT_240320 (LCD_YSIZE_TFT_240320)
cpu是用的S3c2440的啊
还有个问题就是,要把一幅彩色图片转换为16bpp的C文件,用什么软件啊,我的邮箱是hcrh24@sian.com,有的话麻烦给我发一下吧,或者给我个链接地址也行的
2440对24bpp情况下显存的要求,和wince下24bpp显示驱动处理是不一致的,所以会出错。
最简单的方法,是在驱动里,设置成32bpp方式,就可以解决这个问题。
搂主搞定没有?
等着看结果呢。。。。。。。。。。。
呵呵
搞不定啊,我只好改回到16bpp模式显示的了,觉得效果也可以达到产品的要求,先这样吧。谢谢大家的参与,先挂两天,我就给大伙散分啊,都有份啊!
你要把你的图片的数据转化成24bpp的,然后在设置的时候全部按照32bpp来设置。
你可以试下。
2440 lcd 24bpp显示就照我说的做。
关于BMP图片转转成16bpp/24bpp直接显示数据,看代码:
#include
#include
#include
/***********************************************
Data types
************************************************/
#define dgNULL 0L
#define dgTRUE 1
#define dgFALSE 0
typedef short int dgBOOL;
typedef signed char S8;
typedef signed short int S16;
typedef signed int S32;
typedef unsigned char U8;
typedef unsigned short int U16;
typedef unsigned int U32;
#define BI_RGB 0L
typedef struct tag_dgImage_BITMAPFILEHEADER {
U32 bfSize;
U16 bfReserved1;
U16 bfReserved2;
U32 bfOffBits;
} _dgImage_BITMAPFILEHEADER;
typedef struct tag_dgImage_BITMAPINFOHEADER{
U32 biSize;
S32 biWidth;
S32 biHeight;
U16 biPlanes;
U16 biBitCount;
U32 biCompression;
U32 biSizeImage;
S32 biXPelsPerMeter;
S32 biYPelsPerMeter;
U32 biClrUsed;
U32 biClrImportant;
} _dgImage_BITMAPINFOHEADER;
#define RGB_16BIT 0
#define RGB_24BIT 1
dgBOOL BMP2DMP( const char *const srcname, const char *const dstname, char rgbdata)
{
U16 BMP_ID;
_dgImage_BITMAPFILEHEADER bmpfh;
_dgImage_BITMAPINFOHEADER bmpinfo;
FILE *fp1, *fp2;
/* load windows BMP file */
fp1 = fopen( srcname, "rb" );
if( !fp1 ) goto error;
fp2 = fopen( dstname, "wb" );
if( !fp2 ) goto error;
fread((void *)(&BMP_ID),2, 1, fp1 );
//if (BMP_ID != *((U16*) "BM")) goto error;
fread((void *)(&bmpfh),sizeof(_dgImage_BITMAPFILEHEADER), 1, fp1 );
fread((void *)(&bmpinfo),sizeof(_dgImage_BITMAPINFOHEADER), 1, fp1 );
printf( "Width : %d, Height : %d\n", bmpinfo.biWidth, bmpinfo.biHeight );
//printf( "Data Position = 0x%08X\n", bmpfh.bfOffBits );
{
int i, j;
unsigned short int rgb565;
unsigned char bgr[3];
fseek( fp1, bmpfh.bfOffBits,SEEK_SET );
for( i=(bmpinfo.biHeight)-1 ; i>=0 ; i-- )
{
for( j=0 ; j<(bmpinfo.biWidth) ; j++ )
{
if(rgbdata == 0)
{
fread( bgr, 3, 1, fp1 );
rgb565 = ((((U16)bgr[2])&0xF8)<<8) | ((((U16)bgr[1])&0xFC)<<3) | ((((U16)bgr[0])&0xF8)>>3);
//printf(" (%3d, %3d) = (%3d, %3d, %3d) = 0x%04X\n", j, i, bgr[0], bgr[1], bgr[2], rgb565 );
fseek( fp2, (i*bmpinfo.biWidth + j)*2, SEEK_SET );
fwrite( &rgb565, 2, 1, fp2 );
}
else if(rgbdata == 1)
{
fread( bgr, 3, 1, fp1 );
fseek( fp2, (i*bmpinfo.biWidth + j)*3, SEEK_SET );
fwrite( bgr, 3, 1, fp2);
}
else
{
goto error;
}
}
// 4 byte aline per every line.
if( (bmpinfo.biWidth*3) % 4 )
{
fread( bgr, (bmpinfo.biWidth*3) % 4, 1, fp1 );
}
}
}
switch(rgbdata)
{
case 0:
printf( "16BIT RGBDATA\n" );
break;
case 1:
printf( "24BIT RGBDATA\n" );
break;
default:
break;
}
// printf( "saved\n" );
if( fp1 ) fclose( fp1 );
if( fp2 ) fclose( fp2 );
return dgTRUE;
error:
printf( "error\n" );
if( fp1 ) fclose( fp1 );
if( fp2 ) fclose( fp2 );
return dgFALSE;
}
int main( int argc, char *argv[] )
{
if( argc != 4 )
{
printf( "Usage : bmp2dmp.exe srcfilename dstfilename RGB_DATA\n" );
printf( "<>\n" );
printf( "0 : 24Bit BMP File --> 16Bit RGB DATA\n" );
printf( "1 : 24Bit BMP File --> 24Bit RGB DATA\n" );
return -1;
}
// if( BMP2DMP( (const char *const)argv[1], (const char *const)argv[2] ) )
if( BMP2DMP( (const char *const)argv[1], (const char *const)argv[2] , (atoi(argv[3]))))
return 0;
return -1;
}
有哪位高手可以把Bootload里面,16bpp和24bpp显示点的函数drawpoint()给发一下啊,我那个显示的色彩不太对,我是直接给赋值的
void PutPixel(int x, int y, unsigned short color)
{
......
*(lcd_base + delta) = color;
......
}
这个函数在16bpp和24bpp下显示的色彩都不对的,和16进制颜色表里头对不上啊。
void __inline _putpixel( int X, int Y, unsigned long C )
{
#if (MLC_RGB_BPP == MLC_RGB_16BPP)
*(volatile unsigned short *)(DISP_BASE_ADDR + X*MLC_RGB_BPP + Y*DISPLAY_WIDTH*MLC_RGB_BPP) = (unsigned short)C;
#elif (MLC_RGB_BPP == MLC_RGB_24BPP)
*(volatile unsigned char *)(DISP_BASE_ADDR + X*MLC_RGB_BPP + Y*VID_MAX_X_RESOLUTION*MLC_RGB_BPP + 0) = (unsigned char)((C & 0x000000FF)>> 0); // Blue
*(volatile unsigned char *)(DISP_BASE_ADDR + X*MLC_RGB_BPP + Y*VID_MAX_X_RESOLUTION*MLC_RGB_BPP + 1) = (unsigned char)((C & 0x0000FF00)>> 8); // Green
*(volatile unsigned char *)(DISP_BASE_ADDR + X*MLC_RGB_BPP + Y*VID_MAX_X_RESOLUTION*MLC_RGB_BPP + 2) = (unsigned char)((C & 0x00FF0000)>>16); // Red
#elif (MLC_RGB_BPP == MLC_RGB_24BPP_32BIT)
*(volatile unsigned char *)(DISP_BASE_ADDR + X*MLC_RGB_BPP + Y*VID_MAX_X_RESOLUTION*MLC_RGB_BPP + 0) = (unsigned char)((C & 0x000000FF)>> 0); // Blue
*(volatile unsigned char *)(DISP_BASE_ADDR + X*MLC_RGB_BPP + Y*VID_MAX_X_RESOLUTION*MLC_RGB_BPP + 1) = (unsigned char)((C & 0x0000FF00)>> 8); // Green
*(volatile unsigned char *)(DISP_BASE_ADDR + X*MLC_RGB_BPP + Y*VID_MAX_X_RESOLUTION*MLC_RGB_BPP + 2) = (unsigned char)((C & 0x00FF0000)>>16); // Red
#endif
}
引用: 引用 15 楼 ym_luo 的回复:
void __inline _putpixel( int X, int Y, unsigned long C )
{
#if (MLC_RGB_BPP == MLC_RGB_16BPP)
*(volatile unsigned short *)(DISP_BASE_ADDR + X*MLC_RGB_BPP + Y*DISPLAY_WIDTH*MLC_RGB_BPP) = (unsigned short)C;
请问这个里面的MLC_RGB_BPP,DISPLAY_WIDTH两个变量时指代的什么,MLC_RGB_BPP应该就是16吧。关键是DISPLAY_WIDTH是指的虚拟屏的大小还是实际屏幕的大小。
还有就是MLC_RGB_24BPP和 MLC_RGB_24BPP_32BIT各是指的什么啊,有什么区别吗?
#define DISPLAY_WIDTH LCD_XSIZE_TFT
#define VID_MAX_X_RESOLUTION LCD_XSIZE_TFT
#define VID_MAX_Y_RESOLUTION LCD_YSIZE_TFT
#define MLC_RGB_16BPP 0x2 //16 bpp.
#define MLC_RGB_24BPP 0x3 //24 bpp.
#define MLC_RGB_24BPP_32BIT 0x4 //24bpp 32bit
#define MLC_RGB_BPP MLC_RGB_16BPP