Date post: | 03-Apr-2018 |
Category: |
Documents |
Upload: | naagaraaju-aaraadhyula |
View: | 219 times |
Download: | 0 times |
of 17
7/28/2019 DSK_6713
1/17
DSK-6713
Introduction to DSK 6713 using the
Board Support Library
7/28/2019 DSK_6713
2/17
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 anAPI module. The module granularity is structured soeach device is implemented in an individual APImodule.
The goal of the BSL is to provide a level of hardwareabstraction and software standardization that improvesdevelopment time and portability.
7/28/2019 DSK_6713
3/17
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
7/28/2019 DSK_6713
4/17
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.
7/28/2019 DSK_6713
5/17
Using the BSL The version of Code Composer that comes with the DSK
automatically includes the lib and include paths so youdont need to manually include them in the search paths.
To include the dsk6713bsl.lib file for example, select Project.
Include Libraries field.
If you choose to specify your search paths, the librarysearch path is specified on the same tab as the library fileand 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.
7/28/2019 DSK_6713
6/17
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 thin
to do is copy, rename and modify one of the BSLexamples.
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.
7/28/2019 DSK_6713
7/17
Project ChecklistFile 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 ou cant see header .h files that our ro ram uses
make sure you have the paths set correctly in Project Build Options on the Preprocessor tab. If you cant see
header 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
7/28/2019 DSK_6713
8/17
Project ChecklistFile 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.
7/28/2019 DSK_6713
9/17
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_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
7/28/2019 DSK_6713
10/17
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
7/28/2019 DSK_6713
11/17
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);
7/28/2019 DSK_6713
12/17
DSK6713_AIC23_setFreq()
Set the codec sample ratevoidDSK6713_AIC23_setFreq(DSK6713_AIC23_CodecHandle
hCodec, Uint32 freq);
Parameters
hCodec Codec handle.
freq Sample rate of the codec clock. Default
is 48KHz
7/28/2019 DSK_6713
13/17
DSK6713_AIC23_setFreq()Field Value Frequency
DSK6713_FREQ_8KHZ 8 KHz
DSK6713_FREQ_16KHZ 16 KHz
DSK6713_FREQ_24KHZ 24 KHz
DSK6713 FRE 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);
7/28/2019 DSK_6713
14/17
DSK6713_AIC23_read()Int16
DSK6713_AIC23_read(DSK6713_AIC23_CodecHandle hCodec, Int32 *val)
arame ers:
hCodec - Codec Handle
val pointer to int32 variable to get the data
Return Value:
TRUE Data was successfully read
FALSE Data port is busy
7/28/2019 DSK_6713
15/17
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 shoulduse:
leftchannel = (Sample & 0xFFFF0000) >> 16;
rigthchannel = (Sample & 0x0000FFFF); Before using the values of the samples, the value
should be converted to short int.
7/28/2019 DSK_6713
16/17
DSK6713_AIC23_write ()Int16
DSK6713_AIC23_write(DSK6713_AIC23_CodecHandle hCodec, Int32 val)
arame ers:
hCodec - Codec Handle
val Int32 variable to write to codec
Return Value:
TRUE Data written succesfully
FALSE Data port is busy
7/28/2019 DSK_6713
17/17
DSK6713_AIC23_write ()
Example:
data = 0x12345678
while(!DSK6713_AIC23_write(hCodec,
Creates a loop until the port is ready to
transmit.