All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] User-space DMA transfer and I/O access from Xenomai API
@ 2006-06-20  9:21 Merilainen, Jussi (GE Healthcare)
  2006-06-20 11:11 ` Jan Kiszka
  0 siblings, 1 reply; 4+ messages in thread
From: Merilainen, Jussi (GE Healthcare) @ 2006-06-20  9:21 UTC (permalink / raw)
  To: xenomai

 

I'm porting a PCI driver for a custom board from VxWorks to Xenomai/Linux. My goal is to keep the driver as much as possible in user-space. Implementing the HW interrupt handler should be quite straight forward as presented in 'Writing user-space device drivers' in Native-API-Tour manual.
My concern is the PCI DMA transfer. Does the Xenomai API provide any support for this in user-space? Does anyone have experience on this subject?
Another thing is the Device I/O handling from user-space. Simple question: how do I perform read/write operations? In VxWorks, I have for example following function for reading an I/O register of the board:
 
#include <vxworks.h>
#include <sysLib.h>
#include <intLib.h>
#include <taskLib.h>

Uint8 CIo::readIoMaskUint8(Uint32 addr, Uint8 mask)
{
    Uint8 data = 0;
    int intKey;
    
    // Lock interrupts
    intKey = intLock();
    
    // Read data
    data = sysInByte((int)addr);
    data = (data & mask);
    
    // Unlock interrupt
    intUnlock(intKey);
    
    return data;
}
 
Thanks in advance for any support,

Jussi Meriläinen



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

* Re: [Xenomai-core] User-space DMA transfer and I/O access from Xenomai API
  2006-06-20  9:21 [Xenomai-core] User-space DMA transfer and I/O access from Xenomai API Merilainen, Jussi (GE Healthcare)
@ 2006-06-20 11:11 ` Jan Kiszka
  2006-06-20 11:30   ` Gilles Chanteperdrix
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Kiszka @ 2006-06-20 11:11 UTC (permalink / raw)
  To: Merilainen, Jussi (GE Healthcare); +Cc: xenomai

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

Merilainen, Jussi (GE Healthcare) wrote:
>  
> 
> I'm porting a PCI driver for a custom board from VxWorks to Xenomai/Linux. My goal is to keep the driver as much as possible in user-space. Implementing the HW interrupt handler should be quite straight forward as presented in 'Writing user-space device drivers' in Native-API-Tour manual.
> My concern is the PCI DMA transfer. Does the Xenomai API provide any support for this in user-space? Does anyone have experience on this subject?

Actually, this need not be a Xenomai-specific issue. User space device
drivers are of increasing common interest in the Linux community. I only
collected some projects so far, I did not dig into the APIs:

- libpci as part of the pciutils provides ways to access device
  information, don't know if it also allows to map DMA memory to user
  space.

- The Gelato project [1] developed some libs and kernel patches for user
  level drivers.

- Don't know if it is related to the former, but this research project
  [2] implemented user-level drivers as well.

- David Schleef's usddk [3] is another user space driver development
  lib, but it looks a bit premature.

Why am I listing these? Xenomai is not providing PCI access functions,
and I'm not sure yet if it actually has to do this on its own (in user
space, in kernel definitely not). All init/cleanup work can perfectly
use standard Linux infrastructure - if there is one of course. Only
services which may need rescheduling in time-critical contexts (IRQ
handlers, RT tasks) have to be mapped on the Xenomai infrastructure.

Nevertheless, user space support for RTDM, Xenomai's driver model, is
planned, so I'm already collecting input on what services are
additionally required and may have to be provided by RTDM itself (and
not some third-party lib). So, if you find some solution or anyone else
has ideas, please let me know.

> Another thing is the Device I/O handling from user-space. Simple question: how do I perform read/write operations? In VxWorks, I have for example following function for reading an I/O register of the board:
> ...

On x86, iopl() or ioperm() opens in/out to a user space process. Memory
mapped I/O should be accessible via /dev/mem on any arch.

Jan


[1] http://www.gelato.unsw.edu.au/IA64wiki/UserLevelDrivers
[2] http://www.ertos.nicta.com.au/research/uldd/
[3] http://www.schleef.org/usddk/


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

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

* Re: [Xenomai-core] User-space DMA transfer and I/O access from Xenomai API
  2006-06-20 11:11 ` Jan Kiszka
