[MERGED] osmo-trx[master]: Fix whitespace

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Feb 5 22:21:30 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: Fix whitespace
......................................................................


Fix whitespace

Change-Id: Icda84caa998614ce6c15d5118f8c5c1568ba9a79
---
M Transceiver52M/UHDDevice.cpp
M Transceiver52M/USRPDevice.cpp
M Transceiver52M/USRPDevice.h
3 files changed, 47 insertions(+), 48 deletions(-)

Approvals:
  Vadim Yanitskiy: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/Transceiver52M/UHDDevice.cpp b/Transceiver52M/UHDDevice.cpp
index 09317a9..1120299 100644
--- a/Transceiver52M/UHDDevice.cpp
+++ b/Transceiver52M/UHDDevice.cpp
@@ -1,5 +1,5 @@
 /*
- * Device support for Ettus Research UHD driver 
+ * Device support for Ettus Research UHD driver
  *
  * Copyright 2010,2011 Free Software Foundation, Inc.
  * Copyright (C) 2015 Ettus Research LLC
@@ -143,8 +143,8 @@
 public:
 	/** Sample buffer constructor
 	    @param len number of 32-bit samples the buffer should hold
-	    @param rate sample clockrate 
-	    @param timestamp 
+	    @param rate sample clockrate
+	    @param timestamp
 	*/
 	smpl_buf(size_t len, double rate);
 	~smpl_buf();
@@ -172,7 +172,7 @@
 	*/
 	std::string str_status(size_t ts) const;
 
-	/** Formatted error string 
+	/** Formatted error string
 	    @param code an error code
 	    @return a formatted error string
 	*/
@@ -705,7 +705,7 @@
 	for (size_t i = 0; i < rx_buffers.size(); i++)
 		rx_buffers[i] = new smpl_buf(buf_len, rx_rate);
 
-	// Initialize and shadow gain values 
+	// Initialize and shadow gain values
 	init_gains();
 
 	// Print configuration
@@ -926,7 +926,7 @@
 
 		rx_pkt_cnt++;
 
