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

📄 dv1394-private.h

📁 这是关于ieee1394的最新源码,上面包含了所有更新的部分!
💻 H
📖 第 1 页 / 共 2 页
字号:
	   the IRQ handler to determine whether the frame can be reset */	int done;	/* kernel virtual pointer to the start of this frame's data in	   the user ringbuffer. Use only for CPU access; to get the DMA	   bus address you must go through the video->user_dma mapping */	unsigned long data;	/* Max # of packets per frame */#define MAX_PACKETS 500	/* a PAGE_SIZE memory pool for allocating CIP headers	   !header_pool must be aligned to PAGE_SIZE! */	struct CIP_header *header_pool;	dma_addr_t         header_pool_dma;	/* a physically contiguous memory pool for allocating DMA	   descriptor blocks; usually around 64KB in size	   !descriptor_pool must be aligned to PAGE_SIZE! */	struct DMA_descriptor_block *descriptor_pool;	dma_addr_t                   descriptor_pool_dma;	unsigned long                descriptor_pool_size;	/* # of packets allocated for this frame */	unsigned int n_packets;	/* below are several pointers (kernel virtual addresses, not	   DMA bus addresses) to parts of the DMA program.  These are	   set each time the DMA program is written in	   frame_prepare(). They are used later on, e.g. from the	   interrupt handler, to check the status of the frame */	/* points to status/timestamp field of first DMA packet */	/* (we'll check it later to monitor timestamp accuracy) */	u32 *frame_begin_timestamp;	/* the timestamp we assigned to the first packet in the frame */	u32 assigned_timestamp;	/* pointer to the first packet's CIP header (where the timestamp goes) */	struct CIP_header *cip_syt1;	/* pointer to the second packet's CIP header	   (only set if the first packet was empty) */	struct CIP_header *cip_syt2;	/* in order to figure out what caused an interrupt,	   store pointers to the status fields of the two packets	   that can cause interrupts. We'll check these from the	   interrupt handler.	*/	u32 *mid_frame_timestamp;	u32 *frame_end_timestamp;	/* branch address field of final packet. This is effectively	   the "tail" in the chain of DMA descriptor blocks.	   We will fill it with the address of the first DMA descriptor	   block in the subsequent frame, once it is ready.	*/	u32 *frame_end_branch;	/* the number of descriptors in the first descriptor block	   of the frame. Needed to start DMA */	int first_n_descriptors;};struct packet {	u16	timestamp;	u16	invalid;	u16	iso_header;	u16	data_length;	u32	cip_h1;	u32	cip_h2;	unsigned char data[480];	unsigned char padding[16]; /* force struct size =512 for page alignment */};/* allocate/free a frame */static struct frame* frame_new(unsigned int frame_num, struct video_card *video);static void frame_delete(struct frame *f);/* reset f so that it can be used again */static void frame_reset(struct frame *f);/* struct video_card contains all data associated with one instance   of the dv1394 driver*/enum modes {	MODE_RECEIVE,	MODE_TRANSMIT};struct video_card {	/* ohci card to which this instance corresponds */	struct ti_ohci *ohci;	/* OHCI card id; the link between the VFS inode and a specific video_card	   (essentially the device minor number) */	int id;	/* entry in dv1394_cards */	struct list_head list;	/* OHCI card IT DMA context number, -1 if not in use */	int ohci_it_ctx;	struct ohci1394_iso_tasklet it_tasklet;	/* register offsets for current IT DMA context, 0 if not in use */	u32 ohci_IsoXmitContextControlSet;	u32 ohci_IsoXmitContextControlClear;	u32 ohci_IsoXmitCommandPtr;	/* OHCI card IR DMA context number, -1 if not in use */	struct ohci1394_iso_tasklet ir_tasklet;	int ohci_ir_ctx;	/* register offsets for current IR DMA context, 0 if not in use */	u32 ohci_IsoRcvContextControlSet;	u32 ohci_IsoRcvContextControlClear;	u32 ohci_IsoRcvCommandPtr;	u32 ohci_IsoRcvContextMatch;	/* CONCURRENCY CONTROL */	/* there are THREE levels of locking associated with video_card. */	/*	   1) the 'open' flag - this prevents more than one process from	   opening the device. (the driver currently assumes only one opener).	   This is a regular int, but use test_and_set_bit() (on bit zero) 	   for atomicity.	 */	unsigned long open;	/*	   2) the spinlock - this provides mutual exclusion between the interrupt	   handler and process-context operations. Generally you must take the	   spinlock under the following conditions:	     1) DMA (and hence the interrupt handler) may be running	     AND	     2) you need to operate on the video_card, especially active_frame	     It is OK to play with video_card without taking the spinlock if	     you are certain that DMA is not running. Even if DMA is running,	     it is OK to *read* active_frame with the lock, then drop it	     immediately. This is safe because the interrupt handler will never	     advance active_frame onto a frame that is not READY (and the spinlock	     must be held while marking a frame READY).	     spinlock is also used to protect ohci_it_ctx and ohci_ir_ctx,	     which can be accessed from both process and interrupt context	 */	spinlock_t spinlock;	/* flag to prevent spurious interrupts (which OHCI seems to	   generate a lot :) from accessing the struct */	int dma_running;	/*	  3) the sleeping mutex 'mtx' - this is used from process context only,	  to serialize various operations on the video_card. Even though only one	  open() is allowed, we still need to prevent multiple threads of execution	  from entering calls like read, write, ioctl, etc.	  I honestly can't think of a good reason to use dv1394 from several threads	  at once, but we need to serialize anyway to prevent oopses =).	  NOTE: if you need both spinlock and mtx, take mtx first to avoid deadlock!	 */	struct mutex mtx;	/* people waiting for buffer space, please form a line here... */	wait_queue_head_t waitq;	/* support asynchronous I/O signals (SIGIO) */	struct fasync_struct *fasync;	/* the large, non-contiguous (rvmalloc()) ringbuffer for DV           data, exposed to user-space via mmap() */	unsigned long      dv_buf_size;	struct dma_region  dv_buf;	/* next byte in the ringbuffer that a write() call will fill */	size_t write_off;	struct frame *frames[DV1394_MAX_FRAMES];	/* n_frames also serves as an indicator that this struct video_card is	   initialized and ready to run DMA buffers */	int n_frames;	/* this is the frame that is currently "owned" by the OHCI DMA controller	   (set to -1 iff DMA is not running)	   ! must lock against the interrupt handler when accessing it !	   RULES:	       Only the interrupt handler may change active_frame if DMA	          is running; if not, process may change it	       If the next frame is READY, the interrupt handler will advance	       active_frame when the current frame is finished.	       If the next frame is CLEAR, the interrupt handler will re-transmit	       the current frame, and the dropped_frames counter will be  incremented.	       The interrupt handler will NEVER advance active_frame to a	       frame that is not READY.	*/	int active_frame;	int first_run;	/* the same locking rules apply to these three fields also: */	/* altered ONLY from process context. Must check first_clear_frame->state;	   if it's READY, that means the ringbuffer is full with READY frames;	   if it's CLEAR, that means one or more ringbuffer frames are CLEAR */	unsigned int first_clear_frame;	/* altered both by process and interrupt */	unsigned int n_clear_frames;	/* only altered by the interrupt */	unsigned int dropped_frames;	/* the CIP accumulator and continuity counter are properties	   of the DMA stream as a whole (not a single frame), so they	   are stored here in the video_card */	unsigned long cip_accum;	unsigned long cip_n, cip_d;	unsigned int syt_offset;	unsigned int continuity_counter;	enum pal_or_ntsc pal_or_ntsc;	/* redundant, but simplifies the code somewhat */	unsigned int frame_size; /* in bytes */	/* the isochronous channel to use, -1 if video card is inactive */	int channel;	/* physically contiguous packet ringbuffer for receive */	struct dma_region packet_buf;	unsigned long  packet_buf_size;	unsigned int current_packet;	int first_frame; 	/* received first start frame marker? */	enum modes mode;};/*   if the video_card is not initialized, then the ONLY fields that are valid are:   ohci   open   n_frames*/static inline int video_card_initialized(struct video_card *v){	return v->n_frames > 0;}static int do_dv1394_init(struct video_card *video, struct dv1394_init *init);static int do_dv1394_init_default(struct video_card *video);static void do_dv1394_shutdown(struct video_card *video, int free_user_buf);/* NTSC empty packet rate accurate to within 0.01%,   calibrated against a Sony DSR-40 DVCAM deck */#define CIP_N_NTSC   68000000#define CIP_D_NTSC 1068000000#define CIP_N_PAL  1#define CIP_D_PAL 16#endif /* _DV_1394_PRIVATE_H */

⌨️ 快捷键说明

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