diff --git a/doc/comedilib.sgml b/doc/comedilib.sgml index da0ebd9..7f54c29 100644 --- a/doc/comedilib.sgml +++ b/doc/comedilib.sgml @@ -473,9 +473,36 @@ 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. +Individual digital lines can be read and written using the +functions + + Timed Input/Output -
+
-
-Reference of structures:
+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.
-
-
-int comedi_loglevel(int loglevel);
-
-
-
-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.
-
-
-
-
-
-comedi_t *comedi_open(char *fn);
-
-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.
-
-void comedi_close(comedi_t *it);
-
-Closes a device previously opened by comedi_open().
-
-void comedi_perror(const char *s);
-char *comedi_strerror(int errnum);
-int comedi_errno(void);
-
-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
-comedi_errno(). This error number can be
-converted to a human-readable form by the functions
-comedi_perror() 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.
-
-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.
-
-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 comedilib call. An unrecognized error number will
-return a pointer to the string "undefined error", or similar.
-
-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().
-
-
-
-
-int comedi_fileno(comedi_t *it);
-
-The function 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.
-
-
-
-
-
-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.
-
-
-
-
-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 0x010203, which is the version code for
-version 1.2.3.
-
-
-
-
-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.
-
-
-
-
-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.
-
-
-
-
-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:
+Each of these 5 types of events are caused by a triggering
+source. The source types are:
-
+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.
-int comedi_find_subdevice_by_type(comedi_t *it,int type,unsigned int 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
-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.
-
-For subdevice types, see the manual page for the function
-comedi_get_subdevice_type().
-
-
-
+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.
-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.
-
-
-
-
-lsampl_t comedi_get_maxdata(comedi_t *it,unsigned int 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.
-
-
-
-
-int comedi_get_rangetype(comedi_t *it,unsigned int subdevice,unsigned int chan);
-
-The function comedi_get_rangetype() returns an integer
-that represents the number of range specifications available for a
-particular channel, as well as a conversion table to convert sample
-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.
-
-
-
-
-comedi_range * comedi_get_range(comedi_t *it,unsigned int subdevice,unsigned int chan,unsigned int 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.
-
-
-
-
-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.
-
-Complete information about comedi commands is given in the
-manual page comedi(8).
-
-double comedi_to_phys(lsampl_t data,comedi_range *rng,lsampl_t maxdata);
-lsampl_t comedi_from_phys(double data,comedi_range *rng,lsampl_t maxdata);
-
-The functions comedi_to_phys() and
-comedi_from_phys() convert sample values to/from physical
-units. 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/
-will be written to.
-
-
-int comedi_data_read(comedi_t *it,unsigned int subd,unsigned int chan,
- unsigned int range,unsigned int aref,lsampl_t *data);
-int comedi_data_write(comedi_t *it,unsigned int subd,unsigned int chan,
- unsigned int range,unsigned int aref,lsampl_t data);
-
-These functions read or write a single sample on the channel that
-is specified by the comedi device 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.
-
-The function 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.
-
-The function comedi_data_write() writes the data value
-specified by the argument data to
-the specified channel.
-
-On sucess, these functions return 0. If there is an error, -1 is
-returned.
-
-Valid analog reference numbers are:
-
-
-
-
-
-
-
-
-
diff --git a/doc/comedilib_reference.sgml b/doc/comedilib_reference.sgml
index 7298334..f936baf 100644
--- a/doc/comedilib_reference.sgml
+++ b/doc/comedilib_reference.sgml
@@ -49,7 +49,7 @@ device. A valid
@@ -99,9 +99,11 @@ struct comedi_trig_struct{
The
+This structure is defined as part of the Comedi kernel interface.
+