ioctl_bt848.h revision 59013
123599Smarkm/* 223599Smarkm * extensions to ioctl_meteor.h for the bt848 cards 339838Ssos * 450477Speter * $FreeBSD: head/sys/dev/bktr/ioctl_bt848.h 59013 2000-04-04 16:46:19Z roger $ 523599Smarkm */ 623599Smarkm 759013Sroger#ifndef _MACHINE_IOCTL_BT848_H_ 859013Sroger#define _MACHINE_IOCTL_BT848_H_ 959013Sroger 1023599Smarkm/* 1124086Sfsmp * frequency sets 1223599Smarkm */ 1324086Sfsmp#define CHNLSET_NABCST 1 1424086Sfsmp#define CHNLSET_CABLEIRC 2 1524086Sfsmp#define CHNLSET_CABLEHRC 3 1624086Sfsmp#define CHNLSET_WEUROPE 4 1730193Smarkm#define CHNLSET_JPNBCST 5 1830193Smarkm#define CHNLSET_JPNCABLE 6 1939040Ssos#define CHNLSET_XUSSR 7 2047297Sroger#define CHNLSET_AUSTRALIA 8 2156532Sroger#define CHNLSET_FRANCE 9 2230193Smarkm#define CHNLSET_MIN CHNLSET_NABCST 2356532Sroger#define CHNLSET_MAX CHNLSET_FRANCE 2423599Smarkm 2523599Smarkm 2623599Smarkm/* 2723936Sfsmp * constants for various tuner registers 2823936Sfsmp */ 2923936Sfsmp#define BT848_HUEMIN (-90) 3023936Sfsmp#define BT848_HUEMAX 90 3123936Sfsmp#define BT848_HUECENTER 0 3223936Sfsmp#define BT848_HUERANGE 179.3 3323936Sfsmp#define BT848_HUEREGMIN (-128) 3423936Sfsmp#define BT848_HUEREGMAX 127 3523936Sfsmp#define BT848_HUESTEPS 256 3623936Sfsmp 3723936Sfsmp#define BT848_BRIGHTMIN (-50) 3823936Sfsmp#define BT848_BRIGHTMAX 50 3923936Sfsmp#define BT848_BRIGHTCENTER 0 4023936Sfsmp#define BT848_BRIGHTRANGE 99.6 4123936Sfsmp#define BT848_BRIGHTREGMIN (-128) 4223936Sfsmp#define BT848_BRIGHTREGMAX 127 4323936Sfsmp#define BT848_BRIGHTSTEPS 256 4423936Sfsmp 4523936Sfsmp#define BT848_CONTRASTMIN 0 4623936Sfsmp#define BT848_CONTRASTMAX 237 4723936Sfsmp#define BT848_CONTRASTCENTER 100 4823936Sfsmp#define BT848_CONTRASTRANGE 236.57 4923936Sfsmp#define BT848_CONTRASTREGMIN 0 5023936Sfsmp#define BT848_CONTRASTREGMAX 511 5123936Sfsmp#define BT848_CONTRASTSTEPS 512 5223936Sfsmp 5323936Sfsmp#define BT848_CHROMAMIN 0 5423936Sfsmp#define BT848_CHROMAMAX 284 5523936Sfsmp#define BT848_CHROMACENTER 100 5623936Sfsmp#define BT848_CHROMARANGE 283.89 5723936Sfsmp#define BT848_CHROMAREGMIN 0 5823936Sfsmp#define BT848_CHROMAREGMAX 511 5923936Sfsmp#define BT848_CHROMASTEPS 512 6023936Sfsmp 6123936Sfsmp#define BT848_SATUMIN 0 6223936Sfsmp#define BT848_SATUMAX 202 6323936Sfsmp#define BT848_SATUCENTER 100 6423936Sfsmp#define BT848_SATURANGE 201.18 6523936Sfsmp#define BT848_SATUREGMIN 0 6623936Sfsmp#define BT848_SATUREGMAX 511 6723936Sfsmp#define BT848_SATUSTEPS 512 6823936Sfsmp 6923936Sfsmp#define BT848_SATVMIN 0 7023936Sfsmp#define BT848_SATVMAX 284 7123936Sfsmp#define BT848_SATVCENTER 100 7223936Sfsmp#define BT848_SATVRANGE 283.89 7323936Sfsmp#define BT848_SATVREGMIN 0 7423936Sfsmp#define BT848_SATVREGMAX 511 7523936Sfsmp#define BT848_SATVSTEPS 512 7623936Sfsmp 7723936Sfsmp 7824086Sfsmp/* 7924086Sfsmp * audio stuff 8024086Sfsmp */ 8124086Sfsmp#define AUDIO_TUNER 0x00 /* command for the audio routine */ 8224086Sfsmp#define AUDIO_EXTERN 0x01 /* don't confuse them with bit */ 8324086Sfsmp#define AUDIO_INTERN 0x02 /* settings */ 8424086Sfsmp#define AUDIO_MUTE 0x80 8524086Sfsmp#define AUDIO_UNMUTE 0x81 8624086Sfsmp 8724086Sfsmp 8824086Sfsmp/* 8924086Sfsmp * EEProm stuff 9024086Sfsmp */ 9124045Sfsmpstruct eeProm { 9224244Sfsmp short offset; 9324244Sfsmp short count; 9424244Sfsmp u_char bytes[ 256 ]; 9524045Sfsmp}; 9624045Sfsmp 9724045Sfsmp 9823936Sfsmp/* 9923599Smarkm * XXX: this is a hack, should be in ioctl_meteor.h 10023599Smarkm * here to avoid touching that file for now... 10123599Smarkm */ 10223599Smarkm#define TVTUNER_SETCHNL _IOW('x', 32, unsigned int) /* set channel */ 10323599Smarkm#define TVTUNER_GETCHNL _IOR('x', 32, unsigned int) /* get channel */ 10423599Smarkm#define TVTUNER_SETTYPE _IOW('x', 33, unsigned int) /* set tuner type */ 10523599Smarkm#define TVTUNER_GETTYPE _IOR('x', 33, unsigned int) /* get tuner type */ 10623599Smarkm#define TVTUNER_GETSTATUS _IOR('x', 34, unsigned int) /* get tuner status */ 10723936Sfsmp#define TVTUNER_SETFREQ _IOW('x', 35, unsigned int) /* set frequency */ 10823936Sfsmp#define TVTUNER_GETFREQ _IOR('x', 36, unsigned int) /* get frequency */ 10943889Sroger 11023599Smarkm 11124086Sfsmp#define BT848_SHUE _IOW('x', 37, int) /* set hue */ 11224086Sfsmp#define BT848_GHUE _IOR('x', 37, int) /* get hue */ 11323936Sfsmp#define BT848_SBRIG _IOW('x', 38, int) /* set brightness */ 11424086Sfsmp#define BT848_GBRIG _IOR('x', 38, int) /* get brightness */ 11523936Sfsmp#define BT848_SCSAT _IOW('x', 39, int) /* set chroma sat */ 11624086Sfsmp#define BT848_GCSAT _IOR('x', 39, int) /* get UV saturation */ 11724086Sfsmp#define BT848_SCONT _IOW('x', 40, int) /* set contrast */ 11823936Sfsmp#define BT848_GCONT _IOR('x', 40, int) /* get contrast */ 11923936Sfsmp#define BT848_SVSAT _IOW('x', 41, int) /* set chroma V sat */ 12024086Sfsmp#define BT848_GVSAT _IOR('x', 41, int) /* get V saturation */ 12123936Sfsmp#define BT848_SUSAT _IOW('x', 42, int) /* set chroma U sat */ 12224086Sfsmp#define BT848_GUSAT _IOR('x', 42, int) /* get U saturation */ 12323936Sfsmp 12424045Sfsmp#define BT848_SCBARS _IOR('x', 43, int) /* set colorbar */ 12524045Sfsmp#define BT848_CCBARS _IOR('x', 44, int) /* clear colorbar */ 12623936Sfsmp 12724045Sfsmp 12824086Sfsmp#define BT848_SAUDIO _IOW('x', 46, int) /* set audio channel */ 12924086Sfsmp#define BT848_GAUDIO _IOR('x', 47, int) /* get audio channel */ 13024086Sfsmp#define BT848_SBTSC _IOW('x', 48, int) /* set audio channel */ 13124086Sfsmp 13224244Sfsmp#define BT848_GSTATUS _IOR('x', 49, unsigned int) /* reap status */ 13324244Sfsmp 13424528Sfsmp#define BT848_WEEPROM _IOWR('x', 50, struct eeProm) /* write to EEProm */ 13524528Sfsmp#define BT848_REEPROM _IOWR('x', 51, struct eeProm) /* read from EEProm */ 13624244Sfsmp 13724528Sfsmp#define BT848_SIGNATURE _IOWR('x', 52, struct eeProm) /* read card sig */ 13824528Sfsmp 13924528Sfsmp#define TVTUNER_SETAFC _IOW('x', 53, int) /* turn AFC on/off */ 14024528Sfsmp#define TVTUNER_GETAFC _IOR('x', 54, int) /* query AFC on/off */ 14129233Smarkm#define BT848_SLNOTCH _IOW('x', 55, int) /* set luma notch */ 14229233Smarkm#define BT848_GLNOTCH _IOR('x', 56, int) /* get luma notch */ 14324528Sfsmp 14444063Sroger/* Read/Write the BT848's I2C bus directly 14544063Sroger * b7-b0: data (read/write) 14644063Sroger * b15-b8: internal peripheral register (write) 14744063Sroger * b23-b16: i2c addr (write) 14844063Sroger * b31-b24: 1 = write, 0 = read 14944063Sroger */ 15044063Sroger#define BT848_I2CWR _IOWR('x', 57, u_long) /* i2c read-write */ 15143889Sroger 15244063Sroger/* Support for radio tuner */ 15344063Sroger#define RADIO_SETMODE _IOW('x', 58, unsigned int) /* set radio modes */ 15444063Sroger#define RADIO_GETMODE _IOR('x', 58, unsigned char) /* get radio modes */ 15544063Sroger#define RADIO_AFC 0x01 /* These modes will probably not */ 15644063Sroger#define RADIO_MONO 0x02 /* work on the FRxxxx. It does */ 15744063Sroger#define RADIO_MUTE 0x08 /* work on the FMxxxx. */ 15844063Sroger#define RADIO_SETFREQ _IOW('x', 59, unsigned int) /* set frequency */ 15944063Sroger#define RADIO_GETFREQ _IOR('x', 59, unsigned int) /* set frequency */ 16044063Sroger /* Argument is frequency*100MHz */ 16143889Sroger 16223599Smarkm/* 16323599Smarkm * XXX: more bad magic, 16423599Smarkm * we need to fix the METEORGINPUT to return something public 16523599Smarkm * duplicate them here for now... 16623599Smarkm */ 16723599Smarkm#define METEOR_DEV0 0x00001000 16823599Smarkm#define METEOR_DEV1 0x00002000 16923599Smarkm#define METEOR_DEV2 0x00004000 17043348Sroger#define METEOR_DEV3 0x00008000 17143348Sroger#define METEOR_DEV_SVIDEO 0x00006000 17225328Sfsmp/* 17325328Sfsmp * right now I don't know were to put these, but as they are suppose to be 17425328Sfsmp * a part of a common video capture interface, these should be relocated to 17525328Sfsmp * another place. Probably most of the METEOR_xxx defines need to be 17625328Sfsmp * renamed and moved to a common header 17725328Sfsmp */ 17825328Sfsmp 17929233Smarkmtypedef enum { METEOR_PIXTYPE_RGB, METEOR_PIXTYPE_YUV, 18031186Sahasty METEOR_PIXTYPE_YUV_PACKED, 18131186Sahasty METEOR_PIXTYPE_YUV_12 } METEOR_PIXTYPE; 18225328Sfsmp 18331186Sahasty 18425328Sfsmpstruct meteor_pixfmt { 18525328Sfsmp u_int index; /* Index in supported pixfmt list */ 18625328Sfsmp METEOR_PIXTYPE type; /* What's the board gonna feed us */ 18725328Sfsmp u_int Bpp; /* Bytes per pixel */ 18825328Sfsmp u_long masks[3]; /* R,G,B or Y,U,V masks, respectively */ 18925328Sfsmp unsigned swap_bytes :1; /* Bytes swapped within shorts */ 19025328Sfsmp unsigned swap_shorts:1; /* Shorts swapped within longs */ 19125328Sfsmp}; 19225328Sfsmp 19325328Sfsmp 19425328Sfsmpstruct bktr_clip { 19525328Sfsmp int x_min; 19625328Sfsmp int x_max; 19725328Sfsmp int y_min; 19825328Sfsmp int y_max; 19925328Sfsmp}; 20025328Sfsmp 20125328Sfsmp#define BT848_MAX_CLIP_NODE 100 20225328Sfsmpstruct _bktr_clip { 20325328Sfsmp struct bktr_clip x[BT848_MAX_CLIP_NODE]; 20425328Sfsmp}; 20525328Sfsmp 20625328Sfsmp/* 20725328Sfsmp * I'm using METEOR_xxx just because that will be common to other interface 20825328Sfsmp * and less of a surprise 20925328Sfsmp */ 21025328Sfsmp#define METEORSACTPIXFMT _IOW('x', 64, int ) 21125328Sfsmp#define METEORGACTPIXFMT _IOR('x', 64, int ) 21225328Sfsmp#define METEORGSUPPIXFMT _IOWR('x', 65, struct meteor_pixfmt) 21325328Sfsmp 21425328Sfsmp/* set clip list */ 21525328Sfsmp#define BT848SCLIP _IOW('x', 66, struct _bktr_clip ) 21625328Sfsmp#define BT848GCLIP _IOR('x', 66, struct _bktr_clip ) 21730193Smarkm 21830193Smarkm 21930193Smarkm/* set input format */ 22030193Smarkm#define BT848SFMT _IOW('x', 67, unsigned long ) 22130193Smarkm#define BT848GFMT _IOR('x', 67, unsigned long ) 22230193Smarkm 22336090Sahasty/* set clear-buffer-on-start */ 22436090Sahasty#define BT848SCBUF _IOW('x', 68, int) 22536090Sahasty#define BT848GCBUF _IOR('x', 68, int) 22636090Sahasty 22738706Ssos/* set capture area */ 22838706Ssos/* The capture area is the area of the video image which is grabbed */ 22938706Ssos/* Usually the capture area is 640x480 (768x576 PAL) pixels */ 23038706Ssos/* This area is then scaled to the dimensions the user requires */ 23138706Ssos/* using the METEORGEO ioctl */ 23238706Ssos/* However, the capture area could be 400x300 pixels from the top right */ 23338706Ssos/* corner of the video image */ 23438706Ssosstruct bktr_capture_area { 23538706Ssos int x_offset; 23638706Ssos int y_offset; 23738706Ssos int x_size; 23838706Ssos int y_size; 23938706Ssos}; 24038707Ssos#define BT848_SCAPAREA _IOW('x', 69, struct bktr_capture_area) 24138707Ssos#define BT848_GCAPAREA _IOR('x', 69, struct bktr_capture_area) 24236090Sahasty 24344063Sroger 24444063Sroger/* Get channel Set */ 24544063Sroger#define BT848_MAX_CHNLSET_NAME_LEN 16 24644063Srogerstruct bktr_chnlset { 24744063Sroger short index; 24844063Sroger short max_channel; 24944063Sroger char name[BT848_MAX_CHNLSET_NAME_LEN]; 25044063Sroger}; 25144063Sroger#define TVTUNER_GETCHNLSET _IOWR('x', 70, struct bktr_chnlset) 25244063Sroger 25344063Sroger 25444063Sroger 25544063Sroger/* Infra Red Remote Control */ 25644063Srogerstruct bktr_remote { 25744063Sroger unsigned char data[3]; 25844063Sroger}; 25944063Sroger#define REMOTE_GETKEY _IOR('x', 71, struct bktr_remote)/*read the remote */ 26044063Sroger /*control receiver*/ 26144063Sroger /*returns raw data*/ 26244063Sroger 26344063Sroger 26444063Sroger/* 26544063Sroger * Direct access to GPIO pins. You must add BKTR_GPIO_ACCESS to your kernel 26644063Sroger * configuration file to use these 26730979Smarkm */ 26844063Sroger#define BT848_GPIO_SET_EN _IOW('x', 72, int) /* set gpio_out_en */ 26944063Sroger#define BT848_GPIO_GET_EN _IOR('x', 73, int) /* get gpio_out_en */ 27044063Sroger#define BT848_GPIO_SET_DATA _IOW('x', 74, int) /* set gpio_data */ 27144063Sroger#define BT848_GPIO_GET_DATA _IOR('x', 75, int) /* get gpio_data */ 27230979Smarkm 27344063Sroger 27444063Sroger 27530193Smarkm/* XXX - Copied from /sys/pci/brktree_reg.h */ 27630193Smarkm#define BT848_IFORM_FORMAT (0x7<<0) 27730193Smarkm# define BT848_IFORM_F_RSVD (0x7) 27830193Smarkm# define BT848_IFORM_F_SECAM (0x6) 27930193Smarkm# define BT848_IFORM_F_PALN (0x5) 28030193Smarkm# define BT848_IFORM_F_PALM (0x4) 28130193Smarkm# define BT848_IFORM_F_PALBDGHI (0x3) 28230193Smarkm# define BT848_IFORM_F_NTSCJ (0x2) 28330193Smarkm# define BT848_IFORM_F_NTSCM (0x1) 28430193Smarkm# define BT848_IFORM_F_AUTO (0x0) 28530193Smarkm 28659013Sroger 28759013Sroger#endif /* _MACHINE_IOCTL_BT848_H_ */ 28859013Sroger 289