Subject: Re: Need to know about implementation of DMA on MIPS
To: Viswanath <firstname.lastname@example.org>
From: Jochen Kunz <email@example.com>
Date: 01/07/2004 19:45:34
On Tue, 06 Jan 2004 06:17:25 -0800
"Viswanath" <firstname.lastname@example.org> wrote:
> I wanted to write DMA device driver on NetBSD 1.6 for MIPS.
> Need to know the implementation for on-chip DMA controller.
> How to go about and some information about to start. Is there
> any DMA driver for any other port containing on-chip DMA controller
> for reference.
You have a chip with a build in DMA engine that does bus master DMA?
On what MIPS port? If it is an official NetBSD port it has bus_dma(9).
Then you need to allocate a DMA map via bus_dmamap_create(9) e.g. at
device attachment. Once you have data to transfer you need to load that
map via bus_dmamap_load(9). Then you have to programm the DMA addresses
(dma_map->dm_segs.ds_addr etc.) in that map into your chip, call
bus_dmamap_sync(9) to flush the caches and do whatever the hardware
needs to initiate the DMA transfer. Once the DMA is done you have to
call bus_dmamap_sync(9) again to invalidate the caches and
bus_dmamap_unload(9) to clean up.
Or do you mean you created your own, custom NetBSD port and you need to
programm the machine dependent bus_dma(9) backend?