LCD驱动程序
通用文件是fbmem.c
假设
app: open("/dev/fb0", ...) 主设备号: 29, 次设备号: 0
kernel:
fb_open
int fbidx = iminor(inode);
struct fb_info *info = = registered_fb[0];
app: read()
kernel:
fb_read
int fbidx = iminor(inode);
struct fb_info *info = registered_fb[fbidx];
if (info->fbops->fb_read)
return info->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)
问1. registered_fb在哪里被设置?
答1. register_framebuffer
怎么写LCD驱动程序?
1. 分配一个fb_info结构体: framebuffer_alloc
2. 设置
3. 注册: register_framebuffer
4. 硬件相关的操作