嵌入式学习入门 http://blog.chinaunix.net/u3/117680/showart.php?id=2300212
, 文章——>嵌入式学习入门 全面的讲述学习嵌入式linux中的每个步骤
替换声卡驱动源码。因
linux-2.6.31中版本为1.0.20的声卡驱动有bug,在播放音视频时会出现断断续续的现象,所以我们先用早期版本1.0.18a替换之(可在linux-2.6.29.xxx的内核中提取),具体操作如下:
#cp -rf /linux-2.6.29.xxx/sound /linux-2.6.31/sound //替换sound目录
#cp -rf /linux-2.6.29.xxx/include/sound /linux-2.6.31/include/sound //替换include/sound目录
#cp -rf /linux-2.6.29.xxx/include/asm-arm /linux-2.6.31/include //复制include/asm-arm目录
#cp -f /linux-2.6.29.xxx/arch/arm/mach-s3c2410/include/mach/audio.h /linux-2.6.31/arch/arm/mach-s3c2410/include/mach //复制audio.h到相应目录
#gedit /linux-2.6.31/include/linux/proc_fs.h //修改proc_fs.h文件,在第70行添加如下内容
struct module *owner; //因为在sound/core/info.c第159和982行中用到 |
定义并添加声卡设备到系统设备初始化列表中
#gedit arch/arm/plat-s3c24xx/devs.c //定义,添加如下内容
|
#include <mach/regs-gpio.h> #include <sound/s3c24xx_uda134x.h>
/* UDA1341 */ static struct s3c24xx_uda134x_platform_data s3c24xx_uda134x_data = { .l3_clk = S3C2410_GPB4, .l3_data = S3C2410_GPB3, .l3_mode = S3C2410_GPB2, .model = UDA134X_UDA1341, };
struct platform_device s3c_device_uda134x = { .name = "s3c24xx_uda134x", .dev = { .platform_data = &s3c24xx_uda134x_data, } };
EXPORT_SYMBOL(s3c_device_uda134x);
|
#gedit arch/arm/plat-s3c/include/plat/devs.h //声明,添加如下内容
|
extern struct platform_device s3c_device_uda134x;
|
#gedit arch/arm/mach-s3c2440/mach-smdk2440.c //添加到设备列表,红色部分
|
static struct platform_device *smdk2440_devices[] __initdata = { &s3c_device_usb, &s3c_device_sdi, &s3c_device_lcd, &s3c_device_wdt, &s3c_device_i2c0, &s3c_device_iis, &s3c_device_rtc, &s3c_device_dm9000, &s3c_device_uda134x, };
|
3. 配置内核选项
Device Drivers ---> <*> Sound card support ---> --- Sound card support <*> Advanced Linux Sound Architecture ---> --- Advanced Linux Sound Architecture < > Sequencer support <*> OSS Mixer API <*> OSS PCM (digital audio) API [*] OSS PCM (digital audio) API - Include plugin system [ ] Dynamic device file minor numbers [*] Support old ALSA API [*] Verbose procfs contents [*] Verbose printk [ ] Debug [ ] Generic sound devices ---> [ ] ARM sound devices ---> [ ] SPI sound devices ---> [*] USB sound devices ---> <*> ALSA for SoC audio support ---> --- ALSA for SoC audio support <*> SoC Audio for the Samsung S3C24XX chips < > SoC AC97 Audio support for LN2440SBC - ALC650 <*> SoC I2S Audio support UDA134X wired to a S3C24XX < > Build all ASoC CODEC drivers < > Open Sound System (DEPRECATED) --->
|
4. 编译内核并下载到开发板上。可以看到启动信息中声卡设备成功加载
5. 测试声卡设备。先建立设备节点,声卡的主设备号为14。然后使用cat /dev/sound/dsp > /tmp/test.wav进行录音测试,再用cat /tmp/test.wav > /dev/sound/dsp播放录音,操作如图:
阅读(2324) | 评论(0) | 转发(1) |