Framebuffer驱动程序模型
来源:互联网 发布:万方数据库怎么收费 编辑:程序博客网 时间:2024/04/30 15:41
下图会向你展示目前的framebuffer设备驱动的结构,最常用的是非标准驱动。很明显他所处的层次最高,程序编写是最容易的。理解了这个图的,你已经很轻松的去完成一个fb驱动,比如给sa1100,s2410,s2440系列的ARM的LCD控制器写驱动。
在framebuffer驱动程序设计中,cmap这个东东太晕了。现在我要把他赤裸裸的剖析给大家:)
1. struct fb_cmap
|
该结构在fb.h文件中定义,在struct fb_ops结构中有两个成员函数与其相关:
|
在struct fb_info结构中有变量:
|
在fpgen基础操作下提供:
|
在文件/* drivers/video/fbcmap.c */中提供更多的cmap应用
|
2. 通过文件解析
在anakinfb.c文件中,cmap如图
在stifb.c
本文介绍的设备是位于/video目录下面的anakinfb.c驱动程序。虽然我不清楚那个设备的特性,但是从对程序的分析中我们仍然知道如何编写一个frame buffer设备驱动。
本文是个标准的fb驱动。共221行,包含函数如下:
- static int anakinfb_getcolreg(u_int regno, u_int *red, u_int *green, u_int *blue, u_int *transp, struct fb_info *info) 31行
- static int anakinfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,u_int transp, struct fb_info *info) 45行
- static int anakinfb_get_fix(struct fb_fix_screeninfo *fix, int con, struct fb_info *info) 57行
- static int anakinfb_get_var(struct fb_var_screeninfo *var, int con, struct fb_info *info) 75行
- static int anakinfb_set_var(struct fb_var_screeninfo *var, int con, struct fb_info *info) 111行
- static int anakinfb_get_cmap(struct fb_cmap *cmap, int kspc, int con, struct fb_info *info) 117行
- static int anakinfb_set_cmap(struct fb_cmap *cmap, int kspc, int con, struct fb_info *info) 130行
- static int anakinfb_switch_con(int con, struct fb_info *info) 147行
- static int anakinfb_updatevar(int con, struct fb_info *info) 155行
- static void anakinfb_blank(int blank, struct fb_info *info) 161行
- int __init anakinfb_init(void) 178行
很奇怪,对fb设备的读写函数怎么没有!值得说明的是open,release,read,write,ioctl,mmap等函数的实现是由 fbmem.c文件实现了。也就是说所有的fb设备在给定了fb_info后,所有的操作都是一样的。在明确的fb_info前提下,fbmem.c中的函数可以工作的很好。这样大家应该感到非常轻松了吧,只要完成上述的几个设备相关的函数,frame buffer设备的驱动就写完了:)
系统的结构如图:
Stifb驱动模型
linux/drivers/video/stifb.c - Generic frame buffer driver for HP * workstations with STI (standard text interface) video firmware.
这个驱动程序和前面的anakin设备完全不同,因为他不是采用标准的格式,而是根据 based on skeletonfb, which wasCreated 28 Dec 1997 by Geert Uytterhoeven也就是skeletonfb.c提供的框架完成的。
共230行,包含函数如下:
static int sti_encode_fix(struct fb_fix_screeninfo *fix, const void *par, struct fb_info_gen *info) 60行
static int sti_decode_var(const struct fb_var_screeninfo *var,void *par, struct fb_info_gen *info) 71行
static int sti_encode_var(struct fb_var_screeninfo *var, const void *par, struct fb_info_gen *info) 78行
static void sti_get_par(void *par, struct fb_info_gen *info) 94行
static void sti_set_par(const void *par, struct fb_info_gen *info) 99行
static int sti_getcolreg(unsigned regno, unsigned *red, unsigned *green, unsigned *blue, unsigned *transp, struct fb_info *info) 104行
static int sti_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *info) 111行
static void sti_set_disp(const void *par, struct display *disp, struct fb_info_gen *info) 118行
static void sti_detect(void) 127行
static int sti_blank(int blank_mode, const struct fb_info *info) 132行
int __init stifb_init(void) 161行
void stifb_cleanup(struct fb_info *info) 201行
int __init stifb_setup(char *options) 208行
- Framebuffer驱动程序模型
- omap 的framebuffer驱动程序
- FrameBuffer驱动程序分析
- FrameBuffer驱动程序分析
- <转>Framebuffer device驱动程序
- Framebuffer device驱动程序
- Linux下的帧缓冲lcd应用编程及Framebuffer驱动程序模型
- Linux下的帧缓冲lcd应用编程及Framebuffer驱动程序模型
- Framebuffer驱动程序框架 skeletonfb.c 分析
- Framebuffer驱动程序框架 skeletonfb.c 分析
- Linux驱动模型 - 驱动程序
- Linux设备驱动程序模型
- LCD驱动程序分析---基于framebuffer
- FrameBuffer
- FrameBuffer
- FrameBuffer
- Framebuffer
- framebuffer
- apache+Tomcat负载平衡设置详解
- GLIBC 版本
- SQl查询数据库表名、表的列名
- Struts+spring+hibernate的笔记.
- 主题:把.NET程序部署到没有安装.NET Framwork的机器上(JavaEye)
- Framebuffer驱动程序模型
- 非常好的资源分享地址
- microwindows位图解析
- 为Nagios编写自己的插件
- Big-Endian 和 Little-Endian 字节排序
- 脱离.Net Framework运行doNet程序的简单方法(Console)
- 关于loose.dtd和xhtml1-transitional.dtd等文档类型定义模型中CSS失效的解决办法
- centos
- c语言中处理汉字问题