📄 zc0301_struct.h
字号:
/* This file contains the basic struct:zc0301_device. * * This struct is a virtual struct for ZC0301 device driver * * It's created by WE.XCC at 2008.05.03 *
* Author's E-mail:84318391@163.com
* */ #ifndef _ZC0301_STRUCT_H_#define _ZC0301_STRUCT_H_#include <linux/usb.h> /*for usb*/#include <linux/videodev.h> /*for v4l2*/#include <linux/types.h> #include <media/v4l2-common.h> /*for v4l2*/#include <linux/wait.h> /*wait_queue_head_t need*/ #include <linux/list.h> /*struct list*/#include <linux/vmalloc.h> /*virtual memory area need*/#include <linux/mm.h>#include <linux/spinlock.h> /*spin_lock need*/#include <linux/mutex.h> /*struct mutex*/#define ZC0301_URBS 2#define ZC0301_PACKETS 7#define ZC0301_MAX_FRAMES 64enum stream_state { STREAM_ON = 0x01, STREAM_OFF = 0x02,};enum frame_state { F_UNUSED = 0x01, F_QUEUED = 0x02, F_GRABBING = 0x04, F_DONE = 0x08, F_ERROR = 0x10,};enum device_state { INITED = 0x01, MISCONFIGED = 0x02, DISCONNECTED = 0x04,};struct zc0301_frame { void *bufmem; struct v4l2_buffer buf; struct list_head queue; enum frame_state f_state;};struct zc0301_device { struct usb_device *usbdev; /*for usb device*/ struct video_device *v4ldev; /*video register etc*/ struct urb *urb[ZC0301_URBS]; /*urb transfer*/ void *transfer_buffer[ZC0301_URBS]; /*store data when urb come back*/ u8 *control_buffer, users; /*read back data && record how many processes*/ enum device_state d_state; /*device state*/ enum stream_state s_state; /*stream state*/ wait_queue_head_t wait_frame; /*wait queue*/ spinlock_t queue_lock; /*to use when handle with list_head*/ struct zc0301_frame frame[ZC0301_MAX_FRAMES]; /*store data and v4l2 informations*/ struct list_head inqueue, outqueue; /*in/out data*/ struct mutex dev_mutex, fop_mutex; /*mutex lock for device and file operations*/ u32 nbuffers; /*record how many vma/frame are alloced*/ //u8 descriptors[5]; /*flag of descriptors*/ //u8 config_count, intf_count, endp_count; /*to count number of descriptor*/};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -