Remove bktr(4)

Remove the brooktree driver as discussed on arch@. Bump FreeBSD version to
1300082, though I doubt anything will care.

Relnote: yes
This commit is contained in:
Warner Losh 2020-03-01 19:15:03 +00:00
parent 5082c36629
commit 795140556c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=358497
29 changed files with 4 additions and 13613 deletions

View file

@ -26,6 +26,9 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
20200301:
Removed brooktree driver (bktr.4) from the tree.
20200229:
The WITH_GPL_DTC option has been removed. The BSD-licenced device tree
compiler in usr.bin/dtc is used on all architectures which use dtc, and

View file

@ -79,7 +79,6 @@ MAN= aac.4 \
bhnd_pmu.4 \
bhndb.4 \
bhndb_pci.4 \
bktr.4 \
blackhole.4 \
bnxt.4 \
bpf.4 \
@ -601,7 +600,6 @@ MLINKS+=axe.4 if_axe.4
MLINKS+=bce.4 if_bce.4
MLINKS+=bfe.4 if_bfe.4
MLINKS+=bge.4 if_bge.4
MLINKS+=bktr.4 brooktree.4
MLINKS+=bnxt.4 if_bnxt.4
MLINKS+=bridge.4 if_bridge.4
MLINKS+=bwi.4 if_bwi.4

View file

@ -1,264 +0,0 @@
.\"
.\" $FreeBSD$
.\"
.Dd February 25, 2020
.Dt BKTR 4
.Os
.Sh NAME
.Nm bktr
.Nd Brooktree Bt848/849/878/879 and Pinnacle PCTV video capture driver
.Sh SYNOPSIS
.Cd device bktr
.Pp
.Cd device iicbus
.Cd device iicbb
.Cd device smbus
.Sh DEPRECATION NOTICE
The
.Nm
driver is not present in
.Fx 13.0
and later.
.Sh DESCRIPTION
The
.Nm bktr
driver provides support for PCI
.Em video
capture and
.Em VBI
capture on low cost, high performance boards.
The driver is based on the Matrox Meteor driver and uses the same API.
The
.Nm
driver should support most video cards based on the
.Em "Brooktree Bt848/849/878/879 Video Capture Chip" .
Also supported are most
.Em "Pinnacle PCTV"
video cards.
Furthermore, the driver supports
.Em FM Radio
if the tuner supports it.
.Pp
The driver currently supports the following features:
.Bd -unfilled -offset indent
PCI to PCI dma transfer
clipping
yuv
rgb16
rgb24
rgb32
.Ed
.Pp
On the supported cards, tuners and other components are interconnected
with an I2C bus.
The Brooktree848 chips act as a master device on the bus to control them.
Therefore,
.Xr iicbus 4 ,
.Xr iicbb 4
and
.Xr smbus 4
controller declarations are mandatory to activate
.Nm
support.
.Pp
The following kernel parameters may be used to further configure the driver:
.Pp
.Em options "BROOKTREE_ALLOC_PAGES=xxx"
specifies the number of contiguous pages to allocate when successfully
probed.
The default number of pages allocated by the kernel is 216.
This means that there are (216*4096) bytes available for use.
.Bd -unfilled
.Cd options BROOKTREE_SYSTEM_DEFAULT=BROOKTREE_PAL
.Cd options BROOKTREE_SYSTEM_DEFAULT=BROOKTREE_NTSC
.Ed
One of these options can be used to set the default video format for the driver.
This fixed random hangs and lockups with the VideoLogic Captivator PCI card.
.Pp
The following sysctls may be used to further configure the driver:
.Pp
.Em sysctl hw.bt848.card=nnnn
This can be used to override the card make which was detected at boot time.
.Ql nnnn
is set to an integer from 1 to 23 taken from the following table:
.Pp
.Bl -tag -compact -width 30n
.It MIRO
1
.It HAUPPAUGE
2
.It STB
3
.It INTEL
4
.It IMS_TURBO
5
.It AVER_MEDIA
6
.It OSPREY
7
.It NEC_PK
8
.It IO_GV
9
.It FLYVIDEO
10
.It ZOLTRIX
11
.It KISS
12
.It VIDEO_HIGHWAY_XTREME
13
.It ASKEY_DYNALINK_MAGIC_TVIEW
14
.It LEADTEK
15
.It TERRATVPLUS
16
.It IO_BCTV3
17
.It AOPEN_VA1000
18
.It PINNACLE_PCTV_RAVE
19
.It PIXELVIEW_PLAYTV_PAK
20
.It TERRATVALUE
21
.It PIXELVIEW_PLAYTV_PRO_REV_4C
22
.It Bt848_MAX
23
.El
.Pp
.Em sysctl hw.bt848.tuner=nnnn
This can be used to override the tuner make which was detected at boot time.
.Ql nnnn
is set to an integer from 0 to 16 taken from the following table:
.Pp
.Bl -tag -compact -width 22n
.It NO_TUNER
0
.It TEMIC_NTSC
1
.It TEMIC_PAL
2
.It TEMIC_SECAM
3
.It PHILIPS_NTSC
4
.It PHILIPS_PAL
5
.It PHILIPS_SECAM
6
.It TEMIC_PALI
7
.It PHILIPS_PALI
8
.It PHILIPS_FR1236_NTSC
9 /* These have FM Radio support */
.It PHILIPS_FR1216_PAL
10 /* These have FM Radio support */
.It PHILIPS_FR1236_SECAM
11 /* These have FM Radio support */
.It ALPS_TSCH5
12
.It ALPS_TSBH1
13
.It MT2032
14
.It LG_TPI8PSB12P_PAL
15
.It Bt848_MAX
16
.El
.Sh HARDWARE
The
.Nm
driver supports video capture cards based on the
Brooktree Bt848/849/878/879 chips, as well as
Pinnacle PCTV cards, including:
.Pp
.Bl -bullet -compact
.It
AOpen VA1000
.It
AVerMedia AVerTV Studio
.It
AVerMedia TF/FM-98
.It
ATI TV Wonder VE
.It
Hauppauge WinCast/TV
.It
Hauppauge WinTV-Go-FM
.It
Hauppauge WinTV-pci
.It
Hauppauge WinTV-radio
.It
Intel Smart Video Recorder III
.It
KWORLD PCI TV Tuner
.It
Miro PC TV
.It
Pinnacle PCTV Pro
.It
Pinnacle PCTV Rave
.It
PixelView PlayTV PAK
.It
PixelView PlayTV Pro (rev 4C, 9D)
.It
SIGMA TV II
.It
STB TV PCI Television Tuner
.It
Super TV Tuner
.It
TerraTec TValue
.It
V-Stream XPERT TV-PVR 878
.It
Video Highway XTreme
.It
VideoLogic Captivator PCI
.El
.Sh FILES
.Bl -tag -width /usr/share/examples/meteor -compact
.It Pa /usr/ports/multimedia/fxtv
A TV and Camera display program utilizing the bktr driver - requires that
.Em The X Window System
and
.Em The Ports Collection
also be installed.
.It Pa /usr/ports/audio/xmradio
An FM Radio Tuner for cards which have an FM Radio tuner fitted - requires that
.Em The X Window System
and
.Em The Ports Collection
also be installed.
It also requires
.Em Motif
or the
.Em lesstif
port.
.El
.Sh SEE ALSO
.Xr meteor 4
.Sh HISTORY
The
.Nm
driver first appeared in
.Fx 2.2 .
.Sh AUTHORS
.An -nosplit
This driver is based on the work of
.An Jim Lowe Aq Mt james@miller.cs.uwm.edu ,
.An Mark Tinguely Aq Mt tinguely@plains.nodak.edu ,
.An Amancio Hasty Aq Mt hasty@star-gate.com ,
.An Roger Hardiman Aq Mt roger@FreeBSD.org
and a bunch of other people.
Support for Pinnacle PCTV Rave cards was added by
.An Branko Lankester Aq Mt branko@euro.net .

View file

@ -1335,13 +1335,6 @@ dev/bhnd/siba/siba_bhndb.c optional siba bhnd bhndb
dev/bhnd/siba/siba_erom.c optional siba bhnd
dev/bhnd/siba/siba_subr.c optional siba bhnd
#
dev/bktr/bktr_audio.c optional bktr pci
dev/bktr/bktr_card.c optional bktr pci
dev/bktr/bktr_core.c optional bktr pci
dev/bktr/bktr_i2c.c optional bktr pci smbus
dev/bktr/bktr_os.c optional bktr pci
dev/bktr/bktr_tuner.c optional bktr pci
dev/bktr/msp34xx.c optional bktr pci
dev/bnxt/bnxt_hwrm.c optional bnxt iflib pci
dev/bnxt/bnxt_sysctl.c optional bnxt iflib pci
dev/bnxt/bnxt_txrx.c optional bnxt iflib pci

View file

