📄 zoran.h
字号:
/* v4l-capture settings */struct zoran_v4l_settings { int width, height, bytesperline; /* capture size */ const struct zoran_format *format; /* capture format */};/* whoops, this one is undeclared if !v4l2 */#ifndef HAVE_V4L2struct v4l2_jpegcompression { int quality; int APPn; int APP_len; char APP_data[60]; int COM_len; char COM_data[60]; __u32 jpeg_markers; __u8 reserved[116];};#endif/* jpg-capture/-playback settings */struct zoran_jpg_settings { int decimation; /* this bit is used to set everything to default */ int HorDcm, VerDcm, TmpDcm; /* capture decimation settings (TmpDcm=1 means both fields) */ int field_per_buff, odd_even; /* field-settings (odd_even=1 (+TmpDcm=1) means top-field-first) */ int img_x, img_y, img_width, img_height; /* crop settings (subframe capture) */ struct v4l2_jpegcompression jpg_comp; /* JPEG-specific capture settings */};struct zoran_mapping { struct file *file; int count;};struct zoran_jpg_buffer { struct zoran_mapping *map; u32 *frag_tab; /* addresses of frag table */ u32 frag_tab_bus; /* same value cached to save time in ISR */ enum zoran_buffer_state state; /* non-zero if corresponding buffer is in use in grab queue */ struct zoran_sync bs; /* DONE: info to return to application */};struct zoran_v4l_buffer { struct zoran_mapping *map; char *fbuffer; /* virtual address of frame buffer */ unsigned long fbuffer_phys; /* physical address of frame buffer */ unsigned long fbuffer_bus; /* bus address of frame buffer */ enum zoran_buffer_state state; /* state: unused/pending/done */ struct zoran_sync bs; /* DONE: info to return to application */};enum zoran_lock_activity { ZORAN_FREE, /* free for use */ ZORAN_ACTIVE, /* active but unlocked */ ZORAN_LOCKED, /* locked */};/* buffer collections */struct zoran_jpg_struct { enum zoran_lock_activity active; /* feature currently in use? */ struct zoran_jpg_buffer buffer[BUZ_MAX_FRAME]; /* buffers */ int num_buffers, buffer_size; u8 allocated; /* Flag if buffers are allocated */ u8 ready_to_be_freed; /* hack - see zoran_driver.c */ u8 need_contiguous; /* Flag if contiguous buffers are needed */};struct zoran_v4l_struct { enum zoran_lock_activity active; /* feature currently in use? */ struct zoran_v4l_buffer buffer[VIDEO_MAX_FRAME]; /* buffers */ int num_buffers, buffer_size; u8 allocated; /* Flag if buffers are allocated */ u8 ready_to_be_freed; /* hack - see zoran_driver.c */};struct zoran;/* zoran_fh contains per-open() settings */struct zoran_fh { struct zoran *zr; enum zoran_map_mode map_mode; /* Flag which bufferset will map by next mmap() */ struct zoran_overlay_settings overlay_settings; u32 *overlay_mask; /* overlay mask */ enum zoran_lock_activity overlay_active; /* feature currently in use? */ struct zoran_v4l_settings v4l_settings; /* structure with a lot of things to play with */ struct zoran_v4l_struct v4l_buffers; /* V4L buffers' info */ struct zoran_jpg_settings jpg_settings; /* structure with a lot of things to play with */ struct zoran_jpg_struct jpg_buffers; /* MJPEG buffers' info */};struct card_info { enum card_type type; char name[32]; u16 i2c_decoder, i2c_encoder; /* I2C types */ u16 video_vfe, video_codec; /* videocodec types */ u16 audio_chip; /* audio type */ u16 vendor_id, device_id; /* subsystem vendor/device ID */ int inputs; /* number of video inputs */ struct input { int muxsel; char name[32]; } input[BUZ_MAX_INPUT]; int norms; struct tvnorm *tvn[3]; /* supported TV norms */ u32 jpeg_int; /* JPEG interrupt */ u32 vsync_int; /* VSYNC interrupt */ s8 gpio[GPIO_MAX]; u8 gpcs[GPCS_MAX]; struct vfe_polarity vfe_pol; u8 gpio_pol[GPIO_MAX]; /* is the /GWS line conected? */ u8 gws_not_connected; void (*init) (struct zoran * zr);};struct zoran { struct video_device *video_dev; struct i2c_adapter i2c_adapter; /* */ struct i2c_algo_bit_data i2c_algo; /* */ u32 i2cbr; struct i2c_client *decoder; /* video decoder i2c client */ struct i2c_client *encoder; /* video encoder i2c client */ struct videocodec *codec; /* video codec */ struct videocodec *vfe; /* video front end */ struct semaphore resource_lock; /* prevent evil stuff */ u8 initialized; /* flag if zoran has been correctly initalized */ int user; /* number of current users */ struct card_info card; struct tvnorm *timing; unsigned short id; /* number of this device */ char name[32]; /* name of this device */ struct pci_dev *pci_dev; /* PCI device */ unsigned char revision; /* revision of zr36057 */ unsigned int zr36057_adr; /* bus address of IO mem returned by PCI BIOS */ unsigned char __iomem *zr36057_mem;/* pointer to mapped IO memory */ spinlock_t spinlock; /* Spinlock */ /* Video for Linux parameters */ int input, norm; /* card's norm and input - norm=VIDEO_MODE_* */ int hue, saturation, contrast, brightness; /* Current picture params */ struct video_buffer buffer; /* Current buffer params */ struct zoran_overlay_settings overlay_settings; u32 *overlay_mask; /* overlay mask */ enum zoran_lock_activity overlay_active; /* feature currently in use? */ wait_queue_head_t v4l_capq; int v4l_overlay_active; /* Overlay grab is activated */ int v4l_memgrab_active; /* Memory grab is activated */ int v4l_grab_frame; /* Frame number being currently grabbed */#define NO_GRAB_ACTIVE (-1) unsigned long v4l_grab_seq; /* Number of frames grabbed */ struct zoran_v4l_settings v4l_settings; /* structure with a lot of things to play with */ /* V4L grab queue of frames pending */ unsigned long v4l_pend_head; unsigned long v4l_pend_tail; unsigned long v4l_sync_tail; int v4l_pend[V4L_MAX_FRAME]; struct zoran_v4l_struct v4l_buffers; /* V4L buffers' info */ /* Buz MJPEG parameters */ enum zoran_codec_mode codec_mode; /* status of codec */ struct zoran_jpg_settings jpg_settings; /* structure with a lot of things to play with */ wait_queue_head_t jpg_capq; /* wait here for grab to finish */ /* grab queue counts/indices, mask with BUZ_MASK_STAT_COM before using as index */ /* (dma_head - dma_tail) is number active in DMA, must be <= BUZ_NUM_STAT_COM */ /* (value & BUZ_MASK_STAT_COM) corresponds to index in stat_com table */ unsigned long jpg_que_head; /* Index where to put next buffer which is queued */ unsigned long jpg_dma_head; /* Index of next buffer which goes into stat_com */ unsigned long jpg_dma_tail; /* Index of last buffer in stat_com */ unsigned long jpg_que_tail; /* Index of last buffer in queue */ unsigned long jpg_seq_num; /* count of frames since grab/play started */ unsigned long jpg_err_seq; /* last seq_num before error */ unsigned long jpg_err_shift; unsigned long jpg_queued_num; /* count of frames queued since grab/play started */ /* zr36057's code buffer table */ u32 *stat_com; /* stat_com[i] is indexed by dma_head/tail & BUZ_MASK_STAT_COM */ /* (value & BUZ_MASK_FRAME) corresponds to index in pend[] queue */ int jpg_pend[BUZ_MAX_FRAME]; /* array indexed by frame number */ struct zoran_jpg_struct jpg_buffers; /* MJPEG buffers' info */ /* Additional stuff for testing */#ifdef CONFIG_PROC_FS struct proc_dir_entry *zoran_proc;#else void *zoran_proc;#endif int testing; int jpeg_error; int intr_counter_GIRQ1; int intr_counter_GIRQ0; int intr_counter_CodRepIRQ; int intr_counter_JPEGRepIRQ; int field_counter; int IRQ1_in; int IRQ1_out; int JPEG_in; int JPEG_out; int JPEG_0; int JPEG_1; int END_event_missed; int JPEG_missed; int JPEG_error; int num_errors; int JPEG_max_missed; int JPEG_min_missed; u32 last_isr; unsigned long frame_num; wait_queue_head_t test_q;};/*The following should be done in more portable way. It depends on define of _ALPHA_BUZ in the Makefile.*/#ifdef _ALPHA_BUZ#define btwrite(dat,adr) writel((dat), zr->zr36057_adr+(adr))#define btread(adr) readl(zr->zr36057_adr+(adr))#else#define btwrite(dat,adr) writel((dat), zr->zr36057_mem+(adr))#define btread(adr) readl(zr->zr36057_mem+(adr))#endif#define btand(dat,adr) btwrite((dat) & btread(adr), adr)#define btor(dat,adr) btwrite((dat) | btread(adr), adr)#define btaor(dat,mask,adr) btwrite((dat) | ((mask) & btread(adr)), adr)#endif /* __kernel__ */#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -