Commit | Line | Data |
---|---|---|
cdda479f LP |
1 | #ifndef _UVC_QUEUE_H_ |
2 | #define _UVC_QUEUE_H_ | |
3 | ||
4 | #ifdef __KERNEL__ | |
5 | ||
6 | #include <linux/kernel.h> | |
7 | #include <linux/poll.h> | |
8 | #include <linux/videodev2.h> | |
d6925225 | 9 | #include <media/videobuf2-core.h> |
cdda479f LP |
10 | |
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 | |
15 | ||
16 | /* ------------------------------------------------------------------------ | |
17 | * Structures. | |
18 | */ | |
19 | ||
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, | |
26 | }; | |
27 | ||
28 | struct uvc_buffer { | |
d6925225 | 29 | struct vb2_buffer buf; |
cdda479f | 30 | struct list_head queue; |
d6925225 | 31 | |
cdda479f | 32 | enum uvc_buffer_state state; |
d6925225 BS |
33 | void *mem; |
34 | unsigned int length; | |
35 | unsigned int bytesused; | |
cdda479f LP |
36 | }; |
37 | ||
d6925225 BS |
38 | #define UVC_QUEUE_DISCONNECTED (1 << 0) |
39 | #define UVC_QUEUE_DROP_INCOMPLETE (1 << 1) | |
40 | #define UVC_QUEUE_PAUSED (1 << 2) | |
cdda479f LP |
41 | |
42 | struct uvc_video_queue { | |
d6925225 BS |
43 | struct vb2_queue queue; |
44 | struct mutex mutex; /* Protects queue */ | |
cdda479f | 45 | |
cdda479f LP |
46 | unsigned int flags; |
47 | __u32 sequence; | |
48 | ||
cdda479f | 49 | unsigned int buf_used; |
cdda479f | 50 | |
d6925225 | 51 | spinlock_t irqlock; /* Protects flags and irqqueue */ |
cdda479f LP |
52 | struct list_head irqqueue; |
53 | }; | |
54 | ||
cdda479f LP |
55 | static inline int uvc_queue_streaming(struct uvc_video_queue *queue) |
56 | { | |
d6925225 | 57 | return vb2_is_streaming(&queue->queue); |
cdda479f | 58 | } |
cdda479f LP |
59 | |
60 | #endif /* __KERNEL__ */ | |
61 | ||
62 | #endif /* _UVC_QUEUE_H_ */ | |
63 |