linux/drivers/media/pci/ivtv/ivtv-driver.h

/*
    ivtv driver internal defines and structures
    Copyright (C) 2003-2004  Kevin Thayer <nufan_wfk at yahoo.com>
    Copyright (C) 2004  Chris Kennedy <[email protected]>
    Copyright (C) 2005-2007  Hans Verkuil <[email protected]>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef IVTV_DRIVER_H
#define IVTV_DRIVER_H

#define pr_fmt(fmt)

/* Internal header for ivtv project:
 * Driver for the cx23415/6 chip.
 * Author: Kevin Thayer (nufan_wfk at yahoo.com)
 * License: GPL
 *
 * -----
 * MPG600/MPG160 support by  T.Adachi <[email protected]>
 *                      and Takeru KOMORIYA<[email protected]>
 *
 * AVerMedia M179 GPIO info by Chris Pinkham <[email protected]>
 *                using information provided by Jiun-Kuei Jung @ AVerMedia.
 */

#include <linux/module.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/sched/signal.h>
#include <linux/fs.h>
#include <linux/pci.h>
#include <linux/interrupt.h>
#include <linux/spinlock.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
#include <linux/list.h>
#include <linux/unistd.h>
#include <linux/pagemap.h>
#include <linux/scatterlist.h>
#include <linux/kthread.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <asm/byteorder.h>

#include <media/v4l2-common.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fh.h>
#include <media/tuner.h>
#include <media/drv-intf/cx2341x.h>
#include <media/i2c/ir-kbd-i2c.h>

#include <linux/ivtv.h>

/* Memory layout */
#define IVTV_ENCODER_OFFSET
#define IVTV_ENCODER_SIZE
#define IVTV_DECODER_OFFSET
#define IVTV_DECODER_SIZE
#define IVTV_REG_OFFSET
#define IVTV_REG_SIZE

/* Maximum ivtv driver instances. Some people have a huge number of
   capture cards, so set this to a high value. */
#define IVTV_MAX_CARDS

#define IVTV_ENC_STREAM_TYPE_MPG
#define IVTV_ENC_STREAM_TYPE_YUV
#define IVTV_ENC_STREAM_TYPE_VBI
#define IVTV_ENC_STREAM_TYPE_PCM
#define IVTV_ENC_STREAM_TYPE_RAD
#define IVTV_DEC_STREAM_TYPE_MPG
#define IVTV_DEC_STREAM_TYPE_VBI
#define IVTV_DEC_STREAM_TYPE_VOUT
#define IVTV_DEC_STREAM_TYPE_YUV
#define IVTV_MAX_STREAMS

#define IVTV_DMA_SG_OSD_ENT

/* DMA Registers */
#define IVTV_REG_DMAXFER
#define IVTV_REG_DMASTATUS
#define IVTV_REG_DECDMAADDR
#define IVTV_REG_ENCDMAADDR
#define IVTV_REG_DMACONTROL
#define IVTV_REG_IRQSTATUS
#define IVTV_REG_IRQMASK

/* Setup Registers */
#define IVTV_REG_ENC_SDRAM_REFRESH
#define IVTV_REG_ENC_SDRAM_PRECHARGE
#define IVTV_REG_DEC_SDRAM_REFRESH
#define IVTV_REG_DEC_SDRAM_PRECHARGE
#define IVTV_REG_VDM
#define IVTV_REG_AO
#define IVTV_REG_BYTEFLUSH
#define IVTV_REG_SPU
#define IVTV_REG_HW_BLOCKS
#define IVTV_REG_VPU
#define IVTV_REG_APU

/* Other registers */
#define IVTV_REG_DEC_LINE_FIELD

/* debugging */
extern int ivtv_debug;
#ifdef CONFIG_VIDEO_ADV_DEBUG
extern int ivtv_fw_debug;
#endif

