Trace32 import module: Send trigger only once

As we're downsampling, several record time stamps can match the specified
trigger time. For this reason, it's possible that several trigger packets
are sent when a file is loaded. This prevents the issue and sends a
trigger packet only on the first matching record.
This commit is contained in:
Soeren Apel 2016-01-08 23:00:55 +01:00 committed by Uwe Hermann
parent 27d44cf6e0
commit a5be5d5bc0
1 changed files with 5 additions and 3 deletions

View File

@ -85,7 +85,7 @@ enum {
struct context { struct context {
gboolean meta_sent; gboolean meta_sent;
gboolean header_read, records_read; gboolean header_read, records_read, trigger_sent;
char format, device, record_mode, compression; char format, device, record_mode, compression;
char pod_status[MAX_POD_COUNT]; char pod_status[MAX_POD_COUNT];
struct sr_channel *channels[MAX_POD_COUNT][17]; /* 16 + CLK */ struct sr_channel *channels[MAX_POD_COUNT][17]; /* 16 + CLK */
@ -467,13 +467,14 @@ static void process_record_pi(struct sr_input *in, gsize start)
return; return;
} }
if (timestamp == inc->trigger_timestamp) { if (timestamp == inc->trigger_timestamp && !inc->trigger_sent) {
sr_dbg("Trigger @%lf s, record #%d.", sr_dbg("Trigger @%lf s, record #%d.",
timestamp * TIMESTAMP_RESOLUTION, inc->cur_record); timestamp * TIMESTAMP_RESOLUTION, inc->cur_record);
packet.type = SR_DF_TRIGGER; packet.type = SR_DF_TRIGGER;
packet.payload = NULL; packet.payload = NULL;
sr_session_send(in->sdi, &packet); sr_session_send(in->sdi, &packet);
inc->trigger_sent = TRUE;
} }
/* Is this the last record in the file? */ /* Is this the last record in the file? */
@ -519,13 +520,14 @@ static void process_record_iprobe(struct sr_input *in, gsize start)
single_payload[2] = R8(in->buf->str + start + 10) & 1; single_payload[2] = R8(in->buf->str + start + 10) & 1;
payload_len = 3; payload_len = 3;
if (timestamp == inc->trigger_timestamp) { if (timestamp == inc->trigger_timestamp && !inc->trigger_sent) {
sr_dbg("Trigger @%lf s, record #%d.", sr_dbg("Trigger @%lf s, record #%d.",
timestamp * TIMESTAMP_RESOLUTION, inc->cur_record); timestamp * TIMESTAMP_RESOLUTION, inc->cur_record);
packet.type = SR_DF_TRIGGER; packet.type = SR_DF_TRIGGER;
packet.payload = NULL; packet.payload = NULL;
sr_session_send(in->sdi, &packet); sr_session_send(in->sdi, &packet);
inc->trigger_sent = TRUE;
} }
/* Is this the last record in the file? */ /* Is this the last record in the file? */