![]() |
libbladeRF 2.6.0-git
Nuand bladeRF library
|
These functions are thread-safe.
Data Structures | |
struct | bladerf_gain_cal_entry |
Individual gain calibration entry. Each entry associates a frequency with a corresponding gain correction factor. More... | |
struct | bladerf_gain_cal_tbl |
Gain calibration table. The table contains a series of entries, each associating a frequency with a gain correction factor. Entries are sorted by frequency, from start_freq to stop_freq. More... |
Functions | |
API_EXPORT int CALL_CONV | bladerf_load_gain_calibration (struct bladerf *dev, bladerf_channel ch, const char *cal_file_loc) |
Loads and applies gain calibration for a specified channel from a file. | |
API_EXPORT int CALL_CONV | bladerf_print_gain_calibration (struct bladerf *dev, bladerf_channel ch, bool with_entries) |
Displays gain calibration details for a specified channel. | |
API_EXPORT int CALL_CONV | bladerf_enable_gain_calibration (struct bladerf *dev, bladerf_channel ch, bool en) |
Toggles gain calibration for a specified channel. | |
API_EXPORT int CALL_CONV | bladerf_get_gain_calibration (struct bladerf *dev, bladerf_channel ch, const struct bladerf_gain_cal_tbl **tbl) |
Provides read-only access to a channel's gain calibration table. | |
API_EXPORT int CALL_CONV | bladerf_get_gain_target (struct bladerf *dev, bladerf_channel ch, int *gain_target) |
Computes the gain target for a specified channel, incorporating calibration corrections. |
API_EXPORT int CALL_CONV bladerf_enable_gain_calibration | ( | struct bladerf * | dev, |
bladerf_channel | ch, | ||
bool | en ) |
Toggles gain calibration for a specified channel.
Enables or disables automatic gain adjustment based on a preloaded calibration table for the specified channel. This operation is thread-safe.
[in] | dev | Non-NULL pointer to the bladeRF device. |
[in] | ch | Channel (BLADERF_CHANNEL_RX(0), BLADERF_CHANNEL_TX(0), etc.) to set gain calibration for. |
[in] | en | true to enable or false to disable gain calibration. |
API_EXPORT int CALL_CONV bladerf_get_gain_calibration | ( | struct bladerf * | dev, |
bladerf_channel | ch, | ||
const struct bladerf_gain_cal_tbl ** | tbl ) |
Provides read-only access to a channel's gain calibration table.
Returns a read-only pointer to a specified channel's gain calibration table, preventing modification. Access is thread-safe, protected by device mutexes.
[in] | dev | Non-NULL pointer to a BladeRF device structure. |
[in] | ch | Channel to retrieve the gain calibration table for. |
[out] | tbl | On success, updated to point to the read-only gain calibration table. |
API_EXPORT int CALL_CONV bladerf_get_gain_target | ( | struct bladerf * | dev, |
bladerf_channel | ch, | ||
int * | gain_target ) |
Computes the gain target for a specified channel, incorporating calibration corrections.
For a channel, this calculates the target gain considering the current gain setting and calibration corrections, if available. In MGC mode, it returns the target gain from the calibration table. In AGC mode, it adjusts the target based on the calibration correction for the current frequency.
[in] | dev | Non-NULL pointer to a BladeRF device. |
[in] | ch | Channel (RX/TX) for querying the gain target. |
[out] | gain_target | Where to store the computed gain target. Reflects current gain and calibration corrections. |
API_EXPORT int CALL_CONV bladerf_load_gain_calibration | ( | struct bladerf * | dev, |
bladerf_channel | ch, | ||
const char * | cal_file_loc ) |
Loads and applies gain calibration for a specified channel from a file.
This function adjusts the specified channel's gain settings on the bladeRF device using calibration data from the provided file path. It supports calibration files in CSV format, automatically converting them to binary format as required by the device. This ensures the device operates with optimized gain settings across its frequency range. The operation is protected by mutex locks to maintain thread safety.
[in] | dev | Pointer to the initialized bladeRF device. |
[in] | ch | The target channel (RX or TX) for gain calibration. |
[in] | cal_file_loc | Path to the calibration file, either in CSV or binary format. CSV files are converted to binary format during the process. |
API_EXPORT int CALL_CONV bladerf_print_gain_calibration | ( | struct bladerf * | dev, |
bladerf_channel | ch, | ||
bool | with_entries ) |
Displays gain calibration details for a specified channel.
Outputs the gain calibration information to the console. The level of detail is adjustable via with_entries.
[in] | dev | Non-NULL pointer to a bladeRF device. |
[in] | ch | Channel to display gain calibration for. Use bladerf_channel. |
[in] | with_entries | Set to true to print all calibration entries, or false for a summary only. |