rtl_source_c: add buffers argument

This commit is contained in:
Dimitri Stolnikov 2012-05-05 17:40:23 +02:00
parent 3b6c74807c
commit 0a4b9264a3
2 changed files with 24 additions and 8 deletions

View File

@ -99,6 +99,11 @@ self.\$(id).set_antenna(\$ant$(n), $n)
<doc> <doc>
The OsmoSDR $sourk.title() block: The OsmoSDR $sourk.title() block:
While primarily being developed for the OsmoSDR hardware, this block also
supports the FunCube Dongle, Ettus UHD, rtl-sdr radios and cfile source.
By using the OsmoSDR block you can take advantage of a common software api in
your application(s) independent of the underlying radio hardware.
Output Type: Output Type:
This parameter controls the data type of the stream in gnuradio. This parameter controls the data type of the stream in gnuradio.
@ -109,7 +114,7 @@ of devices. If left blank, the first device found will be used.
Examples: Examples:
fcd=0 fcd=1 fcd=2 ... fcd=0 fcd=1 fcd=2 ...
rtl=0 rtl=1 rtl=2,rtl_xtal=28.80001e6,tuner_xtal=26e6 ... rtl=0 rtl=1 rtl=2,rtl_xtal=28.80001e6,tuner_xtal=26e6,buffers=64 ...
uhd=0|name,mcr=52e6,nchan=2,subdev='\\\\'B:0 A:0'\\\\' ... uhd=0|name,mcr=52e6,nchan=2,subdev='\\\\'B:0 A:0'\\\\' ...
osmosdr=0|name,mcr=64e6,nchan=5,port=/dev/ttyUSB0 ... osmosdr=0|name,mcr=64e6,nchan=5,port=/dev/ttyUSB0 ...
file=/path/to/file.ext,freq=428e6,rate=1e6,repeat=true,throttle=true file=/path/to/file.ext,freq=428e6,rate=1e6,repeat=true,throttle=true
@ -127,19 +132,20 @@ Freq. Corr.:
The frequency correction factor in parts per million (ppm). Leave 0 if unknown. The frequency correction factor in parts per million (ppm). Leave 0 if unknown.
Gain: Gain:
Overall gain of the device's signal path. For the gain setting to apply the Overall gain of the device's signal path. For the new gain value to be applied,
manual gain mode must be enabled first for some devices (namely rtlsdr). the manual gain mode must be enabled first.
Gain Mode: Gain Mode:
Chooses between the manual (default) and automatc gain mode where appropriate. Chooses between the manual (default) and automatic gain mode where appropriate.
Currently, only rtlsdr devices support automatic gain mode. Currently, only rtlsdr devices support automatic gain mode.
Antenna: Antenna:
For devices with only one antenna, this may be left blank. For devices with only one antenna, this may be left blank.
Otherwise, the user should specify one of the possible antenna choices. Otherwise, the user should specify one of the possible antenna choices.
See the OsmoSDR manual for more detailed documentation: See the OsmoSDR project page for more detailed documentation:
http://sdr.osmocom.org/trac/ http://sdr.osmocom.org/trac/
http://sdr.osmocom.org/trac/wiki/GrOsmoSDR
</doc> </doc>
</block> </block>
""" """

View File

@ -43,7 +43,8 @@
using namespace boost::assign; using namespace boost::assign;
#define BUF_SIZE (16 * 32 * 512) #define BUF_SIZE (16 * 32 * 512)
#define BUF_NUM 32
/* /*
* Create a new instance of rtl_source_c and return * Create a new instance of rtl_source_c and return
@ -91,7 +92,16 @@ rtl_source_c::rtl_source_c (const std::string &args)
if (dict.count("tuner_xtal")) if (dict.count("tuner_xtal"))
tuner_freq = (unsigned int)boost::lexical_cast< double >( dict["tuner_xtal"] ); tuner_freq = (unsigned int)boost::lexical_cast< double >( dict["tuner_xtal"] );
_buf_num = 32; _buf_num = BUF_NUM;
if (dict.count("buffers")) {
_buf_num = (unsigned int)boost::lexical_cast< double >( dict["buffers"] );
if (0 == _buf_num)
_buf_num = BUF_NUM;
std::cerr << "Using " << _buf_num << " buffers of size " << BUF_SIZE << "."
<< std::endl;
}
_buf = (unsigned short **) malloc(_buf_num * sizeof(unsigned short *)); _buf = (unsigned short **) malloc(_buf_num * sizeof(unsigned short *));
for(unsigned int i = 0; i < _buf_num; ++i) for(unsigned int i = 0; i < _buf_num; ++i)
@ -112,7 +122,7 @@ rtl_source_c::rtl_source_c (const std::string &args)
} }
if ( dev_index >= rtlsdr_get_device_count() ) if ( dev_index >= rtlsdr_get_device_count() )
throw std::runtime_error("Device index out of bounds for rtlsdr."); throw std::runtime_error("Wrong rtlsdr device index given.");
std::cerr << "Using device #" << dev_index << " " std::cerr << "Using device #" << dev_index << " "
<< "(" << rtlsdr_get_device_name(dev_index) << ")" << "(" << rtlsdr_get_device_name(dev_index) << ")"