📄 ov511.h
字号:
SEN_OV8600, SEN_KS0127, SEN_KS0127B, SEN_SAA7111A,};enum { STATE_SCANNING, /* Scanning for start */ STATE_HEADER, /* Parsing header */ STATE_LINES, /* Parsing lines */};/* Buffer states */enum { BUF_NOT_ALLOCATED, BUF_ALLOCATED,};/* --------- Definition of ioctl interface --------- */#define OV511_INTERFACE_VER 101/* LED options */enum { LED_OFF, LED_ON, LED_AUTO,};/* Raw frame formats */enum { RAWFMT_INVALID, RAWFMT_YUV400, RAWFMT_YUV420, RAWFMT_YUV422, RAWFMT_GBR422,};struct ov511_i2c_struct { unsigned char slave; /* Write slave ID (read ID - 1) */ unsigned char reg; /* Index of register */ unsigned char value; /* User sets this w/ write, driver does w/ read */ unsigned char mask; /* Bits to be changed. Not used with read ops */};/* ioctls */#define OV511IOC_WI2C _IOW('v', BASE_VIDIOCPRIVATE + 5, \ struct ov511_i2c_struct)#define OV511IOC_RI2C _IOWR('v', BASE_VIDIOCPRIVATE + 6, \ struct ov511_i2c_struct)/* ------------- End IOCTL interface -------------- */struct usb_ov511; /* Forward declaration */struct ov511_sbuf { struct usb_ov511 *ov; unsigned char *data; struct urb *urb; spinlock_t lock; int n;};enum { FRAME_UNUSED, /* Unused (no MCAPTURE) */ FRAME_READY, /* Ready to start grabbing */ FRAME_GRABBING, /* In the process of being grabbed into */ FRAME_DONE, /* Finished grabbing, but not been synced yet */ FRAME_ERROR, /* Something bad happened while processing */};struct ov511_regvals { enum { OV511_DONE_BUS, OV511_REG_BUS, OV511_I2C_BUS, } bus; unsigned char reg; unsigned char val;};struct ov511_frame { int framenum; /* Index of this frame */ unsigned char *data; /* Frame buffer */ unsigned char *tempdata; /* Temp buffer for multi-stage conversions */ unsigned char *rawdata; /* Raw camera data buffer */ unsigned char *compbuf; /* Temp buffer for decompressor */ int depth; /* Bytes per pixel */ int width; /* Width application is expecting */ int height; /* Height application is expecting */ int rawwidth; /* Actual width of frame sent from camera */ int rawheight; /* Actual height of frame sent from camera */ int sub_flag; /* Sub-capture mode for this frame? */ unsigned int format; /* Format for this frame */ int compressed; /* Is frame compressed? */ volatile int grabstate; /* State of grabbing */ int scanstate; /* State of scanning */ int bytes_recvd; /* Number of image bytes received from camera */ long bytes_read; /* Amount that has been read() */ wait_queue_head_t wq; /* Processes waiting */ int snapshot; /* True if frame was a snapshot */};#define DECOMP_INTERFACE_VER 4/* Compression module operations */struct ov51x_decomp_ops { int (*decomp_400)(unsigned char *, unsigned char *, unsigned char *, int, int, int); int (*decomp_420)(unsigned char *, unsigned char *, unsigned char *, int, int, int); int (*decomp_422)(unsigned char *, unsigned char *, unsigned char *, int, int, int); struct module *owner;};struct usb_ov511 { struct video_device *vdev; struct usb_device *dev; int customid; char *desc; unsigned char iface; char usb_path[OV511_USB_PATH_LEN]; /* Determined by sensor type */ int maxwidth; int maxheight; int minwidth; int minheight; int brightness; int colour; int contrast; int hue; int whiteness; int exposure; int auto_brt; /* Auto brightness enabled flag */ int auto_gain; /* Auto gain control enabled flag */ int auto_exp; /* Auto exposure enabled flag */ int backlight; /* Backlight exposure algorithm flag */ int mirror; /* Image is reversed horizontally */ int led_policy; /* LED: off|on|auto; OV511+ only */ struct semaphore lock; /* Serializes user-accessible operations */ int user; /* user count for exclusive use */ int streaming; /* Are we streaming Isochronous? */ int grabbing; /* Are we grabbing? */ int compress; /* Should the next frame be compressed? */ int compress_inited; /* Are compression params uploaded? */ int lightfreq; /* Power (lighting) frequency */ int bandfilt; /* Banding filter enabled flag */ unsigned char *fbuf; /* Videodev buffer area */ unsigned char *tempfbuf; /* Temporary (intermediate) buffer area */ unsigned char *rawfbuf; /* Raw camera data buffer area */ int sub_flag; /* Pix Array subcapture on flag */ int subx; /* Pix Array subcapture x offset */ int suby; /* Pix Array subcapture y offset */ int subw; /* Pix Array subcapture width */ int subh; /* Pix Array subcapture height */ int curframe; /* Current receiving sbuf */ struct ov511_frame frame[OV511_NUMFRAMES]; struct ov511_sbuf sbuf[OV511_NUMSBUF]; wait_queue_head_t wq; /* Processes waiting */ int snap_enabled; /* Snapshot mode enabled */ int bridge; /* Type of bridge (BRG_*) */ int bclass; /* Class of bridge (BCL_*) */ int sensor; /* Type of image sensor chip (SEN_*) */ int packet_size; /* Frame size per isoc desc */ int packet_numbering; /* Is ISO frame numbering enabled? */ struct semaphore param_lock; /* params lock for this camera */ /* Framebuffer/sbuf management */ int buf_state; struct semaphore buf_lock; struct ov51x_decomp_ops *decomp_ops; /* Stop streaming while changing picture settings */ int stop_during_set; int stopped; /* Streaming is temporarily paused */ /* Video decoder stuff */ int input; /* Composite, S-VIDEO, etc... */ int num_inputs; /* Number of inputs */ int norm; /* NTSC / PAL / SECAM */ int has_decoder; /* Device has a video decoder */ int pal; /* Device is designed for PAL resolution */ /* I2C interface */ struct semaphore i2c_lock; /* Protect I2C controller regs */ unsigned char primary_i2c_slave; /* I2C write id of sensor */ /* Control transaction stuff */ unsigned char *cbuf; /* Buffer for payload */ struct semaphore cbuf_lock;};/* Used to represent a list of values and their respective symbolic names */struct symbolic_list { int num; char *name;};#define NOT_DEFINED_STR "Unknown"/* Returns the name of the matching element in the symbolic_list array. The * end of the list must be marked with an element that has a NULL name. */static inline char * symbolic(struct symbolic_list list[], int num){ int i; for (i = 0; list[i].name != NULL; i++) if (list[i].num == num) return (list[i].name); return (NOT_DEFINED_STR);}/* Compression stuff */#define OV511_QUANTABLESIZE 64#define OV518_QUANTABLESIZE 32#define OV511_YQUANTABLE { \ 0, 1, 1, 2, 2, 3, 3, 4, \ 1, 1, 1, 2, 2, 3, 4, 4, \ 1, 1, 2, 2, 3, 4, 4, 4, \ 2, 2, 2, 3, 4, 4, 4, 4, \ 2, 2, 3, 4, 4, 5, 5, 5, \ 3, 3, 4, 4, 5, 5, 5, 5, \ 3, 4, 4, 4, 5, 5, 5, 5, \ 4, 4, 4, 4, 5, 5, 5, 5 \}#define OV511_UVQUANTABLE { \ 0, 2, 2, 3, 4, 4, 4, 4, \ 2, 2, 2, 4, 4, 4, 4, 4, \ 2, 2, 3, 4, 4, 4, 4, 4, \ 3, 4, 4, 4, 4, 4, 4, 4, \ 4, 4, 4, 4, 4, 4, 4, 4, \ 4, 4, 4, 4, 4, 4, 4, 4, \ 4, 4, 4, 4, 4, 4, 4, 4, \ 4, 4, 4, 4, 4, 4, 4, 4 \}#define OV518_YQUANTABLE { \ 5, 4, 5, 6, 6, 7, 7, 7, \ 5, 5, 5, 5, 6, 7, 7, 7, \ 6, 6, 6, 6, 7, 7, 7, 8, \ 7, 7, 6, 7, 7, 7, 8, 8 \}#define OV518_UVQUANTABLE { \ 6, 6, 6, 7, 7, 7, 7, 7, \ 6, 6, 6, 7, 7, 7, 7, 7, \ 6, 6, 6, 7, 7, 7, 7, 8, \ 7, 7, 7, 7, 7, 7, 8, 8 \}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -