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

Slides:



Advertisements
Similar presentations
Testing Relational Database
Advertisements

CHAPTER OBJECTIVE: NORMALIZATION THE SNOWFLAKE SCHEMA.
Part IV: Memory Management
R4 Dynamically loading processes. Overview R4 is closely related to R3, much of what you have written for R3 applies to R4 In R3, we executed procedures.
Module R2 CS450. Next Week R1 is due next Friday ▫Bring manuals in a binder - make sure to have a cover page with group number, module, and date. You.
Chapter 7: User-Defined Functions II Instructor: Mohammad Mojaddam.
MotoHawk Training Model-Based Design of Embedded Systems.
File Management Chapter 12. File Management File management system is considered part of the operating system Input to applications is by means of a file.
Copyright © 2008 Pearson Addison-Wesley. All rights reserved. Chapter 12A Separate Compilation and Namespaces For classes this time.
MSIS 110: Introduction to Computers; Instructor: S. Mathiyalakan1 Systems Design, Implementation, Maintenance, and Review Chapter 13.
Chapter 6. 2 Objectives You should be able to describe: Function and Parameter Declarations Returning a Single Value Pass by Reference Variable Scope.
Fundamentals of Information Systems, Second Edition
CS 201 Functions Debzani Deb.
Computer Organization and Architecture
Principle of Functional Verification Chapter 1~3 Presenter : Fu-Ching Yang.
C++ fundamentals.
Design, Implementation and Maintenance
OBJECT ORIENTED PROGRAMMING IN C++ LECTURE
Database Administration Chapter 16. Need for Databases  Data is used by different people, in different departments, for different reasons  Interpretation.
XML, DITA and Content Repurposing By France Baril.
1.Database plan 2.Information systems plan 3.Technology plan 4.Business strategy plan 5.Enterprise analysis Which of the following serves as a road map.
Language Evaluation Criteria
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 18 Slide 1 Software Reuse.
CHP - 9 File Structures. INTRODUCTION In some of the previous chapters, we have discussed representations of and operations on data structures. These.
University of Palestine software engineering department Testing of Software Systems Fundamentals of testing instructor: Tasneem Darwish.
Moving into Design SYSTEMS ANALYSIS AND DESIGN, 6 TH EDITION DENNIS, WIXOM, AND ROTH © 2015 JOHN WILEY & SONS. ALL RIGHTS RESERVED. 1 Roberta M. Roth.
SWE 316: Software Design and Architecture – Dr. Khalid Aljasser Objectives Lecture 11 : Frameworks SWE 316: Software Design and Architecture  To understand.
Operator Precedence First the contents of all parentheses are evaluated beginning with the innermost set of parenthesis. Second all multiplications, divisions,
ELG6163 Presentation Geoff Green March 20, 2006 TI Standard for Writing Algorithms.
Moodle (Course Management Systems). Assignments 1 Assignments are a refreshingly simple method for collecting student work. They are a simple and flexible.
Department of Computer Science A Static Program Analyzer to increase software reuse Ramakrishnan Venkitaraman and Gopal Gupta.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
Principles of Information Systems, Sixth Edition Systems Design, Implementation, Maintenance, and Review Chapter 13.
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
Copyright © 2004 Texas Instruments. All rights reserved. 1.Introduction 2.Real-Time System Design Considerations 3.Hardware Interrupts (HWI) 4.Software.
This chapter is extracted from Sommerville’s slides. Text book chapter
SE: CHAPTER 7 Writing The Program
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 1: Software and Software Engineering.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
Major objective of this course is: Design and analysis of modern algorithms Different variants Accuracy Efficiency Comparing efficiencies Motivation thinking.
TMS320 DSP Algorithm Standard: Overview & Rationalization.
C++ History C++ was designed at AT&T Bell Labs by Bjarne Stroustrup in the early 80's Based on the ‘C’ programming language C++ language standardised in.
An Object-Oriented Approach to Programming Logic and Design Fourth Edition Chapter 6 Using Methods.
Copyright 2004 Scott/Jones Publishing Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 7 Structured Data and Classes.
Static Program Analyses of DSP Software Systems Ramakrishnan Venkitaraman and Gopal Gupta.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
Software Engineering Principles. SE Principles Principles are statements describing desirable properties of the product and process.
Moving Arrays -- 1 Completion of ideas needed for a general and complete program Final concepts needed for Final Review for Final – Loop efficiency.
Object Oriented Software Development
Frameworks CompSci 230 S Software Construction.
1 FUNCTIONS - I Chapter 5 Functions help us write more complex programs.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
Introduction to c++ programming - object oriented programming concepts - Structured Vs OOP. Classes and objects - class definition - Objects - class scope.
Spreadsheet Engineering Builders use blueprints or plans – Without plans structures will fail to be effective Advanced planning in any sort of design can.
Principles of Information Systems, Sixth Edition 1 Systems Design, Implementation, Maintenance, and Review Chapter 13.
EGR 2261 Unit 11 Classes and Data Abstraction  Read Malik, Chapter 10.  Homework #11 and Lab #11 due next week.  Quiz next week.
1 Becoming More Effective with C++ … Day Two Stanley B. Lippman
Chapter 5 Linked List by Before you learn Linked List 3 rd level of Data Structures Intermediate Level of Understanding for C++ Please.
DYNAMIC MEMORY ALLOCATION. Disadvantages of ARRAYS MEMORY ALLOCATION OF ARRAY IS STATIC: Less resource utilization. For example: If the maximum elements.
1 Team Skill 3 Defining the System Part 1: Use Case Modeling Noureddine Abbadeni Al-Ain University of Science and Technology College of Engineering and.
User-Written Functions
Phil Tayco Slide version 1.0 Created Oct 2, 2017
Chapter 5 Designing the Architecture Shari L. Pfleeger Joanne M. Atlee
Course: Module: Lesson # & Name Instructional Material 1 of 32 Lesson Delivery Mode: Lesson Duration: Document Name: 1. Professional Diploma in ERP Systems.
CSE 303 Concepts and Tools for Software Development
Applying Use Cases (Chapters 25,26)
Applying Use Cases (Chapters 25,26)
COMP755 Advanced Operating Systems
Presentation transcript:

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

Goals for Lab 11 CPUEDMA RCVCHAN gBufferRcv ADC DAC McBSP0 Rcv Xmt XMTCHAN gBufferXmt COPY + PongPong PongPong PingPing PingPing Flash LEDs and Load XDAIS Filter DIP_1 DIP_2  Add a xDAIS FIR Filter to system  Filter used to eliminate sinewave from audio stream Technical Training Organization T TO

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

 Reusable  Interoperable  Modular  Interface API - Separate App  Algo  … but still adaptable, low real-time overhead Technical Training Organization T TO

Outline  Integrating Algo’s – Problems  Basic XDAIS Components 1. Parameters(Params) 2. Instance Object 3. Memory Table(Memtab)  Example: Sinewave Algorithm  Static vs. Dynamic Algo Instantiation  Ways to use a XDAIS algorithm  Lab  XDAIS Certification  Documentation  Naming  TI Third Parties  Component Wizard  Other  vTab  Scratch vs. Persistent  “Delete” Instance  iAlg, iMod  What is an instance?  C refresher (pointers to pointers -> pointers Technical Training Organization T TO

Code Integration Problems  Three Integration Issues 1. Using multiple algorithms 2. Re-using the same algorithm 3. Purchasing an algorithm  Traditional Solutions  TI XDAIS Solution Technical Training Organization T TO

1. Using Multiple Algorithms Input Buffer Output Buffer Add Sine Filter What problems might occur when integrating two different algorithms into an application?

1. Using Multiple Algorithms Input Buffer Output Buffer 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

1. Using Multiple Algorithms Input Buffer Output Buffer 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 interrupt or EDMA channel required by another?  Basically, any system resource can cause integration 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

2. Using the Same Algo Multiple Times Input Buffer Output Buffer 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 2 nd sine wave tone? 3.3KHz

2. Using the Same Algo Multiple Times Input Buffer Output Buffer 200Hz  What would happen if you reused the sine algorithm for a 2 nd 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 Training Organization T TO

3. Buying Algorithms Why 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 Training Organization T TO

Traditional Solutions 1. Manually integrate algorithms together by finding all (hopefully) the conflicts and fixing them.

Traditional Solutions 1. 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.

Traditional Solutions 1. 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

Algo Input Output Memory Your Application TI Solution  Modularize algorithms. That is, use a standard interface between: Application  Algorithms Application Programming Interface

TI Solution 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 Training Organization T TO

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) TEXAS INSTRUMENTS XDAIS ti ALGORITHM PRODUCERS  Write once, deploy widely  Or, sell widely Algorithm Application  Off-the-shelf DSP content  Ease of integration  Purchase once, use widely Application Developers Technical Training Organization T TO

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 Training Organization T TO

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 Training Organization T TO

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

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 Training Organization T TO

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  We could think of wrapping all these parts of an algorithm into a code module  Or better yet, let’s just use the term module  In other words, we use the term module when speaking abstractly about any algorithm How can we describe an algorithm's interface? Technical Training Organization T TO

Module (Algorithm) Interface Bottom Line  Think of a modules interface (i.e. IMOD) as its “prototype”  For a module called FIR, its description is called IFIR  What is an Algorithm’s Interface (i.e. Module Interface)?  It’s a description of all the functions, data types and data objects available to the application using the algorithm module  Often, this is called an API (Application Programming Interface)  When speaking abstractly (i.e. in general) about any algorithm module, XDAIS uses the term IMOD (short for MODule Interface)  On the other hand, if you are describing a specific algorithm’s module, a unique interface name is used. For example:  If algorithm’s name is:FIR  We name its interface: IFIR Data Types Data Objects Functions typedef struct IFIR_Parms typedef struct … IFIR_Params myParms IFIR_Object … int filter() … IMODIFIR

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 Training Organization T TO

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?

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 Training Organization T TO

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 *x Technical Training Organization T TO

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: Size Alignment Space Attributes Base Addr MemTab Base: Starting address for block of memory Attributes: Scratch or Persistent memory (discussed later) Space: Internal / External memory

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: Size Alignment Space Attributes Base Addr MemTab Size Alignment Space Attributes Base Size Alignment Space Attributes Base Application  Algo provides info for each block of memory it needs,  Except base address … Algorithm

3. XDAIS Components: Memory Table  MemTab example:  What prevents an algorithm from “taking” too much (critical) memory? Size Alignment Space Attributes Base Addr MemTab Size Alignment Space Attributes Base Size Alignment Space Attributes 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 Training Organization T TO

The vTab Concept and Usage Key: User Vendor Module XDAIS firHandle -> fxns=&FIR_TTO_IFIR ; firHandle -> fxns->ialg.algInit ((IALG_Handle)firHandle, memTab,NULL,(IALG_Params *)&firParams); firHandle -> fxns->filter (firHandle,processSrc,processDst);... … FIR_TTO_initObj … FIR_TTO_filter … IFIR_Fxns alg... algInit alg … filter … instance fxns handle #include typedef struct IFIR_Fxns { IALG_Fxns ialg; /* IFIR extends IALG */ Void (*filter)(IFIR_Handle handle, XDAS_Int8 in[],XDAS_Int8 out[]); } IFIR_Fxns; Program Memory Technical Training Organization T TO

typedef struct IALG_Fxns { Void*implementationId; Void(*algActivate)(...); Int (*algAlloc)(...); Int (*algControl)(...); Void (*algDeactivate)(...); Int (*algFree)(...); Int (*algInit)(...); Void (*algMoved)(...); Int (*algNumAlloc)(...); } IALG_Fxns; typedef struct IALG_Fxns { Void*implementationId; Void(*algActivate)(...); Int (*algAlloc)(...); Int (*algControl)(...); Void (*algDeactivate)(...); Int (*algFree)(...); Int (*algInit)(...); Void (*algMoved)(...); Int (*algNumAlloc)(...); } IALG_Fxns; vTab Structure Technical Training Organization T TO

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 Training Organization T TO

From the SINE.C code, it uses the following Data Elements and Functions Functions sineInit() sineValue() sineBlockFill() float FreqTone, FreqSampleRate; static float A, y[3]; void sineInit() short sineValue() void sineBlockFill () sine.c DataScope FreqToneglobal FreqSampleRateglobal Aglobal Y0global Y1global Y2global Technical Training Organization T TO

SINE Example: Params & InstObj DataScope FreqToneglobal FreqSampleRateglobal Aglobal Y0global Y1global Y2global 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

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 Training Organization T TO

// Initialization Code ISINE_Params sineParams; sineParams = ISINE_PARAMS;// Most algos have a set of default params sineParams.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 object memTab[0].base = buffer0; // with 1 st element pointing to object itself ISINE_Handle sineHandle; // Create handle to InstObj sineHandle = memTab[0].base;// Setup handle to InstObj sineHandle->fxns = &SINE_TTO_ISINE;// Set pointer to algo functions call sineInit // Exact syntax is shown later // Runtime Processing call 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 Training Organization T TO

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 Training Organization T TO

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

Algorithm Instance Lifecycle A lgorithm Lifecycle Static Create SINE_init() Process SINE_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

Algorithm Instance Lifecycle A lgorithm Lifecycle StaticDynamic Create SINE_init algNumAlloc algAlloc algInit (aka sineInit) Process SINE_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 Training Organization T TO

Instance Creation - start Application Framework 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.

Instance Creation - start Application Framework 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

Instance Creation - finish Application Framework Algorithm algAlloc() 5.Tell me about your memory requirements… 8.Prepare the new instance to run! algInit() MemTab Size Alignment Space Attributes Base 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 InstObj Param1 Param2 … Base1 Base2 … 10.Delete MemTab Now I can run the "processing" functions of the algo. Technical Training Organization T TO

Algorithm Instance Lifecycle A lgorithm Lifecycle StaticDynamic Create algInit algNumAlloc algAlloc algInit Process SINE_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 Training Organization T TO

Dynamic (top) vs Static (bottom) n = fxns->ialg. algNumAlloc (); //Determine number of buffers required memTab = (IALG_MemRec *) malloc ( n *sizeof(IALG_MemRec) ); //Build the memTab n = fxns->ialg. algAlloc ((IALG_Params *)params,&fxnsPtr, memTab ); //Inquire buffer needs from alg for (i = 0; i < n ; i++) { //Allocate memory for algo memTab[i].base = (Void *) memalign (memTab[i].alignment, memTab[i]. size ); } alg = (IALG_Handle)memTab[0].base; //Set up handle and *fxns pointer alg->fxns = &fxns->ialg; fxns->ialg. algInit (alg, memTab, NULL, (IALG_Params *)params); // initialize instance object IALG_MemRec memTab[1];// Create table of memory requirements int buffer0[5];// Reserve memory for instance object memTab[0].base = buffer0; // with 1 st element pointing to object itself ISINE_Handle sineHandle; // Create handle to InstObj sineHandle = memTab[0].base;// Setup handle to InstObj sineHandle->fxns = &SINE_TTO_ISINE;// Set pointer to algo functions sineHandle->fxns->ialg. algInit ((IALG_Handle)sineHandle,memTab,NULL,(IALG_Params *)&sineParams);         Luckily, though, you shouldn't have to write this code, because... Technical Training Organization T TO

A Generic Create Function Create Functions Reference Framework Purchased Algorithm algNumAlloc () algAlloc () algInit ()  Common for all XDAIS compliant algo’s  These functions specified by XDAIS algorithm standard

A Generic Create Function Create Functions Reference 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

A Generic Create Function Create Functions Reference 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 Training Organization T TO

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 Training Organization T TO

Lab 11 CPUEDMA RCVCHAN gBufferRcv ADC DAC McBSP0 Rcv Xmt XMTCHAN gBufferXmt COPY + PongPong PongPong PingPing PingPing  Add a xDAIS FIR Filter to system  Use filter to eliminate sinewave from audio stream Flash LEDs and Load DIP_1 DIP_2 XDAIS Filter Technical Training Organization T TO

XDAIS Files IALG.H (TI provides)  Define Standard Interface Functions & Data Types IFIR.H (Vendor Provides)  Define Module-specific Interfaces & Structures  E.g. IFIR_Params, IFIR_Obj, IFIR_Handle typedef’s FIR_TTO.L62 & FIR_TTO.PDF (Vendor Provides)  Algorithm Library Archive & Documentation FIR_TTO.H (Vendor Provides)  Only contains one item  Defines Global Symbol of vTab (table of functions) IFIR.C (Vendor Provides)  Default Values for IFIR_Params FIR.H (Vendor May Provide)  Contains FIR_create & FIR_delete functions  These are framework functions  Not required by algorithm standard (but usually provided) Technical Training Organization T TO

Additional Topics  XDAIS Rules & Guidelines  Documentation  Naming  Summary  XDAIS Certification  TI Third Parties  Creating XDAIS Algorithms with Component Wizard Technical Training Organization T TO

XDAIS Documentation Rules Don’t know how fast it runs … or how much memory it uses. Strict rules on vendor-provided documentation (PDF file). Technical Training Organization T TO

XDAIS File Naming Convention Will 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 Algorithm Module Name Vendor Name Variant L: library h: header 62: C62x/C67x 64: C64x fir_company123_max.h62 Technical Training Organization T TO

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 Training Organization T TO

Additional Topics XDAIS Rules & Guidelines  Documentation  Naming  Summary  XDAIS Certification  TI Third Parties  Creating XDAIS Algorithms with Component Wizard Technical Training Organization T TO

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 Training Organization T TO

3 rd Party XDIAS Compliant Algo’s Make or buy… > 650 companies in 3 rd party network > 1000 algorithms from > 100 unique 3 rd parties Tools of the Trade

