dsk6713.h
Hi all
I have a problem in dsk 6713.
have a look on the following code
//detect_play.c
//include appropriate support files
#include"detectcfg.h"
#include"dsk6713.h"
#include"dsk6713_aic23.h"
#include "slevel.h"
#define buffer_length 80000
#pragma DATA_SECTION(buffer,".far")
short buffer[buffer_length];
#pragma DATA_SECTION(playback_buffer,".far")
short playback_buffer[buffer_length];
int buffer_pos = 0; /* input buffer position */
int playback_pos = 0; /* playback buffer position */
int gain = 1; /* output gain */
int duration = 0; /* signal duration (playback on when duration > 0)*/
short buffer_data(short); /* function declarations */
void start_playback(int *);
short playback(int *);
DSK6713_AIC23_Config config = {\
0x0017, /* 0 DSK6713_AIC23_LEFTINVOL Leftline 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 */\
0x0081, /* 8 DSK6713_AIC23_SAMPLERATE Sample rate control */\
0x0001 /* 9 DSK6713_AIC23_DIGACT Digital interface activation */ \
};
voidmain()
{
//interrupt void c_int11() /* interrupt service routine */
//{
short sample_data;
int temp;
DSK6713_AIC23_CodecHandle hCodec;
Uint32 l_input, r_input,l_output, r_output;
/* Initialize the board support library, must be called first */
DSK6713_init();
/* Start the codec */
hCodec = DSK6713_AIC23_openCodec(0, &config);
DSK6713_AIC23_setFreq(hCodec, 1);
while(1)
{
while (!DSK6713_AIC23_read(hCodec, &l_input));
sample_data = l_input; /* input data */
sample_data = buffer_data(sample_data); /* buffer input */
temp = signal_level(sample_data); /* analyze the signal level */
if (temp > 0 && duration == 0) { /* if signal detected and playback off */
duration = temp;
start_playback(&duration); /* start playback */
}
if (duration > 0) /* if playback is on */
sample_data = playback(&duration); /* play stored data backwards */
else
sample_data = 0; /* output zero signal */
while (!DSK6713_AIC23_write(hCodec, sample_data));
}
//output_sample(sample_data); /* output data */
return;
}
//write the sample here
/* 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;
}
/* set up data structures for playback */
void start_playback(int *duration)
{
int i;
if (*duration > buffer_length)
*duration = buffer_length; /* adjust duration to <= buffer length */
playback_pos = buffer_pos; /* copy buffer pointer */
for (i=0;i<buffer_length;i++) /* copy buffer */
playback_buffer = buffer;
}
/* play back stored samples in reverse order */
short playback(int *duration)
{
short output;
output = playback_buffer[playback_pos]; /* outputting samples in reverse */
output = gain * output; /* add gain to output */
playback_pos--; /* reducing the count to access the next sample */
(*duration)--; /* decrement duration (playback stops when duration == 0)*/
if (playback_pos < 0)
playback_pos += buffer_length; /* buffer wrap-around */
return output;
}
after writing this files , with some sub files when i compile it it gives error, which is also mention here-
error: can't allocate .far, size 0004e496 (page 0) in IRAM (avail:
0002fe00)
>> error: errors in input - ./Debug/detectplay.out not built
, so my doubt is how to read data from external memory.
here the we use pragma directive to acess far variable but i am not getting how to resolve such problem.
please help