? bootstrap-mdvh-debian
? gr_usrp.prj
? gr_usrp.pws
Index: src/usrp.py
===================================================================
RCS file: /cvsroot/gnuradio/gr-usrp/src/usrp.py,v
retrieving revision 1.9
diff -u -b -B -r1.9 usrp.py
--- src/usrp.py	11 May 2005 22:28:59 -0000	1.9
+++ src/usrp.py	24 Aug 2005 21:17:23 -0000
@@ -36,6 +36,7 @@
 FPGA_MODE_NORMAL   = usrp1.FPGA_MODE_NORMAL
 FPGA_MODE_LOOPBACK = usrp1.FPGA_MODE_LOOPBACK
 FPGA_MODE_COUNTING = usrp1.FPGA_MODE_COUNTING
+FPGA_MODE_TRUNC_TO_8BIT = usrp1.FPGA_MODE_TRUNC_TO_8BIT
 
 SPI_FMT_xSB_MASK = usrp1.SPI_FMT_xSB_MASK
 SPI_FMT_LSB      = usrp1.SPI_FMT_LSB
Index: src/usrp1.i
===================================================================
RCS file: /cvsroot/gnuradio/gr-usrp/src/usrp1.i,v
retrieving revision 1.18
diff -u -b -B -r1.18 usrp1.i
--- src/usrp1.i	20 Jul 2005 21:54:35 -0000	1.18
+++ src/usrp1.i	24 Aug 2005 21:17:23 -0000
@@ -42,6 +42,7 @@
 %constant int FPGA_MODE_NORMAL   = usrp_standard_rx::FPGA_MODE_NORMAL;
 %constant int FPGA_MODE_LOOPBACK = usrp_standard_rx::FPGA_MODE_LOOPBACK;
 %constant int FPGA_MODE_COUNTING = usrp_standard_rx::FPGA_MODE_COUNTING;
+%constant int FPGA_MODE_TRUNC_TO_8BIT = usrp_standard_rx::FPGA_MODE_TRUNC_TO_8BIT;
 
 // ================================================================
 //			   abstract classes
Index: src/usrp1_source_base.cc
===================================================================
RCS file: /cvsroot/gnuradio/gr-usrp/src/usrp1_source_base.cc,v
retrieving revision 1.15
diff -u -b -B -r1.15 usrp1_source_base.cc
--- src/usrp1_source_base.cc	20 Jul 2005 21:54:35 -0000	1.15
+++ src/usrp1_source_base.cc	24 Aug 2005 21:17:23 -0000
@@ -169,6 +169,18 @@
   return d_usrp->mux ();
 }
 