-		// Check for errors 
+		// Check for errors
 		rc = check_rx_md_err(metadata, num_smpls);
 		switch (rc) {
 		case ERROR_UNRECOVERABLE:
diff --git a/Transceiver52M/USRPDevice.cpp b/Transceiver52M/USRPDevice.cpp
index e5be58d..162bb24 100644
--- a/Transceiver52M/USRPDevice.cpp
+++ b/Transceiver52M/USRPDevice.cpp
@@ -27,7 +27,7 @@
 	Compilation Flags
 
 	SWLOOPBACK	compile for software loopback testing
-*/ 
+*/
 
 
 #include <stdint.h>
@@ -80,7 +80,7 @@
   else
     pingOffset = 0;
 
-#ifdef SWLOOPBACK 
+#ifdef SWLOOPBACK
   samplePeriod = 1.0e6/actualSampleRate;
   loopbackBufferSize = 0;
   gettimeofday(&lastReadTime,NULL);
@@ -93,9 +93,9 @@
   writeLock.unlock();
 
   LOG(INFO) << "opening USRP device..";
-#ifndef SWLOOPBACK 
+#ifndef SWLOOPBACK
   string rbf = "std_inband.rbf";
-  //string rbf = "inband_1rxhb_1tx.rbf"; 
+  //string rbf = "inband_1rxhb_1tx.rbf";
   m_uRx.reset();
   if (!skipRx) {
   try {
@@ -144,7 +144,7 @@
 
   if (!skipRx) m_uRx->stop();
   m_uTx->stop();
-  
+
 #endif
 
   switch (dboardConfig) {
@@ -175,19 +175,19 @@
   samplesRead = 0;
   samplesWritten = 0;
   started = false;
-  
+
   return NORMAL;
 }
 
 
 
-bool USRPDevice::start() 
+bool USRPDevice::start()
 {
   LOG(INFO) << "starting USRP...";
-#ifndef SWLOOPBACK 
+#ifndef SWLOOPBACK
   if (!m_uRx && !skipRx) return false;
   if (!m_uTx) return false;
-  
+
   if (!skipRx) m_uRx->stop();
   m_uTx->stop();
 
@@ -217,8 +217,8 @@
   hi32Timestamp = 0;
   isAligned = false;
 
- 
-  if (!skipRx) 
+
+  if (!skipRx)
   started = (m_uRx->start() && m_uTx->start());
   else
   started = m_uTx->start();
@@ -229,14 +229,14 @@
 #endif
 }
 
-bool USRPDevice::stop() 
+bool USRPDevice::stop()
 {
-#ifndef SWLOOPBACK 
+#ifndef SWLOOPBACK
   if (!m_uRx) return false;
   if (!m_uTx) return false;
-  
+
   delete[] currData;
-  
+
   started = !(m_uRx->stop() && m_uTx->stop());
   return !started;
 #else
@@ -257,7 +257,7 @@
 double USRPDevice::maxRxGain()
 {
   return m_dbRx->gain_max();
-} 
+}
 
 double USRPDevice::minRxGain()
 {
@@ -318,23 +318,23 @@
 int USRPDevice::readSamples(std::vector<short *> &bufs, int len, bool *overrun,
                             TIMESTAMP timestamp, bool *underrun, unsigned *RSSI)
 {
-#ifndef SWLOOPBACK 
+#ifndef SWLOOPBACK
   if (!m_uRx)
     return 0;
 
   short *buf = bufs[0];
 
   timestamp += timestampOffset;
-  
+
   if (timestamp + len < timeStart) {
     memset(buf,0,len*2*sizeof(short));
     return len;
   }
 
   if (underrun) *underrun = false;
- 
+
   uint32_t readBuf[2000];
- 
+
   while (1) {
     //guestimate USB read size
     int readLen=0;
@@ -344,7 +344,7 @@
       readLen = 512 * ((int) ceil((float) numSamplesNeeded/126.0));
       if (readLen > 8000) readLen= (8000/512)*512;
     }
-    
+
     // read USRP packets, parse and save A/D data as needed
     readLen = m_uRx->read((void *)readBuf,readLen,overrun);
     for(int pktNum = 0; pktNum < (readLen/512); pktNum++) {
@@ -381,13 +381,13 @@
 	continue;
       }
       if ((word0 >> 28) & 0x04) {
-	if (underrun) *underrun = true; 
+	if (underrun) *underrun = true;
 	LOG(DEBUG) << "UNDERRUN in TRX->USRP interface";
       }
       if (RSSI) *RSSI = (word0 >> 21) & 0x3f;
-      
+
       if (!isAligned) continue;
-      
+
       unsigned cursorStart = pktTimestamp - timeStart + dataStart;
       while (cursorStart*2 > currDataSize) {
 	cursorStart -= currDataSize/2;
@@ -400,17 +400,17 @@
       else {
 	memcpy(data+cursorStart*2,tmpBuf+2,payloadSz);
       }
-      if (pktTimestamp + payloadSz/2/sizeof(short) > timeEnd) 
+      if (pktTimestamp + payloadSz/2/sizeof(short) > timeEnd)
 	timeEnd = pktTimestamp+payloadSz/2/sizeof(short);
 
       LOG(DEBUG) << "timeStart: " << timeStart << ", timeEnd: " << timeEnd << ", pktTimestamp: " << pktTimestamp;
 
-    }	
-  }     
- 
+    }
+  }
+
   // copy desired data to buf
   unsigned bufStart = dataStart+(timestamp-timeStart);
-  if (bufStart + len < currDataSize/2) { 
+  if (bufStart + len < currDataSize/2) {
     LOG(DEBUG) << "bufStart: " << bufStart;
     memcpy(buf,data+bufStart*2,len*2*sizeof(short));
     memset(data+bufStart*2,0,len*2*sizeof(short));
@@ -428,21 +428,21 @@
   timeStart = timestamp + len;
 
   return len;
-  
+
 #else
   if (loopbackBufferSize < 2) return 0;
   int numSamples = 0;
   struct timeval currTime;
   gettimeofday(&currTime,NULL);
-  double timeElapsed = (currTime.tv_sec - lastReadTime.tv_sec)*1.0e6 + 
+  double timeElapsed = (currTime.tv_sec - lastReadTime.tv_sec)*1.0e6 +
     (currTime.tv_usec - lastReadTime.tv_usec);
   if (timeElapsed < samplePeriod) {return 0;}
   int numSamplesToRead = (int) floor(timeElapsed/samplePeriod);
   if (numSamplesToRead < len) return 0;
-  
+
   if (numSamplesToRead > len) numSamplesToRead = len;
   if (numSamplesToRead > loopbackBufferSize/2) {
-    firstRead =false; 
+    firstRead =false;
     numSamplesToRead = loopbackBufferSize/2;
   }
   memcpy(buf,loopbackBuffer,sizeof(short)*2*numSamplesToRead);
@@ -460,7 +460,7 @@
     firstRead = true;
   }
   samplesRead += numSamples;
-  
+
   return numSamples;
 #endif
 }
@@ -471,7 +471,7 @@
 {
   writeLock.lock();
 
-#ifndef SWLOOPBACK 
+#ifndef SWLOOPBACK
   if (!m_uTx)
     return 0;
 
@@ -518,14 +518,14 @@
   memcpy(loopbackBuffer+loopbackBufferSize,buf,sizeof(short)*2*len);
   samplesWritten += retVal;
   loopbackBufferSize += retVal*2;
-   
+
   return retVal;
 #endif
 }
 
-bool USRPDevice::updateAlignment(TIMESTAMP timestamp) 
+bool USRPDevice::updateAlignment(TIMESTAMP timestamp)
 {
-#ifndef SWLOOPBACK 
+#ifndef SWLOOPBACK
   short data[] = {0x00,0x02,0x00,0x00};
   uint32_t *wordPtr = (uint32_t *) data;
   *wordPtr = host_to_usrp_u32(*wordPtr);
@@ -542,7 +542,7 @@
 #endif
 }
 
-#ifndef SWLOOPBACK 
+#ifndef SWLOOPBACK
 bool USRPDevice::setTxFreq(double wFreq, size_t chan)
 {
   usrp_tune_result result;
diff --git a/Transceiver52M/USRPDevice.h b/Transceiver52M/USRPDevice.h
index b560339..3cbf672 100644
--- a/Transceiver52M/USRPDevice.h
+++ b/Transceiver52M/USRPDevice.h
@@ -83,10 +83,10 @@
 
   double rxGain;
 
-#ifdef SWLOOPBACK 
+#ifdef SWLOOPBACK
   short loopbackBuffer[1000000];
   int loopbackBufferSize;
-  double samplePeriod; 
+  double samplePeriod;
 
   struct timeval startTime;
   struct timeval lastReadTime;
@@ -189,4 +189,3 @@
 };
 
 #endif // _USRP_DEVICE_H_
-

-- 
To view, visit https://gerrit.osmocom.org/6274
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Icda84caa998614ce6c15d5118f8c5c1568ba9a79
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>



More information about the gerrit-log mailing list