#define IVTV_DBGFLG_WARN
#define IVTV_DBGFLG_INFO
#define IVTV_DBGFLG_MB
#define IVTV_DBGFLG_IOCTL
#define IVTV_DBGFLG_FILE
#define IVTV_DBGFLG_DMA
#define IVTV_DBGFLG_IRQ
#define IVTV_DBGFLG_DEC
#define IVTV_DBGFLG_YUV
#define IVTV_DBGFLG_I2C
/* Flag to turn on high volume debugging */
#define IVTV_DBGFLG_HIGHVOL

#define IVTV_DEBUG(x, type, fmt, args...)
#define IVTV_DEBUG_WARN(fmt, args...)
#define IVTV_DEBUG_INFO(fmt, args...)
#define IVTV_DEBUG_MB(fmt, args...)
#define IVTV_DEBUG_DMA(fmt, args...)
#define IVTV_DEBUG_IOCTL(fmt, args...)
#define IVTV_DEBUG_FILE(fmt, args...)
#define IVTV_DEBUG_I2C(fmt, args...)
#define IVTV_DEBUG_IRQ(fmt, args...)
#define IVTV_DEBUG_DEC(fmt, args...)
#define IVTV_DEBUG_YUV(fmt, args...)

#define IVTV_DEBUG_HIGH_VOL(x, type, fmt, args...)
#define IVTV_DEBUG_HI_WARN(fmt, args...)
#define IVTV_DEBUG_HI_INFO(fmt, args...)
#define IVTV_DEBUG_HI_MB(fmt, args...)
#define IVTV_DEBUG_HI_DMA(fmt, args...)
#define IVTV_DEBUG_HI_IOCTL(fmt, args...)
#define IVTV_DEBUG_HI_FILE(fmt, args...)
#define IVTV_DEBUG_HI_I2C(fmt, args...)
#define IVTV_DEBUG_HI_IRQ(fmt, args...)
#define IVTV_DEBUG_HI_DEC(fmt, args...)
#define IVTV_DEBUG_HI_YUV(fmt, args...)

/* Standard kernel messages */
#define IVTV_ERR(fmt, args...)
#define IVTV_WARN(fmt, args...)
#define IVTV_INFO(fmt, args...)

/* output modes (cx23415 only) */
#define OUT_NONE
#define OUT_MPG
#define OUT_YUV
#define OUT_UDMA_YUV
#define OUT_PASSTHROUGH

#define IVTV_MAX_PGM_INDEX

/* Default I2C SCL period in microseconds */
#define IVTV_DEFAULT_I2C_CLOCK_PERIOD

struct ivtv_options {};

/* ivtv-specific mailbox template */
struct ivtv_mailbox {};

struct ivtv_api_cache {};

struct ivtv_mailbox_data {};

/* per-buffer bit flags */
#define IVTV_F_B_NEED_BUF_SWAP

/* per-stream, s_flags */
#define IVTV_F_S_DMA_PENDING
#define IVTV_F_S_DMA_HAS_VBI
#define IVTV_F_S_NEEDS_DATA

#define IVTV_F_S_CLAIMED
#define IVTV_F_S_STREAMING
#define IVTV_F_S_INTERNAL_USE
#define IVTV_F_S_PASSTHROUGH
#define IVTV_F_S_STREAMOFF
#define IVTV_F_S_APPL_IO

#define IVTV_F_S_PIO_PENDING
#define IVTV_F_S_PIO_HAS_VBI

/* per-ivtv, i_flags */
#define IVTV_F_I_DMA
#define IVTV_F_I_UDMA
#define IVTV_F_I_UDMA_PENDING
#define IVTV_F_I_SPEED_CHANGE
#define IVTV_F_I_EOS
#define IVTV_F_I_RADIO_USER
#define IVTV_F_I_DIG_RST
#define IVTV_F_I_DEC_YUV
#define IVTV_F_I_UPDATE_CC
#define IVTV_F_I_UPDATE_WSS
#define IVTV_F_I_UPDATE_VPS
#define IVTV_F_I_DECODING_YUV
#define IVTV_F_I_ENC_PAUSED
#define IVTV_F_I_VALID_DEC_TIMINGS
#define IVTV_F_I_HAVE_WORK
#define IVTV_F_I_WORK_HANDLER_VBI
#define IVTV_F_I_WORK_HANDLER_YUV
#define IVTV_F_I_WORK_HANDLER_PIO
#define IVTV_F_I_PIO
#define IVTV_F_I_DEC_PAUSED
#define IVTV_F_I_INITED
#define IVTV_F_I_FAILED
#define IVTV_F_I_WORK_HANDLER_PCM

