Subject: Re: troubles with DMA
To: Filka Michal <michal.filka@strom.cz>
From: Jachym Holecek <freza@dspfpga.com>
List: tech-kern
Date: 03/14/2006 14:01:36
Hello,
> DMA initialization (reduced) as done in attach callback:
> bus_dmamem_alloc( munInfo->pciInfo.pa_dmat, BUF_BUF_SIZE,
> PAGE_SIZE,&munInfo->dmaMem[ 0], 1, &munInfo->dmaSegs, 0)
>
> bus_dmamem_map( munInfo->pciInfo.pa_dmat, munInfo->dmaMem,
> munInfo->dmaSegs, BUF_BUF_SIZE,
> &munInfo->dmaBuf, BUS_DMA_NOWAIT | BUS_DMA_NOCACHE )
>
> bus_dmamap_create(
> munInfo->pciInfo.pa_dmat,BUF_BUF_SIZE,1,BUF_BUF_SIZE,0,
> 0, &munInfo->dmaMap)
>
> bus_dmamap_load( munInfo->pciInfo.pa_dmat, munInfo->dmaMap,
> munInfo->dmaBuf, BUF_BUF_SIZE, NULL, 0)
>
> Next thing I do is that I configure device's DMA related registers.
> E.g for the first interrupt queue: pulIntQueue[0]=munInfo->dmaBuf + 0
> For the second interrupt queue: pulIntQueue[1]=munInfo->dmaBuf +
> INT_QUEUE_SIZE
> And so on ... and write those pulIntQueue[ i] into device ...
Your "munInfo->dmaBuf" is kernel virtual address which the hardware
is unlikely to understand. Values suitable for programming into DMA
registers are found in ${dmamap}->dm_segs[i]->ds_{addr,len}.
-- Jachym