Commit graph

118 commits

Author SHA1 Message Date
Ian Abbott
2fb6289b1c comedi.h: replace bare 'unsigned' with 'unsigned int' 2016-05-16 11:24:07 +01:00
Ian Abbott
aff4937e03 Added some more buffer position functions for use with mmap
Added comedi_get_buffer_read_offset(), comedi_get_buffer_write_offset(),
comedi_get_buffer_read_count(), and comedi_get_buffer_write_count().

comedi_get_buffer_read_offset() is the same as
comedi_get_buffer_offset(), which has now been documented as deprecated,
but is currently still declared in "comedilib.h" by default.  It gets
the read position within the buffer as an offset from the start of the
buffer (modulo the buffer size).

comedi_get_buffer_write_offset() gets the write position within the
buffer as an offset from the start of the buffer (modulo the buffer
size).

comedi_get_buffer_read_count() gets the number of bytes read from the
buffer, modulo UINT_MAX+1.

comedi_get_buffer_write_count() gets the number of bytes written to the
buffer, modulo UINT_MAX+1.
2016-05-13 15:14:47 +01:00
Ian Abbott
43a3ae9a27 comedilib.h: Don't mark 'data' parameter of comedi_data_read_n for SWIG
The 'data' parameter (of type lsampl_t*) for
comedi_data_read_n(it,subd,chan,range,aref,data,n) is currently marked
as an OUTPUT parameter for SWIG, but we can only do that for single
objects, and this one points to an array of objects.
2016-05-12 18:52:35 +01:00
Ian Abbott
66070c6af6 Add comedi_set_read_subdevice() and comedi_set_write_subdevice()
These functions allow the current read or write subdevice to be changed
to another subdevice that supports streaming input (for read), or
streaming output (for write) asynchronous commands.

They return 0 on success, in which case the comedi_get_read_subdevice()
or comedi_get_write_subdevice() functions will get the updated read or
write subdevice.

Changes are local to the "open file description" that was created by
comedi_open() (actually, by open()), and have no effect on other open
file descriptions created by other calls to comedi_open() (or open())
for the same underlying Comedi device node.

Changes to the read or write subdevice is not currently supported by the
comedi.org version of the Comedi drivers, but is supported by the Linux
"in-tree" Comedi drivers since kernel version 3.19.
2016-05-12 18:10:59 +01:00
Ian Abbott
27509ba9c9 Add digital trigger configuration functions
Add wrapper functions for the INSN_CONFIG_DIGITAL_TRIG configuration
instruction.  These are comedi_digital_trigger_disable(),
comedi_digital_trigger_enable_edges(), and
comedi_digital_trigger_enable_levels().
2016-03-21 11:28:29 +00:00
Ian Abbott
c85d380b93 comedilib.h: fix a typo in a comment 2016-03-21 11:28:29 +00:00
Ian Abbott
ac2ce44520 Add channel-specific arm, disarm, and reset wrappers.
The comedi_arm(), comedi_disarm(), and comedi_reset() functions always
set the channel number in the corresponding configuration instructions
to 0, as they assume the channel number will be ignored by the driver.
Some drivers do in fact use the channel number in these configuration
instructions.  Add additional wrapper functions comedi_arm_channel(),
comedi_disarm_channel(), and comedi_reset_channel() to allow the channel
number to be specified.
2016-03-21 11:28:29 +00:00
Ian Abbott
2062d615ff Add comedi_disarm() and bump to 0.11.0
Add the comedi_disarm() function to send the INSN_CONFIG_DISARM
configuration instruction to a subdevice.

In configure.ac, bump the comedilib libtool version code to 11:0:11, so
the comedilib version becomes 0.11.0.  Also bump the comedilib manual
version to 0.11.0 in doc/comedilib.ent.
2016-03-21 11:28:29 +00:00
Ian Abbott
0378db7399 comedi.h: adjust header comment
Don't mention where the header gets installed.
2016-03-21 11:27:40 +00:00
Ian Abbott
8b01d77b80 comedi.h: Add note that the "aux data" config options are still used
The COMEDI_DEVCONF_AUX_DATA3_LENGTH, COMEDI_DEVCONF_AUX_DATA2_LENGTH,
COMEDI_DEVCONF_AUX_DATA1_LENGTH, COMEDI_DEVCONF_AUX_DATA0_LENGTH,
COMEDI_DEVCONF_AUX_DATA_HI, COMEDI_DEVCONF_AUX_DATA_LO, and
COMEDI_DEVCONF_AUX_DATA_LENGTH config option indices are still used by
the standalone COMEDI kernel modules built from comedi.org sources for
loading firmware in some driver modules, although they are no longer
used by the COMEDI kernel modules in the Linux kernel sources.  Adjust
the comment to reflect this.
2016-03-21 11:08:06 +00:00
Ian Abbott
ef4c4e2e08 Avoid using BIT(x) macro
The BIT(x) macro is used by some internal kernel headers and is not
used in user API kernel headers.  It was used incorrectly in the
"staging" kernel version of "comedi.h" in the "linux-next" tree for a
brief period.