@ -1,519 +0,0 @@
/* $FreeBSD$ */
/*
* This is part of the Driver for Video Capture Cards (Frame grabbers)
* and TV Tuner cards using the Brooktree Bt848, Bt848A, Bt849A, Bt878, Bt879
* chipset.
* Copyright Roger Hardiman and Amancio Hasty.
*
* CHANGELOG : The Change History:
* These version numbers represent the authors own numbering.
* They are unrelated to Revision Control numbering of FreeBSD or
* any other system.
1.0 1/24/97 First Alpha release
1.1 2/20/97 Added video ioctl so we can do PCI To PCI
data transfers. This is for capturing data
directly to a vga frame buffer which has
a linear frame buffer. Minor code clean-up.
1.3 2/23/97 Fixed system lock-up reported by
Randall Hopper <rhh@ct.picker.com>. This
problem seems somehow to be exhibited only
in his system. I changed the setting of
INT_MASK for CAP_CONTINUOUS to be exactly
the same as CAP_SINGLE apparently setting
bit 23 cleared the system lock up.
version 1.1 of the driver has been reported
to work with STB's WinTv, Hauppage's Wincast/Tv
and last but not least with the Intel Smart
Video Recorder.
1.4 3/9/97 fsmp@freefall.org
Merged code to support tuners on STB and WinCast
cards.
Modifications to the contrast and chroma ioctls.
Textual cleanup.
1.5 3/15/97 fsmp@freefall.org
new bt848 specific versions of hue/bright/
contrast/satu/satv.
Amancio's patch to fix "screen freeze" problem.
1.6 3/19/97 fsmp@freefall.org
new table-driven frequency lookup.
removed disable_intr()/enable_intr() calls from i2c.
misc. cleanup.
1.7 3/19/97 fsmp@freefall.org
added audio support submitted by:
Michael Petry <petry@netwolf.NetMasters.com>
1.8 3/20/97 fsmp@freefall.org
extended audio support.
card auto-detection.
major cleanup, order of routines, declarations, etc.
1.9 3/22/97 fsmp@freefall.org
merged in Amancio's minor unit for tuner control
mods.
misc. cleanup, especially in the _intr routine.
made AUDIO_SUPPORT mainline code.
1.10 3/23/97 fsmp@freefall.org
added polled hardware i2c routines,
removed all existing software i2c routines.
created software i2cProbe() routine.
Randall Hopper's fixes of BT848_GHUE & BT848_GBRIG.
eeprom support.
1.11 3/24/97 fsmp@freefall.org
Louis Mamakos's new bt848 struct.
1.12 3/25/97 fsmp@freefall.org
japanese freq table from Naohiro Shichijo.
new table structs for tuner lookups.
major scrub for "magic numbers".
1.13 3/28/97 fsmp@freefall.org
1st PAL support.
MAGIC_[1-4] demarcates magic #s needing PAL work.
AFC code submitted by Richard Tobin
<richard@cogsci.ed.ac.uk>.
1.14 3/29/97 richard@cogsci.ed.ac.uk
PAL support: magic numbers moved into
format_params structure.
Revised AFC interface.
fixed DMA_PROG_ALLOC size misdefinition.
1.15 4/18/97 John-Mark Gurney <gurney_j@resnet.uoregon.edu>
Added [SR]RGBMASKs ioctl for byte swapping.
1.16 4/20/97 Randall Hopper <rhh@ct.picker.com>
Generalized RGBMASK ioctls for general pixel
format setting [SG]ACTPIXFMT, and added query API
to return driver-supported pix fmts GSUPPIXFMT.
1.17 4/21/97 hasty@rah.star-gate.com
Clipping support added.
1.18 4/23/97 Clean up after failed CAP_SINGLEs where bt
interrupt isn't delivered, and fixed fixing
CAP_SINGLEs that for ODD_ONLY fields.
1.19 9/8/97 improved yuv support , cleaned up weurope
channel table, incorporated cleanup work from
Luigi, fixed pci interface bug due to a
change in the pci interface which disables
interrupts from a PCI device by default,
Added Luigi's, ioctl's BT848_SLNOTCH,
BT848_GLNOTCH (set luma notch and get luma not)
1.20 10/5/97 Keith Sklower <sklower@CS.Berkeley.EDU> submitted
a patch to fix compilation of the BSDI's PCI
interface.
Hideyuki Suzuki <hideyuki@sat.t.u-tokyo.ac.jp>
Submitted a patch for Japanese cable channels
Joao Carlos Mendes Luis jonny@gta.ufrj.br
Submitted general ioctl to set video broadcast
formats (PAL, NTSC, etc..) previously we depended
on the Bt848 auto video detect feature.
1.21 10/24/97 Randall Hopper <rhh@ct.picker.com>
Fix temporal decimation, disable it when
doing CAP_SINGLEs, and in dual-field capture, don't
capture fields for different frames
1.22 11/08/97 Randall Hopper <rhh@ct.picker.com>
Fixes for packed 24bpp - FIFO alignment
1.23 11/17/97 Amancio <hasty@star-gate.com>
Added yuv support mpeg encoding
1.24 12/27/97 Jonathan Hanna <pangolin@rogers.wave.ca>
Patch to support Philips FR1236MK2 tuner
1.25 02/02/98 Takeshi Ohashi
<ohashi@atohasi.mickey.ai.kyutech.ac.jp> submitted
code to support bktr_read .
Flemming Jacobsen <fj@schizo.dk.tfs.com>
submitted code to support radio available with in
some bt848 based cards;additionally, wrote code to
correctly recognized his bt848 card.
Roger Hardiman <roger@cs.strath.ac.uk> submitted
various fixes to smooth out the microcode and made
all modes consistent.
1.26 Moved Luigi's I2CWR ioctl from the video_ioctl
section to the tuner_ioctl section
Changed Major device from 79 to 92 and reserved
our Major device number -- hasty@star-gate.com
1.27 Last batch of patches for radio support from
Flemming Jacobsen <fj@trw.nl>.
Added B849 PCI ID submitted by:
Tomi Vainio <tomppa@fidata.fi>
1.28 Frank Nobis <fn@Radio-do.de> added tuner support
for the German Phillips PAL tuner and
additional channels for german cable tv.
1.29 Roger Hardiman <roger@cs.strath.ac.uk>
Revised autodetection code to correctly handle both
old and new VideoLogic Captivator PCI cards.
Added tsleep of 2 seconds to initialistion code
for PAL users.Corrected clock selection code on
format change.
1.30 Bring back Frank Nobis <fn@Radio-do.de>'s opt_bktr.h
1.31 Randall Hopper <rhh@ct.picker.com>
submitted ioctl to clear the video buffer
prior to starting video capture
Amancio : clean up yuv12 so that it does not
affect rgb capture. Basically, fxtv after
capturing in yuv12 mode , switching to rgb
would cause the video capture to be too bright.
1.32 disable inverse gamma function for rgb and yuv
capture. fixed meteor brightness ioctl it now
converts the brightness value from unsigned to
signed.
1.33 added sysctl: hw.bt848.tuner, hw.bt848.reverse_mute,
hw.bt848.card
card takes a value from 0 to bt848_max_card
tuner takes a value from 0 to bt848_max_tuner
reverse_mute : 0 no effect, 1 reverse tuner
mute function some tuners are wired reversed :(
1.34 reverse mute function for ims turbo card
1.35 Roger Hardiman <roger@cs.strath.ac.uk>
options BROOKTREE_SYSTEM_DEFAULT=BROOKTREE_PAL
in the kernel config file makes the driver's
video_open() function select PAL rather than NTSC.
This fixed all the hangs on my Dual Crystal card
when using a PAL video signal. As a result, you
can lose the tsleep (of 2 seconds - now 0.25!!)
which I previously added. (Unless someone else
wanted the 0.25 second tsleep).
1.36 added bt848.format sysctl variable.
1 denotes NTSC , 0 denotes PAL
1.37 added support for Bt878 and improved Hauppauge's
bt848 tuner recognition
1.38 Further improvements on Hauppauge's rely on
eeprom[9] to determine the tuner type 8)
AVerMedia card type added <sos@freebsd.org>
1.39 08/05/98 Roger Hardiman <roger@cs.strath.ac.uk>
Updated Hauppauge detection code for Tuner ID 0x0a
for newer NTSC WinCastTV 404 with Bt878 chipset.
Tidied up PAL default in video_open()
Soren bumped version from 1.39 to 1.49 to sync
with FreeBSD CVS numbers.
1.49 10 August 1998 Roger Hardiman <roger@cs.strath.ac.uk>
Added Capture Area ioctl - BT848[SG]CAPAREA.
Normally the full 640x480 (768x576 PAL) image
is grabbed. This ioctl allows a smaller area
from anywhere within the video image to be
grabbed, eg a 400x300 image from (50,10).
See restrictions in BT848SCAPAREA.
1.50 31 August 1998 Roger Hardiman <roger@cs.strath.ac.uk>
Renamed BT848[SG]CAPAREA to BT848_[SG]CAPAREA.
Added PR kern/7177 for SECAM Video Highway Xtreme
with single crystal PLL configuration
submitted by Vsevolod Lobko <seva@alex-ua.com>.
In kernel configuration file add
options OVERRIDE_CARD=2
options OVERRIDE_TUNER=11
options BKTR_USE_PLL
1.51 31 August 1998 Roger Hardiman <roger@cs.strath.ac.uk>
Fixed bug in Miro Tuner detection. Missing Goto.
Removed Hauppauge EEPROM 0x10 detection as I think
0x10 should be a PAL tuner, not NTSC.
Reinstated some Tuner Guesswork code from 1.27
1.52 3 Sep 1998 Roger Hardiman <roger@cs.strath.ac.uk>
Submitted patch by Vsevolod Lobko <seva@alex-ua.com>
to correct SECAM B-Delay and add XUSSR channel set.
1.53 9 Sep 1998 Roger Hardiman <roger@cs.strath.ac.uk>
Changed METEORSINPUT for Hauppauge cards with bt878.
Submitted by Fred Templin <templin@erg.sri.com>
Also fixed video_open defines and 878 support.
1.54 18 Sep 1998 Roger Hardiman <roger@cs.strath.ac.uk>
Changed tuner code to autodetect tuner i2c address.
Addresses were incorrectly hardcoded.
1.55 21 Sep 1998 Roger Hardiman <roger@cs.strath.ac.uk>
Hauppauge Tech Support confirmed all Hauppauge 878
PAL/SECAM boards will use PLL mode.
Added to card probe. Thanks to Ken and Fred.
1.56 21 Jan 1999 Roger Hardiman <roger@cs.strath.ac.uk>
Added detection of Hauppauge IR remote control.
and MSP34xx Audio chip. Fixed i2c read error.
Hauppauge supplied details of new Tuner Types.
Danny Braniss <danny@cs.huji.ac.il> submitted Bt878
AVerMedia detection with PCI subsystem vendor id.
1.57 26 Jan 1999 Roger Hardiman <roger@cs.strath.ac.uk>
Support for MSP3410D / MSP3415D Stereo/Mono audio
using the audio format Auto Detection Mode.
Nicolas Souchu <nsouch@freebsd.org> ported the
msp_read/write/reset functions to smbus/iicbus.
METEOR_INPUT_DEV2 now selects a composite camera on
the SVIDEO port for Johan Larsson<gozer@ludd.luth.se>
For true SVIDEO, use METEOR_INPUT_DEV_SVIDEO
1.58 8 Feb 1999 Roger Hardiman <roger@cs.strath.ac.uk>
Added check to bktr_mmap from OpenBSD driver.
Improved MSP34xx reset for bt848 Hauppauge boards.
Added detection for Bt848a.
Vsevolod Lobko<seva@sevasoft.alex-ua.com> added
more XUSSR channels.
1.59 9 Feb 1999 Added ioctl REMOTE_GETKEY for Hauppauge Infra-Red
Remote Control. Submitted by Roger Hardiman.
Added ioctl TVTUNER_GETCHANSET and
BT848_GPIO_SET_EN,BT848_GPIO_SET_DATA (and GETs)
Submitted by Vsevolod Lobko <seva@alex-ua.com>
1.60 23 Feb 1999 Roger Hardiman <roger@freebsd.org>
Corrected Mute on Hauppauge Radio cards.
Autodetect MMAC Osprey by looking for "MMAC" in the EEPROM.
Added for Jan Schmidt <mmedia@rz.uni-greifswald.de>
Added ALPS Tuner Type from Hiroki Mori <mori@infocity.co.jp>
1.61 29 Apr 1999 Roger Hardiman <roger@freebsd.org>
Fix row=0/columns=0 bug. From Randal Hopper<aa8vb@ipass.net>
Add option to block the reset of the MSP34xx audio chip by
adding options BKTR_NO_MSP_RESET to the kernel config file.
This is useful if you run another operating system
first to initialise the audio chip, then do a soft reboot.
Added for Yuri Gindin <yuri@xpert.com>
1.62 29 Apr 1999 Added new cards: NEC PK-UG-X017 and I/O DATA GV-BCTV2/PCI
Added new tuner: ALPS_TSBH1 (plus FM Radio for ALPS_TSCH5)
Added support for BCTV audio mux.
All submitted by Hiroki Mori <mori@infocity.co.jp>
1.63 29 Apr 1999 Roger Hardiman <roger@freebsd.org>
Added initial code for VBI capture based on work by
Hiroki Mori <mori@infocity.co.jp> and reworked by myself.
This allows software decoding of teletext, intercast and
subtitles via /dev/vbi.
1.64 7 May 1999 Roger Hardiman <roger@freebsd.org>
Support LifeView FlyVideo 98 cards. Use EEPROM for card
autodetection. Use bttv's audio mux values.
Thanks to Paul Reece <paul@fastlane.net.au>,
Ivan Brawley <brawley@internode.com.au> and
Gilad Rom <rom_glsa@ein-hashofet.co.il>
Automatically locate the EEPROM i2c address and read the
subsystem_vendor_id from EEPROM and not the PCI registers.
Add NSMBUS checks around smbus/iicbus i2c bus code
making it easier to compile the driver under 2.2.x.
Add GPIO mask for the audio mux to each card type.
Add CARD_ZOLTRIX and CARD_KISS from mailing list searches.
1.65 18 May 1999 Roger Hardiman <roger@freebsd.org>
Change Intel GPIO mask to stop turning the Intel Camera off
Fixed tuner selection on Hauppauge card with tuner 0x0a
Replaced none tuner with no tuner for Theo de Raadt.
Ivan Brawley <brawley@internode.com.au> added
the Australian channel frequencies.
1.66 19 May 1999 Ivan Brawley <brawley@internode.com.au> added better
Australian channel frequencies.
1.67 23 May 1999 Roger Hardiman <roger@freebsd.org>
Added rgb_vbi_prog() to capture VBI data and video at the
same time. To capture VBI data, /dev/vbi must be opened
before starting video capture.
1.68 25 May 1999 Roger Hardiman <roger@freebsd.org>
Due to differences in PCI bus implementations from various
motherboard chipset manufactuers, the Bt878/Bt879 has 3
PCI bus compatibility modes. These are
NORMAL PCI 2.1 for proper PCI 2.1 compatible chipsets.
INTEL 430 FX for the Intel 430 FX chipset.
SIS VIA CHIPSET for certain SiS and VIA chipsets.
Older Intel and non-Intel chipsets may also benefit from
either 430_FX or SIS/VIA mode.
NORMAL PCI mode is enabled by default.
For INTEL 430 FX mode, add this to your kenel config:
options "BKTR_430_FX_MODE"
For SiS / VIA mode, add this to your kernel config:
options "BKTR_SIS_VIA_MODE"
Using quotes in these options is not needed in FreeBSD 4.x.
Note. Newer VIA chipsets should be fully PCI 2.1 compatible
and should work fine in the Default mode.
Also rename 849 to 849A, the correct name for the chip.
1.69 12 June 1999 Roger Hardiman <roger@freebsd.org>
Updates for FreeBSD 4.x device driver interface.
BSDI code removed. Will be restored later.
1.70 12 July 1999 Roger Hardiman <roger@freebsd.org>
Reorganise OS device dependent parts (based on a port to
linux by Brad Parker).
Make the driver compile on FreeBSD 2.2.x systems again.
Change number of VBI lines from 16 to 12 for NTSC formats.
Changes to probeCard() for better eeprom identification.
Added STB Bt878 card identification.
Add Hauppauge model identification to probeCard().
Added TDA9850 initialisation code taken from Linux bttv.
Juha.Nurmela@quicknet.inet.fi found/fixed bug in VBI_SLEEP.
Matt Brown <matt@dqc.org> added MSP3430G DBX initialisation.
1.71 30 Aug 1999 Roger Hardiman <roger@freebsd.org>
Small cleanup of OS dependent code. Remove NPCI usage.
Fix bug in AVerMedia detection.
Update VBI support for the AleVT Teletext package. Parts
from Juha Nurmela's driver <Juha.Nurmela@quicknet.inet.fi>
Add support for Hauppauge 627 and Temic 4006 submitted
by Maurice Castro <maurice@atum.castro.aus.net>
Tom Jansen <tom@unhooked.net> added BSDi support again.
1.72 31 Aug 1999 Juha Nurmela <Juha.Nurmela@quicknet.inet.fi>
Clear cap_ctl register when restarting the RISC program.
This fixes the freezes experienced when changing changes.
1.73 10 Sep 1999 Roger Hardiman <roger@freebsd.org>
Add Hauppauge tuner #6 for Brian Somers <brian@freebsd.org>
Add card type for Aimslabs Video Highway Xtreme for
Ladislav Kostal <kostal@pefstud.uniag.sk>
Added select() code (for VBI) for the 2.2.x driver
tested by Steve Richards <steve@richsoft.demon.co.uk>
1.74 17 Sep 1999 Roger Hardiman <roger@freebsd.org>
Fix bug where FM radio stations were offset after using FXTV
AVerMedia tuner type autodetection added for cards with
a configuration EEPROM (currently their Bt878 range)
Thanks to Frank at AVerMedia for providing the information.
Tested by David La Croix <dlacroix@cowpie.acm.vt.edu>
Tidy up some tuner code and Hauppauge detection code.
New NetBSD code from Bernd Ernesti<bernd@arresum.inka.de>
2.00 25 Sep 1999 Roger Hardiman <roger@freebsd.org>
Split the driver into separate tuner, card and audio sections.
Update tuner code for FM radio to use datasheet equations.
2.01 27 Sep 1999 Roger Hardiman <roger@freebsd.org>
Add Dynalink Magic TView for Craig <crh@outpost.co.nz>
Add Leadtek Winfast 2000 for Peter Wemm <peter@netplex.com.au>
There is no audio support on these 2 cards yet.
Tidy up a few tables with tabs and PLL selection code.
Restore Video Highway Xtreme PLL code.
2.02 4 Oct 1999 Peter Wemm <peter@netplex.com.au>
Updated Australian Channel Set.
Added Tuner and Mute values for LeadTek Winfast 2000 card
2.03 5 Oct 1999 Thomas Runge <runge@rostock.zgdv.de>
Found FM radio bug mute introduced in release 2.00
2.04 20 Oct 1999 Roger Hardiman <roger@freebsd.org>
Updated AVerMedia audio sources to support FM and Line In
sources properly. (Based on info supplied by AVerMedia)
Make PLL mode the default for Bt878 chips. This means PAL
Bt878 users no longer need the BKTR_USE_PLL kernel option.
Detect and auto-configure Dolby Surround Sound DPL3518A chip
on Hauppauge WinTV Theater. From Frank Nobis <fn@radio-do.de>
2.05 8 Nov 1999 Update tuner control codes for Philips SECAM. Submitted by
Cyrille Lefevre <clefevre@citeweb.net>
Updated clipping code, ready for Xv support in XFree86 4.0,
submitted by Thomas Mueller <tmueller@thmu.de>
Thomas also has information on a LynxOS port of this driver.
Phase out the rgb_prog RISC program and use rgb_vbi_prog as
the default. Now you no longer have to open /dev/vbi
before /dev/bktr. - Roger Hardiman <roger@freebsd.org>
2.06 7 Dec 1999 Fix bug which made the tuner fail on cards detected as
IMS Turbo. Found by Patrick Mackeown<pgm@NS4.HELP-DESK.CO.UK>
Put back some Hauppauge Tuner Types I deleted my mistake.
Backout the switch from rgb_prob to rgb_vbi_prog due to
problems with NTSC users.
2.07 24 Jan 2000 Update i2c code to build on FreeBSD 3.x and 4.x machines.
Added GPIO audio values for the Askey/Dynalink TV card
taken from postings on the V4L mailing list.
Update Australian Channel Set. Submitted by
John Birrell <jb@cimlogic.com.au>
Add new Channel Set for France. Submitted by
Daniel Dagneaux <dagneaux@lure.u-psud.fr>
2.08 6 Mar 2000 Reinstate rgb_vbi_prog as the default RISC program for
PAL video. This does not want to work for NTSC, which will
continue to use the rgb_prog RISC program.
Add support for cable channels above channel 100.
Submitted by Scott Presnell <srp@zgi.com>
New MSP3410/3415 setup code submitted by
Frank Nobis<fn@radio-do.de>. This is experimental and is
enabled by setting the sysctl, hw.bt848.slow_msp_audio to 1
before starting FXTV (or before opening /dev/bktrN)
2.09 20 Mar 2000 Thomas Klausner <wiz@danbala.ifoer.tuwien.ac.at> submitted
patches to include the NetBSD and OpenBSD support from driver
1.74 into the new 2.xx driver. NetBSD is tested. OpenBSD is
untested.
Also fixed coding error in bktr_audio.c spotted by Thomas.
Change xxx_ioctl functions to use ioctl_cmd_t for the cmd
parameter. Found by looking at OpenBSDs change logs.
Delete PROT_EXEC from OpenBSD (as per OpenBSD cvs logs).
2.10 4 Apr 2000 Convert to using bus_space() to access the Bt848/878 registers
rather than using a memory mapped structure. This makes the
driver portable to other architectures, like Alpha and PPC.
This was done by Thomas Klausner <wiz@netbsd.org> and
myself Roger Hardiman <roger@freebsd.org>
2.11 15 Apr 2000 Made changes so the driver compiles on FreeBSD/Alpha.
Stop printing MSP autodetect. Requested by
Chris D. Faulhaber <jedgar@fxp.org>
2.12 16 Apr 2000 Set adelay as an 8 bit value, noticed by
Thomas Klausner <wiz@netbsd.org>
Fix typo in the new interrupt code.
2.12 20 May 2000 Merge in NetBSD changes from Thomas Klausner <wiz@netbsd.org>
following the import of driver 2.12 into NetBSD
2.13 26 Jun 2000 Merge in more changes from Thomas Klausner <wiz@netbsd.org>
syncing this driver with the NetBSD source at 25th June.
2.14 28 Jun 2000 Add new Hauppauge Tuner Types, supplied by Hauppauge and
required for Josef Karthauser <joe@pavilion.net>
Change the structure of some of the #include files and
merge in more NetBSD changes.
2.15 10 Sep 2000 Add support for bktr_mem, a module to hold onto the bktr
drives's contiguous memory buffers even when it is unloaded
and reloaded.
Simplify the use of the optional SMBUS i2c code by using a new
#define called BKTR_USE_FREEBSD_SMBUS.
Poul-Henning Kamp <phk@freebsd.org> changed the DEVFS code.
Peter Wemm <peter@freebsd.org> fixed an SMBUS warning.
Alexander Langer <alex@cichlids.com> fixed some FreeBSD newbus
resource allocation problems (FreeBSD PR kern/18744).
2.16 19 Sep 2000 Merge in NetBSD changes from Thomas Klausner <wiz@netbsd.org>
2.17 19 Oct 2000 Alexander Langer <alex@big.endian.de> and
Daniel O'Connor <doconnor@gsoft.com.au>
both submitted fixes to devfs code.
Fix PHK's commit so we only include machine/clock.h in
FreeBSD 2.x, 3.x and 4.x systems
2.18 30 Oct 2000 Roger Hardiman - Add new ioctls to allow userland programs
fuller access to the I2C bus, BT848_MSP_READ BT848_MSP_WRITE
and BT848_MSP_RESET.
Add tuner type 0x2a. Remove 0x2c which was incorrect.
Christian Gusenbauer <Christian.Gusenbauer@netway.at> added
support for audio on Hauppauge cards without the audio mux.
The MSP is used for audio selection. (the 44xxx models)
[see https://svnweb.freebsd.org/base/head/sys/dev/bktr/
for newer change logs ]

View file

@ -1,646 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-4-Clause
*
* 1. Redistributions of source code must retain the
* Copyright (c) 1997 Amancio Hasty, 1999 Roger Hardiman
* 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 Amancio Hasty and
* Roger Hardiman
* 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.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
/*
* This is part of the Driver for Video Capture Cards (Frame grabbers)
* and TV Tuner cards using the Brooktree Bt848, Bt848A, Bt849A, Bt878, Bt879
* chipset.
* Copyright Roger Hardiman and Amancio Hasty.
*
* bktr_audio : This deals with controlling the audio on TV cards,
* controlling the Audio Multiplexer (audio source selector).
* controlling any MSP34xx stereo audio decoders.
* controlling any DPL35xx dolby surroud sound audio decoders.
* initialising TDA98xx audio devices.
*
*/
#include "opt_bktr.h" /* Include any kernel config options */
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#ifdef __FreeBSD__
#if (__FreeBSD_version < 500000)
#include <machine/clock.h> /* for DELAY */
#include <pci/pcivar.h>
#else
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/selinfo.h>
#include <dev/pci/pcivar.h>
#endif
#include <machine/bus.h>
#include <sys/bus.h>
#endif
#ifdef __NetBSD__
#include <sys/proc.h>
#include <dev/ic/bt8xx.h> /* NetBSD location of .h files */
#include <dev/pci/bktr/bktr_reg.h>
#include <dev/pci/bktr/bktr_core.h>
#include <dev/pci/bktr/bktr_tuner.h>
#include <dev/pci/bktr/bktr_card.h>
#include <dev/pci/bktr/bktr_audio.h>
#else
#include <dev/bktr/ioctl_meteor.h>
#include <dev/bktr/ioctl_bt848.h> /* extensions to ioctl_meteor.h */
#include <dev/bktr/bktr_reg.h>
#include <dev/bktr/bktr_core.h>
#include <dev/bktr/bktr_tuner.h>
#include <dev/bktr/bktr_card.h>
#include <dev/bktr/bktr_audio.h>
#endif
/*
* Prototypes for the GV_BCTV2 specific functions.
*/
void set_bctv2_audio( bktr_ptr_t bktr );
void bctv2_gpio_write( bktr_ptr_t bktr, int port, int val );
/*int bctv2_gpio_read( bktr_ptr_t bktr, int port );*/ /* Not used */
/*
* init_audio_devices
* Reset any MSP34xx or TDA98xx audio devices.
*/
void init_audio_devices( bktr_ptr_t bktr ) {
/* enable stereo if appropriate on TDA audio chip */
if ( bktr->card.dbx )
init_BTSC( bktr );
/* reset the MSP34xx stereo audio chip */
if ( bktr->card.msp3400c )
msp_dpl_reset( bktr, bktr->msp_addr );
/* reset the DPL35xx dolby audio chip */
if ( bktr->card.dpl3518a )
msp_dpl_reset( bktr, bktr->dpl_addr );
}
/*
*
*/
#define AUDIOMUX_DISCOVER_NOT
int
set_audio( bktr_ptr_t bktr, int cmd )
{
u_long temp;
volatile u_char idx;
#if defined( AUDIOMUX_DISCOVER )
if ( cmd >= 200 )
cmd -= 200;
else
#endif /* AUDIOMUX_DISCOVER */
/* check for existence of audio MUXes */
if ( !bktr->card.audiomuxs[ 4 ] )
return( -1 );
switch (cmd) {
case AUDIO_TUNER:
#ifdef BKTR_REVERSEMUTE
bktr->audio_mux_select = 3;
#else
bktr->audio_mux_select = 0;
#endif
if (bktr->reverse_mute )
bktr->audio_mux_select = 0;
else
bktr->audio_mux_select = 3;
break;
case AUDIO_EXTERN:
bktr->audio_mux_select = 1;
break;
case AUDIO_INTERN:
bktr->audio_mux_select = 2;
break;
case AUDIO_MUTE:
bktr->audio_mute_state = TRUE; /* set mute */
break;
case AUDIO_UNMUTE:
bktr->audio_mute_state = FALSE; /* clear mute */
break;
default:
printf("%s: audio cmd error %02x\n", bktr_name(bktr),
cmd);
return( -1 );
}
/* Most cards have a simple audio multiplexer to select the
* audio source. The I/O_GV card has a more advanced multiplexer
* and requires special handling.
*/
if ( bktr->bt848_card == CARD_IO_BCTV2 ) {
set_bctv2_audio( bktr );
return( 0 );
}
/* Proceed with the simpler audio multiplexer code for the majority
* of Bt848 cards.
*/
/*
* Leave the upper bits of the GPIO port alone in case they control
* something like the dbx or teletext chips. This doesn't guarantee
* success, but follows the rule of least astonishment.
*/
if ( bktr->audio_mute_state == TRUE ) {
#ifdef BKTR_REVERSEMUTE
idx = 0;
#else
idx = 3;
#endif
if (bktr->reverse_mute )
idx = 3;
else
idx = 0;
}
else
idx = bktr->audio_mux_select;
temp = INL(bktr, BKTR_GPIO_DATA) & ~bktr->card.gpio_mux_bits;
#if defined( AUDIOMUX_DISCOVER )
OUTL(bktr, BKTR_GPIO_DATA, temp | (cmd & 0xff));
printf("%s: cmd: %d audio mux %x temp %x \n", bktr_name(bktr),
cmd, bktr->card.audiomuxs[ idx ], temp );
#else
OUTL(bktr, BKTR_GPIO_DATA, temp | bktr->card.audiomuxs[ idx ]);
#endif /* AUDIOMUX_DISCOVER */
/* Some new Hauppauge cards do not have an audio mux */
/* Instead we use the MSP34xx chip to select TV audio, Line-In */
/* FM Radio and Mute */
/* Examples of this are the Hauppauge 44xxx MSP34xx models */
/* It is ok to drive both the mux and the MSP34xx chip. */
/* If there is no mux, the MSP does the switching of the audio source */
/* If there is a mux, it does the switching of the audio source */
if ((bktr->card.msp3400c) && (bktr->audio_mux_present == 0)) {
if (bktr->audio_mute_state == TRUE ) {
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0000, 0x0000); /* volume to MUTE */
} else {
if(bktr->audio_mux_select == 0) { /* TV Tuner */
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0000, 0x7300); /* 0 db volume */
if (bktr->msp_source_selected != 0) msp_autodetect(bktr); /* setup TV audio mode */
bktr->msp_source_selected = 0;
}
if(bktr->audio_mux_select == 1) { /* Line In */
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0000, 0x7300); /* 0 db volume */
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x000d, 0x1900); /* scart prescale */
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0008, 0x0220); /* SCART | STEREO */
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0013, 0x0000); /* DSP In = SC1_IN_L/R */
bktr->msp_source_selected = 1;
}
if(bktr->audio_mux_select == 2) { /* FM Radio */
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0000, 0x7300); /* 0 db volume */
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x000d, 0x1900); /* scart prescale */
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0008, 0x0220); /* SCART | STEREO */
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0013, 0x0200); /* DSP In = SC2_IN_L/R */
bktr->msp_source_selected = 2;
}
}
}
return( 0 );
}
/*
*
*/
void
temp_mute( bktr_ptr_t bktr, int flag )
{
static int muteState = FALSE;
if ( flag == TRUE ) {
muteState = bktr->audio_mute_state;
set_audio( bktr, AUDIO_MUTE ); /* prevent 'click' */
}
else {
tsleep( BKTR_SLEEP, PZERO, "tuning", hz/8 );
if ( muteState == FALSE )
set_audio( bktr, AUDIO_UNMUTE );
}
}
/* address of BTSC/SAP decoder chip */
#define TDA9850_WADDR 0xb6
#define TDA9850_RADDR 0xb7
/* registers in the TDA9850 BTSC/dbx chip */
#define CON1ADDR 0x04
#define CON2ADDR 0x05
#define CON3ADDR 0x06
#define CON4ADDR 0x07
#define ALI1ADDR 0x08
#define ALI2ADDR 0x09
#define ALI3ADDR 0x0a
/*
* initialise the dbx chip
* taken from the Linux bttv driver TDA9850 initialisation code
*/
void
init_BTSC( bktr_ptr_t bktr )
{
i2cWrite(bktr, TDA9850_WADDR, CON1ADDR, 0x08); /* noise threshold st */
i2cWrite(bktr, TDA9850_WADDR, CON2ADDR, 0x08); /* noise threshold sap */
i2cWrite(bktr, TDA9850_WADDR, CON3ADDR, 0x40); /* stereo mode */
i2cWrite(bktr, TDA9850_WADDR, CON4ADDR, 0x07); /* 0 dB input gain? */
i2cWrite(bktr, TDA9850_WADDR, ALI1ADDR, 0x10); /* wideband alignment? */
i2cWrite(bktr, TDA9850_WADDR, ALI2ADDR, 0x10); /* spectral alignment? */
i2cWrite(bktr, TDA9850_WADDR, ALI3ADDR, 0x03);
}
/*
* setup the dbx chip
* XXX FIXME: a lot of work to be done here, this merely unmutes it.
*/
int
set_BTSC( bktr_ptr_t bktr, int control )
{
return( i2cWrite( bktr, TDA9850_WADDR, CON3ADDR, control ) );
}
/*
* CARD_GV_BCTV2 specific functions.
*/
#define BCTV2_AUDIO_MAIN 0x10 /* main audio program */
#define BCTV2_AUDIO_SUB 0x20 /* sub audio program */
#define BCTV2_AUDIO_BOTH 0x30 /* main(L) + sub(R) program */
#define BCTV2_GPIO_REG0 1
#define BCTV2_GPIO_REG1 3
#define BCTV2_GR0_AUDIO_MODE 3
#define BCTV2_GR0_AUDIO_MAIN 0 /* main program */
#define BCTV2_GR0_AUDIO_SUB 3 /* sub program */
#define BCTV2_GR0_AUDIO_BOTH 1 /* main(L) + sub(R) */
#define BCTV2_GR0_AUDIO_MUTE 4 /* audio mute */
#define BCTV2_GR0_AUDIO_MONO 8 /* force mono */
void
set_bctv2_audio( bktr_ptr_t bktr )
{
int data;
switch (bktr->audio_mux_select) {
case 1: /* external */
case 2: /* internal */
bctv2_gpio_write(bktr, BCTV2_GPIO_REG1, 0);
break;
default: /* tuner */
bctv2_gpio_write(bktr, BCTV2_GPIO_REG1, 1);
break;
}
/* switch (bktr->audio_sap_select) { */
switch (BCTV2_AUDIO_BOTH) {
case BCTV2_AUDIO_SUB:
data = BCTV2_GR0_AUDIO_SUB;
break;
case BCTV2_AUDIO_BOTH:
data = BCTV2_GR0_AUDIO_BOTH;
break;
case BCTV2_AUDIO_MAIN:
default:
data = BCTV2_GR0_AUDIO_MAIN;
break;
}
if (bktr->audio_mute_state == TRUE)
data |= BCTV2_GR0_AUDIO_MUTE;
bctv2_gpio_write(bktr, BCTV2_GPIO_REG0, data);
return;
}
/* gpio_data bit assignment */
#define BCTV2_GPIO_ADDR_MASK 0x000300
#define BCTV2_GPIO_WE 0x000400
#define BCTV2_GPIO_OE 0x000800
#define BCTV2_GPIO_VAL_MASK 0x00f000
#define BCTV2_GPIO_PORT_MASK 3
#define BCTV2_GPIO_ADDR_SHIFT 8
#define BCTV2_GPIO_VAL_SHIFT 12
/* gpio_out_en value for read/write */
#define BCTV2_GPIO_OUT_RMASK 0x000f00
#define BCTV2_GPIO_OUT_WMASK 0x00ff00
#define BCTV2_BITS 100
void
bctv2_gpio_write( bktr_ptr_t bktr, int port, int val )
{
u_long data, outbits;
port &= BCTV2_GPIO_PORT_MASK;
switch (port) {
case 1:
case 3:
data = ((val << BCTV2_GPIO_VAL_SHIFT) & BCTV2_GPIO_VAL_MASK) |
((port << BCTV2_GPIO_ADDR_SHIFT) & BCTV2_GPIO_ADDR_MASK) |
BCTV2_GPIO_WE | BCTV2_GPIO_OE;
outbits = BCTV2_GPIO_OUT_WMASK;
break;
default:
return;
}
OUTL(bktr, BKTR_GPIO_OUT_EN, 0);
OUTL(bktr, BKTR_GPIO_DATA, data);
OUTL(bktr, BKTR_GPIO_OUT_EN, outbits);
DELAY(BCTV2_BITS);
OUTL(bktr, BKTR_GPIO_DATA, data & ~BCTV2_GPIO_WE);
DELAY(BCTV2_BITS);
OUTL(bktr, BKTR_GPIO_DATA, data);
DELAY(BCTV2_BITS);
OUTL(bktr, BKTR_GPIO_DATA, ~0);
OUTL(bktr, BKTR_GPIO_OUT_EN, 0);
}
/* Not yet used
int
bctv2_gpio_read( bktr_ptr_t bktr, int port )
{
u_long data, outbits, ret;
port &= BCTV2_GPIO_PORT_MASK;
switch (port) {
case 1:
case 3:
data = ((port << BCTV2_GPIO_ADDR_SHIFT) & BCTV2_GPIO_ADDR_MASK) |
BCTV2_GPIO_WE | BCTV2_GPIO_OE;
outbits = BCTV2_GPIO_OUT_RMASK;
break;
default:
return( -1 );
}
OUTL(bktr, BKTR_GPIO_OUT_EN, 0);
OUTL(bktr, BKTR_GPIO_DATA, data);
OUTL(bktr, BKTR_GPIO_OUT_EN, outbits);
DELAY(BCTV2_BITS);
OUTL(bktr, BKTR_GPIO_DATA, data & ~BCTV2_GPIO_OE);
DELAY(BCTV2_BITS);
ret = INL(bktr, BKTR_GPIO_DATA);
DELAY(BCTV2_BITS);
OUTL(bktr, BKTR_GPIO_DATA, data);
DELAY(BCTV2_BITS);
OUTL(bktr, BKTR_GPIO_DATA, ~0);
OUTL(bktr, BKTR_GPIO_OUT_EN, 0);
return( (ret & BCTV2_GPIO_VAL_MASK) >> BCTV2_GPIO_VAL_SHIFT );
}
*/
/*
* setup the MSP34xx Stereo Audio Chip
* This uses the Auto Configuration Option on MSP3410D and MSP3415D chips
* and DBX mode selection for MSP3430G chips.
* For MSP3400C support, the full programming sequence is required and is
* not yet supported.
*/
/* Read the MSP version string */
void msp_read_id( bktr_ptr_t bktr ){
int rev1=0, rev2=0;
rev1 = msp_dpl_read(bktr, bktr->msp_addr, 0x12, 0x001e);
rev2 = msp_dpl_read(bktr, bktr->msp_addr, 0x12, 0x001f);
sprintf(bktr->msp_version_string, "34%02d%c-%c%d",
(rev2>>8)&0xff, (rev1&0xff)+'@', ((rev1>>8)&0xff)+'@', rev2&0x1f);
}
/* Configure the MSP chip to Auto-detect the audio format.
* For the MSP3430G, we use fast autodetect mode
* For the MSP3410/3415 there are two schemes for this
* a) Fast autodetection - the chip is put into autodetect mode, and the function
* returns immediately. This works in most cases and is the Default Mode.
* b) Slow mode. The function sets the MSP3410/3415 chip, then waits for feedback from
* the chip and re-programs it if needed.
*/
void msp_autodetect( bktr_ptr_t bktr ) {
#ifdef BKTR_NEW_MSP34XX_DRIVER
/* Just wake up the (maybe) sleeping thread, it'll do everything for us */
msp_wake_thread(bktr);
#else
int auto_detect, loops;
int stereo;
/* MSP3430G - countries with mono and DBX stereo */
if (strncmp("3430G", bktr->msp_version_string, 5) == 0){
msp_dpl_write(bktr, bktr->msp_addr, 0x10, 0x0030,0x2003);/* Enable Auto format detection */
msp_dpl_write(bktr, bktr->msp_addr, 0x10, 0x0020,0x0020);/* Standard Select Reg. = BTSC-Stereo*/
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x000E,0x2403);/* darned if I know */
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0008,0x0320);/* Source select = (St or A) */
/* & Ch. Matrix = St */
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0000,0x7300);/* Set volume to 0db gain */
}
/* MSP3415D SPECIAL CASE Use the Tuner's Mono audio output for the MSP */
/* (for Hauppauge 44xxx card with Tuner Type 0x2a) */
else if ( ( (strncmp("3415D", bktr->msp_version_string, 5) == 0)
&&(bktr->msp_use_mono_source == 1)
)
|| (bktr->slow_msp_audio == 2) ){
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0000, 0x7300); /* 0 db volume */
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x000d, 0x1900); /* scart prescale */
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0008, 0x0220); /* SCART | STEREO */
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0013, 0x0100); /* DSP In = MONO IN */
}
/* MSP3410/MSP3415 - countries with mono, stereo using 2 FM channels and NICAM */
/* FAST sound scheme */
else if (bktr->slow_msp_audio == 0) {
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0000,0x7300);/* Set volume to 0db gain */
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0008,0x0000);/* Spkr Source = default(FM/AM) */
msp_dpl_write(bktr, bktr->msp_addr, 0x10, 0x0020,0x0001);/* Enable Auto format detection */
msp_dpl_write(bktr, bktr->msp_addr, 0x10, 0x0021,0x0001);/* Auto selection of NICAM/MONO mode */
}
/* MSP3410/MSP3415 - European Countries where the fast MSP3410/3415 programming fails */
/* SLOW sound scheme */
else if ( bktr->slow_msp_audio == 1) {
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0000,0x7300);/* Set volume to 0db gain */
msp_dpl_write(bktr, bktr->msp_addr, 0x10, 0x0020,0x0001);/* Enable Auto format detection */
/* wait for 0.5s max for terrestrial sound autodetection */
loops = 10;
do {
DELAY(100000);
auto_detect = msp_dpl_read(bktr, bktr->msp_addr, 0x10, 0x007e);
loops++;
} while (auto_detect > 0xff && loops < 50);
if (bootverbose)printf ("%s: Result of autodetect after %dms: %d\n",
bktr_name(bktr), loops*10, auto_detect);
/* Now set the audio baseband processing */
switch (auto_detect) {
case 0: /* no TV sound standard detected */
break;
case 2: /* M Dual FM */
break;
case 3: /* B/G Dual FM; German stereo */
/* Read the stereo detection value from DSP reg 0x0018 */
DELAY(20000);
stereo = msp_dpl_read(bktr, bktr->msp_addr, 0x12, 0x0018);
if (bootverbose)printf ("%s: Stereo reg 0x18 a: %d\n",
bktr_name(bktr), stereo);
DELAY(20000);
stereo = msp_dpl_read(bktr, bktr->msp_addr, 0x12, 0x0018);
if (bootverbose)printf ("%s: Stereo reg 0x18 b: %d\n",
bktr_name(bktr), stereo);
DELAY(20000);
stereo = msp_dpl_read(bktr, bktr->msp_addr, 0x12, 0x0018);
if (bootverbose)printf ("%s: Stereo reg 0x18 c: %d\n",
bktr_name(bktr), stereo);
if (stereo > 0x0100 && stereo < 0x8000) { /* Seems to be stereo */
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0008,0x0020);/* Loudspeaker set stereo*/
/*
set spatial effect strength to 50% enlargement
set spatial effect mode b, stereo basewidth enlargement only
*/
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0005,0x3f28);
} else if (stereo > 0x8000) { /* bilingual mode */
if (bootverbose) printf ("%s: Bilingual mode detected\n",
bktr_name(bktr));
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0008,0x0000);/* Loudspeaker */
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0005,0x0000);/* all spatial effects off */
} else { /* must be mono */
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0008,0x0030);/* Loudspeaker */
/*
set spatial effect strength to 50% enlargement
set spatial effect mode a, stereo basewidth enlargement
and pseudo stereo effect with automatic high-pass filter
*/
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0005,0x3f08);
}
#if 0
/* The reset value for Channel matrix mode is FM/AM and SOUNDA/LEFT */
/* We would like STEREO instead val: 0x0020 */
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0008,0x0020);/* Loudspeaker */
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0009,0x0020);/* Headphone */
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x000a,0x0020);/* SCART1 */
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0041,0x0020);/* SCART2 */
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x000b,0x0020);/* I2S */
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x000c,0x0020);/* Quasi-Peak Detector Source */
msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x000e,0x0001);
#endif
break;
case 8: /* B/G FM NICAM */
msp_dpl_write(bktr, bktr->msp_addr, 0x10, 0x0021,0x0001);/* Auto selection of NICAM/MONO mode */
break;
case 9: /* L_AM NICAM or D/K*/
case 10: /* i-FM NICAM */
break;
default:
if (bootverbose) printf ("%s: Unknown autodetection result value: %d\n",
bktr_name(bktr), auto_detect);
}
}
/* uncomment the following line to enable the MSP34xx 1Khz Tone Generator */
/* turn your speaker volume down low before trying this */
/* msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0014, 0x7f40); */
#endif /* BKTR_NEW_MSP34XX_DRIVER */
}
/* Read the DPL version string */
void dpl_read_id( bktr_ptr_t bktr ){
int rev1=0, rev2=0;
rev1 = msp_dpl_read(bktr, bktr->dpl_addr, 0x12, 0x001e);
rev2 = msp_dpl_read(bktr, bktr->dpl_addr, 0x12, 0x001f);
sprintf(bktr->dpl_version_string, "34%02d%c-%c%d",
((rev2>>8)&0xff)-1, (rev1&0xff)+'@', ((rev1>>8)&0xff)+'@', rev2&0x1f);
}
/* Configure the DPL chip to Auto-detect the audio format */
void dpl_autodetect( bktr_ptr_t bktr ) {
/* The following are empiric values tried from the DPL35xx data sheet */
msp_dpl_write(bktr, bktr->dpl_addr, 0x12, 0x000c,0x0320); /* quasi peak detector source dolby
lr 0x03xx; quasi peak detector matrix
stereo 0xXX20 */
msp_dpl_write(bktr, bktr->dpl_addr, 0x12, 0x0040,0x0060); /* Surround decoder mode;
ADAPTIVE/3D-PANORAMA, that means two
speakers and no center speaker, all
channels L/R/C/S mixed to L and R */
msp_dpl_write(bktr, bktr->dpl_addr, 0x12, 0x0041,0x0620); /* surround source matrix;I2S2/STEREO*/
msp_dpl_write(bktr, bktr->dpl_addr, 0x12, 0x0042,0x1F00); /* surround delay 31ms max */
msp_dpl_write(bktr, bktr->dpl_addr, 0x12, 0x0043,0x0000); /* automatic surround input balance */
msp_dpl_write(bktr, bktr->dpl_addr, 0x12, 0x0044,0x4000); /* surround spatial effect 50%
recommended*/
msp_dpl_write(bktr, bktr->dpl_addr, 0x12, 0x0045,0x5400); /* surround panorama effect 66%
recommended with PANORAMA mode
in 0x0040 set to panorama */
}

