Updates for new rawiso ioctl interface.

git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@103 53a565d1-3bb7-0310-b661-cf11e63c67ab
This commit is contained in:
bencollins 2003-02-22 04:31:28 +00:00
parent 2ecf31c96d
commit e753a09b38
3 changed files with 125 additions and 37 deletions

105
src/ieee1394-ioctl.h Normal file
View File

@ -0,0 +1,105 @@
/* Base file for all ieee1394 ioctl's. Linux-1394 has allocated base '#'
* with a range of 0x00-0x3f. */
#ifndef __IEEE1394_IOCTL_H
#define __IEEE1394_IOCTL_H
#include <linux/ioctl.h>
#include <linux/types.h>
/* AMDTP Gets 6 */
#define AMDTP_IOC_CHANNEL _IOW('#', 0x00, struct amdtp_ioctl)
#define AMDTP_IOC_PLUG _IOW('#', 0x01, struct amdtp_ioctl)
#define AMDTP_IOC_PING _IOW('#', 0x02, struct amdtp_ioctl)
#define AMDTP_IOC_ZAP _IO ('#', 0x03)
/* DV1394 Gets 10 */
/* Get the driver ready to transmit video. pass a struct dv1394_init* as
* the parameter (see below), or NULL to get default parameters */
#define DV1394_IOC_INIT _IOW('#', 0x06, struct dv1394_init)
/* Stop transmitting video and free the ringbuffer */
#define DV1394_IOC_SHUTDOWN _IO ('#', 0x07)
/* Submit N new frames to be transmitted, where the index of the first new
* frame is first_clear_buffer, and the index of the last new frame is
* (first_clear_buffer + N) % n_frames */
#define DV1394_IOC_SUBMIT_FRAMES _IO ('#', 0x08)
/* Block until N buffers are clear (pass N as the parameter) Because we
* re-transmit the last frame on underrun, there will at most be n_frames
* - 1 clear frames at any time */
#define DV1394_IOC_WAIT_FRAMES _IO ('#', 0x09)
/* Capture new frames that have been received, where the index of the
* first new frame is first_clear_buffer, and the index of the last new
* frame is (first_clear_buffer + N) % n_frames */
#define DV1394_IOC_RECEIVE_FRAMES _IO ('#', 0x0a)
/* Tell card to start receiving DMA */
#define DV1394_IOC_START_RECEIVE _IO ('#', 0x0b)
/* Pass a struct dv1394_status* as the parameter */
#define DV1394_IOC_GET_STATUS _IOR('#', 0x0c, struct dv1394_status)
/* Video1394 Gets 10 */
#define VIDEO1394_IOC_LISTEN_CHANNEL \
_IOWR('#', 0x10, struct video1394_mmap)
#define VIDEO1394_IOC_UNLISTEN_CHANNEL \
_IOW ('#', 0x11, int)
#define VIDEO1394_IOC_LISTEN_QUEUE_BUFFER \
_IOW ('#', 0x12, struct video1394_wait)
#define VIDEO1394_IOC_LISTEN_WAIT_BUFFER \
_IOWR('#', 0x13, struct video1394_wait)
#define VIDEO1394_IOC_TALK_CHANNEL \
_IOWR('#', 0x14, struct video1394_mmap)
#define VIDEO1394_IOC_UNTALK_CHANNEL \
_IOW ('#', 0x15, int)
#define VIDEO1394_IOC_TALK_QUEUE_BUFFER \
_IOW ('#', 0x16, sizeof (struct video1394_wait) + \
sizeof (struct video1394_queue_variable))
#define VIDEO1394_IOC_TALK_WAIT_BUFFER \
_IOW ('#', 0x17, struct video1394_wait)
#define VIDEO1394_IOC_LISTEN_POLL_BUFFER \
_IOWR('#', 0x18, struct video1394_wait)
/* Raw1394's ISO interface */
#define RAW1394_IOC_ISO_XMIT_INIT \
_IOW ('#', 0x1a, struct raw1394_iso_status)
#define RAW1394_IOC_ISO_RECV_INIT \
_IOWR('#', 0x1b, struct raw1394_iso_status)
#define RAW1394_IOC_ISO_RECV_START \
_IOC (_IOC_WRITE, '#', 0x1c, sizeof(int) * 3)
#define RAW1394_IOC_ISO_XMIT_START \
_IOC (_IOC_WRITE, '#', 0x1d, sizeof(int) * 2)
#define RAW1394_IOC_ISO_XMIT_RECV_STOP \
_IO ('#', 0x1e)
#define RAW1394_IOC_ISO_GET_STATUS \
_IOR ('#', 0x1f, struct raw1394_iso_status)
#define RAW1394_IOC_ISO_SHUTDOWN \
_IO ('#', 0x20)
#define RAW1394_IOC_ISO_QUEUE_ACTIVITY \
_IO ('#', 0x21)
#define RAW1394_IOC_ISO_RECV_LISTEN_CHANNEL \
_IOW ('#', 0x22, unsigned char)
#define RAW1394_IOC_ISO_RECV_UNLISTEN_CHANNEL \
_IOW ('#', 0x23, unsigned char)
#define RAW1394_IOC_ISO_RECV_SET_CHANNEL_MASK \
_IOW ('#', 0x24, __u64)
#define RAW1394_IOC_ISO_RECV_PACKETS \
_IOW ('#', 0x25, struct raw1394_iso_packets)
#define RAW1394_IOC_ISO_RECV_RELEASE_PACKETS \
_IOW ('#', 0x26, unsigned int)
#define RAW1394_IOC_ISO_XMIT_PACKETS \
_IOW ('#', 0x27, struct raw1394_iso_packets)
#define RAW1394_IOC_ISO_XMIT_SYNC \
_IO ('#', 0x28)
#endif /* __IEEE1394_IOCTL_H */

