使用alsa-utils调试ALSA驱动_第1页
使用alsa-utils调试ALSA驱动_第2页
使用alsa-utils调试ALSA驱动_第3页
使用alsa-utils调试ALSA驱动_第4页
使用alsa-utils调试ALSA驱动_第5页
已阅读5页,还剩3页未读 继续免费阅读

付费下载

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、使用 alsa-utils 调试 ALSA 驱动使用 alsa-utils 调试 ALSA 驱动分类: linuxdriver2011-06-24 14:19 2263 人阅读 评论 (0) 收藏 举报2011-06-24 17:35:58 android 下面的 alsa utils 提供三个工具,分别是:alsa_amixer配置alsa_aplay :播放 录制alsa_ctl:store/restore 配置文件,与 asound.conf 有关可 以通过 alsa_XXX -help 查看详细参数+ +alsa_amixer】 / $ alsa_amixer -help Usage:

2、 amixer <options>command Available options: -h,-help this help -c,-cardN select the card -D,-device N select the device, default 'default' -d,-debug debug mode -n,-nocheck do not perform range checking -v,-version print version of this program -q,-quiet be quiet -i,-inactive sh

3、ow also inactive controls -a,-abstract L select abstraction level (none or basic) -s,-stdinRead and execute commands from stdin sequentially Availablecommands: /我们主要使用后面四个scontrols show all mixer simple controls scontents show contents of all mixer simple controls (default command) sset sID P set co

4、ntents for one mixer simple control sget sID get contents for one mixer simple control controls show all controls for given card contents show contents of all controls for given card cset cIDP set control contents for one control cget cID get control contents for one control 【使用方法】 alsa_amixer contr

5、ols : 列出 alsa 驱动里面注册的所有控制接口。这些 controls 是在驱动里面通过 struct snd_kcontrol_new twl4030_snd_controls 定义,函数 static int twl4030_add_controls(struct snd_soc_codec *codec) 来添加的 接口。格式如下:numid=19,iface=MIXER,name='Analog CaptureVolume'alsa_amixer contents : 列出以上接口的详细内容, 格式如下:numid=19,iface=MIXER,name=

6、9;Analog Capture V olume' type=INTEGER,access=rw-R-,values=2,min=0,max=5,step=: values=5,5 | dBscale-min=0.00dB,step=6.00dB,mute=0 以上, numid 是在 注册的时候顺序分配的,其他信息查看驱动里面的数据结构 来了解。我们可以通过两个命令来读取和设置相关参数:cset cID P set control contents for one control cget cID get control contents for one control例如:alsa

7、_amixer cget numid=19,iface=MIXER,name='AnalogCapture Volume' alsa_amixer cset numid=19,iface=MIXER,name='AnalogCapture Volume' 5其实,如果通过 alsa_amixer controls 获取到这些 controls 的numid 后,可以直接使用 numid 来操作,结果一样:/ $ alsa_amixer cget numid=19 numid=19,iface=MIXER,name='Analog Capture V ol

8、ume' type=INTEGER,access=rw-R-,values=2,min=0,max=5,step=: values=5,5 | dBscale-min=0.00dB,step=6.00dB,mute=0/ $ alsa_amixer cset numid=19 4 #reg_0x48 =TWL4030_REG_ANAMIC_GAIN : 0x24 numid=19,iface=MIXER,name='Analog Capture V olume' type=INTEGER,access=rw-R-,values=2,min=0,max=5,step= :

9、 values=4,4 | dBscale-min=0.00dB,step=6.00dB,mute=0 + +alsa_aplay】/ $ alsa_aplay -help Usage: aplay OPTION. FILE.-h,-help help -version print current version-l, -list-devices list all soundcards and digital audio devices -L, -list-pcms list-q,device names -D, -device=NAME select PCM by name -quiet q

10、uiet mode -t, -file-type TYPE file type (voc, wav, raw or au) -c, -channels=# channels -f, -format=FORMAT sample format (case insensitive) -r, -rate=# sample rate -d, -duration=# interrupt after # seconds -M, -mmap mmapstream -N, -nonblock nonblocking mode-F, -period-time=# distance between interrup

