| 
									
										
										
										
											2018-09-23 19:56:24 +02:00
										 |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | // Copyright (C) 2018 Edouard Griffiths, F4EXB                                   //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // This program is free software; you can redistribute it and/or modify          //
 | 
					
						
							|  |  |  | // it under the terms of the GNU General Public License as published by          //
 | 
					
						
							|  |  |  | // the Free Software Foundation as version 3 of the License, or                  //
 | 
					
						
							| 
									
										
										
										
											2019-04-11 06:39:30 +02:00
										 |  |  | // (at your option) any later version.                                           //
 | 
					
						
							| 
									
										
										
										
											2018-09-23 19:56:24 +02:00
										 |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // This program is distributed in the hope that it will be useful,               //
 | 
					
						
							|  |  |  | // but WITHOUT ANY WARRANTY; without even the implied warranty of                //
 | 
					
						
							|  |  |  | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                  //
 | 
					
						
							|  |  |  | // GNU General Public License V3 for more details.                               //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // You should have received a copy of the GNU General Public License             //
 | 
					
						
							|  |  |  | // along with this program. If not, see <http://www.gnu.org/licenses/>.          //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef DEVICES_BLADERF2_DEVICEBLADERF2SHARED_H_
 | 
					
						
							|  |  |  | #define DEVICES_BLADERF2_DEVICEBLADERF2SHARED_H_
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-24 08:43:16 +02:00
										 |  |  | #include "util/message.h"
 | 
					
						
							| 
									
										
										
										
											2018-09-23 19:56:24 +02:00
										 |  |  | #include "devicebladerf2.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-25 14:19:57 +02:00
										 |  |  | class BladeRF2Input; | 
					
						
							| 
									
										
										
										
											2018-09-29 05:49:14 +02:00
										 |  |  | class BladeRF2Output; | 
					
						
							| 
									
										
										
										
											2018-09-23 19:56:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * Structure shared by a buddy with other buddies | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | class DEVICES_API DeviceBladeRF2Shared | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2018-11-16 13:44:58 +01:00
										 |  |  |     class DEVICES_API MsgReportBuddyChange : public Message { | 
					
						
							| 
									
										
										
										
											2018-09-24 08:43:16 +02:00
										 |  |  |         MESSAGE_CLASS_DECLARATION | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public: | 
					
						
							| 
									
										
										
										
											2018-09-27 05:17:34 +02:00
										 |  |  |         uint64_t getCenterFrequency() const { return m_centerFrequency; } | 
					
						
							| 
									
										
										
										
											2018-09-30 10:26:53 +02:00
										 |  |  |         int      getLOppmTenths() const { return m_LOppmTenths; } | 
					
						
							| 
									
										
										
										
											2018-09-27 23:38:23 +02:00
										 |  |  |         int      getFcPos() const { return m_fcPos; } | 
					
						
							| 
									
										
										
										
											2018-09-27 05:17:34 +02:00
										 |  |  |         int      getDevSampleRate() const { return m_devSampleRate; } | 
					
						
							|  |  |  |         bool     getRxElseTx() const { return m_rxElseTx; } | 
					
						
							| 
									
										
										
										
											2018-09-24 08:43:16 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-27 05:17:34 +02:00
										 |  |  |         static MsgReportBuddyChange* create( | 
					
						
							|  |  |  |                 uint64_t centerFrequency, | 
					
						
							| 
									
										
										
										
											2018-09-30 10:26:53 +02:00
										 |  |  |                 int LOppmTenths, | 
					
						
							| 
									
										
										
										
											2018-09-27 23:38:23 +02:00
										 |  |  |                 int fcPos, | 
					
						
							| 
									
										
										
										
											2018-09-27 05:17:34 +02:00
										 |  |  |                 int devSampleRate, | 
					
						
							|  |  |  |                 bool rxElseTx) | 
					
						
							| 
									
										
										
										
											2018-09-24 08:43:16 +02:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2018-09-27 05:17:34 +02:00
										 |  |  |             return new MsgReportBuddyChange( | 
					
						
							|  |  |  |                     centerFrequency, | 
					
						
							| 
									
										
										
										
											2018-09-30 10:26:53 +02:00
										 |  |  |                     LOppmTenths, | 
					
						
							| 
									
										
										
										
											2018-09-27 23:38:23 +02:00
										 |  |  |                     fcPos, | 
					
						
							| 
									
										
										
										
											2018-09-27 05:17:34 +02:00
										 |  |  |                     devSampleRate, | 
					
						
							|  |  |  |                     rxElseTx); | 
					
						
							| 
									
										
										
										
											2018-09-24 08:43:16 +02:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     private: | 
					
						
							| 
									
										
										
										
											2018-09-27 05:17:34 +02:00
										 |  |  |         uint64_t m_centerFrequency; //!< Center frequency
 | 
					
						
							| 
									
										
										
										
											2018-09-30 10:26:53 +02:00
										 |  |  |         int  m_LOppmTenths;         //!< LO soft correction in tenths of ppm
 | 
					
						
							| 
									
										
										
										
											2018-09-27 23:38:23 +02:00
										 |  |  |         int  m_fcPos;               //!< Center frequency position
 | 
					
						
							| 
									
										
										
										
											2018-09-27 05:17:34 +02:00
										 |  |  |         int  m_devSampleRate;       //!< device/host sample rate
 | 
					
						
							| 
									
										
										
										
											2018-09-24 17:32:40 +02:00
										 |  |  |         bool m_rxElseTx;            //!< tells which side initiated the message
 | 
					
						
							| 
									
										
										
										
											2018-09-24 08:43:16 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-27 05:17:34 +02:00
										 |  |  |         MsgReportBuddyChange( | 
					
						
							|  |  |  |                 uint64_t centerFrequency, | 
					
						
							| 
									
										
										
										
											2018-09-30 10:26:53 +02:00
										 |  |  |                 int LOppmTenths, | 
					
						
							| 
									
										
										
										
											2018-09-27 23:38:23 +02:00
										 |  |  |                 int fcPos, | 
					
						
							| 
									
										
										
										
											2018-09-27 05:17:34 +02:00
										 |  |  |                 int devSampleRate, | 
					
						
							|  |  |  |                 bool rxElseTx) : | 
					
						
							| 
									
										
										
										
											2018-09-24 08:43:16 +02:00
										 |  |  |             Message(), | 
					
						
							| 
									
										
										
										
											2018-09-27 05:17:34 +02:00
										 |  |  |             m_centerFrequency(centerFrequency), | 
					
						
							| 
									
										
										
										
											2018-09-30 10:26:53 +02:00
										 |  |  |             m_LOppmTenths(LOppmTenths), | 
					
						
							| 
									
										
										
										
											2018-09-27 23:38:23 +02:00
										 |  |  |             m_fcPos(fcPos), | 
					
						
							| 
									
										
										
										
											2018-09-27 05:17:34 +02:00
										 |  |  |             m_devSampleRate(devSampleRate), | 
					
						
							| 
									
										
										
										
											2018-09-24 08:43:16 +02:00
										 |  |  |             m_rxElseTx(rxElseTx) | 
					
						
							|  |  |  |         { } | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-23 19:56:24 +02:00
										 |  |  |     DeviceBladeRF2Shared(); | 
					
						
							|  |  |  |     ~DeviceBladeRF2Shared(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     DeviceBladeRF2 *m_dev; | 
					
						
							|  |  |  |     int m_channel; //!< allocated channel (-1 if none)
 | 
					
						
							| 
									
										
										
										
											2018-09-25 14:19:57 +02:00
										 |  |  |     BladeRF2Input *m_source; | 
					
						
							| 
									
										
										
										
											2018-09-29 05:49:14 +02:00
										 |  |  |     BladeRF2Output *m_sink; | 
					
						
							| 
									
										
										
										
											2018-09-29 21:40:22 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-15 01:04:24 +01:00
										 |  |  |     static const unsigned int m_sampleFifoMinRate; | 
					
						
							| 
									
										
										
										
											2018-09-23 19:56:24 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif /* DEVICES_BLADERF2_DEVICEBLADERF2SHARED_H_ */
 |