From f962f54c6089f60fbd395464e6771701a85f57fd Mon Sep 17 00:00:00 2001 From: eb Date: Tue, 10 Feb 2009 21:05:13 +0000 Subject: [PATCH] formatting changes only git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10432 221aa14e-8319-0410-a670-987f0aec2ac5 --- gr-msdd6000/src/msdd_source_simple.cc | 157 +++++++++++++------------- gr-msdd6000/src/msdd_source_simple.h | 8 +- 2 files changed, 84 insertions(+), 81 deletions(-) diff --git a/gr-msdd6000/src/msdd_source_simple.cc b/gr-msdd6000/src/msdd_source_simple.cc index b8e6a7e3..e180d1ab 100644 --- a/gr-msdd6000/src/msdd_source_simple.cc +++ b/gr-msdd6000/src/msdd_source_simple.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2008 Free Software Foundation, Inc. + * Copyright 2008,2009 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -28,21 +28,20 @@ msdd_source_simple_sptr -msdd_make_source_simple ( const char *src, unsigned short port_src) +msdd_make_source_simple (const char *src, unsigned short port_src) { return msdd_source_simple_sptr (new msdd_source_simple ( src, port_src)); } -msdd_source_simple::msdd_source_simple ( - const char *src, - unsigned short port_src) - : gr_sync_block("MSDD_SOURCE_SIMPLE", - gr_make_io_signature (0,0,0), - gr_make_io_signature (1, 1, sizeof (short))), - rcv(new MSDD6000((char*) src)), d_lastseq(0), d_firstrun(true) +msdd_source_simple::msdd_source_simple (const char *src, + unsigned short port_src) + : gr_sync_block("MSDD_SOURCE_SIMPLE", + gr_make_io_signature (0,0,0), + gr_make_io_signature (1, 1, sizeof (short))), + rcv(new MSDD6000((char*) src)), d_lastseq(0), d_firstrun(true) { - set_output_multiple(MSDD_COMPLEX_SAMPLES_PER_PACKET*2); + set_output_multiple(MSDD_COMPLEX_SAMPLES_PER_PACKET*2); } msdd_source_simple::~msdd_source_simple () @@ -58,105 +57,109 @@ msdd_source_simple::work (int noutput_items, #define BUF_LEN (MSDD_COMPLEX_SAMPLES_PER_PACKET*sizeof(short)*2 + 6) - float* out1 =(float*) output_items[0]; - - for(int i=0; iread( &buffer[0], BUF_LEN ); - - int seq = *((int*) &buffer[2]); - - if(d_lastseq == -MSDD_COMPLEX_SAMPLES_PER_PACKET){ - // not started case - if(seq == 0){ - d_lastseq = 0; - } else { - // THROW AWAY SAMPLES WE ARE NOT STARTED YET! - return 0; - } - - } else { - // started case - int samples_missed = seq - d_lastseq - MSDD_COMPLEX_SAMPLES_PER_PACKET; - if(samples_missed > 0){ - if(d_firstrun == true){ - // we may have missed some initial samples off the beginning of - // a stream but there are no drop outs in the middle of what we have - } else { - printf("dropped %d samples.\n", samples_missed); - } - } - d_lastseq = seq; - } - - int out_idx = i*MSDD_COMPLEX_SAMPLES_PER_PACKET*2; - memcpy(&out1[out_idx], &buffer[6], BUF_LEN - 6); - d_firstrun = false; - } - - return noutput_items; + float* out1 =(float*) output_items[0]; + + for(int i=0; iread( &buffer[0], BUF_LEN ); + + int seq = *((int*) &buffer[2]); + + if(d_lastseq == -MSDD_COMPLEX_SAMPLES_PER_PACKET){ + // not started case + if(seq == 0){ + d_lastseq = 0; + } else { + // THROW AWAY SAMPLES WE ARE NOT STARTED YET! + return 0; + } + + } else { + // started case + int samples_missed = seq - d_lastseq - MSDD_COMPLEX_SAMPLES_PER_PACKET; + if(samples_missed > 0){ + if(d_firstrun == true){ + // we may have missed some initial samples off the beginning of + // a stream but there are no drop outs in the middle of what we have + } else { + printf("dropped %d samples.\n", samples_missed); + } + } + d_lastseq = seq; + } + + int out_idx = i*MSDD_COMPLEX_SAMPLES_PER_PACKET*2; + memcpy(&out1[out_idx], &buffer[6], BUF_LEN - 6); + d_firstrun = false; + } + + return noutput_items; } bool msdd_source_simple::set_decim_rate(unsigned int rate) { - rcv->set_decim((int) floor(log2(rate))); - return true; + rcv->set_decim((int) floor(log2(rate))); + return true; } bool msdd_source_simple::set_rx_freq(int channel, double freq) { - long new_fc = (long)freq; - rcv->set_fc( new_fc/1000000, new_fc%1000000); - return true; + long new_fc = (long)freq; + rcv->set_fc( new_fc/1000000, new_fc%1000000); + return true; } bool msdd_source_simple::set_pga(int which, double gain) { - if(gain < 0 || gain > 10){ - printf("GAIN IS OUTSIDE ACCEPTABLE RANGE!\n"); - return false; - } - // ok i lied this is not really a pga, its decimation gain - rcv->set_ddc_gain((int)gain); - return true; + if(gain < 0 || gain > 10){ + printf("GAIN IS OUTSIDE ACCEPTABLE RANGE!\n"); + return false; + } + // ok i lied this is not really a pga, its decimation gain + rcv->set_ddc_gain((int)gain); + return true; } bool msdd_source_simple::start() { - rcv->start(); - return true; + rcv->start(); + return true; } bool msdd_source_simple::stop() { - rcv->stop(); - return true; + rcv->stop(); + return true; } -long msdd_source_simple::adc_freq(){ - return 102400000; +long msdd_source_simple::adc_freq() +{ + return 102400000; } -int msdd_source_simple::decim_rate(){ - return 1 << rcv->d_decim; +int msdd_source_simple::decim_rate() +{ + return 1 << rcv->d_decim; } -std::vector msdd_source_simple::gain_range(){ - static std::vector r; - r.push_back(0); - r.push_back(12); - return r; +std::vector msdd_source_simple::gain_range() +{ + static std::vector r; + r.push_back(0); + r.push_back(12); + return r; } -std::vector msdd_source_simple::freq_range(){ - std::vector r; - r.push_back(30.0*1000*1000); - r.push_back(6.0*1000*1000*1000); - return r; +std::vector msdd_source_simple::freq_range() +{ + std::vector r; + r.push_back(30.0*1000*1000); + r.push_back(6.0*1000*1000*1000); + return r; } diff --git a/gr-msdd6000/src/msdd_source_simple.h b/gr-msdd6000/src/msdd_source_simple.h index d2d88743..142c544a 100644 --- a/gr-msdd6000/src/msdd_source_simple.h +++ b/gr-msdd6000/src/msdd_source_simple.h @@ -33,23 +33,23 @@ typedef boost::shared_ptr msdd_source_simple_sptr; // public shared_ptr constructor -msdd_source_simple_sptr msdd_make_source_simple ( const char *src, unsigned short port_src); +msdd_source_simple_sptr msdd_make_source_simple(const char *src, unsigned short port_src); class msdd_source_simple : public gr_sync_block { private: friend msdd_source_simple_sptr - msdd_make_source_simple ( const char *src, unsigned short port_src); + msdd_make_source_simple(const char *src, unsigned short port_src); boost::scoped_ptr rcv; int d_lastseq; bool d_firstrun; protected: - msdd_source_simple (const char *src, unsigned short port_src); + msdd_source_simple(const char *src, unsigned short port_src); public: - ~msdd_source_simple (); + ~msdd_source_simple(); bool stop(); bool start(); -- 2.30.2