Analog Devices VISUALDSP++ 3.5 Manual
Analog Devices VISUALDSP++ 3.5 Manual

Analog Devices VISUALDSP++ 3.5 Manual

C/c++ compiler and library for adsp-219x processors
Hide thumbs Also See for VISUALDSP++ 3.5:
Table of Contents

Advertisement

Quick Links

3.5
W
C/C++ Compiler and Library
Manual for ADSP-219x Processors
Revision 4.1, October 2003
Part Number:
82-000390-03
Analog Devices, Inc.
One Technology Way
Norwood, Mass. 02062-9106

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the VISUALDSP++ 3.5 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Analog Devices VISUALDSP++ 3.5

  • Page 1 C/C++ Compiler and Library Manual for ADSP-219x Processors Revision 4.1, October 2003 Part Number: 82-000390-03 Analog Devices, Inc. One Technology Way Norwood, Mass. 02062-9106...
  • Page 2: Copyright Information

    Analog Devices, Inc. Printed in the USA. Disclaimer Analog Devices, Inc. reserves the right to change this product without prior notice. Information furnished by Analog Devices is believed to be accurate and reliable. However, no responsibility is assumed by Analog Devices for its use;...
  • Page 3: Table Of Contents

    Online Technical Documentation ......... xxxiv From VisualDSP++ ............xxxiv From Windows ..............xxxv From the Web ..............xxxv Printed Manuals ..............xxxvi VisualDSP++ Documentation Set ........xxxvi Hardware Manuals ............xxxvi Datasheets ............... xxxvi VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 4 ..............1-21 -@ filename ..............1-22 -A name(tokens) ............1-22 -alttok ................1-23 -bss ................1-23 -build-lib ..............1-24 -C ................1-24 -c ................. 1-24 -const-read-write ............1-24 -Dmacro[=definition] ........... 1-24 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 5 -I- ................. 1-29 -I directory [{,|;} directory...] ......... 1-29 -i .................. 1-30 -include filename ............1-30 -ipa ................1-30 -jump-{dm|pm|same} ............ 1-31 -L directory [{,|;} directory...] ........1-31 -l library ............... 1-31 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 6 -no-fp-associative ............1-34 -no_hardware_pc_stack ..........1-35 -no-mem ..............1-35 -no-std-ass ..............1-35 -no-std-def ..............1-35 -no-std-inc ..............1-35 -no-std-lib ..............1-36 -no-widen-muls ............1-36 -nothreads ..............1-36 -O ................1-37 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 7 -proc processor .............. 1-41 -R directory [{;|,}directory …] ........1-42 -R- ................1-43 -reserve register[, register …] ......... 1-43 -S ................. 1-43 -s .................. 1-43 -save-temps ..............1-44 -show ................1-44 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 8 -W {error|remark|suppress|warn} [.number...] ....1-49 -Werror-limit number ........... 1-49 -Wremarks ..............1-49 -Wterse ................. 1-49 -w ................1-50 -warn-protos ..............1-50 -workaround <workaround>[,<workaround>]* ....1-50 -write-files ..............1-50 -write-opts ..............1-50 viii VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 9 Assembly Constructs and Macros ........1-77 Assembly Constructs and Flow Control ......1-77 Dual Memory Support Keywords (pm dm) ......1-78 Memory Keywords and Assignments/Type Conversions ..1-80 Memory Keywords and Function Declarations/Pointers ..1-81 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 10 Compiler Built-In Functions ..........1-94 Access to System Registers ..........1-95 I/O Space Read or Write ........... 1-97 Interrupt Control ............. 1-98 Mode Control ..............1-99 Near and Far Type Qualifiers ..........1-99 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 11 ETSI Support for Data Types .......... 1-110 ETSI Header File ............1-111 Pragmas ................1-119 Data Alignment Pragmas ..........1-121 #pragma align num ............. 1-121 #pragma pad (alignopt) ..........1-121 Interrupt Handler Pragmas ..........1-122 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 12 Template Instantiation Pragmas ........1-134 #pragma instantiate instance ........1-135 #pragma do_not_instantiate instance ......1-136 #pragma can_instantiate instance ........ 1-136 Header File Control Pragmas .......... 1-136 #pragma hdrstop ............1-136 #pragma no_pch ............1-137 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 13 Function, Variable and Type Attribute Keyword (__attribute__) 1-146 Preprocessor Features ..............1-147 Predefined Preprocessor Macros ........... 1-147 Header Files ................ 1-149 Writing Preprocessor Macros ..........1-149 Preprocessing of .IDL Files ..........1-151 VisualDSP++ 3.5 C/C++ Compiler and Library Manual xiii for ADSP-219x DSPs...
  • Page 14 Complete List of Registers ..........1-163 File I/O Support ..............1-166 Extending I/O Support To New Devices ......1-166 C/C++ and Assembly Language Interface ........1-169 Calling Assembly Subroutines from C/C++ Programs ... 1-170 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 15 Trying Pointer and Indexed Styles ........2-12 Function Inlining ..............2-13 Using Inline asm Statements ..........2-14 Memory Usage ..............2-15 Loop Guidelines ................. 2-17 Keeping Loops Short ............. 2-17 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 16 Pragmas ..................2-31 Function Pragmas ..............2-31 #pragma const ..............2-31 #pragma pure ..............2-32 #pragma alloc ..............2-32 #pragma regs_clobbered ............ 2-33 #pragma optimize_{off|for_speed|for_space|as_cmd_line} .. 2-35 Loop Optimization Pragmas ..........2-35 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 17 ................3-10 float.h ................3-10 iso646.h ................3-11 limits.h ................3-11 locale.h ................3-12 math.h ................3-12 setjmp.h ................3-13 signal.h ................3-13 stdarg.h ................3-13 stddef.h ................3-13 VisualDSP++ 3.5 C/C++ Compiler and Library Manual xvii for ADSP-219x DSPs...
  • Page 18 ..............3-18 streambuf ..............3-18 string ................3-19 strstream ..............3-19 C++ Header Files for C Library Facilities ......3-19 Embedded Standard Template Library Header Files ... 3-20 xviii VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 19 ..............3-22 iostream.h ..............3-22 new.h ................3-22 Documented Library Functions ........... 3-23 C Run-Time Library Reference ............ 3-26 Notation Conventions ............3-26 Reference Format ..............3-26 abort ..................3-27 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 20 ................... 3-48 disable_interrupts ............... 3-49 div ..................... 3-50 enable_interrupts ................ 3-51 exit ..................... 3-52 exp ..................... 3-53 external_memory_read ............... 3-54 external_memory_write .............. 3-56 fabs .................... 3-58 floor ................... 3-59 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 21 ..................3-81 ispunct ..................3-82 isspace ..................3-83 isupper ..................3-84 isxdigit ..................3-85 labs ..................... 3-86 ldexp ..................3-87 ldiv ..................... 3-88 log ....................3-89 log10 ..................3-90 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 22 ..................3-109 realloc ..................3-110 setjmp ..................3-111 signal ..................3-112 sin .................... 3-116 sinh ..................3-118 sqrt ..................3-119 srand ..................3-120 strcat ..................3-121 strchr ..................3-122 xxii VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 23 ..................3-138 strtok ..................3-140 strtol ..................3-142 strtoul ..................3-144 strxfrm ..................3-146 sysreg_read ................3-148 sysreg_write ................3-151 tan .................... 3-154 tanh ..................3-155 tolower ..................3-156 VisualDSP++ 3.5 C/C++ Compiler and Library Manual xxiii for ADSP-219x DSPs...
  • Page 24 — Window Generators ........4-20 DSP Run-Time Library Reference ..........4-22 Notation Conventions ............4-22 a_compress ................. 4-23 a_expand ..................4-24 alog .................... 4-25 alog10 ..................4-26 arg ..................... 4-27 xxiv VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 25 ..................4-47 conv2d ..................4-49 conv2d3x3 .................. 4-50 copysign ..................4-51 cot ....................4-52 countones ................... 4-53 crosscoh ..................4-54 crosscorr ..................4-55 csub .................... 4-56 fir ....................4-57 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 26 ..................4-79 ifft2d ..................4-81 iir ....................4-83 max .................... 4-85 mean ..................4-86 min .................... 4-87 mu_compress ................4-88 mu_expand ................4-89 norm ..................4-90 polar ..................4-91 xxvi VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 27 Support for G21-Based Options And Extensions ..... A-4 ANSI C Extensions ..............A-4 Compiler Switch Modifications ..........A-5 New and Obsolete Warnings ........... A-8 Run-Time Model ..............A-9 C/C++ Run-Time Library ............A-9 INDEX VisualDSP++ 3.5 C/C++ Compiler and Library Manual xxvii for ADSP-219x DSPs...
  • Page 28 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 29: Preface

    Intended Audience The primary audience for this manual is DSP programmers who are famil- iar with Analog Devices DSPs. This manual assumes that the audience has a working knowledge of the ADSP-219x DSPs architecture and instruc- tion set and the C/C++ programming languages.
  • Page 30: Manual Contents Description

    This edition of the VisualDSP++ 3.5 C/C++Compiler and Library Manual for ADSP-219x DSPs documents support for all ADSP-219x processors. Refer to VisualDSP++ 3.5 Product Bulletin for 16-Bit Processors for infor- mation on all new and updated features and other release information.
  • Page 31: Technical Or Customer Support

    One Technology Way P.O. Box 9106 Norwood, MA 02062-9106| Supported Processors The name “ADSP-219x” refers to a family of Analog Devices 16-bit, fixed-point processors. VisualDSP++ currently supports the following ADSP-219x processors: ADSP-2191 DSP, ADSP-2192-12 DSP, ADSP-2195 DSP, ADSP-2196 DSP, ADSP-21990 DSP, ADSP-21991 DSP, and ADSP-21992 DSP VisualDSP++ 3.5 C/C++ Compiler and Library Manual...
  • Page 32: Product Information

    MyAnalog.com MyAnalog.com is a free feature of the Analog Devices website that allows customization of a webpage to display only the latest information on products you are interested in. You can also choose to receive weekly email notification containing updates to the webpages that meet your interests.
  • Page 33: Related Documents

    VisualDSP++ 3.5 Getting Started Guide for 16-Bit Processors VisualDSP++ 3.5 User’s Guide for 16-Bit Processors VisualDSP++ 3.5 Assembler and Preprocessor Manual for ADSP-218x and ADSP-219x DSPs VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors VisualDSP++ 3.5 Loader Manual for 16-Bit Processors VisualDSP++ 3.5 Product Bulletin for 16-Bit Processors...
  • Page 34: Online Technical Documentation

    From VisualDSP++ Access VisualDSP++ online Help from the Help menu’s Contents, Search, and Index commands. Open online Help from context-sensitive user interface items (toolbar buttons, menu commands, and windows). xxxiv VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 35: From Windows

    Select a processor family and book title. Download archive (. ) files, one for each manual. Use any archive management software, such as WinZip, to decompress downloaded files. VisualDSP++ 3.5 C/C++ Compiler and Library Manual xxxv for ADSP-219x DSPs...
  • Page 36: Printed Manuals

    The manuals can be purchased only as a kit. For additional information, call 1-603-883-2430. If you do not have an account with Analog Devices, you will be referred to Analog Devices distributors. To get information on our distributors, log onto http://www.analog.com/salesdir/continent.asp...
  • Page 37: Contacting Dsp Publications

    Commands, directives, keywords, and feature names are in text with .SECTION letter gothic font. Non-keyword placeholders appear in text with italic style format. filename VisualDSP++ 3.5 C/C++ Compiler and Library Manual xxxvii for ADSP-219x DSPs...
  • Page 38 A caution, providing information about critical design or program- ming issues that influence operation of a product. In the online version of this book, the word Caution appears instead of this symbol. xxxviii VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 39 Compiler 1 COMPILER The C/C++ compiler ( ) is part of Analog Devices development soft- cc219x ware for ADSP-219x DSPs. This chapter contains: • “C/C++ Compiler Overview” on page 1-2 Provides an overview of C/C++ compiler for ADSP-219x DSPs. •...
  • Page 40: C/C++ Compiler Overview

    The C/C++ compiler ( ) compiles ISO/ANSI standard C and C++ cc219x code for the ADSP-219x DSPs. Additionally, Analog Devices includes within the compiler a number of C language extensions designed to assist in DSP development. The compiler runs from the VisualDSP++ cc219x environment or from an operating system command line.
  • Page 41 Compiler any of the many reference texts on the C language. Analog Devices recom- mends the Bjarne Stroustrup text “The C++ Programming Language” from Addison Wesley Longman Publishing Co (ISBN: 0201889544) (1997) as a reference text for the C++ programming language.
  • Page 42: Standard Conformance

    This is because build configurations and optimization levels are used to select the correct and optimal implementation of the functions. For example, the include files may redefine standard C functions to use optimal compiler built-in implementations. VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 43 • Indexed initializer support • Preprocessor generated warnings • Support for C++-style comments in C programs For more information on these extensions, see the“C/C++ Compiler Lan- guage Extensions” on page 1-59. VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 44: Compiler Command-Line Interface

    By default, the compiler runs with Analog Extensions for C code enabled. This means that the compiler processes source files written in ANSI/ISO standard C language supplemented with Analog Devices extensions. Table 1-1 on page 1-8 lists valid extensions. By default, the compiler pro- cesses the input file through the listed stages to produce a .
  • Page 45: Running The Compiler

    Specifies the processor -proc ADSP-2191 Specifies optimization for the compiler Selects extra diagnostic remarks in addition to -Wremarks warning and error messages Selects a name for the compiled, linked output -o program.dxe VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 46 You can stop this sequence at various points by using appropriate com- piler switches, or by selecting options with the VisualDSP++ environment. These switches are , and VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 47 Using the verbose output switches for the preprocessor, compiler, assembler, and linker causes each of these tools to echo the name of each file as it is processed. VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 48 Object file to be linked. .doj Library of object files to be linked as needed. .dlb DSP system memory map file output. .xml DSP system symbol map file output. .sym 1-10 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 49: Specifying Compiler Options In Visualdsp

    Figure 1-1. Project Options – Compile Property Page There are four sub-pages you can access—General, Preprocessor, Proces- sor, and Warning. Most project options have a corresponding compiler command-line switch described in “Compiler Command-Line Switches” VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-11 for ADSP-219x DSPs...
  • Page 50: Compiler Command-Line Switches

    Table 1-4 on page 1-13 • “C++ Mode Compiler Switches” Table 1-5 on page 1-20. A brief description of each switch follows the tables, beginning on on page 1-21. 1-12 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 51 Defines a macro. -Dmacro[=definition] (on page 1-24) Supports building a file directly and writing a com- -debug-types (on page 1-25) plete set of debugging information for the header file. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-13 for ADSP-219x DSPs...
  • Page 52 1-28)) source file. Outputs a list of included header files and compiles. (on page 1-28) Outputs a list of command-line switches with brief syntax -h[elp] (on page 1-29) descriptions. 1-14 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 53 Generates make rules only; does not compile. No notifica- (on page 1-33) tion when input files are missing. Directs the linker to generate a memory map of all -map filename (on page 1-33) symbols. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-15 for ADSP-219x DSPs...
  • Page 54 Searches for preprocessor header files only in the current -no-std-inc (on page 1-35) directory and in directories specified with the switch. Searches for only those linker libraries specified with the -no-std-lib (on page 1-36) switch when linking. 1-16 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 55 Specifies the location of non-temporary files. -path-output directory (on page 1-39) Specifies the location of temporary files. -path-temp directory (on page 1-39) Generates and uses precompiled header files (*. -pch (on page 1-40) VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-17 for ADSP-219x DSPs...
  • Page 56 Specifies a silicon revision of the specified processor. -si-revision version (on page 1-44) Makes the default type for signed. -signed-bitfield int bitfields (on page 1-45) Makes the default type for signed. -signed-char char (on page 1-45) 1-18 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 57 Overrides the default severity of the specified diagnostic -W{error|remark| messages (errors, remarks, or warnings). suppress|warn} number (on page 1-49) Stops compiling after reaching the specified number of -Werror-limit number (on page 1-49) errors. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-19 for ADSP-219x DSPs...
  • Page 58 Enables C++ anachronisms. The default mode. -anach (on page 1-52) Disables C++ anachronisms. -no-anach (on page 1-53) Prevents filtering of any linker errors through the deman- -no-demangle (on page 1-53) gler. 1-20 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 59: C/C++ Mode Selection Switch Descriptions

    -c++ (C++ mode) switch directs the compiler to assume that the –c++ source file(s) are written in ANSI/ISO standard C++ with Analog Devices language extensions. All the standard features of C++ are accepted in the default mode except exception handling and run-time type identification because these impose a run-time overhead that is not desirable for all embedded programs.
  • Page 60: Filename

    #if #name(value) // do something #else // do something else #endif For example, the default assertions may be tested as: #if #machine(adsp219x) // do something #endif 1-22 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 61: Alttok

    -bss into a BSS-style section (called “ ”), rather than into the normal global data section. This is default mode. See also the switch –no-bss (on page 1-33). VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-23 for ADSP-219x DSPs...
  • Page 62: Build-Lib

    (define macro) switch directs the compiler to define a macro. If you do not include the optional definition string, the compiler defines the macro as the string ‘ ’. If definition is required to be a character string 1-24 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 63: Debug-Types

    VisualDSP++ Project Options dialog box, Compile tab, General category. -dry (verbose dry-run) switch directs the compiler to display main -dry driver actions, but not to perform them. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-25 for ADSP-219x DSPs...
  • Page 64: Dryrun

    -extra-keywords (enable short-form keywords) switch directs the -extra-keywords compiler to recognize the Analog Devices keyword extensions to ISO/ANSI standard C and C++. This recognition includes keywords such without leading underscores which could affect conforming ISO/ANSI C and C++ programs. This is the default mode. The...
  • Page 65: Flags{-Asm | -Compiler | -Lib | -Link | -Mem} Switch [,Switch2

    -fp-associative multiplication and addition as associative. -full-version (display versions) switch directs the compiler to dis- -full-version play version information for build tools used in a compilation. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-27 for ADSP-219x DSPs...
  • Page 66: H[Elp]

    (list headers and compile) switch directs the compiler to print to the standard output file stream a list of the files included by the preproces- sor via the directive. After preprocessing, compilation proceeds #include normally. 1-28 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 67: I Directory [{,|;} Directory

    (directories) to the search path for files. include This option may be specified more than once; all specified directories are added to the search path. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-29 for ADSP-219x DSPs...
  • Page 68: Include Filename

    (IPA) in the compiler. This option enables optimization across the entire program, including between source files that were compiled sepa- rately. The option should be applied to all C and C++ files in the -ipa 1-30 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 69: Jump-{Dm|Pm|Same

    This option may be specified more than once; libraries are searched as encountered during the left-to-right processing of the command line. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-31 for ADSP-219x DSPs...
  • Page 70: Mo Filename

    (“”). The new file name will override the default . The base.doj option supports the extension. .IMPORT 1-32 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 71: Map Filename

    -no-bss non-zero-initialized data in the same data section, rather than separating zero-initialized data into a different, BSS-style section. See also the –bss switch (on page 1-23). VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-33 for ADSP-219x DSPs...
  • Page 72: No-Builtin

    (no circular buffer) switch directs the compiler not to -no-circbuf define any default preprocessor macros, include directories, library direc- tories, libraries, or run-time headers. It also disables the Analog Devices C/C++ keyword extensions. -no-defs (disable defaults) switch directs the preprocessor not to...
  • Page 73: No_Hardware_Pc_Stack

    You can invoke this switch by selecting the Ignore standard include paths check box in the VisualDSP++ Project Options dialog box, Compile tab, Preprocessor category. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-35 for ADSP-219x DSPs...
  • Page 74: No-Std-Lib

    (disable thread-safe build) switch specifies that all com- -nothreads piled code and libraries used in the build need not be thread-safe. This is the default setting when the (enable thread-safe build) switch is -threads not used. 1-36 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 75 The compiler also uses a function to save and restore preserved registers for a function instead of generating the more cycle-efficient inline default versions. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-37 for ADSP-219x DSPs...
  • Page 76: Ov Num

    (omit line numbers and compile) switch directs the compiler to omit the preprocessor directives with line number information from #line the preprocessor output. After preprocessing, compilation proceeds normally. 1-38 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 77: Path {-Asm | -Compiler | -Def | -Lib | -Link | -Mem} Filename

    (non-temporary files location) switch directs the com- -path-output piler to place output files in the specified directory. -path-temp directory (temporary files location) switch directs the compiler to -path-temp place temporary files in the specified directory. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-39 for ADSP-219x DSPs...
  • Page 78: Pch

    The compiler may not detect all noconforming constructs. In par- ticular, the switch does not cause the compiler to issue -pedantic errors when Analog Devices keyword extensions are used. -pedantic-errors (ANSI C errors) switch causes the compiler to -pedantic-errors issue errors instead of warnings for cases described in the -pedantic switch.
  • Page 79: Pplist Filename

    The identifiers processor directly supported in VisualDSP++ 3.5 are: ADSP-2191, ADSP-21990, ADSP-21991, ADSP-21992, ADSP-2195, ADSP-2196, ADSP-2192-12 and ADSP-219x For example, cc219x -proc ADSP-2191 -o bin\p1.doj p1.asm VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-41 for ADSP-219x DSPs...
  • Page 80: R Directory [{;|,}Directory

    Source files whose file names begin with , or (or Windows equivalent) and contain drive specifiers (on Windows platforms) are not affected by this option. 1-42 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 81: Reserve Register[, Register

    Compile tab, General category selection. s (strip debugging information) switch directs the compiler to remove debugging information (symbol table and other items) from the output executable file during linking. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-43 for ADSP-219x DSPs...
  • Page 82: Save-Temps

    For example, cc219x -proc ADSP-2191 -si-revision 0.1 In the absence of silicon revision, the compiler selects the greatest silicon revision it “knows” about, if any. 1-44 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 83: Signed-Bitfield

    -sysdefs several preprocessor macros describing the current user and user’s system. The macros are defined as character string constants and are used in func- tions with null-terminated string arguments. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-45 for ADSP-219x DSPs...
  • Page 84: T Filename

    Linker Description Files to link with thread-safe libraries. This switch is only likely to be used by applications involving the VisualDSP++ Kernel (VDK). 1-46 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 85: Time

    For example, given the declaration struct { int a:2; int b:1; signed int c:2; unsigned int d:2; } x; values are: bitfield VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-47 for ADSP-219x DSPs...
  • Page 86: Unsigned-Char

    <name-list>. This switch is used to define VCSE components. -verbose (display command line) switch directs the compiler to dis- -verbose play command-line information for all the compilation tools as they process each file. 1-48 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 87: Version

    VisualDSP++ Project Options dialog box, Compile tab, Warning selection. -Wterse (enable terse warnings) switch directs the compiler to issue -Wterse the briefest form of warnings. This also applies to errors and remarks. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-49 for ADSP-219x DSPs...
  • Page 88: Warn-Protos

    (but not the input file names) to the main driver via a temporary file. This can be helpful if the resulting main driver command line would otherwise be too long. 1-50 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 89: Xref

    Character Meaning Definition Declaration Modification Address taken Used Changed (used and modified) Any other type of reference Error (unknown type of reference VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-51 for ADSP-219x DSPs...
  • Page 90: C++ Mode Compiler Switch Descriptions

    • A bound function pointer (a pointer to a member function for a given object) can be cast to a pointer to a function. 1-52 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 91: No-Anach

    The demangler’s primary role is to convert the encoded name of a func- tion into a more understandable version of the name. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-53 for ADSP-219x DSPs...
  • Page 92: Data Type Sizes

    Compiler Command-Line Interface Data Type Sizes The sizes of intrinsic C/C++ data types are selected by Analog Devices so that normal C/C++ programs execute with hardware-native data types and therefore at high speed. Table 1-6 shows the size used for each of the intrinsic C/C++ data types Table 1-6.
  • Page 93 Analog Devices does not support data sizes smaller than a single word location for the ADSP-219x processors. For the current processors, this means that both have the same size as .
  • Page 94: Optimization Control

    The optimizations can be directed to favor optimizations for speed ( ) or space ( ) or a factor between speed and space ( ). If debugging is also 1-56 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 95: Interprocedural Analysis

    This capability allows the compiler to see all of the source files used in a final link at compilation time and to use that information while optimizing. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-57 for ADSP-219x DSPs...
  • Page 96 -ipa there are hidden references to the functions and variables defined in those objects which were compiled with the switch, and optimizes those -ipa variables and functions accordingly. 1-58 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 97: C/C++ Compiler Language Extensions

    “C++ Style Comments” on page 1-94 • “Compiler Built-In Functions” on page 1-94 • “ETSI Support” on page 1-106 • “Pragmas” on page 1-119 • “GCC Compatibility Extensions” on page 1-138 VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-59 for ADSP-219x DSPs...
  • Page 98 You might need to use the longer forms (such as ) exclusively if __inline you are porting a program that uses the extra Analog Devices keywords as identifiers. For example, a program might declare local variables such as . In this case, you should use the...
  • Page 99 For more information, see “Preprocessor Generated Warnings” on page 1-93. C++-style comments Support for C++-style comments in C programs. For more information, see “C++ Style Comments” on page 1-94. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-61 for ADSP-219x DSPs...
  • Page 100: Inline Function Support Keyword (Inline)

    The compiler only inlines functions, even those declared using the inline keyword, when optimizations are enabled (using the switches, as described on page 1-37). 1-62 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 101: Inline Assembly Language Support Keyword (Asm)

    (instead of the default code section), then the debug line informa- tion will be incorrect for these lines. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-63 for ADSP-219x DSPs...
  • Page 102: Assembly Construct Template

    C variables. ASM() Construct Syntax: Use the following general syntax for your constructs. asm() asm( template [:[constraint(output operand)[,constraint(output operand)…]] [:[constraint(input operand)[,constraint(input operand)…]] [:clobber]]] The syntax elements are defined as: 1-64 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 103 Use lowercase characters to name clobbered registers. Enclose each name within double quotes, and separate each quoted register name with a comma. The input VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-65 for ADSP-219x DSPs...
  • Page 104: Asm() Construct Syntax Rules

    • A comma separates operands and registers within arguments. • The number of operands in arguments must match the number of operands in your template. • The maximum permissible number of operands is ten ( , and 1-66 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 105: Asm() Construct Template Example

    VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-67 for ADSP-219x DSPs...
  • Page 106: Assembly Construct Operand Description

    The list is separated from the assembly language template with a colon. The input operands are separated from the output operands with a colon and always follow the out- put operands. 1-68 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 107 Once asm() template has been executed, the value in asm() the allocated register is stored into the location indi- cated by its C/C++ expression; therefore, the VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-69 for ADSP-219x DSPs...
  • Page 108 (or inputs). This operand constraint is used when one or more output registers are set while one or more inputs are still to 1-70 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 109 1-10. For example, asm("%0 = %1 + %2;" :"=ar"(sum) /* output */ :"g"(x),"G"(y) /* input would load into register, into register, and will ALU-X ALU-Y be calculated in register VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-71 for ADSP-219x DSPs...
  • Page 110 SR1, SR0, SI, MY1, MX1, AY1, AX1, MY0, MX0, AY0, AX0, MR1, MR0, AR, I0-I7, M0-M7, L0-L7 DAG1 L registers L0-L3 DAG2 L registers L4-L7 DAG1 I registers I0-I3 DAG1 M registers M0-M3 1-72 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 111 "M0", "M1", "M2", "M3", "M4", "M6", "M7" Base registers "B0", "B1", "B2", "B3", "B4", "B5", "B6", "B7" Page registers "DMPG1", "DMPG2" Length register "L0", "L1", "L2", "L3", "L5", "L6", "L7" PMD-DMD bus exchange register "PX" VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-73 for ADSP-219x DSPs...
  • Page 112: Assembly Constructs With Multiple Instructions

    For the purpose of optimization, the compiler assumes that the side effects of an construct are limited to changes in the output operands or the asm() items specified using the clobber specifiers. This does not mean that you 1-74 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 113: Assembly Constructs With Input And Output Operands

    You can use the same C expression for both operands, or different expres- sions. For example, in the following statement, the instruction uses modify as its read only source operand and as its read-write destination: sock shoe VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-75 for ADSP-219x DSPs...
  • Page 114 *my_variable; /* NOT recommended */ /* (pseudo code) result_asm = dm(*my_variable += 3); */ /* asm() operation changes value of my_variable */ asm("%0=DM(%1 += 3);":"=e"(result_asm):"w"(my_variable)); 1-76 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 115: Assembly Constructs And Macros

    VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-77 for ADSP-219x DSPs...
  • Page 116: Dual Memory Support Keywords (Pm Dm)

    • Although program memory on the ADSP-219x DSPs consists of 24-bit words, only 16 bits of each word are used when C or C++ data is stored in . (This is normally the case for assembly lan- 1-78 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 117 * dm * pm fp; /* the first pm means that *fp is in Program Memory, the following dm puts *fp in Data Memory, and fp itself is in Program Memory VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-79 for ADSP-219x DSPs...
  • Page 118: Memory Keywords And Assignments/Type Conversions

    /* Legal Dual Memory Space Variable Assignment Example */ int pm x; int dm y; x = y; /* Legal code */ /* Illegal Dual Memory Space Type Cast Example */ 1-80 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 119: Memory Keywords And Function Declarations/Pointers

    * pm * y(); /* function y resides in */ /* pm and returns a /* pointer to a pointer /* residing in pm that /* points to an integer /* which resides in dm VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-81 for ADSP-219x DSPs...
  • Page 120: Memory Keywords And Function Arguments

    To make changes of this kind easier, you can use C preprocessor macros to define common memory spaces that must be coordinated. The following listing shows two code segments that are equivalent after preprocessing. 1-82 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 121: Pm And Dm Compiler Support For Standard C Library Functions

    . The . file supplied to section the linker must also be updated to support the additional named sections. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-83 for ADSP-219x DSPs...
  • Page 122: Boolean Type Support Keywords (Bool, True, False)

    Also, two different restricted pointers can not designate the same object and therefore are not 1-84 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 123: Variable Length Array Support

    The compiler does allow breaking or jumping out of the brace-level, and it deallocates the array when this occurs. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-85 for ADSP-219x DSPs...
  • Page 124 For example, the following program prints 40, not 50: #include <stdio.h> void foo(int); main () foo(40); 1-86 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 125: Non-Constant Aggregate Initializer Support

    For an array initializer, the syntax appearing before an initializer [INDEX] element value specifies the index to be initialized by that value. Subse- quent initializer elements are then applied to sequentially following VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-87 for ADSP-219x DSPs...
  • Page 126 = { 0, v1, v2, 0, v4, 0 }; /* equivalent cc219x C/C++ array initializer that uses indexed elements */ int a[6] = { [1] v1, v2, [4] v4 }; 1-88 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 127: Aggregate Constructor Expression Support

    The following example shows an ISO/ANSI standard usage fol- struct lowed by equivalent code that has been simplified using an cc219x constructor expression. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-89 for ADSP-219x DSPs...
  • Page 128: Fractional Type Support

    Frac- tional values are represented as signed values in a range of [ ] with a -1 … 1 1-90 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 129: Format Of Fractional Literals

    The conversion to the floating-point type may result in some precision loss. • Conversion between a fractional value and an integer value is sup- ported. The conversion is not recommended because the only common values are –1 VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-91 for ADSP-219x DSPs...
  • Page 130: Fractional Arithmetic Operations

    Most operations supported for fractional values, are supported for mixed fractional/float or fractional/double arithmetic expressions. At run time, a floating-point value is converted to a fractional value, and the operation is completed using fractional arithmetic. 1-92 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 131: Saturated Arithmetic

    The preprocessor directive causes the preprocessor to generate a #warning warning and continue preprocessing. The text on the remainder of the line that follows is used as the warning message. #warning VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-93 for ADSP-219x DSPs...
  • Page 132: C++ Style Comments

    (on page 1-34). -no-builtin compiler provides built-in versions of some of the C library cc219x functions as described in “Using the Compiler’s Built-In C Library Func- tions” on page 3-5. 1-94 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 133: Access To System Registers

    System Control Register set: B0 B1 B2 B3 B4 B5 B6 B7 SYSCTL CACTL DBGCTRL DBGSTAT CNT0 CNT1 CNT2 CNT3 Also any 8-bit value used as a register identifier. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-95 for ADSP-219x DSPs...
  • Page 134 // B5 base register sysreg_B6 = 0xf, // B6 base register sysreg_B7 = 0x10, // B7 base register sysreg_SYSCTL = 0x11, // SYSCTL register sysreg_CACTL = 0x12, // Cache Control register 1-96 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 135: I/O Space Read Or Write

    The prototypes for these functions are, as defined in sysreg.h void io_space_write(const unsigned int, const unsigned int); int io_space_read(const unsigned int addr); These functions are described in “io_space_read” on page 3-67 “io_space_write” on page 3-69, respectively. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-97 for ADSP-219x DSPs...
  • Page 136: Interrupt Control

    The following code provides an example of the use of enable_interrupts to disable and enable interrupts around a call to disable_interrupts printf #include <sysreg.h> #include <stdio.h> void interrupt_safe_iprint(int val) { disable_interrupts(); printf("%d\n",val); enable_interrupts(); 1-98 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 137: Mode Control

    This extension is enabled using a “ ” and “ ” type qualifier in near C/C++ variable declarations. The following are example uses of the “ ” and “ ”type qualifiers. near VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-99 for ADSP-219x DSPs...
  • Page 138: Sizes Of Far And Near Qualified Types

    “ ” will be ignored. The operator near sizeof will return 1 for pointers and 2 for pointers. For example, near #include <assert.h> 1-100 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 139: Conversions Between Far And Near Pointers

    /* truncate MSW leaving LSW - will cause a compiler warning */ void extend_far (int near *i) { far_iptr = i; /* extend MSW with value of internal memory addresses */ VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-101 for ADSP-219x DSPs...
  • Page 140: Addressing "Far" Data

    The prototypes of the functions are defined in sysreg.h int external_memory_read(int DMPG_val, int* addr); void external_memory_write(int DMPG_val, int* addr, int val); 1-102 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 141: Circular Buffer Built-In Functions

    Automatic Circular Buffer Generation If optimization is enabled, the compiler will automatically attempt to use circular buffer mechanisms where appropriate. For example, void func(int *array, int n, int incr) VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-103 for ADSP-219x DSPs...
  • Page 142: Circular Buffer Increment Of An Index

    An example of this built-in function is: void func(int *array, int n, int incr, int len) int i, idx = 0; for (i = 0; i < n; i++) { 1-104 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 143: Circular Buffer Increment Of A Pointer

    // of item pointed to. incr *= sizeof(*ptr); len *= sizeof(*ptr); for (i = 0; i < n; i++) { *ptr += incr; ptr = __builtin_circptr(ptr, incr, array, len); VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-105 for ADSP-219x DSPs...
  • Page 144: Etsi Support

    The results obtained from of use of these operations have well defined overflow and saturation conditions. The ETSI support operations are Analog Devices extensions to ANSI C standard. The ETSI support contains functions that you can call from your source program.
  • Page 145 DSP programmers. These fractional operations can often be done at no extra cost to normal integer operations on DSPs using special instructions or modes of operation. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-107 for ADSP-219x DSPs...
  • Page 146: Calling Etsi Library Functions

    C/C++ Compiler Language Extensions The C programming language does not include a basic type for fractional data, and rather than introduce a non-standard type, Analog Devices defines in terms of appropriately-sized integer data fract16 fract32 types and provides sets of basic intrinsic functions which perform the required operations.
  • Page 147: Using The Etsi Built-In Functions

    Overflow integers and are prototyped in the system header file. With the libetsi.h ETSI functions provided by Analog Devices, this can be switched off by compiling with defined in the compiler command line. __NO_ETSI_FLAGS In fact, this is the default for the ADSP-219x DSP implementation. If the...
  • Page 148: Working With Etsi Library Source Code

    Test the function before you use it in your system to verify that it is func- tionally correct. Analog Devices only supports the run-time library functions as provided. ETSI Support for Data Types ETSI functions support...
  • Page 149: Etsi Header File

    (fract16, fract16) This function returns the 16-bit result of the fractional integer division of must both be positive fractional values with greater than Long division fract16 div_l (fract32, fract16) VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-111 for ADSP-219x DSPs...
  • Page 150 L_msu provided. The result is the rounded 16 most significant bits of the 32-bit result from the operation. L_msu Short multiply fract16 mult (fract16, fract16) 1-112 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 151 16 bit variable for positive values on the interval with minimum of and maximum of , and for negative values on the interval 0x4000 0x7fff with minimum of and maximum of 0x8000 0xc000 Round fract16 round (fract32) VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-113 for ADSP-219x DSPs...
  • Page 152 (fract16, fract16) This function performs a shift to the right as per the operation with shr() additional rounding and saturation of the result. Short subtract fract16 sub (fract16, fract16) 1-114 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 153 L_deposit_l (fract16) This function deposits the 16-bit parameter into the 16 least significant bits of the 32-bit result. The most significant bits are set to sign extension for the input. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-115 for ADSP-219x DSPs...
  • Page 154 This function performs a non-saturating version of the operation. L_msu Long multiply fract32 L_mult (fract16, fract16) This function returns the 32-bit result of the fractional multiplication of the two 16-bit parameters. Long negate fract32 L_negate (fract32) 1-116 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 155 The result is saturated in cases of overflow and underflow. Long shift right with rounding fract32 L_shr_r (fract32, fract16) This function performs the shift-right operation as per but with L_shr rounding. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-117 for ADSP-219x DSPs...
  • Page 156 The result returned is calculated Res = L_mult(hi1,hi2); Res = L_mac(Res, mult(hi1,lo2),1); Res = L_mac(Res, mult(lo1,hi2),1); Multiply short by a long fract32 Mpy_32_16 (fract16, fract16, fract16) 1-118 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 157: Pragmas

    _Pragma ( string-literal ) When processing a pragma operator, the compiler effectively turns it into a pragma directive using a non-string version of . This string-literal means that the following pragma directive VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-119 for ADSP-219x DSPs...
  • Page 158 • “Linking Control Pragmas” on page 1-126 • “Function Side-Effect Pragmas” on page 1-128 • “Template Instantiation Pragmas” on page 1-134 • “Header File Control Pragmas” on page 1-136 1-120 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 159: Data Alignment Pragmas

    , for example, by with empty alignopt #pragma pad() parentheses. This pragma is effectively a shorthand for placing before #pragma align every field within the definition. struct VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-121 for ADSP-219x DSPs...
  • Page 160: Interrupt Handler Pragmas

    Note the use of the pragma is not safe when nested interrupts are enabled. altregisters 1-122 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 161: Loop Optimization Pragmas

    If it is known that each iteration of the loop is not dependent on the pre- vious iteration, then the pragma can be used to explicitly vector_for notify the compiler that this is the case. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-123 for ADSP-219x DSPs...
  • Page 162: Pragma Loop_Count(Min, Max, Modulo)

    1-124 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 163: Pragma No_Alias

    The pragmas are: • #pragma optimize_off This pragma turns off the optimizer, if it was enabled. This pragma has no effect if IPA is enabled. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-125 for ADSP-219x DSPs...
  • Page 164: Linking Control Pragmas

    #pragma linkage_name identifier nal function declaration. It ensures that identifier is used as the external reference, instead of following the compiler’s usual conventions. 1-126 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 165: Pragma Retain_Name

    Since the program has no uses of either , the delete_me() keep_me() compiler will remove , but will keep because of the delete_me() keep_me() pragma. You do not need to specify retain_name main() VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-127 for ADSP-219x DSPs...
  • Page 166: Pragma Weak_Entry

    For example, #pragma pure long dot(short*, short*, int); The function side-effect pragmas are: alloc pure const , and regs_clobbered result_alignment 1-128 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 167: Pragma Alloc

    Therefore, in this example, #pragma pure long sdot(short *, short *, int); long tendots(short *a, short *b, int n) { VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-129 for ADSP-219x DSPs...
  • Page 168: Pragma Const

    , so it may keep local variables in other registers across that call. 1-130 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 169 A register range consists of registers which both reside in the start same register class, separated by a hyphen. All registers between the two (inclusive) are clobbered. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-131 for ADSP-219x DSPs...
  • Page 170 If the user specifies them in the clobbered set, a warning will be issued and they will be removed from the specified clobbered set. 1-132 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 171 They may appear in the clobbered set of the callee but it will make no difference to VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-133 for ADSP-219x DSPs...
  • Page 172: Pragma Result_Alignment (N)

    As templates are a feature of C++ these pragmas are only allowed in mode. -c++ These pragmas take the name of an instance as a parameter, as shown in Table 1-11 1-134 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 173: Pragma Instantiate Instance

    Stack to be instantiated, whether they are required in this compilation or not. The example, #pragma instantiate void Stack<int>::push(int) will cause only the individual member function Stack<int>::push(int) to be instantiated. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-135 for ADSP-219x DSPs...
  • Page 174: Pragma Do_Not_Instantiate Instance

    By default, the header stop point is the first non-preprocessing token in the primary source file. The can be used to set the point #pragma hdrstop earlier in the source file. 1-136 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 175: Pragma No_Pch

    (on page 1-40) for a particular source file. It directs the compiler not to look for a . file and not to generate one for the specified source file. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-137 for ADSP-219x DSPs...
  • Page 176: Pragma Once

    3.2 of the GNU C Compiler. Many of these features are available in the C99 ANSI Standard. A brief description of the extensions is included in this section. For more information, refer to the following web address: http://gcc.gnu.org/onlinedocs/gcc-3.2.1/gcc/C-Extensions.html#C%20Extensions 1-138 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 177: Statement Expressions

    Labels local to a statement expression can be declared with the __label__ keyword. For example, __label__ exit; VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-139 for ADSP-219x DSPs...
  • Page 178: Type Reference Support Keyword (Typeof)

    Statement expressions are not supported in C++ mode. Statement expressions are an extension to C originally imple- mented in the GCC compiler. Analog Devices support the extension primarily to aid porting code written for that compiler. When writing new code consider using inline functions, which are compatible with ANSI/ISO standard C++ and C99, and are as effi- cient as macros when optimization is enabled.
  • Page 179: Gcc Generalized Lvalues

    This is an extension to C, provided for compatibility with GCC. It is a standard feature of C++. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-141 for ADSP-219x DSPs...
  • Page 180: Conditional Expressions With Missing Operands

    , and a constant with suffix is of type float long double Hexadecimal floating constants enable the programmer to specify the exact bit pattern required for a floating-point constant. For example, the declaration 1-142 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 181: Zero Length Arrays

    The variable argument macro syntax comes from GCC. It is not compatible with C99 variable argument macros and is not sup- ported in C++ mode. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-143 for ADSP-219x DSPs...
  • Page 182: Line Breaks In String Literals

    C99 and C++. This allows the declaration of local variables to be placed at the point where they are required. Therefore, the declaration can be combined with initialization of the variable. 1-144 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 183: Escape Character Constant

    Keyword for Specifying Names in Generated Assembler (asm) keyword can be used to direct the compiler to use a different name for a global variable or function (see also “#pragma linkage_name identifier” on page 1-126). VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-145 for ADSP-219x DSPs...
  • Page 184: Function, Variable And Type Attribute Keyword

    GCC, can be ported. All attributes accepted by GCC on ix86 accepted. The ones that are actually interpreted by the compiler are described in the sections of this manual describing the corresponding pragmas (see “Pragmas” on page 1-119). 1-146 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 185: Preprocessor Features

    The __DATE__ “#” operator with a macro body is useful in converting such symbols into text constructs. Table 1-12 describes the predefined preprocessor macros. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-147 for ADSP-219x DSPs...
  • Page 186 __NO_BUILTIN __NO_BUILTIN command-line switch -no-builtin Always defines as 1 for C and C++ source. This _NO_LONG_LONG _NO_LONG_LONG definition signifies no support is present for the long long int type. 1-148 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 187: Header Files

    When a #define macro definition has arguments, the block of text the preprocessor substi- tutes can vary with each new set of arguments. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-149 for ADSP-219x DSPs...
  • Page 188 Whereas with the sec- ond definition, the pair means that the macro is do {...} while (0) followed by a semi-colon. 1-150 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 189: Preprocessing Of .Idl Files

    #include VIDL source text from a secondary input file that is named in the direc- tive. Two available forms of are shown in Figure 1-2. #include VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-151 for ADSP-219x DSPs...
  • Page 190 . If the file is not located within any direc- tory on the search list, the search may be continued in one or more platform dependent system directories. 1-152 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 191: C/C++ Run-Time Model And Environment

    “Stack Frame” on page 1-155 • “Stack Frame Description” on page 1-157 • “Miscellaneous Information” on page 1-161 • “Register Classification” on page 1-161 • “File I/O Support” on page 1-166 VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-153 for ADSP-219x DSPs...
  • Page 192: Using The Run-Time Header

    _____system_start file contains a section of code for each hardware inter- 219x_int_tab rupt. The file places these code sections in the correct interrupt .LDF vector slots for each interrupt. 1-154 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 193: Stack Frame

    • place to save linkage information such as return addresses, location information for the previous caller’s stack frame, and to allow this procedure to return to its caller VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-155 for ADSP-219x DSPs...
  • Page 194 Stack Pointer ( ), which identifies the boundary of the in-use portion of the stack space, and a Frame Pointer ( ), which pro- vides stable addressing to the current frame. 1-156 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 195: Stack Frame Description

    Space for a register save area and local variables/temporaries is allo- cated on the stack by the function prologue. Local variables and temporaries are typically placed first in this area so they can be VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-157 for ADSP-219x DSPs...
  • Page 196: General System-Wide Specifications

    , if it is stored on the stack. • The linkage back to the previous stack frame is stored at offset from the current 1-158 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 197: At A Procedure Call, The Following Must Be True

    Procedure Call and Return To call a procedure: 1. Evaluate the arguments and push them onto the stack. 2. Call the procedure. 3. On return, remove arguments if desired. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-159 for ADSP-219x DSPs...
  • Page 198: On Entry

    3. Place the return value in the correct register (if not there already). 4. Restore for the previous frame. 5. Reset to remove the frame for procedure. 6. Return to the caller. 1-160 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 199: Miscellaneous Information

    Compiled code and libraries expect the dedicated registers to be correct. Caller Save Registers (“Scratch”) All registers not preserved or dedicated are scratch. A subroutine may use a scratch register without having to save it. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-161 for ADSP-219x DSPs...
  • Page 200: Circular Buffer Length Registers

    State Secondary Data Registers disabled SEC_REG Bit-reversed address output disabled BIT_REV ALU saturation mode disabled AR_SAT MAC result mode Integer Mode, 16.0 format M_MODE Secondary DAG registers disabled SEC_DAG 1-162 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 201: Complete List Of Registers

    Table 1-14. List of Data Register File Registers Register Description Notes scratch scratch; single-word return scratch scratch scratch; scratch scratch scratch scratch scratch scratch MR1:0 scratch VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-163 for ADSP-219x DSPs...
  • Page 202 SR1:0 scratch Table 1-15. List of DAG1 Registers Register Description scratch scratch preserved preserved preserved scratch preserved scratch not used, must be zero L0-3 not used B0-3 preserved DMPG1 1-164 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 203 Table 1-17. Miscellaneous Registers Register Description scratch ASTAT preserved; (0x8 ALU result sign default in C/C++ code) CCODE scratch CNTR scratch ICNTL scratch IJPG scratch IMASK scratch IRPTL scratch LPSTACKA VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-165 for ADSP-219x DSPs...
  • Page 204: File I/O Support

    A device driver is a set of primitive functions, grouped together into a structure. This structure is defined in DevEntry device.h struct DevEntry { DeviceID; void *data; 1-166 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 205 If the device is successfully registered, the routine of the device is init() called, with as its parameter. returns the entry add_devtab_entry() DeviceID of the device registered. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-167 for ADSP-219x DSPs...
  • Page 206 Once a file has been opened by , the current value of fopen() is irrelevant to that file. get_default_io_device() 1-168 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 207: C/C++ And Assembly Language Interface

    1-170 • “Calling C/C++ Functions from Assembly Programs” on page 1-172 • “Using Mixed C/C++ and Assembly Naming Conventions” on page 1-174 • “C++ Programming Examples” on page 1-176 VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-169 for ADSP-219x DSPs...
  • Page 208: Calling Assembly Subroutines From C/C++ Programs

    The compiler prefaces the name of any external entry point with an underscore. Therefore, declare your assembly language subroutine’s name with a leading underscore. If you're using the function from assembly pro- 1-170 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 209 //do some assignments so .s file will show where args are global_a = a; global_b = b; global_p = p; //value gets loaded into the return register return 12345; VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-171 for ADSP-219x DSPs...
  • Page 210: Calling C/C++ Functions From Assembly Programs

    Using volatile global variables may help clarify the essential code in your test function. 1-172 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 211 C/C++. However, make sure the dedicated regis- ters are correct. You do not need to set the prior to the call; the caller’s is never used by the recipient. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-173 for ADSP-219x DSPs...
  • Page 212: Using Mixed C/C++ And Assembly Naming Conventions

    Table 1-18 shows several examples of the C/C++ and assembly interface naming conventions. 1-174 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 213 .extern _c_func; void cpp_func(void); /* in C++ .extern _cpp_func__Fv; source */ extern int asm_var; .global _asm_var; extern void asm_func(); .global _asm_func; _asm_func: extern "asm" void asm_func(); .global asm_func; asm_func: VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-175 for ADSP-219x DSPs...
  • Page 214: C++ Programming Examples

    -c++ Specifies that the following source file is written in ANSI/ISO standard C++ extended with the Analog Devices keywords. source.cpp Specifies the source file for your program. -proc ADSP-2191 Specifies that the compiler should produce code suitable for the ADSP-2191 DSP.
  • Page 215: Using Complex Number Support

    := z * z + c values belong to the set for which the above iteration does not diverge to infinity. The canonical set is defined when starts from zero VisualDSP++ 3.5 C/C++ Compiler and Library Manual 1-177 for ADSP-219x DSPs...
  • Page 216 = 2.0 * zreal * zimag + cimag; zreal = real - imag + creal; real = zreal * zreal; imag = zimag * zimag; return (n == max ? 0 : n); 1-178 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 217: Achieving Optimal Performance From C/C++ Source Code

    “General Guidelines” on page 2-3 • “Loop Guidelines” on page 2-17 • “Using Built-In Functions in Code Optimization” on page 2-25 • “Smaller Applications: Optimizing for Code Size” on page 2-29 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 218 • “Pragmas” on page 2-31 • “Useful Optimization Switches” on page 2-37 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 219: General Guidelines

    This section contains: • “How the Compiler Can Help” on page 2-4 • “Data Types” on page 2-7 • “Getting the Most from IPA” on page 2-9 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 220: How The Compiler Can Help

    VisualDSP++ by checking the Enable optimization checkbox under the Project Options ->Compile tab. This adds the (enable optimization) switch (on page 1-37) to the compiler invocation. A “release” build from within VisualDSP++ will automatically enable optimization. VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 221: Using The Statistical Profiler

    The statistical profiling feature provided in VisualDSP++ is an excellent means for finding these areas. More details about how to use it may be found in the VisualDSP++ 3.5 User’s Guide. The particular advantage of statistical profiling is that it is completely unobtrusive.
  • Page 222: Using Interprocedural Optimization

    __builtin_aligned each function interacts with the rest of the program. These directives are further described “Using Built-In Functions in Code Optimization” on page 2-25 “Pragmas” on page 2-31. VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 223: Data Types

    Fractional data types are represented using the integer types. Manipula- tion of these is best done by use of built-in functions, described in “System Support Built-In Functions” on page 2-26. VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 224: Avoiding Emulated Arithmetic

    Emulated arithmetic operators should therefore be avoided where possible, especially in loops. VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 225: Getting The Most From Ipa

    { printf("val %d",val); int main() { init(); func(); Bad: IPA cannot see that is a constant is better written as #include <stdio.h> const int val = 3; // initialized once VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 226: Avoiding Aliases

    If the sets for two pointers are found to intersect, then both pointers are assumed to point to the union of the two sets. 2-10 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 227 *p = a; int *q = b; // some use of p // some use of q Good: do not alias. than int *p = a; // some use of p VisualDSP++ 3.5 C/C++ Compiler and Library Manual 2-11 for ADSP-219x DSPs...
  • Page 228: Indexed Arrays Vs. Pointers

    Tip: Try both pointer and index styles. 2-12 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 229: Function Inlining

    Prime candidates for inlining are small, fre- quently used functions because they will cause the least code-size increase while giving most performance benefit. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 2-13 for ADSP-219x DSPs...
  • Page 230: Using Inline Asm Statements

    The compiler has been enhanced with a large number of built-in func- tions. These generate specific hardware instructions and are designed to allow the programmer to more finely tune the code produced by the com- 2-14 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 231: Memory Usage

    (i=0; i<100; i++) sum += a[i] * b[i]; VisualDSP++ 3.5 C/C++ Compiler and Library Manual 2-15 for ADSP-219x DSPs...
  • Page 232 *p = a; to allow simultaneous accesses to the two buffers. Note that the explicit placement of data in PM can only be done for global data. 2-16 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 233: Loop Guidelines

    (i = 0; i < n; i+=2) { xb = b[i]; yb = b[i+1]; xa = a[i]; ya = a[i+1]; VisualDSP++ 3.5 C/C++ Compiler and Library Manual 2-17 for ADSP-219x DSPs...
  • Page 234: Avoiding Loop Rotation By Hand

    = a[i]; tb = b[i]; for (i = 1; i < n; i++) { sum += ta + tb; ta = a[i]; tb = b[i]; sum += ta + tb; 2-18 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 235: Avoiding Array Writes In Loops

    Therefore, try to make sure that your algorithm also spends most of its VisualDSP++ 3.5 C/C++ Compiler and Library Manual 2-19 for ADSP-219x DSPs...
  • Page 236: Avoiding Conditional Code In Loops

    += a[i] * b[i]; } else { for (i=0; i<100; i++) sum1 += a[i] * c[i]; Good: two simple loops can be optimized well. if this is an important loop. 2-20 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 237: Avoiding Placing Function Calls In Loops

    The C standard requires ints various type promotions and standard conversions that complicate the code for the compiler optimizer. Frequently, the compiler is still able to VisualDSP++ 3.5 C/C++ Compiler and Library Manual 2-21 for ADSP-219x DSPs...
  • Page 238: Using The Restrict Qualifier

    Accesses from distinct pointers restricted do not interfere with each other. The loads and stores in the following loop for (i=0; i<100; i++) a[i] = b[i]; 2-22 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 239: Using The Const Qualifier

    In C, it is legal, though bad programming practice, to use casts to allow the data pointed to by pointers to type to change. This should be const avoided since, by default, the compiler will generate code that assumes VisualDSP++ 3.5 C/C++ Compiler and Library Manual 2-23 for ADSP-219x DSPs...
  • Page 240: Avoiding Long Latencies

    Pipeline Viewer. This can be accessed through Debug Windows -> Pipeline Viewer in the VisualDSP++ 3.5 IDDE. By single-stepping through the program, you will see where the stall occurs. Note that the Pipeline Viewer is only avail- able within a simulator session.
  • Page 241: Using Built-In Functions In Code Optimization

    However, the DSP hardware has a fractional multiply/accu- mulate instruction that performs all these tasks in one cycle. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 2-25 for ADSP-219x DSPs...
  • Page 242: System Support Built-In Functions

    Using builtins will also usually result in improved code-readability. For more information on built-in functions supported by the compiler, refer “Compiler Built-In Functions” on page 1-94. 2-26 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 243: Using Circular Buffers

    Consider the slightly more complicated example: for (i=0; i<1000; i+=n) { sum += a[i] * b[i%20]; VisualDSP++ 3.5 C/C++ Compiler and Library Manual 2-27 for ADSP-219x DSPs...
  • Page 244 += a[i] * (*p); p = __builtin_circptr(p, n, b, 20); Good: explicit use of circular buffer via __builtin_circptr For more information, see “Compiler Built-In Functions” on page 1-94. 2-28 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 245: Smaller Applications: Optimizing For Code Size

    0 and 100, where the lower value corresponds to minimum code size and the upper to maximum performance. A value in between will try to optimize the fre- VisualDSP++ 3.5 C/C++ Compiler and Library Manual 2-29 for ADSP-219x DSPs...
  • Page 246 It does, inline however, prevent automatic inlining (using the switch) from increas- ing the code size. Macro functions can also cause code expansion and should be used with care. 2-30 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 247: Pragmas

    This way, calls to functions #pragma const may be hoisted out of loops if their parameters are loop independent. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 2-31 for ADSP-219x DSPs...
  • Page 248: Pragma Pure

    , and, therefore, the iterations of the loop may be re-ordered. 2-32 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 249: Pragma Regs_Clobbered

    In this way fewer spills to the stack would be needed in the caller function. Using the prototype #pragma regs_clobbered "AX1, AY0, AY1, AR, ASTAT" int add_mask(int, int); Good: uses to increase call-preserved register set. regs_clobbered VisualDSP++ 3.5 C/C++ Compiler and Library Manual 2-33 for ADSP-219x DSPs...
  • Page 250 Therefore, it is better to use CCset (all condition codes) rather than in the clobbered set above. For ASTAT more information, refer to “#pragma regs_clobbered string” on page 1-130. 2-34 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 251: Pragma Optimize_{Off|For_Speed|For_Space|As_Cmd_Line

    An example of the use of the pragma might be: loop_count #pragma loop_count(/*minimum*/ 40, /*maximum*/ 100, /*modulo*/ 4) for (i=0; i<n; i++) a[i] = b[i]; VisualDSP++ 3.5 C/C++ Compiler and Library Manual 2-35 for ADSP-219x DSPs...
  • Page 252: Pragma No_Alias

    This helps to produce shorter loop kernels as it permits instructions in the loop to be rearranged more freely. “#pragma no_alias” on page 1-125 for more information. 2-36 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 253: Useful Optimization Switches

    Optimizes the file for size. on page 1-37 Controls speed vs. size optimizations (sliding scale). -Ov num on page 1-38 Saves intermediate files (for example, -save-temps on page 1-44 VisualDSP++ 3.5 C/C++ Compiler and Library Manual 2-37 for ADSP-219x DSPs...
  • Page 254 Useful Optimization Switches 2-38 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 255 ANSI standard and functions supplied by Analog Devices that are of value in signal processing applications. In addi- tion to the Standard C Library, this release of the compiler software VisualDSP++ 3.5 C/C++ Compiler and Library Manual...
  • Page 256 VisualDSP++, use the Help Topics command (Help menu) and select the Reference book icon. From the Online Manuals topic, you can open any of the library files. You can also manually access the HTML files using a web browser. VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 257: C/C++ Run-Time Library

    For information on the C library’s contents, see “Documented Library Functions” on page 3-23. For information on the Abridged C++ library’s contents, see “Abridged C++ Library Support” on page 3-16 and on-line Help. VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 258: Calling Library Functions

    C, as shown by the following example. extern "C" { int myfunc(int); // external name is _myfunc Alternatively, compile C++ files to assembler, and see how the function has been declared in the assembly file. VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 259: Using The Compiler's Built-In C Library Functions

    If you want to use the C run-time library functions of the same name, compile with the compiler switch (on page 1-34). -no-builtin VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 260: Linking Library Functions

    For more information on the file, see the VisualDSP++ 3.5 Linker and Utilities Manual for .LDF 16-Bit Processors. Table 3-1 briefly describes the ADSP-219x DSP library functions.
  • Page 261 I/O library libio.dlb ibiomt.dlb libio_type32aworkaround.dlb libiomt_type32aworkaround.dlb Simulator library support libsim.dlb Ensure that the C++ library of run-time routines, , is libcpprt.dlb the last library specified on the link line. VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 262: Working With Library Header Files

    Table 3-2. C Run-Time Library Header Files Header Purpose Standard assert.h Diagnostics ANSI ctype.h Character Handling ANSI def2191.h Memory Map Register and System Defini- C Extension tions for ADSP-2191 DSPs VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 263: Assert.h

    C library. The header files are listed in alphabetical order. assert.h header file contains the macro. assert.h assert ctype.h header file contains functions for character handling, such as ctype.h , etc. isalpha tolower VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 264: Def2191.H - Memory Map Definitions

    The float.h macro, defined in the header file, is set to the C run-time FLT_ROUNDS environment definition of the rounding mode for variables, which float is round-towards-nearest. 3-10 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 265: Iso646.H

    (see -alttok on page 1-23) is specified. limits.h header file contains definitions of maximum and minimum limits.h values for each C data type other than floating-point. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-11 for ADSP-219x DSPs...
  • Page 266: Locale.h

    = abs(x); The value in is truncated to an integer prior to calculating the absolute value, then reconverted to floating point for the assign- ment to 3-12 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 267: Setjmp.h

    C run-time library . The library is thread-safe libc.dlb but it is not interrupt-safe and should not therefore be called either directly or indirectly from an interrupt service routine. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-13 for ADSP-219x DSPs...
  • Page 268 _primIO() and, after servicing the request, returns control to the calling routine. See “File I/O Support” on page 1-166 for more information. 3-14 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 269: Stdlib.h

    C source. See “Compiler Built-In Functions” on page 1-94 for more information on these functions. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-15 for ADSP-219x DSPs...
  • Page 270: Abridged C++ Library Support

    This implementation does not support the full set of complex operations as specified by the C++ standard. In particular, it does not support either the transcendental functions or the I/O operators << and >>. 3-16 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 271: Exception

    Most of the header files include iostream iosfwd header declares forward references to various tem- iosfwd iostream plate classes defined in other standard headers. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-17 for ADSP-219x DSPs...
  • Page 272: Iostream

    Most of the iostream header files include streambuf 3-18 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 273: String

    C++ header files that provide access to the C library facilities. Table 3-4. C++ Header Files for C Library Facilities Header Description Enforces assertions during function executions. cassert Classifies characters. cctype VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-19 for ADSP-219x DSPs...
  • Page 274: Embedded Standard Template Library Header Files

    C++ cc219x mode. The embedded standard template library headers are: algorithm header defines numerous common operations on algorithm sequences. deque header defines a deque template container. deque 3-20 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 275: Functional

    VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-21 for ADSP-219x DSPs...
  • Page 276: Set

    3-22 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 277: Documented Library Functions

    Table 3-7. Documented Library Functions in the Header File setjmp.h longjmp setjmp VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-23 for ADSP-219x DSPs...
  • Page 278 Table 3-11. Documented Library Functions in Header File stdlib.h abort atexit atof atoi atol bsearch calloc exit free labs 3-24 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 279 Table 3-13. Documented Library Functions in Header File sysreg.h disable_interrupts enable_interrupts external_memory_read external_memory_write io_space_read io_space_write mode_change sysreg_read sysreg_write VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-25 for ADSP-219x DSPs...
  • Page 280: C Run-Time Library Reference

    Name and Purpose of the function Synopsis—Required header file and functional prototype Description—Function specification Error Conditions—How the function indicates an error Example—Typical function usage See Also—Related functions 3-26 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 281: Abort

    Error Conditions function does not return. abort Example #include <stdlib.h> extern int errors; if(errors) /* terminate program if */ abort(); /* errors are present See Also atexit, exit VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-27 for ADSP-219x DSPs...
  • Page 282: Abs

    INT_MIN Error Conditions function does not return an error condition. Example #include <stdlib.h> int i; i = abs(-5); /* i == 5 */ See Also fabs, labs 3-28 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 283: Acos

    Example #include <math.h> double y; /* y = π/2 */ y = acos(0.0); See Also VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-29 for ADSP-219x DSPs...
  • Page 284: Asin

    Example #include <math.h> double y; /* y = π/2 */ y = asin(1.0); See Also 3-30 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 285: Atan

    ). The input argument is in radians. 0x6488 Error Conditions function does not return an error condition. atan Example #include <math.h> double y; y = atan(0.0); /* y = 0.0 */ See Also atan2, VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-31 for ADSP-219x DSPs...
  • Page 286: Atan2

    = atan2 (0.0, 0.5); /* the error condition: a = 0.0 */ π b = atan2f (1.0, 0.0); /* b = See Also atan, 3-32 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 287: Atexit

    Up to 32 functions can be registered using atexit Error Conditions function returns a non-zero value if the function cannot be atexit registered. Example #include <stdlib.h> extern void goodbye(void); if (atexit(goodbye)) exit(1); See Also abort, exit VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-33 for ADSP-219x DSPs...
  • Page 288: Atof

    The form of a hexadecimal floating-point number is: [sign] [{0x}|{0X}] [hexdigs] [.hexdigs] [{p|P} [sign] [digits]] 3-34 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 289 (valid) representation of 0.0 or some invalid numerical string. Example #include <stdlib.h> double x; x = atof("5.5"); /* x == 5.5 */ VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-35 for ADSP-219x DSPs...
  • Page 290 C Run-Time Library Reference See Also atoi, atol, strtod 3-36 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 291: Atoi

    Example #include <stdlib.h> int i; i = atoi("5"); /* i == 5 */ See Also atol, atof, strtod, strtol, strtoul VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-37 for ADSP-219x DSPs...
  • Page 292: Atol

    Example #include <stdlib.h> long int i; i = atol("5"); /* i == 5 */ See Also atoi, atof, strtod, strtol, strtoul 3-38 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 293: Bsearch

    Error Conditions function returns a null pointer if the key is not found in the bsearch array. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-39 for ADSP-219x DSPs...
  • Page 294 C Run-Time Library Reference Example #include <stdlib.h> char *answer; char base[50][3]; answer = bsearch("g", base, 50, 3, strcmp); See Also qsort 3-40 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 295: Calloc

    Example #include <stdlib.h> int *ptr; ptr = (int *) calloc(10, sizeof(int)); /* ptr points to a zeroed array of length 10 */ See Also free, malloc, realloc VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-41 for ADSP-219x DSPs...
  • Page 296: Ceil

    Example #include <math.h> double y; y = ceil (1.05); /* y = 2.0 y = ceilf (-1.05); /* y = -1.0 */ See Also floor 3-42 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 297 , or on when empty LOOP COUNTER push SIG_KERNEL kernel interrupt SIG_INT4 user-assignable SIG_INT5 user-assignable SIG_INT6 user-assignable SIG_INT7 user-assignable SIG_INT8 user-assignable SIG_INT9 user-assignable SIG_INT10 user-assignable SIG_INT11 user-assignable SIG_INT12 user-assignable SIG_INT13 user-assignable VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-43 for ADSP-219x DSPs...
  • Page 298: Clear_Interrupt

    Example #include <signal.h> clear_interrupt(SIG_PWRDWN); /* clear the interrupt 2 latch */ See Also interrupt, raise, signal 3-44 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 299: Cos

    [-1.0, 1.0). Error Conditions function does not return an error condition. Example #include <math.h> double y; y = cos(3.14159); /* y = -1.0 */ VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-45 for ADSP-219x DSPs...
  • Page 300 /* -cos_fr16([0x0..0x7fff]) = [0..0x8000) */ return -cos_fr16((0xc000 + x) * 4); } else { π π /* fourth quadrant [3/2 /* cos_fr16([0x8000..0x0)) = [0x8000..0) return cos_fr16((0x8000 + x) * 4); 3-46 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 301 C/C++ Run-Time Library See Also acos, VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-47 for ADSP-219x DSPs...
  • Page 302: Cosh

    Error Conditions function returns the IEEE constant if the argument is out- cosh +Inf side the domain. Example #include <math.h> double x,y; y = cosh(x); See Also sinh 3-48 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 303: Disable_Interrupts

    Example #include <sysreg.h> main(){ disable_interrupts(); // emits "DIS INTS;" // instruction inline See Also enable_interrupts, io_space_read, io_space_write, mode_change, sysreg_read, sysreg_write VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-49 for ADSP-219x DSPs...
  • Page 304: Div

    Error Conditions is zero, the behavior of the function is undefined. denom Example #include <stdlib.h> div_t result; result = div(5, 2); /* result.quot=2, result.rem=1 */ See Also ldiv, fmod, modf 3-50 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 305: Enable_Interrupts

    Example #include <sysreg.h> main(){ enable_interrupts(); // emits "ENA INTS;" // instruction inline See Also disable_interrupts, io_space_read, io_space_write, mode_change, sysreg_read, sysreg_write VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-51 for ADSP-219x DSPs...
  • Page 306: Exit

    , and control is passed to the label , which is defined in the run-time startup file. ___lib_prog_term Error Conditions function does not return an error condition. exit Example #include <stdlib.h> exit(EXIT_SUCCESS); See Also abort, atexit 3-52 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 307: Exp

    In the case of underflow, the errno function returns a zero. Example #include <math.h> double y; y = exp(1.0); /* y = 2.71828...*/ See Also alog, log, VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-53 for ADSP-219x DSPs...
  • Page 308: External_Memory_Read

    Example #include <sysreg.h> section("external_memory_section") static int GlobalTable[256]; int main() { int page, read_value; asm("%0 = PAGE(GlobalTable);" : "=e"(page): : ); 3-54 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 309 C/C++ Run-Time Library read_value = external_memory_read(page, &GlobalTable[1]); return read_value; See Also external_memory_write, disable_interrupts, enable_interrupts, io_space_read, io_space_write, mode_change, sysreg_read, sysreg_write VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-55 for ADSP-219x DSPs...
  • Page 310: External_Memory_Write

    Example #include <sysreg.h> section("external_memory_section") static int GlobalTable[256]; int main() { int page, value_to_write = 0; asm("%0 = PAGE(GlobalTable);" : "=e"(page): : ); 3-56 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 311 C/C++ Run-Time Library external_memory_write(page, &GlobalTable[1], value_to_write); See Also external_memory_read, disable_interrupts, enable_interrupts, io_space_read, io_space_write, sysreg_read, sysreg_write VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-57 for ADSP-219x DSPs...
  • Page 312: Fabs

    Example #include <math.h> double y; y = fabs(-2.3); /* y = 2.3 */ y = fabs(2.3); /* y = 2.3 */ See Also abs, labs 3-58 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 313: Floor

    Example #include <math.h> double y; y = floor(1.25); /* y = 1.0 y = floor(-1.25); /* y = -2.0 */ See Also ceil VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-59 for ADSP-219x DSPs...
  • Page 314: Fmod

    Error Conditions function does not return an error condition. fmod Example #include <math.h> double y; y = fmod(5.0, 2.0); /* y = 1.0 */ See Also div, ldiv, modf 3-60 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 315: Free

    Example #include <stdlib.h> char *ptr; ptr = malloc(10); /* Allocate 10 words from heap */ free(ptr); /* Return space to free heap See Also calloc, malloc, realloc VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-61 for ADSP-219x DSPs...
  • Page 316: Frexp

    Error Conditions function does not return an error condition. frexp Example #include <math.h> double y; int exponent; y = frexp(2.0, &exponent); /* y=0.5, exponent=2 */ See Also modf 3-62 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 317: Interrupt

    (*interrupt (int sig, void(*func)(int))) (int); void (*interruptf(int sig, void(*func)(int))) (int); void (*interrupts(int sig, void(*func)(int))) (int); Description These functions are Analog Devices extensions to the ANSI standard. function determines how a signal received during program interrupt execution is handled. The...
  • Page 318 SIG_INT6 user-assignable SIG_INT7 user-assignable SIG_INT8 user-assignable SIG_INT9 user-assignable SIG_INT10 user-assignable SIG_INT11 user-assignable SIG_INT12 user-assignable SIG_INT13 user-assignable SIGABRT software interrupt SIGILL software interrupt SIGINT software interrupt SIGSEGV software interrupt 3-64 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 319 (int sig) { /* Interrupt Service Routine (ISR) */ main () { /* enable power down interrupt and register ISR */ interrupt(SIG_PWRDWN, handler); /* disable power down interrupt */ VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-65 for ADSP-219x DSPs...
  • Page 320 C Run-Time Library Reference interrupt(SIG_PWRDWN, SIG_IGN); /* enable power down interrupt and register ISR */ interruptf(SIG_PWRDWN, handler); /* disable power down interrupt */ interruptf(SIG_PWRDWN, SIG_IGN); See Also signal, raise 3-66 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 321: Io_Space_Read

    Example #include <sysreg.h> int addr = 0xA; main(){ int v1 = io_space_read(0xA); /* inline instruction will be generated int v2 = io_space_read(addr); /* library support routine will be called VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-67 for ADSP-219x DSPs...
  • Page 322 C Run-Time Library Reference See Also disable_interrupts, enable_interrupts, io_space_write, mode_change, sysreg_read,sysreg_write 3-68 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 323: Io_Space_Write

    Example #include <sysreg.h> int addr = 0xA; int val = 0xA; main(){ int v1 = io_space_write(0xA, val); /* inline instruction will be generated VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-69 for ADSP-219x DSPs...
  • Page 324 C Run-Time Library Reference int v2 = io_space_write(addr, 0xFF); /* support routine will be called See Also disable_interrupts, enable_interrupts, io_space_read, mode_change, sysreg_read, sysreg_write 3-70 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 325: Isalnum

    Example #include <ctype.h> int ch; for (ch=0; ch<=0x7f; ch++) { printf("%#04x", ch); printf("%3s", isalnum(ch) ? "alphanumeric" : ""); putchar(‘\n’); See Also isalpha, isdigit VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-71 for ADSP-219x DSPs...
  • Page 326: Isalpha

    Example #include <ctype.h> int ch; for (ch=0; ch<=0x7f; ch++) { printf("%#04x", ch); printf("%2s", isalpha(ch) ? "alphabetic" : ""); putchar(‘\n’); See Also isdigit, isalnum 3-72 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 327: Iscntrl

    Example #include <ctype.h> int ch; for (ch=0; ch<=0x7f; ch++) { printf("%#04x", ch); printf("%2s", iscntrl(ch) ? "control" : ""); putchar(‘\n’); See Also isalnum, isgraph VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-73 for ADSP-219x DSPs...
  • Page 328: Isdigit

    Example #include <ctype.h> int ch; for (ch=0; ch<=0x7f; ch++) { printf("%#04x", ch); printf("%2s", isdigit(ch) ? "digit" : ""); putchar(‘\n’); See Also isalpha, isalnum, isxdigit 3-74 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 329: Isgraph

    Example #include <ctype.h> int ch; for (ch=0; ch<=0x7f; ch++) { printf("%#04x", ch); printf("%2s", isgraph(ch) ? "graph" : ""); putchar(‘\n’); See Also isalnum, iscntrl, isprint VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-75 for ADSP-219x DSPs...
  • Page 330: Isinf

    /* test int isinf(double) */ union { double d; float f; unsigned long l; } u; #ifdef __DOUBLES_ARE_FLOATS__ u.l=0xFF800000L; if ( isinf(u.d)==0 ) fail++; u.l=0xFF800001L; if ( isinf(u.d)!=0 ) fail++; 3-76 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 331 ( isinff(u.f)==0 ) fail++; u.l=0x7F800001L; if ( isinff(u.f)!=0 ) fail++; /* print pass/fail message */ if ( fail==0 ) printf("Test passed\n"); else printf("Test failed: %d\n", fail); See Also isnan VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-77 for ADSP-219x DSPs...
  • Page 332: Islower

    Example #include <ctype.h> int ch; for (ch=0; ch<=0x7f; ch++) { printf("%#04x", ch); printf("%2s", islower(ch) ? "lowercase" : ""); putchar(‘\n’); See Also isalpha, isupper 3-78 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 333: Isnan

    } u; #ifdef __DOUBLES_ARE_FLOATS__ u.l=0xFF800000L; if ( isnan(u.d)!=0 ) fail++; u.l=0xFF800001L; if ( isnan(u.d)==0 ) fail++; u.l=0x7F800000L; if ( isnan(u.d)!=0 ) fail++; VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-79 for ADSP-219x DSPs...
  • Page 334 ( isnanf(u.f)!=0 ) fail++; u.l=0x7F800001L; if ( isnanf(u.f)==0 ) fail++; /* print pass/fail message */ if ( fail==0 ) printf("Test passed\n"); else printf("Test failed: %d\n", fail); See Also isinf 3-80 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 335: Isprint

    Example #include <ctype.h> int ch; for (ch=0; ch<=0x7f; ch++) { printf("%#04x", ch); printf("%3s", isprint(ch) ? "printable" : ""); putchar(‘\n’); See Also isgraph, isspace VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-81 for ADSP-219x DSPs...
  • Page 336: Ispunct

    Example #include <ctype.h> int ch; for (ch=0; ch<=0x7f; ch++) { printf("%#04x", ch); printf("%3s", ispunct(ch) ? "punctuation" : ""); putchar(‘\n’); See Also isalnum 3-82 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 337: Isspace

    Example #include <ctype.h> int ch; for (ch=0; ch<=0x7f; ch++) { printf("%#04x", ch); printf("%2s", isspace(ch) ? "space" : ""); putchar(‘\n’); See Also iscntrl, isgraph VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-83 for ADSP-219x DSPs...
  • Page 338: Isupper

    Example #include <ctype.h> int ch; for (ch=0; ch<=0x7f; ch++) { printf("%#04x", ch); printf("%2s", isupper(ch) ? "uppercase" : ""); putchar(‘\n’); See Also isalpha, islower 3-84 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 339: Isxdigit

    Example #include <ctype.h> int ch; for (ch=0; ch<=0x7f; ch++) { printf("%#04x", ch); printf("%2s", isxdigit(ch) ? "hexadecimal" : ""); putchar(‘\n’); See Also isalnum, isdigit VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-85 for ADSP-219x DSPs...
  • Page 340: Labs

    Error Conditions function does not return an error condition. labs Example #include <stdlib.h> long int j; j = labs(-285128); /* j = 285128 */ See Also abs, fabs 3-86 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 341: Ldexp

    NaN. If the result underflows, ldexp returns a zero. ldexp Example #include <math.h> double y; y = ldexp(0.5, 2); /* y = 2.0 */ See Also exp, VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-87 for ADSP-219x DSPs...
  • Page 342: Ldiv

    Error Conditions is zero, the behavior of the function is undefined. denom ldiv Example #include <stdlib.h> ldiv_t result; result = ldiv(7, 2); /* result.quot=3, result.rem=1 */ See Also div, fmod 3-88 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 343: Log

    EDOM negative. Example #include <math.h> double y; y = log(1.0); /* y = 0.0 */ See Also alog, exp, log10 VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-89 for ADSP-219x DSPs...
  • Page 344: Log10

    ) and log10 errno EDOM returns a zero if the input is negative. Example #include <math.h> double y; y = log10(100.0); /* y = 2.0 */ See Also alog10, log, 3-90 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 345: Longjmp

    Error Conditions function does not return an error condition. longjmp Example #include <setjmp.h> #include <stdio.h> #include <errno.h> #include <stdlib.h> VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-91 for ADSP-219x DSPs...
  • Page 346 ((res == setjmp(env)) != 0) { printf ("Problem %d reported by func ()", res); exit (EXIT_FAILURE); func (); void func (void) if (errno != 0) { longjmp (env, errno); See Also setjmp 3-92 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 347: Malloc

    Example #include <stdlib.h> int *ptr; ptr = (int *)malloc(10); /* ptr points to an /* array of length 10 */ See Also calloc, free, realloc VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-93 for ADSP-219x DSPs...
  • Page 348: Memchr

    Example #include <string.h> char *ptr; ptr= memchr("TESTING", ‘E’, 7); /* ptr points to the E in TESTING See Also strchr, strrchr 3-94 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 349: Memcmp

    Example #include <string.h> char string1 = "ABC"; char string2 = "BCD"; int result; result = memcmp (string1, string2, 3); /* result < 0 */ See Also strcmp, strcoll, strncmp VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-95 for ADSP-219x DSPs...
  • Page 350: Memcpy

    Example #include <string.h> char *a = "SRC"; char *b = "DEST"; memcpy (b, a, 3); /* *b="SRCT" */ See Also memmove, memcpy_from_shared, memcpy_to_shared, strcpy, strncpy 3-96 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 351: Memcpy_From_Shared

    ADSP-2192-12 processor’s shared memory ( 0x20000-0x20FFF Error Conditions function does not return, raise, or set any error memcpy_from_shared conditions. See Also memcpy, memcpy_to_shared VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-97 for ADSP-219x DSPs...
  • Page 352: Memcpy_To_Shared

    ADSP-2192-12 processor’s shared memory ( 0x20000-0x20FFF Error Conditions function does not return, raise, or set any error memcpy_to_shared conditions. See Also memcpy, memcpy_from_shared 3-98 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 353: Memmove

    Example #include <string.h> char *ptr, *str = "ABCDE"; ptr = str + 2; memmove(str, str, 3); /* *ptr = "ABC", *str = "ABABC */ See Also memcpy, strcpy, strncpy VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-99 for ADSP-219x DSPs...
  • Page 354: Memset

    Error Conditions function does not return an error condition. memset Example #include <string.h> char string1[50]; memset(string1, ‘\0’, 50); /* set string1 to 0 */ See Also memcpy 3-100 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 355: Mode_Change

    __MODE_DIS_AR_SAT =0x200, __MODE_DIS_M_MODE =0x400, __MODE_DIS_TIMER =0x800, __MODE_DIS_INT =0x1000, function is implemented as a compiler built-in and the mode_change emitted instructions will be inlined at the point of use. mode_change VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-101 for ADSP-219x DSPs...
  • Page 356 Example #include <sysreg.h> main(){ /* enable TIMER and disable AR saturation */ mode_change( __MODE_ENA_TIMER | __MODE_DIS_AR_SAT ); See Also disable_interrupts, enable_interrupts, io_space_read, io_space_write, sysreg_read, sysreg_write 3-102 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 357: Modf

    Example #include <math.h> double y, n; y = modf(-12.345, &n); /* y = -0.345, n = -12.0 */ See Also frexp VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-103 for ADSP-219x DSPs...
  • Page 358: Pow

    EDOM errno Example #include <math.h> double z; z = pow(4.0, 2.0); /* z = 16.0 */ See Also exp, ldexp 3-104 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 359: Qsort

    The function should return a value less than, equal to, or greater than zero, according to whether the first argument is less than, equal to, or greater than the second. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-105 for ADSP-219x DSPs...
  • Page 360 = *(float *)b; if (aval < bval) return -1; else if (aval == bval) return 0; else return 1; qsort (a, sizeof (a)/sizeof (a[0]), sizeof (a[0]), compare_float); See Also bsearch 3-106 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 361: Raise

    , or on when empty LOOP COUNTER push SIG_KERNEL kernel interrupt SIG_INT4 user-assignable SIG_INT5 user-assignable SIG_INT6 user-assignable SIG_INT7 user-assignable SIG_INT8 user-assignable SIG_INT9 user-assignable SIG_INT10 user-assignable SIG_INT11 user-assignable SIG_INT12 user-assignable SIG_INT13 user-assignable VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-107 for ADSP-219x DSPs...
  • Page 362 Interrupts are not nested by the default start-up file. Error Conditions function returns a zero if successful, a non-zero value if it fails. raise Example #include <signal.h> raise(SIGABRT); See Also interrupt, signal 3-108 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 363: Rand

    – 1. Error Conditions function does not return an error condition. rand Example #include <stdlib.h> int i; i = rand(); See Also srand VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-109 for ADSP-219x DSPs...
  • Page 364: Realloc

    Example #include <stdlib.h> int *ptr; ptr = (int *)malloc(10); /* intervening code ptr = (int *)realloc(ptr, 20); /* the size is now 20 See Also calloc, free, malloc 3-110 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 365: Setjmp

    Error Conditions function does not return an error condition. setjmp Example See code example for “longjmp” on page 3-91. See Also longjmp VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-111 for ADSP-219x DSPs...
  • Page 366: Signal

    (*signal(int sig, void (*func)(int))) (int); void (*signalf(int sig, void (*func)(int))) (int); void (*signals(int sig, void (*func)(int))) (int); Description These functions are Analog Devices extensions to the ANSI standard. function determines how a signal received during program signal execution is handled. The...
  • Page 367 SIG_INT9 user-assignable SIG_INT10 user-assignable SIG_INT11 user-assignable SIG_INT12 user-assignable SIG_INT13 user-assignable SIGABRT software interrupt SIGILL software interrupt SIGINT software interrupt SIGSEGV software interrupt SIGTERM software interrupt SIGFPE software interrupt VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-113 for ADSP-219x DSPs...
  • Page 368 /* disable power down interrupt */ signal(SIG_PWRDWN, SIG_IGN); /* enable power down interrupt and register ISR */ signalf(SIG_PWRDWN, handler); /* disable power down interrupt */ signalf(SIG_PWRDWN, SIG_IGN); 3-114 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 369 C/C++ Run-Time Library See Also interrupt, raise VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-115 for ADSP-219x DSPs...
  • Page 370: Sin

    ] which corresponds to half a period from –( π /2) to π/2. 0x8000 0x7fff It is possible however to derive the full period using the following proper- ties of the function. 3-116 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 371 /* -sin_fr16([0x0..0x7fff]) = [0..0x8000) */ return -sin_fr16((0xc000 + x) * 4); } else { π π /* fourth quadrant [3/2 /* sin_fr16([0x8000..0x0)) = [0x8000..0) return sin_fr16((0x8000 + x) * 4); See Also asin, VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-117 for ADSP-219x DSPs...
  • Page 372: Sinh

    Error Conditions function returns the IEEE constant if the argument is out- sinh +Inf side the domain Example #include <math.h> double x,y; y = sinh(x); See Also cosh 3-118 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 373: Sqrt

    Error Conditions function returns a zero for a negative input. sqrt Example #include <math.h> double y; y = sqrt(2.0); /* y = 1.414..*/ See Also rsqrt VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-119 for ADSP-219x DSPs...
  • Page 374: Srand

    A particular seed value always produces the same sequence of pseudo-random numbers. Error Conditions function does not return an error condition. srand Example #include <stdlib.h> srand(22); See Also rand 3-120 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 375: Strcat

    Example #include <string.h> char string1[50]; string1[0] = ‘A’; string1[1] = ‘B’; string1[2] = ‘\0’; strcat(string1, "CD"); /* new string is "ABCD" */ See Also strncat VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-121 for ADSP-219x DSPs...
  • Page 376: Strchr

    Example #include <string.h> char *ptr1, *ptr2; ptr1 = "TESTING"; ptr2 = strchr(ptr1, ‘E’); /* ptr2 points to the E in TESTING */ See Also memchr, strrchr 3-122 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 377: Strcmp

    Example #include <string.h> char string1[50], string2[50]; if (strcmp(string1, string2)) printf("%s is different than %s \n", string1, string2); See Also memcmp, strncmp VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-123 for ADSP-219x DSPs...
  • Page 378: Strcoll

    Example #include <string.h> char string1[50], string2[50]; if (strcoll(string1, string2)) printf("%s is different than %s \n", string1, string2); See Also strrchr, strncmp 3-124 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 379: Strcpy

    Error Conditions function does not return an error condition. strcpy Example #include <string.h> char string1[50]; strcpy(string1, "SOMEFUN"); /* SOMEFUN is copied into string1 */ See Also memcpy, memmove, strncpy VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-125 for ADSP-219x DSPs...
  • Page 380: Strcspn

    #include <string.h> char *ptr1, *ptr2; size_t len; ptr1 = "Tried and Tested"; ptr2 = "aeiou"; len = strcspn (ptr1, ptr2); /* len = 2 */ See Also strlen, strspn 3-126 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 381: Strerror

    Error Conditions function does not return an error condition. strerror Example #include <string.h> char *ptr1; ptr1 = strerror(1); See Also No references to this function. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-127 for ADSP-219x DSPs...
  • Page 382: Strlen

    Error Conditions function does not return an error condition. strlen Example #include <string.h> size_t len; len = strlen("SOMEFUN"); /* len = 7 */ See Also No references to this function. 3-128 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 383: Strncat

    ’). Error Conditions function does not return an error condition. strncat Example #include <string.h> char string1[50], *ptr; string1[0]=’\0'; strncat(string1, "MOREFUN", 4); /* string1 equals "MORE" */ See Also strcat VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-129 for ADSP-219x DSPs...
  • Page 384: Strncmp

    Example #include <string.h> char *ptr1; ptr1 = "TEST1"; if (strncmp(ptr1, "TEST", 4) == 0) printf("%s starts with TEST \n", ptr1); See Also memcmp, strcmp 3-130 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 385: Strncpy

    Example #include <string.h> char string1[50]; strncpy(string1, "MOREFUN", 4); /* MORE is copied into string1 */ string1[4] = ‘\0’; /* must null-terminate string1 */ See Also memcpy, memmove, strcpy VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-131 for ADSP-219x DSPs...
  • Page 386: Strpbrk

    Example #include <string.h> char *ptr1, *ptr2, *ptr3; ptr1 = "TESTING"; ptr2 = "SHOP" ptr3 = strpbrk(ptr1, ptr2); /* ptr3 points to the S in TESTING */ See Also strspn 3-132 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 387: Strrchr

    Example #include <string.h> char *ptr1, *ptr2; ptr1 = "TESTING"; ptr2 = strrchr(ptr1, ‘T’); /* ptr2 points to the second T of TESTING See Also memchr, strchr VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-133 for ADSP-219x DSPs...
  • Page 388: Strspn

    Example #include <string.h> size_t len; char *ptr1, *ptr2; ptr1 = "TESTING"; ptr2 = "ERST"; len = strspn(ptr1, ptr2); /* len = 4 */ See Also strcspn, strlen 3-134 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 389: Strstr

    Example #include <string.h> char *ptr1, *ptr2; ptr1 = "TESTING"; ptr2 = strstr(ptr1, ‘E’); /* ptr2 points to the E in TESTING See Also strchr VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-135 for ADSP-219x DSPs...
  • Page 390: Strtod

    ( – ) followed by the hexadecimal prefix . This character sequence must be followed by one or more hexadecimal characters that optionally contain a decimal point ( . ). 3-136 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 391 = strtod ("2345.5E4 abc",&rem); /* dd = 2.3455E+7, rem = "abc" */ dd = strtod ("-0x1.800p+9,123",&rem); /* dd = -768.0, rem = ",123" See Also atof, strtol, strtoul VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-137 for ADSP-219x DSPs...
  • Page 392: Strtodf

    ( – ) followed by the hexadecimal prefix . This character sequence must be followed by one or more hexadecimal characters that optionally contain a decimal point ( . ). 3-138 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 393 = strtodf ("2345.5E4 abc",&rem); /* f = 2.3455E+7, rem = "abc" */ f = strtodf ("-0x1.800p+9,123",&rem); /* f = -768.0, rem = ",123 See Also atof, strtol, strtoul VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-139 for ADSP-219x DSPs...
  • Page 394: Strtok

    Example #include <string.h> static char str[] = "a phrase to be tested, today"; char *t; t = strtok(str, " "); /* t points to "a" 3-140 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 395 /* t points to "to be tested" */ t = strtok(NULL, "."); /* t points to " today" t = strtok(NULL, "."); /* t = NULL See Also No references to this function. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-141 for ADSP-219x DSPs...
  • Page 396: Strtol

    (as appropriate) LONG_MAX is returned. If the correct value results in an underflow, LONG_MIN returned. is stored in in the case of either overflow or ERANGE errno underflow. 3-142 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 397 C/C++ Run-Time Library Example #include <stdlib.h> #define base 10 char *rem; long int i; i = strtol("2345.5", &rem, base); /* i=2345, rem=".5" */ See Also atoi, atol, strtoul VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-143 for ADSP-219x DSPs...
  • Page 398: Strtoul

    16; a leading 0 indicates base 8. For any other leading char- acters, base 10 is used. If is between 2 and 36, it is used as a base for base conversion. 3-144 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 399 #include <stdlib.h> #define base 10 char *rem; unsigned long int i; i = strtoul("2345.5", &rem, base); /* i = 2345, rem = ".5" */ See Also atoi, atol, strtol VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-145 for ADSP-219x DSPs...
  • Page 400: Strxfrm

    Error Conditions function does not return an error condition. strxfrm Example #include <string.h> char string1[50]; 3-146 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 401 C/C++ Run-Time Library strxfrm(string1, "SOMEFUN", 49); /* SOMEFUN is copied into string1 */ See Also strcmp, strcoll, strncpy VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-147 for ADSP-219x DSPs...
  • Page 402 Interrupt Latch high address register sysreg_DMPG1 DMPG1 high address register sysreg_DMPG2 DMPG2 I/O page register sysreg_IOPG IOPG System Control Register set: base register sysreg_B0 base register sysreg_B1 base register sysreg_B2 3-148 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 403 The compiler will not validate the input, instead it will rely on the assembler to fault erroneous values. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-149 for ADSP-219x DSPs...
  • Page 404 C Run-Time Library Reference Example #include <sysreg.h> main(){ int value = sysreg_read(sysreg_IMASK); See Also disable_interrupts, enable_interrupts, io_space_read, io_space_write, mode_change, sysreg_write 3-150 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 405 Interrupt Latch high address register sysreg_DMPG1 DMPG1 high address register sysreg_DMPG2 DMPG2 I/O page register sysreg_IOPG IOPG System Control Register set: base register sysreg_B0 base register sysreg_B1 VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-151 for ADSP-219x DSPs...
  • Page 406 The inclusion of the include file is mandatory when using sysreg.h sysreg_write Error Conditions function does not return, raise, or set any error sysreg_write conditions. 3-152 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 407: Sysreg_Read

    C/C++ Run-Time Library Example #include <sysreg.h> main(){ sysreg_write(sysreg_IMASK,0x1); See Also disable_interrupts, enable_interrupts, io_space_read,io_space_write, mode_change, sysreg_read VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-153 for ADSP-219x DSPs...
  • Page 408: Tan

    Example #include <math.h> double y; y = tan(3.14159/4.0); /* y = 1.0 */ See Also atan, atan2 3-154 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 409: Tanh

    Error Conditions function does not return an error condition. tanh Example #include <math.h> double x,y; y = tanh(x); See Also cosh, sinh VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-155 for ADSP-219x DSPs...
  • Page 410: Tolower

    Example #include <ctype.h> int ch; for (ch=0; ch<=0x7f; ch++) { printf("%#04x", ch); if(isupper(ch)) printf("tolower=%#04x", tolower(ch)); putchar(‘\n’); See Also islower, isupper, toupper 3-156 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 411: Toupper

    Example #include <ctype.h> int ch; for (ch=0; ch<=0x7f; ch++) { printf("%#04x", ch); if(islower(ch)) printf("toupper=%#04x", toupper(ch)); putchar(‘\n’); See Also islower, isupper, tolower VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-157 for ADSP-219x DSPs...
  • Page 412: Va_Arg

    3-158 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 413 (!result) return result; *result = ''; va_start (ap,s1); s = s1; while (s){ strcat (result,s); s = va_arg (ap,char *); va_end (ap); return result; See Also va_end, va_start VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-159 for ADSP-219x DSPs...
  • Page 414: Va_End

    Error Conditions macro does not return an error condition. va_end Example “va_arg” on page 3-158. See Also va_arg, va_start 3-160 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 415: Va_Start

    Error Conditions macro does not return an error condition. va_start Example “va_arg” on page 3-158. See Also va_arg, va_end VisualDSP++ 3.5 C/C++ Compiler and Library Manual 3-161 for ADSP-219x DSPs...
  • Page 416 C Run-Time Library Reference 3-162 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 417: Dsp Run-Time Library

    The services provided by the library include support for gen- eral purpose signal processing such as companders, filters, and Fast Fourier Transform (FFT) functions. All these services are Analog Devices extensions to ANSI standard C. These functions are in addition to the C/C++ run-time library functions that are described in Chapter 3, “C/C++ Run-Time...
  • Page 418: Dsp Run-Time Library Guide

    “C/C++ and Assembly Lan- guage Interface” on page 1-169. You can use the archiver, described in the VisualDSP++ 3.5 Linker and Utilities Manual for 16-Bit Processors, to build library archive files of your own functions. VisualDSP++ 3.5 C/C++ Compiler and Library Manual...
  • Page 419: Linking Dsp Library Functions

    DSP assembly language and an understanding of the run-time environ- ment, as explained in“C/C++ and Assembly Language Interface” on page 1-169. Before you make any modifications to the source code, copy VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 420: Dsp Header Files

    Test the function before you use it in your system to verify that it is functionally correct. Analog Devices only supports the run-time library functions as provided. DSP Header Files The DSP header files contains prototypes for all the DSP library func- tions.
  • Page 421 (complex_float a, complex_float b); complex_fract16 cadd_fr16 (complex_fract16 a, complex_fract16 b); Complex complex_double csub (complex_double a, complex_double b); Subtraction complex_float csubf (complex_float a, complex_float b); complex_fract16 csub_fr16 (complex_fract16 a, complex_fract16 b); VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 422: Filter.h — Dsp Filters And Transformations

    A-law and µ-law companders that are used by voice-band compression and expansion applications. The header file also contains functions that perform key transformations used in DSPs, including FFTs and convolution. VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 423 FIR Interpolation void fir_interp_fr16 Filter (const fract16 x[], fract16 y[], int n, fir_state_fr16 *s); Complex Finite Impulse void cfir_fr16 Response Filter (const complex_fract16 x[], complex_fract16 y[], int n, cfir_state_fr16 *s); VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 424 *block_exponent, int scale_method) N Point Radix 4 void rfftrad4_fr16 Real Input FFT (const fract16 *in, complex_fract16 *t, complex_fract16 *out, const complex_fract16 *w, int wst, int n, int *block_exponent, int scale_method) VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 425 3x3 Matrix (const fract16 *cin, int crow1, int ccol1, const fract16 cin2 [3] [3], fract16 *cout) Compression/Expansion A-law Compression void a_compress (const short in[], short out[], int n) VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 426: Math.h — Math Functions

    (float x); Base 10 Anti-log double alog10 (double x); float alog10f (float x); Arc Cosine double acos (double x); float acosf (float x); fract16 acos_fr16 (fract16 x); 4-10 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 427 (float x, int *n); Multiply by Power of 2 double ldexp (double x, int n); float ldexpf (float x, int n); Natural Logarithm double log (double x); float logf (float x); VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-11 for ADSP-219x DSPs...
  • Page 428: Matrix.h — Matrix Functions

    “complex.h — Basic Complex Arithmetic Functions” on page 4-4 definition of the complex types. 4-12 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 429 Subtraction void matssubf (const float *a, const float b, int n, int m, float *c); void matssub_fr16 (const fract16 *a, const fract16 b, int n, int m, fract16 *c); VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-13 for ADSP-219x DSPs...
  • Page 430 *c); Subtraction void cmatssubf (const complex_float *a, complex_float b, int n, int m, complex_float *c); void cmatssub_fr16 (const complex_fract16 *a, complex_fract16 b, int n, int m, complex_fract16 *c); 4-14 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 431 (const double *a, int n, int m, double *c); void transpmf (const float *a, int n, int m, float *c); void transpm_fr16 (const fract16 *a, int n, int m, fract16 *c); VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-15 for ADSP-219x DSPs...
  • Page 432: Stats.h — Statistical Functions

    (const float a[ ], int n) fract16 var_fr16 (const fract16 a[ ], int n); Count Zero float zero_crossf (const float a[ ], int n); Crossing fract16 zero_cross_fr16 (const fract16 a[ ], int n); 4-16 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 433: Vector.h — Vector Functions

    (const float a [ ], float b, float c [ ], int n); void vecsmlt_fr16 (const fract16 a [ ], fract16 b, fract16 c [ ], int n); VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-17 for ADSP-219x DSPs...
  • Page 434 (const double a [ ], int n); Value of Vector int vecminlocf (const float a [ ], int n); Elements int vecminloc_fr16 (const fract16 a [ ], int n); 4-18 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 435 [ ], complex_float c [ ], int n); void cvecvmlt_fr16 (const complex_fract16 a [ ], const complex_fract16 b [ ], complex_fract16 c [ ], int n); VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-19 for ADSP-219x DSPs...
  • Page 436: Window.h — Window Generators

    (fract16 w[ ], int a, int n); Window Generate Blackman void gen_blackman_fr16 (fract16 w[ ], int a, int n); Window Generate Gaussian void gen_gaussian_fr16 (fract16 w[ ], float alpha, int a, int n); Window 4-20 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 437 (fract16 w[ ], int a, int n); Window Generate Triangle void gen_triangle_fr16 (fract16 w[ ], int a, int _n); Window Generate Vonhann void gen_vonhann_fr16 (fract16 _w[ ], int a, int n); Window VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-21 for ADSP-219x DSPs...
  • Page 438 • Notes — Other miscellaneous notations For some functions, the interface is presented using the “K&R” style for ease of documentation. An ANSI C prototype is provided in the header file. 4-22 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 439: A_Compress

    G.711. Each sample is compressed to 8 bits and is returned in the vector pointed to by Algorithm C(k)=a-law compression of A(k) for k=0 to n-1 Domain content of input array: -4096 to 4095 VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-23 for ADSP-219x DSPs...
  • Page 440: A_Expand

    A-law definition and is returned in the vector pointed to by Algorithm C(k)=a-law expansion of A(k) for k=0 to n-1 Domain content of input array: 0 to 255 4-24 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 441: Alog

    Algorithm c = e Domain x = [-87.9 , 88.6] alog() alogf() Example #include <math.h> double y; y = alog(1.0); /* y = 2.71828... */ VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-25 for ADSP-219x DSPs...
  • Page 442: Alog10

    0.0. Algorithm (x * log(10.0)) c = e Domain x = [-38.2 , 38.5] alog10() alog10f() Example #include <math.h> double y; y = alog10(1.0); /* y = 10.0 */ 4-26 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 443: Arg

     Re( ) Domain -3.4 x 10 to +3.4 x 10 argf( ), arg( ) -1.0 to +1.0 arg_fr16( ) Note Im (a) /Re (a) < =1 arg_fr16( ) VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-27 for ADSP-219x DSPs...
  • Page 444: Autocoh

    − ) * ( where k={0,1,...,m-1} and is the mean value of input vector Domain -3.4 x 10 to +3.4 x 10 autocohf( ) -1.0 to 1.0 autocoh_fr16( ) 4-28 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 445: Autocorr

    Algorithm − − ∑ where k={0,1,...,m-1} Domain -3.4 x 10 to +3.4 x 10 autocorrf( ) -1.0 to + 1.0 autocorr_fr16( ) VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-29 for ADSP-219x DSPs...
  • Page 446: Cabs

    The minimum input value for both real and imaginary parts can be less than 1/256 for but the result may have bit error of 2 to 3 bits. cabs_fr16 4-30 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 447: Cadd

    , and returns the result. Algorithm Re(c) = Re(a) + Re(b) Im(c) = Im(a) + Im(b) Domain -3.4 x 10 to +3.4 x 10 caddf( ), cadd( ) -1.0 to +1.0 cadd_fr16( ) VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-31 for ADSP-219x DSPs...
  • Page 448: Cartesian

    “polar” on page 4-91). Algorithm magnitude = cabs(a) phase = arg(a) Domain -3.4 x 10 to +3.4 x 10 cartesianf ( ), cartesian ( ) -1.0 to +1.0 cartesian_fr16 ( ) 4-32 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 449 DSP Run-Time Library Example #include <complex.h> complex_float point = {-2.0 , 0.0}; float phase; float mag; π mag = cartesianf (point,&phase); /* mag = 2.0, phase = VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-33 for ADSP-219x DSPs...
  • Page 450: Cdiv

    This function computes the complex division of two complex inputs: , and returns the result. Algorithm − Domain -3.4 x 10 to +3.4 x 10 cdivf( ), cdiv( ) -1.0 to 1.0 cdiv_fr16( ) 4-34 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 451: Cexp

    This function computes the complex exponential of real input returns the result. Algorithm Re(c) = cos(a) Im(c) = sin(a) Domain a = [-9099 ... 9099] cexpf( ) cexp( ) VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-35 for ADSP-219x DSPs...
  • Page 452: Cfft

    Specifying the input array as the temporary array will also result in increased run-time performance. 4-36 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 453 When the sequence length, , equals power of four, the algo- cfftrad4 rithm is also available. Domain Input sequence length must be a power of two and at least 16. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-37 for ADSP-219x DSPs...
  • Page 454: Cfftrad4

    Specifying the input array as the temporary array will also result in increased run-time performance. 4-38 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 455 , is not a power of four, the radix2 method must be used. See “cfft” on page 4-36 for more information. Domain Input sequence length must be a power of four, and at least 16. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-39 for ADSP-219x DSPs...
  • Page 456: Cfft2D

    If the twiddle table contains more factors than needed for a particular call on , then the stride factor has to be set appro- cfft2d_fr16 priately; otherwise it should be 1. 4-40 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 457 ( , ) a k l e ( , ) * where i={0,1,...,n -1}, j={0,1,2,...,n-1} Domain Input sequence length must be a power of two and at least 16. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-41 for ADSP-219x DSPs...
  • Page 458: Cfir

    The macro , in the header file, is available to initialize the struc- cfir_init filter.h ture and is defined as: 4-42 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 459 Algorithm − ∑ − ( ) * ( fo r , , . . . Domain -1.0 to +1.0 VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-43 for ADSP-219x DSPs...
  • Page 460: Clip

    Description This function clips a value if it is too large. Algorithm if (|parm1| < |parm2|) return(parm1) else return(|parm2| * signof(parm1)) Domain Full range for various input parameter types. 4-44 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 461: Cmlt

    Re(c) = Re(a) * Re(b) - Im(a) * Im(b) Im(c) = Re(a) * Im(b) + Im(a) * Re(b) Domain -3.4 x 10 to +3.4 x 10 cmltf( ), cmlt() -1.0 to 1.0 cmlt_fr16( ) VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-45 for ADSP-219x DSPs...
  • Page 462: Conj

    Algorithm Re(c) = Re(a) Im(c) = -Im(a) Domain – 3.4 x 10 to +3.4 x 10 conjf ( ) conj ( ) – 1.0 to 1.0 conj_fr16 ( ) 4-46 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 463: Convolve

    − − • − − cout clen clen n = 0 clen1 + clen2-2 (Values for are considered to be zero for cin1[j] j < 0 j > clen1-1 VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-47 for ADSP-219x DSPs...
  • Page 464 “B”, the elements of cin1 cin2 the output vector are: {A[0]*B[0], A[1]*B[0] + A[0]*B[1], A[2]*B[0] + A[1]*B[1] + A[0]*B[2], A[3]*B[0] + A[2]*B[1] + A[1]*B[2], A[3]*B[1] + A[2]*B[2], A[3]*B[2]} Domain -1.0 to +1.0 4-48 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 465: Conv2D

    ∑ ∑ • − − − − mout min1 min2 mcol mrow for c = 0 to and r = 0 to mcol1 mcol2-1 mrow2-1 Domain -1.0 to +1.0 VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-49 for ADSP-219x DSPs...
  • Page 466: Conv2D3X3

    ∑ ∑ • − − mout min1 min2 for c = 0 to and r = 0 to mcol1+2 mrow1+2 Domain -1.0 to +1.0 4-50 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 467: Copysign

    (fract16 parm1, fract16 parm2) Description This function copies the sign of the second argument to the first argument. Algorithm return (|parm1| * copysignof(parm2)) Domain Full range for type of parameters used. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-51 for ADSP-219x DSPs...
  • Page 468: Cot

    , which is mea- sured in radians. If is outside of the domain, the function returns 0. Algorithm c = cot(a) Domain x = [–9099 ... 9099] cotf( ) ot( ) 4-52 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 469: Countones

    Description This function counts the number of one bits in parm Algorithm − ∑ return = bit[j] of parm where is the number of bits in parm VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-53 for ADSP-219x DSPs...
  • Page 470: Crosscoh

    Domain -3.4 x 10 to +3.4 x 10 crosscohf( ) -1.0 to +1.0 crosscoh_fr16( ) 4-54 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 471: Crosscorr

    , and stores the result to output vector Algorithm − − ∑ where k={0,1,...,m-1} Domain -3.4 x 10 to +3.4 x 10 crosscorrf( ) -1.0 to +1.0 crosscorr_fr16( ) VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-55 for ADSP-219x DSPs...
  • Page 472: Csub

    , and returns the result. Algorithm – Re(c) = Re(a) Re(b) – Im(c) = Im(a) Im(b) Domain -3.4 x 10 to +3.4 x 10 csubf( ), csub( ) -1.0 to 1.0 csub_fr16( ) 4-56 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 473: Fir

    , which must be declared and initialized before calling the function. The macro , in the header file, is available to initialize the structure fir_init filter.h and is defined as: VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-57 for ADSP-219x DSPs...
  • Page 474 . This field is nor- s->l fir_fr16 mally set to an interpolation/decimation index before calling either the functions. fir_interp_fr16 fir_decima_fr16 Algorithm − ∑ − ,... Domain -1.0 to +1.0 4-58 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 475 , which must be declared and initialized before calling the function. The macro , in the header file, is available to initialize the structure fir_init filter.h and is defined as: VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-59 for ADSP-219x DSPs...
  • Page 476 Algorithm − ∑ where i = 0,1,...,(n/l) - 1 Domain -1.0 to + 1.0 4-60 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 477 , which must be declared and initialized before calling the function. The macro , in the header file, is available to initialize the structure fir_init filter.h and is defined as: VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-61 for ADSP-219x DSPs...
  • Page 478 Algorithm − ∑ − 0,1,..., where i = 0,1,...,n-1 Domain -1.0 to +1.0 4-62 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 479 There is no standard definition for the Triangle window for even ; the slopes of the Triangle window are slightly steeper than those of the Bartlett window. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-63 for ADSP-219x DSPs...
  • Page 480 DSP Run-Time Library Reference Algorithm − − [ ] = − − where n = {0, 1, 2, ..., N-1} Domain a > 0; N > 0 4-64 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 481 0 42 0 5 . cos 0 08        − − where n = {0, 1, 2, ..., N-1} Domain a > 0; N > 0 VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-65 for ADSP-219x DSPs...
  • Page 482      where n = {0, 1, 2, ..., N-1} and α is an input parameter Domain a > 0; N > 0; α > 0.0 4-66 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 483 Algorithm π   − 0 54 0 46     − where n = {0, 1, 2, ..., N-1} Domain a > 0; N > 0 VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-67 for ADSP-219x DSPs...
  • Page 484 Cosine window. Algorithm π   −   −   where n = {0, 1, 2, ..., N-1} Domain a > 0; N > 0 4-68 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 485   01168   − − −       where n = {0, 1, 2, ..., N-1} Domain a > 0; N > 0 VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-69 for ADSP-219x DSPs...
  • Page 486 = {0, 1, 2, ..., N-1}, α = (N - 1) / 2, and I ( β ) represents the zeroth-order modified Bessel function of the first kind. Domain a > 0; N > 0; β > 0.0 4-70 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 487 . The length of the output vector should therefore be Algorithm w[n] = 1 where n = {0, 1, 2, ..., N-1} Domain a > 0; N > 0 VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-71 for ADSP-219x DSPs...
  • Page 488 Triangle window. Algorithm For even , the following equation applies:  <  [ ] =  − −  >  where n = {0, 1, 2, ..., N-1} 4-72 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 489 , the following equation applies:  <  [ ] =  −  >  where n = {0, 1, 2, ..., N-1} Domain a > 0; N > 0 VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-73 for ADSP-219x DSPs...
  • Page 490 /* Address stride in samples for window vector */ int N; /* Length of window vector Description This function is identical to window (on page 4-68). gen_hanning Domain a > 0; N > 0 4-74 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 491: Histogram

    (max – min) / m output vector Any input value that is outside the range will exceed the [ min, max ) boundaries of the output vector and will be discarded. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-75 for ADSP-219x DSPs...
  • Page 492 , multiplied by and is 1/binsize rounded. The appropriate bin in the output vector is then incremented. Domain -3.4 x 10 to +3.4 x 10 histogramf() -1.0 to +1.0 histogram_fr16() 4-76 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 493: Ifft

    If the twiddle table contains more coefficients than needed for a particular call on , then the stride factor has to be ifft_fr16 set appropriately; otherwise it should be 1. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-77 for ADSP-219x DSPs...
  • Page 494 Domain Input sequence length must be a power of two and at least 16. 4-78 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 495: Ifftrad4

    FFT size. If the input data can be overwritten, then optimum memory usage can be achieved by specifying the input array as the output array. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-79 for ADSP-219x DSPs...
  • Page 496 Domain Input sequence length must be a power of four and at least 16. 4-80 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 497: Ifft2D

    FFT size. If the input data can be overwritten, then optimum memory usage can be achieved by specifying the input array as the output array. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-81 for ADSP-219x DSPs...
  • Page 498 ( , ) a k l ( , ) * where i={0,1,...,n -1}, j={0,1,2,...,n-1} Domain Input sequence length must be a power of two and at least 16. 4-82 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 499: Iir

    , in the header file, is available to initialize the structure iir_init filter.h and is defined as: #define iir_init(state, coeffs, delay, stages) (state).c = (coeffs); (state).d = (delay); (state).k = (stages) VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-83 for ADSP-219x DSPs...
  • Page 500 Algorithm − − ( ) = − − − − where − − − − where m={0,1,2,...,n-1} Domain -1.0 to +1.0 4-84 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 501: Max

    (fract16 parm1, fract16 parm2) Description This function returns the larger of its two arguments. Algorithm if (parm1 > parm2) return(parm1) else return(parm2) Domain Full range for type of parameters. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-85 for ADSP-219x DSPs...
  • Page 502: Mean

    This function computes the mean of the input elements contained within input vector and returns the result. Algorithm − ∑ Domain -3.4 x 10 to +3.4 x 10 meanf( ) -1.0 to +1.0 mean_fr16( ) 4-86 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 503: Min

    (fract16 parm1, fract16 parm2) Description This function returns the smaller of its two arguments. Algorithm if (parm1 < parm2) return(parm1) else return(parm2) Domain Full range for type of parameters used. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-87 for ADSP-219x DSPs...
  • Page 504 G.711. Each sample is compressed to 8 bits and is returned in the vector pointed to by Algorithm C(k)= mu_law compression of A(k) for k=0 to n-1 Domain Content of input array: -8192 to 8191 4-88 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 505 µ-law definition and is returned in the vector pointed to Algorithm C(k)= mu_law expansion of A(k) for k=0 to n-1 Domain Content of input array: 0 to 255 VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-89 for ADSP-219x DSPs...
  • Page 506: Norm

    Re( ) Re( ) Re ( ) Im ( ) Im( ) Im( ) Re ( ) Im ( ) Domain -3.4 x 10 to +3.4 x 10 normf () 4-90 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 507: Polar

    Table 4-9. Table 4-9. Positive Phases Phase Radians π /2 0.25 (0x2000) π 0.50 (0x4000) 3/2 π 0.75 (0x6000) <2 π 0.999 (0x7ff0) VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-91 for ADSP-219x DSPs...
  • Page 508 ... +3.4 x 10 polarf( ), polar( ) phase = [-1.0 ...+0.999969] polar_fr16( ) magnitude = [-1.0 ... 1.0) polar_fr16( ) Example #include <complex.h> #define PI 3.14159265 complex_fract16 point; float phase_float; 4-92 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 509 = PI; phase_fr16 = (phase_float / (2*PI)) * 32768.0; mag_fr16 = 0x0200; point = polar_fr16 (mag_fr16,phase_fr16); /* point.re = 0xfe00 */ /* point.im = 0x0000 */ VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-93 for ADSP-219x DSPs...
  • Page 510: Rfft

    . Specifying the input array as the temporary array will also result in increased run-time performance. 4-94 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 511 0 (which indicates that no scaling was performed) and (as if static log2(n) scaling was performed). Algorithm on page 4-36. cfft Domain Input sequence length must be a power of two and at least 16. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-95 for ADSP-219x DSPs...
  • Page 512: Rfftrad4

    . Specifying the input array as the temporary array will also result in increased run-time performance. 4-96 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 513 0 (which indicates that no scaling was performed) and (as if static log2(n) scaling was performed). Algorithm on page 4-38. cfftrad4_fr16 Domain Input sequence length must be a power of four and at least 16. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-97 for ADSP-219x DSPs...
  • Page 514: Rfft2D

    If the twiddle table contains more coefficients than needed for a particular call on , then the stride factor has to rfft2d_fr16 be set appropriately; otherwise it should be one. 4-98 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 515 ( , ) a k l e ( , )* where i={0,1,...,n -1}, j={0,1,2,...,n-1} Domain Input sequence length must be a power of two and at least 16. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-99 for ADSP-219x DSPs...
  • Page 516: Rms

    This function computes the root mean square of the input elements con- tained within input vector and returns the result. Algorithm − ∑ Domain -3.4 x 10 to +3.4 x 10 rmsf( ) -1.0 to +1.0 rms_fr16( ) 4-100 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 517: Rsqrt

    (double a); Description This function calculates the reciprocal of the square root of the number is negative, the function returns 0. Algorithm Domain [0.0 to +3.4 x 10 rsqrtf() VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-101 for ADSP-219x DSPs...
  • Page 518: Twidfftrad2

    _ ( )     π 2   − twid     where k = {0, 1, 2, ..., n/2 - 1} 4-102 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 519 DSP Run-Time Library Domain The FFT length must be a power of two and at least 16. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-103 for ADSP-219x DSPs...
  • Page 520: Twidfftrad4

    Algorithm This function takes FFT length as an input parameter and generates the lookup table of complex twiddle coefficients. 4-104 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 521     where k = {0, 1, 2, ..., ¾n - 1} Domain The FFT length must be a power of four and at least 16. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-105 for ADSP-219x DSPs...
  • Page 522: Twidfft2D

    The samples generated are: π   twid re k _ ( )     4-106 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 523     where k = {0, 1, 2, ..., n/2 - 1} Domain The FFT length must be a power of two and at least 16. VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-107 for ADSP-219x DSPs...
  • Page 524: Var

    Algorithm − − ∑ ∑ − − Domain -3.4 x 10 to +3.4 x 10 varf( ) -1.0 to +1.0 var_fr16( ) 4-108 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 525 ( a(i) > 0 && a(i+1) < 0 )|| (a(i) < 0) && a(i+1) > 0 ) the number of zeros is increased by on Domain -3.4 x 10 to +3.4 x 10 zero_crossf( ) -1.0 to +1.0 zero_cross_fr16( ) VisualDSP++ 3.5 C/C++ Compiler and Library Manual 4-109 for ADSP-219x DSPs...
  • Page 526 DSP Run-Time Library Reference 4-110 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 527 For more information on legacy code support, see the VisualDSP++3.5 Linker and Utilities Manual for 16-Bit Processors and VisualDSP++ 3.5 Assembler and Preprocessor Manual for ADSP-218x and ADSP-219x DSPs. Tools Differences VisualDSP++ 3.5 includes an updated C/C++ compiler, linker, and...
  • Page 528 Legacy syntax and the new syntax under VisualDSP++ 3.5 cannot be used together in the same source file. They can be mixed together within the same project, as long as they are assembled in different source files.
  • Page 529: Compiler Legacy Support

    Compiler Legacy Support C/C++ Compiler and Run-Time Library The new compiler provided in VisualDSP++ 3.5 does not support cc219x some switches and extensions that were available in the compiler. As a result, the compiler supports a set of new rules for the run-time environ- ment.
  • Page 530 If you use any of these extensions in your C source code, revise that source. VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 531 Force keeping of inlined Removed. -fkeep-inline-funtions functions. Don’t recognize asm as a Replaced with -fno-asm keyword. -no-extra-keywords (see on page 1-34) Don’t recognize builtin Replaced with -fno-builtin -no-builtin functions. (see on page 1-34) VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 532 Specify target architecture file Removed. -mdmdata= segments. You can control placement of -mpmdata= object file segments using the -mdcode= command in the . SECTIONS file.. Merge C code with Removed. -mlistm assembler-generated code. VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 533 Do not use standard system Replaced with -nostdlib -no-std-lib libraries and startup files (see on page 1-36) when linking. Specify a particular runtime Removed. -runhdr header. Support some preprocessing Removed. -traditional-cpp features. VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 534 C/C++ Compiler and Run-Time Library New and Obsolete Warnings The VisualDSP++ 3.5 compiler includes several new warning switches. These switches control the number and type of messages reported during a given compilation. They are described in Table A-2 on page A-8.
  • Page 535 Run-Time Model compiler in VisualDSP++ 3.5 produces code that is not fully cc219x compatible with the Release 6.1 run-time model. VisualDSP++ 3.5 has significant changes in the registers and stack usage. These changes are...
  • Page 536 C/C++ Compiler and Run-Time Library A-10 VisualDSP++ 3.5 C/C++ Compiler and Library Manual for ADSP-219x DSPs...
  • Page 537 INDEX Symbols #pragma regs_clobbered string 1-130 #pragma result_alignment 1-134 #pragma align num 1-121 #pragma retain_name 1-127 #pragma alloc 1-129, 2-32 #pragma system_header 1-138 #pragma can_instantiate instance #pragma vector_for 1-124 1-136 #pragma weak_entry 1-128 #pragma const 1-130, 2-31 #pragrma altregisters 1-122 #pragma do_not_instantiate instance #pragrma interrupt 1-122...
  • Page 538 INDEX __SILICON_REVISION__ macro acos (arc cosine) function 3-29 1-44 acos_fr16() function 3-29 __SYSTEM__ macro 1-46 activation record 1-155 __USERNAME__ macro 1-46 ADSP-2192-12 processor _ADI_THREADS macro 1-46 shared memory object 3-98 _primIO C function aggregate constructor expression breakpoint 3-14 support 1-89 channeling I/O operations 3-14 alias...
  • Page 539 INDEX array length 1-86 atan_fr16() function 3-31 array search, binary (see bsearch atan2 (arc tangent of quotient) function) function 3-32 arrays atan2, atan2f (arc tangent division) zero length 1-143 functions 3-33 ASCII string (see atof, atoi, atol atan2_fr16() function 3-32 functions) atexit (select exit function) function asin (arc sine) function...
  • Page 540 INDEX bool (see Boolean type support libc.dlb library 3-13 keywords (bool, true, false)) library boolean type keywords 1-84 library function summary 3-23 Boolean type support keywords library header files 3-8–3-15 (bool, true, false) 1-60, 1-84 C type functions bsearch (binary search in sorted isalnum 3-71 array) function...
  • Page 541 INDEX -c++ (C++ mode) 1-21 cfft (N point complex input FFT) -c89 1-21 function 4-36 C/C++ run-time cfft2d (NxN point 2-D complex environment (See also mixed input FFT) 4-40 C/C++/assembly cfftrad4 (N point complex input programming) FFT) 4-38 library files cfir (complex FIR filter) function library overview 4-42...
  • Page 542 INDEX command-line interface 1-6–1-55 -ED (run after preprocessing to compiler file) 1-26 built-in C library functions -EE (run after preprocessing) 1-26 C extensions 1-60 -extra-keywords 1-26 code optimization 1-56, -flags (command-line input) 1-27 command-line switch summaries -force-circbuf 1-27 1-12 -fp-associative (floating-point command-line syntax associative operation) 1-27...
  • Page 543 INDEX 1-33 1-37 -MM (generate make rules and -oldasmcall-{csp|8x} 1-38 compile) 1-32 -Os (optimize for size) 1-37 -Mo (processor output file) 1-32 -Ov num (optimize for speed vs. 1-33 size) 1-38 -Mt (output make rules) 1-32 -P (omit line numbers) 1-38 -no_hardware_pc_stack 1-35...
  • Page 544 INDEX files) 1-44 switches) 1-49 -show (display command line) -workaround 1-50 1-44 -Wremarks (enable diagnostic -signed-bitfield (make plain warnings) 1-49 bitfields signed) 1-45 -write-files (enable file -signed-char (make char signed) redirection) 1-50 1-45 -write-opts 1-50 -si-revision version (silicon -Wterse (enable terse warnings) revision) 1-44 1-49...
  • Page 545 INDEX construct from polar coordinates count zero crossing (zero_cross (polar function) 4-91 function) 4-109 construct operand countones (count one bits in word) assembly 1-68 function 4-53 constructs crosscoh (cross-coherence) function flow control 1-77 4-54 operand description 1-71 crosscorr (cross-correlation) reordering and optimization 1-74 function 4-55...
  • Page 546 INDEX -default-linkage-C compiler switch guide 1-25 source code -default-linkage-C++ compiler dual memory support switch 1-25 pm dm 1-83 Defines 1-148 dual memory support keywords device (pm dm) 1-60, 1-78 driver 1-166 illegal 1-82 identifiers 1-166 DeviceID field 1-167 disabling -E (stop after preprocessing) compiler optimization on compiler switch 1-26...
  • Page 547 INDEX compiler built-in functions 1-106 multiply and accumulate 1-116 function linking 1-109 multiply and accumulate with header file 1-111 rounding 1-112 library 1-106 multiply and accumulate without library functions 1-111 saturation 1-116 library source code 1-110 multiply and subtract 1-116 run-time library multiply and subtract with support...
  • Page 548 INDEX exp (exponential) function 3-53 file searching exponentiation 4-25, 4-26 <filename> 1-152 extensions files using compiler language .IDL 1-151 external memory access 1-99 filter.h header file external_memory_read function filters 3-54 in digital signal processing external_memory_write function finite impulse response (FIR) filter 3-56 4-57 -extra-keywords (enable short-form...
  • Page 549 INDEX -force-circbuf (circular buffer) C run-time library 3-26–3-161 compiler switch 1-27 4-22–4-109 -force-circbuf switch 2-28 primitive I/O 3-13 -fp-associative (floating-point program control associative) compiler switch calloc 3-41 1-27 free 3-71 fract 1-176 malloc 3-93 data type (C++ mode) 1-90 realloc 3-110 fract type support 1-176...
  • Page 550 INDEX gen_vohann (generate von hann def2192-12.h 3-10 window) function 4-74 def219x.h 3-10 general optimization pragmas 1-125 errno.h 3-10 general register set 1-95, 3-148, float.h 3-10 3-151 iso646.h 3-11 general utilities limits.h 3-11 specified by C standard 3-15 locale.h 3-12 get phase of a complex number (arg math.h 3-12 function)
  • Page 551 INDEX math.h 4-10 iostream.h 3-22 matrix.h 4-12, 4-15 iterator 3-21 stats.h 4-16 list 3-21 vector.h 4-17–4-20 3-21 window.h 4-20 memory 3-21 Embedded C++ Library new.h 3-22 complex 3-16 numeric 3-21 embedded C++ library queue 3-21 exception 3-17 3-22 fract 3-17 stack 3-22 fstream...
  • Page 552 INDEX file support 1-166 inline assembly language support functions 3-13 keyword (asm) 1-63 library 3-7, 3-13 construct new device support 1-166 I/O operands 1-75 primitives 1-166, 3-14 template 1-64 redirection 1-50 template operands 1-68 space addresses 1-97 with multiple instructions 1-74 space read 1-97...
  • Page 553 INDEX interruptf function 3-63 isxdigit (detect hexadecimal digit) Interrupts (see clear_interrupt, function 3-85 interruptf, interrupts, signal, raise functions) io_space_read (read I/O space) -jump (select jump table memory function 3-67 type) compiler switch 1-31 io_space_write (write I/O space) function 3-69 -ipa (interprocedural analysis) Kaiser window 4-70 compiler switch 1-30, 1-58,...
  • Page 554 INDEX libc.dlb library 3-13 loop control libetsi.dlb library 1-106, 1-110, automatic variables 2-21 libetsi.h system header file 1-109 variables 2-21 libio.dlb library 3-13 loop exit test 2-21 library loop rotation format 4-22 by hand. 2-18 functions, listed 3-23 loop-carried dependency 2-18 header files, working with lower case (see islower, tolower...
  • Page 555 INDEX maximum performance. 2-29 min (minimum) function 4-87 -MD (make and compile) compiler minimum code size 2-29 switch 1-32 missing operands mean (mean) function 4-86 in conditional expressions 1-142 mean (mean, array) function 3-111 mixed C/assembly -mem (invoke memory initializer) programming compiler switch 1-33...
  • Page 556 INDEX mu_expand (µ-law expansion) -no-anach (disable C++ function 4-89 anachronisms) compiler switch multidimensional arrays 1-86 1-53 multi-line asm() C program -no-bss compiler switch 1-33 constructs 1-74 -no-builtin (no builtin functions) multiple instructions compiler switch 1-34 constructs with 1-74 -no-circbuf (no circular buffer) multi-statement macros 1-150 compiler switch...
  • Page 557 INDEX -no-std-lib (disable standard library optimizing search) compiler switch 1-36 for space 1-126 -nothreads (disable thread-safe for speed 1-126, 2-29 build) compiler switch 1-36 optimizing asm() C program -no-widen-muls (disable widening constructs 1-75 multiplications) compiler -Os (optimize for size) compiler switch 1-36 switch...
  • Page 558 INDEX placement support keyword interrupt 1-122 (segment) 1-60, 1-83 interrupt handler 1-122 pm memory keyword 1-60, 1-78 linkage_name 1-126 PM support linking 1-126 standard C library 1-83 linking control 1-126 pointer loop optimization 1-123, 2-35 incrementing 2-12 loop_count(min, max, modulo) input parameter types 1-83 1-124...
  • Page 559 1-148 calloc 3-41 __cplusplus 1-148 free 3-71 __DOUBLES_ARE_FLOATS__ malloc 3-93 1-148 realloc 3-110 __ECC__ 1-148 program termination 3-52 __EDG__ 1-148 punctuation character test (ispunct) __EDG_VERSION__ 1-148 function 3-82 __FILE__ 1-148 __LINE__ 1-148 __NO_BUILTIN 1-148 qsort (quicksort) function 3-105 __SIGNED_CHARS__ 1-149 qsort function 3-105 __STDC__...
  • Page 560 clobbered 1-130 run-time environment DAG1 1-164 (See also mixed C/C++/assembly DAG2 1-165 programming) data 1-163 programming (See mixed for asm() constructs 1-68 C/C++/assembly programming) miscellaneous 1-163 user reserved 1-133 regs_clobbered string 1-131 -S (stop after compilation) compiler remove function 3-14 switch 1-43 rename function...
  • Page 561 shared memory object srand (random number seed) function ADSP-2192-12 processor 3-98 3-120 short-form keywords stack disabling 1-34 address direction 1-156 enabling 1-26 frame 1-155 -show (display command line) compiler free space 1-158 switch 1-44 incoming arguments 1-157 shr() operation 1-114 local variables/temporaries 1-157 signal (define signal handling) function...
  • Page 562 memmove 3-99 strtol (convert string to long integer) strchr 3-122 function 3-142 strcoll 3-124 strtoul (convert string to unsigned long strcspn 3-126 integer) function 3-144 strerror 3-127 strxfrm (transform string using strpbrk 3-132 LC_COLLATE) function 3-146 strrchr 3-133, 3-134 strxfrm function 3-146 strspn 3-134...
  • Page 563 tan (tangent) function 3-154 unresolved symbol 1-103 tan_fr16() function 3-154 -unsigned-bitfield (make plain bitfields tanh (hyperbolic tangent) function unsigned) compiler switch 1-47 3-155 -unsigned-char (make char unsigned) template compiler switch 1-48 asm() in C program 1-64 upper case (see isupper, toupper assembly construct 1-64 functions)
  • Page 564 simulator 1-166 -write-files (enable driver I/O volatile and asm() C program constructs redirection) compiler switch 1-50 1-75 -write-opts compiler switch 1-50 writes array element 2-19 writing -w (disable all warnings) compiler preprocessor macros 1-149 switch 1-50 -Wterse (enable terse warnings) -w (disable all warnings) switch 1-49 compiler switch...

Table of Contents