3 * Copyright 2004,2006 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Radio; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
27 //#define MSDD_DEBUG2_TRUE
29 #ifdef MSDD_DEBUG2_TRUE
31 #define MSDD_DEBUG2(x) std::cout << x << std::endl;
33 #define MSDD_DEBUG2(x)
36 #include <msdd_source_c.h>
37 #include <gr_io_signature.h>
40 static const int NBASIC_SAMPLES_PER_ITEM = 2; // I & Q
44 msdd_make_source_c (int which_board,
47 unsigned short port_src
48 ) throw (std::runtime_error)
50 return msdd_source_c_sptr (new msdd_source_c (
59 msdd_source_c::msdd_source_c (int which_board,
62 unsigned short port_src
63 ) throw (std::runtime_error)
64 : msdd_source_base ("msdd_source_c",
65 gr_make_io_signature (1, 1, 2 * sizeof (int)),
66 which_board, opp_mode, src, port_src
70 switch (sizeof_basic_sample()) {
72 d_buffer_copy_behavior.reset(
73 new msdd::BufferCopyBehaviorComplex <short> ());
81 msdd_source_c::~msdd_source_c ()
86 msdd_source_c::ninput_bytes_reqd_for_noutput_items (int noutput_items)
88 return noutput_items * NBASIC_SAMPLES_PER_ITEM * sizeof_basic_sample();
92 * Copy 8 bit fft from mdss buffer into output buffer
95 msdd_source_c::copy_from_msdd_buffer (gr_vector_void_star &output_items,
97 int output_items_available,
98 int &output_items_produced,
99 const void *msdd_buffer,
103 unsigned nmsdd_bytes_per_item = NBASIC_SAMPLES_PER_ITEM * sizeof_basic_sample();
105 unsigned int nitems = std::min (output_items_available,
106 (int)(buffer_length / nmsdd_bytes_per_item));
108 (*d_buffer_copy_behavior.get())(output_items, msdd_buffer, output_index, nitems);
110 output_items_produced = nitems;
111 bytes_read = nitems * nmsdd_bytes_per_item;