[PATCH] devfs: Remove the devfs_fs_kernel.h file from the tree
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / media / dvb / ttpci / av7110.h
blob9c79696da08a60d622aaf347cc5a67609fe74388
1 #ifndef _AV7110_H_
2 #define _AV7110_H_
4 #include <linux/interrupt.h>
5 #include <linux/socket.h>
6 #include <linux/netdevice.h>
7 #include <linux/i2c.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>
17 #include "dvbdev.h"
18 #include "demux.h"
19 #include "dvb_demux.h"
20 #include "dmxdev.h"
21 #include "dvb_filter.h"
22 #include "dvb_net.h"
23 #include "dvb_ringbuffer.h"
24 #include "dvb_frontend.h"
25 #include "ves1820.h"
26 #include "ves1x93.h"
27 #include "stv0299.h"
28 #include "tda8083.h"
29 #include "sp8870.h"
30 #include "stv0297.h"
31 #include "l64781.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)
45 #define MAXFILT 32
47 enum {AV_PES_STREAM, PS_STREAM, TS_STREAM, PES_STREAM};
49 struct av7110_p2t {
50 u8 pes[TS_SIZE];
51 u8 counter;
52 long int pos;
53 int frags;
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];
62 int eventw;
63 int eventr;
64 int overflow;
65 wait_queue_head_t wait_queue;
66 spinlock_t lock;
70 /* place to store all the necessary device information */
71 struct av7110 {
73 /* devices */
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;
85 char *card_name;
87 /* support for analog module of dvb-c */
88 int analog_tuner_flags;
89 int current_input;
90 u32 current_freq;
92 struct tasklet_struct debi_tasklet;
93 struct tasklet_struct gpio_tasklet;
95 int adac_type; /* audio DAC type */
96 #define DVB_ADAC_TI 0
97 #define DVB_ADAC_CRYSTAL 1
98 #define DVB_ADAC_MSP34x0 2
99 #define DVB_ADAC_MSP34x5 3
100 #define DVB_ADAC_NONE -1
103 /* buffers */
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)
110 void *bmpbuf;
111 #define BMPLEN (8*32768+1024)
113 /* bitmap buffers and states */
115 int bmpp;
116 int bmplen;
117 volatile int bmp_state;
118 #define BMP_NONE 0
119 #define BMP_LOADING 1
120 #define BMP_LOADED 2
121 wait_queue_head_t bmpq;
124 /* DEBI and polled command interface */
126 spinlock_t debilock;
127 struct mutex dcomlock;
128 volatile int debitype;
129 volatile int debilen;
132 /* Recording and playback flags */
134 int rec_mode;
135 int playing;
136 #define RP_NONE 0
137 #define RP_VIDEO 1
138 #define RP_AUDIO 2
139 #define RP_AV 3
142 /* OSD */
144 int osdwin; /* currently active window */
145 u16 osdbpp[8];
146 struct mutex osd_mutex;
148 /* CA */
150 ca_slot_info_t ci_slot[2];
152 int vidmode;
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;
164 int feeding1;
165 u8 tsf;
166 u32 ttbp;
167 unsigned char *grabbing;
168 struct saa7146_pgtable pt;
169 struct tasklet_struct vpe_tasklet;
171 int fe_synced;
172 struct mutex pid_mutex;
174 int video_blank;
175 struct video_status videostate;
176 int display_ar;
177 int trickmode;
178 #define TRICK_NONE 0
179 #define TRICK_FAST 1
180 #define TRICK_SLOW 2
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];
188 u8 *kbuf[2];
190 int sinfo;
191 int feeding;
193 int arm_errors;
194 int registered;
197 /* AV711X */
199 u32 arm_fw;
200 u32 arm_rtsl;
201 u32 arm_vid;
202 u32 arm_app;
203 u32 avtype;
204 int arm_ready;
205 struct task_struct *arm_thread;
206 wait_queue_head_t arm_wait;
207 u16 arm_loops;
208 int arm_rmmod;
210 void *debi_virt;
211 dma_addr_t debi_bus;
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;
229 u16 wssMode;
230 u16 wssData;
232 u32 ir_config;
233 u32 ir_command;
234 void (*ir_handler)(struct av7110 *av7110, u32 ircom);
235 struct tasklet_struct ir_tasklet;
237 /* firmware stuff */
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;
250 /* crash recovery */
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_ */