+int
+usrp1_source_base::bits_per_sample () const
+{
+  return (d_usrp->mode() & usrp_standard_rx::FPGA_MODE_TRUNC_TO_8BIT)?8:16;
+}
+
+int
+usrp1_source_base::bytes_per_sample () const
+{
+  return (d_usrp->mode() & usrp_standard_rx::FPGA_MODE_TRUNC_TO_8BIT)?sizeof(char):sizeof(short);
+}
+
 double
 usrp1_source_base::rx_freq (int channel) const
 {
Index: src/usrp1_source_base.h
===================================================================
RCS file: /cvsroot/gnuradio/gr-usrp/src/usrp1_source_base.h,v
retrieving revision 1.13
diff -u -b -B -r1.13 usrp1_source_base.h
--- src/usrp1_source_base.h	20 Jul 2005 21:54:35 -0000	1.13
+++ src/usrp1_source_base.h	24 Aug 2005 21:17:23 -0000
@@ -162,6 +162,8 @@
   unsigned int decim_rate () const;
   int nchannels () const;
   int mux () const;
+	int bits_per_sample() const;
+	int bytes_per_sample() const;
   double rx_freq (int channel) const;
   int noverruns () const { return d_noverruns; }
 
Index: src/usrp1_source_c.cc
===================================================================
RCS file: /cvsroot/gnuradio/gr-usrp/src/usrp1_source_c.cc,v
retrieving revision 1.5
diff -u -b -B -r1.5 usrp1_source_c.cc
--- src/usrp1_source_c.cc	11 Dec 2004 04:26:55 -0000	1.5
+++ src/usrp1_source_c.cc	24 Aug 2005 21:17:23 -0000
@@ -28,7 +28,8 @@
 #include <gr_io_signature.h>
 #include <usrp_standard.h>
 
-static const int NUSRP_BYTES_PER_ITEM = 2 * sizeof (short);
+//static const int NUSRP_BYTES_PER_ITEM = 2 * sizeof (short);
+static const int NUSRP_SAMPLES_PER_ITEM = 2;
 
 
 usrp1_source_c_sptr
@@ -67,7 +68,7 @@
 int
 usrp1_source_c::ninput_bytes_reqd_for_noutput_items (int noutput_items)
 {
-  return noutput_items * NUSRP_BYTES_PER_ITEM;
+  return noutput_items * NUSRP_SAMPLES_PER_ITEM * bytes_per_sample ();
 }
 
 /*
@@ -84,15 +85,28 @@
 				       int &bytes_read)
 {
   gr_complex *out = &((gr_complex *) output_items[0])[output_index];
-  short *src = (short *) usrp_buffer;
 
+  const int nusrp_bytes_per_item=NUSRP_SAMPLES_PER_ITEM * bytes_per_sample ();
   int nitems = std::min (output_items_available,
-			 usrp_buffer_length / NUSRP_BYTES_PER_ITEM);
+			 usrp_buffer_length / nusrp_bytes_per_item);
 
+  if(bytes_per_sample () == sizeof (short))
+  {
+    short *src = (short *) usrp_buffer;
+    for (int i = 0; i < nitems; i++){
+      out[i] = gr_complex ((float) src[2*i + 0], (float) src[2*i + 1]);
+    }
+  } else if(bytes_per_sample () == sizeof (char))
+  {
+    char *src = (char *) usrp_buffer;
   for (int i = 0; i < nitems; i++){
     out[i] = gr_complex ((float) src[2*i + 0], (float) src[2*i + 1]);
   }
+  } else
+  {
+	  assert((bytes_per_sample () == sizeof (char))||(bytes_per_sample () == sizeof (short)));//bytes_per_sample () Should be 1 or 2
+  }
 
   output_items_produced = nitems;
-  bytes_read = nitems * NUSRP_BYTES_PER_ITEM;
+  bytes_read = nitems * nusrp_bytes_per_item;
 }
Index: src/usrp1_source_s.cc
===================================================================
RCS file: /cvsroot/gnuradio/gr-usrp/src/usrp1_source_s.cc,v
retrieving revision 1.2
diff -u -b -B -r1.2 usrp1_source_s.cc
--- src/usrp1_source_s.cc	11 Dec 2004 04:26:55 -0000	1.2
+++ src/usrp1_source_s.cc	24 Aug 2005 21:17:23 -0000
@@ -28,8 +28,8 @@
 #include <gr_io_signature.h>
 #include <usrp_standard.h>
 
-static const int NUSRP_BYTES_PER_ITEM = 1 * sizeof (short);
-
+//static const int NUSRP_BYTES_PER_ITEM = 1 * sizeof (short);
+static const int NUSRP_SAMPLES_PER_ITEM = 1;
 
 usrp1_source_s_sptr
 usrp1_make_source_s (int which_board, 
@@ -67,7 +68,7 @@
 int
 usrp1_source_s::ninput_bytes_reqd_for_noutput_items (int noutput_items)
 {
-  return noutput_items * NUSRP_BYTES_PER_ITEM;
+  return noutput_items * NUSRP_SAMPLES_PER_ITEM * bytes_per_sample ();
 }
 
 /*
@@ -84,15 +85,27 @@
 				       int &bytes_read)
 {
   short *out = &((short *) output_items[0])[output_index];
-  short *src = (short *) usrp_buffer;
-
+  const int nusrp_bytes_per_item=NUSRP_SAMPLES_PER_ITEM * bytes_per_sample ();
   int nitems = std::min (output_items_available,
-			 usrp_buffer_length / NUSRP_BYTES_PER_ITEM);
+			 usrp_buffer_length / nusrp_bytes_per_item);
 
+  if(bytes_per_sample () == sizeof (short))
+  {
+    short *src = (short *) usrp_buffer;
   for (int i = 0; i < nitems; i++){
     out[i] = src[i];
   }
+  } else if(bytes_per_sample () == sizeof (char))
+  {
+    char *src = (char *) usrp_buffer;
+    for (int i = 0; i < nitems; i++){
+      out[i] = (short)src[i];
+    }
+  } else
+  {
+	  assert((bytes_per_sample () == sizeof (char))||(bytes_per_sample () == sizeof (short)));//bytes_per_sample () Should be 1 or 2
+  }
 
   output_items_produced = nitems;
-  bytes_read = nitems * NUSRP_BYTES_PER_ITEM;
+  bytes_read = nitems * nusrp_bytes_per_item;
 }

