+
+
+
+
+
diff --git a/doc/comedilib.sgml b/doc/comedilib.sgml
index 2460940..da0ebd9 100644
--- a/doc/comedilib.sgml
+++ b/doc/comedilib.sgml
@@ -270,16 +270,13 @@ 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. Including all
-the appropriate headers is sometimes a little tricky.
+without error checking or fancy options.
Compile it using
+
+
+
+
+
+ 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.
+
+ The RANGE_LENGTH() macro returns the length of the array that is
+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.
+
+
+
+
+ The data type
+
+
+ The data type
+
+
+ The data type
+
+
+
+
+
+ The
+ The
+
+
+
+
+ The
+
+
+
+
+
+
+ Closes a device previously opened by comedi_open().
+
+ The return type of this function will change to
+ Source:
+
+
+
+ Reads a single sample on the channel that
+is specified by the comedi device
+
+ On sucess,
+ Valid analog reference numbers are:
+
+ Valid data values returned by these function is an unsigned integer
+less than or equal to Source:
+
+
+
+ Writes a single sample on the channel that
+is specified by the comedi device On sucess, Valid analog reference numbers are:
+
+ Valid data values used by these functions is an unsigned integer
+less than or equal to Source:
+
+
+
+ The function
+ 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.
+
+ It should be noted that it is not possible to access channels
+greater than 31 using this function.
+
+ Source:
+
+
+
+ The function
+ Valid directions are:
+ Source:
+
+
+
+ The function reads the status of channel
+ This function is equivalent to
+ Source:
+
+
+ The function writes the value of
+ Source:
+
+
+
+ The function Source:
+
+
+
+
+ The function
+ Valid units are:
+
+ Source:
+
+
+
+ The function 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
+ These functions are intended to mimic the behavior of the
+standard C library functions Source:
+
+
+
+
+ The function
+ For subdevice types, see the manual page for the function
+ Source:
+
+
+
+ Converts data given in physical units (
+ Source:
+
+
+
+ The function Source:
+
+
+
+ The function Source:
+
+
+
+
+ The function Source:
+
+
+
+ The function Source:
+
+
+
+ The function Source:
+
+
+
+ The function Source:
+
+
+
+ The function Source:
+
+
+ The function The macro
+ Source:
+
+
+ The function Valid subdevice types are:
+
+ Source:
+
+
+
+ The function
+ This function is deprecated and should not be used in new applications.
+
+ Source:
+
+
+
+ The function
+ 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:
+
+
+
+ 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
+ In order to conserve resources, some debugging information is
+disabled when libcomedi is compiled.
+
+ The meaning of the loglevels is as follows:
+
+ Bugs: Libcomedi doesn't currently have much debugging information.
+ Source:
+
+
+ Opens a comedi device specified by the filename
+ You are not supposed to have access to the internals of the
+ Bugs: Not strictly identical to Source:
+
+
+
+ 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
+ These functions are intended to mimic the behavior of the
+standard C library functions The function Bugs: Does not support internationalization.
+ Source:
+
+
+
+ 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
+ These functions are intended to mimic the behavior of the
+standard C library functions The function Bugs: Does not support internationalization.
+ Source:
+
+
+
+
+ Bugs: comedi_sv_* was very poorly designed.
+ Source:
+
+
+
+ The function Source:
+
+
+
+ Source:
+
+
+
+ Converts data given in sample values (lsampl_t, between 0 and
+maxdata) into physical units (double). The parameter Source:
+
+
+
+ The function Lifetime: removal at 1.0.
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ defined in
+
+ defined in
+
+
+
+
+
+
+
+
+
+
+
+
+ Closes a device previously opened by comedi_open().
+ Source:
+
+ Reads a single sample on the channel that
+is specified by the comedi device On sucess, Valid analog reference numbers are:
+
+ Valid data values used by these function is an unsigned integer
+less than or equal to Source:
+
+
+ Writes a single sample on the channel that
+is specified by the comedi device On sucess, Valid analog reference numbers are:
+
+ Valid data values used by these functions is an unsigned integer
+less than or equal to Source:
+
+
+ int comedi_dio_bitfield(comedi_t *it,unsigned int subd,unsigned int write_mask,
+unsigned int *bits);
+ Source:
+
+ The function
+ Valid directions are:
+ Source:
+
+ The function reads the status of channel Source:
+
+ The function writes the value of Source:
+
+
+ The function Source:
+
+
+
+ The function Valid units are:
+
+ Source:
+
+
+
+ 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
+ These functions are intended to mimic the behavior of the
+standard C library functions The function Source:
+
+
+
+ The function For subdevice types, see the manual page for the function
+ Source:
+
+
+
+ Converts data given in physical units (double) into sample values (lsampl_t, between 0 and maxdata).
+The parameter Source:
+
+
+
+ The function Source:
+
+
+
+ The function Source:
+
+
+
+ The function Source:
+
+
+
+ The function Source:
+
+
+
+ The function Source:
+
+
+
+ The function Source:
+
+
+
+ The function Source:
+
+
+ The function The macro
+ Source:
+
+
+ The function Valid subdevice types are:
+
+ Source:
+
+
+
+ Supported timers are:
+
+ Source:
+
+
+ The function Source:
+
+
+ This function affects the output of debugging and error messages
+from comedlib. By increasing the loglevel, additional debugging
+information will be printed. This function returns the previous
+loglevel. Some debugging information will only be printed if
+comedilib was compiled with this debugging information included.
+The loglevel can also be affected by the environment
+variable COMEDI_LOGLEVEL. The meaning of the loglevels is as
+follows:
+ COMEDILIB_LOGLEVEL=0
+ Comedilib prints nothing.
+ COMEDILIB_LOGLEVEL=1 (default)
+ Comedilib only prints error messages when there is a
+self-consistency error.
+ COMEDILIB_LOGLEVEL=2
+ Comedilib prints an error message whenever an invalid
+parameter is passed to comedilib.
+ COMEDILIB_LOGLEVEL=3
+ Comedilib prints an error message whenever an error is generated
+in the comedilib library or is generated in the C library when
+called by comedilib.
+ COMEDILIB_LOGLEVEL=4
+ Comedilib prints a lot of debugging messages.
+
+ Source:
+
+
+ Opens a comedi device specified by the filename fn. Returns NULL
+on error. Returns a handle that is given as a parameter to other
+comedilib functions.
+ You are not supposed to have access to the structure comedi_t.
+ Source:
+
+
+
+ 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
+ These functions are intended to mimic the behavior of the
+standard C library functions The function Source:
+
+
+
+ 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
+ These functions are intended to mimic the behavior of the
+standard C library functions The function Valid error strings are:
+
+ Source:
+
+
+
+ The special functions By averaging many A/D conversions of a relatively constant
+signal, it is possible to get a better measurement of the signal
+than a single A/D conversion. In general, the uncertainty of the
+measurement decreases as the square root of the number of samples.
+This is limited by the rate that which the signal varies, and
+ultimately by the spurious free dynamic range of the A/D converter.
+ Source:
+
+
+
+ Source:
+
+
+
+ Source:
+
+
+
+ Converts data given in sample values (lsampl_t, between 0 and maxdata) into physical units (double).
+The parameter Source:
+
+
+
+ The function Complete information about comedi commands is given in the
+manual page comedi(8).
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1. Libcomedi Reference
+
+1.1 Constants and Macros
+
+
+RANGE_LENGTH() (deprecated)
+
+RANGE_LENGTH(rangetype)
+1.2 Data Types and Structures
+
+
+ comedi_t
+
+comedi_t
is used to represent an open Comedi
+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.
+ sampl_t
+
+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.
+ lsampl_t
+
+lsampl_t
is one of the generic types used to represent
+data values in libcomedi. It is currently defined to be unsigned int
.
+ comedi_trig_struct (deprecated)
+
+comedi_trig
structure
+
+
+
+struct comedi_trig_struct{
+ unsigned int subdev; /* subdevice */
+ unsigned int mode; /* mode */
+ unsigned int flags;
+ unsigned int n_chan; /* number of channels */
+ unsigned int *chanlist; /* channel/range list */
+ sampl_t *data; /* data list, size depends on subd flags */
+ unsigned int n; /* number of scans */
+ unsigned int trigsrc;
+ unsigned int trigvar;
+ unsigned int trigvar1;
+ unsigned int data_len;
+ unsigned int unused[3];
+}
+
+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.
+ comedi_sv_t
+
+
+
+
+struct comedi_sv_struct{
+ comedi_t *dev;
+ unsigned int subdevice;
+ unsigned int chan;
+
+ /* range policy */
+ int range;
+ int aref;
+
+ /* number of measurements to average (for ai) */
+ int n;
+
+ lsampl_t maxdata;
+}
+
+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.
+1.3 Functions
+
+
+ comedi_close()
+
+void comedi_close(comedi_t *it);
+int
, in
+order to match fclose
.
+/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);
+it
, the
+subdevice subd
, and the channel chan
.
+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.
+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
.
+comedi_data_read()
returns 0. If there is an
+error, -1 is returned.
+
+
+maxdata
, which is channel-dependent.
+Conversion of these data value to physical units can be performed
+by
+comedi_to_phys()
.
+/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);
+it
, the
+subdevice subd
, and the channel chan
.
+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.
+comedi_data_write()
writes the data value
+specified by the argument data
to
+the specified channel.
+comedi_data_write()
returns 0. If there is an error, -1 is
+returned.
+
+
+maxdata
, which is channel-dependent.
+Conversion of physical units to these data value can be performed
+by
+comedi_from_phys()
.
+/lib/data.c
+comedi_dio_bitfield();
+
+int comedi_dio_bitfield(comedi_t *it,unsigned int subd,unsigned
+int write_mask,unsigned int *bits);
+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
+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
.
+/lib/dio.c
+comedi_dio_config()
+
+int comedi_dio_config(comedi_t *it,unsigned int subd,unsigned
+int chan,unsigned int dir);
+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
.
+
+
+/lib/dio.c
+comedi_dio_read()
+
+int comedi_dio_read(comedi_t *it,unsigned int subd,unsigned int
+chan,unsigned int *bit);
+chan
belonging to the digital
+input subdevice subd
of device it
. The result, 0 or 1, is stored
+in bit. Returns -1 on failure.
+comedi_data_read(it,subd,chan,0,0,bit)
.
+/lib/dio.c
+comedi_dio_write()
+
+int comedi_dio_write(comedi_t *it,unsigned int subd,unsigned
+int chan,unsigned int bit);
+bit
, 0 or 1, to channel chan
,
+belonging to the digital output device subd
of device it
. Returns
+-1 on failure.
+/lib/dio.c
+comedi_fileno()
+
+int comedi_fileno(comedi_t *it);
+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.
+/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);
+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.
+
+
+/lib/range.c
+ comedi_errno()
+
+int comedi_errno(void);
+comedi_errno()
+returns an integer describing the most recent comedilib error. This
+integer may be used as the errnum
parameter for
+
+comedi_strerror()
.
+comedi_errno()
. This error number can be
+converted to a human-readable form by the functions
+
+comedi_perror()
+and
+comedi_strerror()
.
+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.
+/lib/error.c
+comedi_find_subdevice_by_type()
+
+int comedi_find_subdevice_by_type(comedi_t *it,int type,unsigned int
+start_subdevice);
+comedi_find_subdevice_by_type
tries to
+locate a subdevice belonging to comedi device it
,
+having type type
, starting with the subdevice
+start_subdevice
. If it finds the requested 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.
+
+comedi_get_subdevice_type()
.
+/lib/get.c
+ comedi_from_phys()
+
+lsampl_t comedi_from_phys(double data, comedi_range *rng,
+lsampl_t maxdata);
+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.
+/lib/range.c
+comedi_get_board_name()
+
+char *comedi_get_board_name(comedi_t *it);
+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.
+/lib/get.c
+comedi_get_driver_name()
+
+char *comedi_get_driver_name(comedi_t *it);
+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.
+/lib/get.c
+comedi_get_maxdata()
+
+lsampl_t comedi_get_maxdata(comedi_t *it,unsigned int
+subdevice,unsigned int chan);
+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.
+/lib/get.c
+comedi_get_n_channels()
+
+int comedi_get_n_channels(comedi_t *it,unsigned int subdevice);
+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.
+/lib/get.c
+comedi_get_n_ranges()
+
+int comedi_get_n_ranges(comedi_t *it,unsigned int subdevice, unsigned int
+chan);
+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.
+/lib/range.c
+comedi_get_n_subdevices()
+
+int comedi_get_n_subdevices(comedi_t *it);
+comedi_get_n_subdevices
returns the
+number of subdevices associated with the comedi descriptor
+it
, or -1 if there is an error.
+/lib/get.c
+comedi_get_range()
+
+comedi_range * comedi_get_range(comedi_t *it,unsigned int subdevice,unsigned int chan,unsigned int
+range);
+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.
+/lib/get.c
+comedi_get_rangetype()
+
+int comedi_get_rangetype(comedi_t *it,unsigned int subdevice,unsigned int
+chan);
+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.
+RANGE_LENGTH(rangetype)
+can be used to determine the number of range specifications for a given
+range type.
+/lib/get.c
+ comedi_get_subdevice_type()
+
+int comedi_get_subdevice_type(comedi_t *it,unsigned int subdevice);
+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.
+
+
+COMEDI_SUBD_UNUSED
+Subdevice has no functionality, i.e., a place-holder.COMEDI_SUBD_AI
Analog inputCOMEDI_SUBD_AO
Analog outputCOMEDI_SUBD_DI
Digital inputCOMEDI_SUBD_DO
Digital outputCOMEDI_SUBD_DIO
+Digital input/output. Channels are configurable as to whether they
+are inputs or outputs.COMEDI_SUBD_COUNTER
CounterCOMEDI_SUBD_TIMER
TimerCOMEDI_SUBD_MEMORY
+Memory, e.g., EEPROM or dual-ported RAMCOMEDI_SUBD_CALIB
+Calibration DACsCOMEDI_SUBD_PROC
+Processor or DSP/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);
+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.
+/lib/timer.c
+comedi_get_version_code()
+
+int comedi_get_version_code(comedi_t *it);
+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.
+/lib/get.c
+comedi_loglevel()
+
+int comedi_loglevel(int loglevel);
+stderr
. The loglevel can also be affected by the
+environment variable COMEDI_LOGLEVEL.
+
+
+COMEDILIB_LOGLEVEL=0
+
+Comedilib prints nothing.
+COMEDILIB_LOGLEVEL=1
(default)
+
+Comedilib only prints error messages when there is a
+self-consistency error (i.e., internal bug).
+COMEDILIB_LOGLEVEL=2
+
+Comedilib prints an error message when an invalid
+parameter is passed to comedilib.
+COMEDILIB_LOGLEVEL=3
+
+Comedilib prints an error message whenever an error is generated
+in the comedilib library or is generated in the C library when
+called by comedilib.
+COMEDILIB_LOGLEVEL=4
+
+Comedilib prints a lot of debugging messages.
+/lib/error.c
+comedi_open()
+
+comedi_t *comedi_open(char *filename);
+filename
.
+Returns NULL on error. On sucess, it returns a handle that is
+given as a parameter to other libcomedi functions.
+comedi_t
structure.
+fopen
+/lib/comedi.c
+ comedi_perror()
+
+void comedi_perror(const char *s);
+
+comedi_errno()
.
+This error number can be
+converted to a human-readable form by the functions
+comedi_perror()
+and
+comedi_strerror()
.
+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.
+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.
+/lib/error.c
+ comedi_strerror()
+
+*comedi_strerror(int errnum);
+
+comedi_errno()
. This error number can be
+converted to a human-readable form by the functions
+
+comedi_perror()
+and comedi_strerror()
.
+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.
+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.
+/lib/error.c
+comedi_sv_init()
+
+int comedi_sv_init(comedi_sv_t *sv,comedi_t *dev,unsigned int subd,
+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.
+/lib/sv.c
+comedi_sv_update()
+
+int comedi_sv_update(comedi_sv_t *sv);
+comedi_sv_update
updates the slow varying comedi structure
+sv
.
+Returns zero on success, -1 on error.
+/lib/sv.c
+int comedi_sv_measure()
+
+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.
+/lib/sv.c
+ comedi_to_phys()
+
+double comedi_to_phys(lsampl_t data, comedi_range *rng,
+lsampl_t maxdata);
+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.
+/lib/range.c
+comedi_trigger() (deprecated)
+
+int comedi_trigger(comedi_t *it,comedi_trig *trig);
+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.
+/lib/comedi.c
+comedi_get_timer()
+
+
+
+
+int comedi_get_timer(comedi_t *it,unsigned int subdev,double freq,unsigned int *trigvar,
+ double *actual_freq);
+
+
+Next
+Previous
+Contents
+
+
diff --git a/doc/comedilib_reference-2.html b/doc/comedilib_reference-2.html
new file mode 100644
index 0000000..2cb01a9
--- /dev/null
+++ b/doc/comedilib_reference-2.html
@@ -0,0 +1,39 @@
+
+
+
+
+
+2. Reference Comedilib-0.7.9: types
+
+2.1 sampl_t
+
+
+comedi.h
+correspond to unsigned int
+type of the sample data
+ 2.2 comedi_sv_t
+
+
+comedilib.h
+correspond to
+comedi_sv_struct
+
+Next
+Previous
+Contents
+
+
diff --git a/doc/comedilib_reference-3.html b/doc/comedilib_reference-3.html
new file mode 100644
index 0000000..3fe7b6f
--- /dev/null
+++ b/doc/comedilib_reference-3.html
@@ -0,0 +1,72 @@
+
+
+
+
+
+3. Reference Comedilib-0.7.9: structures
+
+ 3.1 comedi_trig_struct
+
+
+
+
+
+struct comedi_trig_struct{
+ unsigned int subdev; /* subdevice */
+ unsigned int mode; /* mode */
+ unsigned int flags;
+ unsigned int n_chan; /* number of channels */
+ unsigned int *chanlist; /* channel/range list */
+ sampl_t *data; /* data list, size depends on subd flags */
+ unsigned int n; /* number of scans */
+ unsigned int trigsrc;
+ unsigned int trigvar;
+ unsigned int trigvar1;
+ unsigned int data_len;
+ unsigned int unused[3];
+}
+
+ 3.2 comedi_sv_struct
+
+
+
+
+
+struct comedi_sv_struct{
+ comedi_t *dev;
+ unsigned int subdevice;
+ unsigned int chan;
+
+ /* range policy */
+ int range;
+ int aref;
+
+ /* number of measurements to average (for ai) */
+ int n;
+
+ lsampl_t maxdata;
+}
+
+
+Next
+Previous
+Contents
+
+
diff --git a/doc/comedilib_reference-4.html b/doc/comedilib_reference-4.html
new file mode 100644
index 0000000..47fadff
--- /dev/null
+++ b/doc/comedilib_reference-4.html
@@ -0,0 +1,646 @@
+
+
+
+
+
+4. Reference Comedilib-0.7.9: functions
+
+4.1 comedi_close()
+
+
+void comedi_close(comedi_t *it);
+/lib/comedi.c
+4.2 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);
+it
, the
+subdevice subd
, and the channel chan
.
+For the operation,
+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.
+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
.
+comedi_data_read()
returns 0. If there is an error, -1 is
+returned.
+
+
+maxdata
, which is channel-dependent.
+Conversion of these data value to physical units can be performed
+by
+comedi_to_phys()
.
+/lib/data.c
+4.3 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);
+it
, the
+subdevice subd
, and the channel chan
.
+For the operation,
+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.
+comedi_data_write()
writes the data value
+specified by the argument data
to
+the specified channel.
+comedi_data_write()
returns 0. If there is an error, -1 is
+returned.
+
+
+maxdata
, which is channel-dependent.
+Conversion of physical units to these data value can be performed
+by
+comedi_from_phys()
.
+/lib/data.c
+4.4 comedi_dio_bitfield();
+
+
+/lib/dio.c
+4.5 comedi_dio_config()
+
+
+int comedi_dio_config(comedi_t *it,unsigned int subd,unsigned int chan,unsigned int dir);
+comedi_dio_config
configures the direction dir
of
+channel chan
belonging to the configurable digital input/output subdevice
+subd
of the device it
. Returns -1 on failure.
+
+
+/lib/dio.c
+4.6 comedi_dio_read()
+
+
+int comedi_dio_read(comedi_t *it,unsigned int subd,unsigned int chan,unsigned int *bit);
+chan
belonging to the digital
+input subdevice subd
of device it
. The result, 0 or 1, is stored
+in bit. Returns -1 on failure.
+/lib/dio.c
+4.7 comedi_dio_write()
+
+
+int comedi_dio_write(comedi_t *it,unsigned int subd,unsigned int chan,unsigned int bit);
+bit
, 0 or 1, in channel chan
,
+belonging to the digital output device subd
of device it
. Returns
+-1 on failure.
+/lib/dio.c
+4.8 comedi_fileno()
+
+
+int comedi_fileno(comedi_t *it);
+comedi_fileno
+returns the integer descriptor for the handle it
. If
+it
is an invalid comedi_t
pointer, the function
+returns -1 and sets the appropriate comedilib error value.
+/lib/comedi.c
+4.9 comedi_find_range()
+
+
+int comedi_find_range(comedi_t *it, unsigned int subdevice, unsigned
+int chan, unsigned int unit, double min, double max);
+comedi_find_range
tries to
+locate the optimal (smallest) range of a channel chan
belonging to a
+subdevice
of the comedi device it
, which includes the data
+range between min
and max
in units
with highest
+precision. If it finds a matching range,
+it returns its index. If no matching range is available, it returns -1.
+
+
+/lib/range.c
+ 4.10 comedi_errno()
+
+
+int comedi_errno(void);
+comedi_errno()
. This error number can be
+converted to a human-readable form by the functions
+
+comedi_perror()
+and
+comedi_strerror()
.
+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.
+comedi_errno()
+returns an integer describing the most recent comedilib error. This
+integer may be used as the errnum
parameter for
+
+comedi_strerror()
.
+/lib/error.c
+4.11 comedi_find_subdevice_by_type()
+
+
+int comedi_find_subdevice_by_type(comedi_t *it,int type,unsigned int
+start_subdevice);
+comedi_find_subdevice_by_type
tries to
+locate a subdevice belonging to comedi device it
,
+having type type
, starting with the subdevice
+start_subdevice
. If it finds the requested 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.
+
+comedi_get_subdevice_type()
.
+/lib/get.c
+ 4.12 comedi_from_phys()
+
+
+lsampl_t comedi_from_phys(double data, comedi_range *rng, lsampl_t maxdata);
+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.
+/lib/range.c
+4.13 comedi_get_board_name()
+
+
+char *comedi_get_board_name(comedi_t *it);
+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.
+/lib/get.c
+4.14 comedi_get_driver_name()
+
+
+char *comedi_get_driver_name(comedi_t *it);
+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.
+/lib/get.c
+4.15 comedi_get_maxdata()
+
+
+lsampl_t comedi_get_maxdata(comedi_t *it,unsigned int subdevice,unsigned int
+chan);
+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.
+/lib/get.c
+4.16 comedi_get_n_channels()
+
+
+int comedi_get_n_channels(comedi_t *it,unsigned int subdevice);
+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.
+/lib/get.c
+4.17 comedi_get_n_ranges()
+
+
+int comedi_get_n_ranges(comedi_t *it,unsigned int subdevice, unsigned int
+chan);
+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.
+/lib/range.c
+4.18 comedi_get_n_subdevices()
+
+
+int comedi_get_n_subdevices(comedi_t *it);
+comedi_get_n_subdevices
returns the
+number of subdevices associated with the comedi descriptor
+it
, or -1 if there is an error.
+/lib/get.c
+4.19 comedi_get_range()
+
+
+comedi_range * comedi_get_range(comedi_t *it,unsigned int subdevice,unsigned int chan,unsigned int
+range);
+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.
+/lib/get.c
+4.20 comedi_get_rangetype()
+
+
+int comedi_get_rangetype(comedi_t *it,unsigned int subdevice,unsigned int
+chan);
+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.
+RANGE_LENGTH(rangetype)
+can be used to determine the number of range specifications for a given
+range type.
+/lib/get.c
+ 4.21 comedi_get_subdevice_type()
+
+
+int comedi_get_subdevice_type(comedi_t *it,unsigned int subdevice);
+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.
+
+
+COMEDI_SUBD_UNUSED
+Subdevice has no functionality, i.e., a place-holder.COMEDI_SUBD_AI
Analog inputCOMEDI_SUBD_AO
Analog outputCOMEDI_SUBD_DI
Digital inputCOMEDI_SUBD_DO
Digital outputCOMEDI_SUBD_DIO
+Digital input/output. Channels are configurable as to whether they
+are inputs or outputs.COMEDI_SUBD_COUNTER
CounterCOMEDI_SUBD_TIMER
TimerCOMEDI_SUBD_MEMORY
+Memory, e.g., EEPROM or dual-ported RAMCOMEDI_SUBD_CALIB
+Calibration DACsCOMEDI_SUBD_PROC
+Processor or DSP/lib/get.c
+4.22 comedi_get_timer()
+
+
+
+
+
+int comedi_get_timer(comedi_t *it,unsigned int subdev, double freq,unsigned int *trigvar,
+ double *actual_freq);
+
+comedi_get_timer
returns the type of the timer of the subdevice
+subdev
of the device it
,
+
+
+/lib/timer.c
+4.23 comedi_get_version_code()
+
+
+int comedi_get_version_code(comedi_t *it);
+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.
+/lib/get.c
+4.24 comedi_loglevel()
+
+
+int comedi_loglevel(int loglevel);
+/lib/error.c
+4.25 comedi_open()
+
+
+comedi_t *comedi_open(char *fn);
+/lib/comedi.c
+ 4.26 comedi_perror()
+
+
+void comedi_perror(const char *s);
+
+comedi_errno()
.
+This error number can be
+converted to a human-readable form by the functions
+comedi_perror()
+and
+comedi_strerror()
.
+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.
+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.
+/lib/error.c
+ 4.27 comedi_strerror()
+
+
+*comedi_strerror(int errnum);
+
+comedi_errno()
. This error number can be
+converted to a human-readable form by the functions
+
+comedi_perror()
+and comedi_strerror()
.
+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.
+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 comedilib call. An unrecognized error number will
+return a pointer to the string "undefined error", or similar.
+
+
+"No error"
"Unknown error
"Bad comedi_t structure"
"Invalid subdevice"
"Invalid channel"
/lib/error.c
+4.28 comedi_sv_init()
+
+
+int comedi_sv_init(comedi_sv_t *sv,comedi_t *dev,unsigned int subd,
+unsigned int chan);
+comedi_sv_*()
are designed to
+make it easy to accurately measure slowly varying analog inputs.
+A slowly varying input is one that is effectively constant over the course
+of approximately 100 A/D conversions. However, since these
+conversions can sometimes be pre-empted by scheduling, for most
+purposes, a slowly varying signal should be effectively constant
+for greater than 20 ms (the default Linux timeslice).
+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. Default number of averaged samples is 100.
+Returns zero on success, -1 on error.
+/lib/sv.c
+4.29 comedi_sv_update()
+
+
+int comedi_sv_update(comedi_sv_t *sv);
+comedi_sv_update
updates the slow varying comedi structure
+sv
.
+Returns zero on success, -1 on error.
+/lib/sv.c
+4.30 int comedi_sv_measure()
+
+
+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.
+/lib/sv.c
+ 4.31 comedi_to_phys()
+
+
+double comedi_to_phys(lsampl_t data, comedi_range *rng, lsampl_t maxdata);
+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.
+/lib/range.c
+4.32 comedi_trigger()
+
+
+int comedi_trigger(comedi_t *it,comedi_trig *trig);
+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.
+/lib/comedi.c
+4.33 comedi_get_timer()
+
+
+
+
+
+int comedi_get_timer(comedi_t *it,unsigned int subdev,double freq,unsigned int *trigvar,
+ double *actual_freq);
+
+
+Next
+Previous
+Contents
+
+
diff --git a/doc/comedilib_reference.html b/doc/comedilib_reference.html
new file mode 100644
index 0000000..7062fdb
--- /dev/null
+++ b/doc/comedilib_reference.html
@@ -0,0 +1,31 @@
+
+
+
+
+
+Comedi Documentation
+
+David Schleef,
+ds@stm.lbl.gov
1. Libcomedi Reference
+
+
+
+Next
+Previous
+Contents
+
+
diff --git a/doc/comedilib_reference.sgml b/doc/comedilib_reference.sgml
new file mode 100644
index 0000000..7298334
--- /dev/null
+++ b/doc/comedilib_reference.sgml
@@ -0,0 +1,878 @@
+
+
+