libbladeRF: libbladeRF.h Source File

| libbladeRF 2.2.0-git 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 (0x02020000)
55
56 #ifdef __cplusplus
57 extern "C" {
58 #else
59
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_
80
82 # define API_EXPORT
83
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 {
113 BLADERF_BACKEND_ANY,
115 BLADERF_BACKEND_LINUX,
116 BLADERF_BACKEND_LIBUSB,
117 BLADERF_BACKEND_CYPRESS,
118 BLADERF_BACKEND_DUMMY = 100,
119 } bladerf_backend;
120
122 #define BLADERF_DESCRIPTION_LENGTH 33
123
125 #define BLADERF_SERIAL_LENGTH 33
126
130 struct bladerf_devinfo {
131 bladerf_backend backend;
133 char serial[BLADERF_SERIAL_LENGTH];
134 uint8_t usb_bus;
135 uint8_t usb_addr;
136 unsigned int instance;
139 char manufacturer[BLADERF_DESCRIPTION_LENGTH];
140 char product[BLADERF_DESCRIPTION_LENGTH];
141 };
142
200 API_EXPORT
201 int CALL_CONV bladerf_open(struct bladerf **device,
202 const char *device_identifier);
203
214 API_EXPORT
215 void CALL_CONV bladerf_close(struct bladerf *device);
216
238 API_EXPORT
239 int CALL_CONV bladerf_open_with_devinfo(struct bladerf **device,
240 struct bladerf_devinfo *devinfo);
241
250 API_EXPORT
251 int CALL_CONV bladerf_get_device_list(struct bladerf_devinfo **devices);
252
258 API_EXPORT
259 void CALL_CONV bladerf_free_device_list(struct bladerf_devinfo *devices);
260
269 API_EXPORT
270 void CALL_CONV bladerf_init_devinfo(struct bladerf_devinfo *info);
271
282 API_EXPORT
283 int CALL_CONV bladerf_get_devinfo(struct bladerf *dev,
284 struct bladerf_devinfo *info);
285
298 API_EXPORT
299 int CALL_CONV bladerf_get_devinfo_from_str(const char *devstr,
300 struct bladerf_devinfo *info);
301
309 API_EXPORT
310 bool CALL_CONV bladerf_devinfo_matches(const struct bladerf_devinfo *a,
311 const struct bladerf_devinfo *b);
312
323 API_EXPORT
324 bool CALL_CONV bladerf_devstr_matches(const char *dev_str,
325 struct bladerf_devinfo *info);
326
334 API_EXPORT
335 const char *CALL_CONV bladerf_backend_str(bladerf_backend backend);
336
350 API_EXPORT
351 void CALL_CONV bladerf_set_usb_reset_on_open(bool enabled);
352
369 struct bladerf_range {
370 int64_t min;
371 int64_t max;
372 int64_t step;
373 float scale;
374 };
375
379 struct bladerf_serial {
380 char serial[BLADERF_SERIAL_LENGTH];
381 };
382
386 struct bladerf_version {
387 uint16_t major;
388 uint16_t minor;
389 uint16_t patch;
390 const char *describe;
395 };
396
400 typedef enum {
401 BLADERF_FPGA_UNKNOWN = 0,
402 BLADERF_FPGA_40KLE = 40,
403 BLADERF_FPGA_115KLE = 115,
404 BLADERF_FPGA_A4 = 49,
405 BLADERF_FPGA_A9 = 301
406 } bladerf_fpga_size;
407
412 typedef enum {
413 BLADERF_DEVICE_SPEED_UNKNOWN,
414 BLADERF_DEVICE_SPEED_HIGH,
415 BLADERF_DEVICE_SPEED_SUPER
416 } bladerf_dev_speed;
417
424 typedef enum {
425 BLADERF_FPGA_SOURCE_UNKNOWN = 0,
426 BLADERF_FPGA_SOURCE_FLASH = 1,
427 BLADERF_FPGA_SOURCE_HOST = 2
428 } bladerf_fpga_source;
429
444 API_EXPORT
445 int CALL_CONV bladerf_get_serial(struct bladerf *dev, char *serial);
446
469 API_EXPORT
470 int CALL_CONV bladerf_get_serial_struct(struct bladerf *dev,
471 struct bladerf_serial *serial);
472
482 API_EXPORT
483 int CALL_CONV bladerf_get_fpga_size(struct bladerf *dev,
484 bladerf_fpga_size *size);
485
495 API_EXPORT
496 int CALL_CONV bladerf_get_fpga_bytes(struct bladerf *dev, size_t *size);
497
511 API_EXPORT
512 int CALL_CONV bladerf_get_flash_size(struct bladerf *dev,
513 uint32_t *size,
514 bool *is_guess);
515
525 API_EXPORT
526 int CALL_CONV bladerf_fw_version(struct bladerf *dev,
527 struct bladerf_version *version);
528
537 API_EXPORT
538 int CALL_CONV bladerf_is_fpga_configured(struct bladerf *dev);
539
548 API_EXPORT
549 int CALL_CONV bladerf_fpga_version(struct bladerf *dev,
550 struct bladerf_version *version);
551
566 API_EXPORT
567 int CALL_CONV bladerf_get_fpga_source(struct bladerf *dev,
568 bladerf_fpga_source *source);
569
577 API_EXPORT
578 bladerf_dev_speed CALL_CONV bladerf_device_speed(struct bladerf *dev);
579
588 API_EXPORT
589 const char *CALL_CONV bladerf_get_board_name(struct bladerf *dev);
590
624 typedef int bladerf_channel;
625
639 #define BLADERF_CHANNEL_RX(ch) (bladerf_channel)(((ch) << 1) | 0x0)
640
654 #define BLADERF_CHANNEL_TX(ch) (bladerf_channel)(((ch) << 1) | 0x1)
655
659 #define BLADERF_CHANNEL_INVALID (bladerf_channel)(-1)
660
662 #define BLADERF_DIRECTION_MASK (0x1)
663
666 /* Backwards compatible mapping to `bladerf_module`. */
667 typedef bladerf_channel bladerf_module;
668 #define BLADERF_MODULE_INVALID BLADERF_CHANNEL_INVALID
669 #define BLADERF_MODULE_RX BLADERF_CHANNEL_RX(0)
670 #define BLADERF_MODULE_TX BLADERF_CHANNEL_TX(0)
671
676 #define BLADERF_CHANNEL_IS_TX(ch) (ch & BLADERF_TX)
677
681 typedef enum {
682 BLADERF_RX = 0,
683 BLADERF_TX = 1,
684 } bladerf_direction;
685
689 typedef enum {
690 BLADERF_RX_X1 = 0,
691 BLADERF_TX_X1 = 1,
692 BLADERF_RX_X2 = 2,
693 BLADERF_TX_X2 = 3,
694 } bladerf_channel_layout;
695
704 API_EXPORT
705 size_t CALL_CONV bladerf_get_channel_count(struct bladerf *dev,
706 bladerf_direction dir);
707
723 typedef int bladerf_gain;
724
735 typedef enum {
744 BLADERF_GAIN_DEFAULT,
745
750 BLADERF_GAIN_MGC,
751
757 BLADERF_GAIN_FASTATTACK_AGC,
758
764 BLADERF_GAIN_SLOWATTACK_AGC,
765
771 BLADERF_GAIN_HYBRID_AGC,
772 } bladerf_gain_mode;
773
775 #define BLADERF_GAIN_AUTOMATIC BLADERF_GAIN_DEFAULT
776
777 #define BLADERF_GAIN_MANUAL BLADERF_GAIN_MGC
778
782 struct bladerf_gain_modes {
783 const char *name;
784 bladerf_gain_mode mode;
785 };
786
812 API_EXPORT
813 int CALL_CONV bladerf_set_gain(struct bladerf *dev,
814 bladerf_channel ch,
815 bladerf_gain gain);
816
826 API_EXPORT
827 int CALL_CONV bladerf_get_gain(struct bladerf *dev,
828 bladerf_channel ch,
829 bladerf_gain *gain);
830
849 API_EXPORT
850 int CALL_CONV bladerf_set_gain_mode(struct bladerf *dev,
851 bladerf_channel ch,
852 bladerf_gain_mode mode);
853
867 API_EXPORT
868 int CALL_CONV bladerf_get_gain_mode(struct bladerf *dev,
869 bladerf_channel ch,
870 bladerf_gain_mode *mode);
871
890 API_EXPORT
891 int CALL_CONV bladerf_get_gain_modes(struct bladerf *dev,
892 bladerf_channel ch,
893 const struct bladerf_gain_modes **modes);
894
907 API_EXPORT
908 int CALL_CONV bladerf_get_gain_range(struct bladerf *dev,
909 bladerf_channel ch,
910 const struct bladerf_range **range);
911
924 API_EXPORT
925 int CALL_CONV bladerf_set_gain_stage(struct bladerf *dev,
926 bladerf_channel ch,
927 const char *stage,
928 bladerf_gain gain);
929
942 API_EXPORT
943 int CALL_CONV bladerf_get_gain_stage(struct bladerf *dev,
944 bladerf_channel ch,
945 const char *stage,
946 bladerf_gain *gain);
947
964 API_EXPORT
965 int CALL_CONV bladerf_get_gain_stage_range(struct bladerf *dev,
966 bladerf_channel ch,
967 const char *stage,
968 const struct bladerf_range **range);
969
984 API_EXPORT
985 int CALL_CONV bladerf_get_gain_stages(struct bladerf *dev,
986 bladerf_channel ch,
987 const char **stages,
988 size_t count);
989
1006 typedef unsigned int bladerf_sample_rate;
1007
1016 struct bladerf_rational_rate {
1017 uint64_t integer;
1018 uint64_t num;
1019 uint64_t den;
1021 };
1022
1040 API_EXPORT
1041 int CALL_CONV bladerf_set_sample_rate(struct bladerf *dev,
1042 bladerf_channel ch,
1043 bladerf_sample_rate rate,
1044 bladerf_sample_rate *actual);
1045
1060 API_EXPORT
1061 int CALL_CONV
1062 bladerf_set_rational_sample_rate(struct bladerf *dev,
1063 bladerf_channel ch,
1064 struct bladerf_rational_rate *rate,
1065 struct bladerf_rational_rate *actual);
1075 API_EXPORT
1076 int CALL_CONV bladerf_get_sample_rate(struct bladerf *dev,
1077 bladerf_channel ch,
1078 bladerf_sample_rate *rate);
1079
1089 API_EXPORT
1090 int CALL_CONV bladerf_get_sample_rate_range(struct bladerf *dev,
1091 bladerf_channel ch,
1092 const struct bladerf_range **range);
1093
1103 API_EXPORT
1104 int CALL_CONV
1105 bladerf_get_rational_sample_rate(struct bladerf *dev,
1106 bladerf_channel ch,
1107 struct bladerf_rational_rate *rate);
1108
1126 typedef unsigned int bladerf_bandwidth;
1127
1146 API_EXPORT
1147 int CALL_CONV bladerf_set_bandwidth(struct bladerf *dev,
1148 bladerf_channel ch,
1149 bladerf_bandwidth bandwidth,
1150 bladerf_bandwidth *actual);
1151
1161 API_EXPORT
1162 int CALL_CONV bladerf_get_bandwidth(struct bladerf *dev,
1163 bladerf_channel ch,
1164 bladerf_bandwidth *bandwidth);
1165
1175 API_EXPORT
1176 int CALL_CONV bladerf_get_bandwidth_range(struct bladerf *dev,
1177 bladerf_channel ch,
1178 const struct bladerf_range **range);
1179
1204 typedef uint64_t bladerf_frequency;
1205
1207 #define BLADERF_PRIuFREQ PRIu64
1208
1209 #define BLADERF_PRIxFREQ PRIx64
1210
1211 #define BLADERF_SCNuFREQ SCNu64
1212
1213 #define BLADERF_SCNxFREQ SCNx64
1214
1233 API_EXPORT
1234 int CALL_CONV bladerf_select_band(struct bladerf *dev,
1235 bladerf_channel ch,
1236 bladerf_frequency frequency);
1237
1261 API_EXPORT
1262 int CALL_CONV bladerf_set_frequency(struct bladerf *dev,
1263 bladerf_channel ch,
1264 bladerf_frequency frequency);
1274 API_EXPORT
1275 int CALL_CONV bladerf_get_frequency(struct bladerf *dev,
1276 bladerf_channel ch,
1277 bladerf_frequency *frequency);
1278
1288 API_EXPORT
1289 int CALL_CONV bladerf_get_frequency_range(struct bladerf *dev,
1290 bladerf_channel ch,
1291 const struct bladerf_range **range);
1292
1313 typedef enum {
1315 BLADERF_LB_NONE = 0,
1316
1318 BLADERF_LB_FIRMWARE,
1319
1321 BLADERF_LB_BB_TXLPF_RXVGA2,
1322
1324 BLADERF_LB_BB_TXVGA1_RXVGA2,
1325
1327 BLADERF_LB_BB_TXLPF_RXLPF,
1328
1330 BLADERF_LB_BB_TXVGA1_RXLPF,
1331
1336 BLADERF_LB_RF_LNA1,
1337
1342 BLADERF_LB_RF_LNA2,
1343
1348 BLADERF_LB_RF_LNA3,
1349
1351 BLADERF_LB_RFIC_BIST,
1352 } bladerf_loopback;
1353
1357 struct bladerf_loopback_modes {
1358 const char *name;
1359 bladerf_loopback mode;
1360 };
1361
1377 API_EXPORT
1378 int CALL_CONV bladerf_get_loopback_modes(
1379 struct bladerf *dev, const struct bladerf_loopback_modes **modes);
1380
1389 API_EXPORT bool CALL_CONV bladerf_is_loopback_mode_supported(
1390 struct bladerf *dev, bladerf_loopback mode);
1391
1405 API_EXPORT
1406 int CALL_CONV bladerf_set_loopback(struct bladerf *dev, bladerf_loopback lb);
1407
1416 API_EXPORT
1417 int CALL_CONV bladerf_get_loopback(struct bladerf *dev, bladerf_loopback *lb);
1418
1542 typedef enum {
1544 BLADERF_TRIGGER_ROLE_INVALID = -1,
1545
1550 BLADERF_TRIGGER_ROLE_DISABLED,
1551
1556 BLADERF_TRIGGER_ROLE_MASTER,
1557
1563 BLADERF_TRIGGER_ROLE_SLAVE,
1564 } bladerf_trigger_role;
1565
1581 typedef enum {
1582 BLADERF_TRIGGER_INVALID = -1,
1583 BLADERF_TRIGGER_J71_4,
1584 BLADERF_TRIGGER_J51_1,
1585 BLADERF_TRIGGER_MINI_EXP_1,
1587 BLADERF_TRIGGER_USER_0 = 128,
1588 BLADERF_TRIGGER_USER_1,
1589 BLADERF_TRIGGER_USER_2,
1590 BLADERF_TRIGGER_USER_3,
1591 BLADERF_TRIGGER_USER_4,
1592 BLADERF_TRIGGER_USER_5,
1593 BLADERF_TRIGGER_USER_6,
1594 BLADERF_TRIGGER_USER_7,
1595 } bladerf_trigger_signal;
1596
1604 struct bladerf_trigger {
1605 bladerf_channel channel;
1606 bladerf_trigger_role role;
1607 bladerf_trigger_signal signal;
1608 uint64_t options;
1610 };
1611
1627 API_EXPORT
1628 int CALL_CONV bladerf_trigger_init(struct bladerf *dev,
1629 bladerf_channel ch,
1630 bladerf_trigger_signal signal,
1631 struct bladerf_trigger *trigger);
1632
1653 API_EXPORT
1654 int CALL_CONV bladerf_trigger_arm(struct bladerf *dev,
1655 const struct bladerf_trigger *trigger,
1656 bool arm,
1657 uint64_t resv1,
1658 uint64_t resv2);
1659
1671 API_EXPORT
1672 int CALL_CONV bladerf_trigger_fire(struct bladerf *dev,
1673 const struct bladerf_trigger *trigger);
1674
1694 API_EXPORT
1695 int CALL_CONV bladerf_trigger_state(struct bladerf *dev,
1696 const struct bladerf_trigger *trigger,
1697 bool *is_armed,
1698 bool *has_fired,
1699 bool *fire_requested,
1700 uint64_t *resv1,
1701 uint64_t *resv2);
1702
1719 typedef enum {
1721 BLADERF_RX_MUX_INVALID = -1,
1722
1724 BLADERF_RX_MUX_BASEBAND = 0x0,
1725
1731 BLADERF_RX_MUX_12BIT_COUNTER = 0x1,
1732
1738 BLADERF_RX_MUX_32BIT_COUNTER = 0x2,
1739
1740 /* RX_MUX setting 0x3 is reserved for future use */
1741
1743 BLADERF_RX_MUX_DIGITAL_LOOPBACK = 0x4,
1744 } bladerf_rx_mux;
1745
1747 /* Backwards compatible mapping for `bladerf_rx_mux`. */
1748 #define BLADERF_RX_MUX_BASEBAND_LMS BLADERF_RX_MUX_BASEBAND
1749
1759 API_EXPORT
1760 int CALL_CONV bladerf_set_rx_mux(struct bladerf *dev, bladerf_rx_mux mux);
1761
1770 API_EXPORT
1771 int CALL_CONV bladerf_get_rx_mux(struct bladerf *dev, bladerf_rx_mux *mode);
1772
1793 typedef uint64_t bladerf_timestamp;
1794
1799 #define BLADERF_RETUNE_NOW (bladerf_timestamp)0
1800
1810 struct bladerf_quick_tune {
1811 union {
1812 /* bladeRF1 quick tune parameters */
1813 struct {
1814 uint8_t freqsel;
1815 uint8_t vcocap;
1816 uint16_t nint;
1817 uint32_t nfrac;
1818 uint8_t flags;
1819 };
1820 /* bladeRF2 quick tune parameters */
1821 struct {
1822 uint16_t nios_profile;
1823 uint8_t rffe_profile;
1824 uint8_t port;
1825 uint8_t spdt;
1826 };
1827 };
1828 };
1829
1859 API_EXPORT
1860 int CALL_CONV bladerf_schedule_retune(struct bladerf *dev,
1861 bladerf_channel ch,
1862 bladerf_timestamp timestamp,
1863 bladerf_frequency frequency,
1864 struct bladerf_quick_tune *quick_tune);
1865
1878 API_EXPORT
1879 int CALL_CONV bladerf_cancel_scheduled_retunes(struct bladerf *dev,
1880 bladerf_channel ch);
1881
1902 API_EXPORT
1903 int CALL_CONV bladerf_get_quick_tune(struct bladerf *dev,
1904 bladerf_channel ch,
1905 struct bladerf_quick_tune *quick_tune);
1906
1927 typedef int16_t bladerf_correction_value;
1928
1938 typedef enum {
1943 BLADERF_CORR_DCOFF_I,
1944
1949 BLADERF_CORR_DCOFF_Q,
1950
1955 BLADERF_CORR_PHASE,
1956
1961 BLADERF_CORR_GAIN
1962 } bladerf_correction;
1963
1965 /* Backwards compatible mapping to `bladerf_correction`. */
1966 #define BLADERF_CORR_LMS_DCOFF_I BLADERF_CORR_DCOFF_I
1967 #define BLADERF_CORR_LMS_DCOFF_Q BLADERF_CORR_DCOFF_Q
1968 #define BLADERF_CORR_FPGA_PHASE BLADERF_CORR_PHASE
1969 #define BLADERF_CORR_FPGA_GAIN BLADERF_CORR_GAIN
1970
1985 API_EXPORT
1986 int CALL_CONV bladerf_set_correction(struct bladerf *dev,
1987 bladerf_channel ch,
1988 bladerf_correction corr,
1989 bladerf_correction_value value);
1990
2001 API_EXPORT
2002 int CALL_CONV bladerf_get_correction(struct bladerf *dev,
2003 bladerf_channel ch,
2004 bladerf_correction corr,
2005 bladerf_correction_value *value);
2006
2020 #define BLADERF_PRIuTS PRIu64
2021
2022 #define BLADERF_PRIxTS PRIx64
2023
2024 #define BLADERF_SCNuTS SCNu64
2025
2026 #define BLADERF_SCNxTS SCNx64
2027
2039 typedef enum {
2095 BLADERF_FORMAT_SC16_Q11,
2096
2131 BLADERF_FORMAT_SC16_Q11_META,
2132 } bladerf_format;
2133
2140 /*
2141 * Metadata status bits
2142 *
2143 * These are used in conjunction with the bladerf_metadata structure's `status`
2144 * field.
2145 */
2146
2153 #define BLADERF_META_STATUS_OVERRUN (1 << 0)
2154
2163 #define BLADERF_META_STATUS_UNDERRUN (1 << 1)
2164
2165 /*
2166 * Metadata flags
2167 *
2168 * These are used in conjunction with the bladerf_metadata structure's `flags`
2169 * field.
2170 */
2171
2186 #define BLADERF_META_FLAG_TX_BURST_START (1 << 0)
2187
2214 #define BLADERF_META_FLAG_TX_BURST_END (1 << 1)
2215
2224 #define BLADERF_META_FLAG_TX_NOW (1 << 2)
2225
2244 #define BLADERF_META_FLAG_TX_UPDATE_TIMESTAMP (1 << 3)
2245
2251 #define BLADERF_META_FLAG_RX_NOW (1 << 31)
2252
2257 #define BLADERF_META_FLAG_RX_HW_UNDERFLOW (1 << 0)
2258
2263 #define BLADERF_META_FLAG_RX_HW_MINIEXP1 (1 << 16)
2264
2269 #define BLADERF_META_FLAG_RX_HW_MINIEXP2 (1 << 17)
2270
2278 struct bladerf_metadata {
2283 bladerf_timestamp timestamp;
2284
2297 uint32_t flags;
2298
2306 uint32_t status;
2307
2321 unsigned int actual_count;
2322
2327 uint8_t reserved[32];
2328 };
2329
2376 API_EXPORT
2377 int CALL_CONV bladerf_interleave_stream_buffer(bladerf_channel_layout layout,
2378 bladerf_format format,
2379 unsigned int buffer_size,
2380 void *samples);
2381
2404 API_EXPORT
2405 int CALL_CONV bladerf_deinterleave_stream_buffer(bladerf_channel_layout layout,
2406 bladerf_format format,
2407 unsigned int buffer_size,
2408 void *samples);
2409
2432 API_EXPORT
2433 int CALL_CONV bladerf_enable_module(struct bladerf *dev,
2434 bladerf_channel ch,
2435 bool enable);
2436
2478 API_EXPORT
2479 int CALL_CONV bladerf_get_timestamp(struct bladerf *dev,
2480 bladerf_direction dir,
2481 bladerf_timestamp *timestamp);
2482
2552 API_EXPORT
2553 int CALL_CONV bladerf_sync_config(struct bladerf *dev,
2554 bladerf_channel_layout layout,
2555 bladerf_format format,
2556 unsigned int num_buffers,
2557 unsigned int buffer_size,
2558 unsigned int num_transfers,
2559 unsigned int stream_timeout);
2560
2594 API_EXPORT
2595 int CALL_CONV bladerf_sync_tx(struct bladerf *dev,
2596 const void *samples,
2597 unsigned int num_samples,
2598 struct bladerf_metadata *metadata,
2599 unsigned int timeout_ms);
2600
2634 API_EXPORT
2635 int CALL_CONV bladerf_sync_rx(struct bladerf *dev,
2636 void *samples,
2637 unsigned int num_samples,
2638 struct bladerf_metadata *metadata,
2639 unsigned int timeout_ms);
2640
2641
2664 #define BLADERF_STREAM_SHUTDOWN (NULL)
2665
2671 #define BLADERF_STREAM_NO_DATA ((void *)(-1))
2672
2674 struct bladerf_stream;
2675
2723 typedef void *(*bladerf_stream_cb)(struct bladerf *dev,
2724 struct bladerf_stream *stream,
2725 struct bladerf_metadata *meta,
2726 void *samples,
2727 size_t num_samples,
2728 void *user_data);
2729
2792 API_EXPORT
2793 int CALL_CONV bladerf_init_stream(struct bladerf_stream **stream,
2794 struct bladerf *dev,
2795 bladerf_stream_cb callback,
2796 void ***buffers,
2797 size_t num_buffers,
2798 bladerf_format format,
2799 size_t samples_per_buffer,
2800 size_t num_transfers,
2801 void *user_data);
2802
2823 API_EXPORT
2824 int CALL_CONV bladerf_stream(struct bladerf_stream *stream,
2825 bladerf_channel_layout layout);
2826
2854 API_EXPORT
2855 int CALL_CONV bladerf_submit_stream_buffer(struct bladerf_stream *stream,
2856 void *buffer,
2857 unsigned int timeout_ms);
2858
2876 API_EXPORT
2877 int CALL_CONV bladerf_submit_stream_buffer_nb(struct bladerf_stream *stream,
2878 void *buffer);
2879
2880
2892 API_EXPORT
2893 void CALL_CONV bladerf_deinit_stream(struct bladerf_stream *stream);
2894
2904 API_EXPORT
2905 int CALL_CONV bladerf_set_stream_timeout(struct bladerf *dev,
2906 bladerf_direction dir,
2907 unsigned int timeout);
2908
2919 API_EXPORT
2920 int CALL_CONV bladerf_get_stream_timeout(struct bladerf *dev,
2921 bladerf_direction dir,
2922 unsigned int *timeout);
2923
2953 API_EXPORT
2954 int CALL_CONV bladerf_flash_firmware(struct bladerf *dev, const char *firmware);
2955
2966 API_EXPORT
2967 int CALL_CONV bladerf_load_fpga(struct bladerf *dev, const char *fpga);
2968
2979 API_EXPORT
2980 int CALL_CONV bladerf_flash_fpga(struct bladerf *dev, const char *fpga_image);
2981
2989 API_EXPORT
2990 int CALL_CONV bladerf_erase_stored_fpga(struct bladerf *dev);
2991
2999 API_EXPORT
3000 int CALL_CONV bladerf_device_reset(struct bladerf *dev);
3001
3011 API_EXPORT
3012 int CALL_CONV bladerf_get_fw_log(struct bladerf *dev, const char *filename);
3013
3024 API_EXPORT
3025 int CALL_CONV bladerf_jump_to_bootloader(struct bladerf *dev);
3026
3042 API_EXPORT
3043 int CALL_CONV bladerf_get_bootloader_list(struct bladerf_devinfo **list);
3044
3068 API_EXPORT
3069 int CALL_CONV bladerf_load_fw_from_bootloader(const char *device_identifier,
3070 bladerf_backend backend,
3071 uint8_t bus,
3072 uint8_t addr,
3073 const char *file);
3074
3089 typedef enum {
3090 BLADERF_IMAGE_TYPE_INVALID = -1,
3091 BLADERF_IMAGE_TYPE_RAW,
3092 BLADERF_IMAGE_TYPE_FIRMWARE,
3093 BLADERF_IMAGE_TYPE_FPGA_40KLE,
3094 BLADERF_IMAGE_TYPE_FPGA_115KLE,
3095 BLADERF_IMAGE_TYPE_CALIBRATION,
3096 BLADERF_IMAGE_TYPE_RX_DC_CAL,
3097 BLADERF_IMAGE_TYPE_TX_DC_CAL,
3098 BLADERF_IMAGE_TYPE_RX_IQ_CAL,
3099 BLADERF_IMAGE_TYPE_TX_IQ_CAL,
3100 } bladerf_image_type;
3101
3103 #define BLADERF_IMAGE_MAGIC_LEN 7
3104
3106 #define BLADERF_IMAGE_CHECKSUM_LEN 32
3107
3109 #define BLADERF_IMAGE_RESERVED_LEN 128
3110
3122 struct bladerf_image {
3130 char magic[BLADERF_IMAGE_MAGIC_LEN + 1];
3131
3136 uint8_t checksum[BLADERF_IMAGE_CHECKSUM_LEN];
3137
3143 struct bladerf_version version;
3144
3146 uint64_t timestamp;
3147
3156 char serial[BLADERF_SERIAL_LENGTH + 1];
3157
3161 char reserved[BLADERF_IMAGE_RESERVED_LEN];
3162
3166 bladerf_image_type type;
3167
3172 uint32_t address;
3173
3175 uint32_t length;
3176
3178 uint8_t *data;
3179 };
3180
3204 API_EXPORT
3205 struct bladerf_image *CALL_CONV bladerf_alloc_image(struct bladerf *dev,
3206 bladerf_image_type type,
3207 uint32_t address,
3208 uint32_t length);
3209
3223 API_EXPORT
3224 struct bladerf_image *CALL_CONV bladerf_alloc_cal_image(
3225 struct bladerf *dev, bladerf_fpga_size fpga_size, uint16_t vctcxo_trim);
3226
3234 API_EXPORT
3235 void CALL_CONV bladerf_free_image(struct bladerf_image *image);
3236
3252 API_EXPORT
3253 int CALL_CONV bladerf_image_write(struct bladerf *dev,
3254 struct bladerf_image *image,
3255 const char *file);
3256
3278 API_EXPORT
3279 int CALL_CONV bladerf_image_read(struct bladerf_image *image, const char *file);
3280
3312 typedef enum {
3314 BLADERF_VCTCXO_TAMER_INVALID = -1,
3315
3317 BLADERF_VCTCXO_TAMER_DISABLED = 0,
3318
3320 BLADERF_VCTCXO_TAMER_1_PPS = 1,
3321
3323 BLADERF_VCTCXO_TAMER_10_MHZ = 2
3324 } bladerf_vctcxo_tamer_mode;
3325
3334 API_EXPORT
3335 int CALL_CONV bladerf_set_vctcxo_tamer_mode(struct bladerf *dev,
3336 bladerf_vctcxo_tamer_mode mode);
3337
3348 API_EXPORT
3349 int CALL_CONV bladerf_get_vctcxo_tamer_mode(struct bladerf *dev,
3350 bladerf_vctcxo_tamer_mode *mode);
3351
3372 API_EXPORT
3373 int CALL_CONV bladerf_get_vctcxo_trim(struct bladerf *dev, uint16_t *trim);
3374
3385 API_EXPORT
3386 int CALL_CONV bladerf_trim_dac_write(struct bladerf *dev, uint16_t val);
3387
3402 API_EXPORT
3403 int CALL_CONV bladerf_trim_dac_read(struct bladerf *dev, uint16_t *val);
3404
3436 typedef enum {
3438 BLADERF_TUNING_MODE_INVALID = -1,
3439
3444 BLADERF_TUNING_MODE_HOST,
3445
3447 BLADERF_TUNING_MODE_FPGA,
3448 } bladerf_tuning_mode;
3449
3459 API_EXPORT
3460 int CALL_CONV bladerf_set_tuning_mode(struct bladerf *dev,
3461 bladerf_tuning_mode mode);
3462
3471 API_EXPORT
3472 int CALL_CONV bladerf_get_tuning_mode(struct bladerf *dev,
3473 bladerf_tuning_mode *mode);
3474
3497 #define BLADERF_TRIGGER_REG_ARM ((uint8_t)(1 << 0))
3498
3508 #define BLADERF_TRIGGER_REG_FIRE ((uint8_t)(1 << 1))
3509
3518 #define BLADERF_TRIGGER_REG_MASTER ((uint8_t)(1 << 2))
3519
3526 #define BLADERF_TRIGGER_REG_LINE ((uint8_t)(1 << 3))
3527
3540 API_EXPORT
3541 int CALL_CONV bladerf_read_trigger(struct bladerf *dev,
3542 bladerf_channel ch,
3543 bladerf_trigger_signal signal,
3544 uint8_t *val);
3545
3557 API_EXPORT
3558 int CALL_CONV bladerf_write_trigger(struct bladerf *dev,
3559 bladerf_channel ch,
3560 bladerf_trigger_signal signal,
3561 uint8_t val);
3562
3584 API_EXPORT
3585 int CALL_CONV bladerf_config_gpio_read(struct bladerf *dev, uint32_t *val);
3586
3599 API_EXPORT
3600 int CALL_CONV bladerf_config_gpio_write(struct bladerf *dev, uint32_t val);
3601
3637 API_EXPORT
3638 int CALL_CONV bladerf_erase_flash(struct bladerf *dev,
3639 uint32_t erase_block,
3640 uint32_t count);
3641
3655 API_EXPORT
3656 int CALL_CONV bladerf_erase_flash_bytes(struct bladerf *dev,
3657 uint32_t address,
3658 uint32_t length);
3659
3679 API_EXPORT
3680 int CALL_CONV bladerf_read_flash(struct bladerf *dev,
3681 uint8_t *buf,
3682 uint32_t page,
3683 uint32_t count);
3684
3700 API_EXPORT
3701 int CALL_CONV bladerf_read_flash_bytes(struct bladerf *dev,
3702 uint8_t *buf,
3703 uint32_t address,
3704 uint32_t bytes);
3705
3724 API_EXPORT
3725 int CALL_CONV bladerf_write_flash(struct bladerf *dev,
3726 const uint8_t *buf,
3727 uint32_t page,
3728 uint32_t count);
3729
3744 API_EXPORT
3745 int CALL_CONV bladerf_write_flash_bytes(struct bladerf *dev,
3746 const uint8_t *buf,
3747 uint32_t address,
3748 uint32_t length);
3749
3772 API_EXPORT
3773 int CALL_CONV bladerf_set_rf_port(struct bladerf *dev,
3774 bladerf_channel ch,
3775 const char *port);
3776
3786 API_EXPORT
3787 int CALL_CONV bladerf_get_rf_port(struct bladerf *dev,
3788 bladerf_channel ch,
3789 const char **port);
3790
3805 API_EXPORT
3806 int CALL_CONV bladerf_get_rf_ports(struct bladerf *dev,
3807 bladerf_channel ch,
3808 const char **ports,
3809 unsigned int count);
3810
3836 typedef enum {
3837 BLADERF_XB_NONE = 0,
3838 BLADERF_XB_100,
3842 BLADERF_XB_200,
3843 BLADERF_XB_300
3844 } bladerf_xb;
3845
3854 API_EXPORT
3855 int CALL_CONV bladerf_expansion_attach(struct bladerf *dev, bladerf_xb xb);
3856
3865 API_EXPORT
3866 int CALL_CONV bladerf_expansion_get_attached(struct bladerf *dev,
3867 bladerf_xb *xb);
3868
3885 typedef enum {
3886 BLADERF_LOG_LEVEL_VERBOSE,
3887 BLADERF_LOG_LEVEL_DEBUG,
3888 BLADERF_LOG_LEVEL_INFO,
3889 BLADERF_LOG_LEVEL_WARNING,
3890 BLADERF_LOG_LEVEL_ERROR,
3891 BLADERF_LOG_LEVEL_CRITICAL,
3892 BLADERF_LOG_LEVEL_SILENT
3893 } bladerf_log_level;
3894
3903 API_EXPORT
3904 void CALL_CONV bladerf_log_set_verbosity(bladerf_log_level level);
3905
3919 API_EXPORT
3920 void CALL_CONV bladerf_version(struct bladerf_version *version);
3921
3940 // clang-format off
3941 #define BLADERF_ERR_UNEXPECTED (-1)
3942 #define BLADERF_ERR_RANGE (-2)
3943 #define BLADERF_ERR_INVAL (-3)
3944 #define BLADERF_ERR_MEM (-4)
3945 #define BLADERF_ERR_IO (-5)
3946 #define BLADERF_ERR_TIMEOUT (-6)
3947 #define BLADERF_ERR_NODEV (-7)
3948 #define BLADERF_ERR_UNSUPPORTED (-8)
3949 #define BLADERF_ERR_MISALIGNED (-9)
3950 #define BLADERF_ERR_CHECKSUM (-10)
3951 #define BLADERF_ERR_NO_FILE (-11)
3952 #define BLADERF_ERR_UPDATE_FPGA (-12)
3953 #define BLADERF_ERR_UPDATE_FW (-13)
3954 #define BLADERF_ERR_TIME_PAST (-14)
3955 #define BLADERF_ERR_QUEUE_FULL (-15)
3957 #define BLADERF_ERR_FPGA_OP (-16)
3958 #define BLADERF_ERR_PERMISSION (-17)
3960 #define BLADERF_ERR_WOULD_BLOCK (-18)
3965 #define BLADERF_ERR_NOT_INIT (-19)
3967 // clang-format on
3968
3976 API_EXPORT
3977 const char *CALL_CONV bladerf_strerror(int error);
3978
3981 #include <bladeRF1.h>
3982 #include <bladeRF2.h>
3983
3984 #ifdef __cplusplus
3985 }
3986 #endif
3987
3988 #endif /* LIBBLADERF_H_ */
bladerf_image::data
uint8_t * data
Definition: libbladeRF.h:3178
bladerf_set_rx_mux
API_EXPORT int CALL_CONV bladerf_set_rx_mux(struct bladerf *dev, bladerf_rx_mux mux)
bladerf_backend_str
API_EXPORT const char *CALL_CONV bladerf_backend_str(bladerf_backend backend)
bladerf_image_read
API_EXPORT int CALL_CONV bladerf_image_read(struct bladerf_image *image, const char *file)
bladerf_get_correction
API_EXPORT int CALL_CONV bladerf_get_correction(struct bladerf *dev, bladerf_channel ch, bladerf_correction corr, bladerf_correction_value *value)
bladerf_gain_modes
Definition: libbladeRF.h:782
bladerf_gain_mode
bladerf_gain_mode
Definition: libbladeRF.h:735
BLADERF_TRIGGER_MINI_EXP_1
Definition: libbladeRF.h:1585
BLADERF_TRIGGER_USER_1
Definition: libbladeRF.h:1588
BLADERF_TRIGGER_USER_5
Definition: libbladeRF.h:1592
bladerf_get_gain_mode
API_EXPORT int CALL_CONV bladerf_get_gain_mode(struct bladerf *dev, bladerf_channel ch, bladerf_gain_mode *mode)
bladerf_get_fpga_size
API_EXPORT int CALL_CONV bladerf_get_fpga_size(struct bladerf *dev, bladerf_fpga_size *size)
bladerf_get_rx_mux
API_EXPORT int CALL_CONV bladerf_get_rx_mux(struct bladerf *dev, bladerf_rx_mux *mode)
bladerf_trigger::channel
bladerf_channel channel
Definition: libbladeRF.h:1605
bladerf_quick_tune::vcocap
uint8_t vcocap
Definition: libbladeRF.h:1815
bladerf_devinfo_matches
API_EXPORT bool CALL_CONV bladerf_devinfo_matches(const struct bladerf_devinfo *a, const struct bladerf_devinfo *b)
bladerf_devinfo::instance
unsigned int instance
Definition: libbladeRF.h:136
bladerf_get_tuning_mode
API_EXPORT int CALL_CONV bladerf_get_tuning_mode(struct bladerf *dev, bladerf_tuning_mode *mode)
bladerf_load_fpga
API_EXPORT int CALL_CONV bladerf_load_fpga(struct bladerf *dev, const char *fpga)
bladerf_quick_tune::port
uint8_t port
Definition: libbladeRF.h:1824
bladerf_version::minor
uint16_t minor
Definition: libbladeRF.h:388
BLADERF_TRIGGER_USER_4
Definition: libbladeRF.h:1591
bladerf_log_set_verbosity
API_EXPORT void CALL_CONV bladerf_log_set_verbosity(bladerf_log_level level)
bladerf_deinit_stream
API_EXPORT void CALL_CONV bladerf_deinit_stream(struct bladerf_stream *stream)
BLADERF_VCTCXO_TAMER_1_PPS
Definition: libbladeRF.h:3320
bladerf_image::magic
char magic[BLADERF_IMAGE_MAGIC_LEN+1]
Definition: libbladeRF.h:3130
bladerf_image::reserved
char reserved[BLADERF_IMAGE_RESERVED_LEN]
Definition: libbladeRF.h:3161
BLADERF_CORR_GAIN
Definition: libbladeRF.h:1961
BLADERF_BACKEND_CYPRESS
Definition: libbladeRF.h:117
bladerf_set_usb_reset_on_open
API_EXPORT void CALL_CONV bladerf_set_usb_reset_on_open(bool enabled)
bladerf_version
API_EXPORT void CALL_CONV bladerf_version(struct bladerf_version *version)
bladerf_get_gain_stage_range
API_EXPORT int CALL_CONV bladerf_get_gain_stage_range(struct bladerf *dev, bladerf_channel ch, const char *stage, const struct bladerf_range **range)
bladerf_loopback
bladerf_loopback
Definition: libbladeRF.h:1313
bladerf_image::serial
char serial[BLADERF_SERIAL_LENGTH+1]
Definition: libbladeRF.h:3156
bladerf_erase_flash
API_EXPORT int CALL_CONV bladerf_erase_flash(struct bladerf *dev, uint32_t erase_block, uint32_t count)
bladerf_interleave_stream_buffer
API_EXPORT int CALL_CONV bladerf_interleave_stream_buffer(bladerf_channel_layout layout, bladerf_format format, unsigned int buffer_size, void *samples)
bladerf_channel
int bladerf_channel
Definition: libbladeRF.h:624
BLADERF_LB_RF_LNA3
Definition: libbladeRF.h:1348
BLADERF_FPGA_UNKNOWN
Definition: libbladeRF.h:401
bladerf_get_rf_ports
API_EXPORT int CALL_CONV bladerf_get_rf_ports(struct bladerf *dev, bladerf_channel ch, const char **ports, unsigned int count)
bladerf_get_stream_timeout
API_EXPORT int CALL_CONV bladerf_get_stream_timeout(struct bladerf *dev, bladerf_direction dir, unsigned int *timeout)
bladerf_trigger::signal
bladerf_trigger_signal signal
Definition: libbladeRF.h:1607
bladerf_set_rational_sample_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)
BLADERF_RX_MUX_12BIT_COUNTER
Definition: libbladeRF.h:1731
bladerf_rx_mux
bladerf_rx_mux
Definition: libbladeRF.h:1719
bladerf_is_loopback_mode_supported
API_EXPORT bool CALL_CONV bladerf_is_loopback_mode_supported(struct bladerf *dev, bladerf_loopback mode)
bladerf_tuning_mode
bladerf_tuning_mode
Definition: libbladeRF.h:3436
bladerf_version::major
uint16_t major
Definition: libbladeRF.h:387
BLADERF_GAIN_SLOWATTACK_AGC
Definition: libbladeRF.h:764
bladerf_devstr_matches
API_EXPORT bool CALL_CONV bladerf_devstr_matches(const char *dev_str, struct bladerf_devinfo *info)
bladerf_get_loopback_modes
API_EXPORT int CALL_CONV bladerf_get_loopback_modes(struct bladerf *dev, const struct bladerf_loopback_modes **modes)
BLADERF_XB_100
Definition: libbladeRF.h:3838
bladerf_fpga_source
bladerf_fpga_source
Definition: libbladeRF.h:424
bladerf_rational_rate
Definition: libbladeRF.h:1016
bladerf_quick_tune
Definition: libbladeRF.h:1810
bladerf_is_fpga_configured
API_EXPORT int CALL_CONV bladerf_is_fpga_configured(struct bladerf *dev)
BLADERF_BACKEND_LINUX
Definition: libbladeRF.h:115
bladerf_quick_tune::spdt
uint8_t spdt
Definition: libbladeRF.h:1825
bladerf_version
Definition: libbladeRF.h:386
BLADERF_LB_BB_TXLPF_RXVGA2
Definition: libbladeRF.h:1321
bladerf_timestamp
uint64_t bladerf_timestamp
Definition: libbladeRF.h:1793
bladerf_loopback_modes::mode
bladerf_loopback mode
Definition: libbladeRF.h:1359
BLADERF_IMAGE_TYPE_FPGA_115KLE
Definition: libbladeRF.h:3094
BLADERF_LB_BB_TXVGA1_RXLPF
Definition: libbladeRF.h:1330
bladerf_quick_tune::nios_profile
uint16_t nios_profile
Definition: libbladeRF.h:1822
BLADERF_GAIN_HYBRID_AGC
Definition: libbladeRF.h:771
bladerf_get_devinfo_from_str
API_EXPORT int CALL_CONV bladerf_get_devinfo_from_str(const char *devstr, struct bladerf_devinfo *info)
bladerf_image::timestamp
uint64_t timestamp
Definition: libbladeRF.h:3146
BLADERF_VCTCXO_TAMER_INVALID
Definition: libbladeRF.h:3314
bladerf_trigger_arm
API_EXPORT int CALL_CONV bladerf_trigger_arm(struct bladerf *dev, const struct bladerf_trigger *trigger, bool arm, uint64_t resv1, uint64_t resv2)
bladerf_get_sample_rate_range
API_EXPORT int CALL_CONV bladerf_get_sample_rate_range(struct bladerf *dev, bladerf_channel ch, const struct bladerf_range **range)
BLADERF_LB_RF_LNA1
Definition: libbladeRF.h:1336
bladerf_get_rf_port
API_EXPORT int CALL_CONV bladerf_get_rf_port(struct bladerf *dev, bladerf_channel ch, const char **port)
bladerf_device_speed
API_EXPORT bladerf_dev_speed CALL_CONV bladerf_device_speed(struct bladerf *dev)
bladerf_image
Definition: libbladeRF.h:3122
bladerf_get_device_list
API_EXPORT int CALL_CONV bladerf_get_device_list(struct bladerf_devinfo **devices)
bladerf_stream_cb
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:2723
BLADERF_DESCRIPTION_LENGTH
#define BLADERF_DESCRIPTION_LENGTH
Definition: libbladeRF.h:122
BLADERF_FPGA_SOURCE_FLASH
Definition: libbladeRF.h:426
bladerf_loopback_modes
Definition: libbladeRF.h:1357
bladerf_get_flash_size
API_EXPORT int CALL_CONV bladerf_get_flash_size(struct bladerf *dev, uint32_t *size, bool *is_guess)
bladerf_set_sample_rate
API_EXPORT int CALL_CONV bladerf_set_sample_rate(struct bladerf *dev, bladerf_channel ch, bladerf_sample_rate rate, bladerf_sample_rate *actual)
bladerf_strerror
API_EXPORT const char *CALL_CONV bladerf_strerror(int error)
bladerf_rational_rate::num
uint64_t num
Definition: libbladeRF.h:1018
bladerf_trigger_init
API_EXPORT int CALL_CONV bladerf_trigger_init(struct bladerf *dev, bladerf_channel ch, bladerf_trigger_signal signal, struct bladerf_trigger *trigger)
bladerf_fpga_version
API_EXPORT int CALL_CONV bladerf_fpga_version(struct bladerf *dev, struct bladerf_version *version)
bladerf_xb
bladerf_xb
Definition: libbladeRF.h:3836
bladerf_quick_tune::freqsel
uint8_t freqsel
Definition: libbladeRF.h:1814
bladerf_devinfo::manufacturer
char manufacturer[BLADERF_DESCRIPTION_LENGTH]
Definition: libbladeRF.h:139
BLADERF_FPGA_A9
Definition: libbladeRF.h:405
bladerf_get_quick_tune
API_EXPORT int CALL_CONV bladerf_get_quick_tune(struct bladerf *dev, bladerf_channel ch, struct bladerf_quick_tune *quick_tune)
bladerf_serial::serial
char serial[BLADERF_SERIAL_LENGTH]
Definition: libbladeRF.h:380
bladerf_devinfo::usb_bus
uint8_t usb_bus
Definition: libbladeRF.h:134
bladerf_version::patch
uint16_t patch
Definition: libbladeRF.h:389
BLADERF_LOG_LEVEL_WARNING
Definition: libbladeRF.h:3889
bladerf_loopback_modes::name
const char * name
Definition: libbladeRF.h:1358
bladerf_vctcxo_tamer_mode
bladerf_vctcxo_tamer_mode
Definition: libbladeRF.h:3312
BLADERF_BACKEND_LIBUSB
Definition: libbladeRF.h:116
BLADERF_LB_BB_TXLPF_RXLPF
Definition: libbladeRF.h:1327
bladerf_trigger::options
uint64_t options
Definition: libbladeRF.h:1608
bladerf_get_rational_sample_rate
API_EXPORT int CALL_CONV bladerf_get_rational_sample_rate(struct bladerf *dev, bladerf_channel ch, struct bladerf_rational_rate *rate)
bladerf_metadata::status
uint32_t status
Definition: libbladeRF.h:2306
bladerf_cancel_scheduled_retunes
API_EXPORT int CALL_CONV bladerf_cancel_scheduled_retunes(struct bladerf *dev, bladerf_channel ch)
bladerf_set_frequency
API_EXPORT int CALL_CONV bladerf_set_frequency(struct bladerf *dev, bladerf_channel ch, bladerf_frequency frequency)
BLADERF_RX_MUX_DIGITAL_LOOPBACK
Definition: libbladeRF.h:1743
bladerf_sync_tx
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)
bladerf_erase_flash_bytes
API_EXPORT int CALL_CONV bladerf_erase_flash_bytes(struct bladerf *dev, uint32_t address, uint32_t length)
BLADERF_LOG_LEVEL_INFO
Definition: libbladeRF.h:3888
BLADERF_TUNING_MODE_FPGA
Definition: libbladeRF.h:3447
bladerf_direction
bladerf_direction
Definition: libbladeRF.h:681
BLADERF_IMAGE_TYPE_TX_IQ_CAL
Definition: libbladeRF.h:3099
BLADERF_FORMAT_SC16_Q11_META
Definition: libbladeRF.h:2131
bladerf_sample_rate
unsigned int bladerf_sample_rate
Definition: libbladeRF.h:1006
bladerf_config_gpio_write
API_EXPORT int CALL_CONV bladerf_config_gpio_write(struct bladerf *dev, uint32_t val)
bladerf_get_bandwidth_range
API_EXPORT int CALL_CONV bladerf_get_bandwidth_range(struct bladerf *dev, bladerf_channel ch, const struct bladerf_range **range)
bladerf_get_fpga_source
API_EXPORT int CALL_CONV bladerf_get_fpga_source(struct bladerf *dev, bladerf_fpga_source *source)
bladerf_quick_tune::nfrac
uint32_t nfrac
Definition: libbladeRF.h:1817
bladerf_set_bandwidth
API_EXPORT int CALL_CONV bladerf_set_bandwidth(struct bladerf *dev, bladerf_channel ch, bladerf_bandwidth bandwidth, bladerf_bandwidth *actual)
BLADERF_LOG_LEVEL_CRITICAL
Definition: libbladeRF.h:3891
BLADERF_TRIGGER_USER_3
Definition: libbladeRF.h:1590
bladerf_read_flash
API_EXPORT int CALL_CONV bladerf_read_flash(struct bladerf *dev, uint8_t *buf, uint32_t page, uint32_t count)
bladerf_image_type
bladerf_image_type
Definition: libbladeRF.h:3089
BLADERF_TRIGGER_USER_6
Definition: libbladeRF.h:1593
BLADERF_GAIN_MGC
Definition: libbladeRF.h:750
BLADERF_TUNING_MODE_HOST
Definition: libbladeRF.h:3444
bladerf_image_write
API_EXPORT int CALL_CONV bladerf_image_write(struct bladerf *dev, struct bladerf_image *image, const char *file)
BLADERF_TX_X1
Definition: libbladeRF.h:691
bladerf_range::scale
float scale
Definition: libbladeRF.h:373
BLADERF_TRIGGER_ROLE_DISABLED
Definition: libbladeRF.h:1550
bladerf_read_trigger
API_EXPORT int CALL_CONV bladerf_read_trigger(struct bladerf *dev, bladerf_channel ch, bladerf_trigger_signal signal, uint8_t *val)
BLADERF_LOG_LEVEL_DEBUG
Definition: libbladeRF.h:3887
bladerf_trigger_fire
API_EXPORT int CALL_CONV bladerf_trigger_fire(struct bladerf *dev, const struct bladerf_trigger *trigger)
bladerf_jump_to_bootloader
API_EXPORT int CALL_CONV bladerf_jump_to_bootloader(struct bladerf *dev)
BLADERF_XB_300
Definition: libbladeRF.h:3843
bladerf_get_vctcxo_tamer_mode
API_EXPORT int CALL_CONV bladerf_get_vctcxo_tamer_mode(struct bladerf *dev, bladerf_vctcxo_tamer_mode *mode)
BLADERF_IMAGE_TYPE_TX_DC_CAL
Definition: libbladeRF.h:3097
bladerf_read_flash_bytes
API_EXPORT int CALL_CONV bladerf_read_flash_bytes(struct bladerf *dev, uint8_t *buf, uint32_t address, uint32_t bytes)
bladerf_fpga_size
bladerf_fpga_size
Definition: libbladeRF.h:400
bladerf_flash_firmware
API_EXPORT int CALL_CONV bladerf_flash_firmware(struct bladerf *dev, const char *firmware)
bladerf_set_gain_mode
API_EXPORT int CALL_CONV bladerf_set_gain_mode(struct bladerf *dev, bladerf_channel ch, bladerf_gain_mode mode)
BLADERF_RX_MUX_BASEBAND
Definition: libbladeRF.h:1724
BLADERF_TRIGGER_INVALID
Definition: libbladeRF.h:1582
BLADERF_XB_NONE
Definition: libbladeRF.h:3837
BLADERF_RX_X2
Definition: libbladeRF.h:692
BLADERF_LOG_LEVEL_SILENT
Definition: libbladeRF.h:3892
BLADERF_FPGA_A4
Definition: libbladeRF.h:404
BLADERF_TRIGGER_ROLE_INVALID
Definition: libbladeRF.h:1544
bladerf_frequency
uint64_t bladerf_frequency
Definition: libbladeRF.h:1204
bladerf_flash_fpga
API_EXPORT int CALL_CONV bladerf_flash_fpga(struct bladerf *dev, const char *fpga_image)
bladerf_get_bootloader_list
API_EXPORT int CALL_CONV bladerf_get_bootloader_list(struct bladerf_devinfo **list)
BLADERF_CORR_DCOFF_I
Definition: libbladeRF.h:1943
bladerf_schedule_retune
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)
bladerf_format
bladerf_format
Definition: libbladeRF.h:2039
bladerf_devinfo::usb_addr
uint8_t usb_addr
Definition: libbladeRF.h:135
bladerf_backend
bladerf_backend
Definition: libbladeRF.h:112
bladerf_alloc_cal_image
API_EXPORT struct bladerf_image *CALL_CONV bladerf_alloc_cal_image(struct bladerf *dev, bladerf_fpga_size fpga_size, uint16_t vctcxo_trim)
BLADERF_LOG_LEVEL_ERROR
Definition: libbladeRF.h:3890
bladerf_bandwidth
unsigned int bladerf_bandwidth
Definition: libbladeRF.h:1126
bladerf_set_loopback
API_EXPORT int CALL_CONV bladerf_set_loopback(struct bladerf *dev, bladerf_loopback lb)
bladerf_set_gain
API_EXPORT int CALL_CONV bladerf_set_gain(struct bladerf *dev, bladerf_channel ch, bladerf_gain gain)
bladerf_get_board_name
API_EXPORT const char *CALL_CONV bladerf_get_board_name(struct bladerf *dev)
BLADERF_IMAGE_CHECKSUM_LEN
#define BLADERF_IMAGE_CHECKSUM_LEN
Definition: libbladeRF.h:3106
bladerf_set_gain_stage
API_EXPORT int CALL_CONV bladerf_set_gain_stage(struct bladerf *dev, bladerf_channel ch, const char *stage, bladerf_gain gain)
BLADERF_RX_MUX_INVALID
Definition: libbladeRF.h:1721
bladerf_device_reset
API_EXPORT int CALL_CONV bladerf_device_reset(struct bladerf *dev)
bladerf_rational_rate::den
uint64_t den
Definition: libbladeRF.h:1019
bladerf_get_channel_count
API_EXPORT size_t CALL_CONV bladerf_get_channel_count(struct bladerf *dev, bladerf_direction dir)
BLADERF_LB_BB_TXVGA1_RXVGA2
Definition: libbladeRF.h:1324
bladerf_set_vctcxo_tamer_mode
API_EXPORT int CALL_CONV bladerf_set_vctcxo_tamer_mode(struct bladerf *dev, bladerf_vctcxo_tamer_mode mode)
BLADERF_LB_FIRMWARE
Definition: libbladeRF.h:1318
bladerf_submit_stream_buffer_nb
API_EXPORT int CALL_CONV bladerf_submit_stream_buffer_nb(struct bladerf_stream *stream, void *buffer)
bladerf_log_level
bladerf_log_level
Definition: libbladeRF.h:3885
BLADERF_RX
Definition: libbladeRF.h:682
bladerf_get_gain_range
API_EXPORT int CALL_CONV bladerf_get_gain_range(struct bladerf *dev, bladerf_channel ch, const struct bladerf_range **range)
bladerf_open
API_EXPORT int CALL_CONV bladerf_open(struct bladerf **device, const char *device_identifier)
bladerf_devinfo::product
char product[BLADERF_DESCRIPTION_LENGTH]
Definition: libbladeRF.h:140
bladerf_expansion_get_attached
API_EXPORT int CALL_CONV bladerf_expansion_get_attached(struct bladerf *dev, bladerf_xb *xb)
bladerf_init_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)
bladerf_image::checksum
uint8_t checksum[BLADERF_IMAGE_CHECKSUM_LEN]
Definition: libbladeRF.h:3136
bladerf_get_devinfo
API_EXPORT int CALL_CONV bladerf_get_devinfo(struct bladerf *dev, struct bladerf_devinfo *info)
BLADERF_TRIGGER_J71_4
Definition: libbladeRF.h:1583
bladerf_free_image
API_EXPORT void CALL_CONV bladerf_free_image(struct bladerf_image *image)
bladerf_rational_rate::integer
uint64_t integer
Definition: libbladeRF.h:1017
BLADERF_IMAGE_RESERVED_LEN
#define BLADERF_IMAGE_RESERVED_LEN
Definition: libbladeRF.h:3109
bladerf_correction_value
int16_t bladerf_correction_value
Definition: libbladeRF.h:1927
BLADERF_CORR_DCOFF_Q
Definition: libbladeRF.h:1949
bladerf_get_frequency_range
API_EXPORT int CALL_CONV bladerf_get_frequency_range(struct bladerf *dev, bladerf_channel ch, const struct bladerf_range **range)
BLADERF_FPGA_40KLE
Definition: libbladeRF.h:402
BLADERF_IMAGE_TYPE_FIRMWARE
Definition: libbladeRF.h:3092
bladerf_stream
API_EXPORT int CALL_CONV bladerf_stream(struct bladerf_stream *stream, bladerf_channel_layout layout)
bladerf_fw_version
API_EXPORT int CALL_CONV bladerf_fw_version(struct bladerf *dev, struct bladerf_version *version)
bladerf_trigger_signal
bladerf_trigger_signal
Definition: libbladeRF.h:1581
CALL_CONV
#define CALL_CONV
Definition: libbladeRF.h:85
BLADERF_FPGA_115KLE
Definition: libbladeRF.h:403
bladerf_write_trigger
API_EXPORT int CALL_CONV bladerf_write_trigger(struct bladerf *dev, bladerf_channel ch, bladerf_trigger_signal signal, uint8_t val)
bladerf_init_devinfo
API_EXPORT void CALL_CONV bladerf_init_devinfo(struct bladerf_devinfo *info)
BLADERF_GAIN_FASTATTACK_AGC
Definition: libbladeRF.h:757
bladerf_get_vctcxo_trim
API_EXPORT int CALL_CONV bladerf_get_vctcxo_trim(struct bladerf *dev, uint16_t *trim)
BLADERF_LB_NONE
Definition: libbladeRF.h:1315
BLADERF_VCTCXO_TAMER_10_MHZ
Definition: libbladeRF.h:3323
BLADERF_IMAGE_TYPE_RAW
Definition: libbladeRF.h:3091
BLADERF_FPGA_SOURCE_UNKNOWN
Definition: libbladeRF.h:425
bladerf_trigger
Definition: libbladeRF.h:1604
bladerf_sync_config
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)
bladerf_get_serial
API_EXPORT int CALL_CONV bladerf_get_serial(struct bladerf *dev, char *serial)
bladerf_erase_stored_fpga
API_EXPORT int CALL_CONV bladerf_erase_stored_fpga(struct bladerf *dev)
bladerf_get_gain_stages
API_EXPORT int CALL_CONV bladerf_get_gain_stages(struct bladerf *dev, bladerf_channel ch, const char **stages, size_t count)
BLADERF_FPGA_SOURCE_HOST
Definition: libbladeRF.h:427
bladerf_write_flash_bytes
API_EXPORT int CALL_CONV bladerf_write_flash_bytes(struct bladerf *dev, const uint8_t *buf, uint32_t address, uint32_t length)
bladeRF2.h
bladeRF2-specific API
bladerf_get_gain
API_EXPORT int CALL_CONV bladerf_get_gain(struct bladerf *dev, bladerf_channel ch, bladerf_gain *gain)
bladerf_write_flash
API_EXPORT int CALL_CONV bladerf_write_flash(struct bladerf *dev, const uint8_t *buf, uint32_t page, uint32_t count)
bladerf_devinfo::backend
bladerf_backend backend
Definition: libbladeRF.h:131
bladerf_metadata::actual_count
unsigned int actual_count
Definition: libbladeRF.h:2321
BLADERF_BACKEND_DUMMY
Definition: libbladeRF.h:118
BLADERF_BACKEND_ANY
Definition: libbladeRF.h:113
bladerf_serial
Definition: libbladeRF.h:379
BLADERF_TRIGGER_ROLE_MASTER
Definition: libbladeRF.h:1556
bladerf_trim_dac_read
API_EXPORT int CALL_CONV bladerf_trim_dac_read(struct bladerf *dev, uint16_t *val)
bladerf_get_timestamp
API_EXPORT int CALL_CONV bladerf_get_timestamp(struct bladerf *dev, bladerf_direction dir, bladerf_timestamp *timestamp)
bladerf_select_band
API_EXPORT int CALL_CONV bladerf_select_band(struct bladerf *dev, bladerf_channel ch, bladerf_frequency frequency)
bladerf_image::address
uint32_t address
Definition: libbladeRF.h:3172
bladerf_free_device_list
API_EXPORT void CALL_CONV bladerf_free_device_list(struct bladerf_devinfo *devices)
BLADERF_TX
Definition: libbladeRF.h:683
BLADERF_TRIGGER_USER_7
Definition: libbladeRF.h:1594
BLADERF_VCTCXO_TAMER_DISABLED
Definition: libbladeRF.h:3317
bladeRF1.h
bladeRF1-specific API
BLADERF_RX_MUX_32BIT_COUNTER
Definition: libbladeRF.h:1738
BLADERF_TRIGGER_USER_2
Definition: libbladeRF.h:1589
bladerf_gain_modes::mode
bladerf_gain_mode mode
Definition: libbladeRF.h:784
API_EXPORT
#define API_EXPORT
Definition: libbladeRF.h:82
bladerf_version::describe
const char * describe
Definition: libbladeRF.h:390
bladerf_metadata::timestamp
bladerf_timestamp timestamp
Definition: libbladeRF.h:2283
BLADERF_CORR_PHASE
Definition: libbladeRF.h:1955
bladerf_alloc_image
API_EXPORT struct bladerf_image *CALL_CONV bladerf_alloc_image(struct bladerf *dev, bladerf_image_type type, uint32_t address, uint32_t length)
bladerf_metadata::reserved
uint8_t reserved[32]
Definition: libbladeRF.h:2327
BLADERF_IMAGE_TYPE_RX_IQ_CAL
Definition: libbladeRF.h:3098
bladerf_get_gain_modes
API_EXPORT int CALL_CONV bladerf_get_gain_modes(struct bladerf *dev, bladerf_channel ch, const struct bladerf_gain_modes **modes)
bladerf_get_sample_rate
API_EXPORT int CALL_CONV bladerf_get_sample_rate(struct bladerf *dev, bladerf_channel ch, bladerf_sample_rate *rate)
bladerf_trigger::role
bladerf_trigger_role role
Definition: libbladeRF.h:1606
BLADERF_IMAGE_TYPE_INVALID
Definition: libbladeRF.h:3090
bladerf_deinterleave_stream_buffer
API_EXPORT int CALL_CONV bladerf_deinterleave_stream_buffer(bladerf_channel_layout layout, bladerf_format format, unsigned int buffer_size, void *samples)
bladerf_quick_tune::rffe_profile
uint8_t rffe_profile
Definition: libbladeRF.h:1823
bladerf_get_fpga_bytes
API_EXPORT int CALL_CONV bladerf_get_fpga_bytes(struct bladerf *dev, size_t *size)
bladerf_get_frequency
API_EXPORT int CALL_CONV bladerf_get_frequency(struct bladerf *dev, bladerf_channel ch, bladerf_frequency *frequency)
BLADERF_SERIAL_LENGTH
#define BLADERF_SERIAL_LENGTH
Definition: libbladeRF.h:125
bladerf_quick_tune::nint
uint16_t nint
Definition: libbladeRF.h:1816
bladerf_config_gpio_read
API_EXPORT int CALL_CONV bladerf_config_gpio_read(struct bladerf *dev, uint32_t *val)
bladerf_set_stream_timeout
API_EXPORT int CALL_CONV bladerf_set_stream_timeout(struct bladerf *dev, bladerf_direction dir, unsigned int timeout)
bladerf_range::min
int64_t min
Definition: libbladeRF.h:370
bladerf_open_with_devinfo
API_EXPORT int CALL_CONV bladerf_open_with_devinfo(struct bladerf **device, struct bladerf_devinfo *devinfo)
bladerf_range::max
int64_t max
Definition: libbladeRF.h:371
BLADERF_GAIN_DEFAULT
Definition: libbladeRF.h:744
bladerf_gain_modes::name
const char * name
Definition: libbladeRF.h:783
bladerf_enable_module
API_EXPORT int CALL_CONV bladerf_enable_module(struct bladerf *dev, bladerf_channel ch, bool enable)
bladerf_set_tuning_mode
API_EXPORT int CALL_CONV bladerf_set_tuning_mode(struct bladerf *dev, bladerf_tuning_mode mode)
bladerf_quick_tune::flags
uint8_t flags
Definition: libbladeRF.h:1818
bladerf_get_bandwidth
API_EXPORT int CALL_CONV bladerf_get_bandwidth(struct bladerf *dev, bladerf_channel ch, bladerf_bandwidth *bandwidth)
bladerf_dev_speed
bladerf_dev_speed
Definition: libbladeRF.h:412
bladerf_metadata
Definition: libbladeRF.h:2278
bladerf_trigger_role
bladerf_trigger_role
Definition: libbladeRF.h:1542
BLADERF_TRIGGER_ROLE_SLAVE
Definition: libbladeRF.h:1563
BLADERF_RX_X1
Definition: libbladeRF.h:690
BLADERF_XB_200
Definition: libbladeRF.h:3842
bladerf_close
API_EXPORT void CALL_CONV bladerf_close(struct bladerf *device)
bladerf_image::version
struct bladerf_version version
Definition: libbladeRF.h:3143
BLADERF_LB_RFIC_BIST
Definition: libbladeRF.h:1351
BLADERF_IMAGE_TYPE_FPGA_40KLE
Definition: libbladeRF.h:3093
bladerf_get_loopback
API_EXPORT int CALL_CONV bladerf_get_loopback(struct bladerf *dev, bladerf_loopback *lb)
BLADERF_IMAGE_TYPE_RX_DC_CAL
Definition: libbladeRF.h:3096
bladerf_trigger_state
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)
BLADERF_FORMAT_SC16_Q11
Definition: libbladeRF.h:2095
bladerf_correction
bladerf_correction
Definition: libbladeRF.h:1938
BLADERF_TRIGGER_USER_0
Definition: libbladeRF.h:1587
bladerf_image::type
bladerf_image_type type
Definition: libbladeRF.h:3166
bladerf_range
Definition: libbladeRF.h:369
BLADERF_TRIGGER_J51_1
Definition: libbladeRF.h:1584
bladerf_load_fw_from_bootloader
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)
bladerf_range::step
int64_t step
Definition: libbladeRF.h:372
BLADERF_IMAGE_TYPE_CALIBRATION
Definition: libbladeRF.h:3095
bladerf_metadata::flags
uint32_t flags
Definition: libbladeRF.h:2297
bladerf_submit_stream_buffer
API_EXPORT int CALL_CONV bladerf_submit_stream_buffer(struct bladerf_stream *stream, void *buffer, unsigned int timeout_ms)
bladerf_channel_layout
bladerf_channel_layout
Definition: libbladeRF.h:689
BLADERF_TUNING_MODE_INVALID
Definition: libbladeRF.h:3438
bladerf_devinfo::serial
char serial[BLADERF_SERIAL_LENGTH]
Definition: libbladeRF.h:133
bladerf_set_correction
API_EXPORT int CALL_CONV bladerf_set_correction(struct bladerf *dev, bladerf_channel ch, bladerf_correction corr, bladerf_correction_value value)
BLADERF_LB_RF_LNA2
Definition: libbladeRF.h:1342
bladerf_set_rf_port
API_EXPORT int CALL_CONV bladerf_set_rf_port(struct bladerf *dev, bladerf_channel ch, const char *port)
bladerf_image::length
uint32_t length
Definition: libbladeRF.h:3175
BLADERF_LOG_LEVEL_VERBOSE
Definition: libbladeRF.h:3886
bladerf_sync_rx
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)
bladerf_gain
int bladerf_gain
Definition: libbladeRF.h:723
bladerf_trim_dac_write
API_EXPORT int CALL_CONV bladerf_trim_dac_write(struct bladerf *dev, uint16_t val)
bladerf_expansion_attach
API_EXPORT int CALL_CONV bladerf_expansion_attach(struct bladerf *dev, bladerf_xb xb)
bladerf_get_gain_stage
API_EXPORT int CALL_CONV bladerf_get_gain_stage(struct bladerf *dev, bladerf_channel ch, const char *stage, bladerf_gain *gain)
bladerf_get_fw_log
API_EXPORT int CALL_CONV bladerf_get_fw_log(struct bladerf *dev, const char *filename)
BLADERF_IMAGE_MAGIC_LEN
#define BLADERF_IMAGE_MAGIC_LEN
Definition: libbladeRF.h:3103
bladerf_get_serial_struct
API_EXPORT int CALL_CONV bladerf_get_serial_struct(struct bladerf *dev, struct bladerf_serial *serial)
bladerf_devinfo
Definition: libbladeRF.h:130
BLADERF_TX_X2
Definition: libbladeRF.h:693