KernelNewbies
  • Comments
  • Immutable Page
  • Menu
    • Navigation
    • RecentChanges
    • FindPage
    • Local Site Map
    • Help
    • HelpContents
    • HelpOnMoinWikiSyntax
    • Display
    • Attachments
    • Info
    • Raw Text
    • Print View
    • Edit
    • Load
    • Save
  • Login

Kernel Hacking

  • Frontpage

  • Kernel Hacking

  • Kernel Documentation

  • Kernel Glossary

  • FAQ

  • Found a bug?

  • Kernel Changelog

  • Upstream Merge Guide

Projects

  • KernelJanitors

  • KernelMentors

  • KernelProjects

Community

  • Why a community?

  • Regional Kernelnewbies

  • Personal Pages

  • Upcoming Events

References

  • Mailing Lists

  • Related Sites

  • Programming Links

Wiki

  • Recent Changes

  • Site Editors

  • Side Bar

  • Tips for Editors

  • Hosted by WikiWall

Navigation

  • RecentChanges
  • FindPage
  • HelpContents
Revision 28 as of 2016-02-08 09:07:18
KernelNewbies:
  • IIO_tasks

These tasks are for you to get familiar with the IIO subsystem.

Please email your solutions to daniel.baluta at intel dot com and octavian.purdila at intel dot com. Your email should have the subject Task XX: Short task description

Experimenting with IIO subsystem

For this we will use two kernel modules found in drivers/staging/iio:

  • iio_dummy_evgen.ko - generates fake events interrupts to be used by the iio_dummy example driver

    • implementation for this module is in iio_dummy_evgen.c

  • iio_dummy.ko - example IIO driver to demonstrate existing functionality

    • core implementation can be found in iio_simple_dummy.c

    • buffer functionality is implemented in iio_simple_dummy_buffer.c

    • events functionality is implemented in iio_simple_dummy_events.c

Dummy modules compilation

You need to select the following config options:

  • CONFIG_IIO_DUMMY_EVGEN - for building iio_dummy_evgen kernel module

  • CONFIG_IIO_SIMPLE_DUMMY - for building iio_dummy kernel module

    • CONFIG_IIO_SIMPLE_DUMMY_EVENTS, CONFIG_IIO_SIMPLE_DUMMY_BUFFER should be selected for events and buffer functionality.

Use the following commands for modules compilation:

  • $ make drivers/staging/iio/iio_dummy_evgen.ko

  • $ make drivers/staging/iio/iio_dummy.ko

Use the following commands for module loading:

  • $ insmod iio_dummy_evgen.ko

  • $ insmod iio_dummy.ko

Task 01:

  • Show that the modules were successfully loaded.
    • lsmod
    • ls -l /sys/bus/iio/devices/
    • ls -l /sys/bus/iio/devices/iio:device0/
    • ls -l /sys/bus/iio/devices/iio_evgen/

Task 02:

  • Add channels for a 3-axis compass to iio_simple_dummy module.
  • Show that channels were successfully added
    • ls -l /sys/bus/iio/devices/iio:device0/
    • ls -l /sys/bus/iio/devices/iio:device0/scan_elements
    • create a patch with your changes
  • Hints:

    • channel type for a compass is IIO_MAGN
    • users should be able to read raw readings from each axis
    • users should be able to read a shared scale
    • users should be able to access data via a buffer
      • data is unsigned, resolution is 16 bits, storage is 16 bits
    • compass doesn't support events

IIO event monitor

IIO event monitor is an user space example application which reads events from IIO layer and pretty prints the results. Implementation can be found in iio_event_monitor.c under tools/iio/. BR

Task 03:

Compile iio_event_monitor:

  • compile iio_event_monitor.c to obtain an executable called iio_event_monitor.

  • send us the command(s) used to successfully compile iio_event_monitor.c

Task 04:

Read events using iio_event_monitor

  • run iio_event_monitor without arguments to figure out how it should be used
  • read events from iio_dummy module
  • Hints

    • Events are generated by iio_dummy_evgen via sysfs (look inside /sys/bus/iio/devices/iio_evgen/)
  • send us the commands used to read/generate the events
  • MoinMoin Powered
  • Python Powered
  • GPL licensed
  • Valid HTML 4.01