From dfcd45f95c302827a7e37a601417fa7282b61075 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Wed, 27 Jun 2001 22:14:20 +0000 Subject: [PATCH] re-autogenerated --- doc/comedilib-1.html | 8 +- doc/comedilib-2.html | 104 +++-- doc/comedilib-3.html | 24 +- doc/comedilib-4.html | 109 +++-- doc/comedilib-5.html | 121 +++-- doc/comedilib.html | 45 +- doc/comedilib_reference-1.html | 810 +++++++++++++++++++-------------- doc/comedilib_reference.html | 7 +- 8 files changed, 689 insertions(+), 539 deletions(-) diff --git a/doc/comedilib-1.html b/doc/comedilib-1.html index f3ba92c..67d8b0f 100644 --- a/doc/comedilib-1.html +++ b/doc/comedilib-1.html @@ -1,7 +1,7 @@ - + Comedi Documentation: Introduction @@ -12,10 +12,10 @@ Previous Contents
-

1. Introduction

+

1. Introduction

+ +

This is preliminary documentation for Comedi and Comedilib.

-

This is preliminary documentation for Comedi and Comedilib. -


Next Previous diff --git a/doc/comedilib-2.html b/doc/comedilib-2.html index 4417140..b54ebc0 100644 --- a/doc/comedilib-2.html +++ b/doc/comedilib-2.html @@ -1,7 +1,7 @@ - + Comedi Documentation: Installation and configuration @@ -12,48 +12,48 @@ Previous Contents
-

2. Installation and configuration

+

2. Installation and configuration

+ -

This section covers compiling, installing, and configuring -comedi and comedlib. -

-

+comedi and comedlib.

+ +

2.1 Compiling and Installing

-

-

This section has not been written. -

-

+ +

This section has not been written.

+ +

2.2 Insmod'ding the kernel module

-

-

This section has not been written. -

-

+ +

This section has not been written.

+ +

2.3 Configuring comedi for your hardware

-

-

+ +

I assume 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, the I/O base, the IRQ, jumper settings related to input -ranges, etc. +ranges, etc.

To tell the comedi kernel module that you have a particular device, and some information about it, you will be running the comedi_config -command. Perhaps you should read the man page now. +command. Perhaps you should read the man page now.

In this tutorial, I will go through the process of configuring comedi for two devices, a National Instruments AT-MIO-16E-10 -and a Data Translation DT2821-F-8DI. +and a Data Translation DT2821-F-8DI.

The NI board is plug-and-play, and the man page tells me that I need to configure the PnP part of the board with isapnptools. The isapnptools package is a little cryptic, but the concepts are simple. Once I learned how to use it, I settled on a /etc/isapnp.conf file that -contained the lines: -

+contained the lines:

+

@@ -67,27 +67,29 @@ contained the lines:
 ))
 
-

+

+

It also contains a few lines about overall configuration and about my sound card. I found out after a bit of trial-and-error that the NI board does not always work with interrupts other than IRQ 3. YMMV. Currently, the driver doesn't use DMA, but it may in the future, so I commented out the DMA lines. It is a curious fact that the device ignores the IRQ and DMA information given here, however, I keep the -information here to remind myself that the numbers aren't arbitrary. +information here to remind myself that the numbers aren't arbitrary.

When I run comedi_config (as root, of course), I provide the same information. Since I want to have the board configured every time -I boot, I put the line +I boot, I put the line

 /usr/sbin/comedi_config /dev/comedi0 atmio-E 0x260,3
 
+

into /etc/rc.d/rc.local. You can, of course, run this command at a command prompt. The man page tells me that the option list is supposed to be "(I/O base),(IRQ)", so I used the same numbers -as I put in /etc/isapnp.conf, i.e., 0x260,3. +as I put in /etc/isapnp.conf, i.e., 0x260,3.

For the Data Translation board, I need to have a list of the jumper settings. Fortunately, I wrote them all down in the manual -- I hope they are still correct. However, I had to @@ -97,7 +99,7 @@ me that I need to know the I/O base, IRQ, DMA 1, DMA 2. However, since I wrote the driver, I know that it also recognizes the differential/single-ended and unipolar/bipolar jumpers. As always, the source is the final authority, and looking in module/dt282x.c -tells me that the options list is interpreted as: +tells me that the options list is interpreted as:

+

(ai=analog input, ao=analog output.) From this, I decide that -the appropriate options list is +the appropriate options list is

 0x200,4,,1,1,1
 
+

I left the differential/single-ended number blank, since the driver already knowns (from the board name), that it is differential. I also left the DMA numbers blank, since I @@ -125,13 +129,14 @@ with my sound card -- life is full of difficult choices.) Keep in mind that things commented in the source, but not in the documentation are about as likely to change as the weather, so I put good comments next to the following line when I put -it in rc.local. +it in rc.local.

 /usr/sbin/comedi_config /dev/comedi1 dt2821-f-8di 0x200,4,,1,1,1
 
+

So now I think that I have my boards configured correctly. Since data acquisition boards are not typically well-engineered, comedi sometimes can't figure out if the board is actually there. @@ -140,41 +145,44 @@ are well-made, so comedi will give me an error message if it can't find them. The comedi kernel module, since it is a part of the kernel, prints messages to the kernel logs, which you can access through the command 'dmesg' or /var/log/messages. -Here is a configuration failure (from dmesg): +Here is a configuration failure (from dmesg):

 comedi0: ni_E: 0x0200 can't find board
 
-

