hantek-4032l: Set maximum samples size to 64MB.

Signed-off-by: Andrej Valek <andy@skyrain.eu>
This commit is contained in:
Andrej Valek 2018-04-30 15:29:17 +02:00 committed by Uwe Hermann
parent 2958315ded
commit 4b75f84c01
2 changed files with 9 additions and 3 deletions

View File

@ -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;
}

View File

@ -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