linux-2.6.33/snd_pcm_lib_writev_transfer()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#p0906ef6]
#backlinks
*説明 [#uecf4553]
-パス: [[linux-2.6.33/sound/core/pcm_lib.c]]
-FIXME: これは何?
--説明
**引数 [#i75451f8]
-struct snd_pcm_substream *substream
--
--[[linux-2.6.33/snd_pcm_substream]]
-unsigned int hwoff
--
-unsigned long data
--
-unsigned int off
--
-snd_pcm_uframes_t frames
--
--[[linux-2.6.33/snd_pcm_uframes_t]]
**返り値 [#rec06036]
-int
**参考 [#j63768f3]
*実装 [#e0b03ce9]
static int snd_pcm_lib_writev_transfer(struct snd_pcm_su...
unsigned int hwoff,
unsigned long data, unsigned int off,
snd_pcm_uframes_t frames)
{
struct snd_pcm_runtime *runtime = substream->runtime;
int err;
void __user **bufs = (void __user **)data;
int channels = runtime->channels;
int c;
-
--[[linux-2.6.33/snd_pcm_runtime]]
if (substream->ops->copy) {
if (snd_BUG_ON(!substream->ops->silence))
return -EINVAL;
-
--substream->ops は snd_pcm_ops 型のメンバ
--[[linux-2.6.33/snd_pcm_ops]]
-
--[[linux-2.6.33/snd_BUG_ON()]]
for (c = 0; c < channels; ++c, ++bufs) {
if (*bufs == NULL) {
if ((err = substream->ops->silence(substream, c, hwo...
return err;
} else {
char __user *buf = *bufs + samples_to_bytes(runtime,...
if ((err = substream->ops->copy(substream, c, hwoff,...
return err;
}
}
-
--substream->ops は snd_pcm_ops 型のメンバ
--[[linux-2.6.33/snd_pcm_ops]]
} else {
/* default transfer behaviour */
size_t dma_csize = runtime->dma_bytes / channels;
for (c = 0; c < channels; ++c, ++bufs) {
char *hwbuf = runtime->dma_area + (c * dma_csize) + s...
if (*bufs == NULL) {
snd_pcm_format_set_silence(runtime->format, hwbuf, f...
} else {
char __user *buf = *bufs + samples_to_bytes(runtime,...
if (copy_from_user(hwbuf, buf, samples_to_bytes(runt...
return -EFAULT;
}
}
-
--[[linux-2.6.33/samples_to_bytes()]]
-
--[[linux-2.6.33/snd_pcm_format_set_silence()]]
-
--[[linux-2.6.33/copy_from_user()]]
}
return 0;
}
*コメント [#h0b8c8a8]
終了行:
*参照元 [#p0906ef6]
#backlinks
*説明 [#uecf4553]
-パス: [[linux-2.6.33/sound/core/pcm_lib.c]]
-FIXME: これは何?
--説明
**引数 [#i75451f8]
-struct snd_pcm_substream *substream
--
--[[linux-2.6.33/snd_pcm_substream]]
-unsigned int hwoff
--
-unsigned long data
--
-unsigned int off
--
-snd_pcm_uframes_t frames
--
--[[linux-2.6.33/snd_pcm_uframes_t]]
**返り値 [#rec06036]
-int
**参考 [#j63768f3]
*実装 [#e0b03ce9]
static int snd_pcm_lib_writev_transfer(struct snd_pcm_su...
unsigned int hwoff,
unsigned long data, unsigned int off,
snd_pcm_uframes_t frames)
{
struct snd_pcm_runtime *runtime = substream->runtime;
int err;
void __user **bufs = (void __user **)data;
int channels = runtime->channels;
int c;
-
--[[linux-2.6.33/snd_pcm_runtime]]
if (substream->ops->copy) {
if (snd_BUG_ON(!substream->ops->silence))
return -EINVAL;
-
--substream->ops は snd_pcm_ops 型のメンバ
--[[linux-2.6.33/snd_pcm_ops]]
-
--[[linux-2.6.33/snd_BUG_ON()]]
for (c = 0; c < channels; ++c, ++bufs) {
if (*bufs == NULL) {
if ((err = substream->ops->silence(substream, c, hwo...
return err;
} else {
char __user *buf = *bufs + samples_to_bytes(runtime,...
if ((err = substream->ops->copy(substream, c, hwoff,...
return err;
}
}
-
--substream->ops は snd_pcm_ops 型のメンバ
--[[linux-2.6.33/snd_pcm_ops]]
} else {
/* default transfer behaviour */
size_t dma_csize = runtime->dma_bytes / channels;
for (c = 0; c < channels; ++c, ++bufs) {
char *hwbuf = runtime->dma_area + (c * dma_csize) + s...
if (*bufs == NULL) {
snd_pcm_format_set_silence(runtime->format, hwbuf, f...
} else {
char __user *buf = *bufs + samples_to_bytes(runtime,...
if (copy_from_user(hwbuf, buf, samples_to_bytes(runt...
return -EFAULT;
}
}
-
--[[linux-2.6.33/samples_to_bytes()]]
-
--[[linux-2.6.33/snd_pcm_format_set_silence()]]
-
--[[linux-2.6.33/copy_from_user()]]
}
return 0;
}
*コメント [#h0b8c8a8]
ページ名: