libbladeRF
2.5.0
Nuand bladeRF library
|
The functions in this section provide the ability query and inspect available devices, initialize them, and deinitialize them.
See the Device configuration boilerplate page for an overview on how to open and configure a device.
These functions are thread-safe.
Data Structures | |
struct | bladerf_devinfo |
struct | bladerf_backendinfo |
Enumerations | |
enum | bladerf_backend { BLADERF_BACKEND_ANY , BLADERF_BACKEND_LINUX , BLADERF_BACKEND_LIBUSB , BLADERF_BACKEND_CYPRESS , BLADERF_BACKEND_DUMMY = 100 } |
Macros | |
#define | BLADERF_DESCRIPTION_LENGTH 33 |
#define | BLADERF_SERIAL_LENGTH 33 |
enum bladerf_backend |
Backend by which the host communicates with the device
Definition at line 112 of file libbladeRF.h.
#define BLADERF_DESCRIPTION_LENGTH 33 |
Length of device description string, including NUL-terminator
Definition at line 122 of file libbladeRF.h.
#define BLADERF_SERIAL_LENGTH 33 |
Length of device serial number string, including NUL-terminator
Definition at line 125 of file libbladeRF.h.
API_EXPORT const char* CALL_CONV bladerf_backend_str | ( | bladerf_backend | backend | ) |
Retrieve the backend string associated with the specified backend enumeration value.
backend
portion of a device identifier string. (See bladerf_open().) API_EXPORT void CALL_CONV bladerf_close | ( | struct bladerf * | device | ) |
Close device
device
is deallocated and may no longer be used.device | Device handle previously obtained by bladerf_open(). This function does nothing if device is NULL. |
API_EXPORT bool CALL_CONV bladerf_devinfo_matches | ( | const struct bladerf_devinfo * | a, |
const struct bladerf_devinfo * | b | ||
) |
Test whether two device identifier information structures match, taking wildcard values into account.
[in] | a | the first bladerf_devinfo struct |
[in] | b | the second bladerf_devinfo struct |
API_EXPORT bool CALL_CONV bladerf_devstr_matches | ( | const char * | dev_str, |
struct bladerf_devinfo * | info | ||
) |
Test whether a provided device string matches a device described by the provided bladerf_devinfo structure
[in] | dev_str | Devices string, formated as described in the the documentation of bladerf_open |
[in] | info | Device info to compare with |
API_EXPORT void CALL_CONV bladerf_free_device_list | ( | struct bladerf_devinfo * | devices | ) |
Free device list returned by bladerf_get_device_list()
[in,out] | devices | List of available devices |
API_EXPORT int CALL_CONV bladerf_get_backendinfo | ( | struct bladerf * | dev, |
struct bladerf_backendinfo * | info | ||
) |
Fill out a provided bladerf_backendinfo structure, given an open device handle.
dev
must be a valid device handle.dev | Device handle previously obtained with bladerf_open() | |
[out] | info | Backend information populated by this function |
API_EXPORT int CALL_CONV bladerf_get_device_list | ( | struct bladerf_devinfo ** | devices | ) |
Obtain a list of bladeRF devices attached to the system
[out] | devices |
API_EXPORT int CALL_CONV bladerf_get_devinfo | ( | struct bladerf * | dev, |
struct bladerf_devinfo * | info | ||
) |
Fill out a provided bladerf_devinfo structure, given an open device handle.
dev
must be a valid device handle.dev | Device handle previously obtained with bladerf_open() | |
[out] | info | Device information populated by this function |
API_EXPORT int CALL_CONV bladerf_get_devinfo_from_str | ( | const char * | devstr, |
struct bladerf_devinfo * | info | ||
) |
Populate a device identifier information structure using the provided device identifier string.
[in] | devstr | Device identifier string, formated as described in the bladerf_open() documentation |
[out] | info | Upon success, this will be filled out according to the provided device identifier string, with wildcards for any fields that were not provided. |
API_EXPORT void CALL_CONV bladerf_init_devinfo | ( | struct bladerf_devinfo * | info | ) |
Initialize a device identifier information structure to a "wildcard" state.
The values in each field will match any value for that field.
API_EXPORT int CALL_CONV bladerf_open | ( | struct bladerf ** | device, |
const char * | device_identifier | ||
) |
Open specified device using a device identifier string. See bladerf_open_with_devinfo() if a device identifier string is not readily available.
The general form of the device identifier string is;
An empty ("") or NULL device identifier will result in the first encountered device being opened (using the first discovered backend)
The 'backend' describes the mechanism used to communicate with the device, and may be one of the following:
If no arguments are provided after the backend, the first encountered device on the specified backend will be opened. Note that a backend is required, if any arguments are to be provided.
Next, any provided arguments are provide as used to find the desired device. Be sure not to over constrain the search. Generally, only one of the above is required – providing all of these may over constrain the search for the desired device (e.g., if a serial number matches, but not on the specified bus and address.)
Below is an example of how to open a device with a specific serial number, using any avaiable backend supported by libbladeRF:
[out] | device | Update with device handle on success |
[in] | device_identifier | Device identifier, formatted as described above |
API_EXPORT int CALL_CONV bladerf_open_with_devinfo | ( | struct bladerf ** | device, |
struct bladerf_devinfo * | devinfo | ||
) |
Opens device specified by provided bladerf_devinfo structure
This function is generally preferred over bladerf_open() when a device identifier string is not already provided.
The most common uses of this function are to:
Below is an example of how to use this function to open a device with a specific serial number:
[out] | device | Update with device handle on success |
[in] | devinfo | Device specification. If NULL, any available device will be opened. |
API_EXPORT void CALL_CONV bladerf_set_usb_reset_on_open | ( | bool | enabled | ) |
Enable or disable USB device reset operation upon opening a device for future bladerf_open() and bladerf_open_with_devinfo() calls.
This operation has been found to be necessary on Linux-based systems for some USB 3.0 controllers on Linux.
This does not reset the state of the device in terms of its frequency, gain, sample rate, etc. settings.
[in] | enabled | Set true to enable the use of the USB device reset, and false otherwise. |