libhackrf HackRF SDR platform library

Loading...
Searching...
No Matches
hackrf.h
1/*
2 Copyright (c) 2012-2022 Great Scott Gadgets <info@greatscottgadgets.com>
3 Copyright (c) 2012, Jared Boone <jared@sharebrained.com>
4 Copyright (c) 2013, Benjamin Vernoux <titanmkd@gmail.com>
5
6 All rights reserved.
7
8 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
9
10 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
11 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the
12 documentation and/or other materials provided with the distribution.
13 Neither the name of Great Scott Gadgets nor the names of its contributors may be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22*/
23
24#ifndef __HACKRF_H__
25#define __HACKRF_H__
26
27#include <stdint.h>
28#include <sys/types.h>
29#include <stdbool.h> // for bool
30#ifdef _WIN32
31 #define ADD_EXPORTS
32
33 /* You should define ADD_EXPORTS *only* when building the DLL. */
34 #ifdef ADD_EXPORTS
35 #define ADDAPI __declspec(dllexport)
36 #else
37 #define ADDAPI __declspec(dllimport)
38 #endif
39
40 /* Define calling convention in one place, for convenience. */
41 #define ADDCALL __cdecl
42
43#else /* _WIN32 not defined. */
44
45 #define ADDAPI
46 #define ADDCALL
47
48#endif
49
512#define SAMPLES_PER_BLOCK 8192
513
518#define BYTES_PER_BLOCK 16384
519
524#define MAX_SWEEP_RANGES 10
525
530#define HACKRF_OPERACAKE_ADDRESS_INVALID 0xFF
531
536#define HACKRF_OPERACAKE_MAX_BOARDS 8
537
542#define HACKRF_OPERACAKE_MAX_DWELL_TIMES 16
543
548#define HACKRF_OPERACAKE_MAX_FREQ_RANGES 8
549
556 enum hackrf_error {
560 HACKRF_SUCCESS = 0,
564 HACKRF_TRUE = 1,
568 HACKRF_ERROR_INVALID_PARAM = -2,
572 HACKRF_ERROR_NOT_FOUND = -5,
576 HACKRF_ERROR_BUSY = -6,
580 HACKRF_ERROR_NO_MEM = -11,
584 HACKRF_ERROR_LIBUSB = -1000,
588 HACKRF_ERROR_THREAD = -1001,
592 HACKRF_ERROR_STREAMING_THREAD_ERR = -1002,
596 HACKRF_ERROR_STREAMING_STOPPED = -1003,
600 HACKRF_ERROR_STREAMING_EXIT_CALLED = -1004,
604 HACKRF_ERROR_USB_API_VERSION = -1005,
608 HACKRF_ERROR_NOT_LAST_DEVICE = -2000,
612 HACKRF_ERROR_OTHER = -9999,
613};
614
619#define HACKRF_BOARD_REV_GSG (0x80)
620
625#define HACKRF_PLATFORM_JAWBREAKER (1 << 0)
630#define HACKRF_PLATFORM_HACKRF1_OG (1 << 1)
635#define HACKRF_PLATFORM_RAD1O (1 << 2)
640#define HACKRF_PLATFORM_HACKRF1_R9 (1 << 3)
645#define HACKRF_PLATFORM_PRALINE (1 << 4)
646
653 enum hackrf_board_id {
657 BOARD_ID_JELLYBEAN = 0,
661 BOARD_ID_JAWBREAKER = 1,
665 BOARD_ID_HACKRF1_OG = 2,
669 BOARD_ID_RAD1O = 3,
673 BOARD_ID_HACKRF1_R9 = 4,
677 BOARD_ID_PRALINE = 5,
681 BOARD_ID_UNRECOGNIZED = 0xFE,
685 BOARD_ID_UNDETECTED = 0xFF,
686};
687
692#define BOARD_ID_HACKRF_ONE (BOARD_ID_HACKRF1_OG)
697#define BOARD_ID_INVALID (BOARD_ID_UNDETECTED)
698
705 enum hackrf_board_rev {
709 BOARD_REV_HACKRF1_OLD = 0,
713 BOARD_REV_HACKRF1_R6 = 1,
717 BOARD_REV_HACKRF1_R7 = 2,
721 BOARD_REV_HACKRF1_R8 = 3,
725 BOARD_REV_HACKRF1_R9 = 4,
729 BOARD_REV_HACKRF1_R10 = 5,
730
734 BOARD_REV_PRALINE_R0_1 = 6,
738 BOARD_REV_PRALINE_R0_2 = 7,
742 BOARD_REV_PRALINE_R0_3 = 8,
746 BOARD_REV_PRALINE_R1_0 = 9,
750 BOARD_REV_PRALINE_R1_1 = 10,
754 BOARD_REV_PRALINE_R1_2 = 11,
755
759 BOARD_REV_GSG_HACKRF1_R6 = 0x81,
763 BOARD_REV_GSG_HACKRF1_R7 = 0x82,
767 BOARD_REV_GSG_HACKRF1_R8 = 0x83,
771 BOARD_REV_GSG_HACKRF1_R9 = 0x84,
775 BOARD_REV_GSG_HACKRF1_R10 = 0x85,
776
780 BOARD_REV_GSG_PRALINE_R0_1 = 0x86,
784 BOARD_REV_GSG_PRALINE_R0_2 = 0x87,
788 BOARD_REV_GSG_PRALINE_R0_3 = 0x88,
792 BOARD_REV_GSG_PRALINE_R1_0 = 0x89,
796 BOARD_REV_GSG_PRALINE_R1_1 = 0x8a,
800 BOARD_REV_GSG_PRALINE_R1_2 = 0x8b,
801
805 BOARD_REV_UNRECOGNIZED = 0xFE,
809 BOARD_REV_UNDETECTED = 0xFF,
810};
811
819 enum hackrf_usb_board_id {
823 USB_BOARD_ID_JAWBREAKER = 0x604B,
827 USB_BOARD_ID_HACKRF_ONE = 0x6089,
831 USB_BOARD_ID_RAD1O = 0xCC15,
835 USB_BOARD_ID_INVALID = 0xFFFF,
836};
837
845 enum rf_path_filter {
849 RF_PATH_FILTER_BYPASS = 0,
853 RF_PATH_FILTER_LOW_PASS = 1,
857 RF_PATH_FILTER_HIGH_PASS = 2,
858};
859
864 enum operacake_ports {
865 OPERACAKE_PA1 = 0,
866 OPERACAKE_PA2 = 1,
867 OPERACAKE_PA3 = 2,
868 OPERACAKE_PA4 = 3,
869 OPERACAKE_PB1 = 4,
870 OPERACAKE_PB2 = 5,
871 OPERACAKE_PB3 = 6,
872 OPERACAKE_PB4 = 7,
873};
874
879 enum operacake_switching_mode {
883 OPERACAKE_MODE_MANUAL,
887 OPERACAKE_MODE_FREQUENCY,
891 OPERACAKE_MODE_TIME,
892};
893
902 enum sweep_style {
906 LINEAR = 0,
910 INTERLEAVED = 1,
911};
912
918 enum p1_ctrl_signal {
919 P1_SIGNAL_TRIGGER_IN = 0,
920 P1_SIGNAL_AUX_CLK1 = 1,
921 P1_SIGNAL_CLKIN = 2,
922 P1_SIGNAL_TRIGGER_OUT = 3,
923 P1_SIGNAL_P22_CLKIN = 4,
924 P1_SIGNAL_P2_5 = 5,
925 P1_SIGNAL_NC = 6,
926 P1_SIGNAL_AUX_CLK2 = 7,
927};
928
934 enum p2_ctrl_signal {
935 P2_SIGNAL_CLK3 = 0,
936 P2_SIGNAL_TRIGGER_IN = 2,
937 P2_SIGNAL_TRIGGER_OUT = 3,
938};
939
945 enum clkin_ctrl_signal {
946 CLKIN_SIGNAL_P1 = 0,
947 CLKIN_SIGNAL_P22 = 1,
948};
949
954 typedef struct hackrf_device hackrf_device;
955
963 typedef struct {
965 hackrf_device* device;
967 uint8_t* buffer;
969 int buffer_length;
971 int valid_length;
973 void* rx_ctx;
975 void* tx_ctx;
976} hackrf_transfer;
977
982 typedef struct {
986 uint32_t part_id[2];
990 uint32_t serial_no[4];
991} read_partid_serialno_t;
992
997 typedef struct {
1001 uint32_t dwell;
1005 uint8_t port;
1006} hackrf_operacake_dwell_time;
1007
1012 typedef struct {
1016 uint16_t freq_min;
1020 uint16_t freq_max;
1024 uint8_t port;
1025} hackrf_operacake_freq_range;
1026
1031 typedef struct {
1032 bool do_update;
1033 bool change_on_mode_entry;
1034 bool enabled;
1035} hackrf_bool_user_settting;
1036
1043 typedef struct {
1044 hackrf_bool_user_settting tx;
1045 hackrf_bool_user_settting rx;
1046 hackrf_bool_user_settting off;
1047} hackrf_bias_t_user_settting_req;
1048
1053 typedef struct {
1055 uint16_t requested_mode;
1057 uint16_t request_flag;
1059 uint32_t active_mode;
1061 uint32_t m0_count;
1063 uint32_t m4_count;
1065 uint32_t num_shortfalls;
1067 uint32_t longest_shortfall;
1069 uint32_t shortfall_limit;
1071 uint32_t threshold;
1073 uint32_t next_mode;
1075 uint32_t error;
1076} hackrf_m0_state;
1077
1082 typedef struct {
1083 bool pass;
1084 char msg[4095];
1085} hackrf_selftest;
1086
1093 struct hackrf_device_list {
1097 char** serial_numbers;
1101 enum hackrf_usb_board_id* usb_board_ids;
1105 int* usb_device_index;
1106
1110 int devicecount;
1111
1115 void** usb_devices;
1119 int usb_devicecount;
1120};
1121
1122 typedef struct hackrf_device_list hackrf_device_list_t;
1123
1136 typedef int (*hackrf_sample_block_cb_fn)(hackrf_transfer* transfer);
1137
1144 typedef void (*hackrf_tx_block_complete_cb_fn)(hackrf_transfer* transfer, int);
1145
1152 typedef void (*hackrf_flush_cb_fn)(void* flush_ctx, int);
1153
1154#ifdef __cplusplus
1155 extern "C" {
1156#endif
1157
1165 extern ADDAPI int ADDCALL hackrf_init();
1166
1174 extern ADDAPI int ADDCALL hackrf_exit();
1175
1183 extern ADDAPI const char* ADDCALL hackrf_library_version();
1184
1192 extern ADDAPI const char* ADDCALL hackrf_library_release();
1193
1199 extern ADDAPI hackrf_device_list_t* ADDCALL hackrf_device_list();
1200
1209 extern ADDAPI int ADDCALL hackrf_device_list_open(
1210 hackrf_device_list_t* list,
1211 int idx,
1212 hackrf_device** device);
1213
1222 extern ADDAPI int ADDCALL hackrf_device_list_bus_sharing(
1223 hackrf_device_list_t* list,
1224 int idx);
1225
1231 extern ADDAPI void ADDCALL hackrf_device_list_free(hackrf_device_list_t* list);
1232
1239 extern ADDAPI int ADDCALL hackrf_open(hackrf_device** device);
1240
1248 extern ADDAPI int ADDCALL hackrf_open_by_serial(
1249 const char* const desired_serial_number,
1250 hackrf_device** device);
1251
1258 extern ADDAPI int ADDCALL hackrf_close(hackrf_device* device);
1259
1272 extern ADDAPI int ADDCALL hackrf_start_rx(
1273 hackrf_device* device,
1274 hackrf_sample_block_cb_fn callback,
1275 void* rx_ctx);
1276
1284 extern ADDAPI int ADDCALL hackrf_stop_rx(hackrf_device* device);
1285
1300 extern ADDAPI int ADDCALL hackrf_start_tx(
1301 hackrf_device* device,
1302 hackrf_sample_block_cb_fn callback,
1303 void* tx_ctx);
1304
1315 extern ADDAPI int ADDCALL hackrf_set_tx_block_complete_callback(
1316 hackrf_device* device,
1317 hackrf_tx_block_complete_cb_fn callback);
1318
1330 extern ADDAPI int ADDCALL hackrf_enable_tx_flush(
1331 hackrf_device* device,
1332 hackrf_flush_cb_fn callback,
1333 void* flush_ctx);
1334
1342 extern ADDAPI int ADDCALL hackrf_stop_tx(hackrf_device* device);
1343
1353 extern ADDAPI int ADDCALL hackrf_get_m0_state(
1354 hackrf_device* device,
1355 hackrf_m0_state* value);
1356
1365 extern ADDAPI int ADDCALL hackrf_read_selftest(
1366 hackrf_device* device,
1367 hackrf_selftest* value);
1368
1377 extern ADDAPI int ADDCALL hackrf_test_rtc_osc(hackrf_device* device, bool* pass);
1378
1388 extern ADDAPI int ADDCALL hackrf_read_adc(
1389 hackrf_device* device,
1390 uint8_t adc_channel,
1391 uint16_t* value);
1392
1404 extern ADDAPI int ADDCALL hackrf_set_tx_underrun_limit(
1405 hackrf_device* device,
1406 uint32_t value);
1407
1419 extern ADDAPI int ADDCALL hackrf_set_rx_overrun_limit(
1420 hackrf_device* device,
1421 uint32_t value);
1422
1430 extern ADDAPI int ADDCALL hackrf_is_streaming(hackrf_device* device);
1431
1443 extern ADDAPI int ADDCALL hackrf_max2837_read(
1444 hackrf_device* device,
1445 uint8_t register_number,
1446 uint16_t* value);
1447
1459 extern ADDAPI int ADDCALL hackrf_max2831_read(
1460 hackrf_device* device,
1461 uint8_t register_number,
1462 uint16_t* value);
1463
1475 extern ADDAPI int ADDCALL hackrf_max2837_write(
1476 hackrf_device* device,
1477 uint8_t register_number,
1478 uint16_t value);
1479
1491 extern ADDAPI int ADDCALL hackrf_max2831_write(
1492 hackrf_device* device,
1493 uint8_t register_number,
1494 uint16_t value);
1495
1507 extern ADDAPI int ADDCALL hackrf_si5351c_read(
1508 hackrf_device* device,
1509 uint16_t register_number,
1510 uint16_t* value);
1511
1523 extern ADDAPI int ADDCALL hackrf_si5351c_write(
1524 hackrf_device* device,
1525 uint16_t register_number,
1526 uint16_t value);
1527
1541 extern ADDAPI int ADDCALL hackrf_set_baseband_filter_bandwidth(
1542 hackrf_device* device,
1543 const uint32_t bandwidth_hz);
1544
1556 extern ADDAPI int ADDCALL hackrf_rffc5071_read(
1557 hackrf_device* device,
1558 uint8_t register_number,
1559 uint16_t* value);
1560
1572 extern ADDAPI int ADDCALL hackrf_rffc5071_write(
1573 hackrf_device* device,
1574 uint8_t register_number,
1575 uint16_t value);
1576
1589 extern ADDAPI int ADDCALL hackrf_fpga_read_register(
1590 hackrf_device* device,
1591 uint8_t register_number,
1592 uint8_t* value);
1593
1606 extern ADDAPI int ADDCALL hackrf_fpga_write_register(
1607 hackrf_device* device,
1608 uint8_t register_number,
1609 uint8_t value);
1610
1620 extern ADDAPI int ADDCALL hackrf_spiflash_erase(hackrf_device* device);
1621
1634 extern ADDAPI int ADDCALL hackrf_spiflash_write(
1635 hackrf_device* device,
1636 const uint32_t address,
1637 const uint16_t length,
1638 unsigned char* const data);
1639
1652 extern ADDAPI int ADDCALL hackrf_spiflash_read(
1653 hackrf_device* device,
1654 const uint32_t address,
1655 const uint16_t length,
1656 unsigned char* data);
1657
1669 extern ADDAPI int ADDCALL hackrf_spiflash_status(hackrf_device* device, uint8_t* data);
1670
1681 extern ADDAPI int ADDCALL hackrf_spiflash_clear_status(hackrf_device* device);
1682
1683/* device will need to be reset after hackrf_cpld_write */
1684
1695 extern ADDAPI int ADDCALL hackrf_cpld_write(
1696 hackrf_device* device,
1697 unsigned char* const data,
1698 const unsigned int total_length);
1699
1711 extern ADDAPI int ADDCALL hackrf_board_id_read(hackrf_device* device, uint8_t* value);
1712
1723 extern ADDAPI int ADDCALL hackrf_version_string_read(
1724 hackrf_device* device,
1725 char* version,
1726 uint8_t length);
1727
1746 extern ADDAPI int ADDCALL hackrf_usb_api_version_read(
1747 hackrf_device* device,
1748 uint16_t* version);
1749
1762 extern ADDAPI int ADDCALL hackrf_set_freq(hackrf_device* device, const uint64_t freq_hz);
1763
1776 extern ADDAPI int ADDCALL hackrf_set_freq_explicit(
1777 hackrf_device* device,
1778 const uint64_t if_freq_hz,
1779 const uint64_t lo_freq_hz,
1780 const enum rf_path_filter path);
1781
1796 extern ADDAPI int ADDCALL hackrf_set_sample_rate_manual(
1797 hackrf_device* device,
1798 const uint32_t freq_hz,
1799 const uint32_t divider);
1800
1812 extern ADDAPI int ADDCALL hackrf_set_sample_rate(
1813 hackrf_device* device,
1814 const double freq_hz);
1815
1826 extern ADDAPI int ADDCALL hackrf_set_amp_enable(
1827 hackrf_device* device,
1828 const uint8_t value);
1829
1840 extern ADDAPI int ADDCALL hackrf_board_partid_serialno_read(
1841 hackrf_device* device,
1842 read_partid_serialno_t* read_partid_serialno);
1843
1854 extern ADDAPI int ADDCALL hackrf_set_lna_gain(hackrf_device* device, uint32_t value);
1855
1864 extern ADDAPI int ADDCALL hackrf_set_vga_gain(hackrf_device* device, uint32_t value);
1865
1874 extern ADDAPI int ADDCALL hackrf_set_txvga_gain(hackrf_device* device, uint32_t value);
1875
1888 extern ADDAPI int ADDCALL hackrf_set_antenna_enable(
1889 hackrf_device* device,
1890 const uint8_t value);
1891
1898 extern ADDAPI const char* ADDCALL hackrf_error_name(enum hackrf_error errcode);
1899
1907 extern ADDAPI const char* ADDCALL hackrf_board_id_name(enum hackrf_board_id board_id);
1908
1916 extern ADDAPI uint32_t ADDCALL hackrf_board_id_platform(enum hackrf_board_id board_id);
1917
1918// part of docstring is from hackrf.h
1925 extern ADDAPI const char* ADDCALL hackrf_usb_board_id_name(
1926 enum hackrf_usb_board_id usb_board_id);
1927
1934 extern ADDAPI const char* ADDCALL hackrf_filter_path_name(const enum rf_path_filter path);
1935
1945 extern ADDAPI uint32_t ADDCALL hackrf_compute_baseband_filter_bw_round_down_lt(
1946 const uint32_t bandwidth_hz);
1947
1957 extern ADDAPI uint32_t ADDCALL hackrf_compute_baseband_filter_bw(
1958 const uint32_t bandwidth_hz);
1959
1960/* All features below require USB API version 0x1002 or higher) */
1961
1973 extern ADDAPI int ADDCALL hackrf_set_hw_sync_mode(
1974 hackrf_device* device,
1975 const uint8_t value);
1976
1993 extern ADDAPI int ADDCALL hackrf_init_sweep(
1994 hackrf_device* device,
1995 const uint16_t* frequency_list,
1996 const int num_ranges,
1997 const uint32_t num_bytes,
1998 const uint32_t step_width,
1999 const uint32_t offset,
2000 const enum sweep_style style);
2001
2013 extern ADDAPI int ADDCALL hackrf_get_operacake_boards(
2014 hackrf_device* device,
2015 uint8_t* boards);
2016
2027 extern ADDAPI int ADDCALL hackrf_set_operacake_mode(
2028 hackrf_device* device,
2029 uint8_t address,
2030 enum operacake_switching_mode mode);
2031
2042 extern ADDAPI int ADDCALL hackrf_get_operacake_mode(
2043 hackrf_device* device,
2044 uint8_t address,
2045 enum operacake_switching_mode* mode);
2046
2060 extern ADDAPI int ADDCALL hackrf_set_operacake_ports(
2061 hackrf_device* device,
2062 uint8_t address,
2063 uint8_t port_a,
2064 uint8_t port_b);
2065
2080 extern ADDAPI int ADDCALL hackrf_set_operacake_dwell_times(
2081 hackrf_device* device,
2082 hackrf_operacake_dwell_time* dwell_times,
2083 uint8_t count);
2084
2099 extern ADDAPI int ADDCALL hackrf_set_operacake_freq_ranges(
2100 hackrf_device* device,
2101 hackrf_operacake_freq_range* freq_ranges,
2102 uint8_t count);
2103
2112 extern ADDAPI int ADDCALL hackrf_reset(hackrf_device* device);
2113
2129 extern ADDAPI int ADDCALL hackrf_set_operacake_ranges(
2130 hackrf_device* device,
2131 uint8_t* ranges,
2132 uint8_t num_ranges);
2133
2143 extern ADDAPI int ADDCALL hackrf_set_clkout_enable(
2144 hackrf_device* device,
2145 const uint8_t value);
2146
2158 extern ADDAPI int ADDCALL hackrf_get_clkin_status(hackrf_device* device, uint8_t* status);
2159
2175 extern ADDAPI int ADDCALL hackrf_operacake_gpio_test(
2176 hackrf_device* device,
2177 uint8_t address,
2178 uint16_t* test_result);
2179
2180#ifdef HACKRF_ISSUE_609_IS_FIXED
2192 extern ADDAPI int ADDCALL hackrf_cpld_checksum(hackrf_device* device, uint32_t* crc);
2193#endif /* HACKRF_ISSUE_609_IS_FIXED */
2194
2206 extern ADDAPI int ADDCALL hackrf_set_ui_enable(hackrf_device* device, const uint8_t value);
2207
2220 extern ADDAPI int ADDCALL hackrf_start_rx_sweep(
2221 hackrf_device* device,
2222 hackrf_sample_block_cb_fn callback,
2223 void* rx_ctx);
2224
2225// docsstring partly from hackrf.c
2232 extern ADDAPI size_t ADDCALL hackrf_get_transfer_buffer_size(hackrf_device* device);
2233
2234// docsstring partly from hackrf.c
2241 extern ADDAPI uint32_t ADDCALL hackrf_get_transfer_queue_depth(hackrf_device* device);
2242
2252 extern ADDAPI int ADDCALL hackrf_board_rev_read(hackrf_device* device, uint8_t* value);
2253
2261 extern ADDAPI const char* ADDCALL hackrf_board_rev_name(enum hackrf_board_rev board_rev);
2262
2274 extern ADDAPI int ADDCALL hackrf_supported_platform_read(
2275 hackrf_device* device,
2276 uint32_t* value);
2277
2292 extern ADDAPI int ADDCALL hackrf_set_leds(hackrf_device* device, const uint8_t state);
2293
2318 extern ADDAPI int ADDCALL hackrf_set_user_bias_t_opts(
2319 hackrf_device* device,
2320 hackrf_bias_t_user_settting_req* req);
2321
2325 extern ADDAPI int ADDCALL hackrf_set_p1_ctrl(
2326 hackrf_device* device,
2327 const enum p1_ctrl_signal signal);
2328
2332 extern ADDAPI int ADDCALL hackrf_set_p2_ctrl(
2333 hackrf_device* device,
2334 const enum p2_ctrl_signal signal);
2335
2339 extern ADDAPI int ADDCALL hackrf_set_clkin_ctrl(
2340 hackrf_device* device,
2341 const enum clkin_ctrl_signal signal);
2342
2346 extern ADDAPI int ADDCALL hackrf_set_narrowband_filter(
2347 hackrf_device* device,
2348 const uint8_t value);
2349
2353 extern ADDAPI int ADDCALL hackrf_set_fpga_bitstream(
2354 hackrf_device* device,
2355 const uint8_t index);
2356
2357#ifdef __cplusplus
2358} // __cplusplus defined.
2359#endif
2360
2361#endif /*__HACKRF_H__*/
hackrf_set_clkout_enable
int hackrf_set_clkout_enable(hackrf_device *device, const uint8_t value)
Enable / disable CLKOUT.
hackrf_set_lna_gain
int hackrf_set_lna_gain(hackrf_device *device, uint32_t value)
Set LNA gain.
hackrf_get_clkin_status
int hackrf_get_clkin_status(hackrf_device *device, uint8_t *status)
Get CLKIN status.
hackrf_filter_path_name
const char * hackrf_filter_path_name(const enum rf_path_filter path)
Convert rf_path_filter into human-readable string.
rf_path_filter
rf_path_filter
RF filter path setting enum.
Definition hackrf.h:845
hackrf_set_sample_rate_manual
int hackrf_set_sample_rate_manual(hackrf_device *device, const uint32_t freq_hz, const uint32_t divider)
Set sample rate explicitly.
hackrf_set_baseband_filter_bandwidth
int hackrf_set_baseband_filter_bandwidth(hackrf_device *device, const uint32_t bandwidth_hz)
Set baseband filter bandwidth.
hackrf_set_sample_rate
int hackrf_set_sample_rate(hackrf_device *device, const double freq_hz)
Set sample rate.
hackrf_set_amp_enable
int hackrf_set_amp_enable(hackrf_device *device, const uint8_t value)
Enable/disable 14dB RF amplifier.
hackrf_set_freq
int hackrf_set_freq(hackrf_device *device, const uint64_t freq_hz)
Set the center frequency.
hackrf_set_txvga_gain
int hackrf_set_txvga_gain(hackrf_device *device, uint32_t value)
Set RF TX gain of the MAX2837 transceiver IC ("IF" or "VGA" gain setting) in decibels.
hackrf_compute_baseband_filter_bw
uint32_t hackrf_compute_baseband_filter_bw(const uint32_t bandwidth_hz)
Compute nearest valid baseband filter bandwidth to specified value.
hackrf_set_freq_explicit
int hackrf_set_freq_explicit(hackrf_device *device, const uint64_t if_freq_hz, const uint64_t lo_freq_hz, const enum rf_path_filter path)
Set the center frequency via explicit tuning.
hackrf_set_vga_gain
int hackrf_set_vga_gain(hackrf_device *device, uint32_t value)
Set baseband RX gain of the MAX2837 transceiver IC ("BB" or "VGA" gain setting) in decibels.
hackrf_set_antenna_enable
int hackrf_set_antenna_enable(hackrf_device *device, const uint8_t value)
Enable / disable bias-tee (antenna port power)
hackrf_compute_baseband_filter_bw_round_down_lt
uint32_t hackrf_compute_baseband_filter_bw_round_down_lt(const uint32_t bandwidth_hz)
Compute nearest valid baseband filter bandwidth lower than a specified value.
RF_PATH_FILTER_HIGH_PASS
@ RF_PATH_FILTER_HIGH_PASS
HPF is selected, .
Definition hackrf.h:857
RF_PATH_FILTER_BYPASS
@ RF_PATH_FILTER_BYPASS
No filter is selected, the mixer is bypassed, .
Definition hackrf.h:849
RF_PATH_FILTER_LOW_PASS
@ RF_PATH_FILTER_LOW_PASS
LPF is selected, .
Definition hackrf.h:853
hackrf_spiflash_erase
int hackrf_spiflash_erase(hackrf_device *device)
Erase firmware image on the SPI flash.
hackrf_max2837_read
int hackrf_max2837_read(hackrf_device *device, uint8_t register_number, uint16_t *value)
Directly read the registers of the MAX2837 transceiver IC.
hackrf_spiflash_write
int hackrf_spiflash_write(hackrf_device *device, const uint32_t address, const uint16_t length, unsigned char *const data)
Write firmware image on the SPI flash.
hackrf_max2831_write
int hackrf_max2831_write(hackrf_device *device, uint8_t register_number, uint16_t value)
Directly write the registers of the MAX2831 transceiver IC.
hackrf_si5351c_write
int hackrf_si5351c_write(hackrf_device *device, uint16_t register_number, uint16_t value)
Directly write the registers of the Si5351 clock generator IC.
hackrf_max2837_write
int hackrf_max2837_write(hackrf_device *device, uint8_t register_number, uint16_t value)
Directly write the registers of the MAX2837 transceiver IC.
hackrf_rffc5071_read
int hackrf_rffc5071_read(hackrf_device *device, uint8_t register_number, uint16_t *value)
Directly read the registers of the RFFC5071/5072 mixer-synthesizer IC.
hackrf_fpga_read_register
int hackrf_fpga_read_register(hackrf_device *device, uint8_t register_number, uint8_t *value)
Directly read the registers of the current gateware through the FPGA SPI interface (HackRF Pro)
hackrf_spiflash_read
int hackrf_spiflash_read(hackrf_device *device, const uint32_t address, const uint16_t length, unsigned char *data)
Read firmware image on the SPI flash.
hackrf_max2831_read
int hackrf_max2831_read(hackrf_device *device, uint8_t register_number, uint16_t *value)
Directly read the registers of the MAX2831 transceiver IC.
hackrf_spiflash_status
int hackrf_spiflash_status(hackrf_device *device, uint8_t *data)
Read the status registers of the W25Q80BV SPI flash chip.
hackrf_read_selftest
int hackrf_read_selftest(hackrf_device *device, hackrf_selftest *value)
Get the results of the device self-test.
hackrf_read_adc
int hackrf_read_adc(hackrf_device *device, uint8_t adc_channel, uint16_t *value)
Read a value from an ADC channel.
hackrf_test_rtc_osc
int hackrf_test_rtc_osc(hackrf_device *device, bool *pass)
Test the RTC oscillator on the device.
hackrf_si5351c_read
int hackrf_si5351c_read(hackrf_device *device, uint16_t register_number, uint16_t *value)
Directly read the registers of the Si5351C clock generator IC.
hackrf_fpga_write_register
int hackrf_fpga_write_register(hackrf_device *device, uint8_t register_number, uint8_t value)
Directly write the registers of the current gateware through the FPGA SPI interface (HackRF Pro)
hackrf_spiflash_clear_status
int hackrf_spiflash_clear_status(hackrf_device *device)
Clear the status registers of the W25Q80BV SPI flash chip.
hackrf_cpld_write
int hackrf_cpld_write(hackrf_device *device, unsigned char *const data, const unsigned int total_length)
Write configuration bitstream into the XC2C64A-7VQ100C CPLD.
hackrf_rffc5071_write
int hackrf_rffc5071_write(hackrf_device *device, uint8_t register_number, uint16_t value)
Directly write the registers of the RFFC5071/5072 mixer-synthesizer IC.
hackrf_get_m0_state
int hackrf_get_m0_state(hackrf_device *device, hackrf_m0_state *value)
Get the state of the M0 code on the LPC43xx MCU.
hackrf_close
int hackrf_close(hackrf_device *device)
Close a previously opened device.
hackrf_device_list_open
int hackrf_device_list_open(hackrf_device_list_t *list, int idx, hackrf_device **device)
Open a hackrf_device from a device list.
hackrf_supported_platform_read
int hackrf_supported_platform_read(hackrf_device *device, uint32_t *value)
Read supported platform of device.
hackrf_open_by_serial
int hackrf_open_by_serial(const char *const desired_serial_number, hackrf_device **device)
Open HackRF device by serial number.
hackrf_device_list_free
void hackrf_device_list_free(hackrf_device_list_t *list)
Free a previously allocated hackrf_device_list list.
hackrf_set_ui_enable
int hackrf_set_ui_enable(hackrf_device *device, const uint8_t value)
Enable / disable UI display (RAD1O, PortaPack, etc.)
hackrf_board_id_platform
uint32_t hackrf_board_id_platform(enum hackrf_board_id board_id)
Lookup platform ID (HACKRF_PLATFORM_xxx) from board id (hackrf_board_id)
hackrf_board_partid_serialno_read
int hackrf_board_partid_serialno_read(hackrf_device *device, read_partid_serialno_t *read_partid_serialno)
Read board part ID and serial number.
hackrf_set_leds
int hackrf_set_leds(hackrf_device *device, const uint8_t state)
Turn on or off (override) the LEDs of the HackRF device.
hackrf_board_rev_name
const char * hackrf_board_rev_name(enum hackrf_board_rev board_rev)
Convert board revision name.
hackrf_usb_board_id_name
const char * hackrf_usb_board_id_name(enum hackrf_usb_board_id usb_board_id)
Convert hackrf_usb_board_id into human-readable string.
hackrf_board_id
hackrf_board_id
HACKRF board id enum.
Definition hackrf.h:653
hackrf_usb_board_id
hackrf_usb_board_id
USB board ID (product ID) enum.
Definition hackrf.h:819
hackrf_board_rev_read
int hackrf_board_rev_read(hackrf_device *device, uint8_t *value)
Read board revision of device.
hackrf_board_id_name
const char * hackrf_board_id_name(enum hackrf_board_id board_id)
Convert hackrf_board_id into human-readable string.
hackrf_open
int hackrf_open(hackrf_device **device)
Open first available HackRF device.
hackrf_device
struct hackrf_device hackrf_device
Opaque struct for hackrf device info.
Definition hackrf.h:954
hackrf_version_string_read
int hackrf_version_string_read(hackrf_device *device, char *version, uint8_t length)
Read HackRF firmware version as a string.
hackrf_board_id_read
int hackrf_board_id_read(hackrf_device *device, uint8_t *value)
Read hackrf_board_id from a device.
hackrf_usb_api_version_read
int hackrf_usb_api_version_read(hackrf_device *device, uint16_t *version)
Read HackRF USB API version.
hackrf_board_rev
hackrf_board_rev
Board revision enum.
Definition hackrf.h:705
hackrf_reset
int hackrf_reset(hackrf_device *device)
Reset HackRF device.
hackrf_set_user_bias_t_opts
int hackrf_set_user_bias_t_opts(hackrf_device *device, hackrf_bias_t_user_settting_req *req)
Configure bias tee behavior of the HackRF device when changing RF states.
BOARD_ID_PRALINE
@ BOARD_ID_PRALINE
Praline.
Definition hackrf.h:677
BOARD_ID_UNDETECTED
@ BOARD_ID_UNDETECTED
Unknown board (detection not yet attempted, should be default value)
Definition hackrf.h:685
BOARD_ID_HACKRF1_R9
@ BOARD_ID_HACKRF1_R9
HackRF One (rev.
Definition hackrf.h:673
BOARD_ID_JELLYBEAN
@ BOARD_ID_JELLYBEAN
Jellybean (pre-production revision, not supported)
Definition hackrf.h:657
BOARD_ID_UNRECOGNIZED
@ BOARD_ID_UNRECOGNIZED
Unknown board (failed detection)
Definition hackrf.h:681
BOARD_ID_HACKRF1_OG
@ BOARD_ID_HACKRF1_OG
HackRF One (prior to rev 9, same limits: 1-6000MHz, 20MSPS, bias-tee)
Definition hackrf.h:665
BOARD_ID_RAD1O
@ BOARD_ID_RAD1O
RAD1O (Chaos Computer Club special edition with LCD & other features.
Definition hackrf.h:669
BOARD_ID_JAWBREAKER
@ BOARD_ID_JAWBREAKER
Jawbreaker (beta platform, 10-6000MHz, no bias-tee)
Definition hackrf.h:661
USB_BOARD_ID_INVALID
@ USB_BOARD_ID_INVALID
Invalid / unknown USB product id.
Definition hackrf.h:835
USB_BOARD_ID_RAD1O
@ USB_BOARD_ID_RAD1O
RAD1O (custom version) USB product id.
Definition hackrf.h:831
USB_BOARD_ID_JAWBREAKER
@ USB_BOARD_ID_JAWBREAKER
Jawbreaker (beta platform) USB product id.
Definition hackrf.h:823
USB_BOARD_ID_HACKRF_ONE
@ USB_BOARD_ID_HACKRF_ONE
HackRF One USB product id.
Definition hackrf.h:827
BOARD_REV_GSG_HACKRF1_R7
@ BOARD_REV_GSG_HACKRF1_R7
board revision 7, made by GSG
Definition hackrf.h:763
BOARD_REV_HACKRF1_R9
@ BOARD_REV_HACKRF1_R9
board revision 9, generic
Definition hackrf.h:725
BOARD_REV_UNDETECTED
@ BOARD_REV_UNDETECTED
unknown board revision (detection not yet attempted)
Definition hackrf.h:809
BOARD_REV_GSG_PRALINE_R1_2
@ BOARD_REV_GSG_PRALINE_R1_2
praline board revision 1.2, made by GSG
Definition hackrf.h:800
BOARD_REV_GSG_HACKRF1_R8
@ BOARD_REV_GSG_HACKRF1_R8
board revision 8, made by GSG
Definition hackrf.h:767
BOARD_REV_PRALINE_R0_1
@ BOARD_REV_PRALINE_R0_1
praline board revision 0.1, generic
Definition hackrf.h:734
BOARD_REV_HACKRF1_R10
@ BOARD_REV_HACKRF1_R10
board revision 10, generic
Definition hackrf.h:729
BOARD_REV_GSG_PRALINE_R0_2
@ BOARD_REV_GSG_PRALINE_R0_2
praline board revision 0.2, made by GSG
Definition hackrf.h:784
BOARD_REV_HACKRF1_R8
@ BOARD_REV_HACKRF1_R8
board revision 8, generic
Definition hackrf.h:721
BOARD_REV_HACKRF1_R6
@ BOARD_REV_HACKRF1_R6
board revision 6, generic
Definition hackrf.h:713
BOARD_REV_HACKRF1_OLD
@ BOARD_REV_HACKRF1_OLD
Older than rev6.
Definition hackrf.h:709
BOARD_REV_PRALINE_R0_3
@ BOARD_REV_PRALINE_R0_3
praline board revision 0.1, generic
Definition hackrf.h:742
BOARD_REV_GSG_PRALINE_R1_0
@ BOARD_REV_GSG_PRALINE_R1_0
praline board revision 1.0, made by GSG
Definition hackrf.h:792
BOARD_REV_GSG_HACKRF1_R9
@ BOARD_REV_GSG_HACKRF1_R9
board revision 9, made by GSG
Definition hackrf.h:771
BOARD_REV_PRALINE_R1_1
@ BOARD_REV_PRALINE_R1_1
praline board revision 1.1, generic
Definition hackrf.h:750
BOARD_REV_GSG_PRALINE_R0_3
@ BOARD_REV_GSG_PRALINE_R0_3
praline board revision 0.1, made by GSG
Definition hackrf.h:788
BOARD_REV_HACKRF1_R7
@ BOARD_REV_HACKRF1_R7
board revision 7, generic
Definition hackrf.h:717
BOARD_REV_PRALINE_R0_2
@ BOARD_REV_PRALINE_R0_2
praline board revision 0.2, generic
Definition hackrf.h:738
BOARD_REV_GSG_PRALINE_R1_1
@ BOARD_REV_GSG_PRALINE_R1_1
praline board revision 1.1, made by GSG
Definition hackrf.h:796
BOARD_REV_PRALINE_R1_2
@ BOARD_REV_PRALINE_R1_2
praline board revision 1.2, generic
Definition hackrf.h:754
BOARD_REV_UNRECOGNIZED
@ BOARD_REV_UNRECOGNIZED
unknown board revision (detection failed)
Definition hackrf.h:805
BOARD_REV_GSG_PRALINE_R0_1
@ BOARD_REV_GSG_PRALINE_R0_1
praline board revision 0.1, made by GSG
Definition hackrf.h:780
BOARD_REV_GSG_HACKRF1_R10
@ BOARD_REV_GSG_HACKRF1_R10
board revision 10, made by GSG
Definition hackrf.h:775
BOARD_REV_PRALINE_R1_0
@ BOARD_REV_PRALINE_R1_0
praline board revision 1.0, generic
Definition hackrf.h:746
BOARD_REV_GSG_HACKRF1_R6
@ BOARD_REV_GSG_HACKRF1_R6
board revision 6, made by GSG
Definition hackrf.h:759
hackrf_error
hackrf_error
error enum, returned by many libhackrf functions
Definition hackrf.h:556
hackrf_init
int hackrf_init()
Initialize libhackrf.
hackrf_exit
int hackrf_exit()
Exit libhackrf.
hackrf_error_name
const char * hackrf_error_name(enum hackrf_error errcode)
Convert hackrf_error into human-readable string.
hackrf_get_transfer_buffer_size
size_t hackrf_get_transfer_buffer_size(hackrf_device *device)
Get USB transfer buffer size.
hackrf_library_release
const char * hackrf_library_release()
Get library release.
hackrf_get_transfer_queue_depth
uint32_t hackrf_get_transfer_queue_depth(hackrf_device *device)
Get the total number of USB transfer buffers.
hackrf_library_version
const char * hackrf_library_version()
Get library version.
HACKRF_ERROR_THREAD
@ HACKRF_ERROR_THREAD
Error setting up transfer thread (pthread-related error)
Definition hackrf.h:588
HACKRF_ERROR_NOT_FOUND
@ HACKRF_ERROR_NOT_FOUND
USB device not found, returned at opening.
Definition hackrf.h:572
HACKRF_ERROR_NO_MEM
@ HACKRF_ERROR_NO_MEM
Memory allocation (on host side) failed.
Definition hackrf.h:580
HACKRF_SUCCESS
@ HACKRF_SUCCESS
no error happened
Definition hackrf.h:560
HACKRF_TRUE
@ HACKRF_TRUE
TRUE value, returned by some functions that return boolean value.
Definition hackrf.h:564
HACKRF_ERROR_USB_API_VERSION
@ HACKRF_ERROR_USB_API_VERSION
The installed firmware does not support this function.
Definition hackrf.h:604
HACKRF_ERROR_INVALID_PARAM
@ HACKRF_ERROR_INVALID_PARAM
The function was called with invalid parameters.
Definition hackrf.h:568
HACKRF_ERROR_STREAMING_THREAD_ERR
@ HACKRF_ERROR_STREAMING_THREAD_ERR
Streaming thread could not start due to an error.
Definition hackrf.h:592
HACKRF_ERROR_STREAMING_EXIT_CALLED
@ HACKRF_ERROR_STREAMING_EXIT_CALLED
Streaming thread exited (normally)
Definition hackrf.h:600
HACKRF_ERROR_LIBUSB
@ HACKRF_ERROR_LIBUSB
LibUSB error, use hackrf_error_name to get a human-readable error string (using libusb_strerror)
Definition hackrf.h:584
HACKRF_ERROR_BUSY
@ HACKRF_ERROR_BUSY
Resource is busy, possibly the device is already opened.
Definition hackrf.h:576
HACKRF_ERROR_OTHER
@ HACKRF_ERROR_OTHER
Unspecified error.
Definition hackrf.h:612
HACKRF_ERROR_STREAMING_STOPPED
@ HACKRF_ERROR_STREAMING_STOPPED
Streaming thread stopped due to an error.
Definition hackrf.h:596
HACKRF_ERROR_NOT_LAST_DEVICE
@ HACKRF_ERROR_NOT_LAST_DEVICE
Can not exit library as one or more HackRFs still in use.
Definition hackrf.h:608
hackrf_get_operacake_mode
int hackrf_get_operacake_mode(hackrf_device *device, uint8_t address, enum operacake_switching_mode *mode)
Query Opera Cake mode.
hackrf_set_operacake_ranges
int hackrf_set_operacake_ranges(hackrf_device *device, uint8_t *ranges, uint8_t num_ranges)
Setup Opera Cake frequency ranges in OPERACAKE_MODE_FREQUENCY mode operation.
hackrf_set_operacake_freq_ranges
int hackrf_set_operacake_freq_ranges(hackrf_device *device, hackrf_operacake_freq_range *freq_ranges, uint8_t count)
Setup Opera Cake frequency ranges in OPERACAKE_MODE_FREQUENCY mode operation.
operacake_switching_mode
operacake_switching_mode
Opera Cake port switching mode.
Definition hackrf.h:879
hackrf_get_operacake_boards
int hackrf_get_operacake_boards(hackrf_device *device, uint8_t *boards)
Query connected Opera Cake boards.
hackrf_set_operacake_ports
int hackrf_set_operacake_ports(hackrf_device *device, uint8_t address, uint8_t port_a, uint8_t port_b)
Setup Opera Cake ports in OPERACAKE_MODE_MANUAL mode operation.
hackrf_set_operacake_mode
int hackrf_set_operacake_mode(hackrf_device *device, uint8_t address, enum operacake_switching_mode mode)
Setup Opera Cake operation mode.
hackrf_set_operacake_dwell_times
int hackrf_set_operacake_dwell_times(hackrf_device *device, hackrf_operacake_dwell_time *dwell_times, uint8_t count)
Setup Opera Cake dwell times in OPERACAKE_MODE_TIME mode operation.
operacake_ports
operacake_ports
Opera Cake secondary ports (A1-A4, B1-B4)
Definition hackrf.h:864
hackrf_operacake_gpio_test
int hackrf_operacake_gpio_test(hackrf_device *device, uint8_t address, uint16_t *test_result)
Perform GPIO test on an Opera Cake addon board.
OPERACAKE_MODE_FREQUENCY
@ OPERACAKE_MODE_FREQUENCY
Port connections are switched automatically when the frequency is changed.
Definition hackrf.h:887
OPERACAKE_MODE_TIME
@ OPERACAKE_MODE_TIME
Port connections are switched automatically over time.
Definition hackrf.h:891
OPERACAKE_MODE_MANUAL
@ OPERACAKE_MODE_MANUAL
Port connections are set manually using hackrf_set_operacake_ports.
Definition hackrf.h:883
OPERACAKE_PB4
@ OPERACAKE_PB4
Definition hackrf.h:872
OPERACAKE_PB2
@ OPERACAKE_PB2
Definition hackrf.h:870
OPERACAKE_PA1
@ OPERACAKE_PA1
Definition hackrf.h:865
OPERACAKE_PA2
@ OPERACAKE_PA2
Definition hackrf.h:866
OPERACAKE_PB1
@ OPERACAKE_PB1
Definition hackrf.h:869
OPERACAKE_PA4
@ OPERACAKE_PA4
Definition hackrf.h:868
OPERACAKE_PB3
@ OPERACAKE_PB3
Definition hackrf.h:871
OPERACAKE_PA3
@ OPERACAKE_PA3
Definition hackrf.h:867
hackrf_flush_cb_fn
void(* hackrf_flush_cb_fn)(void *flush_ctx, int)
Flush (end of transmission) callback.
Definition hackrf.h:1152
hackrf_init_sweep
int hackrf_init_sweep(hackrf_device *device, const uint16_t *frequency_list, const int num_ranges, const uint32_t num_bytes, const uint32_t step_width, const uint32_t offset, const enum sweep_style style)
Initialize sweep mode.
hackrf_stop_tx
int hackrf_stop_tx(hackrf_device *device)
Stop transmission.
hackrf_start_rx_sweep
int hackrf_start_rx_sweep(hackrf_device *device, hackrf_sample_block_cb_fn callback, void *rx_ctx)
Start RX sweep.
hackrf_sample_block_cb_fn
int(* hackrf_sample_block_cb_fn)(hackrf_transfer *transfer)
Sample block callback, used in RX and TX (set via hackrf_start_rx, hackrf_start_rx_sweep and hackrf_s...
Definition hackrf.h:1136
hackrf_tx_block_complete_cb_fn
void(* hackrf_tx_block_complete_cb_fn)(hackrf_transfer *transfer, int)
Block complete callback.
Definition hackrf.h:1144
hackrf_stop_rx
int hackrf_stop_rx(hackrf_device *device)
Stop receiving.
hackrf_start_rx
int hackrf_start_rx(hackrf_device *device, hackrf_sample_block_cb_fn callback, void *rx_ctx)
Start receiving.
hackrf_enable_tx_flush
int hackrf_enable_tx_flush(hackrf_device *device, hackrf_flush_cb_fn callback, void *flush_ctx)
Setup flush (end-of-transmission) callback.
hackrf_set_hw_sync_mode
int hackrf_set_hw_sync_mode(hackrf_device *device, const uint8_t value)
Set hardware sync mode (hardware triggering)
hackrf_set_tx_underrun_limit
int hackrf_set_tx_underrun_limit(hackrf_device *device, uint32_t value)
Set transmit underrun limit.
hackrf_start_tx
int hackrf_start_tx(hackrf_device *device, hackrf_sample_block_cb_fn callback, void *tx_ctx)
Start transmitting.
hackrf_set_tx_block_complete_callback
int hackrf_set_tx_block_complete_callback(hackrf_device *device, hackrf_tx_block_complete_cb_fn callback)
Setup callback to be called when an USB transfer is completed.
hackrf_set_rx_overrun_limit
int hackrf_set_rx_overrun_limit(hackrf_device *device, uint32_t value)
Set receive overrun limit.
hackrf_is_streaming
int hackrf_is_streaming(hackrf_device *device)
Query device streaming status.
sweep_style
sweep_style
sweep mode enum
Definition hackrf.h:902
LINEAR
@ LINEAR
step_width is added to the current frequency at each step.
Definition hackrf.h:906
INTERLEAVED
@ INTERLEAVED
each step is divided into two interleaved sub-steps, allowing the host to select the best portions of...
Definition hackrf.h:910
hackrf_bias_t_user_settting_req
User settings for user-supplied bias tee defaults.
Definition hackrf.h:1043
hackrf_bias_t_user_settting_req::rx
hackrf_bool_user_settting rx
Definition hackrf.h:1045
hackrf_bias_t_user_settting_req::tx
hackrf_bool_user_settting tx
Definition hackrf.h:1044
hackrf_bias_t_user_settting_req::off
hackrf_bool_user_settting off
Definition hackrf.h:1046
hackrf_bool_user_settting
Helper struct for hackrf_bias_t_user_setting.
Definition hackrf.h:1031
hackrf_bool_user_settting::change_on_mode_entry
bool change_on_mode_entry
Definition hackrf.h:1033
hackrf_bool_user_settting::enabled
bool enabled
Definition hackrf.h:1034
hackrf_bool_user_settting::do_update
bool do_update
Definition hackrf.h:1032
hackrf_device_list
List of connected HackRF devices.
Definition hackrf.h:1093
hackrf_device_list::serial_numbers
char ** serial_numbers
Array of human-readable serial numbers.
Definition hackrf.h:1097
hackrf_device_list::devicecount
int devicecount
Number of connected HackRF devices, the length of arrays serial_numbers, usb_board_ids and usb_device...
Definition hackrf.h:1110
hackrf_device_list::usb_device_index
int * usb_device_index
USB device index for a given HW entry.
Definition hackrf.h:1105
hackrf_device_list::usb_board_ids
enum hackrf_usb_board_id * usb_board_ids
ID of each board, based on USB product ID.
Definition hackrf.h:1101
hackrf_device_list::usb_devices
void ** usb_devices
All USB devices (as libusb_device** array)
Definition hackrf.h:1115
hackrf_device_list::usb_devicecount
int usb_devicecount
Number of all queried USB devices.
Definition hackrf.h:1119
hackrf_m0_state
State of the SGPIO loop running on the M0 core.
Definition hackrf.h:1053
hackrf_m0_state::longest_shortfall
uint32_t longest_shortfall
Longest shortfall in bytes.
Definition hackrf.h:1067
hackrf_m0_state::requested_mode
uint16_t requested_mode
Requested mode.
Definition hackrf.h:1055
hackrf_m0_state::request_flag
uint16_t request_flag
Request flag, 0 means request is completed, any other value means request is pending.
Definition hackrf.h:1057
hackrf_m0_state::active_mode
uint32_t active_mode
Active mode.
Definition hackrf.h:1059
hackrf_m0_state::m0_count
uint32_t m0_count
Number of bytes transferred by the M0.
Definition hackrf.h:1061
hackrf_m0_state::next_mode
uint32_t next_mode
Mode which will be switched to when threshold is reached.
Definition hackrf.h:1073
hackrf_m0_state::num_shortfalls
uint32_t num_shortfalls
Number of shortfalls.
Definition hackrf.h:1065
hackrf_m0_state::threshold
uint32_t threshold
Threshold m0_count value (in bytes) for next mode change.
Definition hackrf.h:1071
hackrf_m0_state::error
uint32_t error
Error, if any, that caused the M0 to revert to IDLE mode.
Definition hackrf.h:1075
hackrf_m0_state::shortfall_limit
uint32_t shortfall_limit
Shortfall limit in bytes.
Definition hackrf.h:1069
hackrf_m0_state::m4_count
uint32_t m4_count
Number of bytes transferred by the M4.
Definition hackrf.h:1063
hackrf_operacake_dwell_time
Opera Cake port setting in OPERACAKE_MODE_TIME operation.
Definition hackrf.h:997
hackrf_operacake_dwell_time::port
uint8_t port
Port to connect A0 to (B0 mirrors this choice) Must be one of operacake_ports.
Definition hackrf.h:1005
hackrf_operacake_dwell_time::dwell
uint32_t dwell
Dwell time for port (in number of samples)
Definition hackrf.h:1001
hackrf_operacake_freq_range
Opera Cake port setting in OPERACAKE_MODE_FREQUENCY operation.
Definition hackrf.h:1012
hackrf_operacake_freq_range::port
uint8_t port
Port (A0) to use for that frequency range.
Definition hackrf.h:1024
hackrf_operacake_freq_range::freq_min
uint16_t freq_min
Start frequency (in MHz)
Definition hackrf.h:1016
hackrf_operacake_freq_range::freq_max
uint16_t freq_max
Stop frequency (in MHz)
Definition hackrf.h:1020
hackrf_selftest
Self-test results.
Definition hackrf.h:1082
hackrf_selftest::pass
bool pass
Definition hackrf.h:1083
hackrf_transfer
USB transfer information passed to RX or TX callback.
Definition hackrf.h:963
hackrf_transfer::buffer_length
int buffer_length
length of data buffer in bytes
Definition hackrf.h:969
hackrf_transfer::rx_ctx
void * rx_ctx
User provided RX context.
Definition hackrf.h:973
hackrf_transfer::device
hackrf_device * device
HackRF USB device for this transfer.
Definition hackrf.h:965
hackrf_transfer::buffer
uint8_t * buffer
transfer data buffer (interleaved 8 bit I/Q samples)
Definition hackrf.h:967
hackrf_transfer::valid_length
int valid_length
number of buffer bytes that were transferred
Definition hackrf.h:971
hackrf_transfer::tx_ctx
void * tx_ctx
User provided TX context.
Definition hackrf.h:975
read_partid_serialno_t
MCU (LPC43xx) part ID and serial number.
Definition hackrf.h:982