DM8127如何利用EDMA搬移数据

转自:http://www.deyisupport.com/question_answer/dsp_arm/davinci_digital_media_processors/f/39/t/31656.aspx

http://www.deyisupport.com/question_answer/dsp_arm/davinci_digital_media_processors/f/39/t/71448.aspx

http://www.deyisupport.com/question_answer/dsp_arm/c6000_multicore/f/53/t/47961.aspx

 

 

 ccs工具下载:

http://processors.wiki.ti.com/index.php/Download_CCS

 

ezsdk下载链接:

http://software-dl.ti.com/dsps/dsps_public_sw/ezsdk/latest/index_FDS.html

 

dm8148 收藏帖子:

http://blog.csdn.net/zouwen198317/article/category/1291112

 

DAVINCI平台运行JPEG编解码程序:

 转自:http://blog.csdn.net/tufuzi/article/details/5801082

--------------------------------------------------------------------------------

在运行TI的dvsdk(我这边的版本是dvsdk_2_10_00_17)codec的示例代码,具体路径在:

:/opt/dvsdk_2_10_00_17/dm365_codecs_01_00_06/packages/ti/sdo/codecs/

此目录下有h264dec,h264enc,jpegdec,jpegenc,mpeg4dec,mpeg4enc等6个示例。


--------------------------------------------------------------------------------

下面是我运行jpegenc时遇到的问题和解决办法:

# cd jpegenc/

# cd apps/Client/Test/Src

# make clean

# make

编译通过,生成可执行文件:jpgenc-r

然后通过tftp下载到目标板子运行。

root@SEED_DVS365# cd /opt/dm365

root@SEED_DVS365# ./loadmodules.sh

没办法,这里有现成的,先使用着,然后回到jpgenc-r,开始运行:

root@SEED_DVS365# cd /opt/test/

root@SEED_DVS365# ./jpgenc-r

出现错误如下:

./jpgenc-r: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory


--------------------------------------------------------------------------------

没有libstdc++.so.6这个库:

root@SEED_DVS365# cd /usr/lib

root@SEED_DVS365# ls

确实没有libstdc++.so.6这个库,于是首先想到去linux主机上把这个库下载下去:

# cd /usr/lib

# ls -l libstdc*

lrwxrwxrwx 1 root root     18 2010-06-25 20:04 libstdc++.so.6 -> libstdc++.so.6.0.8

-rwxr-xr-x 1 root root 912700 2008-04-22 07:15 libstdc++.so.6.0.8

把libstdc++.so.6.0.8通过tftp下载到板子上,并使用软连接:

root@SEED_DVS365# cd /usr/lib

root@SEED_DVS365# tftp -g -r libstdc++.so.6.0.8 192.168.1.109

root@SEED_DVS365# ln -sf libstdc++.so.6.0.8 libstdc++.so.6

现在,应该是有libstdc++.so.6这个库了,回去运行:

root@SEED_DVS365# cd /opt/test/

root@SEED_DVS365# ./jpgenc-r

依然是找不到。。。


--------------------------------------------------------------------------------

一时也没想出怎么回事?Google了一阵,猛然发觉,这个是arm板子,需要交叉编译之后的库才能运行。OMG

# cd /opt/mv_pro_5.0

# find -name libstdc++.so.6

./montavista/pro/devkit/arm/v5t_le/target/usr/lib/libstdc++.so.6

于是,再次把此库下载下去。

再运行,成功了。。。


--------------------------------------------------------------------------------

下面是另外的错误:

RMAN initialization done

VICP Protocol Registration Success

EDMA3 Protocol Registration Success

 

----- Running in base parameter mode -----

Couldn't open parameter file ../TestVecs/Config/Testvecs.cfg
 

很明显,错误提示是:缺少TestVecs目录下的文件。

于是把Client整个文件夹拷贝到U盘,然后把U盘插入开发板,挂载:

root@SEED_DVS365# fdisk -l /dev/sda

root@SEED_DVS365# mount -t vfat /dev/sda1 /mnt/usb

root@SEED_DVS365# cd /mnt/usb

root@SEED_DVS365# cd Client/Test/Src

root@SEED_DVS365# ./jpgenc-r

可能是文件系统不匹配的关系,不能正确读写U盘。

 

所以把必要的文件拷贝到板子上,结构如下:

==========================================================

jpgenc

|- jpgenc-r

|- TestVecs

   |- Config

   |   |- Testparams.cfg

   |   |- Testvecs.cfg

   |- Input

   |   |- 352x288_fruitbasket-cif-420.yuv

   |- Output

       |- dummy.txt

==========================================================

再次运行:

root@SEED_DVS365# ./jpgenc-r

成功,结果如下:

RMAN initialization done

VICP Protocol Registration Success

EDMA3 Protocol Registration Success

 

----- Running in base parameter mode -----

 

Testcompliance = 0

 

Param file = ./TestVecs/Config/Testparams.cfg

 

Input file = ./TestVecs/Input/352x288_fruitbasket-cif-420.yuv

 

Output file = ./TestVecs/Output/352x288_fruitbasket-cif.jpg

 

*******************************************

Read Configuration Set 1

*******************************************

Parameter file read starts...

 

Parameter Name 'rstInterval' not recognized..

Syntax Error in ./TestVecs/Config/Testparams.cfg

 Exiting for this configuration...

EDMA3 Unregister Protocol Success

VICP Unregister Protocol : Sucess

RMAN Exit Done

 

 End of execution
 

但是,还是有错误的,参数rstInterval不认可


