/*
- $Id: bttv-risc.c,v 1.9 2004/10/13 10:39:00 kraxel Exp $
-
bttv-risc.c -- interfaces to other kernel modules
bttv risc code handling
instructions += 2;
if ((rc = btcx_riscmem_alloc(btv->c.pci,risc,instructions*8)) < 0)
return rc;
+ dprintk("bttv%d: risc packed: bpl %d lines %d instr %d size %d ptr %p\n",
+ btv->c.nr, bpl, lines, instructions, risc->size, risc->cpu);
/* sync instruction */
rp = risc->cpu;
offset += todo;
}
offset += padding;
+ dprintk("bttv%d: risc packed: line %d ptr %p\n",
+ btv->c.nr, line, rp);
}
+ dprintk("bttv%d: risc packed: %d sglist elems\n", btv->c.nr, (int)(sg-sglist));
/* save pointer to jmp instruction address */
risc->jmp = rp;
- BUG_ON((risc->jmp - risc->cpu + 2) / 4 > risc->size);
return 0;
}
break;
case 1:
if (topfield)
- chroma = ((line & 1) == 0);
+ chroma = (line & 1) == 0;
else
- chroma = ((line & 1) == 1);
+ chroma = (line & 1) == 1;
break;
case 2:
if (topfield)
- chroma = ((line & 3) == 0);
+ chroma = (line & 3) == 0;
else
- chroma = ((line & 3) == 2);
+ chroma = (line & 3) == 2;
break;
default:
chroma = 0;
/* save pointer to jmp instruction address */
risc->jmp = rp;
- BUG_ON((risc->jmp - risc->cpu + 2) / 4 > risc->size);
return 0;
}
/* skip list for window clipping */
if (NULL == (skips = kmalloc(sizeof(*skips) * ov->nclips,GFP_KERNEL)))
return -ENOMEM;
-
+
/* estimate risc mem: worst case is (clip+1) * lines instructions
+ sync + jump (all 2 dwords) */
instructions = (ov->nclips + 1) *
ra = addr + (fmt->depth>>3)*start;
else
ra = 0;
-
+
if (0 == start)
ri |= BT848_RISC_SOL;
if (ov->w.width == end)
/* save pointer to jmp instruction address */
risc->jmp = rp;
- BUG_ON((risc->jmp - risc->cpu + 2) / 4 > risc->size);
kfree(skips);
return 0;
}
/* risc group / risc main loop / dma management */
void
-bttv_set_dma(struct bttv *btv, int override)
+bttv_set_dma(struct bttv *btv, int override, int irqflags)
{
unsigned long cmd;
int capctl;
capctl |= override;
d2printk(KERN_DEBUG
- "bttv%d: capctl=%x lirq=%d top=%08Lx/%08Lx even=%08Lx/%08Lx\n",
- btv->c.nr,capctl,btv->loop_irq,
+ "bttv%d: capctl=%x irq=%d top=%08Lx/%08Lx even=%08Lx/%08Lx\n",
+ btv->c.nr,capctl,irqflags,
btv->cvbi ? (unsigned long long)btv->cvbi->top.dma : 0,
btv->curr.top ? (unsigned long long)btv->curr.top->top.dma : 0,
btv->cvbi ? (unsigned long long)btv->cvbi->bottom.dma : 0,
btv->curr.bottom ? (unsigned long long)btv->curr.bottom->bottom.dma : 0);
-
+
cmd = BT848_RISC_JUMP;
- if (btv->loop_irq) {
+ if (irqflags) {
cmd |= BT848_RISC_IRQ;
- cmd |= (btv->loop_irq & 0x0f) << 16;
- cmd |= (~btv->loop_irq & 0x0f) << 20;
+ cmd |= (irqflags & 0x0f) << 16;
+ cmd |= (~irqflags & 0x0f) << 20;
}
- if (btv->curr.frame_irq || btv->loop_irq || btv->cvbi) {
+ if (irqflags || btv->cvbi) {
mod_timer(&btv->timeout, jiffies+BTTV_TIMEOUT);
} else {
del_timer(&btv->timeout);
}
btv->main.cpu[RISC_SLOT_LOOP] = cpu_to_le32(cmd);
-
+
btaor(capctl, ~0x0f, BT848_CAP_CTL);
if (capctl) {
if (btv->dma_on)
bttv_risc_init_main(struct bttv *btv)
{
int rc;
-
+
if ((rc = btcx_riscmem_alloc(btv->c.pci,&btv->main,PAGE_SIZE)) < 0)
return rc;
dprintk(KERN_DEBUG "bttv%d: risc main @ %08Lx\n",
}
bttv_apply_geo(btv, &set->top->geo, 1);
bttv_apply_geo(btv, &set->bottom->geo,0);
- bttv_risc_hook(btv, RISC_SLOT_O_FIELD, &set->top->top,
- set->top_irq);
- bttv_risc_hook(btv, RISC_SLOT_E_FIELD, &set->bottom->bottom,
- set->frame_irq);
+ bttv_risc_hook(btv, RISC_SLOT_O_FIELD, &set->top->top, set->topirq);
+ bttv_risc_hook(btv, RISC_SLOT_E_FIELD, &set->bottom->bottom, 0);
btaor((set->top->btformat & 0xf0) | (set->bottom->btformat & 0x0f),
~0xff, BT848_COLOR_FMT);
btaor((set->top->btswap & 0x0a) | (set->bottom->btswap & 0x05),
list_del(&set->top->vb.queue);
bttv_apply_geo(btv, &set->top->geo,1);
bttv_apply_geo(btv, &set->top->geo,0);
- bttv_risc_hook(btv, RISC_SLOT_O_FIELD, &set->top->top,
- set->frame_irq);
+ bttv_risc_hook(btv, RISC_SLOT_O_FIELD, &set->top->top, 0);
bttv_risc_hook(btv, RISC_SLOT_E_FIELD, NULL, 0);
btaor(set->top->btformat & 0xff, ~0xff, BT848_COLOR_FMT);
btaor(set->top->btswap & 0x0f, ~0x0f, BT848_COLOR_CTL);
list_del(&set->bottom->vb.queue);
bttv_apply_geo(btv, &set->bottom->geo,1);
bttv_apply_geo(btv, &set->bottom->geo,0);
- bttv_risc_hook(btv, RISC_SLOT_O_FIELD, NULL, 0);
- bttv_risc_hook(btv, RISC_SLOT_E_FIELD, &set->bottom->bottom,
- set->frame_irq);
+ bttv_risc_hook(btv, RISC_SLOT_O_FIELD, NULL, 0);
+ bttv_risc_hook(btv, RISC_SLOT_E_FIELD, &set->bottom->bottom, 0);
btaor(set->bottom->btformat & 0xff, ~0xff, BT848_COLOR_FMT);
btaor(set->bottom->btswap & 0x0f, ~0x0f, BT848_COLOR_CTL);
} else {
bttv_calc_geo(btv,&buf->geo,buf->vb.width,buf->vb.height,
V4L2_FIELD_HAS_BOTH(buf->vb.field),buf->tvnorm);
-
+
switch (buf->vb.field) {
case V4L2_FIELD_TOP:
bttv_risc_packed(btv,&buf->top,buf->vb.dma.sglist,