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

  • 相关阅读:
    扰动算法(哈希函数)
    ONLYOFFICE 文档 8.1 现已发布:功能全面的 PDF 编辑器、幻灯片版式等等
    Flutter:计数器应用分析
    【C++】容器string的构造函数和迭代器
    HTML简单介绍
    Uniapp软件库源码 全新带勋章功能(包含前后端源码)
    僵尸进程的产生与处理
    【第六章】集合类:List、Iterator迭代器
    【FPGA零基础学习之旅#16】嵌入式块RAM-双口ram的使用
    springboot基于协同过滤算法的书籍推荐毕业设计源码101555
  • 原文地址:https://blog.csdn.net/weixin_42464979/article/details/134425830