53
‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserve Technical Training Organization T TO (pronounced DAY-US)

‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

Embed Size (px)

Citation preview

Page 1: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

‘C6000 Integration Workshop

Chapter 11

XDAIS Algorithms

Copyright © 2005 Texas Instruments. All rights reserved. Technical TrainingOrganization

T TO

(pronounced DAY-US)

Page 2: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

Outline Code Integration Problems Background Terminology Basic XDAIS Components XDAIS Example – Sine Wave Algorithm Algorithm Instance Lifecycle Lab 11 – Using a XDAIS FIR Algorithm Additional Topics

Page 3: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

Code Integration Problems

Three Integration Issues1. Using multiple algorithms

2. Re-using the same algorithm

3. Purchasing an algorithm

Traditional Solutions

TI XDAIS Solution

Technical TrainingOrganization

T TO

Page 4: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

1. Using Multiple AlgorithmsInputBuffer

OutputBuffer

Add Sine Filter

What problems might occur when integrating two different algorithms into an application?

Page 5: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

1. Using Multiple AlgorithmsInputBuffer

OutputBuffer

Add Sine

Will one use the memory required by another?

For example:

Given limited fast internal memory, will one fail if another takes too much?

Filter

What problems might occur when integrating two different algorithms into an application?

IRAM

alg1

alg2

Page 6: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

1. Using Multiple AlgorithmsInputBuffer

OutputBuffer

Add Sine

Will one use the memory required by another?

For example:

Given limited fast internal memory, will one fail if another takes too much?

What if one algorithm uses an interruptor EDMA channel required by another?

Basically, any system resource can causeintegration problems between algorithms.

Filter

What problems might occur when integrating two different algorithms into an application?

IRAM

alg1

alg2

Problem 2 ...Technical Training

Organization

T TO

Page 7: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

2. Using the Same Algo Multiple TimesInputBuffer

OutputBuffer

200Hz

float FreqTone, FreqSampleRate;static float A, y[3];

void SINE_init()short SINE_Value()void SINE_blockFill()

sine1.c What would happen if you reused

the sine algorithm for a 2nd sine wave tone?

3.3KHz

Page 8: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

2. Using the Same Algo Multiple TimesInputBuffer

OutputBuffer

200Hz

What would happen if you reused the sine algorithm for a 2nd sine wave tone? Variable names conflict May need to rewrite

functions to handle two (or more) tones

3.3KHz

Note: This very problem occurred to the

sine algorithm when we introduced multi-channel (sorting) in CH 7.

After this chapter, we could drastically improve our solution.

And finally …

float FreqTone, FreqSampleRate;static float A, y[3];

void SINE_init()short SINE_Value()void SINE_blockFill()

sine1.c

float FreqTone, FreqSampleRate;static float A, y[3];

void SINE_init()short SINE_Value()void SINE_blockFill()

sine2.c

Technical TrainingOrganization

T TO

Page 9: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

3. Buying AlgorithmsWhy is it hard to integrate someone else’s algo?

1. Will the function names conflict with other code in the system?

2. Will it use memory or peripherals needed by other algo’s?

3. How can I run the same algo on more than one channel at a time? (How can I prevent variables from conflicting?)

4. Don’t know how fast it runs …

… or how much memory it uses.

5. How can I adapt the algorithm to meet my needs?

6. How many interfaces (API’s) do I have to learn?

What's the solution?

We’ve already seen the first three, four thru six are specific to using someone else’s code …

Technical TrainingOrganization

T TO

Page 10: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

Traditional Solutions1. Manually integrate algorithms together by finding all (hopefully)

the conflicts and fixing them.

Page 11: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

Traditional Solutions1. Manually integrate algorithms together by finding all (hopefully)

the conflicts and fixing them.

2. Rather than reusing an algorithm (e.g. our sinewave), rewrite algorithm to provide the number of required channels.

Page 12: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

Traditional Solutions1. Manually integrate algorithms together by finding all (hopefully)

the conflicts and fixing them.

2. Rather than reusing an algorithm (e.g. our sinewave), rewrite algorithm to provide the number of required channels.

3. When I buy an algorithm, “I need the source code or I can’t guarantee my application will work.” Without source code (and lots of development time),

I can’t use the first two methods of code integration. But, purchasing source code costs a lot of money!

What's the alternative?Technical Training

Organization

T TO

Page 13: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

Algo

Algo

Algo

Input

Output

Memory

Your

Application

