}
}
+static void saa7164_pack_verifier(struct saa7164_buffer *buf)
+{
+ u8 *p = (u8 *)buf->cpu;
+ int i;
+
+ for (i = 0; i < buf->actual_size; i += 2048) {
+
+ if ( (*(p + i + 0) != 0x00) || (*(p + i + 1) != 0x00) || (*(p + i + 2) != 0x01) || (*(p + i + 3) != 0xBA) )
+ printk(KERN_ERR "No pack at 0x%x\n", i);
+ }
+}
+
static void saa7164_ts_verifier(struct saa7164_buffer *buf)
{
struct saa7164_port *port = buf->port;
- struct saa7164_dev *dev = port->dev;
u32 i;
u8 tmp, cc, a;
u8 *bufcpu = (u8 *)buf->cpu;
static void saa7164_histogram_print(struct saa7164_port *port,
struct saa7164_histogram *hg)
{
- struct saa7164_dev *dev = port->dev;
u32 entries = 0;
int i;
(*(p + buf->actual_size + 0x12) != 0xff) ||
(*(p + buf->actual_size + 0x13) != 0xff) )
{
- printk(KERN_ERR "buf %p failed guard check\n", buf);
+ printk(KERN_ERR "%s() buf %p failed guard check\n", __func__, buf);
saa7164_dumphex16(dev, p + buf->actual_size - 32, 64);
}
/* Validate the incoming buffer content */
if (port->encoder_params.stream_type == V4L2_MPEG_STREAM_TYPE_MPEG2_TS)
saa7164_ts_verifier(buf);
+ if (port->encoder_params.stream_type == V4L2_MPEG_STREAM_TYPE_MPEG2_PS)
+ saa7164_pack_verifier(buf);
/* find a free user buffer and clone to it */
if (!list_empty(&port->list_buf_free.list)) {
ubuf = list_first_entry(&port->list_buf_free.list,
struct saa7164_user_buffer, list);
- if (ubuf->actual_size >= buf->actual_size) {
- memcpy(ubuf->data, port->shadow_buf[rp], 312 * 188);
+ if (buf->actual_size <= ubuf->actual_size) {
+
+ memcpy_fromio(ubuf->data, buf->cpu, ubuf->actual_size);
/* Throw a new checksum on the read buffer */
ubuf->crc = crc32(0, ubuf->data, ubuf->actual_size);
rp, buf->crc, port->shadow_crc[rp], ubuf->crc,
ok ? "crcgood" : "crcbad");
- } else {
- printk(KERN_ERR "buf %p actual fails match\n", buf);
- }
+ /* Requeue the buffer on the free list */
+ ubuf->pos = 0;
- /* Requeue the buffer on the free list */
- ubuf->pos = 0;
+ list_move_tail(&ubuf->list,
+ &port->list_buf_used.list);
- list_move_tail(&ubuf->list,
- &port->list_buf_used.list);
+ /* Flag any userland waiters */
+ wake_up_interruptible(&port->wait_read);
- /* Flag any userland waiters */
- wake_up_interruptible(&port->wait_read);
+ } else {
+ printk(KERN_ERR "buf %p bufsize fails match\n", buf);
+ }
} else
printk(KERN_ERR "encirq no free buffers, increase param encoder_buffers\n");
/* Ensure offset into buffer remains 0, fill buffer
- * with known bad data. */
+ * with known bad data. We check for this data at a later point
+ * in time. */
saa7164_buffer_zero_offsets(port, rp);
memset_io(buf->cpu, 0xff, buf->pci_size);
buf->crc = crc32(0, buf->cpu, buf->actual_size);
-// break;
+ break;
} else {
/* Validate all other checksums, on previous buffers - they should never change */
crc = crc32(0, buf->cpu, buf->actual_size);
{
struct saa7164_dev *dev = port->dev;
struct saa7164_buffer *buf;
- struct saa7164_user_buffer *ubuf;
struct list_head *c, *n;
int wp, rp, i = 0;
u8 *p;
if (buf->idx == rp) {
- memcpy_fromio(port->shadow_buf[rp], buf->cpu, 312 * 188);
- port->shadow_crc[rp] = crc32(0, port->shadow_buf[rp], 312 * 188);
+ memcpy_fromio(port->shadow_buf[rp], buf->cpu, buf->actual_size);
- buf->crc = crc32(0, buf->cpu, 312 * 188);
+ port->shadow_crc[rp] = crc32(0, port->shadow_buf[rp], buf->actual_size);
+
+ buf->crc = crc32(0, buf->cpu, buf->actual_size);
if (port->shadow_crc[rp] != buf->crc)
printk(KERN_ERR "%s() crc check failed 0x%x vs 0x%x\n",
if (port->type == SAA7164_MPEG_ENCODER) {
for (i = 0; i < 8; i ++) {
- port->shadow_buf[i] = kzalloc(312 * 188, GFP_KERNEL);
+ port->shadow_buf[i] = kzalloc(256 * 128, GFP_KERNEL);
if (port->shadow_buf[i] == 0)
printk(KERN_ERR "%s() shadow_buf ENOMEM\n", __func__);
else {
- memset(port->shadow_buf[i], 0xff, 312 * 188);
- port->shadow_crc[i] = crc32(0, port->shadow_buf[i], 312 * 188);
+ memset(port->shadow_buf[i], 0xff, 256 * 128);
+ port->shadow_crc[i] = crc32(0, port->shadow_buf[i], 256 * 128);
}
}
}