纯c语言 算法bin文件转换为数组

转换:

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

相关推荐
孤飞2 小时前
zero2Agent:面向大厂面试的 Agent 工程教程,从概念到生产的完整学习路线
算法
技术专家3 小时前
Stable Diffusion系列的详细讨论 / Detailed Discussion of the Stable Diffusion Series
人工智能·python·算法·推荐算法·1024程序员节
csdn_aspnet4 小时前
C# (QuickSort using Random Pivoting)使用随机枢轴的快速排序
数据结构·算法·c#·排序算法
以神为界4 小时前
Python入门实操:基础语法+爬虫入门+模块使用全指南
开发语言·网络·爬虫·python·安全·web
鹿角片ljp4 小时前
最长回文子串(LeetCode 5)详解
算法·leetcode·职场和发展
逻辑驱动的ken5 小时前
Java高频面试题:03
java·开发语言·面试·求职招聘·春招
噜噜大王_5 小时前
深入理解 C 语言内存操作函数:memcpy、memmove、memset、memcmp
c语言·开发语言
广师大-Wzx5 小时前
一篇文章看懂MySQL数据库(下)
java·开发语言·数据结构·数据库·windows·python·mysql
野生技术架构师5 小时前
Java NIO到底是个什么东西?
java·开发语言·nio
lolo大魔王6 小时前
Go语言的异常处理
开发语言·后端·golang