Pass IIR configs from application to baseband.

This commit is contained in:
Jared Boone 2016-01-29 15:57:20 -08:00
parent 01e14ecbcf
commit 96898f82b2
5 changed files with 34 additions and 13 deletions

View File

@ -25,6 +25,9 @@
#include "portapack_shared_memory.hpp"
using namespace portapack;
#include "dsp_fir_taps.hpp"
#include "dsp_iir_config.hpp"
#include "utility.hpp"
AnalogAudioModel::AnalogAudioModel(ReceiverModel::Mode mode) {
@ -60,6 +63,8 @@ void AnalogAudioModel::configure_nbfm() {
taps_4k25_decim_1,
taps_4k25_channel,
2500,
audio_16k_hpf_300hz_config,
audio_16k_deemph_300_6_config
};
shared_memory.baseband_queue.push(message);
clock_manager.set_base_audio_clock_divider(3);
@ -71,6 +76,8 @@ void AnalogAudioModel::configure_wfm() {
taps_200k_wfm_decim_1,
taps_64_lp_156_198,
75000,
audio_48k_hpf_30hz_config,
audio_48k_deemph_2122_6_config
};
shared_memory.baseband_queue.push(message);
clock_manager.set_base_audio_clock_divider(1);
@ -81,6 +88,7 @@ void AnalogAudioModel::configure_am() {
taps_6k0_decim_0,
taps_6k0_decim_1,
taps_6k0_channel,
audio_8k_hpf_300hz_config
};
shared_memory.baseband_queue.push(message);
clock_manager.set_base_audio_clock_divider(6);

View File

@ -21,7 +21,6 @@
#include "proc_am_audio.hpp"
#include "dsp_iir_config.hpp"
#include "audio_output.hpp"
#include <array>
@ -84,7 +83,7 @@ void NarrowbandAMAudio::configure(const AMConfigureMessage& message) {
channel_filter_pass_f = message.channel_filter.pass_frequency_normalized * channel_filter_input_fs;
channel_filter_stop_f = message.channel_filter.stop_frequency_normalized * channel_filter_input_fs;
channel_spectrum.set_decimation_factor(std::floor((channel_filter_output_fs / 2) / ((channel_filter_pass_f + channel_filter_stop_f) / 2)));
audio_output.configure(audio_8k_hpf_300hz_config);
audio_output.configure(message.audio_hpf_config);
configured = true;
}

View File

@ -21,7 +21,6 @@
#include "proc_nfm_audio.hpp"
#include "dsp_iir_config.hpp"
#include "audio_output.hpp"
#include <cstdint>
@ -87,7 +86,7 @@ void NarrowbandFMAudio::configure(const NBFMConfigureMessage& message) {
channel_filter_pass_f = message.channel_filter.pass_frequency_normalized * channel_filter_input_fs;
channel_filter_stop_f = message.channel_filter.stop_frequency_normalized * channel_filter_input_fs;
channel_spectrum.set_decimation_factor(std::floor((channel_filter_output_fs / 2) / ((channel_filter_pass_f + channel_filter_stop_f) / 2)));
audio_output.configure(audio_16k_hpf_300hz_config, audio_16k_deemph_300_6_config, 0);
audio_output.configure(message.audio_hpf_config, message.audio_deemph_config, 0);
configured = true;
}

View File

@ -21,7 +21,6 @@
#include "proc_wfm_audio.hpp"
#include "dsp_iir_config.hpp"
#include "audio_output.hpp"
#include <cstdint>
@ -110,7 +109,7 @@ void WidebandFMAudio::configure(const WFMConfigureMessage& message) {
channel_filter_stop_f = message.decim_1_filter.stop_frequency_normalized * decim_1_input_fs;
demod.configure(demod_input_fs, message.deviation);
audio_filter.configure(message.audio_filter.taps);
audio_output.configure(audio_48k_hpf_30hz_config, audio_48k_deemph_2122_6_config);
audio_output.configure(message.audio_hpf_config, message.audio_deemph_config);
channel_spectrum.set_decimation_factor(1);

View File

@ -30,6 +30,7 @@
#include "baseband_packet.hpp"
#include "ert_packet.hpp"
#include "dsp_fir_taps.hpp"
#include "dsp_iir.hpp"
#include "fifo.hpp"
#include "utility.hpp"
@ -38,7 +39,7 @@
class Message {
public:
static constexpr size_t MAX_SIZE = 276;
static constexpr size_t MAX_SIZE = 288;
enum class ID : uint32_t {
/* Assign consecutive IDs. IDs are used to index array. */
@ -319,12 +320,16 @@ public:
const fir_taps_real<24> decim_0_filter,
const fir_taps_real<32> decim_1_filter,
const fir_taps_real<32> channel_filter,
const size_t deviation
const size_t deviation,
const iir_biquad_config_t audio_hpf_config,
const iir_biquad_config_t audio_deemph_config
) : Message { ID::NBFMConfigure },
decim_0_filter(decim_0_filter),
decim_1_filter(decim_1_filter),
channel_filter(channel_filter),
deviation { deviation }
deviation { deviation },
audio_hpf_config { audio_hpf_config },
audio_deemph_config { audio_deemph_config }
{
}
@ -332,6 +337,8 @@ public:
const fir_taps_real<32> decim_1_filter;
const fir_taps_real<32> channel_filter;
const size_t deviation;
const iir_biquad_config_t audio_hpf_config;
const iir_biquad_config_t audio_deemph_config;
};
class WFMConfigureMessage : public Message {
@ -340,12 +347,16 @@ public:
const fir_taps_real<24> decim_0_filter,
const fir_taps_real<16> decim_1_filter,
const fir_taps_real<64> audio_filter,
const size_t deviation
const size_t deviation,
const iir_biquad_config_t audio_hpf_config,
const iir_biquad_config_t audio_deemph_config
) : Message { ID::WFMConfigure },
decim_0_filter(decim_0_filter),
decim_1_filter(decim_1_filter),
audio_filter(audio_filter),
deviation { deviation }
deviation { deviation },
audio_hpf_config { audio_hpf_config },
audio_deemph_config { audio_deemph_config }
{
}
@ -353,6 +364,8 @@ public:
const fir_taps_real<16> decim_1_filter;
const fir_taps_real<64> audio_filter;
const size_t deviation;
const iir_biquad_config_t audio_hpf_config;
const iir_biquad_config_t audio_deemph_config;
};
class AMConfigureMessage : public Message {
@ -360,17 +373,20 @@ public:
constexpr AMConfigureMessage(
const fir_taps_real<24> decim_0_filter,
const fir_taps_real<32> decim_1_filter,
const fir_taps_real<32> channel_filter
const fir_taps_real<32> channel_filter,
const iir_biquad_config_t audio_hpf_config
) : Message { ID::AMConfigure },
decim_0_filter(decim_0_filter),
decim_1_filter(decim_1_filter),
channel_filter(channel_filter)
channel_filter(channel_filter),
audio_hpf_config { audio_hpf_config }
{
}
const fir_taps_real<24> decim_0_filter;
const fir_taps_real<32> decim_1_filter;
const fir_taps_real<32> channel_filter;
const iir_biquad_config_t audio_hpf_config;
};
class MessageHandlerMap {