DSP

DAVINCI cmem模块

2019-07-13 15:41发布

 模块cmemk.ko为ARM和DSP通信提供连续的内存,装载的格式为: insmod cmemk.ko       pools=4x30000, 2x500000   phys_start=0x0   phys_end=0x3000000      pools_1=4x65536    phys_start_1=0x80000000 phys_end_1=0x80010000 表明1、在内存0x0~0x2ffffff上开辟了两个内存池,第一个由4个30000字节得缓存组成,第二个由2个500000字节的缓存组成。2、在内存 0x80000000~0x8000ffff上开辟了一个由4个65536字节缓存组成的内存池。(注:低版本的cmem只支持一块内存)按照Davinci内存的划分,cmem的内存空间位于linux内存和DSP算法使用的内存之间,在dvsdk2.0中cmem内存空间为118~128M(低版本的dvsdk为120~128M,不过低版本的dvsdk的DSP server程序128M之后的很大一块也没有使用,cmem大一点也没事,不过2.0中DSP server程序内存使用从128M开始) dvsdk2.0中,cmem模块目录为: [root@localhost cmem]# pwd /opt/dvsdk_2_00_00_22/linuxutils_2_23_01/packages/ti/sdo/linuxutils/cmem [root@localhost cmem]# tree . -- CMEM.xdc                                                   -- Makefile                                                   -- Rules.make                                                   -- apps                                                       -- Makefile                                                       -- apitest |                                                                 -- Makefile                                                                 -- apitest.c                                                        -- insmod_rmmod                                                                  -- Makefile                                                                 -- insmod_rmmod.sh                                                                  -- insmod_rmmod_omapL137.sh                                                          -- multi_process                                                                   -- Makefile                                                                   -- multi_process.c                                                           -- translate                                                                   -- Makefile                                                                   -- translate.c                                                      -- include                                                              -- cmem.h                                                      -- lib                                                              -- cmem.a470MV                                                      -- package                                                               -- build.cfg                                                               -- package.bld.xml                                                               -- package.defs.h                                                               -- package.doc.xml                                                               -- package.ext.xml                                                               -- package.rel.dot                                                                -- package.rel.xml                                                                -- package_ti.sdo.linuxutils.cmem.c                                                                -- ti.sdo.linuxutils.cmem.ccs                                                                  -- ti.sdo.linuxutils.cmem.sch                                                                 -- package.xdc                                                                -- package.xs                                                                    -- readme.txt                                                           -- src                                                                  -- Makefile                                                                 -- interface                                                                        -- Makefile                                                                        -- cmem.c                                                                        -- cmem.h                                                                        -- release                                                                                  -- cmem.o470MV                                                                    -- module                                                                        -- Makefile                                                                        -- Module.symvers                                                                        -- cmemk.c                                                                         -- cmemk.ko                                                                        -- cmemk.mod.c                                                                         -- cmemk.mod.o                                                                         -- cmemk.o 12 directories, 40 files [root@localhost cmem]# cmem提供的接口在demo中没有出现,而是被中间件进行了封装。dvsdk1.3中内存的分配使用了CEOSAL包中Memory模块的 Memory_contigAlloc()函数,dvsdk2.0的demo使用了DMAI模块(在CE基础上进一步进行了封装)。 CMEM是一个连续物理存储空间分配模块,使得ARM端Linux进程和DSP端算法之间能够共享缓冲区应用程序需要在共享缓存区动态申请一个连续的物理空间时,通过调用CMEM的API可以实现,申请得到的空间可以供DSP端访问进行算法处理时数据的传递与处理。在DVSDK中集成了CMEM模块,CMEM模块安装在Linux服务器下的路径为:/opt/dvevm_1_20/cmem_1_02在Linux服务器的控制台下,需进行如下操作实现编译:Host # cd /opt/dvevm_1_20/cmem_1_02/packages/ti/sdo/linuxutils/cmemHost # make allHost #make install运行后,即对cmem模块进行了编译,编译文件为在目录src/module下生成的cmem.ko模块,并将cmem.ko和测试文件安装到了目标板的/opt/nfs/opt/dvsdemos目录下。DVSDK中的CMEM Demo提供了测试程序:apitest能够测试CMEM的API功能,translate能够测试虚拟地址与实物理地址之间的转换功能.