diff --git a/src/iso.c b/src/iso.c index 007d72c..36d5d25 100644 --- a/src/iso.c +++ b/src/iso.c @@ -160,7 +160,7 @@ static int do_iso_init(raw1394handle_t handle, * raw1394_iso_xmit_init - initialize isochronous transmission * @handler: handler function for queueing packets * @buf_packets: number of isochronous packets to buffer - * @max_packet_size: largest packet you need to handle, in bytes (not including the 8-byte isochronous header) + * @max_packet_size: largest packet you need to handle, in bytes (not including the isochronous header) * @channel: isochronous channel on which to transmit * @speed: speed at which to transmit * @irq_interval: maximum latency of wake-ups, in packets (-1 if you don't care) @@ -186,7 +186,7 @@ int raw1394_iso_xmit_init(raw1394handle_t handle, * raw1394_iso_recv_init - initialize isochronous reception * @handler: handler function for receiving packets * @buf_packets: number of isochronous packets to buffer - * @max_packet_size: largest packet you need to handle, in bytes (not including the 8-byte isochronous header) + * @max_packet_size: largest packet you need to handle, in bytes (not including the isochronous header) * @channel: isochronous channel to receive * @speed: speed at which to receive * @irq_interval: maximum latency of wake-ups, in packets (-1 if you don't care) @@ -275,6 +275,9 @@ static int _raw1394_iso_xmit_queue_packets(raw1394handle_t handle) packets_done++; if(disp == RAW1394_ISO_DEFER) { + /* queue an event so that we don't hang in the next read() */ + if(ioctl(handle->fd, RAW1394_ISO_QUEUE_ACTIVITY, 0)) + return -1; break; } else if(disp == RAW1394_ISO_ERROR) { retval = -1; @@ -377,6 +380,9 @@ static int _raw1394_iso_recv_packets(raw1394handle_t handle) packets_done++; if(disp == RAW1394_ISO_DEFER) { + /* queue an event so that we don't hang in the next read() */ + if(ioctl(handle->fd, RAW1394_ISO_QUEUE_ACTIVITY, 0)) + return -1; break; } else if(disp == RAW1394_ISO_ERROR) { retval = -1; diff --git a/src/kernel-raw1394.h b/src/kernel-raw1394.h index c6e5c59..24d00c9 100644 --- a/src/kernel-raw1394.h +++ b/src/kernel-raw1394.h @@ -130,6 +130,7 @@ typedef struct arm_request_response { #define RAW1394_ISO_GET_STATUS 5 /* arg: raw1394_iso_status* */ #define RAW1394_ISO_PRODUCE_CONSUME 6 /* arg: int, # of packets */ #define RAW1394_ISO_SHUTDOWN 7 +#define RAW1394_ISO_QUEUE_ACTIVITY 9 /* per-packet metadata embedded in the ringbuffer */ /* must be identical to hpsb_iso_packet_info in iso.h! */ diff --git a/src/raw1394.h b/src/raw1394.h index 42dfe21..8364301 100644 --- a/src/raw1394.h +++ b/src/raw1394.h @@ -72,23 +72,23 @@ enum raw1394_iso_disposition { extern "C" { #endif -typedef int (*raw1394_iso_xmit_handler_t)(raw1394handle_t, - unsigned char *data, - unsigned int *len, - unsigned char *tag, - unsigned char *sy, - unsigned int cycle, - unsigned int dropped); - -typedef int (*raw1394_iso_recv_handler_t)(raw1394handle_t, - unsigned char *data, - unsigned int len, - unsigned char channel, - unsigned char tag, - unsigned char sy, - unsigned int cycle, - unsigned int dropped); +typedef enum raw1394_iso_disposition (*raw1394_iso_xmit_handler_t)(raw1394handle_t, + unsigned char *data, + unsigned int *len, + unsigned char *tag, + unsigned char *sy, + unsigned int cycle, + unsigned int dropped); +typedef enum raw1394_iso_disposition (*raw1394_iso_recv_handler_t)(raw1394handle_t, + unsigned char *data, + unsigned int len, + unsigned char channel, + unsigned char tag, + unsigned char sy, + unsigned int cycle, + unsigned int dropped); + int raw1394_iso_xmit_init(raw1394handle_t handle, raw1394_iso_xmit_handler_t handler, unsigned int buf_packets,