View file

@ -1,91 +0,0 @@
/* $FreeBSD$ */
/*
* This is part of the Driver for Video Capture Cards (Frame grabbers)
* and TV Tuner cards using the Brooktree Bt848, Bt848A, Bt849A, Bt878, Bt879
* chipset.
* Copyright Roger Hardiman and Amancio Hasty.
*
* bktr_audio : This deals with controlling the audio on TV cards,
* controlling the Audio Multiplexer (audio source selector).
* controlling any MSP34xx stereo audio decoders.
* controlling any DPL35xx dolby surroud sound audio decoders.
* initialising TDA98xx audio devices.
*
*/
/*-
* SPDX-License-Identifier: BSD-4-Clause
*
* 1. Redistributions of source code must retain the
* Copyright (c) 1997 Amancio Hasty, 1999 Roger Hardiman
* 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 Amancio Hasty and
* Roger Hardiman
* 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.
*/
/*
* Select Audio source, and allow muting
*/
int set_audio( bktr_ptr_t bktr, int mode );
void temp_mute( bktr_ptr_t bktr, int flag );
/*
* Initialise any MSP or TDA devices
*/
void init_audio_devices( bktr_ptr_t bktr );
/*
* MSP34xx Audio Chip functions.
*/
void msp_autodetect( bktr_ptr_t bktr );
void msp_read_id( bktr_ptr_t bktr );
#ifdef BKTR_NEW_MSP34XX_DRIVER
int msp_attach(bktr_ptr_t bktr);
int msp_detach(bktr_ptr_t bktr);
void msp_wake_thread(bktr_ptr_t bktr);
void msp_halt_thread(bktr_ptr_t bktr);
#endif
/*
* DPL35xx Audio Chip functions.
*/
void dpl_autodetect( bktr_ptr_t bktr );
void dpl_read_id( bktr_ptr_t bktr );
/*
* TDA98xx Audio Chip functions.
*/
void init_BTSC( bktr_ptr_t bktr );
int set_BTSC( bktr_ptr_t bktr, int control );