When it does work, I get: +

+

When it does work, I get:

 comedi0: ni_E: 0x0260 at-mio-16e-10 ( irq = 3 )
 
-

Note that it also correctly identified my board. -

-

-

+

+

Note that it also correctly identified my board.

+ + +

2.4 Getting information from comedi

-

-

+ +

So now that we have comedi talking to the hardware, we want to talk to comedi. Here's some pretty low-level information -- -it's sometimes useful for debugging: -

-

+it's sometimes useful for debugging:

+ +

 cat /proc/comedi
 
-

Right now, on my computer, this command gives: +

+

Right now, on my computer, this command gives:

@@ -184,15 +192,16 @@ format string
  1: dt282x               dt2821-f-8di            4
 
+

This is a feature that is not well-developed yet. Basically, it currently tells you driver name, device name, and number of -subdevices. +subdevices.

In the demo/ directory, there is a command called info, which provides information about each subdevice on the board. The output of it is rather long, since I have 7 subdevices (4 or fewer is common for other boards.) Here's part of the output of the NI board (which -is on /dev/comedi0.) ('demo/info /dev/comedi0') +is on /dev/comedi0.) ('demo/info /dev/comedi0')

@@ -209,20 +218,21 @@ subdevice 0:
 
 ...
 
+

The overall info gives information about the device -- basically -the same information as /proc/comedi. +the same information as /proc/comedi.

This board has 7 subdevices. Devices are separated into subdevices that each have a distinct purpose -- e.g., analog input, analog output, digital input/output. This board also -has an EEPROM and calibration DACs that are also subdevices. +has an EEPROM and calibration DACs that are also subdevices.

Subdevice 0 is the analog input subdevice. You would have known this from the 'type: 1 (unknown)' line, if I've updated demo/info recently, because it would say 'type: 1 (analog input)' instead. The other lines should be self-explanitory. Comedi has more information about the device, but demo/info doesn't -currently display this. -

-

+currently display this.

+ +
Next Previous diff --git a/doc/comedilib-3.html b/doc/comedilib-3.html index e0c7981..1becb2b 100644 --- a/doc/comedilib-3.html +++ b/doc/comedilib-3.html @@ -1,7 +1,7 @@ - + Comedi Documentation: Individual drivers @@ -12,26 +12,26 @@ Previous Contents
-

3. Individual drivers

+

3. Individual drivers

+ -

This section contains information that is specific to each hardware driver. The most current information about a driver -is included in the comedi source. -

+is included in the comedi source.

+

3.1 National Instruments AT-MIO E series

-

-

-

+ + +

3.2 Data Translation

-

-

-

-

+ + + +


Next Previous diff --git a/doc/comedilib-4.html b/doc/comedilib-4.html index 306f359..b0c5984 100644 --- a/doc/comedilib-4.html +++ b/doc/comedilib-4.html @@ -1,7 +1,7 @@ - + Comedi Documentation: Writing programs that use comedi and comedilib @@ -12,16 +12,16 @@ Previous Contents
-

4. Writing programs that use comedi and comedilib

+

4. Writing programs that use comedi and comedilib

+ + -

-

4.1 Your first comedi program

-

+

This example requires a card that has analog or -digital input. Right to the source: +digital input. Right to the source:

@@ -49,29 +49,31 @@ int main(int argc,char *argv[])
 }
 
-

+

+

Should be understandable. Open the device, get the data, print it out. This is basically the guts of demo/inp.c, without error checking or fancy options. -Compile it using +Compile it using

 cc tut1.c -lcomedi -o tut1
 
+

A few notes: The range variable tells comedi which gain to use when measuring an analog voltage. Since we don't know (yet) which numbers are valid, or what each means, we'll use 0, because it won't cause errors. Likewise with -aref, which determines the analog reference used. -

-

-

+aref, which determines the analog reference used.

+ + +

4.2 Converting samples to voltages

-

+

If you selected an analog input subdevice, you should notice that the output of tut1 is a number between 0 and 4095, or 0 and 65535, depending on the number of bits @@ -82,29 +84,29 @@ anything else the manual for your device says. However, you probably prefer to have this number translated to a voltage. Naturally, as a good programmer, your first question is: "How do I do this in a device-independent -manner?" +manner?"

Most devices give you a choice of gain and unipolar/bipolar input, and Comedi allows you to select which of these to use. This parameter is called the "range parameter", since it specifies the "input range" for analog input (or "output range" analog output.) The range parameter represents both the gain -and the unipolar/bipolar aspects. +and the unipolar/bipolar aspects.

Comedi keeps the number of available ranges and the largest sample value for each subdevice/channel combination. (Some devices allow different input/output ranges for different -channels in a subdevice.) -

The largest sample value can be found using the function: -

comedi_get_maxdata() -

The number of available ranges can be found using the function: -

comedi_get_n_ranges() +channels in a subdevice.)

+

The largest sample value can be found using the function:

+

comedi_get_maxdata()

+

The number of available ranges can be found using the function:

+

comedi_get_n_ranges()

For each value of the range parameter for a particular subdevice/channel, you can get range information using the -function: +function:

ptr=comedi_get_range(comedi_file,subdevice,channel, -range) +range)

which returns a pointer to a comedi_range structure. -The comedi_range structure looks like -

+The comedi_range structure looks like

+

@@ -115,83 +117,89 @@ typedef struct{
 }comedi_range;
 
+

