自己编写的驱动出现这种情况????

zhumaomaozmm 2010-09-30 03:05:58
加载驱动时,可以加载成功!但是一触发中断之后超级终端打印:

scheduling while atomic: swapper/0x00000100/0
bad: scheduling from the idle thread!
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c0004000
[00000000] *pgd=00000000
Internal error: Oops: 17 [#1]
Modules linked in: stk_gpio stk_rtc8025 nfs lockd sunrpc mmc_block himci mmc_core sd_mmc_sdio hi3511_usb_1_1 nls_iso8859_1 nls_cp437 hifb fb hi3511_jpege hi3511_h264d hi3511_h264e hi3511_chnl hi3511_ao hi3511_ai hi3511_sio hi3511_md hi3511_vdec hi3511_group hi3511_venc hi3511_vpp hi3511_dsu hi3511_vou hi3511_viu hi3511_sys hi3511_base tde stkwm8510 stkmediactl stksaa7113 stkflashenv hidmac gpioi2c hiether mmz
CPU: 0
PC is at dequeue_task+0xc/0x78
LR is at deactivate_task+0x24/0x30
pc : [<c003346c>] lr : [<c00337b8>] Tainted: P
sp : c02a9dc8 ip : c02a9de0 fp : c02a9ddc
r10: c02fb8d8 r9 : c02a8000 r8 : c02aac40
r7 : c02abe88 r6 : c02aad6c r5 : 00000000 r4 : c02aac40
r3 : ffffffff r2 : 40000093 r1 : 00000000 r0 : c02aac40
Flags: nZCv IRQs off FIQs on Mode SVC_32 Segment kernel
Control: 5317F Table: E1B78000 DAC: 00000017
Process swapper (pid: 0, stack limit = 0xc02a8194)
Stack: (0xc02a9dc8 to 0xc02aa000)
9dc0: c02aac40 00000000 c02a9df0 c02a9de0 c00337b8 c0033470
9de0: 00000000 c02a9e38 c02a9df4 c0260978 c00337a4 c02aac74 0a0bcb26 00754540
9e00: 0098965c c02aad68 c0037cc8 c02a9e38 ffffc3af 00000015 c02a9e3c c02abe88
9e20: c02a9eac c02abe88 c02fb8d8 c02a9e74 c02a9e3c c0261594 c0260550 c02fbe58
9e40: c02fbe58 ffffc3af 4b87ad6e c00411b4 c02aac40 c02fb8d8 00000002 bf1d8350
9e60: c02a8000 00000000 c02a9e84 c02a9e78 c0261634 c0261530 c02a9e94 c02a9e88
9e80: c00411f8 c0261620 c02a9ea8 c02a9e98 bf1d8444 c00411d8 00000100 c02a9ee0
9ea0: c02a9eac c0040958 bf1d8360 c02a9eac c02a9eac 00000000 00000001 c02fb670
9ec0: 00000001 c02fd124 0000000a c02a8000 c02fb640 c02a9f0c c02a9ee4 c003c858
9ee0: c0040864 c02a8000 fe140000 00000010 c02abc1c c02a9f50 41069265 c02f56e4
9f00: c02a9f1c c02a9f10 c003ca08 c003c7f8 c02a9f4c c02a9f20 c0021e10 c003c9d4
9f20: c0037cc8 00000a00 ffffffff fe140000 00000010 c031453c e001d114 e001d0e4
9f40: c02a9fa4 c02a9f50 c00209c4 c0021cf4 00000000 0005317f 0005217f 60000013
9f60: c0022640 c02a8000 c02f5d6c c031453c e001d114 41069265 e001d0e4 c02a9fa4
9f80: c02a9f98 c02a9f98 c002bab0 c002269c 60000013 ffffffff c02a9fc0 c02a9fa8
9fa0: c00226e8 c0022650 00053175 c02f529c c02fde54 c02a9fd0 c02a9fc4 c0020024
9fc0: c00226b4 c02a9ff4 c02a9fd4 c00087e4 c0020010 c00082e4 c02f5e48 00053175
9fe0: c02f5ddc c02abbb8 00000000 c02a9ff8 e0008094 c0008698 00000000 00000000
Backtrace:
[<c0033460>] (dequeue_task+0x0/0x7 from [<c00337b8>] (deactivate_task+0x24/0x30)
r5 = 00000000 r4 = C02AAC40
[<c0033794>] (deactivate_task+0x0/0x30) from [<c0260978>] (schedule+0x438/0x61
r4 = 00000000
[<c0260540>] (schedule+0x0/0x61 from [<c0261594>] (schedule_timeout+0x74/0xc
[<c0261520>] (schedule_timeout+0x0/0xc from [<c0261634>] (schedule_timeout_uninterruptible+0x24/0x2
r7 = 00000000 r6 = C02A8000 r5 = BF1D8350 r4 = 00000002
[<c0261610>] (schedule_timeout_uninterruptible+0x0/0x2 from [<c00411f8>] (msleep+0x30/0x40)
[<c00411c8>] (msleep+0x0/0x40) from [<bf1d8444>] (send_signal_handle+0xf4/0x14c [stk_gpio])
[<bf1d8350>] (send_signal_handle+0x0/0x14c [stk_gpio]) from [<c0040958>] (run_timer_softirq+0x104/0x1f4)
r4 = 00000100
[<c0040854>] (run_timer_softirq+0x0/0x1f4) from [<c003c858>] (__do_softirq+0x70/0xf0)
[<c003c7e8>] (__do_softirq+0x0/0xf0) from [<c003ca08>] (irq_exit+0x44/0x4c)
[<c003c9c4>] (irq_exit+0x0/0x4c) from [<c0021e10>] (asm_do_IRQ+0x12c/0x140)
[<c0021ce4>] (asm_do_IRQ+0x0/0x140) from [<c00209c4>] (__irq_svc+0x24/0x80)
[<c0022640>] (default_idle+0x0/0x64) from [<c00226e8>] (cpu_idle+0x44/0x60)
[<c00226a4>] (cpu_idle+0x0/0x60) from [<c0020024>] (__init_end+0x24/0x2c)
r6 = C02FDE54 r5 = C02F529C r4 = 00053175
[<c0020000>] (__init_end+0x0/0x2c) from [<c00087e4>] (start_kernel+0x15c/0x1c4)
[<c0008688>] (start_kernel+0x0/0x1c4) from [<e0008094>] (0xe0008094)
Code: e89da800 e1a0c00d e92dd830 e24cb004 (e5913000)
<0>Kernel panic - not syncing: Aiee, killing interrupt handler!

...全文
127 点赞 收藏 5
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
Jerry_Lee01 2010-10-13
倒着推算试试
回复
ask_qianru 2010-10-09
如果死,估计多半都是GPIO没有搞成中断模式,调试一下应该可以找到具体死到哪
回复
ask_qianru 2010-10-09
你说一中断就死了,你调试一下,看看死到中断哪个地方啊;你中断里面好像没有使能定时器或者是什么睡眠的错误动作,不可能死啊感觉。
回复
baojunling2008 2010-10-05
楼主牛人,你这些都会了,我这些都还在学呢?你现在这么说,好打击我。。。
回复
zhumaomaozmm 2010-09-30
附上主要源代码:
---------------------------------------------------------------------------------------------------------------------static struct miscdevice stk_gpio_dev =

{

MISC_DYNAMIC_MINOR,

"stk_gpio",

&stk_gpio_fops,

};



//-----------------------Zhuqing added it here.......-------------------------//



void send_signal_handle(void)

{

int flag_judge;



flag_judge = flag & (0x0f);

switch (flag_judge)

{

case 0x01:

{

flag &= (0xfe);

printk("--- lock on\n");

gpio_write_bit(GPIO_5_PORT,IPC3_ALARMEN_BIT,1);

gpio_write_bit(GPIO_7_PORT,IPC3_WALARMOUT_2_BIT,1);

msleep(200);

gpio_write_bit(GPIO_7_PORT,IPC3_WALARMOUT_2_BIT,0);

printk("--- clear alarm on\n");

break;



}



case 0x02:

{

flag &= (0xfd);

printk("--- lock off \n");

gpio_write_bit(GPIO_5_PORT,IPC3_ALARMEN_BIT,1);

gpio_write_bit(GPIO_7_PORT,IPC3_WALARMOUT_1_BIT,1);

msleep(200);

gpio_write_bit(GPIO_7_PORT,IPC3_WALARMOUT_1_BIT,0);

printk("--- clear alarm on\n");

break;

}



case 0x04:

{

flag &= (0xfc);

printk("--- SOS on \n");

gpio_write_bit(GPIO_7_PORT,IPC3_WALARMOUT_0_BIT,1);

msleep(200);

gpio_write_bit(GPIO_7_PORT,IPC3_WALARMOUT_0_BIT,0);

printk("--- clear alarm on\n");

break;

}



default:break;

}



mod_timer(&stk_gpio_timer, jiffies + HZ/10);

}

static irqreturn_t interrupt_handle(int irq, char *dev_id)

{



//Disable the interrupt, because these interrupt can not be interruptted again before them being handled//

//gpio_IE_set_bit(GPIO_5_PORT,IPC3_WALARMIN_0_BIT,INTERRUPT_DISABLE);

//gpio_IE_set_bit(GPIO_5_PORT,IPC3_WALARMIN_1_BIT,INTERRUPT_DISABLE);

//gpio_IE_set_bit(GPIO_5_PORT,IPC3_WALARMIN_2_BIT,INTERRUPT_DISABLE);

//gpio_IE_set_bit(GPIO_5_PORT,IPC3_WALARMIN_3_BIT,INTERRUPT_DISABLE);

//----------------------------The End----------------------------//



//gpio_write_bit(GPIO_7_PORT,IPC3_WALARMOUT_2_BIT,1);

wa0 = gpio_read_bit(GPIO_5_PORT ,IPC3_WALARMIN_0_BIT);

wa2 = gpio_read_bit(GPIO_5_PORT ,IPC3_WALARMIN_2_BIT);

wa1 = gpio_read_bit(GPIO_5_PORT ,IPC3_WALARMIN_1_BIT);

wa3 = gpio_read_bit(GPIO_5_PORT ,IPC3_WALARMIN_3_BIT);

temp = (wa3 << 3) |(wa2 << 2) | (wa1 << 1) |(wa0 << 0);





switch (temp)

{

case IPC3_LOCKON_STATUS:

{

flag |= (0x01);

break;



}



case IPC3_LOCKOFF_STATUS:

{

flag |= (0x02);

break;

}



case IPC3_SOS_STATUS:

{

flag |= (0x04);

break;

}



default:break;

}

//clear the interrupt

writel(0xff, (HI_SYS_GPIO+(GPIO_5_PORT) * GPIO_SPACE_SIZE + GPIO_IC));

//Open the interrupt again

//gpio_IE_set_bit(GPIO_5_PORT,IPC3_WALARMIN_0_BIT,INTERRUPT_ENABLE);

//gpio_IE_set_bit(GPIO_5_PORT,IPC3_WALARMIN_1_BIT,INTERRUPT_ENABLE);

//gpio_IE_set_bit(GPIO_5_PORT,IPC3_WALARMIN_2_BIT,INTERRUPT_ENABLE);

//gpio_IE_set_bit(GPIO_5_PORT,IPC3_WALARMIN_3_BIT,INTERRUPT_ENABLE);

//----------------------------The End----------------------------//

return IRQ_RETVAL(1);

}
复制代码static int gpio_interrupt_init(void)

{



gpio_interrupt_reg_init();

int err = 0;

err = request_irq(GPIO_IRQ, &interrupt_handle, SA_SHIRQ, "stk_gpio", &stk_gpio_dev);

printk("the request_irq return numble is %d\n",err);

if (err != 0)

{

printk("gpio_interrupt_init() fail!\n");

goto gpio_interrupt_init_fail;

}



return 0;

gpio_interrupt_init_fail: misc_deregister(&stk_gpio_dev);

free_irq(GPIO_IRQ, &stk_gpio_dev);

return 0;



}



//----------------------------------The End--------------------------------//

static int __init stk_gpio_init(void)

{

int ret;

unsigned int tmp;

ret = misc_register(&stk_gpio_dev);

if (ret)

{

printk(GPIO_DEVICE_NAME " can't register major number\n");

return ret;

}



// gpio_remap();

gpio_init();



stk_gpio_timer_init();

add_timer(&stk_gpio_timer);



gpio_interrupt_init();//Zhuqing added it here.......



printk("stk gpio control Driver v1.0\n");

return 0;

}





static void __exit stk_gpio_exit(void)

{



//del_timer_sync(&stk_gpio_timer);

misc_deregister(&stk_gpio_dev);

//gpio_unmap();





//disable_irq(GPIO_IRQ); //Zhuqing added it here......

free_irq(GPIO_IRQ, &stk_gpio_dev);//Zhuqing added it here......



}
回复
相关推荐
发帖
驱动开发/核心开发
创建于2007-09-28

2.1w+

社区成员

硬件/嵌入开发 驱动开发/核心开发
申请成为版主
帖子事件
创建了帖子
2010-09-30 03:05
社区公告
暂无公告