summaryrefslogtreecommitdiffstats
path: root/src/eventloop.c
diff options
context:
space:
mode:
authorGravatar dmaas 2003-01-06 04:08:00 +0000
committerGravatar dmaas 2003-01-06 04:08:00 +0000
commitce3cc1bd34bb2f450b231ffc92765f88d3422cad (patch)
treeb9b2a332ef8629d1b02ff89714e6698262c203fe /src/eventloop.c
parentemulate legacy ISO reception API on top of new rawiso API (diff)
back out previous commit - don't drop the legacy API just yet
git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@100 53a565d1-3bb7-0310-b661-cf11e63c67ab
Diffstat (limited to 'src/eventloop.c')
-rw-r--r--src/eventloop.c46
1 files changed, 44 insertions, 2 deletions
diff --git a/src/eventloop.c b/src/eventloop.c
index 4f05862..c360a63 100644
--- a/src/eventloop.c
+++ b/src/eventloop.c
@@ -65,8 +65,17 @@ int raw1394_loop_iterate(struct raw1394_handle *handle)
break;
case RAW1394_REQ_ISO_RECEIVE:
- /* obsolete API, not used anymore */
- break;
+ channel = (handle->buffer[0] >> 8) & 0x3f;
+#ifndef WORDS_BIGENDIAN
+ handle->buffer[0] = bswap_32(handle->buffer[0]);
+#endif
+
+ if (handle->iso_handler[channel]) {
+ retval = handle->iso_handler[channel](handle, channel,
+ req->length,
+ handle->buffer);
+ }
+ break;
case RAW1394_REQ_FCP_REQUEST:
if (handle->fcp_handler) {
@@ -159,6 +168,39 @@ arm_tag_handler_t raw1394_set_arm_tag_handler(struct raw1394_handle *handle,
return old;
}
+
+/**
+ * raw1394_set_iso_handler - set isochronous packet handler
+ * @new_h: pointer to new handler
+ *
+ * Sets the handler to be called when an isochronous packet is received to
+ * @new_h and returns the old handler. The default handler does nothing.
+ *
+ * In order to actually get iso packet events, receiving on a specific channel
+ * first has to be enabled with raw1394_start_iso_rcv() and can be stopped again
+ * with raw1394_stop_iso_rcv().
+ **/
+iso_handler_t raw1394_set_iso_handler(struct raw1394_handle *handle,
+ unsigned int channel, iso_handler_t new)
+{
+ 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;
+ }
+
+ if (handle->iso_handler[channel] != NULL) {
+ return (iso_handler_t)-1;
+ }
+
+ handle->iso_handler[channel] = new;
+ return NULL;
+}
+
/**
* raw1394_set_fcp_handler - set FCP handler
* @new_h: pointer to new handler