The structure element 'min' represents the voltage corresponding to comedi_data_read() returning 0, and 'max' represents comedi_data_read() returning 'maxdata', (i.e., 4095 for 12 bit A/C converters, 65535 for 16 bit, or, 1 for digital input -- more on this in a bit.) The 'unit' entry tells you if min and -max refer to voltage, current, etc. +max refer to voltage, current, etc.

"Could it get easier?", you say. Well, yes. Use the function comedi_to_phys(), which converts data -values to physical units. Call it using something like +values to physical units. Call it using something like

 volts=comedi_to_phys(it,data,range,maxdata);
 
-

and the opposite +

+

and the opposite

 data=comedi_from_phys(it,volts,range,maxdata);
 
-

-

-

+

+ + +

4.3 Another section

-

-

+ +

In addition to providing low level routines for data access, the comedi library provides higher-level access, much like the standard C library provides fopen(), etc. as a high-level (and portable) alternative to the direct UNIX system calls open(), etc. Similarily to fopen(), -we have comedi_open(): -

+we have comedi_open():

+

 file=comedi_open("/dev/comedi0");
 
+

where file is of type (comedi_t *). This function calls open(), like we did explicitly in a previous section, but also fills the comedi_t structure with lots of goodies -- information that we will need to use -soon. +soon.

Specifically, we needed to know maxdata for a specific -subdevice/channel. How about: +subdevice/channel. How about:

 maxdata=comedi_get_maxdata(file,subdevice,channel);
 
-

Wow. How easy. And the range type? +

+

Wow. How easy. And the range type?

 range_type=comedi_get_rangetype(file,subdevice,channel);
 
+

Cool. Other information you need to know about a channel -can be gotten in a similar way. -

-

-

+can be gotten in a similar way.

+ + +

4.4 Your second comedi program

-

-

+ +

Actually, this is the first comedi program again, just -that we've added what we've learned. -

+that we've added what we've learned.

+

@@ -228,17 +236,18 @@ int main(int argc,char *argv[])
 }
 
-

+

+

By now, the comedi_read_data() line looks a little archaic, using the UNIX file descriptor cf->fd instead of just cf. (By the way, somewhere in the heart of comedi_open() is the line cf->fd=open(filename,O_RDWR).) Well, there isn't one good replacement, since it highly depends on your application what additional features you might want in a comedi_get() -replacement. But this is the topic of a different section. -

-

-

+replacement. But this is the topic of a different section.

+ + +
Next Previous diff --git a/doc/comedilib-5.html b/doc/comedilib-5.html index 92e74ba..935786f 100644 --- a/doc/comedilib-5.html +++ b/doc/comedilib-5.html @@ -1,54 +1,70 @@ - + Comedi Documentation: Application-specific functions - -Next +Next Previous Contents
-

5. Application-specific functions

+

5. Application-specific functions

+ + -

-

5.1 Digital Input/Output

-

+

Many boards supported by comedi have digital input and output channels. Some boards allow the direction of a channel to be -specified in software. +specified in software.

Comedi groups digital channels into subdevice, which is a group of digital channels that have the same characteristics. For example, digital output lines will be grouped into a digital output subdevice, bidirectional digital lines will be grouped into a digital I/O subdevice. Thus, there can be multiple -digital subdevices on a particular board. -

-

-

5.2 Timed Input/Output -

+digital subdevices on a particular board.

+

Individual digital lines can be read and written using the +functions

+

comedi_dio_read(device,subdevice,channel,unsigned int *bit); +comedi_dio_write(device,subdevice,channel,unsigned int bit);

+

The direction of bidirectional lines can be configured using +the function

+

comedi_dio_config(device,subdevice,channel,unsigned int dir);

+

The parameter dir should be either COMEDI_INPUT or COMEDI_OUTPUT. +Many digital I/O subdevices group channels into blocks for +configuring direction. Changing one channel in a block changes +the entire block.

+

Multiple channels can be read and written simultaneously using the +function

+

comedi_dio_bitfield(device,subdevice,unsigned int write_mask,unsigned int *bits);

+

Each channel is assigned to a bit in the write_mask and bits +bitfield. If a bit in write_mask is set, the corresponding bit +in *bits will be written to the corresponding digital output line. +Each digital line is then read and placed into *bits. The value +of bits in *bits corresponding to digital output lines is +undefined and device-specific. Channel 0 is the least significant +bit in the bitfield; channel 31 is the most significant bit. Channels +higher than 31 cannot be accessed using this method.

-

-

-

-

5.3 Slowly-varying inputs + + +

5.2 Slowly-varying inputs

-

-

+ +

Sometimes, your input channels change slowly enough that you are able to average many sucessive input values to get a more accurate measurement of the actual value. In general, the more samples you average, the better your estimate gets, roughly by a factor of sqrt(number_of_samples). -Obviously, there are limitations to this: -

+Obviously, there are limitations to this:

+

+

As you might have guessed, the comedi library has functions to help you in your quest to accurately measure slowly varying inputs. I use these functions to measure thermocouple voltages -- actually, the library functions came from a section of code -that was previously part of the thermocouple reading program. +that was previously part of the thermocouple reading program.

The comedi self-calibration utility also uses these functions. On some hardware, it is possible to tell it to measure an internal stable voltage reference, which is typically going @@ -80,14 +97,62 @@ to get a very accurate measurement of the A/D converter output value that corresponds to the voltage reference. Sometimes, however, this is overkill, since there is no need to perform a part-per-million calibration to a standard that -is only accurate to part-per-thousand. -

-

-

-

