This file describes the National Instruments E-series BETA DAQ Driver for
Linux installation & configuration.  Up to date information can always be
found at http://www.natinst.com/linux.



STEP 1: UNPACK

Decompress the edaq-0.8.1.tgz :
tar xvzf edaq-0.8.1.tgz

This will extract the edaq directory with
the following subdirectories:
driver/	contains the driver source, configuration file
lib/	contains the source of the libnidaq.so library
lv/	contains the labview data acquisition ni.llb, a test.llb and the CIN sources.
tests/	contains some C test programs
docs/	documentation


STEP 2: COMPILE & INSTALL

First check the makefile in the driver/ directory to see if it fits
your kernel configuration.  In particular, if your kernel uses module
versioning, make sure the KCFLAGS line contains -DMODVERSIONS, and if it
doesn't use module versioning, make sure the KCFLAGS line does NOT contain
-DMODVERSIONS.

To compile the driver, the library and test C programs, go to the edaq
directory and type:
make

If everything is OK install the driver files:
make install

If only PCI boards are present, give the command:
make config
and go to STEP 4. For ISA boards see STEP 3.



STEP 3: CONFIGURE ISA BOARDS

PCI boards are autodetected. If no ISA boards are present, just jump to step 4

For jumpered ISA boards, you should set the base i/o address and the irq no manually.

