mirror of
				https://github.com/RangeNetworks/openbts.git
				synced 2025-10-31 03:43:33 +00:00 
			
		
		
		
	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> git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2663 19bc5d8c-e614-43d4-8b26-e1612bc8e597
This commit is contained in:
		| @@ -292,22 +292,32 @@ void uhd_device::set_ref_clk(bool ext_clk) | ||||
|  | ||||
| double uhd_device::set_rates(double rate) | ||||
| { | ||||
| 	double actual_rate; | ||||
| 	double actual_rt, actual_clk_rt; | ||||
|  | ||||
| 	// Set master clock rate | ||||
| 	usrp_dev->set_master_clock_rate(master_clk_rt); | ||||
| 	actual_clk_rt = usrp_dev->get_master_clock_rate(); | ||||
|  | ||||
| 	if (actual_clk_rt != master_clk_rt) { | ||||
| 		LOG(ERROR) << "Failed to set master clock rate"; | ||||
| 		return -1.0; | ||||
| 	} | ||||
|  | ||||
| 	// Set sample rates | ||||
| 	usrp_dev->set_tx_rate(rate); | ||||
| 	usrp_dev->set_rx_rate(rate); | ||||
| 	actual_rate = usrp_dev->get_tx_rate(); | ||||
| 	actual_rt = usrp_dev->get_tx_rate(); | ||||
|  | ||||
| 	if (actual_rate != rate) { | ||||
| 	if (actual_rt != rate) { | ||||
| 		LOG(ERROR) << "Actual sample rate differs from desired rate"; | ||||
| 		return -1.0; | ||||
| 	} | ||||
| 	if (usrp_dev->get_rx_rate() != actual_rate) { | ||||
| 	if (usrp_dev->get_rx_rate() != actual_rt) { | ||||
| 		LOG(ERROR) << "Transmit and receive sample rates do not match"; | ||||
| 		return -1.0; | ||||
| 	} | ||||
|  | ||||
| 	return actual_rate; | ||||
| 	return actual_rt; | ||||
| } | ||||
|  | ||||
| double uhd_device::setTxGain(double db) | ||||
| @@ -345,9 +355,6 @@ bool uhd_device::open() | ||||
| 		return false; | ||||
| 	} | ||||
|  | ||||
| 	// Set master clock rate | ||||
| 	usrp_dev->set_master_clock_rate(master_clk_rt); | ||||
|  | ||||
| 	// Number of samples per over-the-wire packet | ||||
| 	tx_spp = usrp_dev->get_device()->get_max_send_samps_per_packet(); | ||||
| 	rx_spp = usrp_dev->get_device()->get_max_recv_samps_per_packet(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user