Update of /cvsroot/alsa/alsa-kernel/pci/ice1712
In directory sc8-pr-cvs1:/tmp/cvs-serv1202

Modified Files:
        ice1724.c 
Log Message:
use SIZE register to get the current DMA position.
this register seems more reliable than BASE register.



Index: ice1724.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/ice1712/ice1724.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- ice1724.c   16 Aug 2003 09:58:29 -0000      1.16
+++ ice1724.c   10 Sep 2003 16:26:26 -0000      1.17
@@ -482,8 +482,6 @@
        return 0;
 }
 
-#define CHECK_INVALID_PTR
-
 static snd_pcm_uframes_t snd_vt1724_playback_pro_pointer(snd_pcm_substream_t * 
substream)
 {
        ice1712_t *ice = snd_pcm_substream_chip(substream);
@@ -491,20 +489,28 @@
 
        if (!(inl(ICEMT1724(ice, DMA_CONTROL)) & VT1724_PDMA0_START))
                return 0;
+#if 0 /* read PLAYBACK_ADDR */
        ptr = inl(ICEMT1724(ice, PLAYBACK_ADDR));
-#ifdef CHECK_INVALID_PTR
        if (ptr < substream->runtime->dma_addr) {
                snd_printd("ice1724: invalid negative ptr\n");
                return 0;
        }
-#endif
        ptr -= substream->runtime->dma_addr;
        ptr = bytes_to_frames(substream->runtime, ptr);
-#ifdef CHECK_INVALID_PTR
        if (ptr >= substream->runtime->buffer_size) {
                snd_printd("ice1724: invalid ptr %d (size=%d)\n", (int)ptr, 
(int)substream->runtime->period_size);
                return 0;
        }
+#else /* read PLAYBACK_SIZE */
+       ptr = inl(ICEMT1724(ice, PLAYBACK_SIZE)) & 0xffffff;
+       ptr = (ptr + 1) << 2;
+       ptr = bytes_to_frames(substream->runtime, ptr);
+       if (ptr <= substream->runtime->buffer_size)
+               ptr = substream->runtime->buffer_size - ptr;
+       else {
+               snd_printd("ice1724: invalid ptr %d (size=%d)\n", (int)ptr, 
(int)substream->runtime->buffer_size);
+               ptr = 0;
+       }
 #endif
        return ptr;
 }
@@ -536,9 +542,22 @@
 
        if (!(inl(ICEMT1724(ice, DMA_CONTROL)) & reg->start))
                return 0;
+#if 0 /* use ADDR register */
        ptr = inl(ice->profi_port + reg->addr);
        ptr -= substream->runtime->dma_addr;
        return bytes_to_frames(substream->runtime, ptr);
+#else /* use SIZE register */
+       ptr = inw(ice->profi_port + reg->size);
+       ptr = (ptr + 1) << 2;
+       ptr = bytes_to_frames(substream->runtime, ptr);
+       if (ptr <= substream->runtime->buffer_size)
+               ptr = substream->runtime->buffer_size - ptr;
+       else {
+               snd_printd("ice1724: invalid ptr %d (size=%d)\n", (int)ptr, 
(int)substream->runtime->buffer_size);
+               ptr = 0;
+       }
+       return ptr;
+#endif
 }
 
 const static struct vt1724_pcm_reg vt1724_capture_pro_reg = {



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to