All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] RTDM driver questions
@ 2006-05-07 15:14 witzel.thomas
  2006-05-07 21:38 ` Jan Kiszka
  0 siblings, 1 reply; 8+ messages in thread
From: witzel.thomas @ 2006-05-07 15:14 UTC (permalink / raw)
  To: xenomai

Hello All,

I'm working on a RTDM driver for a PCMCIA DAQ card. I have already implemented 
all the basic infrastructure, some ioctls for setting the sampling rate and 
interrupt sources and have also implemented the interrupt handling (there is 
some issues with the irqs that I might ask about later). 
My question is how to best give the data from the driver to the user space data 
acquisition program. Should I allocate some kernel space and mmap it to the user 
address space and then use a signal of some kind to inform the user space 
application when the space is half full ? Any suggestions how this is best done 
are welcome.

Also I'm using now a clock on the DAQ card to trigger an interrupt at which I 
read the samples of the card. The card itself (ancient) has only a very small 
FIFO and I also want to do some DIO on the PCs parallel port for each sample 
that I read from the DAQ card, so thats why I decided for this design. Would it 
be better to use a timer from xenomai to do the sample clocking rather than an 
irq generated by the clock on the DAQ card (performance or otherwise) ?

Thanks for your comments,
Thomas


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Xenomai-help] RTDM driver questions
  2006-05-07 15:14 [Xenomai-help] RTDM driver questions witzel.thomas
@ 2006-05-07 21:38 ` Jan Kiszka
  2006-05-07 22:02   ` Thomas Witzel
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Kiszka @ 2006-05-07 21:38 UTC (permalink / raw)
  To: witzel.thomas; +Cc: xenomai

[-- Attachment #1: Type: text/plain, Size: 2108 bytes --]

witzel.thomas@domain.hid wrote:
> Hello All,
> 
> I'm working on a RTDM driver for a PCMCIA DAQ card. I have already implemented 
> all the basic infrastructure, some ioctls for setting the sampling rate and 
> interrupt sources and have also implemented the interrupt handling (there is 
> some issues with the irqs that I might ask about later). 
> My question is how to best give the data from the driver to the user space data 
> acquisition program. Should I allocate some kernel space and mmap it to the user 
> address space and then use a signal of some kind to inform the user space 
> application when the space is half full ? Any suggestions how this is best done 
> are welcome.

Already had a look at the interfaces comedi provides for this? Do you
know of Alexis' ongoing effort to port comedi over RTDM? There is some
code in the Xenomai SVN as a branch. I'm not up-to-date with its
development, but if you are interested, I guess Alexis will be happy to
comment on this.

Generally spoken, mmap can make sense if you have a significant amount
of data to transfer, not "just" a few kbyte/s. RTDM has the elementary
support for such device interfaces now, and this has already been used
for a frame-grabbing driver.

> 
> Also I'm using now a clock on the DAQ card to trigger an interrupt at which I 
> read the samples of the card. The card itself (ancient) has only a very small 
> FIFO and I also want to do some DIO on the PCs parallel port for each sample 
> that I read from the DAQ card, so thats why I decided for this design. Would it 
> be better to use a timer from xenomai to do the sample clocking rather than an 
> irq generated by the clock on the DAQ card (performance or otherwise) ?

The on-board timers surely have lower jitters than software-driven
timers can provide. Depending on your application, this can make a
difference. On the other hand, application-driven acquisition timing can
be easier to implement (less synchronisation issues). Again, I would
suggest a look at comedi if and how such capabilities are used there.

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Xenomai-help] RTDM driver questions
  2006-05-07 21:38 ` Jan Kiszka
@ 2006-05-07 22:02   ` Thomas Witzel
  2006-05-07 22:21     ` [Xenomai-help] " Bernhard Walle
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Witzel @ 2006-05-07 22:02 UTC (permalink / raw)
  To: xenomai

On Sunday 07 May 2006 21:38, you wrote:

> Already had a look at the interfaces comedi provides for this? Do you
> know of Alexis' ongoing effort to port comedi over RTDM? There is some
> code in the Xenomai SVN as a branch. I'm not up-to-date with its
> development, but if you are interested, I guess Alexis will be happy to
> comment on this.
Yes, I did look at comedi. The driver for this project will however be very 
specialized and comedi wouldn't easily allow the implementation of what I 
need without abusing it. A port of comedi to RTDM in general would be a good 
thing to have however.

> Generally spoken, mmap can make sense if you have a significant amount
> of data to transfer, not "just" a few kbyte/s. RTDM has the elementary
> support for such device interfaces now, and this has already been used
> for a frame-grabbing driver.
What would be the proper procedure for just a few kbytes ? I expect less than 
500 kB./second in my application.

> The on-board timers surely have lower jitters than software-driven
> timers can provide. Depending on your application, this can make a
> difference. On the other hand, application-driven acquisition timing can
> be easier to implement (less synchronisation issues). Again, I would
> suggest a look at comedi if and how such capabilities are used there.
I think when I looked last comedi would not have supported the mode that I'm 
using now. If I remember correctly comedi would only allow either software 
paced or hardware paced with fifo interrupt modes, but not single sample 
hardware interrupts. Of course the single sample interrupt mode would become 
unreasonable at high sample rates, but I'm hoping that I'll be fine with 
10-20kHz.

Thomas


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Xenomai-help] Re: RTDM driver questions
  2006-05-07 22:02   ` Thomas Witzel
@ 2006-05-07 22:21     ` Bernhard Walle
  2006-05-21 21:19       ` Thomas Witzel
  0 siblings, 1 reply; 8+ messages in thread
From: Bernhard Walle @ 2006-05-07 22:21 UTC (permalink / raw)
  To: xenomai

Hi Thomas,

Thomas Witzel <witzel.thomas@domain.hid> [2006-05-07]:
> 
> > Generally spoken, mmap can make sense if you have a significant amount
> > of data to transfer, not "just" a few kbyte/s. RTDM has the elementary
> > support for such device interfaces now, and this has already been used
> > for a frame-grabbing driver.
> What would be the proper procedure for just a few kbytes ? I expect less than 
> 500 kB./second in my application.

Simply read() / write() ?


Regards,
  Bernhard
-- 
Das Telefon hat zu viele ernsthaft zu bedenkende Mängel für ein
Kommunikationsmittel. Das Gerät ist von Natur aus von keinem Wert für
uns. -- »Western Union«, Interne Meldung (1876)



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Xenomai-help] Re: RTDM driver questions
  2006-05-07 22:21     ` [Xenomai-help] " Bernhard Walle
@ 2006-05-21 21:19       ` Thomas Witzel
  2006-05-23  9:13         ` Jan Kiszka
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Witzel @ 2006-05-21 21:19 UTC (permalink / raw)
  To: xenomai

I have that now, but I'm not really sure how to synchronize the user space 
application with the driver, since the driver has of course only a limited 
buffer. Practically now I have a 512 sample buffer in the driver that I use 
as a double buffer and I copy blocks of 256 to the user on read. 
Isn't there a way to have a FIFO between driver and user application and is 
there an example somewhere, where I can see how this is done properly ?

Independently of that, if the user space application dies, how can I remove 
the driver then ?

Thank you,

Thomas


