三月 8, 2011

OMAP3530 DSP Howto ( Really works by DSPLINK)

Written by

————–我转载它,主要是为了自己学习

2009/11/03 17:33

搞了一段很長的時間終於把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=20×4096,10×131072,2×1048576,1×5250000,4×829440,2×691200

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呢?

Category : ARMMCU

Tags :

Comments

3 Responses

  1. 匿名说道:

    test

  2. EDWARD说道:

    怎么样子才是

  3. Laurinda说道:

    Woah! I’m really enjoying the template/theme of this site.
    It’s simple, yet effective. A lot of times it’s challenging
    to get that “perfect balance” between superb usability and visual
    appeal. Hereford i v a must say you have done a great job with this.
    Additionally, the blog loads extremely quick for me on Chrome.
    Exceptional Blog!

发表评论

电子邮件地址不会被公开。

Proudly powered by WordPress and Sweet Tech Theme