bladeRF: Default num_transfers to min(32, num_buffers/2)
This avoids inadvertently attempting to use a larger number of transfers than the underlying USB library/interface allows by specifying a large value for num_buffers. Users can specify up to (num_buffers - 1) transfers. However, it is generally recommended to use half as many transfers as buffers.
This commit is contained in:
parent
23b1b9cdb1
commit
7f82d289a6
|
@ -403,10 +403,18 @@ void bladerf_common::init(dict_t &dict, bladerf_module module)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If the user hasn't specified the desired number of transfers, set it to
|
||||||
|
* min(32, num_buffers / 2) */
|
||||||
if (_num_transfers == 0 || _num_transfers > (_num_buffers / 2)) {
|
if (_num_transfers == 0) {
|
||||||
_num_transfers = _num_buffers / 2;
|
_num_transfers = _num_buffers / 2;
|
||||||
|
if (_num_transfers > 32) {
|
||||||
|
_num_transfers = 32;
|
||||||
|
}
|
||||||
|
} else if (_num_transfers >= _num_buffers) {
|
||||||
|
_num_transfers = _num_buffers - 1;
|
||||||
|
std::cerr << _pfx << "Clamping num_tranfers to " << _num_transfers << ". "
|
||||||
|
<< "Try using a smaller num_transfers value if timeouts occur."
|
||||||
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
_conv_buf = static_cast<int16_t*>(malloc(_conv_buf_size * 2 * sizeof(int16_t)));
|
_conv_buf = static_cast<int16_t*>(malloc(_conv_buf_size * 2 * sizeof(int16_t)));
|
||||||
|
|
Loading…
Reference in New Issue