1. 怎么编写字符设备驱动程序
主设备号
构造 file_operations 结构体,填充 open/read/write 等成员函数
注册驱动:register_chrdev(major, name, &fops)
入口函数
出口函数
2. Framebuffer 驱动程序框架
分为上下两层:
fbmem.c:承上启下
实现、注册 file_operations 结构体
把 APP 的调用向下转发到具体的硬件驱动程序
xxx_fb.c:硬件相关的驱动程序
实现、注册 fb_info 结构体
实现硬件操作
调用关系:
例子1:
app:open("/dev/fb0",...)主设备号:29,次设备号:0
--------------------------------------------------------------
kernel:
fb_open
intfbidx=iminor(inode);
structfb_info*info==registered_fb[0];
例子2:
app:read()
---------------------------------------------------------------
kernel:
fb_read
intfbidx=iminor(inode);
structfb_info*info=registered_fb[fbidx];
if(info->fbops->fb_read)
returninfo->fbops->fb_read(info,buf,count,ppos);
src=(u32__iomem*)(info->screen_base+p);
dst=buffer;
*dst++=fb_readl(src++);
copy_to_user(buf,buffer,c)
3. 怎么编写Framebuffer驱动程序
核心结构体:
分配 fb_info
framebuffer_alloc
设置 fb_info
var
fbops
硬件相关操作
注册 fb_info
register_framebuffer
4. 阅读源码
http://aospxref.com/
审核编辑 黄宇
-
框架
+关注
关注
0文章
403浏览量
17476 -
驱动程序
+关注
关注
19文章
831浏览量
48026 -
Framebuffer
+关注
关注
0文章
8浏览量
8056
发布评论请先 登录
相关推荐






如何编写RK3288 framebuffer驱动程序呢
Linux驱动程序缺陷检测研究

微软发布开源框架驱动程序模块新框架
USB串行驱动程序Usbser
Linux设备驱动程序的平台驱动程序和字符驱动程序介绍
如何使用Linux内核实现USB驱动程序框架

怎么编写Framebuffer驱动程序

评论