/* $NetBSD: bktr_reg.h,v 1.22 2012/10/27 17:18:36 chs Exp $ */
/*
* $FreeBSD: src/sys/dev/bktr/bktr_reg.h,v 1.42 2000/10/31 13:09:56 roger Exp$
*
* Copyright (c) 1999 Roger Hardiman
* Copyright (c) 1998 Amancio Hasty
* Copyright (c) 1995 Mark Tinguely and Jim Lowe
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Mark Tinguely and Jim Lowe
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
typedef volatile u_int bregister_t;
/*
* if other persuasion endian, then compiler will probably require that
* these next
* macros be reversed
*/
#define BTBYTE(what) bregister_t what:8; int :24
#define BTWORD(what) bregister_t what:16; int: 16
#define BTLONG(what) bregister_t what:32
/* description of the LOGICAL tuner */
struct TVTUNER {
int frequency;
u_char chnlset;
u_char channel;
u_char band;
u_char afc;
u_char radio_mode; /* current mode of the radio mode */
};
/* description of the PHYSICAL tuner */
struct TUNER {
const char* name;
u_char type;
u_char pllControl[4];
u_int bandLimits[2];
u_char bandAddrs[4]; /* 3 first for the 3 TV
** bands. Last for radio
** band (0x00=NoRadio).
*/
struct format_params {
/* Total lines, lines before image, image lines */
int vtotal, vdelay, vactive;
/* Total unscaled horizontal pixels, pixels before image, image pixels */
int htotal, hdelay, hactive;
/* Scaled horizontal image pixels, Total Scaled horizontal pixels */
int scaled_hactive, scaled_htotal;
/* frame rate . for ntsc is 30 frames per second */
int frame_rate;
/* A-delay and B-delay */
u_char adelay, bdelay;
/* Iform XTSEL value */
int iform_xtsel;
/* VBI number of lines per field, and number of samples per line */
int vbi_num_lines, vbi_num_samples;
};
/* Bt848/878 register access
* The registers can either be access via a memory mapped structure
* or accessed via bus_space.
* bus_space access allows cross platform support, where as the
* memory mapped structure method only works on 32 bit processors
* with the right type of endianness.
*/
struct bktr_softc;
/*
* BrookTree 848 info structure, one per bt848 card installed.
*/
struct bktr_softc {
device_t bktr_dev; /* base device */
bus_dma_tag_t dmat; /* DMA tag */
bus_space_tag_t memt;
bus_space_handle_t memh;
bus_size_t obmemsz; /* size of en card (bytes) */
void *ih;
bus_dmamap_t dm_prog;
bus_dmamap_t dm_oprog;
bus_dmamap_t dm_mem;
bus_dmamap_t dm_vbidata;
bus_dmamap_t dm_vbibuffer;
/* The following definitions are for the contiguous memory */
vaddr_t bigbuf; /* buffer that holds the captured image */
vaddr_t vbidata; /* RISC program puts VBI data from the current frame here */
vaddr_t vbibuffer; /* Circular buffer holding VBI data for the user */
vaddr_t dma_prog; /* RISC prog for single and/or even field capture*/
vaddr_t odd_dma_prog; /* RISC program for Odd field capture */
/* the following definitions are common over all platforms */
int alloc_pages; /* number of pages in bigbuf */
int vbiinsert; /* Position for next write into circular buffer */
int vbistart; /* Position of last read from circular buffer */
int vbisize; /* Number of bytes in the circular buffer */
u_int vbi_sequence_number; /* sequence number for VBI */
int vbi_read_blocked; /* user process blocked on read() from /dev/vbi */
struct selinfo vbi_select; /* Data used by select() on /dev/vbi */
struct proc *proc; /* process to receive raised signal */
int signal; /* signal to send to process */
int clr_on_start; /* clear cap buf on capture start? */
#define METEOR_SIG_MODE_MASK 0xffff0000
#define METEOR_SIG_FIELD_MODE 0x00010000
#define METEOR_SIG_FRAME_MODE 0x00000000
char dma_prog_loaded;
struct meteor_mem *mem; /* used to control sync. multi-frame output */
u_int synch_wait; /* wait for free buffer before continuing */
short current; /* frame number in buffer (1-frames) */
short rows; /* number of rows in a frame */
short cols; /* number of columns in a frame */
int capture_area_x_offset; /* Usually the full 640x480(NTSC) image is */
int capture_area_y_offset; /* captured. The capture area allows for */
int capture_area_x_size; /* example 320x200 pixels from the centre */
int capture_area_y_size; /* of the video image to be captured. */
char capture_area_enabled; /* When TRUE use user's capture area. */
int pixfmt; /* active pixel format (idx into fmt tbl) */
int pixfmt_compat; /* Y/N - in meteor pix fmt compat mode */
u_int format; /* frame format rgb, yuv, etc.. */
short frames; /* number of frames allocated */
int frame_size; /* number of bytes in a frame */
u_int fifo_errors; /* number of fifo capture errors since open */
u_int dma_errors; /* number of DMA capture errors since open */
u_int frames_captured;/* number of frames captured since open */
u_int even_fields_captured; /* number of even fields captured */
u_int odd_fields_captured; /* number of odd fields captured */
u_int range_enable; /* enable range checking ?? */
u_short capcontrol; /* reg 0xdc capture control */
u_short bktr_cap_ctl;
volatile u_int flags;
#define METEOR_INITIALIZED 0x00000001
#define METEOR_OPEN 0x00000002
#define METEOR_MMAP 0x00000004
#define METEOR_INTR 0x00000008
#define METEOR_READ 0x00000010 /* XXX never gets referenced */
#define METEOR_SINGLE 0x00000020 /* get single frame */
#define METEOR_CONTIN 0x00000040 /* continuously get frames */
#define METEOR_SYNCAP 0x00000080 /* synchronously get frames */
#define METEOR_CAP_MASK 0x000000f0
#define METEOR_NTSC 0x00000100
#define METEOR_PAL 0x00000200
#define METEOR_SECAM 0x00000400
#define BROOKTREE_NTSC 0x00000100 /* used in video open() and */
#define BROOKTREE_PAL 0x00000200 /* in the kernel config */
#define BROOKTREE_SECAM 0x00000400 /* file */
#define METEOR_AUTOMODE 0x00000800
#define METEOR_FORM_MASK 0x00000f00
#define METEOR_DEV0 0x00001000
#define METEOR_DEV1 0x00002000
#define METEOR_DEV2 0x00004000
#define METEOR_DEV3 0x00008000
#define METEOR_DEV_SVIDEO 0x00006000
#define METEOR_DEV_RGB 0x0000a000
#define METEOR_DEV_MASK 0x0000f000
#define METEOR_RGB16 0x00010000
#define METEOR_RGB24 0x00020000
#define METEOR_YUV_PACKED 0x00040000
#define METEOR_YUV_PLANAR 0x00080000
#define METEOR_WANT_EVEN 0x00100000 /* want even frame */
#define METEOR_WANT_ODD 0x00200000 /* want odd frame */
#define METEOR_WANT_MASK 0x00300000
#define METEOR_ONLY_EVEN_FIELDS 0x01000000
#define METEOR_ONLY_ODD_FIELDS 0x02000000
#define METEOR_ONLY_FIELDS_MASK 0x03000000
#define METEOR_YUV_422 0x04000000
#define METEOR_OUTPUT_FMT_MASK 0x040f0000
#define METEOR_WANT_TS 0x08000000 /* time-stamp a frame */
#define METEOR_RGB 0x20000000 /* meteor rgb unit */
u_char tflags; /* Tuner flags (/dev/tuner) */
#define TUNER_INITIALIZED 0x00000001
#define TUNER_OPEN 0x00000002
u_char vbiflags; /* VBI flags (/dev/vbi) */
#define VBI_INITIALIZED 0x00000001
#define VBI_OPEN 0x00000002
#define VBI_CAPTURE 0x00000004
u_short fps; /* frames per second */
struct meteor_video video;
struct TVTUNER tuner;
struct CARDTYPE card;
u_char audio_mux_select; /* current mode of the audio */
u_char audio_mute_state; /* mute state of the audio */
u_char format_params;
u_int current_sol;
u_int current_col;
int clip_start;
int line_length;
int last_y;
int y;
int y2;
int yclip;
int yclip2;
int max_clip_node;
bktr_clip_t clip_list[100];
int reverse_mute; /* Swap the GPIO values for Mute and TV Audio */
int bt848_tuner;
int bt848_card;
u_int id;
#define BT848_USE_XTALS 0
#define BT848_USE_PLL 1
int xtal_pll_mode; /* Use XTAL or PLL mode for PAL/SECAM */
int remote_control; /* remote control detected */
int remote_control_addr; /* remote control i2c address */
char msp_version_string[9]; /* MSP version string 34xxx-xx */
int msp_addr; /* MSP i2c address */
char dpl_version_string[9]; /* DPL version string 35xxx-xx */
int dpl_addr; /* DPL i2c address */
int slow_msp_audio; /* 0 = use fast MSP3410/3415 programming sequence */
/* 1 = use slow MSP3410/3415 programming sequence */
/* 2 = use Tuner's Mono audio output via the MSP chip */
int msp_use_mono_source; /* use Tuner's Mono audio output via the MSP chip */
int audio_mux_present; /* 1 = has audio mux on GPIO lines, 0 = no audio mux */
int msp_source_selected; /* 0 = TV source, 1 = Line In source, 2 = FM Radio Source */
void *sih;
struct bt848_card_sig {
int card;
int tuner;
u_char signature[Bt848_MAX_SIGN];
};
/***********************************************************/
/* ioctl_cmd_t int on old versions, u_long on new versions */
/***********************************************************/