1 /* 2 * extensions to ioctl_meteor.h for the bt848 cards 3 * 4 * $FreeBSD: src/sys/dev/bktr/ioctl_bt848.h,v 1.30 2003/12/20 17:12:25 obrien Exp $ 5 * $DragonFly: src/sys/dev/video/bktr/ioctl_bt848.h,v 1.1 2004/05/15 17:54:13 joerg Exp $ 6 */ 7 8 #ifndef _DEV_BKTR_IOCTL_BT848_H_ 9 #define _DEV_BKTR_IOCTL_BT848_H_ 10 11 #include <sys/ioccom.h> 12 13 /* 14 * frequency sets 15 */ 16 #define CHNLSET_NABCST 1 17 #define CHNLSET_CABLEIRC 2 18 #define CHNLSET_CABLEHRC 3 19 #define CHNLSET_WEUROPE 4 20 #define CHNLSET_JPNBCST 5 21 #define CHNLSET_JPNCABLE 6 22 #define CHNLSET_XUSSR 7 23 #define CHNLSET_AUSTRALIA 8 24 #define CHNLSET_FRANCE 9 25 #define CHNLSET_MIN CHNLSET_NABCST 26 #define CHNLSET_MAX CHNLSET_FRANCE 27 28 29 /* 30 * constants for various tuner registers 31 */ 32 #define BT848_HUEMIN (-90) 33 #define BT848_HUEMAX 90 34 #define BT848_HUECENTER 0 35 #define BT848_HUERANGE 179.3 36 #define BT848_HUEREGMIN (-128) 37 #define BT848_HUEREGMAX 127 38 #define BT848_HUESTEPS 256 39 40 #define BT848_BRIGHTMIN (-50) 41 #define BT848_BRIGHTMAX 50 42 #define BT848_BRIGHTCENTER 0 43 #define BT848_BRIGHTRANGE 99.6 44 #define BT848_BRIGHTREGMIN (-128) 45 #define BT848_BRIGHTREGMAX 127 46 #define BT848_BRIGHTSTEPS 256 47 48 #define BT848_CONTRASTMIN 0 49 #define BT848_CONTRASTMAX 237 50 #define BT848_CONTRASTCENTER 100 51 #define BT848_CONTRASTRANGE 236.57 52 #define BT848_CONTRASTREGMIN 0 53 #define BT848_CONTRASTREGMAX 511 54 #define BT848_CONTRASTSTEPS 512 55 56 #define BT848_CHROMAMIN 0 57 #define BT848_CHROMAMAX 284 58 #define BT848_CHROMACENTER 100 59 #define BT848_CHROMARANGE 283.89 60 #define BT848_CHROMAREGMIN 0 61 #define BT848_CHROMAREGMAX 511 62 #define BT848_CHROMASTEPS 512 63 64 #define BT848_SATUMIN 0 65 #define BT848_SATUMAX 202 66 #define BT848_SATUCENTER 100 67 #define BT848_SATURANGE 201.18 68 #define BT848_SATUREGMIN 0 69 #define BT848_SATUREGMAX 511 70 #define BT848_SATUSTEPS 512 71 72 #define BT848_SATVMIN 0 73 #define BT848_SATVMAX 284 74 #define BT848_SATVCENTER 100 75 #define BT848_SATVRANGE 283.89 76 #define BT848_SATVREGMIN 0 77 #define BT848_SATVREGMAX 511 78 #define BT848_SATVSTEPS 512 79 80 81 /* 82 * audio stuff 83 */ 84 #define AUDIO_TUNER 0x00 /* command for the audio routine */ 85 #define AUDIO_EXTERN 0x01 /* don't confuse them with bit */ 86 #define AUDIO_INTERN 0x02 /* settings */ 87 #define AUDIO_MUTE 0x80 88 #define AUDIO_UNMUTE 0x81 89 90 91 /* 92 * EEProm stuff 93 */ 94 struct eeProm { 95 short offset; 96 short count; 97 u_char bytes[ 256 ]; 98 }; 99 100 101 /* 102 * XXX: this is a hack, should be in ioctl_meteor.h 103 * here to avoid touching that file for now... 104 */ 105 #define TVTUNER_SETCHNL _IOW('x', 32, unsigned int) /* set channel */ 106 #define TVTUNER_GETCHNL _IOR('x', 32, unsigned int) /* get channel */ 107 #define TVTUNER_SETTYPE _IOW('x', 33, unsigned int) /* set tuner type */ 108 #define TVTUNER_GETTYPE _IOR('x', 33, unsigned int) /* get tuner type */ 109 #define TVTUNER_GETSTATUS _IOR('x', 34, unsigned int) /* get tuner status */ 110 #define TVTUNER_SETFREQ _IOW('x', 35, unsigned int) /* set frequency */ 111 #define TVTUNER_GETFREQ _IOR('x', 36, unsigned int) /* get frequency */ 112 113 114 #define BT848_SHUE _IOW('x', 37, int) /* set hue */ 115 #define BT848_GHUE _IOR('x', 37, int) /* get hue */ 116 #define BT848_SBRIG _IOW('x', 38, int) /* set brightness */ 117 #define BT848_GBRIG _IOR('x', 38, int) /* get brightness */ 118 #define BT848_SCSAT _IOW('x', 39, int) /* set chroma sat */ 119 #define BT848_GCSAT _IOR('x', 39, int) /* get UV saturation */ 120 #define BT848_SCONT _IOW('x', 40, int) /* set contrast */ 121 #define BT848_GCONT _IOR('x', 40, int) /* get contrast */ 122 #define BT848_SVSAT _IOW('x', 41, int) /* set chroma V sat */ 123 #define BT848_GVSAT _IOR('x', 41, int) /* get V saturation */ 124 #define BT848_SUSAT _IOW('x', 42, int) /* set chroma U sat */ 125 #define BT848_GUSAT _IOR('x', 42, int) /* get U saturation */ 126 127 #define BT848_SCBARS _IOR('x', 43, int) /* set colorbar */ 128 #define BT848_CCBARS _IOR('x', 44, int) /* clear colorbar */ 129 130 131 #define BT848_SAUDIO _IOW('x', 46, int) /* set audio channel */ 132 #define BT848_GAUDIO _IOR('x', 47, int) /* get audio channel */ 133 #define BT848_SBTSC _IOW('x', 48, int) /* set audio channel */ 134 135 #define BT848_GSTATUS _IOR('x', 49, unsigned int) /* reap status */ 136 137 #define BT848_WEEPROM _IOWR('x', 50, struct eeProm) /* write to EEProm */ 138 #define BT848_REEPROM _IOWR('x', 51, struct eeProm) /* read from EEProm */ 139 140 #define BT848_SIGNATURE _IOWR('x', 52, struct eeProm) /* read card sig */ 141 142 #define TVTUNER_SETAFC _IOW('x', 53, int) /* turn AFC on/off */ 143 #define TVTUNER_GETAFC _IOR('x', 54, int) /* query AFC on/off */ 144 #define BT848_SLNOTCH _IOW('x', 55, int) /* set luma notch */ 145 #define BT848_GLNOTCH _IOR('x', 56, int) /* get luma notch */ 146 147 /* Read/Write the BT848's I2C bus directly 148 * b7-b0: data (read/write) 149 * b15-b8: internal peripheral register (write) 150 * b23-b16: i2c addr (write) 151 * b31-b24: 1 = write, 0 = read 152 */ 153 #define BT848_I2CWR _IOWR('x', 57, u_long) /* i2c read-write */ 154 155 struct bktr_msp_control { 156 unsigned char function; 157 unsigned int address; 158 unsigned int data; 159 }; 160 161 #define BT848_MSP_RESET _IO('x', 76) /* MSP chip reset */ 162 #define BT848_MSP_READ _IOWR('x', 77, struct bktr_msp_control) /* MSP chip read */ 163 #define BT848_MSP_WRITE _IOWR('x', 78, struct bktr_msp_control) /* MSP chip write */ 164 165 /* Support for radio tuner */ 166 #define RADIO_SETMODE _IOW('x', 58, unsigned int) /* set radio modes */ 167 #define RADIO_GETMODE _IOR('x', 58, unsigned char) /* get radio modes */ 168 #define RADIO_AFC 0x01 /* These modes will probably not */ 169 #define RADIO_MONO 0x02 /* work on the FRxxxx. It does */ 170 #define RADIO_MUTE 0x08 /* work on the FMxxxx. */ 171 #define RADIO_SETFREQ _IOW('x', 59, unsigned int) /* set frequency */ 172 #define RADIO_GETFREQ _IOR('x', 59, unsigned int) /* set frequency */ 173 /* Argument is frequency*100MHz */ 174 175 /* 176 * XXX: more bad magic, 177 * we need to fix the METEORGINPUT to return something public 178 * duplicate them here for now... 179 */ 180 #define METEOR_DEV0 0x00001000 181 #define METEOR_DEV1 0x00002000 182 #define METEOR_DEV2 0x00004000 183 #define METEOR_DEV3 0x00008000 184 #define METEOR_DEV_SVIDEO 0x00006000 185 /* 186 * right now I don't know were to put these, but as they are suppose to be 187 * a part of a common video capture interface, these should be relocated to 188 * another place. Probably most of the METEOR_xxx defines need to be 189 * renamed and moved to a common header 190 */ 191 192 typedef enum { METEOR_PIXTYPE_RGB, METEOR_PIXTYPE_YUV, 193 METEOR_PIXTYPE_YUV_PACKED, 194 METEOR_PIXTYPE_YUV_12 } METEOR_PIXTYPE; 195 196 197 struct meteor_pixfmt { 198 u_int index; /* Index in supported pixfmt list */ 199 METEOR_PIXTYPE type; /* What's the board gonna feed us */ 200 u_int Bpp; /* Bytes per pixel */ 201 u_long masks[3]; /* R,G,B or Y,U,V masks, respectively */ 202 unsigned swap_bytes :1; /* Bytes swapped within shorts */ 203 unsigned swap_shorts:1; /* Shorts swapped within longs */ 204 }; 205 206 207 struct bktr_clip { 208 int x_min; 209 int x_max; 210 int y_min; 211 int y_max; 212 }; 213 214 #define BT848_MAX_CLIP_NODE 100 215 struct _bktr_clip { 216 struct bktr_clip x[BT848_MAX_CLIP_NODE]; 217 }; 218 219 /* 220 * I'm using METEOR_xxx just because that will be common to other interface 221 * and less of a surprise 222 */ 223 #define METEORSACTPIXFMT _IOW('x', 64, int ) 224 #define METEORGACTPIXFMT _IOR('x', 64, int ) 225 #define METEORGSUPPIXFMT _IOWR('x', 65, struct meteor_pixfmt) 226 227 /* set clip list */ 228 #define BT848SCLIP _IOW('x', 66, struct _bktr_clip ) 229 #define BT848GCLIP _IOR('x', 66, struct _bktr_clip ) 230 231 232 /* set input format */ 233 #define BT848SFMT _IOW('x', 67, unsigned long ) 234 #define BT848GFMT _IOR('x', 67, unsigned long ) 235 236 /* set clear-buffer-on-start */ 237 #define BT848SCBUF _IOW('x', 68, int) 238 #define BT848GCBUF _IOR('x', 68, int) 239 240 /* set capture area */ 241 /* The capture area is the area of the video image which is grabbed */ 242 /* Usually the capture area is 640x480 (768x576 PAL) pixels */ 243 /* This area is then scaled to the dimensions the user requires */ 244 /* using the METEORGEO ioctl */ 245 /* However, the capture area could be 400x300 pixels from the top right */ 246 /* corner of the video image */ 247 struct bktr_capture_area { 248 int x_offset; 249 int y_offset; 250 int x_size; 251 int y_size; 252 }; 253 #define BT848_SCAPAREA _IOW('x', 69, struct bktr_capture_area) 254 #define BT848_GCAPAREA _IOR('x', 69, struct bktr_capture_area) 255 256 257 /* Get channel Set */ 258 #define BT848_MAX_CHNLSET_NAME_LEN 16 259 struct bktr_chnlset { 260 short index; 261 short max_channel; 262 char name[BT848_MAX_CHNLSET_NAME_LEN]; 263 }; 264 #define TVTUNER_GETCHNLSET _IOWR('x', 70, struct bktr_chnlset) 265 266 267 268 /* Infra Red Remote Control */ 269 struct bktr_remote { 270 unsigned char data[3]; 271 }; 272 #define REMOTE_GETKEY _IOR('x', 71, struct bktr_remote)/*read the remote */ 273 /*control receiver*/ 274 /*returns raw data*/ 275 276 277 /* 278 * Direct access to GPIO pins. You must add BKTR_GPIO_ACCESS to your kernel 279 * configuration file to use these 280 */ 281 #define BT848_GPIO_SET_EN _IOW('x', 72, int) /* set gpio_out_en */ 282 #define BT848_GPIO_GET_EN _IOR('x', 73, int) /* get gpio_out_en */ 283 #define BT848_GPIO_SET_DATA _IOW('x', 74, int) /* set gpio_data */ 284 #define BT848_GPIO_GET_DATA _IOR('x', 75, int) /* get gpio_data */ 285 286 287 288 /* XXX - Copied from /sys/pci/brktree_reg.h */ 289 #define BT848_IFORM_FORMAT (0x7<<0) 290 # define BT848_IFORM_F_RSVD (0x7) 291 # define BT848_IFORM_F_SECAM (0x6) 292 # define BT848_IFORM_F_PALN (0x5) 293 # define BT848_IFORM_F_PALM (0x4) 294 # define BT848_IFORM_F_PALBDGHI (0x3) 295 # define BT848_IFORM_F_NTSCJ (0x2) 296 # define BT848_IFORM_F_NTSCM (0x1) 297 # define BT848_IFORM_F_AUTO (0x0) 298 299 300 #endif /* _DEV_BKTR_IOCTL_BT848_H_ */ 301