libbladeRF  2.6.0
Nuand bladeRF library
libbladeRF.h
Go to the documentation of this file.
1 
22 #ifndef LIBBLADERF_H_
23 #define LIBBLADERF_H_
24 
25 #include <inttypes.h>
26 #include <stdint.h>
27 #include <stdlib.h>
28 
54 #define LIBBLADERF_API_VERSION (0x02060000)
55 
56 #ifdef __cplusplus
57 extern "C" {
58 #else
67 #include <stdbool.h>
68 #endif
69 
70 // clang-format off
71 #if defined _WIN32 || defined __CYGWIN__
72 # include <windows.h>
73 # define CALL_CONV __cdecl
74 # ifdef __GNUC__
75 # define API_EXPORT __attribute__ ((dllexport))
76 # else
77 # define API_EXPORT __declspec(dllexport)
78 # endif
79 #elif defined _DOXYGEN_ONLY_ || defined MATLAB_LINUX_THUNK_BUILD_
82 # define API_EXPORT
85 # define CALL_CONV
86 #else
87 # define API_EXPORT __attribute__ ((visibility ("default")))
88 # define CALL_CONV
89 #endif
90 // clang-format on
91 
107 struct bladerf;
108 
112 typedef enum {
120 
122 #define BLADERF_DESCRIPTION_LENGTH 33
123 
125 #define BLADERF_SERIAL_LENGTH 33
126 
134  uint8_t usb_bus;
135  uint8_t usb_addr;
136  unsigned int instance;
141 };
142 
148  void *handle;
150  void *lock;
151 };
152 
211 int CALL_CONV bladerf_open(struct bladerf **device,
212  const char *device_identifier);
213 
225 void CALL_CONV bladerf_close(struct bladerf *device);
226 
249 int CALL_CONV bladerf_open_with_devinfo(struct bladerf **device,
250  struct bladerf_devinfo *devinfo);
251 
262 
270 
281 
293 int CALL_CONV bladerf_get_devinfo(struct bladerf *dev,
294  struct bladerf_devinfo *info);
295 
296 
308 int CALL_CONV bladerf_get_backendinfo(struct bladerf *dev,
309  struct bladerf_backendinfo *info);
324  struct bladerf_devinfo *info);
325 
335  const struct bladerf_devinfo *b);
336 
348 bool CALL_CONV bladerf_devstr_matches(const char *dev_str,
349  struct bladerf_devinfo *info);
350 
360 
376 
394  int64_t min;
395  int64_t max;
396  int64_t step;
397  float scale;
398 };
399 
405 };
406 
411  uint16_t major;
412  uint16_t minor;
413  uint16_t patch;
414  const char *describe;
419 };
420 
424 typedef enum {
430  BLADERF_FPGA_A9 = 301
432 
437 typedef enum {
438  BLADERF_DEVICE_SPEED_UNKNOWN,
439  BLADERF_DEVICE_SPEED_HIGH,
440  BLADERF_DEVICE_SPEED_SUPER
442 
449 typedef enum {
454 
470 int CALL_CONV bladerf_get_serial(struct bladerf *dev, char *serial);
471 
495 int CALL_CONV bladerf_get_serial_struct(struct bladerf *dev,
496  struct bladerf_serial *serial);
497 
508 int CALL_CONV bladerf_get_fpga_size(struct bladerf *dev,
509  bladerf_fpga_size *size);
510 
521 int CALL_CONV bladerf_get_fpga_bytes(struct bladerf *dev, size_t *size);
522 
537 int CALL_CONV bladerf_get_flash_size(struct bladerf *dev,
538  uint32_t *size,
539  bool *is_guess);
540 
551 int CALL_CONV bladerf_fw_version(struct bladerf *dev,
552  struct bladerf_version *version);
553 
563 int CALL_CONV bladerf_is_fpga_configured(struct bladerf *dev);
564 
574 int CALL_CONV bladerf_fpga_version(struct bladerf *dev,
575  struct bladerf_version *version);
576 
592 int CALL_CONV bladerf_get_fpga_source(struct bladerf *dev,
593  bladerf_fpga_source *source);
594 
604 
614 const char *CALL_CONV bladerf_get_board_name(struct bladerf *dev);
615 
649 typedef int bladerf_channel;
650 
664 #define BLADERF_CHANNEL_RX(ch) (bladerf_channel)(((ch) << 1) | 0x0)
665 
679 #define BLADERF_CHANNEL_TX(ch) (bladerf_channel)(((ch) << 1) | 0x1)
680 
684 #define BLADERF_CHANNEL_INVALID (bladerf_channel)(-1)
685 
687 #define BLADERF_DIRECTION_MASK (0x1)
691 /* Backwards compatible mapping to `bladerf_module`. */
692 typedef bladerf_channel bladerf_module;
693 #define BLADERF_MODULE_INVALID BLADERF_CHANNEL_INVALID
694 #define BLADERF_MODULE_RX BLADERF_CHANNEL_RX(0)
695 #define BLADERF_MODULE_TX BLADERF_CHANNEL_TX(0)
701 #define BLADERF_CHANNEL_IS_TX(ch) (ch & BLADERF_TX)
702 
706 typedef enum {
710 
714 typedef enum {
720 
730 size_t CALL_CONV bladerf_get_channel_count(struct bladerf *dev,
731  bladerf_direction dir);
732 
748 typedef int bladerf_gain;
749 
760 typedef enum {
770 
776 
783 
790 
798 
800 #define BLADERF_GAIN_AUTOMATIC BLADERF_GAIN_DEFAULT
802 #define BLADERF_GAIN_MANUAL BLADERF_GAIN_MGC
803 
808  const char *name;
810 };
811 
838 int CALL_CONV bladerf_set_gain(struct bladerf *dev,
839  bladerf_channel ch,
840  bladerf_gain gain);
841 
852 int CALL_CONV bladerf_get_gain(struct bladerf *dev,
853  bladerf_channel ch,
854  bladerf_gain *gain);
855 
875 int CALL_CONV bladerf_set_gain_mode(struct bladerf *dev,
876  bladerf_channel ch,
877  bladerf_gain_mode mode);
878 
893 int CALL_CONV bladerf_get_gain_mode(struct bladerf *dev,
894  bladerf_channel ch,
895  bladerf_gain_mode *mode);
896 
916 int CALL_CONV bladerf_get_gain_modes(struct bladerf *dev,
917  bladerf_channel ch,
918  const struct bladerf_gain_modes **modes);
919 
933 int CALL_CONV bladerf_get_gain_range(struct bladerf *dev,
934  bladerf_channel ch,
935  const struct bladerf_range **range);
936 
950 int CALL_CONV bladerf_set_gain_stage(struct bladerf *dev,
951  bladerf_channel ch,
952  const char *stage,
953  bladerf_gain gain);
954 
968 int CALL_CONV bladerf_get_gain_stage(struct bladerf *dev,
969  bladerf_channel ch,
970  const char *stage,
971  bladerf_gain *gain);
972 
990 int CALL_CONV bladerf_get_gain_stage_range(struct bladerf *dev,
991  bladerf_channel ch,
992  const char *stage,
993  const struct bladerf_range **range);
994 
1009 API_EXPORT
1010 int CALL_CONV bladerf_get_gain_stages(struct bladerf *dev,
1011  bladerf_channel ch,
1012  const char **stages,
1013  size_t count);
1014 
1031 typedef unsigned int bladerf_sample_rate;
1032 
1042  uint64_t integer;
1043  uint64_t num;
1044  uint64_t den;
1046 };
1047 
1065 API_EXPORT
1066 int CALL_CONV bladerf_set_sample_rate(struct bladerf *dev,
1067  bladerf_channel ch,
1068  bladerf_sample_rate rate,
1069  bladerf_sample_rate *actual);
1070 
1085 API_EXPORT
1086 int CALL_CONV
1088  bladerf_channel ch,
1089  struct bladerf_rational_rate *rate,
1090  struct bladerf_rational_rate *actual);
1100 API_EXPORT
1101 int CALL_CONV bladerf_get_sample_rate(struct bladerf *dev,
1102  bladerf_channel ch,
1103  bladerf_sample_rate *rate);
1104 
1114 API_EXPORT
1116  bladerf_channel ch,
1117  const struct bladerf_range **range);
1118 
1128 API_EXPORT
1129 int CALL_CONV
1131  bladerf_channel ch,
1132  struct bladerf_rational_rate *rate);
1133 
1151 typedef unsigned int bladerf_bandwidth;
1152 
1171 API_EXPORT
1172 int CALL_CONV bladerf_set_bandwidth(struct bladerf *dev,
1173  bladerf_channel ch,
1174  bladerf_bandwidth bandwidth,
1175  bladerf_bandwidth *actual);
1176 
1186 API_EXPORT
1187 int CALL_CONV bladerf_get_bandwidth(struct bladerf *dev,
1188  bladerf_channel ch,
1189  bladerf_bandwidth *bandwidth);
1190 
1200 API_EXPORT
1201 int CALL_CONV bladerf_get_bandwidth_range(struct bladerf *dev,
1202  bladerf_channel ch,
1203  const struct bladerf_range **range);
1204 
1229 typedef uint64_t bladerf_frequency;
1230 
1232 #define BLADERF_PRIuFREQ PRIu64
1234 #define BLADERF_PRIxFREQ PRIx64
1236 #define BLADERF_SCNuFREQ SCNu64
1238 #define BLADERF_SCNxFREQ SCNx64
1239 
1258 API_EXPORT
1259 int CALL_CONV bladerf_select_band(struct bladerf *dev,
1260  bladerf_channel ch,
1261  bladerf_frequency frequency);
1262 
1286 API_EXPORT
1287 int CALL_CONV bladerf_set_frequency(struct bladerf *dev,
1288  bladerf_channel ch,
1289  bladerf_frequency frequency);
1299 API_EXPORT
1300 int CALL_CONV bladerf_get_frequency(struct bladerf *dev,
1301  bladerf_channel ch,
1302  bladerf_frequency *frequency);
1303 
1313 API_EXPORT
1314 int CALL_CONV bladerf_get_frequency_range(struct bladerf *dev,
1315  bladerf_channel ch,
1316  const struct bladerf_range **range);
1317 
1338 typedef enum {
1341 
1344 
1347 
1350 
1353 
1356 
1362 
1368 
1374 
1378 
1383  const char *name;
1385 };
1386 
1402 API_EXPORT
1404  struct bladerf *dev, const struct bladerf_loopback_modes **modes);
1405 
1415  struct bladerf *dev, bladerf_loopback mode);
1416 
1430 API_EXPORT
1431 int CALL_CONV bladerf_set_loopback(struct bladerf *dev, bladerf_loopback lb);
1432 
1441 API_EXPORT
1442 int CALL_CONV bladerf_get_loopback(struct bladerf *dev, bladerf_loopback *lb);
1443 
1567 typedef enum {
1570 
1576 
1582 
1590 
1606 typedef enum {
1621 
1633  uint64_t options;
1635 };
1636 
1652 API_EXPORT
1653 int CALL_CONV bladerf_trigger_init(struct bladerf *dev,
1654  bladerf_channel ch,
1655  bladerf_trigger_signal signal,
1656  struct bladerf_trigger *trigger);
1657 
1678 API_EXPORT
1679 int CALL_CONV bladerf_trigger_arm(struct bladerf *dev,
1680  const struct bladerf_trigger *trigger,
1681  bool arm,
1682  uint64_t resv1,
1683  uint64_t resv2);
1684 
1696 API_EXPORT
1697 int CALL_CONV bladerf_trigger_fire(struct bladerf *dev,
1698  const struct bladerf_trigger *trigger);
1699 
1719 API_EXPORT
1720 int CALL_CONV bladerf_trigger_state(struct bladerf *dev,
1721  const struct bladerf_trigger *trigger,
1722  bool *is_armed,
1723  bool *has_fired,
1724  bool *fire_requested,
1725  uint64_t *resv1,
1726  uint64_t *resv2);
1727 
1744 typedef enum {
1747 
1750 
1757 
1764 
1765  /* RX_MUX setting 0x3 is reserved for future use */
1766 
1769 } bladerf_rx_mux;
1770 
1772 /* Backwards compatible mapping for `bladerf_rx_mux`. */
1773 #define BLADERF_RX_MUX_BASEBAND_LMS BLADERF_RX_MUX_BASEBAND
1784 API_EXPORT
1785 int CALL_CONV bladerf_set_rx_mux(struct bladerf *dev, bladerf_rx_mux mux);
1786 
1795 API_EXPORT
1796 int CALL_CONV bladerf_get_rx_mux(struct bladerf *dev, bladerf_rx_mux *mode);
1797 
1818 typedef uint64_t bladerf_timestamp;
1819 
1824 #define BLADERF_RETUNE_NOW (bladerf_timestamp)0
1825 
1836  union {
1837  /* bladeRF1 quick tune parameters */
1838  struct {
1839  uint8_t freqsel;
1840  uint8_t vcocap;
1841  uint16_t nint;
1842  uint32_t nfrac;
1843  uint8_t flags;
1844  uint8_t xb_gpio;
1845  };
1846  /* bladeRF2 quick tune parameters */
1847  struct {
1848  uint16_t nios_profile;
1849  uint8_t rffe_profile;
1850  uint8_t port;
1851  uint8_t spdt;
1852  };
1853  };
1854 };
1855 
1886 API_EXPORT
1887 int CALL_CONV bladerf_schedule_retune(struct bladerf *dev,
1888  bladerf_channel ch,
1889  bladerf_timestamp timestamp,
1890  bladerf_frequency frequency,
1891  struct bladerf_quick_tune *quick_tune);
1892 
1905 API_EXPORT
1907  bladerf_channel ch);
1908 
1929 API_EXPORT
1930 int CALL_CONV bladerf_get_quick_tune(struct bladerf *dev,
1931  bladerf_channel ch,
1932  struct bladerf_quick_tune *quick_tune);
1933 
1949 API_EXPORT
1950 int bladerf_print_quick_tune(struct bladerf *dev,
1951  const struct bladerf_quick_tune *qt);
1952 
1974 
1984 typedef enum {
1990 
1996 
2002 
2009 
2011 /* Backwards compatible mapping to `bladerf_correction`. */
2012 #define BLADERF_CORR_LMS_DCOFF_I BLADERF_CORR_DCOFF_I
2013 #define BLADERF_CORR_LMS_DCOFF_Q BLADERF_CORR_DCOFF_Q
2014 #define BLADERF_CORR_FPGA_PHASE BLADERF_CORR_PHASE
2015 #define BLADERF_CORR_FPGA_GAIN BLADERF_CORR_GAIN
2031 API_EXPORT
2032 int CALL_CONV bladerf_set_correction(struct bladerf *dev,
2033  bladerf_channel ch,
2034  bladerf_correction corr,
2035  bladerf_correction_value value);
2036 
2047 API_EXPORT
2048 int CALL_CONV bladerf_get_correction(struct bladerf *dev,
2049  bladerf_channel ch,
2050  bladerf_correction corr,
2051  bladerf_correction_value *value);
2052 
2066 #define BLADERF_PRIuTS PRIu64
2068 #define BLADERF_PRIxTS PRIx64
2070 #define BLADERF_SCNuTS SCNu64
2072 #define BLADERF_SCNxTS SCNx64
2073 
2085 typedef enum {
2142 
2158 
2199 
2247 
2303 
2344 } bladerf_format;
2345 
2353 API_EXPORT
2355 
2362 /*
2363  * Metadata status bits
2364  *
2365  * These are used in conjunction with the bladerf_metadata structure's `status`
2366  * field.
2367  */
2368 
2375 #define BLADERF_META_STATUS_OVERRUN (1 << 0)
2376 
2385 #define BLADERF_META_STATUS_UNDERRUN (1 << 1)
2386 
2387 /*
2388  * Metadata flags
2389  *
2390  * These are used in conjunction with the bladerf_metadata structure's `flags`
2391  * field.
2392  */
2393 
2408 #define BLADERF_META_FLAG_TX_BURST_START (1 << 0)
2409 
2436 #define BLADERF_META_FLAG_TX_BURST_END (1 << 1)
2437 
2446 #define BLADERF_META_FLAG_TX_NOW (1 << 2)
2447 
2466 #define BLADERF_META_FLAG_TX_UPDATE_TIMESTAMP (1 << 3)
2467 
2473 #define BLADERF_META_FLAG_RX_NOW (1 << 31)
2474 
2479 #define BLADERF_META_FLAG_RX_HW_UNDERFLOW (1 << 0)
2480 
2485 #define BLADERF_META_FLAG_RX_HW_MINIEXP1 (1 << 16)
2486 
2491 #define BLADERF_META_FLAG_RX_HW_MINIEXP2 (1 << 17)
2492 
2506 
2519  uint32_t flags;
2520 
2528  uint32_t status;
2529 
2543  unsigned int actual_count;
2544 
2549  uint8_t reserved[32];
2550 };
2551 
2598 API_EXPORT
2600  bladerf_format format,
2601  unsigned int buffer_size,
2602  void *samples);
2603 
2626 API_EXPORT
2628  bladerf_format format,
2629  unsigned int buffer_size,
2630  void *samples);
2631 
2654 API_EXPORT
2655 int CALL_CONV bladerf_enable_module(struct bladerf *dev,
2656  bladerf_channel ch,
2657  bool enable);
2658 
2700 API_EXPORT
2701 int CALL_CONV bladerf_get_timestamp(struct bladerf *dev,
2702  bladerf_direction dir,
2703  bladerf_timestamp *timestamp);
2704 
2775 API_EXPORT
2776 int CALL_CONV bladerf_sync_config(struct bladerf *dev,
2777  bladerf_channel_layout layout,
2778  bladerf_format format,
2779  unsigned int num_buffers,
2780  unsigned int buffer_size,
2781  unsigned int num_transfers,
2782  unsigned int stream_timeout);
2783 
2817 API_EXPORT
2818 int CALL_CONV bladerf_sync_tx(struct bladerf *dev,
2819  const void *samples,
2820  unsigned int num_samples,
2821  struct bladerf_metadata *metadata,
2822  unsigned int timeout_ms);
2823 
2857 API_EXPORT
2858 int CALL_CONV bladerf_sync_rx(struct bladerf *dev,
2859  void *samples,
2860  unsigned int num_samples,
2861  struct bladerf_metadata *metadata,
2862  unsigned int timeout_ms);
2863 
2864 
2887 #define BLADERF_STREAM_SHUTDOWN (NULL)
2888 
2894 #define BLADERF_STREAM_NO_DATA ((void *)(-1))
2895 
2897 struct bladerf_stream;
2898 
2946 typedef void *(*bladerf_stream_cb)(struct bladerf *dev,
2947  struct bladerf_stream *stream,
2948  struct bladerf_metadata *meta,
2949  void *samples,
2950  size_t num_samples,
2951  void *user_data);
2952 
3015 API_EXPORT
3017  struct bladerf *dev,
3018  bladerf_stream_cb callback,
3019  void ***buffers,
3020  size_t num_buffers,
3021  bladerf_format format,
3022  size_t samples_per_buffer,
3023  size_t num_transfers,
3024  void *user_data);
3025 
3046 API_EXPORT
3048  bladerf_channel_layout layout);
3049 
3077 API_EXPORT
3079  void *buffer,
3080  unsigned int timeout_ms);
3081 
3099 API_EXPORT
3101  void *buffer);
3102 
3103 
3115 API_EXPORT
3117 
3127 API_EXPORT
3128 int CALL_CONV bladerf_set_stream_timeout(struct bladerf *dev,
3129  bladerf_direction dir,
3130  unsigned int timeout);
3131 
3142 API_EXPORT
3143 int CALL_CONV bladerf_get_stream_timeout(struct bladerf *dev,
3144  bladerf_direction dir,
3145  unsigned int *timeout);
3146 
3176 API_EXPORT
3177 int CALL_CONV bladerf_flash_firmware(struct bladerf *dev, const char *firmware);
3178 
3189 API_EXPORT
3190 int CALL_CONV bladerf_load_fpga(struct bladerf *dev, const char *fpga);
3191 
3202 API_EXPORT
3203 int CALL_CONV bladerf_flash_fpga(struct bladerf *dev, const char *fpga_image);
3204 
3212 API_EXPORT
3213 int CALL_CONV bladerf_erase_stored_fpga(struct bladerf *dev);
3214 
3222 API_EXPORT
3223 int CALL_CONV bladerf_device_reset(struct bladerf *dev);
3224 
3234 API_EXPORT
3235 int CALL_CONV bladerf_get_fw_log(struct bladerf *dev, const char *filename);
3236 
3247 API_EXPORT
3248 int CALL_CONV bladerf_jump_to_bootloader(struct bladerf *dev);
3249 
3265 API_EXPORT
3267 
3291 API_EXPORT
3292 int CALL_CONV bladerf_load_fw_from_bootloader(const char *device_identifier,
3293  bladerf_backend backend,
3294  uint8_t bus,
3295  uint8_t addr,
3296  const char *file);
3297 
3312 typedef enum {
3328 
3330 #define BLADERF_IMAGE_MAGIC_LEN 7
3331 
3333 #define BLADERF_IMAGE_CHECKSUM_LEN 32
3334 
3336 #define BLADERF_IMAGE_RESERVED_LEN 128
3337 
3358 
3364 
3370  struct bladerf_version version;
3371 
3373  uint64_t timestamp;
3374 
3384 
3389 
3394 
3399  uint32_t address;
3400 
3402  uint32_t length;
3403 
3405  uint8_t *data;
3406 };
3407 
3436 API_EXPORT
3437 struct bladerf_image *CALL_CONV bladerf_alloc_image(struct bladerf *dev,
3439  uint32_t address,
3440  uint32_t length);
3441 
3455 API_EXPORT
3457  struct bladerf *dev, bladerf_fpga_size fpga_size, uint16_t vctcxo_trim);
3458 
3466 API_EXPORT
3468 
3487 API_EXPORT
3489 
3502 API_EXPORT
3504 
3520 API_EXPORT
3521 int CALL_CONV bladerf_image_write(struct bladerf *dev,
3522  struct bladerf_image *image,
3523  const char *file);
3524 
3546 API_EXPORT
3547 int CALL_CONV bladerf_image_read(struct bladerf_image *image, const char *file);
3548 
3580 typedef enum {
3583 
3586 
3589 
3593 
3602 API_EXPORT
3605 
3616 API_EXPORT
3619 
3640 API_EXPORT
3641 int CALL_CONV bladerf_get_vctcxo_trim(struct bladerf *dev, uint16_t *trim);
3642 
3653 API_EXPORT
3654 int CALL_CONV bladerf_trim_dac_write(struct bladerf *dev, uint16_t val);
3655 
3670 API_EXPORT
3671 int CALL_CONV bladerf_trim_dac_read(struct bladerf *dev, uint16_t *val);
3672 
3700 typedef enum {
3703 
3709 
3713 
3723 API_EXPORT
3724 int CALL_CONV bladerf_set_tuning_mode(struct bladerf *dev,
3725  bladerf_tuning_mode mode);
3726 
3735 API_EXPORT
3736 int CALL_CONV bladerf_get_tuning_mode(struct bladerf *dev,
3737  bladerf_tuning_mode *mode);
3738 
3761 #define BLADERF_TRIGGER_REG_ARM ((uint8_t)(1 << 0))
3762 
3772 #define BLADERF_TRIGGER_REG_FIRE ((uint8_t)(1 << 1))
3773 
3782 #define BLADERF_TRIGGER_REG_MASTER ((uint8_t)(1 << 2))
3783 
3790 #define BLADERF_TRIGGER_REG_LINE ((uint8_t)(1 << 3))
3791 
3804 API_EXPORT
3805 int CALL_CONV bladerf_read_trigger(struct bladerf *dev,
3806  bladerf_channel ch,
3807  bladerf_trigger_signal signal,
3808  uint8_t *val);
3809 
3821 API_EXPORT
3822 int CALL_CONV bladerf_write_trigger(struct bladerf *dev,
3823  bladerf_channel ch,
3824  bladerf_trigger_signal signal,
3825  uint8_t val);
3826 
3849 API_EXPORT
3850 int CALL_CONV bladerf_wishbone_master_read(struct bladerf *dev, uint32_t addr, uint32_t *data);
3851 
3862 API_EXPORT
3863 int CALL_CONV bladerf_wishbone_master_write(struct bladerf *dev, uint32_t addr, uint32_t val);
3864 
3887 API_EXPORT
3888 int CALL_CONV bladerf_config_gpio_read(struct bladerf *dev, uint32_t *val);
3889 
3902 API_EXPORT
3903 int CALL_CONV bladerf_config_gpio_write(struct bladerf *dev, uint32_t val);
3904 
3940 API_EXPORT
3941 int CALL_CONV bladerf_erase_flash(struct bladerf *dev,
3942  uint32_t erase_block,
3943  uint32_t count);
3944 
3958 API_EXPORT
3959 int CALL_CONV bladerf_erase_flash_bytes(struct bladerf *dev,
3960  uint32_t address,
3961  uint32_t length);
3962 
3982 API_EXPORT
3983 int CALL_CONV bladerf_read_flash(struct bladerf *dev,
3984  uint8_t *buf,
3985  uint32_t page,
3986  uint32_t count);
3987 
4003 API_EXPORT
4004 int CALL_CONV bladerf_read_flash_bytes(struct bladerf *dev,
4005  uint8_t *buf,
4006  uint32_t address,
4007  uint32_t bytes);
4008 
4027 API_EXPORT
4028 int CALL_CONV bladerf_write_flash(struct bladerf *dev,
4029  const uint8_t *buf,
4030  uint32_t page,
4031  uint32_t count);
4032 
4047 API_EXPORT
4048 int CALL_CONV bladerf_write_flash_bytes(struct bladerf *dev,
4049  const uint8_t *buf,
4050  uint32_t address,
4051  uint32_t length);
4052 
4063 API_EXPORT
4064 int CALL_CONV bladerf_lock_otp(struct bladerf *dev);
4065 
4078 API_EXPORT
4079 int CALL_CONV bladerf_read_otp(struct bladerf *dev,
4080  uint8_t *buf);
4081 
4094 API_EXPORT
4095 int CALL_CONV bladerf_write_otp(struct bladerf *dev,
4096  uint8_t *buf);
4097 
4120 API_EXPORT
4121 int CALL_CONV bladerf_set_rf_port(struct bladerf *dev,
4122  bladerf_channel ch,
4123  const char *port);
4124 
4134 API_EXPORT
4135 int CALL_CONV bladerf_get_rf_port(struct bladerf *dev,
4136  bladerf_channel ch,
4137  const char **port);
4138 
4153 API_EXPORT
4154 int CALL_CONV bladerf_get_rf_ports(struct bladerf *dev,
4155  bladerf_channel ch,
4156  const char **ports,
4157  unsigned int count);
4158 
4175 typedef enum {
4179 
4189 API_EXPORT
4190 int CALL_CONV bladerf_enable_feature(struct bladerf *dev,
4191  bladerf_feature feature,
4192  bool enable);
4193 
4202 API_EXPORT
4203 int CALL_CONV bladerf_get_feature(struct bladerf *dev,
4204  bladerf_feature* feature);
4205 
4222  double gain_corr;
4223 };
4224 
4231  struct bladerf_version version;
4233  bool enabled;
4234  uint32_t n_entries;
4239  size_t file_path_len;
4240  char *file_path;
4241  enum gain_cal_state {
4242  BLADERF_GAIN_CAL_UNINITIALIZED,
4243  BLADERF_GAIN_CAL_LOADED,
4244  BLADERF_GAIN_CAL_UNLOADED
4245  } state;
4246 };
4247 
4248 
4270 API_EXPORT
4272  bladerf_channel ch,
4273  const char* cal_file_loc);
4274 
4292 API_EXPORT
4294  bladerf_channel ch,
4295  bool with_entries);
4296 
4316 API_EXPORT
4318  bladerf_channel ch,
4319  bool en);
4320 
4335 API_EXPORT
4336 int CALL_CONV bladerf_get_gain_calibration(struct bladerf *dev, bladerf_channel ch, const struct bladerf_gain_cal_tbl **tbl);
4337 
4358 API_EXPORT
4359 int CALL_CONV bladerf_get_gain_target(struct bladerf *dev, bladerf_channel ch, int *gain_target);
4360 
4384 typedef enum {
4386  BLADERF_XB_100,
4393 
4402 API_EXPORT
4403 int CALL_CONV bladerf_expansion_attach(struct bladerf *dev, bladerf_xb xb);
4404 
4413 API_EXPORT
4415  bladerf_xb *xb);
4416 
4433 typedef enum {
4442 
4451 API_EXPORT
4453 
4467 API_EXPORT
4469 
4488 // clang-format off
4489 #define BLADERF_ERR_UNEXPECTED (-1)
4490 #define BLADERF_ERR_RANGE (-2)
4491 #define BLADERF_ERR_INVAL (-3)
4492 #define BLADERF_ERR_MEM (-4)
4493 #define BLADERF_ERR_IO (-5)
4494 #define BLADERF_ERR_TIMEOUT (-6)
4495 #define BLADERF_ERR_NODEV (-7)
4496 #define BLADERF_ERR_UNSUPPORTED (-8)
4497 #define BLADERF_ERR_MISALIGNED (-9)
4498 #define BLADERF_ERR_CHECKSUM (-10)
4499 #define BLADERF_ERR_NO_FILE (-11)
4500 #define BLADERF_ERR_UPDATE_FPGA (-12)
4501 #define BLADERF_ERR_UPDATE_FW (-13)
4502 #define BLADERF_ERR_TIME_PAST (-14)
4503 #define BLADERF_ERR_QUEUE_FULL (-15)
4505 #define BLADERF_ERR_FPGA_OP (-16)
4506 #define BLADERF_ERR_PERMISSION (-17)
4508 #define BLADERF_ERR_WOULD_BLOCK (-18)
4513 #define BLADERF_ERR_NOT_INIT (-19)
4515 // clang-format on
4516 
4524 API_EXPORT
4525 const char *CALL_CONV bladerf_strerror(int error);
4526 
4529 #include <bladeRF1.h>
4530 #include <bladeRF2.h>
4531 
4532 #ifdef __cplusplus
4533 }
4534 #endif
4535 
4536 #endif /* LIBBLADERF_H_ */
bladeRF1-specific API
bladeRF2-specific API
API_EXPORT int CALL_CONV bladerf_set_bandwidth(struct bladerf *dev, bladerf_channel ch, bladerf_bandwidth bandwidth, bladerf_bandwidth *actual)
API_EXPORT int CALL_CONV bladerf_get_bandwidth(struct bladerf *dev, bladerf_channel ch, bladerf_bandwidth *bandwidth)
API_EXPORT int CALL_CONV bladerf_get_bandwidth_range(struct bladerf *dev, bladerf_channel ch, const struct bladerf_range **range)
unsigned int bladerf_bandwidth
Definition: libbladeRF.h:1151
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_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_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_enable_gain_calibration(struct bladerf *dev, bladerf_channel ch, bool en)
Toggles gain calibration for a specified channel.
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.
bladerf_channel_layout
Definition: libbladeRF.h:714
API_EXPORT size_t CALL_CONV bladerf_get_channel_count(struct bladerf *dev, bladerf_direction dir)
int bladerf_channel
Definition: libbladeRF.h:649
bladerf_direction
Definition: libbladeRF.h:706
@ BLADERF_RX_X1
Definition: libbladeRF.h:715
@ BLADERF_RX_X2
Definition: libbladeRF.h:717
@ BLADERF_TX_X2
Definition: libbladeRF.h:718
@ BLADERF_TX_X1
Definition: libbladeRF.h:716
@ BLADERF_TX
Definition: libbladeRF.h:708
@ BLADERF_RX
Definition: libbladeRF.h:707
API_EXPORT int CALL_CONV bladerf_config_gpio_read(struct bladerf *dev, uint32_t *val)
API_EXPORT int CALL_CONV bladerf_config_gpio_write(struct bladerf *dev, uint32_t val)
API_EXPORT int CALL_CONV bladerf_set_correction(struct bladerf *dev, bladerf_channel ch, bladerf_correction corr, bladerf_correction_value value)
bladerf_correction
Definition: libbladeRF.h:1984
API_EXPORT int CALL_CONV bladerf_get_correction(struct bladerf *dev, bladerf_channel ch, bladerf_correction corr, bladerf_correction_value *value)
int16_t bladerf_correction_value
Definition: libbladeRF.h:1973
@ BLADERF_CORR_DCOFF_Q
Definition: libbladeRF.h:1995
@ BLADERF_CORR_PHASE
Definition: libbladeRF.h:2001
@ BLADERF_CORR_GAIN
Definition: libbladeRF.h:2007
@ BLADERF_CORR_DCOFF_I
Definition: libbladeRF.h:1989
API_EXPORT int CALL_CONV bladerf_get_gain_mode(struct bladerf *dev, bladerf_channel ch, bladerf_gain_mode *mode)
API_EXPORT int CALL_CONV bladerf_set_gain_mode(struct bladerf *dev, bladerf_channel ch, bladerf_gain_mode mode)
API_EXPORT int CALL_CONV bladerf_get_gain_modes(struct bladerf *dev, bladerf_channel ch, const struct bladerf_gain_modes **modes)
API_EXPORT int CALL_CONV bladerf_set_gain_stage(struct bladerf *dev, bladerf_channel ch, const char *stage, bladerf_gain gain)
API_EXPORT int CALL_CONV bladerf_get_gain_stage(struct bladerf *dev, bladerf_channel ch, const char *stage, bladerf_gain *gain)
API_EXPORT int CALL_CONV bladerf_get_gain_stages(struct bladerf *dev, bladerf_channel ch, const char **stages, size_t count)
API_EXPORT int CALL_CONV bladerf_get_gain_range(struct bladerf *dev, bladerf_channel ch, const struct bladerf_range **range)
int bladerf_gain
Definition: libbladeRF.h:748
API_EXPORT int CALL_CONV bladerf_get_gain_stage_range(struct bladerf *dev, bladerf_channel ch, const char *stage, const struct bladerf_range **range)
API_EXPORT int CALL_CONV bladerf_set_gain(struct bladerf *dev, bladerf_channel ch, bladerf_gain gain)
bladerf_gain_mode
Definition: libbladeRF.h:760
API_EXPORT int CALL_CONV bladerf_get_gain(struct bladerf *dev, bladerf_channel ch, bladerf_gain *gain)
@ BLADERF_GAIN_SLOWATTACK_AGC
Definition: libbladeRF.h:789
@ BLADERF_GAIN_DEFAULT
Definition: libbladeRF.h:769
@ BLADERF_GAIN_MGC
Definition: libbladeRF.h:775
@ BLADERF_GAIN_FASTATTACK_AGC
Definition: libbladeRF.h:782
@ BLADERF_GAIN_HYBRID_AGC
Definition: libbladeRF.h:796
API_EXPORT int CALL_CONV bladerf_image_read(struct bladerf_image *image, const char *file)
API_EXPORT struct bladerf_image *CALL_CONV bladerf_alloc_image(struct bladerf *dev, bladerf_image_type type, uint32_t address, uint32_t length)
bladerf_image_type
Definition: libbladeRF.h:3312
API_EXPORT int CALL_CONV bladerf_image_write(struct bladerf *dev, struct bladerf_image *image, const char *file)
API_EXPORT const char * bladerf_image_type_to_string(bladerf_image_type type)
Converts a bladeRF image type to its corresponding string representation.
#define BLADERF_IMAGE_RESERVED_LEN
Definition: libbladeRF.h:3336
API_EXPORT void CALL_CONV bladerf_free_image(struct bladerf_image *image)
#define BLADERF_IMAGE_MAGIC_LEN
Definition: libbladeRF.h:3330
API_EXPORT int CALL_CONV bladerf_image_print_metadata(const struct bladerf_image *image)
Prints the metadata of a bladeRF image structure.
API_EXPORT struct bladerf_image *CALL_CONV bladerf_alloc_cal_image(struct bladerf *dev, bladerf_fpga_size fpga_size, uint16_t vctcxo_trim)
#define BLADERF_IMAGE_CHECKSUM_LEN
Definition: libbladeRF.h:3333
@ BLADERF_IMAGE_TYPE_FIRMWARE
Definition: libbladeRF.h:3315
@ BLADERF_IMAGE_TYPE_GAIN_CAL
Definition: libbladeRF.h:3326
@ BLADERF_IMAGE_TYPE_CALIBRATION
Definition: libbladeRF.h:3320
@ BLADERF_IMAGE_TYPE_RX_IQ_CAL
Definition: libbladeRF.h:3323
@ BLADERF_IMAGE_TYPE_INVALID
Definition: libbladeRF.h:3313
@ BLADERF_IMAGE_TYPE_FPGA_40KLE
Definition: libbladeRF.h:3316
@ BLADERF_IMAGE_TYPE_RX_DC_CAL
Definition: libbladeRF.h:3321
@ BLADERF_IMAGE_TYPE_TX_IQ_CAL
Definition: libbladeRF.h:3324
@ BLADERF_IMAGE_TYPE_TX_DC_CAL
Definition: libbladeRF.h:3322
@ BLADERF_IMAGE_TYPE_FPGA_A9
Definition: libbladeRF.h:3319
@ BLADERF_IMAGE_TYPE_FPGA_A5
Definition: libbladeRF.h:3325
@ BLADERF_IMAGE_TYPE_RAW
Definition: libbladeRF.h:3314
@ BLADERF_IMAGE_TYPE_FPGA_A4
Definition: libbladeRF.h:3318
@ BLADERF_IMAGE_TYPE_FPGA_115KLE
Definition: libbladeRF.h:3317
API_EXPORT int CALL_CONV bladerf_get_fpga_source(struct bladerf *dev, bladerf_fpga_source *source)
API_EXPORT int CALL_CONV bladerf_get_serial_struct(struct bladerf *dev, struct bladerf_serial *serial)
bladerf_fpga_size
Definition: libbladeRF.h:424
API_EXPORT int CALL_CONV bladerf_get_serial(struct bladerf *dev, char *serial)
API_EXPORT int CALL_CONV bladerf_is_fpga_configured(struct bladerf *dev)
bladerf_dev_speed
Definition: libbladeRF.h:437
API_EXPORT int CALL_CONV bladerf_get_fpga_bytes(struct bladerf *dev, size_t *size)
API_EXPORT int CALL_CONV bladerf_fw_version(struct bladerf *dev, struct bladerf_version *version)
API_EXPORT int CALL_CONV bladerf_get_fpga_size(struct bladerf *dev, bladerf_fpga_size *size)
API_EXPORT int CALL_CONV bladerf_get_flash_size(struct bladerf *dev, uint32_t *size, bool *is_guess)
API_EXPORT int CALL_CONV bladerf_fpga_version(struct bladerf *dev, struct bladerf_version *version)
API_EXPORT const char *CALL_CONV bladerf_get_board_name(struct bladerf *dev)
bladerf_fpga_source
Definition: libbladeRF.h:449
API_EXPORT bladerf_dev_speed CALL_CONV bladerf_device_speed(struct bladerf *dev)
@ BLADERF_FPGA_UNKNOWN
Definition: libbladeRF.h:425
@ BLADERF_FPGA_A5
Definition: libbladeRF.h:429
@ BLADERF_FPGA_A4
Definition: libbladeRF.h:428
@ BLADERF_FPGA_40KLE
Definition: libbladeRF.h:426
@ BLADERF_FPGA_115KLE
Definition: libbladeRF.h:427
@ BLADERF_FPGA_A9
Definition: libbladeRF.h:430
@ BLADERF_FPGA_SOURCE_HOST
Definition: libbladeRF.h:452
@ BLADERF_FPGA_SOURCE_UNKNOWN
Definition: libbladeRF.h:450
@ BLADERF_FPGA_SOURCE_FLASH
Definition: libbladeRF.h:451
API_EXPORT void CALL_CONV bladerf_set_usb_reset_on_open(bool enabled)
API_EXPORT void CALL_CONV bladerf_free_device_list(struct bladerf_devinfo *devices)
API_EXPORT int CALL_CONV bladerf_get_devinfo(struct bladerf *dev, struct bladerf_devinfo *info)
API_EXPORT int CALL_CONV bladerf_get_device_list(struct bladerf_devinfo **devices)
bladerf_backend
Definition: libbladeRF.h:112
API_EXPORT void CALL_CONV bladerf_init_devinfo(struct bladerf_devinfo *info)
#define BLADERF_DESCRIPTION_LENGTH
Definition: libbladeRF.h:122
API_EXPORT int CALL_CONV bladerf_get_backendinfo(struct bladerf *dev, struct bladerf_backendinfo *info)
API_EXPORT int CALL_CONV bladerf_get_devinfo_from_str(const char *devstr, struct bladerf_devinfo *info)
#define BLADERF_SERIAL_LENGTH
Definition: libbladeRF.h:125
API_EXPORT void CALL_CONV bladerf_close(struct bladerf *device)
API_EXPORT const char *CALL_CONV bladerf_backend_str(bladerf_backend backend)
API_EXPORT bool CALL_CONV bladerf_devstr_matches(const char *dev_str, struct bladerf_devinfo *info)
API_EXPORT int CALL_CONV bladerf_open(struct bladerf **device, const char *device_identifier)
API_EXPORT int CALL_CONV bladerf_open_with_devinfo(struct bladerf **device, struct bladerf_devinfo *devinfo)
API_EXPORT bool CALL_CONV bladerf_devinfo_matches(const struct bladerf_devinfo *a, const struct bladerf_devinfo *b)
@ BLADERF_BACKEND_ANY
Definition: libbladeRF.h:113
@ BLADERF_BACKEND_LIBUSB
Definition: libbladeRF.h:116
@ BLADERF_BACKEND_LINUX
Definition: libbladeRF.h:115
@ BLADERF_BACKEND_CYPRESS
Definition: libbladeRF.h:117
@ BLADERF_BACKEND_DUMMY
Definition: libbladeRF.h:118
API_EXPORT void CALL_CONV bladerf_version(struct bladerf_version *version)
API_EXPORT void CALL_CONV bladerf_log_set_verbosity(bladerf_log_level level)
bladerf_log_level
Definition: libbladeRF.h:4433
@ BLADERF_LOG_LEVEL_ERROR
Definition: libbladeRF.h:4438
@ BLADERF_LOG_LEVEL_SILENT
Definition: libbladeRF.h:4440
@ BLADERF_LOG_LEVEL_INFO
Definition: libbladeRF.h:4436
@ BLADERF_LOG_LEVEL_WARNING
Definition: libbladeRF.h:4437
@ BLADERF_LOG_LEVEL_VERBOSE
Definition: libbladeRF.h:4434
@ BLADERF_LOG_LEVEL_DEBUG
Definition: libbladeRF.h:4435
@ BLADERF_LOG_LEVEL_CRITICAL
Definition: libbladeRF.h:4439
bladerf_loopback
Definition: libbladeRF.h:1338
API_EXPORT bool CALL_CONV bladerf_is_loopback_mode_supported(struct bladerf *dev, bladerf_loopback mode)
API_EXPORT int CALL_CONV bladerf_set_loopback(struct bladerf *dev, bladerf_loopback lb)
API_EXPORT int CALL_CONV bladerf_get_loopback_modes(struct bladerf *dev, const struct bladerf_loopback_modes **modes)
API_EXPORT int CALL_CONV bladerf_get_loopback(struct bladerf *dev, bladerf_loopback *lb)
@ BLADERF_LB_RFIC_BIST
Definition: libbladeRF.h:1376
@ BLADERF_LB_BB_TXVGA1_RXVGA2
Definition: libbladeRF.h:1349
@ BLADERF_LB_BB_TXLPF_RXVGA2
Definition: libbladeRF.h:1346
@ BLADERF_LB_BB_TXLPF_RXLPF
Definition: libbladeRF.h:1352
@ BLADERF_LB_RF_LNA2
Definition: libbladeRF.h:1367
@ BLADERF_LB_RF_LNA3
Definition: libbladeRF.h:1373
@ BLADERF_LB_BB_TXVGA1_RXLPF
Definition: libbladeRF.h:1355
@ BLADERF_LB_NONE
Definition: libbladeRF.h:1340
@ BLADERF_LB_FIRMWARE
Definition: libbladeRF.h:1343
@ BLADERF_LB_RF_LNA1
Definition: libbladeRF.h:1361
API_EXPORT int CALL_CONV bladerf_get_fw_log(struct bladerf *dev, const char *filename)
API_EXPORT int CALL_CONV bladerf_load_fpga(struct bladerf *dev, const char *fpga)
API_EXPORT int CALL_CONV bladerf_flash_firmware(struct bladerf *dev, const char *firmware)
API_EXPORT int CALL_CONV bladerf_jump_to_bootloader(struct bladerf *dev)
API_EXPORT int CALL_CONV bladerf_get_bootloader_list(struct bladerf_devinfo **list)
API_EXPORT int CALL_CONV bladerf_load_fw_from_bootloader(const char *device_identifier, bladerf_backend backend, uint8_t bus, uint8_t addr, const char *file)
API_EXPORT int CALL_CONV bladerf_device_reset(struct bladerf *dev)
API_EXPORT int CALL_CONV bladerf_erase_stored_fpga(struct bladerf *dev)
API_EXPORT int CALL_CONV bladerf_flash_fpga(struct bladerf *dev, const char *fpga_image)
API_EXPORT int CALL_CONV bladerf_get_rx_mux(struct bladerf *dev, bladerf_rx_mux *mode)
API_EXPORT int CALL_CONV bladerf_set_rx_mux(struct bladerf *dev, bladerf_rx_mux mux)
bladerf_rx_mux
Definition: libbladeRF.h:1744
@ BLADERF_RX_MUX_DIGITAL_LOOPBACK
Definition: libbladeRF.h:1768
@ BLADERF_RX_MUX_12BIT_COUNTER
Definition: libbladeRF.h:1756
@ BLADERF_RX_MUX_32BIT_COUNTER
Definition: libbladeRF.h:1763
@ BLADERF_RX_MUX_INVALID
Definition: libbladeRF.h:1746
@ BLADERF_RX_MUX_BASEBAND
Definition: libbladeRF.h:1749
API_EXPORT int CALL_CONV bladerf_get_rf_ports(struct bladerf *dev, bladerf_channel ch, const char **ports, unsigned int count)
API_EXPORT int CALL_CONV bladerf_get_rf_port(struct bladerf *dev, bladerf_channel ch, const char **port)
API_EXPORT int CALL_CONV bladerf_set_rf_port(struct bladerf *dev, bladerf_channel ch, const char *port)
API_EXPORT int CALL_CONV bladerf_get_sample_rate_range(struct bladerf *dev, bladerf_channel ch, const struct bladerf_range **range)
API_EXPORT int CALL_CONV bladerf_get_sample_rate(struct bladerf *dev, bladerf_channel ch, bladerf_sample_rate *rate)
unsigned int bladerf_sample_rate
Definition: libbladeRF.h:1031
API_EXPORT int CALL_CONV bladerf_get_rational_sample_rate(struct bladerf *dev, bladerf_channel ch, struct bladerf_rational_rate *rate)
API_EXPORT int CALL_CONV bladerf_set_rational_sample_rate(struct bladerf *dev, bladerf_channel ch, struct bladerf_rational_rate *rate, struct bladerf_rational_rate *actual)
API_EXPORT int CALL_CONV bladerf_set_sample_rate(struct bladerf *dev, bladerf_channel ch, bladerf_sample_rate rate, bladerf_sample_rate *actual)
API_EXPORT int bladerf_print_quick_tune(struct bladerf *dev, const struct bladerf_quick_tune *qt)
Prints the quick retune parameters for a bladeRF device.
API_EXPORT int CALL_CONV bladerf_get_quick_tune(struct bladerf *dev, bladerf_channel ch, struct bladerf_quick_tune *quick_tune)
API_EXPORT int CALL_CONV bladerf_schedule_retune(struct bladerf *dev, bladerf_channel ch, bladerf_timestamp timestamp, bladerf_frequency frequency, struct bladerf_quick_tune *quick_tune)
API_EXPORT int CALL_CONV bladerf_cancel_scheduled_retunes(struct bladerf *dev, bladerf_channel ch)
API_EXPORT int CALL_CONV bladerf_get_feature(struct bladerf *dev, bladerf_feature *feature)
API_EXPORT int CALL_CONV bladerf_enable_feature(struct bladerf *dev, bladerf_feature feature, bool enable)
bladerf_feature
Definition: libbladeRF.h:4175
@ BLADERF_FEATURE_OVERSAMPLE
Definition: libbladeRF.h:4177
@ BLADERF_FEATURE_DEFAULT
Definition: libbladeRF.h:4176
API_EXPORT int CALL_CONV bladerf_erase_flash_bytes(struct bladerf *dev, uint32_t address, uint32_t length)
API_EXPORT int CALL_CONV bladerf_write_flash(struct bladerf *dev, const uint8_t *buf, uint32_t page, uint32_t count)
API_EXPORT int CALL_CONV bladerf_read_otp(struct bladerf *dev, uint8_t *buf)
API_EXPORT int CALL_CONV bladerf_read_flash(struct bladerf *dev, uint8_t *buf, uint32_t page, uint32_t count)
API_EXPORT int CALL_CONV bladerf_read_flash_bytes(struct bladerf *dev, uint8_t *buf, uint32_t address, uint32_t bytes)
API_EXPORT int CALL_CONV bladerf_erase_flash(struct bladerf *dev, uint32_t erase_block, uint32_t count)
API_EXPORT int CALL_CONV bladerf_write_otp(struct bladerf *dev, uint8_t *buf)
API_EXPORT int CALL_CONV bladerf_write_flash_bytes(struct bladerf *dev, const uint8_t *buf, uint32_t address, uint32_t length)
API_EXPORT int CALL_CONV bladerf_lock_otp(struct bladerf *dev)
API_EXPORT int CALL_CONV bladerf_submit_stream_buffer_nb(struct bladerf_stream *stream, void *buffer)
API_EXPORT void CALL_CONV bladerf_deinit_stream(struct bladerf_stream *stream)
API_EXPORT int CALL_CONV bladerf_init_stream(struct bladerf_stream **stream, struct bladerf *dev, bladerf_stream_cb callback, void ***buffers, size_t num_buffers, bladerf_format format, size_t samples_per_buffer, size_t num_transfers, void *user_data)
void *(* bladerf_stream_cb)(struct bladerf *dev, struct bladerf_stream *stream, struct bladerf_metadata *meta, void *samples, size_t num_samples, void *user_data)
Definition: libbladeRF.h:2946
API_EXPORT int CALL_CONV bladerf_get_stream_timeout(struct bladerf *dev, bladerf_direction dir, unsigned int *timeout)
API_EXPORT int CALL_CONV bladerf_stream(struct bladerf_stream *stream, bladerf_channel_layout layout)
API_EXPORT int CALL_CONV bladerf_set_stream_timeout(struct bladerf *dev, bladerf_direction dir, unsigned int timeout)
API_EXPORT int CALL_CONV bladerf_submit_stream_buffer(struct bladerf_stream *stream, void *buffer, unsigned int timeout_ms)
API_EXPORT int CALL_CONV bladerf_sync_config(struct bladerf *dev, bladerf_channel_layout layout, bladerf_format format, unsigned int num_buffers, unsigned int buffer_size, unsigned int num_transfers, unsigned int stream_timeout)
API_EXPORT int CALL_CONV bladerf_sync_tx(struct bladerf *dev, const void *samples, unsigned int num_samples, struct bladerf_metadata *metadata, unsigned int timeout_ms)
API_EXPORT int CALL_CONV bladerf_sync_rx(struct bladerf *dev, void *samples, unsigned int num_samples, struct bladerf_metadata *metadata, unsigned int timeout_ms)
API_EXPORT int CALL_CONV bladerf_write_trigger(struct bladerf *dev, bladerf_channel ch, bladerf_trigger_signal signal, uint8_t val)
API_EXPORT int CALL_CONV bladerf_read_trigger(struct bladerf *dev, bladerf_channel ch, bladerf_trigger_signal signal, uint8_t *val)
API_EXPORT int CALL_CONV bladerf_trigger_arm(struct bladerf *dev, const struct bladerf_trigger *trigger, bool arm, uint64_t resv1, uint64_t resv2)
API_EXPORT int CALL_CONV bladerf_trigger_init(struct bladerf *dev, bladerf_channel ch, bladerf_trigger_signal signal, struct bladerf_trigger *trigger)
API_EXPORT int CALL_CONV bladerf_trigger_state(struct bladerf *dev, const struct bladerf_trigger *trigger, bool *is_armed, bool *has_fired, bool *fire_requested, uint64_t *resv1, uint64_t *resv2)
API_EXPORT int CALL_CONV bladerf_trigger_fire(struct bladerf *dev, const struct bladerf_trigger *trigger)
bladerf_trigger_role
Definition: libbladeRF.h:1567
bladerf_trigger_signal
Definition: libbladeRF.h:1606
@ BLADERF_TRIGGER_ROLE_INVALID
Definition: libbladeRF.h:1569
@ BLADERF_TRIGGER_ROLE_MASTER
Definition: libbladeRF.h:1581
@ BLADERF_TRIGGER_ROLE_DISABLED
Definition: libbladeRF.h:1575
@ BLADERF_TRIGGER_ROLE_SLAVE
Definition: libbladeRF.h:1588
@ BLADERF_TRIGGER_USER_4
Definition: libbladeRF.h:1616
@ BLADERF_TRIGGER_USER_1
Definition: libbladeRF.h:1613
@ BLADERF_TRIGGER_USER_5
Definition: libbladeRF.h:1617
@ BLADERF_TRIGGER_USER_2
Definition: libbladeRF.h:1614
@ BLADERF_TRIGGER_USER_7
Definition: libbladeRF.h:1619
@ BLADERF_TRIGGER_MINI_EXP_1
Definition: libbladeRF.h:1610
@ BLADERF_TRIGGER_USER_0
Definition: libbladeRF.h:1612
@ BLADERF_TRIGGER_USER_3
Definition: libbladeRF.h:1615
@ BLADERF_TRIGGER_J51_1
Definition: libbladeRF.h:1609
@ BLADERF_TRIGGER_USER_6
Definition: libbladeRF.h:1618
@ BLADERF_TRIGGER_J71_4
Definition: libbladeRF.h:1608
@ BLADERF_TRIGGER_INVALID
Definition: libbladeRF.h:1607
API_EXPORT int CALL_CONV bladerf_set_tuning_mode(struct bladerf *dev, bladerf_tuning_mode mode)
bladerf_tuning_mode
Definition: libbladeRF.h:3700
API_EXPORT int CALL_CONV bladerf_get_tuning_mode(struct bladerf *dev, bladerf_tuning_mode *mode)
@ BLADERF_TUNING_MODE_FPGA
Definition: libbladeRF.h:3711
@ BLADERF_TUNING_MODE_INVALID
Definition: libbladeRF.h:3702
@ BLADERF_TUNING_MODE_HOST
Definition: libbladeRF.h:3708
API_EXPORT int CALL_CONV bladerf_get_frequency(struct bladerf *dev, bladerf_channel ch, bladerf_frequency *frequency)
API_EXPORT int CALL_CONV bladerf_set_frequency(struct bladerf *dev, bladerf_channel ch, bladerf_frequency frequency)
uint64_t bladerf_frequency
Definition: libbladeRF.h:1229
API_EXPORT int CALL_CONV bladerf_select_band(struct bladerf *dev, bladerf_channel ch, bladerf_frequency frequency)
API_EXPORT int CALL_CONV bladerf_get_frequency_range(struct bladerf *dev, bladerf_channel ch, const struct bladerf_range **range)
API_EXPORT int CALL_CONV bladerf_set_vctcxo_tamer_mode(struct bladerf *dev, bladerf_vctcxo_tamer_mode mode)
API_EXPORT int CALL_CONV bladerf_get_vctcxo_tamer_mode(struct bladerf *dev, bladerf_vctcxo_tamer_mode *mode)
bladerf_vctcxo_tamer_mode
Definition: libbladeRF.h:3580
@ BLADERF_VCTCXO_TAMER_DISABLED
Definition: libbladeRF.h:3585
@ BLADERF_VCTCXO_TAMER_INVALID
Definition: libbladeRF.h:3582
@ BLADERF_VCTCXO_TAMER_1_PPS
Definition: libbladeRF.h:3588
@ BLADERF_VCTCXO_TAMER_10_MHZ
Definition: libbladeRF.h:3591
API_EXPORT int CALL_CONV bladerf_trim_dac_read(struct bladerf *dev, uint16_t *val)
API_EXPORT int CALL_CONV bladerf_trim_dac_write(struct bladerf *dev, uint16_t val)
API_EXPORT int CALL_CONV bladerf_get_vctcxo_trim(struct bladerf *dev, uint16_t *trim)
API_EXPORT int CALL_CONV bladerf_wishbone_master_read(struct bladerf *dev, uint32_t addr, uint32_t *data)
API_EXPORT int CALL_CONV bladerf_wishbone_master_write(struct bladerf *dev, uint32_t addr, uint32_t val)
API_EXPORT int CALL_CONV bladerf_expansion_attach(struct bladerf *dev, bladerf_xb xb)
API_EXPORT int CALL_CONV bladerf_expansion_get_attached(struct bladerf *dev, bladerf_xb *xb)
bladerf_xb
Definition: libbladeRF.h:4384
@ BLADERF_XB_200
Definition: libbladeRF.h:4390
@ BLADERF_XB_NONE
Definition: libbladeRF.h:4385
@ BLADERF_XB_300
Definition: libbladeRF.h:4391
@ BLADERF_XB_100
Definition: libbladeRF.h:4386
API_EXPORT const char *CALL_CONV bladerf_strerror(int error)
API_EXPORT int CALL_CONV bladerf_interleave_stream_buffer(bladerf_channel_layout layout, bladerf_format format, unsigned int buffer_size, void *samples)
bladerf_format
Definition: libbladeRF.h:2085
API_EXPORT const char *CALL_CONV bladerf_format_to_string(bladerf_format format)
API_EXPORT int CALL_CONV bladerf_deinterleave_stream_buffer(bladerf_channel_layout layout, bladerf_format format, unsigned int buffer_size, void *samples)
@ BLADERF_FORMAT_SC8_Q7
Definition: libbladeRF.h:2302
@ BLADERF_FORMAT_SC16_Q11_META
Definition: libbladeRF.h:2198
@ BLADERF_FORMAT_PACKET_META
Definition: libbladeRF.h:2246
@ BLADERF_FORMAT_SC16_Q11
Definition: libbladeRF.h:2141
@ BLADERF_FORMAT_SC8_Q7_META
Definition: libbladeRF.h:2343
@ BLADERF_FORMAT_SC16_Q11_PACKED
Signed, Complex 16-bit Q11 using a 12-bit Q11 intermediate format.
Definition: libbladeRF.h:2157
uint64_t bladerf_timestamp
Definition: libbladeRF.h:1818
API_EXPORT int CALL_CONV bladerf_enable_module(struct bladerf *dev, bladerf_channel ch, bool enable)
API_EXPORT int CALL_CONV bladerf_get_timestamp(struct bladerf *dev, bladerf_direction dir, bladerf_timestamp *timestamp)
#define API_EXPORT
Definition: libbladeRF.h:82
#define CALL_CONV
Definition: libbladeRF.h:85
unsigned int instance
Definition: libbladeRF.h:136
uint8_t usb_addr
Definition: libbladeRF.h:135
char product[BLADERF_DESCRIPTION_LENGTH]
Definition: libbladeRF.h:140
bladerf_backend backend
Definition: libbladeRF.h:131
char serial[BLADERF_SERIAL_LENGTH]
Definition: libbladeRF.h:133
char manufacturer[BLADERF_DESCRIPTION_LENGTH]
Definition: libbladeRF.h:139
uint8_t usb_bus
Definition: libbladeRF.h:134
Individual gain calibration entry. Each entry associates a frequency with a corresponding gain correc...
Definition: libbladeRF.h:4220
bladerf_frequency freq
Definition: libbladeRF.h:4221
double gain_corr
Definition: libbladeRF.h:4222
Gain calibration table. The table contains a series of entries, each associating a frequency with a g...
Definition: libbladeRF.h:4230
struct bladerf_gain_cal_entry * entries
Definition: libbladeRF.h:4237
struct bladerf_version version
Definition: libbladeRF.h:4231
bladerf_frequency stop_freq
Definition: libbladeRF.h:4236
bladerf_frequency start_freq
Definition: libbladeRF.h:4235
bladerf_gain gain_target
Definition: libbladeRF.h:4238
enum bladerf_gain_cal_tbl::gain_cal_state state
bladerf_channel ch
Definition: libbladeRF.h:4232
const char * name
Definition: libbladeRF.h:808
bladerf_gain_mode mode
Definition: libbladeRF.h:809
char reserved[BLADERF_IMAGE_RESERVED_LEN]
Definition: libbladeRF.h:3388
struct bladerf_version version
Definition: libbladeRF.h:3370
uint64_t timestamp
Definition: libbladeRF.h:3373
uint8_t checksum[BLADERF_IMAGE_CHECKSUM_LEN]
Definition: libbladeRF.h:3363
char magic[BLADERF_IMAGE_MAGIC_LEN+1]
Definition: libbladeRF.h:3357
char serial[BLADERF_SERIAL_LENGTH+1]
Definition: libbladeRF.h:3383
uint8_t * data
Definition: libbladeRF.h:3405
uint32_t address
Definition: libbladeRF.h:3399
uint32_t length
Definition: libbladeRF.h:3402
bladerf_image_type type
Definition: libbladeRF.h:3393
bladerf_loopback mode
Definition: libbladeRF.h:1384
unsigned int actual_count
Definition: libbladeRF.h:2543
uint8_t reserved[32]
Definition: libbladeRF.h:2549
bladerf_timestamp timestamp
Definition: libbladeRF.h:2505
uint16_t nios_profile
Definition: libbladeRF.h:1848
int64_t max
Definition: libbladeRF.h:395
int64_t step
Definition: libbladeRF.h:396
int64_t min
Definition: libbladeRF.h:394
char serial[BLADERF_SERIAL_LENGTH]
Definition: libbladeRF.h:404
bladerf_trigger_signal signal
Definition: libbladeRF.h:1632
bladerf_trigger_role role
Definition: libbladeRF.h:1631
bladerf_channel channel
Definition: libbladeRF.h:1630
uint64_t options
Definition: libbladeRF.h:1633
uint16_t major
Definition: libbladeRF.h:411
const char * describe
Definition: libbladeRF.h:414
uint16_t minor
Definition: libbladeRF.h:412
uint16_t patch
Definition: libbladeRF.h:413