forked from sdr/gr-osmosdr
hackrf: update to libhackrf 6f0ae9bc99 API
This commit is contained in:
parent
905dd03ac6
commit
7c22e6975c
|
@ -269,13 +269,11 @@ int hackrf_sink_c::hackrf_tx_callback(unsigned char *buffer, uint32_t length)
|
||||||
memset(buffer, 0, length);
|
memset(buffer, 0, length);
|
||||||
std::cerr << "U" << std::flush;
|
std::cerr << "U" << std::flush;
|
||||||
} else {
|
} else {
|
||||||
// std::cerr << ":" << std::flush;
|
// std::cerr << "-" << std::flush;
|
||||||
_buf_cond.notify_one();
|
_buf_cond.notify_one();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0; // TODO: return -1 on error/stop
|
return 0; // TODO: return -1 on error/stop
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,9 +299,7 @@ bool hackrf_sink_c::start()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ( ! hackrf_is_streaming( _dev ) );
|
return true;
|
||||||
|
|
||||||
return (bool) hackrf_is_streaming( _dev );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hackrf_sink_c::stop()
|
bool hackrf_sink_c::stop()
|
||||||
|
@ -317,16 +313,9 @@ bool hackrf_sink_c::stop()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ( hackrf_is_streaming( _dev ) );
|
return true;
|
||||||
|
|
||||||
/* 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 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_AVX
|
#ifdef USE_AVX
|
||||||
void convert_avx(const float* inbuf, unsigned char* outbuf,const unsigned int count)
|
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,
|
int hackrf_sink_c::work( int noutput_items,
|
||||||
gr_vector_const_void_star &input_items,
|
gr_vector_const_void_star &input_items,
|
||||||
gr_vector_void_star &output_items )
|
gr_vector_void_star &output_items )
|
||||||
{
|
{
|
||||||
const gr_complex *in = (const gr_complex *) input_items[0];
|
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;
|
items_consumed = 0;
|
||||||
std::cerr << "O" << std::flush;
|
std::cerr << "O" << std::flush;
|
||||||
} else {
|
} else {
|
||||||
// std::cerr << "." << std::flush;
|
// std::cerr << "+" << std::flush;
|
||||||
_buf_used = 0;
|
_buf_used = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,8 +130,6 @@ private:
|
||||||
static int _usage;
|
static int _usage;
|
||||||
static boost::mutex _usage_mutex;
|
static boost::mutex _usage_mutex;
|
||||||
|
|
||||||
std::vector<gr_complex> _lut;
|
|
||||||
|
|
||||||
hackrf_device *_dev;
|
hackrf_device *_dev;
|
||||||
// gruel::thread _thread;
|
// gruel::thread _thread;
|
||||||
|
|
||||||
|
|
|
@ -258,9 +258,7 @@ bool hackrf_source_c::start()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ( ! hackrf_is_streaming( _dev ) );
|
return true;
|
||||||
|
|
||||||
return (bool) hackrf_is_streaming( _dev );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hackrf_source_c::stop()
|
bool hackrf_source_c::stop()
|
||||||
|
@ -274,13 +272,7 @@ bool hackrf_source_c::stop()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ( hackrf_is_streaming( _dev ) );
|
return true;
|
||||||
|
|
||||||
/* 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 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int hackrf_source_c::work( int noutput_items,
|
int hackrf_source_c::work( int noutput_items,
|
||||||
|
@ -292,7 +284,7 @@ int hackrf_source_c::work( int noutput_items,
|
||||||
bool running = false;
|
bool running = false;
|
||||||
|
|
||||||
if ( _dev )
|
if ( _dev )
|
||||||
running = (bool) hackrf_is_streaming( _dev );
|
running = (hackrf_is_streaming( _dev ) == HACKRF_TRUE);
|
||||||
|
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock( _buf_mutex );
|
boost::mutex::scoped_lock lock( _buf_mutex );
|
||||||
|
@ -301,7 +293,7 @@ int hackrf_source_c::work( int noutput_items,
|
||||||
_buf_cond.wait( lock );
|
_buf_cond.wait( lock );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!running)
|
if ( ! running )
|
||||||
return WORK_DONE;
|
return WORK_DONE;
|
||||||
|
|
||||||
unsigned short *buf = _buf[_buf_head] + _buf_offset;
|
unsigned short *buf = _buf[_buf_head] + _buf_offset;
|
||||||
|
|
Loading…
Reference in New Issue