4 #include <linux/interrupt.h>
5 #include <linux/socket.h>
6 #include <linux/netdevice.h>
9 #include <linux/dvb/video.h>
10 #include <linux/dvb/audio.h>
11 #include <linux/dvb/dmx.h>
12 #include <linux/dvb/ca.h>
13 #include <linux/dvb/osd.h>
14 #include <linux/dvb/net.h>
15 #include <linux/mutex.h>
19 #include "dvb_demux.h"
21 #include "dvb_filter.h"
23 #include "dvb_ringbuffer.h"
24 #include "dvb_frontend.h"
33 #include <media/saa7146_vv.h>
36 #define ANALOG_TUNER_VES1820 1
37 #define ANALOG_TUNER_STV0297 2
38 #define ANALOG_TUNER_VBI 0x100
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
;
70 /* place to store all the necessary device information */
75 struct dvb_device dvb_dev
;
76 struct dvb_net dvb_net
;
78 struct video_device
*v4l_dev
;
79 struct video_device
*vbi_dev
;
81 struct saa7146_dev
*dev
;
83 struct i2c_adapter i2c_adap
;
87 /* support for analog module of dvb-c */
88 int analog_tuner_flags
;
92 struct tasklet_struct debi_tasklet
;
93 struct tasklet_struct gpio_tasklet
;
95 int adac_type
; /* audio DAC type */
97 #define DVB_ADAC_CRYSTAL 1
98 #define DVB_ADAC_MSP34x0 2
99 #define DVB_ADAC_MSP34x5 3
100 #define DVB_ADAC_NONE -1
105 void *iobuf
; /* memory for all buffers */
106 struct dvb_ringbuffer avout
; /* buffer for video or A/V mux */
107 #define AVOUTLEN (128*1024)
108 struct dvb_ringbuffer aout
; /* buffer for audio */
109 #define AOUTLEN (64*1024)
111 #define BMPLEN (8*32768+1024)
113 /* bitmap buffers and states */
117 volatile int bmp_state
;
119 #define BMP_LOADING 1
121 wait_queue_head_t bmpq
;
124 /* DEBI and polled command interface */
127 struct mutex dcomlock
;
128 volatile int debitype
;
129 volatile int debilen
;
132 /* Recording and playback flags */
144 int osdwin
; /* currently active window */
146 struct mutex osd_mutex
;
150 ca_slot_info_t ci_slot
[2];
153 struct dmxdev dmxdev
;
154 struct dvb_demux demux
;
156 struct dmx_frontend hw_frontend
;
157 struct dmx_frontend mem_frontend
;
159 /* for budget mode demux1 */
160 struct dmxdev dmxdev1
;
161 struct dvb_demux demux1
;
162 struct dvb_net dvb_net1
;
163 spinlock_t feedlock1
;
167 unsigned char *grabbing
;
168 struct saa7146_pgtable pt
;
169 struct tasklet_struct vpe_tasklet
;
172 struct mutex pid_mutex
;
175 struct video_status videostate
;
181 #define TRICK_FREEZE 3
182 struct audio_status audiostate
;
184 struct dvb_demux_filter
*handle2filter
[32];
185 struct av7110_p2t p2t_filter
[MAXFILT
];
186 struct dvb_filter_pes2ts p2t
[2];
187 struct ipack ipack
[2];
205 struct task_struct
*arm_thread
;
206 wait_queue_head_t arm_wait
;
213 u16 pids
[DMX_PES_OTHER
];
215 struct dvb_ringbuffer ci_rbuffer
;
216 struct dvb_ringbuffer ci_wbuffer
;
218 struct audio_mixer mixer
;
220 struct dvb_adapter dvb_adapter
;
221 struct dvb_device
*video_dev
;
222 struct dvb_device
*audio_dev
;
223 struct dvb_device
*ca_dev
;
224 struct dvb_device
*osd_dev
;
226 struct dvb_video_events video_events
;
227 video_size_t video_size
;
234 void (*ir_handler
)(struct av7110
*av7110
, u32 ircom
);
235 struct tasklet_struct ir_tasklet
;
238 unsigned char *bin_fw
;
239 unsigned long size_fw
;
241 unsigned char *bin_dpram
;
242 unsigned long size_dpram
;
244 unsigned char *bin_root
;
245 unsigned long size_root
;
247 struct dvb_frontend
* fe
;
248 fe_status_t fe_status
;
251 void (*recover
)(struct av7110
* av7110
);
252 struct dvb_frontend_parameters saved_fe_params
;
253 fe_sec_voltage_t saved_voltage
;
254 fe_sec_tone_mode_t saved_tone
;
255 struct dvb_diseqc_master_cmd saved_master_cmd
;
256 fe_sec_mini_cmd_t saved_minicmd
;
258 int (*fe_init
)(struct dvb_frontend
* fe
);
259 int (*fe_read_status
)(struct dvb_frontend
* fe
, fe_status_t
* status
);
260 int (*fe_diseqc_reset_overload
)(struct dvb_frontend
* fe
);
261 int (*fe_diseqc_send_master_cmd
)(struct dvb_frontend
* fe
, struct dvb_diseqc_master_cmd
* cmd
);
262 int (*fe_diseqc_send_burst
)(struct dvb_frontend
* fe
, fe_sec_mini_cmd_t minicmd
);
263 int (*fe_set_tone
)(struct dvb_frontend
* fe
, fe_sec_tone_mode_t tone
);
264 int (*fe_set_voltage
)(struct dvb_frontend
* fe
, fe_sec_voltage_t voltage
);
265 int (*fe_dishnetwork_send_legacy_command
)(struct dvb_frontend
* fe
, unsigned long cmd
);
266 int (*fe_set_frontend
)(struct dvb_frontend
* fe
, struct dvb_frontend_parameters
* params
);
270 extern int ChangePIDs(struct av7110
*av7110
, u16 vpid
, u16 apid
, u16 ttpid
,
271 u16 subpid
, u16 pcrpid
);
273 extern int av7110_ir_init(struct av7110
*av7110
);
274 extern void av7110_ir_exit(struct av7110
*av7110
);
276 /* msp3400 i2c subaddresses */
277 #define MSP_WR_DEM 0x10
278 #define MSP_RD_DEM 0x11
279 #define MSP_WR_DSP 0x12
280 #define MSP_RD_DSP 0x13
282 extern int i2c_writereg(struct av7110
*av7110
, u8 id
, u8 reg
, u8 val
);
283 extern u8
i2c_readreg(struct av7110
*av7110
, u8 id
, u8 reg
);
284 extern int msp_writereg(struct av7110
*av7110
, u8 dev
, u16 reg
, u16 val
);
287 extern int av7110_init_analog_module(struct av7110
*av7110
);
288 extern int av7110_init_v4l(struct av7110
*av7110
);
289 extern int av7110_exit_v4l(struct av7110
*av7110
);
291 #endif /* _AV7110_H_ */