Chinaunix首页 | 论坛 | 博客
  • 博客访问: 208707
  • 博文数量: 56
  • 博客积分: 1085
  • 博客等级: 少尉
  • 技术积分: 652
  • 用 户 组: 普通用户
  • 注册时间: 2011-09-29 13:50
文章分类
文章存档

2014年(4)

2012年(25)

2011年(27)

我的朋友

分类: Delphi

2012-06-01 09:36:11

、移植环境
    主  机:Fedora 14 (kernel-2.6.33.7)
    开发板:FL2440(nandflash:K9F1G08 128MB)
    编译器:arm-linux-gcc-4.3.2
 
二、移植步骤
    1. 根据FL2440赠送的光盘资料可以得知,FL2440的声卡是采用PHILIPS公司的UDA1341TS型号的声卡。在没有声卡uda驱动之前,启动开发板,从系统启动信息可以看到声卡跟s3c2440的I2S并没有映射起来。
  1. usbcore: registered new interface driver hiddev
  2. usbcore: registered new interface driver usbhid
  3. usbhid: USB HID core driver
  4. No device for DAI UDA134X
  5. No device for DAI s3c24xx-i2s
  6. ALSA device list:
  7. No soundcards found.
     2. uda驱动的移植也主要是以linux-2.6.33.7内核中自带的驱动程序为主,我只是做少量的修改与配置。打开mach-smdk2440.c文件开始配置。
  1. #vim arch/arm/mach-s3c2440/mach-smdk2440.c
    增加头两个用到的文件:
  1. #include <sound/s3c24xx_uda134x.h>
  2. #include <mach/gpio-fns.h>
    在LCD配置信息结构体后面开始增加声卡配置的结构体:
  1. //uda1341 sound card driver

  2. static struct s3c24xx_uda134x_platform_data s3c24xx_uda134x_data = {
  3.         .l3_clk = S3C2410_GPB(4),
  4.         .l3_data = S3C2410_GPB(3),
  5.         .l3_mode = S3C2410_GPB(2),
  6.         .model = UDA134X_UDA1341,
  7. };
  8. static struct platform_device s3c24xx_uda134x = {
  9.         .name = "s3c24xx_uda134x",
  10.         .dev = {
  11.                 .platform_data = &s3c24xx_uda134x_data,
  12.         }
  13. };
    配置好后,把配置信息加入到平台中:
  1. static struct platform_device *smdk2440_devices[] __initdata = {
  2.         &s3c_device_usb,
  3.         &s3c_device_lcd,
  4.         &s3c_device_wdt,
  5.         &s3c_device_i2c0,
  6.         &s3c_device_iis,
  7.         &s3c_device_rtc,
  8.         &s3c24xx_uda134x, //uda

  9. };
     到这里就基本上完成了配置,剩下的就是配置内核。
     3. 内核各相关项配置如下。
  1. Device Drivers --->
  2.     <*> Sound card support --->
  3.         --- Sound card support
  4.         <*> Advanced Linux Sound Architecture --->
  5.             --- Advanced Linux Sound Architecture
  6.             < > Sequencer support
  7.             <*> OSS Mixer API
  8.             <*> OSS PCM (digital audio) API
  9.             [*] OSS PCM (digital audio) API - Include plugin system
  10.             [ ] Dynamic device file minor numbers
  11.             [*] Support old ALSA API
  12.             [*] Verbose procfs contents
  13.             [*] Verbose printk
  14.             [ ] Debug
  15.             [ ] Generic sound devices --->
  16.             [ ] ARM sound devices --->
  17.             [ ] SPI sound devices --->
  18.             [*] USB sound devices --->
  19.             <*> ALSA for SoC audio support --->
  20.                 --- ALSA for SoC audio support
  21.                 <*> SoC Audio for the Samsung S3C24XX chips
  22.                 < > SoC AC97 Audio support for LN2440SBC - ALC650
  23.                 <*> SoC I2S Audio support UDA134X wired to a S3C24XX
  24.                 < > Build all ASoC CODEC drivers
  25.         < > Open Sound System (DEPRECATED) --->
     4. 编译下载#make zImage。很奇怪的是好像这次配置并没有启动作用,有了LCD和RTC驱动移植的经验,我很快又找到了思路,那就是修改mach-smdk2410.c程序。
  1. #vim arch/arm/mach-s3c2410/mach-smdk2410.c
    增加头两个用到的文件:
  1. #include <sound/s3c24xx_uda134x.h>
  2. #include <mach/gpio-fns.h>
    在LCD配置信息结构体后面开始增加声卡配置的结构体:
  1. //uda1341 sound card driver
  2. static struct s3c24xx_uda134x_platform_data s3c24xx_uda134x_data = {
  3.         .l3_clk = S3C2410_GPB(4),
  4.         .l3_data = S3C2410_GPB(3),
  5.         .l3_mode = S3C2410_GPB(2),
  6.         .model = UDA134X_UDA1341,
  7. };
  8. static struct platform_device s3c24xx_uda134x = {
  9.         .name = "s3c24xx_uda134x",
  10.         .dev = {
  11.                 .platform_data = &s3c24xx_uda134x_data,
  12.         }
  13. };
    配置好后,把配置信息加入到平台中:
  1. static struct platform_device *smdk2410_devices[] __initdata = {
  2.         &s3c_device_usb,
  3.         &s3c_device_lcd,
  4.         &s3c_device_wdt,
  5.         &s3c_device_i2c0,
  6.         &s3c_device_iis,
  7.         &s3c_device_rtc,
  8.         &s3c24xx_uda134x, //uda
  9. };
    编译后出现如下错误:
  1. [skywalker@localhost linux-2.6.33]$ make zImage
  2.   CHK include/linux/version.h
  3.   CHK include/generated/utsrelease.h
  4. make[1]: “include/generated/mach-types.h”是最新的。
  5.   CALL scripts/checksyscalls.sh
  6.   CHK include/generated/compile.h
  7.   CC arch/arm/mach-s3c2410/mach-smdk2410.o
  8. arch/arm/mach-s3c2410/mach-smdk2410.c:134: error: implicit declaration of function `S3C2410_GPB'
  9. arch/arm/mach-s3c2410/mach-smdk2410.c:134: error: initializer element is not constant
  10. arch/arm/mach-s3c2410/mach-smdk2410.c:134: error: (near initialization for `s3c24xx_uda134x_data.l3_clk')
  11. arch/arm/mach-s3c2410/mach-smdk2410.c:135: error: initializer element is not constant
  12. arch/arm/mach-s3c2410/mach-smdk2410.c:135: error: (near initialization for `s3c24xx_uda134x_data.l3_data')
  13. arch/arm/mach-s3c2410/mach-smdk2410.c:136: error: initializer element is not constant
  14. arch/arm/mach-s3c2410/mach-smdk2410.c:136: error: (near initialization for `s3c24xx_uda134x_data.l3_mode')
  15. arch/arm/mach-s3c2410/mach-smdk2410.c:147: warning: 'smdk2440_devices' defined but not used
  16. make[1]: *** [arch/arm/mach-s3c2410/mach-smdk2410.o] 错误 1
  17. make: *** [arch/arm/mach-s3c2410] 错误 2
    被这几个错误弄得有点糊涂了,后来跟踪了一下代码,发现原来S3C2410_GPB这个宏是定义在mach/gpio-nrs.h头文件里的,于是乎增加了这个头文件,再编译,终于生成了内核映象文件。下载到开发板,从系统的启动信息可以看到声2440的I2S和uda已经关联起来了。
  1. sbcore: registered new interface driver hiddev
  2. usbcore: registered new interface driver usbhid
  3. usbhid: USB HID core driver
  4. No device for DAI UDA134X
  5. No device for DAI s3c24xx-i2s
  6. S3C24XX_UDA134X SoC Audio driver
  7. UDA134X SoC Audio Codec
  8. asoc: UDA134X <-> s3c24xx-i2s mapping ok
  9. ALSA device list:
  10.   #0: S3C24XX_UDA134X (UDA134X)
    5. 验证。先建立设备节点
  1.  #mkdir /dev/sound
  2.  #mknod /dev/sound/dsp c 14 4
  3.  #cat /dev/sound/dsp > /tmp/test.wav
  4.  ^c
  5.  # ls -l tmp
  6.  drwx------ 1 root root 2048 Jan 27 10:48 qtembedded-0
  7.  drwx------ 1 root root 2048 Jan 27 10:48 qtopia-0
  8.  -rw-r--r-- 1 root root 49152 Jan 27 10:43 test.wav
  9.  # cat /tmp/test/wav > /dev/sound/dsp
  10.  #
 ok,声卡驱动大功告成。
阅读(1694) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~