Added fusb_sysconfig::default_block_size (<= max_block_size).
authoreb <eb@221aa14e-8319-0410-a670-987f0aec2ac5>
Mon, 7 May 2007 21:36:54 +0000 (21:36 +0000)
committereb <eb@221aa14e-8319-0410-a670-987f0aec2ac5>
Mon, 7 May 2007 21:36:54 +0000 (21:36 +0000)
Changed Linux default_block_size to 4KB, and default buffersize to 1MB.

git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@5253 221aa14e-8319-0410-a670-987f0aec2ac5

usrp/host/lib/legacy/fusb.h
usrp/host/lib/legacy/fusb_sysconfig_darwin.cc
usrp/host/lib/legacy/fusb_sysconfig_generic.cc
usrp/host/lib/legacy/fusb_sysconfig_linux.cc
usrp/host/lib/legacy/fusb_sysconfig_ra_wb.cc
usrp/host/lib/legacy/fusb_sysconfig_win32.cc
usrp/host/lib/legacy/usrp_basic.cc

index da1b7c0adce1c60004fa1053982c20bdbde29ad4..8116ed0563683e2750b0c8450f3b7b9fd777ca89 100644 (file)
@@ -119,12 +119,17 @@ public:
   static fusb_devhandle *make_devhandle (usb_dev_handle *udh);
 
   /*!
-   * \brief returns max block size hard limit
+   * \brief Returns max block size in bytes (hard limit).
    */
   static int max_block_size ();
 
   /*!
-   * \brief returns the default buffer size
+   * \brief Returns default block size in bytes.
+   */
+  static int default_block_size ();
+
+  /*!
+   * \brief Returns the default buffer size in bytes.
    */
   static int default_buffer_size ();
 
index f66c298dbe718deba590d43846e790bce9062680..54d0084376fee2c032b2691dd07fe73ae0baceb8 100644 (file)
@@ -24,7 +24,7 @@
 #include <fusb_darwin.h>
 
 static const int MAX_BLOCK_SIZE = 32 * 1024;           // hard limit
-static const int FUSB_BUFFER_SIZE = 2 * (1L << 20);    // 2 MB (was 8 MB)
+static const int FUSB_BUFFER_SIZE = 2 * (1L << 20);    // 2 MB
 
 fusb_devhandle *
 fusb_sysconfig::make_devhandle (usb_dev_handle *udh)
@@ -37,6 +37,11 @@ int fusb_sysconfig::max_block_size ()
   return MAX_BLOCK_SIZE;
 }
 
+int fusb_sysconfig::default_block_size ()
+{
+  return fusb_sysconfig::max_block_size ();
+}
+
 int fusb_sysconfig::default_buffer_size ()
 {
   return FUSB_BUFFER_SIZE;
index d336cb946c0ba20d205d9af6aa06c00c56756763..31022c14f4ef49476bd454ae3ce2886778f50f50 100644 (file)
@@ -24,7 +24,7 @@
 #include <fusb_generic.h>
 
 static const int MAX_BLOCK_SIZE = 16 * 1024;           // hard limit
-static const int FUSB_BUFFER_SIZE = 2 * (1L << 20);    // 2 MB (was 8 MB)
+static const int FUSB_BUFFER_SIZE = 2 * (1L << 20);    // 2 MB
 
 fusb_devhandle *
 fusb_sysconfig::make_devhandle (usb_dev_handle *udh)
@@ -37,6 +37,11 @@ int fusb_sysconfig::max_block_size ()
   return MAX_BLOCK_SIZE;
 }
 
+int fusb_sysconfig::default_block_size ()
+{
+  return fusb_sysconfig::max_block_size ();
+}
+
 int fusb_sysconfig::default_buffer_size ()
 {
   return FUSB_BUFFER_SIZE;
index 468fa9f829d0cf2469ed50a009225145eec8ab20..e5dc1f4573dfb4c943246644349c8a1f766df9c0 100644 (file)
@@ -23,8 +23,9 @@
 #include <fusb.h>
 #include <fusb_linux.h>
 
-static const int MAX_BLOCK_SIZE = 16 * 1024;           // hard limit
-static const int FUSB_BUFFER_SIZE = 2 * (1L << 20);    // 2 MB (was 8 MB)
+static const int MAX_BLOCK_SIZE     =  16 * 1024;      // hard limit
+static const int DEFAULT_BLOCK_SIZE =   4 * 1024;      // fewer kernel memory problems
+static const int FUSB_BUFFER_SIZE   =   1 * (1L << 20); // 1MB
 
 fusb_devhandle *
 fusb_sysconfig::make_devhandle (usb_dev_handle *udh)
@@ -37,6 +38,11 @@ int fusb_sysconfig::max_block_size ()
   return MAX_BLOCK_SIZE;
 }
 
+int fusb_sysconfig::default_block_size ()
+{
+  return DEFAULT_BLOCK_SIZE;
+}
+
 int fusb_sysconfig::default_buffer_size ()
 {
   return FUSB_BUFFER_SIZE;
index 68eecedc5972c60ecf954616f558ce1f580e05ea..c5ea7fff3f69d33c0b9525516af2b5265eb3da39 100644 (file)
@@ -41,6 +41,11 @@ int fusb_sysconfig::max_block_size ()
   return MAX_BLOCK_SIZE;
 }
 
+int fusb_sysconfig::default_block_size ()
+{
+  return fusb_sysconfig::max_block_size ();
+}
+
 int fusb_sysconfig::default_buffer_size ()
 {
   return FUSB_BUFFER_SIZE;
index 282e77ac4c67fe8c7f2534e7a1ae439dbec9ce32..02a3bf2094b62d6657986766119e55c721a39049 100644 (file)
@@ -24,7 +24,7 @@
 #include <fusb_win32.h>
 
 static const int MAX_BLOCK_SIZE = 64 * 1024;           // Windows kernel hard limit
-static const int FUSB_BUFFER_SIZE = 2 * (1L << 20);    // 2 MB (was 8 MB)
+static const int FUSB_BUFFER_SIZE = 2 * (1L << 20);    // 2 MB
        
 fusb_devhandle *
 fusb_sysconfig::make_devhandle (usb_dev_handle *udh)
@@ -37,6 +37,11 @@ int fusb_sysconfig::max_block_size ()
   return MAX_BLOCK_SIZE;
 }
 
+int fusb_sysconfig::default_block_size ()
+{
+  return fusb_sysconfig::max_block_size ();
+}
+
 int fusb_sysconfig::default_buffer_size ()
 {
   return FUSB_BUFFER_SIZE;
index 2eef14727701fd6905df67e1b4ee406d1ebb56d8..0ac9e052a14efc0e8b41033a82bfb41d071267dd 100644 (file)
@@ -475,7 +475,7 @@ usrp_basic_rx::usrp_basic_rx (int which_board, int fusb_block_size, int fusb_nbl
     throw std::out_of_range ("usrp_basic_rx: invalid fusb_nblocks");
   
   if (fusb_block_size == 0)
-    fusb_block_size = FUSB_BLOCK_SIZE;
+    fusb_block_size = fusb_sysconfig::default_block_size();
 
   if (fusb_nblocks == 0)
     fusb_nblocks = std::max (1, FUSB_BUFFER_SIZE / fusb_block_size);