--------------------------------------------------------------------------------

回去看相关文档,即: JPEG_Encoder_DM365_UserGuide.pdf

里面原话:

==========================================================

Change the directory to Client/Test/Src folder and execute the

following command to run the JPEG encoder executable:

$./jpgenc-r

This will run the JPEG encoder with base parameters. To run the JPEG

Encoder with extended parameters execute the following command:

$./jpgenc-r –ext

==========================================================

再次运行:

root@SEED_DVS365# ./jpgenc-r -ext

成功,结果如下:

RMAN initialization done

VICP Protocol Registration Success

EDMA3 Protocol Registration Success

 

----- Running in extended parameter mode -----

 

Testcompliance = 0

 

Param file = ./TestVecs/Config/Testparams.cfg

 

Input file = ./TestVecs/Input/352x288_fruitbasket-cif-420.yuv

 

Output file = ./TestVecs/Output/352x288_fruitbasket-cif.jpg

 

*******************************************

Read Configuration Set 1

*******************************************

Parameter file read starts...

 

Running in Output Dump Mode

Algorithm Instance Creation Done...

Number of Input bufs =3

Input file read starts

number of bytes read from input file = 101376

number of bytes read from input file = 25344

number of bytes read from input file = 25344

bytesGenerated = 60950

EDMA3 Unregister Protocol Success

VICP Unregister Protocol : Sucess

RMAN Exit Done

 

 End of execution
 

进入Output查看是否有jpg图片生成,并上传到Linux服务器:

root@SEED_DVS365# cd /jpgenc/TestVecs/Output/

root@SEED_DVS365# ls -l

-rw-r--r--    1 root     root        60950 Jan  1 01:32 352x288_fruitbasket-cif.jpg

root@SEED_DVS365# tftp -p -l 352x288_fruitbasket-cif.jpg 192.168.1.109

注意:tftp上传时,需要Linux服务器/tftpboot目录下有相同名字的文件存在

即存在:352x288_fruitbasket-cif.jpg(没有就新建一个)

# touch 352x288_fruitbasket-cif.jpg

然后要确保操作权限,除了root用户之外的也能写:

# chmod 766 352x288_fruitbasket-cif.jpg

(这个确实不好用!)

然后在PC上打开,查看是否正确。


--------------------------------------------------------------------------------

按照上面的方法,进行jpgdec的演示:

root@SEED_DVS365# ./jpgdec-r

出错,如下:

CMEMK Error: Failed to find a pool which fits 3686400

CMEM Error: getPCMEMK Error: Failed to find a pool which fits 3686400

ool: Failed to get a pool fitting a size 3686400

CMEM Error: getPool: Failed to get a pool fitting a size 3686400

Segmentation fault
 

 

是内存方面出错,貌似没有大小为3686400的连续内存块,查看loadmodule.sh

==========================================================

# Pools configuration

insmod cmemk.ko phys_start=0x85000000 phys_end=0x88000000 pools=6x4096,2x8192,1x11908,2x13184,1x2697152,6x4096,1x30720,3x81920,1x3185664,64x56,1x320,1x640,1x81920,1x6650880,2x608,1x296,1x28,2x24,23x1548288,1x154288 allowOverlap=1 phys_start_1=0x00001000 phys_end_1=0x00008000 pools_1=1x28672

==========================================================

现在的内存是128M的,其中uBoot配置Linux启动参数时,分配给Linux的内存为80M,

则剩下为48M,从0x85000000到0x88000000,刚好是48M

所以我认为:Linux操作系统占了80M,给应用程序的内存只有48M

再看目前的pool,加起来已经有48,766,952,即剩余1,564,696,不够3,686,400

所以不能在后面直接添加“1x3686400”

需要重新配置Linux的内存大小,重新设置uBoot中的启动参数:

setenv bootargs mem=64M console=ttyS0,115200n8 noinitrd rw ip=192.168.1.144:255.255.255.0:192.168.1.254 root=/dev/mtdblock3 rootfstype=yaffs video=davincifb:osd0=720x576x16,4050K dm365_imp.oper_mode=0 davinci_capture.device_type=4

saveenv

boot

(以上操作可参考:http://blog.csdn.net/talent258/archive/2010/06/28/5699971.aspx)


--------------------------------------------------------------------------------

然后再修改loadmodule.sh,如下:

==========================================================

# Pools configuration

insmod cmemk.ko phys_start=0x84000000 phys_end=0x88000000 pools=6x4096,2x8192,1x11908,2x13184,1x2697152,6x4096,1x30720,3x81920,1x3185664,64x56,1x320,1x640,1x81920,1x6650880,2x608,1x296,1x28,2x24,23x1548288,1x154288,1x3686400 allowOverlap=1 phys_start_1=0x00001000 phys_end_1=0x00008000 pools_1=1x28672

==========================================================

通过tftp把它下载下去,重新运行:

root@SEED_DVS365# ./loadmodule.sh

root@SEED_DVS365# ./jpgdec-r

还是出现错误,如下:

==========================================================

CMEMK Error: Failed to find a pool which fits 3686400

CMEM Error: getPool: Failed to get a pool fitting a size 3686400

Segmentation fault

==========================================================

和之前的错误相比,好像少了一点了。。。

试着分配2块3686400的pool,(把“1x3686400”改为“2x3686400”)

重新下载下去

然后运行

。。。

这个问题算是解决了。

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/talent258/archive/2010/07/10/5725720.aspx

 

 

你可能感兴趣的:(DM8127如何利用EDMA搬移数据)