在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
芯片精品文章合集(500篇!) 创芯人才网--重磅上线啦!
查看: 2820|回复: 0

单色显示屏驱动,很急,谢谢

[复制链接]
发表于 2007-3-29 21:44:53 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
在1bpp的时候不知道调色板、dma寄存器等如何设置为好,另外stn屏本来就比tft屏不好做。
320*240*1BPP,STN屏,单屏,PXA255处理器,当置
palette_size=4,palette_mem_size = 2*fbi->palette_size * sizeof(u16);加入
内核后不显示内容,没有任何反应,
用cat /dev/urandom>/dev/fb0后提示:cat: write error: No space left on device
当置palette_size=4,palette_mem_size = fbi->palette_size * sizeof(u16);时
屏幕中间偏上一点位置出现一条亮线,该线随着把分辨率设为不同值如640*480而发
生位置变化,请熟悉framebuffer的人帮忙分析一下.
另外:对于1bpp,RGB的设置该如何处理,下边贴出起动时在串口终端打印出的信息和
部分原文件,请熟悉的人帮忙分析一下,万分感谢
下面是启动时打印出的参数
pxafb_map_video_memory..............................
fb.palette_size=4
palette_mem_size=1008x
pxafb_set_var--------------------------------------
RGBT length = 0:0:1:0
RGBT length = 0:0:1:0
pxafb_activate_var Configuring PXA LCD..............
var: xres=320 hslen=3 lm=4 rm=4
var: yres=240 vslen=2 um=0 bm=0
dma period =82368000 ps
nlccr0 = 0x0030087b
nlccr1 = 0x0303093f
nlccr2 = 0x000004ef
nlccr3 = 0x0040ff1f
dma setting here!
fbi->dmadesc_fblow_cpu = 0xc4800fc0
fbi->dmadesc_fbhigh_cpu = 0xc4800fd0
fbi->fdadr0=0xa0348fe0
fbi->fdadr1=0xa0348fc0
fbi->dmadesc_fblow_cpu = 0xc4800fc0
fbi->dmadesc_fbhigh_cpu = 0xc4800fd0
fbi->dmadesc_palette_cpu = 0xc4800fe0
fbi->dmadesc_fblow_dma = 0xa0348fc0
fbi->dmadesc_fbhigh_dma = 0xa0348fd0
fbi->dmadesc_palette_dma = 0xa0348fe0
fbi->dmadesc_fblow_cpu->fdadr = 0xa0348fc0
fbi->dmadesc_fbhigh_cpu->fdadr = 0xa0348fe0
fbi->dmadesc_palette_cpu->fdadr = 0xa0348fd0
fbi->dmadesc_fblow_cpu->fsadr = 0xa034b580
fbi->dmadesc_fbhigh_cpu->fsadr = 0xa0349000
fbi->dmadesc_palette_cpu->fsadr = 0xa0348ff0
fbi->dmadesc_fblow_cpu->ldcmd = 0x2580
fbi->dmadesc_fbhigh_cpu->ldcmd = 0x2580
fbi->dmadesc_palette_cpu->ldcmd = 0x4000008
fbcon_init...................................
mode: PXA
visual: 0
res: 320x240-1
pxafb_switch....................................
con=0 info->modename=PXA
pxafb_set_var--------------------------------------
RGBT length = 0:0:1:0
RGBT length = 0:0:1:0
pxafb_activate_var Configuring PXA LCD..............
var: xres=320 hslen=3 lm=4 rm=4
var: yres=240 vslen=2 um=0 bm=0
dma period =82368000 ps
nlccr0 = 0x0030087b
nlccr1 = 0x0303093f
nlccr2 = 0x000004ef
nlccr3 = 0x0040ff1f
dma setting here!
fbi->dmadesc_fblow_cpu = 0xc4800fc0
fbi->dmadesc_fbhigh_cpu = 0xc4800fd0
fbi->fdadr0=0xa0348fe0
fbi->fdadr1=0xa0348fc0
fbi->dmadesc_fblow_cpu = 0xc4800fc0
fbi->dmadesc_fbhigh_cpu = 0xc4800fd0
fbi->dmadesc_palette_cpu = 0xc4800fe0
fbi->dmadesc_fblow_dma = 0xa0348fc0
fbi->dmadesc_fbhigh_dma = 0xa0348fd0
fbi->dmadesc_palette_dma = 0xa0348fe0
fbi->dmadesc_fblow_cpu->fdadr = 0xa0348fc0
fbi->dmadesc_fbhigh_cpu->fdadr = 0xa0348fe0
fbi->dmadesc_palette_cpu->fdadr = 0xa0348fd0
fbi->dmadesc_fblow_cpu->fsadr = 0xa034b580
fbi->dmadesc_fbhigh_cpu->fsadr = 0xa0349000
fbi->dmadesc_palette_cpu->fsadr = 0xa0348ff0
fbi->dmadesc_fblow_cpu->ldcmd = 0x2580
fbi->dmadesc_fbhigh_cpu->ldcmd = 0x2580
fbi->dmadesc_palette_cpu->ldcmd = 0x4000008
pxafb_switch....................................
con=0 info->modename=PXA
pxafb_logo1--------------------------------------
Console: switching to mono frame buffer device 40x30
pxafb_setup_gpio: 4 bits interface
LCCR0= : 0x0030087b
LCCR1= : 0x0303093f
LCCR2= : 0x000004ef
LCCR3= : 0x0040ff1f
fbi->fdadr0 = : 0xa0348fe0
fbi->fdadr1 = : 0xa0348fc0
FDADR0 = : 0xa0348fe0
FDADR1 = : 0xa0348fc0
头文件里边的设置
#define LCD_PIXCLOCK 643500//0
#define LCD_BPP 1///
#define LCD_XRES 320//640
#define LCD_YRES 240//480
#define LCD_HORIZONTAL_SYNC_PULSE_WIDTH 3//1
#define LCD_VERTICAL_SYNC_PULSE_WIDTH 2//1
#define LCD_BEGIN_OF_LINE_WAIT_COUNT 4//2//200
#define LCD_BEGIN_FRAME_WAIT_COUNT 0
#define LCD_END_OF_LINE_WAIT_COUNT 4//2//4
#define LCD_END_OF_FRAME_WAIT_COUNT 0
#define LCD_SYNC (FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT)
#define LCD_LCCR0 (LCCR0_LDM | LCCR0_SFM | LCCR0_IUM | LCCR0_EFM |
LCCR0_QDM | LCCR0_BM | LCCR0_OUM | LCCR0_CMS |LCCR0_ENB)
#define LCD_LCCR3 (LCCR3_PCP | LCCR3_PixClkDiv(0x1F) | LCCR3_Bpp(0x00) |
LCCR3_Acb(0xff))
#endif

