next up previous contents
Next: alloc_dos: allocate low DOS Up: MOSS system calls Previous: MOSS system calls

alloc_dma: allocate DMA memory

SYNOPSIS

unsigned alloc_dma(size_t size, int align_bits, unsigned align_ofs);

DESCRIPTION

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.

PARAMETERS

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.

RETURN VALUE

Returns the physical address of the memory allocated if successful, or 0 on error, in which case errno indicates the error.



Bryan Ford