Replace the use of BIT(x) with explicit masks.  Handle CR_INVERT
specially in SWIG to avoid it appearing as a negative integer.
_CR_FLAGS_MASK was defined twice, identically, in SWIG, so remove one of
the definitions.
2016-03-21 10:35:16 +00:00
Spencer E. Olson
b9821b9d8c Sync removal of obsolete/useless items in comedi.h
This patch removes COMEDI_CB_* macros that are of no use to userspace at
any rate.  COMEDI_CB_* are no longer in comedi.h in the staging tree, but
rather in comedidev.h.

This patch also removes an old commented-out INSN_CONFIG_GET_OTHER_SRC, the
value of which was already taken long ago by
INSN_CONFIG_GET_HARDWARE_BUFFER_SIZE.
2016-03-18 12:26:52 -06:00
Spencer E. Olson
5d36757aa6 Move old items of comedi.h into new "deprecated" section
This allows the body of comedi to maintain visual sync to that of the
staging tree.
2016-03-18 12:19:22 -06:00
Spencer E. Olson
5cb320d559 Use BIT(x) macro for better sync to staging comedi.h
This patch defines a copy of the kernel BIT(x) macro and syncs the use of
BIT(x) between the staging tree and comedilib versions of comedi.h
2016-03-18 12:09:04 -06:00
Spencer E. Olson
0bb9805c82 Inherit documentation from staging comedi.h
This partial sync of staging tree to the comedilib version of comedi.h
brings documentation and some mild formatting.  The documentation should be
beneficial to userspace and the sync helps to visually maintain future
syncing between kernel and userspace code.
2016-03-18 12:05:17 -06:00
Spencer E. Olson
823bf1e398 Teach SWIG to properly handle some unsigned consts for python
This revisits the change made in da0fe745fc:
1)  Changes c-macro constants back to their original definition (without
    explicit typing them as unsigned) so-as to more exactly compare
    the comedilib version of comedi.h with that of the kernel module.
2)  Removes the duplicate definition of NI_GPCT_INVERT_CLOCK_SRC_BIT in
    comedi.i.
3)  Instead of redefining the macros to fix the mishandling of signedness
    by SWIG for python, teach SWIG to treat these as unsigned ints.
2016-03-18 10:17:11 -06:00
Spencer E. Olson
9d4b7367eb change static inline NI_* to macros
This is a partial sync of the staging tree to comedilib with these
benefits:
1.  This is first in a series of patches to sync comedilib to the kernel
    modules in the staging development tree.  The point of this series of
    patches is to make the syncing of the userspace and kernel comedi.h
    files be visually more easily done.

2.  This patch also teaches SWIG out to properly wrap these macros and
    provide them to the user.

3.  The redef of static inline NI_* functions as macro functions eases
    alternative use of comedi.h as an import source for a new ctypes-based
    python interface for comedilib.
2016-03-18 10:12:37 -06:00
Ian Abbott
ba27bddca4 include/comedi.h: synced with comedi
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
2016-03-18 12:07:08 +00:00
Éric Piel
da0fe745fc include: explicitly indicate values are unsigned when it could matter
In C, mixing up between int and unsigned int doesn't matter too much for constants
because in memory they end up the same.
However, in Python, they appear differently.

Swig assumes (wrongly?) by default that the constants are signed, intead of being unsigned.
For every value equal or greater that 2**31, it matters.
For instance CR_INVERT should be 2147483648, but it is -2147483648 in python.
By marking the values explicitly unsigned, swig generates the right values.