On Sunday 07 May 2006 22:21, Bernhard Walle wrote:
> Hi Thomas,
>
> Thomas Witzel <witzel.thomas@domain.hid> [2006-05-07]:
> > > Generally spoken, mmap can make sense if you have a significant amount
> > > of data to transfer, not "just" a few kbyte/s. RTDM has the elementary
> > > support for such device interfaces now, and this has already been used
> > > for a frame-grabbing driver.
> >
> > What would be the proper procedure for just a few kbytes ? I expect less
> > than 500 kB./second in my application.
>
> Simply read() / write() ?
>
>
> Regards,
>   Bernhard


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Xenomai-help] Re: RTDM driver questions
  2006-05-21 21:19       ` Thomas Witzel
@ 2006-05-23  9:13         ` Jan Kiszka
  2006-05-23 20:29           ` Thomas Witzel
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Kiszka @ 2006-05-23  9:13 UTC (permalink / raw)
  To: witzel.thomas; +Cc: xenomai

[-- Attachment #1: Type: text/plain, Size: 996 bytes --]

Thomas Witzel wrote:
> I have that now, but I'm not really sure how to synchronize the user space 
> application with the driver, since the driver has of course only a limited 
> buffer. Practically now I have a 512 sample buffer in the driver that I use 
> as a double buffer and I copy blocks of 256 to the user on read. 
> Isn't there a way to have a FIFO between driver and user application and is 
> there an example somewhere, where I can see how this is done properly ?

Why not extending your sample buffer to some FIFO by providing more space?

> 
> Independently of that, if the user space application dies, how can I remove 
> the driver then ?

As long as we have no auto-cleanup on termination (WIP), you can
forcibly close a RTDM file descriptor via "echo FD >
/proc/xenomai/rtdm/open_fildes" (FD = descriptor number, see "cat
/proc/xenomai/rtdm/open_fildes" for candidates). Once all descriptors of
a device are closed, you can remove the driver again.

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Xenomai-help] Re: RTDM driver questions
  2006-05-23  9:13         ` Jan Kiszka
@ 2006-05-23 20:29           ` Thomas Witzel
  2006-05-23 20:51             ` Jan Kiszka
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Witzel @ 2006-05-23 20:29 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

On Tuesday 23 May 2006 09:13, Jan Kiszka wrote:
> Thomas Witzel wrote:
> Why not extending your sample buffer to some FIFO by providing more space?

That is exactly my thinking, but either I'm blind, or I can't see any FIFO 
functionality in rtdm. I could implement it myself, but I'm asking here in 
case that I might not have to do this.

Thomas


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Xenomai-help] Re: RTDM driver questions
  2006-05-23 20:29           ` Thomas Witzel
@ 2006-05-23 20:51             ` Jan Kiszka
  0 siblings, 0 replies; 8+ messages in thread
From: Jan Kiszka @ 2006-05-23 20:51 UTC (permalink / raw)
  To: witzel.thomas; +Cc: xenomai

[-- Attachment #1: Type: text/plain, Size: 1072 bytes --]

Thomas Witzel wrote:
> On Tuesday 23 May 2006 09:13, Jan Kiszka wrote:
>> Thomas Witzel wrote:
>> Why not extending your sample buffer to some FIFO by providing more space?
> 
> That is exactly my thinking, but either I'm blind, or I can't see any FIFO 
> functionality in rtdm. I could implement it myself, but I'm asking here in 
> case that I might not have to do this.

Probably because it's either too simple or too specific. Take a look at
this FIFO [1] e.g. It handles single network packets, with or without
locking dependent on the number of readers/writers. Would look different
again if you decide to dequeue more than one packet at a time. Further
FIFOs are contained in the 16550A driver, but I do not see urging
similarities between all of them.

Anyway, if someone drafts a generic FIFO for RTDM, I would definitely
welcome this. Would not be the first time users came up with concrete
scenarios, and we finally added a useful new feature.

Jan


[1]http://www.rts.uni-hannover.de/rtnet/lxr/source/stack/include/rtskb_fifo.h?v=SVN


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-05-23 20:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-07 15:14 [Xenomai-help] RTDM driver questions witzel.thomas
2006-05-07 21:38 ` Jan Kiszka
2006-05-07 22:02   ` Thomas Witzel
2006-05-07 22:21     ` [Xenomai-help] " Bernhard Walle
2006-05-21 21:19       ` Thomas Witzel
2006-05-23  9:13         ` Jan Kiszka
2006-05-23 20:29           ` Thomas Witzel
2006-05-23 20:51             ` Jan Kiszka

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.