6 #include <linux/kernel.h>
7 #include <linux/poll.h>
8 #include <linux/videodev2.h>
9 #include <media/videobuf2-core.h>
11 /* Maximum frame size in bytes, for sanity checking. */
12 #define UVC_MAX_FRAME_SIZE (16*1024*1024)
13 /* Maximum number of video buffers. */
14 #define UVC_MAX_VIDEO_BUFFERS 32
16 /* ------------------------------------------------------------------------
20 enum uvc_buffer_state
{
21 UVC_BUF_STATE_IDLE
= 0,
22 UVC_BUF_STATE_QUEUED
= 1,
23 UVC_BUF_STATE_ACTIVE
= 2,
24 UVC_BUF_STATE_DONE
= 3,
25 UVC_BUF_STATE_ERROR
= 4,
29 struct vb2_buffer buf
;
30 struct list_head queue
;
32 enum uvc_buffer_state state
;
35 unsigned int bytesused
;
38 #define UVC_QUEUE_DISCONNECTED (1 << 0)
39 #define UVC_QUEUE_DROP_INCOMPLETE (1 << 1)
40 #define UVC_QUEUE_PAUSED (1 << 2)
42 struct uvc_video_queue
{
43 struct vb2_queue queue
;
44 struct mutex mutex
; /* Protects queue */
49 unsigned int buf_used
;
51 spinlock_t irqlock
; /* Protects flags and irqqueue */
52 struct list_head irqqueue
;
55 static inline int uvc_queue_streaming(struct uvc_video_queue
*queue
)
57 return vb2_is_streaming(&queue
->queue
);
60 #endif /* __KERNEL__ */
62 #endif /* _UVC_QUEUE_H_ */