From: Alexis Berlemont <berlemont.hauw@domain.hid>
To: Stefan Schaal <sschaal@domain.hid>
Cc: Jonas Buchli <jonas@domain.hid>,
Peter Pastor Sampedro <pastorsa@domain.hid>,
Ludovic Righetti <ludovic.righetti@domain.hid>,
xenomai@xenomai.org
Subject: Re: [Xenomai-core] digital I/O with analgoy using ni_pcmcia
Date: Tue, 22 Dec 2009 00:23:46 +0100 [thread overview]
Message-ID: <4B300382.6070802@domain.hid> (raw)
In-Reply-To: <1F6D4575-0CF0-49E6-A7ED-1A045BE8D5B4@domain.hid>
Hi,
Stefan Schaal wrote:
> Hi everybody,
>
> we have an NI6259 board working xenomai 2.5, using the analogy APIs.
> Read/write to analog channels is quite straightforward and can be
> inferred from the cmd_read and cmd_write source code. Now I would also
> like to use the digital I/O of this board (e.g., the 32 digital I/O
> lines). In Comedi, there are functions to set the DIO lines to
> input/output mode (comedi_dio_config), and then functions to read/write,
> like comedi_dio_read and comedi_dio_write. Does xenomai/analogy already
> have similar functionality?
Many thanks for this question, it is an issue I have been
keeping on postponing the resolution. Currently, the functions are not
implemented but it could be quickly done.
Here is my understanding of the Comedi DIO features; please, correct
me if I am wrong.
In Comedi, here is the list of functions related with DIO:
- comedi_dio_read (insn_read or deprecated insn trigger)
- comedi_dio_write (insn_write or deprecated insn trigger)
- comedi_dio_config (insn_config or deprecated insn trigger)
- comedi_dio_get_config (insn_config or deprecated trigger)
- comedi_dio_bitfield (insn_bits or comedi_dio_read/write)
- comedi_dio_bitfield2 (insn_bits or comedi_dio_read/write)
The instruction insn_bits is a combination of a read operation and a
write operation (that is why, the function comedi_dio_bitfield* call
comedi_dio_read and comedi_dio_write if the driver does not provide an
insn-bits handler).
I had a look at many Comedi drivers and most of them register the
handler "insn_bits" for the DIO subdevice. The instructions insn_read
and insn_write are not oftenly used in DIO contexts.
comedi_dio_bitfield() uses the insn_bits instruction. However, it only
works with DIO subdevice limited to 32 channels; that was why
comedi_dio_bitfield2() was introduced, this latter function contains
one more argument so as to shift the bits.
Consequently, we may need a more limited set of functions:
- a4l_sync_dio(dsc, idx_subd, mask, buf)
- a4l_sizeof_subd(dsc, idx_subd)
- a4l_config_subd(dsc, idx_subd, idx_chan, cfg_type, *val)
a4l_sync_dio() could work with any DIO subdevice (more or less than 32
channels). The last argument would be a pointer to a buffer which size
should be defined thanks to a4l_sizeof_subd() (8, 16, 32, 64 or more
bits).
a4l_config_subd() could be used to configure the polarity of the DIO
channels. The argument cfg_type could be set to DIO_INPUT, DIO_OUTPUT,
DIO_QUERY. And, we could even imagine that this function would not be
limited to DIO subdevice; so, the argument cfg_type could accept more
values (SERIAL_CLOCK, BIDIRECTIONAL_DATA, SET_CLOCK_SRC,
GET_CLOCK_SRC, etc.)
How do you see this approach ?
Do you (or anyone else) have a better solution in mind ?
Best regards,
> Thanks a lot,
>
> -Stefan
> _______________________________________________
> Xenomai-core mailing list
> Xenomai-core@domain.hid
> https://mail.gna.org/listinfo/xenomai-core
>
Alexis.
next prev parent reply other threads:[~2009-12-21 23:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-29 0:19 [Xenomai-help] analog output device with comedi/analogy -- suddenly threads don't work anymore Stefan Schaal
2009-10-29 8:30 ` Gilles Chanteperdrix
2009-10-29 8:52 ` Gilles Chanteperdrix
2009-10-29 14:08 ` Gilles Chanteperdrix
2009-10-29 15:25 ` Stefan Schaal
[not found] ` <FF6D4747-95BE-4B18-8B77-864B7DA5EAEF@usc.edu>
[not found] ` <4AE9E5AC.7050401@domain.hid>
2009-12-18 21:10 ` [Xenomai-core] digital I/O with analgoy using ni_pcmcia Stefan Schaal
2009-12-21 23:23 ` Alexis Berlemont [this message]
2009-12-22 7:02 ` Stefan Schaal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B300382.6070802@domain.hid \
--to=berlemont.hauw@domain.hid \
--cc=jonas@domain.hid \
--cc=ludovic.righetti@domain.hid \
--cc=pastorsa@domain.hid \
--cc=sschaal@domain.hid \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.