[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r6024 - in grc/trunk: notes src src/SignalBlockDefs
From: |
jblum |
Subject: |
[Commit-gnuradio] r6024 - in grc/trunk: notes src src/SignalBlockDefs |
Date: |
Wed, 18 Jul 2007 18:28:29 -0600 (MDT) |
Author: jblum
Date: 2007-07-18 18:28:28 -0600 (Wed, 18 Jul 2007)
New Revision: 6024
Modified:
grc/trunk/notes/notes.txt
grc/trunk/src/ExecFlowGraph.py
grc/trunk/src/SignalBlockDefs/Audio.py
grc/trunk/src/SignalBlockDefs/Misc.py
grc/trunk/src/SignalBlockDefs/Packet.py
grc/trunk/src/SignalBlockDefs/USRP.py
Log:
removed fake audio fix
Modified: grc/trunk/notes/notes.txt
===================================================================
--- grc/trunk/notes/notes.txt 2007-07-18 22:14:09 UTC (rev 6023)
+++ grc/trunk/notes/notes.txt 2007-07-19 00:28:28 UTC (rev 6024)
@@ -5,10 +5,13 @@
-blks blocks, add filesave for logging
-combine add/mult with add/mult vector
-tun/tap block (with input and output)
+-multi-channel scope
############ Known Problems: ####################
-blocks need to fix themselves when they go out of bounds, like in a resize
-socket controllers should be intelligent on shrinkage
+-usrp transmit dies in lock/unlock
+-packet blocks freeze in lock/unlock
############ Features to Add: ####################
-startup tips
Modified: grc/trunk/src/ExecFlowGraph.py
===================================================================
--- grc/trunk/src/ExecFlowGraph.py 2007-07-18 22:14:09 UTC (rev 6023)
+++ grc/trunk/src/ExecFlowGraph.py 2007-07-19 00:28:28 UTC (rev 6024)
@@ -41,6 +41,7 @@
#internal data structures
self.callbacks = list()
self.callbacks_locked = list()
+ self.callbacks_cond = list()
self.var_keys = list()
self.runtime = gr.runtime(self)
self.started = False
@@ -79,13 +80,23 @@
def add_callback_locked(self, function, *data_type_params):
"""
- Register a callback function with its associated data.
+ Register a "locked" callback function with its associated data.
These callbacks will be called inside of a lock/unlock sequence.
@param function the callback function
@param data_type_params a list of data types
"""
self.callbacks_locked.append((function, data_type_params))
+ def add_callback_cond(self, function, *data_type_params):
+ """
+ Register a "conditional" callback function with its associated
data.
+ These callbacks will be called inside of a lock/unlock sequence
+ only if at least one locked callback has been registered.
+ @param function the callback function
+ @param data_type_params a list of data types
+ """
+ self.callbacks_cond.append((function, data_type_params))
+
def _parse_callback(self, function, *data_type_params):
"""
Parse a single callback. Call function on the data types.
@@ -106,9 +117,9 @@
if self.callbacks: #parse regular callbacks
for function, data_type_params in
self.callbacks:
self._parse_callback(function,
*data_type_params)
- if self.callbacks_locked: #parse locked callbacks
+ if self.callbacks_locked: #parse locked callbacks
and conditional callbacks
self._hb.lock()
- for function, data_type_params in
self.callbacks_locked:
+ for function, data_type_params in
self.callbacks_locked + self.callbacks_cond:
self._parse_callback(function,
*data_type_params)
self._hb.unlock()
time.sleep(.005) #sleep to lower chances
of possible thread-lockup
Modified: grc/trunk/src/SignalBlockDefs/Audio.py
===================================================================
--- grc/trunk/src/SignalBlockDefs/Audio.py 2007-07-18 22:14:09 UTC (rev
6023)
+++ grc/trunk/src/SignalBlockDefs/Audio.py 2007-07-19 00:28:28 UTC (rev
6024)
@@ -36,71 +36,6 @@
##index of the default audio rate
default_audio_rate_index = 3
-##type source
-SOURCE = 'source'
-
-##type sink
-SINK = 'sink'
-
-class AudioHelper(gr.hier_block2):
- """This block deletes and creates an internal audio block
- to avoid problems with stopping the audio device."""
-
- def __init__(self, samp_rate, type):
- """!
- AudioHelper contructor.
- @param samp_rate audio sampling rate
- @param type SOURCE or SINK
- """
- self.type = type
- assert(type in (SOURCE, SINK))
- if self.type == SINK:
- gr.hier_block2.__init__(
- self, "audio_sink_helper",
- gr.io_signature(1, 2, Float().get_num_bytes()),
- gr.io_signature(0, 0, 0),
- )
- elif self.type == SOURCE:
- gr.hier_block2.__init__(
- self, "audio_source_helper",
- gr.io_signature(0, 0, 0),
- gr.io_signature(1, 2, Float().get_num_bytes()),
- )
- self.samp_rate = samp_rate
- self._create_and_connect()
-
- def _create_and_connect(self):
- """Create a new audio block and connect its 2 ports"""
- from gnuradio import audio
- if self.type == SINK: #connect if sink
- self.audio_block = audio.sink(self.samp_rate)
- self.connect((self, 0), (self.audio_block, 0))
- self.connect((self, 1), (self.audio_block, 1))
- elif self.type == SOURCE: #connect if source
- self.audio_block = audio.source(self.samp_rate)
- self.connect((self.audio_block, 0), (self, 0))
- self.connect((self.audio_block, 1), (self, 1))
-
- def reconstruct(self, samp_rate):
- """!
- In a lock/unlock sequence:
- disconnect the audio sink,
- delete the audio sink,
- and call create and connect.
- @param samp_rate the new sampling rate
- """
- self._hb.lock()
- self.samp_rate = samp_rate #set the new samp rate
- if self.type == SINK: #disconnect if sink
- self.disconnect((self, 0), (self.audio_block, 0))
- self.disconnect((self, 1), (self.audio_block, 1))
- elif self.type == SOURCE: #disconnect if source
- self.disconnect((self.audio_block, 0), (self, 0))
- self.disconnect((self.audio_block, 1), (self, 1))
- del self.audio_block #must delete the block (file descriptor
is bad)
- self._create_and_connect()
- self._hb.unlock()
-
#######################################################################################
## Defs for Audio Source and Audio Sink
#######################################################################################
@@ -109,26 +44,22 @@
from gnuradio import audio #imports
sb.add_input_socket('lin', Float())
sb.add_input_socket('rin', Float(), optional=True)
- sb.add_param('Sampling Rate', Enum(audio_rates,
default_audio_rate_index), type=True, variable=True)
+ sb.add_param('Sampling Rate', Enum(audio_rates,
default_audio_rate_index), type=True)
sb.set_docs('''\
The left input must be connected, The right input is optional. \
If only one audio stream is connected, both channels will receive the
stream.''')
def make(fg, samp_rate):
- block = AudioHelper(samp_rate.parse(), SINK)
- fg.add_callback_locked(block.reconstruct, samp_rate)
- return block
+ return audio.sink(samp_rate.parse())
return sb, make
def AudioSource(sb):
from gnuradio import audio #imports
sb.add_output_socket('lout', Float())
sb.add_output_socket('rout', Float(), optional=True)
- sb.add_param('Sampling Rate', Enum(audio_rates,
default_audio_rate_index), type=True, variable=True)
+ sb.add_param('Sampling Rate', Enum(audio_rates,
default_audio_rate_index), type=True)
sb.set_docs('''The left output must be connected, The right output is
optional.''')
def make(fg, samp_rate):
- block = AudioHelper(samp_rate.parse(), SOURCE)
- fg.add_callback_locked(block.reconstruct, samp_rate)
- return block
+ return audio.source(samp_rate.parse())
return sb, make
\ No newline at end of file
Modified: grc/trunk/src/SignalBlockDefs/Misc.py
===================================================================
--- grc/trunk/src/SignalBlockDefs/Misc.py 2007-07-18 22:14:09 UTC (rev
6023)
+++ grc/trunk/src/SignalBlockDefs/Misc.py 2007-07-19 00:28:28 UTC (rev
6024)
@@ -189,7 +189,9 @@
sb.add_param('Num Outputs', Int(1, min=1, max=MAX_NUM_SOCKETS),
show_label=False, output_sockets_controller=True)
sb.add_param('Vector Length', vlen)
- sb.set_docs('''Forward data from the input index to the output
index.''')
+ sb.set_docs('''Forward data from the input index to the output index.
+
+Warning: this block is experimental and may cause the flow graph to lock up
when variables are changed.''')
def make(fg, type, input_index, output_index, num_inputs, num_outputs,
vlen):
item_size = type.parse().get_num_bytes()*vlen.parse()
block = SelectorHelper(
@@ -212,7 +214,9 @@
sb.add_param('Type', type, False, type=True)
sb.add_param('Open', Int(0), variable=True)
sb.add_param('Vector Length', vlen)
- sb.set_docs('''When open is 0, the valve will forward data.''')
+ sb.set_docs('''When open is 0, the valve will forward data.
+
+Warning: this block is experimental and may cause the flow graph to lock up
when variables are changed.''')
def make(fg, type, open, vlen):
item_size = type.parse().get_num_bytes()*vlen.parse()
block = SelectorHelper(item_size, 1, 1, 0, open.parse())
Modified: grc/trunk/src/SignalBlockDefs/Packet.py
===================================================================
--- grc/trunk/src/SignalBlockDefs/Packet.py 2007-07-18 22:14:09 UTC (rev
6023)
+++ grc/trunk/src/SignalBlockDefs/Packet.py 2007-07-19 00:28:28 UTC (rev
6024)
@@ -202,7 +202,7 @@
pad_for_usrp=pad_for_usrp.parse(),
use_whitener_offset=use_whitener_offset.parse(),
) #build packet modulator
- fg.add_callback_locked(block.flush)
+ fg.add_callback_cond(block.flush)
return block
return sb, make
Modified: grc/trunk/src/SignalBlockDefs/USRP.py
===================================================================
--- grc/trunk/src/SignalBlockDefs/USRP.py 2007-07-18 22:14:09 UTC (rev
6023)
+++ grc/trunk/src/SignalBlockDefs/USRP.py 2007-07-19 00:28:28 UTC (rev
6024)
@@ -105,13 +105,13 @@
elif not r: raise ValueError, '"%s" is not a valid frequency for this
sub-device\n'%freq
def _setup_rx_subdev(fg, u, subdev_spec, ddc, gain, freq, auto_tr=None,
rx_ant=None):
- """
+ """!
Setup a usrp receive subdevice by setting gain and freq.
Add the gain and freq callbacks to the flow graph.
FlexRF: Handle auto transmit/receive and set the receive antenna.
@param fg the flow graph
@param u the usrp object
- @param subdev the sub-device specification
+ @param subdev_spec the sub-device specification
@param ddc which ddc to use: 0 or 1
@param gain the gain DataType
@param freq the freq DataType
@@ -128,13 +128,13 @@
if rx_ant != None: subdev.select_rx_antenna(rx_ant)
def _setup_tx_subdev(fg, u, subdev_spec, gain, freq, auto_tr=None,
tx_enb=None):
- """
+ """!
Setup a usrp receive subdevice by setting gain and freq.
Add the gain and freq callbacks to the flow graph.
FlexRF: Handle auto transmit/receive and enable the transmitter.
@param fg the flow graph
@param u the usrp object
- @param subdev the sub-device specification
+ @param subdev_spec the sub-device specification
@param gain the gain DataType
@param freq the freq DataType
@param auto_tr auto transmit/receive True, False, or None
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r6024 - in grc/trunk: notes src src/SignalBlockDefs,
jblum <=