From: David Schleef Date: Tue, 10 Jul 2001 22:23:29 +0000 (+0000) Subject: Remove comedilib_reference, rebuild comedilib*html X-Git-Tag: r0_7_16~40 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0f8fd728ae4b788169a98dc56421ce572187c8d5;p=comedilib.git Remove comedilib_reference, rebuild comedilib*html --- diff --git a/doc/comedilib-4.html b/doc/comedilib-4.html index b0c5984..e8fa9e5 100644 --- a/doc/comedilib-4.html +++ b/doc/comedilib-4.html @@ -36,12 +36,11 @@ int aref = AREF_GROUND; /* more on this later */ int main(int argc,char *argv[]) { comedi_t *it; - int chan=0; lsampl_t data; - + it=comedi_open("/dev/comedi0"); - comedi_data_read(it,subdev,chan,range,aref,& data); + comedi_data_read(it,subdev,chan,range,aref,&data); printf("%d\n",data); @@ -51,10 +50,10 @@ int main(int argc,char *argv[])

-

Should be understandable. Open the device, get the data, +

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

@@ -74,7 +73,7 @@ aref, which determines the analog reference used.

-

If you selected an analog input subdevice, you should notice +

If you selected an analog input subdevice, you probably noticed that the output of tut1 is a number between 0 and 4095, or 0 and 65535, depending on the number of bits in the A/D converter. Comedi samples are always unsigned, @@ -89,7 +88,7 @@ manner?"

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 +for analog output.) The range parameter represents both the gain and the unipolar/bipolar aspects.

Comedi keeps the number of available ranges and the largest sample value for each subdevice/channel combination. (Some @@ -205,7 +204,7 @@ that we've added what we've learned.

 #include <stdio.h>      /* for printf() */
 #include <comedi.h>     /* also included by comedilib.h */
-#include <comedilib.h>  /* for comedi_get() */
+#include <comedilib.h>  /* 'cuz we're using comedilib */
 
 int subdev = 0;         /* change this to your input subdevice */
 int chan = 0;           /* change this to your channel */
@@ -216,7 +215,7 @@ int main(int argc,char *argv[])
 {
         comedi_t *cf;
         int chan=0;
-        int data;
+        lsampl_t data;
         int maxdata,rangetype;
         double volts;
 
@@ -226,7 +225,7 @@ int main(int argc,char *argv[])
 
         rangetype=comedi_get_rangetype(cf,subdev,chan);
 
-        data=comedi_get(cf->fd,subdev,chan,range,aref);
+        comedi_data_read(cf->fd,subdev,chan,range,aref,&data);
 
         volts=comedi_to_phys(data,rangetype,range,maxdata);
 
@@ -238,14 +237,6 @@ 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.

-
diff --git a/doc/comedilib-5.html b/doc/comedilib-5.html index 935786f..311824d 100644 --- a/doc/comedilib-5.html +++ b/doc/comedilib-5.html @@ -3,11 +3,12 @@ Comedi Documentation: Application-specific functions + -Next +Next Previous Contents
@@ -109,8 +110,13 @@ is only accurate to part-per-thousand.

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.

+of acquisition. The +comedi_cmd structure is +used to control acquisition and query the capabilities of a device +(see also +comedi_command(), +comedi_command_test(), and +comedi_get_cmd_src_mask()).

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 @@ -118,41 +124,120 @@ 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:

+source, specified through the *_src members of the +comedi_cmd structure. The source types are:

+

For every trigger, there is a corresponding +argument (the *_arg members of the +comedi_cmd +structure) whose meaning depends on the type of trigger. The meanings +of the arguments are as follows:

+

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.

- +device.

+

TRIG_NONE is typically used only as a stop_src. The arg for TRIG_NONE +is reserved and should be set to 0.

+

TRIG_NOW is most often used as a start_src. The arg for TRIG_NOW is +the number of nanoseconds between when the command is issued and when +the event should occur. In the case of using TRIG now as a start_src, +it indicates a delay between issuing the command and the start of +acquisition. Most drivers only support a delay of 0.

+

TRIG_FOLLOW is a special type of trigger for events that trigger on +the completion of some other, logically connected event. The argument +is reserved and should be set to 0. When used +as a scan_begin_src, it indicates that a trigger should occur as a +logical continuation of convert events. This is done in order to +properly describe boards that do not have separate timers for +convert and scan_begin events. When used as a start_src for analog +output subdevices, it indicates that conversion of output samples +should begin when samples are written to the buffer.

+

TRIG_TIME is reserved for future use.

+

TRIG_TIMER is most often used as a convert_src, a scan_begin_src, or +both. It indicates that triggers should occur at a specific rate. +The argument specifies the interval between triggers in nanoseconds.

+

TRIG_COUNT is used for scan_end_src and stop_src. It indicates that +a trigger should occur when the specified number of corresponding +lower-level triggers (convert and scan_begin, respectively) occur. +The argument is the count of lower-level triggers.

+

TRIG_EXT can be useful as any of the trigger sources. It indicates +that an external digital line should be used to trigger the event. +The exact meaning of digital line is device-dependent. Some devices +have one dedicated line, others may allow generic digital input +lines to be used. The argument indicates the particular external +line to use as the trigger.

+

TRIG_INT is typically used as a start_src. This trigger occurs when +the application performs an INSN_INTTRIG instruction. Using TRIG_INT +is a method by which the application can accurately record the time of +the start of acquisition, since the parsing and setup time of a +particular command may be significant. The argument associated with +TRIG_INT is reserved and should be set to 0.

+

TRIG_OTHER can be useful as any of the trigger sources. The exact +meaning of TRIG_OTHER is driver-specific, and implements a feature +that otherwise does not fit into the command interface. Configuration +of TRIG_OTHER features are done by INSN_CONFIG insns. The argument +is reserved and should be set to 0.

+ +

The chanlist member of the +comedi_cmd +structure should point to an array whose number of elements is specificed by chanlist_len +(this will generally be the same as the scan_end_arg). +The chanlist specifies the sequence of channels and gains (and analog references) +that should be stepped through for each scan. The elements of the chanlist array +should be initialized by packing the channel, range and reference information +together with the +CR_PACK(channel, range, aref) macro.

+

The final member of the +comedi_cmd structure is 'flags'. +The following flags are valid, and can be bitwise-or'd together.

+

+

+There are also a few flags that indicate how timing arguments should be rounded +if the hardware cannot achieve the exact timing requested. + +


-Next +Next Previous Contents diff --git a/doc/comedilib-6.html b/doc/comedilib-6.html index 49afcdb..0c2c13e 100644 --- a/doc/comedilib-6.html +++ b/doc/comedilib-6.html @@ -1,8 +1,8 @@ - - Comedi Documentation: Comedilib reference + + Comedi Documentation: Libcomedi Reference @@ -11,21 +11,111 @@ Next Previous Contents
-

6. Comedilib reference

+

6. Libcomedi Reference

-

Reference of structures: + + +

6.1 Constants and Macros +

+ + + +

CR_PACK(channel, range, aref)

+ + +

undocumented

+ +

RANGE_LENGTH() (deprecated)

+ +

+

+

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.

+ +

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.

+ + + +

6.2 Data Types and Structures +

+ + +

comedi_t

+ +

The data type 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 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.

+ + + +

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.

+ + + + + +

comedi_trig_struct (deprecated)

+ + +

The comedi_trig structure

-typedef struct comedi_t_struct comedi_t;
+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];
+}
+
+
+

