VE DMA is a DMA data transfer feature for VE programs.
More...
|
int | ve_dma_handle_t::status |
|
int | ve_dma_handle_t::index |
|
VE DMA is a DMA data transfer feature for VE programs.
Please include "vedma.h" in the source file. Please specify "-lveio -pthread" option to the compiler driver to link libveio.
- Note
- A source and a destination of DMA data transfer are specified by VE host virtual address. To obtain VE host virtual address, you need to register memory to DMAATB.
-
A source and a destination of DMA data transfer needs to be aligned on a 4 byte boundary.
-
Data transfer size needs to be a multiple of 4 and less than 128MB.
This function initializes VE DMA feature.
- Note
- When the VE program invokes this function multiple times, this function simply returns 0.
-
Before using VE DMA, invoke this function to initialize VE DMA.
When a child process is created by fork(), vfork(), the state of VE DMA is not inherited to the child process. This function should be invoked from the child process.
- Return values
-
- Examples:
- vedma/dma.c.
int ve_dma_post |
( |
uint64_t |
dst, |
|
|
uint64_t |
src, |
|
|
int |
size, |
|
|
ve_dma_handle_t * |
handle |
|
) |
| |
This function issues asynchronous DMA.
- Note
- This function writes the DMA transfer request to the DMA descriptor table.
- Parameters
-
[in] | dst | 4 byte aligned VE host virtual address of destination |
[in] | src | 4 byte aligned VE host virtual address of source |
[in] | size | Transfer size which is a multiple of 4 and less than 128MB |
[out] | handle | Handle used to inquire DMA completion |
- Return values
-
0 | On success |
-EAGAIN | The DMA using the DMA descriptor to be used next is not yet completed
Need to call ve_dma_post() again. |
This function inquiries the completion of asynchronous DMA.
- Note
- This function inquiries the completion of DMA transfer request issued by ve_dma_post().
- Parameters
-
- Return values
-
0 | DMA completed normally |
1-65535 | DMA failed
Exception value of DMA descriptor is returned.
DMA failed. The value is bitwise ORed combination of the values described below.
- 0x8000: Memory protection exception
- 0x4000: Missing page exception
- 0x2000: Missing space exception
- 0x1000: Memory access exception
- 0x0800: I/O access exception
|
-EAGAIN | DMA has not completed yet
Need to call ve_dma_poll() again |
This function iterates over the inquiry until it completes the asynchronous DMA,.
- Note
- This function iterates over the inquiry the completion of DMA transfer request
issued by ve_dma_post(), until it completes the asynchronous DMA.
- Parameters
-
- Return values
-
0 | DMA completed normally |
1-65535 | DMA failed
Exception value of DMA descriptor is returned.
DMA failed. The value is bitwise ORed combination of the values described below.
- 0x8000: Memory protection exception
- 0x4000: Missing page exception
- 0x2000: Missing space exception
- 0x1000: Memory access exception
- 0x0800: I/O access exception
|
int ve_dma_post_wait |
( |
uint64_t |
dst, |
|
|
uint64_t |
src, |
|
|
int |
size |
|
) |
| |
This function issues synchronous DMA.
- Note
- This function writes the DMA transfer request to the DMA descriptor table, and waits for finish.
- Parameters
-
[in] | dst | 4 byte aligned VE host virtual address of destination |
[in] | src | 4 byte aligned VE host virtual address of source |
[in] | size | Transfer size which is a multiple of 4 and less than 128MB |
- Return values
-
0 | On success |
1-65535 | DMA failed
Exception value of DMA descriptor is returned.
DMA failed. The value is bitwise ORed combination of the values described below.
- 0x8000: Memory protection exception
- 0x4000: Missing page exception
- 0x2000: Missing space exception
- 0x1000: Memory access exception
- 0x0800: I/O access exception
|
- Examples:
- vedma/dma.c.
uint64_t ve_register_mem_to_dmaatb |
( |
void * |
vemva, |
|
|
size_t |
size |
|
) |
| |
This function registers VE local memory to DMAATB.
- Note
- The default value of VE page size is 64MB.
In this case, values of vemva and size need to be aligned with 64MB boundary.
If VE page size is 2MB, values of vemva and size need to be aligned with 2MB boundary.
- Parameters
-
[in] | vemva | An address of memory to be registered
The address needs to be aligned with 64MB boundary. |
[in] | size | Size of memory aligned aligned with 64MB boundary |
- Return values
-
vehva | VE host virtual address on success |
0xffffffffffffffff | On failure
- EINVAL Invalid argument
- EFAULT Bad address
- ESRCH No such process
- ENOENT No such memory
- EACCES Permission denied
- ECANCEL Operation canceled
|
- Examples:
- vedma/dma.c.
int ve_unregister_mem_from_dmaatb |
( |
uint64_t |
vehva | ) |
|
This function unregisters VE local memory from DMAATB.
- Parameters
-
[in] | vehva | VE host virtual address of memory to be unregistered |
- Return values
-
0 | On success |
-1 | On failure
- EINVAL Invalid argument
- ECANCELED No such memory
|
- Examples:
- vedma/dma.c.