From: Andrej Valek Date: Mon, 30 Apr 2018 13:29:17 +0000 (+0200) Subject: hantek-4032l: Set maximum samples size to 64MB. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=4b75f84c01936c7266e6700408109dcce142f0f2;p=libsigrok.git hantek-4032l: Set maximum samples size to 64MB. Signed-off-by: Andrej Valek --- diff --git a/src/hardware/hantek-4032l/api.c b/src/hardware/hantek-4032l/api.c index 954ef67b..97e9979b 100644 --- a/src/hardware/hantek-4032l/api.c +++ b/src/hardware/hantek-4032l/api.c @@ -36,7 +36,7 @@ static const uint32_t drvopts[] = { static const uint32_t devopts[] = { SR_CONF_SAMPLERATE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, SR_CONF_CAPTURE_RATIO | SR_CONF_GET | SR_CONF_SET, - SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET, + SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, SR_CONF_TRIGGER_MATCH | SR_CONF_LIST, SR_CONF_CONN | SR_CONF_GET, SR_CONF_VOLTAGE_THRESHOLD | SR_CONF_SET | SR_CONF_LIST, @@ -349,8 +349,8 @@ static int config_set(uint32_t key, GVariant *data, uint64_t number_samples = g_variant_get_uint64(data); number_samples += 511; number_samples &= 0xfffffe00; - if (number_samples < 2048 || - number_samples > 64 * 1024 * 1024) { + if (number_samples < H4043L_NUM_SAMPLES_MIN || + number_samples > H4032L_NUM_SAMPLES_MAX) { sr_err("Invalid sample range 2k...64M: %" PRIu64 ".", number_samples); return SR_ERR; @@ -388,6 +388,9 @@ static int config_list(uint32_t key, GVariant **data, case SR_CONF_VOLTAGE_THRESHOLD: *data = std_gvar_tuple_double(2.5, 2.5); break; + case SR_CONF_LIMIT_SAMPLES: + *data = std_gvar_tuple_u64(H4043L_NUM_SAMPLES_MIN, H4032L_NUM_SAMPLES_MAX); + break; default: return SR_ERR_NA; } diff --git a/src/hardware/hantek-4032l/protocol.h b/src/hardware/hantek-4032l/protocol.h index 70a468c0..0a2eeece 100644 --- a/src/hardware/hantek-4032l/protocol.h +++ b/src/hardware/hantek-4032l/protocol.h @@ -36,6 +36,9 @@ #define H4032L_DATA_BUFFER_SIZE (2 * 1024) #define H4032L_DATA_TRANSFER_MAX_NUM 32 +#define H4043L_NUM_SAMPLES_MIN (2 * 1024) +#define H4032L_NUM_SAMPLES_MAX (64 * 1024 * 1024) + #define H4032L_CMD_PKT_MAGIC 0x017f #define H4032L_STATUS_PACKET_MAGIC 0x2B1A037F #define H4032L_START_PACKET_MAGIC 0x2B1A027F