diff options
29 files changed, 3 insertions, 2273 deletions
diff --git a/docs/sphinx/source/gr/coding_blk.rst b/docs/sphinx/source/gr/coding_blk.rst deleted file mode 100644 index da8cacf2b4..0000000000 --- a/docs/sphinx/source/gr/coding_blk.rst +++ /dev/null @@ -1,5 +0,0 @@ -gnuradio.gr: Information Coding and Decoding -============================================ - -.. autooldblock:: gnuradio.gr.fake_channel_encoder_pp -.. autooldblock:: gnuradio.gr.fake_channel_decoder_pp diff --git a/docs/sphinx/source/gr/index.rst b/docs/sphinx/source/gr/index.rst index 8da9504030..64bf9355fd 100644 --- a/docs/sphinx/source/gr/index.rst +++ b/docs/sphinx/source/gr/index.rst @@ -29,31 +29,11 @@ Signal Sinks .. autosummary:: :nosignatures: - gnuradio.gr.check_counting_s gnuradio.gr.check_lfsr_32k_s gnuradio.gr.histo_sink_f gnuradio.gr.oscope_sink_f -Information Coding and Decoding -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. autosummary:: - :nosignatures: - - gnuradio.gr.fake_channel_encoder_pp - gnuradio.gr.fake_channel_decoder_pp - - - -Miscellaneous Blocks -^^^^^^^^^^^^^^^^^^^^ - -.. autosummary:: - :nosignatures: - - gnuradio.gr.pa_2x2_phase_combiner - Miscellaneous ------------- diff --git a/docs/sphinx/source/gr/misc_blk.rst b/docs/sphinx/source/gr/misc_blk.rst deleted file mode 100644 index 9028adc660..0000000000 --- a/docs/sphinx/source/gr/misc_blk.rst +++ /dev/null @@ -1,4 +0,0 @@ -gnuradio.gr: Miscellaneous Blocks -================================= - -.. autooldblock:: gnuradio.gr.pa_2x2_phase_combiner diff --git a/docs/sphinx/source/gr/sink_blk.rst b/docs/sphinx/source/gr/sink_blk.rst index b5ca85aff8..9c2c859765 100644 --- a/docs/sphinx/source/gr/sink_blk.rst +++ b/docs/sphinx/source/gr/sink_blk.rst @@ -1,7 +1,6 @@ gnuradio.gr: Signal Sinks ========================= -.. autooldblock:: gnuradio.gr.check_counting_s .. autooldblock:: gnuradio.gr.check_lfsr_32k_s .. autooldblock:: gnuradio.gr.histo_sink_f .. autooldblock:: gnuradio.gr.oscope_sink_f diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index 2ef7c11055..820f300f10 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -106,15 +106,10 @@ endif(ENABLE_PYTHON) ######################################################################## set(gr_core_general_triple_threats complex_vec_test - gr_align_on_samplenumbers_ss gr_block_gateway - gr_check_counting_s gr_check_lfsr_32k_s - gr_fake_channel_coder_pp gr_feval - gr_iqcomp_cc gr_lfsr_32k_source_s - gr_pa_2x2_phase_combiner gr_prefs gr_test ) diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index e0c735f100..3a32e838ea 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -22,12 +22,8 @@ %{ -#include <gr_check_counting_s.h> #include <gr_lfsr_32k_source_s.h> #include <gr_check_lfsr_32k_s.h> -#include <gr_align_on_samplenumbers_ss.h> -#include <gr_fake_channel_coder_pp.h> -#include <gr_pa_2x2_phase_combiner.h> #include <gr_prefs.h> #include <gr_constants.h> #include <gr_test_types.h> @@ -37,12 +33,8 @@ #include <gr_endianness.h> %} -%include "gr_check_counting_s.i" %include "gr_lfsr_32k_source_s.i" %include "gr_check_lfsr_32k_s.i" -%include "gr_align_on_samplenumbers_ss.i" -%include "gr_fake_channel_coder_pp.i" -%include "gr_pa_2x2_phase_combiner.i" %include "gr_prefs.i" %include "gr_constants.i" %include "gr_test_types.h" diff --git a/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.cc b/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.cc deleted file mode 100644 index 4728533964..0000000000 --- a/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.cc +++ /dev/null @@ -1,464 +0,0 @@ -/* -*- 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_align_on_samplenumbers_ss.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <stdexcept> -#include <string.h> -#include <cstdio> - -//define ALIGN_ADVANCED_IMPLEMENTATION to have an alternative implementation of the align algoritm which exactly follows the align_interval spec. -//It is more resource intensive, less tested and probably not needed -//define ALIGN_ADVANCED_IMPLEMENTATION - -//define DEBUG_TOCONSUME to see debug messages about the synchronisation part of this block -//define DEBUG_TOCONSUME -#ifdef DEBUG_TOCONSUME -#define tcPrintf if(dprint) printf -#else -#define tcPrintf //printf -#endif - -#define ePrintf printf - -gr_align_on_samplenumbers_ss_sptr -gr_make_align_on_samplenumbers_ss (int nchan, int align_interval) -{ - return gnuradio::get_initial_sptr(new gr_align_on_samplenumbers_ss (nchan,align_interval)); -} - -gr_align_on_samplenumbers_ss::gr_align_on_samplenumbers_ss (int nchan,int align_interval) - : gr_block ("align_on_samplenumbers_ss", - gr_make_io_signature (2, -1, sizeof (short)), //2, -1 - gr_make_io_signature (2, -1, sizeof (short))), //2,-1 - d_align_interval (align_interval), - d_nchan(nchan), - d_ninputs(0) -{ - if (d_align_interval<0) - set_output_multiple (d_nchan*2); - else - { - set_output_multiple (d_align_interval*d_nchan*2); - } - -} - -gr_align_on_samplenumbers_ss::~gr_align_on_samplenumbers_ss() -{ - -} -void -gr_align_on_samplenumbers_ss::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - //assert (0 == noutput_items % d_align_interval); - unsigned ninputs = ninput_items_required.size(); - for (unsigned int i = 0; i < ninputs; i++) - ninput_items_required[i] = std::max(noutput_items*d_nchan*2+ history() - 1,1024*d_nchan*2+ history() - 1);//TODO include the diffs found in determine input_items_required -} - -bool -gr_align_on_samplenumbers_ss::check_topology (int ninputs, int noutputs) -{ - bool result=true; - if(noutputs!=ninputs) - { - result=false; - ePrintf("gr_align_on_samplenumbers_ss: ERROR noutputs %i != ninputs %i\n",noutputs,ninputs); - } - if(d_nchan<2) - { - result=false; - ePrintf("gr_align_on_samplenumbers_ss: ERROR nchan %i<2 \n",d_nchan); - } - if((int)d_ninputs!=ninputs) - { - //Only resize and reset the status if there really changed something - //Don't reset the status if the user just called stop() and start(), although maybe we should. - d_state.resize(ninputs); - d_ninputs=ninputs; - for(unsigned int i=0;i<d_ninputs;i++) - { - d_state[i].sync_found=false; - d_state[i].sync_end_found=false; - } - d_in_presync=false; - } - return result; -} - -#ifdef ALIGN_ADVANCED_IMPLEMENTATION -int -gr_align_on_samplenumbers_ss::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ -#ifdef DEBUG_TOCONSUME - static int dcount=0; - bool dprint=false; - dcount++; - if(dcount>200) - { - dcount=0; - dprint=true; - } -#endif - const size_t item_size = output_signature()->sizeof_stream_item (0); - const unsigned ninputs = input_items.size(); - const unsigned noutputs = output_items.size(); - - int align_interval=d_align_interval*2*d_nchan; - if(d_align_interval<0) - { - //align once per noutput_items - align_interval=noutput_items; - align_interval=align_interval/(2*d_nchan); - align_interval=align_interval*(2*d_nchan); - } - - int min_ninput_items=noutput_items;//numeric_limits<int>::max(); - int noutput_items_produced=0; - for(unsigned int i=0;i<ninputs;i++) - { - d_state[i].ninput_items=ninput_items[i]; - d_state[i].ninput_items_used=0; - min_ninput_items=std::min(ninput_items[i],min_ninput_items); - } - for(int j=0;j<noutput_items-align_interval+1;j+=align_interval) - { - int common_end; - if(min_ninput_items>=align_interval) - common_end=align_interval; - else - { - common_end=min_ninput_items/(d_nchan*2); - common_end=common_end*(d_nchan*2); - } - if (common_end<=0) break; - - bool all_diffs_zero=true; - //bool sync_found=false; - int diff_comp_end_max=0; - for(unsigned int i=0;i<ninputs;i++) - { - unsigned short * uin=&(((unsigned short*)input_items[i])[d_state[i].ninput_items_used]); - unsigned int x_high16bits = uin[0]; - unsigned int x_low16bits = uin[1]; - d_state[i].ucounter_begin = x_high16bits<<16 | x_low16bits; - d_state[i].diff=d_state[0].ucounter_begin-d_state[i].ucounter_begin;//Result is a signed value,Will wrap around on 32 bit boundary - int common_last=std::max(common_end-d_nchan*2,0); - x_high16bits = uin[d_nchan*2]; - x_low16bits = uin[d_nchan*2+1]; - unsigned int ucounter_begin2 = x_high16bits<<16 | x_low16bits; -#ifdef DEBUG_TOCONSUME - if((d_state[i].ucounter_begin+1)!=(ucounter_begin2)) - if(ucounter_begin2==0) - ePrintf("SYNC counters are 0\n"); - else - ePrintf("Error: counter not continuous.\n ucounter_begin[%i]=%i +1 != ucounter_begin2=%i\n",i,d_state[i].ucounter_begin,ucounter_begin2); -#endif - x_high16bits = uin[common_last]; - x_low16bits = uin[common_last+1]; - d_state[i].ucounter_end = x_high16bits<<16 | x_low16bits; - d_state[i].diff_end=d_state[0].ucounter_end-d_state[i].ucounter_end;//Result is a signed value,Will wrap around on 32 bit boundary - d_state[i].diff_comp_end=d_state[i].ucounter_end-d_state[0].ucounter_end; - diff_comp_end_max=std::max(d_state[i].diff_comp_end,diff_comp_end_max); -#ifdef DEBUG_TOCONSUME - if(d_state[i].diff>256000000 || d_state[i].diff_end>256000000 || d_state[i].diff_comp_end>256000000) - { - tcPrintf("diff[%i]=%i diff_end=%i diff_comp_end=%i\n",i,d_state[i].diff,d_state[i].diff_end,d_state[i].diff_comp_end); - } -#endif - all_diffs_zero=all_diffs_zero && (0==d_state[i].diff_end); - if(d_state[i].ucounter_end<d_state[i].ucounter_begin+(unsigned)(common_last/(d_nchan*2))) //(unsigned)(common_last/(d_nchan*2))) - { - //printf("sync 1 ");// found ucounter_end[%i]=%i ucounter_begin[%i]=%i \n",i,d_state[i].ucounter_end,i,d_state[i].ucounter_begin); - //sync_found=true;//sync_found or 32 bit counter wraparound (0xffffffff -> 0x00000000) - if(!d_in_presync) - { -#ifdef DEBUG_TOCONSUME - printf("presync START with %i\n",i); -#endif - for(unsigned int k=0;k<ninputs;k++) - { - d_state[k].sync_found=false; - d_state[i].sync_end_found=false; - } - d_in_presync=true; - d_state[i].sync_found=true; - } else - { - //d_in_presync=true; -#ifdef DEBUG_TOCONSUME - if(d_state[i].sync_found) - printf("presync CONTINUE with %i\n",i); - else - printf("presync NEXT with %i\n",i); -#endif - d_state[i].sync_found=true; - d_state[i].sync_end_found=false; - } - } else - { - if(d_in_presync && d_state[i].sync_found) - { - d_state[i].sync_end_found=true; - bool all_syncs_found=true; - for(unsigned int k=0;k<ninputs;k++) - all_syncs_found=all_syncs_found && d_state[k].sync_end_found; - d_in_presync=!all_syncs_found; - if(!d_in_presync) - { - for(unsigned int k=0;k<ninputs;k++) - { - d_state[k].sync_found=false; - d_state[i].sync_end_found=false; - } -#ifdef DEBUG_TOCONSUME - printf("presync END\n"); -#endif - } - } - } - } - if(d_in_presync || all_diffs_zero) - { - for(unsigned int i=0;i<ninputs;i++) - { - memcpy(&(((unsigned short*)output_items[i])[j]),&(((const unsigned short*)input_items[i])[d_state[i].ninput_items_used]),common_end*item_size); - //consume(i,common_end); - d_state[i].ninput_items-=common_end; - d_state[i].ninput_items_used+=common_end; - min_ninput_items=std::min(d_state[i].ninput_items,min_ninput_items); -#ifdef DEBUG_TOCONSUME - if(common_end<256) - tcPrintf("common_end %i\n",common_end); -#endif - } - //min_ninput_items-=common_end; - noutput_items_produced+=common_end; - //return common_end; - } else - { - //printf("sync 2"); - for(unsigned int i=0;i<ninputs;i++) - { - int toconsume=std::min((d_state[i].diff_end+diff_comp_end_max)*d_nchan*2,d_state[i].ninput_items); - toconsume=toconsume/(d_nchan*2); - toconsume=toconsume*(d_nchan*2); - d_state[i].ninput_items-=toconsume; - d_state[i].ninput_items_used+=toconsume; - min_ninput_items=std::min(d_state[i].ninput_items,min_ninput_items); -#ifdef DEBUG_TOCONSUME - static int toconsume_counter=0; - toconsume_counter++; - //if(toconsume_counter>10) - { - tcPrintf("toconsume=%i diff_end[%i]*d_nchan*2=%i diff_comp_end_max*d_nchan*2=%i ninput_items[%i]=%i\n",toconsume,i,d_state[i].diff_end*d_nchan*2,diff_comp_end_max*d_nchan*2,i,ninput_items[i]); - toconsume_counter=0; - } -#endif - //printf("toconsume[%i]=%i\n",i,toconsume); - //consume(i,toconsume);//skip the difference in samplenumber items - } - //return 0; - } - } - for(unsigned int i=0;i<ninputs;i++) - consume(i,d_state[i].ninput_items_used); -#ifdef DEBUG_TOCONSUME - if(noutput_items_produced<256) - tcPrintf("noutput_items_produced %i\n",noutput_items_produced); -#endif - return noutput_items_produced; -} - - -#else /*ALIGN_ADVANCED_IMPLEMENTATION*/ -int -gr_align_on_samplenumbers_ss::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ -#ifdef DEBUG_TOCONSUME - static int dcount=0; - bool dprint=false; - dcount++; - if(dcount>2000) - { - dcount=0; - dprint=true; - } -#endif - const size_t item_size = output_signature()->sizeof_stream_item (0); - const unsigned ninputs = input_items.size(); - - int common_end=noutput_items; - //int diff_min=INT_MAX; - //int diff_max=INT_MIN; - for(unsigned int i=0;i<ninputs;i++) - { - unsigned short * uin=(unsigned short*)input_items[i]; - unsigned int x_high16bits = uin[0]; - unsigned int x_low16bits = uin[1]; - d_state[i].ucounter_begin = x_high16bits<<16 | x_low16bits; - d_state[i].diff=d_state[0].ucounter_end-d_state[i].ucounter_end;//Result is a signed value,Will wrap around on 32 bit boundary - x_high16bits = uin[d_nchan*2]; - x_low16bits = uin[d_nchan*2+1]; - unsigned int ucounter_begin2 = x_high16bits<<16 | x_low16bits; - if((d_state[i].ucounter_begin+1)!=(ucounter_begin2)){ - if(ucounter_begin2==0) - { -#ifdef DEBUG_TOCONSUME - ePrintf("SYNC counters are 0\n"); -#endif - } - else - { - ePrintf("Error: counter not continuous.\n ucounter_begin[%i]=%i +1 != ucounter_begin2=%i\n",i,d_state[i].ucounter_begin,ucounter_begin2); - } - } - - //diff_comp[i]=ucounter[i]-ucounter[0]; - //diff_min=std::min(diff[i],diff_min); - //diff_max=std::max(diff[i],diff_max); - common_end=std::max(std::min(ninput_items[i],common_end),0); - } - common_end=common_end/(d_nchan*2); - common_end=common_end*(d_nchan*2); -#ifdef DEBUG_TOCONSUME - if(common_end<d_nchan*2) - { - printf(" common_end %i\n",common_end); - for(int j=0;j<ninputs;j++) - printf("ninput_items[%i]=%i\n",j,ninput_items[j]); - } -#endif - bool all_diffs_zero=true; - bool sync_found=false; - int diff_comp_end_max=0; - for(unsigned int i=0;i<ninputs;i++) - { - unsigned short * uin=(unsigned short*)input_items[i]; - int common_last=common_end-(d_nchan*2); - unsigned int x_high16bits = uin[common_last]; - unsigned int x_low16bits = uin[common_last+1]; - d_state[i].ucounter_end = x_high16bits<<16 | x_low16bits; - d_state[i].diff_end=d_state[0].ucounter_end-d_state[i].ucounter_end;//Result is a signed value,Will wrap around on 32 bit boundary - d_state[i].diff_comp_end=d_state[i].ucounter_end-d_state[0].ucounter_end; - //diff_end_min=std::min(diff_end[i],diff_end_min); - //diff_end_max=std::max(diff_end[i],diff_end_max); - diff_comp_end_max=std::max(d_state[i].diff_comp_end,diff_comp_end_max); -#ifdef DEBUG_TOCONSUME - if(d_state[i].diff_end!=d_state[i].diff) - { - //samples_lost_or_syncstart=true; - printf("Us%i %i %i ",i,d_state[i].diff_end,d_state[i].diff); - } -#endif - all_diffs_zero=all_diffs_zero && (0==d_state[i].diff_end); - if((d_state[i].ucounter_end<d_state[i].ucounter_begin+(unsigned)(common_last/(d_nchan*2))) || (0==d_state[i].ucounter_end) || (0==d_state[i].ucounter_begin)) //(unsigned)(common_last/(d_nchan*2))) - { - sync_found=true;//sync_found or 32 bit counter wraparound (0xffffffff -> 0x00000000) -#ifdef DEBUG_TOCONSUME - tcPrintf("SYNC diff_end[%i]=%i ucounter_end[%i]=%i ucounter_begin[%i]=%i \n",i,d_state[i].diff_end,i,d_state[i].ucounter_end,i,d_state[i].ucounter_begin); - tcPrintf("ucounter_end=%i < %i = ucounter_begin+(unsigned)(common_last/(d_nchan*2) \n",d_state[i].ucounter_end,d_state[i].ucounter_begin+(unsigned)(common_last/(d_nchan*2))); - - printf("ucounter_end[%i]=%i ucounter_begin[%i]=%i\n",i,d_state[i].ucounter_end,i,d_state[i].ucounter_begin); - int expected_sync_position=common_last - d_state[i].ucounter_end*(d_nchan*2); - if(0==uin[expected_sync_position] && 0==uin[expected_sync_position+1]) - { - printf("sync found on input %i at position %i \n",i,expected_sync_position); - //sync_start[i]=expected_sync_position; - } else - { - printf("sync found on input %i position unclear, expected at %i value there %i\n",i,expected_sync_position,uin[expected_sync_position]<<16 | uin[expected_sync_position+1]); - //sync_start[i]=-1; - } - } else - { - tcPrintf("NOsync diff_end[%i]=%i ucounter_end[%i]=%i ucounter_begin[%i]=%i \n",i,d_state[i].diff_end,i,d_state[i].ucounter_end,i,d_state[i].ucounter_begin); -#endif - } - } - bool problem=false; - for(unsigned int i=0;i<ninputs;i++) - if((d_state[i].diff_end+diff_comp_end_max) >0x4000000) - { - problem=true; - ePrintf("Warning: counter diff greater as 64 Million\n"); - ePrintf(" You might want to swap master and slave.\n"); - ePrintf(" i=%i,d_state[i].diff_end+diff_comp_end_max=%i,d_state[i].diff_end=%i,diff_comp_end_max=%i,ucounter[i]=%i,ucounter[0]=%i\n", - i,d_state[i].diff_end+diff_comp_end_max,d_state[i].diff_end,diff_comp_end_max,d_state[i].ucounter_end,d_state[0].ucounter_end); - //ePrintf(" toconsume=%i\n",toconsume); - } - if(sync_found || all_diffs_zero || problem) - { -#ifdef DEBUG_TOCONSUME - if(all_diffs_zero) tcPrintf("ZERO\n"); - if(sync_found) tcPrintf("SYNC\n"); -#endif - for(unsigned int i=0;i<ninputs;i++) - { - memcpy(output_items[i],input_items[i],common_end*item_size); - consume(i,common_end); -#ifdef DEBUG_TOCONSUME - if(common_end<256) - tcPrintf("common_end %i\n",common_end); -#endif - } - return common_end; - } else - { - //int minconsume=0;//common_end/(2*d_nchan*2); - //min_consume=min_consume*d_nchan*2; - for(unsigned int i=0;i<ninputs;i++) - { - int toconsume=std::min((d_state[i].diff_end+diff_comp_end_max)*d_nchan*2,ninput_items[i]); - toconsume=toconsume/(d_nchan*2); - toconsume=toconsume*(d_nchan*2); -#ifdef DEBUG_TOCONSUME - //printf("dcount %i\n",dcount); - static int toconsume_counter=0; - toconsume_counter++; - //if(toconsume_counter>10) - { - tcPrintf("toconsume=%i diff_end[[%i]*d_nchan*2=%i diff_comp_end_max)*d_nchan*2=%i ninput_items[%i]=%i\n", - toconsume,i,d_state[i].diff_end*d_nchan*2,diff_comp_end_max*d_nchan*2,i,ninput_items[i]); - toconsume_counter=0; - } -#endif - consume(i,toconsume);//skip the difference in samplenumber items - //printf("toconsume%i %i diff_comp_end_max %i diff_end[[%i] %i\n",i,toconsume,diff_comp_end_max,i,d_state[i].diff_end); - } - return 0; - } - return -1;//Should never come here -} -#endif /*ALIGN_ADVANCED_IMPLEMENTATION*/ diff --git a/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.h b/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.h deleted file mode 100644 index 1b71a3f4bc..0000000000 --- a/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.h +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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_ALIGN_ON_SAMPLE_NUMBERS_SS_H -#define INCLUDED_GR_ALIGN_ON_SAMPLE_NUMBERS_SS_H - -#include <gr_core_api.h> -#include <gr_block.h> - -/*! - * \brief align several complex short (interleaved short) input channels with corresponding unsigned 32 bit sample_counters (provided as interleaved 16 bit values) - * \ingroup misc - * \param number of complex_short input channels (including the 32 bit counting channel) - * \param align_interval is after how much samples (minimally) the sample-alignement is refreshed. Default is 128. - * A bigger value means less processing power but also requests more buffer space, which has a maximum. - * Decrease the align_interval if you get an error like: - * "sched: <gr_block align_on_samplenumbers_ss (0)> is requesting more input data than we can provide. - * ninput_items_required = 32768 - * max_possible_items_available = 16383 - * If this is a filter, consider reducing the number of taps." - * \ingroup block - * Pay attention on how you connect this block. - * It expects a minimum of 2 usrp_source_s with nchan number of channels and FPGA_MODE_COUNTING_32BIT enabled. - * This means that the first complex_short channel on every input is an interleaved 32 bit counter. - * The samples are aligned by dropping samples untill the samplenumbers match. - */ -class gr_align_on_samplenumbers_ss; -typedef boost::shared_ptr<gr_align_on_samplenumbers_ss> gr_align_on_samplenumbers_ss_sptr; - -GR_CORE_API gr_align_on_samplenumbers_ss_sptr gr_make_align_on_samplenumbers_ss (int nchan=2, int align_interval=128); - - - - -class GR_CORE_API gr_align_on_samplenumbers_ss : public gr_block -{ - int d_align_interval; - int d_sample_counter; - int d_nchan; - bool d_in_presync; - unsigned int d_ninputs; - class GR_CORE_API align_state { - public: - unsigned int ucounter_end; - unsigned int ucounter_begin; - int diff; - int diff_comp; - int diff_end; - int diff_comp_end; - bool sync_found; - bool sync_end_found; - int ninput_items; - int ninput_items_used; - }; - std::vector<align_state> d_state; - - friend GR_CORE_API gr_align_on_samplenumbers_ss_sptr gr_make_align_on_samplenumbers_ss (int nchan,int align_interval); - gr_align_on_samplenumbers_ss (int nchan,int align_interval); - - public: - ~gr_align_on_samplenumbers_ss(); - bool check_topology (int ninputs, int noutputs); - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif /* INCLUDED_GR_ALIGN_ON_SAMPLE_NUMBERS_SS_H */ diff --git a/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.i b/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.i deleted file mode 100644 index 471f743010..0000000000 --- a/gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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,align_on_samplenumbers_ss); - -gr_align_on_samplenumbers_ss_sptr -gr_make_align_on_samplenumbers_ss(int nchan=2, int align_interval=128) throw (std::exception); - -class gr_align_on_samplenumbers_ss : public gr_block -{ - public: - ~gr_align_on_samplenumbers_ss (); - private: - gr_align_on_samplenumbers_ss (int nchan,int align_interval); -}; diff --git a/gnuradio-core/src/lib/general/gr_check_counting_s.cc b/gnuradio-core/src/lib/general/gr_check_counting_s.cc deleted file mode 100644 index c3288f4813..0000000000 --- a/gnuradio-core/src/lib/general/gr_check_counting_s.cc +++ /dev/null @@ -1,190 +0,0 @@ -/* -*- 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_check_counting_s.h> -#include <gr_io_signature.h> -#include <stdlib.h> -#include <stdio.h> - -gr_check_counting_s_sptr -gr_make_check_counting_s (bool do_32bit) -{ - return gnuradio::get_initial_sptr(new gr_check_counting_s (do_32bit)); -} - -gr_check_counting_s::gr_check_counting_s (bool do_32bit) - : gr_sync_block ("gr_check_counting", - gr_make_io_signature (1, 1, sizeof (short)), - gr_make_io_signature (0, 0, 0)), - d_state(SEARCHING), d_history (0), d_current_count (0), d_current_count_32bit(0), - d_total_errors (0), d_total_shorts (0), - d_do_32bit(do_32bit) -{ - enter_SEARCHING (); -} - -int -gr_check_counting_s::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - unsigned short *in = (unsigned short *) input_items[0]; - if(d_do_32bit) - return check_32bit(noutput_items,in); - else - return check_16bit(noutput_items,in); -} - -int -gr_check_counting_s::check_16bit (int noutput_items, - unsigned short * in) -{ - for (int i = 0; i < noutput_items; i++){ - unsigned short x = in[i]; - - switch (d_state){ - - case SEARCHING: - if (x == d_current_count){ - right (); - log_error (d_current_count, x); - d_current_count = d_current_count + 1; - if (right_three_times ()) - enter_LOCKED (); - } - else { - wrong (); - log_error (d_current_count, x); - d_current_count = x + 1; - } - break; - - case LOCKED: - if (x == d_current_count){ - right (); - d_current_count = d_current_count + 1; - } - else { - wrong (); - log_error (d_current_count, x); - d_current_count = d_current_count + 1; - if (wrong_three_times ()) - enter_SEARCHING (); - } - break; - - default: - abort (); - } - - d_total_shorts++; - } - - return noutput_items; -} - -int -gr_check_counting_s::check_32bit (int noutput_items, - unsigned short * in) -{ - - for (int i = 0; i < noutput_items-1; i+=2){ - unsigned int x_high16bits = in[i]; - unsigned int x_low16bits = in[i+1]; - unsigned int x = x_high16bits<<16 | x_low16bits; - - switch (d_state){ - - case SEARCHING: - if (x == d_current_count_32bit){ - right (); - log_error_32bit (d_current_count_32bit, x); - d_current_count_32bit = d_current_count_32bit + 1; - if (right_three_times ()) - enter_LOCKED (); - } - else { - wrong (); - log_error_32bit (d_current_count_32bit, x); - d_current_count_32bit = x + 1; - } - break; - - case LOCKED: - if (x == d_current_count_32bit){ - right (); - d_current_count_32bit = d_current_count_32bit + 1; - } - else { - wrong (); - log_error_32bit (d_current_count_32bit, x); - d_current_count_32bit = d_current_count_32bit + 1; - if (wrong_three_times ()) - enter_SEARCHING (); - } - break; - - default: - abort (); - } - - d_total_shorts++; - } - - return noutput_items; -} - -void -gr_check_counting_s::enter_SEARCHING () -{ - d_state = SEARCHING; - fprintf (stdout, "gr_check_counting: enter_SEARCHING at offset %8ld (0x%08lx)\n", - d_total_shorts, d_total_shorts); -} - -void -gr_check_counting_s::enter_LOCKED () -{ - d_state = LOCKED; - fprintf (stdout, "gr_check_counting: enter_LOCKED at offset %8ld (0x%08lx)\n", - d_total_shorts, d_total_shorts); -} - -void -gr_check_counting_s::log_error (unsigned short expected, unsigned short actual) -{ - fprintf (stdout, -"gr_check_counting: expected %5d (0x%04x) got %5d (0x%04x) offset %8ld (0x%08lx)\n", - expected, expected, actual, actual, d_total_shorts, d_total_shorts); -} - -void -gr_check_counting_s::log_error_32bit (unsigned int expected, unsigned int actual) -{ - fprintf (stdout, -"gr_check_counting: expected %10d (0x%08x) got %10d (0x%08x) offset %8ld (0x%08lx)\n", - expected, expected, actual, actual, d_total_shorts, d_total_shorts); -} diff --git a/gnuradio-core/src/lib/general/gr_check_counting_s.h b/gnuradio-core/src/lib/general/gr_check_counting_s.h deleted file mode 100644 index 996fa3259f..0000000000 --- a/gnuradio-core/src/lib/general/gr_check_counting_s.h +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- 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_CHECK_COUNTING_S_H -#define INCLUDED_GR_CHECK_COUNTING_S_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_check_counting_s; -typedef boost::shared_ptr<gr_check_counting_s> gr_check_counting_s_sptr; - -GR_CORE_API gr_check_counting_s_sptr gr_make_check_counting_s (bool do_32bit=false); - -/*! - * \brief sink that checks if its input stream consists of a counting sequence. - * \param do_32bit expect an interleaved 32 bit counter in stead of 16 bit counter (default false) - * \ingroup sink_blk - * - * This sink is typically used to test the USRP "Counting Mode" or "Counting mode 32 bit". - */ -class GR_CORE_API gr_check_counting_s : public gr_sync_block -{ - friend GR_CORE_API gr_check_counting_s_sptr gr_make_check_counting_s (bool do_32bit); - - enum state { - SEARCHING, // searching for synchronization - LOCKED // is locked - }; - - state d_state; - unsigned int d_history; // bitmask of decisions - unsigned short d_current_count; - unsigned int d_current_count_32bit; - - long d_total_errors; - long d_total_shorts; - bool d_do_32bit; - - gr_check_counting_s (bool do_32bit); - - void enter_SEARCHING (); - void enter_LOCKED (); - - void right (){ - d_history = (d_history << 1) | 0x1; - } - - void wrong (){ - d_history = (d_history << 1) | 0x0; - d_total_errors++; - } - - bool right_three_times () { return (d_history & 0x7) == 0x7; } - bool wrong_three_times () { return (d_history & 0x7) == 0x0; } - - void log_error (unsigned short expected, unsigned short actual); - void log_error_32bit (unsigned int expected, unsigned int actual); - - int check_32bit (int noutput_items, unsigned short * in); - int check_16bit (int noutput_items, unsigned short * in); - - public: - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif /* INCLUDED_GR_CHECK_COUNTING_S_H */ diff --git a/gnuradio-core/src/lib/general/gr_check_counting_s.i b/gnuradio-core/src/lib/general/gr_check_counting_s.i deleted file mode 100644 index 0275dad9db..0000000000 --- a/gnuradio-core/src/lib/general/gr_check_counting_s.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- 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,check_counting_s) - -gr_check_counting_s_sptr gr_make_check_counting_s (bool do_32bit=false); - -class gr_check_counting_s : public gr_sync_block -{ - private: - gr_check_counting_s (bool do_32bit); -}; diff --git a/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.cc b/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.cc deleted file mode 100644 index c1c3883c56..0000000000 --- a/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.cc +++ /dev/null @@ -1,113 +0,0 @@ -/* -*- 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_fake_channel_coder_pp.h> -#include <gr_io_signature.h> -#include <string.h> -#include <stdexcept> -#include <string.h> - -static const int PAD_VAL = 0xAA; - -gr_fake_channel_encoder_pp_sptr -gr_make_fake_channel_encoder_pp(int input_vlen, int output_vlen) -{ - return gnuradio::get_initial_sptr(new gr_fake_channel_encoder_pp(input_vlen, - output_vlen)); -} - -gr_fake_channel_encoder_pp::gr_fake_channel_encoder_pp(int input_vlen, int output_vlen) - : gr_sync_block("fake_channel_encoder_pp", - gr_make_io_signature(1, 1, input_vlen * sizeof(unsigned char)), - gr_make_io_signature(1, 1, output_vlen * sizeof(unsigned char))), - d_input_vlen(input_vlen), d_output_vlen(output_vlen) -{ - if (input_vlen <= 0 || output_vlen <= 0 || input_vlen > output_vlen) - throw std::invalid_argument("gr_fake_channel_encoder_pp"); -} - -gr_fake_channel_encoder_pp::~gr_fake_channel_encoder_pp() -{ -} - -int -gr_fake_channel_encoder_pp::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]; - int npad = d_output_vlen - d_input_vlen; - - for (int i = 0; i < noutput_items; i++){ - memcpy(out, in, d_input_vlen); - memset(out + d_input_vlen, PAD_VAL, npad); - in += d_input_vlen; - out += d_output_vlen; - } - - return noutput_items; -} - -// ------------------------------------------------------------------------ - -gr_fake_channel_decoder_pp_sptr -gr_make_fake_channel_decoder_pp(int input_vlen, int output_vlen) -{ - return gnuradio::get_initial_sptr(new gr_fake_channel_decoder_pp(input_vlen, - output_vlen)); -} - -gr_fake_channel_decoder_pp::gr_fake_channel_decoder_pp(int input_vlen, int output_vlen) - : gr_sync_block("fake_channel_decoder_pp", - gr_make_io_signature(1, 1, input_vlen * sizeof(unsigned char)), - gr_make_io_signature(1, 1, output_vlen * sizeof(unsigned char))), - d_input_vlen(input_vlen), d_output_vlen(output_vlen) -{ - if (input_vlen <= 0 || output_vlen <= 0 || output_vlen > input_vlen) - throw std::invalid_argument("gr_fake_channel_decoder_pp"); -} - -gr_fake_channel_decoder_pp::~gr_fake_channel_decoder_pp() -{ -} - -int -gr_fake_channel_decoder_pp::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++){ - memcpy(out, in, d_output_vlen); - in += d_input_vlen; - out += d_output_vlen; - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.h b/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.h deleted file mode 100644 index 45808752d3..0000000000 --- a/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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_FAKE_CHANNEL_CODER_PP_H -#define INCLUDED_GR_FAKE_CHANNEL_CODER_PP_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_fake_channel_encoder_pp; -typedef boost::shared_ptr<gr_fake_channel_encoder_pp> gr_fake_channel_encoder_pp_sptr; - -GR_CORE_API gr_fake_channel_encoder_pp_sptr -gr_make_fake_channel_encoder_pp(int input_vlen, int output_vlen); - -/*! - * \brief pad packet with alternating 1,0 pattern. - * \ingroup coding_blk - * - * input: stream of byte vectors; output: stream of byte vectors - */ -class GR_CORE_API gr_fake_channel_encoder_pp : public gr_sync_block -{ - int d_input_vlen; - int d_output_vlen; - - gr_fake_channel_encoder_pp(int input_vlen, int output_vlen); - - friend GR_CORE_API gr_fake_channel_encoder_pp_sptr - gr_make_fake_channel_encoder_pp(int input_vlen, int output_vlen); - -public: - ~gr_fake_channel_encoder_pp(); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -// ------------------------------------------------------------------------ - -class gr_fake_channel_decoder_pp; -typedef boost::shared_ptr<gr_fake_channel_decoder_pp> gr_fake_channel_decoder_pp_sptr; - -GR_CORE_API gr_fake_channel_decoder_pp_sptr -gr_make_fake_channel_decoder_pp(int input_vlen, int output_vlen); - -/*! - * \brief remove fake padding from packet - * \ingroup coding_blk - * - * input: stream of byte vectors; output: stream of byte vectors - */ -class GR_CORE_API gr_fake_channel_decoder_pp : public gr_sync_block -{ - int d_input_vlen; - int d_output_vlen; - - gr_fake_channel_decoder_pp(int input_vlen, int output_vlen); - - friend GR_CORE_API gr_fake_channel_decoder_pp_sptr - gr_make_fake_channel_decoder_pp(int input_vlen, int output_vlen); - -public: - ~gr_fake_channel_decoder_pp(); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_FAKE_CHANNEL_CODER_PP_H */ diff --git a/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.i b/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.i deleted file mode 100644 index 123c84e473..0000000000 --- a/gnuradio-core/src/lib/general/gr_fake_channel_coder_pp.i +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 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,fake_channel_encoder_pp) - -gr_fake_channel_encoder_pp_sptr -gr_make_fake_channel_encoder_pp(int input_vlen, - int output_vlen - ) throw(std::invalid_argument); - -class gr_fake_channel_encoder_pp : public gr_sync_block -{ - gr_fake_channel_encoder_pp(int input_vlen, int output_vlen); - -public: - ~gr_fake_channel_encoder_pp(); -}; - -// ------------------------------------------------------------------------ - -GR_SWIG_BLOCK_MAGIC(gr,fake_channel_decoder_pp) - -gr_fake_channel_decoder_pp_sptr -gr_make_fake_channel_decoder_pp(int input_vlen, - int output_vlen - ) throw(std::invalid_argument); - -class gr_fake_channel_decoder_pp : public gr_sync_block -{ - gr_fake_channel_decoder_pp(int input_vlen, int output_vlen); - -public: - ~gr_fake_channel_decoder_pp(); -}; diff --git a/gnuradio-core/src/lib/general/gr_iqcomp_cc.cc b/gnuradio-core/src/lib/general/gr_iqcomp_cc.cc deleted file mode 100644 index 599b25b728..0000000000 --- a/gnuradio-core/src/lib/general/gr_iqcomp_cc.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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_iqcomp_cc.h> -#include <gr_io_signature.h> - -gr_iqcomp_cc_sptr -gr_make_iqcomp_cc (float mu) -{ - return gnuradio::get_initial_sptr(new gr_iqcomp_cc (mu)); -} - -gr_iqcomp_cc::gr_iqcomp_cc (float mu) - : gr_sync_block ("iqcomp_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (gr_complex))), - d_mu (mu) -{ - d_wi=0.0; - d_wq=0.0; -} - -int -gr_iqcomp_cc::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *iptr = (gr_complex *) input_items[0]; - // gr_complex *optr = (gr_complex *) output_items[0]; - - for(int i = 0 ; i < noutput_items ; i++) { - float i_out = iptr[i].real() - iptr[i].imag() * d_wq; - float q_out = iptr[i].imag() - iptr[i].real() * d_wi; - d_wi += d_mu * q_out * iptr[i].real(); - d_wq += d_mu * i_out * iptr[i].imag(); - } - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_iqcomp_cc.h b/gnuradio-core/src/lib/general/gr_iqcomp_cc.h deleted file mode 100644 index 2f5a44ebfb..0000000000 --- a/gnuradio-core/src/lib/general/gr_iqcomp_cc.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- 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_IQCOMP_CC_H -#define INCLUDED_GR_IQCOMP_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_iqcomp_cc; -typedef boost::shared_ptr<gr_iqcomp_cc> gr_iqcomp_cc_sptr; - -GR_CORE_API gr_iqcomp_cc_sptr gr_make_iqcomp_cc (float mu); - -/*! - * \brief - * \ingroup misc_blk - */ -class GR_CORE_API gr_iqcomp_cc : public gr_sync_block -{ - friend GR_CORE_API gr_iqcomp_cc_sptr gr_make_iqcomp_cc (float mu); - - float d_mu, d_wi, d_wq; - gr_iqcomp_cc (float mu); - - public: - float mu () const { return d_mu; } - void set_mu (float mu) { d_mu = mu; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_iqcomp_cc.i b/gnuradio-core/src/lib/general/gr_iqcomp_cc.i deleted file mode 100644 index 5cca59dd5d..0000000000 --- a/gnuradio-core/src/lib/general/gr_iqcomp_cc.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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,iqcomp_cc) - -gr_iqcomp_cc_sptr gr_make_iqcomp_cc (float mu); - -class gr_iqcomp_cc : public gr_sync_block -{ - private: - gr_iqcomp_cc (float mu); - - public: - float mu () const { return d_mu; } - void set_mu (float mu) { d_mu = mu; } -}; diff --git a/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.cc b/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.cc deleted file mode 100644 index 2b718e5ce2..0000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.cc +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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_ofdm_bpsk_demapper.h> -#include <gr_io_signature.h> - -gr_ofdm_bpsk_demapper_sptr -gr_make_ofdm_bpsk_demapper (unsigned int occupied_carriers) -{ - return gnuradio::get_initial_sptr(new gr_ofdm_bpsk_demapper (occupied_carriers)); -} - -gr_ofdm_bpsk_demapper::gr_ofdm_bpsk_demapper (unsigned occupied_carriers) - : gr_block ("ofdm_bpsk_demapper", - gr_make_io_signature (1, 1, sizeof(gr_complex)*occupied_carriers), - gr_make_io_signature (1, 1, sizeof(unsigned char))), - d_occupied_carriers(occupied_carriers), - d_byte_offset(0), d_partial_byte(0) -{ -} - -gr_ofdm_bpsk_demapper::~gr_ofdm_bpsk_demapper(void) -{ -} - -unsigned char gr_ofdm_bpsk_demapper::slicer(gr_complex x) -{ - return (unsigned char)(x.real() > 0 ? 1 : 0); -} - -void -gr_ofdm_bpsk_demapper::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - unsigned ninputs = ninput_items_required.size (); - for (unsigned i = 0; i < ninputs; i++) - ninput_items_required[i] = 1; -} - -int -gr_ofdm_bpsk_demapper::general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex *)input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - unsigned int i=0, bytes_produced=0; - - while(i < d_occupied_carriers) { - - while((d_byte_offset < 8) && (i < d_occupied_carriers)) { - //fprintf(stderr, "%f+j%f\n", in[i].real(), in[i].imag()); - d_partial_byte |= slicer(in[i++]) << (d_byte_offset++); - } - - if(d_byte_offset == 8) { - out[bytes_produced++] = d_partial_byte; - d_byte_offset = 0; - d_partial_byte = 0; - } - } - -#if 0 -printf("demod out: "); - for(i = 0; i < bytes_produced; i++) { - printf("%4x", out[i]); - } - printf(" \tlen: %d\n", i); -#endif - - consume_each(1); - return bytes_produced; -} diff --git a/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.h b/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.h deleted file mode 100644 index d69d427edb..0000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- 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_OFDM_BPSK_DEMAPPER_H -#define INCLUDED_GR_OFDM_BPSK_DEMAPPER_H - - -#include <gr_core_api.h> -#include <gr_block.h> -#include <vector> - -class gr_ofdm_bpsk_demapper; -typedef boost::shared_ptr<gr_ofdm_bpsk_demapper> gr_ofdm_bpsk_demapper_sptr; - -GR_CORE_API gr_ofdm_bpsk_demapper_sptr -gr_make_ofdm_bpsk_demapper (unsigned int occupied_carriers); - - -/*! - * \brief take a vector of complex constellation points in from an FFT - * and demodulate to a stream of bits. Simple BPSK version. - * \ingroup ofdm_blk - */ -class GR_CORE_API gr_ofdm_bpsk_demapper : public gr_block -{ - friend GR_CORE_API gr_ofdm_bpsk_demapper_sptr - gr_make_ofdm_bpsk_demapper (unsigned int occupied_carriers); - - protected: - gr_ofdm_bpsk_demapper (unsigned int occupied_carriers); - - private: - unsigned char slicer(gr_complex x); - - unsigned int d_occupied_carriers; - unsigned int d_byte_offset; - unsigned char d_partial_byte; - - void forecast(int noutput_items, gr_vector_int &ninput_items_required); - - public: - ~gr_ofdm_bpsk_demapper(void); - int general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif diff --git a/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.i b/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.i deleted file mode 100644 index e58a4e40c5..0000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_bpsk_demapper.i +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -#include <vector> - -GR_SWIG_BLOCK_MAGIC(gr,ofdm_bpsk_demapper) - -gr_ofdm_bpsk_demapper_sptr -gr_make_ofdm_bpsk_demapper (unsigned int occupied_carriers); - -class gr_ofdm_bpsk_demapper : public gr_sync_decimator -{ - protected: - gr_ofdm_bpsk_demapper (unsigned int occupied_carriers); - - public: - int general_work(int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; diff --git a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.cc b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.cc deleted file mode 100644 index eb12327565..0000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.cc +++ /dev/null @@ -1,374 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2008,2010,2011 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_ofdm_frame_sink2.h> -#include <gr_io_signature.h> -#include <gr_expj.h> -#include <gr_math.h> -#include <math.h> -#include <cstdio> -#include <stdexcept> -#include <iostream> -#include <string.h> -#include <gr_constellation.h> - -#define VERBOSE 0 - -inline void -gr_ofdm_frame_sink2::enter_search() -{ - if (VERBOSE) - fprintf(stderr, "@ enter_search\n"); - - d_state = STATE_SYNC_SEARCH; - -} - -inline void -gr_ofdm_frame_sink2::enter_have_sync() -{ - if (VERBOSE) - fprintf(stderr, "@ enter_have_sync\n"); - - d_state = STATE_HAVE_SYNC; - - // clear state of demapper - d_byte_offset = 0; - d_partial_byte = 0; - - d_header = 0; - d_headerbytelen_cnt = 0; - - // Resetting PLL - d_freq = 0.0; - d_phase = 0.0; - fill(d_dfe.begin(), d_dfe.end(), gr_complex(1.0,0.0)); -} - -inline void -gr_ofdm_frame_sink2::enter_have_header() -{ - d_state = STATE_HAVE_HEADER; - - // header consists of two 16-bit shorts in network byte order - // payload length is lower 12 bits - // whitener offset is upper 4 bits - d_packetlen = (d_header >> 16) & 0x0fff; - d_packet_whitener_offset = (d_header >> 28) & 0x000f; - d_packetlen_cnt = 0; - - if (VERBOSE) - fprintf(stderr, "@ enter_have_header (payload_len = %d) (offset = %d)\n", - d_packetlen, d_packet_whitener_offset); -} - - -unsigned int gr_ofdm_frame_sink2::demapper(const gr_complex *in, - unsigned char *out) -{ - unsigned int i=0, bytes_produced=0; - gr_complex carrier; - - carrier=gr_expj(d_phase); - - gr_complex accum_error = 0.0; - //while(i < d_occupied_carriers) { - while(i < d_subcarrier_map.size()) { - if(d_nresid > 0) { - d_partial_byte |= d_resid; - d_byte_offset += d_nresid; - d_nresid = 0; - d_resid = 0; - } - - //while((d_byte_offset < 8) && (i < d_occupied_carriers)) { - while((d_byte_offset < 8) && (i < d_subcarrier_map.size())) { - //gr_complex sigrot = in[i]*carrier*d_dfe[i]; - gr_complex sigrot = in[d_subcarrier_map[i]]*carrier*d_dfe[i]; - - if(d_derotated_output != NULL){ - d_derotated_output[i] = sigrot; - } - - unsigned char bits = d_constell->decision_maker(&sigrot); - - gr_complex closest_sym = d_constell->points()[bits]; - - accum_error += sigrot * conj(closest_sym); - - // FIX THE FOLLOWING STATEMENT - if (norm(sigrot)> 0.001) d_dfe[i] += d_eq_gain*(closest_sym/sigrot-d_dfe[i]); - - i++; - - if((8 - d_byte_offset) >= d_nbits) { - d_partial_byte |= bits << (d_byte_offset); - d_byte_offset += d_nbits; - } - else { - d_nresid = d_nbits-(8-d_byte_offset); - int mask = ((1<<(8-d_byte_offset))-1); - d_partial_byte |= (bits & mask) << d_byte_offset; - d_resid = bits >> (8-d_byte_offset); - d_byte_offset += (d_nbits - d_nresid); - } - //printf("demod symbol: %.4f + j%.4f bits: %x partial_byte: %x byte_offset: %d resid: %x nresid: %d\n", - // in[i-1].real(), in[i-1].imag(), bits, d_partial_byte, d_byte_offset, d_resid, d_nresid); - } - - if(d_byte_offset == 8) { - //printf("demod byte: %x \n\n", d_partial_byte); - out[bytes_produced++] = d_partial_byte; - d_byte_offset = 0; - d_partial_byte = 0; - } - } - //std::cerr << "accum_error " << accum_error << std::endl; - - float angle = arg(accum_error); - - d_freq = d_freq - d_freq_gain*angle; - d_phase = d_phase + d_freq - d_phase_gain*angle; - if (d_phase >= 2*M_PI) d_phase -= 2*M_PI; - if (d_phase <0) d_phase += 2*M_PI; - - //if(VERBOSE) - // std::cerr << angle << "\t" << d_freq << "\t" << d_phase << "\t" << std::endl; - - return bytes_produced; -} - - -gr_ofdm_frame_sink2_sptr -gr_make_ofdm_frame_sink2(gr_constellation_sptr constell, - gr_msg_queue_sptr target_queue, unsigned int occupied_carriers, - float phase_gain, float freq_gain) -{ - return gnuradio::get_initial_sptr(new gr_ofdm_frame_sink2(constell, - target_queue, occupied_carriers, - phase_gain, freq_gain)); -} - - -gr_ofdm_frame_sink2::gr_ofdm_frame_sink2(gr_constellation_sptr constell, - gr_msg_queue_sptr target_queue, unsigned int occupied_carriers, - float phase_gain, float freq_gain) - : gr_sync_block ("ofdm_frame_sink2", - gr_make_io_signature2 (2, 2, sizeof(gr_complex)*occupied_carriers, sizeof(char)), - gr_make_io_signature (1, 1, sizeof(gr_complex)*occupied_carriers)), - d_constell(constell), - d_target_queue(target_queue), d_occupied_carriers(occupied_carriers), - d_byte_offset(0), d_partial_byte(0), - d_resid(0), d_nresid(0),d_phase(0),d_freq(0),d_phase_gain(phase_gain),d_freq_gain(freq_gain), - d_eq_gain(0.05) -{ - if (d_constell->dimensionality() != 1) - throw std::runtime_error ("This receiver only works with constellations of dimension 1."); - - std::string carriers = "FE7F"; - - // A bit hacky to fill out carriers to occupied_carriers length - int diff = (d_occupied_carriers - 4*carriers.length()); - while(diff > 7) { - carriers.insert(0, "f"); - carriers.insert(carriers.length(), "f"); - diff -= 8; - } - - // if there's extras left to be processed - // divide remaining to put on either side of current map - // all of this is done to stick with the concept of a carrier map string that - // can be later passed by the user, even though it'd be cleaner to just do this - // on the carrier map itself - int diff_left=0; - int diff_right=0; - - // dictionary to convert from integers to ascii hex representation - char abc[16] = {'0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; - if(diff > 0) { - char c[2] = {0,0}; - - diff_left = (int)ceil((float)diff/2.0f); // number of carriers to put on the left side - c[0] = abc[(1 << diff_left) - 1]; // convert to bits and move to ASCI integer - carriers.insert(0, c); - - diff_right = diff - diff_left; // number of carriers to put on the right side - c[0] = abc[0xF^((1 << diff_right) - 1)]; // convert to bits and move to ASCI integer - carriers.insert(carriers.length(), c); - } - - // It seemed like such a good idea at the time... - // because we are only dealing with the occupied_carriers - // at this point, the diff_left in the following compensates - // for any offset from the 0th carrier introduced - unsigned int i,j,k; - for(i = 0; i < (d_occupied_carriers/4)+diff_left; i++) { - char c = carriers[i]; - for(j = 0; j < 4; j++) { - k = (strtol(&c, NULL, 16) >> (3-j)) & 0x1; - if(k) { - d_subcarrier_map.push_back(4*i + j - diff_left); - } - } - } - - // make sure we stay in the limit currently imposed by the occupied_carriers - if(d_subcarrier_map.size() > d_occupied_carriers) { - throw std::invalid_argument("gr_ofdm_mapper_bcv: subcarriers allocated exceeds size of occupied carriers"); - } - - d_bytes_out = new unsigned char[d_occupied_carriers]; - d_dfe.resize(occupied_carriers); - fill(d_dfe.begin(), d_dfe.end(), gr_complex(1.0,0.0)); - - d_nbits = d_constell->bits_per_symbol(); - - enter_search(); -} - -gr_ofdm_frame_sink2::~gr_ofdm_frame_sink2 () -{ - delete [] d_bytes_out; -} - - -int -gr_ofdm_frame_sink2::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex *) input_items[0]; - const char *sig = (const char *) input_items[1]; - unsigned int j = 0; - unsigned int bytes=0; - - // If the output is connected, send it the derotated symbols - if(output_items.size() >= 1) - d_derotated_output = (gr_complex *)output_items[0]; - else - d_derotated_output = NULL; - - if (VERBOSE) - fprintf(stderr,">>> Entering state machine\n"); - - switch(d_state) { - - case STATE_SYNC_SEARCH: // Look for flag indicating beginning of pkt - if (VERBOSE) - fprintf(stderr,"SYNC Search, noutput=%d\n", noutput_items); - - if (sig[0]) { // Found it, set up for header decode - enter_have_sync(); - } - break; - - case STATE_HAVE_SYNC: - // only demod after getting the preamble signal; otherwise, the - // equalizer taps will screw with the PLL performance - bytes = demapper(&in[0], d_bytes_out); - - if (VERBOSE) { - if(sig[0]) - printf("ERROR -- Found SYNC in HAVE_SYNC\n"); - fprintf(stderr,"Header Search bitcnt=%d, header=0x%08x\n", - d_headerbytelen_cnt, d_header); - } - - j = 0; - while(j < bytes) { - d_header = (d_header << 8) | (d_bytes_out[j] & 0xFF); - j++; - - if (++d_headerbytelen_cnt == HEADERBYTELEN) { - - if (VERBOSE) - fprintf(stderr, "got header: 0x%08x\n", d_header); - - // we have a full header, check to see if it has been received properly - if (header_ok()){ - enter_have_header(); - - if (VERBOSE) - printf("\nPacket Length: %d\n", d_packetlen); - - while((j < bytes) && (d_packetlen_cnt < d_packetlen)) { - d_packet[d_packetlen_cnt++] = d_bytes_out[j++]; - } - - if(d_packetlen_cnt == d_packetlen) { - gr_message_sptr msg = - gr_make_message(0, d_packet_whitener_offset, 0, d_packetlen); - memcpy(msg->msg(), d_packet, d_packetlen_cnt); - d_target_queue->insert_tail(msg); // send it - msg.reset(); // free it up - - enter_search(); - } - } - else { - enter_search(); // bad header - } - } - } - break; - - case STATE_HAVE_HEADER: - bytes = demapper(&in[0], d_bytes_out); - - if (VERBOSE) { - if(sig[0]) - printf("ERROR -- Found SYNC in HAVE_HEADER at %d, length of %d\n", d_packetlen_cnt, d_packetlen); - fprintf(stderr,"Packet Build\n"); - } - - j = 0; - while(j < bytes) { - d_packet[d_packetlen_cnt++] = d_bytes_out[j++]; - - if (d_packetlen_cnt == d_packetlen){ // packet is filled - // build a message - // NOTE: passing header field as arg1 is not scalable - gr_message_sptr msg = - gr_make_message(0, d_packet_whitener_offset, 0, d_packetlen_cnt); - memcpy(msg->msg(), d_packet, d_packetlen_cnt); - - d_target_queue->insert_tail(msg); // send it - msg.reset(); // free it up - - enter_search(); - break; - } - } - break; - - default: - assert(0); - - } // switch - - return 1; -} diff --git a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.h b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.h deleted file mode 100644 index a743e8c5a5..0000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.h +++ /dev/null @@ -1,121 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2011 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_OFDM_FRAME_SINK2_H -#define INCLUDED_GR_OFDM_FRAME_SINK2_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_msg_queue.h> -#include <gr_constellation.h> - -class gr_ofdm_frame_sink2; -typedef boost::shared_ptr<gr_ofdm_frame_sink2> gr_ofdm_frame_sink2_sptr; - -GR_CORE_API gr_ofdm_frame_sink2_sptr -gr_make_ofdm_frame_sink2 (gr_constellation_sptr constell, - gr_msg_queue_sptr target_queue, unsigned int occupied_tones, - float phase_gain=0.25, float freq_gain=0.25*0.25/4.0); - -/*! - * \brief Takes an OFDM symbol in, demaps it into bits of 0's and 1's, packs - * them into packets, and sends to to a message queue sink. - * \ingroup sink_blk - * \ingroup ofdm_blk - * - * NOTE: The mod input parameter simply chooses a pre-defined demapper/slicer. Eventually, - * we want to be able to pass in a reference to an object to do the demapping and slicing - * for a given modulation type. - */ -class GR_CORE_API gr_ofdm_frame_sink2 : public gr_sync_block -{ - friend GR_CORE_API gr_ofdm_frame_sink2_sptr - gr_make_ofdm_frame_sink2 (gr_constellation_sptr constell, - gr_msg_queue_sptr target_queue, unsigned int occupied_tones, - float phase_gain, float freq_gain); - - private: - enum state_t {STATE_SYNC_SEARCH, STATE_HAVE_SYNC, STATE_HAVE_HEADER}; - - static const int MAX_PKT_LEN = 4096; - static const int HEADERBYTELEN = 4; - - gr_msg_queue_sptr d_target_queue; // where to send the packet when received - state_t d_state; - unsigned int d_header; // header bits - int d_headerbytelen_cnt; // how many so far - - unsigned char *d_bytes_out; // hold the current bytes produced by the demapper - - unsigned int d_occupied_carriers; - unsigned int d_byte_offset; - unsigned int d_partial_byte; - - unsigned char d_packet[MAX_PKT_LEN]; // assembled payload - int d_packetlen; // length of packet - int d_packet_whitener_offset; // offset into whitener string to use - int d_packetlen_cnt; // how many so far - - gr_complex * d_derotated_output; // Pointer to output stream to send deroated symbols out - - gr_constellation_sptr d_constell; - std::vector<gr_complex> d_dfe; - unsigned int d_nbits; - - unsigned char d_resid; - unsigned int d_nresid; - float d_phase; - float d_freq; - float d_phase_gain; - float d_freq_gain; - float d_eq_gain; - - std::vector<int> d_subcarrier_map; - - protected: - gr_ofdm_frame_sink2(gr_constellation_sptr constell, - gr_msg_queue_sptr target_queue, unsigned int occupied_tones, - float phase_gain, float freq_gain); - - void enter_search(); - void enter_have_sync(); - void enter_have_header(); - - bool header_ok() - { - // confirm that two copies of header info are identical - return ((d_header >> 16) ^ (d_header & 0xffff)) == 0; - } - - unsigned char slicer(const gr_complex x); - unsigned int demapper(const gr_complex *in, - unsigned char *out); - - public: - ~gr_ofdm_frame_sink2(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_OFDM_FRAME_SINK2_H */ diff --git a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.i b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.i deleted file mode 100644 index 8c04d1e160..0000000000 --- a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink2.i +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2011 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,ofdm_frame_sink2); - -gr_ofdm_frame_sink2_sptr -gr_make_ofdm_frame_sink2(gr_constellation_sptr constell, - gr_msg_queue_sptr target_queue, unsigned int occupied_tones, - float phase_gain=0.25, float freq_gain=0.25*0.25/4); - -class gr_ofdm_frame_sink2 : public gr_sync_block -{ - protected: - gr_ofdm_frame_sink2(gr_constellation_sptr constell, - gr_msg_queue_sptr target_queue, unsigned int occupied_tones, - float phase_gain, float freq_gain); - - public: - ~gr_ofdm_frame_sink2(); -}; diff --git a/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.cc b/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.cc deleted file mode 100644 index 3187536726..0000000000 --- a/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.cc +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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_pa_2x2_phase_combiner.h> -#include <gr_io_signature.h> - -gr_pa_2x2_phase_combiner_sptr -gr_make_pa_2x2_phase_combiner() -{ - return gnuradio::get_initial_sptr(new gr_pa_2x2_phase_combiner()); -} - -gr_pa_2x2_phase_combiner::gr_pa_2x2_phase_combiner () - : gr_sync_block ("pa_2x2_phase_combiner", - gr_make_io_signature (1, 1, NM * sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (float))) -{ - set_theta(0); -} - -void -gr_pa_2x2_phase_combiner::set_theta(float theta) -{ - d_theta = theta; - gr_complex j = gr_complex(0,1); - d_phase[0] = exp(j * (float) (M_PI * (sin(theta) + cos(theta)))); - d_phase[1] = exp(j * (float) (M_PI * cos(theta))); - d_phase[2] = exp(j * (float) (M_PI * sin(theta))); - d_phase[3] = exp(j * (float) 0.0); -} - -int -gr_pa_2x2_phase_combiner::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - - for (int i = 0; i < noutput_items; i++){ - gr_complex acc = 0; - acc += in[0] * d_phase[0]; - acc += in[1] * d_phase[1]; - acc += in[2] * d_phase[2]; - acc += in[3] * d_phase[3]; - out[i] = acc; - in += 4; - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.h b/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.h deleted file mode 100644 index d430d154fc..0000000000 --- a/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- 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_PA_2X2_PHASE_COMBINER_H -#define INCLUDED_GR_PA_2X2_PHASE_COMBINER_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_pa_2x2_phase_combiner; -typedef boost::shared_ptr<gr_pa_2x2_phase_combiner> gr_pa_2x2_phase_combiner_sptr; - -GR_CORE_API gr_pa_2x2_phase_combiner_sptr gr_make_pa_2x2_phase_combiner (); - -/*! - * \brief pa_2x2 phase combiner - * \ingroup misc_blk - * - * Anntenas are arranged like this: - * - * 2 3 - * 0 1 - * - * dx and dy are lambda/2. - */ -class GR_CORE_API gr_pa_2x2_phase_combiner : public gr_sync_block -{ - static const int NM = 4; - - float d_theta; - gr_complex d_phase[NM]; - - gr_pa_2x2_phase_combiner (); - friend GR_CORE_API gr_pa_2x2_phase_combiner_sptr gr_make_pa_2x2_phase_combiner(); - - public: - float theta() const { return d_theta; } - void set_theta(float theta); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_PA_2X2_PHASE_COMBINER_H */ diff --git a/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.i b/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.i deleted file mode 100644 index 2cd373a5e4..0000000000 --- a/gnuradio-core/src/lib/general/gr_pa_2x2_phase_combiner.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,pa_2x2_phase_combiner) - -gr_pa_2x2_phase_combiner_sptr gr_make_pa_2x2_phase_combiner(); - -class gr_pa_2x2_phase_combiner : public gr_sync_block -{ - gr_pa_2x2_phase_combiner(); - - public: - float theta() const; - void set_theta(float theta); -}; diff --git a/gr-digital/python/digital_voice.py.real b/gr-digital/python/digital_voice.py.real index 4a2ef7721f..241a4a3dc2 100644 --- a/gr-digital/python/digital_voice.py.real +++ b/gr-digital/python/digital_voice.py.real @@ -23,8 +23,7 @@ """ Digital voice Tx and Rx using GSM 13kbit vocoder and GMSK. -Runs channel at 32kbit/sec. Currently uses fake channel coding, -but there's room for a rate 1/2 coder. +Runs channel at 32kbit/sec. """ from gnuradio import gr, gru @@ -66,7 +65,7 @@ class digital_voice_tx(gr.hier_block): f2s = blocks.float_to_short() voice_coder = gsm_full_rate.encode_sp() - channel_coder = gr.fake_channel_encoder_pp(GSM_FRAME_SIZE, AIR_FRAME_SIZE) + channel_coder = gr.multiply_const_b(1) p2s = gr.parallel_to_serial(gr.sizeof_char, AIR_FRAME_SIZE) mod = gmsk_mod(fg, sps=samples_per_symbol, @@ -93,7 +92,7 @@ class digital_voice_rx(gr.hier_block): p_size=AIR_FRAME_SIZE) s2p = gr.serial_to_parallel(gr.sizeof_char, AIR_FRAME_SIZE) - channel_decoder = gr.fake_channel_decoder_pp(AIR_FRAME_SIZE, GSM_FRAME_SIZE) + channel_decoder = gr.multiply_const_b(1) voice_decoder = gsm_full_rate.decode_ps() s2f = blocks.short_to_float () diff --git a/grc/todo.txt b/grc/todo.txt index 1205b3ff6d..cedea72aa3 100644 --- a/grc/todo.txt +++ b/grc/todo.txt @@ -12,11 +12,6 @@ * packet mod: whitening offset * wx min window size in options block * gr_adaptive_fir_ccf -* ofdm - * gr_ofdm_bpsk_demapper - * gr_ofdm_demapper_vcb - * gr_ofdm_frame_sink - * gr_ofdm_mapper_bcv * size params for the graphical sinks * callbacks for set average on fft, waterfall, number sinks * add units to params: Sps, Hz, dB... |