TI Solution

Modularize algorithms. That is,use a standard interface between: Application Algorithms

ApplicationProgramming

Interface

Page 14: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

TI Solution

Algo

Algo

Algo

Input

Output

Memory

Your

Application

XDAIS is the standard interface specification

for DSP algorithms

Modularize algorithms. That is,use a standard interface between: Application Algorithms

TI designed a DSP algorithm interface: XDAIS Public, published set of rules & guidelines Algorithm certification Only one interface to learn for all algorithms and vendors!

Technical TrainingOrganization

T TO

Page 15: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

Rules & Guidelines Applied to Algorithm Software Modules

Programming Rules

Standard Interface Defined by TI

Algorithm Packaging

Algorithm Performance

TI DSP Algorithm Standard (XDAIS)

TMS320™ DSP Algorithm Standard

Specification

(XDAIS)

TEXASINSTRUMENTS

XDAIS

ti

ALGORITHMPRODUCERS

Write once, deploy widely

Or, sell widely

AlgorithmApplication

Off-the-shelf DSP content

Ease of integration

Purchase once, use widely

Application Developers

Technical TrainingOrganization

T TO

Page 16: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

Outline Code Integration Problems Background Terminology

Instance Interface Algorithm

Basic XDAIS Components XDAIS Example – Sine Wave Algorithm Algorithm Instance Lifecycle Lab 11 – Using a XDAIS FIR Algorithm Additional Topics

Technical TrainingOrganization

T TO

Page 17: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

What is an Instance?

typedef struct myType {

int var1;

short var2;

char var3;

};

Define Datatype Only a “template” No memory allocated

myType myVar;

myType anotherVar;

Create an Instance of that Datatype Memory is allocated Can create multiple

instances

This is a key concept in XDAIS To demonstrate the concept, let’s

examine an “instance” in C code

Technical TrainingOrganization

T TO

Page 18: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

What is an Interface?

int myFunction(short a, int b){

return((int)a + b);

}

Example Function

// Function Prototype

int myFunction(short a, int b);

Function Interface: Describes how the function

is used That is, how does an

application interface to it

“Interface” can mean many things We define it conceptually for the purposes

of this chapter Let’s start by defining a Function interface

Extending this definition, How does an algo differ from a function?Technical Training

Organization

T TO

Page 19: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

What is an Algorithm?

typedef struct myType {};

myType var1;

int var2;

int myFunction(short a, int b)

algorithm may include: Data Types Data Objects Functions

Algo’s usually are more than just a single function, an

An Algorithm’s Interface then must include a description of all the: functions, data types, and data objects

available to the application using the algorithm

Often, this is called an API or Application Programming Interface

Technical TrainingOrganization

T TO

Page 20: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

Outline Code Integration Problems

Background Terminology

Basic XDAIS Components Parameters Instance Object Memory Table

XDAIS Example – Sine Wave Algorithm

Algorithm Instance Lifecycle

Lab 11 – Using a XDAIS FIR Algorithm

Additional Topics

Technical TrainingOrganization

T TO

Page 21: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

1. Algorithm Parameters (Params)

Vendor supplies “params” structure to allow user to describe any user-changeable algorithm parameters.

For example, what parameters might you need for a FIR filter?

firLen

blockSize

*coeffPtr

How can you adapt an algorithm to meet your needs?

Page 22: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

1. Algorithm Parameters (Params) How can you adapt an algorithm to meet your needs?

Vendor supplies “params” structure to allow user to describe any user-changeable algorithm parameters.

typedef struct IFIR_Params {

Int size; // size of params

XDAS_Int16 firLen;

XDAS_Int16 blockSize;

XDAS_Int16 *coeffPtr;

} IFIR_Params;

typedef struct IFIR_Params {

Int size; // size of params

XDAS_Int16 firLen;

XDAS_Int16 blockSize;

XDAS_Int16 *coeffPtr;

} IFIR_Params;

A filter called IFIR might have:

For example, what parameters might you need for a FIR filter?

firLen;

blockSize;

*coeffPtr;

Technical TrainingOrganization

T TO

Page 23: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

instObj1

instObj2

Each instance of an algorithm gets it’s own ‘storage’ location called an instance object.

2. XDAIS Components: Instance Object

IFIR algorithm: Instance 1

*fxns Pointer to algo functions

*a Pointer to coefficients

*x Pointer to new data buffer

If you want to run the same algo on more than one channel …How do you prevent variables from conflicting with each other?

