On Tue, 18 Sep 2001 [EMAIL PROTECTED] wrote:
>
>
>
>
> > > > 1. Is it possible to write a single PCI I/O driver module that can be
> > > > accessible from user or kernel space ?
>
> It's easier to write it in user space, and gradually move it to kernel
> space. You can certainly have a PCI device driver be an RTL module which
> could be used by other RTL modules and by users programs via FIFO, MBUFF,
> or other means.
>
> > > > 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 ?
>
> PCI cards generally have registers mapped into IO-space and memory space.
> The IO spce is super easy via ioperm() and family. The memory space
> registers are also accesable by mmap and company.
>
> You should be aware that programmed PCI IO is not a great deal faster than
> ISA programmed IO. Don't expect 120mb/sec no matter how fast your CPU is.
> Expect a single 32 bit IO instruction to consume hundreds of nanoseconds
> if it's reading/writing to a PCI register or FIFO.
>
>
> > Wait.. but how can one do DMA this way? Won't the whole virtual,
> > swappable, transient nature of user memory basically cause problems when
> > trying to use DMA? Or am I misunderstanding the question?
>
> Most PCI cards which use DMA contain onboard PCI dma controllers. You can
> use those controllers from user-mode or kernel mode. I have recently
> developed a system which uses PCI-DMA from a user-level program. I've
> measured transfer rates at over 100 megabyes/seconds with it. The
> principal problem with dma is dealing with the need for "scatter/gather"
> logic since the virtual memory space your program has is porbably not in
> contiguous physical memory. The DMA systems all want linear physical ram
> and will do nasty things if you don't properly control them. The unit I
> use has the ability to follow a linked-list of pointers to the fragments
> which make up your programs virtual data space. It appeared complicated
> to use, so I configured linux to reserve 4mb of linear address space at
> the top which I use to do the DMA transfers to/from. It's much simpler,
> and quite easy to use.
Hmm, so you can program your controller from user mode to get to a random
collection of pages. However, how can a user mode program be sure of the
real physical address (if any!) of any virtual page? Or does the
onboard PCI DMA controller on some cards know how to talk to memory
management hardware to query that information?
Also, how do you deal with swapping of physical pages? Or do you just
lock the user pages into ram?
At any rate, I find this curiously fascinating.... :)
-Calin
>
> C. W. Wright
>
>
>
>
>
>
>
-- [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/