+is only accurate to part-per-thousand.

+ + + +

5.3 Commands +

+ + + +

Many data acquisition devices have the capability to directly +control acquisition using either an on-board timer or an external +triggering input. Comedi commands are used to control this kind +of acquisition. The same structure (comedi_cmd) used to control +acquisition is used to query the capabilities of a device.

+

Commands specify a particular data acquisition sequence, which +is comprised of a number of scans. Each scan is comprised of +a number of conversions, which usually corresponds to a single +A/D or D/A conversion. The start and end of the sequence, and +the start and end of each scan, and each conversion is called an +event.

+

Each of these 5 types of events are caused by a triggering +source. The source types are:

+

+

+

Not all triggers are applicable to all events. Supported triggers +for specific events depends significantly on your particular +device. In addition, for every trigger type, there is a cooresponding +argument that specifies the rate, the count, which external signal, +etc.

+

TRIG_FOLLOW is a special type of trigger for scan_begin events that +triggers on the next lower level trigger, in this case, the trigger +for convert events. It may or may not be supported. Later, it may +also be used for start events if you want to chain multiple commands.

+

In particular, scan_end events will almost always be triggered on +TRIG_COUNT, with the argument being the number of channels in the +scan. (Actually, samples in the scan, since on most boards you can +measure a single channel multiple times in a scan.) Also, until +otherwise supported, start events can only be TRIG_NOW.

+ + + + + +
-Next +Next Previous Contents diff --git a/doc/comedilib.html b/doc/comedilib.html index 490972c..894f950 100644 --- a/doc/comedilib.html +++ b/doc/comedilib.html @@ -1,7 +1,7 @@ - + Comedi Documentation @@ -21,58 +21,15 @@ Contents

2. Installation and configuration

-

3. Individual drivers

-

4. Writing programs that use comedi and comedilib

-

5. Application-specific functions

- -

-

6. Comedilib reference

- -
Next Previous diff --git a/doc/comedilib_reference-1.html b/doc/comedilib_reference-1.html index 623327f..f8ce382 100644 --- a/doc/comedilib_reference-1.html +++ b/doc/comedilib_reference-1.html @@ -1,7 +1,7 @@ - + Comedi Documentation: Libcomedi Reference @@ -11,39 +11,40 @@ Next Previous Contents
-

1. Libcomedi Reference

+

1. Libcomedi Reference

+ + -

-

1.1 Constants and Macros

-

-

-

+ + +

RANGE_LENGTH() (deprecated)

-

RANGE_LENGTH(rangetype) -

+

+

RANGE_LENGTH(rangetype)

+

Rangetype values are library-internal tokens that represent an array of range information structures. These numbers are primarily -used for communication between the kernel and library. -

+used for communication between the kernel and library.

+

The RANGE_LENGTH() macro returns the length of the array that is -specified by the rangetype token. -

+specified by the rangetype token.

+

The RANGE_LENGTH() macro is deprecated, and should not be used in new applications. It is scheduled to be removed from the header file at version 1.0. Binary compatibility may be broken for version -1.1. -

-

-

+1.1.

+ + +

1.2 Data Types and Structures

-

+

comedi_t

The data type comedi_t is used to represent an open Comedi @@ -51,31 +52,31 @@ device. A valid comedi_t pointer is returned by a successful call to comedi_open(), and should be used for subsequent access to the device. It is a transparent type, and pointers to type comedi_t -should not be dereferenced. -

-

-

+should not be dereferenced by the application.

+ + +

sampl_t

The data type sampl_t is one of the generic types used to represent data values in libcomedi. It is used in a few places where a shorter -data type is useful, but is limited to 16 bits on the i386 architecture. -

-

-

+data type is useful, but is limited to 16 bits on the i386 architecture.

+ + +

lsampl_t

The data type lsampl_t is one of the generic types used to represent -data values in libcomedi. It is currently defined to be unsigned int. -

-

-

-

-

+data values in libcomedi. It is currently defined to be unsigned int.

+ + + + +

comedi_trig_struct (deprecated)

-

-

The comedi_trig structure + +

The comedi_trig structure

@@ -95,16 +96,18 @@ struct comedi_trig_struct{
 }
 
+

The comedi_trig structure is a control structure used by the COMEDI_TRIG ioctl, an older method of communicating -instructions to the driver and hardware. Use of Comedi triggers is -deprecated, and should not be used in new applications. -

-

-

+instructions to the driver and hardware. Use of comedi_trig is +deprecated, and should not be used in new applications.

+ +

This structure is defined as part of the Comedi kernel interface.

+ +

comedi_sv_t

-

+

@@ -124,37 +127,66 @@ struct comedi_sv_struct{
 }
 
+

The comedi_sv_t structure is used by the comedi_sv_*() functions to provide a simple method of accurately measuring slowly varying inputs. See the relevant section for more -details. -

-

-

+details.

+ + + +

comedi_cmd

+ + +

undocumented

+ +

Related functions are described in section XXX.

+ +

This structure is defined as part of the Comedi kernel interface.

+ + +

comedi_insn

+ + +

undocumented

+ +

Related functions are described in section XXX.

+ +

This structure is defined as part of the Comedi kernel interface.

+ + + +

comedi_range

+ + +

undocumented

+ + +

1.3 Functions

-

-

+ +

comedi_close()

-

-

void comedi_close(comedi_t *it); -

-

Closes a device previously opened by comedi_open(). -

+ +

void comedi_close(comedi_t *it);

+ +

