Subject: Documentation
To: None <current-users@NetBSD.ORG>
From: Ken Hornstein <>
List: current-users
Date: 01/06/1995 12:11:22
Whoah!  I've gotten _tons_ of positive responses about writing a device driver
primer!  It makes me feel like I should start writing one right away.

I'm chaning jobs at the end of this month, and I have a few days before my new
job starts.  I think I might use that time to work on such a beast.

Some people expressed interest in helping out - the more the merrier!  Attached
is tenative outline of such a document.  Anyone who thinks that they can write
sections of it is welcome to!  Since I started the ball rolling, I'll be the
co-ordinator for all of this.  Sections marked with an * are things which I
don't know a lot about.  I'd really love feedback on this outline as well;
if you think something is missing or is in the wrong place, tell me!


		NetBSD device driver primer

I.  Introduction
II. General concepts
    A. User mode and supervisor mode (ie - difference between user-level code
       and kernel code).
    B. Filesystem layout of /sys
    C. Brief overview of syscall interface
    D. Device interface
       1. Major/minor numbers and char/block devices
       2. conf.c, cdevsw & bdevsw
       3. brief description of each function in cdevsw and bdevsw
    E. Device I/O
       1. Memory-mapped I/O
       2. Harvard architecture (separate I/O bus)
       3. DMA
    F. Kernel config file
III. Device driver functions
    A. xxprobe
    B. xxattach
    C. xxopen
    D. xxread
    E. xxwrite
    F. xxclose
    G. xxioctl
    H. xxstrategy
    I. xxdump (*)
    J. xxstop (*)
    K. xxreset (*)
    L. xxselect
    M. xxmmap (*)
IV. Device driver theory (maybe this should be up higher)
    A. User context routines
    B. Interrupt context routines
IV. Kernel utilities
    A. sleep/tsleep/wakeup
    B. spl functions
       1. Explanation of different priority levels
       2. List of all spl functions
       3. Use of spl routines for atomic access
    C. printf/kprintf
    D. DDB
V. Kernel device layers
    A. tty layer (*)
       1. line disciplines (*)
       2. explanation of various modes (*)
       3. ttselect (*)
    B. enet layer (8)
    C. Block I/O layer
VI. Hints, tips, and style
    A. Start out small
    B. Be as robust as possible
       1. Handle all possible known conditions
       2. Use timeouts when appropriate
       3. Try to support UNK ioaddr/irq in config file.
    C. UTSL!