-msdd_source_simple::msdd_source_simple (
- const char *src,
- unsigned short port_src)
- : gr_sync_block("MSDD_SOURCE_SIMPLE",
- gr_make_io_signature (0,0,0),
- gr_make_io_signature (1, 1, sizeof (short))),
- rcv(new MSDD6000((char*) src)), d_lastseq(0), d_firstrun(true)
+msdd_source_simple::msdd_source_simple (const char *src,
+ unsigned short port_src)
+ : gr_sync_block("MSDD_SOURCE_SIMPLE",
+ gr_make_io_signature (0,0,0),
+ gr_make_io_signature (1, 1, sizeof (short))),
+ rcv(new MSDD6000((char*) src)), d_lastseq(0), d_firstrun(true)
- float* out1 =(float*) output_items[0];
-
- for(int i=0; i<floor(noutput_items*1.0/(2*MSDD_COMPLEX_SAMPLES_PER_PACKET));i++){
- char buffer[BUF_LEN];
- rcv->read( &buffer[0], BUF_LEN );
-
- int seq = *((int*) &buffer[2]);
-
- if(d_lastseq == -MSDD_COMPLEX_SAMPLES_PER_PACKET){
- // not started case
- if(seq == 0){
- d_lastseq = 0;
- } else {
- // THROW AWAY SAMPLES WE ARE NOT STARTED YET!
- return 0;
- }
-
- } else {
- // started case
- int samples_missed = seq - d_lastseq - MSDD_COMPLEX_SAMPLES_PER_PACKET;
- if(samples_missed > 0){
- if(d_firstrun == true){
- // we may have missed some initial samples off the beginning of
- // a stream but there are no drop outs in the middle of what we have
- } else {
- printf("dropped %d samples.\n", samples_missed);
- }
- }
- d_lastseq = seq;
- }
-
- int out_idx = i*MSDD_COMPLEX_SAMPLES_PER_PACKET*2;
- memcpy(&out1[out_idx], &buffer[6], BUF_LEN - 6);
- d_firstrun = false;
- }
-
- return noutput_items;
+ float* out1 =(float*) output_items[0];
+
+ for(int i=0; i<floor(noutput_items*1.0/(2*MSDD_COMPLEX_SAMPLES_PER_PACKET));i++){
+ char buffer[BUF_LEN];
+ rcv->read( &buffer[0], BUF_LEN );
+
+ int seq = *((int*) &buffer[2]);
+
+ if(d_lastseq == -MSDD_COMPLEX_SAMPLES_PER_PACKET){
+ // not started case
+ if(seq == 0){
+ d_lastseq = 0;
+ } else {
+ // THROW AWAY SAMPLES WE ARE NOT STARTED YET!
+ return 0;
+ }
+
+ } else {
+ // started case
+ int samples_missed = seq - d_lastseq - MSDD_COMPLEX_SAMPLES_PER_PACKET;
+ if(samples_missed > 0){
+ if(d_firstrun == true){
+ // we may have missed some initial samples off the beginning of
+ // a stream but there are no drop outs in the middle of what we have
+ } else {
+ printf("dropped %d samples.\n", samples_missed);
+ }
+ }
+ d_lastseq = seq;
+ }
+
+ int out_idx = i*MSDD_COMPLEX_SAMPLES_PER_PACKET*2;
+ memcpy(&out1[out_idx], &buffer[6], BUF_LEN - 6);
+ d_firstrun = false;
+ }
+
+ return noutput_items;
- long new_fc = (long)freq;
- rcv->set_fc( new_fc/1000000, new_fc%1000000);
- return true;
+ long new_fc = (long)freq;
+ rcv->set_fc( new_fc/1000000, new_fc%1000000);
+ return true;
- if(gain < 0 || gain > 10){
- printf("GAIN IS OUTSIDE ACCEPTABLE RANGE!\n");
- return false;
- }
- // ok i lied this is not really a pga, its decimation gain
- rcv->set_ddc_gain((int)gain);
- return true;
+ if(gain < 0 || gain > 10){
+ printf("GAIN IS OUTSIDE ACCEPTABLE RANGE!\n");
+ return false;
+ }
+ // ok i lied this is not really a pga, its decimation gain
+ rcv->set_ddc_gain((int)gain);
+ return true;
-std::vector<float> msdd_source_simple::freq_range(){
- std::vector<float> r;
- r.push_back(30.0*1000*1000);
- r.push_back(6.0*1000*1000*1000);
- return r;
+std::vector<float> msdd_source_simple::freq_range()
+{
+ std::vector<float> r;
+ r.push_back(30.0*1000*1000);
+ r.push_back(6.0*1000*1000*1000);
+ return r;