Closes a device previously opened by comedi_open().

+

The return type of this function will change to int, in -order to match fclose. -

-

Source: /lib/comedi.c -

-

+order to match fclose.

+ +

Source: /lib/comedi.c

+ +

comedi_data_read()

-

+

int comedi_data_read(comedi_t *it,unsigned int subd,unsigned int chan, -unsigned int range,unsigned int aref,lsampl_t *data); -

+unsigned int range,unsigned int aref,lsampl_t *data);

+

Reads a single sample on the channel that is specified by the comedi device it, the subdevice subd, and the channel chan. @@ -162,17 +194,17 @@ For the A/D conversion (if appropriate), the device is configured to use range specification range and (if appropriate) analog reference type aref. Analog reference types that are not supported -by the device are silently ignored. -

+by the device are silently ignored.

+

comedi_data_read() reads one data value from the specified channel and places the data value that is read in the location pointed to by -data. -

+data.

+

On sucess, comedi_data_read() returns 0. If there is an -error, -1 is returned. -

-

Valid analog reference numbers are: +error, -1 is returned.

+ +

Valid analog reference numbers are:

+

Valid data values returned by these function is an unsigned integer less than or equal to maxdata, which is channel-dependent. Conversion of these data value to physical units can be performed by -comedi_to_phys(). -

Source: /lib/data.c -

-

+comedi_to_phys().

+

Source: /lib/data.c

+ +

comedi_data_write()

-

+

int comedi_data_write(comedi_t *it,unsigned int subd,unsigned int chan, -unsigned int range,unsigned int aref,lsampl_t data); -

+unsigned int range,unsigned int aref,lsampl_t data);

+

Writes a single sample on the channel that is specified by the comedi device it, the subdevice subd, and the channel chan. @@ -201,13 +234,13 @@ For the D/A conversion (if appropriate), the device is configured to use range specification range and (if appropriate) analog reference type aref. Analog reference types that are not supported -by the device are silently ignored. +by the device are silently ignored.

comedi_data_write() writes the data value specified by the argument data to -the specified channel. +the specified channel.

On sucess, comedi_data_write() returns 0. If there is an error, -1 is -returned. -

Valid analog reference numbers are: +returned.

+

Valid analog reference numbers are:

+

Valid data values used by these functions is an unsigned integer less than or equal to maxdata, which is channel-dependent. Conversion of physical units to these data value can be performed by -comedi_from_phys(). -

Source: /lib/data.c -

-

-

+comedi_from_phys().

+

Source: /lib/data.c

+ + +

comedi_dio_bitfield();

int comedi_dio_bitfield(comedi_t *it,unsigned int subd,unsigned -int write_mask,unsigned int *bits); -

+int write_mask,unsigned int *bits);

+

The function comedi_dio_bitfield() allows multiple channels to be read simultaneously from a digital input or digital I/O device. The parameter write_mask and the value pointed to by bits @@ -236,112 +270,114 @@ are interpreted as bit fields, with the least significant bit representing channel 0. For each bit in write_mask that is set, the cooresponding bit in *bits is written to the digital output channel. Each digital input channel is read, and the result -placed in the approprate bits in *bits. -

+placed in the approprate bits in *bits.

+

The current implementation reads and writes bits using separate system calls, which is not ideal. When the kernel driver supports -simultaneous reading/writing, this will be fixed in the library. -

+simultaneous reading/writing, this will be fixed in the library.

+

It should be noted that it is not possible to access channels -greater than 31 using this function. -

-

Source: /lib/dio.c -

-

-

+greater than 31 using this function.

+ +

Source: /lib/dio.c

+ + +

comedi_dio_config()

int comedi_dio_config(comedi_t *it,unsigned int subd,unsigned -int chan,unsigned int dir); -

+int chan,unsigned int dir);

+

The function comedi_dio_config configures individual channels in a digital I/O subdevice to be either input or output, depending on the value of parameter dir. Depending on the capabilities of the hardware device, multiple channels may be affected by -a single call to comedi_dio_config. -

+a single call to comedi_dio_config.

+

Valid directions are:

-

Source: /lib/dio.c -

-

-

+

+

Source: /lib/dio.c

+ + +

comedi_dio_read()

int comedi_dio_read(comedi_t *it,unsigned int subd,unsigned int -chan,unsigned int *bit); -

+chan,unsigned int *bit);

+

The function reads the status of channel chan belonging to the digital input subdevice subd of device it. The result, 0 or 1, is stored -in bit. Returns -1 on failure. -

-

This function is equivalent to comedi_data_read(it,subd,chan,0,0,bit). -

-

Source: /lib/dio.c -

-

+in bit. Returns -1 on failure.

+ +

This function is equivalent to comedi_data_read(it,subd,chan,0,0,bit).

+ +

Source: /lib/dio.c

+ +

comedi_dio_write()

int comedi_dio_write(comedi_t *it,unsigned int subd,unsigned -int chan,unsigned int bit); -

+int chan,unsigned int bit);

+

The function writes the value of bit, 0 or 1, to channel chan, belonging to the digital output device subd of device it. Returns --1 on failure. -

-

Source: /lib/dio.c -

-

+-1 on failure.

+ +

Source: /lib/dio.c

+ +

comedi_fileno()

-

-

int comedi_fileno(comedi_t *it); -

+ +

int comedi_fileno(comedi_t *it);

+

The function comedi_fileno returns the integer descriptor for the handle it. It is equivalent to the standard function fileno. If it is an invalid comedi_t pointer, the function -returns -1 and sets the appropriate libcomedi error value. -