IFIR algorithm: Instance 2

*fxns

*a

*xTechnical Training

Organization

T TO

Page 24: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

3. XDAIS Components: Memory Table

Algorithms cannot allocate memory. Each block of memory required by algorithm is detailed in a

Memory Table (memtab), then allocated by the Application.

What prevents an algorithm from “taking” too much (critical) memory?

MemTab:

SizeAlignment

SpaceAttributesBase Addr

MemTab

Base: Starting address for block of memory

Attributes: Scratch or Persistent memory (discussed later)

Space: Internal / External memory

Page 25: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

3. XDAIS Components: Memory Table

Algorithms cannot allocate memory. Each block of memory required by algorithm is detailed in a

Memory Table (memtab), then allocated by the Application.

What prevents an algorithm from “taking” too much (critical) memory?

MemTab example:

SizeAlignment

SpaceAttributesBase Addr

MemTab

SizeAlignment

SpaceAttributes

Base

SizeAlignment

SpaceAttributes

Base

Application

Algo provides info for each block of memory it needs,

Except base address …

Algorithm

Page 26: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

3. XDAIS Components: Memory Table

MemTab example:

What prevents an algorithm from “taking” too much (critical) memory?

SizeAlignment

SpaceAttributesBase Addr

MemTab

SizeAlignment

SpaceAttributes

Base

SizeAlignment

SpaceAttributes

Base

Application

Algo provides info for each block of memory it needs,

Except base address …

Algorithm

Based on the four memory details in MemTab,

Application allocates each memory block, and then

Provides base address to MemTab

Algorithms cannot allocate memory. Each block of memory required by algorithm is detailed in a

Memory Table (memtab), then allocated by the Application.

Technical TrainingOrganization

T TO

Page 27: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

Outline Code Integration Problems

Background Terminology

Basic XDAIS Components

XDAIS Example – Sine Wave Algorithm Parameters InstObj: ‘Global’ Variables MemTab Example

Algorithm Instance Lifecycle

Lab 11 – Using a XDAIS FIR Algorithm

Additional Topics

Technical TrainingOrganization

T TO

Page 28: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

From the SINE.C code, it uses the following Data Elements and Functions

FunctionssineInit()

sineValue()

sineBlockFill()

float FreqTone, FreqSampleRate;static float A, y[3];

void sineInit()short sineValue()void sineBlockFill()

sine.c

Data ScopeFreqTone global

FreqSampleRate global

A global

Y0 global

Y1 global

Y2 global

Technical TrainingOrganization

T TO

Page 29: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

SINE Example: Params & InstObj

Data ScopeFreqTone global

FreqSampleRate global

A global

Y0 global

Y1 global

Y2 global

typedef struct ISINE_Params {

Int size;

XDAS_Float32 FreqTone;

XDAS_Float32 FreqSampleRate;

} ISINE_Params;

typedef struct ISINE_Params {

Int size;

XDAS_Float32 FreqTone;

XDAS_Float32 FreqSampleRate;

} ISINE_Params;

typedef struct ISINE_Obj {

struct ISINE_Fxns *fxns;

XDAS_Float32 A;

XDAS_Float32 Y0;

XDAS_Float32 Y1;

XDAS_Float32 Y2;

} ISINE_Obj;

typedef struct ISINE_Obj {

struct ISINE_Fxns *fxns;

XDAS_Float32 A;

XDAS_Float32 Y0;

XDAS_Float32 Y1;

XDAS_Float32 Y2;

} ISINE_Obj;

1. Params

2. Instance Object

And, the 3rd component we discussed?Technical Training

Organization

T TO

Page 30: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

SINE Example: MemTab

Only one - for the Instance Object itself

memTab[0].size = 5;

memTab[0].align = 1;

memTab[0].space = Internal;

memTab[0].attr = 0;

memTab[0].base = buffer0;

IALG_MemRec memTab[1];

int buffer0[5];

The sine algorithm’s MemTab looks like:

How many blocks of memory does the Sine algorithm need?

Note: If an algorithm needs additional memory block, such as data buffers, MemTab would need additional records: e.g. memTab[2]

Technical TrainingOrganization

T TO

Page 31: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

// Initialization CodeISINE_Params sineParams; sineParams = ISINE_PARAMS; // Most algos have a set of default paramssineParams.freqTone = 200; // 200 Hz sineParams.freqSampleRate = 48 * 1024; // 48 KHz IALG_MemRec memTab[1]; // Create table of memory requirements.int buffer0[5]; // Reserve memory for instance objectmemTab[0].base = buffer0; // with 1st element pointing to object itself

