DM8127如何利用EDMA搬移資料

smilestone322發表於2015-07-28

轉自: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

 

 

相關文章