forked from sdr/gr-osmosdr
rfspace: add support for RFSPACE SDR-IQ and SDR-IP
Usage example: osmocom_fft -a sdr-iq=/dev/ttyUSB0 osmocom_fft -a sdr-ip=host[:port] osmocom_fft -a netsdr=host[:port][,nchan=2] The following named gain stages are available: SDR-IQ: ATT: -20 to +10 dB, in 10dB steps SDR-IP: ATT: -30 to 0 dB, in 10dB steps The ftdi_sio driver is being used for SDR-IQ. It creates a character device of the form: crw-rw---- 1 root dialout 188, 0 Dec 19 22:14 /dev/ttyUSB0 To be able to open the device without root permissions add yourself to the "dialout" group or do a "chmod 666 /dev/ttyUSB0" after pluggin in.
This commit is contained in:
parent
5410ee53b2
commit
9c6ac9e3e3
2
README
2
README
|
@ -8,7 +8,7 @@ as well supports:
|
||||||
* RTL-TCP spectrum server (see librtlsdr project)
|
* RTL-TCP spectrum server (see librtlsdr project)
|
||||||
* MSi2500 based DVB-T dongles through libmirisdr
|
* MSi2500 based DVB-T dongles through libmirisdr
|
||||||
* gnuradio .cfile input through libgnuradio-blocks
|
* gnuradio .cfile input through libgnuradio-blocks
|
||||||
* RFSPACE NetSDR via direct TCP/UDP communication
|
* RFSPACE SDR-IQ, SDR-IP, NetSDR (incl. X2 option)
|
||||||
* Great Scott Gadgets HackRF through libhackrf
|
* Great Scott Gadgets HackRF through libhackrf
|
||||||
* Nuand LLC bladeRF through libbladeRF library
|
* Nuand LLC bladeRF through libbladeRF library
|
||||||
* Ettus USRP Devices through Ettus UHD library
|
* Ettus USRP Devices through Ettus UHD library
|
||||||
|
|
|
@ -122,7 +122,7 @@ While primarily being developed for the OsmoSDR hardware, this block as well sup
|
||||||
* RTL-TCP spectrum server (see librtlsdr project)
|
* RTL-TCP spectrum server (see librtlsdr project)
|
||||||
* MSi2500 based DVB-T dongles through libmirisdr
|
* MSi2500 based DVB-T dongles through libmirisdr
|
||||||
* gnuradio .cfile input through libgnuradio-blocks
|
* gnuradio .cfile input through libgnuradio-blocks
|
||||||
* RFSPACE NetSDR via direct TCP/UDP communication
|
* RFSPACE SDR-IQ, SDR-IP, NetSDR (incl. X2 option)
|
||||||
#end if
|
#end if
|
||||||
* Great Scott Gadgets HackRF through libhackrf
|
* Great Scott Gadgets HackRF through libhackrf
|
||||||
* Nuand LLC bladeRF through libbladeRF library
|
* Nuand LLC bladeRF through libbladeRF library
|
||||||
|
@ -153,7 +153,9 @@ Lines ending with ... mean it's possible to bind devices together by specifying
|
||||||
rtl_tcp=127.0.0.1:1234[,psize=16384][,direct_samp=0|1|2][,offset_tune=0|1] ...
|
rtl_tcp=127.0.0.1:1234[,psize=16384][,direct_samp=0|1|2][,offset_tune=0|1] ...
|
||||||
osmosdr=0[,buffers=32][,buflen=N*512] ...
|
osmosdr=0[,buffers=32][,buflen=N*512] ...
|
||||||
file='/path/to/your file',rate=1e6[,freq=100e6][,repeat=true][,throttle=true] ...
|
file='/path/to/your file',rate=1e6[,freq=100e6][,repeat=true][,throttle=true] ...
|
||||||
netsdr=127.0.0.1:50000[,nchan=1]
|
netsdr=127.0.0.1[:50000][,nchan=2]
|
||||||
|
sdr-ip=127.0.0.1[:50000]
|
||||||
|
sdr-iq=/dev/ttyUSB0
|
||||||
#end if
|
#end if
|
||||||
hackrf=0[,buffers=32]
|
hackrf=0[,buffers=32]
|
||||||
bladerf=0[,fpga='/path/to/the/bitstream.rbf'][,fw='/path/to/the/firmware.img']
|
bladerf=0[,fpga='/path/to/the/bitstream.rbf'][,fw='/path/to/the/firmware.img']
|
||||||
|
|
|
@ -139,12 +139,12 @@ GR_INCLUDE_SUBDIRECTORY(bladerf)
|
||||||
endif(ENABLE_BLADERF)
|
endif(ENABLE_BLADERF)
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# Setup NetSDR component
|
# Setup RFSPACE component
|
||||||
########################################################################
|
########################################################################
|
||||||
GR_REGISTER_COMPONENT("RFSPACE NetSDR" ENABLE_NETSDR)
|
GR_REGISTER_COMPONENT("RFSPACE Receivers" ENABLE_RFSPACE)
|
||||||
if(ENABLE_NETSDR)
|
if(ENABLE_RFSPACE)
|
||||||
GR_INCLUDE_SUBDIRECTORY(netsdr)
|
GR_INCLUDE_SUBDIRECTORY(rfspace)
|
||||||
endif(ENABLE_NETSDR)
|
endif(ENABLE_RFSPACE)
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# Setup configuration file
|
# Setup configuration file
|
||||||
|
|
|
@ -13,6 +13,6 @@
|
||||||
#cmakedefine ENABLE_MIRI
|
#cmakedefine ENABLE_MIRI
|
||||||
#cmakedefine ENABLE_HACKRF
|
#cmakedefine ENABLE_HACKRF
|
||||||
#cmakedefine ENABLE_BLADERF
|
#cmakedefine ENABLE_BLADERF
|
||||||
#cmakedefine ENABLE_NETSDR
|
#cmakedefine ENABLE_RFSPACE
|
||||||
|
|
||||||
#endif // CONFIG_H_IN
|
#endif // CONFIG_H_IN
|
||||||
|
|
|
@ -66,8 +66,8 @@
|
||||||
#include <bladerf_source_c.h>
|
#include <bladerf_source_c.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_NETSDR
|
#ifdef ENABLE_RFSPACE
|
||||||
#include <netsdr_source_c.h>
|
#include <rfspace_source_c.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "arg_helpers.h"
|
#include "arg_helpers.h"
|
||||||
|
@ -154,8 +154,8 @@ devices_t device::find(const device_t &hint)
|
||||||
BOOST_FOREACH( std::string dev, hackrf_source_c::get_devices() )
|
BOOST_FOREACH( std::string dev, hackrf_source_c::get_devices() )
|
||||||
devices.push_back( device_t(dev) );
|
devices.push_back( device_t(dev) );
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_NETSDR
|
#ifdef ENABLE_RFSPACE
|
||||||
BOOST_FOREACH( std::string dev, netsdr_source_c::get_devices( fake ) )
|
BOOST_FOREACH( std::string dev, rfspace_source_c::get_devices( fake ) )
|
||||||
devices.push_back( device_t(dev) );
|
devices.push_back( device_t(dev) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -25,13 +25,13 @@ include_directories(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
set(netsdr_srcs
|
set(rfspace_srcs
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/netsdr_source_c.cc
|
${CMAKE_CURRENT_SOURCE_DIR}/rfspace_source_c.cc
|
||||||
)
|
)
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# Append gnuradio-osmosdr library sources
|
# Append gnuradio-osmosdr library sources
|
||||||
########################################################################
|
########################################################################
|
||||||
list(APPEND gr_osmosdr_srcs ${netsdr_srcs})
|
list(APPEND gr_osmosdr_srcs ${rfspace_srcs})
|
||||||
#list(APPEND gr_osmosdr_libs ...)
|
#list(APPEND gr_osmosdr_libs ...)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -17,8 +17,8 @@
|
||||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||||
* Boston, MA 02110-1301, USA.
|
* Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
#ifndef INCLUDED_NETSDR_SOURCE_C_H
|
#ifndef INCLUDED_RFSPACE_SOURCE_C_H
|
||||||
#define INCLUDED_NETSDR_SOURCE_C_H
|
#define INCLUDED_RFSPACE_SOURCE_C_H
|
||||||
|
|
||||||
//#define USE_ASIO
|
//#define USE_ASIO
|
||||||
|
|
||||||
|
@ -29,13 +29,17 @@
|
||||||
#include <gnuradio/block.h>
|
#include <gnuradio/block.h>
|
||||||
#include <gnuradio/sync_block.h>
|
#include <gnuradio/sync_block.h>
|
||||||
|
|
||||||
|
#include <boost/circular_buffer.hpp>
|
||||||
|
#include <boost/thread/mutex.hpp>
|
||||||
|
#include <boost/thread/condition_variable.hpp>
|
||||||
|
|
||||||
#include "osmosdr/ranges.h"
|
#include "osmosdr/ranges.h"
|
||||||
#include "source_iface.h"
|
#include "source_iface.h"
|
||||||
#ifdef USE_ASIO
|
#ifdef USE_ASIO
|
||||||
using boost::asio::ip::tcp;
|
using boost::asio::ip::tcp;
|
||||||
using boost::asio::ip::udp;
|
using boost::asio::ip::udp;
|
||||||
#endif
|
#endif
|
||||||
class netsdr_source_c;
|
class rfspace_source_c;
|
||||||
|
|
||||||
#ifndef SOCKET
|
#ifndef SOCKET
|
||||||
#define SOCKET int
|
#define SOCKET int
|
||||||
|
@ -52,30 +56,30 @@ class netsdr_source_c;
|
||||||
*
|
*
|
||||||
* As a convention, the _sptr suffix indicates a boost::shared_ptr
|
* As a convention, the _sptr suffix indicates a boost::shared_ptr
|
||||||
*/
|
*/
|
||||||
typedef boost::shared_ptr<netsdr_source_c> netsdr_source_c_sptr;
|
typedef boost::shared_ptr<rfspace_source_c> rfspace_source_c_sptr;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Return a shared_ptr to a new instance of netsdr_source_c.
|
* \brief Return a shared_ptr to a new instance of rfspace_source_c.
|
||||||
*
|
*
|
||||||
* To avoid accidental use of raw pointers, netsdr_source_c's
|
* To avoid accidental use of raw pointers, rfspace_source_c's
|
||||||
* constructor is private. netsdr_make_source_c is the public
|
* constructor is private. rfspace_make_source_c is the public
|
||||||
* interface for creating new instances.
|
* interface for creating new instances.
|
||||||
*/
|
*/
|
||||||
netsdr_source_c_sptr make_netsdr_source_c (const std::string & args = "");
|
rfspace_source_c_sptr make_rfspace_source_c (const std::string & args = "");
|
||||||
|
|
||||||
class netsdr_source_c :
|
class rfspace_source_c :
|
||||||
public gr::sync_block,
|
public gr::sync_block,
|
||||||
public source_iface
|
public source_iface
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// The friend declaration allows netsdr_make_source_c to
|
// The friend declaration allows rfspace_make_source_c to
|
||||||
// access the private constructor.
|
// access the private constructor.
|
||||||
friend netsdr_source_c_sptr make_netsdr_source_c (const std::string & args);
|
friend rfspace_source_c_sptr make_rfspace_source_c (const std::string & args);
|
||||||
|
|
||||||
netsdr_source_c (const std::string & args); // private constructor
|
rfspace_source_c (const std::string & args); // private constructor
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~netsdr_source_c (); // public destructor
|
~rfspace_source_c (); // public destructor
|
||||||
|
|
||||||
bool start();
|
bool start();
|
||||||
bool stop();
|
bool stop();
|
||||||
|
@ -117,14 +121,26 @@ public:
|
||||||
osmosdr::freq_range_t get_bandwidth_range( size_t chan = 0 );
|
osmosdr::freq_range_t get_bandwidth_range( size_t chan = 0 );
|
||||||
|
|
||||||
private: /* functions */
|
private: /* functions */
|
||||||
void apply_channel(unsigned char *cmd, size_t chan_pos, size_t chan);
|
void apply_channel( unsigned char *cmd, size_t chan = 0 );
|
||||||
|
|
||||||
bool transaction( const unsigned char *cmd, size_t size );
|
bool transaction( const unsigned char *cmd, size_t size );
|
||||||
|
|
||||||
bool transaction( const unsigned char *cmd, size_t size,
|
bool transaction( const unsigned char *cmd, size_t size,
|
||||||
std::vector< unsigned char > &response );
|
std::vector< unsigned char > &response );
|
||||||
|
|
||||||
|
void usb_read_task();
|
||||||
|
|
||||||
private: /* members */
|
private: /* members */
|
||||||
|
enum radio_type
|
||||||
|
{
|
||||||
|
RADIO_UNKNOWN = 0,
|
||||||
|
RFSPACE_SDR_IQ,
|
||||||
|
RFSPACE_SDR_IP,
|
||||||
|
RFSPACE_NETSDR
|
||||||
|
};
|
||||||
|
|
||||||
|
radio_type _radio;
|
||||||
|
|
||||||
#ifdef USE_ASIO
|
#ifdef USE_ASIO
|
||||||
boost::asio::io_service _io_service;
|
boost::asio::io_service _io_service;
|
||||||
tcp::resolver _resolver;
|
tcp::resolver _resolver;
|
||||||
|
@ -134,6 +150,7 @@ private: /* members */
|
||||||
SOCKET _tcp;
|
SOCKET _tcp;
|
||||||
SOCKET _udp;
|
SOCKET _udp;
|
||||||
#endif
|
#endif
|
||||||
|
int _usb;
|
||||||
bool _running;
|
bool _running;
|
||||||
bool _keep_running;
|
bool _keep_running;
|
||||||
uint16_t _sequence;
|
uint16_t _sequence;
|
||||||
|
@ -141,6 +158,17 @@ private: /* members */
|
||||||
size_t _nchan;
|
size_t _nchan;
|
||||||
double _sample_rate;
|
double _sample_rate;
|
||||||
double _bandwidth;
|
double _bandwidth;
|
||||||
|
|
||||||
|
gr::thread::thread _thread;
|
||||||
|
bool _run_usb_read_task;
|
||||||
|
|
||||||
|
boost::circular_buffer<gr_complex> *_fifo;
|
||||||
|
boost::mutex _fifo_lock;
|
||||||
|
boost::condition_variable _samp_avail;
|
||||||
|
|
||||||
|
std::vector< unsigned char > _resp;
|
||||||
|
boost::mutex _resp_lock;
|
||||||
|
boost::condition_variable _resp_avail;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* INCLUDED_NETSDR_SOURCE_C_H */
|
#endif /* INCLUDED_RFSPACE_SOURCE_C_H */
|
|
@ -68,8 +68,8 @@
|
||||||
#include <bladerf_source_c.h>
|
#include <bladerf_source_c.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_NETSDR
|
#ifdef ENABLE_RFSPACE
|
||||||
#include <netsdr_source_c.h>
|
#include <rfspace_source_c.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "arg_helpers.h"
|
#include "arg_helpers.h"
|
||||||
|
@ -132,8 +132,8 @@ source_impl::source_impl( const std::string &args )
|
||||||
#ifdef ENABLE_BLADERF
|
#ifdef ENABLE_BLADERF
|
||||||
dev_types.push_back("bladerf");
|
dev_types.push_back("bladerf");
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_NETSDR
|
#ifdef ENABLE_RFSPACE
|
||||||
dev_types.push_back("netsdr");
|
dev_types.push_back("rfspace");
|
||||||
#endif
|
#endif
|
||||||
std::cerr << "gr-osmosdr "
|
std::cerr << "gr-osmosdr "
|
||||||
<< GR_OSMOSDR_VERSION << " (" << GR_OSMOSDR_LIBVER << ") "
|
<< GR_OSMOSDR_VERSION << " (" << GR_OSMOSDR_LIBVER << ") "
|
||||||
|
@ -143,6 +143,12 @@ source_impl::source_impl( const std::string &args )
|
||||||
std::cerr << dev_type << " ";
|
std::cerr << dev_type << " ";
|
||||||
std::cerr << std::endl << std::flush;
|
std::cerr << std::endl << std::flush;
|
||||||
|
|
||||||
|
#ifdef ENABLE_RFSPACE
|
||||||
|
dev_types.push_back("sdr-iq"); /* additional aliases for rfspace backend */
|
||||||
|
dev_types.push_back("sdr-ip");
|
||||||
|
dev_types.push_back("netsdr");
|
||||||
|
#endif
|
||||||
|
|
||||||
BOOST_FOREACH(std::string arg, arg_list) {
|
BOOST_FOREACH(std::string arg, arg_list) {
|
||||||
dict_t dict = params_to_dict(arg);
|
dict_t dict = params_to_dict(arg);
|
||||||
BOOST_FOREACH(std::string dev_type, dev_types) {
|
BOOST_FOREACH(std::string dev_type, dev_types) {
|
||||||
|
@ -180,8 +186,8 @@ source_impl::source_impl( const std::string &args )
|
||||||
BOOST_FOREACH( std::string dev, bladerf_source_c::get_devices() )
|
BOOST_FOREACH( std::string dev, bladerf_source_c::get_devices() )
|
||||||
dev_list.push_back( dev );
|
dev_list.push_back( dev );
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_NETSDR
|
#ifdef ENABLE_RFSPACE
|
||||||
BOOST_FOREACH( std::string dev, netsdr_source_c::get_devices() )
|
BOOST_FOREACH( std::string dev, rfspace_source_c::get_devices() )
|
||||||
dev_list.push_back( dev );
|
dev_list.push_back( dev );
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_HACKRF
|
#ifdef ENABLE_HACKRF
|
||||||
|
@ -274,9 +280,12 @@ source_impl::source_impl( const std::string &args )
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_NETSDR
|
#ifdef ENABLE_RFSPACE
|
||||||
if ( dict.count("netsdr") ) {
|
if ( dict.count("rfspace") ||
|
||||||
netsdr_source_c_sptr src = make_netsdr_source_c( arg );
|
dict.count("sdr-iq") ||
|
||||||
|
dict.count("sdr-ip") ||
|
||||||
|
dict.count("netsdr") ) {
|
||||||
|
rfspace_source_c_sptr src = make_rfspace_source_c( arg );
|
||||||
block = src; iface = src.get();
|
block = src; iface = src.get();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue