You are on page 1of 6

This is the html version of the file http://galia.fc.uaslp.mx/~rmariela/RTDSP/DSK_6713.pdf.

Google automatically generates html versions of documents as we crawl the web. Page 1 DSK-6713 Introduction to DSK 6713 using the Board Support Library Page 2 BSL Overview The BSL provides a C-language interface for configuring and controlling all on-board devices. The library consists of discrete modules that are built and archived into a library file. Each module represents an individual Application Program Interface (API) and is referred to simply as an API module. The module granularity is structured so each device is implemented in an individual API module. The goal of the BSL is to provide a level of hardware abstraction and software standardization that improves development time and portability. Page 3 BSL Overview The BSL contains 5 modules: Module Function Board Setup General board initialization Codec Access the AIC23 codec DIP Switch Read DIP switches LED Manipulate LEDs Flash Program and erase Flash Page 4 Libraries and Include Files In its most basic form, using the BSL is just a matter of: Linking the BSL in with your code. Referencing the appropriate include files for each module Calling the functions themselves, starting with DSK6713_init(). The libraries and include files reside in these directories: TI_DIR\C6000\dsk6713\lib Library Files TI_DIR\C6000\dsk6713\include Include Files

where TI_DIR is the directory Code Composer is installed in. Page 5 Using the BSL The version of Code Composer that comes with the DSK automatically includes the lib and include paths so you dont need to manually include them in the search paths. To include the dsk6713bsl.lib file for example, select Project Build Options on the Linker tab type dsk6713bsl.lib in the Build Options on the Linker tab type dsk6713bsl.lib in the Include Libraries field. If you choose to specify your search paths, the library search path is specified on the same tab as the library file and the include search path is specified by selecting Project Build Options, and setting the "Include Search Path" field in the preprocessor section of the compiler tab. Page 6 Project Checklist The following are things to check when creating your own project: File Type Action CDB File The CDB file contains all of the DSP/BIOS settings. The easiest thing to do is copy, rename and modify one of the BSL examples. Linker Command File Included Make sure the linker command file is included in your project. It ends in .cmd and is auto-generated when your CDB file is compiled. Endian Mode is Consistent The endian mode must be consistent in each place it is set. It is set in the project options by selecting Project Build Options and viewing the Advanced tab. It is also set in your CDB file under System Global Settings in the DSP Endian Mode selector. Page 7 Project Checklist File Action BSL Library Included Make sure the correct BSL library is included. The BSL library should be specified by selecting Project Build Options on the Linker tab and typing dsk6713bsl.lib in the "Include Libraries" field. Include Paths are Set If you cant see header (.h) files that your program uses, Include Paths are Set If you cant see header (.h) files that your program uses, make sure you have the paths set correctly in Project Build Options on the Preprocessor tab. If you cant seeheader files in the

same directory as your project, add a .to your search path. To include multiple paths, place a semicolon between paths. Include both the project directory and the BSL include directory Page 8 Project Checklist File Action Processor Options are Set The processor type is set under Project Build Options by selecting C671x in the Target Version field of the Basic tab. It is also used in your CDB file to select the matching version of the Chip Support Library. Look under System Global Settings in the CSL selector box. If your program does not use DSP/BIOS you must manually define the value CHIP_6713 under Project Build Options on the Define Symbols field of the Preprocessor tab. Use a semicolon to separate multiple values if something else is already defined. Page 9 Codec API Summary The codec module include file dsk6713_aic23.h contains constant definitions for the handles and AIC23 register offsets Function Action DSK6713_AIC23_openCodec() Allocate an identifying handle for an instance of a codec DSK6713_AIC23_closeCodec() Release a codec handle DSK6713_AIC23_config() Set parameters on codec registers DSK6713_AIC23_read() Read 32 bits from the codec data stream DSK6713_AIC23_read() Read 32 bits from the codec data stream DSK6713_AIC23_write() Write 32 bit value to the codec data stream DSK6713_AIC23_rset() Set the value of a codec control register DSK6713_AIC23_rget() Return the value of a codec register DSK6713_AIC23_outGain() Set the codec output gain DSK6713_AIC23_loopback() Enable/disable the codec loop-back mode

