Texas Instruments TMS320 DSP User Manual Page 1

Browse online or download User Manual for Decoders Texas Instruments TMS320 DSP. Texas Instruments TMS320 DSP User's Manual

  • Download
  • Add to my manuals
  • Print
  • Page
    / 88
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 0
TMS320 DSP Algorithm Standard
Rules and Guidelines
User's Guide
Literature Number: SPRU352G
June 2005 Revised February 2007
Page view 0
1 2 3 4 5 6 ... 87 88

Summary of Contents

Page 1 - User's Guide

TMS320 DSP Algorithm StandardRules and GuidelinesUser's GuideLiterature Number: SPRU352GJune 2005 – Revised February 2007

Page 2 - Submit Documentation Feedback

www.ti.com1.1 Scope of the StandardRules for TMS320C2xLevel 1Level 2Level 3Level 4TelecomRules for TMS320C5x Rules for TMS320C6xImaging Audio Automoti

Page 3 - Contents

www.ti.com1.1.1 Rules and Guidelines1.2 Requirements of the StandardRequirements of the StandardLevel 3 contains the guidelines for specific families

Page 4

www.ti.com1.3 Goals of the Standard1.4 Intentional OmissionsGoals of the StandardThis section contains the goals of this standard. While it may not be

Page 5

www.ti.com1.5 System ArchitectureALGALGALGFrameworkStatusCmdStatusCmdCore run time support1.5.1 FrameworksSystem ArchitectureTo support the ability of

Page 6

www.ti.com1.5.2 Algorithms1.5.3 Core Run-Time SupportSystem ArchitectureCareful inspection of the various frameworks in use reveals that, at some leve

Page 7 - Read This First

Chapter 2SPRU352G – June 2005 – Revised February 2007General Programming GuidelinesIn this chapter, we develop programming guidelines that apply to al

Page 8 - Text Conventions

www.ti.com2.1 Use of C Language2.2 Threads and Reentrancy2.2.1 ThreadsUse of C LanguageAlmost all recently developed software modules follow these com

Page 9 - Overview

www.ti.com2.2.2 Preemptive vs. Non-Preemptive Multitasking2.2.3 ReentrancyThreads and ReentrancyNon-preemptive multitasking relies on each thread to v

Page 10 - 1.1 Scope of the Standard

www.ti.com2.2.4 Exampleyn+ xn* xn*1)1332xn*2Threads and ReentrancyThe definition of reentrant code often implies that the code does not retain "s

Page 11 - 1.1.1 Rules and Guidelines

