-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
digital.mpsk_receiver_cc: Set reasonable default parameter values for GRC definition digital.ofdm_insert_preamble: Expose enter_preamble() as public, to allow external state changes Cleanup of incorrect forecast behavior Make the flag port optional, incase external preamble triggers are preferred to in-band gr_vector_source: added set_data( data ) and rewind() public methods gr_head: added set_length(int) method to modify head length New Blocks Added: gr_keep_m_in_n: Allows periodic extraction of M items instead of 1 (in keep_1_in_n) gr_pack_k_bits: Complementary block fo gr_unpack_k_bits gr_vector_insert_x: Complement to the gr_head block, inserts a vector into a stream then becomes a pass through
- Loading branch information
Showing
26 changed files
with
831 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,5 +28,6 @@ class gr_head : public gr_block { | |
gr_head(); | ||
public: | ||
void reset(); | ||
void set_length(int nitems); | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* -*- c++ -*- */ | ||
/* | ||
* Copyright 2004,2010 Free Software Foundation, Inc. | ||
* | ||
* This file is part of GNU Radio | ||
* | ||
* GNU Radio is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 3, or (at your option) | ||
* any later version. | ||
* | ||
* GNU Radio is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with GNU Radio; see the file COPYING. If not, write to | ||
* the Free Software Foundation, Inc., 51 Franklin Street, | ||
* Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
#ifdef HAVE_CONFIG_H | ||
#include "config.h" | ||
#endif | ||
|
||
#include <gr_keep_m_in_n.h> | ||
#include <gr_io_signature.h> | ||
#include <string.h> | ||
#include <stdio.h> | ||
|
||
gr_keep_m_in_n_sptr | ||
gr_make_keep_m_in_n (size_t item_size, int m, int n, int offset) | ||
{ | ||
return gnuradio::get_initial_sptr(new gr_keep_m_in_n (item_size, m, n, offset)); | ||
} | ||
|
||
|
||
/* | ||
* | ||
* offset = 0, starts with 0th item | ||
* offset = 1, starts with 1st item, etc... | ||
* | ||
* we take m items out of each n | ||
*/ | ||
gr_keep_m_in_n::gr_keep_m_in_n (size_t item_size, int m, int n, int offset) | ||
: gr_sync_block ("keep_m_in_n", | ||
gr_make_io_signature (1, 1, n*item_size), | ||
gr_make_io_signature (1, 1, m*item_size)), | ||
d_n(n), | ||
d_m(m), | ||
d_offset( offset ) | ||
{ | ||
// sanity checking | ||
assert(d_m > 0); | ||
assert(d_n > 0); | ||
assert(d_m <= d_n); | ||
assert(d_offset <= (d_n-d_m)); | ||
} | ||
|
||
|
||
void gr_keep_m_in_n::set_offset(int offset){ | ||
d_offset = offset; | ||
} | ||
|
||
|
||
int | ||
gr_keep_m_in_n::work (int noutput_items, | ||
gr_vector_const_void_star &input_items, | ||
gr_vector_void_star &output_items) | ||
{ | ||
uint8_t* out = (uint8_t*) output_items[0]; | ||
const uint8_t* in = (const uint8_t*) input_items[0]; | ||
|
||
int in_item( input_signature()->sizeof_stream_item(0) ); | ||
int out_item( output_signature()->sizeof_stream_item(0) ); | ||
int single_size = in_item/d_n; | ||
|
||
// iterate over data blocks of size {n, input : m, output} | ||
for(int i=0; i<noutput_items; i++){ | ||
memcpy( &out[out_item*i], &in[in_item*i + single_size*d_offset], out_item); | ||
} | ||
|
||
return noutput_items; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* -*- c++ -*- */ | ||
/* | ||
* Copyright 2004 Free Software Foundation, Inc. | ||
* | ||
* This file is part of GNU Radio | ||
* | ||
* GNU Radio is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 3, or (at your option) | ||
* any later version. | ||
* | ||
* GNU Radio is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with GNU Radio; see the file COPYING. If not, write to | ||
* the Free Software Foundation, Inc., 51 Franklin Street, | ||
* Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
#ifndef INCLUDED_GR_KEEP_M_IN_N_H | ||
#define INCLUDED_GR_KEEP_M_IN_N_H | ||
|
||
#include <gr_core_api.h> | ||
#include <gr_sync_block.h> | ||
|
||
class gr_keep_m_in_n; | ||
typedef boost::shared_ptr<gr_keep_m_in_n> gr_keep_m_in_n_sptr; | ||
|
||
GR_CORE_API gr_keep_m_in_n_sptr | ||
gr_make_keep_m_in_n (size_t item_size, int m, int n, int offset); | ||
|
||
|
||
/*! | ||
* \brief decimate a stream, keeping one item out of every n. | ||
* \ingroup slicedice_blk | ||
*/ | ||
class GR_CORE_API gr_keep_m_in_n : public gr_sync_block | ||
{ | ||
friend GR_CORE_API gr_keep_m_in_n_sptr | ||
gr_make_keep_m_in_n (size_t item_size, int m, int n, int offset); | ||
|
||
int d_n; | ||
int d_m; | ||
int d_count; | ||
int d_offset; | ||
|
||
protected: | ||
gr_keep_m_in_n (size_t item_size, int m, int n, int offset); | ||
|
||
public: | ||
int work (int noutput_items, | ||
gr_vector_const_void_star &input_items, | ||
gr_vector_void_star &output_items); | ||
|
||
void set_offset(int offset); | ||
|
||
}; | ||
|
||
#endif /* INCLUDED_GR_KEEP_M_IN_N_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* -*- c++ -*- */ | ||
/* | ||
* Copyright 2004 Free Software Foundation, Inc. | ||
* | ||
* This file is part of GNU Radio | ||
* | ||
* GNU Radio is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 3, or (at your option) | ||
* any later version. | ||
* | ||
* GNU Radio is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with GNU Radio; see the file COPYING. If not, write to | ||
* the Free Software Foundation, Inc., 51 Franklin Street, | ||
* Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
GR_SWIG_BLOCK_MAGIC(gr,keep_m_in_n) | ||
|
||
gr_keep_m_in_n_sptr | ||
gr_make_keep_m_in_n (size_t itemsize, int m, int n, int offset); | ||
|
||
class gr_keep_m_in_n : public gr_sync_block | ||
{ | ||
protected: | ||
gr_keep_m_in_n (size_t itemsize, int m, int n, int offset); | ||
public: | ||
void set_offset(int offset); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* -*- c++ -*- */ | ||
/* | ||
* Copyright 2005,2010 Free Software Foundation, Inc. | ||
* | ||
* This file is part of GNU Radio | ||
* | ||
* GNU Radio is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 3, or (at your option) | ||
* any later version. | ||
* | ||
* GNU Radio is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with GNU Radio; see the file COPYING. If not, write to | ||
* the Free Software Foundation, Inc., 51 Franklin Street, | ||
* Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
#if HAVE_CONFIG_H | ||
#include "config.h" | ||
#endif | ||
|
||
#include <gr_pack_k_bits_bb.h> | ||
#include <gr_io_signature.h> | ||
#include <stdexcept> | ||
#include <iostream> | ||
|
||
gr_pack_k_bits_bb_sptr gr_make_pack_k_bits_bb (unsigned k) | ||
{ | ||
return gnuradio::get_initial_sptr(new gr_pack_k_bits_bb (k)); | ||
} | ||
|
||
|
||
gr_pack_k_bits_bb::gr_pack_k_bits_bb (unsigned k) | ||
: gr_sync_decimator ("pack_k_bits_bb", | ||
gr_make_io_signature (1, 1, sizeof (unsigned char)), | ||
gr_make_io_signature (1, 1, sizeof (unsigned char)), | ||
k), | ||
d_k (k) | ||
{ | ||
if (d_k == 0) | ||
throw std::out_of_range ("interpolation must be > 0"); | ||
} | ||
|
||
gr_pack_k_bits_bb::~gr_pack_k_bits_bb () | ||
{ | ||
} | ||
|
||
int | ||
gr_pack_k_bits_bb::work (int noutput_items, | ||
gr_vector_const_void_star &input_items, | ||
gr_vector_void_star &output_items) | ||
{ | ||
const unsigned char *in = (const unsigned char *) input_items[0]; | ||
unsigned char *out = (unsigned char *) output_items[0]; | ||
|
||
for (int i = 0; i < noutput_items; i++){ | ||
out[i] = 0x00; | ||
for (unsigned int j = 0; j < d_k; j++){ | ||
out[i] |= (0x01 & in[i*d_k+j])<<j; | ||
} | ||
} | ||
|
||
return noutput_items; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* -*- c++ -*- */ | ||
/* | ||
* Copyright 2006 Free Software Foundation, Inc. | ||
* | ||
* This file is part of GNU Radio | ||
* | ||
* GNU Radio is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 3, or (at your option) | ||
* any later version. | ||
* | ||
* GNU Radio is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with GNU Radio; see the file COPYING. If not, write to | ||
* the Free Software Foundation, Inc., 51 Franklin Street, | ||
* Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
#ifndef INCLUDED_GR_PACK_K_BITS_BB_H | ||
#define INCLUDED_GR_PACK_K_BITS_BB_H | ||
|
||
#include <gr_core_api.h> | ||
#include <gr_sync_decimator.h> | ||
|
||
class gr_pack_k_bits_bb; | ||
typedef boost::shared_ptr<gr_pack_k_bits_bb> gr_pack_k_bits_bb_sptr; | ||
GR_CORE_API gr_pack_k_bits_bb_sptr gr_make_pack_k_bits_bb (unsigned k); | ||
|
||
class gr_pack_k_bits_bb; | ||
|
||
/*! | ||
* \brief Converts a byte with k relevent bits to k output bytes with 1 bit in the LSB. | ||
* \ingroup converter_blk | ||
*/ | ||
class GR_CORE_API gr_pack_k_bits_bb : public gr_sync_decimator | ||
{ | ||
private: | ||
friend GR_CORE_API gr_pack_k_bits_bb_sptr gr_make_pack_k_bits_bb (unsigned k); | ||
|
||
gr_pack_k_bits_bb (unsigned k); | ||
|
||
unsigned d_k; // number of relevent bits to pack from k input bytes | ||
|
||
public: | ||
~gr_pack_k_bits_bb (); | ||
|
||
int work (int noutput_items, | ||
gr_vector_const_void_star &input_items, | ||
gr_vector_void_star &output_items); | ||
}; | ||
|
||
#endif |
Oops, something went wrong.