This function is declared in the coresrv/io/dma.h file.
Retcode KnIoDmaMap(Handle rid, rtl_size_t offset, rtl_size_t length, void *hint,
int vmflags, void **addr, Handle *handle);
This function maps a DMA buffer area to the address space of a process.
Input parameters:
rid is the handle of the DMA buffer allocated using KnIoDmaCreate().offset refers to the page-aligned offset of the start of the area from the start of the buffer, indicated in bytes.length refers to the size of the area; it must be a multiple of the page size and must not exceed <buffer size - offset>.hint is the virtual address of the start of mapping; if it is equal to 0, the address is selected by the kernel.vmflags refers to allocation flags.In the vmflags parameter, you can use the following allocation flags (vmm/flags.h):
Permissible combinations of memory protection attributes:
Output parameters:
addr is the pointer to the virtual address of the start of the mapped area.handle refers to the handle of the created mapping.If successful, the function returns rcOk.
For a usage example, see KnIoDmaCreate().
To delete a created mapping, you must call the KnIoClose() function and pass the specified mapping handle in this function.