April 2012
Intermediate to advanced
352 pages
8h
English
This section describes an alternative set of functions used to manage DMA maps.
#include <machine/bus.h>
int
bus_dmamem_alloc(bus_dma_tag_t dmat, void **vaddr, int flags,
bus_dmamap_t *mapp);
void
bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map);The bus_dmamem_alloc function creates a DMA map based on the DMA tag dmat and stores the result in mapp. This function also allocates maxsize bytes of contiguous memory (where maxsize is defined by dmat). The address of this memory is returned in vaddr. As you’ll soon see, this contiguous memory will eventually become your DMA buffer. The flags argument modifies bus_dmamem_alloc’s behavior. Valid values for this argument are shown in Table 12-4.
Table 12-4. bus_dmamem_alloc ...