[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r10994 - gnuradio/branches/developers/jblum/digital
From: |
jblum |
Subject: |
[Commit-gnuradio] r10994 - gnuradio/branches/developers/jblum/digital |
Date: |
Fri, 8 May 2009 16:40:15 -0600 (MDT) |
Author: jblum
Date: 2009-05-08 16:40:15 -0600 (Fri, 08 May 2009)
New Revision: 10994
Modified:
gnuradio/branches/developers/jblum/digital/generic_usrp.py
gnuradio/branches/developers/jblum/digital/pick_bitrate.py
gnuradio/branches/developers/jblum/digital/receive_path.py
gnuradio/branches/developers/jblum/digital/transmit_path.py
Log:
get decim and interp rates for generic usrp
allows pick bitrate module to use only rates that are possible with the given
usrp
Modified: gnuradio/branches/developers/jblum/digital/generic_usrp.py
===================================================================
--- gnuradio/branches/developers/jblum/digital/generic_usrp.py 2009-05-08
18:54:58 UTC (rev 10993)
+++ gnuradio/branches/developers/jblum/digital/generic_usrp.py 2009-05-08
22:40:15 UTC (rev 10994)
@@ -131,9 +131,16 @@
# generic access methods
####################################################################
def set_decim(self, decim):
+ if decim not in self.get_decim_rates(): return False
if self._type == USRP1_TYPE: return self._u.set_decim_rate(decim)
elif self._type == USRP2_TYPE: return self._u.set_decim(decim)
+ def get_decim_rates(self):
+ if self._type == USRP1_TYPE: return range(8, 256+1, 2) #default
firmware w/ hb filters
+ if self._type == USRP2_TYPE: return range(4, 128+1, 1) + \
+ range(130, 256+1, 2) + \
+ range(260, 512+1, 4)
+
def adc_rate(self): return self._u.adc_rate()
####################################################################
@@ -178,9 +185,16 @@
# generic access methods
####################################################################
def set_interp(self, interp):
+ if interp not in self.get_interp_rates(): return False
if self._type == USRP1_TYPE: return self._u.set_interp_rate(interp)
elif self._type == USRP2_TYPE: return self._u.set_interp(interp)
+ def get_interp_rates(self):
+ if self._type == USRP1_TYPE: return range(16, 512+1, 4)
+ if self._type == USRP2_TYPE: return range(4, 128+1, 1) + \
+ range(130, 256+1, 2) + \
+ range(260, 512+1, 4)
+
def dac_rate(self): return self._u.dac_rate()
####################################################################
Modified: gnuradio/branches/developers/jblum/digital/pick_bitrate.py
===================================================================
--- gnuradio/branches/developers/jblum/digital/pick_bitrate.py 2009-05-08
18:54:58 UTC (rev 10993)
+++ gnuradio/branches/developers/jblum/digital/pick_bitrate.py 2009-05-08
22:40:15 UTC (rev 10994)
@@ -25,19 +25,19 @@
_valid_samples_per_symbol = (2,3,4,5,6,7)
-def _gen_tx_info(converter_rate):
+def _gen_tx_info(converter_rate, xrates):
results = []
for samples_per_symbol in _valid_samples_per_symbol:
- for interp in range(16, 512 + 1, 4):
+ for interp in xrates:
bitrate = converter_rate / interp / samples_per_symbol
results.append((bitrate, samples_per_symbol, interp))
results.sort()
return results
-def _gen_rx_info(converter_rate):
+def _gen_rx_info(converter_rate, xrates):
results = []
for samples_per_symbol in _valid_samples_per_symbol:
- for decim in range(8, 256 + 1, 2):
+ for decim in xrates:
bitrate = converter_rate / decim / samples_per_symbol
results.append((bitrate, samples_per_symbol, decim))
results.sort()
@@ -79,7 +79,7 @@
return ((best[0] * bits_per_symbol),) + best[1:]
def _pick_bitrate(bitrate, bits_per_symbol, samples_per_symbol,
- xrate, converter_rate, gen_info):
+ xrate, converter_rate, xrates, gen_info):
"""
@returns tuple (bitrate, samples_per_symbol, interp_rate_or_decim_rate)
"""
@@ -97,14 +97,14 @@
# samples_per_symbol constraint, but not both of them.
ret = _pick_best(bitrate, bits_per_symbol,
- _filter_info(gen_info(converter_rate),
samples_per_symbol, xrate))
+ _filter_info(gen_info(converter_rate, xrates),
samples_per_symbol, xrate))
print "Actual Bitrate:", eng_notation.num_to_str(ret[0])
return ret
#
---------------------------------------------------------------------------------------
def pick_tx_bitrate(bitrate, bits_per_symbol, samples_per_symbol,
- interp_rate, converter_rate):
+ interp_rate, converter_rate, possible_interps):
"""
Given the 4 input parameters, return at configuration that matches
@@ -118,16 +118,18 @@
@type interp_rate: integer or None
@param converter_rate: converter sample rate in Hz
@type converter_rate: number
+ @param possible_interps: a list of possible rates
+ @type possible_interps: a list of integers
@returns tuple (bitrate, samples_per_symbol, interp_rate)
"""
- print "Requested TX Bitrate:", bitrate and
eng_notation.num_to_str(bitrate) or 'Auto'
+ print "Requested TX Bitrate:", bitrate and
eng_notation.num_to_str(bitrate) or 'Auto',
return _pick_bitrate(bitrate, bits_per_symbol, samples_per_symbol,
- interp_rate, converter_rate, _gen_tx_info)
+ interp_rate, converter_rate, possible_interps,
_gen_tx_info)
def pick_rx_bitrate(bitrate, bits_per_symbol, samples_per_symbol,
- decim_rate, converter_rate):
+ decim_rate, converter_rate, possible_decims):
"""
Given the 4 input parameters, return at configuration that matches
@@ -141,9 +143,11 @@
@type decim_rate: integer or None
@param converter_rate: converter sample rate in Hz
@type converter_rate: number
+ @param possible_decims: a list of possible rates
+ @type possible_decims: a list of integers
@returns tuple (bitrate, samples_per_symbol, decim_rate)
"""
print "Requested RX Bitrate:", bitrate and
eng_notation.num_to_str(bitrate) or 'Auto'
return _pick_bitrate(bitrate, bits_per_symbol, samples_per_symbol,
- decim_rate, converter_rate, _gen_rx_info)
+ decim_rate, converter_rate, possible_decims,
_gen_rx_info)
Modified: gnuradio/branches/developers/jblum/digital/receive_path.py
===================================================================
--- gnuradio/branches/developers/jblum/digital/receive_path.py 2009-05-08
18:54:58 UTC (rev 10993)
+++ gnuradio/branches/developers/jblum/digital/receive_path.py 2009-05-08
22:40:15 UTC (rev 10994)
@@ -119,7 +119,7 @@
# derive values of bitrate, samples_per_symbol, and decim from desired
info
(self._bitrate, self._samples_per_symbol, self._decim) = \
pick_rx_bitrate(self._bitrate,
self._demod_class.bits_per_symbol(), \
- self._samples_per_symbol, self._decim, adc_rate)
+ self._samples_per_symbol, self._decim, adc_rate,
self.u.get_decim_rates())
self.u.set_decim(self._decim)
Modified: gnuradio/branches/developers/jblum/digital/transmit_path.py
===================================================================
--- gnuradio/branches/developers/jblum/digital/transmit_path.py 2009-05-08
18:54:58 UTC (rev 10993)
+++ gnuradio/branches/developers/jblum/digital/transmit_path.py 2009-05-08
22:40:15 UTC (rev 10994)
@@ -110,7 +110,7 @@
# derive values of bitrate, samples_per_symbol, and interp from
desired info
(self._bitrate, self._samples_per_symbol, self._interp) = \
pick_tx_bitrate(self._bitrate,
self._modulator_class.bits_per_symbol(),
- self._samples_per_symbol, self._interp, dac_rate)
+ self._samples_per_symbol, self._interp, dac_rate,
self.u.get_interp_rates())
self.u.set_interp(self._interp)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r10994 - gnuradio/branches/developers/jblum/digital,
jblum <=