* [Xenomai-help] RTDM & serial port
@ 2005-10-26 3:40 Hannes Mayer
2005-10-26 7:18 ` Jan Kiszka
0 siblings, 1 reply; 11+ messages in thread
From: Hannes Mayer @ 2005-10-26 3:40 UTC (permalink / raw)
To: xenomai
Hi Jan et al.!
I've noticed your thread on the RTAI list "Driver Model for RTAI" in June.
Now as I try to port some RTAI serial port stuff to Xenomai in order to
put up some howto page on my website, I'm clueless.
None of the RTAI functions rt_spopen, rt_spread_timed, rt_spwrite are
available - I see that there is some rt_dev_open, rt_dev_write available,
but only rt_dev_read - what about some timed-read ?
I see that rt_spopen opens /dev/rtser[X] but /dev/rtser[X] is not on my
system, nor can I find any creation-script in the xenomai source.
Sorry if I'm overlooking some stuff... 5:40am here.
I'd be very glad for any hints/examples/code-snippets!
Thanks a lot & best regards,
Hannes.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Xenomai-help] RTDM & serial port
2005-10-26 3:40 [Xenomai-help] RTDM & serial port Hannes Mayer
@ 2005-10-26 7:18 ` Jan Kiszka
2005-10-26 17:03 ` Hannes Mayer
0 siblings, 1 reply; 11+ messages in thread
From: Jan Kiszka @ 2005-10-26 7:18 UTC (permalink / raw)
To: Hannes Mayer; +Cc: xenomai
[-- Attachment #1: Type: text/plain, Size: 1302 bytes --]
Hannes Mayer wrote:
> Hi Jan et al.!
>
> I've noticed your thread on the RTAI list "Driver Model for RTAI" in June.
> Now as I try to port some RTAI serial port stuff to Xenomai in order to
> put up some howto page on my website, I'm clueless.
Actually, there is already some howto, but I guess also enough room for
improvements: http://www.rts.uni-hannover.de/mitarbeiter/kiszka/rtaddon/
>
> None of the RTAI functions rt_spopen, rt_spread_timed, rt_spwrite are
> available - I see that there is some rt_dev_open, rt_dev_write available,
> but only rt_dev_read - what about some timed-read ?
Yep, that's correct, it's yet another new API. Anyway, if you feel the
need for a legacy wrapper, you are welcome to add some library on top of
the RTDM profile.
BTW, timed read can be realised by setting a reception timeout for the
opened device instance, see example or profile documentation.
>
> I see that rt_spopen opens /dev/rtser[X] but /dev/rtser[X] is not on my
> system, nor can I find any creation-script in the xenomai source.
Nope, RTDM devices are not being mapped into the Linux file system. They
use a separate namespace where you can find serial devices as plain
"rtser[X]".
>
> Sorry if I'm overlooking some stuff... 5:40am here.
>
Any frequent problems falling asleep? ;)
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Xenomai-help] RTDM & serial port
2005-10-26 7:18 ` Jan Kiszka
@ 2005-10-26 17:03 ` Hannes Mayer
2005-10-26 17:32 ` Jan Kiszka
0 siblings, 1 reply; 11+ messages in thread
From: Hannes Mayer @ 2005-10-26 17:03 UTC (permalink / raw)
To: Jan Kiszka; +Cc: xenomai
Hi Jan!
Jan Kiszka wrote:
[...]
> Actually, there is already some howto, but I guess also enough room for
> improvements: http://www.rts.uni-hannover.de/mitarbeiter/kiszka/rtaddon/
Cool! Thanks!
> Nope, RTDM devices are not being mapped into the Linux file system. They
> use a separate namespace where you can find serial devices as plain
> "rtser[X]".
I compiled the rt_serial_uprog, but it can't open rtser0:
# ./rt_serial_uprog
rt_serial_uprog: timer started
rt_serial_uprog: can't open rtser0 (write)
rt_serial_uprog: stop timer
# lsmod
Module Size Used by
xeno_16550A 12392 0
xeno_rtdm 23460 1 xeno_16550A
xeno_native 114384 0
xeno_nucleus 82696 3 xeno_16550A,xeno_rtdm,xeno_native
xeno_hal 23616 4 xeno_16550A,xeno_rtdm,xeno_native,xeno_nucleus
[...]
rtser[X] should be available as soon as xeno_16550A is loaded, right ?
> Any frequent problems falling asleep? ;)
Usually not - we have national holiday today, so I was doing my stuff as long
as I wanted :-)
Thanks and best regards,
Hannes.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Xenomai-help] RTDM & serial port
2005-10-26 17:03 ` Hannes Mayer
@ 2005-10-26 17:32 ` Jan Kiszka
2005-10-26 18:22 ` Hannes Mayer
0 siblings, 1 reply; 11+ messages in thread
From: Jan Kiszka @ 2005-10-26 17:32 UTC (permalink / raw)
To: Hannes Mayer; +Cc: xenomai
[-- Attachment #1: Type: text/plain, Size: 1146 bytes --]
Hello Hannes,
> ...
> I compiled the rt_serial_uprog, but it can't open rtser0:
>
> # ./rt_serial_uprog
> rt_serial_uprog: timer started
> rt_serial_uprog: can't open rtser0 (write)
> rt_serial_uprog: stop timer
>
> # lsmod
> Module Size Used by
> xeno_16550A 12392 0
> xeno_rtdm 23460 1 xeno_16550A
> xeno_native 114384 0
> xeno_nucleus 82696 3 xeno_16550A,xeno_rtdm,xeno_native
> xeno_hal 23616 4
> xeno_16550A,xeno_rtdm,xeno_native,xeno_nucleus
> [...]
>
> rtser[X] should be available as soon as xeno_16550A is loaded, right ?
Only when you provided the correct module parameters... Isn't that
documented somewhere? Don't remember right now, but if not, this
requires fixing. Check what's available on your box via /proc/xenomai/rtdm.
>
>> Any frequent problems falling asleep? ;)
>
>
> Usually not - we have national holiday today, so I was doing my stuff as
> long
> as I wanted :-)
Yea, I can understand. The only problem is the code one produces between
about 3 and 5 am - mine is generally just "interesting". Later it gets
better again. :)
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Xenomai-help] RTDM & serial port
2005-10-26 17:32 ` Jan Kiszka
@ 2005-10-26 18:22 ` Hannes Mayer
2005-10-26 18:27 ` Jan Kiszka
0 siblings, 1 reply; 11+ messages in thread
From: Hannes Mayer @ 2005-10-26 18:22 UTC (permalink / raw)
To: Jan Kiszka; +Cc: xenomai
Hi Jan!
Jan Kiszka wrote:
[...]
>>rtser[X] should be available as soon as xeno_16550A is loaded, right ?
>
>
> Only when you provided the correct module parameters... Isn't that
> documented somewhere? Don't remember right now, but if not, this
> requires fixing. Check what's available on your box via /proc/xenomai/rtdm.
E.g.:
# cat named_devices
Hash Name /proc
I didn't find any page so far documenting the parameters, but they should be
something like this ?
# insmod /usr/realtime/modules/xeno_16550A.ko ioaddr=3f8 irq=4 tx_fifo=10 start_index=0
But I get:
insmod: error inserting '/usr/realtime/modules/xeno_16550A.ko': -1 Device or resource busy
During boot, this appears in the kernel log:
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled
ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
Maybe this is causing the device to be busy ?
Thanks a lot and best regards,
Hannes.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Xenomai-help] RTDM & serial port
2005-10-26 18:22 ` Hannes Mayer
@ 2005-10-26 18:27 ` Jan Kiszka
2005-10-26 20:05 ` Hannes Mayer
0 siblings, 1 reply; 11+ messages in thread
From: Jan Kiszka @ 2005-10-26 18:27 UTC (permalink / raw)
To: Hannes Mayer; +Cc: xenomai
[-- Attachment #1: Type: text/plain, Size: 1241 bytes --]
Hannes Mayer wrote:
> Hi Jan!
>
> Jan Kiszka wrote:
> [...]
>
>>> rtser[X] should be available as soon as xeno_16550A is loaded, right ?
>>
>>
>>
>> Only when you provided the correct module parameters... Isn't that
>> documented somewhere? Don't remember right now, but if not, this
>> requires fixing. Check what's available on your box via
>> /proc/xenomai/rtdm.
>
>
> E.g.:
> # cat named_devices
> Hash Name /proc
>
> I didn't find any page so far documenting the parameters, but they
> should be
> something like this ?
> # insmod /usr/realtime/modules/xeno_16550A.ko ioaddr=3f8 irq=4
> tx_fifo=10 start_index=0
Almost: ioaddr=0x3f8
Ok, we need some README about xeno_16550A somewhere. Where would you
look for information first?
> But I get:
> insmod: error inserting '/usr/realtime/modules/xeno_16550A.ko': -1
> Device or resource busy
>
> During boot, this appears in the kernel log:
> Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled
> ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
> ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
> Maybe this is causing the device to be busy ?
>
"setserial /dev/ttyS0 uart none" releases the first port.
Also something for a README. :-/
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Xenomai-help] RTDM & serial port
2005-10-26 18:27 ` Jan Kiszka
@ 2005-10-26 20:05 ` Hannes Mayer
2005-10-26 20:17 ` Hannes Mayer
2005-10-26 20:53 ` Jan Kiszka
0 siblings, 2 replies; 11+ messages in thread
From: Hannes Mayer @ 2005-10-26 20:05 UTC (permalink / raw)
To: Jan Kiszka; +Cc: xenomai
Hi Jan!
Jan Kiszka wrote:
[...]
> Almost: ioaddr=0x3f8
Yep, tried that too before, but disabling ttyS0 with setserial did the trick :-)
> Ok, we need some README about xeno_16550A somewhere. Where would you
> look for information first?
API-docs -> Modules -> Real-Time Driver Model -> Device Profiles -> Serial Devices ?
> "setserial /dev/ttyS0 uart none" releases the first port.
>
> Also something for a README. :-/
I'd add that to the API-docs too.
Just one further thing:
I've modified rt_serial_uprog.c and I just open rtser0 for reading and writing.
That works, I can write to it and read data back from it, but:
In read_task_proc:
ret = rt_dev_ioctl(my_fd, RTSER_RTIOC_WAIT_EVENT, &rx_event );
rt_dev_ioctl always returns -1 - it doesn't block.
rtser_config for rtser0:
static const struct rtser_config ser_config = {
0xFFFF, /* config_mask */
RTSER_9600_BAUD, /* baud_rate */
RTSER_ODD_PARITY , /* parity */
RTSER_8_BITS , /* data_bits */
RTSER_1_STOPB , /* stop_bits */
RTSER_NO_HAND , /* handshake */
RTSER_DEF_FIFO_DEPTH, /* fifo_depth*/
RTSER_DEF_TIMEOUT, /* rx_timeout */
RTSER_DEF_TIMEOUT, /* tx_timeout */
RTSER_DEF_TIMEOUT, /* event_timeout */
RTSER_RX_TIMESTAMP_HISTORY, /* timestamp_history */
RTSER_EVENT_RXPEND /* event mask */
};
How can I get rt_dev_ioctl to block ?
Thank you very much for your time Jan! :-)
Best regards,
Hannes.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Xenomai-help] RTDM & serial port
2005-10-26 20:05 ` Hannes Mayer
@ 2005-10-26 20:17 ` Hannes Mayer
2005-10-26 20:53 ` Jan Kiszka
1 sibling, 0 replies; 11+ messages in thread
From: Hannes Mayer @ 2005-10-26 20:17 UTC (permalink / raw)
To: Jan Kiszka; +Cc: xenomai
Hannes Mayer wrote:
[...]
> Just one further thing:
> I've modified rt_serial_uprog.c and I just open rtser0 for reading and
> writing.
> That works, I can write to it and read data back from it, but:
>
> In read_task_proc:
> ret = rt_dev_ioctl(my_fd, RTSER_RTIOC_WAIT_EVENT, &rx_event );
> rt_dev_ioctl always returns -1 - it doesn't block.
[...]
> How can I get rt_dev_ioctl to block ?
AHA! Found it! :-)
There is
if (!rtdm_in_rt_context())
return -EPERM;
in rt_16550_ioctl(...)
Silly me put a printf into it:
ret = rt_task_set_mode(0, T_PRIMARY, NULL);
[...]
printf(RTASK_PREFIX "waiting for event\n");
ret = rt_dev_ioctl(write_fd, RTSER_RTIOC_WAIT_EVENT, &rx_event );
so the whole thing was not in RT anymore.
Thanks again and best regards,
Hannes.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Xenomai-help] RTDM & serial port
2005-10-26 20:05 ` Hannes Mayer
2005-10-26 20:17 ` Hannes Mayer
@ 2005-10-26 20:53 ` Jan Kiszka
2005-10-26 21:40 ` Hannes Mayer
1 sibling, 1 reply; 11+ messages in thread
From: Jan Kiszka @ 2005-10-26 20:53 UTC (permalink / raw)
To: Hannes Mayer; +Cc: xenomai
[-- Attachment #1: Type: text/plain, Size: 1271 bytes --]
Hannes Mayer wrote:
> Hi Jan!
>
> Jan Kiszka wrote:
> [...]
>
>> Almost: ioaddr=0x3f8
>
>
> Yep, tried that too before, but disabling ttyS0 with setserial did the
> trick :-)
>
>> Ok, we need some README about xeno_16550A somewhere. Where would you
>> look for information first?
>
>
> API-docs -> Modules -> Real-Time Driver Model -> Device Profiles ->
> Serial Devices ?
Hmm, that part is intended to remain implementation indepent. Will have
to think about it.
>> How can I get rt_dev_ioctl to block ?
>
> AHA! Found it! :-)
>
> There is
> if (!rtdm_in_rt_context())
> return -EPERM;
> in rt_16550_ioctl(...)
>
> Silly me put a printf into it:
> ret = rt_task_set_mode(0, T_PRIMARY, NULL);
> [...]
> printf(RTASK_PREFIX "waiting for event\n");
> ret = rt_dev_ioctl(write_fd, RTSER_RTIOC_WAIT_EVENT, &rx_event );
> so the whole thing was not in RT anymore.
But this one IS documented! ;)
Well, the patch containing this check is rather new. Maybe it should
better read like this:
if (!rtdm_in_rt_context())
return -ENOSYS;
The result would be that the nucleus will try to switch the caller to RT
on return and restart the call afterwards. Then you shouldn't notice any
error. Patch in preparation...
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Xenomai-help] RTDM & serial port
2005-10-26 20:53 ` Jan Kiszka
@ 2005-10-26 21:40 ` Hannes Mayer
2005-10-27 2:34 ` Romain Lenglet
0 siblings, 1 reply; 11+ messages in thread
From: Hannes Mayer @ 2005-10-26 21:40 UTC (permalink / raw)
To: Jan Kiszka; +Cc: xenomai
Jan Kiszka wrote:
[...]
>>API-docs -> Modules -> Real-Time Driver Model -> Device Profiles ->
>>Serial Devices ?
>
> Hmm, that part is intended to remain implementation indepent. Will have
> to think about it.
Ok, what about a README.DRIVERS in the root-dir of the xeno tarball ?
This file could contain any information regarding RTDM drivers.
[...]
> Well, the patch containing this check is rather new. Maybe it should
> better read like this:
>
> if (!rtdm_in_rt_context())
> return -ENOSYS;
>
> The result would be that the nucleus will try to switch the caller to RT
> on return and restart the call afterwards. Then you shouldn't notice any
> error. Patch in preparation...
I dunno if either solution is good. IMO, if the program is not in RT, it
should work anyway. And I'm not sure if it's good, if it ist switched sliently
to RT... *shrugs*
Thanks and best regards,
Hannes.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Xenomai-help] RTDM & serial port
2005-10-26 21:40 ` Hannes Mayer
@ 2005-10-27 2:34 ` Romain Lenglet
0 siblings, 0 replies; 11+ messages in thread
From: Romain Lenglet @ 2005-10-27 2:34 UTC (permalink / raw)
To: xenomai
> Ok, what about a README.DRIVERS in the root-dir of the xeno
> tarball ? This file could contain any information regarding
> RTDM drivers.
According to the current file layout, this file should rather be
called rtdm.txt and be placed into skins/rtdm/doc (cf. doc files
for the other skins).
Or it would be preferable to rename all skins/*/doc/*.txt files
into README.* files in the root directory.
--
Romain Lenglet
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2005-10-27 2:34 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-26 3:40 [Xenomai-help] RTDM & serial port Hannes Mayer
2005-10-26 7:18 ` Jan Kiszka
2005-10-26 17:03 ` Hannes Mayer
2005-10-26 17:32 ` Jan Kiszka
2005-10-26 18:22 ` Hannes Mayer
2005-10-26 18:27 ` Jan Kiszka
2005-10-26 20:05 ` Hannes Mayer
2005-10-26 20:17 ` Hannes Mayer
2005-10-26 20:53 ` Jan Kiszka
2005-10-26 21:40 ` Hannes Mayer
2005-10-27 2:34 ` Romain Lenglet
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.