]> sigrok.org Git - libsigrok.git/commitdiff
hantek-4032l: Set maximum samples size to 64MB.
authorAndrej Valek <redacted>
Mon, 30 Apr 2018 13:29:17 +0000 (15:29 +0200)
committerUwe Hermann <redacted>
Tue, 5 Jun 2018 15:11:43 +0000 (17:11 +0200)
Signed-off-by: Andrej Valek <redacted>
src/hardware/hantek-4032l/api.c
src/hardware/hantek-4032l/protocol.h

index 954ef67b6a46391dc9e544dd3be079ce98de1c98..97e9979b6d2bdad58784abf7250c73ce17669e25 100644 (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;
        }
index 70a468c054e8adc6c468d0b337598f798211ba56..0a2eeece47e08675e470b6147857557a58d299cd 100644 (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