For PnP ISA boards use the command:
pnpdump >isapnp.conf
to find all ISA pnp devices in your system. Edit isapnp.conf to uncomment the desired configuration (don't forget to uncomment ACT Y at the end of the file). There is a sample file you can look at (name?).
Note: you should also edit the settings for non NI ISA PnP boards.
Then run:
isapnp isapnp.conf
to store the settings into all the PnP ISA boards.
Copy isapnp.conf to /etc/isapnp.conf to activate the boards at boot automaticaly.

In this point jumpered and PnP ISA devices are seen identicaly by the driver. You should know in this moment what resources are used by each ISA board.


There is a configuration file driver/ni.conf for configuring ISA boards.
For each ISA board there is a corresponding line in this file (first is for board 0, second for board 1, etc.).
Please see the sample ni.conf. The syntax of a line is:

type=<isa_device_type> base=<base_io> irq=<irq_no>

isa_device_type is the name of a NI board. See niboards for a list of supported boards.
If your can't find your board in the list please use the closest board type (it should have a lower sampling freq)
base_io is the base i/o address of the ISA board; you can use 0x****
irq_no is the irq number used by the ISA board

If the above is confusing or doesn't work, see the HOWTO on configuring
Plug and Play devices under Linux.  The HOWTOs are installed with most
Linux distributions, or go to the Linux Documentation Project copy at:
http://metalab.unc.edu/LDP/HOWTO/Plug-and-Play-HOWTO.html

The driver first installs ISA boards, then autodetects PCI devices. So, if both ISA and PCI are present, ISA boards will normaly get the first board numbers. To reserve a board number for PCI use a line of form:
type=0
or
type=<pci_device_type>
The first will reserve a board number for any PCI board, the second will reserve it for a PCI board of a given type (see niboards for supported types)
Note: 16 boards are supported but only boards 0 .. 3 can be ISA.

Finaly give the command:
make config


STEP 4: VERIFY THE INSTALLATION

In this point the driver should be activated. Please verify it.

Under Linux 2.0.x the commands are:
cat /proc/modules
cat /proc/devices
cat /proc/ioports
cat /proc/interrupts

For help understanding this output (if you are unfamiliar with Linux
modules) see the man page for proc.

Now verify the ni devices in the /dev/directory:
ls -l /dev/ni*

The following devices should be found:
/dev/nidaqX
/dev/nidioX
/dev/nigpctXY

where X (0 to 3) is the board number and Y (0 or 1) is the counter number.
If you use more than 4 boards please modify driver/mknidevices.pl 

note: mknidevices takes the major number (ussualy 127) from /proc/devices,
so the driver must be active when running it.



STEP 5: RUN C TEST PROGRAMS

In this moment you may run the included C test programs in the tests/ directory (see STEP 1):

For E-series boards run: (in the following tests both AI & AO are configured in the -10V .. +10 V range; AI is in
 differential mode)

./testaisp /dev/nidaq0 3
should read a point from AI channel 3 of board 0
./testai /dev/nidaq0
should read 10 scans of 4 samples (AI channels 0, 1, 2, 3 of board 0)
./testao /dev/nidaq0 5.0
should output 5.0V to both DAC0 and DAQ1 of board 0
./testdioe /dev/nidio0
should configure the DIO port half read - half write, set a write mask then write 0 or 0xff and read the port in a loop. Ctrl-C to exit

Counter tests are also included.  See the files in the tests/ directory
for more information.


For a 8255 - based DIO board run:

# nr. de porturi !!
./testdio8255 /dev/nidio0
should configure even/odd ports as outputs/inputs then write 0 or 0xff on the out ports and read the input ports in a loop. Ctrl-C to exit



STEP 6: RUN LABVIEW TEST VI'S

Once the driver is properly installed and the test programs are working fine you can try the labview test vis

start labview and load any test vi from test.llb in the lv/ subdirectory (see STEP 1)
Each test vi has instructions on its main panel. Modify the controls to test any resource you wish.

Note: LV device n is nidaq board n-1 (i.e. lv device 1 is nidaq board 0, coresponding to /dev/nidaq0, /dev/nidio0, etc)





KNOWN BUGS
==========

* The driver has problems with XE (16-bit) boards.  This is under
investigation.  If you are having problems using the XE boards and you are
calling the driver directly (by opening the device and issuing ioctl
calls) be absolutely sure you aren't skipping any steps!  Check the ai.c
file in the lib/ directory for examples.
* DMA is not supported at this time.  Doing DMA would require programming
the mMITE chip on NI's CPCI/PCI/PXI cards, and as of now that information
is only available under NDA, thus precluding an open-source release.
Feedback on this issue is appreciated.
* This driver is not yet SMP safe under 2.1.x and greater kernels.  Don't
use this with an SMP machine and an SMP enabled kernel.

AREAS FOR DEVELOPMENT (or ways to get your name in the README...)
=====================

* The error codes for the LabVIEW VIs are not very descriptive or robust.
* The driver should now work for kernel versions 2.0.x and above,
including the newer 2.2.x kernels, but hasn't been tested as rigorously on
the 2.2.x kernels.  We need more testing and improvements in the code's
performance under these kernels (particularly SMP).
* The code is ugly in places (spacing, comments, etc.) and could be
cleaned up.
* A great deal of NI-DAQ functionality is still not supported (triggering,
RTSI, etc.).  This could all still be added.
* File commenting and descriptions would be useful.
* Giving a nice way to set up the ISR and entry points in ai.c, ao.c, and
dio.c to RTLinux applications would be appreciated.
* Anything else not specified here to make this a flexible as NI-DAQ!

If you need technical manuals or register maps to improve this driver, go
to http://www.natinst.com/manuals and look for either the manual for your
card, or for the DAQSTC Programming Manual (if you use an E-series board).


REVISION HISTORY
================

0.7  -  First release.  Coding done by Cristi Soviani.  Testing done by
        both Cristi Soviani and Kurtis McCathern.
0.8  -  Support for 2.1.x and later kernels added by Kurtis McCathern.
        Documentation updated to list additional web resources.
0.8.1 - Changed some example tests to use the C library rather than
        calling the ioctls directly to remove assumptions (initial
        versions assumed a 12-bit board, etc.).  Added support for kernel
        versioning.
0.8.2 - Ted Roth sent a patch to add the PCI-6503x to niboards (can't
        believe I missed that one) as well as the default configuration in
        ni.conf.  Now the ni.conf comes empty - fill it to your heart's
        content!

CONTACT INFORMATION
===================

Contact National Instruments Linux support at lvlinux-support@natinst.com
or Cristi Soviani directly at soviani@fx.ro.
