4 #include <linux/list.h>
6 #define USB_REQ_CPIA_GET_VERSION 0x01
7 #define USB_REQ_CPIA_GET_PNP_ID 0x02
8 #define USB_REQ_CPIA_GET_CAMERA_STATUS 0x03
9 #define USB_REQ_CPIA_GOTO_HI_POWER 0x04
10 #define USB_REQ_CPIA_GOTO_LO_POWER 0x05
12 #define USB_REQ_CPIA_GOTO_SUSPEND 0x07
13 #define USB_REQ_CPIA_GOTO_PASS_THROUGH 0x08
15 #define USB_REQ_CPIA_MODIFY_CAMERA_STATUS 0x0A
17 #define USB_REQ_CPIA_READ_VC_REGS 0x21
18 #define USB_REQ_CPIA_WRITE_BC_REG 0x22
19 #define USB_REQ_CPIA_READ_MC_PORTS 0x23
20 #define USB_REQ_CPIA_WRITE_MC_PORT 0x24
21 #define USB_REQ_CPIA_SET_BAUD_RATE 0x25
22 #define USB_REQ_CPIA_SET_ECP_TIMING 0x26
23 #define USB_REQ_CPIA_READ_IDATA 0x27
24 #define USB_REQ_CPIA_WRITE_IDATA 0x28
25 #define USB_REQ_CPIA_GENERIC_CALL 0x29
26 #define USB_REQ_CPIA_I2CSTART 0x2A
27 #define USB_REQ_CPIA_I2CSTOP 0x2B
28 #define USB_REQ_CPIA_I2CWRITE 0x2C
29 #define USB_REQ_CPIA_I2CREAD 0x2D
31 #define USB_REQ_CPIA_GET_VP_VERSION 0xA1
32 #define USB_REQ_CPIA_SET_COLOUR_PARAMS 0xA3
33 #define USB_REQ_CPIA_SET_EXPOSURE 0xA4
35 #define USB_REQ_CPIA_SET_COLOUR_BALANCE 0xA6
36 #define USB_REQ_CPIA_SET_SENSOR_FPS 0xA7
37 #define USB_REQ_CPIA_SET_VP_DEFAULTS 0xA8
38 #define USB_REQ_CPIA_SET_APCOR 0xA9
39 #define USB_REQ_CPIA_SET_FLICKER_CTRL 0xAA
40 #define USB_REQ_CPIA_SET_VL_OFFSET 0xAB
42 #define USB_REQ_CPIA_GET_COLOUR_PARAMETERS 0xB0
43 #define USB_REQ_CPIA_GET_COLOUR_BALANCE 0xB1
44 #define USB_REQ_CPIA_GET_EXPOSURE 0xB2
45 #define USB_REQ_CPIA_SET_SENSOR_MATRIX 0xB3
47 #define USB_REQ_CPIA_COLOUR_BARS 0xBD
48 #define USB_REQ_CPIA_READ_VP_REGS 0xBE
49 #define USB_REQ_CPIA_WRITE_VP_REGS 0xBF
51 #define USB_REQ_CPIA_GRAB_FRAME 0xC1
52 #define USB_REQ_CPIA_UPLOAD_FRAME 0xC2
53 #define USB_REQ_CPIA_SET_GRAB_MODE 0xC3
54 #define USB_REQ_CPIA_INIT_STREAM_CAP 0xC4
55 #define USB_REQ_CPIA_FINI_STREAM_CAP 0xC5
56 #define USB_REQ_CPIA_START_STREAM_CAP 0xC6
57 #define USB_REQ_CPIA_END_STREAM_CAP 0xC7
58 #define USB_REQ_CPIA_SET_FORMAT 0xC8
59 #define USB_REQ_CPIA_SET_ROI 0xC9
60 #define USB_REQ_CPIA_SET_COMPRESSION 0xCA
61 #define USB_REQ_CPIA_SET_COMPRESSION_TARGET 0xCB
62 #define USB_REQ_CPIA_SET_YUV_THRESH 0xCC
63 #define USB_REQ_CPIA_SET_COMPRESSION_PARAMS 0xCD
64 #define USB_REQ_CPIA_DISCARD_FRAME 0xCE
66 #define USB_REQ_CPIA_OUTPUT_RS232 0xE1
67 #define USB_REQ_CPIA_ABORT_PROCESS 0xE4
68 #define USB_REQ_CPIA_SET_DRAM_PAGE 0xE5
69 #define USB_REQ_CPIA_START_DRAM_UPLOAD 0xE6
70 #define USB_REQ_CPIA_START_DUMMY_STREAM 0xE8
71 #define USB_REQ_CPIA_ABORT_STREAM 0xE9
72 #define USB_REQ_CPIA_DOWNLOAD_DRAM 0xEA
73 /* #define USB_REQ_CPIA_NULL_CMD 0x?? */
81 #define STREAM_BUF_SIZE (PAGE_SIZE * 4)
83 #define SCRATCH_BUF_SIZE (STREAM_BUF_SIZE * 2)
86 STATE_SCANNING
, /* Scanning for start */
87 STATE_HEADER
, /* Parsing header */
88 STATE_LINES
, /* Parsing lines */
100 FRAME_READY
, /* Ready to grab into */
101 FRAME_GRABBING
, /* In the process of being grabbed into */
102 FRAME_DONE
, /* Finished grabbing, but not been synced yet */
103 FRAME_UNUSED
, /* Unused (no MCAPTURE) */
114 struct video_device vdev
;
116 /* Device structure */
117 struct usb_device
*dev
;
121 char *fbuf
; /* Videodev buffer area */
124 struct cpia_frame frame
[2]; /* Double buffering */
126 int receivesbuf
; /* Current receiving sbuf */
127 struct cpia_sbuf sbuf
[3]; /* Triple buffering */
129 int state
; /* Current scanning state */
132 char scratch
[SCRATCH_BUF_SIZE
];
135 wait_queue_head_t wq
;