laforge
/
openbts-osmo
Archived
1
0
Fork 0
Commit Graph

31 Commits

Author SHA1 Message Date
Thomas Tsou d71ce7c294 uhd: output more informative error message on make failure
The device make generally only fails on failure to find an
appropriate device.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2011-08-05 12:30:19 -07:00
Thomas Tsou fda11abe6c uhd: verify setting of master clock rate
If the master clock rate fails to set - this basically only happens
when the wrong transceiver is choosen for the particular device -
the error is fatal and the transceiver should exit. The clock rate
setting was previously never verified.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2011-08-05 12:29:31 -07:00
Thomas Tsou 96710c8077 uhd: flush receive buffer should return true on timeout
Receive buffer flush should continue to read until
either the desired number of packets has been read or
timeout, which means that the buffer has been emptied.
These are expected behaviours and should return true.

Ignore errors at this stage as the data and associated
metadata can be considered garbage and not worth
reporting. Actual error conditions will be caught
further downstream when useful data comes in.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2011-06-09 12:47:32 -07:00
Thomas Tsou e8b9db51e2 uhd: log asynchronous errors as errors
Bump abnormal asynchronous events - basically send errors -
up to ERROR level. These errors are dominated almost
entirely by underflow events, which should not be regularly
occuring.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2011-06-02 11:19:30 -07:00
Thomas Tsou e161523c8b transceiver: simplify transmit power control
UHD will internally accept floats with a range of +/-1.0,
which corresponds to a 16-bit signed integer range of
apporximately +/- 32000. Set the default amplitude to .3,
which is a safe value agaist saturation elsewhere in the
transmit chain.

The non-UHD maximum amplitude is unchanged at 13500.

Remove digital gain control because it's unnecessary and
causes extra load on enbedded systems.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2011-05-26 15:39:54 -07:00
Thomas Tsou a3bd572e45 uhd: reorganize error handling, exit when non-recoverable
This is primarily a minor refactor with the exception
of non-recoverable errors - notably if the receive times
out - which almost always requires a reload of the FPGA.
In these cases, quit without trying as resistance is
futile.

ERROR_TIMING:          Soft restart of streaming
ERROR_UNHANDLED:       Benign errors
ERROR_UNRECOVERABLE:   Abandon ship

Non-recoverable behaviour has not been observed in recent
builds, but may exist in older (or future) configurations.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2011-05-25 17:02:10 -07:00
Thomas Tsou 99a1466155 uhd: enable automatic alignment updates
Overnight testing shows that this shouldn't be required
in the majority of cases, but shit happens. Enabling
this forces transmit timing realignment at one minute
intervals. As a fallback method, timing slips not
caught by normal checks will be reset at the update.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2011-05-23 19:01:32 -07:00
Thomas Tsou 6ddbc257c8 uhd: cleanup startup timestamp alignment
At startup, instead of flushing initial packets blindly,
send a stop streaming command, flush, and start. The same
procedure is used in the event of a runtime timestamp
validity error.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2011-05-23 19:01:21 -07:00
Thomas Tsou 4f08ddf45a uhd: rework handling of timestamp errors
On a lapses of time monotonicity (and possibly other errors),
stop and restart the receive streaming with a buffer flush
in between. This is a cleaner replacement to the previous
clock reset with that didn't attempt to stop steaming.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2011-05-23 11:52:46 -07:00
Thomas Tsou de018f7fef uhd: fix timestamp conversion bug on 32-bit architectures
Type size_t was used in the UHD time_spec_t to integer
conversion, which would overflow at roughly 4 and a half
hours causing the sample buffer to error on timestamp
validity. Builds where size_t takes on 64-bits were not
affected by this bug.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2011-05-23 11:32:37 -07:00
Thomas Tsou 551dbd3326 uhd: reset sample clock when time goes non-monotonic
With UHD b4fc0d61bb6cbd1a5614745bab9aeb0abc22cb6f

Sample clock will reset to zero after an overrun. Earlier
versions may hang the FPGA, which is non-recoverable,
requiring a manual image reload or reboot.

If reset to zero, attempt to kick the sample clock to the
last properly received timestamp value. At this point,
there will be a timing continuity jump, which will drop
connections, but transmit and receive chains should be
aligned allowing for re-establishment.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2011-05-08 13:46:29 -04:00
Thomas Tsou 17750fd756 uhd: move static functions into the uhd_device class
Simplifies things slightly, and this is supposed to be
C++ after all.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2011-05-06 20:35:47 -04:00
Thomas Tsou 8c86da79c0 uhd: move non-52MHz transceiver to common radio device interface
Use the same header files for the device and start moving
toward a commmon transceiver without so much redundant code.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2011-05-06 17:42:18 -04:00
Thomas Tsou 258ad91549 uhd: set and shadow settings through interface
Shadow all gains and frequencies, which minimizes device access.
This allows the transceiver to variably control the device
settings.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2011-05-06 17:42:09 -04:00
Thomas Tsou 79a1cf3d34 uhd: set receive gain during initialization
This shouldn't matter much, but the gain settings through the
interface are short circuited right now, which makes this a
problem.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2011-05-06 13:34:30 -04:00
Thomas Tsou 0ff69c95ff uhd: set hardware side delay offset for e100
The value is used to align transmit and receive time slots within
a sample. This oscilloscope measured value is close, but may
need minor tweaking.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2011-05-06 13:19:47 -04:00
Thomas Tsou 39f0bcfd18 uhd: log useful information on monotonic errors
Track the current errant and previous timestamp values.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2011-05-06 12:58:41 -04:00
Thomas Tsou b4fa0c4074 uhd: flush initial receive samples
Occasionally, the E100 will have errant timestamps at start
related to previous sessions. Early packets will be thrown
out anyways, so do this explicitly so the timestamps don't
royally fuck up the sample timing.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2011-05-05 12:21:08 -04:00
Thomas Tsou 47faafb525 uhd: one-off code cleanup and evisceration of camel casing
Because I can't take it anymore...

