On Fri, 11 Aug 2000, Charlie Flynn wrote:
> Thanks Nicholas,
>
> I saw your code and I also studied the code in the audio driver you mentioned.
> I have been able to get DMA working using a combination of the existing code and
> your code ( specifically the function "sa1100_start_dma" ). My code isn't
> generic stuff but at least it's working and I can tidy it up later. I was also
> in a steep DMA learning curve.
>
> My understanding is that the "generic" API as presented in
> /arch/arm/kernel/dma.c (kernel 2.4.0-test4) needs the architecture specific
> functions (arch_xxx() ). These functions are still under development (and are
> presently commented out in 2.4.0-test4). If this is true can you give some
> indication as to when they will be finished.?
Actually I don't know since I'm not settled on the best API to use. The
generic one isn't appropriate for SA1100 DMA and probably a separate one
might be best.
My idea is to use a function to commit some buffers in DMA queues and have
a callback function be called to notify the interested code when the
buffer has been processed. Also buffers size shouldn't be limited by the
physical DMA buffer size, etc.
As soon as I can resurface from everything that stacked while I was on
vacation I'll try to complete the code.
> Your help now and in the future would be much appreciated. One question comes to
> mind since you offer ;-)
> The physical and virtual addresses returned from the call to
> "consistent_alloc()" were different (as expected) but when I tried to convert
> physical to virtual using the macros "virt_to_phys" and "phys_to_virt".the
> addresses were the same. I only got DMA working when I ditched these macros and
> stayed with the physical address returned from "consistent_alloc()". Any
> comments?
The consist_alloc() creates a separate virtual mapping for the allocated
memory which is marked as non cacheable. Since the returned virtual
address is the new mapping and not the actually allocated memory, you
can't use virt_to_phys() on it.
If you wanted to use the physical address of a buffer like a skbuf for
example, you should use pci_map_single() as described in
linux/Documentation/DMA-mapping.txt (here you should pass NULL as the PCI
dev argument). This is especially suited for streaming DMA like
networking data where you can avoid the extra memcpy to/from the static
coherent buffer.
Nicolas
Received on Fri Aug 11 10:40:19 2000
This archive was generated by hypermail 2.1.8 : Tue May 04 2004 - 09:43:40 EDT