4 #include <linux/interrupt.h>
5 #include <linux/socket.h>
6 #include <linux/netdevice.h>
10 #include <linux/devfs_fs_kernel.h>
13 #include <linux/dvb/video.h>
14 #include <linux/dvb/audio.h>
15 #include <linux/dvb/dmx.h>
16 #include <linux/dvb/ca.h>
17 #include <linux/dvb/osd.h>
18 #include <linux/dvb/net.h>
22 #include "dvb_demux.h"
24 #include "dvb_filter.h"
26 #include "dvb_ringbuffer.h"
27 #include "dvb_frontend.h"
36 #include <media/saa7146_vv.h>
39 #define ANALOG_TUNER_VES1820 1
40 #define ANALOG_TUNER_STV0297 2
41 #define ANALOG_TUNER_VBI 0x100
43 extern int av7110_debug;
45 #define dprintk(level,args...) \
46 do { if ((av7110_debug & level)) { printk("dvb-ttpci: %s(): ", __FUNCTION__); printk(args); } } while (0)
50 enum {AV_PES_STREAM, PS_STREAM, TS_STREAM, PES_STREAM};
57 struct dvb_demux_feed *feed;
60 /* video MPEG decoder events: */
61 /* (code copied from dvb_frontend.c, should maybe be factored out...) */
62 #define MAX_VIDEO_EVENT 8
63 struct dvb_video_events {
64 struct video_event events[MAX_VIDEO_EVENT];
68 wait_queue_head_t wait_queue;
73 /* place to store all the necessary device information */
78 struct dvb_device dvb_dev;
79 struct dvb_net dvb_net;
81 struct video_device *v4l_dev;
82 struct video_device *vbi_dev;
84 struct saa7146_dev *dev;
86 struct i2c_adapter i2c_adap;
90 /* support for analog module of dvb-c */
91 int analog_tuner_flags;
95 struct tasklet_struct debi_tasklet;
96 struct tasklet_struct gpio_tasklet;
98 int adac_type; /* audio DAC type */
100 #define DVB_ADAC_CRYSTAL 1
101 #define DVB_ADAC_MSP34x0 2
102 #define DVB_ADAC_MSP34x5 3
103 #define DVB_ADAC_NONE -1
108 void *iobuf; /* memory for all buffers */
109 struct dvb_ringbuffer avout; /* buffer for video or A/V mux */
110 #define AVOUTLEN (128*1024)
111 struct dvb_ringbuffer aout; /* buffer for audio */
112 #define AOUTLEN (64*1024)
114 #define BMPLEN (8*32768+1024)
116 /* bitmap buffers and states */
120 volatile int bmp_state;
122 #define BMP_LOADING 1
124 wait_queue_head_t bmpq;
127 /* DEBI and polled command interface */
130 struct semaphore dcomlock;
131 volatile int debitype;
132 volatile int debilen;
135 /* Recording and playback flags */
147 int osdwin; /* currently active window */
149 struct semaphore osd_sema;
153 ca_slot_info_t ci_slot[2];
156 struct dmxdev dmxdev;
157 struct dvb_demux demux;
159 struct dmx_frontend hw_frontend;
160 struct dmx_frontend mem_frontend;
162 /* for budget mode demux1 */
163 struct dmxdev dmxdev1;
164 struct dvb_demux demux1;
165 struct dvb_net dvb_net1;
166 spinlock_t feedlock1;
170 unsigned char *grabbing;
171 struct saa7146_pgtable pt;
172 struct tasklet_struct vpe_tasklet;
175 struct semaphore pid_mutex;
178 struct video_status videostate;
184 #define TRICK_FREEZE 3
185 struct audio_status audiostate;
187 struct dvb_demux_filter *handle2filter[32];
188 struct av7110_p2t p2t_filter[MAXFILT];
189 struct dvb_filter_pes2ts p2t[2];
190 struct ipack ipack[2];
208 struct task_struct *arm_thread;
209 wait_queue_head_t arm_wait;
216 u16 pids[DMX_PES_OTHER];
218 struct dvb_ringbuffer ci_rbuffer;
219 struct dvb_ringbuffer ci_wbuffer;
221 struct audio_mixer mixer;
223 struct dvb_adapter dvb_adapter;
224 struct dvb_device *video_dev;
225 struct dvb_device *audio_dev;
226 struct dvb_device *ca_dev;
227 struct dvb_device *osd_dev;
229 struct dvb_video_events video_events;
230 video_size_t video_size;
237 void (*ir_handler)(struct av7110 *av7110, u32 ircom);
238 struct tasklet_struct ir_tasklet;
241 unsigned char *bin_fw;
242 unsigned long size_fw;
244 unsigned char *bin_dpram;
245 unsigned long size_dpram;
247 unsigned char *bin_root;
248 unsigned long size_root;
250 struct dvb_frontend* fe;
251 fe_status_t fe_status;
254 void (*recover)(struct av7110* av7110);
255 struct dvb_frontend_parameters saved_fe_params;
256 fe_sec_voltage_t saved_voltage;
257 fe_sec_tone_mode_t saved_tone;
258 struct dvb_diseqc_master_cmd saved_master_cmd;
259 fe_sec_mini_cmd_t saved_minicmd;
261 int (*fe_init)(struct dvb_frontend* fe);
262 int (*fe_read_status)(struct dvb_frontend* fe, fe_status_t* status);
263 int (*fe_diseqc_reset_overload)(struct dvb_frontend* fe);
264 int (*fe_diseqc_send_master_cmd)(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd* cmd);
265 int (*fe_diseqc_send_burst)(struct dvb_frontend* fe, fe_sec_mini_cmd_t minicmd);
266 int (*fe_set_tone)(struct dvb_frontend* fe, fe_sec_tone_mode_t tone);
267 int (*fe_set_voltage)(struct dvb_frontend* fe, fe_sec_voltage_t voltage);
268 int (*fe_dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned long cmd);
269 int (*fe_set_frontend)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
273 extern int ChangePIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid,
274 u16 subpid, u16 pcrpid);
276 extern int av7110_setup_irc_config (struct av7110 *av7110, u32 ir_config);
278 extern int av7110_ir_init(struct av7110 *av7110);
279 extern void av7110_ir_exit(struct av7110 *av7110);
281 /* msp3400 i2c subaddresses */
282 #define MSP_WR_DEM 0x10
283 #define MSP_RD_DEM 0x11
284 #define MSP_WR_DSP 0x12
285 #define MSP_RD_DSP 0x13
287 extern int i2c_writereg(struct av7110 *av7110, u8 id, u8 reg, u8 val);
288 extern u8 i2c_readreg(struct av7110 *av7110, u8 id, u8 reg);
289 extern int msp_writereg(struct av7110 *av7110, u8 dev, u16 reg, u16 val);
292 extern int av7110_init_analog_module(struct av7110 *av7110);
293 extern int av7110_init_v4l(struct av7110 *av7110);
294 extern int av7110_exit_v4l(struct av7110 *av7110);
296 #endif /* _AV7110_H_ */