diff options
| author | 2002-12-16 05:11:45 +0000 | |
|---|---|---|
| committer | 2002-12-16 05:11:45 +0000 | |
| commit | e01decd75c1455c9fb018494d73ee77928f12ba6 (patch) | |
| tree | 00a3937aac6ece03bddec9c76ea7a098b2f24062 | |
| parent | fix cplusplus extern C block (diff) | |
rawiso updates:
- 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
| -rw-r--r-- | src/iso.c | 10 | ||||
| -rw-r--r-- | src/kernel-raw1394.h | 1 | ||||
| -rw-r--r-- | src/raw1394.h | 32 |
3 files changed, 25 insertions, 18 deletions
@@ -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, |
