Chinaunix首页 | 论坛 | 博客
  • 博客访问: 15358675
  • 博文数量: 2005
  • 博客积分: 11986
  • 博客等级: 上将
  • 技术积分: 22535
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-17 13:56
文章分类

全部博文(2005)

文章存档

2014年(2)

2013年(2)

2012年(16)

2011年(66)

2010年(368)

2009年(743)

2008年(491)

2007年(317)

分类: LINUX

2009-11-19 13:50:43

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;
}
阅读(3866) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~