Understanding Embedded Linux Device Drivers for ARM Architecture

Slide Note
Embed
Share

Explore the intricate world of Linux device drivers with a focus on ARM architecture. Delve into topics like character device drivers, memory and I/O access, block device drivers, and various other driver types. Gain insights into the principles and workings of LCD drivers, IIC drivers, network drivers, and more, in this comprehensive study of Embedded Linux.


Uploaded on Oct 04, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. Review - IV Embedded Linux - I 1 Linux Device Driver: 1 Char Device Driver 2 Memory and I/O Access 3 Engineering Device Driver ARM201819 2024/10/4

  2. IV Embedded Linux - J 2 ARM201819 2024/10/4

  3. Linux Device Driver 3 4 Block device driver 5 Terminate device driver 6 IIC device driver 7 Network device driver 8 Audio device driver 9 LCD device driver 10 Flash device driver 11 USB device driver 12 PCI device driver 13 Linux device driver debug 14 Linux device driver translate ARM201819 2024/10/4

  4. 4 Block device driver 4 ARM201819 2024/10/4

  5. 5 Terminate device driver 5 ARM201819 2024/10/4

  6. 6 IIC device driver 6 ARM201819 2024/10/4

  7. 7 Network device driver 7 ARM201819 2024/10/4

  8. 8 Audio device driver 8 ARM201819 2024/10/4

  9. 9 LCD device driver 9 9.1 LCD hardware principles 9.2 framebuffer principles 9.3 framebuffer driver architeture 9.4 framebuffer driver templates 9.5 framebuffer buffer request 9.6 framebuffer parameter setting 9.7 framebuffer fb_ops functions 9.8 framebuffer fb_fops functions 9.9 framebuffer user space access 9.10 Linux graphical user interface 9.11 Exynos LCD device driver 9.12 summary ARM201819 2024/10/4

  10. 9.1 LCD hardware principles 10 LCD work timing LCD timing parameters ARM201819 2024/10/4

  11. LCD work timing 11 ARM201819 2024/10/4

  12. VSPW (vertical sync pulse width) VBPD (vertical back porch delay) VFPD (vertical front porch delay) HSPW (horizontal sync pulse width) HBPD (horizontal back porch delay) HFPD (horizontal front porch delay) ARM201819 2024/10/4 12

  13. LCD timing parameters 13 VSPW+1 VBPD+1 LINEVAL+1 HSPW+1 HBPD+1 HFPD+1 HOZVAL+1 VFPD+1 ARM201819 2024/10/4

  14. 9.2 framebuffer principles 14 9.2.1 framebuffer basic concept 9.2.2 framebuffer data format 9.2.3 framebuffer structures and functions ARM201819 2024/10/4

  15. 9.2.1 framebuffer basic concept 15 Framebuffer Display device interface, abstract of display buffer Apps directly access, don t care low-level hardware /dev/fbn, char device, major device number is 29 X Windows and Qt are both based on framebuffer ARM201819 2024/10/4

  16. 9.2.2 framebuffer data format 16 16 BPP: RGB 565 18 BPP: RGB666 24 BPP: RGB 888 See Exynos4412 SoC user manual ARM201819 2024/10/4

  17. 9.2.3 framebuffer structures and functions 17 fb_info fb_ops fb_var|fix_screeninfo fb_bitfield fb_cmap fb_fops {un}register_framebuffer() ARM201819 2024/10/4

  18. (1) fb_info 18 The most important structure of framebuffer Description of device property and operations Abbreviated as FBI (Federal Bureau of Investigation) ARM201819 2024/10/4

  19. fb_info 19 Variable parameters Fixed parameters Current color map Framebuffer operations Screen base address ARM201819 2024/10/4

  20. struct fb_info 20 struct fb_info { int node; int flags; struct fb_var_screeninfo var; //variable struct fb_fix_screeninfo fix; //fixed struct fb_monspecs monspecs; struct work_struct queue; ARM201819 2024/10/4

  21. struct fb_info 21 struct fb_pixmap pixmap; struct fb_pixmap sprite; struct fb_cmap cmap; //color map struct list_head modelist; struct fb_videomode *mode; ARM201819 2024/10/4

  22. struct fb_info 22 struct backlight_device *bl_dev; struct mutex bl_curve_mutex; u8 bl_curve[FB_BACKLIGHT_LEVELS]; struct delayed_work deferred_work; struct fb_deferred_io *fbdefio; ARM201819 2024/10/4

  23. struct fb_info 23 struct fb_ops *fbops; // = &exynosfb_ops struct device *device; struct device *dev; int class_flag; ARM201819 2024/10/4

  24. struct fb_info 24 struct fb_tile_ops *tileops; char __iomem *screen_base; //virtual address unsigned long screen_size; void *pseudo_palette; ARM201819 2024/10/4

  25. struct fb_info 25 #define FBINFO_STATE_RUNNING 0 #define FBINFO_STATE_SUSPENDED 1 u32 state; void *fbcon_par; void *par; // -> struct s3cfb_info }; ARM201819 2024/10/4

  26. (2) fb_ops 26 Maintain low level pointers of operation functions Need driver developer to implement it ARM201819 2024/10/4

  27. fb_ops 27 Open and release Display blank Rectangle filling Data copy Graphical filling Cursor drawing Display rotation ARM201819 2024/10/4

  28. fb_ops 28 fb_check_var() Check variable screen parameters and adjust them to suitable values fb_set_var() Make screen parameters, set by user, effective in hardware ARM201819 2024/10/4

  29. struct fb_ops 29 struct fb_ops { // open/release and usage marking struct module *owner; int (*fb_open)(*info, int user); int (*fb_release)(*info, int user); ARM201819 2024/10/4

  30. struct fb_ops 30 // get non settable parameters int (*fb_get_fix)(*fix, int con, *info); // get settable parameters int (*fb_get_var)(*var, int con, *info); // set settable parameters int (*fb_set_var)(*var, int con, *info); ARM201819 2024/10/4

  31. struct fb_ops 31 // get colormap int (*fb_get_cmap)(*cmap, kspc, con, *info); // set colormap int (*fb_set_cmap)(*cmap, kspc, con, *info); // pan display (optional) int (*fb_pan_display)(*var, int con, *info); ARM201819 2024/10/4

  32. struct fb_ops 32 // perform fb specific ioctl (optional) int (*fb_ioctl)(*inode,*file,cmd,ag,cn,*info); // perform fb specific mmap int (*fb_mmap)(*info, *file, *vma); // switch to/from raster image mode int (*fb_rasterimg)(*info, int start); }; ARM201819 2024/10/4

  33. (3) fb_var|fix_screeninfo 33 fb_var_screeninfo Display controller parameters which can be changed by user fb_fix_screeninfo Display controller parameters which cannot be changed by user ARM201819 2024/10/4

  34. fb_var_screeninfo 34 Visuable resolution xres, yres Bit per pixel bits_per_pixel Pixel data format red/green/blue Timing parameters Sync pulse width: hsync/vsync_len Margin: left/right/upper/lower_margin Pixel clock: pixclock ARM201819 2024/10/4

  35. struct fb_var_screeninfo 35 struct fb_var_screeninfo { __u32 xres; // visible resolution __u32 yres; // visible resolution __u32 xres_virtual; // virtual resolution __u32 yres_virtual; __u32 xoffset; // offset from virtual to visible __u32 yoffset; ARM201819 2024/10/4

  36. struct fb_var_screeninfo 36 __u32 bits_per_pixel; __u32 grayscale; struct fb_bitfield red; struct fb_bitfield green; struct fb_bitfield blue; struct fb_bitfield transp; // transparency __u32 nonstd; ARM201819 2024/10/4

  37. struct fb_var_screeninfo 37 __u32 activate; // see FB_ACTIVATE_* __u32 height; // height of picture in mm __u32 width; // width of picture in mm __u32 accel_flags; // acceleration flags ARM201819 2024/10/4

  38. struct fb_var_screeninfo 38 __u32 pixclock;//pixel clock in ps __u32 left_margin;//time from sync to pic __u32 right_margin;//time from pic to sync __u32 upper_margin;//time from sync to pic __u32 lower_margin;//time from pic to sync __u32 hsync_len;//length of horizontal sync __u32 vsync_len;//length of vertical sync ARM201819 2024/10/4

  39. VSPW+1 (vsync_len) VBPD+1 (upper_margin) LINEVAL+1 (yres) HSPW+1 (hsync_len) HBPD+1 (left_margin) HFPD+1 (right_margin) HOZVAL+1 (xres) VFPD+1 (lower_margin) ARM201819 2024/10/4 39

  40. struct fb_var_screeninfo 40 __u32 sync; // see FB_SYNC_* __u32 vmode; // see FB_VMODE_* __u32 rotate; // clockwise rotation angle __u32 reserved[6]; // Reserved for future }; ARM201819 2024/10/4

  41. fb_fix_screeninfo 41 Starting physical address of framebuffer smem_start (physical address) Framebuffer size smem_len Starting virtual address of I/O memory mmio_start (virtual address) Size of I/O memory mapped by framebuffer mmio_len ARM201819 2024/10/4

  42. struct fb_fix_screeninfo 42 struct fb_fix_screeninfo { char id[16]; // identification string ulong smem_start; // phys start addr of fb mem __u32 smem_len; // length of fb mem __u32 type; // see FB_TYPE_* __u32 type_aux; // interleave for planes __u32 visual; // see FB_VISUAL_* ARM201819 2024/10/4

  43. struct fb_fix_screeninfo 43 __u16 xpanstep; // zero if no hw panning __u16 ypanstep; // zero if no hw panning __u16 ywrapstep; // zero if no hw ywrap __u32 line_length; // length of a line in bytes ARM201819 2024/10/4

  44. struct fb_fix_screeninfo 44 ulong mmio_start; // virt start addr of Memory I/O __u32 mmio_len; // length of Memory I/O __u32 accel; // type of acceleration __u16 reserved[3]; // reserved for future }; ARM201819 2024/10/4

  45. (4) fb_bitfield 45 Describe organization method of each pixel of display buffer ARM201819 2024/10/4

  46. struct fb_bitfield 46 struct fb_bitfield { __u32 offset; // beginning of bitfield __u32 length; // length of bitfield __u32 msb_right; // != 0 : MSB is right }; ARM201819 2024/10/4

  47. (5) fb_cmap 47 Record device-independent color map ARM201819 2024/10/4

  48. struct fbcmap 48 struct fb_cmap { __u32 start; // first entry __u32 len; // number of entries __u16 *red; // red values __u16 *green; // green values __u16 *blue; // blue values __u16 *transp; // transparency }; ARM201819 2024/10/4

  49. (6) fb_fops 49 File operation structure, discriminated from fb_ops Located in drivers/video/fbmem.c Interface function is device-independent Interface function is existed, no need to rewrite ARM201819 2024/10/4

  50. struct file_operations fb_fops 50 static const struct file_operations fb_fops = { .owner = THIS_MODULE, .read = fb_read, .write = fb_write, .ioctl = fb_ioctl, .compat_ioctl = fb_compat_ioctl, ARM201819 2024/10/4

Related


More Related Content