commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r6146 - gnuradio/trunk/usrp/host/lib/legacy


From: michaelld
Subject: [Commit-gnuradio] r6146 - gnuradio/trunk/usrp/host/lib/legacy
Date: Thu, 16 Aug 2007 21:23:02 -0600 (MDT)

Author: michaelld
Date: 2007-08-16 21:23:02 -0600 (Thu, 16 Aug 2007)
New Revision: 6146

Modified:
   gnuradio/trunk/usrp/host/lib/legacy/circular_buffer.h
Log:
Updated USRP's circular_buffer with the same corrections as for
gr-audio-osx.  These corrections impact OSX/Darwin only.



Modified: gnuradio/trunk/usrp/host/lib/legacy/circular_buffer.h
===================================================================
--- gnuradio/trunk/usrp/host/lib/legacy/circular_buffer.h       2007-08-17 
03:18:37 UTC (rev 6145)
+++ gnuradio/trunk/usrp/host/lib/legacy/circular_buffer.h       2007-08-17 
03:23:02 UTC (rev 6146)
@@ -138,8 +138,9 @@
 
   int enqueue (T* buf, UInt32 bufLen_I) {
 #if DO_DEBUG
-    fprintf (stderr, "enqueue: buf = %X, bufLen = %ld.\n",
-            (unsigned int)buf, bufLen_I);
+    fprintf (stderr, "enqueue: buf = %X, bufLen = %ld, #av_wr = %ld, "
+            "#av_rd = %ld.\n", (unsigned int)buf, bufLen_I,
+            d_n_avail_write_I, d_n_avail_read_I);
 #endif
     if (bufLen_I > d_bufLen_I) {
       fprintf (stderr, "cannot add buffer longer (%ld"
@@ -158,6 +159,8 @@
       d_internal->unlock ();
       return (2);
     }
+    // set the return value to 1: success; change if needed
+    int retval = 1;
     if (bufLen_I > d_n_avail_write_I) {
       if (d_doWriteBlock) {
        while (bufLen_I > d_n_avail_write_I) {
@@ -184,7 +187,7 @@
 #if DO_DEBUG
        fprintf (stderr, "circular_buffer::enqueue: overflow\n");
 #endif
-       return (-1);
+       retval = -1;
       }
     }
     UInt32 n_now_I = d_bufLen_I - d_writeNdx_I, n_start_I = 0;
@@ -202,7 +205,7 @@
     d_n_avail_write_I -= bufLen_I;
     d_readBlock->signal ();
     d_internal->unlock ();
-    return (1);
+    return (retval);
   };
 
 /*
@@ -226,11 +229,11 @@
  *     buffer length is larger than the instantiated buffer length
  */
 
-
   int dequeue (T* buf, UInt32* bufLen_I) {
 #if DO_DEBUG
-    fprintf (stderr, "dequeue: buf = %X, *bufLen = %ld.\n",
-            (unsigned int)buf, *bufLen_I);
+    fprintf (stderr, "dequeue: buf = %X, *bufLen = %ld, #av_wr = %ld, "
+            "#av_rd = %ld.\n", (unsigned int)buf, *bufLen_I,
+            d_n_avail_write_I, d_n_avail_read_I);
 #endif
     if (!bufLen_I)
       throw std::runtime_error ("circular_buffer::dequeue(): "





reply via email to

[Prev in Thread] Current Thread [Next in Thread]