From: Philippe Gerum <rpm@xenomai.org>
To: Helder Daniel <hdaniel@ualg.pt>,
"Xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [Xenomai] Can rtdm_read, rtdm_write, be used in userspace in Xenomai 3.x
Date: Fri, 08 May 2015 15:37:47 +0200 [thread overview]
Message-ID: <554CBC2B.7090203@xenomai.org> (raw)
In-Reply-To: <CAKk99t1TPO3Tv5c+WLqPR0rcypa1bvA6tiKhoqu7cdTvAotDPQ@mail.gmail.com>
On 05/08/2015 01:28 PM, Helder Daniel wrote:
> Hi,
>
> I am writing a driver that implements read_rt and read_nrt handlers for
> Xenomai 3-rc4 Cobalt.
> But I am having problems when trying to read from user space in comand line:
>
> $> cat /dev/rtdm/device0
> cat: /dev/rtdm/device0: Invalid argument
>
> and also from a user space real time thread:
>
> f = open("/dev/rtdm/device0");
> for(;;){
> rt_task_wait_period(NULL);
> read (f, &count, 1);
> //...
>
> This read gives me garbage.
>
>
[snip]
> Looking at kernel log, after accessing the driver from user spcae both:
>
> in cmd line with:
>
> $> cat /dev/rtdm/device0
>
> and from a real time task
>
> it seems that the open, close and read are never called, since there is no
> entry in kernel log.
>
> I am doing something wrong?
The Cobalt read() service must be called for invoking the related
read_[n]rt handler in your RTDM driver. Since the cat command will use
the regular glibc read() call instead, this won't work. Your test
program is likely missing the wrapping step, which is performed by a
linker trick, substituting calls to read() and other POSIX services to
the corresponding Cobalt implementation. In your test, the glibc
counterpart is still used, which won't work either.
You need to make sure to pass --posix to xeno-config --ldflags for
retrieving the proper LDFLAGS that do the magic for wrapping POSIX
calls. You can combine APIs with xeno-config, such as --alchemy --posix.
>
> Should I use rtdm_read in user space to access the driver?
>
No, this is a kernel-space only service, for inter-driver communication.
This is the reason why you can't pull the related declarations in a
user-space program.
--
Philippe.
next prev parent reply other threads:[~2015-05-08 13:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-08 11:28 [Xenomai] Can rtdm_read, rtdm_write, be used in userspace in Xenomai 3.x Helder Daniel
2015-05-08 13:37 ` Philippe Gerum [this message]
2015-05-08 14:38 ` Helder Daniel
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=554CBC2B.7090203@xenomai.org \
--to=rpm@xenomai.org \
--cc=hdaniel@ualg.pt \
--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.