#include <devemu_pci_common.h>
#include <signal.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
#include <doca_ctx.h>
#include <doca_devemu_pci.h>
#include <doca_dev.h>
#include <doca_error.h>
#include <doca_log.h>
#include <doca_dma.h>
#include <doca_buf.h>
#include <doca_buf_inventory.h>
#include <common.h>
Go to the source code of this file.
|
| #define | NUM_DMA_TASKS (1) /* DMA tasks number */ |
| |
| #define | MEM_BUF_LEN (4 * 1024) /* Mem buffer size. It's the same as Host side */ |
| |
|
| | DOCA_LOG_REGISTER (DEVEMU_PCI_DEVICE_DMA_DPU) |
| |
| static void | dma_memcpy_completed_callback (struct doca_dma_task_memcpy *dma_task, union doca_data task_user_data, union doca_data ctx_user_data) |
| |
| static void | dma_memcpy_error_callback (struct doca_dma_task_memcpy *dma_task, union doca_data task_user_data, union doca_data ctx_user_data) |
| |
| static doca_error_t | setup_buf_inventory (struct dma_resources *resources, int max_bufs) |
| |
| static doca_error_t | dma_device_caps_is_supported (struct doca_devinfo *devinfo) |
| |
| static doca_error_t | setup_dma_ctx (struct dma_resources *resources, const char *devemu_name) |
| |
| static doca_error_t | setup_remote_mmap (struct dma_resources *resources, char *buf, int len) |
| |
| static doca_error_t | setup_local_mmap (struct dma_resources *resources, char *buf, int len) |
| |
| static doca_error_t | do_dma_copy (struct dma_resources *resources, int len, struct doca_mmap *src_mmap, void *src_addr, struct doca_mmap *dst_mmap, void *dst_addr) |
| |
| static doca_error_t | setup_devemu_resources (struct devemu_resources *resources, const char *pci_address, const char *emulated_dev_vuid) |
| |
| static void | dma_resources_cleanup (struct dma_resources *resources) |
| |
| doca_error_t | devemu_pci_device_dma_dpu (const char *pci_address, const char *devemu_name, const char *emulated_dev_vuid, uint64_t host_dma_mem_iova, const char *write_data) |
| |
◆ MEM_BUF_LEN
| #define MEM_BUF_LEN (4 * 1024) /* Mem buffer size. It's the same as Host side */ |
◆ NUM_DMA_TASKS
| #define NUM_DMA_TASKS (1) /* DMA tasks number */ |
◆ devemu_pci_device_dma_dpu()
| doca_error_t devemu_pci_device_dma_dpu |
( |
const char * |
pci_address, |
|
|
const char * |
devemu_name, |
|
|
const char * |
emulated_dev_vuid, |
|
|
uint64_t |
host_dma_mem_iova, |
|
|
const char * |
write_data |
|
) |
| |
◆ dma_device_caps_is_supported()
| static doca_error_t dma_device_caps_is_supported |
( |
struct doca_devinfo * |
devinfo | ) |
|
|
static |
◆ dma_memcpy_completed_callback()
| static void dma_memcpy_completed_callback |
( |
struct doca_dma_task_memcpy * |
dma_task, |
|
|
union doca_data |
task_user_data, |
|
|
union doca_data |
ctx_user_data |
|
) |
| |
|
static |
◆ dma_memcpy_error_callback()
| static void dma_memcpy_error_callback |
( |
struct doca_dma_task_memcpy * |
dma_task, |
|
|
union doca_data |
task_user_data, |
|
|
union doca_data |
ctx_user_data |
|
) |
| |
|
static |
◆ dma_resources_cleanup()
| static void dma_resources_cleanup |
( |
struct dma_resources * |
resources | ) |
|
|
static |
◆ do_dma_copy()
| static doca_error_t do_dma_copy |
( |
struct dma_resources * |
resources, |
|
|
int |
len, |
|
|
struct doca_mmap * |
src_mmap, |
|
|
void * |
src_addr, |
|
|
struct doca_mmap * |
dst_mmap, |
|
|
void * |
dst_addr |
|
) |
| |
|
static |
Do DMA copy task
@resources [in]: struct dma_resources @len [in]: The length of data to copy @src_mmap [in]: Source DOCA mmap @src_addr [in]: Source memory address @dst_mmap [in]: Destination DOCA mmap @dst_addr [in]: Destination memory address
- Returns
- : DOCA_SUCCESS on success and DOCA_ERROR otherwise
Definition at line 322 of file devemu_pci_device_dma_dpu_sample.c.
◆ DOCA_LOG_REGISTER()
| DOCA_LOG_REGISTER |
( |
DEVEMU_PCI_DEVICE_DMA_DPU |
| ) |
|
◆ setup_buf_inventory()
◆ setup_devemu_resources()
| static doca_error_t setup_devemu_resources |
( |
struct devemu_resources * |
resources, |
|
|
const char * |
pci_address, |
|
|
const char * |
emulated_dev_vuid |
|
) |
| |
|
static |
◆ setup_dma_ctx()
◆ setup_local_mmap()
Setup local mmap
@resources [in]: struct dma_resources @buf [in]: Local memory buffer @len [in]: Length of local memory buffer
- Returns
- : DOCA_SUCCESS on success and DOCA_ERROR otherwise
Definition at line 282 of file devemu_pci_device_dma_dpu_sample.c.
◆ setup_remote_mmap()
Setup remote mmap
@resources [in]: dma_resources @buf [in]: address of remote memory buffer @len [in]: len of remote memory buffer
- Returns
- : DOCA_SUCCESS on success and DOCA_ERROR otherwise
Definition at line 232 of file devemu_pci_device_dma_dpu_sample.c.