From: Ian Abbott Date: Thu, 10 Apr 2008 14:43:06 +0000 (+0000) Subject: Allow Comedi to be built without PCI drivers. The PCI drivers won't be built X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e5a50bb4e9ed7c398e8d9807ab35a5896065e37a;p=comedi.git Allow Comedi to be built without PCI drivers. The PCI drivers won't be built if the kernel has no PCI support or if a new configure option '--disable-pci' is used. --- diff --git a/comedi/comedi_kbuild.inc.in b/comedi/comedi_kbuild.inc.in index c550f68d..49e19a18 100644 --- a/comedi/comedi_kbuild.inc.in +++ b/comedi/comedi_kbuild.inc.in @@ -1,4 +1,5 @@ @CONFIG_COMEDI_RT_TRUE@CONFIG_COMEDI_RT=y @CONFIG_COMEDI_RT_TRUE@CONFIG_COMEDI_RT_MODULES=m +@CONFIG_COMEDI_PCI_TRUE@CONFIG_COMEDI_PCI_MODULES=m @CONFIG_COMEDI_PCMCIA_TRUE@CONFIG_COMEDI_PCMCIA_MODULES=m @CONFIG_COMEDI_USB_TRUE@CONFIG_COMEDI_USB_MODULES=m diff --git a/comedi/drivers/Kbuild b/comedi/drivers/Kbuild index d0546cec..49030164 100644 --- a/comedi/drivers/Kbuild +++ b/comedi/drivers/Kbuild @@ -6,6 +6,60 @@ include comedi_kbuild.inc obj-$(CONFIG_COMEDI_RT_MODULES) += comedi_rt_timer.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += mite.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += icp_multi.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += addi_apci_035.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += addi_apci_1032.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += addi_apci_1500.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += addi_apci_1516.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += addi_apci_1564.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += addi_apci_16xx.o +#obj-$(CONFIG_COMEDI_PCI_MODULES) += addi_apci_1710.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += addi_apci_2016.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += addi_apci_2032.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += addi_apci_2200.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += addi_apci_3001.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += addi_apci_3120.o +#obj-$(CONFIG_COMEDI_PCI_MODULES) += addi_apci_3200.o +#obj-$(CONFIG_COMEDI_PCI_MODULES) += addi_apci_3300.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += addi_apci_3501.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += addi_apci_3xxx.o +#obj-$(CONFIG_COMEDI_PCI_MODULES) += addi_apci_all.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += adl_pci6208.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += adl_pci7296.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += adl_pci7432.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += adl_pci8164.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += adl_pci9111.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += adl_pci9118.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += adv_pci1710.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += adv_pci1723.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += adv_pci_dio.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += amplc_pci224.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += amplc_pci230.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += cb_pcidas.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += cb_pcidas64.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += cb_pcidda.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += cb_pcidio.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += cb_pcimdas.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += cb_pcimdda.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += contec_pci_dio.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += daqboard2000.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += dt3000.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += gsc_hpdi.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += ii_pci20kc.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += jr3_pci.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += ke_counter.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += me_daq.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += me4000.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += ni_6527.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += ni_65xx.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += ni_660x.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += ni_670x.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += ni_pcidio.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += ni_pcimio.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += rtd520.o +obj-$(CONFIG_COMEDI_PCI_MODULES) += s626.o + obj-$(CONFIG_COMEDI_PCMCIA_MODULES) += cb_das16_cs.o obj-$(CONFIG_COMEDI_PCMCIA_MODULES) += das08_cs.o obj-$(CONFIG_COMEDI_PCMCIA_MODULES) += ni_daq_700.o @@ -21,53 +75,16 @@ obj-$(CONFIG_COMEDI_USB_MODULES) += dt9812.o obj-m += 8255.o obj-m += comedi_fc.o obj-m += das08.o -obj-m += mite.o obj-m += ni_labpc.o obj-m += acl7225b.o -obj-m += addi_apci_035.o -obj-m += addi_apci_1032.o -obj-m += addi_apci_1500.o -obj-m += addi_apci_1516.o -obj-m += addi_apci_1564.o -obj-m += addi_apci_16xx.o -#obj-m += addi_apci_1710.o -obj-m += addi_apci_2016.o -obj-m += addi_apci_2032.o -obj-m += addi_apci_2200.o -obj-m += addi_apci_3001.o -obj-m += addi_apci_3120.o -#obj-m += addi_apci_3200.o -#obj-m += addi_apci_3300.o -obj-m += addi_apci_3501.o -obj-m += addi_apci_3xxx.o -#obj-m += addi_apci_all.o -obj-m += adl_pci6208.o -obj-m += adl_pci7296.o -obj-m += adl_pci7432.o -obj-m += adl_pci8164.o -obj-m += adl_pci9111.o -obj-m += adl_pci9118.o obj-m += adq12b.o -obj-m += adv_pci1710.o -obj-m += adv_pci1723.o -obj-m += adv_pci_dio.o obj-m += aio_aio12_8.o obj-m += aio_iiro_16.o -obj-m += amplc_pci224.o -obj-m += amplc_pci230.o obj-m += amplc_pc236.o obj-m += amplc_pc263.o obj-m += amplc_dio200.o obj-m += c6xdigio.o -obj-m += cb_pcidas.o -obj-m += cb_pcidas64.o -obj-m += cb_pcidda.o -obj-m += cb_pcidio.o -obj-m += cb_pcimdas.o -obj-m += cb_pcimdda.o obj-m += comedi_bond.o -obj-m += contec_pci_dio.o -obj-m += daqboard2000.o obj-m += das16.o obj-m += das16m1.o obj-m += das6402.o @@ -80,27 +97,13 @@ obj-m += dt2814.o obj-m += dt2815.o obj-m += dt2817.o obj-m += dt282x.o -obj-m += dt3000.o obj-m += fl512.o -obj-m += gsc_hpdi.o -obj-m += ii_pci20kc.o -obj-m += icp_multi.o -obj-m += jr3_pci.o -obj-m += ke_counter.o -obj-m += me_daq.o -obj-m += me4000.o obj-m += mpc624.o obj-m += multiq3.o -obj-m += ni_6527.o -obj-m += ni_65xx.o -obj-m += ni_660x.o -obj-m += ni_670x.o obj-m += ni_at_a2150.o obj-m += ni_at_ao.o obj-m += ni_atmio.o obj-m += ni_atmio16d.o -obj-m += ni_pcimio.o -obj-m += ni_pcidio.o obj-m += ni_tio.o obj-m += pcm3724.o obj-m += pcm3730.o @@ -118,13 +121,11 @@ obj-m += pcl818.o obj-m += pcmuio.o obj-m += pcmmio.o obj-m += comedi_parport.o -obj-m += rtd520.o obj-m += rti800.o obj-m += rti802.o obj-m += serial2002.o obj-m += skel.o obj-m += ssv_dnp.o obj-m += s526.o -obj-m += s626.o obj-m += comedi_test.o obj-m += unioxx5.o diff --git a/comedi/drivers/Makefile.am b/comedi/drivers/Makefile.am index b1b27784..91370823 100644 --- a/comedi/drivers/Makefile.am +++ b/comedi/drivers/Makefile.am @@ -67,6 +67,62 @@ else rt_modules = endif +if CONFIG_COMEDI_PCI +pci_modules= \ + mite.ko \ + addi_apci_035.ko \ + addi_apci_1032.ko \ + addi_apci_1500.ko \ + addi_apci_1516.ko \ + addi_apci_1564.ko \ + addi_apci_16xx.ko \ + addi_apci_2016.ko \ + addi_apci_2032.ko \ + addi_apci_2200.ko \ + addi_apci_3001.ko \ + addi_apci_3120.ko \ + addi_apci_3501.ko \ + addi_apci_3xxx.ko \ + adl_pci6208.ko \ + adl_pci7296.ko \ + adl_pci7432.ko \ + adl_pci8164.ko \ + adl_pci9111.ko \ + adl_pci9118.ko \ + adv_pci1710.ko \ + adv_pci1723.ko \ + adv_pci_dio.ko \ + amplc_pci224.ko \ + amplc_pci230.ko \ + cb_pcidas.ko \ + cb_pcidas64.ko \ + cb_pcidda.ko \ + cb_pcidio.ko \ + cb_pcimdas.ko \ + cb_pcimdda.ko \ + contec_pci_dio.ko \ + daqboard2000.ko \ + dt3000.ko \ + gsc_hpdi.ko \ + icp_multi.ko \ + ii_pci20kc.ko \ + jr3_pci.ko \ + ke_counter.ko \ + me_daq.ko \ + me4000.ko \ + ni_6527.ko \ + ni_65xx.ko \ + ni_660x.ko \ + ni_670x.ko \ + ni_pcidio.ko \ + ni_pcimio.ko \ + rtd520.ko \ + s626.ko +else +pci_modules= +endif + + if CONFIG_COMEDI_PCMCIA pcmcia_modules= \ cb_das16_cs.ko \ @@ -96,49 +152,16 @@ module_PROGRAMS = \ 8255.ko \ comedi_fc.ko \ das08.ko \ - mite.ko \ ni_labpc.ko \ acl7225b.ko \ - addi_apci_035.ko \ - addi_apci_1032.ko \ - addi_apci_1500.ko \ - addi_apci_1516.ko \ - addi_apci_1564.ko \ - addi_apci_16xx.ko \ - addi_apci_2016.ko \ - addi_apci_2032.ko \ - addi_apci_2200.ko \ - addi_apci_3001.ko \ - addi_apci_3120.ko \ - addi_apci_3501.ko \ - addi_apci_3xxx.ko \ - adl_pci6208.ko \ - adl_pci7296.ko \ - adl_pci7432.ko \ - adl_pci8164.ko \ - adl_pci9111.ko \ - adl_pci9118.ko \ adq12b.ko \ - adv_pci1710.ko \ - adv_pci1723.ko \ - adv_pci_dio.ko \ - amplc_pci224.ko \ - amplc_pci230.ko \ amplc_pc236.ko \ amplc_pc263.ko \ amplc_dio200.ko \ aio_aio12_8.ko \ aio_iiro_16.ko \ c6xdigio.ko \ - cb_pcidas.ko \ - cb_pcidas64.ko \ - cb_pcidda.ko \ - cb_pcidio.ko \ - cb_pcimdas.ko \ - cb_pcimdda.ko \ comedi_bond.ko \ - contec_pci_dio.ko \ - daqboard2000.ko \ das16.ko \ das16m1.ko \ das6402.ko \ @@ -151,24 +174,10 @@ module_PROGRAMS = \ dt2815.ko \ dt2817.ko \ dt282x.ko \ - dt3000.ko \ fl512.ko \ - gsc_hpdi.ko \ - ii_pci20kc.ko \ - icp_multi.ko \ - jr3_pci.ko \ - ke_counter.ko \ - me_daq.ko \ - me4000.ko \ mpc624.ko \ multiq3.ko \ - ni_660x.ko \ - ni_670x.ko \ ni_atmio.ko \ - ni_pcimio.ko \ - ni_pcidio.ko \ - ni_6527.ko \ - ni_65xx.ko \ ni_atmio16d.ko \ ni_at_a2150.ko \ ni_at_ao.ko \ @@ -189,16 +198,15 @@ module_PROGRAMS = \ pcmuio.ko \ pcmmio.ko \ comedi_parport.ko \ - rtd520.ko \ rti800.ko \ rti802.ko \ serial2002.ko \ skel.ko \ ssv_dnp.ko \ s526.ko \ - s626.ko \ comedi_test.ko \ unioxx5.ko \ + $(pci_modules) \ $(pcmcia_modules) \ $(usb_modules) \ $(rt_modules) diff --git a/comedi/drivers/amplc_dio200.c b/comedi/drivers/amplc_dio200.c index f461fc50..e89f37a1 100644 --- a/comedi/drivers/amplc_dio200.c +++ b/comedi/drivers/amplc_dio200.c @@ -301,12 +301,14 @@ static const dio200_board dio200_boards[] = { model: pc215e_model, layout: pc215_layout, }, +#ifdef CONFIG_COMEDI_PCI { name: "pci215", bustype: pci_bustype, model: pci215_model, layout: pc215_layout, }, +#endif { name: "pc218e", bustype: isa_bustype, @@ -319,12 +321,14 @@ static const dio200_board dio200_boards[] = { model: pc272e_model, layout: pc272_layout, }, +#ifdef CONFIG_COMEDI_PCI { name: "pci272", bustype: pci_bustype, model: pci272_model, layout: pc272_layout, }, +#endif }; /* @@ -398,6 +402,7 @@ static const dio200_layout dio200_layouts[] = { * PCI driver table. */ +#ifdef CONFIG_COMEDI_PCI static struct pci_device_id dio200_pci_table[] __devinitdata = { {PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI215, PCI_ANY_ID, PCI_ANY_ID, 0, 0, pci215_model}, @@ -407,6 +412,7 @@ static struct pci_device_id dio200_pci_table[] __devinitdata = { }; MODULE_DEVICE_TABLE(pci, dio200_pci_table); +#endif /* CONFIG_COMEDI_PCI */ /* * Useful for shorthand access to the particular board structure @@ -418,7 +424,9 @@ MODULE_DEVICE_TABLE(pci, dio200_pci_table); several hardware drivers keep similar information in this structure, feel free to suggest moving the variable to the comedi_device struct. */ typedef struct { +#ifdef CONFIG_COMEDI_PCI struct pci_dev *pci_dev; /* PCI device */ +#endif int intr_sd; } dio200_private; @@ -469,6 +477,7 @@ COMEDI_INITCLEANUP(driver_amplc_dio200); * This function looks for a PCI device matching the requested board name, * bus and slot. */ +#ifdef CONFIG_COMEDI_PCI static int dio200_find_pci(comedi_device * dev, int bus, int slot, struct pci_dev **pci_dev_p) @@ -530,6 +539,7 @@ dio200_find_pci(comedi_device * dev, int bus, int slot, } return -EIO; } +#endif /* * This function checks and requests an I/O region, reporting an error @@ -1243,10 +1253,12 @@ dio200_subdev_8254_cleanup(comedi_device * dev, comedi_subdevice * s) static int dio200_attach(comedi_device * dev, comedi_devconfig * it) { comedi_subdevice *s; - struct pci_dev *pci_dev = NULL; unsigned long iobase = 0; unsigned int irq = 0; +#ifdef CONFIG_COMEDI_PCI + struct pci_dev *pci_dev = NULL; int bus = 0, slot = 0; +#endif const dio200_layout *layout; int share_irq = 0; int sdx; @@ -1269,6 +1281,7 @@ static int dio200_attach(comedi_device * dev, comedi_devconfig * it) irq = it->options[1]; share_irq = 0; break; +#ifdef CONFIG_COMEDI_PCI case pci_bustype: bus = it->options[0]; slot = it->options[1]; @@ -1278,6 +1291,7 @@ static int dio200_attach(comedi_device * dev, comedi_devconfig * it) return ret; devpriv->pci_dev = pci_dev; break; +#endif default: printk(KERN_ERR "comedi%d: %s: BUG! cannot determine board type!\n", @@ -1289,6 +1303,7 @@ static int dio200_attach(comedi_device * dev, comedi_devconfig * it) devpriv->intr_sd = -1; /* Enable device and reserve I/O spaces. */ +#ifdef CONFIG_COMEDI_PCI if (pci_dev) { ret = comedi_pci_enable(pci_dev, DIO200_DRIVER_NAME); if (ret < 0) { @@ -1299,7 +1314,9 @@ static int dio200_attach(comedi_device * dev, comedi_devconfig * it) } iobase = pci_resource_start(pci_dev, 2); irq = pci_dev->irq; - } else { + } else +#endif + { ret = dio200_request_region(dev->minor, iobase, DIO200_IO_SIZE); if (ret < 0) { return ret; @@ -1377,7 +1394,9 @@ static int dio200_attach(comedi_device * dev, comedi_devconfig * it) if (thisboard->bustype == isa_bustype) { printk("(base %#lx) ", iobase); } else { +#ifdef CONFIG_COMEDI_PCI printk("(pci %s) ", pci_name(pci_dev)); +#endif } if (irq) { printk("(irq %u%s) ", irq, (dev->irq ? "" : " UNAVAILABLE")); @@ -1429,13 +1448,18 @@ static int dio200_detach(comedi_device * dev) } } if (devpriv) { +#ifdef CONFIG_COMEDI_PCI if (devpriv->pci_dev) { if (dev->iobase) { comedi_pci_disable(devpriv->pci_dev); } pci_dev_put(devpriv->pci_dev); - } else if (dev->iobase) { - release_region(dev->iobase, DIO200_IO_SIZE); + } else +#endif + { + if (dev->iobase) { + release_region(dev->iobase, DIO200_IO_SIZE); + } } } if (dev->board_name) { diff --git a/comedi/drivers/amplc_pc236.c b/comedi/drivers/amplc_pc236.c index a46c6f46..4224f469 100644 --- a/comedi/drivers/amplc_pc236.c +++ b/comedi/drivers/amplc_pc236.c @@ -108,14 +108,17 @@ static const pc236_board pc236_boards[] = { bustype: isa_bustype, model: pc36at_model, }, +#ifdef CONFIG_COMEDI_PCI { name: "pci236", fancy_name:"PCI236", bustype: pci_bustype, model: pci236_model, }, +#endif }; +#ifdef CONFIG_COMEDI_PCI static struct pci_device_id pc236_pci_table[] __devinitdata = { {PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI236, PCI_ANY_ID, PCI_ANY_ID, 0, 0, pci236_model}, @@ -123,6 +126,7 @@ static struct pci_device_id pc236_pci_table[] __devinitdata = { }; MODULE_DEVICE_TABLE(pci, pc236_pci_table); +#endif /* CONFIG_COMEDI_PCI */ /* * Useful for shorthand access to the particular board structure @@ -133,9 +137,11 @@ MODULE_DEVICE_TABLE(pci, pc236_pci_table); several hardware drivers keep similar information in this structure, feel free to suggest moving the variable to the comedi_device struct. */ typedef struct { +#ifdef CONFIG_COMEDI_PCI /* PCI device */ struct pci_dev *pci_dev; unsigned long lcr_iobase; /* PLX PCI9052 config registers in PCIBAR1 */ +#endif int enable_irq; } pc236_private; @@ -182,11 +188,13 @@ static irqreturn_t pc236_interrupt(int irq, void *d PT_REGS_ARG); static int pc236_attach(comedi_device * dev, comedi_devconfig * it) { comedi_subdevice *s; - struct pci_dev *pci_dev = NULL; unsigned long iobase = 0; unsigned int irq = 0; +#ifdef CONFIG_COMEDI_PCI + struct pci_dev *pci_dev = NULL; int bus = 0, slot = 0; struct pci_device_id *pci_id; +#endif int share_irq = 0; int ret; @@ -206,6 +214,7 @@ static int pc236_attach(comedi_device * dev, comedi_devconfig * it) irq = it->options[1]; share_irq = 0; break; +#ifdef CONFIG_COMEDI_PCI case pci_bustype: bus = it->options[0]; slot = it->options[1]; @@ -256,6 +265,7 @@ static int pc236_attach(comedi_device * dev, comedi_devconfig * it) return -EIO; } break; +#endif /* CONFIG_COMEDI_PCI */ default: printk("bug! cannot determine board type!\n"); return -EINVAL; @@ -269,6 +279,7 @@ static int pc236_attach(comedi_device * dev, comedi_devconfig * it) printk("%s ", dev->board_name); /* Enable device and reserve I/O spaces. */ +#ifdef CONFIG_COMEDI_PCI if (pci_dev) { if ((ret = comedi_pci_enable(pci_dev, PC236_DRIVER_NAME)) < 0) { printk("error enabling PCI device and requesting regions!\n"); @@ -277,7 +288,9 @@ static int pc236_attach(comedi_device * dev, comedi_devconfig * it) devpriv->lcr_iobase = pci_resource_start(pci_dev, 1); iobase = pci_resource_start(pci_dev, 2); irq = pci_dev->irq; - } else { + } else +#endif + { if ((ret = pc236_request_region(iobase, PC236_IO_SIZE)) < 0) { return ret; } @@ -323,7 +336,9 @@ static int pc236_attach(comedi_device * dev, comedi_devconfig * it) if (thisboard->bustype == isa_bustype) { printk("(base %#lx) ", iobase); } else { +#ifdef CONFIG_COMEDI_PCI printk("(pci %s) ", pci_name(pci_dev)); +#endif } if (irq) { printk("(irq %u%s) ", irq, (dev->irq ? "" : " UNAVAILABLE")); @@ -356,13 +371,18 @@ static int pc236_detach(comedi_device * dev) subdev_8255_cleanup(dev, dev->subdevices + 0); } if (devpriv) { +#ifdef CONFIG_COMEDI_PCI if (devpriv->pci_dev) { if (dev->iobase) { comedi_pci_disable(devpriv->pci_dev); } pci_dev_put(devpriv->pci_dev); - } else if (dev->iobase) { - release_region(dev->iobase, PC236_IO_SIZE); + } else +#endif + { + if (dev->iobase) { + release_region(dev->iobase, PC236_IO_SIZE); + } } } return 0; @@ -392,8 +412,10 @@ static void pc236_intr_disable(comedi_device * dev) comedi_spin_lock_irqsave(&dev->spinlock, flags); devpriv->enable_irq = 0; +#ifdef CONFIG_COMEDI_PCI if (devpriv->lcr_iobase) outl(PCI236_INTR_DISABLE, devpriv->lcr_iobase + PLX9052_INTCSR); +#endif comedi_spin_unlock_irqrestore(&dev->spinlock, flags); } @@ -408,8 +430,10 @@ static void pc236_intr_enable(comedi_device * dev) comedi_spin_lock_irqsave(&dev->spinlock, flags); devpriv->enable_irq = 1; +#ifdef CONFIG_COMEDI_PCI if (devpriv->lcr_iobase) outl(PCI236_INTR_ENABLE, devpriv->lcr_iobase + PLX9052_INTCSR); +#endif comedi_spin_unlock_irqrestore(&dev->spinlock, flags); } diff --git a/comedi/drivers/amplc_pc263.c b/comedi/drivers/amplc_pc263.c index 22e6de6d..cc9c0e3b 100644 --- a/comedi/drivers/amplc_pc263.c +++ b/comedi/drivers/amplc_pc263.c @@ -77,14 +77,17 @@ static const pc263_board pc263_boards[] = { bustype: isa_bustype, model: pc263_model, }, +#ifdef CONFIG_COMEDI_PCI { name: "pci263", fancy_name:"PCI263", bustype: pci_bustype, model: pci263_model, }, +#endif }; +#ifdef CONFIG_COMEDI_PCI static struct pci_device_id pc263_pci_table[] __devinitdata = { {PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI263, PCI_ANY_ID, PCI_ANY_ID, 0, 0, pci263_model}, @@ -92,6 +95,7 @@ static struct pci_device_id pc263_pci_table[] __devinitdata = { }; MODULE_DEVICE_TABLE(pci, pc263_pci_table); +#endif /* CONFIG_COMEDI_PCI */ /* * Useful for shorthand access to the particular board structure @@ -101,12 +105,14 @@ MODULE_DEVICE_TABLE(pci, pc263_pci_table); /* this structure is for data unique to this hardware driver. If several hardware drivers keep similar information in this structure, feel free to suggest moving the variable to the comedi_device struct. */ +#ifdef CONFIG_COMEDI_PCI typedef struct { /* PCI device. */ struct pci_dev *pci_dev; } pc263_private; #define devpriv ((pc263_private *)dev->private) +#endif /* CONFIG_COMEDI_PCI */ /* * The comedi_driver structure tells the Comedi core module @@ -141,10 +147,12 @@ static int pc263_dio_insn_config(comedi_device * dev, comedi_subdevice * s, static int pc263_attach(comedi_device * dev, comedi_devconfig * it) { comedi_subdevice *s; - struct pci_dev *pci_dev = NULL; unsigned long iobase = 0; +#ifdef CONFIG_COMEDI_PCI + struct pci_dev *pci_dev = NULL; int bus = 0, slot = 0; struct pci_device_id *pci_id; +#endif int ret; printk("comedi%d: %s: ", dev->minor, PC263_DRIVER_NAME); @@ -152,15 +160,18 @@ static int pc263_attach(comedi_device * dev, comedi_devconfig * it) * Allocate the private structure area. alloc_private() is a * convenient macro defined in comedidev.h. */ +#ifdef CONFIG_COMEDI_PCI if ((ret = alloc_private(dev, sizeof(pc263_private))) < 0) { printk("out of memory!\n"); return ret; } +#endif /* Process options. */ switch (thisboard->bustype) { case isa_bustype: iobase = it->options[0]; break; +#ifdef CONFIG_COMEDI_PCI case pci_bustype: bus = it->options[0]; slot = it->options[1]; @@ -210,6 +221,7 @@ static int pc263_attach(comedi_device * dev, comedi_devconfig * it) return -EIO; } break; +#endif /* CONFIG_COMEDI_PCI */ default: printk("bug! cannot determine board type!\n"); return -EINVAL; @@ -223,13 +235,16 @@ static int pc263_attach(comedi_device * dev, comedi_devconfig * it) printk("%s ", dev->board_name); /* Enable device and reserve I/O spaces. */ +#ifdef CONFIG_COMEDI_PCI if (pci_dev) { if ((ret = comedi_pci_enable(pci_dev, PC263_DRIVER_NAME)) < 0) { printk("error enabling PCI device and requesting regions!\n"); return ret; } iobase = pci_resource_start(pci_dev, 2); - } else { + } else +#endif + { if ((ret = pc263_request_region(iobase, PC263_IO_SIZE)) < 0) { return ret; } @@ -263,7 +278,9 @@ static int pc263_attach(comedi_device * dev, comedi_devconfig * it) if (thisboard->bustype == isa_bustype) { printk("(base %#lx) ", iobase); } else { +#ifdef CONFIG_COMEDI_PCI printk("(pci %s) ", pci_name(pci_dev)); +#endif } printk("attached\n"); @@ -283,14 +300,22 @@ static int pc263_detach(comedi_device * dev) { printk("comedi%d: %s: remove\n", dev->minor, PC263_DRIVER_NAME); - if (devpriv) { +#ifdef CONFIG_COMEDI_PCI + if (devpriv) +#endif + { +#ifdef CONFIG_COMEDI_PCI if (devpriv->pci_dev) { if (dev->iobase) { comedi_pci_disable(devpriv->pci_dev); } pci_dev_put(devpriv->pci_dev); - } else if (dev->iobase) { - release_region(dev->iobase, PC263_IO_SIZE); + } else +#endif + { + if (dev->iobase) { + release_region(dev->iobase, PC263_IO_SIZE); + } } } diff --git a/comedi/drivers/ni_labpc.c b/comedi/drivers/ni_labpc.c index 5dc4373e..de8ead97 100644 --- a/comedi/drivers/ni_labpc.c +++ b/comedi/drivers/ni_labpc.c @@ -187,7 +187,9 @@ static int labpc_eeprom_write_insn(comedi_device * dev, comedi_subdevice * s, comedi_insn * insn, lsampl_t * data); static unsigned int labpc_suggest_transfer_size(comedi_cmd cmd); static void labpc_adc_timing(comedi_device * dev, comedi_cmd * cmd); +#ifdef CONFIG_COMEDI_PCI static struct mite_struct *labpc_find_device(int bus, int slot); +#endif static int labpc_dio_mem_callback(int dir, int port, int data, unsigned long arg); static void labpc_serial_out(comedi_device * dev, unsigned int value, @@ -393,6 +395,7 @@ static const labpc_board labpc_boards[] = { ai_scan_up:0, memory_mapped_io:0, }, +#ifdef CONFIG_COMEDI_PCI { name: "pci-1200", device_id:0x161, @@ -406,6 +409,7 @@ static const labpc_board labpc_boards[] = { ai_scan_up:1, memory_mapped_io:1, }, +#endif }; /* @@ -428,12 +432,14 @@ static comedi_driver driver_labpc = { offset:sizeof(labpc_board), }; +#ifdef CONFIG_COMEDI_PCI static struct pci_device_id labpc_pci_table[] __devinitdata = { {PCI_VENDOR_ID_NATINST, 0x161, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {0} }; MODULE_DEVICE_TABLE(pci, labpc_pci_table); +#endif /* CONFIG_COMEDI_PCI */ static inline int labpc_counter_load(comedi_device * dev, unsigned long base_address, unsigned int counter_number, @@ -635,7 +641,6 @@ static int labpc_attach(comedi_device * dev, comedi_devconfig * it) unsigned long iobase = 0; unsigned int irq = 0; unsigned int dma_chan = 0; - int ret; /* allocate and initialize dev->private */ if (alloc_private(dev, sizeof(labpc_private)) < 0) @@ -649,6 +654,7 @@ static int labpc_attach(comedi_device * dev, comedi_devconfig * it) dma_chan = it->options[2]; break; case pci_bustype: +#ifdef CONFIG_COMEDI_PCI devpriv->mite = labpc_find_device(it->options[0], it->options[1]); if (devpriv->mite == NULL) { @@ -658,11 +664,17 @@ static int labpc_attach(comedi_device * dev, comedi_devconfig * it) printk("bug! mite device id does not match boardtype definition\n"); return -EINVAL; } - ret = mite_setup(devpriv->mite); - if (ret < 0) - return ret; + { + int ret = mite_setup(devpriv->mite); + if (ret < 0) + return ret; + } iobase = (unsigned long)devpriv->mite->daq_io_addr; irq = mite_irq(devpriv->mite); +#else + printk(" this driver has not been built with PCI support.\n"); + return -EINVAL; +#endif break; case pcmcia_bustype: printk(" this driver does not support pcmcia cards, use ni_labpc_cs.o\n"); @@ -678,6 +690,7 @@ static int labpc_attach(comedi_device * dev, comedi_devconfig * it) } // adapted from ni_pcimio for finding mite based boards (pc-1200) +#ifdef CONFIG_COMEDI_PCI static struct mite_struct *labpc_find_device(int bus, int slot) { struct mite_struct *mite; @@ -703,6 +716,7 @@ static struct mite_struct *labpc_find_device(int bus, int slot) mite_list_devices(); return NULL; } +#endif int labpc_common_detach(comedi_device * dev) { @@ -720,8 +734,10 @@ int labpc_common_detach(comedi_device * dev) comedi_free_irq(dev->irq, dev); if (thisboard->bustype == isa_bustype && dev->iobase) release_region(dev->iobase, LABPC_SIZE); +#ifdef CONFIG_COMEDI_PCI if (devpriv->mite) mite_unsetup(devpriv->mite); +#endif return 0; }; diff --git a/comedi/drivers/ni_mio_common.c b/comedi/drivers/ni_mio_common.c index 34ca524b..e68992b5 100644 --- a/comedi/drivers/ni_mio_common.c +++ b/comedi/drivers/ni_mio_common.c @@ -642,6 +642,7 @@ static void ni_release_cdo_mite_channel(comedi_device * dev) } // e-series boards use the second irq signals to generate dma requests for their counters +#ifdef PCIDMA static void ni_e_series_enable_second_irq(comedi_device * dev, unsigned gpct_index, short enable) { @@ -671,6 +672,7 @@ static void ni_e_series_enable_second_irq(comedi_device * dev, break; } } +#endif // PCIDMA static void ni_clear_ai_fifo(comedi_device * dev) { @@ -775,7 +777,9 @@ static irqreturn_t ni_E_interrupt(int irq, void *d PT_REGS_ARG) unsigned int ai_mite_status = 0; unsigned int ao_mite_status = 0; unsigned long flags; +#ifdef PCIDMA struct mite_struct *mite = devpriv->mite; +#endif if (dev->attached == 0) return IRQ_NONE; @@ -785,6 +789,7 @@ static irqreturn_t ni_E_interrupt(int irq, void *d PT_REGS_ARG) comedi_spin_lock_irqsave(&dev->spinlock, flags); a_status = devpriv->stc_readw(dev, AI_Status_1_Register); b_status = devpriv->stc_readw(dev, AO_Status_1_Register); +#ifdef PCIDMA if (mite) { unsigned long flags_too; @@ -809,6 +814,7 @@ static irqreturn_t ni_E_interrupt(int irq, void *d PT_REGS_ARG) comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags_too); } +#endif ack_a_interrupt(dev, a_status); ack_b_interrupt(dev, b_status); if ((a_status & Interrupt_A_St) || (ai_mite_status & CHSR_INT)) @@ -936,12 +942,14 @@ static void ni_event(comedi_device * dev, comedi_subdevice * s) static void handle_gpct_interrupt(comedi_device * dev, unsigned short counter_index) { +#ifdef PCIDMA comedi_subdevice *s = dev->subdevices + NI_GPCT_SUBDEV(counter_index); ni_tio_handle_interrupt(&devpriv->counter_dev->counters[counter_index], s); if (s->async->events) ni_event(dev, s); +#endif } static void ack_a_interrupt(comedi_device * dev, unsigned short a_status) @@ -3658,7 +3666,9 @@ static int ni_cdio_cmd(comedi_device * dev, comedi_subdevice * s) static int ni_cdo_inttrig(comedi_device * dev, comedi_subdevice * s, unsigned int trignum) { +#ifdef PCIDMA unsigned long flags; +#endif int retval = 0; unsigned i; const unsigned timeout = 100; @@ -3668,6 +3678,7 @@ static int ni_cdo_inttrig(comedi_device * dev, comedi_subdevice * s, /* read alloc the entire buffer */ comedi_buf_read_alloc(s->async, s->async->prealloc_bufsz); +#ifdef PCIDMA comedi_spin_lock_irqsave(&devpriv->mite_channel_lock, flags); if (devpriv->cdo_mite_chan) { mite_prep_dma(devpriv->cdo_mite_chan, 32, 32); @@ -3679,6 +3690,7 @@ static int ni_cdo_inttrig(comedi_device * dev, comedi_subdevice * s, comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); if (retval < 0) return retval; +#endif // XXX not sure what interrupt C group does // ni_writeb(Interrupt_Group_C_Enable_Bit, M_Offset_Interrupt_C_Enable); //wait for dma to fill output fifo @@ -3694,7 +3706,7 @@ static int ni_cdo_inttrig(comedi_device * dev, comedi_subdevice * s, } ni_writel(CDO_Arm_Bit | CDO_Error_Interrupt_Enable_Set_Bit | CDO_Empty_FIFO_Interrupt_Enable_Set_Bit, M_Offset_CDIO_Command); - return 0; + return retval; } static int ni_cdio_cancel(comedi_device * dev, comedi_subdevice * s) @@ -3714,11 +3726,14 @@ static void handle_cdio_interrupt(comedi_device * dev) { unsigned cdio_status; comedi_subdevice *s = dev->subdevices + NI_DIO_SUBDEV; +#ifdef PCIDMA unsigned long flags; +#endif if ((boardtype.reg_type & ni_reg_m_series_mask) == 0) { return; } +#ifdef PCIDMA comedi_spin_lock_irqsave(&devpriv->mite_channel_lock, flags); if (devpriv->cdo_mite_chan) { unsigned cdo_mite_status = @@ -3731,6 +3746,7 @@ static void handle_cdio_interrupt(comedi_device * dev) mite_sync_output_dma(devpriv->cdo_mite_chan, s->async); } comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); +#endif cdio_status = ni_readl(M_Offset_CDIO_Status); if (cdio_status & (CDO_Overrun_Bit | CDO_Underflow_Bit)) { @@ -5074,13 +5090,18 @@ static int ni_gpct_cmd(comedi_device * dev, comedi_subdevice * s) static int ni_gpct_cmdtest(comedi_device * dev, comedi_subdevice * s, comedi_cmd * cmd) { +#ifdef PCIDMA struct ni_gpct *counter = s->private; return ni_tio_cmdtest(counter, cmd); +#else + return -ENOTSUPP; +#endif } static int ni_gpct_cancel(comedi_device * dev, comedi_subdevice * s) { +#ifdef PCIDMA struct ni_gpct *counter = s->private; int retval; @@ -5088,6 +5109,9 @@ static int ni_gpct_cancel(comedi_device * dev, comedi_subdevice * s) ni_e_series_enable_second_irq(dev, counter->counter_index, 0); ni_release_gpct_mite_channel(dev, counter->counter_index); return retval; +#else + return 0; +#endif } /* diff --git a/comedi/drivers/ni_tio.c b/comedi/drivers/ni_tio.c index d9b47f75..480147aa 100644 --- a/comedi/drivers/ni_tio.c +++ b/comedi/drivers/ni_tio.c @@ -2420,6 +2420,7 @@ int ni_tio_winsn(struct ni_gpct *counter, comedi_insn * insn, lsampl_t * data) return 0; } +#ifdef CONFIG_COMEDI_PCI static void ni_tio_configure_dma(struct ni_gpct *counter, short enable, short read_not_write) { @@ -2460,7 +2461,9 @@ static void ni_tio_configure_dma(struct ni_gpct *counter, short enable, break; } } +#endif +#ifdef CONFIG_COMEDI_PCI static int ni_tio_input_inttrig(comedi_device * dev, comedi_subdevice * s, unsigned int trignum) { @@ -2485,7 +2488,9 @@ static int ni_tio_input_inttrig(comedi_device * dev, comedi_subdevice * s, return retval; } +#endif +#ifdef CONFIG_COMEDI_PCI static int ni_tio_input_cmd(struct ni_gpct *counter, comedi_async * async) { struct ni_gpct_device *counter_dev = counter->counter_dev; @@ -2533,7 +2538,9 @@ static int ni_tio_input_cmd(struct ni_gpct *counter, comedi_async * async) } return retval; } +#endif +#ifdef CONFIG_COMEDI_PCI static int ni_tio_output_cmd(struct ni_gpct *counter, comedi_async * async) { rt_printk("ni_tio: output commands not yet implemented.\n"); @@ -2545,7 +2552,9 @@ static int ni_tio_output_cmd(struct ni_gpct *counter, comedi_async * async) mite_dma_arm(counter->mite_chan); return ni_tio_arm(counter, 1, NI_GPCT_ARM_IMMEDIATE); } +#endif +#ifdef CONFIG_COMEDI_PCI static int ni_tio_cmd_setup(struct ni_gpct *counter, comedi_async * async) { comedi_cmd *cmd = &async->cmd; @@ -2571,7 +2580,9 @@ static int ni_tio_cmd_setup(struct ni_gpct *counter, comedi_async * async) } return retval; } +#endif +#ifdef CONFIG_COMEDI_PCI int ni_tio_cmd(struct ni_gpct *counter, comedi_async * async) { comedi_cmd *cmd = &async->cmd; @@ -2596,7 +2607,9 @@ int ni_tio_cmd(struct ni_gpct *counter, comedi_async * async) comedi_spin_unlock_irqrestore(&counter->lock, flags); return retval; } +#endif +#ifdef CONFIG_COMEDI_PCI int ni_tio_cmdtest(struct ni_gpct *counter, comedi_cmd * cmd) { int err = 0; @@ -2701,7 +2714,9 @@ int ni_tio_cmdtest(struct ni_gpct *counter, comedi_cmd * cmd) return 0; } +#endif +#ifdef CONFIG_COMEDI_PCI int ni_tio_cancel(struct ni_gpct *counter) { unsigned long flags; @@ -2719,10 +2734,12 @@ int ni_tio_cancel(struct ni_gpct *counter) Gi_Gate_Interrupt_Enable_Bit(counter->counter_index), 0x0); return 0; } +#endif /* During buffered input counter operation for e-series, the gate interrupt is acked automatically by the dma controller, due to the Gi_Read/Write_Acknowledges_IRQ bits in the input select register. */ +#ifdef CONFIG_COMEDI_PCI static int should_ack_gate(struct ni_gpct *counter) { unsigned long flags; @@ -2747,7 +2764,9 @@ static int should_ack_gate(struct ni_gpct *counter) } return retval; } +#endif +#ifdef CONFIG_COMEDI_PCI void ni_tio_acknowledge_and_confirm(struct ni_gpct *counter, int *gate_error, int *tc_error, int *perm_stale_data, int *stale_data) { @@ -2811,7 +2830,9 @@ void ni_tio_acknowledge_and_confirm(struct ni_gpct *counter, int *gate_error, } } } +#endif +#ifdef CONFIG_COMEDI_PCI void ni_tio_handle_interrupt(struct ni_gpct *counter, comedi_subdevice * s) { unsigned gpct_mite_status; @@ -2856,7 +2877,9 @@ void ni_tio_handle_interrupt(struct ni_gpct *counter, comedi_subdevice * s) mite_sync_input_dma(counter->mite_chan, s->async); comedi_spin_unlock_irqrestore(&counter->lock, flags); } +#endif +#ifdef CONFIG_COMEDI_PCI void ni_tio_set_mite_channel(struct ni_gpct *counter, struct mite_channel *mite_chan) { @@ -2866,16 +2889,21 @@ void ni_tio_set_mite_channel(struct ni_gpct *counter, counter->mite_chan = mite_chan; comedi_spin_unlock_irqrestore(&counter->lock, flags); } +#endif EXPORT_SYMBOL_GPL(ni_tio_rinsn); EXPORT_SYMBOL_GPL(ni_tio_winsn); +#ifdef CONFIG_COMEDI_PCI EXPORT_SYMBOL_GPL(ni_tio_cmd); EXPORT_SYMBOL_GPL(ni_tio_cmdtest); EXPORT_SYMBOL_GPL(ni_tio_cancel); +#endif EXPORT_SYMBOL_GPL(ni_tio_insn_config); EXPORT_SYMBOL_GPL(ni_tio_init_counter); EXPORT_SYMBOL_GPL(ni_gpct_device_construct); EXPORT_SYMBOL_GPL(ni_gpct_device_destroy); +#ifdef CONFIG_COMEDI_PCI EXPORT_SYMBOL_GPL(ni_tio_handle_interrupt); EXPORT_SYMBOL_GPL(ni_tio_set_mite_channel); EXPORT_SYMBOL_GPL(ni_tio_acknowledge_and_confirm); +#endif diff --git a/configure.ac b/configure.ac index db86a8d1..bb7c1522 100644 --- a/configure.ac +++ b/configure.ac @@ -67,6 +67,26 @@ CC=$LINUX_CC -DKBUILD_BASENAME=\$(shell basename \$< .c)"] AC_SUBST(COMEDI_CFLAGS) +AS_CHECK_LINUX_CONFIG_OPTION([CONFIG_PCI],[HAVE_PCI="yes"],[HAVE_PCI="yes"],[HAVE_PCI="no"]) +AM_CONDITIONAL([CONFIG_PCI],[test "$HAVE_PCI" = "yes"]) +AC_ARG_ENABLE([pci],[ --disable-pci Disable support for PCI devices], + [ENABLE_PCI=$enableval],[ENABLE_PCI="maybe"]) +if test "$HAVE_PCI" = "yes" ; then + if test "ENABLE_PCI" = "no" ; then + AC_MSG_NOTICE([PCI support disabled]) + USE_PCI="no" + else + AC_DEFINE([CONFIG_COMEDI_PCI],[true],[Define if PCI support is enabled]) + USE_PCI="yes" + fi +else + if test "ENABLE_PCI" = "yes" ; then + AC_MSG_ERROR([Kernel does not support PCI]) + fi + USE_PCI="no" +fi +AM_CONDITIONAL([CONFIG_COMEDI_PCI],[test "$USE_PCI" = "yes"]) + COMEDI_CHECK_PCMCIA_PROBE([$LINUX_SRC_DIR], [HAVE_PCMCIA="yes"], [HAVE_PCMCIA="no"]) AM_CONDITIONAL([CONFIG_PCMCIA],[test "$HAVE_PCMCIA" = "yes"]) AC_ARG_ENABLE([pcmcia],[ --disable-pcmcia Disable support for PCMCIA devices], @@ -113,7 +133,6 @@ AC_ARG_ENABLE([kbuild], [ --enable-kbuild Force use (or not) of kernel's Kbuild AM_CONDITIONAL([CONFIG_KBUILD], [test ${ENABLE_KBUILD} = "yes"]) COMEDI_CHECK_HAVE_MUTEX_H([$LINUX_SRC_DIR], [HAVE_MUTEX_H="yes"], [HAVE_MUTEX_H="no"]) AS_LINUX_CONFIG_OPTION_MODULE(CONFIG_ISA) -AS_LINUX_CONFIG_OPTION_MODULE(CONFIG_PCI) AC_DEFINE(CONFIG_COMEDI_DEBUG, true, [Define if debugging is enabled]) AC_DEFINE(CONFIG_COMEDI_8255, true, [Define if 8255 support is enabled])