📄 spca5xx.h
字号:
#define SPCASVIDIOPARAM _IOW('v',BASE_VIDIOCPRIVATE + 2,struct video_param)/* State machine for each frame in the frame buffer during capture */enum { STATE_SCANNING, /* Scanning for start */ STATE_HEADER, /* Parsing header */ STATE_LINES, /* Parsing lines */};/* Buffer states */enum { BUF_NOT_ALLOCATED, BUF_ALLOCATED, BUF_PEND_DEALLOC, /* spca50x->buf_timer is set */};struct usb_device;/* One buffer for the USB ISO transfers */struct spca50x_sbuf { char *data; struct urb *urb;};/* States for each frame buffer. */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 */ FRAME_ABORTING, /* Aborting everything. Caused by hot unplugging. */};/************************ decoding data **************************/struct pictparam { int change; int force_rgb; int gamma; int OffRed; int OffBlue; int OffGreen; int GRed; int GBlue; int GGreen;};#define MAXCOMP 4struct dec_hufftbl;struct enc_hufftbl;union hufftblp { struct dec_hufftbl *dhuff; struct enc_hufftbl *ehuff;};struct scan { int dc; /* old dc value */ union hufftblp hudc; /* pointer to huffman table dc */ union hufftblp huac; /* pointer to huffman table ac */ int next; /* when to switch to next scan */ int cid; /* component id */ int hv; /* horiz/vert, copied from comp */ int tq; /* quant tbl, copied from comp */};/*********************************/#define DECBITS 10 /* seems to be the optimum */struct dec_hufftbl { int maxcode[17]; int valptr[16]; unsigned char vals[256]; unsigned int llvals[1 << DECBITS];};/*********************************/struct in { unsigned char *p; unsigned int bits; int omitescape; int left; int marker;};struct jpginfo { int nc; /* number of components */ int ns; /* number of scans */ int dri; /* restart interval */ int nm; /* mcus til next marker */ int rm; /* next restart marker */};struct comp { int cid; int hv; int tq;};/* Sonix decompressor struct B.S.(2004) */struct code_table_t { int is_abs; int len; int val;};struct dec_data { struct in in; struct jpginfo info; struct comp comps[MAXCOMP]; struct scan dscans[MAXCOMP]; unsigned char quant[3][64]; int dquant[3][64]; struct code_table_t table[256]; unsigned char Red[256]; unsigned char Green[256]; unsigned char Blue[256];};/*************************End decoding data ********************************/struct spca50x_frame { unsigned char *data; /* Frame buffer */ unsigned char *tmpbuffer; /* temporary buffer spca50x->tmpbuffer need for decoding */ struct dec_data *decoder; /* Memory allocation for the jpeg decoders */ int dcts[6 * 64 + 16]; int out[6 * 64]; int max[6]; /*******************************************/ int seq; /* Frame sequence number */ int depth; /* Bytes per pixel */ int width; /* Width application is expecting */ int height; /* Height */ int hdrwidth; /* Width the frame actually is */ int hdrheight; /* Height */ int method; /* The decoding method for that frame 0 nothing 1 crop 2 div 4 mult */ int cropx1; /* value to be send with the frame for decoding feature */ int cropx2; int cropy1; int cropy2; int x; int y; unsigned int format; /* Format asked by apps for this frame */ int cameratype; /* native in frame format */ struct pictparam pictsetting; volatile int grabstate; /* State of grabbing */ int scanstate; /* State of scanning */ long scanlength; /* uncompressed, raw data length of frame */ int totlength; /* length of the current reading byte in the Iso stream */ wait_queue_head_t wq; /* Processes waiting */ int snapshot; /* True if frame was a snapshot */ int last_packet; /* sequence number for last packet */ unsigned char *highwater; /* used for debugging */};struct usb_spca50x { struct video_device *vdev; struct usb_device *dev; /* Device structure */ struct tasklet_struct spca5xx_tasklet; /* use a tasklet per device */ struct dec_data maindecode; unsigned long last_times; //timestamp unsigned int dtimes; //nexttimes to acquire unsigned char iface; /* interface in use */ int alt; /* current alternate setting */ int customid; /* product id get by probe */ int desc; /* enum camera name */ int ccd; /* If true, using the CCD otherwise the external input */ int chip_revision; /* set when probe the camera spca561 zc0301p for vm303 */ struct mwebcam mode_cam[TOTMODE]; /* all available mode registers by probe */ int bridge; /* Type of bridge (BRIDGE_SPCA505 or BRIDGE_SPCA506) */ int sensor; /* Type of image sensor chip */ int packet_size; /* Frame size per isoc desc */ int header_len; /* Determined by sensor type */ int maxwidth; int maxheight; int minwidth; int minheight; /* What we think the hardware is currently set to */ int brightness; int colour; int contrast; int hue; int whiteness; int exposure; // used by spca561 int autoexpo; int qindex; int width; /* use here for the init of each frame */ int height; int hdrwidth; int hdrheight; unsigned int format; int method; /* method ask for output pict */ int mode; /* requested frame size */ int pipe_size; // requested pipe size set according to mode __u16 norme; /* norme in use Pal Ntsc Secam */ __u16 channel; /* input composite video1 or svideo */ int cameratype; /* native in frame format */ struct pictparam pictsetting; /* Statistics variables */ spinlock_t v4l_lock; /* lock to protect shared data between isoc and process context */ int avg_lum; //The average luminance (if available from theframe header) int avg_bg, avg_rg; //The average B-G and R-G for white balancing struct semaphore lock; int user; /* user count for exclusive use */ int present; /* driver loaded */ int streaming; /* Are we streaming Isochronous? */ int grabbing; /* Are we grabbing? */ int packet; int compress; /* Should the next frame be compressed? */ char *fbuf; /* Videodev buffer area */ int curframe; /* Current receiving frame buffer */ struct spca50x_frame frame[SPCA50X_NUMFRAMES]; int cursbuf; /* Current receiving sbuf */ struct spca50x_sbuf sbuf[SPCA50X_NUMSBUF]; /* Temporary jpeg decoder workspace */ char *tmpBuffer; /* Framebuffer/sbuf management */ int buf_state; struct semaphore buf_lock; wait_queue_head_t wq; /* Processes waiting */ /* proc interface */ struct semaphore param_lock; /* params lock for this camera */ struct proc_dir_entry *proc_entry; /* /proc/spca50x/videoX */ struct proc_dir_entry *ctl_proc_entry; /* /proc/spca50x/controlX */ int lastFrameRead; uint i2c_ctrl_reg; // Camera I2C control register uint i2c_base; // Camera I2C address base char i2c_trigger_on_write; //do trigger bit on write __u8 force_rgb; //Read RGB instead of BGR __u8 min_bpp; //The minimal color depth that may be set __u8 lum_level; //Luminance level for brightness autoadjustment#ifdef SPCA50X_ENABLE_EXPERIMENTAL uint nstable; // the stable condition counter uint nunstable; // the unstable position counter __u8 a_red, a_green, a_blue; //initial values of color corrections params. #endif /* SPCA50X_ENABLE_EXPERIMENTAL */};struct cam_list { int id; const char *description;};struct palette_list { int num; const char *name;};struct bridge_list { int num; const char *name;};struct mode_list { int width; int height; int color; /* 0=grayscale, 1=color */ u8 pxcnt; /* pixel counter */ u8 lncnt; /* line counter */ u8 pxdv; /* pixel divisor */ u8 lndv; /* line divisor */ u8 m420; u8 common_A; u8 common_L;};#endif /* __KERNEL__ */#endif /* SPCA50X_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -