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