linux音频alsa-uda134x驱动分析之十二(pcm)

linux音频alsa-uda134x驱动分析之十二(pcm)

ID:17380960

大小:75.50 KB

页数:9页

时间:2018-08-30

linux音频alsa-uda134x驱动分析之十二(pcm)_第1页
linux音频alsa-uda134x驱动分析之十二(pcm)_第2页
linux音频alsa-uda134x驱动分析之十二(pcm)_第3页
linux音频alsa-uda134x驱动分析之十二(pcm)_第4页
linux音频alsa-uda134x驱动分析之十二(pcm)_第5页
资源描述:

《linux音频alsa-uda134x驱动分析之十二(pcm)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、Codec:音频芯片的控制,比如静音、打开(关闭)ADC(DAC)、设置ADC(DAC)的增益、耳机模式的检测等操作。I2S:数字音频接口,用于CPU和Codec之间的数字音频流rawdata的传输。每当有playback或record操作时,snd_soc_dai_ops.prepare()会被调用,启动I2S总线。PCM:我不知道为什么会取这个模块名,它其实是定义DMA操作的,用于将音频数据通过DMA传到I2S控制器的FIFO中。音频数据流向:RAM--(dma)-->I2SControllerFIFO--(i2s)-->Codec

2、-->Speaker/HeadsetPCM模块初始化调用snd_soc_register_platform()向ALSACore注册一个snd_soc_platform结构体。structsnd_soc_platformloon_soc_platform={.name="loon-pcm-audio",.pcm_ops=&loon_pcm_ops,.pcm_new=loon_pcm_new,.pcm_free=loon_pcm_free_dma_buffers,.suspend=loon_pcm_suspend,.resume=loon

3、_pcm_resume,};structsnd_soc_platformloon_soc_platform={.name="loon-pcm-audio",.pcm_ops=&loon_pcm_ops,.pcm_new=loon_pcm_new,.pcm_free=loon_pcm_free_dma_buffers,.suspend=loon_pcm_suspend,.resume=loon_pcm_resume,};成员pcm_new需要调用dma_alloc_writecombine()给DMA分配一块write-combining

4、的内存空间,并把这块缓冲区的相关信息保存到substream->dma_buffer中,相当于构造函数。pcm_free则相反。这些成员函数都还算简单,看看代码即可以理解其流程。snd_pcm_ops接着我们看一下snd_pcm_ops结构体,该结构体的操作集函数的实现是本模块的主体。structsnd_pcm_ops{int(*open)(structsnd_pcm_substream*substream);int(*close)(structsnd_pcm_substream*substream);int(*ioctl)(struc

5、tsnd_pcm_substream*substream,unsignedintcmd,void*arg);int(*hw_params)(structsnd_pcm_substream*substream,structsnd_pcm_hw_params*params);int(*hw_free)(structsnd_pcm_substream*substream);int(*prepare)(structsnd_pcm_substream*substream);int(*trigger)(structsnd_pcm_substream

6、*substream,intcmd);snd_pcm_uframes_t(*pointer)(structsnd_pcm_substream*substream);int(*copy)(structsnd_pcm_substream*substream,intchannel,snd_pcm_uframes_tpos,void__user*buf,snd_pcm_uframes_tcount);int(*silence)(structsnd_pcm_substream*substream,intchannel,snd_pcm_uframe

7、s_tpos,snd_pcm_uframes_tcount);structpage*(*page)(structsnd_pcm_substream*substream,unsignedlongoffset);int(*mmap)(structsnd_pcm_substream*substream,structvm_area_struct*vma);int(*ack)(structsnd_pcm_substream*substream);};structsnd_pcm_ops{int(*open)(structsnd_pcm_substr

8、eam*substream);int(*close)(structsnd_pcm_substream*substream);int(*ioctl)(structsnd_pcm_substream*subst

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。