summaryrefslogtreecommitdiffstats
path: root/juju
diff options
context:
space:
mode:
authorGravatar Kristian Høgsberg 2007-04-03 21:23:08 -0400
committerGravatar Kristian Høgsberg 2007-04-03 21:23:08 -0400
commit18c6919398b63c714040f0971e98fc940bb3b32d (patch)
treeb005fc379f2912c754d66de02e76caac0310855a /juju
parentFix xmit payload packing, use pointers for circular buffer indices. (diff)
Handle rawiso dispositions.
Diffstat (limited to '')
-rw-r--r--juju/raw1394-iso.c44
1 files changed, 37 insertions, 7 deletions
diff --git a/juju/raw1394-iso.c b/juju/raw1394-iso.c
index b97bf87..bbf49f0 100644
--- a/juju/raw1394-iso.c
+++ b/juju/raw1394-iso.c
@@ -30,7 +30,7 @@
#include "juju.h"
-static int
+static enum raw1394_iso_disposition
queue_xmit_packets(raw1394handle_t handle)
{
struct fw_cdev_iso_packet *p = handle->iso.packets;
@@ -53,7 +53,8 @@ queue_xmit_packets(raw1394handle_t handle)
d = handle->iso.xmit_handler(handle, handle->iso.head,
&len, &tag, &sy, cycle, dropped);
- /* FIXME: handle the different dispositions. */
+ if (d != RAW1394_ISO_OK)
+ break;
p->payload_length = len;
p->interrupt =
@@ -77,14 +78,15 @@ queue_xmit_packets(raw1394handle_t handle)
len = ioctl(handle->iso.fd, FW_CDEV_IOC_QUEUE_ISO, &queue_iso);
if (len < 0)
- return -1;
+ return RAW1394_ISO_ERROR;
- return 0;
+ return d;
}
static int
flush_xmit_packets(raw1394handle_t handle, int limit)
{
+ enum raw1394_iso_disposition d;
int len;
if (handle->iso.xmit_handler == NULL)
@@ -93,8 +95,19 @@ flush_xmit_packets(raw1394handle_t handle, int limit)
if (limit < handle->iso.irq_interval)
limit = handle->iso.irq_interval;
- while (handle->iso.packet_count + handle->iso.irq_interval <= limit)
- queue_xmit_packets(handle);
+ while (handle->iso.packet_count + handle->iso.irq_interval <= limit) {
+ d = queue_xmit_packets(handle);
+ switch (d) {
+ case RAW1394_ISO_DEFER:
+ case RAW1394_ISO_AGAIN:
+ return 0;
+ case RAW1394_ISO_ERROR:
+ return -1;
+ case RAW1394_ISO_STOP:
+ raw1394_iso_stop(handle);
+ return 0;
+ }
+ }
return 0;
}
@@ -168,7 +181,7 @@ queue_recv_packets(raw1394handle_t handle)
return 0;
}
-static int
+static enum raw1394_iso_disposition
flush_recv_packets(raw1394handle_t handle,
struct fw_cdev_event_iso_interrupt *interrupt)
{
@@ -192,6 +205,10 @@ flush_recv_packets(raw1394handle_t handle,
d = handle->iso.recv_handler(handle, handle->iso.tail, len,
channel, tag, sy, cycle, dropped);
+ if (d != RAW1394_ISO_OK)
+ /* FIXME: we need to save the headers so we
+ * can restart this loop. */
+ break;
cycle++;
handle->iso.tail += handle->iso.max_packet_size;
@@ -200,6 +217,19 @@ flush_recv_packets(raw1394handle_t handle,
handle->iso.tail = handle->iso.buffer;
}
+ switch (d) {
+ case RAW1394_ISO_OK:
+ case RAW1394_ISO_DEFER:
+ break;
+
+ case RAW1394_ISO_ERROR:
+ return -1;
+
+ case RAW1394_ISO_STOP:
+ raw1394_iso_stop(handle);
+ return 0;
+ }
+
while (handle->iso.packet_count + handle->iso.irq_interval <=
handle->iso.buf_packets)
queue_recv_packets(handle);
:58:19 +0000'>2003-01-05emulate legacy ISO reception API on top of new rawiso APIGravatar dmaas 7-131/+174 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@99 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-12-24update iso API for multi-channel reception and new packet buffer layoutGravatar dmaas 4-123/+236 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@98 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-12-20oops, irq_interval needs to be signedGravatar anonymous 1-1/+1 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@97 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-12-20dmaas - renamed exported arm definitions into the raw1394_ namespace; ↵Gravatar anonymous 3-124/+48 brought kernel-raw1394.h back in sync with the kernel version git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@96 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-12-16rawiso updates:Gravatar dmaas 3-18/+25 - changed return type of rawiso xmit/recv handlers from int to enum raw1394_iso_disposition - added an ioctl (RAW1394_ISO_QUEUE_ACTIVITY) to force an ISO_ACTIVITY event into the queue. This is needed for handling RAW1394_ISO_DEFER, to kick us out of the next read() instead of sleeping forever. - removed references to "8-byte" isochronous header - this is an OHCI-specific implementation detail git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@95 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-11-18fix cplusplus extern C blockGravatar ddennedy 1-4/+4 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@94 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-11-18merged rawiso branchGravatar ddennedy 7-6/+488 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@93 53a565d1-3bb7-0310-b661-cf11e63c67ab