asix-sigma: Unify calling of decode_chunk_ts()
Clean up the way decode_chunk_ts() is called a little. Introduce a variable which will not be -1 only in case a trigger happened on the particular DRAM line. Signed-off-by: Marek Vasut <marex@denx.de>
This commit is contained in:
parent
c6648b663c
commit
e69ad48e08
|
@ -1083,7 +1083,7 @@ static int download_capture(struct sr_dev_inst *sdi)
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint32_t dl_lines_total, dl_lines_curr, dl_lines_done;
|
uint32_t dl_lines_total, dl_lines_curr, dl_lines_done;
|
||||||
uint32_t dl_trailing_events;
|
uint32_t dl_trailing_events;
|
||||||
uint32_t trg_line;
|
uint32_t trg_line = ~0;
|
||||||
|
|
||||||
dram_line = g_try_malloc0(chunks_per_read * sizeof(*dram_line));
|
dram_line = g_try_malloc0(chunks_per_read * sizeof(*dram_line));
|
||||||
if (!dram_line)
|
if (!dram_line)
|
||||||
|
@ -1106,8 +1106,6 @@ static int download_capture(struct sr_dev_inst *sdi)
|
||||||
modestatus = sigma_get_register(READ_MODE, devc);
|
modestatus = sigma_get_register(READ_MODE, devc);
|
||||||
if (modestatus & 0x20)
|
if (modestatus & 0x20)
|
||||||
trg_line = triggerpos >> 9;
|
trg_line = triggerpos >> 9;
|
||||||
else
|
|
||||||
trg_line = ~0;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determine how many 1024b "DRAM lines" do we need to read from the
|
* Determine how many 1024b "DRAM lines" do we need to read from the
|
||||||
|
@ -1135,22 +1133,19 @@ static int download_capture(struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
for (i = 0; i < dl_lines_curr; i++) {
|
for (i = 0; i < dl_lines_curr; i++) {
|
||||||
uint32_t dl_limit = 0;
|
uint32_t dl_limit = 0;
|
||||||
|
int trigger_line = -1;
|
||||||
/* The last "DRAM line" can be only partially full. */
|
/* The last "DRAM line" can be only partially full. */
|
||||||
if (dl_lines_done + i == dl_lines_total - 1)
|
if (dl_lines_done + i == dl_lines_total - 1)
|
||||||
dl_limit = dl_trailing_events;
|
dl_limit = dl_trailing_events;
|
||||||
|
|
||||||
|
/* Test if the trigger happened on this line. */
|
||||||
if (dl_lines_done + i == trg_line)
|
if (dl_lines_done + i == trg_line)
|
||||||
|
trigger_line = trg_line;
|
||||||
|
|
||||||
decode_chunk_ts(buf + (i * CHUNK_SIZE),
|
decode_chunk_ts(buf + (i * CHUNK_SIZE),
|
||||||
&devc->state.lastts,
|
&devc->state.lastts,
|
||||||
&devc->state.lastsample,
|
&devc->state.lastsample,
|
||||||
triggerpos & 0x1ff,
|
trigger_line, dl_limit, sdi);
|
||||||
dl_limit, sdi);
|
|
||||||
else
|
|
||||||
decode_chunk_ts(buf + (i * CHUNK_SIZE),
|
|
||||||
&devc->state.lastts,
|
|
||||||
&devc->state.lastsample,
|
|
||||||
-1,
|
|
||||||
dl_limit, sdi);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dl_lines_done += dl_lines_curr;
|
dl_lines_done += dl_lines_curr;
|
||||||
|
|
Loading…
Reference in New Issue