| 
 | 
 
近日,我在做一个基于s3c2410下的linux驱动,在驱动中的request_irq函数如下: 
 
static void hpi_interrupt(int irq, void *dev_id, struct pt_regs *regs) 
{ 
} 
 
 
static int hpi_open(struct inode *inode, struct file *file) 
/*file_operation的“打开”指针函数实现,可省去,如果为NULL,设备打开操作永远成功*/ 
{         
   int ret; 
        
       ret=request_irq(HPI_IRQ,hpi_interrupt,SA_INTERRUPT,DEVICE_NAME,NULL); 
     
    if(ret){ 
     printk(DEVICE_NAME " can't get assigned irq\n"); 
     printk("HPI_IRQ is %d\n",HPI_IRQ); 
     printk("ret is %d\n",ret); 
        goto bad_out; 
    } 
 
        //init the HPIC 
         HPIC_L = 0x0001;//HWOB = 1,LSB.ie.the low half come first 
         HPIC_H = 0x0001;//The same of low half; 
 
         //init the HPIA 
         HPIA_L = 0x0000; 
         HPIA_H = 0x0180; 
          
          return 0; 
 
     bad_out: 
         return ret; 
} 
其中 HPI_IRQ定义为EINT5,DEVICE_NAME是“hpi”,驱动编译无错,然后用insmod加载,设备注册成功,可是在系统调用open时,每次都显示: 
hpi can't get assigned irq 
HPI_IRQ is 33 
ret is -22 
在/proc/interrupts中33号中断确实空闲啊。换成别的空闲中断也是申请不到,不知为什么。请高手指点一下,谢谢! |   
 
 
 
 |