1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
|
From 247bed453e19e3b2aa8f5858c8ac310cbbf3830f Mon Sep 17 00:00:00 2001
From: Youssef Touil <youssef@live.com>
Date: Sat, 12 Jul 2025 14:10:14 +0200
Subject: [PATCH 45/46] Increased the buffer size to 4k samples; Removed IQ
balancer eval skip; Set the Win32 thread priority to THREAD_PRIORITY_HIGHEST;
Fixed the bis-tee conrol call.
---
libairspyhf/src/airspyhf.c | 23 +++++------------------
libairspyhf/src/airspyhf.h | 5 +++++
2 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/libairspyhf/src/airspyhf.c b/libairspyhf/src/airspyhf.c
index 3d5a6ff..a4400f6 100644
--- a/libairspyhf/src/airspyhf.c
+++ b/libairspyhf/src/airspyhf.c
@@ -52,7 +52,7 @@ typedef int bool;
#define MAX(a,b) ((a) > (b) ? a : b)
#define MIN(a,b) ((a) < (b) ? a : b)
-#define SAMPLES_TO_TRANSFER (1024 * 2)
+#define SAMPLES_TO_TRANSFER (1024 * 4)
#define SERIAL_NUMBER_UNUSED (0)
#define FILE_DESCRIPTOR_UNUSED (-1)
#define RAW_BUFFER_COUNT (8)
@@ -79,8 +79,6 @@ static const char str_prefix_serial_airspyhf[STR_PREFIX_SERIAL_AIRSPYHF_SIZE] =
#define LIBUSB_CTRL_TIMEOUT_MS (500)
-#define IQ_BALANCER_EVAL_SKIP (RAW_BUFFER_COUNT)
-
#pragma pack(push,1)
typedef struct {
@@ -121,7 +119,6 @@ typedef struct airspyhf_device
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;
@@ -325,7 +322,6 @@ static void convert_samples(airspyhf_device_t* device, airspyhf_complex_int16_t
airspyhf_complex_float_t rot;
double angle;
float conversion_gain;
- uint8_t iqb_eval_skip = 0;
conversion_gain = scale * device->filter_gain;
@@ -335,18 +331,12 @@ static void convert_samples(airspyhf_device_t* device, airspyhf_complex_int16_t
dest[i].im = src[i].im * conversion_gain;
}
- if (device->iq_balancer_eval_skip > 0)
- {
- device->iq_balancer_eval_skip--;
- iqb_eval_skip = 1;
- }
-
if (device->enable_dsp)
{
if (!device->is_low_if)
{
// Zero IF requires external IQ correction
- iq_balancer_process(device->iq_balancer, dest, count, iqb_eval_skip);
+ iq_balancer_process(device->iq_balancer, dest, count, 0);
}
// Fine tuning
@@ -380,7 +370,7 @@ static void* consumer_threadproc(void *arg)
#ifdef _WIN32
- SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
+ SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
#endif
@@ -486,7 +476,7 @@ static void* transfer_threadproc(void* arg)
#ifdef _WIN32
- SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
+ SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
#endif
@@ -1109,7 +1099,6 @@ static int airspyhf_open_init(airspyhf_device_t** device, uint64_t serial_number
}
lib_device->iq_balancer = iq_balancer_create(INITIAL_PHASE, INITIAL_AMPLITUDE);
- lib_device->iq_balancer_eval_skip = 0;
*device = lib_device;
@@ -1384,8 +1373,6 @@ int ADDCALL airspyhf_set_freq_double(airspyhf_device_t* device, const double fre
if (device->freq_khz != freq_khz)
{
- device->iq_balancer_eval_skip = IQ_BALANCER_EVAL_SKIP;
-
buf[0] = (uint8_t)((freq_khz >> 24) & 0xff);
buf[1] = (uint8_t)((freq_khz >> 16) & 0xff);
buf[2] = (uint8_t)((freq_khz >> 8) & 0xff);
@@ -1743,7 +1730,7 @@ int ADDCALL airspyhf_get_bias_tee_count(airspyhf_device_t* device, int32_t* valu
uint8_t length;
int result;
- length = sizeof(airspyhf_read_partid_serialno_t);
+ length = sizeof(int32_t);
result = libusb_control_transfer(
device->usb_device,
LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE,
diff --git a/libairspyhf/src/airspyhf.h b/libairspyhf/src/airspyhf.h
index 2879120..0b90110 100644
--- a/libairspyhf/src/airspyhf.h
+++ b/libairspyhf/src/airspyhf.h
@@ -83,6 +83,7 @@ enum airspyhf_board_id
AIRSPYHF_BOARD_ID_UNKNOWN_AIRSPYHF = 0,
AIRSPYHF_BOARD_ID_AIRSPYHF_REV_A = 1,
AIRSPYHF_BOARD_ID_AIRSPYHF_DISCOVERY_REV_A = 2,
+ AIRSPYHF_BOARD_ID_AIRSPYHF_RANGER_REV_A = 3,
AIRSPYHF_BOARD_ID_INVALID = 0xFF,
};
@@ -105,6 +106,10 @@ typedef struct {
#define MAX_NAME_STRING_SIZE (64)
#define MAX_VERSION_STRING_SIZE MAX_NAME_STRING_SIZE
+#define AIRSPYHF_FLAGS_NONE 0
+#define AIRSPYHF_FLAGS_OPTIMIZE_BAND_III 1
+#define AIRSPYHF_FLAGS_OPTIMIZE_PLL_INT_BOUNDARY 2
+
typedef int (*airspyhf_sample_block_cb_fn) (airspyhf_transfer_t* transfer_fn);
extern ADDAPI void ADDCALL airspyhf_lib_version(airspyhf_lib_version_t* lib_version);
--
2.47.3
|