#include"dsk6713.h"
#include"dsk6713_aic23.h"
#define buffer_length 10000
#include"stdio.h"
#pragma DATA_SECTION(buffer,".caijishuju")
short buffer[buffer_length];
int buffer_pos = 0; /* input buffer position */
/* Codec configuration settings */
short buffer_data(short); /* function declarations */
DSK6713_AIC23_Config config = {
0x0017, // 0 DSK6713_AIC23_LEFTINVOL Left line input channel volume
0x0017, // 1 DSK6713_AIC23_RIGHTINVOL Right line input channel volume
0x00d8, // 2 DSK6713_AIC23_LEFTHPVOL Left channel headphone volume
0x00d8, // 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
0x000d, // 8 DSK6713_AIC23_SAMPLERATE Sample rate control
0x0001 // 9 DSK6713_AIC23_DIGACT Digital interface activation
};
void main()
{
Uint32 I_input;
short sample_data;
DSK6713_AIC23_CodecHandle hCodec;
DSK6713_init();
/* Start the codec */
hCodec = DSK6713_AIC23_openCodec(0, &config);
DSK6713_AIC23_setFreq(hCodec, 1);
while(1)
{
while (!DSK6713_AIC23_read(hCodec, &I_input));
sample_data =I_input; /* input data */
sample_data = buffer_data(sample_data); /* buffer input */
}
}
/* store the input sample in a circular buffer */
short buffer_data(short sample)
{
buffer[buffer_pos] = sample;/* store sample */
buffer_pos++; /* increment buffer position */
if (buffer_pos > buffer_length)
buffer_pos = 0; /* buffer wrap-around */
return sample;
}