+

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_trig is +deprecated, and should not be used in new applications.

+ +

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

+ -typedef struct{ - double min; - double max; - unsigned int unit; -}comedi_range; +

comedi_sv_t

-typedef struct comedi_sv_struct{ + +

+

+
+struct comedi_sv_struct{
         comedi_t *dev;
         unsigned int subdevice;
         unsigned int chan;
@@ -33,291 +123,144 @@ typedef struct comedi_sv_struct{
         /* range policy */
         int range;
         int aref;
-        
+
         /* number of measurements to average (for ai) */
         int n;
 
         lsampl_t maxdata;
-}comedi_sv_t;
+}
 
-

-

6.1 comedi_loglevel() -

+

+

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.

-

-

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. -

-

-

-

6.2 comedi_open -

-

-

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(). -

-

-

6.3 comedi_fileno() -

-

-

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. -

-

-

-

6.4 comedi_get_n_subdevices() -

+

comedi_cmd

-

-

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. -

-

-

6.5 comedi_get_version_code() -

-

-

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. -

-

-

6.6 comedi_get_driver_name() -

+

undocumented

-

-

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. -

-

-

6.7 comedi_get_board_name() -

+

Related functions are described in section XXX.

-

-

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. -

-

-

6.8 comedi_get_subdevice_type() -

+

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

-

-

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: -

-

-

-

-

-

6.9 comedi_find_subdevice_by_type() -

-

-

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(). -

-

-

6.10 comedi_get_n_channels() -

+

comedi_insn

-

-

-

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. -

-

-

6.11 comedi_get_maxdata() -

-

-

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. -

-

-

6.12 comedi_get_rangetype() -

+

undocumented

-

-

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. -

-

-

6.13 comedi_get_range() -

+

Related functions are described in section XXX.

-

-

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. -

-

-

6.14 comedi_trigger() -

+

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

-

-

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. -

-

-

-

6.15 comedi_data_read() + + +

comedi_range

+ + +

undocumented

+ + + +

6.3 Functions

-

-

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 + + +

comedi_close()

+ + +

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

+ + +

comedi_command()

+ + +

int comedi_command(comedi_t *it, comedi_cmd *cmd);

+

undocumented

+

Source: /lib/comedi.c

+ + +

comedi_command_test()

+ + +

int comedi_command_test(comedi_t *it, comedi_cmd *cmd);

+

undocumented

+

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);

+ +

Reads a single sample on the channel that is specified by the comedi device it, the subdevice subd, and the channel chan. -For the operation, +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. -

The function comedi_data_read() reads one data value from -the specified channel and places the +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. -

The function comedi_data_write() writes the data value +data.

+ +

On sucess, comedi_data_read() returns 0. If there is an +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_data_write()

+ + +

int comedi_data_write(comedi_t *it,unsigned int subd,unsigned int chan, +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. +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. -

On sucess, these functions return 0. If there is an error, -1 is -returned. -

Valid analog reference numbers are: +the specified channel.

+

On sucess, comedi_data_write() returns 0. If there is an error, -1 is +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 these data values to physical units can be performed -by comedi_to_phys() and comedi_from_phys(). -

-

-

-

6.16 comedi_sv_init() -

+Conversion of physical units to these data value can be performed +by +comedi_from_phys().

+

Source: /lib/data.c

-

-

-

-
-int comedi_sv_init(comedi_sv_t *it,comedi_t *dev,unsigned int subd,unsigned int chan);
-int comedi_sv_update(comedi_sv_t *it);
-int comedi_sv_measure(comedi_sv_t *it,double *data);
-
-
-

The special functions 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). -

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. -

-

-

-

6.17 comedi_get_timer() -

+ +

comedi_dio_bitfield();

+ +

