免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 4101 | 回复: 10
打印 上一主题 下一主题

uda1341音频驱动移植 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-06-04 22:53 |只看该作者 |倒序浏览
将音频驱动从2.6.12上移植到2.6.18内核中。不知道我的方法对不对?直接将音频驱动编译成模块再插入。在网上有的人编译三个模块(snd.ko、soundcore.ko和s3c2410-uda1341.ko)我只有一个,也不知道另个两个是那个文件编译得来的!
之前的音频驱动是静态加载到内核到中,后面我移植到18内核上是采用模块式的。编译可以通过,再进行插入模块也没有问题!可是一运行测试DOME程序时,就出现下面的问题!
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c38e0000
[00000000] *pgd=3383a031, *pte=00000000, *ppte=00000000
Internal error: Oops: 817 [#1]
Modules linked in: s3c2410_oss
CPU: 0
PC is at smdk2410_audio_open+0x150/0x20c [s3c2410_oss]
LR is at 0x1
pc : [<bf001b20>]    lr : [<00000001>]    Not tainted
sp : c3e5fe58  ip : bf0032e0  fp : c3e5fe78
r10: 00000000  r9 : c3e5e000  r8 : 00000008
r7 : c39928e0  r6 : 00000003  r5 : 00000000  r4 : 00000000
r3 : 0000000e  r2 : bf0032d4  r1 : 00000002  r0 : bf001e1c
Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  Segment user
Control: C000717F  Table: 338E0000  DAC: 00000015
Process sh (pid: 394, stack limit = 0xc3e5e250)
Stack: (0xc3e5fe58 to 0xc3e60000)
fe40:                                                       c03015a0 00000000
fe60: 00000003 c39928e0 c3bed120 c3e5fe9c c3e5fe7c c02193d8 bf0019e0 c3e5be60
fe80: c3bed120 00000000 00000000 c39928e0 c3e5fec4 c3e5fea0 c0089014 c021925c
fea0: 00000003 c39928e0 c3bed120 c0088ef0 c3beec38 c03f4f20 c3e5feec c3e5fec8
fec0: c007e134 c0088f00 c39928e0 c3e5ff0c 000001b6 ffffff9c c3bf1000 00000002
fee0: c3e5ff04 c3e5fef0 c007e238 c007dfbc 00000000 00020241 c3e5ff70 c3e5ff08
ff00: c007e29c c007e214 c3e5ff0c c3beec38 c03f4f20 0024543e 00000003 c3bf1005
ff20: 00000300 00000000 00000000 c3c0b088 c3e5e000 ffffffe8 c3e5e000 00000002
ff40: c3e5ff70 c3e5ff50 c007e428 c009b23c 00020242 000001b6 c39928e0 00000003
ff60: 00020241 c3e5ff94 c3e5ff74 c007e604 c007e260 000001b6 00000241 00193540
ff80: 00000005 c0025f84 c3e5ffa4 c3e5ff98 c007e66c c007e5bc 00000000 c3e5ffa8
ffa0: c0025de0 c007e658 000001b6 00000241 00193540 00020241 000001b6 00000000
ffc0: 000001b6 00000241 00193540 001934c0 00000001 001bd620 00000002 00000003
ffe0: 0000045c becea6a8 0007cbd0 000f6568 60000010 00193540 22b23fba bbfaba32
Backtrace:
[<bf0019d0>] (smdk2410_audio_open+0x0/0x20c [s3c2410_oss]) from [<c02193d8>] (so
undcore_open+0x18c/0x25c)
r8 = C3BED120  r7 = C39928E0  r6 = 00000003  r5 = 00000000
r4 = C03015A0
[<c021924c>] (soundcore_open+0x0/0x25c) from [<c0089014>] (chrdev_open+0x124/0x1
80)
r8 = C39928E0  r7 = 00000000  r6 = 00000000  r5 = C3BED120
r4 = C3E5BE60
[<c0088ef0>] (chrdev_open+0x0/0x180) from [<c007e134>] (__dentry_open+0x188/0x25

r8 = C03F4F20  r7 = C3BEEC38  r6 = C0088EF0  r5 = C3BED120
r4 = C39928E0
[<c007dfac>] (__dentry_open+0x0/0x25 from [<c007e238>] (nameidata_to_filp+0x34
/0x4c)
[<c007e204>] (nameidata_to_filp+0x0/0x4c) from [<c007e29c>] (do_filp_open+0x4c/0
x50)
r4 = 00020241
[<c007e250>] (do_filp_open+0x0/0x50) from [<c007e604>] (do_sys_open+0x58/0x9c)
r5 = 00020241  r4 = 00000003
[<c007e5ac>] (do_sys_open+0x0/0x9c) from [<c007e66c>] (sys_open+0x24/0x2
r8 = C0025F84  r7 = 00000005  r6 = 00193540  r5 = 00000241
r4 = 000001B6
[<c007e648>] (sys_open+0x0/0x2 from [<c0025de0>] (ret_fast_syscall+0x0/0x2c)
Code: 0affffcf eaffffc0 e3a04000 e59f00a4 (e5844000)
在OPEN时系统调用出现空指针!找了几遍没有找到!请高手指教,顺便指点一下,调试像这样空指针出现的问题,应该要怎么样去调试!
以下是OPEN的驱动源码(在2.6.18.4里面可以运行的,是没有问题!):
static int smdk2410_audio_open(struct inode *inode, struct file *file)
{
        int cold = !audio_active;
//printk(KERN_ERR "line %d passed!\n",__LINE__);
        DPRINTK("audio_open\n");
//printk(KERN_ERR "line %d passed!\n",__LINE__);
        if ((file->f_flags & O_ACCMODE) == O_RDONLY) {
//printk(KERN_ERR "line %d passed!\n",__LINE__);
                if (audio_rd_refcount || audio_wr_refcount)
                        {
//printk(KERN_ERR "line %d passed!\n",__LINE__);
                        return -EBUSY;
                        }
//printk(KERN_ERR "line %d passed!\n",__LINE__);
                audio_rd_refcount++;
//printk(KERN_ERR "line %d passed!\n",__LINE__);
        } else if ((file->f_flags & O_ACCMODE) == O_WRONLY) {
//printk(KERN_ERR "line %d passed!\n",__LINE__);
                if (audio_rd_refcount || audio_wr_refcount)
                        {
//printk(KERN_ERR "line %d passed!\n",__LINE__);
                        return -EBUSY;
                        }
               
                audio_wr_refcount++;
//printk(KERN_ERR "line %d passed!\n",__LINE__);
        } else if ((file->f_flags & O_ACCMODE) == O_RDWR) {
//printk(KERN_ERR "line %d passed!\n",__LINE__);
                if (audio_rd_refcount || audio_wr_refcount)
                        {
//printk(KERN_ERR "line %d passed!\n",__LINE__);
                return -EBUSY;}
                audio_rd_refcount++;
//printk(KERN_ERR "line %d passed!\n",__LINE__);
                audio_wr_refcount++;
        } else
                {
//printk(KERN_ERR "line %d passed!\n",__LINE__);
                return -EINVAL;
                }

        if (cold) {
//printk(KERN_ERR "line %d passed!\n",__LINE__);
                audio_rate = AUDIO_RATE_DEFAULT;
                audio_channels = AUDIO_CHANNELS_DEFAULT;
                audio_fragsize = AUDIO_FRAGSIZE_DEFAULT;
                audio_nbfrags = AUDIO_NBFRAGS_DEFAULT;
                if ((file->f_mode & FMODE_WRITE)){
//printk(KERN_ERR "line %d passed!\n",__LINE__);
                                init_s3c2410_iis_bus_tx();
                                audio_clear_buf(&output_stream);
                }
                if ((file->f_mode & FMODE_READ)){
//printk(KERN_ERR "line %d passed!\n",__LINE__);
                                init_s3c2410_iis_bus_rx();
                                audio_clear_buf(&input_stream);
                }
        }
//printk(KERN_ERR "line %d passed!\n",__LINE__);
        return 0;
}

static int smdk2410_audio_release(struct inode *inode, struct file *file)
{
        DPRINTK("audio_release\n");
  //printk(KERN_ERR "line %d passed!\n",__LINE__);
        if (file->f_mode & FMODE_READ) {
                          if (audio_rd_refcount == 1) {
                                audio_clear_buf(&input_stream);
                                  audio_rd_refcount = 0;
                        }
        }

        if(file->f_mode & FMODE_WRITE) {
                          if (audio_wr_refcount == 1) {
                                    audio_sync(file);
                                    audio_clear_buf(&output_stream);
                                    audio_wr_refcount = 0;
                            }
                  }

        return 0;
}

论坛徽章:
0
2 [报告]
发表于 2009-06-05 14:52 |只看该作者
DPRINTK("audio_open\n");
这句好像都没打印出来呢。

论坛徽章:
0
3 [报告]
发表于 2009-06-05 14:57 |只看该作者
你的内核配置中选上了对OSS的支持了吗?

论坛徽章:
0
4 [报告]
发表于 2009-06-09 23:00 |只看该作者

回复 #3 lpzgbd 的帖子

可能是地址映射的问题的吧!
        __raw_writel(__raw_readl(S3C2410_GPBCON)&~(0x3f<<4), S3C2410_GPBCON);
//printk(KERN_ERR "line %d passed!\n",__LINE__);
        __raw_writel(__raw_readl(S3C2410_GPBCON)|(0x15<<4), S3C2410_GPBCON);
上面是其中的一段代码!而且刚运行此段时就报错!
Unable to handle kernel paging request at virtual address 56000010
在虚拟地址56000010处问题!而56000010对应刚好是S3C2410_GPBCON。可是我查看了内核,并没有做地址映射!
#define S3C2410_GPBCON           S3C2410_GPIOREG(0x10)

#define S3C2410_GPIOREG(x) ((x) + S3C24XX_VA_GPIO)

#define S3C24XX_VA_GPIO           S3C2410_ADDR(0x00E00000)

#ifndef __ASSEMBLY__
#define S3C2410_ADDR(x)          ((void __iomem *)0xF0000000 + (x))
#else
#define S3C2410_ADDR(x)          (0xF0000000 + (x))
#endif
照这样宏替换算一下!地址是不对的!对应该不上56000010!!
前辈们指点一下!

论坛徽章:
0
5 [报告]
发表于 2009-06-10 22:38 |只看该作者

回复 #4 shuiyu123 的帖子

自己顶一下!!
请大哥们指教一下!!!!

论坛徽章:
0
6 [报告]
发表于 2009-06-11 13:10 |只看该作者
原帖由 shuiyu123 于 2009-6-9 23:00 发表
可能是地址映射的问题的吧!
        __raw_writel(__raw_readl(S3C2410_GPBCON)&~(0x3f

你确定是这里出错了。你把这两句注释了,看看还包不报错。我感觉不是这里的原因。
S3C2410_GPBCON 这个值不是56000010。

论坛徽章:
0
7 [报告]
发表于 2009-06-11 13:26 |只看该作者
又是大堆的代码

论坛徽章:
0
8 [报告]
发表于 2009-06-11 21:17 |只看该作者

回复 #6 lpzgbd 的帖子

已经注释掉了!就没有Unable to handle kernel paging request at virtual address 56000010提示了,而又是另外一个地址的也是同样的问题!还是地址错误!!

论坛徽章:
0
9 [报告]
发表于 2009-06-11 22:24 |只看该作者

回复 #8 shuiyu123 的帖子

再者还有一个问题总是觉得不对劲!!
如:GPBCON手册上写的地址是0x56000010
可是在内核里面的include里面看到
#define S3C2410_GPBCON           S3C2410_GPIOREG(0x10)

#define S3C2410_GPIOREG(x) ((x) + S3C24XX_VA_GPIO)

#define S3C24XX_VA_GPIO           S3C2410_ADDR(0x00E00000)

#ifndef __ASSEMBLY__
#define S3C2410_ADDR(x)          ((void __iomem *)0xF0000000 + (x))
#else
#define S3C2410_ADDR(x)          (0xF0000000 + (x))
#endif

算出来的结果却是0xf0e00010???
为什么?是怎么去理解才对?

论坛徽章:
0
10 [报告]
发表于 2009-06-13 11:05 |只看该作者

回复 #3 lpzgbd 的帖子

内核里面已经支持了OSS!我没有把驱动编译进内核!只是通过insmod 加载进去呀!
现在能加载到内核!只是在DOME测试的时候有一点问题!
提示如下!
line 1256 passed!
line 376 passed!
Unable to handle kernel paging request at virtual address f0d00000
pgd = c0424000
[f0d00000] *pgd=00000000
Internal error: Oops: 805 [#1]
Modules linked in: s3c2410_oss
CPU: 0
PC is at smdk2410_audio_open+0x19c/0x290 [s3c2410_oss]
LR is at 0x1
pc : [<bf001b7c>]    lr : [<00000001>]    Not tainted
sp : c06a5e5c  ip : 60000093  fp : c06a5e78
r10: 00000000  r9 : c06a4000  r8 : c3cf1120
r7 : c044d760  r6 : 00000003  r5 : f0d00000  r4 : 00000000
r3 : c02fa75c  r2 : 00000000  r1 : 0000017a  r0 : bf001e60
Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  Segment user
Control: C000717F  Table: 30424000  DAC: 00000015
Process sh (pid: 394, stack limit = 0xc06a4250)
Stack: (0xc06a5e5c to 0xc06a6000)
5e40:                                                                c0311930
5e60: 00000000 00000003 c044d760 c06a5e9c c06a5e7c c02269f8 bf0019f0 c0645e00
5e80: c3cf1120 00000000 00000000 c044d760 c06a5ec4 c06a5ea0 c0089014 c022687c
5ea0: 00000003 c044d760 c3cf1120 c0088ef0 c3cf2ac4 c0414f20 c06a5eec c06a5ec8
5ec0: c007e134 c0088f00 c044d760 c06a5f0c 000001b6 ffffff9c c3ce6000 00000002
5ee0: c06a5f04 c06a5ef0 c007e238 c007dfbc 00000000 00020241 c06a5f70 c06a5f08
5f00: c007e29c c007e214 c06a5f0c c3cf2ac4 c0414f20 0024543e 00000003 c3ce6005
5f20: 00000300 00000000 00000000 c040dd48 c06a4000 ffffffe8 c06a4000 00000002
5f40: c06a5f70 c06a5f50 c007e428 c009b23c 00020242 000001b6 c044d760 00000003
5f60: 00020241 c06a5f94 c06a5f74 c007e604 c007e260 000001b6 00000241 00193540
5f80: 00000005 c0025f84 c06a5fa4 c06a5f98 c007e66c c007e5bc 00000000 c06a5fa8
5fa0: c0025de0 c007e658 000001b6 00000241 00193540 00020241 000001b6 00000000
5fc0: 000001b6 00000241 00193540 001934c0 00000001 001bd620 00000002 00000003
5fe0: 0000045c bef836a8 0007cbd0 000f6568 60000010 00193540 00000000 203a7325
Backtrace:
[<bf0019e0>] (smdk2410_audio_open+0x0/0x290 [s3c2410_oss]) from [<c02269f8>] (so
undcore_open+0x18c/0x25c)
r7 = C044D760  r6 = 00000003  r5 = 00000000  r4 = C0311930
[<c022686c>] (soundcore_open+0x0/0x25c) from [<c0089014>] (chrdev_open+0x124/0x1
80)
r8 = C044D760  r7 = 00000000  r6 = 00000000  r5 = C3CF1120
r4 = C0645E00
[<c0088ef0>] (chrdev_open+0x0/0x180) from [<c007e134>] (__dentry_open+0x188/0x25

r8 = C0414F20  r7 = C3CF2AC4  r6 = C0088EF0  r5 = C3CF1120
r4 = C044D760
[<c007dfac>] (__dentry_open+0x0/0x25 from [<c007e238>] (nameidata_to_filp+0x34
/0x4c)
[<c007e204>] (nameidata_to_filp+0x0/0x4c) from [<c007e29c>] (do_filp_open+0x4c/0
x50)
r4 = 00020241
[<c007e250>] (do_filp_open+0x0/0x50) from [<c007e604>] (do_sys_open+0x58/0x9c)
r5 = 00020241  r4 = 00000003
[<c007e5ac>] (do_sys_open+0x0/0x9c) from [<c007e66c>] (sys_open+0x24/0x2
r8 = C0025F84  r7 = 00000005  r6 = 00193540  r5 = 00000241
r4 = 000001B6
[<c007e648>] (sys_open+0x0/0x2 from [<c0025de0>] (ret_fast_syscall+0x0/0x2c)
Code: e59f00d0 eb40f003 e59f10dc e59f00c4 (e5854000)
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP