summaryrefslogtreecommitdiff
path: root/Radio/HW/AirSpyHF/src/airspyhf.h
diff options
context:
space:
mode:
Diffstat (limited to 'Radio/HW/AirSpyHF/src/airspyhf.h')
-rw-r--r--Radio/HW/AirSpyHF/src/airspyhf.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/Radio/HW/AirSpyHF/src/airspyhf.h b/Radio/HW/AirSpyHF/src/airspyhf.h
index 2879120..d58a84a 100644
--- a/Radio/HW/AirSpyHF/src/airspyhf.h
+++ b/Radio/HW/AirSpyHF/src/airspyhf.h
@@ -26,7 +26,14 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSI
#ifndef __AIRSPYHF_H__
#define __AIRSPYHF_H__
+#include <stdbool.h>
#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "libusb.h"
+#include <pthread.h>
+#include <math.h>
#define AIRSPYHF_VERSION "1.8.0"
#define AIRSPYHF_VER_MAJOR 1
@@ -61,6 +68,8 @@ extern "C"
{
#endif
+#define RAW_BUFFER_COUNT (8)
+
enum airspyhf_error
{
AIRSPYHF_SUCCESS = 0,
@@ -86,6 +95,13 @@ enum airspyhf_board_id
AIRSPYHF_BOARD_ID_INVALID = 0xFF,
};
+#pragma pack(push,1)
+typedef struct {
+ int16_t im;
+ int16_t re;
+} airspyhf_complex_int16_t;
+#pragma pack(pop)
+
typedef struct airspyhf_device airspyhf_device_t;
typedef struct {
@@ -96,6 +112,7 @@ typedef struct {
uint64_t dropped_samples;
} airspyhf_transfer_t;
+
typedef struct {
uint32_t major_version;
uint32_t minor_version;
@@ -107,6 +124,55 @@ typedef struct {
typedef int (*airspyhf_sample_block_cb_fn) (airspyhf_transfer_t* transfer_fn);
+
+
+typedef struct airspyhf_device
+{
+ libusb_context* usb_context;
+ libusb_device_handle* usb_device;
+ struct libusb_transfer** transfers;
+ airspyhf_sample_block_cb_fn callback;
+ pthread_t transfer_thread;
+ pthread_t consumer_thread;
+ bool transfer_thread_running;
+ bool consumer_thread_running;
+ pthread_cond_t consumer_cv;
+ pthread_mutex_t consumer_mp;
+ uint32_t supported_samplerate_count;
+ uint32_t *supported_samplerates;
+ uint8_t *samplerate_architectures;
+ uint32_t supported_att_step_count;
+ float *supported_att_steps;
+ volatile uint32_t current_samplerate;
+ volatile double freq_hz;
+ volatile uint32_t freq_khz;
+ volatile double freq_delta_hz;
+ volatile double freq_shift;
+ volatile int32_t calibration_ppb;
+ volatile int32_t calibration_vctcxo;
+ volatile uint32_t frontend_options;
+ volatile float optimal_point;
+ uint8_t enable_dsp;
+ uint8_t is_low_if;
+ float filter_gain;
+ airspyhf_complex_float_t vec;
+ struct iq_balancer_t *iq_balancer;
+ volatile int32_t iq_balancer_eval_skip;
+ uint32_t transfer_count;
+ int32_t transfer_live;
+ uint32_t buffer_size;
+ uint32_t dropped_buffers;
+ uint32_t dropped_buffers_queue[RAW_BUFFER_COUNT];
+ airspyhf_complex_int16_t *received_samples_queue[RAW_BUFFER_COUNT];
+ volatile bool streaming;
+ volatile bool stop_requested;
+ volatile int received_samples_queue_head;
+ volatile int received_samples_queue_tail;
+ volatile int received_buffer_count;
+ airspyhf_complex_float_t *output_buffer;
+ void* ctx;
+} airspyhf_device_t;
+
extern ADDAPI void ADDCALL airspyhf_lib_version(airspyhf_lib_version_t* lib_version);
extern ADDAPI int ADDCALL airspyhf_list_devices(uint64_t *serials, int count);
extern ADDAPI int ADDCALL airspyhf_open(airspyhf_device_t** device);