That's excepted for enum, which swig just consider int. So for the only constant in that
case, we manually override it in swig.
2015-06-08 11:21:11 +01:00
Ian Abbott
18fc613988 include/comedi.h: synced with comedi
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
2013-05-14 17:35:49 +01:00
Ian Abbott
ddec51884b include/comedi.h: synced with comedi
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
2013-03-21 16:27:56 +00:00
Ian Abbott
ee2986755a include/comedi.h: synced with comedi
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
2012-04-16 14:53:28 +01:00
Ian Abbott
cceb2bc250 Fix a couple of typos.
A couple of the include files are missing the 'p' in 'published' in the
file header comment.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
2011-05-11 12:05:55 +01:00
Ian Abbott
91a3504623 Add comedilib_version.h header, produced by ./configure,
included by comedilib.h, containing COMEDILIB_VERSION_MAJOR,
COMEDILIB_VERSION_MINOR, COMEDILIB_VERSION_MICRO, and
COMEDILIB_CHECK_VERSION(major,minor,micro).  This can be used to perform
C pre-processor checks for API changes in comedilib.
2011-01-26 16:29:34 +00:00
Ian Abbott
eb57419204 Tag comedi_sv_measure's data as a swig output in comedilib.h.
Patch from W. Trevor King.
2010-12-16 11:29:10 +00:00
Ian Abbott
b8a4f1a265 Added channel parameter to comedi_set_clock_source() and
comedi_get_clock_source().  Bumped library version to 0.10.0.
2010-03-19 13:44:56 +00:00
Ian Abbott
f2fdf25018 Move "comedi_errno.h" into "include/" and install it. 2009-02-18 14:47:06 +00:00
Ian Abbott
24147c08a4 Allow swig to include comedi.h and comedilib.h from comedi.i to avoid
duplication.
2009-01-30 14:51:38 +00:00
Frank Mori Hess
ac9f5f248f synced with comedi. 2008-09-16 14:01:38 +00:00
Frank Mori Hess
d0956ca8b5 Added comedi_get_hardware_buffer_size() wrapper function, and made
comedi_strerror return a const char*.
2008-03-28 15:56:35 +00:00
Frank Mori Hess
2edd66775b synced with comedi. 2008-03-28 15:29:16 +00:00
Frank Mori Hess
a06bba542a Added more INSN_CONFIG wrappers: comedi_get_clock_source(),
comedi_get_gate_source(), and comedi_get_routing().  Added "channel"
parameter to some of the INSN_CONFIG wrappers.
2008-01-23 18:56:52 +00:00
Frank Mori Hess
76791bfeed Added comedi_set_filter() and comedi_set_routing() configuration
instruction wrappers.
2008-01-18 16:37:32 +00:00
Frank Mori Hess
b3627840ac Added reference entries for new configuration instruction wrappers. 2008-01-17 17:03:01 +00:00
Frank Mori Hess
4d07ce9969 Moved some wrappers for INSN_CONFIG instructions into comedilib.
Will add some reference documentation for the new functions soon.
2008-01-15 21:01:40 +00:00
Bernd Porr
9493cf1b47 Synced this with comedi. PWM support. 2008-01-13 23:18:05 +00:00
Ian Abbott
df5e7fde3f Synced with comedi. 2007-11-30 12:24:08 +00:00
Frank Mori Hess
c73ce599a6 synced with comedi. 2007-10-29 00:58:41 +00:00
Frank Mori Hess
334b16aabe Synced with comedi. 2007-10-17 20:17:43 +00:00
Frank Mori Hess
e8ad2b3498 Sync with comedi. 2007-09-28 19:02:02 +00:00
Frank Mori Hess
e448dd685e Got rid of redundant EXTRA_DIST 2007-08-27 20:32:07 +00:00
Frank Mori Hess
da5769b50f synced with comedi. 2007-08-13 21:18:47 +00:00
Frank Mori Hess
c1082cee65 Fixed comedi_get_cmd_generic_timed() by adding a chanlist_len
parameter.  Old version is still available in library, thanks to the
magic of the version_script.
2007-08-02 19:46:44 +00:00
Frank Mori Hess
2d7d5f9bf3 Took comedi_dio_bitfield out of _COMEDILIB_DEPRECATED for release,
until bindings are updated.
2007-07-31 14:27:21 +00:00
Frank Mori Hess
c8ff80779b Synced with comedi. 2007-07-16 15:01:06 +00:00
Frank Mori Hess
23acd1d5bd Sync with comedi. 2007-07-13 20:32:43 +00:00
Frank Mori Hess
c5bd91e4c8 sync with comedi 2007-07-12 14:56:21 +00:00
Frank Mori Hess
9804a8c81d Demo program for quadrature encoder counting with NI GPCT, from
Anders Blomdell <anders.blomdell@control.lth.se>
2007-06-28 01:22:38 +00:00
Frank Mori Hess
88d88b1f41 synced with comedi. 2007-02-26 17:24:24 +00:00
Frank Mori Hess
a5cbc369a1 synced with comedi. 2007-01-08 21:54:15 +00:00