From ce14ef3b9e73da3ddc62c286d1ef41637d798c6b Mon Sep 17 00:00:00 2001 From: bencollins Date: Thu, 17 Jul 2003 17:33:39 +0000 Subject: [PATCH] Patch from Dan Maas to add raw1394_iso_recv_flush() call to API, using the RAW1394_IOC_ISO_RECV_FLUSH ioctl. Updated the ieee1394-ioctl.h file aswell. git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@127 53a565d1-3bb7-0310-b661-cf11e63c67ab --- src/ieee1394-ioctl.h | 2 ++ src/iso.c | 26 +++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/ieee1394-ioctl.h b/src/ieee1394-ioctl.h index 1091bdf..24ef3b3 100644 --- a/src/ieee1394-ioctl.h +++ b/src/ieee1394-ioctl.h @@ -100,6 +100,8 @@ _IOW ('#', 0x27, struct raw1394_iso_packets) #define RAW1394_IOC_ISO_XMIT_SYNC \ _IO ('#', 0x28) +#define RAW1394_IOC_ISO_RECV_FLUSH \ + _IO ('#', 0x29) #endif /* __IEEE1394_IOCTL_H */ diff --git a/src/iso.c b/src/iso.c index 32c0fa5..f6f18c7 100644 --- a/src/iso.c +++ b/src/iso.c @@ -256,7 +256,7 @@ int raw1394_iso_multichannel_recv_init(raw1394handle_t handle, **/ int raw1394_iso_recv_listen_channel(raw1394handle_t handle, unsigned char channel) { - if(handle->iso_mode != ISO_RECV) { + if (handle->iso_mode != ISO_RECV) { errno = EINVAL; return -1; } @@ -269,7 +269,7 @@ int raw1394_iso_recv_listen_channel(raw1394handle_t handle, unsigned char channe **/ int raw1394_iso_recv_unlisten_channel(raw1394handle_t handle, unsigned char channel) { - if(handle->iso_mode != ISO_RECV) { + if (handle->iso_mode != ISO_RECV) { errno = EINVAL; return -1; } @@ -277,6 +277,26 @@ int raw1394_iso_recv_unlisten_channel(raw1394handle_t handle, unsigned char chan return ioctl(handle->fd, RAW1394_IOC_ISO_RECV_UNLISTEN_CHANNEL, channel); } +/** + * raw1394_iso_recv_flush - if you specified an irq_interval > 1 in + * iso_recv_init, you won't be notified for every single iso packet, but + * for groups of them. Now e.g. if irq_interval is 100, and you were just + * notified about iso packets and after them only 20 more packets arrived, + * no notification will be generated (20 < 100). In the case that you know + * that there should be more packets at this moment, you can call this + * function and all iso packets which are already received by the kernel + * will be flushed out to user space. + */ +int raw1394_iso_recv_flush(raw1394handle_t handle) +{ + if (handle->iso_mode != ISO_RECV) { + errno = EINVAL; + return -1; + } + + return ioctl(handle->fd, RAW1394_IOC_ISO_RECV_FLUSH, 0); +} + /** * raw1394_iso_recv_set_channel_mask - listen or unlisten to a whole bunch of channels at once * @mask: 64-bit mask of channels, 1 means listen, 0 means unlisten, @@ -286,7 +306,7 @@ int raw1394_iso_recv_unlisten_channel(raw1394handle_t handle, unsigned char chan **/ int raw1394_iso_recv_set_channel_mask(raw1394handle_t handle, u_int64_t mask) { - if(handle->iso_mode != ISO_RECV) { + if (handle->iso_mode != ISO_RECV) { errno = EINVAL; return -1; }