/*
comedi/drivers/adl_pci6208.c
-
+
Hardware driver for ADLink 6208 series cards:
card | voltage output | current output
-------------+-------------------+---------------
none
References:
- - ni_660x.c
+ - ni_660x.c
- adl_pci9111.c copied the entire pci setup section
- - adl_pci9118.c
+ - adl_pci9118.c
*/
/*
* These headers should be followed by a blank line, and any comments
detach:pci6208_detach,
};
-COMEDI_INITCLEANUP(driver_pci6208);
+COMEDI_PCI_INITCLEANUP(driver_pci6208, pci6208_pci_table);
static int pci6208_find_device(comedi_device * dev, int bus, int slot);
static int
/*
* _detach is called to deconfigure a device. It should deallocate
- * resources.
+ * resources.
* This function is also called when _attach() fails, so it should be
* careful not to release resources that were not necessarily
* allocated by _attach(). dev->private and dev->subdevices are
return 0;
}
-COMEDI_INITCLEANUP(driver_adl_pci7296);
+COMEDI_PCI_INITCLEANUP(driver_adl_pci7296, adl_pci7296_pci_table);
return 2;
}
-COMEDI_INITCLEANUP(driver_adl_pci7432);
+COMEDI_PCI_INITCLEANUP(driver_adl_pci7432, adl_pci7432_pci_table);
return 2;
}
-COMEDI_INITCLEANUP(driver_adl_pci8164);
+COMEDI_PCI_INITCLEANUP(driver_adl_pci8164, adl_pci8164_pci_table);
offset:sizeof(pci9111_board_struct),
};
-COMEDI_INITCLEANUP(pci9111_driver);
+COMEDI_PCI_INITCLEANUP(pci9111_driver, pci9111_pci_table);
//
// Private data structure
offset:sizeof(boardtype),
};
-COMEDI_INITCLEANUP(driver_pci9118);
+COMEDI_PCI_INITCLEANUP(driver_pci9118, pci9118_pci_table);
typedef struct {
unsigned long iobase_a; // base+size for AMCC chip
/*
==============================================================================
*/
-COMEDI_INITCLEANUP(driver_pci1710);
+COMEDI_PCI_INITCLEANUP(driver_pci1710, pci1710_pci_table);
/*
==============================================================================
*/
* A convenient macro that defines init_module() and cleanup_module(),
* as necessary.
*/
-COMEDI_INITCLEANUP(driver_pci1723);
+COMEDI_PCI_INITCLEANUP(driver_pci1723, pci1723_pci_table);
// Advantech PCI-1736UP
#define PCI1736_IDI 0 /* R: Isolated digital input 0-15 */
#define PCI1736_IDO 0 /* W: Isolated digital output 0-15 */
-#define PCI1736_3_INT_EN 0x08 /* R/W: enable/disable interrupts */
+#define PCI1736_3_INT_EN 0x08 /* R/W: enable/disable interrupts */
#define PCI1736_3_INT_RF 0x0c /* R/W: set falling/raising edge for interrupts */
#define PCI1736_3_INT_CLR 0x10 /* R/W: clear interrupts */
#define PCI1736_BOARDID 4 /* R: Board I/D switch for 1736UP */
/*
==============================================================================
*/
-COMEDI_INITCLEANUP(driver_pci_dio);
+COMEDI_PCI_INITCLEANUP(driver_pci_dio, pci_dio_pci_table);
/*
==============================================================================
*/
num_names:sizeof(dio200_boards) / sizeof(dio200_board),
};
-COMEDI_INITCLEANUP(driver_amplc_dio200);
+COMEDI_PCI_INITCLEANUP(driver_amplc_dio200, dio200_pci_table);
/*
* This function looks for a PCI device matching the requested board name,
num_names:sizeof(pc236_boards) / sizeof(pc236_board),
};
-COMEDI_INITCLEANUP(driver_amplc_pc236);
+COMEDI_PCI_INITCLEANUP(driver_amplc_pc236, pc236_pci_table);
static int pc236_request_region(unsigned long from, unsigned long extent);
static void pc236_intr_disable(comedi_device * dev);
comedi_pci_disable(devpriv->pci_dev);
}
pci_dev_put(devpriv->pci_dev);
- } else
+ } else
#endif
{
if (dev->iobase) {
* A convenient macro that defines init_module() and cleanup_module(),
* as necessary.
*/
-COMEDI_INITCLEANUP(driver_amplc_pc263);
+COMEDI_PCI_INITCLEANUP(driver_amplc_pc263, pc263_pci_table);
num_names:sizeof(pci224_boards) / sizeof(pci224_board),
};
-COMEDI_INITCLEANUP(driver_amplc_pci224);
+COMEDI_PCI_INITCLEANUP(driver_amplc_pci224, pci224_pci_table);
/*
* Called from the 'insn_write' function to perform a single write.
PCI230(+) PCI260(+)
--------- ---------
Subdevices 3 1
- 0 AI AI
+ 0 AI AI
1 AO
2 DIO
The AI subdevice has 16 single-ended channels or 8 differential
channels.
-
+
The PCI230 and PCI260 cards have 12-bit resolution. The PCI230+ and
PCI260+ cards have 16-bit resolution.
-
+
For differential mode, use inputs 2N and 2N+1 for channel N (e.g. use
inputs 14 and 15 for channel 7). If the card is physically a PCI230
or PCI260 then it actually uses a "pseudo-differential" mode where the
num_names:sizeof(pci230_boards) / sizeof(pci230_boards[0]),
};
-COMEDI_INITCLEANUP(driver_amplc_pci230);
+COMEDI_PCI_INITCLEANUP(driver_amplc_pci230, pci230_pci_table);
static int pci230_ai_rinsn(comedi_device * dev, comedi_subdevice * s,
comedi_insn * insn, lsampl_t * data);
* A convenient macro that defines init_module() and cleanup_module(),
* as necessary.
*/
-COMEDI_INITCLEANUP(driver_cb_pcidas);
+COMEDI_PCI_INITCLEANUP(driver_cb_pcidas, cb_pcidas_pci_table);
static unsigned int get_ao_divisor(unsigned int ns, unsigned int flags);
static void load_ao_dma(comedi_device * dev, const comedi_cmd * cmd);
-COMEDI_INITCLEANUP(driver_cb_pcidas);
+COMEDI_PCI_INITCLEANUP(driver_cb_pcidas, pcidas64_pci_table);
static unsigned int ai_range_bits_6xxx(const comedi_device * dev,
unsigned int range_index)
* A convenient macro that defines init_module() and cleanup_module(),
* as necessary.
*/
-COMEDI_INITCLEANUP(driver_cb_pcidda);
+COMEDI_PCI_INITCLEANUP(driver_cb_pcidda, cb_pcidda_pci_table);
* A convenient macro that defines init_module() and cleanup_module(),
* as necessary.
*/
-COMEDI_INITCLEANUP(driver_cb_pcidio);
+COMEDI_PCI_INITCLEANUP(driver_cb_pcidio, pcidio_pci_table);
* A convenient macro that defines init_module() and cleanup_module(),
* as necessary.
*/
-COMEDI_INITCLEANUP(driver_cb_pcimdas);
+COMEDI_PCI_INITCLEANUP(driver_cb_pcimdas, cb_pcimdas_pci_table);
"series. Currently only supports PCIM-DDA06-16 (which "
"also happens to be the only board in this series. :) ) ");
MODULE_LICENSE("GPL");
-COMEDI_INITCLEANUP_NOMODULE(cb_pcimdda_driver);
+COMEDI_PCI_INITCLEANUP_NOMODULE(cb_pcimdda_driver, pci_table);
static int ao_winsn(comedi_device * dev, comedi_subdevice * s,
comedi_insn * insn, lsampl_t * data);
return 2;
}
-COMEDI_INITCLEANUP(driver_contec);
+COMEDI_PCI_INITCLEANUP(driver_contec, contec_pci_table);
Much of the functionality of this driver was determined from reading
the source code for the Windows driver.
-The FPGA on the board requires initialization code, which can
+The FPGA on the board requires initialization code, which can
be loaded by comedi_config using the -i
option. The initialization code is available from http://www.comedi.org
in the comedi_nonfree_firmware tarball.
PCI device found will be used.
*/
/*
- This card was obviously never intended to leave the Windows world,
- since it lacked all kind of hardware documentation (except for cable
- pinouts, plug and pray has something to catch up with yet).
+ This card was obviously never intended to leave the Windows world,
+ since it lacked all kind of hardware documentation (except for cable
+ pinouts, plug and pray has something to catch up with yet).
- With some help from our swedish distributor, we got the Windows sourcecode
+ With some help from our swedish distributor, we got the Windows sourcecode
for the card, and here are the findings so far.
1. A good document that describes the PCI interface chip is found at:
http://plx.plxtech.com/download/9080/databook/9080db-106.pdf
-
+
2. The initialization done so far is:
a. program the FPGA (windows code sans a lot of error messages)
- b.
+ b.
- 3. Analog out seems to work OK with DAC's disabled, if DAC's are enabled,
+ 3. Analog out seems to work OK with DAC's disabled, if DAC's are enabled,
you have to output values to all enabled DAC's until result appears, I
- guess that it has something to do with pacer clocks, but the source
+ guess that it has something to do with pacer clocks, but the source
gives me no clues. I'll keep it simple so far.
- 4. Analog in.
+ 4. Analog in.
Each channel in the scanlist seems to be controlled by four
control words:
| +---------------- Unipolar
+------------------------- Correction gain high
-
+
999. The card seems to have an incredible amount of capabilities, but
trying to reverse engineer them from the Windows source is beyond my
patience.
-
+
*/
#include <linux/comedidev.h>
//comedi_udelay(2);
}
devpriv->ao_readback[chan] = data[i];
- /*
+ /*
* Since we never enabled the DAC's, we don't need to disable it...
* fpga->dacControl = (chan + 2) * 0x0010 | 0x0000; comedi_udelay(1000);
*/
return 0;
}
-COMEDI_INITCLEANUP(driver_daqboard2000);
+COMEDI_PCI_INITCLEANUP(driver_daqboard2000, daqboard2000_pci_table);
return 0;
}
-COMEDI_INITCLEANUP(driver_das08);
+COMEDI_PCI_INITCLEANUP(driver_das08, das08_pci_table);
EXPORT_SYMBOL_GPL(das08_common_attach);
EXPORT_SYMBOL_GPL(das08_common_detach);
detach:dt3000_detach,
};
-COMEDI_INITCLEANUP(driver_dt3000);
+COMEDI_PCI_INITCLEANUP(driver_dt3000, dt3k_pci_table);
static void dt3k_ai_empty_fifo(comedi_device * dev, comedi_subdevice * s);
static int dt3k_ns_to_timer(unsigned int timer_base, unsigned int *arg,
detach:hpdi_detach,
};
-COMEDI_INITCLEANUP(driver_hpdi);
+COMEDI_PCI_INITCLEANUP(driver_hpdi, hpdi_pci_table);
static int dio_config_insn(comedi_device * dev, comedi_subdevice * s,
comedi_insn * insn, lsampl_t * data)
Status: works
Devices: [JR3] PCI force sensor board (jr3_pci)
- The DSP on the board requires initialization code, which can
- be loaded by placing it in /lib/firmware/comedi.
- The initialization code should be somewhere on the media you got
+ The DSP on the board requires initialization code, which can
+ be loaded by placing it in /lib/firmware/comedi.
+ The initialization code should be somewhere on the media you got
with your card. One version is available from http://www.comedi.org
in the comedi_nonfree_firmware tarball.
{
int result = 0;
if (pos != 0 && val != 0) {
- // Skip over non hex
+ // Skip over non hex
for (; *pos < size && !isxdigit(data[*pos]); (*pos)++) {
}
// Collect value
// printk("jr3_data, not tested\n");
// jr3[addr + 0x20000 * pnum] = data1;
} else {
- // Download 24 bit program
+ // Download 24 bit program
unsigned int data1, data2;
more = more
u16 serial_no = get_u16(&channel->serial_no);
if ((errors & (watch_dog | watch_dog2)) ||
model_no == 0 || serial_no == 0) {
- // Still no sensor, keep on polling. Since it takes up to
+ // Still no sensor, keep on polling. Since it takes up to
// 10 seconds for offsets to stabilize, polling each
// second should suffice.
result = poll_delay_min_max(1000, 2000);
subdevpriv->next_time_max =
jiffies + msecs_to_jiffies(sub_delay.max);
if (sub_delay.max && sub_delay.max < delay) {
- // Wake up as late as possible -> poll as many channels as
+ // Wake up as late as possible -> poll as many channels as
// possible at once
delay = sub_delay.max;
}
}
// TODO: use firmware to load preferred offset tables. Suggested format:
// model serial Fx Fy Fz Mx My Mz\n
- //
+ //
// comedi_load_firmware(dev, "jr3_offsets_table", jr3_download_firmware);
// It takes a few milliseconds for software to settle
return 0;
}
-COMEDI_INITCLEANUP(driver_jr3_pci);
+COMEDI_PCI_INITCLEANUP(driver_jr3_pci, jr3_pci_pci_table);
detach:cnt_detach,
};
-COMEDI_INITCLEANUP(cnt_driver);
+COMEDI_PCI_INITCLEANUP(cnt_driver, cnt_pci_table);
/*-- counter write ----------------------------------------------------------*/
return 1;
}
-COMEDI_INITCLEANUP(driver_me4000);
+COMEDI_PCI_INITCLEANUP(driver_me4000, me4000_pci_table);
offset:sizeof(me_board_struct),
};
-COMEDI_INITCLEANUP(me_driver);
+COMEDI_PCI_INITCLEANUP(me_driver, me_pci_table);
//
// Private data structure
detach:ni6527_detach,
};
-COMEDI_INITCLEANUP(driver_ni6527);
-
typedef struct {
int dev_id;
const char *name;
mite_list_devices();
return -EIO;
}
+
+COMEDI_PCI_INITCLEANUP(driver_ni6527, ni6527_pci_table);
detach:ni_65xx_detach,
};
-COMEDI_INITCLEANUP(driver_ni_65xx);
-
typedef struct {
int dev_id;
const char *name;
mite_list_devices();
return -EIO;
}
+
+COMEDI_PCI_INITCLEANUP(driver_ni_65xx, ni_65xx_pci_table);
detach:ni_660x_detach,
};
-COMEDI_INITCLEANUP(driver_ni_660x);
+COMEDI_PCI_INITCLEANUP(driver_ni_660x, ni_660x_pci_table);
static int ni_660x_find_device(comedi_device * dev, int bus, int slot);
static int ni_660x_set_pfi_routing(comedi_device * dev, unsigned chan,
detach:ni_670x_detach,
};
-COMEDI_INITCLEANUP(driver_ni_670x);
+COMEDI_PCI_INITCLEANUP(driver_ni_670x, ni_670x_pci_table);
static comedi_lrange range_0_20mA = { 1, {RANGE_mA(0, 20)} };
devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG);
}
-COMEDI_INITCLEANUP(driver_labpc);
+COMEDI_PCI_INITCLEANUP(driver_labpc, labpc_pci_table);
EXPORT_SYMBOL_GPL(labpc_common_attach);
EXPORT_SYMBOL_GPL(labpc_common_detach);
detach:nidio_detach,
};
-COMEDI_INITCLEANUP(driver_pcidio);
-
typedef struct {
int dev_id;
const char *name;
mite_list_devices();
return -EIO;
}
+
+COMEDI_PCI_INITCLEANUP(driver_pcidio, ni_pcidio_pci_table);
* A convenient macro that defines init_module() and cleanup_module(),
* as necessary.
*/
-COMEDI_INITCLEANUP(rtd520Driver);
+COMEDI_PCI_INITCLEANUP(rtd520Driver, rtd520_pci_table);
#define devpriv ((s626_private *)dev->private)
#define diopriv ((dio_private *)s->private)
-COMEDI_INITCLEANUP_NOMODULE(driver_s626);
+COMEDI_PCI_INITCLEANUP_NOMODULE(driver_s626, s626_pci_table);
//ioctl routines
static int s626_ai_insn_config(comedi_device * dev, comedi_subdevice * s,
* it is, this is the place to do it. Otherwise, dev->board_ptr
* should already be initialized.
*/
- //dev->board_ptr = skel_probe(dev);
+ //dev->board_ptr = skel_probe(dev, it);
/*
* Initialize dev->board_name. Note that we can use the "thisboard"
* as necessary.
*/
COMEDI_INITCLEANUP(driver_skel);
+/* If you are writing a PCI driver you should use COMEDI_PCI_INITCLEANUP instead.
+*/
+// COMEDI_PCI_INITCLEANUP(driver_skel, skel_pci_table)
#define COMEDI_INITCLEANUP(x) \
COMEDI_MODULE_MACROS \
- static int __init x ## _init_module(void) \
- {return comedi_driver_register(&(x));} \
- static void __exit x ## _cleanup_module(void) \
- {comedi_driver_unregister(&(x));} \
- module_init(x ## _init_module); \
- module_exit(x ## _cleanup_module); \
+ COMEDI_INITCLEANUP_NOMODULE(x)
-#define COMEDI_PCI_INITCLEANUP(comedi_driver, pci_id_table) \
- COMEDI_MODULE_MACROS \
+#define COMEDI_PCI_INITCLEANUP_NOMODULE(comedi_driver, pci_id_table) \
static int __devinit comedi_driver ## _pci_probe(struct pci_dev *dev, \
const struct pci_device_id *ent) \
{ \
module_init(comedi_driver ## _init_module); \
module_exit(comedi_driver ## _cleanup_module);
+#define COMEDI_PCI_INITCLEANUP(comedi_driver, pci_id_table) \
+ COMEDI_MODULE_MACROS \
+ COMEDI_PCI_INITCLEANUP_NOMODULE(comedi_driver, pci_id_table)
+
#define PCI_VENDOR_ID_INOVA 0x104c
#define PCI_VENDOR_ID_NATINST 0x1093
#define PCI_VENDOR_ID_DATX 0x1116