@@ -43,12 +43,13 @@ sdrdevice_block_base::sdrdevice_block_base(lime::TRXDir dir,
4343 double sampleRate,
4444 int rf_oversampling,
4545 gr::logger_ptr logger,
46- gr::logger_ptr debug_baselogger )
46+ gr::logger_ptr debug_logger )
4747 : chipIndex(chipIndex),
4848 direction (dir),
4949 autoAntenna(true ),
5050 canWork(false ),
51- baselogger(logger)
51+ baselogger(logger),
52+ debuglogger(debug_logger)
5253{
5354 devManager = sdrdevice_manager::GetSingleton ();
5455 assert (devManager);
@@ -91,20 +92,20 @@ sdrdevice_block_base::sdrdevice_block_base(lime::TRXDir dir,
9192
9293sdrdevice_block_base::~sdrdevice_block_base ()
9394{
94- GR_LOG_DEBUG (baselogger , __func__);
95+ GR_LOG_DEBUG (debuglogger , __func__);
9596 ReleaseResources ();
9697}
9798
9899void sdrdevice_block_base::ReleaseResources ()
99100{
100- GR_LOG_DEBUG (baselogger , __func__);
101+ GR_LOG_DEBUG (debuglogger , __func__);
101102 devContext.reset ();
102103 devManager.reset ();
103104}
104105
105106bool sdrdevice_block_base::start ()
106107{
107- GR_LOG_DEBUG (baselogger , __func__);
108+ GR_LOG_DEBUG (debuglogger , __func__);
108109 assert (devContext);
109110
110111 lime::SDRConfig& config = devContext->deviceConfig ;
@@ -123,26 +124,25 @@ bool sdrdevice_block_base::start()
123124 return true ;
124125 }
125126
126- GR_LOG_DEBUG (baselogger , " SDRDevice Configure()" );
127+ GR_LOG_DEBUG (debuglogger , " SDRDevice Configure()" );
127128 config.skipDefaults = !devContext->customBaseConfigFilepath .empty ();
128129 if (config.skipDefaults &&
129130 devContext->device ->LoadConfig (chipIndex, devContext->customBaseConfigFilepath ) !=
130131 OpStatus::Success) {
131132 const std::string msg = fmt::format (" Failed to load configuration file {:s}" ,
132133 devContext->customBaseConfigFilepath );
133- GR_LOG_ERROR (baselogger, msg);
134+ GR_LOG_CRIT (baselogger, msg);
134135 throw std::runtime_error (msg);
135136 }
136137
137138 if (devContext->device ->Configure (config, chipIndex) != OpStatus::Success) {
138139 const std::string msg = fmt::format (" Failed to configure device. {:s}" ,
139140 lime::GetLastErrorMessageCString ());
140- GR_LOG_ERROR (baselogger, msg);
141+ GR_LOG_CRIT (baselogger, msg);
141142 throw std::runtime_error (msg);
142143 return false ;
143144 }
144145
145- GR_LOG_DEBUG (baselogger, " RFStream Create()" );
146146 devContext->stream =
147147 devContext->device ->StreamCreate (devContext->streamCfg , chipIndex);
148148 if (!devContext->stream )
@@ -151,24 +151,24 @@ bool sdrdevice_block_base::start()
151151 // Start the actual streaming in work(), otherwise multiple devices won't be started
152152 // at the same time
153153 OpStatus status = devContext->stream ->StageStart ();
154- GR_LOG_INFO (baselogger , " Device configured and ready." );
154+ GR_LOG_DEBUG (debuglogger , " Device configured and ready." );
155155 canWork = true ;
156156 return true ;
157157}
158158
159159void sdrdevice_block_base::StartRFStreaming ()
160160{
161161 if (devContext->stream ->Start () != OpStatus::Success) {
162- GR_LOG_ERROR (baselogger , " RFStream Start() Failed" );
162+ GR_LOG_ERROR (debuglogger , " RFStream Start() Failed" );
163163 } else {
164- GR_LOG_INFO (baselogger , " RFStream Start()" );
164+ GR_LOG_DEBUG (debuglogger , " RFStream Start()" );
165165 }
166166}
167167
168168bool sdrdevice_block_base::stop ()
169169{
170170 assert (devContext);
171- GR_LOG_DEBUG (baselogger , __func__);
171+ GR_LOG_DEBUG (debuglogger , __func__);
172172 if (direction == TRXDir::Tx)
173173 devContext->sinkBlockCounter --;
174174 else
@@ -178,7 +178,7 @@ bool sdrdevice_block_base::stop()
178178 (devContext->sourceBlockCounter == 0 && devContext->sinkBlockCounter == 0 );
179179
180180 if (doStop && devContext->stream ) {
181- GR_LOG_DEBUG (baselogger , " RFStream Stop" );
181+ GR_LOG_DEBUG (debuglogger , " RFStream Stop" );
182182 devContext->stream ->Stop ();
183183 devContext->stream ->Teardown ();
184184 devContext->stream .reset ();
@@ -204,10 +204,9 @@ double sdrdevice_block_base::set_lo_frequency(double frequencyHz)
204204 if (!devContext)
205205 return frequencyHz;
206206
207- GR_LOG_INFO (baselogger, fmt::format (" {:s} {:f}" , __func__, frequencyHz));
208-
209207 for (const int ch : devContext->streamCfg .channels .at (direction)) {
210208 if (devContext->stream ) {
209+ GR_LOG_DEBUG (debuglogger, fmt::format (" {:s} {:f}" , __func__, frequencyHz));
211210 devContext->device ->SetFrequency (chipIndex, direction, ch, frequencyHz);
212211 } else {
213212 if (direction == TRXDir::Tx)
@@ -227,9 +226,9 @@ double sdrdevice_block_base::set_lpf_bandwidth(double bandwidthHz)
227226 if (!devContext)
228227 return bandwidthHz;
229228
230- GR_LOG_INFO (baselogger, fmt::format (" {:s} {:f}" , __func__, bandwidthHz));
231229 for (const int ch : devContext->streamCfg .channels .at (direction)) {
232230 if (devContext->stream ) {
231+ GR_LOG_DEBUG (debuglogger, fmt::format (" {:s} {:f}" , __func__, bandwidthHz));
233232 devContext->device ->SetLowPassFilter (chipIndex, direction, ch, bandwidthHz);
234233 } else {
235234 if (direction == TRXDir::Tx)
@@ -247,13 +246,13 @@ double sdrdevice_block_base::set_gfir_bandwidth(double bandwidthHz)
247246 return bandwidthHz;
248247
249248 const bool enableFilter = bandwidthHz > 0 ;
250- GR_LOG_INFO (baselogger,
251- fmt::format (" {:s} {:f} {:s}" ,
252- __func__,
253- bandwidthHz,
254- enableFilter ? " enabled" : " disabled" ));
255249 for (const int ch : devContext->streamCfg .channels .at (direction)) {
256250 if (devContext->stream ) {
251+ GR_LOG_DEBUG (debuglogger,
252+ fmt::format (" {:s} {:f} {:s}" ,
253+ __func__,
254+ bandwidthHz,
255+ enableFilter ? " enabled" : " disabled" ));
257256 ChannelConfig::Direction::GFIRFilter filter;
258257 filter.enabled = enableFilter;
259258 filter.bandwidth = bandwidthHz;
@@ -299,7 +298,6 @@ bool sdrdevice_block_base::set_antenna(const std::string& antenna_name)
299298 if (!devContext)
300299 return false ;
301300
302- GR_LOG_INFO (baselogger, fmt::format (" {:s} {:s}" , __func__, antenna_name));
303301 const auto & antennas =
304302 devContext->device ->GetDescriptor ().rfSOC .at (chipIndex).pathNames .at (direction);
305303 auto antennaFind = antennas.begin ();
@@ -310,6 +308,7 @@ bool sdrdevice_block_base::set_antenna(const std::string& antenna_name)
310308 double freq;
311309 int ch = devContext->streamCfg .channels .at (direction).front ();
312310 if (devContext->stream ) {
311+ GR_LOG_DEBUG (debuglogger, fmt::format (" {:s} {:s}" , __func__, antenna_name));
313312 freq = devContext->device ->GetFrequency (chipIndex, direction, ch);
314313 } else {
315314 if (direction == TRXDir::Tx)
@@ -322,7 +321,8 @@ bool sdrdevice_block_base::set_antenna(const std::string& antenna_name)
322321 antennas,
323322 devContext->device ->GetDescriptor ().rfSOC .at (chipIndex).antennaRange .at (
324323 direction));
325- GR_LOG_INFO (baselogger, fmt::format (" auto selected antenna: {:s}" , bestAntenna));
324+ GR_LOG_DEBUG (debuglogger,
325+ fmt::format (" auto selected antenna: {:s}" , bestAntenna));
326326 antennaFind = std::find (antennas.begin (), antennas.end (), bestAntenna);
327327 } else
328328 antennaFind = std::find (antennas.begin (), antennas.end (), antenna_name);
@@ -332,7 +332,7 @@ bool sdrdevice_block_base::set_antenna(const std::string& antenna_name)
332332 ss << " Antenna " << antenna_name << " not found. Available:" << std::endl;
333333 for (const auto & iter : antennas)
334334 ss << " \t\" " << iter << " \" " << std::endl;
335- GR_LOG_ERROR (baselogger , ss.str ());
335+ GR_LOG_ERROR (debuglogger , ss.str ());
336336 return false ;
337337 }
338338
@@ -362,29 +362,23 @@ double sdrdevice_block_base::set_gain(lime::eGainTypes type, double gain_value)
362362
363363 const std::string gainName = lime::ToString (type);
364364
365- GR_LOG_INFO (baselogger,
366- fmt::format (" {:s} {:s} {:f}" , __func__, gainName, gain_value));
367365 const RFSOCDescriptor& desc = devContext->device ->GetDescriptor ().rfSOC .at (chipIndex);
368366
369367 lime::Range gain_range = desc.gainRange .at (direction).at (type);
370- GR_LOG_INFO (baselogger,
371- fmt::format (" {:s} {:s} gain range: {:f}:{:f}" ,
372- __func__,
373- gainName,
374- gain_range.min ,
375- gain_range.max ));
376368 if (gain_value > gain_range.max ) {
377369 gain_value = gain_range.max ;
378- GR_LOG_WARN (baselogger ,
370+ GR_LOG_WARN (debuglogger ,
379371 fmt::format (" {:s} clip gain to {:f}" , __func__, gain_value));
380372 } else if (gain_value < gain_range.min ) {
381373 gain_value = gain_range.min ;
382- GR_LOG_WARN (baselogger ,
374+ GR_LOG_WARN (debuglogger ,
383375 fmt::format (" {:s} clip gain to {:f}" , __func__, gain_value));
384376 }
385377
386378 for (const int ch : devContext->streamCfg .channels .at (direction)) {
387379 if (devContext->stream ) {
380+ GR_LOG_DEBUG (debuglogger,
381+ fmt::format (" {:s} {:s} {:f}" , __func__, gainName, gain_value));
388382 devContext->device ->SetGain (chipIndex, direction, ch, type, gain_value);
389383 } else {
390384 if (direction == TRXDir::Tx)
@@ -401,12 +395,13 @@ double sdrdevice_block_base::set_nco_frequency(double frequency_offset_Hz)
401395 if (!devContext)
402396 return frequency_offset_Hz;
403397
404- GR_LOG_INFO (baselogger, fmt::format (" {:s} {:f}" , __func__, frequency_offset_Hz));
405398 if (!devContext)
406399 return frequency_offset_Hz;
407400
408401 for (const int ch : devContext->streamCfg .channels .at (direction)) {
409402 if (devContext->stream ) {
403+ GR_LOG_DEBUG (debuglogger,
404+ fmt::format (" {:s} {:f}" , __func__, frequency_offset_Hz));
410405 devContext->device ->SetNCOFrequency (
411406 chipIndex, direction, ch, 0 , frequency_offset_Hz);
412407 } else {
0 commit comments