⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uvcvideo.h

📁 trident tm5600的linux驱动
💻 H
📖 第 1 页 / 共 2 页
字号:
	char *name;	__u8 guid[16];	__u32 fcc;};/* The term 'entity' refers to both UVC units and UVC terminals. * * The type field is either the terminal type (wTerminalType in the terminal * descriptor), or the unit type (bDescriptorSubtype in the unit descriptor). * As the bDescriptorSubtype field is one byte long, the type value will * always have a null MSB for units. All terminal types defined by the UVC * specification have a non-null MSB, so it is safe to use the MSB to * differentiate between units and terminals as long as the descriptor parsing * code makes sure terminal types have a non-null MSB. * * For terminals, the type's most significant bit stores the terminal * direction (either UVC_TERM_INPUT or UVC_TERM_OUTPUT). The type field should * always be accessed with the UVC_ENTITY_* macros and never directly. */struct uvc_entity {	struct list_head list;		/* Entity as part of a UVC device. */	struct list_head chain;		/* Entity as part of a video device					 * chain. */	__u8 id;	__u16 type;	char name[64];	union {		struct {			__u16 wObjectiveFocalLengthMin;			__u16 wObjectiveFocalLengthMax;			__u16 wOcularFocalLength;			__u8  bControlSize;			__u8  *bmControls;		} camera;		struct {			__u8  bControlSize;			__u8  *bmControls;			__u8  bTransportModeSize;			__u8  *bmTransportModes;		} media;		struct {			__u8  bSourceID;		} output;		struct {			__u8  bSourceID;			__u16 wMaxMultiplier;			__u8  bControlSize;			__u8  *bmControls;			__u8  bmVideoStandards;		} processing;		struct {			__u8  bNrInPins;			__u8  *baSourceID;		} selector;		struct {			__u8  guidExtensionCode[16];			__u8  bNumControls;			__u8  bNrInPins;			__u8  *baSourceID;			__u8  bControlSize;			__u8  *bmControls;			__u8  *bmControlsType;		} extension;	};	unsigned int ncontrols;	struct uvc_control *controls;};struct uvc_frame {	__u8  bFrameIndex;	__u8  bmCapabilities;	__u16 wWidth;	__u16 wHeight;	__u32 dwMinBitRate;	__u32 dwMaxBitRate;	__u32 dwMaxVideoFrameBufferSize;	__u8  bFrameIntervalType;	__u32 dwDefaultFrameInterval;	__u32 *dwFrameInterval;};struct uvc_format {	__u8 type;	__u8 index;	__u8 bpp;	__u8 colorspace;	__u32 fcc;	__u32 flags;	char name[32];	unsigned int nframes;	struct uvc_frame *frame;};struct uvc_streaming_header {	__u8 bNumFormats;	__u8 bEndpointAddress;	__u8 bTerminalLink;	__u8 bControlSize;	__u8 *bmaControls;	/* The following fields are used by input headers only. */	__u8 bmInfo;	__u8 bStillCaptureMethod;	__u8 bTriggerSupport;	__u8 bTriggerUsage;};struct uvc_streaming {	struct list_head list;	struct usb_interface *intf;	int intfnum;	__u16 maxpsize;	struct uvc_streaming_header header;	unsigned int nformats;	struct uvc_format *format;	struct uvc_streaming_control ctrl;	struct uvc_format *cur_format;	struct uvc_frame *cur_frame;	struct mutex mutex;};enum uvc_buffer_state {	UVC_BUF_STATE_IDLE       = 0,	UVC_BUF_STATE_QUEUED     = 1,	UVC_BUF_STATE_ACTIVE     = 2,	UVC_BUF_STATE_DONE       = 3,	UVC_BUF_STATE_ERROR      = 4,};struct uvc_buffer {	unsigned long vma_use_count;	struct list_head stream;	/* Touched by interrupt handler. */	struct v4l2_buffer buf;	struct list_head queue;	wait_queue_head_t wait;	enum uvc_buffer_state state;};#define UVC_QUEUE_STREAMING		(1 << 0)#define UVC_QUEUE_DISCONNECTED		(1 << 1)#define UVC_QUEUE_DROP_INCOMPLETE	(1 << 2)struct uvc_video_queue {	void *mem;	unsigned int flags;	__u32 sequence;	unsigned int count;	unsigned int buf_size;	struct uvc_buffer buffer[UVC_MAX_VIDEO_BUFFERS];	struct mutex mutex;	/* protects buffers and mainqueue */	spinlock_t irqlock;	/* protects irqqueue */	struct list_head mainqueue;	struct list_head irqqueue;};struct uvc_video_device {	struct uvc_device *dev;	struct video_device *vdev;	atomic_t active;	unsigned int frozen : 1;	struct list_head iterms;	struct uvc_entity *oterm;	struct uvc_entity *processing;	struct uvc_entity *selector;	struct list_head extensions;	struct mutex ctrl_mutex;	struct uvc_video_queue queue;	/* Video streaming object, must always be non-NULL. */	struct uvc_streaming *streaming;	void (*decode) (struct urb *urb, struct uvc_video_device *video,			struct uvc_buffer *buf);	/* Context data used by the bulk completion handler. */	struct {		__u8 header[256];		unsigned int header_size;		int skip_payload;		__u32 payload_size;		__u32 max_payload_size;	} bulk;	struct urb *urb[UVC_URBS];	char *urb_buffer[UVC_URBS];	dma_addr_t urb_dma[UVC_URBS];	unsigned int urb_size;	__u8 last_fid;};enum uvc_device_state {	UVC_DEV_DISCONNECTED = 1,};struct uvc_device {	struct usb_device *udev;	struct usb_interface *intf;	__u32 quirks;	int intfnum;	char name[32];	enum uvc_device_state state;	struct kref kref;	struct list_head list;	/* Video control interface */	__u16 uvc_version;	__u32 clock_frequency;	struct list_head entities;	struct uvc_video_device video;	/* Status Interrupt Endpoint */	struct usb_host_endpoint *int_ep;	struct urb *int_urb;	__u8 *status;	struct input_dev *input;	/* Video Streaming interfaces */	struct list_head streaming;};enum uvc_handle_state {	UVC_HANDLE_PASSIVE	= 0,	UVC_HANDLE_ACTIVE	= 1,};struct uvc_fh {	struct uvc_video_device *device;	enum uvc_handle_state state;};struct uvc_driver {	struct usb_driver driver;	struct mutex open_mutex;	/* protects from open/disconnect race */	struct list_head devices;	/* struct uvc_device list */	struct list_head controls;	/* struct uvc_control_info list */	struct mutex ctrl_mutex;	/* protects controls and devices					   lists */};/* ------------------------------------------------------------------------ * Debugging, printing and logging */#define UVC_TRACE_PROBE		(1 << 0)#define UVC_TRACE_DESCR		(1 << 1)#define UVC_TRACE_CONTROL	(1 << 2)#define UVC_TRACE_FORMAT	(1 << 3)#define UVC_TRACE_CAPTURE	(1 << 4)#define UVC_TRACE_CALLS		(1 << 5)#define UVC_TRACE_IOCTL		(1 << 6)#define UVC_TRACE_FRAME		(1 << 7)#define UVC_TRACE_SUSPEND	(1 << 8)#define UVC_TRACE_STATUS	(1 << 9)extern unsigned int uvc_trace_param;#define uvc_trace(flag, msg...) \	do { \		if (uvc_trace_param & flag) \			printk(KERN_DEBUG "uvcvideo: " msg); \	} while (0)#define uvc_printk(level, msg...) \	printk(level "uvcvideo: " msg)#define UVC_GUID_FORMAT "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-" \			"%02x%02x%02x%02x%02x%02x"#define UVC_GUID_ARGS(guid) \	(guid)[3],  (guid)[2],  (guid)[1],  (guid)[0], \	(guid)[5],  (guid)[4], \	(guid)[7],  (guid)[6], \	(guid)[8],  (guid)[9], \	(guid)[10], (guid)[11], (guid)[12], \	(guid)[13], (guid)[14], (guid)[15]/* -------------------------------------------------------------------------- * Internal functions. *//* Core driver */extern struct uvc_driver uvc_driver;extern void uvc_delete(struct kref *kref);/* Video buffers queue management. */extern void uvc_queue_init(struct uvc_video_queue *queue);extern int uvc_alloc_buffers(struct uvc_video_queue *queue,		unsigned int nbuffers, unsigned int buflength);extern int uvc_free_buffers(struct uvc_video_queue *queue);extern int uvc_query_buffer(struct uvc_video_queue *queue,		struct v4l2_buffer *v4l2_buf);extern int uvc_queue_buffer(struct uvc_video_queue *queue,		struct v4l2_buffer *v4l2_buf);extern int uvc_dequeue_buffer(struct uvc_video_queue *queue,		struct v4l2_buffer *v4l2_buf, int nonblocking);extern int uvc_queue_enable(struct uvc_video_queue *queue, int enable);extern void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect);extern struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue,		struct uvc_buffer *buf);extern unsigned int uvc_queue_poll(struct uvc_video_queue *queue,		struct file *file, poll_table *wait);static inline int uvc_queue_streaming(struct uvc_video_queue *queue){	return queue->flags & UVC_QUEUE_STREAMING;}/* V4L2 interface */extern struct file_operations uvc_fops;/* Video */extern int uvc_video_init(struct uvc_video_device *video);extern int uvc_video_suspend(struct uvc_video_device *video);extern int uvc_video_resume(struct uvc_video_device *video);extern int uvc_video_enable(struct uvc_video_device *video, int enable);extern int uvc_probe_video(struct uvc_video_device *video,		struct uvc_streaming_control *probe);extern int uvc_query_ctrl(struct uvc_device *dev, __u8 query, __u8 unit,		__u8 intfnum, __u8 cs, void *data, __u16 size);extern int uvc_set_video_ctrl(struct uvc_video_device *video,		struct uvc_streaming_control *ctrl, int probe);/* Status */extern int uvc_status_init(struct uvc_device *dev);extern void uvc_status_cleanup(struct uvc_device *dev);extern int uvc_status_suspend(struct uvc_device *dev);extern int uvc_status_resume(struct uvc_device *dev);/* Controls */extern struct uvc_control *uvc_find_control(struct uvc_video_device *video,		__u32 v4l2_id, struct uvc_control_mapping **mapping);extern int uvc_query_v4l2_ctrl(struct uvc_video_device *video,		struct v4l2_queryctrl *v4l2_ctrl);extern int uvc_ctrl_add_info(struct uvc_control_info *info);extern int uvc_ctrl_add_mapping(struct uvc_control_mapping *mapping);extern int uvc_ctrl_init_device(struct uvc_device *dev);extern void uvc_ctrl_cleanup_device(struct uvc_device *dev);extern int uvc_ctrl_resume_device(struct uvc_device *dev);extern void uvc_ctrl_init(void);extern int uvc_ctrl_begin(struct uvc_video_device *video);extern int __uvc_ctrl_commit(struct uvc_video_device *video, int rollback);static inline int uvc_ctrl_commit(struct uvc_video_device *video){	return __uvc_ctrl_commit(video, 0);}static inline int uvc_ctrl_rollback(struct uvc_video_device *video){	return __uvc_ctrl_commit(video, 1);}extern int uvc_ctrl_get(struct uvc_video_device *video,		struct v4l2_ext_control *xctrl);extern int uvc_ctrl_set(struct uvc_video_device *video,		struct v4l2_ext_control *xctrl);extern int uvc_xu_ctrl_query(struct uvc_video_device *video,		struct uvc_xu_control *ctrl, int set);/* Utility functions */extern void uvc_simplify_fraction(uint32_t *numerator, uint32_t *denominator,		unsigned int n_terms, unsigned int threshold);extern uint32_t uvc_fraction_to_interval(uint32_t numerator,		uint32_t denominator);extern struct usb_host_endpoint *uvc_find_endpoint(		struct usb_host_interface *alts, __u8 epaddr);/* Quirks support */void uvc_video_decode_isight(struct urb *urb, struct uvc_video_device *video,		struct uvc_buffer *buf);#endif /* __KERNEL__ */#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -