On Tuesday 18 September 2001 18:40, Calin A. Culianu wrote:
> > On Monday 10 September 2001 16:48, S. Ancelot wrote:
> > > Hi,
> > > 1. Is it possible to write a single PCI I/O driver module that can
> > > be accessible from user or kernel space ?
> >
> > Yes, but it's not trivial to do it in a "nice" way.
> >
> > (The "DPI" I hacked when I used RTL for real time audio replaced the
> > kernel driver "API" with calls that automatically detected the
> > calling context and used Linux or RTL calls accordingly.)
> >
> > > 2. on the PCI board, I use , I would like to remap I/O pci to have
> > > direct memory access from user space programs directly.
> > > is it possible and how ?
> >
> > Nice Linux specific feature: Use "ioperm()" to gain access to the
> > ports you need. Then use port instructions (or macros) right in your
> > code, as if you were running in kernel space - or under DOS. :-)
>
> Wait.. but how can one do DMA this way?
You can't, AFAIK. You need a kernel driver for setting up the DMA. You'll
probably also need it to handle the IRQ for DMA to be truly useful.
> Won't the whole virtual,
> swappable, transient nature of user memory basically cause problems
> when trying to use DMA?
No, not even if you share the buffer with user space applications, as for
example most (modern) sound card drivers can do if you request it. DMA
buffers are always locked, and should also be allocated with flags that
ask for memory in the accessible range for the hardware in question.
(Busses have different DMA adressing limits.)
BTW, you *can* prevent user space code, data and stack from being swapped
out if you want. (Very useful with Linux/lowlatency, as swapped memory
out is the only way that the system can still cause SCHED_FIFO threahs to
miss deadlines on lowlatency kernels.) See mlock() and mlockall().
//David Olofson --- Programmer, Reologica Instruments AB
.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
`----------------------------> http://www.linuxdj.com/maia -'
.- David Olofson -------------------------------------------.
| Audio Hacker - Open Source Advocate - Singer - Songwriter |
`--------------------------------------> [EMAIL PROTECTED] -'
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/