File diff suppressed because it is too large Load diff

View file

@ -1,97 +0,0 @@
/* $FreeBSD$ */
/*
* This is part of the Driver for Video Capture Cards (Frame grabbers)
* and TV Tuner cards using the Brooktree Bt848, Bt848A, Bt849A, Bt878, Bt879
* chipset.
* Copyright Roger Hardiman and Amancio Hasty.
*
* bktr_card : This deals with identifying TV cards.
* trying to find the card make and model of card.
* trying to find the type of tuner fitted.
* reading the configuration EEPROM.
* locating i2c devices.
*
*/
/*-
* SPDX-License-Identifier: BSD-4-Clause
*
* 1. Redistributions of source code must retain the
* Copyright (c) 1997 Amancio Hasty, 1999 Roger Hardiman
* 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 Amancio Hasty and
* Roger Hardiman
* 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.
*/
/*
* If probeCard() fails to detect the correct card on boot you can
* override it by setting adding the following option to your kernel config
* options BKTR_OVERRIDE_CARD <card type>
* eg options BKTR_OVERRIDE CARD=1
*
* or using the sysclt hw.bt848.card
* eg sysctl hw.bt848.card=1
*
* where <card type> is one of the following card defines.
*/
#define CARD_UNKNOWN 0
#define CARD_MIRO 1
#define CARD_HAUPPAUGE 2
#define CARD_STB 3
#define CARD_INTEL 4 /* Also for VideoLogic Captivator PCI */
#define CARD_IMS_TURBO 5
#define CARD_AVER_MEDIA 6
#define CARD_OSPREY 7
#define CARD_NEC_PK 8
#define CARD_IO_BCTV2 9
#define CARD_FLYVIDEO 10
#define CARD_ZOLTRIX 11
#define CARD_KISS 12
#define CARD_VIDEO_HIGHWAY_XTREME 13
#define CARD_ASKEY_DYNALINK_MAGIC_TVIEW 14
#define CARD_LEADTEK 15
#define CARD_TERRATVPLUS 16
#define CARD_IO_BCTV3 17
#define CARD_AOPEN_VA1000 18
#define CARD_PINNACLE_PCTV_RAVE 19
#define CARD_PIXELVIEW_PLAYTV_PAK 20
#define CARD_TERRATVALUE 21
#define CARD_PIXELVIEW_PLAYTV_PRO_REV_4C 22
#define CARD_LEADTEK_WINFAST_2000_XP 23
#define Bt848_MAX_CARD 24
#define CARD_IO_GV CARD_IO_BCTV2
int signCard( bktr_ptr_t bktr, int offset, int count, u_char* sig );
void probeCard( bktr_ptr_t bktr, int verbose, int unit);
int writeEEProm( bktr_ptr_t bktr, int offset, int count, u_char *data );
int readEEProm( bktr_ptr_t bktr, int offset, int count, u_char *data );

File diff suppressed because it is too large Load diff

View file

@ -1,98 +0,0 @@
/* $FreeBSD$ */
/*
* This is part of the Driver for Video Capture Cards (Frame grabbers)
* and TV Tuner cards using the Brooktree Bt848, Bt848A, Bt849A, Bt878, Bt879
* chipset.
* Copyright Roger Hardiman and Amancio Hasty.
*
* bktr_core : This deals with the Bt848/849/878/879 PCI Frame Grabber,
* Handles all the open, close, ioctl and read userland calls.
* Sets the Bt848 registers and generates RISC pograms.
* Controls the i2c bus and GPIO interface.
* Contains the interface to the kernel.
* (eg probe/attach and open/close/ioctl)
*
*/
/*-
* SPDX-License-Identifier: BSD-4-Clause
*
* 1. Redistributions of source code must retain the
* Copyright (c) 1997 Amancio Hasty, 1999 Roger Hardiman
* 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 Amancio Hasty and
* Roger Hardiman
* 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.
*/
int i2cWrite( bktr_ptr_t bktr, int addr, int byte1, int byte2 );
int i2cRead( bktr_ptr_t bktr, int addr );
void msp_dpl_reset( bktr_ptr_t bktr, int i2d_addr );
unsigned int msp_dpl_read( bktr_ptr_t bktr, int i2c_addr, unsigned char dev, unsigned int addr );
void msp_dpl_write( bktr_ptr_t bktr, int i2c_addr, unsigned char dev,
unsigned int addr, unsigned int data );
/*
* Defines for userland processes blocked in this driver
* For /dev/bktr[n] use memory address of bktr structure
* For /dev/vbi[n] use memory address of bktr structure + 1
* this is ok as the bktr structure is > 1 byte
*/
#define BKTR_SLEEP ((caddr_t)bktr )
#define VBI_SLEEP ((caddr_t)bktr + 1)
/* device name for printf */
const char *bktr_name(bktr_ptr_t bktr);
/* Prototypes for attatch and interrupt functions */
void common_bktr_attach( bktr_ptr_t bktr, int unit,
u_long pci_id, u_int rev );
int common_bktr_intr( void *arg );
/* Prototypes for open, close, read, mmap and ioctl calls */
int video_open( bktr_ptr_t bktr );
int video_close( bktr_ptr_t bktr );
int video_read( bktr_ptr_t bktr, int unit, struct cdev *dev, struct uio *uio );
int video_ioctl( bktr_ptr_t bktr, int unit,
ioctl_cmd_t cmd, caddr_t arg, struct thread* pr );
int tuner_open( bktr_ptr_t bktr );
int tuner_close( bktr_ptr_t bktr );
int tuner_ioctl( bktr_ptr_t bktr, int unit,
ioctl_cmd_t cmd, caddr_t arg, struct thread* pr );
int vbi_open( bktr_ptr_t bktr );
int vbi_close( bktr_ptr_t bktr );
int vbi_read( bktr_ptr_t bktr, struct uio *uio, int ioflag );

View file

