阅读:1493回复:1
alsa-driver与alsa-lib之间 的关系
alsa声卡驱动体系中的alsa-driver与alsa-lib是整个alsa音频驱动的中间层,
alsa app -------------------- alsa lib -------------------- alsa driver -------------------- alsa device driver 上面的alsa app只需要集中注意力到应用逻辑, 下层的alsa device driver也只需要关注如何实现alsa driver要求的接口. 现在我有个问题想请教各位牛人,在lib与driver之间一定会有接口, 但我跟踪了alsa-lib里面的pcm.c里面的snd_pcm_open\snd_pcm_hw_params_any\ snd_pcm_writei等一系统列(用户放音接口)用户接口,但并没有发现与driver层的接口函数。 在网上曾经看到过一些关于这方面的资料,driver为lib提供的接口就是在driver层pcm_native.c里面的文件接口函数 struct file_operations snd_pcm_f_ops[2] = { { .owner = THIS_MODULE, .write = snd_pcm_write, .writev = snd_pcm_writev, .open = snd_pcm_playback_open, .release = snd_pcm_release, .poll = snd_pcm_playback_poll, .unlocked_ioctl = snd_pcm_playback_ioctl, .compat_ioctl = snd_pcm_ioctl_compat, .mmap = snd_pcm_mmap, .fasync = snd_pcm_fasync, }, { .owner = THIS_MODULE, .read = snd_pcm_read, .readv = snd_pcm_readv, .open = snd_pcm_capture_open, .release = snd_pcm_release, .poll = snd_pcm_capture_poll, .unlocked_ioctl = snd_pcm_capture_ioctl, .compat_ioctl = snd_pcm_ioctl_compat, .mmap = snd_pcm_mmap, .fasync = snd_pcm_fasync, } }; 而在lib中是只有Plugin:hw(我自认为是lib中的pcm_hw.c文件)和alsa driver 打交道,其他Plugin(其它的pcm_xxx.c)只需要和Plugin:hw打交道即可. 言下之意就是说,我上面说的pcm.c中的用户接口函数,就是调用lib中的pcm_hw.c中的接口函数 来与alsa-driver发生联系(据我的推断:可能就是通过他们来调用driver中的pcm_native.c中的文件接口)。 这个问题我搞了一周了,主就是没有发现点什么,alsa到底是怎么实现lib与driver之间的接口的呢? |
|
沙发#
发布于:2008-10-22 15:50
oh mygod
|
|