alsa声卡dev_snd_pcmc0d0p的open打开流程

alsa声卡dev_snd_pcmc0d0p的open打开流程

ID:6380378

大小:42.00 KB

页数:10页

时间:2018-01-12

alsa声卡dev_snd_pcmc0d0p的open打开流程_第1页
alsa声卡dev_snd_pcmc0d0p的open打开流程_第2页
alsa声卡dev_snd_pcmc0d0p的open打开流程_第3页
alsa声卡dev_snd_pcmc0d0p的open打开流程_第4页
alsa声卡dev_snd_pcmc0d0p的open打开流程_第5页
资源描述:

《alsa声卡dev_snd_pcmc0d0p的open打开流程》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库

1、alsa声卡/dev/snd/pcmC0D0p的open打开流程  原文地址:http://blog.chinaunix.net/space.php?uid=20564848&do=blog&cuid=2116725aplay.c==>main==>snd_pcm_open(&handle,pcm_name,stream,open_mode);//打开一路pcm,刷新config配置如果是"default",同时type等于SND_CONFIG_TYPE_COMPOUND那么这里对应"empty"staticconstch

2、ar*constbuild_in_pcms[]={   "adpcm","alaw","copy","dmix","file","hooks","hw","ladspa","lfloat",   "linear","meter","mulaw","multi","null","empty","plug","rate","route","share",   "shm","dsnoop","dshare","asym","iec958","softvol","mmap_emul",   NULL};_snd_pcm_empty

3、_open和snd_pcm_open_named_slave==>snd_pcm_open_conf(pcmp,name,root,conf,stream,mode);==>open_func=snd_dlobj_cache_lookup(open_name);将获得lib库中_snd_pcm_empty_open函数   所以open_func将等于_snd_pcm_empty_open       _snd_pcm_empty_open   _snd_pcm_asym_open   _snd_pcm_plug_open

4、   _snd_pcm_softvol_open   _snd_pcm_dmix_open   _snd_pcm_hw_open   ==>snd_pcm_hw_open(pcmp,name,card,device,subdevice,stream,              mode

5、(nonblock?SND_PCM_NONBLOCK:0),              0,sync_ptr_ioctl);==>snd_ctl_hw_openfilename等于"/dev/snd/controlC0"==>snd_ope

6、n_device(filename,fmode);   ctl->ops=&snd_ctl_hw_ops;   ctl->private_data=hw;   ctl->poll_fd=fd;   *handle=ctl;filename等于"/dev/snd/pcmC0D0p"==>fd=snd_open_device(filename,fmode);==>returnsnd_pcm_hw_open_fd(pcmp,name,fd,0,sync_ptr_ioctl);==>snd_pcm_new(&pcm,SND_PCM

7、_TYPE_HW,name,info.stream,mode);   pcm->ops=&snd_pcm_hw_ops;   pcm->fast_ops=&snd_pcm_hw_fast_ops;staticintsnd_pcm_hw_mmap_control(snd_pcm_t*pcm){   snd_pcm_hw_t*hw=pcm->private_data;   void*ptr;   interr;   if(hw->sync_ptr==NULL){//如果还没有mmap,那么执行mmap映射内核空间驱动使用的声音

8、缓冲区      ptr=mmap(NULL,page_align(sizeof(structsndrv_pcm_mmap_control)),           PROT_READ

9、PROT_WRITE,MAP_FILE

10、MAP_SHARED,            hw->fd,SNDRV_PCM_MMAP_OFFSET_CONTROL);      if(ptr==MAP_FAILED

11、

12、ptr==NULL){         err=-errno;         SYSMSG("controlmmapfaile

13、d");         returnerr;      }      hw->mmap_control=ptr;//声卡驱动头部填充了一个结构体sndrv_pcm_mmap_control,类似qvfb显示原理.//structsndrv_pcm_mmap_control{//  sndrv_pcm_

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

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

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