Source: /lib/comedi.c -

-

-

+returns -1 and sets the appropriate libcomedi error value.

+

Source: /lib/comedi.c

+ + +

comedi_find_range()

-

+

int comedi_find_range(comedi_t *it, unsigned int subdevice, unsigned -int chan, unsigned int unit, double min, double max); -

+int chan, unsigned int unit, double min, double max);

+

The function comedi_find_range tries to locate the optimal (smallest) range for the channel chan belonging to a subdevice of the comedi device it, that includes both min and max in units. If it finds a matching range, it returns its index. If no -matching range is available, it returns -1. -

-

Valid units are: +matching range is available, it returns -1.

+ +

Valid units are:

-

Source: /lib/range.c -

-

-

+

+

Source: /lib/range.c

+ + +

comedi_errno()

-

int comedi_errno(void); -

+

int comedi_errno(void);

+

The function comedi_errno() returns an integer describing the most recent comedilib error. This integer may be used as the errnum parameter for -comedi_strerror(). +comedi_strerror().

When a libcomedi function fails, it usually returns -1 or NULL, depending on the return type. An internal library variable stores an error number, which can be retrieved with @@ -350,23 +386,23 @@ converted to a human-readable form by the functions comedi_perror() and -comedi_strerror(). +comedi_strerror().

These functions are intended to mimic the behavior of the standard C library functions perror(), strerror, and errno(). In particular, libcomedi functions sometimes return an error that is generated by the C library; the Comedi error message in this case -is the same as the C library. -

Source: /lib/error.c -

-

-

+is the same as the C library.

+

Source: /lib/error.c

+ + +

comedi_find_subdevice_by_type()

-

+

int comedi_find_subdevice_by_type(comedi_t *it,int type,unsigned int -start_subdevice); -

+start_subdevice);

+

The function comedi_find_subdevice_by_type tries to locate a subdevice belonging to comedi device it, having type type, starting with the subdevice @@ -374,141 +410,143 @@ having type type, starting with the subdevice it returns its index. If it does not locate the requested subdevice, it returns -1 and sets the comedi error number to "subdevice not found". If there is an error, the function -returns -1 and sets the appropriate error. -

+returns -1 and sets the appropriate error.

+

For subdevice types, see the manual page for the function -comedi_get_subdevice_type(). -

Source: /lib/get.c -

-

-

+comedi_get_subdevice_type().

+

Source: /lib/get.c

+ + +

comedi_from_phys()

-

+

lsampl_t comedi_from_phys(double data, comedi_range *rng, -lsampl_t maxdata); +lsampl_t maxdata);

Converts data given in physical units (data) into sample values (lsampl_t, between 0 and maxdata). The parameter rng represents the conversion information to use, and the parameter maxdata represents the maximum possible data value for the -channel that the data will be written to. -

-

Source: /lib/range.c -

-

-

+channel that the data will be written to.

+ +

Source: /lib/range.c

+ + +

comedi_get_board_name()

-

-

char *comedi_get_board_name(comedi_t *it); + +

char *comedi_get_board_name(comedi_t *it);

The function comedi_get_board_name returns a pointer to a string containing the name of the device. This pointer is valid until the comedi descriptor it is closed. This -function returns NULL if there is an error. -

Source: /lib/get.c -

-

-

+function returns NULL if there is an error.

+

Source: /lib/get.c

+ + +

comedi_get_driver_name()

-

-

char *comedi_get_driver_name(comedi_t *it); + +

char *comedi_get_driver_name(comedi_t *it);

The function comedi_get_driver_name returns a pointer to a string containing the name of the driver being used by comedi for the comedi device represented by it. This pointer is valid until the comedi descriptor it is closed. This -function returns NULL if there is an error. -

Source: /lib/get.c -

-

-

+function returns NULL if there is an error.

+

Source: /lib/get.c

+ + +

comedi_get_maxdata()

-

+

lsampl_t comedi_get_maxdata(comedi_t *it,unsigned int -subdevice,unsigned int chan); -

+subdevice,unsigned int chan);

+

The function comedi_get_maxdata() returns the maximum valid data value for channel chan of subdevice subdevice belonging to the comedi device it -This function returns 0 on error. -

Source: /lib/get.c -

-

-

+This function returns 0 on error.

+

Source: /lib/get.c

+ + +

comedi_get_n_channels()

-

-

int comedi_get_n_channels(comedi_t *it,unsigned int subdevice); + +

int comedi_get_n_channels(comedi_t *it,unsigned int subdevice);

The function comedi_get_n_channels() returns the number of channels of the subdevice belonging to the comedi device it -and having index subdevice. This function returns -1 on error. -

Source: /lib/get.c -

-

-

+and having index subdevice. This function returns -1 on error.

+

Source: /lib/get.c

+ + +

comedi_get_n_ranges()

-

+

int comedi_get_n_ranges(comedi_t *it,unsigned int subdevice, unsigned int -chan); +chan);

The function comedi_get_n_ranges() returns the number of ranges of the channel chan belonging to the subdevice -of the comedi device it. This function returns -1 on error. -

Source: /lib/range.c -

-

-

+of the comedi device it. This function returns -1 on error.

+

Source: /lib/range.c

+ + +

comedi_get_n_subdevices()

-

-

int comedi_get_n_subdevices(comedi_t *it); + +

int comedi_get_n_subdevices(comedi_t *it);

