
                      CIO-DDA06/16 Version 1.0a
                      ----------------------

 Linux loadable module for the Computer Boards CIO-DDA 06/16 D/A adapter
 ------------------------------------------------------------------------

Introduction:
-------------

This driver was written by Warren J. Jasper at North Carolina State
University.  It is a driver for the ComputerBoards CIO-DDA 06/16 D/A
adapter.  This adapter is claimed to be 100% compatible with the
MetraByte DDA-06 series.

Distribution contents:
----------------------

README       - this file
Makefile     - Makefile to compile and install the driver
d2ac.c	     - CIO-DDA06/16 Driver source.
d2ac.h	     - Driver definitions and constants.
dac.h	     - User and driver definitions and constants.
dacwrite.c   - Test program.

Building and installing the driver:
-----------------------------------

1. Untar the tar file in a test directory:

   tar zxvf CIO-DDA06-16.1.0a.tar.gz


2. If the major device number 33 is in use, then edit the following line
   in the Makefile. 

	MAJOR_DEV=33

3. Sometimes the dependency list is not correct, depending on which version
   Linux you are running, and which distribution.  Type:

   make depend

4. To compile, type:

   make

5. To make the appropriate devices:
 
   make devices

6. To install the driver type:

    make install

    check that the destination directory is correct.

7. To test run the test program 'dacwrite':

    dacwrite -nostop


Having the driver install at boot:
----------------------------------

To install the driver so that it comes up every time on boot-up, you
will need to include the following lines in one of your boot rc files.
The one we used is called /etc/rc.d/rc.local. Your setup may vary.

echo -n "Local customization:"

if [ -x /sbin/insmod -a -r /lib/modules/`uname -r`/misc/dac.o ]; then
        echo -n " DAC-DDA06"
        /sbin/insmod -f /lib/modules/`uname -r`/misc/dac.o
fi

How the driver works:
---------------------

The driver is fairly straight forward, but since the current version of
Linux is not 1003.4 compliant (it is not a real-time operating system),
certain design decisions were made in writing this driver.  On a
Pentium 90 MHz with 16 MByte of memory, we are able to output data at a 
sustained rate of 120kHz with no other output running.  Your mileage may vary.

Each D/A channel has its own minor number.  There is only one major
number for the device.  In the header file a2ac.h, the following
values need to be set for your particular machine:

#define DAC_BASE           0x340 /* Default base address */
#define DEFAULT_MAJOR_DEV  33    /* Default Major Device Number */
#define DA_CHANNELS         6    /* 6 Digital to Analog Channels */

Make sure that these numbers are not being used on your system.  The
Base address must also be set with DIP switches on the board. 

****************************************************************************
NOTE:  You can only open one channel at a time.  If you are running
multiple processes, you must make sure you close the file descriptor before
tying to open it again.
****************************************************************************

To write to a channel, use:

  int count = 2;             /* desired number of conversions */
  int bytesWritten;
  short data;

  bytesWritten = write(fd, &data, count);


****************************************************************************

The following ioctl() functions have been implemented:

1. ioctl(fd, DAC_XFER_MODE, 0);
   By setting the XFER jumper on the board, the DAC board is set to simultaneous
   update. When a DAC pair is set for simultaneous update, writing new digital values
   to the DAC's control register does not cause an update of the DAC's voltage
   output.  Update occurs on after a READ from the board's address.

2. ioctl(fd, DIO_SET_MODE, MODE,IO);
   Sets the INTEL 8255 Programmable Peripheral Interface to one of three modes:
       MODE_IO            - normal input/output mode
       MODE_STROBE_IO     - Strobed Input/Output (port A or B)
       MODE_BIDIRECTIONAL - Bi-Directional Bus (port A only )
    See the documentation of the chip for more information

3. ioctl(fd, DIO_SET_DIRECTION, PORT_INPUT);
   Set the direction of the port to either input or output.  Port C can be split
   into two levels (4 bits each), while ports A and B are either all input or
   all output.

