- 论坛徽章:
- 0
|
问题解决了,把uch8*comresp或者uch8 comresp[20]改成 uch8*comresp=kmalloc(20,GFP_KERNEL)OOPs就没有了
把Psam_Command_Send函数里uch8 *back;back=resp;改成uch8*back=resp;
我在编写驱动的时候,在模块加载函数里测试两个函数
Psam_Reset函数正常执行,一执行到Psam_Command_Send(send1,5,comresp);函数就出现oops
static int __init Psam_init(void)
{
int result;
dev_t devno=MKDEV(ippsam_major,0);
if(ippsam_major)
result=register_chrdev_region(devno,1,"ippsam");
else
{
result=alloc_chrdev_region(&devno,0,1,"ippsam");
ippsam_major=MAJOR(devno);
}
if(result<0)
return result;
Psam_setup_cdev();
Psam_Hw_init();
printk(KERN_ALERT"hello psam\n");
Psam_Reset();
char send1[]={0x12,0x84,0x34,0x56,0x04};
int i;
uch8*lenr;
uch8 comresp[20]; //此处改成uch8*comresp=kmalloc(20,GFP_KERNEL);
memset(comresp,0xFF,20);
Psam_Command_Send(send1,5,comresp);
// CPU_Cmd(5,send1,lenr,comresp);
// for(i=0;i<10;i++)
// printk(KERN_ALERT"data is %x\n",comresp);
return 0;
}
[ 本帖最后由 kyt1984 于 2009-5-22 13:17 编辑 ] |
|