April 2012
Intermediate to advanced
352 pages
8h
English
DMA buffers must be synchronized after each write completed by the CPU/driver or a device. The exact reason why is beyond the scope of this book. But it’s basically done to ensure that the CPU/driver and device have a consistent view of the DMA buffer.
DMA buffers are synchronized with the bus_dmamap_sync function.
#include <machine/bus.h> void bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dmasync_op_t op);
This function synchronizes the DMA buffer currently loaded in the DMA map map. The dmat argument is the DMA tag that map is based on. The op argument identifies the type of synchronization operation to perform. Valid values for this argument are shown in Table 12-5.
Table 12-5. bus_dmamap_sync Symbolic Constant ...