hackrf: update to libhackrf 6f0ae9bc99 API

gr3.6
Dimitri Stolnikov 10 years ago
parent 905dd03ac6
commit 7c22e6975c
  1. 23
      lib/hackrf/hackrf_sink_c.cc
  2. 2
      lib/hackrf/hackrf_sink_c.h
  3. 16
      lib/hackrf/hackrf_source_c.cc

@ -269,13 +269,11 @@ int hackrf_sink_c::hackrf_tx_callback(unsigned char *buffer, uint32_t length)
memset(buffer, 0, length);
std::cerr << "U" << std::flush;
} else {
// std::cerr << ":" << std::flush;
// std::cerr << "-" << std::flush;
_buf_cond.notify_one();
}
}
#endif
return 0; // TODO: return -1 on error/stop
}
@ -301,9 +299,7 @@ bool hackrf_sink_c::start()
return false;
}
while ( ! hackrf_is_streaming( _dev ) );
return (bool) hackrf_is_streaming( _dev );
return true;
}
bool hackrf_sink_c::stop()
@ -317,16 +313,9 @@ bool hackrf_sink_c::stop()
return false;
}
while ( hackrf_is_streaming( _dev ) );
/* FIXME: hackrf_stop_tx should wait until the device is ready for a start */
/* required if we want to immediately start() again */
boost::this_thread::sleep( boost::posix_time::milliseconds(100) );
return ! (bool) hackrf_is_streaming( _dev );
return true;
}
#ifdef USE_AVX
void convert_avx(const float* inbuf, unsigned char* outbuf,const unsigned int count)
{
@ -392,8 +381,8 @@ void convert_default(float* inbuf, unsigned char* outbuf,const unsigned int coun
}
int hackrf_sink_c::work( int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items )
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items )
{
const gr_complex *in = (const gr_complex *) input_items[0];
@ -435,7 +424,7 @@ int hackrf_sink_c::work( int noutput_items,
items_consumed = 0;
std::cerr << "O" << std::flush;
} else {
// std::cerr << "." << std::flush;
// std::cerr << "+" << std::flush;
_buf_used = 0;
}
}

@ -130,8 +130,6 @@ private:
static int _usage;
static boost::mutex _usage_mutex;
std::vector<gr_complex> _lut;
hackrf_device *_dev;
// gruel::thread _thread;

@ -258,9 +258,7 @@ bool hackrf_source_c::start()
return false;
}
while ( ! hackrf_is_streaming( _dev ) );
return (bool) hackrf_is_streaming( _dev );
return true;
}
bool hackrf_source_c::stop()
@ -274,13 +272,7 @@ bool hackrf_source_c::stop()
return false;
}
while ( hackrf_is_streaming( _dev ) );
/* FIXME: hackrf_stop_rx should wait until the device is ready for a start */
/* required if we want to immediately start() again */
boost::this_thread::sleep( boost::posix_time::milliseconds(100) );
return ! (bool) hackrf_is_streaming( _dev );
return true;
}
int hackrf_source_c::work( int noutput_items,
@ -292,7 +284,7 @@ int hackrf_source_c::work( int noutput_items,
bool running = false;
if ( _dev )
running = (bool) hackrf_is_streaming( _dev );
running = (hackrf_is_streaming( _dev ) == HACKRF_TRUE);
{
boost::mutex::scoped_lock lock( _buf_mutex );
@ -301,7 +293,7 @@ int hackrf_source_c::work( int noutput_items,
_buf_cond.wait( lock );
}
if (!running)
if ( ! running )
return WORK_DONE;
unsigned short *buf = _buf[_buf_head] + _buf_offset;

Loading…
Cancel
Save