static struct pxafb_rgb rgb_8 = {
// red: { offset: 0, length: 8, },
// green: { offset: 0, length: 8, },
blue: { offset: 0, length: 1, },
transp: { offset: 0, length: 0, },
};
pxafb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
u_int trans, struct fb_info *info)
{
struct pxafb_info *fbi = (struct pxafb_info *)info;
u_int val;
int ret = 1;
/*
* If greyscale is true, then we convert the RGB value
* to greyscale no mater what visual we are using.
*/
//printk(
KERN_ERR "pxafb_setcolreg______________________________\n"); /////chenlei

if (fbi->fb.var.grayscale)
{ red = green = blue = (19595 * red + 38470 * green +
7471 * blue) >> 16;
printk( KERN_ERR "pxa_grayscale\n"); }/////chenlei
//printk( "regno=: %d\n",regno); /////chenlei
switch (fbi->fb.disp->visual) {
case FB_VISUAL_TRUECOLOR:
/*
* 12 or 16-bit True Colour. We encode the RGB value
* according to the RGB bitfield information.
*/
if (regno < 16) {
u16 *pal = fbi->fb.pseudo_palette;
val = chan_to_field(red, &fbi->fb.var.red);
val |= chan_to_field(green, &fbi->fb.var.green);
val |= chan_to_field(blue, &fbi->fb.var.blue);
pal[regno] = val;
ret = 0;
}
break;
//下一行FB_VISUAL_MONO01///////////////////////
case FB_VISUAL_MONO01:
if (fbi->fb.var.bits_per_pixel == 1)
{ // 1 BIT Palette: Black = Pixel Off, Non-Black = Pixel On
val = (red+blue+green ? 0xff : 0x0 );
fbi->palette_cpu[regno] = val;
ret=0;
}
break;

static struct pxafb_info * __init pxafb_init_fbinfo(void)
{
struct pxafb_mach_info *inf;
struct pxafb_info *fbi;
fbi = kmalloc(sizeof(struct pxafb_info) + sizeof(struct display) +
sizeof(u16) * 16, GFP_KERNEL);
if (!fbi)
return NULL;
memset(fbi, 0, sizeof(struct pxafb_info) + sizeof(struct display));
fbi->currcon = -1;
strcpy(fbi->fb.fix.id, PXA_NAME);
fbi->fb.fix.type = FB_TYPE_PACKED_PIXELS;
fbi->fb.fix.type_aux = 0;
fbi->fb.fix.xpanstep = 0;
fbi->fb.fix.ypanstep = 0;
fbi->fb.fix.ywrapstep = 0;
fbi->fb.fix.accel = FB_ACCEL_NONE;
fbi->fb.var.nonstd = 0;
fbi->fb.var.activate = FB_ACTIVATE_NOW;
fbi->fb.var.height = -1;
fbi->fb.var.width = -1;
fbi->fb.var.accel_flags = 0;
fbi->fb.var.vmode = FB_VMODE_NONINTERLACED;
strcpy(fbi->fb.modename, PXA_NAME);
strcpy(fbi->fb.fontname, "Acorn8x8");
fbi->fb.fbops = &pxafb_ops;
fbi->fb.changevar = NULL;
fbi->fb.switch_con = pxafb_switch;
fbi->fb.updatevar = pxafb_updatevar;
fbi->fb.blank = pxafb_blank;
fbi->fb.flags = FBINFO_FLAG_DEFAULT;
fbi->fb.node = -1;
fbi->fb.monspecs = monspecs;
fbi->fb.disp = (struct display *)(fbi + 1);
fbi->fb.pseudo_palette = (void *)(fbi->fb.disp + 1);
fbi->rgb[RGB_8] = &rgb_8;
fbi->rgb[RGB_16] = &def_rgb_16;
inf = pxafb_get_machine_info(fbi);
fbi->max_xres = inf->xres;
fbi->fb.var.xres = inf->xres;
fbi->fb.var.xres_virtual = inf->xres;
fbi->max_yres = inf->yres;
fbi->fb.var.yres = inf->yres;
fbi->fb.var.yres_virtual = inf->yres;
fbi->max_bpp = inf->bpp;
fbi->fb.var.bits_per_pixel = inf->bpp;
fbi->fb.var.pixclock = inf->pixclock;
fbi->fb.var.hsync_len = inf->hsync_len;
fbi->fb.var.left_margin = inf->left_margin;
fbi->fb.var.right_margin = inf->right_margin;
fbi->fb.var.vsync_len = inf->vsync_len;
fbi->fb.var.upper_margin = inf->upper_margin;
fbi->fb.var.lower_margin = inf->lower_margin;
fbi->fb.var.sync = inf->sync;
fbi->fb.var.grayscale = inf->cmap_greyscale;
fbi->cmap_inverse = inf->cmap_inverse;
fbi->cmap_static = inf->cmap_static;
fbi->lccr0 = inf->lccr0;
fbi->lccr3 = inf->lccr3;
fbi->state = C_DISABLE;
fbi->task_state = (u_char)-1;
fbi->fb.fix.smem_len = fbi->max_xres * fbi->max_yres *
fbi->max_bpp / 8;
init_waitqueue_head(&fbi->ctrlr_wait);
INIT_TQUEUE(&fbi->task, pxafb_task, fbi);
init_MUTEX(&fbi->ctrlr_sem);
return fbi;
}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条


小黑屋| 手机版| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-11-22 19:56 , Processed in 0.020042 second(s), 9 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表