[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
COMEDI wrapper (was: Re: Data acquisition in Octave)
From: |
John W. Eaton |
Subject: |
COMEDI wrapper (was: Re: Data acquisition in Octave) |
Date: |
Thu, 20 Nov 2008 12:04:49 -0500 |
On 19-Nov-2008, Olaf Till wrote:
| Data aquisition on Linux is mostly done (and should be done) with the
| so called Comedi drivers and the Comedi library. They have good
| support for National Instruments cards.
|
| AFAIK there is no general interface of Octave to Comedi as
| yet.
I have the beginnings of a package here:
ftp://velveeta.che.wisc.edu/pub/octave-comedi/comedi-0.1.tar.gz
The md5sum of this file is si6994b6e3ada0442eae4f2d0baecc9880.
The following functions from comedilib.h are implemented:
comedi_open
comedi_close
comedi_loglevel
comedi_perror
comedi_strerror
comedi_errno
comedi_fileno
comedi_get_n_subdevices
comedi_get_version_code
comedi_get_driver_name
comedi_get_board_name
comedi_get_read_subdevice
comedi_get_write_subdevice
comedi_get_subdevice_type
comedi_find_subdevice_by_type
comedi_get_subdevice_flags
comedi_get_n_channels
comedi_range_is_chan_specific
comedi_maxdata_is_chan_specific
comedi_get_maxdata
comedi_get_n_ranges
comedi_get_range
comedi_find_range
comedi_get_buffer_size
comedi_get_max_buffer_size
comedi_set_buffer_size
comedi_lock
comedi_unlock
comedi_to_phys
comedi_from_phys
comedi_data_read
comedi_data_read_n
comedi_data_read_hint
comedi_data_read_delayed
comedi_data_write
comedi_dio_config
comedi_dio_get_config
comedi_dio_read
comedi_dio_write
comedi_dio_bitfield2
comedi_cancel
comedi_poll
comedi_set_max_buffer_size
comedi_get_buffer_contents
comedi_mark_buffer_read
comedi_mark_buffer_written
comedi_get_buffer_offset
The following still need to be written:
comedi_set_global_oor_behavior
comedi_do_insnlist
comedi_do_insn
comedi_sampl_to_phys
comedi_sampl_from_phys
comedi_get_cmd_src_mask
comedi_get_cmd_generic_timed
comedi_command
comedi_command_test
Are these functions required to do something useful with the library?
If so, I can probably add them soon, but I could probably also use
some help from someone more familiar with the COMEDI library.
I skipped everything that was marked as deprecated or experimental in
the comedilib.h header file or documentation.
I also added one function that is not part of the COMEDI library
called comedi_constant that provides the values of various constants
defined in the comedilib header file. For example,
aref_ground = comedi_constant ("AREF_GROUND");
or you may use
s = comedi_constant ();
to get all the known constants in a structure.
I realize that these functions could be generated with swig, but I
chose to write them by hand with some macros to eliminate some code
duplication.
One thing I'm not sure of is whether we should simply return status
codes as the underlying library functions do, or generate errors if a
library call fails. I've currently chosen to have the functions
return status codes as the COMEDI library functions do.
I don't have any data acquisition hardware so my only testing was to
try a few things using the comedi_test driver. I could use some help
with testing, bug fixes, or additional code...
Thanks,
jwe