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