From 4c4d62f248d1c58a0cbd35d19f8ffda9bb4551f7 Mon Sep 17 00:00:00 2001 From: Stefan Richter Date: Mon, 23 Nov 2009 21:37:48 +0100 Subject: [PATCH] Addendum to 'Calculate iso receive cycles on firewire-core' The number of packets is a 4th of the number of header bytes (in case of ABI version 1). Also, wrap after an increment over 8000. Signed-off-by: Stefan Richter --- src/fw-iso.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/fw-iso.c b/src/fw-iso.c index 677b98d..88909dc 100644 --- a/src/fw-iso.c +++ b/src/fw-iso.c @@ -196,7 +196,7 @@ flush_recv_packets(raw1394handle_t handle, cycle = interrupt->cycle; cycle &= 0x1fff; cycle += 8000; - cycle -= end - p; + cycle -= interrupt->header_length / 4; } dropped = 0; @@ -211,8 +211,11 @@ flush_recv_packets(raw1394handle_t handle, if (header_has_timestamp) cycle = be32_to_cpu(*p++) & 0x1fff; - else + else { cycle++; + if (cycle >= 8000) + cycle -= 8000; + } d = fwhandle->iso.recv_handler(handle, fwhandle->iso.tail, len, channel, tag, sy, cycle, dropped);