Specifications

Comedi
5 / 148
Buffering is another important aspect of device drivers: the acquired data has to be stored in such buffers, because, in general,
the application program cannot guarantee to always be ready to provide or accept data as soon as the interface board wants to do
a read or write operation. Comedi provides internal buffers for data being streamed to/from devices via Comedi commands. The
buffer sizes are user-adjustable.
2 Configuration
This section assumes that you have successfully compiled and installed the Comedi software, that your hardware device is in
your computer, and that you know the relevant details about it, i.e., what kind of card it is, any jumper settings related to input
ranges, the I/O base address and IRQ for old non-plug-n-play boards, etc.
2.1 Configuration
The good news is: on most systems PCI and USB based boards are configured automatically. The kernel will detect your data
acquisition devices, will load the appropriate kernel drivers and will create the /dev/comedi entries.
bp1@bp1-x61:~/sandbox/comedilib$ ls -l /dev/comedi0
*
crw-rw---- 1 root iocard 98, 0 2012-04-26 23:41 /dev/comedi0
crw-rw---- 1 root iocard 98, 48 2012-04-26 23:41 /dev/comedi0_subd0
crw-rw---- 1 root iocard 98, 49 2012-04-26 23:41 /dev/comedi0_subd1
Usually these devices belong to the group iocard as shown here. The only action you need to take is to become member of
this group and then the Comedi device is ready to be used.
Old ISA based cards need to be manually configured which is explained here. You only need to read on here if you have one of
these old cards. On embedded systems it might also be necessary to load the driver and then to configure the boards manually.
In general manual configuration is done by running the comedi_config command (as root). Here is an example of how to use
the command (perhaps you should read its man page now):
comedi_config /dev/comedi0 labpc-1200 0x260,3
This command says that the ‘file’ /dev/comedi0 can be used to access the Comedi device that uses the labpc-1200 board,
and that you give it two run-time parameters (0x260 and 3). More parameters are possible, and their meaning is driver depen-
dant.
This tutorial goes through the process of configuring Comedi for two devices, a National Instruments AT-MIO-16E-10, and a
Data Translation DT2821-F-8DI.
The NI board is plug-and-play. The current ni_atmio driver has kernel-level ISAPNP support, which is used by default if you
do not specify a base address. So you could simply run comedi_config as
comedi_config /dev/comedi0 ni_atmio
For the preceding comedi_config command to succeed, the ni_atmio kernel module must be loaded first. For plug-n-play
boards on modern kernels, the appropriate comedi kernel modules should get loaded automatically when your computer is
booted. The modprobe command can be used to manually load/unload kernel modules, and lsmod will list all the currently
loaded modules.
For the Data Translation board, you need to know how the board’s jumpers are configured in order to specify the correct
comedi_config parameters. These parameters for the board are given in the kernel drivers section about the dt282x driver.
The card discussed here is a DT2821-f-8di. The entry for the dt282x driver tells you that the comedi_config parameters give
the driver the I/O base, IRQ, DMA 1, DMA 2, and in addition the states of the differential/single-ended and unipolar/bipolar
jumpers:
DT282X CONFIGURATION OPTIONS:
[0] - I/O port base address
[1] - IRQ