[maemo-developers] DSP Programming: Using shared memory

From: Simon Pickering S.G.Pickering at bath.ac.uk
Date: Tue Aug 28 21:23:24 EEST 2007
Hello all,

I've sat down and worked out how to use shared memory (shared between 
the ARM and DSP). Not rocket science (despite my troubles with for 
loops ;) ), but it's probably needed for any useful dspsink codecs (as 
illustrated by the use of shared memory buffers for Nokia's dspsinks).

It's reasonably simple. You must provide a mmap_info structure in your 
task's dsptask structure. The mmap_info structure is defined in 
tokliBIOS.h and is simply a pointer to some memory and a length.

I've written some example code (looks like the Uni http server is down 
atm though): 

The code reads in a file from the ARM side and adds 1 to each of the 
characters (so "abc"->"bcd").

In this code I've also broached the other subject we were wondering 
about, the individual .cmd files. In retrospect these are reasonably 
simple too, they are a way of communicating with the runtime linker to 
define various things. In this case I've just defined a new data 
section (giving location, alignment, etc.) with reference to the memory 
sections that exist (see the /lib/dsp/dsp_dld_avs.conf file for the 
names and sizes, and also look at what the other dsp tasks use in their 
.cmd file). I then use this newly defined data section when I #pragma 
DATA_SECTION() in the DSP-side code to tell the linker where to place 
my shared memory buffer.

Obviously there are other uses for this particular pragma and the .cmd 
file, iirc some of the DSPlib functions work best/only when placed in 
DARAM, so this is something one could do here if needs be.



More information about the maemo-developers mailing list