Code Written by Component Wizard Technical Training Organization T TO

ti Technical Training Organization

Don't worry about stuff following this slide... For now, at least. Technical Training Organization T TO

Outline  Integrating Algo’s – Problems  Basic XDAIS Components 1. Parameters(Params) 2. Instance Object 3. Memory Table(Memtab)  Example: Sinewave Algorithm  Static vs. Dynamic Algo Instantiation  Ways to use a XDAIS algorithm  Lab  XDAIS Certification  Documentation  Naming  TI Third Parties  Component Wizard  Other  vTab  Scratch vs. Persistent  “Delete” Instance  iAlg, iMod  What is an instance?  C refresher (pointers to pointers -> pointers Technical Training Organization T TO

ISINE_Params sineParams; sineParams = ISINE_PARAMS;// Most algos have a set of default params sineParams.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 object memTab[0].base = buffer0; // with 1 st element pointing to object itself ISINE_Handle sineHandle; sineHandle = memTab[0].base; sineHandle->fxns = &SINE_TTO_ISINE; // call sineInit sineHandle->fxns->ialg.algInit( (IALG_Handle)sineHandle, memTab, NULL, (IALG_Params *)&sineParams); // call sineSingleValue (to generate a single sinewave value sineHandle->fxns->sineSingleValue(sineHandle, gBuf, BUFFSIZE); ISINE_Params sineParams; sineParams = ISINE_PARAMS;// Most algos have a set of default params sineParams.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 object memTab[0].base = buffer0; // with 1 st element pointing to object itself ISINE_Handle sineHandle; sineHandle = memTab[0].base; sineHandle->fxns = &SINE_TTO_ISINE; // call sineInit sineHandle->fxns->ialg.algInit( (IALG_Handle)sineHandle, memTab, NULL, (IALG_Params *)&sineParams); // call sineSingleValue (to generate a single sinewave value sineHandle->fxns->sineSingleValue(sineHandle, gBuf, BUFFSIZE); Technical Training Organization T TO

Outline  Integrating Algo’s – Problems  XDAIS Solution  Detailed look at XDAIS solution  XDAIS Certification  TI Third Parties  Ways to use a XDAIS algorithm  Lab Technical Training Organization T TO

Outline  Integrating Algo’s – Problems  XDAIS Solution  Detailed look at XDAIS solution  XDAIS Certification  TI Third Parties  Ways to use a XDAIS algorithm  Lab Technical Training Organization T TO

XDAIS Solution (4) 4. Will it use memory or peripherals needed by other algo’s?  Application controls all peripherals and memory  Algorithms cannot access peripherals directly  Algorithms cannot allocate their own memory  Pre-defined XDAIS functions provide a common method for algorithms to request resources: Algorithm Application (framework) Memory During algo startup, it ‘requests’ any memory it requires Application grants memory via *address *ptr This sounds great, but what if I want to statically allocate memory? malloc() Technical Training Organization T TO

Supports Static & Dynamic Instances *Note: Static case can also use “algActivate” if algo uses “scratch” memory Static Framework (algorithm lifecycle) Dynamic algInit Create algNumAlloc algAlloc algInit Filter Execute algActivate Filter algDeactivate Delete algFree Technical Training Organization T TO

XDAIS Solution (5) IFIR algorithm: Instance 1 *fxns  Pointer to algo functions *a  Pointer to coefficients *x  Pointer to new data buffer 5. If I want to run the same algo on more than one channel … Technical Training Organization T TO

XDAIS Solution (6) 6. How many interfaces (API’s) do I have to learn? Only one … XDAIS! And, TI provides a tool that essentially writes the XDAIS interface, though you still need to add your magic... Technical Training Organization T TO

firHandle -> fxns=&FIR_TTO_IFIR ; firHandle -> fxns->ialg.algInit ((IALG_Handle)firHandle, memTab,NULL,(IALG_Params *)&firParams); firHandle -> fxns->filter (firHandle,processSrc,processDst); XDAIS Summary Key: User Vendor Module XDAIS... … FIR_TTO_initObj … FIR_TTO_filter … IFIR_Fxns alg... algInit alg … filter … instance fxns handle Program Memory memTab... params Technical Training Organization T TO

Outline  Integrating Algo’s – Problems  XDAIS Solution  Detailed look at XDAIS solution  XDAIS Certification  TI Third Parties  Ways to use a XDAIS algorithm  Lab Technical Training Organization T TO

Outline  Integrating Algo’s – Problems  XDAIS Solution  Detailed look at XDAIS solution  XDAIS Certification  TI Third Parties  Ways to use a XDAIS algorithm  Lab Technical Training Organization T TO

Since the code required to create (i.e. instantiate) a XDAIS algorithm is essentially the same for every function, vendors/users/TI can define efficient Create and Delete functions to be used for all compliant algorithms Putting XDAIS to Use Creating an Instance of an Algorithm 1. Write your own code to dynamically “create” algo  Goal of Lab Write static code to create algo  Example in optional discussion 3. Use “create” function shipped with algo  Many vendors provide a MOD_create function, but the standard doesn’t require it 4. Use a framework “create” function  e.g. ALGRF_create() provided by TI’s “Reference Frameworks” (RF)  RF is covered in the next chapter (Chapter 11) Technical Training Organization T TO

XDAIS API Review Static Algorithm Framework Dynamic Algorithm Create algNumAlloc algAlloc algInit algActivate Filter Execute Filter algDeactivate Delete algFree Technical Training Organization T TO

Outline  Integrating Algo’s – Problems  XDAIS Solution  Detailed look at XDAIS solution  XDAIS Certification  TI Third Parties  Ways to use a XDAIS algorithm  Lab Technical Training Organization T TO

Outline  Why XDAIS? What's in it for me?  How does XDAIS work?  Parts & Terminology of XDAIS  What is a Filter?  Lab 11 – Using a XDAIS Filter Algo Technical Training Organization T TO

Outline  Why XDAIS? What's in it for me? 1. Reusing Memory 2. Sharing Memory 3. Buying off-the-shelf  How does XDAIS work?  Parts & Terminology of XDAIS  What is a Filter?  Lab 11 – Using a XDAIS Filter Algo Technical Training Organization T TO

1. How do you like your memory? #define SIZE 32 int x[SIZE];/*allocate*/ int a[SIZE]; x={…};/*initialize*/ a={…}; filter(…);/*execute*/ “Normal” (static) C Coding #define SIZE 32 x=malloc(SIZE); a=malloc(SIZE); x={…}; a={…}; filter(…); free(a); free(x); “Dynamic” C Coding Create Execute Delete  High-performance DSP users have traditionally used static embedded systems  As DSPs and compilers have improved, the benefits of dynamic systems often allow enhanced flexibility (more threads) at lower costs Technical Training Organization T TO

Algorithm A Persistent A Scratch B Algorithm B Scratch B Physical Memory Persistent BScratch APersistent A Persistent B Scratch A Okay for speed-optimized systems, but may pose problems for systems where minimum memory usage is desired Are you running out of memory?  Scratch : used by algorithm during execution only  Persistent : used to store state information during instance lifespan Technical Training Organization T TO

Physical Memory Algorithm C Scratch Persistent C Algorithm B Scratch Persistent B Algorithm A Scratch Persistent A Scratch Persistent APersistent BPersistent C Usually a: Limited Resource e.g. Internal RAM Often an: Extensive Resource e.g. External RAM 2. Memory Sharing Between Algo's Technical Training Organization T TO

3. Purchase Off-the-Shelf  Buy algorithms “Off the Shelf”  Certified to published standard  Only one interface to learn for all algorithms  Authors can make code available to more users  One purchase, use any memory scheme you want  Solves memory integration problems Algo Input Output Memory Your Application XDAIS is the standard interface specification for DSP algorithms Technical Training Organization T TO

What's in it for me? 1. Reuse Memory 2. Sharing Memory 3. Buy off-the-shelf Summary: Why XDAIS?  CCS-Find/fix Logical bugs  DSP/BIOS-Solves Temporal issues  XDAIS-Manage Memory Resources Memory Temporal Logical Solves Memory Problems during integration Technical Training Organization T TO

Outline  Why XDAIS? What's in it for me?  How does XDAIS work? (CXD)  Create  Execute  Delete  Parts & Terminology of XDAIS  What is a Filter?  Lab 11 – Using a XDAIS Filter Algo Technical Training Organization T TO

Using XDAIS – Basic Steps Application Create Execute Delete Algorithm algNumAlloc algAlloc algInit DSP fxn ex: Filter algFree Technical Training Organization T TO

Support for Scratch Memory StaticApplicationDynamic Create algNumAlloc algAlloc algInit DSP Fxn Ex: Filter Execute DSP Fxn Ex: Filter Delete algFree Applications manage memory – Algorithms use memory Technical Training Organization T TO

Instance Creation - start Application Framework Algorithm algNumAlloc() 2.How many blocks of memory will you need to do this for me? 3.I’ll need “N” blocks of memory to do what you’ve specified… 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 Technical Training Organization T TO

Instance Creation - finish Application Framework Algorithm algAlloc() 5.Tell me about your memory requirements… 8.Prepare an instance to run! algInit() MemTab Size Alignment Type Scr/Per Base 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.Copy Params and memory bases into my instance object… InstObj Param1 Param2 … Base1 Base2 … 10.Delete MemTab Run algo Ready to run AlgoDSP fxn's Technical Training Organization T TO

Outline  Why XDAIS? What's in it for me?  How does XDAIS work?  Parts & Terminology of XDAIS  IALG  IMOD  IFIR example (of IMOD)  “Create” Functions  XDAIS related Files  What is a Filter?  Lab 11 – Using a XDAIS Filter Algo Technical Training Organization T TO

Uniform Interfaces Across Algorithms Your Application  Allocates Memory  I/F to Peripherals  Invoke Algo’s Your Application  Allocates Memory  I/F to Peripherals  Invoke Algo’s Provided by Algorithm Vendor Algorithm  DSP functions  Data transducers Algorithm  DSP functions  Data transducers Technical Training Organization T TO

Uniform Interfaces Across Algorithms Your Application  Allocates Memory  I/F to Peripherals  Invoke Algo’s Your Application  Allocates Memory  I/F to Peripherals  Invoke Algo’s Provided by Algorithm Vendor Algorithm  DSP functions  Data transducers Algorithm  DSP functions  Data transducers Interface  IFIR (IMOD)  Common Functions  Algo Specific DSP Functions Interface  IFIR (IMOD)  Common Functions  Algo Specific DSP Functions  Common XDAIS Functions (IALG) Technical Training Organization T TO

typedef struct IALG_Fxns { Void*implementationId; Void(*algActivate)(...); Int (*algAlloc)(...); Int (*algControl)(...); Void (*algDeactivate)(...); Int (*algFree)(...); Int (*algInit)(...); Void (*algMoved)(...); Int (*algNumAlloc)(...); } IALG_Fxns; typedef struct IALG_Fxns { Void*implementationId; Void(*algActivate)(...); Int (*algAlloc)(...); Int (*algControl)(...); Void (*algDeactivate)(...); Int (*algFree)(...); Int (*algInit)(...); Void (*algMoved)(...); Int (*algNumAlloc)(...); } IALG_Fxns; Common XDAIS Functions (IALG)  Standard set of functions for all algorithms  All XDAIS algo's MUST provide these Note: The ‘I’ in IALG stands for abstract “Interface” algNum algAlloc algInit … IALG_Fxns Technical Training Organization T TO

Specific Algo's Functions (IMOD) DSP fxns … algNum algAlloc algInit … IMOD_Fxns  IMOD says, along with IALG functions there will need to be:  Additional functions Also … Technical Training Organization T TO

IMOD Defined *fxns IMOD_Obj IMOD_Params DSP fxns … algNum algAlloc algInit … IMOD_Fxns IMOD_Handle  IMOD says, along with IALG functions there will need to be:  Additional functions  Instance object  Handle (to the instance object)  Parameter structure Technical Training Organization T TO

IFIR - Example of an IMOD *fxns IFIR_Obj IFIR_Params filter … algNum algAlloc algInit … IFIR_Fxns IFIR_Handle  IMOD says, along with IALG functions there will need to be:  Additional functions  Instance object  Handle (to the instance object)  Parameter structure  IMOD is generic, that is, it only states that the vendor needs to define each of these.  IFIR is a specific example of IMOD (the one used in this workshop) Technical Training Organization T TO

Defining IMOD/IFIR Elements *fxns *a,*x,len, etc. IFIR_Obj IFIR_Params filter … algNum algAlloc algInit … IFIR_Fxns " Instance Object " myHandle IFIR_Handle  Handle:  Created by your application  Points to first location in instance object  Instance Object:  You initialize *fxns with vendor provided constant, rest of object initialized by algInit  Use this to call functions with *fxns: myHandle->fxns->ialg.algInit(...);  Params:  Defines ways user can config algo as provided by vendor; ex: if filter allows varying the # of taps Technical Training Organization T TO

Defining IMOD/IFIR Elements *fxns *a,*x,len, etc. IFIR_Obj IFIR_Params filter … algNum algAlloc algInit … IFIR_Fxns " vTab " " Instance Object " myHandle IFIR_Handle  Handle:  Created by your application  Points to first location in instance object  Instance Object:  You initialize *fxns with vendor provided constant, rest of object initialized by algInit  Use this to call functions with *fxns: myHandle->fxns->ialg.algInit(...);  Params:  Defines ways user can config algo as provided by vendor; ex: if filter allows varying the # of taps  vTab:  Another name for function table Technical Training Organization T TO

Outline  Why XDAIS? What's in it for me?  How does XDAIS work?  Parts & Terminology of XDAIS  What is a Filter?  IFIR implementation of a filter  Lab 11 – Using a XDAIS Filter Algo Technical Training Organization T TO

Sampling  We’re going to sample a real world signal at some rate greater than twice the frequency of interest using an analog to digital converter  …to generate an array of numbers representing our original input: Let’s take a look at one of several filtering methods... ADC  Or, the input might look like this:  We might want to filter this signal to extract or exclude a part of it. Technical Training Organization T TO

DSP Filtering Using an FIR Filter z -1 + x ++ xxx y0 = a0*x0 + a1*x1 + a2*x2 + a3*x3 a0a1a2a3 x0 x3x2 x1 y0 FIR Signal Flow Diagram  Unconditionally stable (no feedback) for (j = 0; j < nout; j++) { sum = 0; for (i = 0; i < nCoeff; i++) sum += in[i + j] * coeff[i]; out[j] = sum >> 15; } Technical Training Organization T TO

Determining Coefficients  Coefficients were calculated with a filter design package  Design specs eliminate the 200 Hz tone  Coefficients are located in coeffs.h Technical Training Organization T TO

Filter Characteristics for IFIR Algo  Params (Create)  Filter Length - # of taps  Frame Length – size of buffers  Coefficient Pointer - coefficients  Memory (Create and Execute)  Instance Object – state information  Working Buffer – processing buffer  Run-time (Execution)  Handle – access to state info. and memory  Source – source address  Destination – destination address Technical Training Organization T TO

Optional Topics  Activate/Deactivate  Algo Deletion (Dynamic)  Static Model Example  Multiple Instances of an Algo  Creating XDAIS Compliant Algo’s  For your own use or to sell  Strategic Advantages Technical Training Organization T TO

Support for Scratch Memory Static Algorithm Framework Dynamic Algorithm Create algNumAlloc algAlloc algInit algActivate Filter Execute Filter algDeactivate Delete algFree Technical Training Organization T TO

Instance Execution Application Framework Algorithm algActivate() To run algorithm: 1.Prepare to execute algorithm… (Any scratch memory assigned to algo must be unused.) 2.Setup scratch memory (Use base addresses from Instance Object, which were assigned during alg creation) algDeactivate() To free up scratch mem: 5.Call deactivate 6.Save any values in scratch needed later to persistent memory 3.Run the algorithm … i.e. filter() Run algo 4.Perform algorithm Technical Training Organization T TO

Optional Topics Activate/Deactivate  Algo Deletion (Dynamic)  Static Model Example  Multiple Instances of an Algo  Creating XDAIS Compliant Algo’s  For your own use or to sell  Strategic Advantages Technical Training Organization T TO

Application Framework Algorithm Instance Delete (Free) If you are done running the algorithm: InstObj Param1 Param2 … Base1 Base2 … 1.Create a new memTab to hold algorithm's memory requirements Size Alignment Type Scr/Per Base 3.Based on algorithm requirements and the base addresses from the instance object, fill- in the new memTab (similar to memAlloc) algFree() 2.Ask the algorithm what memory resources it has 4.Delete/unassign all persistent & scratch memory used by the algorithm. Technical Training Organization T TO

Optional Topics Activate/Deactivate Algo Deletion (Dynamic)  Static Model Example  Multiple Instances of an Algo  Creating XDAIS Compliant Algo’s  For your own use or to sell  Strategic Advantages Technical Training Organization T TO

IFIR_PARAMS 4 0 Static Instance Creation buffer0 [5] firParams size *coeffPtr filterLen frameLen *IFIR_Obj firHandle buffer1[1031] *buffer0 *workBuf *coeff filterLenM1 frameLen *fxns coeff[32] How do you programmatically create, initialize and interface to an instance of an algorithm IFIR_Params firParams; firParams = IFIR_PARAMS; firParams.coeff = coeff; firParams.filterLen = 32; firParams.frameLen = 1000; firParams.coeff = coeff; firParams.filterLen = 32; firParams.frameLen = 1000; IALG_MemRec memTab[2]; int buffer0[5]; short buffer1[1031]; int buffer0[5]; short buffer1[1031]; memTab[0].base = buffer0; memTab[1].base = buffer1; memTab[0].base = buffer0; memTab[1].base = buffer1; IFIR_Handle firHandle; firHandle = memTab[0].base; firHandle->fxns=&FIR_TTO_IFIR; firHandle->fxns->ialg.algInit( (IALG_Handle)firHandle, memTab,NULL, (IALG_Params *)&firParams); firHandle->fxns->filter(firHandle,processSrc,processDst); *workBuf *coeff *workBuf x+x+ FIR_TTO_IFIR IALG_Fxns filter *coeff memTab[2] *base *buffer1 *buffer0 MAIN.C Technical Training Organization T TO

IFIR_PARAMS 4 0 Static Instance Creation buffer0 [5] firParams size *coeffPtr filterLen frameLen *IFIR_Obj firHandle buffer1[1031] *buffer0 *workBuf *coeff filterLenM1 frameLen *fxns coeff[32] How do you programmatically create, initialize and interface to an instance of an algorithm IFIR_Params firParams; firParams = IFIR_PARAMS; firParams.coeff = coeff; firParams.filterLen = 32; firParams.frameLen = 1000; firParams.coeff = coeff; firParams.filterLen = 32; firParams.frameLen = 1000; IALG_MemRec memTab[2]; int buffer0[5]; short buffer1[1031]; int buffer0[5]; short buffer1[1031]; memTab[0].base = buffer0; memTab[1].base = buffer1; memTab[0].base = buffer0; memTab[1].base = buffer1; IFIR_Handle firHandle; firHandle = memTab[0].base; firHandle->fxns=&FIR_TTO_IFIR; firHandle->fxns->ialg.algInit( (IALG_Handle)firHandle, memTab,NULL, (IALG_Params *)&firParams); firHandle->fxns->filter(firHandle,processSrc,processDst); *workBuf *coeff *workBuf x+x+ FIR_TTO_IFIR IALG_Fxns filter *coeff memTab[2] *base *buffer1 *buffer0 MAIN.C  Utility is available to generate code required to “create” static instantiation of an algorithm.  Utility is available along with the Reference Frameworks discussed during the next chapter.  Utility is available to generate code required to “create” static instantiation of an algorithm.  Utility is available along with the Reference Frameworks discussed during the next chapter. Technical Training Organization T TO

Algorithm Documentation : FIR_TTO_MIN.PDF Technical Training Organization T TO

Optional Topics Activate/Deactivate Algo Deletion (Dynamic) Static Model Example  Multiple Instances of an Algo  Creating XDAIS Compliant Algo’s  For your own use or to sell  Strategic Advantages Technical Training Organization T TO

Multiple Instances of an Algorithm algo code... x+x+ vtab x_hist[31] instObj * IALG_Fxns *a *x *x_hist handle a[32] x[1031] instObj2 * IALG_Fxns *a *x *x_hist handle2 x_hist[31] x[1031] All instance objects point to the same vtab Allocate, Activate as many instances as desired Uniquely named handles allow control of individual instances of the same algorithm Coefficient array can be shared Scratch can be common or separate as desired Technical Training Organization T TO

Optional Topics Activate/Deactivate Algo Deletion (Dynamic) Static Model Example Multiple Instances of an Algo  Creating XDAIS Compliant Algo’s  For your own use or to sell  Strategic Advantages Technical Training Organization T TO

Optional Topics Activate/Deactivate Algo Deletion (Dynamic) Static Model Example Multiple Instances of an Algo Creating XDAIS Compliant Algo’s  For your own use or to sell  Strategic Advantages Technical Training Organization T TO

XDAIS Strategic Question: Make vs. Buy ? 1. Faster Time to Market 2. Reduced Software Development Costs 3. Improved Software Reliability 4. Ability to Leverage Special Expertise 5. “Off the Shelf” Convenience Technical Training Organization T TO

Faster Time to Market Won’t I spend just as much – or more – time integrating a purchased algorithm into my system than just writing it myself? Prior to the standard, integration effort could be quite substantial, as it often happened that new software would conflict with existing components. However, the XDAIS rules were developed to assure problem- free component integration, eliminating this concern. Technical Training Organization T TO

Reduced Software Development Costs Isn’t purchasing algorithms adding expense ? What are the present costs for: Authoring (engineering time + overhead) Debug, Verification Lost time to market (profit, reputation) If analyzing all the above indicates it’s better to make a given algorithm than buy it, then write your own – with XDAIS. If other algorithms are better bought than made, then XDAIS allows their integration into your system with no complications stemming from their ‘foreign’ authorship… Technical Training Organization T TO

Ability to Leverage Special Expertise Are all the aspects of every system you will build completely covered by in-house expertise? Is that expertise available when you need it? Outside expertise can be ‘rented’ instead of ‘bought’ when needed for solving problems outside the expertise or interests of your company. Why spend the time becoming an expert in a splinter topic if it slows your time to market? Instead, spend that time becoming better yet at what you do best. Trade the time being broad for the ability to achieve greater depth in the areas that differentiate your company. Technical Training Organization T TO

Performance Interfacing Power Size Ease-of Use Programming Interfacing Debugging Integration Memory Peripherals Cost Device cost System cost Development cost Time to market Ability to Select “Best in Class” per Algo… Technical Training Organization T TO

Applications Can Leverage Multiple Vendors Set of all Compliant Algorithms produced by each Vendor Set of all DSP Applications that incorporate algorithms A1A1 V1V1 V2V2 VNVN A2A2 ANAN..... An application can use compliant algorithms from multiple vendors  For consumers: allows greater selection  For vendors: larger potential market Technical Training Organization T TO

Vendors Can Sell to Multiple Applications Set of all Compliant Algorithms produced by each Vendor Set of all DSP Applications that incorporate algorithms A1A1 V1V1 V2V2 VNVN A2A2 ANAN..... A compliant algorithm can be inserted into any application  For vendors: larger potential market  For consumers: yields larger number of algorithms available Technical Training Organization T TO

Make vs. Buy decision process  Step 1: Identify system requirements in terms of functionality, performance, time, cost requirements.  Step 2: Select a TI DSP to meet your needs and determine the software needs to meet the system requirements.  Step 3: Do you have, or will you be hiring, programmers to program the DSP.  If no, then you are heading towards a buy type decision.  If yes, then there are additional questions to consider  Is the software already written and available for sale. If it is, then ask how much value you will add by writing the function yourself. Can you afford the time? The risk involved in “doing it alone”?  What additional functionality would/could you add if you purchased off the shelf software components Technical Training Organization T TO

Make vs. Buy - Summary  Ask yourself the question - “Am I building something I could buy?”  Analyze carefully what value is being added by “doing it alone”.  Be creative in thinking about what else could be ADDED to the current product if the “already written” components were purchased.  Evaluate the risk of trying to build complex components yourself when someone else has already done most of the hard work.  Once you start shopping, request only xDAIS compliant algorithms. Technical Training Organization T TO

XDAIS Strategy : Concerns… Tactical Requirements : 1. Static vs. Dynamic Algorithms 2. Memory Reuse Amongst Algorithms 3. Uniform Algorithm Interface 4. Improved Software Modularity 5. Multiple Instances of Algorithms 6. Improved Re-usability of Algorithms Strategic Benefits : 1. Faster Time to Market 2. Reduced Software Development Costs 3. Improved Software Reliability 4. Ability to Leverage Special Expertise 5. “Off the Shelf” Convenience 6. Concerns 7. System Software Paradigm Technical Training Organization T TO

Today, it’s difficult to integrate algorithms from more than a single source into a DSP system Challenges that lead to an increase in application development time:  Lack of documentation  Non-standardized performance characterization  Competition for resources, notably memory & peripherals  Code or data cannot be relocated in different memory spaces Problems with Lack of Standards CODE SIZE DIFFICULTY TMS320™ DSP Memory Peripherals Alg Application Alg Technical Training Organization T TO

Third party software is too expensive…  Are you aware of all the “hidden” costs of doing it alone?  Optimization time  Testing time - interoperability, eXpressDSP compliance, quality etc.  Maintenance time  How confident are you in your internal estimate  Convert cost in $ to number of your man weeks/months  Make an estimate of the time and what it is worth  Determine what else you could do with that time  Third party competition  Often more than one vendor, thus driving down acquisition costs  Reduce Risk  Third party software is probably already complete and shipping elsewhere. You’re probably just about to get started! Technical Training Organization T TO

Will the 3 rd Party Author be around tomorrow?  Many common algorithms now have a second source  Second source algorithms should also be eXpressDSP compliant and a substitution will be easy  Suggest the possibility of setting up a source code “escrow” account between you and third party in the unlikely event 3P does go out of business. Technical Training Organization T TO

Don’t We Need the Source Code, Too ?  What will do with the algorithm source code  Unlikely you’ll want or be able to modify the core algorithm  Modify the interfaces to the algorithm for integration purposes?  The algorithm standard removes the need to alter any of the interfaces  Concerned that third party will go out of business?  See previous objection  Arrange an escrow account to store the source code  Consider buying a source code license  However, source code is often 3-5 times more expensive than object code Technical Training Organization T TO

What About Indemnification?  Indemnification protects you from the demands of intellectual property holders - usually patent holders  Some third parties can offer indemnification  TI offers several bundled solutions that include indemnification  Check with your local salesperson or sales rep. for further details. Technical Training Organization T TO

Is What I Need Available ?  First step is to check the most recent listing of already compliant algorithms  DSP Village -> TMS320 DSP Algorithm Standard -> Algorithms  Second step is to contact TI sales rep.  They have access to a list of what algorithms are in process and when they will become available  They also have the means to make an “New Algorithm Request”  Within 5 days you will be get some feedback on possible availability. Technical Training Organization T TO

Can I Use Software From Multiple Sources ?  XDAIS was created specifically to allow users the ability to integrate algorithms from different sources!  Having both vendors provide eXpressDSP compliant code will ensure a much smoother system integration experience.  Consider requesting that one third party act as a general contractor and let them sub-contract the other required components in the system. Technical Training Organization T TO

How Do I Create XDAIS Algorithms ?  This is good practice, especially when your algorithms must be matched to someone else’s compliant algorithm.  Follow the appropriate application notes for making algorithms compliant the standard  SPRU352, SPRU360, SPRA579.  Use the tooling provided in our Code Composer Studio development tools to help with standard template generation  Consider attending one of our 3 day training classes to become truly proficient in the compliance technology  Check  Algorithm Standard  Training Technical Training Organization T TO

Should I Use Code From a Vendor Far Away ?  One of the primary benefits of the Algorithm Standard is that it reduces the need to talk to the vendor.  Contact your sales rep. They should be able to leverage a team inside of TI that specializes in third party operations. Technical Training Organization T TO

XDAIS Procedure Application Create Execute Delete Algorithm algNumAlloc algAlloc algInit DSP fxn ex: Filter algFree Technical Training Organization T TO

XDAIS Procedure (1) 1. Add the following files to your project Technical Training Organization T TO

XDAIS Procedure (2)  Add three headers files (IFIR.H, IALG.H, FIR_TTO.H)  Create Handle:  IFR_Handle myHandle;  Create and initialize Params to defaults:  IFIR_Params myParams = IFIR_PARAMS;  Initialize additional params Technical Training Organization T TO

XDAIS Procedure (3)  "Create Algorithm" function  int n;  IFIR_Obj myInstance;  myHandle = &myInstance;  myHandle->fxns = &FIR_TTO_IFR;  n = myHandle algNumAlloc Technical Training Organization T TO

Outline  Integrating Algo’s – Problems  Basic XDAIS Components 1. Parameters(Params) 2. Instance Object 3. Memory Table(Memtab)  Example: Sinewave Algorithm  Sinewave code from preceding labs 1. Parameters(Params) 2. Instance Object 3. Memory Table(Memtab)  Code Example  XDAIS Certification  Documentation  Naming  TI Third Parties  Ways to use a XDAIS algorithm  Lab Technical Training Organization T TO