Subject: Bus Dma Question
To: None <tech-kern@netbsd.org>
From: Riaz <riazr@cat.co.za>
List: tech-kern
Date: 08/24/2000 17:34:15
Hello
I have a query regarding bus_dma functions on i386 NetBSD 1.4.
We have 3 PCI Video Capture Cards and 3Mb memory is allocated
using bus_dmamem_alloc. A typical RAW image is 400kb and we transfer
25 images/s per card. That's 10Mb per card per second.
Just before we capture an image we set the first 4 bytes
to a magic number and check those bytes when an interrupt
is generated after a capture. If they are the same, we assume
that the capture failed (may happen after a few minutes).
I don't know whether the data is cached somewhere.
(I know that I am transferring a ridiculous amount of data on the PCI bus)
I tried "bus_dmamap_sync" but isn't that a "nop" on i386?
Also what is the need for creating a dmamap anyway?
Are the results I obtain to be expected or is there something I could do?
----------------------------------------------------------------------
static void
fg_attach_pci(parent, self, aux)
struct device *parent, *self;
void *aux;
{
struct fg_softc *sc = (void *) self;
struct pci_attach_args *pap = aux;
bus_space_tag_t memt;
bus_space_handle_t memh;
bus_size_t memsize;
bus_dma_segment_t segs;
int rsegs;
caddr_t kva;
...
pci_mapreg_map(pap, 0x10, PCI_MAPREG_TYPE_MEM, 0,&memt, &memh, NULL,
&memsize);
bus_dmamem_alloc(pap->pa_dmat, TOTAL_DMA, 0,
0,&segs,1,&rsegs,BUS_DMA_NOWAIT);
bus_dmamem_map(pap->pa_dmat,&segs,rsegs,TOTAL_DMA,&kva,BUS_DMA_NOWAIT);
...
sc->VideoPhysMem = segs.ds_addr;
sc->VideoMapMem = kva;
...
}
then just before capture:
...
*(int*)(sc->VideoMapMem) = 0xfacecafe;
...
and the card transfers the image into sc->VideoPhysMem
then interrupt handler (after capture):
int
fg_intr(arg)
void *arg;
{...
if ( *(int*)(sc->VideoMapMem) == 0xfacecafe)
{
RawFail = 1;
}
...
}
-----------------------------------------------------------
Please help.
Thanks in advance
Riaz Randeree