Path: blob/master/drivers/media/dvb/b2c2/flexcop-common.h
15111 views
/*1* Linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III2* flexcop-common.h - common header file for device-specific source files3* see flexcop.c for copyright information4*/5#ifndef __FLEXCOP_COMMON_H__6#define __FLEXCOP_COMMON_H__78#include <linux/pci.h>9#include <linux/mutex.h>1011#include "flexcop-reg.h"1213#include "dmxdev.h"14#include "dvb_demux.h"15#include "dvb_filter.h"16#include "dvb_net.h"17#include "dvb_frontend.h"1819#define FC_MAX_FEED 2562021#ifndef FC_LOG_PREFIX22#warning please define a log prefix for your file, using a default one23#define FC_LOG_PREFIX "b2c2-undef"24#endif2526/* Steal from usb.h */27#undef err28#define err(format, arg...) \29printk(KERN_ERR FC_LOG_PREFIX ": " format "\n" , ## arg)30#undef info31#define info(format, arg...) \32printk(KERN_INFO FC_LOG_PREFIX ": " format "\n" , ## arg)33#undef warn34#define warn(format, arg...) \35printk(KERN_WARNING FC_LOG_PREFIX ": " format "\n" , ## arg)3637struct flexcop_dma {38struct pci_dev *pdev;3940u8 *cpu_addr0;41dma_addr_t dma_addr0;42u8 *cpu_addr1;43dma_addr_t dma_addr1;44u32 size; /* size of each address in bytes */45};4647struct flexcop_i2c_adapter {48struct flexcop_device *fc;49struct i2c_adapter i2c_adap;5051u8 no_base_addr;52flexcop_i2c_port_t port;53};5455/* Control structure for data definitions that are common to56* the B2C2-based PCI and USB devices.57*/58struct flexcop_device {59/* general */60struct device *dev; /* for firmware_class */6162#define FC_STATE_DVB_INIT 0x0163#define FC_STATE_I2C_INIT 0x0264#define FC_STATE_FE_INIT 0x0465int init_state;6667/* device information */68int has_32_hw_pid_filter;69flexcop_revision_t rev;70flexcop_device_type_t dev_type;71flexcop_bus_t bus_type;7273/* dvb stuff */74struct dvb_adapter dvb_adapter;75struct dvb_frontend *fe;76struct dvb_net dvbnet;77struct dvb_demux demux;78struct dmxdev dmxdev;79struct dmx_frontend hw_frontend;80struct dmx_frontend mem_frontend;81int (*fe_sleep) (struct dvb_frontend *);8283struct flexcop_i2c_adapter fc_i2c_adap[3];84struct mutex i2c_mutex;85struct module *owner;8687/* options and status */88int extra_feedcount;89int feedcount;90int pid_filtering;91int fullts_streaming_state;9293/* bus specific callbacks */94flexcop_ibi_value(*read_ibi_reg) (struct flexcop_device *,95flexcop_ibi_register);96int (*write_ibi_reg) (struct flexcop_device *,97flexcop_ibi_register, flexcop_ibi_value);98int (*i2c_request) (struct flexcop_i2c_adapter *,99flexcop_access_op_t, u8 chipaddr, u8 addr, u8 *buf, u16 len);100int (*stream_control) (struct flexcop_device *, int);101int (*get_mac_addr) (struct flexcop_device *fc, int extended);102void *bus_specific;103};104105/* exported prototypes */106107/* from flexcop.c */108void flexcop_pass_dmx_data(struct flexcop_device *fc, u8 *buf, u32 len);109void flexcop_pass_dmx_packets(struct flexcop_device *fc, u8 *buf, u32 no);110111struct flexcop_device *flexcop_device_kmalloc(size_t bus_specific_len);112void flexcop_device_kfree(struct flexcop_device *);113114int flexcop_device_initialize(struct flexcop_device *);115void flexcop_device_exit(struct flexcop_device *fc);116void flexcop_reset_block_300(struct flexcop_device *fc);117118/* from flexcop-dma.c */119int flexcop_dma_allocate(struct pci_dev *pdev,120struct flexcop_dma *dma, u32 size);121void flexcop_dma_free(struct flexcop_dma *dma);122123int flexcop_dma_control_timer_irq(struct flexcop_device *fc,124flexcop_dma_index_t no, int onoff);125int flexcop_dma_control_size_irq(struct flexcop_device *fc,126flexcop_dma_index_t no, int onoff);127int flexcop_dma_config(struct flexcop_device *fc, struct flexcop_dma *dma,128flexcop_dma_index_t dma_idx);129int flexcop_dma_xfer_control(struct flexcop_device *fc,130flexcop_dma_index_t dma_idx, flexcop_dma_addr_index_t index,131int onoff);132int flexcop_dma_config_timer(struct flexcop_device *fc,133flexcop_dma_index_t dma_idx, u8 cycles);134135/* from flexcop-eeprom.c */136/* the PCI part uses this call to get the MAC address, the USB part has its own */137int flexcop_eeprom_check_mac_addr(struct flexcop_device *fc, int extended);138139/* from flexcop-i2c.c */140/* the PCI part uses this a i2c_request callback, whereas the usb part has its own141* one. We have it in flexcop-i2c.c, because it is going via the actual142* I2C-channel of the flexcop.143*/144int flexcop_i2c_request(struct flexcop_i2c_adapter*, flexcop_access_op_t,145u8 chipaddr, u8 addr, u8 *buf, u16 len);146147/* from flexcop-sram.c */148int flexcop_sram_set_dest(struct flexcop_device *fc, flexcop_sram_dest_t dest,149flexcop_sram_dest_target_t target);150void flexcop_wan_set_speed(struct flexcop_device *fc, flexcop_wan_speed_t s);151void flexcop_sram_ctrl(struct flexcop_device *fc,152int usb_wan, int sramdma, int maximumfill);153154/* global prototypes for the flexcop-chip */155/* from flexcop-fe-tuner.c */156int flexcop_frontend_init(struct flexcop_device *fc);157void flexcop_frontend_exit(struct flexcop_device *fc);158159/* from flexcop-i2c.c */160int flexcop_i2c_init(struct flexcop_device *fc);161void flexcop_i2c_exit(struct flexcop_device *fc);162163/* from flexcop-sram.c */164int flexcop_sram_init(struct flexcop_device *fc);165166/* from flexcop-misc.c */167void flexcop_determine_revision(struct flexcop_device *fc);168void flexcop_device_name(struct flexcop_device *fc,169const char *prefix, const char *suffix);170void flexcop_dump_reg(struct flexcop_device *fc,171flexcop_ibi_register reg, int num);172173/* from flexcop-hw-filter.c */174int flexcop_pid_feed_control(struct flexcop_device *fc,175struct dvb_demux_feed *dvbdmxfeed, int onoff);176void flexcop_hw_filter_init(struct flexcop_device *fc);177178void flexcop_smc_ctrl(struct flexcop_device *fc, int onoff);179180void flexcop_set_mac_filter(struct flexcop_device *fc, u8 mac[6]);181void flexcop_mac_filter_ctrl(struct flexcop_device *fc, int onoff);182183#endif184185186