Lines Matching refs:db

704 static void dealloc_dmabuf(struct sv_state *s, struct dmabuf *db)  in dealloc_dmabuf()  argument
708 if (db->rawbuf) { in dealloc_dmabuf()
710 pend = virt_to_page(db->rawbuf + (PAGE_SIZE << db->buforder) - 1); in dealloc_dmabuf()
711 for (page = virt_to_page(db->rawbuf); page <= pend; page++) in dealloc_dmabuf()
713 pci_free_consistent(s->dev, PAGE_SIZE << db->buforder, db->rawbuf, db->dmaaddr); in dealloc_dmabuf()
715 db->rawbuf = NULL; in dealloc_dmabuf()
716 db->mapped = db->ready = 0; in dealloc_dmabuf()
724 struct dmabuf *db = rec ? &s->dma_adc : &s->dma_dac; in prog_dmabuf() local
745 db->hwptr = db->swptr = db->total_bytes = db->count = db->error = db->endcleared = 0; in prog_dmabuf()
746 if (!db->rawbuf) { in prog_dmabuf()
747 db->ready = db->mapped = 0; in prog_dmabuf()
749 if ((db->rawbuf = pci_alloc_consistent(s->dev, PAGE_SIZE << order, &db->dmaaddr))) in prog_dmabuf()
751 if (!db->rawbuf) in prog_dmabuf()
753 db->buforder = order; in prog_dmabuf()
754 …if ((virt_to_bus(db->rawbuf) ^ (virt_to_bus(db->rawbuf) + (PAGE_SIZE << db->buforder) - 1)) & ~0xf… in prog_dmabuf()
756 virt_to_bus(db->rawbuf), PAGE_SIZE << db->buforder); in prog_dmabuf()
757 if ((virt_to_bus(db->rawbuf) + (PAGE_SIZE << db->buforder) - 1) & ~0xffffff) in prog_dmabuf()
759 virt_to_bus(db->rawbuf), PAGE_SIZE << db->buforder); in prog_dmabuf()
761 pend = virt_to_page(db->rawbuf + (PAGE_SIZE << db->buforder) - 1); in prog_dmabuf()
762 for (page = virt_to_page(db->rawbuf); page <= pend; page++) in prog_dmabuf()
766 bufs = PAGE_SIZE << db->buforder; in prog_dmabuf()
767 if (db->ossfragshift) { in prog_dmabuf()
768 if ((1000 << db->ossfragshift) < bytepersec) in prog_dmabuf()
769 db->fragshift = ld2(bytepersec/1000); in prog_dmabuf()
771 db->fragshift = db->ossfragshift; in prog_dmabuf()
773 db->fragshift = ld2(bytepersec/100/(db->subdivision ? db->subdivision : 1)); in prog_dmabuf()
774 if (db->fragshift < 3) in prog_dmabuf()
775 db->fragshift = 3; in prog_dmabuf()
777 db->numfrag = bufs >> db->fragshift; in prog_dmabuf()
778 while (db->numfrag < 4 && db->fragshift > 3) { in prog_dmabuf()
779 db->fragshift--; in prog_dmabuf()
780 db->numfrag = bufs >> db->fragshift; in prog_dmabuf()
782 db->fragsize = 1 << db->fragshift; in prog_dmabuf()
783 if (db->ossmaxfrags >= 4 && db->ossmaxfrags < db->numfrag) in prog_dmabuf()
784 db->numfrag = db->ossmaxfrags; in prog_dmabuf()
785 db->fragsamples = db->fragsize >> sample_shift[fmt]; in prog_dmabuf()
786 db->dmasize = db->numfrag << db->fragshift; in prog_dmabuf()
787 memset(db->rawbuf, (fmt & SV_CFMT_16BIT) ? 0 : 0x80, db->dmasize); in prog_dmabuf()
790 set_dmac(s, db->dmaaddr, db->numfrag << db->fragshift); in prog_dmabuf()
792 wrindir(s, SV_CIDMACBASECOUNT1, (db->fragsamples-1) >> 8); in prog_dmabuf()
793 wrindir(s, SV_CIDMACBASECOUNT0, db->fragsamples-1); in prog_dmabuf()
795 set_dmaa(s, db->dmaaddr, db->numfrag << db->fragshift); in prog_dmabuf()
797 wrindir(s, SV_CIDMAABASECOUNT1, (db->fragsamples-1) >> 8); in prog_dmabuf()
798 wrindir(s, SV_CIDMAABASECOUNT0, db->fragsamples-1); in prog_dmabuf()
801 db->enabled = 1; in prog_dmabuf()
802 db->ready = 1; in prog_dmabuf()
1530 struct dmabuf *db; in sv_mmap() local
1539 db = &s->dma_dac; in sv_mmap()
1543 db = &s->dma_adc; in sv_mmap()
1550 if (size > (PAGE_SIZE << db->buforder)) in sv_mmap()
1553 if (remap_page_range(vma->vm_start, virt_to_phys(db->rawbuf), size, vma->vm_page_prot)) in sv_mmap()
1555 db->mapped = 1; in sv_mmap()