libhackrf: add transfer buffer size access calls

Applications may need to learn the size of the USB transfer buffer
queue, for example to determine how many bytes will be preloaded with
calls to the TX callback.
This commit is contained in:
Michael Ossmann
2022-09-09 16:16:24 -04:00
parent e7b19ef2c2
commit 70a04855ac
2 changed files with 25 additions and 0 deletions

View File

@ -2685,6 +2685,26 @@ int ADDCALL hackrf_start_rx_sweep(
return result;
}
/**
* Get USB transfer buffer size.
* @return size in bytes
*/
size_t ADDCALL hackrf_get_transfer_buffer_size(hackrf_device* device)
{
(void) device;
return TRANSFER_BUFFER_SIZE;
}
/**
* Get the total number of USB transfer buffers.
* @return number of buffers
*/
uint32_t ADDCALL hackrf_get_transfer_queue_depth(hackrf_device* device)
{
(void) device;
return TRANSFER_COUNT;
}
#ifdef __cplusplus
} // __cplusplus defined.
#endif

View File

@ -25,6 +25,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSI
#define __HACKRF_H__
#include <stdint.h>
#include <sys/types.h>
#ifdef _WIN32
#define ADD_EXPORTS
@ -458,6 +459,10 @@ extern ADDAPI int ADDCALL hackrf_start_rx_sweep(
hackrf_sample_block_cb_fn callback,
void* rx_ctx);
extern ADDAPI size_t ADDCALL hackrf_get_transfer_buffer_size(hackrf_device* device);
extern ADDAPI uint32_t ADDCALL hackrf_get_transfer_queue_depth(hackrf_device* device);
#ifdef __cplusplus
} // __cplusplus defined.
#endif