@ -1,364 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 1998, 2001 Nicolas Souchu
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
/*
* I2C support for the bti2c chipset.
*
* From brooktree848.c <fsmp@freefall.org>
*/
#include "opt_bktr.h"
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/systm.h>
#include <sys/module.h>
#include <sys/bus.h>
#include <sys/uio.h>
#if __FreeBSD_version < 500014
#include <sys/select.h>
#else
#include <sys/selinfo.h>
#endif
#if (__FreeBSD_version < 500000)
#include <pci/pcivar.h>
#include <pci/pcireg.h>
#else
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
#endif
#include <machine/bus.h>
#include <sys/bus.h>
#include <dev/bktr/ioctl_meteor.h>
#include <dev/bktr/ioctl_bt848.h> /* extensions to ioctl_meteor.h */
#include <dev/bktr/bktr_reg.h>
#include <dev/bktr/bktr_i2c.h>
#include <dev/smbus/smbconf.h>
#include <dev/iicbus/iiconf.h>
/* Compilation is void if BKTR_USE_FREEBSD_SMBUS is not
* defined. This allows bktr owners to have smbus active for there
* motherboard and still use their bktr without smbus.
*/
#if defined(BKTR_USE_FREEBSD_SMBUS)
#define BTI2C_DEBUG(x) if (bti2c_debug) (x)
static int bti2c_debug = 0;
/*
* Call this to pass the address of the bktr device to the
* bti2c_i2c layer and initialize all the I2C bus architecture
*/
int bt848_i2c_attach(device_t dev)
{
struct bktr_softc *bktr_sc = (struct bktr_softc *)device_get_softc(dev);
struct bktr_i2c_softc *sc = &bktr_sc->i2c_sc;
sc->smbus = device_add_child(dev, "smbus", -1);
sc->iicbb = device_add_child(dev, "iicbb", -1);
if (!sc->iicbb || !sc->smbus)
return ENXIO;
bus_generic_attach(dev);
return (0);
};
int bt848_i2c_detach(device_t dev)
{
struct bktr_softc *bktr_sc = (struct bktr_softc *)device_get_softc(dev);
struct bktr_i2c_softc *sc = &bktr_sc->i2c_sc;
int error = 0;
if ((error = bus_generic_detach(dev)))
goto error;
if (sc->iicbb && (error = device_delete_child(dev, sc->iicbb)))
goto error;
if (sc->smbus && (error = device_delete_child(dev, sc->smbus)))
goto error;
error:
return (error);
}
int bti2c_smb_callback(device_t dev, int index, void *data)
{
struct bktr_softc *bktr_sc = (struct bktr_softc *)device_get_softc(dev);
struct bktr_i2c_softc *sc = &bktr_sc->i2c_sc;
int error = 0;
/* test each time if we already have/haven't the iicbus
* to avoid deadlocks
*/
switch (index) {
case SMB_REQUEST_BUS:
/* XXX test & set */
mtx_lock(&Giant);
if (!sc->bus_owned) {
sc->bus_owned = 1;
} else
error = EWOULDBLOCK;
mtx_unlock(&Giant);
break;
case SMB_RELEASE_BUS:
/* XXX test & set */
mtx_lock(&Giant);
if (sc->bus_owned) {
sc->bus_owned = 0;
} else
error = EINVAL;
mtx_unlock(&Giant);
break;
default:
error = EINVAL;
}
return (error);
}
int bti2c_iic_callback(device_t dev, int index, caddr_t *data)
{
struct bktr_softc *bktr_sc = (struct bktr_softc *)device_get_softc(dev);
struct bktr_i2c_softc *sc = &bktr_sc->i2c_sc;
int error = 0;
/* test each time if we already have/haven't the smbus
* to avoid deadlocks
*/
switch (index) {
case IIC_REQUEST_BUS:
/* XXX test & set */
mtx_lock(&Giant);
if (!sc->bus_owned) {
sc->bus_owned = 1;
} else
error = EWOULDBLOCK;
mtx_unlock(&Giant);
break;
case IIC_RELEASE_BUS:
/* XXX test & set */
mtx_lock(&Giant);
if (sc->bus_owned) {
sc->bus_owned = 0;
} else
error = EINVAL;
mtx_unlock(&Giant);
break;
default:
error = EINVAL;
}
return (error);
}
int bti2c_iic_reset(device_t dev, u_char speed, u_char addr, u_char * oldaddr)
{
mtx_lock(&Giant);
if (oldaddr)
*oldaddr = 0; /* XXX */
mtx_unlock(&Giant);
return (IIC_ENOADDR);
}
void bti2c_iic_setsda(device_t dev, int val)
{
struct bktr_softc *sc = (struct bktr_softc *)device_get_softc(dev);
int clock;
mtx_lock(&Giant);
clock = INL(sc, BKTR_I2C_DATA_CTL) & 0x2;
if (val)
OUTL(sc, BKTR_I2C_DATA_CTL, clock | 1);
else
OUTL(sc, BKTR_I2C_DATA_CTL, clock);
mtx_unlock(&Giant);
return;
}
void bti2c_iic_setscl(device_t dev, int val)
{
struct bktr_softc *sc = (struct bktr_softc *)device_get_softc(dev);
int data;
mtx_lock(&Giant);
data = INL(sc, BKTR_I2C_DATA_CTL) & 0x1;
if (val)
OUTL(sc, BKTR_I2C_DATA_CTL, 0x2 | data);
else
OUTL(sc, BKTR_I2C_DATA_CTL, data);
mtx_unlock(&Giant);
return;
}
int
bti2c_iic_getsda(device_t dev)
{
struct bktr_softc *sc = (struct bktr_softc *)device_get_softc(dev);
int retval;
mtx_lock(&Giant);
retval = INL(sc,BKTR_I2C_DATA_CTL) & 0x1;
mtx_unlock(&Giant);
return (retval);
}
int
bti2c_iic_getscl(device_t dev)
{
return (0);
}
static int
bti2c_write(struct bktr_softc *sc, u_long data)
{
u_long x;
mtx_lock(&Giant);
/* clear status bits */
OUTL(sc, BKTR_INT_STAT, (BT848_INT_RACK | BT848_INT_I2CDONE));
BTI2C_DEBUG(printf("w%lx", data));
/* write the address and data */
OUTL(sc, BKTR_I2C_DATA_CTL, data);
/* wait for completion */
for ( x = 0x7fffffff; x; --x ) { /* safety valve */
if ( INL(sc, BKTR_INT_STAT) & BT848_INT_I2CDONE )
break;
}
/* check for ACK */
if ( !x || !( INL(sc, BKTR_INT_STAT) & BT848_INT_RACK) ) {
BTI2C_DEBUG(printf("%c%c", (!x)?'+':'-',
(!( INL(sc, BKTR_INT_STAT) & BT848_INT_RACK))?'+':'-'));
mtx_unlock(&Giant);
return (SMB_ENOACK);
}
BTI2C_DEBUG(printf("+"));
mtx_unlock(&Giant);
/* return OK */
return( 0 );
}
int
bti2c_smb_writeb(device_t dev, u_char slave, char cmd, char byte)
{
struct bktr_softc *sc = (struct bktr_softc *)device_get_softc(dev);
u_long data;
data = ((slave & 0xff) << 24) | ((byte & 0xff) << 16) | (u_char)cmd;
return (bti2c_write(sc, data));
}
/*
* byte1 becomes low byte of word
* byte2 becomes high byte of word
*/
int
bti2c_smb_writew(device_t dev, u_char slave, char cmd, short word)
{
struct bktr_softc *sc = (struct bktr_softc *)device_get_softc(dev);
u_long data;
char low, high;
low = (char)(word & 0xff);
high = (char)((word & 0xff00) >> 8);
data = ((slave & 0xff) << 24) | ((low & 0xff) << 16) |
((high & 0xff) << 8) | BT848_DATA_CTL_I2CW3B | (u_char)cmd;
return (bti2c_write(sc, data));
}
/*
* The Bt878 and Bt879 differed on the treatment of i2c commands
*/
int
bti2c_smb_readb(device_t dev, u_char slave, char cmd, char *byte)
{
struct bktr_softc *sc = (struct bktr_softc *)device_get_softc(dev);
u_long x;
mtx_lock(&Giant);
/* clear status bits */
OUTL(sc,BKTR_INT_STAT, (BT848_INT_RACK | BT848_INT_I2CDONE));
OUTL(sc,BKTR_I2C_DATA_CTL, ((slave & 0xff) << 24) | (u_char)cmd);
BTI2C_DEBUG(printf("r%lx/", (u_long)(((slave & 0xff) << 24) | (u_char)cmd)));
/* wait for completion */
for ( x = 0x7fffffff; x; --x ) { /* safety valve */
if ( INL(sc,BKTR_INT_STAT) & BT848_INT_I2CDONE )
break;
}
/* check for ACK */
if ( !x || !(INL(sc,BKTR_INT_STAT) & BT848_INT_RACK) ) {
BTI2C_DEBUG(printf("r%c%c", (!x)?'+':'-',
(!( INL(sc,BKTR_INT_STAT) & BT848_INT_RACK))?'+':'-'));
mtx_unlock(&Giant);
return (SMB_ENOACK);
}
*byte = (char)((INL(sc,BKTR_I2C_DATA_CTL) >> 8) & 0xff);
BTI2C_DEBUG(printf("r%x+", *byte));
mtx_unlock(&Giant);
return (0);
}
DRIVER_MODULE(iicbb, bktr, iicbb_driver, iicbb_devclass, 0, 0);
DRIVER_MODULE(smbus, bktr, smbus_driver, smbus_devclass, 0, 0);
#endif /* defined(BKTR_USE_FREEBSD_SMBUS) */

View file

@ -1,49 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 1998, 2001 Nicolas Souchu
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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.
*
* $FreeBSD$
*
*/
#ifndef _BT848_I2C_H
#define _BT848_I2C_H
extern int bt848_i2c_attach(device_t);
extern int bt848_i2c_detach(device_t);
extern int bti2c_iic_callback(device_t, int, caddr_t *);
extern void bti2c_iic_setsda(device_t, int);
extern void bti2c_iic_setscl(device_t, int);
extern int bti2c_iic_getsda(device_t);
extern int bti2c_iic_getscl(device_t);
extern int bti2c_iic_reset(device_t, u_char, u_char, u_char *);
extern int bti2c_smb_callback(device_t, int, void *);
extern int bti2c_smb_writeb(device_t dev, u_char slave, char cmd, char byte);
extern int bti2c_smb_writew(device_t dev, u_char slave, char cmd, short word);
extern int bti2c_smb_readb(device_t dev, u_char slave, char cmd, char *byte);
#endif

View file

