+ struct sigma *sigma = sdi->priv;
+ struct sr_probe *probe;
+ GSList *l;
+ int trigger_set = 0;
+ int probebit;
+
+ memset(&sigma->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 (sigma->cur_samplerate >= SR_MHZ(100)) {
+ /* Fast trigger support. */
+ if (trigger_set) {
+ sr_err("ASIX SIGMA only supports a single "
+ "pin trigger in 100 and 200MHz mode.");
+ return SR_ERR;
+ }
+ if (probe->trigger[0] == 'f')
+ sigma->trigger.fallingmask |= probebit;
+ else if (probe->trigger[0] == 'r')
+ sigma->trigger.risingmask |= probebit;
+ else {
+ sr_err("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') {
+ sigma->trigger.simplevalue |= probebit;
+ sigma->trigger.simplemask |= probebit;
+ }
+ else if (probe->trigger[0] == '0') {
+ sigma->trigger.simplevalue &= ~probebit;
+ sigma->trigger.simplemask |= probebit;
+ }
+ else if (probe->trigger[0] == 'f') {
+ sigma->trigger.fallingmask |= probebit;
+ ++trigger_set;
+ }
+ else if (probe->trigger[0] == 'r') {
+ sigma->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("ASIX SIGMA only supports 1 rising/"
+ "falling triggers.");
+ return SR_ERR;
+ }
+ }