summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1996-06-07 03:03:25 +0000
committerjkh <jkh@FreeBSD.org>1996-06-07 03:03:25 +0000
commit95fcc9d9857fdefb3425fccb40419a251cd73521 (patch)
treeb19abe2422067dd383d30d9fb53b915bf4859394 /sys
parent7ccbe485e6ae568fc13bdca538625ba84f3dae18 (diff)
downloadFreeBSD-src-95fcc9d9857fdefb3425fccb40419a251cd73521.zip
FreeBSD-src-95fcc9d9857fdefb3425fccb40419a251cd73521.tar.gz
Here is a patch that fix a few problems with the RGB version of
the meteor card. Submitted-by: james
Diffstat (limited to 'sys')
-rw-r--r--sys/pci/meteor.c81
-rw-r--r--sys/pci/meteor_reg.h10
2 files changed, 78 insertions, 13 deletions
diff --git a/sys/pci/meteor.c b/sys/pci/meteor.c
index e23444a..b26154f 100644
--- a/sys/pci/meteor.c
+++ b/sys/pci/meteor.c
@@ -129,6 +129,18 @@
Changed the spelling of PLANER to PLANAR as pointed
out by Paco Hope <paco@cs.virigina.edu> 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,
+ <ian@robots.ox.ac.uk>.
+ 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 <ljo@po.cwru.edu>.
+ Added METEOR_FIELD_MODE to include files for a
+ future version of this driver.
*/
#include "meteor.h"
@@ -622,6 +634,12 @@ meteor_intr(void *arg)
*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))
+ psignal(mtr->proc, mtr->signal&(~METEOR_SIG_MODE_MASK));
}
if (status & 0x2) { /* odd field */
mtr->odd_fields_captured++;
@@ -630,6 +648,12 @@ meteor_intr(void *arg)
*(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))
+ psignal(mtr->proc, mtr->signal&(~METEOR_SIG_MODE_MASK));
}
/*
@@ -661,8 +685,8 @@ meteor_intr(void *arg)
* If the user requested to be notified via signal,
* let them know the frame is complete.
*/
- if(mtr->proc && mtr->signal)
- psignal(mtr->proc, mtr->signal);
+ if(mtr->proc && !(mtr->signal & METEOR_SIG_MODE_MASK))
+ psignal(mtr->proc, mtr->signal&(~METEOR_SIG_MODE_MASK));
/*
* Reset the want flags if in continuous or
* synchronous capture mode.
@@ -784,14 +808,29 @@ set_fps(meteor_reg_t *mtr, u_short fps)
/*
* Compute the mask/length using the fps.
*/
- if(fps < maxfps) {
- float b, step;
-
- mask = (1 << maxfps) - 1;
- length = ((maxfps - 1) << 16) | (maxfps - 1);
- step = (float)(maxfps - 1) / (float)(maxfps - 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<<maxfps) - 1;
+ length = maxfps - 1;
+ step = (float)(maxfps - 1)/(float)(maxfps - fps);
for(b=step; b < maxfps; b += step) {
- mask &= ~(1<<((int)b));
+ mask &= ~(1<<((int)b)); /* mask out the bth frame */
+ }
+ } else { /* fps < maxfps/2 */
+ float step, b;
+
+ mask = 0x1;
+ length = maxfps - 1;
+ step = (float)(maxfps -1)/(float)(fps);
+ for(b = step + 1; b < maxfps - 1; b += step) {
+ mask |= (1<<((int)b)); /* mask in the bth frame */
}
}
@@ -799,7 +838,7 @@ set_fps(meteor_reg_t *mtr, u_short fps)
* Set the fps.
*/
s7116->fme = s7116->fmo = mask;
- s7116->fml = length;
+ s7116->fml = (length << 16) | length;;
mtr->fps = fps;
@@ -865,6 +904,19 @@ int i;
}
static void
+bt254_ntsc(meteor_reg_t *mtr, int arg)
+{
+ if (arg){
+ /* Set NTSC bit */
+ PCF8574_CTRL_WRITE(mtr, PCF8574_CTRL_REG(mtr) | 0x20);
+ }
+ else {
+ /* reset NTSC bit */
+ PCF8574_CTRL_WRITE(mtr, PCF8574_CTRL_REG(mtr) &= ~0x20);
+ }
+}
+
+static void
select_bt254(meteor_reg_t *mtr)
{
/* disable saa7196, saaen = 1 */
@@ -1458,6 +1510,9 @@ meteor_ioctl(dev_t dev, int cmd, caddr_t arg, int flag, struct proc *pr)
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) |
@@ -1472,6 +1527,9 @@ meteor_ioctl(dev_t dev, int cmd, caddr_t arg, int flag, struct proc *pr)
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) |
@@ -1486,6 +1544,9 @@ meteor_ioctl(dev_t dev, int cmd, caddr_t arg, int flag, struct proc *pr)
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) |
diff --git a/sys/pci/meteor_reg.h b/sys/pci/meteor_reg.h
index 5f93342..5293ba4 100644
--- a/sys/pci/meteor_reg.h
+++ b/sys/pci/meteor_reg.h
@@ -147,10 +147,10 @@ struct saa7116_regs {
#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, 0, 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, 0, 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]
@@ -180,6 +180,9 @@ typedef struct meteor_softc {
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) */
@@ -215,7 +218,7 @@ typedef struct meteor_softc {
#define METEOR_DEV3 0x00008000
#define METEOR_DEV_SVIDEO 0x00006000
#define METEOR_DEV_RGB 0x0000a000
-#define METEOR_DEV_MASK 0x2000f000
+#define METEOR_DEV_MASK 0x0000f000
#define METEOR_RGB16 0x00010000
#define METEOR_RGB24 0x00020000
#define METEOR_YUV_PACKED 0x00040000
@@ -230,6 +233,7 @@ typedef struct meteor_softc {
#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 */
OpenPOWER on IntegriCloud