From 97edcb45ca4a7f0b1763090903eeb36d69d71a24 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Thu, 24 Feb 2011 19:19:34 +0100 Subject: [PATCH] Remove the meteor(4) driver. It stopped building when -msoft-float was added to the options for building the kernel. FreeBSD removed it over 7 years ago, and so far I've heard of no one using DragonFly because he had one of those old cards and we still had a driver, so I guess it's safe to follow suit. However, the header is used by other, working drivers (bktr(4) and cxm(4)) so we keep it. We also keep the /usr/share/examples/meteor directory because the bktr(4) driver is based on meteor(4) and bktr(4)'s manual page references these examples as being mostly valid for bktr(4), too. --- Makefile_upgrade.inc | 2 + share/man/man4/bktr.4 | 9 +- share/man/man4/cxm.4 | 7 +- share/man/man4/man4.i386/Makefile | 3 +- share/man/man4/man4.i386/meteor.4 | 926 -------- sys/conf/files | 1 - sys/conf/options | 7 - sys/config/LINT | 16 - sys/dev/video/meteor/meteor.c | 2115 ----------------- sys/dev/video/meteor/meteor_reg.h | 247 -- .../cxm/setchannel/cxm_setchannel.1 | 3 +- 11 files changed, 10 insertions(+), 3326 deletions(-) delete mode 100644 share/man/man4/man4.i386/meteor.4 delete mode 100644 sys/dev/video/meteor/meteor.c delete mode 100644 sys/dev/video/meteor/meteor_reg.h diff --git a/Makefile_upgrade.inc b/Makefile_upgrade.inc index 5844137ab5..7ec7a2074c 100644 --- a/Makefile_upgrade.inc +++ b/Makefile_upgrade.inc @@ -1565,6 +1565,8 @@ TO_REMOVE+=/usr/share/man/cat/cat9/kref_inc.9.gz TO_REMOVE+=/usr/share/man/cat/man9/kref_inc.9.gz TO_REMOVE+=/usr/share/man/cat/cat9/kref_init.9.gz TO_REMOVE+=/usr/share/man/cat/man9/kref_init.9.gz +TO_REMOVE+=/usr/share/man/cat4/i386/meteor.4.gz +TO_REMOVE+=/usr/share/man/man4/i386/meteor.4.gz # XXX Remove when pfsync(4) has been fixed TO_REMOVE+=/usr/share/man/cat4/pfsync.4.gz diff --git a/share/man/man4/bktr.4 b/share/man/man4/bktr.4 index d13562cbcb..2004632b45 100644 --- a/share/man/man4/bktr.4 +++ b/share/man/man4/bktr.4 @@ -1,8 +1,7 @@ .\" .\" $FreeBSD: src/share/man/man4/bktr.4,v 1.31 2006/01/21 14:58:25 netchild Exp $ -.\" $DragonFly: src/share/man/man4/bktr.4,v 1.8 2007/10/03 19:27:08 swildner Exp $ .\" -.Dd October 3, 2007 +.Dd February 24, 2011 .Dt BKTR 4 .Os .Sh NAME @@ -23,6 +22,7 @@ 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 Meteor driver has since been removed. The .Nm driver should support most video cards based on the @@ -223,7 +223,7 @@ VideoLogic Captivator PCI .Sh FILES .Bl -tag -width /usr/share/examples/meteor -compact .It Pa /usr/share/examples/meteor -Examples of what you can do with the (similarly designed) Meteor driver. +Examples of what you could do with the (similarly designed) Meteor driver. .It Pa /usr/pkgsrc/multimedia/fxtv A TV and Camera display program utilizing the .Nm @@ -251,8 +251,7 @@ or the port. .El .Sh SEE ALSO -.Xr cxm 4 , -.Xr meteor 4 +.Xr cxm 4 .Sh HISTORY The .Nm diff --git a/share/man/man4/cxm.4 b/share/man/man4/cxm.4 index b3820efc2e..135179b19c 100644 --- a/share/man/man4/cxm.4 +++ b/share/man/man4/cxm.4 @@ -31,7 +31,7 @@ .\" .\" $Id: cxm.4,v 1.1 2004/10/16 00:12:35 mavetju Exp $ .\" -.Dd May 14, 2010 +.Dd February 24, 2011 .Dt CXM 4 .Os .Sh NAME @@ -61,9 +61,7 @@ driver provides support for the PCI capture on the Hauppauge PVR-250/350. It uses the .Xr bktr 4 -and -.Xr meteor 4 -ioctls. +and Meteor driver ioctls. .Pp Note that in order for the .Xr cxm 4 @@ -153,7 +151,6 @@ For example: .Sh SEE ALSO .Xr cxm_setchannel 1 , .Xr bktr 4 , -.Xr meteor 4 , .Xr cxm_extract_fw 8 .Sh HISTORY The diff --git a/share/man/man4/man4.i386/Makefile b/share/man/man4/man4.i386/Makefile index a1e1d71b27..1afab91b59 100644 --- a/share/man/man4/man4.i386/Makefile +++ b/share/man/man4/man4.i386/Makefile @@ -1,11 +1,10 @@ # $FreeBSD: src/share/man/man4/man4.i386/Makefile,v 1.122.2.12 2003/04/15 17:23:32 fjoe Exp $ -# $DragonFly: src/share/man/man4/man4.i386/Makefile,v 1.15 2008/08/28 09:47:04 hasso Exp $ MAN= aic.4 apm.4 ar.4 asc.4 asr.4 \ cs.4 cy.4 \ dgb.4 digi.4 el.4 en.4 ep.4 est.4 ex.4 fe.4 glxsb.4 gsc.4 \ ie.4 io.4 labpc.4 le.4 linux.4 lnc.4 longrun.4 \ - meteor.4 mse.4 npx.4 \ + mse.4 npx.4 \ pcf.4 perfmon.4 pnp.4 pnpbios.4 \ rdp.4 sb.4 sbni.4 \ spkr.4 sr.4 tw.4 \ diff --git a/share/man/man4/man4.i386/meteor.4 b/share/man/man4/man4.i386/meteor.4 deleted file mode 100644 index 40516bc33f..0000000000 --- a/share/man/man4/man4.i386/meteor.4 +++ /dev/null @@ -1,926 +0,0 @@ -.\" -.\" $FreeBSD: src/share/man/man4/man4.i386/meteor.4,v 1.10.2.4 2001/08/17 13:08:45 ru Exp $ -.\" $DragonFly: src/share/man/man4/man4.i386/meteor.4,v 1.11 2008/05/02 02:05:06 swildner Exp $ -.\" -.Dd August 6, 2009 -.Dt METEOR 4 i386 -.Os -.Sh NAME -.Nm meteor -.Nd "video capture driver" -.Sh SYNOPSIS -.Cd "device meteor" -.Sh DESCRIPTION -The -.Nm -driver provides support for a PCI -.Em video -capture. -It allows the capture of 24 bit RGB, 16 bit RGB and 16 bit YUV -output formats. -.Ss Meteor Driver Configuration -To use the -.Tn "Matrox Meteor" -card in your system, you need a computer -that supports the PCI (preferably the Type 2 or better) interface bus. -It is recommended that the system has more than 16 MB of RAM since this -capture card directly deposits the image to system RAM. -.Bl -enum -.It -In the configuration file, add the line: -.Pp -.Cd "device meteor" -.It -There is also a couple of optional parameters you may use: -.Bl -tag -width indent -.It Cd "options ""METEOR_ALLOC_PAGES=xxx""" -Specifies the number of contiguous pages to allocate when successfully -probed. -The default number of pages allocated by the kernel is 151. -This means that there are (151*4096) bytes available for use. -.It Cd "options METEOR_DEALLOC_PAGES" -Deallocate all pages when closing the device. -Note, the chances of -contiguously re-allocating new pages are very small. -The default -behavior is to not deallocate pages. -.It Cd "options ""METEOR_DEALLOC_ABOVE=xxx""" -Deallocate all pages above the specified number. -The default action is -to not deallocate above any pages. -.El -.It -Make and install the kernel. -.El -.Ss Meteor Capture Modes -The -.Nm -capture driver has three modes of capture operation. -.Bl -enum -.It -Conventional -.Xr read 2 -interface. -.Pp -This mode is the easiest and slowest to use. -This mode is great for -capturing a single field at little programming cost. -.Pp -In this mode, the user opens the device, sets the capture mode -and size (see: -.Dv METEORSETGEO -.Xr ioctl 2 -call), and uses the -.Xr read 2 -system -call to load the data into a buffer. -.Pp -.Pa meteor_read.c ; -read 400x300 RGB24 into a viewable PPM file -.Bd -literal -#include -#include - -extern int errno; -#define ROWS 300 -#define COLS 400 -#define SIZE (ROWS * COLS * 4) -main() -{ - struct meteor_geomet geo; - char buf[SIZE],b[4],header[16],*p; - int i,o,c; - - if ((i = open("/dev/meteor0", O_RDONLY)) < 0) { - printf("open failed: %d\\n", errno); - exit(1); - } - /* set up the capture type and size */ - geo.rows = ROWS; - geo.columns = COLS; - geo.frames = 1; - geo.oformat = METEOR_GEO_RGB24 ; - - if (ioctl(i, METEORSETGEO, &geo) < 0) { - printf("ioctl failed: %d\\n", errno); - exit(1); - } - - c = METEOR_FMT_NTSC; - - if (ioctl(i, METEORSFMT, &c) < 0) { - printf("ioctl failed: %d\\n", errno); - exit(1); - } - - c = METEOR_INPUT_DEV0; - - if (ioctl(i, METEORSINPUT, &c) < 0) { - printf("ioctl failed: %d\\n", errno); - exit(1); - } - - if ((c=read(i, &buf[0], SIZE)) < SIZE) { - printf("read failed %d %d %d\\n", c, i, errno); - close(i); - exit(1); - } - close(i); - - if ((o = open("rgb24.ppm", O_WRONLY | O_CREAT, 0644)) < 0) { - printf("ppm open failed: %d\\n", errno); - exit(1); - } - - /* make PPM header and save to file */ - strcpy(&header[0], "P6 400 300 255 "); - header[2] = header[6] = header[10] = header[14] = '\\n'; - write (o, &header[0], 15); - /* save the RGB data to PPM file */ - for (p = &buf[0]; p < &buf[SIZE]; ) { - b[2] = *p++; /* blue */ - b[1] = *p++; /* green */ - b[0] = *p++; /* red */ - *p++; /* NULL byte */ - write(o,&b[0], 3); /* not very efficient */ - } - close(o); - exit(0); -} -.Ed -.It -Memory mapped single capture or unsynchronized continuous capture. -.Pp -The single capture mode is designed for conferencing tools such as -.Nm nv . -These tools need to control the starting of the image capture and also -need several frames a second. -The continuous capture mode is designed -for applications that want free-running data. -.Pp -In this mode, the user opens the device, sets the capture mode -and size (see: -.Dv METEORSETGEO -.Xr ioctl 2 -call), -.Xr mmap 2 Ns s -the frame buffer -memory into the user process space, and issues either the -single-capture or the continuous capture call (see: -.Dv METEORCAPTUR -.Xr ioctl 2 -call) to load the data into the memory mapped buffer. -.Pp -As explained in the -.Dv METEORCAPTUR -.Xr ioctl 2 -call, the single frame capture -.Xr ioctl 2 -will block until the capture is complete, the continuous capture -will return immediately. -.Pp -.Pa meteor_mmap_single_continuous.c -.Bd -literal -#include -#include -#include -#include - -extern int errno; -#define ROWS 480 -#define COLS 640 -#define SIZE (ROWS * COLS * 2) -main() -{ - struct meteor_geomet geo; - char buf[SIZE]; - char *mmbuf; - int i,c; - - if ((i = open("/dev/meteor0", O_RDONLY)) < 0) { - printf("open failed\\n"); - exit(1); - } - - geo.rows = ROWS; - geo.columns = COLS; - geo.frames = 1; - geo.oformat = METEOR_GEO_RGB16 ; - - if (ioctl(i, METEORSETGEO, &geo) < 0) { - printf("ioctl failed: %d\\n", errno); - exit(1); - } - - c = METEOR_FMT_NTSC; - - if (ioctl(i, METEORSFMT, &c) < 0) { - printf("ioctl failed: %d\\n", errno); - exit(1); - } - - c = METEOR_INPUT_DEV0; - - if (ioctl(i, METEORSINPUT, &c) < 0) { - printf("ioctl failed: %d\\n", errno); - exit(1); - } - - mmbuf=(char *)mmap((caddr_t)0, SIZE, PROT_READ, - MAP_SHARED, i, (off_t)0); - -#ifdef SINGLE_MODE - /* single frame capture */ - c = METEOR_CAP_SINGLE ; - ioctl(i, METEORCAPTUR, &c); /* wait for the frame */ - - /* directly access the frame buffer array data in mmbuf */ -#else - /* continuous frame capture */ - c = METEOR_CAP_CONTINOUS ; - ioctl(i, METEORCAPTUR, &c); /* returns immediately */ - - /* directly access the frame buffer array data in mmbuf */ - - c = METEOR_CAP_STOP_CONT ; - ioctl(i, METEORCAPTUR, &c); /* close will also stop capture */ -#endif - - close(i); - exit(0); -} -.Ed -.It -Memory mapped, multi-frame ring buffer synchronize capture. -.Pp -This continuous capture mode is synchronized with the application that -processes up to 32 frames. -This gives the advantages of both single and -continuous capture modes. -.Pp -The kernel notifies the application of a new data by raising an -application defined signal. -The driver also shares a structure with -the application that allows them to communicate which frame has been -written by the kernel and which frame has been read by the application. -.Pp -The shared structure starts on the first page after your data. -The -structure address can be found by calculation: -.Pp -.Dl "(number_rows * number_columns * pixel_depth + 4095) & 0xfffff000" -or -.Dl "((number_rows * number_columns * pixel_depth + 4095)/4096) * 4096" -.Pp -The shared structure is of type -.Va struct meteor_mem . -The two most -important fields are called -.Va active -and -.Va num_active_buf . -.Va active -is a bitmap of frames written by the kernel. -.Va num_active_bufs -is -a count of frames marked in the -.Va active -field. -When a frame is read -in by the driver, the -.Va num_active_bufs -count is tested, if this -count is below the threshold of number of active frames (value -in -.Va meteor_mem Ns 's -.Va hiwat -variable), the bit representing frame -number in the buffer is stored in the -.Va active -variable, the -.Va num_active_bufs -is incremented, the kernel then raises the specified -signal to activate the user application. -The user application's -responsibility when getting the signal is to check the active bitmap -to determine the lowest active frame, use the data as the application -desires, clear the bitmap entry for that frame, and decrement the -.Va num_active_bufs . -If the threshold of number of active frames -.Pq Va hiwat -has been exceeded, no new frames or signal from the kernel will occur -until the -.Va num_active_bufs -is less than or equal to -.Va lowat . -.Pp -The driver loads the frames in a round-robin fashion. -It is expected -that the user removes them in the same order. -The driver does not -check to see if the frame is already active. -.Pp -The -.Va frame_size -and number of frames in the buffer are also provided -to the -.Va meteor_mem -structure, but changing these fields in the -application will not change the operation of the driver. -.Pp -In programming for this mode, the user opens the device, sets the -geometry, -.Xr mmap 2 Ns s -the data/common control structure, then starts the -continuous capture mode. -A special signal catcher is required to -process the frames as they are read by the kernel. -.Pp -When specifying the geometry (see: -.Dv METEORSETGEO -.Xr ioctl 2 -call), -it -is important that the number of frames is set greater than 1. -.Pp -.Pa skeleton_capture_n.c -.Bd -literal -#include -#include -#include -#include -#include - -int video; /* made global if you wish to stop capture in signal handler */ -caddr_t data_frames; -struct meteor_mem *common_mem; -extern int errno; - -#define FRAME_MAX - -void -usr2_catcher() -{ -#ifdef SIGNAL_STOP - struct meteor_capframe capframe; /* for ioctl */ -#endif - char *frame; - - /* find frame */ - frame = (char *) (data_frames + sig_cnt * common_mem->frame_size) ; - - /* add frame processing here */ - /* deactivate frame */ - common_mem->active &= ~(1 << (sig_cnt % 16)); - common_mem->num_active_bufs--; - - /* process next frame on next interrupt */ - sig_cnt = ((sig_cnt+1) % FRAME_MAX); - -#ifdef SIGNAL_STOP - if (some_condition_requiring_stopping) { - capframe.command=METEOR_CAP_STOP_FRAMES; - - if (ioctl(i, METEORCAPFRM, &capframe) < 0) { - printf("METEORCAPFRM failed %d\\n", errno); - exit(1); - } - } -#endif -} - -main() -{ - struct meteor_geomet geo; - int height, width, depth, frames, size; - struct meteor_capframe capframe; - - if ((i = open("/dev/meteor0", O_RDONLY)) < 0) { - printf("open failed\\n"); - exit(1); - } - printf("test %d %d\\n", errno, i); - - height = geo.rows = 120; - width= geo.columns = 320; - frames = geo.frames = FRAME_MAX; - depth = 2; /* 2 bytes per pixel for RGB*/ - - - geo.oformat = METEOR_GEO_RGB16; - - if (ioctl(i, METEORSETGEO, &geo) < 0) { - printf("METEORSETGEO failed %d\\n", errno); - exit(1); - } - - c = METEOR_FMT_NTSC; - - if (ioctl(i, METEORSFMT, &c) < 0) { - printf("ioctl failed: %d\\n", errno); - exit(1); - } - - c = METEOR_INPUT_DEV0; - - if (ioctl(i, METEORSINPUT, &c) < 0) { - printf("ioctl failed: %d\\n", errno); - exit(1); - } - - size = ((width*height*depth*frames+4095)/4096)*4096; - /* add one page after data for meteor_mem */ - data_frames = mmap((caddr_t)0, size + 4096, PROT_READ | PROT_WRITE, - MAP_SHARED, i, (off_t)0); - - if (data_frames == (caddr_t) MAP_FAILED) return (0); - - /* common_mem is located at page following data */ - common_mem = (struct meteor_mem *) (y + size); - - signal(SIGUSR2, usr2_catcher); /* catch new frame message */ - - capframe.command=METEOR_CAP_N_FRAMES; - capframe.signal=SIGUSR2; - capframe.lowat=12; /* must be < hiwat */ - capframe.hiwat=14; /* must be < FRAME_MAX */ - - /* start the sync capture */ - if (ioctl(i, METEORCAPFRM, &capframe) < 0) { - printf("METEORCAPFRM failed %d\\n", errno); - exit(1); - } - - /* this is the background working area, or you can sleep */ - - - /* to stop capture */ - capframe.command=METEOR_CAP_STOP_FRAMES; - - if (ioctl(i, METEORCAPFRM, &capframe) < 0) { - printf("METEORCAPFRM failed %d\\n", errno); - exit(1); - } -} -.Ed -.El -.Ss Meteor IOCTL Call and Parameters -The -.Nm -capture driver has -.Xr ioctl 2 -requests for capturing, reading card -status, for setting and reading the geometry, and for setting and reading the -attributes. -.Pp -.Bf -symbolic -IT IS VERY IMPORTANT TO CHECK FOR ERRORS ON THESE RETURNING IOCTLs. -.Ef -Errors indicate that something is very wrong with the -.Xr ioctl 2 -and the -application should not attempt to proceed further with capturing. -The -.Nm -capture driver still makes attempts to stop the next capture step if -an error occurred in a previous step but was ignored by the application -programmer. -.Bl -enum -.It -.Xr ioctl 2 -requests -.Dv METEORSETGEO -and -.Dv METEORGETGEO -.Pp -.Dv METEORSETGEO -and -.Dv METEORGETGEO -are used to set and read the input -size, input device, and output format for frame capture. -.Pp -These -.Xr ioctl 2 -routines use the -.Va meteor_geomet -structure that has the -following entries: -.Bl -tag -width columns -.It Va rows -number of rows (lines high) in output image -.It Va columns -number of pixels in a row (width) in output image -.It Va frames -number of frames in buffer. -Should be 1, unless using -the multi-framed synchronous capture mode -.Pq Dv METEORCAPFRM -which REQUIRES frames to be larger than 1. -.Pp -Note: if -.Va rows , columns -or -.Va frames -is not changed, then -the existing values are used. -The system defaults -is 640x480x1. -.It Va oformat -you may choose one of the following output format: -.Bl -tag -width METEOR_GEO_YUV_PACKED -.It Dv METEOR_GEO_RGB16 -(RGB 16 bits xrrrrrgg gggbbbbb default) -.It Dv METEOR_GEO_RGB24 -(RGB 24 bits packed in 32 bits: -00000000 rrrrrrrr gggggggg bbbbbbbb) -.It Dv METEOR_GEO_YUV_PACKED -(4-2-2 YUV 16 bits packed byte format: -u0 y0 v0 y1 u1 y2 v1 y3 ...) -.It Dv METEOR_GEO_YUV_PLANER -(4-2-2 YUV 16 bits planer format: -rows * columns bytes of y -rows * column / 4 bytes of even u -rows * column / 4 bytes of even v -rows * column / 4 bytes of odd u -rows * column / 4 bytes of odd v) -.El -.El -.Pp -The -.Dv METEORSETGEO -.Xr ioctl 2 -will fail if more than one entry from a category -is selected. -It is highly recommended that a -.Dv METEORSETGEO -is done -before capturing data because you cannot guarantee the initial mode -the card. -.Pp -The -.Dv METEORSETGEO -will also attempt to reallocate a new contiguous -kernel buffer if the new geometry exceeds the old geometry. -On -other hand, if the new geometry will fit in the existing buffer, -the existing buffer is used. -.Pp -If -.Dv METEORSETGEO -fails the -.Xr ioctl 2 -will return a value of -1 and the -external variable -.Va errno -will be set to: -.Bl -tag -width Er -.It Bq Er EINVAL -invalid -.Va meteor_geomet -structure pointer, -.Va rows , columns , frames -were invalid. -.It Bq Er ENOMEM -could not allocate the contiguous block. -.El -.It -.Xr ioctl 2 -requests -.Dv METEORSFMT -and -.Dv METEORGFMT -.Pp -.Dv METEORSFMT -and -.Dv METEORGFMT -are used to set and read the camera input -standard format. -.Pp -Possible formats are: -.Pp -.Bl -tag -width METEOR_FMT_AUTOMODE -compact -.It Dv METEOR_FMT_NTSC -NTSC (default mode) -.It Dv METEOR_FMT_PAL -PAL -.It Dv METEOR_FMT_SECAM -SECAM -.It Dv METEOR_FMT_AUTOMODE -Autodetect. -.El -.It -.Xr ioctl 2 -requests -.Dv METEORSINPUT -and -.Dv METEORGINPUT -.Pp -.Dv METEORSINPUT -and -.Dv METEORGINPUT -are used to set and read the camera -input device. -Using the DB9 connector on the -.Tn Meteor -card, 4 input -devices can be connected and an input camera can be selected with this -.Xr ioctl 2 . -.Pp -Possible formats are: -.Pp -.Bl -tag -width METEOR_INPUT_DEV_SVIDEO -compact -.It Dv METEOR_INPUT_DEV0 -(default if none specified) -.It Dv METEOR_INPUT_DEV_RCA -(same as METEOR_INPUT_DEV0) -.It Dv METEOR_INPUT_DEV1 -.It Dv METEOR_INPUT_DEV2 -.It Dv METEOR_INPUT_DEV_SVIDEO -(same as METEOR_INPUT_DEV2) -.El -.It -.Xr ioctl 2 -request -.Dv METEORSTATUS -.Pp -.Dv METEORSTATUS -is used to read the status of the -.Tn Meteor -capture card -and returns the following information: -.Bl -column "METEOR_STATUS_ID_MASK" "\&" -.It Dv METEOR_STATUS_ID_MASK " 4 bit ID of the SAA7196 scaler chip." -.Pp -.It Dv METEOR_STATUS_DIR " 0 = scaler uses internal source." -.It " 1 = scaler uses external data of expansion bus." -.Pp -.It Dv METEOR_STATUS_OEF " 0 = even field detected." -.It " 1 = odd field detected." -.Pp -.It Dv METEOR_STATUS_SVP " VRAM Port state:" -.It " 0 = inputs HFL and INCADDR inactive." -.It " 1 = inputs HFL and INCADDR active." -.Pp -.It Dv METEOR_STATUS_STTC " 0 = TV horizontal time constant (slow)." -.It " 1 = VCR horizontal time constant (fast)." -.Pp -.It Dv METEOR_STATUS_HCLK " 0 = Horizontal Phase Lock Loop locked." -.It " 1 = Horizontal Phase Lock Loop unlocked." -.Pp -.It Dv METEOR_STATUS_FIDT " 0 = 50 Hz Field detected." -.It " 1 = 60 Hz Field detected." -.Pp -.It Dv METEOR_STATUS_ALTD " 0 = no line alternating color burst detected." -.It " 1 = line alternating color burst detected (PAL/SECAM)." -.Pp -.It Dv METEOR_STATUS_CODE " 0 = no color information detected." -.It " 1 = color information detected." -.El -.It -.Xr ioctl 2 -request -.Dv METEORCAPTUR -.Pp -.Dv METEORCAPTUR -is used to single frame capture or unsynchronized -continuous capture. -.Pp -The single frame capture -.Xr ioctl 2 -request will return only after a -frame has been captured and transferred to the frame buffer. -.Pp -The unsynchronized continuous capture will return immediately and -data is directly deposited into the buffer when it is available. -Since this is unsynchronized, it is possible the data is being -written by the kernel while being read by the application. -.Pp -These -.Xr ioctl 2 -routines use the following settings: -.Pp -.Bl -tag -width METEOR_CAP_CONTINOUS -compact -.It Dv METEOR_CAP_SINGLE -capture one frame -.It Dv METEOR_CAP_CONTINOUS -unsynchronized continuous capture -.It Dv METEOR_CAP_STOP_CONT -stop the unsynchronized continuous -capture -.El -.Pp -If -.Dv METEORCAPTUR -fails the -.Xr ioctl 2 -will return a value of -1 and the -external variable -.Va errno -will be set to: -.Bl -tag -width Er -.It Bq Er EINVAL -invalid capture command value -.It Bq Er ENXIO -there is not internal buffer to hold the frame. -This indicates the previous set geometry -.Xr ioctl 2 -failed. -.It Bq Er EIO -card is already capturing. -.El -.It -.Xr ioctl 2 -request -.Dv METEORCAPFRM -.Pp -.Dv METEORCAPFRM -is used for synchronous capture of multiple frames. -.Pp -This -.Xr ioctl 2 -routine uses the -.Va meteor_capture -structure that has the -following entries: -.Bl -tag -width command -.It Va command -possible values for -.Va command -are: -.Bl -tag -width METEOR_CAP_STOP_FRAMES -.It Dv METEOR_CAP_STOP_FRAMES -stop the capture; does not use the -other variable in structure. -.It Dv METEOR_CAP_N_FRAMES -start the capture using the other -variables in the structure as inputs -.El -.It Va signal -signal to send to application when a new -frame has been captured. -This signal will -only be raised if the captured frame is saved. -.It Va lowat -see below -.It Va hiwat -see below -.El -.Pp -When a new frame is completed, the driver checks the current unread -frame count stored in shared variable (the shared variable is stored -in the -.Va meteor_mem -structure) -.Va num_active_buf ; -if the count is larger -than -.Va hiwat , -the driver will not store any new frames and will not -send capture signal to the user application until the -.Va num_active_buf -is lower than -.Va lowat . -.Pp -If -.Dv METEORCAPFRM -fails the -.Xr ioctl 2 -will return a value of -1 and the -external variable -.Va errno -will be set to: -.Bl -tag -width Er -.It Bq Er EINVAL -invalid meteor_geomet structure pointer or bad command. -.It Bq Er ENXIO -there is not internal buffer to hold the frame. -This indicates the previous set geometry -.Xr ioctl 2 -failed. -.It Bq Er EIO -card is already capturing. -.El -.It -.Xr ioctl 2 -requests -.Dv METEORSCHCV -and -.Dv METEORGCHCV -.Pp -.Dv METEORSCHCV -and -.Dv METEORGCHCV -are used to set and get the chrominance -gain control and affects the UV output amplitude. -.Pp -If -.Dv METEORSCHCV -or -.Dv METEORGCHCV -fails the -.Xr ioctl 2 -will return a value -of -1 and the external variable -.Va errno -will be set to: -.Bl -tag -width Er -.It Bq Er EINVAL -invalid unsigned char pointer. -.El -.It -.Xr ioctl 2 -requests -.Dv METEORGHUE -and -.Dv METEORSHUE -.Pp -.Dv METEORGHUE -and -.Dv METEORSHUE -are used to get and set the hue. -The -signed character has legal values are from +127 which represent -+178.6 degrees to -128 which represents -180 degrees. -.Pp -If -.Dv METEORGHUE -or -.Dv METEORSHUE -fails the -.Xr ioctl 2 -will return a value of --1 and the external variable -.Va errno -will be set to: -.Bl -tag -width Er -.It Bq Er EINVAL -invalid signed char pointer. -.El -.It -.Xr ioctl 2 -requests -.Dv METEORSCOUNT -and -.Dv METEORGCOUNT -.Pp -.Dv METEORGCOUNT -is used to get the count of frame errors, DMA errors and -count of the number of frames captured that have occurred since -the device was opened. -.Dv METEORSCOUNT -can be used to reinitialize the -counters. -.Pp -This -.Xr ioctl 2 -routines use the -.Va meteor_counts -structure that has the -following entries: -.Bl -tag -width frame_count -.It Va fifo_errors -number of FIFO errors since device was opened. -.It Va dma_errors -number of DMA errors since device was opened. -.It Va frame_count -number of frames captured since device was opened. -.El -.Pp -If -.Dv METEORSCOUNT -or -.Dv METEORGCOUNT -fails the -.Xr ioctl 2 -will return a value -of -1 and the external variable -.Va errno -will be set to: -.Bl -tag -width Er -.It Bq Er EINVAL -invalid meteor_counts structure pointer. -.El -.El -.Sh SEE ALSO -.Xr bktr 4 , -.Xr cxm 4 -.Sh AUTHORS -.An Jim Lowe Aq james@miller.cs.uwm.edu , -.An Mark Tinguely Aq tinguely@plains.nodak.edu -.Sh BUGS -.Bl -enum -.It -IIC register is difficult to set. -We got around that by adding a long -wait at each IIC register write. -.It -We had difficulties getting the -.Tn Meteor -capture card to work on systems -that used NCR chipset SCSI cards. -It is possible that the -.Tn Meteor -and -.Tn "NCR SCSI" -could work together using the newer TRITON motherboards. -.El diff --git a/sys/conf/files b/sys/conf/files index be579a8628..4fd0bed75e 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1632,7 +1632,6 @@ dev/powermng/amdpm/amdpm.c optional amdpm pci dev/powermng/amdsmb/amdsmb.c optional amdsmb pci dev/powermng/intpm/intpm.c optional intpm pci dev/powermng/viapm/viapm.c optional viapm pci -dev/video/meteor/meteor.c optional meteor pci dev/disk/ncr/ncr.c optional ncr dev/disk/sym/sym_hipd.c optional sym \ dependency "$S/dev/disk/sym/sym_{conf,defs}.h" diff --git a/sys/conf/options b/sys/conf/options index 6ebe2471f4..5673df1edb 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -532,13 +532,6 @@ BKTR_430_FX_MODE opt_bktr.h BKTR_SIS_VIA_MODE opt_bktr.h BKTR_NEW_MSP34XX_DRIVER opt_bktr.h -# meteor opt_meteor.h -METEOR_ALLOC_PAGES opt_meteor.h -METEOR_TEST_VIDEO opt_meteor.h -METEOR_SYSTEM_DEFAULT opt_meteor.h -METEOR_DEALLOC_PAGES opt_meteor.h -METEOR_DEALLOC_ABOVE opt_meteor.h - # Various mi ISA bus flags COMPAT_OLDISA opt_compat_oldisa.h COM_ESP opt_sio.h diff --git a/sys/config/LINT b/sys/config/LINT index df3c3c3fec..786a643508 100644 --- a/sys/config/LINT +++ b/sys/config/LINT @@ -1573,7 +1573,6 @@ device "snd_uaudio" # ctx: Cortex-I frame grabber # apm: Laptop Advanced Power Management (experimental) # spigot: The Creative Labs Video Spigot video-acquisition board -# meteor: Matrox Meteor video capture board # bktr: Brooktree bt848/848a/849a/878/879 video capture and TV Tuner board # cy: Cyclades serial driver # dgb: Digiboard PC/Xi and PC/Xe series driver (ALPHA QUALITY!) @@ -1862,17 +1861,6 @@ options AHD_REG_PRETTY_PRINT # Dell Precision desktop machines and the integrated 3c905-TX chips # in Dell Latitude laptop docking stations. # -# The `meteor' device is a PCI video capture board. It can also have the -# following options: -# options METEOR_ALLOC_PAGES=xxx preallocate kernel pages for data entry -# figure (ROWS*COLUMN*BYTES_PER_PIXEL*FRAME+PAGE_SIZE-1)/PAGE_SIZE -# options METEOR_DEALLOC_PAGES remove all allocated pages on close(2) -# options METEOR_DEALLOC_ABOVE=xxx remove all allocated pages above the -# specified amount. If this value is below the allocated amount no action -# taken -# options METEOR_SYSTEM_DEFAULT={METEOR_PAL|METEOR_NTSC|METEOR_SECAM}, used -# for initialization of fps routine when a signal is not present. -# # The 'bktr' device is a PCI video capture device using the Brooktree # bt848/bt848a/bt849a/bt878/bt879 chipset. When used with a TV Tuner it forms a # TV card, eg Miro PC/TV, Hauppauge WinCast/TV WinTV, VideoLogic Captivator, @@ -2011,9 +1999,6 @@ device stge # Sundance/Tamarack TC9021 Gigabit Ethernet device msk # Marvell/SysKonnect Yukon II Gigabit Ethernet device jme # JMicron Gigabit/Fast Ethernet -#device meteor - - # Brooktree driver has been ported to the new I2C framework. Thus, # you'll need to have the following 3 lines in the kernel config. # device smbus @@ -2829,7 +2814,6 @@ options LOCKF_DEBUG options LOUTB #options MAXFILES=xxx options MBUF_DEBUG -options METEOR_TEST_VIDEO options NETATALKDEBUG options PANIC_DEBUG options PMAP_DEBUG diff --git a/sys/dev/video/meteor/meteor.c b/sys/dev/video/meteor/meteor.c deleted file mode 100644 index 261e713dd5..0000000000 --- a/sys/dev/video/meteor/meteor.c +++ /dev/null @@ -1,2115 +0,0 @@ -/* - * 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: src/sys/pci/meteor.c,v 1.49 1999/09/25 18:24:41 phk Exp $ - */ - -/* Change History: - 8/21/95 Release - 8/23/95 On advice from Stefan Esser, added volatile to PCI - memory pointers to remove PCI caching . - 8/29/95 Fixes suggested by Bruce Evans. - meteor_mmap should return -1 on error rather than 0. - unit # > NMETEOR should be unit # >= NMETEOR. - 10/24/95 Turn 50 Hz processing for SECAM and 60 Hz processing - off for AUTOMODE. - 11/11/95 Change UV from always begin signed to ioctl selected - to either signed or unsigned. - 12/07/95 Changed 7196 startup codes for 50 Hz as recommended - by Luigi Rizzo (luigi@iet.unipi.it) - 12/08/95 Clear SECAM bit in PAL/NTSC and set input field count - bits for 50 Hz mode (PAL/SECAM) before I was setting the - output count bits. by Luigi Rizzo (luigi@iet.unipi.it) - 12/18/95 Correct odd DMA field (never exceed, but good for safety - Changed 7196 startup codes for 50 Hz as recommended - by Luigi Rizzo (luigi@iet.unipi.it) - 12/19/95 Changed field toggle mode to enable (offset 0x3c) - recommended by luigi@iet.unipi.it - Added in prototyping, include file, staticizing, - and DEVFS changes from FreeBSD team. - Changed the default allocated pages from 151 (NTSC) - to 217 (PAL). - Cleaned up some old comments in iic_write(). - Added a Field (even or odd) only capture mode to - eliminate the high frequency problems with compression - algorithms. Recommended by luigi@iet.unipi.it. - Changed geometry ioctl so if it couldn't allocated a - large enough contiguous space, it wouldn't free the - stuff it already had. - Added new mode called YUV_422 which delivers the - data in planer Y followed by U followed by V. This - differs from the standard YUV_PACKED mode in that - the chrominance (UV) data is in the correct (different) - order. This is for programs like vic and mpeg_encode - so they don't have to reorder the chrominance data. - Added field count to stats. - Increment frame count stat if capturing continuous on - even frame grabs. - Added my email address to these comments - (james@cs.uwm.edu) suggested by (luigi@iet.unipt.it :-). - Changed the user mode signal mechanism to allow the - user program to be interrupted at the end of a frame - in any one of the modes. Added SSIGNAL ioctl. - Added a SFPS/GFPS ioctl so one may set the frames per - second that the card catpures. This code needs to be - completed. - Changed the interrupt routine so synchronous capture - will work on fields or frames and the starting frame - can be either even or odd. - Added HALT_N_FRAMES and CONT_N_FRAMES so one could - stop and continue synchronous capture mode. - Change the tsleep/wakeup function to wait on mtr - rather than &read_intr_wait. - 1/22/96 Add option (METEOR_FreeBSD_210) for FreeBSD 2.1 - to compile. - Changed intr so it only printed errors every 50 times. - Added unit number to error messages. - Added get_meteor_mem and enabled range checking. - 1/30/96 Added prelim test stuff for direct video dma transfers - from Amancio Hasty (hasty@rah.star-gate.com). Until - we get some stuff sorted out, this will be ifdef'ed - with METEOR_DIRECT_VIDEO. This is very dangerous to - use at present since we don't check the address that - is passed by the user!!!!! - 2/26/96 Added special SVIDEO input device type. - 2/27/96 Added meteor_reg.h file and associate types Converted - meteor.c over to using meteor.h file. Prompted by - Lars Jonas Olsson . - 2/28/96 Added meteor RGB code from Lars Jonas Olsson - . I make some mods to this code, so - I hope it still works as I don't have an rgb card to - test with. - 2/29/96 tested the meteor RGB and supplied - me with diffs. Thanks, we now have a working RGB - version of the driver. Still need to clean up this - code. - 3/1/96 Fixed a nasty little bug that was clearing the VTR - mode bit when the 7196 status was requested. - 3/15/96 Fixed bug introduced in previous version that - stopped the only fields mode from working. - Added METEOR{GS}TS ioctl, still needs work. - 3/25/96 Added YUV_9 and YUV_12 modes. Cleaned up some of the - code and converted variables to use the new register - types. - 4/8/96 Fixed the a bug in with the range enable. Pointed - out by Jim Bray. - 5/13/96 Fix the FPS ioctl so it actually sets the frames - per second. Code supplied by ian@robots.ox.ac.uk. - The new code implements a new define: - METEOR_SYSTEM_DEFAULT which should be defined as - METEOR_PAL, METEOR_SECAM, or METEOR_NTSC in your system - configuration file. If METEOR_SYSTEM_DEFAULT isn't - defined, and there is not a signal when set_fps is - called, then the call has no effect. - Changed the spelling of PLANER to PLANAR as pointed - out by Paco Hope and define - PLANER to be PLANAR for backward compatibility. - 5/28/95 METEOR_INPUT_DEV_RCA -> METEOR_INPUT_DEV0, not - METEOR_GEO_DEV0. Pointed out by Ian Reid, - . - METEOR_DEV_MASK should be 0x0000f000 and not - 0x2000f000, otherwise METEOR_RGB gets masked - out. Pointed out by Ian Reid. - Changed the fps code to give even distribution for - low frame rates. Code supplied by Ian Reid. - Fix some problems with the RGB version. Patch supplied - by . - Added METEOR_FIELD_MODE to include files for a - future version of this driver. -*/ - -#include "use_meteor.h" -#include "opt_meteor.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(METEOR_FreeBSD_210) -#include /* bootverbose */ -#endif - -#include -#include -#include -#include - -#include -#include -#include -#include - - -static void meteor_intr (void *arg); - -/* - * Allocate enough memory for: - * 768x576 RGB 16 or YUV (16 storage bits/pixel) = 884736 = 216 pages - * - * You may override this using the options "METEOR_ALLOC_PAGES=value" in your - * kernel configuration file. - */ -#ifndef METEOR_ALLOC_PAGES -#define METEOR_ALLOC_PAGES 217 -#endif -#define METEOR_ALLOC (METEOR_ALLOC_PAGES * PAGE_SIZE) - -static meteor_reg_t meteor[NMETEOR]; -#define METEOR_NUM(mtr) ((mtr - &meteor[0])/sizeof(meteor_reg_t)) - -#define METPRI PCATCH - -static const char* met_probe (pcici_t tag, pcidi_t type); -static void met_attach(pcici_t tag, int unit); -static u_long met_count; - -static struct pci_device met_device = { - "meteor", - met_probe, - met_attach, - &met_count -}; - -COMPAT_PCI_DRIVER (meteor, met_device); - -#if defined(METEOR_FreeBSD_210) /* XXX */ -d_open_t meteor_open; -d_close_t meteor_close; -d_read_t meteor_read; -d_write_t meteor_write; -d_ioctl_t meteor_ioctl; -d_mmap_t meteor_mmap; -#else -static d_open_t meteor_open; -static d_close_t meteor_close; -static d_read_t meteor_read; -static d_write_t meteor_write; -static d_ioctl_t meteor_ioctl; -static d_mmap_t meteor_mmap; - -static struct dev_ops meteor_ops = { - { "meteor", 0, 0 }, - .d_open = meteor_open, - .d_close = meteor_close, - .d_read = meteor_read, - .d_write = meteor_write, - .d_ioctl = meteor_ioctl, - .d_mmap = meteor_mmap, -}; -#endif - -static mreg_t saa7116_pci_default[sizeof(struct saa7116_regs)/sizeof(mreg_t)]={ - /* PCI Memory registers */ - /* BITS Type Description */ -/* 0x00 */ 0x00000000, /* 31:1 e*RW DMA 1 (Even) - 0 RO 0x0 */ -/* 0x04 */ 0x00000000, /* 31:2 e*RW DMA 2 (Even) - 1:0 RO 0x0 */ -/* 0x08 */ 0x00000000, /* 31:2 e*RW DMA 3 (Even) - 1:0 RO 0x0 */ -/* 0x0c */ 0x00000000, /* 31:1 o*RW DMA 1 (Odd) - 0 RO 0x0 */ -/* 0x10 */ 0x00000000, /* 31:2 o*RW DMA 2 (Odd) - 1:0 RO 0x0 */ -/* 0x14 */ 0x00000000, /* 31:2 o*RW DMA 3 (Odd) - 1:0 RO 0x0 */ -/* 0x18 */ 0x00000500, /* 15:2 e*RW Stride 1 (Even) - 1:0 RO 0x0 */ -/* 0x1c */ 0x00000000, /* 15:2 e*RW Stride 2 (Even) - 1:0 RO 0x0 */ -/* 0x20 */ 0x00000000, /* 15:2 e*RW Stride 3 (Even) - 1:0 RO 0x0 */ -/* 0x24 */ 0x00000500, /* 15:2 o*RW Stride 1 (Odd) - 1:0 RO 0x0 */ -/* 0x28 */ 0x00000000, /* 15:2 o*RW Stride 2 (Odd) - 1:0 RO 0x0 */ -/* 0x2c */ 0x00000000, /* 15:2 o*RW Stride 3 (Odd) - 1:0 RO 0x0 */ -/* 0x30 */ 0xeeeeee01, /* 31:8 *RW Route (Even) - 7:0 *RW Mode (Even) */ -/* 0x34 */ 0xeeeeee01, /* 31:8 *RW Route (Odd) - 7:0 *RW Mode (Odd) */ -/* 0x38 */ 0x00200020, /* 22:16 *RW FIFO Trigger Planer Mode, - 6:0 *RW FIFO Trigger Packed Mode */ -/* 0x3c */ 0x00000107, /* 9:8 *RW Reserved (0x0) - 2 *RW Field Toggle - 1 *RW Reserved (0x1) - 0 *RW Reserved (0x1) */ -/* 0x40 */ 0x000000c0, /* 15 *RW Range Enable - 14 *RW Corrupt Disable - 11 *RR Address Error (Odd) - 10 *RR Address Error (Even) - 9 *RR Field Corrupt (Odd) - 8 *RR Field Corrupt (Even) - 7 *RW Fifo Enable - 6 *RW VRSTN# - 5 *RR Field Done (Odd) - 4 *RR Field Done (Even) - 3 *RS Single Field Capture (Odd) - 2 *RS Single Field Capture (Even) - 1 *RW Capture (ODD) Continous - 0 *RW Capture (Even) Continous */ -/* 0x44 */ 0x00000000, /* 7:0 *RW Retry Wait Counter */ -/* 0x48 */ 0x00000307, /* 10 *RW Interrupt mask, start of field - 9 *RW Interrupt mask, end odd field - 8 *RW Interrupt mask, end even field - 2 *RR Interrupt status, start of field - 1 *RR Interrupt status, end of odd - 0 *RR Interrupt status, end of even */ -/* 0x4c */ 0x00000001, /* 31:0 *RW Field Mask (Even) continous */ -/* 0x50 */ 0x00000001, /* 31:0 *RW Field Mask (Odd) continous */ -/* 0x54 */ 0x00000000, /* 20:16 *RW Mask Length (Odd) - 4:0 *RW Mask Length (Even) */ -/* 0x58 */ 0x0005007c, /* 22:16 *RW FIFO almost empty - 6:0 *RW FIFO almost full */ -/* 0x5c */ 0x461e1e0f, /* 31:24 *RW I2C Phase 4 - 23:16 *RW I2C Phase 3 - 15:8 *RW I2C Phase 2 - 7:0 *RW I2C Phase 1 */ -/* 0x60 */ 0x00000300, /* 31:24 *RO I2C Read Data - 23:16 **RW I2C Auto Address - 11 RO I2C SCL Input - 10 RO I2C SDA Input - 9 RR I2C Direct Abort - 8 RR I2C Auto Abort - 3 RW I2C SCL Output - 2 RW I2C SDA Output - 1 RW I2C Bypass - 0 RW I2C Auto Enable */ -/* 0x64 */ 0x00000000, /* 24 RS I2C New Cycle - 23:16 **RW I2C Direct Address - 15:8 **RW I2C Direct Sub-address - 7:0 **RW I2C Direct Write Address */ -/* 0x68 */ 0x00000000, /* 31:24 **RW I2C Auto Sub-address 1 (Even) - 23:16 **RW I2C Auto Data 1 (Even) - 15:8 **RW I2C Auto Sub-address 0 (Even) - 7:0 **RW I2C Auto Data 0 (Even) */ -/* 0x6c */ 0x00000000, /* 31:24 **RW I2C Auto Sub-address 3 (Even) - 23:16 **RW I2C Auto Data 3 (Even) - 15:8 **RW I2C Auto Sub-address 2 (Even) - 7:0 **RW I2C Auto Data 2 (Even) */ -/* 0x70 */ 0x00000000, /* 31:24 **RW I2C Auto Sub-address 5 (Even) - 23:16 **RW I2C Auto Data 5 (Even) - 15:8 **RW I2C Auto Sub-address 4 (Even) - 7:0 **RW I2C Auto Data 4 (Even) */ -/* 0x74 */ 0x00000000, /* 31:24 **RW I2C Auto Sub-address 7 (Even) - 23:16 **RW I2C Auto Data 7 (Even) - 15:8 **RW I2C Auto Sub-address 6 (Even) - 7:0 **RW I2C Auto Data 6 (Even) */ -/* 0x78 */ 0x00000000, /* 31:24 **RW I2C Auto Sub-address 1 (Odd) - 23:16 **RW I2C Auto Data 1 (Odd) - 15:8 **RW I2C Auto Sub-address 0 (Odd) - 7:0 **RW I2C Auto Data 0 (Odd) */ -/* 0x7c */ 0x00000000, /* 31:24 **RW I2C Auto Sub-address 3 (Odd) - 23:16 **RW I2C Auto Data 3 (Odd) - 15:8 **RW I2C Auto Sub-address 2 (Odd) - 7:0 **RW I2C Auto Data 2 (Odd) */ -/* 0x80 */ 0x00000000, /* 31:24 **RW I2C Auto Sub-address 5 (Odd) - 23:16 **RW I2C Auto Data 5 (Odd) - 15:8 **RW I2C Auto Sub-address 4 (Odd) - 7:0 **RW I2C Auto Data 4 (Odd) */ -/* 0x84 */ 0x00000000, /* 31:24 **RW I2C Auto Sub-address 7 (Odd) - 23:16 **RW I2C Auto Data 7 (Odd) - 15:8 **RW I2C Auto Sub-address 6 (Odd) - 7:0 **RW I2C Auto Data 6 (Odd) */ -/* 0x88 */ 0x00000000, /* 23:16 **RW I2C Register Enable (Odd) - 7:0 **RW I2C Register Enable (Even) */ -/* 0x8c */ 0x00000000, /* 23:2 e*RW DMA End (Even) - 1:0 RO 0x0 */ -/* 0x90 */ 0x00000000 /* 23:2 e*RW DMA End (Odd) - 1:0 RO 0x0 */ -}; - -static u_char saa7196_i2c_default[NUM_SAA7196_I2C_REGS] = { - /* SAA7196 I2C bus control */ - /* BITS Function */ -/* 00 */ 0x50, /* 7:0 Increment Delay */ -/* 01 */ 0x30, /* 7:0 Horizontal Sync Begin for 50hz */ -/* 02 */ 0x00, /* 7:0 Horizontal Sync Stop for 50hz */ -/* 03 */ 0xe8, /* 7:0 Horizontal Sync Clamp Start for 50hz */ -/* 04 */ 0xb6, /* 7:0 Horizontal Sync Clamp Stop for 50hz */ -/* 05 */ 0xf4, /* 7:0 Horizontal Sync Start after PH1 for 50hz */ -/* 06 */ 0x46, /* 7 Input mode =0 CVBS, =1 S-Video - 6 Pre filter - 5:4 Aperture Bandpass characteristics - 3:2 Coring range for high freq - 1:0 Aperture bandpass filter weights */ -/* 07 */ 0x00, /* 7:0 Hue */ -/* 08 */ 0x7f, /* 7:3 Colour-killer threshold QAM (PAL, NTSC) */ -/* 09 */ 0x7f, /* 7:3 Colour-killer threshold SECAM */ -/* 0a */ 0x7f, /* 7:0 PAL switch sensitivity */ -/* 0b */ 0x7f, /* 7:0 SECAM switch sensitivity */ -/* 0c */ 0x40, /* 7 Colour-on bit - 6:5 AGC filter */ -/* 0d */ 0x84, /* 7 VTR/TV mode bit = 1->VTR mode - 3 Realtime output mode select bit - 2 HREF position select - 1 Status byte select - 0 SECAM mode bit */ -/* 0e */ 0x38, /* 7 Horizontal clock PLL - 5 Select interal/external clock source - 4 Output enable of Horizontal/Vertical sync - 3 Data output YUV enable - 2 S-VHS bit - 1 GPSW2 - 0 GPSW1 */ -/* 0f */ 0x50, /* 7 Automatic Field detection - 6 Field Select 0 = 50hz, 1=60hz - 5 SECAM cross-colour reduction - 4 Enable sync and clamping pulse - 3:1 Luminance delay compensation */ -/* 10 */ 0x00, /* 2 Select HREF Position - 1:0 Vertical noise reduction */ -/* 11 */ 0x2c, /* 7:0 Chrominance gain conrtol for QAM */ -/* 12 */ 0x40, /* 7:0 Chrominance saturation control for VRAM port */ -/* 13 */ 0x40, /* 7:0 Luminance contract control for VRAM port */ -/* 14 */ 0x34, /* 7:0 Horizontal sync begin for 60hz */ -#ifdef notdef -/* 15 */ 0x0c, /* 7:0 Horizontal sync stop for 60hz */ -/* 16 */ 0xfb, /* 7:0 Horizontal clamp begin for 60hz */ -/* 17 */ 0xd4, /* 7:0 Horizontal clamp stop for 60hz */ -/* 18 */ 0xec, /* 7:0 Horizontal sync start after PH1 for 60hz */ -#else - 0x0a, 0xf4, 0xce, 0xf4, -#endif -/* 19 */ 0x80, /* 7:0 Luminance brightness control for VRAM port */ -/* 1a */ 0x00, -/* 1b */ 0x00, -/* 1c */ 0x00, -/* 1d */ 0x00, -/* 1e */ 0x00, -/* 1f */ 0x00, -/* 20 */ 0x90, /* 7 ROM table bypass switch - 6:5 Set output field mode - 4 VRAM port outputs enable - 3:2 First pixel position in VRO data - 1:0 FIFO output register select */ -/* 21 */ 0x80, /* 7:0 [7:0] Pixel number per line on output */ -/* 22 */ 0x80, /* 7:0 [7:0] Pixel number per line on input */ -/* 23 */ 0x03, /* 7:0 [7:0] Horizontal start position of scaling win*/ -/* 24 */ 0x8a, /* 7:5 Horizontal decimation filter - 4 [8] Horizontal start position of scaling win - 3:2 [9:8] Pixel number per line on input - 1:0 [9:8] Pixel number per line on output */ -/* 25 */ 0xf0, /* 7:0 [7:0] Line number per output field */ -/* 26 */ 0xf0, /* 7:0 [7:0] Line number per input field */ -/* 27 */ 0x0f, /* 7:0 [7:0] Vertical start of scaling window */ -/* 28 */ 0x80, /* 7 Adaptive filter switch - 6:5 Vertical luminance data processing - 4 [8] Vertical start of scaling window - 3:2 [9:8] Line number per input field - 1:0 [9:8] Line number per output field */ -/* 29 */ 0x16, /* 7:0 [7:0] Vertical bypass start */ -/* 2a */ 0x00, /* 7:0 [7:0] Vertical bypass count */ -/* 2b */ 0x00, /* 4 [8] Vertical bypass start - 2 [8] Vertical bypass count - 0 Polarity, internally detected odd even flag */ -/* 2c */ 0x80, /* 7:0 Set lower limit V for colour-keying */ -/* 2d */ 0x7f, /* 7:0 Set upper limit V for colour-keying */ -/* 2e */ 0x80, /* 7:0 Set lower limit U for colour-keying */ -/* 2f */ 0x7f, /* 7:0 Set upper limit U for colour-keying */ -/* 30 */ 0xbf /* 7 VRAM bus output format - 6 Adaptive geometrical filter - 5 Luminance limiting value - 4 Monochrome and two's complement output data sel - 3 Line quailifier flag - 2 Pixel qualifier flag - 1 Transparent data transfer - 0 Extended formats enable bit */ -}; - -static u_char bt254_default[NUM_BT254_REGS] = { - 0x00, /* 24 bpp */ - 0xa0, - 0xa0, - 0xa0, - 0x50, - 0x50, - 0x50, -} ; - -/* - * i2c_write: - * Returns 0 Succesful completion. - * Returns 1 If transfer aborted or timeout occured. - * - */ -static int i2c_print_err = 1; -static int -i2c_write(meteor_reg_t * mtr, u_char slave, u_char rw, u_char reg, u_char data) -{ -unsigned long wait_counter = 0x0001ffff; -mreg_t * iic_write_loc = &mtr->base->i2c_write; -int err = 0; - - - /* Write the data the the i2c write register */ - *iic_write_loc = SAA7116_IIC_NEW_CYCLE | - (((u_long)slave|(u_long)rw) << 16) | - ((u_long)reg << 8) | (u_long)data; - - /* Wait until the i2c cycle is compeleted */ - while((*iic_write_loc & SAA7116_IIC_NEW_CYCLE)) { - if(!wait_counter) break; - wait_counter--; - } - - /* 1ffff should be enough delay time for the i2c cycle to complete */ - if(!wait_counter) { - if(i2c_print_err) - kprintf("meteor%d: %d i2c %s transfer timeout 0x%x", - METEOR_NUM(mtr), slave, - rw ? "read" : "write", *iic_write_loc); - - err=1; - } - - /* Check for error on direct write, clear if any */ - if(mtr->base->i2c_read & SAA7116_IIC_DIRECT_TRANSFER_ABORTED){ - mtr->base->i2c_read |= SAA7116_IIC_DIRECT_TRANSFER_ABORTED; - if(i2c_print_err) - kprintf("meteor%d: 0x%x i2c %s transfer aborted", - METEOR_NUM(mtr), slave, - rw ? "read" : "write" ); - err= 1; - } - - if(err) { - if(i2c_print_err) - kprintf(" - reg=0x%x, value=0x%x.\n", reg, data); - } - - return err; -} -#undef i2c_print - -static const char * -met_probe (pcici_t tag, pcidi_t type) -{ - switch (type) { - case SAA7116_PHILIPS_ID: /* meteor */ - return("Philips SAA 7116"); - }; - return (NULL); -} - - /* interrupt handling routine - complete meteor_read() if using interrupts - */ -static void -meteor_intr(void *arg) -{ - meteor_reg_t *mtr = (meteor_reg_t *) arg; - mreg_t *cap = &mtr->base->cap_cntl, - *base = &mtr->base->dma1e, - *stat = &mtr->base->irq_stat; - u_long status = *stat, - cap_err = *cap & 0x00000f00, -#ifdef METEOR_CHECK_PCI_BUS - pci_err = pci_conf_read(mtr->tag, - PCI_COMMAND_STATUS_REG), -#endif - next_base = (u_long)(vtophys(mtr->bigbuf)); - - /* - * Disable future interrupts if a capture mode is not selected. - * This can happen when we are in the process of closing or - * changing capture modes, otherwise it shouldn't happen. - */ - if(!(mtr->flags & METEOR_CAP_MASK)) { - *cap &= 0x8ff0; /* disable future interrupts */ - } -#ifdef METEOR_CHECK_PCI_BUS - /* - * Check for pci bus errors. - */ -#define METEOR_MASTER_ABORT 0x20000000 -#define METEOR_TARGET_ABORT 0x10000000 - if(pci_err & METEOR_MASTER_ABORT) { - kprintf("meteor%d: intr: pci bus master dma abort: 0x%x 0x%x.\n", - METEOR_NUM(mtr), *base, *(base+3)); - pci_conf_write(mtr->tag, PCI_COMMAND_STATUS_REG, pci_err); - } - if(pci_err & METEOR_TARGET_ABORT) { - kprintf("meteor%d: intr: pci bus target dma abort: 0x%x 0x%x.\n", - METEOR_NUM(mtr), *base, *(base+3)); - pci_conf_write(mtr->tag, PCI_COMMAND_STATUS_REG, pci_err); - } -#endif - /* - * Check for errors. - */ - if (cap_err) { - if (cap_err & 0x300) { - if(mtr->fifo_errors % 50 == 0) { - kprintf("meteor%d: capture error", METEOR_NUM(mtr)); - kprintf(": %s FIFO overflow.\n", - cap_err&0x0100? "even" : "odd"); - } - mtr->fifo_errors++ ; /* increment fifo capture errors cnt */ - } - if (cap_err & 0xc00) { - if(mtr->dma_errors % 50 == 0) { - kprintf("meteor%d: capture error", METEOR_NUM(mtr)); - kprintf(": %s DMA address.\n", - cap_err&0x0400? "even" : "odd"); - } - mtr->dma_errors++ ; /* increment DMA capture errors cnt */ - } - } - *cap |= 0x0f30; /* clear error and field done */ - - /* - * In synchronous capture mode we need to know what the address - * offset for the next field/frame will be. next_base holds the - * value for the even dma buffers (for odd, one must add stride). - */ - if((mtr->flags & METEOR_SYNCAP) && !mtr->synch_wait && - (mtr->current < mtr->frames)) { /* could be !=, but < is safer */ - /* next_base is initialized to mtr->bigbuf */ - next_base += mtr->frame_size * mtr->current; - if(mtr->flags & METEOR_WANT_TS) - next_base += sizeof(struct timeval) * mtr->current; - } - - /* - * Count the field and clear the field flag. - * - * In single mode capture, clear the continuous capture mode. - * - * In synchronous capture mode, if we have room for another field, - * adjust DMA buffer pointers. - * When we are above the hi water mark (hiwat), mtr->synch_wait will - * be set and we will not bump the DMA buffer pointers. Thus, once - * we reach the hi water mark, the driver acts like a continuous mode - * capture on the mtr->current frame until we hit the low water - * mark (lowat). The user had the option of stopping or halting - * the capture if this is not the desired effect. - */ - if (status & 0x1) { /* even field */ - mtr->even_fields_captured++; - mtr->flags &= ~METEOR_WANT_EVEN; - if((mtr->flags & METEOR_SYNCAP) && !mtr->synch_wait) { - *base = next_base; - /* XXX should add adjustments for YUV_422 & PLANAR */ - } - /* - * If the user requested to be notified via signal, - * let them know the field is complete. - */ - if(mtr->proc && (mtr->signal & METEOR_SIG_MODE_MASK)) - ksignal(mtr->proc, mtr->signal&(~METEOR_SIG_MODE_MASK)); - } - if (status & 0x2) { /* odd field */ - mtr->odd_fields_captured++; - mtr->flags &= ~METEOR_WANT_ODD; - if((mtr->flags & METEOR_SYNCAP) && !mtr->synch_wait) { - *(base+3) = next_base + *(base+6); - /* XXX should add adjustments for YUV_422 & PLANAR */ - } - /* - * If the user requested to be notified via signal, - * let them know the field is complete. - */ - if(mtr->proc && (mtr->signal & METEOR_SIG_MODE_MASK)) - ksignal(mtr->proc, mtr->signal&(~METEOR_SIG_MODE_MASK)); - } - - /* - * If we have a complete frame. - */ - if(!(mtr->flags & METEOR_WANT_MASK)) { - mtr->frames_captured++; - /* - * post the completion time. - */ - if(mtr->flags & METEOR_WANT_TS) { - struct timeval *ts; - - if(mtr->alloc_pages * PAGE_SIZE <= (mtr->frame_size + - sizeof(struct timeval))) { - ts =(struct timeval *)mtr->bigbuf + - mtr->frame_size; - /* doesn't work in synch mode except for first frame */ - /* XXX */ - microtime(ts); - } - } - /* - * Wake up the user in single capture mode. - */ - if(mtr->flags & METEOR_SINGLE) - wakeup((caddr_t)mtr); - /* - * If the user requested to be notified via signal, - * let them know the frame is complete. - */ - if(mtr->proc && !(mtr->signal & METEOR_SIG_MODE_MASK)) - ksignal(mtr->proc, mtr->signal&(~METEOR_SIG_MODE_MASK)); - /* - * Reset the want flags if in continuous or - * synchronous capture mode. - */ - if(mtr->flags & (METEOR_CONTIN|METEOR_SYNCAP)) { - switch(mtr->flags & METEOR_ONLY_FIELDS_MASK) { - case METEOR_ONLY_ODD_FIELDS: - mtr->flags |= METEOR_WANT_ODD; - break; - case METEOR_ONLY_EVEN_FIELDS: - mtr->flags |= METEOR_WANT_EVEN; - break; - default: - mtr->flags |= METEOR_WANT_MASK; - break; - } - } - /* - * Special handling for synchronous capture mode. - */ - if(mtr->flags & METEOR_SYNCAP) { - struct meteor_mem *mm = mtr->mem; - /* - * Mark the current frame as active. It is up to - * the user to clear this, but we will clear it - * for the user for the current frame being captured - * if we are within the water marks (see below). - */ - mm->active |= 1 << (mtr->current - 1); - - /* - * Since the user can muck with these values, we need - * to check and see if they are sane. If they don't - * pass the sanity check, disable the capture mode. - * This is rather rude, but then so was the user. - * - * Do we really need all of this or should we just - * eliminate the possiblity of allowing the - * user to change hi and lo water marks while it - * is running? XXX - */ - if(mm->num_active_bufs < 0 || - mm->num_active_bufs > mtr->frames || - mm->lowat < 1 || mm->lowat >= mtr->frames || - mm->hiwat < 1 || mm->hiwat >= mtr->frames || - mm->lowat > mm->hiwat ) { - *cap &= 0x8ff0; - mtr->flags &= ~(METEOR_SYNCAP|METEOR_WANT_MASK); - } else { - /* - * Ok, they are sane, now we want to - * check the water marks. - */ - if(mm->num_active_bufs <= mm->lowat) - mtr->synch_wait = 0; - if(mm->num_active_bufs >= mm->hiwat) - mtr->synch_wait = 1; - /* - * Clear the active frame bit for this frame - * and advance the counters if we are within - * the banks of the water marks. - */ - if(!mtr->synch_wait) { - mm->active &= ~(1 << mtr->current); - mtr->current++; - if(mtr->current > mtr->frames) - mtr->current = 1; - mm->num_active_bufs++; - } - } - } - } - - *stat |= 0x7; /* clear interrupt status */ - return; -} - -static void -set_fps(meteor_reg_t *mtr, u_short fps) -{ - struct saa7116_regs *s7116 = mtr->base; - unsigned status; - unsigned maxfps, mask = 0x1, length = 0; - - SAA7196_WRITE(mtr, SAA7196_STDC, SAA7196_REG(mtr, SAA7196_STDC) | 0x02); - SAA7196_READ(mtr); - status = (s7116->i2c_read & 0xff000000L) >> 24; - - /* - * Determine if there is an input signal. Depending on the - * frequency we either have a max of 25 fps (50 hz) or 30 fps (60 hz). - * If there is no input signal, then we need some defaults. If the - * user neglected to specify any defaults, just set to the fps to max. - */ - if((status & 0x40) == 0) { /* Is there a signal ? */ - if(status & 0x20) { - maxfps = 30; /* 60 hz system */ - } else { - maxfps = 25; /* 50 hz system */ - } - } else { /* We have no signal, check defaults */ -#if METEOR_SYSTEM_DEFAULT == METEOR_PAL || METEOR_SYSTEM_DEFAULT == METEOR_SECAM - maxfps = 25; -#elif METEOR_SYSTEM_DEFAULT == METEOR_NTSC - maxfps = 30; -#else - /* Don't really know what to do, just set max */ - maxfps = 30; - fps = 30; -#endif - } - - /* - * A little sanity checking... - */ - if(fps < 1) fps = 1; - if(fps > maxfps) fps = maxfps; - - /* - * Compute the mask/length using the fps. - */ - if(fps == maxfps) { - mask = 0x1; - length = 0x0; - } else if ((float)fps == maxfps/2.0) { - mask = 0x1; - length = 0x1; - } else if (fps > maxfps/2) { - float step, b; - - mask = (1<fme = s7116->fmo = mask; - s7116->fml = (length << 16) | length; - - mtr->fps = fps; - - return; - -} - -/* - * There is also a problem with range checking on the 7116. - * It seems to only work for 22 bits, so the max size we can allocate - * is 22 bits long or 4194304 bytes assuming that we put the beginning - * of the buffer on a 2^24 bit boundary. The range registers will use - * the top 8 bits of the dma start registers along with the bottom 22 - * bits of the range register to determine if we go out of range. - * This makes getting memory a real kludge. - * - */ -#define RANGE_BOUNDARY (1<<22) -static vm_offset_t -get_meteor_mem(int unit, unsigned size) -{ -vm_offset_t addr = 0; - - addr = vm_page_alloc_contig(size, 0, 0xffffffff, 1<<24); - if(addr == 0) - addr = vm_page_alloc_contig(size, 0, 0xffffffff, PAGE_SIZE); - if(addr == 0) { - kprintf("meteor%d: Unable to allocate %d bytes of memory.\n", - unit, size); - } - - return addr; -} - -static void -bt254_write(meteor_reg_t *mtr, u_char addr, u_char data) -{ - addr &= 0x7; /* sanity? */ - mtr->bt254_reg[addr] = data; - PCF8574_DATA_WRITE(mtr, data); /* set data */ - PCF8574_CTRL_WRITE(mtr, (PCF8574_CTRL_REG(mtr) & ~0x7) | addr); - PCF8574_CTRL_WRITE(mtr, PCF8574_CTRL_REG(mtr) & ~0x10); /* WR/ to 0 */ - PCF8574_CTRL_WRITE(mtr, PCF8574_CTRL_REG(mtr) | 0x10); /* WR to 1 */ - PCF8574_DATA_WRITE(mtr, 0xff); /* clr data */ - -} - -static void -bt254_init(meteor_reg_t *mtr) -{ -int i; - - PCF8574_CTRL_WRITE(mtr, 0x7f); - PCF8574_DATA_WRITE(mtr, 0xff); /* data port must be 0xff */ - PCF8574_CTRL_WRITE(mtr, 0x7f); - - /* init RGB module for 24bpp, composite input */ - for(i=0; ibase->cap_cntl = 0x00000040L; - vbase_addr = &mtr->base->dma1e; - for (i = 0 ; i < (sizeof(struct saa7116_regs)/sizeof(mreg_t)); i++) - *vbase_addr++ = saa7116_pci_default[i]; - - /* - * Check for the Philips SAA7196 - */ - i2c_print_err = 0; - if(i2c_write(mtr, SAA7196_I2C_ADDR, SAA7116_I2C_WRITE, 0, 0xff) == 0) { - i2c_print_err = 1; - /* - * Initialize 7196 - */ - for (i = 0; i < NUM_SAA7196_I2C_REGS; i++) - SAA7196_WRITE(mtr, i, saa7196_i2c_default[i]); - /* - * Get version number. - */ - SAA7196_WRITE(mtr, SAA7196_STDC, - SAA7196_REG(mtr, SAA7196_STDC) & ~0x02); - SAA7196_READ(mtr); - kprintf("meteor%d: rev 0x%x\n", - METEOR_NUM(mtr), - (unsigned)((mtr->base->i2c_read & 0xff000000L) >> 28)); - } else { - i2c_print_err = 1; - kprintf("meteor%d: \n", - METEOR_NUM(mtr)); - } - /* - * Check for RGB module, initialized if found. - */ - i2c_print_err = 0; - if(i2c_write(mtr,PCF8574_DATA_I2C_ADDR,SAA7116_I2C_WRITE,0,0xff) == 0) { - i2c_print_err = 1; - kprintf("meteor%d: \n", - METEOR_NUM(mtr)); /* does this have a rev #? */ - bt254_init(mtr); /* Set up RGB module */ - mtr->flags = METEOR_RGB; - } else { - i2c_print_err = 1; - mtr->flags = 0; - } - - set_fps(mtr, 30); - -} - -static void -met_attach(pcici_t tag, int unit) -{ -#ifdef METEOR_IRQ - u_long old_irq, new_irq; -#endif /* METEOR_IRQ */ - meteor_reg_t *mtr; - vm_offset_t buf; - u_long latency; - - if (unit >= NMETEOR) { - kprintf("meteor%d: attach: only %d units configured.\n", - unit, NMETEOR); - kprintf("meteor%d: attach: invalid unit number.\n", unit); - return ; - } - - /* - * Check for Meteor/PPB (PCI-PCI Bridge) - * Reprogram IBM Bridge if detected. - * New Meteor cards have an IBM PCI-PCI bridge, creating a secondary - * PCI bus. The SAA chip is connected to this secondary bus. - */ - - /* If we are not on PCI Bus 0, check for the Bridge */ - if ( pci_get_bus_from_tag( tag ) != 0) { - pcici_t bridge_tag; - - /* get tag of parent bridge */ - bridge_tag = pci_get_parent_from_tag( tag ); - - /* Look for IBM 82351, 82352 or 82353 */ - if (pci_conf_read(bridge_tag, PCI_ID_REG) == 0x00221014) { - - if ( bootverbose) - kprintf("meteor%d: PPB device detected, reprogramming IBM bridge.\n", unit); - - /* disable SERR */ - pci_cfgwrite(bridge_tag, 0x05, 0x00, 1); - /* set LATENCY */ - pci_cfgwrite(bridge_tag, 0x0d, 0x20, 1); - /* write posting enable, prefetch enabled --> GRAB direction */ - pci_cfgwrite(bridge_tag, 0x42, 0x14, 1); - /* set PRTR Primary retry timer register */ - pci_cfgwrite(bridge_tag, 0x4c, 0x10, 1); - } - } - - mtr = &meteor[unit]; - mtr->tag = tag; - pci_map_mem(tag, PCI_MAP_REG_START, (vm_offset_t *)&mtr->base, - &mtr->phys_base); - -#ifdef METEOR_IRQ /* from the configuration file */ - old_irq = pci_conf_read(tag, PCI_INTERRUPT_REG); - pci_conf_write(tag, PCI_INTERRUPT_REG, METEOR_IRQ); - new_irq = pci_conf_read(tag, PCI_INTERRUPT_REG); - kprintf("meteor%d: attach: irq changed from %d to %d\n", - unit, (old_irq & 0xff), (new_irq & 0xff)); -#endif /* METEOR_IRQ */ - /* setup the interrupt handling routine */ - pci_map_int(tag, meteor_intr, (void*) mtr); - -/* - * PCI latency timer. 32 is a good value for 4 bus mastering slots, if - * you have more than for, then 16 would probably be a better value. - * - */ -#ifndef METEOR_DEF_LATENCY_VALUE -#define METEOR_DEF_LATENCY_VALUE 32 -#endif - latency = pci_conf_read(tag, PCI_LATENCY_TIMER); - latency = (latency >> 8) & 0xff; - if(bootverbose) { - if(latency) - kprintf("meteor%d: PCI bus latency is", unit); - else - kprintf("meteor%d: PCI bus latency was 0 changing to", - unit); - } - if(!latency) { - latency = METEOR_DEF_LATENCY_VALUE; - pci_conf_write(tag, PCI_LATENCY_TIMER, latency<<8); - } - if(bootverbose) { - kprintf(" %lu.\n", latency); - } - - meteor_init(mtr); /* set up saa7116, saa7196, and rgb module */ - - if(METEOR_ALLOC) - buf = get_meteor_mem(unit, METEOR_ALLOC); - else - buf = 0; - if(bootverbose) { - kprintf("meteor%d: buffer size %d, addr 0x%llx\n", - unit, METEOR_ALLOC, vtophys(buf)); - } - - mtr->bigbuf = buf; - mtr->alloc_pages = METEOR_ALLOC_PAGES; - if(buf != 0) { - bzero((caddr_t) buf, METEOR_ALLOC); - buf = vtophys(buf); - /* 640x480 RGB 16 */ - mtr->base->dma1e = buf; - mtr->base->dma1o = buf + 0x500; - mtr->base->dma_end_e = - mtr->base->dma_end_o = buf + METEOR_ALLOC; - } - /* 1 frame of 640x480 RGB 16 */ - mtr->cols = 640; - mtr->rows = 480; - mtr->depth = 2; /* two bytes per pixel */ - mtr->frames = 1; /* one frame */ - - mtr->flags |= METEOR_INITALIZED | METEOR_AUTOMODE | METEOR_DEV0 | - METEOR_RGB16; - make_dev(&meteor_ops, unit, 0, 0, 0644, "meteor"); -} - -#define UNIT(x) ((x) & 0x07) - -#ifdef unused -static int -meteor_reset(cdev_t dev) -{ -int unit = UNIT(minor(dev)); -struct saa7116_regs *m; - - if(unit >= NMETEOR) - return ENXIO; - - m = meteor[unit].base; - - m->cap_cntl = 0x0; - tsleep((caddr_t)m, METPRI, "Mreset", hz/50); - - m->cap_cntl = 0x8ff0; - m->cap_cntl = 0x80c0; - m->cap_cntl = 0x8040; - tsleep((caddr_t)m, METPRI, "Mreset", hz/10); - m->cap_cntl = 0x80c0; - - return 0; - -} -#endif - -/*--------------------------------------------------------- -** -** Meteor character device driver routines -** -**--------------------------------------------------------- -*/ - -int -meteor_open(struct dev_open_args *ap) -{ - cdev_t dev = ap->a_head.a_dev; - meteor_reg_t *mtr; - int unit; - int i; - - unit = UNIT(minor(dev)); - if (unit >= NMETEOR) /* unit out of range */ - return(ENXIO); - - mtr = &(meteor[unit]); - - if (!(mtr->flags & METEOR_INITALIZED)) /* device not found */ - return(ENXIO); - - if (mtr->flags & METEOR_OPEN) /* device is busy */ - return(EBUSY); - - mtr->flags |= METEOR_OPEN; - /* - * Make sure that the i2c regs are set the same for each open. - */ - for(i=0; i< NUM_SAA7196_I2C_REGS; i++) { - SAA7196_WRITE(mtr, i, saa7196_i2c_default[i]); - } - - mtr->fifo_errors = 0; - mtr->dma_errors = 0; - mtr->frames_captured = 0; - mtr->even_fields_captured = 0; - mtr->odd_fields_captured = 0; - mtr->proc = NULL; - set_fps(mtr, 30); -#ifdef METEOR_TEST_VIDEO - mtr->video.addr = 0; - mtr->video.width = 0; - mtr->video.banksize = 0; - mtr->video.ramsize = 0; -#endif - - return(0); -} - -int -meteor_close(struct dev_close_args *ap) -{ - cdev_t dev = ap->a_head.a_dev; - meteor_reg_t *mtr; - int unit; -#ifdef METEOR_DEALLOC_ABOVE - int temp; -#endif - - unit = UNIT(minor(dev)); - if (unit >= NMETEOR) /* unit out of range */ - return(ENXIO); - - mtr = &(meteor[unit]); - mtr->flags &= ~METEOR_OPEN; - - if(mtr->flags & METEOR_SINGLE) - /* this should not happen, the read capture - should have completed or in the very least - recieved a signal before close is called. */ - wakeup((caddr_t)mtr); /* continue read */ - /* - * Turn off capture mode. - */ - mtr->base->cap_cntl = 0x8ff0; - mtr->flags &= ~(METEOR_CAP_MASK|METEOR_WANT_MASK); - mtr->proc = NULL; - -#ifdef METEOR_DEALLOC_PAGES - if (mtr->bigbuf != NULL) { - kmem_free(&kernel_map, mtr->bigbuf, - (mtr->alloc_pages * PAGE_SIZE)); - mtr->bigbuf = NULL; - mtr->alloc_pages = 0; - } -#else -#ifdef METEOR_DEALLOC_ABOVE - if (mtr->bigbuf != NULL && mtr->alloc_pages > METEOR_DEALLOC_ABOVE) { - temp = METEOR_DEALLOC_ABOVE - mtr->alloc_pages; - kmem_free(&kernel_map, - mtr->bigbuf+((mtr->alloc_pages - temp) * PAGE_SIZE), - (temp * PAGE_SIZE)); - mtr->alloc_pages = METEOR_DEALLOC_ABOVE; - } -#endif -#endif - - return(0); -} - -static void -start_capture(meteor_reg_t *mtr, unsigned type) -{ -mreg_t *cap = &mtr->base->cap_cntl; - - mtr->flags |= type; - switch(mtr->flags & METEOR_ONLY_FIELDS_MASK) { - case METEOR_ONLY_EVEN_FIELDS: - mtr->flags |= METEOR_WANT_EVEN; - if(type == METEOR_SINGLE) - *cap = 0x0ff4 | mtr->range_enable; - else - *cap = 0x0ff1 | mtr->range_enable; - break; - case METEOR_ONLY_ODD_FIELDS: - mtr->flags |= METEOR_WANT_ODD; - if(type == METEOR_SINGLE) - *cap = 0x0ff8 | mtr->range_enable; - else - *cap = 0x0ff2 | mtr->range_enable; - break; - default: - mtr->flags |= METEOR_WANT_MASK; - if(type == METEOR_SINGLE) - *cap = 0x0ffc | mtr->range_enable; - else - *cap = 0x0ff3 | mtr->range_enable; - break; - } -} - -int -meteor_read(struct dev_read_args *ap) -{ - cdev_t dev = ap->a_head.a_dev; - struct uio *uio = ap->a_uio; - meteor_reg_t *mtr; - int unit; - int status; - int count; - - unit = UNIT(minor(dev)); - if (unit >= NMETEOR) /* unit out of range */ - return(ENXIO); - - mtr = &(meteor[unit]); - if (mtr->bigbuf == 0)/* no frame buffer allocated (ioctl failed) */ - return(ENOMEM); - - if (mtr->flags & METEOR_CAP_MASK) - return(EIO); /* already capturing */ - - count = mtr->rows * mtr->cols * mtr->depth; - if (uio->uio_iov->iov_len < count) - return(EINVAL); - - /* Start capture */ - start_capture(mtr, METEOR_SINGLE); - - status=tsleep((caddr_t)mtr, METPRI, "capturing", 0); - if (!status) /* successful capture */ - status = uiomove((caddr_t)mtr->bigbuf, count, uio); - else - kprintf ("meteor%d: read: tsleep error %d\n", unit, status); - - mtr->flags &= ~(METEOR_SINGLE | METEOR_WANT_MASK); - - return(status); -} - -int -meteor_write(struct dev_write_args *ap) -{ - return(0); -} - -int -meteor_ioctl(struct dev_ioctl_args *ap) -{ - cdev_t dev = ap->a_head.a_dev; - caddr_t data = ap->a_data; - int error; - int unit; - unsigned int temp; - meteor_reg_t *mtr; - struct meteor_counts *cnt; - struct meteor_geomet *geo; - struct meteor_mem *mem; - struct meteor_capframe *frame; -#ifdef METEOR_TEST_VIDEO - struct meteor_video *video; -#endif - vm_offset_t buf; - struct saa7116_regs *base; - - error = 0; - - if (data == NULL) - return(EINVAL); - unit = UNIT(minor(dev)); - if (unit >= NMETEOR) /* unit out of range */ - return(ENXIO); - - mtr = &(meteor[unit]); - base = mtr->base; - - switch (ap->a_cmd) { - case METEORSTS: - if(*data) - mtr->flags |= METEOR_WANT_TS; - else - mtr->flags &= ~METEOR_WANT_TS; - break; - case METEORGTS: - if(mtr->flags & METEOR_WANT_TS) - *data = 1; - else - *data = 0; - break; -#ifdef METEOR_TEST_VIDEO - case METEORGVIDEO: - video = (struct meteor_video *)data; - video->addr = mtr->video.addr; - video->width = mtr->video.width; - video->banksize = mtr->video.banksize; - video->ramsize = mtr->video.ramsize; - break; - case METEORSVIDEO: - video = (struct meteor_video *)data; - mtr->video.addr = video->addr; - mtr->video.width = video->width; - mtr->video.banksize = video->banksize; - mtr->video.ramsize = video->ramsize; - break; -#endif - case METEORSFPS: - set_fps(mtr, *(u_short *)data); - break; - case METEORGFPS: - *(u_short *)data = mtr->fps; - break; - case METEORSSIGNAL: - if (*(int *)data < 0 || *(int *)data > _SIG_MAXSIG) - return EINVAL; - mtr->signal = *(int *) data; - if (mtr->signal) { - mtr->proc = curproc; /* might be NULL */ - } else { - mtr->proc = NULL; - } - break; - case METEORGSIGNAL: - *(int *)data = mtr->signal; - break; - case METEORSTATUS: /* get 7196 status */ - temp = 0; - SAA7196_WRITE(mtr, SAA7196_STDC, - SAA7196_REG(mtr, SAA7196_STDC) | 0x02); - SAA7196_READ(mtr); - temp |= (base->i2c_read & 0xff000000L) >> 24; - SAA7196_WRITE(mtr, SAA7196_STDC, - SAA7196_REG(mtr, SAA7196_STDC) & ~0x02); - SAA7196_READ(mtr); - temp |= (base->i2c_read & 0xff000000L) >> 16; - *(u_short *)data = temp; - break; - case METEORSHUE: /* set hue */ - SAA7196_WRITE(mtr, SAA7196_HUEC, *(char *)data); - break; - case METEORGHUE: /* get hue */ - *(char *)data = SAA7196_REG(mtr, SAA7196_HUEC); - break; - case METEORSCHCV: /* set chrominance gain */ - SAA7196_WRITE(mtr, SAA7196_CGAINR, *(char *)data); - break; - case METEORGCHCV: /* get chrominance gain */ - *(char *)data = SAA7196_REG(mtr, SAA7196_CGAINR); - break; - case METEORSBRIG: /* set brightness */ - SAA7196_WRITE(mtr, SAA7196_BRIG, *(char *)data); - break; - case METEORGBRIG: /* get brightness */ - *(char *)data = SAA7196_REG(mtr, SAA7196_BRIG); - break; - case METEORSCSAT: /* set chroma saturation */ - SAA7196_WRITE(mtr, SAA7196_CSAT, *(char *)data); - break; - case METEORGCSAT: /* get chroma saturation */ - *(char *)data = SAA7196_REG(mtr, SAA7196_CSAT); - break; - case METEORSCONT: /* set contrast */ - SAA7196_WRITE(mtr, SAA7196_CONT, *(char *)data); - break; - case METEORGCONT: /* get contrast */ - *(char *)data = SAA7196_REG(mtr, SAA7196_CONT); - break; - case METEORSBT254: - if((mtr->flags & METEOR_RGB) == 0) - return EINVAL; - temp = *(unsigned short *)data; - bt254_write(mtr, temp & 0xf, (temp & 0x0ff0) >> 4); - break; - case METEORGBT254: - if((mtr->flags & METEOR_RGB) == 0) - return EINVAL; - temp = *(unsigned short *)data & 0x7; - *(unsigned short *)data = mtr->bt254_reg[temp] << 4 | temp; - break; - case METEORSHWS: /* set horizontal window start */ - SAA7196_WRITE(mtr, SAA7196_HWS, *(char *)data); - break; - case METEORGHWS: /* get horizontal window start */ - *(char *)data = SAA7196_REG(mtr, SAA7196_HWS); - break; - case METEORSVWS: /* set vertical window start */ - SAA7196_WRITE(mtr, SAA7196_VWS, *(char *)data); - break; - case METEORGVWS: /* get vertical window start */ - *(char *)data = SAA7196_REG(mtr, SAA7196_VWS); - break; - case METEORSINPUT: /* set input device */ - switch(*(unsigned long *)data & METEOR_DEV_MASK) { - case 0: /* default */ - case METEOR_INPUT_DEV0: - if(mtr->flags & METEOR_RGB) - select_saa7196(mtr); - mtr->flags = (mtr->flags & ~METEOR_DEV_MASK) - | METEOR_DEV0; - SAA7196_WRITE(mtr, 0x0e, - (SAA7196_REG(mtr, 0x0e) & ~0x3) | 0x0); - SAA7196_WRITE(mtr, 0x06, - (SAA7196_REG(mtr, 0x06) & ~0x80)); - break; - case METEOR_INPUT_DEV1: - if(mtr->flags & METEOR_RGB) - select_saa7196(mtr); - mtr->flags = (mtr->flags & ~METEOR_DEV_MASK) - | METEOR_DEV1; - SAA7196_WRITE(mtr, 0x0e, - (SAA7196_REG(mtr, 0x0e) & ~0x3) | 0x1); - SAA7196_WRITE(mtr, 0x06, - (SAA7196_REG(mtr, 0x06) & ~0x80)); - break; - case METEOR_INPUT_DEV2: - if(mtr->flags & METEOR_RGB) - select_saa7196(mtr); - mtr->flags = (mtr->flags & ~METEOR_DEV_MASK) - | METEOR_DEV2; - SAA7196_WRITE(mtr, 0x0e, - (SAA7196_REG(mtr, 0x0e) & ~0x3) | 0x2); - SAA7196_WRITE(mtr, 0x06, - (SAA7196_REG(mtr, 0x06) & ~0x80)); - break; - case METEOR_INPUT_DEV3: - if(mtr->flags & METEOR_RGB) - select_saa7196(mtr); - mtr->flags = (mtr->flags & ~METEOR_DEV_MASK) - | METEOR_DEV3; - SAA7196_WRITE(mtr, 0x0e, - (SAA7196_REG(mtr, 0x0e) | 0x3)); - SAA7196_WRITE(mtr, 0x06, - (SAA7196_REG(mtr, 0x06) & ~0x80) ); - break; - case METEOR_INPUT_DEV_SVIDEO: - if(mtr->flags & METEOR_RGB) - select_saa7196(mtr); - mtr->flags = (mtr->flags & ~METEOR_DEV_MASK) - | METEOR_DEV_SVIDEO; - SAA7196_WRITE(mtr, 0x0e, - (SAA7196_REG(mtr, 0x0e) & ~0x3) | 0x2); - SAA7196_WRITE(mtr, 0x06, - (SAA7196_REG(mtr, 0x06) & ~0x80) | 0x80); - break; - case METEOR_INPUT_DEV_RGB: - if((mtr->flags & METEOR_RGB) == 0) - return EINVAL; - mtr->flags = (mtr->flags & ~METEOR_DEV_MASK) - | METEOR_DEV_RGB; - SAA7196_WRITE(mtr, 0x0e, - (SAA7196_REG(mtr, 0x0e) & ~0x3) | 0x3); - SAA7196_WRITE(mtr, 0x06, - (SAA7196_REG(mtr, 0x06) & ~0x80)); - select_bt254(mtr); - SAA7196_WRITE(mtr, 0x0e, /* chn 3 for synch */ - (SAA7196_REG(mtr, 0x0e) & ~0x3) | 0x3); - break; - default: - return EINVAL; - } - break; - case METEORGINPUT: /* get input device */ - *(u_long *)data = mtr->flags & METEOR_DEV_MASK; - break; - case METEORSFMT: /* set input format */ - switch(*(unsigned long *)data & METEOR_FORM_MASK ) { - case 0: /* default */ - case METEOR_FMT_NTSC: - mtr->flags = (mtr->flags & ~METEOR_FORM_MASK) | - METEOR_NTSC; - SAA7196_WRITE(mtr, SAA7196_STDC, - (SAA7196_REG(mtr, SAA7196_STDC) & ~0x01)); - SAA7196_WRITE(mtr, 0x0f, - (SAA7196_REG(mtr, 0x0f) & ~0xe0) | 0x40); - SAA7196_WRITE(mtr, 0x22, 0x80); - SAA7196_WRITE(mtr, 0x24, - (SAA7196_REG(mtr, 0x24) & ~0x0c) | 0x08); - SAA7196_WRITE(mtr, 0x26, 0xf0); - SAA7196_WRITE(mtr, 0x28, - (SAA7196_REG(mtr, 0x28) & ~0x0c)) ; - if(mtr->flags & METEOR_RGB){ - bt254_ntsc(mtr, 1); - } - break; - case METEOR_FMT_PAL: - mtr->flags = (mtr->flags & ~METEOR_FORM_MASK) | - METEOR_PAL; - SAA7196_WRITE(mtr, SAA7196_STDC, - (SAA7196_REG(mtr, SAA7196_STDC) & ~0x01)); - SAA7196_WRITE(mtr, 0x0f, - (SAA7196_REG(mtr, 0x0f) & ~0xe0)); - SAA7196_WRITE(mtr, 0x22, 0x00); - SAA7196_WRITE(mtr, 0x24, - (SAA7196_REG(mtr, 0x24) | 0x0c)); - SAA7196_WRITE(mtr, 0x26, 0x20); - SAA7196_WRITE(mtr, 0x28, - (SAA7196_REG(mtr, 0x28) & ~0x0c) | 0x04) ; - if(mtr->flags & METEOR_RGB){ - bt254_ntsc(mtr, 0); - } - break; - case METEOR_FMT_SECAM: - mtr->flags = (mtr->flags & ~METEOR_FORM_MASK) | - METEOR_SECAM; - SAA7196_WRITE(mtr, SAA7196_STDC, - (SAA7196_REG(mtr, SAA7196_STDC) & ~0x01) | 0x1); - SAA7196_WRITE(mtr, 0x0f, - (SAA7196_REG(mtr, 0x0f) & ~0xe0) | 0x20); - SAA7196_WRITE(mtr, 0x22, 0x00); - SAA7196_WRITE(mtr, 0x24, - (SAA7196_REG(mtr, 0x24) | 0x0c)); - SAA7196_WRITE(mtr, 0x26, 0x20); - SAA7196_WRITE(mtr, 0x28, - (SAA7196_REG(mtr, 0x28) & ~0x0c) | 0x04) ; - if(mtr->flags & METEOR_RGB){ - bt254_ntsc(mtr, 0); - } - break; - case METEOR_FMT_AUTOMODE: - mtr->flags = (mtr->flags & ~METEOR_FORM_MASK) | - METEOR_AUTOMODE; - SAA7196_WRITE(mtr, SAA7196_STDC, - (SAA7196_REG(mtr, SAA7196_STDC) & ~0x01)); - SAA7196_WRITE(mtr, 0x0f, - (SAA7196_REG(mtr, 0x0f) & ~0xe0) | 0x80); - break; - default: - return EINVAL; - } - break; - case METEORGFMT: /* get input format */ - *(u_long *)data = mtr->flags & METEOR_FORM_MASK; - break; - case METEORCAPTUR: - temp = mtr->flags; - switch (*(int *) data) { - case METEOR_CAP_SINGLE: - if (mtr->bigbuf==0) /* no frame buffer allocated */ - return(ENOMEM); - - if (temp & METEOR_CAP_MASK) - return(EIO); /* already capturing */ - - start_capture(mtr, METEOR_SINGLE); - - /* wait for capture to complete */ - error=tsleep((caddr_t)mtr, METPRI, "capturing", 0); - if(error) - kprintf("meteor%d: ioctl: tsleep error %d\n", - unit, error); - mtr->flags &= ~(METEOR_SINGLE|METEOR_WANT_MASK); - break; - case METEOR_CAP_CONTINOUS: - if (mtr->bigbuf==0) /* no frame buffer allocated */ - return(ENOMEM); - - if (temp & METEOR_CAP_MASK) - return(EIO); /* already capturing */ - - start_capture(mtr, METEOR_CONTIN); - - break; - case METEOR_CAP_STOP_CONT: - if (mtr->flags & METEOR_CONTIN) { - /* turn off capture */ - base->cap_cntl = 0x8ff0; - mtr->flags &= ~(METEOR_CONTIN|METEOR_WANT_MASK); - } - break; - - default: - error = EINVAL; - break; - } - break; - case METEORCAPFRM: - frame = (struct meteor_capframe *) data; - if (!frame) - return(EINVAL); - switch (frame->command) { - case METEOR_CAP_N_FRAMES: - if (mtr->flags & METEOR_CAP_MASK) - return(EIO); - if (mtr->flags & (METEOR_YUV_PLANAR | METEOR_YUV_422)) /* XXX */ - return(EINVAL); /* should fix intr so we allow these */ - if (mtr->bigbuf == 0) - return(ENOMEM); - if ((mtr->frames < 2) || - (frame->lowat < 1 || frame->lowat >= mtr->frames) || - (frame->hiwat < 1 || frame->hiwat >= mtr->frames) || - (frame->lowat > frame->hiwat)) - return(EINVAL); - /* meteor_mem structure is on the page after the data */ - mem = mtr->mem = (struct meteor_mem *) (mtr->bigbuf + - (round_page(mtr->frame_size * mtr->frames))); - mtr->current = 1; - mtr->synch_wait = 0; - mem->num_bufs = mtr->frames; - mem->frame_size= mtr->frame_size; - /* user and kernel change these */ - mem->lowat = frame->lowat; - mem->hiwat = frame->hiwat; - mem->active = 0; - mem->num_active_bufs = 0; - /* Start capture */ - start_capture(mtr, METEOR_SYNCAP); - break; - case METEOR_CAP_STOP_FRAMES: - if (mtr->flags & METEOR_SYNCAP) { - /* turn off capture */ - base->cap_cntl = 0x8ff0; - mtr->flags &= ~(METEOR_SYNCAP|METEOR_WANT_MASK); - } - break; - case METEOR_HALT_N_FRAMES: - if(mtr->flags & METEOR_SYNCAP) { - base->cap_cntl = 0x8ff0; - mtr->flags &= ~(METEOR_WANT_MASK); - } - break; - case METEOR_CONT_N_FRAMES: - if(!(mtr->flags & METEOR_SYNCAP)) { - error = EINVAL; - break; - } - start_capture(mtr, METEOR_SYNCAP); - break; - default: - error = EINVAL; - break; - } - break; - - case METEORSETGEO: - geo = (struct meteor_geomet *) data; - - /* Either even or odd, if even & odd, then these a zero */ - if((geo->oformat & METEOR_GEO_ODD_ONLY) && - (geo->oformat & METEOR_GEO_EVEN_ONLY)) { - kprintf("meteor%d: ioctl: Geometry odd or even only.\n", - unit); - return EINVAL; - } - /* set/clear even/odd flags */ - if(geo->oformat & METEOR_GEO_ODD_ONLY) - mtr->flags |= METEOR_ONLY_ODD_FIELDS; - else - mtr->flags &= ~METEOR_ONLY_ODD_FIELDS; - if(geo->oformat & METEOR_GEO_EVEN_ONLY) - mtr->flags |= METEOR_ONLY_EVEN_FIELDS; - else - mtr->flags &= ~METEOR_ONLY_EVEN_FIELDS; - - /* can't change parameters while capturing */ - if (mtr->flags & METEOR_CAP_MASK) - return(EBUSY); - - if ((geo->columns & 0x3fe) != geo->columns) { - kprintf( - "meteor%d: ioctl: %d: columns too large or not even.\n", - unit, geo->columns); - error = EINVAL; - } - if (((geo->rows & 0x7fe) != geo->rows) || - ((geo->oformat & METEOR_GEO_FIELD_MASK) && - ((geo->rows & 0x3fe) != geo->rows)) ) { - kprintf( - "meteor%d: ioctl: %d: rows too large or not even.\n", - unit, geo->rows); - error = EINVAL; - } - if (geo->frames > 32) { - kprintf("meteor%d: ioctl: too many frames.\n", unit); - error = EINVAL; - } - if(error) return error; - - if ((temp=geo->rows * geo->columns * geo->frames * 2) != 0) { - if (geo->oformat & METEOR_GEO_RGB24) temp = temp * 2; - - /* meteor_mem structure for SYNC Capture */ - if (geo->frames > 1) temp += PAGE_SIZE; - - temp = btoc(temp); - if (temp > mtr->alloc_pages -#ifdef METEOR_TEST_VIDEO - && mtr->video.addr == 0 -#endif - ) { - buf = get_meteor_mem(unit, temp*PAGE_SIZE); - if(buf != 0) { - kmem_free(&kernel_map, mtr->bigbuf, - (mtr->alloc_pages * PAGE_SIZE)); - mtr->bigbuf = buf; - mtr->alloc_pages = temp; - if(bootverbose) - kprintf( - "meteor%d: ioctl: Allocating %d bytes\n", - unit, temp*PAGE_SIZE); - } else { - error = ENOMEM; - } - } - } - if(error) return error; - - mtr->rows = geo->rows; - mtr->cols = geo->columns; - mtr->frames = geo->frames; - -#ifdef METEOR_TEST_VIDEO - if(mtr->video.addr) - buf = vtophys(mtr->video.addr); - else -#endif - buf = vtophys(mtr->bigbuf); - - /* set defaults and end of buffer locations */ - base->dma1e = buf; - base->dma2e = buf; - base->dma3e = buf; - base->dma1o = buf; - base->dma2o = buf; - base->dma3o = buf; - base->stride1e = 0; - base->stride2e = 0; - base->stride3e = 0; - base->stride1o = 0; - base->stride2o = 0; - base->stride3o = 0; - /* set end of DMA location, even/odd */ - base->dma_end_e = - base->dma_end_o = buf + mtr->alloc_pages * PAGE_SIZE; - - /* - * Determine if we can use the hardware range detect. - */ - if(mtr->alloc_pages * PAGE_SIZE < RANGE_BOUNDARY && - ((buf & 0xff000000) | base->dma_end_e) == - (buf + mtr->alloc_pages * PAGE_SIZE) ) - mtr->range_enable = 0x8000; - else { - mtr->range_enable = 0x0; - base->dma_end_e = - base->dma_end_o = 0xffffffff; - } - - - switch (geo->oformat & METEOR_GEO_OUTPUT_MASK) { - case 0: /* default */ - case METEOR_GEO_RGB16: - mtr->depth = 2; - mtr->frame_size = mtr->rows * mtr->cols * mtr->depth; - mtr->flags &= ~METEOR_OUTPUT_FMT_MASK; - mtr->flags |= METEOR_RGB16; - temp = mtr->cols * mtr->depth; - /* recal stride and starting point */ - switch(mtr->flags & METEOR_ONLY_FIELDS_MASK) { - case METEOR_ONLY_ODD_FIELDS: - base->dma1o = buf; -#ifdef METEOR_TEST_VIDEO - if(mtr->video.addr && mtr->video.width) - base->stride1o = mtr->video.width-temp; -#endif - SAA7196_WRITE(mtr, 0x20, 0xd0); - break; - case METEOR_ONLY_EVEN_FIELDS: - base->dma1e = buf; -#ifdef METEOR_TEST_VIDEO - if(mtr->video.addr && mtr->video.width) - base->stride1e = mtr->video.width-temp; -#endif - SAA7196_WRITE(mtr, 0x20, 0xf0); - break; - default: /* interlaced even/odd */ - base->dma1e = buf; - base->dma1o = buf + temp; - base->stride1e = base->stride1o = temp; -#ifdef METEOR_TEST_VIDEO - if(mtr->video.addr && mtr->video.width) { - base->dma1o = buf + mtr->video.width; - base->stride1e = base->stride1o = - mtr->video.width - - temp + mtr->video.width; - } -#endif - SAA7196_WRITE(mtr, 0x20, 0x90); - break; - } - base->routee = base->routeo = 0xeeeeee01; - break; - case METEOR_GEO_RGB24: - mtr->depth = 4; - mtr->frame_size = mtr->rows * mtr->cols * mtr->depth; - mtr->flags &= ~METEOR_OUTPUT_FMT_MASK; - mtr->flags |= METEOR_RGB24; - temp = mtr->cols * mtr->depth; - /* recal stride and starting point */ - switch(mtr->flags & METEOR_ONLY_FIELDS_MASK) { - case METEOR_ONLY_ODD_FIELDS: - base->dma1o = buf; -#ifdef METEOR_TEST_VIDEO - if(mtr->video.addr && mtr->video.width) - base->stride1o = mtr->video.width-temp; -#endif - SAA7196_WRITE(mtr, 0x20, 0xd2); - break; - case METEOR_ONLY_EVEN_FIELDS: - base->dma1e = buf; -#ifdef METEOR_TEST_VIDEO - if(mtr->video.addr && mtr->video.width) - base->stride1e = mtr->video.width-temp; -#endif - SAA7196_WRITE(mtr, 0x20, 0xf2); - break; - default: /* interlaced even/odd */ - base->dma1e = buf; - base->dma1o = buf + mtr->cols * mtr->depth; - base->stride1e = base->stride1o = - mtr->cols * mtr->depth; -#ifdef METEOR_TEST_VIDEO - if(mtr->video.addr && mtr->video.width) { - base->dma1o = buf + mtr->video.width; - base->stride1e = base->stride1o = - mtr->video.width - - temp + mtr->video.width; - } -#endif - SAA7196_WRITE(mtr, 0x20, 0x92); - break; - } - base->routee= base->routeo= 0x39393900; - break; - case METEOR_GEO_YUV_PLANAR: - mtr->depth = 2; - temp = mtr->rows * mtr->cols; /* compute frame size */ - mtr->frame_size = temp * mtr->depth; - mtr->flags &= ~METEOR_OUTPUT_FMT_MASK; - mtr->flags |= METEOR_YUV_PLANAR; - /* recal stride and starting point */ - switch(mtr->flags & METEOR_ONLY_FIELDS_MASK) { - case METEOR_ONLY_ODD_FIELDS: - base->dma1o = buf; /* Y Odd */ - base->dma2o = buf + temp; /* U Odd */ - temp >>= 1; - base->dma3o = base->dma2o + temp; /* V Odd */ - SAA7196_WRITE(mtr, 0x20, 0xd1); - break; - case METEOR_ONLY_EVEN_FIELDS: - base->dma1e = buf; /* Y Even */ - base->dma2e = buf + temp; /* U Even */ - temp >>= 1; - base->dma2e= base->dma2e + temp; /* V Even */ - SAA7196_WRITE(mtr, 0x20, 0xf1); - break; - default: /* interlaced even/odd */ - base->dma1e = buf; /* Y Even */ - base->dma2e = buf + temp; /* U Even */ - temp >>= 2; - base->dma3e = base->dma2e + temp; /* V Even */ - base->dma1o = base->dma1e+mtr->cols;/* Y Odd */ - base->dma2o = base->dma3e + temp; /* U Odd */ - base->dma3o = base->dma2o + temp; /* V Odd */ - base->stride1e = base->stride1o = mtr->cols; - SAA7196_WRITE(mtr, 0x20, 0x91); - break; - } - switch (geo->oformat & - (METEOR_GEO_YUV_12 | METEOR_GEO_YUV_9)) { - case METEOR_GEO_YUV_9: - base->routee=base->routeo = 0xaaaaffc3; - break; - case METEOR_GEO_YUV_12: - base->routee=base->routeo = 0xaaaaffc2; - break; - default: - base->routee=base->routeo = 0xaaaaffc1; - break; - } - break; - case METEOR_GEO_YUV_422:/* same as planer, different uv order */ - mtr->depth = 2; - temp = mtr->rows * mtr->cols; /* compute frame size */ - mtr->frame_size = temp * mtr->depth; - mtr->flags &= ~METEOR_OUTPUT_FMT_MASK; - mtr->flags |= METEOR_YUV_422; - switch(mtr->flags & METEOR_ONLY_FIELDS_MASK) { - case METEOR_ONLY_ODD_FIELDS: - base->dma1o = buf; - base->dma2o = buf + temp; - base->dma3o = base->dma2o + (temp >> 1); - SAA7196_WRITE(mtr, 0x20, 0xd1); - break; - case METEOR_ONLY_EVEN_FIELDS: - base->dma1e = buf; - base->dma2e = buf + temp; - base->dma3e = base->dma2e + (temp >> 1); - SAA7196_WRITE(mtr, 0x20, 0xf1); - break; - default: /* interlaced even/odd */ - base->dma1e = buf; /* Y even */ - base->dma2e = buf + temp; /* U even */ - base->dma3e = - base->dma2e + (temp >> 1);/* V even */ - base->dma1o = base->dma1e+mtr->cols;/* Y odd */ - temp = mtr->cols >> 1; - base->dma2o = base->dma2e+temp; /* U odd */ - base->dma3o = base->dma3e+temp; /* V odd */ - base->stride1e = - base->stride1o = mtr->cols; /* Y stride */ - base->stride2e = - base->stride2o = temp; /* U stride */ - base->stride3e = - base->stride3o = temp; /* V stride */ - SAA7196_WRITE(mtr, 0x20, 0x91); - break; - } - switch (geo->oformat & - (METEOR_GEO_YUV_12 | METEOR_GEO_YUV_9)) { - case METEOR_GEO_YUV_9: - base->routee=base->routeo = 0xaaaaffc3; - break; - case METEOR_GEO_YUV_12: - base->routee=base->routeo = 0xaaaaffc2; - break; - default: - base->routee=base->routeo = 0xaaaaffc1; - break; - } - break; - case METEOR_GEO_YUV_PACKED: - mtr->depth = 2; - mtr->frame_size = mtr->rows * mtr->cols * mtr->depth; - mtr->flags &= ~METEOR_OUTPUT_FMT_MASK; - mtr->flags |= METEOR_YUV_PACKED; - /* recal stride and odd starting point */ - switch(mtr->flags & METEOR_ONLY_FIELDS_MASK) { - case METEOR_ONLY_ODD_FIELDS: - base->dma1o = buf; - SAA7196_WRITE(mtr, 0x20, 0xd1); - break; - case METEOR_ONLY_EVEN_FIELDS: - base->dma1e = buf; - SAA7196_WRITE(mtr, 0x20, 0xf1); - break; - default: /* interlaced even/odd */ - base->dma1e = buf; - base->dma1o = buf + mtr->cols * mtr->depth; - base->stride1e = base->stride1o = - mtr->cols * mtr->depth; - SAA7196_WRITE(mtr, 0x20, 0x91); - break; - } - base->routee = base->routeo = 0xeeeeee41; - break; - default: - error = EINVAL; /* invalid argument */ - kprintf("meteor%d: ioctl: invalid output format\n",unit); - break; - } - /* set cols */ - SAA7196_WRITE(mtr, 0x21, mtr->cols & 0xff); - SAA7196_WRITE(mtr, 0x24, - ((SAA7196_REG(mtr, 0x24) & ~0x03) | - ((mtr->cols >> 8) & 0x03))); - /* set rows */ - if(mtr->flags & METEOR_ONLY_FIELDS_MASK) { - SAA7196_WRITE(mtr, 0x25, ((mtr->rows) & 0xff)); - SAA7196_WRITE(mtr, 0x28, - ((SAA7196_REG(mtr, 0x28) & ~0x03) | - ((mtr->rows >> 8) & 0x03))); - } else { /* Interlaced */ - SAA7196_WRITE(mtr, 0x25, ((mtr->rows >> 1) & 0xff)); - SAA7196_WRITE(mtr, 0x28, - ((SAA7196_REG(mtr, 0x28) & ~0x03) | - ((mtr->rows >> 9) & 0x03))); - } - /* set signed/unsigned chrominance */ - SAA7196_WRITE(mtr, 0x30, (SAA7196_REG(mtr, 0x30) & ~0x10) | - ((geo->oformat&METEOR_GEO_UNSIGNED)?0:0x10)); - break; - case METEORGETGEO: - geo = (struct meteor_geomet *) data; - geo->rows = mtr->rows; - geo->columns = mtr->cols; - geo->frames = mtr->frames; - geo->oformat = (mtr->flags & METEOR_OUTPUT_FMT_MASK) | - (mtr->flags & METEOR_ONLY_FIELDS_MASK) | - (SAA7196_REG(mtr, 0x30) & 0x10 ? - 0:METEOR_GEO_UNSIGNED); - switch(base->routee & 0xff) { - case 0xc3: - geo->oformat |= METEOR_GEO_YUV_9; - break; - case 0xc2: - geo->oformat |= METEOR_GEO_YUV_12; - break; - default: - break; - } - break; - case METEORSCOUNT: /* (re)set error counts */ - cnt = (struct meteor_counts *) data; - mtr->fifo_errors = cnt->fifo_errors; - mtr->dma_errors = cnt->dma_errors; - mtr->frames_captured = cnt->frames_captured; - mtr->even_fields_captured = cnt->even_fields_captured; - mtr->odd_fields_captured = cnt->odd_fields_captured; - break; - case METEORGCOUNT: /* get error counts */ - cnt = (struct meteor_counts *) data; - cnt->fifo_errors = mtr->fifo_errors; - cnt->dma_errors = mtr->dma_errors; - cnt->frames_captured = mtr->frames_captured; - cnt->even_fields_captured = mtr->even_fields_captured; - cnt->odd_fields_captured = mtr->odd_fields_captured; - break; - default: - kprintf("meteor%d: ioctl: invalid ioctl request\n", unit); - error = ENOTTY; - break; - } - return(error); -} - -int -meteor_mmap(struct dev_mmap_args *ap) -{ - cdev_t dev = ap->a_head.a_dev; - int unit; - meteor_reg_t *mtr; - - unit = UNIT(minor(dev)); - if (unit >= NMETEOR) /* at this point could this happen? */ - return(-1); - - mtr = &(meteor[unit]); - - - if (ap->a_nprot & PROT_EXEC) - return -1; - - if (ap->a_offset >= mtr->alloc_pages * PAGE_SIZE) - return -1; - - return i386_btop(vtophys(mtr->bigbuf) + ap->a_offset); -} diff --git a/sys/dev/video/meteor/meteor_reg.h b/sys/dev/video/meteor/meteor_reg.h deleted file mode 100644 index 2c826f8ddc..0000000000 --- a/sys/dev/video/meteor/meteor_reg.h +++ /dev/null @@ -1,247 +0,0 @@ -/* - * 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: src/sys/pci/meteor_reg.h,v 1.5.2.1 2000/08/03 01:09:11 peter Exp $ - * $DragonFly: src/sys/dev/video/meteor/meteor_reg.h,v 1.2 2003/06/17 04:28:57 dillon Exp $ - */ -#ifndef PCI_LATENCY_TIMER -#define PCI_LATENCY_TIMER 0x0c /* pci timer register */ -#endif - -/* - * Definitions for the Philips SAA7116 digital video to pci interface. - */ -#define SAA7116_PHILIPS_ID 0x12238086ul -#define SAA7116_I2C_WRITE 0x00 -#define SAA7116_I2C_READ 0x01 -#define SAA7116_IIC_NEW_CYCLE 0x1000000L -#define SAA7116_IIC_DIRECT_TRANSFER_ABORTED 0x0000200L - -typedef volatile u_int mreg_t; -struct saa7116_regs { - mreg_t dma1e; /* Base address for even field dma chn 1 */ - mreg_t dma2e; /* Base address for even field dma chn 2 */ - mreg_t dma3e; /* Base address for even field dma chn 3 */ - mreg_t dma1o; /* Base address for odd field dma chn 1 */ - mreg_t dma2o; /* Base address for odd field dma chn 2 */ - mreg_t dma3o; /* Base address for odd field dma chn 3 */ - mreg_t stride1e; /* Address stride for even field dma chn 1 */ - mreg_t stride2e; /* Address stride for even field dma chn 2 */ - mreg_t stride3e; /* Address stride for even field dma chn 3 */ - mreg_t stride1o; /* Address stride for odd field dma chn 1 */ - mreg_t stride2o; /* Address stride for odd field dma chn 2 */ - mreg_t stride3o; /* Address stride for odd field dma chn 3 */ - mreg_t routee; /* Route/mode even */ - mreg_t routeo; /* Route/mode odd */ - mreg_t fifo_t; /* FIFO trigger for PCI int */ - mreg_t field_t; /* Field toggle */ - mreg_t cap_cntl; /* Capture control */ - mreg_t retry_wait_cnt; /* Clks for master to wait after disconnect */ - mreg_t irq_stat; /* IRQ mask and status reg */ - mreg_t fme; /* Field Mask even */ - mreg_t fmo; /* Field mask odd */ - mreg_t fml; /* Field mask length */ - mreg_t fifo_t_err; /* FIFO almost empty/almost full ptrs */ - mreg_t i2c_phase; /* i2c phase register */ - mreg_t i2c_read; /* i2c read register */ - mreg_t i2c_write; /* i2c write register */ - mreg_t i2c_auto_a_e; /* i2c auto register a, even */ - mreg_t i2c_auto_b_e; /* i2c auto register b, even */ - mreg_t i2c_auto_c_e; /* i2c auto register c, even */ - mreg_t i2c_auto_d_e; /* i2c auto register d, even */ - mreg_t i2c_auto_a_o; /* i2c auto register a, odd */ - mreg_t i2c_auto_b_o; /* i2c auto register b, odd */ - mreg_t i2c_auto_c_o; /* i2c auto register c, odd */ - mreg_t i2c_auto_d_o; /* i2c auto register d, odd */ - mreg_t i2c_auto_enable;/* enable above auto registers */ - mreg_t dma_end_e; /* DMA end even (range) */ - mreg_t dma_end_o; /* DMA end odd (range) */ -}; - - -/* - * Definitions for the Philips SAA7196 digital video decoder, - * scalar, and clock generator circuit (DESCpro). - */ -#define NUM_SAA7196_I2C_REGS 49 -#define SAA7196_I2C_ADDR 0x40 -#define SAA7196_WRITE(mtr, reg, data) \ - i2c_write(mtr, SAA7196_I2C_ADDR, SAA7116_I2C_WRITE, reg, data), \ - mtr->saa7196_i2c[reg] = data -#define SAA7196_REG(mtr, reg) mtr->saa7196_i2c[reg] -#define SAA7196_READ(mtr) \ - i2c_write(mtr, SAA7196_I2C_ADDR, SAA7116_I2C_READ, 0x0, 0x0) - -#define SAA7196_IDEL 0x00 /* Increment delay */ -#define SAA7196_HSB5 0x01 /* H-sync begin; 50 hz */ -#define SAA7196_HSS5 0x02 /* H-sync stop; 50 hz */ -#define SAA7196_HCB5 0x03 /* H-clamp begin; 50 hz */ -#define SAA7196_HCS5 0x04 /* H-clamp stop; 50 hz */ -#define SAA7196_HSP5 0x05 /* H-sync after PHI1; 50 hz */ -#define SAA7196_LUMC 0x06 /* Luminance control */ -#define SAA7196_HUEC 0x07 /* Hue control */ -#define SAA7196_CKTQ 0x08 /* Colour Killer Threshold QAM (PAL, NTSC) */ -#define SAA7196_CKTS 0x09 /* Colour Killer Threshold SECAM */ -#define SAA7196_PALS 0x0a /* PAL switch sensitivity */ -#define SAA7196_SECAMS 0x0b /* SECAM switch sensitivity */ -#define SAA7196_CGAINC 0x0c /* Chroma gain control */ -#define SAA7196_STDC 0x0d /* Standard/Mode control */ -#define SAA7196_IOCC 0x0e /* I/O and Clock Control */ -#define SAA7196_CTRL1 0x0f /* Control #1 */ -#define SAA7196_CTRL2 0x10 /* Control #2 */ -#define SAA7196_CGAINR 0x11 /* Chroma Gain Reference */ -#define SAA7196_CSAT 0x12 /* Chroma Saturation */ -#define SAA7196_CONT 0x13 /* Luminance Contrast */ -#define SAA7196_HSB6 0x14 /* H-sync begin; 60 hz */ -#define SAA7196_HSS6 0x15 /* H-sync stop; 60 hz */ -#define SAA7196_HCB6 0x16 /* H-clamp begin; 60 hz */ -#define SAA7196_HCS6 0x17 /* H-clamp stop; 60 hz */ -#define SAA7196_HSP6 0x18 /* H-sync after PHI1; 60 hz */ -#define SAA7196_BRIG 0x19 /* Luminance Brightness */ -#define SAA7196_FMTS 0x20 /* Formats and sequence */ -#define SAA7196_OUTPIX 0x21 /* Output data pixel/line */ -#define SAA7196_INPIX 0x22 /* Input data pixel/line */ -#define SAA7196_HWS 0x23 /* Horiz. window start */ -#define SAA7196_HFILT 0x24 /* Horiz. filter */ -#define SAA7196_OUTLINE 0x25 /* Output data lines/field */ -#define SAA7196_INLINE 0x26 /* Input data lines/field */ -#define SAA7196_VWS 0x27 /* Vertical window start */ -#define SAA7196_VYP 0x28 /* AFS/vertical Y processing */ -#define SAA7196_VBS 0x29 /* Vertical Bypass start */ -#define SAA7196_VBCNT 0x2a /* Vertical Bypass count */ -#define SAA7196_VBP 0x2b /* veritcal Bypass Polarity */ -#define SAA7196_VLOW 0x2c /* Colour-keying lower V limit */ -#define SAA7196_VHIGH 0x2d /* Colour-keying upper V limit */ -#define SAA7196_ULOW 0x2e /* Colour-keying lower U limit */ -#define SAA7196_UHIGH 0x2f /* Colour-keying upper U limit */ -#define SAA7196_DPATH 0x30 /* Data path setting */ - -/* - * Defines for the PCF8574. - */ -#define NUM_PCF8574_I2C_REGS 2 -#define PCF8574_CTRL_I2C_ADDR 0x70 -#define PCF8574_DATA_I2C_ADDR 0x72 -#define PCF8574_CTRL_WRITE(mtr, data) \ - i2c_write(mtr, PCF8574_CTRL_I2C_ADDR, SAA7116_I2C_WRITE, data, data), \ - mtr->pcf_i2c[0] = data -#define PCF8574_DATA_WRITE(mtr, data) \ - i2c_write(mtr, PCF8574_DATA_I2C_ADDR, SAA7116_I2C_WRITE, data, data), \ - mtr->pcf_i2c[1] = data -#define PCF8574_CTRL_REG(mtr) mtr->pcf_i2c[0] -#define PCF8574_DATA_REG(mtr) mtr->pcf_i2c[1] - - -/* - * Defines for the BT254. - */ -#define NUM_BT254_REGS 7 - -#define BT254_COMMAND 0 -#define BT254_IOUT1 1 -#define BT254_IOUT2 2 -#define BT254_IOUT3 3 -#define BT254_IOUT4 4 -#define BT254_IOUT5 5 -#define BT254_IOUT6 6 - -/* - * Meteor info structure, one per meteor card installed. - */ -typedef struct meteor_softc { - struct saa7116_regs *base; /* saa7116 register virtual address */ - vm_offset_t phys_base; /* saa7116 register physical address */ - pcici_t tag; /* PCI tag, for doing PCI commands */ - vm_offset_t bigbuf; /* buffer that holds the captured image */ - int alloc_pages; /* number of pages in bigbuf */ - struct proc *proc; /* process to receive raised signal */ - int signal; /* signal to send to process */ -#define METEOR_SIG_MODE_MASK 0xffff0000 -#define METEOR_SIG_FIELD_MODE 0x00010000 -#define METEOR_SIG_FRAME_MODE 0x00000000 - 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 */ - short depth; /* number of byte per pixel */ - 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 ?? */ - unsigned 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 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 saa7196_i2c[NUM_SAA7196_I2C_REGS]; /* saa7196 register values */ - u_char pcf_i2c[NUM_PCF8574_I2C_REGS]; /* PCF8574 register values */ - u_char bt254_reg[NUM_BT254_REGS]; /* BT254 register values */ - u_short fps; /* frames per second */ -#ifdef METEOR_TEST_VIDEO - struct meteor_video video; -#endif -} meteor_reg_t; diff --git a/tools/multimedia/cxm/setchannel/cxm_setchannel.1 b/tools/multimedia/cxm/setchannel/cxm_setchannel.1 index 579e3d7d74..6001ae5fc3 100644 --- a/tools/multimedia/cxm/setchannel/cxm_setchannel.1 +++ b/tools/multimedia/cxm/setchannel/cxm_setchannel.1 @@ -126,8 +126,7 @@ has to be either a channel number or a frequency in MHz (which must include a decimal point). .Sh SEE ALSO .Xr bktr 4 , -.Xr cxm 4 , -.Xr meteor 4 +.Xr cxm 4 .Sh HISTORY The .Nm -- 2.41.0