Here is a patch that fix a few problems with the RGB version of

the meteor card.
Submitted-by: james
This commit is contained in:
Jordan K. Hubbard 1996-06-07 03:03:25 +00:00
parent 475dca82bb
commit 068439339a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=16167
2 changed files with 77 additions and 12 deletions

View File

@ -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;
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) << 16) | (maxfps - 1);
step = (float)(maxfps - 1) / (float)(maxfps - fps);
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;
@ -864,6 +903,19 @@ int i;
bt254_write(mtr, BT254_COMMAND, 0x00); /* 24 bpp */
}
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)
{
@ -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) |

View File

@ -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 */