summaryrefslogtreecommitdiffstats
path: root/src/eventloop.c
diff options
context:
space:
mode:
authorGravatar abombe 2000-02-04 23:20:17 +0000
committerGravatar abombe 2000-02-04 23:20:17 +0000
commit9eb8df1247c1f573e9c28644a2457d89ddc0459d (patch)
treedcba8a50d61c3e72a4e0907dba143eff372b1525 /src/eventloop.c
parentAdded dev target to Makefile (diff)
Changed iso rcv handling to separate handlers per channel.
git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@6 53a565d1-3bb7-0310-b661-cf11e63c67ab
Diffstat (limited to 'src/eventloop.c')
-rw-r--r--src/eventloop.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/eventloop.c b/src/eventloop.c
index 32b053c..62f5202 100644
--- a/src/eventloop.c
+++ b/src/eventloop.c
@@ -9,7 +9,7 @@
int raw1394_loop_iterate(struct raw1394_handle *handle)
{
struct raw1394_request *req = &handle->req;
- int retval = 0;
+ int retval = 0, channel;
if (read(handle->fd, req, sizeof(*req)) < 0) {
return -1;
@@ -27,11 +27,12 @@ int raw1394_loop_iterate(struct raw1394_handle *handle)
break;
case RAW1394_REQ_ISO_RECEIVE:
- if (handle->iso_handler) {
- retval = handle->iso_handler(handle,
- (handle->buffer[0] >> 8)
- & 0x3f, req->length,
- handle->buffer);
+ channel = (handle->buffer[0] >> 8) & 0x3f;
+
+ if (handle->iso_handler[channel]) {
+ retval = handle->iso_handler[channel](handle, channel,
+ req->length,
+ handle->buffer);
}
break;
@@ -70,12 +71,22 @@ tag_handler_t raw1394_set_tag_handler(struct raw1394_handle *handle,
}
iso_handler_t raw1394_set_iso_handler(struct raw1394_handle *handle,
- iso_handler_t new)
+ unsigned int channel, iso_handler_t new)
{
- iso_handler_t old;
+ if (channel >= 64) {
+ return (iso_handler_t)-1;
+ }
+
+ if (new == NULL) {
+ iso_handler_t old = handle->iso_handler[channel];
+ handle->iso_handler[channel] = NULL;
+ return old;
+ }
- old = handle->iso_handler;
- handle->iso_handler = new;
+ if (handle->iso_handler[channel] != NULL) {
+ return (iso_handler_t)-1;
+ }
- return old;
+ handle->iso_handler[channel] = new;
+ return NULL;
}