aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Fenlason <fenlason@redhat.com>2009-11-19 15:00:02 -0500
committerStefan Richter <stefanr@s5r6.in-berlin.de>2009-11-22 23:17:49 +0100
commit4e2fd98144d37bf73197e7058f8f6685acd748d9 (patch)
tree2a453eba164c77b145ac55236c4d04bf7fa5c176
parentce82d255efa4d748e4ade922f71796a502a19c27 (diff)
downloadlibraw1394-4e2fd98144d37bf73197e7058f8f6685acd748d9.tar.gz
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)
-rw-r--r--src/fw-iso.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/fw-iso.c b/src/fw-iso.c
index 235040b..466b638 100644
--- a/src/fw-iso.c
+++ b/src/fw-iso.c
@@ -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--;