Update of /cvsroot/alsa/alsa-kernel/core/oss
In directory sc8-pr-cvs1:/tmp/cvs-serv20202

Modified Files:
        pcm_oss.c 
Log Message:
Implemented POST ioctl and enhanced OSS_DEBUG sections

Index: pcm_oss.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/oss/pcm_oss.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- pcm_oss.c   2 Jul 2003 12:08:00 -0000       1.37
+++ pcm_oss.c   4 Jul 2003 08:49:53 -0000       1.38
@@ -577,6 +577,12 @@
        while (1) {
                if (runtime->status->state == SNDRV_PCM_STATE_XRUN ||
                    runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
+#ifdef OSS_DEBUG
+                       if (runtime->status->state == SNDRV_PCM_STATE_XRUN)
+                               printk("pcm_oss: write: recovering from XRUN\n");
+                       else
+                               printk("pcm_oss: write: recovering from SUSPEND\n");
+#endif
                        ret = snd_pcm_oss_prepare(substream);
                        if (ret < 0)
                                break;
@@ -606,6 +612,12 @@
        while (1) {
                if (runtime->status->state == SNDRV_PCM_STATE_XRUN ||
                    runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
+#ifdef OSS_DEBUG
+                       if (runtime->status->state == SNDRV_PCM_STATE_XRUN)
+                               printk("pcm_oss: read: recovering from XRUN\n");
+                       else
+                               printk("pcm_oss: read: recovering from SUSPEND\n");
+#endif
                        ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, 
0);
                        if (ret < 0)
                                break;
@@ -643,6 +655,12 @@
        while (1) {
                if (runtime->status->state == SNDRV_PCM_STATE_XRUN ||
                    runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
+#ifdef OSS_DEBUG
+                       if (runtime->status->state == SNDRV_PCM_STATE_XRUN)
+                               printk("pcm_oss: writev: recovering from XRUN\n");
+                       else
+                               printk("pcm_oss: writev: recovering from SUSPEND\n");
+#endif
                        ret = snd_pcm_oss_prepare(substream);
                        if (ret < 0)
                                break;
@@ -673,6 +691,12 @@
        while (1) {
                if (runtime->status->state == SNDRV_PCM_STATE_XRUN ||
                    runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
+#ifdef OSS_DEBUG
+                       if (runtime->status->state == SNDRV_PCM_STATE_XRUN)
+                               printk("pcm_oss: readv: recovering from XRUN\n");
+                       else
+                               printk("pcm_oss: readv: recovering from SUSPEND\n");
+#endif
                        ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, 
0);
                        if (ret < 0)
                                break;
@@ -858,6 +882,22 @@
        return 0;
 }
 
+static int snd_pcm_oss_post(snd_pcm_oss_file_t *pcm_oss_file)
+{
+       snd_pcm_substream_t *substream;
+       int err;
+
+       substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK];
+       if (substream != NULL) {
+               if ((err = snd_pcm_oss_make_ready(substream)) < 0)
+                       return err;
+               snd_pcm_kernel_playback_ioctl(substream, SNDRV_PCM_IOCTL_START, 0);
+       }
+       /* note: all errors from the start action are ignored */
+       /* OSS apps do not know, how to handle them */
+       return 0;
+}
+
 static int snd_pcm_oss_sync(snd_pcm_oss_file_t *pcm_oss_file)
 {
        int err = 0;
@@ -1388,7 +1428,9 @@
                runtime->oss.period++;
        runtime->oss.subdivision = 1;   /* disable SUBDIVIDE */
 #endif
-       // printk("space: bytes = %i, periods = %i, fragstotal = %i, fragsize = %i\n", 
info.bytes, info.periods, info.fragstotal, info.fragsize);
+#ifdef OSS_DEBUG
+       printk("pcm_oss: space: bytes = %i, fragments = %i, fragstotal = %i, fragsize 
= %i\n", info.bytes, info.fragments, info.fragstotal, info.fragsize);
+#endif
        if (copy_to_user(_info, &info, sizeof(info)))
                return -EFAULT;
        return 0;
@@ -1792,8 +1834,8 @@
        case SOUND_PCM_WRITE_FILTER:
        case SOUND_PCM_READ_FILTER:
                return -EIO;
-       case SNDCTL_DSP_POST:   /* to do */
-               return 0;
+       case SNDCTL_DSP_POST:
+               return snd_pcm_oss_post(pcm_oss_file);
        case SNDCTL_DSP_SUBDIVIDE:
                if (get_user(res, (int *)arg))
                        return -EFAULT;



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to