- struct ipdbg_org_la_dev_context *devc;
- struct sr_trigger *trigger;
- struct sr_trigger_stage *stage;
- struct sr_trigger_match *match;
- const GSList *l, *m;
-
- devc = sdi->priv;
-
- devc->num_stages = 0;
- devc->num_transfers = 0;
- devc->raw_sample_buf = NULL; /// name convert_trigger to init acquisition...
- for (unsigned int i = 0; i < devc->DATA_WIDTH_BYTES; i++) // Hier werden die Trigger-Variabeln 0 gesetzt!
- {
- devc->trigger_mask[i] = 0;
- devc->trigger_value[i] = 0;
- devc->trigger_mask_last[i] = 0;
- devc->trigger_value_last[i] = 0;
- devc->trigger_edge_mask[i] = 0;
- }
-
- if (!(trigger = sr_session_trigger_get(sdi->session))) //
- {
- return SR_OK;
- }
-
- for (l = trigger->stages; l; l = l->next)
- {
- stage = l->data;
- for (m = stage->matches; m; m = m->next)
- {
- match = m->data;
- unsigned int byteIndex = (match->channel->index) /8;
- unsigned char matchPattern = 1 << (match->channel->index - 8* byteIndex);
- //zeroTrigger |= matchPattern;
- //sr_err("\n\nzerotrigger:%x\n\n",zeroTrigger);
- //sr_err("\nbyteIndex:%i",byteIndex);
- //sr_err("\nmatch Pattern:%i\n",matchPattern);
-
- if (!match->channel->enabled)
- /* Ignore disabled channels with a trigger. */
- continue;
- if (match->match == SR_TRIGGER_ONE )
- {
- devc->trigger_value[byteIndex] |= matchPattern;
- devc->trigger_mask[byteIndex] |= matchPattern;
- devc->trigger_mask_last[byteIndex] &= ~matchPattern;
- devc->trigger_edge_mask[byteIndex] &= ~matchPattern;
- //sr_err("\n========ONE MASK===========");
-
- }
- else if (match->match == SR_TRIGGER_ZERO)
- {
- devc->trigger_value[byteIndex] &= ~matchPattern;
- devc->trigger_mask[byteIndex] |= matchPattern;
- devc->trigger_mask_last[byteIndex] &= ~matchPattern;
- devc->trigger_edge_mask[byteIndex] &= ~matchPattern;
- //sr_err("\n========ZERO MASK===========");
- }
- else if ( match->match == SR_TRIGGER_RISING)
- {
- devc->trigger_value[byteIndex] |= matchPattern;
- devc->trigger_value_last[byteIndex] &= ~matchPattern;
- devc->trigger_mask[byteIndex] |= matchPattern;
- devc->trigger_mask_last[byteIndex] |= matchPattern;
- devc->trigger_edge_mask[byteIndex] &= ~matchPattern;
- //sr_err("\n==========RISING===========");
-
- }
- else if (match->match == SR_TRIGGER_FALLING )
- {
- devc->trigger_value[byteIndex] &= ~matchPattern;
- devc->trigger_value_last[byteIndex] |= matchPattern;
- devc->trigger_mask[byteIndex] |= matchPattern;
- devc->trigger_mask_last[byteIndex] |= matchPattern;
- devc->trigger_edge_mask[byteIndex] &= ~matchPattern;
- //sr_err("\n========FALlING===========");
- }
- else if (match->match == SR_TRIGGER_EDGE)
- {
- devc->trigger_mask[byteIndex] &= ~matchPattern;
- devc->trigger_mask_last[byteIndex] &= ~matchPattern;
- devc->trigger_edge_mask[byteIndex] |= matchPattern;
- }
-
- }
-
- }
-
- return SR_OK;
+ struct ipdbg_org_la_dev_context *devc;
+ struct sr_trigger *trigger;
+ struct sr_trigger_stage *stage;
+ struct sr_trigger_match *match;
+ const GSList *l, *m;
+
+ devc = sdi->priv;
+
+ devc->num_stages = 0;
+ devc->num_transfers = 0;
+ devc->raw_sample_buf = NULL;
+
+ for (uint64_t i = 0; i < devc->DATA_WIDTH_BYTES; i++) {
+ devc->trigger_mask[i] = 0;
+ devc->trigger_value[i] = 0;
+ devc->trigger_mask_last[i] = 0;
+ devc->trigger_value_last[i] = 0;
+ devc->trigger_edge_mask[i] = 0;
+ }
+
+ if (!(trigger = sr_session_trigger_get(sdi->session)))
+ return SR_OK;
+
+ for (l = trigger->stages; l; l = l->next) {
+ stage = l->data;
+ for (m = stage->matches; m; m = m->next) {
+ match = m->data;
+ int byte_idx = match->channel->index / 8;
+ uint8_t match_bit = 1 << (match->channel->index % 8);
+
+ if (!match->channel->enabled)
+ /* Ignore disabled channels with a trigger. */
+ continue;
+
+ if (match->match == SR_TRIGGER_ONE) {
+ devc->trigger_value[byte_idx] |= match_bit;
+ devc->trigger_mask[byte_idx] |= match_bit;
+ devc->trigger_mask_last[byte_idx] &= ~match_bit;
+ devc->trigger_edge_mask[byte_idx] &= ~match_bit;
+ } else if (match->match == SR_TRIGGER_ZERO) {
+ devc->trigger_value[byte_idx] &= ~match_bit;
+ devc->trigger_mask[byte_idx] |= match_bit;
+ devc->trigger_mask_last[byte_idx] &= ~match_bit;
+ devc->trigger_edge_mask[byte_idx] &= ~match_bit;
+ } else if (match->match == SR_TRIGGER_RISING) {
+ devc->trigger_value[byte_idx] |= match_bit;
+ devc->trigger_value_last[byte_idx] &=
+ ~match_bit;
+ devc->trigger_mask[byte_idx] |= match_bit;
+ devc->trigger_mask_last[byte_idx] |= match_bit;
+ devc->trigger_edge_mask[byte_idx] &= ~match_bit;
+ } else if (match->match == SR_TRIGGER_FALLING) {
+ devc->trigger_value[byte_idx] &= ~match_bit;
+ devc->trigger_value_last[byte_idx] |= match_bit;
+ devc->trigger_mask[byte_idx] |= match_bit;
+ devc->trigger_mask_last[byte_idx] |= match_bit;
+ devc->trigger_edge_mask[byte_idx] &= ~match_bit;
+ } else if (match->match == SR_TRIGGER_EDGE) {
+ devc->trigger_mask[byte_idx] &= ~match_bit;
+ devc->trigger_mask_last[byte_idx] &= ~match_bit;
+ devc->trigger_edge_mask[byte_idx] |= match_bit;
+ }
+ }
+ }
+
+ return SR_OK;