DMA_ALLOC(9)

NAME
dma_alloc, dma_free - DMA-safe memory allocator

SYNOPSIS
#include <sys/types.h>
#include <sys/pool.h>
void *
dma_alloc(size_t size, int flags);
void
dma_free(void *m, size_t size);

DESCRIPTION
This allocator provides DMA-safe memory managed using the pool(9) interface. It is safe to call in most contexts and is typically used for temporary buffers up to 65536 bytes. When buffers are used many times it may be better to consider using other DMA-safe allocators.

Interrupt protection is set to IPL_VM using pool_setipl(9).

The flags argument is a selection of pool_get(9) flag arguments.

The same size argument must be passed to both dma_alloc() and the subsequent dma_free(). Allocations over 65536 will fail.

SEE ALSO
bus_dma(9), mbuf(9), pool(9)

HISTORY
The dma_alloc interface first appeared in OpenBSD 4.8.