The function comedi_get_n_subdevices returns the number of subdevices associated with the comedi descriptor -it, or -1 if there is an error. -

Source: /lib/get.c -

-

-

+it, or -1 if there is an error.

+

Source: /lib/get.c

+ + +

comedi_get_range()

-

+

comedi_range * comedi_get_range(comedi_t *it,unsigned int subdevice,unsigned int chan,unsigned int -range); +range);

The function comedi_get_range returns a pointer to a comedi_range structure that contains information that can be used to convert sample values to or from physical units. The pointer is valid until the comedi device it is closed. If there is an -error, NULL is returned. -

Source: /lib/get.c -

-

-

comedi_get_rangetype()

+error, NULL is returned.

+

Source: /lib/get.c

+ + +

comedi_get_rangetype() deprecated

+ -

int comedi_get_rangetype(comedi_t *it,unsigned int subdevice,unsigned int -chan); +chan);

The function comedi_get_rangetype() returns an integer that represents the number of range specifications available for a particular channel chan of the subdevice subdevice, as well as a conversion table to convert sample -values to/from physical units. +values to/from physical units.

The macro RANGE_LENGTH(rangetype) can be used to determine the number of range specifications for a given -range type. -

Source: /lib/get.c -

-

+range type.

+ +

This function is deprecated and should not be used in new code.

+

Source: /lib/get.c

+ +

comedi_get_subdevice_type()

-

-

int comedi_get_subdevice_type(comedi_t *it,unsigned int subdevice); + +

int comedi_get_subdevice_type(comedi_t *it,unsigned int subdevice);

The function comedi_get_subdevice_type() returns an integer describing the type of subdevice that belongs to the comedi device it and has the index subdevice. The -function returns -1 is there is an error. -

Valid subdevice types are: +function returns -1 is there is an error.

+

Valid subdevice types are:

-

Source: /lib/get.c -

-

+

+

Source: /lib/get.c

+ +

comedi_get_timer() (deprecated)

-

+

int comedi_get_timer(comedi_t *it,unsigned int subdev, double -freq,unsigned int *trigvar, double *actual_freq); -

+freq,unsigned int *trigvar, double *actual_freq);

+

The function comedi_get_timer converts the frequency freq to a number suitable to send to the driver in a comedi_trig structure. This function remains for compatibility with very old versions of Comedi, that converted sampling rates to timer values in the libary. This conversion is now done in the kernel, and every device has the timer type nanosec_timer, indicating -that timer values are simply a time specified in nanoseconds. -

-

This function is deprecated and should not be used in new applications. -

-

Source: /lib/timer.c -

-

+that timer values are simply a time specified in nanoseconds.

+ +

This function is deprecated and should not be used in new applications.

+ +

Source: /lib/timer.c

+ +

comedi_get_version_code()

-

-

int comedi_get_version_code(comedi_t *it); -

+ +

int comedi_get_version_code(comedi_t *it);

+

The function comedi_get_version_code() returns the version code of the currently running comedi module. The version code is of the form 0x01072b, which is the version code for -version 1.7.43. -

+version 1.7.43.

+

This function is of limited usefulness. A typical mis-application of this function is to use it to determine if a certain feature is supported. If the application needs to know of the existence of a particular feature, an existence -test function should be written and put in the libcomedi source. -

Source: /lib/get.c -

-

+test function should be written and put in the libcomedi source.

+

Source: /lib/get.c

+ +

comedi_loglevel()

-

-

int comedi_loglevel(int loglevel); -

+ +

int comedi_loglevel(int loglevel);

+

This function affects the output of debugging and error messages from libcomedi. By increasing the loglevel, additional debugging information will be printed. This function returns the previous loglevel. Error messages and debugging are printed to the stream stderr. The loglevel can also be affected by the -environment variable COMEDI_LOGLEVEL. -

+environment variable COMEDI_LOGLEVEL.

+

In order to conserve resources, some debugging information is -disabled when libcomedi is compiled. -

-

The meaning of the loglevels is as follows: +disabled when libcomedi is compiled.

+ +

The meaning of the loglevels is as follows:

-

Bugs: Libcomedi doesn't currently have much debugging information. -

Source: /lib/error.c -

-

+

+

Bugs: Libcomedi doesn't currently have much debugging information.

+

Source: /lib/error.c

+ +

comedi_open()

-

-

comedi_t *comedi_open(char *filename); + +

comedi_t *comedi_open(char *filename);

Opens a comedi device specified by the filename filename. Returns NULL on error. On sucess, it returns a handle that is -given as a parameter to other libcomedi functions. -

+given as a parameter to other libcomedi functions.

+

You are not supposed to have access to the internals of the -comedi_t structure. -

Bugs: Not strictly identical to fopen -

Source: /lib/comedi.c -

-

-

+comedi_t structure.

+

Bugs: Not strictly identical to fopen

+

Source: /lib/comedi.c

+ + +

comedi_perror()

-

-

void comedi_perror(const char *s); + +

void comedi_perror(const char *s);

When a comedilib function fails, it usually returns -1 or NULL, depending on the return type. An internal library variable stores an error number, which can be retrieved with @@ -644,26 +684,26 @@ This error number can be converted to a human-readable form by the functions comedi_perror() and -comedi_strerror(). +comedi_strerror().

These functions are intended to mimic the behavior of the standard C library functions perror(), strerror, and errno(). In particular, comedilib functions sometimes return an error that is generated inside the C library; the comedi error message in this case -is the same as the C library. +is the same as the C library.