View File

@ -151,7 +151,7 @@ static int do_iso_init(raw1394handle_t handle,
if(handle->iso_buffer == (unsigned char*) MAP_FAILED) {
handle->iso_buffer = NULL;
ioctl(handle->fd, RAW1394_ISO_SHUTDOWN, 0);
ioctl(handle->fd, RAW1394_IOC_ISO_SHUTDOWN, 0);
return -1;
}
@ -186,7 +186,7 @@ int raw1394_iso_xmit_init(raw1394handle_t handle,
int irq_interval)
{
if(do_iso_init(handle, buf_packets, max_packet_size, channel, speed,
irq_interval, RAW1394_ISO_XMIT_INIT))
irq_interval, RAW1394_IOC_ISO_XMIT_INIT))
return -1;
handle->iso_mode = ISO_XMIT;
@ -216,7 +216,7 @@ int raw1394_iso_recv_init(raw1394handle_t handle,
{
/* any speed will work */
if(do_iso_init(handle, buf_packets, max_packet_size, channel, RAW1394_ISO_SPEED_100,
irq_interval, RAW1394_ISO_RECV_INIT))
irq_interval, RAW1394_IOC_ISO_RECV_INIT))
return -1;
handle->iso_mode = ISO_RECV;
@ -242,7 +242,7 @@ int raw1394_iso_multichannel_recv_init(raw1394handle_t handle,
{
/* any speed will work */
if(do_iso_init(handle, buf_packets, max_packet_size, -1, RAW1394_ISO_SPEED_100,
irq_interval, RAW1394_ISO_RECV_INIT))
irq_interval, RAW1394_IOC_ISO_RECV_INIT))
return -1;
handle->iso_mode = ISO_RECV;
@ -260,7 +260,7 @@ int raw1394_iso_recv_listen_channel(raw1394handle_t handle, unsigned char channe
return -1;
}
return ioctl(handle->fd, RAW1394_ISO_RECV_LISTEN_CHANNEL, channel);
return ioctl(handle->fd, RAW1394_IOC_ISO_RECV_LISTEN_CHANNEL, channel);
}
/**
@ -273,7 +273,7 @@ int raw1394_iso_recv_unlisten_channel(raw1394handle_t handle, unsigned char chan
return -1;
}
return ioctl(handle->fd, RAW1394_ISO_RECV_UNLISTEN_CHANNEL, channel);
return ioctl(handle->fd, RAW1394_IOC_ISO_RECV_UNLISTEN_CHANNEL, channel);
}
/**
@ -290,7 +290,7 @@ int raw1394_iso_recv_set_channel_mask(raw1394handle_t handle, u_int64_t mask)
return -1;
}
return ioctl(handle->fd, RAW1394_ISO_RECV_SET_CHANNEL_MASK, (void*) &mask);
return ioctl(handle->fd, RAW1394_IOC_ISO_RECV_SET_CHANNEL_MASK, (void*) &mask);
}
/**
@ -312,7 +312,7 @@ int raw1394_iso_recv_start(raw1394handle_t handle, int start_on_cycle, int tag_m
args[1] = tag_mask;
args[2] = sync;
if(ioctl(handle->fd, RAW1394_ISO_RECV_START, &args[0]))
if(ioctl(handle->fd, RAW1394_IOC_ISO_RECV_START, &args[0]))
return -1;
handle->iso_state = ISO_GO;
@ -364,7 +364,7 @@ static int _raw1394_iso_xmit_queue_packets(raw1394handle_t handle)
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))
if(ioctl(handle->fd, RAW1394_IOC_ISO_QUEUE_ACTIVITY, 0))
goto out_produce;
break;
} else if(disp == RAW1394_ISO_STOP) {
@ -383,7 +383,7 @@ static int _raw1394_iso_xmit_queue_packets(raw1394handle_t handle)
out_produce:
if(packets.n_packets > 0) {
if(ioctl(handle->fd, RAW1394_ISO_XMIT_PACKETS, &packets))
if(ioctl(handle->fd, RAW1394_IOC_ISO_XMIT_PACKETS, &packets))
retval = -1;
}
out_free:
@ -442,7 +442,7 @@ int raw1394_iso_xmit_write(raw1394handle_t handle, unsigned char *data, unsigned
packets.n_packets = 1;
packets.infos = &info;
if(ioctl(handle->fd, RAW1394_ISO_XMIT_PACKETS, &packets))
if(ioctl(handle->fd, RAW1394_IOC_ISO_XMIT_PACKETS, &packets))
return -1;
stat->n_packets--;
@ -470,7 +470,7 @@ int raw1394_iso_xmit_start(raw1394handle_t handle, int start_on_cycle, int prebu
args[0] = start_on_cycle;
args[1] = prebuffer_packets;
if(ioctl(handle->fd, RAW1394_ISO_XMIT_START, &args[0]))
if(ioctl(handle->fd, RAW1394_IOC_ISO_XMIT_START, &args[0]))
return -1;
handle->iso_state = ISO_GO;
@ -486,7 +486,7 @@ int raw1394_iso_xmit_sync(raw1394handle_t handle)
errno = EINVAL;
return -1;
}
return ioctl(handle->fd, RAW1394_ISO_XMIT_SYNC, 0);
return ioctl(handle->fd, RAW1394_IOC_ISO_XMIT_SYNC, 0);
}
/**
@ -498,7 +498,7 @@ void raw1394_iso_stop(raw1394handle_t handle)
return;
}
ioctl(handle->fd, RAW1394_ISO_XMIT_RECV_STOP, 0);
ioctl(handle->fd, RAW1394_IOC_ISO_XMIT_RECV_STOP, 0);
handle->iso_state = ISO_STOP;
}
@ -514,7 +514,7 @@ void raw1394_iso_shutdown(raw1394handle_t handle)
if(handle->iso_mode != ISO_INACTIVE) {
raw1394_iso_stop(handle);
ioctl(handle->fd, RAW1394_ISO_SHUTDOWN, 0);
ioctl(handle->fd, RAW1394_IOC_ISO_SHUTDOWN, 0);
}
handle->iso_mode = ISO_INACTIVE;
@ -538,7 +538,7 @@ static int _raw1394_iso_recv_packets(raw1394handle_t handle)
if(packets.infos == NULL)
goto out;
if(ioctl(handle->fd, RAW1394_ISO_RECV_PACKETS, &packets) < 0)
if(ioctl(handle->fd, RAW1394_IOC_ISO_RECV_PACKETS, &packets) < 0)
goto out_free;
while(stat->n_packets > 0) {
@ -561,7 +561,7 @@ static int _raw1394_iso_recv_packets(raw1394handle_t handle)
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))
if(ioctl(handle->fd, RAW1394_IOC_ISO_QUEUE_ACTIVITY, 0))
goto out_consume;
break;
} else if(disp == RAW1394_ISO_STOP || disp == RAW1394_ISO_STOP_NOSYNC) {
@ -577,7 +577,7 @@ static int _raw1394_iso_recv_packets(raw1394handle_t handle)
out_consume:
if(packets_done > 0) {
if(ioctl(handle->fd, RAW1394_ISO_RECV_RELEASE_PACKETS, packets_done))
if(ioctl(handle->fd, RAW1394_IOC_ISO_RECV_RELEASE_PACKETS, packets_done))
retval = -1;
}
out_free:
@ -594,7 +594,7 @@ int _raw1394_iso_iterate(raw1394handle_t handle)
if(handle->iso_mode == ISO_INACTIVE)
return 0;
err = ioctl(handle->fd, RAW1394_ISO_GET_STATUS, &handle->iso_status);
err = ioctl(handle->fd, RAW1394_IOC_ISO_GET_STATUS, &handle->iso_status);
if(err != 0)
return err;

View File

@ -116,24 +116,7 @@ typedef struct arm_request_response {
} *arm_request_response_t;
/* rawiso API */
/* ioctls */
#define RAW1394_ISO_XMIT_INIT 1 /* arg: raw1394_iso_status* */
#define RAW1394_ISO_RECV_INIT 2 /* arg: raw1394_iso_status* */
#define RAW1394_ISO_RECV_START 3 /* arg: int[3], { starting cycle, tag, sync } */
#define RAW1394_ISO_XMIT_START 8 /* arg: int[2], { starting cycle, prebuffer } */
#define RAW1394_ISO_XMIT_RECV_STOP 4
#define RAW1394_ISO_GET_STATUS 5 /* arg: raw1394_iso_status* */
#define RAW1394_ISO_PRODUCE_CONSUME 6 /* no longer used */
#define RAW1394_ISO_SHUTDOWN 7
#define RAW1394_ISO_QUEUE_ACTIVITY 9
#define RAW1394_ISO_RECV_LISTEN_CHANNEL 10 /* arg: channel number */
#define RAW1394_ISO_RECV_UNLISTEN_CHANNEL 11 /* arg: channel number */
#define RAW1394_ISO_RECV_SET_CHANNEL_MASK 12 /* arg: pointer to 64-bit mask */
#define RAW1394_ISO_RECV_PACKETS 13 /* arg: struct raw1394_iso_packets* */
#define RAW1394_ISO_RECV_RELEASE_PACKETS 14 /* arg: int n_packets */
#define RAW1394_ISO_XMIT_PACKETS 15 /* arg: struct raw1394_iso_packets* */
#define RAW1394_ISO_XMIT_SYNC 16
#include "ieee1394-ioctl.h"
/* per-packet metadata embedded in the ringbuffer */
/* must be identical to hpsb_iso_packet_info in iso.h! */