Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
| 9 | #ifdef CONFIG_DEVFS_FS |
| 10 | #include <linux/devfs_fs_kernel.h> |
| 11 | #endif |
| 12 | |
| 13 | #include <linux/dvb/video.h> |
| 14 | #include <linux/dvb/audio.h> |
| 15 | #include <linux/dvb/dmx.h> |
| 16 | #include <linux/dvb/ca.h> |
| 17 | #include <linux/dvb/osd.h> |
| 18 | #include <linux/dvb/net.h> |
| 19 | |
| 20 | #include "dvbdev.h" |
| 21 | #include "demux.h" |
| 22 | #include "dvb_demux.h" |
| 23 | #include "dmxdev.h" |
| 24 | #include "dvb_filter.h" |
| 25 | #include "dvb_net.h" |
| 26 | #include "dvb_ringbuffer.h" |
| 27 | #include "dvb_frontend.h" |
| 28 | #include "ves1820.h" |
| 29 | #include "ves1x93.h" |
| 30 | #include "stv0299.h" |
| 31 | #include "tda8083.h" |
| 32 | #include "sp8870.h" |
| 33 | #include "stv0297.h" |
| 34 | #include "l64781.h" |
| 35 | |
| 36 | #include <media/saa7146_vv.h> |
| 37 | |
| 38 | |
| 39 | #define ANALOG_TUNER_VES1820 1 |
| 40 | #define ANALOG_TUNER_STV0297 2 |
| 41 | #define ANALOG_TUNER_VBI 0x100 |
| 42 | |
| 43 | extern int av7110_debug; |
| 44 | |
| 45 | #define dprintk(level,args...) \ |
| 46 | do { if ((av7110_debug & level)) { printk("dvb-ttpci: %s(): ", __FUNCTION__); printk(args); } } while (0) |
| 47 | |
| 48 | #define MAXFILT 32 |
| 49 | |
| 50 | enum {AV_PES_STREAM, PS_STREAM, TS_STREAM, PES_STREAM}; |
| 51 | |
| 52 | struct av7110_p2t { |
| 53 | u8 pes[TS_SIZE]; |
| 54 | u8 counter; |
| 55 | long int pos; |
| 56 | int frags; |
| 57 | struct dvb_demux_feed *feed; |
| 58 | }; |
| 59 | |
| 60 | /* video MPEG decoder events: */ |
| 61 | /* (code copied from dvb_frontend.c, should maybe be factored out...) */ |
| 62 | #define MAX_VIDEO_EVENT 8 |
| 63 | struct dvb_video_events { |
| 64 | struct video_event events[MAX_VIDEO_EVENT]; |
| 65 | int eventw; |
| 66 | int eventr; |
| 67 | int overflow; |
| 68 | wait_queue_head_t wait_queue; |
| 69 | spinlock_t lock; |
| 70 | }; |
| 71 | |
| 72 | |
| 73 | /* place to store all the necessary device information */ |
| 74 | struct av7110 { |
| 75 | |
| 76 | /* devices */ |
| 77 | |
| 78 | struct dvb_device dvb_dev; |
| 79 | struct dvb_net dvb_net; |
| 80 | |
| 81 | struct video_device *v4l_dev; |
| 82 | struct video_device *vbi_dev; |
| 83 | |
| 84 | struct saa7146_dev *dev; |
| 85 | |
| 86 | struct i2c_adapter i2c_adap; |
| 87 | |
| 88 | char *card_name; |
| 89 | |
| 90 | /* support for analog module of dvb-c */ |
| 91 | int analog_tuner_flags; |
| 92 | int current_input; |
| 93 | u32 current_freq; |
| 94 | |
| 95 | struct tasklet_struct debi_tasklet; |
| 96 | struct tasklet_struct gpio_tasklet; |
| 97 | |
| 98 | int adac_type; /* audio DAC type */ |
| 99 | #define DVB_ADAC_TI 0 |
| 100 | #define DVB_ADAC_CRYSTAL 1 |
Marco Schluessler | 1c13b95 | 2006-01-09 15:25:06 -0200 | [diff] [blame] | 101 | #define DVB_ADAC_MSP34x0 2 |
| 102 | #define DVB_ADAC_MSP34x5 3 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | #define DVB_ADAC_NONE -1 |
| 104 | |
| 105 | |
| 106 | /* buffers */ |
| 107 | |
| 108 | void *iobuf; /* memory for all buffers */ |
| 109 | struct dvb_ringbuffer avout; /* buffer for video or A/V mux */ |
| 110 | #define AVOUTLEN (128*1024) |
| 111 | struct dvb_ringbuffer aout; /* buffer for audio */ |
| 112 | #define AOUTLEN (64*1024) |
| 113 | void *bmpbuf; |
| 114 | #define BMPLEN (8*32768+1024) |
| 115 | |
| 116 | /* bitmap buffers and states */ |
| 117 | |
| 118 | int bmpp; |
| 119 | int bmplen; |
| 120 | volatile int bmp_state; |
| 121 | #define BMP_NONE 0 |
| 122 | #define BMP_LOADING 1 |
Wolfgang Rohdewald | c9090eb | 2005-07-07 17:57:55 -0700 | [diff] [blame] | 123 | #define BMP_LOADED 2 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 124 | wait_queue_head_t bmpq; |
| 125 | |
| 126 | |
| 127 | /* DEBI and polled command interface */ |
| 128 | |
| 129 | spinlock_t debilock; |
| 130 | struct semaphore dcomlock; |
| 131 | volatile int debitype; |
| 132 | volatile int debilen; |
| 133 | |
| 134 | |
| 135 | /* Recording and playback flags */ |
| 136 | |
| 137 | int rec_mode; |
| 138 | int playing; |
| 139 | #define RP_NONE 0 |
| 140 | #define RP_VIDEO 1 |
| 141 | #define RP_AUDIO 2 |
| 142 | #define RP_AV 3 |
| 143 | |
| 144 | |
| 145 | /* OSD */ |
| 146 | |
| 147 | int osdwin; /* currently active window */ |
| 148 | u16 osdbpp[8]; |
| 149 | struct semaphore osd_sema; |
| 150 | |
| 151 | /* CA */ |
| 152 | |
| 153 | ca_slot_info_t ci_slot[2]; |
| 154 | |
| 155 | int vidmode; |
| 156 | struct dmxdev dmxdev; |
| 157 | struct dvb_demux demux; |
| 158 | |
| 159 | struct dmx_frontend hw_frontend; |
| 160 | struct dmx_frontend mem_frontend; |
| 161 | |
| 162 | /* for budget mode demux1 */ |
| 163 | struct dmxdev dmxdev1; |
| 164 | struct dvb_demux demux1; |
| 165 | struct dvb_net dvb_net1; |
| 166 | spinlock_t feedlock1; |
| 167 | int feeding1; |
| 168 | u8 tsf; |
| 169 | u32 ttbp; |
| 170 | unsigned char *grabbing; |
| 171 | struct saa7146_pgtable pt; |
| 172 | struct tasklet_struct vpe_tasklet; |
| 173 | |
| 174 | int fe_synced; |
| 175 | struct semaphore pid_mutex; |
| 176 | |
| 177 | int video_blank; |
| 178 | struct video_status videostate; |
| 179 | int display_ar; |
| 180 | int trickmode; |
| 181 | #define TRICK_NONE 0 |
| 182 | #define TRICK_FAST 1 |
| 183 | #define TRICK_SLOW 2 |
| 184 | #define TRICK_FREEZE 3 |
| 185 | struct audio_status audiostate; |
| 186 | |
| 187 | struct dvb_demux_filter *handle2filter[32]; |
| 188 | struct av7110_p2t p2t_filter[MAXFILT]; |
| 189 | struct dvb_filter_pes2ts p2t[2]; |
| 190 | struct ipack ipack[2]; |
| 191 | u8 *kbuf[2]; |
| 192 | |
| 193 | int sinfo; |
| 194 | int feeding; |
| 195 | |
| 196 | int arm_errors; |
| 197 | int registered; |
| 198 | |
| 199 | |
| 200 | /* AV711X */ |
| 201 | |
| 202 | u32 arm_fw; |
| 203 | u32 arm_rtsl; |
| 204 | u32 arm_vid; |
| 205 | u32 arm_app; |
| 206 | u32 avtype; |
| 207 | int arm_ready; |
| 208 | struct task_struct *arm_thread; |
| 209 | wait_queue_head_t arm_wait; |
| 210 | u16 arm_loops; |
| 211 | int arm_rmmod; |
| 212 | |
| 213 | void *debi_virt; |
| 214 | dma_addr_t debi_bus; |
| 215 | |
| 216 | u16 pids[DMX_PES_OTHER]; |
| 217 | |
| 218 | struct dvb_ringbuffer ci_rbuffer; |
| 219 | struct dvb_ringbuffer ci_wbuffer; |
| 220 | |
| 221 | struct audio_mixer mixer; |
| 222 | |
Johannes Stezenbach | fdc53a6 | 2005-05-16 21:54:39 -0700 | [diff] [blame] | 223 | struct dvb_adapter dvb_adapter; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 224 | struct dvb_device *video_dev; |
| 225 | struct dvb_device *audio_dev; |
| 226 | struct dvb_device *ca_dev; |
| 227 | struct dvb_device *osd_dev; |
| 228 | |
| 229 | struct dvb_video_events video_events; |
| 230 | video_size_t video_size; |
| 231 | |
Oliver Endriss | 03388ae | 2005-09-09 13:03:12 -0700 | [diff] [blame] | 232 | u32 ir_config; |
| 233 | u32 ir_command; |
| 234 | void (*ir_handler)(struct av7110 *av7110, u32 ircom); |
| 235 | struct tasklet_struct ir_tasklet; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 236 | |
| 237 | /* firmware stuff */ |
| 238 | unsigned char *bin_fw; |
| 239 | unsigned long size_fw; |
| 240 | |
| 241 | unsigned char *bin_dpram; |
| 242 | unsigned long size_dpram; |
| 243 | |
| 244 | unsigned char *bin_root; |
| 245 | unsigned long size_root; |
| 246 | |
| 247 | struct dvb_frontend* fe; |
| 248 | fe_status_t fe_status; |
Oliver Endriss | 66190a2 | 2006-01-09 15:32:42 -0200 | [diff] [blame] | 249 | |
| 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; |
| 257 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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); |
Peter Beutner | 400b708 | 2006-01-09 15:32:43 -0200 | [diff] [blame] | 265 | int (*fe_dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned long cmd); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 266 | int (*fe_set_frontend)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params); |
| 267 | }; |
| 268 | |
| 269 | |
Wolfgang Rohdewald | ce18a22 | 2005-07-07 17:57:59 -0700 | [diff] [blame] | 270 | extern int ChangePIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 271 | u16 subpid, u16 pcrpid); |
| 272 | |
Wolfgang Rohdewald | ce18a22 | 2005-07-07 17:57:59 -0700 | [diff] [blame] | 273 | extern int av7110_setup_irc_config (struct av7110 *av7110, u32 ir_config); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 274 | |
Oliver Endriss | 03388ae | 2005-09-09 13:03:12 -0700 | [diff] [blame] | 275 | extern int av7110_ir_init(struct av7110 *av7110); |
| 276 | extern void av7110_ir_exit(struct av7110 *av7110); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 277 | |
| 278 | /* msp3400 i2c subaddresses */ |
| 279 | #define MSP_WR_DEM 0x10 |
| 280 | #define MSP_RD_DEM 0x11 |
| 281 | #define MSP_WR_DSP 0x12 |
| 282 | #define MSP_RD_DSP 0x13 |
| 283 | |
| 284 | extern int i2c_writereg(struct av7110 *av7110, u8 id, u8 reg, u8 val); |
| 285 | extern u8 i2c_readreg(struct av7110 *av7110, u8 id, u8 reg); |
| 286 | extern int msp_writereg(struct av7110 *av7110, u8 dev, u16 reg, u16 val); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 | |
| 288 | |
| 289 | extern int av7110_init_analog_module(struct av7110 *av7110); |
| 290 | extern int av7110_init_v4l(struct av7110 *av7110); |
| 291 | extern int av7110_exit_v4l(struct av7110 *av7110); |
| 292 | |
| 293 | #endif /* _AV7110_H_ */ |