The function comedi_perror() prints an error message to stderr. The error message consists of the argument string, a colon, a space, a description of the error -condition, and a new line. -

Bugs: Does not support internationalization. -

Source: /lib/error.c -

-

-

+condition, and a new line.

+

Bugs: Does not support internationalization.

+

Source: /lib/error.c

+ + +

comedi_strerror()

-

-

*comedi_strerror(int errnum); + +

*comedi_strerror(int errnum);

When a comedilib function fails, it usually returns -1 or NULL, depending on the return type. An internal library variable stores an error number, which can be retrieved with @@ -672,118 +712,192 @@ variable stores an error number, which can be retrieved with converted to a human-readable form by the functions comedi_perror() -and comedi_strerror(). +and comedi_strerror().

These functions are intended to mimic the behavior of the standard C library functions perror(), strerror, and errno(). In particular, comedilib functions sometimes return an error that is generated inside the C library; the comedi error message in this case -is the same as the C library. +is the same as the C library.

The function comedi_strerror() returns a pointer to a character string describing the comedilib error errnum. The persistence of the returned pointer is undefined, and should not be trusted after the next libcomedi call. An unrecognized error number will -return a pointer to the string "undefined error", or similar. -

Bugs: Does not support internationalization. -

Source: /lib/error.c -

-

-

+return a pointer to the string "undefined error", or similar.

+

Bugs: Does not support internationalization.

+

Source: /lib/error.c

+ + +

comedi_sv_init()

-

+

int comedi_sv_init(comedi_sv_t *sv,comedi_t *dev,unsigned int subd, -unsigned int chan); -

+unsigned int chan);

+

comedi_sv_init initializes the slow varying comedi structure sv of the device dev, the subdevice subd (analog input) and the channel chan. The slow varying comedi structure sv of type comedi_sv_t specifies the signal measurement. The default number of averaged -samples is 100. Returns zero on success, -1 on error. -

Bugs: comedi_sv_* was very poorly designed. -

Source: /lib/sv.c -

-

-

+samples is 100. Returns zero on success, -1 on error.

+

Bugs: comedi_sv_* was very poorly designed.

+

Source: /lib/sv.c

+ + +

comedi_sv_update()

-

-

int comedi_sv_update(comedi_sv_t *sv); + +

int comedi_sv_update(comedi_sv_t *sv);

The function comedi_sv_update updates the slow varying comedi structure sv. -Returns zero on success, -1 on error. -

Source: /lib/sv.c -

-

-

+Returns zero on success, -1 on error.

+

Source: /lib/sv.c

+ + +

int comedi_sv_measure()

-

-

int comedi_sv_measure(comedi_sv_t *it,double *data); + +

int comedi_sv_measure(comedi_sv_t *it,double *data);

comedi_sv_measure measures the slow variing signal. The measurement is specified by the slow varying comedi structure sv, the result is stored in data. -On success returns the number of samples, -1 on error. -

Source: /lib/sv.c -

-

-

+On success returns the number of samples, -1 on error.

+

Source: /lib/sv.c

+ + +

comedi_to_phys()

-

+

double comedi_to_phys(lsampl_t data, comedi_range *rng, -lsampl_t maxdata); +lsampl_t maxdata);

Converts data given in sample values (lsampl_t, between 0 and maxdata) into physical units (double). The parameter rng represents the conversion information to use, and the parameter maxdata represents the maximum possible data value for the -channel that the data was read. -

Source: /lib/range.c -

-

-

+channel that the data was read.

+

Source: /lib/range.c

+ + +

comedi_trigger() (deprecated)

-

-

int comedi_trigger(comedi_t *it,comedi_trig *trig); + +

int comedi_trigger(comedi_t *it,comedi_trig *trig);

The function comedi_trigger instructs comedi to perform the command specified by the trigger structure trig. Results depend on the particular command being issued. If there is an -error, -1 is returned. -

Lifetime: removal at 1.0. -

Source: /lib/comedi.c -

-

-

-

-

-

-

-

-

-

-

-

-

-

-

comedi_get_timer()

+error, -1 is returned.

+

Lifetime: removal at 1.0.

+

Source: /lib/comedi.c

+ + +

comedi_get_subdevice_flags()

+ + +

int comedi_get_subdevice_flags(comedi_t *dev, unsigned int subdevice);

+ +

This function returns a bitfield describing the capabilities of the +specified subdevice. If there is an error, -1 is returned.

+ +

The bits are:

+

+

+ + + +

The bit definitions are part of the Comedi kernel interface.

+ + + +

comedi_range_is_chan_specific()

+ + +

int comedi_range_is_chan_specific(comedi_t *dev,unsigned int subdevice);

+ +

If each channel of the specified subdevice has a different range +specification, this function returns 1. Otherwise, this function +returns 0. On error, this function returns -1.

+ + + +

Undocumented functions

+ + +

-

-
-int comedi_get_timer(comedi_t *it,unsigned int subdev,double freq,unsigned int *trigvar,
-        double *actual_freq);
-
-
-

-

-

-

+

+

+ + + + + + + + + +
Next Previous diff --git a/doc/comedilib_reference.html b/doc/comedilib_reference.html index 7062fdb..78ad784 100644 --- a/doc/comedilib_reference.html +++ b/doc/comedilib_reference.html @@ -1,7 +1,7 @@ - + Comedi Documentation @@ -18,11 +18,6 @@ Contents

1. Libcomedi Reference

-
Next Previous -- 2.26.2