KnIoDmaMap()
KnIoDmaMap()
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 usingKnIoDmaCreate()
.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
):
- VMM_FLAG_READ and VMM_FLAG_WRITE are memory protection attributes.
- VMM_FLAG_LOW_GUARD and VMM_FLAG_HIGH_GUARD add a protective page before and after the allocated memory, respectively.
Permissible combinations of memory protection attributes:
- VMM_FLAG_READ allows reading page contents.
- VMM_FLAG_WRITE allows modification of page contents.
- VMM_FLAG_READ | VMM_FLAG_WRITE allows reading and modifying page contents.
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.
Did you find this article helpful?
What can we do better?
Thank you for your feedback! You're helping us improve.
Thank you for your feedback! You're helping us improve.