Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
av7110.h
Go to the documentation of this file.
1 #ifndef _AV7110_H_
2 #define _AV7110_H_
3 
4 #include <linux/interrupt.h>
5 #include <linux/socket.h>
6 #include <linux/netdevice.h>
7 #include <linux/i2c.h>
8 #include <linux/input.h>
9 
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>
17 
18 #include "dvbdev.h"
19 #include "demux.h"
20 #include "dvb_demux.h"
21 #include "dmxdev.h"
22 #include "dvb_filter.h"
23 #include "dvb_net.h"
24 #include "dvb_ringbuffer.h"
25 #include "dvb_frontend.h"
26 #include "ves1820.h"
27 #include "ves1x93.h"
28 #include "stv0299.h"
29 #include "tda8083.h"
30 #include "sp8870.h"
31 #include "stv0297.h"
32 #include "l64781.h"
33 
34 #include <media/saa7146_vv.h>
35 
36 
37 #define ANALOG_TUNER_VES1820 1
38 #define ANALOG_TUNER_STV0297 2
39 
40 extern int av7110_debug;
41 
42 #define dprintk(level,args...) \
43  do { if ((av7110_debug & level)) { printk("dvb-ttpci: %s(): ", __func__); printk(args); } } while (0)
44 
45 #define MAXFILT 32
46 
48 
52 };
53 
54 struct av7110_p2t {
57  long int pos;
58  int frags;
60 };
61 
62 /* video MPEG decoder events: */
63 /* (code copied from dvb_frontend.c, should maybe be factored out...) */
64 #define MAX_VIDEO_EVENT 8
67  int eventw;
68  int eventr;
69  int overflow;
72 };
73 
74 
75 struct av7110;
76 
77 /* infrared remote control */
78 struct infrared {
79  u16 key_map[256];
81  char input_phys[32];
84  void (*ir_handler)(struct av7110 *av7110, u32 ircom);
93 };
94 
95 
96 /* place to store all the necessary device information */
97 struct av7110 {
98 
99  /* devices */
100 
102  struct dvb_net dvb_net;
103 
106 
107  struct saa7146_dev *dev;
108 
110 
111  char *card_name;
112 
113  /* support for analog module of dvb-c */
117 
120 
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
127 
128 
129  /* buffers */
130 
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)
136  void *bmpbuf;
137 #define BMPLEN (8*32768+1024)
138 
139  /* bitmap buffers and states */
140 
141  int bmpp;
142  int bmplen;
143  volatile int bmp_state;
144 #define BMP_NONE 0
145 #define BMP_LOADING 1
146 #define BMP_LOADED 2
148 
149 
150  /* DEBI and polled command interface */
151 
153  struct mutex dcomlock;
154  volatile int debitype;
155  volatile int debilen;
156 
157 
158  /* Recording and playback flags */
159 
160  int rec_mode;
161  int playing;
162 #define RP_NONE 0
163 #define RP_VIDEO 1
164 #define RP_AUDIO 2
165 #define RP_AV 3
166 
167 
168  /* OSD */
169 
170  int osdwin; /* currently active window */
172  struct mutex osd_mutex;
173 
174  /* CA */
175 
177 
179  struct dmxdev dmxdev;
180  struct dvb_demux demux;
181 
184 
185  /* for budget mode demux1 */
186  struct dmxdev dmxdev1;
190  int feeding1;
192  unsigned char *grabbing;
195  bool full_ts;
196 
198  struct mutex pid_mutex;
199 
205 #define TRICK_NONE 0
206 #define TRICK_FAST 1
207 #define TRICK_SLOW 2
208 #define TRICK_FREEZE 3
210 
214  struct ipack ipack[2];
215  u8 *kbuf[2];
216 
217  int sinfo;
218  int feeding;
219 
222 
223 
224  /* AV711X */
225 
235 
236  void *debi_virt;
238 
240 
243 
245 
251 
254 
257 
258  struct infrared ir;
259 
260  /* firmware stuff */
261  unsigned char *bin_fw;
262  unsigned long size_fw;
263 
264  unsigned char *bin_dpram;
265  unsigned long size_dpram;
266 
267  unsigned char *bin_root;
268  unsigned long size_root;
269 
270  struct dvb_frontend* fe;
272 
273  /* crash recovery */
274  void (*recover)(struct av7110* av7110);
279 
280  int (*fe_init)(struct dvb_frontend* fe);
289 };
290 
291 
292 extern int ChangePIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid,
293  u16 subpid, u16 pcrpid);
294 
295 extern int av7110_check_ir_config(struct av7110 *av7110, int force);
296 extern int av7110_ir_init(struct av7110 *av7110);
297 extern void av7110_ir_exit(struct av7110 *av7110);
298 
299 /* msp3400 i2c subaddresses */
300 #define MSP_WR_DEM 0x10
301 #define MSP_RD_DEM 0x11
302 #define MSP_WR_DSP 0x12
303 #define MSP_RD_DSP 0x13
304 
305 extern int i2c_writereg(struct av7110 *av7110, u8 id, u8 reg, u8 val);
306 extern u8 i2c_readreg(struct av7110 *av7110, u8 id, u8 reg);
307 extern int msp_writereg(struct av7110 *av7110, u8 dev, u16 reg, u16 val);
308 
309 
310 extern int av7110_init_analog_module(struct av7110 *av7110);
311 extern int av7110_init_v4l(struct av7110 *av7110);
312 extern int av7110_exit_v4l(struct av7110 *av7110);
313 
314 #endif /* _AV7110_H_ */