S3C2410 framebuffer 设备驱动 相关结构体


  1. include/linux/fb.h  
  2.   
  3. struct fb_info {  
  4.     int node;           /* node成员域标示了特定的FrameBuffer, 
  5.                      * 实际上也就是一个FrameBuffer设备的次设备号  
  6.                     */  
  7.     int flags;  
  8.     struct fb_var_screeninfo var;       /* LCD可变参数结构体 */  
  9.     struct fb_fix_screeninfo fix;       /* LCD固定参数结构体 */  
  10.     struct fb_monspecs monspecs;    /* LCD显示器标准 */  
  11.     struct work_struct queue;       /* 帧缓冲事件队列 */  
  12.     struct fb_pixmap pixmap;        /* 图像硬件mapper(Image hardware mapper) */  
  13.     struct fb_pixmap sprite;            /* 光标硬件mapper(Cursor hardware mapper) */  
  14.     struct fb_cmap cmap;            /* 当前颜色表(Current cmap) */  
  15.     struct list_head modelist;      /* mode list */  
  16.     struct fb_videomode *mode;      /* 当前的显示模式(current mode) */  
  17.   
  18. #ifdef CONFIG_FB_BACKLIGHT      /* assigned backlight device */   
  19.   
  20.                                 /* set before framebuffer registration,  
  21.                                 *  remove after unregister 
  22.                                 */  
  23.     struct backlight_device *bl_dev;    /* 对应的背光设备 */  
  24.     struct mutex bl_curve_mutex;      
  25.     u8 bl_curve[FB_BACKLIGHT_LEVELS];   /* 背光调整(Backlight level curve) */  
  26. #endif   
  27.   
  28. #ifdef CONFIG_FB_DEFERRED_IO            /* 延迟IO */   
  29.     struct delayed_work deferred_work;  
  30.     struct fb_deferred_io *fbdefio;  
  31. #endif   
  32.   
  33.     struct fb_ops *fbops;       /* 对底层硬件操作的函数指针 */  
  34.     struct device *device;      /* This is the parent */  
  35.     struct device *dev;         /* This is this fb device */  
  36.     int class_flag;             /* private sysfs flags */  
  37.       
  38. #ifdef CONFIG_FB_TILEBLITTING   
  39.     struct fb_tile_ops *tileops;    /* Tile Blitting(blit -- Bit-Block Image Transfer) */  
  40. #endif   
  41.   
  42.     char __iomem *screen_base;  /* 虚拟基地址(Virtual address) */  
  43.     unsigned long screen_size;  /* LCD IO映射的虚拟内存大小(Amount of ioremapped VRAM or 0) */  
  44.     void *pseudo_palette;       /* 伪16色颜色表(Fake palette of 16 colors) */  
  45.       
  46. #define FBINFO_STATE_RUNNING    0   
  47. #define FBINFO_STATE_SUSPENDED  1   
  48.     u32 state;              /* LCD硬件状态,如运行和挂起(Hardware state i.e suspend) */  
  49.     void *fbcon_par;            /* fbcon use-only private area */  
  50.                             /* From here on everything is device dependent */  
  51.     void *par;  
  52.       
  53. };/* struct fb_info */  
  54.   
  55.   
  56. struct fb_var_screeninfo {  
  57.     __u32 xres;         /* 可见屏幕一行的像素点数(visible resolution) */  
  58.     __u32 yres;         /* 可见屏幕一列的像素点数 */  
  59.     __u32 xres_virtual;     /* 虚拟屏幕一行的像素点数(virtual resolution) */  
  60.     __u32 yres_virtual;     /* 虚拟屏幕一列的像素点数 */  
  61.     __u32 xoffset;          /* 虚拟到可见屏幕之间的行偏移(offset from virtual to visible) */  
  62.     __u32 yoffset;          /* 虚拟到可见屏幕之间的列偏移 */  
  63.   
  64.     __u32 bits_per_pixel;   /* 每个像素的位数即BPP */  
  65.     __u32 grayscale;        /* 非0时,指的是灰度(!= 0 Graylevels instead of colors) */  
  66.   
  67.     struct fb_bitfield red;     /* bitfield in fb mem if true color, 
  68.                             *  else only length is significant 
  69.                             */  
  70.     struct fb_bitfield green;       /* fb缓存的G位域 */  
  71.     struct fb_bitfield blue;        /* fb缓存的B位域 */  
  72.     struct fb_bitfield transp;      /* 透明度(transparency )*/   
  73.   
  74.     __u32 nonstd;               /* 非0,非标准像素格式(!= 0 Non standard pixel format) */  
  75.   
  76.     __u32 activate;         /* see FB_ACTIVATE_*    */  
  77.   
  78.     __u32 height;           /* 图像高度(height of picture in mm)*/  
  79.     __u32 width;            /* 图像宽度(width of picture in mm)*/  
  80.   
  81.     __u32 accel_flags;      /* (OBSOLETE) see fb_info.flags */  
  82.   
  83.     /* Timing: All values in pixclocks, except pixclock (of course) */  
  84.     /* 定时:除了pixclock本身外,其他的都以像素时钟为单位 */  
  85.     __u32 pixclock;     /* 像素时钟,皮秒(pixel clock in ps (pico seconds)) */  
  86.     __u32 left_margin;      /* 行切换,从同步到绘图之间的延迟(time from sync to picture)*/  
  87.     __u32 right_margin; /* 行切换,从绘图到同步之间的延迟(time from picture to sync)*/  
  88.     __u32 upper_margin; /* 帧切换,从同步到绘图之间的延迟(time from sync to picture)*/  
  89.     __u32 lower_margin; /* 帧切换,从绘图到同步之间的延迟(time from picture to sync)*/  
  90.     __u32 hsync_len;        /* 水平同步的长度(length of horizontal sync)*/  
  91.     __u32 vsync_len;        /* 垂直同步的长度(length of vertical sync)*/  
  92.     __u32 sync;         /* see FB_SYNC_*    */  
  93.     __u32 vmode;            /* see FB_VMODE_*   */  
  94.     __u32 rotate;           /* angle we rotate counter clockwise */  
  95.     __u32 reserved[5];      /* 保留(Reserved for future compatibility)*/  
  96.       
  97. };/* struct fb_var_screeninfo */  
  98.   
  99.   
  100. /* Interpretation of offset for color fields: All offsets are from the right, 
  101.  * inside a "pixel" value, which is exactly 'bits_per_pixel' wide (means: you 
  102.  * can use the offset as right argument to <<). A pixel afterwards is a bit 
  103.  * stream and is written to video memory as that unmodified. This implies 
  104.  * big-endian byte order if bits_per_pixel is greater than 8. 
  105.  */  
  106. struct fb_bitfield {  
  107.     __u32 offset;           /* beginning of bitfield    */  
  108.     __u32 length;           /* length of bitfield       */  
  109.     __u32 msb_right;        /* != 0 : Most significant bit is right */   
  110. };  
  111.   
  112.   
  113. struct fb_fix_screeninfo {  
  114.     char id[16];                /* 字符串形式的标示符(identification string eg "TT Builtin")*/  
  115.     unsigned long smem_start;   /* fb缓存的起始位置(Start of frame buffer mem)*/  
  116.                             /* (physical address) */  
  117.     __u32 smem_len;         /* fb缓存的长度(Length of frame buffer mem)*/  
  118.     __u32 type;             /* see FB_TYPE_*    */  
  119.     __u32 type_aux;         /* 分界(Interleave for interleaved Planes)*/  
  120.     __u32 visual;               /* see FB_VISUAL_*  */   
  121.     __u16 xpanstep;         /* 如果没有硬件panning,就赋值为0(zero if no hardware panning)*/  
  122.     __u16 ypanstep;         /* 如果没有硬件panning,就赋值为0(zero if no hardware panning)*/  
  123.     __u16 ywrapstep;            /* 如果没有硬件ywrap,就赋值为0(zero if no hardware ywrap)*/  
  124.     __u32 line_length;          /* 一行的字节数(length of a line in bytes)*/  
  125.     unsigned long mmio_start;   /* 内存映射IO的起始位置(Start of Memory Mapped I/O)*/  
  126.                             /* (physical address) */  
  127.     __u32 mmio_len;         /* 内存映射IO的长度(Length of Memory Mapped I/O)*/  
  128.     __u32 accel;                /* Indicate to driver which */  
  129.                             /*  specific chip/card we have */  
  130.     __u16 reserved[3];          /* Reserved for future compatibility */  
  131.       
  132. };/* struct fb_fix_screeninfo */  
  133.   
  134.   
  135. struct fb_monspecs {  
  136.     struct fb_chroma chroma;  
  137.     struct fb_videomode *modedb;    /* mode database */  
  138.     __u8  manufacturer[4];  /* Manufacturer */  
  139.     __u8  monitor[14];      /* Monitor String */  
  140.     __u8  serial_no[14];        /* Serial Number */  
  141.     __u8  ascii[14];        /* ? */  
  142.     __u32 modedb_len;   /* mode database length */  
  143.     __u32 model;            /* Monitor Model */  
  144.     __u32 serial;           /* Serial Number - Integer */  
  145.     __u32 year;         /* Year manufactured */  
  146.     __u32 week;         /* Week Manufactured */  
  147.     __u32 hfmin;            /* hfreq lower limit (Hz) */  
  148.     __u32 hfmax;            /* hfreq upper limit (Hz) */  
  149.     __u32 dclkmin;      /* pixelclock lower limit (Hz) */  
  150.     __u32 dclkmax;      /* pixelclock upper limit (Hz) */  
  151.     __u16 input;            /* display type - see FB_DISP_* */  
  152.     __u16 dpms;         /* DPMS support - see FB_DPMS_ */  
  153.     __u16 signal;           /* Signal Type - see FB_SIGNAL_* */  
  154.     __u16 vfmin;            /* vfreq lower limit (Hz) */  
  155.     __u16 vfmax;            /* vfreq upper limit (Hz) */  
  156.     __u16 gamma;        /* Gamma - in fractions of 100 */  
  157.     __u16 gtf   : 1;            /* supports GTF */  
  158.     __u16 misc;         /* Misc flags - see FB_MISC_* */  
  159.     __u8  version;          /* EDID version... */  
  160.     __u8  revision;         /* ...and revision */  
  161.     __u8  max_x;            /* Maximum horizontal size (cm) */  
  162.     __u8  max_y;            /* Maximum vertical size (cm) */  
  163.       
  164. };/* struct fb_monspecs */  
  165.   
  166.   
  167. struct fb_pixmap {  
  168.     u8  *addr;      /* pointer to memory */  
  169.     u32 size;           /* size of buffer in bytes */  
  170.     u32 offset;     /* current offset to buffer */  
  171.     u32 buf_align;      /* byte alignment of each bitmap */  
  172.     u32 scan_align; /* alignment per scanline */  
  173.     u32 access_align;   /* alignment per read/write (bits)  */  
  174.     u32 flags;      /* see FB_PIXMAP_*  */  
  175.     u32 blit_x;     /* supported bit block dimensions (1-32)*/  
  176.     u32 blit_y;     /* Format: blit_x = 1 << (width - 1)    */  
  177.                     /* blit_y = 1 << (height - 1) */  
  178.                     /* if 0, will be set to 0xffffffff (all)*/  
  179.     /* access methods */  
  180.     void (*writeio)(struct fb_info *info, void __iomem *dst, void *src, unsigned int size);  
  181.     void (*readio) (struct fb_info *info, void *dst, void __iomem *src, unsigned int size);  
  182.       
  183. };/* struct fb_pixmap */  
  184.   
  185.   
  186. struct fb_cmap {  
  187.     __u32 start;            /* First entry  */  
  188.     __u32 len;          /* Number of entries */  
  189.     __u16 *red;         /* Red values   */  
  190.     __u16 *green;  
  191.     __u16 *blue;  
  192.     __u16 *transp;          /* transparency, can be NULL */  
  193. };  
  194.   
  195.   
  196. struct fb_videomode {  
  197.     const char *name;       /* optional */  
  198.     u32 refresh;            /* optional */  
  199.     u32 xres;  
  200.     u32 yres;  
  201.     u32 pixclock;  
  202.     u32 left_margin;  
  203.     u32 right_margin;  
  204.     u32 upper_margin;  
  205.     u32 lower_margin;  
  206.     u32 hsync_len;  
  207.     u32 vsync_len;  
  208.     u32 sync;  
  209.     u32 vmode;  
  210.     u32 flag;  
  211. };  
  212.   
  213.   
  214. struct backlight_device {  
  215.     /* Backlight properties */  
  216.     struct backlight_properties props;  
  217.   
  218.     /* Serialise access to update_status method */  
  219.     struct mutex update_lock;  
  220.   
  221.     /* This protects the 'ops' field. If 'ops' is NULL, the driver that 
  222.        registered this device has been unloaded, and if class_get_devdata() 
  223.        points to something in the body of that driver, it is also invalid. */  
  224.     struct mutex ops_lock;  
  225.     struct backlight_ops *ops;  
  226.   
  227.     /* The framebuffer notifier block */  
  228.     struct notifier_block fb_notif;  
  229.     struct device dev;  
  230. };  
  231.   
  232.   
  233. struct mutex {  
  234.     /* 1: unlocked, 0: locked, negative: locked, possible waiters */  
  235.     atomic_t        count;  
  236.     spinlock_t      wait_lock;  
  237.     struct list_head    wait_list;  
  238.       
  239. #ifdef CONFIG_DEBUG_MUTEXES   
  240.     struct thread_info  *owner;  
  241.     const char      *name;  
  242.     void            *magic;  
  243. #endif   
  244.   
  245. #ifdef CONFIG_DEBUG_LOCK_ALLOC   
  246.     struct lockdep_map  dep_map;  
  247. #endif   
  248. };  
  249.   
  250.   
  251. /* 
  252.  * Frame buffer operations 
  253.  * 
  254.  * LOCKING NOTE: those functions must _ALL_ be called with the console 
  255.  * semaphore held, this is the only suitable locking mechanism we have 
  256.  * in 2.6. Some may be called at interrupt time at this point though. 
  257.  */  
  258. struct fb_ops {  
  259.     /* open/release and usage marking */  
  260.     struct module *owner;  
  261.     int (*fb_open)(struct fb_info *info, int user);  
  262.     int (*fb_release)(struct fb_info *info, int user);  
  263.   
  264.     /* For framebuffers with strange non linear layouts(布局,结构) or that do not 
  265.      * work with normal memory mapped access 
  266.      */  
  267.     ssize_t (*fb_read)(struct fb_info *info, char __user *buf, size_t count, loff_t *ppos);  
  268.     ssize_t (*fb_write)(struct fb_info *info, const char __user *buf, size_t count, loff_t *ppos);  
  269.   
  270.     /* checks var and eventually tweaks(调整) it to something supported, 
  271.      * DO NOT MODIFY PAR */  
  272.     int (*fb_check_var)(struct fb_var_screeninfo *var, struct fb_info *info);  
  273.   
  274.     /* set the video mode according to info->var */  
  275.     int (*fb_set_par)(struct fb_info *info);  
  276.   
  277.     /* set color register */  
  278.     int (*fb_setcolreg)(unsigned regno, unsigned red, unsigned green,  
  279.                 unsigned blue, unsigned transp, struct fb_info *info);  
  280.   
  281.     /* set color registers in batch(批量) */  
  282.     int (*fb_setcmap)(struct fb_cmap *cmap, struct fb_info *info);  
  283.   
  284.     /* blank display */  
  285.     int (*fb_blank)(int blank, struct fb_info *info);  
  286.   
  287.     /* pan display */  
  288.     int (*fb_pan_display)(struct fb_var_screeninfo *var, struct fb_info *info);  
  289.   
  290.     /* Draws a rectangle */  
  291.     void (*fb_fillrect) (struct fb_info *info, const struct fb_fillrect *rect);  
  292.     /* Copy data from area to another */  
  293.     void (*fb_copyarea) (struct fb_info *info, const struct fb_copyarea *region);  
  294.     /* Draws a image to the display */  
  295.     void (*fb_imageblit) (struct fb_info *info, const struct fb_image *image);  
  296.   
  297.     /* Draws cursor */  
  298.     int (*fb_cursor) (struct fb_info *info, struct fb_cursor *cursor);  
  299.   
  300.     /* Rotates the display */  
  301.     void (*fb_rotate)(struct fb_info *info, int angle);  
  302.   
  303.     /* wait for blit(位块传送) idle, optional */  
  304.     int (*fb_sync)(struct fb_info *info);  
  305.   
  306.     /* perform fb specific ioctl (optional) */  
  307.     int (*fb_ioctl)(struct fb_info *info, unsigned int cmd,  
  308.             unsigned long arg);  
  309.   
  310.     /* Handle 32bit compat(兼容) ioctl (optional) */  
  311.     int (*fb_compat_ioctl)(struct fb_info *info, unsigned cmd,  
  312.             unsigned long arg);  
  313.   
  314.     /* perform fb specific mmap */  
  315.     int (*fb_mmap)(struct fb_info *info, struct vm_area_struct *vma);  
  316.   
  317.     /* save current hardware state */  
  318.     void (*fb_save_state)(struct fb_info *info);  
  319.   
  320.     /* restore saved state */  
  321.     void (*fb_restore_state)(struct fb_info *info);  
  322.   
  323.     /* get capability given var */  
  324.     void (*fb_get_caps)(struct fb_info *info, struct fb_blit_caps *caps,  
  325.                 struct fb_var_screeninfo *var);  
  326.                   
  327. };/* struct fb_ops */  
  • 1
  • 2
  • 下一页

相关内容