frameworks & framebuffer framework & framebuffer driver

版权声明:This article is a blogger original article, only for study reference, reprint please indicate the source, thank you! https://blog.csdn.net/Rong_Toa/article/details/88046745

Table of Contents

Example of frameworks

Example of the framebuffer framework

Skeleton example


Example of frameworks

Example of the framebuffer framework

  1. Kernel option CONFIG_FB
  2. Implemented in drivers/video/
  3. fb.c, fbmem.c, fbmon.c, fbcmap.c, fbsysfs.c, modedb.c, fbcvt.c
  4. Implements a single character driver (through file_operations), registers the major number and allocates minors, denes and implements the user/kernel API
  5. First part of include/linux/fb.h
  6. Denes the set of operations a framebuffer driver must implement and helper functions for the drivers
  7. struct fb_ops
  8. Second part of include/linux/fb.h
  9. Must implement some or all operations dened in struct fb_ops. Those operations are framebuffer-specic.
  10. xxx open(), xxx read(), xxx write(), xxx release(), xxx checkvar(), xxx setpar(), xxx setcolreg(), xxx blank(), xxx pan display(), xxx fillrect(), xxx copyarea(), xxx imageblit(), xxx cursor(), xxx rotate(), xxx sync(), xxx get caps(), etc.
  11. Must allocate a fb info structure with framebuffer alloc(), set the ->fbops eld to the operation structure, and register the framebuffer device with register framebuffer()

Skeleton example

static int xxx_open(struct fb_info *info, int user) {}
static int xxx_release(struct fb_info *info, int user) {}
static int xxx_check_var(struct fb_var_screeninfo *var, struct fb_info *info) {}
static int xxx_set_par(struct fb_info *info) {}
static struct fb_ops xxx_ops = {
    .owner = THIS_MODULE,
    .fb_open = xxxfb_open,
    .fb_release = xxxfb_release,
    .fb_check_var = xxxfb_check_var,
    .fb_set_par = xxxfb_set_par,
    [...]
};
init()
{
    struct fb_info *info;
    info = framebuffer_alloc(sizeof(struct xxx_par), device);
    info->fbops = &xxxfb_ops;
    [...]
    register_framebuffer(info);
}

Thomas Petazzoni
Free Electrons
[email protected]

猜你喜欢

转载自blog.csdn.net/Rong_Toa/article/details/88046745
今日推荐