Actually, I've been manually converting names to camel
case before checking in, which was an error prone process
in and of itself.

The interface is unchanged, so nobody should complain.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2011-05-05 12:15:02 -04:00
Thomas Tsou 1c21ffd51b uhd: clean up sample alignment procedure
Utilize start and stop burst flags more effectively to
manage interaction with the FPGA. This makes communication
slightly more explicit, though it is not expected to
have a major effect. Also, lower the alignment messages
to DEBUG, and raise the asynchronous messages to INFO.
In other words, report the underrun, but not the handling
of it.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2011-05-04 23:08:43 -04:00
Thomas Tsou 9de5527574 uhd: enable priority scheduling on receive loop
Though the receive loop ultimately drives the GSM clock,
it does not have any priority because it runs as a
separate thread from the trasmit loop. The transmit
has priority because it starts the UHD device, where
priority scheduling is enabled. The result is frequent
underruns, which occur regardless of buffer size tuning.

To address this, break out and expose the priority
setting so that it can be called from the radioInterface
at the start of a new thread.

Tested on a modest Intel Core 2 Duo tablet running
Linux 2.6.33.7.2-rt30, this reduced underruns down to
near zero.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2011-03-23 11:35:35 -04:00
Thomas Tsou 391b377668 uhd: log timestamp on receive error
Currently, upon receiving an unexpected timestamp, the sample
buffer will error and log its internal state. The errant
timestamp is not logged though. This patch fixes that.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2011-03-21 15:05:08 -04:00
Thomas Tsou a8dd7a370b Revert "uhd: temporary fix for lingering packet bug"
This reverts commit f5e4628f1f.

Fix was moved upstream.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2011-03-09 01:09:59 -05:00
Thomas Tsou f5e4628f1f uhd: temporary fix for lingering packet bug
Certain chipsets (e.g. RTL8168) have issues with the
initial packet of samples at that start of a UHD
receive stream resulting in timestamp errors shortly
after start. This temporary patch forces a receive
during init to clear any lingering errant packets.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2011-02-04 17:07:48 -05:00
Thomas Tsou 5ed92311dc uhd: remove device time read during alignment
Recent UHD firmware for the USRP2/N210 replaces the MicroBlaze
with a slower ZPU in addition to changes to the control
transactions. The effect is less predictable reading of the
current time and Tx/Rx sample mis-alignment following
underruns.

After an underrun, this patch drops potentially stale packets
with a fixed interval instead of relying on reading the
current time from the device.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2011-01-28 13:27:12 -05:00
Thomas Tsou 753118031e Transceiver: move I/Q swap and byteorder to behind device interface
The non-UHD implementation tunes the DDC to output an inverted
spectrum that requires swapping on the host. Push I/Q and byte
swapping into the device implementation and strip the related
bits out of the remaining transceiver code.

This also moves the Transceiver closer to the Transcever52M
version.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2011-01-28 13:26:39 -05:00
Thomas Tsou 2ce9041742 uhd: update to change in uhd metadata interface
Fixes the following build error.

UHDDevice.cpp:462: error: ‘EVENT_CODE_SUCCESS’ is not a member of ‘uhd::async_metadata_t’
UHDDevice.cpp:507: error: ‘EVENT_CODE_SUCCESS’ is not a member of ‘uhd::async_metadata_t’

Reported-by: Dirk Kirsten <Dirk.Kirsten@uni-konstanz.de>
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2010-11-27 18:43:18 -05:00
Thomas Tsou 6e55e19418 uhd: add missing return in device open
Fixes a compile warning; returns true if all is goes well.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2010-11-27 17:58:00 -05:00
Thomas Tsou e9010cb9a0 uhd: fix potential buffer overrun
Fix a bug that might allow a sample buffer write to go a sample too far.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2010-11-27 17:57:06 -05:00
Thomas Tsou aaf378a111 uhd: update to new uhd range api
Fixes the following that occurs with recent uhd changes.

UHDDevice.cpp:260: error: ‘struct uhd::gain_range_t’ has no member named ‘max’
UHDDevice.cpp:260: error: ‘struct uhd::gain_range_t’ has no member named ‘min’

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2010-11-17 01:45:01 -05:00
Thomas Tsou 2735b806dd uhd: add uhd device implementation
This patch adds USRP2 device support and future support for
other UHD based devices. On receive, a sample buffer class,
which is indexable by timestamps, is used to temporarily
hold data until the requested samples are available.

On transmit, samples are sent immediately unless sample
alignment is known to be off - during startup or after the
occurrence of underruns or other errors. To regain
synchronization at these moments, timestamps are compared
against the current device time and dropped unless there
exists significant delay margin to physically arrive at the
device before deadline.

Signed-off-by: Thomas Tsou <ttsou@vt.edu>
2010-11-17 01:44:16 -05:00