<< Chapter < Page Chapter >> Page >
DSK6713_EDMA_AIC23_DevParams AIC23CodecConfig ={ 0x0000AB01, //VersionId0x00000001, //cacheCalls 0x00000008, //irqIdAIC23_REG0_DEFAULT, AIC23_REG1_DEFAULT,AIC23_REG2_DEFAULT, AIC23_REG3_DEFAULT,AIC23_REG4_LINE,// Use the macro for Mic or Line here AIC23_REG5_DEFAULT,AIC23_REG6_DEFAULT, AIC23_REG7_DEFAULT,AIC23_REG8_48KHZ,// Set the sample rate here AIC23_REG9_DEFAULT,0x00000001, //intrMask 0x00000001 //edmaPriority};

This is set up to use the Line In as the input with the macro AIC23_REG4_LINE . If the microphone input is needed then change this macro to AIC23_REG4_MIC . The sample rate is set to 48kHz with the macro AIC23_REG8_48KHZ . This sample rate can be changed by changing the line to one of the following macros:

AIC23_REG8_8KHZ AIC23_REG8_32KHZAIC23_REG8_44_1KHZ AIC23_REG8_48KHZAIC23_REG8_96KHZ

Signal processing function

The main part of the software is an infinite loop inside the function processing() . The loop within the function is shown here.

while(1) { /* Reclaim full buffer from the input stream */if ((nmadus = SIO_reclaim(&inStream, (Ptr *)&inbuf, NULL))<0) { SYS_abort("Error reclaiming full buffer from the input stream");}/* Reclaim empty buffer from the output stream to be reused */ if (SIO_reclaim(&outStream, (Ptr *)&outbuf, NULL)<0) { SYS_abort("Error reclaiming empty buffer from the output stream");}// Even numbered elements are the left channel (Silver on splitter) // and odd elements are the right channel (Gold on splitter)./* This simply moves each channel from the input to the output. */ /* To perform signal processing, put code here */for (i = 0; i<CHANLEN; i++) { outbuf[2*i]= inbuf[2*i];// Left channel (Silver on splitter)outbuf[2*i+1] = inbuf[2*i+1];// Right channel (Gold on splitter) }/* Issue full buffer to the output stream */if (SIO_issue(&outStream, outbuf, nmadus, NULL) != SYS_OK) { SYS_abort("Error issuing full buffer to the output stream");}/* Issue an empty buffer to the input stream */ if (SIO_issue(&inStream, inbuf, SIO_bufsize(&inStream), NULL) != SYS_OK) { SYS_abort("Error issuing empty buffer to the input stream");} }

This loop simply gets buffers to be processed with the SIO_reclaim commands, processes them, and puts them back with the SIO_issue commands. In this example the data is simply copied from the input buffer to the output buffer. Since the data comes in as packed left and right channels, the even numbered samples are the left channel and the odd numbered samples are the right channel. So the command that copies the left channel is:

outbuf[2*i] = inbuf[2*i];// Left channel (Silver on splitter)

Suppose you wanted to change the function so that the algorithm just amplifies the left input by a factor of 2. Then the program would simply be changed to:

outbuf[2*i] = 2*inbuf[2*i];// Left channel (Silver on splitter)

Notice that there is a for loop within the infinite loop. The loop is executed CHANLEN times. In the example code, CHANLEN is 256. So the block of data is 256 samples from the left channel and 256 samples from the right channel. When writing your programs use the variable CHANLEN to determine how much data to process.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Dsp lab with ti c6x dsp and c6713 dsk. OpenStax CNX. Feb 18, 2013 Download for free at http://cnx.org/content/col11264/1.6
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Dsp lab with ti c6x dsp and c6713 dsk' conversation and receive update notifications?

Ask