ISINE_Handle sineHandle; // Create handle to InstObjsineHandle = memTab[0].base; // Setup handle to InstObjsineHandle->fxns = &SINE_TTO_ISINE; // Set pointer to algo functions

call sineInit // Exact syntax is shown later

// Runtime Processingcall sineValue // To generate a single sinewave value

Application’s Code: Static Sine Example

Star symbols indicate small amount of “extra” code required when using XDAIS Note, extra code only affects initialization of algorithm, not runtime processing This example uses “Static” allocation of memory in application code.

Technical TrainingOrganization

T TO

Page 32: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

Outline Code Integration Problems

Background Terminology

Basic XDAIS Components

XDAIS Example – Sine Wave Algorithm

Algorithm Instance Lifecycle Create, Process, Delete Static vs. Dynamic Lifecycle Examining Algorithm Creation Generic Algorithm 'Create' Function

Lab 11 – Using a XDAIS FIR Algo

Additional Topics

Technical TrainingOrganization

T TO

Page 33: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

Sine Algorithm Functions

Sine Algorithm Functions

SINE_init()

SINE_value()

SINE_blockFill()

Once again, here are the functions from our Sine example:

Why did we group the functions as shown?Technical Training

Organization

T TO

Page 34: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

Algorithm Instance Lifecycle

Algorithm Lifecycle

Static

Create SINE_init()

ProcessSINE_value()

SINE_blockFill()

Delete - none -

Once again, here are the functions from our Sine example:

SINE_init() initializes the memory used by the sine algo

How was this memory allocated?

IALG_MemRec memTab[1]; int buf0[5]; memTab[0].base = buf0;

In the last example, we did it statically:

Can we dynamically instantiate an algorithm?Technical Training

Organization

T TO

Page 35: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

Algorithm Instance Lifecycle

Algorithm Lifecycle

Static Dynamic

CreateSINE_init

algNumAlloc

algAlloc

algInit (aka sineInit)

ProcessSINE_value

SINE_blockFill

SINE_value

SINE_blockFill

Delete - none - algFree

When dynamically instantiating an algorithm, a few more functions are required:

Notice the additional functions,Let's look at the process more closely...

Technical TrainingOrganization

T TO

Page 36: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

Instance Creation - startApplicationFramework Algorithm

Params

1. Here’s the way I want you to perform…

Params = malloc(x);*Params= PARAMS;

Notice the use of dynamic memory

allocation.

And the fact the algo never does the allocation.

Notice the use of dynamic memory

allocation.

And the fact the algo never does the allocation.

Page 37: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

Instance Creation - startApplicationFramework Algorithm

algNumAlloc()

2. How many blocks of memory will you need to do this for me?

3. I’ll need “N” blocks of memory. (N may be based upon a params value)

N

Params

1. Here’s the way I want you to perform…

Params = malloc(x);*Params= PARAMS;

4. I’ll make a place where you can tell me about your memory needs…

MemTab = malloc(5*N) MemTab

Page 38: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

Instance Creation - finishApplicationFramework Algorithm

algAlloc()5. Tell me about your memory requirements…

8. Prepare the new instance to run!

algInit()

MemTabSize

AlignmentSpace

AttributesBase

N

6. I'll enter my needs for each of the N blocks of memory, given these para-meters, into the MemTab…

7. I’ll go get/assign the memory you need…

for(i=0;i<=N;i++) mem = malloc(size);

Params

9. Initialize vars in my instance object using Params & Base’s

InstObjParam1Param2

…Base1Base2

10.Delete MemTab

Now I can run the "processing" functions of the algo.Technical Training

Organization

T TO

Page 39: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

Algorithm Instance Lifecycle

Algorithm Lifecycle

Static Dynamic

CreatealgInit

algNumAlloc

algAlloc

algInit

ProcessSINE_value

SINE_blockFill

SINE_value

SINE_blockFill

Delete - none - algFree

If all algorithms must use these ‘create’ functions, couldn’t we simplify our application code?

Technical TrainingOrganization

T TO

Page 40: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

A Generic Create FunctionCreate

FunctionsReference Framework

Purchased Algorithm

algNumAlloc ()

algAlloc ()

algInit ()

Common for all XDAIS compliant algo’s

These functions specified by XDAIS algorithm standard

