Return to Training Programs

ADVANCED TRAINING & RESEARCH LABS

Course-Number: ATR-002

Course-Description: Linux Device Drivers

Duration of course: 3 days


Course Description:

This course teaches how to write device drivers for the Linux Operating System. It dwells at length on how devices interact with the Operating System and how System Calls act as a layer of abstraction and protection between devices and end-users.

The course covers Loadable Kernel Modules, Kernel Programming Mechanisms, The Serial and Parallel Port Interfaces, Character Device Drivers, Block Device Drivers and the PCI Bus.

The course covers writing Loadable Kernel Modules in detail since this is necessary to write Kernel Extensions. Starting from basic concepts like writing/compiling LKMs to passing arguments to LKMs and exporting/suppressing-the-export of symbols into the Kernel Symbol tree, it then goes on into advanced concepts like writing stackable modules, Inter-Module communication mechanisms and writing modules to support Kernel Versioning.

The course covers Kernel Programming Mechanisms like Kernel Timers, Wait-queues, Task-Queues, writing Interrupt Service Routines using Tasklets etc. It covers core concepts like managing deadlock resolutions using kernel semaphores, circular buffers and bit operations. It also looks at Symmetric Multi-processing architectures and the usage of spin-locks to handle access to critical regions.

The course then looks at Character Device Drivers, the major and minor numbers as an entry point from the user’s code, the VFS and its role in standard access to driver methods, system calls and how they invoke the respective driver methods and a detailed treatment of ioctls, macros used to encode and decode ioctls and other advanced issues in character devices such as multi-user concurrency, kernel semaphores, single-open devices, Blocking and Non-blocking I/O etc. Character devices are taught with respect to RAM disks as an example and also using simple LED boards driven through the parallel port.

The course covers the Peripheral Component Interconnect ( PCI ) bus and its architecture and how device drivers are written for PCI bus devices.

The course also covers USB interfacing mechanisms. The protocol is briefly covered and an example is shown on how to interface a simple USB device to a linux kernel.

The course finally gives an overview of Network drivers and their interfacing.

Target Audience:

The course is ideal for Systems Software programmers and device driver writers migrating from other platforms onto Linux. The course will also be appreciated by Application Programmers and Systems Administrators having a good knowledge of ‘C’ programming, who wish to know more about how things work "under the hood".

Pre-requisites:

Completion of course ATR-001 ( Linux Kernel Internals ) is a must for doing this course. Alternatively, it is expected that the participants have some working knowledge of the kernel and its programming APIs.


Day

Topic

Duration

Contents

1

Introduction

1.5 hrs

Driver Interfacing mechanisms, kernel support for drivers, architecture


Kernel Loadable Modules

1.5 hrs

Writing LKMs, passing arguments, exporting symbols, suppressing the export of symbols, module cascading, Inter-module communication, versioning support.


Interrupts and Interrupt Service Routines

1.5 hrs

Interrupt strategies, writing fast interrupt handlers, shared interrupts, tasklets, methods of avoiding deadlocks – circular buffers, bitops.


Device Management & Interfacing

1.5 hrs

I/O ports, memory mapped devices, DMA, PICs, Overview of peripheral buses.





2

Character Device Drivers

1.5 hrs

Major number, minor number, link between file system and driver methods written as LKMs, registering driver methods, unregistering, requesting resources from the kernel etc.


Advanced concepts in Character Devices

1.5 hrs

Single Device, Single User, Blocking and Non-blocking I/O, Concurrency Control, IOCTL calls and related macros.


PCI Bus Interfacing

1.5 hrs

Bus architectures, ISA and PCI. The PCI 2.2 standards, lspci and setpci.
PCI related API, accessing the configuration space, requesting I/O or memory, converting physical address to a kernel logical address etc.


USB Interfacing

1.5 hrs

Protocol, kernel interfacing mechanisms, example driver.





3

Network Drivers

1.5 hrs

Kernel data structures, algorithms, registering & unregistering, device initialization, transmission/reception of a packet.


Kernel Interfacing

1.5 hrs

proc fs interface, Magic SysRq interface, ioctl calls.


Advanced kernel debugging

1.5 hrs

kdb - The linux kernel debugger.


Miscellaneous

1.5 hrs

Open house. Other topics not covered in above.


(C) 2005 -  www.atr-labs.com   All Rights Reserved.

Return to Training Programs