145,28 → 145,27 |
|
static int request_io_memory(PCIConfig *pPch) |
{ |
if (check_mem_region(pci_resource_start(pPch->pciDev, 0), LCR_SPACE)) |
{ |
PRINTK(KERN_DEBUG "%s : LCR 0x%08lx\n", DEVICE_NAME, (long unsigned int) pci_resource_start(pPch->pciDev, 0)); |
return -EBUSY; |
} |
if (!request_mem_region(pci_resource_start(pPch->pciDev, 0), LCR_SPACE, DEVICE_NAME) ) { |
PRINTK(KERN_WARNING "%s: LCR memory region %llx-%llx already in use\n", DEVICE_NAME, |
pci_resource_start(pPch->pciDev, 0), pci_resource_start(pPch->pciDev, 0) + LCR_SPACE ); |
kfree(pPch); |
return EBUSY; |
|
if (check_mem_region(pci_resource_start(pPch->pciDev, 2), CTL_SPACE)) |
{ |
PRINTK(KERN_DEBUG "%s : CTL 0x%08lx\n", DEVICE_NAME, (long unsigned int) pci_resource_start(pPch->pciDev, 2)); |
return -EBUSY; |
} |
}; |
if (!request_mem_region(pci_resource_start(pPch->pciDev, 2), CTL_SPACE, DEVICE_NAME) ){ |
PRINTK(KERN_WARNING "%s: CTL memory region %llx-%llx already in use\n", DEVICE_NAME, |
pci_resource_start(pPch->pciDev, 0), pci_resource_start(pPch->pciDev, 2) + CTL_SPACE ); |
kfree(pPch); |
return EBUSY; |
|
if (check_mem_region(pci_resource_start(pPch->pciDev, 2) + CTL_SPACE, VME_SPACE)) |
{ |
PRINTK(KERN_DEBUG "%s : VME 0x%08lx\n", DEVICE_NAME, (long unsigned int) pci_resource_start(pPch->pciDev, 2) + CTL_SPACE); |
return -EBUSY; |
} |
if (!request_mem_region(pci_resource_start(pPch->pciDev, 2) + CTL_SPACE, VME_SPACE, DEVICE_NAME) ){ |
PRINTK(KERN_WARNING "%s: VME memory region %llx-%llx already in use\n", DEVICE_NAME, |
pci_resource_start(pPch->pciDev, 0)+CTL_SPACE, pci_resource_start(pPch->pciDev, 0) + LCR_SPACE+VME_SPACE ); |
kfree(pPch); |
return EBUSY; |
|
request_mem_region(pci_resource_start(pPch->pciDev, 0), LCR_SPACE, DEVICE_NAME); |
request_mem_region(pci_resource_start(pPch->pciDev, 2), CTL_SPACE, DEVICE_NAME); |
request_mem_region(pci_resource_start(pPch->pciDev, 2) + CTL_SPACE, VME_SPACE, DEVICE_NAME); |
|
}; |
return 0; |
} |
|
367,12 → 366,8 |
return found; |
} |
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) |
static int pcivme_read_proc(char *buf, char **start, off_t offset, int len) |
#else |
//static int pcivme_read_proc(char *buf, char **start, off_t offset, int len, int *eof, void *data) |
static int pcivme_read_proc(struct file *filp,char *buf,size_t count,loff_t *offp ) |
#endif |
static ssize_t pcivme_read_proc(struct file *filp,char *buf,size_t count,loff_t *offp ) |
{ |
int pos = 0; |
DEVICE_OBJ *pd; |
383,7 → 378,7 |
PRINTK(KERN_DEBUG "%s : pcivme_read_proc()\n",DEVICE_NAME); |
|
if (*offp != 0) return 0; |
pos += sprintf(buf + pos, "\nPCIVME information. Version %d.%d of %s from Klaus Hitschler.\n", VERSION_HI, VERSION_LO, __DATE__); |
pos += sprintf(buf + pos, "\nPCIVME information. Version %d.%d from Klaus Hitschler.\n", VERSION_HI, VERSION_LO); |
|
pos += sprintf(buf + pos, " ---------------------\n"); |
pos += sprintf(buf + pos, " Interfaces found : %d\n", drv.count); |
429,31 → 424,14 |
pos=count; |
} |
PRINTK(KERN_DEBUG "%s : pcivme_read_proc() end count=%d\n",DEVICE_NAME, pos); |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0) |
//*eof = 1; |
#endif |
*offp = pos; |
|
return pos; |
} |
|
|
|
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) |
struct proc_dir_entry pcimod_proc_entry = |
{ |
namelen: 7, /* len of name */ |
name: DEVICE_NAME, /* entry name */ |
mode: S_IFREG | S_IRUGO, /* mode */ |
nlink: 1, /* nlinks */ |
get_info: pcivme_read_proc, /* function used to read data */ |
static const struct proc_ops pcivme_read_proc_fops = { |
proc_read: pcivme_read_proc |
}; |
#else |
struct file_operations pcivme_read_proc_fops = { |
read: pcivme_read_proc |
}; |
#endif |
|
static void deleteMyLists(void) |
{ |
531,7 → 509,8 |
pd->pPCIADACntrl = pd->pLCR + PLX9050_CNTRL; |
pd->pPCIADAIntCSR = pd->pLCR + PLX9050_INTCSR; |
|
if (request_irq(pd->pPch->pciDev->irq, pcivme_irqhandler, IRQF_DISABLED| IRQF_SHARED, DEVICE_NAME, pd)) |
//if (request_irq(pd->pPch->pciDev->irq, pcivme_irqhandler, IRQF_DISABLED| IRQF_SHARED, DEVICE_NAME, pd)) |
if (request_irq(pd->pPch->pciDev->irq, pcivme_irqhandler, IRQF_SHARED, DEVICE_NAME, pd)) |
{ |
printk(KERN_ERR "%s : can't get irq @ %d\n", DEVICE_NAME, pd->pPch->pciDev->irq); |
kfree_s(pd, sizeof(*pd)); // FREE(pd); |
605,11 → 584,7 |
unregister_chrdev(drv.nMajor, DEVICE_NAME); |
|
/* unregister the proc device */ |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) |
proc_unregister(&proc_root, pcimod_proc_entry.low_ino); |
#else |
remove_proc_entry(DEVICE_NAME, NULL); |
#endif |
|
/* redo all */ |
for (ptr = drv.devList.next; ptr != &drv.devList; ptr = ptr->next) |