Design - Develop - Deploy

Linux Device Driver Programming

Summary

The course aims at teaching the basics of device driver programming for the Linux kernel. The course includes char driver development, PCI driver development and network driver development. The course is taught with very simple devices like the parallel port, serial port, mouse and LCD devices, so that the student can focus better on learning the kernel interface, while still programming real hardware.

Pre-requisite

  • C Programming

  • Programming in GNU/Linux

  • Microprocessors

Duration

  • Duration: 48 hours

  • Span for Weekdays: 4 weeks

  • Span for Weekends: 6 weeks

Syllabus

Introduction to Devices

  • Device Interfacing

  • Parallel Port LED Userspace Access

  • Parallel Port LCD Userspace Access

Introduction to Drivers

  • Unix/Linux Device Abstraction

  • Device Files

  • Types of Drivers

  • Mouse Device Access

  • Sound Mixer Device

  • RTC Access through /proc

  • Print Partition Table

Using Qemu and Using Kernel Modules

  • Qemu Usage

  • Disk Images

  • Host System Access

  • Device Simulation

  • Kernel Modules

  • Kernel Version Numbering

Writing Kernel Modules

  • Module Programming vs Application Programming

  • Hello World Module

    • Module Programming Basics

    • Compiling

    • Loading and Unloading

    • Module Parameters

Char Drivers

  • Major and Minor Numbers

  • Data Structures

    • File Operations Structure

    • File Structure

  • Registering Char Driver

  • Parallel Port LCD Driver

Device Model and Device Access

  • Linux Device Model

  • Bus Model

  • Writing PCI Drivers

Debugging Techniques

  • Debugging by Printing

    • Kernel Log Mechanism

    • Turning on/off Debug Messages

    • Rate Limiting

  • Debugging by Querying

    • debugfs

  • Debugging by Watching

    • strace

  • Debugging System Faults

    • Decoding Oops

    • Recovering from a System Hang

Interrupts and Concurrency

  • Interrupts

  • Installing Interrupt Handlers

  • Sources of Concurrency

  • Semaphores

  • Spinlocks

  • Common Locking Problems

  • Atomic Variables

Advanced Character I/O

  • Char driver to transmit and receive serial data

  • Blocking I/O

  • Implementing poll

  • Implementing ioctl

Networking and Ethernet Controllers

  • UDP - IP - Ethernet Overview

  • Network Interfaces

  • Configuring Routes

  • Ethernet Basics

  • Functional Description of mipsnet

Network Drivers

  • Network Driver Interface

  • Registering With the Kernel

  • Opening and Closing

  • Packet Transmission

  • Packet Reception

  • Socket Buffers

  • MAC Address Resolution