www.ti.com2.3 Data MemoryData Memoryvoid PRE_filter1(int input[], int length, int *z){int I, tmp;for (I = 0; I< length; I++) {tmp = input[i] - z[0]

Page 12 - 1.4 Intentional Omissions

2 SPRU352G – June 2005 – Revised February 2007Submit Documentation Feedback

Page 13 - 1.5.1 Frameworks

www.ti.com2.3.1 Memory Spaces2.3.2 Scratch versus PersistentData MemoryWhile the amount of on-chip data memory may be adequate for each algorithm in i

Page 14 - 1.5.3 Core Run-Time Support

www.ti.comScratchAlgorithm AScratchAlgorithm BWrite-Once CScratchAlgorithm CScratchPhysicalMemoryPersistent BPersistent APersistent A Persistent B Wri

Page 15 - Chapter 2

www.ti.com2.3.3 Algorithm versus ApplicationPersistentScratchShared PrivateShadowData MemoryGuideline 1Algorithms should minimize their persistent dat

Page 16 - 2.2.1 Threads

www.ti.com2.4 Program Memory2.5 ROM-abilityProgram MemoryLike the data memory requirements described in the previous section, it is important that all

Page 17 - 2.2.3 Reentrancy

www.ti.com2.6 Use of PeripheralsUse of PeripheralsRule 5Algorithms must characterize their ROM-ability; i.e., state whether or not they are ROM-able.O

Page 18 - 2.2.4 Example

Chapter 3SPRU352G – June 2005 – Revised February 2007Algorithm Component ModelIn this chapter, we develop additional rules and guidelines that apply t

Page 19 - 2.3 Data Memory

www.ti.com3.1 Interfaces and Modulesclient.c#include <fir.h> ...FIR_apply();}fir.htypedef struct FIR_obj *FIR_Handle;extern void FIR_init();ext

Page 20 - 2.3.1 Memory Spaces

www.ti.com3.1.1 External IdentifiersInterfaces and ModulesRule 7All header files must support multiple inclusions within a single source file.The gene

Page 21 - Data Memory

www.ti.com3.1.2 Naming Conventions3.1.3 Module Initialization and Finalization3.1.4 Module Instance ObjectsInterfaces and ModulesTo simplify the way e

Page 22

www.ti.comFIR_Config FIR;FIR_init();FIR_exit();FIR_create();FIRfirObjectCreates firObjectFIRFIR_create();CreatesfirObjectInt length;Int coeff[];Int de

Page 23 - 2.5 ROM-ability

ContentsPreface ... 71 Ove

Page 24 - 2.6 Use of Peripherals

www.ti.com3.1.7 Module Configuration3.1.8 Example ModuleInterfaces and ModulesGuideline 4All modules that support object creation should support run-t

Page 25 - Algorithm Component Model

www.ti.com3.1.9 Multiple Interface SupportInterfaces and Modulestypedef struct FIR_Obj { /* FIR_Obj definition */int hist[16]; /* previous input value

Page 26 - 3.1 Interfaces and Modules

www.ti.com3.1.10 Interface Inheritance3.1.11 SummaryInterfaces and Modulesmodule's header file defines a concrete interface; the functions define

Page 27 - 3.1.1 External Identifiers

www.ti.com3.2 AlgorithmsIALGIALG_FxnsFIR_Config FIR;FIR_init();FIR_exit();FIR_Fxcs FIR_IALG;FIRImplementsAlgorithmsElement Description RequiredModule&

Page 28 - 3.1.4 Module Instance Objects

www.ti.com3.3 Packaging3.3.1 Object CodePackagingRule 13Each of the IALG methods implemented by an algorithm must be independently relocatable.In prac

Page 29 - Interfaces and Modules

www.ti.com3.3.2 Header Files3.3.3 Debug Verses ReleasePackaging<module> is the name of the module (containing characters from the set [a-z0-9]),

Page 30 - 3.1.8 Example Module

www.ti.comPackagingIf multiple versions of the same component are provided by a single vendor, the different versions must bein different libraries (a

Page 31

Chapter 4SPRU352G – June 2005 – Revised February 2007Algorithm Performance CharacterizationIn this chapter, we examine the performance information tha

Page 32 - 3.1.11 Summary

www.ti.com4.1 Data Memory4.1.1 Heap MemoryData MemoryThe only resources consumed by eXpressDSP-compliant algorithms are MIPS and memory. All I/O,perip

Page 33 - 3.2 Algorithms

www.ti.com4.1.2 Stack Memory4.1.3 Static Local and Global Data MemoryData MemoryIn the example above, the algorithm requires 960 16-bit words of singl

Page 34 - 3.3.1 Object Code

4 Algorithm Performance Characterization ... 374.1 Data Memory...

Page 35 - 3.3.3 Debug Verses Release

www.ti.com4.2 Program MemoryProgram MemoryAlgorithms must characterize their static data memory requirements by filling out a table such as thatillust

Page 36 - Packaging

www.ti.com4.3 Interrupt Latency4.4 Execution Time4.4.1 MIPS Is Not EnoughInterrupt LatencyCodeCode Sections Size Aligna.obj(.text) 768 0b.obj(.text) 1

Page 37 - Chapter 4

www.ti.com3 ms 3 ms 3 ms 3 msABIdle4.4.2 Execution Time ModelExecution TimeFigure 4-1. Execution Timeline for Two Periodic TasksIn this case, both tas

Page 38 - 4.1.1 Heap Memory

www.ti.comExecution TimeExecution time should be expressed in instruction cycles whereas the period expressed in microseconds.Worst-case execution tim

Page 39 - 4.1.2 Stack Memory

www.ti.comAlgorithm Performance Characterization44 SPRU352G – June 2005 – Revised February 2007Submit Documentation Feedback

Page 40 - 4.2 Program Memory

Chapter 5SPRU352G – June 2005 – Revised February 2007DSP-Specific GuidelinesThis chapter provides guidelines for creating eXpressDSP-compliant algorit

Page 41 - 4.4.1 MIPS Is Not Enough

www.ti.com5.1 CPU Register TypesRead−only Scratch PreserveInitGlobalLocalRead−writeCPU Register TypesDSP algorithms are often written in assembly lang

Page 42 - 4.4.2 Execution Time Model

www.ti.com5.2 Use of Floating Point5.3 TMS320C6xxx Rules and Guidelines5.3.1 Endian Byte Ordering5.3.2 Data Models5.3.3 Program ModelUse of Floating P

Page 43 - Execution Time

www.ti.com5.3.4 Register Conventions5.3.5 Status RegisterTMS320C6xxx Rules and GuidelinesIn addition, no algorithm may ever directly manipulate the ca

Page 44

www.ti.com5.3.6 Interrupt Latency5.4 TMS320C54xx Rules and Guidelines5.4.1 Data Models5.4.2 Program ModelsTMS320C54xx Rules and GuidelinesCSR Field Us

Page 45 - DSP-Specific Guidelines

6.2 Algorithm and Framework ... 626.3 Requirements for the Use of

Page 46 - 5.1 CPU Register Types

www.ti.comTMS320C54xx Rules and GuidelinesThere are, of course, cases where it would be desirable that the core run-time support is accessible withnea

Page 47 - 5.3.3 Program Model

www.ti.com5.4.3 Register Conventions5.4.4 Status RegistersTMS320C54xx Rules and GuidelinesThis section describes the rules and guidelines that apply t

Page 48 - 5.3.5 Status Register

www.ti.com5.4.5 Interrupt Latency5.5 TMS320C55x Rules and Guidelines5.5.1 Stack Architecture5.5.2 Data ModelsTMS320C55x Rules and GuidelinesST1 Field

Page 49 - 5.4.2 Program Models

www.ti.com5.5.3 Program Models5.5.4 RelocatabilityTMS320C55x Rules and GuidelinesRule 32All C55x algorithms must access all static and global data as

Page 50

www.ti.com5.5.5 Register ConventionsTMS320C55x Rules and GuidelinesIf the algorithm does not use B-bus, then the first column must be zero. If there i

Page 51 - 5.4.4 Status Registers

www.ti.com5.5.6 Status BitsTMS320C55x Rules and GuidelinesThe C55xx contains four status registers: ST0, ST1, ST2 and ST3.ST0 Field Name Use TypeACOV2

Page 52 - 5.5.2 Data Models

www.ti.comTMS320C55x Rules and GuidelinesST3 Field Name Use TypeHOMY Host only access mode Read-only (global)HOMX Host only access mode Read-only (glo

Page 53 - 5.5.4 Relocatability

www.ti.com5.6 TMS320C24xx Guidelines5.6.1 GeneralTMS320 DSP Standard Algorithms vs. DCS Modules The C24xx family of DSPsare classified as DSP controll

Page 54 - 5.5.5 Register Conventions

www.ti.com5.6.5 Status Registers5.6.6 Interrupt Latency5.7 TMS320C28x Rules and Guidelines5.7.1 Data ModelsTMS320C28x Rules and GuidelinesRegister Use

Page 55 - 5.5.6 Status Bits

www.ti.com5.7.2 Program Models5.7.3 Register Conventions5.7.4 Status RegistersTMS320C28x Rules and GuidelinesOnly large memory model is supported for

Page 56

List of Figures1-1 TMS320 DSP Algorithm Standard Elements ... 101-2 DSP Softwa

Page 57 - 5.6.4 Register Conventions

www.ti.com5.7.5 Interrupt LatencyTMS320C28x Rules and GuidelinesST1 Field Name Use TypeARP Auxiliary register pointer Scratch (local)XF XF pin status

Page 58 - 5.7.1 Data Models

Chapter 6SPRU352G – June 2005 – Revised February 2007Use of the DMA ResourceThe direct memory access (DMA) controller performs asynchronously schedule

Page 59 - 5.7.4 Status Registers

www.ti.com6.1 Overview6.2 Algorithm and FrameworkOverviewRule 6 states that "Algorithms must never directly access any peripheral device. This in

Page 60 - 5.7.5 Interrupt Latency

www.ti.com6.3 Requirements for the Use of the DMA Resource6.4 Logical ChannelRequirements for the Use of the DMA Resourcethrough the logical DMA chann

Page 61 - Use of the DMA Resource

www.ti.com6.5 Data Transfer PropertiesElem0 Elem1 Elem2 Elem3Gaps betweenelementsElement indexFrameElement sizeFrame 0Frame 1Frame N-1Number offrames

Page 62 - 6.2 Algorithm and Framework

www.ti.com6.7 Abstract InterfaceAbstract InterfaceDMA Guideline 1The data transfer should complete before the CPU operations executing in parallel.How

Page 63 - 6.4 Logical Channel

www.ti.com6.8 Resource CharacterizationResource CharacterizationDMA Rule 3Each of the IDMA2 or IDMA3 methods implemented by an algorithm must be indep

Page 64 - 6.5 Data Transfer Properties

www.ti.com6.9 Runtime APIs6.10 Strong Ordering of DMA Transfer RequestsRuntime APIsFor example, in the table above, the "process" operation

Page 65 - 6.7 Abstract Interface

www.ti.com6.11 Submitting DMA Transfer Requests6.12 Device Independent DMA Optimization GuidelineSubmitting DMA Transfer RequestsThe specification of

Page 66 - 6.8 Resource Characterization

www.ti.com6.13 C6xxx Specific DMA Rules and Guidelines6.13.1 Cache Coherency Issues for Algorithm ProducersYX = 0ldY = newXL2 cache External memoryDMA

Page 67 - 6.9 Runtime APIs

PrefaceSPRU352G – June 2005 – Revised February 2007Read This FirstThis document defines a set of requirements for DSP algorithms that, if followed, al

Page 68

www.ti.comVX = 0ldY = newVXL2 cache External memoryYDMACache line6.14 C55x Specific DMA Rules and Guidelines6.14.1 Supporting Packed/Burst Mode DMA Tr

Page 69

www.ti.com6.14.2 Minimizing Logical Channel Reconfiguration Overhead6.14.3 Addressing Automatic Endianism Conversion Issues6.15 Inter-Algorithm Synchr

Page 70

www.ti.comDMA/CPU idleCPU context switchCPU/DMA activeAlgorithm AactiveAlgorithm BactiveCPU context(timeline)DMA context(timeline)1 2 3 4 56.15.3 Pree

Page 71 - 6.15.1 Non-Preemptive System

www.ti.comDMA/CPU idleCPU context switchCPU/DMA activeAlgorithm AactiveAlgorithm Bactive activeAlgorithm ACPU context(timeline)DMA context(timeline)1

Page 72 - 6.15.3 Preemptive System

www.ti.comInter-Algorithm SynchronizationIt is important to notice that preemptive systems might have groups of algorithms that execute with thesame p

Page 73

Appendix ASPRU352G – June 2005 – Revised February 2007Rules and GuidelinesThis appendix gathers together all rules and guidelines into one compact ref

Page 74

www.ti.comA.1 General RulesGeneral RulesRecall that rules must be followed in order for software to be eXpressDSP-compliant. Guidelines, on theother h

Page 75 - Rules and Guidelines

www.ti.comA.2 Performance Characterization RulesA.3 DMA RulesPerformance Characterization RulesRule 25 — All C6x algorithms must be supplied in little

Page 76 - A.1 General Rules

www.ti.comA.4 General GuidelinesGeneral GuidelinesDMA Rule 3 — Each of the IDMA2 methods implemented by an algorithm must be independentlyrelocateable

Page 77 - A.3 DMA Rules

www.ti.comA.5 DMA GuidelinesDMA GuidelinesGuideline 12 — All C6x algorithms should be supplied in both little- and big-endian formats. (SeeSection 5.3

Page 78 - A.4 General Guidelines

www.ti.comRelated Documentation• Chapter 6 - Use of the DMA Resource, develops guidelines and rules for creatingeXpressDSP-compliant algorithms that u

Page 79 - A.5 DMA Guidelines

www.ti.comRules and Guidelines80 SPRU352G – June 2005 – Revised February 2007Submit Documentation Feedback

Page 80

Appendix BSPRU352G – June 2005 – Revised February 2007Core Run-Time APIsThis appendix enumerates all acceptable core run-time APIs that may be referen

Page 81 - Core Run-Time APIs

www.ti.comB.1 TI C-Language Run-Time Support LibraryB.2 DSP/BIOS Run-time Support LibraryTI C-Language Run-Time Support LibraryRecall that only a subs

Page 82

C.1 BooksC.2 URLSAppendix CSPRU352G – June 2005 – Revised February 2007BibliographyThis appendix lists sources for additional information.Dialogic, Me

Page 83 - Bibliography

www.ti.comBibliography 84 SPRU352G – June 2005 – Revised February 2007Submit Documentation Feedback

Page 84

D.1 Glossary of TermsAppendix DSPRU352G – June 2005 – Revised February 2007GlossaryAbstract Interface — An interface defined by a C header whose funct

Page 85 - Glossary

www.ti.comGlossary of TermsEndian — Refers to which bytes are most significant in multi-byte data types. In big-endian architectures,the leftmost byte

Page 86 - Glossary of Terms

www.ti.comGlossary of TermsScheduling — The process of deciding what thread should execute next on a particular CPU. It is usuallyalso taken as involv

Page 87

IMPORTANT NOTICE Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, modifications, enhancements, improve

Page 88

Chapter 1SPRU352G – June 2005 – Revised February 2007OverviewThis chapter provides an overview of the TMS320 DSP Algorithm Standard.Topic ....

Comments to this Manuals

No comments