moved stuff from comedi

This commit is contained in:
David Schleef 2000-06-03 19:57:41 +00:00
parent 3aeb987160
commit 7db2496edd
4 changed files with 417 additions and 0 deletions

12
comedi_config/Makefile Normal file
View file

@ -0,0 +1,12 @@
CFLAGS=-Wall -O2 -I../include
#LDFLAGS=-L../lib/ -lcomedi
LDFLAGS=
OBJS=comedi_config.o
comedi_config: $(OBJS)
$(CC) -o comedi_config $(OBJS) $(LDFLAGS)
clean:
rm -f comedi_config *.o

View file

@ -0,0 +1,169 @@
/*
comedi_config/comedi_config.c
configuration program for comedi kernel module
COMEDI - Linux Control and Measurement Device Interface
Copyright (C) 1998 David A. Schleef <ds@stm.lbl.gov>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define CC_VERSION "0.6.13"
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/sysmacros.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <getopt.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <comedi.h>
int quiet=0,verbose=0,script=0;
void do_script(void);
void do_help(int i)
{
fputs(
"comedi_config version " CC_VERSION "\n"
"usage: comedi_config [-[vVq]] <device file> <driver> <option1>,<option2>,...\n"
"where <optionN> are integers (or blank) whose interpretation depends on\n"
"the driver. In general, however, option1 refers to the I/O port address\n"
"and option2 refers to IRQ number to be used by the driver\n"
,stderr);
exit(i);
}
int main(int argc,char *argv[])
{
comedi_devconfig it;
int fd;
int c,i,num,k;
char *opts;
char *fn,*driver;
struct stat statbuf;
int ret;
int remove=0;
while(1){
c=getopt(argc,argv,"rvVq");
if(c==-1)break;
switch(c){
case 'v':
verbose=1;
break;
case 'V':
fputs("comedi_config version " CC_VERSION "\n",stderr);
exit(0);
break;
case 'q':
quiet=1;
break;
case 'a':
script=1;
break;
case 'r':
remove=1;
break;
default:
do_help(1);
}
}
if(script){
if( (argc-optind)>0 ){
do_help(1);
}else{
do_script();
}
}
if((argc-optind)!=2 && (argc-optind)!=3){
do_help(1);
}
fn=argv[optind];
driver=argv[optind+1];
strncpy(it.board_name,driver,COMEDI_NAMELEN-1);
for(i=0;i<COMEDI_NDEVCONFOPTS;i++)it.options[i]=0;
if((argc-optind)==3){
opts=argv[optind+2];
i=0;
while(*opts){
if((*opts)==','){
i++;
opts++;
if(i>=COMEDI_NDEVCONFOPTS)
do_help(1);
continue;
}
if(sscanf(opts,"%i%n",&num,&k)>0){
it.options[i]=num;
opts+=k;
continue;
}
do_help(1);
}
}
ret=stat(fn,&statbuf);
if(ret<0){
perror(fn);
exit(1);
}
#if 0
/* this appears to be broken */
if( !(S_ISCHR(statbuf.st_mode)) ||
major(statbuf.st_dev)!=COMEDI_MAJOR){
if(!quiet)
fprintf(stderr,"warning: %s might not be a comedi device\n",fn);
}
#endif
fd=open(fn,O_RDWR);
if(fd<0){
perror(fn);
exit(1);
}
/* add: sanity check for device */
if(verbose){
printf("configuring driver=%s ",it.board_name);
for(i=0;i<COMEDI_NDEVCONFOPTS;i++)printf("%d,",it.options[i]);
printf("\n");
}
if(ioctl(fd,COMEDI_DEVCONFIG,remove?NULL:&it)<0){
perror("Configure failed!");
exit(1);
}
exit(0);
}
void do_script(void)
{
printf("comedi_config: -a option not supported (yet).\n");
exit(0);
}

59
man/comedi.7 Normal file
View file

@ -0,0 +1,59 @@
.TH comedi 7 ""
.SH NAME
\fBcomedi\fR - the Linux Control and Measurement Device Interface
.SH SYNOPSIS
\fB#include <comedi.h>\fR
.br
.SH DESCRIPTION
The \fBcomedi\fR package is a collection of hardware drivers and
library routines that can be used to communicate with a variety of
data acquisition boards, including A/D converters, D/A converters,
digital I/O and timers.
The hardware drivers that are installed on your system may include
one or more of the following:
\fB8255\fR - Generic 8255 support
.br
\fBdas08\fR - Keithley DAS08 and compatibles
.br
\fBdt2811\fR - Data Translation DT2811
.br
\fBdt2814\fR - Data Translation DT2814
.br
\fBdt2817\fR - Data Translation DT2817
.br
\fBdt282x\fR - Data Translation DT2821 series
.br
\fBni_E\fR - National Instruments AT-MIO E series
.br
\fBni_E\fR - National Instruments AT-MIO (Am9513 based)
.br
\fBparport\fR - Standard PC parallel port digital I/O
.br
\fBpcl711\fR - PC-LabCard PCL-711, 711B
.br
\fBpcl711\fR - PC-LabCard PCL-725
.br
\fBpcl711\fR - PC-LabCard PCL-726
.br
\fBrti800\fR - Analog Devices RTI-800/815
.SH OTHER DOCUMENTATION
The following man pages may be useful:
\fBcomedi_config\fR(8),
Additional text documentation is located in /usr/doc/comedi-0.5.0.
.SH VERSION
0.5.0
The current version can be found at ftp://stm.lbl.gov/pub/comedi.
.SH AUTHOR
David Schleef, <ds@stm.lbl.gov>

