Lines Matching defs:btv

35 bttv_risc_packed(struct bttv *btv, struct btcx_riscmem *risc,
54 if ((rc = btcx_riscmem_alloc(btv->c.pci,risc,instructions)) < 0)
71 btv->opt_vcr_hack)
114 bttv_risc_planar(struct bttv *btv, struct btcx_riscmem *risc,
137 if ((rc = btcx_riscmem_alloc(btv->c.pci,risc,instructions*4*5)) < 0)
150 if ((btv->opt_vcr_hack) &&
237 bttv_calc_geo_old(struct bttv *btv, struct bttv_geometry *geo,
248 if (btv->input == btv->dig) {
271 if (btv->opt_combfilter) {
281 bttv_calc_geo (struct bttv * btv,
298 || btv->input == btv->dig) {
299 bttv_calc_geo_old(btv, geo, width, height,
327 if (btv->opt_combfilter) {
337 bttv_apply_geo(struct bttv *btv, struct bttv_geometry *geo, int odd)
363 static void bttv_set_risc_status(struct bttv *btv)
366 if (btv->loop_irq) {
368 cmd |= (btv->loop_irq & 0x0f) << 16;
369 cmd |= (~btv->loop_irq & 0x0f) << 20;
371 btv->main.cpu[RISC_SLOT_LOOP] = cpu_to_le32(cmd);
374 static void bttv_set_irq_timer(struct bttv *btv)
376 if (btv->curr.frame_irq || btv->loop_irq || btv->cvbi)
377 mod_timer(&btv->timeout, jiffies + BTTV_TIMEOUT);
379 del_timer(&btv->timeout);
382 static int bttv_set_capture_control(struct bttv *btv, int start_capture)
386 if (btv->curr.top || btv->curr.bottom)
390 if (btv->cvbi)
401 static void bttv_start_dma(struct bttv *btv)
403 if (btv->dma_on)
405 btwrite(btv->main.dma, BT848_RISC_STRT_ADD);
408 btv->dma_on = 1;
411 static void bttv_stop_dma(struct bttv *btv)
413 if (!btv->dma_on)
417 btv->dma_on = 0;
420 void bttv_set_dma(struct bttv *btv, int start_capture)
424 bttv_set_risc_status(btv);
425 bttv_set_irq_timer(btv);
426 capctl = bttv_set_capture_control(btv, start_capture);
429 bttv_start_dma(btv);
431 bttv_stop_dma(btv);
434 btv->c.nr,capctl,btv->loop_irq,
435 btv->cvbi ? (unsigned long long)btv->cvbi->top.dma : 0,
436 btv->curr.top ? (unsigned long long)btv->curr.top->top.dma : 0,
437 btv->cvbi ? (unsigned long long)btv->cvbi->bottom.dma : 0,
438 btv->curr.bottom ? (unsigned long long)btv->curr.bottom->bottom.dma : 0);
442 bttv_risc_init_main(struct bttv *btv)
446 if ((rc = btcx_riscmem_alloc(btv->c.pci,&btv->main,PAGE_SIZE)) < 0)
449 btv->c.nr, (unsigned long long)btv->main.dma);
451 btv->main.cpu[0] = cpu_to_le32(BT848_RISC_SYNC | BT848_RISC_RESYNC |
453 btv->main.cpu[1] = cpu_to_le32(0);
454 btv->main.cpu[2] = cpu_to_le32(BT848_RISC_JUMP);
455 btv->main.cpu[3] = cpu_to_le32(btv->main.dma + (4<<2));
458 btv->main.cpu[4] = cpu_to_le32(BT848_RISC_JUMP);
459 btv->main.cpu[5] = cpu_to_le32(btv->main.dma + (6<<2));
460 btv->main.cpu[6] = cpu_to_le32(BT848_RISC_JUMP);
461 btv->main.cpu[7] = cpu_to_le32(btv->main.dma + (8<<2));
463 btv->main.cpu[8] = cpu_to_le32(BT848_RISC_SYNC | BT848_RISC_RESYNC |
465 btv->main.cpu[9] = cpu_to_le32(0);
468 btv->main.cpu[10] = cpu_to_le32(BT848_RISC_JUMP);
469 btv->main.cpu[11] = cpu_to_le32(btv->main.dma + (12<<2));
470 btv->main.cpu[12] = cpu_to_le32(BT848_RISC_JUMP);
471 btv->main.cpu[13] = cpu_to_le32(btv->main.dma + (14<<2));
474 btv->main.cpu[14] = cpu_to_le32(BT848_RISC_JUMP);
475 btv->main.cpu[15] = cpu_to_le32(btv->main.dma + (0<<2));
481 bttv_risc_hook(struct bttv *btv, int slot, struct btcx_riscmem *risc,
485 unsigned long next = btv->main.dma + ((slot+2) << 2);
488 d2printk("%d: risc=%p slot[%d]=NULL\n", btv->c.nr, risc, slot);
489 btv->main.cpu[slot+1] = cpu_to_le32(next);
492 btv->c.nr, risc, slot,
502 btv->main.cpu[slot+1] = cpu_to_le32(risc->dma);
507 int bttv_buffer_risc_vbi(struct bttv *btv, struct bttv_buffer *buf)
517 const struct bttv_tvnorm *tvnorm = btv->vbi_fmt.tvnorm;
521 if (btv->vbi_fmt.fmt.count[0] > 0)
522 skip_lines0 = max(0, (btv->vbi_fmt.fmt.start[0] -
524 if (btv->vbi_fmt.fmt.count[1] > 0)
525 skip_lines1 = max(0, (btv->vbi_fmt.fmt.start[1] -
528 if (btv->vbi_fmt.fmt.count[0] > 0) {
529 r = bttv_risc_packed(btv, &buf->top, list, 0, bpl, padding,
530 skip_lines0, btv->vbi_fmt.fmt.count[0]);
535 if (btv->vbi_fmt.fmt.count[1] > 0) {
536 offset = btv->vbi_fmt.fmt.count[0] * VBI_BPL;
537 r = bttv_risc_packed(btv, &buf->bottom, list, offset, bpl,
539 btv->vbi_fmt.fmt.count[1]);
544 if (btv->vbi_fmt.end >= tvnorm->cropcap.bounds.top)
545 min_vdelay += btv->vbi_fmt.end - tvnorm->cropcap.bounds.top;
554 bttv_buffer_activate_vbi(struct bttv *btv,
586 if (btv->vbi_count[0] > 0) {
591 if (btv->vbi_count[1] > 0) {
598 bttv_risc_hook(btv, RISC_SLOT_O_VBI, top, top_irq_flags);
599 bttv_risc_hook(btv, RISC_SLOT_E_VBI, bottom, bottom_irq_flags);
605 bttv_buffer_activate_video(struct bttv *btv,
619 bttv_apply_geo(btv, &set->top->geo, 1);
620 bttv_apply_geo(btv, &set->bottom->geo,0);
621 bttv_risc_hook(btv, RISC_SLOT_O_FIELD, &set->top->top,
623 bttv_risc_hook(btv, RISC_SLOT_E_FIELD, &set->bottom->bottom,
632 bttv_apply_geo(btv, &set->top->geo,1);
633 bttv_apply_geo(btv, &set->top->geo,0);
634 bttv_risc_hook(btv, RISC_SLOT_O_FIELD, &set->top->top,
636 bttv_risc_hook(btv, RISC_SLOT_E_FIELD, NULL, 0);
642 bttv_apply_geo(btv, &set->bottom->geo,1);
643 bttv_apply_geo(btv, &set->bottom->geo,0);
644 bttv_risc_hook(btv, RISC_SLOT_O_FIELD, NULL, 0);
645 bttv_risc_hook(btv, RISC_SLOT_E_FIELD, &set->bottom->bottom,
650 bttv_risc_hook(btv, RISC_SLOT_O_FIELD, NULL, 0);
651 bttv_risc_hook(btv, RISC_SLOT_E_FIELD, NULL, 0);
660 bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
663 const struct bttv_tvnorm *tvnorm = bttv_tvnorms + btv->tvnorm;
666 unsigned long size = (btv->fmt->depth * btv->width * btv->height) >> 3;
669 if (btv->fmt->flags & FORMAT_FLAGS_PACKED) {
670 int bpl = (btv->fmt->depth >> 3) * btv->width;
671 int bpf = bpl * (btv->height >> 1);
673 bttv_calc_geo(btv, &buf->geo, btv->width, btv->height,
675 &btv->crop[!!btv->do_crop].rect);
678 r = bttv_risc_packed(btv, &buf->top, list, 0, bpl, 0,
679 0, btv->height);
682 r = bttv_risc_packed(btv, &buf->bottom, list, 0, bpl,
683 0, 0, btv->height);
686 r = bttv_risc_packed(btv, &buf->top, list, 0, bpl,
687 bpl, 0, btv->height >> 1);
688 r = bttv_risc_packed(btv, &buf->bottom, list, bpl,
689 bpl, bpl, 0, btv->height >> 1);
692 r = bttv_risc_packed(btv, &buf->top, list, 0, bpl, 0,
693 0, btv->height >> 1);
694 r = bttv_risc_packed(btv, &buf->bottom, list, bpf,
695 bpl, 0, 0, btv->height >> 1);
703 if (btv->fmt->flags & FORMAT_FLAGS_PLANAR) {
708 uoffset = btv->width * btv->height;
709 voffset = btv->width * btv->height;
710 if (btv->fmt->flags & FORMAT_FLAGS_CrCb) {
712 uoffset >>= btv->fmt->hshift;
713 uoffset >>= btv->fmt->vshift;
717 voffset >>= btv->fmt->hshift;
718 voffset >>= btv->fmt->vshift;
723 bttv_calc_geo(btv, &buf->geo, btv->width, btv->height,
725 &btv->crop[!!btv->do_crop].rect);
726 r = bttv_risc_planar(btv, &buf->top, list, 0,
727 btv->width, 0, btv->height,
729 btv->fmt->hshift,
730 btv->fmt->vshift, 0);
733 bttv_calc_geo(btv, &buf->geo, btv->width, btv->height,
735 &btv->crop[!!btv->do_crop].rect);
736 r = bttv_risc_planar(btv, &buf->bottom, list, 0,
737 btv->width, 0, btv->height,
739 btv->fmt->hshift,
740 btv->fmt->vshift, 0);
743 bttv_calc_geo(btv, &buf->geo, btv->width, btv->height,
745 &btv->crop[!!btv->do_crop].rect);
746 lines = btv->height >> 1;
747 ypadding = btv->width;
748 cpadding = btv->width >> btv->fmt->hshift;
749 r = bttv_risc_planar(btv, &buf->top, list, 0,
750 btv->width, ypadding, lines,
752 btv->fmt->hshift,
753 btv->fmt->vshift, cpadding);
755 r = bttv_risc_planar(btv, &buf->bottom, list,
756 ypadding, btv->width, ypadding,
759 btv->fmt->hshift,
760 btv->fmt->vshift, cpadding);
763 bttv_calc_geo(btv, &buf->geo, btv->width, btv->height,
765 &btv->crop[!!btv->do_crop].rect);
766 lines = btv->height >> 1;
767 ypadding = btv->width;
768 cpadding = btv->width >> btv->fmt->hshift;
769 r = bttv_risc_planar(btv, &buf->top, list, 0,
770 btv->width, 0, lines,
772 btv->fmt->hshift,
773 btv->fmt->vshift, 0);
774 r = bttv_risc_planar(btv, &buf->bottom, list,
776 btv->width, 0, lines,
779 btv->fmt->hshift,
780 btv->fmt->vshift, 0);
788 if (btv->fmt->flags & FORMAT_FLAGS_RAW) {
791 bttv_calc_geo(btv, &buf->geo, tvnorm->swidth, tvnorm->sheight,
792 1, tvnorm, &btv->crop[!!btv->do_crop].rect);
793 r = bttv_risc_packed(btv, &buf->top, list, 0, RAW_BPL, 0, 0,
795 r = bttv_risc_packed(btv, &buf->bottom, list, size / 2,
800 buf->btformat = btv->fmt->btformat;
801 buf->btswap = btv->fmt->btswap;