@ 2006-06-20 11:30   ` Gilles Chanteperdrix
  2006-06-20 11:43     ` Jan Kiszka
  0 siblings, 1 reply; 4+ messages in thread
From: Gilles Chanteperdrix @ 2006-06-20 11:30 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

Jan Kiszka wrote:
 > Merilainen, Jussi (GE Healthcare) wrote:
 > >  
 > > 
 > > I'm porting a PCI driver for a custom board from VxWorks to Xenomai/Linux. My goal is to keep the driver as much as possible in user-space. Implementing the HW interrupt handler should be quite straight forward as presented in 'Writing user-space device drivers' in Native-API-Tour manual.
 > > My concern is the PCI DMA transfer. Does the Xenomai API provide any support for this in user-space? Does anyone have experience on this subject?
 > 
 > Actually, this need not be a Xenomai-specific issue. User space device
 > drivers are of increasing common interest in the Linux community. I only
 > collected some projects so far, I did not dig into the APIs:
 > 
 > - libpci as part of the pciutils provides ways to access device
 >   information, don't know if it also allows to map DMA memory to user
 >   space.

libpci allow user-space to retrieve the bus addresses of memory
regions of each PCI device. Mmaping this memory may be done using
/dev/mem. But usually, PCI devices do DMA the other way around: they are
passed the physical address of some RAM, become bus-master and write
directly to this RAM. So what is needed is:
- to map some physically contiguous RAM region to user-space;
- get the physical addres of this region in order to pass it to the PCI
  device to program the DMA.

Xenomai allow you to map to user-space some physically contiguous RAM
region (using either native heaps or posix shared memory smaller than
128K), but does not provide accessors to the RAM physical
address. Is it what you need ?

-- 


					    Gilles Chanteperdrix.


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

* Re: [Xenomai-core] User-space DMA transfer and I/O access from Xenomai API
  2006-06-20 11:30   ` Gilles Chanteperdrix
@ 2006-06-20 11:43     ` Jan Kiszka
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Kiszka @ 2006-06-20 11:43 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

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

Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
>  > Merilainen, Jussi (GE Healthcare) wrote:
>  > >  
>  > > 
>  > > I'm porting a PCI driver for a custom board from VxWorks to Xenomai/Linux. My goal is to keep the driver as much as possible in user-space. Implementing the HW interrupt handler should be quite straight forward as presented in 'Writing user-space device drivers' in Native-API-Tour manual.
>  > > My concern is the PCI DMA transfer. Does the Xenomai API provide any support for this in user-space? Does anyone have experience on this subject?
>  > 
>  > Actually, this need not be a Xenomai-specific issue. User space device
>  > drivers are of increasing common interest in the Linux community. I only
>  > collected some projects so far, I did not dig into the APIs:
>  > 
>  > - libpci as part of the pciutils provides ways to access device
>  >   information, don't know if it also allows to map DMA memory to user
>  >   space.
> 
> libpci allow user-space to retrieve the bus addresses of memory
> regions of each PCI device. Mmaping this memory may be done using
> /dev/mem. But usually, PCI devices do DMA the other way around: they are
> passed the physical address of some RAM, become bus-master and write
> directly to this RAM. So what is needed is:
> - to map some physically contiguous RAM region to user-space;
> - get the physical addres of this region in order to pass it to the PCI
>   device to program the DMA.
> 
> Xenomai allow you to map to user-space some physically contiguous RAM
> region (using either native heaps or posix shared memory smaller than
> 128K), but does not provide accessors to the RAM physical
> address. Is it what you need ?
> 

I think we are primarily looking for some user space
dma_map_*/dma_unmap_* support here - which also has to be RT-safe.

Jan


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

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

end of thread, other threads:[~2006-06-20 11:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-20  9:21 [Xenomai-core] User-space DMA transfer and I/O access from Xenomai API Merilainen, Jussi (GE Healthcare)
2006-06-20 11:11 ` Jan Kiszka
2006-06-20 11:30   ` Gilles Chanteperdrix
2006-06-20 11:43     ` 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.