Thread: [Linux1394-cvslog] rev 781 - trunk
Brought to you by:
aeb,
bencollins
From: SVN U. <ben...@li...> - 2003-02-11 18:58:07
|
Author: bencollins Date: 2003-02-11 13:57:27 -0500 (Tue, 11 Feb 2003) New Revision: 781 Added: trunk/ieee1394-ioctl.h Modified: trunk/amdtp.h trunk/dv1394.c trunk/dv1394.h trunk/raw1394.c trunk/raw1394.h trunk/video1394.c trunk/video1394.h Log: ioctl conversion Modified: trunk/dv1394.h ============================================================================== --- trunk/dv1394.h (original) +++ trunk/dv1394.h 2003-02-11 13:57:29.000000000 -0500 @@ -200,48 +200,7 @@ /* ioctl() commands */ - -enum { - /* I don't like using 0 as a valid ioctl() */ - DV1394_INVALID = 0, - - - /* get the driver ready to transmit video. - pass a struct dv1394_init* as the parameter (see below), - or NULL to get default parameters */ - DV1394_INIT, - - - /* stop transmitting video and free the ringbuffer */ - DV1394_SHUTDOWN, - - - /* 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 */ - DV1394_SUBMIT_FRAMES, - - - /* 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 */ - DV1394_WAIT_FRAMES, - - /* 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 */ - DV1394_RECEIVE_FRAMES, - - - DV1394_START_RECEIVE, - - - /* pass a struct dv1394_status* as the parameter (see below) */ - DV1394_GET_STATUS, -}; - +#include "ieee1394-ioctl.h" enum pal_or_ntsc { Added: trunk/ieee1394-ioctl.h ============================================================================== --- trunk/ieee1394-ioctl.h (original) +++ trunk/ieee1394-ioctl.h 2003-02-11 13:57:29.000000000 -0500 @@ -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 <asm/ioctl.h> +#include <asm/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 */ Modified: trunk/amdtp.h ============================================================================== --- trunk/amdtp.h (original) +++ trunk/amdtp.h 2003-02-11 13:57:29.000000000 -0500 @@ -3,8 +3,8 @@ #ifndef __AMDTP_H #define __AMDTP_H -#include <asm/ioctl.h> #include <asm/types.h> +#include "ieee1394-ioctl.h" /* The userspace interface for the Audio & Music Data Transmission * Protocol driver is really simple. First, open /dev/amdtp, use the @@ -57,13 +57,6 @@ * */ -/* We use '#' for our ioctl magic number because it's cool. */ - -#define AMDTP_IOC_CHANNEL _IOW('#', 0, sizeof (struct amdtp_ioctl)) -#define AMDTP_IOC_PLUG _IOW('#', 1, sizeof (struct amdtp_ioctl)) -#define AMDTP_IOC_PING _IOW('#', 2, sizeof (struct amdtp_ioctl)) -#define AMDTP_IOC_ZAP _IO('#', 3) - enum { AMDTP_FORMAT_RAW, AMDTP_FORMAT_IEC958_PCM, Modified: trunk/raw1394.c ============================================================================== --- trunk/raw1394.c (original) +++ trunk/raw1394.c 2003-02-11 13:57:29.000000000 -0500 @@ -2238,9 +2238,9 @@ switch(fi->iso_state) { case RAW1394_ISO_INACTIVE: switch(cmd) { - case RAW1394_ISO_XMIT_INIT: + case RAW1394_IOC_ISO_XMIT_INIT: return raw1394_iso_xmit_init(fi, (void*) arg); - case RAW1394_ISO_RECV_INIT: + case RAW1394_IOC_ISO_RECV_INIT: return raw1394_iso_recv_init(fi, (void*) arg); default: break; @@ -2248,63 +2248,63 @@ break; case RAW1394_ISO_RECV: switch(cmd) { - case RAW1394_ISO_RECV_START: { + case RAW1394_IOC_ISO_RECV_START: { /* copy args from user-space */ int args[3]; if(copy_from_user(&args[0], (void*) arg, sizeof(args))) return -EFAULT; return hpsb_iso_recv_start(fi->iso_handle, args[0], args[1], args[2]); } - case RAW1394_ISO_XMIT_RECV_STOP: + case RAW1394_IOC_ISO_XMIT_RECV_STOP: hpsb_iso_stop(fi->iso_handle); return 0; - case RAW1394_ISO_RECV_LISTEN_CHANNEL: + case RAW1394_IOC_ISO_RECV_LISTEN_CHANNEL: return hpsb_iso_recv_listen_channel(fi->iso_handle, arg); - case RAW1394_ISO_RECV_UNLISTEN_CHANNEL: + case RAW1394_IOC_ISO_RECV_UNLISTEN_CHANNEL: return hpsb_iso_recv_unlisten_channel(fi->iso_handle, arg); - case RAW1394_ISO_RECV_SET_CHANNEL_MASK: { + case RAW1394_IOC_ISO_RECV_SET_CHANNEL_MASK: { /* copy the u64 from user-space */ u64 mask; if(copy_from_user(&mask, (void*) arg, sizeof(mask))) return -EFAULT; return hpsb_iso_recv_set_channel_mask(fi->iso_handle, mask); } - case RAW1394_ISO_GET_STATUS: + case RAW1394_IOC_ISO_GET_STATUS: return raw1394_iso_get_status(fi, (void*) arg); - case RAW1394_ISO_RECV_PACKETS: + case RAW1394_IOC_ISO_RECV_PACKETS: return raw1394_iso_recv_packets(fi, (void*) arg); - case RAW1394_ISO_RECV_RELEASE_PACKETS: + case RAW1394_IOC_ISO_RECV_RELEASE_PACKETS: return hpsb_iso_recv_release_packets(fi->iso_handle, arg); - case RAW1394_ISO_SHUTDOWN: + case RAW1394_IOC_ISO_SHUTDOWN: raw1394_iso_shutdown(fi); return 0; - case RAW1394_ISO_QUEUE_ACTIVITY: + case RAW1394_IOC_ISO_QUEUE_ACTIVITY: queue_rawiso_event(fi); return 0; } break; case RAW1394_ISO_XMIT: switch(cmd) { - case RAW1394_ISO_XMIT_START: { + case RAW1394_IOC_ISO_XMIT_START: { /* copy two ints from user-space */ int args[2]; if(copy_from_user(&args[0], (void*) arg, sizeof(args))) return -EFAULT; return hpsb_iso_xmit_start(fi->iso_handle, args[0], args[1]); } - case RAW1394_ISO_XMIT_SYNC: + case RAW1394_IOC_ISO_XMIT_SYNC: return hpsb_iso_xmit_sync(fi->iso_handle); - case RAW1394_ISO_XMIT_RECV_STOP: + case RAW1394_IOC_ISO_XMIT_RECV_STOP: hpsb_iso_stop(fi->iso_handle); return 0; - case RAW1394_ISO_GET_STATUS: + case RAW1394_IOC_ISO_GET_STATUS: return raw1394_iso_get_status(fi, (void*) arg); - case RAW1394_ISO_XMIT_PACKETS: + case RAW1394_IOC_ISO_XMIT_PACKETS: return raw1394_iso_send_packets(fi, (void*) arg); - case RAW1394_ISO_SHUTDOWN: + case RAW1394_IOC_ISO_SHUTDOWN: raw1394_iso_shutdown(fi); return 0; - case RAW1394_ISO_QUEUE_ACTIVITY: + case RAW1394_IOC_ISO_QUEUE_ACTIVITY: queue_rawiso_event(fi); return 0; } Modified: trunk/raw1394.h ============================================================================== --- trunk/raw1394.h (original) +++ trunk/raw1394.h 2003-02-11 13:57:29.000000000 -0500 @@ -116,24 +116,7 @@ } *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! */ Modified: trunk/video1394.c ============================================================================== --- trunk/video1394.c (original) +++ trunk/video1394.c 2003-02-11 13:57:29.000000000 -0500 @@ -719,8 +719,8 @@ switch(cmd) { - case VIDEO1394_LISTEN_CHANNEL: - case VIDEO1394_TALK_CHANNEL: + case VIDEO1394_IOC_LISTEN_CHANNEL: + case VIDEO1394_IOC_TALK_CHANNEL: { struct video1394_mmap v; u64 mask; @@ -779,7 +779,7 @@ return -EFAULT; } - if (cmd == VIDEO1394_LISTEN_CHANNEL) { + if (cmd == VIDEO1394_IOC_LISTEN_CHANNEL) { d = alloc_dma_iso_ctx(ohci, OHCI_ISO_RECEIVE, v.nb_buffers, v.buf_size, v.channel, 0); @@ -829,8 +829,8 @@ return 0; } - case VIDEO1394_UNLISTEN_CHANNEL: - case VIDEO1394_UNTALK_CHANNEL: + case VIDEO1394_IOC_UNLISTEN_CHANNEL: + case VIDEO1394_IOC_UNTALK_CHANNEL: { int channel; u64 mask; @@ -854,7 +854,7 @@ /* Mark this channel as unused */ ohci->ISO_channel_usage &= ~mask; - if (cmd == VIDEO1394_UNLISTEN_CHANNEL) + if (cmd == VIDEO1394_IOC_UNLISTEN_CHANNEL) d = find_ctx(&ctx->context_list, OHCI_ISO_RECEIVE, channel); else d = find_ctx(&ctx->context_list, OHCI_ISO_TRANSMIT, channel); @@ -866,7 +866,7 @@ return 0; } - case VIDEO1394_LISTEN_QUEUE_BUFFER: + case VIDEO1394_IOC_LISTEN_QUEUE_BUFFER: { struct video1394_wait v; struct dma_iso_ctx *d; @@ -926,8 +926,8 @@ return 0; } - case VIDEO1394_LISTEN_WAIT_BUFFER: - case VIDEO1394_LISTEN_POLL_BUFFER: + case VIDEO1394_IOC_LISTEN_WAIT_BUFFER: + case VIDEO1394_IOC_LISTEN_POLL_BUFFER: { struct video1394_wait v; struct dma_iso_ctx *d; @@ -954,7 +954,7 @@ d->buffer_status[v.buffer]=VIDEO1394_BUFFER_FREE; break; case VIDEO1394_BUFFER_QUEUED: - if (cmd == VIDEO1394_LISTEN_POLL_BUFFER) { + if (cmd == VIDEO1394_IOC_LISTEN_POLL_BUFFER) { /* for polling, return error code EINTR */ spin_unlock_irqrestore(&d->lock, flags); return -EINTR; @@ -1008,7 +1008,7 @@ return 0; } - case VIDEO1394_TALK_QUEUE_BUFFER: + case VIDEO1394_IOC_TALK_QUEUE_BUFFER: { struct video1394_wait v; struct video1394_queue_variable qv; @@ -1096,7 +1096,7 @@ return 0; } - case VIDEO1394_TALK_WAIT_BUFFER: + case VIDEO1394_IOC_TALK_WAIT_BUFFER: { struct video1394_wait v; struct dma_iso_ctx *d; Modified: trunk/dv1394.c ============================================================================== --- trunk/dv1394.c (original) +++ trunk/dv1394.c 2003-02-11 13:57:29.000000000 -0500 @@ -1608,7 +1608,7 @@ switch(cmd) { - case DV1394_SUBMIT_FRAMES: { + case DV1394_IOC_SUBMIT_FRAMES: { unsigned int n_submit; if( !video_card_initialized(video) ) { @@ -1662,7 +1662,7 @@ break; } - case DV1394_WAIT_FRAMES: { + case DV1394_IOC_WAIT_FRAMES: { unsigned int n_wait; if( !video_card_initialized(video) ) { @@ -1711,7 +1711,7 @@ break; } - case DV1394_RECEIVE_FRAMES: { + case DV1394_IOC_RECEIVE_FRAMES: { unsigned int n_recv; if( !video_card_initialized(video) ) { @@ -1744,7 +1744,7 @@ break; } - case DV1394_START_RECEIVE: { + case DV1394_IOC_START_RECEIVE: { if( !video_card_initialized(video) ) { ret = do_dv1394_init_default(video); if(ret) @@ -1761,7 +1761,7 @@ break; } - case DV1394_INIT: { + case DV1394_IOC_INIT: { struct dv1394_init init; if(arg == (unsigned long) NULL) { ret = do_dv1394_init_default(video); @@ -1775,12 +1775,12 @@ break; } - case DV1394_SHUTDOWN: + case DV1394_IOC_SHUTDOWN: ret = do_dv1394_shutdown(video, 0); break; - case DV1394_GET_STATUS: { + case DV1394_IOC_GET_STATUS: { struct dv1394_status status; if( !video_card_initialized(video) ) { Modified: trunk/video1394.h ============================================================================== --- trunk/video1394.h (original) +++ trunk/video1394.h 2003-02-11 13:57:29.000000000 -0500 @@ -21,6 +21,8 @@ #ifndef _VIDEO_1394_H #define _VIDEO_1394_H +#include "ieee1394-ioctl.h" + #define VIDEO1394_DRIVER_NAME "video1394" #define VIDEO1394_MAX_SIZE 0x4000000 @@ -31,18 +33,6 @@ VIDEO1394_BUFFER_READY }; -enum { - VIDEO1394_LISTEN_CHANNEL = 0, - VIDEO1394_UNLISTEN_CHANNEL, - VIDEO1394_LISTEN_QUEUE_BUFFER, - VIDEO1394_LISTEN_WAIT_BUFFER, // wait until buffer is ready - VIDEO1394_TALK_CHANNEL, - VIDEO1394_UNTALK_CHANNEL, - VIDEO1394_TALK_QUEUE_BUFFER, - VIDEO1394_TALK_WAIT_BUFFER, - VIDEO1394_LISTEN_POLL_BUFFER // return immediately with -EINTR if not ready -}; - #define VIDEO1394_SYNC_FRAMES 0x00000001 #define VIDEO1394_INCLUDE_ISO_HEADERS 0x00000002 #define VIDEO1394_VARIABLE_PACKET_SIZE 0x00000004 |