177
man/comedi_config.8 Normal file
View file

@ -0,0 +1,177 @@
.TH comedi_config 8 ""
.SH NAME
\fBcomedi_config\fR - COMEDI configuration utility
.SH SYNOPSIS
\fB/usr/sbin/comedi_config\fR [-vVq] /dev/comediN <driver>
<option1>[,<option2>...]
.br
.SH DESCRIPTION
\fBcomedi_config\fR is a utility designed to configure
control and measurement hardware associated with a particular
\fBcomedi\fR device. You must have the \fBcomedi\fR module installed
in the kernel to use this utility.
Each control and measurement card in your computer is associated
with an individual comedi device; to a user, these appear as the
files \fB/dev/comedi\fRN, with N being 0,1,2,3,etc. To configure
\fBcomedi\fR to use a particular hardware driver for your card,
you would use this utility with the device file, driver name, and
other vital parameters (I/O base address, IRQ, etc.) on the
command line.
As an example, the command line used to tell the comedi module that
you want to access a National Instruments AT-MIO E series board as
\fB/dev/comedi0\fR would be:
/usr/sbin/comedi_config /dev/comedi0 atmio-E 0x220,3
This tells the driver that the board is configured
for I/O base 0x220 and IRQ 3. In general, I/O base is listed first
and IRQ, if necessary, is listed second. Additional parameters
vary, so see the information below for the particular driver.
Parameters can be expressed in either decimal or hexadecimal, with
a 0x prefix.
.SH OPTIONS
\fBcomedi_config\fR recognizes the following options:
\fB-a\fR obtain configuration information from the file
/fB/etc/comedi.conf/fR.
\fB-q\fR don't print output while running.
\fB-v\fR print verbose output while running.
\fB-V\fR print version number and exit.
.SH HARDWARE DRIVERS
Additional information pertaining to each hardware driver is
available in \fB/usr/doc/comedi-0.5.0\fR. Unless noted,
the names below are the same as the driver names given on
the command line.
\fB8255\fR Generic 8255 support
.br
<I/O base>
\fBdas08\fR - Keithley DAS08 and compatibles
.br
<I/O base>
\fBdt2811\fR - Data Translation DT2811
.br
<I/O base>
.br
Interrupts are not used with this board.
\fBdt2814\fR - Data Translation DT2814
.br
<I/O base>,<IRQ>
.br
Set IRQ to -1 to probe for IRQ.
\fBdt2817\fR - Data Translation DT2817
.br
<I/O base>
\fBdt282x\fR - Data Translation DT2821 series
.br
<I/O base>,<IRQ>,<DMA 1>,<DMA 2>,
<analog reference>,
<encoding, analog input>,
<encoding, analog output 0>,
<encoding, analog output 1>,
<voltage range, analog input>,
<voltage range, analog output 0>,
<voltage range, analog output 1>.
.br
Valid values for analog reference are 0=single ended,
1=differential.
Valid values for encoding are
[0=straight or offset binary, 1=two's complement].
Valid values for voltage range are
0=(-10,10), 1=(0,10), 2=(-5,+5), 3=(0,5),
4=(-2.5,2.5).
Options must agree with how your board is
configured.
.br
The driver recognizes the following names:
\fBdt2821\fR,
\fBdt2823\fR,
\fBdt2824-pgh\fR,
\fBdt2824-pgl\fR,
\fBdt2825\fR,
\fBdt2827\fR,
\fBdt2828\fR.
Use the name that best represents your board.
\fBatmio-E\fR - National Instruments AT-MIO E series
.br
<I/O base>,<IRQ>
.br
This driver automatically detects which board is installed
in your computer. The E-series boards are plug-and-play, so use
\fBisapnptools\fR to tell the board which I/O port to use before
running \fBcomedi_config\fR. In a random fit of stupidity, the
E-series boards ignore the IRQ which PnP assigns to it.
\fBparport\fR - Standard PC parallel port digital I/O
.br
<I/O base>
.br
This driver does not work with the new parallel port sharing
capabilities of Linux.
\fBpcl711\fR - PC-LabCard PCL-711, 711B, ACL-8112
.br
<I/O base>
.br
Use the driver name \fBpcl711b\fR to configure for a 711B board.
\fBpcl725\fR - PC-LabCard PCL-725
.br
<I/O base>
.br
\fBpcl726\fR - PC-LabCard PCL-726
.br
<I/O base>
.br
\fBrti800\fR - Analog Devices RTI-800/815
.br
<I/O base>
.SH CONFIGURATION FILE
[This section has not been implemented yet.]
A list of device configurations can be put into the file
\fB/etc/comedi.conf\fR. This file takes the form
<device> <driver> <param1>,<param2>,...
These configurations will be read and performed when the
switch \fB-a\fR is used. This is potentially useful when
run from an initialization script.
.SH OTHER DOCUMENTATION
\fBcomedi\fR(7),
Additional text documentation is located in /usr/doc/comedi-0.5.0.
.SH VERSION
0.5.0
The current version can be obtained from ftp://stm.lbl.gov/pub/comedi.
.SH AUTHOR
David Schleef, <ds@stm.lbl.gov>