case SR_CONF_DEVICE_OPTIONS:
return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
case SR_CONF_SAMPLERATE:
- *data = std_gvar_samplerates_steps(samplerates, ARRAY_SIZE(samplerates));
+ *data = std_gvar_samplerates_steps(ARRAY_AND_SIZE(samplerates));
break;
case SR_CONF_DATA_SOURCE:
- *data = g_variant_new_strv(data_sources, ARRAY_SIZE(data_sources));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(data_sources));
break;
default:
return SR_ERR_NA;
case SR_CONF_DEVICE_OPTIONS:
return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
case SR_CONF_DATA_SOURCE:
- *data = g_variant_new_strv(data_sources, ARRAY_SIZE(data_sources));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(data_sources));
break;
default:
return SR_ERR_NA;
} else {
switch (key) {
case SR_CONF_DEVICE_OPTIONS:
- *data = std_gvar_array_u32(devopts_cg, ARRAY_SIZE(devopts_cg));
+ *data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg));
break;
case SR_CONF_CURRENT_LIMIT:
*data = std_gvar_min_max_step(0.0, 6.0, 0.001);
break;
#if ASIX_SIGMA_WITH_TRIGGER
case SR_CONF_TRIGGER_MATCH:
- *data = std_gvar_array_i32(trigger_matches, ARRAY_SIZE(trigger_matches));
+ *data = std_gvar_array_i32(ARRAY_AND_SIZE(trigger_matches));
break;
#endif
default:
switch (key) {
case SR_CONF_CHANNEL_CONFIG:
sval = g_variant_get_string(data, NULL);
- if ((ival = find_str(sval, channel_modes,
- ARRAY_SIZE(channel_modes))) == -1) {
+ if ((ival = find_str(sval, ARRAY_AND_SIZE(channel_modes))) == -1) {
ret = SR_ERR_ARG;
break;
}
*data = g_variant_new_strv(channel_modes, 1);
} else {
/* The other models support all modes. */
- *data = g_variant_new_strv(channel_modes, ARRAY_SIZE(channel_modes));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(channel_modes));
}
break;
default:
switch (key) {
case SR_CONF_DEVICE_OPTIONS:
- *data = std_gvar_array_u32(devopts_cg, ARRAY_SIZE(devopts_cg));
+ *data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg));
break;
case SR_CONF_VOLTAGE_TARGET:
*data = std_gvar_min_max_step_array(devc->model->channels[channel].voltage);
case SR_CONF_DEVICE_OPTIONS:
return STD_CONFIG_LIST(key, data, sdi, cg, NULL, drvopts, devopts);
case SR_CONF_SAMPLERATE:
- *data = std_gvar_samplerates_steps(samplerates, ARRAY_SIZE(samplerates));
+ *data = std_gvar_samplerates_steps(ARRAY_AND_SIZE(samplerates));
break;
default:
return SR_ERR_NA;
case SR_CONF_DEVICE_OPTIONS:
return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
case SR_CONF_SAMPLERATE:
- *data = std_gvar_samplerates_steps(samplerates, ARRAY_SIZE(samplerates));
+ *data = std_gvar_samplerates_steps(ARRAY_AND_SIZE(samplerates));
break;
case SR_CONF_TRIGGER_MATCH:
- *data = std_gvar_array_i32(soft_trigger_matches, ARRAY_SIZE(soft_trigger_matches));
+ *data = std_gvar_array_i32(ARRAY_AND_SIZE(soft_trigger_matches));
break;
default:
return SR_ERR_NA;
case SR_CONF_DEVICE_OPTIONS:
return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
case SR_CONF_SPL_WEIGHT_FREQ:
- *data = g_variant_new_strv(weight_freq, ARRAY_SIZE(weight_freq));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(weight_freq));
break;
case SR_CONF_SPL_WEIGHT_TIME:
- *data = g_variant_new_strv(weight_time, ARRAY_SIZE(weight_time));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(weight_time));
break;
case SR_CONF_SPL_MEASUREMENT_RANGE:
*data = std_gvar_tuple_array(&meas_ranges, ARRAY_SIZE(meas_ranges));
break;
case SR_CONF_DATA_SOURCE:
- *data = g_variant_new_strv(data_sources, ARRAY_SIZE(data_sources));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(data_sources));
break;
default:
return SR_ERR_NA;
return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
case SR_CONF_SAMPLERATE:
cv_fill_samplerates_if_needed(sdi);
- *data = std_gvar_samplerates(devc->samplerates, ARRAY_SIZE(devc->samplerates));
+ *data = std_gvar_samplerates(ARRAY_AND_SIZE(devc->samplerates));
break;
case SR_CONF_LIMIT_SAMPLES:
if (!devc->prof)
case SR_CONF_DEVICE_OPTIONS:
return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
case SR_CONF_SAMPLERATE:
- *data = std_gvar_samplerates_steps(samplerates, ARRAY_SIZE(samplerates));
+ *data = std_gvar_samplerates_steps(ARRAY_AND_SIZE(samplerates));
break;
default:
return SR_ERR_NA;
switch (key) {
case SR_CONF_DEVICE_OPTIONS:
if (ch->type == SR_CHANNEL_LOGIC)
- *data = std_gvar_array_u32(devopts_cg_logic, ARRAY_SIZE(devopts_cg_logic));
+ *data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg_logic));
else if (ch->type == SR_CHANNEL_ANALOG) {
if (strcmp(cg->name, "Analog") == 0)
- *data = std_gvar_array_u32(devopts_cg_analog_group, ARRAY_SIZE(devopts_cg_analog_group));
+ *data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg_analog_group));
else
- *data = std_gvar_array_u32(devopts_cg_analog_channel, ARRAY_SIZE(devopts_cg_analog_channel));
+ *data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg_analog_channel));
}
else
return SR_ERR_BUG;
return SR_ERR_NA;
if (ch->type == SR_CHANNEL_LOGIC)
- *data = g_variant_new_strv(logic_pattern_str,
- ARRAY_SIZE(logic_pattern_str));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(logic_pattern_str));
else if (ch->type == SR_CHANNEL_ANALOG)
- *data = g_variant_new_strv(analog_pattern_str,
- ARRAY_SIZE(analog_pattern_str));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(analog_pattern_str));
else
return SR_ERR_BUG;
break;
devc->continuous_mode = g_variant_get_boolean(data);
break;
case SR_CONF_CLOCK_EDGE:
- i = lookup_index(data, signal_edge_names,
- ARRAY_SIZE(signal_edge_names));
+ i = lookup_index(data, ARRAY_AND_SIZE(signal_edge_names));
if (i < 0)
return SR_ERR_ARG;
devc->clock_edge = i;
*data = std_gvar_samplerates(devc->samplerates, devc->num_samplerates);
break;
case SR_CONF_CLOCK_EDGE:
- *data = g_variant_new_strv(signal_edge_names,
- ARRAY_SIZE(signal_edge_names));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(signal_edge_names));
break;
default:
return SR_ERR_NA;
case SR_CONF_DEVICE_OPTIONS:
return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
case SR_CONF_SAMPLERATE:
- *data = std_gvar_samplerates_steps(samplerates, ARRAY_SIZE(samplerates));
+ *data = std_gvar_samplerates_steps(ARRAY_AND_SIZE(samplerates));
break;
default:
return SR_ERR_NA;
*data = std_gvar_samplerates(devc->samplerates, devc->num_samplerates);
break;
case SR_CONF_TRIGGER_MATCH:
- *data = std_gvar_array_i32(soft_trigger_matches, ARRAY_SIZE(soft_trigger_matches));
+ *data = std_gvar_array_i32(ARRAY_AND_SIZE(soft_trigger_matches));
break;
default:
return SR_ERR_NA;
switch (key) {
case SR_CONF_SCAN_OPTIONS:
- *data = std_gvar_array_u32(scanopts, ARRAY_SIZE(scanopts));
+ *data = std_gvar_array_u32(ARRAY_AND_SIZE(scanopts));
break;
case SR_CONF_DEVICE_OPTIONS:
if (cg_type == CG_NONE) {
if (model)
*data = std_gvar_array_u32((const uint32_t *)model->devopts, model->num_devopts);
else
- *data = std_gvar_array_u32(drvopts, ARRAY_SIZE(drvopts));
+ *data = std_gvar_array_u32(ARRAY_AND_SIZE(drvopts));
} else if (cg_type == CG_ANALOG) {
*data = std_gvar_array_u32((const uint32_t *)model->devopts_cg_analog, model->num_devopts_cg_analog);
} else {
if (sr_scpi_get_string(scpi, command, &tmp_str) != SR_OK)
return SR_ERR;
- if (array_float_get(tmp_str, vdivs, ARRAY_SIZE(vdivs), &j) != SR_OK) {
+ if (array_float_get(tmp_str, ARRAY_AND_SIZE(vdivs), &j) != SR_OK) {
g_free(tmp_str);
sr_err("Could not determine array index for vertical div scale.");
return SR_ERR;
&tmp_str) != SR_OK)
return SR_ERR;
- if (array_float_get(tmp_str, timebases, ARRAY_SIZE(timebases), &i) != SR_OK) {
+ if (array_float_get(tmp_str, ARRAY_AND_SIZE(timebases), &i) != SR_OK) {
g_free(tmp_str);
sr_err("Could not determine array index for time base.");
return SR_ERR;
{
0x04b4, 0x6022, 0x1d50, 0x608e, 0x0001,
"Hantek", "6022BE", "fx2lafw-hantek-6022be.fw",
- dc_coupling, ARRAY_SIZE(dc_coupling), FALSE,
+ ARRAY_AND_SIZE(dc_coupling), FALSE,
},
{
0x8102, 0x8102, 0x1d50, 0x608e, 0x0002,
"Sainsmart", "DDS120", "fx2lafw-sainsmart-dds120.fw",
- acdc_coupling, ARRAY_SIZE(acdc_coupling), TRUE,
+ ARRAY_AND_SIZE(acdc_coupling), TRUE,
},
{
0x04b4, 0x602a, 0x1d50, 0x608e, 0x0003,
"Hantek", "6022BL", "fx2lafw-hantek-6022bl.fw",
- dc_coupling, ARRAY_SIZE(dc_coupling), FALSE,
+ ARRAY_AND_SIZE(dc_coupling), FALSE,
},
ALL_ZERO
};
case SR_CONF_DEVICE_OPTIONS:
return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
case SR_CONF_SAMPLERATE:
- *data = std_gvar_samplerates(samplerates, ARRAY_SIZE(samplerates));
+ *data = std_gvar_samplerates(ARRAY_AND_SIZE(samplerates));
break;
default:
return SR_ERR_NA;
} else {
switch (key) {
case SR_CONF_DEVICE_OPTIONS:
- *data = std_gvar_array_u32(devopts_cg, ARRAY_SIZE(devopts_cg));
+ *data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg));
break;
case SR_CONF_COUPLING:
*data = g_variant_new_strv(devc->coupling_vals, devc->coupling_tab_size);
*data = std_gvar_tuple_array(&timebases, ARRAY_SIZE(timebases));
break;
case SR_CONF_TRIGGER_SOURCE:
- *data = g_variant_new_strv(trigger_sources,
- ARRAY_SIZE(trigger_sources));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(trigger_sources));
break;
case SR_CONF_TRIGGER_SLOPE:
- *data = g_variant_new_strv(trigger_slopes,
- ARRAY_SIZE(trigger_slopes));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(trigger_slopes));
break;
default:
return SR_ERR_NA;
} else {
switch (key) {
case SR_CONF_DEVICE_OPTIONS:
- *data = std_gvar_array_u32(devopts_cg, ARRAY_SIZE(devopts_cg));
+ *data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg));
break;
case SR_CONF_COUPLING:
- *data = g_variant_new_strv(coupling, ARRAY_SIZE(coupling));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(coupling));
break;
case SR_CONF_VDIV:
*data = std_gvar_tuple_array(&vdivs, ARRAY_SIZE(vdivs));
*data = g_variant_new_uint64(samplerates[devc->rate]);
break;
case SR_CONF_TRIGGER_SOURCE:
- i = reverse_map(devc->cctl[0] & 0xC0, trigger_sources_map,
- ARRAY_SIZE(trigger_sources_map));
+ i = reverse_map(devc->cctl[0] & 0xC0, ARRAY_AND_SIZE(trigger_sources_map));
if (i == -1)
return SR_ERR;
else
if (ch == -1) {
return SR_ERR_CHANNEL_GROUP;
} else {
- i = reverse_map(devc->cctl[ch] & 0x33, vdivs_map,
- ARRAY_SIZE(vdivs_map));
+ i = reverse_map(devc->cctl[ch] & 0x33, ARRAY_AND_SIZE(vdivs_map));
if (i == -1)
return SR_ERR;
else
if (ch == -1) {
return SR_ERR_CHANNEL_GROUP;
} else {
- i = reverse_map(devc->cctl[ch] & 0x0C, coupling_map,
- ARRAY_SIZE(coupling_map));
+ i = reverse_map(devc->cctl[ch] & 0x0C, ARRAY_AND_SIZE(coupling_map));
if (i == -1)
return SR_ERR;
else
break;
case SR_CONF_SAMPLERATE:
i = find_in_array(data, G_VARIANT_TYPE_UINT64,
- samplerates, ARRAY_SIZE(samplerates));
+ ARRAY_AND_SIZE(samplerates));
if (i == -1)
return SR_ERR_ARG;
else
break;
case SR_CONF_TRIGGER_SOURCE:
i = find_in_array(data, G_VARIANT_TYPE_STRING,
- trigger_sources, ARRAY_SIZE(trigger_sources));
+ ARRAY_AND_SIZE(trigger_sources));
if (i == -1)
return SR_ERR_ARG;
else
break;
case SR_CONF_TRIGGER_SLOPE:
i = find_in_array(data, G_VARIANT_TYPE_STRING,
- trigger_slopes, ARRAY_SIZE(trigger_slopes));
+ ARRAY_AND_SIZE(trigger_slopes));
if (i == -1)
return SR_ERR_ARG;
else
break;
case SR_CONF_BUFFERSIZE:
i = find_in_array(data, G_VARIANT_TYPE_UINT64,
- buffersizes, ARRAY_SIZE(buffersizes));
+ ARRAY_AND_SIZE(buffersizes));
if (i == -1)
return SR_ERR_ARG;
else
return SR_ERR_CHANNEL_GROUP;
} else {
i = find_in_array(data, G_VARIANT_TYPE_STRING,
- coupling, ARRAY_SIZE(coupling));
+ ARRAY_AND_SIZE(coupling));
if (i == -1)
return SR_ERR_ARG;
else
case SR_CONF_DEVICE_OPTIONS:
if (!cg)
return STD_CONFIG_LIST(key, data, sdi, cg, NULL, drvopts, devopts);
- *data = std_gvar_array_u32(devopts_cg, ARRAY_SIZE(devopts_cg));
+ *data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg));
break;
case SR_CONF_SAMPLERATE:
- *data = std_gvar_samplerates(samplerates, ARRAY_SIZE(samplerates));
+ *data = std_gvar_samplerates(ARRAY_AND_SIZE(samplerates));
break;
case SR_CONF_TRIGGER_SOURCE:
- *data = g_variant_new_strv(trigger_sources, ARRAY_SIZE(trigger_sources));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(trigger_sources));
break;
case SR_CONF_TRIGGER_SLOPE:
- *data = g_variant_new_strv(trigger_slopes, ARRAY_SIZE(trigger_slopes));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(trigger_slopes));
break;
case SR_CONF_BUFFERSIZE:
- *data = std_gvar_array_u64(buffersizes, ARRAY_SIZE(buffersizes));
+ *data = std_gvar_array_u64(ARRAY_AND_SIZE(buffersizes));
break;
case SR_CONF_VDIV:
*data = std_gvar_tuple_array(&vdivs, ARRAY_SIZE(vdivs));
break;
case SR_CONF_COUPLING:
- *data = g_variant_new_strv(coupling, ARRAY_SIZE(coupling));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(coupling));
break;
}
case SR_CONF_DEVICE_OPTIONS:
return STD_CONFIG_LIST(key, data, sdi, cg, NULL, drvopts, devopts);
case SR_CONF_SAMPLERATE:
- *data = std_gvar_samplerates(sl2_samplerates, ARRAY_SIZE(sl2_samplerates));
+ *data = std_gvar_samplerates(ARRAY_AND_SIZE(sl2_samplerates));
break;
case SR_CONF_TRIGGER_MATCH:
- *data = std_gvar_array_i32(trigger_matches, ARRAY_SIZE(trigger_matches));
+ *data = std_gvar_array_i32(ARRAY_AND_SIZE(trigger_matches));
break;
case SR_CONF_LIMIT_SAMPLES:
grange[0] = g_variant_new_uint64(0);
case SR_CONF_DEVICE_OPTIONS:
return STD_CONFIG_LIST(key, data, sdi, cg, NULL, drvopts, devopts);
case SR_CONF_SAMPLERATE:
- *data = std_gvar_samplerates(samplerates, ARRAY_SIZE(samplerates));
+ *data = std_gvar_samplerates(ARRAY_AND_SIZE(samplerates));
break;
default:
return SR_ERR_NA;
ARRAY_SIZE(kecheng_kc_330b_sample_intervals));
break;
case SR_CONF_SPL_WEIGHT_FREQ:
- *data = g_variant_new_strv(weight_freq, ARRAY_SIZE(weight_freq));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(weight_freq));
break;
case SR_CONF_SPL_WEIGHT_TIME:
- *data = g_variant_new_strv(weight_time, ARRAY_SIZE(weight_time));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(weight_time));
break;
case SR_CONF_DATA_SOURCE:
- *data = g_variant_new_strv(data_sources, ARRAY_SIZE(data_sources));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(data_sources));
break;
default:
return SR_ERR_NA;
case SR_CONF_DEVICE_OPTIONS:
return STD_CONFIG_LIST(key, data, sdi, cg, NULL, drvopts, devopts);
case SR_CONF_SAMPLERATE:
- *data = std_gvar_samplerates(samplerates, ARRAY_SIZE(samplerates));
+ *data = std_gvar_samplerates(ARRAY_AND_SIZE(samplerates));
break;
case SR_CONF_TRIGGER_MATCH:
- *data = std_gvar_array_i32(trigger_matches, ARRAY_SIZE(trigger_matches));
+ *data = std_gvar_array_i32(ARRAY_AND_SIZE(trigger_matches));
break;
default:
return SR_ERR_NA;
prep_regw(&cmd[i++], REG_FETCH_SAMPLES, devc->magic_fetch_samples + 0x01);
prep_regw(&cmd[i++], REG_FETCH_SAMPLES, devc->magic_fetch_samples | 0x02);
- return write_registers_async(sdi, 0x12, 5444, cmd, ARRAY_SIZE(cmd),
+ return write_registers_async(sdi, 0x12, 5444, ARRAY_AND_SIZE(cmd),
handle_fetch_samples_done);
}
prep_regw(®s[k++], REG_TRIGGER_CFG, value);
}
- if (write_registers_sync(sdi, 0x12, 5444, regs, ARRAY_SIZE(regs))) {
+ if (write_registers_sync(sdi, 0x12, 5444, ARRAY_AND_SIZE(regs))) {
sr_err("Failed to upload trigger config.");
return SR_ERR;
}
devc->magic_arm_trigger = 0x0c;
prep_regw(&cmd[i++], REG_ARM_TRIGGER, devc->magic_arm_trigger | 0x01);
- return write_registers_sync(sdi, 0x12, 5444, cmd, ARRAY_SIZE(cmd));
+ return write_registers_sync(sdi, 0x12, 5444, ARRAY_AND_SIZE(cmd));
}
SR_PRIV int lls_stop_acquisition(const struct sr_dev_inst *sdi)
assert(i == ARRAY_SIZE(cmd));
- return write_registers_sync(sdi, 0x12, 5444, cmd, ARRAY_SIZE(cmd));
+ return write_registers_sync(sdi, 0x12, 5444, ARRAY_AND_SIZE(cmd));
}
case SR_CONF_DEVICE_OPTIONS:
if (!cg)
return STD_CONFIG_LIST(key, data, sdi, cg, NULL, drvopts, devopts);
- *data = std_gvar_array_u32(devopts_cg_analog, ARRAY_SIZE(devopts_cg_analog));
+ *data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg_analog));
break;
case SR_CONF_COUPLING:
*data = g_variant_new_strv(*model->coupling_options,
if (sr_scpi_get_string(scpi, command, &tmp_str) != SR_OK)
return SR_ERR;
- if (array_float_get(tmp_str, vdivs, ARRAY_SIZE(vdivs), &j) != SR_OK) {
+ if (array_float_get(tmp_str, ARRAY_AND_SIZE(vdivs), &j) != SR_OK) {
g_free(tmp_str);
sr_err("Could not determine array index for vertical div scale.");
return SR_ERR;
if (sr_scpi_get_string(sdi->conn, "TIME_DIV?", &tmp_str) != SR_OK)
return SR_ERR;
- if (array_float_get(tmp_str, timebases, ARRAY_SIZE(timebases), &i) != SR_OK) {
+ if (array_float_get(tmp_str, ARRAY_AND_SIZE(timebases), &i) != SR_OK) {
g_free(tmp_str);
sr_err("Could not determine array index for timbase scale.");
return SR_ERR;
case SR_CONF_DEVICE_OPTIONS:
return STD_CONFIG_LIST(key, data, sdi, cg, NULL, drvopts, devopts);
case SR_CONF_SAMPLERATE:
- *data = std_gvar_samplerates_steps(samplerates, ARRAY_SIZE(samplerates));
+ *data = std_gvar_samplerates_steps(ARRAY_AND_SIZE(samplerates));
break;
case SR_CONF_TRIGGER_TYPE:
*data = g_variant_new_string(TRIGGER_TYPE);
} else {
switch (key) {
case SR_CONF_DEVICE_OPTIONS:
- *data = std_gvar_array_u32(devopts_cg, ARRAY_SIZE(devopts_cg));
+ *data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg));
break;
case SR_CONF_VOLTAGE_TARGET:
*data = std_gvar_min_max_step(0.0, devc->model->max_voltage, 0.001);
*data = g_variant_new_strv(channel_modes, 1);
} else {
/* The other models support all modes. */
- *data = g_variant_new_strv(channel_modes, ARRAY_SIZE(channel_modes));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(channel_modes));
}
return SR_OK;
default:
switch (key) {
case SR_CONF_DEVICE_OPTIONS:
if ((ch_idx == 0) || (ch_idx == 1)) /* CH1, CH2 */
- *data = std_gvar_array_u32(devopts_cg_ch12, ARRAY_SIZE(devopts_cg_ch12));
+ *data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg_ch12));
else /* Must be CH3 */
- *data = std_gvar_array_u32(devopts_cg_ch3, ARRAY_SIZE(devopts_cg_ch3));
+ *data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg_ch3));
break;
case SR_CONF_VOLTAGE_TARGET:
*data = std_gvar_min_max_step_array(devc->model->channels[ch_idx].voltage);
case SR_CONF_DEVICE_OPTIONS:
return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
case SR_CONF_SAMPLERATE:
- *data = std_gvar_samplerates_steps(samplerates, ARRAY_SIZE(samplerates));
+ *data = std_gvar_samplerates_steps(ARRAY_AND_SIZE(samplerates));
break;
case SR_CONF_TRIGGER_MATCH:
- *data = std_gvar_array_i32(trigger_matches, ARRAY_SIZE(trigger_matches));
+ *data = std_gvar_array_i32(ARRAY_AND_SIZE(trigger_matches));
break;
case SR_CONF_PATTERN_MODE:
- *data = g_variant_new_strv(patterns, ARRAY_SIZE(patterns));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(patterns));
break;
case SR_CONF_LIMIT_SAMPLES:
if (!sdi)
case SR_CONF_DEVICE_OPTIONS:
return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
case SR_CONF_SPL_WEIGHT_FREQ:
- *data = g_variant_new_strv(weight_freq, ARRAY_SIZE(weight_freq));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(weight_freq));
break;
case SR_CONF_SPL_WEIGHT_TIME:
- *data = g_variant_new_strv(weight_time, ARRAY_SIZE(weight_time));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(weight_time));
break;
case SR_CONF_SPL_MEASUREMENT_RANGE:
*data = std_gvar_tuple_array(&meas_ranges, ARRAY_SIZE(meas_ranges));
break;
case SR_CONF_DATA_SOURCE:
- *data = g_variant_new_strv(data_sources, ARRAY_SIZE(data_sources));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(data_sources));
break;
default:
return SR_ERR_NA;
case SR_CONF_DEVICE_OPTIONS:
return STD_CONFIG_LIST(key, data, sdi, cg, NULL, drvopts, devopts);
case SR_CONF_SAMPLERATE:
- *data = std_gvar_samplerates_steps(samplerates, ARRAY_SIZE(samplerates));
+ *data = std_gvar_samplerates_steps(ARRAY_AND_SIZE(samplerates));
break;
case SR_CONF_TRIGGER_MATCH:
- *data = std_gvar_array_i32(trigger_matches, ARRAY_SIZE(trigger_matches));
+ *data = std_gvar_array_i32(ARRAY_AND_SIZE(trigger_matches));
break;
case SR_CONF_PATTERN_MODE:
- *data = g_variant_new_strv(patterns, ARRAY_SIZE(patterns));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(patterns));
break;
case SR_CONF_LIMIT_SAMPLES:
if (!sdi)
} else {
for (i = 0; i < devc->model->analog_channels; i++) {
if (cg == devc->analog_groups[i]) {
- *data = std_gvar_array_u32(devopts_cg_analog, ARRAY_SIZE(devopts_cg_analog));
+ *data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg_analog));
return SR_OK;
}
}
case SR_CONF_COUPLING:
if (!cg)
return SR_ERR_CHANNEL_GROUP;
- *data = g_variant_new_strv(coupling, ARRAY_SIZE(coupling));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(coupling));
break;
case SR_CONF_PROBE_FACTOR:
if (!cg)
return SR_ERR_CHANNEL_GROUP;
- *data = std_gvar_array_u64(probe_factor, ARRAY_SIZE(probe_factor));
+ *data = std_gvar_array_u64(ARRAY_AND_SIZE(probe_factor));
break;
case SR_CONF_VDIV:
if (!devc)
devc->model->has_digital ? ARRAY_SIZE(trigger_sources) : 4);
break;
case SR_CONF_TRIGGER_SLOPE:
- *data = g_variant_new_strv(trigger_slopes, ARRAY_SIZE(trigger_slopes));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(trigger_slopes));
break;
case SR_CONF_DATA_SOURCE:
if (!devc)
*data = g_variant_new_strv(data_sources, ARRAY_SIZE(data_sources) - 1);
break;
default:
- *data = g_variant_new_strv(data_sources, ARRAY_SIZE(data_sources));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(data_sources));
break;
}
break;
case SR_CONF_DEVICE_OPTIONS:
return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
case SR_CONF_SAMPLERATE:
- *data = std_gvar_samplerates(samplerates, ARRAY_SIZE(samplerates));
+ *data = std_gvar_samplerates(ARRAY_AND_SIZE(samplerates));
break;
default:
return SR_ERR_NA;
{REG_ADC_VAL_MSB, value >> 8},
};
- return write_regs(sdi, regs, G_N_ELEMENTS(regs));
+ return write_regs(sdi, ARRAY_AND_SIZE(regs));
}
static int read_eeprom(const struct sr_dev_inst *sdi,
authenticate(sdi);
- return write_regs(sdi, regs, G_N_ELEMENTS(regs));
+ return write_regs(sdi, ARRAY_AND_SIZE(regs));
}
#endif
authenticate(sdi);
write_reg(sdi, 0x15, 0x03);
- write_regs(sdi, regs_unknown, G_N_ELEMENTS(regs_unknown));
- write_regs(sdi, regs_config, G_N_ELEMENTS(regs_config));
+ write_regs(sdi, ARRAY_AND_SIZE(regs_unknown));
+ write_regs(sdi, ARRAY_AND_SIZE(regs_config));
transact(sdi, start_req, sizeof(start_req), start_rsp, sizeof(start_rsp));
case SR_CONF_DEVICE_OPTIONS:
return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
case SR_CONF_SAMPLERATE:
- *data = std_gvar_samplerates(samplerates, ARRAY_SIZE(samplerates));
+ *data = std_gvar_samplerates(ARRAY_AND_SIZE(samplerates));
break;
case SR_CONF_VOLTAGE_THRESHOLD:
g_variant_builder_init(&gvb, G_VARIANT_TYPE_ARRAY);
*data = g_variant_builder_end(&gvb);
break;
case SR_CONF_TRIGGER_MATCH:
- *data = std_gvar_array_i32(soft_trigger_matches, ARRAY_SIZE(soft_trigger_matches));
+ *data = std_gvar_array_i32(ARRAY_AND_SIZE(soft_trigger_matches));
break;
default:
return SR_ERR_NA;
case SR_CONF_SCAN_OPTIONS:
case SR_CONF_DEVICE_OPTIONS:
return std_opts_config_list(key, data, sdi, cg,
- scanopts, ARRAY_SIZE(scanopts),
- drvopts, ARRAY_SIZE(drvopts),
+ ARRAY_AND_SIZE(scanopts),
+ ARRAY_AND_SIZE(drvopts),
(devc) ? devc->device->devopts : NULL,
(devc) ? devc->device->num_devopts : 0);
break;
? CLOCK_EXT_CLK : CLOCK_INTERNAL;
break;
case SR_CONF_CLOCK_EDGE:
- idx = lookup_index(data, signal_edge_names,
- ARRAY_SIZE(signal_edge_names));
+ idx = lookup_index(data, ARRAY_AND_SIZE(signal_edge_names));
if (idx < 0)
return SR_ERR_ARG;
devc->cfg_clock_edge = idx;
break;
case SR_CONF_TRIGGER_SOURCE:
- idx = lookup_index(data, trigger_source_names,
- ARRAY_SIZE(trigger_source_names));
+ idx = lookup_index(data, ARRAY_AND_SIZE(trigger_source_names));
if (idx < 0)
return SR_ERR_ARG;
devc->cfg_trigger_source = idx;
break;
case SR_CONF_TRIGGER_SLOPE:
- idx = lookup_index(data, signal_edge_names,
- ARRAY_SIZE(signal_edge_names));
+ idx = lookup_index(data, ARRAY_AND_SIZE(signal_edge_names));
if (idx < 0)
return SR_ERR_ARG;
devc->cfg_trigger_slope = idx;
case SR_CONF_SCAN_OPTIONS:
case SR_CONF_DEVICE_OPTIONS:
return std_opts_config_list(key, data, sdi, cg,
- scanopts, ARRAY_SIZE(scanopts),
- drvopts, ARRAY_SIZE(drvopts),
+ ARRAY_AND_SIZE(scanopts), ARRAY_AND_SIZE(drvopts),
(devc) ? devc->model->devopts : NULL,
(devc) ? devc->model->num_devopts : 0);
}
*data = std_gvar_samplerates(devc->model->samplerates, devc->model->num_samplerates);
break;
case SR_CONF_TRIGGER_MATCH:
- *data = std_gvar_array_i32(trigger_matches, ARRAY_SIZE(trigger_matches));
+ *data = std_gvar_array_i32(ARRAY_AND_SIZE(trigger_matches));
break;
case SR_CONF_TRIGGER_SOURCE:
- *data = g_variant_new_strv(trigger_source_names,
- ARRAY_SIZE(trigger_source_names));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(trigger_source_names));
break;
case SR_CONF_TRIGGER_SLOPE:
case SR_CONF_CLOCK_EDGE:
- *data = g_variant_new_strv(signal_edge_names,
- ARRAY_SIZE(signal_edge_names));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(signal_edge_names));
break;
default:
/* Must not happen for a key listed in devopts. */
command[0] = LWLA_WORD(CMD_READ_REG);
command[1] = LWLA_WORD(reg);
- ret = lwla_send_command(usb, command, ARRAY_SIZE(command));
+ ret = lwla_send_command(usb, ARRAY_AND_SIZE(command));
if (ret != SR_OK)
return ret;
command[2] = LWLA_WORD_0(value);
command[3] = LWLA_WORD_1(value);
- return lwla_send_command(usb, command, ARRAY_SIZE(command));
+ return lwla_send_command(usb, ARRAY_AND_SIZE(command));
}
SR_PRIV int lwla_write_regs(const struct sr_usb_dev_inst *usb,
command[3] = LWLA_WORD_0(count);
command[4] = LWLA_WORD_1(count);
- ret = lwla_send_command(usb, command, ARRAY_SIZE(command));
+ ret = lwla_send_command(usb, ARRAY_AND_SIZE(command));
if (ret != SR_OK)
return ret;
return SR_ERR;
}
- ret = lwla_write_regs(sdi->conn, mem_reset, ARRAY_SIZE(mem_reset));
+ ret = lwla_write_regs(sdi->conn, ARRAY_AND_SIZE(mem_reset));
if (ret != SR_OK)
return ret;
if (ret != SR_OK)
return ret;
- ret = lwla_write_regs(usb, capture_init, ARRAY_SIZE(capture_init));
+ ret = lwla_write_regs(usb, ARRAY_AND_SIZE(capture_init));
if (ret != SR_OK)
return ret;
command[1] = LWLA_WORD(0);
command[2] = LWLA_WORD(lreg_count);
- ret = lwla_send_command(usb, command, ARRAY_SIZE(command));
+ ret = lwla_send_command(usb, ARRAY_AND_SIZE(command));
if (ret != SR_OK)
return ret;
usb = sdi->conn;
acq = devc->acquisition;
- ret = lwla_write_regs(usb, capture_init, ARRAY_SIZE(capture_init));
+ ret = lwla_write_regs(usb, ARRAY_AND_SIZE(capture_init));
if (ret != SR_OK)
return ret;
case SR_CONF_DEVICE_OPTIONS:
return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
case SR_CONF_DATA_SOURCE:
- *data = g_variant_new_strv(data_sources, ARRAY_SIZE(data_sources));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(data_sources));
break;
default:
return SR_ERR_NA;
switch (key) {
case SR_CONF_DEVICE_OPTIONS:
if (cg_type == CG_ANALOG)
- *data = std_gvar_array_u32(devopts_cg_analog, ARRAY_SIZE(devopts_cg_analog));
+ *data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg_analog));
else if (cg_type == CG_DIGITAL)
- *data = std_gvar_array_u32(devopts_cg_digital, ARRAY_SIZE(devopts_cg_digital));
+ *data = std_gvar_array_u32(ARRAY_AND_SIZE(devopts_cg_digital));
else
*data = std_gvar_array_u32(NULL, 0);
break;
if (dlm_analog_chan_vdiv_get(scpi, i + 1, &response) != SR_OK)
return SR_ERR;
- if (array_float_get(response, dlm_vdivs, ARRAY_SIZE(dlm_vdivs),
+ if (array_float_get(response, ARRAY_AND_SIZE(dlm_vdivs),
&j) != SR_OK) {
g_free(response);
return SR_ERR;
if (dlm_timebase_get(sdi->conn, &response) != SR_OK)
return SR_ERR;
- if (array_float_get(response, dlm_timebases,
- ARRAY_SIZE(dlm_timebases), &i) != SR_OK) {
+ if (array_float_get(response, ARRAY_AND_SIZE(dlm_timebases), &i) != SR_OK) {
g_free(response);
return SR_ERR;
}
case SR_CONF_SAMPLERATE:
devc = sdi->priv;
if (devc->prof->max_sampling_freq == 100)
- *data = std_gvar_samplerates(samplerates_100, ARRAY_SIZE(samplerates_100));
+ *data = std_gvar_samplerates(ARRAY_AND_SIZE(samplerates_100));
else if (devc->prof->max_sampling_freq == 200)
- *data = std_gvar_samplerates(samplerates_200, ARRAY_SIZE(samplerates_200));
+ *data = std_gvar_samplerates(ARRAY_AND_SIZE(samplerates_200));
else {
sr_err("Internal error: Unknown max. samplerate: %d.",
devc->prof->max_sampling_freq);
}
break;
case SR_CONF_TRIGGER_MATCH:
- *data = std_gvar_array_i32(trigger_matches, ARRAY_SIZE(trigger_matches));
+ *data = std_gvar_array_i32(ARRAY_AND_SIZE(trigger_matches));
break;
case SR_CONF_VOLTAGE_THRESHOLD:
*data = std_gvar_min_max_step_thresholds(-6.0, 6.0, 0.1);
return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
case SR_CONF_OUTPUT_FREQUENCY:
*data = g_variant_new_fixed_array(G_VARIANT_TYPE_DOUBLE,
- frequencies, ARRAY_SIZE(frequencies), sizeof(double));
+ ARRAY_AND_SIZE(frequencies), sizeof(double));
break;
case SR_CONF_EQUIV_CIRCUIT_MODEL:
- *data = g_variant_new_strv(models, ARRAY_SIZE(models));
+ *data = g_variant_new_strv(ARRAY_AND_SIZE(models));
break;
default:
return SR_ERR_NA;