【Linux高级驱动】LCD驱动框架分析

时间:2021-10-27 18:11:56

1.framebuffer接口层(fbmem.c)

功能:给用户提供接口

fbmem_init  ),"fb",&fb_fops)
 
 /*2.创建一个设备类*/
 fb_class = class_create(THIS_MODULE, "graphics");
static const struct file_operations fb_fops = {
 .owner = THIS_MODULE,
 .read =  fb_read,
 .write = fb_write,
 .unlocked_ioctl = fb_ioctl,
#ifdef CONFIG_COMPAT
 .compat_ioctl = fb_compat_ioctl,
#endif
 .mmap =  fb_mmap,
 .open =  fb_open,
 .release = fb_release,
#ifdef HAVE_ARCH_FB_UNMAPPED_AREA
 .get_unmapped_area = get_fb_unmapped_area,
#endif
#ifdef CONFIG_FB_DEFERRED_IO
 .fsync = fb_deferred_io_fsync,
#endif
};

2.从应用层往下分析

open

app);

ioctl

app;
       break;
     }

搜索registered_fb数组,看在哪里被设置了?

s3c_fb_probe(; win < S3C_FB_MAX_WIN; win++) {
  /*设置一个硬件窗口:一个窗口就是一个帧缓冲设备,一个帧缓冲设备用struct fb_info来描述*/
  s3c_fb_probe_win     //drivers\video\s3c-fb.c
   /*构建fb_info:表示一个帧缓冲设备*/
   
   /*设置fb_info*/
   /*设置它的可变参数*/
   /*设置它的固定参数*/
   /*设置它的操作方法*/
   /*注册一个fb_info结构体*/
   register_framebuffer(struct fb_info *fb_info)
    /*将fb_info加入数组项*/
    registered_fb[i] = fb_info;

@成鹏致远

(blogs:http://lcw.cnblogs.com

(emailwwwlllll@126.com)