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:
Jay Fenlason 2009-11-19 15:00:02 -05:00 committed by Stefan Richter
parent ce82d255ef
commit 4e2fd98144
1 changed files with 17 additions and 2 deletions

View File

@ -182,7 +182,21 @@ flush_recv_packets(raw1394handle_t handle,
p = interrupt->header;
end = (void *) interrupt->header + interrupt->header_length;
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;
d = RAW1394_ISO_OK;
@ -195,6 +209,8 @@ flush_recv_packets(raw1394handle_t handle,
if (header_has_timestamp)
cycle = be32_to_cpu(*p++) & 0x1fff;
else
cycle++;
d = fwhandle->iso.recv_handler(handle, fwhandle->iso.tail, len,
channel, tag, sy, cycle, dropped);
@ -202,7 +218,6 @@ flush_recv_packets(raw1394handle_t handle,
/* FIXME: we need to save the headers so we
* can restart this loop. */
break;
cycle++;
fwhandle->iso.tail += fwhandle->iso.max_packet_size;
fwhandle->iso.packet_count--;