/* Memory layout */ #define IVTV_ENCODER_OFFSET 0x00000000 #define IVTV_ENCODER_SIZE 0x00800000 /* Total size is 0x01000000, but only first half is used */ #define IVTV_DECODER_OFFSET 0x01000000 #define IVTV_DECODER_SIZE 0x00800000 /* Total size is 0x01000000, but only first half is used */ #define IVTV_REG_OFFSET 0x02000000 #define IVTV_REG_SIZE 0x00010000
/* Maximum ivtv driver instances. Some people have a huge number of
capture cards, so set this to a high value. */ #define IVTV_MAX_CARDS 32
/* Default I2C SCL period in microseconds */ #define IVTV_DEFAULT_I2C_CLOCK_PERIOD 20
struct ivtv_options { int kilobytes[IVTV_MAX_STREAMS]; /* size in kilobytes of each stream */ int cardtype; /* force card type on load */ int tuner; /* set tuner on load */ int radio; /* enable/disable radio */ int newi2c; /* new I2C algorithm */ int i2c_clock_period; /* period of SCL for I2C bus */
};
struct ivtv_api_cache { unsignedlong last_jiffies; /* when last command was issued */
u32 data[CX2341X_MBOX_MAX_DATA]; /* last sent api data */
};
struct ivtv_mailbox_data { volatilestruct ivtv_mailbox __iomem *mbox; /* Bits 0-2 are for the encoder mailboxes, 0-1 are for the decoder mailboxes.
If the bit is set, then the corresponding mailbox is in use by the driver. */ unsignedlong busy;
u8 max_mbox;
};
/* per-buffer bit flags */ #define IVTV_F_B_NEED_BUF_SWAP (1 << 0) /* this buffer should be byte swapped */
/* per-stream, s_flags */ #define IVTV_F_S_DMA_PENDING 0/* this stream has pending DMA */ #define IVTV_F_S_DMA_HAS_VBI 1/* the current DMA request also requests VBI data */ #define IVTV_F_S_NEEDS_DATA 2/* this decoding stream needs more data */
#define IVTV_F_S_CLAIMED 3/* this stream is claimed */ #define IVTV_F_S_STREAMING 4/* the fw is decoding/encoding this stream */ #define IVTV_F_S_INTERNAL_USE 5/* this stream is used internally (sliced VBI processing) */ #define IVTV_F_S_PASSTHROUGH 6/* this stream is in passthrough mode */ #define IVTV_F_S_STREAMOFF 7/* signal end of stream EOS */ #define IVTV_F_S_APPL_IO 8/* this stream is used read/written by an application */
#define IVTV_F_S_PIO_PENDING 9/* this stream has pending PIO */ #define IVTV_F_S_PIO_HAS_VBI 1/* the current PIO request also requests VBI data */
/* per-ivtv, i_flags */ #define IVTV_F_I_DMA 0/* DMA in progress */ #define IVTV_F_I_UDMA 1/* UDMA in progress */ #define IVTV_F_I_UDMA_PENDING 2/* UDMA pending */ #define IVTV_F_I_SPEED_CHANGE 3/* a speed change is in progress */ #define IVTV_F_I_EOS 4/* end of encoder stream reached */ #define IVTV_F_I_RADIO_USER 5/* the radio tuner is selected */ #define IVTV_F_I_DIG_RST 6/* reset digitizer */ #define IVTV_F_I_DEC_YUV 7/* YUV instead of MPG is being decoded */ #define IVTV_F_I_UPDATE_CC 9/* CC should be updated */ #define IVTV_F_I_UPDATE_WSS 10/* WSS should be updated */ #define IVTV_F_I_UPDATE_VPS 11/* VPS should be updated */ #define IVTV_F_I_DECODING_YUV 12/* this stream is YUV frame decoding */ #define IVTV_F_I_ENC_PAUSED 13/* the encoder is paused */ #define IVTV_F_I_VALID_DEC_TIMINGS 14/* last_dec_timing is valid */ #define IVTV_F_I_HAVE_WORK 15/* used in the interrupt handler: there is work to be done */ #define IVTV_F_I_WORK_HANDLER_VBI 16/* there is work to be done for VBI */ #define IVTV_F_I_WORK_HANDLER_YUV 17/* there is work to be done for YUV */ #define IVTV_F_I_WORK_HANDLER_PIO 18/* there is work to be done for PIO */ #define IVTV_F_I_PIO 19/* PIO in progress */ #define IVTV_F_I_DEC_PAUSED 20/* the decoder is paused */ #define IVTV_F_I_INITED 21/* set after first open */ #define IVTV_F_I_FAILED 22/* set if first open failed */ #define IVTV_F_I_WORK_HANDLER_PCM 23/* there is work to be done for PCM */
struct ivtv_queue { struct list_head list; /* the list of buffers in this queue */
u32 buffers; /* number of buffers in this queue */
u32 length; /* total number of bytes of available buffer space */
u32 bytesused; /* total number of bytes used in this queue */
};
struct ivtv_stream { /* These first four fields are always set, even if the stream
is not actually created. */ struct video_device vdev; /* vdev.v4l2_dev is NULL if there is no device */ struct ivtv *itv; /* for ease of use */ constchar *name; /* name of the stream */ int type; /* stream type */
struct ivtv_open_id *id; /* pointer to the streaming ivtv_open_id */
spinlock_t qlock; /* locks access to the queues */ unsignedlong s_flags; /* status flags, see above */ int dma; /* can be PCI_DMA_TODEVICE, PCI_DMA_FROMDEVICE or PCI_DMA_NONE */
u32 pending_offset;
u32 pending_backup;
u64 pending_pts;
u32 dma_offset;
u32 dma_backup;
u64 dma_pts;
int subtype;
wait_queue_head_t waitq;
u32 dma_last_offset;
/* DMA xfer counter, buffers belonging to the same DMA
xfer will have the same dma_xfer_cnt. */
u16 dma_xfer_cnt;
/* Base Dev SG Array for cx23415/6 */ struct ivtv_sg_host_element *sg_pending; struct ivtv_sg_host_element *sg_processing; struct ivtv_sg_element *sg_dma;
dma_addr_t sg_handle; int sg_pending_size; int sg_processing_size; int sg_processed;
/* SG List of Buffers */ struct scatterlist *SGlist;
};
struct ivtv_open_id { struct v4l2_fh fh; int type; /* stream type */ int yuv_frames; /* 1: started OUT_UDMA_YUV output mode */ struct ivtv *itv;
};
struct vbi_info { /* VBI general data, does not change during streaming */
u32 raw_decoder_line_size; /* raw VBI line size from digitizer */
u8 raw_decoder_sav_odd_field; /* raw VBI Start Active Video digitizer code of odd field */
u8 raw_decoder_sav_even_field; /* raw VBI Start Active Video digitizer code of even field */
u32 sliced_decoder_line_size; /* sliced VBI line size from digitizer */
u8 sliced_decoder_sav_odd_field; /* sliced VBI Start Active Video digitizer code of odd field */
u8 sliced_decoder_sav_even_field; /* sliced VBI Start Active Video digitizer code of even field */
u32 start[2]; /* start of first VBI line in the odd/even fields */
u32 count; /* number of VBI lines per field */
u32 raw_size; /* size of raw VBI line from the digitizer */
u32 sliced_size; /* size of sliced VBI line from the digitizer */
u32 dec_start; /* start in decoder memory of VBI re-insertion buffers */
u32 enc_start; /* start in encoder memory of VBI capture buffers */
u32 enc_size; /* size of VBI capture area */ int fpi; /* number of VBI frames per interrupt */
struct v4l2_format in; /* current VBI capture format */ struct v4l2_sliced_vbi_format *sliced_in; /* convenience pointer to sliced struct in vbi.in union */ int insert_mpeg; /* if non-zero, then embed VBI data in MPEG stream */
/* Raw VBI compatibility hack */
u32 frame; /* frame counter hack needed for backwards compatibility
of old VBI software */
/* Sliced VBI output data */
struct vbi_cc cc_payload[256]; /* sliced VBI CC payload array: it is an array to preventdroppingCCdataiftheycouldn'tbe
processed fast enough */ int cc_payload_idx; /* index in cc_payload */
u8 cc_missing_cnt; /* counts number of frames without CC for passthrough mode */ int wss_payload; /* sliced VBI WSS payload */
u8 wss_missing_cnt; /* counts number of frames without WSS for passthrough mode */ struct vbi_vps vps_payload; /* sliced VBI VPS payload */
This pointer array will allocate 2049 bytes to store each VBI frame. */
u8 *sliced_mpeg_data[IVTV_VBI_FRAMES];
u32 sliced_mpeg_size[IVTV_VBI_FRAMES]; struct ivtv_buffer sliced_mpeg_buf; /* temporary buffer holding data from sliced_mpeg_data */
u32 inserted_frame; /* index in sliced_mpeg_size of next sliced data
to be inserted in the MPEG stream */
};
/* forward declaration of struct defined in ivtv-cards.h */ struct ivtv_card;
/* Struct to hold info about ivtv cards */ struct ivtv { /* General fixed card data */ struct pci_dev *pdev; /* PCI device */ conststruct ivtv_card *card; /* card information */ constchar *card_name; /* full name of the card */ conststruct ivtv_card_tuner_i2c *card_i2c; /* i2c addresses to probe for tuner */
u8 has_cx23415; /* 1 if it is a cx23415 based card, 0 for cx23416 */
u8 pvr150_workaround; /* 1 if the cx25840 needs to workaround a PVR150 bug */
u8 nof_inputs; /* number of video inputs */
u8 nof_audio_inputs; /* number of audio inputs */
u32 v4l2_cap; /* V4L2 capabilities of card */
u32 hw_flags; /* hardware description of the board */
v4l2_std_id tuner_std; /* the norm of the card's tuner (fixed) */ struct v4l2_subdev *sd_video; /* controlling video decoder subdev */ bool sd_video_is_streaming; /* is video already streaming? */ struct v4l2_subdev *sd_audio; /* controlling audio subdev */ struct v4l2_subdev *sd_muxer; /* controlling audio muxer subdev */
resource_size_t base_addr; /* PCI resource base address */ volatilevoid __iomem *enc_mem; /* pointer to mapped encoder memory */ volatilevoid __iomem *dec_mem; /* pointer to mapped decoder memory */ volatilevoid __iomem *reg_mem; /* pointer to mapped registers */ struct ivtv_options options; /* user options */
/* High-level state info */ unsignedlong i_flags; /* global ivtv flags */
u8 is_50hz; /* 1 if the current capture standard is 50 Hz */
u8 is_60hz /* 1 if the current capture standard is 60 Hz */;
u8 is_out_50hz /* 1 if the current TV output standard is 50 Hz */;
u8 is_out_60hz /* 1 if the current TV output standard is 60 Hz */; int output_mode; /* decoder output mode: NONE, MPG, YUV, UDMA YUV, passthrough */
u32 audio_input; /* current audio input */
u32 active_input; /* current video input */
u32 active_output; /* current video output */
v4l2_std_id std; /* current capture TV standard */
v4l2_std_id std_out; /* current TV output standard */
u8 audio_stereo_mode; /* decoder setting how to handle stereo MPEG audio */
u8 audio_bilingual_mode; /* decoder setting how to handle bilingual MPEG audio */
/* Locking */
spinlock_t lock; /* lock access to this struct */ struct mutex serialize_lock; /* mutex used to serialize open/close/start/stop/ioctl operations */
/* Streams */ int stream_buf_size[IVTV_MAX_STREAMS]; /* stream buffer size */ struct ivtv_stream streams[IVTV_MAX_STREAMS]; /* stream data */
atomic_t capturing; /* count number of active capture streams */
atomic_t decoding; /* count number of active decoding streams */
/* Used for ivtv-alsa module loading */ struct work_struct request_module_wk;
/* Interrupts & DMA */
u32 irqmask; /* active interrupts */
u32 irq_rr_idx; /* round-robin stream index */ struct kthread_worker irq_worker; /* kthread worker for PIO/YUV/VBI actions */ struct task_struct *irq_worker_task; /* task for irq_worker */ struct kthread_work irq_work; /* kthread work entry */
spinlock_t dma_reg_lock; /* lock access to DMA engine registers */ int cur_dma_stream; /* index of current stream doing DMA (-1 if none) */ int cur_pio_stream; /* index of current stream doing PIO (-1 if none) */
u32 dma_data_req_offset; /* store offset in decoder memory of current DMA request */
u32 dma_data_req_size; /* store size of current DMA request */ int dma_retries; /* current DMA retry attempt */ struct ivtv_user_dma udma; /* user based DMA for OSD */ struct timer_list dma_timer; /* timer used to catch unfinished DMAs */
u32 last_vsync_field; /* last seen vsync field */
wait_queue_head_t dma_waitq; /* wake up when the current DMA is finished */
wait_queue_head_t eos_waitq; /* wake up when EOS arrives */
wait_queue_head_t event_waitq; /* wake up when the next decoder event arrives */
wait_queue_head_t vsync_waitq; /* wake up when the next decoder vsync arrives */
/* I2C */ struct i2c_adapter i2c_adap; struct i2c_algo_bit_data i2c_algo; struct i2c_client i2c_client; int i2c_state; /* i2c bit state */ struct mutex i2c_bus_lock; /* lock i2c bus */
struct IR_i2c_init_data ir_i2c_init_data;
/* Program Index information */
u32 pgm_info_offset; /* start of pgm info in encoder memory */
u32 pgm_info_num; /* number of elements in the pgm cyclic buffer in encoder memory */
u32 pgm_info_write_idx; /* last index written by the card that was transferred to pgm_info[] */
u32 pgm_info_read_idx; /* last index in pgm_info read by the application */ struct v4l2_enc_idx_entry pgm_info[IVTV_MAX_PGM_INDEX]; /* filled from the pgm cyclic buffer on the card */
/* Miscellaneous */
u32 open_id; /* incremented each time an open occurs, is >= 1 */ int search_pack_header; /* 1 if ivtv_copy_buf_to_user() is scanning for a pack header (0xba) */ int speed; /* current playback speed setting */
u8 speed_mute_audio; /* 1 if audio should be muted when fast forward */
u64 mpg_data_received; /* number of bytes received from the MPEG stream */
u64 vbi_data_inserted; /* number of VBI bytes inserted into the MPEG stream */
u32 last_dec_timing[3]; /* cache last retrieved pts/scr/frame values */ unsignedlong dualwatch_jiffies;/* jiffies value of the previous dualwatch check */
u32 dualwatch_stereo_mode; /* current detected dualwatch stereo mode */
/* VBI state info */ struct vbi_info vbi; /* VBI-specific data */
/* OSD support */ unsignedlong osd_video_pbase; int osd_global_alpha_state; /* 1 = global alpha is on */ int osd_local_alpha_state; /* 1 = local alpha is on */ int osd_chroma_key_state; /* 1 = chroma-keying is on */
u8 osd_global_alpha; /* current global alpha */
u32 osd_chroma_key; /* current chroma key */ struct v4l2_rect osd_rect; /* current OSD position and size */ struct v4l2_rect main_rect; /* current Main window position and size */ struct osd_info *osd_info; /* ivtvfb private OSD info */ void (*ivtvfb_restore)(struct ivtv *itv); /* Used for a warm start */
};
/* First-open initialization: load firmware, init cx25840, etc. */ int ivtv_init_on_first_open(struct ivtv *itv);
/* Test if the current VBI mode is raw (1) or sliced (0) */ staticinlineint ivtv_raw_vbi(conststruct ivtv *itv)
{ return itv->vbi.in.type == V4L2_BUF_TYPE_VBI_CAPTURE;
}
/* This is a PCI post thing, where if the pci register is not read, then thewritedoesn'talwaystakeeffectrightaway.Byreadingbackthe registeranypendingPCIwriteswillbeperformed(inorder),andso youcanbesurethatthewritesareguaranteedtobedone.
Rarelyneeded,onlyinsometimingsensitivecases. Apparentlyifthisisnotdonesomemotherboardsseem tokillthefirmwareandgetintothebrokenstateuntilcomputeris
rebooted. */ #define write_sync(val, reg) \ do { writel(val, reg); readl(reg); } while (0)
/* Call the specified callback for all subdevs matching hw (if 0, then
match them all). Ignore any errors. */ #define ivtv_call_hw(itv, hw, o, f, args...) \
v4l2_device_mask_call_all(&(itv)->v4l2_dev, hw, o, f, ##args)
#define ivtv_call_all(itv, o, f, args...) ivtv_call_hw(itv, 0, o, f , ##args)
/* Call the specified callback for all subdevs matching hw (if 0, then matchthemall).Ifthecallbackreturnsanerrorotherthan0or
-ENOIOCTLCMD, then return with that error code. */ #define ivtv_call_hw_err(itv, hw, o, f, args...) \
v4l2_device_mask_call_until_err(&(itv)->v4l2_dev, hw, o, f, ##args)
#define ivtv_call_all_err(itv, o, f, args...) ivtv_call_hw_err(itv, 0, o, f , ##args)
#endif
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.29 Sekunden
(vorverarbeitet am 2026-10-11)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.