int comedi_dio_bitfield(comedi_t *it,unsigned int subd,unsigned +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 +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.

+ +

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: /lib/dio.c

+ + + +

comedi_dio_config()

+ +

int comedi_dio_config(comedi_t *it,unsigned int subd,unsigned +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.

+ +

Valid directions are: +

+

+

Source: /lib/dio.c

+ + + +

comedi_dio_read()

+ +

int comedi_dio_read(comedi_t *it,unsigned int subd,unsigned int +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

+ + +

comedi_dio_write()

+ +

int comedi_dio_write(comedi_t *it,unsigned int subd,unsigned +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

+ + +

comedi_fileno()

+ + +

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

+ + + +

comedi_find_range()

+ + +

int comedi_find_range(comedi_t *it, unsigned int subdevice, unsigned +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:

+

+

+

+

Source: /lib/range.c

+ + + +

comedi_errno()

+ +

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().

+

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 +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, +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

+ + + +

comedi_find_subdevice_by_type()

+ + +

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().

+

Source: /lib/get.c

+ + + +

comedi_from_phys()

+ + +

lsampl_t comedi_from_phys(double data, comedi_range *rng, +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

+ + + +

comedi_get_board_name()

+ + +

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

+ + +

comedi_get_cmd_src_mask()

+ + +

int comedi_get_cmd_src_mask(comedi_t *dev, unsigned int subdevice, +comedi_cmd *cmd);

+

undocumented

+

Source: /lib/cmd.c

+ + +

comedi_get_driver_name()

+ + +

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

+ + + +

comedi_get_maxdata()

+ + +

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.

+

Source: /lib/get.c

+ + + +

comedi_get_n_channels()

+ + +

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

+ + + +

comedi_get_n_ranges()

+ + +

int comedi_get_n_ranges(comedi_t *it,unsigned int subdevice, unsigned int +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

+ + + +

comedi_get_n_subdevices()

+ + +

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

+ + + +

comedi_get_range()

+ + +

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.

+

Source: /lib/get.c

+ + +

comedi_get_rangetype() deprecated

+ + +

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 chan of the subdevice subdevice, 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.

+ +

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);

+

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:

+

+

+

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);

+ +

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

+ + +

comedi_get_version_code()

+ + +

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.

+ +

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

+ + +

comedi_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.

+ +

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

+ +

The meaning of the loglevels is as follows:

-

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

-

+

+

+

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

+

Source: /lib/error.c

+ + +

comedi_open()

+ + +

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.

+ +

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_perror()

+ + +

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 + +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.

+

Bugs: Does not support internationalization.

+

Source: /lib/error.c

+ + + +

comedi_strerror()

+ + +

*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 + +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_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

+ + + +

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.

+

Bugs: comedi_sv_* was very poorly designed.

+

Source: /lib/sv.c

+ + + +

comedi_sv_update()

+ + +

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

+ + + +

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.

+

Source: /lib/sv.c

+ + + +

comedi_to_phys()

+ + +

double comedi_to_phys(lsampl_t data, comedi_range *rng, +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

+ + + +

comedi_trigger() (deprecated)

+ + +

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_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

+ + +

+

+

+ +
Next Previous diff --git a/doc/comedilib.html b/doc/comedilib.html index 894f950..593b881 100644 --- a/doc/comedilib.html +++ b/doc/comedilib.html @@ -14,7 +14,8 @@ Contents

Comedi Documentation

-

David Schleef, ds@stm.lbl.gov

+

David Schleef ds@stm.lbl.gov, +Frank Hess fmhess@uiuc.edu

1. Introduction

@@ -30,6 +31,9 @@ Contents

5. Application-specific functions

+

+

6. Libcomedi Reference

+
Next Previous diff --git a/doc/comedilib_reference-1.html b/doc/comedilib_reference-1.html deleted file mode 100644 index f8ce382..0000000 --- a/doc/comedilib_reference-1.html +++ /dev/null @@ -1,906 +0,0 @@ - - - - - Comedi Documentation: Libcomedi Reference - - - - -Next -Previous -Contents -
-

1. Libcomedi Reference

- - - -

1.1 Constants and Macros -

- - - - -

RANGE_LENGTH() (deprecated)

- -

-

-

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.

- -

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.

- - - -

1.2 Data Types and Structures -

- - -

comedi_t

- -

The data type 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 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.

- - - -

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.

- - - - - -

comedi_trig_struct (deprecated)

- - -

The 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];
-}
-
-
-

-

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_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

- - -

-

-
-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;
-}
-
-
-

-

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.

- - - -

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().

- -

The return type of this function will change to int, in -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);

- -

Reads a single sample on the channel that -is specified by the comedi device 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.

- -

On sucess, comedi_data_read() returns 0. If there is an -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_data_write()

- - -

int comedi_data_write(comedi_t *it,unsigned int subd,unsigned int chan, -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. -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.

-

On sucess, comedi_data_write() returns 0. If there is an error, -1 is -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_dio_bitfield();

- -

int comedi_dio_bitfield(comedi_t *it,unsigned int subd,unsigned -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 -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.

- -

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: /lib/dio.c

- - - -

comedi_dio_config()

- -

int comedi_dio_config(comedi_t *it,unsigned int subd,unsigned -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.

- -

Valid directions are: -

-

-

Source: /lib/dio.c

- - - -

comedi_dio_read()

- -

int comedi_dio_read(comedi_t *it,unsigned int subd,unsigned int -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

- - -

comedi_dio_write()

- -

int comedi_dio_write(comedi_t *it,unsigned int subd,unsigned -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

- - -

comedi_fileno()

- - -

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

- - - -

comedi_find_range()

- - -

int comedi_find_range(comedi_t *it, unsigned int subdevice, unsigned -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:

-

-

-

-

Source: /lib/range.c

- - - -

comedi_errno()

- -

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().

-

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 -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, -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

- - - -

comedi_find_subdevice_by_type()

- - -

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().

-

Source: /lib/get.c

- - - -

comedi_from_phys()

- - -

lsampl_t comedi_from_phys(double data, comedi_range *rng, -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

- - - -

comedi_get_board_name()

- - -

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

- - - -

comedi_get_driver_name()

- - -

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

- - - -

comedi_get_maxdata()

- - -

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.

-

Source: /lib/get.c

- - - -

comedi_get_n_channels()

- - -

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

- - - -

comedi_get_n_ranges()

- - -

int comedi_get_n_ranges(comedi_t *it,unsigned int subdevice, unsigned int -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

- - - -

comedi_get_n_subdevices()

- - -

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

- - - -

comedi_get_range()

- - -

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.

-

Source: /lib/get.c

- - -

comedi_get_rangetype() deprecated

- - -

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 chan of the subdevice subdevice, 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.

- -

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);

-

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:

-

-

-

-

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);

- -

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

- - -

comedi_get_version_code()

- - -

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.

- -

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

- - -

comedi_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.

- -

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: /lib/error.c

- - -

comedi_open()

- - -

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.

- -

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_perror()

- - -

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 - -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.

-

Bugs: Does not support internationalization.

-

Source: /lib/error.c

- - - -

comedi_strerror()

- - -

*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 - -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_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

- - - -

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.

-

Bugs: comedi_sv_* was very poorly designed.

-

Source: /lib/sv.c

- - - -

comedi_sv_update()

- - -

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

- - - -

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.

-

Source: /lib/sv.c

- - - -

comedi_to_phys()

- - -

double comedi_to_phys(lsampl_t data, comedi_range *rng, -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

- - - -

comedi_trigger() (deprecated)

- - -

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_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

- - - -

-

-

- - - - - - - - - - -
-Next -Previous -Contents - - diff --git a/doc/comedilib_reference-2.html b/doc/comedilib_reference-2.html deleted file mode 100644 index 2cb01a9..0000000 --- a/doc/comedilib_reference-2.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - Comedi Documentation: Reference Comedilib-0.7.9: types - - - - - -Next -Previous -Contents -
-

2. Reference Comedilib-0.7.9: types

- -

-

2.1 sampl_t -

- -

defined in comedi.h -correspond to unsigned int -type of the sample data -

-

-

2.2 comedi_sv_t -

- -

defined in comedilib.h -correspond to -comedi_sv_struct -

-

-


-Next -Previous -Contents - - diff --git a/doc/comedilib_reference-3.html b/doc/comedilib_reference-3.html deleted file mode 100644 index 3fe7b6f..0000000 --- a/doc/comedilib_reference-3.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - Comedi Documentation: Reference Comedilib-0.7.9: structures - - - - - -Next -Previous -Contents -
-

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 deleted file mode 100644 index 47fadff..0000000 --- a/doc/comedilib_reference-4.html +++ /dev/null @@ -1,646 +0,0 @@ - - - - - Comedi Documentation: Reference Comedilib-0.7.9: functions - - - - -Next -Previous -Contents -
-

4. Reference Comedilib-0.7.9: functions

- -

-

-

4.1 comedi_close() -

- -

-

void comedi_close(comedi_t *it); -

Closes a device previously opened by comedi_open(). -

Source: /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); -

Reads 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. -

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. -

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

Valid analog reference numbers are: -

-

-

Valid data values used 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 -

-

-

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); -

Writes 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. -

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

On sucess, comedi_data_write() returns 0. If there is an error, -1 is -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 -

-

-

-

4.4 comedi_dio_bitfield(); -

- -

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

Source: /lib/dio.c -

-

-

4.5 comedi_dio_config() -

- -

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

The function 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. -

-

Valid directions are: -

-

Source: /lib/dio.c -

-

-

4.6 comedi_dio_read() -

- -

int comedi_dio_read(comedi_t *it,unsigned int subd,unsigned int 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. -

Source: /lib/dio.c -

-

-

4.7 comedi_dio_write() -

- -

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

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

Source: /lib/dio.c -

-

-

4.8 comedi_fileno() -

- -

-

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. -

Source: /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); -

The function 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. -

Valid units are: -

-

-

Source: /lib/range.c -

-

-

-

4.10 comedi_errno() -

- -

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_errno() -returns an integer describing the most recent comedilib error. This -integer may be used as the errnum parameter for - -comedi_strerror(). -

Source: /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); -

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(). -

Source: /lib/get.c -

-

-

-

4.12 comedi_from_phys() -

- -

-

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

Converts data given in physical units (double) 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 -

-

-

-

4.13 comedi_get_board_name() -

- -

-

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 -

-

-

-

4.14 comedi_get_driver_name() -

- -

-

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 -

-

-

-

4.15 comedi_get_maxdata() -

- -

-

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. -

Source: /lib/get.c -

-

-

-

4.16 comedi_get_n_channels() -

- -

-

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 -

-

-

-

4.17 comedi_get_n_ranges() -

- -

-

int comedi_get_n_ranges(comedi_t *it,unsigned int subdevice, unsigned int -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 -

-

-

-

4.18 comedi_get_n_subdevices() -

- -

-

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 -

-

-

-

4.19 comedi_get_range() -

- -

-

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. -

Source: /lib/get.c -

-

-

4.20 comedi_get_rangetype() -

- -

-

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 chan of the subdevice subdevice, 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. -

Source: /lib/get.c -

-

-

4.21 comedi_get_subdevice_type() -

- -

-

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: -

-

-

Source: /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 , -

Supported timers are: -

-

-

Source: /lib/timer.c -

-

-

4.23 comedi_get_version_code() -

- -

-

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. -

Source: /lib/get.c -

-

-

4.24 comedi_loglevel() -

- -

-

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. -

-

Source: /lib/error.c -

-

-

4.25 comedi_open() -

- -

-

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. -

Source: /lib/comedi.c -

-

-

-

4.26 comedi_perror() -

- -

-

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 - -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. -

Source: /lib/error.c -

-

-

-

4.27 comedi_strerror() -

- -

-

*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 - -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_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. -

Valid error strings are: -

-

-

Source: /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); -

The special functions 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). -

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. -

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. -

Source: /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. -

Source: /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. -

Source: /lib/sv.c -

-

-

-

4.31 comedi_to_phys() -

- -

-

double comedi_to_phys(lsampl_t data, comedi_range *rng, 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 -

-

-

-

4.32 comedi_trigger() -

- -

-

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). -

Source: /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 deleted file mode 100644 index 78ad784..0000000 --- a/doc/comedilib_reference.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - Comedi Documentation - - - - - -Next -Previous -Contents -
-

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 deleted file mode 100644 index f936baf..0000000 --- a/doc/comedilib_reference.sgml +++ /dev/null @@ -1,998 +0,0 @@ - - -
-Comedi Documentation -<author>David Schleef, <tt/ds@stm.lbl.gov/ - - - - -<sect>Libcomedi Reference -<p> - -<sect1>Constants and Macros -<p> - - -<sect2>RANGE_LENGTH() <it/(deprecated)/ -<p> -<label id="RANGE_LENGTH"> - -<tt/RANGE_LENGTH(rangetype)/ - -<p> -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. - -<p> -The RANGE_LENGTH() macro returns the length of the array that is -specified by the rangetype token. - -<p> -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. - - -<p> -<sect1>Data Types and Structures - -<p> -<sect2>comedi_t -<label id="comedi_t"> - -<p> -The data type <tt/comedi_t/ is used to represent an open Comedi -device. A valid <tt/comedi_t/ pointer is returned by a successful -call to <tt/comedi_open()/, and should be used for subsequent -access to the device. -It is a transparent type, and pointers to type <tt/comedi_t/ -should not be dereferenced by the application. - - -<p> -<sect2>sampl_t -<label id="sampl_t"> - -<p> -The data type <tt/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. - - -<p> -<sect2>lsampl_t -<label id="lsampl_t"> - -<p> -The data type <tt/lsampl_t/ is one of the generic types used to represent -data values in libcomedi. It is currently defined to be <tt/unsigned int/. - - - - -<p> -<sect2>comedi_trig_struct <it/(deprecated)/ -<label id="comedi_trig_struct"> -<p> - -The <tt/comedi_trig/ structure - -<tscreen><verb> -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]; -} -</verb></tscreen> - -The <tt/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_trig is -deprecated, and should not be used in new applications. - -<p> -This structure is defined as part of the Comedi kernel interface. - -<p> -<sect2>comedi_sv_t -<label id="comedi_sv_t"> -<p> - -<tscreen><verb> -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; -} -</verb></tscreen> - -The <tt/comedi_sv_t/ structure is used by the <tt/comedi_sv_*()/ -functions to provide a simple method of accurately measuring -slowly varying inputs. See the relevant section for more -details. - - -<p> -<sect2>comedi_cmd -<label id="comedi_cmd"> -<p> - -undocumented - -<p> -Related functions are described in section XXX. - -<p> -This structure is defined as part of the Comedi kernel interface. - -<p> -<sect2>comedi_insn -<label id="comedi_insn"> -<p> - -undocumented - -<p> -Related functions are described in section XXX. - -<p> -This structure is defined as part of the Comedi kernel interface. - - -<p> -<sect2>comedi_range -<label id="comedi_range"> -<p> - -undocumented - - - -<sect1>Functions -<p> - -<sect2>comedi_close() -<label id="comedi_close"> -<p> - -<tt>void comedi_close(comedi_t *it);</tt> - -<p> -Closes a device previously opened by comedi_open(). - -<p> -The return type of this function will change to <tt/int/, in -order to match <tt/fclose/. - -<p> -Source: <tt>/lib/comedi.c</tt> - - -<sect2>comedi_data_read() -<label id="comedi_data_read"> -<p> - -<tt>int comedi_data_read(comedi_t *it,unsigned int subd,unsigned int chan, - unsigned int range,unsigned int aref,lsampl_t *data);</tt> - -<p> -Reads a single sample on the channel that -is specified by the comedi device <tt>it</tt>, the -subdevice <tt>subd</tt>, and the channel <tt>chan</tt>. -For the A/D conversion (if appropriate), -the device is configured to use range specification -<tt>range</tt> and (if appropriate) analog reference type -<tt>aref</tt>. Analog reference types that are not supported -by the device are silently ignored. - -<p> -<tt>comedi_data_read()</tt> reads one data value from -the specified channel and places the -data value that is read in the location pointed to by -<tt>data</tt>. - -<p> -On sucess, <tt>comedi_data_read()</tt> returns 0. If there is an -error, -1 is returned. - -<p> -Valid analog reference numbers are: - -<itemize> -<item>AREF_GROUND Reference to analog ground -<item>AREF_COMMON Reference to analog common -<item>AREF_DIFF Differential reference -<item>AREF_OTHER Board-specific meaning -</itemize> - -Valid data values returned by these function is an unsigned integer -less than or equal to <tt>maxdata</tt>, which is channel-dependent. -Conversion of these data value to physical units can be performed -by <tt><ref id="comedi_to_phys" name = -"comedi_to_phys()"></tt>. - -Source: <tt>/lib/data.c</tt> - - -<sect2>comedi_data_write() -<p> - -<tt>int comedi_data_write(comedi_t *it,unsigned int subd,unsigned int chan, - unsigned int range,unsigned int aref,lsampl_t data);</tt> - -<p> -Writes a single sample on the channel that -is specified by the comedi device <tt/it/, the -subdevice <tt/subd/, and the channel <tt/chan/. -For the D/A conversion (if appropriate), the device is -configured to use range specification -<tt/range/ and (if appropriate) analog reference type -<tt/aref/. Analog reference types that are not supported -by the device are silently ignored. - -<tt/comedi_data_write()/ writes the data value -specified by the argument <tt/data/ to -the specified channel. - -On sucess, <tt>comedi_data_write()</tt> returns 0. If there is an error, -1 is -returned. - -Valid analog reference numbers are: - -<itemize> -<item>AREF_GROUND Reference to analog ground -<item>AREF_COMMON Reference to analog common -<item>AREF_DIFF Differential reference -<item>AREF_OTHER Board-specific meaning -</itemize> - -Valid data values used by these functions is an unsigned integer -less than or equal to <tt>maxdata</tt>, which is channel-dependent. -Conversion of physical units to these data value can be performed -by <tt><ref id="comedi_from_phys" name = -"comedi_from_phys()"></tt>. - -Source: <tt>/lib/data.c</tt> - - -<p> -<sect2>comedi_dio_bitfield(); - -<p> -<tt/int comedi_dio_bitfield(comedi_t *it,unsigned int subd,unsigned -int write_mask,unsigned int *bits);/ - -<p> -The function <tt/comedi_dio_bitfield()/ allows multiple channels to -be read simultaneously from a digital input or digital I/O device. -The parameter <tt/write_mask/ and the value pointed to by <tt/bits/ -are interpreted as bit fields, with the least significant bit -representing channel 0. For each bit in <tt/write_mask/ that is -set, the cooresponding bit in <tt/*bits/ is written to the digital -output channel. Each digital input channel is read, and the result -placed in the approprate bits in <tt/*bits/. - -<p> -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. - -<p> -It should be noted that it is not possible to access channels -greater than 31 using this function. - -<p> -Source: <tt>/lib/dio.c</tt> - - -<p> -<sect2>comedi_dio_config() -<p> -<tt/int comedi_dio_config(comedi_t *it,unsigned int subd,unsigned -int chan,unsigned int dir);/ - -<p> -The function <tt/comedi_dio_config/ configures individual channels -in a digital I/O subdevice to be either input or output, depending -on the value of parameter <tt/dir/. Depending on the capabilities -of the hardware device, multiple channels may be affected by -a single call to <tt/comedi_dio_config/. - - -Valid directions are: -<itemize> -<item> COMEDI_INPUT -<item> COMEDI_OUTPUT -</itemize> - -Source: <tt>/lib/dio.c</tt> - - -<p> -<sect2>comedi_dio_read() -<p> -<tt/int comedi_dio_read(comedi_t *it,unsigned int subd,unsigned int -chan,unsigned int *bit);/ - -<p> -The function reads the status of channel <tt/chan/ belonging to the digital -input subdevice <tt/subd/ of device <tt/it/. The result, 0 or 1, is stored -in bit. Returns -1 on failure. - -<p> -This function is equivalent to <tt/comedi_data_read(it,subd,chan,0,0,bit)/. - - -Source: <tt>/lib/dio.c</tt> - -<p> -<sect2>comedi_dio_write() -<p> -<tt/int comedi_dio_write(comedi_t *it,unsigned int subd,unsigned -int chan,unsigned int bit);/ - -<p> -The function writes the value of <tt/bit/, 0 or 1, to channel <tt/chan/, -belonging to the digital output device <tt/subd/ of device <tt/it/. Returns --1 on failure. - -<p> -Source: <tt>/lib/dio.c</tt> - -<p> -<sect2>comedi_fileno() -<p> - -<tt/int comedi_fileno(comedi_t *it);/ -<p> - -The function <tt/comedi_fileno/ -returns the integer descriptor for the handle <tt/it/. It -is equivalent to the standard function <tt/fileno/. If -<tt>it</tt> is an invalid <tt>comedi_t</tt> pointer, the function -returns -1 and sets the appropriate libcomedi error value. - -Source: <tt>/lib/comedi.c</tt> - - -<p> -<sect2>comedi_find_range() -<p> - -<tt/int comedi_find_range(comedi_t *it, unsigned int subdevice, unsigned -int chan, unsigned int unit, double min, double max);/ - -<p> -The function <tt/comedi_find_range/ tries to -locate the optimal (smallest) range for the channel <tt>chan</tt> -belonging to a <tt>subdevice</tt> of the comedi device <tt>it</tt>, -that includes both <tt>min</tt> and <tt>max</tt> in <tt>units</tt>. -If it finds a matching range, it returns its index. If no -matching range is available, it returns -1. - -<p> -Valid units are: - -<itemize> -<item>UNIT_volt -<item>UNIT_mA -<item>UNIT_none -</itemize> - -Source: <tt>/lib/range.c</tt> - - -<p> -<sect2>comedi_errno() -<label id="comedi_errno"> -<p> -<tt/int comedi_errno(void);/ - -<p> -The function <tt>comedi_errno()</tt> -returns an integer describing the most recent comedilib error. This -integer may be used as the <tt>errnum</tt> parameter for -<tt><ref id="comedi_strerror" name ="comedi_strerror()"></tt>. - -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 -<tt>comedi_errno()</tt>. This error number can be -converted to a human-readable form by the functions -<tt><ref id="comedi_perror" name ="comedi_perror()"></tt> - and <tt><ref id="comedi_strerror" name ="comedi_strerror()"></tt>. - -These functions are intended to mimic the behavior of the -standard C library functions <tt>perror()</tt>, -<tt>strerror</tt>, and <tt>errno()</tt>. 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: <tt>/lib/error.c</tt> - - -<p> -<sect2>comedi_find_subdevice_by_type() -<p> - -<tt>int comedi_find_subdevice_by_type(comedi_t *it,int type,unsigned int -start_subdevice);</tt> - -<p> -The function <tt>comedi_find_subdevice_by_type</tt> tries to -locate a subdevice belonging to comedi device <tt>it</tt>, -having type <tt>type</tt>, starting with the subdevice -<tt>start_subdevice</tt>. 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. - -<p> -For subdevice types, see the manual page for the function -<tt><ref id="comedi_get_subdevice_type" name = -"comedi_get_subdevice_type()"></tt>. - -Source: <tt>/lib/get.c</tt> - - -<p> -<sect2>comedi_from_phys()<label id="comedi_from_phys"> -<p> - -<tt/lsampl_t comedi_from_phys(double data, comedi_range *rng, -lsampl_t maxdata);/ - -Converts data given in physical units (<tt/data/) into sample values -(lsampl_t, between 0 and maxdata). The parameter <tt>rng</tt> -represents the conversion information to use, and the parameter -<tt>maxdata</tt> represents the maximum possible data value for the -channel that the data will be written to. - - -Source: <tt>/lib/range.c</tt> - - -<p> -<sect2>comedi_get_board_name() -<p> - -<tt/char *comedi_get_board_name(comedi_t *it);/ - -The function <tt/comedi_get_board_name/ returns a pointer -to a string containing the name of the device. This pointer is -valid until the comedi descriptor <tt/it/ is closed. This -function returns <tt/NULL/ if there is an error. - -Source: <tt>/lib/get.c</tt> - - -<p> -<sect2>comedi_get_driver_name() -<p> - -<tt/char *comedi_get_driver_name(comedi_t *it);/ - -The function <tt/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 <tt/it/. This pointer is -valid until the comedi descriptor <tt/it/ is closed. This -function returns <tt/NULL/ if there is an error. - -Source: <tt>/lib/get.c</tt> - - -<p> -<sect2>comedi_get_maxdata() -<p> - -<tt/lsampl_t comedi_get_maxdata(comedi_t *it,unsigned int -subdevice,unsigned int chan);/ - -<p> -The function <tt/comedi_get_maxdata()/ returns the maximum -valid data value for channel <tt/chan/ of subdevice -<tt/subdevice/ belonging to the comedi device <tt/it/ -This function returns 0 on error. - -Source: <tt>/lib/get.c</tt> - - -<p> -<sect2>comedi_get_n_channels() -<p> - -<tt/int comedi_get_n_channels(comedi_t *it,unsigned int subdevice);/ - -The function <tt>comedi_get_n_channels()</tt> returns the number -of channels of the subdevice belonging to the comedi device <tt>it</tt> -and having index <tt>subdevice</tt>. This function returns -1 on error. - -Source: <tt>/lib/get.c</tt> - - -<p> -<sect2>comedi_get_n_ranges() -<p> - -<tt>int comedi_get_n_ranges(comedi_t *it,unsigned int subdevice, unsigned int -chan);</tt> - -The function <tt>comedi_get_n_ranges()</tt> returns the number -of ranges of the channel <tt>chan</tt> belonging to the <tt>subdevice</tt> -of the comedi device <tt>it</tt>. This function returns -1 on error. - -Source: <tt>/lib/range.c</tt> - - -<p> -<sect2>comedi_get_n_subdevices() -<p> - -<tt>int comedi_get_n_subdevices(comedi_t *it);</tt> - -The function <tt>comedi_get_n_subdevices</tt> returns the -number of subdevices associated with the comedi descriptor -<tt>it</tt>, or -1 if there is an error. - -Source: <tt>/lib/get.c</tt> - - -<p> -<sect2>comedi_get_range() -<p> - -<tt>comedi_range * comedi_get_range(comedi_t *it,unsigned int subdevice,unsigned int chan,unsigned int -range);</tt> - -The function <tt>comedi_get_range</tt> 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 <tt>it</tt> is closed. If there is an -error, NULL is returned. - -Source: <tt>/lib/get.c</tt> - -<p> -<sect2>comedi_get_rangetype() <it/deprecated/ -<p> - -<tt>int comedi_get_rangetype(comedi_t *it,unsigned int subdevice,unsigned int -chan);</tt> - -The function <tt>comedi_get_rangetype()</tt> returns an integer -that represents the number of range specifications available for a -particular channel <tt/chan/ of the subdevice <tt/subdevice/, as well as a conversion table to convert sample -values to/from physical units. - - The macro -<tt>RANGE_LENGTH(rangetype)</tt> -can be used to determine the number of range specifications for a given -range type. - -<p> -This function is deprecated and should not be used in new code. - -Source: <tt>/lib/get.c</tt> - -<p> -<sect2>comedi_get_subdevice_type()<label id="comedi_get_subdevice_type"> -<p> - -<tt>int comedi_get_subdevice_type(comedi_t *it,unsigned int subdevice);</tt> - -The function <tt>comedi_get_subdevice_type()</tt> returns an -integer describing the type of subdevice that belongs to the comedi -device <tt>it</tt> and has the index <tt>subdevice</tt>. The -function returns -1 is there is an error. - -Valid subdevice types are: - -<itemize> -<item><tt>COMEDI_SUBD_UNUSED</tt> -Subdevice has no functionality, i.e., a place-holder. -<item><tt>COMEDI_SUBD_AI</tt> Analog input -<item><tt>COMEDI_SUBD_AO</tt> Analog output -<item><tt>COMEDI_SUBD_DI</tt> Digital input -<item><tt>COMEDI_SUBD_DO</tt> Digital output -<item><tt>COMEDI_SUBD_DIO</tt> -Digital input/output. Channels are configurable as to whether they -are inputs or outputs. -<item><tt>COMEDI_SUBD_COUNTER</tt> Counter -<item><tt>COMEDI_SUBD_TIMER</tt> Timer -<item><tt>COMEDI_SUBD_MEMORY</tt> -Memory, e.g., EEPROM or dual-ported RAM -<item><tt>COMEDI_SUBD_CALIB</tt> -Calibration DACs -<item><tt>COMEDI_SUBD_PROC</tt> -Processor or DSP -</itemize> - -Source: <tt>/lib/get.c</tt> - -<p> -<sect2>comedi_get_timer() <it/(deprecated)/ -<p> - -<tt/int comedi_get_timer(comedi_t *it,unsigned int subdev, double -freq,unsigned int *trigvar, double *actual_freq);/ - -<p> -The function <tt>comedi_get_timer</tt> converts the frequency <tt/freq/ -to a number suitable to send to the driver in a <tt/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 <tt/nanosec_timer/, indicating -that timer values are simply a time specified in nanoseconds. - -<p> -This function is deprecated and should not be used in new applications. - -<p> -Source: <tt>/lib/timer.c</tt> - -<p> -<sect2>comedi_get_version_code() -<p> - -<tt/int comedi_get_version_code(comedi_t *it);/ - -<p> -The function <tt/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. - -<p> -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: <tt>/lib/get.c</tt> - -<p> -<sect2>comedi_loglevel() -<P> - -<tt>int comedi_loglevel(int loglevel);</tt> - -<p> -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 <tt/stderr/. The loglevel can also be affected by the -environment variable COMEDI_LOGLEVEL. - -<p> -In order to conserve resources, some debugging information is -disabled when libcomedi is compiled. - -<p>The meaning of the loglevels is as follows: - -<itemize> -<item><tt/COMEDILIB_LOGLEVEL=0/ - -Comedilib prints nothing. - -<item><tt/COMEDILIB_LOGLEVEL=1/ (default) - -Comedilib only prints error messages when there is a -self-consistency error (i.e., internal bug). - -<item><tt/COMEDILIB_LOGLEVEL=2/ - -Comedilib prints an error message when an invalid -parameter is passed to comedilib. - -<item><tt/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. - -<item><tt/COMEDILIB_LOGLEVEL=4/ - -Comedilib prints a lot of debugging messages. - -</itemize> - -Bugs: Libcomedi doesn't currently have much debugging information. - -Source: <tt>/lib/error.c</tt> - -<p> -<sect2>comedi_open() -<p> - -<tt/comedi_t *comedi_open(char *filename);/ - -Opens a comedi device specified by the filename <tt/filename/. -Returns NULL on error. On sucess, it returns a handle that is -given as a parameter to other libcomedi functions. - -<p> -You are not supposed to have access to the internals of the -<tt/comedi_t/ structure. - -Bugs: Not strictly identical to <tt/fopen/ - -Source: <tt>/lib/comedi.c</tt> - - -<p> -<sect2>comedi_perror()<label id="comedi_perror"> -<p> - -<tt>void comedi_perror(const char *s);</tt> - -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 -<tt><ref id="comedi_errno" name ="comedi_errno()"></tt>. - This error number can be - converted to a human-readable form by the functions -<tt>comedi_perror()</tt> - and <tt><ref id="comedi_strerror" name ="comedi_strerror()"></tt>. - -These functions are intended to mimic the behavior of the -standard C library functions <tt>perror()</tt>, -<tt>strerror</tt>, and <tt>errno()</tt>. 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 <tt>comedi_perror()</tt> 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: <tt>/lib/error.c</tt> - - -<p> -<sect2>comedi_strerror()<label id="comedi_strerror"> -<p> - -<tt>*comedi_strerror(int errnum);</tt> - -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 -<tt><ref id="comedi_errno" name ="comedi_errno()"></tt>. This error number can be -converted to a human-readable form by the functions -<tt><ref id="comedi_perror" name ="comedi_perror()"></tt> - and <tt>comedi_strerror()</tt>. - -These functions are intended to mimic the behavior of the -standard C library functions <tt>perror()</tt>, -<tt>strerror</tt>, and <tt>errno()</tt>. 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 <tt>comedi_strerror()</tt> returns a pointer to a -character string -describing the comedilib error <tt>errnum</tt>. 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: <tt>/lib/error.c</tt> - - -<p> -<sect2>comedi_sv_init() -<p> - -<tt/int comedi_sv_init(comedi_sv_t *sv,comedi_t *dev,unsigned int subd, -unsigned int chan);/ - - -<tt/comedi_sv_init/ initializes the slow varying comedi structure -<tt/sv/ of the device <tt/dev/, the subdevice <tt/subd/ (analog input) and -the channel <tt/chan/. -The slow varying comedi structure <tt/sv/ of type <tt><ref id="comedi_sv_t" -name="comedi_sv_t"</tt> -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: <tt>/lib/sv.c</tt> - - -<p> -<sect2>comedi_sv_update() -<p> - -<tt/int comedi_sv_update(comedi_sv_t *sv);/ - -The function <tt/comedi_sv_update/ updates the slow varying comedi structure -<tt/sv/. -Returns zero on success, -1 on error. - -Source: <tt>/lib/sv.c</tt> - - -<p> -<sect2>int comedi_sv_measure() -<p> - -<tt>int comedi_sv_measure(comedi_sv_t *it,double *data);</tt> - -<tt/comedi_sv_measure/ measures the slow variing signal. The measurement -is specified by the slow varying comedi structure <tt/sv/, the result is -stored in <tt/data/. -On success returns the number of samples, -1 on error. - -Source: <tt>/lib/sv.c</tt> - - -<p> -<sect2>comedi_to_phys()<label id="comedi_to_phys"> -<p> - -<tt/double comedi_to_phys(lsampl_t data, comedi_range *rng, -lsampl_t maxdata);/ - -Converts data given in sample values (lsampl_t, between 0 and -maxdata) into physical units (double). The parameter <tt/rng/ -represents the conversion information to use, and the parameter -<tt/maxdata/ represents the maximum possible data value for the -channel that the data was read. - -Source: <tt>/lib/range.c</tt> - - -<p> -<sect2>comedi_trigger() <it/(deprecated)/ -<p> - -<tt/int comedi_trigger(comedi_t *it,comedi_trig *trig);/ - -The function <tt/comedi_trigger/ instructs comedi to -perform the command specified by the <ref id="comedi_trig_struct" name -="trigger structure"> <tt/trig/. Results depend on -the particular command being issued. If there is an -error, -1 is returned. - -Lifetime: removal at 1.0. - -Source: <tt>/lib/comedi.c</tt> - - -<p> -<sect2>comedi_get_subdevice_flags() -<label id="comedi_get_subdevice_flags"> -<p> - -<tt/int comedi_get_subdevice_flags(comedi_t *dev, unsigned int subdevice);/ - -<p> -This function returns a bitfield describing the capabilities of the -specified subdevice. If there is an error, -1 is returned. - -<p>The bits are: - -<itemize> -<item>SDF_BUSY subdevice is running a command -<item>SDF_BUSY_OWNER subdevice is running a command started by -the file descriptor used by <tt/dev/. -<item>SDF_LOCKED subdevice is locked -<item>SDF_LOCKED_OWNER subdevice is locked by the file descriptor used -by <tt/dev/. -<item>SDF_MAXDATA maximum data values are channel dependent -<item>SDF_FLAGS channel flags are channel dependent -<item>SDF_RANGETYPE range types are channel dependent -<item>SDF_MODE0 deprecated -<item>SDF_MODE1 deprecated -<item>SDF_MODE2 deprecated -<item>SDF_MODE3 deprecated -<item>SDF_MODE4 deprecated -<item>SDF_CMD subdevice supports commands -<item>SDF_READABLE subdevice can be read from -<item>SDF_WRITEABLE subdevice can be written to -<item>SDF_RT deprecated -<item>SDF_GROUND subdevice is capable of ground analog reference -<item>SDF_COMMON subdevice is capable of common analog reference -<item>SDF_DIFF subdevice is capable of differential analog reference -<item>SDF_OTHER subdevice is capable of other analog reference -<item>SDF_DITHER subdevice recognizes dither flag -<item>SDF_DEGLITCH subdevice recognizes deglitch flag -<item>SDF_MMAP deprecated -<item>SDF_RUNNING subdevice is acquiring data (i.e., command has not -completed) -<item>SDF_LSAMPL subdevice uses samples of type lsampl_t (otherwise -sampl_t) -<item>SDF_PACKED subdevice uses bitfield samples (otherwise it uses -one sample per channel) -</itemize> - - - -<p> -The bit definitions are part of the Comedi kernel interface. - - -<p> -<sect2>comedi_range_is_chan_specific() -<label id="comedi_range_is_chan_specific"> -<p> - -<tt/int comedi_range_is_chan_specific(comedi_t *dev,unsigned int subdevice);/ - -<p> -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. - - -<p> -<sect2>Undocumented functions -<label id="undocumented"> -<p> - - -<itemize> -<item>comedi_maxdata_is_chan_specific() -<item>comedi_get_buffer_size() -<item>comedi_get_max_buffer_size() -<item>comedi_set_buffer_size() -<item>comedi_set_max_buffer_size() -<item>comedi_do_insnlist() -<item>comedi_do_insn() -<item>comedi_lock() -<item>comedi_unlock() -<item>comedi_get_cmd_src_mask() -<item>comedi_get_cmd_generic_timed() -<item>comedi_cancel() -<item>comedi_command() -<item>comedi_command_test() -<item>comedi_poll() -<item>comedi_get_buffer_contents() -<item>comedi_mark_buffer_read() -<item>comedi_get_buffer_offset() -<item>comedi_set_global_oor_behavior() -</itemize> - - - - - - - - - - -</article> -