asix-sigma: Fixed RLE decoder
When "tsdiff < EVENTS_PER_CLUSTER" we don't want "tsdiff - EVENTS_PER_CLUSTER" (a negative number) to be treated as (int). Submitted-By: jry <jrysig@gmail.com> [ gsi: massaged for mainline submission ]
This commit is contained in:
parent
42be2adb5a
commit
a44b3b3f16
|
@ -723,7 +723,7 @@ static void sigma_decode_dram_cluster(struct sigma_dram_cluster *dram_cluster,
|
||||||
|
|
||||||
ts = sigma_dram_cluster_ts(dram_cluster);
|
ts = sigma_dram_cluster_ts(dram_cluster);
|
||||||
tsdiff = ts - ss->lastts;
|
tsdiff = ts - ss->lastts;
|
||||||
ss->lastts = ts;
|
ss->lastts = ts + EVENTS_PER_CLUSTER;
|
||||||
|
|
||||||
packet.type = SR_DF_LOGIC;
|
packet.type = SR_DF_LOGIC;
|
||||||
packet.payload = &logic;
|
packet.payload = &logic;
|
||||||
|
@ -741,7 +741,7 @@ static void sigma_decode_dram_cluster(struct sigma_dram_cluster *dram_cluster,
|
||||||
* sample in the cluster happens at the time of the timestamp
|
* sample in the cluster happens at the time of the timestamp
|
||||||
* and the remaining samples happen at timestamp +1...+6 .
|
* and the remaining samples happen at timestamp +1...+6 .
|
||||||
*/
|
*/
|
||||||
for (ts = 0; ts < tsdiff - (EVENTS_PER_CLUSTER - 1); ts++) {
|
for (ts = 0; ts < tsdiff; ts++) {
|
||||||
i = ts % 1024;
|
i = ts % 1024;
|
||||||
samples[2 * i + 0] = ss->lastsample & 0xff;
|
samples[2 * i + 0] = ss->lastsample & 0xff;
|
||||||
samples[2 * i + 1] = ss->lastsample >> 8;
|
samples[2 * i + 1] = ss->lastsample >> 8;
|
||||||
|
@ -751,7 +751,7 @@ static void sigma_decode_dram_cluster(struct sigma_dram_cluster *dram_cluster,
|
||||||
* end of submitting the padding samples, submit
|
* end of submitting the padding samples, submit
|
||||||
* the packet to Sigrok.
|
* the packet to Sigrok.
|
||||||
*/
|
*/
|
||||||
if ((i == 1023) || (ts == (tsdiff - EVENTS_PER_CLUSTER))) {
|
if ((i == 1023) || (ts == tsdiff - 1)) {
|
||||||
logic.length = (i + 1) * logic.unitsize;
|
logic.length = (i + 1) * logic.unitsize;
|
||||||
sr_session_send(sdi, &packet);
|
sr_session_send(sdi, &packet);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue