On 24/03/07, Philippe Gerum <[EMAIL PROTECTED]> wrote:

[...]
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.


rt_pipe_read -> rt_pipe_receive -> xnpipe_recv -> take from state->inq

rt_pipe_write -> rt_pipe_send -> xnpipe_send -> put into state->outq

So there are 2 different queues.

If a user space side makes use of rt_pipe_read(), then a kernel side
(driver) should use
xnpipe_write(), not rt_pipe_*


For data transfer in the opposite direction, [user space] rt_pipe_write()
---> [kernel space] xnpipe_read()


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
}
--
Philippe.





--
Best regards,
Dmitry Adamushko
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to