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 ();
#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)
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;
#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)
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;
#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)
return MAX_BLOCK_SIZE;
}
+int fusb_sysconfig::default_block_size ()
+{
+ return DEFAULT_BLOCK_SIZE;
+}
+
int fusb_sysconfig::default_buffer_size ()
{
return FUSB_BUFFER_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;
#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)
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;
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);