av7110.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. #ifndef _AV7110_H_
  2. #define _AV7110_H_
  3. #include <linux/interrupt.h>
  4. #include <linux/socket.h>
  5. #include <linux/netdevice.h>
  6. #include <linux/i2c.h>
  7. #ifdef CONFIG_DEVFS_FS
  8. #include <linux/devfs_fs_kernel.h>
  9. #endif
  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 "dvbdev.h"
  17. #include "demux.h"
  18. #include "dvb_demux.h"
  19. #include "dmxdev.h"
  20. #include "dvb_filter.h"
  21. #include "dvb_net.h"
  22. #include "dvb_ringbuffer.h"
  23. #include "dvb_frontend.h"
  24. #include "ves1820.h"
  25. #include "ves1x93.h"
  26. #include "stv0299.h"
  27. #include "tda8083.h"
  28. #include "sp8870.h"
  29. #include "stv0297.h"
  30. #include "l64781.h"
  31. #include <media/saa7146_vv.h>
  32. #define ANALOG_TUNER_VES1820 1
  33. #define ANALOG_TUNER_STV0297 2
  34. #define ANALOG_TUNER_VBI 0x100
  35. extern int av7110_debug;
  36. #define dprintk(level,args...) \
  37. do { if ((av7110_debug & level)) { printk("dvb-ttpci: %s(): ", __FUNCTION__); printk(args); } } while (0)
  38. #define MAXFILT 32
  39. enum {AV_PES_STREAM, PS_STREAM, TS_STREAM, PES_STREAM};
  40. struct av7110_p2t {
  41. u8 pes[TS_SIZE];
  42. u8 counter;
  43. long int pos;
  44. int frags;
  45. struct dvb_demux_feed *feed;
  46. };
  47. /* video MPEG decoder events: */
  48. /* (code copied from dvb_frontend.c, should maybe be factored out...) */
  49. #define MAX_VIDEO_EVENT 8
  50. struct dvb_video_events {
  51. struct video_event events[MAX_VIDEO_EVENT];
  52. int eventw;
  53. int eventr;
  54. int overflow;
  55. wait_queue_head_t wait_queue;
  56. spinlock_t lock;
  57. };
  58. /* place to store all the necessary device information */
  59. struct av7110 {
  60. /* devices */
  61. struct dvb_device dvb_dev;
  62. struct dvb_net dvb_net;
  63. struct video_device *v4l_dev;
  64. struct video_device *vbi_dev;
  65. struct saa7146_dev *dev;
  66. struct i2c_adapter i2c_adap;
  67. char *card_name;
  68. /* support for analog module of dvb-c */
  69. int analog_tuner_flags;
  70. int current_input;
  71. u32 current_freq;
  72. struct tasklet_struct debi_tasklet;
  73. struct tasklet_struct gpio_tasklet;
  74. int adac_type; /* audio DAC type */
  75. #define DVB_ADAC_TI 0
  76. #define DVB_ADAC_CRYSTAL 1
  77. #define DVB_ADAC_MSP34x0 2
  78. #define DVB_ADAC_MSP34x5 3
  79. #define DVB_ADAC_NONE -1
  80. /* buffers */
  81. void *iobuf; /* memory for all buffers */
  82. struct dvb_ringbuffer avout; /* buffer for video or A/V mux */
  83. #define AVOUTLEN (128*1024)
  84. struct dvb_ringbuffer aout; /* buffer for audio */
  85. #define AOUTLEN (64*1024)
  86. void *bmpbuf;
  87. #define BMPLEN (8*32768+1024)
  88. /* bitmap buffers and states */
  89. int bmpp;
  90. int bmplen;
  91. volatile int bmp_state;
  92. #define BMP_NONE 0
  93. #define BMP_LOADING 1
  94. #define BMP_LOADED 2
  95. wait_queue_head_t bmpq;
  96. /* DEBI and polled command interface */
  97. spinlock_t debilock;
  98. struct semaphore dcomlock;
  99. volatile int debitype;
  100. volatile int debilen;
  101. /* Recording and playback flags */
  102. int rec_mode;
  103. int playing;
  104. #define RP_NONE 0
  105. #define RP_VIDEO 1
  106. #define RP_AUDIO 2
  107. #define RP_AV 3
  108. /* OSD */
  109. int osdwin; /* currently active window */
  110. u16 osdbpp[8];
  111. struct semaphore osd_sema;
  112. /* CA */
  113. ca_slot_info_t ci_slot[2];
  114. int vidmode;
  115. struct dmxdev dmxdev;
  116. struct dvb_demux demux;
  117. struct dmx_frontend hw_frontend;
  118. struct dmx_frontend mem_frontend;
  119. /* for budget mode demux1 */
  120. struct dmxdev dmxdev1;
  121. struct dvb_demux demux1;
  122. struct dvb_net dvb_net1;
  123. spinlock_t feedlock1;
  124. int feeding1;
  125. u8 tsf;
  126. u32 ttbp;
  127. unsigned char *grabbing;
  128. struct saa7146_pgtable pt;
  129. struct tasklet_struct vpe_tasklet;
  130. int fe_synced;
  131. struct semaphore pid_mutex;
  132. int video_blank;
  133. struct video_status videostate;
  134. int display_ar;
  135. int trickmode;
  136. #define TRICK_NONE 0
  137. #define TRICK_FAST 1
  138. #define TRICK_SLOW 2
  139. #define TRICK_FREEZE 3
  140. struct audio_status audiostate;
  141. struct dvb_demux_filter *handle2filter[32];
  142. struct av7110_p2t p2t_filter[MAXFILT];
  143. struct dvb_filter_pes2ts p2t[2];
  144. struct ipack ipack[2];
  145. u8 *kbuf[2];
  146. int sinfo;
  147. int feeding;
  148. int arm_errors;
  149. int registered;
  150. /* AV711X */
  151. u32 arm_fw;
  152. u32 arm_rtsl;
  153. u32 arm_vid;
  154. u32 arm_app;
  155. u32 avtype;
  156. int arm_ready;
  157. struct task_struct *arm_thread;
  158. wait_queue_head_t arm_wait;
  159. u16 arm_loops;
  160. int arm_rmmod;
  161. void *debi_virt;
  162. dma_addr_t debi_bus;
  163. u16 pids[DMX_PES_OTHER];
  164. struct dvb_ringbuffer ci_rbuffer;
  165. struct dvb_ringbuffer ci_wbuffer;
  166. struct audio_mixer mixer;
  167. struct dvb_adapter dvb_adapter;
  168. struct dvb_device *video_dev;
  169. struct dvb_device *audio_dev;
  170. struct dvb_device *ca_dev;
  171. struct dvb_device *osd_dev;
  172. struct dvb_video_events video_events;
  173. video_size_t video_size;
  174. u16 wssMode;
  175. u16 wssData;
  176. u32 ir_config;
  177. u32 ir_command;
  178. void (*ir_handler)(struct av7110 *av7110, u32 ircom);
  179. struct tasklet_struct ir_tasklet;
  180. /* firmware stuff */
  181. unsigned char *bin_fw;
  182. unsigned long size_fw;
  183. unsigned char *bin_dpram;
  184. unsigned long size_dpram;
  185. unsigned char *bin_root;
  186. unsigned long size_root;
  187. struct dvb_frontend* fe;
  188. fe_status_t fe_status;
  189. /* crash recovery */
  190. void (*recover)(struct av7110* av7110);
  191. struct dvb_frontend_parameters saved_fe_params;
  192. fe_sec_voltage_t saved_voltage;
  193. fe_sec_tone_mode_t saved_tone;
  194. struct dvb_diseqc_master_cmd saved_master_cmd;
  195. fe_sec_mini_cmd_t saved_minicmd;
  196. int (*fe_init)(struct dvb_frontend* fe);
  197. int (*fe_read_status)(struct dvb_frontend* fe, fe_status_t* status);
  198. int (*fe_diseqc_reset_overload)(struct dvb_frontend* fe);
  199. int (*fe_diseqc_send_master_cmd)(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd* cmd);
  200. int (*fe_diseqc_send_burst)(struct dvb_frontend* fe, fe_sec_mini_cmd_t minicmd);
  201. int (*fe_set_tone)(struct dvb_frontend* fe, fe_sec_tone_mode_t tone);
  202. int (*fe_set_voltage)(struct dvb_frontend* fe, fe_sec_voltage_t voltage);
  203. int (*fe_dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned long cmd);
  204. int (*fe_set_frontend)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
  205. };
  206. extern int ChangePIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid,
  207. u16 subpid, u16 pcrpid);
  208. extern int av7110_setup_irc_config (struct av7110 *av7110, u32 ir_config);
  209. extern int av7110_ir_init(struct av7110 *av7110);
  210. extern void av7110_ir_exit(struct av7110 *av7110);
  211. /* msp3400 i2c subaddresses */
  212. #define MSP_WR_DEM 0x10
  213. #define MSP_RD_DEM 0x11
  214. #define MSP_WR_DSP 0x12
  215. #define MSP_RD_DSP 0x13
  216. extern int i2c_writereg(struct av7110 *av7110, u8 id, u8 reg, u8 val);
  217. extern u8 i2c_readreg(struct av7110 *av7110, u8 id, u8 reg);
  218. extern int msp_writereg(struct av7110 *av7110, u8 dev, u16 reg, u16 val);
  219. extern int av7110_init_analog_module(struct av7110 *av7110);
  220. extern int av7110_init_v4l(struct av7110 *av7110);
  221. extern int av7110_exit_v4l(struct av7110 *av7110);
  222. #endif /* _AV7110_H_ */