- PC 관련 설정 및 ALSA PC에서 설치
https://en.wikipedia.org/wiki/Advanced_Linux_Sound_Architecture
http://alsa.opensrc.org/ALSA_Setup_Guide
https://wiki.gentoo.org/wiki/ALSA
1.1 ALSA 환경설정 및 관련사이트
ALSA의 환경설정/etc/asound.conf (아직 미확인 및 추후 사용해본후 수정)
- 환경설정 (ALSA 환경설정)
http://www.mjmwired.net/kernel/Documentation/sound/alsa/ALSA-Configuration.txt
- ALSA Project 및 ALSA UTIL 기본사용법
http://www.alsa-project.org/main/index.php/Main_Page
https://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture
1.2 ALSA와 UDEV의 조합
임베디드에서는 잘 사용하지 않겠지만, udev를 이용하여 ALSA 설정을 적용가능한것 같다.
USB를 Sound Card 적용하여 sound card를 등록하여 동적으로 등록하여 사용하는 것 같다.
추후 사용할 기회가 있으면 사용후 완성.
http://alsa.opensrc.org/Udev
2. ALSA 의 기본 확인 사항
ALSA 기본 설정값들의 이해와 XRUN 문제
https://ahyuo79.blogspot.com/2014/04/alsa.html
ALSA device File 확인 , ALSA를 사용한 이후로 부터 /dev 구성은 아래와 같이 구성이 된다. OSS를 사용한다면 구성이 달라진다.
$ ls -l /dev/snd/ /dev/snd/controlC0 /dev/snd/pcmC0D0c /dev/snd/pcmC0D0p /dev/snd/timer ALSA PCM devices to OSS devices mapping ======================================= /dev/snd/pcmC0D0[c|p] -> /dev/audio0 (/dev/audio) -> minor 4 /dev/snd/pcmC0D0[c|p] -> /dev/dsp0 (/dev/dsp) -> minor 3 /dev/snd/pcmC0D1[c|p] -> /dev/adsp0 (/dev/adsp) -> minor 12 /dev/snd/pcmC1D0[c|p] -> /dev/audio1 -> minor 4+16 = 20 /dev/snd/pcmC1D0[c|p] -> /dev/dsp1 -> minor 3+16 = 19 /dev/snd/pcmC1D1[c|p] -> /dev/adsp1 -> minor 12+16 = 28 /dev/snd/pcmC2D0[c|p] -> /dev/audio2 -> minor 4+32 = 36 /dev/snd/pcmC2D0[c|p] -> /dev/dsp2 -> minor 3+32 = 39 /dev/snd/pcmC2D1[c|p] -> /dev/adsp2 -> minor 12+32 = 44
2.2 ALSA의 PROC 구조 및 정보확인
- PROC 기본 구조
/proc/asound/card0/ |-- codec#0 |-- id |-- oss_mixer `-- pcm3p // Channel, Playback, |-- info `-- sub0 |-- hw_params // 만약 동작 중이면, 정보를 볼수 있다. |-- info |-- prealloc |-- prealloc_max |-- status `-- sw_params // 만약 동작 중이면 정보를 볼 수 있다.
ALSA Proc 문서
http://alsa.opensrc.org/Proc_asound_documentation
- ALSA Util을 이용하여 DM368 TEST 및 DEBUG
$ aplay /root/test.wav
$ arecord -f S16_LE -r48000 -c 2 -d 10 /root/test.wav // -f : format , -r samplerate , -c channel , -d time
- ALSA 의 Proc 구성확인 (DM365로 분석)
$ cat /proc/asound/cards 0 [EVM ]: - DaVinci DM365 EVM DaVinci DM365 EVM $ cat /proc/asound/card0/pcm0c/info $ cat /proc/asound/card0/pcm0p/info card: 0 device: 0 subdevice: 0 stream: PLAYBACK id: AIC3X tlv320aic3x-hifi-0 name: subname: subdevice #0 class: 0 subclass: 0 subdevices_count: 1 subdevices_avail: 1 $ cat /proc/asound/card0/pcm0c/sub0/status $ cat /proc/asound/card0/pcm0p/sub0/status state: RUNNING owner_pid : 3893 trigger_time: 3158.514143919 tstamp : 3162.679480670 // time stamp delay : 32768 // buffer_size , latency , now playback avail : 0 // xrun check avail_max : 0 ----- hw_ptr : 0 appl_ptr : 32768 // buffer_size $ cat /proc/asound/card0/pcm0c/sub0/sw_params $ cat /proc/asound/card0/pcm0p/sub0/sw_params tstamp_mode: NONE period_step: 1 avail_min: 2048 start_threshold: 32768 // default setting is buffer size, stop_threshold: 32768 // default setting is buffer size , silence_threshold: 0 silence_size: 0 $ cat /proc/asound/card0/pcm0c/sub0/hw_params $ cat /proc/asound/card0/pcm0p/sub0/hw_params access: RW_INTERLEAVED format: S16_LE subformat: STD channels: 2 // channel check , 2 ch x 16 bit = frame size rate: 48000 (48000/1) period_size: 2048 // 32768/16 = 2048 , buffer_size / periods_min buffer_size: 32768 // 2048 x 16 = 32768 , buffer_bytes_max (128 * 1024) / 4 ( 2ch * 16bit)
관련내용부분
http://www.alsa-project.org/alsa-doc/alsa-lib/group___p_c_m___s_w___params.html
http://alsa.opensrc.org/Aplay
http://furmuwon.egloos.com/m/11090448
3. ALSA UTILS (추후 정리 및 삭제)
요즘 거의 모든 SDK에는 ALSA UTIL과 관련된 Library는 들어가 있다.
물론 Android도 관련부분이 다 있다.
http://www.alsa-project.org/main/index.php/SoundcardTesting
http://www.alsa-project.org/main/index.php/Download
ALSA Util에는 많이 사용하는 Tool 은 aplay,arecord,amixer
http://alsa.opensrc.org/Aplay
hw: 0, 0
cardnumber , device number
aplay -vv -Dhw:0,0 /opt/ipnc/alarm_1_16K.wav
speaker-test
http://forum.falinux.com/zbxe/index.php?document_srl=549296&mid=lecture_tip
https://en.wikibooks.org/wiki/Configuring_Sound_on_Linux/HW_Address
http://www.sabi.co.uk/Notes/linuxSoundALSA.html
cat /proc/asound/card0/pcm0p/sub0/hw_params
$ vi ./sound/soc/davinci/davinci-evm.c
#define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \
SND_SOC_DAIFMT_CBS_CFM | SND_SOC_DAIFMT_IB_NF)
SND_SOC_DAIFMT_CBM_CFS / MCBSP_CLKR
CLKR
DAVINCI_MCBSP_SRGR_CLKSM 0
DAVINCI_MCBSP_PCR_SCLKME 1
SCLKME Bit CLKSM Bit
in PCR in SRGR Input Clock for Sample Rate Generator
0 0 Signal on MCBSP_CLKS pin
0 1 McBSP internal input clock
1 0 Signal on MCBSP_CLKR pin
1 1 Signal on MCBSP_CLKX pin
소스
https://github.com/torvalds/linux/tree/master/sound/soc/codecs
#define SND_SOC_DAIFMT_CBM_CFM (1 << 12) -- codec clk & FRM master --
#define SND_SOC_DAIFMT_CBS_CFM (2 << 12) -- codec clk slave & FRM master --
#define SND_SOC_DAIFMT_CBM_CFS (3 << 12) -- codec clk master & frame slave -
#define SND_SOC_DAIFMT_CBS_CFS (4 << 12) -- codec clk & FRM slave --
http://processors.wiki.ti.com/index.php/Omapl137_linux_audio_driver
http://processors.wiki.ti.com/index.php/DM81xx_AM38xx_Audio_Driver_User_Guide
http://egloos.zum.com/furmuwon/v/10996415
https://developer.ridgerun.com/wiki/index.php/Audio_codec_AIC3x_register_dump
http://crystalcube.co.kr/123
http://alsa.opensrc.org/Aplay
http://furmuwon.egloos.com/m/11090448
3. ALSA UTILS (추후 정리 및 삭제)
요즘 거의 모든 SDK에는 ALSA UTIL과 관련된 Library는 들어가 있다.
물론 Android도 관련부분이 다 있다.
http://www.alsa-project.org/main/index.php/SoundcardTesting
http://www.alsa-project.org/main/index.php/Download
ALSA Util에는 많이 사용하는 Tool 은 aplay,arecord,amixer
http://alsa.opensrc.org/Aplay
hw: 0, 0
cardnumber , device number
aplay -vv -Dhw:0,0 /opt/ipnc/alarm_1_16K.wav
speaker-test
http://forum.falinux.com/zbxe/index.php?document_srl=549296&mid=lecture_tip
https://en.wikibooks.org/wiki/Configuring_Sound_on_Linux/HW_Address
http://www.sabi.co.uk/Notes/linuxSoundALSA.html
cat /proc/asound/card0/pcm0p/sub0/hw_params
$ vi ./sound/soc/davinci/davinci-evm.c
#define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \
SND_SOC_DAIFMT_CBS_CFM | SND_SOC_DAIFMT_IB_NF)
SND_SOC_DAIFMT_CBM_CFS / MCBSP_CLKR
CLKR
DAVINCI_MCBSP_SRGR_CLKSM 0
DAVINCI_MCBSP_PCR_SCLKME 1
SCLKME Bit CLKSM Bit
in PCR in SRGR Input Clock for Sample Rate Generator
0 0 Signal on MCBSP_CLKS pin
0 1 McBSP internal input clock
1 0 Signal on MCBSP_CLKR pin
1 1 Signal on MCBSP_CLKX pin
소스
https://github.com/torvalds/linux/tree/master/sound/soc/codecs
#define SND_SOC_DAIFMT_CBM_CFM (1 << 12) -- codec clk & FRM master --
#define SND_SOC_DAIFMT_CBS_CFM (2 << 12) -- codec clk slave & FRM master --
#define SND_SOC_DAIFMT_CBM_CFS (3 << 12) -- codec clk master & frame slave -
#define SND_SOC_DAIFMT_CBS_CFS (4 << 12) -- codec clk & FRM slave --
http://processors.wiki.ti.com/index.php/Omapl137_linux_audio_driver
http://processors.wiki.ti.com/index.php/DM81xx_AM38xx_Audio_Driver_User_Guide
http://egloos.zum.com/furmuwon/v/10996415
https://developer.ridgerun.com/wiki/index.php/Audio_codec_AIC3x_register_dump
http://crystalcube.co.kr/123
댓글 없음 :
댓글 쓰기