@ -1,195 +0,0 @@
/*
* This is part of the Driver for Video Capture Cards (Frame grabbers)
* and TV Tuner cards using the Brooktree Bt848, Bt848A, Bt849A, Bt878, Bt879
* chipset.
* Copyright Roger Hardiman.
*
* bktr_mem : This kernel module allows us to keep our allocated
* contiguous memory for the video buffer, DMA programs and VBI data
* while the main bktr driver is unloaded and reloaded.
* This avoids the problem of trying to allocate contiguous each
* time the bktr driver is loaded.
*/
/*-
* SPDX-License-Identifier: BSD-4-Clause
*
* 1. Redistributions of source code must retain the
* Copyright (c) 2000 Roger Hardiman
* 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 Roger Hardiman
* 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.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/systm.h>
#include <dev/bktr/bktr_mem.h>
struct memory_pointers {
int addresses_stored;
vm_offset_t dma_prog;
vm_offset_t odd_dma_prog;
vm_offset_t vbidata;
vm_offset_t vbibuffer;
vm_offset_t buf;
} memory_pointers;
static struct memory_pointers memory_list[BKTR_MEM_MAX_DEVICES];
/*************************************************************/
static int
bktr_mem_modevent(module_t mod, int type, void *unused){
switch (type) {
case MOD_LOAD:
printf("bktr_mem: memory holder loaded\n");
/*
* bzero((caddr_t)memory_list, sizeof(memory_list));
* causes a panic. So use a simple for loop for now.
*/
{
int x;
unsigned char *d;
d = (unsigned char *)memory_list;
for (x = 0; x < sizeof(memory_list); x++)
d[x] = 0;
}
return 0;
case MOD_UNLOAD:
printf("bktr_mem: memory holder cannot be unloaded\n");
return EBUSY;
default:
return EOPNOTSUPP;
break;
}
return (0);
}
/*************************************************************/
int
bktr_has_stored_addresses(int unit)
{
if (unit < 0 || unit >= BKTR_MEM_MAX_DEVICES) {
printf("bktr_mem: Unit number %d invalid\n", unit);
return 0;
}
return memory_list[unit].addresses_stored;
}
/*************************************************************/
void
bktr_store_address(int unit, int type, vm_offset_t addr)
{
if (unit < 0 || unit >= BKTR_MEM_MAX_DEVICES) {
printf("bktr_mem: Unit number %d invalid for memory type %d, address %p\n",
unit, type, (void *) addr);
return;
}
switch (type) {
case BKTR_MEM_DMA_PROG:
memory_list[unit].dma_prog = addr;
memory_list[unit].addresses_stored = 1;
break;
case BKTR_MEM_ODD_DMA_PROG:
memory_list[unit].odd_dma_prog = addr;
memory_list[unit].addresses_stored = 1;
break;
case BKTR_MEM_VBIDATA:
memory_list[unit].vbidata = addr;
memory_list[unit].addresses_stored = 1;
break;
case BKTR_MEM_VBIBUFFER:
memory_list[unit].vbibuffer = addr;
memory_list[unit].addresses_stored = 1;
break;
case BKTR_MEM_BUF:
memory_list[unit].buf = addr;
memory_list[unit].addresses_stored = 1;
break;
default:
printf("bktr_mem: Invalid memory type %d for bktr%d, address %p\n",
type, unit, (void *)addr);
break;
}
}
/*************************************************************/
vm_offset_t
bktr_retrieve_address(int unit, int type)
{
if (unit < 0 || unit >= BKTR_MEM_MAX_DEVICES) {
printf("bktr_mem: Unit number %d too large for memory type %d\n",
unit, type);
return (0);
}
switch (type) {
case BKTR_MEM_DMA_PROG:
return memory_list[unit].dma_prog;
case BKTR_MEM_ODD_DMA_PROG:
return memory_list[unit].odd_dma_prog;
case BKTR_MEM_VBIDATA:
return memory_list[unit].vbidata;
case BKTR_MEM_VBIBUFFER:
return memory_list[unit].vbibuffer;
case BKTR_MEM_BUF:
return memory_list[unit].buf;
default:
printf("bktr_mem: Invalid memory type %d for bktr%d",
type, unit);
return (0);
}
}
/*************************************************************/
static moduledata_t bktr_mem_mod = {
"bktr_mem",
bktr_mem_modevent,
0
};
/*
* The load order is First and module type is Driver to make sure bktr_mem
* loads (and initialises) before bktr when both are loaded together.
*/
DECLARE_MODULE(bktr_mem, bktr_mem_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
MODULE_VERSION(bktr_mem, 1);

View file

@ -1,65 +0,0 @@
/* $FreeBSD$ */
/*
* This is prt of the Driver for Video Capture Cards (Frame grabbers)
* and TV Tuner cards using the Brooktree Bt848, Bt848A, Bt849A, Bt878, Bt879
* chipset.
* Copyright Roger Hardiman.
*
* bktr_mem : This kernel module allows us to keep our allocated
* contiguous memory for the video buffer, DMA programs and VBI data
* while the main bktr driver is unloaded and reloaded.
* This avoids the problem of trying to allocate contiguous each
* time the bktr driver is loaded.
*/
/*-
* SPDX-License-Identifier: BSD-4-Clause
*
* 1. Redistributions of source code must retain the
* Copyright (c) 2000 Roger Hardiman
* 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 Roger Hardiman
* 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.
*/
/* Support this number of devices */
#define BKTR_MEM_MAX_DEVICES 8
/* Define a name for each block of memory we need to keep hold of */
#define BKTR_MEM_DMA_PROG 1
#define BKTR_MEM_ODD_DMA_PROG 2
#define BKTR_MEM_VBIDATA 3
#define BKTR_MEM_VBIBUFFER 4
#define BKTR_MEM_BUF 5
/* Prototypes */
int bktr_has_stored_addresses(int unit);
void bktr_store_address(int unit, int type, vm_offset_t addr);
vm_offset_t bktr_retrieve_address(int unit, int type);

File diff suppressed because it is too large Load diff

View file

@ -1,87 +0,0 @@
/* $FreeBSD$ */
/*
* This is part of the Driver for Video Capture Cards (Frame grabbers)
* and TV Tuner cards using the Brooktree Bt848, Bt848A, Bt849A, Bt878, Bt879
* chipset.
* Copyright Roger Hardiman and Amancio Hasty.
*
* bktr_os : This has all the Operating System dependent code.
*
*/
/*-
* SPDX-License-Identifier: BSD-4-Clause
*
* 1. Redistributions of source code must retain the
* Copyright (c) 1997 Amancio Hasty, 1999 Roger Hardiman
* 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 Amancio Hasty and
* Roger Hardiman
* 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.
*/
/******************************/
/* *** Memory Allocation *** */
/******************************/
#if (defined(__FreeBSD__) || defined(__bsdi__))
vm_offset_t get_bktr_mem( int unit, unsigned size );
#endif
#if (defined(__NetBSD__) || defined(__OpenBSD__))
vm_offset_t get_bktr_mem(bktr_ptr_t, bus_dmamap_t *, unsigned size);
void free_bktr_mem(bktr_ptr_t, bus_dmamap_t, vm_offset_t);
#endif
/************************************/
/* *** Interrupt Enable/Disable *** */
/************************************/
#if defined(__FreeBSD__)
#if (__FreeBSD_version >=500000)
#define USE_VBIMUTEX
#define DECLARE_INTR_MASK(s) /* no need to declare 's' */
#define DISABLE_INTR(s)
#define ENABLE_INTR(s)
#else
#define DECLARE_INTR_MASK(s) intrmask_t s
#define DISABLE_INTR(s) s=spltty()
#define ENABLE_INTR(s) splx(s)
#endif
#else
#define DECLARE_INTR_MASK(s) /* no need to declare 's' */
#define DISABLE_INTR(s) disable_intr()
#define ENABLE_INTR(s) enable_intr()
#endif
#ifdef USE_VBIMUTEX
#define LOCK_VBI(bktr) mtx_lock(&bktr->vbimutex)
#define UNLOCK_VBI(bktr) mtx_unlock(&bktr->vbimutex)
#else
#define LOCK_VBI(bktr)
#define UNLOCK_VBI(bktr)
#endif

View file

@ -1,730 +0,0 @@
/*-
* $FreeBSD$
*
* SPDX-License-Identifier: BSD-4-Clause
*
* 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.
*
*/
#ifdef __NetBSD__
#include <machine/bus.h> /* device_t */
#include <sys/device.h>
#include <sys/select.h> /* struct selinfo */
# ifdef DEBUG
# define bootverbose 1
# else
# define bootverbose 0
# endif
#endif
/*
* The kernel options for the driver now all begin with BKTR.
* Support the older kernel options on FreeBSD and OpenBSD.
*
*/
#if defined(__FreeBSD__) || defined(__OpenBSD__)
#if defined(BROOKTREE_ALLOC_PAGES)
#define BKTR_ALLOC_PAGES BROOKTREE_ALLOC_PAGES
#endif
#if defined(BROOKTREE_SYSTEM_DEFAULT)
#define BKTR_SYSTEM_DEFAULT BROOKTREE_SYSTEM_DEFAULT
#endif
#if defined(OVERRIDE_CARD)
#define BKTR_OVERRIDE_CARD OVERRIDE_CARD
#endif
#if defined(OVERRIDE_TUNER)
#define BKTR_OVERRIDE_TUNER OVERRIDE_TUNER
#endif
#if defined(OVERRIDE_DBX)
#define BKTR_OVERRIDE_DBX OVERRIDE_DBX
#endif
#if defined(OVERRIDE_MSP)
#define BKTR_OVERRIDE_MSP OVERRIDE_MSP
#endif
#endif
#ifndef PCI_LATENCY_TIMER
#define PCI_LATENCY_TIMER 0x0c /* pci timer register */
#endif
/*
* Definitions for the Brooktree 848/878 video capture to pci interface.
*/
#ifndef __NetBSD__
#define BKTR_PCI_VENDOR_SHIFT 0
#define BKTR_PCI_VENDOR_MASK 0xffff
#define BKTR_PCI_VENDOR(id) \
(((id) >> BKTR_PCI_VENDOR_SHIFT) & BKTR_PCI_VENDOR_MASK)
#define BKTR_PCI_PRODUCT_SHIFT 16
#define BKTR_PCI_PRODUCT_MASK 0xffff
#define BKTR_PCI_PRODUCT(id) \
(((id) >> BKTR_PCI_PRODUCT_SHIFT) & BKTR_PCI_PRODUCT_MASK)
/* PCI vendor ID */
#define PCI_VENDOR_BROOKTREE 0x109e /* Brooktree */
/* Brooktree products */
#define PCI_PRODUCT_BROOKTREE_BT848 0x0350 /* Bt848 Video Capture */
#define PCI_PRODUCT_BROOKTREE_BT849 0x0351 /* Bt849 Video Capture */
#define PCI_PRODUCT_BROOKTREE_BT878 0x036e /* Bt878 Video Capture */
#define PCI_PRODUCT_BROOKTREE_BT879 0x036f /* Bt879 Video Capture */
#endif
#define BROOKTREE_848 1
#define BROOKTREE_848A 2
#define BROOKTREE_849A 3
#define BROOKTREE_878 4
#define BROOKTREE_879 5
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
struct bt848_registers {
BTBYTE (dstatus); /* 0, 1,2,3 */
#define BT848_DSTATUS_PRES (1<<7)
#define BT848_DSTATUS_HLOC (1<<6)
#define BT848_DSTATUS_FIELD (1<<5)
#define BT848_DSTATUS_NUML (1<<4)
#define BT848_DSTATUS_CSEL (1<<3)
#define BT848_DSTATUS_PLOCK (1<<2)
#define BT848_DSTATUS_LOF (1<<1)
#define BT848_DSTATUS_COF (1<<0)
BTBYTE (iform); /* 4, 5,6,7 */
#define BT848_IFORM_MUXSEL (0x3<<5)
# define BT848_IFORM_M_MUX1 (0x03<<5)
# define BT848_IFORM_M_MUX0 (0x02<<5)
# define BT848_IFORM_M_MUX2 (0x01<<5)
# define BT848_IFORM_M_MUX3 (0x0)
# define BT848_IFORM_M_RSVD (0x00<<5)
#define BT848_IFORM_XTSEL (0x3<<3)
# define BT848_IFORM_X_AUTO (0x03<<3)
# define BT848_IFORM_X_XT1 (0x02<<3)
# define BT848_IFORM_X_XT0 (0x01<<3)
# define BT848_IFORM_X_RSVD (0x00<<3)
BTBYTE (tdec); /* 8, 9,a,b */
BTBYTE (e_crop); /* c, d,e,f */
BTBYTE (e_vdelay_lo); /* 10, 11,12,13 */
BTBYTE (e_vactive_lo); /* 14, 15,16,17 */
BTBYTE (e_delay_lo); /* 18, 19,1a,1b */
BTBYTE (e_hactive_lo); /* 1c, 1d,1e,1f */
BTBYTE (e_hscale_hi); /* 20, 21,22,23 */
BTBYTE (e_hscale_lo); /* 24, 25,26,27 */
BTBYTE (bright); /* 28, 29,2a,2b */
BTBYTE (e_control); /* 2c, 2d,2e,2f */
#define BT848_E_CONTROL_LNOTCH (1<<7)
#define BT848_E_CONTROL_COMP (1<<6)
#define BT848_E_CONTROL_LDEC (1<<5)
#define BT848_E_CONTROL_CBSENSE (1<<4)
#define BT848_E_CONTROL_RSVD (1<<3)
#define BT848_E_CONTROL_CON_MSB (1<<2)
#define BT848_E_CONTROL_SAT_U_MSB (1<<1)
#define BT848_E_CONTROL_SAT_V_MSB (1<<0)
BTBYTE (contrast_lo); /* 30, 31,32,33 */
BTBYTE (sat_u_lo); /* 34, 35,36,37 */
BTBYTE (sat_v_lo); /* 38, 39,3a,3b */
BTBYTE (hue); /* 3c, 3d,3e,3f */
BTBYTE (e_scloop); /* 40, 41,42,43 */
#define BT848_E_SCLOOP_RSVD1 (1<<7)
#define BT848_E_SCLOOP_CAGC (1<<6)
#define BT848_E_SCLOOP_CKILL (1<<5)
#define BT848_E_SCLOOP_HFILT (0x3<<3)
# define BT848_E_SCLOOP_HFILT_ICON (0x3<<3)
# define BT848_E_SCLOOP_HFILT_QCIF (0x2<<3)
# define BT848_E_SCLOOP_HFILT_CIF (0x1<<3)
# define BT848_E_SCLOOP_HFILT_AUTO (0x0<<3)
#define BT848_E_SCLOOP_RSVD0 (0x7<<0)
int :32; /* 44, 45,46,47 */
BTBYTE (oform); /* 48, 49,4a,4b */
BTBYTE (e_vscale_hi); /* 4c, 4d,4e,4f */
BTBYTE (e_vscale_lo); /* 50, 51,52,53 */
BTBYTE (test); /* 54, 55,56,57 */
int :32; /* 58, 59,5a,5b */
int :32; /* 5c, 5d,5e,5f */
BTLONG (adelay); /* 60, 61,62,63 */
BTBYTE (bdelay); /* 64, 65,66,67 */
BTBYTE (adc); /* 68, 69,6a,6b */
#define BT848_ADC_RESERVED (0x80) /* required pattern */
#define BT848_ADC_SYNC_T (1<<5)
#define BT848_ADC_AGC_EN (1<<4)
#define BT848_ADC_CLK_SLEEP (1<<3)
#define BT848_ADC_Y_SLEEP (1<<2)
#define BT848_ADC_C_SLEEP (1<<1)
#define BT848_ADC_CRUSH (1<<0)
BTBYTE (e_vtc); /* 6c, 6d,6e,6f */
int :32; /* 70, 71,72,73 */
int :32; /* 74, 75,76,77 */
int :32; /* 78, 79,7a,7b */
BTLONG (sreset); /* 7c, 7d,7e,7f */
u_char filler1[0x84-0x80];
BTBYTE (tgctrl); /* 84, 85,86,87 */
#define BT848_TGCTRL_TGCKI (3<<3)
#define BT848_TGCTRL_TGCKI_XTAL (0<<3)
#define BT848_TGCTRL_TGCKI_PLL (1<<3)
#define BT848_TGCTRL_TGCKI_GPCLK (2<<3)
#define BT848_TGCTRL_TGCKI_GPCLK_I (3<<3)
u_char filler[0x8c-0x88];
BTBYTE (o_crop); /* 8c, 8d,8e,8f */
BTBYTE (o_vdelay_lo); /* 90, 91,92,93 */
BTBYTE (o_vactive_lo); /* 94, 95,96,97 */
BTBYTE (o_delay_lo); /* 98, 99,9a,9b */
BTBYTE (o_hactive_lo); /* 9c, 9d,9e,9f */
BTBYTE (o_hscale_hi); /* a0, a1,a2,a3 */
BTBYTE (o_hscale_lo); /* a4, a5,a6,a7 */
int :32; /* a8, a9,aa,ab */
BTBYTE (o_control); /* ac, ad,ae,af */
#define BT848_O_CONTROL_LNOTCH (1<<7)
#define BT848_O_CONTROL_COMP (1<<6)
#define BT848_O_CONTROL_LDEC (1<<5)
#define BT848_O_CONTROL_CBSENSE (1<<4)
#define BT848_O_CONTROL_RSVD (1<<3)
#define BT848_O_CONTROL_CON_MSB (1<<2)
#define BT848_O_CONTROL_SAT_U_MSB (1<<1)
#define BT848_O_CONTROL_SAT_V_MSB (1<<0)
u_char fillter4[16];
BTBYTE (o_scloop); /* c0, c1,c2,c3 */
#define BT848_O_SCLOOP_RSVD1 (1<<7)
#define BT848_O_SCLOOP_CAGC (1<<6)
#define BT848_O_SCLOOP_CKILL (1<<5)
#define BT848_O_SCLOOP_HFILT (0x3<<3)
#define BT848_O_SCLOOP_HFILT_ICON (0x3<<3)
#define BT848_O_SCLOOP_HFILT_QCIF (0x2<<3)
#define BT848_O_SCLOOP_HFILT_CIF (0x1<<3)
#define BT848_O_SCLOOP_HFILT_AUTO (0x0<<3)
#define BT848_O_SCLOOP_RSVD0 (0x7<<0)
int :32; /* c4, c5,c6,c7 */
int :32; /* c8, c9,ca,cb */
BTBYTE (o_vscale_hi); /* cc, cd,ce,cf */
BTBYTE (o_vscale_lo); /* d0, d1,d2,d3 */
BTBYTE (color_fmt); /* d4, d5,d6,d7 */
bregister_t color_ctl_swap :4; /* d8 */
#define BT848_COLOR_CTL_WSWAP_ODD (1<<3)
#define BT848_COLOR_CTL_WSWAP_EVEN (1<<2)
#define BT848_COLOR_CTL_BSWAP_ODD (1<<1)
#define BT848_COLOR_CTL_BSWAP_EVEN (1<<0)
bregister_t color_ctl_gamma :1;
bregister_t color_ctl_rgb_ded :1;
bregister_t color_ctl_color_bars :1;
bregister_t color_ctl_ext_frmrate :1;
#define BT848_COLOR_CTL_GAMMA (1<<4)
#define BT848_COLOR_CTL_RGB_DED (1<<5)
#define BT848_COLOR_CTL_COLOR_BARS (1<<6)
#define BT848_COLOR_CTL_EXT_FRMRATE (1<<7)
int :24; /* d9,da,db */
BTBYTE (cap_ctl); /* dc, dd,de,df */
#define BT848_CAP_CTL_DITH_FRAME (1<<4)
#define BT848_CAP_CTL_VBI_ODD (1<<3)
#define BT848_CAP_CTL_VBI_EVEN (1<<2)
#define BT848_CAP_CTL_ODD (1<<1)
#define BT848_CAP_CTL_EVEN (1<<0)
BTBYTE (vbi_pack_size); /* e0, e1,e2,e3 */
BTBYTE (vbi_pack_del); /* e4, e5,e6,e7 */
int :32; /* e8, e9,ea,eb */
BTBYTE (o_vtc); /* ec, ed,ee,ef */
BTBYTE (pll_f_lo); /* f0, f1,f2,f3 */
BTBYTE (pll_f_hi); /* f4, f5,f6,f7 */
BTBYTE (pll_f_xci); /* f8, f9,fa,fb */
#define BT848_PLL_F_C (1<<6)
#define BT848_PLL_F_X (1<<7)
u_char filler2[0x100-0xfc];
BTLONG (int_stat); /* 100, 101,102,103 */
BTLONG (int_mask); /* 104, 105,106,107 */
#define BT848_INT_RISCS (0xf<<28)
#define BT848_INT_RISC_EN (1<<27)
#define BT848_INT_RACK (1<<25)
#define BT848_INT_FIELD (1<<24)
#define BT848_INT_MYSTERYBIT (1<<23)
#define BT848_INT_SCERR (1<<19)
#define BT848_INT_OCERR (1<<18)
#define BT848_INT_PABORT (1<<17)
#define BT848_INT_RIPERR (1<<16)
#define BT848_INT_PPERR (1<<15)
#define BT848_INT_FDSR (1<<14)
#define BT848_INT_FTRGT (1<<13)
#define BT848_INT_FBUS (1<<12)
#define BT848_INT_RISCI (1<<11)
#define BT848_INT_GPINT (1<<9)
#define BT848_INT_I2CDONE (1<<8)
#define BT848_INT_RSV1 (1<<7)
#define BT848_INT_RSV0 (1<<6)
#define BT848_INT_VPRES (1<<5)
#define BT848_INT_HLOCK (1<<4)
#define BT848_INT_OFLOW (1<<3)
#define BT848_INT_HSYNC (1<<2)
#define BT848_INT_VSYNC (1<<1)
#define BT848_INT_FMTCHG (1<<0)
int :32; /* 108, 109,10a,10b */
BTWORD (gpio_dma_ctl); /* 10c, 10d,10e,10f */
#define BT848_DMA_CTL_PL23TP4 (0<<6) /* planar1 trigger 4 */
#define BT848_DMA_CTL_PL23TP8 (1<<6) /* planar1 trigger 8 */
#define BT848_DMA_CTL_PL23TP16 (2<<6) /* planar1 trigger 16 */
#define BT848_DMA_CTL_PL23TP32 (3<<6) /* planar1 trigger 32 */
#define BT848_DMA_CTL_PL1TP4 (0<<4) /* planar1 trigger 4 */
#define BT848_DMA_CTL_PL1TP8 (1<<4) /* planar1 trigger 8 */
#define BT848_DMA_CTL_PL1TP16 (2<<4) /* planar1 trigger 16 */
#define BT848_DMA_CTL_PL1TP32 (3<<4) /* planar1 trigger 32 */
#define BT848_DMA_CTL_PKTP4 (0<<2) /* packed trigger 4 */
#define BT848_DMA_CTL_PKTP8 (1<<2) /* packed trigger 8 */
#define BT848_DMA_CTL_PKTP16 (2<<2) /* packed trigger 16 */
#define BT848_DMA_CTL_PKTP32 (3<<2) /* packed trigger 32 */
#define BT848_DMA_CTL_RISC_EN (1<<1)
#define BT848_DMA_CTL_FIFO_EN (1<<0)
BTLONG (i2c_data_ctl); /* 110, 111,112,113 */
#define BT848_DATA_CTL_I2CDIV (0xf<<4)
#define BT848_DATA_CTL_I2CSYNC (1<<3)
#define BT848_DATA_CTL_I2CW3B (1<<2)
#define BT848_DATA_CTL_I2CSCL (1<<1)
#define BT848_DATA_CTL_I2CSDA (1<<0)
BTLONG (risc_strt_add); /* 114, 115,116,117 */
BTLONG (gpio_out_en); /* 118, 119,11a,11b */ /* really 24 bits */
BTLONG (gpio_reg_inp); /* 11c, 11d,11e,11f */ /* really 24 bits */
BTLONG (risc_count); /* 120, 121,122,123 */
u_char filler3[0x200-0x124];
BTLONG (gpio_data); /* 200, 201,202,203 */ /* really 24 bits */
};
#define BKTR_DSTATUS 0x000
#define BKTR_IFORM 0x004
#define BKTR_TDEC 0x008
#define BKTR_E_CROP 0x00C
#define BKTR_O_CROP 0x08C
#define BKTR_E_VDELAY_LO 0x010
#define BKTR_O_VDELAY_LO 0x090
#define BKTR_E_VACTIVE_LO 0x014
#define BKTR_O_VACTIVE_LO 0x094
#define BKTR_E_DELAY_LO 0x018
#define BKTR_O_DELAY_LO 0x098
#define BKTR_E_HACTIVE_LO 0x01C
#define BKTR_O_HACTIVE_LO 0x09C
#define BKTR_E_HSCALE_HI 0x020
#define BKTR_O_HSCALE_HI 0x0A0
#define BKTR_E_HSCALE_LO 0x024
#define BKTR_O_HSCALE_LO 0x0A4
#define BKTR_BRIGHT 0x028
#define BKTR_E_CONTROL 0x02C
#define BKTR_O_CONTROL 0x0AC
#define BKTR_CONTRAST_LO 0x030
#define BKTR_SAT_U_LO 0x034
#define BKTR_SAT_V_LO 0x038
#define BKTR_HUE 0x03C
#define BKTR_E_SCLOOP 0x040
#define BKTR_O_SCLOOP 0x0C0
#define BKTR_OFORM 0x048
#define BKTR_E_VSCALE_HI 0x04C
#define BKTR_O_VSCALE_HI 0x0CC
#define BKTR_E_VSCALE_LO 0x050
#define BKTR_O_VSCALE_LO 0x0D0
#define BKTR_TEST 0x054
#define BKTR_ADELAY 0x060
#define BKTR_BDELAY 0x064
#define BKTR_ADC 0x068
#define BKTR_E_VTC 0x06C
#define BKTR_O_VTC 0x0EC
#define BKTR_SRESET 0x07C
#define BKTR_COLOR_FMT 0x0D4
#define BKTR_COLOR_CTL 0x0D8
#define BKTR_CAP_CTL 0x0DC
#define BKTR_VBI_PACK_SIZE 0x0E0
#define BKTR_VBI_PACK_DEL 0x0E4
#define BKTR_INT_STAT 0x100
#define BKTR_INT_MASK 0x104
#define BKTR_RISC_COUNT 0x120
#define BKTR_RISC_STRT_ADD 0x114
#define BKTR_GPIO_DMA_CTL 0x10C
#define BKTR_GPIO_OUT_EN 0x118
#define BKTR_GPIO_REG_INP 0x11C
#define BKTR_GPIO_DATA 0x200
#define BKTR_I2C_DATA_CTL 0x110
#define BKTR_TGCTRL 0x084
#define BKTR_PLL_F_LO 0x0F0
#define BKTR_PLL_F_HI 0x0F4
#define BKTR_PLL_F_XCI 0x0F8
/*
* device support for onboard tv tuners
*/
/* 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 {
char* name;
u_char type;
u_char pllControl[4];
u_char bandLimits[ 2 ];
u_char bandAddrs[ 4 ]; /* 3 first for the 3 TV
** bands. Last for radio
** band (0x00=NoRadio).
*/
};
/* description of the card */
#define EEPROMBLOCKSIZE 32
struct CARDTYPE {
unsigned int card_id; /* card id (from #define's) */
char* name;
const struct TUNER* tuner; /* Tuner details */
u_char tuner_pllAddr; /* Tuner i2c address */
u_char dbx; /* Has DBX chip? */
u_char msp3400c; /* Has msp3400c chip? */
u_char dpl3518a; /* Has dpl3518a chip? */
u_char eepromAddr;
u_char eepromSize; /* bytes / EEPROMBLOCKSIZE */
u_int audiomuxs[ 5 ]; /* tuner, ext (line-in) */
/* int/unused (radio) */
/* mute, present */
u_int gpio_mux_bits; /* GPIO mask for audio mux */
};
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;
};
#if defined(BKTR_USE_FREEBSD_SMBUS)
struct bktr_i2c_softc {
int bus_owned;
device_t iicbb;
device_t smbus;
};
#endif
/* Bt848/878 register access
* The registers can either be access via a memory mapped structure
* or accessed via bus_space.
* bus_0pace access allows cross platform support, where as the
* memory mapped structure method only works on 32 bit processors
* with the right type of endianness.
*/
#if defined(__NetBSD__) || defined(__FreeBSD__)
#define INB(bktr,offset) bus_space_read_1((bktr)->memt,(bktr)->memh,(offset))
#define INW(bktr,offset) bus_space_read_2((bktr)->memt,(bktr)->memh,(offset))
#define INL(bktr,offset) bus_space_read_4((bktr)->memt,(bktr)->memh,(offset))
#define OUTB(bktr,offset,value) bus_space_write_1((bktr)->memt,(bktr)->memh,(offset),(value))
#define OUTW(bktr,offset,value) bus_space_write_2((bktr)->memt,(bktr)->memh,(offset),(value))
#define OUTL(bktr,offset,value) bus_space_write_4((bktr)->memt,(bktr)->memh,(offset),(value))
#else
#define INB(bktr,offset) *(volatile unsigned char*) ((int)((bktr)->memh)+(offset))
#define INW(bktr,offset) *(volatile unsigned short*)((int)((bktr)->memh)+(offset))
#define INL(bktr,offset) *(volatile unsigned int*) ((int)((bktr)->memh)+(offset))
#define OUTB(bktr,offset,value) *(volatile unsigned char*) ((int)((bktr)->memh)+(offset)) = (value)
#define OUTW(bktr,offset,value) *(volatile unsigned short*)((int)((bktr)->memh)+(offset)) = (value)
#define OUTL(bktr,offset,value) *(volatile unsigned int*) ((int)((bktr)->memh)+(offset)) = (value)
#endif
typedef struct bktr_clip bktr_clip_t;
/*
* BrookTree 848 info structure, one per bt848 card installed.
*/
struct bktr_softc {
#if defined (__bsdi__)
struct device bktr_dev; /* base device */
struct isadev bktr_id; /* ISA device */
struct intrhand bktr_ih; /* interrupt vectoring */
#define pcici_t pci_devaddr_t
#endif
#if defined(__NetBSD__)
struct device 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;
#endif
#if defined(__OpenBSD__)
struct device 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;
size_t dm_mapsize;
pci_chipset_tag_t pc; /* Opaque PCI chipset tag */
pcitag_t tag; /* PCI tag, for doing PCI commands */
vm_offset_t phys_base; /* Bt848 register physical address */
#endif
#if defined (__FreeBSD__)
int mem_rid; /* 4.x resource id */
struct resource *res_mem; /* 4.x resource descriptor for registers */
int irq_rid; /* 4.x resource id */
struct resource *res_irq; /* 4.x resource descriptor for interrupt */
void *res_ih; /* 4.x newbus interrupt handler cookie */
struct cdev *bktrdev; /* 4.x device entry for /dev/bktrN */
struct cdev *tunerdev; /* 4.x device entry for /dev/tunerN */
struct cdev *vbidev; /* 4.x device entry for /dev/vbiN */
struct cdev *bktrdev_alias; /* alias /dev/bktr to /dev/bktr0 */
struct cdev *tunerdev_alias; /* alias /dev/tuner to /dev/tuner0 */
struct cdev *vbidev_alias; /* alias /dev/vbi to /dev/vbi0 */
#if (__FreeBSD_version >= 500000)
struct mtx vbimutex; /* Mutex protecting vbi buffer */
#endif
bus_space_tag_t memt; /* Bus space register access functions */
bus_space_handle_t memh; /* Bus space register access functions */
bus_size_t obmemsz;/* Size of card (bytes) */
#if defined(BKTR_USE_FREEBSD_SMBUS)
struct bktr_i2c_softc i2c_sc; /* bt848_i2c device */
#endif
char bktr_xname[7]; /* device name and unit number */
#endif
/* The following definitions are for the contiguous memory */
#ifdef __NetBSD__
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 */
#else
vm_offset_t bigbuf; /* buffer that holds the captured image */
vm_offset_t vbidata; /* RISC program puts VBI data from the current frame here */
vm_offset_t vbibuffer; /* Circular buffer holding VBI data for the user */
vm_offset_t dma_prog; /* RISC prog for single and/or even field capture*/
vm_offset_t odd_dma_prog;/* RISC program for Odd field capture */
#endif
/* 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 */
uint32_t 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_long 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_long format; /* frame format rgb, yuv, etc.. */
short frames; /* number of frames allocated */
int frame_size; /* number of bytes in a frame */
u_long fifo_errors; /* number of fifo capture errors since open */
u_long dma_errors; /* number of DMA capture errors since open */
u_long frames_captured;/* number of frames captured since open */
u_long even_fields_captured; /* number of even fields captured */
u_long odd_fields_captured; /* number of odd fields captured */
u_long range_enable; /* enable range checking ?? */
u_short capcontrol; /* reg 0xdc capture control */
u_short bktr_cap_ctl;
volatile u_int flags;
#define METEOR_INITALIZED 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 */
#define METEOR_FIELD_MODE 0x80000000
u_char tflags; /* Tuner flags (/dev/tuner) */
#define TUNER_INITALIZED 0x00000001
#define TUNER_OPEN 0x00000002
u_char vbiflags; /* VBI flags (/dev/vbi) */
#define VBI_INITALIZED 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_long current_sol;
u_long 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_long 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 */
#ifdef BKTR_NEW_MSP34XX_DRIVER
/* msp3400c related data */
void * msp3400c_info;
int stereo_once;
int amsound;
int mspsimple;
int dolby;
#endif
};
typedef struct bktr_softc bktr_reg_t;
typedef struct bktr_softc* bktr_ptr_t;
#define Bt848_MAX_SIGN 16
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 */
/***********************************************************/
#if defined(__FreeBSD__)
typedef u_long ioctl_cmd_t;
#endif
#if defined(__NetBSD__) || defined(__OpenBSD__)
typedef u_long ioctl_cmd_t;
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,107 +0,0 @@
/* $FreeBSD$ */
/*
* This is part of the Driver for Video Capture Cards (Frame grabbers)
* and TV Tuner cards using the Brooktree Bt848, Bt848A, Bt849A, Bt878, Bt879
* chipset.
* Copyright Roger Hardiman and Amancio Hasty.
*
* bktr_tuner : This deals with controlling the tuner fitted to TV cards.
*
*/
/*-
* SPDX-License-Identifier: BSD-4-Clause
*
* 1. Redistributions of source code must retain the
* Copyright (c) 1997 Amancio Hasty, 1999 Roger Hardiman
* 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 Amancio Hasty and
* Roger Hardiman
* 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.
*/
/* Definitions for Tuners */
#define NO_TUNER 0
#define TEMIC_NTSC 1
#define TEMIC_PAL 2
#define TEMIC_SECAM 3
#define PHILIPS_NTSC 4
#define PHILIPS_PAL 5
#define PHILIPS_SECAM 6
#define TEMIC_PALI 7
#define PHILIPS_PALI 8
#define PHILIPS_FR1236_NTSC 9 /* These have FM radio support */
#define PHILIPS_FR1216_PAL 10 /* These have FM radio support */
#define PHILIPS_FR1236_SECAM 11 /* These have FM radio support */
#define ALPS_TSCH5 12
#define ALPS_TSBH1 13
#define TUNER_MT2032 14
#define LG_TPI8PSB12P_PAL 15
#define PHILIPS_FI1216 16
#define Bt848_MAX_TUNER 17
/* experimental code for Automatic Frequency Control */
#define TUNER_AFC
/*
* Fill in the tuner entries in the bktr_softc based on the selected tuner
* type (from the list of tuners above)
*/
void select_tuner( bktr_ptr_t bktr, int tuner_type );
/*
* The Channel Set maps TV channels eg Ch 36, Ch 51, onto frequencies
* and is country specific.
*/
int tuner_getchnlset( struct bktr_chnlset *chnlset );
/*
* tv_channel sets the tuner to channel 'n' using the current Channel Set
* tv_freq sets the tuner to a specific frequency for TV or for FM Radio
* get_tuner_status can be used to get the signal strength.
*/
#define TV_FREQUENCY 0
#define FM_RADIO_FREQUENCY 1
int tv_channel( bktr_ptr_t bktr, int channel );
int tv_freq( bktr_ptr_t bktr, int frequency, int type );
int get_tuner_status( bktr_ptr_t bktr );
#if defined( TUNER_AFC )
int do_afc( bktr_ptr_t bktr, int addr, int frequency );
#endif /* TUNER_AFC */
int mt2032_init(bktr_ptr_t bktr);
/*
* This is for start-up convenience only, NOT mandatory.
*/
#if !defined( DEFAULT_CHNLSET )
#define DEFAULT_CHNLSET CHNLSET_WEUROPE
#endif

