Subject: Re: Documentation
To: None <current-users@NetBSD.ORG,>
From: Stephen J. Roznowski <>
List: current-users
Date: 01/07/1995 10:24:06
> From: Ken Hornstein <>
> 		NetBSD device driver primer

  0.  TOC

> 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
>     [ ... ]

The differences between block/character/loadable drives should probably
go here.

> III. Device driver functions
>     [ ... ]

> IV. Device driver theory (maybe this should be up higher)
>     A. User context routines
>     B. Interrupt context routines

I'd consider moving this to II.A.

> 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

Change this title to: "Writing your device driver", and guide someone
through writing one.

>     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!

I'd consider adding the following:

  VIII. Book references

      B. {Machine specific sections here}

Perhaps add some sample drivers as an appendix?

It should also be possible to add a section on writing loadable system

I'm still thinking about this layout. Could you resend an updated
version of what your primer is looking like? [I've seen a bunch of
suggestions fly by...] I have several different sets of notes from
courses that I've taken on writing device drivers that I'll dig out
for organizational ideas.

Maybe you need to update the title to be:

 		NetBSD device driver primer (Version 0.1)