openvortex-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Openvortex-dev] re-setup dma pointers before resume


From: Wilfried Weissmann
Subject: [Openvortex-dev] re-setup dma pointers before resume
Date: Sun, 14 Dec 2003 14:30:04 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020623 Debian/1.0.0-0.woody.1

hi,

attached is a patch that fixes the messed up periods after resuming a halted audio stream playback. somehow the dma pointer got wrong and all the attached patch does is to re-write the 4 dma pointers. that should fix my problems with speakfreely. however mu_law is still messed up at a rate of 10-32 kHz.

the soundbyte program that i have sent you works now fine with a fragment count of 0x7fff and 4. please consider to apply this patch.

greetings,
wilfried
diff -urp alsa-driver-1.0.0rc1/pci/au88x0/au88x0.h 
alsa-driver-1.0.0rc1-ww2/pci/au88x0/au88x0.h
--- alsa-driver-1.0.0rc1/pci/au88x0/au88x0.h    2003-11-21 12:16:33.000000000 
+0100
+++ alsa-driver-1.0.0rc1-ww2/pci/au88x0/au88x0.h        2003-12-13 
18:13:45.000000000 +0100
@@ -176,6 +176,8 @@ void vortex_adbdma_resumefifo(vortex_t *
 void vortex_wtdma_pausefifo(vortex_t *vortex, int wtdma);
 void vortex_wtdma_resumefifo(vortex_t *vortex, int wtdma);
 
+void vortex_adbdma_resetup(vortex_t *vortex, int adbdma);
+
 int inline vortex_adbdma_getlinearpos(vortex_t *vortex, int adbdma);
 int inline vortex_wtdma_getlinearpos(vortex_t *vortex, int wtdma);
 
diff -urp alsa-driver-1.0.0rc1/pci/au88x0/au88x0_core.c 
alsa-driver-1.0.0rc1-ww2/pci/au88x0/au88x0_core.c
--- alsa-driver-1.0.0rc1/pci/au88x0/au88x0_core.c       2003-11-20 
11:48:03.000000000 +0100
+++ alsa-driver-1.0.0rc1-ww2/pci/au88x0/au88x0_core.c   2003-12-14 
14:05:57.000000000 +0100
@@ -946,6 +946,28 @@ void vortex_adbdma_bufshift(vortex_t *vo
                printk(KERN_INFO "vortex: % d virt=0x%d, real=0x%x, delta = 
%d\n", adbdma, dma->period_virt, dma->period_real, delta);
 }
 
+void vortex_adbdma_resetup(vortex_t *vortex, int adbdma) {
+       stream_t *dma = &vortex->dma_adb[adbdma];
+       int p, pp, i;
+
+       /* refresh hw page table */
+       if (dma->nr_periods > 4) {
+               for (i=0 ; i < 4 && i < dma->nr_periods; i++) {
+                       /* p: audio buffer page index */
+                       p = dma->period_virt + i;
+                       if (p >= dma->nr_periods)
+                               p -= dma->nr_periods;
+                       /* pp: hardware DMA page index. */
+                       pp = dma->period_real + i;
+                       if (pp >= 4)
+                               pp -= 4;
+                       hwwrite(vortex->mmio, VORTEX_ADBDMA_BUFBASE+(((adbdma 
<< 2)+pp) << 2), dma->buf_addr+((dma->period_bytes)*p));
+                       /* Force write thru cache. */
+                       hwread(vortex->mmio, VORTEX_ADBDMA_BUFBASE + (((adbdma 
<< 2)+pp) << 2));
+               }
+       }
+}
+
 void vortex_adbdma_setctrl(vortex_t *vortex, int a, int b, int c, int d, int 
e, int f) {
     //FIXME
 }
diff -urp alsa-driver-1.0.0rc1/pci/au88x0/au88x0_pcm.c 
alsa-driver-1.0.0rc1-ww2/pci/au88x0/au88x0_pcm.c
--- alsa-driver-1.0.0rc1/pci/au88x0/au88x0_pcm.c        2003-10-06 
16:01:05.000000000 +0200
+++ alsa-driver-1.0.0rc1-ww2/pci/au88x0/au88x0_pcm.c    2003-12-13 
18:08:45.000000000 +0100
@@ -236,6 +236,7 @@ static int snd_vortex_pcm_trigger(snd_pc
         //printk(KERN_INFO "vortex: start %d\n", dma);
                if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_WT) {
             stream->fifo_enabled = 1;
+           vortex_adbdma_resetup(chip, dma);
             vortex_adbdma_startfifo(chip, dma);
         } 
 #ifndef CHIP_AU8810            

reply via email to

[Prev in Thread] Current Thread [Next in Thread]