DSP

DSPLink环境

2019-07-13 20:23发布

CE、XDC、BIOS、DSPLink、FC、CMEM这些Davinci的高级玩意儿真的只能在Linux字符界面下封装算法、配置、编译、链接、调试……?据说DSPLink也是可以profile的。不过连一份系统点儿的API手册还没发现,高级玩意儿还是慢慢看吧~   现在就是不会用DSPLink看DSP端的log、trace,配置了BIOS也不知道到底管不管用。不过之前对DSPLink模块和例程的编译过程总算告一段落了,希望算是做了点儿有用的工作:   1. 环境变量 vi etc/host/scripts/Linux/dsplinkenv.bash -> export DSPLINK=/opt/dvevm_1_10/dsplink_1_30_08_02/packages/dsplink   vi ~/bin/dsplk -> source /opt/dvevm_1_10/dsplink_1_30_08_02/packages/dsplink/etc/host/scripts/Linux/dsplinkenv.bash   chmod u+x ~/bin/dsplk . dsplk /**** 用“.”或“source”执行的shell脚本运行在当前进程;否则运行在子shell进程里,无法修改当前shell的环境变量 ****/   2. GPP工具路径 vi make/Linux/davinci_mvlpro4.0.mk -> BASE_BUILDOS    := /opt/mv_pro_4.0/montavista/pro/devkit/lsp/ti-davinci BASE_CGTOOLS    := /opt/mv_pro_4.0/montavista/pro/devkit/arm/v5t_le/bin OSINC_PLATFORM := /opt/mv_pro_4.0/montavista/pro/devkit/arm/v5t_le/lib/gcc/armv5tl-montavista-linuxeabi/3.4.3/include OSINC_TARGET    := /opt/mv_pro_4.0/montavista/pro/devkit/arm/v5t_le/target/usr/include BASE_OSLIB      := /opt/mv_pro_4.0/montavista/pro/devkit/arm/v5t_le/lib   3. DSP工具路径 vi make/DspBios/c64xxp_5.xx_linux.mk -> BASE_INSTALL    := /opt XDCTOOLS_DIR    := /opt/dvevm_1_10/xdctools_1_21 BASE_CGTOOLS    := /opt/TI/cg6x_6_0_14   4. DSP/BIOS内存配置 cd dsp/inc/DspBios/Davinci cp dsplink-davinci-base.tci.256MB dsplink-davinci-base.tci /**** 由sample的tcf引用,不影响模块本身 ****/   5. DSPLink内存配置 vi config/all/CFG_Davinci.TXT /**** 应与DSP内存配置保持一致,但不知有何实际用途 ****/   6. DSPLink模块配置文件 vi config/CURRENTCFG.MK /**** 由dsplinkcfg生成 ****/   7. 编译脚本 #!/bin/sh . dsplk if [ "$1" = "dsp" -o "$1" = "gpp" ] then     if [ "$2" = "-m" ]     then         source etc/host/scripts/Linux/dsplinkcfg         cd ${DSPLINK}/$1/src/         make clean         make -s     fi     cd ${DSPLINK}/$1/src/samples     #make clean     make -s else     cd ${DSPLINK}/package/ti/dsplink/dsp/DspBios/Davinci/RELEASE/     scp *.out root@192.168.0.66:dsplink/     cd ${DSPLINK}/package/ti/dsplink/gpp/Linux/Davinci/RELEASE     scp dsplinkk.ko *gpp root@192.168.0.66:dsplink/     cd ${DSPLINK} fi   8. 卸载、加载模块的顺序 rm -f /dev/dsplink rmmod dsplinkk insmod dsplinkk.ko mknod /dev/dsplink c 230   0 /**** 若先rmmod后rm设备节点,模块会崩溃,并且无法卸载 ****/   9. 增加GPP组件 vi gpp/src/samples/net/Linux/COMPONENT -> ## 生成目标文件 ## COMP_NAME       := NET COMP_PATH       := $(GPPROOT)$(DIRSEP)src$(DIRSEP)samples$(DIRSEP)net COMP_TYPE       := EXE COMP_TARGET     := netgpp COMP_MEMSPACE   := USER ## 导出目标文件 ## EXP_TARGETS     := netgpp   vi gpp/src/samples/DIRS -> DIRS += net   10.增加DSP组件 vi dsp/src/samples/net/DspBios/COMPONENT -> ## 生成目标文件 ## COMP_NAME       := NET COMP_PATH       := $(DSPROOT)$(DIRSEP)src$(DIRSEP)samples$(DIRSEP)net COMP_TYPE       := EXE COMP_TARGET     := net.out ## 导出目标文件 ## EXP_TARGETS     := net.out   vi dsp/src/samples/DIRS -> DIRS += net     11.GPP端加入源文件(以自定义的UDP打包函数为例) cp /media/win/Projects/examples/udplib/udplib.cpp gpp/src/samples/net/Linux/udplib.c cp /media/win/Projects/examples/udplib/udplib.h gpp/src/samples/net/Linux/udplib.h   vi gpp/src/samples/net/Linux/COMPONENT -> EXP_HEADERS     := loop.h                 Linux/loop_os.h        Linux/udplib.h vi gpp/src/samples/net/Linux/SOURCES -> SOURCES := loop_os.c                udplib.c                main.c   12.CHNL驱动之ARM篇 EXPORT_API DSP_STATUS CHNL_AllocateBuffer (IN ProcessorId procId,                      IN ChannelId   chnlId,                      OUT Char8 **    bufArray,                      IN Uint32      size,                      IN Uint32      numBufs) ;   EXPORT_API DSP_STATUS CHNL_Issue (IN ProcessorId      procId,             IN ChannelId        chnlId,             IN ChannelIOInfo * ioReq) ;   EXPORT_API DSP_STATUS CHNL_Reclaim (IN     ProcessorId       procId,               IN     ChannelId         chnlId,               IN     Uint32            timeout,               IN OUT ChannelIOInfo *   ioReq) ; /**** 与DSP端使用GIO还是SIO无关 ****/   13.CHNL驱动之GIO篇 #define DSPLINK_alloc(poolId, bufPtr, size)                             (((POOL->allocators [poolId]).fxns->alloc)                              (POOL->allocators [poolId].object,                               bufPtr,                                                         size))   vi dsp/src/samples/net/swiLoop.c -> void switx(Arg arg0, Arg arg1) { SWILOOP_TransferInfo * info = (SWILOOP_TransferInfo *) arg0;   (Void) arg1 ; /* To remove compiler warning */   GIO_submit (info->gioOutputChan, IOM_WRITE, info->outputBuffer, (size_t *) &(info->bufferSize), &(info->appWriteCb)) ; } /**** 异步GIO能用于SWI ****/   14.CHNL驱动之SIO篇 #define DSPLINK_alloc(poolId, bufPtr, size)                             (((POOL->allocators [poolId]).fxns->alloc)                              (POOL->allocators [poolId].object,                               bufPtr,                                                          size))   vi dsp/src/samples/net/tskLoop.c -> void tsktx(TSKLOOP_TransferInfo * info){ Arg arg = 0 ;   SIO_issue(info->outputStream, info->buffers [0], info->bufferSize, arg); SIO_reclaim (info->outputStream, (Ptr *) &(info->buffers [0]), &arg) ; } /**** 同步SIO只能用于TSK ****/ /**** 包含SIO的TSK可同步地执行算法,相当于CE中调用process函数 ****/   15.Issue/Reclaim模型 /**** Put/Get模型会自动分配内置交换缓冲,Issue/Reclaim不会 ****/ /**** Issue 不论收/发,向CHNL的另一端传入指针,非阻塞 ****/ /**** Reclaim 不论收/发,从CHNL的另一端传出指针,I/O阻塞 ****/ /**** Issue与Reclaim一起使用,可达到Put或Get的效果 ****/ /**** Issue与Reclaim分开使用,可提供一定的缓冲深度 ****/   16.Tconf vi dsp/src/samples/net/loop.tci -> var tsk0 = bios.TSK.create("tsk0"); tsk0.fxn = prog.extern("tskLoop");   var swi0 = bios.SWI.create("swi0"); swi0.fxn = prog.extern("switx"); swi0.arg0 = prog.extern("info");   vi dsp/src/samples/net/swiLoop.c -> extern far SWI_Obj swi0; SWI_post(&swi0);   /**** 在tci里面添加模块比在程序中调用API动态添加更方便,而且对程序结构的简化也很有帮助 ****/ /**** BIOS模块和API相关内容参考TI文档 ****/ /**** typedef struct SWI_Obj SWI_Handle; ****/ /**** loop.tci由dsp/src/samples/net/DspBios/Davinci/loop.tcf引用 ****/

热门文章