4 #include <linux/interrupt.h>
5 #include <linux/socket.h>
6 #include <linux/netdevice.h>
8 #include <linux/input.h>
10 #include <linux/dvb/video.h>
11 #include <linux/dvb/audio.h>
12 #include <linux/dvb/dmx.h>
13 #include <linux/dvb/ca.h>
14 #include <linux/dvb/osd.h>
15 #include <linux/dvb/net.h>
16 #include <linux/mutex.h>
20 #include "dvb_demux.h"
22 #include "dvb_filter.h"
24 #include "dvb_ringbuffer.h"
25 #include "dvb_frontend.h"
34 #include <media/saa7146_vv.h>
37 #define ANALOG_TUNER_VES1820 1
38 #define ANALOG_TUNER_STV0297 2
40 extern int av7110_debug
;
42 #define dprintk(level,args...) \
43 do { if ((av7110_debug & level)) { printk("dvb-ttpci: %s(): ", __FUNCTION__); printk(args); } } while (0)
47 enum {AV_PES_STREAM
, PS_STREAM
, TS_STREAM
, PES_STREAM
};
54 struct dvb_demux_feed
*feed
;
57 /* video MPEG decoder events: */
58 /* (code copied from dvb_frontend.c, should maybe be factored out...) */
59 #define MAX_VIDEO_EVENT 8
60 struct dvb_video_events
{
61 struct video_event events
[MAX_VIDEO_EVENT
];
65 wait_queue_head_t wait_queue
;
72 /* infrared remote control */
75 struct input_dev
*input_dev
;
77 struct timer_list keyup_timer
;
78 struct tasklet_struct ir_tasklet
;
79 void (*ir_handler
)(struct av7110
*av7110
, u32 ircom
);
87 u8 delay_timer_finished
;
91 /* place to store all the necessary device information */
96 struct dvb_device dvb_dev
;
97 struct dvb_net dvb_net
;
99 struct video_device
*v4l_dev
;
100 struct video_device
*vbi_dev
;
102 struct saa7146_dev
*dev
;
104 struct i2c_adapter i2c_adap
;
108 /* support for analog module of dvb-c */
109 int analog_tuner_flags
;
113 struct tasklet_struct debi_tasklet
;
114 struct tasklet_struct gpio_tasklet
;
116 int adac_type
; /* audio DAC type */
117 #define DVB_ADAC_TI 0
118 #define DVB_ADAC_CRYSTAL 1
119 #define DVB_ADAC_MSP34x0 2
120 #define DVB_ADAC_MSP34x5 3
121 #define DVB_ADAC_NONE -1
126 void *iobuf
; /* memory for all buffers */
127 struct dvb_ringbuffer avout
; /* buffer for video or A/V mux */
128 #define AVOUTLEN (128*1024)
129 struct dvb_ringbuffer aout
; /* buffer for audio */
130 #define AOUTLEN (64*1024)
132 #define BMPLEN (8*32768+1024)
134 /* bitmap buffers and states */
138 volatile int bmp_state
;
140 #define BMP_LOADING 1
142 wait_queue_head_t bmpq
;
145 /* DEBI and polled command interface */
148 struct mutex dcomlock
;
149 volatile int debitype
;
150 volatile int debilen
;
153 /* Recording and playback flags */
165 int osdwin
; /* currently active window */
167 struct mutex osd_mutex
;
171 ca_slot_info_t ci_slot
[2];
174 struct dmxdev dmxdev
;
175 struct dvb_demux demux
;
177 struct dmx_frontend hw_frontend
;
178 struct dmx_frontend mem_frontend
;
180 /* for budget mode demux1 */
181 struct dmxdev dmxdev1
;
182 struct dvb_demux demux1
;
183 struct dvb_net dvb_net1
;
184 spinlock_t feedlock1
;
188 unsigned char *grabbing
;
189 struct saa7146_pgtable pt
;
190 struct tasklet_struct vpe_tasklet
;
193 struct mutex pid_mutex
;
196 struct video_status videostate
;
202 #define TRICK_FREEZE 3
203 struct audio_status audiostate
;
205 struct dvb_demux_filter
*handle2filter
[32];
206 struct av7110_p2t p2t_filter
[MAXFILT
];
207 struct dvb_filter_pes2ts p2t
[2];
208 struct ipack ipack
[2];
226 struct task_struct
*arm_thread
;
227 wait_queue_head_t arm_wait
;
233 u16 pids
[DMX_PES_OTHER
];
235 struct dvb_ringbuffer ci_rbuffer
;
236 struct dvb_ringbuffer ci_wbuffer
;
238 struct audio_mixer mixer
;
240 struct dvb_adapter dvb_adapter
;
241 struct dvb_device
*video_dev
;
242 struct dvb_device
*audio_dev
;
243 struct dvb_device
*ca_dev
;
244 struct dvb_device
*osd_dev
;
246 struct dvb_video_events video_events
;
247 video_size_t video_size
;
255 unsigned char *bin_fw
;
256 unsigned long size_fw
;
258 unsigned char *bin_dpram
;
259 unsigned long size_dpram
;
261 unsigned char *bin_root
;
262 unsigned long size_root
;
264 struct dvb_frontend
* fe
;
265 fe_status_t fe_status
;
268 void (*recover
)(struct av7110
* av7110
);
269 struct dvb_frontend_parameters saved_fe_params
;
270 fe_sec_voltage_t saved_voltage
;
271 fe_sec_tone_mode_t saved_tone
;
272 struct dvb_diseqc_master_cmd saved_master_cmd
;
273 fe_sec_mini_cmd_t saved_minicmd
;
275 int (*fe_init
)(struct dvb_frontend
* fe
);
276 int (*fe_read_status
)(struct dvb_frontend
* fe
, fe_status_t
* status
);
277 int (*fe_diseqc_reset_overload
)(struct dvb_frontend
* fe
);
278 int (*fe_diseqc_send_master_cmd
)(struct dvb_frontend
* fe
, struct dvb_diseqc_master_cmd
* cmd
);
279 int (*fe_diseqc_send_burst
)(struct dvb_frontend
* fe
, fe_sec_mini_cmd_t minicmd
);
280 int (*fe_set_tone
)(struct dvb_frontend
* fe
, fe_sec_tone_mode_t tone
);
281 int (*fe_set_voltage
)(struct dvb_frontend
* fe
, fe_sec_voltage_t voltage
);
282 int (*fe_dishnetwork_send_legacy_command
)(struct dvb_frontend
* fe
, unsigned long cmd
);
283 int (*fe_set_frontend
)(struct dvb_frontend
* fe
, struct dvb_frontend_parameters
* params
);
287 extern int ChangePIDs(struct av7110
*av7110
, u16 vpid
, u16 apid
, u16 ttpid
,
288 u16 subpid
, u16 pcrpid
);
290 extern int av7110_check_ir_config(struct av7110
*av7110
, int force
);
291 extern int av7110_ir_init(struct av7110
*av7110
);
292 extern void av7110_ir_exit(struct av7110
*av7110
);
294 /* msp3400 i2c subaddresses */
295 #define MSP_WR_DEM 0x10
296 #define MSP_RD_DEM 0x11
297 #define MSP_WR_DSP 0x12
298 #define MSP_RD_DSP 0x13
300 extern int i2c_writereg(struct av7110
*av7110
, u8 id
, u8 reg
, u8 val
);
301 extern u8
i2c_readreg(struct av7110
*av7110
, u8 id
, u8 reg
);
302 extern int msp_writereg(struct av7110
*av7110
, u8 dev
, u16 reg
, u16 val
);
305 extern int av7110_init_analog_module(struct av7110
*av7110
);
306 extern int av7110_init_v4l(struct av7110
*av7110
);
307 extern int av7110_exit_v4l(struct av7110
*av7110
);
309 #endif /* _AV7110_H_ */