snd_pcm_oss_f_reg
==> snd_pcm_oss_write
==> snd_pcm_oss_write1
==> snd_pcm_oss_write2
==> snd_pcm_oss_write3
==> snd_pcm_lib_write
==> snd_pcm_lib_writel
==> snd_pcm_lib_write_transfer
static int snd_pcm_lib_write_transfer(struct snd_pcm_substream *substream,
unsigned int hwoff,
unsigned long data, unsigned int off,
snd_pcm_uframes_t frames)
{
struct snd_pcm_runtime *runtime = substream->runtime;
int err;
char __user *buf = (char __user *) data + frames_to_bytes(runtime, off);
// 调用copy函数发送数据到dai上
// uda134x_soc_probe
// ==> snd_soc_new_pcms
// ==> soc_new_pcm
// ==> soc_pcm_ops.copy = platform->pcm_ops->copy;
// 这里的platform就是s3c24xx_soc_platform
// struct snd_soc_platform s3c24xx_soc_platform = {
// .name = "s3c24xx-audio",
// .pcm_ops = &s3c24xx_pcm_ops,
// .pcm_new = s3c24xx_pcm_new,
// .pcm_free = s3c24xx_pcm_free_dma_buffers,
//};
// static struct snd_pcm_ops s3c24xx_pcm_ops = {
// .open = s3c24xx_pcm_open,
// .close = s3c24xx_pcm_close,
// .ioctl = snd_pcm_lib_ioctl,
// .hw_params = s3c24xx_pcm_hw_params,
// .hw_free = s3c24xx_pcm_hw_free,
// .prepare = s3c24xx_pcm_prepare,
// .trigger = s3c24xx_pcm_trigger,
// .pointer = s3c24xx_pcm_pointer,
// .mmap = s3c24xx_pcm_mmap,
//};
if (substream->ops->copy) {
if ((err = substream->ops->copy(substream, -1, hwoff, buf, frames)) < 0)
return err;
} else {
// 对于标准的s3c24xx_soc_platform来说,没有提供platform->pcm_ops->copy
// 所以将直接执行下面的copy_from_user将数据拷贝到runtime->dma_area的DMA空间[luther.gliethttp]
char *hwbuf = runtime->dma_area + frames_to_bytes(runtime, hwoff);
if (copy_from_user(hwbuf, buf, frames_to_bytes(runtime, frames)))
return -EFAULT;
}
return 0;
}
阅读(3966) | 评论(0) | 转发(0) |