View file

@ -1,298 +0,0 @@
/*
* extensions to ioctl_meteor.h for the bt848 cards
*
* $FreeBSD$
*/
#ifndef _DEV_BKTR_IOCTL_BT848_H_
#define _DEV_BKTR_IOCTL_BT848_H_
/*
* frequency sets
*/
#define CHNLSET_NABCST 1
#define CHNLSET_CABLEIRC 2
#define CHNLSET_CABLEHRC 3
#define CHNLSET_WEUROPE 4
#define CHNLSET_JPNBCST 5
#define CHNLSET_JPNCABLE 6
#define CHNLSET_XUSSR 7
#define CHNLSET_AUSTRALIA 8
#define CHNLSET_FRANCE 9
#define CHNLSET_MIN CHNLSET_NABCST
#define CHNLSET_MAX CHNLSET_FRANCE
/*
* constants for various tuner registers
*/
#define BT848_HUEMIN (-90)
#define BT848_HUEMAX 90
#define BT848_HUECENTER 0
#define BT848_HUERANGE 179.3
#define BT848_HUEREGMIN (-128)
#define BT848_HUEREGMAX 127
#define BT848_HUESTEPS 256
#define BT848_BRIGHTMIN (-50)
#define BT848_BRIGHTMAX 50
#define BT848_BRIGHTCENTER 0
#define BT848_BRIGHTRANGE 99.6
#define BT848_BRIGHTREGMIN (-128)
#define BT848_BRIGHTREGMAX 127
#define BT848_BRIGHTSTEPS 256
#define BT848_CONTRASTMIN 0
#define BT848_CONTRASTMAX 237
#define BT848_CONTRASTCENTER 100
#define BT848_CONTRASTRANGE 236.57
#define BT848_CONTRASTREGMIN 0
#define BT848_CONTRASTREGMAX 511
#define BT848_CONTRASTSTEPS 512
#define BT848_CHROMAMIN 0
#define BT848_CHROMAMAX 284
#define BT848_CHROMACENTER 100
#define BT848_CHROMARANGE 283.89
#define BT848_CHROMAREGMIN 0
#define BT848_CHROMAREGMAX 511
#define BT848_CHROMASTEPS 512
#define BT848_SATUMIN 0
#define BT848_SATUMAX 202
#define BT848_SATUCENTER 100
#define BT848_SATURANGE 201.18
#define BT848_SATUREGMIN 0
#define BT848_SATUREGMAX 511
#define BT848_SATUSTEPS 512
#define BT848_SATVMIN 0
#define BT848_SATVMAX 284
#define BT848_SATVCENTER 100
#define BT848_SATVRANGE 283.89
#define BT848_SATVREGMIN 0
#define BT848_SATVREGMAX 511
#define BT848_SATVSTEPS 512
/*
* audio stuff
*/
#define AUDIO_TUNER 0x00 /* command for the audio routine */
#define AUDIO_EXTERN 0x01 /* don't confuse them with bit */
#define AUDIO_INTERN 0x02 /* settings */
#define AUDIO_MUTE 0x80
#define AUDIO_UNMUTE 0x81
/*
* EEProm stuff
*/
struct eeProm {
short offset;
short count;
unsigned char bytes[ 256 ];
};
/*
* XXX: this is a hack, should be in ioctl_meteor.h
* here to avoid touching that file for now...
*/
#define TVTUNER_SETCHNL _IOW('x', 32, unsigned int) /* set channel */
#define TVTUNER_GETCHNL _IOR('x', 32, unsigned int) /* get channel */
#define TVTUNER_SETTYPE _IOW('x', 33, unsigned int) /* set tuner type */
#define TVTUNER_GETTYPE _IOR('x', 33, unsigned int) /* get tuner type */
#define TVTUNER_GETSTATUS _IOR('x', 34, unsigned int) /* get tuner status */
#define TVTUNER_SETFREQ _IOW('x', 35, unsigned int) /* set frequency */
#define TVTUNER_GETFREQ _IOR('x', 36, unsigned int) /* get frequency */
#define BT848_SHUE _IOW('x', 37, int) /* set hue */
#define BT848_GHUE _IOR('x', 37, int) /* get hue */
#define BT848_SBRIG _IOW('x', 38, int) /* set brightness */
#define BT848_GBRIG _IOR('x', 38, int) /* get brightness */
#define BT848_SCSAT _IOW('x', 39, int) /* set chroma sat */
#define BT848_GCSAT _IOR('x', 39, int) /* get UV saturation */
#define BT848_SCONT _IOW('x', 40, int) /* set contrast */
#define BT848_GCONT _IOR('x', 40, int) /* get contrast */
#define BT848_SVSAT _IOW('x', 41, int) /* set chroma V sat */
#define BT848_GVSAT _IOR('x', 41, int) /* get V saturation */
#define BT848_SUSAT _IOW('x', 42, int) /* set chroma U sat */
#define BT848_GUSAT _IOR('x', 42, int) /* get U saturation */
#define BT848_SCBARS _IOR('x', 43, int) /* set colorbar */
#define BT848_CCBARS _IOR('x', 44, int) /* clear colorbar */
#define BT848_SAUDIO _IOW('x', 46, int) /* set audio channel */
#define BT848_GAUDIO _IOR('x', 47, int) /* get audio channel */
#define BT848_SBTSC _IOW('x', 48, int) /* set audio channel */
#define BT848_GSTATUS _IOR('x', 49, unsigned int) /* reap status */
#define BT848_WEEPROM _IOWR('x', 50, struct eeProm) /* write to EEProm */
#define BT848_REEPROM _IOWR('x', 51, struct eeProm) /* read from EEProm */
#define BT848_SIGNATURE _IOWR('x', 52, struct eeProm) /* read card sig */
#define TVTUNER_SETAFC _IOW('x', 53, int) /* turn AFC on/off */
#define TVTUNER_GETAFC _IOR('x', 54, int) /* query AFC on/off */
#define BT848_SLNOTCH _IOW('x', 55, int) /* set luma notch */
#define BT848_GLNOTCH _IOR('x', 56, int) /* get luma notch */
/* Read/Write the BT848's I2C bus directly
* b7-b0: data (read/write)
* b15-b8: internal peripheral register (write)
* b23-b16: i2c addr (write)
* b31-b24: 1 = write, 0 = read
*/
#define BT848_I2CWR _IOWR('x', 57, unsigned long) /* i2c read-write */
struct bktr_msp_control {
unsigned char function;
unsigned int address;
unsigned int data;
};
#define BT848_MSP_RESET _IO('x', 76) /* MSP chip reset */
#define BT848_MSP_READ _IOWR('x', 77, struct bktr_msp_control) /* MSP chip read */
#define BT848_MSP_WRITE _IOWR('x', 78, struct bktr_msp_control) /* MSP chip write */
/* Support for radio tuner */
#define RADIO_SETMODE _IOW('x', 58, unsigned int) /* set radio modes */
#define RADIO_GETMODE _IOR('x', 58, unsigned char) /* get radio modes */
#define RADIO_AFC 0x01 /* These modes will probably not */
#define RADIO_MONO 0x02 /* work on the FRxxxx. It does */
#define RADIO_MUTE 0x08 /* work on the FMxxxx. */
#define RADIO_SETFREQ _IOW('x', 59, unsigned int) /* set frequency */
#define RADIO_GETFREQ _IOR('x', 59, unsigned int) /* set frequency */
/* Argument is frequency*100MHz */
/*
* XXX: more bad magic,
* we need to fix the METEORGINPUT to return something public
* duplicate them here for now...
*/
#define METEOR_DEV0 0x00001000
#define METEOR_DEV1 0x00002000
#define METEOR_DEV2 0x00004000
#define METEOR_DEV3 0x00008000
#define METEOR_DEV_SVIDEO 0x00006000
/*
* right now I don't know were to put these, but as they are suppose to be
* a part of a common video capture interface, these should be relocated to
* another place. Probably most of the METEOR_xxx defines need to be
* renamed and moved to a common header
*/
typedef enum { METEOR_PIXTYPE_RGB, METEOR_PIXTYPE_YUV,
METEOR_PIXTYPE_YUV_PACKED,
METEOR_PIXTYPE_YUV_12 } METEOR_PIXTYPE;
struct meteor_pixfmt {
unsigned int index; /* Index in supported pixfmt list */
METEOR_PIXTYPE type; /* What's the board gonna feed us */
unsigned int Bpp; /* Bytes per pixel */
unsigned long masks[3]; /* R,G,B or Y,U,V masks, respectively */
unsigned swap_bytes :1; /* Bytes swapped within shorts */
unsigned swap_shorts:1; /* Shorts swapped within longs */
};
struct bktr_clip {
int x_min;
int x_max;
int y_min;
int y_max;
};
#define BT848_MAX_CLIP_NODE 100
struct _bktr_clip {
struct bktr_clip x[BT848_MAX_CLIP_NODE];
};
/*
* I'm using METEOR_xxx just because that will be common to other interface
* and less of a surprise
*/
#define METEORSACTPIXFMT _IOW('x', 64, int )
#define METEORGACTPIXFMT _IOR('x', 64, int )
#define METEORGSUPPIXFMT _IOWR('x', 65, struct meteor_pixfmt)
/* set clip list */
#define BT848SCLIP _IOW('x', 66, struct _bktr_clip )
#define BT848GCLIP _IOR('x', 66, struct _bktr_clip )
/* set input format */
#define BT848SFMT _IOW('x', 67, unsigned long )
#define BT848GFMT _IOR('x', 67, unsigned long )
/* set clear-buffer-on-start */
#define BT848SCBUF _IOW('x', 68, int)
#define BT848GCBUF _IOR('x', 68, int)
/* set capture area */
/* The capture area is the area of the video image which is grabbed */
/* Usually the capture area is 640x480 (768x576 PAL) pixels */
/* This area is then scaled to the dimensions the user requires */
/* using the METEORGEO ioctl */
/* However, the capture area could be 400x300 pixels from the top right */
/* corner of the video image */
struct bktr_capture_area {
int x_offset;
int y_offset;
int x_size;
int y_size;
};
#define BT848_SCAPAREA _IOW('x', 69, struct bktr_capture_area)
#define BT848_GCAPAREA _IOR('x', 69, struct bktr_capture_area)
/* Get channel Set */
#define BT848_MAX_CHNLSET_NAME_LEN 16
struct bktr_chnlset {
short index;
short max_channel;
char name[BT848_MAX_CHNLSET_NAME_LEN];
};
#define TVTUNER_GETCHNLSET _IOWR('x', 70, struct bktr_chnlset)
/* Infra Red Remote Control */
struct bktr_remote {
unsigned char data[3];
};
#define REMOTE_GETKEY _IOR('x', 71, struct bktr_remote)/*read the remote */
/*control receiver*/
/*returns raw data*/
/*
* Direct access to GPIO pins. You must add BKTR_GPIO_ACCESS to your kernel
* configuration file to use these
*/
#define BT848_GPIO_SET_EN _IOW('x', 72, int) /* set gpio_out_en */
#define BT848_GPIO_GET_EN _IOR('x', 73, int) /* get gpio_out_en */
#define BT848_GPIO_SET_DATA _IOW('x', 74, int) /* set gpio_data */
#define BT848_GPIO_GET_DATA _IOR('x', 75, int) /* get gpio_data */
/* XXX - Copied from /sys/pci/brktree_reg.h */
#define BT848_IFORM_FORMAT (0x7<<0)
# define BT848_IFORM_F_RSVD (0x7)
# define BT848_IFORM_F_SECAM (0x6)
# define BT848_IFORM_F_PALN (0x5)
# define BT848_IFORM_F_PALM (0x4)
# define BT848_IFORM_F_PALBDGHI (0x3)
# define BT848_IFORM_F_NTSCJ (0x2)
# define BT848_IFORM_F_NTSCM (0x1)
# define BT848_IFORM_F_AUTO (0x0)
#endif /* _DEV_BKTR_IOCTL_BT848_H_ */

