搞了一段很長的時間終於把DSP功能弄起來了,該是回頭紀錄一下"眉角"了.
1.Before touch anything
目前有兩種方式可以控制DSP,一個是TI DVSDK提供的DSPLINK,另一個則是DSPBRIDGE.
以我從google搜尋之後的了解DSPBRIDGE目前是沒有繼續maintain.
DSPLINK是TI比較建議的方式.
所搭配的media library為
DSPLINK + gstreamer
DSPBRIDGE + openmax + gstreamer
http://felipec.wordpress.com/2009/10/13/new-project-gst-dsp-with-beagleboard-demo-image/
http://felipec.wordpress.com/2008/12/12/gst-openmax-demo-on-the-beagleboard/
這邊我選擇DSPLINK控制DSP
2.Software
dvsdk_3_00_02_44
gst-ti-plugin-full-1.00.02
gst-omapfb
Build and install to target root file system (過程就省略了)
可參考以下作法
http://ossie.wireless.vt.edu/trac/wiki/BeagleBoard_CodecEngine
安裝目錄
DVSDK : /opt/dvsdk
gstreamer : /opt
3.Setup
DSPLINK透過share memory的方式跟DSP交換資料所以有另一個driver叫cmemk.ko負責建立memory pool. 但這塊memory必須脫離kernel的掌控因此必須要空出一塊memory讓cmemk.ko使用.至於大小要看實際memory size跟DSP所需要的size來決定.
http://pixhawk.ethz.ch/wiki/tutorials/omap/dsplink/memorymap
依照以上說明修改以下檔案
dsplink_1_61_03/packages/dsplink/config/all/CFG_OMAP3530_SHMEM.c
dsplink_1_61_03/packages/dsplink/dsp/inc/DspBios/5.XX/OMAP3530/dsplink-omap3530-base.tci
dsplink_1_61_03/packages/dsplink/config/all/CFG_OMAP3530_SHMEM.c
我的target board有256MB DDR,因此記憶體配置如下
# 0x40200000 60 KB CMEM (internal memory, see comment below)
# 0x80000000 200 MB Linux
# 0x8C900000 16 MB CMEM (external memory)
# 0x8D900000 2 MB DSPLINK (MEM)
# 0x8DB00000 unused
kernel boot command 加上 mem=200M
For kernel 2.6.27
optargs=init=/init omapfb.video_mode=1280x1024MR-16@60 vram=12M omapfb.vram=4M,4M,4M omapfb.debug=1 omap-dss.def_disp=lcd omap-dss.debug=1 mem=200M
For kernel 2.6.29
setenv optargs 'init=/init omapdss.def_disp=dvi omapfb.mode=dvi:1280x1024MR-16@60 vram=12M omapfb.vram=0:4M,1:4M,2:4M mem=200M'
memory pool配置如下
insmod cmemk.ko phys_start=0x8C900000 phys_end=0x8D900000 pools=20x4096,10x131072,2x1048576,1x5250000,4x829440,2x691200
gstreamer需要設定target上的環境變數好讓系統找的到執行檔及plug-in
export PATH=$PATH:/opt/gstreamer/bin
export GST_PLUGIN_PATH=/opt/gstreamer/lib/gstreamer-0.10
export LD_LIBRARY_PATH=/opt/gstreamer/lib
3.Get DSP work
載入drivers
#cd /opt/dvsdk
#./loadmodules.sh
CMEMK module: built on Oct 30 2009 at 20:23:52
Reference Linux version 2.6.28
File /home/gigijoe/OMAP3530/dvsdk_3_00_02_44/linuxutils_2_24_02/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.c
ioremap_nocache(0x8c900000, 16777216)=0xcf000000
allocated heap buffer 0xcf000000 of size 0x32c000
cmem initialized 6 pools between 0x8c900000 and 0x8d900000
DSPLINK Module (1.61.03) created on Date: Oct 30 2009 Time: 20:20:31
# lsmod
lpm_omap3530 8276 0 - Live 0xbf02c000
dsplinkk 114052 1 lpm_omap3530, Live 0xbf00b000
cmemk 24428 0 - Live 0xbf000000
測試omapfb, 應該會在畫面上看到彩色條紋.
gst-launch videotestsrc num-buffers=1000 ! omapfbsink
播放TI h.264 raw data sample
gst-launch --gst-debug-level=1 filesrc location="/media/dcim/100andro/ntsc.264" ! typefind ! TIViddec2 ! omapfbsink
Play avi file
gst-launch --gst-debug-no-color --gst-debug=TI*:2 filesrc location=/media/dcim/100andro/aris.mpeg ! typefind ! qtdemux name=demux demux.audio_00 ! queue max-size-buffers=8000 max-size-time=0 max-size-bytes=0 ! typefind ! TIAuddec1 ! audioconvert ! osssink demux.video_00 ! typefind ! TIViddec2 ! omapfbsink
Play mpeg4 file
gst-launch --gst-debug-no-color --gst-debug=TI*:2 filesrc location=/media/dcim/100andro/KenBlock-TopGear.mp4 ! typefind ! qtdemux name=demux demux.audio_00 ! queue max-size-buffers=8000 max-size-time=0 max-size-bytes=0 ! typefind ! TIAuddec1 ! audioconvert ! osssink demux.video_00 ! typefind ! TIViddec2 ! omapfbsink
Play H.264 mpeg4 file without mp3 audio
gst-launch filesrc location=/media/dcim/100andro/sany0014.mp4 ! typefind ! qtdemux name=demux demux.video_00 ! typefind ! TIViddec2 ! omapfbsink
4.Debug
http://tiexpressdsp.com/wiki/index.php?title=Debugging_DSPLink_using_SET_FAILURE_REASON_prints
http://tiexpressdsp.com/index.php/Enabling_trace_in_DSPLink
一開始有一段時間kernel-2.6.29 DSP_init總是失敗
# ./messagegpp ./message.out 1000
========== Sample Application : Failure [0x8000800b] in [0x401] at line 522
MESSAGE ==========
Entered MESSFailure [0x8000802d] in [0x401] at line 544
AGE_Create ()
Failure [0x8000802d] in [0x401] at line 544
Failure [0x8000802d] in [0x401] at line 544
ISR_Install:445
request_irq 28
request_irq failed with error: -16
Failure [0x80008008] in [0x502] at line 459
Failure [0x80008008] in [0x80a] at line 824
Failure [0x80008008] in [0x80a] at line 1061
Failure [0x80008008] in [0x801] at line 597
Failure [0x80008008] in [0x701] at line 370
DSP_init status [0x80008008]
Assertion failed ((isrObj!= NULL) && (ISR_InstalledIsrs [isrObj->dspId][isrObj->irq] == isrObj)). File : /home/gigijoe/OMAP3530/dvsdk_3_00_02_44/dsplink_1_61_03/packages/dsplink/gp
p/src/../../gpp/src/osal/Linux/2.6.18/isr.c Line : 507
Failure [0x80008000] in [0x502] at line 515
Failure [0x80008008] in [0x300] at line 476
Failure [0x80008008] in [0x300] at line 563
PROC_attach () failed. Status = [0x80008008]
PROC_setup () failed. Status = [0x80008008]
Leaving MESSAGE_Create ()
Entered MESSAGE_Delete ()
Assertion failed (IS_VALID_MSGQ (msgqQueue)). File : msgq.c Line : 484
MSGQ_release () failed. Status = [0x8000800b]
Assertion failed (IS_VALID_MSGQ (msgqQueue)). File : msgq.c Line : 335
Leaving MESSAGE_Delete ()
====================================================
Trace DSPLINK driver發現request_irq 28 居然失敗了.很明顯IRQ被佔據了.
看看到底是誰
cat /proc/interrupts
CPU0
11: 0 INTC prcm
12: 1 INTC DMA
18: 0 INTC sr1
19: 0 INTC sr2
24: 0 INTC omap-iommu.1, Omap 3 Camera ISP
25: 1 INTC OMAP DSS
28: 0 INTC omap-iommu.2
56: 347 INTC i2c_omap
61: 0 INTC i2c_omap
72: 1 INTC serial idle
73: 1 INTC serial idle
74: 94 INTC serial idle, serial
77: 0 INTC ehci_hcd:usb2
83: 0 INTC mmc0
86: 14 INTC mmc1
92: 0 INTC musb_hdrc
93: 0 INTC musb_hdrc
95: 641 INTC gp timer
160: 0 GPIO mmc1
167: 0 GPIO user
181: 8 GPIO eth0
378: 0 twl4030 twl4030_usb
379: 0 twl4030 rtc0
384: 0 twl4030 mmc0
原來是iommu啊,OK,調整一下kernel config
Disable
Device Drivers->Multimedia Devices->Video Capture Adapters->OMAP 3 Camera Support
System Type->TI OMAP Implemenation->IOMMU Support
這樣就OK囉
其實還有一些疑慮沒有解決.
IOMMU 以 Shared IRQ 方式 request_irq而DSPLINK Driver request_irq 並不是.
因此造成問題,DSPLINK Driver是否應該以Shared IRQ方式request_irq呢?
Problem :
# gst-launch --gst-debug=TI*:2 v4l2src always_copy=FALSE num-buffers=100 ! video
/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! TIVidenc1 codecName=h264enc
engineName=codecServer contiguousInputFrame=FALSE genTimeStamps=FALSE ! filesin
k location=/tmp/enc.264
(gst-launch-0.10:636): GLib-WARNING **: getpwuid_r(): failed due to unknown user id (0)
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
0:00:01.011901868 636 0x9ebb0 WARN TIVidenc1 gsttividenc1.c:1432:gst_tividenc1_codec_start: error: failed to open codec engine "codecServer"
ERROR: from element /GstPipeline:pipeline0/GstTIVidenc1:tividenc10: failed to open codec engine "codecServer"
Additional debug info:
gsttividenc1.c(1432): gst_tividenc1_codec_start (): /GstPipeline:pipeline0/GstTIVidenc1:tividenc10
Execution ended after 382354731 ns.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
0:00:01.016387951 636 0x9ebb0 WARN TIVidenc1 gsttividenc1.c:1601:gst_tividenc1_encode_thread: error: failed to start codec
gst-launch-0.10: BufTab.c:440: BufTab_getNumBufs: Assertion `hBufTab' failed.
Aborted
重新compile ti-gstreamer就好了...
Problem:
ERROR: from element /GstPipeline:pipeline0/GstTIViddec2:tividdec20: Failed to determine target board
這個問題是因為所使用的OMAP3530 board不是TI support的.
自己修改來support吧
Get board name first
# cat /proc/cpuinfo
Processor : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 499.92
Features : swp half thumb fastmult vfp edsp thumbee neon vfpv3
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x1
CPU part : 0xc08
CPU revision : 3
Hardware : OMAP3 Thunder Board
Revision : 0020
Serial : 0000000000000000
So, the board name is OMAP3 Thunder Board
Edit dmai_2_05_00_04/packages/ti/sdo/dmai/linux/Cpu.c
...
}
else if ((strcmp(valBuf,"OMAP3EVM Board") == 0) ||
(strcmp(valBuf, "OMAP3 EVM") == 0) ||
(strcmp(valBuf, "OMAP3 Beagle Board") == 0) ||
(strcmp(valBuf, "OMAP3 Thunder Board") == 0)) { <<-- Add here
*device = Cpu_Device_OMAP3530;
}
else {
Dmai_err0("Unknown Cpu Type!\n");
return Dmai_EFAIL;
}
return Dmai_EOK;
}
...
Then rebuild again ...
不好意思 可以請教一下~~ 我可以請問一下 gst-ti-plugin-full 該在哪裡載呢?我看了好久都沒看到。
回覆刪除[版主回覆03/10/2010 19:40:12]這是由TI提供的
https://gstreamer.ti.com/gf/project/gstreamer_ti/frs/
Hi
回覆刪除你好, 不知道你有沒有遇過在播放影片時候, 有聲音 但是螢幕上只有一塊黑色的方塊?
還有你有用X嗎? 感謝 :)
[版主回覆03/29/2010 13:02:41]先確定你的frame buffer會動
gst-launch videotestsrc num-buffers=1000 ! omapfbsink
你應該要看到有彩色方塊的畫面
如果你是用gstreamer,其實有一些影像檔案是無法正確播放.
請找個480P H.264 mp4檔案試試
偶都是用Frame buffer.
Hi
回覆刪除我又來了! :)
我有用X, 我用gst-launch videotestsrc ! ximagesink 是有彩色方塊.
只是用TIDmaiVideoSink 就會像我上面所說得一樣..
不過謝謝你的答覆, 我在試試囉!
感謝
[版主回覆03/29/2010 21:03:59]TIDmaiVideoSink 偶試過,也是不work.
這跟你用的開發板和kernel version有很大的關係
Hi :)
回覆刪除我是用29的kernel, Mistral 256MB evm.
對了, 再請問一下, 當改dsplink memory 配置, 是不是連同codec server 都要改?
[版主回覆03/30/2010 13:12:20]codec server應該不需要改.
insert cmemk.ko時參數給對就好
偶的是長這樣
insmod cmemk.ko phys_start=0x8C900000 phys_end=0x8D900000 pools=20x4096,10x131072,2x1048576,1x5250000,4x829440,2x691200
你好,請問一下你在裝gst-ti-plugin-full-1.01.00的時候,有遇到問題嗎? 我出現了" configure: error: C compiler cannot create executables " 這個錯誤,不知道問題在哪邊,google到的方法也沒有用..以下是我的編譯訊息 :
回覆刪除davinci@davinci-desktop:~/桌面/gst-ti-plugin-full-1.01.00$ make all
make[1]: Entering directory `/home/davinci/桌面/gst-ti-plugin-full-1.01.00'
Building opensource_build
make[2]: Entering directory `/home/davinci/桌面/gst-ti-plugin-full-1.01.00/opensource_build'
make[3]: Entering directory `/home/davinci/桌面/gst-ti-plugin-full-1.01.00/opensource_build'
make[4]: Entering directory `/home/davinci/桌面/gst-ti-plugin-full-1.01.00/opensource_build'
***** Extracting glib
***** Configuring glib
configure: WARNING: using cross tools not prefixed with host triplet
configure: error: in `/home/davinci/桌面/gst-ti-plugin-full-1.01.00/opensource_build/glib-2.21.1':
configure: error: C compiler cannot create executables
See `config.log' for more details.
make[4]: *** [glib.configure] 错误 77
make[4]: Leaving directory `/home/davinci/桌面/gst-ti-plugin-full-1.01.00/opensource_build'
make[3]: *** [base] 错误 2
make[3]: Leaving directory `/home/davinci/桌面/gst-ti-plugin-full-1.01.00/opensource_build'
make[2]: *** [.base] 错误 2
make[2]: Leaving directory `/home/davinci/桌面/gst-ti-plugin-full-1.01.00/opensource_build'
make[1]: *** [opensource_build] 错误 2
make[1]: Leaving directory `/home/davinci/桌面/gst-ti-plugin-full-1.01.00'
make: *** [all] 错误 2
謝謝QQ
[版主回覆04/27/2010 00:45:29]很明顯是cross compiler沒有設定好
請檢查gst-ti-plugin-full-1.01.00/Makefile.common
# CROSS_COMPILER
# Cross compiler being used. A default is chosen based on the platform
# you are building for, but you can set it explicitly to one of these
# values:
# MVL_4_0_1: MontaVista v4.0.1
# MVL_5_0: MontaVista v5.0
# CS_2008Q1: CodeSourcery v2008q1
#
謝謝你的回答,我是設定成 CS_2008Q1 ,不過我是用2007_Q3的tool chain,不知道是不是因為這樣才出現問題,我裝看看2008_Q1的試試,萬分感謝QQ
回覆刪除您好,
回覆刪除我現在也是在研究omap3530的arm與dsp連結,但一直出問題,我查了很多資料,發現在filesystem中的/sys/device/platform/omapfb/下必須要有overlay等檔案,但我們沒有此檔案,接著我找到了一個資料說In TI PSP kernel with DSS2 the entry is /sys/devices/platform/omapfb/overlays; In opensource community kernel the entry is /sys/devices/platform/omapdss/overlay,我們是使用opensource,但在/sys/devices/platform/omapdss/目錄之下,我們只有overlay0、overlay1、overlay2,無法使用cat overlay來查看設定,現在卡在此問題,不知道您是否有遇到類似問題,可以提供我一些建議,謝謝!!參考網站http://processors.wiki.ti.com/index.php/Dual_Frame_Buffer_on_OMAP35x
[版主回覆05/12/2010 16:48:26]Hello Rooster
我覺得你的問題應該出在kernel.
2.6.27 ~ 2.6.29 DSS介面有變動,我記得kernel/Documents裡有DSS的文件說明很清楚
以下是我試過的方式
For miniboard-v3 kernel 2.6.27
cd /sys/devices/platform/
echo "lcd e:0" > omapfb/displays
echo "lcd t:none" > omapfb/managers
#fbset -fb /dev/fb0 -xres $WIDTH -yres $HEIGHT
fbset -fb /dev/fb0 -xres 640 -yres 480
#fbset -fb /dev/fb0 -xres 352 -yres 288
echo "lcd t:dvi" > omapfb/managers
echo "dvi e:1" > omapfb/displays
For miniboard-v3 kernel 2.6.29
ovl0=/sys/devices/platform/omapdss/overlay0
ovl1=/sys/devices/platform/omapdss/overlay1
ovl2=/sys/devices/platform/omapdss/overlay2
mgr0=/sys/devices/platform/omapdss/manager0
mgr1=/sys/devices/platform/omapdss/manager1
lcd=/sys/devices/platform/omapdss/display0
dvi=/sys/devices/platform/omapdss/display1
tv=/sys/devices/platform/omapdss/display2
fb0=/sys/class/graphics/fb0
fb1=/sys/class/graphics/fb1
fb2=/sys/class/graphics/fb2
w=`cat $dvi/timings | cut -d "," -f 2 | cut -d "/" -f 1`
h=`cat $dvi/timings | cut -d "," -f 3 | cut -d "/" -f 1`
echo "0" > $lcd/enabled
echo "" > $mgr0/display
fbset -fb /dev/fb0 -xres $w -yres $h -vxres $w -vyres $h
# at this point you have to switch the dvi/lcd dip-switch from the omap board
echo "dvi" > $mgr0/display
echo "1" > $dvi/enabled
我想請問一下你編kernel的source code在哪下載的呢??
回覆刪除[版主回覆05/20/2010 08:25:19]I'm using 0xlab's kernel, please visit http://code.google.com/p/0xdroid/wiki/Source.
git clone git://gitorious.org/0xlab-kernel/kernel.git
您好!!
回覆刪除我已經下載0xdroid的kernel,我想請問一下,如何在menuconfig中設定,才會讓/sys/devices/platform/omapfb/下出現overlays等裝置呢??謝謝您!!!
[版主回覆05/24/2010 11:07:41]請看
Device Drivers -> Graphic Supports -> OMAP2/3 Display Subsystem support (EXPERIMENTAL)
root file system掛起來之後記得下 mdev -s
您好,
回覆刪除我有照您上面的步驟選擇Device Drivers -> Graphic Supports -> OMAP2/3 Display Subsystem support (EXPERIMENTAL),但是在omapfb/下仍然沒有出現overlay等device,我使用的嵌入式板是BeagleBoard,在boot下的參數為setenv bootargs console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootdelay=1 devfs=mount omapfb.mode=dvi:1024x768MR-24@60 omapfb.vram=0:2M,1:4M mem=88M,在開機的畫面看到下面的訊息,
[ 2.094848] omapfb omapfb: no driver for display
[ 2.099731] omapfb omapfb: failed to setup omapfb
我有google過,但沒找到解決的方法,想詢問您是否有什麼想法能提供呢?是否要插上device能會有overlay的裝置,還是boot下的參數是錯的,不好意思一直麻煩您!!謝謝!!
[版主回覆07/23/2010 15:11:56]我也是用beagleboard
你參考我的 kernel param 試試
console=ttyS2,115200n8 init=/init omapdss.def_disp=dvi omapfb.mode=dvi:1280x1024MR-16@60 vram=12M omapfb.vram=0:4M,1:4M,2:4M mem=88M@0x8
0000000 mem=128M@0x88000000 root=ubi0:rootfs ubi.mtd=4 rw rootfstype=ubifs
確定你的環境變數真的有設定好 !!!
kernel boot之後的log
fbcvt: 1280x1024@60: CVT Name - 1.310M4-R
regulator_init_complete: incomplete constraints, leaving VDVI on
regulator_init_complete: incomplete constraints, leaving VDAC on
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
omapdss DPI error: display already enabled
omap_vout omap_vout: 'dvi' Display already enabled
omapdss DPI error: display already enabled
omap_vout omap_vout: 'dvi' Display already enabled
omap_vout omap_vout: Buffer Size = 3686400
omap_vout omap_vout: : registered and initialized video device 0
omap_vout omap_vout: Buffer Size = 3686400
omap_vout omap_vout: : registered and initialized video device 1
你好
回覆刪除我的平台是 omap3530evm mem=256M
我之前參考 http://code.google.com/p/rowboat/wiki/DSP 這裡面的設定
裡面有說參數要設定成
setenv bootcmd 'mmc init; fatload mmc 0 80800000 uImage; bootm 80800000'
setenv bootargs 'mem=88M@0x80000000 mem=128M@0x88000000 console=tty0
console=ttyS0,115200n8 androidboot.console=ttyS0 root=/dev/mmcblk0p2
rw init=/init rootwait omap_vout.vid1_static_vrfb_alloc=y
omap_vout.video1_numbuffers=3 omap_vout.video1_bufsize=614400
omap_vout.video2_numbuffers=0'
之後我開機從run bootcmd之後下面有個cmemk的地方出現說我的CMEM那有問題
CMEMK module: built on Jan 18 2011 at 18:06:47
Reference Linux version 2.6.32
File /root/rowboat-android/external/ti-dsp/ti-dvsdk_dm3730-evm_4_00_00_22
/linc
CMEM Range Overlaps Kernel Physical - allowing overlap
CMEM phys_start (0x85800000) overlaps kernel (0x80000000 -> 0x8d800000)
allocated heap buffer 0xd1000000 of size 0x4be000
cmemk initialized
DSPLINK Module (1.65.00.02) created on Date: Jan 18 2011 Time: 18:05:27
SDMAK module: built on Jan 18 2011 at 18:06:50
明明一開始就有設定
mem=88M@0x80000000 mem=128M@0x88000000
但是卻避不開那個地方
但又不知道要怎麼修改
CMEM phys_start (0x85800000)
的實體位址
雖然開機正常 但是再執行loadmodules.sh會有問題
不知 老二 是否知道我要怎麼解決此問題
[版主回覆01/21/2011 22:14:55]你的問題是u-boot太老舊造成memory hole無法設定.
偶的u-boot版本
U-Boot 2009.11 (Feb 23 2010 - 15:33:48)
我的版本是 U-Boot 2010.06-rc1-00049-ga306f53 (Aug 16 2010 - 19:25:16)
回覆刪除就我昨天的那個訊息
CMEM phys_start (0x85800000) overlaps kernel (0x80000000 -> 0x8d800000)
之後想說用成舊的版本
U-Boot 2009.11 (Oct 14 2010 - 16:23:59)
還是一樣的訊息
想說是否有其他的解決辦法?
[版主回覆01/22/2011 18:42:08]看你的message是跑rowboat android吧.
memory hole我曾經遇過setenv設定的字串太長而出問題.
你必須將bootargs拆開.
週一進office我再把我目前beagleboard u-boot env內容貼上來
不好意思請教一下我出現跟linli一樣的問題,我的Makefile.com內容如下:
回覆刪除DVSDK_INSTALL_DIR = /home/lin/rowboat/rowboat-android-eclair/external/ti-dsp/dvsdk_3_01_00_10
TARGET_ROOT_DIR = /home/lin/rowboatfs/rootfs
GSTREAMER_DIR = /home/lin/rowboat/rowboat-android-eclair/external/ti-dsp/gstreamer_ti
CROSS_COMPILER = /usr/local/arm/arm2008q1/bin/arm-none-linux-gnueabi-
GST_TI_PLATFORM = omap3530
還是出現同樣的錯誤,網路上資訊很少,可以請教你嗎@@?~感謝!!