Comedi i Comedi The Control and Measurement Device Interface handbook for Comedilib 0.10.
Comedi ii Copyright © 1998-2003 David Schleef Copyright © 2001-2003, 2005, 2008 Frank Mori Hess Copyright © 2002-2003 Herman Bruyninckx Copyright © 2012 Bernd Porr Copyright © 2012 Ian Abbott This document is part of Comedilib. In the context of this document, the term "source code" as defined by the license is interpreted as the XML source.
Comedi iii Contents 1 2 3 4 Overview 1 1.1 What is a ‘device driver’? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Policy vs. mechanism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.3 A general DAQ device driver package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.4 DAQ signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Comedi iv 5 4.7.1 Digital input combining machines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 4.7.2 Analog filtering configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 4.7.3 Analog Output Waveform Generation 4.7.4 Extended Triggering 4.7.5 Analog Triggering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 4.7.6 Bitfield Pattern Matching Extended Trigger 4.7.
Comedi v 5.4.1.6 comedi_data_write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 5.4.1.7 comedi_do_insn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 5.4.1.8 comedi_do_insnlist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 5.4.1.9 comedi_fileno . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 5.4.1.10 comedi_find_range . . . . . . . . . . . . . .
Comedi vi 5.4.2.12 comedi_mark_buffer_read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 5.4.2.13 comedi_mark_buffer_written . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 5.4.2.14 comedi_poll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 5.4.2.15 comedi_set_buffer_size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 5.4.2.16 comedi_set_max_buffer_size . . . . . . . . . . . .
Comedi vii 5.5 5.4.7.2 comedi_get_timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 5.4.7.3 comedi_sv_init . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 5.4.7.4 comedi_sv_measure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 5.4.7.5 comedi_sv_update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 5.4.7.6 comedi_timed_1chan . . . . . . . . . .
Comedi viii 5.5.31 comedi_rt_timer -- Command emulator using real-time tasks . . . . . . . . . . . . . . . . . . . . . . . 96 5.5.32 comedi_test -- generates fake waveforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 5.5.33 contec_pci_dio -- Contec PIO1616L digital I/O board . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 5.5.34 daqboard2000 -- IOTech DAQBoard/2000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 5.5.
Comedi ix 5.5.70 ni_daq_700 -- National Instruments PCMCIA DAQCard-700 DIO only 5.5.71 ni_daq_dio24 -- National Instruments PCMCIA DAQ-Card DIO-24 . . . . . . . . . . . . . . . . . 117 . . . . . . . . . . . . . . . . . . . 117 5.5.72 ni_labpc -- National Instruments Lab-PC (& compatibles) . . . . . . . . . . . . . . . . . . . . . . . . . 117 5.5.73 ni_labpc_cs -- National Instruments Lab-PC (& compatibles) . . . . . . . . . . . . . . . . . . . . . . . 118 5.5.
Comedi x 6 Writing a Comedi driver 6.1 Communication user-space — kernel-space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 6.2 Generic functionality 6.2.1 6.2.2 7 140 Data structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 6.2.1.1 comedi_lrange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Comedi xi List of Figures 1 Asynchronous Acquisition Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Abstract Comedi is a free software project to interface digital acquisition (DAQ) cards.
Comedi 1 / 148 1 Overview Comedi is a free software project that develops drivers, tools, and libraries for various forms of data acquisition: reading and writing of analog signals; reading and writing of digital inputs/outputs; pulse and frequency counting; pulse generation; reading encoders; etc.
Comedi 2 / 148 So, Comedi focuses only on the mechanism part of DAQ interfacing. The project does not provide the policy parts, such as Graphical User Interfaces to program and display acquisitions, signal processing libraries, or control algorithms. 1.
Comedi 3 / 148 • Analog signals are a bit more complicated. Typically, an analog acquisition channel can be programmed to generate or read a voltage between a lower and an upper threshold (e.g., -10V and +10V). The card’s electronics may also allow automatically sampling of a set of channels in a prescribed order. • Pulse-based signals (counters, timers, encoders, etc.) are conceptually only a bit more complex than digital inputs and outputs, in that they only add some timing specifications to the signal.
Comedi 4 / 148 Figure courtesy of Kurt Müller. Figure 1: Asynchronous Acquisition Sequence 1.7 DAQ functions The basic data acquisition functionalities that Comedi offers work on channels, or sets of channels: • Single acquisition: Comedi has function calls to synchronously perform one single data acquisition on a specified channel: comedi_data_read(), comedi_data_read_delayed(), comedi_data_write(), comedi_dio_read(), comedi_dio_write().
Comedi 5 / 148 Buffering is another important aspect of device drivers: the acquired data has to be stored in such buffers, because, in general, the application program cannot guarantee to always be ready to provide or accept data as soon as the interface board wants to do a read or write operation. Comedi provides internal buffers for data being streamed to/from devices via Comedi commands. The buffer sizes are user-adjustable.
Comedi 6 / 148 • [2] - DMA 1 • [3] - DMA 2 • [4] - AI jumpered for 0=single ended, 1=differential • [5] - AI jumpered for 0=straight binary, 1=2’s complement • [6] - AO 0 jumpered for 0=straight binary, 1=2’s complement • [7] - AO 1 jumpered for 0=straight binary, 1=2’s complement • [8] - AI jumpered for 0=[-10,10]V, 1=[0,10], 2=[-5,5], 3=[0,5] • [9] - AO 0 jumpered for 0=[-10,10]V, 1=[0,10], 2=[-5,5], 3=[0,5], 4=[-2.5,2.5] • [10]- A0 1 jumpered for 0=[-10,10]V, 1=[0,10], 2=[-5,5], 3=[0,5], 4=[-2.5,2.
Comedi 7 / 148 ranges: all chans: [-1.325 V,1.325 V] command: start: now|int scan_begin: timer convert: now scan_end: count stop: none|count command structure filled with probe_cmd_generic_timed for 16 channels: start: now 0 scan_begin: timer 1000000 scan_begin_src = TRIG_TIMER: The sampling rate is defined per scan meaning all channels are sampled at the same time.
Comedi 8 / 148 ranges: all chans: [0,1] command: not supported This board has four subdevices. Devices are separated into subdevices that each have a distinct purpose; e.g., analog input, analog output, digital input/output. Here’s the information from Comedi’s /proc/comedi file, which indicates what drivers are loaded and which boards are configured: cat /proc/comedi comedi version 0.7.
Comedi 9 / 148 { comedi_t *it; int chan = 0; lsampl_t data; int retval; it = comedi_open("/dev/comedi0"); if(it == NULL) { comedi_perror("comedi_open"); return -1; } retval = comedi_data_read(it, subdev, chan, range, aref, &data); if(retval < 0) { comedi_perror("comedi_data_read"); return -1; } printf("%d\n", data); return 0; } The source code file for the above program can be found in Comedilib, at demo/tut1.c. You can compile the program using cc tut1.
Comedi 10 / 148 * Copyright (c) 1999,2000 David A. Schleef * Copyright (c) 2008 Frank Mori Hess * * This file may be freely modified, distributed, and combined with * other software, as long as proper attribution is given in the * source code. */ #include #include #include #include #include /* for printf() */
Comedi 11 / 148 } return 0; } The source code file for the above program can be found in the Comedilib source at demo/tut2.c and if installed as a package usually at /usr/share/doc/libcomedi-dev/demo/ with all the other tutorial/demo files. 3.4 Asynchronous acquisition Of special importance is the so called "asynchronous data acquisition" where Comedi is sampling in the background at a given sample rate. The user can retrieve the data whenever it is convenient.
Comedi 12 / 148 It requests data from two channels at a sampling rate of 1kHz and a total of 10000 samples. which are then printed to stdout. You can pipe the data into a file and plot it with gnuplot. As mentioned above, central in this program is the loop using the standard C read() command which receives the buffer contents. Below is an extract from tut3.c showing the relevant commands: /* open the device */ dev = comedi_open(options.filename); if(!dev){ comedi_perror(options.
Comedi 13 / 148 /* start the command */ ret = comedi_command(dev, cmd); if(ret < 0){ comedi_perror("comedi_command"); exit(1); } subdev_flags = comedi_get_subdevice_flags(dev, options.subdevice); while(1){ ret = read(comedi_fileno(dev),buf,BUFSZ); if(ret < 0){ /* some error occurred */ perror("read"); break; }else if(ret == 0){ /* reached stop condition */ break; }else{ static int col = 0; int bytes_per_sample; total += ret; if(options.
Comedi 14 / 148 } /* Modify parts of the command */ cmd->chanlist = chanlist; cmd->chanlist_len = n_chan; if(cmd->stop_src == TRIG_COUNT) cmd->stop_arg = n_scan; return 0; } For advanced programmers the function comedi_get_buffer_contents() is useful to check if there is actually data in the ringbuffer so that a call of read() can be avoided for example when the data readout is called by a timer call-back function. 3.5 Further examples See the demo subdirectory of Comedilib for more example programs.
Comedi 15 / 148 int comedi_dio_bitfield2(comedi_t *device, unsigned int subdevice, unsigned int write_mask, unsigned int *bits, unsigned int base_channel); Each channel from base_channel to base_channel + 31 is assigned to a bit in the write_mask and bits bitfield with bit 0 assigned to channel base_channel, bit 1 assigned to channel base_channel + 1, etc.
Comedi 16 / 148 Most functions specify the range to be used for a channel by a zero-based index into the list of ranges supported by the channel. Depending on the device and subdevice, different channels on the subdevice may or may not share the same list of ranges, that is, ranges may or may not be channel-specific. (The SDF_RANGETYPE subdevice flag indicates whether ranges are channel-specific.
Comedi 17 / 148 4.2.2 Instruction execution Once an instruction data structure has been filled in, the corresponding instruction is executed with the function comedi_do_insn(): int comedi_do_insn(comedi_t *device, comedi_insn *instruction); Many Comedi instructions are shortcuts that relieve the programmer from explicitly filling in the data structure and calling the comedi_do_insn() function.
Comedi 18 / 148 data[0] INSN_CONFIG_ALT_SOURCE INSN_CONFIG_BLOCK_SIZE INSN_CONFIG_DIO_QUERY Description Select an alternate input source. This instruction is used by calibration programs to configure analog input channels which can be redirected to read internal calibration references. You need to set the CR_ALT_SOURCE flag in the chanspec when reading to actually read from the configured alternate input source.
Comedi 19 / 148 • accompanied with various callback functionalities (DMA, interrupts, driver-specific callback functions), • for any number of channels, • with an arbitrary order of channels in each scan (possibly even with repeated channels per scan), • and with various scan triggering sources, external (i.e., hardware pulses) as well as internal (i.e., pulses generated on the DAQ card itself, or generated by a software trigger instruction).
Comedi 20 / 148 unsigned int stop_src; unsigned int stop_arg; // what make the acquisition terminate // parameters that influence this termination unsigned int *chanlist; unsigned int chanlist_len; // pointer to list of channels to be sampled // number of channels to be sampled sampl_t *data; unsigned int data_len; // address of buffer // number of samples to acquire }; The start and end of the whole command acquisition sequence, and the start and end of each scan and of each conversion, is triggere
Comedi 21 / 148 • TRIG_EXT: the ‘scan begin’ event occurs when an external trigger signal occurs; e.g., a rising edge of a digital line. scan_begin_arg chooses the particular digital line. The scan_begin_arg used here may not be supported exactly by the device, but it will be adjusted to the nearest supported value by comedi_command_test(). The timing between each sample in a scan is controlled by the convert_src events. The available options are: • TRIG_TIMER: the conversion events occur periodically.
Comedi 22 / 148 • TRIG_ROUND_NEAREST: round to nearest supported timing period, the default. This flag (as well as the following three), indicates how timing arguments should be rounded if the hardware cannot achieve the exact timing requested. • TRIG_ROUND_DOWN: round period down. • TRIG_ROUND_UP: round period up. • TRIG_ROUND_UP_NEXT: this one doesn’t do anything, and I don’t know what it was intended to do. . .
Comedi 23 / 148 As you might have guessed, the Comedi library has functions to help you in your quest to accurately measure slowly varying inputs: int comedi_sv_init(comedi_sv_t *sv, comedi_t *device, unsigned int subdevice, unsigned int channel); The above function comedi_sv_init() initializes the comedi_sv_t data structure, used to do the averaging acquisition: typedef struct comedi_sv_struct { comedi_t *dev; unsigned int subdevice; unsigned int chan; /* range policy */ int range; int aref; /* number of
Comedi 24 / 148 11 reserved. For example, a simple digital follower is specified by the bit pattern 01 10, because it sets the output on positive transitions of the input, and clears the output on negative transitions. A digital inverter is similarily 10 01. These systems have only one sensitive input. As another example, a simple up counter, which increments on positive transitions of one input, is specified by 01 00. This system has only one sensitive input.
Comedi 25 / 148 Extended trigger configuration should be designed in such a way that the user can probe for valid parameters, similar to how command testing works. An extended trigger configuration instruction should not configure the hardware directly, rather, the configuration should be saved until the subsequent command is issued. This allows more flexibility for future interface changes.
Comedi 26 / 148 4.7.6 Bitfield Pattern Matching Extended Trigger (Status: design. No driver implements this feature yet.) The insn field of the instruction data structure has not been assigned yet. The chanspec field of the instruction data structure is ignored. The data field of the instruction data structure is used as follows: data[1] trigger flags. data[2] mask. data[3] pattern. The pattern matching trigger issues a trigger when all of a specifed set of input lines match a specified pattern.
Comedi 27 / 148 4.7.8 One source plus auxiliary counter configuration (Status: design. No driver implements this feature yet.) The insn field of the instruction data structure has not been assigned yet. The chanspec field of the instruction data structure is used to . . . The data field of the instruction data structure is used as follows: data[1] is flags, including the flags for the command triggering configuration.
Comedi 28 / 148 Signal Source NI_RTSI_OUTPUT_ADR_START1 NI_RTSI_OUTPUT_ADR_START2 NI_RTSI_OUTPUT_SCLKG NI_RTSI_OUTPUT_DACUPDN NI_RTSI_OUTPUT_DA_START1 NI_RTSI_OUTPUT_G_SRC0 NI_RTSI_OUTPUT_G_GATE0 NI_RTSI_OUTPUT_RGOUT0 NI_RTSI_OUTPUT_RTSI_BRD(n) NI_RTSI_OUTPUT_RTSI_OSC Description ADR_START1, an analog input start signal. See the NI’s DAQ-STC Technical Reference Manual for more information. ADR_START2, an analog input stop signal. See the NI’s DAQ-STC Technical Reference Manual for more information.
Comedi 29 / 148 ret = comedi_do_insn(dev, &configCmd); if(ret < 0){ comedi_perror("comedi_do_insn: INSN_CONFIG"); exit(1); } // Set clock RTSI line as output ret = comedi_dio_config(dev, rtsi_subdev, rtsi_clock_line, INSN_CONFIG_DIO_OUTPUT); if(ret < 0){ comedi_perror("comedi_dio_config"); exit(1); } /* Set routing of the 3 main AI RTSI signals and their direction to output. We’re reusing the already initialized configCmd instruction here since it’s mostly the same. */ configCmd.chanspec = 0; configCmd.
Comedi 30 / 148 int ret; unsigned int d = 0;; static const unsigned rtsi_subdev = 10; static const unsigned rtsi_clock_line = 7; memset(&configCmd, 0, sizeof(configCmd)); memset(&configData, 0, sizeof(configData)); configCmd.insn = INSN_CONFIG; configCmd.subdev = rtsi_subdev; configCmd.chanspec = 0; configCmd.n = 3; configCmd.data = configData; configCmd.data[0] = INSN_CONFIG_SET_CLOCK_SRC; configCmd.data[1] = NI_MIO_PLL_RTSI_CLOCK(rtsi_clock_line); configCmd.
Comedi 31 / 148 } cmd.chanlist cmd.chanlist_len cmd.scan_end_arg cmd.start_src cmd.start_arg cmd.convert_src cmd.convert_arg cmd.stop_src = chanList; = nChannels; = nChannels; = TRIG_EXT; = CR_EDGE | NI_EXT_RTSI(0); = TRIG_EXT; = CR_INVERT | CR_EDGE | NI_EXT_RTSI(2); = TRIG_NONE; ret = comedi_command(dev0, &cmd0); if(ret<0){ printf("comedi_command failed\n"); return ret; } return 0; } 5 5.1 Comedi reference Headerfiles: comedi.h and comedilib.
Comedi 32 / 148 5.2.2 CR_PACK_FLAGS CR_PACK_FLAGS(chan, range, aref , flags) is similar to CR_PACK() but can be used to combine one or more flag bits (bitwise-ORed together in the flags parameter) with the other parameters. #define CR_PACK_FLAGS(chan, range, aref, flags) \ (CR_PACK(chan, range, aref) | ((flags) & CR_FLAGS_MASK)) Depending on context, the chan parameter might not be a channel; it could be a trigger source, clock source, gate source etc.
Comedi 33 / 148 5.2.
Comedi 34 / 148 5.3.2 comedi_t The data type comedi_t is used to represent an open Comedi device: typedef struct comedi_t_struct comedi_t; 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 an opaque type, and pointers to type comedi_t should not be dereferenced by the application. 5.3.
Comedi 35 / 148 /* 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. This relies on the COMEDI_TRIG ioctl and is no longer by the Comedi kernel layer. 5.3.
Comedi 36 / 148 Comedi instructions are described by the comedi_insn structure. Applications send instructions to the driver in order to perform control and measurement operations that are done immediately or synchronously, i.e., the operations complete before program control returns to the application. In particular, instructions cannot describe acquisition that involves timers or external events. The field insn determines the type of instruction that is sent to the driver.
Comedi 37 / 148 5.3.11 comedi_insnlist typedef struct comedi_insnlist_struct comedi_insnlist; struct comedi_insnlist_struct{ unsigned int n_insns; comedi_insn *insns; }; A comedi_insnlist structure is used to communicate a list of instructions to the driver using the comedi_do_insnlist() function. 5.3.
Comedi 38 / 148 Synopsis #include int comedi_data_read(comedi_t * device, unsigned int subdevice, unsigned int channel, unsigned int range, unsigned int aref, lsampl_t * data); Description Reads a single sample on the channel specified by the Comedi device device, the subdevice subdevice, and the channel channel. For the A/D conversion (if appropriate), the device is configured to use range specification range and (if appropriate) analog reference type aref .
Comedi 39 / 148 Description Similar to comedi_data_read() except it will wait for the specified number of nanoseconds between setting the input channel and taking a sample. For analog inputs, most boards have a single analog to digital converter which is multiplexed to be able to read multiple channels. If the input is not allowed to settle after the multiplexer switches channels, the reading will be inaccurate.
Comedi 40 / 148 5.4.1.7 comedi_do_insn comedi_do_insn — perform instruction Synopsis #include int comedi_do_insn(comedi_t * device, comedi_insn * instruction); Description The function comedi_do_insn() performs a single instruction. Return value If successful, returns a non-negative number. For the case of INSN_READ or INSN_WRITE instructions, comedi_do_insn() returns the number of samples read or written, which may be less than the number requested. If there is an error, -1 is returned.
Comedi 41 / 148 Description The function comedi_fileno() returns the file descriptor for the device device. This descriptor can then be used as the file descriptor parameter of read(), write(), etc. This function is intended to mimic the standard C library function fileno(). The returned file descriptor should not be closed, and will become invalid when comedi_close() is called on device. Return value A file descriptor, or -1 on error. 5.4.1.
Comedi 42 / 148 5.4.1.12 comedi_from_phys comedi_from_phys — convert physical units to sample Synopsis #include lsampl_t comedi_from_phys(double data, comedi_range * range, lsampl_t maxdata); Description Converts parameter data given in physical units (double) into sample values (lsampl_t, between 0 and maxdata).
Comedi 43 / 148 Description The function comedi_get_board_name() returns a pointer to a string containing the name of the comedi device represented by device. This pointer is valid until the device is closed. This function returns NULL if there is an error. 5.4.1.15 comedi_get_driver_name comedi_get_driver_name — Comedi driver name Synopsis #include
Comedi 44 / 148 Description The function comedi_get_n_channels() returns the number of channels of the subdevice subdevice belonging to the comedi device device. This function returns -1 on error and the Comedilib error value is set. 5.4.1.18 comedi_get_n_ranges comedi_get_n_ranges — number of ranges of channel Synopsis #include
Comedi 45 / 148 5.4.1.21 comedi_get_subdevice_flags comedi_get_subdevice_flags — properties of subdevice Synopsis #include int comedi_get_subdevice_flags(comedi_t * device, unsigned int subdevice); Description The function comedi_get_subdevice_flags() returns a bitfield describing the capabilities of the specified subdevice subdevice of the Comedi device device. If there is an error, -1 is returned, and the Comedilib error value is set.
Comedi 46 / 148 Subdevice Flag Value (hex) SDF_WRITABLE 0x00020000 SDF_INTERNAL 0x00040000 SDF_GROUND 0x00100000 SDF_COMMON 0x00200000 SDF_DIFF 0x00400000 SDF_OTHER 0x00800000 SDF_DITHER 0x01000000 SDF_DEGLITCH 0x02000000 SDF_RUNNING 0x08000000 SDF_LSAMPL 0x10000000 SDF_PACKED 0x20000000 5.4.1.22 Description The subdevice can be written to (e.g. analog output). The subdevice does not have externally visible lines. The subdevice supports analog reference AREF_GROUND.
Comedi 47 / 148 Synopsis #include int comedi_get_version_code(comedi_t * device); Description Returns the Comedi kernel module version code. A valid Comedi device referenced by the parameter device is necessary to communicate with the kernel module. On error, -1 is returned. The version code is encoded as a bitfield of three 8-bit numbers. For example, 0x00073d is the version code for version 0.7.61. This function is of limited usefulness.
Comedi 48 / 148 Return value If successful, 0 is returned. If there is an error, -1 is returned. 5.4.1.26 comedi_maxdata_is_chan_specific comedi_maxdata_is_chan_specific — maximum sample depends on channel Synopsis #include int comedi_maxdata_is_chan_specific(comedi_t * device, unsigned int subdevice); Description If each channel of the specified subdevice may have different maximum sample values, this function returns 1. Otherwise, this function returns 0.
Comedi 49 / 148 5.4.1.29 comedi_set_global_oor_behavior comedi_set_global_oor_behavior — out-of-range behavior Synopsis #include enum comedi_oor_behavior comedi_set_global_oor_behavior(enum comedi_oor_behavior behavior); Description This function changes the Comedilib out-of-range behavior. This currently affects the behavior of comedi_to_phys() when converting endpoint sample values, that is, sample values equal to 0 or maxdata.
Comedi 50 / 148 Description Converts data given in Comedi’s integer sample values (lsampl_t, between 0 and maxdata) into physical units (double). The conversion_polynomial parameter is obtained from either comedi_get_hardcal_converter() or comedi_get_softcal_converter(). No range checking of the input data is performed. It is up to you to check for data values of 0 or maxdata if you want to detect possibly out-of-range readings. Return value Physical value corresponding to the input sample value. 5.4.1.
Comedi 51 / 148 Synopsis #include int comedi_command(comedi_t * device, comedi_cmd * command); Description The function comedi_command() starts a streaming input or output. The command structure pointed to by command specifies settings for the acquisition. The command must be able to pass comedi_command_test() with a return value of 0, or comedi_command() will fail. For input subdevices, sample values are read using the function read() on the device file.
Comedi 52 / 148 Synopsis #include int comedi_get_buffer_contents(comedi_t * device, unsigned int subdevice); Description The function comedi_get_buffer_contents() is used on a subdevice that has a Comedi command in progress. The number of bytes that are available in the streaming buffer is returned. If there is an error, -1 is returned. 5.4.2.5 comedi_get_buffer_offset comedi_get_buffer_offset — streaming buffer status Synopsis #include
Comedi 53 / 148 Description The command capabilities of the subdevice indicated by the parameters device and subdevice are probed, and the results placed in the command structure pointed to by the parameter command . The command structure pointed to by command is modified to be a valid command that can be used as a parameter to comedi_command() (after the command has additionally been assigned a valid chanlist array).
Comedi 54 / 148 Synopsis #include int comedi_get_read_subdevice(comedi_t * device); Description The function comedi_get_read_subdevice() returns the index of the subdevice whose streaming input buffer is accessible through the device device. If there is no such subdevice, -1 is returned. 5.4.2.11 comedi_get_write_subdevice comedi_get_write_subdevice — find streaming output subdevice Synopsis #include
Comedi 55 / 148 Synopsis #include int comedi_mark_buffer_written(comedi_t * device, unsigned int subdevice, unsigned int num_bytes); Description The function comedi_mark_buffer_written() is used on a subdevice that has a Comedi output command in progress.
Comedi 56 / 148 Return value The new buffer size in bytes is returned on success. On error, -1 is returned. 5.4.2.16 comedi_set_max_buffer_size comedi_set_max_buffer_size — streaming maximum buffer size of subdevice Synopsis #include
Comedi 57 / 148 In practice, their are some rules of thumb on how calibrations behave. No calibrations depend on the analog reference. A multiplexed analog input will have calibration settings that do not depend on the channel, and applying a setting for one channel will affect all channels equally.
Comedi 58 / 148 Status alpha Description This function frees the resources associated with a comedi_calibration_t obtained from comedi_parse_calibration_file(). The comedi_calibration_t pointed to by calibration can not be used again after calling this function. 5.4.3.4 comedi_get_default_calibration_path comedi_get_default_calibration_path — get default calibration file path Synopsis #include
Comedi 59 / 148 Description The function comedi_get_hardcal_converter() initializes the comedi_polynomial_t pointed to by converter so it can be passed to either comedi_to_physical(), or comedi_from_physical(). The result can be used to convert data from the specified subdevice, channel, and range. The direction parameter specifies whether converter will be passed to comedi_to_physical() or comedi_from_physical().
Comedi 60 / 148 5.4.3.7 comedi_parse_calibration_file comedi_parse_calibration_file — load contents of calibration file Synopsis #include
Comedi 61 / 148 5.4.4.2 comedi_dio_config comedi_dio_config — change input/output properties of channel Synopsis #include int comedi_dio_config(comedi_t * device, unsigned int subdevice, unsigned int channel, unsigned int direction); Description 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 direction. Valid directions are COMEDI_INPUT or COMEDI_OUTPUT.
Comedi 62 / 148 Description The function comedi_dio_read() reads the channel channel belonging to the subdevice subdevice of device device. The data value that is read is stored in the *bit. This function is equivalent to: comedi_data_read(device, subdevice, channel, 0, 0, bit); This function does not require a digital subdevice or a subdevice with a maximum data value of 1 to work properly.
Comedi 63 / 148 Description 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 by calling 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.
Comedi 64 / 148 Description 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() or comedi_strerror(). These functions are intended to mimic the behavior of the standard C library functions perror(), strerror(), and errno.
Comedi 65 / 148 Description This function arms a subdevice. It may, for example, arm a counter to begin counting. The source parameter specifies what source should trigger the subdevice to begin. The possible sources are driver-dependant. This function is only useable on subdevices that provide support for the INSN_CONFIG_ARM configuration instruction. Return value 0 on success, -1 on error. 5.4.6.
Comedi 66 / 148 Description This function queries the gate for a subdevice, as set by comedi_set_gate_source(). The currently configured gate source will be written to *gate_source. The possible values and their corresponding gates are driver-dependant. If the subdevice does not support configuring its gates on a per-channel basis, then the channel parameter will be ignored. This function is only useable on subdevices that provide support for the INSN_CONFIG_GET_GATE_SOURCE configuration instruction.
Comedi 67 / 148 Description This function queries the routing for an output, as set by comedi_set_routing(). The currently configured routing will be written to *routing . The possible values and their corresponding routings are driver-dependant. This function is only useable on subdevices that provide support for the INSN_CONFIG_GET_ROUTING configuration instruction. Return value 0 on success, -1 on error. 5.4.6.6 comedi_reset comedi_reset — reset a subdevice Synopsis #include
Comedi 68 / 148 Description This function selects a master clock for a subdevice. The clock parameter selects the master clock, and is driver-dependant. If the subdevice does not support configuring its master clocks on a per-channel basis, then the channel parameter will be ignored. The period_ns parameter specifies the clock’s period in nanoseconds. It may left unspecified by using a value of zero.
Comedi 69 / 148 Status alpha Description This function selects a filter for a subdevice. For instance, a digital input subdevice may provide deglitching filters with varying cutoff frequencies. The filters are used to prevent high-frequency noise from causing unwanted transitions on the digital inputs. This function can tell the hardware which deglitching filter to use, or to use none at all. The filter parameter selects which of the subdevice’s filters to use, and is driver-dependant.
Comedi 70 / 148 Synopsis #include int comedi_set_other_source(comedi_t * device, unsigned int subdevice, unsigned int channel, unsigned int other, unsigned int source); Status alpha Description This function allows selection of a source signal for something on a subdevice other than a gate (which uses comedi_set_gate_source()) or a clock (which uses comedi_set_clock_source()). The other parameter selects which ‘other’ we are configuring, and is driver-dependent.
Comedi 71 / 148 5.4.7 Deprecated functions 5.4.7.1 comedi_dio_bitfield comedi_dio_bitfield — read/write multiple digital channels Synopsis #include int comedi_dio_bitfield(comedi_t * device, unsigned int subdevice, unsigned int write_mask, unsigned int * bits); Status deprecated Description This function is deprecated. Use comedi_dio_bitfield2() instead. It is equivalent to using comedi_dio_bitfield2() with base_channel set to 0. 5.4.7.
Comedi 72 / 148 Status deprecated Description The function comedi_sv_init() initializes the slow varying Comedi structure pointed to by sv to use the device device, the analog input subdevice subdevice, and the channel channel. The slow varying Comedi structure is used by comedi_sv_measure() to accurately measure an analog input by averaging over many samples. The default number of samples is 100. Return value This function returns 0 on success, -1 on error. 5.4.7.
Comedi 73 / 148 5.4.7.6 comedi_timed_1chan comedi_timed_1chan — streaming input (deprecated) Synopsis #include int comedi_timed_1chan(comedi_t * device, unsigned int subdevice, unsigned int channel, unsigned int range, unsigned int aref, double frequency, unsigned int num_samples, double * data); Status deprecated Description Not documented. 5.4.7.7 comedi_trigger comedi_trigger — perform streaming input/output (deprecated) Synopsis #include
Comedi 74 / 148 to the 8255’s port A, bit 0; channel 23 corresponds to port C, bit 7. Direction configuration is done in blocks, with channels 0-7, 8-15, 16-19, and 20-23 making up the 4 blocks. The only 8255 mode supported is mode 0. You should enable compilation this driver if you plan to use a board that has an 8255 chip. For multifunction boards, the main driver will configure the 8255 subdevice automatically.
Comedi 75 / 148 5.5.4 adl_pci7230 -- Driver for the Adlink PCI-7230 32 ch. isolated digital io board Author: David Fernandez Status: experimental Manufacturer ADLink Device PCI-7230 Name adl_pci7230 Configuration Options: [0] - PCI bus of device (optional) [1] - PCI slot of device (optional) If bus/slot is not specified, the first supported PCI device found will be used. 5.5.5 adl_pci7296 -- Driver for the Adlink PCI-7296 96 ch.
Comedi 76 / 148 [1] - PCI slot of device (optional) If bus/slot is not specified, the first supported PCI device found will be used. 5.5.7 adl_pci8164 -- Driver for the Adlink PCI-8164 4 Axes Motion Control board Author: Michel Lachaine
Comedi 77 / 148 [0] - PCI bus number (optional) [1] - PCI slot number (optional) If bus/slot is not specified, the first available PCI device will be used. 5.5.9 adl_pci9118 -- Adlink PCI-9118DG, PCI-9118HG, PCI-9118HR Author: Michal Dobes Status: works Manufacturer ADLink ADLink ADLink Device PCI-9118DG PCI-9118HG PCI-9118HR Name pci9118dg pci9118hg pci9118hr This driver supports AI, AO, DI and DO subdevices.
Comedi 78 / 148 0=use SSHO (pin 45) signal is generated in onboard hardware S&H logic 0!=use ADCHN7 (pin 23) signal is generated from driver, number say how long delay is requested in ns and sign polarity of the hold (in this case external multiplexor can serve only 128 channels) [5] - 0=stop measure on all hardware errors 2|=ignore ADOR - A/D Overrun status 8|=ignore Bover - A/D Burst Mode Overrun status 256|=ignore nFull - A/D FIFO Full status 5.5.
Comedi 79 / 148 written by jeremy theler instituto balseiro comision nacional de energia atomica universidad nacional de cuyo argentina 21-feb-2008 + changed supported devices string (missused the [] and ()) 13-oct-2007 + first try 5.5.11 adv_pci1710 -- Advantech PCI-1710, PCI-1710HG, PCI-1711, PCI-1713, Advantech PCI-1720, PCI-1731 Author: Michal Dobes
Comedi 80 / 148 Manufacturer Advantech Device PCI-1723 Name adv_pci1723 Configuration Options: [0] - PCI bus of device (optional) [1] - PCI slot of device (optional) If bus/slot is not specified, the first supported PCI device found will be used. Subdevice 0 is 8-channel AO, 16-bit, range +/- 10 V. Subdevice 1 is 16-channel DIO. The channels are configurable as input or output in 2 groups (0 to 7, 8 to 15). Configuring any channel implicitly configures all channels in the same group. 1.
Comedi 81 / 148 If bus/slot is not specified, the first available PCI device will be used. 5.5.14 aio_aio12_8 -- Acces I/O Products PC-104 AIO12-8 Analog I/O Board Author: Pablo Mejia Status: experimental Manufacturer Acces I/O Device PC-104 AIO12-8 Name adv_pci_dio Configuration Options: [0] - I/O port base address Only synchronous operations are supported. 5.5.
Comedi 82 / 148 Manufacturer Amplicon Amplicon Amplicon Amplicon Amplicon Device PC215E PCI215 PC218E PC272E PCI272 Name pc215e pci215 or amplc_dio200 pc218e pc272e pci272 or amplc_dio200 Configuration options - PC212E, PC214E, PC215E, PC218E, PC272E: [0] - I/O port base address [1] - IRQ (optional, but commands won’t work without it) Configuration options - PCI215, PCI272: [0] - PCI bus of device (optional) [1] - PCI slot of device (optional) If bus/slot is not specified, the first available PCI device
Comedi 83 / 148 INSN_CONFIG_8254_READ_STATUS. Reads the status register value for the counter channel into data[1]. INSN_CONFIG_SET_CLOCK_SRC. Sets the counter channel’s clock source as specified in data[1] (this is a hardware-specific value). Not supported on PC214E. For the other boards, valid clock sources are 0 to 7 as follows: 0. CLK n, the counter channel’s dedicated CLK input from the SK1 connector. (N.B. for other values, the counter channel’s CLKn pin on the SK1 connector is an output!) 1.
Comedi 84 / 148 have an interrupt status register; see notes on ’INTERRUPT SOURCES’ below.
Comedi 85 / 148 5.5.17 amplc_pc236 -- Amplicon PC36AT, PCI236 Author: Ian Abbott Status: works Manufacturer Amplicon Amplicon Device PC36AT PCI236 Name pc36at pci236 or amplc_pc236 Configuration options - PC36AT: [0] - I/O port base address [1] - IRQ (optional) Configuration options - PCI236: [0] - PCI bus of device (optional) [1] - PCI slot of device (optional) If bus/slot is not specified, the first available PCI device will be used.
Comedi 86 / 148 The state of the outputs can be read. 5.5.19 amplc_pci224 -- Amplicon PCI224, PCI234 Author: Ian Abbott
Comedi 87 / 148 [3] - Select channel 0 range according to jumper LK2: 0=Jumper position 2-3 (factory default), range [-2*Vref,+2*Vref] (10V bipolar when options[2]=0). 1=Jumper position 1-2, range [-Vref,+Vref] (5V bipolar when options[2]=0). [4] - Select channel 1 range according to jumper LK3: cf. options[3]. [5] - Select channel 2 range according to jumper LK4: cf. options[3]. [6] - Select channel 3 range according to jumper LK5: cf. options[3].
Comedi 88 / 148 Subdevices 0 1 AO 2 DIO PCI230(+) --------3 AI PCI260(+) --------1 AI AI Subdevice: The AI subdevice has 16 single-ended channels or 8 differential channels. The PCI230 and PCI260 cards have 12-bit resolution. PCI260+ cards have 16-bit resolution. The PCI230+ and For differential mode, use inputs 2N and 2N+1 for channel N (e.g. use inputs 14 and 15 for channel 7).
Comedi 89 / 148 convert_arg value is interpreted as follows: convert_arg convert_arg convert_arg convert_arg == == == == (CR_EDGE | 0) => rising edge (CR_EDGE | CR_INVERT | 0) => falling edge 0 => falling edge (backwards compatibility) 1 => rising edge (backwards compatibility) All entries in the channel list must use the same analogue reference. If the analogue reference is not AREF_DIFF (not differential) each pair of channel numbers (0 and 1, 2 and 3, etc.) must use the same input range.
Comedi 90 / 148 Port B - channels 8 to 15 Port CL - channels 16 to 19 Port CH - channels 20 to 23 Only mode 0 of the 8255 chip is supported. Bit 0 of port C (DIO channel 16) is also used as an external scan trigger input for AI commands on PCI230 and PCI230+, so would need to be configured as an input to use it for that purpose. 5.5.21 c6xdigio -- Mechatronic Systems Inc. C6x_DIGIO DSP daughter card Author: Dan Block Status: unknown Manufacturer Mechatronic Systems Inc.
Comedi 91 / 148 Manufacturer Measurement Computing Measurement Computing Measurement Computing Measurement Computing Measurement Computing Measurement Computing Measurement Computing Measurement Computing Measurement Computing Measurement Computing Measurement Computing Measurement Computing Measurement Computing Measurement Computing Measurement Computing Measurement Computing Measurement Computing Measurement Computing Measurement Computing Measurement Computing Measurement Computing Measurement Computin
Comedi 92 / 148 Manufacturer Measurement Computing Measurement Computing Measurement Computing Measurement Computing Measurement Computing Measurement Computing Measurement Computing Measurement Computing Device PCI-DAS1602/16 PCI-DAS1602/16jr PCI-DAS1602/12 PCI-DAS1200 PCI-DAS1200jr PCI-DAS1000 PCI-DAS1001 PCI_DAS1002 Name cb_pcidas cb_pcidas cb_pcidas cb_pcidas cb_pcidas cb_pcidas cb_pcidas cb_pcidas The boards may be autocalibrated using the comedi_calibrate utility.
Comedi 93 / 148 If bus/slot is not specified, the first available PCI device will be used. Only simple analog output writing is supported. So far it has only been tested with: - PCI-DDA08/12 Please report success/failure with other different cards to . 5.5.
Comedi 94 / 148 Developed from cb_pcidas and skel by Richard Bytheway (mocelet@sucs.org). Only supports DIO, AO and simple AI in it’s present form. No interrupts, multi channel or FIFO AI, although the card looks like it could support this ←. See http://www.measurementcomputing.com/PDFManuals/pcim-das1602_16.pdf for more details. 5.5.28 cb_pcimdda -- Measurement Computing PCIM-DDA06-16 Author: Calin Culianu
Comedi 95 / 148 5.5.29 comedi_bond -- A driver to ’bond’ (merge) multiple subdevices from multiple devices together as one. Author: ds Status: works This driver allows you to ’bond’ (merge) multiple comedi subdevices (coming from possibly difference boards and/or drivers) together. For example, if you had a board with 2 different DIO subdevices, and another with 1 DIO subdevice, you could ’bond’ them with this driver so that they look like one big fat DIO subdevice.
Comedi 96 / 148 9 10 11 12 13 14 15 16 17 18-25 0 1 1 1 1 2 1 2 2 ground 7 3 4 2 1 1 0 2 3 data 7 acknowledge busy output printer selected auto LF error init select printer Subdevices 0 is digital I/O, subdevice 1 is digital input, and subdevice 2 is digital output. Unlike other Comedi devices, subdevice 0 defaults to output. Pins 13 and 14 are inverted once by Comedi and once by the hardware, thus cancelling the effect. Pin 1 is a strobe, thus acts like one.
Comedi 97 / 148 Status: works This driver is mainly for testing purposes, but can also be used to generate sample waveforms on systems that don’t have data acquisition hardware. Configuration options: [0] - Amplitude in microvolts for fake waveforms (default 1 volt) [1] - Period in microseconds for fake waveforms (default 0.1 sec) Generates a sawtooth wave on channel 0, square wave on channel 1, additional waveforms could be added to other channels (currently they return flatline zero volts). 5.5.
Comedi 98 / 148 Configuration options: [0] - PCI bus of device (optional) [1] - PCI slot of device (optional) If bus/slot is not specified, the first supported PCI device found will be used. 5.5.
Comedi 99 / 148 Manufacturer ComputerBoards Device PCM-DAS08 Name pcm-das08 This is the PCMCIA-specific support split off from the das08 driver. Options (for pcm-das08): NONE Command support does not exist, but could be added for this board. 5.5.
Comedi 100 / 148 5.5.38 das16m1 -- CIO-DAS16/M1 Author: Frank Mori Hess Status: works Manufacturer Measurement Computing Device CIO-DAS16/M1 Name cio-das16/m1 This driver supports a single board - the CIO-DAS16/M1. As far as I know, there are no other boards that have the same register layout. Even the CIO-DAS16/M1/16 is significantly different.
Comedi 101 / 148 Manufacturer Keithley Metrabyte Keithley Metrabyte Keithley Metrabyte Keithley Metrabyte Keithley Metrabyte Device DAS-1802ST-DA DAS-1802HR DAS-1802HR-DA DAS-1802HC DAS-1802AO Name das-1802st-da das-1802hr das-1802hr-da das-1802hc das-1802ao The waveform analog output on the ’ao’ cards is not supported. If you need it, send me (Frank Hess) an email.
Comedi 102 / 148 [1] - IRQ (optional, required for timed or externally triggered conversions) All entries in the channel/gain list must use the same gain and be consecutive channels counting upwards in channel number (these are hardware limitations.) I’ve never tested the gain setting stuff since I only have a DAS-800 board with fixed gain. The cio-das802/16 does not have a fifo-empty status bit! Therefore only fifo-half-full transfers are possible with this card. 5.5.
Comedi 103 / 148 [3] - A/D range 0 = [-10,10] 1 = [0,10] [4] - D/A 0 range 0 = [-10,10] 1 = [-5,5] 2 = [-2.5,2.5] 3 = [0,10] 4 = [0,5] [5] - D/A 1 range (same choices) 5.5.
Comedi 104 / 148 This card has 16 analog inputs multiplexed onto a 12 bit ADC. There is a minimally useful onboard clock. The base frequency for the clock is selected by jumpers, and the clock divider can be selected via programmed I/O. Unfortunately, the clock divider can only be a power of 10, from 1 to 10^7, of which only 3 or 4 are useful. In addition, the clock does not seem to be very accurate. 5.5.
Comedi 105 / 148 Status: complete
Comedi 106 / 148 Manufacturer Data Translation Device DT2817 Name dt2817 A very simple digital I/O card. Four banks of 8 lines, each bank is configurable for input or output. One wonders why it takes a 50 page manual to describe this thing. The driver (which, btw, is much less than 50 pages) has 1 subdevice with 32 channels, configurable in groups of 8. Configuration options: [0] - I/O port base base address 5.5.
Comedi 107 / 148 5.5.
Comedi 108 / 148 5.5.51 fl512 -- unknown Author: Anders Gnistrup Status: unknown Manufacturer unknown Device FL512 Name fl512 Digital I/O is not supported. Configuration options: [0] - I/O port base address 5.5.52 gsc_hpdi -- General Standards Corporation High Speed Parallel Digital Interface rs485 boards Author: Frank Mori Hess
Comedi 109 / 148 It has 16 single-ended or 8 differential Analogue Input channels with 12-bit resolution. Ranges : 5V, 10V, +/-5V, +/-10V, 0..20mA and 4..20mA. Input ranges can be individually programmed for each channel. Voltage or current measurement is selected by jumper. There are 4 x 12-bit Analogue Outputs. Ranges : 5V, 10V, +/-5V, +/-10V 16 x Digital Inputs, 24V 8 x Digital Outputs, 24V, 1A 4 x 16-bit counters 5.5.
Comedi 110 / 148 The DSP on the board requires initialization code, which can be loaded by placing it in /lib/firmware/comedi. The initialization code should be somewhere on the media you got with your card. One version is available from http://www.comedi.org in the comedi_nonfree_firmware tarball. Configuration options: [0] - PCI bus number - if bus number and slot number are 0, then driver search for first unused card [1] - PCI slot number 5.5.
Comedi 111 / 148 - Analog Output - Digital I/O - Counter Configuration Options: [0] - PCI bus number (optional) [1] - PCI slot number (optional) If bus/slot is not specified, the first available PCI device will be used. The firmware required by these boards is available in the comedi_nonfree_firmware tarball available from 5.5.58 me_daq -- Meilhaus PCI data acquisition cards Author: Michael Hillmann
Comedi 112 / 148 Manufacturer Micro/sys Device MPC-624 Name mpc624 The Micro/sys MPC-624 board is based on the LTC2440 24-bit sigma-delta ADC chip. Subdevices supported by the driver: - Analog In: supported - Digital I/O: not supported - LEDs: not supported - EEPROM: not supported Configuration Options: [0] - I/O base address [1] - convertion rate Convertion rate RMS noise 0 3.52kHz 23uV 1 1.76kHz 3.5uV 2 880Hz 2uV 3 440Hz 1.4uV 4 220Hz 1uV 5 110Hz 750uV 6 55Hz 510nV 7 27.5Hz 375nV 8 13.75Hz 250nV 9 6.
Comedi 113 / 148 5.5.61 multiq3 -- Quanser Consulting MultiQ-3 Author: Anders Blomdell Status: works Manufacturer Quanser Consulting 5.5.62 Device MultiQ-3 Name multiq3 ni_6527 -- National Instruments 6527 Author: ds Status: works Manufacturer National Instruments National Instruments 5.5.63 Device PCI-6527 PXI-6527 Name ni6527 ni6527 ni_65xx -- National Instruments 65xx static dio boards Author: Jon Grierson , Frank Mori Hess
Comedi 114 / 148 Manufacturer National Instruments National Instruments National Instruments National Instruments Device PCI-6521 PXI-6521 PCI-6528 PXI-6528 Name ni_65xx ni_65xx ni_65xx ni_65xx Based on the PCI-6527 driver by ds. The interrupt subdevice (subdevice 3) is probably broken for all boards except maybe the 6514. 5.5.64 ni_660x -- National Instruments 660x counter/timer boards Author: J.P. Mellor , Herman.Bruyninckx@mech.kuleuven.ac.be, Wim.Meeussen@mech.kuleuven.
Comedi 115 / 148 5.5.66 ni_at_a2150 -- National Instruments AT-A2150 Author: Frank Mori Hess Status: works Manufacturer National Instruments National Instruments Device AT-A2150C AT-2150S Name at_a2150c at_a2150s If you want to ac couple the board’s inputs, use AREF_OTHER. Configuration options: [0] - I/O port base address [1] - IRQ (optional, required for timed conversions) [2] - DMA (optional, required for timed conversions) 5.5.
Comedi 116 / 148 Manufacturer National Instruments National Instruments 5.5.
Comedi 117 / 148 5.5.70 ni_daq_700 -- National Instruments PCMCIA DAQCard-700 DIO only Author: Fred Brooks , based on ni_daq_dio24 by Daniel Vecino Castel Status: works Manufacturer National Instruments Device PCMCIA DAQ-Card-700 Name ni_daq_700 The daqcard-700 appears in Comedi as a single digital I/O subdevice with 16 channels. The channel 0 corresponds to the daqcard-700’s output port, bit 0; channel 8 corresponds to the input port, bit 0.
Comedi 118 / 148 Tested with lab-pc-1200. For the older Lab-PC+, not all input ranges and analog references will work, the available ranges/arefs will depend on how you have configured the jumpers on your board (see your owner’s manual). Kernel-level ISA plug-and-play support for the lab-pc-1200 boards has not yet been added to the driver, mainly due to the fact that I don’t know the device id numbers. If you have one of these boards, please file a bug report at https://bugs.comedi.
Comedi 119 / 148 Configuration options: none The daqcard-1200 has quirky chanlist requirements when scanning multiple channels. Multiple channel scan sequence must start at highest channel, then decrement down to channel 0. Chanlists consisting of all one channel are also legal, and allow you to pace conversions in bursts. 5.5.
Comedi 120 / 148 The DIO-96 appears as four 8255 subdevices. driver notes for details. See the 8255 The DIO32HS board appears as one subdevice, with 32 channels. Each channel is individually I/O configurable. The channel order is 0=A0, 1=A1, 2=A2, ... 8=B0, 16=C0, 24=D0. The driver only supports simple digital I/O; no handshaking is supported. DMA mostly works for the PCI-DIO32HS, but only in timed input mode. The PCI-DIO-32HS/PCI-6533 has a configurable external trigger.
Comedi 121 / 148 Manufacturer National Instruments National Instruments National Instruments National Instruments National Instruments National Instruments National Instruments National Instruments National Instruments National Instruments National Instruments National Instruments National Instruments National Instruments National Instruments National Instruments National Instruments National Instruments National Instruments National Instruments National Instruments National Instruments National Instrument
Comedi 122 / 148 The RTSI trigger bus is supported on these cards on subdevice 10. See the comedilib documentation for details. Information (number of channels, bits, etc.) for some devices may be incorrect. Please check this and submit a bug if there are problems for your device. SCXI is probably broken for m-series boards. 5.5.77 ni_tio -- National Instruments general purpose counters Author: J.P. Mellor , Herman.Bruyninckx@mech.kuleuven.ac.be, Wim.Meeussen@mech.kuleuven.ac.
Comedi 123 / 148 Manufacturer Advantech Advantech AdLink AdLink Device PCL-711 PCL-711B ACL-8112HG ACL-8112DG Name pcl711 pcl711b acl8112hg acl8112dg Since these boards do not have DMA or FIFOs, only immediate mode is supported. 5.5.80 pcl724 -- Advantech PCL-724, PCL-722, PCL-731 ADLink ACL-7122, ACL-7124, PET-48DIO Author: Michal Dobes Status: untested Manufacturer Advantech Advantech Advantech ADLink ADLink ADLink This is and for It need See the 5.5.
Comedi 124 / 148 5.5.82 pcl726 -- Advantech PCL-726 & compatibles Author: ds Status: untested Manufacturer Advantech Advantech Advantech ADLink ADLink Device PCL-726 PCL-727 PCL-728 ACL-6126 ACL-6128 Name pcl726 pcl727 pcl728 acl6126 acl6128 Interrupts are not supported. Options for PCL-726: [0] - IO Base [2]...[7] - D/A output range for channel 1-6: 0: 0-5V, 1: 0-10V, 2: +/-5V, 3: +/-10V, 4: 4-20mA, 5: unknown (external reference) Options for PCL-727: [0] - IO Base [2]...
Comedi 125 / 148 The ACL-7130 card have an 8254 timer/counter not supported by this driver. 5.5.84 pcl812 -- Advantech PCL-812/PG, PCL-813/B, ADLink ACL-8112DG/HG/PG, ACL-8113, ACL-8216, ICP DAS A821PGH/PGL/PGL-NDA, A-822PGH/PGL, A-823PGH/PGL, A-826PG, ICP DAS ISO-813 Author: Michal Dobes Status: works (I hope. My board fire up under my hands and I cann’t test all features.
Comedi 126 / 148 [3] - 0=trigger source is internal 8253 with 2MHz clock 1=trigger source is external [4] - 0=A/D have max +/-5V input 1=A/D have max +/-10V input [5] - 0=D/A outputs 0-5V (internal reference -5V) 1=D/A outputs 0-10V (internal reference -10V) 2=D/A outputs unknow (external reference) Options [0] [1] [2] [3] - for ACL-8112DG/HG, A-822PGL/PGH, A-823PGL/PGH, ACL-8216, A-826PG: IO Base IRQ (0=disable, 2, 3, 4, 5, 6, 7; 10, 11, 12, 14, 15) DMA (0=disable, 1, 3) 0=trigger source is internal 8253
Comedi 127 / 148 Manufacturer Advantech Device PCL-814B Name pcl814b PCL 816 and 814B have 16 SE/DIFF ADCs, 16 DACs, 16 DI and 16 DO. Differences are at resolution (16 vs 12 bits). The driver support AI command mode, other subdevices not written. Analog output and digital input and output are not supported. Configuration Options: [0] - IO Base [1] - IRQ (0=disable, 2, 3, 4, 5, 6, 7) [2] - DMA (0=disable, 1, 3) [3] - 0, 10=10MHz clock for 8254 1= 1MHz clock for 8254 5.5.
Comedi 128 / 148 If you’ve data dropouts with DMA mode 2 then: a) disable IDE DMA b) switch text mode console to fb. Options for PCL-818L: [0] - IO Base [1] - IRQ (0=disable, 2, 3, 4, 5, 6, 7) [2] - DMA (0=disable, 1, 3) [3] - 0, 10=10MHz clock for 8254 1= 1MHz clock for 8254 [4] - 0, 5=A/D input -5V.. +5V 1, 10=A/D input -10V..
Comedi 129 / 148 5.5.87 pcm3724 -- Advantech PCM-3724 Author: Drew Csillag Status: tested Manufacturer Advantech Device PCM-3724 Name pcm724 This is driver for digital I/O boards PCM-3724 with 48 DIO. It needs 8255.o for operations and only immediate mode is supported. See the source for configuration details. Copy/pasted/hacked from pcm724.c 5.5.
Comedi 130 / 148 Configuration options: [0] - I/O port base [1] - unused [2] - Analog input reference 0 = single ended 1 = differential [3] - Analog input encoding (must match jumpers) 0 = straight binary 1 = two’s complement 5.5.90 pcmda12 -- A driver for the Winsystems PCM-D/A-12 Author: Calin Culianu Status: works Manufacturer Winsystems Device PCM-D/A-12 Name pcmda12 A driver for the relatively straightforward-to-program PCM-D/A-12.
Comedi 131 / 148 Manufacturer Winsystems Device PCM-MIO Name pcmmio A driver for the relatively new PCM-MIO multifunction board from Winsystems. This board is a PC-104 based I/O board.
Comedi 132 / 148 Status: works Manufacturer Winsystems Winsystems Device PCM-UIO48A PCM-UIO96A Name pcmuio48 pcmuio96 A driver for the relatively straightforward-to-program PCM-UIO48A and PCM-UIO96A boards from Winsystems. These boards use either one or two (in the 96-DIO version) WS16C48 ASIC HighDensity I/O Chips (HDIO). This chip is interesting in that each I/O line is individually programmable for INPUT or OUTPUT (thus comedi_dio_config can be done on a per-channel basis).
Comedi 133 / 148 5.5.93 poc -- Generic driver for very simple devices Author: ds Status: unknown Manufacturer Keithley Metrabyte Advantech Advantech Device DAC-02 PCL-733 PCL-734 Name dac02 pcl733 pcl734 This driver is indended to support very simple ISA-based devices, Configuration options: [0] - I/O port base 5.5.94 quatech_daqp_cs -- Quatech DAQP PCMCIA data capture cards Author: Brent Baccala Status: works Manufacturer Quatech Quatech 5.5.
Comedi 134 / 148 5.5.
Comedi 135 / 148 [4] - dac#1 ... ... [17] - dac#7 ... 5.5.98 s526 -- Sensoray 526 driver Author: Richie Everett Wang Status: experimental Manufacturer Sensoray Device 526 Name s526 Encoder works Analog input works Analog output works PWM output works Commands are not supported yet. Configuration Options: comedi_config /dev/comedi0 s526 0x2C0,0x3 5.5.99 s626 -- Sensoray 626 driver Author: Richie Everett Wang <everett.wang@everteq.
Comedi 136 / 148 digital channel: s626 has 3 dio subdevices (2,3 and 4) each with 16 i/o channels supported configuration options: INSN_CONFIG_DIO_QUERY COMEDI_INPUT COMEDI_OUTPUT encoder: Every channel must be configured before reading. Example code insn.insn=INSN_CONFIG; //configuration instruction insn.n=1; //number of operation (must be 1) insn.data=&initialvalue; //initial value loaded into encoder //during configuration insn.subdev=5; //encoder subdevice insn.
Comedi 137 / 148 Manufacturer SSV Embedded Systems 5.5.103 Device DIL/Net-PC 1486 Name dnp-1486 unioxx5 -- Driver for Fastwel UNIOxx-5 (analog and digital i/o) boards. Author: Kruchinin Daniil (asgard) Status: unknown Manufacturer Fastwel Fastwel Device UNIOxx-5 UNIOxx-5 Name unioxx5 unioxx5 This card supports digital and analog I/O. It written for g01 subdevices only. channels range: 0 .. 23 dio channels and 0 ..
Comedi 138 / 148 - - - - convert: now scan_end: count stop: none|count Analogue output: subdevice: 1 number of channels: 4 max data value: 4095 ranges: all channels: range = 0 : [-4.096 V,4.096 V] range = 1 : [0 V,4.096 V] command: start: now|int scan_begin: timer (contains the sampling interval. min is 1ms.
Comedi 139 / 148 number of channels: 16 max data value: 4096 ranges: all channelss: range = 0 : [-0.75 V,0.75 V] range = 1 : [-0.5 V,0.5 V] command: The channel-list allows 1,2,3 and 16 channels. start: now|ext|int (external trigger via pin at HD-D connector) scan_begin: follow|timer|ext convert: timer|ext (contains the sampling interval.
Comedi 140 / 148 start: now|int scan_begin: timer (contains the sampling interval. min 1ms) convert: now scan_end: count stop: none|count - Digital I/O subdevice: 2 number of channels: 24 (first 8 bits on the D connector, 16 bits int.
Comedi 141 / 148 All user-space Comedi instructions and commands are transmitted to kernel space through a traditional ioctl() system call. (See lib/ioctl.c in Comedilib.) The user-space information command is encoded as a number in the ioctl() call, and decoded in the kernel-space library. There, they are executed by their kernel-space counterparts. This is done in the comedi_fops.
Comedi 142 / 148 In addition to these data entities that are also known at the user level (device, sub-device, channel), the device driver level provides two more data structures which the application programmer doesn’t get in touch with: the data structure comedi_driver that stores the device driver information that is relevant at the operating system level, and the data structure comedi_async that stores the information about all asynchronous activities (interrupts, callbacks and events). 6.2.1.
Comedi 143 / 148 }; The function pointers insn_read . . . cancel . offer (pointers to) the standardized user-visible API that every subdevice should offer; every device driver has to fill in these functions with their board-specific implementations. (Functionality for which Comedi provides generic functions will, by definition, not show up in the device driver data structures.
Comedi 144 / 148 volatile unsigned int buf_write_alloc_count; /* byte count for writer (allocated for writing) */ volatile unsigned int buf_read_count; /* byte count for reader (read completed)*/ ←- unsigned int buf_write_ptr; /* buffer marker for writer */ unsigned int buf_read_ptr; /* buffer marker for reader */ unsigned int cur_chan; /* useless channel marker for interrupt */ /* number of bytes that have been received for current scan */ unsigned int scan_progress; /* keeps track of where we are in ch
Comedi 145 / 148 int comedi_register_callback(comedi_t *d,unsigned int subdevice, unsigned int mask,int (* ←cb)(unsigned int,void *),void *arg); int comedi_poll(comedi_t *d, unsigned int subdevice); void comedi_perror(const char *message); The file comedi/rt.
Comedi 146 / 148 Typically, you will be able to implement most of the above-mentioned functionality by cut-and-paste from already existing drivers. The mydriver_attach() function needs most of your attention, because it must correctly define and allocate the (private and generic) data structures that are needed for this device. That is, each sub-device and each channel must get appropriate data fields, and an appropriate initialization.
Comedi 147 / 148 6.5 Device driver caveats A few things to strive for when writing a new driver: • Some DAQ cards consist of different ‘layers’ of hardware, which can each be given their own device driver. Examples are: some of the National Instruments cards, that all share the same Mite PCI driver chip; the ubiquitous parallel port, that can be used for simple digital IO acquisitions. If your new card has such a multi-layer design too, please take the effort to provide drivers for each layer separately.
Comedi 148 / 148 Differential IO ... Direct Memory Access (DMA) DMA is a method of transferring data between a device and the main memory of a computer. DMA operates differently on ISA and PCI cards. ISA DMA is handled by a controller on the motherboard and is limited to transfers to/from the lowest 16 MB of physical RAM and can only handle a single segment of memory at a time. These limitations make it almost useless.