From: Frank Mori Hess Date: Thu, 23 Oct 2003 00:44:07 +0000 (+0000) Subject: some pci_request_regions() tweaks, and set DUMMY_BIT on writes to X-Git-Tag: r0_7_69~168 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=be77dbbe0a1e383f6e14c90c2f2b381978ab8fbb;p=comedi.git some pci_request_regions() tweaks, and set DUMMY_BIT on writes to calibration reg 2 in cb_pcidda.c --- diff --git a/comedi/drivers/adl_pci9111.c b/comedi/drivers/adl_pci9111.c index d04a9085..734807ff 100644 --- a/comedi/drivers/adl_pci9111.c +++ b/comedi/drivers/adl_pci9111.c @@ -1261,33 +1261,24 @@ found: dev->minor, lcr_io_base, lcr_io_range); - - if (check_region (lcr_io_base, lcr_io_range) < 0) - { - printk("comedi%d: I/O port conflict\n",dev->minor); - return -EIO; - } - + // Read PCI6308 register base address [PCI_BASE_ADDRESS #2]. - + io_base = pci_resource_start (pci_device, 2); io_range = pci_resource_end (pci_device, 2) - io_base +1; - + printk ("comedi%d: 6503 registers at address 0x%4x [0x%4x]\n", dev->minor, io_base, io_range); - if (check_region (io_base, io_range) < 0) - { - printk("comedi%d: I/O port conflict\n",dev->minor); - return -EIO; - } - // Allocate IO ressources - - pci_request_regions(pci_device, PCI9111_DRIVER_NAME); - + if(pci_request_regions(pci_device, PCI9111_DRIVER_NAME)) + { + printk("comedi%d: I/O port conflict\n",dev->minor); + return -EIO; + } + dev->iobase=io_base; dev->board_name = board->name; diff --git a/comedi/drivers/cb_pcidda.c b/comedi/drivers/cb_pcidda.c index 9b5f9047..6fa9570a 100644 --- a/comedi/drivers/cb_pcidda.c +++ b/comedi/drivers/cb_pcidda.c @@ -270,7 +270,6 @@ static int cb_pcidda_attach(comedi_device *dev, comedi_devconfig *it) comedi_subdevice *s; struct pci_dev* pcidev; int index; - unsigned int dac, digitalio; printk("comedi%d: cb_pcidda: ",dev->minor); @@ -309,7 +308,7 @@ static int cb_pcidda_attach(comedi_device *dev, comedi_devconfig *it) } } printk("Not a supported ComputerBoards/MeasurementComputing card on " - "requested position\n"); + "requested position\n"); return -EIO; found: @@ -324,29 +323,17 @@ found: */ if(pci_enable_device(devpriv->pci_dev)) return -EIO; - digitalio = pci_resource_start(devpriv->pci_dev, DIGITALIO_BADRINDEX); - dac = pci_resource_start(devpriv->pci_dev, DAC_BADRINDEX); /* * Allocate the I/O ports. */ - if (check_region(digitalio, DIGITALIO_SIZE) < 0) + if (pci_request_regions(devpriv->pci_dev, thisboard->name)) { - printk("I/O port conflict: failed to allocate ports 0x%x to 0x%x\n", - digitalio, digitalio + DIGITALIO_SIZE - 1); + printk("cb_pcidda: I/O port conflict\n"); return -EIO; } - if (check_region(dac, 8 + thisboard->ao_chans*2) < 0) - { - printk("I/O port conflict: failed to allocate ports 0x%x to 0x%x\n", - dac, dac + 7 + thisboard->ao_chans*2); - return -EIO; - } - request_region(digitalio, DIGITALIO_SIZE, thisboard->name); - devpriv->digitalio = digitalio; - request_region(dac, 8 + thisboard->ao_chans*2, - thisboard->name); - devpriv->dac = dac; + devpriv->digitalio = pci_resource_start(devpriv->pci_dev, DIGITALIO_BADRINDEX); + devpriv->dac = pci_resource_start(devpriv->pci_dev, DAC_BADRINDEX); /* * Warn about the status of the driver. @@ -729,7 +716,7 @@ static unsigned int cb_pcidda_read_eeprom(comedi_device *dev, unsigned int addre const int address_length = 8; // send serial output stream to eeprom - cal2_bits = SELECT_EEPROM_BIT | DESELECT_REF_DAC_BIT; + cal2_bits = SELECT_EEPROM_BIT | DESELECT_REF_DAC_BIT | DUMMY_BIT; // deactivate caldacs (one caldac for every two channels) for(i = 0; i < max_num_caldacs; i++) { @@ -768,7 +755,7 @@ static void cb_pcidda_write_caldac(comedi_device *dev, unsigned int caldac, // latch stream into appropriate caldac // deselect reference dac - cal2_bits = DESELECT_REF_DAC_BIT; + cal2_bits = DESELECT_REF_DAC_BIT | DUMMY_BIT; // deactivate caldacs (one caldac for every two channels) for(i = 0; i < max_num_caldacs; i++) {