The previous implementation got stuck in an infinite loop when data
acquisition started, but the device got disconnected before the data
acquisition terminates. An implementation detail ignored communication
errors, and never saw the expected condition that was required to
continue in the sample download sequence. Unbreak that code path.
return sigma_read(data, len, devc);
}
return sigma_read(data, len, devc);
}
-static uint8_t sigma_get_register(uint8_t reg, struct dev_context *devc)
-{
- uint8_t value;
-
- if (1 != sigma_read_register(reg, &value, 1, devc)) {
- sr_err("sigma_get_register: 1 byte expected");
- return 0;
- }
-
- return value;
-}
-
static int sigma_read_pos(uint32_t *stoppos, uint32_t *triggerpos,
struct dev_context *devc)
{
static int sigma_read_pos(uint32_t *stoppos, uint32_t *triggerpos,
struct dev_context *devc)
{
*/
sigma_set_register(WRITE_MODE, WMR_FORCESTOP | WMR_SDRAMWRITEEN, devc);
do {
*/
sigma_set_register(WRITE_MODE, WMR_FORCESTOP | WMR_SDRAMWRITEEN, devc);
do {
- modestatus = sigma_get_register(READ_MODE, devc);
+ if (sigma_read_register(READ_MODE, &modestatus, 1, devc) != 1) {
+ sr_err("sigma: failed while waiting for RMR_POSTTRIGGERED bit");
+ return FALSE;
+ }
} while (!(modestatus & RMR_POSTTRIGGERED));
/* Set SDRAM Read Enable. */
} while (!(modestatus & RMR_POSTTRIGGERED));
/* Set SDRAM Read Enable. */
sigma_read_pos(&stoppos, &triggerpos, devc);
/* Check if trigger has fired. */
sigma_read_pos(&stoppos, &triggerpos, devc);
/* Check if trigger has fired. */
- modestatus = sigma_get_register(READ_MODE, devc);
+ if (sigma_read_register(READ_MODE, &modestatus, 1, devc) != 1) {
+ sr_err("sigma: failed to read READ_MODE register");
+ return FALSE;
+ }
trg_line = ~0;
trg_event = ~0;
if (modestatus & RMR_TRIGGERED) {
trg_line = ~0;
trg_event = ~0;
if (modestatus & RMR_TRIGGERED) {