View file

@ -1,189 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-4-Clause
*
* 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.
*
* $FreeBSD$
*/
/*
* ioctl constants for Matrox Meteor Capture card.
*/
#ifndef _DEV_BKTR_IOCTL_METEOR_H_
#define _DEV_BKTR_IOCTL_METEOR_H_
#ifndef _KERNEL
#include <sys/types.h>
#endif
#include <sys/ioccom.h>
struct meteor_capframe {
short command; /* see below for valid METEORCAPFRM commands */
short lowat; /* start transfer if < this number */
short hiwat; /* stop transfer if > this number */
} ;
/* structure for METEOR[GS]ETGEO - get/set geometry */
struct meteor_geomet {
unsigned short rows;
unsigned short columns;
unsigned short frames;
unsigned long oformat;
} ;
/* structure for METEORGCOUNT-get count of frames, fifo errors and dma errors */
struct meteor_counts {
unsigned long fifo_errors; /* count of fifo errors since open */
unsigned long dma_errors; /* count of dma errors since open */
unsigned long frames_captured; /* count of frames captured since open */
unsigned long even_fields_captured; /* count of even fields captured */
unsigned long odd_fields_captured; /* count of odd fields captured */
} ;
/* structure for getting and setting direct transfers to vram */
struct meteor_video {
unsigned long addr; /* Address of location to dma to */
unsigned long width; /* Width of memory area */
unsigned long banksize; /* Size of Vram bank */
unsigned long ramsize; /* Size of Vram */
};
#define METEORCAPTUR _IOW('x', 1, int) /* capture a frame */
#define METEORCAPFRM _IOW('x', 2, struct meteor_capframe) /* sync capture */
#define METEORSETGEO _IOW('x', 3, struct meteor_geomet) /* set geometry */
#define METEORGETGEO _IOR('x', 4, struct meteor_geomet) /* get geometry */
#define METEORSTATUS _IOR('x', 5, unsigned short) /* get status */
#define METEORSHUE _IOW('x', 6, signed char) /* set hue */
#define METEORGHUE _IOR('x', 6, signed char) /* get hue */
#define METEORSFMT _IOW('x', 7, unsigned long) /* set format */
#define METEORGFMT _IOR('x', 7, unsigned long) /* get format */
#define METEORSINPUT _IOW('x', 8, unsigned long) /* set input dev */
#define METEORGINPUT _IOR('x', 8, unsigned long) /* get input dev */
#define METEORSCHCV _IOW('x', 9, unsigned char) /* set uv gain */
#define METEORGCHCV _IOR('x', 9, unsigned char) /* get uv gain */
#define METEORSCOUNT _IOW('x',10, struct meteor_counts)
#define METEORGCOUNT _IOR('x',10, struct meteor_counts)
#define METEORSFPS _IOW('x',11, unsigned short) /* set fps */
#define METEORGFPS _IOR('x',11, unsigned short) /* get fps */
#define METEORSSIGNAL _IOW('x', 12, unsigned int) /* set signal */
#define METEORGSIGNAL _IOR('x', 12, unsigned int) /* get signal */
#define METEORSVIDEO _IOW('x', 13, struct meteor_video) /* set video */
#define METEORGVIDEO _IOR('x', 13, struct meteor_video) /* get video */
#define METEORSBRIG _IOW('x', 14, unsigned char) /* set brightness */
#define METEORGBRIG _IOR('x', 14, unsigned char) /* get brightness */
#define METEORSCSAT _IOW('x', 15, unsigned char) /* set chroma sat */
#define METEORGCSAT _IOR('x', 15, unsigned char) /* get uv saturation */
#define METEORSCONT _IOW('x', 16, unsigned char) /* set contrast */
#define METEORGCONT _IOR('x', 16, unsigned char) /* get contrast */
#define METEORSBT254 _IOW('x', 17, unsigned short) /* set Bt254 reg */
#define METEORGBT254 _IOR('x', 17, unsigned short) /* get Bt254 reg */
#define METEORSHWS _IOW('x', 18, unsigned char) /* set hor start reg */
#define METEORGHWS _IOR('x', 18, unsigned char) /* get hor start reg */
#define METEORSVWS _IOW('x', 19, unsigned char) /* set vert start reg */
#define METEORGVWS _IOR('x', 19, unsigned char) /* get vert start reg */
#define METEORSTS _IOW('x', 20, unsigned char) /* set time stamp */
#define METEORGTS _IOR('x', 20, unsigned char) /* get time stamp */
#define METEOR_STATUS_ID_MASK 0xf000 /* ID of 7196 */
#define METEOR_STATUS_DIR 0x0800 /* Direction of Expansion port YUV */
#define METEOR_STATUS_OEF 0x0200 /* Field detected: Even/Odd */
#define METEOR_STATUS_SVP 0x0100 /* State of VRAM Port:inactive/active */
#define METEOR_STATUS_STTC 0x0080 /* Time Constant: TV/VCR */
#define METEOR_STATUS_HCLK 0x0040 /* Horiz PLL: locked/unlocked */
#define METEOR_STATUS_FIDT 0x0020 /* Field detect: 50/60hz */
#define METEOR_STATUS_ALTD 0x0002 /* Line alt: no line alt/line alt */
#define METEOR_STATUS_CODE 0x0001 /* Colour info: no colour/colour */
/* METEORCAPTUR capture options */
#define METEOR_CAP_SINGLE 0x0001 /* capture one frame */
#define METEOR_CAP_CONTINOUS 0x0002 /* continuously capture */
#define METEOR_CAP_STOP_CONT 0x0004 /* stop the continuous capture */
/* METEORCAPFRM capture commands */
#define METEOR_CAP_N_FRAMES 0x0001 /* capture N frames */
#define METEOR_CAP_STOP_FRAMES 0x0002 /* stop capture N frames */
#define METEOR_HALT_N_FRAMES 0x0003 /* halt of capture N frames */
#define METEOR_CONT_N_FRAMES 0x0004 /* continue after above halt */
/* valid video input formats: */
#define METEOR_FMT_NTSC 0x00100 /* NTSC -- initialized default */
#define METEOR_FMT_PAL 0x00200 /* PAL */
#define METEOR_FMT_SECAM 0x00400 /* SECAM */
#define METEOR_FMT_AUTOMODE 0x00800 /* auto-mode */
#define METEOR_INPUT_DEV0 0x01000 /* camera input 0 -- default */
#define METEOR_INPUT_DEV_RCA METEOR_INPUT_DEV0
#define METEOR_INPUT_DEV1 0x02000 /* camera input 1 */
#define METEOR_INPUT_DEV2 0x04000 /* camera input 2 */
#define METEOR_INPUT_DEV3 0x08000 /* camera input 3 */
#define METEOR_INPUT_DEV_RGB 0x0a000 /* for rgb version of meteor */
#define METEOR_INPUT_DEV_SVIDEO 0x06000 /* S-video input port */
/* valid video output formats: */
#define METEOR_GEO_RGB16 0x0010000 /* packed -- initialized default */
#define METEOR_GEO_RGB24 0x0020000 /* RBG 24 bits packed */
/* internally stored in 32 bits */
#define METEOR_GEO_YUV_PACKED 0x0040000 /* 4-2-2 YUV 16 bits packed */
#define METEOR_GEO_YUV_PLANAR 0x0080000 /* 4-2-2 YUV 16 bits planer */
#define METEOR_GEO_YUV_PLANER METEOR_GEO_YUV_PLANAR
#define METEOR_GEO_UNSIGNED 0x0400000 /* unsigned uv outputs */
#define METEOR_GEO_EVEN_ONLY 0x1000000 /* set for even only field capture */
#define METEOR_GEO_ODD_ONLY 0x2000000 /* set for odd only field capture */
#define METEOR_GEO_FIELD_MASK 0x3000000
#define METEOR_GEO_YUV_422 0x4000000 /* 4-2-2 YUV in Y-U-V combined */
#define METEOR_GEO_OUTPUT_MASK 0x40f0000
#define METEOR_GEO_YUV_12 0x10000000 /* YUV 12 format */
#define METEOR_GEO_YUV_9 0x40000000 /* YUV 9 format */
#define METEOR_FIELD_MODE 0x80000000 /* Field cap or Frame cap */
#define METEOR_SIG_MODE_MASK 0xffff0000
#define METEOR_SIG_FRAME 0x00000000 /* signal every frame */
#define METEOR_SIG_FIELD 0x00010000 /* signal every field */
/* following structure is used to coordinate the synchronous */
struct meteor_mem {
/* kernel write only */
int frame_size; /* row*columns*depth */
unsigned num_bufs; /* number of frames in buffer (1-32) */
/* user and kernel change these */
int lowat; /* kernel starts capture if < this number */
int hiwat; /* kernel stops capture if > this number.
hiwat <= numbufs */
unsigned active; /* bit mask of active frame buffers
kernel sets, user clears */
int num_active_bufs; /* count of active frame buffer
kernel increments, user decrements */
/* reference to mmapped data */
caddr_t buf; /* The real space (virtual addr) */
} ;
#endif /* !_DEV_BKTR_IOCTL_METEOR_H_ */

File diff suppressed because it is too large Load diff

View file

@ -67,7 +67,6 @@ SUBDIR= \
bhnd \
${_bxe} \
${_bios} \
${_bktr} \
${_blake2} \
bnxt \
bridgestp \
@ -583,7 +582,6 @@ _agp= agp
_an= an
_aout= aout
_bios= bios
_bktr= bktr
.if ${MK_SOURCELESS_UCODE} != "no"
_bxe= bxe
.endif

View file

@ -1,7 +0,0 @@
# $FreeBSD$
SUBDIR =
SUBDIR += bktr
SUBDIR += bktr_mem
.include <bsd.subdir.mk>

View file

@ -1,3 +0,0 @@
# $FreeBSD$
.include "../Makefile.inc"

View file

@ -1,19 +0,0 @@
# $FreeBSD$
# Makefile for the bktr Brooktree Bt848/Bt878 PCI video capture device
.PATH: ${SRCTOP}/sys/dev/bktr
KMOD= bktr
SRCS= bktr_core.c bktr_os.c bktr_audio.c bktr_tuner.c bktr_card.c msp34xx.c \
opt_bktr.h bus_if.h device_if.h \
pci_if.h
CFLAGS+= -DBKTR_FREEBSD_MODULE
.if defined(BKTR_USE_FREEBSD_SMBUS)
SRCS+= bktr_i2c.c iicbb_if.h iicbus_if.h smbus_if.h
CFLAGS+= -DBKTR_USE_FREEBSD_SMBUS
.endif
.include <bsd.kmod.mk>

View file

@ -1,11 +0,0 @@
# $FreeBSD$
.PATH: ${SRCTOP}/sys/dev/bktr
KMOD= bktr_mem
SRCS= bktr_mem.c
EXPORT_SYMS= bktr_has_stored_addresses \
bktr_store_address \
bktr_retrieve_address
.include <bsd.kmod.mk>

View file

@ -60,7 +60,7 @@
* in the range 5 to 9.
*/
#undef __FreeBSD_version
#define __FreeBSD_version 1300081 /* Master, propagated to newvers */
#define __FreeBSD_version 1300082 /* Master, propagated to newvers */
/*
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,