laforge
/
openbts-osmo
Archived
1
0
Fork 0

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>
This commit is contained in:
Thomas Tsou 2011-04-14 14:45:40 -04:00
parent baffdf3e65
commit 1c21ffd51b
1 changed files with 13 additions and 7 deletions

View File

@ -405,7 +405,7 @@ int UHDDevice::writeSamples(short *buf, int len, bool *underrun,
uhd::tx_metadata_t metadata;
metadata.has_time_spec = true;
metadata.start_of_burst = true;
metadata.start_of_burst = false;
metadata.end_of_burst = false;
metadata.time_spec =
SampleBuffer::convertTime(timestamp, actualSampleRate);
@ -413,14 +413,20 @@ int UHDDevice::writeSamples(short *buf, int len, bool *underrun,
// Drop a fixed number of packets (magic value)
if (!aligned) {
dropCount++;
if (dropCount < 30) {
LOG(DEBUG) << "Realigning transmitter";
if (dropCount == 1) {
LOG(DEBUG) << "Aligning transmitter: stop burst";
metadata.end_of_burst = true;
} else if (dropCount < 30) {
LOG(DEEPDEBUG) << "Aligning transmitter: packet advance";
*underrun = true;
return len;
} else {
LOG(DEBUG) << "Aligning transmitter: start burst";
metadata.start_of_burst = true;
aligned = true;
dropCount = 0;
}
aligned = true;
dropCount = 0;
}
size_t samplesSent = usrpDevice->get_device()->send(buf,
@ -466,7 +472,7 @@ bool UHDDevice::recvAsyncMesg()
// Assume that any error requires resynchronization
if (metadata.event_code != uhd::async_metadata_t::EVENT_CODE_BURST_ACK) {
aligned = false;
LOG(DEBUG) << stringCode(metadata);
LOG(INFO) << stringCode(metadata);
}
return true;