MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / config_set

Function config_set

libsigrok4DSL/hardware/DSL/dscope.c:1217–1736  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1215}
1216
1217static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
1218 struct sr_channel *ch,
1219 struct sr_channel_group *cg )
1220{
1221 struct DSL_context *devc;
1222 int ret, num_probes;
1223 struct sr_usb_dev_inst *usb;
1224 struct libusb_device_handle *hdl;
1225 struct ctl_wr_cmd wr_cmd;
1226 unsigned int i;
1227 GSList *l;
1228 int nv;
1229
1230 assert(sdi);
1231 assert(sdi->priv);
1232
1233 (void)cg;
1234
1235 if (sdi->status != SR_ST_ACTIVE) {
1236 return SR_ERR;
1237 }
1238
1239 devc = sdi->priv;
1240 usb = sdi->conn;
1241 hdl = usb->devhdl;
1242
1243 ret = dsl_config_set(id, data, sdi, ch, cg);
1244 if (ret == SR_OK)
1245 return ret;
1246
1247 ret = SR_OK;
1248 if (id == SR_CONF_CLOCK_TYPE) {
1249 devc->clock_type = g_variant_get_boolean(data);
1250 } else if (id == SR_CONF_CLOCK_EDGE) {
1251 devc->clock_edge = g_variant_get_boolean(data);
1252 } else if (id == SR_CONF_LIMIT_SAMPLES) {
1253 devc->limit_samples = g_variant_get_uint64(data);
1254 } else if (id == SR_CONF_PROBE_VDIV) {
1255 ch->vdiv = g_variant_get_uint64(data);
1256 ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, ch, SR_CONF_PROBE_VDIV));
1257 if (ret == SR_OK)
1258 sr_dbg("%s: setting VDIV of channel %d to %d mv",
1259 __func__, ch->index, ch->vdiv);
1260 else
1261 sr_dbg("%s: setting VDIV of channel %d to %d mv failed",
1262 __func__, ch->index, ch->vdiv);
1263 } else if (id == SR_CONF_PROBE_FACTOR) {
1264 ch->vfactor = g_variant_get_uint64(data);
1265 sr_dbg("%s: setting Factor of channel %d to %d", __func__,
1266 ch->index, ch->vfactor);
1267 } else if (id == SR_CONF_TIMEBASE) {
1268 devc->timebase = g_variant_get_uint64(data);
1269 } else if (id == SR_CONF_PROBE_COUPLING) {
1270 ch->coupling = g_variant_get_byte(data);
1271 if (ch->coupling == SR_GND_COUPLING)
1272 ch->coupling = SR_DC_COUPLING;
1273 ret = dsl_wr_dso(sdi, dso_cmd_gen(sdi, ch, SR_CONF_PROBE_COUPLING));
1274 if (ret == SR_OK)

Callers 1

dev_openFunction · 0.70

Calls 14

dsl_config_setFunction · 0.85
dsl_wr_dsoFunction · 0.85
dsl_en_ch_numFunction · 0.85
dsl_adjust_probesFunction · 0.85
dsl_adjust_samplerateFunction · 0.85
dsl_wr_regFunction · 0.85
dsl_config_adcFunction · 0.85
command_ctl_wrFunction · 0.85
dso_zeroFunction · 0.85
dso_load_eepFunction · 0.85
dsl_adc_fgain2codeFunction · 0.85
dsl_wr_nvmFunction · 0.85

Tested by

no test coverage detected