11、ts is # microseconds -B, -buffer-time=# buffer duration is # microseconds -period-size=# distance between interrupts is # frames -buffer-size=# buffer duration is # frames -A, -avail-min=# min available space for wakeup is # microseconds -R, -start-delay=# delay for automatic PCM start is # microsec

12、onds(relative to buffer size if <= 0)-T, -stop-delay=# delay forautomatic PCM stop is # microseconds from xrun -v,-verbose show PCM structure and setup (accumulative) -V,-vumeter=TYPE enable VU meter (TYPE: mono or stereo)-I,-separate-channels one file for each channel-disable-resample disabl

13、e automatic rate resample-disable-channels disable automatic channel conversions-disable-format disable automatic format conversions-disable-softvol disable software volume control (softvol)-test-position test ring buffer positionRecognized sampleformats are: S8 U8 S16_LE S16_BE U16_LE U16_BE S24_LE

14、S24_BE U24_LE U24_BE S32_LE S32_BE U32_LE U32_BEFLOAT_LE FLOAT_BE FLOAT64_LE FLOAT64_BEIEC958_SUBFRAME_LE IEC958_SUBFRAME_BEMU_LAW A_LAW IMA_ADPCM MPEG GSM SPECIALS24_3LE S24_3BE U24_3LE U24_3BE S20_3LES20_3BEU20_3LE U20_3BE S18_3LE S18_3BE U18_3LESome ofthese may not be available on selected hardwa

15、reTheavailabled format shortcuts are: -f cd (16 bit little endian,44100, stereo) -f cdr (16 bit big endian, 44100, stereo) -f dat(16 bit little endian, 48000, stereo)录音参数 S8 U8 S16_LES16_BE U16_LE U16_B 的详细解释:S 是有符号 U 是无符号BE 是大端LE 是小端这都是 PCM 的一种表示范围的方法,所以表示方法中最小值等价,最大值等价,中间的数据级别就是对应的进度了,可以都映射到 -11 范

16、围。-128127S8: signed 8 bits,有符号字符=char, 表示范围U8: unsigned 8 bits,无符号字符 =unsigned char,表示范围 0255S16_LE: little endian signed 16 bits ,小端有符号字 = short,表示范围 -3276832767S16_BE: big endian signed 16 bits ,大端有符号字 = short 倒序(PPC),表示范围-3276832767U16_LE: little endian unsigned 16 bits ,小端无符号字unsigned short,表示范围

17、 065535U16_BE: big endian unsigned signed 16 bits ,大端无符号字unsigned short倒序(PPC),表示范围 065535还有S24_LE,S32_LE 等,都可以表示数字的方法, PCM 都可以用 这些表示。面这些值中,所有最小值 -128, 0, -32768, -32768, 0, 0 对应PCM 描叙来说都是一个值, 表示最小值, 可以量化到浮点 -1。所有最大值也是一个值,可以量化到浮点 1,其他值可以等比例转换。 example: alsa_aplay -C -t wav -c 2 -r 44100 -f S16_LE -d

18、 10 -v record.wav alsa_aplay record.wav -C: record -t, -file-type TYPE file type (voc, wav, raw or au) -c, -channels=# channels -f, -format=FORMAT sample format (case insensitive) -r, -rate=# sample rate -d, -duration=# interrupt after # seconds -v, -verbose show PCM structure and setup (accumulativ

19、e) + +alsa_ctl】 / $ alsa_ctl -help Usage: alsactl <options> commandAvailable global options: -h,-help this help -d,-debug debug mode -v,-version print version of this programAvailable state options: -f,-file # configuration file (default /etc/asound.state) -F,-force try to restore the

20、matching controls as much as possible (default mode) -g,-ignore ignore 'No soundcards found' error -P,-pedantic do not restoremismatching controls (old default) -I,-no-init-fallbackdon'tinitialize even if restore fails-r,-runstate # save restore and init state to this file (only errors) default settings is 'no file set' -R,-remove remove runstate file at first, otherwise appenderrors Available init options:-E,-env #=# set environment variable for init phase (NAME=V ALUE) -i,-initfile # main configuation file for init phase (default

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论