DmaMap¶
Lets a device reach part of a memory object by DMA.
| Number | Selector | Blocking | Since |
|---|---|---|---|
0x0B SVC_MANAGEMEMORY |
MNGMEM_DMAMAP (4) |
no | 2.0 |
DmaMapResult DmaMap(Handle dev, Handle mem, size_t offset, size_t len, DmaDir dir);
Registers: (&args) -> r0 status, r1 bus address, r2 id
Cached memory is cleaned and invalidated at map time; use DmaSync() around later transfers. The mapping belongs to the device, not the caller, so it survives the driver exiting; DmaAdopt() lets a restarted driver take it over.
Parameters¶
| Name | Direction | Description |
|---|---|---|
dev |
in | Device handle with PERM_MAP. |
mem |
in | MEM_CONTIG memory object with PERM_MAP. |
offset |
in | Page-aligned byte offset into mem. |
len |
in | Page-aligned length; must fit in mem. |
dir |
in | Direction of the transfers. |
Returns¶
The status, the address the device must use, and the mapping id.
Errors¶
| Error | Condition |
|---|---|
ERR_BADHANDLE |
dev or mem is not a live handle. |
ERR_BADTYPE |
dev is not a device, or mem is not MEM_CONTIG memory. |
ERR_NOPERM |
A handle lacks PERM_MAP. |
ERR_BADARG |
Bad direction, misaligned or out-of-range window, or beyond the device's DMA reach. |
ERR_NOMEM |
The device has no mapping slots left. |
ERR_BADPTR |
The argument block is unreadable. |