浅析alsa声卡驱动snd_pcm_start函数-将音频数据真实的发送到外部音频接口硬件

本文深入解析了ALSA声卡驱动中的snd_pcm_start函数,阐述了其如何将音频数据真实地发送到外部音频接口硬件的过程。详细介绍了函数的调用流程,从snd_pcm_action_start到最终的硬件触发操作,包括平台特定的操作如s3c24xx_pcm_ops等,以及如何通过这些操作实现音频数据的高效传输。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

转载自链接:浅析alsa声卡驱动snd_pcm_start函数-将音频数据真实的发送到外部音频接口硬件-gliethttp-ChinaUnix博客 http://blog.chinaunix.net/uid-20564848-id-74236.html


将音频数据真实的发送到外部音频接口硬件
/**
 * snd_pcm_start - start all linked streams
 * @substream: the PCM substream instance
 */
int snd_pcm_start(struct snd_pcm_substream *substream)
{
    // 启动发送,将streams中的所有音频数据递交到硬件[luther.gliethttp]
    // 执行snd_pcm_action_start
    // ==> snd_pcm_do_start
    // ==> substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_START);
    // ==> 即调用soc_pcm_ops.soc_pcm_trigger
    // ==> platform->pcm_ops->trigger
    // ==> 最后调用s3c24xx_pcm_trigger启动s3c24xx处理器的DMA通道发送音频数据到外围接口硬件[luther.gliethttp]
    // 这里的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,
    //};
    return snd_pcm_action(&snd_pcm_action_start, substream,
                  SNDRV_PCM_STATE_RUNNING);
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值