unsigned alloc_dma(size_t size, int align_bits, unsigned align_ofs);
This function can be used to allocate memory from the low 16MB of physical memory accessible to the PC's built-in DMA controller.This function only allocates the requested physical memory; in order to gain access to it within the application you must map it into the application's address space using mmap.
- size
- The minimum number of bytes of memory required.
- align_bits
- If greater than zero, the lowest align_bits bits of the physical start address of the returned memory will be equal to the specified align_ofs.
- align_ofs
- The low-order bits of the required alignment. If align_ofs is zero, the returned block will be naturally aligned according to align_bits. Must be less than 2align_bits.
Returns the physical address of the memory allocated if successful, or 0 on error, in which case errno indicates the error.