|
目前正在学习Linux嵌入开发 芯片是at91sam9260 屏是:黑白屏160*160 UC1698控制器,与芯片的接口是:i80接口,驱动想写成framebuffer形式的怎么处理?
/* 1. 分配一个fb_info */
at91_lcd = framebuffer_alloc(0, NULL);
/* 2. 设置 */
/* 2.1 设置固定的参数 */
strcpy(at91_lcd->fix.id, "mylcd");
at91_lcd->fix.smem_len = 160*160/8;
at91_lcd->fix.type = FB_TYPE_PACKED_PIXELS;
at91_lcd->fix.visual = FB_VISUAL_MONO01; /* TFT */
at91_lcd->fix.line_length = 160/8;
/* 2.2 设置可变的参数 */
at91_lcd->var.xres = 160;
at91_lcd->var.yres = 160;
at91_lcd->var.xres_virtual = 160;
at91_lcd->var.yres_virtual = 160;
at91_lcd->var.bits_per_pixel = 1;
/* RGB:565 */
// at91_lcd->var.red.offset = 11;
// at91_lcd->var.red.length = 5;
// at91_lcd->var.green.offset = 5;
// at91_lcd->var.green.length = 6;
// at91_lcd->var.blue.offset = 0;
// at91_lcd->var.blue.length = 5;
at91_lcd->var.activate = FB_ACTIVATE_NOW;
/* 2.3 设置操作函数 */
at91_lcd->fbops = &at91_lcdfb_ops;
/* 2.4 其他的设置 */
at91_lcd->screen_size = 160*160/8;
at91_lcd->screen_base = dma_alloc_writecombine(NULL, at91_lcd->fix.smem_len, (dma_addr_t *)&at91_lcd->fix.smem_start, GFP_KERNEL);
static struct fb_ops at91_lcdfb_ops = {
.owner = THIS_MODULE,
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
};
驱动是装载没有问题 cat abc > /dev/fb0屏幕上也可以显示几个点,但是cat abc > /dev/tty1 屏幕却没有显示
之后我又自己重新编写:
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
这三个函数但是屏幕依旧没有反应
怎么才能让framebuffer和tty1关联起来啊,谢谢! |
阿莫论坛20周年了!感谢大家的支持与爱护!!
该献的血还是要献的。你不献他不献。难道让我去献? --- 出自坛友:lovejp1981
|