Function axdma::alloc_coherent

source ·
pub unsafe fn alloc_coherent(layout: Layout) -> AllocResult<DMAInfo>
Expand description

Allocates coherent memory that meets Direct Memory Access (DMA) requirements.

This function allocates a block of memory through the global allocator. The memory pages must be contiguous, undivided, and have consistent read and write access.

  • layout: The memory layout, which describes the size and alignment requirements of the requested memory.

Returns an DMAInfo structure containing details about the allocated memory, such as the starting address and size. If it’s not possible to allocate memory meeting the criteria, returns None.

§Safety

This function is unsafe because it directly interacts with the global allocator, which can potentially cause memory leaks or other issues if not used correctly.