- 论坛徽章:
- 0
|
将音频驱动从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;
} |
|