0001
0002
0003
0004
0005
0006
0007 #ifndef __FLEXCOP_COMMON_H__
0008 #define __FLEXCOP_COMMON_H__
0009
0010 #include <linux/interrupt.h>
0011 #include <linux/pci.h>
0012 #include <linux/mutex.h>
0013
0014 #include "flexcop-reg.h"
0015
0016 #include <media/dmxdev.h>
0017 #include <media/dvb_demux.h>
0018 #include <media/dvb_net.h>
0019 #include <media/dvb_frontend.h>
0020
0021 #define FC_MAX_FEED 256
0022
0023 #ifndef FC_LOG_PREFIX
0024 #warning please define a log prefix for your file, using a default one
0025 #define FC_LOG_PREFIX "b2c2-undef"
0026 #endif
0027
0028
0029 #undef err
0030 #define err(format, arg...) \
0031 printk(KERN_ERR FC_LOG_PREFIX ": " format "\n" , ## arg)
0032 #undef info
0033 #define info(format, arg...) \
0034 printk(KERN_INFO FC_LOG_PREFIX ": " format "\n" , ## arg)
0035 #undef warn
0036 #define warn(format, arg...) \
0037 printk(KERN_WARNING FC_LOG_PREFIX ": " format "\n" , ## arg)
0038
0039 struct flexcop_dma {
0040 struct pci_dev *pdev;
0041
0042 u8 *cpu_addr0;
0043 dma_addr_t dma_addr0;
0044 u8 *cpu_addr1;
0045 dma_addr_t dma_addr1;
0046 u32 size;
0047 };
0048
0049 struct flexcop_i2c_adapter {
0050 struct flexcop_device *fc;
0051 struct i2c_adapter i2c_adap;
0052
0053 u8 no_base_addr;
0054 flexcop_i2c_port_t port;
0055 };
0056
0057
0058
0059
0060 struct flexcop_device {
0061
0062 struct device *dev;
0063
0064 #define FC_STATE_DVB_INIT 0x01
0065 #define FC_STATE_I2C_INIT 0x02
0066 #define FC_STATE_FE_INIT 0x04
0067 int init_state;
0068
0069
0070 int has_32_hw_pid_filter;
0071 flexcop_revision_t rev;
0072 flexcop_device_type_t dev_type;
0073 flexcop_bus_t bus_type;
0074
0075
0076 struct dvb_adapter dvb_adapter;
0077 struct dvb_frontend *fe;
0078 struct dvb_net dvbnet;
0079 struct dvb_demux demux;
0080 struct dmxdev dmxdev;
0081 struct dmx_frontend hw_frontend;
0082 struct dmx_frontend mem_frontend;
0083 int (*fe_sleep) (struct dvb_frontend *);
0084
0085 struct flexcop_i2c_adapter fc_i2c_adap[3];
0086 struct mutex i2c_mutex;
0087 struct module *owner;
0088
0089
0090 int extra_feedcount;
0091 int feedcount;
0092 int pid_filtering;
0093 int fullts_streaming_state;
0094 int skip_6_hw_pid_filter;
0095
0096
0097 flexcop_ibi_value(*read_ibi_reg) (struct flexcop_device *,
0098 flexcop_ibi_register);
0099 int (*write_ibi_reg) (struct flexcop_device *,
0100 flexcop_ibi_register, flexcop_ibi_value);
0101 int (*i2c_request) (struct flexcop_i2c_adapter *,
0102 flexcop_access_op_t, u8 chipaddr, u8 addr, u8 *buf, u16 len);
0103 int (*stream_control) (struct flexcop_device *, int);
0104 int (*get_mac_addr) (struct flexcop_device *fc, int extended);
0105 void *bus_specific;
0106 };
0107
0108
0109
0110
0111 void flexcop_pass_dmx_data(struct flexcop_device *fc, u8 *buf, u32 len);
0112 void flexcop_pass_dmx_packets(struct flexcop_device *fc, u8 *buf, u32 no);
0113
0114 struct flexcop_device *flexcop_device_kmalloc(size_t bus_specific_len);
0115 void flexcop_device_kfree(struct flexcop_device *);
0116
0117 int flexcop_device_initialize(struct flexcop_device *);
0118 void flexcop_device_exit(struct flexcop_device *fc);
0119 void flexcop_reset_block_300(struct flexcop_device *fc);
0120
0121
0122 int flexcop_dma_allocate(struct pci_dev *pdev,
0123 struct flexcop_dma *dma, u32 size);
0124 void flexcop_dma_free(struct flexcop_dma *dma);
0125
0126 int flexcop_dma_control_timer_irq(struct flexcop_device *fc,
0127 flexcop_dma_index_t no, int onoff);
0128 int flexcop_dma_control_size_irq(struct flexcop_device *fc,
0129 flexcop_dma_index_t no, int onoff);
0130 int flexcop_dma_config(struct flexcop_device *fc, struct flexcop_dma *dma,
0131 flexcop_dma_index_t dma_idx);
0132 int flexcop_dma_xfer_control(struct flexcop_device *fc,
0133 flexcop_dma_index_t dma_idx, flexcop_dma_addr_index_t index,
0134 int onoff);
0135 int flexcop_dma_config_timer(struct flexcop_device *fc,
0136 flexcop_dma_index_t dma_idx, u8 cycles);
0137
0138
0139
0140 int flexcop_eeprom_check_mac_addr(struct flexcop_device *fc, int extended);
0141
0142
0143
0144
0145
0146
0147 int flexcop_i2c_request(struct flexcop_i2c_adapter*, flexcop_access_op_t,
0148 u8 chipaddr, u8 addr, u8 *buf, u16 len);
0149
0150
0151 int flexcop_sram_set_dest(struct flexcop_device *fc, flexcop_sram_dest_t dest,
0152 flexcop_sram_dest_target_t target);
0153 void flexcop_wan_set_speed(struct flexcop_device *fc, flexcop_wan_speed_t s);
0154 void flexcop_sram_ctrl(struct flexcop_device *fc,
0155 int usb_wan, int sramdma, int maximumfill);
0156
0157
0158
0159 int flexcop_frontend_init(struct flexcop_device *fc);
0160 void flexcop_frontend_exit(struct flexcop_device *fc);
0161
0162
0163 int flexcop_i2c_init(struct flexcop_device *fc);
0164 void flexcop_i2c_exit(struct flexcop_device *fc);
0165
0166
0167 int flexcop_sram_init(struct flexcop_device *fc);
0168
0169
0170 void flexcop_determine_revision(struct flexcop_device *fc);
0171 void flexcop_device_name(struct flexcop_device *fc,
0172 const char *prefix, const char *suffix);
0173 void flexcop_dump_reg(struct flexcop_device *fc,
0174 flexcop_ibi_register reg, int num);
0175
0176
0177 int flexcop_pid_feed_control(struct flexcop_device *fc,
0178 struct dvb_demux_feed *dvbdmxfeed, int onoff);
0179 void flexcop_hw_filter_init(struct flexcop_device *fc);
0180
0181 void flexcop_smc_ctrl(struct flexcop_device *fc, int onoff);
0182
0183 void flexcop_set_mac_filter(struct flexcop_device *fc, u8 mac[6]);
0184 void flexcop_mac_filter_ctrl(struct flexcop_device *fc, int onoff);
0185
0186 #endif