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
};
49 enum av7110_video_mode
{
50 AV7110_VIDEO_MODE_PAL
= 0,
51 AV7110_VIDEO_MODE_NTSC
= 1
59 struct dvb_demux_feed
*feed
;
62 /* video MPEG decoder events: */
63 /* (code copied from dvb_frontend.c, should maybe be factored out...) */
64 #define MAX_VIDEO_EVENT 8
65 struct dvb_video_events
{
66 struct video_event events
[MAX_VIDEO_EVENT
];
70 wait_queue_head_t wait_queue
;
77 /* infrared remote control */
80 struct input_dev
*input_dev
;
82 struct timer_list keyup_timer
;
83 struct tasklet_struct ir_tasklet
;
84 void (*ir_handler
)(struct av7110
*av7110
, u32 ircom
);
92 u8 delay_timer_finished
;
96 /* place to store all the necessary device information */
101 struct dvb_device dvb_dev
;
102 struct dvb_net dvb_net
;
104 struct video_device
*v4l_dev
;
105 struct video_device
*vbi_dev
;
107 struct saa7146_dev
*dev
;
109 struct i2c_adapter i2c_adap
;
113 /* support for analog module of dvb-c */
114 int analog_tuner_flags
;
118 struct tasklet_struct debi_tasklet
;
119 struct tasklet_struct gpio_tasklet
;
121 int adac_type
; /* audio DAC type */
122 #define DVB_ADAC_TI 0
123 #define DVB_ADAC_CRYSTAL 1
124 #define DVB_ADAC_MSP34x0 2
125 #define DVB_ADAC_MSP34x5 3
126 #define DVB_ADAC_NONE -1
131 void *iobuf
; /* memory for all buffers */
132 struct dvb_ringbuffer avout
; /* buffer for video or A/V mux */
133 #define AVOUTLEN (128*1024)
134 struct dvb_ringbuffer aout
; /* buffer for audio */
135 #define AOUTLEN (64*1024)
137 #define BMPLEN (8*32768+1024)
139 /* bitmap buffers and states */
143 volatile int bmp_state
;
145 #define BMP_LOADING 1
147 wait_queue_head_t bmpq
;
150 /* DEBI and polled command interface */
153 struct mutex dcomlock
;
154 volatile int debitype
;
155 volatile int debilen
;
158 /* Recording and playback flags */
170 int osdwin
; /* currently active window */
172 struct mutex osd_mutex
;
176 ca_slot_info_t ci_slot
[2];
178 enum av7110_video_mode vidmode
;
179 struct dmxdev dmxdev
;
180 struct dvb_demux demux
;
182 struct dmx_frontend hw_frontend
;
183 struct dmx_frontend mem_frontend
;
185 /* for budget mode demux1 */
186 struct dmxdev dmxdev1
;
187 struct dvb_demux demux1
;
188 struct dvb_net dvb_net1
;
189 spinlock_t feedlock1
;
193 unsigned char *grabbing
;
194 struct saa7146_pgtable pt
;
195 struct tasklet_struct vpe_tasklet
;
198 struct mutex pid_mutex
;
201 struct video_status videostate
;
208 #define TRICK_FREEZE 3
209 struct audio_status audiostate
;
211 struct dvb_demux_filter
*handle2filter
[32];
212 struct av7110_p2t p2t_filter
[MAXFILT
];
213 struct dvb_filter_pes2ts p2t
[2];
214 struct ipack ipack
[2];
232 struct task_struct
*arm_thread
;
233 wait_queue_head_t arm_wait
;
239 u16 pids
[DMX_PES_OTHER
];
241 struct dvb_ringbuffer ci_rbuffer
;
242 struct dvb_ringbuffer ci_wbuffer
;
244 struct audio_mixer mixer
;
246 struct dvb_adapter dvb_adapter
;
247 struct dvb_device
*video_dev
;
248 struct dvb_device
*audio_dev
;
249 struct dvb_device
*ca_dev
;
250 struct dvb_device
*osd_dev
;
252 struct dvb_video_events video_events
;
253 video_size_t video_size
;
261 unsigned char *bin_fw
;
262 unsigned long size_fw
;
264 unsigned char *bin_dpram
;
265 unsigned long size_dpram
;
267 unsigned char *bin_root
;
268 unsigned long size_root
;
270 struct dvb_frontend
* fe
;
271 fe_status_t fe_status
;
274 void (*recover
)(struct av7110
* av7110
);
275 struct dvb_frontend_parameters saved_fe_params
;
276 fe_sec_voltage_t saved_voltage
;
277 fe_sec_tone_mode_t saved_tone
;
278 struct dvb_diseqc_master_cmd saved_master_cmd
;
279 fe_sec_mini_cmd_t saved_minicmd
;
281 int (*fe_init
)(struct dvb_frontend
* fe
);
282 int (*fe_read_status
)(struct dvb_frontend
* fe
, fe_status_t
* status
);
283 int (*fe_diseqc_reset_overload
)(struct dvb_frontend
* fe
);
284 int (*fe_diseqc_send_master_cmd
)(struct dvb_frontend
* fe
, struct dvb_diseqc_master_cmd
* cmd
);
285 int (*fe_diseqc_send_burst
)(struct dvb_frontend
* fe
, fe_sec_mini_cmd_t minicmd
);
286 int (*fe_set_tone
)(struct dvb_frontend
* fe
, fe_sec_tone_mode_t tone
);
287 int (*fe_set_voltage
)(struct dvb_frontend
* fe
, fe_sec_voltage_t voltage
);
288 int (*fe_dishnetwork_send_legacy_command
)(struct dvb_frontend
* fe
, unsigned long cmd
);
289 int (*fe_set_frontend
)(struct dvb_frontend
* fe
, struct dvb_frontend_parameters
* params
);
293 extern int ChangePIDs(struct av7110
*av7110
, u16 vpid
, u16 apid
, u16 ttpid
,
294 u16 subpid
, u16 pcrpid
);
296 extern int av7110_check_ir_config(struct av7110
*av7110
, int force
);
297 extern int av7110_ir_init(struct av7110
*av7110
);
298 extern void av7110_ir_exit(struct av7110
*av7110
);
300 /* msp3400 i2c subaddresses */
301 #define MSP_WR_DEM 0x10
302 #define MSP_RD_DEM 0x11
303 #define MSP_WR_DSP 0x12
304 #define MSP_RD_DSP 0x13
306 extern int i2c_writereg(struct av7110
*av7110
, u8 id
, u8 reg
, u8 val
);
307 extern u8
i2c_readreg(struct av7110
*av7110
, u8 id
, u8 reg
);
308 extern int msp_writereg(struct av7110
*av7110
, u8 dev
, u16 reg
, u16 val
);
311 extern int av7110_init_analog_module(struct av7110
*av7110
);
312 extern int av7110_init_v4l(struct av7110
*av7110
);
313 extern int av7110_exit_v4l(struct av7110
*av7110
);
315 #endif /* _AV7110_H_ */