- 论坛徽章:
- 0
|
请各位前辈帮忙指点一下.
我在init函数中注册中断时出现如下错误:
Root#insmod kbd.ko
using kbd.ko
Unable to handle kernel NULL pointer dereference at virtual address 00000060
pgd = c39e0000
[00000060] *pgd=33d01031, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#1]
Modules linked in: kbd
CPU: 0
PC is at buttons4x4_init+0xc0/0x1fc [kbd]
LR is at set_irq_type+0x8c/0xb0
pc : [<bf0030c0>]
lr : [<c0021350>]
Tainted: GF
sp : c3fabf60
ip : c3fabf3c
fp : c3fabf7c
r10: 00000001
r9 : c3faa000
r8 : c3faa000
r7 : 00000000
r6 : bf001470
r5 : 00000000
r4 : 0000003f
r3 : 00000000
r2 : 0000fffe
r1 : 00000000
r0 : 00000000
Flags: nZcv
IRQs on
FIQs on
Mode SVC_32
Segment user
Control: C000717F
Table: 339E0000
DAC: 00000015
Process insmod (pid: 750, stack limit = 0xc3faa194)
Stack: (0xc3fabf60 to 0xc3fac000)
bf60: 00000000 c02315c4 bf0012e0 c02315b4 c3fabfa4 c3fabf80 c0054b10 bf003010
bf80: 00000004 00000000 00000000 00000080 c00200e4 00000000 00000000 c3fabfa8
bfa0: c001ff60 c00549b8 00000000 00000000 00900080 40015000 00001f58 001cb028
bfc0: 00000004 00000000 00000000 be901d64 001cb018 001cb008 00000000 00000000
bfe0: be8ff8b4 be8ff8a8 000444e0 40199ac0 60000010 00900080 30002031 30002431
Backtrace:
[<bf003000>] (buttons4x4_init+0x0/0x1fc [kbd]) from [<c0054b10>] (sys_init_modu)
r6 = C02315B4
r5 = BF0012E0
r4 = C02315C4
[<c00549a8>] (sys_init_module+0x0/0x310) from [<c001ff60>] (ret_fast_syscall+0x)
Code: e2800013 eb407882 e5961000 e59f2118 (e5913060)
Segmentation fault
/mnt/key_button_all_ok$
注册内容如下:
开头定义:
static int irq_col_tab[] = { IRQ_EINT0, IRQ_EINT2, IRQ_EINT11, IRQ_EINT19};
#define COL_NUM ( (sizeof irq_col_tab) / sizeof (irq_col_tab[0]) )
static unsigned gpio_col_tab[] = {S3C2410_GPF0, S3C2410_GPF2,S3C2410_GPG3, S3C2410_GPG11};
static unsigned gpio_row_tab[] = {S3C2410_GPF4, S3C2410_GPF5, S3C2410_GPF6, S3C2410_GPF7 };
以下为init中内容:
int i,ret;
//int port_irq;
for (i = 0; i < COL_NUM; i++) {
int irq = irq_col_tab;
set_irq_type(irq,IRQT_LOW);
s3c2410_gpio_pullup(gpio_col_tab,1);
ret = request_irq(irq, buttons_irq, SA_INTERRUPT, DEVICE_NAME, NULL);
if (ret) {
unregister_chrdev(BUTTON_MAJOR, DEVICE_NAME);
printk(DEVICE_NAME " can't request irq %d\n", irq);
return ret;
}
}
set_irq_type(IRQ_EINT3,IRQT_BOTHEDGE);
s3c2410_gpio_cfgpin(S3C2410_GPG0, S3C2410_GPG0_INP);//G端口中G0管脚设为输入模式
s3c2410_gpio_pullup(S3C2410_GPG0,0);
//G端口中G0管脚设为上拉使能
s3c2410_gpio_pullup(S3C2410_GPF3,0);//F端口中F3管脚设为上拉使能
/* writel(readl(gpbase+0x60) & 0xfffffffc,gpbase+0x60);//G端口中G0管脚设为输入模式
writel(readl(gpbase+0x6 & 0xfffe,gpbase+0x6 ;//G端口中G0管脚设为上拉使能
writel(readl(gpbase+0x5 & 0xfff7,gpbase+0x5 ;//F端口中F3管脚设为上拉使能*/
ret = request_irq(IRQ_EINT3, buttons2_irq, SA_INTERRUPT, DEVICE_NAME, NULL);
if (ret) {
unregister_chrdev(BUTTON_MAJOR, DEVICE_NAME);
printk(DEVICE_NAME " can't request irq %d\n", IRQ_EINT3);
return ret;
}
printk("keybutton interrupt register!\n" ;
return 0;
}
请高手帮忙分析一下,这是什么原因啊!谢谢! |
|