<< Chapter < Page | Chapter >> Page > |
In the program file is a macro that is used to define the size of the buffers that are in the
inStream
and
outStream
buffers. The macro is
#define CHANLEN 256// Number of samples per channel
The CCS project uses TI's device drivers described in SPRA846. In the TI document SPRA846 it states that "If buffers are placed in external memory for use with this device driver they should be aligned to a 128 bytes boundary. In addition the buffers should be of a size multiple of 128 bytes as well for the cache to work optimally." If the SIO streams
inStream
and
outStream
are in external memory then the buffer sizes need to adhere to this requirement. If the streams are placed in internal memory then they can be any size desired as long as there is enough memory.
Suppose you want to keep the buffers in external memory but change the size. As an example, you want to change the length of each channel to 512 (multiple of 128). Then change
CHANLEN
to 512 and then open the configuration file
DSK6713_audio.tcf
and examine the properties for
inStream
.
Notice that the buffer size is 1024. This was for a channel length of 256. In the C6713 a Minimum Addressable Data Unit (MADU) is an 8-bit byte. The buffer size is in MADUs. Since each sample from the codec is 16-bits (2 MADUs) and there is a right channel and a left channel, the channel length is multiplied by 4 to get the total buffer size needed in MADUs. 256*4 = 1024. If you want to change the channel length to 512 then the buffer size needs to be 512*4 = 2048. Simply change the buffer size entry to 2048. Leave the alignment on 128. The same change must be made to the
outStream
object so that the buffers have the same size so change the buffer size in the properties for the
outStream
object also.
Suppose you have an algorithm that processes a block of data at a time and the buffer size is not a multiple of 128. To make the processing easier, you could make the stream buffer sizes the size you need for your algorithm. In this case, the stream objects must be placed in internal memory. As an example suppose you want a channel length of 94. Set the
CHANLEN
macro to 94 and then open the configuration file
DSK6713_audio.tcf
and examine and modify the properties for
inStream
and
outStream
. The buffer size will now be 94*4 = 376 and the buffer memory segment must be change from external RAM (SDRAM) to the internal RAM (IRAM).
The example project uses the Chip Support Library (CSL) which is an application programming interface (API) used for configuring and controlling the DSP on-chip peripherals. In order to use the CSL there are several things that must be done first.
Download and install the CSL. The CSL is labeled SPRC090 and can be found at
Under Windows, the CSL can be installed in the directory in your CCS install directory such as C:\Program Files\Texas Instruments\C6xCSL or another directory of your choosing.
Notification Switch
Would you like to follow the 'Ti dsp/bios lab' conversation and receive update notifications?