mirror of
https://github.com/RangeNetworks/openbts.git
synced 2025-10-24 08:33:44 +00:00
Transceiver52M: Set resampling option automatically based on device
Remove the built time resampling selection and link both options. Move the normal push/pullBuffer() calls back to the base class and overload them in the inherited resampling class. USRP2/N2xx devices are the only devices that require resampling so return that resampling is necessary on the device open(), which is the point at which the device type will be known. The GSM transceiver only operates at a whole number multiple of the GSM rate and doesn't care about the actual device rate and if resampling is used. Therefore GSM specific portion of the transceiver should only need to submit the samples-per-symbol value to the device interface. Then, the device should be able to determine the appropriate sample rate (400 ksps or 270.833 ksps) and if resampling is appropriate. Signed-off-by: Thomas Tsou <tom@tsou.cc> git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@6723 19bc5d8c-e614-43d4-8b26-e1612bc8e597
This commit is contained in:
@@ -59,11 +59,11 @@ const dboardConfigType dboardConfig = TXA_RXB;
|
||||
|
||||
const double USRPDevice::masterClockRate = 52.0e6;
|
||||
|
||||
USRPDevice::USRPDevice (double _desiredSampleRate, bool skipRx)
|
||||
USRPDevice::USRPDevice(int sps, bool skipRx)
|
||||
: skipRx(skipRx)
|
||||
{
|
||||
LOG(INFO) << "creating USRP device...";
|
||||
decimRate = (unsigned int) round(masterClockRate/_desiredSampleRate);
|
||||
decimRate = (unsigned int) round(masterClockRate/((GSMRATE) * (double) sps));
|
||||
actualSampleRate = masterClockRate/decimRate;
|
||||
rxGain = 0;
|
||||
|
||||
@@ -75,7 +75,7 @@ USRPDevice::USRPDevice (double _desiredSampleRate, bool skipRx)
|
||||
#endif
|
||||
}
|
||||
|
||||
bool USRPDevice::open(const std::string &)
|
||||
int USRPDevice::open(const std::string &)
|
||||
{
|
||||
writeLock.unlock();
|
||||
|
||||
@@ -97,7 +97,7 @@ bool USRPDevice::open(const std::string &)
|
||||
catch(...) {
|
||||
LOG(ALERT) << "make failed on Rx";
|
||||
m_uRx.reset();
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (m_uRx->fpga_master_clock_freq() != masterClockRate)
|
||||
@@ -105,7 +105,7 @@ bool USRPDevice::open(const std::string &)
|
||||
LOG(ALERT) << "WRONG FPGA clock freq = " << m_uRx->fpga_master_clock_freq()
|
||||
<< ", desired clock freq = " << masterClockRate;
|
||||
m_uRx.reset();
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ bool USRPDevice::open(const std::string &)
|
||||
catch(...) {
|
||||
LOG(ALERT) << "make failed on Tx";
|
||||
m_uTx.reset();
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (m_uTx->fpga_master_clock_freq() != masterClockRate)
|
||||
@@ -128,7 +128,7 @@ bool USRPDevice::open(const std::string &)
|
||||
LOG(ALERT) << "WRONG FPGA clock freq = " << m_uTx->fpga_master_clock_freq()
|
||||
<< ", desired clock freq = " << masterClockRate;
|
||||
m_uTx.reset();
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!skipRx) m_uRx->stop();
|
||||
@@ -165,7 +165,7 @@ bool USRPDevice::open(const std::string &)
|
||||
samplesWritten = 0;
|
||||
started = false;
|
||||
|
||||
return true;
|
||||
return NORMAL;
|
||||
}
|
||||
|
||||
|
||||
@@ -556,7 +556,7 @@ bool USRPDevice::setTxFreq(double wFreq) { return true;};
|
||||
bool USRPDevice::setRxFreq(double wFreq) { return true;};
|
||||
#endif
|
||||
|
||||
RadioDevice *RadioDevice::make(double desiredSampleRate, bool skipRx)
|
||||
RadioDevice *RadioDevice::make(int sps, bool skipRx)
|
||||
{
|
||||
return new USRPDevice(desiredSampleRate, skipRx);
|
||||
return new USRPDevice(sps, skipRx);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user