阅读:1737回复:1
驱动中一中断使能就死,去掉就好了------怎么回事啊
写了一摸数转换cs5341驱动,环境:amlinux,cpu:ep7312
在驱动的初始化函数中,所有寄存器初始化完毕后,加上fiq使能语句。insmod使就死在那了 去掉中断使能就正常了,请问怎么回事啊? 附初始化函数: int CS5341Init(void) { int rc; struct pt_regs regs; void *fiqhandler_start; unsigned int fiqhandler_length; extern unsigned char dai_fiq_handler_start, dai_fiq_handler_end;//外部变量,在汇编程序中定义 Ready = 0; INTMR3 = 0x0; SYSCON3 |= 0x00000008; // frame size:64; 0x00000208(128fs) // Select DAI mode instead of CODEC/SSI mode. DAI64FS = 0x60B; // 64FS SAMPLE RATE: 48K PLL:74MZ DAIR =0x00220404; DAISR =0xFFFFFFFF; // Clear the overrun and underrun bits in the DAI status register. DAIR |=0x10000; // enable DAI interface // // Enable the FIFOs for the left and right channels. // while(!(DAISR & 0x1000)) //直到DAISR的fifo传送(或输出)完成 { } DAIDR2 = 0x118000; //右通道使能 while(!(DAISR & 0x1000)) //直到DAISR的fifo传送(或输出)完成 { } DAIDR2 = 0xD8000; while(!(DAISR & 0x1000)) ; INTMR3 |= 0x00000001; // DAI interface interrupt *************** 加上这一句就死机了!!!!!!!!! delay(1000); // Delay so the CS5341 can calibrate. rc = register_chrdev(cs5341_major, "CS5341", &CS5341_fops); if (rc < 0) { printk(KERN_WARNING "CS5341: can't get Major %d\n", cs5341_major); return rc; } if (cs5341_major == 0) cs5341_major = rc; printk("the dynamic major device number is %d\n",cs5341_major); printk("CS5341............Support\n"); num = (int*)kmalloc(MMSIZE,GFP_KERNEL); fiqhandler_start = &dai_fiq_handler_start; fiqhandler_length = &dai_fiq_handler_end - &dai_fiq_handler_start; if (claim_fiq(&cs5341_fh)) { printk("cs5341_fh: couldn't claim FIQ.\n"); return 0; } set_fiq_handler(fiqhandler_start,fiqhandler_length); set_fiq_regs(®s); enable_fiq(cs5341_fiq_num); *num = 0; start = (char*)(num + sizeof(int)); end = (char*)(num + MMSIZE);//the last bit of the bottom of the queue; head = start; tail = (char*)num;//tail points the last vaild data;when no data exsit,it ponits num return 0; } |
|
沙发#
发布于:2005-01-10 19:53
首先要区分是不是由于那一句语句发生的所谓驱动“死掉”。
你可以先用调试器或者简单的初始化语句测试一下你的fiq使能步骤正确与否,如果正确,那么你就应该分析你使能后的驱动程序在逻辑上正确与否。 每一个项目都是一个系统,希望以上的排查步骤能够给你带来帮助。太具体的东西还是自己去发现去解决。 |
|