准备散列读地址 - DmaScatterPrepare
函数简介
为散列读准备一个内存地址和大小。可以多次调用以准备多个地址。(高级版功能,普通版无法使用)
接口名称
DmaScatterPrepare
DLL调用
int32_t OLA_CALL_TYPE DmaScatterPrepare(int64_t instance, int64_t scatterHandle, int64_t address, int32_t size);
参数定义:
instance(长整型数): OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。scatterHandle(长整型数): 散列句柄,由 DmaScatterCreate 返回address(长整型数): 内存地址size(整型数): 读取大小(字节)
示例:
// 创建散列读句柄
int64_t scatterHandle = DmaScatterCreate(instance, deviceId, 1234);
// 准备多个地址
int32_t result1 = DmaScatterPrepare(instance, scatterHandle, 0x400000, 4);
int32_t result2 = DmaScatterPrepare(instance, scatterHandle, 0x400010, 8);
int32_t result3 = DmaScatterPrepare(instance, scatterHandle, 0x400020, 4);
if (result1 == 1 && result2 == 1 && result3 == 1) {
printf("所有地址准备成功\n");
// 执行散列读
DmaScatterExecute(instance, scatterHandle);
} else {
printf("地址准备失败\n");
}
返回值
整型数:
- 1: 成功
- 0: 失败
参数说明
address(地址):
- 要读取的内存地址
- 必须是有效的进程内存地址
size(大小):
- 要读取的字节数
- 通常为 1、2、4、8 等
应用场景
- 批量准备多个读取地址
- 提高内存读取效率
- 一次性读取多个数据
相关接口
- DmaScatterCreate - 创建散列读句柄
- DmaScatterExecute - 执行散列读
- DmaScatterRead - 从散列读结果中读取数据
