bktr_reg.h revision 50693
123599Smarkm/* 248781Sroger * Copyright (c) 1999 Roger Hardiman 348781Sroger * Copyright (c) 1998 Amancio Hasty 423599Smarkm * Copyright (c) 1995 Mark Tinguely and Jim Lowe 523599Smarkm * All rights reserved. 623599Smarkm * 723599Smarkm * Redistribution and use in source and binary forms, with or without 823599Smarkm * modification, are permitted provided that the following conditions 923599Smarkm * are met: 1023599Smarkm * 1. Redistributions of source code must retain the above copyright 1123599Smarkm * notice, this list of conditions and the following disclaimer. 1223599Smarkm * 2. Redistributions in binary form must reproduce the above copyright 1323599Smarkm * notice, this list of conditions and the following disclaimer in the 1423599Smarkm * documentation and/or other materials provided with the distribution. 1523599Smarkm * 3. All advertising materials mentioning features or use of this software 1623599Smarkm * must display the following acknowledgement: 1723599Smarkm * This product includes software developed by Mark Tinguely and Jim Lowe 1823599Smarkm * 4. The name of the author may not be used to endorse or promote products 1923599Smarkm * derived from this software without specific prior written permission. 2023599Smarkm * 2123599Smarkm * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 2223599Smarkm * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 2323599Smarkm * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 2423599Smarkm * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 2523599Smarkm * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 2623599Smarkm * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 2723599Smarkm * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2823599Smarkm * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 2923599Smarkm * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 3023599Smarkm * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 3123599Smarkm * POSSIBILITY OF SUCH DAMAGE. 3239838Ssos * 3350693Sroger * $Id: brktree_reg.h,v 1.29 1999/06/12 14:54:56 roger Exp $ 3423599Smarkm */ 3523599Smarkm#ifndef PCI_LATENCY_TIMER 3623599Smarkm#define PCI_LATENCY_TIMER 0x0c /* pci timer register */ 3723599Smarkm#endif 3823599Smarkm 3923599Smarkm/* 4047884Sroger * Definitions for the Brooktree 848/878 video capture to pci interface. 4123599Smarkm */ 4243771Sroger#define BROOKTREE_848_PCI_ID 0x0350109E 4343771Sroger#define BROOKTREE_849_PCI_ID 0x0351109E 4443771Sroger#define BROOKTREE_878_PCI_ID 0x036E109E 4543771Sroger#define BROOKTREE_879_PCI_ID 0x036F109E 4623599Smarkm 4743771Sroger#define BROOKTREE_848 1 4843771Sroger#define BROOKTREE_848A 2 4947492Sroger#define BROOKTREE_849A 3 5043771Sroger#define BROOKTREE_878 4 5143771Sroger#define BROOKTREE_879 5 5243771Sroger 5324246Sfsmptypedef volatile u_int bregister_t; 5424246Sfsmp/* 5524246Sfsmp * if other persuasion endian, then compiler will probably require that 5624246Sfsmp * these next 5724246Sfsmp * macros be reversed 5824246Sfsmp */ 5924246Sfsmp#define BTBYTE(what) bregister_t what:8; int :24 6024246Sfsmp#define BTWORD(what) bregister_t what:16; int: 16 6124246Sfsmp#define BTLONG(what) bregister_t what:32 6223599Smarkm 6324246Sfsmpstruct bt848_registers { 6424246Sfsmp BTBYTE (dstatus); /* 0, 1,2,3 */ 6524528Sfsmp#define BT848_DSTATUS_PRES (1<<7) 6624528Sfsmp#define BT848_DSTATUS_HLOC (1<<6) 6724528Sfsmp#define BT848_DSTATUS_FIELD (1<<5) 6824528Sfsmp#define BT848_DSTATUS_NUML (1<<4) 6924528Sfsmp#define BT848_DSTATUS_CSEL (1<<3) 7038707Ssos#define BT848_DSTATUS_PLOCK (1<<2) 7124528Sfsmp#define BT848_DSTATUS_LOF (1<<1) 7224528Sfsmp#define BT848_DSTATUS_COF (1<<0) 7324246Sfsmp BTBYTE (iform); /* 4, 5,6,7 */ 7424528Sfsmp#define BT848_IFORM_MUXSEL (0x3<<5) 7524528Sfsmp# define BT848_IFORM_M_MUX1 (0x03<<5) 7624528Sfsmp# define BT848_IFORM_M_MUX0 (0x02<<5) 7724528Sfsmp# define BT848_IFORM_M_MUX2 (0x01<<5) 7837611Sahasty# define BT848_IFORM_M_MUX3 (0x0) 7924528Sfsmp# define BT848_IFORM_M_RSVD (0x00<<5) 8024528Sfsmp#define BT848_IFORM_XTSEL (0x3<<3) 8124528Sfsmp# define BT848_IFORM_X_AUTO (0x03<<3) 8224528Sfsmp# define BT848_IFORM_X_XT1 (0x02<<3) 8324528Sfsmp# define BT848_IFORM_X_XT0 (0x01<<3) 8424528Sfsmp# define BT848_IFORM_X_RSVD (0x00<<3) 8524246Sfsmp BTBYTE (tdec); /* 8, 9,a,b */ 8624246Sfsmp BTBYTE (e_crop); /* c, d,e,f */ 8724246Sfsmp BTBYTE (e_vdelay_lo); /* 10, 11,12,13 */ 8824246Sfsmp BTBYTE (e_vactive_lo); /* 14, 15,16,17 */ 8924246Sfsmp BTBYTE (e_delay_lo); /* 18, 19,1a,1b */ 9024246Sfsmp BTBYTE (e_hactive_lo); /* 1c, 1d,1e,1f */ 9124246Sfsmp BTBYTE (e_hscale_hi); /* 20, 21,22,23 */ 9224246Sfsmp BTBYTE (e_hscale_lo); /* 24, 25,26,27 */ 9324246Sfsmp BTBYTE (bright); /* 28, 29,2a,2b */ 9424246Sfsmp BTBYTE (e_control); /* 2c, 2d,2e,2f */ 9524528Sfsmp#define BT848_E_CONTROL_LNOTCH (1<<7) 9624528Sfsmp#define BT848_E_CONTROL_COMP (1<<6) 9724528Sfsmp#define BT848_E_CONTROL_LDEC (1<<5) 9824528Sfsmp#define BT848_E_CONTROL_CBSENSE (1<<4) 9924528Sfsmp#define BT848_E_CONTROL_RSVD (1<<3) 10024528Sfsmp#define BT848_E_CONTROL_CON_MSB (1<<2) 10124528Sfsmp#define BT848_E_CONTROL_SAT_U_MSB (1<<1) 10224528Sfsmp#define BT848_E_CONTROL_SAT_V_MSB (1<<0) 10324246Sfsmp BTBYTE (contrast_lo); /* 30, 31,32,33 */ 10424246Sfsmp BTBYTE (sat_u_lo); /* 34, 35,36,37 */ 10524246Sfsmp BTBYTE (sat_v_lo); /* 38, 39,3a,3b */ 10624246Sfsmp BTBYTE (hue); /* 3c, 3d,3e,3f */ 10724246Sfsmp BTBYTE (e_scloop); /* 40, 41,42,43 */ 10824528Sfsmp#define BT848_E_SCLOOP_RSVD1 (1<<7) 10924528Sfsmp#define BT848_E_SCLOOP_CAGC (1<<6) 11024528Sfsmp#define BT848_E_SCLOOP_CKILL (1<<5) 11124528Sfsmp#define BT848_E_SCLOOP_HFILT (0x3<<3) 11224528Sfsmp# define BT848_E_SCLOOP_HFILT_ICON (0x3<<3) 11324528Sfsmp# define BT848_E_SCLOOP_HFILT_QCIF (0x2<<3) 11424528Sfsmp# define BT848_E_SCLOOP_HFILT_CIF (0x1<<3) 11524528Sfsmp# define BT848_E_SCLOOP_HFILT_AUTO (0x0<<3) 11624528Sfsmp#define BT848_E_SCLOOP_RSVD0 (0x7<<0) 11724246Sfsmp int :32; /* 44, 45,46,47 */ 11824246Sfsmp BTBYTE (oform); /* 48, 49,4a,4b */ 11924246Sfsmp BTBYTE (e_vscale_hi); /* 4c, 4d,4e,4f */ 12024246Sfsmp BTBYTE (e_vscale_lo); /* 50, 51,52,53 */ 12124246Sfsmp BTBYTE (test); /* 54, 55,56,57 */ 12224246Sfsmp int :32; /* 58, 59,5a,5b */ 12324246Sfsmp int :32; /* 5c, 5d,5e,5f */ 12424246Sfsmp BTLONG (adelay); /* 60, 61,62,63 */ 12524246Sfsmp BTBYTE (bdelay); /* 64, 65,66,67 */ 12624246Sfsmp BTBYTE (adc); /* 68, 69,6a,6b */ 12724528Sfsmp#define BT848_ADC_RESERVED (0x80) /* required pattern */ 12824528Sfsmp#define BT848_ADC_SYNC_T (1<<5) 12924528Sfsmp#define BT848_ADC_AGC_EN (1<<4) 13024528Sfsmp#define BT848_ADC_CLK_SLEEP (1<<3) 13124528Sfsmp#define BT848_ADC_Y_SLEEP (1<<2) 13224528Sfsmp#define BT848_ADC_C_SLEEP (1<<1) 13324528Sfsmp#define BT848_ADC_CRUSH (1<<0) 13424246Sfsmp BTBYTE (e_vtc); /* 6c, 6d,6e,6f */ 13524246Sfsmp int :32; /* 70, 71,72,73 */ 13624246Sfsmp int :32; /* 74, 75,76,77 */ 13724246Sfsmp int :32; /* 78, 79,7a,7b */ 13824246Sfsmp BTLONG (sreset); /* 7c, 7d,7e,7f */ 13938707Ssos u_char filler1[0x84-0x80]; 14038707Ssos BTBYTE (tgctrl); /* 84, 85,86,87 */ 14138707Ssos#define BT848_TGCTRL_TGCKI (3<<3) 14238707Ssos#define BT848_TGCTRL_TGCKI_XTAL (0<<3) 14338707Ssos#define BT848_TGCTRL_TGCKI_PLL (1<<3) 14438707Ssos#define BT848_TGCTRL_TGCKI_GPCLK (2<<3) 14538707Ssos#define BT848_TGCTRL_TGCKI_GPCLK_I (3<<3) 14638707Ssos u_char filler[0x8c-0x88]; 14724246Sfsmp BTBYTE (o_crop); /* 8c, 8d,8e,8f */ 14824246Sfsmp BTBYTE (o_vdelay_lo); /* 90, 91,92,93 */ 14924246Sfsmp BTBYTE (o_vactive_lo); /* 94, 95,96,97 */ 15024246Sfsmp BTBYTE (o_delay_lo); /* 98, 99,9a,9b */ 15124246Sfsmp BTBYTE (o_hactive_lo); /* 9c, 9d,9e,9f */ 15224246Sfsmp BTBYTE (o_hscale_hi); /* a0, a1,a2,a3 */ 15324246Sfsmp BTBYTE (o_hscale_lo); /* a4, a5,a6,a7 */ 15424246Sfsmp int :32; /* a8, a9,aa,ab */ 15524246Sfsmp BTBYTE (o_control); /* ac, ad,ae,af */ 15624528Sfsmp#define BT848_O_CONTROL_LNOTCH (1<<7) 15724528Sfsmp#define BT848_O_CONTROL_COMP (1<<6) 15824528Sfsmp#define BT848_O_CONTROL_LDEC (1<<5) 15924528Sfsmp#define BT848_O_CONTROL_CBSENSE (1<<4) 16024528Sfsmp#define BT848_O_CONTROL_RSVD (1<<3) 16124528Sfsmp#define BT848_O_CONTROL_CON_MSB (1<<2) 16224528Sfsmp#define BT848_O_CONTROL_SAT_U_MSB (1<<1) 16324528Sfsmp#define BT848_O_CONTROL_SAT_V_MSB (1<<0) 16424246Sfsmp u_char fillter1[16]; 16524246Sfsmp BTBYTE (o_scloop); /* c0, c1,c2,c3 */ 16624528Sfsmp#define BT848_O_SCLOOP_RSVD1 (1<<7) 16724528Sfsmp#define BT848_O_SCLOOP_CAGC (1<<6) 16824528Sfsmp#define BT848_O_SCLOOP_CKILL (1<<5) 16924528Sfsmp#define BT848_O_SCLOOP_HFILT (0x3<<3) 17038707Ssos#define BT848_O_SCLOOP_HFILT_ICON (0x3<<3) 17138707Ssos#define BT848_O_SCLOOP_HFILT_QCIF (0x2<<3) 17238707Ssos#define BT848_O_SCLOOP_HFILT_CIF (0x1<<3) 17338707Ssos#define BT848_O_SCLOOP_HFILT_AUTO (0x0<<3) 17424528Sfsmp#define BT848_O_SCLOOP_RSVD0 (0x7<<0) 17524246Sfsmp int :32; /* c4, c5,c6,c7 */ 17624246Sfsmp int :32; /* c8, c9,ca,cb */ 17724246Sfsmp BTBYTE (o_vscale_hi); /* cc, cd,ce,cf */ 17824246Sfsmp BTBYTE (o_vscale_lo); /* d0, d1,d2,d3 */ 17924246Sfsmp BTBYTE (color_fmt); /* d4, d5,d6,d7 */ 18025329Sfsmp bregister_t color_ctl_swap :4; /* d8 */ 18124528Sfsmp#define BT848_COLOR_CTL_WSWAP_ODD (1<<3) 18224528Sfsmp#define BT848_COLOR_CTL_WSWAP_EVEN (1<<2) 18324528Sfsmp#define BT848_COLOR_CTL_BSWAP_ODD (1<<1) 18424528Sfsmp#define BT848_COLOR_CTL_BSWAP_EVEN (1<<0) 18525329Sfsmp bregister_t color_ctl_gamma :1; 18625329Sfsmp bregister_t color_ctl_rgb_ded :1; 18725329Sfsmp bregister_t color_ctl_color_bars :1; 18825329Sfsmp bregister_t color_ctl_ext_frmrate :1; 18925329Sfsmp int :24; /* d9,da,db */ 19024246Sfsmp BTBYTE (cap_ctl); /* dc, dd,de,df */ 19124528Sfsmp#define BT848_CAP_CTL_DITH_FRAME (1<<4) 19224528Sfsmp#define BT848_CAP_CTL_VBI_ODD (1<<3) 19324528Sfsmp#define BT848_CAP_CTL_VBI_EVEN (1<<2) 19424528Sfsmp#define BT848_CAP_CTL_ODD (1<<1) 19524528Sfsmp#define BT848_CAP_CTL_EVEN (1<<0) 19624246Sfsmp BTBYTE (vbi_pack_size); /* e0, e1,e2,e3 */ 19724246Sfsmp BTBYTE (vbi_pack_del); /* e4, e5,e6,e7 */ 19824246Sfsmp int :32; /* e8, e9,ea,eb */ 19924246Sfsmp BTBYTE (o_vtc); /* ec, ed,ee,ef */ 20038707Ssos BTBYTE (pll_f_lo); /* f0, f1,f2,f3 */ 20138707Ssos BTBYTE (pll_f_hi); /* f4, f5,f6,f7 */ 20238707Ssos BTBYTE (pll_f_xci); /* f8, f9,fa,fb */ 20338707Ssos#define BT848_PLL_F_C (1<<6) 20438707Ssos#define BT848_PLL_F_X (1<<7) 20538707Ssos u_char filler2[0x100-0xfc]; 20624246Sfsmp BTLONG (int_stat); /* 100, 101,102,103 */ 20724246Sfsmp BTLONG (int_mask); /* 104, 105,106,107 */ 20824528Sfsmp#define BT848_INT_RISCS (0xf<<28) 20924528Sfsmp#define BT848_INT_RISC_EN (1<<27) 21024528Sfsmp#define BT848_INT_RACK (1<<25) 21124528Sfsmp#define BT848_INT_FIELD (1<<24) 21224528Sfsmp#define BT848_INT_MYSTERYBIT (1<<23) 21324528Sfsmp#define BT848_INT_SCERR (1<<19) 21424528Sfsmp#define BT848_INT_OCERR (1<<18) 21524528Sfsmp#define BT848_INT_PABORT (1<<17) 21624528Sfsmp#define BT848_INT_RIPERR (1<<16) 21724528Sfsmp#define BT848_INT_PPERR (1<<15) 21824528Sfsmp#define BT848_INT_FDSR (1<<14) 21924528Sfsmp#define BT848_INT_FTRGT (1<<13) 22024528Sfsmp#define BT848_INT_FBUS (1<<12) 22124528Sfsmp#define BT848_INT_RISCI (1<<11) 22224528Sfsmp#define BT848_INT_GPINT (1<<9) 22324528Sfsmp#define BT848_INT_I2CDONE (1<<8) 22424528Sfsmp#define BT848_INT_RSV1 (1<<7) 22524528Sfsmp#define BT848_INT_RSV0 (1<<6) 22624528Sfsmp#define BT848_INT_VPRES (1<<5) 22724528Sfsmp#define BT848_INT_HLOCK (1<<4) 22824528Sfsmp#define BT848_INT_OFLOW (1<<3) 22924528Sfsmp#define BT848_INT_HSYNC (1<<2) 23024528Sfsmp#define BT848_INT_VSYNC (1<<1) 23124528Sfsmp#define BT848_INT_FMTCHG (1<<0) 23224246Sfsmp int :32; /* 108, 109,10a,10b */ 23324246Sfsmp BTWORD (gpio_dma_ctl); /* 10c, 10d,10e,10f */ 23429233Smarkm#define BT848_DMA_CTL_PL23TP4 (0<<6) /* planar1 trigger 4 */ 23529233Smarkm#define BT848_DMA_CTL_PL23TP8 (1<<6) /* planar1 trigger 8 */ 23629233Smarkm#define BT848_DMA_CTL_PL23TP16 (2<<6) /* planar1 trigger 16 */ 23729233Smarkm#define BT848_DMA_CTL_PL23TP32 (3<<6) /* planar1 trigger 32 */ 23829233Smarkm#define BT848_DMA_CTL_PL1TP4 (0<<4) /* planar1 trigger 4 */ 23929233Smarkm#define BT848_DMA_CTL_PL1TP8 (1<<4) /* planar1 trigger 8 */ 24029233Smarkm#define BT848_DMA_CTL_PL1TP16 (2<<4) /* planar1 trigger 16 */ 24129233Smarkm#define BT848_DMA_CTL_PL1TP32 (3<<4) /* planar1 trigger 32 */ 24229233Smarkm#define BT848_DMA_CTL_PKTP4 (0<<2) /* packed trigger 4 */ 24329233Smarkm#define BT848_DMA_CTL_PKTP8 (1<<2) /* packed trigger 8 */ 24429233Smarkm#define BT848_DMA_CTL_PKTP16 (2<<2) /* packed trigger 16 */ 24529233Smarkm#define BT848_DMA_CTL_PKTP32 (3<<2) /* packed trigger 32 */ 24624528Sfsmp#define BT848_DMA_CTL_RISC_EN (1<<1) 24724528Sfsmp#define BT848_DMA_CTL_FIFO_EN (1<<0) 24824246Sfsmp BTLONG (i2c_data_ctl); /* 110, 111,112,113 */ 24924528Sfsmp#define BT848_DATA_CTL_I2CDIV (0xf<<4) 25024528Sfsmp#define BT848_DATA_CTL_I2CSYNC (1<<3) 25124528Sfsmp#define BT848_DATA_CTL_I2CW3B (1<<2) 25224528Sfsmp#define BT848_DATA_CTL_I2CSCL (1<<1) 25324528Sfsmp#define BT848_DATA_CTL_I2CSDA (1<<0) 25424246Sfsmp BTLONG (risc_strt_add); /* 114, 115,116,117 */ 25524246Sfsmp BTLONG (gpio_out_en); /* 118, 119,11a,11b */ /* really 24 bits */ 25624246Sfsmp BTLONG (gpio_reg_inp); /* 11c, 11d,11e,11f */ /* really 24 bits */ 25724246Sfsmp BTLONG (risc_count); /* 120, 121,122,123 */ 25824246Sfsmp u_char filler3[0x200-0x124]; 25924246Sfsmp BTLONG (gpio_data); /* 200, 201,202,203 */ /* really 24 bits */ 26024246Sfsmp}; 26123599Smarkm 26224528Sfsmptypedef volatile struct bt848_registers* bt848_ptr_t; 26324246Sfsmp 26424246Sfsmp 26524528Sfsmp#if 0 26624528Sfsmp/* force people to be aware of the new struct */ 26724528Sfsmp 26824087Sfsmp#define BKTR_DSTATUS 0x000 26924087Sfsmp#define BKTR_IFORM 0x004 27024087Sfsmp#define BKTR_TDEC 0x008 27124087Sfsmp#define BKTR_EVEN_CROP 0x00C 27224087Sfsmp#define BKTR_ODD_CROP 0x08C 27324087Sfsmp#define BKTR_E_VDELAY_LO 0x010 27424087Sfsmp#define BKTR_O_VDELAY_LO 0x090 27524087Sfsmp#define BKTR_E_VACTIVE_LO 0x014 27624087Sfsmp#define BKTR_O_VACTIVE_LO 0x094 27724087Sfsmp#define BKTR_E_DELAY_LO 0x018 27824087Sfsmp#define BKTR_O_DELAY_LO 0x098 27924087Sfsmp#define BKTR_E_HACTIVE_LO 0x01C 28024087Sfsmp#define BKTR_O_HACTIVE_LO 0x09C 28124087Sfsmp#define BKTR_E_HSCALE_HI 0x020 28224087Sfsmp#define BKTR_O_HSCALE_HI 0x0A0 28324087Sfsmp#define BKTR_E_HSCALE_LO 0x024 28424087Sfsmp#define BKTR_O_HSCALE_LO 0x0A4 28524087Sfsmp#define BKTR_BRIGHT 0x028 28624087Sfsmp#define BKTR_E_CONTROL 0x02C 28724087Sfsmp#define BKTR_O_CONTROL 0x0AC 28824087Sfsmp#define BKTR_CONTRAST_LO 0x030 28924087Sfsmp#define BKTR_SAT_U_LO 0x034 29024087Sfsmp#define BKTR_SAT_V_LO 0x038 29124087Sfsmp#define BKTR_HUE 0x03C 29224087Sfsmp#define BKTR_E_SCLOOP 0x040 29324087Sfsmp#define BKTR_O_SCLOOP 0x0C0 29424087Sfsmp#define BKTR_OFORM 0x048 29524087Sfsmp#define BKTR_E_VSCALE_HI 0x04C 29624087Sfsmp#define BKTR_O_VSCALE_HI 0x0CC 29724087Sfsmp#define BKTR_E_VSCALE_LO 0x050 29824087Sfsmp#define BKTR_O_VSCALE_LO 0x0D0 29924087Sfsmp#define BKTR_TEST 0x054 30024087Sfsmp#define BKTR_ADELAY 0x060 30124087Sfsmp#define BKTR_BDELAY 0x064 30224087Sfsmp#define BKTR_ADC 0x068 30324087Sfsmp#define BKTR_E_VTC 0x06C 30424087Sfsmp#define BKTR_O_VTC 0x0EC 30524087Sfsmp#define BKTR_SRESET 0x07C 30624087Sfsmp#define BKTR_COLOR_FMT 0x0D4 30724087Sfsmp#define BKTR_COLOR_CTL 0x0D8 30824087Sfsmp#define BKTR_CAP_CTL 0x0DC 30924087Sfsmp#define BKTR_VBI_PACK_SIZE 0x0E0 31024087Sfsmp#define BKTR_VBI_PACK_DEL 0x0E4 31124087Sfsmp#define BKTR_INT_STAT 0x100 31224087Sfsmp#define BKTR_INT_MASK 0x104 31324087Sfsmp#define BKTR_RISC_COUNT 0x120 31424087Sfsmp#define BKTR_RISC_STRT_ADD 0x114 31524087Sfsmp#define BKTR_GPIO_DMA_CTL 0x10C 31624087Sfsmp#define BKTR_GPIO_OUT_EN 0x118 31724087Sfsmp#define BKTR_GPIO_REG_INP 0x11C 31824087Sfsmp#define BKTR_GPIO_DATA 0x200 31924087Sfsmp#define BKTR_I2C_CONTROL 0x110 32023599Smarkm 32124528Sfsmp#endif /* 0 */ 32223599Smarkm 32323599Smarkm/* 32423599Smarkm * device support for onboard tv tuners 32523599Smarkm */ 32624528Sfsmp 32724528Sfsmp/* description of the LOGICAL tuner */ 32824246Sfsmpstruct TVTUNER { 32924528Sfsmp int frequency; 33024528Sfsmp u_char chnlset; 33124528Sfsmp u_char channel; 33224528Sfsmp u_char band; 33324528Sfsmp u_char afc; 33433850Sahasty u_char radio_mode; /* current mode of the radio mode */ 33523599Smarkm}; 33623599Smarkm 33724528Sfsmp/* description of the PHYSICAL tuner */ 33824528Sfsmpstruct TUNER { 33924528Sfsmp char* name; 34024528Sfsmp u_char type; 34133025Sahasty u_char pllControl[4]; 34224528Sfsmp u_char bandLimits[ 2 ]; 34333025Sahasty u_char bandAddrs[ 4 ]; /* 3 first for the 3 TV 34433025Sahasty ** bands. Last for radio 34533025Sahasty ** band (0x00=NoRadio). 34633025Sahasty */ 34733025Sahasty 34824528Sfsmp}; 34924528Sfsmp 35024528Sfsmp/* description of the card */ 35124246Sfsmp#define EEPROMBLOCKSIZE 32 35224246Sfsmpstruct CARDTYPE { 35339041Ssos unsigned int card_id; /* card id (from #define's) */ 35424528Sfsmp char* name; 35539838Ssos const struct TUNER* tuner; /* Tuner details */ 35639838Ssos u_char tuner_pllAddr; /* Tuner i2c address */ 35730856Seivind u_char dbx; /* Has DBX chip? */ 35830856Seivind u_char msp3400c; /* Has msp3400c chip? */ 35924528Sfsmp u_char eepromAddr; 36024528Sfsmp u_char eepromSize; /* bytes / EEPROMBLOCKSIZE */ 36146876Sroger u_int audiomuxs[ 5 ]; /* tuner, ext (line-in) */ 36246876Sroger /* int/unused (radio) */ 36346876Sroger /* mute, present */ 36446876Sroger u_int gpio_mux_bits; /* GPIO mask for audio mux */ 36524246Sfsmp}; 36623599Smarkm 36724528Sfsmpstruct format_params { 36824528Sfsmp /* Total lines, lines before image, image lines */ 36924528Sfsmp int vtotal, vdelay, vactive; 37024528Sfsmp /* Total unscaled horizontal pixels, pixels before image, image pixels */ 37124528Sfsmp int htotal, hdelay, hactive; 37238706Ssos /* Scaled horizontal image pixels, Total Scaled horizontal pixels */ 37338706Ssos int scaled_hactive, scaled_htotal; 37438706Ssos /* frame rate . for ntsc is 30 frames per second */ 37529233Smarkm int frame_rate; 37638706Ssos /* A-delay and B-delay */ 37730856Seivind u_char adelay, bdelay; 37838706Ssos /* Iform XTSEL value */ 37930856Seivind int iform_xtsel; 38046175Sroger /* VBI number of lines per field, and number of samples per line */ 38146175Sroger int vbi_num_lines, vbi_num_samples; 38224528Sfsmp}; 38324528Sfsmp 38446876Sroger#if ((defined(__FreeBSD__)) && (NSMBUS > 0)) 38540781Snsouchstruct bktr_i2c_softc { 38640781Snsouch device_t iicbus; 38740781Snsouch device_t smbus; 38840781Snsouch}; 38940781Snsouch#endif 39025329Sfsmp 39125329Sfsmptypedef struct bktr_clip bktr_clip_t; 39247884Sroger 39347884Sroger 39423599Smarkm/* 39523599Smarkm * BrookTree 848 info structure, one per bt848 card installed. 39623599Smarkm */ 39724528Sfsmpstruct bktr_softc { 39847884Sroger 39947884Sroger#if defined (__bsdi__) 40029233Smarkm struct device bktr_dev; /* base device */ 40129233Smarkm struct isadev bktr_id; /* ISA device */ 40229233Smarkm struct intrhand bktr_ih; /* interrupt vectoring */ 40347884Sroger #define pcici_t pci_devaddr_t 40429233Smarkm#endif 40547884Sroger 40647884Sroger#if defined(__NetBSD__) 40747884Sroger struct device bktr_dev; /* base device */ 40847884Sroger bus_space_tag_t memt; 40947884Sroger bus_space_handle_t memh; 41047884Sroger bus_size_t obmemsz; /* size of en card (bytes) */ 41147884Sroger void *ih; 41247884Sroger bus_dmamap_t dm_prog; 41347884Sroger bus_dmamap_t dm_oprog; 41447884Sroger bus_dmamap_t dm_mem; 41550693Sroger bus_dmamap_t dm_vbidata; 41650693Sroger bus_dmamap_t dm_vbibuffer; 41747884Sroger vm_offset_t phys_base; /* Bt848 register physical address */ 41840781Snsouch#endif 41947884Sroger 42047884Sroger#if defined(__OpenBSD__) 42147884Sroger struct device bktr_dev; /* base device */ 42247884Sroger bus_dma_tag_t dmat; /* DMA tag */ 42347884Sroger bus_space_tag_t memt; 42447884Sroger bus_space_handle_t memh; 42547884Sroger bus_size_t obmemsz; /* size of en card (bytes) */ 42647884Sroger void *ih; 42747884Sroger bus_dmamap_t dm_prog; 42847884Sroger bus_dmamap_t dm_oprog; 42947884Sroger bus_dmamap_t dm_mem; 43050693Sroger bus_dmamap_t dm_vbidata; 43150693Sroger bus_dmamap_t dm_vbibuffer; 43247884Sroger size_t dm_mapsize; 43347884Sroger pci_chipset_tag_t pc; /* Opaque PCI chipset tag */ 43447884Sroger pcitag_t tag; /* PCI tag, for doing PCI commands */ 43547884Sroger vm_offset_t phys_base; /* Bt848 register physical address */ 43647884Sroger#endif 43747884Sroger 43847884Sroger#if defined (__FreeBSD__) 43948781Sroger #if (__FreeBSD_version < 400000) 44047884Sroger vm_offset_t phys_base; /* 2.x Bt848 register physical address */ 44147884Sroger pcici_t tag; /* 2.x PCI tag, for doing PCI commands */ 44247884Sroger #endif 44348781Sroger #if (__FreeBSD_version >= 400000) 44447884Sroger struct resource *res_mem; /* 4.x resource descriptor for registers */ 44547884Sroger struct resource *res_irq; /* 4.x resource descriptor for interrupt */ 44647884Sroger void *res_ih; /* 4.x newbus interrupt handler cookie */ 44747884Sroger #endif 44847884Sroger #if (NSMBUS > 0) 44947884Sroger struct bktr_i2c_softc i2c_sc; /* bt848_i2c device */ 45047884Sroger #endif 45147884Sroger#endif 45247884Sroger 45347884Sroger /* the following definitions are common over all platforms */ 45424528Sfsmp bt848_ptr_t base; /* Bt848 register physical address */ 45523599Smarkm vm_offset_t bigbuf; /* buffer that holds the captured image */ 45623599Smarkm int alloc_pages; /* number of pages in bigbuf */ 45750693Sroger 45846175Sroger vm_offset_t vbidata; /* RISC program puts VBI data from the current frame here */ 45946175Sroger vm_offset_t vbibuffer; /* Circular buffer holding VBI data for the user */ 46046175Sroger int vbiinsert; /* Position for next write into circular buffer */ 46146175Sroger int vbistart; /* Position of last read from circular buffer */ 46246175Sroger int vbisize; /* Number of bytes in the circular buffer */ 46350693Sroger u_long vbi_sequence_number; /* sequence number for VBI */ 46450693Sroger int vbi_read_blocked; /* user process blocked on read() from /dev/vbi */ 46550693Sroger struct selinfo vbi_select; /* Data used by select() on /dev/vbi */ 46650693Sroger 46750693Sroger 46823599Smarkm struct proc *proc; /* process to receive raised signal */ 46923599Smarkm int signal; /* signal to send to process */ 47036090Sahasty int clr_on_start; /* clear cap buf on capture start? */ 47123599Smarkm#define METEOR_SIG_MODE_MASK 0xffff0000 47223599Smarkm#define METEOR_SIG_FIELD_MODE 0x00010000 47323599Smarkm#define METEOR_SIG_FRAME_MODE 0x00000000 47423599Smarkm vm_offset_t dma_prog; 47523599Smarkm vm_offset_t odd_dma_prog; 47623599Smarkm char dma_prog_loaded; 47723599Smarkm struct meteor_mem *mem; /* used to control sync. multi-frame output */ 47823599Smarkm u_long synch_wait; /* wait for free buffer before continuing */ 47923599Smarkm short current; /* frame number in buffer (1-frames) */ 48023599Smarkm short rows; /* number of rows in a frame */ 48123599Smarkm short cols; /* number of columns in a frame */ 48238706Ssos int capture_area_x_offset; /* Usually the full 640x480(NTSC) image is */ 48338706Ssos int capture_area_y_offset; /* captured. The capture area allows for */ 48438706Ssos int capture_area_x_size; /* example 320x200 pixels from the centre */ 48538706Ssos int capture_area_y_size; /* of the video image to be captured. */ 48638706Ssos char capture_area_enabled; /* When TRUE use user's capture area. */ 48725329Sfsmp int pixfmt; /* active pixel format (idx into fmt tbl) */ 48825329Sfsmp int pixfmt_compat; /* Y/N - in meteor pix fmt compat mode */ 48923599Smarkm u_long format; /* frame format rgb, yuv, etc.. */ 49023599Smarkm short frames; /* number of frames allocated */ 49123599Smarkm int frame_size; /* number of bytes in a frame */ 49223599Smarkm u_long fifo_errors; /* number of fifo capture errors since open */ 49323599Smarkm u_long dma_errors; /* number of DMA capture errors since open */ 49423599Smarkm u_long frames_captured;/* number of frames captured since open */ 49523599Smarkm u_long even_fields_captured; /* number of even fields captured */ 49623599Smarkm u_long odd_fields_captured; /* number of odd fields captured */ 49723599Smarkm u_long range_enable; /* enable range checking ?? */ 49823599Smarkm u_short capcontrol; /* reg 0xdc capture control */ 49923935Sfsmp u_short bktr_cap_ctl; 50029233Smarkm volatile u_int flags; 50123599Smarkm#define METEOR_INITALIZED 0x00000001 50223599Smarkm#define METEOR_OPEN 0x00000002 50323599Smarkm#define METEOR_MMAP 0x00000004 50423599Smarkm#define METEOR_INTR 0x00000008 50523599Smarkm#define METEOR_READ 0x00000010 /* XXX never gets referenced */ 50623599Smarkm#define METEOR_SINGLE 0x00000020 /* get single frame */ 50723599Smarkm#define METEOR_CONTIN 0x00000040 /* continuously get frames */ 50823599Smarkm#define METEOR_SYNCAP 0x00000080 /* synchronously get frames */ 50923599Smarkm#define METEOR_CAP_MASK 0x000000f0 51023599Smarkm#define METEOR_NTSC 0x00000100 51123599Smarkm#define METEOR_PAL 0x00000200 51223599Smarkm#define METEOR_SECAM 0x00000400 51339041Ssos#define BROOKTREE_NTSC 0x00000100 /* used in video open() and */ 51439041Ssos#define BROOKTREE_PAL 0x00000200 /* in the kernel config */ 51539041Ssos#define BROOKTREE_SECAM 0x00000400 /* file */ 51623599Smarkm#define METEOR_AUTOMODE 0x00000800 51723599Smarkm#define METEOR_FORM_MASK 0x00000f00 51823599Smarkm#define METEOR_DEV0 0x00001000 51923599Smarkm#define METEOR_DEV1 0x00002000 52023599Smarkm#define METEOR_DEV2 0x00004000 52123599Smarkm#define METEOR_DEV3 0x00008000 52223599Smarkm#define METEOR_DEV_SVIDEO 0x00006000 52323599Smarkm#define METEOR_DEV_RGB 0x0000a000 52423599Smarkm#define METEOR_DEV_MASK 0x0000f000 52523599Smarkm#define METEOR_RGB16 0x00010000 52623599Smarkm#define METEOR_RGB24 0x00020000 52723599Smarkm#define METEOR_YUV_PACKED 0x00040000 52823599Smarkm#define METEOR_YUV_PLANAR 0x00080000 52923599Smarkm#define METEOR_WANT_EVEN 0x00100000 /* want even frame */ 53023599Smarkm#define METEOR_WANT_ODD 0x00200000 /* want odd frame */ 53123599Smarkm#define METEOR_WANT_MASK 0x00300000 53223599Smarkm#define METEOR_ONLY_EVEN_FIELDS 0x01000000 53323599Smarkm#define METEOR_ONLY_ODD_FIELDS 0x02000000 53423599Smarkm#define METEOR_ONLY_FIELDS_MASK 0x03000000 53523599Smarkm#define METEOR_YUV_422 0x04000000 53623599Smarkm#define METEOR_OUTPUT_FMT_MASK 0x040f0000 53723599Smarkm#define METEOR_WANT_TS 0x08000000 /* time-stamp a frame */ 53823599Smarkm#define METEOR_RGB 0x20000000 /* meteor rgb unit */ 53923599Smarkm#define METEOR_FIELD_MODE 0x80000000 54046175Sroger u_char tflags; /* Tuner flags (/dev/tuner) */ 54124528Sfsmp#define TUNER_INITALIZED 0x00000001 54224528Sfsmp#define TUNER_OPEN 0x00000002 54346175Sroger u_char vbiflags; /* VBI flags (/dev/vbi) */ 54446175Sroger#define VBI_INITALIZED 0x00000001 54546175Sroger#define VBI_OPEN 0x00000002 54646175Sroger#define VBI_CAPTURE 0x00000004 54723599Smarkm u_short fps; /* frames per second */ 54823599Smarkm struct meteor_video video; 54924246Sfsmp struct TVTUNER tuner; 55024528Sfsmp struct CARDTYPE card; 55124528Sfsmp u_char audio_mux_select; /* current mode of the audio */ 55224528Sfsmp u_char audio_mute_state; /* mute state of the audio */ 55324528Sfsmp u_char format_params; 55425329Sfsmp u_long current_sol; 55525329Sfsmp u_long current_col; 55625329Sfsmp int clip_start; 55725329Sfsmp int line_length; 55825329Sfsmp int last_y; 55925329Sfsmp int y; 56025329Sfsmp int y2; 56125329Sfsmp int yclip; 56225329Sfsmp int yclip2; 56325329Sfsmp int max_clip_node; 56425329Sfsmp bktr_clip_t clip_list[100]; 56536090Sahasty int reverse_mute; 56636090Sahasty int bt848_tuner; 56736090Sahasty int bt848_card; 56837611Sahasty u_long id; 56939841Ssos#define BT848_USE_XTALS 0 57039841Ssos#define BT848_USE_PLL 1 57143098Sroger int xtal_pll_mode; /* Use XTAL or PLL mode for PAL/SECAM */ int remote_control; /* remote control detected */ 57248781Sroger int remote_control_addr; /* remote control i2c address */ 57348781Sroger char msp_version_string[9]; /* MSP version string 34xxx-xx */ 57443098Sroger 57548781Sroger 57624528Sfsmp}; 57723599Smarkm 57824528Sfsmptypedef struct bktr_softc bktr_reg_t; 57924528Sfsmptypedef struct bktr_softc* bktr_ptr_t; 58036090Sahasty 58136090Sahasty#define Bt848_MAX_SIGN 16 58236090Sahasty 58336090Sahastystruct bt848_card_sig { 58436090Sahasty int card; 58536090Sahasty int tuner; 58636090Sahasty u_char signature[Bt848_MAX_SIGN]; 58736090Sahasty}; 588