Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
uvc_queue.h
Go to the documentation of this file.
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>
9 
10 /* Maximum frame size in bytes, for sanity checking. */
11 #define UVC_MAX_FRAME_SIZE (16*1024*1024)
12 /* Maximum number of video buffers. */
13 #define UVC_MAX_VIDEO_BUFFERS 32
14 
15 /* ------------------------------------------------------------------------
16  * Structures.
17  */
18 
19 enum uvc_buffer_state {
25 };
26 
27 struct uvc_buffer {
28  unsigned long vma_use_count;
29  struct list_head stream;
30 
31  /* Touched by interrupt handler. */
32  struct v4l2_buffer buf;
33  struct list_head queue;
36 };
37 
38 #define UVC_QUEUE_STREAMING (1 << 0)
39 #define UVC_QUEUE_DISCONNECTED (1 << 1)
40 #define UVC_QUEUE_DROP_INCOMPLETE (1 << 2)
41 #define UVC_QUEUE_PAUSED (1 << 3)
42 
43 struct uvc_video_queue {
44  enum v4l2_buf_type type;
45 
46  void *mem;
47  unsigned int flags;
49 
50  unsigned int count;
51  unsigned int buf_size;
52  unsigned int buf_used;
54  struct mutex mutex; /* protects buffers and mainqueue */
55  spinlock_t irqlock; /* protects irqqueue */
56 
57  struct list_head mainqueue;
58  struct list_head irqqueue;
59 };
60 
61 static inline int uvc_queue_streaming(struct uvc_video_queue *queue)
62 {
63  return queue->flags & UVC_QUEUE_STREAMING;
64 }
65 
66 #endif /* __KERNEL__ */
67 
68 #endif /* _UVC_QUEUE_H_ */
69