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.wip-signat
parent
5410ee53b2
commit
9c6ac9e3e3
2
README
2
README
|
@ -8,7 +8,7 @@ as well supports:
|
|||
* RTL-TCP spectrum server (see librtlsdr project)
|
||||
* MSi2500 based DVB-T dongles through libmirisdr
|
||||
* 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
|
||||
* Nuand LLC bladeRF through libbladeRF 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)
|
||||
* MSi2500 based DVB-T dongles through libmirisdr
|
||||
* gnuradio .cfile input through libgnuradio-blocks
|
||||
* RFSPACE NetSDR via direct TCP/UDP communication
|
||||
* RFSPACE SDR-IQ, SDR-IP, NetSDR (incl. X2 option)
|
||||
#end if
|
||||
* Great Scott Gadgets HackRF through libhackrf
|
||||
* 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] ...
|
||||
osmosdr=0[,buffers=32][,buflen=N*512] ...
|
||||
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
|
||||
hackrf=0[,buffers=32]
|
||||
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)
|
||||
|
||||
########################################################################
|
||||
# Setup NetSDR component
|
||||
# Setup RFSPACE component
|
||||
########################################################################
|
||||
GR_REGISTER_COMPONENT("RFSPACE NetSDR" ENABLE_NETSDR)
|
||||
if(ENABLE_NETSDR)
|
||||
GR_INCLUDE_SUBDIRECTORY(netsdr)
|
||||
endif(ENABLE_NETSDR)
|
||||
GR_REGISTER_COMPONENT("RFSPACE Receivers" ENABLE_RFSPACE)
|
||||
if(ENABLE_RFSPACE)
|
||||
GR_INCLUDE_SUBDIRECTORY(rfspace)
|
||||
endif(ENABLE_RFSPACE)
|
||||
|
||||
########################################################################
|
||||
# Setup configuration file
|
||||
|
|
|
@ -13,6 +13,6 @@
|
|||
#cmakedefine ENABLE_MIRI
|
||||
#cmakedefine ENABLE_HACKRF
|
||||
#cmakedefine ENABLE_BLADERF
|
||||
#cmakedefine ENABLE_NETSDR
|
||||
#cmakedefine ENABLE_RFSPACE
|
||||
|
||||
#endif // CONFIG_H_IN
|
||||
|
|
|
@ -66,8 +66,8 @@
|
|||
#include <bladerf_source_c.h>
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NETSDR
|
||||
#include <netsdr_source_c.h>
|
||||
#ifdef ENABLE_RFSPACE
|
||||
#include <rfspace_source_c.h>
|
||||
#endif
|
||||
|
||||
#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() )
|
||||
devices.push_back( device_t(dev) );
|
||||
#endif
|
||||
#ifdef ENABLE_NETSDR
|
||||
BOOST_FOREACH( std::string dev, netsdr_source_c::get_devices( fake ) )
|
||||
#ifdef ENABLE_RFSPACE
|
||||
BOOST_FOREACH( std::string dev, rfspace_source_c::get_devices( fake ) )
|
||||
devices.push_back( device_t(dev) );
|
||||
#endif
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -25,13 +25,13 @@ include_directories(
|
|||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
set(netsdr_srcs
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/netsdr_source_c.cc
|
||||
set(rfspace_srcs
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rfspace_source_c.cc
|
||||
)
|
||||
|
||||
########################################################################
|
||||
# Append gnuradio-osmosdr library sources
|
||||
########################################################################
|
||||
list(APPEND gr_osmosdr_srcs ${netsdr_srcs})
|
||||
list(APPEND gr_osmosdr_srcs ${rfspace_srcs})
|
||||
#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,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#ifndef INCLUDED_NETSDR_SOURCE_C_H
|
||||
#define INCLUDED_NETSDR_SOURCE_C_H
|
||||
#ifndef INCLUDED_RFSPACE_SOURCE_C_H
|
||||
#define INCLUDED_RFSPACE_SOURCE_C_H
|
||||
|
||||
//#define USE_ASIO
|
||||
|
||||
|
@ -29,13 +29,17 @@
|
|||
#include <gnuradio/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 "source_iface.h"
|
||||
#ifdef USE_ASIO
|
||||
using boost::asio::ip::tcp;
|
||||
using boost::asio::ip::udp;
|
||||
#endif
|
||||
class netsdr_source_c;
|
||||
class rfspace_source_c;
|
||||
|
||||
#ifndef SOCKET
|
||||
#define SOCKET int
|
||||
|
@ -52,30 +56,30 @@ class netsdr_source_c;
|
|||
*
|
||||
* 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
|
||||
* constructor is private. netsdr_make_source_c is the public
|
||||
* To avoid accidental use of raw pointers, rfspace_source_c's
|
||||
* constructor is private. rfspace_make_source_c is the public
|
||||
* 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 source_iface
|
||||
{
|
||||
private:
|
||||
// The friend declaration allows netsdr_make_source_c to
|
||||
// The friend declaration allows rfspace_make_source_c to
|
||||
// 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:
|
||||
~netsdr_source_c (); // public destructor
|
||||
~rfspace_source_c (); // public destructor
|
||||
|
||||
bool start();
|
||||
bool stop();
|
||||
|
@ -117,14 +121,26 @@ public:
|
|||
osmosdr::freq_range_t get_bandwidth_range( size_t chan = 0 );
|
||||
|
||||
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,
|
||||
std::vector< unsigned char > &response );
|
||||
|
||||
void usb_read_task();
|
||||
|
||||
private: /* members */
|
||||
enum radio_type
|
||||
{
|
||||
RADIO_UNKNOWN = 0,
|
||||
RFSPACE_SDR_IQ,
|
||||
RFSPACE_SDR_IP,
|
||||
RFSPACE_NETSDR
|
||||
};
|
||||
|
||||
radio_type _radio;
|
||||
|
||||
#ifdef USE_ASIO
|
||||
boost::asio::io_service _io_service;
|
||||
tcp::resolver _resolver;
|
||||
|
@ -134,6 +150,7 @@ private: /* members */
|
|||
SOCKET _tcp;
|
||||
SOCKET _udp;
|
||||
#endif
|
||||
int _usb;
|
||||
bool _running;
|
||||
bool _keep_running;
|
||||
uint16_t _sequence;
|
||||
|
@ -141,6 +158,17 @@ private: /* members */
|
|||
size_t _nchan;
|
||||
double _sample_rate;
|
||||
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>
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NETSDR
|
||||
#include <netsdr_source_c.h>
|
||||
#ifdef ENABLE_RFSPACE
|
||||
#include <rfspace_source_c.h>
|
||||
#endif
|
||||
|
||||
#include "arg_helpers.h"
|
||||
|
@ -132,8 +132,8 @@ source_impl::source_impl( const std::string &args )
|
|||
#ifdef ENABLE_BLADERF
|
||||
dev_types.push_back("bladerf");
|
||||
#endif
|
||||
#ifdef ENABLE_NETSDR
|
||||
dev_types.push_back("netsdr");
|
||||
#ifdef ENABLE_RFSPACE
|
||||
dev_types.push_back("rfspace");
|
||||
#endif
|
||||
std::cerr << "gr-osmosdr "
|
||||
<< GR_OSMOSDR_VERSION << " (" << GR_OSMOSDR_LIBVER << ") "
|
||||
|
@ -143,6 +143,12 @@ source_impl::source_impl( const std::string &args )
|
|||
std::cerr << dev_type << " ";
|
||||
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) {
|
||||
dict_t dict = params_to_dict(arg);
|
||||
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() )
|
||||
dev_list.push_back( dev );
|
||||
#endif
|
||||
#ifdef ENABLE_NETSDR
|
||||
BOOST_FOREACH( std::string dev, netsdr_source_c::get_devices() )
|
||||
#ifdef ENABLE_RFSPACE
|
||||
BOOST_FOREACH( std::string dev, rfspace_source_c::get_devices() )
|
||||
dev_list.push_back( dev );
|
||||
#endif
|
||||
#ifdef ENABLE_HACKRF
|
||||
|
@ -274,9 +280,12 @@ source_impl::source_impl( const std::string &args )
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NETSDR
|
||||
if ( dict.count("netsdr") ) {
|
||||
netsdr_source_c_sptr src = make_netsdr_source_c( arg );
|
||||
#ifdef ENABLE_RFSPACE
|
||||
if ( dict.count("rfspace") ||
|
||||
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();
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue