la8->final_buf = NULL;
la8->trigger_pattern = 0x00; /* Value irrelevant, see trigger_mask. */
la8->trigger_mask = 0x00; /* All probes are "don't care". */
la8->final_buf = NULL;
la8->trigger_pattern = 0x00; /* Value irrelevant, see trigger_mask. */
la8->trigger_mask = 0x00; /* All probes are "don't care". */
*
* @param la8 The LA8 struct containing private per-device-instance data.
* @return SR_OK upon success, or SR_ERR upon errors.
*
* @param la8 The LA8 struct containing private per-device-instance data.
* @return SR_OK upon success, or SR_ERR upon errors.
/* If first block read got 0 bytes, retry until success or timeout. */
if ((bytes_read == 0) && (la8->block_counter == 0)) {
do {
// sr_dbg("la8: %s: reading block 0 again", __func__);
/* If first block read got 0 bytes, retry until success or timeout. */
if ((bytes_read == 0) && (la8->block_counter == 0)) {
do {
// sr_dbg("la8: %s: reading block 0 again", __func__);
/* TODO: How to handle read errors here? */
now = time(NULL);
} while ((la8->done > now) && (bytes_read == 0));
}
/* Check if block read was successful or a timeout occured. */
/* TODO: How to handle read errors here? */
now = time(NULL);
} while ((la8->done > now) && (bytes_read == 0));
}
/* Check if block read was successful or a timeout occured. */
sr_warn("la8: %s: trigger timed out", __func__);
(void) la8_reset(la8); /* Ignore errors. */
return SR_ERR;
sr_warn("la8: %s: trigger timed out", __func__);
(void) la8_reset(la8); /* Ignore errors. */
return SR_ERR;
/* De-mangle the data. */
// sr_dbg("la8: de-mangling samples of block %d", la8->block_counter);
/* De-mangle the data. */
// sr_dbg("la8: de-mangling samples of block %d", la8->block_counter);
/* Check if we can find the trigger condition in this block. */
trigger_point = -1;
expected_sample = la8->trigger_pattern & la8->trigger_mask;
/* Check if we can find the trigger condition in this block. */
trigger_point = -1;
expected_sample = la8->trigger_pattern & la8->trigger_mask;
/* If no trigger was found, send one SR_DF_LOGIC packet. */
if (trigger_point == -1) {
/* If no trigger was found, send one SR_DF_LOGIC packet. */
if (trigger_point == -1) {
// sr_dbg("la8: %s: sending SR_DF_LOGIC packet", __func__);
packet.type = SR_DF_LOGIC;
// sr_dbg("la8: %s: sending SR_DF_LOGIC packet", __func__);
packet.type = SR_DF_LOGIC;
/* Send pre-trigger SR_DF_LOGIC packet to the session bus. */
sr_dbg("la8: %s: sending pre-trigger SR_DF_LOGIC packet, ",
"start = %" PRIu64 ", length = %d", __func__,
/* Send pre-trigger SR_DF_LOGIC packet to the session bus. */
sr_dbg("la8: %s: sending pre-trigger SR_DF_LOGIC packet, ",
"start = %" PRIu64 ", length = %d", __func__,
sr_session_bus(la8->session_id, &packet);
}
/* Send the SR_DF_TRIGGER packet to the session bus. */
sr_dbg("la8: %s: sending SR_DF_TRIGGER packet, sample = %" PRIu64,
sr_session_bus(la8->session_id, &packet);
}
/* Send the SR_DF_TRIGGER packet to the session bus. */
sr_dbg("la8: %s: sending SR_DF_TRIGGER packet, sample = %" PRIu64,
sr_session_bus(la8->session_id, &packet);
/* If at least one sample is located after the trigger... */
sr_session_bus(la8->session_id, &packet);
/* If at least one sample is located after the trigger... */
/* Send post-trigger SR_DF_LOGIC packet to the session bus. */
sr_dbg("la8: %s: sending post-trigger SR_DF_LOGIC packet, ",
"start = %" PRIu64 ", length = %d", __func__,
/* Send post-trigger SR_DF_LOGIC packet to the session bus. */
sr_dbg("la8: %s: sending post-trigger SR_DF_LOGIC packet, ",
"start = %" PRIu64 ", length = %d", __func__,
if ((ret = la8_read_block(la8)) < 0) {
sr_err("la8: %s: la8_read_block error: %d", __func__, ret);
hw_stop_acquisition(sdi->index, user_data);
return FALSE;
}
if ((ret = la8_read_block(la8)) < 0) {
sr_err("la8: %s: la8_read_block error: %d", __func__, ret);
hw_stop_acquisition(sdi->index, user_data);
return FALSE;
}
- /* We need to get exactly 2048 blocks (i.e. 8MB) of data. */
- if (la8->block_counter != 2047) {
+ /* We need to get exactly NUM_BLOCKS blocks (i.e. 8MB) of data. */
+ if (la8->block_counter != (NUM_BLOCKS - 1)) {
sr_dbg("la8: sampling finished, sending data to session bus now");
/* All data was received and demangled, send it to the session bus. */
sr_dbg("la8: sampling finished, sending data to session bus now");
/* All data was received and demangled, send it to the session bus. */
send_block_to_session_bus(la8, i);
hw_stop_acquisition(sdi->index, user_data);
send_block_to_session_bus(la8, i);
hw_stop_acquisition(sdi->index, user_data);