From: Philippe Gerum <rpm@xenomai.org>
To: Leopold Palomo-Avellaneda <leo@alaxarxa.net>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai] xddp port questions
Date: Mon, 20 Jan 2014 18:08:19 +0100 [thread overview]
Message-ID: <52DD5803.5030104@xenomai.org> (raw)
In-Reply-To: <201401201739.28209.leo@alaxarxa.net>
On 01/20/2014 05:39 PM, Leopold Palomo-Avellaneda wrote:
> A Dilluns, 20 de gener de 2014, Philippe Gerum va escriure:
>> On 01/20/2014 05:18 PM, Leopold Palomo-Avellaneda wrote:
>>> A Dimarts, 14 de gener de 2014, Philippe Gerum va escriure:
>>>> On 01/14/2014 01:15 PM, Leopold Palomo-Avellaneda wrote:
>>>>> Hi,
>>>>>
>>>>> in the example xddp-label a two realtime task are connected with a non-
>>>>> realtime time. They share the same port where one rt task receive from
> the
>>>>> non-rt task and the other send to rt-task.
>>>>>
>>>>> The regular thread read and write in the same devname
>>>>> (/proc/xenomai/registry/rtipc/xddp/XDDP_PORT_LABEL). One rt thread
> listen
>>> from
>>>>> that port.
>>>>>
>>>>> I don't understand how is possible that both (non-rt and rt threads)
>>> listen
>>>>> from the same port and could not have collisions if two threads (non-rt
>>> and
>>>>> rt) try to write in the same port.
>>>>>
>>>>> Could not be better to separate it?
>>>>>
>>>>
>>>> No, that would defeat the purpose of the illustration.
>>>>
>>>> XDDP is a wrapper over Xenomai's message pipe support, offering a
>>>> socket-based interface to applications. Each XDDP port is mapped to a
>>>> given /dev/rtp device minor, but the communication endpoints between RT
>>>> and NRT are different internally.
>>>>
>>>> [XDDP-port] <---> xnpipe #<port>
>>>> ^
>>>> |
>>>> | * input queue: /dev/rtp -> xnpipe
>>>> | * output queue: xnpipe -> /dev/rtp
>>>> |
>>>> v
>>>> /dev/rtp<port>
>>>>
>>>> So, when NRT reads from /dev/rtp<port>, it does not actually listen to
>>>> the same endpoint/queue than RT, because message pipes are
>>>> bi-directional. Likewise, NRT and RT never write to the same queue,
>>>> since the purpose of message pipes is to cross the RT/NRT domain
> boundary.
>>>
>>> Ok,
>>>
>>> in the example the same thread open a device for write and read from the
> same
>>> device. From your answer about the endpoints, I understand that when the
> NRT
>>> open for read, read from the RT world, and when the NRT writes to the RT
>>> world.
>>>
>>> So, could I have a NRT function (thread) that open the device to just read
>>> from the RT world and _another_ that send to the RT world?
>>>
>>> Because I have to one the same device, and I don't know that I could do it
> at
>>> the same time.
>>>
>>
>> You can both send-receive data to/from the same socket descriptor
>> RT-wise, and read-write from/to the same /dev/rtp* descriptor NRT-wise.
>> Message pipes are bi-directional by design, on both ends. In the XDDP
>> case, traffic is routed as follows:
>>
>> - RT-writes -> NRT-reads
>> - RT-reads <- NRT-writes
>>
>> So, fd = open("/dev/rtpX", ...) => read(fd, and write(fd, are allowed
>> s = socket(AF_RTIPC, ...) => sendmsg(s, and recv(s, are allowed.
>>
> Sorry if I have not been clear or I don't understand you. For design I would
> like to make a thread that:
>
> fd = open("/dev/rtpX", ...) => read(fd, ...
>
> to read
>
> and another thread to
>
> fd = open("/dev/rtpX", ...) => write(fd, ...
>
> so I open TWO times the /dev/rtpX, one for read and another for write, because
> I would like to use it in two different parts, and I don't know if it's
> allowed.
No, this won't work. open() is implicitly exclusive for those devices.
--
Philippe.
prev parent reply other threads:[~2014-01-20 17:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-14 12:15 [Xenomai] xddp port questions Leopold Palomo-Avellaneda
2014-01-14 14:22 ` Philippe Gerum
2014-01-20 16:18 ` Leopold Palomo-Avellaneda
2014-01-20 16:29 ` Philippe Gerum
2014-01-20 16:39 ` Leopold Palomo-Avellaneda
2014-01-20 17:08 ` Philippe Gerum [this message]
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=52DD5803.5030104@xenomai.org \
--to=rpm@xenomai.org \
--cc=leo@alaxarxa.net \
--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.