From 3bed016128349dded091e50c87d8ed79d75e7212 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Thu, 10 Dec 2015 11:56:16 -0800 Subject: [PATCH] BasebandProcessor interface change to pass references, not copies. --- firmware/baseband/baseband_processor.cpp | 14 +++++++------- firmware/baseband/baseband_processor.hpp | 16 ++++++++-------- firmware/baseband/main.cpp | 2 +- firmware/baseband/proc_ais.cpp | 2 +- firmware/baseband/proc_ais.hpp | 2 +- firmware/baseband/proc_am_audio.cpp | 2 +- firmware/baseband/proc_am_audio.hpp | 2 +- firmware/baseband/proc_ert.cpp | 2 +- firmware/baseband/proc_ert.hpp | 2 +- firmware/baseband/proc_nfm_audio.cpp | 2 +- firmware/baseband/proc_nfm_audio.hpp | 2 +- firmware/baseband/proc_tpms.cpp | 2 +- firmware/baseband/proc_tpms.hpp | 2 +- firmware/baseband/proc_wfm_audio.cpp | 2 +- firmware/baseband/proc_wfm_audio.hpp | 2 +- firmware/baseband/proc_wideband_spectrum.cpp | 2 +- firmware/baseband/proc_wideband_spectrum.hpp | 2 +- 17 files changed, 30 insertions(+), 30 deletions(-) diff --git a/firmware/baseband/baseband_processor.cpp b/firmware/baseband/baseband_processor.cpp index 83e6d857..2b57b8ec 100644 --- a/firmware/baseband/baseband_processor.cpp +++ b/firmware/baseband/baseband_processor.cpp @@ -59,7 +59,7 @@ void BasebandProcessor::update_spectrum() { } } -void BasebandProcessor::feed_channel_stats(const buffer_c16_t channel) { +void BasebandProcessor::feed_channel_stats(const buffer_c16_t& channel) { channel_stats.feed( channel, [this](const ChannelStatistics statistics) { @@ -69,7 +69,7 @@ void BasebandProcessor::feed_channel_stats(const buffer_c16_t channel) { } void BasebandProcessor::feed_channel_spectrum( - const buffer_c16_t channel, + const buffer_c16_t& channel, const uint32_t filter_pass_frequency, const uint32_t filter_stop_frequency ) { @@ -83,7 +83,7 @@ void BasebandProcessor::feed_channel_spectrum( ); } -void BasebandProcessor::fill_audio_buffer(const buffer_s16_t audio) { +void BasebandProcessor::fill_audio_buffer(const buffer_s16_t& audio) { auto audio_buffer = audio::dma::tx_empty_buffer();; for(size_t i=0; i, 256> channel_spectrum; @@ -67,10 +67,10 @@ private: AudioStatsCollector audio_stats; AudioStatisticsMessage audio_stats_message; - void post_channel_stats_message(const ChannelStatistics statistics); - void post_channel_spectrum_message(const buffer_c16_t data); - void feed_audio_stats(const buffer_s16_t audio); - void post_audio_stats_message(const AudioStatistics statistics); + void post_channel_stats_message(const ChannelStatistics& statistics); + void post_channel_spectrum_message(const buffer_c16_t& data); + void feed_audio_stats(const buffer_s16_t& audio); + void post_audio_stats_message(const AudioStatistics& statistics); }; #endif/*__BASEBAND_PROCESSOR_H__*/ diff --git a/firmware/baseband/main.cpp b/firmware/baseband/main.cpp index 70a9d43e..4999e067 100755 --- a/firmware/baseband/main.cpp +++ b/firmware/baseband/main.cpp @@ -135,7 +135,7 @@ private: while(true) { // TODO: Place correct sampling rate into buffer returned here: const auto buffer_tmp = baseband::dma::wait_for_rx_buffer(); - const buffer_c8_t buffer { + buffer_c8_t buffer { buffer_tmp.p, buffer_tmp.count, baseband_configuration.sampling_rate }; diff --git a/firmware/baseband/proc_ais.cpp b/firmware/baseband/proc_ais.cpp index b411dc3d..fa61004b 100644 --- a/firmware/baseband/proc_ais.cpp +++ b/firmware/baseband/proc_ais.cpp @@ -26,7 +26,7 @@ #include "i2s.hpp" using namespace lpc43xx; -void AISProcessor::execute(buffer_c8_t buffer) { +void AISProcessor::execute(buffer_c8_t& buffer) { /* 2.4576MHz, 2048 samples */ auto decimator_out = decimator.execute(buffer); diff --git a/firmware/baseband/proc_ais.hpp b/firmware/baseband/proc_ais.hpp index 94de70e0..67e3c7d2 100644 --- a/firmware/baseband/proc_ais.hpp +++ b/firmware/baseband/proc_ais.hpp @@ -42,7 +42,7 @@ class AISProcessor : public BasebandProcessor { public: - void execute(buffer_c8_t buffer) override; + void execute(buffer_c8_t& buffer) override; private: ChannelDecimator decimator { ChannelDecimator::DecimationFactor::By32 }; diff --git a/firmware/baseband/proc_am_audio.cpp b/firmware/baseband/proc_am_audio.cpp index 7a688a08..4899f802 100644 --- a/firmware/baseband/proc_am_audio.cpp +++ b/firmware/baseband/proc_am_audio.cpp @@ -23,7 +23,7 @@ #include -void NarrowbandAMAudio::execute(buffer_c8_t buffer) { +void NarrowbandAMAudio::execute(buffer_c8_t& buffer) { auto decimator_out = decimator.execute(buffer); const buffer_c16_t work_baseband_buffer { diff --git a/firmware/baseband/proc_am_audio.hpp b/firmware/baseband/proc_am_audio.hpp index 6c0d91e5..d6f6ce11 100644 --- a/firmware/baseband/proc_am_audio.hpp +++ b/firmware/baseband/proc_am_audio.hpp @@ -38,7 +38,7 @@ public: channel_filter.configure(channel_filter_taps.taps, 2); } - void execute(buffer_c8_t buffer) override; + void execute(buffer_c8_t& buffer) override; private: ChannelDecimator decimator; diff --git a/firmware/baseband/proc_ert.cpp b/firmware/baseband/proc_ert.cpp index c7c07074..34d6e0e8 100644 --- a/firmware/baseband/proc_ert.cpp +++ b/firmware/baseband/proc_ert.cpp @@ -41,7 +41,7 @@ float ERTProcessor::abs(const complex8_t& v) { return std::sqrt(r2_i2); } -void ERTProcessor::execute(buffer_c8_t buffer) { +void ERTProcessor::execute(buffer_c8_t& buffer) { /* 4.194304MHz, 2048 samples */ // auto decimator_out = decimator.execute(buffer); diff --git a/firmware/baseband/proc_ert.hpp b/firmware/baseband/proc_ert.hpp index 9663a1f3..09fea85c 100644 --- a/firmware/baseband/proc_ert.hpp +++ b/firmware/baseband/proc_ert.hpp @@ -50,7 +50,7 @@ constexpr size_t idm_payload_length_max { 1408 }; class ERTProcessor : public BasebandProcessor { public: - void execute(buffer_c8_t buffer) override; + void execute(buffer_c8_t& buffer) override; private: const uint32_t baseband_sampling_rate = 4194304; diff --git a/firmware/baseband/proc_nfm_audio.cpp b/firmware/baseband/proc_nfm_audio.cpp index e9b70cf9..c1889416 100644 --- a/firmware/baseband/proc_nfm_audio.cpp +++ b/firmware/baseband/proc_nfm_audio.cpp @@ -24,7 +24,7 @@ #include #include -void NarrowbandFMAudio::execute(buffer_c8_t buffer) { +void NarrowbandFMAudio::execute(buffer_c8_t& buffer) { /* Called every 2048/3072000 second -- 1500Hz. */ auto decimator_out = decimator.execute(buffer); diff --git a/firmware/baseband/proc_nfm_audio.hpp b/firmware/baseband/proc_nfm_audio.hpp index f3553387..ede1c6cc 100644 --- a/firmware/baseband/proc_nfm_audio.hpp +++ b/firmware/baseband/proc_nfm_audio.hpp @@ -39,7 +39,7 @@ public: channel_filter.configure(channel_filter_taps.taps, 2); } - void execute(buffer_c8_t buffer) override; + void execute(buffer_c8_t& buffer) override; private: ChannelDecimator decimator; diff --git a/firmware/baseband/proc_tpms.cpp b/firmware/baseband/proc_tpms.cpp index 17eebafb..c8431b2c 100644 --- a/firmware/baseband/proc_tpms.cpp +++ b/firmware/baseband/proc_tpms.cpp @@ -26,7 +26,7 @@ #include "i2s.hpp" using namespace lpc43xx; -void TPMSProcessor::execute(buffer_c8_t buffer) { +void TPMSProcessor::execute(buffer_c8_t& buffer) { /* 2.4576MHz, 2048 samples */ auto decimator_out = decimator.execute(buffer); diff --git a/firmware/baseband/proc_tpms.hpp b/firmware/baseband/proc_tpms.hpp index fd7e1d20..79fa4ae1 100644 --- a/firmware/baseband/proc_tpms.hpp +++ b/firmware/baseband/proc_tpms.hpp @@ -50,7 +50,7 @@ constexpr std::array, 8> rect_taps_153k6_1t_p { { class TPMSProcessor : public BasebandProcessor { public: - void execute(buffer_c8_t buffer) override; + void execute(buffer_c8_t& buffer) override; private: ChannelDecimator decimator { ChannelDecimator::DecimationFactor::By16 }; diff --git a/firmware/baseband/proc_wfm_audio.cpp b/firmware/baseband/proc_wfm_audio.cpp index 5f4a09cc..d01ab169 100644 --- a/firmware/baseband/proc_wfm_audio.cpp +++ b/firmware/baseband/proc_wfm_audio.cpp @@ -23,7 +23,7 @@ #include -void WidebandFMAudio::execute(buffer_c8_t buffer) { +void WidebandFMAudio::execute(buffer_c8_t& buffer) { auto decimator_out = decimator.execute(buffer); const buffer_s16_t work_audio_buffer { diff --git a/firmware/baseband/proc_wfm_audio.hpp b/firmware/baseband/proc_wfm_audio.hpp index 3a0eb65c..d638f46a 100644 --- a/firmware/baseband/proc_wfm_audio.hpp +++ b/firmware/baseband/proc_wfm_audio.hpp @@ -37,7 +37,7 @@ public: decimator.set_decimation_factor(ChannelDecimator::DecimationFactor::By4); } - void execute(buffer_c8_t buffer) override; + void execute(buffer_c8_t& buffer) override; private: ChannelDecimator decimator; diff --git a/firmware/baseband/proc_wideband_spectrum.cpp b/firmware/baseband/proc_wideband_spectrum.cpp index 32ae65b9..d6beb051 100644 --- a/firmware/baseband/proc_wideband_spectrum.cpp +++ b/firmware/baseband/proc_wideband_spectrum.cpp @@ -33,7 +33,7 @@ using namespace lpc43xx; #include -void WidebandSpectrum::execute(buffer_c8_t buffer) { +void WidebandSpectrum::execute(buffer_c8_t& buffer) { // 2048 complex8_t samples per buffer. // 102.4us per buffer. 20480 instruction cycles per buffer. diff --git a/firmware/baseband/proc_wideband_spectrum.hpp b/firmware/baseband/proc_wideband_spectrum.hpp index bbbe04ea..f142588e 100644 --- a/firmware/baseband/proc_wideband_spectrum.hpp +++ b/firmware/baseband/proc_wideband_spectrum.hpp @@ -30,7 +30,7 @@ class WidebandSpectrum : public BasebandProcessor { public: - void execute(buffer_c8_t buffer) override; + void execute(buffer_c8_t& buffer) override; private: size_t sample_count = 0;