Message-ID: Date: Sat, 24 Mar 2007 23:36:51 +0100 From: "Dmitry Adamushko" Subject: [off-list] Re: [Xenomai-help] [RT_PIPE] - User space read() not waking up In-Reply-To: <1174737325.20953.24.camel@domain.hid> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_248342_28768533.1174775811811" References: <20070322215707.232970@domain.hid> <460481F2.5010408@domain.hid> <1174737325.20953.24.camel@domain.hid> List-Id: Help regarding installation and common use of Xenomai List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: rpm@xenomai.org Cc: Viktor STARK , Xenomai help ------=_Part_248342_28768533.1174775811811 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 24/03/07, Philippe Gerum 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 ------=_Part_248342_28768533.1174775811811 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline

On 24/03/07, Philippe Gerum <rpm@xenomai.org > 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 ------=_Part_248342_28768533.1174775811811--