纯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:

数据(由上往下挖):

params0 = (tivx_obj_desc_t *) tivxObjDescGet( node_obj_desc->base.scope_obj_desc_id );

obj_desc = (tivx_obj_desc_t*)&g_obj_desc_table.table_baseobj_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_descTIVX_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_descTIVX_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

相关推荐
稚南城才子,乌衣巷风流6 分钟前
ST 表(Sparse Table)算法详解:原理、实现与应用
算法
hold?fish:palm12 分钟前
9 找到字符串中所有字母异位词
c++·算法·leetcode
小大宇18 分钟前
python flask框架 SSE流式返回、跨域、报错
开发语言·python·flask
Sw1zzle39 分钟前
算法入门(六):贪心算法 - 基础入门(Leetcode 121/455/860/376/738)
算法·leetcode·贪心算法
青山木1 小时前
Hot 100 --- 岛屿数量
java·数据结构·算法·leetcode·深度优先·广度优先
柒星栈1 小时前
PHP 源码怎么加密防破解?三套方案实战指南
开发语言·php·android studio
不会就选b1 小时前
算法日常・每日刷题--<归并排序>1
数据结构·算法
勉灬之1 小时前
Next.js + Prisma 跨平台部署踩坑记
开发语言·javascript·ecmascript
危桥带雨1 小时前
排序算法(快排、归并、计数、基数排序)
数据结构·算法·排序算法