*参照元 [#cafd319f]
#backlinks

*説明 [#c9320013]
-パス: [[linux-2.6.33/sound/core/pcm_lib.c]]

-FIXME: これは何?
--説明


**引数 [#z249f8f3]
-struct snd_pcm_substream *substream
--
--[[linux-2.6.33/snd_pcm_substream]]
-snd_pcm_uframes_t *availp
--
--[[linux-2.6.33/snd_pcm_uframes_t]]


**返り値 [#ga582bc3]
-int
--


**参考 [#bbe68413]


*実装 [#v00bce9c]
 /*
  * Wait until avail_min data becomes available
  * Returns a negative error code if any error occurs during operation.
  * The available space is stored on availp.  When err = 0 and avail = 0
  * on the capture stream, it indicates the stream is in DRAINING state.
  */
 static int wait_for_avail_min(struct snd_pcm_substream *substream,
 			      snd_pcm_uframes_t *availp)
 {
 	struct snd_pcm_runtime *runtime = substream->runtime;
 	int is_playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
 	wait_queue_t wait;
 	int err = 0;
 	snd_pcm_uframes_t avail = 0;
 	long tout;
 
-
--[[linux-2.6.33/snd_pcm_runtime]]
-
--[[linux-2.6.33/SNDRV_PCM_STREAM_PLAYBACK]]

 	init_waitqueue_entry(&wait, current);
 	add_wait_queue(&runtime->sleep, &wait);
-
--[[linux-2.6.33/init_waitqueue_entry()]]
-
--[[linux-2.6.33/current(global)]]
-
--[[linux-2.6.33/add_wait_queue()]]

 	for (;;) {
 		if (signal_pending(current)) {
 			err = -ERESTARTSYS;
 			break;
 		}
-
--[[linux-2.6.33/signal_pending()]]

 		set_current_state(TASK_INTERRUPTIBLE);
 		snd_pcm_stream_unlock_irq(substream);
 		tout = schedule_timeout(msecs_to_jiffies(10000));
-
--[[linux-2.6.33/set_current_state()]]
-
--[[linux-2.6.33/TASK_INTERRUPTIBLE]]
-
--[[linux-2.6.33/snd_pcm_stream_unlock_irq()]]
-
--[[linux-2.6.33/schedule_timeout()]]
-
--[[linux-2.6.33/msecs_to_jiffies()]]

 		snd_pcm_stream_lock_irq(substream);
-
--[[linux-2.6.33/snd_pcm_stream_lock_irq()]]

 		switch (runtime->status->state) {
 		case SNDRV_PCM_STATE_SUSPENDED:
-
--[[linux-2.6.33/SNDRV_PCM_STATE_SUSPENDED]]

 			err = -ESTRPIPE;
 			goto _endloop;
 		case SNDRV_PCM_STATE_XRUN:
-
--[[linux-2.6.33/SNDRV_PCM_STATE_XRUN]]

 			err = -EPIPE;
 			goto _endloop;
 		case SNDRV_PCM_STATE_DRAINING:
-
--[[linux-2.6.33/SNDRV_PCM_STATE_DRAINING]]

 			if (is_playback)
 				err = -EPIPE;
 			else 
 				avail = 0; /* indicate draining */
 			goto _endloop;
 		case SNDRV_PCM_STATE_OPEN:
 		case SNDRV_PCM_STATE_SETUP:
 		case SNDRV_PCM_STATE_DISCONNECTED:
-
--[[linux-2.6.33/SNDRV_PCM_STATE_OPEN]]
-
--[[linux-2.6.33/SNDRV_PCM_STATE_SETUP]]
-
--[[linux-2.6.33/SNDRV_PCM_STATE_DISCONNECTED]]

 			err = -EBADFD;
 			goto _endloop;
 		}
 		if (!tout) {
 			snd_printd("%s write error (DMA or IRQ trouble?)\n",
 				   is_playback ? "playback" : "capture");
 			err = -EIO;
 			break;
 		}
-
--[[linux-2.6.33/snd_printd()]]

 		if (is_playback)
 			avail = snd_pcm_playback_avail(runtime);
 		else
 			avail = snd_pcm_capture_avail(runtime);
-
--[[linux-2.6.33/snd_pcm_playback_avail()]]
-
--[[linux-2.6.33/snd_pcm_capture_avail()]]

 		if (avail >= runtime->control->avail_min)
 			break;
 	}
  _endloop:
 	remove_wait_queue(&runtime->sleep, &wait);
 	*availp = avail;
 	return err;
-
--[[linux-2.6.33/remove_wait_queue()]]

 }


*コメント [#cc265c60]


トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS