gf_ai_box/include/fake/vmf/vector_dma.h
2026-04-12 17:47:54 +08:00

53 lines
1.8 KiB
C

#ifndef VMF_VECTOR_DMA_H
#define VMF_VECTOR_DMA_H
#include <stdint.h>
/* Opaque DMA handles */
typedef struct VMF_DMA_HANDLE_S VMF_DMA_HANDLE_T;
typedef struct VMF_DMA_DESCRIPTOR_S VMF_DMA_DESCRIPTOR_T;
/* MemBroker alignment type enum: ALIGN_TYPE_32_BYTE = 5 (not the byte value) */
#define VMF_ALIGN_TYPE_DEFAULT 5u
/* DMA descriptor type enum */
typedef enum {
DMA_1D = 0,
DMA_2D = 1,
} VMF_DMA_TYPE_E;
/* 2D copy filter init struct */
typedef struct {
uint32_t dwProcessCbCr; /* 1 = process chroma plane */
uint32_t dwSrcFormatFlag; /* source pixel format flag */
uint32_t dwReserved[6];
} VMF_DMA_2DCF_INIT_T;
/* DMA address / copy parameters */
typedef struct {
uint32_t dwCopyWidth;
uint32_t dwCopyHeight;
unsigned char *pbySrcYPhysAddr;
unsigned char *pbySrcCbPhysAddr;
unsigned char *pbySrcCrPhysAddr;
unsigned char *pbyDstYPhysAddr;
unsigned char *pbyDstCbPhysAddr;
unsigned char *pbyDstCrPhysAddr;
uint32_t dwSrcStride;
uint32_t dwDstStride;
uint32_t _pad[4];
} VMF_DMA_ADDR_T;
/* DMA API */
VMF_DMA_HANDLE_T *VMF_DMA_Init(uint32_t ch_id, uint32_t queue_depth);
void VMF_DMA_Release(VMF_DMA_HANDLE_T *handle);
VMF_DMA_DESCRIPTOR_T *VMF_DMA_Descriptor_Create(VMF_DMA_TYPE_E type, void *init_param);
void VMF_DMA_Descriptor_Destroy(VMF_DMA_DESCRIPTOR_T *desc);
int VMF_DMA_Copy(VMF_DMA_HANDLE_T *handle, VMF_DMA_DESCRIPTOR_T *desc,
void *dst, void *src, uint32_t size);
int VMF_DMA_Descriptor_Update_Addr(VMF_DMA_DESCRIPTOR_T *desc, VMF_DMA_ADDR_T *addr);
int VMF_DMA_Setup(VMF_DMA_HANDLE_T *handle, VMF_DMA_DESCRIPTOR_T **descs, uint32_t count);
int VMF_DMA_Process(VMF_DMA_HANDLE_T *handle);
#endif /* VMF_VECTOR_DMA_H */