  This is the BSD version of the MIDI driver.  This is the basis
for all the other driver.  I use this myself under BSDI.
  Let's see if I can remember what needs to happen to install this.

  + Put midi.c midiioctl.h midivar.h quad.c quad.h in your isa source directory
(ie /usr/src/sys/i386/isa).

  + Make a symbolic link from /usr/src/sys/i386 to /usr/include/i386.
This is so we can pick up the midiioctl.h include file.

  + If you are running BSD/386 1.1, you can skip this step.  conf.c already
has the correct entries.  Edit /usr/src/sys/i386/i386/conf.c.  We need
to add the following bits:

  This section goes near the others that look like it:
>#include "midi.h"
>
>cdev_decl(midi);
>
>/* open, close, read, write, ioctl */
>#define cdev_midi_init(c,n) { \
>        dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
>        dev_init(c,n,write), dev_init(c,n,ioctl), \
>        (dev_type_stop((*))) enodev, (dev_type_reset((*))) nullop, 0, \
>        dev_init(c,n,select), (dev_type_map((*))) enodev, 0 }

  This line goes in the "struct cdevsw cdevsw[]" definition.  Your
number (22) will be different depending on your selection of drivers.
Just stick this line at the end and make the number one bigger than
the line above it.  Keep track of the number - it's the major device
number and will be used in /dev/MAKEDEV
>        cdev_midi_init(NMIDI,midi),     /* 22: Midi device */


  + Edit /usr/src/sys/i386/conf/files.i386, and add the following lines:
BSD/386 1.1 already has the midi.c line, so you don't need to add it
again.  However, you do need to add the quad.c line.

>files.i386:i386/isa/midi.c              optional midi device-driver
>files.i386:i386/isa/quad.c		 optional midi device-driver

  You configuration line in the config file (ie GENERIC or whatever)
should look something like the following, though if you don't have
autoconfig you might have to change the isa? to the specific irq
number (ie isa5).  Your port number might also be different (0x330?).

>device             midi0   at isa? port 0x300

  + Edit /dev/MAKEDEV and add the following block, changing maj to
be the correct major number for your system.  Remember, from above.
BSD/386 1.1 has a midi entry, but it is for the old driver.  Modify
it to look like this version.

>midi)
>        maj=22
>        umask 000
>        for i in 0 1
>        do
>                if [ ! -f midi${i} ] ; then
>                        mknod midi${i} c ${maj} ${i}
>                fi
>        done
>        ;;

  + Now config a new kernel with a midi device, make it and install it.

  + make the /dev/midi entries.  cd /dev; MAKEDEV midi;

  + reboot

  + I think that's everything, though I'm sure I missed something.  If
you have problems, you can reach me at durian@boogie.com




Notes:
  Currently the driver calculates the time difference between incoming
events using the global kernel variable, time.  This is a struct
timeval value which I convert to ticks.  I'd rather just use a tick
count from the start.  SVR4 has lbolt and Linux has jiffies.  Vanilla
BSD 4.3 doesn't have anything like this.  There is a modified version
of kern_clock.o available from bsdi that has a variable ticks that
can be used, but since not everyone uses BSDI and won't have this
new file, I won't use that.  4.4 will have a ticks variable, and
once that becomes common in all the BSD releases, I'll switch over.
