Embedded I/O Management

5,834 views

Published on

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
5,834
On SlideShare
0
From Embeds
0
Number of Embeds
2,639
Actions
Shares
0
Downloads
0
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Embedded I/O Management

  1. 1. Embedded I/O Management © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> All Rights Reserved.
  2. 2. What to Expect? Basic I/O Management Support Advanced I/O Management Video Subsystem Audio Subsystem © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 2 All Rights Reserved.
  3. 3. I/O Management Overview Linux provides a uniform i/f to on-board I/O Devices Categorized as follows Link oriented (Network Devices) Block oriented (Storage Device) All Other (Sequential) Devices Sequential Device or Character Device category is one of the largest, with majority of Devices falling under this So, based on the specialized functions, this have been further categorized Basic I/O (GPIOs, and all that uses plain character drivers) Custom I/O (tty, audio, video, ..) © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 3 All Rights Reserved.
  4. 4. Basic I/O Management Device Category Domain-specific Electronics Actuators, Sensors, … General Purpose I/O A2D, D2A, ... Driver Type: Character © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 4 All Rights Reserved.
  5. 5. Bus I/O Management Device Category: I2C, SPI, … Driver Category: Character with Platform Porting mostly involves Respective bus controller code (driver) to be enabled in the kernel © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 5 All Rights Reserved.
  6. 6. Custom I/O Management Topics under Consideration Video Audio © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 6 All Rights Reserved.
  7. 7. Video Drivers © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 7 All Rights Reserved.
  8. 8. Video Subsystem FB-aware applications Such as video players Console setterm UM X Windows fbset Driver User Space Virtual Terminal lpcons usb_uart Driver fbcon .. vgacon Common Frame Buffer API over /dev/fbX Frame Buffer Driver Kernel Space Hardware Space Video Card X VGA Card Printer USB UART © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 8 All Rights Reserved.
  9. 9. FB Programming Interface Header: <linux/fb.h> Data Structures struct fb_info – Main data structure struct fb_ops – Entry points struct fb_var_screen_info – Resolution, ... struct fb_fix_screen_info – FB start addr, ... struct fb_cmap – RGB colour map APIs int register_framebuffer(struct fb_info *fb_info); int unregister_framebuffer(struct fb_info *fb_info); struct fb_info *framebuffer_alloc(size_t size, struct device *dev); void framebuffer_release(struct fb_info *info); int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp); void fb_dealloc_cmap(struct fb_cmap *cmap); Source: drivers/video/ © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 9 All Rights Reserved.
  10. 10. struct fb_ops fb_open – Open fb_release – Close fb_check_var – Check video parameters fb_set_par – Set video controller registers fb_setcolreg – Create pseudo colour palette map fb_blank – Blank / Unblank display fb_fillrect – Fill rectangle with pixel lines fb_copyarea – Copy rectangular area between screens fb_imageblit – Draw an image to the display fb_rotate – Rotate the display fb_ioctl – Ioctl interface for device specific commands © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 10 All Rights Reserved.
  11. 11. Console Programming Interface Header: <linux/console.h> Data Structures struct console – top-level console driver struct consw – bottom-level console driver APIs void register_console(struct console *); int unregister_console(struct console *); int register_con_driver(const struct consw *csw, int first, int last); int unregister_con_driver(const struct consw *csw); © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 11 All Rights Reserved.
  12. 12. Porting a Video Driver Standard Video Chipset Mostly involves changing pin assignments as per the Board Design New Video Chipset Complete Driver as per the preceeding discussions, need to be implemented © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 12 All Rights Reserved.
  13. 13. Browse some Video Drivers For Frame Buffer drivers Browse the drivers/video/ folder For Console drivers Browse the drivers/video/console/ folder © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 13 All Rights Reserved.
  14. 14. Audio Drivers © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 14 All Rights Reserved.
  15. 15. Audio Subsystem ALSA conforming Apps User Space OSS conforming Apps (aplay, arecord, mplayer, ...) (rawplay, rawrec, ...) /dev/snd/pcm*, ... /proc/asound /dev/dsp, /dev/adsp, /dev/snd/controlC0, /sys/class/sound /dev/mixer, /dev/audio /dev/snd/timer OSS Emulation Layer (snd_pcm_oss, snd_mixer_oss) Sound Core Audio Controller Audio Codec Driver Driver Kernel Space Hardware Space MIC Audio Controller Audio Codec Speaker © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 15 All Rights Reserved.
  16. 16. ALSA Sound Card Interface Header: <linux/sound/core.h> Data Structure: struct snd_card APIs int snd_card_create(int idx, const char *id, struct module *module, int extra_size, struct snd_card **card_ret); int snd_card_free(struct snd_card *card); int snd_card_register(struct snd_card *card); © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 16 All Rights Reserved.
  17. 17. ALSA PCM Interface Header: <linux/sound/pcm.h> Data Structure struct snd_pcm struct snd_pcm_ops APIs int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size); int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream); int snd_pcm_new(struct snd_card *card, const char *id, int device, int playback_count, int capture_count, struct snd_pcm **rpcm); void snd_pcm_set_ops(struct snd_pcm * pcm, int direction, struct snd_pcm_ops *ops); © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 17 All Rights Reserved.
  18. 18. ALSA Sound Card Interface Header: <linux/sound/control.h> Data Structure: struct snd_kcontrol_new APIs int snd_ctl_add(struct snd_card * card, struct snd_kcontrol * kcontrol); int snd_ctl_remove(struct snd_card * card, struct snd_kcontrol * kcontrol); © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 18 All Rights Reserved.
  19. 19. Porting a Audio Driver Standard Audio Codec Mostly involves changing pin assignments as per the Board Design New Audio Codec Complete Driver as per the preceeding discussions, need to be implemented © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 19 All Rights Reserved.
  20. 20. Browse some Audio Drivers For ALSA drivers Browse the sound/ folder Say sound/arm/aaci.* © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 20 All Rights Reserved.
  21. 21. What all have we learnt? Basic I/O Management Support Advanced I/O Management Video Subsystem Frame Buffer Programming Interface Console Programming Interface Porting Audio Subsystem ALSA Programming Interface Porting © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 21 All Rights Reserved.
  22. 22. Any Queries? © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 22 All Rights Reserved.

×