Calculate iso receive cycles on firewire-core at ABI version 1
More accurately report the cycle on which isochronous packets were received. Only affects libraw1394 when used with kernel 2.6.29 or older. Signed-off-by: Jay Fenlason <fenlason@redhat.com> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (changelog, whitespace)
This commit is contained in:
parent
ce82d255ef
commit
4e2fd98144
19
src/fw-iso.c
19
src/fw-iso.c
|
@ -182,7 +182,21 @@ flush_recv_packets(raw1394handle_t handle,
|
||||||
p = interrupt->header;
|
p = interrupt->header;
|
||||||
end = (void *) interrupt->header + interrupt->header_length;
|
end = (void *) interrupt->header + interrupt->header_length;
|
||||||
header_has_timestamp = fwhandle->abi_version >= 2;
|
header_has_timestamp = fwhandle->abi_version >= 2;
|
||||||
cycle = interrupt->cycle;
|
/*
|
||||||
|
* This is bogus, but it's the best we can do without accurate
|
||||||
|
* timestamps. Assume that the first packet was received
|
||||||
|
* {number of packets} before the cycle recorded in the interrupt
|
||||||
|
* event, and that each subsequent packet was received one cycle
|
||||||
|
* later. This also assumes that the interrupt event happened
|
||||||
|
* immediately after the last packet was received.
|
||||||
|
*/
|
||||||
|
if (!header_has_timestamp) {
|
||||||
|
cycle = interrupt->cycle;
|
||||||
|
cycle &= 0x1fff;
|
||||||
|
cycle += 8000;
|
||||||
|
cycle -= end - p;
|
||||||
|
}
|
||||||
|
|
||||||
dropped = 0;
|
dropped = 0;
|
||||||
d = RAW1394_ISO_OK;
|
d = RAW1394_ISO_OK;
|
||||||
|
|
||||||
|
@ -195,6 +209,8 @@ flush_recv_packets(raw1394handle_t handle,
|
||||||
|
|
||||||
if (header_has_timestamp)
|
if (header_has_timestamp)
|
||||||
cycle = be32_to_cpu(*p++) & 0x1fff;
|
cycle = be32_to_cpu(*p++) & 0x1fff;
|
||||||
|
else
|
||||||
|
cycle++;
|
||||||
|
|
||||||
d = fwhandle->iso.recv_handler(handle, fwhandle->iso.tail, len,
|
d = fwhandle->iso.recv_handler(handle, fwhandle->iso.tail, len,
|
||||||
channel, tag, sy, cycle, dropped);
|
channel, tag, sy, cycle, dropped);
|
||||||
|
@ -202,7 +218,6 @@ flush_recv_packets(raw1394handle_t handle,
|
||||||
/* FIXME: we need to save the headers so we
|
/* FIXME: we need to save the headers so we
|
||||||
* can restart this loop. */
|
* can restart this loop. */
|
||||||
break;
|
break;
|
||||||
cycle++;
|
|
||||||
|
|
||||||
fwhandle->iso.tail += fwhandle->iso.max_packet_size;
|
fwhandle->iso.tail += fwhandle->iso.max_packet_size;
|
||||||
fwhandle->iso.packet_count--;
|
fwhandle->iso.packet_count--;
|
||||||
|
|
Reference in New Issue