mirror of
https://github.com/RangeNetworks/openbts.git
synced 2025-11-02 12:53:15 +00:00
transceiver, uhd: runtime check for setting master clock rate
Before setting the master clock rate, make sure that the device is capable of being set. For now, assume that devices that operate with default clock rates above 64 MHz, specifically USRP2/N200/N210, cannot be set at 52 MHz. Inform the user that these devices can be used with the compile time option of host based resampling. Signed-off-by: Thomas Tsou <ttsou@vt.edu> git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2697 19bc5d8c-e614-43d4-8b26-e1612bc8e597
This commit is contained in:
@@ -31,6 +31,9 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#define U1_DEFAULT_CLK_RT 64e6
|
||||
#define U2_DEFAULT_CLK_RT 100e6
|
||||
|
||||
/*
|
||||
master_clk_rt - Master clock frequency - ignored if host resampling is
|
||||
enabled
|
||||
@@ -325,6 +328,14 @@ double uhd_device::set_rates(double rate)
|
||||
double actual_rt, actual_clk_rt;
|
||||
|
||||
#ifndef RESAMPLE
|
||||
// Make sure we can set the master clock rate on this device
|
||||
actual_clk_rt = usrp_dev->get_master_clock_rate();
|
||||
if (actual_clk_rt > U1_DEFAULT_CLK_RT) {
|
||||
LOG(ALERT) << "Cannot set clock rate on this device";
|
||||
LOG(ALERT) << "Please compile with host resampling support";
|
||||
return -1.0;
|
||||
}
|
||||
|
||||
// Set master clock rate
|
||||
usrp_dev->set_master_clock_rate(master_clk_rt);
|
||||
actual_clk_rt = usrp_dev->get_master_clock_rate();
|
||||
|
||||
Reference in New Issue
Block a user