0
在我的項目,我想開發一個PCIE Linux設備驅動程序與32位MSI handler.For爲此我寫了這樣的代碼:MSI註冊PCIE設備驅動程序
if((pci_resource_flags(dev,i)&IORESOURCE_TYPE_BITS)==IORESOURCE_MEM)
{
printk(KERN_INFO "memmap1");
devInfo->resource[i].type=IORESOURCE_MEM;
devInfo->resource[i].flag=pci_resource_flags(dev,i);
devInfo->resource[i].RegsLength=(u32)pci_resource_len(dev,i);
devInfo->resource[i].RegsBase=ioremap_nocache(pci_resource_start(dev,i),pci_resource_len(dev,i));
devInfo->resource[i].PhysBase.QuadPart=(u64)pci_resource_start(dev,i);
if(devInfo->resource[i].RegsBase==NULL)
{
printk(KERN_ERR "pci_ioremap_bar da hata olustu!\n");
return -ENOMEM;
}
printk(KERN_INFO "Birinci bar icin type:%d",devInfo->resource[0].type);
printk(KERN_INFO "Birinci bar icin register length:%d",devInfo->resource[0].RegsLength);
}
if(pci_enable_msi(dev))
{
printk(KERN_WARNING "MSI enable basarisiz oldu\n");
return -1;
}
if(request_irq(dev->irq, irq_handler, 0,"bbn_fpga", NULL))
{
printk(KERN_WARNING "MSI register edilemiyor\n");
return -ENODEV;
}
devInfo->flag=0;
printk(KERN_INFO "iowrite icerisine giriyorum");
iowrite32((u32) 0x80000000,&devInfo->resource[0].RegsBase);
if(devInfo->flag==0)
{
printk(KERN_ERR "Interrupt\n");
return -1;
}
static irqreturn_t irq_handler(int irq, void *dev_id)
{
printk(KERN_INFO "(irq_handler): Called\n");
return IRQ_HANDLED;
}
在這裏,我寫了8000註冊基地創建一個MSI中斷,雖然它不起作用。從這裏我怎麼能採取32位的MSI中斷?
PCIe endpoint generating a memory write transaction to the specified
address in MSI capability register
所以從CPU到MSI地址存儲器寫入是不會做任何事情 -
當然,它不會工作。你完全錯過**應該工作**。在Linux中,它隱藏在PCI核心實現中。 MSI向量由平臺定義。請閱讀任何有關PCI體系結構的書。 – 0andriy