纯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

相关推荐
virus59451 小时前
悟空CRM mybatis-3.5.3-mapper.dtd错误解决方案
java·开发语言·mybatis
一匹电信狗1 小时前
【LeetCode_547_990】并查集的应用——省份数量 + 等式方程的可满足性
c++·算法·leetcode·职场和发展·stl
初次见面我叫泰隆1 小时前
Qt——3、常用控件
开发语言·qt·客户端
鱼跃鹰飞2 小时前
Leetcode会员尊享100题:270.最接近的二叉树值
数据结构·算法·leetcode
无小道2 小时前
Qt——QWidget
开发语言·qt
时艰.2 小时前
Java 并发编程之 CAS 与 Atomic 原子操作类
java·开发语言
梵刹古音3 小时前
【C语言】 函数基础与定义
c语言·开发语言·算法
筵陌3 小时前
算法:模拟
算法
梵刹古音3 小时前
【C语言】 结构化编程与选择结构
c语言·开发语言·嵌入式
Yvonne爱编码3 小时前
JAVA数据结构 DAY3-List接口
java·开发语言·windows·python