DSK6713_AIC23_mute() Enable/disable the codec mute mode DSK6713_AIC23_powerDown() Enable/disable the codec powerdown modes DSK6713_AIC23_setFreq() Set the codec sample rate Page 10 DSK6713_AIC23_openCodec() Required headers: dsk6713.h, dsk6713_aic23.h Prototype DSK6713_AIC23_CodecHandle DSK6713_AIC23_openCodec(int id, DSK6713_AIC23_Config *Config) id = type of codec. For DSK6713 id = 0 Config = codec register value Page 11 DSK6713_AIC23_openCodec() /* Codec configuration settings */ DSK6713_AIC23_Config config = { \ 0x0017, /* 0 DSK6713_AIC23_LEFTINVOL Left line input channel volume */ \ 0x0017, /* 1 DSK6713_AIC23_RIGHTINVOL Right line input channel volume */\ 0x01f9, /* 2 DSK6713_AIC23_LEFTHPVOL Left channel headphone volume */ \ 0x01f9, /* 3 DSK6713_AIC23_RIGHTHPVOL Right channel headphone volume */ \ 0x0011, /* 4 DSK6713_AIC23_ANAPATH Analog audio path control */ \ 0x0000, /* 5 DSK6713_AIC23_DIGPATH Digital audio path control */ \ 0x0000, /* 6 DSK6713_AIC23_POWERDOWN Power down control */ \ 0x0043, /* 7 DSK6713_AIC23_DIGIF Digital audio interface format */ \ 0x0081, /* 8 DSK6713_AIC23_SAMPLERATE Sample rate control */ \ 0x0001 /* 9 DSK6713_AIC23_DIGACT Digital interface activation */ \ }; // Open codec with default settings DSK6713_AIC23_CodecHandle hCodec; hCodec = DSK6713_AIC23_openCodec(0, &config); // Close codec DSK6713_AIC23_closeCodec(hCodec); Page 12 DSK6713_AIC23_setFreq() Set the codec sample rate void DSK6713_AIC23_setFreq(DSK6713_AIC23_CodecHandle

hCodec, Uint32 freq); Parameters hCodec Codec handle. freq Sample rate of the codec clock. Default is 48KHz Page 13 DSK6713_AIC23_setFreq() Field Value Frequency DSK6713_FREQ_8KHZ 8 KHz DSK6713_FREQ_16KHZ 16 KHz DSK6713_FREQ_24KHZ 24 KHz DSK6713_FREQ_32KHZ 32 KHz DSK6713_FREQ_32KHZ 32 KHz DSK6713_FREQ_44KHZ 44.1 KHz DSK6713_FREQ_48KHZ 48 KHz DSK6713_FREQ_96KHZ 96 KHz // Set codec frequency to 48KHz DSK6713_AIC23_setFreq(hCodec, DSK6713_FREQ_48KHZ); Page 14 DSK6713_AIC23_read() Int16 DSK6713_AIC23_read(DSK6713_AIC23_Co decHandle hCodec, Int32 *val) Parameters: hCodec - Codec Handle val pointer to int32 variable to get the data Return Value: TRUE Data was successfully read FALSE Data port is busy Page 15 DSK6713_AIC23_read()

The function read 16-bit sample from each channel: Left channel sample is stored in the high word Rigth channel sample is stored in the low word In order to separate both samples you should use: leftchannel = (Sample & 0xFFFF0000) >> 16; rigthchannel = (Sample & 0x0000FFFF); Before using the values of the samples, the value should be converted to short int. Page 16 DSK6713_AIC23_write () Int16 DSK6713_AIC23_write(DSK6713_AIC23_C odecHandle hCodec, Int32 val) Parameters: hCodec - Codec Handle val Int32 variable to write to codec Return Value: TRUE Data written succesfully FALSE Data port is busy Page 17 DSK6713_AIC23_write () Example: data = 0x12345678 while(!DSK6713_AIC23_write(hCodec, data)) Creates a loop until the port is ready to transmit.