Build issues resolved with latest lib_mic_array

This commit is contained in:
Ross Owen
2016-01-12 12:10:06 +00:00
parent 12ec473470
commit dcc81c6dd7
2 changed files with 18 additions and 16 deletions

View File

@@ -1,7 +1,6 @@
#ifndef MIC_ARRAY_CONF_H_
#define MIC_ARRAY_CONF_H_
#define FRAME_SIZE_LOG2 0
#define MAX_FRAME_SIZE_LOG2 0
#endif /* MIC_ARRAY_CONF_H_ */

View File

@@ -16,6 +16,8 @@
#include "fir_decimator.h"
#include "mic_array.h"
#define MAX_DECIMATION_FACTOR 12
/* Hardware resources */
in port p_pdm_clk = PORT_PDM_CLK;
in buffered port:32 p_pdm_mics = PORT_PDM_DATA;
@@ -26,12 +28,12 @@ clock pdmclk = on tile[PDM_TILE]: XS1_CLKBLK_3;
unsafe void user_pdm_process(frame_audio * unsafe audio, int output[]);
void user_pdm_init();
int data_0[4*COEFS_PER_PHASE*MAX_DECIMATION_FACTOR] = {0};
int data_1[4*COEFS_PER_PHASE*MAX_DECIMATION_FACTOR] = {0};
int data_0[4*THIRD_STAGE_COEFS_PER_STAGE * MAX_DECIMATION_FACTOR] = {0};
int data_1[4*THIRD_STAGE_COEFS_PER_STAGE * MAX_DECIMATION_FACTOR] = {0};
frame_audio mic_audio[2];
void pdm_process(streaming chanend c_ds_output_0, streaming chanend c_ds_output_1, chanend c_audio)
void pdm_process(streaming chanend c_ds_output[2], chanend c_audio)
{
unsigned buffer = 1; // Buffer index
memset(mic_audio, sizeof(frame_audio), 0);
@@ -45,21 +47,22 @@ void pdm_process(streaming chanend c_ds_output_0, streaming chanend c_ds_output_
c_audio :> samplerate;
unsigned decimationfactor = 48000/samplerate;
unsigned decimationfactor = 96000/samplerate;
unsafe
{
decimator_config_common dcc = {FRAME_SIZE_LOG2, 1, 0, 0, decimationfactor, fir_coefs[decimationfactor], 0};
decimator_config dc0 = {&dcc, data_0, {0, 0, 0, 0}};
decimator_config dc1 = {&dcc, data_1, {0, 0, 0, 0}};
decimator_configure(c_ds_output_0, c_ds_output_1, dc0, dc1);
int * unsafe fir_coefs[7] = {0, g_third_48kHz_fir, g_third_24kHz_fir, g_third_16kHz_fir, g_third_12kHz_fir, 0, g_third_8kHz_fir};
decimator_config_common dcc = {MAX_FRAME_SIZE_LOG2, 1, 0, 0, decimationfactor, fir_coefs[decimationfactor/2], 0, INT_MAX>>4};
decimator_config dc[2] = {{&dcc, data_0, {0, 0, 0, 0}, 4}, {&dcc, data_1, {0, 0, 0, 0}, 4}};
decimator_configure(c_ds_output, 2, dc);
}
decimator_init_audio_frame(c_ds_output_0, c_ds_output_1, buffer, mic_audio, DECIMATOR_NO_FRAME_OVERLAP);
decimator_init_audio_frame(c_ds_output, 2, buffer, mic_audio, DECIMATOR_NO_FRAME_OVERLAP);
while(1)
{
frame_audio * unsafe current = decimator_get_next_audio_frame(c_ds_output_0, c_ds_output_1, buffer, mic_audio, 2);
frame_audio * unsafe current = decimator_get_next_audio_frame(c_ds_output, 2, buffer, mic_audio, 2);
unsafe
{
@@ -91,7 +94,7 @@ void pdm_process(streaming chanend c_ds_output_0, streaming chanend c_ds_output_
void pcm_pdm_mic(chanend c_pcm_out)
{
streaming chan c_4x_pdm_mic_0, c_4x_pdm_mic_1;
streaming chan c_ds_output_0, c_ds_output_1;
streaming chan c_ds_output[2];
/* TODO, always run mics at 3MHz */
configure_clock_src_divide(pdmclk, p_mclk, 2);
@@ -102,9 +105,9 @@ void pcm_pdm_mic(chanend c_pcm_out)
par
{
pdm_rx(p_pdm_mics, c_4x_pdm_mic_0, c_4x_pdm_mic_1);
decimate_to_pcm_4ch(c_4x_pdm_mic_0, c_ds_output_0);
decimate_to_pcm_4ch(c_4x_pdm_mic_1, c_ds_output_1);
pdm_process(c_ds_output_0, c_ds_output_1, c_pcm_out);
decimate_to_pcm_4ch(c_4x_pdm_mic_0, c_ds_output[0]);
decimate_to_pcm_4ch(c_4x_pdm_mic_1, c_ds_output[1]);
pdm_process(c_ds_output, c_pcm_out);
}
}