没有合适的资源?快使用搜索试试~ 我知道了~
首页writing-an-alsa-driver.pdf
writing-an-alsa-driver.pdf
需积分: 9 8 下载量 102 浏览量
更新于2023-03-03
评论
收藏 714KB PDF 举报
how to write linux alsa audio driver.
资源详情
资源评论
资源推荐
Writing an ALSA Driver
Takashi Iwai
tiwai@suse.de
Writing an ALSA Driver
by Takashi Iwai
0.3.6 Edition
This document describes how to write an ALSA (Advanced Linux Sound Architecture) driver.
Copyright (c) 2002-2005 Takashi Iwai <tiwai@suse.de>
This document is free; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option) any later version.
This document is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Table of Contents
Preface .................................................................................................................................................... viii
1. File Tree Structure.................................................................................................................................1
General ...............................................................................................................................................1
core directory .....................................................................................................................................2
core/oss .....................................................................................................................................2
core/ioctl32 ...............................................................................................................................2
core/seq.....................................................................................................................................2
core/seq/oss...............................................................................................................................2
core/seq/instr.............................................................................................................................2
include directory ................................................................................................................................2
drivers directory .................................................................................................................................2
drivers/mpu401 .........................................................................................................................3
drivers/opl3 and opl4 ................................................................................................................3
i2c directory .......................................................................................................................................3
i2c/l3 .........................................................................................................................................3
synth directory....................................................................................................................................3
pci directory .......................................................................................................................................3
isa directory........................................................................................................................................3
arm, ppc, and sparc directories ......................................... ..................................................................4
usb directory.......................................................................................................................................4
pcmcia directory.................................................................................................................................4
oss directory .......................................................................................................................................4
2. Basic Flow for PCI Drivers ...................................................................................................................5
Outline................................................................................................................................................5
Full Code Example.............................................................................................................................5
Constructor.........................................................................................................................................8
1) Check and increment the device index.................................................................................8
2) Create a card instance...........................................................................................................8
3) Create a main component.....................................................................................................8
4) Set the driver ID and name strings. ......................................................................................9
5) Create other components, such as mixer, MIDI, etc. ...........................................................9
6) Register the card instance.....................................................................................................9
7) Set the PCI driver data and return zero. ...............................................................................9
Destructor.........................................................................................................................................10
Header Files .....................................................................................................................................10
3. Management of Cards and Components ...........................................................................................11
Card Instance....................................................................................................................................11
Components .....................................................................................................................................11
Chip-Specific Data ...........................................................................................................................12
1. Allocating via snd_card_new(). .....................................................................................12
2. Allocating an extra device. .................................................................................................12
Registration and Release ..................................................................................................................13
iii
4. PCI Resource Managements...............................................................................................................15
Full Code Example...........................................................................................................................15
Some Hafta’s ....................................................................................................................................17
Resource Allocation.........................................................................................................................18
Registration of Device Struct ...........................................................................................................21
PCI Entries .......................................................................................................................................21
5. PCM Interface......................................................................................................................................23
General .............................................................................................................................................23
Full Code Example...........................................................................................................................23
Constructor.......................................................................................................................................27
... And the Destructor? .....................................................................................................................29
Runtime Pointer - The Chest of PCM Information..........................................................................29
Hardware Description.............................................................................................................31
PCM Configurations...............................................................................................................33
DMA Buffer Information .......................................................................................................34
Running Status........................................................................................................................34
Private Data ............................................................................................................................34
Interrupt Callbacks .................................................................................................................35
Operators..........................................................................................................................................35
open callback ..........................................................................................................................35
close callback..........................................................................................................................36
ioctl callback...........................................................................................................................36
hw_params callback ...............................................................................................................36
hw_free callback.....................................................................................................................37
prepare callback......................................................................................................................37
trigger callback .......................................................................................................................38
pointer callback ......................................................................................................................38
copy and silence callbacks......................................................................................................39
ack callback ............................................................................................................................39
page callback ..........................................................................................................................39
Interrupt Handler..............................................................................................................................39
Interrupts at the period (fragment) boundary .........................................................................40
High-frequent timer interrupts................................................................................................40
On calling snd_pcm_period_elapsed() ..........................................................................41
Atomicity .........................................................................................................................................41
Constraints .......................................................................................................................................42
6. Control Interface .................................................................................................................................45
General .............................................................................................................................................45
Definition of Controls ......................................................................................................................45
Control Names ................................................................. ................................................................46
Global capture and playback ..................................................................................................46
Tone-controls ..........................................................................................................................46
3D controls .............................................................................................................................46
Mic boost ................................................................................................................................46
Access Flags.....................................................................................................................................47
Callbacks..........................................................................................................................................47
info callback ...........................................................................................................................47
iv
get callback.............................................................................................................................48
put callback.............................................................................................................................49
Callbacks are not atomic ........................................................................................................49
Constructor.......................................................................................................................................49
Change Notification ......................................................... ................................................................50
7. API for AC97 Codec ............................................................................................................................51
General .............................................................................................................................................51
Full Code Example...........................................................................................................................51
Constructor.......................................................................................................................................52
Callbacks..........................................................................................................................................52
Updating Registers in The Driver ....................................................................................................53
Clock Adjustment ............................................................................................................................54
Proc Files..........................................................................................................................................54
Multiple Codecs ...............................................................................................................................54
8. MIDI (MPU401-UART) Interface ......................................................................................................55
General .............................................................................................................................................55
Constructor.......................................................................................................................................55
Interrupt Handler..............................................................................................................................56
9. RawMIDI Interface .............................................................................................................................57
Overview ..........................................................................................................................................57
Constructor.......................................................................................................................................57
Callbacks..........................................................................................................................................58
open callback .........................................................................................................................58
close callback .......................................................................................................................58
trigger callback for output substreams ...............................................................................59
trigger callback for input substreams .................................................................................60
drain callback .......................................................................................................................60
10. Miscellaneous Devices .......................................................................................................................61
FM OPL3 .........................................................................................................................................61
Hardware-Dependent Devices..........................................................................................................62
IEC958 (S/PDIF)..............................................................................................................................62
11. Buffer and Memory Management....................................................................................................64
Buffer Types.....................................................................................................................................64
External Hardware Buffers...............................................................................................................64
Non-Contiguous Buffers ..................................................................................................................66
Vmalloc’ed Buffers..........................................................................................................................67
12. Proc Interface.....................................................................................................................................68
13. Power Management ...........................................................................................................................70
14. Module Parameters ...........................................................................................................................74
15. How To Put Your Driver Into ALSA Tree.......................................................................................75
General .............................................................................................................................................75
Driver with A Single Source File.....................................................................................................75
Drivers with Several Source Files ....................................................................................................76
v
剩余85页未读,继续阅读
kuishi
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- 2022年中国足球球迷营销价值报告.pdf
- 房地产培训 -营销总每天在干嘛.pptx
- 黄色简约实用介绍_汇报PPT模板.pptx
- 嵌入式系统原理及应用:第三章 ARM编程简介_3.pdf
- 多媒体应用系统.pptx
- 黄灰配色简约设计精美大气商务汇报PPT模板.pptx
- 用matlab绘制差分方程Z变换-反变换-zplane-residuez-tf2zp-zp2tf-tf2sos-sos2tf-幅相频谱等等.docx
- 网络营销策略-网络营销团队的建立.docx
- 电子商务示范企业申请报告.doc
- 淡雅灰低面风背景完整框架创业商业计划书PPT模板.pptx
- 计算模型与算法技术:10-Iterative Improvement.ppt
- 计算模型与算法技术:9-Greedy Technique.ppt
- 计算模型与算法技术:6-Transform-and-Conquer.ppt
- 云服务安全风险分析研究.pdf
- 软件工程笔记(完整版).doc
- 电子商务网项目实例规划书.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0