无法在Linux内核中设置IRQ的触发类型

时间:2019-12-10 08:50:44

标签: c linux linux-kernel interrupt-handling irq

我正在使用RTAI Patch 5.2在Linux内核3.18.20中解决问题。我发现驱动程序注册的中断频率很高,大约是20us /次。

我尝试更改其触发类型,以查看触发方式是否错误。

err = request_irq(dev->irq, sja1000_interrupt, IRQF_TRIGGER_HIGH | IRQF_SHARED | IRQF_ONESHOT,
                  dev->name, (void *)dev);

PINFO("priv->flags=%x\n",priv->flags);

if(irq_set_irq_type(dev->irq,IRQ_TYPE_LEVEL_HIGH))
    PERROR("could not set irq %d type\n",dev->irq);
else
    PINFO("set irq %d type success\n",dev->irq);

request_irqirq_set_irq_type看起来不错,返回值为0。但是当我使用irq_get_irq_type时,它总是返回0。

中断号为 16 。以下/proc/interrupt/显示 它没有更改其触发类型。

            CPU0       CPU1       CPU2       CPU3
   0:         57          0          0          0   IO-APIC-edge      timer
   1:         12          0          0          0   IO-APIC-edge      i8042
   7:          1          0          0          0   IO-APIC-edge
   9:          0          0          0          0   IO-APIC-fasteoi   acpi
  12:          1          0          0          0   IO-APIC-edge
  16:     998473          0   49801960          0   IO-APIC   16-fasteoi   can0
  17:         52          0          0          0   IO-APIC   17-fasteoi   mmc0
  18:          0          0          0          0   IO-APIC   18-fasteoi   mmc1
  23:      28409          0          0          0   IO-APIC   23-fasteoi   ehci_hcd:usb1, mmc2
  87:       1905          0          0          0   PCI-MSI-edge      i915
  88:          0          0          0          0   PCI-MSI-edge      eth0
  89:        471          0          5          0   PCI-MSI-edge      eth0-TxRx-0
  90:          6          0          0        470   PCI-MSI-edge      eth0-TxRx-1
  91:          6        465          5          0   PCI-MSI-edge      eth0-TxRx-2
  92:          6          0         10        460   PCI-MSI-edge      eth0-TxRx-3
  93:          1          0          0          0   PCI-MSI-edge      eth1
  94:         32          0          0        666   PCI-MSI-edge      eth1-TxRx-0
  95:         18        506          9          0   PCI-MSI-edge      eth1-TxRx-1
  96:         23          0         53        485   PCI-MSI-edge      eth1-TxRx-2
  97:        113        561         13          0   PCI-MSI-edge      eth1-TxRx-3  
 NMI:         31          0         94         21   Non-maskable interrupts  
 LOC:    1373419       2014     939934    1115589   Local timer interrupts   
 SPU:          0          0          0          0   Spurious interrupts  
 PMI:         31          0         94         21   Performance monitoring interrupts  
 IWI:       2528          0        642          0   IRQ work interrupts  
 RTR:          0          0          0          0   APIC ICR read retries  
 RES:     195337          1      19434      42295   Rescheduling interrupts  
 CAL:        143        162        118        101   Function call interrupts  
 TLB:        571          0        290        640   TLB shootdowns  
 TRM:          0          0          0          0   Thermal event interrupts  
 THR:          0          0          0          0   Threshold APIC interrupts  
 MCE:          0          0          0          0   Machine check exceptions  
 MCP:          4          4          4          4   Machine check polls  
 ERR:          1
 MIS:          0  

是否可以设置irq 16的触发类型?

0 个答案:

没有答案