*参照元 [#sd1369a8]
#backlinks

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

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


**引数 [#b7290e45]
-struct snd_card *card
--
--[[linux-2.6.33/snd_card]]
-const char *id
--
-int device
--
-int playback_count
--
-int capture_count
--
-struct snd_pcm ** rpcm
--
--[[linux-2.6.33/snd_pcm]]


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


**参考 [#lbe92a68]


*実装 [#k858eb66]
 /**
  * snd_pcm_new - create a new PCM instance
  * @card: the card instance
  * @id: the id string
  * @device: the device index (zero based)
  * @playback_count: the number of substreams for playback
  * @capture_count: the number of substreams for capture
  * @rpcm: the pointer to store the new pcm instance
  *
  * Creates a new PCM instance.
  *
  * The pcm operators have to be set afterwards to the new instance
  * via snd_pcm_set_ops().
  *
  * Returns zero if successful, or a negative error code on failure.
  */
 int snd_pcm_new(struct snd_card *card, const char *id, int device,
 		int playback_count, int capture_count,
 	        struct snd_pcm ** rpcm)
 {
 	struct snd_pcm *pcm;
 	int err;
 	static struct snd_device_ops ops = {
 		.dev_free = snd_pcm_dev_free,
 		.dev_register =	snd_pcm_dev_register,
 		.dev_disconnect = snd_pcm_dev_disconnect,
 	};
 
-
--[[linux-2.6.33/snd_device_ops]]
-
--[[linux-2.6.33/snd_pcm_dev_free()]]
-
--[[linux-2.6.33/snd_pcm_dev_register()]]
-
--[[linux-2.6.33/snd_pcm_dev_disconnect()]]

 	if (snd_BUG_ON(!card))
 		return -ENXIO;
 	if (rpcm)
 		*rpcm = NULL;
-
--[[linux-2.6.33/snd_BUG_ON()]]

 	pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
 	if (pcm == NULL) {
 		snd_printk(KERN_ERR "Cannot allocate PCM\n");
 		return -ENOMEM;
 	}
-
--[[linux-2.6.33/kzalloc()]]
-
--[[linux-2.6.33/GFP_KERNEL]]
-
--[[linux-2.6.33/snd_printk()]]

 	pcm->card = card;
 	pcm->device = device;
 	if (id)
 		strlcpy(pcm->id, id, sizeof(pcm->id));
 	if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK, playback_count)) < 0) {
 		snd_pcm_free(pcm);
 		return err;
 	}
-
--[[linux-2.6.33/strlcpy()]]
-
--[[linux-2.6.33/snd_pcm_new_stream()]]
-
--[[linux-2.6.33/SNDRV_PCM_STREAM_PLAYBACK]]
-
--[[linux-2.6.33/snd_pcm_free()]]

 	if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count)) < 0) {
 		snd_pcm_free(pcm);
 		return err;
 	}
-
--[[linux-2.6.33/SNDRV_PCM_STREAM_CAPTURE]]

 	mutex_init(&pcm->open_mutex);
 	init_waitqueue_head(&pcm->open_wait);
 	if ((err = snd_device_new(card, SNDRV_DEV_PCM, pcm, &ops)) < 0) {
 		snd_pcm_free(pcm);
 		return err;
 	}
 	if (rpcm)
 		*rpcm = pcm;
-
--[[linux-2.6.33/mutex_init()]]
-
--[[linux-2.6.33/init_waitqueue_head()]]
-
--[[linux-2.6.33/snd_device_new()]]
-
--[[linux-2.6.33/SNDRV_DEV_PCM]]

 	return 0;
 }
 
 EXPORT_SYMBOL(snd_pcm_new);
-ライセンスに関係なくシンボルを公開する。
--[[linux-2.6.33/EXPORT_SYMBOL()]]


*コメント [#m319ee80]


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