}
/* Only send trigger if explicitly enabled. */
- if (devc->use_triggers) {
- packet.type = SR_DF_TRIGGER;
- sr_session_send(sdi, &packet);
- }
+ if (devc->use_triggers)
+ std_session_send_df_trigger(sdi);
}
/*
/* Send the SR_DF_TRIGGER packet to the session bus. */
sr_spew("Sending SR_DF_TRIGGER packet, sample = %d.",
(block * BS) + trigger_point);
- packet.type = SR_DF_TRIGGER;
- packet.payload = NULL;
- sr_session_send(sdi, &packet);
+ std_session_send_df_trigger(sdi);
/* If at least one sample is located after the trigger... */
if (trigger_point < (BS - 1)) {
(DSLOGIC_ATOMIC_BYTES * channel_count);
gboolean packet_has_error = FALSE;
- struct sr_datafeed_packet packet;
unsigned int num_samples;
int trigger_offset;
devc->sent_samples += trigger_offset;
/* Trigger position. */
devc->trigger_pos = 0;
- packet.type = SR_DF_TRIGGER;
- packet.payload = NULL;
- sr_session_send(sdi, &packet);
+ std_session_send_df_trigger(sdi);
/* Post trigger samples. */
num_samples -= trigger_offset;
send_data(sdi, devc->deinterleave_buffer
.type = SR_DF_LOGIC,
.payload = &logic
};
- const struct sr_datafeed_packet trig = {
- .type = SR_DF_TRIGGER,
- .payload = NULL
- };
size_t trigger_offset;
if (devc->trigger_pos >= devc->sent_samples &&
sr_session_send(sdi, &packet);
/* Send trigger position. */
- sr_session_send(sdi, &trig);
+ std_session_send_df_trigger(sdi);
/* Send rest of data. */
logic.length = (sample_count - trigger_offset) * sizeof(uint32_t);
if (interleave)
num *= 2;
if (!devc->step) {
- struct sr_datafeed_packet packet = {
- .type = SR_DF_TRIGGER
- };
-
push_samples(sdi, buf, 6);
- sr_session_send(sdi, &packet);
+ std_session_send_df_trigger(sdi);
buf += 6;
num -= 6;
}
* through the capture ratio.
*/
if (devc->trigger_type != TRIGGER_TYPE_NONE &&
- devc->pre_trigger_samples == 0) {
- packet.type = SR_DF_TRIGGER;
- sr_session_send(sdi, &packet);
- }
+ devc->pre_trigger_samples == 0)
+ std_session_send_df_trigger(sdi);
}
for (; k >= 0; k--) {
logic.data = buffer;
sr_session_send(sdi, &packet);
- packet.type = SR_DF_TRIGGER;
- sr_session_send(sdi, &packet);
+ std_session_send_df_trigger(sdi);
n = 0;
}
}
/* Send the trigger. */
- packet.type = SR_DF_TRIGGER;
- sr_session_send(cb_data, &packet);
+ std_session_send_df_trigger(cb_data);
/* Send post-trigger samples. */
packet.type = SR_DF_LOGIC;
const struct sr_dev_inst *sdi;
struct dev_context *devc;
struct drv_context *drvc;
- struct sr_datafeed_packet packet;
uint32_t bytes_left, length;
uint16_t read_offset, trigger_offset;
}
/* Here comes the trigger. */
- packet.type = SR_DF_TRIGGER;
- packet.payload = NULL;
-
- sr_session_send(sdi, &packet);
+ std_session_send_df_trigger(sdi);
/* Send post-trigger samples. */
while (bytes_left > 0) {
}
/* Send the trigger. */
- packet.type = SR_DF_TRIGGER;
- sr_session_send(sdi, &packet);
+ std_session_send_df_trigger(sdi);
/* Send post-trigger samples. */
packet.type = SR_DF_LOGIC;
}
/* Send the trigger. */
- packet.type = SR_DF_TRIGGER;
- sr_session_send(sdi, &packet);
+ std_session_send_df_trigger(sdi);
/* Send post-trigger samples. */
packet.type = SR_DF_LOGIC;
buf_offset += logic.length;
}
- if (samples_read == trigger_offset) {
- /* Send out trigger */
- packet.type = SR_DF_TRIGGER;
- packet.payload = NULL;
- sr_session_send(sdi, &packet);
- }
+ if (samples_read == trigger_offset)
+ std_session_send_df_trigger(sdi);
/* Send out data (or data after trigger) */
packet.type = SR_DF_LOGIC;
static void process_record_pi(struct sr_input *in, gsize start)
{
- struct sr_datafeed_packet packet;
struct context *inc;
uint64_t timestamp, next_timestamp;
uint32_t pod_data;
if (timestamp == inc->trigger_timestamp && !inc->trigger_sent) {
sr_dbg("Trigger @%lf s, record #%d.",
timestamp * TIMESTAMP_RESOLUTION, inc->cur_record);
-
- packet.type = SR_DF_TRIGGER;
- packet.payload = NULL;
- sr_session_send(in->sdi, &packet);
+ std_session_send_df_trigger(in->sdi);
inc->trigger_sent = TRUE;
}
static void process_record_iprobe(struct sr_input *in, gsize start)
{
- struct sr_datafeed_packet packet;
struct context *inc;
uint64_t timestamp, next_timestamp;
char single_payload[3];
if (timestamp == inc->trigger_timestamp && !inc->trigger_sent) {
sr_dbg("Trigger @%lf s, record #%d.",
timestamp * TIMESTAMP_RESOLUTION, inc->cur_record);
-
- packet.type = SR_DF_TRIGGER;
- packet.payload = NULL;
- sr_session_send(in->sdi, &packet);
+ std_session_send_df_trigger(in->sdi);
inc->trigger_sent = TRUE;
}
SR_PRIV int soft_trigger_logic_check(struct soft_trigger_logic *stl,
uint8_t *buf, int len, int *pre_trigger_samples)
{
- struct sr_datafeed_packet packet;
struct sr_trigger_stage *stage;
struct sr_trigger_match *match;
GSList *l, *l_stage;
/* Fire trigger. */
offset = i / stl->unitsize;
- packet.type = SR_DF_TRIGGER;
- packet.payload = NULL;
- sr_session_send(stl->sdi, &packet);
+ std_session_send_df_trigger(stl->sdi);
break;
}
} else if (stl->cur_stage > 0) {