/* just in case something is wrong... */ if (ptr->codec->master_data->readreg)
value = (ptr->codec->master_data->readreg(ptr->codec, reg)) & 0xFF; else
zrdev_err(zr, "%s: invalid I/O setup, nothing read!\n", ptr->name);
zrdev_dbg(zr, "%s: reading from 0x%04x: %02x\n", ptr->name, reg, value);
zrdev_dbg(zr, "%s: writing 0x%02x to 0x%04x\n", ptr->name, value, reg);
// just in case something is wrong... if (ptr->codec->master_data->writereg)
ptr->codec->master_data->writereg(ptr->codec, reg, value); else
zrdev_err(zr, "%s: invalid I/O setup, nothing written!\n", ptr->name);
}
/* * indirect read and write functions * * the 016 supports auto-addr-increment, but * writing it all time cost not much and is safer...
*/ static u8 zr36016_readi(struct zr36016 *ptr, u16 reg)
{
u8 value = 0; struct zoran *zr = videocodec_to_zoran(ptr->codec);
/* just in case something is wrong... */ if ((ptr->codec->master_data->writereg) && (ptr->codec->master_data->readreg)) {
ptr->codec->master_data->writereg(ptr->codec, ZR016_IADDR, reg & 0x0F);
value = (ptr->codec->master_data->readreg(ptr->codec, ZR016_IDATA)) & 0xFF;
} else {
zrdev_err(zr, "%s: invalid I/O setup, nothing read (i)!\n", ptr->name);
}
zrdev_dbg(zr, "%s: writing indirect 0x%02x to 0x%04x\n", ptr->name,
value, reg);
/* just in case something is wrong... */ if (ptr->codec->master_data->writereg) {
ptr->codec->master_data->writereg(ptr->codec, ZR016_IADDR, reg & 0x0F);
ptr->codec->master_data->writereg(ptr->codec, ZR016_IDATA, value & 0x0FF);
} else {
zrdev_err(zr, "%s: invalid I/O setup, nothing written (i)!\n", ptr->name);
}
}
if (*KERN_INFO <= CONSOLE_LOGLEVEL_DEFAULT) { int i;
zr36016_writei(ptr, ZR016I_PAX_LO, 0x55);
zrdev_dbg(zr, "%s: registers: ", ptr->name); for (i = 0; i <= 0x0b; i++)
zrdev_dbg(zr, "%02x ", zr36016_readi(ptr, i));
zrdev_dbg(zr, "\n");
} // for testing just write 0, then the default value to a register and read // it back in both cases
zr36016_writei(ptr, ZR016I_PAX_LO, 0x00); if (zr36016_readi(ptr, ZR016I_PAX_LO) != 0x0) {
zrdev_err(zr, "%s: attach failed, can't connect to vfe processor!\n", ptr->name); return -ENXIO;
}
zr36016_writei(ptr, ZR016I_PAX_LO, 0x0d0); if (zr36016_readi(ptr, ZR016I_PAX_LO) != 0x0d0) {
zrdev_err(zr, "%s: attach failed, can't connect to vfe processor!\n", ptr->name); return -ENXIO;
} // we allow version numbers from 0-3, should be enough, though
zr36016_read_version(ptr); if (ptr->version & 0x0c) {
zrdev_err(zr, "%s: attach failed, suspicious version %d found...\n", ptr->name,
ptr->version); return -ENXIO;
}
/* * CODEC API FUNCTIONS * * These functions are accessed by the master via the API structure
*/
/* * set compression/expansion mode and launches codec - * this should be the last call from the master before starting processing
*/ staticint zr36016_set_mode(struct videocodec *codec, int mode)
{ struct zr36016 *ptr = (struct zr36016 *)codec->data; struct zoran *zr = videocodec_to_zoran(codec);
/* * if () return -EINVAL; * trust the master driver that it knows what it does - so * we allow invalid startx/y for now ...
*/
ptr->width = cap->width;
ptr->height = cap->height; /* * (Ronald) This is ugly. zoran_device.c, line 387 * already mentions what happens if h_start is even * (blue faces, etc., cr/cb inversed). There's probably * some good reason why h_start is 0 instead of 1, so I'm * leaving it to this for now, but really... This can be * done a lot simpler
*/
ptr->xoff = (norm->h_start ? norm->h_start : 1) + cap->x; /* * Something to note here (I don't understand it), setting * v_start too high will cause the codec to 'not work'. I * really don't get it. values of 16 (v_start) already break * it here. Just '0' seems to work. More testing needed!
*/
ptr->yoff = norm->v_start + cap->y; /* (Ronald) dzjeeh, can't this thing do hor_decimation = 4? */
ptr->xdec = ((cap->decimation & 0xff) == 1) ? 0 : 1;
ptr->ydec = (((cap->decimation >> 8) & 0xff) == 1) ? 0 : 1;
return 0;
}
/* additional control functions */ staticint zr36016_control(struct videocodec *codec, int type, int size, void *data)
{ struct zr36016 *ptr = (struct zr36016 *)codec->data; struct zoran *zr = videocodec_to_zoran(codec); int *ival = (int *)data;
zrdev_dbg(zr, "%s: control %d call with %d byte\n",
ptr->name, type, size);
switch (type) { case CODEC_G_STATUS: /* get last status - we don't know it ... */ if (size != sizeof(int)) return -EFAULT;
*ival = 0; break;
case CODEC_G_CODEC_MODE: if (size != sizeof(int)) return -EFAULT;
*ival = 0; break;
case CODEC_S_CODEC_MODE: if (size != sizeof(int)) return -EFAULT; if (*ival != 0) return -EINVAL; /* not needed, do nothing */ return 0;
case CODEC_G_VFE: case CODEC_S_VFE: return 0;
case CODEC_S_MMAP: /* not available, give an error */ return -ENXIO;
/* * Setup and registry function: * * Initializes Zoran's JPEG processor * * Also sets pixel size, average code size, mode (compr./decompr.) * (the given size is determined by the processor with the video interface)
*/
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.