Page 41: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

A Generic Create FunctionCreate

FunctionsReference Framework

Purchased Algorithm

algNumAlloc ()

algAlloc () ALGRF_create()

algInit ()

Common for all XDAIS compliant algo’s

These functions specified by XDAIS algorithm standard

One create function can instantiate any XDAIS algo

ALGRF library provided in Reference Frameworks

Reference Frameworks (RF) are discussed further in the next chapter

Page 42: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

A Generic Create FunctionCreate

FunctionsReference Framework

Purchased Algorithm

algNumAlloc ()

algAlloc () ALGRF_create() FIR_create()

algInit ()

Common for all XDAIS compliant algo’s

These functions specified by XDAIS algorithm standard

One create function can instantiate any XDAIS algo

ALGRF library provided in Reference Frameworks

Reference Frameworks (RF) are discussed further in the next chapter

Can be as simple as a single-line function which only calls ALGRF_create

Easier than using ALGRF_create; no complex C casting

Optional function per XDAIS standard

Technical TrainingOrganization

T TO

Page 43: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

Outline Code Integration Problems

Background Terminology

Basic XDAIS Components

XDAIS Example – Sine Wave Algorithm

Algorithm Instance Lifecycle

Lab 11 – Using a XDAIS FIR Filter Algorithm

Additional Topics

Technical TrainingOrganization

T TO

Page 44: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

Lab 11

CPUEDMA

RCVCHAN gBufferRcvADC

DAC

McBSP0

Rcv

Xmt

XMTCHAN gBufferXmt

COPY

+

Pong

Pong

Ping

Ping

Add a xDAIS FIR Filter to system Use filter to eliminate sinewave from audio stream

Flash LEDs and Load

DIP_1

DIP_2

XDAISFilter

Technical TrainingOrganization

T TO

Page 45: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

Additional Topics

XDAIS Rules & Guidelines Documentation Naming Summary

XDAIS Certification TI Third Parties Creating XDAIS Algorithms with

Component Wizard

Technical TrainingOrganization

T TO

Page 46: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

XDAIS Documentation RulesDon’t know how fast it runs … or how much memory it uses.

Strict rules on vendor-provided documentation (PDF file).

Technical TrainingOrganization

T TO

Page 47: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

XDAIS File Naming ConventionWill the function names conflict with other code in the system?

Algorithm must be C callable and re-entrant Strict naming rules virtually eliminate conflicts Similar rules exist for variable and function names

fir_company123_min.l64

AlgorithmModule Name

VendorName

VariantL: libraryh: header62: C62x/C67x64: C64x

fir_company123_max.h62

Technical TrainingOrganization

T TO

Page 48: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

Overview of the XDAIS Rules General “Good Citizen” Software Coding Rules

C callable & Reentrant Naming conventions enforced to avoid symbol clashes No direct peripheral interface or memory allocation Relocatable data and code in both static and dynamic systems No thread scheduling nor any awareness of controlling app Pure data transducer; cannot alter the DSP environment

Standard Algorithm Interface defined by TI Defines a memory management protocol between application

and algorithm for all compliant algorithm modules

Packaging Rules All algorithms packaged and delivered in a consistent format

Documentation Rules Algorithms must provide basic memory and performance

information to enable “apples to apples” comparisons and to aid system designers with algorithm integration

Technical TrainingOrganization

T TO

Page 49: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

Additional Topics

XDAIS Rules & Guidelines Documentation Naming Summary

XDAIS Certification TI Third Parties Creating XDAIS Algorithms with

Component Wizard

Technical TrainingOrganization

T TO

Page 50: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

Improved Software Reliability

All third party compliant algorithms have been submitted to and passed a formal test

TI oversees the test that is fully automated, error free, and unbiased

TI is moving to release the test tool so that customers can self-check their own algorithms

When an algorithm formally passes, the owner gains the right to use the compliant logo

Technical TrainingOrganization

T TO

Page 51: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

3rd Party XDIAS Compliant Algo’s

Make or buy… > 650 companies

in 3rd party network > 1000 algorithms

from > 100 unique 3rd parties

Tools of the Trade

Page 52: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

Code Written by Component Wizard

Technical TrainingOrganization

T TO

Page 53: ‘C6000 Integration Workshop Chapter 11 XDAIS Algorithms Copyright © 2005 Texas Instruments. All rights reserved. Technical Training Organization T TO (pronounced

ti

Technical TrainingOrganization