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
This commit is contained in:
dmaas 2002-12-16 05:11:45 +00:00
parent 45112de225
commit e01decd75c
3 changed files with 25 additions and 18 deletions

View File

@ -160,7 +160,7 @@ static int do_iso_init(raw1394handle_t handle,
* raw1394_iso_xmit_init - initialize isochronous transmission * raw1394_iso_xmit_init - initialize isochronous transmission
* @handler: handler function for queueing packets * @handler: handler function for queueing packets
* @buf_packets: number of isochronous packets to buffer * @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 * @channel: isochronous channel on which to transmit
* @speed: speed at which to transmit * @speed: speed at which to transmit
* @irq_interval: maximum latency of wake-ups, in packets (-1 if you don't care) * @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 * raw1394_iso_recv_init - initialize isochronous reception
* @handler: handler function for receiving packets * @handler: handler function for receiving packets
* @buf_packets: number of isochronous packets to buffer * @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 * @channel: isochronous channel to receive
* @speed: speed at which to receive * @speed: speed at which to receive
* @irq_interval: maximum latency of wake-ups, in packets (-1 if you don't care) * @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++; packets_done++;
if(disp == RAW1394_ISO_DEFER) { 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; break;
} else if(disp == RAW1394_ISO_ERROR) { } else if(disp == RAW1394_ISO_ERROR) {
retval = -1; retval = -1;
@ -377,6 +380,9 @@ static int _raw1394_iso_recv_packets(raw1394handle_t handle)
packets_done++; packets_done++;
if(disp == RAW1394_ISO_DEFER) { 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; break;
} else if(disp == RAW1394_ISO_ERROR) { } else if(disp == RAW1394_ISO_ERROR) {
retval = -1; retval = -1;

View File

@ -130,6 +130,7 @@ typedef struct arm_request_response {
#define RAW1394_ISO_GET_STATUS 5 /* arg: raw1394_iso_status* */ #define RAW1394_ISO_GET_STATUS 5 /* arg: raw1394_iso_status* */
#define RAW1394_ISO_PRODUCE_CONSUME 6 /* arg: int, # of packets */ #define RAW1394_ISO_PRODUCE_CONSUME 6 /* arg: int, # of packets */
#define RAW1394_ISO_SHUTDOWN 7 #define RAW1394_ISO_SHUTDOWN 7
#define RAW1394_ISO_QUEUE_ACTIVITY 9
/* per-packet metadata embedded in the ringbuffer */ /* per-packet metadata embedded in the ringbuffer */
/* must be identical to hpsb_iso_packet_info in iso.h! */ /* must be identical to hpsb_iso_packet_info in iso.h! */

View File

@ -72,23 +72,23 @@ enum raw1394_iso_disposition {
extern "C" { extern "C" {
#endif #endif
typedef int (*raw1394_iso_xmit_handler_t)(raw1394handle_t, typedef enum raw1394_iso_disposition (*raw1394_iso_xmit_handler_t)(raw1394handle_t,
unsigned char *data, unsigned char *data,
unsigned int *len, unsigned int *len,
unsigned char *tag, unsigned char *tag,
unsigned char *sy, unsigned char *sy,
unsigned int cycle, unsigned int cycle,
unsigned int dropped); 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_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, int raw1394_iso_xmit_init(raw1394handle_t handle,
raw1394_iso_xmit_handler_t handler, raw1394_iso_xmit_handler_t handler,
unsigned int buf_packets, unsigned int buf_packets,