1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3<HEAD>
4<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
5<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 7.0.0.0 for Windows">
6<META http-equiv="Content-Style-Type" content="text/css">
7<TITLE>How to Use the DSP Component (Overview)</TITLE>
8<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css">
9</HEAD>
10<BODY>
11<H1 align="left">How to Use the DSP Component (Overview) <IMG src="../../image/TWL.gif"></H1>
12<P>This page describes how to use the various components provided by the DSP library.</P>
13
14<A name="OVERVIEW"><H2>Overview</H2></A>
15<P>The TWL-SDK provides a DSP library, which can encode and decode images and audio using a DSP.
16</P>
17<P>The following features are provided by the DSP library.</P>
18<UL>
19	<LI>G.711 Encoding and Decoding</LI>
20	<LI>Graphics</LI>
21	<LI>Shared Component Features (Sound Playback, Microphone Sampling, and so on)</LI>
22</UL>
23
24<A name="COMPONENT"><H2>Components</H2></A>
25<P>Linking to the DSP library does not make each of its features immediately available. Individual features are split into &quot;components&quot;, and <FONT color="red">the application must load components to the DSP to use them.</FONT><BR>The DSP becomes operative when the functions that load the components (<CODE>DSP_Load*</CODE>) run. Sleep mode is prohibited while any component is loaded.<BR>
26</P>
27
28<P>The DSP uses the WRAM-B as the code region and the WRAM-C as the data region (see the <A href="../../mi/wram/about_Wram.html">Work RAM Overview</A> for details). Each component uses a different size (number of slots). A macro is defined for indicating the size of each component. These macros are written in the description for each component-loading function (<CODE>DSP_Load*</CODE>).</P>
29
30<A name="LOAD"><H2>Loading Components</H2></A>
31<P>Each component is a <CODE>.a</CODE> file under the <CODE>$TwlSDK/dspcomponents/<I>{component name}</I></CODE> folder. These component files must be expanded, and the DSP library places each component file in static memory and opens it. The <CODE>DSP_OpenStaticComponent*</CODE> functions are provided (this increases the program's resident memory size, however).</P>
32
33<P>If you would like to reduce the size, you can place the compressed component files in memory and use the <A href="../../fs/file/FS_CreateFileFromMemory.html"><CODE>FS_CreateFileFromMemory</CODE></A> function to expand and open them on demand.(The <A href="../../fs/file/FS_CreateFileFromMemory.html"><CODE>FS_CreateFileFromMemory</CODE></A> function is used within the <CODE>DSP_OpenStaticComponent*</CODE> functions as well.)
34</P>
35
36<P>After opening a component file, pass the <A href="../../fs/fs_file_type.html"><CODE>FSFile</CODE></A> structure for that file as an argument to a <CODE>DSP_Load*</CODE> function to load the component. You must specify a slot in WRAM-B or WRAM-C that can be used by the DSP. This fails if there are not enough free slots in WRAM-B or WRAM-C for loading.
37</P>
38<P>The DSP loading functions switches WRAM slots to both ARM9 and DSP, as necessary. Switching slots reserved by the <A href="../../mi/wram/MI_ReserveWram.html"><CODE>MI_ReserveWram*</CODE></A> functions is prohibited, so specifying these slots results in failure. Consequently, <FONT color=red>you do not need to reserve the WRAM in advance for the DSP.</FONT>
39</P>
40
41<P>If there are enough free regions for loading, only the required regions will be assigned to the DSP.
42</P>
43
44<P><B><FONT color="red">You cannot load and use multiple components at the same time.</FONT></B></P>
45
46<H3>Example</H3>
47<BLOCKQUOTE style="background-color:#ffffd0;"><CODE>// Example using the G.711 component<BR> FSFile *file;<BR> // Open the G.711 component file<BR> DSP_OpenStaticComponentG711(file);<BR> // Load<BR> DSP_LoadG711(file, 0xff, 0xff);<BR></CODE></BLOCKQUOTE>
48
49<P>In the example above, only the necessary slots are selected from all the WRAM-B and WRAM-C slots to be allocated for the DSP.
50</P>
51
52<H2>Unloading Components</H2>
53<P><FONT color="red">You must unload components</FONT> using the <CODE>DSP_Unload*</CODE> functions when deleting the loaded component files to free WRAM or when the application sleeps or exits.</P>
54<P>Unloading releases the WRAM-B and WRAM-C slots that were allocated to the DSP.</P>
55
56<H3>Example</H3>
57<BLOCKQUOTE style="background-color:#ffffd0;"><CODE>// Unloading the G.711 component<BR> DSP_UnloadG711();<BR></CODE></BLOCKQUOTE>
58
59<H2>See Also</H2>
60<P><A href="../list_dsp.html">DSP Function List</A></P>
61
62<H2>Revision History</H2>
63<P>
642008/11/04 Added mention that Sleep mode is prohibited when components are loaded.<br> 2008/10/21 Added situations where components must be unloaded.<br> 2008/09/03 Initial version.</P>
65<hr><p>CONFIDENTIAL</p></body>
66</HTML>
67