summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Stefan Richter 2009-01-11 22:46:48 +0100
committerGravatar Stefan Richter 2009-05-30 10:17:43 +0200
commit49dda1ef90ab1c8b57634a06a35bbbacbe17604e (patch)
tree7f5c21d1baf0c54272bd9751189ae7c306146c45
parentUse new iso resource allocation ioctls (diff)
Iso reception: Use packet timestamps in juju ABI v2
In the firewire-cdev ABI v1, the kernel exported only the timestamp of interrupt packets. libraw1394 estimated the cycle of all packets between interrupt packets by continuously incrementing the cycle. In v2 of the ABI, we can obtain an accurate timestamp of each packet as provided by the OHCI controller. AFAIU, this is also what you got from raw1394/ ohci1394. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to '')
-rw-r--r--src/fw-iso.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/fw-iso.c b/src/fw-iso.c
index e7618b5..e49ad3d 100644
--- a/src/fw-iso.c
+++ b/src/fw-iso.c
@@ -141,12 +141,17 @@ int fw_iso_xmit_start(raw1394handle_t handle, int start_on_cycle,
return 0;
}
+static inline int recv_header_length(fw_handle_t handle)
+{
+ return handle->abi_version >= 2 ? 8 : 4;
+}
+
static int
queue_recv_packets(fw_handle_t handle)
{
while (handle->iso.packet_count <= handle->iso.buf_packets)
- queue_packet(handle, handle->iso.max_packet_size, 4, 0, 0);
-
+ queue_packet(handle, handle->iso.max_packet_size,
+ recv_header_length(handle), 0, 0);
return 0;
}
@@ -159,9 +164,11 @@ flush_recv_packets(raw1394handle_t handle,
quadlet_t header, *p, *end;
unsigned int len, cycle, dropped;
unsigned char channel, tag, sy;
+ int header_has_timestamp;
p = interrupt->header;
end = (void *) interrupt->header + interrupt->header_length;
+ header_has_timestamp = fwhandle->abi_version >= 2;
cycle = interrupt->cycle;
dropped = 0;
d = RAW1394_ISO_OK;
@@ -173,6 +180,9 @@ flush_recv_packets(raw1394handle_t handle,
channel = (header >> 8) & 0x3f;
sy = header & 0x0f;
+ if (header_has_timestamp)
+ cycle = be32_to_cpu(*p++) & 0x1fff;
+
d = fwhandle->iso.recv_handler(handle, fwhandle->iso.tail, len,
channel, tag, sy, cycle, dropped);
if (d != RAW1394_ISO_OK)
@@ -420,7 +430,7 @@ iso_init(fw_handle_t handle, int type,
create.type = type;
create.channel = channel;
create.speed = speed;
- create.header_size = 4;
+ create.header_size = recv_header_length(handle);
retval = ioctl(handle->iso.fd,
FW_CDEV_IOC_CREATE_ISO_CONTEXT, &create);
avatar/2fce9f8dd90949315d789a6546dfacd0?s=13&d=retro' width='13' height='13' alt='Gravatar' /> bencollins 4-5/+14 2003-04-23add libtoolize to bootstrapGravatar ddennedy 1-1/+10 2003-04-21added Dan Maas' rawiso docsGravatar ddennedy 1-32/+295 2003-04-07new_handle_on_port() error path fix from Jim RadfordGravatar dmaas 1-1/+3 2003-03-26add raw1394_new_handle_on_port() convenience functionGravatar dmaas 2-1/+41 2003-02-22Updates for new rawiso ioctl interface.Gravatar bencollins 3-37/+125 2003-01-15add iso_xmit_sync() and iso_xmit_write(); clean up iso handling a bitGravatar dmaas 5-39/+161 2003-01-15implement tag matching for rawiso receptionGravatar dmaas 3-4/+12 2003-01-06back out previous commit - don't drop the legacy API just yetGravatar dmaas 6-173/+130 2003-01-05emulate legacy ISO reception API on top of new rawiso APIGravatar dmaas 7-131/+174 2002-12-24update iso API for multi-channel reception and new packet buffer layoutGravatar dmaas 4-123/+236 2002-12-20oops, irq_interval needs to be signedGravatar anonymous 1-1/+1 2002-12-20dmaas - renamed exported arm definitions into the raw1394_ namespace; brought...Gravatar anonymous 3-124/+48 2002-12-16rawiso updates:Gravatar dmaas 3-18/+25 2002-11-18fix cplusplus extern C blockGravatar ddennedy 1-4/+4 2002-11-18merged rawiso branchGravatar ddennedy 7-6/+488