NULL,
};
+static const uint64_t buffersizes_32k[] = {
+ 10240, 32768,
+};
+static const uint64_t buffersizes_512k[] = {
+ 10240, 524288,
+};
+static const uint64_t buffersizes_14k[] = {
+ 10240, 14336,
+};
+
static const struct dso_profile dev_profiles[] = {
{ 0x04b4, 0x2090, 0x04b5, 0x2090,
"Hantek", "DSO-2090",
+ buffersizes_32k,
FIRMWARE_DIR "/hantek-dso-2090.fw" },
{ 0x04b4, 0x2150, 0x04b5, 0x2150,
"Hantek", "DSO-2150",
+ buffersizes_32k,
FIRMWARE_DIR "/hantek-dso-2150.fw" },
{ 0x04b4, 0x2250, 0x04b5, 0x2250,
"Hantek", "DSO-2250",
+ buffersizes_512k,
FIRMWARE_DIR "/hantek-dso-2250.fw" },
{ 0x04b4, 0x5200, 0x04b5, 0x5200,
"Hantek", "DSO-5200",
+ buffersizes_14k,
FIRMWARE_DIR "/hantek-dso-5200.fw" },
{ 0x04b4, 0x520a, 0x04b5, 0x520a,
"Hantek", "DSO-5200A",
+ buffersizes_512k,
FIRMWARE_DIR "/hantek-dso-5200A.fw" },
- { 0, 0, 0, 0, 0, 0, 0 },
-};
-
-static const uint64_t buffersizes[] = {
- 10240,
- 32768,
- /* TODO: 65535 */
+ { 0, 0, 0, 0, 0, 0, 0, 0 },
};
static const uint64_t timebases[][2] = {
break;
case SR_CONF_BUFFERSIZE:
tmp_u64 = g_variant_get_uint64(data);
- for (i = 0; buffersizes[i]; i++) {
- if (buffersizes[i] == tmp_u64) {
+ for (i = 0; i < 2; i++) {
+ if (devc->profile->buffersizes[i] == tmp_u64) {
devc->framesize = tmp_u64;
break;
}
}
- if (buffersizes[i] == 0)
+ if (i == 2)
ret = SR_ERR_ARG;
break;
case SR_CONF_TIMEBASE:
static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
{
+ struct dev_context *devc;
(void)sdi;
+ if (!sdi)
+ return SR_ERR_ARG;
+
+ devc = sdi->priv;
switch (key) {
case SR_CONF_DEVICE_OPTIONS:
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
break;
case SR_CONF_BUFFERSIZE:
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT64,
- buffersizes, ARRAY_SIZE(buffersizes), sizeof(uint64_t));
+ devc->profile->buffersizes, 2, sizeof(uint64_t));
break;
case SR_CONF_COUPLING:
*data = g_variant_new_strv(coupling, ARRAY_SIZE(coupling));
/* Timebase fast */
sr_dbg("Time base index: %d.", devc->timebase);
- switch (devc->framesize) {
- case FRAMESIZE_SMALL:
+ if (devc->framesize == FRAMESIZE_SMALL) {
if (devc->timebase < TIME_20us)
tmp = 0;
else if (devc->timebase == TIME_20us)
tmp = 3;
else if (devc->timebase >= TIME_200us)
tmp = 4;
- break;
- case FRAMESIZE_LARGE:
+ } else {
if (devc->timebase < TIME_40us) {
sr_err("Timebase < 40us only supported with 10K buffer.");
return SR_ERR_ARG;
tmp = 3;
else if (devc->timebase >= TIME_400us)
tmp = 4;
- break;
}
cmdstring[2] |= (tmp & 0x07) << 5;