home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / src / linux-headers-2.6.17-6 / include / media / em8300.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-08-11  |  12.8 KB  |  462 lines

  1. #ifndef LINUX_EM8300_H
  2. #define LINUX_EM8300_H
  3.  
  4. typedef struct {
  5.     void *ucode;
  6.     int ucode_size;
  7. } em8300_microcode_t;
  8.  
  9. typedef struct {
  10.     int reg;
  11.     int val;
  12.     int microcode_register;
  13. } em8300_register_t;
  14.  
  15. typedef struct {
  16.     int brightness;
  17.     int contrast;
  18.     int saturation;
  19. } em8300_bcs_t;
  20.  
  21. typedef struct {
  22.     int cal_mode;
  23.     int arg;
  24.     int arg2;
  25.     int result;
  26.     int result2;
  27. } em8300_overlay_calibrate_t;
  28.  
  29. typedef struct {
  30.     int xpos, ypos;
  31.     int width, height;
  32. } em8300_overlay_window_t;
  33.  
  34. typedef struct {
  35.     int xsize, ysize;
  36. } em8300_overlay_screen_t;
  37.  
  38. typedef struct {
  39.     int attribute;
  40.     int value;
  41. } em8300_attribute_t;
  42.  
  43. typedef struct {
  44.     int color;
  45.     int contrast;
  46.     int top;
  47.     int bottom;
  48.     int left;
  49.     int right;
  50. } em8300_button_t;
  51.  
  52. #define MAX_UCODE_REGISTER 110
  53.  
  54. #define EM8300_IOCTL_INIT       _IOW('C',0,em8300_microcode_t)
  55. #define EM8300_IOCTL_READREG    _IOWR('C',1,em8300_register_t)
  56. #define EM8300_IOCTL_WRITEREG   _IOW('C',2,em8300_register_t)
  57. #define EM8300_IOCTL_GETSTATUS  _IOR('C',3,char[1024])
  58. #define EM8300_IOCTL_SETBCS    _IOW('C',4,em8300_bcs_t)
  59. #define EM8300_IOCTL_GETBCS    _IOR('C',4,em8300_bcs_t)
  60. #define EM8300_IOCTL_SET_ASPECTRATIO _IOW('C',5,int)
  61. #define EM8300_IOCTL_GET_ASPECTRATIO _IOR('C',5,int)
  62. #define EM8300_IOCTL_SET_VIDEOMODE _IOW('C',6,int)
  63. #define EM8300_IOCTL_GET_VIDEOMODE _IOR('C',6,int)
  64. #define EM8300_IOCTL_SET_PLAYMODE _IOW('C',7,int)
  65. #define EM8300_IOCTL_GET_PLAYMODE _IOR('C',7,int)
  66. #define EM8300_IOCTL_SET_AUDIOMODE _IOW('C',8,int)
  67. #define EM8300_IOCTL_GET_AUDIOMODE _IOR('C',8,int)
  68. #define EM8300_IOCTL_SET_SPUMODE _IOW('C',9,int)
  69. #define EM8300_IOCTL_GET_SPUMODE _IOR('C',9,int)
  70. #define EM8300_IOCTL_OVERLAY_CALIBRATE _IOWR('C',10,em8300_overlay_calibrate_t)
  71. #define EM8300_IOCTL_OVERLAY_SETMODE _IOW('C',11,int)
  72. #define EM8300_IOCTL_OVERLAY_SETWINDOW _IOWR('C',12,em8300_overlay_window_t)
  73. #define EM8300_IOCTL_OVERLAY_SETSCREEN _IOWR('C',13,em8300_overlay_screen_t)
  74. #define EM8300_IOCTL_OVERLAY_GET_ATTRIBUTE _IOR('C',14,em8300_attribute_t)
  75. #define EM8300_IOCTL_OVERLAY_SET_ATTRIBUTE _IOW('C',14,em8300_attribute_t)
  76. #define EM8300_IOCTL_OVERLAY_SIGNALMODE _IOW('C',15,em8300_attribute_t)
  77. #define EM8300_IOCTL_SCR_GET _IOR('C',16,unsigned)
  78. #define EM8300_IOCTL_SCR_SET _IOW('C',16,unsigned)
  79. #define EM8300_IOCTL_SCR_GETSPEED _IOR('C',17,unsigned)
  80. #define EM8300_IOCTL_SCR_SETSPEED _IOW('C',17,unsigned)
  81. #define EM8300_IOCTL_FLUSH _IOW('C',18,int)
  82. #define EM8300_IOCTL_VBI _IOW('C',19,struct timeval)
  83.  
  84. #define EM8300_OVERLAY_SIGNAL_ONLY 1
  85. #define EM8300_OVERLAY_SIGNAL_WITH_VGA 2
  86. #define EM8300_OVERLAY_VGA_ONLY 3
  87.  
  88. #define EM8300_IOCTL_VIDEO_SETPTS 1
  89. #define EM8300_IOCTL_VIDEO_GETSCR _IOR('C',2,unsigned)
  90. #define EM8300_IOCTL_VIDEO_SETSCR _IOW('C',2,unsigned)
  91.  
  92. #define EM8300_IOCTL_SPU_SETPTS 1
  93. #define EM8300_IOCTL_SPU_SETPALETTE 2
  94. #define EM8300_IOCTL_SPU_BUTTON 3
  95.  
  96. #define EM8300_ASPECTRATIO_4_3 0
  97. #define EM8300_ASPECTRATIO_16_9 1
  98. #define EM8300_ASPECTRATIO_LAST 1
  99.  
  100. #define EM8300_VIDEOMODE_PAL    0
  101. #define EM8300_VIDEOMODE_PAL60    1
  102. #define EM8300_VIDEOMODE_NTSC    2
  103. #define EM8300_VIDEOMODE_PALCROP 3
  104. #define EM8300_VIDEOMODE_LAST    3
  105. #ifndef EM8300_VIDEOMODE_DEFAULT
  106. #define EM8300_VIDEOMODE_DEFAULT EM8300_VIDEOMODE_PAL
  107. #endif
  108.  
  109. #define EM8300_AUDIOMODE_ANALOG 0
  110. #define EM8300_AUDIOMODE_DIGITALPCM 1
  111. #define EM8300_AUDIOMODE_DIGITALAC3 2
  112. #ifndef EM8300_AUDIOMODE_DEFAULT
  113. #define EM8300_AUDIOMODE_DEFAULT EM8300_AUDIOMODE_ANALOG
  114. #endif
  115.  
  116. #define EM8300_SPUMODE_OFF 0
  117. #define EM8300_SPUMODE_ON 1
  118.  
  119. #define EM8300_PLAYMODE_STOPPED         0
  120. #define EM8300_PLAYMODE_PAUSED          1
  121. #define EM8300_PLAYMODE_SLOWFORWARDS    2
  122. #define EM8300_PLAYMODE_SLOWBACKWARDS   3
  123. #define EM8300_PLAYMODE_SINGLESTEP      4
  124. #define EM8300_PLAYMODE_PLAY            5
  125. #define EM8300_PLAYMODE_REVERSEPLAY     6
  126. #define EM8300_PLAYMODE_SCAN            7
  127. #define EM8300_PLAYMODE_FRAMEBUF    8
  128.  
  129. #define EM8300_OVERLAY_MODE_OFF 0
  130. #define EM8300_OVERLAY_MODE_RECTANGLE 1
  131. #define EM8300_OVERLAY_MODE_OVERLAY 2
  132.  
  133. #define EM8300_OVERLAY_CALMODE_XOFFSET 1
  134. #define EM8300_OVERLAY_CALMODE_YOFFSET 2
  135. #define EM8300_OVERLAY_CALMODE_XCORRECTION 3
  136. #define EM8300_OVERLAY_CALMODE_COLOR 4
  137.  
  138. #define EM9010_ATTRIBUTE_XCORR 1
  139. #define EM9010_ATTRIBUTE_XOFFSET 2
  140. #define EM9010_ATTRIBUTE_YOFFSET 3
  141. #define EM9010_ATTRIBUTE_JITTER 4
  142. #define EM9010_ATTRIBUTE_STABILITY 5
  143. #define EM9010_ATTRIBUTE_KEYCOLOR_UPPER 6
  144. #define EM9010_ATTRIBUTE_KEYCOLOR_LOWER 7
  145. #define EM9010_ATTRIBUTE_MAX 7
  146.  
  147. #define EM8300_SUBDEVICE_CONTROL 0
  148. #define EM8300_SUBDEVICE_VIDEO 1
  149. #define EM8300_SUBDEVICE_AUDIO 2
  150. #define EM8300_SUBDEVICE_SUBPICTURE 3
  151.  
  152. #ifndef PCI_VENDOR_ID_SIGMADESIGNS
  153. #define PCI_VENDOR_ID_SIGMADESIGNS 0x1105
  154. #define PCI_DEVICE_ID_SIGMADESIGNS_EM8300 0x8300
  155. #endif
  156.  
  157. #define CLOCKGEN_SAMPFREQ_MASK 0xc0
  158. #define CLOCKGEN_SAMPFREQ_66 0xc0
  159. #define CLOCKGEN_SAMPFREQ_48 0x40
  160. #define CLOCKGEN_SAMPFREQ_44 0x80
  161. #define CLOCKGEN_SAMPFREQ_32 0x00
  162.  
  163. #define CLOCKGEN_OUTMASK 0x30
  164. #define CLOCKGEN_DIGITALOUT 0x10
  165. #define CLOCKGEN_ANALOGOUT 0x20
  166.  
  167. #define CLOCKGEN_MODEMASK 0x0f
  168. #define CLOCKGEN_OVERLAYMODE_1 0x07
  169. #define CLOCKGEN_TVMODE_1 0x0b
  170. #define CLOCKGEN_OVERLAYMODE_2 0x04
  171. #define CLOCKGEN_TVMODE_2 0x02
  172.  
  173. #define MVCOMMAND_STOP 0x0
  174. #define MVCOMMAND_PAUSE 0x1
  175. #define MVCOMMAND_START 0x3
  176. #define MVCOMMAND_PLAYINTRA 0x4
  177. #define MVCOMMAND_SYNC 0x6
  178. #define MVCOMMAND_FLUSHBUF 0x10
  179. #define MVCOMMAND_DISPLAYBUFINFO 0x11
  180.  
  181. #define MACOMMAND_STOP 0x0
  182. #define MACOMMAND_PAUSE 0x1
  183. #define MACOMMAND_PLAY 0x2
  184.  
  185. #define IRQSTATUS_VIDEO_VBL 0x10
  186. #define IRQSTATUS_VIDEO_FIFO 0x2
  187. #define IRQSTATUS_AUDIO_FIFO 0x8
  188.  
  189. #define ENCODER_UNKNOWN 0
  190. #define ENCODER_ADV7175 1 
  191. #define ENCODER_ADV7170 2
  192. #define ENCODER_BT865   3
  193.  
  194. #ifdef __KERNEL__
  195.  
  196. #define EM8300_VERSION "cvs-20021026"
  197. #define EM8300_MAX 4
  198. #define EM8300_MAJOR 121
  199. #define EM8300_LOGNAME "em8300"
  200.  
  201. struct dicom_s {
  202.     int luma;
  203.     int chroma;
  204.     int frametop;
  205.     int framebottom;
  206.     int frameleft;
  207.     int frameright;
  208.     int visibletop;
  209.     int visiblebottom;
  210.     int visibleleft;
  211.     int visibleright;
  212.     int tvout;
  213. };
  214.  
  215. struct displaybuffer_info_s {
  216.     int xsize;
  217.     int ysize;
  218.     int xsize2;
  219.     int flag1,flag2;
  220.     int buffer1;
  221.     int buffer2;
  222.     int unk_present;
  223.     int unknown1;
  224.     int unknown2;
  225.     int unknown3;
  226. };
  227.  
  228. struct em8300_audio_s {
  229.     int channels;
  230.     int format;
  231.     int speed;
  232.     int slotsize;
  233.     int enable_bits;
  234. };
  235.  
  236. struct em8300_s
  237. {
  238.     char name[40];
  239.     int card;
  240.  
  241.     int chip_revision;
  242.     int pci_revision;
  243.     
  244.     int inuse[4];
  245.     int nonblock[4];
  246.     int ucodeloaded;
  247.     
  248.     struct pci_dev *dev;
  249.     ulong adr;
  250.     volatile unsigned *mem;
  251.     ulong memsize;
  252.     
  253.     int playmode;
  254.     
  255.     /* Fifos */
  256.     struct fifo_s *mvfifo;
  257.     struct fifo_s *mafifo;
  258.     struct fifo_s *spfifo;
  259.     int mtrr_reg;
  260.     
  261.     /* DICOM */
  262.     int dicom_vertoffset;
  263.     int dicom_horizoffset;
  264.     int dicom_brightness;
  265.     int dicom_contrast;
  266.     int dicom_saturation;
  267.     int dicom_tvout;
  268.     struct displaybuffer_info_s dbuf_info;
  269.     
  270.     /* I2C */
  271.     int i2c_pin_reg;
  272.     int i2c_oe_reg;
  273.     
  274.     /* different between revision 1 and revision 2 boards */
  275.     int mystery_divisor;
  276.     
  277.     /* I2C bus 1*/
  278.     struct i2c_algo_bit_data i2c_data_1;
  279.     struct i2c_adapter i2c_ops_1;
  280.     
  281.     /* I2C bus 2*/
  282.     struct i2c_algo_bit_data i2c_data_2;
  283.     struct i2c_adapter i2c_ops_2;
  284.     
  285.     /* I2C clients */
  286.     int encoder_type;
  287.     struct i2c_client *encoder;
  288.     
  289.     /* Microcode registers */
  290.     unsigned ucode_regs[MAX_UCODE_REGISTER];
  291.     int var_ucode_reg1; /* These are registers that differ */
  292.     int var_ucode_reg2; /* between versions 1 and 2 of the board */
  293.     int var_ucode_reg3; /* " */
  294.     
  295.     /* Interrupt */
  296.     unsigned irqmask;
  297.     
  298.     /* Clockgenerator */
  299.     int clockgen;
  300.     int clockgen_overlaymode;
  301.     int clockgen_tvmode;
  302.     
  303.     /* Timing measurement */
  304.     struct timeval tv, last_status_time;
  305.     long irqtimediff;
  306.     int irqcount;
  307.     int frames;
  308.     int scr;
  309.     
  310.     /* Audio */
  311.     struct em8300_audio_s audio;
  312.     int audio_mode;
  313.         int pcm_mode;
  314.     int dsp_num;
  315. /* */
  316.     int dword_DB4;
  317.     unsigned char byte_D90[24];
  318.     
  319.     /* Video */
  320.     int video_mode;
  321.     int video_playmode;
  322.     int aspect_ratio;
  323.     uint32_t video_pts;
  324.     uint32_t video_lastpts;
  325.     int video_ptsvalid,video_offset,video_count;
  326.     int video_ptsfifo_ptr;
  327.     wait_queue_head_t video_ptsfifo_wait;
  328.     int video_ptsfifo_waiting;
  329.     int video_first;
  330.     int var_video_value;
  331.     
  332.     /* Sub Picture */
  333.     int sp_pts, sp_ptsvalid, sp_count;
  334.     int sp_ptsfifo_ptr;
  335.     wait_queue_head_t sp_ptsfifo_wait;
  336.     int sp_ptsfifo_waiting;
  337.     int sp_mode;
  338.     
  339.     int linecounter;
  340.  
  341.     wait_queue_head_t vbi_wait;
  342.     struct list_head memory;
  343.  
  344.     /* EM9010 overlay processor */
  345.     int overlay_enabled;
  346.     int overlay_mode;
  347.     int overlay_gamma_enable;
  348.     int overlay_xres;
  349.     int overlay_yres;
  350.     int overlay_frame_xpos;
  351.     int overlay_frame_ypos;
  352.     int overlay_frame_width;
  353.     int overlay_frame_height;
  354.     int overlay_a[EM9010_ATTRIBUTE_MAX+1];
  355.     int overlay_double_y;
  356.     int overlay_xcorr_default;
  357.     int overlay_70;
  358.     int overlay_dword_24bb8;
  359. };
  360.  
  361. #define TIMEDIFF(a,b) a.tv_usec - b.tv_usec + \
  362.         1000000 * (a.tv_sec - b.tv_sec)
  363.  
  364.  
  365. /*
  366.   Prototypes
  367. */
  368.  
  369. /* em8300_i2c.c */
  370. int em8300_i2c_init(struct em8300_s *em);
  371. void em8300_i2c_exit(struct em8300_s *em);
  372. void em8300_clockgen_write(struct em8300_s *em, int abyte);
  373.  
  374. void em9010_write(struct em8300_s *em, int reg, int data);
  375. int em9010_read(struct em8300_s *em, int reg);
  376. int em9010_read16(struct em8300_s *em, int reg);
  377. void em9010_write16(struct em8300_s *em, int reg, int value);
  378.  
  379. /* em8300_audio.c */
  380. int em8300_audio_ioctl(struct em8300_s *em,unsigned int cmd, unsigned long arg);
  381. int em8300_audio_flush(struct em8300_s *em);
  382. int em8300_audio_open(struct em8300_s *em);
  383. int em8300_audio_release(struct em8300_s *em);
  384. int em8300_audio_setup(struct em8300_s *em);
  385. int em8300_audio_write(struct em8300_s *em, const char * buf,
  386.                size_t count, loff_t *ppos);
  387. int mpegaudio_command(struct em8300_s *em, int cmd);
  388.  
  389. /* em8300_ucode.c */
  390. int em8300_ucode_upload(struct em8300_s *em, void *ucode_user, int ucode_size);
  391.  
  392. /* em8300_misc.c */
  393. int em8300_setregblock(struct em8300_s *em, int offset, int val, int len);
  394. int em8300_writeregblock(struct em8300_s *em, int offset, unsigned *buf, int len);
  395. int em8300_waitfor(struct em8300_s *em, int reg, int val, int mask);
  396. int em8300_waitfor_not(struct em8300_s *em, int reg, int val, int mask);
  397.  
  398. /* em8300_dicom.c */
  399. void em8300_dicom_setBCS(struct em8300_s *em, int brightness, int contrast, int saturation);
  400. void em8300_dicom_enable(struct em8300_s *em);
  401. void em8300_dicom_disable(struct em8300_s *em);
  402. int em8300_dicom_update(struct em8300_s *em);
  403. void em8300_dicom_init(struct em8300_s *em);
  404. int em8300_dicom_get_dbufinfo(struct em8300_s *em);
  405. void em8300_dicom_fill_dispbuffers(struct em8300_s *em, int xpos, int ypos, int xsize,
  406.                   int ysize, unsigned int pat1, unsigned int pat2);
  407.  
  408. /* em8300_video.c */
  409. void em8300_video_open(struct em8300_s *em);
  410. int em8300_video_setplaymode(struct em8300_s *em, int mode);
  411. int em8300_video_sync(struct em8300_s *em);
  412. int em8300_video_flush(struct em8300_s *em);
  413. int em8300_video_setup(struct em8300_s *em);
  414. int em8300_video_release(struct em8300_s *em);
  415. void em8300_video_setspeed(struct em8300_s *em, int speed);
  416. int em8300_video_write(struct em8300_s *em, const char * buf,
  417.                size_t count, loff_t *ppos);
  418. int em8300_video_ioctl(struct em8300_s *em, unsigned int cmd, unsigned long arg);
  419. void em8300_video_check_ptsfifo(struct em8300_s *em);
  420.  
  421. /* em8300_spu.c */
  422. int em8300_spu_write(struct em8300_s *em, const char * buf,
  423.                size_t count, loff_t *ppos);
  424. int em8300_spu_open(struct em8300_s *em);
  425. int em8300_spu_ioctl(struct em8300_s *em, unsigned int cmd, unsigned long arg);
  426. int em8300_spu_init(struct em8300_s *em);
  427. void em8300_spu_check_ptsfifo(struct em8300_s *em);
  428. int em8300_ioctl_setspumode(struct em8300_s *em, int mode);
  429. void em8300_spu_release(struct em8300_s *em);
  430.  
  431. /* em8300_ioctl.c */
  432. int em8300_control_ioctl(struct em8300_s *em, int cmd, unsigned long arg);
  433. int em8300_ioctl_setvideomode(struct em8300_s *em, int mode);
  434. int em8300_ioctl_setaspectratio(struct em8300_s *em, int ratio);
  435. void em8300_ioctl_getstatus(struct em8300_s *em, char *usermsg);
  436. int em8300_ioctl_init(struct em8300_s *em, em8300_microcode_t *useruc);
  437. void em8300_ioctl_enable_videoout(struct em8300_s *em, int mode);
  438. int em8300_ioctl_setplaymode(struct em8300_s *em, int mode);
  439. int em8300_ioctl_setaudiomode(struct em8300_s *em, int mode);
  440. int em8300_ioctl_getaudiomode(struct em8300_s *em, int mode);
  441. int em8300_ioctl_overlay_calibrate(struct em8300_s *em, em8300_overlay_calibrate_t *c);
  442. int em8300_ioctl_overlay_setwindow(struct em8300_s *em,em8300_overlay_window_t *w);
  443. int em8300_ioctl_overlay_setscreen(struct em8300_s *em,em8300_overlay_screen_t *s);
  444. int em8300_ioctl_overlay_setmode(struct em8300_s *em,int val);
  445.  
  446. /* em9010.c */
  447. int em9010_cabledetect(struct em8300_s *em);
  448. int em9010_calibrate_xoffset(struct em8300_s *em);
  449. int em9010_calibrate_yoffset(struct em8300_s *em);
  450. int em9010_init(struct em8300_s *em);
  451. int em9010_overlay_set_signalmode(struct em8300_s *em, int val);
  452. int em9010_overlay_update(struct em8300_s *em);
  453. int em9010_overlay_set_res(struct em8300_s *em, int xres, int yres);
  454. void sub_4288c(struct em8300_s *em, int pa, int pb, int pc, int pd, int pe, int pf,
  455.            int pg, int ph);
  456. int em9010_get_attribute(struct em8300_s *em, int attribute);
  457. int em9010_set_attribute(struct em8300_s *em, int attribute, int value);
  458.  
  459. #endif /* __KERNEL__ */
  460.  
  461. #endif /* LINUX_EM8300_H */
  462.