+/*
+ * In 100 and 200 MHz mode, only a single pin rising/falling can be
+ * set as trigger. In other modes, two rising/falling triggers can be set,
+ * in addition to value/mask trigger for any number of probes.
+ *
+ * The Sigma supports complex triggers using boolean expressions, but this
+ * has not been implemented yet.
+ */
+static int configure_probes(struct sr_dev_inst *sdi, GSList *probes)
+{
+ struct context *ctx = sdi->priv;
+ struct sr_probe *probe;
+ GSList *l;
+ int trigger_set = 0;
+ int probebit;
+
+ memset(&ctx->trigger, 0, sizeof(struct sigma_trigger));
+
+ for (l = probes; l; l = l->next) {
+ probe = (struct sr_probe *)l->data;
+ probebit = 1 << (probe->index - 1);
+
+ if (!probe->enabled || !probe->trigger)
+ continue;
+
+ if (ctx->cur_samplerate >= SR_MHZ(100)) {
+ /* Fast trigger support. */
+ if (trigger_set) {
+ sr_err("sigma: ASIX SIGMA only supports a single "
+ "pin trigger in 100 and 200MHz mode.");
+ return SR_ERR;
+ }
+ if (probe->trigger[0] == 'f')
+ ctx->trigger.fallingmask |= probebit;
+ else if (probe->trigger[0] == 'r')
+ ctx->trigger.risingmask |= probebit;
+ else {
+ sr_err("sigma: ASIX SIGMA only supports "
+ "rising/falling trigger in 100 "
+ "and 200MHz mode.");
+ return SR_ERR;
+ }
+
+ ++trigger_set;
+ } else {
+ /* Simple trigger support (event). */
+ if (probe->trigger[0] == '1') {
+ ctx->trigger.simplevalue |= probebit;
+ ctx->trigger.simplemask |= probebit;
+ }
+ else if (probe->trigger[0] == '0') {
+ ctx->trigger.simplevalue &= ~probebit;
+ ctx->trigger.simplemask |= probebit;
+ }
+ else if (probe->trigger[0] == 'f') {
+ ctx->trigger.fallingmask |= probebit;
+ ++trigger_set;
+ }
+ else if (probe->trigger[0] == 'r') {
+ ctx->trigger.risingmask |= probebit;
+ ++trigger_set;
+ }
+
+ /*
+ * Actually, Sigma supports 2 rising/falling triggers,
+ * but they are ORed and the current trigger syntax
+ * does not permit ORed triggers.
+ */
+ if (trigger_set > 1) {
+ sr_err("sigma: ASIX SIGMA only supports 1 "
+ "rising/falling triggers.");
+ return SR_ERR;
+ }
+ }
+
+ if (trigger_set)
+ ctx->use_triggers = 1;
+ }
+
+ return SR_OK;
+}
+
+static int hw_dev_close(int dev_index)