From: Viktor STARK <abraar@domain.hid>
To: rpm@xenomai.org
Cc: Viktor STARK <stark.viktor@domain.hid>,
Xenomai help <xenomai@xenomai.org>
Subject: Re: [Xenomai-help] [RT_PIPE] - User space read() not waking up
Date: Sat, 24 Mar 2007 13:07:54 +0100 [thread overview]
Message-ID: <4605149A.5090802@domain.hid> (raw)
In-Reply-To: <1174737325.20953.24.camel@domain.hid>
Philippe Gerum wrote:
> On Sat, 2007-03-24 at 11:20 +0100, Dmitry Adamushko wrote:
>
>
>> 3) Pipes seemed to be a good way to transfer data from kernel
>> space.
>> What other (maybe more deterministic) way would you suggest?
>> I'm not
>> asking for a complete program architecture here just a half
>> dozen words
>> describing how you would have done it.
>>
>> rt_queue_*
>>
>>
>
> I would add that if you really want to keep the pipe semantics for
> exchanging data without crossing domains between real-time tasks, then
> you may access the real-time API of message pipes from user-space too.
> i.e.
> rt_pipe_create/bind/delete/read/write/stream() are all available from a
> user-space application, in which case data exchange will happen in
> primary mode.
>
Now, that is interesting. I was left under the impression that in user
space, the only option to access pipes was using regular
open()/read()/write().
I guess I overlooked something in the documentation. Thank you for
pointing this out.
> To sum up, given that you want to create a pipe in kernel space, to
> exchange data with a user-space program, the options with Xenomai's
> message pipes are:
>
> 1) Implementing a real-time communication path between two Xenomai
> tasks, crossing the kernel/user-space boundary without leaving the
> deterministic primary domain: you have to create the kernel-side
> endpoint in your module, then bind the user-space endpoint to the latter
> using the proper interface, as shown below in the REALTIME_TO_REALTIME
> illustration.
>
> 2) Implementing a communication path between a real-time Xenomai task in
> kernel space, and a regular user-space program: you still have to create
> the kernel-side endpoint in your module, then use the standard
> open/read/write routines to access to the pipe channel. This is what you
> are doing right now.
>
> kernel-side:
>
> void foo_task(void)
> {
> for (;;) {
> rt_pipe_read/write(&pipe_desc, ...);
> }
> }
>
> int init_module(void)
> {
> rt_pipe_create(&pipe_desc, "channel", ...);
> }
>
> user-space side:
>
> int main(int argc, char *argv[])
> {
> #ifdef REALTIME_TO_REALTIME
> /* promote main() to the Xenomai real-time space */
> rt_task_shadow(&task_desc, __FUNCTION__, ...);
> /* bind to the pipe created in kernel space */
> rt_pipe_bind(&pipe_desc, "channel", TM_INFINITE);
> for (;;) {
> rt_pipe_read/write(&pipe_desc, "channel", ...);
> }
> #else /* REALTIME_TO_REGULAR */
> fd = open("/proc/xenomai/registry/native/pipes/channel",O_RDWR);
> for (;;) {
> read/write(fd, ...);
> }
> #endif
> }
>
That looks like a pretty good solution. I'll be able to test this out on
Monday. I'll keep the list posted about my results.
Thanks a lot for your enlightening comments / example. It's very much
appreciated.
Viktor STARK
next prev parent reply other threads:[~2007-03-24 12:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-22 21:57 [Xenomai-help] [RT_PIPE] - User space read() not waking up Viktor Stark
2007-03-23 8:38 ` Jan Kiszka
2007-03-23 8:42 ` Dmitry Adamushko
2007-03-23 8:49 ` Jan Kiszka
2007-03-24 1:48 ` Viktor STARK
[not found] ` <460481F2.5010408@domain.hid>
2007-03-24 10:20 ` Dmitry Adamushko
2007-03-24 11:55 ` Philippe Gerum
2007-03-24 12:07 ` Viktor STARK [this message]
2007-03-24 22:49 ` Philippe Gerum
2007-03-25 0:23 ` Viktor STARK
2007-03-24 22:36 ` [off-list] " Dmitry Adamushko
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=4605149A.5090802@domain.hid \
--to=abraar@domain.hid \
--cc=rpm@xenomai.org \
--cc=stark.viktor@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.