xapp1022里:
static int XPCIe_init(void)
{
gDev = pci_find_device (PCI_VENDOR_ID_XILINX, PCI_DEVICE_ID_XILINX_PCIE, gDev);
if (NULL == gDev) {
printk(/*KERN_WARNING*/"%s: Init: Hardware not found.\n", gDrvrName);
//return (CRIT_ERR);
return (-1);
}
if (0 > pci_enable_device(gDev)) {
printk(/*KERN_WARNING*/"%s: Init: Device not enabled.\n", gDrvrName);
//return (CRIT_ERR);
return (-1);
}
// Get Base Address of registers from pci structure. Should come from pci_dev
// structure, but that element seems to be missing on the development system.
gBaseHdwr = pci_resource_start (gDev, 0);
if (0 > gBaseHdwr) {
printk(/*KERN_WARNING*/"%s: Init: Base Address not set.\n", gDrvrName);
//return (CRIT_ERR);
return (-1);
}
printk(/*KERN_WARNING*/"Base hw val %X\n", (unsigned int)gBaseHdwr);
gBaseLen = pci_resource_len (gDev, 0);