DSPBridge Project

From OMAPpedia

Revision as of 09:24, 5 October 2012 by Bizulk (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Last updated: 10 May 2010

NOTE: These instructions are to compile dspbridge branch in kernel-dspbridge dev.omapzoom project. However, they give a fair overview to build other branches and kernels.

Check out the news under DSPBridge Branch section.

Contents

[edit] About DSP Bridge

DSP Bridge driver provides features to control and communicate with DSP enabling parallel processing for multimedia acceleration. It enables the applications running on MPU to offload the processing to DSP.


Some of the key features of DSP Bridge are:

   Messaging: Ability to exchange fixed size control messages with DSP
   Dynamic memory management: Ability to dynamically map files to DSP address space
   Dynamic loading: Ability to dynamically load new nodes on DSP at run time
   Power Management: Static and dynamic power management for DSP


[edit] Bridge Architecture

Bridge Arch.jpg

[edit] Getting Started with DSP Bridge

The latest 'DSP Bridge' has been included into the kernel source ('staging' tree). The repository you may select depends on the board you are using. Indeed the mainline kernels tree support a majority of boards, but the communities use to maintain a mainlin synced tree with many patches that are still not included in the mainline.

If you know what you're doing you may also work with the mainlien/linux-next/linux-stable git tree.


The below sections provide information on how to build DSP Bridge, for information on u-boot or kernel.

Before proceeding, check for the tools:

Set up a tool chain, the tool chain versions comonly used are Code Sourcery ARM Sourcery G++ 2008q3 or 2007q3.

Set cross compile variable.

  export CROSS_COMPILE=arm-none-linux-gnueabi-  

Be sure that you have the mkimage tool visible in the exported PATH, this is generated while compiling u-boot under u-boot/tools folder, you can clone u-boot repository from here.

[edit] Building Kernel Image with Bridge Driver Support (git tree approach)

Clone linux-bridge repository with the following command:

  git clone <the git url repository from above>

Configure your board.

  make omap_<my_board>_defconfig  

Select any desired kernel options

  make menuconfig  

Select from menuconfig the options to enable Bridge driver as shown in the figures below:

Img1-2.6.37-rc1.jpg


Select staging drivers, inside it, deselect the option to exclude staging driver from being built.

Img2-2.6.37-rc1.jpg


Toggle between "*" or "M" to build Kernel image with builtin support or as a loadable kernel module.

Img3-2.6.37-rc1.jpg

Bridge driver options menu:

   --- DSP Bridge driver
   
   [ ] Enable Bridge Dynamic Voltage and Frequency Scaling (DVFS)
   Bridge DVFS depends on other kernel options, it will not be displayed until you enable them.
   
   (0x600000) Physical memory pool size (Byte)
   Amount of memory allocated for bridge. This needs that dspbridge.ko is installed before the driver, refer to working with bridge
   
   [ ] DSP Bridge Debug Support
   Bridge GT trace debug system.  

Make the Kernel Image and modules after saving your changes in menuconfig.

   make uImage && make modules  

At this point, you should have a uImage, and depending on your configuration either the driver built-in as part of the kernel or as a module.

If bridge was compiled as a module, the .ko file are located at:

   arch/arm/plat-omap/mailbox.ko
   arch/arm/mach-omap2/mailbox_mach.ko
   drivers/dsp/bridge/bridgedriver.ko

Note that on the latest versions, bridge has migrated to use omap mailbox driver.

Copy these files to the file system.

[edit] Build Userspace Files

[edit] Initial environment setup

Set up an arm tool chain, the tool chain versions comonly used are Code Sourcery ARM Sourcery G++ 2008q3 or 2007q3 You must also have the libstdc++5 installed in your host.

Set cross compile variable.

   export CROSS_COMPILE=arm-none-linux-gnueabi- 

Set up dsp toolchain, to compile dsp samples you will need the CGT 6.0.7 or later version (Code Generation Tools) and the DSP/BIOS 5.21.03 package (subsequent version not compatible with user-space source). Please note that you might be required to register to gain access to those files.

   # Create your dsp toolchain folder (DEPOT); installing DSP required
   # software in a single location will help you save time from editing
   # config.bld and specifyng the paths to your tools
        mkdir /dsp-tc/ 
# Install directories: # CGT: /dsp-tc/cgt6x-6.0.7 # BIOS: /dsp-tc/bios_5_33_04
# If you are changing from the recommended CGT version, you need to # match the version used to the one defined in product.mak
# Export your DEPOT folder export DEPOT=/dsp-tc/

[edit] Building Userspace Files

Clone userspace repository with the following command:

git clone git://dev.omapzoom.org/pub/scm/tidspbridge/userspace-dspbridge.git
Note: The repository has documents, and a source folder. Since 2012-04-27 there are no more precompiled dsp binaries, there is an unofficial location to download them .

Checkout userspace master branch or tag.

cd userspace-dspbridge 
git checkout -b my_userspace --track origin/master

note : for the build steps you may also check the README file found in the repository source.

In /source/product.mak file, change the below version numbers to match the tools version numbers:

   # DSP BIOS
   SABIOS_VER   = 5.33.04
   SABIOS_VER_2 = 5_33_04
   # CodeGen Tools
   CGT55_VER = 3.2.2
   CGT6X_VER = 6.0.7

Check also the config.bld file :

   Check the CGT path définition : tiTargets.C64P.rootDir = depot + "/<your dir prefix>" + c6xCodeGenVersion;

Compile the package from the 'source' folder.

Make options:
make clean # clean all make all # clean, compile and install all make .api # clean, compile and install API only make .samples # clean, compile and install samples only make .dsp # clean, compile and install DSP binaires only
# The output will be created under: userspace/source/target

Copy the compiled binaries into the filesystem, target/dspbridge folder and target/lib/*

   cp -r target/dspbridge my_filesystem/
   cp target/lib/* my_filesystem/lib/

[edit] Working with bridge driver

Boot your kernel, when you receive the console prompt:

If bridge was compiled as part of the kernel, jump to step 2.

1. Install dspbridge and bridgedriver modules.

   modprobe tidspbridge (if module is installed in /lib/modules/... path) OR insmod <pathtomodule>/tidspbridge.ko

If everything went fine, /dev/DspBridge should be created, cat /proc/interrupts should show 26 and 28 assigned to bridge.

2. Load a baseimage.

A baseimage is a file containing all DSP/BIOS primitives to work with the dsp. While building the userspace files ddspbase_tiomap3430 (static) and dynbase_tiomap3430 (dynamic) baseimages were created. A static baseimage links all the nodes that will be used during execution. A dynamic baseimage loads the nodes at runtime by registering DLLs (dll64P).

   ./cexec.out ddspbase_tiomap3430.dof64P

Loading the dynamic baseimage:

   ./cexec.out dynbase_tiomap3430.dof64P

Register the dll

   ./dynreg.out -r <sample>dyn_3430.dll64P

3. Execute a sample.

A sample is a bridge native application, that uses the API to communicate to the DSP through bridge driver. These are: ping, dmmcopy, strmcopy, scale, cexec, dynreg.

[edit] Bridge Samples

[edit] Cexec

It is used to load and start a DSP baseimage.

Usage: cexec.out <baseimage>
Options:
    -v    Verbose.
    -T    Load, Start and exit execution. If not used cexec waits for user input before exiting.

Source: userspace-dspbridge/source/samples/mpu/src/cexec

[edit] Ping

Illustrates the fundamental control and messaging mechanisms used between ARM applications and BIOS tasks.

Usage: ping.out <no. msg>
Options:
    <no. msg>    Number of messages to be sent to DSP, if not specified, ping will send 50 messages.

Source: userspace-dspbridge/source/samples/mpu/src/ping

[edit] Strmcopy

Stream copy application demonstrates simple data streaming between a GPP (arm) task and a DSP task node, and end-of-stream handling. It copies data from file to file on the host file system.

Usage: strmcopy.out <streaming transport id> <input> <output>
       strmcopy_dyn.out <streaming transport id> <input> <output>
Options:
    <streaming transport id>    0 - proc-copy
                                1 - dsp-dma (unsupported)
                                2 - zero-copy (unsupported)
    <input>    Input file to copy
    <output>   Output file to write

Source: userspace-dspbridge/source/samples/mpu/src/strmcopy

[edit] Scale

It provide an example of how a XDAIS algorithm can be integrated into the DSP/BIOS node framework. It sends buffers of data to the DSP to be scaled and returned back.

Usage: scale.out <iterations>
       scale_dyn.out <iterations>
Options:
    <iterations>    Number of iterations

Source: userspace-dspbridge/source/samples/mpu/src/scale

[edit] Dmmcopy

Dynamic Memory mapping example to demonstrate basic usage of DMM APIs, it maps two buffers allocated on the ARM to two regions in the DSP virtual address space. It reads the data from an input file into the first buffer, using messaging to synchronize buffer access, DSP copies the contents of the first buffer to the second buffer and returns it to the sample, the sample compares both buffer to be the same and continues execution until the input end of file.

Usage: dmmcopy.out <input> <output>
Options:
    <input>    Input file
    <output>   Output file

Source: userspace-dspbridge/source/samples/mpu/src/dmmcopy

[edit] Dynreg

Used to register nodes that are going to be dynamically loaded along with any corresponding or dependent libraries.

Usage: dynreg.out <args> <library path>
Options:
    -v    verbose mode.
    -ls   Short list of currently registered node in the Node Database
    -ln   Long list of currently registered node in the Node Database
    -r <lib_path>    Register dynamic library
    -u <lib_path>    Unregister dynamic library
    -?    displays "dynreg" usage.

Source: userspace-dspbridge/source/samples/mpu/src/dynreg

[edit] Bridge Driver

The latest DSP Bridge source code exists on the dev.omapzoom Git Tree under drivers/dsp/dspbridge.

[edit] User space Bridge libraries and samples

Download the user space Bridge components:

Userspace Git Tree

[edit] DSP Binaries

Download the DSP binaries:

Userspace Git Tree

[edit] Documents

[edit] See also

[edit] DSPBridge Branch

[edit] In the works (pushed)

[edit] In the works (development)

[edit] DSP/Bridge patch status

For status on dspbridge patches check: dspbridge patchwork

[edit] dspbridge version 0.2 (Kernel 2.6.32)

Released: 18 Mar 2010

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox