DMA
DMA Facilities Interface
- DMA
Work with DMA-able host memory and DMA descriptors: allocate and free buffers, translate between CPU and bus addresses, fill or edit buffers, and build or dump DMA vectors (DVs) and descriptors (DCBs). It is a tool for driver debugging; it does not start DMA transfers by itself. Sub-command keywords must be typed in full (any case).
Results are stored in shell variables (
$dma_laddr,$dma_paddr,$dma_size,$dma_count,$dma_bytes,$dma_shorts,$dma_words,$dma_dv_laddr,$dma_dcb_laddr,$dma_dcb_count,$dma_dcb_size) and used as defaults by later sub-commands.Warning
Addresses are pointers inside the
syncdprocess.fill,load,edit,free,dvfreeanddcbdumpon an address that was not allocated withdma alloc/dma dvalloccan corruptsyncd’s packet buffers or crash it.Unvalidated — Allocate 64 words, show the bus address, free them
drivshell> dma alloc w 64 test drivshell> dma l2p drivshell> dma free
- DMA alloc [b|h|w] <count> [<name>]
Allocate DMA-able memory of
<count>bytes, half-words or words and print its address (Allocated <n> bytes of DMA-able memory at address <p>). Sets$dma_laddrand the size variables.Unvalidated
drivshell> dma alloc b 256
- DMA fill [b|h|w] <laddr> <count> <value>
Fill a buffer with a value.
dma load <laddr> <hex data>copies hex bytes into it;dma editedits it interactively;flush/invalmaintain the CPU cache for a region.Unvalidated
drivshell> dma fill w $dma_laddr 64 0
- DMA dvalloc [r|t] <dcb_count>
Allocate an RX (
r) or TX (t) DMA vector with<dcb_count>descriptors.dma addrx <dv_laddr> <buf_laddr> <bytes>adds an RX descriptor,dma dcbdump [r|t] <dcb_laddr>decodes a descriptor anddma dvfree <dv_laddr>frees the vector.Unvalidated
drivshell> dma dvalloc r 4 drivshell> dma dcbdump r $dma_dcb_laddr drivshell> dma dvfree $dma_dv_laddr
Built-in help
Usages: dma alloc [b|h|w] <count> [name] Allocate DMA-able memory (you can add region name) dma free [<laddr>] Free DMA-able memory dma l2p [<laddr>] Convert logical (CPU) address into a physical (bus) address dma p2l [<paddr>] Convert physical (bus) address into a logical (CPU) address dma flush [b|h|w] [<laddr> [<count>]] Flush the cache corresponding to the DMA-able memory region dma inval [b|h|w] [<laddr> [<count>]] Invalidate the cache corresponding to the DMA-able memory region dma load <laddr> <hex data> Fill DMA-able memory with provided hex data dma fill [b|h|w] <laddr> <count> <value> Fill DMA-able memory with provided value dma edit [b|h|w] [<laddr>] Interactive memory editing dma dvalloc [r|t] <dcb_count> Allocate a DMA Vector (DV) with dcb_count DCBs dma dvfree dv_addr Free a DV together with the allocated DCBs dma addrx <dv_laddr> <buf_laddr> <bytes> Add an RX DCB to the DV chain dma dcbdump [r|t] $dcb_laddr Dump the memory as a DCB Note: The following variables contain the results of the subcommands and be used as default arguments: $dma_laddr -- the logical address of DMA-able memory $dma_paddr -- the physical address of DMA-able memory $dma_size -- the size of the element (b, h, or w) $dma_count -- the number of elements (bytes, shorts, words) $dma_bytes -- number of bytes in the allocated region $dma_shorts -- number of shorts in the allocated region $dma_words -- number of words in the allocated region $dma_dv_laddr -- the logical address of the allocated DMA vector (DV) $dma_dcb_laddr -- the logical address of allocated DCB chain $dma_dcb_count -- number of DCBs in the allocated chain $dma_dcb_size -- the size of a single DCB in bytesFurther reading