/* Event notifications */
#define IVTV_F_I_EV_DEC_STOPPED
#define IVTV_F_I_EV_VSYNC
#define IVTV_F_I_EV_VSYNC_FIELD
#define IVTV_F_I_EV_VSYNC_ENABLED

/* Scatter-Gather array element, used in DMA transfers */
struct ivtv_sg_element {};

struct ivtv_sg_host_element {};

struct ivtv_user_dma {};

struct ivtv_dma_page_info {};

struct ivtv_buffer {};

struct ivtv_queue {};

struct ivtv;				/* forward reference */

struct ivtv_stream {};

struct ivtv_open_id {};

static inline struct ivtv_open_id *fh2id(struct v4l2_fh *fh)
{}

struct yuv_frame_info
{};

#define IVTV_YUV_MODE_INTERLACED
#define IVTV_YUV_MODE_PROGRESSIVE
#define IVTV_YUV_MODE_AUTO
#define IVTV_YUV_MODE_MASK

#define IVTV_YUV_SYNC_EVEN
#define IVTV_YUV_SYNC_ODD
#define IVTV_YUV_SYNC_MASK

#define IVTV_YUV_BUFFERS

struct yuv_playback_info
{};

#define IVTV_VBI_FRAMES

/* VBI data */
struct vbi_cc {};

struct vbi_vps {};

struct vbi_info {};

/* forward declaration of struct defined in ivtv-cards.h */
struct ivtv_card;

/* Struct to hold info about ivtv cards */
struct ivtv {};

static inline struct ivtv *to_ivtv(struct v4l2_device *v4l2_dev)
{}

/* ivtv extensions to be loaded */
extern int (*ivtv_ext_init)(struct ivtv *);

/* Globals */
extern int ivtv_first_minor;

/*==============Prototypes==================*/

/* Hardware/IRQ */
void ivtv_set_irq_mask(struct ivtv *itv, u32 mask);
void ivtv_clear_irq_mask(struct ivtv *itv, u32 mask);

/* try to set output mode, return current mode. */
int ivtv_set_output_mode(struct ivtv *itv, int mode);

/* return current output stream based on current mode */
struct ivtv_stream *ivtv_get_output_stream(struct ivtv *itv);

/* Return non-zero if a signal is pending */
int ivtv_msleep_timeout(unsigned int msecs, int intr);

/* Wait on queue, returns -EINTR if interrupted */
int ivtv_waitq(wait_queue_head_t *waitq);

/* Read Hauppauge eeprom */
struct tveeprom; /* forward reference */
void ivtv_read_eeprom(struct ivtv *itv, struct tveeprom *tv);

/* 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) */
static inline int ivtv_raw_vbi(const struct ivtv *itv)
{}

/* This is a PCI post thing, where if the pci register is not read, then
   the write doesn't always take effect right away. By reading back the
   register any pending PCI writes will be performed (in order), and so
   you can be sure that the writes are guaranteed to be done.

   Rarely needed, only in some timing sensitive cases.
   Apparently if this is not done some motherboards seem
   to kill the firmware and get into the broken state until computer is
   rebooted. */
#define write_sync(val, reg)

#define read_reg(reg)
#define write_reg(val, reg)
#define write_reg_sync(val, reg)

#define read_enc(addr)
#define write_enc(val, addr)
#define write_enc_sync(val, addr)

#define read_dec(addr)
#define write_dec(val, addr)
#define write_dec_sync(val, addr)

/* 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...)

#define ivtv_call_all(itv, o, f, args...)

/* Call the specified callback for all subdevs matching hw (if 0, then
   match them all). If the callback returns an error other than 0 or
   -ENOIOCTLCMD, then return with that error code. */
#define ivtv_call_hw_err(itv, hw, o, f, args...)

#define ivtv_call_all_err(itv, o, f, args...)

#endif