转换:
void printIOBufDesc_io(sTIDL_IOBufDesc_t* ioBufDesc) {
FILE *file = fopen("/opt/NetBuf_struct.c", "w");
if (file == NULL) {
printf("printIOBufDescAll() : Error opening file!\n");
return;
}
// 保存为能够直接在代码里赋值的语句
fprintf(file, "static unsigned char binData[] = {");
for (int i = 0; i < sizeof(sTIDL_IOBufDesc_t); i++) {
if (i % 16 == 0) {
fprintf(file, "\n ");
}
fprintf(file, "0x%02X", ((unsigned char *)ioBufDesc)[i]);
if (i != sizeof(sTIDL_IOBufDesc_t) - 1) {
fprintf(file, ", ");
}
}
fprintf(file, "\n};\n");
fclose(file);
}
数组使用:
memcpy(ioBufDesc, binData, sizeof(sTIDL_IOBufDesc_t));
j784s4 tda4vh IPC C7:
数据(由上往下挖):
params[0] = (tivx_obj_desc_t *) tivxObjDescGet( node_obj_desc->base.scope_obj_desc_id );
obj_desc = (tivx_obj_desc_t*)&g_obj_desc_table.table_base[obj_desc_id];
table_info->table_base = gTivxObjDescShmEntry;
retVal = appIpcGetTiovxObjDescSharedMemInfo( (void **) &gTivxObjDescShmEntry, &shmSize);
逻辑:
tivxInit()->tivxInitLocal()->tivxPlatformCreateTargets() "C7 only" ->
tivxTargetCreate()->tivxTargetTaskMain()->tivxTargetCmdDescHandler()->tivxTargetNodeDescNodeCreate()->
tivxTargetKernelCreate( params )->tivxKernelTIDLCreate( ***params*** )->tivxAlgiVisionCreate()->tivxAlgiVisionAllocMem()->
算法结构体使用(上取 下用):
/* IMPORTANT! Config data is assumed to be available at index 0 */
config = (tivx_obj_desc_user_data_object_t *)obj_desc[TIVX_KERNEL_TIDL_IN_CONFIG_IDX];
/* IMPORTANT! Network data is assumed to be available at index 1 */
network = (tivx_obj_desc_user_data_object_t *)obj_desc[TIVX_KERNEL_TIDL_IN_NETWORK_IDX];
memcpy(&tidlObj->tidlParams, config_target_ptr, sizeof(tivxTIDLJ7Params));
tivxTIDLObj->tivxTIDLJ7Params->sTIDL_IOBufDesc_t
memcpy(tidlObj->tidlNet, network_target_ptr, network->mem_size);
sTIDL_Network_t *pNet = (sTIDL_Network_t *)network_target_ptr; // only for checksum
tivxTIDLObj->void* tidlNet