From 7e13b1424790226ffc99a0adc4da89714daf8873 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Thu, 6 Oct 2005 17:42:02 +0000 Subject: [PATCH] merge branch-0_7 back to HEAD --- ChangeLog | 11817 +++++++++++++++++- comedi/comedi_fops.c | 20 +- comedi/drivers.c | 6 +- comedi/drivers/8253.h | 21 +- comedi/drivers/8255.c | 4 +- comedi/drivers/Makefile.am | 9 +- comedi/drivers/acl7225b.c | 6 +- comedi/drivers/addi-data/APCI1710_82x54.c | 1970 +-- comedi/drivers/addi-data/APCI1710_82x54.h | 95 +- comedi/drivers/addi-data/APCI1710_Chrono.c | 1638 +-- comedi/drivers/addi-data/APCI1710_Chrono.h | 79 +- comedi/drivers/addi-data/APCI1710_Dig_io.c | 104 +- comedi/drivers/addi-data/APCI1710_Dig_io.h | 24 +- comedi/drivers/addi-data/APCI1710_INCCPT.c | 469 +- comedi/drivers/addi-data/APCI1710_INCCPT.h | 30 +- comedi/drivers/addi-data/APCI1710_Inp_cpt.c | 178 +- comedi/drivers/addi-data/APCI1710_Inp_cpt.h | 39 +- comedi/drivers/addi-data/APCI1710_Pwm.c | 4721 +++---- comedi/drivers/addi-data/APCI1710_Pwm.h | 145 +- comedi/drivers/addi-data/APCI1710_Ssi.c | 120 +- comedi/drivers/addi-data/APCI1710_Ssi.h | 32 +- comedi/drivers/addi-data/APCI1710_Tor.c | 267 +- comedi/drivers/addi-data/APCI1710_Tor.h | 44 +- comedi/drivers/addi-data/APCI1710_Ttl.c | 457 +- comedi/drivers/addi-data/APCI1710_Ttl.h | 33 +- comedi/drivers/addi-data/addi_amcc_S5920.c | 185 + comedi/drivers/addi-data/addi_amcc_S5920.h | 63 + comedi/drivers/addi-data/addi_amcc_s5933.h | 48 +- comedi/drivers/addi-data/addi_common.c | 2918 ++++- comedi/drivers/addi-data/addi_common.h | 78 +- comedi/drivers/addi-data/addi_eeprom.c | 1514 ++- comedi/drivers/addi-data/hwdrv_APCI1710.c | 2334 ++-- comedi/drivers/addi-data/hwdrv_APCI1710.h | 94 +- comedi/drivers/addi-data/hwdrv_apci035.c | 812 +- comedi/drivers/addi-data/hwdrv_apci035.h | 133 +- comedi/drivers/addi-data/hwdrv_apci1032.c | 37 +- comedi/drivers/addi-data/hwdrv_apci1032.h | 26 +- comedi/drivers/addi-data/hwdrv_apci1500.c | 48 +- comedi/drivers/addi-data/hwdrv_apci1500.h | 25 +- comedi/drivers/addi-data/hwdrv_apci1516.c | 949 +- comedi/drivers/addi-data/hwdrv_apci1516.h | 62 +- comedi/drivers/addi-data/hwdrv_apci1564.c | 1832 +-- comedi/drivers/addi-data/hwdrv_apci1564.h | 93 +- comedi/drivers/addi-data/hwdrv_apci16xx.c | 813 ++ comedi/drivers/addi-data/hwdrv_apci16xx.h | 111 + comedi/drivers/addi-data/hwdrv_apci2016.c | 610 +- comedi/drivers/addi-data/hwdrv_apci2016.h | 57 +- comedi/drivers/addi-data/hwdrv_apci2032.c | 30 +- comedi/drivers/addi-data/hwdrv_apci2032.h | 57 +- comedi/drivers/addi-data/hwdrv_apci2200.c | 30 +- comedi/drivers/addi-data/hwdrv_apci2200.h | 23 + comedi/drivers/addi-data/hwdrv_apci3120.c | 570 +- comedi/drivers/addi-data/hwdrv_apci3120.h | 27 +- comedi/drivers/addi-data/hwdrv_apci3200.c | 5090 +++++--- comedi/drivers/addi-data/hwdrv_apci3200.h | 197 +- comedi/drivers/addi-data/hwdrv_apci3501.c | 32 +- comedi/drivers/addi-data/hwdrv_apci3501.h | 23 + comedi/drivers/addi-data/hwdrv_apci3xxx.c | 1771 +++ comedi/drivers/addi-data/hwdrv_apci3xxx.h | 70 + comedi/drivers/adl_pci6208.c | 11 +- comedi/drivers/adl_pci9118.c | 15 +- comedi/drivers/adv_pci1710.c | 5 +- comedi/drivers/adv_pci_dio.c | 97 +- comedi/drivers/amplc_dio200.c | 5 +- comedi/drivers/amplc_pc236.c | 3 +- comedi/drivers/amplc_pc263.c | 7 +- comedi/drivers/amplc_pci230.c | 22 +- comedi/drivers/cb_das16_cs.c | 24 +- comedi/drivers/cb_pcidas.c | 39 +- comedi/drivers/cb_pcidas64.c | 55 +- comedi/drivers/comedi_parport.c | 3 +- comedi/drivers/daqboard2000.c | 4 +- comedi/drivers/das08.c | 19 +- comedi/drivers/das08_cs.c | 20 +- comedi/drivers/das16.c | 58 +- comedi/drivers/das16m1.c | 7 +- comedi/drivers/das1800.c | 6 +- comedi/drivers/das6402.c | 3 +- comedi/drivers/das800.c | 3 +- comedi/drivers/dmm32at.c | 1079 ++ comedi/drivers/dt2801.c | 3 +- comedi/drivers/dt2811.c | 3 +- comedi/drivers/dt2814.c | 3 +- comedi/drivers/dt2815.c | 3 +- comedi/drivers/dt2817.c | 3 +- comedi/drivers/dt282x.c | 3 +- comedi/drivers/dt3000.c | 81 +- comedi/drivers/fl512.c | 3 +- comedi/drivers/gsc_hpdi.c | 12 +- comedi/drivers/icp_multi.c | 83 +- comedi/drivers/ii_pci20kc.c | 65 +- comedi/drivers/me_daq.c | 8 +- comedi/drivers/mite.c | 83 +- comedi/drivers/mite.h | 58 +- comedi/drivers/multiq3.c | 3 +- comedi/drivers/ni_6527.c | 65 +- comedi/drivers/ni_660x.c | 101 +- comedi/drivers/ni_670x.c | 15 +- comedi/drivers/ni_at_a2150.c | 3 +- comedi/drivers/ni_at_ao.c | 3 +- comedi/drivers/ni_atmio.c | 11 +- comedi/drivers/ni_atmio16d.c | 6 +- comedi/drivers/ni_daq_dio24.c | 26 +- comedi/drivers/ni_labpc.c | 15 +- comedi/drivers/ni_labpc_cs.c | 32 +- comedi/drivers/ni_mio_common.c | 54 +- comedi/drivers/ni_mio_cs.c | 10 +- comedi/drivers/ni_pcidio.c | 195 +- comedi/drivers/ni_pcimio.c | 48 +- comedi/drivers/ni_stc.h | 1 + comedi/drivers/pcl711.c | 3 +- comedi/drivers/pcl724.c | 3 +- comedi/drivers/pcl725.c | 3 +- comedi/drivers/pcl726.c | 3 +- comedi/drivers/pcl730.c | 6 +- comedi/drivers/pcl812.c | 3 +- comedi/drivers/pcl816.c | 6 +- comedi/drivers/pcl818.c | 7 +- comedi/drivers/pcm3730.c | 3 +- comedi/drivers/pcmad.c | 3 +- comedi/drivers/plx9080.h | 4 +- comedi/drivers/poc.c | 3 +- comedi/drivers/quatech_daqp_cs.c | 16 +- comedi/drivers/rti800.c | 3 +- comedi/drivers/rti802.c | 3 +- comedi/drivers/s626.c | 3073 +++++ comedi/drivers/s626.h | 814 ++ comedi/drivers/usbdux.c | 105 +- comedi/drivers/usbduxfast.c | 144 +- configure.ac | 2 +- include/asm/pgtable.h | 7 + include/linux/comedi_rt.h | 1 - include/linux/compiler.h | 3 +- include/linux/device.h | 30 +- include/linux/ioport.h | 3 +- 135 files changed, 37349 insertions(+), 12476 deletions(-) create mode 100755 comedi/drivers/addi-data/addi_amcc_S5920.c create mode 100755 comedi/drivers/addi-data/addi_amcc_S5920.h create mode 100755 comedi/drivers/addi-data/hwdrv_apci16xx.c create mode 100755 comedi/drivers/addi-data/hwdrv_apci16xx.h create mode 100755 comedi/drivers/addi-data/hwdrv_apci3xxx.c create mode 100755 comedi/drivers/addi-data/hwdrv_apci3xxx.h create mode 100644 comedi/drivers/dmm32at.c create mode 100644 comedi/drivers/s626.c create mode 100644 comedi/drivers/s626.h diff --git a/ChangeLog b/ChangeLog index ae4be3f8..933ee592 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,55 +1,11764 @@ -2005-06-15 Frank Hess - - * Contributors: Added Alexis Berlemont and Simone Mannori. - * Makefile.am: Fix depmod call on "make install". - * comedi/rt.c: (comedi_request_irq), (comedi_free_irq), - (comedi_switch_to_rt), (comedi_switch_to_non_rt), - (handle_void_irq), (comedi_rt_get_irq), (fusion_handle_irq), - (comedi_rt_release_irq), (comedi_rt_init), (comedi_rt_cleanup), - (handle_rtl_irq): rtai fusion support from Alexis Berlemont, - plus some cleanups by me. - * comedi/rt_pend_tq.c: (rt_pend_call), (rt_pend_tq_init), - (rt_pend_tq_cleanup): rtai fusion support from Alexis Berlemont. - * include/linux/comedi_rt.h: Implemented comedi_spinlock_irqsave() - and comedi_spinlock_irqrestore for rtai fusion. - * m4/rtai.m4: rtai fusion support from Alexis Berlemont. - - -2005-06-04 Frank Hess - - Patch from abbotti@mev.co.uk (Ian Abbott) to - make it possible to remove deprecated check_region() - calls from drivers. - * include/linux/ioport.h: Added compat__request_region() - * include/linux/pci.h: Replace use of check_region() with - modern version of request_region(). - -2005-05-28 Frank Hess - - * include/linux/delay.h: Added msleep_interruptible() - * include/linux/time.h:i Added msecs_to_jiffies() and jiffies_to_msecs() - * include/linux/usb.h: Added USB_CONTROL_MSG() and USB_BULK_MSG() - -2005-04-20 David Schleef - - Remove the debian directory, since it's not maintained here. - * debian/changelog: - * debian/comedi-modules.control: - * debian/comedi-modules.postinst: - * debian/comedi-modules.prerm: - * debian/comedi-source.postinst: - * debian/comedi-source.prerm: - * debian/control: - * debian/copyright: - * debian/rules: - -2005-04-17 Frank Hess - - * comedi/kcomedilib/get.c: Added comedi_mark_buffer_written() to - kcomedilib. - -2005-04-07 David Schleef - - * ChangeLog-0.7: Move ChangeLog to ChangeLog-0.7, and start - this changelog +2005-10-01 11:12 fmhess + + * comedi/drivers/ni_mio_common.c: patch from Jan Gukelberger + : + + implemented INSN_CONFIG_DIO_QUERY for pfi subdevice. + +2005-09-20 16:27 fmhess + + * comedi/drivers/: das08_cs.c, ni_daq_dio24.c, ni_labpc_cs.c, + ni_mio_cs.c, quatech_daqp_cs.c: Deal with event callback getting + moved into pcmcia_driver struct in 2.6.13 kernels. + +2005-09-12 14:34 ds + + * comedi/drivers/: Makefile.am, dmm32at.c: + Add new driver + +2005-09-10 09:19 fmhess + + * comedi/drivers/adv_pci1710.c: Fixed range table for 1713. + +2005-09-10 09:10 fmhess + + * comedi/drivers/amplc_dio200.c: Patch from abbotti@mev.co.uk (Ian + Abbott): + + I cocked up the register offset for the third 8255 subdevice of + the Amplicon PC272E and PCI272 cards. It should be at offset + 0x10, not 0x0C. + +2005-09-10 09:08 fmhess + + * comedi/drivers/8253.h: added i8254_status() + +2005-09-10 09:04 fmhess + + * comedi/drivers/das08.c: Fixed initialization bug reported by + abbotti@mev.co.uk (Ian Abbott). + +2005-08-28 06:16 fmhess + + * comedi/drivers/cb_pcidas64.c: increase allowable number of + calibration sources, to try and find them on the 6052 + +2005-08-26 17:35 fmhess + + * comedi/drivers/ni_atmio.c: reverting caldac type for + AT-MIO-16XE-50, as it didn't help. + +2005-08-25 16:58 fmhess + + * include/linux/compiler.h: Patch from abbotti@mev.co.uk (Ian + Abbott): + + The include/linux/compiler.h file appeared in kernel 2.4.4, but + disappeared in 2.4.5 and didn't reappear until 2.4.10! Comedi + fails to build for kernel versions 2.4.5 through 2.4.9 inclusive + for this reason. + +2005-08-25 16:53 fmhess + + * comedi/drivers/ni_atmio.c: Added isapnp id for at-mio-16de-10 + from isapnp.conf attachment in bugzilla bug 165. + +2005-08-24 15:29 fmhess + + * comedi/drivers/ni_atmio.c: change caldac type for AT-MIO-16XE-50, + as we seem to be missing a coarse caldac adjustment. + +2005-08-22 17:50 fmhess + + * comedi/drivers/cb_pcidas64.c: fix number of ao bits for 6025 and + 6040 + +2005-08-20 08:47 fmhess + + * comedi/drivers/ni_daq_dio24.c: made ni_daq_dio24 driver accept + the driver name as the board name, as suggested by Calin A. + Culianu. + +2005-08-16 10:04 fmhess + + * include/linux/comedi_rt.h: removed redundant include of + linux/config.h + +2005-08-15 17:29 fmhess + + * comedi/drivers.c, include/asm/pgtable.h: fix for 4-level page + tables introduced in 2.6.12 + +2005-08-03 16:58 fmhess + + * comedi/comedi_fops.c: use vmalloc instead of kmalloc in + do_devconfig_ioctl() in order to accommodate large firmware + uploads (pci-6534). + +2005-07-31 19:05 fmhess + + * comedi/drivers/: mite.c, mite.h, ni_mio_common.c: be more careful + about mite transfer counts + +2005-07-30 14:26 fmhess + + * comedi/drivers/cb_pcidas64.c: don't set write_subdev for + pcidas-4020 + +2005-07-30 10:49 fmhess + + * comedi/drivers/: mite.c, mite.h: Add support for dumping + information from mite chip signature register, in particular the + number of dma channels + +2005-07-27 16:00 fmhess + + * comedi/drivers/ni_atmio.c: fix caldac type for at-mio-16de-10 + +2005-07-24 19:28 fmhess + + * comedi/drivers/ni_atmio.c: fixes for isapnp device id table + +2005-07-24 19:12 fmhess + + * INSTALL: revert INSTALL, which I accidentally blew away + +2005-07-24 19:10 fmhess + + * INSTALL, comedi/comedi_fops.c, include/linux/device.h: patch from + abbotti@mev.co.uk (Ian Abbott): + + The class_simple interface has been removed - mostly a renaming + exercise. Comedi needs to use the new interface with some + compatibility stuff for older kernels. + + The patch has been tested on 2.4.28, 2.6.12 and 2.6.13-rc1 and + seems to work. + +2005-07-24 19:09 fmhess + + * include/linux/time.h: jiffies_to_msecs was added in 2.6.7 (and + 2.4.29) + +2005-07-24 18:16 fmhess + + * include/linux/time.h: jiffies_to_msecs and msecs_to_jiffies were + backported to vanilla kernel 2.4.29 and later. + +2005-07-24 13:59 fmhess + + * comedi/drivers/s626.c: patch from abbotti@mev.co.uk (Ian Abbott): + + The s626.c driver needs to use COMEDI_INITCLEANUP_NOMODULE + instead of COMEDI_INITCLEANUP because it uses the MODULE_AUTHOR, + MODULE_DESCRIPTION and MODULE_LICENSE macros. I'm not sure why + it compiled okay on 2.6. + +2005-07-24 13:53 fmhess + + * comedi/drivers/Makefile.am: added s626_ko_SOURCES + +2005-07-24 13:50 fmhess + + * comedi/drivers/s626.c: Clairify comment about Sensoray driver. + +2005-07-24 13:50 fmhess + + * comedi/drivers/s626.h: patch from gpalli@deis.unibo.it (Gianluca + Palli): + + Added Sensoray copyright notice. + +2005-07-24 13:48 fmhess + + * comedi/drivers/s626.c: patch from gpalli@deis.unibo.it (Gianluca + Palli): + + All compilation warning has been fixed. The includes of user + space headers and #ifdef RTAI has been removed, rt_printk is used + for outputting debug messages. + + A bug in s626_ai_cmdtest has been fixed. + +2005-07-04 14:27 fmhess + + * comedi/drivers/: ni_labpc.c, ni_pcimio.c: mite_iobase is gone + +2005-07-04 11:20 fmhess + + * comedi/drivers/dt3000.c: add missing iounmap in detach + +2005-07-04 11:18 fmhess + + * comedi/drivers/: 8253.h, cb_pcidas64.c, daqboard2000.c, dt3000.c, + gsc_hpdi.c, icp_multi.c, ii_pci20kc.c, me_daq.c, mite.h, + ni_6527.c, ni_660x.c, ni_670x.c, ni_labpc.c, ni_pcidio.c, + ni_pcimio.c, plx9080.h: fix compile warnings due to doing + write[bwl] and read[bwl] to addresses specified by unsigned long + instead of void* + +2005-07-04 11:17 fmhess + + * include/linux/ioport.h: fix return value of request_mem_region + compatibility macro so it returns a non-null value (null + indicates error). + +2005-07-04 09:46 fmhess + + * comedi/drivers/adv_pci_dio.c: fix typo + +2005-06-26 10:53 fmhess + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: some tweaks to try + and support ao commands on pci boards without ao fifos. + +2005-06-26 08:35 fmhess + + * comedi/drivers/: amplc_pc263.c, cb_pcidas.c: patch from + abbotti@mev.co.uk (Ian Abbott): + + At the end of February (or possibly the beginning of March, + depending on your timezone!) I submitted a patch to remove + pci_find_device and use pci_get_device and pci_dev_put (and + occasionally pci_dev_get) instead. + + I messed up on the amplc_pc262 and cb_pcidas drivers as I forgot + to replace pci_find_device with pci_get_device, but added the + calls to pci_dev_put, so the PCI reference counts would go + negative when the device was detached. The attached patch + corrects this problem and also fixes an unrelated gcc warning in + the cb_pcidas driver about a possibly ambiguous 'else' requiring + braces (my fault again!). + +2005-06-26 08:17 fmhess + + * comedi/drivers/s626.h: patch from gpalli@deis.unibo.it (Gianluca + Palli): + + Got rid of user-space includes, and unneeded check for RTAI + +2005-06-16 17:55 fmhess + + * comedi/drivers/: Makefile.am, s626.c, s626.h: Sensoray 626 driver + from gpalli@deis.unibo.it (Gianluca Palli): + + This driver is based on the Sensoray 626 GPL Linux driver + + The ai_poll function is not yet implemented + + ao_cmd support is under development + + The 48 dio channels are divided in to 3 subdev (2,3 and 4) with + 16 channels (each group of 16 channels is managed by a different + hardware registers). These can be grouped in one subdev with 48 + bit mask. Channels 0-39 can be used as TRIG_EXT arg for ai_cmd + (cmd->start_src=TRIG_EXT; cmd->start_arg=20; subdev 3 channel 3 + is used as external trigger) + + Encoder/timer device has a lot of configuration option. Now only + the encoder configuration is avaiable. If ai_cmd + scan_begin_src=TRIG_TIMER or convert_src=TRIG_TIMER are selected, + the timer channel 5 and 4 respectively are used as trigger. + + The code is filled with a lot of debugging messages visible + compiling the code with -D_DEBUG_ flag + +2005-06-16 16:00 fmhess + + * comedi/drivers/ni_pcimio.c: ordered ni_pci_table[] by id, and + added some missing device ids + +2005-06-15 16:24 fmhess + + * ChangeLog, Contributors, Makefile.am, comedi/rt.c, + comedi/rt_pend_tq.c, include/linux/comedi_rt.h, m4/rtai.m4: * + Contributors: Added Alexis Berlemont and Simone Mannori. * + Makefile.am: Fix depmod call on "make install". * comedi/rt.c: + (comedi_request_irq), (comedi_free_irq), (comedi_switch_to_rt), + (comedi_switch_to_non_rt), (handle_void_irq), + (comedi_rt_get_irq), (fusion_handle_irq), + (comedi_rt_release_irq), (comedi_rt_init), (comedi_rt_cleanup), + (handle_rtl_irq): rtai fusion support from Alexis Berlemont, plus + some cleanups by me. * comedi/rt_pend_tq.c: (rt_pend_call), + (rt_pend_tq_init), (rt_pend_tq_cleanup): rtai fusion support from + Alexis Berlemont. * include/linux/comedi_rt.h: Implemented + comedi_spinlock_irqsave() and comedi_spinlock_irqrestore for rtai + fusion. * m4/rtai.m4: rtai fusion support from Alexis Berlemont. + +2005-06-15 16:11 fmhess + + * Contributors: add Alexis Berlemont + +2005-06-15 16:05 fmhess + + * Makefile.am: fix depmod call on install + +2005-06-15 15:58 fmhess + + * comedi/drivers/ni_pcimio.c: add pci id for PCI-6731 + +2005-06-14 04:16 fmhess + + * comedi/rt.c: only allocate comedi_irq_struct if we are going to + use it (fixes memory leak caused by my last changes). + +2005-06-13 18:43 fmhess + + * comedi/rt.c: undo my silly (and failed) attempt to support shared + RT interrupts + +2005-06-13 18:42 fmhess + + * comedi/rt.c: fix return type for comedi_irq_struct.handler on 2.6 + kernels + +2005-06-13 17:49 fmhess + + * comedi/rt.c: removed some obsolete #defines + +2005-06-12 19:14 fmhess + + * comedi/rt.c, comedi/rt_pend_tq.c, include/linux/comedi_rt.h, + m4/rtai.m4: rtai fusion support from Alexis Berlemont + , slightly modified by me. Patch to + comedi_rt_timer has not been applied yet. + +2005-06-12 18:29 fmhess + + * Contributors: added Simone Mannori + +2005-06-12 18:25 fmhess + + * comedi/drivers/cb_das16_cs.c: fix for analog output, based on + patch from Simone Mannori + +2005-06-12 15:09 bporr + + * comedi/drivers/usbduxfast.c: For one channel now sampling rates + up to 30MHz are possible. However, buffer overflows in the usb + system limit the number of consecutive samples to 256. At 5MHz + 796 samples are possible and at 3MHz continous sampling is + possible. + +2005-06-04 07:40 fmhess + + * ChangeLog, include/linux/ioport.h, include/linux/pci.h: Patch + from abbotti@mev.co.uk (Ian Abbott) to make it possible to remove + deprecated check_region() calls from drivers. * + include/linux/ioport.h: Added compat__request_region() * + include/linux/pci.h: Replace use of check_region() with modern + version of request_region(). + +2005-06-04 07:32 fmhess + + * comedi/drivers/8255.c, comedi/drivers/acl7225b.c, + comedi/drivers/adl_pci6208.c, comedi/drivers/adl_pci9118.c, + comedi/drivers/adv_pci1710.c, comedi/drivers/amplc_dio200.c, + comedi/drivers/amplc_pc236.c, comedi/drivers/amplc_pc263.c, + comedi/drivers/amplc_pci230.c, comedi/drivers/cb_pcidas.c, + comedi/drivers/comedi_parport.c, comedi/drivers/das08.c, + comedi/drivers/das16.c, comedi/drivers/das16m1.c, + comedi/drivers/das1800.c, comedi/drivers/das6402.c, + comedi/drivers/das800.c, comedi/drivers/dt2801.c, + comedi/drivers/dt2811.c, comedi/drivers/dt2814.c, + comedi/drivers/dt2815.c, comedi/drivers/dt2817.c, + comedi/drivers/dt282x.c, comedi/drivers/fl512.c, + comedi/drivers/multiq3.c, comedi/drivers/ni_at_a2150.c, + comedi/drivers/ni_at_ao.c, comedi/drivers/ni_atmio.c, + comedi/drivers/ni_atmio16d.c, comedi/drivers/ni_labpc.c, + comedi/drivers/pcl711.c, comedi/drivers/pcl724.c, + comedi/drivers/pcl725.c, comedi/drivers/pcl726.c, + comedi/drivers/pcl730.c, comedi/drivers/pcl812.c, + comedi/drivers/pcl816.c, comedi/drivers/pcl818.c, + comedi/drivers/pcm3730.c, comedi/drivers/pcmad.c, + comedi/drivers/poc.c, comedi/drivers/rti800.c, + comedi/drivers/rti802.c, include/linux/ioport.h, + include/linux/pci.h: Patch from Ian Abbot : + + I've done some work on getting rid of the check_region calls + which are now deprecated. + + I first mentioned this back in March and did a little bit of work + on it at the time: + + https://cvs.comedi.org/pipermail/comedi/2005-March/006971.html + https://cvs.comedi.org/pipermail/comedi/2005-March/006977.html + + My new patch seems to be too large for the comedi mailing list - + they just disappear into a black hole, so here is a description + of my latest patch: + + I used a static inline function called compat__request_region and + (re)defined a macro called request_region to use it. The result + is that drivers can check the return value of request_region (or + pci_request_regions) instead of calling check_region. Note that + the compat__request_region does not return a pointer to anything + real, but it can be compared to NULL. + + The attached patch implements the above compatibility stuff and + changes the drivers to use it (but I changed the amplc_pci230 + driver to use pci_request_regions instead of request_region while + I was at it). I've also changed the compatibility version of + pci_request_regions to avoid calling check_regions (otherwise it + would be called twice) and also made it release any regions it + successfully requested on failure. + + Most of the changes to the individual drivers were + straightforward. One or two required a modicum of thought to + release resources on error. + +2005-05-28 16:27 bporr + + * comedi/drivers/usbduxfast.c: urb_kill is available from 2.6.8 and + not from 2.6.10. This affects especially sarge which works with + 2.6.8. The urb_kill command is much safer than urb_unlink. + +2005-05-28 16:26 bporr + + * comedi/drivers/usbdux.c: urb_kill is available from 2.6.8 and not + from 2.6.10. This affects especially sarge which works with + 2.6.8. The urb_kill command is much safer than the urb_unlink. + The async cmd is modifying the sampling interval so that the user + program can use the real sampling rate. + +2005-05-28 12:10 fmhess + + * ChangeLog, include/linux/delay.h, include/linux/time.h, + include/linux/usb.h: * include/linux/delay.h: Added + msleep_interruptible() * include/linux/time.h:i Added + msecs_to_jiffies() and jiffies_to_msecs() * include/linux/usb.h: + Added USB_CONTROL_MSG() and USB_BULK_MSG() + +2005-05-28 12:02 fmhess + + * include/linux/: delay.h, time.h: added jiffies_to_msecs() and + msleep_interruptible() to compatibility headers + +2005-05-28 11:54 fmhess + + * include/linux/time.h: added msecs_to_jiffies() compatibility + definition + +2005-05-28 11:32 fmhess + + * comedi/drivers/usbdux.c, comedi/drivers/usbduxfast.c, + include/linux/usb.h: add USB_CONTROL_MSG and USB_BULK_MSG + compatibility functions due to change in meaning of timeout + argument with kernel 2.6.12 + +2005-05-23 15:56 bporr + + * comedi/drivers/usbdux.c: Reduced the amount of debug messages + during normal operation. + +2005-05-16 15:19 fmhess + + * include/linux/mm.h: revert to revision 1.8, as the issues with + remap_page_range have already been fixed by migrating to + remap_pfn_range + +2005-05-14 16:08 fmhess + + * comedi/drivers/das16.c: try to fix problems on pc104-das16jr that + occur when an dma transfer with an odd number of bytes occurs. + +2005-05-14 10:17 fmhess + + * comedi/drivers/adv_pci_dio.c: be more careful about sending + pci-1760 mailbox commands + +2005-05-13 17:06 fmhess + + * comedi/drivers/adv_pci_dio.c: fixes for 1760: base address index + was wrong (from Bill Jennings ), and + I cleaned up some dead code and removed broken (and unneeded) + pci1760_insn_read_di() + +2005-04-26 17:17 fmhess + + * comedi/drivers/ni_atmio16d.c: add error message when request_irq + fails + +2005-04-25 01:03 bporr + + * include/linux/mm.h: + Wiktor Grebla wrote in the comedi mailing list: Somwhere around + 2.6.9 kernel remap_pfn_range() was introduced as a portable + replacement for remap_page_range, presumably with some wrapper + which has dissapeared recently (2.6.11), what resulted in + "Unknown symbol" while loading comedi module (and the following + ones because of the symbols in it). I've changed + include/linux/mm.h slightly, hopefully without breaking anything. + Seems to work. I've tested it with 2.6.10 and 2.6.11. + +2005-04-20 17:46 ds + + * ChangeLog: Remove the debian directory, since it's not maintained + here. * debian/changelog: * debian/comedi-modules.control: * + debian/comedi-modules.postinst: * debian/comedi-modules.prerm: * + debian/comedi-source.postinst: * debian/comedi-source.prerm: * + debian/control: * debian/copyright: * debian/rules: + +2005-04-17 18:25 fmhess + + * ChangeLog, comedi/kcomedilib/get.c: * comedi/kcomedilib/get.c: + Added comedi_mark_buffer_written() to kcomedilib. + +2005-04-17 18:21 fmhess + + * comedi/kcomedilib/get.c: added comedi_mark_buffer_written() to + kcomedilib + +2005-04-17 15:30 bporr + + * comedi/drivers/usbduxfast.c: Changed maxrange from 0xfff to + 0x1000. The converter can reach the value 0x1000 if there's an + overflow. Thanks to Frank Mori Hess who pointed that out. + +2005-04-17 15:27 bporr + + * comedi/drivers/usbdux.c: Applied to the 0.7 branch: Fixed a bug + which uploaded the firmware always to the first device. Even if + there were two devices. Thus, the second device never got the + firmware uploaded. Thanks to Bjorn Kinell. + +2005-04-13 12:34 bporr + + * comedi/drivers/usbdux.c: Fixed a bug which uploaded the firmware + always to the first device. Even if there were two devices. Thus, + the second device never got the firmware uploaded. Thanks to + Bjorn Kinell. + +2005-04-07 19:58 ds + + * ChangeLog, ChangeLog-0.7: * ChangeLog-0.7: Move ChangeLog to + ChangeLog-0.7, and start this changelog + +2005-04-07 19:57 ds + + * ChangeLog: copy from HEAD + +2005-04-07 16:53 fmhess + + * ChangeLog: summary of 0.7.70 changes + +2005-04-07 13:20 ds + + * comedi/rt.c, include/linux/irq.h: Remove references to + linux/irq.h + +2005-04-07 13:15 ds + + * Makefile.am: Re-add call to depmod if it's a normal install + +2005-04-07 09:52 fmhess + + * Contributors: added José Luis Sánchez + +2005-04-05 13:21 ds + + * comedi/drivers/ni_pcidio.c: Remove linux/irq.h. It should be + asm/irq.h, which is included automatically. + +2005-04-02 16:00 ds + + * autogen.sh: Use -i and -f flags + +2005-04-02 15:57 ds + + * Makefile.am: Fix drivers.txt target + +2005-04-02 15:52 ds + + * AUTHORS, NEWS, autogen.sh: Use autoreconf. Add files + +2005-04-02 15:48 ds + + * Makefile.am, scripts/Configure, scripts/Menuconfig, + scripts/config.dist, scripts/config.dist-2.0.39, + scripts/config.in, scripts/dep.linux, scripts/dep.pcmcia, + scripts/dep.rtai, scripts/dep.rtlinux, scripts/generate_makefile, + scripts/mkdep.c, scripts/pathdown.sh, scripts/release: Change the + way files are disted. Remove all the crap from scripts/ that's + no longer used. + +2005-03-31 20:24 ds + + * comedi/drivers/: acl7225b.c, adl_pci6208.c, adl_pci9111.c, + adv_pci_dio.c, amplc_pc236.c, amplc_pc263.c, amplc_pci230.c, + cb_pcidas.c, cb_pcidas64.c, cb_pcidda.c, cb_pcimdas.c, + cb_pcimdda.c, contec_pci_dio.c, das08.c, gsc_hpdi.c, me4000.c, + me_daq.c, ni_6527.c, poc.c: Documentation fixes + +2005-03-31 20:23 ds + + * configure.ac: version bump + +2005-03-31 19:00 ds + + * Makefile.am, configure.ac, comedi/Makefile.am, + comedi/drivers/Makefile.am, comedi/kcomedilib/Makefile.am, + m4/as-linux.m4, m4/as-modtool.m4: Make distcheck work. Add + LINUX_MODULE_STYLE to indicate module building style. + +2005-03-28 18:49 fmhess + + * comedi/drivers/ni_660x.c: fix compile warning, and initialize + both tio chips + +2005-03-28 18:41 fmhess + + * comedi/drivers/: mite.c, mite.h, ni_660x.c: patch from Klaas + Gadeyne which fixes problem + with initialization of CounterSwap bit in the + ClockConfigRegister. + + The patch also fixes a small bug in the configuration of the TIO + to serve as an encoder: There was a copy-paste error in the code + for taking into account the index pulse or not. + +2005-03-21 18:30 fmhess + + * comedi/comedi_fops.c: check for CAP_SYS_MODULE instead of + CAP_SYS_ADMIN in comedi_fop_open() + +2005-03-18 19:36 fmhess + + * comedi/drivers/: daqboard2000.c, me4000.c, me_daq.c: add mention + of comedi_nonfree_firmware tarball + +2005-03-18 19:35 fmhess + + * comedi/drivers/ni_pcidio.c: allow schedules() during firmware + upload + +2005-03-17 16:00 fmhess + + * comedi/drivers/ni_pcidio.c: add support for loading firmware into + main fpga and scarabs on pci-6534 + +2005-03-17 09:25 fmhess + + * comedi/comedi_fops.c, comedi/drivers/daqboard2000.c, + comedi/drivers/me_daq.c, comedi/drivers/usbdux.c, + comedi/drivers/usbduxfast.c, include/linux/comedi.h, + include/linux/comedidev.h: add support for uploading firmware on + 64 bit arches, and added support for loading up to 4 different + firmware files (will be needed by ni pci-6534). + +2005-03-17 06:53 fmhess + + * comedi/drivers/cb_pcidas64.c: add SDF_DITHER flag to analog input + subdevice + +2005-03-16 07:56 fmhess + + * include/linux/mm.h: fix version check for remap_pfn_range() + compatibility + +2005-03-14 17:00 fmhess + + * comedi/comedi_fops.c, include/linux/mm.h: replace + remap_page_range with remap_pfn_range + +2005-03-13 07:17 fmhess + + * comedi/: comedi_fops.c, kcomedilib/kcomedilib_main.c: move check + of s->busy after aquisition of big_comedi_lock in do_lock_ioctl. + Make locking return a less confusing error code on failure. Make + locking fail if process already has lock (alternative would be to + make locking recursive, but I don't see a reason to bother). + +2005-03-12 05:31 fmhess + + * comedi/drivers/amplc_pci224.c: patch from Ian Abbott + : + + Here's a change to my new amplc_pci224 driver to use + pci_request_regions instead of check_region/request_region, as + suggested by Frank. + +2005-03-07 18:35 fmhess + + * comedi/drivers/: Makefile.am, amplc_pci224.c: new driver from + abbotti@mev.co.uk (Ian Abbott): + + Here's a new driver for the Amplicon PCI224 and PCI234 analog + output cards, supporting streaming AO. It seems to be working + well except that the first scan can misfire at the start of + acquisition, and I can't find a way to work around this hardware + problem. It shouldn't matter too much for waveform output. I've + mentioned it in the caveats section of the driver documentation. + +2005-03-06 16:59 fmhess + + * comedi/comedi_fops.c: fix compile error + +2005-03-06 16:11 fmhess + + * comedi/drivers/cb_pcimdas.c: use 8255 driver for 8255 subdevice + +2005-03-06 09:34 fmhess + + * comedi/drivers/usbdux.c: fixed "cast as lvalue" compiler warning + +2005-03-06 09:31 fmhess + + * comedi/drivers/: 8255.c, adl_pci6208.c, cb_das16_cs.c, + cb_pcidas64.c, dt3000.c, gsc_hpdi.c, me4000.c, mpc8260cpm.c, + ni_660x.c, ni_670x.c, ni_at_ao.c, ni_mio_common.c, ni_pcidio.c, + rtd520.c, skel.c, ssv_dnp.c, usbdux.c: add support for new + INSN_CONFIG_DIO_QUERY + +2005-03-06 09:30 fmhess + + * comedi/comedi_fops.c: move some checks for length of data[] in + configuration insn to core + +2005-03-06 09:30 fmhess + + * include/linux/comedi.h: add id for INSN_CONFIG_DIO_QUERY for + querying configuration state of dio line + +2005-03-06 08:10 fmhess + + * comedi/drivers/ni_pcidio.c: at least now i know why the 6534 + doesn't work + +2005-03-03 15:13 fmhess + + * comedi/drivers/: adl_pci6208.c, adl_pci9111.c, adv_pci_dio.c, + amcc_s5933.c, amplc_dio200.c, amplc_pc236.c, amplc_pc263.c, + amplc_pci230.c, cb_pcidas.c, cb_pcidas64.c, cb_pcidda.c, + cb_pcimdas.c, cb_pcimdda.c, contec_pci_dio.c, daqboard2000.c, + das08.c, dt3000.c, gsc_hpdi.c, ke_counter.c, me4000.c, me_daq.c, + mite.c, rtd520.c: patch from Ian Abbott : + + updates the drivers to use pci_get_device() instead of + pci_find_device() and fixes a few other bits that seemed to be + broken: mostly insufficient checking in the 'detach' routines. + +2005-03-03 15:08 fmhess + + * include/linux/pci.h: patch from Ian Abbott : + + adds two more compatibility definitions for 'pci_dev_get()' and + 'pci_get_device()' + +2005-03-03 14:06 fmhess + + * comedi/drivers/daqboard2000.c: updated documentation: firmware + cannot be compiled into driver any more. + +2005-03-01 15:43 fmhess + + * comedi/drivers/ni_pcidio.c: pci-6534 does not work + +2005-02-28 15:35 fmhess + + * comedi/drivers/cb_pcidas64.c: 6035 only has 12 bit analog output + resolution, despite 16 bit input resolution. Added ao_bits + member to board struct to deal with it. + +2005-02-28 15:24 fmhess + + * comedi/drivers/cb_pcidas64.c: 6034 and 6035 don't have 8255 chips + +2005-02-27 16:22 fmhess + + * comedi/comedi_fops.c: compile fix for gcc 2.95 from + al14@inf.tu-dresden.de (Andreas Leuner) + +2005-02-27 16:08 fmhess + + * comedi/drivers/gsc_hpdi.c: don't use deprecated + pci_find_subsys(), replace with pci_get_subsys() (and + pci_dev_put()) + +2005-02-27 16:07 fmhess + + * include/linux/pci.h: implementation of pci_find_subsys for old + kernels from abbotti@mev.co.uk (Ian Abbott), and #defines for + pci_get_subsys() and pci_dev_put() from me. + +2005-02-27 15:47 fmhess + + * comedi/drivers/dt3000.c: patch from abbotti@mev.co.uk (Ian + Abbott): + + "modprobe dt3000" fails on current 2.6 kernels due to missing + symbols in the PCI stuff. + + The attached patch should fix it, but needs testing properly. + I've checked that it modprobes okay, but don't have the hardware + to make sure it finds the board okay. + +2005-02-27 15:42 fmhess + + * comedi/drivers/adl_pci9111.c: patch from + emmanuel.pacaud@univ-poitiers.fr (Emmanuel Pacaud): + + here's a patch that extends AI streaming capabilities of the + adl_pci9111 driver, and fixes analog output. + +2005-02-27 15:31 fmhess + + * include/linux/mm.h: need to change things around a little to + prevent asm/tlb.h from breaking compilation against debian 2.4.27 + kernel headers + +2005-02-27 15:12 fmhess + + * include/: linux/device.h, pcmcia/ds.h: patch from Ian Abbott + : + + The last change to das08_cs.c on Feb 5 breaks on 2.4, though the + change itself was not unreasonable (it saves a few bytes at + least). The problem is that the change was incompatible with the + version of struct device_driver defined in comedi's + linux/device.h compatibility header. In the "real" version of + struct device_driver, the "name" member is a "char *", but in the + compatibility version it's a "dev_info_t", which is a "char[32]". + + The attached patch sorts it out in the compatibility headers. + +2005-02-27 14:26 fmhess + + * include/: asm/pgtable.h, linux/mm.h: patch from Ian Abbott + : + + This patch against CVS also applies to comedi-0.7.69 and allows + it to compile correctly against Red Hat 9's 2.4.20-8 kernel, and + probably others using the "statm" kernel patch. It also changes + the conditions for defining the pte_offset_kernel() macro in the + asm/pgtable.h compatibility header to avoid it being redefined. + +2005-02-27 14:05 fmhess + + * comedi/drivers/amplc_dio200.c: patch from Ian Abbot + : + + I think it's probably a bad idea for my amplc_dio200 driver to + call comedi_event() while it's holding a spinlock. The call to + comedi_event could call a kcomedilib client's callback function, + which might do something that requires the same spinlock, leading + to a deadlock. + + The attached patch moves the calls to comedi_event() to a safe + point after the spinlock is released. + +2005-02-26 18:15 bporr + + * comedi/drivers/usbduxfast.c: Removed a buffer overflow routine + again. The buffer overflow can only be detected in the firmware + when 3 out of 4 buffers are full. Thus, the condition that all 4 + buffers are full gives already an buffer overflow. + +2005-02-21 13:02 fmhess + + * comedi/drivers/8253.h: replace 0x10000 with max_count constant, + and handle a couple more corner cases + +2005-02-21 12:52 fmhess + + * comedi/drivers/8253.h: patch from Ian Abbott : + + Here's a couple more minor patches for the + i8253_cascade_ns_to_timer_2div function, which I should have + spotted earlier. + + 8253_dupcalc.patch gets rid of a duplicate calculation + 8253_overflow.patch adds some arithmetic overflow checks to the + "early exit" test. + +2005-02-17 15:37 fmhess + + * comedi/drivers/: amplc_pc236.c, comedi_parport.c: patch from Ian + Abbott : + + This patch sets the COMEDI_CB_BLOCK event in the interrupt + routines of the comedi_parport and amplc_pc236 drivers, as + whatever is monitoring the interrupts probably wants to know + about them as soon as possible! + +2005-02-17 15:23 fmhess + + * comedi/drivers/: Makefile.am, amplc_dio200.c: new driver from Ian + Abbott + +2005-02-17 15:15 fmhess + + * include/linux/compiler.h: inew compatibility header from Ian + Abbott + +2005-02-17 15:13 fmhess + + * comedi/drivers/: usbdux.c, usbduxfast.c: add missing include for + likely/unlikely + +2005-02-17 14:58 fmhess + + * include/asm/semaphore.h: new compatibility header from Ian Abbott + : + + Here's an asm/semaphore.h compatibility header to help build + Comedi drivers for kernel versions prior to 2.2.18. It defines + the following missing macros: + + init_MUTEX(x) init_MUTEX_LOCKED(x) DECLARE_MUTEX(name) + DECLARE_MUTEX_LOCKED(name) + + I didn't define sema_init(sem, val) as I the implementation is + arch-dependent. + +2005-02-17 14:48 fmhess + + * comedi/drivers/8253.h: patch from Ian Abbott : + + This patch improves the "early exit" test in the + i8253_cascade_ns_to_timer_2div function (comedi/drivers/8253.h) + to take account of a divisor of 65536 being represented by 0. + +2005-02-17 14:42 fmhess + + * comedi/drivers/comedi_rt_timer.c: patch from Emmanuel PACAUD + : + + Here's a trivial patch that closes comedi device file when + detaching comedi_rt_timer driver. + +2005-02-08 17:53 fmhess + + * include/linux/sched.h: patch from Ian Abbott : + + This patch adds compatibility code for the 'wait_event()' macro + in linux/sched.h for kernels prior to 2.2.3. The actual + implementation in this patch has been taken from 2.2.14. + +2005-02-07 15:36 bporr + + * comedi/drivers/usbduxfast.c: Added proper insn command with a + sampling rate of 1MHz/16. Now 4 packets are ignored before data + is sampled. One packet was not enough. Improved timing for the + multiplexer. Should run now reliable at high rates. + +2005-02-06 08:22 fmhess + + * include/linux/comedi.h: fix license header (comedilib is lgpl) + +2005-02-06 08:06 fmhess + + * comedi/drivers/cb_pcidas.c: force read from channel 0 when + CR_ALT_SRC is set in ai read insn. + +2005-02-05 07:23 fmhess + + * comedi/drivers/das08_cs.c: fix pcmcia_driver.drv.name + +2005-02-05 07:22 fmhess + + * include/linux/sched.h: fix for need_resched from Ian Abbott + : + + This patch alters the Comedi driver's linux/sched.h compatibility + header to move the need_resched function after the #include_next + directive. This is because the 'current' task variable is not + defined until after the real linux/sched.h is included. I've + also removed the comment - "/* not sure exactly when + need_resched() was added */"; I've checked, and it was added in + 2.4.20 as the code stated. I thought I'd fix the incorrect + comment at the top of the file while I was at it. + +2005-02-03 15:48 fmhess + + * comedi/drivers/mite.c: enable burst mode dma transfers on mite + +2005-01-25 15:44 fmhess + + * comedi/drivers/: amplc_pc236.c, amplc_pc263.c: patch from Ian + Abbott , who says: + + This patch fixes a harmless logical error in the _attach routines + of the amplc_pc236 and amplc_pc263 drivers that I noticed while + looking at the pci_for_each_dev stuff. Also, now that the + drivers ar using pci_find_device instead of pci_for_each_dev, the + patch offloads some of the searching for a matching PCI device to + the pci_find_device function. + + The bug is just after the loop that finds the PCI device ID table + entry that matches the comedi board name. The test for reaching + the end of the PCI device ID table without finding a match was + incorrect. I say the bug is harmless because there would have to + be another bug somewhere else to trigger this bug. + +2005-01-25 15:41 fmhess + + * comedi/drivers/comedi_fc.c: fix rounding error in + bytes_per_scan() for dio subdevices, noted by Ian Abbott + . Also, round to nearest sampl_t or lsampl_t + size, instead of nearest byte size. + +2005-01-22 18:45 fmhess + + * comedi/comedi_fops.c, include/linux/comedi.h: rename some members + of bufinfo struct to make output mmaps workable + +2005-01-22 06:22 fmhess + + * comedi/rt.c, comedi/drivers/adl_pci6208.c, + comedi/drivers/adl_pci9111.c, comedi/drivers/adv_pci_dio.c, + comedi/drivers/amcc_s5933.c, comedi/drivers/amplc_pc236.c, + comedi/drivers/amplc_pc263.c, comedi/drivers/amplc_pci230.c, + comedi/drivers/cb_pcidas.c, comedi/drivers/cb_pcidas64.c, + comedi/drivers/cb_pcidda.c, comedi/drivers/cb_pcimdas.c, + comedi/drivers/cb_pcimdda.c, comedi/drivers/contec_pci_dio.c, + comedi/drivers/das08.c, comedi/drivers/icp_multi.h, + comedi/drivers/ke_counter.c, comedi/drivers/me4000.c, + comedi/drivers/me_daq.c, comedi/drivers/mite.c, + comedi/drivers/rtd520.c, include/linux/pci.h: got rid of + pci_for_each_dev macro (which no longer exists in 2.6 kernels) + +2005-01-22 06:15 fmhess + + * Contributors: alphabetized contributors + +2005-01-13 17:23 fmhess + + * comedi/drivers/8255.c: fix for cmdtest check of start_arg, from + Ian Abbott + +2005-01-13 17:19 fmhess + + * comedi/drivers/cb_pcimdda.c: fix for gcc3.4 compile error from + Ian Abbott + +2005-01-13 11:37 bporr + + * comedi/drivers/usbduxfast.c: + + Removed a transfer flag which gave a compilation error under + 2.4.x. Transfer works without it anyway. Thanks to Ian Abbott + who reported the bug. + +2005-01-04 11:29 fmhess + + * comedi/comedi_fops.c: get rid of KILL_FASYNC define, since it is + already in linux/fs.h compat header + +2005-01-04 09:10 bporr + + * comedi/drivers/usbduxfast.c: + Tested with 2.6.10. Introduced min sampling rate which is 60kHz. + +2005-01-04 09:04 bporr + + * comedi/drivers/usbdux.c: + Minor changes. Tested with 2.6.10. + +2005-01-04 09:01 bporr + + * comedi/drivers/Makefile.am: + Compilation aborted because the makefile wasn't able to generate + object files for some drivers. Added some missing lines like: + pcl812_ko_SOURCES = pcl812.c + +2005-01-03 15:43 fmhess + + * include/linux/comedi_rt.h: fix rtlinux compile + +2005-01-03 14:48 bporr + + * comedi/drivers/usbdux.c: + From kernel version 2.6.10 the function usb_kill_urb has to be + used instead of the old unlink function. This makes hotplugging + much safer, in particular when the user unplugs the device while + it is transmitting data. Also added some comments to the debug + defines. + +2005-01-03 09:22 bporr + + * comedi/drivers/usbduxfast.c: + Switched from iso transfer to bulk transfer. ISO is not the right + transfer mode as it imposes a certain sampling rate. The sampling + rate, however, is set by the GPIF and not by the transfer + protocol. + +2004-12-28 19:10 fmhess + + * include/linux/device.h: compatibility functions so udev support + compiles on 2.4 kernels + +2004-12-28 18:57 fmhess + + * m4/as-linux.m4: handle errors when trying to get kernel flags + +2004-12-28 18:43 fmhess + + * m4/as-linux.m4: make lack of .hdepend in kernel dir a warning + instead of an error + +2004-12-28 17:14 fmhess + + * comedi/comedi_fops.c: add support for udev + +2004-12-28 17:13 fmhess + + * comedi/drivers/ni_mio_common.c: generate overflow events when ai + fifo overflows with pio transfers + +2004-12-28 17:07 fmhess + + * comedi/drivers/ni_at_ao.c: Fixed bugs reported by + csp@andrew.cmu.edu. The bug report was as follows: + + I have been attempting to get a NI-ATAO10, a 10 channel legacy + ISA analog output board, working with comedi. Apparantely the way + comedi_from_phys works to convert voltage to sample doesn't seem + to work correctly with the ATAO10 board. I found that the + correct sample data for the ATAO10 board is as follows: + + In unipolar mode 0V = 2048 +10V = 6143 + + In bipolar mode -10V = 2048 +10V = 6143 + + It seems that comedi_from_phys is somehow shifted by 2048 from + what it should be (comedi_from_phys gives values from 0 to 4095). + + Furthermore, comedi does not detect the polarity of the board + (I'm not sure if this is possible on this board); thus the range + is always reported as -10V to +10V even if the board is set on + unipolar mode (which is achieved by setting jumpers on the + board). + + Finally, for some reason, channel 0 does not work with Comedi + (the board fully works in Windows). The other 9 channels work. + +2004-12-12 18:02 fmhess + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: make single-scan ai + commands work + +2004-12-12 17:59 fmhess + + * comedi/drivers/adl_pci6208.c: fix "Devices:" comment field + +2004-12-12 17:42 fmhess + + * comedi/drivers/ni_660x.c: enhancement from YEOW NGEE SOON + : + + added simple event counting + +2004-12-12 17:41 fmhess + + * comedi/drivers/: Makefile.am, adl_pci6208.c: new driver from YEOW + NGEE SOON + +2004-12-07 17:59 fmhess + + * comedi/drivers/ni_mio_common.c: fix for pcmcia fifo-half-full + interrupt problems from "Blacker, Phil M" + + +2004-12-04 10:18 fmhess + + * autogen.sh: make autogen.sh work with automake1.9 + +2004-11-29 17:01 fmhess + + * comedi/drivers/: Makefile.am, acl7225b.c, pcl730.c: added new + drivers from José Luis Sánchez (jsanchezv@teleline.es) + +2004-11-20 09:22 fmhess + + * Makefile.am: sort devices.txt + +2004-11-20 08:55 fmhess + + * comedi/drivers/: cb_das16_cs.c, cb_pcimdas.c, fl512.c, me4000.c, + ni_daq_dio24.c: some comment fixes to make Devices.txt get + generated correctly + +2004-11-14 15:12 bporr + + * comedi/drivers/usbduxfast.c: + cmd is now dumping the first 5 packets. They are usually + leftovers from last the cmd: 4 packets from the quad buffer in + the usbduxfast and one packet kept by the host controller. + +2004-11-10 16:20 bporr + + * include/linux/usb.h: + The memory allocation flag GFP_KERNEL is not permissible in an + interrupt callback. It has to be GFP_ATOMIC. The submit_urb + function has been called with the wrong kernel kernel flag. It's + now GFP_ATOMIC. Thanks for the feedback from Dave Brownell. + +2004-11-09 15:20 bporr + + * comedi/drivers/usbduxfast.c: + Commented out the USB ID for testing purposes and added the + proper one for ITL/Univ of Stirling (product IDs 0x10 and 0x11). + +2004-10-31 15:21 bporr + + * comedi/drivers/Makefile.am: + Added the usbduxfast driver. + +2004-10-31 15:19 bporr + + * comedi/drivers/usbduxfast.c: + Initial version of the new usbduxfast driver. Tested with 2.4.27 + and 2.6.9. + +2004-10-26 15:25 fmhess + + * comedi/drivers/ni_pcidio.c: Remove bogus scan_end_src. By the + way, the last log message should have said "added support for + stop_src==TRIG_NONE", instead of saying he added support for + externally triggered input commands + +2004-10-26 15:11 fmhess + + * Contributors: added Brent Ledvina + +2004-10-26 15:09 fmhess + + * comedi/drivers/ni_pcidio.c: Support for externally triggered + input commands from Brent Ledvina bml22@cornell.edu + +2004-10-17 08:44 fmhess + + * Contributors: Added Steve Sharples + +2004-10-17 08:40 fmhess + + * comedi/drivers/amplc_pci230.c: Enhancement from Steve Sharples: + + I've added the ability for the AI command to support "triggered + burst mode" sampling, ie: - scan_begin_src=TRIG_EXT - + convert_src=TRIG_TIMER + +2004-10-10 10:02 fmhess + + * ChangeLog, Changelog: renamged Changelog to ChangeLog and add + entry for 0.7.69 + +2004-10-05 18:56 fmhess + + * comedi/drivers/ni_mio_common.c: oops, convert counter really + should be limited to 16 bits after all + +2004-10-05 18:38 fmhess + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: Fix bogus sample at + beginning of ao command (me). Fix check of convert_arg in + ai_cmdtest() (Jonathan Wang ). + +2004-10-05 18:35 fmhess + + * comedi/drivers/ni_atmio.c: fix passing of bad argument to + comedi_error() + +2004-10-05 17:47 fmhess + + * comedi/drivers/cb_pcidas64.c: add support for 6014, and add + missing entries to pci device table + +2004-10-02 16:01 fmhess + + * configure.ac: bump version for release + +2004-10-02 15:49 fmhess + + * comedi/drivers/Makefile.am: me400_fw.h is gone + +2004-10-02 15:47 fmhess + + * Makefile.am: modtool.in is gone + +2004-10-01 17:27 fmhess + + * m4/as-linux.m4: check for modpost in two possible locations + +2004-10-01 17:26 fmhess + + * configure.ac: fix missing $ in check for depmod + +2004-09-29 05:28 fmhess + + * comedi/drivers/amplc_pci230.c: fix for shared interrupt bug from + steve.sharples@nottingham.ac.uk + +2004-09-09 04:49 fmhess + + * include/linux/comedi_rt.h: fix argument to rtl_delay for rtlinux + +2004-09-05 12:12 bporr + + * comedi/drivers/usbdux.c: Typo in the synchonous out command: in + case of an error the synchronous _in_ command was stopped instead + of the out command. Also added a short description of the timer + connections. + +2004-08-31 18:50 fmhess + + * include/linux/comedi_rt.h: use rtl_delay() for rtlinux + +2004-08-31 18:38 fmhess + + * include/linux/comedi_rt.h: usleep() seems to crash rtlinux when + called from non-rt priority + +2004-08-31 17:56 fmhess + + * comedi/drivers/ni_atmio.c: add error message when no isapnp + support is available + +2004-08-30 19:42 fmhess + + * comedi/drivers/ni_mio_common.c: return error if a command is run + with no irq + +2004-08-18 15:36 bporr + + * comedi/drivers/usbdux.c: The submission of the bulk transfers can + be delayed. This leads in the worst case to a change in the order + of bulk transfers. For example, the insn command requests the + counter value. After that another insn requests the status of the + digital port. It happens that these requests are swapped in their + temporal order because the USB controller might delay a + submission because of heavy traffic. The linux kernel _assumes_ + that the packet has been sent. In fact this can't be guaranteed. + Therefore now the packet which is sent from the firmware is + checked. If it is the wrong one it is requested again. + +2004-08-05 17:48 fmhess + + * comedi/drivers/das800.c: fix deadlock on end-of-acquisition + +2004-08-01 18:13 fmhess + + * comedi/drivers/cb_pcidas64.c: move setup of subdevices after init + of plx9080 + +2004-08-01 16:18 fmhess + + * comedi/drivers/cb_pcidas64.c: fix initialization of eeprom + subdevice + +2004-08-01 15:20 fmhess + + * comedi/drivers/usbdux.c: updated usbdux driver from Bernd Porr + +2004-07-25 12:05 fmhess + + * comedi/kcomedilib/kcomedilib_main.c: fix INSN_GTOD + +2004-07-20 17:10 fmhess + + * comedi/: comedi_fops.c, drivers.c: fix double-munging when + bufinfo ioctl is called in concert with read()s from /dev/comediX + +2004-07-19 16:24 fmhess + + * comedi/drivers/ni_atmio.c: add isapnp device id for at-mio-64e-3 + +2004-07-19 16:05 fmhess + + * comedi/drivers/cb_pcidas64.c: fix null dereference on boards + without analog output + +2004-07-19 15:14 fmhess + + * comedi/rt.c: fix prototype of comedi_request_irq() + +2004-07-17 18:03 fmhess + + * comedi/drivers/: ni_atmio.c, ni_mio_cs.c, ni_pcimio.c: missed + some locking that should have been converted to use + devpriv->window_lock + +2004-07-17 17:40 fmhess + + * comedi/drivers/ni_6527.c: bug fix from zharkov@vista-control.com + (Eugene Zharkov) + +2004-07-17 15:55 fmhess + + * comedi/comedi_fops.c, include/linux/sched.h: list 10 insn limit + on insn lists + +2004-07-17 15:44 fmhess + + * comedi/drivers/cb_pcidas64.c: fix interrupt handler return value + +2004-07-15 15:30 fmhess + + * comedi/drivers/ni_mio_common.c: don't write to ao fifo offset + load register if it doesn't exist + +2004-07-15 15:29 fmhess + + * comedi/drivers/ni_pcimio.c: added pci-6014 to supported devices + list + +2004-07-14 04:41 fmhess + + * comedi/drivers/ni_atmio.c: change caldac to ad8804_debug for + at-mio-64e-3 + +2004-07-11 18:51 fmhess + + * INSTALL: a little update for 2.6 kernels + +2004-07-11 18:28 fmhess + + * m4/as-modtool.m4: don't barf if Modules.symvers doesn't exist + +2004-07-07 15:11 fmhess + + * comedi/rt.c: fix interrupt reenabling with rtai-adeos + +2004-06-27 18:03 fmhess + + * comedi/: drivers.c, drivers/ni_mio_common.c: fix possible crash + when shared interrupt is asserted before comedi_device_attach() + has finished with postconfig() + +2004-06-27 17:51 fmhess + + * Makefile.am: add autogen.sh to EXTRA_DIST + +2004-06-19 06:04 fmhess + + * comedi/drivers/cb_pcidas.c: fix selection of output channel for + ao write insn (for boards with fifo) + +2004-06-15 05:17 fmhess + + * comedi/drivers/ni_660x.c: removed obsolete references to + comedi_counter_unstable.h + +2004-06-15 05:17 fmhess + + * Contributors: added Luis Martinez for bug fix + +2004-06-08 17:19 fmhess + + * comedi/drivers/quatech_daqp_cs.c: bug fix from Luis Martínez + + +2004-06-05 09:55 fmhess + + * comedi/drivers/ni_mio_common.c: fix CR_EDGE and CR_INVERT flags + for ai scan_begin_src = TRIG_EXT + +2004-06-05 09:51 fmhess + + * comedi/drivers/ni_mio_common.c: Fix CR_INVERT and CR_EDGE flags + for ai start_arg=TRIG_EXT + +2004-06-03 16:01 fmhess + + * comedi/drivers/Makefile.am: patch from Emmanuel PACAUD + +2004-06-02 16:30 fmhess + + * configure.ac: pcmcia drivers should work under 2.6 now + +2004-06-02 12:00 ds + + * comedi/Makefile.am, comedi/drivers/Makefile.am, + comedi/kcomedilib/Makefile.am, m4/as-linux.m4, m4/as-modtool.m4: + Upgrade as-linux.m4 and as-modtool.m4. Fix build system to + handle changes. + +2004-05-31 18:55 fmhess + + * include/: linux/device.h, pcmcia/ds.h: fix compiler warnings for + 2.4 + +2004-05-31 18:05 fmhess + + * comedi/drivers/quatech_daqp_cs.c: port to 2.6 pcmcia api + +2004-05-31 17:52 fmhess + + * comedi/drivers/ni_labpc_cs.c: port to 2.6 pcmcia api + +2004-05-31 17:35 fmhess + + * comedi/drivers/ni_mio_cs.c: port to 2.6 pcmcia api + +2004-05-31 16:01 fmhess + + * comedi/drivers/ni_daq_dio24.c: port to 2.6 pcmcia api + +2004-05-31 16:00 fmhess + + * comedi/drivers/cb_das16_cs.c: fix if block that got broken during + port to 2.6 + +2004-05-31 15:31 fmhess + + * comedi/drivers/das08_cs.c: port to 2.6 pcmcia api + +2004-05-31 15:30 fmhess + + * include/pcmcia/ds.h: added cs_error() compatibility function + +2004-05-31 14:45 fmhess + + * comedi/drivers/cb_das16_cs.c: moved some 2.4 compatibility cruft + into headers + +2004-05-31 14:44 fmhess + + * include/: linux/device.h, pcmcia/ds.h: add 2.4 compatibility for + pcmcia_register_driver() and pcmcia_unregister_driver() + +2004-05-21 18:05 fmhess + + * comedi/drivers/cb_das16_cs.c: ported to 2.6 kernel pcmcia api + +2004-05-21 17:39 fmhess + + * comedi/drivers/ni_pcimio.c: pci-6014 support courtesy Alberto + Sechi + +2004-05-18 05:30 fmhess + + * INSTALL: update for some minor changes to comedi instalation that + have occurred + +2004-05-14 15:59 fmhess + + * m4/as-linux.m4: be less picky about finding .hdepend + +2004-05-09 13:41 fmhess + + * comedi/drivers/ni_atmio.c: fix caldac type for at-mio-16e-10 + +2004-04-29 15:13 fmhess + + * comedi/kcomedilib/kcomedilib_main.c: have comedi_command set + subdevice->busy + +2004-04-22 15:39 fmhess + + * comedi/drivers/ni_mio_common.c: fix init of len_chanlist for + analog output subdevice, removed redundant check in ao command + test + +2004-04-22 14:58 fmhess + + * comedi/: drivers.c, drivers/cb_pcidas64.c: crashes on + pci-das6402/16 attach seem to be due to interrupt handler running + before postconfig() in drivers.c has finished initializing + everything. So I added check for dev->attached in handler, and + put a barrier() before dev->attached is set in drivers.c. + +2004-04-21 12:16 fmhess + + * comedi/drivers/cb_pcidas64.c: added a memory barrier to try and + fix mysterious 6402/16 crash on attach + +2004-04-20 22:56 fmhess + + * comedi/drivers/: adl_pci9118.c, cb_pcidas64.c, daqboard2000.c, + dt3000.c, icp_multi.c, ii_pci20kc.c, me_daq.c, ni_660x.c, + pcm3730.c, usbdux.c: fixes for 64bit archs + +2004-04-19 15:09 fmhess + + * comedi/drivers/cb_das16_cs.c, comedi/drivers/cb_pcidas64.c, + comedi/drivers/contec_pci_dio.c, comedi/drivers/dt2814.c, + comedi/drivers/icp_multi.c, comedi/drivers/ii_pci20kc.c, + comedi/drivers/ni_mio_cs.c, comedi/drivers/pcl812.c, + comedi/drivers/quatech_daqp_cs.c, include/linux/comedidev.h: + change dev->iobase to unsigned long for 64 bit cpus + +2004-04-19 14:56 fmhess + + * INSTALL: add note about unresolved rt kernel symbols + +2004-04-13 16:23 fmhess + + * comedi/rt.c: rt_request_global_irq_arg() doesn't seem to exist in + rtai anymore + +2004-04-11 10:38 fmhess + + * Contributors: added Nils + +2004-04-11 10:36 fmhess + + * comedi/drivers/pcl818.c: command support for pcl818 from Nils + Juergens: + + The streaming aquisition support has been dropped with the move + from comedi_trig to comedi_command. The attached patch ports the + comedi_trig stuff over to comedi_command. It is not heavily + tested, but works for me with both pcl818 and pcl818h cards + (though i haven't tested the fifo code for the 818h). + +2004-04-05 17:03 fmhess + + * comedi/drivers/: mite.c, ni_mio_common.c: figured out how i broke + dma, and removed useless barrier + +2004-04-05 15:47 fmhess + + * comedi/drivers/ni_mio_common.c: take into account possibility of + comedi_poll getting called from interrupt context (kcomedilib). + Removed some dead code. Fix tiny possibility of undetected + buffer overrun. Added a memory barrier to ni_sync_ai_dma(). + +2004-04-05 14:42 fmhess + + * comedi/drivers/ni_mio_common.c: remove bogus bug warning + +2004-04-04 13:30 fmhess + + * comedi/drivers/: mite.c, mite.h, ni_mio_common.c, ni_pcidio.c: + replaced some preprocessor defines with enums and inline + functions + +2004-04-04 11:19 fmhess + + * comedi/drivers/: mite.c, mite.h: added declarations for IO Device + Window Base Size Register + +2004-04-04 10:49 fmhess + + * comedi/drivers/ni_mio_common.c: try to make sure we get the scan + data dma'd after eos interrupts + +2004-04-04 09:44 fmhess + + * comedi/drivers/ni_mio_common.c: add more locking to make + comedi_poll smp safe, and made ni_handle_fifo_dregs() slightly + more efficient + +2004-04-04 09:40 fmhess + + * comedi/drivers/cb_pcidas.c: fix initialization of channel, that I + broke with last fix + +2004-03-25 16:24 fmhess + + * comedi/drivers/cb_pcidas.c: fix analog output channel interaction + for boards with analog output fifo + +2004-03-22 13:05 fmhess + + * comedi/rt.c: complain more loudly on comedi_switch_to_rt() + failure + +2004-03-21 10:31 fmhess + + * INSTALL: comedi_calibrate supports more than NI boards now + +2004-03-21 09:41 fmhess + + * comedi/drivers/mite.c: add a rmb() in mite_bytes_transferred() + +2004-03-21 09:41 fmhess + + * comedi/drivers.c: use barrier() instead of mb() since it really + is just memory + +2004-03-21 09:35 fmhess + + * comedi/drivers/: ni_atmio.c, ni_mio_common.c, ni_mio_cs.c, + ni_pcimio.c, ni_stc.h: add support for comedi_poll when using + mite dma, (needed to add another spinlock to prevent races with + interrupt handler). + +2004-03-21 09:11 fmhess + + * comedi/drivers/ni_mio_common.c: wake on end of scan based on + TRIG_WAKE_EOS bit in command flags, instead of COMEDI_CB_EOS in + callback mask + +2004-03-21 09:10 fmhess + + * comedi/kcomedilib/: get.c, kcomedilib_main.c: don't force various + bits in cb_mask when command is executed, and automaticaly set + TRIG_WAKE_EOS if they are calling back on end of scan events + +2004-03-21 09:08 fmhess + + * comedi/comedi_fops.c: don't force on COMEDI_CB_BLOCK in + comedi_event() + +2004-03-20 05:32 fmhess + + * comedi/drivers/usbdux.c: usbdux driver update from Bernd Porr: + + This patch resolves problems with buggy VIA/SIS USB controllers. + They tend to loose IRQs in high speed mode. In the 2.6.4 kernel + there's now a watchdog timer which triggers an interrupt after + 5ms. To make this safely work with the usbdux driver the number + of buffers has been increased to 10 for the high speed mode and + to 5 for the full speed mode. There are also some minor changes: + removed unnecessary defines and removed the text that firmware + upload through comedi is deprecated. In fact some distros have + fxload not installed so that comedi itself has (still) to do the + job. + +2004-03-14 19:27 fmhess + + * comedi/drivers/adv_pci_dio.c: fix register offset problems noted + by Henk van Rooy + +2004-03-13 08:43 fmhess + + * comedi/drivers/ni_mio_cs.c: change some caldac types to + ad8804_debug, as not all calibration channels were available for + daqcard-6036e (at least ao ch0 fine gain was unavailable) + +2004-03-10 15:34 fmhess + + * comedi/drivers/ni_mio_common.c: add support for reading internal + reference voltage, and don't return an error on calibration adc + overrange + +2004-03-07 14:19 fmhess + + * comedi/drivers/ni_mio_common.c: stop forcing cs5529 gain to one, + added cs5529_wait_for_idle() to get rid of some code duplication + +2004-03-06 18:22 fmhess + + * comedi/drivers/ni_mio_common.c: fixed ni_ai_fifo_read(), to use + the loop index when copying input data to array. got rid of + comedi_buf_put() calls, some cleanups + +2004-03-06 11:08 fmhess + + * comedi/drivers.c: added some memory barriers on read/writes to + comedi's buffer + +2004-03-02 15:51 fmhess + + * m4/rtai.m4: update configure help to suggest using rtai + installation or build dir instead of source dir. + +2004-03-01 15:31 fmhess + + * configure.ac: make KBUILD_BASENAME and KBUILD_MODNAME hacks more + robust + +2004-02-29 15:43 fmhess + + * configure.ac: version bump + +2004-02-29 15:18 fmhess + + * comedi/rt.c: fix name clashes with rtai + +2004-02-29 15:17 fmhess + + * m4/rtai.m4: get CONFIG_ADEOS value + +2004-02-29 15:05 fmhess + + * m4/rtai.m4: add missing quote + +2004-02-29 14:51 fmhess + + * m4/rtai.m4: add mising $ and recognize adeos patched kernels + +2004-02-29 14:14 fmhess + + * Makefile.am, configure.ac: add check for depmod to configure + +2004-02-29 14:09 fmhess + + * m4/rtai.m4: deal with moved rtai_config.h + +2004-02-29 13:51 fmhess + + * m4/rtai.m4: fix m4 quoting + +2004-02-29 13:48 fmhess + + * comedi/drivers/ni_mio_common.c: force gain calibration of 67xx + calibration adc to 1 + +2004-02-29 10:25 fmhess + + * configure.ac: hack to set KBUILD_BASENAME + +2004-02-27 12:47 ds + + * m4/as-linux.m4: Add fallback if mktemp utility cannot be found. + +2004-02-26 16:33 fmhess + + * comedi/drivers/usbdux.c: fix version check for 'owner' member of + usb_driver + +2004-02-23 13:20 ds + + * configure.ac: cleanups. Disable PCMCIA on linux-2.6 + +2004-02-23 13:19 ds + + * comedi/drivers/: pcl816.c, pcl818.c: disable RTC code + +2004-02-21 07:46 fmhess + + * comedi/drivers/das08.c: fix for return value of config insn from + Salvador Eduardo Tropea + +2004-02-21 07:38 fmhess + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: disable analog + triggerring so pfi0 works + +2004-02-15 14:18 fmhess + + * comedi/drivers/ni_mio_common.c: init ao configuration reg 2 for + 67xx + +2004-02-15 13:57 fmhess + + * comedi/drivers/: ni_mio_common.c, ni_pcimio.c, ni_stc.h: + eliminate duplicate ao window register definitions, move some ao + windowed registers into the proper enum, some fixes for ni 67xx + board definitions + +2004-02-13 15:50 fmhess + + * comedi/drivers/: das16.c, ni_mio_common.c: fix compilation with + kernels using dynamic hz patch + +2004-02-10 15:18 fmhess + + * comedi/drivers/ni_660x.c: patch from Klaas Gadeyne + + +2004-02-08 13:52 fmhess + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: more driver support + for ni 67xx calibration. + +2004-02-08 13:35 fmhess + + * comedi/comedi_fops.c: we aren't checking for writes that exceed + subdevice's maxdata + +2004-02-07 13:57 fmhess + + * comedi/drivers/me4000.c: fix for compiler warnings from Salvador + Eduardo Tropea + +2004-02-07 13:31 fmhess + + * comedi/drivers/ni_mio_common.c: add some more support for 67xx + calibration adc + +2004-02-03 15:13 fmhess + + * Contributors, comedi/drivers/das08.c, comedi/drivers/das08.h, + include/linux/comedi.h: i8254 counter patch from Salvador Eduardo + Tropea + +2004-01-31 15:29 fmhess + + * comedi/drivers/ni_mio_common.c: comment out debug message + +2004-01-31 15:03 fmhess + + * Contributors: added Caleb Tennis + +2004-01-31 14:27 fmhess + + * comedi/drivers/rtd520.c: TRIG_WAKE_EOS and CMD_EV_SCAN_END are + not interchangeable + +2004-01-31 14:26 fmhess + + * include/linux/comedi.h: COMEDI_EV_SCAN_END and TRIG_WAKE_EOS are + not interchangeable + +2004-01-31 14:13 fmhess + + * include/linux/comedi.h: serial dio (SCXI) support from Caleb + Tennis + +2004-01-31 14:09 fmhess + + * comedi/drivers/ni_mio_common.c: increase udelay while wait for + dma to load analog output since the polling of the status + register seems to slow the dma transfer + +2004-01-31 14:08 fmhess + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: serial dio support + (SCXI) from Caleb Tennis. + +2004-01-31 13:58 fmhess + + * comedi/drivers/usbdux.c: update to usbdux driver from Bernd Porr + who says: + + Had to change the USB 2.0 transfer protocol from IRQ transfer to + ISO transfer. Reason: IRQ transfer is still not stable + (2.4/2.6). However, ISO transfer has been rewritten in the kernel + and works (just now in 2.6 but will be backported sooner or + later)! I supply new firmware and a new version of the driver + which now uses ISO transfer throughout (1.1 / 2.0). + +2004-01-31 13:58 fmhess + + * comedi/drivers/ni_mio_common.c: check for nonzero return from + schedule_timeout() + +2004-01-24 16:12 fmhess + + * m4/as-linux.m4: add use of LDFLAGS_MODULE for 2.6 + +2004-01-24 16:09 fmhess + + * configure.ac: add -DKBUILD_MODNAME=... to COMEDI_CFLAGS (required + by linux/module.h to make modprobe recognize modules under 2.6 + +2004-01-24 13:55 fmhess + + * m4/as-linux.m4: fixed setting of -DMODULE for 2.6 + +2004-01-24 13:24 fmhess + + * configure.ac: add --disable-pcmcia configure option + +2004-01-24 08:56 fmhess + + * include/linux/pci.h: pci_for_each_device fix for 2.6 from Bernd + Porr + +2004-01-24 08:48 fmhess + + * comedi/drivers/usbdux.c: update from Bernd Porr + +2004-01-21 10:59 fmhess + + * comedi/drivers/ni_mio_common.c: beginnings of ni_67xx calibration + support + +2004-01-19 14:19 fmhess + + * comedi/drivers/ni_stc.h: beginnings of 671x and 673x self + calibration support + +2004-01-19 08:01 fmhess + + * comedi/drivers/ni_pcimio.c: added some device ids for 67xx boards + +2004-01-11 17:18 fmhess + + * m4/as-modtool.m4: fix install brokenness (missing some square + brackets) + +2004-01-11 17:05 fmhess + + * Makefile.am: fix depmod call in install-data-hook + +2004-01-11 16:45 fmhess + + * m4/: as-linux.m4, as-modtool.m4, rtai.m4, rtlinux.m4: added some + more m4 quoting to get rid of automake1.8 warnings + +2004-01-11 16:32 fmhess + + * include/linux/comedi.h: made some alternate names for + COMEDI_INPUT and COMEDI_OUTPUT that match the usual convention + for config insn ids. Also replaced defines with an enum and list + all values in decimal + +2004-01-11 16:28 fmhess + + * comedi/: comedi_fops.c, drivers.c: be more careful about + subdevice allocation/free + +2004-01-11 15:33 fmhess + + * comedi/drivers.c: include for VMALLOC_VMADDR() + macro + +2004-01-11 15:27 fmhess + + * include/linux/vmalloc.h: band aid from Bernd Porr for + VMALLOC_VMADDR macro getting dropped in 2.6 (from kernel + changelog this happened because it did nothing). + +2004-01-11 15:07 fmhess + + * Contributors: added Bernd Porr and Steven Jenkins + +2004-01-08 21:06 ds + + * Makefile.am, configure.ac, modtool.in, m4/as-linux.m4, + m4/as-modtool.m4, m4/linux.m4, m4/rtai.m4, m4/rtlinux.m4: Merge + thomasvs's linux.m4 improvements. Write as-modtool.m4 macro, and + create modtool from the macro. + +2004-01-01 16:38 fmhess + + * comedi/drivers/ni_pcimio.c: update status comments + +2004-01-01 15:59 fmhess + + * comedi/drivers/: ni_atmio.c, ni_mio_common.c, ni_mio_cs.c, + ni_pcimio.c, ni_stc.h: some cleanups, verified that 6711 ao + command works now (needed to modify ao_waveform to preload more + samples into comedi's buffer though) + +2003-12-27 16:50 fmhess + + * comedi/drivers/: ni_mio_common.c, ni_pcimio.c, ni_stc.h: a fix + for 67xx boards, trying to get waveform analog out working. + +2003-12-23 19:04 fmhess + + * comedi/drivers/ni_660x.c, include/linux/comedi.h: giving up on + fully abstract counter interface for now, applying patch from + Klaas Gadeyne with some changes by me. + +2003-12-21 15:51 fmhess + + * comedi/drivers/usbdux.c: moved some 2.4/2.6 compatibility stuff + into comedi/include/linux/usb.h + +2003-12-21 15:50 fmhess + + * Makefile.am, comedi/comedi_fops.c: fixes for COMEDI_NDEVICES > 4 + +2003-12-21 15:47 fmhess + + * include/linux/usb.h: new compat header + +2003-12-21 09:10 fmhess + + * comedi/drivers/usbdux.c: update from bernd porr + +2003-12-19 14:47 ds + + * include/linux/interrupt.h: Linux-2.4.23 has the new interrupt + prototypes + +2003-12-17 19:38 ds + + * comedi/drivers/amplc_pci230.c: Remove printk() that is triggered + by devices sharing the IRQ + +2003-12-06 11:34 fmhess + + * comedi/comedi_fops.c, comedi/drivers.c, include/linux/kdev_t.h: + fix for changes in linux 2.6 kdev_t.h + +2003-12-06 08:41 fmhess + + * comedi/drivers/usbdux.c: include linux/version.h before trying to + check LINUX_VERSION_CODE + +2003-11-30 06:55 fmhess + + * configure.ac, comedi/drivers/Makefile.am, + comedi/drivers/usbdux.c: added usbdux driver + +2003-11-26 13:36 ds + + * comedi/drivers/adv_pci1710.c: Fixes from Nils Juergens + + +2003-11-23 11:12 fmhess + + * comedi/drivers/comedi_counter_unstable.h: valid bit should be 3rd + bit, not 0x3 value + +2003-11-23 10:55 fmhess + + * comedi/drivers/: comedi_counter_unstable.h, ni_660x.c: added + patch from Klaas Gadeyne, with my own modifications. + +2003-11-23 10:52 fmhess + + * comedi/drivers/comedi_fc.h: check if we've already been included + +2003-11-20 18:27 fmhess + + * comedi/drivers/das08.h: declare das08_cs_boards extern + +2003-11-20 18:22 fmhess + + * comedi/drivers/ni_labpc.h: declare labpc_cs_boards as extern + +2003-11-19 18:28 fmhess + + * comedi/drivers/: das08_cs.c, ni_labpc_cs.c, ni_mio_cs.c: added + some MODULE_LICENSE() calls to pcmcia drivers, that dont call + COMEDI_INITCLEANUP + +2003-11-17 12:12 ds + + * README.CVS: Add some notes about compiling from CVS + +2003-11-15 16:17 fmhess + + * include/linux/interrupt.h: 2.4.22 does _not_ have new interrupt + prototypes (at least the debian and I assume the vanilla kernel + do not). I believe the RH 2.4.22 kernel is patched with the new + prototypes, but to heck with them. + +2003-11-13 13:13 ds + + * comedi/drivers/adv_pci1710.c: Add counter subdevice. From Nils + Juergens + +2003-10-30 15:00 fmhess + + * comedi/drivers/cb_pcidas64.c: adjust number of dma ring bounce + buffers independently for ai and ao, and make number of ai ring + buffers board-dependent (to deal with extremely fast 4020) + +2003-10-23 17:55 fmhess + + * comedi/drivers/ni_mio_cs.c: add mention of daqcard-6036e as + supported board + +2003-10-22 17:44 fmhess + + * comedi/drivers/: adl_pci9111.c, cb_pcidda.c: some + pci_request_regions() tweaks, and set DUMMY_BIT on writes to + calibration reg 2 in cb_pcidda.c + +2003-10-22 17:12 ds + + * configure.ac, modtool.in: Use LINUX_CC for CC. Cause modtool to + strip debugging symbols. + +2003-10-18 14:29 fmhess + + * comedi/drivers/me4000.c: make it compile without firmware header + (but it wont work of course) + +2003-10-18 14:16 fmhess + + * comedi/drivers/me4000_fw.h: removed file for same reason as + me2600_fw.h was removed: licensing terms are incompatible with + GPL and we don't even have source code for the firmware binary. + +2003-10-18 14:05 fmhess + + * comedi/drivers/cb_pcidas64.c: give warning and return error if + user attempts to use ao command and ai external queue at the same + time. + +2003-10-18 07:13 fmhess + + * comedi/drivers/: adl_pci9118.c, das16.c, gsc_hpdi.c, + ni_mio_common.c: get rid of underscores in my byte swapping calls + +2003-10-17 09:42 fmhess + + * comedi/drivers/cb_pcidas64.c: ao commands work now + +2003-10-13 16:42 ds + + * comedi/drivers/ni_pcidio.c: turn off debugging + +2003-10-13 16:38 ds + + * include/linux/comedi.h: NDEVICES should have been increased a + long time ago + +2003-10-13 13:12 fmhess + + * comedi/drivers/multiq3.c: fix ai munging + +2003-10-13 11:47 fmhess + + * INSTALL: remove obsolete mention of 'make config' + +2003-10-13 11:45 fmhess + + * INSTALL: add mention of new --with-rtaidir and --with-rtlinuxdir + configure options + +2003-10-12 15:49 fmhess + + * comedi/drivers/cb_pcidas64.c: more ao waveform support (still not + done yet) + +2003-10-12 15:47 fmhess + + * comedi/drivers/das16.c: disable irq mode entirely, since it is so + lame. + +2003-10-10 12:57 fmhess + + * comedi/drivers/cb_pcidas64.c: beginnings of ao command support + +2003-10-09 07:57 fmhess + + * Makefile.am: add ACLOCAL_AMFLAGS so automake calls aclocal + correctly when necessary + +2003-10-04 16:21 fmhess + + * comedi/Makefile.am, comedi/drivers/Makefile.am, + comedi/drivers/das16.c, comedi/kcomedilib/Makefile.am, + m4/linux.m4: first pass at autoconf'd RT support done + +2003-10-04 16:19 fmhess + + * comedi/comedi_fops.c: fixed comedi_buf_write_n_available argument + +2003-10-03 15:56 fmhess + + * m4/linux.m4: partial RT support + +2003-10-02 12:58 ds + + * comedi/drivers/multiq3.c: Fix incorrect return value of AI insn + function + +2003-10-01 15:44 ds + + * comedi/drivers/ni_atmio.c: reenable isapnp + +2003-10-01 15:44 ds + + * include/linux/isapnp.h: Disable isapnp on 2.6 (temporarily) + +2003-10-01 15:43 ds + + * include/linux/interrupt.h: 2.4.22 has new interrupt prototypes + +2003-10-01 15:30 ds + + * Makefile.in.append, Makefile.modbuild, Rules.make: Remove old + files + +2003-09-30 18:22 fmhess + + * comedi/drivers/: ni_labpc.c, ni_labpc.h, ni_labpc_cs.c: fix + loading of counters on memory-mapped io boards (pci-1200) + +2003-09-30 06:13 fmhess + + * comedi/drivers/das16.c: revert last change, it didn't help + +2003-09-28 12:50 fmhess + + * comedi/drivers/das16.c: a couple of people have reported + interrupts not working, I'm guessing the interrupt needs to be + cleared at the end of the interrupt handler. + +2003-09-20 14:30 fmhess + + * comedi/drivers/cb_pcidas64.c: fix for crapiness of computerboards + hardware (external queue interacts with ao fifo) + +2003-09-20 09:42 fmhess + + * comedi/drivers/ni_mio_common.c: remove redundant analog output + munging with using PIO + +2003-09-19 18:51 fmhess + + * comedi/drivers/adl_pci9118.c: simplify and speed up + +2003-09-19 14:26 fmhess + + * comedi/drivers/adl_pci9118.c: convert to new-style munging, fix + for big-endian machines, simplified slightly. + +2003-09-19 11:53 fmhess + + * comedi/drivers/ni_mio_cs.c: correct ai fifo depth for daqcard + 6062e + +2003-09-19 11:32 fmhess + + * comedi/drivers/me4000.c: fix compilation error + +2003-09-19 08:46 fmhess + + * comedi/drivers/adl_pci9111.c: Converted to new-style munging. + Got rid of bogus scan_begin_src=TRIG_TIMER support. Some + space->tab whitespace fixes. + +2003-09-19 08:12 fmhess + + * comedi/drivers/comedi_fc.h: discourage inappropriate use + +2003-09-18 14:27 ds + + * .cvsignore, comedi/.cvsignore, comedi/drivers/.cvsignore, + comedi/kcomedilib/.cvsignore: ignore some files + +2003-09-18 14:14 ds + + * comedi/drivers/Makefile.am: Add me4000 driver + +2003-09-18 13:56 ds + + * comedi/drivers/me4000.c: Fixes for changes since 0.7.67. + +2003-09-18 13:55 ds + + * comedi/Makefile.am: remove install-data-hook target + +2003-09-18 13:54 ds + + * Makefile.am: Dist modtool.in. change check target to "moo" + (temporary). + +2003-09-18 13:53 ds + + * configure.ac: default prefix should be /. modtool is in + ${builddir}. + +2003-09-18 12:10 ds + + * comedi/drivers/: me4000.c, me4000.h, me4000_fw.h: new driver + +2003-09-16 17:18 fmhess + + * comedi/drivers/gsc_hpdi.c: big endian fixes + +2003-09-16 17:07 fmhess + + * comedi/drivers/ni_mio_common.c: get rid of redundant ai munging + +2003-09-16 11:36 fmhess + + * comedi/drivers/: cb_pcidas64.c, plx9080.h: fixes for big endian + machines + +2003-09-16 08:19 fmhess + + * comedi/drivers/das16.c, include/linux/comedidev.h: do das16.c + munging in core + +2003-09-15 17:30 fmhess + + * comedi/kcomedilib/get.c: added munging to kcomedilib + +2003-09-15 14:33 fmhess + + * comedi/comedi_fops.c, comedi/drivers.c, + comedi/drivers/comedi_fc.c, comedi/drivers/dt282x.c, + comedi/drivers/ni_labpc.c, comedi/drivers/ni_mio_common.c, + comedi/drivers/rti800.c, comedi/kcomedilib/kcomedilib_main.c, + include/linux/comedidev.h: Fully support munging in core. Still + need to check munging for kcomedilib though. + +2003-09-15 14:21 fmhess + + * Makefile, configure, comedi/Makefile.in, + comedi/drivers/Makefile.in, comedi/kcomedilib/Makefile.in: + removing old files replaced by autoconf stuff + +2003-09-12 11:56 fmhess + + * comedi/drivers/gsc_hpdi.c: apply dma init fix that worked so well + with cb_pcidas64.c + +2003-09-12 11:33 fmhess + + * comedi/drivers/cb_pcidas64.c: really fixed channel queue + problems. The adc enable bit does not need to be set during + setup after all. Fixed random problems with first dma block by + adding a little more dma initialization during command setup. + Fixed two bogus samples on first command using external queue by + moving queue setup to a later point in ai cmd. Moved around some + code in attach() so more stuff gets done before interrupt handler + is registered (due to one crash I saw while modprobing while + sound card on same interrupt was playing). + +2003-09-11 17:34 fmhess + + * comedi/drivers/cb_pcidas64.c: clear/set adc enable bit during ai + cmd setup, so that start triggers work + +2003-09-11 14:27 fmhess + + * comedi/drivers/cb_pcidas64.c: fixed ai channel queue setup + +2003-09-11 11:03 ds + + * configure.ac: Add 8255 config option + +2003-09-08 15:48 fmhess + + * comedi/drivers/cb_pcidas64.c: check that dma allocations succeed, + and some minor cleanups + +2003-09-08 15:16 fmhess + + * comedi/drivers/8253.h: change base address variables to long, for + 64 bit machines. + +2003-09-08 11:16 fmhess + + * comedi/drivers/plx9080.h: fix dma abort lockups + +2003-09-06 20:44 fmhess + + * comedi/drivers.c: fix increment of munge_chan + +2003-09-06 12:58 fmhess + + * comedi/drivers/dt282x.c: make sure dma is disabled during command + setup + +2003-09-06 10:43 fmhess + + * comedi/drivers/dt282x.c: fixed maximum speeds for different board + types (added dt2821-f and g). Changed some variables to + volatile, renamed confusingly named dma_chan variables to + dma_index + +2003-09-06 09:33 fmhess + + * comedi/comedi_fops.c: move init of async->events into + init_async_buf() + +2003-09-06 09:31 fmhess + + * comedi/kcomedilib/kcomedilib_main.c: init async->events to zero + +2003-09-05 15:23 fmhess + + * comedi/drivers/dt282x.c: re-enabled ad done interrupts in ai cmd, + and added check against maximum board speed to ai_cmdtest + +2003-09-05 10:14 fmhess + + * comedi/drivers/dt282x.c: ignore ai errors that occur after we + have all the data we wanted + +2003-09-05 09:46 fmhess + + * comedi/drivers/dt282x.c: trying to fix crashes at during high + frequency ai + +2003-09-04 13:19 fmhess + + * comedi/drivers/dt282x.c: don't re-enable ai dma after it's + finished + +2003-09-03 13:08 fmhess + + * comedi/drivers/dt282x.c: add clear_dma_ff() calls + +2003-09-03 12:46 fmhess + + * include/linux/comedidev.h: define COMEDI_VERSION() + +2003-09-03 12:36 fmhess + + * comedi/drivers/ni_labpc_cs.c: its IRQ_FORCED_PULSE, not + IRQ_FORCE_PULSED + +2003-09-03 12:28 fmhess + + * INSTALL: update install instructions for autoconf + +2003-09-03 12:15 fmhess + + * comedi/drivers/dt282x.c: fix problems with buffer wrap-around by + using generic comedi_fc code + +2003-09-03 10:21 fmhess + + * comedi/drivers/ni_labpc_cs.c: daqcard-1200 uses pulsed interrupts + +2003-09-01 18:12 ds + + * configure.ac, include/linux/comedidev.h: Fix to make the version + code work correctly. + +2003-09-01 17:55 ds + + * m4/linux.m4: change ${MAKE} to ${MAKE-make} to set a reasonable + default + +2003-08-31 21:02 fmhess + + * comedi/comedi_fops.c: on second thought, EPERM isn't any more + accurate than ENODEV. + +2003-08-31 19:26 fmhess + + * comedi/comedi_fops.c: print some debug messages on ENODEV errors + in open, and changed one to an EPERM + +2003-08-31 17:20 fmhess + + * comedi/drivers/ni_labpc.c: add missing comedi_event() call after + overflow + +2003-08-25 13:04 ds + + * m4/linux.m4: change make -C to ${MAKE} -C + +2003-08-21 16:14 ds + + * modtool.in: For some reason, install wants to set the mode to 755 + on installed .o files. Override it to 644. + +2003-08-20 15:35 fmhess + + * comedi/drivers/rti800.c: fix delays + +2003-08-16 20:37 ds + + * configure.ac: force debugging + +2003-08-16 20:33 ds + + * configure.ac: enable PCMCIA checking + +2003-08-11 16:51 fmhess + + * comedi/: comedi_ksyms.c, kcomedilib/ksyms.c: fix compiler warning + about redefinition of EXPORT_SYMTAB with old Makefiles + +2003-08-11 15:25 ds + + * comedi/drivers/quatech_daqp_cs.c: update from Brent (with + 1.13->1.15 merged in) + +2003-08-11 13:19 ds + + * Makefile.am, comedi/Makefile.am, comedi/comedi_ksyms.c, + comedi/drivers/Makefile.am, comedi/kcomedilib/Makefile.am, + comedi/kcomedilib/ksyms.c: Fixes for 'make dist' to work properly + +2003-08-11 11:32 ds + + * comedi/drivers/addi-data/: APCI1710_82x54.c, APCI1710_82x54.h, + APCI1710_Chrono.c, APCI1710_Chrono.h, APCI1710_Dig_io.c, + APCI1710_Dig_io.h, APCI1710_INCCPT.c, APCI1710_INCCPT.h, + APCI1710_Inp_cpt.c, APCI1710_Inp_cpt.h, APCI1710_Pwm.c, + APCI1710_Pwm.h, APCI1710_Ssi.c, APCI1710_Ssi.h, APCI1710_Tor.c, + APCI1710_Tor.h, APCI1710_Ttl.c, APCI1710_Ttl.h, Makefile.am, + addi_amcc_s5933.h, addi_common.c, addi_common.h, addi_eeprom.c, + amcc_s5933_58.h, hwdrv_APCI1710.c, hwdrv_APCI1710.h, + hwdrv_apci035.c, hwdrv_apci035.h, hwdrv_apci1032.c, + hwdrv_apci1032.h, hwdrv_apci1500.c, hwdrv_apci1500.h, + hwdrv_apci1516.c, hwdrv_apci1516.h, hwdrv_apci1564.c, + hwdrv_apci1564.h, hwdrv_apci2016.c, hwdrv_apci2016.h, + hwdrv_apci2032.c, hwdrv_apci2032.h, hwdrv_apci2200.c, + hwdrv_apci2200.h, hwdrv_apci3120.c, hwdrv_apci3120.h, + hwdrv_apci3200.c, hwdrv_apci3200.h, hwdrv_apci3501.c, + hwdrv_apci3501.h: driver(s) from ADDI-DATA + +2003-08-08 15:01 fmhess + + * m4/linux.m4: changed indentation to tabs + +2003-08-08 14:56 fmhess + + * m4/linux.m4: add config and depend checks for linux directory + +2003-08-08 14:42 fmhess + + * m4/linux.m4: added check for include/linux/version.h + +2003-08-08 13:01 ds + + * Makefile.am: Add the dev, drivers.txt, and check targets from old + Makefile + +2003-08-08 11:35 fmhess + + * comedi/Makefile.am: add install-data-hook for depmod + +2003-08-08 11:18 fmhess + + * m4/linux.m4: extra m4 quotes [] to make regular expression work + +2003-08-08 10:41 fmhess + + * comedi/drivers/cb_pcidas64.c: some cleanup for external master + clock support on 4020, and allow TRIG_TIMER as convert_src on + 4020 (with convert_arg=0). + +2003-08-06 19:46 ds + + * configure.ac, m4/linux.m4: Add detection for kernel major/minor + version + +2003-08-06 19:45 ds + + * comedi/drivers/Makefile.am: fix another typo + +2003-08-06 18:06 ds + + * comedi/drivers/Makefile.am: readd pcmcia modules (typo) + +2003-08-06 18:04 ds + + * comedi/drivers/ni_atmio.c: diable isapnp, because it doesn't + compile on 2.6 + +2003-08-06 18:03 ds + + * comedi/: Makefile.am, drivers/Makefile.am, + kcomedilib/Makefile.am: add link flag for modtool. separate out + PCMCIA-based drivers + +2003-08-06 18:02 ds + + * configure.ac, modtool.in: actually works now + +2003-08-06 18:02 ds + + * autogen.sh: pass command line options to configure + +2003-08-06 18:01 ds + + * m4/linux.m4: m4 macros for a bunch of Linux ops + +2003-08-06 15:01 fmhess + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: speed up pio ai fifo + transfer a little + +2003-08-05 15:39 fmhess + + * Makefile.modbuild: config/modversions.h and linux/modversions.h + are not equivalent + +2003-08-05 15:38 fmhess + + * scripts/dep.linux: override MODVERDIR + +2003-08-05 13:02 fmhess + + * scripts/dep.linux: fix overwrite of LINUXDIR and trivial tweaks + +2003-08-05 12:23 fmhess + + * include/linux/module.h: fix for NULL undefined? + +2003-08-05 11:55 fmhess + + * Makefile.modbuild, scripts/dep.linux: linux 2.6 flag extraction + +2003-08-05 11:28 fmhess + + * include/: asm/dma.h, linux/fs.h, linux/init.h, linux/irq.h, + linux/isapnp.h, linux/kmod.h, linux/mm.h, linux/module.h, + linux/pci.h, linux/poll.h, linux/sched.h, linux/slab.h, + linux/spinlock.h, linux/timer.h, linux/vmalloc.h: replace all hex + codes with KERNEL_VERSION() for clairity + +2003-08-04 20:46 ds + + * include/linux/version.h: Comedi's version is now in config.h + +2003-08-04 20:37 ds + + * modtool.in: tool for making kernel modules + +2003-08-04 20:36 ds + + * Makefile.am: new makefile + +2003-08-04 20:35 ds + + * m4/linux.m4: holder for linux macro + +2003-08-04 20:34 ds + + * autogen.sh, configure.ac: automake! + +2003-08-04 20:34 ds + + * include/linux/: comedi_rt.h, interrupt.h, module.h: Backport + Frank's 2.6 changes to 2.4 + +2003-08-04 20:32 ds + + * comedi/drivers/: adl_pci9111.c, adv_pci1710.c, amplc_pc236.c, + amplc_pci230.c, cb_pcidas.c, cb_pcidas64.c, ni_pcidio.c: Change + IRQ_HANDLED to 1 when used as an rvalue + +2003-08-04 20:30 ds + + * comedi/: Makefile.am, drivers/Makefile.am, + kcomedilib/Makefile.am: automake Makefiles + +2003-08-04 20:29 ds + + * Contributors: I'm a contributor, too + +2003-08-04 13:23 fmhess + + * comedi/drivers/comedi_test.c: bugfix from Steven Jenkins + +2003-08-04 12:10 fmhess + + * include/linux/pci.h: added some 2.2 pci hotplug compat + +2003-08-04 11:56 fmhess + + * comedi/drivers/dt282x.c: get_free_page() is gone in 2.6 + +2003-08-04 11:48 fmhess + + * comedi/drivers/comedi_parport.c: update to 2.6 interrupt handler + prototype + +2003-08-04 11:47 fmhess + + * comedi/drivers/dt3000.c: pci_present() gone in 2.6 + +2003-08-04 11:32 fmhess + + * comedi/: comedi_fops.c, drivers.c, kcomedilib/kcomedilib_main.c: + replace deprecated MOD_INC_USE_COUNT/MOD_DEC_USE_COUNT with + try_module_get()/module_put() + +2003-08-04 11:30 fmhess + + * include/linux/module.h: fixes for 2.6 module_get/module_put + +2003-08-03 20:28 fmhess + + * comedi/drivers.c: pte_offset is now pte_offset_kernel in 2.6 + +2003-08-03 20:27 fmhess + + * comedi/drivers/: adl_pci9111.c, adl_pci9118.c, adv_pci1710.c, + amplc_pc236.c, amplc_pci230.c, cb_das16_cs.c, cb_pcidas.c, + cb_pcidas64.c, daqboard2000.c, das16.c, das16m1.c, das1800.c, + das6402.c, das800.c, dt2814.c, dt282x.c, dt3000.c, gsc_hpdi.c, + icp_multi.c, ni_6527.c, ni_at_a2150.c, ni_atmio16d.c, + ni_daq_dio24.c, ni_labpc.c, ni_labpc_cs.c, ni_mio_common.c, + ni_mio_cs.c, ni_pcidio.c, pcl711.c, pcl812.c, pcl816.c, pcl818.c, + quatech_daqp_cs.c, rtd520.c, rti800.c: new interrupt handler + prototype for 2.6, plus some other 2.6 issues + +2003-08-03 18:06 fmhess + + * include/: asm/pgtable.h, linux/comedidev.h, + linux/devfs_fs_kernel.h, linux/interrupt.h, linux/module.h, + linux/pci.h, linux/wrapper.h: more 2.6 compatibility + +2003-08-03 15:23 fmhess + + * comedi/comedi_fops.c, include/linux/comedidev.h: kdev_t and suser + fixes for 2.6 + +2003-08-03 15:16 fmhess + + * include/linux/kdev_t.h: new compat header for 2.6 changes + +2003-07-19 14:51 fmhess + + * comedi/drivers/das16.c: don't require id bits to match anymore, + since it has proven to be more trouble than it's worth + +2003-07-16 09:48 fmhess + + * README: update web page url + +2003-07-10 15:08 fmhess + + * comedi/drivers/ni_pcimio.c: fix caldac types for 6052 + +2003-07-08 17:03 fmhess + + * comedi/drivers/ni_labpc.c: added a note about isapnp support + +2003-07-08 16:47 fmhess + + * INSTALL: removed references to hard-coded comedi_config path + +2003-07-04 13:00 fmhess + + * comedi/: Config.in, drivers/Makefile.in, drivers/das08.c, + drivers/das08.h, drivers/das08_cs.c, drivers/ni_labpc.h: split + PCMCIA support out of das08.o driver + +2003-07-04 11:50 fmhess + + * comedi/drivers/: ni_labpc.c, ni_labpc.h, ni_labpc_cs.c: reduce + number of symbols exported from ni_labpc.o for ni_labpc_cs.o + +2003-07-03 13:42 fmhess + + * comedi/: Config.in, drivers/Makefile.in, drivers/ni_labpc.c, + drivers/ni_labpc.h, drivers/ni_labpc_cs.c: split off pcmcia + daqcard-1200 support from ni_labpc driver + +2003-07-02 15:58 ds + + * scripts/dep.rtai: Simple patch to get Comedi to compile with the + experimential version of RTAI. + +2003-07-01 08:43 fmhess + + * comedi/Config.in: fix setting of CONIFG_COMEDI_MITE + +2003-06-27 07:24 fmhess + + * comedi/drivers/ni_pcimio.c: fix caldac type for pci-6036e and + pci-6034e. fixed some indentation. + +2003-06-18 11:07 fmhess + + * include/linux/module.h: added EXPORT_SYMBOL_GPL() compat macro + +2003-06-17 18:39 ds + + * Contributors: Add a bunch of people + +2003-06-17 18:27 ds + + * scripts/config.dist: update for new drivers + +2003-06-17 18:25 ds + + * scripts/check_driver: alloc_subdevices() changed. + +2003-06-17 18:25 ds + + * comedi/drivers/ni_6527.c: fix driver name in doc block + +2003-06-17 18:25 ds + + * comedi/drivers/adv_pci_dio.c: Add subdev_8255_cleanup() + +2003-06-17 18:24 ds + + * comedi/drivers/Makefile.in: Add ni_660x + +2003-06-17 18:24 ds + + * comedi/Config.in: Add NI_660X + +2003-06-17 18:22 ds + + * comedi/drivers/ni_660x.c: Found this wandering around. Figured + it should go in CVS. + +2003-06-12 09:10 fmhess + + * comedi/comedi_fops.c, include/linux/mm.h: fix for new 2.5 + remap_page_range() prototype + +2003-06-09 16:46 fmhess + + * comedi/drivers/cb_pcidas.c: trying to fix some pci-das1602/16 + calibration weirdness + +2003-06-06 11:58 ds + + * comedi/Config.in: ni_6527 requires the mite driver + +2003-06-06 11:57 ds + + * comedi/drivers/ni_6527.c: Fix minor typos. + +2003-06-05 12:52 fmhess + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: make single-scan code + work for 611x too + +2003-06-05 12:52 fmhess + + * comedi/drivers/cb_pcidas.c: trying to fix dac08 calibration dac, + which doesn't seem to be updating + +2003-06-03 19:24 fmhess + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: jump through hoops + for special case of stop_arg=1 on ai command + +2003-06-03 14:12 fmhess + + * comedi/drivers/ni_mio_common.c: try and make sure we get the scan + across dma during end-of-scan interrupts + +2003-05-29 17:37 fmhess + + * comedi/drivers/ni_mio_common.c: fix race in setting COMEDI_CB_EOS + event with dma + +2003-05-29 17:23 fmhess + + * scripts/dep.linux: added an error check that catches common case + of 'make config' failing to get compile flags from kernel source. + +2003-05-29 15:34 fmhess + + * comedi/drivers/ni_mio_common.c: made minimum stop_arg for + stop_src = TRIG_COUNT equal to 2, since that is the smallest + supported by the scan counter. Also, fixes for COMEDI_CB_EOS + with pcidma. + +2003-05-27 10:28 ds + + * Contributors, Documentation/Configure.help, + Documentation/Configure.help.append, comedi/Config.in, + comedi/comedi_fops.c, include/linux/comedidev.h: New driver from + Michal Dobes + +2003-05-27 10:27 ds + + * comedi/drivers/: Makefile.in, adv_pci_dio.c: Add adv_pci_dio + driver from Michal Dobes + +2003-05-27 10:22 ds + + * comedi/drivers/: adl_pci9118.c, adv_pci1710.c, amcc_s5933.c, + ni_atmio16d.c, pcl724.c, pcl812.c, pcl816.c, pcl818.c, + amcc_s5933.h: majkl@tesnet.cz -> dobes@tesnet.cz + +2003-05-27 10:19 ds + + * comedi/drivers/icp_multi.c: update documentation + +2003-05-25 20:50 fmhess + + * comedi/drivers/ni_mio_common.c: external trigger fixes + +2003-05-25 19:30 fmhess + + * comedi/drivers/ni_mio_common.c: got rid of BUG message on buffer + overrun, since it isn't really a bug in the driver + +2003-05-24 08:02 fmhess + + * comedi/drivers/ni_mio_common.c: think i finnally found the + problem with 611x initialization + +2003-05-23 16:04 fmhess + + * comedi/drivers/: ni_mio_common.c, ni_pcimio.c, ni_stc.h: still + trying to fix 6110 initialization problem, plus a tiny bit of + random cleanup + +2003-05-23 12:15 fmhess + + * comedi/drivers/cb_pcidas64.c: fix new ai range code + +2003-05-23 12:11 fmhess + + * comedi/drivers/cb_pcidas64.c: added new boards + +2003-05-23 08:47 fmhess + + * comedi/drivers/ni_mio_common.c: still trying to fix erratic scan + pacing on 611x, plus some minor cleanup + +2003-05-20 10:18 fmhess + + * comedi/drivers/ni_mio_common.c: really fixed munging for pio + boards + +2003-05-19 13:26 fmhess + + * comedi/drivers/ni_atmio.c: fix segfault noted by calin calianu + +2003-05-15 17:39 fmhess + + * comedi/drivers/ni_mio_common.c: disarm counters in ni_ai_reset(), + to try and fix initialization problems with 611x. Apparantly, + counters won't load unless they are disarmed so this should make + sure they are disarmed. + +2003-05-15 15:07 fmhess + + * comedi/drivers/ni_mio_common.c: fix munging for pio analog input + +2003-05-15 10:55 ds + + * comedi/drivers/comedi_test.c: Patch to add AO subdevice from + "Calin A. Culianu" + +2003-05-14 11:00 ds + + * scripts/dep.rtlinux: Patch from "Calin A. Culianu" + + +2003-05-12 11:04 fmhess + + * comedi/drivers/: cb_pcidas.c, ni_mio_common.c: initialize caldacs + (so software readback is synced with actual setting) and avoid + doing caldac write when it is unnecessary. + +2003-05-12 11:03 fmhess + + * comedi/drivers/ni_labpc.c: change address parameter to unsigned + long for inb/outb/readb/writeb wrappers + +2003-05-12 11:00 fmhess + + * comedi/drivers/ni_stc.h: fix length of caldacs array to prevent + its overflow when caldac channels + >= 12 are used + +2003-05-09 07:22 fmhess + + * comedi/drivers/: cb_pcidas.c, cb_pcidas64.c: added a little + comedi_calibrate advertising + +2003-05-08 17:02 fmhess + + * comedi/drivers/ni_labpc.c: moved calibration code to + comedi_calibrate + +2003-05-05 12:09 ds + + * comedi/drivers/ni_670x.c: PCI code for PCI-6704 + +2003-05-03 07:56 fmhess + + * comedi/drivers/ni_pcimio.c: change 6071 caldac type to + ad8804_debug to fix broken cal + +2003-05-01 18:01 fmhess + + * comedi/drivers/ni_atmio.c: updated driver description about + isapnp support + +2003-04-28 10:26 fmhess + + * comedi/drivers.c: re-fix suse brokeness + +2003-04-28 09:04 fmhess + + * comedi/drivers/ni_mio_cs.c: daqcard 6062e definitely has an + ad8804 caldac + +2003-04-27 10:24 fmhess + + * comedi/drivers/ni_mio_cs.c: oops that was supposed to be ad8804, + not dac8804. Made it ad8804_debug even, for better testing. + +2003-04-27 10:01 fmhess + + * comedi/drivers/ni_mio_cs.c: trying dac8804 caldac type for + daqcard-6062 + +2003-04-18 21:54 fmhess + + * comedi/drivers/cb_pcidas64.c: remove nonexistant ao range for + 60xx boards + +2003-04-11 10:09 fmhess + + * comedi/kcomedilib/data.c: added include of comedidev.h for + comedi_udelay() + +2003-04-02 09:12 fmhess + + * comedi/drivers/cb_pcidas.c: removed some comments, at ivan's + request + +2003-03-31 08:27 fmhess + + * comedi/drivers/ni_atmio.c: fix compile + +2003-03-27 13:08 fmhess + + * comedi/kcomedilib/: data.c, kcomedilib_main.c: replaced udelay + with comedi_udelay + +2003-03-27 13:00 fmhess + + * comedi/drivers/adl_pci9111.c, comedi/drivers/adl_pci9118.c, + comedi/drivers/adv_pci1710.c, comedi/drivers/cb_das16_cs.c, + comedi/drivers/cb_pcidas.c, comedi/drivers/cb_pcidas64.c, + comedi/drivers/daqboard2000.c, comedi/drivers/das800.c, + comedi/drivers/dt2801.c, comedi/drivers/dt2811.c, + comedi/drivers/dt2814.c, comedi/drivers/dt2815.c, + comedi/drivers/dt282x.c, comedi/drivers/dt3000.c, + comedi/drivers/fl512.c, comedi/drivers/gsc_hpdi.c, + comedi/drivers/icp_multi.c, comedi/drivers/ni_at_a2150.c, + comedi/drivers/ni_labpc.c, comedi/drivers/ni_mio_common.c, + comedi/drivers/ni_pcimio.c, comedi/drivers/pcl711.c, + comedi/drivers/pcl812.c, comedi/drivers/pcl816.c, + comedi/drivers/pcl818.c, comedi/drivers/plx9080.h, + comedi/drivers/rtd520.c, comedi/drivers/rti800.c, + comedi/drivers/serial2002.c, include/linux/comedi_rt.h: replaced + all udelay() calls with comedi_udelay() wrapper for RT safety + +2003-03-27 12:46 fmhess + + * include/linux/pci.h: added pci_find_subsys() compatibility stub. + changed extern inline functions to static inline + +2003-03-27 09:02 fmhess + + * comedi/kcomedilib/get.c, comedi/kcomedilib/ksyms.c, + include/linux/comedilib.h: added comedi_get_buffer_offset() to + kcomedilib + +2003-03-27 08:54 fmhess + + * comedi/kcomedilib/get.c, comedi/kcomedilib/ksyms.c, + include/linux/comedilib.h: added comedi_mark_buffer_read() and + comedi_get_buffer_contents() to kcomedilib + +2003-03-14 09:01 fmhess + + * comedi/drivers/ni_atmio.c: more isapnp id tweaks, and removed + redundant num_ni_boards constant + +2003-03-14 08:53 fmhess + + * comedi/drivers/ni_atmio.c: added isapnp id number for + at-mio-16e-10 + +2003-03-13 13:39 fmhess + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: added locking for + software copies of registers + +2003-03-13 12:36 fmhess + + * comedi/drivers/ni_mio_common.c: get rid of printk on AO terminal + count interrupt + +2003-03-13 11:42 fmhess + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: AO + stop_src=TRIG_COUNT support from Rolf Mueller, and some fixes for + uniform use of ni_set_bits from me + +2003-03-13 10:34 fmhess + + * comedi/drivers/: ni_atmio.c, ni_stc.h: added isapnp id of + AT-MIO-16XE-50 to driver + +2003-03-12 15:08 fmhess + + * comedi/kcomedilib/ksyms.c: added comedi_data_read_hint() and + comedi_data_read_delayed() + +2003-03-12 14:04 fmhess + + * comedi/kcomedilib/data.c, include/linux/comedilib.h: added + comedi_data_read_hint() and comedi_data_read_delayed to + kcomedilib + +2003-03-12 07:58 fmhess + + * comedi/drivers/: amplc_pci230.c, cb_pcimdas.c, das08.c: ripped + out some settling delays + +2003-03-11 14:23 fmhess + + * comedi/drivers/ni_mio_common.c: make underrun detection play nice + with stop_src TRIG_COUNT + +2003-03-11 11:55 fmhess + + * comedi/drivers/ni_mio_common.c: handle ai error events before + exiting handler + +2003-03-11 09:57 fmhess + + * comedi/drivers/cb_pcidas.c: patch from Ivan, with settling delay + ripped out (updates email address) + +2003-03-10 14:23 fmhess + + * comedi/drivers/ni_atmio.c, include/linux/isapnp.h: isapnp.h + compat header didn't work out as nicely as I hoped + +2003-03-10 13:38 fmhess + + * include/linux/isapnp.h: added isapnp compat header + +2003-03-10 13:04 fmhess + + * comedi/drivers/ni_atmio.c: isapnp fixes (mostly just changing + pcidev->irq to pcidev->irq_resource[0].start + +2003-03-01 19:10 fmhess + + * comedi/drivers/cb_pcidas64.c: initialize caldacs to + middle-of-range during attach, don't bother reprogramming them if + they are already set as desired + +2003-03-01 17:21 fmhess + + * comedi/drivers/gsc_hpdi.c: init almost empty/full registers with + larger values, since dma seems to be underrunning the fifo + occasionally + +2003-03-01 17:04 fmhess + + * comedi/drivers/cb_pcidas64.c: don't enable BTERM# + +2003-02-28 09:17 fmhess + + * comedi/drivers/das16.c: try to fix some useless warning messages + with das16/330 + +2003-02-27 09:30 fmhess + + * comedi/drivers/das16.c: explicitly disable interrupts and pacing + in ai read insn + +2003-02-27 09:19 fmhess + + * comedi/drivers/das16.c: made das16_cancel() disable external + pacing too + +2003-02-24 11:16 fmhess + + * comedi/drivers/gsc_hpdi.c: fix crash + +2003-02-21 19:00 fmhess + + * comedi/kcomedilib/get.c: removed redundant setting of + async->buf_read_count since it is handled by comedi_read_free() + call I added + +2003-02-20 18:19 fmhess + + * comedi/kcomedilib/ksyms.c: exported symbol for + comedi_get_buffer_size() + +2003-02-20 11:00 fmhess + + * comedi/kcomedilib/get.c, include/linux/comedilib.h: added + comedi_get_buffer_size() to kcomedilib + +2003-02-20 08:43 fmhess + + * comedi/drivers/gsc_hpdi.c: updated status + +2003-02-19 17:50 fmhess + + * comedi/drivers/gsc_hpdi.c: disable debugging code + +2003-02-19 17:46 fmhess + + * comedi/drivers/gsc_hpdi.c: added debug message + +2003-02-19 17:00 fmhess + + * comedi/kcomedilib/get.c: added comedi_buf_read_free() call to + comedi_set_user_int_count() + +2003-02-19 16:31 fmhess + + * comedi/drivers/gsc_hpdi.c: added rx fifo overrun detection + +2003-02-19 16:28 fmhess + + * comedi/drivers/gsc_hpdi.c: imore debug messages + +2003-02-19 16:17 fmhess + + * comedi/drivers/gsc_hpdi.c: disable interrupts in cancel + +2003-02-19 13:34 fmhess + + * include/linux/comedidev.h: make subdev_flags and runflags + volatile since they can be modified in interrupt (comedi_event()) + +2003-02-19 08:08 fmhess + + * comedi/drivers/gsc_hpdi.c: stop suppressing block events + +2003-02-18 20:21 fmhess + + * comedi/comedi_fops.c: added a debug message + +2003-02-18 20:20 fmhess + + * comedi/drivers.c: set insn_config to insn_inval if it is NULL + +2003-02-18 20:19 fmhess + + * comedi/drivers/gsc_hpdi.c: fix INSN_CONFIG_BLOCK_SIZE + +2003-02-18 18:37 fmhess + + * comedi/drivers/gsc_hpdi.c: more debug messages + +2003-02-18 18:05 fmhess + + * comedi/drivers/gsc_hpdi.c: bug fixes + +2003-02-18 15:44 fmhess + + * comedi/drivers/comedi_fc.c: make end of scan events correct for + digital io + +2003-02-18 15:44 fmhess + + * comedi/drivers/plx9080.h: declare elements of dma descriptors + volatile + +2003-02-18 15:41 fmhess + + * comedi/drivers/gsc_hpdi.c: add support for + INSN_CONFIG_BLOCK_SIZE + +2003-02-18 09:32 fmhess + + * comedi/drivers/gsc_hpdi.c: added init of hpdi interrupt control + reg, fixed dma abort channel + +2003-02-18 08:19 fmhess + + * comedi/drivers/gsc_hpdi.c: fix stop src TRIG_COUNT + +2003-02-17 16:35 fmhess + + * comedi/drivers/gsc_hpdi.c: fix pci discovery + +2003-02-17 10:01 fmhess + + * comedi/drivers/gsc_hpdi.c: use dma chan 0 + +2003-02-16 21:04 fmhess + + * comedi/: Config.in, drivers/Makefile.in, drivers/gsc_hpdi.c: new + driver (doesn't work yet) + +2003-02-15 15:45 fmhess + + * comedi/drivers/cb_pcidas64.c: fixed sizes passed to ioremap + +2003-02-15 10:35 fmhess + + * comedi/drivers/8255.c, comedi/drivers/adl_pci9111.c, + comedi/drivers/adl_pci9118.c, comedi/drivers/adv_pci1710.c, + comedi/drivers/amplc_pc236.c, comedi/drivers/amplc_pc263.c, + comedi/drivers/amplc_pci230.c, comedi/drivers/cb_das16_cs.c, + comedi/drivers/cb_pcidas.c, comedi/drivers/cb_pcidas64.c, + comedi/drivers/cb_pcidda.c, comedi/drivers/cb_pcimdas.c, + comedi/drivers/cb_pcimdda.c, comedi/drivers/comedi_parport.c, + comedi/drivers/comedi_rt_timer.c, comedi/drivers/comedi_test.c, + comedi/drivers/contec_pci_dio.c, comedi/drivers/daqboard2000.c, + comedi/drivers/das08.c, comedi/drivers/das16.c, + comedi/drivers/das16m1.c, comedi/drivers/das1800.c, + comedi/drivers/das6402.c, comedi/drivers/das800.c, + comedi/drivers/dt2801.c, comedi/drivers/dt2811.c, + comedi/drivers/dt2814.c, comedi/drivers/dt2815.c, + comedi/drivers/dt2817.c, comedi/drivers/dt282x.c, + comedi/drivers/dt3000.c, comedi/drivers/fl512.c, + comedi/drivers/icp_multi.c, comedi/drivers/ii_pci20kc.c, + comedi/drivers/ke_counter.c, comedi/drivers/me_daq.c, + comedi/drivers/mpc8260cpm.c, comedi/drivers/multiq3.c, + comedi/drivers/ni_6527.c, comedi/drivers/ni_670x.c, + comedi/drivers/ni_at_a2150.c, comedi/drivers/ni_at_ao.c, + comedi/drivers/ni_atmio16d.c, comedi/drivers/ni_daq_dio24.c, + comedi/drivers/ni_labpc.c, comedi/drivers/ni_mio_common.c, + comedi/drivers/ni_pcidio.c, comedi/drivers/pcl711.c, + comedi/drivers/pcl724.c, comedi/drivers/pcl725.c, + comedi/drivers/pcl726.c, comedi/drivers/pcl812.c, + comedi/drivers/pcl816.c, comedi/drivers/pcl818.c, + comedi/drivers/pcm3730.c, comedi/drivers/pcmad.c, + comedi/drivers/poc.c, comedi/drivers/quatech_daqp_cs.c, + comedi/drivers/rtd520.c, comedi/drivers/rti800.c, + comedi/drivers/rti802.c, comedi/drivers/serial2002.c, + comedi/drivers/skel.c, comedi/drivers/ssv_dnp.c, + include/linux/comedidev.h: Changed prototype of + alloc_subdevices() so it doesn't require dev->n_subdevices to be + set prior to being called. Fixed 8255 cleanup in ni_daq_dio24.c. + Comedi sure has a lot of drivers these days! + +2003-02-15 09:45 fmhess + + * comedi/drivers/: cb_pcidas64.c, plx9080.h: moved plx9080 dma + abort routine from cb_pcidas64 driver into plx9080 header + +2003-02-13 08:52 fmhess + + * comedi/drivers/ni_pcidio.c: added pci-6534 to pci_device_id table + +2003-02-10 09:02 fmhess + + * comedi/drivers/skel.c: removed comment which said to wait for mux + to settle + +2003-02-10 08:12 fmhess + + * comedi/drivers/skel.c: got rid of some spurious address-of + operators + +2003-02-05 07:06 fmhess + + * scripts/release: updated reference to old lineo cvs server + +2003-02-03 10:16 ds + + * comedi/kcomedilib/dio.c: Fix warning + +2003-02-03 10:16 ds + + * comedi/drivers/pcl816.c: Move DEBUG() definition to fix compile + errors + +2003-02-03 10:15 ds + + * comedi/drivers/ni_670x.c: Doc links + +2003-02-03 10:14 ds + + * comedi/drivers/dt3000.c: Need to set read_subdev + +2003-02-02 22:09 fmhess + + * INSTALL: make install directions more redhat 8 friendly, + apparently 'make oldconfig' pulls in a config file based on + Makefile's EXTRAVERSION + +2003-01-30 19:55 ds + + * comedi/drivers/ni_pcidio.c: randomly change is_diodaq to a + bitfield + +2003-01-30 19:54 ds + + * include/linux/comedi.h: Add some configuration instructions + +2003-01-30 19:54 ds + + * comedi/kcomedilib/data.c: Add header + +2003-01-30 19:49 ds + + * comedi/drivers/ni_mio_common.c: move INSN_CONFIG to header + +2003-01-30 19:49 ds + + * comedi/drivers/comedi_parport.c: Fix missing bounds check + +2003-01-30 19:48 ds + + * comedi/: Config.in, drivers/Makefile.in, drivers/ni_6527.c: New + driver + +2003-01-30 14:00 ds + + * comedi/drivers/cb_pcimdda.c: Fix device name + +2003-01-29 11:35 fmhess + + * comedi/drivers/adl_pci9118.c: replace broken comedi_buf_put() + with cfc_write_to_buffer() + +2003-01-27 09:19 fmhess + + * comedi/drivers/das16.c: don't allow irq and timer mode to be used + simultaneously + +2003-01-23 11:44 fmhess + + * comedi/drivers/cb_pcidas.c: added some locking to make sure + software copies of write only registers are in sync + +2003-01-13 08:49 fmhess + + * comedi/drivers/cb_pcidas.c: trying to fix apparent failure to + reset interrupt + +2003-01-10 21:18 fmhess + + * comedi/drivers/ni_mio_common.c: fix 671x analog output insn that + i broke + +2003-01-01 15:57 fmhess + + * comedi/drivers/cb_pcidas.c: fix interaction between analog output + channels ( bug 14 ) + +2003-01-01 14:42 fmhess + + * comedi/drivers/cb_pcidas.c: fix number of eeprom channels, and + remove incorrect SDF_COMMON flag from ai subdevice + +2002-12-30 14:54 fmhess + + * Contributors, comedi/drivers/cb_pcidda.c, + comedi/drivers/comedi_test.c, comedi/drivers/das16m1.c, + comedi/drivers/das1800.c, comedi/drivers/das800.c, + comedi/drivers/poc.c: updated my email address + +2002-12-30 14:49 fmhess + + * comedi/drivers/cb_pcidas.c: fixed channel 1 analog output insn + (bug11) + +2002-12-20 20:12 fmhess + + * comedi/drivers/cb_pcidas64.c: fix supported analog input arefs + flags + +2002-12-20 20:12 fmhess + + * comedi/drivers/ni_pcimio.c: removed unused win_save() and + win_restore() + +2002-12-20 20:11 fmhess + + * comedi/drivers/: ni_atmio.c, ni_mio_common.c, ni_mio_cs.c: got + rid of all window save/restore stuff since it wasn't smp safe + anyways. replaced with spinlock as in ni_pcimio.c + +2002-12-20 15:29 ds + + * comedi/kcomedilib/kcomedilib_main.c: Patch from tomasz for + INSN_INITTRIG + +2002-12-11 19:14 ds + + * comedi/drivers/ni_670x.c: still don't know what the PCI ID of the + 6704 is + +2002-12-11 18:50 ds + + * comedi/drivers/ni_670x.c: Fixed range structures for 6704. + +2002-12-10 18:33 fmhess + + * comedi/drivers/: das08.c, ni_labpc.c: changed dev_info names so + pcmcia script will run comedi_config correctly + +2002-12-09 13:09 ds + + * comedi/drivers/ni_670x.c: Add PXI-6704 + +2002-12-08 11:30 fmhess + + * comedi/drivers/ni_labpc.c: some fixes to recent changes + +2002-12-06 12:28 fmhess + + * comedi/drivers/ni_labpc.c: made mapping of comedi_cmd to hardware + a little smarter, fixed ai external conversion trigger bug + +2002-12-06 12:27 fmhess + + * comedi/comedi_fops.c, include/linux/comedidev.h: made + comedi_error take a const pointer + +2002-12-05 12:11 ds + + * comedi/drivers/ni_pcimio.c: add pxi-6713 + +2002-12-02 19:13 ds + + * include/linux/comedidev.h: Fix symbol problems when debugging is + turned off + +2002-12-02 12:03 ds + + * comedi/: rt.c, rt_pend_tq.c: Fix compilation for rt due to + changes in comedidev.h. Fixes #8 + +2002-12-01 12:25 fmhess + + * comedi/drivers/ni_labpc.c: fix checking of scan_begin_arg in ai + command test + +2002-11-29 14:34 fmhess + + * comedi/drivers/ni_labpc.c: fix checking of first channel in + chanlist for ai cmd + +2002-11-29 14:05 fmhess + + * comedi/drivers/ni_labpc.c: reverted unnecessary locking of + command6 register (already safe due to ioctl locking) + +2002-11-29 10:09 fmhess + + * comedi/drivers/ni_mio_common.c: [no log message] + +2002-11-26 16:25 ds + + * comedi/Config.in: removed DAQBoard2000 FPGA option + +2002-11-26 16:25 ds + + * comedi/drivers/daqboard2000.c: remove FPGA header + +2002-11-26 16:24 fmhess + + * comedi/drivers/ni_labpc.c: added locking for software copies of + command registers 2 and 6, to prevent races between ai and ao. + Got rid of a couple redundant lines. + +2002-11-26 16:23 ds + + * comedi/drivers/daqboard2000_fpga.h: remove non-source code + +2002-11-26 15:36 ds + + * comedi/comedi_fops.c, comedi/drivers/daqboard2000.c, + comedi/drivers/me_daq.c, include/linux/comedi.h: Move auxiliary + data to options[30,31] + +2002-11-26 14:48 ds + + * Makefile: bump version + +2002-11-26 12:01 fmhess + + * comedi/comedi_fops.c: fix incorrect return of error when mmapping + entire buffer + +2002-11-25 12:13 fmhess + + * comedi/drivers/ni_mio_common.c: fix rejection of + CONFIG_ALT_SOURCE insn for 611x + +2002-11-25 11:13 fmhess + + * comedi/drivers/ni_mio_common.c: add support for 611x adjustable + calibration reference + +2002-11-24 10:35 fmhess + + * comedi/drivers/me2600_fw.h: licensing terms stated in header file + are incompatible with GPL. The files licensing was: + + /* * This file is copyrigth by Meilhaus Electronic GmbH 1998, + 1999. * You are not allowed to distribute, sell, modify, + reverse * engineer or use this code (or parts of it) for any + * other purpose or under any other conditions than stated below. + * * 1) You are allowed to distribute verbatim copies of this + file together * with device drivers for the Meilhaus me2600 + board. * * 2) Derived work (device drivers using this file) + can be * published under the terms of the * GNU General + Public License as published by * the Free Software + Foundation; either version 2 of the License, or * (at your + option) any later version. Any other license terms have * to + be agreed by Meilhaus GmbH in written. * * 3) This file is + distributed WITHOUT ANY WARRANTY; * without even the implied + warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR + PURPOSE. Meilhaus is under * no means liable for products + using this file or parts of it. * * 4) The copyright of this + file has to be mentioned in derived work. * * 5) If this + license terms are not valid due to any other law * or + restrictions imposed on you, you are not allowed to use * + this file in any way at all. */ + +2002-11-24 07:40 fmhess + + * comedi/drivers/ni_pcimio.c: fixed caldac types for 611x + +2002-11-22 13:37 fmhess + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: really fixing munging + this time + +2002-11-22 09:39 fmhess + + * comedi/drivers/ni_mio_common.c: fix ai munging bugs + +2002-11-21 23:12 ds + + * comedi/comedi_fops.c: Revert bufinfo structure name changes. + Fixed long-standing bug involving the return value of the insn + ioctl. + +2002-11-21 22:57 ds + + * include/linux/comedi.h: Revert accidental change of structure + names + +2002-11-21 22:55 ds + + * comedi/comedi_fops.c, comedi/drivers.c, comedi/drivers/mite.c, + comedi/drivers/mite.h, comedi/drivers/ni_pcidio.c, + comedi/drivers/ni_pcimio.c, include/linux/comedidev.h: Change + buf_alloc to buf_change, and fix allocation and mapping of + buffers. Added buf_page_list with list of pointers to buffer + pages. + +2002-11-21 22:53 ds + + * include/linux/version.h: Add a UTS_RELEASE override + +2002-11-21 11:16 fmhess + + * comedi/drivers/mite.c: added include to fix unresolved + mem_map_reserve and mem_map_unreserve + +2002-11-21 10:27 fmhess + + * comedi/drivers/ni_labpc.c: force io data path width to 8 bits for + daqcard + +2002-11-21 09:58 fmhess + + * comedi/drivers/ni_labpc.c: daqcard1200 cant scan upwards through + ai channels + +2002-11-21 00:40 ds + + * comedi/comedi_fops.c: Warning cleanup on 2.0.39 + +2002-11-21 00:39 ds + + * comedi/drivers/comedi_rt_timer.c: Compilation fixes + +2002-11-21 00:27 ds + + * include/linux/comedidev.h: Fix to previous checkin + +2002-11-21 00:21 ds + + * include/linux/: comedidev.h, init.h, vmalloc.h: Fixes for 2.0.39 + +2002-11-21 00:21 ds + + * scripts/config.dist-2.0.39: config.dist file with everything + disabled that doesn't work on 2.0.39 + +2002-11-21 00:00 ds + + * comedi/drivers/cb_pcimdas.c: compile fixes and warning fixes + +2002-11-20 23:56 ds + + * comedi/drivers/: amplc_pci230.c, cb_das16_cs.c, cb_pcimdas.c, + comedi_rt_timer.c, daqboard2000.c, das6402.c, dt2801.c, dt2811.c, + dt2814.c, dt3000.c, fl512.c, multiq3.c, ni_atmio16d.c, pcl711.c, + pcmad.c, quatech_daqp_cs.c, rtd520.c, rti800.c, serial2002.c, + skel.c: Fix subdevice flags not having AREF capability + +2002-11-20 23:55 ds + + * comedi/drivers/Makefile.in: added cb_pcimdas + +2002-11-20 23:54 ds + + * scripts/config.dist: new dffault + +2002-11-20 23:53 ds + + * comedi/Config.in: add cb_pcimdas + +2002-11-20 23:34 ds + + * comedi/comedi_ksyms.c, comedi/proc.c, comedi/drivers/8255.c, + comedi/drivers/adl_pci9111.c, comedi/drivers/adl_pci9118.c, + comedi/drivers/adv_pci1710.c, comedi/drivers/amcc_s5933.c, + comedi/drivers/amcc_s5933.h, comedi/drivers/amplc_pc236.c, + comedi/drivers/amplc_pc263.c, comedi/drivers/amplc_pci230.c, + comedi/drivers/cb_das16_cs.c, comedi/drivers/cb_pcidas.c, + comedi/drivers/cb_pcidas64.c, comedi/drivers/cb_pcidda.c, + comedi/drivers/cb_pcimdas.c, comedi/drivers/cb_pcimdda.c, + comedi/drivers/comedi_fc.c, comedi/drivers/comedi_fc.h, + comedi/drivers/comedi_parport.c, + comedi/drivers/comedi_rt_timer.c, comedi/drivers/comedi_test.c, + comedi/drivers/contec_pci_dio.c, comedi/drivers/daqboard2000.c, + comedi/drivers/das08.c, comedi/drivers/das16.c, + comedi/drivers/das16m1.c, comedi/drivers/das1800.c, + comedi/drivers/das6402.c, comedi/drivers/das800.c, + comedi/drivers/dt2801.c, comedi/drivers/dt2811.c, + comedi/drivers/dt2814.c, comedi/drivers/dt2815.c, + comedi/drivers/dt2817.c, comedi/drivers/dt282x.c, + comedi/drivers/dt3000.c, comedi/drivers/fl512.c, + comedi/drivers/icp_multi.c, comedi/drivers/icp_multi.h, + comedi/drivers/ii_pci20kc.c, comedi/drivers/ke_counter.c, + comedi/drivers/me_daq.c, comedi/drivers/mite.c, + comedi/drivers/mpc8260cpm.c, comedi/drivers/multiq3.c, + comedi/drivers/ni_670x.c, comedi/drivers/ni_at_a2150.c, + comedi/drivers/ni_at_ao.c, comedi/drivers/ni_atmio.c, + comedi/drivers/ni_atmio16d.c, comedi/drivers/ni_daq_dio24.c, + comedi/drivers/ni_labpc.c, comedi/drivers/ni_mio_common.c, + comedi/drivers/ni_mio_cs.c, comedi/drivers/ni_pcidio.c, + comedi/drivers/ni_pcimio.c, comedi/drivers/pcl711.c, + comedi/drivers/pcl724.c, comedi/drivers/pcl725.c, + comedi/drivers/pcl726.c, comedi/drivers/pcl812.c, + comedi/drivers/pcl816.c, comedi/drivers/pcl818.c, + comedi/drivers/pcm3730.c, comedi/drivers/pcmad.c, + comedi/drivers/poc.c, comedi/drivers/quatech_daqp_cs.c, + comedi/drivers/rtd520.c, comedi/drivers/rti800.c, + comedi/drivers/rti802.c, comedi/drivers/serial2002.c, + comedi/drivers/skel.c, comedi/drivers/ssv_dnp.c, + comedi/kcomedilib/get.c, include/linux/comedidev.h, + scripts/check_driver: Huge monster patch that removes unnessary + headers + +2002-11-20 20:44 ds + + * comedi/: kvmem.c, kvmem.h: remove + +2002-11-20 20:43 ds + + * comedi/: Makefile.in, comedi_fops.c, drivers.c: Reimplement + kvmem.[ch] code in comedi_fops + +2002-11-20 20:34 ds + + * include/linux/highmem.h: new compat header + +2002-11-20 20:33 ds + + * comedi/drivers/cb_pcimdda.c: fix request_region on 2.2 + +2002-11-20 20:33 ds + + * comedi/drivers/mite.c: remove kvmem.h + +2002-11-20 20:31 ds + + * comedi/drivers/: amplc_pc236.c, amplc_pc263.c: remove subdevice + stuff, since it doesn't work on 2.2 + +2002-11-20 20:30 ds + + * comedi/drivers/cb_pcimdas.c: new driver + +2002-11-20 20:29 ds + + * include/linux/pci.h: fix compat for pci_enable_device + +2002-11-20 20:28 ds + + * include/linux/module.h: fix some warnigns + +2002-11-20 20:27 ds + + * include/linux/mm.h: add page_address() + +2002-11-20 20:26 ds + + * include/linux/comedidev.h: Add uvirt_to_kva() and kvirt_to_pa() + +2002-11-20 20:26 ds + + * include/asm/page.h: add virt_to_page + +2002-11-20 20:18 ds + + * comedi/drivers/ke_counter.c: fix warning from check_driver + +2002-11-20 20:07 ds + + * comedi/Config.in: Put PC-CARD-DAS16/16 inside if PCMCIA + +2002-11-20 12:48 fmhess + + * comedi/drivers/ni_labpc.c: set CCSR_POWER_DOWN bit to see if that + changes anything + +2002-11-20 07:27 fmhess + + * comedi/drivers/ni_mio_common.c: changed all + if(boardtype.reg_611x) in analog output code to + if(boardtype.ao_671x) to try and get 671x boards to work too. + +2002-11-19 16:40 fmhess + + * comedi/drivers/comedi_fc.c: added log message on overrun + +2002-11-19 15:49 fmhess + + * comedi/comedi_fops.c, comedi/comedi_ksyms.c, comedi/drivers.c, + comedi/rt.c, comedi/drivers/comedi_fc.c, + comedi/drivers/ni_mio_common.c, comedi/drivers/ni_pcimio.c, + comedi/kcomedilib/kcomedilib_main.c, include/linux/comedi.h, + include/linux/comedi_rt.h, include/linux/comedidev.h: Added + capability to bufinfo ioctl for marking bytes written and renamed + its members. Changed prototype of RT version of + comedi_request_irq to make dev_id a comedi_device* instead of a + void* since it is assumed to be so elsewhere in rt code. Made + comedi_switch_to_rt return an int so it is able to return error + on failure. Fixes for overrun/underrun checking with dma in + ni_mio_common. + +2002-11-19 12:59 ds + + * comedi/drivers/das16.c: Change bit identification for + CIO-DAS16/330 from 0x00 to 0xf0. + +2002-11-19 11:44 fmhess + + * comedi/drivers/cb_pcidas64.c: make sure dithering is off during + ai commands + +2002-11-19 05:42 fmhess + + * comedi/drivers/cb_pcidas64.c: fixed disabling of dma when using + TRIG_WAKE_EOS + +2002-11-19 05:24 fmhess + + * comedi/drivers/cb_pcidas64.c: fixed clearing of bits in + adc_control1 register + +2002-11-18 15:45 fmhess + + * comedi/range.c: disabled checking for supported aref + +2002-11-18 15:32 ds + + * scripts/config.dist: update + +2002-11-18 15:31 ds + + * scripts/check_driver: Add test for SDF aref flags + +2002-11-18 13:49 fmhess + + * comedi/drivers/ni_labpc.c: added udelay in ai read insn while + waiting for conversion, added udelay between writing lsb and msb + of analog output (stab in the dark to get daqcard-1200 to work) + +2002-11-18 09:14 fmhess + + * comedi/drivers/ni_labpc.c: fix for external start source + +2002-11-18 09:03 fmhess + + * Contributors, comedi/range.c, comedi/drivers/ni_mio_common.c, + comedi/drivers/ni_stc.h: added checking for valid aref. 611x + calibration support. + +2002-11-15 09:33 fmhess + + * comedi/Config.in, comedi/comedi_fops.c, comedi/drivers.c, + comedi/drivers/comedi_fc.h, comedi/drivers/mite.c, + comedi/drivers/mite.h, comedi/drivers/ni_mio_common.c, + comedi/drivers/ni_pcidio.c, comedi/drivers/ni_pcimio.c, + comedi/drivers/ni_stc.h, include/linux/comedidev.h: Working dma + analog input and output with NI 611x cards, tested 6024 to make + sure we didn't break it's analog input. DMA analog output with + other boards still needs to be tested by someone. Patch is from + me, Rolf Mueller, John Hallen, Herbert Peremans, Herman + Bruyninckx. + +2002-11-08 14:15 ds + + * scripts/check_driver: new tests + +2002-11-08 14:01 ds + + * include/linux/comedidev.h: Add COMEDI_INITCLEANUP_NOMODULE() + +2002-11-08 14:00 ds + + * comedi/drivers/: ke_counter.c, ni_mio_cs.c, poc.c: Fix bugs + noticed by check_driver + +2002-11-08 13:59 ds + + * comedi/drivers/das1800.c: fix symbol leakage + +2002-11-08 13:59 ds + + * comedi/drivers/comedi_fc.h: change inline to static line, to fix + symbol leakage + +2002-11-08 13:53 ds + + * comedi/drivers/ni_daq_dio24.c: Cleanup. Remove unused functions. + +2002-11-08 13:52 ds + + * comedi/drivers/cb_pcimdda.c: Random cleanup. Remove (usused) AI + subdevice, remove lots of comments copied from the skel driver + +2002-11-08 13:50 ds + + * comedi/drivers/cb_das16_cs.c: Add fingerprinting, fix outb() + calls + +2002-11-08 13:49 ds + + * comedi/comedi_fops.c: Add debugging + +2002-11-07 19:13 ds + + * comedi/drivers/: 8255.c, adl_pci9111.c, adl_pci9118.c, + cb_pcidas64.c, das08.c, ni_at_ao.c, ni_mio_common.c: Change + insn->data[] to data[], since insn->data points to user space + +2002-11-07 11:41 ds + + * README: Instructions for anonymous CVS + +2002-11-06 11:20 ds + + * comedi/drivers/amplc_pc236.c: Move plx9052 definitions to new + header + +2002-11-06 11:18 ds + + * comedi/drivers/plx9052.h: Pull definitions for PLX-9052 from + amplc_pc236.c + +2002-11-04 22:55 ds + + * comedi/drivers/ni_pcimio.c: Add spin locking to win_out() + +2002-11-04 22:55 ds + + * comedi/drivers/ni_mio_common.c: temporarily remove spinlocks + +2002-11-04 22:54 ds + + * comedi/drivers/ni_mio_cs.c: Add specs for 6036E + +2002-11-04 22:54 ds + + * comedi/Config.in: Move NI-DAQ-DIO24 into if CONFIG_PCMCIA + +2002-11-04 22:52 ds + + * comedi/: Config.in, drivers/Makefile.in: new driver + +2002-11-04 22:52 ds + + * comedi/drivers/cb_das16_cs.c: New driver + +2002-11-04 07:54 fmhess + + * comedi/drivers/das16.c: fixed detach so it only tries to release + ioports if it has allocated them + +2002-11-03 08:33 fmhess + + * include/asm/div64.h: fix possibility of endless loop when divisor + > 0x80000000 + +2002-10-28 16:43 ds + + * comedi/drivers/: 8255.c, 8255.h: Add preliminary command support + +2002-10-26 20:30 fmhess + + * comedi/kcomedilib/kcomedilib_main.c, include/linux/comedilib.h: + changed prototype of comedi_map() to prevent bogus compiler + warnings + +2002-10-26 20:25 fmhess + + * comedi/drivers/comedi_rt_timer.c: fixed some % that were supposed + to be & + +2002-10-25 21:23 fmhess + + * comedi/rt.c: fixing shared interrupts for comedi boards when + using RT patch + +2002-10-10 17:37 fmhess + + * comedi/drivers/cb_pcidas64.c: fixed off by one error in + calculation of fifo size, fixed TRIG_WAKE_EOS with non 4020 + boards + +2002-10-09 18:19 ds + + * comedi/comedi_fops.c, comedi/drivers.c, + include/linux/comedidev.h: Fix for not calculating buffer + fullness through a counter wraparound + +2002-10-09 18:17 ds + + * comedi/drivers/ni_mio_common.c: Fix problem detecting DMA + overflows at buffer wraparound + +2002-10-08 15:35 fmhess + + * Documentation/comedi/insn_config: added brief description for + INSN_CONFIG_TIMER_1 + +2002-10-08 15:34 fmhess + + * comedi/drivers/cb_pcidas64.c: Added some more locking for + software copies of register bits that can be manipulated in + interrupt. Fixed return of -EAGAIN when external master clock + divisor is out of valid range. + +2002-10-07 21:55 fmhess + + * comedi/drivers/cb_pcidas64.c: added support for external master + clock, and commited some code reorganization that had been lying + around for a while + +2002-10-07 21:54 fmhess + + * Documentation/comedi/insn_config: added bit about + INSN_CONFIGTIMER_1 + +2002-10-07 21:53 fmhess + + * include/linux/comedi.h: added INSN_CONFIG_TIMER_1 + +2002-10-02 19:27 fmhess + + * comedi/drivers/comedi_fc.c: don't generate events when there are + none + +2002-09-30 19:47 fmhess + + * comedi/drivers/das16.c: trying to decrease time dma channel is + disabled for sake of jr cards without fifo. Also got rid of + deprecated virt_to_bus() calls. + +2002-09-30 16:48 ds + + * comedi/drivers/ni_mio_common.c: Fix 671x ao munging (again). + This time, with feeling. (Or, correct unipolar/bipolar behavior) + +2002-09-30 16:21 ds + + * comedi/drivers/: ke_counter.c, me_daq.c: Fix documentation + +2002-09-30 16:20 ds + + * comedi/drivers/ni_mio_common.c: one-liner to fix analog + triggering + +2002-09-30 16:20 ds + + * comedi/drivers/rtd520.c: Makes non-DMA mode efficient enough for + 620khz input on a 400Mhz K6-2 (uses "about" instead of "sample" + counter) + + Make DMA abort/initialization more consistent + + Makes the board initialization more closely match the RTD + supplied driver + + Be more consistent about error messages + + Detect read buffer overflow and abort transfer + + Disable DMA by default + +2002-09-24 19:31 ds + + * include/linux/comedidev.h: Add meilhaus PCI ID + +2002-09-24 19:30 ds + + * comedi/drivers/ni_daq_dio24.c: remove #ifdef CONFIG_PCMCIA, since + they're wrong (need CONFIG_PCMCIA_MODULE) and compilation is + already conditional on PCMCIA + +2002-09-24 19:24 ds + + * comedi/comedi_fops.c: fix warning + +2002-09-24 19:14 ds + + * comedi/Config.in: new drivers + +2002-09-24 19:14 ds + + * comedi/drivers/: Makefile.in, ke_counter.c, me2600_fw.h, + me_daq.c: Add new drivers from Michael Hillmann + +2002-09-24 18:56 ds + + * comedi/drivers/amplc_pc236.c: Update buffer code to CVS + +2002-09-24 18:55 ds + + * comedi/drivers/comedi_parport.c: Fix EOS event + +2002-09-24 18:55 ds + + * comedi/Config.in, comedi/drivers/Makefile.in, + scripts/config.dist: Add new amplicon drivers + +2002-09-24 18:50 ds + + * comedi/drivers/: amplc_pc236.c, amplc_pc263.c: new driver from + Ian Abbott + +2002-09-24 18:35 ds + + * TODO: Where the hell was Biggles when we needed him last + Saturday? + +2002-09-24 18:34 ds + + * scripts/Configure: change from bin/sh to bin/bash + +2002-09-24 18:33 ds + + * comedi/comedi_fops.c: Change a 4 to a COMEDI_NDEVICES. Prolong + the static allocation dumbness. + +2002-09-24 18:33 ds + + * comedi/drivers/ni_pcimio.c: update documentation list + +2002-09-24 18:31 ds + + * comedi/drivers/dt2814.c: fix stupid typo. (from someone, don't + remember whom) + +2002-09-24 12:31 ds + + * comedi/drivers/amcc_s5933.c: Add MODULE_LICENSE. + +2002-09-13 12:47 ds + + * comedi/drivers/cb_pcimdda.c: Fix Devices line + +2002-09-09 15:10 ds + + * comedi/drivers/ni_mio_cs.c: revert last checkin + +2002-09-09 14:27 ds + + * comedi/drivers/ni_mio_cs.c: test to see if 16e-4 has incorrectly + documented caldac + +2002-09-09 12:00 ds + + * comedi/drivers/ni_pcidio.c: Fix bad bus number comparison. + +2002-09-04 14:47 ds + + * comedi/comedi_fops.c: Move buffer info ioctl to new buffer code + +2002-09-04 14:44 ds + + * include/linux/comedi.h: Change unused[0] to settling_time_0 to + subdevice info structure. Not exactly sure of the specification + for it, though. + +2002-09-04 14:43 ds + + * comedi/drivers/dt282x.c: end-of-range fix in ao cmdtest, and ao + chanlist should be 2. + +2002-09-04 14:42 ds + + * comedi/drivers/comedi_rt_timer.c: add timer_open + +2002-09-04 14:41 ds + + * TODO: ack + +2002-09-04 14:41 ds + + * comedi/drivers/mite.c: remember to reserve buffer after + allocating it + +2002-08-30 15:50 ds + + * include/linux/comedidev.h: Correct fix for zero-length arrays in + gcc-3.0 + +2002-08-30 15:26 ds + + * include/linux/comedidev.h: Fix zero-length array + +2002-08-30 15:24 ds + + * comedi/drivers.c: Change default buffer size to 64kB + +2002-08-30 15:23 ds + + * comedi/drivers/ni_mio_common.c: Allocate 4*PAGE_SIZE for write + space instead of 2 pages + +2002-08-28 17:01 ds + + * comedi/drivers/: rtd520.c, rtd520.h: patch from Dan Christian. + - DMA support (experimental) - Fix timing limits to properly + handle single channel and multi channel cases - Stop using the + About counter, it really wasn't needed and caused problems - + The usual clean ups and doc improvements + +2002-08-28 16:56 ds + + * comedi/drivers/ni_mio_common.c: Patch for cleaner analog output + underrun handling from Ray Kelm + +2002-08-07 17:37 fmhess + + * comedi/drivers/mite.c: only release regions if we requested them. + +2002-08-07 10:32 fmhess + + * comedi/drivers/: ni_labpc.c, mite.c: fixed freeing of mite + resources in detach for pci-1200, re-added allocation of io mem + regions in mite.c (was removed earlier due to my wrong assumption + about the nature of the return value from request_mem_region). + +2002-07-25 19:21 fmhess + + * comedi/drivers/cb_pcidas64.c: making sure there are no races wrt + ai_cmd_running status flag + +2002-07-25 17:24 fmhess + + * comedi/drivers/comedi_fc.c: switched to use new + COMEDI_CB_OVERFLOW flag + +2002-07-25 16:46 ds + + * include/linux/comedidev.h: remove async->data_len and async->data + +2002-07-25 16:45 ds + + * comedi/: comedi_fops.c, drivers.c, drivers/adl_pci9118.c, + drivers/adv_pci1710.c, drivers/dt282x.c, drivers/ni_mio_common.c, + drivers/ni_pcidio.c, drivers/pcl812.c, + kcomedilib/kcomedilib_main.c: Remove async->data_len globally + +2002-07-25 16:33 ds + + * comedi/comedi_fops.c: Stop running on error conditions. + +2002-07-25 16:32 ds + + * include/linux/comedi.h: Deprecate a few things, add + COMEDI_CB_OVERFLOW + +2002-07-25 16:31 ds + + * comedi/drivers/ni_mio_common.c: Update DMA code for recent buffer + changes + +2002-07-25 16:31 ds + + * comedi/drivers/dt282x.c: Migrated COMEDI_CB_ERROR to OVERFLOW + where necessary + +2002-07-25 13:27 ds + + * comedi/drivers/ni_pcimio.c: Fixed n_aochan for 6110 + +2002-07-25 13:07 ds + + * comedi/drivers/: 8255.c, daqboard2000.c, ii_pci20kc.c, + ni_pcidio.c, pcl816.c, pcl818.c: Remove SDF_RT + +2002-07-25 12:57 ds + + * comedi/comedi_ksyms.c, include/linux/comedidev.h: remove + comedi_buf_copy_from + +2002-07-25 12:57 ds + + * comedi/drivers/dt282x.c: remove usage of comedi_buf_copy_from() + +2002-07-25 12:45 ds + + * comedi/drivers.c: remove dead code + +2002-07-25 12:37 ds + + * include/linux/comedidev.h: Add comedi_debug symbol and make + DPRINTK() conditional on it. + +2002-07-25 12:36 ds + + * comedi/drivers/comedi_fc.c: Fix spelling error + +2002-07-25 12:36 ds + + * comedi/: comedi_fops.c, comedi_ksyms.c: Add comedi_debug symbol. + +2002-07-23 17:59 ds + + * comedi/drivers/ni_mio_common.c: Add 611x-specific changes for + STC/board configuration + +2002-07-23 17:23 ds + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: Change "mystery + numbers" to defines in ni_stc.h + +2002-07-19 13:09 fmhess + + * comedi/drivers/comedi_fc.c: export cfc_handle_events + +2002-07-19 12:41 fmhess + + * comedi/drivers/cb_pcidas64.c: fixed initialization of external + trigger sources for pcidas-4020, reduced use of preprocessor, + started to split some functions out of large ai_cmd() function + +2002-07-17 14:55 fmhess + + * comedi/drivers/: comedi_fc.c, comedi_fc.h: added error handling + for failed writes to buffer + +2002-07-17 14:18 fmhess + + * comedi/drivers/das16.c: cleaning up logic for dealing with 8 bit + dma transfers that get interrupted halfway through a sample + +2002-07-17 12:10 fmhess + + * comedi/drivers.c: replaced prealloc_bufsz with data_len so + functions can be used with user-specified buffers + +2002-07-17 11:53 fmhess + + * comedi/drivers/comedi_test.c: don't let people run at RT priority + +2002-07-16 17:45 fmhess + + * comedi/rt.c: trying to fix problems people are having with + commands working fine, then failing when interrupt is set to RT + priority. + +2002-07-15 14:06 ds + + * comedi/drivers/Makefile.in: Fix conditional for ni_670x driver + +2002-07-15 13:59 ds + + * comedi/drivers/adv_pci1710.c: Patch from + Christian.Werner@t-online.de (Christian Werner) to add + scan_begin_src=TRIG_EXT support. + +2002-07-14 15:44 fmhess + + * comedi/drivers/cb_pcidas64.c: fixed ambiguity in return value of + dma_transfer_size() query + +2002-07-14 15:33 fmhess + + * comedi/Config.in, comedi/comedi_fops.c, comedi/comedi_ksyms.c, + comedi/drivers.c, comedi/drivers/Makefile.in, + comedi/drivers/cb_pcidas.c, comedi/drivers/cb_pcidas64.c, + comedi/drivers/comedi_fc.c, comedi/drivers/comedi_fc.h, + comedi/drivers/comedi_rt_timer.c, comedi/drivers/comedi_test.c, + comedi/drivers/das16.c, comedi/drivers/das16m1.c, + comedi/drivers/das1800.c, comedi/drivers/das800.c, + comedi/drivers/ni_at_a2150.c, comedi/drivers/ni_labpc.c, + comedi/kcomedilib/kcomedilib_main.c, include/linux/comedidev.h: + fixing end of scan events in some drivers + +2002-07-08 20:35 ds + + * comedi/: comedi_fops.c, comedi_ksyms.c, drivers/ni_mio_common.c: + More buffer fixes. AI and AO work now. + +2002-07-08 19:58 ds + + * comedi/drivers.c, comedi/drivers/cb_pcidas.c, + comedi/drivers/das16m1.c, comedi/drivers/dt282x.c, + comedi/drivers/ni_labpc.c, include/linux/comedidev.h: Fixes for + more buffer changes + +2002-07-08 18:58 ds + + * comedi/drivers/rtd520.c: clean up warning + +2002-07-08 17:31 ds + + * comedi/comedi_fops.c, comedi/comedi_ksyms.c, comedi/drivers.c, + comedi/drivers/adl_pci9118.c, comedi/drivers/ni_mio_common.c, + comedi/kcomedilib/kcomedilib_main.c, include/linux/comedidev.h: + Move buffer inlines to comedi/drivers.c. Rewrite as consistent + primitives. Change buf_dirty_count to buf_free_count. + +2002-07-08 17:27 ds + + * TODO: moo + +2002-07-08 17:25 ds + + * comedi/drivers/comedi_rt_timer.c: Remove timer_poll. + +2002-07-08 17:15 fmhess + + * comedi/kcomedilib/kcomedilib_main.c: moved inc/dec of use count + from comedi_lock/unlock() to comedi_open/close(). Added a + comedi_switch_to_non_rt() in comedi_cancel() + +2002-07-08 17:15 ds + + * comedi/drivers/rtd520.c: fix warnings + +2002-07-08 16:59 ds + + * comedi/rt.c: Remove bogus warning + +2002-07-08 14:50 ds + + * TODO: none + +2002-07-08 14:33 ds + + * TODO: test + +2002-07-06 22:54 fmhess + + * comedi/drivers/: mite.c, mite.h, ni_mio_common.c: fix integer + overflow with mite_bytes_transferred() + +2002-07-06 21:52 fmhess + + * comedi/drivers/cb_pcidas.c: got rid of useless attempt to avoid + handling spurious interrupt during attach + +2002-07-05 16:01 fmhess + + * comedi/comedi_fops.c, comedi/drivers/adl_pci9118.c, + comedi/drivers/comedi_parport.c, comedi/drivers/das16m1.c, + comedi/drivers/das1800.c, comedi/drivers/das6402.c, + comedi/drivers/dt282x.c, comedi/drivers/ni_mio_common.c, + comedi/drivers/ni_pcidio.c, comedi/drivers/pcl812.c, + comedi/drivers/pcl816.c, comedi/drivers/rtd520.c, + comedi/kcomedilib/get.c, comedi/kcomedilib/kcomedilib_main.c, + include/linux/comedidev.h: First pass at revised buffer system, + hopefully didn't create too many new bugs. Tested analog input + command with comedi_test module, haven't tried analog output. + +2002-07-05 15:23 fmhess + + * comedi/drivers/pcl818.c: converted to use comedi_buf_put() + +2002-07-05 15:16 fmhess + + * comedi/drivers/pcl816.c: converted to use comedi_buf_put() + +2002-07-05 15:08 fmhess + + * comedi/drivers/pcl812.c: converted to comedi_buf_put() and got + rid of bogus range switching in interrupt + +2002-07-05 15:00 fmhess + + * comedi/drivers/ni_atmio16d.c: converted to use comedi_buf_put() + +2002-07-05 14:20 fmhess + + * comedi/drivers/ni_mio_common.c: partial conversion to + comedi_buf_put/get() + +2002-07-05 13:10 fmhess + + * comedi/drivers/das6402.c: converted to use comedi_buf_put() + +2002-07-05 12:52 fmhess + + * comedi/drivers/adv_pci1710.c: converted to use comedi_buf_put() + +2002-07-05 11:55 ds + + * comedi/drivers/cb_pcimdda.c: Update from Calin + +2002-07-05 11:51 ds + + * include/linux/comedi.h: Revert last check in + +2002-07-05 11:45 ds + + * comedi/drivers/comedi_rt_timer.c: Fix for unresolved symbols with + RTLinux + +2002-07-05 11:23 ds + + * comedi/drivers/ni_mio_common.c: Fix munging on 671x boards + +2002-07-04 17:35 fmhess + + * comedi/drivers/cb_pcidas64.c: dealt with possible race in using + plx dma control/status register + +2002-07-03 14:48 ds + + * comedi/drivers/rtd520.c: New patch from Dan + +2002-07-03 13:40 ds + + * include/linux/comedi.h: disable unapproved defines + +2002-07-03 13:37 ds + + * comedi/: Config.in, drivers/Makefile.in: new driver + +2002-07-02 10:53 ds + + * comedi/drivers/rtd520.c: Patch from Dan. Adds a munging list, + polling. + +2002-06-30 21:01 fmhess + + * Documentation/comedi/insn_config, comedi/comedi_fops.c, + comedi/drivers/cb_pcidas64.c, include/linux/comedi.h, + include/linux/comedidev.h: Added support in cb_pcidas64 driver + for user adjusting size of board's hardware fifo (added config + insn for adjusting the desired block size for asynchronous + transfers ) + +2002-06-27 09:12 ds + + * comedi/drivers/cb_pcimdda.c: Driver from "Calin A. Culianu" + + +2002-06-24 17:40 fmhess + + * comedi/drivers/cb_pcidas64.c: disabled hw scan counter until I + work out a race with dma transfer + +2002-06-23 16:27 fmhess + + * comedi/drivers/cb_pcidas.c: fixed length of bitstream for ad8402 + trimpot + +2002-06-23 16:19 fmhess + + * comedi/drivers/: cb_pcidas.c, cb_pcidas64.c: add calibration + support for 1602/16 series + +2002-06-22 13:06 fmhess + + * comedi/drivers/cb_pcidas64.c: make sure bogus interrupts during + ai insn don't cause problems + +2002-06-22 12:32 fmhess + + * comedi/drivers/cb_pcidas64.c: run ai_cancel() when aquisition is + stopped by hardware counter + +2002-06-22 12:13 fmhess + + * comedi/drivers/cb_pcidas64.c: be more careful to avoid lockups + that surfaced after adding hardware scan counter support + +2002-06-21 13:01 ds + + * comedi/kvmem.h: fix for suse brokenness + +2002-06-20 11:36 ds + + * comedi/drivers/ni_atmio.c: Fix ao specs for at-mio-16xe-10 + +2002-06-17 16:20 fmhess + + * comedi/drivers/cb_pcidas.c: enabled trimpot subdevice + +2002-06-17 16:14 fmhess + + * comedi/drivers/cb_pcidas.c: converted to use amccs5933 header, + and added eeprom/caldac/trimpot subdevices + +2002-06-17 08:47 fmhess + + * comedi/drivers/amcc_s5933.h: some additions so cb_pcidas driver + can use this header + +2002-06-17 08:47 fmhess + + * comedi/drivers/amcc_s5933.c: bitwise and should be logical and + +2002-06-17 08:46 fmhess + + * include/linux/comedidev.h: make comedi_buf_put automatically + signal block events + +2002-06-17 08:45 fmhess + + * comedi/comedi_fops.c: prevent callbacks from getting run when + there is no command running + +2002-06-17 08:43 fmhess + + * comedi/drivers/cb_pcidas64.c: added support for hardware scan + counter + +2002-06-13 15:12 ds + + * comedi/drivers/comedi_parport.c: Change subdevice 0 to DIO. + +2002-06-07 14:07 ds + + * scripts/release: remove -v option to tar + +2002-06-07 14:01 ds + + * Makefile: version bump + +2002-06-07 14:01 ds + + * Changelog: 0.7.65 + +2002-06-07 13:22 ds + + * comedi/drivers/: amplc_pci230.c, contec_pci_dio.c, fl512.c, + ni_at_ao.c, pcm3730.c, rtd520.c, serial2002.c, ssv_dnp.c: + Cleanups suggested by check_driver. + +2002-06-07 13:15 ds + + * scripts/check_driver: Changed recently added test to warning + +2002-06-07 13:14 ds + + * comedi/drivers/serial2002.c: Added documentation block + +2002-06-07 13:14 ds + + * comedi/drivers/icp_multi.c: Added Description tag + +2002-06-07 13:14 ds + + * comedi/drivers/contec_pci_dio.c: Fix driver structure, + documentation + +2002-06-07 13:13 ds + + * comedi/drivers/8255.c: Added documentation + +2002-06-07 13:12 ds + + * TODO: [no log message] + +2002-06-07 12:55 ds + + * comedi/drivers/ni_atmio.c: Revert 16xe-50 caldacs to manual. + Change *-xe-10 to manual. + +2002-06-07 12:53 ds + + * comedi/drivers/: contec_pci_dio.c, mite.c: clean up warnings + +2002-06-06 17:03 ds + + * comedi/drivers/ni_pcimio.c: Change some caldacs to debug + +2002-06-06 17:02 ds + + * comedi/drivers/ni_mio_common.c: Ignore more MITE errors, and + don't call disable_irq() when something goes wrong. It's not + nice to our neighbors. + +2002-06-06 17:01 ds + + * comedi/drivers/ni_atmio.c: Change 16xe-50 caldacs to debug. + Change max caldacs to 32. + +2002-06-06 17:01 ds + + * comedi/drivers/dt282x.c: Only advertise TRIG_NONE as a stop + source, since that's what we support. + +2002-06-06 17:00 ds + + * comedi/drivers/comedi_parport.c: Fix: make sure to flag a EOS + event in interrupts + +2002-06-06 16:56 ds + + * TODO: [no log message] + +2002-06-02 17:04 fmhess + + * comedi/drivers/cb_pcidas64.c: fixed analog output insn for 4020 + +2002-06-01 18:27 fmhess + + * comedi/drivers/cb_pcidas64.c: added pcidas-6023 support + +2002-06-01 17:48 fmhess + + * include/linux/comedilib.h: COMEDI_CB_* flags are already defined + in linux/comedi.h + +2002-06-01 16:03 fmhess + + * comedi/drivers/cb_pcidas64.c: added check in command test for + peculiar restrictions on pcidas-4020 chanlists + +2002-05-29 13:11 ds + + * comedi/comedi_fops.c: Make default mode for /dev/comediN 666 in + devfs. + +2002-05-28 21:28 ds + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: Fixed AI_START + trigger for PFI inputs + +2002-05-28 17:17 fmhess + + * comedi/drivers/cb_pcidas64.c, include/linux/comedi.h: made + cb_pcidas64 external trigger configuration consistent + +2002-05-20 11:38 ds + + * comedi/drivers/serial2002.c: new driver from Anders + +2002-05-17 14:14 ds + + * comedi/drivers/ni_mio_common.c: Add ni_ao_reset() + +2002-05-17 13:27 ds + + * TODO: [no log message] + +2002-05-17 13:26 ds + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: Mostly revert + CR_ALT_SOURCE changes and do it differently. + +2002-05-16 19:23 ds + + * include/linux/comedi.h: Make CR_PACK less strict. Useful for + comedilib. + +2002-05-16 18:51 fmhess + + * INSTALL, include/linux/comedidev.h: twiddling some documentation + +2002-05-16 18:44 fmhess + + * comedi/drivers/comedi_rt_timer.c: fixed rtai operation by adding + start_rt_timer() and stop_rt_timer() + +2002-05-16 17:00 fmhess + + * comedi/comedi_fops.c: undid some of my wrong changes to try and + get analog out working again + +2002-05-16 15:37 ds + + * comedi/comedi_fops.c: Change inttrig error handling. Fix + spelling errors. + +2002-05-16 15:19 ds + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: Change calibration + channel configuration to CR_ALT_SOURCE. Add start_src=TRIG_INT + to analog input. Remove (non-working) stop_src= TRIG_COUNT from + analog output. Fix spelling of SDF_WRITABLE. + +2002-05-16 15:16 ds + + * comedi/drivers/mite.c: Remove release_mem_region() + +2002-05-16 15:16 ds + + * comedi/drivers/8255.c: Update documentation + +2002-05-16 15:15 ds + + * comedi/comedi_fops.c: Remove dead code + +2002-05-16 15:14 ds + + * TODO: [no log message] + +2002-05-16 15:13 ds + + * comedi/: drivers.c, drivers/8255.c, drivers/adl_pci9111.c, + drivers/adl_pci9118.c, drivers/adv_pci1710.c, + drivers/amplc_pci230.c, drivers/cb_pcidas.c, + drivers/cb_pcidas64.c, drivers/cb_pcidda.c, + drivers/comedi_parport.c, drivers/contec_pci_dio.c, + drivers/daqboard2000.c, drivers/das08.c, drivers/das16.c, + drivers/das16m1.c, drivers/das1800.c, drivers/das800.c, + drivers/dt2801.c, drivers/dt2811.c, drivers/dt2815.c, + drivers/dt2817.c, drivers/dt282x.c, drivers/dt3000.c, + drivers/fl512.c, drivers/icp_multi.c, drivers/ii_pci20kc.c, + drivers/mpc8260cpm.c, drivers/multiq3.c, drivers/ni_670x.c, + drivers/ni_at_ao.c, drivers/ni_atmio16d.c, drivers/ni_labpc.c, + drivers/ni_pcidio.c, drivers/pcl711.c, drivers/pcl725.c, + drivers/pcl726.c, drivers/pcl812.c, drivers/pcl816.c, + drivers/pcl818.c, drivers/pcm3730.c, drivers/poc.c, + drivers/rtd520.c, drivers/rti800.c, drivers/rti802.c, + drivers/skel.c, drivers/ssv_dnp.c: Globally fix spelling of + SDF_WRITABLE + +2002-05-16 15:10 ds + + * comedi/comedi_fops.c, comedi/comedi_ksyms.c, + comedi/kcomedilib/kcomedilib_main.c, include/linux/comedidev.h: + Change pseudo-locking to spin locks. + +2002-05-16 14:41 ds + + * comedi/kcomedilib/ksyms.c: Remove export of comedi_errno. + +2002-05-16 14:40 ds + + * comedi/kcomedilib/ksyms.c: Put #ifdef around symbols that are + conditionally defined + +2002-05-16 09:09 fmhess + + * comedi/comedi_fops.c: fixed a bug I made + +2002-05-15 17:48 ds + + * include/linux/comedi.h: Fix long-standing spelling error of + writable + +2002-05-15 12:33 ds + + * comedi/drivers/ni_mio_common.c: Add PFI subdevice + +2002-05-15 12:08 ds + + * comedi/comedi_fops.c, include/linux/comedidev.h: Added open/close + hooks to device structure + +2002-05-15 12:06 ds + + * comedi/drivers/mite.c: Don't need request_mem_region(). I think. + +2002-05-12 21:07 fmhess + + * comedi/drivers/cb_pcidas64.c: 6402 and 6025 attach opposite + meanings to single-ended/differential bit + +2002-05-12 19:35 fmhess + + * comedi/drivers/cb_pcidas64.c: fixing config insn + +2002-05-11 20:08 fmhess + + * comedi/drivers/cb_pcidas64.c: corrected return values of config + insn + +2002-05-11 17:32 fmhess + + * Makefile.modbuild: added -e option to depmod, to promote more + useful error reports on 'make install' + +2002-05-11 17:26 fmhess + + * scripts/config.dist: added contec driver + +2002-05-10 23:20 ds + + * comedi/drivers/ni_pcimio.c: Comments about possible problems on + 6040e + +2002-05-10 23:20 ds + + * comedi/drivers/ni_atmio.c: Update documentation + +2002-05-10 11:10 ds + + * Makefile: version bump + +2002-05-10 11:09 ds + + * comedi/drivers/ni_atmio.c: Don't use debugging caldac. + +2002-05-07 16:24 fmhess + + * Documentation/comedi/insn_config, comedi/drivers/cb_pcidas64.c, + include/linux/comedi.h: added config insn for choosing rising or + falling edge trigger + +2002-05-07 15:58 fmhess + + * include/linux/comedi.h: sync with comedilib + +2002-05-07 11:16 fmhess + + * scripts/dep.linux: got rid of redirection to /dev/null since a + lot of people have been hitting errors silently at this point + +2002-05-03 10:27 fmhess + + * include/linux/devfs_fs_kernel.h: fix for broken compatibility + headers in 2.2.18 through 2.2.20, got rid of devfs_get_handle() + which was apparently a typo + +2002-05-03 09:27 fmhess + + * include/linux/devfs_fs_kernel.h: devfs support introduced in + 2.2.18 + +2002-05-03 09:23 fmhess + + * include/linux/devfs_fs_kernel.h: added devfs_find_handle() + +2002-05-03 09:13 fmhess + + * include/: asm/page.h, linux/pci.h, linux/vmalloc.h: fixed + compilation against 2.2.0 kernel + +2002-05-02 20:20 fmhess + + * include/linux/pci.h: might as well make pci_request_regions + allocate 1 ioport so it's not a complete waste + +2002-05-02 20:11 fmhess + + * include/linux/pci.h: fixed pci_resource_len for pre 2.2.18 + kernels, I didn't realize it was just a dummy function even for + later 2.2 kernels. Make pci_request_regions compatibility stuff + pretty useless. + +2002-05-02 19:58 fmhess + + * include/linux/pci.h: put typedef of dma_addr_t in asm/types.h and + restricted it to pre 2.2.18 kernels + +2002-05-02 19:52 fmhess + + * include/linux/pci.h: added pci_set_master() compatibility + +2002-05-02 19:27 fmhess + + * include/asm/types.h: added typedef of dma_addr_t for earlier 2.2 + kernels + +2002-05-02 16:10 ds + + * include/linux/: devfs_fs_kernel.h, module.h, pci.h: Improved + compatibility for 2.2.14. May break other 2.2.x kernels. + +2002-05-02 12:01 ds + + * include/linux/devfs_fs_kernel.h: Added compat header for devfs on + 2.2. kernels + +2002-05-02 12:00 ds + + * comedi/comedi_fops.c: Added devfs support + +2002-05-02 09:01 fmhess + + * comedi/comedi_fops.c: fixing races + +2002-04-30 14:12 ds + + * comedi/drivers/comedi_parport.c: Fixed references to 0.5-like + channels in documentation. + +2002-04-29 13:16 fmhess + + * include/linux/comedidev.h: added comments describing scheme for + reading/writing to comedi's buffer that should be race-free and + reliably detect overruns. + +2002-04-26 11:35 ds + + * TODO: [no log message] + +2002-04-26 11:35 ds + + * comedi/Config.in: Add Contec PCI DIO + +2002-04-26 11:34 ds + + * comedi/drivers/Makefile.in: Add contec_pci_dio.o + +2002-04-26 11:34 ds + + * comedi/drivers/contec_pci_dio.c: Initial cleanup for driver. + +2002-04-26 11:34 ds + + * comedi/drivers/contec_pci_dio.c: New driver from + + +2002-04-26 11:30 ds + + * comedi/drivers/comedi_rt_timer.c: Change from int to comedi_t * + +2002-04-26 11:28 ds + + * comedi/drivers/pcl816.c: Moved comments to documentation area. + Fixed initialization problem for local variable. + +2002-04-26 11:26 ds + + * include/linux/comedilib.h: Add a few more prototypes + +2002-04-26 11:26 ds + + * include/linux/comedidev.h: Add PCI_VENDOR_ID_CONTEC + +2002-04-26 11:25 ds + + * comedi/kcomedilib/Makefile.in: Add get.o to link + +2002-04-26 11:24 ds + + * comedi/kcomedilib/: data.c, dio.c, get.c, kcomedilib_main.c: + Globally change int to comedi_t *. Split out _get functions from + kcomedilib_main.c. Use spinlock instead of stupid, buggy + comedi_lock_semaphore. + +2002-04-25 14:52 ds + + * include/linux/comedilib.h: Changed to use comedi_t * instead of + int for device token + +2002-04-25 14:51 ds + + * comedi/kcomedilib/ksyms.c: Random reordering. This needs to be + cleaned up somehow. + +2002-04-25 14:50 ds + + * comedi/kcomedilib/kcomedilib_main.c: Added logging and error + functions. + +2002-04-25 12:22 fmhess + + * comedi/drivers/rti800.c: removed settling delay from ai read insn + +2002-04-25 10:27 fmhess + + * comedi/drivers/: ni_at_a2150.c, ni_labpc.c, pcl711.c, pcl816.c, + pcl818.c: stripped out some settle delays in analog input read + insn, as per official policy + +2002-04-23 08:08 fmhess + + * comedi/drivers/mite.c: minor changes to get rid of 'statement + with no effect' compiler warnings on 2.2 kernel + +2002-04-23 08:07 fmhess + + * include/linux/pci.h: added pci_disable_device() + +2002-04-21 21:04 ds + + * comedi/drivers/ni_pcidio.c: Added PCI-6534 + +2002-04-21 17:12 fmhess + + * comedi/drivers/cb_pcidas64.c: analog output waveform operations + shouldn't be enabled in insn + +2002-04-21 14:36 fmhess + + * comedi/drivers/cb_pcidas64.c: bugfixes, added support for ad8402 + calibration pots on 64xx series. pci-das6402/16 seems to work + okay now, although I still experience occasional lockups from + faulty interrupt handling. + +2002-04-19 14:24 fmhess + + * comedi/drivers/cb_pcidas64.c: Trying to calm down interrupt-happy + chips, plus a little cleanup + +2002-04-19 13:29 fmhess + + * comedi/drivers/cb_pcidas64.c: fixed setting of input range on + 4020 commands, slight speed up for i2c + +2002-04-19 10:46 fmhess + + * comedi/drivers/das16.c: trying to clarify interrupt logic a + little + +2002-04-18 23:24 fmhess + + * comedi/drivers/cb_pcidas64.c: added delay that seems to fix + unreliable dma abort. Fixed selection of bnc inputs for adc + converts on 4020. + +2002-04-18 16:12 fmhess + + * comedi/drivers/das16.c: fixing some bugs with Roman's help + +2002-04-17 16:46 fmhess + + * comedi/drivers/cb_pcidas64.c: fixed setting of input range and + reading of internal calibration sources for pci-das4020 insn. + +2002-04-17 14:40 fmhess + + * comedi/drivers/das16.c: additions from Roman Fietze + with additional modifications by me. Now + supports irq-less dma transfers with timer interrupt added to + work around Roman's broken dma controller. + +2002-04-17 09:13 fmhess + + * comedi/drivers/das16.c: added note about keithley 1400 series id + bits + +2002-04-16 21:23 fmhess + + * comedi/drivers/cb_pcidas64.c: a tiny bit of cleanup, initial + tests with pcidas-6040/16 look okay + +2002-04-16 21:02 fmhess + + * comedi/drivers/plx9080.h: oops forgot to update header, fixes + compile of cb_pcidas64.c + +2002-04-15 17:27 fmhess + + * comedi/drivers/cb_pcidas64.c: i2c stuff works for 4020 now, + albiet extremely slowly (1000 bits/sec!) + +2002-04-14 08:46 fmhess + + * comedi/comedi_fops.c: calculate max number of bytes that can be + read or written by using buf_int_ptr and buf_user_ptr to avoid + any possible race with comedi_buf_put*(). + +2002-04-13 19:43 fmhess + + * include/linux/comedidev.h: moved increment of buf_int_count to + beginning of comedi_buf_put*() to eliminate race with buffer + overrun check. Added setting of COMEDI_CB_BLOCK to + comedi_buf_put() so it doesn't need to be set in drivers + +2002-04-13 08:49 fmhess + + * comedi/drivers/cb_pcidas.c, comedi/drivers/cb_pcidas64.c, + comedi/drivers/das16.c, comedi/drivers/das16m1.c, + comedi/drivers/ni_at_a2150.c, comedi/drivers/ni_labpc.c, + include/linux/comedidev.h: converted some drivers to use + comedi_buf_put_array + +2002-04-07 19:23 fmhess + + * comedi/drivers/: cb_pcidas64.c, plx9080.h: more calibration + support for 64xx and 4020 boards, and got rid of useless i2o reg + definitions in plx9080.h + +2002-04-07 19:09 fmhess + + * comedi/drivers/das16.c: fixes to make interrupt handling more + robust + +2002-04-07 18:30 fmhess + + * include/linux/comedidev.h: added comedi_buf_put_array() writes + array to buffer + +2002-04-05 19:15 fmhess + + * comedi/drivers/cb_pcidas64.c: fixed 6xxx boards to work with dma + ch1, for compatibility with 4020 + +2002-04-04 17:12 fmhess + + * comedi/drivers/cb_pcidas64.c: fixed single-channel command + +2002-04-04 17:06 fmhess + + * comedi/drivers/cb_pcidas64.c: fixed count of number of conversion + completed using pio + +2002-04-04 17:02 fmhess + + * comedi/drivers/cb_pcidas64.c: deal with grey coding of read and + write fifo pointers on 4020 + +2002-04-04 16:05 fmhess + + * comedi/drivers/cb_pcidas64.c: pio and dma fixes for 4020 + +2002-04-04 12:20 fmhess + + * comedi/drivers/plx9080.h: more registers + +2002-04-04 11:46 fmhess + + * comedi/drivers/cb_pcidas64.c: trying dma channel 1 for 4020, + still trying to debug pio transfer + +2002-04-03 21:03 fmhess + + * comedi/drivers/cb_pcidas64.c: fixed pio fifo drain for 4020 + +2002-04-03 15:31 fmhess + + * comedi/drivers/cb_pcidas64.c: temporary band-aid for 4020 pio + transfer + +2002-04-03 14:59 fmhess + + * comedi/drivers/cb_pcidas.c: last change didn't work out too well, + reverting parts of it + +2002-04-03 14:03 fmhess + + * comedi/drivers/cb_pcidas64.c: added some debug messages to pio + fifo drain + +2002-04-03 09:06 fmhess + + * comedi/drivers/cb_pcidas64.c: I think we found the correct fifo + register for 4020 now + +2002-04-03 09:03 fmhess + + * TODO: removed finished item + +2002-04-02 23:32 ds + + * comedi/drivers/ni_mio_common.c: Clean up compiler warning. + +2002-04-02 23:27 ds + + * comedi/Config.in, comedi/drivers/Makefile.in, + scripts/config.dist: Add pcl816 driver + +2002-04-02 23:27 ds + + * TODO: [no log message] + +2002-04-02 23:26 ds + + * Changelog: update for 0.7.64 + +2002-04-02 23:25 ds + + * patches/patch-rtai: Pointless, misleading drivel + +2002-04-02 23:24 ds + + * patches/patch-scxi-0.7.63: Update of patch-scxi + +2002-04-02 23:22 ds + + * comedi/drivers/pcl816.c: Clean up check_driver complaints + +2002-04-02 23:12 ds + + * comedi/drivers/pcl816.c: From Juan Grigera + +2002-04-02 23:10 ds + + * scripts/check_driver: Add more documentation checking + +2002-04-02 21:25 fmhess + + * comedi/drivers/cb_pcidas64.c: testing alternate fifo offset + +2002-04-02 21:07 fmhess + + * comedi/drivers/cb_pcidas64.c: fixed cmdtest for 4020 and eeprom + subdevice + +2002-04-02 17:32 fmhess + + * comedi/drivers/cb_pcidas64.c: 4020 fixes + +2002-04-02 15:44 fmhess + + * comedi/drivers/cb_pcidas64.c: trying to debug location of fifo on + 4020 + +2002-04-02 14:49 fmhess + + * comedi/drivers/cb_pcidas64.c: added eeprom subdevice, some fixes + for 4020 although it still has some bugs + +2002-04-01 07:38 fmhess + + * comedi/drivers/cb_pcidas64.c: added check to make sure interrupt + handler doesn't get behind while reading dma buffers + +2002-03-31 15:32 fmhess + + * comedi/drivers/cb_pcidas64.c: added support for additional 8 dio + channels on 60xx series, plus various bugfixes + +2002-03-30 20:18 fmhess + + * comedi/drivers/: das08.c, ni_labpc.c: enabled pcmcia code for + kernels with modular pcmcia support + +2002-03-30 12:30 fmhess + + * Documentation/comedi/insn_config: added note on new config insn + +2002-03-30 12:29 fmhess + + * include/linux/comedi.h: Added INSN_CONFIG_ALT_SOURCE id + +2002-03-30 12:28 fmhess + + * comedi/drivers/cb_pcidas64.c: added support for reading internal + calibration reference through CR_ALT_SOURCE and insn_config + +2002-03-29 14:49 fmhess + + * comedi/comedi_fops.c: removed some ineffectual locking I put in a + long time ago when I was young and naive. + +2002-03-28 09:00 fmhess + + * TODO: added a bug description + +2002-03-27 22:32 ds + + * include/linux/comedi.h: Added CR_ALT_SOURCE + +2002-03-27 21:26 fmhess + + * comedi/drivers/ni_labpc.c: disabled shared interrupt for + daqcard-1200 + +2002-03-26 08:34 fmhess + + * comedi/drivers/plx9080.h: corrected some 9060->9080 differences + +2002-03-24 12:39 fmhess + + * comedi/drivers/cb_pcidas64.c: bugfixes for 6025, beginning to + work on calibration support + +2002-03-22 16:43 fmhess + + * comedi/drivers/cb_pcidas.c: trying to make sure the interrupt + handler doesn't have any races with the hardware + +2002-03-22 16:42 fmhess + + * comedi/drivers/plx9080.h: oops forgot to update this header to + accomodate recent changes in cb_pcidas64 + +2002-03-21 20:35 fmhess + + * comedi/drivers/cb_pcidas64.c: some fixes for 64xx boards and + 4020, got TRIG_WAKE_EOS working on 60xx series + +2002-03-20 13:28 ds + + * comedi/drivers/ni_mio_common.c: Fix ni_load_channelgain_list() + for 611x. + +2002-03-20 12:29 ds + + * comedi/drivers/ni_mio_common.c: Change position of ai_reset when + handling an error. + +2002-03-20 12:00 ds + + * comedi/drivers/ni_mio_common.c: Rewrote fifo_dregs for 611x + boards + +2002-03-20 11:57 ds + + * comedi/drivers/ni_pcimio.c: Remove 6115, since it probably can't + be supported easily. + +2002-03-19 12:27 ds + + * comedi/drivers/ni_pcimio.c: Added pci-6115 and pxi-6115. Renamed + 6110e and 6111e to remove e. + +2002-03-19 12:17 ds + + * comedi/drivers/ni_mio_common.c: Fix problem with sample offsets + introduced in one of the last few check-ins. + +2002-03-18 16:00 ds + + * comedi/drivers/skel.c: more of the same + +2002-03-18 15:47 ds + + * comedi/drivers/skel.c: Added info about the documentation comment + block + +2002-03-18 13:14 ds + + * comedi/drivers/ni_pcimio.c: (Log message for last check-in). + Changes 602x boards to ad8804 caldacs + +2002-03-18 13:12 ds + + * comedi/drivers/: adl_pci9118.c, ni_pcimio.c: [no log message] + +2002-03-17 14:28 ds + + * comedi/drivers/: adl_pci9118.c, adv_pci1710.c, amcc_s5933.c, + amcc_s5933.h: Update from Michal. Prototype of function changed + in amcc_s5933 driver. + +2002-03-17 14:18 ds + + * Documentation/Configure.help.append: Update from Configure.help. + (Why do we need 2 identical files?) + +2002-03-17 14:17 ds + + * Documentation/: Configure.help, Configure.help.append: Fix help + entries for ADL_PCI9118 + +2002-03-17 14:08 ds + + * comedi/drivers/: adl_pci9111.c, cb_pcidas.c, cb_pcidas64.c, + cb_pcidda.c, comedi_test.c, das6402.c, dt3000.c, mpc8260cpm.c, + ni_670x.c, ni_labpc.c, ni_pcidio.c, pcl726.c, pcl818.c, poc.c, + rti802.c: Documentation updates + +2002-03-17 14:03 ds + + * comedi/drivers/: icp_multi.c, icp_multi.h: Fixed symbol leakage. + Updated documentation. + +2002-03-17 14:02 ds + + * comedi/drivers/ni_stc.h: Cleaned up 611x definitions + +2002-03-17 14:01 ds + + * comedi/drivers/: ni_atmio.c, ni_mio_common.c, ni_mio_cs.c, + ni_pcimio.c: More work on 611x support. Documentation updates. + +2002-03-17 13:59 ds + + * TODO: [no log message] + +2002-03-16 20:13 fmhess + + * comedi/drivers/: cb_pcidas64.c, plx9080.h: got dma transfers + working for pci-das6025 + +2002-03-16 16:57 ds + + * comedi/drivers/ni_mio_common.c: clean up compiler warnings + +2002-03-16 16:48 ds + + * comedi/drivers/ni_mio_common.c: rewrote much of the PCI DMA code. + Needs to be cleaned up. + +2002-03-16 16:47 ds + + * comedi/drivers/ni_pcimio.c: Turn off debugging + +2002-03-16 16:47 ds + + * comedi/drivers/ni_pcidio.c: Fix problems when mite debugging is + turned off + +2002-03-16 16:39 ds + + * comedi/drivers/mite.h: Turn debugging off + +2002-03-16 16:38 ds + + * comedi/drivers/mite.c: Add ability to chose between kmalloc'd and + vmalloc'd buffers. Default is vmalloc. Added resetting code in + mite_setup(). + +2002-03-16 16:36 ds + + * comedi/comedi_fops.c: Change board-level error to EPIPE. Random, + but it makes some sort of sense. Comedi buffer overflow remains + at EIO. + +2002-03-10 15:07 fmhess + + * comedi/drivers/cb_pcidas64.c: analog input insn and cmd seem to + work now (pio transfers for cmd). + +2002-03-10 12:34 ds + + * comedi/drivers/ni_mio_common.c: Add check for uncleared + interrupts, enabled only when debugging. + +2002-03-10 12:29 ds + + * comedi/drivers/ni_stc.h: Change the bitfields to unsigned int. + +2002-03-10 12:28 ds + + * comedi/drivers/ni_pcimio.c: Disable windowed register access, + since it's still causing problems on 611x. + +2002-03-08 20:02 fmhess + + * comedi/drivers/: comedi_rt_timer.c, comedi_test.c: converted 64 + bit integer division to use do_div + +2002-03-08 19:54 fmhess + + * include/asm/div64.h: added asm/div64.h compatibility header so + comedi can use 64 bit integer division macro + +2002-03-08 17:12 ds + + * README, Documentation/Configure.help, + Documentation/Configure.help.append, rpm/comedi.spec: Changed + hostnames to comedi.org + +2002-03-08 16:57 ds + + * comedi/comedi_fops.c, comedi/comedi_ksyms.c, comedi/drivers.c, + comedi/proc.c, comedi/range.c, comedi/rt.c, + comedi/drivers/8253.h, comedi/drivers/8255.c, + comedi/drivers/8255.h, comedi/drivers/am9513.h, + comedi/drivers/cb_pcidas.c, comedi/drivers/cb_pcidas64.c, + comedi/drivers/cb_pcidda.c, comedi/drivers/das08.c, + comedi/drivers/das16.c, comedi/drivers/das16m1.c, + comedi/drivers/dt2811.c, comedi/drivers/dt2814.c, + comedi/drivers/dt2817.c, comedi/drivers/dt282x.c, + comedi/drivers/dt3000.c, comedi/drivers/mite.h, + comedi/drivers/ni_pcidio.c, comedi/drivers/ni_pcimio.c, + comedi/drivers/ni_stc.h, comedi/drivers/pcl711.c, + comedi/drivers/pcl726.c, comedi/drivers/quatech_daqp_cs.c, + comedi/drivers/rti800.c, comedi/kcomedilib/data.c, + comedi/kcomedilib/dio.c, comedi/kcomedilib/kcomedilib_main.c, + comedi/kcomedilib/ksyms.c, include/linux/comedi_rt.h, + include/linux/comedidev.h, include/linux/kern_compat.h: Global + change from ds@stm.lbl.gov to ds@schleef.org + +2002-03-08 16:47 ds + + * comedi/drivers/: comedi_test.c, dt3000.c, icp_multi.c: Fix some + problems noticed by check_driver + +2002-03-08 16:10 ds + + * TODO: [no log message] + +2002-03-08 16:09 ds + + * include/linux/comedi.h: Added CMDF_RAWDATA, CMDF_WRITE and + COMEDI_MIN_SPEED + +2002-03-08 16:08 ds + + * comedi/drivers/ni_pcimio.c: Updated docs + +2002-03-08 16:08 ds + + * comedi/drivers/ni_mio_common.c: Added non-munging support + (CMDF_RAWDATA) + +2002-03-08 16:07 ds + + * comedi/drivers/comedi_test.c: Use instead of + + +2002-03-08 15:08 ds + + * Contributors: I'm not good at updating this list. If you think + you should be here, please tell me. + +2002-03-08 15:07 ds + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: Added ad8842 caldac + +2002-03-08 14:44 ds + + * comedi/drivers/ni_mio_common.c: Hand-applied patch from Rolf + Mueller . Most of the patch was + obsoleted by the previous check-in. + +2002-03-08 14:24 ds + + * TODO: [no log message] + +2002-03-08 14:19 ds + + * TODO: [no log message] + +2002-03-08 14:16 ds + + * scripts/config.dist: update + +2002-03-08 14:12 ds + + * comedi/drivers/rtd520.c: Update from Dan + +2002-03-08 14:06 ds + + * comedi/drivers/: ni_atmio.c, ni_mio_common.c, ni_mio_cs.c, + ni_pcimio.c, ni_stc.h: Change direct writing of shadow registers + to win_in() and win_out(), and fix win_in() and win_out() to + write directly to shadow registers if possible. Added 611x + register definitions to ni_stc.h. Change caldacs on 611x boards + to ad8804_debug. + +2002-03-08 11:42 ds + + * comedi/drivers/dt2814.c: Remove floating point constant + +2002-03-08 11:42 ds + + * comedi/drivers/comedi_rt_timer.c: Fix documentation + +2002-03-08 09:54 fmhess + + * comedi/drivers/cb_pcidas64.c: more bugfixes, untested with + hardware though + +2002-03-07 20:39 fmhess + + * comedi/drivers/cb_pcidas64.c: some bugfixes. Driver still + doesn't work yet. + +2002-03-06 15:35 fmhess + + * comedi/drivers/: comedi_rt_timer.c, comedi_test.c, das08.c, + das16.c, das16m1.c, pcl711.c: Corrected 'Authors:' fields that + should be 'Author:' , since it was causing problems with the + documentation comedilib produces from drivers.txt + +2002-03-06 10:46 fmhess + + * comedi/drivers/cb_pcidas64.c: added some new boards, still needs + some tweaking but I should be getting one of these in a week or + so. + +2002-03-06 09:31 fmhess + + * comedi/: Config.in, drivers/Makefile.in, drivers/comedi_test.c, + drivers/dummy_waveform.c: changed dummy_waveform driver to + comedi_test driver, added support for convert_src = TRIG_TIMER + +2002-03-05 17:13 fmhess + + * include/linux/pci.h: more compatibility functions to get + adl_pci9111.c driver working on 2.2 kernels + +2002-03-05 15:14 fmhess + + * comedi/drivers/pcl726.c: removed definition of RANGE_mA() macro, + which is already defined by linux/comedidev.h + +2002-03-05 12:54 fmhess + + * comedi/drivers/dummy_waveform.c: added square wave generation on + channel 1, made scans with more than one channel work, added 5 + volt range, added documentation comments + +2002-03-05 12:53 fmhess + + * comedi/drivers/: das16.c, das800.c: removed some redundant + comments + +2002-03-04 16:23 fmhess + + * comedi/: Config.in, drivers/Makefile.in, + drivers/dummy_waveform.c: Got dummy waveform generation driver + started by Wuttke Joachim working (sort of) so I can bring comedi + to a job interview :P + +2002-03-04 11:05 fmhess + + * comedi/drivers/das16.c: patch from John Conner + for cio-das16jr/16 support + +2002-03-01 13:20 fmhess + + * Makefile.modbuild: pass PATH environment variable to script so + 'fake' kernel source installations will still work. + +2002-03-01 12:48 fmhess + + * include/linux/ioport.h: 2.2.20 kernel already includes + compatibility functions for check/request/release_mem_region() + +2002-02-28 11:19 fmhess + + * comedi/drivers/ni_stc.h: fixing compile... I guess this is right + +2002-02-27 19:03 ds + + * comedi/drivers/: ni_atmio.c, ni_mio_common.c: Add debugging + caldac, and change at-mio-16xe-50 to use it. + +2002-02-27 19:02 ds + + * comedi/drivers/ni_pcimio.c: Fix some board information + +2002-02-27 16:09 fmhess + + * comedi/drivers/cb_pcidas.c: added initialization of calibration + register to make sure channel 0 is not reading calibration + source. + +2002-02-26 03:09 ds + + * rpm/: comedi.patch, comedi.spec: let's build some RPMs. From Tim + Ousley + +2002-02-25 13:48 fmhess + + * include/linux/pci.h: undid addition of PCI_VENDOR_ID_ICP, since + it was already added to comedidev.h Not sure why I had this + problem in the first place, must have had a problem with cvs + update + +2002-02-21 09:57 fmhess + + * include/linux/pci.h: quick hack to fix lack of PCI_VENDOR_ID_ICP + in 2.2 kernels + +2002-02-21 09:52 fmhess + + * comedi/drivers/das16.c: enabled 8255 support for a few boards + that should have it + +2002-02-20 12:09 ds + + * comedi/drivers/ni_mio_common.c: fixed driver being very noisy if + debugging is turned on with shared interrupts. Attempt to get + the driver to stop acquisition correctly with DMA. + +2002-02-20 12:02 ds + + * comedi/drivers/ni_pcimio.c: Enable PCIDMA, add structure for + 6053e + +2002-02-20 11:56 ds + + * comedi/drivers/adl_pci9111.c: Cleanups + +2002-02-20 11:54 ds + + * comedi/drivers/: adv_pci1710.c, icp_multi.c, ni_pcimio.c: Fix PCI + vendor IDs + +2002-02-20 11:42 ds + + * include/linux/comedidev.h: Add some vendor ids + +2002-02-20 09:29 ds + + * comedi/drivers/adl_pci9111.c: new driver from Emmanuel PACAUD + + +2002-02-20 09:29 ds + + * scripts/config.dist, comedi/Config.in, + comedi/drivers/Makefile.in: new driver adl_pci9111 + +2002-02-18 16:29 ds + + * comedi/drivers/poc.c: Added pcl733 and pcl734 + +2002-02-18 13:58 fmhess + + * comedi/drivers/das16.c: fixed gain for pc104-das16jr/16 + +2002-02-16 14:46 ds + + * comedi/drivers/ni_labpc.c: PCMCIA can share interrupts, too + +2002-02-15 15:08 fmhess + + * comedi/drivers/icp_multi.h: added pci_enable_device() call + +2002-02-15 14:39 fmhess + + * comedi/drivers/amcc_s5933.c, comedi/drivers/amplc_pci230.c, + comedi/drivers/cb_pcidas.c, comedi/drivers/cb_pcidas64.c, + comedi/drivers/cb_pcidda.c, comedi/drivers/das08.c, + comedi/drivers/icp_multi.h, comedi/drivers/rtd520.c, + include/linux/pci.h, include/linux/vmalloc.h: fixed + pci_resource_start compatibility macro so it returns address + without and extra flag bits set. Some hacks to fix amcc_s5933.c + stuff on 2.4 + +2002-02-15 14:25 ds + + * comedi/drivers/ni_pcimio.c: 6024e and 6025e don't have unipolar + or external AO + +2002-02-14 15:36 ds + + * include/linux/vmalloc.h: Compatibility for vmalloc_32() + +2002-02-13 20:59 ds + + * comedi/drivers/dt3000.c: First attempt at AI command support + +2002-02-11 17:48 ds + + * Makefile.modbuild: Only run depmod if installing to / and kernel + is the same + +2002-02-11 16:49 ds + + * comedi/drivers/: ni_mio_common.c, ni_pcimio.c: Change 6052e to + use ad8804 caldac + +2002-02-10 17:03 ds + + * comedi/drivers/ni_pcimio.c: Added 6731, 6733. Updated + documentation + +2002-02-10 17:03 ds + + * comedi/drivers/ni_mio_cs.c: Added 6715, disabled. + +2002-02-10 15:55 ds + + * comedi/drivers/: ni_mio_common.c, ni_pcimio.c, ni_stc.h: Changes + needed for 671x boards + +2002-02-09 21:05 ds + + * comedi/drivers/: cb_pcidda.c, daqboard2000.c, dt3000.c: Convert + to pci_resource_start() + +2002-02-09 21:04 ds + + * comedi/drivers/ni_mio_common.c: Moved edge/level rising/falling + defs to comedi.h + +2002-02-09 20:56 ds + + * comedi/drivers/ni_670x.c: Remove 2.0 PCI code + +2002-02-09 20:54 ds + + * include/linux/comedi.h: Added a few things to interface + +2002-02-09 20:21 ds + + * comedi/drivers/: amcc_s5933.c, amcc_s5933.h, icp_multi.h, + ni_labpc.c, ni_pcidio.c, ni_pcimio.c: Removal of 2.0 PCI support + +2002-02-09 20:13 ds + + * comedi/drivers/ni_pcidio.c: More DMA hacking. Works nicely now. + Allocator moved to mite.c. Converted to new MITE DMA functions + and dynamic ring buffer. Added more mite interrupt handling. + +2002-02-09 20:11 ds + + * comedi/drivers/ni_pcimio.c: Change buffer allocation to use mite + allocator. + +2002-02-09 20:11 ds + + * comedi/drivers/ni_mio_common.c: Attempt to fix for new MITE DMA + code. Cleanups. + +2002-02-09 20:09 ds + + * comedi/drivers/mite.c: Ifdef old DMA functions + +2002-02-09 20:09 ds + + * comedi/drivers/mite.h: Remove old PCI support. Remove static + ring buffer. #ifdef old dma functions. + +2002-02-09 19:37 ds + + * comedi/drivers/mite.c: Cleanups: remove old PCI support. Fix + more places for mite->chan. Remove ring[].dar usage. + +2002-02-09 19:26 ds + + * comedi/drivers/mite.c: Added cpu_to_le32() for big-endian + machines. Removed unused functions. Cleanups. Converted most + to use mite->chan. Added functions for ni_pcidio. Added chsr + dump function. + +2002-02-09 19:19 ds + + * comedi/drivers/mite.h: Added more defines. Added new functions, + works on ni_pcidio. Added elements to mite structure to handle a + dynamic ring buffer. + +2002-02-09 17:02 ds + + * comedi/drivers/ni_pcidio.c: Checkpoint for DMA hacking. Mostly + works for small N. + +2002-02-08 21:57 ds + + * comedi/drivers/ni_pcidio.c: Timed input works in non-DMA mode. + +2002-02-08 17:38 ds + + * comedi/drivers/rtd520.c: Update from Dan. Fixes conflict between + rounding timer values and speed cutoff. + +2002-02-08 16:49 ds + + * comedi/drivers/ni_pcidio.c: Cleanups. Should work identically to + last revision. + +2002-02-08 15:11 ds + + * comedi/drivers/ni_daq_dio24.c: Compilation fixes + +2002-02-08 15:10 ds + + * comedi/: Config.in, drivers/Makefile.in: New drivers + +2002-02-08 15:09 ds + + * comedi/drivers/ni_at_ao.c: Big hack attack results in new driver. + Film at 11. + +2002-02-08 13:03 ds + + * comedi/drivers/8255.c: Updated documentation + +2002-02-07 13:06 ds + + * comedi/drivers/rtd520.c: Update from Dan + +2002-02-07 10:11 fmhess + + * comedi/drivers/: icp_multi.c, icp_multi.h: newer versino of + icp_multi driver that Anne Smorthit had mailed to me while she + was trying to debug it + +2002-02-07 09:55 fmhess + + * INSTALL: added a paragraph about preparing a kernel source + directory to match an already compiled kernel. + +2002-02-06 13:48 ds + + * comedi/comedi_fops.c: Revert poll conditions: if device is + non-busy, set the poll flags so the app can read the error. This + is how it used to be, and I'm not sure why I changed (broke) it. + +2002-02-06 12:41 ds + + * comedi/drivers/: ni_atmio.c, ni_mio_common.c, ni_mio_cs.c, + ni_pcimio.c, ni_stc.h: Change caldac code to be slightly less + confusing + +2002-02-06 01:04 ds + + * comedi/comedi_fops.c: Revert some previous dumb changes with + events. This should get polling/select/regular read working + again. There is an unresolved problem: a normal select/read + cycle on a device will fail to show the end of acquisition. One + solution is to always have the app read 0 bytes at the end of + acquisition, but people got confused when that was necessary. + +2002-02-05 21:22 ds + + * TODO: random ci + +2002-02-05 21:21 ds + + * comedi/drivers/ni_pcimio.c: Fix documentation numbers + +2002-02-05 21:21 ds + + * comedi/drivers/ni_daq_dio24.c: New driver + +2002-02-04 17:19 fmhess + + * include/linux/pci.h: changed pci_alloc_consistent compatibility + function so it can allocate up to 2M. + +2002-02-03 16:28 ds + + * comedi/: comedi_fops.c, drivers.c, drivers/ni_pcimio.c: Change + Comedi buffer allocator to use a virtual function in the + subdevice structure. Added a default allocator. Added an + override in ni_pcimio, to use dma_alloc_consistent. Changed the + number of maximum caldac in ni_pcimio -- mostly bogus, but is + used for testing. + +2002-02-03 16:25 ds + + * include/linux/comedidev.h: Remove buf_change, add buf_alloc in + subdevice structure + +2002-02-03 16:23 ds + + * comedi/drivers/ni_mio_common.c: Add comedi_event() call in mite + interrupt handler + +2002-02-02 09:21 fmhess + + * comedi/drivers/: mite.c, mite.h, ni_670x.c, ni_labpc.c, + ni_pcidio.c, ni_pcimio.c: fixed error handling for mite_setup + +2002-02-01 14:23 fmhess + + * comedi/drivers/das16.c: fixed race in interrupt handler + +2002-01-31 16:18 ds + + * scripts/release: Generate tar file in local dir + +2002-01-31 16:17 ds + + * Makefile: version bump + +2002-01-31 16:16 ds + + * scripts/release: Fix problem with constructing new version + numbers + +2002-01-31 16:09 ds + + * Changelog: For 0.7.63 + +2002-01-31 16:05 ds + + * comedi/comedi_fops.c: Fix event handling bugs. + +2002-01-31 16:00 ds + + * Changelog: 0.7.62 changelog + +2002-01-29 19:19 fmhess + + * comedi/comedi_fops.c: fixed pointer arithmetic + +2002-01-26 18:28 ds + + * comedi/drivers/ni_mio_common.c: Yet another iteration. + +2002-01-26 17:54 ds + + * comedi/drivers/ni_mio_common.c: Yet another iteration. + +2002-01-26 17:43 ds + + * comedi/drivers/ni_mio_common.c: Another iteration on the AI 611x + chanlist problem + +2002-01-26 15:52 ds + + * comedi/drivers/: ni_mio_common.c, ni_pcimio.c, ni_stc.h: Fix AI + chanlist configuration on 611x + +2002-01-26 15:51 ds + + * comedi/drivers/ni_mio_common.c: Merge AO chanlist configuration + into one function + +2002-01-22 01:50 ds + + * scripts/release: Export to versioned directory + +2002-01-22 01:47 ds + + * scripts/release: Create drivers.txt. + +2002-01-22 01:47 ds + + * Makefile: Fix rule to make drivers.txt. Add rule to run + check_driver. + +2002-01-22 01:43 ds + + * comedi/drivers/check_cmdtest, comedi/drivers/check_driver, + scripts/check_cmdtest, scripts/check_driver: move scripts + +2002-01-22 01:38 ds + + * scripts/release: Cleanup the release script + +2002-01-21 19:32 fmhess + + * INSTALL: added a little note about PCMCIA + +2002-01-21 19:11 fmhess + + * comedi/drivers/: das08.c, ni_labpc.c: oops I wanted the pcmcia + device names to match the names that need to be passed to + comedi_config + +2002-01-21 19:08 fmhess + + * comedi/drivers/: das08.c, ni_labpc.c: fixing device names for + pcmcia + +2002-01-21 16:55 ds + + * Rules.make: Fix export-objs being unconditionally recompiled + +2002-01-21 16:16 ds + + * comedi/drivers/check_driver: Added a test for SDF_RT + +2002-01-21 16:14 ds + + * comedi/drivers/comedi_rt_timer.c: Added DIO subdevice support. + Untested. Added SPEED_LIMIT #define. + +2002-01-21 16:12 ds + + * Documentation/comedi/pci.ids: Some National Instruments PCI IDs + +2002-01-20 15:31 ds + + * comedi/drivers/ni_pcimio.c: Added pci-6036e + +2002-01-15 04:08 ds + + * comedi/drivers/icp_multi.c: Change malloc.h to slab.h + +2002-01-15 04:05 ds + + * scripts/config.dist: update + +2002-01-15 04:03 ds + + * comedi/: comedi_fops.c, comedi_ksyms.c: Remove comedi_done and + friends + +2002-01-15 04:02 ds + + * configure, scripts/dep.linux: Fix problems with old bash + +2002-01-15 03:59 ds + + * include/linux/comedidev.h: Added PCI_VENDOR_IDs. Removed + comedi_done and friends. Fixed compilation without + CONFIG_PROC_FS. Removed dead code. + +2002-01-15 03:56 ds + + * TODO: [no log message] + +2002-01-15 03:54 ds + + * comedi/drivers/: adl_pci9118.c, adv_pci1710.c, comedi_parport.c, + das6402.c, dt2811.c, dt2814.c, dt282x.c, ni_atmio16d.c, + ni_mio_common.c, pcl711.c, pcl818.c, rtd520.c: Convert all uses + of comedi_bufcheck, comedi_done, comedi_error_done, comedi_eobuf, + and comedi_eos to setting s->async flags and calling + comedi_event. + +2002-01-15 03:50 ds + + * comedi/drivers/: adl_pci9118.c, adv_pci1710.c, amcc_s5933.c, + amcc_s5933.h, amplc_pci230.c, cb_pcidas.c, comedi_parport.c, + comedi_rt_timer.c, daqboard2000.c, das16.c, das1800.c, das6402.c, + dt2811.c, dt2814.c, dt2815.c, dt2817.c, dt282x.c, dt3000.c, + fl512.c, ii_pci20kc.c, mpc8260cpm.c, multiq3.c, ni_670x.c, + ni_at_a2150.c, ni_atmio.c, ni_atmio16d.c, ni_mio_common.c, + ni_mio_cs.c, ni_pcidio.c, ni_pcimio.c, pcl711.c, pcl724.c, + pcl725.c, pcl726.c, pcl812.c, pcl818.c, pcm3730.c, poc.c, + quatech_daqp_cs.c, rtd520.c, rti800.c, skel.c, ssv_dnp.c: + Cleanups suggested by check_driver. Mostly leaky symbols, + incorrect use of free_irq() and SA_SHIRQ, and pci_device_id + tables. + +2002-01-15 03:42 ds + + * comedi/drivers/ni_labpc.c: Update for new 8255 interface + +2002-01-15 03:38 ds + + * comedi/drivers/check_driver: New checks. Wrap some old checks in + check_all + +2002-01-15 03:35 ds + + * comedi/drivers/: icp_multi.c, icp_multi.h: New driver + +2002-01-15 03:27 ds + + * comedi/drivers/Makefile.in: amcc_s5933.o exports symbols. Change + DT282x CONFIG option. Add a few drivers. + +2002-01-15 03:26 ds + + * comedi/Config.in: Changed CONFIG option for DT282x + +2002-01-15 03:25 ds + + * comedi/drivers/ni_pcidio.c: Added preliminary command support. + From Ildefond Magrans + +2002-01-14 14:37 fmhess + + * comedi/drivers/dt282x.c: added a little printk for when + request_irq fails + +2002-01-10 10:10 fmhess + + * comedi/comedi_fops.c: according to linux device drivers, POSIX + standard is to return -ENOTTY for invalid ioctl number + +2002-01-09 18:18 fmhess + + * comedi/drivers/: amcc_s5933.c, amplc_pci230.c, cb_pcidas.c, + cb_pcidas64.c, cb_pcidda.c, das08.c, das800.c, mite.c, rtd520.c: + got rid of some preproccesor ugliness by converting to use of + pci_resource_start() + +2002-01-09 17:35 fmhess + + * include/linux/pci.h: added pci_resource_start() compatibility + macro + +2002-01-09 16:01 fmhess + + * comedi/drivers/cb_pcidas.c: should be fixed for 1602/16 now + +2002-01-08 16:42 fmhess + + * comedi/drivers/das1800.c: prevented it from switching dma + channels when using dual dma and polled, unless a terminal count + has actually occured. + +2002-01-08 12:42 fmhess + + * comedi/drivers/cb_pcidas.c: reenabled debugging code to try and + get 1602/16 working + +2002-01-02 18:05 fmhess + + * comedi/drivers/das1800.c: made poll() work on dma transfers again + +2002-01-01 09:46 fmhess + + * comedi/drivers/das1800.c: merged some duplicated code, and became + more careful about clearing board's interrupt status bits. Makes + no noticeable difference though, dual isa dma can still get + clobbered by heavy hard drive i/o with 2.2 kernel (the hard drive + bursts are causing greater than 200 millisec interrupt + latencies). + +2001-12-31 18:55 fmhess + + * comedi/drivers/das1800.c: fixed bug with dma transfers not being + quite the length I wanted them to be. + +2001-12-29 23:47 ds + + * TODO: [no log message] + +2001-12-29 23:46 ds + + * comedi/drivers/ssv_dnp.c: Fix warning about requesting region. + +2001-12-17 14:14 fmhess + + * comedi/drivers/ni_pcimio.c: corrected top speed for 6040 + +2001-12-15 08:39 ds + + * scripts/dep.linux: Check for the case where 'make dep' was not + run. + +2001-12-14 22:52 fmhess + + * Makefile.modbuild, comedi/Config.in: Changed Makefile.modbuild to + run configure script in empty environment to prevent variables + from a stale LINUXDIR from getting imported. Finally got + comedi/Config.in to properly prompt for comedi_rt_timer depending + on whether we are using an RT kernel or not. + +2001-12-14 14:10 ds + + * comedi/drivers/: 8255.c, 8255.h, amplc_pci230.c, cb_pcidas.c, + cb_pcidas64.c, cb_pcidda.c, daqboard2000.c, das08.c, das16.c, + das16m1.c, ni_atmio16d.c, ni_labpc.c, ni_mio_common.c, + ni_pcidio.c, pcl724.c: Change prototype of subdev_8255_init() + (void * -> unsigned long) to make it more 64-bit friendly. + +2001-12-14 13:44 ds + + * comedi/drivers/8255.c: 64-bit cleanups + +2001-12-14 13:43 ds + + * Makefile.modbuild: Pull CC, AS, and LD from kernel. Sparc64 + needs it. + +2001-12-14 11:49 fmhess + + * comedi/drivers/das1800.c: oops undid accidental reversion of + linux/slab.h to linux/malloc.h + +2001-12-14 11:48 fmhess + + * comedi/drivers/das1800.c: moved clearing of interrupt to + beginning of interrupt handler from end. + +2001-12-14 11:25 ds + + * Makefile.modbuild, scripts/dep.rtai, scripts/dep.rtlinux: Fix + Makefile.modbuild to delete Makefiles on distclean, CFLAGS not to + duplicate kernel flags. Fix scripts/dep.* to not add to CFLAGS if + the RTAI/RTLinux include directories don't exist. (Might not be + an error -- otherwise it's difficult to compile for a real-time + patched kernel without the RTAI/RTLinux source.) + +2001-12-14 11:20 ds + + * Changelog: Added Changelog + +2001-12-14 11:15 fmhess + + * comedi/drivers/das16.c: fix for stop_src == TRIG_NONE + +2001-12-14 11:09 ds + + * configure: Fix to export LINUXDIR. + +2001-12-10 09:44 fmhess + + * comedi/comedi_fops.c: added useless line to maybe help sparc + compilation + +2001-12-10 09:32 fmhess + + * include/linux/module.h: okay, MODULE_LICENSE was introduced in + 2.4.10 + +2001-12-10 09:27 fmhess + + * include/linux/module.h: little cleanup + +2001-12-07 14:23 fmhess + + * Makefile.modbuild, comedi/comedi_fops.c, comedi/rt.c, + include/linux/comedidev.h, include/linux/init.h: fixes for 2.2 + compile + +2001-12-07 13:53 fmhess + + * include/linux/module.h: fix for MODULE_LICENSE() with 2.2 kernels + +2001-12-06 18:14 ds + + * comedi/comedi_fops.c: Add module license, clean up init/cleanup. + +2001-12-06 18:13 ds + + * comedi/drivers.c: Remove bogus driver registration + +2001-12-06 18:12 ds + + * comedi/drivers/: adl_pci9118.c, adv_pci1710.c: Fix symbol leakage + +2001-12-06 18:12 ds + + * include/linux/comedidev.h: Add module license to INITCLEANUP + +2001-12-06 18:10 ds + + * comedi/kcomedilib/kcomedilib_main.c: Add module license + +2001-12-06 18:09 ds + + * comedi/drivers/: amcc_s5933.c, amcc_s5933.h: Split apart into a + module and header + +2001-12-06 18:02 ds + + * scripts/Menuconfig: Added menuconfig script, slightly modified + from 2.4.16 + +2001-12-06 17:57 ds + + * configure, comedi/Makefile.in, comedi/drivers/Makefile.in, + scripts/dep.linux, scripts/generate_makefile: Fixes to the new + build system + +2001-12-03 12:54 fmhess + + * include/linux/slab.h: 2.2 linux/malloc.h just includes + linux/slab.h, this file was causing the kmalloc versioning to get + messed up somehow (linux 2.2.19). + +2001-12-03 12:43 fmhess + + * comedi/: Makefile, drivers/Makefile, kcomedilib/Makefile: + removing autogenerated makefiles from cvs + +2001-12-03 12:40 fmhess + + * Makefile.modbuild, scripts/dep.rtlinux, + include/linux/comedidev.h: fixes for compile on rtlinux-3.1 with + linux 2.2.19 + +2001-11-30 21:34 ds + + * scripts/preconfigure: Not used in new build system + +2001-11-30 21:33 ds + + * patches/: patch-rtai, rel_comedi: rel_comedi moved to scripts. + patch-rtai cleaned up, although it doesn't work anymore. + +2001-11-30 21:20 ds + + * Documentation/comedi/mode-info: Irrelevant, now that comedi_trig + has been completely removed + +2001-11-30 21:19 ds + + * Documentation/comedi/: drivers.txt, hardware: These files are now + generated from .c files + +2001-11-30 21:18 ds + + * Makefile, Rules.make: Fix modversions, installation, drivers.txt + targets. + +2001-11-30 21:11 ds + + * comedi/drivers/: ni_at_a2150.c, rtd520.c: Remove spurious + floating point code that shouldn't be there + +2001-11-30 20:48 ds + + * include/linux/: comedi_rt.h, comedidev.h, config.h, version.h: + Change malloc.h to slab.h. Fixed header references to modbuild + directory. + +2001-11-30 20:45 ds + + * comedi/: comedi_fops.c, drivers.c, kvmem.h, rt.c: Change malloc.h + to slab.h. Minor fixes for RTAI on PPC. + +2001-11-30 20:40 ds + + * INSTALL, Makefile.modbuild, README, Rules.make, configure, + scripts/Configure, scripts/dep.linux, scripts/dep.pcmcia, + scripts/dep.rtai, scripts/dep.rtlinux, scripts/generate_makefile, + scripts/mkdep.c: Massive rewrite of the configure/build system + +2001-11-30 18:09 ds + + * scripts/config.h.dist: Don't need this. + +2001-11-30 17:16 ds + + * comedi/kcomedilib/: data.c, dio.c, kcomedilib_main.c, ksyms.c: + Change linux/malloc.h to linux/slab.h + +2001-11-30 17:15 ds + + * comedi/: rt_pend_tq.c, rt_pend_tq.h: I'm tired of these being in + a separate directory + +2001-11-30 17:07 ds + + * comedi/drivers/: 8255.c, adl_pci9118.c, adv_pci1710.c, + amplc_pci230.c, cb_pcidas.c, cb_pcidas64.c, cb_pcidda.c, + comedi_parport.c, daqboard2000.c, das08.c, das16.c, das16m1.c, + das1800.c, das800.c, dt2811.c, dt2814.c, dt2815.c, dt2817.c, + dt282x.c, fl512.c, mite.c, mpc8260cpm.c, multiq3.c, ni_670x.c, + ni_at_a2150.c, ni_atmio.c, ni_atmio16d.c, ni_labpc.c, + ni_mio_cs.c, ni_pcidio.c, ni_pcimio.c, pcl711.c, pcl724.c, + pcl725.c, pcl726.c, pcl812.c, pcm3730.c, pcmad.c, poc.c, + quatech_daqp_cs.c, rtd520.c, rti800.c, rti802.c, skel.c, + ssv_dnp.c: Change linux/malloc.h to linux/slab.h + +2001-11-30 16:34 ds + + * include/linux/slab.h: Linux-2.4 prefers slab.h + +2001-11-29 15:38 fmhess + + * INSTALL: corrected typo + +2001-11-22 19:03 fmhess + + * comedi/kcomedilib/: data.c, dio.c, kcomedilib_main.c, ksyms.c: + removed more old trig stuff + +2001-11-22 18:57 fmhess + + * comedi/Config.in, scripts/config.dist: okay, _really_ fixed + problem with comedi_rt_timer getting compiled on non-RT kernels + when make config used defaults in config.dist + +2001-11-22 08:32 fmhess + + * comedi/drivers/ni_labpc.c: oops parse error + +2001-11-22 08:20 fmhess + + * comedi/drivers/ni_labpc.c: fixed error in calculating counter a0 + and b1 values + +2001-11-22 08:15 fmhess + + * comedi/drivers/ni_labpc.c: fix to cmdtest + +2001-11-22 08:01 fmhess + + * comedi/drivers/ni_labpc.c: fixed bug noted by Massimiliano Cialdi + +2001-11-22 07:57 fmhess + + * comedi/drivers/ni_labpc.c: fixed bug in pacing when both + convert_src and scan_begin_src are TRIG_TIMER + +2001-11-21 22:36 fmhess + + * comedi/: Makefile, Makefile.in, comedi_fops.c, drivers.c, trig.c: + trig go bye bye + +2001-11-21 17:21 fmhess + + * comedi/drivers/ni_labpc.c: fixed declarations + +2001-11-21 17:09 fmhess + + * comedi/comedi_fops.c, comedi/drivers/ni_atmio16d.c, + comedi/drivers/ni_mio_common.c, comedi/drivers/pcl812.c, + comedi/drivers/pcl818.c, comedi/kcomedilib/kcomedilib_main.c, + include/linux/comedidev.h: removed async.cur_chanlist_len + +2001-11-21 12:26 fmhess + + * comedi/Config.in: fixed problem with make trying to compile + comedi_rt_timer with non-RT kernel, removed useless trig support + prompt + +2001-11-21 12:24 fmhess + + * comedi/drivers/ni_labpc.c: added support for scan_begin_src == + TRIG_TIMER + +2001-11-18 10:26 fmhess + + * comedi/drivers/ni_stc.h: fixed offset for ao mode 1 register, + multiple channel analog out should work now + +2001-11-18 10:08 fmhess + + * comedi/drivers/ni_stc.h: fixed an error I made + +2001-11-16 12:59 fmhess + + * comedi/kcomedilib/kcomedilib_main.c: added initialization of + async->cur_chan and cur_chanlist_len to comedi_command() + +2001-11-16 12:42 fmhess + + * comedi/drivers/ni_labpc.c: fixed bug that caused nasty + interaction between analog input command and analog output + instruction + +2001-11-16 12:04 fmhess + + * comedi/drivers/cb_pcidda.c: seems to work okay, removed some + debugging message spam + +2001-11-15 10:22 fmhess + + * comedi/drivers/ni_labpc.c: fixed sending of BLOCK events with pio + transfers + +2001-11-14 12:51 fmhess + + * comedi/drivers/cb_pcidda.c: should properly calibrate itself + according to eeprom now (excepting bugs) + +2001-11-14 12:28 fmhess + + * comedi/drivers/ni_mio_common.c: removed some duplicated function + declarations + +2001-11-14 09:09 fmhess + + * comedi/drivers/cb_pcidda.c: added stuff for reading data from + boards eeprom as first step towards making board calibrate itself + according to range and factory calibration. + +2001-11-12 14:19 fmhess + + * comedi/drivers/ni_mio_common.c: implemented data munging for + analog output commands + +2001-11-12 10:58 fmhess + + * comedi/drivers/cb_pcidas.c: disabled driver's debugging messages + +2001-11-09 15:30 ds + + * scripts/release: The release script. I could never find it when + necessary, so it's here now. + +2001-11-09 13:29 fmhess + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: fixed problem with + setting of bipolar mode in analog out command noted by Amish + Dave. However, have noticed that no data munging appears to ever + get done on analog output commands (it does get done in ao insn) + so this is still a problem that needs to be fixed. + +2001-11-09 12:26 fmhess + + * comedi/drivers/ni_mio_common.c: fixed bug with checking number of + caldac channels noted by Amish Dave + +2001-11-08 09:32 fmhess + + * scripts/dep.linux: made prompting for linux directory work like + prompting for rtlinux directory (doesn't assume directory found + in .sourcedirs is correct) + +2001-11-07 12:33 fmhess + + * comedi/drivers/mite.c: took into account possibility of + pci_enable_device failure + +2001-11-07 12:31 fmhess + + * comedi/drivers/ni_labpc.c: initial attempt at pcmcia support + +2001-11-06 16:43 fmhess + + * comedi/drivers/ni_labpc.c: Fixed all the bugs I'm aware of. Just + needs pcmcia support added now. + +2001-11-06 14:23 ds + + * scripts/config.dist: Updated with new drivers + +2001-11-06 14:16 ds + + * comedi/drivers/comedi_rt_timer.c: Added implementation of + comedi_poll(). This function may be useful in the core, although + presumably the behavior should be different if the driver doesn't + implement poll. + +2001-11-06 14:13 ds + + * comedi/drivers/adv_pci1710.c: Change #ifdefs to DPRINTK() macro. + Eliminated bogus udelay(1)s. + +2001-11-06 10:43 fmhess + + * comedi/drivers/ni_labpc.c: made pci interrupt shareable, + implemented writes for eeprom subdevice, made it properly flush + all data to comedi on stop_src == TRIG_EXT + +2001-11-05 16:40 fmhess + + * comedi/drivers/ni_labpc.c: fixed Devices: list to prevent parse + error during 'make drivers.txt' + +2001-11-05 13:29 fmhess + + * comedi/drivers/ni_labpc.c: loading of caldacs from eeprom works + now + +2001-11-04 21:20 fmhess + + * comedi/drivers/ni_labpc.c: implemented work around to correct + (nearly undocumented by NI, and then incorrectly documented) + caldac design mistake + +2001-11-04 20:18 fmhess + + * comedi/drivers/ni_labpc.c: bug fixes + +2001-11-03 16:22 fmhess + + * comedi/drivers/ni_labpc.c: some more caldac/eeprom stuff + +2001-11-02 18:10 fmhess + + * comedi/drivers/ni_labpc.c: added device id for pci card, pci + device table, started on calibration/eeprom stuff, fixed symbol + leaks, some bugfixes. + +2001-11-02 12:04 fmhess + + * comedi/drivers/das08.c: got rid of some excess ioport allocation + +2001-11-02 11:48 fmhess + + * comedi/drivers/das08.c: added some debugging messages + +2001-11-01 16:39 fmhess + + * comedi/drivers/ni_labpc.c: more bugfixing. Seems to work during + initial testing with lab-pc-1200 board. Still needs more + thorough testing though. + +2001-11-01 09:55 fmhess + + * comedi/drivers/ni_labpc.c: added support for some 1200 series + boards, fixed some bugs + +2001-10-29 16:07 fmhess + + * comedi/drivers/ni_labpc.c: added command support. Lotsa bugs + still, but almost ready to enter testing and debugging phase + +2001-10-29 15:53 fmhess + + * comedi/drivers/das16.c: fixed stop_src == TRIG_NONE bug + +2001-10-26 14:02 fmhess + + * comedi/: Config.in, drivers/Makefile, drivers/ni_labpc.c: new + driver. insn support only. untested. + +2001-10-25 15:11 fmhess + + * comedi/drivers/: adl_pci9118.c, adv_pci1710.c, das1800.c, + dt2811.c, multiq3.c, pcl726.c, pcl818.c, rti800.c, skel.c: fixed + a bunch of insn_bits functions + +2001-10-24 15:21 ds + + * comedi/drivers/ni_mio_common.c: Fixed bug creating ai_xorlist[] + because of change in ni_gainlkup[] + +2001-10-24 15:19 ds + + * include/linux/comedi.h: Added flags in chanspec description + +2001-10-24 15:16 ds + + * comedi/drivers/ssv_dnp.c: Added in-line documentation section + +2001-10-24 15:12 ds + + * comedi/: Config.in, drivers/Makefile, drivers/Makefile.in: Added + ssv_dnp driver + +2001-10-24 15:11 ds + + * comedi/drivers/ssv_dnp.c: New driver from Robert Schwebel + +2001-10-19 08:37 fmhess + + * comedi/comedi_fops.c: put back line that I shouldn't have removed + +2001-10-18 16:16 fmhess + + * comedi/comedi_fops.c, include/linux/comedidev.h: read now returns + -EIO (once) at end of data stream if aquisition was terminated by + an error, returns 0 if aquisition terminated normally. + +2001-10-09 15:20 fmhess + + * comedi/drivers/das08.c: fixed null dereference if you try to + configure pcm-das08 without card inserted + +2001-10-07 13:45 fmhess + + * comedi/drivers/das16m1.c: fixed bug with stop_src == TRIG_NONE + introduced with changes for poll() code + +2001-10-07 13:39 fmhess + + * comedi/drivers/ni_mio_common.c: changed type of ni_gainlkup to + get rid of compiler's overflow warnings + +2001-10-05 14:41 fmhess + + * comedi/drivers/das08.c: pcmcia support for pcm-das08, mostly just + merging in stuff from dummy_cs.c + +2001-10-04 16:52 ds + + * comedi/drivers/ni_mio_common.c: Added support for 611x style + configuration memory + +2001-10-04 16:51 ds + + * scripts/doc_devlist: change formatting + +2001-10-01 17:46 fmhess + + * comedi/drivers/das08.c: some preparation for adding pcmcia + support + +2001-09-30 10:01 fmhess + + * comedi/drivers/cb_pcidas64.c: fixed 2.4 compile error and some + bugs + +2001-09-30 09:36 fmhess + + * comedi/drivers/cb_pcidas.c: fixed checking of chanlist in cmdtest + for analog out + +2001-09-28 13:18 fmhess + + * comedi/drivers/das08.c: oops forgot to update Devices: + +2001-09-28 13:16 fmhess + + * comedi/drivers/das08.c: added support for pc104 and pcm das08 + cards, but pcmcia specific support for pcm card still needs to be + added. Fixed digital i/o insn. + +2001-09-27 14:20 ds + + * comedi/drivers/ni_pcimio.c: MAX_N_CALDACS should be 28 + +2001-09-27 14:20 ds + + * TODO: [no log message] + +2001-09-27 14:19 ds + + * comedi/drivers/dt2801.c: Remove useless debugging message + +2001-09-27 09:02 fmhess + + * comedi/drivers/das08.c: fixed error in pci-das08 board definition + +2001-09-25 17:56 fmhess + + * comedi/drivers/das16m1.c: added poll() support + +2001-09-25 17:07 fmhess + + * comedi/drivers/das1800.c: fixed poll() code by unlocking spinlock + on spurious interrupt + +2001-09-24 13:10 fmhess + + * comedi/drivers/cb_pcidas64.c: switched allocation of the dma + descriptor array to pci_alloc_consistent + +2001-09-22 19:56 fmhess + + * comedi/drivers/das16m1.c: fixed symbol leak, started using + hardware conversion counter to keep track of how many samples are + available in fifo. That's not so useful for fifo half-full + interrupt handling, but will be helpful if I add poll() support. + +2001-09-21 16:23 ds + + * comedi/drivers/ni_pcimio.c: Added pxi-6031e + +2001-09-21 16:22 ds + + * comedi/drivers/dt3000.c: Fixed Devices: + +2001-09-20 10:44 fmhess + + * comedi/drivers/cb_pcidas64.c: fixed decrement of conversion count + with dma transfers + +2001-09-19 13:43 fmhess + + * comedi/drivers/: cb_pcidas64.c, plx9080.h: more pci dma stuff, + ready for inital testing + +2001-09-19 12:48 fmhess + + * comedi/drivers/das1800.c: fixed typo in Devices:, and commiting + older tweaks that I had left uncommited + +2001-09-19 12:46 fmhess + + * comedi/drivers/poc.c: removed an obsolete comment + +2001-09-19 12:43 fmhess + + * comedi/drivers/das08.c: fixed typo in Devices: section + +2001-09-19 12:25 fmhess + + * include/linux/pci.h: took out line that belonged in init.h, added + include for definition of pci_alloc_consistent() used by older + kernels + +2001-09-18 17:35 ds + + * comedi/drivers/Makefile: Change name to devices.txt + +2001-09-18 17:35 ds + + * scripts/doc_devlist: Fix another parse error + +2001-09-18 17:33 ds + + * scripts/doc_devlist: Fix parse problem + +2001-09-18 16:45 ds + + * comedi/drivers/: cb_pcidas64.c, comedi_rt_timer.c, das08.c, + das16.c, das16m1.c, das1800.c, das6402.c, das800.c, rti800.c, + rti802.c, skel.c: Added Devices: documentation to rest of drivers + +2001-09-18 16:44 ds + + * comedi/drivers/Makefile: Moved scripts to scripts/ + +2001-09-18 16:23 fmhess + + * comedi/drivers/: cb_pcidas64.c, plx9080.h: more pci-dma stuff, + still nonfunctional + +2001-09-18 15:51 ds + + * scripts/: call_trace, doc_devlist, dump_doc: Scripts to extract + documentation + +2001-09-18 15:45 ds + + * include/linux/init.h: new + +2001-09-18 13:54 ds + + * comedi/drivers/ni_pcidio.c: Fixed a segfault in nidio_detach() + when configure fails because it can't find board + +2001-09-18 12:28 ds + + * comedi/drivers/daqboard2000.c: Change file location comment + +2001-09-18 12:20 ds + + * comedi/drivers/rti800.c: Patch from Anders Blomdell, fixing AI. + +2001-09-17 16:48 fmhess + + * comedi/drivers/: cb_pcidas64.c, plx9080.h: some initial pci dma + stuff, doesn't do anything useful yet + +2001-09-16 12:29 fmhess + + * comedi/drivers/das800.c: fixed symbol leak, and settings of + SDF_GROUND subdevice flag + +2001-09-14 15:21 fmhess + + * comedi/drivers/cb_pcidas64.c: some bugfixes + +2001-09-14 11:55 fmhess + + * comedi/drivers/cb_pcidas64.c: added support for stop_src + TRIG_COUNT that I forgot, fixed end-of-line problems my editor + was having + +2001-09-14 11:39 fmhess + + * comedi/drivers/: cb_pcidas64.c, plx9080.h: analog input commands + may possibly work now + +2001-09-13 21:06 ds + + * comedi/drivers/mite.c: Oops. Fix typo in previous check-in. + +2001-09-13 21:00 ds + + * include/linux/comedidev.h: Removed last remnants of trig support + for drivers + +2001-09-13 20:59 ds + + * comedi/: comedi_fops.c, drivers.c: Removed last remnants of + comedi_trig support for drivers + +2001-09-13 20:57 ds + + * comedi/trig.c: rewrote much of the trig support. No longer uses + any of the old internal trig stuff. + +2001-09-13 20:54 ds + + * comedi/drivers/mite.c: Remove min() macro + +2001-09-13 20:54 ds + + * comedi/drivers/Makefile: Added a target for drivers.txt + +2001-09-13 20:19 ds + + * comedi/drivers/: das6402.c, pcl818.c: Complete phase-out of + comedi_trig in drivers + +2001-09-13 20:16 ds + + * comedi/kcomedilib/: kcomedilib_main.c, ksyms.c: Complete + phase-out of comedi_trig support + +2001-09-13 19:44 ds + + * comedi/drivers/: 8255.c, amplc_pci230.c, cb_pcidas.c, + cb_pcidda.c, comedi_parport.c, daqboard2000.c, dt2801.c, fl512.c, + ii_pci20kc.c, mpc8260cpm.c, multiq3.c, ni_at_a2150.c, + ni_mio_cs.c, ni_pcidio.c, pcl711.c, pcl724.c, pcl725.c, pcl726.c, + pcm3730.c, rtd520.c, rti800.c, rti802.c: Add list of devices to + documentation + +2001-09-13 19:19 ds + + * comedi/Config.in: Change comedi_trig compat to deprecated + +2001-09-13 10:19 fmhess + + * comedi/drivers/cb_pcidas.c: fixed sending of events for analog + output + +2001-09-12 17:48 ds + + * comedi/drivers/cb_pcidas64.c: Fix argument of mem_test_region() + +2001-09-12 17:47 ds + + * comedi/drivers/rtd520.c: Fixed argument of pci_enable_dev() + +2001-09-12 16:07 ds + + * comedi/drivers/: 8255.c, adl_pci9118.c, adv_pci1710.c, + amplc_pci230.c, cb_pcidas.c, cb_pcidas64.c, cb_pcidda.c, + comedi_parport.c, comedi_rt_timer.c, daqboard2000.c, das08.c, + das16.c, das16m1.c, das1800.c, das6402.c, das800.c, dt2801.c, + dt2811.c, dt2814.c, dt2815.c, dt2817.c, dt282x.c, dt3000.c, + fl512.c, ii_pci20kc.c, mpc8260cpm.c, multiq3.c, ni_670x.c, + ni_at_a2150.c, ni_atmio.c, ni_atmio16d.c, ni_mio_cs.c, + ni_pcidio.c, ni_pcimio.c, pcl711.c, pcl724.c, pcl725.c, pcl726.c, + pcl812.c, pcl818.c, pcm3730.c, pcmad.c, poc.c, quatech_daqp_cs.c, + rtd520.c, rti800.c, rti802.c, skel.c: Moved driver documentation + to inline documentation + +2001-09-12 15:45 ds + + * comedi/drivers/check_driver: Added check for documentation in + source code + +2001-09-12 15:23 ds + + * Documentation/Configure.help: Removed VD_DDS + +2001-09-12 14:00 fmhess + + * comedi/drivers/ii_pci20kc.c: does still need to ioremap for 2.4 + kernels though + +2001-09-12 13:43 fmhess + + * comedi/drivers/ii_pci20kc.c: oops, apparently it's not even a pci + driver, that pci in the name tricked me + +2001-09-12 13:31 fmhess + + * comedi/drivers/ii_pci20kc.c: added comment regarding lack of pci + support & ioremap + +2001-09-12 13:13 fmhess + + * comedi/drivers/mite.c: added check/request/release_mem_region() + calls + +2001-09-11 17:05 fmhess + + * include/linux/: ioport.h, pci.h: added some compatibility macros + for pci-dma buffer related functions, stolen from Donald Becker's + starfire.c driver + +2001-09-11 16:46 fmhess + + * comedi/drivers/cb_pcidas64.c, include/linux/ioport.h: oops got + LINUX_VERSION_CODE mixed up with KERNEL_VERSION_CODE + +2001-09-10 13:45 fmhess + + * include/linux/ioport.h: made dummy release_mem_region() macro + consistent with a function that returns void. Reduces the number + of compiler warnings slightly. + +2001-09-09 14:38 fmhess + + * include/linux/ioport.h: new compatibility header for + *_mem_region() functions + +2001-09-07 18:23 fmhess + + * comedi/drivers/: cb_pcidas64.c, plx9060.h, plx9080.h: more work + on ai command, still not functional yet though + +2001-09-06 16:51 fmhess + + * comedi/drivers/: cb_pcidas64.c, plx9060.h: starting to add ai + command support, completely nonfunctional so far + +2001-09-06 14:43 fmhess + + * include/linux/pci.h: fix to get pci drivers to compile on 2.2 + kernel + +2001-09-06 12:47 fmhess + + * comedi/drivers/das16.c: fixed some typos causing null dereference + +2001-09-05 16:39 ds + + * include/linux/: module.h, pci.h: Added compat code for + MODULE_DEVICE_TABLE() + +2001-09-05 16:39 ds + + * comedi/drivers/daqboard2000.c: Added MODULE_DEVICE_TABLE() and + pci_enable_device() + +2001-09-05 16:38 ds + + * comedi/drivers/check_driver: Added check for pcibios_ code + +2001-09-05 16:38 ds + + * comedi/drivers/amplc_pci230.c: Fix compilation due to last + check-in + +2001-09-05 16:36 ds + + * scripts/config.dist: Added some drivers + +2001-09-05 16:35 ds + + * comedi/drivers/pcl711.c: Converted _mode2, _mode4 to command + +2001-09-05 16:35 ds + + * comedi/drivers/ni_pcidio.c: Pretended to convert _mode2 to a + command + +2001-09-05 16:34 ds + + * comedi/drivers/mpc8260cpm.c: Generic hacking + +2001-09-05 16:34 ds + + * comedi/drivers/: dt3000.c, rtd520.c: Added pci_enable_device() + +2001-09-05 16:33 ds + + * comedi/drivers/dt282x.c: Remove use of range_unknown + +2001-09-05 16:32 ds + + * TODO: fixed some stuff + +2001-09-03 18:23 ds + + * comedi/drivers/: amplc_pci230.c, cb_pcidas.c, cb_pcidas64.c, + cb_pcidda.c, das08.c, dt3000.c, ni_670x.c, ni_pcidio.c, + ni_pcimio.c, rtd520.c, skel.c: Added MODULE_DEVICE_TABLE() on a + bunch of drivers + +2001-09-03 17:35 ds + + * Documentation/comedi/drivers.txt: Added stub for amplc_pci230 + +2001-09-03 17:31 ds + + * comedi/drivers/: amplc_pci230.c, cb_pcidda.c, dt2801.c, dt2811.c, + pcl711.c, pcl726.c, pcl812.c, pcl818.c, pcmad.c, rtd520.c, + skel.c: Fix symbol leakage in a bunch of drivers + +2001-09-03 17:16 ds + + * comedi/drivers/check_driver: Added check for Makefile.in + +2001-09-03 17:14 ds + + * comedi/: Config.in, drivers/Makefile, drivers/Makefile.in, + drivers/check_driver: Fix typo in CONFIG_AMPLC_PCI230 + +2001-09-03 16:44 ds + + * comedi/drivers/daqboard2000.c: Update from Anders + +2001-09-03 16:43 ds + + * comedi/drivers/amplc_pci230.c: Update from Allan + +2001-08-28 16:23 ds + + * comedi/drivers/amplc_pci230.c: Update from Allan. + +2001-08-28 08:26 fmhess + + * Documentation/comedi/drivers.txt, comedi/drivers/das16.c: changed + configuration of input/output ranges to use microvolts instead of + volts so fractional voltages can be specified + +2001-08-27 17:02 fmhess + + * Documentation/comedi/drivers.txt: updated cb_pcidas, cb_pcidas64, + das16 entries + +2001-08-27 16:49 fmhess + + * comedi/drivers/das16.c: supports user configurable analog input + and output ranges. + +2001-08-27 14:36 fmhess + + * include/linux/: config.h, version.h: terminated with newline + +2001-08-27 14:32 fmhess + + * include/linux/: config.h, version.h: preventing multiple includes + +2001-08-27 14:05 fmhess + + * include/linux/fs.h: fixed version checking for 2.2 kernels + +2001-08-27 14:04 fmhess + + * include/linux/sched.h: fixed conflict with poll.h + +2001-08-27 02:58 ds + + * comedi/: comedi_fops.c, proc.c, kcomedilib/data.c, + kcomedilib/dio.c, kcomedilib/kcomedilib_main.c, + kcomedilib/ksyms.c: Fixes for compilation on 2.0.x + +2001-08-27 02:56 ds + + * Makefile.modbuild: Added -nostdinc flag. Comedi _should_ compile + with it. + +2001-08-27 02:55 ds + + * include/: asm/dma.h, linux/comedidev.h, linux/fs.h, linux/kmod.h, + linux/module.h, linux/poll.h, linux/sched.h, linux/spinlock.h, + linux/timer.h, linux/vmalloc.h: Fixes for compiling with 2.0.x + +2001-08-27 02:52 ds + + * Documentation/Configure.help.append: A copy of Configure.help, + for use with kbuild-2.5 + +2001-08-27 01:54 ds + + * comedi/drivers/ni_670x.c: New driver + +2001-08-26 16:23 fmhess + + * comedi/: Config.in, drivers/Makefile, drivers/Makefile.in, + drivers/cb_pcidas64.c: driver supports insn now, no command + support + +2001-08-25 16:49 fmhess + + * comedi/drivers/cb_pcidas64.c: skeleton of a new driver, doesn't + do anything yet. + +2001-08-24 13:15 fmhess + + * comedi/drivers/: cb_pcidas.c, das16.c, das1800.c, das800.c, + ni_at_a2150.c: fixed symbol leaks noted by check_driver + +2001-08-23 09:51 fmhess + + * comedi/drivers/comedi_rt_timer.c: converted analog out to + TRIG_INT + +2001-08-23 09:27 fmhess + + * comedi/drivers/amplc_pci230.c: added a comment + +2001-08-23 02:06 fmhess + + * comedi/drivers/: cb_pcidas.c, das1800.c: undid some changes i + made recently to placement of interrupt clearing in interrupt + handlers + +2001-08-22 22:51 ds + + * scripts/config.dist: update + +2001-08-22 22:51 ds + + * comedi/drivers/ni_pcidio.c: Disabled non-working code + +2001-08-22 22:50 ds + + * comedi/drivers/amplc_pci230.c: Cleanups. + +2001-08-22 22:47 ds + + * Documentation/comedi/drivers.txt: Fixed typo + +2001-08-22 22:47 ds + + * Documentation/comedi/drivers.txt, comedi/Config.in, + comedi/drivers/Makefile, comedi/drivers/Makefile.in: Added + ni_670x + +2001-08-22 21:54 fmhess + + * comedi/drivers/: cb_pcidas.c, dt282x.c, ni_at_a2150.c: forgot to + load up fifo in analog out inttrig, fixed typo in dt282x.c, + accidentally commited unknown changes to ni_at_a2150.c I'll have + to look at that :) + +2001-08-22 17:54 fmhess + + * comedi/drivers/cb_pcidas.c: tweak to analog out interrupt handler + +2001-08-22 17:24 ds + + * Documentation/comedi/drivers.txt: Updated dt282x + +2001-08-22 17:24 fmhess + + * comedi/drivers/cb_pcidas.c: converted to start_src TRIG_INT + +2001-08-22 17:11 ds + + * comedi/drivers/dt282x.c: Fixed analog output command to use + TRIG_INT + +2001-08-22 16:58 ds + + * comedi/comedi_fops.c: Removed buffer preloading from + comedi_write_v22(). Apps must now use start_src=TRIG_INT, issue + the command, then cause an internal trigger. + +2001-08-22 16:55 ds + + * comedi/drivers/ni_mio_common.c: Fixed streaming analog output. + Converted to using start_src=TRIG_INT + +2001-08-22 16:36 fmhess + + * comedi/drivers/cb_pcidas.c: experimental analog output command + support for 1602 series, and fixed bug in analog input insn that + i created earlier. + +2001-08-21 11:26 fmhess + + * comedi/drivers/das16.c: cleaned up id bit checking, fixed id bits + for keithley das16 boards (which was assumed the same as computer + boards das16, but is not). + +2001-08-21 08:31 fmhess + + * comedi/drivers/ni_pcidio.c: small change to interrupt handler so + it can be made shareable + +2001-08-19 22:01 fmhess + + * comedi/drivers/das1800.c: added support for poll(), and made a + bunch of other changes for 'no good reason', although it's a bit + more careful about flushing out all the data with stop_src + TRIG_EXT and dma now. Also, disabled non-conforming + interpretation of stop_arg for TRIG_EXT. + +2001-08-19 19:37 fmhess + + * Documentation/comedi/Hardware_Driver.HOWTO: added online version + of linux device drivers to reference list + +2001-08-19 17:49 ds + + * Documentation/comedi/Hardware_Driver.HOWTO: Updates from Robert + Schwebel. I also deleted a bunch of obsolete stuff and rewrote a + few bits that were only moderately wrong. + +2001-08-18 19:27 fmhess + + * comedi/drivers/das16m1.c: fixed clearing of irq flip flop in read + insn, so wait for end of conversion works properly + +2001-08-15 16:23 fmhess + + * comedi/drivers/comedi_rt_timer.c: changes from brent baccula, and + added a workaround to avoid weird gcc-2.95.2 bug that shows up + when compiled against rtlinux-3.1 + +2001-08-13 04:08 ds + + * comedi/comedi_fops.c: Define KILL_FASYNC() + +2001-08-13 04:08 ds + + * comedi/drivers/check_driver: Add check on .o file for symbol + leakage + +2001-08-13 04:07 ds + + * comedi/drivers/8255.c: Fix symbol leaks + +2001-08-13 03:33 ds + + * Config.in: Want to keep comedi in comedi/, not drivers/comedi/ + +2001-08-13 03:29 ds + + * comedi/: comedi_fops.c, comedi_ksyms.c, drivers.c, range.c: + Eliminated test on LINUX_V2x in favor of LINUX_VERSION_CODE + tests. + +2001-08-13 03:27 ds + + * include/linux/comedidev.h: Remove kern_compat, because it isn't + used anymore. Fixed COMEDI_RELEASE. Pendantry. + +2001-08-13 03:26 ds + + * include/linux/comedi_rt.h: Add error to check if included + directly + +2001-08-13 03:25 ds + + * comedi/drivers/mite.c: Fix Linux version dependencies + +2001-08-13 03:23 ds + + * comedi/: Makefile, rt.c: Initial priority IRQ support + +2001-08-13 03:21 ds + + * Makefile.in.append: Keep comedi in same directory for now + +2001-08-13 03:01 ds + + * comedi/kern_compat.h, include/linux/kern_compat.h: Move header + file to the place where header files belong + +2001-08-13 02:41 ds + + * include/linux/comedi_rt.h: Fix include of comedidev.h + +2001-08-13 02:39 ds + + * comedi/Config.in, scripts/config.in: Move define_bool for + CONFIG_COMEDI + +2001-08-13 02:35 ds + + * Config.in, Makefile.in.append, comedi/Makefile.in, + comedi/drivers/Makefile.in, comedi/kcomedilib/Makefile.in: Added + support for kbuild-2.5 + +2001-08-10 15:29 ds + + * comedi/drivers/ni_pcimio.c: Add board code for 6711, remove + boards that will never be supported + +2001-08-10 15:28 ds + + * comedi/drivers/ni_mio_cs.c: Add board code for DAQCard-6024E + +2001-08-10 15:28 ds + + * comedi/drivers/mite.c: Replace pci_enable_device and add + pci_set_master + +2001-08-10 15:27 ds + + * Documentation/comedi/insn_config: Moved some stuff to comedilib + sgml doc + +2001-08-10 15:26 ds + + * TODO: [no log message] + +2001-08-09 16:37 fmhess + + * comedi/drivers/: cb_pcidda.c, das08.c: took into account + possibility of pci_enable_device() failing + +2001-08-09 16:36 fmhess + + * comedi/drivers/cb_pcidas.c: added analog out insn for 1602 series + +2001-08-09 10:20 fmhess + + * comedi/drivers/cb_pcidas.c: fixed pci autodetection that could + have been confused by a second computer boards card being present + that was not supported by this driver. + +2001-08-09 09:45 fmhess + + * comedi/drivers/amplc_pci230.c: fix for 2.4 kernels, fix + uninitialized use of 'range' variable in pci230_ai_cmd() + +2001-08-09 02:10 ds + + * comedi/drivers/check_cmdtest: fixes for amplc_pci230.c + +2001-08-09 01:18 ds + + * comedi/Config.in: New driver + +2001-08-09 01:18 ds + + * comedi/drivers/: Makefile, amplc_pci230.c: A new driver from + Allan Willcox. + +2001-08-06 14:58 fmhess + + * Documentation/comedi/hardware: added pcidas-1602/16/jr entry + +2001-08-06 14:48 fmhess + + * comedi/drivers/cb_pcidas.c: added analog out insn for 1000 and + 1200 series + +2001-08-03 13:37 fmhess + + * comedi/drivers/cb_pcidas.c: fix for 16 bit cards with smaller 512 + sample fifo. some preparations for adding analog out support + +2001-08-02 11:06 fmhess + + * comedi/drivers/rtd520.c: fixed bug in cmdtest level 2 + +2001-08-01 19:05 fmhess + + * comedi/drivers/: cb_pcidda.c, rtd520.c, skel.c: removed a bunch + of unnecessary address-of operators which seem logically wrong, + although this don't have any actual effect since gcc just seems + to ignore them anyways. + +2001-08-01 18:33 fmhess + + * comedi/comedi_fops.c: making the common 'subdevice does not + support commands' debugging message slightly more informative + +2001-08-01 05:25 ds + + * include/linux/comedi.h: Rearrange flags used for both cmd and + trig. Added COMEDI_EV flags. + +2001-08-01 05:13 ds + + * comedi/drivers/: ni_mio_common.c, ni_pcimio.c: Enabled PCIDMA by + default. Moved various functions into #ifdefs on PCIDMA. Code + cleanup. Changed sign bit fixing sequences to be addition. + Removed interrupt enabling in ni_ai_insn_read(). + +2001-08-01 05:09 ds + + * Makefile: version bump + +2001-08-01 03:08 ds + + * comedi/drivers/ni_mio_common.c: Removed TRY_BLOCK code. + +2001-08-01 03:06 ds + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: Added beginning of + analog trigger support. Fixed dithering and deglitching. + Changed some board struct elements to boolean. + +2001-08-01 03:03 ds + + * comedi/drivers/ni_stc.h: A bunch of hopefully idempotent changes. + +2001-08-01 03:01 ds + + * comedi/drivers/: ni_atmio.c, ni_mio_common.c, ni_mio_cs.c, + ni_pcimio.c: A bunch of hopfully idempotent changes, mostly + cleanups. A few minor bugfixes. + +2001-07-30 13:36 ds + + * README: Fix typo + +2001-07-30 11:52 fmhess + + * comedi/drivers/cb_pcidas.c: added more dumping of debugging info + +2001-07-28 12:48 timousley + + * comedi/drivers/: mite.c, mite.h, ni_mio_common.c: MITE DMA works + with any size acquisition and any size buffer, although large + buffers are still best. + +2001-07-28 07:50 fmhess + + * comedi/drivers/cb_pcidda.c: added a pci_enable_device() call + +2001-07-27 13:35 fmhess + + * comedi/drivers/cb_pcidas.c: getting rid of premature interrupt + that occurs during attach, disabling burst mode unless the + chanlist actually has more than a single entry + +2001-07-27 11:54 fmhess + + * comedi/drivers/: pcl711.c, pcl818.c: removed nulling of s->busy + in driver + +2001-07-27 09:01 fmhess + + * comedi/drivers/cb_pcidas.c: silly me forgot to initialize + software count of number of conversions + +2001-07-27 08:34 fmhess + + * comedi/drivers/cb_pcidas.c: rounded up minimum conversion periods + so cmd test doesn't get stuck between returning 3 and 4 + +2001-07-26 15:43 ds + + * Documentation/comedi/FAQ: Updated with my least favorite + questions to answer. + +2001-07-26 15:28 ds + + * INSTALL: Make note of Red Hat kernel doc + +2001-07-26 15:26 ds + + * Documentation/comedi/redhat-notes: More info + +2001-07-26 06:16 ds + + * comedi/drivers/ni_mio_cs.c: Fix for PowerPC. I'd bet it breaks + i386. + +2001-07-26 06:14 ds + + * comedi/drivers/comedi_rt_timer.c: Fixes for RTAI. Change RT_TASK + to be kmalloc'ed instead of part of the devpriv structure because + of alignment issues. Switched to one-shot mode (for RTAI). + Changed task priority to not conflict with RTAI watchdog. More + careful about task init failure. + +2001-07-26 06:05 ds + + * include/linux/config.h: Fix to pull in the RTAI config.h + +2001-07-25 17:39 fmhess + + * comedi/drivers/pcl818.c: Change from Michal Dobes. Enables + shared interrupt for rtc, so multiple interrupt handlers can be + attached to its interrupt. It's wierd, but what the heck. + +2001-07-25 16:21 fmhess + + * comedi/rt.c: fix to prevent use of rt interrupt with shared + interrupt + +2001-07-24 09:35 fmhess + + * comedi/drivers/cb_pcidas.c: fixed analog input insn wait for end + of conversion, fixed external start trigger, tweaked interrupt + clearing. + +2001-07-24 03:38 ds + + * comedi/drivers/ni_mio_cs.c: Don't fail if PCMCIA version doesn't + match. + +2001-07-24 03:36 ds + + * include/linux/comedidev.h: subdevice structure elements do_lock + and do_unlock are unused, so comment them out + +2001-07-24 03:35 ds + + * comedi/kcomedilib/kcomedilib_main.c: Remove s->do_lock, + s->do_unlock + +2001-07-24 03:35 ds + + * comedi/drivers/ni_pcidio.c: Change some print's to DPRINTK's + +2001-07-24 03:34 ds + + * comedi/drivers/ni_atmio.c: fix typo in document number + +2001-07-24 03:33 ds + + * comedi/drivers/check_driver: Uncomment pci_enable_device check + +2001-07-24 03:33 ds + + * comedi/drivers/check_cmdtest: Cleanups, add check_timed() + +2001-07-24 03:32 ds + + * comedi/rt.c: #ifdef for some experimental RTAI code + +2001-07-23 17:28 fmhess + + * comedi/drivers/: das16.c, das1800.c, ni_at_a2150.c: added + virt_to_bus() translations to set_dma_addr() arguments + +2001-07-23 16:04 fmhess + + * comedi/drivers/pcl818.c: undid some of my changes, applying + michael dobe's patch with some fixes + +2001-07-23 15:04 fmhess + + * comedi/drivers/ni_at_a2150.c: drop attempted use of demand-mode + dma + +2001-07-23 11:50 fmhess + + * comedi/drivers/pcl818.c: bug fixes + +2001-07-23 11:47 ds + + * TODO: [no log message] + +2001-07-23 11:47 ds + + * comedi/: Config.in, drivers/pcl812.c: Update from Michal Dobes + +2001-07-23 11:46 ds + + * Documentation/: Configure.help, comedi/drivers.txt, + comedi/hardware: Updates from Michal Dobes + +2001-07-23 11:45 ds + + * Documentation/comedi/insn_config: Added some stuff + +2001-07-23 11:43 ds + + * comedi/drivers/rtd520.c: Patch from Dan + +2001-07-23 08:27 fmhess + + * comedi/drivers/cb_pcidas.c: more lines to clear that interrupt + +2001-07-22 15:00 fmhess + + * comedi/drivers/ni_at_a2150.c: comedi_cmd works now, added some + debugging info to insn + +2001-07-22 09:11 fmhess + + * comedi/drivers/ni_at_a2150.c: should work now, really. + +2001-07-22 09:10 fmhess + + * comedi/drivers/cb_pcidas.c: fixed compile error + +2001-07-21 22:02 fmhess + + * comedi/drivers/ni_at_a2150.c: added reset and sync of adc + circuitry to attach as recommened by manual + +2001-07-21 21:53 fmhess + + * comedi/drivers/ni_at_a2150.c: bug fixes + +2001-07-21 21:21 fmhess + + * comedi/drivers/ni_at_a2150.c: fixed channel selection bits that + had confused binary with hex + +2001-07-20 12:26 fmhess + + * Documentation/comedi/hardware: added a couple boards + +2001-07-20 12:18 fmhess + + * Documentation/comedi/drivers.txt: some updates + +2001-07-20 11:47 fmhess + + * Documentation/Configure.help: added a couple entries + +2001-07-20 11:40 fmhess + + * comedi/drivers/: cb_pcidas.c, das16m1.c, das1800.c, das800.c: + made chanlist cmdtests return 5 + +2001-07-20 11:37 fmhess + + * comedi/drivers/ni_at_a2150.c: added analog input insn + +2001-07-20 08:24 fmhess + + * comedi/drivers/mite.c: moved pci_enable_device to get rid of + statement with no effect' compiler warning + +2001-07-20 08:23 fmhess + + * comedi/drivers/: cb_pcidas.c, das08.c: 2.4 kernel pci fixes + +2001-07-19 15:13 ds + + * comedi/drivers/mite.c: Add pci_enable_device() + +2001-07-19 09:37 fmhess + + * comedi/drivers/pcl818.c: fixing some bitrot + +2001-07-18 15:57 fmhess + + * comedi/drivers/ni_at_a2150.c: added start_src TRIG_EXT and + stop_src TRIG_NONE + +2001-07-18 10:10 fmhess + + * comedi/drivers/cb_pcidas.c: fixed amcc s5933 interrupt clear so + it doesn't disable interrupts also + +2001-07-18 09:45 fmhess + + * comedi/drivers/cb_pcidas.c: interrupts are working, trying to get + them cleared properly now. + +2001-07-18 01:55 ds + + * comedi/drivers/ni_mio_common.c: Fixed high-bit problem for AO on + ao_unipolar=1 boards. + +2001-07-18 01:15 ds + + * Documentation/comedi/insn_config: Slap together some notes about + insn_config + +2001-07-16 08:48 fmhess + + * comedi/drivers/cb_pcidas.c: making progress now... + +2001-07-15 12:14 fmhess + + * comedi/drivers/das16.c: added to a comment + +2001-07-15 11:39 fmhess + + * comedi/drivers/ni_at_a2150.c: fixed typo in a2150_get_timing() + +2001-07-14 18:40 fmhess + + * comedi/drivers/8253.h: added rejection of count == 1 for mode 3, + added i8254_read() function + +2001-07-14 18:18 fmhess + + * comedi/drivers/das16.c: fixed bug in cmd_test + +2001-07-14 14:43 ds + + * comedi/rt.c: PowerPC has higher IRQ numbers. + +2001-07-14 14:42 ds + + * comedi/kvmem.c: Add some headers + +2001-07-14 14:41 ds + + * comedi/drivers/ni_at_a2150.c: Resolve conflict with function + defined in PPC kernel + +2001-07-14 14:39 ds + + * comedi/drivers/das16.c: Fix a little buglet in cmd_test + +2001-07-13 17:33 fmhess + + * comedi/drivers/das16m1.c: improved initialization to make sure + hardware conversion counter doesn't prevent comedi_cmd from + working, some other random changes + +2001-07-13 11:12 fmhess + + * comedi/drivers/cb_pcidas.c: added a little more debug info + +2001-07-13 10:41 fmhess + + * comedi/drivers/cb_pcidas.c: oops, last time I was looking at the + section of the manual that described the s5920 instead of the + s5933 section + +2001-07-12 18:55 ds + + * include/linux/pci.h: Added pci_enable_device() + +2001-07-12 09:24 fmhess + + * comedi/drivers/cb_pcidas.c: trying to get interrupts enabled on + the amcc s5933... + +2001-07-11 12:01 ds + + * comedi/kcomedilib/kcomedilib_main.c: Added INSN_CONFIG to insn + parsing. + +2001-07-10 15:28 fmhess + + * comedi/drivers/comedi_rt_timer.c: fixed detection of analog input + or output subdevice + +2001-07-10 15:12 ds + + * comedi/drivers.c: Fix problem with DO subdevices in + insn_rw_emulate_bits() + +2001-07-10 14:59 fmhess + + * comedi/drivers/das16.c: set sdf readable flag for digital output + +2001-07-10 14:47 ds + + * TODO, scripts/config.dist: [no log message] + +2001-07-10 14:46 ds + + * Documentation/comedi/pci.ids: Needs more help + +2001-07-10 14:42 ds + + * comedi/drivers/check_cmdtest: Perl rocks my world + +2001-07-10 14:32 ds + + * comedi/drivers/: ni_atmio.c, ni_mio_common.c, ni_mio_cs.c, + ni_pcimio.c, ni_stc.h: Fix memory leak with caldac maxdata list. + Changed init of AI_Personal_Register to 0xa420. Could cause + problems. + +2001-07-10 14:28 ds + + * comedi/drivers/daqboard2000.c: Fix buffer overrun problem + +2001-07-10 14:27 ds + + * comedi/drivers/check_driver: Become more evil about checking for + instruction support + +2001-07-10 14:26 ds + + * comedi/drivers/rtd520.c: Fix cmdtest logic bug + +2001-07-10 14:25 ds + + * comedi/drivers/pcl724.c: Add a check_driver override + +2001-07-10 14:23 ds + + * comedi/drivers/: cb_pcidas.c, cb_pcidda.c: Fix cmdtest logic bug + +2001-07-10 14:20 ds + + * comedi/drivers/: adl_pci9118.c, adv_pci1710.c: Split + check_and_setup_channel_list() into separate functions + +2001-07-10 14:19 ds + + * comedi/drivers/8253.h: Added wrapper defs for cmdtest + +2001-07-10 14:11 ds + + * Documentation/comedi/drivers.txt: Added chunk for ni_at_a2150 + +2001-07-10 14:04 ds + + * comedi/Config.in, Documentation/comedi/drivers.txt: Remove old + drivers + +2001-07-10 14:03 ds + + * comedi/drivers/Makefile: Removed -old drivers + +2001-07-10 14:02 ds + + * comedi/drivers/: das08-old.c, das08jr-old.c, das16-old.c, + das1600-old.c: So long, you served well. + +2001-07-10 13:22 ds + + * comedi/drivers/skel.c: Add len_chanlist initialization + +2001-07-10 13:22 ds + + * include/linux/comedidev.h: Fix len_chanlist comment + +2001-07-10 09:34 fmhess + + * comedi/drivers/cb_pcidas.c: merged ivan's changes with mine + +2001-07-09 14:13 fmhess + + * comedi/drivers/cb_pcidas.c: added initialization of + s->len_chanlist + +2001-07-09 11:38 fmhess + + * comedi/drivers/cb_pcidda.c: oops forgot to include header file + +2001-07-09 11:38 fmhess + + * comedi/drivers/cb_pcidda.c: added 2 8255 digital io subdevices + +2001-07-09 11:26 fmhess + + * comedi/drivers/cb_pcidda.c: fixed attach/detach so ioports are + only released if they were successfully allocated + +2001-07-08 16:07 fmhess + + * comedi/drivers/ni_at_a2150.c: debugging moves slowly forward... + +2001-07-08 15:43 fmhess + + * comedi/drivers/cb_pcidas.c: put if(cmd->chanlist) block in + cmdtest + +2001-07-08 15:41 fmhess + + * comedi/drivers/das16m1.c: made digital output readable + +2001-07-08 15:40 fmhess + + * comedi/drivers/das1800.c: put if(cmd->chanlist) block in cmdtest, + dropped digital io read/write insn that have been replaced by + insn_bits. Made digital output readable. + +2001-07-08 15:27 fmhess + + * comedi/drivers/das800.c: put if(cmd->chanlist) block in cmdtest + to prevent segfault with comedi_test. Chucked old digital io + insn_read and insn_write since there is an insn_bits. Added + SUBD_READABLE flag to digital output device. + +2001-07-08 14:46 ds + + * comedi/drivers/das16.c: Fixed oops in das16_cmd_test() because + cmd->chanlist was NULL. + +2001-07-06 13:13 ds + + * Documentation/comedi/drivers.txt: Update from ivan + +2001-07-06 08:22 fmhess + + * comedi/drivers/ni_at_a2150.c: fixed cmdtest + +2001-07-05 09:01 fmhess + + * comedi/comedi_fops.c: changed declaration of bufinfo spinlock to + static. This doesn't actually matter, since it is only there to + prevent interrupts, but makes the code look less buggy. + +2001-07-05 08:55 fmhess + + * comedi/trig.c: fix for trig emulation by cmd + +2001-07-04 22:34 ds + + * comedi/drivers/ni_mio_common.c: Remove duplicate code + +2001-07-04 22:33 ds + + * comedi/comedi_fops.c, comedi/drivers.c, + include/linux/comedidev.h: Rewrote checking in comedi_fop_open(), + fixed spinlock init problem. + +2001-07-04 22:29 ds + + * comedi/drivers/mite.c: Fix Oops when reporting 0 boards. + +2001-07-04 13:36 fmhess + + * comedi/drivers/das16.c: added pc104 board definitions, fixed + das16/330 definition + +2001-07-04 12:12 fmhess + + * comedi/drivers/: cb_pcidas.c, das16.c, das1800.c, ni_at_a2150.c: + 2.4.6 kernel linux/mm.h does not define GFP_BUFFER... + +2001-07-03 14:11 fmhess + + * comedi/: Config.in, drivers/Makefile, drivers/ni_at_a2150.c: new + driver, untested + +2001-07-02 17:31 ds + + * comedi/drivers/check_driver: Check for dos-like end of line + +2001-07-02 17:04 ds + + * comedi/drivers/ni_mio_common.c: I'm gunna hafta start kickin' + some asses if files are checked in with CR/LF end-of-lines. + +2001-07-02 16:59 fmhess + + * comedi/drivers/8253.h: masked flags in divisor functions, so + argument doesn't need to be masked before passing to functions + +2001-07-02 16:57 ds + + * Contributors: Added ivan + +2001-07-02 16:57 fmhess + + * comedi/drivers/: das1800.c, das800.c: removed some unnecessary + lines from command tests + +2001-07-02 16:57 ds + + * TODO: random todo checkin + +2001-07-01 20:33 fmhess + + * comedi/drivers/das16.c: oops, small mistake won't make any + difference but might as well be correct + +2001-07-01 20:16 fmhess + + * comedi/drivers/das16.c: fix for possible weirdness in ai read + insn + +2001-06-30 17:02 ds + + * comedi/drivers/cb_pcidda.c: Update from Ivan + +2001-06-28 16:33 ds + + * scripts/: config.dist, config.in: Heh. revert change to + config.in and apply to config.dist + +2001-06-28 16:31 ds + + * scripts/config.in: Update + +2001-06-28 16:31 ds + + * comedi/drivers/cb_pcidas.c: Fix compilation for PCI code + +2001-06-28 15:22 ds + + * include/linux/comedi.h: Added TRIG_OTHER + +2001-06-27 15:07 ds + + * Makefile.modbuild: Change MOD_INSTALL_PATH to INSTALL_MOD_PATH + +2001-06-27 12:08 ds + + * Documentation/comedi/drivers.txt, comedi/Config.in, + comedi/drivers/Makefile: Updates for cb_pcidda driver + +2001-06-27 12:06 ds + + * comedi/drivers/cb_pcidda.c: New driver from Ivan Martinez + +2001-06-27 10:27 fmhess + + * comedi/drivers/: das16.c, das16m1.c, das800.c, poc.c: minor + updates + +2001-06-27 09:29 fmhess + + * comedi/drivers/cb_pcidas.c: fix for stop_src == TRIG_NONE + +2001-06-26 11:38 fmhess + + * comedi/drivers/cb_pcidas.c: added support for external + triggering/pacing and burst mode + +2001-06-26 09:27 fmhess + + * comedi/drivers/pcm3730.c: fixed include that prevented compile + +2001-06-26 09:26 fmhess + + * comedi/drivers/Makefile: fixed typo for pcm3730 + +2001-06-25 18:27 fmhess + + * comedi/drivers/das16.c: scapped autoprobe, which was ultimately + unable to distinguish boards, changed it into just a check that + id bits are consistent with user's board selection. + +2001-06-25 15:36 fmhess + + * comedi/drivers/das1800.c: I recently stumbled across an + explanation of why you clear the dma flip-flop... + +2001-06-25 12:37 ds + + * comedi/drivers/pcm3730.c: Fix typo. + +2001-06-25 12:23 fmhess + + * Documentation/comedi/hardware: updated some entries for das16 and + cb_pcidas + +2001-06-25 11:46 fmhess + + * comedi/drivers/das16.c: fixes for burst mode, added das1201 + das1202 entries. Autoprobing of board types is weak, that needs + to be fixed. + +2001-06-25 10:18 fmhess + + * Documentation/comedi/drivers.txt: updated das16 and cb-pcidas + info + +2001-06-25 10:05 fmhess + + * comedi/drivers/das16.c: added support for das1600 burst mode + +2001-06-25 10:05 fmhess + + * comedi/drivers/skel.c: fixed error, added some comments + +2001-06-23 18:45 fmhess + + * comedi/drivers/cb_pcidas.c: fixed a bug I created + +2001-06-23 18:32 fmhess + + * comedi/drivers/cb_pcidas.c: added preliminary comedi_cmd support. + Untested. + +2001-06-23 18:18 fmhess + + * comedi/drivers/das16.c: entered correct max conversion rates + +2001-06-23 14:56 fmhess + + * comedi/drivers/das16.c: fixed settings of master clock speed + through options + +2001-06-23 11:11 fmhess + + * comedi/drivers/: das16.c, das16m1.c, das1800.c: fixed bugs with + master clock speed in hertz instead of nanosec, added isa dma + initialization code that I forgot to put in + +2001-06-22 16:34 fmhess + + * comedi/drivers/das16.c: overhaul of comedi_cmd support. Needs + more work, but ready for initial testing (Chris Baugher said he'd + give it a test run.) + +2001-06-22 08:50 fmhess + + * Documentation/comedi/drivers.txt, comedi/drivers/das1800.c: dma + is no longer disabled in das1800 driver when rt suppport is + configured for comedi. dma is instead disabled on a cmd by cmd + basis when the TRIG_RT flag is received. + +2001-06-21 15:43 ds + + * comedi/drivers/comedi_parport.c: Fix header + +2001-06-21 15:43 ds + + * comedi/drivers/check_driver: Check for CONFIG_ in Makefile and + Config.in + +2001-06-21 15:42 ds + + * comedi/: Config.in, drivers/Makefile: Add PCM3730, which should + have been there all along + +2001-06-21 15:42 ds + + * TODO: [no log message] + +2001-06-21 14:54 ds + + * Documentation/comedi/drivers.txt: Major documentation update. + +2001-06-21 13:59 fmhess + + * comedi/drivers/: adl_pci9118.c, adv_pci1710.c, daqboard2000.c, + das08.c, das16.c, das16m1.c, ni_atmio.c, ni_atmio16d.c, + ni_mio_common.c, ni_mio_cs.c, ni_pcidio.c, ni_pcimio.c, pcl711.c, + pcl724.c, pcl812.c, pcl818.c, rti800.c: changed a bunch of + #include to #include "blah.h" so that make dep catches + the dependencies + +2001-06-21 13:58 fmhess + + * comedi/drivers/8253.h: added memory-mapped io version of + i8254_load(), made i8253_cascade_ns_to_timer_2div() return early + if everything is already correct instead of going through loop + again + +2001-06-21 13:53 ds + + * comedi/drivers/check_driver: Add some documentation checks + +2001-06-21 11:23 fmhess + + * Documentation/Configure.help, + Documentation/comedi/Hardware_Driver.HOWTO, + Documentation/comedi/drivers.txt, Documentation/comedi/hardware, + comedi/drivers/das16m1.c: added a little das16m1 documentation + +2001-06-21 10:53 ds + + * comedi/comedi_fops.c: Added COMEDI_INSN ioctl() + +2001-06-21 10:53 ds + + * TODO: [no log message] + +2001-06-21 10:43 ds + + * scripts/config.dist: update + +2001-06-21 10:42 ds + + * README: Changed wording w.r.t. mailing list + +2001-06-20 16:41 fmhess + + * comedi/drivers/das16m1.c: added some external triggering support + +2001-06-20 14:58 fmhess + + * comedi/drivers/das16.c: fixed digital input and output insns + +2001-06-20 13:19 fmhess + + * comedi/drivers/das16m1.c: implemented insns, everything seems to + work okay so far + +2001-06-20 12:15 fmhess + + * comedi/drivers/das16.c: fixed bug. This driver has some other + bugs/problems I intend to get to eventually, although I will need + someone with an actual das-16 card to do quality assurance for + me. + +2001-06-20 09:05 fmhess + + * comedi/drivers/das16m1.c: Doesn't crash computer anymore, and + asynchronous analog input seems to work now + +2001-06-19 16:28 fmhess + + * comedi/: Config.in, drivers/Makefile, drivers/das16m1.c: added + das16m1 driver, compiles with warnings but completely untested. + insns not yet implemented. + +2001-06-19 12:35 fmhess + + * comedi/drivers/: 8253.h, das1800.c, das800.c: put generic + i8254_load function in 8253.h for loading a 8254 counter + +2001-06-19 09:16 fmhess + + * comedi/drivers/das800.c: fixed bit mangling in analog input read + insn for 16 bit das802/16 + +2001-06-18 15:32 fmhess + + * comedi/drivers/: comedi_rt_timer.c, das1800.c, das800.c: declared + some variables as volatile to be safe + +2001-06-13 14:25 fmhess + + * INSTALL: minor corrections + +2001-06-13 03:22 ds + + * INSTALL, INSTALL.RTAI, INSTALL.RTLinux, README: Rewrote INSTALL + and README + +2001-06-11 15:38 fmhess + + * comedi/drivers/das800.c: fix to bug in fifo overflow check I + created with last revision + +2001-06-11 13:36 fmhess + + * comedi/drivers/comedi_rt_timer.c: switched to use async->event + and comedi_event(), and to use comedi_buf_put() and + comedi_buf_get() + +2001-06-11 11:58 fmhess + + * comedi/drivers/das1800.c: switched to use of async->events and + comedi_event(), started using comedi_buf_put, fixed bug when + using dma where number of points remaining to be taken was + decremented twice for each point taken + +2001-06-11 11:44 fmhess + + * comedi/drivers/das800.c: moved fifo overflow check back outside + of loop where it belongs, switched over to use of async->events + and comedi_event(), started using generic comedi_buf_put() to + transfer data + +2001-06-11 00:53 ds + + * include/linux/comedi.h: Replace TRIG_INVALID + +2001-06-10 15:56 fmhess + + * include/linux/comedidev.h: changed prototype of comedi_buf_get a + bit + +2001-06-10 13:32 fmhess + + * include/linux/comedidev.h: defined generic inline functions for + writing/reading a data point to/from comedi's buffer + +2001-06-10 09:01 fmhess + + * comedi/drivers/das800.c: removed spurious warning that would have + occured with cio-das802/16. Sidenote: earlier revision 1.30 that + I made to fix a race condition was unnecessay, race only existed + in an intermediate form of the code which was never commited. + +2001-06-09 15:36 fmhess + + * Documentation/comedi/hardware: added cards from rtd520 driver + +2001-06-09 15:24 fmhess + + * Documentation/comedi/drivers.txt, Documentation/comedi/hardware, + comedi/drivers/das800.c: added support for cio-das802/16 to + das800 driver + +2001-06-09 13:07 fmhess + + * comedi/drivers/das800.c: fixed race between conversions and fifo + overflow check + +2001-06-08 15:38 ds + + * Makefile: version bump + +2001-06-08 15:38 ds + + * patches/rel_comedi: Fix sed line for version update + +2001-06-08 15:37 ds + + * comedi/proc.c: /proc/comedi dumps out the device names recognized + for each driver + +2001-06-08 15:36 ds + + * Documentation/comedi/counter-spec: More busy-talk about counters + +2001-06-08 15:35 ds + + * comedi/drivers/ni_mio_common.c: Added internal trigger support, + various reformatting + +2001-06-08 15:34 ds + + * comedi/drivers/Makefile: Added make check rule. + +2001-06-08 15:33 ds + + * include/linux/comedi.h, include/linux/comedidev.h, + comedi/comedi_fops.c: Added internal trigger support + +2001-06-08 14:43 fmhess + + * comedi/kcomedilib/: dio.c, ksyms.c: fixes for kcomedilib with + trigger support off. comedi_dio_config() was using trigger code + instead of insn, I assumed there was no good reason for this such + as the insn code not working. + +2001-06-07 17:06 ds + + * INSTALL: Added comments about 2.0 + +2001-06-07 16:36 fmhess + + * include/linux/version.h: attempting to fix 2.0 kernels that don't + seem to define KERNEL_VERSION(a,b,c) + +2001-06-07 10:52 fmhess + + * comedi/drivers/comedi_rt_timer.c: tweak to make rt_task clean + itself up without one scan delay + +2001-06-04 15:42 ds + + * comedi/drivers/das08.c: Reverted the variable timeout part of the + last change. + +2001-06-04 15:30 ds + + * comedi/drivers/das08.c: Patch for das08jr/16 from Luke Stras + + +2001-06-04 15:03 fmhess + + * comedi/drivers/comedi_rt_timer.c: merged input and output scan + tasks, kept more careful track of status of rt tasks + +2001-06-03 19:16 fmhess + + * comedi/drivers/comedi_rt_timer.c: fixed conversion timing check + for TRIG_NOW case + +2001-06-03 19:13 fmhess + + * comedi/drivers/comedi_rt_timer.c: added check on conversion + timing + +2001-06-03 18:45 fmhess + + * comedi/drivers/comedi_rt_timer.c: switched priorities of + scan_task and rt_task to prevent strange 5 millisec timing errors + that would occassionaly occur + +2001-06-02 16:54 fmhess + + * comedi/drivers/comedi_rt_timer.c: removed redundant unlock + +2001-06-02 15:32 fmhess + + * comedi/drivers/comedi_rt_timer.c: moved creation/deletion of real + time tasks from comedi_cmd code to attach/detach + +2001-06-01 21:04 fmhess + + * comedi/drivers/comedi_rt_timer.c: fixes, chucked rt_pend_call(), + added check for good scan timing and increased allowable + frequency + +2001-06-01 09:07 fmhess + + * comedi/drivers/comedi_rt_timer.c: conversion frequency and scan + frequency can now be set independently + +2001-05-31 16:24 fmhess + + * comedi/drivers/das1800.c: tweak + +2001-05-30 14:38 fmhess + + * comedi/drivers/das1800.c: added support for TRIG_WAKE_EOS command + flag + +2001-05-30 13:27 ds + + * comedi/drivers/check_driver: Added check for functions replaced + by comedi_event() + +2001-05-30 09:55 fmhess + + * scripts/config.dist: added line for das1600-old so it is not + marked as (NEW) by default + +2001-05-30 09:50 fmhess + + * scripts/config.dist: made default for trigger support config + match suggestion of 'just say yes' + +2001-05-27 20:58 fmhess + + * comedi/comedi_fops.c: added a do_become_nonbusy() when all the + data is marked as being read (presumably via a mmap) instead of + being read in the conventional way + +2001-05-27 20:55 fmhess + + * comedi/drivers/comedi_rt_timer.c: small cleanup, ifdef'd hack to + expire with next rtlinux version where it should no longer be + required + +2001-05-27 17:29 ds + + * patches/patch-rtai: patch for possible rtai changes + +2001-05-27 17:26 ds + + * patches/patch-bufconfig: patch has been merged + +2001-05-27 17:26 ds + + * patches/: comedi-rtl-irq-tm.patch, patch-pcmad, pcmad.c: patches + have been merged + +2001-05-27 17:25 ds + + * TODO: [no log message] + +2001-05-27 17:10 ds + + * comedi/trig.c: Major simplification of trig[0] path + +2001-05-27 17:08 ds + + * comedi/drivers/pcmad.c: Update pcmad driver for Comedi changes in + the last year. + +2001-05-27 16:56 ds + + * comedi/drivers/: Makefile, pcmad.c: Merged pcmad driver + +2001-05-27 16:56 ds + + * comedi/Config.in: Merged PCMAD driver + +2001-05-27 16:16 ds + + * comedi/trig.c: Last remnant of trig[0]. Calls emulation function + directly. + +2001-05-27 16:13 ds + + * comedi/: comedi_fops.c, trig.c: Moved trig-related code from + comedi_fops.c to trig.c + +2001-05-27 16:12 ds + + * comedi/dummy.c: This should have been removed a long time ago. + +2001-05-27 16:03 ds + + * comedi/Config.in, comedi/Makefile, comedi/comedi_fops.c, + comedi/drivers.c, comedi/trig.c, + comedi/kcomedilib/kcomedilib_main.c, include/linux/comedidev.h: + Moved trig compatibility functions from drivers.c to trig.c. + Wrapped all trig related code in CONFIG_COMEDI_TRIG. Added + config option for CONFIG_COMEDI_TRIG. + +2001-05-27 15:35 ds + + * comedi/drivers/: das08.c, das6402.c, ni_pcidio.c, pcl711.c, + pcl812.c, pcl818.c: ifdef all the remaining trig related code + +2001-05-27 15:32 ds + + * Documentation/comedi/configuration: docs out of date + +2001-05-27 14:48 ds + + * comedi/drivers.c: removed insn emulation using trig[0] + +2001-05-27 14:13 ds + + * comedi/drivers/: das6402.c, multiq3.c, ni_atmio16d.c: Cleanups, + insn migration + +2001-05-27 14:13 ds + + * comedi/drivers/check_driver: Fix a couple checks, add comments + +2001-05-27 13:23 ds + + * patches/rel_comedi: fix for EXTRAVERSION + +2001-05-25 15:05 fmhess + + * Documentation/comedi/hardware: added pci-das08 and pci-das1200 + entries + +2001-05-25 14:59 fmhess + + * Documentation/comedi/drivers.txt: updates + +2001-05-25 14:43 fmhess + + * comedi/drivers/: cb_pcidas.c, rtd520.c: fix so cards on bus 0 can + be chosen through configuration options + +2001-05-25 14:39 fmhess + + * comedi/drivers/das08.c: added support for pci-das08 card + +2001-05-24 19:24 ds + + * comedi/kcomedilib/kcomedilib_main.c: fixed overwriting of + cb_mask. + +2001-05-24 19:01 ds + + * comedi/: kvmem.h, drivers/mite.c, drivers/pcl818.c: Compilation + fixes on powerpc + +2001-05-24 12:01 ds + + * Documentation/comedi/redhat-notes: Added email from Dan Christian + about Red Hat + +2001-05-23 18:41 ds + + * comedi/: comedi_ksyms.c, drivers.c: removed di_unpack, do_pack. + +2001-05-23 18:28 ds + + * comedi/drivers/: 8255.c, 8255.h, adl_pci9118.c, comedi_parport.c, + comedi_rt_timer.c, daqboard2000.c, das08.c, das16.c, das1800.c, + das6402.c, das800.c, dt2814.c, dt282x.c, fl512.c, multiq3.c, + ni_atmio.c, ni_atmio16d.c, ni_mio_common.c, ni_pcidio.c, + ni_pcimio.c, pcl711.c, pcl724.c, rti802.c, skel.c: Code cleanup, + mainly things noticed by check_driver. A couple of the drivers + were converted to insn. + +2001-05-23 17:47 ds + + * comedi/drivers/check_driver: new tests + +2001-05-23 17:47 ds + + * TODO: [no log message] + +2001-05-20 21:50 fmhess + + * comedi/kcomedilib/kcomedilib_main.c: marked (but did not fix =) a + couple bugs + +2001-05-19 13:46 fmhess + + * comedi/: rt.c, drivers/comedi_rt_timer.c: fixed problem with + comedi_switch_to_rt() and irq-less comedi_rt_timer driver + +2001-05-18 21:15 fmhess + + * comedi/comedi_ksyms.c, comedi/drivers/comedi_rt_timer.c, + include/linux/comedi_rt.h: exported rt_pend_call() so that + comedi_rt_timer can be configured multiple times + +2001-05-18 12:25 timousley + + * comedi/drivers/: mite.c, ni_mio_common.c: MITE DMA data is now + unsigned short instead of twos complement. Also fixed bug where + the ISR would try to poll the STC fifo instead of letting the + MITE retrieve the data. + +2001-05-15 21:58 fmhess + + * comedi/drivers/comedi_rt_timer.c: improved error handling a bit + +2001-05-15 13:07 timousley + + * comedi/drivers/ni_pcidio.c: added PXI-6533 support. + +2001-05-14 13:53 timousley + + * comedi/drivers/ni_pcimio.c: added card IDs and descriptions for + several PXI cards: PXI-6071, PXI-6070, PXI-6052, PXI-6040, + PXI-6030, PXI-6025 + +2001-05-14 07:45 fmhess + + * comedi/drivers/comedi_rt_timer.c: put start_rt_timer()back for + rtai, as it looks like its needed but im not sure, put in some + compatibility defines to reduce number of #ifdef CONFIG_COMEDI* + statements + +2001-05-14 05:10 ds + + * comedi/drivers/: ni_mio_common.c, ni_pcimio.c, ni_stc.h: 602x + doesn't have unipolar AI. + +2001-05-14 02:34 ds + + * comedi/drivers/rtd520.c: Update from Dan + +2001-05-13 17:12 fmhess + + * Documentation/Configure.help: added comedi_rt_timer description + +2001-05-13 16:41 fmhess + + * comedi/drivers/comedi_rt_timer.c: bug fixes, analog output + commands work now! Added scan_begin_src==TRIG_FOLLOW, + convert_src==TRIG_TIMER. TRIG_RT flag was causing null + dereferences, that is fixed now from user space, but NOT when + command is called from kernel space. + +2001-05-13 11:19 fmhess + + * comedi/drivers/poc.c: fixed bug due to typo + +2001-05-11 17:00 fmhess + + * comedi/drivers/comedi_rt_timer.c: fixed spurious EINVAL errors on + read and possibility of never becoming_nonbusy + +2001-05-11 16:24 fmhess + + * comedi/drivers/comedi_rt_timer.c: now it is fixed for real. Had + to redefine rt_get_time() which still called broken HRT_TO_8254() + function. + +2001-05-11 13:18 timousley + + * comedi/drivers/: mite.c, ni_mio_common.c, ni_stc.h: MITE does + continuous AI now. Fixed bug so MIO cards can go 1.25MS/s. + Fixed some assorted MITE bugs. + +2001-05-11 09:00 fmhess + + * comedi/drivers/comedi_rt_timer.c: nano2tick_hack() now gives + exactly correct answer (rounded down to nearest integer) + +2001-05-11 07:58 fmhess + + * comedi/comedi_fops.c: rolling back last change + +2001-05-10 21:29 fmhess + + * comedi/drivers/comedi_rt_timer.c: added hack to fix broken + rtlinux compatibility headers and let driver work for more than a + half hour + +2001-05-10 16:12 fmhess + + * comedi/drivers/comedi_rt_timer.c: some fixes, still gives divide + error / segfault on rt_task_make periodic after about a half hour + +2001-05-10 13:30 fmhess + + * comedi/comedi_fops.c: changed order or error check in read_v22() + to get rid of spurious EINVAL errors when using comedi_rt_timer + +2001-05-10 10:47 fmhess + + * comedi/drivers/comedi_rt_timer.c: fixed dereferencing of + chanlist, hopefully this will also fix the occasional segfaults + +2001-05-10 09:47 fmhess + + * comedi/drivers/comedi_rt_timer.c: fixed clearing of async->events + +2001-05-10 09:41 timousley + + * comedi/drivers/ni_mio_common.c: ni_ai_setup_MITE_dma() now + configures MITE for correct # of bytes. mite interrupt handler + now stops blocking when the MITE transfers a chunk of data. + handle_a_interrupt() does not stop the MITE prematurely (when STC + generates a SC.TC. interrupt) + +2001-05-10 08:30 fmhess + + * comedi/drivers/comedi_rt_timer.c: fixed a bug I created, noticed + that commands only work right the first try. Second try command + seems to start, then abort after 1 or a few samples then (from + /proc/interrupts) start again and finish. + +2001-05-10 03:18 ds + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: minor cleanups + +2001-05-10 03:16 ds + + * comedi/drivers/ni_mio_common.c: Minor cleanups Added ioctl poll + support Fixed AO cmdtest logic bug + +2001-05-10 03:15 ds + + * comedi/comedi_fops.c: Added poll ioctl Moved checking code into + common area Minor cleanups + +2001-05-10 03:12 ds + + * comedi/drivers/pcl818.c: Migrated from mode0 to insn + +2001-05-10 03:09 ds + + * comedi/Config.in, comedi/drivers/Makefile, scripts/config.dist: + added rtd520 driver + +2001-05-10 03:08 ds + + * Contributors: added + +2001-05-10 02:59 ds + + * comedi/drivers/rtd520.c: Update from Dan + +2001-05-10 02:57 ds + + * comedi/drivers/: rtd520.c, rtd520.h: Added driver from Dan + Christian + +2001-05-09 18:36 fmhess + + * comedi/drivers/comedi_rt_timer.c: added support for analog output + commands. Untested except to check that analog input still + works. + +2001-05-07 15:04 timousley + + * comedi/drivers/mite.c: oops, undid my last change. no more + continuous DMA, but much more stable. + +2001-05-07 13:11 timousley + + * comedi/drivers/mite.c: continuous analog acquisition using + MITE... + +2001-05-07 09:48 fmhess + + * comedi/drivers/das1800.c: dealt with possible race between + interrupt fifio half-full and external stop trigger + +2001-05-07 08:58 fmhess + + * comedi/kcomedilib/kcomedilib_main.c: added delarations of ret + variable in comedi_map and unmap + +2001-05-05 04:35 ds + + * include/linux/: comedi.h, comedilib.h: Added comedi_map, + comedi_unmap, comedi_poll + +2001-05-05 04:35 ds + + * comedi/kcomedilib/: kcomedilib_main.c, ksyms.c: Added comedi_map, + comedi_unmap + +2001-05-04 18:06 fmhess + + * Documentation/Configure.help: added entries for das800 and + das1800 drivers + +2001-05-04 17:51 fmhess + + * comedi/drivers/das800.c: fixed null dereference that occured when + interrupt was handled before driver was fully attached + +2001-05-04 16:32 fmhess + + * comedi/comedi_fops.c, include/linux/comedi_rt.h: restored include + of comedidev.h from comedi_rt.h so that spin locks can be used + through including comedi_rt.h instead of having to go through + comedidev.h. This include was originally removed due to circular + dependence between comedidev.h and comedi_rt.h but they're just + header files so it doesn't seem to matter. + +2001-05-04 15:19 fmhess + + * comedi/drivers/comedi_rt_timer.c: bug fixes, seems to work + +2001-05-04 09:24 timousley + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: fixed bug with + innaccurate pulse width measurement, and GPCT_Reset() does not + affect the other counter now. + +2001-05-03 09:58 fmhess + + * comedi/comedi_fops.c: fixed trig modes > 0 for using cur_trig-> + instead of async-> + +2001-05-03 09:50 fmhess + + * comedi/kcomedilib/kcomedilib_main.c: dealt with switch from + cur_trig->data, etc to async->data, etc + +2001-05-03 09:24 fmhess + + * comedi/drivers/comedi_rt_timer.c: added some comments on what + look like bugs + +2001-05-02 14:50 timousley + + * comedi/drivers/ni_mio_common.c: fixed bug where pulsewidth meas. + armed incorrectly + +2001-05-02 12:39 timousley + + * comedi/drivers/ni_mio_common.c, comedi/drivers/ni_stc.h, + include/linux/comedi.h: changed GPCTR to GPCT and gpctr to gpct. + +2001-05-02 11:17 fmhess + + * include/linux/comedi_errno.h: comedi specific error codes to be + used in comedilib only so this header unnecessary here + +2001-05-01 17:08 fmhess + + * include/linux/comedi_errno.h: a small step towards standardized + comedi error codes + +2001-05-01 14:53 timousley + + * comedi/drivers/ni_mio_common.c, comedi/drivers/ni_pcimio.c, + include/linux/comedi.h: GPCTR compiles by default, #defined insn + to get internal gpctr timebase + +2001-05-01 13:50 fmhess + + * LICENSE: renmaed to COPYING + +2001-05-01 13:50 fmhess + + * COPYING: named GPL file COPYING instead of LICENSE + +2001-05-01 13:47 fmhess + + * LICENSE: added copy of GPL + +2001-05-01 12:51 timousley + + * comedi/drivers/ni_mio_common.c: fixed bug with gating. + +2001-04-28 09:24 ds + + * comedi/kcomedilib/kcomedilib_main.c: comedi_command shouldn't set + _EOS + +2001-04-27 09:16 timousley + + * comedi/drivers/ni_mio_common.c: compiles now with MITE DMA + support + +2001-04-27 09:00 timousley + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: insn based + counter/timer operations now work, including event counting, + period and pulse width measurement, single and continuous pulse + generation, and quadrature encoder reading + +2001-04-27 08:49 fmhess + + * comedi/drivers/: das1800.c, das800.c: use dev->spinlock now + instead of creating my own spinlock in dev->private + +2001-04-26 14:08 timousley + + * comedi/drivers/ni_mio_common.c: added single pulse generation + using the GPCTRs. almost works, I just need to enable the output + signal. + +2001-04-25 14:03 timousley + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: Period measurement + and pulsewidth measurement now work correctly. + +2001-04-25 02:24 ds + + * comedi/kcomedilib/kcomedilib_main.c: Check async structure in + comedi_unlock + +2001-04-24 10:50 fmhess + + * comedi/drivers/ni_pcimio.c: fixed compile errors + +2001-04-24 10:34 fmhess + + * Makefile.modbuild: patch to make comedi_rt_timer.c compile under + rtlinux 3.0 + +2001-04-23 13:23 ds + + * comedi/drivers/: ni_mio_common.c, ni_pcimio.c: Added PCI-6713 and + PCI-6711 board definitions. Added disable of AI subdevice if no + AI capability. + +2001-04-20 16:43 fmhess + + * comedi/drivers.c: change to make comedi_error() callable from a + driver's attach function + +2001-04-20 16:42 fmhess + + * comedi/drivers/das1800.c: update, fixes, cleanup + +2001-04-20 15:43 fmhess + + * comedi/drivers.c: fixed initialization of comedi_device bug due + to sizeof returning size of pointer instead of object + +2001-04-20 12:15 timousley + + * comedi/drivers/ni_mio_common.c, include/linux/comedi.h: Simple + event counting (and quadrature encoding) works correctly from + user process using insn API. Added some constants for other + GPCTR operations. GPCTR constants now are XORable for debugging + purposes. + +2001-04-19 14:36 timousley + + * comedi/drivers/ni_mio_common.c, include/linux/comedi.h: added + first draft of insn API for GPCTRs + +2001-04-19 00:29 ds + + * comedi/drivers/comedi_rt_timer.c: Major fixes. Updates for + cmd/insn, compiles for RTAI, fails strangely. + +2001-04-19 00:28 ds + + * patches/rel_comedi: remove dependency on bc + +2001-04-19 00:27 ds + + * comedi/drivers/ni_mio_cs.c: Specs for new card + +2001-04-19 00:27 ds + + * comedi/drivers/: check_driver, ni_mio_common.c: Logic error + +2001-04-19 00:21 ds + + * INSTALL: change 2.3 to 2.4 + +2001-04-18 13:57 timousley + + * comedi/drivers/ni_mio_common.c, include/linux/comedi.h: started + adding an insn interface to GPCTRs. + +2001-04-17 14:47 timousley + + * comedi/drivers/ni_mio_common.c: GPCTR_Begin_Event_Counting() + functions now, although it isn't very flexible. + +2001-04-17 14:24 fmhess + + * comedi/drivers/das800.c: fixed some problems with last change + trying to dereferency s->async in cmdtest, and merged gain lookup + tables into board struct + +2001-04-17 13:53 fmhess + + * comedi/drivers/das800.c: added checking of chanlist against + limitations of das800 autoscan mode + +2001-04-17 13:52 timousley + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: added + ni_set_bits(dev,register,bits, value) to share access to + interrupt and pfi registers. This should let AI, AO, and CTR + code all share the interrupts. Some of the GPCTR functions + appear to work now in kernel tests. + +2001-04-17 13:42 fmhess + + * comedi/drivers/pcl711.c: fixed unresolved symbol problem due to + merging of free_resources and _detach functions + +2001-04-13 15:36 timousley + + * Makefile.modbuild, comedi/drivers/ni_mio_common.c, + comedi/drivers/ni_pcimio.c, comedi/drivers/ni_stc.h: added + functions to do simple event counting...no API and no way to test + it yet, but its coming... + +2001-04-13 03:31 ds + + * comedi/drivers/daqboard2000.c: writew() had its arguments + reversed. + +2001-04-12 14:36 timousley + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: Tim Ousley 4/12/01: + consolidated some constants in ni_stc.h and added some low level + GPCTR specific writes to ni_mio_common.c + +2001-04-12 13:24 timousley + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: Tim Ousley 4/12/01: + gpct_mode0,gpct_mode1 and other GPCTR variables are now stored as + an array for future scalability to non STC GPCTR chips. Some + function stubs are in ni_mio_common.c for GPCTR low level writes. + +2001-04-11 00:20 ds + + * comedi/drivers/: comedi_rt_timer.c, ii_pci20kc.c, pcl812.c, + quatech_daqp_cs.c, rti800.c, rti802.c: more migration to insn + +2001-04-10 22:51 ds + + * comedi/drivers/: adl_pci9118.c, adv_pci1710.c: Deleted trig + related code. + +2001-04-10 22:50 ds + + * comedi/drivers/skel.c: Added AO readback and DIO bits and DIO + config. + +2001-04-10 22:08 ds + + * comedi/drivers/: Makefile, comedi_rt_timer.c, dt2811.c, dt2814.c, + dt2815.c, dt2817.c, dt282x.c, dt3000.c, ni_pcidio.c, pcl711.c, + pcl725.c, pcl726.c: Migrating drivers from trig to insn + +2001-04-10 20:37 ds + + * include/linux/comedidev.h: added RANGE_mA + +2001-04-10 12:47 timousley + + * comedi/drivers/mite.c: Tim Ousley 4/10/01: added comments + explaining how to modify mite_ll_from_kvmem, for continuous + acquisition. + +2001-04-10 09:45 timousley + + * comedi/drivers/: mite.c, mite.h, ni_mio_common.c: Tim Ousley + 4/10/01: MITE DMA now works correctly for finite acquisitions + smaller than the prealloc bufsz. uncomment #define PCIDMA in + ni_pcimio.c + +2001-04-10 04:46 ds + + * Makefile: version bump + +2001-04-09 02:29 ds + + * comedi/drivers/dt2811.c: Change from trig to insn + +2001-04-08 23:19 ds + + * comedi/drivers/dt2801.c: fixed call of request_region() with + uninitialized dev->iobase + +2001-04-08 23:15 ds + + * comedi/drivers/: Makefile, das1600-old.c, das1600.c: das1600 name + change + +2001-04-08 23:15 ds + + * comedi/Config.in: Fix for das1600 name change + +2001-04-08 22:46 ds + + * comedi/drivers/ni_pcimio.c: added (commented) definition of + USE_PCIDMA + +2001-04-08 22:32 ds + + * comedi/drivers/ni_mio_common.c: Tried to integrate patch from Tim + Ousley + +2001-04-08 22:03 ds + + * comedi/Makefile: Fix linking of rt_pend_tq + +2001-04-08 15:22 fmhess + + * comedi/comedi_fops.c: added buffer overrun check to bufinfo ioctl + +2001-04-08 15:08 fmhess + + * include/linux/spinlock.h: converted some left over irq.h to + spinlock.h + +2001-04-07 18:48 ds + + * comedi/drivers/: adl_pci9118.c, adv_pci1710.c: patch from Michal + +2001-04-07 18:41 ds + + * include/linux/spinlock.h: Spinlocks were moved to + linux/spinlock.h. + +2001-04-06 16:24 fmhess + + * comedi/drivers/: das1800.c, das800.c: added explicit + initialization of devpriv->spinlock + +2001-04-06 16:13 fmhess + + * comedi/comedi_fops.c, include/linux/comedi.h: added buffer info + ioctl + +2001-04-06 15:57 ds + + * scripts/config.dist: Enabled more drivers + +2001-04-06 15:55 ds + + * comedi/drivers/: mite.c, mite.h: Mite additions from Tim Ousley + +2001-04-06 15:54 ds + + * comedi/Makefile: I think this fixes building rt_pend_tq + repeatedly + +2001-04-03 16:48 ds + + * comedi/drivers/adv_pci1710.c: Fixed some stuff discovered by + check_driver + +2001-04-03 16:45 fmhess + + * include/linux/comedi_rt.h: made comedi_spinlock functions do some + type checking for standard linux and rtlinux spinlocks + +2001-04-03 16:37 fmhess + + * include/linux/comedidev.h: removed two repeated #include + directives + +2001-04-03 02:59 ds + + * Documentation/Configure.help, scripts/Configure.help: moved file, + since that's where it's expected. + +2001-04-03 02:32 ds + + * comedi/drivers/adv_pci1710.c: New driver from Michal Dobes + +2001-04-03 02:30 ds + + * Documentation/comedi/drivers.txt, Documentation/comedi/hardware, + comedi/Config.in, comedi/drivers/Makefile, + comedi/drivers/adl_pci9118.c, comedi/drivers/amcc_s5933.h, + scripts/Configure.help: Patch from Michal Dobes + +2001-04-03 02:24 ds + + * comedi/kcomedilib/kcomedilib_main.c: Fixed insn_write bug. + +2001-04-03 02:23 ds + + * comedi/drivers/rti800.c: Fixed request_region() being called with + uninitialized value. + +2001-04-03 02:23 ds + + * comedi/drivers/das08.c: Fix bug in ao code related to warning + about return value != insn.n. Also fixed ao range to be +/- 5V. + +2001-04-03 02:21 ds + + * comedi/drivers/check_driver: More checks of dubious relevance + +2001-04-03 02:19 ds + + * comedi/: Config.in, drivers/Makefile, drivers/comedi_rt_timer.c: + Fixes for comedi_rt_timer. Still needs work; doesn't even + compile right now. + +2001-03-30 12:31 fmhess + + * comedi/drivers.c: fixed previous over-eager to change things that + dont need to change patch, real problem was just one line + +2001-03-30 12:18 fmhess + + * comedi/drivers.c: fixed bug that was preventing read insn from + being emulated by insn_emulate_bits() + +2001-03-23 16:42 fmhess + + * comedi/drivers/das800.c: tweaked previous fix to be extra safe + +2001-03-23 16:07 fmhess + + * comedi/drivers/das800.c: fixed problem with spurious interrupts + occuring when hardware conversions were disabled + +2001-03-22 18:12 fmhess + + * comedi/rt_pend_tq.h: removed redundant rt_pend_tq.h from comedi + directory since it was moved to comedi/rt_pend_tq directory + +2001-03-22 14:42 ds + + * comedi/drivers/ni_mio_common.c: more cleanup + +2001-03-22 14:32 ds + + * comedi/drivers/ni_mio_cs.c: removed iosize + +2001-03-22 14:31 ds + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: cleaned up interrupt + handling + +2001-03-22 13:06 ds + + * include/linux/comedidev.h: added events to async structure + +2001-03-22 12:55 ds + + * comedi/: Makefile, rt.c: Fix to make rt_pend_tq work correctly on + RTAI. + +2001-03-22 12:53 ds + + * Makefile: Added install_dev target + +2001-03-22 12:48 ds + + * Documentation/comedi/: drivers.txt, hardware: patch for cb_pcidas + info + +2001-03-21 16:09 ds + + * include/linux/comedidev.h: removed dev->iosize + +2001-03-21 16:09 ds + + * comedi/Config.in: moved vd_timer to drivers/comedi_rt_timer + +2001-03-21 16:02 ds + + * comedi/drivers/: adl_pci9118.c, comedi_parport.c, das08.c, + das1800.c, das800.c, dt2811.c, dt2814.c, dt2817.c, dt282x.c, + multiq3.c, ni_atmio.c, ni_atmio16d.c, pcl711.c, pcl724.c, + pcl725.c, pcl726.c, pcl812.c, pcl818.c, poc.c, rti800.c: removed + dev->iosize + +2001-03-21 16:01 ds + + * comedi/drivers/pcm3730.c: changed driver from trig to insn + +2001-03-21 15:59 ds + + * comedi/drivers/: Makefile, comedi_rt_timer.c: Moved real-time + timer code from comedi/realtime/vd_timer.c + +2001-03-21 15:41 ds + + * comedi/drivers/ni_mio_common.c: fix for reversed arguments to + win_out(), from Tim Ousley + +2001-03-16 19:56 ds + + * comedi/drivers/: adl_pci9118.c, cb_pcidas.c, check_driver, + das1800.c, das800.c: fix use of cmd->data + +2001-03-16 19:45 ds + + * comedi/: Config.in, drivers/Makefile, drivers/das08-new.c, + drivers/das08.c, drivers/das16-new.c, drivers/das16.c: changed + driver names + +2001-03-16 19:44 ds + + * comedi/drivers/: das08-old.c, das08.c, das08jr-old.c, das08jr.c, + das16-old.c, das16.c: Changed names on drivers + +2001-03-16 19:38 ds + + * comedi/comedi_fops.c, comedi/drivers/adl_pci9118.c, + comedi/drivers/comedi_parport.c, comedi/drivers/das16-new.c, + comedi/drivers/das6402.c, comedi/drivers/dt282x.c, + comedi/drivers/mite.c, comedi/drivers/ni_atmio16d.c, + comedi/drivers/ni_mio_common.c, comedi/drivers/pcl812.c, + comedi/drivers/pcl818.c, include/linux/comedidev.h: Removed + dependency on s->async->cur_trig in all the drivers. Only + dependency is in comedi_fops.c, where it could be replaced by a + local variable. Also cleaned up the buffer code in many of the + drivers. + + Probably broke a lot of code that was techinically already + broken. + +2001-03-16 19:34 ds + + * TODO: random todo checkin + +2001-03-16 19:34 ds + + * comedi/drivers/check_driver: added new tests + +2001-03-16 11:32 ds + + * comedi/drivers/8255.c: 8255 shouldn't use async structure because + it doesn't get allocated. + +2001-03-16 11:20 ds + + * comedi/drivers/pcm3730.c: Original source from author. Probably + will be moved/fixed. + +2001-03-13 01:31 ds + + * patches/comedi-rtl-irq-tm.patch: TM's original patch + +2001-03-13 01:28 ds + + * comedi/: Makefile, rt.c: added rt_pend_tq support from Tomasz, + plus my mods + +2001-03-13 01:25 ds + + * comedi/kcomedilib/kcomedilib_main.c: added comedi_poll() + +2001-03-13 01:25 ds + + * comedi/drivers.c: more ->poll support + +2001-03-08 09:34 fmhess + + * comedi/drivers/cb_pcidas.c: removed unused recognize stuff from + pci driver + +2001-03-08 01:21 ds + + * comedi/drivers/: 8255.c, dt2801.c, dt2814.c, dt2817.c, dt282x.c, + ni_mio_common.c: Conversion of drivers from trig to insn/cmd. + +2001-03-05 13:12 fmhess + + * comedi/drivers/mite.c: fixed problem with segfault on rmmod when + you load mite with no supported cards installed in your computer + +2001-03-05 13:02 fmhess + + * comedi/drivers.c: made comedi_report_boards() report the driver + name if num_names == 0 + +2001-03-04 02:55 ds + + * comedi/drivers/: adl_pci9118.c, check_driver, das16-new.c, + das16.c, das6402.c, dt2811.c, dt2814.c, dt2815.c, dt282x.c, + ni_atmio16d.c, ni_pcidio.c, ni_pcimio.c, pcl711.c, pcl724.c, + pcl725.c, pcl726.c, pcl812.c, pcl818.c, rti800.c, rti802.c: fixes + for bugs suggested by check_driver + +2001-03-04 00:45 ds + + * scripts/config.dist: enabled all boards + +2001-03-04 00:45 ds + + * include/linux/comedidev.h: cleaned up commenting for async + structure removed dev->board + +2001-03-04 00:44 ds + + * comedi/drivers.c: changed to use comedi_recognize that uses + board_name and offset, to pull the name pointer directly out of + the board structures + +2001-03-04 00:42 ds + + * Documentation/comedi/drivers.txt: fixed pcl726 info, needs more + work + +2001-03-04 00:42 ds + + * TODO: [no log message] + +2001-03-04 00:39 ds + + * comedi/drivers/: 8255.c, adl_pci9118.c, cb_pcidas.c, + daqboard2000.c, das08-new.c, das08.c, das16-new.c, das1600.c, + das1800.c, das800.c, dt2801.c, dt2811.c, dt282x.c, dt3000.c, + ii_pci20kc.c, mpc8260cpm.c, ni_atmio.c, ni_atmio16d.c, + ni_mio_common.c, ni_mio_cs.c, ni_pcidio.c, ni_pcimio.c, ni_stc.h, + pcl711.c, pcl724.c, pcl726.c, pcl812.c, pcl818.c, poc.c, + quatech_daqp_cs.c, rti800.c, skel.c: converted all drivers to use + comedi_recognize() with name info pulled from board structures. + removed dev->board in all drivers in favor of dev->board_ptr + 8255: removed way-old strcmp() cb_pcidas: fixed PCI code for 2.4 + mpc8260cpm: removed comments, replaced skel with mpc8260cpm + pcl726: changed way subdevices are allocated pcl818: changed way + subdevices are allocated + +2001-03-03 22:57 ds + + * comedi/drivers/check_driver: script to check random craziness in + drivers + +2001-03-03 07:56 fmhess + + * comedi/drivers/das08-new.c: added recognize replacement + +2001-03-03 07:43 fmhess + + * comedi/drivers/cb_pcidas.c: removed unnecessary recognize + function that just recognized name of driver + +2001-03-02 09:55 ds + + * comedi/drivers/ni_mio_common.c: fix warning + +2001-03-02 09:21 ds + + * Documentation/comedi/: drivers.txt, hardware: changes for dt2811 + +2001-03-01 22:43 ds + + * comedi/comedi_fops.c: Fix previous vm changes for 2.2 (I think) + +2001-03-01 22:00 ds + + * comedi/drivers/: ni_mio_common.c, ni_mio_cs.c: added ao interrupt + debugging now checks ao interrupt flag remove incorrect comment + in ni_mio_cs + +2001-03-01 21:31 ds + + * comedi/comedi_fops.c: removed comedi_file_private added + comedi_unmap and comedi_vm_ops added callback when vma is + unmapped fixed subdevice index range check in + do_bufconfig_ioctl() + +2001-03-01 14:25 ds + + * comedi/comedi_fops.c, comedi/drivers.c, include/linux/comedi.h, + include/linux/comedidev.h: changes to bufconfig structure + +2001-03-01 11:05 fmhess + + * comedi/drivers/adl_pci9118.c: added recognize replacement + +2001-03-01 10:35 fmhess + + * comedi/drivers/das1800.c: added recognize replacement, integrated + ai range table into das1800_board struct + +2001-03-01 10:33 fmhess + + * comedi/drivers/skel.c: updated some comments + +2001-03-01 10:30 fmhess + + * comedi/comedi_fops.c: replaced kill_async with KILL_ASYNC from + compatability header linux/fs.h so I could compile + +2001-02-28 21:03 ds + + * Makefile.modbuild: add install to pcmcia subdir + +2001-02-28 21:02 ds + + * include/linux/fs.h: added compatibility for kill_fasync() + +2001-02-28 20:59 ds + + * comedi/drivers/: ni_mio_common.c, ni_mio_cs.c: range changes for + limited-8 fixes related to sample timing in a scan fix for async + structure being allocated on boards without AO fix for DAQCard + using wrong gain info + +2001-02-28 10:00 fmhess + + * comedi/drivers.c, comedi/drivers/das800.c, comedi/drivers/skel.c, + include/linux/comedidev.h: changed comedi_driver member + num_boards to num_names as this is more accurate + +2001-02-27 15:23 fmhess + + * comedi/drivers.c, comedi/drivers/das800.c, comedi/drivers/skel.c, + include/linux/comedidev.h: recognize replacement now provides + simpler interface to drivers + +2001-02-26 14:03 ds + + * Makefile: version bump + +2001-02-21 09:25 fmhess + + * comedi/drivers/das1800.c: protected indirect addressing with + comedi_spin_lock_irqsave() + +2001-02-19 14:50 ds + + * comedi/: Config.in, drivers/Makefile, drivers/mpc8260cpm.c: Added + driver for DIO pins on MPC8260 CPM. Not working. + +2001-02-19 14:47 ds + + * comedi/comedi_fops.c, include/linux/comedidev.h: Added + fasync/SIGIO support. + +2001-02-19 14:41 ds + + * comedi/: Config.in, drivers/Makefile: added fl512 driver + +2001-02-19 14:41 ds + + * TODO, patches/rel_comedi: [no log message] + +2001-02-19 14:39 ds + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: fixed reversal of + ni_writeb parameters in 8255 callback fixed TRIG_EXT support + added level/edge, hi/lo support for TRIG_EXT added selection of + trigger line for TRIG_EXT (maybe) fixed dual-channel AO + +2001-02-19 13:18 ds + + * comedi/drivers/fl512.c: fixups for driver + +2001-02-19 12:56 ds + + * comedi/drivers/fl512.c: Driver from Anders Gnustrup + + +2001-02-13 18:36 fmhess + + * comedi/drivers.c: fixed up postconfig() error handling + +2001-02-13 12:24 fmhess + + * comedi/drivers.c: added handling of memory allocation failures in + postconfig() + +2001-02-13 12:14 fmhess + + * comedi/comedi_fops.c: fixed NULL dereference problem in + do_become_nonbusy() caused by async changes + +2001-02-13 09:06 fmhess + + * comedi/drivers/: das1800.c, das800.c: removed direct references + to prealloc_buf from das800 and das1800 drivers + +2001-02-13 08:57 fmhess + + * comedi/comedi_fops.c, comedi/drivers.c, + include/linux/comedidev.h: remove unnecessary comedi_subdevice + *subdev from comedi_async_struct + +2001-02-12 19:51 fmhess + + * comedi/comedi_fops.c, comedi/drivers.c, comedi/drivers/8255.c, + comedi/drivers/adl_pci9118.c, comedi/drivers/comedi_parport.c, + comedi/drivers/das16-new.c, comedi/drivers/das1800.c, + comedi/drivers/das6402.c, comedi/drivers/das800.c, + comedi/drivers/dt2814.c, comedi/drivers/dt282x.c, + comedi/drivers/mite.c, comedi/drivers/ni_atmio16d.c, + comedi/drivers/ni_mio_common.c, comedi/drivers/pcl812.c, + comedi/drivers/pcl818.c, comedi/drivers/skel.c, + comedi/kcomedilib/kcomedilib_main.c, include/linux/comedidev.h: + split asyncronous stuff off of comedi_subdevice_struct + +2001-02-12 18:52 fmhess + + * comedi/drivers/daqboard2000_fpga.h: fixed typo that prevented + compile + +2001-02-07 18:00 fmhess + + * comedi/comedi_fops.c: made bufconfig ioctl always write back + buffer sizes even if they were not changed + +2001-02-05 14:10 fmhess + + * Documentation/comedi/hardware: added some tabs to make das800 + entries line up better + +2001-02-05 10:09 ds + + * comedi/: Config.in, drivers/Makefile, drivers/cb_pcidas.c: new + driver + +2001-02-05 10:09 ds + + * comedi/drivers/ii_pci20kc.c: change to len_chanlist + +2001-02-04 19:09 ds + + * Makefile: version bump + +2001-02-04 19:07 ds + + * patches/rel_comedi: the release script. + +2001-02-04 19:06 ds + + * patches/: cascade-test.c, patch-bufconfig, patch-pcmad, + patch-scxi, pcmad.c: random cruft that needs to be merged, or not + +2001-02-04 18:58 ds + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: merged part of patch + from Brad Keryan + +2001-02-04 18:39 ds + + * comedi/drivers/ni_pcimio.c: removed irrelevant comment + +2001-02-04 18:17 ds + + * comedi/comedi_fops.c: interface change: INSN_WAIT now takes + nanoseconds instead of microseconds. + +2001-02-04 18:09 ds + + * comedi/comedi_ksyms.c, include/linux/comedi_rt.h, + include/linux/comedidev.h: cleanup, fixes for real-time + +2001-02-04 18:07 ds + + * comedi/kcomedilib/ksyms.c, include/linux/comedilib.h: added + command support + +2001-02-04 18:07 ds + + * comedi/kcomedilib/kcomedilib_main.c: added command support, + removed SDF_RT code, bugfix for insn_bits + +2001-02-04 18:06 ds + + * comedi/rt.c: fixes for RTAI, good for rtai4 cvs, not checked for + rtai-22 + +2001-02-04 18:05 ds + + * comedi/comedi_fops.c: cleanup, fix to make callback work with + non-rt + +2001-02-04 18:01 ds + + * comedi/drivers/comedi_parport.c: added support for using the + interrupt pin + +2001-02-03 13:29 ds + + * comedi/comedi_fops.c: testing CVS permissions. No change + +2001-01-30 17:26 fmhess + + * comedi/comedi_fops.c: added a bunch of if(!dev->attached) sanity + checks + +2001-01-30 12:24 fmhess + + * comedi/comedi_fops.c: fixed memory leak due to last change + +2001-01-30 12:19 fmhess + + * comedi/comedi_fops.c, include/linux/comedi.h, + include/linux/comedidev.h: fixed up counting of mmaps by using + struct file->private_data to keep track of mmap count + +2001-01-29 15:43 ds + + * comedi/drivers/ni_pcidio.c: fixed NI document numbers + +2001-01-29 10:38 fmhess + + * include/linux/comedi_rt.h: commented out #ifdef that broke + comedi_spin_lock_irqsave for rtlinux version 2 + +2001-01-28 22:37 fmhess + + * comedi/drivers/das1800.c: fixed null dereference problems caused + by last change + +2001-01-28 21:01 fmhess + + * comedi/drivers/das1800.c: moved das1800_probe() back in + das1800_attach() to insure no io to ports happens until after io + addresses have been requested + +2001-01-28 20:51 fmhess + + * comedi/drivers/das800.c: made sure all port io happens after io + ports have been requested (I messed this up with last commit when + I moved das800_probe() to an earlier place in the das800_attach() + +2001-01-28 17:10 fmhess + + * comedi/comedi_fops.c: made comedi_mmap_v22() mark subdevice as + mmapped + +2001-01-28 17:04 fmhess + + * comedi/comedi_fops.c: improved sanity checks in bufconfig ioctl + +2001-01-28 16:45 fmhess + + * include/linux/comedi.h: added SDF_MMAPPED flag + +2001-01-28 16:42 fmhess + + * include/linux/comedidev.h: changed comedi_device.read_subdev and + write_subdev from type unsigned int to type signed int + +2001-01-28 12:46 fmhess + + * comedi/drivers.c, comedi/drivers/das800.c, comedi/drivers/skel.c, + include/linux/comedidev.h: added replacement for recognize that + can report valid board names + +2001-01-28 11:20 fmhess + + * comedi/drivers/dt2811.c: fixed bug in attach function + +2001-01-27 13:44 fmhess + + * comedi/drivers/das1800.c: added bitfield insn to di and do + +2001-01-27 13:26 fmhess + + * comedi/drivers/das800.c: [no log message] + +2001-01-27 13:20 fmhess + + * comedi/drivers/das800.c: added bitfield insn to di and do + +2001-01-27 12:23 fmhess + + * Documentation/comedi/hardware: added das800 and das1800 drivers + +2001-01-27 12:13 fmhess + + * Documentation/comedi/drivers.txt: updated notes for das1800 and + das800 drivers + +2001-01-27 11:46 fmhess + + * comedi/comedi_fops.c: undid my last fix because i think it was + wrong + +2001-01-27 11:36 fmhess + + * comedi/comedi_fops.c: fixed bug with initialization of + buf_user_ptr and buf_user_count in do_cmd_ioctl for writeable + subdevices + +2001-01-27 11:33 fmhess + + * comedi/comedi_fops.c: fixed corruption of chanlist pointer in + cmdtest ioctl, made cmd ioctl leave chanlist pointer alone + instead of nulling it. + +2001-01-25 13:36 fmhess + + * comedi/comedi_fops.c: fixed buffer overrun race in + comedi_read_v22 + +2001-01-24 17:01 fmhess + + * comedi/drivers/das1800.c: trivial changes + +2001-01-24 16:43 fmhess + + * include/linux/comedi.h: added bufconfig struct and ioctl + +2001-01-24 16:41 fmhess + + * comedi/comedi_fops.c: added bufconfig ioctl + +2001-01-24 11:33 fmhess + + * comedi/drivers/das800.c: removed spurious comment to test commit + access + +2001-01-23 16:44 ds + + * Makefile.modbuild: [no log message] + +2001-01-23 16:44 ds + + * scripts/: Configure, config.dist: changes to Configure for + modbuild, and update to config.dist + +2001-01-23 16:41 ds + + * comedi/drivers/das08-new.c: fix from Luke Stras + +2001-01-23 16:07 ds + + * scripts/Configure: copied over verbatim 2.2.17 Configure + +2001-01-23 10:59 ds + + * README: added CVS info + +2001-01-23 10:47 ds + + * TODO: [no log message] + +2001-01-23 10:34 ds + + * include/linux/comedi_rt.h: removed circular dependency + +2001-01-23 10:34 ds + + * comedi/kcomedilib/kcomedilib_main.c: compile fix + +2001-01-23 10:34 ds + + * comedi/drivers/ni_pcidio.c: added insn support + +2001-01-23 10:33 ds + + * comedi/drivers/ni_mio_cs.c: fixes, debug + +2001-01-23 10:33 ds + + * comedi/drivers/ni_mio_common.c: fixes, debugging + +2001-01-23 10:32 ds + + * comedi/drivers/ni_atmio.c: random cleanup, attempt at ISAPNP + +2001-01-23 10:31 ds + + * comedi/drivers/dt282x.c: random cleanup + +2001-01-23 10:30 ds + + * TODO: [no log message] + +2001-01-23 10:30 ds + + * Makefile.modbuild: remove make dep + +2001-01-17 14:05 ds + + * comedi/drivers.c: bugfix + +2001-01-17 10:01 ds + + * comedi/kcomedilib/kcomedilib_main.c: remove module.h + +2001-01-17 10:01 ds + + * comedi/rt.c: clear struct after malloc + +2001-01-17 10:00 ds + + * comedi/drivers/dt282x.c: fixed adbits for dt2824 + +2001-01-16 14:21 ds + + * comedi/kcomedilib/Makefile, comedi/kcomedilib/data.c, + comedi/kcomedilib/dio.c, comedi/kcomedilib/kcomedilib_main.c, + comedi/kcomedilib/ksyms.c, include/linux/comedi.h, + include/linux/comedilib.h: bunch of changes for kcomedilib + +2001-01-16 14:20 ds + + * TODO: [no log message] + +2001-01-16 14:01 ds + + * comedi/drivers/ni_atmio.c: driver was choking on ni_atmio name + +2001-01-16 14:00 ds + + * comedi/rt.c: fix error message + +2001-01-16 11:26 ds + + * comedi/Makefile: fix accidental compilation of kcomedilib + +2001-01-16 11:24 ds + + * comedi/kcomedilib/: data.c, dio.c, kcomedilib_main.c: fixed + unresolved symbols + +2001-01-16 11:00 ds + + * include/linux/comedidev.h: fix spinlock defs + +2001-01-16 10:59 ds + + * include/linux/comedi_rt.h: fix RTAI spin_lock defs + +2001-01-16 10:59 ds + + * comedi/drivers/das800.c: move header files + +2001-01-16 10:58 ds + + * comedi/drivers/ni_mio_cs.c: compile fix + +2001-01-16 09:15 ds + + * comedi/drivers/ni_mio_common.c: bugfix on cmdtest ao + +2001-01-16 09:15 ds + + * comedi/drivers/ni_mio_cs.c: new cards + +2001-01-16 09:14 ds + + * include/linux/comedidev.h: moved comedi_rt.h + +2001-01-16 09:13 ds + + * include/linux/comedi_rt.h: added spinlock stuff (frank) + +2001-01-16 09:12 ds + + * comedi/drivers/das800.c: update from Frank + +2001-01-16 09:01 ds + + * include/linux/comedi_rt.h: fix for rtlinux 3.0 + +2001-01-16 08:59 ds + + * comedi/comedi_rt.h, include/linux/comedi_rt.h: move comedi_rt.h + +2001-01-15 14:56 ds + + * comedi/drivers/ni_pcidio.c: bugfix of the "oh, crap" variety + +2001-01-13 08:19 ds + + * comedi/drivers.c: fix reference counting + +2001-01-12 14:44 ds + + * scripts/Configure: clarity fix + +2001-01-12 07:32 ds + + * comedi/kcomedilib/kcomedilib_main.c: fix symbol export + +2001-01-12 07:31 ds + + * comedi/: rtai.c, rtl.c, rtl_v1.c: remove old files + +2001-01-11 14:07 ds + + * comedi/drivers/ni_pcidio.c: readded linux/irq.h for debugging + +2001-01-11 14:03 ds + + * comedi/drivers/poc.c: compile fixes + +2001-01-11 13:50 ds + + * comedi/drivers/: adl_pci9118.c, das16-new.c, das1800.c, das800.c, + dt2814.c, dt282x.c, ni_atmio16d.c, ni_mio_common.c, skel.c: added + read_subdev and write_subdev where appropriate + +2001-01-11 13:48 ds + + * comedi/comedi_rt.h: fix for rtlinux-3.0 + +2001-01-11 08:02 ds + + * README: mailing list changes + +2001-01-09 11:21 ds + + * comedi/: Config.in, drivers/Makefile, drivers/poc.c: added poc + driver + +2001-01-09 11:18 ds + + * comedi/: rtai.c, rtl.c, rtl_v1.c, drivers/dt282x.c, + drivers/ni_pcidio.c: migrate everybody from asm/irq.h to + linux/irq.h + +2001-01-09 11:18 ds + + * scripts/dep.rtai: fix for rtai4 CVS + +2001-01-09 11:17 ds + + * TODO: random checkin + +2001-01-09 10:06 ds + + * include/linux/irq.h: who forgot to check in irq.h? + +2001-01-08 14:02 ds + + * scripts/dep.linux: fix versioning issues on UTS_VERSION + +2001-01-08 14:00 ds + + * comedi/drivers/: ni_pcidio.c, ni_pcimio.c: select device based on + bus,slot + +2001-01-08 13:59 ds + + * comedi/drivers/dt2814.c: cleanup + +2001-01-08 13:59 ds + + * comedi/drivers.c: clears dev structure on attach + +2001-01-08 13:57 ds + + * INSTALL: bugfix + +2001-01-08 13:42 ds + + * comedi/comedi_fops.c: bugfix + +2001-01-01 16:34 ds + + * comedi/drivers/: das16-new.c, quatech_daqp_cs.c: compile fixes + +2001-01-01 16:34 ds + + * scripts/config.dist: update + +2001-01-01 13:30 ds + + * comedi/drivers/ni_pcidio.c: fix recognize having wrong prototype + +2001-01-01 13:29 ds + + * comedi/drivers/ni_mio_common.c: fix dio configuration bug + +2001-01-01 13:29 ds + + * comedi/drivers/das16-new.c: fix single-ended/differential probe + problem + +2000-12-26 08:28 ds + + * comedi/drivers/das1800.c: update from frank + +2000-12-22 13:23 ds + + * comedi/drivers/das1800.c: update from Frank + +2000-12-19 08:06 ds + + * INSTALL: modprobe does not require .o + +2000-12-19 08:05 ds + + * comedi/drivers/ni_pcidio.c: fix recognize + +2000-12-18 09:28 ds + + * comedi/drivers/das16-new.c: fix compile problems + +2000-12-18 09:28 ds + + * comedi/drivers/ni_atmio.c: fix warning + +2000-12-18 08:41 ds + + * comedi/comedi_fops.c: fix in do_cmd_ioctl() + +2000-12-18 08:39 ds + + * comedi/rt.c: fixed include + +2000-12-18 08:38 ds + + * comedi/drivers/8253.h: remove misleading comment and make _div + function default + +2000-12-18 08:36 ds + + * comedi/drivers/das16-new.c: changes from Chris Baugher + +2000-12-15 10:27 ds + + * comedi/drivers/das08.c: bugfix from Luke Stras + +2000-12-11 20:58 ds + + * comedi/drivers/das1800.c: update from frank + +2000-12-07 17:09 ds + + * Makefile.modbuild: readded depmod on install + +2000-12-06 12:10 ds + + * comedi/: comedi_rt.h, rt.c: fixed 2.2.17/rtl-2.2 compile + +2000-12-06 12:09 ds + + * comedi/drivers/ni_pcimio.c: new device id + +2000-12-06 12:09 ds + + * comedi/drivers/ni_mio_common.c: remove warnings + +2000-12-06 12:09 ds + + * comedi/drivers/8253.h: new cascade math function by Frank Mori + Hess + +2000-12-05 20:06 ds + + * comedi/drivers/ni_atmio.c: added recognize to use older name + atmio-E + +2000-12-02 09:51 ds + + * comedi/: Config.in, drivers/Makefile: added das1800 + +2000-12-02 09:51 ds + + * Documentation/comedi/drivers.txt, comedi/drivers/das1800.c, + comedi/drivers/das800.c: update from Frank Mori Hess + +2000-12-01 11:07 ds + + * comedi/drivers/: ni_mio_common.c, ni_mio_cs.c: error message + cleanup + +2000-12-01 11:06 ds + + * comedi/comedi_fops.c: fixed compile errors on 2.2 + +2000-12-01 11:05 ds + + * include/linux/mm.h: added mm.h compat header + +2000-11-30 12:34 ds + + * comedi/drivers/ni_mio_common.c: random changes for block mode + +2000-11-30 12:30 ds + + * comedi/drivers/amcc_s5933.h: compile fix + +2000-11-30 12:29 ds + + * comedi/comedi_fops.c: make select work when there is no cmd + running + +2000-11-30 12:28 ds + + * NOTES: don't want this no more + +2000-11-29 17:25 ds + + * Documentation/comedi/configuration: info on configuration + parameters + +2000-11-29 17:19 ds + + * Contributors: added Contributors list + +2000-11-29 17:19 ds + + * comedi/drivers/: ni_mio_common.c, ni_stc.h: #ifdef's added for + trig stuff blocking mode added ao insns added ao cmd added + +2000-11-29 17:16 ds + + * comedi/comedi_fops.c: fixed mmap reference counting + +2000-11-29 17:15 ds + + * comedi/drivers/das800.c: compile fix + +2000-11-29 17:15 ds + + * comedi/drivers/Makefile: [no log message] + +2000-11-29 17:14 ds + + * comedi/drivers/amcc_s5933.h: compile fixes + +2000-11-29 16:31 ds + + * comedi/Config.in: fixed adl9118 driver + +2000-11-29 16:30 ds + + * TODO: [no log message] + +2000-11-29 16:29 ds + + * comedi/drivers/ni_mio_cs.c: removed release_region + +2000-11-29 16:28 ds + + * comedi/drivers/dt282x.c: added insn support + +2000-11-29 16:27 ds + + * comedi/drivers/dt2814.c: added cmd support, insn support + +2000-11-29 16:26 ds + + * comedi/drivers/skel.c: added cmdtest + +2000-11-29 15:18 ds + + * comedi/drivers/das800.c: update from frank + +2000-11-25 17:11 ds + + * Documentation/comedi/drivers.txt: updates + +2000-11-25 16:53 ds + + * Documentation/comedi/drivers.txt: change format + +2000-11-24 16:20 ds + + * comedi/drivers/das800.c: driver cleanup + +2000-11-24 16:10 ds + + * TODO, comedi/Makefile, comedi/comedi_fops.c, + comedi/comedi_ksyms.c, comedi/comedi_rt.h, comedi/rt.c, + comedi/drivers/ni_mio_common.c, comedi/drivers/pcl818.c, + comedi/drivers/quatech_daqp_cs.c, + comedi/kcomedilib/kcomedilib_main.c, include/linux/comedidev.h: + fixed poll, select, mod use count for RT; many RT fixes/changes; + more support for running drivers RT from user space; pcl818: + added pcm3718; quatech_daqp_cs: fixed compilation; kcomedilib: + added specific EXPORT_SYMBOL()s + +2000-11-23 22:14 ds + + * comedi/drivers/ni_mio_common.c: added flag to error string + conversion + +2000-11-23 22:13 ds + + * comedi/drivers/das800.c: driver fixes + +2000-11-23 22:00 ds + + * comedi/: Config.in, drivers/Makefile, drivers/das800.c: added + das800 driver + +2000-11-21 10:46 ds + + * Makefile: fixed mknod bug + +2000-11-13 02:39 ds + + * Makefile.modbuild: compile fixes + +2000-11-13 02:23 ds + + * include/linux/version.h: wedge for version.h + +2000-11-13 02:22 ds + + * include/linux/comedidev.h: moved from comedi/comedi_module.h + +2000-11-13 02:21 ds + + * scripts/dep.rtlinux: = vs. == bugfix + +2000-11-13 02:21 ds + + * Makefile.modbuild: [no log message] + +2000-11-13 02:17 ds + + * comedi/drivers/ni_atmio.c: rtlinux fix + +2000-11-07 13:59 ds + + * scripts/check_kernel: looked in /usr/include/linux + +2000-11-07 13:50 ds + + * comedi/: am9513.h, drivers/am9513.h: move header file + +2000-11-07 13:48 ds + + * comedi/: comedi_fops.c, comedi_ksyms.c, drivers.c, dummy.c, + proc.c, range.c, rt.c, rtai.c, rtl.c, rtl_v1.c, drivers/8255.c, + drivers/8255.h, drivers/adl_pci9118.c, drivers/comedi_parport.c, + drivers/daqboard2000.c, drivers/das08-new.c, drivers/das08.c, + drivers/das08jr.c, drivers/das16-new.c, drivers/das16.c, + drivers/das1600.c, drivers/das6402.c, drivers/dt2801.c, + drivers/dt2811.c, drivers/dt2814.c, drivers/dt2815.c, + drivers/dt2817.c, drivers/dt282x.c, drivers/dt3000.c, + drivers/ii_pci20kc.c, drivers/mite.c, drivers/mite.h, + drivers/multiq3.c, drivers/ni_atmio.c, drivers/ni_atmio16d.c, + drivers/ni_mio_cs.c, drivers/ni_pcidio.c, drivers/ni_pcimio.c, + drivers/pcl711.c, drivers/pcl724.c, drivers/pcl725.c, + drivers/pcl726.c, drivers/pcl812.c, drivers/pcl818.c, + drivers/quatech_daqp_cs.c, drivers/rti800.c, drivers/rti802.c, + drivers/skel.c, kcomedilib/data.c, kcomedilib/dio.c, + kcomedilib/kcomedilib_main.c: fix sed script mistake + +2000-11-07 13:39 ds + + * comedi/: comedi_fops.c, comedi_ksyms.c, comedi_module.h, + drivers.c, dummy.c, proc.c, range.c, rt.c, rtai.c, rtl.c, + rtl_v1.c, drivers/8255.c, drivers/8255.h, drivers/adl_pci9118.c, + drivers/comedi_parport.c, drivers/daqboard2000.c, + drivers/das08-new.c, drivers/das08.c, drivers/das08jr.c, + drivers/das16-new.c, drivers/das16.c, drivers/das1600.c, + drivers/das6402.c, drivers/dt2801.c, drivers/dt2811.c, + drivers/dt2814.c, drivers/dt2815.c, drivers/dt2817.c, + drivers/dt282x.c, drivers/dt3000.c, drivers/ii_pci20kc.c, + drivers/mite.c, drivers/mite.h, drivers/multiq3.c, + drivers/ni_atmio.c, drivers/ni_atmio16d.c, drivers/ni_mio_cs.c, + drivers/ni_pcidio.c, drivers/ni_pcimio.c, drivers/pcl711.c, + drivers/pcl724.c, drivers/pcl725.c, drivers/pcl726.c, + drivers/pcl812.c, drivers/pcl818.c, drivers/quatech_daqp_cs.c, + drivers/rti800.c, drivers/rti802.c, drivers/skel.c, + kcomedilib/data.c, kcomedilib/dio.c, + kcomedilib/kcomedilib_main.c: change comedi_module.h to + linux/comedidev.h + +2000-11-07 13:36 ds + + * comedi/drivers/8255.c: warning fixes + +2000-11-07 12:53 ds + + * comedi/: comedi_module.h, comedi_rt.h: moved comedi.h to + include/linux/ + +2000-11-07 12:47 ds + + * include/: comedi.h, linux/comedi.h: moved comedi.h to linux/ + +2000-11-07 12:46 ds + + * comedi/drivers.c: fix warning + +2000-11-07 12:24 ds + + * comedi/comedi_fops.c, comedi/comedi_module.h, comedi/drivers.c, + comedi/drivers/8255.c, comedi/drivers/mite.c, + comedi/drivers/ni_mio_common.c, include/comedi.h: addition of + insn_config + +2000-11-07 12:23 ds + + * Documentation/comedi/counter-spec: added ideas for counter + configuration + +2000-11-07 12:22 ds + + * include/linux/: module.h, pci.h: new files + +2000-11-07 12:21 ds + + * comedi/drivers/das16-new.c: added recognize function + +2000-11-07 12:20 ds + + * comedi/kern_compat.h: move parts to include/linux + +2000-11-07 12:20 ds + + * comedi/comedi_ksyms.c: fixed 2.0 symbol export + +2000-10-15 15:33 ds + + * comedi/drivers/daqboard2000.c: added + +2000-10-15 15:33 ds + + * comedi/kern_compat.h: moved some stuff to include/ + +2000-10-15 15:33 ds + + * include/: asm/uaccess.h, linux/wait.h: new + +2000-10-15 14:53 ds + + * Makefile, comedi/kern_compat.h, comedi/rtl.c, + scripts/dep.rtlinux: Patch from Tomasz + +2000-10-15 14:50 ds + + * Makefile.modbuild, comedi/Config.in, + comedi/drivers/daqboard2000.c, comedi/drivers/dt3000.c, + scripts/dep.rtlinux: patch from Tomasz + +2000-10-15 14:31 ds + + * comedi/drivers/: mite.c, ni_pcidio.c, ni_pcimio.c: mite->used + fix, 6034e fix from Brad Keryan + +2000-10-13 17:55 ds + + * TODO, scripts/preconfigure: removed pcmcia dep (conflicts on + 2.4.0) + +2000-10-13 17:36 ds + + * Makefile.modbuild, comedi/Config.in, comedi/drivers/Makefile, + comedi/drivers/quatech_daqp_cs.c, scripts/dep.pcmcia, + scripts/dep.rtlinux, scripts/preconfigure: patch from Brent + Baccala + +2000-10-13 02:29 ds + + * comedi/: comedi_fops.c, drivers.c: moved BUG check to drivers.c + compile warning fix + +2000-10-13 02:28 ds + + * TODO: random TODO checkin + +2000-10-13 02:28 ds + + * Makefile: version bump + +2000-10-13 02:27 ds + + * comedi/drivers/comedi_parport.c: updates for insn + +2000-10-13 02:27 ds + + * comedi/: kvmem.c, kvmem.h: fixes for kernel >=2.4.0-test7 + +2000-10-13 01:51 ds + + * comedi/drivers/ii_pci20kc.c: modified for insn + +2000-10-13 01:15 ds + + * comedi/drivers/ii_pci20kc.c: update from Markus + +2000-10-12 13:07 ds + + * Makefile.modbuild, scripts/dep.rtlinux: fix rtlinux include file + problems + +2000-10-12 13:00 ds + + * Documentation/comedi/drivers.txt, Documentation/comedi/hardware, + comedi/Config.in, comedi/drivers/adl_pci9118.c, + comedi/drivers/amcc_s5933.h, scripts/Configure.help: new driver + from Michal Dobes, plus fixes to docs + +2000-10-11 13:48 ds + + * Documentation/comedi/hacks: added documentation of hacks + +2000-10-10 18:09 ds + + * INSTALL: updates + +2000-10-10 18:09 ds + + * TODO: [no log message] + +2000-10-10 18:08 ds + + * comedi/kcomedilib/: data.c, dio.c, kcomedilib_main.c: insn + support + +2000-10-10 18:07 ds + + * comedi/drivers.c: insn_read/write emulation based on insn_bits + +2000-10-10 18:00 ds + + * comedi/comedi_module.h: added read/write wait_queues and + read/write subdevices + +2000-10-10 17:59 ds + + * comedi/comedi_fops.c: changed insn handling added poll fop + changed read/write from depending on f_pos to paticular + read/write subdev + +2000-10-10 17:54 ds + + * comedi/Config.in: added fpga conf option for dasboard2000 + +2000-10-10 17:50 ds + + * comedi/drivers/: ni_mio_common.c, ni_pcimio.c, ni_stc.h: bug + fixes re failure on comedi_test + +2000-10-10 17:47 ds + + * comedi/drivers/daqboard2000.c: code cleanup modularized fpga code + +2000-10-10 17:40 ds + + * include/comedi.h: added comedi_do_insn() + +2000-09-17 08:50 ds + + * comedi/drivers/rti800.c: fix 815 recognition + +2000-09-09 15:00 ds + + * comedi/drivers/daqboard2000.c: patch from anders re 8255 + +2000-09-09 14:50 ds + + * comedi/drivers.c: ao insn emulation bug + +2000-09-07 17:40 ds + + * comedi/drivers/: ni_atmio.c, ni_mio_common.c, ni_stc.h: enable + GPCTs on all boards + +2000-09-07 17:22 ds + + * comedi/comedi_fops.c: change email address + +2000-09-07 17:21 ds + + * comedi/drivers/ni_pcimio.c: removed debugging messages + +2000-09-07 10:34 ds + + * Makefile: The reappearance of make dev + +2000-09-05 17:53 ds + + * comedi/drivers/ni_mio_cs.c: remove bogus undef + +2000-09-05 17:53 ds + + * comedi/drivers.c: fix for insn->mode0 conversion + +2000-09-05 11:33 ds + + * comedi/drivers/: ni_atmio.c, ni_mio_cs.c, ni_pcimio.c, ni_stc.h: + moved ni_private common stuff to .h + +2000-09-05 11:16 ds + + * comedi/drivers/ni_pcimio.c: device id + +2000-09-04 19:12 ds + + * comedi/drivers/ni_mio_common.c: hack bugfix for commands + +2000-09-04 19:11 ds + + * Makefile.modbuild: remove extra -DMODULE + +2000-09-04 16:09 ds + + * comedi/drivers/: ni_mio_common.c, ni_mio_cs.c: speedup changes. + +2000-09-04 16:08 ds + + * comedi/drivers/ni_pcimio.c: added PCI id + +2000-09-02 18:54 ds + + * comedi/drivers/ni_mio_common.c: fix cmdtest bug for external + triggering + +2000-09-02 18:53 ds + + * comedi/drivers/mite.h: added mite_list_devices() + +2000-09-02 18:51 ds + + * comedi/drivers/: ni_pcidio.c, ni_pcimio.c: additional debugging + for unknown boards + +2000-09-02 18:49 ds + + * include/comedi.h: add instruction bits support, make + comedi_insn_struct forward compatible + +2000-09-02 18:49 ds + + * comedi/: comedi_fops.c, comedi_module.h, drivers.c, + drivers/8255.c, drivers/dt282x.c, drivers/ni_mio_common.c: + instruction bits support + +2000-09-02 18:44 ds + + * comedi/drivers/: das16.c, dt3000.c: warning cleanups + +2000-09-02 18:42 ds + + * comedi/range.c: fix unknown range + +2000-09-02 18:41 ds + + * Documentation/comedi/command: doc update + +2000-09-02 18:41 ds + + * TODO: todo update + +2000-08-31 08:29 ds + + * comedi/drivers/ni_mio_cs.c: added product ID for 16e-4 + +2000-08-30 08:42 ds + + * comedi/drivers/ni_mio_cs.c: fix unknown device id message + +2000-08-18 17:59 ds + + * Makefile.modbuild: revert previous change (ppc cross-compile) + +2000-08-18 17:59 ds + + * comedi/drivers/: mite.c, ni_mio_common.c, ni_pcimio.c, ni_stc.h: + Additonal info on PCI boards, readded warning for unknown boards + +2000-08-09 13:45 ds + + * Makefile.modbuild: modbuild changes + +2000-08-09 13:44 ds + + * comedi/Config.in: makefile related fix + +2000-08-09 13:42 ds + + * comedi/: comedi_fops.c, proc.c, comedi_module.h: changes due to + modbuild + +2000-08-09 13:28 ds + + * comedi/drivers/ni_mio_cs.c: fix fifo depth + +2000-08-09 13:27 ds + + * scripts/: Configure, dep.rtai, preconfigure: dep fixes + +2000-08-07 23:44 ds + + * comedi/drivers/ni_pcimio.c: start name migration to ni_pcimio + +2000-08-05 16:31 ds + + * comedi/drivers/: ni_pcidio.c, ni_pcimio.c: new PCI ids from ni + source + +2000-07-27 17:38 ds + + * comedi/rtl.c: bugfix + +2000-07-26 16:12 ds + + * include/linux/config.h: merge modbuild-0.0.2 + +2000-07-26 16:11 ds + + * comedi/rtai.c: fix rtai.h include + +2000-07-26 16:10 ds + + * comedi/: comedi_module.h, comedi_rt.h: fix config.h include, as + per modbuild-0.0.2 + +2000-07-26 16:10 ds + + * comedi/drivers/: ni_atmio.c, ni_mio_cs.c: fix RT dep + +2000-07-26 16:07 ds + + * Makefile, Makefile.modbuild, scripts/Configure, + scripts/check_kernel, scripts/config.in, scripts/dep.linux, + scripts/dep.rtai, scripts/dep.rtlinux, scripts/mkdep.c, + scripts/preconfigure: merge modbuild-0.0.2 changes + +2000-07-26 13:51 ds + + * comedi/rtai.c, comedi/drivers/comedi_parport.c, + comedi/drivers/ni_mio_common.c, include/comedi.h: changes + +2000-07-25 17:28 ds + + * Makefile: version bump + +2000-07-24 12:43 ds + + * Documentation/comedi/drivers.txt, comedi/Config.in, + comedi/drivers/8255.h, comedi/drivers/Makefile, + scripts/Configure.help, comedi/drivers/pcl724.c: patch from dobes + +2000-07-24 12:42 ds + + * comedi/drivers/skel.c: added skeleton driver + +2000-07-24 12:41 ds + + * Makefile, Documentation/comedi/FAQ, + Documentation/comedi/hardware, comedi/Config.in, comedi/Makefile, + comedi/comedi_fops.c, comedi/comedi_module.h, comedi/drivers.c, + comedi/drivers/Makefile, comedi/drivers/das08-new.c, + comedi/drivers/das16-new.c, comedi/drivers/dt282x.c, + comedi/drivers/ni_atmio.c, comedi/drivers/ni_atmio16d.c, + comedi/drivers/ni_mio_common.c, comedi/drivers/ni_mio_cs.c, + comedi/drivers/ni_pcimio.c, comedi/drivers/ni_stc.h: lots of + changes + +2000-07-21 15:38 ds + + * comedi/drivers/: pcl812.c, pcl818.c: iobase fix + +2000-07-21 15:37 ds + + * comedi/drivers/pcl726.c: updates from Michal Dobes + +2000-07-14 19:37 ds + + * comedi/: comedi_module.h, drivers/das08-new.c, + drivers/das16-new.c: changes + +2000-07-13 10:31 ds + + * Makefile: version bump + +2000-07-13 10:25 ds + + * comedi/comedi_fops.c, comedi/drivers.c, comedi/kern_compat.h, + scripts/config.in: compilation fixes + +2000-07-13 10:15 ds + + * comedi/drivers/: ni_mio_common.c, ni_pcimio.c: fix breakage + +2000-07-13 10:02 ds + + * comedi/drivers/ni_mio_common.c: remove debugging bug + +2000-07-13 07:40 ds + + * comedi/comedi_fops.c: CONFIG_KMOD check + +2000-07-12 18:29 ds + + * comedi/kern_compat.h: added module stuff for 2.0 + +2000-07-12 18:27 ds + + * comedi/: comedi_fops.c, drivers.c: MOD_INC/DEC fixes + +2000-07-12 18:12 ds + + * comedi/drivers.c: __this_module fix + +2000-07-12 17:54 ds + + * comedi/kern_compat.h: added THIS_MODULE + +2000-07-12 17:46 ds + + * comedi/Config.in, comedi/Makefile, comedi/drivers/8255.c, + comedi/drivers/Makefile, comedi/drivers/comedi_parport.c, + comedi/drivers/daqboard2000.c, comedi/drivers/das08.c, + comedi/drivers/das08jr.c, comedi/drivers/das16.c, + comedi/drivers/das1600.c, comedi/drivers/das6402.c, + comedi/drivers/dt2801.c, comedi/drivers/dt2811.c, + comedi/drivers/dt2814.c, comedi/drivers/dt2815.c, + comedi/drivers/dt2817.c, comedi/drivers/dt282x.c, + comedi/drivers/dt3000.c, comedi/drivers/ii_pci20kc.c, + comedi/drivers/multiq3.c, comedi/drivers/ni_atmio.c, + comedi/drivers/ni_atmio16d.c, comedi/drivers/ni_pcidio.c, + comedi/drivers/ni_pcimio.c, comedi/drivers/pcl711.c, + comedi/drivers/pcl725.c, comedi/drivers/pcl726.c, + comedi/drivers/pcl812.c, comedi/drivers/pcl818.c, + comedi/drivers/rti800.c, comedi/drivers/rti802.c, + comedi/kcomedilib/Makefile, scripts/check_kernel, + scripts/config.dist, scripts/config.in: module, Makefile, config + changes + +2000-07-12 17:44 ds + + * comedi/drivers/: ni_mio_common.c, ni_mio_cs.c: random editing + +2000-07-12 17:42 ds + + * comedi/comedi_module.h: kernel compile fixes + +2000-07-12 17:39 ds + + * comedi/comedi_fops.c: comment, init code + +2000-07-12 17:39 ds + + * TODO: [no log message] + +2000-07-12 17:38 ds + + * README: email address changes + +2000-07-12 17:38 ds + + * Makefile: change installation + +2000-07-12 17:37 ds + + * Documentation/comedi/hardware: hardware list + +2000-07-12 17:35 ds + + * comedi/drivers/: das08-new.c, das16-new.c: new drivers + +2000-07-12 11:19 ds + + * comedi/Config.in: changes for DAS drivers, fix for kernel compile + +2000-06-26 08:29 ds + + * comedi/: rtl.c, drivers/8253.h, drivers/ni_pcidio.c, + drivers/pcl812.c: fix hidden include of linux/module.h by rtl.h + +2000-06-14 23:51 ds + + * comedi/: comedi_fops.c, comedi_module.h: major event handling + changes + +2000-06-14 23:46 ds + + * comedi/drivers/ni_mio_common.c: made PCI DMA optional + +2000-06-14 23:42 ds + + * comedi/drivers/ni_mio_common.c: more sign bit fixes + +2000-06-14 22:39 ds + + * comedi/drivers.c: more emulation + +2000-06-14 22:10 ds + + * include/comedi.h: instruction support + +2000-06-14 22:10 ds + + * comedi/: comedi_fops.c, comedi_module.h, comedi_rt.h, drivers.c: + insn support, rt virtualization, runflags + +2000-06-14 22:03 ds + + * comedi/drivers/: ni_atmio.c, ni_mio_common.c, ni_mio_cs.c, + ni_pcimio.c: fix more sign bit problems, added insn support for + ai + +2000-06-14 22:00 ds + + * comedi/Config.in: fix CONFIG_PCI dependency + +2000-06-14 21:57 ds + + * comedi/rtai.c: fix crash on rmmod dur to free_irq() + +2000-06-14 15:23 ds + + * comedi/drivers/dt2801.c: fix compile warning + +2000-06-14 00:56 ds + + * Documentation/comedi/notes/: boards, das, regmaps: collected + information about DAS boards + +2000-06-14 00:45 ds + + * comedi/drivers/: mite.c, mite.h, ni_mio_common.c, ni_pcimio.c: + PCI DMA support + +2000-06-14 00:26 ds + + * comedi/: comedi_module.h, comedi_rt.h, rt.c, rt_pend_tq.h, + rtai.c, rtl.c: TM added rt interrupt for user space support + +2000-06-14 00:02 ds + + * comedi/drivers/: ni_atmio.c, ni_mio_common.c, ni_stc.h: finally + fix 2's compliment bug in asynchronous + +2000-06-02 00:03 ds + + * comedi/drivers/ni_mio_common.c: analog output range problem fix + +2000-05-31 20:07 ds + + * comedi/drivers/ni_mio_common.c: interrupt service routine -- + stops interrupts on error + +2000-05-26 17:54 ds + + * comedi/kcomedilib/kcomedilib_main.c: [no log message] + +2000-05-26 17:54 ds + + * comedi/drivers/: ni_atmio.c, ni_atmio16d.c, ni_mio_common.c, + ni_mio_cs.c, ni_pcimio.c, ni_stc.h: patch from Tomasz, more fixes + for ni_mio_cs.c + +2000-05-26 17:53 ds + + * Rules.make, comedi/Config.in, comedi/comedi_fops.c: patch from + Tomasz + +2000-05-26 17:30 ds + + * comedi/drivers/ni_mio_cs.c: fix interrupt pin. interrupts work. + +2000-05-25 19:43 ds + + * comedi/drivers/ni_mio_cs.c: driver works + +2000-05-25 19:19 ds + + * comedi/drivers/ni_mio_cs.c: Correctly configures card -- + fingerprint works + +2000-05-24 16:35 ds + + * comedi/Config.in: fix last PCMCIA fix + +2000-05-24 16:31 ds + + * Makefile: fix previous PCMCIA breakage + +2000-05-24 16:29 ds + + * comedi/drivers/daqboard2000.c: PCI fixes for 2.3 + +2000-05-24 16:19 ds + + * comedi/Config.in: PCMCIA fixes + +2000-05-24 16:19 ds + + * Makefile: version bump, PCMCIA fixes + +2000-05-24 16:18 ds + + * comedi/drivers/ni_mio_cs.c: more work + +2000-05-24 15:51 ds + + * comedi/drivers/dt2815.c: warning fix + +2000-05-24 15:32 ds + + * comedi/drivers/ni_pcimio.c: add gpct members to ni_private + +2000-05-24 15:27 ds + + * scripts/Configure.help: Heavily updated for new drivers, new + CONFIG_ options + +2000-05-24 14:43 ds + + * comedi/range.c: range_type cleanup + +2000-05-24 14:43 ds + + * comedi/comedi_fops.c: dev->minor fix, a minor bugfix + +2000-05-24 14:42 ds + + * comedi/kcomedilib/kcomedilib_main.c: additions from Michal Dobes + +2000-05-24 14:25 ds + + * include/comedi.h: added SDF_PACKED + +2000-05-23 19:31 ds + + * comedi/: comedi_ksyms.c, comedi_module.h, drivers.c: dynamic + allocation of devices for PCMCIA + +2000-05-23 19:26 ds + + * comedi/comedi_fops.c, comedi/comedi_ksyms.c, + comedi/comedi_module.h, include/comedi.h: added + comedi_error_done() + +2000-05-23 19:26 ds + + * comedi/drivers/: 8253.h, pcl818.c: patch from Michal Dobes + +2000-05-23 11:21 ds + + * comedi/drivers/ni_mio_cs.c: more changes + +2000-05-23 10:50 ds + + * comedi/drivers/pcl818.c: patch from Michael Dobes + +2000-05-23 10:50 ds + + * comedi/drivers/: daqboard2000.c, daqboard2000_fpga.h: patch from + Anders Blomdell + +2000-05-23 10:46 ds + + * Documentation/comedi/drivers.txt, comedi/Config.in, + comedi/drivers/8253.h, comedi/drivers/Makefile, + comedi/drivers/pcl711.c, comedi/drivers/pcl812.c: patch from + Michael Dobes + +2000-05-23 10:44 ds + + * comedi/: Config.in, drivers.c, drivers/Makefile, + drivers/ni_atmio.c, drivers/ni_atmio16d.c, + drivers/ni_mio_common.c, drivers/ni_stc.h: patch from Anders + Blomdell + +2000-05-21 12:23 ds + + * comedi/drivers/ni_mio_cs.c: updates to mio_cs + +2000-05-10 15:51 ds + + * comedi/drivers/ni_mio_common.c: documentation fixes + +2000-05-10 15:51 ds + + * comedi/: comedi_fops.c, range.c: range fixes for multiple + channels + +2000-05-06 13:26 ds + + * comedi/drivers/ni_atmio16d.c: sanity fixes + +2000-05-06 11:55 ds + + * comedi/drivers/ni_atmio16d.c: buffer fix + +2000-05-06 11:55 ds + + * comedi/Config.in: PCMCIA fix + +2000-05-05 12:24 ds + + * comedi/: Config.in, drivers.c, drivers/Makefile, + drivers/dt3000.c, drivers/ni_atmio.c, drivers/ni_atmio16d.c: + random unknown changes + +2000-05-05 12:23 ds + + * comedi/: Config.in, drivers/Makefile, drivers/ni_mio_common.c, + drivers/ni_stc.h: changes for ni_mio_cs + +2000-05-05 12:22 ds + + * comedi/drivers/ni_mio_cs.c: added ni_mio_cs.c + +2000-05-05 12:14 ds + + * comedi/drivers/ni_atmio16d.c: added ni_atmio16d.c + +2000-04-06 00:18 ds + + * Makefile: LINUXDIR fix + +2000-04-03 21:59 ds + + * comedi/kcomedilib/kcomedilib_main.c: compile fix + +2000-04-03 21:59 ds + + * comedi/drivers/ni_mio_common.c: fixes for continuous acquisition + +2000-03-23 10:58 ds + + * comedi/kcomedilib/: data.c, dio.c, kcomedilib_main.c: fixed + data_len issues + +2000-03-22 11:35 ds + + * comedi/drivers/ni_pcidio.c: allocates correct number of subdevs + +2000-03-22 11:34 ds + + * comedi/drivers/das1600.c: tentative patch for das16 compatibility + +2000-03-22 11:33 ds + + * comedi/drivers/8255.h: added warning when not configured + +2000-03-21 12:08 ds + + * Makefile, comedi/kcomedilib/kcomedilib_main.c: compilation fix + +2000-03-13 17:17 ds + + * comedi/kcomedilib/kcomedilib_main.c: fix data_len bug + +2000-03-11 08:17 ds + + * comedi/comedi_fops.c, comedi/kcomedilib/kcomedilib_main.c, + include/comedi.h: Added prototypes for kcomedilib functions in + comedi.h, added comedi_open and comedi_close, removed conflict + with comedi. + +2000-03-09 14:05 ds + + * Documentation/comedi/drivers.txt: updates + +2000-03-09 14:04 ds + + * comedi/drivers.c: dev->board bugfix + +2000-03-09 13:28 ds + + * comedi/drivers/8255.h: changed CONFIG_8255 to CONFIG_COMEDI_8255 + +2000-03-09 13:28 ds + + * comedi/drivers/ni_pcidio.c: Correctly inits 6503 + +2000-03-06 00:37 ds + + * comedi/drivers/ni_mio_common.c: fixups for commands + +2000-03-06 00:36 ds + + * comedi/comedi_fops.c: Split do_trig_ioctl() and fixups for + commands. + +2000-03-05 19:59 ds + + * comedi/range.c: warning fix + +2000-03-05 19:59 ds + + * comedi/range.c: additional checks for getrange ioctl + +2000-03-05 19:13 ds + + * comedi/comedi_fops.c: fix range_table==NULL bug + +2000-03-05 17:18 ds + + * comedi/drivers/8253.h: New file + +2000-03-05 17:18 ds + + * comedi/: Config.in, comedi_fops.c, comedi_module.h, drivers.c, + proc.c, range.c, drivers/das1600.c, drivers/das6402.c, + drivers/dt2814.c, drivers/dt282x.c, drivers/dt3000.c, + drivers/ni_mio_common.c, drivers/ni_pcidio.c, drivers/pcl711.c, + drivers/pcl812.c, kcomedilib/dio.c, kcomedilib/kcomedilib_main.c: + Removed timer_type globally, moved to + comedi_get_device_by_minor(), removed VER08 conf option, made all + timers TIMER_nanosec (ni_mio_common, pcl711, pcl812), pcl812 + changes, pcl812 indent + +2000-03-05 17:13 ds + + * TODO: [no log message] + +2000-03-03 18:07 ds + + * comedi/drivers/pcl812.c: Compilation fixes + +2000-03-03 16:08 ds + + * Documentation/comedi/drivers.txt: added new drivers + +2000-03-03 15:54 ds + + * TODO: [no log message] + +2000-03-03 15:51 ds + + * INSTALL: updated INSTALL + +2000-03-03 15:35 ds + + * Changelog: who needs changelogs anyway + +2000-03-03 15:29 ds + + * INSTALL.RTAI, INSTALL.RTLinux: new install files for RTAI and + RTLinux + +2000-03-03 15:10 ds + + * comedi/drivers/pcl812.c: added timer function + +2000-03-03 15:06 ds + + * comedi/comedi_ksyms.c: removed symbols that were moved to + kcomedilib + +2000-03-02 00:16 ds + + * comedi/drivers/ni_pcidio.c: Added PCI id for PCI-6503 + +2000-03-02 00:11 ds + + * Documentation/comedi/drivers.txt, comedi/Config.in, + comedi/comedi_module.h, comedi/drivers.c, + comedi/drivers/Makefile, comedi/drivers/pcl812.c: Added pcl812 + driver from Michal Dobes + +2000-02-26 17:39 ds + + * comedi/drivers/ii_pci20kc.c: modularized PCI20k modules, general + cleanup + +2000-02-26 17:38 ds + + * comedi/comedi_module.h: added private element to subdevice + structure + +2000-02-26 15:23 ds + + * comedi/drivers/ii_pci20kc.c: include reordering + +2000-02-26 15:12 ds + + * comedi/kcomedilib/Makefile: fixed linking + +2000-02-26 15:04 ds + + * Makefile: no changes + +2000-02-26 15:03 ds + + * TODO: [no log message] + +2000-02-26 15:02 ds + + * comedi/comedi_fops.c: added command testing + +2000-02-26 15:01 ds + + * comedi/drivers.c: rvfree memleak fix + +2000-02-26 14:59 ds + + * comedi/drivers/ni_pcimio.c: added PCI ID + +2000-02-26 14:59 ds + + * comedi/drivers/ni_mio_common.c: added AO channel loop + +2000-02-26 14:58 ds + + * comedi/drivers/ii_pci20kc.c: range fixes + +2000-02-25 12:12 ds + + * comedi/Config.in: Added entry for ii_pci20kc + +2000-02-25 12:11 ds + + * comedi/drivers/Makefile: Fix ii_pci20kc again + +2000-02-25 12:11 ds + + * comedi/drivers/Makefile: Fix ii_pci20kc + +2000-02-25 12:09 ds + + * comedi/drivers/Makefile: Added ii_pci20kc + +2000-02-25 12:09 ds + + * comedi/drivers/: ii-pci20kc.c, ii_pci20kc.c: Change name. + +2000-02-25 12:07 ds + + * comedi/drivers/ii-pci20kc.c: Added Intelligent Instruments + PCI-200001C driver + +2000-02-24 15:31 ds + + * comedi/Makefile: don't always make realtime subdir + +2000-02-21 18:52 ds + + * comedi/dummy.c: added init_module()/cleanup_module() + +2000-02-20 14:54 ds + + * comedi/kcomedilib/: Makefile, data.c, dio.c: added + comedi_data_*() and comedi_dio_*() functions + +2000-02-20 14:53 ds + + * comedi/kcomedilib/: kcomedilib.c, kcomedilib_main.c: rename + +2000-02-17 00:03 ds + + * Makefile, comedi/comedi_fops.c, comedi/range.c, + comedi/drivers/ni_mio_common.c, comedi/drivers/ni_pcimio.c, + include/comedi.h: command changes, range fixes + +2000-02-15 00:02 ds + + * comedi/Makefile, comedi/comedi_fops.c, comedi/comedi_ksyms.c, + comedi/comedi_module.h, comedi/drivers.c, comedi/dummy.c, + comedi/mk_range.c, comedi/range.c, comedi/drivers/8255.c, + comedi/drivers/Makefile, comedi/drivers/comedi_parport.c, + comedi/drivers/das08.c, comedi/drivers/das08jr.c, + comedi/drivers/das1600.c, comedi/drivers/das6402.c, + comedi/drivers/dt2801.c, comedi/drivers/dt2811.c, + comedi/drivers/dt2814.c, comedi/drivers/dt2815.c, + comedi/drivers/dt2817.c, comedi/drivers/dt282x.c, + comedi/drivers/dt3000.c, comedi/drivers/multiq3.c, + comedi/drivers/ni_pcidio.c, comedi/drivers/pcl711.c, + comedi/drivers/pcl725.c, comedi/drivers/pcl726.c, + comedi/drivers/rti800.c, comedi/drivers/rti802.c, + include/comedi.h: range modularization + +2000-02-15 00:01 ds + + * comedi/drivers/ni_stc.h: ai_speed addition + +2000-02-15 00:00 ds + + * comedi/drivers/: ni_atmio.c, ni_mio_common.c, ni_pcimio.c: range + changes, command support, ai_speed addition, device additions to + pci_mio.c + +2000-02-12 14:47 ds + + * include/comedi.h: changed command flags to a bitfield + +2000-02-11 18:26 ds + + * comedi/drivers/das1600.c: fixed _attach() using local variable + for board number + +2000-02-11 18:25 ds + + * comedi/: Config.in, Makefile: Fixes for virtual drivers + +2000-02-09 20:56 ds + + * comedi/range.c: fixed typo on RANGE_bipolar2_5 + +2000-02-09 20:53 ds + + * comedi/drivers/: dt2801.c, dt282x.c: [no log message] + +2000-02-09 20:52 ds + + * Makefile, comedi/Makefile, comedi/range.c: Updates for dt2801 + driver + +2000-02-09 15:55 ds + + * comedi/: Makefile, comedi_ksyms.c, rtl.c: RTL fixes, export + functions for kcomedilib + +2000-02-09 15:55 ds + + * Makefile: RTL fixes + +2000-02-09 11:45 ds + + * comedi/Makefile: fixes for RANGE_* for pcimio + +2000-02-09 11:45 ds + + * Makefile, TODO: version bump, fixes for RTLinux compiling + +2000-02-08 23:51 ds + + * comedi/: comedi_module.h, drivers/dt282x.c: initial command + support for dt282x + +2000-02-08 22:57 ds + + * Makefile, comedi/comedi_ksyms.c, comedi/comedi_module.h: ksyms + needed for kcomedilib + +2000-02-08 22:43 ds + + * comedi/rt.c: This file somehow disappeared from the repository + +2000-02-08 21:10 ds + + * Makefile, comedi/comedi_module.h: More compilation fixes + +2000-02-08 20:59 ds + + * comedi/: rtl.c, rtl.h, rtl_v1.h: Removed unnecessary header files + +2000-02-08 20:57 ds + + * comedi/: Makefile, comedi_module.h, rtai.c, rtai.h, rtl.c: fixed + compilation problems with RTL/RTAI + +2000-02-08 20:56 ds + + * Documentation/comedi/drivers.txt: updated comedi_parport + +2000-02-08 20:56 ds + + * Makefile, TODO: update + +2000-02-08 18:20 ds + + * comedi/drivers/dt2801.c: Duh. Compilation fixes. + +2000-02-08 18:12 ds + + * comedi/drivers/dt2801.c: Modified debugging + +2000-02-07 15:11 ds + + * comedi/drivers/comedi_parport.c: compilation fix + +2000-02-07 15:08 ds + + * comedi/drivers/: Makefile, comedi_parport.c: Fix to make + comedi_parport driver modular + +2000-02-07 15:08 ds + + * comedi/parport.c: [no log message] + +2000-02-06 09:23 ds + + * Makefile: version bump + +2000-02-06 09:16 ds + + * TODO: [no log message] + +2000-02-05 13:43 ds + + * comedi/drivers/das16.c: Corrected type in last patch. + +2000-02-03 15:07 ds + + * comedi/drivers/das16.c: Added dev->boardname= in das16. + +2000-02-01 20:49 ds + + * Makefile, comedi/Config.in, comedi/Makefile, + comedi/comedi_fops.c, comedi/comedi_ksyms.c, comedi/module.c, + comedi/rtai.c, comedi/rtl.c, comedi/rtl_v1.c, + comedi/drivers/ni_mio_common.c, scripts/config.dist: moved + module.c to comedi_fops.c merged patch + +2000-02-01 19:21 ds + + * Changelog, INSTALL, Makefile, NOTES, README, Rules.make, TODO, + Documentation/comedi/FAQ, + Documentation/comedi/Hardware_Driver.HOWTO, + Documentation/comedi/command, Documentation/comedi/drivers.txt, + Documentation/comedi/mode-info, + Documentation/comedi/notes/README, + Documentation/comedi/notes/atmio_notes, + Documentation/comedi/notes/das, + Documentation/comedi/notes/testing, comedi/Config.in, + comedi/Makefile, comedi/am9513.h, comedi/comedi_ksyms.c, + comedi/comedi_module.h, comedi/drivers.c, comedi/dummy.c, + comedi/kern_compat.h, comedi/kvmem.c, comedi/kvmem.h, + comedi/mk_range.c, comedi/module.c, comedi/parport.c, + comedi/proc.c, comedi/range.c, comedi/rtai.c, comedi/rtai.h, + comedi/rtl.c, comedi/rtl.h, comedi/rtl_v1.c, comedi/rtl_v1.h, + comedi/drivers/8255.c, comedi/drivers/8255.h, + comedi/drivers/Makefile, comedi/drivers/das08.c, + comedi/drivers/das08jr.c, comedi/drivers/das16.c, + comedi/drivers/das1600.c, comedi/drivers/das6402.c, + comedi/drivers/dt2801.c, comedi/drivers/dt2811.c, + comedi/drivers/dt2814.c, comedi/drivers/dt2815.c, + comedi/drivers/dt2817.c, comedi/drivers/dt282x.c, + comedi/drivers/dt3000.c, comedi/drivers/mite.c, + comedi/drivers/mite.h, comedi/drivers/multiq3.c, + comedi/drivers/ni_atmio.c, comedi/drivers/ni_mio_common.c, + comedi/drivers/ni_pcidio.c, comedi/drivers/ni_pcimio.c, + comedi/drivers/ni_stc.h, comedi/drivers/pcl711.c, + comedi/drivers/pcl725.c, comedi/drivers/pcl726.c, + comedi/drivers/rti800.c, comedi/drivers/rti802.c, + comedi/kcomedilib/Makefile, comedi/kcomedilib/kcomedilib.c, + include/comedi.h, scripts/Configure, scripts/Configure.help, + scripts/check_kernel, scripts/config.dist, scripts/config.h.dist, + scripts/config.in, scripts/pathdown.sh: Import of comedi-0.7.36. + +2000-02-01 19:21 ds + + * Changelog, INSTALL, Makefile, NOTES, README, Rules.make, TODO, + Documentation/comedi/FAQ, + Documentation/comedi/Hardware_Driver.HOWTO, + Documentation/comedi/command, Documentation/comedi/drivers.txt, + Documentation/comedi/mode-info, + Documentation/comedi/notes/README, + Documentation/comedi/notes/atmio_notes, + Documentation/comedi/notes/das, + Documentation/comedi/notes/testing, comedi/Config.in, + comedi/Makefile, comedi/am9513.h, comedi/comedi_ksyms.c, + comedi/comedi_module.h, comedi/drivers.c, comedi/dummy.c, + comedi/kern_compat.h, comedi/kvmem.c, comedi/kvmem.h, + comedi/mk_range.c, comedi/module.c, comedi/parport.c, + comedi/proc.c, comedi/range.c, comedi/rtai.c, comedi/rtai.h, + comedi/rtl.c, comedi/rtl.h, comedi/rtl_v1.c, comedi/rtl_v1.h, + comedi/drivers/8255.c, comedi/drivers/8255.h, + comedi/drivers/Makefile, comedi/drivers/das08.c, + comedi/drivers/das08jr.c, comedi/drivers/das16.c, + comedi/drivers/das1600.c, comedi/drivers/das6402.c, + comedi/drivers/dt2801.c, comedi/drivers/dt2811.c, + comedi/drivers/dt2814.c, comedi/drivers/dt2815.c, + comedi/drivers/dt2817.c, comedi/drivers/dt282x.c, + comedi/drivers/dt3000.c, comedi/drivers/mite.c, + comedi/drivers/mite.h, comedi/drivers/multiq3.c, + comedi/drivers/ni_atmio.c, comedi/drivers/ni_mio_common.c, + comedi/drivers/ni_pcidio.c, comedi/drivers/ni_pcimio.c, + comedi/drivers/ni_stc.h, comedi/drivers/pcl711.c, + comedi/drivers/pcl725.c, comedi/drivers/pcl726.c, + comedi/drivers/rti800.c, comedi/drivers/rti802.c, + comedi/kcomedilib/Makefile, comedi/kcomedilib/kcomedilib.c, + include/comedi.h, scripts/Configure, scripts/Configure.help, + scripts/check_kernel, scripts/config.dist, scripts/config.h.dist, + scripts/config.in, scripts/pathdown.sh: Initial revision diff --git a/comedi/comedi_fops.c b/comedi/comedi_fops.c index d012c029..c8dc9b9a 100644 --- a/comedi/comedi_fops.c +++ b/comedi/comedi_fops.c @@ -174,12 +174,12 @@ static int do_devconfig_ioctl(comedi_device *dev,comedi_devconfig *arg, unsigned aux_len = it.options[COMEDI_DEVCONF_AUX_DATA_LENGTH]; if(aux_len<0)return -EFAULT; - aux_data = kmalloc(aux_len, GFP_KERNEL); - if(!aux_data)return -EFAULT; + aux_data = vmalloc(aux_len); + if(!aux_data) return -ENOMEM; if(copy_from_user(aux_data, comedi_aux_data(it.options, 0), aux_len)){ - kfree(aux_data); + vfree(aux_data); return -EFAULT; } it.options[COMEDI_DEVCONF_AUX_DATA_LO] = (unsigned long)aux_data; @@ -193,7 +193,7 @@ static int do_devconfig_ioctl(comedi_device *dev,comedi_devconfig *arg, unsigned ret = comedi_device_attach(dev,&it); - if(aux_data) kfree(aux_data); + if(aux_data) vfree(aux_data); return ret; } @@ -1784,7 +1784,7 @@ static struct file_operations comedi_fops={ }; #endif -static struct class_simple *comedi_class; +static struct class *comedi_class; static int __init comedi_init(void) { @@ -1795,7 +1795,7 @@ static int __init comedi_init(void) printk("comedi: unable to get major %d\n",COMEDI_MAJOR); return -EIO; } - comedi_class = class_simple_create(THIS_MODULE, "comedi"); + comedi_class = class_create(THIS_MODULE, "comedi"); if(IS_ERR(comedi_class)) { printk("comedi: failed to create class"); @@ -1805,7 +1805,7 @@ static int __init comedi_init(void) comedi_devices=(comedi_device *)kmalloc(sizeof(comedi_device)*COMEDI_NDEVICES,GFP_KERNEL); if(!comedi_devices) { - class_simple_destroy(comedi_class); + class_destroy(comedi_class); devfs_unregister_chrdev(COMEDI_MAJOR,"comedi"); return -ENOMEM; } @@ -1823,7 +1823,7 @@ static int __init comedi_init(void) sprintf(name, "comedi%d", i); devfs_register(NULL, name, DEVFS_FL_DEFAULT, COMEDI_MAJOR, i, 0666 | S_IFCHR, &comedi_fops, NULL); - class_simple_device_add(comedi_class, MKDEV(COMEDI_MAJOR, i), NULL, "comedi%i", i); + class_device_create(comedi_class, MKDEV(COMEDI_MAJOR, i), NULL, "comedi%i", i); } comedi_rt_init(); @@ -1840,12 +1840,12 @@ static void __exit comedi_cleanup(void) for(i=0;i 2) return -1; if(count > 0xffff) return -1; @@ -234,7 +236,7 @@ static inline int i8254_load(unsigned long base_address, byte = counter_number << 6; byte |= 0x30; // load low then high byte byte |= (mode << 1); // set counter mode - outb(byte, base_address + counter_control); + outb(byte, base_address + i8254_control_reg); byte = count & 0xff; // lsb of counter value outb(byte, base_address + counter_number); byte = (count >> 8) & 0xff; // msb of counter value @@ -243,11 +245,10 @@ static inline int i8254_load(unsigned long base_address, return 0; } -static inline int i8254_mm_load(unsigned long base_address, +static inline int i8254_mm_load(void *base_address, unsigned int counter_number, unsigned int count, unsigned int mode) { unsigned int byte; - static const int counter_control = 3; if(counter_number > 2) return -1; if(count > 0xffff) return -1; @@ -257,7 +258,7 @@ static inline int i8254_mm_load(unsigned long base_address, byte = counter_number << 6; byte |= 0x30; // load low then high byte byte |= (mode << 1); // set counter mode - writeb(byte, base_address + counter_control); + writeb(byte, base_address + i8254_control_reg); byte = count & 0xff; // lsb of counter value writeb(byte, base_address + counter_number); byte = (count >> 8) & 0xff; // msb of counter value @@ -271,13 +272,12 @@ static inline int i8254_read(unsigned long base_address, unsigned int counter_nu { unsigned int byte; int ret; - static const int counter_control = 3; if(counter_number > 2) return -1; // latch counter byte = counter_number << 6; - outb(byte, base_address + counter_control); + outb(byte, base_address + i8254_control_reg); // read lsb ret = inb(base_address + counter_number); @@ -286,6 +286,13 @@ static inline int i8254_read(unsigned long base_address, unsigned int counter_nu return ret; } + +static inline int i8254_status(unsigned long base_address, int counter_number) +{ + outb(0xE0 | (2 << counter_number), base_address + i8254_control_reg); + return inb(base_address + counter_number); +} + #endif #endif diff --git a/comedi/drivers/8255.c b/comedi/drivers/8255.c index 3a8679b7..fa752385 100644 --- a/comedi/drivers/8255.c +++ b/comedi/drivers/8255.c @@ -385,13 +385,11 @@ static int dev_8255_attach(comedi_device *dev,comedi_devconfig *it) iobase=it->options[i]; printk(" 0x%04x",iobase); - if(check_region(iobase,_8255_SIZE)<0){ + if(!request_region(iobase,_8255_SIZE,"8255")){ printk(" (I/O port conflict)"); dev->subdevices[i].type=COMEDI_SUBD_UNUSED; }else{ - request_region(iobase,_8255_SIZE,"8255"); - subdev_8255_init(dev,dev->subdevices+i,NULL,iobase); } } diff --git a/comedi/drivers/Makefile.am b/comedi/drivers/Makefile.am index 110127a8..6418ff9f 100644 --- a/comedi/drivers/Makefile.am +++ b/comedi/drivers/Makefile.am @@ -1,5 +1,5 @@ -#SUBDIRS = addi-data +SUBDIRS = addi-data AM_CFLAGS = $(COMEDI_CFLAGS) $(LINUX_CFLAGS) $(RTAI_CFLAGS) $(RTLINUX_CFLAGS) LINK = $(top_builddir)/modtool --link -o $@ \ @@ -48,7 +48,8 @@ EXTRA_DIST = \ ni_stc.h \ plx9052.h \ plx9080.h \ - rtd520.h + rtd520.h \ + s626.h # mpc8260cpm.ko @@ -106,6 +107,7 @@ module_PROGRAMS = \ das6402.ko \ das800.ko \ das1800.ko \ + dmm32at.ko \ dt2801.ko \ dt2811.ko \ dt2814.ko \ @@ -147,6 +149,7 @@ module_PROGRAMS = \ rti802.ko \ skel.ko \ ssv_dnp.ko \ + s626.ko \ comedi_test.ko \ $(pcmcia_modules) \ $(usb_modules) \ @@ -181,6 +184,7 @@ das16m1_ko_SOURCES = das16m1.c das6402_ko_SOURCES = das6402.c das800_ko_SOURCES = das800.c das1800_ko_SOURCES = das1800.c +dmm32at_ko_SOURCES = dmm32at.c dt2801_ko_SOURCES = dt2801.c dt2811_ko_SOURCES = dt2811.c dt2814_ko_SOURCES = dt2814.c @@ -229,6 +233,7 @@ rti800_ko_SOURCES = rti800.c rti802_ko_SOURCES = rti802.c skel_ko_SOURCES = skel.c ssv_dnp_ko_SOURCES = ssv_dnp.c +s626_ko_SOURCES = s626.c comedi_test_ko_SOURCES = comedi_test.c usbdux_ko_SOURCES = usbdux.c usbduxfast_ko_SOURCES = usbduxfast.c diff --git a/comedi/drivers/acl7225b.c b/comedi/drivers/acl7225b.c index e0351bc1..d7c0479e 100644 --- a/comedi/drivers/acl7225b.c +++ b/comedi/drivers/acl7225b.c @@ -90,13 +90,11 @@ static int acl7225b_attach(comedi_device *dev,comedi_devconfig *it) iorange=this_board->io_range; printk("comedi%d: acl7225b: board=%s 0x%04x ", dev->minor, this_board->name, iobase); - if( check_region(iobase, iorange) < 0 ) - { + if( !request_region(iobase, iorange, "acl7225b") ) { printk("I/O port conflict\n"); return -EIO; } - request_region(iobase, iorange, "acl7225b"); - dev->board_name=this_board->name; + dev->board_name=this_board->name; dev->iobase=iobase; dev->irq=0; diff --git a/comedi/drivers/addi-data/APCI1710_82x54.c b/comedi/drivers/addi-data/APCI1710_82x54.c index 6cbe9eff..bf013783 100644 --- a/comedi/drivers/addi-data/APCI1710_82x54.c +++ b/comedi/drivers/addi-data/APCI1710_82x54.c @@ -1,801 +1,925 @@ -/* - +-----------------------------------------------------------------------+ - | (C) ADDI-DATA GmbH Dieselstraße 3 D-77833 Ottersweier | - +-----------------------------------------------------------------------+ - | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | - | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | - +-----------------------------------------------------------------------+ - | Project : API APCI1710 | Compiler : BORLANDC/MICROSOFT C | - | Module name : 82X54.C | Version : 3.1 / 6.0 | - +-------------------------------+---------------------------------------+ - | Author : S.WEBER | Date : 29.06.98 | - +-----------------------------------------------------------------------+ - | Description : APCI-1710 82X54 timer module | - | | - | | - +-----------------------------------------------------------------------+ - | UPDATES | - +-----------------------------------------------------------------------+ - | Date | Author | Description of updates | - +----------+-----------+------------------------------------------------+ - | 29/06/98 | S. Weber | Digital input / output implementation | - |----------|-----------|------------------------------------------------| - | 08/05/00 | Guinot C | - 0400/0228 All Function in RING 0 | - | | | available | - +-----------------------------------------------------------------------+ - | | | | - | | | | - +-----------------------------------------------------------------------+ -*/ - -/* -+----------------------------------------------------------------------------+ -| Included files | -+----------------------------------------------------------------------------+ -*/ - - -#include "APCI1710_82x54.h" - -/* -+----------------------------------------------------------------------------+ -| Function Name : _INT_ i_APCI1710_InitTimer | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_TimerNbr, | -| BYTE_ b_TimerMode, | -| ULONG_ ul_ReloadValue, | -| BYTE_ b_InputClockSelection, | -| BYTE_ b_InputClockLevel, | -| BYTE_ b_OutputLevel, | -| BYTE_ b_HardwareGateLevel) -INT i_InsnConfig_InitTimer(comedi_device *dev,comedi_subdevice *s, - comedi_insn *insn,lsampl_t *data) -| -+----------------------------------------------------------------------------+ -| Task : Configure the Timer (b_TimerNbr) operating mode | -| (b_TimerMode) from selected module (b_ModulNbr). | -| You must calling this function be for you call any | -| other function witch access of the timer. | -| | -| | -| Timer mode description table | -| | -|+--------+-----------------------------+--------------+--------------------+| -||Selected+ Mode description +u_ReloadValue | Hardware gate input|| -|| mode | | description | action || -|+--------+-----------------------------+--------------+--------------------+| -|| |Mode 0 is typically used | | || -|| |for event counting. After | | || -|| |the initialisation, OUT | | || -|| |is initially low, and | | || -|| 0 |will remain low until the |Start counting| Hardware gate || -|| |counter reaches zero. | value | || -|| |OUT then goes high and | | || -|| |remains high until a new | | || -|| |count is written. See | | || -|| |"i_APCI1710_WriteTimerValue" | | || -|| |function. | | || -|+--------+-----------------------------+--------------+--------------------+| -|| |Mode 1 is similar to mode 0 | | || -|| |except for the gate input | | || -|| 1 |action. The gate input is not|Start counting| Hardware trigger || -|| |used for enabled or disabled | value | || -|| |the timer. | | || -|| |The gate input is used for | | || -|| |triggered the timer. | | || -|+--------+-----------------------------+--------------+--------------------+| -|| |This mode functions like a | | || -|| |divide-by-ul_ReloadValue | | || -|| |counter. It is typically used| | || -|| |to generate a real time clock| | || -|| |interrupt. OUT will initially| | || -|| 2 |be high after the | Division | Hardware gate || -|| |initialisation. When the | factor | || -|| |initial count has decremented| | || -|| |to 1, OUT goes low for one | | || -|| |CLK pule. OUT then goes high | | || -|| |again, the counter reloads | | || -|| |the initial count | | || -|| |(ul_ReloadValue) and the | | || -|| |process is repeated. | | || -|| |This action can generated a | | || -|| |interrupt. See function | | || -|| |"i_APCI1710_SetBoardInt- | | || -|| |RoutineX" | | || -|| |and "i_APCI1710_EnableTimer" | | || -|+--------+-----------------------------+--------------+--------------------+| -|| |Mode 3 is typically used for | | || -|| |baud rate generation. This | | || -|| |mode is similar to mode 2 | | || -|| |except for the duty cycle of | | || -|| 3 |OUT. OUT will initially be | Division | Hardware gate || -|| |high after the initialisation| factor | || -|| |When half the initial count | | || -|| |(ul_ReloadValue) has expired,| | || -|| |OUT goes low for the | | || -|| |remainder of the count. The | | || -|| |mode is periodic; the | | || -|| |sequence above is repeated | | || -|| |indefinitely. | | || -|+--------+-----------------------------+--------------+--------------------+| -|| |OUT will be initially high | | || -|| |after the initialisation. | | || -|| |When the initial count | | || -|| 4 |expires OUT will go low for |Start counting| Hardware gate || -|| |one CLK pulse and then go | value | || -|| |high again. | | || -|| |The counting sequences is | | || -|| |triggered by writing a new | | || -|| |value. See | | || -|| |"i_APCI1710_WriteTimerValue" | | || -|| |function. If a new count is | | || -|| |written during counting, | | || -|| |it will be loaded on the | | || -|| |next CLK pulse | | || -|+--------+-----------------------------+--------------+--------------------+| -|| |Mode 5 is similar to mode 4 | | || -|| |except for the gate input | | || -|| |action. The gate input is not| | || -|| 5 |used for enabled or disabled |Start counting| Hardware trigger || -|| |the timer. The gate input is | value | || -|| |used for triggered the timer.| | || -|+--------+-----------------------------+--------------+--------------------+| -| | -| | -| | -| Input clock selection table | -| | -| +--------------------------------+------------------------------------+ | -| | b_InputClockSelection | Description | | -| | parameter | | | -| +--------------------------------+------------------------------------+ | -| | APCI1710_PCI_BUS_CLOCK | For the timer input clock, the PCI | | -| | | bus clock / 4 is used. This PCI bus| | -| | | clock can be 30MHz or 33MHz. For | | -| | | Timer 0 only this selection are | | -| | | available. | | -| +--------------------------------+------------------------------------+ | -| | APCI1710_ FRONT_CONNECTOR_INPUT| Of the front connector you have the| | -| | | possibility to inject a input clock| | -| | | for Timer 1 or Timer 2. The source | | -| | | from this clock can eat the output | | -| | | clock from Timer 0 or any other | | -| | | clock source. | | -| +--------------------------------+------------------------------------+ | -| | -+----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board | -| APCI-1710 | -| BYTE_ b_ModulNbr : Module number to | -| configure (0 to 3) | -| BYTE_ b_TimerNbr : Timer number to | -| configure (0 to 2) | -| BYTE_ b_TimerMode : Timer mode selection | -| (0 to 5) | -| 0: Interrupt on terminal| -| count | -| 1: Hardware | -| retriggerable one- | -| shot | -| 2: Rate generator | -| 3: Square wave mode | -| 4: Software triggered | -| strobe | -| 5: Hardware triggered | -| strobe | -| See timer mode | -| description table. | -| ULONG_ ul_ReloadValue : Start counting value | -| or division factor | -| See timer mode | -| description table. | -| BYTE_ b_InputClockSelection : Selection from input | -| timer clock. | -| See input clock | -| selection table. | -| BYTE_ b_InputClockLevel : Selection from input | -| clock level. | -| 0 : Low active | -| (Input inverted) | -| 1 : High active | -| BYTE_ b_OutputLevel, : Selection from output | -| clock level. | -| 0 : Low active | -| 1 : High active | -| (Output inverted) | -| BYTE_ b_HardwareGateLevel : Selection from | -| hardware gate level. | -| 0 : Low active | -| (Input inverted) | -| 1 : High active | -| If you will not used | -| the hardware gate set | -| this value to 0. -|b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_TimerNbr = (BYTE) CR_CHAN(insn->chanspec); - b_TimerMode = (BYTE) data[0]; - ul_ReloadValue = (ULONG) data[1]; - b_InputClockSelection =(BYTE) data[2]; - b_InputClockLevel =(BYTE) data[3]; - b_OutputLevel =(BYTE) data[4]; - b_HardwareGateLevel =(BYTE) data[5]; -+----------------------------------------------------------------------------+ -| Output Parameters : - | -+----------------------------------------------------------------------------+ -| Return Value : 0: No error | -| -1: The handle parameter of the board is wrong | -| -2: Module selection wrong | -| -3: Timer selection wrong | -| -4: The module is not a TIMER module | -| -5: Timer mode selection is wrong | -| -6: Input timer clock selection is wrong | -| -7: Selection from input clock level is wrong | -| -8: Selection from output clock level is wrong | -| -9: Selection from hardware gate level is wrong | -+----------------------------------------------------------------------------+ -*/ - - -INT i_APCI1710_InsnConfigInitTimer(comedi_device *dev,comedi_subdevice *s, - comedi_insn *insn,lsampl_t *data) - { - - INT i_ReturnValue = 0; - BYTE b_ModulNbr; - BYTE b_TimerNbr; - BYTE b_TimerMode; - ULONG ul_ReloadValue; - BYTE b_InputClockSelection; - BYTE b_InputClockLevel; - BYTE b_OutputLevel; - BYTE b_HardwareGateLevel; - - i_ReturnValue=insn->n; - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_TimerNbr = (BYTE) CR_CHAN(insn->chanspec); - b_TimerMode = (BYTE) data[0]; - ul_ReloadValue = (ULONG) data[1]; - b_InputClockSelection =(BYTE) data[2]; - b_InputClockLevel =(BYTE) data[3]; - b_OutputLevel =(BYTE) data[4]; - b_HardwareGateLevel =(BYTE) data[5]; - - /**************************/ - /* Test the module number */ - /**************************/ - - if (b_ModulNbr < 4) - { - /***********************/ - /* Test if 82X54 timer */ - /***********************/ - - if ((devpriv->s_BoardInfos. - dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF0000UL) == APCI1710_82X54_TIMER) - { - /*************************/ - /* Test the timer number */ - /*************************/ - - if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) - { - /***********************/ - /* Test the timer mode */ - /***********************/ - - if ((b_TimerMode >= 0) && (b_TimerMode <= 5)) - { - /*********************************/ - /* Test te imput clock selection */ - /*********************************/ - - if (((b_TimerNbr == 0) && (b_InputClockSelection == 0)) || - ((b_TimerNbr != 0) && ((b_InputClockSelection == 0) || (b_InputClockSelection == 1)))) - { - /****************************************/ - /* Test the input clock level selection */ - /****************************************/ - - if ((b_InputClockLevel == 0) || (b_InputClockLevel == 1)) - { - /*****************************************/ - /* Test the output clock level selection */ - /*****************************************/ - - if ((b_OutputLevel == 0) || (b_OutputLevel == 1)) - { - /******************************************/ - /* Test the hardware gate level selection */ - /******************************************/ - - if ((b_HardwareGateLevel == 0) || (b_HardwareGateLevel == 1)) - { - /*********************/ - /* Initialisation OK */ - /*********************/ - - devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo. - s_82X54TimerInfo [b_TimerNbr]. - b_82X54Init = 1; - - /**********************************/ - /* Save the input clock selection */ - /**********************************/ - devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo. - s_82X54TimerInfo [b_TimerNbr]. - b_InputClockSelection = b_InputClockSelection; - - /******************************/ - /* Save the input clock level */ - /******************************/ - devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo. - s_82X54TimerInfo [b_TimerNbr]. - b_InputClockLevel = ~b_InputClockLevel & 1; - - /*************************/ - /* Save the output level */ - /*************************/ - - devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo. - s_82X54TimerInfo [b_TimerNbr]. - b_OutputLevel = ~b_OutputLevel & 1; - - /***********************/ - /* Save the gate level */ - /***********************/ - - devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo. - s_82X54TimerInfo [b_TimerNbr]. - b_HardwareGateLevel = b_HardwareGateLevel; - - /****************************************************/ - /* Set the configuration word and disable the timer */ - /****************************************************/ - devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo. - s_82X54TimerInfo [b_TimerNbr]. - dw_ConfigurationWord = (DWORD) (((b_HardwareGateLevel << 0) & 0x1) | - ((b_InputClockLevel << 1) & 0x2) | - (((~b_OutputLevel & 1) << 2) & 0x4) | - ((b_InputClockSelection << 4) & 0x10)); - - - outl(devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo.s_82X54TimerInfo [b_TimerNbr]. - dw_ConfigurationWord, devpriv->s_BoardInfos. - ui_Address + 32 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); - - /******************************/ - /* Initialise the 82X54 Timer */ - /******************************/ - - - outl((DWORD) b_TimerMode,devpriv->s_BoardInfos. - ui_Address + 16 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); - - /**************************/ - /* Write the reload value */ - /**************************/ - +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ +/* + + +-----------------------------------------------------------------------+ + | (C) ADDI-DATA GmbH Dieselstraße 3 D-77833 Ottersweier | + +-----------------------------------------------------------------------+ + | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | + | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | + +-----------------------------------------------------------------------+ + | Project : API APCI1710 | Compiler : gcc | + | Module name : 82X54.C | Version : 2.96 | + +-------------------------------+---------------------------------------+ + | Project manager: Eric Stolz | Date : 02/12/2002 | + +-----------------------------------------------------------------------+ + | Description : APCI-1710 82X54 timer module | + | | + | | + +-----------------------------------------------------------------------+ + | UPDATES | + +-----------------------------------------------------------------------+ + | Date | Author | Description of updates | + +----------+-----------+------------------------------------------------+ + | 29/06/98 | S. Weber | Digital input / output implementation | + |----------|-----------|------------------------------------------------| + | 08/05/00 | Guinot C | - 0400/0228 All Function in RING 0 | + | | | available | + +-----------------------------------------------------------------------+ + | 27.10.03 | J. Krauth | Add the possibility to use a 40 Mhz quartz | + | | | | + +-----------------------------------------------------------------------+ +*/ + +/* ++----------------------------------------------------------------------------+ +| Included files | ++----------------------------------------------------------------------------+ +*/ + + +#include "APCI1710_82x54.h" + +/* ++----------------------------------------------------------------------------+ +| Function Name : _INT_ i_APCI1710_InitTimer | +| (BYTE_ b_BoardHandle, | +| BYTE_ b_ModulNbr, | +| BYTE_ b_TimerNbr, | +| BYTE_ b_TimerMode, | +| ULONG_ ul_ReloadValue, | +| BYTE_ b_InputClockSelection, | +| BYTE_ b_InputClockLevel, | +| BYTE_ b_OutputLevel, | +| BYTE_ b_HardwareGateLevel) +INT i_InsnConfig_InitTimer(comedi_device *dev,comedi_subdevice *s, + comedi_insn *insn,lsampl_t *data) +| ++----------------------------------------------------------------------------+ +| Task : Configure the Timer (b_TimerNbr) operating mode | +| (b_TimerMode) from selected module (b_ModulNbr). | +| You must calling this function be for you call any | +| other function witch access of the timer. | +| | +| | +| Timer mode description table | +| | +|+--------+-----------------------------+--------------+--------------------+| +||Selected+ Mode description +u_ReloadValue | Hardware gate input|| +|| mode | | description | action || +|+--------+-----------------------------+--------------+--------------------+| +|| |Mode 0 is typically used | | || +|| |for event counting. After | | || +|| |the initialisation, OUT | | || +|| |is initially low, and | | || +|| 0 |will remain low until the |Start counting| Hardware gate || +|| |counter reaches zero. | value | || +|| |OUT then goes high and | | || +|| |remains high until a new | | || +|| |count is written. See | | || +|| |"i_APCI1710_WriteTimerValue" | | || +|| |function. | | || +|+--------+-----------------------------+--------------+--------------------+| +|| |Mode 1 is similar to mode 0 | | || +|| |except for the gate input | | || +|| 1 |action. The gate input is not|Start counting| Hardware trigger || +|| |used for enabled or disabled | value | || +|| |the timer. | | || +|| |The gate input is used for | | || +|| |triggered the timer. | | || +|+--------+-----------------------------+--------------+--------------------+| +|| |This mode functions like a | | || +|| |divide-by-ul_ReloadValue | | || +|| |counter. It is typically used| | || +|| |to generate a real time clock| | || +|| |interrupt. OUT will initially| | || +|| 2 |be high after the | Division | Hardware gate || +|| |initialisation. When the | factor | || +|| |initial count has decremented| | || +|| |to 1, OUT goes low for one | | || +|| |CLK pule. OUT then goes high | | || +|| |again, the counter reloads | | || +|| |the initial count | | || +|| |(ul_ReloadValue) and the | | || +|| |process is repeated. | | || +|| |This action can generated a | | || +|| |interrupt. See function | | || +|| |"i_APCI1710_SetBoardInt- | | || +|| |RoutineX" | | || +|| |and "i_APCI1710_EnableTimer" | | || +|+--------+-----------------------------+--------------+--------------------+| +|| |Mode 3 is typically used for | | || +|| |baud rate generation. This | | || +|| |mode is similar to mode 2 | | || +|| |except for the duty cycle of | | || +|| 3 |OUT. OUT will initially be | Division | Hardware gate || +|| |high after the initialisation| factor | || +|| |When half the initial count | | || +|| |(ul_ReloadValue) has expired,| | || +|| |OUT goes low for the | | || +|| |remainder of the count. The | | || +|| |mode is periodic; the | | || +|| |sequence above is repeated | | || +|| |indefinitely. | | || +|+--------+-----------------------------+--------------+--------------------+| +|| |OUT will be initially high | | || +|| |after the initialisation. | | || +|| |When the initial count | | || +|| 4 |expires OUT will go low for |Start counting| Hardware gate || +|| |one CLK pulse and then go | value | || +|| |high again. | | || +|| |The counting sequences is | | || +|| |triggered by writing a new | | || +|| |value. See | | || +|| |"i_APCI1710_WriteTimerValue" | | || +|| |function. If a new count is | | || +|| |written during counting, | | || +|| |it will be loaded on the | | || +|| |next CLK pulse | | || +|+--------+-----------------------------+--------------+--------------------+| +|| |Mode 5 is similar to mode 4 | | || +|| |except for the gate input | | || +|| |action. The gate input is not| | || +|| 5 |used for enabled or disabled |Start counting| Hardware trigger || +|| |the timer. The gate input is | value | || +|| |used for triggered the timer.| | || +|+--------+-----------------------------+--------------+--------------------+| +| | +| | +| | +| Input clock selection table | +| | +| +--------------------------------+------------------------------------+ | +| | b_InputClockSelection | Description | | +| | parameter | | | +| +--------------------------------+------------------------------------+ | +| | APCI1710_PCI_BUS_CLOCK | For the timer input clock, the PCI | | +| | | bus clock / 4 is used. This PCI bus| | +| | | clock can be 30MHz or 33MHz. For | | +| | | Timer 0 only this selection are | | +| | | available. | | +| +--------------------------------+------------------------------------+ | +| | APCI1710_ FRONT_CONNECTOR_INPUT| Of the front connector you have the| | +| | | possibility to inject a input clock| | +| | | for Timer 1 or Timer 2. The source | | +| | | from this clock can eat the output | | +| | | clock from Timer 0 or any other | | +| | | clock source. | | +| +--------------------------------+------------------------------------+ | +| | ++----------------------------------------------------------------------------+ +| Input Parameters : BYTE_ b_BoardHandle : Handle of board | +| APCI-1710 | +| BYTE_ b_ModulNbr : Module number to | +| configure (0 to 3) | +| BYTE_ b_TimerNbr : Timer number to | +| configure (0 to 2) | +| BYTE_ b_TimerMode : Timer mode selection | +| (0 to 5) | +| 0: Interrupt on terminal| +| count | +| 1: Hardware | +| retriggerable one- | +| shot | +| 2: Rate generator | +| 3: Square wave mode | +| 4: Software triggered | +| strobe | +| 5: Hardware triggered | +| strobe | +| See timer mode | +| description table. | +| ULONG_ ul_ReloadValue : Start counting value | +| or division factor | +| See timer mode | +| description table. | +| BYTE_ b_InputClockSelection : Selection from input | +| timer clock. | +| See input clock | +| selection table. | +| BYTE_ b_InputClockLevel : Selection from input | +| clock level. | +| 0 : Low active | +| (Input inverted) | +| 1 : High active | +| BYTE_ b_OutputLevel, : Selection from output | +| clock level. | +| 0 : Low active | +| 1 : High active | +| (Output inverted) | +| BYTE_ b_HardwareGateLevel : Selection from | +| hardware gate level. | +| 0 : Low active | +| (Input inverted) | +| 1 : High active | +| If you will not used | +| the hardware gate set | +| this value to 0. +|b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); + b_TimerNbr = (BYTE) CR_CHAN(insn->chanspec); + b_TimerMode = (BYTE) data[0]; + ul_ReloadValue = (ULONG) data[1]; + b_InputClockSelection =(BYTE) data[2]; + b_InputClockLevel =(BYTE) data[3]; + b_OutputLevel =(BYTE) data[4]; + b_HardwareGateLevel =(BYTE) data[5]; ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value : 0: No error | +| -1: The handle parameter of the board is wrong | +| -2: Module selection wrong | +| -3: Timer selection wrong | +| -4: The module is not a TIMER module | +| -5: Timer mode selection is wrong | +| -6: Input timer clock selection is wrong | +| -7: Selection from input clock level is wrong | +| -8: Selection from output clock level is wrong | +| -9: Selection from hardware gate level is wrong | ++----------------------------------------------------------------------------+ +*/ + + +INT i_APCI1710_InsnConfigInitTimer(comedi_device *dev,comedi_subdevice *s, + comedi_insn *insn,lsampl_t *data) + { + + INT i_ReturnValue = 0; + BYTE b_ModulNbr; + BYTE b_TimerNbr; + BYTE b_TimerMode; + ULONG ul_ReloadValue; + BYTE b_InputClockSelection; + BYTE b_InputClockLevel; + BYTE b_OutputLevel; + BYTE b_HardwareGateLevel; + + //BEGIN JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz + DWORD dw_Test = 0; + //END JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz + + i_ReturnValue=insn->n; + b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); + b_TimerNbr = (BYTE) CR_CHAN(insn->chanspec); + b_TimerMode = (BYTE) data[0]; + ul_ReloadValue = (ULONG) data[1]; + b_InputClockSelection =(BYTE) data[2]; + b_InputClockLevel =(BYTE) data[3]; + b_OutputLevel =(BYTE) data[4]; + b_HardwareGateLevel =(BYTE) data[5]; + + + /**************************/ + /* Test the module number */ + /**************************/ + + + if (b_ModulNbr < 4) + { + /***********************/ + /* Test if 82X54 timer */ + /***********************/ + + if ((devpriv->s_BoardInfos. + dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF0000UL) == APCI1710_82X54_TIMER) + { + /*************************/ + /* Test the timer number */ + /*************************/ + + if (b_TimerNbr <= 2) + { + /***********************/ + /* Test the timer mode */ + /***********************/ + + if (b_TimerMode <= 5) + { + //BEGIN JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz + /*********************************/ + /* Test te imput clock selection */ + /*********************************/ + /* + if (((b_TimerNbr == 0) && (b_InputClockSelection == 0)) || + ((b_TimerNbr != 0) && ((b_InputClockSelection == 0) || (b_InputClockSelection == 1)))) + */ + + if (((b_TimerNbr == 0) && (b_InputClockSelection == APCI1710_PCI_BUS_CLOCK)) || + ((b_TimerNbr == 0) && (b_InputClockSelection == APCI1710_10MHZ)) || + ((b_TimerNbr != 0) && ((b_InputClockSelection == APCI1710_PCI_BUS_CLOCK) + || (b_InputClockSelection == APCI1710_FRONT_CONNECTOR_INPUT) + || (b_InputClockSelection == APCI1710_10MHZ)))) + //END JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz + { + //BEGIN JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz + if (((b_InputClockSelection == APCI1710_10MHZ) && + ((devpriv->s_BoardInfos.dw_MolduleConfiguration [b_ModulNbr] & 0x0000FFFFUL) >= 0x3131)) || + (b_InputClockSelection != APCI1710_10MHZ)) + { + //END JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz + /****************************************/ + /* Test the input clock level selection */ + /****************************************/ + + if ((b_InputClockLevel == 0) || (b_InputClockLevel == 1)) + { + /*****************************************/ + /* Test the output clock level selection */ + /*****************************************/ + + if ((b_OutputLevel == 0) || (b_OutputLevel == 1)) + { + /******************************************/ + /* Test the hardware gate level selection */ + /******************************************/ + + if ((b_HardwareGateLevel == 0) || (b_HardwareGateLevel == 1)) + { + //BEGIN JK 27.10.03 : Add the possibility to use a 40 Mhz quartz + /*****************************************************/ + /* Test if version > 1.1 and clock selection = 10MHz */ + /*****************************************************/ + + if ((b_InputClockSelection == APCI1710_10MHZ) && + ((devpriv->s_BoardInfos.dw_MolduleConfiguration [b_ModulNbr] & 0x0000FFFFUL) > 0x3131)) + { + /*********************************/ + /* Test if 40MHz quartz on board */ + /*********************************/ + + dw_Test = inl (devpriv->s_BoardInfos.ui_Address + (16 + (b_TimerNbr * 4) + (64 * b_ModulNbr))); + + dw_Test = (dw_Test >> 16) & 1; + } + else + { + dw_Test = 1; + } + + /************************/ + /* Test if detection OK */ + /************************/ + + if (dw_Test == 1) + { + //END JK 27.10.03 : Add the possibility to use a 40 Mhz quartz + /*********************/ + /* Initialisation OK */ + /*********************/ + + devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo. + s_82X54TimerInfo [b_TimerNbr]. + b_82X54Init = 1; + + /**********************************/ + /* Save the input clock selection */ + /**********************************/ + devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo. + s_82X54TimerInfo [b_TimerNbr]. + b_InputClockSelection = b_InputClockSelection; + + /******************************/ + /* Save the input clock level */ + /******************************/ + devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo. + s_82X54TimerInfo [b_TimerNbr]. + b_InputClockLevel = ~b_InputClockLevel & 1; + + /*************************/ + /* Save the output level */ + /*************************/ + + devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo. + s_82X54TimerInfo [b_TimerNbr]. + b_OutputLevel = ~b_OutputLevel & 1; + + /***********************/ + /* Save the gate level */ + /***********************/ + + devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo. + s_82X54TimerInfo [b_TimerNbr]. + b_HardwareGateLevel = b_HardwareGateLevel; + + /****************************************************/ + /* Set the configuration word and disable the timer */ + /****************************************************/ + //BEGIN JK 27.10.03 : Add the possibility to use a 40 Mhz quartz + /* + devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo. + s_82X54TimerInfo [b_TimerNbr]. + dw_ConfigurationWord = (DWORD) (((b_HardwareGateLevel << 0) & 0x1) | + ((b_InputClockLevel << 1) & 0x2) | + (((~b_OutputLevel & 1) << 2) & 0x4) | + ((b_InputClockSelection << 4) & 0x10)); + */ + /**************************/ + /* Test if 10MHz selected */ + /**************************/ + + if (b_InputClockSelection == APCI1710_10MHZ) + { + b_InputClockSelection = 2; + } + + devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo. + s_82X54TimerInfo [b_TimerNbr]. + dw_ConfigurationWord = (DWORD) (((b_HardwareGateLevel << 0) & 0x1) | + ((b_InputClockLevel << 1) & 0x2) | + (((~b_OutputLevel & 1) << 2) & 0x4) | + ((b_InputClockSelection << 4) & 0x30)); + //END JK 27.10.03 : Add the possibility to use a 40 Mhz quartz + outl(devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo.s_82X54TimerInfo [b_TimerNbr]. + dw_ConfigurationWord, devpriv->s_BoardInfos. + ui_Address + 32 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); + + /******************************/ + /* Initialise the 82X54 Timer */ + /******************************/ + - outl(ul_ReloadValue,devpriv->s_BoardInfos. - ui_Address + 0 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); - - } // if ((b_HardwareGateLevel == 0) || (b_HardwareGateLevel == 1)) - else - { - /***********************************************/ - /* Selection from hardware gate level is wrong */ - /***********************************************/ - DPRINTK("Selection from hardware gate level is wrong\n"); - i_ReturnValue = -9; - } // if ((b_HardwareGateLevel == 0) || (b_HardwareGateLevel == 1)) - } // if ((b_OutputLevel == 0) || (b_OutputLevel == 1)) - else - { - /**********************************************/ - /* Selection from output clock level is wrong */ - /**********************************************/ - DPRINTK("Selection from output clock level is wrong\n"); - i_ReturnValue = -8; - } // if ((b_OutputLevel == 0) || (b_OutputLevel == 1)) - } // if ((b_InputClockLevel == 0) || (b_InputClockLevel == 1)) - else - { - /*********************************************/ - /* Selection from input clock level is wrong */ - /*********************************************/ - DPRINTK("Selection from input clock level is wrong\n"); - i_ReturnValue = -7; - } // if ((b_InputClockLevel == 0) || (b_InputClockLevel == 1)) - } - else - { - /****************************************/ - /* Input timer clock selection is wrong */ - /****************************************/ - DPRINTK("Input timer clock selection is wrong\n"); - i_ReturnValue = -6; - } - } // if ((b_TimerMode >= 0) && (b_TimerMode <= 5)) - else - { - /*********************************/ - /* Timer mode selection is wrong */ - /*********************************/ - DPRINTK("Timer mode selection is wrong\n"); - i_ReturnValue = -5; - } // if ((b_TimerMode >= 0) && (b_TimerMode <= 5)) - } // if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) - else - { - /*************************/ - /* Timer selection wrong */ - /*************************/ - DPRINTK("Timer selection wrong\n"); - i_ReturnValue = -3; - } // if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) - } - else - { - /************************************/ - /* The module is not a TIMER module */ - /************************************/ - DPRINTK("The module is not a TIMER module\n"); - i_ReturnValue = -4; - } - } - else - { - /***********************/ - /* Module number error */ - /***********************/ - DPRINTK("Module number error\n"); - i_ReturnValue = -2; - } - - return (i_ReturnValue); - } - - -/* -+----------------------------------------------------------------------------+ -| Function Name : _INT_ i_APCI1710_EnableTimer | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_TimerNbr, | -| BYTE_ b_InterruptEnable) -INT i_APCI1710_InsnWriteEnableDisableTimer(comedi_device *dev,comedi_subdevice *s, - comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Enable OR Disable the Timer (b_TimerNbr) from selected module | -| (b_ModulNbr). You must calling the | -| "i_APCI1710_InitTimer" function be for you call this | -| function. If you enable the timer interrupt, the timer | -| generate a interrupt after the timer value reach | -| the zero. See function "i_APCI1710_SetBoardIntRoutineX"| -+----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board | -| APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number | -| (0 to 3) | -| BYTE_ b_TimerNbr : Timer number to enable | -| (0 to 2) | -| BYTE_ b_InterruptEnable : Enable or disable the | -| timer interrupt. | -| APCI1710_ENABLE : | -| Enable the timer interrupt | -| APCI1710_DISABLE : | -| Disable the timer interrupt| -i_ReturnValue=insn->n; - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_TimerNbr = (BYTE) CR_CHAN(insn->chanspec); - b_ActionType = (BYTE) data[0]; // enable disable -+----------------------------------------------------------------------------+ -| Output Parameters : - | -+----------------------------------------------------------------------------+ -| Return Value : 0: No error | -| -1: The handle parameter of the board is wrong | -| -2: Module selection wrong | -| -3: Timer selection wrong | -| -4: The module is not a TIMER module | -| -5: Timer not initialised see function | -| "i_APCI1710_InitTimer" | -| -6: Interrupt parameter is wrong | -| -7: Interrupt function not initialised. | -| See function "i_APCI1710_SetBoardIntRoutineX" | -+----------------------------------------------------------------------------+ -*/ - -INT i_APCI1710_InsnWriteEnableDisableTimer(comedi_device *dev,comedi_subdevice *s, - comedi_insn *insn,lsampl_t *data) - { - INT i_ReturnValue = 0; - DWORD dw_DummyRead; - BYTE b_ModulNbr; - BYTE b_TimerNbr; - BYTE b_ActionType; - BYTE b_InterruptEnable; - - i_ReturnValue=insn->n; - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_TimerNbr = (BYTE) CR_CHAN(insn->chanspec); - b_ActionType = (BYTE) data[0]; // enable disable - /**************************/ - /* Test the module number */ - /**************************/ - - if (b_ModulNbr < 4) - { - /***********************/ - /* Test if 82X54 timer */ - /***********************/ - - if ((devpriv->s_BoardInfos. - dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF0000UL) == APCI1710_82X54_TIMER) - { - /*************************/ - /* Test the timer number */ - /*************************/ - - if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) - { - /*****************************/ - /* Test if timer initialised */ - /*****************************/ - - if (devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo. - s_82X54TimerInfo [b_TimerNbr]. - b_82X54Init == 1) - { - - switch(b_ActionType) - { - case APCI1710_ENABLE: - - b_InterruptEnable = (BYTE) data[1]; - /********************************/ - /* Test the interrupt selection */ - /********************************/ - - if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) - { - if (b_InterruptEnable == APCI1710_ENABLE) - { + outl((DWORD) b_TimerMode,devpriv->s_BoardInfos. + ui_Address + 16 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); + + /**************************/ + /* Write the reload value */ + /**************************/ + + + outl(ul_ReloadValue,devpriv->s_BoardInfos. + ui_Address + 0 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); + //BEGIN JK 27.10.03 : Add the possibility to use a 40 Mhz quartz + } // if (dw_Test == 1) + else + { + /****************************************/ + /* Input timer clock selection is wrong */ + /****************************************/ + + i_ReturnValue = -6; + } // if (dw_Test == 1) + //END JK 27.10.03 : Add the possibility to use a 40 Mhz quartz + } // if ((b_HardwareGateLevel == 0) || (b_HardwareGateLevel == 1)) + else + { + /***********************************************/ + /* Selection from hardware gate level is wrong */ + /***********************************************/ + + DPRINTK("Selection from hardware gate level is wrong\n"); + i_ReturnValue = -9; + } // if ((b_HardwareGateLevel == 0) || (b_HardwareGateLevel == 1)) + } // if ((b_OutputLevel == 0) || (b_OutputLevel == 1)) + else + { + /**********************************************/ + /* Selection from output clock level is wrong */ + /**********************************************/ + + DPRINTK("Selection from output clock level is wrong\n"); + i_ReturnValue = -8; + } // if ((b_OutputLevel == 0) || (b_OutputLevel == 1)) + } // if ((b_InputClockLevel == 0) || (b_InputClockLevel == 1)) + else + { + /*********************************************/ + /* Selection from input clock level is wrong */ + /*********************************************/ + + DPRINTK("Selection from input clock level is wrong\n"); + i_ReturnValue = -7; + } // if ((b_InputClockLevel == 0) || (b_InputClockLevel == 1)) + } + else + { + /****************************************/ + /* Input timer clock selection is wrong */ + /****************************************/ + + DPRINTK("Input timer clock selection is wrong\n"); + i_ReturnValue = -6; + } + } + else + { + /****************************************/ + /* Input timer clock selection is wrong */ + /****************************************/ + + DPRINTK("Input timer clock selection is wrong\n"); + i_ReturnValue = -6; + } + } // if ((b_TimerMode >= 0) && (b_TimerMode <= 5)) + else + { + /*********************************/ + /* Timer mode selection is wrong */ + /*********************************/ + + DPRINTK("Timer mode selection is wrong\n"); + i_ReturnValue = -5; + } // if ((b_TimerMode >= 0) && (b_TimerMode <= 5)) + } // if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) + else + { + /*************************/ + /* Timer selection wrong */ + /*************************/ + + DPRINTK("Timer selection wrong\n"); + i_ReturnValue = -3; + } // if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) + } + else + { + /************************************/ + /* The module is not a TIMER module */ + /************************************/ + + DPRINTK("The module is not a TIMER module\n"); + i_ReturnValue = -4; + } + } + else + { + /***********************/ + /* Module number error */ + /***********************/ + + DPRINTK("Module number error\n"); + i_ReturnValue = -2; + } + + return (i_ReturnValue); + } + + +/* ++----------------------------------------------------------------------------+ +| Function Name : _INT_ i_APCI1710_EnableTimer | +| (BYTE_ b_BoardHandle, | +| BYTE_ b_ModulNbr, | +| BYTE_ b_TimerNbr, | +| BYTE_ b_InterruptEnable) +INT i_APCI1710_InsnWriteEnableDisableTimer(comedi_device *dev,comedi_subdevice *s, + comedi_insn *insn,lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Enable OR Disable the Timer (b_TimerNbr) from selected module | +| (b_ModulNbr). You must calling the | +| "i_APCI1710_InitTimer" function be for you call this | +| function. If you enable the timer interrupt, the timer | +| generate a interrupt after the timer value reach | +| the zero. See function "i_APCI1710_SetBoardIntRoutineX"| ++----------------------------------------------------------------------------+ +| Input Parameters : BYTE_ b_BoardHandle : Handle of board | +| APCI-1710 | +| BYTE_ b_ModulNbr : Selected module number | +| (0 to 3) | +| BYTE_ b_TimerNbr : Timer number to enable | +| (0 to 2) | +| BYTE_ b_InterruptEnable : Enable or disable the | +| timer interrupt. | +| APCI1710_ENABLE : | +| Enable the timer interrupt | +| APCI1710_DISABLE : | +| Disable the timer interrupt| +i_ReturnValue=insn->n; + b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); + b_TimerNbr = (BYTE) CR_CHAN(insn->chanspec); + b_ActionType = (BYTE) data[0]; // enable disable ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value : 0: No error | +| -1: The handle parameter of the board is wrong | +| -2: Module selection wrong | +| -3: Timer selection wrong | +| -4: The module is not a TIMER module | +| -5: Timer not initialised see function | +| "i_APCI1710_InitTimer" | +| -6: Interrupt parameter is wrong | +| -7: Interrupt function not initialised. | +| See function "i_APCI1710_SetBoardIntRoutineX" | ++----------------------------------------------------------------------------+ +*/ + +INT i_APCI1710_InsnWriteEnableDisableTimer(comedi_device *dev,comedi_subdevice *s, + comedi_insn *insn,lsampl_t *data) + { + INT i_ReturnValue = 0; + DWORD dw_DummyRead; + BYTE b_ModulNbr; + BYTE b_TimerNbr; + BYTE b_ActionType; + BYTE b_InterruptEnable; + + i_ReturnValue=insn->n; + b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); + b_TimerNbr = (BYTE) CR_CHAN(insn->chanspec); + b_ActionType = (BYTE) data[0]; // enable disable + /**************************/ + /* Test the module number */ + /**************************/ + + if (b_ModulNbr < 4) + { + /***********************/ + /* Test if 82X54 timer */ + /***********************/ + + if ((devpriv->s_BoardInfos. + dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF0000UL) == APCI1710_82X54_TIMER) + { + /*************************/ + /* Test the timer number */ + /*************************/ + + if (b_TimerNbr <= 2) + { + /*****************************/ + /* Test if timer initialised */ + /*****************************/ + + if (devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo. + s_82X54TimerInfo [b_TimerNbr]. + b_82X54Init == 1) + { + + switch(b_ActionType) + { + case APCI1710_ENABLE: + + b_InterruptEnable = (BYTE) data[1]; + /********************************/ + /* Test the interrupt selection */ + /********************************/ + + if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) + { + if (b_InterruptEnable == APCI1710_ENABLE) + { - dw_DummyRead=inl(devpriv->s_BoardInfos. - ui_Address + 12 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); - - /************************/ - /* Enable the interrupt */ - /************************/ - - devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo. - s_82X54TimerInfo [b_TimerNbr]. - dw_ConfigurationWord = devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo. - s_82X54TimerInfo [b_TimerNbr]. - dw_ConfigurationWord | 0x8; - - - outl(devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo. - s_82X54TimerInfo [b_TimerNbr]. - dw_ConfigurationWord,devpriv->s_BoardInfos. + dw_DummyRead=inl(devpriv->s_BoardInfos. + ui_Address + 12 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); + + /************************/ + /* Enable the interrupt */ + /************************/ + + devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo. + s_82X54TimerInfo [b_TimerNbr]. + dw_ConfigurationWord = devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo. + s_82X54TimerInfo [b_TimerNbr]. + dw_ConfigurationWord | 0x8; + + + outl(devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo. + s_82X54TimerInfo [b_TimerNbr]. + dw_ConfigurationWord,devpriv->s_BoardInfos. ui_Address + 32 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); - devpriv->tsk_Current=current; // Save the current process task structure - + devpriv->tsk_Current=current; // Save the current process task structure + - } // if (b_InterruptEnable == APCI1710_ENABLE) - else - { - /*************************/ - /* Disable the interrupt */ - /*************************/ - - devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo. - s_82X54TimerInfo [b_TimerNbr]. - dw_ConfigurationWord = devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo. - s_82X54TimerInfo [b_TimerNbr]. - dw_ConfigurationWord & 0xF7; - - - outl(devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo. - s_82X54TimerInfo [b_TimerNbr]. - dw_ConfigurationWord,devpriv->s_BoardInfos. - ui_Address + 32 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); - - /***************************/ - /* Save the interrupt flag */ - /***************************/ - - devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo. - b_InterruptMask = devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo. - b_InterruptMask & (0xFF - (1 << b_TimerNbr)); - } // if (b_InterruptEnable == APCI1710_ENABLE) - - /***********************/ - /* Test if error occur */ - /***********************/ - - if (i_ReturnValue >= 0) - { - /***************************/ - /* Save the interrupt flag */ - /***************************/ - - devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo. - b_InterruptMask = devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo. - b_InterruptMask | ((1 & b_InterruptEnable) << b_TimerNbr); - - - /********************/ - /* Enable the timer */ - /********************/ - - - outl(1,devpriv->s_BoardInfos. - ui_Address + 44 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); - } - } - else - { - /********************************/ - /* Interrupt parameter is wrong */ - /********************************/ - DPRINTK("\n"); - i_ReturnValue = -6; - } - break; - case APCI1710_DISABLE: - /***************************/ - /* Test the interrupt flag */ - /***************************/ - - if (((devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo. - b_InterruptMask >> b_TimerNbr) & 1) == 1) - { - /*************************/ - /* Disable the interrupt */ - /*************************/ - - devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo. - s_82X54TimerInfo [b_TimerNbr]. - dw_ConfigurationWord = devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo. - s_82X54TimerInfo [b_TimerNbr]. - dw_ConfigurationWord & 0xF7; - - - outl(devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo. - s_82X54TimerInfo [b_TimerNbr]. - dw_ConfigurationWord,devpriv->s_BoardInfos. - ui_Address + 32 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); - - /***************************/ - /* Save the interrupt flag */ - /***************************/ - - devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo. - b_InterruptMask = devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo.b_InterruptMask & (0xFF - (1 << b_TimerNbr)); - } - - /*********************/ - /* Disable the timer */ - /*********************/ - + } // if (b_InterruptEnable == APCI1710_ENABLE) + else + { + /*************************/ + /* Disable the interrupt */ + /*************************/ + + devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo. + s_82X54TimerInfo [b_TimerNbr]. + dw_ConfigurationWord = devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo. + s_82X54TimerInfo [b_TimerNbr]. + dw_ConfigurationWord & 0xF7; + + + outl(devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo. + s_82X54TimerInfo [b_TimerNbr]. + dw_ConfigurationWord,devpriv->s_BoardInfos. + ui_Address + 32 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); + + /***************************/ + /* Save the interrupt flag */ + /***************************/ + + devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo. + b_InterruptMask = devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo. + b_InterruptMask & (0xFF - (1 << b_TimerNbr)); + } // if (b_InterruptEnable == APCI1710_ENABLE) + + /***********************/ + /* Test if error occur */ + /***********************/ + + if (i_ReturnValue >= 0) + { + /***************************/ + /* Save the interrupt flag */ + /***************************/ + + devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo. + b_InterruptMask = devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo. + b_InterruptMask | ((1 & b_InterruptEnable) << b_TimerNbr); + + + /********************/ + /* Enable the timer */ + /********************/ + + + outl(1,devpriv->s_BoardInfos. + ui_Address + 44 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); + } + } + else + { + /********************************/ + /* Interrupt parameter is wrong */ + /********************************/ + + DPRINTK("\n"); + i_ReturnValue = -6; + } + break; + case APCI1710_DISABLE: + /***************************/ + /* Test the interrupt flag */ + /***************************/ + + if (((devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo. + b_InterruptMask >> b_TimerNbr) & 1) == 1) + { + /*************************/ + /* Disable the interrupt */ + /*************************/ + + devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo. + s_82X54TimerInfo [b_TimerNbr]. + dw_ConfigurationWord = devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo. + s_82X54TimerInfo [b_TimerNbr]. + dw_ConfigurationWord & 0xF7; + + + outl(devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo. + s_82X54TimerInfo [b_TimerNbr]. + dw_ConfigurationWord,devpriv->s_BoardInfos. + ui_Address + 32 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); + + /***************************/ + /* Save the interrupt flag */ + /***************************/ + + devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo. + b_InterruptMask = devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo.b_InterruptMask & (0xFF - (1 << b_TimerNbr)); + } + + /*********************/ + /* Disable the timer */ + /*********************/ + - outl(0,devpriv->s_BoardInfos. - ui_Address + 44 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); - break; - }// Switch end - } - else - { - /**************************************/ - /* Timer not initialised see function */ - /**************************************/ - DPRINTK("Timer not initialised see function\n"); - i_ReturnValue = -5; - } - } - else - { - /*************************/ - /* Timer selection wrong */ - /*************************/ - DPRINTK("Timer selection wrong\n"); - i_ReturnValue = -3; - } // if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) - } - else - { - /************************************/ - /* The module is not a TIMER module */ - /************************************/ - DPRINTK("The module is not a TIMER module\n"); - i_ReturnValue = -4; - } - } - else - { - /***********************/ - /* Module number error */ - /***********************/ - DPRINTK("Module number error\n"); - i_ReturnValue = -2; - } - - return (i_ReturnValue); - } - - -/* -+----------------------------------------------------------------------------+ -| Function Name : _INT_ i_APCI1710_ReadAllTimerValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| PULONG_ pul_TimerValueArray) -INT i_APCI1710_InsnReadAllTimerValue(comedi_device *dev,comedi_subdevice *s, - comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Return the all timer values from selected timer | -| module (b_ModulNbr). | -+----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board | -| APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number | -| (0 to 3) | -+----------------------------------------------------------------------------+ -| Output Parameters : PULONG_ pul_TimerValueArray : Timer value array. | -| Element 0 contain the timer 0 value. | -| Element 1 contain the timer 1 value. | -| Element 2 contain the timer 2 value. | -+----------------------------------------------------------------------------+ -| Return Value : 0: No error | -| -1: The handle parameter of the board is wrong | -| -2: Module selection wrong | -| -3: The module is not a TIMER module | -| -4: Timer 0 not initialised see function | -| "i_APCI1710_InitTimer" | -| -5: Timer 1 not initialised see function | -| "i_APCI1710_InitTimer" | -| -6: Timer 2 not initialised see function | -| "i_APCI1710_InitTimer" | -+----------------------------------------------------------------------------+ -*/ - -INT i_APCI1710_InsnReadAllTimerValue(comedi_device *dev,comedi_subdevice *s, - comedi_insn *insn,lsampl_t *data) - { - INT i_ReturnValue = 0; - BYTE b_ModulNbr,b_ReadType; - PULONG pul_TimerValueArray; - - b_ModulNbr=CR_AREF(insn->chanspec); + outl(0,devpriv->s_BoardInfos. + ui_Address + 44 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); + break; + }// Switch end + } + else + { + /**************************************/ + /* Timer not initialised see function */ + /**************************************/ + + DPRINTK("Timer not initialised see function\n"); + i_ReturnValue = -5; + } + } + else + { + /*************************/ + /* Timer selection wrong */ + /*************************/ + + DPRINTK("Timer selection wrong\n"); + i_ReturnValue = -3; + } // if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) + } + else + { + /************************************/ + /* The module is not a TIMER module */ + /************************************/ + + DPRINTK("The module is not a TIMER module\n"); + i_ReturnValue = -4; + } + } + else + { + /***********************/ + /* Module number error */ + /***********************/ + + DPRINTK("Module number error\n"); + i_ReturnValue = -2; + } + + return (i_ReturnValue); + } + + +/* ++----------------------------------------------------------------------------+ +| Function Name : _INT_ i_APCI1710_ReadAllTimerValue | +| (BYTE_ b_BoardHandle, | +| BYTE_ b_ModulNbr, | +| PULONG_ pul_TimerValueArray) +INT i_APCI1710_InsnReadAllTimerValue(comedi_device *dev,comedi_subdevice *s, + comedi_insn *insn,lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Return the all timer values from selected timer | +| module (b_ModulNbr). | ++----------------------------------------------------------------------------+ +| Input Parameters : BYTE_ b_BoardHandle : Handle of board | +| APCI-1710 | +| BYTE_ b_ModulNbr : Selected module number | +| (0 to 3) | ++----------------------------------------------------------------------------+ +| Output Parameters : PULONG_ pul_TimerValueArray : Timer value array. | +| Element 0 contain the timer 0 value. | +| Element 1 contain the timer 1 value. | +| Element 2 contain the timer 2 value. | ++----------------------------------------------------------------------------+ +| Return Value : 0: No error | +| -1: The handle parameter of the board is wrong | +| -2: Module selection wrong | +| -3: The module is not a TIMER module | +| -4: Timer 0 not initialised see function | +| "i_APCI1710_InitTimer" | +| -5: Timer 1 not initialised see function | +| "i_APCI1710_InitTimer" | +| -6: Timer 2 not initialised see function | +| "i_APCI1710_InitTimer" | ++----------------------------------------------------------------------------+ +*/ + +INT i_APCI1710_InsnReadAllTimerValue(comedi_device *dev,comedi_subdevice *s, + comedi_insn *insn,lsampl_t *data) + { + INT i_ReturnValue = 0; + BYTE b_ModulNbr,b_ReadType; + PULONG pul_TimerValueArray; + + b_ModulNbr=CR_AREF(insn->chanspec); b_ReadType=CR_CHAN(insn->chanspec); - pul_TimerValueArray=(PULONG) data; - i_ReturnValue=insn->n; + pul_TimerValueArray=(PULONG) data; + i_ReturnValue=insn->n; switch(b_ReadType) { @@ -827,129 +951,137 @@ INT i_APCI1710_InsnReadAllTimerValue(comedi_device *dev,comedi_subdevice *s, ui_Read + 1) % APCI1710_SAVE_INTERRUPT; break; - + + case APCI1710_TIMER_READALLTIMER: - /**************************/ - /* Test the module number */ - /**************************/ - - if (b_ModulNbr < 4) - { - /***********************/ - /* Test if 82X54 timer */ - /***********************/ - - if ((devpriv->s_BoardInfos. - dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF0000UL) == APCI1710_82X54_TIMER) - { - /********************************/ - /* Test if timer 0 iniutialised */ - /********************************/ - - if (devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo. - s_82X54TimerInfo [0]. - b_82X54Init == 1) - { - /********************************/ - /* Test if timer 1 iniutialised */ - /********************************/ - - if (devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo. - s_82X54TimerInfo [1]. - b_82X54Init == 1) - { - /********************************/ - /* Test if timer 2 iniutialised */ - /********************************/ - - if (devpriv->s_ModuleInfo [b_ModulNbr]. - s_82X54ModuleInfo. - s_82X54TimerInfo [2]. - b_82X54Init == 1) - { - /*********************/ - /* Latch all counter */ - /*********************/ - + /**************************/ + /* Test the module number */ + /**************************/ + + + if (b_ModulNbr < 4) + { + /***********************/ + /* Test if 82X54 timer */ + /***********************/ + + if ((devpriv->s_BoardInfos. + dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF0000UL) == APCI1710_82X54_TIMER) + { + /********************************/ + /* Test if timer 0 iniutialised */ + /********************************/ + + if (devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo. + s_82X54TimerInfo [0]. + b_82X54Init == 1) + { + /********************************/ + /* Test if timer 1 iniutialised */ + /********************************/ + + if (devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo. + s_82X54TimerInfo [1]. + b_82X54Init == 1) + { + /********************************/ + /* Test if timer 2 iniutialised */ + /********************************/ + + if (devpriv->s_ModuleInfo [b_ModulNbr]. + s_82X54ModuleInfo. + s_82X54TimerInfo [2]. + b_82X54Init == 1) + { + /*********************/ + /* Latch all counter */ + /*********************/ + - outl(0x17,devpriv->s_BoardInfos. - ui_Address + 12 + (64 * b_ModulNbr)); - - /**************************/ - /* Read the timer 0 value */ - /**************************/ - + outl(0x17,devpriv->s_BoardInfos. + ui_Address + 12 + (64 * b_ModulNbr)); + + /**************************/ + /* Read the timer 0 value */ + /**************************/ + - pul_TimerValueArray [0]=inl(devpriv->s_BoardInfos. - ui_Address + 0 + (64 * b_ModulNbr)); - - /**************************/ - /* Read the timer 1 value */ - /**************************/ - + pul_TimerValueArray [0]=inl(devpriv->s_BoardInfos. + ui_Address + 0 + (64 * b_ModulNbr)); + + /**************************/ + /* Read the timer 1 value */ + /**************************/ + - pul_TimerValueArray [1]=inl(devpriv->s_BoardInfos. - ui_Address + 4 + (64 * b_ModulNbr)); - - /**************************/ - /* Read the timer 2 value */ - /**************************/ - + pul_TimerValueArray [1]=inl(devpriv->s_BoardInfos. + ui_Address + 4 + (64 * b_ModulNbr)); + + /**************************/ + /* Read the timer 2 value */ + /**************************/ + - pul_TimerValueArray [2]=inl(devpriv->s_BoardInfos. - ui_Address + 8 + (64 * b_ModulNbr)); - } - else - { - /****************************************/ - /* Timer 2 not initialised see function */ - /****************************************/ - DPRINTK("Timer 2 not initialised see function\n"); - i_ReturnValue = -6; - } - } - else - { - /****************************************/ - /* Timer 1 not initialised see function */ - /****************************************/ - DPRINTK("Timer 1 not initialised see function\n"); - i_ReturnValue = -5; - } - } - else - { - /****************************************/ - /* Timer 0 not initialised see function */ - /****************************************/ - DPRINTK("Timer 0 not initialised see function\n"); - i_ReturnValue = -4; - } - } - else - { - /************************************/ - /* The module is not a TIMER module */ - /************************************/ - DPRINTK("The module is not a TIMER module\n"); - i_ReturnValue = -3; - } - } - else - { - /***********************/ - /* Module number error */ - /***********************/ - DPRINTK("Module number error\n"); - i_ReturnValue = -2; - } - }// End of Switch - return (i_ReturnValue); - } - - + pul_TimerValueArray [2]=inl(devpriv->s_BoardInfos. + ui_Address + 8 + (64 * b_ModulNbr)); + } + else + { + /****************************************/ + /* Timer 2 not initialised see function */ + /****************************************/ + + DPRINTK("Timer 2 not initialised see function\n"); + i_ReturnValue = -6; + } + } + else + { + /****************************************/ + /* Timer 1 not initialised see function */ + /****************************************/ + + DPRINTK("Timer 1 not initialised see function\n"); + i_ReturnValue = -5; + } + } + else + { + /****************************************/ + /* Timer 0 not initialised see function */ + /****************************************/ + + DPRINTK("Timer 0 not initialised see function\n"); + i_ReturnValue = -4; + } + } + else + { + /************************************/ + /* The module is not a TIMER module */ + /************************************/ + + DPRINTK("The module is not a TIMER module\n"); + i_ReturnValue = -3; + } + } + else + { + /***********************/ + /* Module number error */ + /***********************/ + + DPRINTK("Module number error\n"); + i_ReturnValue = -2; + } + + }// End of Switch + return (i_ReturnValue); + } + + /* +----------------------------------------------------------------------------+ @@ -973,6 +1105,8 @@ comedi_insn *insn,lsampl_t *data) INT i_ReturnValue=0; b_BitsType=data[0]; + printk ("\n82X54"); + switch(b_BitsType) { case APCI1710_TIMER_READVALUE: @@ -1068,7 +1202,7 @@ INT i_APCI1710_ReadTimerValue (comedi_device *dev, /* Test the timer number */ /*************************/ - if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) + if (b_TimerNbr <= 2) { /*****************************/ /* Test if timer initialised */ @@ -1196,7 +1330,7 @@ INT i_APCI1710_GetTimerOutputLevel (comedi_device *dev, /* Test the timer number */ /*************************/ - if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) + if (b_TimerNbr <= 2) { /*****************************/ /* Test if timer initialised */ @@ -1327,7 +1461,7 @@ INT i_APCI1710_GetTimerProgressStatus (comedi_device *dev, /* Test the timer number */ /*************************/ - if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) + if (b_TimerNbr <= 2) { /*****************************/ /* Test if timer initialised */ @@ -1456,7 +1590,7 @@ INT i_APCI1710_GetTimerProgressStatus (comedi_device *dev, /* Test the timer number */ /*************************/ - if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) + if (b_TimerNbr <= 2) { /*****************************/ /* Test if timer initialised */ @@ -1515,7 +1649,7 @@ INT i_APCI1710_GetTimerProgressStatus (comedi_device *dev, return (i_ReturnValue); } - - - - + + + + diff --git a/comedi/drivers/addi-data/APCI1710_82x54.h b/comedi/drivers/addi-data/APCI1710_82x54.h index 4e958a5a..6e4e2bdd 100644 --- a/comedi/drivers/addi-data/APCI1710_82x54.h +++ b/comedi/drivers/addi-data/APCI1710_82x54.h @@ -1,39 +1,68 @@ - - -#define APCI1710_PCI_BUS_CLOCK 0 -#define APCI1710_FRONT_CONNECTOR_INPUT 1 -#define APCI1710_TIMER_READVALUE 0 -#define APCI1710_TIMER_GETOUTPUTLEVEL 1 -#define APCI1710_TIMER_GETPROGRESSSTATUS 2 -#define APCI1710_TIMER_WRITEVALUE 3 +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ + + +#define APCI1710_PCI_BUS_CLOCK 0 +#define APCI1710_FRONT_CONNECTOR_INPUT 1 +#define APCI1710_TIMER_READVALUE 0 +#define APCI1710_TIMER_GETOUTPUTLEVEL 1 +#define APCI1710_TIMER_GETPROGRESSSTATUS 2 +#define APCI1710_TIMER_WRITEVALUE 3 #define APCI1710_TIMER_READINTERRUPT 1 #define APCI1710_TIMER_READALLTIMER 2 -/* -+----------------------------------------------------------------------------+ -| 82X54 TIMER INISIALISATION FUNCTION | -+----------------------------------------------------------------------------+ -*/ - - - -INT i_APCI1710_InsnConfigInitTimer(comedi_device *dev,comedi_subdevice *s, - comedi_insn *insn,lsampl_t *data); - - - -INT i_APCI1710_InsnWriteEnableDisableTimer(comedi_device *dev,comedi_subdevice *s, - comedi_insn *insn,lsampl_t *data); -/* -+----------------------------------------------------------------------------+ -| 82X54 READ FUNCTION | -+----------------------------------------------------------------------------+ -*/ - -INT i_APCI1710_InsnReadAllTimerValue(comedi_device *dev,comedi_subdevice *s, - comedi_insn *insn,lsampl_t *data); - +// BEGIN JK 27.10.03 : Add the possibility to use a 40 Mhz quartz +#ifndef APCI1710_10MHZ + #define APCI1710_10MHZ 10 +#endif +// END JK 27.10.03 : Add the possibility to use a 40 Mhz quartz + +/* ++----------------------------------------------------------------------------+ +| 82X54 TIMER INISIALISATION FUNCTION | ++----------------------------------------------------------------------------+ +*/ + + + +INT i_APCI1710_InsnConfigInitTimer(comedi_device *dev,comedi_subdevice *s, + comedi_insn *insn,lsampl_t *data); + + + +INT i_APCI1710_InsnWriteEnableDisableTimer(comedi_device *dev,comedi_subdevice *s, + comedi_insn *insn,lsampl_t *data); +/* ++----------------------------------------------------------------------------+ +| 82X54 READ FUNCTION | ++----------------------------------------------------------------------------+ +*/ + +INT i_APCI1710_InsnReadAllTimerValue(comedi_device *dev,comedi_subdevice *s, + comedi_insn *insn,lsampl_t *data); + INT i_APCI1710_InsnBitsTimer(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data); @@ -66,4 +95,4 @@ INT i_APCI1710_GetTimerProgressStatus (comedi_device *dev, INT i_APCI1710_WriteTimerValue (comedi_device *dev, BYTE b_ModulNbr, BYTE b_TimerNbr, - ULONG ul_WriteValue); \ No newline at end of file + ULONG ul_WriteValue); diff --git a/comedi/drivers/addi-data/APCI1710_Chrono.c b/comedi/drivers/addi-data/APCI1710_Chrono.c index 998f86a7..da805ae8 100644 --- a/comedi/drivers/addi-data/APCI1710_Chrono.c +++ b/comedi/drivers/addi-data/APCI1710_Chrono.c @@ -1,14 +1,38 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ /* + +-----------------------------------------------------------------------+ | (C) ADDI-DATA GmbH Dieselstraße 3 D-77833 Ottersweier | +-----------------------------------------------------------------------+ | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | +-----------------------------------------------------------------------+ - | Project : API APCI1710 | Compiler : BORLANDC/MICROSOFT C | - | Module name : CHRONO.C | Version : 3.1 / 6.0 | + | Project : API APCI1710 | Compiler : gcc | + | Module name : CHRONO.C | Version : 2.96 | +-------------------------------+---------------------------------------+ - | Author : S.WEBER | Date : 06.07.98 | + | Project manager: Eric Stolz | Date : 02/12/2002 | +-----------------------------------------------------------------------+ | Description : APCI-1710 chronometer module | | | @@ -45,7 +69,7 @@ | BYTE_ b_TimingUnit, | | ULONG_ ul_TimingInterval, | | PULONG_ pul_RealTimingInterval) - + +----------------------------------------------------------------------------+ | Task : Configure the chronometer operating mode (b_ChronoMode)| | from selected module (b_ModulNbr). | @@ -107,18 +131,19 @@ +----------------------------------------------------------------------------+ */ - + INT i_APCI1710_InsnConfigInitChrono(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data) { - INT i_ReturnValue = 0; - ULONG ul_TimerValue,ul_TimingInterval,ul_RealTimingInterval; - double d_RealTimingInterval; + INT i_ReturnValue = 0; + ULONG ul_TimerValue = 0; + ULONG ul_TimingInterval = 0; + ULONG ul_RealTimingInterval = 0; + double d_RealTimingInterval = 0; DWORD dw_ModeArray [8] = {0x01, 0x05, 0x00, 0x04, 0x02, 0x0E, 0x0A, 0x06}; BYTE b_ModulNbr,b_ChronoMode,b_PCIInputClock,b_TimingUnit; - PULONG pul_RealTimingInterval; - + b_ModulNbr = CR_AREF(insn->chanspec); b_ChronoMode = (BYTE) data[0]; b_PCIInputClock = (BYTE) data[1]; @@ -143,7 +168,7 @@ INT i_APCI1710_InsnConfigInitChrono(comedi_device *dev,comedi_subdevice *s, /* Test the chronometer mode */ /*****************************/ - if (b_ChronoMode >= 0 && b_ChronoMode <= 7) + if (b_ChronoMode <= 7) { /**************************/ /* Test the PCI bus clock */ @@ -157,7 +182,7 @@ INT i_APCI1710_InsnConfigInitChrono(comedi_device *dev,comedi_subdevice *s, /* Test the timing unity */ /*************************/ - if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) + if (b_TimingUnit <= 4) { /**********************************/ /* Test the base timing selection */ @@ -183,18 +208,20 @@ INT i_APCI1710_InsnConfigInitChrono(comedi_device *dev,comedi_subdevice *s, /* Test the board version */ /**************************/ - if ((b_PCIInputClock == APCI1710_40MHZ) && (devpriv->s_BoardInfos. - b_BoardVersion > 0) || + if (((b_PCIInputClock == APCI1710_40MHZ) && (devpriv->s_BoardInfos. + b_BoardVersion > 0)) || (b_PCIInputClock != APCI1710_40MHZ)) { /************************/ /* Test the TOR version */ /************************/ - if ((b_PCIInputClock == APCI1710_40MHZ) && ((devpriv->s_BoardInfos. - dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3131) || + if (((b_PCIInputClock == APCI1710_40MHZ) && ((devpriv->s_BoardInfos. + dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3131)) || (b_PCIInputClock != APCI1710_40MHZ)) { + fpu_begin (); + /****************************************/ /* Calculate the timer 0 division fator */ /****************************************/ @@ -229,7 +256,7 @@ INT i_APCI1710_InsnConfigInitChrono(comedi_device *dev,comedi_subdevice *s, ul_RealTimingInterval = (ULONG) (ul_TimerValue / (0.001 * (double) b_PCIInputClock)); d_RealTimingInterval = (double) ul_TimerValue / (0.001 * (double) b_PCIInputClock); - if ((double) ((double) ul_TimerValue / (0.001 * (double) b_PCIInputClock)) >= (double) ((double) *pul_RealTimingInterval + 0.5)) + if ((double) ((double) ul_TimerValue / (0.001 * (double) b_PCIInputClock)) >= (double) ((double) ul_RealTimingInterval + 0.5)) { ul_RealTimingInterval = ul_RealTimingInterval + 1; } @@ -271,7 +298,7 @@ INT i_APCI1710_InsnConfigInitChrono(comedi_device *dev,comedi_subdevice *s, ul_RealTimingInterval = (ULONG) (ul_TimerValue / (1.0 * (double) b_PCIInputClock)); d_RealTimingInterval = (double) ul_TimerValue / ((double) 1.0 * (double) b_PCIInputClock); - if ((double) ((double) ul_TimerValue / (1.0 * (double) b_PCIInputClock)) >= (double) ((double) *pul_RealTimingInterval + 0.5)) + if ((double) ((double) ul_TimerValue / (1.0 * (double) b_PCIInputClock)) >= (double) ((double) ul_RealTimingInterval + 0.5)) { ul_RealTimingInterval = ul_RealTimingInterval + 1; } @@ -314,7 +341,7 @@ INT i_APCI1710_InsnConfigInitChrono(comedi_device *dev,comedi_subdevice *s, ul_RealTimingInterval = (ULONG) (ul_TimerValue / (1000.0 * (double) b_PCIInputClock)); d_RealTimingInterval = (double) ul_TimerValue / (1000.0 * (double) b_PCIInputClock); - if ((double) ((double) ul_TimerValue / (1000.0 * (double) b_PCIInputClock)) >= (double) ((double) *pul_RealTimingInterval + 0.5)) + if ((double) ((double) ul_TimerValue / (1000.0 * (double) b_PCIInputClock)) >= (double) ((double) ul_RealTimingInterval + 0.5)) { ul_RealTimingInterval = ul_RealTimingInterval + 1; } @@ -356,7 +383,7 @@ INT i_APCI1710_InsnConfigInitChrono(comedi_device *dev,comedi_subdevice *s, ul_RealTimingInterval = (ULONG) (ul_TimerValue / (1000000.0 * (double) b_PCIInputClock)); d_RealTimingInterval = (double) ul_TimerValue / (1000000.0 * (double) b_PCIInputClock); - if ((double) ((double) ul_TimerValue / (1000000.0 * (double) b_PCIInputClock)) >= (double) ((double) *pul_RealTimingInterval + 0.5)) + if ((double) ((double) ul_TimerValue / (1000000.0 * (double) b_PCIInputClock)) >= (double) ((double) ul_RealTimingInterval + 0.5)) { ul_RealTimingInterval = ul_RealTimingInterval + 1; } @@ -399,7 +426,7 @@ INT i_APCI1710_InsnConfigInitChrono(comedi_device *dev,comedi_subdevice *s, ul_RealTimingInterval = (ULONG) (ul_TimerValue / (1000000.0 * (double) b_PCIInputClock)) / 60; d_RealTimingInterval = ((double) ul_TimerValue / (0.001 * (double) b_PCIInputClock)) / 60.0; - if ((double) (((double) ul_TimerValue / (1000000.0 * (double) b_PCIInputClock)) / 60.0) >= (double) ((double) *pul_RealTimingInterval + 0.5)) + if ((double) (((double) ul_TimerValue / (1000000.0 * (double) b_PCIInputClock)) / 60.0) >= (double) ((double) ul_RealTimingInterval + 0.5)) { ul_RealTimingInterval = ul_RealTimingInterval + 1; } @@ -415,6 +442,8 @@ INT i_APCI1710_InsnConfigInitChrono(comedi_device *dev,comedi_subdevice *s, break; } + fpu_end (); + /****************************/ /* Save the PCI input clock */ /****************************/ @@ -468,7 +497,7 @@ INT i_APCI1710_InsnConfigInitChrono(comedi_device *dev,comedi_subdevice *s, /* Write timer 0 value */ /***********************/ - + outl(ul_TimerValue,devpriv->s_BoardInfos. ui_Address + (64 * b_ModulNbr)); @@ -485,7 +514,8 @@ INT i_APCI1710_InsnConfigInitChrono(comedi_device *dev,comedi_subdevice *s, /***********************************************/ /* TOR version error for 40MHz clock selection */ /***********************************************/ - DPRINTK("TOR version error for 40MHz clock selection\n"); + + DPRINTK("TOR version error for 40MHz clock selection\n"); i_ReturnValue = -9; } } @@ -494,7 +524,8 @@ INT i_APCI1710_InsnConfigInitChrono(comedi_device *dev,comedi_subdevice *s, /**************************************************************/ /* You can not used the 40MHz clock selection wich this board */ /**************************************************************/ - DPRINTK("You can not used the 40MHz clock selection wich this board\n"); + + DPRINTK("You can not used the 40MHz clock selection wich this board\n"); i_ReturnValue = -8; } } @@ -503,7 +534,8 @@ INT i_APCI1710_InsnConfigInitChrono(comedi_device *dev,comedi_subdevice *s, /**********************************/ /* Base timing selection is wrong */ /**********************************/ - DPRINTK("Base timing selection is wrong\n"); + + DPRINTK("Base timing selection is wrong\n"); i_ReturnValue = -7; } } // if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) @@ -512,7 +544,8 @@ INT i_APCI1710_InsnConfigInitChrono(comedi_device *dev,comedi_subdevice *s, /***********************************/ /* Timing unity selection is wrong */ /***********************************/ - DPRINTK("Timing unity selection is wrong\n"); + + DPRINTK("Timing unity selection is wrong\n"); i_ReturnValue = -6; } // if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) } // if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ)) @@ -521,7 +554,8 @@ INT i_APCI1710_InsnConfigInitChrono(comedi_device *dev,comedi_subdevice *s, /*****************************************/ /* The selected PCI input clock is wrong */ /*****************************************/ - DPRINTK("The selected PCI input clock is wrong\n"); + + DPRINTK("The selected PCI input clock is wrong\n"); i_ReturnValue = -5; } // if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ)) } // if (b_ChronoMode >= 0 && b_ChronoMode <= 7) @@ -530,7 +564,8 @@ INT i_APCI1710_InsnConfigInitChrono(comedi_device *dev,comedi_subdevice *s, /***************************************/ /* Chronometer mode selection is wrong */ /***************************************/ - DPRINTK("Chronometer mode selection is wrong\n"); + +DPRINTK("Chronometer mode selection is wrong\n"); i_ReturnValue = -4; } // if (b_ChronoMode >= 0 && b_ChronoMode <= 7) } @@ -539,7 +574,8 @@ INT i_APCI1710_InsnConfigInitChrono(comedi_device *dev,comedi_subdevice *s, /******************************************/ /* The module is not a Chronometer module */ /******************************************/ - DPRINTK("The module is not a Chronometer module\n"); + + DPRINTK("The module is not a Chronometer module\n"); i_ReturnValue = -3; } } @@ -548,7 +584,8 @@ INT i_APCI1710_InsnConfigInitChrono(comedi_device *dev,comedi_subdevice *s, /***********************/ /* Module number error */ /***********************/ - DPRINTK("Module number error\n"); + + DPRINTK("Module number error\n"); i_ReturnValue = -2; } data[0] = ul_RealTimingInterval; @@ -614,18 +651,19 @@ comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) | -8: data[0] wrong input | +----------------------------------------------------------------------------+ */ - + + INT i_APCI1710_InsnWriteEnableDisableChrono(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data) { INT i_ReturnValue = 0; BYTE b_ModulNbr,b_CycleMode,b_InterruptEnable,b_Action; b_ModulNbr = CR_AREF(insn->chanspec); - b_Action =(BYTE) data[0]; + b_Action =(BYTE) data[0]; b_CycleMode =(BYTE) data[1]; b_InterruptEnable =(BYTE) data[2]; i_ReturnValue = insn->n; - + /**************************/ @@ -655,7 +693,7 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(comedi_device *dev,comedi_subdevice { case APCI1710_ENABLE : - + /*********************************/ /* Test the cycle mode parameter */ /*********************************/ @@ -668,8 +706,8 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(comedi_device *dev,comedi_subdevice if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) { - - + + /***************************/ /* Save the interrupt flag */ /***************************/ @@ -709,14 +747,14 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(comedi_device *dev,comedi_subdevice outl(devpriv->s_ModuleInfo [b_ModulNbr]. s_ChronoModuleInfo.dw_ConfigReg, devpriv->s_BoardInfos. ui_Address + 32 + (64 * b_ModulNbr)); - devpriv->tsk_Current=current; // Save the current process task structure + devpriv->tsk_Current=current; // Save the current process task structure } /***********************************/ /* Enable or disable the interrupt */ /* Enable the chronometer */ /***********************************/ - + outl(devpriv->s_ModuleInfo [b_ModulNbr]. s_ChronoModuleInfo.dw_ConfigReg,devpriv->s_BoardInfos. ui_Address + 16 + (64 * b_ModulNbr)); @@ -725,7 +763,7 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(comedi_device *dev,comedi_subdevice /* Clear status register */ /*************************/ - + outl(0,devpriv->s_BoardInfos.ui_Address + 36 + (64 * b_ModulNbr)); } // if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) @@ -734,7 +772,8 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(comedi_device *dev,comedi_subdevice /********************************/ /* Interrupt parameter is wrong */ /********************************/ - DPRINTK("Interrupt parameter is wrong\n"); + + DPRINTK("Interrupt parameter is wrong\n"); i_ReturnValue = -6; } // if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) } // if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS)) @@ -743,7 +782,8 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(comedi_device *dev,comedi_subdevice /***********************************************/ /* Chronometer acquisition mode cycle is wrong */ /***********************************************/ - DPRINTK("Chronometer acquisition mode cycle is wrong\n"); + + DPRINTK("Chronometer acquisition mode cycle is wrong\n"); i_ReturnValue = -5; } // if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS)) break; @@ -765,7 +805,7 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(comedi_device *dev,comedi_subdevice /* Disable the chronometer */ /***************************/ - + outl(devpriv->s_ModuleInfo [b_ModulNbr]. s_ChronoModuleInfo.dw_ConfigReg, devpriv->s_BoardInfos. ui_Address + 16 + (64 * b_ModulNbr)); @@ -781,11 +821,11 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(comedi_device *dev,comedi_subdevice /* Clear status register */ /*************************/ - + outl(0,devpriv->s_BoardInfos.ui_Address + 36 + (64 * b_ModulNbr)); } break; - + default: DPRINTK("Inputs wrong! Enable or Disable chrono\n"); i_ReturnValue = -8; @@ -796,7 +836,557 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(comedi_device *dev,comedi_subdevice /*******************************/ /* Chronometer not initialised */ /*******************************/ - DPRINTK("Chronometer not initialised\n"); + + DPRINTK("Chronometer not initialised\n"); + i_ReturnValue = -4; + } + } + else + { + /******************************************/ + /* The module is not a Chronometer module */ + /******************************************/ + + DPRINTK("The module is not a Chronometer module\n"); + i_ReturnValue = -3; + } + } + else + { + /***********************/ + /* Module number error */ + /***********************/ + + DPRINTK("Module number error\n"); + i_ReturnValue = -2; + } + + + return (i_ReturnValue); + } + + + + +/* ++----------------------------------------------------------------------------+ +| Function Name :INT i_APCI1710_InsnReadChrono(comedi_device *dev,comedi_subdevice *s, +comedi_insn *insn,lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Read functions for Timer | ++----------------------------------------------------------------------------+ +| Input Parameters : ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value : ++----------------------------------------------------------------------------+ +*/ + +INT i_APCI1710_InsnReadChrono(comedi_device *dev,comedi_subdevice *s, +comedi_insn *insn,lsampl_t *data) +{ + BYTE b_ReadType; + INT i_ReturnValue=insn->n; + + b_ReadType=CR_CHAN(insn->chanspec); + + switch(b_ReadType) + { + case APCI1710_CHRONO_PROGRESS_STATUS: + i_ReturnValue=i_APCI1710_GetChronoProgressStatus (dev, + (BYTE) CR_AREF(insn->chanspec), + (PBYTE) &data[0]); + break; + + case APCI1710_CHRONO_READVALUE: + i_ReturnValue=i_APCI1710_ReadChronoValue (dev, + (BYTE) CR_AREF(insn->chanspec), + (UINT) insn->unused[0], + (PBYTE) &data[0], + (PULONG) &data[1]); + break; + + case APCI1710_CHRONO_CONVERTVALUE: + i_ReturnValue=i_APCI1710_ConvertChronoValue (dev, + (BYTE) CR_AREF(insn->chanspec), + (ULONG) insn->unused[0], + (PULONG) &data[0], + (PBYTE) &data[1], + (PBYTE) &data[2], + (PUINT) &data[3], + (PUINT) &data[4], + (PUINT) &data[5]); + break; + + case APCI1710_CHRONO_READINTERRUPT: + printk("In Chrono Read Interrupt\n"); + + data[0]=devpriv->s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Read].b_OldModuleMask; + data[1]=devpriv->s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Read].ul_OldInterruptMask; + data[2]=devpriv->s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Read].ul_OldCounterLatchValue; + + + /**************************/ + /* Increment the read FIFO */ + /***************************/ + + devpriv-> + s_InterruptParameters. + ui_Read = (devpriv-> + s_InterruptParameters. + ui_Read + 1) % APCI1710_SAVE_INTERRUPT; + break; + + default: + printk("ReadType Parameter wrong\n"); + } + + if(i_ReturnValue>=0) i_ReturnValue =insn->n; + return (i_ReturnValue); + +} + + + +/* ++----------------------------------------------------------------------------+ +| Function Name : _INT_ i_APCI1710_GetChronoProgressStatus | +| (BYTE_ b_BoardHandle, | +| BYTE_ b_ModulNbr, | +| PBYTE_ pb_ChronoStatus) | ++----------------------------------------------------------------------------+ +| Task : Return the chronometer status (pb_ChronoStatus) from | +| selected chronometer module (b_ModulNbr). | ++----------------------------------------------------------------------------+ +| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | +| BYTE_ b_ModulNbr : Selected module number (0 to 3) | ++----------------------------------------------------------------------------+ +| Output Parameters : PULONG_ pb_ChronoStatus : Return the chronometer | +| status. | +| 0 : Measurement not started.| +| No start signal occur. | +| 1 : Measurement started. | +| A start signal occur. | +| 2 : Measurement stopped. | +| A stop signal occur. | +| The measurement is | +| terminate. | +| 3: A overflow occur. You | +| must change the base | +| timing witch the | +| function | +| "i_APCI1710_InitChrono" | ++----------------------------------------------------------------------------+ +| Return Value : 0: No error | +| -1: The handle parameter of the board is wrong | +| -2: Module selection wrong | +| -3: The module is not a Chronometer module | +| -4: Chronometer not initialised see function | +| "i_APCI1710_InitChrono" | ++----------------------------------------------------------------------------+ +*/ + +INT i_APCI1710_GetChronoProgressStatus (comedi_device *dev, + BYTE b_ModulNbr, + PBYTE pb_ChronoStatus) + { + INT i_ReturnValue = 0; + DWORD dw_Status; + + /**************************/ + /* Test the module number */ + /**************************/ + + if (b_ModulNbr < 4) + { + /***********************/ + /* Test if chronometer */ + /***********************/ + + if ((devpriv-> + s_BoardInfos. + dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF0000UL) == APCI1710_CHRONOMETER) + { + /***********************************/ + /* Test if chronometer initialised */ + /***********************************/ + + if (devpriv-> + s_ModuleInfo [b_ModulNbr]. + s_ChronoModuleInfo. + b_ChronoInit == 1) + { + + dw_Status=inl(devpriv->s_BoardInfos. + ui_Address + 8 + (64 * b_ModulNbr)); + + /********************/ + /* Test if overflow */ + /********************/ + + if ((dw_Status & 8) == 8) + { + /******************/ + /* Overflow occur */ + /******************/ + + *pb_ChronoStatus = 3; + } // if ((dw_Status & 8) == 8) + else + { + /*******************************/ + /* Test if measurement stopped */ + /*******************************/ + + if ((dw_Status & 2) == 2) + { + /***********************/ + /* A stop signal occur */ + /***********************/ + + *pb_ChronoStatus = 2; + } // if ((dw_Status & 2) == 2) + else + { + /*******************************/ + /* Test if measurement started */ + /*******************************/ + + if ((dw_Status & 1) == 1) + { + /************************/ + /* A start signal occur */ + /************************/ + + *pb_ChronoStatus = 1; + } // if ((dw_Status & 1) == 1) + else + { + /***************************/ + /* Measurement not started */ + /***************************/ + + *pb_ChronoStatus = 0; + } // if ((dw_Status & 1) == 1) + } // if ((dw_Status & 2) == 2) + } // if ((dw_Status & 8) == 8) + } + else + { + /*******************************/ + /* Chronometer not initialised */ + /*******************************/ + DPRINTK("Chronometer not initialised\n"); + i_ReturnValue = -4; + } + } + else + { + /******************************************/ + /* The module is not a Chronometer module */ + /******************************************/ + DPRINTK("The module is not a Chronometer module\n"); + i_ReturnValue = -3; + } + } + else + { + /***********************/ + /* Module number error */ + /***********************/ + DPRINTK("Module number error\n"); + i_ReturnValue = -2; + } + + return (i_ReturnValue); + } + + +/* ++----------------------------------------------------------------------------+ +| Function Name : _INT_ i_APCI1710_ReadChronoValue | +| (BYTE_ b_BoardHandle, | +| BYTE_ b_ModulNbr, | +| UINT_ ui_TimeOut, | +| PBYTE_ pb_ChronoStatus, | +| PULONG_ pul_ChronoValue) | ++----------------------------------------------------------------------------+ +| Task : Return the chronometer status (pb_ChronoStatus) and the| +| timing value (pul_ChronoValue) after a stop signal | +| occur from selected chronometer module (b_ModulNbr). | +| This function are only avaible if you have disabled | +| the interrupt functionality. See function | +| "i_APCI1710_EnableChrono" and the Interrupt mask | +| description chapter. | +| You can test the chronometer status witch the | +| "i_APCI1710_GetChronoProgressStatus" function. | +| | +| The returned value from pul_ChronoValue parameter is | +| not real measured timing. | +| You must used the "i_APCI1710_ConvertChronoValue" | +| function or make this operation for calculate the | +| timing: | +| | +| Timing = pul_ChronoValue * pul_RealTimingInterval. | +| | +| pul_RealTimingInterval is the returned parameter from | +| "i_APCI1710_InitChrono" function and the time unity is | +| the b_TimingUnit from "i_APCI1710_InitChrono" function| ++----------------------------------------------------------------------------+ +| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | +| BYTE_ b_ModulNbr : Selected module number (0 to 3) | ++----------------------------------------------------------------------------+ +| Output Parameters : PULONG_ pb_ChronoStatus : Return the chronometer | +| status. | +| 0 : Measurement not started.| +| No start signal occur. | +| 1 : Measurement started. | +| A start signal occur. | +| 2 : Measurement stopped. | +| A stop signal occur. | +| The measurement is | +| terminate. | +| 3: A overflow occur. You | +| must change the base | +| timing witch the | +| function | +| "i_APCI1710_InitChrono" | +| PULONG pul_ChronoValue : Chronometer timing value. | ++----------------------------------------------------------------------------+ +| Return Value : 0: No error | +| -1: The handle parameter of the board is wrong | +| -2: Module selection wrong | +| -3: The module is not a Chronometer module | +| -4: Chronometer not initialised see function | +| "i_APCI1710_InitChrono" | +| -5: Timeout parameter is wrong (0 to 65535) | +| -6: Interrupt routine installed. You can not read | +| directly the chronometer measured timing. | ++----------------------------------------------------------------------------+ +*/ + +INT i_APCI1710_ReadChronoValue (comedi_device *dev, + BYTE b_ModulNbr, + UINT ui_TimeOut, + PBYTE pb_ChronoStatus, + PULONG pul_ChronoValue) + { + INT i_ReturnValue = 0; + DWORD dw_Status; + DWORD dw_TimeOut = 0; + + + /**************************/ + /* Test the module number */ + /**************************/ + + if (b_ModulNbr < 4) + { + /***********************/ + /* Test if chronometer */ + /***********************/ + + if ((devpriv-> + s_BoardInfos. + dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF0000UL) == APCI1710_CHRONOMETER) + { + /***********************************/ + /* Test if chronometer initialised */ + /***********************************/ + + if (devpriv-> + s_ModuleInfo [b_ModulNbr]. + s_ChronoModuleInfo. + b_ChronoInit == 1) + { + /*****************************/ + /* Test the timout parameter */ + /*****************************/ + + if ((ui_TimeOut >= 0) && (ui_TimeOut <= 65535UL)) + { + + for (;;) + { + /*******************/ + /* Read the status */ + /*******************/ + + + dw_Status=inl(devpriv->s_BoardInfos. + ui_Address + 8 + (64 * b_ModulNbr)); + + + /********************/ + /* Test if overflow */ + /********************/ + + if ((dw_Status & 8) == 8) + { + /******************/ + /* Overflow occur */ + /******************/ + + *pb_ChronoStatus = 3; + + /***************************/ + /* Test if continuous mode */ + /***************************/ + + if (devpriv->s_ModuleInfo [b_ModulNbr]. + s_ChronoModuleInfo. + b_CycleMode == APCI1710_CONTINUOUS) + { + /*************************/ + /* Clear status register */ + /*************************/ + + + outl(0,devpriv->s_BoardInfos. + ui_Address + 36 + (64 * b_ModulNbr)); + } + + break; + } // if ((dw_Status & 8) == 8) + else + { + /*******************************/ + /* Test if measurement stopped */ + /*******************************/ + + if ((dw_Status & 2) == 2) + { + /***********************/ + /* A stop signal occur */ + /***********************/ + + *pb_ChronoStatus = 2; + + /***************************/ + /* Test if continnous mode */ + /***************************/ + + if (devpriv-> + s_ModuleInfo [b_ModulNbr]. + s_ChronoModuleInfo. + b_CycleMode == APCI1710_CONTINUOUS) + { + /*************************/ + /* Clear status register */ + /*************************/ + + + outl(0,devpriv->s_BoardInfos. + ui_Address + 36 + (64 * b_ModulNbr)); + } + break; + } // if ((dw_Status & 2) == 2) + else + { + /*******************************/ + /* Test if measurement started */ + /*******************************/ + + if ((dw_Status & 1) == 1) + { + /************************/ + /* A start signal occur */ + /************************/ + + *pb_ChronoStatus = 1; + } // if ((dw_Status & 1) == 1) + else + { + /***************************/ + /* Measurement not started */ + /***************************/ + + *pb_ChronoStatus = 0; + } // if ((dw_Status & 1) == 1) + } // if ((dw_Status & 2) == 2) + } // if ((dw_Status & 8) == 8) + + if (dw_TimeOut == ui_TimeOut) + { + /*****************/ + /* Timeout occur */ + /*****************/ + + break; + } + else + { + /*************************/ + /* Increment the timeout */ + /*************************/ + + dw_TimeOut = dw_TimeOut + 1; + mdelay(1000); + + } + } // for (;;) + + /*****************************/ + /* Test if stop signal occur */ + /*****************************/ + + if (*pb_ChronoStatus == 2) + { + /**********************************/ + /* Read the measured timing value */ + /**********************************/ + + + *pul_ChronoValue= inl(devpriv->s_BoardInfos. + ui_Address + 4 + (64 * b_ModulNbr)); + + if (*pul_ChronoValue != 0) + { + *pul_ChronoValue = *pul_ChronoValue - 1; + } + } + else + { + /*************************/ + /* Test if timeout occur */ + /*************************/ + + if ((*pb_ChronoStatus != 3) && (dw_TimeOut == ui_TimeOut) && (ui_TimeOut != 0)) + { + /*****************/ + /* Timeout occur */ + /*****************/ + + *pb_ChronoStatus = 4; + } + } + + } + else + { + /******************************/ + /* Timeout parameter is wrong */ + /******************************/ + DPRINTK("Timeout parameter is wrong\n"); + i_ReturnValue = -5; + } + } + else + { + /*******************************/ + /* Chronometer not initialised */ + /*******************************/ + DPRINTK("Chronometer not initialised\n"); i_ReturnValue = -4; } } @@ -805,7 +1395,7 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(comedi_device *dev,comedi_subdevice /******************************************/ /* The module is not a Chronometer module */ /******************************************/ - DPRINTK("The module is not a Chronometer module\n"); + DPRINTK("The module is not a Chronometer module\n"); i_ReturnValue = -3; } } @@ -814,744 +1404,200 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(comedi_device *dev,comedi_subdevice /***********************/ /* Module number error */ /***********************/ - DPRINTK("Module number error\n"); + DPRINTK("Module number error\n"); i_ReturnValue = -2; } - + return (i_ReturnValue); } +/* ++----------------------------------------------------------------------------+ +| Function Name : _INT_ i_APCI1710_ConvertChronoValue | +| (BYTE_ b_BoardHandle, | +| BYTE_ b_ModulNbr, | +| ULONG_ ul_ChronoValue, | +| PULONG_ pul_Hour, | +| PBYTE_ pb_Minute, | +| PBYTE_ pb_Second, | +| PUINT_ pui_MilliSecond, | +| PUINT_ pui_MicroSecond, | +| PUINT_ pui_NanoSecond) | ++----------------------------------------------------------------------------+ +| Task : Convert the chronometer measured timing | +| (ul_ChronoValue) in to h, mn, s, ms, µs, ns. | ++----------------------------------------------------------------------------+ +| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | +| BYTE_ b_ModulNbr : Selected module number (0 to 3)| +| ULONG_ ul_ChronoValue : Measured chronometer timing | +| value. | +| See"i_APCI1710_ReadChronoValue"| ++----------------------------------------------------------------------------+ +| Output Parameters : PULONG_ pul_Hour : Chronometer timing hour | +| PBYTE_ pb_Minute : Chronometer timing minute | +| PBYTE_ pb_Second : Chronometer timing second | +| PUINT_ pui_MilliSecond : Chronometer timing mini | +| second | +| PUINT_ pui_MicroSecond : Chronometer timing micro | +| second | +| PUINT_ pui_NanoSecond : Chronometer timing nano | +| second | ++----------------------------------------------------------------------------+ +| Return Value : 0: No error | +| -1: The handle parameter of the board is wrong | +| -2: Module selection wrong | +| -3: The module is not a Chronometer module | +| -4: Chronometer not initialised see function | +| "i_APCI1710_InitChrono" | ++----------------------------------------------------------------------------+ +*/ + +INT i_APCI1710_ConvertChronoValue (comedi_device *dev, + BYTE b_ModulNbr, + ULONG ul_ChronoValue, + PULONG pul_Hour, + PBYTE pb_Minute, + PBYTE pb_Second, + PUINT pui_MilliSecond, + PUINT pui_MicroSecond, + PUINT pui_NanoSecond) + { + INT i_ReturnValue = 0; + double d_Hour; + double d_Minute; + double d_Second; + double d_MilliSecond; + double d_MicroSecond; + double d_NanoSecond; + + /**************************/ + /* Test the module number */ + /**************************/ + + if (b_ModulNbr < 4) + { + /***********************/ + /* Test if chronometer */ + /***********************/ + + if ((devpriv-> + s_BoardInfos. + dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF0000UL) == APCI1710_CHRONOMETER) + { + /***********************************/ + /* Test if chronometer initialised */ + /***********************************/ + + if (devpriv-> + s_ModuleInfo [b_ModulNbr]. + s_ChronoModuleInfo. + b_ChronoInit == 1) + { + fpu_begin (); + + d_Hour = (double) ul_ChronoValue * (double) devpriv-> + s_ModuleInfo [b_ModulNbr]. + s_ChronoModuleInfo. + d_TimingInterval; + + switch (devpriv-> + s_ModuleInfo [b_ModulNbr]. + s_ChronoModuleInfo. + b_TimingUnit) + { + case 0: + d_Hour = d_Hour / (double) 1000.0; + + case 1: + d_Hour = d_Hour / (double) 1000.0; + + case 2: + d_Hour = d_Hour / (double) 1000.0; + + case 3: + d_Hour = d_Hour / (double) 60.0; + + case 4: + /**********************/ + /* Calculate the hour */ + /**********************/ + d_Hour = d_Hour / (double) 60.0; + *pul_Hour = (ULONG) d_Hour; + /************************/ + /* Calculate the minute */ + /************************/ -/* -+----------------------------------------------------------------------------+ -| Function Name :INT i_APCI1710_InsnReadChrono(comedi_device *dev,comedi_subdevice *s, -comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Read functions for Timer | -+----------------------------------------------------------------------------+ -| Input Parameters : -+----------------------------------------------------------------------------+ -| Output Parameters : - | -+----------------------------------------------------------------------------+ -| Return Value : -+----------------------------------------------------------------------------+ -*/ - -INT i_APCI1710_InsnReadChrono(comedi_device *dev,comedi_subdevice *s, -comedi_insn *insn,lsampl_t *data) -{ - BYTE b_ReadType; - INT i_ReturnValue=insn->n; - - b_ReadType=CR_CHAN(insn->chanspec); - - switch(b_ReadType) - { - case APCI1710_CHRONO_PROGRESS_STATUS: - i_ReturnValue=i_APCI1710_GetChronoProgressStatus (dev, - (BYTE) CR_AREF(insn->chanspec), - (PBYTE) &data[0]); - break; - - case APCI1710_CHRONO_READVALUE: - i_ReturnValue=i_APCI1710_ReadChronoValue (dev, - (BYTE) CR_AREF(insn->chanspec), - (UINT) insn->unused[0], - (PBYTE) &data[0], - (PULONG) &data[1]); - break; - - case APCI1710_CHRONO_CONVERTVALUE: - i_ReturnValue=i_APCI1710_ConvertChronoValue (dev, - (BYTE) CR_AREF(insn->chanspec), - (ULONG) insn->unused[0], - (PULONG) &data[0], - (PBYTE) &data[1], - (PBYTE) &data[2], - (PUINT) &data[3], - (PUINT) &data[4], - (PUINT) &data[5]); - break; - - case APCI1710_CHRONO_READINTERRUPT: - printk("In Chrono Read Interrupt\n"); - - data[0]=devpriv->s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Read].b_OldModuleMask; - data[1]=devpriv->s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Read].ul_OldInterruptMask; - data[2]=devpriv->s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Read].ul_OldCounterLatchValue; - - - /**************************/ - /* Increment the read FIFO */ - /***************************/ - - devpriv-> - s_InterruptParameters. - ui_Read = (devpriv-> - s_InterruptParameters. - ui_Read + 1) % APCI1710_SAVE_INTERRUPT; - break; - - default: - printk("ReadType Parameter wrong\n"); - } - - if(i_ReturnValue>=0) i_ReturnValue =insn->n; - return (i_ReturnValue); - -} - - - -/* -+----------------------------------------------------------------------------+ -| Function Name : _INT_ i_APCI1710_GetChronoProgressStatus | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| PBYTE_ pb_ChronoStatus) | -+----------------------------------------------------------------------------+ -| Task : Return the chronometer status (pb_ChronoStatus) from | -| selected chronometer module (b_ModulNbr). | -+----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number (0 to 3) | -+----------------------------------------------------------------------------+ -| Output Parameters : PULONG_ pb_ChronoStatus : Return the chronometer | -| status. | -| 0 : Measurement not started.| -| No start signal occur. | -| 1 : Measurement started. | -| A start signal occur. | -| 2 : Measurement stopped. | -| A stop signal occur. | -| The measurement is | -| terminate. | -| 3: A overflow occur. You | -| must change the base | -| timing witch the | -| function | -| "i_APCI1710_InitChrono" | -+----------------------------------------------------------------------------+ -| Return Value : 0: No error | -| -1: The handle parameter of the board is wrong | -| -2: Module selection wrong | -| -3: The module is not a Chronometer module | -| -4: Chronometer not initialised see function | -| "i_APCI1710_InitChrono" | -+----------------------------------------------------------------------------+ -*/ - -INT i_APCI1710_GetChronoProgressStatus (comedi_device *dev, - BYTE b_ModulNbr, - PBYTE pb_ChronoStatus) - { - INT i_ReturnValue = 0; - DWORD dw_Status; - - /**************************/ - /* Test the module number */ - /**************************/ - - if (b_ModulNbr < 4) - { - /***********************/ - /* Test if chronometer */ - /***********************/ - - if ((devpriv-> - s_BoardInfos. - dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF0000UL) == APCI1710_CHRONOMETER) - { - /***********************************/ - /* Test if chronometer initialised */ - /***********************************/ - - if (devpriv-> - s_ModuleInfo [b_ModulNbr]. - s_ChronoModuleInfo. - b_ChronoInit == 1) - { - - dw_Status=inl(devpriv->s_BoardInfos. - ui_Address + 8 + (64 * b_ModulNbr)); - - /********************/ - /* Test if overflow */ - /********************/ - - if ((dw_Status & 8) == 8) - { - /******************/ - /* Overflow occur */ - /******************/ - - *pb_ChronoStatus = 3; - } // if ((dw_Status & 8) == 8) - else - { - /*******************************/ - /* Test if measurement stopped */ - /*******************************/ - - if ((dw_Status & 2) == 2) - { - /***********************/ - /* A stop signal occur */ - /***********************/ - - *pb_ChronoStatus = 2; - } // if ((dw_Status & 2) == 2) - else - { - /*******************************/ - /* Test if measurement started */ - /*******************************/ - - if ((dw_Status & 1) == 1) - { - /************************/ - /* A start signal occur */ - /************************/ - - *pb_ChronoStatus = 1; - } // if ((dw_Status & 1) == 1) - else - { - /***************************/ - /* Measurement not started */ - /***************************/ - - *pb_ChronoStatus = 0; - } // if ((dw_Status & 1) == 1) - } // if ((dw_Status & 2) == 2) - } // if ((dw_Status & 8) == 8) - } - else - { - /*******************************/ - /* Chronometer not initialised */ - /*******************************/ - DPRINTK("Chronometer not initialised\n"); - i_ReturnValue = -4; - } - } - else - { - /******************************************/ - /* The module is not a Chronometer module */ - /******************************************/ - DPRINTK("The module is not a Chronometer module\n"); - i_ReturnValue = -3; - } - } - else - { - /***********************/ - /* Module number error */ - /***********************/ - DPRINTK("Module number error\n"); - i_ReturnValue = -2; - } - - return (i_ReturnValue); - } - - -/* -+----------------------------------------------------------------------------+ -| Function Name : _INT_ i_APCI1710_ReadChronoValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| UINT_ ui_TimeOut, | -| PBYTE_ pb_ChronoStatus, | -| PULONG_ pul_ChronoValue) | -+----------------------------------------------------------------------------+ -| Task : Return the chronometer status (pb_ChronoStatus) and the| -| timing value (pul_ChronoValue) after a stop signal | -| occur from selected chronometer module (b_ModulNbr). | -| This function are only avaible if you have disabled | -| the interrupt functionality. See function | -| "i_APCI1710_EnableChrono" and the Interrupt mask | -| description chapter. | -| You can test the chronometer status witch the | -| "i_APCI1710_GetChronoProgressStatus" function. | -| | -| The returned value from pul_ChronoValue parameter is | -| not real measured timing. | -| You must used the "i_APCI1710_ConvertChronoValue" | -| function or make this operation for calculate the | -| timing: | -| | -| Timing = pul_ChronoValue * pul_RealTimingInterval. | -| | -| pul_RealTimingInterval is the returned parameter from | -| "i_APCI1710_InitChrono" function and the time unity is | -| the b_TimingUnit from "i_APCI1710_InitChrono" function| -+----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number (0 to 3) | -+----------------------------------------------------------------------------+ -| Output Parameters : PULONG_ pb_ChronoStatus : Return the chronometer | -| status. | -| 0 : Measurement not started.| -| No start signal occur. | -| 1 : Measurement started. | -| A start signal occur. | -| 2 : Measurement stopped. | -| A stop signal occur. | -| The measurement is | -| terminate. | -| 3: A overflow occur. You | -| must change the base | -| timing witch the | -| function | -| "i_APCI1710_InitChrono" | -| PULONG pul_ChronoValue : Chronometer timing value. | -+----------------------------------------------------------------------------+ -| Return Value : 0: No error | -| -1: The handle parameter of the board is wrong | -| -2: Module selection wrong | -| -3: The module is not a Chronometer module | -| -4: Chronometer not initialised see function | -| "i_APCI1710_InitChrono" | -| -5: Timeout parameter is wrong (0 to 65535) | -| -6: Interrupt routine installed. You can not read | -| directly the chronometer measured timing. | -+----------------------------------------------------------------------------+ -*/ - -INT i_APCI1710_ReadChronoValue (comedi_device *dev, - BYTE b_ModulNbr, - UINT ui_TimeOut, - PBYTE pb_ChronoStatus, - PULONG pul_ChronoValue) - { - INT i_ReturnValue = 0; - DWORD dw_Status; - DWORD dw_TimeOut = 0; - - - /**************************/ - /* Test the module number */ - /**************************/ - - if (b_ModulNbr < 4) - { - /***********************/ - /* Test if chronometer */ - /***********************/ - - if ((devpriv-> - s_BoardInfos. - dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF0000UL) == APCI1710_CHRONOMETER) - { - /***********************************/ - /* Test if chronometer initialised */ - /***********************************/ - - if (devpriv-> - s_ModuleInfo [b_ModulNbr]. - s_ChronoModuleInfo. - b_ChronoInit == 1) - { - /*****************************/ - /* Test the timout parameter */ - /*****************************/ - - if ((ui_TimeOut >= 0) && (ui_TimeOut <= 65535UL)) - { - - for (;;) - { - /*******************/ - /* Read the status */ - /*******************/ - - - dw_Status=inl(devpriv->s_BoardInfos. - ui_Address + 8 + (64 * b_ModulNbr)); - - - /********************/ - /* Test if overflow */ - /********************/ - - if ((dw_Status & 8) == 8) - { - /******************/ - /* Overflow occur */ - /******************/ - - *pb_ChronoStatus = 3; - - /***************************/ - /* Test if continuous mode */ - /***************************/ - - if (devpriv->s_ModuleInfo [b_ModulNbr]. - s_ChronoModuleInfo. - b_CycleMode == APCI1710_CONTINUOUS) - { - /*************************/ - /* Clear status register */ - /*************************/ - - - outl(0,devpriv->s_BoardInfos. - ui_Address + 36 + (64 * b_ModulNbr)); - } - - break; - } // if ((dw_Status & 8) == 8) - else - { - /*******************************/ - /* Test if measurement stopped */ - /*******************************/ - - if ((dw_Status & 2) == 2) - { - /***********************/ - /* A stop signal occur */ - /***********************/ - - *pb_ChronoStatus = 2; - - /***************************/ - /* Test if continnous mode */ - /***************************/ - - if (devpriv-> - s_ModuleInfo [b_ModulNbr]. - s_ChronoModuleInfo. - b_CycleMode == APCI1710_CONTINUOUS) - { - /*************************/ - /* Clear status register */ - /*************************/ - - - outl(0,devpriv->s_BoardInfos. - ui_Address + 36 + (64 * b_ModulNbr)); - } - break; - } // if ((dw_Status & 2) == 2) - else - { - /*******************************/ - /* Test if measurement started */ - /*******************************/ - - if ((dw_Status & 1) == 1) - { - /************************/ - /* A start signal occur */ - /************************/ - - *pb_ChronoStatus = 1; - } // if ((dw_Status & 1) == 1) - else - { - /***************************/ - /* Measurement not started */ - /***************************/ - - *pb_ChronoStatus = 0; - } // if ((dw_Status & 1) == 1) - } // if ((dw_Status & 2) == 2) - } // if ((dw_Status & 8) == 8) - - if (dw_TimeOut == ui_TimeOut) - { - /*****************/ - /* Timeout occur */ - /*****************/ - - break; - } - else - { - /*************************/ - /* Increment the timeout */ - /*************************/ - - dw_TimeOut = dw_TimeOut + 1; - mdelay(1000); - - } - } // for (;;) - - /*****************************/ - /* Test if stop signal occur */ - /*****************************/ - - if (*pb_ChronoStatus == 2) - { - /**********************************/ - /* Read the measured timing value */ - /**********************************/ - - - *pul_ChronoValue= inl(devpriv->s_BoardInfos. - ui_Address + 4 + (64 * b_ModulNbr)); - - if (*pul_ChronoValue != 0) - { - *pul_ChronoValue = *pul_ChronoValue - 1; - } - } - else - { - /*************************/ - /* Test if timeout occur */ - /*************************/ - - if ((*pb_ChronoStatus != 3) && (dw_TimeOut == ui_TimeOut) && (ui_TimeOut != 0)) - { - /*****************/ - /* Timeout occur */ - /*****************/ - - *pb_ChronoStatus = 4; - } - } - - } - else - { - /******************************/ - /* Timeout parameter is wrong */ - /******************************/ - DPRINTK("Timeout parameter is wrong\n"); - i_ReturnValue = -5; - } - } - else - { - /*******************************/ - /* Chronometer not initialised */ - /*******************************/ - DPRINTK("Chronometer not initialised\n"); - i_ReturnValue = -4; - } - } - else - { - /******************************************/ - /* The module is not a Chronometer module */ - /******************************************/ - DPRINTK("The module is not a Chronometer module\n"); - i_ReturnValue = -3; - } - } - else - { - /***********************/ - /* Module number error */ - /***********************/ - DPRINTK("Module number error\n"); - i_ReturnValue = -2; - } - - return (i_ReturnValue); - } - -/* -+----------------------------------------------------------------------------+ -| Function Name : _INT_ i_APCI1710_ConvertChronoValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| ULONG_ ul_ChronoValue, | -| PULONG_ pul_Hour, | -| PBYTE_ pb_Minute, | -| PBYTE_ pb_Second, | -| PUINT_ pui_MilliSecond, | -| PUINT_ pui_MicroSecond, | -| PUINT_ pui_NanoSecond) | -+----------------------------------------------------------------------------+ -| Task : Convert the chronometer measured timing | -| (ul_ChronoValue) in to h, mn, s, ms, µs, ns. | -+----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number (0 to 3)| -| ULONG_ ul_ChronoValue : Measured chronometer timing | -| value. | -| See"i_APCI1710_ReadChronoValue"| -+----------------------------------------------------------------------------+ -| Output Parameters : PULONG_ pul_Hour : Chronometer timing hour | -| PBYTE_ pb_Minute : Chronometer timing minute | -| PBYTE_ pb_Second : Chronometer timing second | -| PUINT_ pui_MilliSecond : Chronometer timing mini | -| second | -| PUINT_ pui_MicroSecond : Chronometer timing micro | -| second | -| PUINT_ pui_NanoSecond : Chronometer timing nano | -| second | -+----------------------------------------------------------------------------+ -| Return Value : 0: No error | -| -1: The handle parameter of the board is wrong | -| -2: Module selection wrong | -| -3: The module is not a Chronometer module | -| -4: Chronometer not initialised see function | -| "i_APCI1710_InitChrono" | -+----------------------------------------------------------------------------+ -*/ - -INT i_APCI1710_ConvertChronoValue (comedi_device *dev, - BYTE b_ModulNbr, - ULONG ul_ChronoValue, - PULONG pul_Hour, - PBYTE pb_Minute, - PBYTE pb_Second, - PUINT pui_MilliSecond, - PUINT pui_MicroSecond, - PUINT pui_NanoSecond) - { - INT i_ReturnValue = 0; - double d_Hour; - double d_Minute; - double d_Second; - double d_MilliSecond; - double d_MicroSecond; - double d_NanoSecond; - - /**************************/ - /* Test the module number */ - /**************************/ - - if (b_ModulNbr < 4) - { - /***********************/ - /* Test if chronometer */ - /***********************/ - - if ((devpriv-> - s_BoardInfos. - dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF0000UL) == APCI1710_CHRONOMETER) - { - /***********************************/ - /* Test if chronometer initialised */ - /***********************************/ - - if (devpriv-> - s_ModuleInfo [b_ModulNbr]. - s_ChronoModuleInfo. - b_ChronoInit == 1) - { - - d_Hour = (double) ul_ChronoValue * (double) devpriv-> - s_ModuleInfo [b_ModulNbr]. - s_ChronoModuleInfo. - d_TimingInterval; - - switch (devpriv-> - s_ModuleInfo [b_ModulNbr]. - s_ChronoModuleInfo. - b_TimingUnit) - { - case 0: - d_Hour = d_Hour / (double) 1000.0; - - case 1: - d_Hour = d_Hour / (double) 1000.0; - - case 2: - d_Hour = d_Hour / (double) 1000.0; - - case 3: - d_Hour = d_Hour / (double) 60.0; - - case 4: - /**********************/ - /* Calculate the hour */ - /**********************/ - - d_Hour = d_Hour / (double) 60.0; - *pul_Hour = (ULONG) d_Hour; - - /************************/ - /* Calculate the minute */ - /************************/ - - d_Minute = d_Hour - *pul_Hour; - d_Minute = d_Minute * 60; - *pb_Minute = (BYTE) d_Minute; - - /************************/ - /* Calculate the second */ - /************************/ - - d_Second = d_Minute - *pb_Minute; - d_Second = d_Second * 60; - *pb_Second = (BYTE) d_Second; - - /*****************************/ - /* Calculate the mini second */ - /*****************************/ - - d_MilliSecond = d_Second - *pb_Second; - d_MilliSecond = d_MilliSecond * 1000; - *pui_MilliSecond = (UINT) d_MilliSecond; - - /******************************/ - /* Calculate the micro second */ - /******************************/ - - d_MicroSecond = d_MilliSecond - *pui_MilliSecond; - d_MicroSecond = d_MicroSecond * 1000; - *pui_MicroSecond = (UINT) d_MicroSecond; - - /******************************/ - /* Calculate the micro second */ - /******************************/ - - d_NanoSecond = d_MicroSecond - *pui_MicroSecond; - d_NanoSecond = d_NanoSecond * 1000; - *pui_NanoSecond = (UINT) d_NanoSecond; - break; - } - - } - else - { - /*******************************/ - /* Chronometer not initialised */ - /*******************************/ - DPRINTK("Chronometer not initialised\n"); - i_ReturnValue = -4; - } - } - else - { - /******************************************/ - /* The module is not a Chronometer module */ - /******************************************/ - DPRINTK("The module is not a Chronometer module\n"); - i_ReturnValue = -3; - } - } - else - { - /***********************/ - /* Module number error */ - /***********************/ - DPRINTK("Module number error\n"); - i_ReturnValue = -2; - } - - return (i_ReturnValue); - } + d_Minute = d_Hour - *pul_Hour; + d_Minute = d_Minute * 60; + *pb_Minute = (BYTE) d_Minute; + + /************************/ + /* Calculate the second */ + /************************/ + + d_Second = d_Minute - *pb_Minute; + d_Second = d_Second * 60; + *pb_Second = (BYTE) d_Second; + + /*****************************/ + /* Calculate the mini second */ + /*****************************/ + + d_MilliSecond = d_Second - *pb_Second; + d_MilliSecond = d_MilliSecond * 1000; + *pui_MilliSecond = (UINT) d_MilliSecond; + + /******************************/ + /* Calculate the micro second */ + /******************************/ + + d_MicroSecond = d_MilliSecond - *pui_MilliSecond; + d_MicroSecond = d_MicroSecond * 1000; + *pui_MicroSecond = (UINT) d_MicroSecond; + + /******************************/ + /* Calculate the micro second */ + /******************************/ + + d_NanoSecond = d_MicroSecond - *pui_MicroSecond; + d_NanoSecond = d_NanoSecond * 1000; + *pui_NanoSecond = (UINT) d_NanoSecond; + break; + } + + fpu_end (); + } + else + { + /*******************************/ + /* Chronometer not initialised */ + /*******************************/ + DPRINTK("Chronometer not initialised\n"); + i_ReturnValue = -4; + } + } + else + { + /******************************************/ + /* The module is not a Chronometer module */ + /******************************************/ + DPRINTK("The module is not a Chronometer module\n"); + i_ReturnValue = -3; + } + } + else + { + /***********************/ + /* Module number error */ + /***********************/ + DPRINTK("Module number error\n"); + i_ReturnValue = -2; + } + + return (i_ReturnValue); + } @@ -1675,15 +1721,15 @@ INT i_APCI1710_ConvertChronoValue (comedi_device *dev, | "i_APCI1710_InitChrono" | +----------------------------------------------------------------------------+ */ - + INT i_APCI1710_InsnBitsChronoDigitalIO(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data) { INT i_ReturnValue = 0; - BYTE b_ModulNbr,b_OutputChannel,b_InputChannel,b_IOType; - DWORD dw_Status; - PBYTE pb_ChannelStatus; + BYTE b_ModulNbr,b_OutputChannel,b_InputChannel,b_IOType; + DWORD dw_Status; + PBYTE pb_ChannelStatus; PBYTE pb_PortValue; b_ModulNbr = CR_AREF(insn->chanspec); @@ -1691,7 +1737,7 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(comedi_device *dev,comedi_subdevice *s, b_IOType = (BYTE) data[0]; - + /**************************/ /* Test the module number */ @@ -1723,9 +1769,9 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(comedi_device *dev,comedi_subdevice *s, case APCI1710_CHRONO_SET_CHANNELOFF: b_OutputChannel = (BYTE) CR_CHAN(insn->chanspec); - if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2)) + if (b_OutputChannel <= 2) { - + outl(0,devpriv->s_BoardInfos.ui_Address + 20 + (b_OutputChannel * 4) + (64 * b_ModulNbr)); } // if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2)) else @@ -1733,7 +1779,8 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(comedi_device *dev,comedi_subdevice *s, /****************************************/ /* The selected digital output is wrong */ /****************************************/ - DPRINTK("The selected digital output is wrong\n"); + + DPRINTK("The selected digital output is wrong\n"); i_ReturnValue = -4; } // if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2)) @@ -1743,9 +1790,9 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(comedi_device *dev,comedi_subdevice *s, case APCI1710_CHRONO_SET_CHANNELON: b_OutputChannel = (BYTE) CR_CHAN(insn->chanspec); - if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2)) + if (b_OutputChannel <= 2) { - + outl(1,devpriv->s_BoardInfos.ui_Address + 20 + (b_OutputChannel * 4) + (64 * b_ModulNbr)); } // if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2)) else @@ -1753,7 +1800,8 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(comedi_device *dev,comedi_subdevice *s, /****************************************/ /* The selected digital output is wrong */ /****************************************/ - DPRINTK("The selected digital output is wrong\n"); + + DPRINTK("The selected digital output is wrong\n"); i_ReturnValue = -4; } // if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2)) @@ -1767,7 +1815,7 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(comedi_device *dev,comedi_subdevice *s, pb_ChannelStatus = (PBYTE) &data[0]; b_InputChannel = (BYTE) CR_CHAN(insn->chanspec); - if ((b_InputChannel >= 0) && (b_InputChannel <= 2)) + if (b_InputChannel <= 2) { dw_Status = inl(devpriv->s_BoardInfos.ui_Address + 12 + (64 * b_ModulNbr)); @@ -1779,7 +1827,8 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(comedi_device *dev,comedi_subdevice *s, /***************************************/ /* The selected digital input is wrong */ /***************************************/ - DPRINTK("The selected digital input is wrong\n"); + + DPRINTK("The selected digital input is wrong\n"); i_ReturnValue = -4; } // if ((b_InputChannel >= 0) && (b_InputChannel <= 2)) @@ -1789,7 +1838,7 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(comedi_device *dev,comedi_subdevice *s, pb_PortValue = (PBYTE) &data[0]; - + dw_Status = inl(devpriv->s_BoardInfos.ui_Address + 12 + (64 * b_ModulNbr)); *pb_PortValue = (BYTE) ((dw_Status & 0x7) ^ 7); @@ -1801,7 +1850,8 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(comedi_device *dev,comedi_subdevice *s, /*******************************/ /* Chronometer not initialised */ /*******************************/ - DPRINTK("Chronometer not initialised\n"); + + DPRINTK("Chronometer not initialised\n"); i_ReturnValue = -5; } } @@ -1810,7 +1860,8 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(comedi_device *dev,comedi_subdevice *s, /******************************************/ /* The module is not a Chronometer module */ /******************************************/ - DPRINTK("The module is not a Chronometer module\n"); + + DPRINTK("The module is not a Chronometer module\n"); i_ReturnValue = -3; } } @@ -1819,7 +1870,8 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(comedi_device *dev,comedi_subdevice *s, /***********************/ /* Module number error */ /***********************/ - DPRINTK("Module number error\n"); + + DPRINTK("Module number error\n"); i_ReturnValue = -2; } diff --git a/comedi/drivers/addi-data/APCI1710_Chrono.h b/comedi/drivers/addi-data/APCI1710_Chrono.h index 7d8833be..e284114d 100644 --- a/comedi/drivers/addi-data/APCI1710_Chrono.h +++ b/comedi/drivers/addi-data/APCI1710_Chrono.h @@ -1,78 +1 @@ - - - -#define APCI1710_30MHZ 30 -#define APCI1710_33MHZ 33 -#define APCI1710_40MHZ 40 - - -#define APCI1710_SINGLE 0 -#define APCI1710_CONTINUOUS 1 - - -#define APCI1710_CHRONO_PROGRESS_STATUS 0 -#define APCI1710_CHRONO_READVALUE 1 -#define APCI1710_CHRONO_CONVERTVALUE 2 -#define APCI1710_CHRONO_READINTERRUPT 3 - -#define APCI1710_CHRONO_SET_CHANNELON 0 -#define APCI1710_CHRONO_SET_CHANNELOFF 1 -#define APCI1710_CHRONO_READ_CHANNEL 2 -#define APCI1710_CHRONO_READ_PORT 3 - -/* -+----------------------------------------------------------------------------+ -| CHRONOMETER INISIALISATION FUNCTION | -+----------------------------------------------------------------------------+ */ - -INT i_APCI1710_InsnConfigInitChrono(comedi_device *dev,comedi_subdevice *s, - comedi_insn *insn,lsampl_t *data); - -INT i_APCI1710_InsnWriteEnableDisableChrono(comedi_device *dev,comedi_subdevice *s, - comedi_insn *insn,lsampl_t *data); - - -/* -+----------------------------------------------------------------------------+ -| CHRONOMETER READ FUNCTION | -+----------------------------------------------------------------------------+ -*/ - -INT i_APCI1710_InsnReadChrono(comedi_device *dev,comedi_subdevice *s, -comedi_insn *insn,lsampl_t *data); - - -INT i_APCI1710_GetChronoProgressStatus (comedi_device *dev, - BYTE b_ModulNbr, - PBYTE pb_ChronoStatus); - -INT i_APCI1710_ReadChronoValue (comedi_device *dev, - BYTE b_ModulNbr, - UINT ui_TimeOut, - PBYTE pb_ChronoStatus, - PULONG pul_ChronoValue); - -INT i_APCI1710_ConvertChronoValue (comedi_device *dev, - BYTE b_ModulNbr, - ULONG ul_ChronoValue, - PULONG pul_Hour, - PBYTE pb_Minute, - PBYTE pb_Second, - PUINT pui_MilliSecond, - PUINT pui_MicroSecond, - PUINT pui_NanoSecond); - - - - - -/* -+----------------------------------------------------------------------------+ -| CHRONOMETER DIGITAL INPUT OUTPUT FUNCTION | -+----------------------------------------------------------------------------+ -*/ - -INT i_APCI1710_InsnBitsChronoDigitalIO(comedi_device *dev,comedi_subdevice *s, - comedi_insn *insn,lsampl_t *data); - - +/** @verbatim Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. ADDI-DATA GmbH Dieselstrasse 3 D-77833 Ottersweier Tel: +19(0)7223/9493-0 Fax: +49(0)7223/9493-92 http://www.addi-data-com info@addi-data.com This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA You shoud also find the complete GPL in the COPYING file accompanying this source code. @endverbatim */ #define APCI1710_30MHZ 30 #define APCI1710_33MHZ 33 #define APCI1710_40MHZ 40 #define APCI1710_SINGLE 0 #define APCI1710_CONTINUOUS 1 #define APCI1710_CHRONO_PROGRESS_STATUS 0 #define APCI1710_CHRONO_READVALUE 1 #define APCI1710_CHRONO_CONVERTVALUE 2 #define APCI1710_CHRONO_READINTERRUPT 3 #define APCI1710_CHRONO_SET_CHANNELON 0 #define APCI1710_CHRONO_SET_CHANNELOFF 1 #define APCI1710_CHRONO_READ_CHANNEL 2 #define APCI1710_CHRONO_READ_PORT 3 /* +----------------------------------------------------------------------------+ | CHRONOMETER INISIALISATION FUNCTION | +----------------------------------------------------------------------------+ */ INT i_APCI1710_InsnConfigInitChrono(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data); INT i_APCI1710_InsnWriteEnableDisableChrono(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data); /* +----------------------------------------------------------------------------+ | CHRONOMETER READ FUNCTION | +----------------------------------------------------------------------------+ */ INT i_APCI1710_InsnReadChrono(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data); INT i_APCI1710_GetChronoProgressStatus (comedi_device *dev, BYTE b_ModulNbr, PBYTE pb_ChronoStatus); INT i_APCI1710_ReadChronoValue (comedi_device *dev, BYTE b_ModulNbr, UINT ui_TimeOut, PBYTE pb_ChronoStatus, PULONG pul_ChronoValue); INT i_APCI1710_ConvertChronoValue (comedi_device *dev, BYTE b_ModulNbr, ULONG ul_ChronoValue, PULONG pul_Hour, PBYTE pb_Minute, PBYTE pb_Second, PUINT pui_MilliSecond, PUINT pui_MicroSecond, PUINT pui_NanoSecond); /* +----------------------------------------------------------------------------+ | CHRONOMETER DIGITAL INPUT OUTPUT FUNCTION | +----------------------------------------------------------------------------+ */ INT i_APCI1710_InsnBitsChronoDigitalIO(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data); \ No newline at end of file diff --git a/comedi/drivers/addi-data/APCI1710_Dig_io.c b/comedi/drivers/addi-data/APCI1710_Dig_io.c index c39d304b..e7d1aac9 100644 --- a/comedi/drivers/addi-data/APCI1710_Dig_io.c +++ b/comedi/drivers/addi-data/APCI1710_Dig_io.c @@ -1,14 +1,38 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ /* + +-----------------------------------------------------------------------+ | (C) ADDI-DATA GmbH Dieselstraße 3 D-77833 Ottersweier | +-----------------------------------------------------------------------+ | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | +-----------------------------------------------------------------------+ - | Project : API APCI1710 | Compiler : BORLANDC/MICROSOFT C | - | Module name : DIG_IO.C | Version : 3.1 / 6.0 | + | Project : API APCI1710 | Compiler : gcc | + | Module name : DIG_IO.C | Version : 2.96 | +-------------------------------+---------------------------------------+ - | Author : S.WEBER | Date : 16.06.98 | + | Project manager: Eric Stolz | Date : 02/12/2002 | +-----------------------------------------------------------------------+ | Description : APCI-1710 digital I/O module | | | @@ -79,19 +103,20 @@ Activates and deactivates the digital output memory. INT i_APCI1710_InsnConfigDigitalIO(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data) { - BYTE b_ModulNbr,b_ChannelAMode,b_ChannelBMode ; + BYTE b_ModulNbr,b_ChannelAMode,b_ChannelBMode ; BYTE b_MemoryOnOff,b_ConfigType; INT i_ReturnValue = 0; DWORD dw_WriteConfig = 0; - - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_ConfigType = (BYTE) data[0];// Memory or Init + + b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); + b_ConfigType + = (BYTE) data[0];// Memory or Init b_ChannelAMode = (BYTE) data[1]; b_ChannelBMode = (BYTE) data[2]; - b_MemoryOnOff = (BYTE) data[1]; // if memory operation + b_MemoryOnOff = (BYTE) data[1]; // if memory operation i_ReturnValue = insn->n; - - + + /**************************/ /* Test the module number */ /**************************/ @@ -99,12 +124,12 @@ INT i_APCI1710_InsnConfigDigitalIO(comedi_device *dev,comedi_subdevice *s, if (b_ModulNbr >= 4) { DPRINTK("Module Number invalid\n"); - i_ReturnValue = -2; + i_ReturnValue = -2; return i_ReturnValue; } - switch(b_ConfigType) - { - case APCI1710_DIGIO_MEMORYONOFF: + switch(b_ConfigType) + { + case APCI1710_DIGIO_MEMORYONOFF: if(b_MemoryOnOff) // If Memory ON { @@ -133,10 +158,10 @@ INT i_APCI1710_InsnConfigDigitalIO(comedi_device *dev,comedi_subdevice *s, s_DigitalIOInfo. b_OutputMemoryEnabled = 0; } - break; - - case APCI1710_DIGIO_INIT: - + break; + + case APCI1710_DIGIO_INIT: + /*******************************/ /* Test if digital I/O counter */ /*******************************/ @@ -218,8 +243,8 @@ INT i_APCI1710_InsnConfigDigitalIO(comedi_device *dev,comedi_subdevice *s, /******************************************/ DPRINTK("The module is not a digital I/O module\n"); i_ReturnValue = -3; - } - } // end of Switch + } + } // end of Switch printk("Return Value %d\n",i_ReturnValue); return i_ReturnValue; } @@ -285,11 +310,11 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(comedi_device *dev,comedi_subdevice *s, INT i_ReturnValue = 0; DWORD dw_StatusReg; BYTE b_ModulNbr,b_InputChannel; - PBYTE pb_ChannelStatus; + PBYTE pb_ChannelStatus; b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_InputChannel = (BYTE) CR_CHAN(insn->chanspec); + b_InputChannel = (BYTE) CR_CHAN(insn->chanspec); data[0]=0; - pb_ChannelStatus= (PBYTE) &data[0]; + pb_ChannelStatus= (PBYTE) &data[0]; i_ReturnValue = insn->n; @@ -309,7 +334,7 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(comedi_device *dev,comedi_subdevice *s, /* Test the digital imnput channel number */ /******************************************/ - if ((b_InputChannel >= 0) && (b_InputChannel <= 6)) + if (b_InputChannel <= 6) { /**********************************************/ /* Test if the digital I/O module initialised */ @@ -378,7 +403,7 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(comedi_device *dev,comedi_subdevice *s, dw_StatusReg = inl(devpriv->s_BoardInfos.ui_Address + (64 * b_ModulNbr)); *pb_ChannelStatus = (BYTE) ((dw_StatusReg ^ 0x1C) >> b_InputChannel) & 1; - + } // if (i_ReturnValue == 0) } else @@ -470,13 +495,13 @@ INT i_APCI1710_InsnWriteDigitalIOChlOnOff(comedi_device *dev,comedi_subdevice *s comedi_insn *insn,lsampl_t *data) { INT i_ReturnValue = 0; - DWORD dw_WriteValue; + DWORD dw_WriteValue = 0; BYTE b_ModulNbr,b_OutputChannel; i_ReturnValue = insn->n; b_ModulNbr = CR_AREF(insn->chanspec); b_OutputChannel = CR_CHAN(insn->chanspec); - + /**************************/ /* Test the module number */ @@ -714,18 +739,21 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(comedi_device *dev,comedi_subdevice *s comedi_insn *insn,lsampl_t *data) { INT i_ReturnValue = 0; - DWORD dw_WriteValue,dw_StatusReg; - BYTE b_ModulNbr,b_PortValue; - BYTE b_PortOperation,b_PortOnOFF; - PBYTE pb_PortValue; - + DWORD dw_WriteValue = 0; + DWORD dw_StatusReg; + BYTE b_ModulNbr,b_PortValue; + BYTE b_PortOperation,b_PortOnOFF; + + PBYTE pb_PortValue; + b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_PortOperation = (BYTE) data[0];// Input or output - b_PortOnOFF = (BYTE) data[1];// if output then On or Off + b_PortOperation = (BYTE) data[0];// Input or output + b_PortOnOFF = (BYTE) data[1];// if output then On or Off b_PortValue = (BYTE) data[2];// if out put then Value i_ReturnValue = insn->n; - pb_PortValue = (PBYTE) &data[0]; // if input then read value - + pb_PortValue = (PBYTE) &data[0]; +// if input then read value + switch(b_PortOperation) @@ -763,7 +791,7 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(comedi_device *dev,comedi_subdevice *s dw_StatusReg=inl(devpriv->s_BoardInfos.ui_Address + (64 * b_ModulNbr)); *pb_PortValue = (BYTE) (dw_StatusReg ^ 0x1C); - + } else { @@ -820,7 +848,7 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(comedi_device *dev,comedi_subdevice *s /* Test the port value */ /***********************/ - if ((b_PortValue >= 0) && (b_PortValue <= 7)) + if (b_PortValue <= 7) { /***********************************/ /* Test the digital output channel */ diff --git a/comedi/drivers/addi-data/APCI1710_Dig_io.h b/comedi/drivers/addi-data/APCI1710_Dig_io.h index 59c79b54..78eef9b2 100644 --- a/comedi/drivers/addi-data/APCI1710_Dig_io.h +++ b/comedi/drivers/addi-data/APCI1710_Dig_io.h @@ -1,4 +1,26 @@ +/** +@verbatim +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ #define APCI1710_ON 1 // Digital Output ON or OFF @@ -8,7 +30,7 @@ #define APCI1710_INPUT 0 // Digital I/O #define APCI1710_OUTPUT 1 -#define APCI1710_DIGIO_MEMORYONOFF 0x10 // +#define APCI1710_DIGIO_MEMORYONOFF 0x10 // #define APCI1710_DIGIO_INIT 0x11 diff --git a/comedi/drivers/addi-data/APCI1710_INCCPT.c b/comedi/drivers/addi-data/APCI1710_INCCPT.c index 5751bca5..03211f0e 100644 --- a/comedi/drivers/addi-data/APCI1710_INCCPT.c +++ b/comedi/drivers/addi-data/APCI1710_INCCPT.c @@ -1,14 +1,37 @@ -/* +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ +/* +-----------------------------------------------------------------------+ | (C) ADDI-DATA GmbH Dieselstraße 3 D-77833 Ottersweier | +-----------------------------------------------------------------------+ | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | +-----------------------------------------------------------------------+ - | Project : API APCI1710 | Compiler : BORLANDC/MICROSOFT C | - | Module name : INC_CPT.C | Version : 3.1 / 6.0 | + | Project : API APCI1710 | Compiler : gcc | + | Module name : INC_CPT.C | Version : 2.96 | +-------------------------------+---------------------------------------+ - | Author : S.WEBER | Date : 08.01.98 | + | Project manager: Eric Stolz | Date : 02/12/2002 | +-----------------------------------------------------------------------+ | Description : APCI-1710 incremental counter module | | | @@ -60,7 +83,10 @@ comedi_insn *insn,lsampl_t *data) UINT ui_ConfigType; INT i_ReturnValue = 0; ui_ConfigType=CR_CHAN(insn->chanspec); - devpriv->tsk_Current=current; // Save the current process task structure + + printk ("\nINC_CPT"); + + devpriv->tsk_Current=current; // Save the current process task structure switch(ui_ConfigType) { case APCI1710_INCCPT_INITCOUNTER : @@ -367,7 +393,8 @@ INT i_APCI1710_InitCounter (comedi_device *dev, /*********************************************************/ /* The selected second counter operating option is wrong */ /*********************************************************/ - DPRINTK("The selected second counter operating option is wrong\n"); + + DPRINTK("The selected second counter operating option is wrong\n"); i_ReturnValue = -7; } } @@ -376,7 +403,8 @@ INT i_APCI1710_InitCounter (comedi_device *dev, /*******************************************************/ /* The selected second counter operating mode is wrong */ /*******************************************************/ - DPRINTK("The selected second counter operating mode is wrong\n"); + + DPRINTK("The selected second counter operating mode is wrong\n"); i_ReturnValue = -6; } } @@ -386,7 +414,8 @@ INT i_APCI1710_InitCounter (comedi_device *dev, /********************************************************/ /* The selected first counter operating option is wrong */ /********************************************************/ - DPRINTK("The selected first counter operating option is wrong\n"); + + DPRINTK("The selected first counter operating option is wrong\n"); i_ReturnValue = -5; } } @@ -404,7 +433,8 @@ INT i_APCI1710_InitCounter (comedi_device *dev, /***************************************/ /* The selected counter range is wrong */ /***************************************/ - DPRINTK("The selected counter range is wrong\n"); + + DPRINTK("The selected counter range is wrong\n"); i_ReturnValue = -3; } @@ -466,7 +496,7 @@ INT i_APCI1710_InitCounter (comedi_device *dev, /* Write the configuration */ /***************************/ - + outl(devpriv->s_ModuleInfo [b_ModulNbr]. s_SiemensCounterInfo. s_ModeRegister. @@ -487,7 +517,8 @@ INT i_APCI1710_InitCounter (comedi_device *dev, /**************************************/ /* The module is not a counter module */ /**************************************/ - DPRINTK("The module is not a counter module\n"); + + DPRINTK("The module is not a counter module\n"); i_ReturnValue = -2; } @@ -576,7 +607,7 @@ INT i_APCI1710_CounterAutoTest (comedi_device *dev,PBYTE pb_TestStatus) /* Start the test */ /******************/ - + outl(3,devpriv->s_BoardInfos. ui_Address + 16 + (64 * b_ModulCpt)); @@ -584,7 +615,7 @@ INT i_APCI1710_CounterAutoTest (comedi_device *dev,PBYTE pb_TestStatus) /* Tatch the counter */ /*********************/ - + outl(1,devpriv->s_BoardInfos. ui_Address + (64 * b_ModulCpt)); @@ -592,7 +623,7 @@ INT i_APCI1710_CounterAutoTest (comedi_device *dev,PBYTE pb_TestStatus) /* Read the latch value */ /************************/ - + dw_LathchValue=inl(devpriv->s_BoardInfos. ui_Address + 4 + (64 * b_ModulCpt)); @@ -618,7 +649,8 @@ INT i_APCI1710_CounterAutoTest (comedi_device *dev,PBYTE pb_TestStatus) /***************************/ /* No counter module found */ /***************************/ - DPRINTK("No counter module found\n"); + + DPRINTK("No counter module found\n"); i_ReturnValue = -2; } @@ -1003,7 +1035,8 @@ INT i_APCI1710_InitIndex (comedi_device *dev, /************************************/ /* The auto mode parameter is wrong */ /************************************/ - DPRINTK("The auto mode parameter is wrong\n"); + + DPRINTK("The auto mode parameter is wrong\n"); i_ReturnValue = -6; } } @@ -1012,7 +1045,8 @@ INT i_APCI1710_InitIndex (comedi_device *dev, /***********************************************/ /* The index operating mode parameter is wrong */ /***********************************************/ - DPRINTK("The index operating mode parameter is wrong\n"); + + DPRINTK("The index operating mode parameter is wrong\n"); i_ReturnValue = -5; } } @@ -1021,7 +1055,8 @@ INT i_APCI1710_InitIndex (comedi_device *dev, /*******************************************/ /* The reference action parameter is wrong */ /*******************************************/ - DPRINTK("The reference action parameter is wrong\n"); + + DPRINTK("The reference action parameter is wrong\n"); i_ReturnValue = -4; } } @@ -1031,7 +1066,8 @@ INT i_APCI1710_InitIndex (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -1040,7 +1076,8 @@ INT i_APCI1710_InitIndex (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -1143,7 +1180,7 @@ INT i_APCI1710_InitReference (comedi_device *dev, b_ModeRegister2 & APCI1710_REFERENCE_LOW; } - + outl(devpriv->s_ModuleInfo [b_ModulNbr]. s_SiemensCounterInfo. s_ModeRegister. @@ -1162,7 +1199,8 @@ INT i_APCI1710_InitReference (comedi_device *dev, /**************************************/ /* Reference level parameter is wrong */ /**************************************/ - DPRINTK("Reference level parameter is wrong\n"); + + DPRINTK("Reference level parameter is wrong\n"); i_ReturnValue = -4; } } @@ -1172,7 +1210,8 @@ INT i_APCI1710_InitReference (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -1181,7 +1220,8 @@ INT i_APCI1710_InitReference (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -1287,7 +1327,8 @@ INT i_APCI1710_InitExternalStrobe (comedi_device *dev, /********************************************/ /* External strobe level parameter is wrong */ /********************************************/ - DPRINTK("External strobe level parameter is wrong\n"); + + DPRINTK("External strobe level parameter is wrong\n"); i_ReturnValue = -5; } } // if (b_ExternalStrobe == 0 || b_ExternalStrobe == 1) @@ -1296,7 +1337,8 @@ INT i_APCI1710_InitExternalStrobe (comedi_device *dev, /**************************************/ /* External strobe selection is wrong */ /**************************************/ - DPRINTK("External strobe selection is wrong\n"); + + DPRINTK("External strobe selection is wrong\n"); i_ReturnValue = -4; } // if (b_ExternalStrobe == 0 || b_ExternalStrobe == 1) } @@ -1306,7 +1348,8 @@ INT i_APCI1710_InitExternalStrobe (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -1315,7 +1358,8 @@ INT i_APCI1710_InitExternalStrobe (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -1388,7 +1432,8 @@ INT i_APCI1710_InitCompareLogic (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -1397,7 +1442,8 @@ INT i_APCI1710_InitCompareLogic (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -1463,7 +1509,7 @@ INT i_APCI1710_InitFrequencyMeasurement (comedi_device *dev, PULONG pul_RealTimingInterval) { INT i_ReturnValue = 0; - ULONG ul_TimerValue; + ULONG ul_TimerValue = 0; double d_RealTimingInterval; DWORD dw_Status = 0; @@ -1495,7 +1541,7 @@ INT i_APCI1710_InitFrequencyMeasurement (comedi_device *dev, /* Test the timing unit */ /************************/ - if ((b_TimingUnity >= 0) && (b_TimingUnity <= 2)) + if (b_TimingUnity <= 2) { /**********************************/ /* Test the base timing selection */ @@ -1545,7 +1591,8 @@ INT i_APCI1710_InitFrequencyMeasurement (comedi_device *dev, /*****************************/ /* 40MHz quartz not on board */ /*****************************/ - DPRINTK("40MHz quartz not on board\n"); + + DPRINTK("40MHz quartz not on board\n"); i_ReturnValue = -7; } } @@ -1572,7 +1619,7 @@ INT i_APCI1710_InitFrequencyMeasurement (comedi_device *dev, if ((devpriv->s_BoardInfos. dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3131) { - + /**********************/ /* Test if 40MHz used */ /**********************/ @@ -1614,12 +1661,13 @@ INT i_APCI1710_InitFrequencyMeasurement (comedi_device *dev, b_ModeRegister4 & APCI1710_DISABLE_40MHZ_FREQUENCY; } // if (b_PCIInputClock == APCI1710_40MHZ) - + /********************************/ /* Calculate the division fator */ /********************************/ + fpu_begin (); switch (b_TimingUnity) { /******/ @@ -1664,7 +1712,8 @@ INT i_APCI1710_InitFrequencyMeasurement (comedi_device *dev, /* æs */ /******/ - case 1: + case 1: + /******************/ /* Timer 0 factor */ @@ -1703,7 +1752,8 @@ INT i_APCI1710_InitFrequencyMeasurement (comedi_device *dev, /* ms */ /******/ - case 2: + case 2: + /******************/ /* Timer 0 factor */ @@ -1738,6 +1788,7 @@ INT i_APCI1710_InitFrequencyMeasurement (comedi_device *dev, break; } + fpu_end (); /*************************/ /* Write the timer value */ /*************************/ @@ -1761,7 +1812,8 @@ INT i_APCI1710_InitFrequencyMeasurement (comedi_device *dev, /***************************/ /* Counter not initialised */ /***************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } // if (i_ReturnValue == 0) @@ -1771,7 +1823,8 @@ INT i_APCI1710_InitFrequencyMeasurement (comedi_device *dev, /**********************************/ /* Base timing selection is wrong */ /**********************************/ - DPRINTK("Base timing selection is wrong\n"); + + DPRINTK("Base timing selection is wrong\n"); i_ReturnValue = -6; } } @@ -1780,7 +1833,8 @@ INT i_APCI1710_InitFrequencyMeasurement (comedi_device *dev, /***********************************/ /* Timing unity selection is wrong */ /***********************************/ - DPRINTK("Timing unity selection is wrong\n"); + + DPRINTK("Timing unity selection is wrong\n"); i_ReturnValue = -5; } } @@ -1789,7 +1843,8 @@ INT i_APCI1710_InitFrequencyMeasurement (comedi_device *dev, /*****************************************/ /* The selected PCI input clock is wrong */ /*****************************************/ - DPRINTK("The selected PCI input clock is wrong\n"); + + DPRINTK("The selected PCI input clock is wrong\n"); i_ReturnValue = -4; } } @@ -1799,7 +1854,8 @@ INT i_APCI1710_InitFrequencyMeasurement (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -1808,7 +1864,8 @@ INT i_APCI1710_InitFrequencyMeasurement (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -1842,7 +1899,7 @@ comedi_insn *insn,lsampl_t *data) UINT ui_BitsType; INT i_ReturnValue=0; ui_BitsType=CR_CHAN(insn->chanspec); - devpriv->tsk_Current=current; // Save the current process task structure + devpriv->tsk_Current=current; // Save the current process task structure switch(ui_BitsType) { @@ -1951,7 +2008,8 @@ INT i_APCI1710_ClearCounterValue (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -1960,7 +2018,8 @@ INT i_APCI1710_ClearCounterValue (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -2029,7 +2088,8 @@ INT i_APCI1710_ClearAllCounterValue (comedi_device *dev) /***************************/ /* No counter module found */ /***************************/ - DPRINTK("No counter module found\n"); + + DPRINTK("No counter module found\n"); i_ReturnValue = -2; } @@ -2187,7 +2247,7 @@ INT i_APCI1710_SetInputFilter (comedi_device *dev, /* Test if 40MHz quartz on board */ /*********************************/ - + dw_Status= inl(devpriv->s_BoardInfos. ui_Address + 36 + (64 * b_ModulNbr)); @@ -2200,7 +2260,8 @@ INT i_APCI1710_SetInputFilter (comedi_device *dev, /*****************************/ /* 40MHz quartz not on board */ /*****************************/ - DPRINTK("40MHz quartz not on board\n"); + + DPRINTK("40MHz quartz not on board\n"); i_ReturnValue = -6; } } // if (b_PCIInputClock == APCI1710_40MHZ) @@ -2297,7 +2358,8 @@ INT i_APCI1710_SetInputFilter (comedi_device *dev, /**************************************/ /* The selected filter value is wrong */ /**************************************/ - DPRINTK("The selected filter value is wrong\n"); + + DPRINTK("The selected filter value is wrong\n"); i_ReturnValue = -5; } // if (b_Filter < 16) } // if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ) || (b_PCIInputClock == APCI1710_40MHZ)) @@ -2306,7 +2368,8 @@ INT i_APCI1710_SetInputFilter (comedi_device *dev, /*****************************************/ /* The selected PCI input clock is wrong */ /*****************************************/ - DPRINTK("The selected PCI input clock is wrong\n"); + + DPRINTK("The selected PCI input clock is wrong\n"); i_ReturnValue = 4; } // if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ) || (b_PCIInputClock == APCI1710_40MHZ)) } @@ -2315,7 +2378,8 @@ INT i_APCI1710_SetInputFilter (comedi_device *dev, /**************************************/ /* The module is not a counter module */ /**************************************/ - DPRINTK("The module is not a counter module\n"); + + DPRINTK("The module is not a counter module\n"); i_ReturnValue = -3; } } @@ -2324,7 +2388,8 @@ INT i_APCI1710_SetInputFilter (comedi_device *dev, /**************************************/ /* The module is not a counter module */ /**************************************/ - DPRINTK("The module is not a counter module\n"); + + DPRINTK("The module is not a counter module\n"); i_ReturnValue = -3; } } @@ -2333,7 +2398,8 @@ INT i_APCI1710_SetInputFilter (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -2409,7 +2475,8 @@ INT i_APCI1710_LatchCounter (comedi_device *dev, /**************************************************/ /* The selected latch register parameter is wrong */ /**************************************************/ - DPRINTK("The selected latch register parameter is wrong\n"); + + DPRINTK("The selected latch register parameter is wrong\n"); i_ReturnValue = -4; } } @@ -2419,7 +2486,8 @@ INT i_APCI1710_LatchCounter (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -2428,7 +2496,8 @@ INT i_APCI1710_LatchCounter (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -2553,7 +2622,8 @@ INT i_APCI1710_SetIndexAndReferenceSource (comedi_device *dev, /*********************************/ /* The source selection is wrong */ /*********************************/ - DPRINTK("The source selection is wrong\n"); + + DPRINTK("The source selection is wrong\n"); i_ReturnValue = -4; } // if (b_SourceSelection == APCI1710_SOURCE_0 ||b_SourceSelection == APCI1710_SOURCE_1) } @@ -2562,7 +2632,8 @@ INT i_APCI1710_SetIndexAndReferenceSource (comedi_device *dev, /**************************************/ /* The module is not a counter module */ /**************************************/ - DPRINTK("The module is not a counter module\n"); + + DPRINTK("The module is not a counter module\n"); i_ReturnValue = -3; } } @@ -2571,7 +2642,8 @@ INT i_APCI1710_SetIndexAndReferenceSource (comedi_device *dev, /**************************************/ /* The module is not a counter module */ /**************************************/ - DPRINTK("The module is not a counter module\n"); + + DPRINTK("The module is not a counter module\n"); i_ReturnValue = -3; } } @@ -2580,7 +2652,8 @@ INT i_APCI1710_SetIndexAndReferenceSource (comedi_device *dev, /***************************************/ /* The selected module number is wrong */ /***************************************/ - DPRINTK("The selected module number is wrong\n"); + + DPRINTK("The selected module number is wrong\n"); i_ReturnValue = -2; } @@ -2659,7 +2732,8 @@ INT i_APCI1710_SetDigitalChlOn (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -2668,7 +2742,8 @@ INT i_APCI1710_SetDigitalChlOn (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -2747,7 +2822,8 @@ INT i_APCI1710_SetDigitalChlOff (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -2756,7 +2832,8 @@ INT i_APCI1710_SetDigitalChlOff (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -2790,7 +2867,7 @@ comedi_insn *insn,lsampl_t *data) INT i_ReturnValue=0; ui_WriteType=CR_CHAN(insn->chanspec); - devpriv->tsk_Current=current; // Save the current process task structure + devpriv->tsk_Current=current; // Save the current process task structure switch(ui_WriteType) { @@ -2936,7 +3013,8 @@ INT i_APCI1710_EnableLatchInterrupt (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -2945,7 +3023,8 @@ INT i_APCI1710_EnableLatchInterrupt (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -3035,7 +3114,8 @@ INT i_APCI1710_DisableLatchInterrupt (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -3044,7 +3124,8 @@ INT i_APCI1710_DisableLatchInterrupt (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -3123,7 +3204,8 @@ INT i_APCI1710_Write16BitCounterValue (comedi_device *dev, /**************************************************/ /* The selected 16-Bit counter parameter is wrong */ /**************************************************/ - DPRINTK("The selected 16-Bit counter parameter is wrong\n"); + + DPRINTK("The selected 16-Bit counter parameter is wrong\n"); i_ReturnValue = -4; } } @@ -3133,7 +3215,8 @@ INT i_APCI1710_Write16BitCounterValue (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -3142,7 +3225,8 @@ INT i_APCI1710_Write16BitCounterValue (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -3210,7 +3294,8 @@ INT i_APCI1710_Write32BitCounterValue (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -3219,7 +3304,8 @@ INT i_APCI1710_Write32BitCounterValue (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -3310,7 +3396,8 @@ INT i_APCI1710_EnableIndex (comedi_device *dev, /*************************************************************/ /* Index not initialised see function "i_APCI1710_InitIndex" */ /*************************************************************/ - DPRINTK("Index not initialised \n"); + + DPRINTK("Index not initialised \n"); i_ReturnValue = -4; } } @@ -3320,7 +3407,8 @@ INT i_APCI1710_EnableIndex (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -3329,7 +3417,8 @@ INT i_APCI1710_EnableIndex (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -3414,7 +3503,8 @@ INT i_APCI1710_DisableIndex (comedi_device *dev, /*************************************************************/ /* Index not initialised see function "i_APCI1710_InitIndex" */ /*************************************************************/ - DPRINTK("Index not initialised \n"); + + DPRINTK("Index not initialised \n"); i_ReturnValue = -4; } } @@ -3424,7 +3514,8 @@ INT i_APCI1710_DisableIndex (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -3433,7 +3524,8 @@ INT i_APCI1710_DisableIndex (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -3528,7 +3620,8 @@ INT i_APCI1710_EnableCompareLogic (comedi_device *dev, /*********************************/ /* Compare logic not initialised */ /*********************************/ - DPRINTK("Compare logic not initialised\n"); + + DPRINTK("Compare logic not initialised\n"); i_ReturnValue = -4; } } @@ -3538,7 +3631,8 @@ INT i_APCI1710_EnableCompareLogic (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -3547,7 +3641,8 @@ INT i_APCI1710_EnableCompareLogic (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -3636,7 +3731,8 @@ INT i_APCI1710_DisableCompareLogic (comedi_device *dev, /*********************************/ /* Compare logic not initialised */ /*********************************/ - DPRINTK("Compare logic not initialised\n"); + + DPRINTK("Compare logic not initialised\n"); i_ReturnValue = -4; } } @@ -3646,7 +3742,8 @@ INT i_APCI1710_DisableCompareLogic (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -3655,7 +3752,8 @@ INT i_APCI1710_DisableCompareLogic (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -3790,7 +3888,8 @@ INT i_APCI1710_EnableFrequencyMeasurement (comedi_device *dev, /********************************/ /* Interrupt parameter is wrong */ /********************************/ - DPRINTK("Interrupt parameter is wrong\n"); + + DPRINTK("Interrupt parameter is wrong\n"); i_ReturnValue = -5; } } @@ -3799,7 +3898,8 @@ INT i_APCI1710_EnableFrequencyMeasurement (comedi_device *dev, /***********************************************/ /* Frequency measurement logic not initialised */ /***********************************************/ - DPRINTK("Frequency measurement logic not initialised\n"); + + DPRINTK("Frequency measurement logic not initialised\n"); i_ReturnValue = -4; } } @@ -3809,7 +3909,8 @@ INT i_APCI1710_EnableFrequencyMeasurement (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -3818,7 +3919,8 @@ INT i_APCI1710_EnableFrequencyMeasurement (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -3924,7 +4026,8 @@ INT i_APCI1710_DisableFrequencyMeasurement (comedi_device *dev, /***********************************************/ /* Frequency measurement logic not initialised */ /***********************************************/ - DPRINTK("Frequency measurement logic not initialised\n"); + + DPRINTK("Frequency measurement logic not initialised\n"); i_ReturnValue = -4; } } @@ -3934,7 +4037,8 @@ INT i_APCI1710_DisableFrequencyMeasurement (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -3943,7 +4047,8 @@ INT i_APCI1710_DisableFrequencyMeasurement (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -3977,10 +4082,11 @@ INT i_APCI1710_InsnReadINCCPT(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data) { UINT ui_ReadType; - INT i_ReturnValue=0; + INT i_ReturnValue=0; ui_ReadType=CR_CHAN(insn->chanspec); - devpriv->tsk_Current=current; // Save the current process task structure + + devpriv->tsk_Current=current; // Save the current process task structure switch(ui_ReadType) { case APCI1710_INCCPT_READLATCHREGISTERSTATUS: @@ -3995,7 +4101,7 @@ comedi_insn *insn,lsampl_t *data) (BYTE) CR_AREF(insn->chanspec), (BYTE) CR_RANGE(insn->chanspec), (PULONG) &data[0]); - printk("Latch Register Value %d\n",data[0]); + printk("Latch Register Value %d\n",data[0]); break; case APCI1710_INCCPT_READ16BITCOUNTERVALUE: @@ -4045,8 +4151,8 @@ comedi_insn *insn,lsampl_t *data) case APCI1710_INCCPT_GETUDSTATUS: i_ReturnValue=i_APCI1710_GetUDStatus (dev, (BYTE) CR_AREF(insn->chanspec), - (PBYTE) &data[0]); - + (PBYTE) &data[0]); + break; case APCI1710_INCCPT_GETINTERRUPTUDLATCHEDSTATUS: @@ -4062,33 +4168,33 @@ comedi_insn *insn,lsampl_t *data) (PBYTE) &data[1], (PULONG) &data[2]); break; - - case APCI1710_INCCPT_READINTERRUPT: - data[0]=devpriv->s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Read].b_OldModuleMask; - data[1]=devpriv->s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Read].ul_OldInterruptMask; - data[2]=devpriv->s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Read].ul_OldCounterLatchValue; - - - /**************************/ - /* Increment the read FIFO */ - /***************************/ - - devpriv-> - s_InterruptParameters. - ui_Read = (devpriv->s_InterruptParameters. - ui_Read + 1) % APCI1710_SAVE_INTERRUPT; - - - break; + + case APCI1710_INCCPT_READINTERRUPT: + data[0]=devpriv->s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Read].b_OldModuleMask; + data[1]=devpriv->s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Read].ul_OldInterruptMask; + data[2]=devpriv->s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Read].ul_OldCounterLatchValue; + + + /**************************/ + /* Increment the read FIFO */ + /***************************/ + + devpriv-> + s_InterruptParameters. + ui_Read = (devpriv->s_InterruptParameters. + ui_Read + 1) % APCI1710_SAVE_INTERRUPT; + + + break; default: printk("ReadType Parameter wrong\n"); @@ -4175,7 +4281,8 @@ INT i_APCI1710_ReadLatchRegisterStatus (comedi_device *dev, /**************************************************/ /* The selected latch register parameter is wrong */ /**************************************************/ - DPRINTK("The selected latch register parameter is wrong\n"); + + DPRINTK("The selected latch register parameter is wrong\n"); i_ReturnValue = -4; } } @@ -4185,7 +4292,8 @@ INT i_APCI1710_ReadLatchRegisterStatus (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -4194,7 +4302,8 @@ INT i_APCI1710_ReadLatchRegisterStatus (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -4262,15 +4371,16 @@ INT i_APCI1710_ReadLatchRegisterValue (comedi_device *dev, if (b_LatchReg < 2) { *pul_LatchValue=inl(devpriv->s_BoardInfos. - ui_Address + ((b_LatchReg + 1) * 4) + (64 * b_ModulNbr)); - + ui_Address + ((b_LatchReg + 1) * 4) + (64 * b_ModulNbr)); + } else { /**************************************************/ /* The selected latch register parameter is wrong */ /**************************************************/ - DPRINTK("The selected latch register parameter is wrong\n"); + + DPRINTK("The selected latch register parameter is wrong\n"); i_ReturnValue = -4; } } @@ -4280,7 +4390,8 @@ INT i_APCI1710_ReadLatchRegisterValue (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -4289,7 +4400,8 @@ INT i_APCI1710_ReadLatchRegisterValue (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -4377,7 +4489,8 @@ INT i_APCI1710_Read16BitCounterValue (comedi_device *dev, /**************************************************/ /* The selected 16-Bit counter parameter is wrong */ /**************************************************/ - DPRINTK("The selected 16-Bit counter parameter is wrong\n"); + + DPRINTK("The selected 16-Bit counter parameter is wrong\n"); i_ReturnValue = -4; } } @@ -4387,7 +4500,8 @@ INT i_APCI1710_Read16BitCounterValue (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -4396,7 +4510,8 @@ INT i_APCI1710_Read16BitCounterValue (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -4471,7 +4586,8 @@ INT i_APCI1710_Read32BitCounterValue (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -4480,7 +4596,8 @@ INT i_APCI1710_Read32BitCounterValue (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -4556,7 +4673,8 @@ INT i_APCI1710_GetIndexStatus (comedi_device *dev, /*************************************************************/ /* Index not initialised see function "i_APCI1710_InitIndex" */ /*************************************************************/ - DPRINTK("Index not initialised\n"); + + DPRINTK("Index not initialised\n"); i_ReturnValue = -4; } } @@ -4566,7 +4684,8 @@ INT i_APCI1710_GetIndexStatus (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -4575,7 +4694,8 @@ INT i_APCI1710_GetIndexStatus (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -4651,7 +4771,8 @@ INT i_APCI1710_GetReferenceStatus (comedi_device *dev, /*********************************************************************/ /* Reference not initialised see function "i_APCI1710_InitReference" */ /*********************************************************************/ - DPRINTK("Reference not initialised\n"); + + DPRINTK("Reference not initialised\n"); i_ReturnValue = -4; } } @@ -4661,7 +4782,8 @@ INT i_APCI1710_GetReferenceStatus (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -4670,7 +4792,8 @@ INT i_APCI1710_GetReferenceStatus (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -4738,7 +4861,8 @@ INT i_APCI1710_GetUASStatus (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -4747,8 +4871,10 @@ INT i_APCI1710_GetUASStatus (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); - i_ReturnValue = -2; + + DPRINTK("The selected module number parameter is wrong\n"); + i_ReturnValue = -2; + } return (i_ReturnValue); @@ -4806,7 +4932,8 @@ INT i_APCI1710_GetCBStatus (comedi_device *dev, dw_StatusReg=inl(devpriv->s_BoardInfos. ui_Address + 16 + (64 * b_ModulNbr)); - *pb_CBStatus = (BYTE) (dw_StatusReg & 1); + *pb_CBStatus = (BYTE) (dw_StatusReg & 1); + } else { @@ -4814,7 +4941,8 @@ INT i_APCI1710_GetCBStatus (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -4823,7 +4951,8 @@ INT i_APCI1710_GetCBStatus (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -4877,7 +5006,8 @@ INT i_APCI1710_Get16BitCBStatus (comedi_device *dev, INT i_ReturnValue = 0; DWORD dw_StatusReg = 0; - + + /**************************/ /* Test the module number */ /**************************/ @@ -4934,7 +5064,8 @@ INT i_APCI1710_Get16BitCBStatus (comedi_device *dev, /* Counter not initialised to 2*16-bit mode */ /* "i_APCI1710_InitCounter" */ /********************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -4; } // if ((ps_APCI1710Variable->s_Board [b_BoardHandle].s_ModuleInfo [b_ModulNbr].s_SiemensCounterInfo.s_ModeRegister.s_ByteModeRegister.b_ModeRegister1 & 0x10) == 0x10) } // if (ps_APCI1710Variable->s_Board [b_BoardHandle].s_ModuleInfo [b_ModulNbr].s_SiemensCounterInfo.s_InitFlag.b_CounterInit == 1) @@ -4944,7 +5075,8 @@ INT i_APCI1710_Get16BitCBStatus (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } // if (ps_APCI1710Variable->s_Board [b_BoardHandle].s_ModuleInfo [b_ModulNbr].s_SiemensCounterInfo.s_InitFlag.b_CounterInit == 1) } // if (b_ModulNbr < 4) @@ -4953,7 +5085,8 @@ INT i_APCI1710_Get16BitCBStatus (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } // if (b_ModulNbr < 4) @@ -5016,7 +5149,7 @@ INT i_APCI1710_GetUDStatus (comedi_device *dev, ui_Address + 24 + (64 * b_ModulNbr)); *pb_UDStatus = (BYTE) ((dw_StatusReg >> 2) & 1); - + } else { @@ -5024,7 +5157,8 @@ INT i_APCI1710_GetUDStatus (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -5033,7 +5167,8 @@ INT i_APCI1710_GetUDStatus (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -5130,7 +5265,8 @@ INT i_APCI1710_GetInterruptUDLatchedStatus (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -5139,7 +5275,8 @@ INT i_APCI1710_GetInterruptUDLatchedStatus (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } @@ -5258,7 +5395,8 @@ INT i_APCI1710_ReadFrequencyMeasurement (comedi_device *dev, /******************/ *pul_ReadValue=inl(devpriv->s_BoardInfos. - ui_Address + 28 + (64 * b_ModulNbr)); + ui_Address + 28 + (64 * b_ModulNbr)); + if (*pb_UDStatus == 0) { @@ -5349,7 +5487,8 @@ INT i_APCI1710_ReadFrequencyMeasurement (comedi_device *dev, /***********************************************/ /* Frequency measurement logic not initialised */ /***********************************************/ - DPRINTK("Frequency measurement logic not initialised\n"); + + DPRINTK("Frequency measurement logic not initialised\n"); i_ReturnValue = -4; } } @@ -5359,7 +5498,8 @@ INT i_APCI1710_ReadFrequencyMeasurement (comedi_device *dev, /* Counter not initialised see function */ /* "i_APCI1710_InitCounter" */ /****************************************/ - DPRINTK("Counter not initialised\n"); + + DPRINTK("Counter not initialised\n"); i_ReturnValue = -3; } } @@ -5368,7 +5508,8 @@ INT i_APCI1710_ReadFrequencyMeasurement (comedi_device *dev, /*************************************************/ /* The selected module number parameter is wrong */ /*************************************************/ - DPRINTK("The selected module number parameter is wrong\n"); + + DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; } diff --git a/comedi/drivers/addi-data/APCI1710_INCCPT.h b/comedi/drivers/addi-data/APCI1710_INCCPT.h index 5f3bb095..9824970d 100644 --- a/comedi/drivers/addi-data/APCI1710_INCCPT.h +++ b/comedi/drivers/addi-data/APCI1710_INCCPT.h @@ -1,6 +1,28 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ - #define APCI1710_16BIT_COUNTER 0x10 #define APCI1710_32BIT_COUNTER 0x0 #define APCI1710_QUADRUPLE_MODE 0x0 @@ -73,10 +95,10 @@ #define APCI1710_REFERENCE_HIGH 0x40 #define APCI1710_REFERENCE_LOW (~APCI1710_REFERENCE_HIGH) - + #define APCI1710_TOR_GATE_LOW 0x40 #define APCI1710_TOR_GATE_HIGH (~APCI1710_TOR_GATE_LOW) - + // INSN CONFIG #define APCI1710_INCCPT_INITCOUNTER 100 @@ -100,7 +122,7 @@ #define APCI1710_INCCPT_GETUDSTATUS 209 #define APCI1710_INCCPT_GETINTERRUPTUDLATCHEDSTATUS 210 #define APCI1710_INCCPT_READFREQUENCYMEASUREMENT 211 -#define APCI1710_INCCPT_READINTERRUPT 212 +#define APCI1710_INCCPT_READINTERRUPT 212 //INSN BITS #define APCI1710_INCCPT_CLEARCOUNTERVALUE 300 diff --git a/comedi/drivers/addi-data/APCI1710_Inp_cpt.c b/comedi/drivers/addi-data/APCI1710_Inp_cpt.c index bd27ada5..77733e83 100644 --- a/comedi/drivers/addi-data/APCI1710_Inp_cpt.c +++ b/comedi/drivers/addi-data/APCI1710_Inp_cpt.c @@ -1,14 +1,38 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ /* + +-----------------------------------------------------------------------+ | (C) ADDI-DATA GmbH Dieselstraße 3 D-77833 Ottersweier | +-----------------------------------------------------------------------+ | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | +-----------------------------------------------------------------------+ - | Project : API APCI1710 | Compiler : BORLANDC/MICROSOFT C | - | Module name : INP_CPT.C | Version : 3.1 / 6.0 | + | Project : API APCI1710 | Compiler : gcc | + | Module name : Inp_CPT.C | Version : 2.96 | +-------------------------------+---------------------------------------+ - | Author : S.WEBER | Date : 27.08.98 | + | Project manager: Eric Stolz | Date : 02/12/2002 | +-----------------------------------------------------------------------+ | Description : APCI-1710 pulse encoder module | | | @@ -116,14 +140,15 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(comedi_device *dev,comedi_subdevice * b_InputLevelSelection =(BYTE) data[1]; b_TriggerOutputAction =(BYTE) data[2]; ul_StartValue =(ULONG) data[3]; - i_ReturnValue =insn->n; + + i_ReturnValue =insn->n; /***********************************/ /* Test the selected module number */ /***********************************/ - if (b_ModulNbr >= 0 && b_ModulNbr <= 3) + if (b_ModulNbr <= 3) { /*************************/ /* Test if pulse encoder */ @@ -136,7 +161,7 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(comedi_device *dev,comedi_subdevice * /* Test the selected pulse encoder number */ /******************************************/ - if (b_PulseEncoderNbr >= 0 && b_PulseEncoderNbr <= 3) + if (b_PulseEncoderNbr <= 3) { /************************/ /* Test the input level */ @@ -148,7 +173,7 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(comedi_device *dev,comedi_subdevice * /* Test the ouput TRIGGER action selection */ /*******************************************/ - if ((b_TriggerOutputAction >= 0 && b_TriggerOutputAction <= 2) || (b_PulseEncoderNbr > 0)) + if ((b_TriggerOutputAction <= 2) || (b_PulseEncoderNbr > 0)) { if (ul_StartValue > 1) { @@ -232,7 +257,8 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(comedi_device *dev,comedi_subdevice * /**************************************/ /* Pulse encoder start value is wrong */ /**************************************/ - DPRINTK("Pulse encoder start value is wrong\n"); + + DPRINTK("Pulse encoder start value is wrong\n"); i_ReturnValue = -6; } } @@ -241,7 +267,8 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(comedi_device *dev,comedi_subdevice * /****************************************************/ /* Digital TRIGGER output action selection is wrong */ /****************************************************/ - DPRINTK("Digital TRIGGER output action selection is wrong\n"); + + DPRINTK("Digital TRIGGER output action selection is wrong\n"); i_ReturnValue = -5; } } @@ -250,7 +277,8 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(comedi_device *dev,comedi_subdevice * /**********************************/ /* Input level selection is wrong */ /**********************************/ - DPRINTK("Input level selection is wrong\n"); + + DPRINTK("Input level selection is wrong\n"); i_ReturnValue = -4; } } @@ -259,7 +287,8 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(comedi_device *dev,comedi_subdevice * /************************************/ /* Pulse encoder selection is wrong */ /************************************/ - DPRINTK("Pulse encoder selection is wrong\n"); + + DPRINTK("Pulse encoder selection is wrong\n"); i_ReturnValue = -3; } } @@ -268,7 +297,8 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(comedi_device *dev,comedi_subdevice * /********************************************/ /* The module is not a pulse encoder module */ /********************************************/ - DPRINTK("The module is not a pulse encoder module\n"); + + DPRINTK("The module is not a pulse encoder module\n"); i_ReturnValue = -2; } } @@ -277,7 +307,8 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(comedi_device *dev,comedi_subdevice * /********************************************/ /* The module is not a pulse encoder module */ /********************************************/ - DPRINTK("The module is not a pulse encoder module\n"); + + DPRINTK("The module is not a pulse encoder module\n"); i_ReturnValue = -2; } @@ -350,7 +381,7 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(comedi_device *dev,comedi_subdevice * +----------------------------------------------------------------------------+ */ - + INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data) { @@ -368,18 +399,19 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(comedi_device *dev,comedi_subdevice * b_CycleSelection =(BYTE) data[2]; b_InterruptHandling =(BYTE) data[3]; - + + /***********************************/ /* Test the selected module number */ /***********************************/ - if (b_ModulNbr >= 0 && b_ModulNbr <= 3) + if (b_ModulNbr <= 3) { /******************************************/ /* Test the selected pulse encoder number */ /******************************************/ - if (b_PulseEncoderNbr >= 0 && b_PulseEncoderNbr <= 3) + if (b_PulseEncoderNbr <= 3) { /*************************************/ /* Test if pulse encoder initialised */ @@ -434,9 +466,9 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(comedi_device *dev,comedi_subdevice * dw_SetRegister = devpriv->s_ModuleInfo [b_ModulNbr]. s_PulseEncoderModuleInfo. dw_SetRegister | (1UL << b_PulseEncoderNbr); - devpriv->tsk_Current=current; // Save the current process task structure + devpriv->tsk_Current=current; // Save the current process task structure - + } if (i_ReturnValue>=0) @@ -445,7 +477,7 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(comedi_device *dev,comedi_subdevice * /* Enable or disable the interrupt */ /***********************************/ - + outl(devpriv->s_ModuleInfo [b_ModulNbr]. s_PulseEncoderModuleInfo. dw_SetRegister,devpriv->s_BoardInfos. @@ -475,7 +507,7 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(comedi_device *dev,comedi_subdevice * /* Enable the pulse encoder */ /****************************/ - + outl(devpriv->s_ModuleInfo [b_ModulNbr]. s_PulseEncoderModuleInfo. dw_ControlRegister,devpriv->s_BoardInfos. @@ -487,7 +519,8 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(comedi_device *dev,comedi_subdevice * /************************************/ /* Interrupt handling mode is wrong */ /************************************/ - DPRINTK("Interrupt handling mode is wrong\n"); + + DPRINTK("Interrupt handling mode is wrong\n"); i_ReturnValue = -6; } } @@ -496,7 +529,8 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(comedi_device *dev,comedi_subdevice * /*********************************/ /* Cycle selection mode is wrong */ /*********************************/ - DPRINTK("Cycle selection mode is wrong\n"); + + DPRINTK("Cycle selection mode is wrong\n"); i_ReturnValue = -5; } break; @@ -527,7 +561,8 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(comedi_device *dev,comedi_subdevice * /*********************************/ /* Pulse encoder not initialised */ /*********************************/ - DPRINTK("Pulse encoder not initialised\n"); + + DPRINTK("Pulse encoder not initialised\n"); i_ReturnValue = -4; } } @@ -536,7 +571,8 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(comedi_device *dev,comedi_subdevice * /************************************/ /* Pulse encoder selection is wrong */ /************************************/ - DPRINTK("Pulse encoder selection is wrong\n"); + + DPRINTK("Pulse encoder selection is wrong\n"); i_ReturnValue = -3; } } @@ -545,7 +581,8 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(comedi_device *dev,comedi_subdevice * /*****************************/ /* Module selection is wrong */ /*****************************/ - DPRINTK("Module selection is wrong\n"); + + DPRINTK("Module selection is wrong\n"); i_ReturnValue = -2; } @@ -617,10 +654,10 @@ INT i_APCI1710_InsnBitsReadWritePulseEncoder(comedi_device *dev,comedi_subdevi PULONG pul_ReadValue; ULONG ul_WriteValue ; - i_ReturnValue=insn->n; - b_ModulNbr =(BYTE) CR_AREF(insn->chanspec); + i_ReturnValue=insn->n; + b_ModulNbr =(BYTE) CR_AREF(insn->chanspec); b_Type =(BYTE) data[0] ; - b_PulseEncoderNbr=(BYTE) data[1]; + b_PulseEncoderNbr=(BYTE) data[1]; pb_Status =(PBYTE) &data[0]; pul_ReadValue =(PULONG) &data[1]; @@ -628,13 +665,13 @@ INT i_APCI1710_InsnBitsReadWritePulseEncoder(comedi_device *dev,comedi_subdevi /* Test the selected module number */ /***********************************/ - if (b_ModulNbr >= 0 && b_ModulNbr <= 3) + if (b_ModulNbr <= 3) { /******************************************/ /* Test the selected pulse encoder number */ /******************************************/ - if (b_PulseEncoderNbr >= 0 && b_PulseEncoderNbr <= 3) + if (b_PulseEncoderNbr <= 3) { /*************************************/ /* Test if pulse encoder initialised */ @@ -653,7 +690,7 @@ INT i_APCI1710_InsnBitsReadWritePulseEncoder(comedi_device *dev,comedi_subdevi /* Read the status register */ /****************************/ - + dw_StatusRegister=inl(devpriv->s_BoardInfos. ui_Address + 16 + (64 * b_ModulNbr)); @@ -677,7 +714,7 @@ INT i_APCI1710_InsnBitsReadWritePulseEncoder(comedi_device *dev,comedi_subdevi /******************/ /* Read the value */ /******************/ - + *pul_ReadValue=inl(devpriv->s_BoardInfos. ui_Address + (4 * b_PulseEncoderNbr) + (64 * b_ModulNbr)); @@ -689,7 +726,7 @@ INT i_APCI1710_InsnBitsReadWritePulseEncoder(comedi_device *dev,comedi_subdevi /* Write the value */ /*******************/ - + outl(ul_WriteValue,devpriv->s_BoardInfos. ui_Address + (4 * b_PulseEncoderNbr) + (64 * b_ModulNbr)); @@ -700,7 +737,8 @@ INT i_APCI1710_InsnBitsReadWritePulseEncoder(comedi_device *dev,comedi_subdevi /*********************************/ /* Pulse encoder not initialised */ /*********************************/ - DPRINTK("Pulse encoder not initialised\n"); + + DPRINTK("Pulse encoder not initialised\n"); i_ReturnValue = -4; } } @@ -709,7 +747,8 @@ INT i_APCI1710_InsnBitsReadWritePulseEncoder(comedi_device *dev,comedi_subdevi /************************************/ /* Pulse encoder selection is wrong */ /************************************/ - DPRINTK("Pulse encoder selection is wrong\n"); + + DPRINTK("Pulse encoder selection is wrong\n"); i_ReturnValue = -3; } } @@ -718,43 +757,44 @@ INT i_APCI1710_InsnBitsReadWritePulseEncoder(comedi_device *dev,comedi_subdevi /*****************************/ /* Module selection is wrong */ /*****************************/ - DPRINTK("Module selection is wrong\n"); + + DPRINTK("Module selection is wrong\n"); i_ReturnValue = -2; } return (i_ReturnValue); } - -INT i_APCI1710_InsnReadInterruptPulseEncoder(comedi_device *dev,comedi_subdevice *s, - comedi_insn *insn,lsampl_t *data) -{ - - data[0] = devpriv->s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Read].b_OldModuleMask; - data[1] = devpriv->s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Read].ul_OldInterruptMask; - data[2] = devpriv->s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Read].ul_OldCounterLatchValue; - - - /***************************/ - /* Increment the read FIFO */ - /***************************/ - - devpriv->s_InterruptParameters. - ui_Read = (devpriv-> - s_InterruptParameters.ui_Read + 1) % APCI1710_SAVE_INTERRUPT; - - return insn->n; - - -} - + +INT i_APCI1710_InsnReadInterruptPulseEncoder(comedi_device *dev,comedi_subdevice *s, + comedi_insn *insn,lsampl_t *data) +{ + + data[0] = devpriv->s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Read].b_OldModuleMask; + data[1] = devpriv->s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Read].ul_OldInterruptMask; + data[2] = devpriv->s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Read].ul_OldCounterLatchValue; + + + /***************************/ + /* Increment the read FIFO */ + /***************************/ + + devpriv->s_InterruptParameters. + ui_Read = (devpriv-> + s_InterruptParameters.ui_Read + 1) % APCI1710_SAVE_INTERRUPT; + + return insn->n; + + +} + diff --git a/comedi/drivers/addi-data/APCI1710_Inp_cpt.h b/comedi/drivers/addi-data/APCI1710_Inp_cpt.h index 7265a724..aa95b7d3 100644 --- a/comedi/drivers/addi-data/APCI1710_Inp_cpt.h +++ b/comedi/drivers/addi-data/APCI1710_Inp_cpt.h @@ -1,38 +1 @@ - - - - #define APCI1710_SINGLE 0 - #define APCI1710_CONTINUOUS 1 - - -#define APCI1710_PULSEENCODER_READ 0 -#define APCI1710_PULSEENCODER_WRITE 1 - - -INT i_APCI1710_InsnConfigInitPulseEncoder(comedi_device *dev,comedi_subdevice *s, - comedi_insn *insn,lsampl_t *data); - - - - -INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(comedi_device *dev,comedi_subdevice *s, - comedi_insn *insn,lsampl_t *data); -/* -+----------------------------------------------------------------------------+ -| READ PULSE ENCODER FUNCTIONS | -+----------------------------------------------------------------------------+ -*/ - -INT i_APCI1710_InsnReadInterruptPulseEncoder(comedi_device *dev,comedi_subdevice *s, - comedi_insn *insn,lsampl_t *data); - -/* -+----------------------------------------------------------------------------+ -| WRITE PULSE ENCODER FUNCTIONS | -+----------------------------------------------------------------------------+ -*/ - - INT i_APCI1710_InsnBitsReadWritePulseEncoder(comedi_device *dev,comedi_subdevice *s, - comedi_insn *insn,lsampl_t *data); - - +/** @verbatim Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. ADDI-DATA GmbH Dieselstrasse 3 D-77833 Ottersweier Tel: +19(0)7223/9493-0 Fax: +49(0)7223/9493-92 http://www.addi-data-com info@addi-data.com This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA You shoud also find the complete GPL in the COPYING file accompanying this source code. @endverbatim */ #define APCI1710_SINGLE 0 #define APCI1710_CONTINUOUS 1 #define APCI1710_PULSEENCODER_READ 0 #define APCI1710_PULSEENCODER_WRITE 1 INT i_APCI1710_InsnConfigInitPulseEncoder(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data); INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data); /* +----------------------------------------------------------------------------+ | READ PULSE ENCODER FUNCTIONS | +----------------------------------------------------------------------------+ */ INT i_APCI1710_InsnReadInterruptPulseEncoder(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data); /* +----------------------------------------------------------------------------+ | WRITE PULSE ENCODER FUNCTIONS | +----------------------------------------------------------------------------+ */ INT i_APCI1710_InsnBitsReadWritePulseEncoder(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data); \ No newline at end of file diff --git a/comedi/drivers/addi-data/APCI1710_Pwm.c b/comedi/drivers/addi-data/APCI1710_Pwm.c index 588dc35f..2423717a 100644 --- a/comedi/drivers/addi-data/APCI1710_Pwm.c +++ b/comedi/drivers/addi-data/APCI1710_Pwm.c @@ -1,18 +1,38 @@ - - - - +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ /* + +-----------------------------------------------------------------------+ | (C) ADDI-DATA GmbH Dieselstraße 3 D-77833 Ottersweier | +-----------------------------------------------------------------------+ | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | +-----------------------------------------------------------------------+ - | Project : API APCI1710 | Compiler : BORLANDC/MICROSOFT C | - | Module name : PWM.C | Version : 3.1 / 6.0 | + | Project : API APCI1710 | Compiler : gcc | + | Module name : PWM.C | Version : 2.96 | +-------------------------------+---------------------------------------+ - | Author : S.WEBER | Date : 22.01.99 | + | Project manager: Eric Stolz | Date : 02/12/2002 | +-----------------------------------------------------------------------+ | Description : APCI-1710 Wulse wide modulation module | | | @@ -29,2310 +49,2319 @@ /* +----------------------------------------------------------------------------+ -| Included files | +| Included files | ++----------------------------------------------------------------------------+ +*/ + + +#include "APCI1710_Pwm.h" + + + +/* ++----------------------------------------------------------------------------+ +| Function Name :INT i_APCI1710_InsnConfigPWM(comedi_device *dev, +comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Pwm Init and Get Pwm Initialisation | ++----------------------------------------------------------------------------+ +| Input Parameters : ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value : ++----------------------------------------------------------------------------+ +*/ + +INT i_APCI1710_InsnConfigPWM(comedi_device *dev,comedi_subdevice *s, +comedi_insn *insn,lsampl_t *data) +{ + BYTE b_ConfigType; + INT i_ReturnValue=0; + b_ConfigType=CR_CHAN(insn->chanspec); + + + switch(b_ConfigType) + { + case APCI1710_PWM_INIT : + i_ReturnValue=i_APCI1710_InitPWM (dev, + (BYTE)CR_AREF(insn->chanspec), // b_ModulNbr + (BYTE) data[0], //b_PWM + (BYTE) data[1], // b_ClockSelection + (BYTE) data[2], // b_TimingUnit + (ULONG)data[3], //ul_LowTiming + (ULONG)data[4], //ul_HighTiming + (PULONG)&data[0], //pul_RealLowTiming + (PULONG)&data[1] //pul_RealHighTiming + ); + break; + + case APCI1710_PWM_GETINITDATA : + i_ReturnValue=i_APCI1710_GetPWMInitialisation (dev, + (BYTE)CR_AREF(insn->chanspec), // b_ModulNbr + (BYTE) data[0], //b_PWM + (PBYTE)&data[0], //pb_TimingUnit + (PULONG)&data[1], //pul_LowTiming + (PULONG)&data[2], //pul_HighTiming + (PBYTE) &data[3], // pb_StartLevel + (PBYTE) &data[4], // pb_StopMode + (PBYTE) &data[5], // pb_StopLevel + (PBYTE) &data[6], // pb_ExternGate + (PBYTE) &data[7], // pb_InterruptEnable + (PBYTE) &data[8] // pb_Enable + ); + break; + + default: + printk(" Config Parameter Wrong\n"); + } + + if(i_ReturnValue>=0) i_ReturnValue =insn->n; + return (i_ReturnValue); +} + + + +/* ++----------------------------------------------------------------------------+ +| Function Name : _INT_ i_APCI1710_InitPWM | +| (BYTE_ b_BoardHandle, | +| BYTE_ b_ModulNbr, | +| BYTE_ b_PWM, | +| BYTE_ b_ClockSelection, | +| BYTE_ b_TimingUnit, | +| ULONG_ ul_LowTiming, | +| ULONG_ ul_HighTiming, | +| PULONG_ pul_RealLowTiming, | +| PULONG_ pul_RealHighTiming) | ++----------------------------------------------------------------------------+ +| Task : Configure the selected PWM (b_PWM) from selected module| +| (b_ModulNbr). The ul_LowTiming, ul_HighTiming and | +| ul_TimingUnit determine the low/high timing base for | +| the period. pul_RealLowTiming, pul_RealHighTiming | +| return the real timing value. | +| You must calling this function be for you call any | +| other function witch access of the PWM. | ++----------------------------------------------------------------------------+ +| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | +| BYTE_ b_ModulNbr : Module number to configure| +| (0 to 3) | +| BYTE_ b_PWM : Selected PWM (0 or 1). | +| BYTE_ b_ClockSelection : Selection from PCI bus | +| clock | +| - APCI1710_30MHZ : | +| The PC have a 30 MHz | +| PCI bus clock | +| - APCI1710_33MHZ : | +| The PC have a 33 MHz | +| PCI bus clock | +| - APCI1710_40MHZ | +| The APCI-1710 have a | +| integrated 40Mhz | +| quartz. | +| BYTE_ b_TimingUnit : Base timing Unit (0 to 4) | +| 0 : ns | +| 1 : æs | +| 2 : ms | +| 3 : s | +| 4 : mn | +| ULONG_ ul_LowTiming : Low base timing value. | +| ULONG_ ul_HighTiming : High base timing value. | ++----------------------------------------------------------------------------+ +| Output Parameters : PULONG_ pul_RealLowTiming : Real low base timing | +| value. | +| PULONG_ pul_RealHighTiming : Real high base timing | +| value. | ++----------------------------------------------------------------------------+ +| Return Value : 0: No error | +| -1: The handle parameter of the board is wrong | +| -2: Module selection wrong | +| -3: The module is not a PWM module | +| -4: PWM selection is wrong | +| -5: The selected input clock is wrong | +| -6: Timing Unit selection is wrong | +| -7: Low base timing selection is wrong | +| -8: High base timing selection is wrong | +| -9: You can not used the 40MHz clock selection with | +| this board | ++----------------------------------------------------------------------------+ +*/ + +INT i_APCI1710_InitPWM (comedi_device *dev, + BYTE b_ModulNbr, + BYTE b_PWM, + BYTE b_ClockSelection, + BYTE b_TimingUnit, + ULONG ul_LowTiming, + ULONG ul_HighTiming, + PULONG pul_RealLowTiming, + PULONG pul_RealHighTiming) + { + INT i_ReturnValue = 0; + ULONG ul_LowTimerValue = 0; + ULONG ul_HighTimerValue = 0; + DWORD dw_Command; + double d_RealLowTiming = 0; + double d_RealHighTiming = 0; + + + /**************************/ + /* Test the module number */ + /**************************/ + + if (b_ModulNbr < 4) + { + /***************/ + /* Test if PWM */ + /***************/ + + if ((devpriv-> + s_BoardInfos. + dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF0000UL) == APCI1710_PWM) + { + /**************************/ + /* Test the PWM selection */ + /**************************/ + + if (b_PWM <= 1) + { + /******************/ + /* Test the clock */ + /******************/ + + if ((b_ClockSelection == APCI1710_30MHZ) || + (b_ClockSelection == APCI1710_33MHZ) || + (b_ClockSelection == APCI1710_40MHZ)) + { + /************************/ + /* Test the timing unit */ + /************************/ + + if (b_TimingUnit <= 4) + { + /*********************************/ + /* Test the low timing selection */ + /*********************************/ + + if (((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 0) && (ul_LowTiming >= 266) && (ul_LowTiming <= 0xFFFFFFFFUL)) || + ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 1) && (ul_LowTiming >= 1) && (ul_LowTiming <= 571230650UL)) || + ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 2) && (ul_LowTiming >= 1) && (ul_LowTiming <= 571230UL)) || + ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 3) && (ul_LowTiming >= 1) && (ul_LowTiming <= 571UL)) || + ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 4) && (ul_LowTiming >= 1) && (ul_LowTiming <= 9UL)) || + ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 0) && (ul_LowTiming >= 242) && (ul_LowTiming <= 0xFFFFFFFFUL)) || + ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 1) && (ul_LowTiming >= 1) && (ul_LowTiming <= 519691043UL)) || + ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 2) && (ul_LowTiming >= 1) && (ul_LowTiming <= 519691UL)) || + ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 3) && (ul_LowTiming >= 1) && (ul_LowTiming <= 520UL)) || + ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 4) && (ul_LowTiming >= 1) && (ul_LowTiming <= 8UL)) || + ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 0) && (ul_LowTiming >= 200) && (ul_LowTiming <= 0xFFFFFFFFUL)) || + ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 1) && (ul_LowTiming >= 1) && (ul_LowTiming <= 429496729UL)) || + ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 2) && (ul_LowTiming >= 1) && (ul_LowTiming <= 429496UL)) || + ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 3) && (ul_LowTiming >= 1) && (ul_LowTiming <= 429UL)) || + ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 4) && (ul_LowTiming >= 1) && (ul_LowTiming <= 7UL))) + { + /**********************************/ + /* Test the High timing selection */ + /**********************************/ + + if (((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 266) && (ul_HighTiming <= 0xFFFFFFFFUL)) || + ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571230650UL)) || + ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571230UL)) || + ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571UL)) || + ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 9UL)) || + ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 242) && (ul_HighTiming <= 0xFFFFFFFFUL)) || + ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 519691043UL)) || + ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 519691UL)) || + ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 520UL)) || + ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 8UL)) || + ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 200) && (ul_HighTiming <= 0xFFFFFFFFUL)) || + ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429496729UL)) || + ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429496UL)) || + ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429UL)) || + ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 7UL))) + { + /**************************/ + /* Test the board version */ + /**************************/ + + if (((b_ClockSelection == APCI1710_40MHZ) && (devpriv-> + s_BoardInfos. + b_BoardVersion > 0)) || + (b_ClockSelection != APCI1710_40MHZ)) + { + + /************************************/ + /* Calculate the low division fator */ + /************************************/ + + fpu_begin (); + + switch (b_TimingUnit) + { + /******/ + /* ns */ + /******/ + + case 0: + + /******************/ + /* Timer 0 factor */ + /******************/ + + ul_LowTimerValue = (ULONG) (ul_LowTiming * (0.00025 * b_ClockSelection)); + + /*******************/ + /* Round the value */ + /*******************/ + + if ((double) ((double) ul_LowTiming * (0.00025 * (double) b_ClockSelection)) >= ((double) ((double) ul_LowTimerValue + 0.5))) + { + ul_LowTimerValue = ul_LowTimerValue + 1; + } + + /*****************************/ + /* Calculate the real timing */ + /*****************************/ + + *pul_RealLowTiming = (ULONG) (ul_LowTimerValue / (0.00025 * (double) b_ClockSelection)); + d_RealLowTiming = (double) ul_LowTimerValue / (0.00025 * (double) b_ClockSelection); + + if ((double) ((double) ul_LowTimerValue / (0.00025 * (double) b_ClockSelection)) >= (double) ((double) *pul_RealLowTiming + 0.5)) + { + *pul_RealLowTiming = *pul_RealLowTiming + 1; + } + + ul_LowTiming = ul_LowTiming - 1; + ul_LowTimerValue = ul_LowTimerValue - 2; + + if (b_ClockSelection != APCI1710_40MHZ) + { + ul_LowTimerValue = (ULONG) ((double) (ul_LowTimerValue) * 1.007752288); + } + + + break; + + /******/ + /* æs */ + /******/ + + case 1: + + /******************/ + /* Timer 0 factor */ + /******************/ + + ul_LowTimerValue = (ULONG) (ul_LowTiming * (0.25 * b_ClockSelection)); + + /*******************/ + /* Round the value */ + /*******************/ + + if ((double) ((double) ul_LowTiming * (0.25 * (double) b_ClockSelection)) >= ((double) ((double) ul_LowTimerValue + 0.5))) + { + ul_LowTimerValue = ul_LowTimerValue + 1; + } + + /*****************************/ + /* Calculate the real timing */ + /*****************************/ + + *pul_RealLowTiming = (ULONG) (ul_LowTimerValue / (0.25 * (double) b_ClockSelection)); + d_RealLowTiming = (double) ul_LowTimerValue / ((double) 0.25 * (double) b_ClockSelection); + + if ((double) ((double) ul_LowTimerValue / (0.25 * (double) b_ClockSelection)) >= (double) ((double) *pul_RealLowTiming + 0.5)) + { + *pul_RealLowTiming = *pul_RealLowTiming + 1; + } + + ul_LowTiming = ul_LowTiming - 1; + ul_LowTimerValue = ul_LowTimerValue - 2; + + if (b_ClockSelection != APCI1710_40MHZ) + { + ul_LowTimerValue = (ULONG) ((double) (ul_LowTimerValue) * 1.007752288); + } + + + break; + + /******/ + /* ms */ + /******/ + + case 2: + + /******************/ + /* Timer 0 factor */ + /******************/ + + ul_LowTimerValue = ul_LowTiming * (250.0 * b_ClockSelection); + + /*******************/ + /* Round the value */ + /*******************/ + + if ((double) ((double) ul_LowTiming * (250.0 * (double) b_ClockSelection)) >= ((double) ((double) ul_LowTimerValue + 0.5))) + { + ul_LowTimerValue = ul_LowTimerValue + 1; + } + + /*****************************/ + /* Calculate the real timing */ + /*****************************/ + + *pul_RealLowTiming = (ULONG) (ul_LowTimerValue / (250.0 * (double) b_ClockSelection)); + d_RealLowTiming = (double) ul_LowTimerValue / (250.0 * (double) b_ClockSelection); + + if ((double) ((double) ul_LowTimerValue / (250.0 * (double) b_ClockSelection)) >= (double) ((double) *pul_RealLowTiming + 0.5)) + { + *pul_RealLowTiming = *pul_RealLowTiming + 1; + } + + ul_LowTiming = ul_LowTiming - 1; + ul_LowTimerValue = ul_LowTimerValue - 2; + + if (b_ClockSelection != APCI1710_40MHZ) + { + ul_LowTimerValue = (ULONG) ((double) (ul_LowTimerValue) * 1.007752288); + } + + break; + + /*****/ + /* s */ + /*****/ + + case 3: + /******************/ + /* Timer 0 factor */ + /******************/ + + ul_LowTimerValue = (ULONG) (ul_LowTiming * (250000.0 * b_ClockSelection)); + + /*******************/ + /* Round the value */ + /*******************/ + + if ((double) ((double) ul_LowTiming * (250000.0 * (double) b_ClockSelection)) >= ((double) ((double) ul_LowTimerValue + 0.5))) + { + ul_LowTimerValue = ul_LowTimerValue + 1; + } + + /*****************************/ + /* Calculate the real timing */ + /*****************************/ + + *pul_RealLowTiming = (ULONG) (ul_LowTimerValue / (250000.0 * (double) b_ClockSelection)); + d_RealLowTiming = (double) ul_LowTimerValue / (250000.0 * (double) b_ClockSelection); + + if ((double) ((double) ul_LowTimerValue / (250000.0 * (double) b_ClockSelection)) >= (double) ((double) *pul_RealLowTiming + 0.5)) + { + *pul_RealLowTiming = *pul_RealLowTiming + 1; + } + + ul_LowTiming = ul_LowTiming - 1; + ul_LowTimerValue = ul_LowTimerValue - 2; + + if (b_ClockSelection != APCI1710_40MHZ) + { + ul_LowTimerValue = (ULONG) ((double) (ul_LowTimerValue) * 1.007752288); + } + + + break; + + /******/ + /* mn */ + /******/ + + case 4: + + /******************/ + /* Timer 0 factor */ + /******************/ + + ul_LowTimerValue = (ULONG) ((ul_LowTiming * 60) * (250000.0 * b_ClockSelection)); + + /*******************/ + /* Round the value */ + /*******************/ + + if ((double) ((double) (ul_LowTiming * 60.0) * (250000.0 * (double) b_ClockSelection)) >= ((double) ((double) ul_LowTimerValue + 0.5))) + { + ul_LowTimerValue = ul_LowTimerValue + 1; + } + + /*****************************/ + /* Calculate the real timing */ + /*****************************/ + + *pul_RealLowTiming = (ULONG) (ul_LowTimerValue / (250000.0 * (double) b_ClockSelection)) / 60; + d_RealLowTiming = ((double) ul_LowTimerValue / (250000.0 * (double) b_ClockSelection)) / 60.0; + + if ((double) (((double) ul_LowTimerValue / (250000.0 * (double) b_ClockSelection)) / 60.0) >= (double) ((double) *pul_RealLowTiming + 0.5)) + { + *pul_RealLowTiming = *pul_RealLowTiming + 1; + } + + ul_LowTiming = ul_LowTiming - 1; + ul_LowTimerValue = ul_LowTimerValue - 2; + + if (b_ClockSelection != APCI1710_40MHZ) + { + ul_LowTimerValue = (ULONG) ((double) (ul_LowTimerValue) * 1.007752288); + } + + break; + } + + /*************************************/ + /* Calculate the high division fator */ + /*************************************/ + + switch (b_TimingUnit) + { + /******/ + /* ns */ + /******/ + + case 0: + + /******************/ + /* Timer 0 factor */ + /******************/ + + ul_HighTimerValue = (ULONG) (ul_HighTiming * (0.00025 * b_ClockSelection)); + + /*******************/ + /* Round the value */ + /*******************/ + + if ((double) ((double) ul_HighTiming * (0.00025 * (double) b_ClockSelection)) >= ((double) ((double) ul_HighTimerValue + 0.5))) + { + ul_HighTimerValue = ul_HighTimerValue + 1; + } + + /*****************************/ + /* Calculate the real timing */ + /*****************************/ + + *pul_RealHighTiming = (ULONG) (ul_HighTimerValue / (0.00025 * (double) b_ClockSelection)); + d_RealHighTiming = (double) ul_HighTimerValue / (0.00025 * (double) b_ClockSelection); + + if ((double) ((double) ul_HighTimerValue / (0.00025 * (double) b_ClockSelection)) >= (double) ((double) *pul_RealHighTiming + 0.5)) + { + *pul_RealHighTiming = *pul_RealHighTiming + 1; + } + + ul_HighTiming = ul_HighTiming - 1; + ul_HighTimerValue = ul_HighTimerValue - 2; + + if (b_ClockSelection != APCI1710_40MHZ) + { + ul_HighTimerValue = (ULONG) ((double) (ul_HighTimerValue) * 1.007752288); + } + + + break; + + /******/ + /* æs */ + /******/ + + case 1: + + /******************/ + /* Timer 0 factor */ + /******************/ + + ul_HighTimerValue = (ULONG) (ul_HighTiming * (0.25 * b_ClockSelection)); + + /*******************/ + /* Round the value */ + /*******************/ + + if ((double) ((double) ul_HighTiming * (0.25 * (double) b_ClockSelection)) >= ((double) ((double) ul_HighTimerValue + 0.5))) + { + ul_HighTimerValue = ul_HighTimerValue + 1; + } + + /*****************************/ + /* Calculate the real timing */ + /*****************************/ + + *pul_RealHighTiming = (ULONG) (ul_HighTimerValue / (0.25 * (double) b_ClockSelection)); + d_RealHighTiming = (double) ul_HighTimerValue / ((double) 0.25 * (double) b_ClockSelection); + + if ((double) ((double) ul_HighTimerValue / (0.25 * (double) b_ClockSelection)) >= (double) ((double) *pul_RealHighTiming + 0.5)) + { + *pul_RealHighTiming = *pul_RealHighTiming + 1; + } + + ul_HighTiming = ul_HighTiming - 1; + ul_HighTimerValue = ul_HighTimerValue - 2; + + if (b_ClockSelection != APCI1710_40MHZ) + { + ul_HighTimerValue = (ULONG) ((double) (ul_HighTimerValue) * 1.007752288); + } + + + break; + + /******/ + /* ms */ + /******/ + + case 2: + + /******************/ + /* Timer 0 factor */ + /******************/ + + ul_HighTimerValue = ul_HighTiming * (250.0 * b_ClockSelection); + + /*******************/ + /* Round the value */ + /*******************/ + + if ((double) ((double) ul_HighTiming * (250.0 * (double) b_ClockSelection)) >= ((double) ((double) ul_HighTimerValue + 0.5))) + { + ul_HighTimerValue = ul_HighTimerValue + 1; + } + + /*****************************/ + /* Calculate the real timing */ + /*****************************/ + + *pul_RealHighTiming = (ULONG) (ul_HighTimerValue / (250.0 * (double) b_ClockSelection)); + d_RealHighTiming = (double) ul_HighTimerValue / (250.0 * (double) b_ClockSelection); + + if ((double) ((double) ul_HighTimerValue / (250.0 * (double) b_ClockSelection)) >= (double) ((double) *pul_RealHighTiming + 0.5)) + { + *pul_RealHighTiming = *pul_RealHighTiming + 1; + } + + ul_HighTiming = ul_HighTiming - 1; + ul_HighTimerValue = ul_HighTimerValue - 2; + + if (b_ClockSelection != APCI1710_40MHZ) + { + ul_HighTimerValue = (ULONG) ((double) (ul_HighTimerValue) * 1.007752288); + } + + + break; + + /*****/ + /* s */ + /*****/ + + case 3: + + /******************/ + /* Timer 0 factor */ + /******************/ + + ul_HighTimerValue = (ULONG) (ul_HighTiming * (250000.0 * b_ClockSelection)); + + /*******************/ + /* Round the value */ + /*******************/ + + if ((double) ((double) ul_HighTiming * (250000.0 * (double) b_ClockSelection)) >= ((double) ((double) ul_HighTimerValue + 0.5))) + { + ul_HighTimerValue = ul_HighTimerValue + 1; + } + + /*****************************/ + /* Calculate the real timing */ + /*****************************/ + + *pul_RealHighTiming = (ULONG) (ul_HighTimerValue / (250000.0 * (double) b_ClockSelection)); + d_RealHighTiming = (double) ul_HighTimerValue / (250000.0 * (double) b_ClockSelection); + + if ((double) ((double) ul_HighTimerValue / (250000.0 * (double) b_ClockSelection)) >= (double) ((double) *pul_RealHighTiming + 0.5)) + { + *pul_RealHighTiming = *pul_RealHighTiming + 1; + } + + ul_HighTiming = ul_HighTiming - 1; + ul_HighTimerValue = ul_HighTimerValue - 2; + + if (b_ClockSelection != APCI1710_40MHZ) + { + ul_HighTimerValue = (ULONG) ((double) (ul_HighTimerValue) * 1.007752288); + } + + + break; + + /******/ + /* mn */ + /******/ + + case 4: + + /******************/ + /* Timer 0 factor */ + /******************/ + + ul_HighTimerValue = (ULONG) ((ul_HighTiming * 60) * (250000.0 * b_ClockSelection)); + + /*******************/ + /* Round the value */ + /*******************/ + + if ((double) ((double) (ul_HighTiming * 60.0) * (250000.0 * (double) b_ClockSelection)) >= ((double) ((double) ul_HighTimerValue + 0.5))) + { + ul_HighTimerValue = ul_HighTimerValue + 1; + } + + /*****************************/ + /* Calculate the real timing */ + /*****************************/ + + *pul_RealHighTiming = (ULONG) (ul_HighTimerValue / (250000.0 * (double) b_ClockSelection)) / 60; + d_RealHighTiming = ((double) ul_HighTimerValue / (250000.0 * (double) b_ClockSelection)) / 60.0; + + if ((double) (((double) ul_HighTimerValue / (250000.0 * (double) b_ClockSelection)) / 60.0) >= (double) ((double) *pul_RealHighTiming + 0.5)) + { + *pul_RealHighTiming = *pul_RealHighTiming + 1; + } + + ul_HighTiming = ul_HighTiming - 1; + ul_HighTimerValue = ul_HighTimerValue - 2; + + if (b_ClockSelection != APCI1710_40MHZ) + { + ul_HighTimerValue = (ULONG) ((double) (ul_HighTimerValue) * 1.007752288); + } + + break; + } + + fpu_end (); + /****************************/ + /* Save the clock selection */ + /****************************/ + + devpriv-> + s_ModuleInfo [b_ModulNbr]. + s_PWMModuleInfo. + b_ClockSelection = b_ClockSelection; + + /************************/ + /* Save the timing unit */ + /************************/ + + devpriv-> + s_ModuleInfo [b_ModulNbr]. + s_PWMModuleInfo. + s_PWMInfo [b_PWM]. + b_TimingUnit = b_TimingUnit; + + /****************************/ + /* Save the low base timing */ + /****************************/ + + devpriv-> + s_ModuleInfo [b_ModulNbr]. + s_PWMModuleInfo. + s_PWMInfo [b_PWM]. + d_LowTiming = d_RealLowTiming; + + devpriv-> + s_ModuleInfo [b_ModulNbr]. + s_PWMModuleInfo. + s_PWMInfo [b_PWM]. + ul_RealLowTiming = *pul_RealLowTiming; + + /****************************/ + /* Save the high base timing */ + /****************************/ + + devpriv-> + s_ModuleInfo [b_ModulNbr]. + s_PWMModuleInfo. + s_PWMInfo [b_PWM]. + d_HighTiming = d_RealHighTiming; + + devpriv-> + s_ModuleInfo [b_ModulNbr]. + s_PWMModuleInfo. + s_PWMInfo [b_PWM]. + ul_RealHighTiming = *pul_RealHighTiming; + + /************************/ + /* Write the low timing */ + /************************/ + + outl(ul_LowTimerValue,devpriv->s_BoardInfos. + ui_Address + 0 + (20 * b_PWM) + (64 * b_ModulNbr)); + + /*************************/ + /* Write the high timing */ + /*************************/ + + outl(ul_HighTimerValue,devpriv->s_BoardInfos. + ui_Address + 4 + (20 * b_PWM) + (64 * b_ModulNbr)); + + /***************************/ + /* Set the clock selection */ + /***************************/ + + dw_Command=inl(devpriv->s_BoardInfos. + ui_Address + 8 + (20 * b_PWM) + (64 * b_ModulNbr)); + + dw_Command = dw_Command & 0x7F; + + if (b_ClockSelection == APCI1710_40MHZ) + { + dw_Command = dw_Command | 0x80; + } + + /***************************/ + /* Set the clock selection */ + /***************************/ + + outl(dw_Command,devpriv->s_BoardInfos. + ui_Address + 8 + (20 * b_PWM) + (64 * b_ModulNbr)); + + /*************/ + /* PWM init. */ + /*************/ + devpriv-> + s_ModuleInfo [b_ModulNbr]. + s_PWMModuleInfo. + s_PWMInfo [b_PWM]. + b_PWMInit = 1; + } + else + { + /***************************************************/ + /* You can not used the 40MHz clock selection with */ + /* this board */ + /***************************************************/ + DPRINTK("You can not used the 40MHz clock selection with this board\n"); + i_ReturnValue = -9; + } + } + else + { + /***************************************/ + /* High base timing selection is wrong */ + /***************************************/ + DPRINTK("High base timing selection is wrong\n"); + i_ReturnValue = -8; + } + } + else + { + /**************************************/ + /* Low base timing selection is wrong */ + /**************************************/ + DPRINTK("Low base timing selection is wrong\n"); + i_ReturnValue = -7; + } + } // if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) + else + { + /**********************************/ + /* Timing unit selection is wrong */ + /**********************************/ + DPRINTK("Timing unit selection is wrong\n"); + i_ReturnValue = -6; + } // if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) + } // if ((b_ClockSelection == APCI1710_30MHZ) || (b_ClockSelection == APCI1710_33MHZ) || (b_ClockSelection == APCI1710_40MHZ)) + else + { + /*******************************/ + /* The selected clock is wrong */ + /*******************************/ + DPRINTK("The selected clock is wrong\n"); + i_ReturnValue = -5; + } // if ((b_ClockSelection == APCI1710_30MHZ) || (b_ClockSelection == APCI1710_33MHZ) || (b_ClockSelection == APCI1710_40MHZ)) + } // if (b_PWM >= 0 && b_PWM <= 1) + else + { + /******************************/ + /* Tor PWM selection is wrong */ + /******************************/ + DPRINTK("Tor PWM selection is wrong\n"); + i_ReturnValue = -4; + } // if (b_PWM >= 0 && b_PWM <= 1) + } + else + { + /**********************************/ + /* The module is not a PWM module */ + /**********************************/ + DPRINTK("The module is not a PWM module\n"); + i_ReturnValue = -3; + } + } + else + { + /***********************/ + /* Module number error */ + /***********************/ + DPRINTK("Module number error\n"); + i_ReturnValue = -2; + } + + return (i_ReturnValue); + } + + + +/* ++----------------------------------------------------------------------------+ +| Function Name : _INT_ i_APCI1710_GetPWMInitialisation | +| (BYTE_ b_BoardHandle, | +| BYTE_ b_ModulNbr, | +| BYTE_ b_PWM, | +| PBYTE_ pb_TimingUnit, | +| PULONG_ pul_LowTiming, | +| PULONG_ pul_HighTiming, | +| PBYTE_ pb_StartLevel, | +| PBYTE_ pb_StopMode, | +| PBYTE_ pb_StopLevel, | +| PBYTE_ pb_ExternGate, | +| PBYTE_ pb_InterruptEnable, | +| PBYTE_ pb_Enable) | ++----------------------------------------------------------------------------+ +| Task : Return the PWM (b_PWM) initialisation from selected | +| module (b_ModulNbr). You must calling the | +| "i_APCI1710_InitPWM" function be for you call this | +| function. | ++----------------------------------------------------------------------------+ +| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | +| BYTE_ b_ModulNbr : Selected module number (0 to 3) | +| BYTE_ b_PWM : Selected PWM (0 or 1) | ++----------------------------------------------------------------------------+ +| Output Parameters : PBYTE_ pb_TimingUnit : Base timing Unit (0 to 4) | +| 0 : ns | +| 1 : æs | +| 2 : ms | +| 3 : s | +| 4 : mn | +| PULONG_ pul_LowTiming : Low base timing value. | +| PULONG_ pul_HighTiming : High base timing value. | +| PBYTE_ pb_StartLevel : Start period level | +| selection | +| 0 : The period start | +| with a low level | +| 1 : The period start | +| with a high level| +| PBYTE_ pb_StopMode : Stop mode selection | +| 0 : The PWM is stopped | +| directly after the | +| "i_APCI1710_DisablePWM"| +| function and break the| +| last period | +| 1 : After the | +| "i_APCI1710_DisablePWM"| +| function the PWM is | +| stopped at the end | +| from last period cycle| +| PBYTE_ pb_StopLevel : Stop PWM level selection | +| 0 : The output signal | +| keep the level after| +| the | +| "i_APCI1710_DisablePWM"| +| function | +| 1 : The output signal is| +| set to low after the| +| "i_APCI1710_DisablePWM"| +| function | +| 2 : The output signal is| +| set to high after | +| the | +| "i_APCI1710_DisablePWM"| +| function | +| PBYTE_ pb_ExternGate : Extern gate action | +| selection | +| 0 : Extern gate signal | +| not used. | +| 1 : Extern gate signal | +| used. | +| PBYTE_ pb_InterruptEnable : Enable or disable the PWM | +| interrupt. | +| - APCI1710_ENABLE : | +| Enable the PWM interrupt| +| A interrupt occur after | +| each period | +| - APCI1710_DISABLE : | +| Disable the PWM | +| interrupt | +| PBYTE_ pb_Enable : Indicate if the PWM is | +| enabled or no | +| 0 : PWM not enabled | +| 1 : PWM enabled | ++----------------------------------------------------------------------------+ +| Return Value : 0: No error | +| -1: The handle parameter of the board is wrong | +| -2: Module selection wrong | +| -3: The module is not a PWM module | +| -4: PWM selection is wrong | +| -5: PWM not initialised see function | +| "i_APCI1710_InitPWM" | ++----------------------------------------------------------------------------+ +*/ + +INT i_APCI1710_GetPWMInitialisation (comedi_device *dev, + BYTE b_ModulNbr, + BYTE b_PWM, + PBYTE pb_TimingUnit, + PULONG pul_LowTiming, + PULONG pul_HighTiming, + PBYTE pb_StartLevel, + PBYTE pb_StopMode, + PBYTE pb_StopLevel, + PBYTE pb_ExternGate, + PBYTE pb_InterruptEnable, + PBYTE pb_Enable) + { + INT i_ReturnValue = 0; + DWORD dw_Status; + DWORD dw_Command; + + + + /**************************/ + /* Test the module number */ + /**************************/ + + if (b_ModulNbr < 4) + { + /***************/ + /* Test if PWM */ + /***************/ + + if ((devpriv-> + s_BoardInfos. + dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF0000UL) == APCI1710_PWM) + { + /**************************/ + /* Test the PWM selection */ + /**************************/ + + if (b_PWM <= 1) + { + /***************************/ + /* Test if PWM initialised */ + /***************************/ + + dw_Status=inl(devpriv->s_BoardInfos. + ui_Address + 12 + (20 * b_PWM) + (64 * b_ModulNbr)); + + if (dw_Status & 0x10) + { + /***********************/ + /* Read the low timing */ + /***********************/ + + *pul_LowTiming = inl(devpriv->s_BoardInfos. + ui_Address + 0 + (20 * b_PWM) + (64 * b_ModulNbr)); + + /************************/ + /* Read the high timing */ + /************************/ + + *pul_HighTiming= inl(devpriv->s_BoardInfos. + ui_Address + 4 + (20 * b_PWM) + (64 * b_ModulNbr)); + + /********************/ + /* Read the command */ + /********************/ + + dw_Command = inl(devpriv->s_BoardInfos. + ui_Address + 8 + (20 * b_PWM) + (64 * b_ModulNbr)); + + *pb_StartLevel = (BYTE) ((dw_Command >> 5) & 1); + *pb_StopMode = (BYTE) ((dw_Command >> 0) & 1); + *pb_StopLevel = (BYTE) ((dw_Command >> 1) & 1); + *pb_ExternGate = (BYTE) ((dw_Command >> 4) & 1); + *pb_InterruptEnable = (BYTE) ((dw_Command >> 3) & 1); + + if (*pb_StopLevel) + { + *pb_StopLevel = *pb_StopLevel + (BYTE) ((dw_Command >> 2) & 1); + } + + /********************/ + /* Read the command */ + /********************/ + + dw_Command=inl(devpriv->s_BoardInfos. + ui_Address + 8 + (20 * b_PWM) + (64 * b_ModulNbr)); + + *pb_Enable = (BYTE) ((dw_Command >> 0) & 1); + + *pb_TimingUnit = devpriv-> + s_ModuleInfo [b_ModulNbr]. + s_PWMModuleInfo. + s_PWMInfo [b_PWM]. + b_TimingUnit; + } // if (dw_Status & 0x10) + else + { + /***********************/ + /* PWM not initialised */ + /***********************/ + DPRINTK("PWM not initialised\n"); + i_ReturnValue = -5; + } // if (dw_Status & 0x10) + } // if (b_PWM >= 0 && b_PWM <= 1) + else + { + /******************************/ + /* Tor PWM selection is wrong */ + /******************************/ + DPRINTK("Tor PWM selection is wrong\n"); + i_ReturnValue = -4; + } // if (b_PWM >= 0 && b_PWM <= 1) + } + else + { + /**********************************/ + /* The module is not a PWM module */ + /**********************************/ + DPRINTK("The module is not a PWM module\n"); + i_ReturnValue = -3; + } + } + else + { + /***********************/ + /* Module number error */ + /***********************/ + DPRINTK("Module number error\n"); + i_ReturnValue = -2; + } + + return (i_ReturnValue); + } + + + + + +/* ++----------------------------------------------------------------------------+ +| Function Name :INT i_APCI1710_InsnWritePWM(comedi_device *dev, +comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Pwm Enable Disable and Set New Timing | ++----------------------------------------------------------------------------+ +| Input Parameters : ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value : ++----------------------------------------------------------------------------+ +*/ + +INT i_APCI1710_InsnWritePWM(comedi_device *dev,comedi_subdevice *s, +comedi_insn *insn,lsampl_t *data) +{ + BYTE b_WriteType; + INT i_ReturnValue=0; + b_WriteType=CR_CHAN(insn->chanspec); + + + switch(b_WriteType) + { + case APCI1710_PWM_ENABLE : + i_ReturnValue=i_APCI1710_EnablePWM (dev, + (BYTE) CR_AREF(insn->chanspec), + (BYTE) data[0], + (BYTE) data[1], + (BYTE) data[2], + (BYTE) data[3], + (BYTE) data[4], + (BYTE) data[5]); + break; + + case APCI1710_PWM_DISABLE : + i_ReturnValue=i_APCI1710_DisablePWM (dev, + (BYTE) CR_AREF(insn->chanspec), + (BYTE) data[0]); + break; + + case APCI1710_PWM_NEWTIMING: + i_ReturnValue=i_APCI1710_SetNewPWMTiming (dev, + (BYTE) CR_AREF(insn->chanspec), + (BYTE) data[0], + (BYTE) data[1], + (ULONG) data[2], + (ULONG) data[3]); + break; + + + default: + printk("Write Config Parameter Wrong\n"); + } + + if(i_ReturnValue>=0) i_ReturnValue =insn->n; + return (i_ReturnValue); +} + + + + + +/* ++----------------------------------------------------------------------------+ +| Function Name : _INT_ i_APCI1710_EnablePWM | +| (BYTE_ b_BoardHandle, | +| BYTE_ b_ModulNbr, | +| BYTE_ b_PWM, | +| BYTE_ b_StartLevel, | +| BYTE_ b_StopMode, | +| BYTE_ b_StopLevel, | +| BYTE_ b_ExternGate, | +| BYTE_ b_InterruptEnable) | ++----------------------------------------------------------------------------+ +| Task : Enable the selected PWM (b_PWM) from selected module | +| (b_ModulNbr). You must calling the "i_APCI1710_InitPWM"| +| function be for you call this function. | +| If you enable the PWM interrupt, the PWM generate a | +| interrupt after each period. | +| See function "i_APCI1710_SetBoardIntRoutineX" and the | +| Interrupt mask description chapter. | ++----------------------------------------------------------------------------+ +| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | +| BYTE_ b_ModulNbr : Selected module number | +| (0 to 3) | +| BYTE_ b_PWM : Selected PWM (0 or 1) | +| BYTE_ b_StartLevel : Start period level selection | +| 0 : The period start with a | +| low level | +| 1 : The period start with a | +| high level | +| BYTE_ b_StopMode : Stop mode selection | +| 0 : The PWM is stopped | +| directly after the | +| "i_APCI1710_DisablePWM" | +| function and break the | +| last period | +| 1 : After the | +| "i_APCI1710_DisablePWM" | +| function the PWM is | +| stopped at the end from| +| last period cycle. | +| BYTE_ b_StopLevel : Stop PWM level selection | +| 0 : The output signal keep | +| the level after the | +| "i_APCI1710_DisablePWM" | +| function | +| 1 : The output signal is set| +| to low after the | +| "i_APCI1710_DisablePWM" | +| function | +| 2 : The output signal is set| +| to high after the | +| "i_APCI1710_DisablePWM" | +| function | +| BYTE_ b_ExternGate : Extern gate action selection | +| 0 : Extern gate signal not | +| used. | +| 1 : Extern gate signal used.| +| BYTE_ b_InterruptEnable : Enable or disable the PWM | +| interrupt. | +| - APCI1710_ENABLE : | +| Enable the PWM interrupt | +| A interrupt occur after | +| each period | +| - APCI1710_DISABLE : | +| Disable the PWM interrupt | ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value : 0: No error | +| -1: The handle parameter of the board is wrong | +| -2: Module selection wrong | +| -3: The module is not a PWM module | +| -4: PWM selection is wrong | +| -5: PWM not initialised see function | +| "i_APCI1710_InitPWM" | +| -6: PWM start level selection is wrong | +| -7: PWM stop mode selection is wrong | +| -8: PWM stop level selection is wrong | +| -9: Extern gate signal selection is wrong | +| -10: Interrupt parameter is wrong | +| -11: Interrupt function not initialised. | +| See function "i_APCI1710_SetBoardIntRoutineX" | ++----------------------------------------------------------------------------+ +*/ + +INT i_APCI1710_EnablePWM (comedi_device *dev, + BYTE b_ModulNbr, + BYTE b_PWM, + BYTE b_StartLevel, + BYTE b_StopMode, + BYTE b_StopLevel, + BYTE b_ExternGate, + BYTE b_InterruptEnable) + { + INT i_ReturnValue = 0; + DWORD dw_Status; + DWORD dw_Command; + + + devpriv->tsk_Current=current; // Save the current process task structure + /**************************/ + /* Test the module number */ + /**************************/ + + if (b_ModulNbr < 4) + { + /***************/ + /* Test if PWM */ + /***************/ + + if ((devpriv-> + s_BoardInfos. + dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF0000UL) == APCI1710_PWM) + { + /**************************/ + /* Test the PWM selection */ + /**************************/ + + if (b_PWM <= 1) + { + /***************************/ + /* Test if PWM initialised */ + /***************************/ + + dw_Status= inl(devpriv->s_BoardInfos. + ui_Address + 12 + (20 * b_PWM) + (64 * b_ModulNbr)); + + if (dw_Status & 0x10) + { + /**********************************/ + /* Test the start level selection */ + /**********************************/ + + if (b_StartLevel <= 1) + { + /**********************/ + /* Test the stop mode */ + /**********************/ + + if (b_StopMode <= 1) + { + /***********************/ + /* Test the stop level */ + /***********************/ + + if (b_StopLevel <= 2) + { + /*****************************/ + /* Test the extern gate mode */ + /*****************************/ + + if (b_ExternGate <= 1) + { + /*****************************/ + /* Test the interrupt action */ + /*****************************/ + + if (b_InterruptEnable == APCI1710_ENABLE || b_InterruptEnable == APCI1710_DISABLE) + { + /******************************************/ + /* Test if interrupt function initialised */ + /******************************************/ + + /********************/ + /* Read the command */ + /********************/ + + dw_Command=inl(devpriv->s_BoardInfos. + ui_Address + 8 + (20 * b_PWM) + (64 * b_ModulNbr)); + + dw_Command = dw_Command & 0x80; + + /********************/ + /* Make the command */ + /********************/ + + dw_Command = dw_Command | b_StopMode | (b_InterruptEnable << 3) | (b_ExternGate << 4) | (b_StartLevel << 5); + + if (b_StopLevel & 3) + { + dw_Command = dw_Command | 2; + + if (b_StopLevel & 2) + { + dw_Command = dw_Command | 4; + } + } + + + devpriv-> + s_ModuleInfo [b_ModulNbr]. + s_PWMModuleInfo. + s_PWMInfo [b_PWM]. + b_InterruptEnable = b_InterruptEnable; + + /*******************/ + /* Set the command */ + /*******************/ + + outl(dw_Command,devpriv->s_BoardInfos. + ui_Address + 8 + (20 * b_PWM) + (64 * b_ModulNbr)); + + /******************/ + /* Enable the PWM */ + /******************/ + outl(1,devpriv->s_BoardInfos. + ui_Address + 12 + (20 * b_PWM) + (64 * b_ModulNbr)); + } // if (b_InterruptEnable == APCI1710_ENABLE || b_InterruptEnable == APCI1710_DISABLE) + else + { + /********************************/ + /* Interrupt parameter is wrong */ + /********************************/ + DPRINTK("Interrupt parameter is wrong\n"); + i_ReturnValue = -10; + } // if (b_InterruptEnable == APCI1710_ENABLE || b_InterruptEnable == APCI1710_DISABLE) + } // if (b_ExternGate >= 0 && b_ExternGate <= 1) + else + { + /*****************************************/ + /* Extern gate signal selection is wrong */ + /*****************************************/ + DPRINTK("Extern gate signal selection is wrong\n"); + i_ReturnValue = -9; + } // if (b_ExternGate >= 0 && b_ExternGate <= 1) + } // if (b_StopLevel >= 0 && b_StopLevel <= 2) + else + { + /*************************************/ + /* PWM stop level selection is wrong */ + /*************************************/ + DPRINTK("PWM stop level selection is wrong\n"); + i_ReturnValue = -8; + } // if (b_StopLevel >= 0 && b_StopLevel <= 2) + } // if (b_StopMode >= 0 && b_StopMode <= 1) + else + { + /************************************/ + /* PWM stop mode selection is wrong */ + /************************************/ + DPRINTK("PWM stop mode selection is wrong\n"); + i_ReturnValue = -7; + } // if (b_StopMode >= 0 && b_StopMode <= 1) + } // if (b_StartLevel >= 0 && b_StartLevel <= 1) + else + { + /**************************************/ + /* PWM start level selection is wrong */ + /**************************************/ + DPRINTK("PWM start level selection is wrong\n"); + i_ReturnValue = -6; + } // if (b_StartLevel >= 0 && b_StartLevel <= 1) + } // if (dw_Status & 0x10) + else + { + /***********************/ + /* PWM not initialised */ + /***********************/ + DPRINTK("PWM not initialised\n"); + i_ReturnValue = -5; + } // if (dw_Status & 0x10) + } // if (b_PWM >= 0 && b_PWM <= 1) + else + { + /******************************/ + /* Tor PWM selection is wrong */ + /******************************/ + DPRINTK("Tor PWM selection is wrong\n"); + i_ReturnValue = -4; + } // if (b_PWM >= 0 && b_PWM <= 1) + } + else + { + /**********************************/ + /* The module is not a PWM module */ + /**********************************/ + DPRINTK("The module is not a PWM module\n"); + i_ReturnValue = -3; + } + } + else + { + /***********************/ + /* Module number error */ + /***********************/ + DPRINTK("Module number error\n"); + i_ReturnValue = -2; + } + + return (i_ReturnValue); + } + +/* ++----------------------------------------------------------------------------+ +| Function Name : _INT_ i_APCI1710_DisablePWM (BYTE_ b_BoardHandle, | +| BYTE_ b_ModulNbr, | +| BYTE_ b_PWM) | ++----------------------------------------------------------------------------+ +| Task : Disable the selected PWM (b_PWM) from selected module | +| (b_ModulNbr). The output signal level depend of the | +| initialisation by the "i_APCI1710_EnablePWM". | +| See the b_StartLevel, b_StopMode and b_StopLevel | +| parameters from this function. | ++----------------------------------------------------------------------------+ +| Input Parameters :BYTE_ b_BoardHandle : Handle of board APCI-1710 | +| BYTE_ b_ModulNbr : Selected module number (0 to 3) | +| BYTE_ b_PWM : Selected PWM (0 or 1) | ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value : 0: No error | +| -1: The handle parameter of the board is wrong | +| -2: Module selection wrong | +| -3: The module is not a PWM module | +| -4: PWM selection is wrong | +| -5: PWM not initialised see function | +| "i_APCI1710_InitPWM" | +| -6: PWM not enabled see function | +| "i_APCI1710_EnablePWM" | ++----------------------------------------------------------------------------+ +*/ + +INT i_APCI1710_DisablePWM (comedi_device *dev, + BYTE b_ModulNbr, + BYTE b_PWM) + { + INT i_ReturnValue = 0; + DWORD dw_Status; + + /**************************/ + /* Test the module number */ + /**************************/ + + if (b_ModulNbr < 4) + { + /***************/ + /* Test if PWM */ + /***************/ + + if ((devpriv->s_BoardInfos. + dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF0000UL) == APCI1710_PWM) + { + /**************************/ + /* Test the PWM selection */ + /**************************/ + + if (b_PWM <= 1) + { + /***************************/ + /* Test if PWM initialised */ + /***************************/ + + dw_Status=inl(devpriv->s_BoardInfos. + ui_Address + 12 + (20 * b_PWM) + (64 * b_ModulNbr)); + + if (dw_Status & 0x10) + { + /***********************/ + /* Test if PWM enabled */ + /***********************/ + + if (dw_Status & 0x1) + { + /*******************/ + /* Disable the PWM */ + /*******************/ + outl(0,devpriv->s_BoardInfos. + ui_Address + 12 + (20 * b_PWM) + (64 * b_ModulNbr)); + } // if (dw_Status & 0x1) + else + { + /*******************/ + /* PWM not enabled */ + /*******************/ + DPRINTK("PWM not enabled\n"); + i_ReturnValue = -6; + } // if (dw_Status & 0x1) + } // if (dw_Status & 0x10) + else + { + /***********************/ + /* PWM not initialised */ + /***********************/ + DPRINTK(" PWM not initialised\n"); + i_ReturnValue = -5; + } // if (dw_Status & 0x10) + } // if (b_PWM >= 0 && b_PWM <= 1) + else + { + /******************************/ + /* Tor PWM selection is wrong */ + /******************************/ + DPRINTK("Tor PWM selection is wrong\n"); + i_ReturnValue = -4; + } // if (b_PWM >= 0 && b_PWM <= 1) + } + else + { + /**********************************/ + /* The module is not a PWM module */ + /**********************************/ + DPRINTK("The module is not a PWM module\n"); + i_ReturnValue = -3; + } + } + else + { + /***********************/ + /* Module number error */ + /***********************/ + DPRINTK("Module number error\n"); + i_ReturnValue = -2; + } + + return (i_ReturnValue); + } + +/* ++----------------------------------------------------------------------------+ +| Function Name : _INT_ i_APCI1710_SetNewPWMTiming | +| (BYTE_ b_BoardHandle, | +| BYTE_ b_ModulNbr, | +| BYTE_ b_PWM, | +| BYTE_ b_ClockSelection, | +| BYTE_ b_TimingUnit, | +| ULONG_ ul_LowTiming, | +| ULONG_ ul_HighTiming) | ++----------------------------------------------------------------------------+ +| Task : Set a new timing. The ul_LowTiming, ul_HighTiming and | +| ul_TimingUnit determine the low/high timing base for | +| the period. | ++----------------------------------------------------------------------------+ +| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | +| BYTE_ b_ModulNbr : Module number to configure| +| (0 to 3) | +| BYTE_ b_PWM : Selected PWM (0 or 1). | +| BYTE_ b_TimingUnit : Base timing Unit (0 to 4) | +| 0 : ns | +| 1 : æs | +| 2 : ms | +| 3 : s | +| 4 : mn | +| ULONG_ ul_LowTiming : Low base timing value. | +| ULONG_ ul_HighTiming : High base timing value. | ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value : 0: No error | +| -1: The handle parameter of the board is wrong | +| -2: Module selection wrong | +| -3: The module is not a PWM module | +| -4: PWM selection is wrong | +| -5: PWM not initialised | +| -6: Timing Unit selection is wrong | +| -7: Low base timing selection is wrong | +| -8: High base timing selection is wrong | +----------------------------------------------------------------------------+ */ +INT i_APCI1710_SetNewPWMTiming (comedi_device *dev, + BYTE b_ModulNbr, + BYTE b_PWM, + BYTE b_TimingUnit, + ULONG ul_LowTiming, + ULONG ul_HighTiming) + { + BYTE b_ClockSelection; + INT i_ReturnValue = 0; + ULONG ul_LowTimerValue = 0; + ULONG ul_HighTimerValue = 0; + ULONG ul_RealLowTiming = 0; + ULONG ul_RealHighTiming = 0; + DWORD dw_Status; + DWORD dw_Command; + double d_RealLowTiming = 0; + double d_RealHighTiming = 0; + + + /**************************/ + /* Test the module number */ + /**************************/ + + if (b_ModulNbr < 4) + { + /***************/ + /* Test if PWM */ + /***************/ + + if ((devpriv->s_BoardInfos. + dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF0000UL) == APCI1710_PWM) + { + /**************************/ + /* Test the PWM selection */ + /**************************/ + + if (b_PWM <= 1) + { + /***************************/ + /* Test if PWM initialised */ + /***************************/ + + dw_Status=inl(devpriv->s_BoardInfos. + ui_Address + 12 + (20 * b_PWM) + (64 * b_ModulNbr)); + + if (dw_Status & 0x10) + { + b_ClockSelection = devpriv-> + s_ModuleInfo [b_ModulNbr]. + s_PWMModuleInfo. + b_ClockSelection; + + /************************/ + /* Test the timing unit */ + /************************/ + + if (b_TimingUnit <= 4) + { + /*********************************/ + /* Test the low timing selection */ + /*********************************/ + + if (((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 0) && (ul_LowTiming >= 266) && (ul_LowTiming <= 0xFFFFFFFFUL)) || + ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 1) && (ul_LowTiming >= 1) && (ul_LowTiming <= 571230650UL)) || + ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 2) && (ul_LowTiming >= 1) && (ul_LowTiming <= 571230UL)) || + ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 3) && (ul_LowTiming >= 1) && (ul_LowTiming <= 571UL)) || + ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 4) && (ul_LowTiming >= 1) && (ul_LowTiming <= 9UL)) || + ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 0) && (ul_LowTiming >= 242) && (ul_LowTiming <= 0xFFFFFFFFUL)) || + ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 1) && (ul_LowTiming >= 1) && (ul_LowTiming <= 519691043UL)) || + ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 2) && (ul_LowTiming >= 1) && (ul_LowTiming <= 519691UL)) || + ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 3) && (ul_LowTiming >= 1) && (ul_LowTiming <= 520UL)) || + ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 4) && (ul_LowTiming >= 1) && (ul_LowTiming <= 8UL)) || + ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 0) && (ul_LowTiming >= 200) && (ul_LowTiming <= 0xFFFFFFFFUL)) || + ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 1) && (ul_LowTiming >= 1) && (ul_LowTiming <= 429496729UL)) || + ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 2) && (ul_LowTiming >= 1) && (ul_LowTiming <= 429496UL)) || + ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 3) && (ul_LowTiming >= 1) && (ul_LowTiming <= 429UL)) || + ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 4) && (ul_LowTiming >= 1) && (ul_LowTiming <= 7UL))) + { + /**********************************/ + /* Test the High timing selection */ + /**********************************/ + + if (((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 266) && (ul_HighTiming <= 0xFFFFFFFFUL)) || + ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571230650UL)) || + ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571230UL)) || + ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571UL)) || + ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 9UL)) || + ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 242) && (ul_HighTiming <= 0xFFFFFFFFUL)) || + ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 519691043UL)) || + ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 519691UL)) || + ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 520UL)) || + ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 8UL)) || + ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 200) && (ul_HighTiming <= 0xFFFFFFFFUL)) || + ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429496729UL)) || + ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429496UL)) || + ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429UL)) || + ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 7UL))) + { + /************************************/ + /* Calculate the low division fator */ + /************************************/ + + fpu_begin (); + switch (b_TimingUnit) + { + /******/ + /* ns */ + /******/ + + case 0: + + /******************/ + /* Timer 0 factor */ + /******************/ + + ul_LowTimerValue = (ULONG) (ul_LowTiming * (0.00025 * b_ClockSelection)); + + /*******************/ + /* Round the value */ + /*******************/ + + if ((double) ((double) ul_LowTiming * (0.00025 * (double) b_ClockSelection)) >= ((double) ((double) ul_LowTimerValue + 0.5))) + { + ul_LowTimerValue = ul_LowTimerValue + 1; + } + + /*****************************/ + /* Calculate the real timing */ + /*****************************/ + + ul_RealLowTiming = (ULONG) (ul_LowTimerValue / (0.00025 * (double) b_ClockSelection)); + d_RealLowTiming = (double) ul_LowTimerValue / (0.00025 * (double) b_ClockSelection); + + if ((double) ((double) ul_LowTimerValue / (0.00025 * (double) b_ClockSelection)) >= (double) ((double) ul_RealLowTiming + 0.5)) + { + ul_RealLowTiming = ul_RealLowTiming + 1; + } + + ul_LowTiming = ul_LowTiming - 1; + ul_LowTimerValue = ul_LowTimerValue - 2; + + if (b_ClockSelection != APCI1710_40MHZ) + { + ul_LowTimerValue = (ULONG) ((double) (ul_LowTimerValue) * 1.007752288); + } + + + break; + + /******/ + /* æs */ + /******/ + + case 1: + + /******************/ + /* Timer 0 factor */ + /******************/ + + ul_LowTimerValue = (ULONG) (ul_LowTiming * (0.25 * b_ClockSelection)); + + /*******************/ + /* Round the value */ + /*******************/ + + if ((double) ((double) ul_LowTiming * (0.25 * (double) b_ClockSelection)) >= ((double) ((double) ul_LowTimerValue + 0.5))) + { + ul_LowTimerValue = ul_LowTimerValue + 1; + } + + /*****************************/ + /* Calculate the real timing */ + /*****************************/ + + ul_RealLowTiming = (ULONG) (ul_LowTimerValue / (0.25 * (double) b_ClockSelection)); + d_RealLowTiming = (double) ul_LowTimerValue / ((double) 0.25 * (double) b_ClockSelection); + + if ((double) ((double) ul_LowTimerValue / (0.25 * (double) b_ClockSelection)) >= (double) ((double) ul_RealLowTiming + 0.5)) + { + ul_RealLowTiming = ul_RealLowTiming + 1; + } + + ul_LowTiming = ul_LowTiming - 1; + ul_LowTimerValue = ul_LowTimerValue - 2; + + if (b_ClockSelection != APCI1710_40MHZ) + { + ul_LowTimerValue = (ULONG) ((double) (ul_LowTimerValue) * 1.007752288); + } + + break; + + /******/ + /* ms */ + /******/ + + case 2: + + /******************/ + /* Timer 0 factor */ + /******************/ + + ul_LowTimerValue = ul_LowTiming * (250.0 * b_ClockSelection); + + /*******************/ + /* Round the value */ + /*******************/ + + if ((double) ((double) ul_LowTiming * (250.0 * (double) b_ClockSelection)) >= ((double) ((double) ul_LowTimerValue + 0.5))) + { + ul_LowTimerValue = ul_LowTimerValue + 1; + } + + /*****************************/ + /* Calculate the real timing */ + /*****************************/ + + ul_RealLowTiming = (ULONG) (ul_LowTimerValue / (250.0 * (double) b_ClockSelection)); + d_RealLowTiming = (double) ul_LowTimerValue / (250.0 * (double) b_ClockSelection); + + if ((double) ((double) ul_LowTimerValue / (250.0 * (double) b_ClockSelection)) >= (double) ((double) ul_RealLowTiming + 0.5)) + { + ul_RealLowTiming = ul_RealLowTiming + 1; + } + + ul_LowTiming = ul_LowTiming - 1; + ul_LowTimerValue = ul_LowTimerValue - 2; + + if (b_ClockSelection != APCI1710_40MHZ) + { + ul_LowTimerValue = (ULONG) ((double) (ul_LowTimerValue) * 1.007752288); + } + + break; + + /*****/ + /* s */ + /*****/ + + case 3: + + /******************/ + /* Timer 0 factor */ + /******************/ + + ul_LowTimerValue = (ULONG) (ul_LowTiming * (250000.0 * b_ClockSelection)); + + /*******************/ + /* Round the value */ + /*******************/ + + if ((double) ((double) ul_LowTiming * (250000.0 * (double) b_ClockSelection)) >= ((double) ((double) ul_LowTimerValue + 0.5))) + { + ul_LowTimerValue = ul_LowTimerValue + 1; + } + + /*****************************/ + /* Calculate the real timing */ + /*****************************/ + + ul_RealLowTiming = (ULONG) (ul_LowTimerValue / (250000.0 * (double) b_ClockSelection)); + d_RealLowTiming = (double) ul_LowTimerValue / (250000.0 * (double) b_ClockSelection); + + if ((double) ((double) ul_LowTimerValue / (250000.0 * (double) b_ClockSelection)) >= (double) ((double) ul_RealLowTiming + 0.5)) + { + ul_RealLowTiming = ul_RealLowTiming + 1; + } + + ul_LowTiming = ul_LowTiming - 1; + ul_LowTimerValue = ul_LowTimerValue - 2; + + if (b_ClockSelection != APCI1710_40MHZ) + { + ul_LowTimerValue = (ULONG) ((double) (ul_LowTimerValue) * 1.007752288); + } + + break; + + /******/ + /* mn */ + /******/ + + case 4: + + /******************/ + /* Timer 0 factor */ + /******************/ + + ul_LowTimerValue = (ULONG) ((ul_LowTiming * 60) * (250000.0 * b_ClockSelection)); + + /*******************/ + /* Round the value */ + /*******************/ + + if ((double) ((double) (ul_LowTiming * 60.0) * (250000.0 * (double) b_ClockSelection)) >= ((double) ((double) ul_LowTimerValue + 0.5))) + { + ul_LowTimerValue = ul_LowTimerValue + 1; + } + + /*****************************/ + /* Calculate the real timing */ + /*****************************/ + + ul_RealLowTiming = (ULONG) (ul_LowTimerValue / (250000.0 * (double) b_ClockSelection)) / 60; + d_RealLowTiming = ((double) ul_LowTimerValue / (250000.0 * (double) b_ClockSelection)) / 60.0; + + if ((double) (((double) ul_LowTimerValue / (250000.0 * (double) b_ClockSelection)) / 60.0) >= (double) ((double) ul_RealLowTiming + 0.5)) + { + ul_RealLowTiming = ul_RealLowTiming + 1; + } + + ul_LowTiming = ul_LowTiming - 1; + ul_LowTimerValue = ul_LowTimerValue - 2; + + if (b_ClockSelection != APCI1710_40MHZ) + { + ul_LowTimerValue = (ULONG) ((double) (ul_LowTimerValue) * 1.007752288); + } + + break; + } + + /*************************************/ + /* Calculate the high division fator */ + /*************************************/ + + switch (b_TimingUnit) + { + /******/ + /* ns */ + /******/ + + case 0: + + /******************/ + /* Timer 0 factor */ + /******************/ + + ul_HighTimerValue = (ULONG) (ul_HighTiming * (0.00025 * b_ClockSelection)); + + /*******************/ + /* Round the value */ + /*******************/ + + if ((double) ((double) ul_HighTiming * (0.00025 * (double) b_ClockSelection)) >= ((double) ((double) ul_HighTimerValue + 0.5))) + { + ul_HighTimerValue = ul_HighTimerValue + 1; + } + + /*****************************/ + /* Calculate the real timing */ + /*****************************/ + + ul_RealHighTiming = (ULONG) (ul_HighTimerValue / (0.00025 * (double) b_ClockSelection)); + d_RealHighTiming = (double) ul_HighTimerValue / (0.00025 * (double) b_ClockSelection); + + if ((double) ((double) ul_HighTimerValue / (0.00025 * (double) b_ClockSelection)) >= (double) ((double) ul_RealHighTiming + 0.5)) + { + ul_RealHighTiming = ul_RealHighTiming + 1; + } + + ul_HighTiming = ul_HighTiming - 1; + ul_HighTimerValue = ul_HighTimerValue - 2; + + if (b_ClockSelection != APCI1710_40MHZ) + { + ul_HighTimerValue = (ULONG) ((double) (ul_HighTimerValue) * 1.007752288); + } + + + break; + + /******/ + /* æs */ + /******/ + + case 1: + + /******************/ + /* Timer 0 factor */ + /******************/ + + ul_HighTimerValue = (ULONG) (ul_HighTiming * (0.25 * b_ClockSelection)); + + /*******************/ + /* Round the value */ + /*******************/ + + if ((double) ((double) ul_HighTiming * (0.25 * (double) b_ClockSelection)) >= ((double) ((double) ul_HighTimerValue + 0.5))) + { + ul_HighTimerValue = ul_HighTimerValue + 1; + } + + /*****************************/ + /* Calculate the real timing */ + /*****************************/ + + ul_RealHighTiming = (ULONG) (ul_HighTimerValue / (0.25 * (double) b_ClockSelection)); + d_RealHighTiming = (double) ul_HighTimerValue / ((double) 0.25 * (double) b_ClockSelection); + + if ((double) ((double) ul_HighTimerValue / (0.25 * (double) b_ClockSelection)) >= (double) ((double) ul_RealHighTiming + 0.5)) + { + ul_RealHighTiming = ul_RealHighTiming + 1; + } + + ul_HighTiming = ul_HighTiming - 1; + ul_HighTimerValue = ul_HighTimerValue - 2; + + if (b_ClockSelection != APCI1710_40MHZ) + { + ul_HighTimerValue = (ULONG) ((double) (ul_HighTimerValue) * 1.007752288); + } + + break; + + /******/ + /* ms */ + /******/ + + case 2: + + /******************/ + /* Timer 0 factor */ + /******************/ + + ul_HighTimerValue = ul_HighTiming * (250.0 * b_ClockSelection); + + /*******************/ + /* Round the value */ + /*******************/ + + if ((double) ((double) ul_HighTiming * (250.0 * (double) b_ClockSelection)) >= ((double) ((double) ul_HighTimerValue + 0.5))) + { + ul_HighTimerValue = ul_HighTimerValue + 1; + } + + /*****************************/ + /* Calculate the real timing */ + /*****************************/ + + ul_RealHighTiming = (ULONG) (ul_HighTimerValue / (250.0 * (double) b_ClockSelection)); + d_RealHighTiming = (double) ul_HighTimerValue / (250.0 * (double) b_ClockSelection); + + if ((double) ((double) ul_HighTimerValue / (250.0 * (double) b_ClockSelection)) >= (double) ((double) ul_RealHighTiming + 0.5)) + { + ul_RealHighTiming = ul_RealHighTiming + 1; + } + + ul_HighTiming = ul_HighTiming - 1; + ul_HighTimerValue = ul_HighTimerValue - 2; + + if (b_ClockSelection != APCI1710_40MHZ) + { + ul_HighTimerValue = (ULONG) ((double) (ul_HighTimerValue) * 1.007752288); + } + + break; + + /*****/ + /* s */ + /*****/ + + case 3: + + /******************/ + /* Timer 0 factor */ + /******************/ + + ul_HighTimerValue = (ULONG) (ul_HighTiming * (250000.0 * b_ClockSelection)); + + /*******************/ + /* Round the value */ + /*******************/ + + if ((double) ((double) ul_HighTiming * (250000.0 * (double) b_ClockSelection)) >= ((double) ((double) ul_HighTimerValue + 0.5))) + { + ul_HighTimerValue = ul_HighTimerValue + 1; + } + + /*****************************/ + /* Calculate the real timing */ + /*****************************/ + + ul_RealHighTiming = (ULONG) (ul_HighTimerValue / (250000.0 * (double) b_ClockSelection)); + d_RealHighTiming = (double) ul_HighTimerValue / (250000.0 * (double) b_ClockSelection); + + if ((double) ((double) ul_HighTimerValue / (250000.0 * (double) b_ClockSelection)) >= (double) ((double) ul_RealHighTiming + 0.5)) + { + ul_RealHighTiming = ul_RealHighTiming + 1; + } + + ul_HighTiming = ul_HighTiming - 1; + ul_HighTimerValue = ul_HighTimerValue - 2; + + if (b_ClockSelection != APCI1710_40MHZ) + { + ul_HighTimerValue = (ULONG) ((double) (ul_HighTimerValue) * 1.007752288); + } + + break; + + /******/ + /* mn */ + /******/ + + case 4: + + /******************/ + /* Timer 0 factor */ + /******************/ + + ul_HighTimerValue = (ULONG) ((ul_HighTiming * 60) * (250000.0 * b_ClockSelection)); + + /*******************/ + /* Round the value */ + /*******************/ + + if ((double) ((double) (ul_HighTiming * 60.0) * (250000.0 * (double) b_ClockSelection)) >= ((double) ((double) ul_HighTimerValue + 0.5))) + { + ul_HighTimerValue = ul_HighTimerValue + 1; + } + + /*****************************/ + /* Calculate the real timing */ + /*****************************/ + + ul_RealHighTiming = (ULONG) (ul_HighTimerValue / (250000.0 * (double) b_ClockSelection)) / 60; + d_RealHighTiming = ((double) ul_HighTimerValue / (250000.0 * (double) b_ClockSelection)) / 60.0; + + if ((double) (((double) ul_HighTimerValue / (250000.0 * (double) b_ClockSelection)) / 60.0) >= (double) ((double) ul_RealHighTiming + 0.5)) + { + ul_RealHighTiming = ul_RealHighTiming + 1; + } + + ul_HighTiming = ul_HighTiming - 1; + ul_HighTimerValue = ul_HighTimerValue - 2; + + if (b_ClockSelection != APCI1710_40MHZ) + { + ul_HighTimerValue = (ULONG) ((double) (ul_HighTimerValue) * 1.007752288); + } + + break; + } + + fpu_end (); + + /************************/ + /* Save the timing unit */ + /************************/ + + devpriv-> + s_ModuleInfo [b_ModulNbr]. + s_PWMModuleInfo. + s_PWMInfo [b_PWM]. + b_TimingUnit = b_TimingUnit; + + /****************************/ + /* Save the low base timing */ + /****************************/ + + devpriv-> + s_ModuleInfo [b_ModulNbr]. + s_PWMModuleInfo. + s_PWMInfo [b_PWM]. + d_LowTiming = d_RealLowTiming; + + devpriv-> + s_ModuleInfo [b_ModulNbr]. + s_PWMModuleInfo. + s_PWMInfo [b_PWM]. + ul_RealLowTiming = ul_RealLowTiming; + + /****************************/ + /* Save the high base timing */ + /****************************/ + + devpriv-> + s_ModuleInfo [b_ModulNbr]. + s_PWMModuleInfo. + s_PWMInfo [b_PWM]. + d_HighTiming = d_RealHighTiming; + + devpriv-> + s_ModuleInfo [b_ModulNbr]. + s_PWMModuleInfo. + s_PWMInfo [b_PWM]. + ul_RealHighTiming = ul_RealHighTiming; + + /************************/ + /* Write the low timing */ + /************************/ + + outl(ul_LowTimerValue,devpriv->s_BoardInfos. + ui_Address + 0 + (20 * b_PWM) + (64 * b_ModulNbr)); + + /*************************/ + /* Write the high timing */ + /*************************/ + + outl(ul_HighTimerValue,devpriv->s_BoardInfos. + ui_Address + 4 + (20 * b_PWM) + (64 * b_ModulNbr)); + + /***************************/ + /* Set the clock selection */ + /***************************/ + + dw_Command=inl(devpriv->s_BoardInfos. + ui_Address + 8 + (20 * b_PWM) + (64 * b_ModulNbr)); + + dw_Command = dw_Command & 0x7F; + + if (b_ClockSelection == APCI1710_40MHZ) + { + dw_Command = dw_Command | 0x80; + } + + /***************************/ + /* Set the clock selection */ + /***************************/ + + outl(dw_Command,devpriv->s_BoardInfos. + ui_Address + 8 + (20 * b_PWM) + (64 * b_ModulNbr)); + } + else + { + /***************************************/ + /* High base timing selection is wrong */ + /***************************************/ + DPRINTK("High base timing selection is wrong\n"); + i_ReturnValue = -8; + } + } + else + { + /**************************************/ + /* Low base timing selection is wrong */ + /**************************************/ + DPRINTK("Low base timing selection is wrong\n"); + i_ReturnValue = -7; + } + } // if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) + else + { + /**********************************/ + /* Timing unit selection is wrong */ + /**********************************/ + DPRINTK("Timing unit selection is wrong\n"); + i_ReturnValue = -6; + } // if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) + } // if (dw_Status & 0x10) + else + { + /***********************/ + /* PWM not initialised */ + /***********************/ + DPRINTK("PWM not initialised\n"); + i_ReturnValue = -5; + } // if (dw_Status & 0x10) + } // if (b_PWM >= 0 && b_PWM <= 1) + else + { + /******************************/ + /* Tor PWM selection is wrong */ + /******************************/ + DPRINTK("Tor PWM selection is wrong\n"); + i_ReturnValue = -4; + } // if (b_PWM >= 0 && b_PWM <= 1) + } + else + { + /**********************************/ + /* The module is not a PWM module */ + /**********************************/ + DPRINTK("The module is not a PWM module\n"); + i_ReturnValue = -3; + } + } + else + { + /***********************/ + /* Module number error */ + /***********************/ + DPRINTK("Module number error\n"); + i_ReturnValue = -2; + } + + return (i_ReturnValue); + } -#include "APCI1710_Pwm.h" - - -/* -+----------------------------------------------------------------------------+ -| Function Name :INT i_APCI1710_InsnConfigPWM(comedi_device *dev, -comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Pwm Init and Get Pwm Initialisation | -+----------------------------------------------------------------------------+ -| Input Parameters : -+----------------------------------------------------------------------------+ -| Output Parameters : - | -+----------------------------------------------------------------------------+ -| Return Value : -+----------------------------------------------------------------------------+ -*/ - -INT i_APCI1710_InsnConfigPWM(comedi_device *dev,comedi_subdevice *s, -comedi_insn *insn,lsampl_t *data) -{ - BYTE b_ConfigType; - INT i_ReturnValue=0; - b_ConfigType=CR_CHAN(insn->chanspec); - - switch(b_ConfigType) - { - case APCI1710_PWM_INIT : - i_ReturnValue=i_APCI1710_InitPWM (dev, - (BYTE)CR_AREF(insn->chanspec), // b_ModulNbr - (BYTE) data[0], //b_PWM - (BYTE) data[1], // b_ClockSelection - (BYTE) data[2], // b_TimingUnit - (ULONG)data[3], //ul_LowTiming - (ULONG)data[4], //ul_HighTiming - (PULONG)&data[0], //pul_RealLowTiming - (PULONG)&data[1] //pul_RealHighTiming - ); - break; - - case APCI1710_PWM_GETINITDATA : - i_ReturnValue=i_APCI1710_GetPWMInitialisation (dev, - (BYTE)CR_AREF(insn->chanspec), // b_ModulNbr - (BYTE) data[0], //b_PWM - (PBYTE)&data[0], //pb_TimingUnit - (PULONG)&data[1], //pul_LowTiming - (PULONG)&data[2], //pul_HighTiming - (PBYTE) &data[3], // pb_StartLevel - (PBYTE) &data[4], // pb_StopMode - (PBYTE) &data[5], // pb_StopLevel - (PBYTE) &data[6], // pb_ExternGate - (PBYTE) &data[7], // pb_InterruptEnable - (PBYTE) &data[8] // pb_Enable - ); - break; - - default: - printk(" Config Parameter Wrong\n"); - } - - if(i_ReturnValue>=0) i_ReturnValue =insn->n; - return (i_ReturnValue); -} - - - -/* -+----------------------------------------------------------------------------+ -| Function Name : _INT_ i_APCI1710_InitPWM | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_PWM, | -| BYTE_ b_ClockSelection, | -| BYTE_ b_TimingUnit, | -| ULONG_ ul_LowTiming, | -| ULONG_ ul_HighTiming, | -| PULONG_ pul_RealLowTiming, | -| PULONG_ pul_RealHighTiming) | -+----------------------------------------------------------------------------+ -| Task : Configure the selected PWM (b_PWM) from selected module| -| (b_ModulNbr). The ul_LowTiming, ul_HighTiming and | -| ul_TimingUnit determine the low/high timing base for | -| the period. pul_RealLowTiming, pul_RealHighTiming | -| return the real timing value. | -| You must calling this function be for you call any | -| other function witch access of the PWM. | -+----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure| -| (0 to 3) | -| BYTE_ b_PWM : Selected PWM (0 or 1). | -| BYTE_ b_ClockSelection : Selection from PCI bus | -| clock | -| - APCI1710_30MHZ : | -| The PC have a 30 MHz | -| PCI bus clock | -| - APCI1710_33MHZ : | -| The PC have a 33 MHz | -| PCI bus clock | -| - APCI1710_40MHZ | -| The APCI-1710 have a | -| integrated 40Mhz | -| quartz. | -| BYTE_ b_TimingUnit : Base timing Unit (0 to 4) | -| 0 : ns | -| 1 : æs | -| 2 : ms | -| 3 : s | -| 4 : mn | -| ULONG_ ul_LowTiming : Low base timing value. | -| ULONG_ ul_HighTiming : High base timing value. | -+----------------------------------------------------------------------------+ -| Output Parameters : PULONG_ pul_RealLowTiming : Real low base timing | -| value. | -| PULONG_ pul_RealHighTiming : Real high base timing | -| value. | -+----------------------------------------------------------------------------+ -| Return Value : 0: No error | -| -1: The handle parameter of the board is wrong | -| -2: Module selection wrong | -| -3: The module is not a PWM module | -| -4: PWM selection is wrong | -| -5: The selected input clock is wrong | -| -6: Timing Unit selection is wrong | -| -7: Low base timing selection is wrong | -| -8: High base timing selection is wrong | -| -9: You can not used the 40MHz clock selection with | -| this board | -+----------------------------------------------------------------------------+ -*/ - -INT i_APCI1710_InitPWM (comedi_device *dev, - BYTE b_ModulNbr, - BYTE b_PWM, - BYTE b_ClockSelection, - BYTE b_TimingUnit, - ULONG ul_LowTiming, - ULONG ul_HighTiming, - PULONG pul_RealLowTiming, - PULONG pul_RealHighTiming) - { - INT i_ReturnValue = 0; - ULONG ul_LowTimerValue; - ULONG ul_HighTimerValue; - DWORD dw_Command; - double d_RealLowTiming; - double d_RealHighTiming; - - - - /**************************/ - /* Test the module number */ - /**************************/ - - if (b_ModulNbr < 4) - { - /***************/ - /* Test if PWM */ - /***************/ - - if ((devpriv-> - s_BoardInfos. - dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF0000UL) == APCI1710_PWM) - { - /**************************/ - /* Test the PWM selection */ - /**************************/ - - if (b_PWM >= 0 && b_PWM <= 1) - { - /******************/ - /* Test the clock */ - /******************/ - - if ((b_ClockSelection == APCI1710_30MHZ) || - (b_ClockSelection == APCI1710_33MHZ) || - (b_ClockSelection == APCI1710_40MHZ)) - { - /************************/ - /* Test the timing unit */ - /************************/ - - if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) - { - /*********************************/ - /* Test the low timing selection */ - /*********************************/ - - if (((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 0) && (ul_LowTiming >= 266) && (ul_LowTiming <= 0xFFFFFFFFUL)) || - ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 1) && (ul_LowTiming >= 1) && (ul_LowTiming <= 571230650UL)) || - ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 2) && (ul_LowTiming >= 1) && (ul_LowTiming <= 571230UL)) || - ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 3) && (ul_LowTiming >= 1) && (ul_LowTiming <= 571UL)) || - ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 4) && (ul_LowTiming >= 1) && (ul_LowTiming <= 9UL)) || - ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 0) && (ul_LowTiming >= 242) && (ul_LowTiming <= 0xFFFFFFFFUL)) || - ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 1) && (ul_LowTiming >= 1) && (ul_LowTiming <= 519691043UL)) || - ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 2) && (ul_LowTiming >= 1) && (ul_LowTiming <= 519691UL)) || - ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 3) && (ul_LowTiming >= 1) && (ul_LowTiming <= 520UL)) || - ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 4) && (ul_LowTiming >= 1) && (ul_LowTiming <= 8UL)) || - ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 0) && (ul_LowTiming >= 200) && (ul_LowTiming <= 0xFFFFFFFFUL)) || - ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 1) && (ul_LowTiming >= 1) && (ul_LowTiming <= 429496729UL)) || - ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 2) && (ul_LowTiming >= 1) && (ul_LowTiming <= 429496UL)) || - ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 3) && (ul_LowTiming >= 1) && (ul_LowTiming <= 429UL)) || - ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 4) && (ul_LowTiming >= 1) && (ul_LowTiming <= 7UL))) - { - /**********************************/ - /* Test the High timing selection */ - /**********************************/ - - if (((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 266) && (ul_HighTiming <= 0xFFFFFFFFUL)) || - ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571230650UL)) || - ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571230UL)) || - ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571UL)) || - ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 9UL)) || - ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 242) && (ul_HighTiming <= 0xFFFFFFFFUL)) || - ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 519691043UL)) || - ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 519691UL)) || - ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 520UL)) || - ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 8UL)) || - ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 200) && (ul_HighTiming <= 0xFFFFFFFFUL)) || - ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429496729UL)) || - ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429496UL)) || - ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429UL)) || - ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 7UL))) - { - /**************************/ - /* Test the board version */ - /**************************/ - - if ((b_ClockSelection == APCI1710_40MHZ) && (devpriv-> - s_BoardInfos. - b_BoardVersion > 0) || - (b_ClockSelection != APCI1710_40MHZ)) - { - - /************************************/ - /* Calculate the low division fator */ - /************************************/ - - switch (b_TimingUnit) - { - /******/ - /* ns */ - /******/ - - case 0: - - /******************/ - /* Timer 0 factor */ - /******************/ - - ul_LowTimerValue = (ULONG) (ul_LowTiming * (0.00025 * b_ClockSelection)); - - /*******************/ - /* Round the value */ - /*******************/ - - if ((double) ((double) ul_LowTiming * (0.00025 * (double) b_ClockSelection)) >= ((double) ((double) ul_LowTimerValue + 0.5))) - { - ul_LowTimerValue = ul_LowTimerValue + 1; - } - - /*****************************/ - /* Calculate the real timing */ - /*****************************/ - - *pul_RealLowTiming = (ULONG) (ul_LowTimerValue / (0.00025 * (double) b_ClockSelection)); - d_RealLowTiming = (double) ul_LowTimerValue / (0.00025 * (double) b_ClockSelection); - - if ((double) ((double) ul_LowTimerValue / (0.00025 * (double) b_ClockSelection)) >= (double) ((double) *pul_RealLowTiming + 0.5)) - { - *pul_RealLowTiming = *pul_RealLowTiming + 1; - } - - ul_LowTiming = ul_LowTiming - 1; - ul_LowTimerValue = ul_LowTimerValue - 2; - - if (b_ClockSelection != APCI1710_40MHZ) - { - ul_LowTimerValue = (ULONG) ((double) (ul_LowTimerValue) * 1.007752288); - } - - - break; - - /******/ - /* æs */ - /******/ - - case 1: - - /******************/ - /* Timer 0 factor */ - /******************/ - - ul_LowTimerValue = (ULONG) (ul_LowTiming * (0.25 * b_ClockSelection)); - - /*******************/ - /* Round the value */ - /*******************/ - - if ((double) ((double) ul_LowTiming * (0.25 * (double) b_ClockSelection)) >= ((double) ((double) ul_LowTimerValue + 0.5))) - { - ul_LowTimerValue = ul_LowTimerValue + 1; - } - - /*****************************/ - /* Calculate the real timing */ - /*****************************/ - - *pul_RealLowTiming = (ULONG) (ul_LowTimerValue / (0.25 * (double) b_ClockSelection)); - d_RealLowTiming = (double) ul_LowTimerValue / ((double) 0.25 * (double) b_ClockSelection); - - if ((double) ((double) ul_LowTimerValue / (0.25 * (double) b_ClockSelection)) >= (double) ((double) *pul_RealLowTiming + 0.5)) - { - *pul_RealLowTiming = *pul_RealLowTiming + 1; - } - - ul_LowTiming = ul_LowTiming - 1; - ul_LowTimerValue = ul_LowTimerValue - 2; - - if (b_ClockSelection != APCI1710_40MHZ) - { - ul_LowTimerValue = (ULONG) ((double) (ul_LowTimerValue) * 1.007752288); - } - - - break; - - /******/ - /* ms */ - /******/ - - case 2: - - /******************/ - /* Timer 0 factor */ - /******************/ - - ul_LowTimerValue = ul_LowTiming * (250.0 * b_ClockSelection); - - /*******************/ - /* Round the value */ - /*******************/ - - if ((double) ((double) ul_LowTiming * (250.0 * (double) b_ClockSelection)) >= ((double) ((double) ul_LowTimerValue + 0.5))) - { - ul_LowTimerValue = ul_LowTimerValue + 1; - } - - /*****************************/ - /* Calculate the real timing */ - /*****************************/ - - *pul_RealLowTiming = (ULONG) (ul_LowTimerValue / (250.0 * (double) b_ClockSelection)); - d_RealLowTiming = (double) ul_LowTimerValue / (250.0 * (double) b_ClockSelection); - - if ((double) ((double) ul_LowTimerValue / (250.0 * (double) b_ClockSelection)) >= (double) ((double) *pul_RealLowTiming + 0.5)) - { - *pul_RealLowTiming = *pul_RealLowTiming + 1; - } - - ul_LowTiming = ul_LowTiming - 1; - ul_LowTimerValue = ul_LowTimerValue - 2; - - if (b_ClockSelection != APCI1710_40MHZ) - { - ul_LowTimerValue = (ULONG) ((double) (ul_LowTimerValue) * 1.007752288); - } - - break; - - /*****/ - /* s */ - /*****/ - - case 3: - /******************/ - /* Timer 0 factor */ - /******************/ - - ul_LowTimerValue = (ULONG) (ul_LowTiming * (250000.0 * b_ClockSelection)); - - /*******************/ - /* Round the value */ - /*******************/ - - if ((double) ((double) ul_LowTiming * (250000.0 * (double) b_ClockSelection)) >= ((double) ((double) ul_LowTimerValue + 0.5))) - { - ul_LowTimerValue = ul_LowTimerValue + 1; - } - - /*****************************/ - /* Calculate the real timing */ - /*****************************/ - - *pul_RealLowTiming = (ULONG) (ul_LowTimerValue / (250000.0 * (double) b_ClockSelection)); - d_RealLowTiming = (double) ul_LowTimerValue / (250000.0 * (double) b_ClockSelection); - - if ((double) ((double) ul_LowTimerValue / (250000.0 * (double) b_ClockSelection)) >= (double) ((double) *pul_RealLowTiming + 0.5)) - { - *pul_RealLowTiming = *pul_RealLowTiming + 1; - } - - ul_LowTiming = ul_LowTiming - 1; - ul_LowTimerValue = ul_LowTimerValue - 2; - - if (b_ClockSelection != APCI1710_40MHZ) - { - ul_LowTimerValue = (ULONG) ((double) (ul_LowTimerValue) * 1.007752288); - } - - - break; - - /******/ - /* mn */ - /******/ - - case 4: - - /******************/ - /* Timer 0 factor */ - /******************/ - - ul_LowTimerValue = (ULONG) ((ul_LowTiming * 60) * (250000.0 * b_ClockSelection)); - - /*******************/ - /* Round the value */ - /*******************/ - - if ((double) ((double) (ul_LowTiming * 60.0) * (250000.0 * (double) b_ClockSelection)) >= ((double) ((double) ul_LowTimerValue + 0.5))) - { - ul_LowTimerValue = ul_LowTimerValue + 1; - } - - /*****************************/ - /* Calculate the real timing */ - /*****************************/ - - *pul_RealLowTiming = (ULONG) (ul_LowTimerValue / (250000.0 * (double) b_ClockSelection)) / 60; - d_RealLowTiming = ((double) ul_LowTimerValue / (250000.0 * (double) b_ClockSelection)) / 60.0; - - if ((double) (((double) ul_LowTimerValue / (250000.0 * (double) b_ClockSelection)) / 60.0) >= (double) ((double) *pul_RealLowTiming + 0.5)) - { - *pul_RealLowTiming = *pul_RealLowTiming + 1; - } - - ul_LowTiming = ul_LowTiming - 1; - ul_LowTimerValue = ul_LowTimerValue - 2; - - if (b_ClockSelection != APCI1710_40MHZ) - { - ul_LowTimerValue = (ULONG) ((double) (ul_LowTimerValue) * 1.007752288); - } - - break; - } - - /*************************************/ - /* Calculate the high division fator */ - /*************************************/ - - switch (b_TimingUnit) - { - /******/ - /* ns */ - /******/ - - case 0: - - /******************/ - /* Timer 0 factor */ - /******************/ - - ul_HighTimerValue = (ULONG) (ul_HighTiming * (0.00025 * b_ClockSelection)); - - /*******************/ - /* Round the value */ - /*******************/ - - if ((double) ((double) ul_HighTiming * (0.00025 * (double) b_ClockSelection)) >= ((double) ((double) ul_HighTimerValue + 0.5))) - { - ul_HighTimerValue = ul_HighTimerValue + 1; - } - - /*****************************/ - /* Calculate the real timing */ - /*****************************/ - - *pul_RealHighTiming = (ULONG) (ul_HighTimerValue / (0.00025 * (double) b_ClockSelection)); - d_RealHighTiming = (double) ul_HighTimerValue / (0.00025 * (double) b_ClockSelection); - - if ((double) ((double) ul_HighTimerValue / (0.00025 * (double) b_ClockSelection)) >= (double) ((double) *pul_RealHighTiming + 0.5)) - { - *pul_RealHighTiming = *pul_RealHighTiming + 1; - } - - ul_HighTiming = ul_HighTiming - 1; - ul_HighTimerValue = ul_HighTimerValue - 2; - - if (b_ClockSelection != APCI1710_40MHZ) - { - ul_HighTimerValue = (ULONG) ((double) (ul_HighTimerValue) * 1.007752288); - } - - - break; - - /******/ - /* æs */ - /******/ - - case 1: - - /******************/ - /* Timer 0 factor */ - /******************/ - - ul_HighTimerValue = (ULONG) (ul_HighTiming * (0.25 * b_ClockSelection)); - - /*******************/ - /* Round the value */ - /*******************/ - - if ((double) ((double) ul_HighTiming * (0.25 * (double) b_ClockSelection)) >= ((double) ((double) ul_HighTimerValue + 0.5))) - { - ul_HighTimerValue = ul_HighTimerValue + 1; - } - - /*****************************/ - /* Calculate the real timing */ - /*****************************/ - - *pul_RealHighTiming = (ULONG) (ul_HighTimerValue / (0.25 * (double) b_ClockSelection)); - d_RealHighTiming = (double) ul_HighTimerValue / ((double) 0.25 * (double) b_ClockSelection); - - if ((double) ((double) ul_HighTimerValue / (0.25 * (double) b_ClockSelection)) >= (double) ((double) *pul_RealHighTiming + 0.5)) - { - *pul_RealHighTiming = *pul_RealHighTiming + 1; - } - - ul_HighTiming = ul_HighTiming - 1; - ul_HighTimerValue = ul_HighTimerValue - 2; - - if (b_ClockSelection != APCI1710_40MHZ) - { - ul_HighTimerValue = (ULONG) ((double) (ul_HighTimerValue) * 1.007752288); - } - - - break; - - /******/ - /* ms */ - /******/ - - case 2: - - /******************/ - /* Timer 0 factor */ - /******************/ - - ul_HighTimerValue = ul_HighTiming * (250.0 * b_ClockSelection); - - /*******************/ - /* Round the value */ - /*******************/ - - if ((double) ((double) ul_HighTiming * (250.0 * (double) b_ClockSelection)) >= ((double) ((double) ul_HighTimerValue + 0.5))) - { - ul_HighTimerValue = ul_HighTimerValue + 1; - } - - /*****************************/ - /* Calculate the real timing */ - /*****************************/ - - *pul_RealHighTiming = (ULONG) (ul_HighTimerValue / (250.0 * (double) b_ClockSelection)); - d_RealHighTiming = (double) ul_HighTimerValue / (250.0 * (double) b_ClockSelection); - - if ((double) ((double) ul_HighTimerValue / (250.0 * (double) b_ClockSelection)) >= (double) ((double) *pul_RealHighTiming + 0.5)) - { - *pul_RealHighTiming = *pul_RealHighTiming + 1; - } - - ul_HighTiming = ul_HighTiming - 1; - ul_HighTimerValue = ul_HighTimerValue - 2; - - if (b_ClockSelection != APCI1710_40MHZ) - { - ul_HighTimerValue = (ULONG) ((double) (ul_HighTimerValue) * 1.007752288); - } - - - break; - - /*****/ - /* s */ - /*****/ - - case 3: - - /******************/ - /* Timer 0 factor */ - /******************/ - - ul_HighTimerValue = (ULONG) (ul_HighTiming * (250000.0 * b_ClockSelection)); - - /*******************/ - /* Round the value */ - /*******************/ - - if ((double) ((double) ul_HighTiming * (250000.0 * (double) b_ClockSelection)) >= ((double) ((double) ul_HighTimerValue + 0.5))) - { - ul_HighTimerValue = ul_HighTimerValue + 1; - } - - /*****************************/ - /* Calculate the real timing */ - /*****************************/ - - *pul_RealHighTiming = (ULONG) (ul_HighTimerValue / (250000.0 * (double) b_ClockSelection)); - d_RealHighTiming = (double) ul_HighTimerValue / (250000.0 * (double) b_ClockSelection); - - if ((double) ((double) ul_HighTimerValue / (250000.0 * (double) b_ClockSelection)) >= (double) ((double) *pul_RealHighTiming + 0.5)) - { - *pul_RealHighTiming = *pul_RealHighTiming + 1; - } - - ul_HighTiming = ul_HighTiming - 1; - ul_HighTimerValue = ul_HighTimerValue - 2; - - if (b_ClockSelection != APCI1710_40MHZ) - { - ul_HighTimerValue = (ULONG) ((double) (ul_HighTimerValue) * 1.007752288); - } - - - break; - - /******/ - /* mn */ - /******/ - - case 4: - - /******************/ - /* Timer 0 factor */ - /******************/ - - ul_HighTimerValue = (ULONG) ((ul_HighTiming * 60) * (250000.0 * b_ClockSelection)); - - /*******************/ - /* Round the value */ - /*******************/ - - if ((double) ((double) (ul_HighTiming * 60.0) * (250000.0 * (double) b_ClockSelection)) >= ((double) ((double) ul_HighTimerValue + 0.5))) - { - ul_HighTimerValue = ul_HighTimerValue + 1; - } - - /*****************************/ - /* Calculate the real timing */ - /*****************************/ - - *pul_RealHighTiming = (ULONG) (ul_HighTimerValue / (250000.0 * (double) b_ClockSelection)) / 60; - d_RealHighTiming = ((double) ul_HighTimerValue / (250000.0 * (double) b_ClockSelection)) / 60.0; - - if ((double) (((double) ul_HighTimerValue / (250000.0 * (double) b_ClockSelection)) / 60.0) >= (double) ((double) *pul_RealHighTiming + 0.5)) - { - *pul_RealHighTiming = *pul_RealHighTiming + 1; - } - - ul_HighTiming = ul_HighTiming - 1; - ul_HighTimerValue = ul_HighTimerValue - 2; - - if (b_ClockSelection != APCI1710_40MHZ) - { - ul_HighTimerValue = (ULONG) ((double) (ul_HighTimerValue) * 1.007752288); - } - - break; - } - - /****************************/ - /* Save the clock selection */ - /****************************/ - - devpriv-> - s_ModuleInfo [b_ModulNbr]. - s_PWMModuleInfo. - b_ClockSelection = b_ClockSelection; - - /************************/ - /* Save the timing unit */ - /************************/ - - devpriv-> - s_ModuleInfo [b_ModulNbr]. - s_PWMModuleInfo. - s_PWMInfo [b_PWM]. - b_TimingUnit = b_TimingUnit; - - /****************************/ - /* Save the low base timing */ - /****************************/ - - devpriv-> - s_ModuleInfo [b_ModulNbr]. - s_PWMModuleInfo. - s_PWMInfo [b_PWM]. - d_LowTiming = d_RealLowTiming; - - devpriv-> - s_ModuleInfo [b_ModulNbr]. - s_PWMModuleInfo. - s_PWMInfo [b_PWM]. - ul_RealLowTiming = *pul_RealLowTiming; - - /****************************/ - /* Save the high base timing */ - /****************************/ - - devpriv-> - s_ModuleInfo [b_ModulNbr]. - s_PWMModuleInfo. - s_PWMInfo [b_PWM]. - d_HighTiming = d_RealHighTiming; - - devpriv-> - s_ModuleInfo [b_ModulNbr]. - s_PWMModuleInfo. - s_PWMInfo [b_PWM]. - ul_RealHighTiming = *pul_RealHighTiming; - - /************************/ - /* Write the low timing */ - /************************/ - - outl(ul_LowTimerValue,devpriv->s_BoardInfos. - ui_Address + 0 + (20 * b_PWM) + (64 * b_ModulNbr)); - - /*************************/ - /* Write the high timing */ - /*************************/ - - outl(ul_HighTimerValue,devpriv->s_BoardInfos. - ui_Address + 4 + (20 * b_PWM) + (64 * b_ModulNbr)); - - /***************************/ - /* Set the clock selection */ - /***************************/ - - dw_Command=inl(devpriv->s_BoardInfos. - ui_Address + 8 + (20 * b_PWM) + (64 * b_ModulNbr)); - - dw_Command = dw_Command & 0x7F; - - if (b_ClockSelection == APCI1710_40MHZ) - { - dw_Command = dw_Command | 0x80; - } - - /***************************/ - /* Set the clock selection */ - /***************************/ - - outl(dw_Command,devpriv->s_BoardInfos. - ui_Address + 8 + (20 * b_PWM) + (64 * b_ModulNbr)); - - /*************/ - /* PWM init. */ - /*************/ - devpriv-> - s_ModuleInfo [b_ModulNbr]. - s_PWMModuleInfo. - s_PWMInfo [b_PWM]. - b_PWMInit = 1; - } - else - { - /***************************************************/ - /* You can not used the 40MHz clock selection with */ - /* this board */ - /***************************************************/ - DPRINTK("You can not used the 40MHz clock selection with this board\n"); - i_ReturnValue = -9; - } - } - else - { - /***************************************/ - /* High base timing selection is wrong */ - /***************************************/ - DPRINTK("High base timing selection is wrong\n"); - i_ReturnValue = -8; - } - } - else - { - /**************************************/ - /* Low base timing selection is wrong */ - /**************************************/ - DPRINTK("Low base timing selection is wrong\n"); - i_ReturnValue = -7; - } - } // if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) - else - { - /**********************************/ - /* Timing unit selection is wrong */ - /**********************************/ - DPRINTK("Timing unit selection is wrong\n"); - i_ReturnValue = -6; - } // if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) - } // if ((b_ClockSelection == APCI1710_30MHZ) || (b_ClockSelection == APCI1710_33MHZ) || (b_ClockSelection == APCI1710_40MHZ)) - else - { - /*******************************/ - /* The selected clock is wrong */ - /*******************************/ - DPRINTK("The selected clock is wrong\n"); - i_ReturnValue = -5; - } // if ((b_ClockSelection == APCI1710_30MHZ) || (b_ClockSelection == APCI1710_33MHZ) || (b_ClockSelection == APCI1710_40MHZ)) - } // if (b_PWM >= 0 && b_PWM <= 1) - else - { - /******************************/ - /* Tor PWM selection is wrong */ - /******************************/ - DPRINTK("Tor PWM selection is wrong\n"); - i_ReturnValue = -4; - } // if (b_PWM >= 0 && b_PWM <= 1) - } - else - { - /**********************************/ - /* The module is not a PWM module */ - /**********************************/ - DPRINTK("The module is not a PWM module\n"); - i_ReturnValue = -3; - } - } - else - { - /***********************/ - /* Module number error */ - /***********************/ - DPRINTK("Module number error\n"); - i_ReturnValue = -2; - } - - return (i_ReturnValue); - } - - - -/* -+----------------------------------------------------------------------------+ -| Function Name : _INT_ i_APCI1710_GetPWMInitialisation | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_PWM, | -| PBYTE_ pb_TimingUnit, | -| PULONG_ pul_LowTiming, | -| PULONG_ pul_HighTiming, | -| PBYTE_ pb_StartLevel, | -| PBYTE_ pb_StopMode, | -| PBYTE_ pb_StopLevel, | -| PBYTE_ pb_ExternGate, | -| PBYTE_ pb_InterruptEnable, | -| PBYTE_ pb_Enable) | -+----------------------------------------------------------------------------+ -| Task : Return the PWM (b_PWM) initialisation from selected | -| module (b_ModulNbr). You must calling the | -| "i_APCI1710_InitPWM" function be for you call this | -| function. | -+----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number (0 to 3) | -| BYTE_ b_PWM : Selected PWM (0 or 1) | -+----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_TimingUnit : Base timing Unit (0 to 4) | -| 0 : ns | -| 1 : æs | -| 2 : ms | -| 3 : s | -| 4 : mn | -| PULONG_ pul_LowTiming : Low base timing value. | -| PULONG_ pul_HighTiming : High base timing value. | -| PBYTE_ pb_StartLevel : Start period level | -| selection | -| 0 : The period start | -| with a low level | -| 1 : The period start | -| with a high level| -| PBYTE_ pb_StopMode : Stop mode selection | -| 0 : The PWM is stopped | -| directly after the | -| "i_APCI1710_DisablePWM"| -| function and break the| -| last period | -| 1 : After the | -| "i_APCI1710_DisablePWM"| -| function the PWM is | -| stopped at the end | -| from last period cycle| -| PBYTE_ pb_StopLevel : Stop PWM level selection | -| 0 : The output signal | -| keep the level after| -| the | -| "i_APCI1710_DisablePWM"| -| function | -| 1 : The output signal is| -| set to low after the| -| "i_APCI1710_DisablePWM"| -| function | -| 2 : The output signal is| -| set to high after | -| the | -| "i_APCI1710_DisablePWM"| -| function | -| PBYTE_ pb_ExternGate : Extern gate action | -| selection | -| 0 : Extern gate signal | -| not used. | -| 1 : Extern gate signal | -| used. | -| PBYTE_ pb_InterruptEnable : Enable or disable the PWM | -| interrupt. | -| - APCI1710_ENABLE : | -| Enable the PWM interrupt| -| A interrupt occur after | -| each period | -| - APCI1710_DISABLE : | -| Disable the PWM | -| interrupt | -| PBYTE_ pb_Enable : Indicate if the PWM is | -| enabled or no | -| 0 : PWM not enabled | -| 1 : PWM enabled | -+----------------------------------------------------------------------------+ -| Return Value : 0: No error | -| -1: The handle parameter of the board is wrong | -| -2: Module selection wrong | -| -3: The module is not a PWM module | -| -4: PWM selection is wrong | -| -5: PWM not initialised see function | -| "i_APCI1710_InitPWM" | -+----------------------------------------------------------------------------+ -*/ - -INT i_APCI1710_GetPWMInitialisation (comedi_device *dev, - BYTE b_ModulNbr, - BYTE b_PWM, - PBYTE pb_TimingUnit, - PULONG pul_LowTiming, - PULONG pul_HighTiming, - PBYTE pb_StartLevel, - PBYTE pb_StopMode, - PBYTE pb_StopLevel, - PBYTE pb_ExternGate, - PBYTE pb_InterruptEnable, - PBYTE pb_Enable) - { - INT i_ReturnValue = 0; - DWORD dw_Status; - DWORD dw_Command; - - - /**************************/ - /* Test the module number */ - /**************************/ - - if (b_ModulNbr < 4) - { - /***************/ - /* Test if PWM */ - /***************/ - - if ((devpriv-> - s_BoardInfos. - dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF0000UL) == APCI1710_PWM) - { - /**************************/ - /* Test the PWM selection */ - /**************************/ - - if (b_PWM >= 0 && b_PWM <= 1) - { - /***************************/ - /* Test if PWM initialised */ - /***************************/ - - dw_Status=inl(devpriv->s_BoardInfos. - ui_Address + 12 + (20 * b_PWM) + (64 * b_ModulNbr)); - - if (dw_Status & 0x10) - { - /***********************/ - /* Read the low timing */ - /***********************/ - - *pul_LowTiming = inl(devpriv->s_BoardInfos. - ui_Address + 0 + (20 * b_PWM) + (64 * b_ModulNbr)); - - /************************/ - /* Read the high timing */ - /************************/ - - *pul_HighTiming= inl(devpriv->s_BoardInfos. - ui_Address + 4 + (20 * b_PWM) + (64 * b_ModulNbr)); - - /********************/ - /* Read the command */ - /********************/ - - dw_Command = inl(devpriv->s_BoardInfos. - ui_Address + 8 + (20 * b_PWM) + (64 * b_ModulNbr)); - - *pb_StartLevel = (BYTE) ((dw_Command >> 5) & 1); - *pb_StopMode = (BYTE) ((dw_Command >> 0) & 1); - *pb_StopLevel = (BYTE) ((dw_Command >> 1) & 1); - *pb_ExternGate = (BYTE) ((dw_Command >> 4) & 1); - *pb_InterruptEnable = (BYTE) ((dw_Command >> 3) & 1); - - if (*pb_StopLevel) - { - *pb_StopLevel = *pb_StopLevel + (BYTE) ((dw_Command >> 2) & 1); - } - - /********************/ - /* Read the command */ - /********************/ - - dw_Command=inl(devpriv->s_BoardInfos. - ui_Address + 8 + (20 * b_PWM) + (64 * b_ModulNbr)); - - *pb_Enable = (BYTE) ((dw_Command >> 0) & 1); - - *pb_TimingUnit = devpriv-> - s_ModuleInfo [b_ModulNbr]. - s_PWMModuleInfo. - s_PWMInfo [b_PWM]. - b_TimingUnit; - } // if (dw_Status & 0x10) - else - { - /***********************/ - /* PWM not initialised */ - /***********************/ - DPRINTK("PWM not initialised\n"); - i_ReturnValue = -5; - } // if (dw_Status & 0x10) - } // if (b_PWM >= 0 && b_PWM <= 1) - else - { - /******************************/ - /* Tor PWM selection is wrong */ - /******************************/ - DPRINTK("Tor PWM selection is wrong\n"); - i_ReturnValue = -4; - } // if (b_PWM >= 0 && b_PWM <= 1) - } - else - { - /**********************************/ - /* The module is not a PWM module */ - /**********************************/ - DPRINTK("The module is not a PWM module\n"); - i_ReturnValue = -3; - } - } - else - { - /***********************/ - /* Module number error */ - /***********************/ - DPRINTK("Module number error\n"); - i_ReturnValue = -2; - } - - return (i_ReturnValue); - } - - - - - -/* -+----------------------------------------------------------------------------+ -| Function Name :INT i_APCI1710_InsnWritePWM(comedi_device *dev, -comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Pwm Enable Disable and Set New Timing | -+----------------------------------------------------------------------------+ -| Input Parameters : -+----------------------------------------------------------------------------+ -| Output Parameters : - | -+----------------------------------------------------------------------------+ -| Return Value : -+----------------------------------------------------------------------------+ -*/ - -INT i_APCI1710_InsnWritePWM(comedi_device *dev,comedi_subdevice *s, -comedi_insn *insn,lsampl_t *data) -{ - BYTE b_WriteType; - INT i_ReturnValue=0; - b_WriteType=CR_CHAN(insn->chanspec); - - switch(b_WriteType) - { - case APCI1710_PWM_ENABLE : - i_ReturnValue=i_APCI1710_EnablePWM (dev, - (BYTE) CR_AREF(insn->chanspec), - (BYTE) data[0], - (BYTE) data[1], - (BYTE) data[2], - (BYTE) data[3], - (BYTE) data[4], - (BYTE) data[5]); - break; - - case APCI1710_PWM_DISABLE : - i_ReturnValue=i_APCI1710_DisablePWM (dev, - (BYTE) CR_AREF(insn->chanspec), - (BYTE) data[0]); - break; - - case APCI1710_PWM_NEWTIMING: - i_ReturnValue=i_APCI1710_SetNewPWMTiming (dev, - (BYTE) CR_AREF(insn->chanspec), - (BYTE) data[0], - (BYTE) data[1], - (ULONG) data[2], - (ULONG) data[3]); - break; - - - default: - printk("Write Config Parameter Wrong\n"); - } - - if(i_ReturnValue>=0) i_ReturnValue =insn->n; - return (i_ReturnValue); -} - - - - - -/* -+----------------------------------------------------------------------------+ -| Function Name : _INT_ i_APCI1710_EnablePWM | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_PWM, | -| BYTE_ b_StartLevel, | -| BYTE_ b_StopMode, | -| BYTE_ b_StopLevel, | -| BYTE_ b_ExternGate, | -| BYTE_ b_InterruptEnable) | -+----------------------------------------------------------------------------+ -| Task : Enable the selected PWM (b_PWM) from selected module | -| (b_ModulNbr). You must calling the "i_APCI1710_InitPWM"| -| function be for you call this function. | -| If you enable the PWM interrupt, the PWM generate a | -| interrupt after each period. | -| See function "i_APCI1710_SetBoardIntRoutineX" and the | -| Interrupt mask description chapter. | -+----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number | -| (0 to 3) | -| BYTE_ b_PWM : Selected PWM (0 or 1) | -| BYTE_ b_StartLevel : Start period level selection | -| 0 : The period start with a | -| low level | -| 1 : The period start with a | -| high level | -| BYTE_ b_StopMode : Stop mode selection | -| 0 : The PWM is stopped | -| directly after the | -| "i_APCI1710_DisablePWM" | -| function and break the | -| last period | -| 1 : After the | -| "i_APCI1710_DisablePWM" | -| function the PWM is | -| stopped at the end from| -| last period cycle. | -| BYTE_ b_StopLevel : Stop PWM level selection | -| 0 : The output signal keep | -| the level after the | -| "i_APCI1710_DisablePWM" | -| function | -| 1 : The output signal is set| -| to low after the | -| "i_APCI1710_DisablePWM" | -| function | -| 2 : The output signal is set| -| to high after the | -| "i_APCI1710_DisablePWM" | -| function | -| BYTE_ b_ExternGate : Extern gate action selection | -| 0 : Extern gate signal not | -| used. | -| 1 : Extern gate signal used.| -| BYTE_ b_InterruptEnable : Enable or disable the PWM | -| interrupt. | -| - APCI1710_ENABLE : | -| Enable the PWM interrupt | -| A interrupt occur after | -| each period | -| - APCI1710_DISABLE : | -| Disable the PWM interrupt | -+----------------------------------------------------------------------------+ -| Output Parameters : - | -+----------------------------------------------------------------------------+ -| Return Value : 0: No error | -| -1: The handle parameter of the board is wrong | -| -2: Module selection wrong | -| -3: The module is not a PWM module | -| -4: PWM selection is wrong | -| -5: PWM not initialised see function | -| "i_APCI1710_InitPWM" | -| -6: PWM start level selection is wrong | -| -7: PWM stop mode selection is wrong | -| -8: PWM stop level selection is wrong | -| -9: Extern gate signal selection is wrong | -| -10: Interrupt parameter is wrong | -| -11: Interrupt function not initialised. | -| See function "i_APCI1710_SetBoardIntRoutineX" | -+----------------------------------------------------------------------------+ -*/ - -INT i_APCI1710_EnablePWM (comedi_device *dev, - BYTE b_ModulNbr, - BYTE b_PWM, - BYTE b_StartLevel, - BYTE b_StopMode, - BYTE b_StopLevel, - BYTE b_ExternGate, - BYTE b_InterruptEnable) - { - INT i_ReturnValue = 0; - DWORD dw_Status; - DWORD dw_Command; - - devpriv->tsk_Current=current; // Save the current process task structure - /**************************/ - /* Test the module number */ - /**************************/ - - if (b_ModulNbr < 4) - { - /***************/ - /* Test if PWM */ - /***************/ - - if ((devpriv-> - s_BoardInfos. - dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF0000UL) == APCI1710_PWM) - { - /**************************/ - /* Test the PWM selection */ - /**************************/ - - if (b_PWM >= 0 && b_PWM <= 1) - { - /***************************/ - /* Test if PWM initialised */ - /***************************/ - - dw_Status= inl(devpriv->s_BoardInfos. - ui_Address + 12 + (20 * b_PWM) + (64 * b_ModulNbr)); - - if (dw_Status & 0x10) - { - /**********************************/ - /* Test the start level selection */ - /**********************************/ - - if (b_StartLevel >= 0 && b_StartLevel <= 1) - { - /**********************/ - /* Test the stop mode */ - /**********************/ - - if (b_StopMode >= 0 && b_StopMode <= 1) - { - /***********************/ - /* Test the stop level */ - /***********************/ - - if (b_StopLevel >= 0 && b_StopLevel <= 2) - { - /*****************************/ - /* Test the extern gate mode */ - /*****************************/ - - if (b_ExternGate >= 0 && b_ExternGate <= 1) - { - /*****************************/ - /* Test the interrupt action */ - /*****************************/ - - if (b_InterruptEnable == APCI1710_ENABLE || b_InterruptEnable == APCI1710_DISABLE) - { - /******************************************/ - /* Test if interrupt function initialised */ - /******************************************/ - - /********************/ - /* Read the command */ - /********************/ - - dw_Command=inl(devpriv->s_BoardInfos. - ui_Address + 8 + (20 * b_PWM) + (64 * b_ModulNbr)); - - dw_Command = dw_Command & 0x80; - - /********************/ - /* Make the command */ - /********************/ - - dw_Command = dw_Command | b_StopMode | (b_InterruptEnable << 3) | (b_ExternGate << 4) | (b_StartLevel << 5); - - if (b_StopLevel & 3) - { - dw_Command = dw_Command | 2; - - if (b_StopLevel & 2) - { - dw_Command = dw_Command | 4; - } - } - - - devpriv-> - s_ModuleInfo [b_ModulNbr]. - s_PWMModuleInfo. - s_PWMInfo [b_PWM]. - b_InterruptEnable = b_InterruptEnable; - - /*******************/ - /* Set the command */ - /*******************/ - - outl(dw_Command,devpriv->s_BoardInfos. - ui_Address + 8 + (20 * b_PWM) + (64 * b_ModulNbr)); - - /******************/ - /* Enable the PWM */ - /******************/ - outl(1,devpriv->s_BoardInfos. - ui_Address + 12 + (20 * b_PWM) + (64 * b_ModulNbr)); - } // if (b_InterruptEnable == APCI1710_ENABLE || b_InterruptEnable == APCI1710_DISABLE) - else - { - /********************************/ - /* Interrupt parameter is wrong */ - /********************************/ - DPRINTK("Interrupt parameter is wrong\n"); - i_ReturnValue = -10; - } // if (b_InterruptEnable == APCI1710_ENABLE || b_InterruptEnable == APCI1710_DISABLE) - } // if (b_ExternGate >= 0 && b_ExternGate <= 1) - else - { - /*****************************************/ - /* Extern gate signal selection is wrong */ - /*****************************************/ - DPRINTK("Extern gate signal selection is wrong\n"); - i_ReturnValue = -9; - } // if (b_ExternGate >= 0 && b_ExternGate <= 1) - } // if (b_StopLevel >= 0 && b_StopLevel <= 2) - else - { - /*************************************/ - /* PWM stop level selection is wrong */ - /*************************************/ - DPRINTK("PWM stop level selection is wrong\n"); - i_ReturnValue = -8; - } // if (b_StopLevel >= 0 && b_StopLevel <= 2) - } // if (b_StopMode >= 0 && b_StopMode <= 1) - else - { - /************************************/ - /* PWM stop mode selection is wrong */ - /************************************/ - DPRINTK("PWM stop mode selection is wrong\n"); - i_ReturnValue = -7; - } // if (b_StopMode >= 0 && b_StopMode <= 1) - } // if (b_StartLevel >= 0 && b_StartLevel <= 1) - else - { - /**************************************/ - /* PWM start level selection is wrong */ - /**************************************/ - DPRINTK("PWM start level selection is wrong\n"); - i_ReturnValue = -6; - } // if (b_StartLevel >= 0 && b_StartLevel <= 1) - } // if (dw_Status & 0x10) - else - { - /***********************/ - /* PWM not initialised */ - /***********************/ - DPRINTK("PWM not initialised\n"); - i_ReturnValue = -5; - } // if (dw_Status & 0x10) - } // if (b_PWM >= 0 && b_PWM <= 1) - else - { - /******************************/ - /* Tor PWM selection is wrong */ - /******************************/ - DPRINTK("Tor PWM selection is wrong\n"); - i_ReturnValue = -4; - } // if (b_PWM >= 0 && b_PWM <= 1) - } - else - { - /**********************************/ - /* The module is not a PWM module */ - /**********************************/ - DPRINTK("The module is not a PWM module\n"); - i_ReturnValue = -3; - } - } - else - { - /***********************/ - /* Module number error */ - /***********************/ - DPRINTK("Module number error\n"); - i_ReturnValue = -2; - } - - return (i_ReturnValue); - } - -/* -+----------------------------------------------------------------------------+ -| Function Name : _INT_ i_APCI1710_DisablePWM (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_PWM) | -+----------------------------------------------------------------------------+ -| Task : Disable the selected PWM (b_PWM) from selected module | -| (b_ModulNbr). The output signal level depend of the | -| initialisation by the "i_APCI1710_EnablePWM". | -| See the b_StartLevel, b_StopMode and b_StopLevel | -| parameters from this function. | -+----------------------------------------------------------------------------+ -| Input Parameters :BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number (0 to 3) | -| BYTE_ b_PWM : Selected PWM (0 or 1) | -+----------------------------------------------------------------------------+ -| Output Parameters : - | -+----------------------------------------------------------------------------+ -| Return Value : 0: No error | -| -1: The handle parameter of the board is wrong | -| -2: Module selection wrong | -| -3: The module is not a PWM module | -| -4: PWM selection is wrong | -| -5: PWM not initialised see function | -| "i_APCI1710_InitPWM" | -| -6: PWM not enabled see function | -| "i_APCI1710_EnablePWM" | -+----------------------------------------------------------------------------+ -*/ - -INT i_APCI1710_DisablePWM (comedi_device *dev, - BYTE b_ModulNbr, - BYTE b_PWM) - { - INT i_ReturnValue = 0; - DWORD dw_Status; - - /**************************/ - /* Test the module number */ - /**************************/ - - if (b_ModulNbr < 4) - { - /***************/ - /* Test if PWM */ - /***************/ - - if ((devpriv->s_BoardInfos. - dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF0000UL) == APCI1710_PWM) - { - /**************************/ - /* Test the PWM selection */ - /**************************/ - - if (b_PWM >= 0 && b_PWM <= 1) - { - /***************************/ - /* Test if PWM initialised */ - /***************************/ - - dw_Status=inl(devpriv->s_BoardInfos. - ui_Address + 12 + (20 * b_PWM) + (64 * b_ModulNbr)); - - if (dw_Status & 0x10) - { - /***********************/ - /* Test if PWM enabled */ - /***********************/ - - if (dw_Status & 0x1) - { - /*******************/ - /* Disable the PWM */ - /*******************/ - outl(0,devpriv->s_BoardInfos. - ui_Address + 12 + (20 * b_PWM) + (64 * b_ModulNbr)); - } // if (dw_Status & 0x1) - else - { - /*******************/ - /* PWM not enabled */ - /*******************/ - DPRINTK("PWM not enabled\n"); - i_ReturnValue = -6; - } // if (dw_Status & 0x1) - } // if (dw_Status & 0x10) - else - { - /***********************/ - /* PWM not initialised */ - /***********************/ - DPRINTK(" PWM not initialised\n"); - i_ReturnValue = -5; - } // if (dw_Status & 0x10) - } // if (b_PWM >= 0 && b_PWM <= 1) - else - { - /******************************/ - /* Tor PWM selection is wrong */ - /******************************/ - DPRINTK("Tor PWM selection is wrong\n"); - i_ReturnValue = -4; - } // if (b_PWM >= 0 && b_PWM <= 1) - } - else - { - /**********************************/ - /* The module is not a PWM module */ - /**********************************/ - DPRINTK("The module is not a PWM module\n"); - i_ReturnValue = -3; - } - } - else - { - /***********************/ - /* Module number error */ - /***********************/ - DPRINTK("Module number error\n"); - i_ReturnValue = -2; - } - - return (i_ReturnValue); - } - -/* -+----------------------------------------------------------------------------+ -| Function Name : _INT_ i_APCI1710_SetNewPWMTiming | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_PWM, | -| BYTE_ b_ClockSelection, | -| BYTE_ b_TimingUnit, | -| ULONG_ ul_LowTiming, | -| ULONG_ ul_HighTiming) | -+----------------------------------------------------------------------------+ -| Task : Set a new timing. The ul_LowTiming, ul_HighTiming and | -| ul_TimingUnit determine the low/high timing base for | -| the period. | -+----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure| -| (0 to 3) | -| BYTE_ b_PWM : Selected PWM (0 or 1). | -| BYTE_ b_TimingUnit : Base timing Unit (0 to 4) | -| 0 : ns | -| 1 : æs | -| 2 : ms | -| 3 : s | -| 4 : mn | -| ULONG_ ul_LowTiming : Low base timing value. | -| ULONG_ ul_HighTiming : High base timing value. | -+----------------------------------------------------------------------------+ -| Output Parameters : - | -+----------------------------------------------------------------------------+ -| Return Value : 0: No error | -| -1: The handle parameter of the board is wrong | -| -2: Module selection wrong | -| -3: The module is not a PWM module | -| -4: PWM selection is wrong | -| -5: PWM not initialised | -| -6: Timing Unit selection is wrong | -| -7: Low base timing selection is wrong | -| -8: High base timing selection is wrong | -+----------------------------------------------------------------------------+ -*/ - -INT i_APCI1710_SetNewPWMTiming (comedi_device *dev, - BYTE b_ModulNbr, - BYTE b_PWM, - BYTE b_TimingUnit, - ULONG ul_LowTiming, - ULONG ul_HighTiming) - { - BYTE b_ClockSelection; - INT i_ReturnValue = 0; - ULONG ul_LowTimerValue; - ULONG ul_HighTimerValue; - ULONG ul_RealLowTiming; - ULONG ul_RealHighTiming; - DWORD dw_Status; - DWORD dw_Command; - double d_RealLowTiming; - double d_RealHighTiming; - - - - /**************************/ - /* Test the module number */ - /**************************/ - - if (b_ModulNbr < 4) - { - /***************/ - /* Test if PWM */ - /***************/ - - if ((devpriv->s_BoardInfos. - dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF0000UL) == APCI1710_PWM) - { - /**************************/ - /* Test the PWM selection */ - /**************************/ - - if (b_PWM >= 0 && b_PWM <= 1) - { - /***************************/ - /* Test if PWM initialised */ - /***************************/ - - dw_Status=inl(devpriv->s_BoardInfos. - ui_Address + 12 + (20 * b_PWM) + (64 * b_ModulNbr)); - - if (dw_Status & 0x10) - { - b_ClockSelection = devpriv-> - s_ModuleInfo [b_ModulNbr]. - s_PWMModuleInfo. - b_ClockSelection; - - /************************/ - /* Test the timing unit */ - /************************/ - - if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) - { - /*********************************/ - /* Test the low timing selection */ - /*********************************/ - - if (((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 0) && (ul_LowTiming >= 266) && (ul_LowTiming <= 0xFFFFFFFFUL)) || - ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 1) && (ul_LowTiming >= 1) && (ul_LowTiming <= 571230650UL)) || - ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 2) && (ul_LowTiming >= 1) && (ul_LowTiming <= 571230UL)) || - ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 3) && (ul_LowTiming >= 1) && (ul_LowTiming <= 571UL)) || - ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 4) && (ul_LowTiming >= 1) && (ul_LowTiming <= 9UL)) || - ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 0) && (ul_LowTiming >= 242) && (ul_LowTiming <= 0xFFFFFFFFUL)) || - ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 1) && (ul_LowTiming >= 1) && (ul_LowTiming <= 519691043UL)) || - ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 2) && (ul_LowTiming >= 1) && (ul_LowTiming <= 519691UL)) || - ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 3) && (ul_LowTiming >= 1) && (ul_LowTiming <= 520UL)) || - ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 4) && (ul_LowTiming >= 1) && (ul_LowTiming <= 8UL)) || - ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 0) && (ul_LowTiming >= 200) && (ul_LowTiming <= 0xFFFFFFFFUL)) || - ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 1) && (ul_LowTiming >= 1) && (ul_LowTiming <= 429496729UL)) || - ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 2) && (ul_LowTiming >= 1) && (ul_LowTiming <= 429496UL)) || - ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 3) && (ul_LowTiming >= 1) && (ul_LowTiming <= 429UL)) || - ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 4) && (ul_LowTiming >= 1) && (ul_LowTiming <= 7UL))) - { - /**********************************/ - /* Test the High timing selection */ - /**********************************/ - - if (((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 266) && (ul_HighTiming <= 0xFFFFFFFFUL)) || - ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571230650UL)) || - ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571230UL)) || - ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 571UL)) || - ((b_ClockSelection == APCI1710_30MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 9UL)) || - ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 242) && (ul_HighTiming <= 0xFFFFFFFFUL)) || - ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 519691043UL)) || - ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 519691UL)) || - ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 520UL)) || - ((b_ClockSelection == APCI1710_33MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 8UL)) || - ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 0) && (ul_HighTiming >= 200) && (ul_HighTiming <= 0xFFFFFFFFUL)) || - ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 1) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429496729UL)) || - ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 2) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429496UL)) || - ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 3) && (ul_HighTiming >= 1) && (ul_HighTiming <= 429UL)) || - ((b_ClockSelection == APCI1710_40MHZ) && (b_TimingUnit == 4) && (ul_HighTiming >= 1) && (ul_HighTiming <= 7UL))) - { - /************************************/ - /* Calculate the low division fator */ - /************************************/ - - switch (b_TimingUnit) - { - /******/ - /* ns */ - /******/ - - case 0: - - /******************/ - /* Timer 0 factor */ - /******************/ - - ul_LowTimerValue = (ULONG) (ul_LowTiming * (0.00025 * b_ClockSelection)); - - /*******************/ - /* Round the value */ - /*******************/ - - if ((double) ((double) ul_LowTiming * (0.00025 * (double) b_ClockSelection)) >= ((double) ((double) ul_LowTimerValue + 0.5))) - { - ul_LowTimerValue = ul_LowTimerValue + 1; - } - - /*****************************/ - /* Calculate the real timing */ - /*****************************/ - - ul_RealLowTiming = (ULONG) (ul_LowTimerValue / (0.00025 * (double) b_ClockSelection)); - d_RealLowTiming = (double) ul_LowTimerValue / (0.00025 * (double) b_ClockSelection); - - if ((double) ((double) ul_LowTimerValue / (0.00025 * (double) b_ClockSelection)) >= (double) ((double) ul_RealLowTiming + 0.5)) - { - ul_RealLowTiming = ul_RealLowTiming + 1; - } - - ul_LowTiming = ul_LowTiming - 1; - ul_LowTimerValue = ul_LowTimerValue - 2; - - if (b_ClockSelection != APCI1710_40MHZ) - { - ul_LowTimerValue = (ULONG) ((double) (ul_LowTimerValue) * 1.007752288); - } - - - break; - - /******/ - /* æs */ - /******/ - - case 1: - - /******************/ - /* Timer 0 factor */ - /******************/ - - ul_LowTimerValue = (ULONG) (ul_LowTiming * (0.25 * b_ClockSelection)); - - /*******************/ - /* Round the value */ - /*******************/ - - if ((double) ((double) ul_LowTiming * (0.25 * (double) b_ClockSelection)) >= ((double) ((double) ul_LowTimerValue + 0.5))) - { - ul_LowTimerValue = ul_LowTimerValue + 1; - } - - /*****************************/ - /* Calculate the real timing */ - /*****************************/ - - ul_RealLowTiming = (ULONG) (ul_LowTimerValue / (0.25 * (double) b_ClockSelection)); - d_RealLowTiming = (double) ul_LowTimerValue / ((double) 0.25 * (double) b_ClockSelection); - - if ((double) ((double) ul_LowTimerValue / (0.25 * (double) b_ClockSelection)) >= (double) ((double) ul_RealLowTiming + 0.5)) - { - ul_RealLowTiming = ul_RealLowTiming + 1; - } - - ul_LowTiming = ul_LowTiming - 1; - ul_LowTimerValue = ul_LowTimerValue - 2; - - if (b_ClockSelection != APCI1710_40MHZ) - { - ul_LowTimerValue = (ULONG) ((double) (ul_LowTimerValue) * 1.007752288); - } - - break; - - /******/ - /* ms */ - /******/ - - case 2: - - /******************/ - /* Timer 0 factor */ - /******************/ - - ul_LowTimerValue = ul_LowTiming * (250.0 * b_ClockSelection); - - /*******************/ - /* Round the value */ - /*******************/ - - if ((double) ((double) ul_LowTiming * (250.0 * (double) b_ClockSelection)) >= ((double) ((double) ul_LowTimerValue + 0.5))) - { - ul_LowTimerValue = ul_LowTimerValue + 1; - } - - /*****************************/ - /* Calculate the real timing */ - /*****************************/ - - ul_RealLowTiming = (ULONG) (ul_LowTimerValue / (250.0 * (double) b_ClockSelection)); - d_RealLowTiming = (double) ul_LowTimerValue / (250.0 * (double) b_ClockSelection); - - if ((double) ((double) ul_LowTimerValue / (250.0 * (double) b_ClockSelection)) >= (double) ((double) ul_RealLowTiming + 0.5)) - { - ul_RealLowTiming = ul_RealLowTiming + 1; - } - - ul_LowTiming = ul_LowTiming - 1; - ul_LowTimerValue = ul_LowTimerValue - 2; - - if (b_ClockSelection != APCI1710_40MHZ) - { - ul_LowTimerValue = (ULONG) ((double) (ul_LowTimerValue) * 1.007752288); - } - - break; - - /*****/ - /* s */ - /*****/ - - case 3: - - /******************/ - /* Timer 0 factor */ - /******************/ - - ul_LowTimerValue = (ULONG) (ul_LowTiming * (250000.0 * b_ClockSelection)); - - /*******************/ - /* Round the value */ - /*******************/ - - if ((double) ((double) ul_LowTiming * (250000.0 * (double) b_ClockSelection)) >= ((double) ((double) ul_LowTimerValue + 0.5))) - { - ul_LowTimerValue = ul_LowTimerValue + 1; - } - - /*****************************/ - /* Calculate the real timing */ - /*****************************/ - - ul_RealLowTiming = (ULONG) (ul_LowTimerValue / (250000.0 * (double) b_ClockSelection)); - d_RealLowTiming = (double) ul_LowTimerValue / (250000.0 * (double) b_ClockSelection); - - if ((double) ((double) ul_LowTimerValue / (250000.0 * (double) b_ClockSelection)) >= (double) ((double) ul_RealLowTiming + 0.5)) - { - ul_RealLowTiming = ul_RealLowTiming + 1; - } - - ul_LowTiming = ul_LowTiming - 1; - ul_LowTimerValue = ul_LowTimerValue - 2; - - if (b_ClockSelection != APCI1710_40MHZ) - { - ul_LowTimerValue = (ULONG) ((double) (ul_LowTimerValue) * 1.007752288); - } - - break; - - /******/ - /* mn */ - /******/ - - case 4: - - /******************/ - /* Timer 0 factor */ - /******************/ - - ul_LowTimerValue = (ULONG) ((ul_LowTiming * 60) * (250000.0 * b_ClockSelection)); - - /*******************/ - /* Round the value */ - /*******************/ - - if ((double) ((double) (ul_LowTiming * 60.0) * (250000.0 * (double) b_ClockSelection)) >= ((double) ((double) ul_LowTimerValue + 0.5))) - { - ul_LowTimerValue = ul_LowTimerValue + 1; - } - - /*****************************/ - /* Calculate the real timing */ - /*****************************/ - - ul_RealLowTiming = (ULONG) (ul_LowTimerValue / (250000.0 * (double) b_ClockSelection)) / 60; - d_RealLowTiming = ((double) ul_LowTimerValue / (250000.0 * (double) b_ClockSelection)) / 60.0; - - if ((double) (((double) ul_LowTimerValue / (250000.0 * (double) b_ClockSelection)) / 60.0) >= (double) ((double) ul_RealLowTiming + 0.5)) - { - ul_RealLowTiming = ul_RealLowTiming + 1; - } - - ul_LowTiming = ul_LowTiming - 1; - ul_LowTimerValue = ul_LowTimerValue - 2; - - if (b_ClockSelection != APCI1710_40MHZ) - { - ul_LowTimerValue = (ULONG) ((double) (ul_LowTimerValue) * 1.007752288); - } - - break; - } - - /*************************************/ - /* Calculate the high division fator */ - /*************************************/ - - switch (b_TimingUnit) - { - /******/ - /* ns */ - /******/ - - case 0: - - /******************/ - /* Timer 0 factor */ - /******************/ - - ul_HighTimerValue = (ULONG) (ul_HighTiming * (0.00025 * b_ClockSelection)); - - /*******************/ - /* Round the value */ - /*******************/ - - if ((double) ((double) ul_HighTiming * (0.00025 * (double) b_ClockSelection)) >= ((double) ((double) ul_HighTimerValue + 0.5))) - { - ul_HighTimerValue = ul_HighTimerValue + 1; - } - - /*****************************/ - /* Calculate the real timing */ - /*****************************/ - - ul_RealHighTiming = (ULONG) (ul_HighTimerValue / (0.00025 * (double) b_ClockSelection)); - d_RealHighTiming = (double) ul_HighTimerValue / (0.00025 * (double) b_ClockSelection); - - if ((double) ((double) ul_HighTimerValue / (0.00025 * (double) b_ClockSelection)) >= (double) ((double) ul_RealHighTiming + 0.5)) - { - ul_RealHighTiming = ul_RealHighTiming + 1; - } - - ul_HighTiming = ul_HighTiming - 1; - ul_HighTimerValue = ul_HighTimerValue - 2; - - if (b_ClockSelection != APCI1710_40MHZ) - { - ul_HighTimerValue = (ULONG) ((double) (ul_HighTimerValue) * 1.007752288); - } - - - break; - - /******/ - /* æs */ - /******/ - - case 1: - - /******************/ - /* Timer 0 factor */ - /******************/ - - ul_HighTimerValue = (ULONG) (ul_HighTiming * (0.25 * b_ClockSelection)); - - /*******************/ - /* Round the value */ - /*******************/ - - if ((double) ((double) ul_HighTiming * (0.25 * (double) b_ClockSelection)) >= ((double) ((double) ul_HighTimerValue + 0.5))) - { - ul_HighTimerValue = ul_HighTimerValue + 1; - } - - /*****************************/ - /* Calculate the real timing */ - /*****************************/ - - ul_RealHighTiming = (ULONG) (ul_HighTimerValue / (0.25 * (double) b_ClockSelection)); - d_RealHighTiming = (double) ul_HighTimerValue / ((double) 0.25 * (double) b_ClockSelection); - - if ((double) ((double) ul_HighTimerValue / (0.25 * (double) b_ClockSelection)) >= (double) ((double) ul_RealHighTiming + 0.5)) - { - ul_RealHighTiming = ul_RealHighTiming + 1; - } - - ul_HighTiming = ul_HighTiming - 1; - ul_HighTimerValue = ul_HighTimerValue - 2; - - if (b_ClockSelection != APCI1710_40MHZ) - { - ul_HighTimerValue = (ULONG) ((double) (ul_HighTimerValue) * 1.007752288); - } - - break; - - /******/ - /* ms */ - /******/ - - case 2: - - /******************/ - /* Timer 0 factor */ - /******************/ - - ul_HighTimerValue = ul_HighTiming * (250.0 * b_ClockSelection); - - /*******************/ - /* Round the value */ - /*******************/ - - if ((double) ((double) ul_HighTiming * (250.0 * (double) b_ClockSelection)) >= ((double) ((double) ul_HighTimerValue + 0.5))) - { - ul_HighTimerValue = ul_HighTimerValue + 1; - } - - /*****************************/ - /* Calculate the real timing */ - /*****************************/ - - ul_RealHighTiming = (ULONG) (ul_HighTimerValue / (250.0 * (double) b_ClockSelection)); - d_RealHighTiming = (double) ul_HighTimerValue / (250.0 * (double) b_ClockSelection); - - if ((double) ((double) ul_HighTimerValue / (250.0 * (double) b_ClockSelection)) >= (double) ((double) ul_RealHighTiming + 0.5)) - { - ul_RealHighTiming = ul_RealHighTiming + 1; - } - - ul_HighTiming = ul_HighTiming - 1; - ul_HighTimerValue = ul_HighTimerValue - 2; - - if (b_ClockSelection != APCI1710_40MHZ) - { - ul_HighTimerValue = (ULONG) ((double) (ul_HighTimerValue) * 1.007752288); - } - - break; - - /*****/ - /* s */ - /*****/ - - case 3: - - /******************/ - /* Timer 0 factor */ - /******************/ - - ul_HighTimerValue = (ULONG) (ul_HighTiming * (250000.0 * b_ClockSelection)); - - /*******************/ - /* Round the value */ - /*******************/ - - if ((double) ((double) ul_HighTiming * (250000.0 * (double) b_ClockSelection)) >= ((double) ((double) ul_HighTimerValue + 0.5))) - { - ul_HighTimerValue = ul_HighTimerValue + 1; - } - - /*****************************/ - /* Calculate the real timing */ - /*****************************/ - - ul_RealHighTiming = (ULONG) (ul_HighTimerValue / (250000.0 * (double) b_ClockSelection)); - d_RealHighTiming = (double) ul_HighTimerValue / (250000.0 * (double) b_ClockSelection); - - if ((double) ((double) ul_HighTimerValue / (250000.0 * (double) b_ClockSelection)) >= (double) ((double) ul_RealHighTiming + 0.5)) - { - ul_RealHighTiming = ul_RealHighTiming + 1; - } - - ul_HighTiming = ul_HighTiming - 1; - ul_HighTimerValue = ul_HighTimerValue - 2; - - if (b_ClockSelection != APCI1710_40MHZ) - { - ul_HighTimerValue = (ULONG) ((double) (ul_HighTimerValue) * 1.007752288); - } - - break; - - /******/ - /* mn */ - /******/ - - case 4: - - /******************/ - /* Timer 0 factor */ - /******************/ - - ul_HighTimerValue = (ULONG) ((ul_HighTiming * 60) * (250000.0 * b_ClockSelection)); - - /*******************/ - /* Round the value */ - /*******************/ - - if ((double) ((double) (ul_HighTiming * 60.0) * (250000.0 * (double) b_ClockSelection)) >= ((double) ((double) ul_HighTimerValue + 0.5))) - { - ul_HighTimerValue = ul_HighTimerValue + 1; - } - - /*****************************/ - /* Calculate the real timing */ - /*****************************/ - - ul_RealHighTiming = (ULONG) (ul_HighTimerValue / (250000.0 * (double) b_ClockSelection)) / 60; - d_RealHighTiming = ((double) ul_HighTimerValue / (250000.0 * (double) b_ClockSelection)) / 60.0; - - if ((double) (((double) ul_HighTimerValue / (250000.0 * (double) b_ClockSelection)) / 60.0) >= (double) ((double) ul_RealHighTiming + 0.5)) - { - ul_RealHighTiming = ul_RealHighTiming + 1; - } - - ul_HighTiming = ul_HighTiming - 1; - ul_HighTimerValue = ul_HighTimerValue - 2; - - if (b_ClockSelection != APCI1710_40MHZ) - { - ul_HighTimerValue = (ULONG) ((double) (ul_HighTimerValue) * 1.007752288); - } - - break; - } - /************************/ - /* Save the timing unit */ - /************************/ - - devpriv-> - s_ModuleInfo [b_ModulNbr]. - s_PWMModuleInfo. - s_PWMInfo [b_PWM]. - b_TimingUnit = b_TimingUnit; - - /****************************/ - /* Save the low base timing */ - /****************************/ - - devpriv-> - s_ModuleInfo [b_ModulNbr]. - s_PWMModuleInfo. - s_PWMInfo [b_PWM]. - d_LowTiming = d_RealLowTiming; - - devpriv-> - s_ModuleInfo [b_ModulNbr]. - s_PWMModuleInfo. - s_PWMInfo [b_PWM]. - ul_RealLowTiming = ul_RealLowTiming; - - /****************************/ - /* Save the high base timing */ - /****************************/ - - devpriv-> - s_ModuleInfo [b_ModulNbr]. - s_PWMModuleInfo. - s_PWMInfo [b_PWM]. - d_HighTiming = d_RealHighTiming; - - devpriv-> - s_ModuleInfo [b_ModulNbr]. - s_PWMModuleInfo. - s_PWMInfo [b_PWM]. - ul_RealHighTiming = ul_RealHighTiming; - - /************************/ - /* Write the low timing */ - /************************/ - - outl(ul_LowTimerValue,devpriv->s_BoardInfos. - ui_Address + 0 + (20 * b_PWM) + (64 * b_ModulNbr)); - - /*************************/ - /* Write the high timing */ - /*************************/ - - outl(ul_HighTimerValue,devpriv->s_BoardInfos. - ui_Address + 4 + (20 * b_PWM) + (64 * b_ModulNbr)); - - /***************************/ - /* Set the clock selection */ - /***************************/ - - dw_Command=inl(devpriv->s_BoardInfos. - ui_Address + 8 + (20 * b_PWM) + (64 * b_ModulNbr)); - - dw_Command = dw_Command & 0x7F; - - if (b_ClockSelection == APCI1710_40MHZ) - { - dw_Command = dw_Command | 0x80; - } - - /***************************/ - /* Set the clock selection */ - /***************************/ - - outl(dw_Command,devpriv->s_BoardInfos. - ui_Address + 8 + (20 * b_PWM) + (64 * b_ModulNbr)); - } - else - { - /***************************************/ - /* High base timing selection is wrong */ - /***************************************/ - DPRINTK("High base timing selection is wrong\n"); - i_ReturnValue = -8; - } - } - else - { - /**************************************/ - /* Low base timing selection is wrong */ - /**************************************/ - DPRINTK("Low base timing selection is wrong\n"); - i_ReturnValue = -7; - } - } // if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) - else - { - /**********************************/ - /* Timing unit selection is wrong */ - /**********************************/ - DPRINTK("Timing unit selection is wrong\n"); - i_ReturnValue = -6; - } // if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) - } // if (dw_Status & 0x10) - else - { - /***********************/ - /* PWM not initialised */ - /***********************/ - DPRINTK("PWM not initialised\n"); - i_ReturnValue = -5; - } // if (dw_Status & 0x10) - } // if (b_PWM >= 0 && b_PWM <= 1) - else - { - /******************************/ - /* Tor PWM selection is wrong */ - /******************************/ - DPRINTK("Tor PWM selection is wrong\n"); - i_ReturnValue = -4; - } // if (b_PWM >= 0 && b_PWM <= 1) - } - else - { - /**********************************/ - /* The module is not a PWM module */ - /**********************************/ - DPRINTK("The module is not a PWM module\n"); - i_ReturnValue = -3; - } - } - else - { - /***********************/ - /* Module number error */ - /***********************/ - DPRINTK("Module number error\n"); - i_ReturnValue = -2; - } - - return (i_ReturnValue); - } - - @@ -2416,7 +2445,7 @@ INT i_APCI1710_InsnReadGetPWMStatus(comedi_device *dev,comedi_subdevice *s, /* Test the PWM selection */ /**************************/ - if (b_PWM >= 0 && b_PWM <= 1) + if (b_PWM <= 1) { /***************************/ /* Test if PWM initialised */ @@ -2441,7 +2470,8 @@ INT i_APCI1710_InsnReadGetPWMStatus(comedi_device *dev,comedi_subdevice *s, /*******************/ /* PWM not enabled */ /*******************/ - DPRINTK("PWM not enabled \n"); + + DPRINTK("PWM not enabled \n"); i_ReturnValue = -6; } // if (dw_Status & 0x1) } // if (dw_Status & 0x10) @@ -2450,7 +2480,8 @@ INT i_APCI1710_InsnReadGetPWMStatus(comedi_device *dev,comedi_subdevice *s, /***********************/ /* PWM not initialised */ /***********************/ - DPRINTK("PWM not initialised\n"); + + DPRINTK("PWM not initialised\n"); i_ReturnValue = -5; } // if (dw_Status & 0x10) } // if (b_PWM >= 0 && b_PWM <= 1) @@ -2459,7 +2490,8 @@ INT i_APCI1710_InsnReadGetPWMStatus(comedi_device *dev,comedi_subdevice *s, /******************************/ /* Tor PWM selection is wrong */ /******************************/ - DPRINTK("Tor PWM selection is wrong\n"); + + DPRINTK("Tor PWM selection is wrong\n"); i_ReturnValue = -4; } // if (b_PWM >= 0 && b_PWM <= 1) } @@ -2468,7 +2500,8 @@ INT i_APCI1710_InsnReadGetPWMStatus(comedi_device *dev,comedi_subdevice *s, /**********************************/ /* The module is not a PWM module */ /**********************************/ - DPRINTK("The module is not a PWM module\n"); + + DPRINTK("The module is not a PWM module\n"); i_ReturnValue = -3; } } @@ -2477,41 +2510,43 @@ INT i_APCI1710_InsnReadGetPWMStatus(comedi_device *dev,comedi_subdevice *s, /***********************/ /* Module number error */ /***********************/ - DPRINTK("Module number error\n"); + + DPRINTK("Module number error\n"); i_ReturnValue = -2; } return (i_ReturnValue); } - -INT i_APCI1710_InsnBitsReadPWMInterrupt(comedi_device *dev,comedi_subdevice *s, - comedi_insn *insn,lsampl_t *data) -{ - data[0]=devpriv->s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Read].b_OldModuleMask; - data[1]=devpriv->s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Read].ul_OldInterruptMask; - data[2]=devpriv->s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Read].ul_OldCounterLatchValue; - - - /**************************/ - /* Increment the read FIFO */ - /***************************/ - - devpriv-> - s_InterruptParameters. - ui_Read = (devpriv-> - s_InterruptParameters. - ui_Read + 1) % APCI1710_SAVE_INTERRUPT; - - return insn->n; - -} + +INT i_APCI1710_InsnBitsReadPWMInterrupt(comedi_device *dev,comedi_subdevice *s, + comedi_insn *insn,lsampl_t *data) + +{ + data[0]=devpriv->s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Read].b_OldModuleMask; + data[1]=devpriv->s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Read].ul_OldInterruptMask; + data[2]=devpriv->s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Read].ul_OldCounterLatchValue; + + + /**************************/ + /* Increment the read FIFO */ + /***************************/ + + devpriv-> + s_InterruptParameters. + ui_Read = (devpriv-> + s_InterruptParameters. + ui_Read + 1) % APCI1710_SAVE_INTERRUPT; + + return insn->n; + +} diff --git a/comedi/drivers/addi-data/APCI1710_Pwm.h b/comedi/drivers/addi-data/APCI1710_Pwm.h index f6e265bc..e5f67e19 100644 --- a/comedi/drivers/addi-data/APCI1710_Pwm.h +++ b/comedi/drivers/addi-data/APCI1710_Pwm.h @@ -1,12 +1,35 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ + + - - #define APCI1710_30MHZ 30 #define APCI1710_33MHZ 33 #define APCI1710_40MHZ 40 - + #define APCI1710_PWM_INIT 0 #define APCI1710_PWM_GETINITDATA 1 @@ -14,65 +37,65 @@ #define APCI1710_PWM_DISABLE 0 #define APCI1710_PWM_ENABLE 1 #define APCI1710_PWM_NEWTIMING 2 - - - - -INT i_APCI1710_InsnConfigPWM(comedi_device *dev,comedi_subdevice *s, -comedi_insn *insn,lsampl_t *data); - -INT i_APCI1710_InitPWM (comedi_device *dev, - BYTE b_ModulNbr, - BYTE b_PWM, - BYTE b_ClockSelection, - BYTE b_TimingUnit, - ULONG ul_LowTiming, - ULONG ul_HighTiming, - PULONG pul_RealLowTiming, - PULONG pul_RealHighTiming); - -INT i_APCI1710_GetPWMInitialisation (comedi_device *dev, - BYTE b_ModulNbr, - BYTE b_PWM, - PBYTE pb_TimingUnit, - PULONG pul_LowTiming, - PULONG pul_HighTiming, - PBYTE pb_StartLevel, - PBYTE pb_StopMode, - PBYTE pb_StopLevel, - PBYTE pb_ExternGate, - PBYTE pb_InterruptEnable, - PBYTE pb_Enable); - - - - -INT i_APCI1710_InsnWritePWM(comedi_device *dev,comedi_subdevice *s, -comedi_insn *insn,lsampl_t *data); - -INT i_APCI1710_EnablePWM (comedi_device *dev, - BYTE b_ModulNbr, - BYTE b_PWM, - BYTE b_StartLevel, - BYTE b_StopMode, - BYTE b_StopLevel, - BYTE b_ExternGate, - BYTE b_InterruptEnable); - -INT i_APCI1710_SetNewPWMTiming (comedi_device *dev, - BYTE b_ModulNbr, - BYTE b_PWM, - BYTE b_TimingUnit, - ULONG ul_LowTiming, - ULONG ul_HighTiming); - -INT i_APCI1710_DisablePWM (comedi_device *dev, - BYTE b_ModulNbr, - BYTE b_PWM); + + + + +INT i_APCI1710_InsnConfigPWM(comedi_device *dev,comedi_subdevice *s, +comedi_insn *insn,lsampl_t *data); + +INT i_APCI1710_InitPWM (comedi_device *dev, + BYTE b_ModulNbr, + BYTE b_PWM, + BYTE b_ClockSelection, + BYTE b_TimingUnit, + ULONG ul_LowTiming, + ULONG ul_HighTiming, + PULONG pul_RealLowTiming, + PULONG pul_RealHighTiming); + +INT i_APCI1710_GetPWMInitialisation (comedi_device *dev, + BYTE b_ModulNbr, + BYTE b_PWM, + PBYTE pb_TimingUnit, + PULONG pul_LowTiming, + PULONG pul_HighTiming, + PBYTE pb_StartLevel, + PBYTE pb_StopMode, + PBYTE pb_StopLevel, + PBYTE pb_ExternGate, + PBYTE pb_InterruptEnable, + PBYTE pb_Enable); + + + + +INT i_APCI1710_InsnWritePWM(comedi_device *dev,comedi_subdevice *s, +comedi_insn *insn,lsampl_t *data); + +INT i_APCI1710_EnablePWM (comedi_device *dev, + BYTE b_ModulNbr, + BYTE b_PWM, + BYTE b_StartLevel, + BYTE b_StopMode, + BYTE b_StopLevel, + BYTE b_ExternGate, + BYTE b_InterruptEnable); + +INT i_APCI1710_SetNewPWMTiming (comedi_device *dev, + BYTE b_ModulNbr, + BYTE b_PWM, + BYTE b_TimingUnit, + ULONG ul_LowTiming, + ULONG ul_HighTiming); + +INT i_APCI1710_DisablePWM (comedi_device *dev, + BYTE b_ModulNbr, + BYTE b_PWM); INT i_APCI1710_InsnReadGetPWMStatus(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data); - -INT i_APCI1710_InsnBitsReadPWMInterrupt(comedi_device *dev,comedi_subdevice *s, - comedi_insn *insn,lsampl_t *data); + +INT i_APCI1710_InsnBitsReadPWMInterrupt(comedi_device *dev,comedi_subdevice *s, + comedi_insn *insn,lsampl_t *data); diff --git a/comedi/drivers/addi-data/APCI1710_Ssi.c b/comedi/drivers/addi-data/APCI1710_Ssi.c index 99282f72..8c605418 100644 --- a/comedi/drivers/addi-data/APCI1710_Ssi.c +++ b/comedi/drivers/addi-data/APCI1710_Ssi.c @@ -1,14 +1,38 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ /* + +-----------------------------------------------------------------------+ | (C) ADDI-DATA GmbH Dieselstraße 3 D-77833 Ottersweier | +-----------------------------------------------------------------------+ | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | +-----------------------------------------------------------------------+ - | Project : API APCI1710 | Compiler : BORLANDC/MICROSOFT C | - | Module name : SSI.C | Version : 3.1 / 6.0 | + | Project : API APCI1710 | Compiler : gcc | + | Module name : SSI.C | Version : 2.96 | +-------------------------------+---------------------------------------+ - | Author : S.WEBER | Date : 14.01.98 | + | Project manager: Eric Stolz | Date : 02/12/2002 | +-----------------------------------------------------------------------+ | Description : APCI-1710 SSI counter module | | | @@ -109,7 +133,7 @@ | -9: The selected SSI counting mode parameter is wrong | +----------------------------------------------------------------------------+ */ - + INT i_APCI1710_InsnConfigInitSSI(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data) @@ -206,12 +230,12 @@ INT i_APCI1710_InsnConfigInitSSI(comedi_device *dev,comedi_subdevice *s, if (b_SSICountingMode == APCI1710_BINARY_MODE) { - + outl(b_SSIProfile + 1,devpriv->s_BoardInfos.ui_Address + 4 + (64 * b_ModulNbr)); } else { - + outl(b_SSIProfile,devpriv->s_BoardInfos.ui_Address + 4 + (64 * b_ModulNbr)); } @@ -242,7 +266,8 @@ INT i_APCI1710_InsnConfigInitSSI(comedi_device *dev,comedi_subdevice *s, /*****************************************************/ /* The selected SSI counting mode parameter is wrong */ /*****************************************************/ - DPRINTK("The selected SSI counting mode parameter is wrong\n"); + + DPRINTK("The selected SSI counting mode parameter is wrong\n"); i_ReturnValue = -9; } } @@ -251,7 +276,8 @@ INT i_APCI1710_InsnConfigInitSSI(comedi_device *dev,comedi_subdevice *s, /******************************************/ /* The selected SSI output clock is wrong */ /******************************************/ - DPRINTK("The selected SSI output clock is wrong\n"); + + DPRINTK("The selected SSI output clock is wrong\n"); i_ReturnValue = -8; } } @@ -260,7 +286,8 @@ INT i_APCI1710_InsnConfigInitSSI(comedi_device *dev,comedi_subdevice *s, /*****************************************/ /* The selected PCI input clock is wrong */ /*****************************************/ - DPRINTK("The selected PCI input clock is wrong\n"); + + DPRINTK("The selected PCI input clock is wrong\n"); i_ReturnValue = -7; } } @@ -269,7 +296,8 @@ INT i_APCI1710_InsnConfigInitSSI(comedi_device *dev,comedi_subdevice *s, /********************************************/ /* The selected SSI profile length is wrong */ /********************************************/ - DPRINTK("The selected SSI profile length is wrong\n"); + + DPRINTK("The selected SSI profile length is wrong\n"); i_ReturnValue = -4; } } @@ -278,7 +306,8 @@ INT i_APCI1710_InsnConfigInitSSI(comedi_device *dev,comedi_subdevice *s, /******************************************************/ /* The selected SSI turn counter data length is wrong */ /******************************************************/ - DPRINTK("The selected SSI turn counter data length is wrong\n"); + + DPRINTK("The selected SSI turn counter data length is wrong\n"); i_ReturnValue = -6; } } @@ -287,7 +316,8 @@ INT i_APCI1710_InsnConfigInitSSI(comedi_device *dev,comedi_subdevice *s, /**************************************************/ /* The selected SSI position data length is wrong */ /**************************************************/ - DPRINTK("The selected SSI position data length is wrong\n"); + + DPRINTK("The selected SSI position data length is wrong\n"); i_ReturnValue = -5; } } @@ -296,7 +326,8 @@ INT i_APCI1710_InsnConfigInitSSI(comedi_device *dev,comedi_subdevice *s, /********************************************/ /* The selected SSI profile length is wrong */ /********************************************/ - DPRINTK("The selected SSI profile length is wrong\n"); + + DPRINTK("The selected SSI profile length is wrong\n"); i_ReturnValue = -4; } } @@ -305,7 +336,8 @@ INT i_APCI1710_InsnConfigInitSSI(comedi_device *dev,comedi_subdevice *s, /**********************************/ /* The module is not a SSI module */ /**********************************/ - DPRINTK("The module is not a SSI module\n"); + + DPRINTK("The module is not a SSI module\n"); i_ReturnValue = -3; } } @@ -314,7 +346,8 @@ INT i_APCI1710_InsnConfigInitSSI(comedi_device *dev,comedi_subdevice *s, /***********************/ /* Module number error */ /***********************/ - DPRINTK("Module number error\n"); + + DPRINTK("Module number error\n"); i_ReturnValue = -2; } @@ -387,15 +420,17 @@ pul_Position = (PULONG) &data[0]; BYTE b_ReadType; PULONG pul_Position; PULONG pul_TurnCpt; - PULONG pul_Position1; - PULONG pul_TurnCpt1; - + PULONG pul_Position1; + PULONG pul_TurnCpt1; + i_ReturnValue = insn->n; - pul_Position1 = (PULONG) &data[0]; // For Read1 - pul_TurnCpt1 = (PULONG) &data[1]; // For Read all - pul_Position = (PULONG) &data[0];//0-2 - pul_TurnCpt = (PULONG) &data[3];//3-5 + pul_Position1 = (PULONG) &data[0]; +// For Read1 + pul_TurnCpt1 = (PULONG) &data[1]; +// For Read all + pul_Position = (PULONG) &data[0];//0-2 + pul_TurnCpt = (PULONG) &data[3];//3-5 b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); b_SelectedSSI = (BYTE) CR_CHAN(insn->chanspec); b_ReadType = (BYTE) CR_RANGE(insn->chanspec); @@ -435,7 +470,8 @@ pul_Position = (PULONG) &data[0]; /************************/ /* Start the conversion */ /************************/ - + + outl(0,devpriv->s_BoardInfos.ui_Address + 8 + (64 * b_ModulNbr)); @@ -452,7 +488,7 @@ pul_Position = (PULONG) &data[0]; /******************************/ /* Read the SSI counter value */ /******************************/ - + dw_CounterValue = inl(devpriv->s_BoardInfos.ui_Address + 4 + (b_SelectedSSI * 4) + (64 * b_ModulNbr)); b_Length = devpriv->s_ModuleInfo [b_ModulNbr].s_SSICounterInfo.b_SSIProfile / 2; @@ -498,7 +534,8 @@ pul_Position = (PULONG) &data[0]; /*****************************/ /* The selected SSI is wrong */ /*****************************/ - DPRINTK("The selected SSI is wrong\n"); + + DPRINTK("The selected SSI is wrong\n"); i_ReturnValue = -5; } break; @@ -525,7 +562,7 @@ pul_Position = (PULONG) &data[0]; /************************/ /* Start the conversion */ /************************/ - + outl(0,devpriv->s_BoardInfos.ui_Address + 8 + (64 * b_ModulNbr)); do @@ -582,7 +619,8 @@ pul_Position = (PULONG) &data[0]; /***********************/ /* SSI not initialised */ /***********************/ - DPRINTK("SSI not initialised\n"); + + DPRINTK("SSI not initialised\n"); i_ReturnValue = -4; } } @@ -591,8 +629,10 @@ pul_Position = (PULONG) &data[0]; /**********************************/ /* The module is not a SSI module */ /**********************************/ - DPRINTK("The module is not a SSI module\n"); - i_ReturnValue = -3; + + DPRINTK("The module is not a SSI module\n"); + i_ReturnValue = -3; + } } else @@ -600,7 +640,8 @@ pul_Position = (PULONG) &data[0]; /***********************/ /* Module number error */ /***********************/ - DPRINTK("Module number error\n"); + + DPRINTK("Module number error\n"); i_ReturnValue = -2; } @@ -658,7 +699,7 @@ lsampl_t *data) DWORD dw_StatusReg; BYTE b_ModulNbr; BYTE b_InputChannel; - PBYTE pb_ChannelStatus; + PBYTE pb_ChannelStatus; PBYTE pb_InputStatus; BYTE b_IOType; i_ReturnValue = insn->n; @@ -685,7 +726,7 @@ lsampl_t *data) /* Set the digital output ON */ /*****************************/ - + outl(1,devpriv->s_BoardInfos.ui_Address + 16 + (64 * b_ModulNbr)); break ; @@ -694,7 +735,7 @@ lsampl_t *data) /* Set the digital output OFF */ /******************************/ - + outl(0,devpriv->s_BoardInfos.ui_Address + 16 + (64 * b_ModulNbr)); break ; @@ -708,7 +749,7 @@ lsampl_t *data) b_InputChannel = (BYTE) CR_CHAN(insn->chanspec); pb_ChannelStatus = (PBYTE) &data[0]; - if ((b_InputChannel >= 0) && (b_InputChannel <= 2)) + if (b_InputChannel <= 2) { /**************************/ /* Read all digital input */ @@ -723,7 +764,8 @@ lsampl_t *data) /********************************/ /* Selected digital input error */ /********************************/ - DPRINTK("Selected digital input error\n"); + + DPRINTK("Selected digital input error\n"); i_ReturnValue = -4; } break; @@ -741,7 +783,7 @@ lsampl_t *data) default : printk("IO type wrong\n"); - + } //switch end } else @@ -749,7 +791,8 @@ lsampl_t *data) /**********************************/ /* The module is not a SSI module */ /**********************************/ - DPRINTK("The module is not a SSI module\n"); + + DPRINTK("The module is not a SSI module\n"); i_ReturnValue = -3; } } @@ -758,7 +801,8 @@ lsampl_t *data) /***********************/ /* Module number error */ /***********************/ - DPRINTK("Module number error\n"); + + DPRINTK("Module number error\n"); i_ReturnValue = -2; } diff --git a/comedi/drivers/addi-data/APCI1710_Ssi.h b/comedi/drivers/addi-data/APCI1710_Ssi.h index 918558dd..f5cf4843 100644 --- a/comedi/drivers/addi-data/APCI1710_Ssi.h +++ b/comedi/drivers/addi-data/APCI1710_Ssi.h @@ -1,11 +1,33 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ - #define APCI1710_30MHZ 30 #define APCI1710_33MHZ 33 #define APCI1710_40MHZ 40 - + #define APCI1710_BINARY_MODE 0x1 #define APCI1710_GRAY_MODE 0x0 @@ -27,14 +49,14 @@ INT i_APCI1710_InsnConfigInitSSI(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data); - + INT i_APCI1710_InsnReadSSIValue(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data); - + INT i_APCI1710_InsnBitsSSIDigitalIO(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn, lsampl_t *data); - + diff --git a/comedi/drivers/addi-data/APCI1710_Tor.c b/comedi/drivers/addi-data/APCI1710_Tor.c index bc06967b..dbebeeef 100644 --- a/comedi/drivers/addi-data/APCI1710_Tor.c +++ b/comedi/drivers/addi-data/APCI1710_Tor.c @@ -1,14 +1,38 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ /* + +-----------------------------------------------------------------------+ | (C) ADDI-DATA GmbH Dieselstraße 3 D-77833 Ottersweier | +-----------------------------------------------------------------------+ | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | +-----------------------------------------------------------------------+ - | Project : API APCI1710 | Compiler : BORLANDC/MICROSOFT C | - | Module name : TOR.C | Version : 3.1 / 6.0 | + | Project : API APCI1710 | Compiler : gcc | + | Module name : TOR.C | Version : 2.96 | +-------------------------------+---------------------------------------+ - | Author : S.WEBER | Date : 14.12.98 | + | Project manager: Eric Stolz | Date : 02/12/2002 | +-----------------------------------------------------------------------+ | Description : APCI-1710 tor counter module | | | @@ -110,21 +134,21 @@ +----------------------------------------------------------------------------+ */ - + INT i_APCI1710_InsnConfigInitTorCounter(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data) { INT i_ReturnValue = 0; - ULONG ul_TimerValue; + ULONG ul_TimerValue = 0; DWORD dw_Command; - double d_RealTimingInterval; + double d_RealTimingInterval = 0; BYTE b_ModulNbr; BYTE b_TorCounter; BYTE b_PCIInputClock; BYTE b_TimingUnit; ULONG ul_TimingInterval; - ULONG ul_RealTimingInterval; + ULONG ul_RealTimingInterval = 0; i_ReturnValue = insn->n; b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); @@ -133,7 +157,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(comedi_device *dev,comedi_subdevice *s b_PCIInputClock = (BYTE) data[1]; b_TimingUnit = (BYTE) data[2]; ul_TimingInterval = (ULONG) data[3]; - printk("INPUT clock %d\n",b_PCIInputClock); + printk("INPUT clock %d\n",b_PCIInputClock); /**************************/ /* Test the module number */ @@ -152,7 +176,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(comedi_device *dev,comedi_subdevice *s /* Test the tor counter selection */ /**********************************/ - if (b_TorCounter >= 0 && b_TorCounter <= 1) + if (b_TorCounter <= 1) { /**************************/ /* Test the PCI bus clock */ @@ -167,7 +191,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(comedi_device *dev,comedi_subdevice *s /* Test the timing unit */ /************************/ - if (((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) || (b_PCIInputClock == APCI1710_GATE_INPUT)) + if ((b_TimingUnit <= 4) || (b_PCIInputClock == APCI1710_GATE_INPUT)) { /**********************************/ /* Test the base timing selection */ @@ -194,18 +218,18 @@ INT i_APCI1710_InsnConfigInitTorCounter(comedi_device *dev,comedi_subdevice *s /* Test the board version */ /**************************/ - if ((b_PCIInputClock == APCI1710_40MHZ) && (devpriv->s_BoardInfos. - b_BoardVersion > 0) || + if (((b_PCIInputClock == APCI1710_40MHZ) && (devpriv->s_BoardInfos. + b_BoardVersion > 0)) || (b_PCIInputClock != APCI1710_40MHZ)) { /************************/ /* Test the TOR version */ /************************/ - if ((b_PCIInputClock == APCI1710_40MHZ) && ((devpriv->s_BoardInfos. - dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3131) || - (b_PCIInputClock == APCI1710_GATE_INPUT) && ((devpriv->s_BoardInfos. - dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3132) || + if (((b_PCIInputClock == APCI1710_40MHZ) && ((devpriv->s_BoardInfos. + dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3131)) || + ((b_PCIInputClock == APCI1710_GATE_INPUT) && ((devpriv->s_BoardInfos. + dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3132)) || (b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ)) { @@ -215,6 +239,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(comedi_device *dev,comedi_subdevice *s if (b_PCIInputClock != APCI1710_GATE_INPUT) { + fpu_begin (); /****************************************/ /* Calculate the timer 0 division fator */ /****************************************/ @@ -440,6 +465,8 @@ INT i_APCI1710_InsnConfigInitTorCounter(comedi_device *dev,comedi_subdevice *s break; } + + fpu_end (); } // if (b_PCIInputClock != APCI1710_GATE_INPUT) else { @@ -483,7 +510,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(comedi_device *dev,comedi_subdevice *s /* Get the command */ /*******************/ - + dw_Command = inl(devpriv->s_BoardInfos.ui_Address + 4 + (16 * b_TorCounter) + (64 * b_ModulNbr)); dw_Command = (dw_Command >> 4) & 0xF; @@ -548,7 +575,8 @@ INT i_APCI1710_InsnConfigInitTorCounter(comedi_device *dev,comedi_subdevice *s /***********************************************/ /* TOR version error for 40MHz clock selection */ /***********************************************/ - DPRINTK("TOR version error for 40MHz clock selection\n"); + + DPRINTK("TOR version error for 40MHz clock selection\n"); i_ReturnValue = -9; } } @@ -557,7 +585,8 @@ INT i_APCI1710_InsnConfigInitTorCounter(comedi_device *dev,comedi_subdevice *s /**************************************************************/ /* You can not used the 40MHz clock selection wich this board */ /**************************************************************/ - DPRINTK("You can not used the 40MHz clock selection wich this board\n"); + + DPRINTK("You can not used the 40MHz clock selection wich this board\n"); i_ReturnValue = -8; } } @@ -566,7 +595,8 @@ INT i_APCI1710_InsnConfigInitTorCounter(comedi_device *dev,comedi_subdevice *s /**********************************/ /* Base timing selection is wrong */ /**********************************/ - DPRINTK("Base timing selection is wrong\n"); + + DPRINTK("Base timing selection is wrong\n"); i_ReturnValue = -7; } } // if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) @@ -575,7 +605,8 @@ INT i_APCI1710_InsnConfigInitTorCounter(comedi_device *dev,comedi_subdevice *s /**********************************/ /* Timing unit selection is wrong */ /**********************************/ - DPRINTK("Timing unit selection is wrong\n"); + + DPRINTK("Timing unit selection is wrong\n"); i_ReturnValue = -6; } // if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) } // if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ)) @@ -584,7 +615,8 @@ INT i_APCI1710_InsnConfigInitTorCounter(comedi_device *dev,comedi_subdevice *s /*****************************************/ /* The selected PCI input clock is wrong */ /*****************************************/ - DPRINTK("The selected PCI input clock is wrong\n"); + + DPRINTK("The selected PCI input clock is wrong\n"); i_ReturnValue = -5; } // if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ)) } // if (b_TorCounterMode >= 0 && b_TorCounterMode <= 7) @@ -593,7 +625,8 @@ INT i_APCI1710_InsnConfigInitTorCounter(comedi_device *dev,comedi_subdevice *s /**********************************/ /* Tor Counter selection is wrong */ /**********************************/ - DPRINTK("Tor Counter selection is wrong\n"); + + DPRINTK("Tor Counter selection is wrong\n"); i_ReturnValue = -4; } // if (b_TorCounterMode >= 0 && b_TorCounterMode <= 7) } @@ -602,7 +635,8 @@ INT i_APCI1710_InsnConfigInitTorCounter(comedi_device *dev,comedi_subdevice *s /******************************************/ /* The module is not a tor counter module */ /******************************************/ - DPRINTK("The module is not a tor counter module\n"); + + DPRINTK("The module is not a tor counter module\n"); i_ReturnValue = -3; } } @@ -611,7 +645,8 @@ INT i_APCI1710_InsnConfigInitTorCounter(comedi_device *dev,comedi_subdevice *s /***********************/ /* Module number error */ /***********************/ - DPRINTK("Module number error\n"); + + DPRINTK("Module number error\n"); i_ReturnValue = -2; } data[0] = (UINT) ul_RealTimingInterval; @@ -748,7 +783,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(comedi_device *dev,comedi_subdevice *s */ - + INT i_APCI1710_InsnWriteEnableDisableTorCounter (comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data) { @@ -789,7 +824,7 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter (comedi_device *dev,comedi_subd /* Test the tor counter selection */ /**********************************/ - if (b_TorCounter >= 0 && b_TorCounter <= 1) + if (b_TorCounter <= 1) { switch(b_Action)// Enable or Disable { @@ -798,7 +833,7 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter (comedi_device *dev,comedi_subd /* Test if tor counter initialised */ /***********************************/ - + dw_Status =inl(devpriv->s_BoardInfos.ui_Address + 8 + (16 * b_TorCounter) + (64 * b_ModulNbr)); @@ -833,8 +868,8 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter (comedi_device *dev,comedi_subd if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) { - - + + /***************************/ /* Save the interrupt mode */ /***************************/ @@ -848,7 +883,7 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter (comedi_device *dev,comedi_subd /* Get the command */ /*******************/ - + dw_ConfigReg = inl(devpriv->s_BoardInfos.ui_Address + 4 + (16 * b_TorCounter) + (64 * b_ModulNbr)); dw_ConfigReg = (dw_ConfigReg >> 4) & 0x30; @@ -928,25 +963,26 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter (comedi_device *dev,comedi_subd /* Set the commando */ /********************/ - + outl(dw_ConfigReg,devpriv->s_BoardInfos. ui_Address + 4 + (16 * b_TorCounter) + (64 * b_ModulNbr)); /****************/ /* Set the gate */ /****************/ - + outl(1,devpriv->s_BoardInfos. ui_Address + 8 + (16 * b_TorCounter) + (64 * b_ModulNbr)); - + } // if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) else { /********************************/ /* Interrupt parameter is wrong */ /********************************/ - DPRINTK("Interrupt parameter is wrong\n"); + + DPRINTK("Interrupt parameter is wrong\n"); i_ReturnValue = -9; } // if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) } // if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS)) @@ -955,7 +991,8 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter (comedi_device *dev,comedi_subd /***********************************************/ /* Tor counter acquisition mode cycle is wrong */ /***********************************************/ - DPRINTK("Tor counter acquisition mode cycle is wrong\n"); + + DPRINTK("Tor counter acquisition mode cycle is wrong\n"); i_ReturnValue = -8; } // if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS)) } // if (b_ExternGate >= 0 && b_ExternGate <= 1) @@ -964,7 +1001,8 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter (comedi_device *dev,comedi_subd /***********************************/ /* Extern gate input mode is wrong */ /***********************************/ - DPRINTK("Extern gate input mode is wrong\n"); + + DPRINTK("Extern gate input mode is wrong\n"); i_ReturnValue = -7; } // if (b_ExternGate >= 0 && b_ExternGate <= 1) } // if (b_InputMode >= 0 && b_InputMode <= 1) @@ -973,7 +1011,8 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter (comedi_device *dev,comedi_subd /***************************************/ /* Tor input signal selection is wrong */ /***************************************/ - DPRINTK("Tor input signal selection is wrong\n"); + + DPRINTK("Tor input signal selection is wrong\n"); i_ReturnValue = -6; } } @@ -982,7 +1021,8 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter (comedi_device *dev,comedi_subd /*******************************/ /* Tor counter not initialised */ /*******************************/ - DPRINTK("Tor counter not initialised\n"); + + DPRINTK("Tor counter not initialised\n"); i_ReturnValue = -5; } break; @@ -991,7 +1031,7 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter (comedi_device *dev,comedi_subd /***********************************/ /* Test if tor counter initialised */ /***********************************/ - + dw_Status = inl(devpriv->s_BoardInfos. ui_Address + 8 + (16 * b_TorCounter) + (64 * b_ModulNbr)); @@ -1027,7 +1067,8 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter (comedi_device *dev,comedi_subd /***************************/ /* Tor counter not enabled */ /***************************/ - DPRINTK("Tor counter not enabled \n"); + + DPRINTK("Tor counter not enabled \n"); i_ReturnValue = -6; } // if (dw_Status & 0x1) } // if (dw_Status & 0x10) @@ -1036,29 +1077,32 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter (comedi_device *dev,comedi_subd /*******************************/ /* Tor counter not initialised */ /*******************************/ - DPRINTK("Tor counter not initialised\n"); + + DPRINTK("Tor counter not initialised\n"); i_ReturnValue = -5; } // // if (dw_Status & 0x10) } // switch - } // if (b_TorCounter >= 0 && b_TorCounter <= 1) + } // if (b_TorCounter <= 1) else { /**********************************/ /* Tor counter selection is wrong */ /**********************************/ - DPRINTK("Tor counter selection is wrong\n"); + + DPRINTK("Tor counter selection is wrong\n"); i_ReturnValue = -4; - } // if (b_TorCounter >= 0 && b_TorCounter <= 1) + } // if (b_TorCounter <= 1) } else { /******************************************/ /* The module is not a tor counter module */ /******************************************/ - DPRINTK("The module is not a tor counter module \n"); + + DPRINTK("The module is not a tor counter module \n"); i_ReturnValue = -3; } } @@ -1067,7 +1111,8 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter (comedi_device *dev,comedi_subd /***********************/ /* Module number error */ /***********************/ - DPRINTK("Module number error \n"); + + DPRINTK("Module number error \n"); i_ReturnValue = -2; } @@ -1158,7 +1203,7 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter (comedi_device *dev,comedi_subd | "i_APCI1710_InitTorCounter" | +----------------------------------------------------------------------------+ */ - + INT i_APCI1710_InsnReadGetTorCounterInitialisation(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data) @@ -1204,7 +1249,7 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(comedi_device *dev,comedi_sub /* Test the tor counter selection */ /**********************************/ - if (b_TorCounter >= 0 && b_TorCounter <= 1) + if (b_TorCounter <= 1) { @@ -1212,7 +1257,7 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(comedi_device *dev,comedi_sub /* Test if tor counter initialised */ /***********************************/ - + dw_Status = inl(devpriv->s_BoardInfos. ui_Address + 8 + (16 * b_TorCounter) + (64 * b_ModulNbr)); @@ -1225,7 +1270,7 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(comedi_device *dev,comedi_sub /* Get the commando */ /********************/ - + dw_Status=inl(devpriv->s_BoardInfos. ui_Address + 4 + (16 * b_TorCounter) + (64 * b_ModulNbr)); @@ -1303,26 +1348,29 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(comedi_device *dev,comedi_sub /*******************************/ /* Tor counter not initialised */ /*******************************/ - DPRINTK("Tor counter not initialised\n"); + + DPRINTK("Tor counter not initialised\n"); i_ReturnValue = -5; } - } // if (b_TorCounter >= 0 && b_TorCounter <= 1) + } // if (b_TorCounter <= 1) else { /**********************************/ /* Tor counter selection is wrong */ /**********************************/ - DPRINTK("Tor counter selection is wrong \n"); + + DPRINTK("Tor counter selection is wrong \n"); i_ReturnValue = -4; - } // if (b_TorCounter >= 0 && b_TorCounter <= 1) + } // if (b_TorCounter <= 1) } else { /******************************************/ /* The module is not a tor counter module */ /******************************************/ - DPRINTK("The module is not a tor counter module\n"); + + DPRINTK("The module is not a tor counter module\n"); i_ReturnValue = -3; } } @@ -1331,7 +1379,8 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(comedi_device *dev,comedi_sub /***********************/ /* Module number error */ /***********************/ - DPRINTK("Module number error\n"); + + DPRINTK("Module number error\n"); i_ReturnValue = -2; } @@ -1411,7 +1460,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(comedi_device *dev,co BYTE b_ModulNbr; BYTE b_TorCounter; - BYTE b_ReadType; + BYTE b_ReadType; UINT ui_TimeOut; PBYTE pb_TorCounterStatus; PULONG pul_TorCounterValue; @@ -1427,37 +1476,37 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(comedi_device *dev,co /**************************/ /* Test the module number */ /**************************/ - - - if(b_ReadType==APCI1710_TOR_READINTERRUPT) - { - - data[0]=devpriv->s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Read].b_OldModuleMask; - data[1]=devpriv->s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Read].ul_OldInterruptMask; - data[2]=devpriv->s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Read].ul_OldCounterLatchValue; - - - /**************************/ - /* Increment the read FIFO */ - /***************************/ - - devpriv-> - s_InterruptParameters. - ui_Read = (devpriv-> - s_InterruptParameters. - ui_Read + 1) % APCI1710_SAVE_INTERRUPT; - - return insn->n; - } + + + if(b_ReadType==APCI1710_TOR_READINTERRUPT) + { + + data[0]=devpriv->s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Read].b_OldModuleMask; + data[1]=devpriv->s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Read].ul_OldInterruptMask; + data[2]=devpriv->s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Read].ul_OldCounterLatchValue; + + + /**************************/ + /* Increment the read FIFO */ + /***************************/ + + devpriv-> + s_InterruptParameters. + ui_Read = (devpriv-> + s_InterruptParameters. + ui_Read + 1) % APCI1710_SAVE_INTERRUPT; + + return insn->n; + } if (b_ModulNbr < 4) { @@ -1472,14 +1521,14 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(comedi_device *dev,co /* Test the tor counter selection */ /**********************************/ - if (b_TorCounter >= 0 && b_TorCounter <= 1) + if (b_TorCounter <= 1) { /***********************************/ /* Test if tor counter initialised */ /***********************************/ - + dw_Status=inl(devpriv->s_BoardInfos. ui_Address + 8 + (16 * b_TorCounter) + (64 * b_ModulNbr)); @@ -1498,7 +1547,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(comedi_device *dev,co switch(b_ReadType) { - + case APCI1710_TOR_GETPROGRESSSTATUS: /*******************/ /* Read the status */ @@ -1566,7 +1615,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(comedi_device *dev,co /*******************/ /* Read the status */ /*******************/ - + dw_Status=inl(devpriv->s_BoardInfos. ui_Address + 4 + (16 * b_TorCounter) + (64 * b_ModulNbr)); /********************/ @@ -1607,7 +1656,8 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(comedi_device *dev,co /******************/ /* Read the value */ /******************/ - + + *pul_TorCounterValue=inl(devpriv->s_BoardInfos. ui_Address + 0 + (16 * b_TorCounter) + (64 * b_ModulNbr)); @@ -1676,12 +1726,13 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(comedi_device *dev,co /******************************/ /* Timeout parameter is wrong */ /******************************/ - DPRINTK("Timeout parameter is wrong\n"); + + DPRINTK("Timeout parameter is wrong\n"); i_ReturnValue = -7; } break; - - + + default: printk("Inputs wrong\n"); } // switch end @@ -1691,7 +1742,8 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(comedi_device *dev,co /***************************/ /* Tor counter not enabled */ /***************************/ - DPRINTK("Tor counter not enabled\n"); + + DPRINTK("Tor counter not enabled\n"); i_ReturnValue = -6; } // if (dw_Status & 0x1) } @@ -1700,25 +1752,28 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(comedi_device *dev,co /*******************************/ /* Tor counter not initialised */ /*******************************/ - DPRINTK("Tor counter not initialised\n"); + + DPRINTK("Tor counter not initialised\n"); i_ReturnValue = -5; } - } // if (b_TorCounter >= 0 && b_TorCounter <= 1) + } // if (b_TorCounter <= 1) else { /**********************************/ /* Tor counter selection is wrong */ /**********************************/ - DPRINTK("Tor counter selection is wrong\n"); + + DPRINTK("Tor counter selection is wrong\n"); i_ReturnValue = -4; - } // if (b_TorCounter >= 0 && b_TorCounter <= 1) + } // if (b_TorCounter <= 1) } else { /******************************************/ /* The module is not a tor counter module */ /******************************************/ - DPRINTK("The module is not a tor counter module\n"); + + DPRINTK("The module is not a tor counter module\n"); i_ReturnValue = -3; } } @@ -1727,10 +1782,12 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(comedi_device *dev,co /***********************/ /* Module number error */ /***********************/ - DPRINTK("Module number error\n"); + + DPRINTK("Module number error\n"); i_ReturnValue = -2; } - + + return (i_ReturnValue); } diff --git a/comedi/drivers/addi-data/APCI1710_Tor.h b/comedi/drivers/addi-data/APCI1710_Tor.h index b29d22c1..5a29214f 100644 --- a/comedi/drivers/addi-data/APCI1710_Tor.h +++ b/comedi/drivers/addi-data/APCI1710_Tor.h @@ -1,26 +1,50 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ + + - #define APCI1710_30MHZ 30 #define APCI1710_33MHZ 33 #define APCI1710_40MHZ 40 - - + + #define APCI1710_GATE_INPUT 10 - + #define APCI1710_TOR_SIMPLE_MODE 2 #define APCI1710_TOR_DOUBLE_MODE 3 #define APCI1710_TOR_QUADRUPLE_MODE 4 - + #define APCI1710_SINGLE 0 #define APCI1710_CONTINUOUS 1 - + #define APCI1710_TOR_GETPROGRESSSTATUS 0 -#define APCI1710_TOR_GETCOUNTERVALUE 1 +#define APCI1710_TOR_GETCOUNTERVALUE 1 #define APCI1710_TOR_READINTERRUPT 2 @@ -33,14 +57,14 @@ INT i_APCI1710_InsnConfigInitTorCounter(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data); - + INT i_APCI1710_InsnWriteEnableDisableTorCounter (comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data); - + INT i_APCI1710_InsnReadGetTorCounterInitialisation(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data); @@ -50,7 +74,7 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(comedi_device *dev,comedi_sub +----------------------------------------------------------------------------+ */ - + INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data); diff --git a/comedi/drivers/addi-data/APCI1710_Ttl.c b/comedi/drivers/addi-data/APCI1710_Ttl.c index 1307e61a..af98adb8 100644 --- a/comedi/drivers/addi-data/APCI1710_Ttl.c +++ b/comedi/drivers/addi-data/APCI1710_Ttl.c @@ -1,17 +1,38 @@ - - - +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ /* + +-----------------------------------------------------------------------+ | (C) ADDI-DATA GmbH Dieselstraße 3 D-77833 Ottersweier | +-----------------------------------------------------------------------+ | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | +-----------------------------------------------------------------------+ - | Project : API APCI1710 | Compiler : BORLANDC/MICROSOFT C | - | Module name : TTL.C | Version : 3.1 / 6.0 | + | Project : API APCI1710 | Compiler : gcc | + | Module name : TTL.C | Version : 2.96 | +-------------------------------+---------------------------------------+ - | Author : S.WEBER | Date : 04.06.98 | + | Project manager: Eric Stolz | Date : 02/12/2002 | +-----------------------------------------------------------------------+ | Description : APCI-1710 TTL I/O module | | | @@ -151,7 +172,7 @@ INT i_APCI1710_InsnConfigInitTTLIO(comedi_device *dev,comedi_subdevice *s, /*************************/ /* Set the configuration */ /*************************/ - + outl(0x8,devpriv->s_BoardInfos.ui_Address + 20 + (64 * b_ModulNbr)); break; @@ -234,7 +255,7 @@ INT i_APCI1710_InsnConfigInitTTLIO(comedi_device *dev,comedi_subdevice *s, /* Set the configuration */ /*************************/ - + outl((b_PortAMode << 0) | (b_PortBMode << 1) | (b_PortCMode << 2) | @@ -246,7 +267,8 @@ INT i_APCI1710_InsnConfigInitTTLIO(comedi_device *dev,comedi_subdevice *s, /**********************************/ /* Port D mode selection is wrong */ /**********************************/ - DPRINTK("Port D mode selection is wrong\n"); + + DPRINTK("Port D mode selection is wrong\n"); i_ReturnValue = -8; } } @@ -255,7 +277,8 @@ INT i_APCI1710_InsnConfigInitTTLIO(comedi_device *dev,comedi_subdevice *s, /**********************************/ /* Port C mode selection is wrong */ /**********************************/ - DPRINTK("Port C mode selection is wrong\n"); + + DPRINTK("Port C mode selection is wrong\n"); i_ReturnValue = -7; } } @@ -264,7 +287,8 @@ INT i_APCI1710_InsnConfigInitTTLIO(comedi_device *dev,comedi_subdevice *s, /**********************************/ /* Port B mode selection is wrong */ /**********************************/ - DPRINTK("Port B mode selection is wrong\n"); + + DPRINTK("Port B mode selection is wrong\n"); i_ReturnValue = -6; } } @@ -273,7 +297,8 @@ INT i_APCI1710_InsnConfigInitTTLIO(comedi_device *dev,comedi_subdevice *s, /**********************************/ /* Port A mode selection is wrong */ /**********************************/ - DPRINTK("Port A mode selection is wrong\n"); + + DPRINTK("Port A mode selection is wrong\n"); i_ReturnValue = -5; } } @@ -282,11 +307,13 @@ INT i_APCI1710_InsnConfigInitTTLIO(comedi_device *dev,comedi_subdevice *s, /*******************************************/ /* Function not available for this version */ /*******************************************/ - DPRINTK("Function not available for this version\n"); + + DPRINTK("Function not available for this version\n"); i_ReturnValue = -4; } break; - DPRINTK("\n"); + + DPRINTK("\n"); default: printk("Bad Config Type\n"); }// switch end @@ -296,7 +323,8 @@ INT i_APCI1710_InsnConfigInitTTLIO(comedi_device *dev,comedi_subdevice *s, /**********************************/ /* The module is not a TTL module */ /**********************************/ - DPRINTK("The module is not a TTL module\n"); + + DPRINTK("The module is not a TTL module\n"); i_ReturnValue = -3; } } @@ -305,7 +333,8 @@ INT i_APCI1710_InsnConfigInitTTLIO(comedi_device *dev,comedi_subdevice *s, /***********************/ /* Module number error */ /***********************/ - DPRINTK("Module number error\n"); + + DPRINTK("Module number error\n"); i_ReturnValue = -2; } @@ -335,7 +364,7 @@ INT i_APCI1710_InsnConfigInitTTLIO(comedi_device *dev,comedi_subdevice *s, | Task : Read the status from digital input port | | (b_SelectedPort) from selected TTL module (b_ModulNbr) | +----------------------------------------------------------------------------+ - + +----------------------------------------------------------------------------+ | Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710| | BYTE_ b_ModulNbr : Module number to | @@ -389,7 +418,7 @@ INT i_APCI1710_InsnBitsReadTTLIO(comedi_device *dev,comedi_subdevice *s, BYTE b_ReadType; PBYTE pb_ChannelStatus; PBYTE pb_PortValue; - + i_ReturnValue = insn->n; b_ReadType = (BYTE) data[0]; @@ -422,17 +451,17 @@ INT i_APCI1710_InsnBitsReadTTLIO(comedi_device *dev,comedi_subdevice *s, /* Test the TTL I/O port number */ /********************************/ - if ((((b_SelectedPort >= 0) && (b_SelectedPort <= 2)) && ((devpriv->s_BoardInfos. - dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) == 0x3130)) || - (((b_SelectedPort >= 0) && (b_SelectedPort <= 3)) && ((devpriv->s_BoardInfos. - dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3230))) + if (((b_SelectedPort <= 2) && ((devpriv->s_BoardInfos. + dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) == 0x3130)) || + ((b_SelectedPort <= 3) && ((devpriv->s_BoardInfos. + dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3230))) { /******************************************/ /* Test the digital imnput channel number */ /******************************************/ - if ((((b_InputChannel >= 0) && (b_InputChannel <= 7)) && (b_SelectedPort < 3)) || - (((b_InputChannel >= 0) && (b_InputChannel <= 1)) && (b_SelectedPort == 3))) + if (((b_InputChannel <= 7) && (b_SelectedPort < 3)) || + ((b_InputChannel <= 1) && (b_SelectedPort == 3))) { /******************************************/ /* Test if the TTL I/O module initialised */ @@ -457,10 +486,10 @@ INT i_APCI1710_InsnBitsReadTTLIO(comedi_device *dev,comedi_subdevice *s, /**************************/ /* Read all digital input */ /**************************/ - + dw_StatusReg = inl(devpriv->s_BoardInfos.ui_Address + (64 * b_ModulNbr)); - *pb_ChannelStatus = (BYTE) ((dw_StatusReg >> (8 * b_SelectedPort)) >> + *pb_ChannelStatus = (BYTE) ((dw_StatusReg >> (8 * b_SelectedPort)) >> b_InputChannel) & 1; } else @@ -468,7 +497,8 @@ INT i_APCI1710_InsnBitsReadTTLIO(comedi_device *dev,comedi_subdevice *s, /*******************************/ /* Selected TTL I/O port error */ /*******************************/ - DPRINTK("Selected TTL I/O port error\n"); + + DPRINTK("Selected TTL I/O port error\n"); i_ReturnValue = -4; } } @@ -477,7 +507,8 @@ INT i_APCI1710_InsnBitsReadTTLIO(comedi_device *dev,comedi_subdevice *s, /***************************/ /* TTL I/O not initialised */ /***************************/ - DPRINTK("TTL I/O not initialised\n"); + + DPRINTK("TTL I/O not initialised\n"); i_ReturnValue = -6; } } @@ -486,7 +517,8 @@ INT i_APCI1710_InsnBitsReadTTLIO(comedi_device *dev,comedi_subdevice *s, /********************************/ /* Selected digital input error */ /********************************/ - DPRINTK("Selected digital input error\n"); + + DPRINTK("Selected digital input error\n"); i_ReturnValue = -5; } } @@ -495,7 +527,8 @@ INT i_APCI1710_InsnBitsReadTTLIO(comedi_device *dev,comedi_subdevice *s, /*******************************/ /* Selected TTL I/O port error */ /*******************************/ - DPRINTK("Selected TTL I/O port error\n"); + + DPRINTK("Selected TTL I/O port error\n"); i_ReturnValue = -4; } break; @@ -506,10 +539,10 @@ INT i_APCI1710_InsnBitsReadTTLIO(comedi_device *dev,comedi_subdevice *s, /* Test the TTL I/O port number */ /********************************/ - if ((((b_SelectedPort >= 0) && (b_SelectedPort <= 2)) && ((devpriv->s_BoardInfos. - dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) == 0x3130)) || - (((b_SelectedPort >= 0) && (b_SelectedPort <= 3)) && ((devpriv->s_BoardInfos. - dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3230))) + if (((b_SelectedPort <= 2) && ((devpriv->s_BoardInfos. + dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) == 0x3130)) || + ((b_SelectedPort <= 3) && ((devpriv->s_BoardInfos. + dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3230))) { /******************************************/ /* Test if the TTL I/O module initialised */ @@ -534,7 +567,7 @@ INT i_APCI1710_InsnBitsReadTTLIO(comedi_device *dev,comedi_subdevice *s, /**************************/ /* Read all digital input */ /**************************/ - + dw_StatusReg=inl(devpriv->s_BoardInfos.ui_Address + (64 * b_ModulNbr)); *pb_PortValue = (BYTE) ((dw_StatusReg >> (8 * b_SelectedPort)) & 0xFF); @@ -544,7 +577,8 @@ INT i_APCI1710_InsnBitsReadTTLIO(comedi_device *dev,comedi_subdevice *s, /*******************************/ /* Selected TTL I/O port error */ /*******************************/ - DPRINTK("Selected TTL I/O port error\n"); + + DPRINTK("Selected TTL I/O port error\n"); i_ReturnValue = -4; } } @@ -553,7 +587,8 @@ INT i_APCI1710_InsnBitsReadTTLIO(comedi_device *dev,comedi_subdevice *s, /***************************/ /* TTL I/O not initialised */ /***************************/ - DPRINTK("TTL I/O not initialised\n"); + + DPRINTK("TTL I/O not initialised\n"); i_ReturnValue = -5; } } @@ -562,7 +597,8 @@ INT i_APCI1710_InsnBitsReadTTLIO(comedi_device *dev,comedi_subdevice *s, /*******************************/ /* Selected TTL I/O port error */ /*******************************/ - DPRINTK("Selected TTL I/O port error\n"); + + DPRINTK("Selected TTL I/O port error\n"); i_ReturnValue = -4; } break; @@ -577,7 +613,8 @@ INT i_APCI1710_InsnBitsReadTTLIO(comedi_device *dev,comedi_subdevice *s, /**********************************/ /* The module is not a TTL module */ /**********************************/ - DPRINTK("The module is not a TTL module\n"); + + DPRINTK("The module is not a TTL module\n"); i_ReturnValue = -3; } } @@ -586,7 +623,8 @@ INT i_APCI1710_InsnBitsReadTTLIO(comedi_device *dev,comedi_subdevice *s, /***********************/ /* Module number error */ /***********************/ - DPRINTK("Module number error\n"); + + DPRINTK("Module number error\n"); i_ReturnValue = -2; } @@ -594,160 +632,160 @@ INT i_APCI1710_InsnBitsReadTTLIO(comedi_device *dev,comedi_subdevice *s, } - -/* -+----------------------------------------------------------------------------+ -| Function Name : INT i_APCI1710_InsnReadTTLIOAllPortValue(comedi_device -*dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Read the status from all digital input ports | -| (port A, port B and port C) from selected TTL | -| module (b_ModulNbr) | -+----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710| -| BYTE_ b_ModulNbr : Module number to | -| configure (0 to 3) | -+----------------------------------------------------------------------------+ -| Output Parameters : PULONG_ pul_PortValue : Digital TTL inputs port | -| status | -+----------------------------------------------------------------------------+ -| Return Value : 0: No error | -| -1: The handle parameter of the board is wrong | -| -2: The module parameter is wrong | -| -3: The module is not a TTL module | -| -4: TTL I/O not initialised | -+----------------------------------------------------------------------------+ -*/ - -INT i_APCI1710_InsnReadTTLIOAllPortValue(comedi_device *dev,comedi_subdevice *s, -comedi_insn *insn,lsampl_t *data) - { - INT i_ReturnValue = 0; - DWORD dw_StatusReg; - BYTE b_ModulNbr; - PULONG pul_PortValue; - - b_ModulNbr=(BYTE) CR_AREF(insn->chanspec); - i_ReturnValue=insn->n; - pul_PortValue=(PULONG) &data[0]; - - /**************************/ - /* Test the module number */ - /**************************/ - - if (b_ModulNbr < 4) - { - /**************************/ - /* Test if TTL I/O module */ - /**************************/ - - if ((devpriv->s_BoardInfos. - dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF0000UL) == APCI1710_TTL_IO) - { - /******************************************/ - /* Test if the TTL I/O module initialised */ - /******************************************/ - - if (devpriv-> - s_ModuleInfo [b_ModulNbr]. - s_TTLIOInfo. - b_TTLInit == 1) - { - /**************************/ - /* Read all digital input */ - /**************************/ - - - dw_StatusReg=inl(devpriv->s_BoardInfos. - ui_Address + (64 * b_ModulNbr)); - - /**********************/ - /* Test if TTL Rev1.0 */ - /**********************/ - - if ((devpriv->s_BoardInfos. - dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) == 0x3130) - { - *pul_PortValue = dw_StatusReg & 0xFFFFFFUL; - } - else - { - /**************************************/ - /* Test if port A not used for output */ - /**************************************/ - - if (devpriv->s_ModuleInfo [b_ModulNbr]. - s_TTLIOInfo.b_PortConfiguration [0] == 1) - { - *pul_PortValue = dw_StatusReg & 0x3FFFF00UL; - } - - /**************************************/ - /* Test if port B not used for output */ - /**************************************/ - - if (devpriv-> - s_ModuleInfo [b_ModulNbr]. - s_TTLIOInfo. - b_PortConfiguration [1] == 1) - { - *pul_PortValue = dw_StatusReg & 0x3FF00FFUL; - } - - /**************************************/ - /* Test if port C not used for output */ - /**************************************/ - - if (devpriv-> - s_ModuleInfo [b_ModulNbr]. - s_TTLIOInfo. - b_PortConfiguration [2] == 1) - { - *pul_PortValue = dw_StatusReg & 0x300FFFFUL; - } - - /**************************************/ - /* Test if port D not used for output */ - /**************************************/ - - if (devpriv-> - s_ModuleInfo [b_ModulNbr]. - s_TTLIOInfo. - b_PortConfiguration [3] == 1) - { - *pul_PortValue = dw_StatusReg & 0xFFFFFFUL; - } - } - } - else - { - /***************************/ - /* TTL I/O not initialised */ - /***************************/ - DPRINTK("TTL I/O not initialised\n"); - i_ReturnValue = -5; - } - } - else - { - /**********************************/ - /* The module is not a TTL module */ - /**********************************/ - DPRINTK("The module is not a TTL module\n"); - i_ReturnValue = -3; - } - } - else - { - /***********************/ - /* Module number error */ - /***********************/ - DPRINTK("Module number error\n"); - i_ReturnValue = -2; - } - - return (i_ReturnValue); - } + +/* ++----------------------------------------------------------------------------+ +| Function Name : INT i_APCI1710_InsnReadTTLIOAllPortValue(comedi_device +*dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Read the status from all digital input ports | +| (port A, port B and port C) from selected TTL | +| module (b_ModulNbr) | ++----------------------------------------------------------------------------+ +| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710| +| BYTE_ b_ModulNbr : Module number to | +| configure (0 to 3) | ++----------------------------------------------------------------------------+ +| Output Parameters : PULONG_ pul_PortValue : Digital TTL inputs port | +| status | ++----------------------------------------------------------------------------+ +| Return Value : 0: No error | +| -1: The handle parameter of the board is wrong | +| -2: The module parameter is wrong | +| -3: The module is not a TTL module | +| -4: TTL I/O not initialised | ++----------------------------------------------------------------------------+ +*/ + +INT i_APCI1710_InsnReadTTLIOAllPortValue(comedi_device *dev,comedi_subdevice *s, +comedi_insn *insn,lsampl_t *data) + { + INT i_ReturnValue = 0; + DWORD dw_StatusReg; + BYTE b_ModulNbr; + PULONG pul_PortValue; + + b_ModulNbr=(BYTE) CR_AREF(insn->chanspec); + i_ReturnValue=insn->n; + pul_PortValue=(PULONG) &data[0]; + + /**************************/ + /* Test the module number */ + /**************************/ + + if (b_ModulNbr < 4) + { + /**************************/ + /* Test if TTL I/O module */ + /**************************/ + + if ((devpriv->s_BoardInfos. + dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF0000UL) == APCI1710_TTL_IO) + { + /******************************************/ + /* Test if the TTL I/O module initialised */ + /******************************************/ + + if (devpriv-> + s_ModuleInfo [b_ModulNbr]. + s_TTLIOInfo. + b_TTLInit == 1) + { + /**************************/ + /* Read all digital input */ + /**************************/ + + + dw_StatusReg=inl(devpriv->s_BoardInfos. + ui_Address + (64 * b_ModulNbr)); + + /**********************/ + /* Test if TTL Rev1.0 */ + /**********************/ + + if ((devpriv->s_BoardInfos. + dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) == 0x3130) + { + *pul_PortValue = dw_StatusReg & 0xFFFFFFUL; + } + else + { + /**************************************/ + /* Test if port A not used for output */ + /**************************************/ + + if (devpriv->s_ModuleInfo [b_ModulNbr]. + s_TTLIOInfo.b_PortConfiguration [0] == 1) + { + *pul_PortValue = dw_StatusReg & 0x3FFFF00UL; + } + + /**************************************/ + /* Test if port B not used for output */ + /**************************************/ + + if (devpriv-> + s_ModuleInfo [b_ModulNbr]. + s_TTLIOInfo. + b_PortConfiguration [1] == 1) + { + *pul_PortValue = dw_StatusReg & 0x3FF00FFUL; + } + + /**************************************/ + /* Test if port C not used for output */ + /**************************************/ + + if (devpriv-> + s_ModuleInfo [b_ModulNbr]. + s_TTLIOInfo. + b_PortConfiguration [2] == 1) + { + *pul_PortValue = dw_StatusReg & 0x300FFFFUL; + } + + /**************************************/ + /* Test if port D not used for output */ + /**************************************/ + + if (devpriv-> + s_ModuleInfo [b_ModulNbr]. + s_TTLIOInfo. + b_PortConfiguration [3] == 1) + { + *pul_PortValue = dw_StatusReg & 0xFFFFFFUL; + } + } + } + else + { + /***************************/ + /* TTL I/O not initialised */ + /***************************/ + DPRINTK("TTL I/O not initialised\n"); + i_ReturnValue = -5; + } + } + else + { + /**********************************/ + /* The module is not a TTL module */ + /**********************************/ + DPRINTK("The module is not a TTL module\n"); + i_ReturnValue = -3; + } + } + else + { + /***********************/ + /* Module number error */ + /***********************/ + DPRINTK("Module number error\n"); + i_ReturnValue = -2; + } + + return (i_ReturnValue); + } /* +----------------------------------------------------------------------------+ @@ -793,7 +831,7 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(comedi_device *dev,comedi_subdevice *s, | " i_APCI1710_InitTTLIO" +----------------------------------------------------------------------------+ */ - + INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data) { @@ -833,16 +871,16 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(comedi_device *dev,comedi_subdevice *s, /* Test the TTL I/O channel number */ /***********************************/ - if ((((b_OutputChannel >= 0) && (b_OutputChannel <= 1)) && ((devpriv->s_BoardInfos. - dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) == 0x3130)) || - (((b_OutputChannel >= 0) && (b_OutputChannel <= 25)) && ((devpriv->s_BoardInfos. - dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3230))) + if (((b_OutputChannel <= 1) && ((devpriv->s_BoardInfos. + dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) == 0x3130)) || + ((b_OutputChannel <= 25) && ((devpriv->s_BoardInfos. + dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3230))) { /****************************************************/ /* Test if the selected channel is a output channel */ /****************************************************/ - if (((b_OutputChannel >= 0) && (b_OutputChannel <= 1) && (devpriv-> + if (((b_OutputChannel <= 1) && (devpriv-> s_ModuleInfo [b_ModulNbr]. s_TTLIOInfo. b_PortConfiguration [3] == 1)) || @@ -862,7 +900,7 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(comedi_device *dev,comedi_subdevice *s, if (b_OutputChannel == 0) { - + outl(ui_State,devpriv->s_BoardInfos. ui_Address + (64 * b_ModulNbr)); } @@ -886,7 +924,7 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(comedi_device *dev,comedi_subdevice *s, /* Read all channel */ /********************/ - + dw_StatusReg =inl(devpriv->s_BoardInfos. ui_Address + (64 * b_ModulNbr)); if(ui_State) // ON @@ -915,7 +953,8 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(comedi_device *dev,comedi_subdevice *s, /************************************/ /* The selected TTL output is wrong */ /************************************/ - DPRINTK(" The selected TTL output is wrong\n"); + + DPRINTK(" The selected TTL output is wrong\n"); i_ReturnValue = -4; } } @@ -924,7 +963,8 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(comedi_device *dev,comedi_subdevice *s, /************************************/ /* The selected TTL output is wrong */ /************************************/ - DPRINTK("The selected TTL output is wrong\n"); + + DPRINTK("The selected TTL output is wrong\n"); i_ReturnValue = -4; } } @@ -933,7 +973,8 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(comedi_device *dev,comedi_subdevice *s, /***************************/ /* TTL I/O not initialised */ /***************************/ - DPRINTK("TTL I/O not initialised\n"); + + DPRINTK("TTL I/O not initialised\n"); i_ReturnValue = -5; } } @@ -942,7 +983,8 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(comedi_device *dev,comedi_subdevice *s, /**************************************/ /* The module is not a TTL I/O module */ /**************************************/ - DPRINTK("The module is not a TTL I/O module\n"); + + DPRINTK("The module is not a TTL I/O module\n"); i_ReturnValue = -3; } } @@ -951,7 +993,8 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(comedi_device *dev,comedi_subdevice *s, /***********************/ /* Module number error */ /***********************/ - DPRINTK("Module number error\n"); + + DPRINTK("Module number error\n"); i_ReturnValue = -2; } diff --git a/comedi/drivers/addi-data/APCI1710_Ttl.h b/comedi/drivers/addi-data/APCI1710_Ttl.h index f7ecfc0f..25403ece 100644 --- a/comedi/drivers/addi-data/APCI1710_Ttl.h +++ b/comedi/drivers/addi-data/APCI1710_Ttl.h @@ -1,6 +1,29 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ + - #define APCI1710_TTL_INIT 0 #define APCI1710_TTL_INITDIRECTION 1 @@ -8,7 +31,7 @@ #define APCI1710_TTL_READCHANNEL 0 #define APCI1710_TTL_READPORT 1 - + /* +----------------------------------------------------------------------------+ @@ -24,11 +47,11 @@ | TTL INPUT FUNCTION | +----------------------------------------------------------------------------+ */ - + INT i_APCI1710_InsnBitsReadTTLIO(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data); - INT i_APCI1710_InsnReadTTLIOAllPortValue(comedi_device *dev,comedi_subdevice *s, - comedi_insn *insn,lsampl_t *data); + INT i_APCI1710_InsnReadTTLIOAllPortValue(comedi_device *dev,comedi_subdevice *s, + comedi_insn *insn,lsampl_t *data); /* +----------------------------------------------------------------------------+ | TTL OUTPUT FUNCTIONS | diff --git a/comedi/drivers/addi-data/addi_amcc_S5920.c b/comedi/drivers/addi-data/addi_amcc_S5920.c new file mode 100755 index 00000000..305a39fd --- /dev/null +++ b/comedi/drivers/addi-data/addi_amcc_S5920.c @@ -0,0 +1,185 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ +/* + +-----------------------------------------------------------------------+ + | (C) ADDI-DATA GmbH Dieselstraße 3 D-77833 Ottersweier | + +-----------------------------------------------------------------------+ + | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | + | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | + +-------------------------------+---------------------------------------+ + | Project : ADDI HEADER READ WRITER | Compiler : Visual C++ | + | Module name : S5920.cpp | Version : 6.0 | + +-------------------------------+---------------------------------------+ + | Author : E. LIBS Date : 02/05/2002 | + +-----------------------------------------------------------------------+ + | Description : DLL with the S5920 PCI Controller functions | + +-----------------------------------------------------------------------+ + | UPDATE'S | + +-----------------------------------------------------------------------+ + | Date | Author | Description of updates | + +----------+-----------+------------------------------------------------+ + | 28/08/02 | LIBS Eric | Add return codes each time a function of the | + | | | Addi Library is called | + +-----------------------------------------------------------------------+ + | 31/07/03 | KRAUTH J. | Changes for the MSX-Box | + +-----------------------------------------------------------------------+ +*/ + + +#include "addi_amcc_S5920.h" + +/*+----------------------------------------------------------------------------+*/ +/*| Function Name : INT i_AddiHeaderRW_ReadEeprom |*/ +/*| (INT i_NbOfWordsToRead, |*/ +/*| DWORD dw_PCIBoardEepromAddress, |*/ +/*| WORD w_EepromStartAddress, |*/ +/*| PWORD pw_DataRead) |*/ +/*+----------------------------------------------------------------------------+*/ +/*| Task : Read word from the 5920 eeprom. |*/ +/*+----------------------------------------------------------------------------+*/ +/*| Input Parameters : INT i_NbOfWordsToRead : Nbr. of word to read |*/ +/*| DWORD dw_PCIBoardEepromAddress : Address of the eeprom |*/ +/*| WORD w_EepromStartAddress : Eeprom strat address |*/ +/*+----------------------------------------------------------------------------+*/ +/*| Output Parameters : PWORD pw_DataRead : Read data |*/ +/*+----------------------------------------------------------------------------+*/ +/*| Return Value : - |*/ +/*+----------------------------------------------------------------------------+*/ + +INT i_AddiHeaderRW_ReadEeprom (INT i_NbOfWordsToRead, + DWORD dw_PCIBoardEepromAddress, + WORD w_EepromStartAddress, + PWORD pw_DataRead) +{ + DWORD dw_eeprom_busy=0; + INT i_Counter=0; + INT i_WordCounter; + INT i; + BYTE pb_ReadByte[1]; + BYTE b_ReadLowByte = 0; + BYTE b_ReadHighByte = 0; + BYTE b_SelectedAddressLow = 0; + BYTE b_SelectedAddressHigh = 0; + WORD w_ReadWord = 0; + + for (i_WordCounter = 0;i_WordCounternext){ +#elif LINUX_VERSION_CODE >= 0x020600 + for(pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); + pcidev != NULL ; + pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { #else pci_for_each_dev(pcidev){ #endif @@ -357,12 +382,17 @@ int i_find_free_pci_card_by_position(unsigned short vendor_id, unsigned short de /****************************************************************************/ /* mark card as used */ -int i_pci_card_alloc(struct pcilst_struct *amcc) +int pci_card_alloc(struct pcilst_struct *amcc, int master) { if (!amcc) return -1; if (amcc->used) return 1; +#if LINUX_VERSION_CODE >= 0x020600 + if (pci_enable_device(amcc->pcidev)) return -1; + if (master) pci_set_master(amcc->pcidev); +#endif amcc->used=1; + return 0; } @@ -399,7 +429,7 @@ void v_pci_card_list_display(void) /* return all card information for driver */ int i_pci_card_data(struct pcilst_struct *amcc, unsigned char *pci_bus, unsigned char *pci_slot, unsigned char *pci_func, - unsigned short *io_addr, unsigned short *irq, unsigned short *master) + unsigned long *io_addr, unsigned short *irq, unsigned short *master) { int i; @@ -416,7 +446,7 @@ int i_pci_card_data(struct pcilst_struct *amcc, /****************************************************************************/ /* select and alloc card */ -struct pcilst_struct *ptr_select_and_alloc_pci_card(unsigned short vendor_id, unsigned short device_id, unsigned short pci_bus, unsigned short pci_slot) +struct pcilst_struct *ptr_select_and_alloc_pci_card(unsigned short vendor_id, unsigned short device_id, unsigned short pci_bus, unsigned short pci_slot, int i_Master) { struct pcilst_struct *card; @@ -437,9 +467,11 @@ struct pcilst_struct *ptr_select_and_alloc_pci_card(unsigned short vendor_id, un } - if (i_pci_card_alloc(card)!=0) { + if (pci_card_alloc(card, i_Master)!=0) { rt_printk(" - Can't allocate card!\n"); return NULL; + + } return card; diff --git a/comedi/drivers/addi-data/addi_common.c b/comedi/drivers/addi-data/addi_common.c index d1ebfa7f..87466774 100644 --- a/comedi/drivers/addi-data/addi_common.c +++ b/comedi/drivers/addi-data/addi_common.c @@ -1,72 +1,60 @@ +/** +@verbatim +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -/*************************************************** - Generic Driver For ADDI APCI CARDs - - - - CONFIG OPTIONS - option[0] - PCI bus number - if bus number and slot number are 0, - then driver search for first unused card - option[1] - PCI slot number - - option[2]= 0 DMA ENABLE - = 1 DMA DISABLE - - ******************************************************************/ - -/*====================================================================== - Authors Email ID - Santosh Raktawan santosh.raktawan@tatainfotech.com - Sarath Chandran K R sarath.chandran@tatainfotech.com -========================================================================*/ - - +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +You shoud also find the complete GPL in the COPYING file accompanying this source code. +@endverbatim +*/ /* + +-----------------------------------------------------------------------+ | (C) ADDI-DATA GmbH Dieselstrasse 3 D-77833 Ottersweier | +-----------------------------------------------------------------------+ | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | +-----------------------------------------------------------------------+ - | Project : ADDI DATA | Compiler : GCC | + | Project : ADDI DATA | Compiler : GCC | | Modulname : addi_common.c | Version : 2.96 | +-------------------------------+---------------------------------------+ - | Author : | Date : | + | Author : | Date : | +-----------------------------------------------------------------------+ | Description : ADDI COMMON Main Module | +-----------------------------------------------------------------------+ - | UPDATE'S | - +-----------------------------------------------------------------------+ - | Date | Author | Description of updates | - +----------+-----------+------------------------------------------------+ - | | | | - | | | | - | | | | - | | | | - | | | | - +----------+-----------+------------------------------------------------+ - | | | | - | | | | - | | | | + | CONFIG OPTIONS | + | option[0] - PCI bus number - if bus number and slot number are 0, | + | then driver search for first unused card | + | option[1] - PCI slot number | + | | + | option[2] = 0 - DMA ENABLE | + | = 1 - DMA DISABLE | +----------+-----------+------------------------------------------------+ */ - - #include #include #include #include -#include +#include #include #include #include @@ -76,14 +64,32 @@ #include #include #include +#include +#include "../comedi_fc.h" #include "addi_common.h" #include "addi_amcc_s5933.h" -//#include "addi_eeprom.c" + +//Update-0.7.57->0.7.68MODULE_AUTHOR("ADDI-DATA GmbH "); +//Update-0.7.57->0.7.68MODULE_DESCRIPTION("Comedi ADDI-DATA module"); +//Update-0.7.57->0.7.68MODULE_LICENSE("GPL"); #define devpriv ((addi_private *)dev->private) #define this_board ((boardtype *)dev->board_ptr) +//BYTE b_SaveFPUReg [94]; + +void fpu_begin (void) + { + //asm ("fstenv b_SaveFPUReg"); + kernel_fpu_begin (); + } + +void fpu_end (void) + { + // asm ("frstor b_SaveFPUReg"); + kernel_fpu_end (); + } #include "addi_eeprom.c" #include "hwdrv_apci3120.c" @@ -98,15 +104,39 @@ #include "hwdrv_apci035.c" #include "hwdrv_apci3200.c" #include "hwdrv_APCI1710.c" +#include "hwdrv_apci16xx.c" +#include "hwdrv_apci3xxx.c" + static boardtype boardtypes[] = { - {"apci3120", APCI3120_BOARD_VENDOR_ID, 0x818D, - AMCC_OP_REG_SIZE, APCI3120_ADDRESS_RANGE,8,0, - ADDIDATA_NO_EEPROM,NULL, - 16, 8, 16, 8, 0xffff, 0x3fff, - &range_apci3120_ai, &range_apci3120_ao, - 4,4,0x0f,1,1,10000,100000, + {"apci3120", + APCI3120_BOARD_VENDOR_ID, + 0x818D, + AMCC_OP_REG_SIZE, + APCI3120_ADDRESS_RANGE, + 8, + 0, + ADDIDATA_NO_EEPROM, + NULL, + 16, + 8, + 16, + 8, + 0xffff, + 0x3fff, + &range_apci3120_ai, + &range_apci3120_ao, + 4, + 4, + 0x0f, + 0, + NULL, + 1, + 1, + 1, + 10000, + 100000, v_APCI3120_Interrupt, i_APCI3120_Reset, i_APCI3120_InsnConfigAnalogInput, @@ -130,14 +160,40 @@ static boardtype boardtypes[] = i_APCI3120_InsnConfigTimer, i_APCI3120_InsnWriteTimer, i_APCI3120_InsnReadTimer, - NULL + NULL, + NULL, + NULL, + NULL, + NULL }, - {"apci1032",APCI1032_BOARD_VENDOR_ID,0x1003, - 4,APCI1032_ADDRESS_RANGE,0,0, - ADDIDATA_EEPROM,ADDIDATA_93C76, - 0,0,0,0,0,0,0,0, - 32,0,0,0,0,0,0, + {"apci1032", + APCI1032_BOARD_VENDOR_ID, + 0x1003, + 4, + APCI1032_ADDRESS_RANGE, + 0, + 0, + ADDIDATA_EEPROM, + ADDIDATA_93C76, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 32, + 0, + 0, + 0, + NULL, + 0, + 0, + 0, + 0, + 0, v_APCI1032_Interrupt, i_APCI1032_Reset, NULL, @@ -161,13 +217,40 @@ static boardtype boardtypes[] = NULL, NULL, NULL, - NULL + NULL, + NULL, + NULL, + NULL, + NULL }, - {"apci1516",APCI1516_BOARD_VENDOR_ID,0x1001, - 128,APCI1516_ADDRESS_RANGE,32,0, - ADDIDATA_EEPROM,ADDIDATA_S5920, - 0,0,0,0,0,0,NULL,NULL,8, - 8,0,0,1,0,0, + + {"apci1516", + APCI1516_BOARD_VENDOR_ID, + 0x1001, + 128, + APCI1516_ADDRESS_RANGE, + 32, + 0, + ADDIDATA_EEPROM, + ADDIDATA_S5920, + 0, + 0, + 0, + 0, + 0, + 0, + NULL, + NULL, + 8, + 8, + 0, + 0, + NULL, + 0, + 1, + 0, + 0, + 0, NULL, i_APCI1516_Reset, NULL,NULL, @@ -190,18 +273,44 @@ static boardtype boardtypes[] = i_APCI1516_ConfigWatchdog, i_APCI1516_StartStopWriteWatchdog, i_APCI1516_ReadWatchdog, - NULL + NULL, + NULL, + NULL, + NULL, + NULL }, - {"apci2016",APCI2016_BOARD_VENDOR_ID,0x1002, - 128,APCI2016_ADDRESS_RANGE,32,0, - ADDIDATA_EEPROM,ADDIDATA_S5920, - 0,0,0,0,0,0, - NULL,NULL, - 0,16,0,0,1,0,0, - NULL, + {"apci2016", + APCI2016_BOARD_VENDOR_ID, + 0x1002, + 128, + APCI2016_ADDRESS_RANGE, + 32, + 0, + ADDIDATA_EEPROM, + ADDIDATA_S5920, + 0, + 0, + 0, + 0, + 0, + 0, + NULL, + NULL, + 0, + 16, + 0, + 0, + NULL, + 0, + 1, + 0, + 0, + 0, + NULL, i_APCI2016_Reset, - NULL,NULL, + NULL, + NULL, NULL, NULL, NULL, @@ -221,15 +330,40 @@ static boardtype boardtypes[] = i_APCI2016_ConfigWatchdog, i_APCI2016_StartStopWriteWatchdog, i_APCI2016_ReadWatchdog, - NULL + NULL, + NULL, + NULL, + NULL, + NULL }, - {"apci2032", APCI2032_BOARD_VENDOR_ID, 0x1004, - 4,APCI2032_ADDRESS_RANGE,0,0, - ADDIDATA_EEPROM,ADDIDATA_93C76, - 0, 0, 0, 0, 0, 0, - NULL, NULL, - 0,32,0xffffffff,0,1,0,0, + {"apci2032", + APCI2032_BOARD_VENDOR_ID, + 0x1004, + 4, + APCI2032_ADDRESS_RANGE, + 0, + 0, + ADDIDATA_EEPROM, + ADDIDATA_93C76, + 0, + 0, + 0, + 0, + 0, + 0, + NULL, + NULL, + 0, + 32, + 0xffffffff, + 0, + NULL, + 0, + 1, + 0, + 0, + 0, v_APCI2032_Interrupt, i_APCI2032_Reset, NULL,NULL, @@ -252,13 +386,40 @@ static boardtype boardtypes[] = i_APCI2032_ConfigWatchdog, i_APCI2032_StartStopWriteWatchdog, i_APCI2032_ReadWatchdog, - NULL + NULL, + NULL, + NULL, + NULL, + NULL }, - {"apci2200",APCI2200_BOARD_VENDOR_ID,0x1005, - 4,APCI2200_ADDRESS_RANGE,0,0, - ADDIDATA_EEPROM,ADDIDATA_93C76, - 0,0,0,0,0,0,NULL,NULL,8, - 16,0,0,1,0,0, + + {"apci2200", + APCI2200_BOARD_VENDOR_ID, + 0x1005, + 4, + APCI2200_ADDRESS_RANGE, + 0, + 0, + ADDIDATA_EEPROM, + ADDIDATA_93C76, + 0, + 0, + 0, + 0, + 0, + 0, + NULL, + NULL, + 8, + 16, + 0, + 0, + NULL, + 0, + 1, + 0, + 0, + 0, NULL, i_APCI2200_Reset, NULL,NULL, @@ -281,17 +442,44 @@ static boardtype boardtypes[] = i_APCI2200_ConfigWatchdog, i_APCI2200_StartStopWriteWatchdog, i_APCI2200_ReadWatchdog, - NULL + NULL, + NULL, + NULL, + NULL, + NULL }, - {"apci1564",APCI1564_BOARD_VENDOR_ID,0x1006, - 128,APCI1564_ADDRESS_RANGE,0,0, - ADDIDATA_EEPROM,ADDIDATA_93C76, - 0,0,0,0,0,0, - NULL,NULL, - 32,32,0xffffffff,0,1,0,0, + + {"apci1564", + APCI1564_BOARD_VENDOR_ID, + 0x1006, + 128, + APCI1564_ADDRESS_RANGE, + 0, + 0, + ADDIDATA_EEPROM, + ADDIDATA_93C76, + 0, + 0, + 0, + 0, + 0, + 0, + NULL, + NULL, + 32, + 32, + 0xffffffff, + 0, + NULL, + 0, + 1, + 0, + 0, + 0, v_APCI1564_Interrupt, i_APCI1564_Reset, - NULL,NULL, + NULL, + NULL, NULL, NULL, NULL, @@ -311,17 +499,44 @@ static boardtype boardtypes[] = i_APCI1564_ConfigTimerCounterWatchdog, i_APCI1564_StartStopWriteTimerCounterWatchdog, i_APCI1564_ReadTimerCounterWatchdog, - NULL + NULL, + NULL, + NULL, + NULL, + NULL }, - {"apci1500", APCI1500_BOARD_VENDOR_ID, 0x80fc, - 128,APCI1500_ADDRESS_RANGE,4,0, - ADDIDATA_NO_EEPROM,NULL, - 0, 0, 0, 0, 0, 0, - NULL, NULL, - 16,16,0xffff,0,1,0,0, + + {"apci1500", + APCI1500_BOARD_VENDOR_ID, + 0x80fc, + 128, + APCI1500_ADDRESS_RANGE, + 4, + 0, + ADDIDATA_NO_EEPROM, + NULL, + 0, + 0, + 0, + 0, + 0, + 0, + NULL, + NULL, + 16, + 16, + 0xffff, + 0, + NULL, + 0, + 1, + 0, + 0, + 0, v_APCI1500_Interrupt, i_APCI1500_Reset, - NULL,NULL, + NULL, + NULL, NULL, NULL, NULL, @@ -341,21 +556,47 @@ static boardtype boardtypes[] = i_APCI1500_ConfigCounterTimerWatchdog, i_APCI1500_StartStopTriggerTimerCounterWatchdog, i_APCI1500_ReadInterruptMask, - i_APCI1500_ReadCounterTimerWatchdog + i_APCI1500_ReadCounterTimerWatchdog, + NULL, + NULL, + NULL, + NULL }, - {"apci3001", APCI3120_BOARD_VENDOR_ID, 0x828D, - AMCC_OP_REG_SIZE, APCI3120_ADDRESS_RANGE,8,0, - ADDIDATA_NO_EEPROM,NULL, - 16, 8, 16, 0, 0xfff, 0, - &range_apci3120_ai, NULL, - 4,4,0x0f,1,1,10000,100000, + {"apci3001", + APCI3120_BOARD_VENDOR_ID, + 0x828D, + AMCC_OP_REG_SIZE, + APCI3120_ADDRESS_RANGE, + 8, + 0, + ADDIDATA_NO_EEPROM, + NULL, + 16, + 8, + 16, + 0, + 0xfff, + 0, + &range_apci3120_ai, + NULL, + 4, + 4, + 0x0f, + 0, + NULL, + 1, + 1, + 1, + 10000, + 100000, v_APCI3120_Interrupt, i_APCI3120_Reset, i_APCI3120_InsnConfigAnalogInput, i_APCI3120_InsnReadAnalogInput, - NULL,NULL, + NULL, + NULL, i_APCI3120_CommandTestAnalogInput, i_APCI3120_CommandAnalogInput, i_APCI3120_StopCyclicAcquisition, @@ -373,14 +614,40 @@ static boardtype boardtypes[] = i_APCI3120_InsnConfigTimer, i_APCI3120_InsnWriteTimer, i_APCI3120_InsnReadTimer, - NULL + NULL, + NULL, + NULL, + NULL, + NULL }, - {"apci3501", APCI3501_BOARD_VENDOR_ID, 0x3001, - 64,APCI3501_ADDRESS_RANGE,0,0, - ADDIDATA_EEPROM,ADDIDATA_S5933, - 0, 0, 0, 8, 0,16383, - NULL,&range_apci3501_ao, - 2,2,0x3,0,1,0,0, + + {"apci3501", + APCI3501_BOARD_VENDOR_ID, + 0x3001, + 64, + APCI3501_ADDRESS_RANGE, + 0, + 0, + ADDIDATA_EEPROM, + ADDIDATA_S5933, + 0, + 0, + 0, + 8, + 0, + 16383, + NULL, + &range_apci3501_ao, + 2, + 2, + 0x3, + 0, + NULL, + 0, + 1, + 0, + 0, + 0, v_APCI3501_Interrupt, i_APCI3501_Reset, NULL,NULL, @@ -403,18 +670,46 @@ static boardtype boardtypes[] = i_APCI3501_ConfigTimerCounterWatchdog, i_APCI3501_StartStopWriteTimerCounterWatchdog, i_APCI3501_ReadTimerCounterWatchdog, - NULL + NULL, + NULL, + NULL, + NULL, + NULL }, - {"apci035", APCI035_BOARD_VENDOR_ID, 0x0300, - 127,APCI035_ADDRESS_RANGE ,0,0,1,ADDIDATA_S5920, - 16,8,16,0, 0xff, 0, - &range_apci035_ai, NULL, - 0,0,0,0,1,10000,100000, + + {"apci035", + APCI035_BOARD_VENDOR_ID, + 0x0300, + 127, + APCI035_ADDRESS_RANGE , + 0, + 0, + 1, + ADDIDATA_S5920, + 16, + 8, + 16, + 0, + 0xff, + 0, + &range_apci035_ai, + NULL, + 0, + 0, + 0, + 0, + NULL, + 0, + 1, + 0, + 10000, + 100000, v_APCI035_Interrupt, i_APCI035_Reset, i_APCI035_ConfigAnalogInput, i_APCI035_ReadAnalogInput , - NULL,NULL, + NULL, + NULL, NULL, NULL, NULL, @@ -432,13 +727,40 @@ static boardtype boardtypes[] = i_APCI035_ConfigTimerWatchdog, i_APCI035_StartStopWriteTimerWatchdog, i_APCI035_ReadTimerWatchdog, - NULL + NULL, + NULL, + NULL, + NULL, + NULL }, - {"apci3200", APCI3200_BOARD_VENDOR_ID, 0x3000, - 128,256,4,4,ADDIDATA_EEPROM,ADDIDATA_S5920, - 16,8,16,0, 0x3ffff, 0, - &range_apci3200_ai, NULL, - 4,4,0,0,0,10000,100000, + + {"apci3200", + APCI3200_BOARD_VENDOR_ID, + 0x3000, + 128, + 256, + 4, + 4, + ADDIDATA_EEPROM, + ADDIDATA_S5920, + 16, + 8, + 16, + 0, + 0x3ffff, + 0, + &range_apci3200_ai, + NULL, + 4, + 4, + 0, + 0, + NULL, + 0, + 0, + 0, + 10000, + 100000, v_APCI3200_Interrupt, i_APCI3200_Reset, i_APCI3200_ConfigAnalogInput, @@ -462,15 +784,97 @@ static boardtype boardtypes[] = NULL, NULL, NULL, - NULL + NULL, + NULL, + NULL, + NULL, + NULL }, - + + //Begin JK 20.10.2004: APCI-3300 integration + {"apci3300", + APCI3200_BOARD_VENDOR_ID, + 0x3007, + 128, + 256, + 4, + 4, + ADDIDATA_EEPROM, + ADDIDATA_S5920, + 0, + 8, + 8, + 0, + 0x3ffff, + 0, + &range_apci3300_ai, + NULL, + 4, + 4, + 0, + 0, + NULL, + 0, + 0, + 0, + 10000, + 100000, + v_APCI3200_Interrupt, + i_APCI3200_Reset, + i_APCI3200_ConfigAnalogInput, + i_APCI3200_ReadAnalogInput , + i_APCI3200_InsnWriteReleaseAnalogInput, + i_APCI3200_InsnBits_AnalogInput_Test, + i_APCI3200_CommandTestAnalogInput, + i_APCI3200_CommandAnalogInput, + i_APCI3200_StopCyclicAcquisition, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3200_ReadDigitalInput, + i_APCI3200_ConfigDigitalOutput, + i_APCI3200_WriteDigitalOutput, + i_APCI3200_ReadDigitalOutput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + }, + + //End JK 20.10.2004: APCI-3300 integration {"apci1710",APCI1710_BOARD_VENDOR_ID,APCI1710_BOARD_DEVICE_ID, - 128,8,256,0, - ADDIDATA_NO_EEPROM,NULL, - 0, 0, 0, 0, 0, 0, - NULL, NULL, - 0,0,0,0,0,0,0, + 128, + 8, + 256, + 0, + ADDIDATA_NO_EEPROM, + NULL, + 0, + 0, + 0, + 0, + 0, + 0, + NULL, + NULL, + 0, + 0, + 0, + 0, + NULL, + 0, + 0, + 0, + 0, + 0, v_APCI1710_Interrupt, i_APCI1710_Reset, NULL, @@ -494,23 +898,1561 @@ static boardtype boardtypes[] = NULL, NULL, NULL, - NULL - } - -}; + NULL, + NULL, + NULL, + NULL, + NULL + }, + + {"apci1648", + 0x15B8, + 0x1009, + 128, + 0, + 0, + 0, + ADDIDATA_NO_EEPROM, + NULL, + 0, + 0, + 0, + 0, + 0, + 0, + NULL, + NULL, + 0, + 0, + 0, + 48, + &range_apci16xx_ttl, + 0, + 0, + 0, + 0, + 0, + NULL, + i_APCI16XX_Reset, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI16XX_InsnConfigInitTTLIO, + i_APCI16XX_InsnBitsReadTTLIO, + i_APCI16XX_InsnReadTTLIOAllPortValue, + i_APCI16XX_InsnBitsWriteTTLIO + }, -#define n_boardtypes (sizeof(boardtypes)/sizeof(boardtype)) -comedi_driver driver_addi ={ - driver_name: "addi_common", - module: THIS_MODULE, - attach: i_ADDI_Attach, - detach: i_ADDI_Detach, - num_names: n_boardtypes, - board_name: boardtypes, - offset: sizeof(boardtype), - }; + {"apci1696", + 0x15B8, + 0x100A, + 128, + 0, + 0, + 0, + ADDIDATA_NO_EEPROM, + NULL, + 0, + 0, + 0, + 0, + 0, + 0, + NULL, + NULL, + 0, + 0, + 0, + 96, + &range_apci16xx_ttl, + 0, + 0, + 0, + 0, + 0, + NULL, + i_APCI16XX_Reset, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI16XX_InsnConfigInitTTLIO, + i_APCI16XX_InsnBitsReadTTLIO, + i_APCI16XX_InsnReadTTLIOAllPortValue, + i_APCI16XX_InsnBitsWriteTTLIO + }, + {"apci3000-16", + 0x15B8, + 0x3010, + 256, + 256, + 256, + 256, + ADDIDATA_NO_EEPROM, + ADDIDATA_9054, + 16, + 8, + 16, + 0, + 4095, + 0, + &range_apci3XXX_ai, + NULL, + 0, + 0, + 0, + 24, + &range_apci3XXX_ttl, + 0, + 0, + 6, + 10000, + 0, + v_APCI3XXX_Interrupt, + i_APCI3XXX_Reset, + i_APCI3XXX_InsnConfigAnalogInput, + i_APCI3XXX_InsnReadAnalogInput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnConfigInitTTLIO, + i_APCI3XXX_InsnBitsTTLIO, + i_APCI3XXX_InsnReadTTLIO, + i_APCI3XXX_InsnWriteTTLIO + }, + + {"apci3000-8", + 0x15B8, + 0x300F, + 256, + 256, + 256, + 256, + ADDIDATA_NO_EEPROM, + ADDIDATA_9054, + 8, + 4, + 8, + 0, + 4095, + 0, + &range_apci3XXX_ai, + NULL, + 0, + 0, + 0, + 24, + &range_apci3XXX_ttl, + 0, + 0, + 6, + 10000, + 0, + v_APCI3XXX_Interrupt, + i_APCI3XXX_Reset, + i_APCI3XXX_InsnConfigAnalogInput, + i_APCI3XXX_InsnReadAnalogInput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnConfigInitTTLIO, + i_APCI3XXX_InsnBitsTTLIO, + i_APCI3XXX_InsnReadTTLIO, + i_APCI3XXX_InsnWriteTTLIO + }, + + {"apci3000-4", + 0x15B8, + 0x300E, + 256, + 256, + 256, + 256, + ADDIDATA_NO_EEPROM, + ADDIDATA_9054, + 4, + 2, + 4, + 0, + 4095, + 0, + &range_apci3XXX_ai, + NULL, + 0, + 0, + 0, + 24, + &range_apci3XXX_ttl, + 0, + 0, + 6, + 10000, + 0, + v_APCI3XXX_Interrupt, + i_APCI3XXX_Reset, + i_APCI3XXX_InsnConfigAnalogInput, + i_APCI3XXX_InsnReadAnalogInput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnConfigInitTTLIO, + i_APCI3XXX_InsnBitsTTLIO, + i_APCI3XXX_InsnReadTTLIO, + i_APCI3XXX_InsnWriteTTLIO + }, + + {"apci3006-16", + 0x15B8, + 0x3013, + 256, + 256, + 256, + 256, + ADDIDATA_NO_EEPROM, + ADDIDATA_9054, + 16, + 8, + 16, + 0, + 65535, + 0, + &range_apci3XXX_ai, + NULL, + 0, + 0, + 0, + 24, + &range_apci3XXX_ttl, + 0, + 0, + 6, + 10000, + 0, + v_APCI3XXX_Interrupt, + i_APCI3XXX_Reset, + i_APCI3XXX_InsnConfigAnalogInput, + i_APCI3XXX_InsnReadAnalogInput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnConfigInitTTLIO, + i_APCI3XXX_InsnBitsTTLIO, + i_APCI3XXX_InsnReadTTLIO, + i_APCI3XXX_InsnWriteTTLIO + }, + + {"apci3006-8", + 0x15B8, + 0x3014, + 256, + 256, + 256, + 256, + ADDIDATA_NO_EEPROM, + ADDIDATA_9054, + 8, + 4, + 8, + 0, + 65535, + 0, + &range_apci3XXX_ai, + NULL, + 0, + 0, + 0, + 24, + &range_apci3XXX_ttl, + 0, + 0, + 6, + 10000, + 0, + v_APCI3XXX_Interrupt, + i_APCI3XXX_Reset, + i_APCI3XXX_InsnConfigAnalogInput, + i_APCI3XXX_InsnReadAnalogInput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnConfigInitTTLIO, + i_APCI3XXX_InsnBitsTTLIO, + i_APCI3XXX_InsnReadTTLIO, + i_APCI3XXX_InsnWriteTTLIO + }, + + {"apci3006-4", + 0x15B8, + 0x3015, + 256, + 256, + 256, + 256, + ADDIDATA_NO_EEPROM, + ADDIDATA_9054, + 4, + 2, + 4, + 0, + 65535, + 0, + &range_apci3XXX_ai, + NULL, + 0, + 0, + 0, + 24, + &range_apci3XXX_ttl, + 0, + 0, + 6, + 10000, + 0, + v_APCI3XXX_Interrupt, + i_APCI3XXX_Reset, + i_APCI3XXX_InsnConfigAnalogInput, + i_APCI3XXX_InsnReadAnalogInput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnConfigInitTTLIO, + i_APCI3XXX_InsnBitsTTLIO, + i_APCI3XXX_InsnReadTTLIO, + i_APCI3XXX_InsnWriteTTLIO + }, + + {"apci3010-16", + 0x15B8, + 0x3016, + 256, + 256, + 256, + 256, + ADDIDATA_NO_EEPROM, + ADDIDATA_9054, + 16, + 8, + 16, + 0, + 4095, + 0, + &range_apci3XXX_ai, + NULL, + 4, + 4, + 0xF, + 24, + &range_apci3XXX_ttl, + 0, + 0, + 6, + 5000, + 0, + v_APCI3XXX_Interrupt, + i_APCI3XXX_Reset, + i_APCI3XXX_InsnConfigAnalogInput, + i_APCI3XXX_InsnReadAnalogInput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnReadDigitalInput, + NULL, + i_APCI3XXX_InsnBitsDigitalInput, + NULL, + i_APCI3XXX_InsnWriteDigitalOutput, + i_APCI3XXX_InsnBitsDigitalOutput, + i_APCI3XXX_InsnReadDigitalOutput, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnConfigInitTTLIO, + i_APCI3XXX_InsnBitsTTLIO, + i_APCI3XXX_InsnReadTTLIO, + i_APCI3XXX_InsnWriteTTLIO + }, + + {"apci3010-8", + 0x15B8, + 0x3017, + 256, + 256, + 256, + 256, + ADDIDATA_NO_EEPROM, + ADDIDATA_9054, + 8, + 4, + 8, + 0, + 4095, + 0, + &range_apci3XXX_ai, + NULL, + 4, + 4, + 0xF, + 24, + &range_apci3XXX_ttl, + 0, + 0, + 6, + 5000, + 0, + v_APCI3XXX_Interrupt, + i_APCI3XXX_Reset, + i_APCI3XXX_InsnConfigAnalogInput, + i_APCI3XXX_InsnReadAnalogInput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnReadDigitalInput, + NULL, + i_APCI3XXX_InsnBitsDigitalInput, + NULL, + i_APCI3XXX_InsnWriteDigitalOutput, + i_APCI3XXX_InsnBitsDigitalOutput, + i_APCI3XXX_InsnReadDigitalOutput, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnConfigInitTTLIO, + i_APCI3XXX_InsnBitsTTLIO, + i_APCI3XXX_InsnReadTTLIO, + i_APCI3XXX_InsnWriteTTLIO + }, + + {"apci3010-4", + 0x15B8, + 0x3018, + 256, + 256, + 256, + 256, + ADDIDATA_NO_EEPROM, + ADDIDATA_9054, + 4, + 2, + 4, + 0, + 4095, + 0, + &range_apci3XXX_ai, + NULL, + 4, + 4, + 0xF, + 24, + &range_apci3XXX_ttl, + 0, + 0, + 6, + 5000, + 0, + v_APCI3XXX_Interrupt, + i_APCI3XXX_Reset, + i_APCI3XXX_InsnConfigAnalogInput, + i_APCI3XXX_InsnReadAnalogInput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnReadDigitalInput, + NULL, + i_APCI3XXX_InsnBitsDigitalInput, + NULL, + i_APCI3XXX_InsnWriteDigitalOutput, + i_APCI3XXX_InsnBitsDigitalOutput, + i_APCI3XXX_InsnReadDigitalOutput, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnConfigInitTTLIO, + i_APCI3XXX_InsnBitsTTLIO, + i_APCI3XXX_InsnReadTTLIO, + i_APCI3XXX_InsnWriteTTLIO + }, + + {"apci3016-16", + 0x15B8, + 0x3019, + 256, + 256, + 256, + 256, + ADDIDATA_NO_EEPROM, + ADDIDATA_9054, + 16, + 8, + 16, + 0, + 65535, + 0, + &range_apci3XXX_ai, + NULL, + 4, + 4, + 0xF, + 24, + &range_apci3XXX_ttl, + 0, + 0, + 6, + 5000, + 0, + v_APCI3XXX_Interrupt, + i_APCI3XXX_Reset, + i_APCI3XXX_InsnConfigAnalogInput, + i_APCI3XXX_InsnReadAnalogInput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnReadDigitalInput, + NULL, + i_APCI3XXX_InsnBitsDigitalInput, + NULL, + i_APCI3XXX_InsnWriteDigitalOutput, + i_APCI3XXX_InsnBitsDigitalOutput, + i_APCI3XXX_InsnReadDigitalOutput, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnConfigInitTTLIO, + i_APCI3XXX_InsnBitsTTLIO, + i_APCI3XXX_InsnReadTTLIO, + i_APCI3XXX_InsnWriteTTLIO + }, + + {"apci3016-8", + 0x15B8, + 0x301A, + 256, + 256, + 256, + 256, + ADDIDATA_NO_EEPROM, + ADDIDATA_9054, + 8, + 4, + 8, + 0, + 65535, + 0, + &range_apci3XXX_ai, + NULL, + 4, + 4, + 0xF, + 24, + &range_apci3XXX_ttl, + 0, + 0, + 6, + 5000, + 0, + v_APCI3XXX_Interrupt, + i_APCI3XXX_Reset, + i_APCI3XXX_InsnConfigAnalogInput, + i_APCI3XXX_InsnReadAnalogInput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnReadDigitalInput, + NULL, + i_APCI3XXX_InsnBitsDigitalInput, + NULL, + i_APCI3XXX_InsnWriteDigitalOutput, + i_APCI3XXX_InsnBitsDigitalOutput, + i_APCI3XXX_InsnReadDigitalOutput, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnConfigInitTTLIO, + i_APCI3XXX_InsnBitsTTLIO, + i_APCI3XXX_InsnReadTTLIO, + i_APCI3XXX_InsnWriteTTLIO + }, + + {"apci3016-4", + 0x15B8, + 0x301B, + 256, + 256, + 256, + 256, + ADDIDATA_NO_EEPROM, + ADDIDATA_9054, + 4, + 2, + 4, + 0, + 65535, + 0, + &range_apci3XXX_ai, + NULL, + 4, + 4, + 0xF, + 24, + &range_apci3XXX_ttl, + 0, + 0, + 6, + 5000, + 0, + v_APCI3XXX_Interrupt, + i_APCI3XXX_Reset, + i_APCI3XXX_InsnConfigAnalogInput, + i_APCI3XXX_InsnReadAnalogInput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnReadDigitalInput, + NULL, + i_APCI3XXX_InsnBitsDigitalInput, + NULL, + i_APCI3XXX_InsnWriteDigitalOutput, + i_APCI3XXX_InsnBitsDigitalOutput, + i_APCI3XXX_InsnReadDigitalOutput, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnConfigInitTTLIO, + i_APCI3XXX_InsnBitsTTLIO, + i_APCI3XXX_InsnReadTTLIO, + i_APCI3XXX_InsnWriteTTLIO + }, + + {"apci3100-16-4", + 0x15B8, + 0x301C, + 256, + 256, + 256, + 256, + ADDIDATA_NO_EEPROM, + ADDIDATA_9054, + 16, + 8, + 16, + 4, + 4095, + 4095, + &range_apci3XXX_ai, + &range_apci3XXX_ao, + 4, + 4, + 0xF, + 24, + &range_apci3XXX_ttl, + 0, + 0, + 6, + 10000, + 0, + v_APCI3XXX_Interrupt, + i_APCI3XXX_Reset, + i_APCI3XXX_InsnConfigAnalogInput, + i_APCI3XXX_InsnReadAnalogInput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnWriteAnalogOutput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnConfigInitTTLIO, + i_APCI3XXX_InsnBitsTTLIO, + i_APCI3XXX_InsnReadTTLIO, + i_APCI3XXX_InsnWriteTTLIO + }, + + {"apci3100-8-4", + 0x15B8, + 0x301D, + 256, + 256, + 256, + 256, + ADDIDATA_NO_EEPROM, + ADDIDATA_9054, + 8, + 4, + 8, + 4, + 4095, + 4095, + &range_apci3XXX_ai, + &range_apci3XXX_ao, + 4, + 4, + 0xF, + 24, + &range_apci3XXX_ttl, + 0, + 0, + 6, + 10000, + 0, + v_APCI3XXX_Interrupt, + i_APCI3XXX_Reset, + i_APCI3XXX_InsnConfigAnalogInput, + i_APCI3XXX_InsnReadAnalogInput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnWriteAnalogOutput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnConfigInitTTLIO, + i_APCI3XXX_InsnBitsTTLIO, + i_APCI3XXX_InsnReadTTLIO, + i_APCI3XXX_InsnWriteTTLIO + }, + + {"apci3106-16-4", + 0x15B8, + 0x301E, + 256, + 256, + 256, + 256, + ADDIDATA_NO_EEPROM, + ADDIDATA_9054, + 16, + 8, + 16, + 4, + 65535, + 4095, + &range_apci3XXX_ai, + &range_apci3XXX_ao, + 4, + 4, + 0xF, + 24, + &range_apci3XXX_ttl, + 0, + 0, + 6, + 10000, + 0, + v_APCI3XXX_Interrupt, + i_APCI3XXX_Reset, + i_APCI3XXX_InsnConfigAnalogInput, + i_APCI3XXX_InsnReadAnalogInput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnWriteAnalogOutput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnConfigInitTTLIO, + i_APCI3XXX_InsnBitsTTLIO, + i_APCI3XXX_InsnReadTTLIO, + i_APCI3XXX_InsnWriteTTLIO + }, + + {"apci3106-8-4", + 0x15B8, + 0x301F, + 256, + 256, + 256, + 256, + ADDIDATA_NO_EEPROM, + ADDIDATA_9054, + 8, + 4, + 8, + 4, + 65535, + 4095, + &range_apci3XXX_ai, + &range_apci3XXX_ao, + 4, + 4, + 0xF, + 24, + &range_apci3XXX_ttl, + 0, + 0, + 6, + 10000, + 0, + v_APCI3XXX_Interrupt, + i_APCI3XXX_Reset, + i_APCI3XXX_InsnConfigAnalogInput, + i_APCI3XXX_InsnReadAnalogInput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnWriteAnalogOutput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnConfigInitTTLIO, + i_APCI3XXX_InsnBitsTTLIO, + i_APCI3XXX_InsnReadTTLIO, + i_APCI3XXX_InsnWriteTTLIO + }, + + {"apci3110-16-4", + 0x15B8, + 0x3020, + 256, + 256, + 256, + 256, + ADDIDATA_NO_EEPROM, + ADDIDATA_9054, + 16, + 8, + 16, + 4, + 4095, + 4095, + &range_apci3XXX_ai, + &range_apci3XXX_ao, + 4, + 4, + 0xF, + 24, + &range_apci3XXX_ttl, + 0, + 0, + 6, + 5000, + 0, + v_APCI3XXX_Interrupt, + i_APCI3XXX_Reset, + i_APCI3XXX_InsnConfigAnalogInput, + i_APCI3XXX_InsnReadAnalogInput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnWriteAnalogOutput, + NULL, + NULL, + i_APCI3XXX_InsnReadDigitalInput, + NULL, + i_APCI3XXX_InsnBitsDigitalInput, + NULL, + i_APCI3XXX_InsnWriteDigitalOutput, + i_APCI3XXX_InsnBitsDigitalOutput, + i_APCI3XXX_InsnReadDigitalOutput, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnConfigInitTTLIO, + i_APCI3XXX_InsnBitsTTLIO, + i_APCI3XXX_InsnReadTTLIO, + i_APCI3XXX_InsnWriteTTLIO + }, + + {"apci3110-8-4", + 0x15B8, + 0x3021, + 256, + 256, + 256, + 256, + ADDIDATA_NO_EEPROM, + ADDIDATA_9054, + 8, + 4, + 8, + 4, + 4095, + 4095, + &range_apci3XXX_ai, + &range_apci3XXX_ao, + 4, + 4, + 0xF, + 24, + &range_apci3XXX_ttl, + 0, + 0, + 6, + 5000, + 0, + v_APCI3XXX_Interrupt, + i_APCI3XXX_Reset, + i_APCI3XXX_InsnConfigAnalogInput, + i_APCI3XXX_InsnReadAnalogInput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnWriteAnalogOutput, + NULL, + NULL, + i_APCI3XXX_InsnReadDigitalInput, + NULL, + i_APCI3XXX_InsnBitsDigitalInput, + NULL, + i_APCI3XXX_InsnWriteDigitalOutput, + i_APCI3XXX_InsnBitsDigitalOutput, + i_APCI3XXX_InsnReadDigitalOutput, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnConfigInitTTLIO, + i_APCI3XXX_InsnBitsTTLIO, + i_APCI3XXX_InsnReadTTLIO, + i_APCI3XXX_InsnWriteTTLIO + }, + + {"apci3116-16-4", + 0x15B8, + 0x3022, + 256, + 256, + 256, + 256, + ADDIDATA_NO_EEPROM, + ADDIDATA_9054, + 16, + 8, + 16, + 4, + 65535, + 4095, + &range_apci3XXX_ai, + &range_apci3XXX_ao, + 4, + 4, + 0xF, + 24, + &range_apci3XXX_ttl, + 0, + 0, + 6, + 5000, + 0, + v_APCI3XXX_Interrupt, + i_APCI3XXX_Reset, + i_APCI3XXX_InsnConfigAnalogInput, + i_APCI3XXX_InsnReadAnalogInput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnWriteAnalogOutput, + NULL, + NULL, + i_APCI3XXX_InsnReadDigitalInput, + NULL, + i_APCI3XXX_InsnBitsDigitalInput, + NULL, + i_APCI3XXX_InsnWriteDigitalOutput, + i_APCI3XXX_InsnBitsDigitalOutput, + i_APCI3XXX_InsnReadDigitalOutput, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnConfigInitTTLIO, + i_APCI3XXX_InsnBitsTTLIO, + i_APCI3XXX_InsnReadTTLIO, + i_APCI3XXX_InsnWriteTTLIO + }, + + {"apci3116-8-4", + 0x15B8, + 0x3023, + 256, + 256, + 256, + 256, + ADDIDATA_NO_EEPROM, + ADDIDATA_9054, + 8, + 4, + 8, + 4, + 65535, + 4095, + &range_apci3XXX_ai, + &range_apci3XXX_ao, + 4, + 4, + 0xF, + 24, + &range_apci3XXX_ttl, + 0, + 0, + 6, + 5000, + 0, + v_APCI3XXX_Interrupt, + i_APCI3XXX_Reset, + i_APCI3XXX_InsnConfigAnalogInput, + i_APCI3XXX_InsnReadAnalogInput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnWriteAnalogOutput, + NULL, + NULL, + i_APCI3XXX_InsnReadDigitalInput, + NULL, + i_APCI3XXX_InsnBitsDigitalInput, + NULL, + i_APCI3XXX_InsnWriteDigitalOutput, + i_APCI3XXX_InsnBitsDigitalOutput, + i_APCI3XXX_InsnReadDigitalOutput, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnConfigInitTTLIO, + i_APCI3XXX_InsnBitsTTLIO, + i_APCI3XXX_InsnReadTTLIO, + i_APCI3XXX_InsnWriteTTLIO + }, + + {"apci3003", + 0x15B8, + 0x300B, + 256, + 256, + 256, + 256, + ADDIDATA_NO_EEPROM, + ADDIDATA_9054, + 0, + 4, + 4, + 0, + 65535, + 0, + &range_apci3XXX_ai, + NULL, + 4, + 4, + 0xF, + 0, + NULL, + 0, + 0, + 7, + 2500, + 0, + v_APCI3XXX_Interrupt, + i_APCI3XXX_Reset, + i_APCI3XXX_InsnConfigAnalogInput, + i_APCI3XXX_InsnReadAnalogInput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnReadDigitalInput, + NULL, + i_APCI3XXX_InsnBitsDigitalInput, + NULL, + i_APCI3XXX_InsnWriteDigitalOutput, + i_APCI3XXX_InsnBitsDigitalOutput, + i_APCI3XXX_InsnReadDigitalOutput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + }, + + {"apci3002-16", + 0x15B8, + 0x3002, + 256, + 256, + 256, + 256, + ADDIDATA_NO_EEPROM, + ADDIDATA_9054, + 0, + 16, + 16, + 0, + 65535, + 0, + &range_apci3XXX_ai, + NULL, + 4, + 4, + 0xF, + 0, + NULL, + 0, + 0, + 6, + 5000, + 0, + v_APCI3XXX_Interrupt, + i_APCI3XXX_Reset, + i_APCI3XXX_InsnConfigAnalogInput, + i_APCI3XXX_InsnReadAnalogInput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnReadDigitalInput, + NULL, + i_APCI3XXX_InsnBitsDigitalInput, + NULL, + i_APCI3XXX_InsnWriteDigitalOutput, + i_APCI3XXX_InsnBitsDigitalOutput, + i_APCI3XXX_InsnReadDigitalOutput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + }, + + {"apci3002-8", + 0x15B8, + 0x3003, + 256, + 256, + 256, + 256, + ADDIDATA_NO_EEPROM, + ADDIDATA_9054, + 0, + 8, + 8, + 0, + 65535, + 0, + &range_apci3XXX_ai, + NULL, + 4, + 4, + 0xF, + 0, + NULL, + 0, + 0, + 6, + 5000, + 0, + v_APCI3XXX_Interrupt, + i_APCI3XXX_Reset, + i_APCI3XXX_InsnConfigAnalogInput, + i_APCI3XXX_InsnReadAnalogInput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnReadDigitalInput, + NULL, + i_APCI3XXX_InsnBitsDigitalInput, + NULL, + i_APCI3XXX_InsnWriteDigitalOutput, + i_APCI3XXX_InsnBitsDigitalOutput, + i_APCI3XXX_InsnReadDigitalOutput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + }, + + {"apci3002-4", + 0x15B8, + 0x3004, + 256, + 256, + 256, + 256, + ADDIDATA_NO_EEPROM, + ADDIDATA_9054, + 0, + 4, + 4, + 0, + 65535, + 0, + &range_apci3XXX_ai, + NULL, + 4, + 4, + 0xF, + 0, + NULL, + 0, + 0, + 6, + 5000, + 0, + v_APCI3XXX_Interrupt, + i_APCI3XXX_Reset, + i_APCI3XXX_InsnConfigAnalogInput, + i_APCI3XXX_InsnReadAnalogInput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnReadDigitalInput, + NULL, + i_APCI3XXX_InsnBitsDigitalInput, + NULL, + i_APCI3XXX_InsnWriteDigitalOutput, + i_APCI3XXX_InsnBitsDigitalOutput, + i_APCI3XXX_InsnReadDigitalOutput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + }, + + {"apci3500", + 0x15B8, + 0x3024, + 256, + 256, + 256, + 256, + ADDIDATA_NO_EEPROM, + ADDIDATA_9054, + 0, + 0, + 0, + 4, + 0, + 4095, + NULL, + &range_apci3XXX_ao, + 0, + 0, + 0, + 24, + &range_apci3XXX_ttl, + 0, + 0, + 0, + 0, + 0, + v_APCI3XXX_Interrupt, + i_APCI3XXX_Reset, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnWriteAnalogOutput, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + i_APCI3XXX_InsnConfigInitTTLIO, + i_APCI3XXX_InsnBitsTTLIO, + i_APCI3XXX_InsnReadTTLIO, + i_APCI3XXX_InsnWriteTTLIO + }, +}; + +#define n_boardtypes (sizeof(boardtypes)/sizeof(boardtype)) + +comedi_driver driver_addi ={ + driver_name: "addi_common", + module: THIS_MODULE, + attach: i_ADDI_Attach, + detach: i_ADDI_Detach, + num_names: n_boardtypes, + board_name: boardtypes, + offset: sizeof(boardtype), + }; //This macro is defined in comedidev.h @@ -523,7 +2465,6 @@ COMEDI_INITCLEANUP(driver_addi); - /* +----------------------------------------------------------------------------+ | Function name :static int i_ADDI_Attach(comedi_device *dev, | @@ -548,339 +2489,293 @@ COMEDI_INITCLEANUP(driver_addi); static int i_ADDI_Attach(comedi_device *dev,comedi_devconfig *it) { comedi_subdevice *s; - int ret,pages,i; + int ret,pages,i,n_subdevices; DWORD dw_Dummy; - unsigned short io_addr[5],master,irq;//v_58 - unsigned int iobase_a,iobase_main,iobase_addon,iobase_reserved; + unsigned long io_addr[5]; + unsigned short master,irq;//v_58 + unsigned long iobase_a,iobase_main,iobase_addon,iobase_reserved; struct pcilst_struct *card=NULL; unsigned char pci_bus,pci_slot,pci_func; + int i_Dma = 0; + static char c_Identifier [150]; + + sprintf (c_Identifier, "Addi-Data GmbH Comedi %s", this_board->pc_DriverName); if (!pci_list_builded) - { - v_pci_card_list_init(this_board->i_VendorId,1); //1 for displaying the list.. - pci_list_builded=1; - } + { + v_pci_card_list_init(this_board->i_VendorId,1); //1 for displaying the list.. + pci_list_builded=1; + } + //rt_printk("comedi%d: addi_common: board=%s",dev->minor,this_board->pc_DriverName); - if ((card=ptr_select_and_alloc_pci_card(this_board->i_VendorId, this_board->i_DeviceId, it->options[0], it->options[1]))==NULL) - return -EIO; + if ((this_board->i_Dma) && (it->options[2] == 0)) + { + i_Dma = 1; + } + + if ((card=ptr_select_and_alloc_pci_card(this_board->i_VendorId, + this_board->i_DeviceId, + it->options[0], + it->options[1], + i_Dma))==NULL) + { + return -EIO; + } + if ((i_pci_card_data(card,&pci_bus,&pci_slot,&pci_func,&io_addr[0],&irq,&master))<0) - { - i_pci_card_free(card); - rt_printk(" - Can't get AMCC data!\n"); - return -EIO; - } + { + i_pci_card_free(card); + printk(" - Can't get AMCC data!\n"); + return -EIO; + } + iobase_a=io_addr[0]; iobase_main=io_addr[1]; iobase_addon=io_addr[2]; iobase_reserved=io_addr[3]; - rt_printk(", b:s:f=%d:%d:%d, base0:0x%4x, base1: 0x%4x, base2: 0x%4x",pci_bus,pci_slot,pci_func,io_addr[0],io_addr[1],io_addr[2]); - if (check_region(iobase_main, this_board->i_IorangeBase1) < 0) - { - rt_printk("I/O port conflict\n"); - return -EIO; - } - //if(this_board->i_Dma) - if(iobase_a) - { - if (check_region(iobase_a, this_board->i_IorangeBase0) < 0) - { - printk("AMCC check region failed\n"); - rt_printk("I/O port conflict\n"); - return -EIO; - } - } - - // ## - if(io_addr[2]) - { - if (check_region(io_addr[2], this_board->i_IorangeBase2) < 0) - { - printk("Base 2 check region failed\n"); - rt_printk("I/O port conflict\n"); - return -EIO; - } - - - } - //## - dev->iobase=iobase_main;// DAQ base address... - request_region(dev->iobase, this_board->i_IorangeBase1, "ADDI COMMON"); - - dev->board_name =this_board->pc_DriverName; - if((ret=alloc_private(dev,sizeof(addi_private)))<0) - return -ENOMEM; - devpriv->amcc=card; - devpriv->master=master; //testing - devpriv->iobase=dev->iobase; - devpriv->i_IobaseAmcc=iobase_a;//AMCC base address... - devpriv->i_IobaseAddon=iobase_addon;//ADD ON base address.... - devpriv->i_IobaseReserved=iobase_reserved; - - //if(this_board->i_Dma) - if(iobase_a) - { - request_region(devpriv->i_IobaseAmcc,this_board->i_IorangeBase0, "ADDI COMMON"); - } + printk("\nBus %d: Slot %d: Funct%d\nBase0: 0x%8lx\nBase1: 0x%8lx\nBase2: 0x%8lx\nBase3: 0x%8lx\n", + pci_bus,pci_slot,pci_func,io_addr[0],io_addr[1],io_addr[2],io_addr[3]); + + if ((this_board->pc_EepromChip == NULL) || (strcmp (this_board->pc_EepromChip, ADDIDATA_9054) != 0)) + { + if (iobase_main) + { + if (check_region(iobase_main, this_board->i_IorangeBase1) < 0) + { + printk("I/O port conflict\n"); + return -EIO; + } + } + + //if(this_board->i_Dma) + if(iobase_a) + { + if (check_region(iobase_a, this_board->i_IorangeBase0) < 0) + { + printk("AMCC check region failed\n"); + printk("I/O port conflict\n"); + return -EIO; + } + } + + // ## + if(io_addr[2]) + { + if (check_region(io_addr[2], this_board->i_IorangeBase2) < 0) + { + printk("\nBase 2 check region failed"); + printk("\nI/O port conflict"); + return -EIO; + } + } + //## + + /************************************/ + /* Test if more that 1 address used */ + /************************************/ + + if (this_board->i_IorangeBase1 != 0) + { + dev->iobase=iobase_main;// DAQ base address... + printk("\nrequest_region i_IorangeBase1 - 1\n"); + request_region(dev->iobase, this_board->i_IorangeBase1, c_Identifier); + printk("\nrequest_region i_IorangeBase1 - 1 OK\n"); + } + else + { + dev->iobase=iobase_a;// DAQ base address... + printk("\nrequest_region i_IorangeBase0 - 2"); + request_region(dev->iobase, this_board->i_IorangeBase0, c_Identifier); + printk("\nrequest_region i_IorangeBase0 - 2 %lX OK", dev->iobase); + } + + dev->board_name =this_board->pc_DriverName; + if((ret=alloc_private(dev,sizeof(addi_private)))<0) + { + return -ENOMEM; + } + devpriv->amcc=card; + devpriv->master=master; //testing + devpriv->iobase=dev->iobase; + devpriv->i_IobaseAmcc=iobase_a;//AMCC base address... + devpriv->i_IobaseAddon=iobase_addon;//ADD ON base address.... + devpriv->i_IobaseReserved=iobase_reserved; + devpriv->ps_BoardInfo = this_board; + + //if(this_board->i_Dma) + if((iobase_a) && (iobase_a != dev->iobase)) + { + request_region(devpriv->i_IobaseAmcc,this_board->i_IorangeBase0, c_Identifier); + printk("\nrequest_region i_IorangeBase0 - 3 OK\n"); + } - //## - if(io_addr[2]) - { - request_region(io_addr[2],this_board->i_IorangeBase2, "ADDI COMMON"); - } + //## + if(io_addr[2]) + { + printk("request_region i_IorangeBase2\n"); + request_region(io_addr[2],this_board->i_IorangeBase2, c_Identifier); + printk("request_region i_IorangeBase2 OK\n"); + } + } + else + { + if((ret=alloc_private(dev,sizeof(addi_private)))<0) + { + return -ENOMEM; + } + + if (pci_request_regions (card->pcidev, c_Identifier)) + { + printk("\nRequest regions error\n"); + return -EIO; + } + + dev->board_name =this_board->pc_DriverName; + dev->iobase=io_addr[2]; + devpriv->amcc=card; + devpriv->iobase=io_addr[2]; + devpriv->ps_BoardInfo = this_board; + devpriv->i_IobaseReserved=io_addr[3]; + printk ("\nioremap begin"); + devpriv->dw_AiBase=(UINT) ioremap(io_addr[3],this_board->i_IorangeBase3); + printk ("\nioremap end"); + } //## if (irq>0) - { - if (comedi_request_irq(irq, v_ADDI_Interrupt, SA_SHIRQ, "ADDI COMMON", dev)) - { - rt_printk(", unable to allocate IRQ %d, DISABLING IT", irq); - irq=0; /* Can't use IRQ */ - } - else - { - rt_printk(", irq=%d", irq); - } - } + { + if (comedi_request_irq(irq, v_ADDI_Interrupt, SA_SHIRQ, c_Identifier, dev) < 0) + { + printk(", unable to allocate IRQ %d, DISABLING IT", irq); + irq=0; /* Can't use IRQ */ + } + else + { + rt_printk("\nirq=%d", irq); + enable_irq (irq); + } + } else - { - rt_printk(", IRQ disabled"); - } - rt_printk("\n%d %d %d\n",it->options[0],it->options[1],it->options[2]); + { + rt_printk(", IRQ disabled"); + } + + printk("\nOption %d %d %d\n",it->options[0],it->options[1],it->options[2]); dev->irq = irq; // Read eepeom and fill boardtype Structure if(this_board->i_PCIEeprom) - { - if (!(strcmp(this_board->pc_EepromChip, "S5920"))) - { - // Set 3 wait stait - if(!(strcmp(this_board->pc_DriverName,"apci035"))) - { - outl(0x80808082,devpriv->i_IobaseAmcc+0x60); - } - else - { - outl(0x83838383,devpriv->i_IobaseAmcc+0x60); - } - // Enable the interrupt for the controler - dw_Dummy = inl(devpriv->i_IobaseAmcc+ 0x38); - outl(dw_Dummy | 0x2000,devpriv->i_IobaseAmcc+0x38); - } - i_EepromReadMainHeader(io_addr[0],this_board->pc_EepromChip,dev); - } - if (it->options[2]>0) + { + printk("\nPCI Eeprom used"); + if (!(strcmp(this_board->pc_EepromChip, "S5920"))) + { + // Set 3 wait stait + if(!(strcmp(this_board->pc_DriverName,"apci035"))) + { + outl(0x80808082,devpriv->i_IobaseAmcc+0x60); + } + else + { + outl(0x83838383,devpriv->i_IobaseAmcc+0x60); + } + // Enable the interrupt for the controler + dw_Dummy = inl(devpriv->i_IobaseAmcc+ 0x38); + outl(dw_Dummy | 0x2000,devpriv->i_IobaseAmcc+0x38); + printk ("\nEnable the interrupt for the controler"); + } + printk("\nRead Eeprom"); + i_EepromReadMainHeader(io_addr[0],this_board->pc_EepromChip,dev); + } + else + { + printk("\nPCI Eeprom unused"); + } + + if (it->options[2]>0) { - devpriv->us_UseDma=ADDI_DISABLE; + devpriv->us_UseDma=ADDI_DISABLE; } else { - devpriv->us_UseDma=ADDI_ENABLE; + devpriv->us_UseDma=ADDI_ENABLE; } - if(this_board->i_Dma) - { - if (devpriv->us_UseDma==ADDI_ENABLE) - { - // alloc DMA buffers - devpriv->b_DmaDoubleBuffer=0; - for (i=0; i<2; i++) - { - for (pages=4; pages>=0; pages--) - { - - if((devpriv->ul_DmaBufferVirtual[i]=__get_free_pages(GFP_KERNEL,pages))) - break; - - } - - - if (devpriv->ul_DmaBufferVirtual[i]) - { - - devpriv->ui_DmaBufferPages[i]=pages; - devpriv->ui_DmaBufferSize[i]=PAGE_SIZE*pages; - devpriv->ui_DmaBufferSamples[i]=devpriv->ui_DmaBufferSize[i]>>1; - devpriv->ul_DmaBufferHw[i]=virt_to_bus((void*)devpriv->ul_DmaBufferVirtual[i]); - - } - } - if (!devpriv->ul_DmaBufferVirtual[0]) - { - rt_printk(", Can't allocate DMA buffer, DMA disabled!"); - master=0; - devpriv->us_UseDma=ADDI_DISABLE; - } - - if (devpriv->ul_DmaBufferVirtual[1]) - devpriv->b_DmaDoubleBuffer=1; - - - } - - - if ((devpriv->us_UseDma==ADDI_ENABLE)) - { - rt_printk("\nDMA ENABLED\n"); - } - else - { - rt_printk("\nDMA DISABLED\n"); - } - } - - - - if (!strcmp(this_board->pc_DriverName,"apci1710")) - { - dev->n_subdevices = 9; - if((ret=alloc_subdevices(dev))<0) - return ret; - - // Allocate and Initialise Timer Subdevice Structures - s = dev->subdevices + 0; - - s->type = COMEDI_SUBD_TIMER; - s->subdev_flags = SDF_WRITEABLE|SDF_RT|SDF_GROUND|SDF_COMMON; - s->n_chan = 3; - s->maxdata = 0; - s->len_chanlist = 3; - s->range_table = &range_digital; - s->insn_write=i_APCI1710_InsnWriteEnableDisableTimer; - s->insn_read=i_APCI1710_InsnReadAllTimerValue; - s->insn_config=i_APCI1710_InsnConfigInitTimer; - s->insn_bits=i_APCI1710_InsnBitsTimer; - - - // Allocate and Initialise DIO Subdevice Structures - s = dev->subdevices + 1; - - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_WRITEABLE|SDF_READABLE|SDF_RT|SDF_GROUND|SDF_COMMON; - s->n_chan = 7; - s->maxdata = 1; - s->len_chanlist = 7; - s->range_table = &range_digital; - s->insn_config=i_APCI1710_InsnConfigDigitalIO; - s->insn_read= i_APCI1710_InsnReadDigitalIOChlValue; - s->insn_bits=i_APCI1710_InsnBitsDigitalIOPortOnOff; - s->insn_write=i_APCI1710_InsnWriteDigitalIOChlOnOff; - - - // Allocate and Initialise Chrono Subdevice Structures - s = dev->subdevices + 2; - - s->type = COMEDI_SUBD_CHRONO; - s->subdev_flags = SDF_WRITEABLE|SDF_RT|SDF_GROUND|SDF_COMMON; - s->n_chan = 4; - s->maxdata = 0; - s->len_chanlist = 4; - s->range_table = &range_digital; - s->insn_write=i_APCI1710_InsnWriteEnableDisableChrono; - s->insn_read=i_APCI1710_InsnReadChrono; - s->insn_config=i_APCI1710_InsnConfigInitChrono; - s->insn_bits=i_APCI1710_InsnBitsChronoDigitalIO; + if(this_board->i_Dma) + { + printk("\nDMA used"); + if (devpriv->us_UseDma==ADDI_ENABLE) + { + // alloc DMA buffers + devpriv->b_DmaDoubleBuffer=0; + for (i=0; i<2; i++) + { + for (pages=4; pages>=0; pages--) + { + if((devpriv->ul_DmaBufferVirtual[i]=__get_free_pages(GFP_KERNEL,pages))) + { + break; + } + } + if (devpriv->ul_DmaBufferVirtual[i]) + { + devpriv->ui_DmaBufferPages[i]=pages; + devpriv->ui_DmaBufferSize[i]=PAGE_SIZE*pages; + devpriv->ui_DmaBufferSamples[i]=devpriv->ui_DmaBufferSize[i]>>1; + devpriv->ul_DmaBufferHw[i]=virt_to_bus((void*)devpriv->ul_DmaBufferVirtual[i]); + } + } + if (!devpriv->ul_DmaBufferVirtual[0]) + { + rt_printk(", Can't allocate DMA buffer, DMA disabled!"); + master=0; + devpriv->us_UseDma=ADDI_DISABLE; + } + + if (devpriv->ul_DmaBufferVirtual[1]) + { + devpriv->b_DmaDoubleBuffer=1; + } + } - - // Allocate and Initialise PWM Subdevice Structures - s = dev->subdevices + 3; - s->type = COMEDI_SUBD_PWM; - s->subdev_flags = SDF_WRITEABLE|SDF_READABLE|SDF_RT|SDF_GROUND|SDF_COMMON; - s->n_chan = 3; - s->maxdata = 1; - s->len_chanlist = 3; - s->range_table = &range_digital; - s->io_bits=0; //all bits input - s->insn_config = i_APCI1710_InsnConfigPWM; - s->insn_read = i_APCI1710_InsnReadGetPWMStatus; - s->insn_write = i_APCI1710_InsnWritePWM; - s->insn_bits = i_APCI1710_InsnBitsReadPWMInterrupt; - - // Allocate and Initialise TTLIO Subdevice Structures - s = dev->subdevices + 4; - s->type = COMEDI_SUBD_TTLIO; - s->subdev_flags = SDF_WRITEABLE|SDF_READABLE|SDF_RT|SDF_GROUND|SDF_COMMON; - s->n_chan = 8; - s->maxdata = 1; - s->len_chanlist = 8; - s->range_table = &range_apci1710_ttl; // to pass arguments in range - s->insn_config = i_APCI1710_InsnConfigInitTTLIO; - s->insn_bits = i_APCI1710_InsnBitsReadTTLIO; - s->insn_write = i_APCI1710_InsnWriteSetTTLIOChlOnOff; - s->insn_read = i_APCI1710_InsnReadTTLIOAllPortValue; - - // Allocate and Initialise TOR Subdevice Structures - s = dev->subdevices + 5; - s->type = COMEDI_SUBD_TOR; - s->subdev_flags = SDF_WRITEABLE|SDF_READABLE|SDF_RT|SDF_GROUND|SDF_COMMON; - s->n_chan = 8; - s->maxdata = 1; - s->len_chanlist = 8; - s->range_table = &range_digital; - s->io_bits=0; //all bits input - s->insn_config = i_APCI1710_InsnConfigInitTorCounter; - s->insn_read = i_APCI1710_InsnReadGetTorCounterInitialisation; - s->insn_write = i_APCI1710_InsnWriteEnableDisableTorCounter; - s->insn_bits = i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue; - - // Allocate and Initialise SSI Subdevice Structures - s = dev->subdevices + 6; - s->type = COMEDI_SUBD_SSI; - s->subdev_flags = SDF_WRITEABLE|SDF_READABLE|SDF_RT|SDF_GROUND|SDF_COMMON; - s->n_chan =4; - s->maxdata = 1; - s->len_chanlist = 4; - s->range_table = &range_apci1710_ssi; - s->insn_config = i_APCI1710_InsnConfigInitSSI; - s->insn_read = i_APCI1710_InsnReadSSIValue; - s->insn_bits = i_APCI1710_InsnBitsSSIDigitalIO; - - // Allocate and Initialise PULSEENCODER Subdevice Structures - s = dev->subdevices + 7; - s->type = COMEDI_SUBD_PULSEENCODER; - s->subdev_flags = SDF_WRITEABLE|SDF_READABLE|SDF_RT|SDF_GROUND|SDF_COMMON; - s->n_chan = 4; - s->maxdata = 1; - s->len_chanlist = 4; - s->range_table = &range_digital; - s->insn_config = i_APCI1710_InsnConfigInitPulseEncoder; - s->insn_write = i_APCI1710_InsnWriteEnableDisablePulseEncoder; - s->insn_bits = i_APCI1710_InsnBitsReadWritePulseEncoder; - s->insn_read = i_APCI1710_InsnReadInterruptPulseEncoder; - - // Allocate and Initialise INCREMENTALCOUNTER Subdevice Structures - s = dev->subdevices + 8; - s->type = COMEDI_SUBD_INCREMENTALCOUNTER; - s->subdev_flags = SDF_WRITEABLE|SDF_READABLE|SDF_RT|SDF_GROUND|SDF_COMMON; - s->n_chan = 500; - s->maxdata = 1; - s->len_chanlist = 500; - s->range_table = &range_apci1710_inccpt; - s->insn_config = i_APCI1710_InsnConfigINCCPT; - s->insn_write = i_APCI1710_InsnWriteINCCPT; - s->insn_read = i_APCI1710_InsnReadINCCPT; - s->insn_bits = i_APCI1710_InsnBitsINCCPT; - - // save base address - devpriv->s_BoardInfos.ui_Address=io_addr[2]; - } - else - { - dev->n_subdevices = 6; - if((ret=alloc_subdevices(dev))<0) + if ((devpriv->us_UseDma==ADDI_ENABLE)) + { + rt_printk("\nDMA ENABLED\n"); + } + else + { + printk("\nDMA DISABLED\n"); + } + } + + if (!strcmp(this_board->pc_DriverName,"apci1710")) + { + i_ADDI_AttachPCI1710 (dev); + + // save base address + devpriv->s_BoardInfos.ui_Address=io_addr[2]; + } + else + { + //Update-0.7.57->0.7.68dev->n_subdevices = 7; + n_subdevices = 7; + if((ret=alloc_subdevices(dev,n_subdevices))<0) return ret; // Allocate and Initialise AI Subdevice Structures s = dev->subdevices + 0; - if(this_board->i_NbrAiChannel) + if((this_board->i_NbrAiChannel) || (this_board->i_NbrAiChannelDiff)) { dev->read_subdev = s; s->type = COMEDI_SUBD_AI; s->subdev_flags = SDF_READABLE|SDF_RT|SDF_COMMON|SDF_GROUND|SDF_DIFF; - s->n_chan = this_board->i_NbrAiChannel; + if (this_board->i_NbrAiChannel) + s->n_chan = this_board->i_NbrAiChannel; + else + s->n_chan = this_board->i_NbrAiChannelDiff; s->maxdata = this_board->i_AiMaxdata; s->len_chanlist = this_board->i_AiChannelList; s->range_table = this_board->pr_AiRangelist; @@ -929,13 +2824,11 @@ static int i_ADDI_Attach(comedi_device *dev,comedi_devconfig *it) s->len_chanlist = this_board->i_NbrDiChannel; s->range_table = &range_digital; s->io_bits=0; /* all bits input */ - s->insn_config=this_board->i_hwdrv_InsnConfigDigitalInput; s->insn_read=this_board->i_hwdrv_InsnReadDigitalInput; s->insn_write=this_board->i_hwdrv_InsnWriteDigitalInput; s->insn_bits=this_board->i_hwdrv_InsnBitsDigitalInput; - - } + } else { s->type=COMEDI_SUBD_UNUSED; @@ -945,7 +2838,7 @@ static int i_ADDI_Attach(comedi_device *dev,comedi_devconfig *it) if(this_board->i_NbrDoChannel) { s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITEABLE|SDF_RT|SDF_GROUND|SDF_COMMON; + s->subdev_flags = SDF_READABLE|SDF_WRITEABLE|SDF_RT|SDF_GROUND|SDF_COMMON; s->n_chan= this_board->i_NbrDoChannel; s->maxdata = this_board->i_DoMaxdata; s->len_chanlist =this_board->i_NbrDoChannel ; @@ -982,9 +2875,30 @@ static int i_ADDI_Attach(comedi_device *dev,comedi_devconfig *it) { s->type=COMEDI_SUBD_UNUSED; } - + + // Allocate and Initialise TTL + s = dev->subdevices + 5; + if(this_board->i_NbrTTLChannel) + { + s->type = COMEDI_SUBD_TTLIO; + s->subdev_flags = SDF_WRITEABLE|SDF_READABLE|SDF_RT|SDF_GROUND|SDF_COMMON; + s->n_chan = this_board->i_NbrTTLChannel; + s->maxdata = 0; + s->io_bits=0; /* all bits input */ + s->len_chanlist = this_board->i_NbrTTLChannel; + s->range_table = this_board->pr_TTLRangelist; // to pass arguments in range + s->insn_config = this_board->i_hwdr_ConfigInitTTLIO; + s->insn_bits = this_board->i_hwdr_ReadTTLIOBits; + s->insn_read = this_board->i_hwdr_ReadTTLIOAllPortValue; + s->insn_write = this_board->i_hwdr_WriteTTLIOChlOnOff; + } + else + { + s->type=COMEDI_SUBD_UNUSED; + } + /* EEPROM */ - s=dev->subdevices+5; + s=dev->subdevices+6; if(this_board->i_PCIEeprom) { s->type=COMEDI_SUBD_MEMORY; @@ -998,6 +2912,8 @@ static int i_ADDI_Attach(comedi_device *dev,comedi_devconfig *it) s->type=COMEDI_SUBD_UNUSED; } } + + printk("\ni_ADDI_Attach end\n"); i_ADDI_Reset(dev); devpriv->b_ValidDriver=1; return 0; @@ -1026,39 +2942,80 @@ static int i_ADDI_Attach(comedi_device *dev,comedi_devconfig *it) static int i_ADDI_Detach(comedi_device *dev) -{ - - if (dev->private) { - if (devpriv->b_ValidDriver) i_ADDI_Reset(dev); - if(devpriv->i_IobaseAmcc) - release_region(devpriv->i_IobaseAmcc,this_board->i_IorangeBase0); - if (devpriv->allocated) - i_pci_card_free(devpriv->amcc); - if (devpriv->ul_DmaBufferVirtual[0]) - free_pages(devpriv->ul_DmaBufferVirtual[0],devpriv->ui_DmaBufferPages[0]); - if (devpriv->ul_DmaBufferVirtual[1]) - free_pages(devpriv->ul_DmaBufferVirtual[1],devpriv->ui_DmaBufferPages[1]); - } + + if (dev->private) + { + if (devpriv->b_ValidDriver) + { + i_ADDI_Reset(dev); + } + + if ((devpriv->ps_BoardInfo->pc_EepromChip == NULL) || (strcmp (devpriv->ps_BoardInfo->pc_EepromChip, ADDIDATA_9054) != 0)) + { + if(devpriv->i_IobaseAmcc) + { + printk("\nrelease_region base address 0"); + release_region(devpriv->i_IobaseAmcc,this_board->i_IorangeBase0); + printk("\nrelease_region base address 0 OK"); + } + + if(this_board->i_IorangeBase1) + { + printk("\nrelease_region base address 1"); + release_region(dev->iobase,this_board->i_IorangeBase1); + printk("\nrelease_region base address 1 OK"); + } + + if(this_board->i_IorangeBase2) + { + printk("\nrelease_region base address 2"); + release_region(devpriv->i_IobaseAddon,this_board->i_IorangeBase2); + printk("\nrelease_region base address 2 OK"); + } + + if (devpriv->allocated) + { + i_pci_card_free(devpriv->amcc); + } + + if (devpriv->ul_DmaBufferVirtual[0]) + { + free_pages((unsigned long)devpriv->ul_DmaBufferVirtual[0],devpriv->ui_DmaBufferPages[0]); + } + + if (devpriv->ul_DmaBufferVirtual[1]) + { + free_pages((unsigned long)devpriv->ul_DmaBufferVirtual[1],devpriv->ui_DmaBufferPages[1]); + } + } + else + { + iounmap ((void *) devpriv->dw_AiBase); + + pci_release_regions(devpriv->amcc->pcidev); + + if (devpriv->allocated) + { + i_pci_card_free(devpriv->amcc); + } + } - if(dev->irq) - { - free_irq(dev->irq,dev); - } + if(dev->irq) + { + free_irq(dev->irq,dev); + } - if(dev->iobase) release_region(dev->iobase,this_board->i_IorangeBase1); - - if(devpriv->i_IobaseAddon) release_region(devpriv->i_IobaseAddon,this_board->i_IorangeBase2); - - if (pci_list_builded) - { - //v_pci_card_list_cleanup(PCI_VENDOR_ID_AMCC); - v_pci_card_list_cleanup(this_board->i_VendorId); - pci_list_builded=0; - } - + if (pci_list_builded) + { + //v_pci_card_list_cleanup(PCI_VENDOR_ID_AMCC); + v_pci_card_list_cleanup(this_board->i_VendorId); + pci_list_builded=0; + } + } + return 0; -} + } /* @@ -1107,11 +3064,11 @@ static int i_ADDI_Reset(comedi_device *dev) +----------------------------------------------------------------------------+ */ -static void v_ADDI_Interrupt(int irq, void *d, struct pt_regs *regs) +static irqreturn_t v_ADDI_Interrupt(int irq, void *d, struct pt_regs *regs) { comedi_device *dev = d; this_board->v_hwdrv_Interrupt(irq,d,regs); -return; +return IRQ_RETVAL(1); } // EEPROM Read Function /* @@ -1147,8 +3104,3 @@ static int i_ADDIDATA_InsnReadEeprom(comedi_device *dev,comedi_subdevice *s,come return insn->n; } - - - - - diff --git a/comedi/drivers/addi-data/addi_common.h b/comedi/drivers/addi-data/addi_common.h index 3747497e..205efd37 100644 --- a/comedi/drivers/addi-data/addi_common.h +++ b/comedi/drivers/addi-data/addi_common.h @@ -1,37 +1,41 @@ -/***********ADDI_COMMON.H*********************/ +/** +@verbatim +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ /* + +-----------------------------------------------------------------------+ | (C) ADDI-DATA GmbH Dieselstrasse 3 D-77833 Ottersweier | +-----------------------------------------------------------------------+ | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | +-----------------------------------------------------------------------+ - | Project : ADDI DATA | Compiler : GCC | + | Project : ADDI-DATA | Compiler : GCC | | Modulname : addi_common.h | Version : 2.96 | +-------------------------------+---------------------------------------+ - | Author : | Date : | + | Project manager: Eric Stolz | Date : 02/12/2002 | +-----------------------------------------------------------------------+ | Description : ADDI COMMON Header File | +-----------------------------------------------------------------------+ - | UPDATE'S | - +-----------------------------------------------------------------------+ - | Date | Author | Description of updates | - +----------+-----------+------------------------------------------------+ - | | | | - | | | | - | | | | - | | | | - | | | | - +----------+-----------+------------------------------------------------+ - | | | | - | | | | - | | | | - +----------+-----------+------------------------------------------------+ */ @@ -43,7 +47,8 @@ #include #include #include -#include +//#include +#include #include #include #include @@ -94,6 +99,7 @@ #define ADDIDATA_93C76 "93C76" #define ADDIDATA_S5920 "S5920" #define ADDIDATA_S5933 "S5933" +#define ADDIDATA_9054 "9054" // Structures // structure for the boardtype @@ -120,9 +126,13 @@ typedef struct { INT i_NbrDiChannel; // Number of DI channels INT i_NbrDoChannel; // Number of DO channels INT i_DoMaxdata; // data to set all chanels high - + + INT i_NbrTTLChannel; // Number of TTL channels + PRANGE pr_TTLRangelist; // rangelist for TTL + INT i_Dma; // dma present or not INT i_Timer; // timer subdevice present or not + BYTE b_AvailableConvertUnit; UINT ui_MinAcquisitiontimeNs; // Minimum Acquisition in Nano secs UINT ui_MinDelaytimeNs; // Minimum Delay in Nano secs @@ -159,11 +169,18 @@ int (*i_hwdrv_InsnConfigDigitalOutput)(comedi_device *dev,comedi_subdevice *s,co int (*i_hwdrv_InsnWriteDigitalOutput)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); int (*i_hwdrv_InsnBitsDigitalOutput)(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data); int (*i_hwdrv_InsnReadDigitalOutput)(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data); + //TIMER int (*i_hwdrv_InsnConfigTimer)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); int (*i_hwdrv_InsnWriteTimer)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); int (*i_hwdrv_InsnReadTimer)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); int (*i_hwdrv_InsnBitsTimer)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); + +//TTL IO + int (*i_hwdr_ConfigInitTTLIO)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); + int (*i_hwdr_ReadTTLIOBits)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); + int (*i_hwdr_ReadTTLIOAllPortValue)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); + int (*i_hwdr_WriteTTLIOChlOnOff)(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); } boardtype; @@ -368,11 +385,13 @@ typedef struct{ INT i_IobaseAmcc; // base+size for AMCC chip INT i_IobaseAddon; //addon base address INT i_IobaseReserved; + DWORD dw_AiBase; struct pcilst_struct *amcc; // ptr too AMCC data UINT master; // master capable BYTE allocated; // we have blocked card BYTE b_ValidDriver;// driver is ok BYTE b_AiContinuous; // we do unlimited AI + BYTE b_AiInitialisation; UINT ui_AiActualScan; //how many scans we finished UINT ui_AiBufferPtr;// data buffer ptr in samples UINT ui_AiNbrofChannels;// how many channels is measured @@ -380,7 +399,9 @@ typedef struct{ UINT ui_AiActualScanPosition; // position in actual scan PUINT pui_AiChannelList; // actual chanlist UINT ui_AiChannelList[32]; // actual chanlist + BYTE b_AiChannelConfiguration[32]; // actual chanlist UINT ui_AiReadData[32]; + DWORD dw_AiInitialised; UINT ui_AiTimer0; //Timer Constant for Timer0 UINT ui_AiTimer1; //Timer constant for Timer1 UINT ui_AiFlags; @@ -390,10 +411,12 @@ typedef struct{ USHORT us_UseDma; // To use Dma or not BYTE b_DmaDoubleBuffer;// we can use double buffering UINT ui_DmaActualBuffer; // which buffer is used now - ULONG ul_DmaBufferVirtual[2];// pointers to begin of DMA buffer + //*UPDATE-0.7.57->0.7.68 + //ULONG ul_DmaBufferVirtual[2];// pointers to begin of DMA buffer + sampl_t *ul_DmaBufferVirtual[2];// pointers to begin of DMA buffer ULONG ul_DmaBufferHw[2]; // hw address of DMA buff UINT ui_DmaBufferSize[2];// size of dma buffer in bytes - UINT ui_DmaBufferUsesize[2];// which size e may now used for transfer + UINT ui_DmaBufferUsesize[2];// which size we may now used for transfer UINT ui_DmaBufferSamples[2];// size in samples UINT ui_DmaBufferPages[2];// number of pages in buffer BYTE b_DigitalOutputRegister; // Digital Output Register @@ -412,10 +435,14 @@ typedef struct{ BYTE b_InterruptMode; // eoc eos or dma BYTE b_EocEosInterrupt; // Enable disable eoc eos interrupt UINT ui_EocEosConversionTime; + BYTE b_EocEosConversionTimeBase; + BYTE b_SingelDiff; BYTE b_ExttrigEnable; // To enable or disable external trigger - struct task_struct *tsk_Current; // Pointer to the current process - - + + struct task_struct *tsk_Current; // Pointer to the current process + boardtype *ps_BoardInfo; + + // Hardware board infos for 1710 @@ -450,6 +477,7 @@ typedef struct{ }s_InterruptParameters; str_ModuleInfo s_ModuleInfo [4]; + ULONG ul_TTLPortConfiguration[10]; } addi_private; @@ -468,7 +496,7 @@ static int i_ADDI_Attach(comedi_device *dev,comedi_devconfig *it); static int i_ADDI_Detach(comedi_device *dev); static int i_ADDI_Reset(comedi_device *dev); -static void v_ADDI_Interrupt(int irq, void *d, struct pt_regs *regs); +static irqreturn_t v_ADDI_Interrupt(int irq, void *d, struct pt_regs *regs); static int i_ADDIDATA_InsnReadEeprom(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); diff --git a/comedi/drivers/addi-data/addi_eeprom.c b/comedi/drivers/addi-data/addi_eeprom.c index 72c0d318..636efb10 100644 --- a/comedi/drivers/addi-data/addi_eeprom.c +++ b/comedi/drivers/addi-data/addi_eeprom.c @@ -1,884 +1,1274 @@ - - -/* - +-----------------------------------------------------------------------+ - | (C) ADDI-DATA GmbH Dieselstrasse 3 D-77833 Ottersweier | - +-----------------------------------------------------------------------+ - | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | - | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | - +-----------------------------------------------------------------------+ - | Project : ADDI DATA | Compiler : GCC | - | Modulname : addi_eeprom.c | Version : 2.96 | - +-------------------------------+---------------------------------------+ - | Author : | Date : | - +-----------------------------------------------------------------------+ - | Description : ADDI EEPROM Module | - +-----------------------------------------------------------------------+ - | UPDATE'S | - +-----------------------------------------------------------------------+ - | Date | Author | Description of updates | - +----------+-----------+------------------------------------------------+ - | | | | - | | | | - | | | | - | | | | - | | | | - +----------+-----------+------------------------------------------------+ - | | | | - | | | | - | | | | - +----------+-----------+------------------------------------------------+ -*/ - - - - - - - - -#define NVCMD_BEGIN_READ (0x7 << 5 ) // nvRam begin read command -#define NVCMD_LOAD_LOW (0x4 << 5 ) // nvRam load low command -#define NVCMD_LOAD_HIGH (0x5 << 5 ) // nvRam load high command -#define EE76_CMD_LEN 13 // bits in instructions -#define EE_READ 0x0180 // 01 1000 0000 read instruction - -#define WORD unsigned short -#define DWORD unsigned int -#define PWORD unsigned short * -#define PDWORD unsigned int * - - - - -#define EEPROM_DIGITALINPUT 0 -#define EEPROM_DIGITALOUTPUT 1 -#define EEPROM_ANALOGINPUT 2 -#define EEPROM_ANALOGOUTPUT 3 -#define EEPROM_TIMER 4 -#define EEPROM_WATCHDOG 5 -#define EEPROM_TIMER_WATCHDOG_COUNTER 10 - -struct str_Functionality -{ - BYTE b_Type; - WORD w_Address; -}; - - -typedef struct -{ - WORD w_HeaderSize; - BYTE b_Nfunctions; - struct str_Functionality s_Functions[7]; -}str_MainHeader; - - - -typedef struct -{ - WORD w_Nchannel; - BYTE b_Interruptible; - WORD w_NinterruptLogic; -}str_DigitalInputHeader; - -typedef struct -{ - WORD w_Nchannel; -}str_DigitalOutputHeader; - -// used for timer as well as watchdog - -typedef struct -{ - WORD w_HeaderSize; - BYTE b_Resolution; - BYTE b_Mode; // in case of Watchdog it is functionality - WORD w_MinTiming; - BYTE b_TimeBase; -}str_TimerDetails; -typedef struct -{ - - WORD w_Ntimer; - str_TimerDetails s_TimerDetails[4]; // supports 4 timers -}str_TimerMainHeader; - - -typedef struct -{ - WORD w_Nchannel; - BYTE b_Resolution; - }str_AnalogOutputHeader ; - -typedef struct -{ - WORD w_Nchannel; - WORD w_MinConvertTiming; - WORD w_MinDelayTiming; - BYTE b_HasDma; - BYTE b_Resolution; -} str_AnalogInputHeader; - - /*****************************************/ - /* Read Header Functions */ - /*****************************************/ - -INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,comedi_device *dev); - -INT i_EepromReadDigitalInputHeader(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,WORD w_Address,str_DigitalInputHeader *s_Header); - -INT i_EepromReadDigitalOutputHeader(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,WORD w_Address,str_DigitalOutputHeader *s_Header); - -INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,WORD w_Address,str_TimerMainHeader *s_Header); - -INT i_EepromReadAnlogOutputHeader(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,WORD w_Address,str_AnalogOutputHeader *s_Header); - -INT i_EepromReadAnlogInputHeader(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,WORD w_Address,str_AnalogInputHeader *s_Header); - - /******************************************/ - /* Eeprom Specific Functions */ - /******************************************/ -WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,WORD w_EepromStartAddress); -VOID v_EepromWaitBusy(WORD w_PCIBoardEepromAddress); -VOID v_EepromClock76(DWORD dw_Address,DWORD dw_RegisterValue); -VOID v_EepromWaitBusy(WORD w_PCIBoardEepromAddress); -VOID v_EepromSendCommand76(DWORD dw_Address,DWORD dw_EepromCommand,BYTE b_DataLengthInBits); -VOID v_EepromCs76Read(DWORD dw_Address,WORD w_offset,PWORD pw_Value); - - - -/* -+----------------------------------------------------------------------------+ -| Function Name : WORD w_EepromReadWord | -| (WORD w_PCIBoardEepromAddress, | -| PCHAR pc_PCIChipInformation, | -| WORD w_EepromStartAddress) | -+----------------------------------------------------------------------------+ -| Task : Read from eepromn a word | -+----------------------------------------------------------------------------+ -| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | -| | -| PCHAR pc_PCIChipInformation : PCI Chip Type. | -| | -| WORD w_EepromStartAddress : Selected eeprom address | -+----------------------------------------------------------------------------+ -| Output Parameters : - | -+----------------------------------------------------------------------------+ -| Return Value : Read word value from eeprom | -+----------------------------------------------------------------------------+ -*/ - +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ +/* + + +-----------------------------------------------------------------------+ + | (C) ADDI-DATA GmbH Dieselstrasse 3 D-77833 Ottersweier | + +-----------------------------------------------------------------------+ + | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | + | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | + +-----------------------------------------------------------------------+ + | Project : ADDI DATA | Compiler : GCC | + | Modulname : addi_eeprom.c | Version : 2.96 | + +-------------------------------+---------------------------------------+ + | Project manager: Eric Stolz | Date : 02/12/2002 | + +-----------------------------------------------------------------------+ + | Description : ADDI EEPROM Module | + +-----------------------------------------------------------------------+ + | UPDATE'S | + +-----------------------------------------------------------------------+ + | Date | Author | Description of updates | + +----------+-----------+------------------------------------------------+ + | | | | + | | | | + +----------+-----------+------------------------------------------------+ +*/ + + + + + + + + +#define NVCMD_BEGIN_READ (0x7 << 5 ) // nvRam begin read command +#define NVCMD_LOAD_LOW (0x4 << 5 ) // nvRam load low command +#define NVCMD_LOAD_HIGH (0x5 << 5 ) // nvRam load high command +#define EE76_CMD_LEN 13 // bits in instructions +#define EE_READ 0x0180 // 01 1000 0000 read instruction + +#define WORD unsigned short +#define PWORD unsigned short * +#define PDWORD unsigned int * + +#define DWORD unsigned int + + + +#define EEPROM_DIGITALINPUT 0 +#define EEPROM_DIGITALOUTPUT 1 +#define EEPROM_ANALOGINPUT 2 +#define EEPROM_ANALOGOUTPUT 3 +#define EEPROM_TIMER 4 +#define EEPROM_WATCHDOG 5 +#define EEPROM_TIMER_WATCHDOG_COUNTER 10 + +struct str_Functionality +{ + BYTE b_Type; + WORD w_Address; +}; + + +typedef struct +{ + WORD w_HeaderSize; + BYTE b_Nfunctions; + struct str_Functionality s_Functions[7]; +}str_MainHeader; + + + +typedef struct +{ + WORD w_Nchannel; + BYTE b_Interruptible; + WORD w_NinterruptLogic; +}str_DigitalInputHeader; + +typedef struct +{ + WORD w_Nchannel; +}str_DigitalOutputHeader; + +// used for timer as well as watchdog + +typedef struct +{ + WORD w_HeaderSize; + BYTE b_Resolution; + BYTE b_Mode; // in case of Watchdog it is functionality + WORD w_MinTiming; + BYTE b_TimeBase; +}str_TimerDetails; +typedef struct +{ + + WORD w_Ntimer; + str_TimerDetails s_TimerDetails[4]; // supports 4 timers +}str_TimerMainHeader; + + +typedef struct +{ + WORD w_Nchannel; + BYTE b_Resolution; + }str_AnalogOutputHeader ; + +typedef struct +{ + WORD w_Nchannel; + WORD w_MinConvertTiming; + WORD w_MinDelayTiming; + BYTE b_HasDma; + BYTE b_Resolution; +} str_AnalogInputHeader; + + /*****************************************/ + /* Read Header Functions */ + /*****************************************/ + +INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,comedi_device *dev); + +INT i_EepromReadDigitalInputHeader(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,WORD w_Address,str_DigitalInputHeader *s_Header); + +INT i_EepromReadDigitalOutputHeader(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,WORD w_Address,str_DigitalOutputHeader *s_Header); + +INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,WORD w_Address,str_TimerMainHeader *s_Header); + +INT i_EepromReadAnlogOutputHeader(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,WORD w_Address,str_AnalogOutputHeader *s_Header); + +INT i_EepromReadAnlogInputHeader(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,WORD w_Address,str_AnalogInputHeader *s_Header); + + /******************************************/ + /* Eeprom Specific Functions */ + /******************************************/ +WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,WORD w_EepromStartAddress); +VOID v_EepromWaitBusy(WORD w_PCIBoardEepromAddress); +VOID v_EepromClock76(DWORD dw_Address,DWORD dw_RegisterValue); +VOID v_EepromWaitBusy(WORD w_PCIBoardEepromAddress); +VOID v_EepromSendCommand76(DWORD dw_Address,DWORD dw_EepromCommand,BYTE b_DataLengthInBits); +VOID v_EepromCs76Read(DWORD dw_Address,WORD w_offset,PWORD pw_Value); + + + +/* ++----------------------------------------------------------------------------+ +| Function Name : WORD w_EepromReadWord | +| (WORD w_PCIBoardEepromAddress, | +| PCHAR pc_PCIChipInformation, | +| WORD w_EepromStartAddress) | ++----------------------------------------------------------------------------+ +| Task : Read from eepromn a word | ++----------------------------------------------------------------------------+ +| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | +| | +| PCHAR pc_PCIChipInformation : PCI Chip Type. | +| | +| WORD w_EepromStartAddress : Selected eeprom address | ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value : Read word value from eeprom | ++----------------------------------------------------------------------------+ +*/ + WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,WORD w_EepromStartAddress) + { + BYTE b_Counter = 0; + BYTE b_ReadByte = 0; + BYTE b_ReadLowByte = 0; + BYTE b_ReadHighByte = 0; + BYTE b_SelectedAddressLow = 0; + BYTE b_SelectedAddressHigh = 0; + WORD w_ReadWord = 0; - + + + /**************************/ + /* Test the PCI chip type */ + /**************************/ - + + + if ((!strcmp(pc_PCIChipInformation, "S5920")) || + (!strcmp(pc_PCIChipInformation, "S5933"))) + { - + + for (b_Counter=0; b_Counter<2; b_Counter++) + { + b_SelectedAddressLow = (w_EepromStartAddress + b_Counter) % 256; //Read the low 8 bit part + b_SelectedAddressHigh = (w_EepromStartAddress + b_Counter) / 256; //Read the high 8 bit part + + /************************************/ + /* Select the load low address mode */ + /************************************/ - outb(NVCMD_LOAD_LOW,w_PCIBoardEepromAddress + 0x3F); - - + + + outb(NVCMD_LOAD_LOW,w_PCIBoardEepromAddress + 0x3F); + + + /****************/ + /* Wait on busy */ + /****************/ + v_EepromWaitBusy (w_PCIBoardEepromAddress); - + + /************************/ + /* Load the low address */ + /************************/ - outb(b_SelectedAddressLow,w_PCIBoardEepromAddress + 0x3E); - - + + + outb(b_SelectedAddressLow,w_PCIBoardEepromAddress + 0x3E); + + + /****************/ + /* Wait on busy */ + /****************/ + v_EepromWaitBusy (w_PCIBoardEepromAddress); + + /*************************************/ + /* Select the load high address mode */ + /*************************************/ - outb(NVCMD_LOAD_HIGH,w_PCIBoardEepromAddress + 0x3F); - + + + outb(NVCMD_LOAD_HIGH,w_PCIBoardEepromAddress + 0x3F); + + /****************/ + /* Wait on busy */ + /****************/ + v_EepromWaitBusy (w_PCIBoardEepromAddress); + + /*************************/ + /* Load the high address */ + /*************************/ - outb(b_SelectedAddressHigh,w_PCIBoardEepromAddress +0x3E); - - + + + outb(b_SelectedAddressHigh,w_PCIBoardEepromAddress +0x3E); + + /****************/ + /* Wait on busy */ + /****************/ + v_EepromWaitBusy (w_PCIBoardEepromAddress); + + /************************/ + /* Select the READ mode */ + /************************/ - outb(NVCMD_BEGIN_READ,w_PCIBoardEepromAddress + 0x3F); - - + + + outb(NVCMD_BEGIN_READ,w_PCIBoardEepromAddress + 0x3F); + + /****************/ + /* Wait on busy */ - /****************/ + + /****************/ + + v_EepromWaitBusy (w_PCIBoardEepromAddress); + + /*****************************/ + /* Read data into the EEPROM */ + /*****************************/ + b_ReadByte = inb(w_PCIBoardEepromAddress + 0x3E); - - + + + + /****************/ + /* Wait on busy */ + /****************/ + + v_EepromWaitBusy (w_PCIBoardEepromAddress); + + /*********************************/ + /* Select the upper address part */ + /*********************************/ + + if(b_Counter==0) + { + b_ReadLowByte=b_ReadByte; + } // if(b_Counter==0) + else + { + b_ReadHighByte=b_ReadByte; + } // if(b_Counter==0) + } // for (b_Counter=0; b_Counter<2; b_Counter++) + + w_ReadWord=(b_ReadLowByte | (((WORD) b_ReadHighByte) * 256)); - + + + } // end of if ((!strcmp(pc_PCIChipInformation, "S5920")) || (!strcmp(pc_PCIChipInformation, "S5933"))) + if (!strcmp(pc_PCIChipInformation, "93C76")) + { + /*************************************/ + /* Read 16 bit from the EEPROM 93C76 */ + /*************************************/ - + + + v_EepromCs76Read(w_PCIBoardEepromAddress, w_EepromStartAddress, &w_ReadWord); + } - + + return (w_ReadWord); + } + + + + /* + +----------------------------------------------------------------------------+ + | Function Name : VOID v_EepromWaitBusy | + | (WORD w_PCIBoardEepromAddress) | + +----------------------------------------------------------------------------+ + | Task : Wait the busy flag from PCI controller | + +----------------------------------------------------------------------------+ + | Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom base address | + +----------------------------------------------------------------------------+ + | Output Parameters : - | + +----------------------------------------------------------------------------+ + | Return Value : - | + +----------------------------------------------------------------------------+ + */ + + VOID v_EepromWaitBusy(WORD w_PCIBoardEepromAddress) + { + BYTE b_EepromBusy = 0; + + do + { + /*************/ + /* IMPORTANT */ + /*************/ + + /************************************************************************/ - /* An error has been written in the AMCC 5933 book at the page B-13*/ - /* Ex: if you read a byte and look for the busy statusEEPROM=0x80 and */ - /* the operator register is AMCC_OP_REG_MCSR+3*/ - /* WORD read EEPROM=0x8000 andAMCC_OP_REG_MCSR+2 */ - /* DWORD read EEPROM=0x80000000 and AMCC_OP_REG_MCSR */ - /************************************************************************/ - b_EepromBusy = inb(w_PCIBoardEepromAddress + 0x3F); + + /* An error has been written in the AMCC 5933 book at the page B-13*/ + + /* Ex: if you read a byte and look for the busy statusEEPROM=0x80 and */ + + /* the operator register is AMCC_OP_REG_MCSR+3*/ + + /* WORD read EEPROM=0x8000 andAMCC_OP_REG_MCSR+2 */ + + /* DWORD read EEPROM=0x80000000 and AMCC_OP_REG_MCSR */ + + /************************************************************************/ + + + b_EepromBusy = inb(w_PCIBoardEepromAddress + 0x3F); b_EepromBusy = b_EepromBusy &0x80; - } while(b_EepromBusy == 0x80); - + + } + while(b_EepromBusy == 0x80); + + + } - + + + + /* + +---------------------------------------------------------------------------------+ + | Function Name : VOID v_EepromClock76(DWORD dw_Address, | + | DWORD dw_RegisterValue) | + +---------------------------------------------------------------------------------+ + | Task : This function sends the clocking sequence to the EEPROM. | + +---------------------------------------------------------------------------------+ + | Input Parameters : DWORD dw_Address : PCI eeprom base address | + | DWORD dw_RegisterValue : PCI eeprom register value to write.| + +---------------------------------------------------------------------------------+ + | Output Parameters : - | + +---------------------------------------------------------------------------------+ + | Return Value : - | + +---------------------------------------------------------------------------------+ + */ + + VOID v_EepromClock76(DWORD dw_Address,DWORD dw_RegisterValue) + { + + /************************/ + /* Set EEPROM clock Low */ + /************************/ - outl(dw_RegisterValue & 0x6,dw_Address); - + + +outl(dw_RegisterValue & 0x6,dw_Address); + /***************/ + /* Wait 0.1 ms */ - /***************/ - udelay(100); + + /***************/ + + + udelay(100); + /*************************/ + /* Set EEPROM clock High */ + /*************************/ - outl(dw_RegisterValue | 0x1,dw_Address); + + + outl(dw_RegisterValue | 0x1,dw_Address); + /***************/ + /* Wait 0.1 ms */ + /***************/ - udelay(100); - - } + + + udelay(100); + + } + + /* + +---------------------------------------------------------------------------------+ + | Function Name : VOID v_EepromSendCommand76(DWORD dw_Address, | + | DWORD dw_EepromCommand, | + | BYTE b_DataLengthInBits) | + +---------------------------------------------------------------------------------+ + | Task : This function sends a Command to the EEPROM 93C76. | + +---------------------------------------------------------------------------------+ + | Input Parameters : DWORD dw_Address : PCI eeprom base address | + | DWORD dw_EepromCommand : PCI eeprom command to write. | + | BYTE b_DataLengthInBits : PCI eeprom command data length. | + +---------------------------------------------------------------------------------+ + | Output Parameters : - | + +---------------------------------------------------------------------------------+ + | Return Value : - | + +---------------------------------------------------------------------------------+ + */ + + VOID v_EepromSendCommand76(DWORD dw_Address,DWORD dw_EepromCommand,BYTE b_DataLengthInBits) + { + CHAR c_BitPos = 0; + DWORD dw_RegisterValue = 0; + + + /*****************************/ + /* Enable EEPROM Chip Select */ + /*****************************/ + dw_RegisterValue = 0x2; + + /********************************************************************/ + /* Toggle EEPROM's Chip select to get it out of Shift Register Mode */ + /********************************************************************/ + outl(dw_RegisterValue,dw_Address); - + + + /***************/ + /* Wait 0.1 ms */ + /***************/ - udelay(100); - + + +udelay(100); + + /*******************************************/ + /* Send EEPROM command - one bit at a time */ - /*******************************************/ + + /*******************************************/ + + for (c_BitPos = (b_DataLengthInBits - 1); c_BitPos >= 0; c_BitPos--) + { - + + /**********************************/ + /* Check if current bit is 0 or 1 */ - /**********************************/ + + /**********************************/ + + if (dw_EepromCommand & (1 << c_BitPos)) + { + /***********/ + /* Write 1 */ + /***********/ + + dw_RegisterValue = dw_RegisterValue | 0x4; + } + else + { + /***********/ + /* Write 0 */ + /***********/ + + dw_RegisterValue = dw_RegisterValue & 0x3; + } + + /*********************/ + /* Write the command */ + /*********************/ - outl(dw_RegisterValue,dw_Address); - + + + outl(dw_RegisterValue,dw_Address); + + /***************/ + /* Wait 0.1 ms */ + /***************/ - udelay(100); - + + + udelay(100); + + /****************************/ + /* Trigger the EEPROM clock */ + /****************************/ + v_EepromClock76(dw_Address, dw_RegisterValue); - + + } + + } + + /* + +---------------------------------------------------------------------------------+ + | Function Name : VOID v_EepromCs76Read(DWORD dw_Address, | + | WORD w_offset, | + | PWORD pw_Value) | + +---------------------------------------------------------------------------------+ + | Task : This function read a value from the EEPROM 93C76. | + +---------------------------------------------------------------------------------+ + | Input Parameters : DWORD dw_Address : PCI eeprom base address | + | WORD w_offset : Offset of the adress to read | + | PWORD pw_Value : PCI eeprom 16 bit read value. | + +---------------------------------------------------------------------------------+ + | Output Parameters : - | + +---------------------------------------------------------------------------------+ + | Return Value : - | + +---------------------------------------------------------------------------------+ + */ -VOID v_EepromCs76Read(DWORD dw_Address,WORD w_offset, PWORD pw_Value) + + +VOID v_EepromCs76Read(DWORD dw_Address,WORD w_offset, +PWORD pw_Value) + { + CHAR c_BitPos = 0; + DWORD dw_RegisterValue = 0; + DWORD dw_RegisterValueRead = 0; + + + /*************************************************/ + /* Send EEPROM read command and offset to EEPROM */ + /*************************************************/ + v_EepromSendCommand76(dw_Address, (EE_READ << 4) | (w_offset / 2), EE76_CMD_LEN); + + /*******************************/ + /* Get the last register value */ + /*******************************/ + dw_RegisterValue = (((w_offset / 2) & 0x1) << 2) | 0x2; + + /*****************************/ + /* Set the 16-bit value of 0 */ - /*****************************/ + + /*****************************/ + + *pw_Value = 0; + + /************************/ + /* Get the 16-bit value */ + /************************/ + for (c_BitPos = 0; c_BitPos < 16; c_BitPos++) + { - + + /****************************/ + /* Trigger the EEPROM clock */ - /****************************/ + + /****************************/ + + v_EepromClock76(dw_Address, dw_RegisterValue); + + /**********************/ + /* Get the result bit */ + /**********************/ - dw_RegisterValueRead = inl(dw_Address); - + + + dw_RegisterValueRead = inl(dw_Address); + /***************/ + /* Wait 0.1 ms */ + /***************/ - udelay(100); + + + udelay(100); + /***************************************/ + /* Get bit value and shift into result */ - /***************************************/ + + /***************************************/ + + if (dw_RegisterValueRead & 0x8) + { - + + /**********/ + /* Read 1 */ - /**********/ + + /**********/ + + *pw_Value = (*pw_Value << 1) | 0x1; + } + else + { + /**********/ + /* Read 0 */ + /**********/ + *pw_Value = (*pw_Value << 1); - + + } + } + + /*************************/ + /* Clear all EEPROM bits */ - /*************************/ + + /*************************/ + + dw_RegisterValue = 0x0; + + /********************************************************************/ + /* Toggle EEPROM's Chip select to get it out of Shift Register Mode */ + /********************************************************************/ - outl(dw_RegisterValue,dw_Address); - + + + outl(dw_RegisterValue,dw_Address); + /***************/ + /* Wait 0.1 ms */ + /***************/ - udelay(100); - + + udelay(100); + } - - - /******************************************/ - /* EEPROM HEADER READ FUNCTIONS */ - /******************************************/ - -/* -+----------------------------------------------------------------------------+ -| Function Name : INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress, | -| PCHAR pc_PCIChipInformation,comedi_device *dev) | -+----------------------------------------------------------------------------+ -| Task : Read from eeprom Main Header | -+----------------------------------------------------------------------------+ -| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | -| | -| PCHAR pc_PCIChipInformation : PCI Chip Type. | -| | -| comedi_device *dev : comedi device structure | -| pointer | -+----------------------------------------------------------------------------+ -| Output Parameters : - | -+----------------------------------------------------------------------------+ -| Return Value : 0 | -+----------------------------------------------------------------------------+ -*/ - - -INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,comedi_device *dev) -{ - WORD w_Temp,i,w_Count=0; - UINT ui_Temp; - str_MainHeader s_MainHeader; - str_DigitalInputHeader s_DigitalInputHeader; - str_DigitalOutputHeader s_DigitalOutputHeader; - //str_TimerMainHeader s_TimerMainHeader,s_WatchdogMainHeader; - str_AnalogOutputHeader s_AnalogOutputHeader; - str_AnalogInputHeader s_AnalogInputHeader; - - // Read size - s_MainHeader.w_HeaderSize = w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+8); - - // Read nbr of functionality - w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+10); - s_MainHeader.b_Nfunctions =(BYTE)w_Temp & 0x00FF; - - // Read functionality details - for(i=0;ii_NbrDiChannel=s_DigitalInputHeader.w_Nchannel; - break; - - case EEPROM_DIGITALOUTPUT: - i_EepromReadDigitalOutputHeader(w_PCIBoardEepromAddress,pc_PCIChipInformation, - s_MainHeader.s_Functions[i].w_Address,&s_DigitalOutputHeader); - this_board->i_NbrDoChannel=s_DigitalOutputHeader.w_Nchannel; - ui_Temp=0xffffffff; - this_board->i_DoMaxdata= ui_Temp >>(32 - this_board->i_NbrDoChannel); - break; - - case EEPROM_ANALOGINPUT: - i_EepromReadAnlogInputHeader(w_PCIBoardEepromAddress,pc_PCIChipInformation, - s_MainHeader.s_Functions[i].w_Address,&s_AnalogInputHeader); - this_board->i_NbrAiChannel=s_AnalogInputHeader.w_Nchannel; - this_board->i_Dma=s_AnalogInputHeader.b_HasDma; - this_board->ui_MinAcquisitiontimeNs=(UINT)s_AnalogInputHeader.w_MinConvertTiming * 1000; - this_board->ui_MinDelaytimeNs =(UINT)s_AnalogInputHeader.w_MinDelayTiming * 1000; - ui_Temp=0xffff; - this_board->i_AiMaxdata = ui_Temp >> (16 - s_AnalogInputHeader.b_Resolution); - break; - - case EEPROM_ANALOGOUTPUT: - i_EepromReadAnlogOutputHeader(w_PCIBoardEepromAddress,pc_PCIChipInformation, - s_MainHeader.s_Functions[i].w_Address,&s_AnalogOutputHeader); - this_board->i_NbrAoChannel=s_AnalogOutputHeader.w_Nchannel; - ui_Temp=0xffff; - this_board->i_AoMaxdata= ui_Temp >>(16 - s_AnalogOutputHeader.b_Resolution); - break; - - case EEPROM_TIMER: - this_board->i_Timer=1;//Timer subdevice present - break; - - case EEPROM_WATCHDOG: - this_board->i_Timer=1; //Timer subdevice present - break; - - case EEPROM_TIMER_WATCHDOG_COUNTER: - this_board->i_Timer=1; //Timer subdevice present - } - } - - return 0; -} - - - - -/* -+----------------------------------------------------------------------------+ -| Function Name : INT i_EepromReadDigitalInputHeader(WORD | -| w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation, | -| WORD w_Address,str_DigitalInputHeader *s_Header) | -| | -+----------------------------------------------------------------------------+ -| Task : Read Digital Input Header | -+----------------------------------------------------------------------------+ -| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | -| | -| PCHAR pc_PCIChipInformation : PCI Chip Type. | -| | -| str_DigitalInputHeader *s_Header: Digita Input Header | -| Pointer | -+----------------------------------------------------------------------------+ -| Output Parameters : - | -+----------------------------------------------------------------------------+ -| Return Value : 0 | -+----------------------------------------------------------------------------+ -*/ -INT i_EepromReadDigitalInputHeader(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,WORD w_Address,str_DigitalInputHeader *s_Header) -{ - WORD w_Temp; - - // read nbr of channels - s_Header->w_Nchannel=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+6); - - // interruptible or not - w_Temp=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+8); - s_Header->b_Interruptible=(BYTE) (w_Temp>>7)& 0x01; - -// How many interruptible logic - s_Header->w_NinterruptLogic=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+10); - - return 0; -} - -/* -+----------------------------------------------------------------------------+ -| Function Name : INT i_EepromReadDigitalOutputHeader(WORD | -| w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation, | -| WORD w_Address,str_DigitalOutputHeader *s_Header) | -| | -+----------------------------------------------------------------------------+ -| Task : Read Digital Output Header | -+----------------------------------------------------------------------------+ -| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | -| | -| PCHAR pc_PCIChipInformation : PCI Chip Type. | -| | -| str_DigitalOutputHeader *s_Header: Digital Output Header| -| Pointer | -+----------------------------------------------------------------------------+ -| Output Parameters : - | -+----------------------------------------------------------------------------+ -| Return Value : 0 | -+----------------------------------------------------------------------------+ -*/ -INT i_EepromReadDigitalOutputHeader(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,WORD w_Address,str_DigitalOutputHeader *s_Header) -{ -// Read Nbr channels - s_Header->w_Nchannel=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+6); -return 0; -} - -/* -+----------------------------------------------------------------------------+ -| Function Name : INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress, | -| PCHAR pc_PCIChipInformation,WORD w_Address, | -| str_TimerMainHeader *s_Header) | -+----------------------------------------------------------------------------+ -| Task : Read Timer or Watchdog Header | -+----------------------------------------------------------------------------+ -| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | -| | -| PCHAR pc_PCIChipInformation : PCI Chip Type. | -| | -| str_TimerMainHeader *s_Header: Timer Header | -| Pointer | -+----------------------------------------------------------------------------+ -| Output Parameters : - | -+----------------------------------------------------------------------------+ -| Return Value : 0 | -+----------------------------------------------------------------------------+ -*/ -INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,WORD w_Address,str_TimerMainHeader *s_Header) -{ - -WORD i,w_Size=0,w_Temp; - - -//Read No of Timer -s_Header->w_Ntimer=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+6); -//Read header size - -for(i=0;iw_Ntimer;i++) -{ - s_Header->s_TimerDetails[i].w_HeaderSize=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+8+w_Size+0); - w_Temp=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+8+w_Size+2) ; - - //Read Resolution - s_Header->s_TimerDetails[i].b_Resolution=(BYTE)(w_Temp>>10)&0x3F; - - //Read Mode - s_Header->s_TimerDetails[i].b_Mode =(BYTE) (w_Temp>>4)&0x3F; - - w_Temp=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+8+w_Size+4) ; - - //Read MinTiming - s_Header->s_TimerDetails[i].w_MinTiming =(w_Temp>>6)&0x3FF; - - //Read Timebase - s_Header->s_TimerDetails[i].b_TimeBase =(BYTE)(w_Temp)&0x3F; - w_Size += s_Header->s_TimerDetails[i].w_HeaderSize; -} - -return 0; -} - - - -/* -+----------------------------------------------------------------------------+ -| Function Name : INT i_EepromReadAnlogOutputHeader(WORD | -| w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation, | -| WORD w_Address,str_AnalogOutputHeader *s_Header) | -+----------------------------------------------------------------------------+ -| Task : Read Nalog Output Header | -+----------------------------------------------------------------------------+ -| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | -| | -| PCHAR pc_PCIChipInformation : PCI Chip Type. | -| | -| str_AnalogOutputHeader *s_Header:Anlog Output Header | -| Pointer | -+----------------------------------------------------------------------------+ -| Output Parameters : - | -+----------------------------------------------------------------------------+ -| Return Value : 0 | -+----------------------------------------------------------------------------+ -*/ - -INT i_EepromReadAnlogOutputHeader(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,WORD w_Address,str_AnalogOutputHeader *s_Header) -{ - WORD w_Temp; - // No of channels for 1st hard component - w_Temp=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+10); - s_Header->w_Nchannel=(w_Temp>>4)& 0x03FF; - // Resolution for 1st hard component - w_Temp=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+16); - s_Header->b_Resolution=(BYTE)(w_Temp>>8) & 0xFF; - return 0; -} - - -/* -+----------------------------------------------------------------------------+ -| Function Name : INT i_EepromReadAnlogInputHeader(WORD | -| w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation, | -| WORD w_Address,str_AnalogInputHeader *s_Header) | -+----------------------------------------------------------------------------+ -| Task : Read Nalog Output Header | -+----------------------------------------------------------------------------+ -| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | -| | -| PCHAR pc_PCIChipInformation : PCI Chip Type. | -| | -| str_AnalogInputHeader *s_Header:Anlog Input Header | -| Pointer | -+----------------------------------------------------------------------------+ -| Output Parameters : - | -+----------------------------------------------------------------------------+ -| Return Value : 0 | -+----------------------------------------------------------------------------+ -*/ - -// Reads only for ONE hardware component -INT i_EepromReadAnlogInputHeader(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,WORD w_Address,str_AnalogInputHeader *s_Header) -{ - WORD w_Temp,w_Offset; - w_Temp=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+10); - s_Header->w_Nchannel=(w_Temp>>4)& 0x03FF; - s_Header->w_MinConvertTiming=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+16); -s_Header->w_MinDelayTiming=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+30); -w_Temp=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+20); -s_Header->b_HasDma=(w_Temp>>13) & 0x01; // whether dma present or not - -w_Temp=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+72);// reading Y -w_Temp=w_Temp & 0x00FF; -if(w_Temp)//Y>0 -{ -w_Offset=74+(2*w_Temp)+(10*(1+(w_Temp/16)));// offset of first analog input single header -w_Offset= w_Offset+2; // resolution -} -else//Y=0 -{ -w_Offset=74; -w_Offset= w_Offset+2; // resolution -} - -// read Resolution -w_Temp=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+w_Offset); -s_Header->b_Resolution=w_Temp & 0x001F;// last 5 bits - -return 0; -} + + + + + /******************************************/ + /* EEPROM HEADER READ FUNCTIONS */ + /******************************************/ + +/* ++----------------------------------------------------------------------------+ +| Function Name : INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress, | +| PCHAR pc_PCIChipInformation,comedi_device *dev) | ++----------------------------------------------------------------------------+ +| Task : Read from eeprom Main Header | ++----------------------------------------------------------------------------+ +| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | +| | +| PCHAR pc_PCIChipInformation : PCI Chip Type. | +| | +| comedi_device *dev : comedi device structure | +| pointer | ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value : 0 | ++----------------------------------------------------------------------------+ +*/ + + +INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,comedi_device *dev) +{ + WORD w_Temp,i,w_Count=0; + UINT ui_Temp; + str_MainHeader s_MainHeader; + str_DigitalInputHeader s_DigitalInputHeader; + str_DigitalOutputHeader s_DigitalOutputHeader; + //str_TimerMainHeader s_TimerMainHeader,s_WatchdogMainHeader; + str_AnalogOutputHeader s_AnalogOutputHeader; + str_AnalogInputHeader s_AnalogInputHeader; + + // Read size + s_MainHeader.w_HeaderSize = w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+8); + + // Read nbr of functionality + w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+10); + s_MainHeader.b_Nfunctions =(BYTE)w_Temp & 0x00FF; + + // Read functionality details + for(i=0;ii_NbrDiChannel=s_DigitalInputHeader.w_Nchannel; + break; + + case EEPROM_DIGITALOUTPUT: + i_EepromReadDigitalOutputHeader(w_PCIBoardEepromAddress,pc_PCIChipInformation, + s_MainHeader.s_Functions[i].w_Address,&s_DigitalOutputHeader); + this_board->i_NbrDoChannel=s_DigitalOutputHeader.w_Nchannel; + ui_Temp=0xffffffff; + this_board->i_DoMaxdata= ui_Temp >>(32 - this_board->i_NbrDoChannel); + break; + + case EEPROM_ANALOGINPUT: + i_EepromReadAnlogInputHeader(w_PCIBoardEepromAddress,pc_PCIChipInformation, + s_MainHeader.s_Functions[i].w_Address,&s_AnalogInputHeader); + if (!(strcmp(this_board->pc_DriverName, "apci3200"))) + this_board->i_NbrAiChannel=s_AnalogInputHeader.w_Nchannel * 4; + else + this_board->i_NbrAiChannel=s_AnalogInputHeader.w_Nchannel; + this_board->i_Dma=s_AnalogInputHeader.b_HasDma; + this_board->ui_MinAcquisitiontimeNs=(UINT)s_AnalogInputHeader.w_MinConvertTiming * 1000; + this_board->ui_MinDelaytimeNs =(UINT)s_AnalogInputHeader.w_MinDelayTiming * 1000; + ui_Temp=0xffff; + this_board->i_AiMaxdata = ui_Temp >> (16 - s_AnalogInputHeader.b_Resolution); + break; + + case EEPROM_ANALOGOUTPUT: + i_EepromReadAnlogOutputHeader(w_PCIBoardEepromAddress,pc_PCIChipInformation, + s_MainHeader.s_Functions[i].w_Address,&s_AnalogOutputHeader); + this_board->i_NbrAoChannel=s_AnalogOutputHeader.w_Nchannel; + ui_Temp=0xffff; + this_board->i_AoMaxdata= ui_Temp >>(16 - s_AnalogOutputHeader.b_Resolution); + break; + + case EEPROM_TIMER: + this_board->i_Timer=1;//Timer subdevice present + break; + + case EEPROM_WATCHDOG: + this_board->i_Timer=1; //Timer subdevice present + break; + + case EEPROM_TIMER_WATCHDOG_COUNTER: + this_board->i_Timer=1; //Timer subdevice present + } + } + + return 0; +} + + + + +/* ++----------------------------------------------------------------------------+ +| Function Name : INT i_EepromReadDigitalInputHeader(WORD | +| w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation, | +| WORD w_Address,str_DigitalInputHeader *s_Header) | +| | ++----------------------------------------------------------------------------+ +| Task : Read Digital Input Header | ++----------------------------------------------------------------------------+ +| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | +| | +| PCHAR pc_PCIChipInformation : PCI Chip Type. | +| | +| str_DigitalInputHeader *s_Header: Digita Input Header | +| Pointer | ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value : 0 | ++----------------------------------------------------------------------------+ +*/ +INT i_EepromReadDigitalInputHeader(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,WORD w_Address,str_DigitalInputHeader *s_Header) +{ + WORD w_Temp; + + // read nbr of channels + s_Header->w_Nchannel=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+6); + + // interruptible or not + w_Temp=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+8); + s_Header->b_Interruptible=(BYTE) (w_Temp>>7)& 0x01; + +// How many interruptible logic + s_Header->w_NinterruptLogic=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+10); + + return 0; +} + +/* ++----------------------------------------------------------------------------+ +| Function Name : INT i_EepromReadDigitalOutputHeader(WORD | +| w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation, | +| WORD w_Address,str_DigitalOutputHeader *s_Header) | +| | ++----------------------------------------------------------------------------+ +| Task : Read Digital Output Header | ++----------------------------------------------------------------------------+ +| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | +| | +| PCHAR pc_PCIChipInformation : PCI Chip Type. | +| | +| str_DigitalOutputHeader *s_Header: Digital Output Header| +| Pointer | ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value : 0 | ++----------------------------------------------------------------------------+ +*/ +INT i_EepromReadDigitalOutputHeader(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,WORD w_Address,str_DigitalOutputHeader *s_Header) +{ +// Read Nbr channels + s_Header->w_Nchannel=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+6); +return 0; +} + +/* ++----------------------------------------------------------------------------+ +| Function Name : INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress, | +| PCHAR pc_PCIChipInformation,WORD w_Address, | +| str_TimerMainHeader *s_Header) | ++----------------------------------------------------------------------------+ +| Task : Read Timer or Watchdog Header | ++----------------------------------------------------------------------------+ +| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | +| | +| PCHAR pc_PCIChipInformation : PCI Chip Type. | +| | +| str_TimerMainHeader *s_Header: Timer Header | +| Pointer | ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value : 0 | ++----------------------------------------------------------------------------+ +*/ +INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,WORD w_Address,str_TimerMainHeader *s_Header) +{ + +WORD i,w_Size=0,w_Temp; + + +//Read No of Timer +s_Header->w_Ntimer=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+6); +//Read header size + +for(i=0;iw_Ntimer;i++) +{ + s_Header->s_TimerDetails[i].w_HeaderSize=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+8+w_Size+0); + w_Temp=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+8+w_Size+2) ; + + //Read Resolution + s_Header->s_TimerDetails[i].b_Resolution=(BYTE)(w_Temp>>10)&0x3F; + + //Read Mode + s_Header->s_TimerDetails[i].b_Mode =(BYTE) (w_Temp>>4)&0x3F; + + w_Temp=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+8+w_Size+4) ; + + //Read MinTiming + s_Header->s_TimerDetails[i].w_MinTiming =(w_Temp>>6)&0x3FF; + + //Read Timebase + s_Header->s_TimerDetails[i].b_TimeBase =(BYTE)(w_Temp)&0x3F; + w_Size += s_Header->s_TimerDetails[i].w_HeaderSize; +} + +return 0; +} + + + +/* ++----------------------------------------------------------------------------+ +| Function Name : INT i_EepromReadAnlogOutputHeader(WORD | +| w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation, | +| WORD w_Address,str_AnalogOutputHeader *s_Header) | ++----------------------------------------------------------------------------+ +| Task : Read Nalog Output Header | ++----------------------------------------------------------------------------+ +| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | +| | +| PCHAR pc_PCIChipInformation : PCI Chip Type. | +| | +| str_AnalogOutputHeader *s_Header:Anlog Output Header | +| Pointer | ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value : 0 | ++----------------------------------------------------------------------------+ +*/ + +INT i_EepromReadAnlogOutputHeader(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,WORD w_Address,str_AnalogOutputHeader *s_Header) +{ + WORD w_Temp; + // No of channels for 1st hard component + w_Temp=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+10); + s_Header->w_Nchannel=(w_Temp>>4)& 0x03FF; + // Resolution for 1st hard component + w_Temp=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+16); + s_Header->b_Resolution=(BYTE)(w_Temp>>8) & 0xFF; + return 0; +} + + +/* ++----------------------------------------------------------------------------+ +| Function Name : INT i_EepromReadAnlogInputHeader(WORD | +| w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation, | +| WORD w_Address,str_AnalogInputHeader *s_Header) | ++----------------------------------------------------------------------------+ +| Task : Read Nalog Output Header | ++----------------------------------------------------------------------------+ +| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | +| | +| PCHAR pc_PCIChipInformation : PCI Chip Type. | +| | +| str_AnalogInputHeader *s_Header:Anlog Input Header | +| Pointer | ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value : 0 | ++----------------------------------------------------------------------------+ +*/ + +// Reads only for ONE hardware component +INT i_EepromReadAnlogInputHeader(WORD w_PCIBoardEepromAddress,PCHAR pc_PCIChipInformation,WORD w_Address,str_AnalogInputHeader *s_Header) +{ + WORD w_Temp,w_Offset; + w_Temp=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+10); + s_Header->w_Nchannel=(w_Temp>>4)& 0x03FF; + s_Header->w_MinConvertTiming=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+16); +s_Header->w_MinDelayTiming=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+30); +w_Temp=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+20); +s_Header->b_HasDma=(w_Temp>>13) & 0x01; // whether dma present or not + +w_Temp=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+72);// reading Y +w_Temp=w_Temp & 0x00FF; +if(w_Temp)//Y>0 +{ +w_Offset=74+(2*w_Temp)+(10*(1+(w_Temp/16)));// offset of first analog input single header +w_Offset= w_Offset+2; // resolution +} +else//Y=0 +{ +w_Offset=74; +w_Offset= w_Offset+2; // resolution +} + +// read Resolution +w_Temp=w_EepromReadWord(w_PCIBoardEepromAddress,pc_PCIChipInformation,0x100+w_Address+w_Offset); +s_Header->b_Resolution=w_Temp & 0x001F;// last 5 bits + +return 0; +} diff --git a/comedi/drivers/addi-data/hwdrv_APCI1710.c b/comedi/drivers/addi-data/hwdrv_APCI1710.c index 5acb77f0..85356539 100644 --- a/comedi/drivers/addi-data/hwdrv_APCI1710.c +++ b/comedi/drivers/addi-data/hwdrv_APCI1710.c @@ -1,1077 +1,1263 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ +/* + +-----------------------------------------------------------------------+ + | (C) ADDI-DATA GmbH Dieselstraße 3 D-77833 Ottersweier | + +-----------------------------------------------------------------------+ + | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | + | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | + +-------------------------------+---------------------------------------+ + | Project : APCI-1710 | Compiler : GCC | + | Module name : hwdrv_apci1710.c| Version : 2.96 | + +-------------------------------+---------------------------------------+ + | Project manager: Eric Stolz | Date : 02/12/2002 | + +-------------------------------+---------------------------------------+ + | Description : Hardware Layer Acces For APCI-1710 | + +-----------------------------------------------------------------------+ + | UPDATES | + +----------+-----------+------------------------------------------------+ + | Date | Author | Description of updates | + +----------+-----------+------------------------------------------------+ + | | | | + | | | | + | | | | + +----------+-----------+------------------------------------------------+ +*/ #include "hwdrv_APCI1710.h" - #include "APCI1710_Inp_cpt.c" + #include "APCI1710_Inp_cpt.c" + #include "APCI1710_Ssi.c" #include "APCI1710_Tor.c" - #include "APCI1710_Ttl.c" - #include "APCI1710_Dig_io.c" - #include "APCI1710_82x54.c" - #include "APCI1710_Chrono.c" - #include "APCI1710_Pwm.c" - #include "APCI1710_INCCPT.c" - -int i_APCI1710_Reset(comedi_device *dev); -VOID v_APCI1710_Interrupt(int irq, void *d, struct pt_regs *regs) ; -//for 1710 - - int i_APCI1710_Reset(comedi_device *dev) -{ - int ret; - DWORD dw_Dummy; - - /*********************************/ - /* Read all module configuration */ - /*********************************/ - ret=inl(devpriv->s_BoardInfos.ui_Address+60); - devpriv->s_BoardInfos.dw_MolduleConfiguration [0]=ret; - - ret=inl(devpriv->s_BoardInfos.ui_Address+124); - devpriv->s_BoardInfos.dw_MolduleConfiguration [1]=ret; - - ret=inl(devpriv->s_BoardInfos.ui_Address+188); - devpriv->s_BoardInfos.dw_MolduleConfiguration [2]=ret; - - ret=inl(devpriv->s_BoardInfos.ui_Address+252); - devpriv->s_BoardInfos.dw_MolduleConfiguration [3]=ret; - - // outl(0x80808082,devpriv->s_BoardInfos.ui_Address+0x60); - outl(0x83838383,devpriv->s_BoardInfos.ui_Address+0x60); - - // Enable the interrupt for the controler - dw_Dummy = inl(devpriv->s_BoardInfos.ui_Address+ 0x38); - outl(dw_Dummy | 0x2000,devpriv->s_BoardInfos.ui_Address+0x38); - - return 0; -} - - -/* -+----------------------------------------------------------------------------+ -| Function's Name : __VOID__ v_APCI1710_InterruptFunction | -| (BYTE b_Interrupt, __CPPARGS) | -+----------------------------------------------------------------------------+ -| Task : APCI-1710 interrupt function | -+----------------------------------------------------------------------------+ -| Input Parameters : BYTE b_Interrupt : Interrupt number | -+----------------------------------------------------------------------------+ -| Output Parameters : - | -+----------------------------------------------------------------------------+ -| Return Value : 0 : OK | -| -1 : Error | -+----------------------------------------------------------------------------+ -*/ - - - - - -VOID v_APCI1710_Interrupt(int irq, void *d, struct pt_regs *regs) -{ - comedi_device *dev = d; - comedi_subdevice *s = dev->subdevices + 0; - BYTE b_ModuleCpt = 0; - BYTE b_InterruptFlag = 0; - BYTE b_PWMCpt = 0; - BYTE b_ETMCpt = 0; - BYTE b_TorCounterCpt = 0; - BYTE b_PulseIncoderCpt = 0; - UINT ui_16BitValue; - ULONG ul_InterruptLatchReg; - ULONG ul_LatchRegisterValue; - ULONG ul_82X54InterruptStatus; - ULONG ul_StatusRegister; - - str_ModuleInfo * ps_ModuleInfo; - - printk("APCI1710 Interrupt\n"); - for (b_ModuleCpt = 0; b_ModuleCpt < 4; b_ModuleCpt ++, ps_ModuleInfo ++) - { - - /**************************/ - /* 1199/0225 to 0100/0226 */ - /**************************/ - ps_ModuleInfo = &devpriv->s_ModuleInfo [b_ModuleCpt]; - - - /***********************/ - /* Test if 82X54 timer */ - /***********************/ - - if ((devpriv-> - s_BoardInfos. - dw_MolduleConfiguration [b_ModuleCpt] & 0xFFFF0000UL) == APCI1710_82X54_TIMER) - { - - //printk("TIMER Interrupt Occurred\n"); - ul_82X54InterruptStatus= inl(devpriv->s_BoardInfos. - ui_Address + 12 + (64 * b_ModuleCpt)); - - /***************************/ - /* Test if interrupt occur */ - /***************************/ - - if ((ul_82X54InterruptStatus & ps_ModuleInfo-> - s_82X54ModuleInfo. - b_InterruptMask) != 0) - { - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - ul_OldInterruptMask = (ul_82X54InterruptStatus & ps_ModuleInfo-> - s_82X54ModuleInfo. - b_InterruptMask) << 4; - - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - b_OldModuleMask = 1 << b_ModuleCpt; - - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - ul_OldCounterLatchValue = 0; - - devpriv-> - s_InterruptParameters. - ul_InterruptOccur ++; - - /****************************/ - /* Increment the write FIFO */ - /****************************/ - - devpriv-> - s_InterruptParameters. - ui_Write = (devpriv-> - s_InterruptParameters. - ui_Write + 1) % APCI1710_SAVE_INTERRUPT; - - b_InterruptFlag = 1; - - - - /**********************/ - /* Call user function */ - /**********************/ - //Send a signal to from kernel to user space - send_sig(SIGIO,devpriv->tsk_Current,0); - - } // if ((ul_82X54InterruptStatus & 0x7) != 0) - } // 82X54 timer - - - - - - /***************************/ - /* Test if increm. counter */ - /***************************/ - - if ((devpriv-> - s_BoardInfos. - dw_MolduleConfiguration [b_ModuleCpt] & 0xFFFF0000UL) == APCI1710_INCREMENTAL_COUNTER) - { - - ul_InterruptLatchReg=inl(devpriv->s_BoardInfos. - ui_Address + (64 * b_ModuleCpt)); - - /*********************/ - /* Test if interrupt */ - /*********************/ - - if ((ul_InterruptLatchReg & 0x22) && (ps_ModuleInfo-> - s_SiemensCounterInfo. - s_ModeRegister. - s_ByteModeRegister. - b_ModeRegister2 & 0x80)) - { - /************************************/ - /* Test if strobe latch I interrupt */ - /************************************/ - - if (ul_InterruptLatchReg & 2) - { - ul_LatchRegisterValue=inl(devpriv->s_BoardInfos. - ui_Address + 4 + (64 * b_ModuleCpt)); - - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - ul_OldInterruptMask = 1UL; - - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - b_OldModuleMask = 1 << b_ModuleCpt; - - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - ul_OldCounterLatchValue = ul_LatchRegisterValue; - - devpriv-> - s_InterruptParameters. - ul_InterruptOccur ++; - - /****************************/ - /* 0899/0224 to 1199/0225 */ - /****************************/ - /* Increment the write FIFO */ - /****************************/ - - devpriv-> - s_InterruptParameters. - ui_Write = (devpriv-> - s_InterruptParameters. - ui_Write + 1) % APCI1710_SAVE_INTERRUPT; - - b_InterruptFlag = 1; - - - - /**********************/ - /* Call user function */ - /**********************/ - //Send a signal to from kernel to user space - send_sig(SIGIO,devpriv->tsk_Current,0); - - - } - - /*************************************/ - /* Test if strobe latch II interrupt */ - /*************************************/ - - if (ul_InterruptLatchReg & 0x20) - { - - ul_LatchRegisterValue=inl(devpriv->s_BoardInfos. - ui_Address + 8 + (64 * b_ModuleCpt)); - - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - ul_OldInterruptMask = 2UL; - - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - b_OldModuleMask = 1 << b_ModuleCpt; - - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - ul_OldCounterLatchValue = ul_LatchRegisterValue; - - devpriv-> - s_InterruptParameters. - ul_InterruptOccur ++; - - /****************************/ - /* 0899/0224 to 1199/0225 */ - /****************************/ - /* Increment the write FIFO */ - /****************************/ - - devpriv-> - s_InterruptParameters. - ui_Write = (devpriv-> - s_InterruptParameters. - ui_Write + 1) % APCI1710_SAVE_INTERRUPT; - - b_InterruptFlag = 1; - - - /**********************/ - /* Call user function */ - /**********************/ - //Send a signal to from kernel to user space - send_sig(SIGIO,devpriv->tsk_Current,0); - - } - } - - - ul_InterruptLatchReg=inl(devpriv-> s_BoardInfos. - ui_Address + 24 + (64 * b_ModuleCpt)); - - /***************************/ - /* Test if index interrupt */ - /***************************/ - - if (ul_InterruptLatchReg & 0x8) - { - ps_ModuleInfo-> - s_SiemensCounterInfo. - s_InitFlag. - b_IndexInterruptOccur = 1; - - if (ps_ModuleInfo-> - s_SiemensCounterInfo. - s_ModeRegister. - s_ByteModeRegister. - b_ModeRegister2 & APCI1710_INDEX_AUTO_MODE) - { - - outl(ps_ModuleInfo-> - s_SiemensCounterInfo. - s_ModeRegister. - dw_ModeRegister1_2_3_4,devpriv-> - s_BoardInfos. - ui_Address + 20 + (64 * b_ModuleCpt)); - } - - /*****************************/ - /* Test if interrupt enabled */ - /*****************************/ - - if ((ps_ModuleInfo-> - s_SiemensCounterInfo. - s_ModeRegister. - s_ByteModeRegister. - b_ModeRegister3 & APCI1710_ENABLE_INDEX_INT) == APCI1710_ENABLE_INDEX_INT) - { - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - ul_OldInterruptMask = 4UL; - - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - b_OldModuleMask = 1 << b_ModuleCpt; - - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - ul_OldCounterLatchValue = ul_LatchRegisterValue; - - devpriv-> - s_InterruptParameters. - ul_InterruptOccur ++; - - /****************************/ - /* 0899/0224 to 1199/0225 */ - /****************************/ - /* Increment the write FIFO */ - /****************************/ - - devpriv-> - s_InterruptParameters. - ui_Write = (devpriv-> - s_InterruptParameters. - ui_Write + 1) % APCI1710_SAVE_INTERRUPT; - - b_InterruptFlag = 1; - - - - /**********************/ - /* Call user function */ - /**********************/ - //Send a signal to from kernel to user space - send_sig(SIGIO,devpriv->tsk_Current,0); - - } - } - - /*****************************/ - /* Test if compare interrupt */ - /*****************************/ - - if (ul_InterruptLatchReg & 0x10) - { - /*****************************/ - /* Test if interrupt enabled */ - /*****************************/ - - if ((ps_ModuleInfo-> - s_SiemensCounterInfo. - s_ModeRegister. - s_ByteModeRegister. - b_ModeRegister3 & APCI1710_ENABLE_COMPARE_INT) == APCI1710_ENABLE_COMPARE_INT) - { - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - ul_OldInterruptMask = 8UL; - - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - b_OldModuleMask = 1 << b_ModuleCpt; - - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - ul_OldCounterLatchValue = ul_LatchRegisterValue; - - devpriv-> - s_InterruptParameters. - ul_InterruptOccur ++; - - /****************************/ - /* 0899/0224 to 1199/0225 */ - /****************************/ - /* Increment the write FIFO */ - /****************************/ - - devpriv-> - s_InterruptParameters. - ui_Write = (devpriv-> - s_InterruptParameters. - ui_Write + 1) % APCI1710_SAVE_INTERRUPT; - - b_InterruptFlag = 1; - - - - /**********************/ - /* Call user function */ - /**********************/ - //Send a signal to from kernel to user space - send_sig(SIGIO,devpriv->tsk_Current,0); - - - } - } - - /*******************************************/ - /* Test if frequency measurement interrupt */ - /*******************************************/ - - if (ul_InterruptLatchReg & 0x20) - { - /*******************/ - /* Read the status */ - /*******************/ - - ul_StatusRegister=inl(devpriv->s_BoardInfos. - ui_Address + 32 + (64 * b_ModuleCpt)); - - /******************/ - /* Read the value */ - /******************/ - - - ul_LatchRegisterValue=inl(devpriv->s_BoardInfos. - ui_Address + 28 + (64 * b_ModuleCpt)); - - switch ((ul_StatusRegister >> 1) & 3) - { - case 0: - /*************************/ - /* Test the counter mode */ - /*************************/ - - if ((devpriv-> - s_ModuleInfo [b_ModuleCpt]. - s_SiemensCounterInfo. - s_ModeRegister. - s_ByteModeRegister. - b_ModeRegister1 & APCI1710_16BIT_COUNTER) == APCI1710_16BIT_COUNTER) - { - /****************************************/ - /* Test if 16-bit counter 1 pulse occur */ - /****************************************/ - - if ((ul_LatchRegisterValue & 0xFFFFU) != 0) - { - ui_16BitValue = (UINT) ul_LatchRegisterValue & 0xFFFFU; - ul_LatchRegisterValue = (ul_LatchRegisterValue & 0xFFFF0000UL) | (0xFFFFU - ui_16BitValue); - } - - /****************************************/ - /* Test if 16-bit counter 2 pulse occur */ - /****************************************/ - - if ((ul_LatchRegisterValue & 0xFFFF0000UL) != 0) - { - ui_16BitValue = (UINT) ((ul_LatchRegisterValue >> 16) & 0xFFFFU); - ul_LatchRegisterValue = (ul_LatchRegisterValue & 0xFFFFUL) | ((0xFFFFU - ui_16BitValue) << 16); - } - } - else - { - if (ul_LatchRegisterValue != 0) - { - ul_LatchRegisterValue = 0xFFFFFFFFUL - ul_LatchRegisterValue; - } - } - break; - - case 1: - /****************************************/ - /* Test if 16-bit counter 2 pulse occur */ - /****************************************/ - - if ((ul_LatchRegisterValue & 0xFFFF0000UL) != 0) - { - ui_16BitValue = (UINT) ((ul_LatchRegisterValue >> 16) & 0xFFFFU); - ul_LatchRegisterValue = (ul_LatchRegisterValue & 0xFFFFUL) | ((0xFFFFU - ui_16BitValue) << 16); - } - break; - - case 2: - /****************************************/ - /* Test if 16-bit counter 1 pulse occur */ - /****************************************/ - - if ((ul_LatchRegisterValue & 0xFFFFU) != 0) - { - ui_16BitValue = (UINT) ul_LatchRegisterValue & 0xFFFFU; - ul_LatchRegisterValue = (ul_LatchRegisterValue & 0xFFFF0000UL) | (0xFFFFU - ui_16BitValue); - } - break; - } - - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - ul_OldInterruptMask = 0x10000UL; - - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - b_OldModuleMask = 1 << b_ModuleCpt; - - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - ul_OldCounterLatchValue = ul_LatchRegisterValue; - - devpriv-> - s_InterruptParameters. - ul_InterruptOccur ++; - - /****************************/ - /* 0899/0224 to 1199/0225 */ - /****************************/ - /* Increment the write FIFO */ - /****************************/ - - devpriv-> - s_InterruptParameters. - ui_Write = (devpriv-> - s_InterruptParameters. - ui_Write + 1) % APCI1710_SAVE_INTERRUPT; - - b_InterruptFlag = 1; - - - - /**********************/ - /* Call user function */ - /**********************/ - //Send a signal to from kernel to user space - send_sig(SIGIO,devpriv->tsk_Current,0); - - - - } - } // Incremental counter - - - - - - - /***************/ - /* Test if CDA */ - /***************/ - - if ((devpriv-> - s_BoardInfos. - dw_MolduleConfiguration [b_ModuleCpt] & 0xFFFF0000UL) == APCI1710_CDA) - { - /******************************************/ - /* Test if CDA enable and functionality 0 */ - /******************************************/ - - if ((devpriv-> - s_ModuleInfo [b_ModuleCpt]. - s_CDAModuleInfo. - b_CDAEnable == APCI1710_ENABLE) && (devpriv-> - s_ModuleInfo [b_ModuleCpt]. - s_CDAModuleInfo. - b_FctSelection == 0)) - { - /****************************/ - /* Get the interrupt status */ - /****************************/ - - - ul_StatusRegister=inl(devpriv->s_BoardInfos. - ui_Address + 16 + (64 * b_ModuleCpt)); - /***************************/ - /* Test if interrupt occur */ - /***************************/ - - if (ul_StatusRegister & 1) - { - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - ul_OldInterruptMask = 0x80000UL; - - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - b_OldModuleMask = 1 << b_ModuleCpt; - - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - ul_OldCounterLatchValue = 0; - - devpriv-> - s_InterruptParameters. - ul_InterruptOccur ++; - - - /****************************/ - /* Increment the write FIFO */ - /****************************/ - - devpriv-> - s_InterruptParameters. - ui_Write = (devpriv-> - s_InterruptParameters. - ui_Write + 1) % APCI1710_SAVE_INTERRUPT; - - b_InterruptFlag = 1; - - - - /**********************/ - /* Call user function */ - /**********************/ - - //Send a signal to from kernel to user space - send_sig(SIGIO,devpriv->tsk_Current,0); - - } // if (ul_StatusRegister & 1) - - } - } // CDA - - - /***********************/ - /* Test if PWM counter */ - /***********************/ - - if ((devpriv-> - s_BoardInfos. - dw_MolduleConfiguration [b_ModuleCpt] & 0xFFFF0000UL) == APCI1710_PWM) - { - for (b_PWMCpt = 0; b_PWMCpt < 2; b_PWMCpt ++) - { - /*************************************/ - /* Test if PWM interrupt initialised */ - /*************************************/ - - if (devpriv-> - s_ModuleInfo [b_ModuleCpt]. - s_PWMModuleInfo. - s_PWMInfo [b_PWMCpt]. - b_InterruptEnable == APCI1710_ENABLE) - { - /*****************************/ - /* Read the interrupt status */ - /*****************************/ - - ul_StatusRegister=inl(devpriv->s_BoardInfos. - ui_Address + 16 + (20 * b_PWMCpt) + (64 * b_ModuleCpt)); - - - /***************************/ - /* Test if interrupt occur */ - /***************************/ - - if (ul_StatusRegister & 0x1) - { - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - ul_OldInterruptMask = 0x4000UL << b_PWMCpt; - - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - b_OldModuleMask = 1 << b_ModuleCpt; - - devpriv-> - s_InterruptParameters. - ul_InterruptOccur ++; - - /****************************/ - /* Increment the write FIFO */ - /****************************/ - - devpriv-> - s_InterruptParameters. - ui_Write = (devpriv-> - s_InterruptParameters. - ui_Write + 1) % APCI1710_SAVE_INTERRUPT; - - b_InterruptFlag = 1; - - - /**********************/ - /* Call user function */ - /**********************/ - //Send a signal to from kernel to user space - send_sig(SIGIO,devpriv->tsk_Current,0); - - - } // if (ul_StatusRegister & 0x1) - } // if (APCI1710_ENABLE) - } // for (b_PWMCpt == 0; b_PWMCpt < 0; b_PWMCpt ++) - } // PWM counter - - - - /***********************/ - /* Test if tor counter */ - /***********************/ - - if ((devpriv-> - s_BoardInfos. - dw_MolduleConfiguration [b_ModuleCpt] & 0xFFFF0000UL) == APCI1710_TOR_COUNTER) - { - for (b_TorCounterCpt = 0; b_TorCounterCpt < 2; b_TorCounterCpt ++) - { - /*************************************/ - /* Test if tor interrupt initialised */ - /*************************************/ - - if (devpriv-> - s_ModuleInfo [b_ModuleCpt]. - s_TorCounterModuleInfo. - s_TorCounterInfo [b_TorCounterCpt]. - b_InterruptEnable == APCI1710_ENABLE) - { - /*****************************/ - /* Read the interrupt status */ - /*****************************/ - - - ul_StatusRegister=inl(devpriv->s_BoardInfos. - ui_Address + 12 + (16 * b_TorCounterCpt) + (64 * b_ModuleCpt)); - - /***************************/ - /* Test if interrupt occur */ - /***************************/ - - if (ul_StatusRegister & 0x1) - { - /******************************/ - /* Read the tor counter value */ - /******************************/ - - - ul_LatchRegisterValue=inl(devpriv->s_BoardInfos. - ui_Address + 0 + (16 * b_TorCounterCpt) + (64 * b_ModuleCpt)); - - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - ul_OldInterruptMask = 0x1000UL << b_TorCounterCpt; - - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - b_OldModuleMask = 1 << b_ModuleCpt; - - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - ul_OldCounterLatchValue = ul_LatchRegisterValue; - - devpriv-> - s_InterruptParameters. - ul_InterruptOccur ++; - - - /****************************/ - /* Increment the write FIFO */ - /****************************/ - - devpriv-> - s_InterruptParameters. - ui_Write = (devpriv-> - s_InterruptParameters. - ui_Write + 1) % APCI1710_SAVE_INTERRUPT; - - b_InterruptFlag = 1; - - - /**********************/ - /* Call user function */ - /**********************/ - - //Send a signal to from kernel to user space - send_sig(SIGIO,devpriv->tsk_Current,0); - } // if (ul_StatusRegister & 0x1) - } // if (APCI1710_ENABLE) - } // for (b_TorCounterCpt == 0; b_TorCounterCpt < 0; b_TorCounterCpt ++) - } // Tor counter - - - - - /***********************/ - /* Test if chronometer */ - /***********************/ - - if ((devpriv-> - s_BoardInfos. - dw_MolduleConfiguration [b_ModuleCpt] & 0xFFFF0000UL) == APCI1710_CHRONOMETER) - { - - //printk("APCI1710 Chrono Interrupt\n"); - /*****************************/ - /* Read the interrupt status */ - /*****************************/ - - - ul_InterruptLatchReg=inl(devpriv->s_BoardInfos. - ui_Address + 12 + (64 * b_ModuleCpt)); - - /***************************/ - /* Test if interrupt occur */ - /***************************/ - - if ((ul_InterruptLatchReg & 0x8) == 0x8) - { - /****************************/ - /* Clear the interrupt flag */ - /****************************/ - - - outl(0,devpriv->s_BoardInfos. - ui_Address + 32 + (64 * b_ModuleCpt)); - - /***************************/ - /* Test if continuous mode */ - /***************************/ - - if (ps_ModuleInfo-> - s_ChronoModuleInfo. - b_CycleMode == APCI1710_ENABLE) - { - /********************/ - /* Clear the status */ - /********************/ - - - outl(0,devpriv->s_BoardInfos. - ui_Address + 36 + (64 * b_ModuleCpt)); - } - - /*************************/ - /* Read the timing value */ - /*************************/ - - - ul_LatchRegisterValue=inl(devpriv->s_BoardInfos. - ui_Address + 4 + (64 * b_ModuleCpt)); - - /*****************************/ - /* Test if interrupt enabled */ - /*****************************/ - - if (ps_ModuleInfo-> - s_ChronoModuleInfo. - b_InterruptMask) - { - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - ul_OldInterruptMask = 0x80; - - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - b_OldModuleMask = 1 << b_ModuleCpt; - - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - ul_OldCounterLatchValue = ul_LatchRegisterValue; - - devpriv-> - s_InterruptParameters. - ul_InterruptOccur ++; - - /****************************/ - /* Increment the write FIFO */ - /****************************/ - - devpriv-> - s_InterruptParameters. - ui_Write = (devpriv-> - s_InterruptParameters. - ui_Write + 1) % APCI1710_SAVE_INTERRUPT; - - b_InterruptFlag = 1; - - - - /**********************/ - /* Call user function */ - /**********************/ - //Send a signal to from kernel to user space - send_sig(SIGIO,devpriv->tsk_Current,0); - - } - } - } // Chronometer - - - - /*************************/ - /* Test if pulse encoder */ - /*************************/ - - if ((devpriv-> - s_BoardInfos. - dw_MolduleConfiguration [b_ModuleCpt] & 0xFFFF0000UL) == APCI1710_PULSE_ENCODER) - { - /****************************/ - /* Read the status register */ - /****************************/ - - - ul_StatusRegister=inl(devpriv->s_BoardInfos. - ui_Address + 20 + (64 * b_ModuleCpt)); - - if (ul_StatusRegister & 0xF) - { - for (b_PulseIncoderCpt = 0; b_PulseIncoderCpt < 4; b_PulseIncoderCpt ++) - { - /*************************************/ - /* Test if pulse encoder initialised */ - /*************************************/ - - if ((ps_ModuleInfo-> - s_PulseEncoderModuleInfo. - s_PulseEncoderInfo [b_PulseIncoderCpt]. - b_PulseEncoderInit == 1) && - (((ps_ModuleInfo-> - s_PulseEncoderModuleInfo. - dw_SetRegister >> b_PulseIncoderCpt) & 1) == 1) && - (((ul_StatusRegister >> (b_PulseIncoderCpt)) & 1) == 1)) - { - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - ul_OldInterruptMask = 0x100UL << b_PulseIncoderCpt; - - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - b_OldModuleMask = 1 << b_ModuleCpt; - - devpriv-> - s_InterruptParameters. - s_FIFOInterruptParameters [devpriv-> - s_InterruptParameters. - ui_Write]. - ul_OldCounterLatchValue = ul_LatchRegisterValue; - - devpriv-> - s_InterruptParameters. - ul_InterruptOccur ++; - - /****************************/ - /* 0899/0224 to 1199/0225 */ - /****************************/ - /* Increment the write FIFO */ - /****************************/ - - devpriv-> - s_InterruptParameters. - ui_Write = (devpriv-> - s_InterruptParameters. - ui_Write + 1) % APCI1710_SAVE_INTERRUPT; - - b_InterruptFlag = 1; - - /**********************/ - /* Call user function */ - /**********************/ - //Send a signal to from kernel to user space - send_sig(SIGIO,devpriv->tsk_Current,0); - - - } - } - } - }//pulse encoder - - } - return ; - -} - + #include "APCI1710_Ttl.c" + #include "APCI1710_Dig_io.c" + #include "APCI1710_82x54.c" + #include "APCI1710_Chrono.c" + #include "APCI1710_Pwm.c" + #include "APCI1710_INCCPT.c" + + +void i_ADDI_AttachPCI1710 (comedi_device *dev) + { + comedi_subdevice *s; + int ret = 0; + int n_subdevices = 9; + + //Update-0.7.57->0.7.68dev->n_subdevices = 9; + if((ret=alloc_subdevices(dev,n_subdevices))<0) + return ret; + + // Allocate and Initialise Timer Subdevice Structures + s = dev->subdevices + 0; + + s->type = COMEDI_SUBD_TIMER; + s->subdev_flags = SDF_WRITEABLE|SDF_RT|SDF_GROUND|SDF_COMMON; + s->n_chan = 3; + s->maxdata = 0; + s->len_chanlist = 3; + s->range_table = &range_digital; + s->insn_write=i_APCI1710_InsnWriteEnableDisableTimer; + s->insn_read=i_APCI1710_InsnReadAllTimerValue; + s->insn_config=i_APCI1710_InsnConfigInitTimer; + s->insn_bits=i_APCI1710_InsnBitsTimer; + + + // Allocate and Initialise DIO Subdevice Structures + s = dev->subdevices + 1; + + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_WRITEABLE|SDF_READABLE|SDF_RT|SDF_GROUND|SDF_COMMON; + s->n_chan = 7; + s->maxdata = 1; + s->len_chanlist = 7; + s->range_table = &range_digital; + s->insn_config=i_APCI1710_InsnConfigDigitalIO; + s->insn_read= i_APCI1710_InsnReadDigitalIOChlValue; + s->insn_bits=i_APCI1710_InsnBitsDigitalIOPortOnOff; + s->insn_write=i_APCI1710_InsnWriteDigitalIOChlOnOff; + + + // Allocate and Initialise Chrono Subdevice Structures + s = dev->subdevices + 2; + + s->type = COMEDI_SUBD_CHRONO; + s->subdev_flags = SDF_WRITEABLE|SDF_RT|SDF_GROUND|SDF_COMMON; + s->n_chan = 4; + s->maxdata = 0; + s->len_chanlist = 4; + s->range_table = &range_digital; + s->insn_write=i_APCI1710_InsnWriteEnableDisableChrono; + s->insn_read=i_APCI1710_InsnReadChrono; + s->insn_config=i_APCI1710_InsnConfigInitChrono; + s->insn_bits=i_APCI1710_InsnBitsChronoDigitalIO; + + + // Allocate and Initialise PWM Subdevice Structures + s = dev->subdevices + 3; + s->type = COMEDI_SUBD_PWM; + s->subdev_flags = SDF_WRITEABLE|SDF_READABLE|SDF_RT|SDF_GROUND|SDF_COMMON; + s->n_chan = 3; + s->maxdata = 1; + s->len_chanlist = 3; + s->range_table = &range_digital; + s->io_bits=0; //all bits input + s->insn_config = i_APCI1710_InsnConfigPWM; + s->insn_read = i_APCI1710_InsnReadGetPWMStatus; + s->insn_write = i_APCI1710_InsnWritePWM; + s->insn_bits = i_APCI1710_InsnBitsReadPWMInterrupt; + + // Allocate and Initialise TTLIO Subdevice Structures + s = dev->subdevices + 4; + s->type = COMEDI_SUBD_TTLIO; + s->subdev_flags = SDF_WRITEABLE|SDF_READABLE|SDF_RT|SDF_GROUND|SDF_COMMON; + s->n_chan = 8; + s->maxdata = 1; + s->len_chanlist = 8; + s->range_table = &range_apci1710_ttl; // to pass arguments in range + s->insn_config = i_APCI1710_InsnConfigInitTTLIO; + s->insn_bits = i_APCI1710_InsnBitsReadTTLIO; + s->insn_write = i_APCI1710_InsnWriteSetTTLIOChlOnOff; + s->insn_read = i_APCI1710_InsnReadTTLIOAllPortValue; + + + // Allocate and Initialise TOR Subdevice Structures + s = dev->subdevices + 5; + s->type = COMEDI_SUBD_TOR; + s->subdev_flags = SDF_WRITEABLE|SDF_READABLE|SDF_RT|SDF_GROUND|SDF_COMMON; + s->n_chan = 8; + s->maxdata = 1; + s->len_chanlist = 8; + s->range_table = &range_digital; + s->io_bits=0; //all bits input + s->insn_config = i_APCI1710_InsnConfigInitTorCounter; + s->insn_read = i_APCI1710_InsnReadGetTorCounterInitialisation; + s->insn_write = i_APCI1710_InsnWriteEnableDisableTorCounter; + s->insn_bits = i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue; + + // Allocate and Initialise SSI Subdevice Structures + s = dev->subdevices + 6; + s->type = COMEDI_SUBD_SSI; + s->subdev_flags = SDF_WRITEABLE|SDF_READABLE|SDF_RT|SDF_GROUND|SDF_COMMON; + s->n_chan =4; + s->maxdata = 1; + s->len_chanlist = 4; + s->range_table = &range_apci1710_ssi; + s->insn_config = i_APCI1710_InsnConfigInitSSI; + s->insn_read = i_APCI1710_InsnReadSSIValue; + s->insn_bits = i_APCI1710_InsnBitsSSIDigitalIO; + + // Allocate and Initialise PULSEENCODER Subdevice Structures + s = dev->subdevices + 7; + s->type = COMEDI_SUBD_PULSEENCODER; + s->subdev_flags = SDF_WRITEABLE|SDF_READABLE|SDF_RT|SDF_GROUND|SDF_COMMON; + s->n_chan = 4; + s->maxdata = 1; + s->len_chanlist = 4; + s->range_table = &range_digital; + s->insn_config = i_APCI1710_InsnConfigInitPulseEncoder; + s->insn_write = i_APCI1710_InsnWriteEnableDisablePulseEncoder; + s->insn_bits = i_APCI1710_InsnBitsReadWritePulseEncoder; + s->insn_read = i_APCI1710_InsnReadInterruptPulseEncoder; + + // Allocate and Initialise INCREMENTALCOUNTER Subdevice Structures + s = dev->subdevices + 8; + s->type = COMEDI_SUBD_INCREMENTALCOUNTER; + s->subdev_flags = SDF_WRITEABLE|SDF_READABLE|SDF_RT|SDF_GROUND|SDF_COMMON; + s->n_chan = 500; + s->maxdata = 1; + s->len_chanlist = 500; + s->range_table = &range_apci1710_inccpt; + s->insn_config = i_APCI1710_InsnConfigINCCPT; + s->insn_write = i_APCI1710_InsnWriteINCCPT; + s->insn_read = i_APCI1710_InsnReadINCCPT; + s->insn_bits = i_APCI1710_InsnBitsINCCPT; + } + + + +int i_APCI1710_Reset(comedi_device *dev); +VOID v_APCI1710_Interrupt(int irq, void *d, struct pt_regs *regs) ; +//for 1710 + + int i_APCI1710_Reset(comedi_device *dev) +{ + int ret; + DWORD dw_Dummy; + + /*********************************/ + /* Read all module configuration */ + /*********************************/ + ret=inl(devpriv->s_BoardInfos.ui_Address+60); + devpriv->s_BoardInfos.dw_MolduleConfiguration [0]=ret; + + ret=inl(devpriv->s_BoardInfos.ui_Address+124); + devpriv->s_BoardInfos.dw_MolduleConfiguration [1]=ret; + + ret=inl(devpriv->s_BoardInfos.ui_Address+188); + devpriv->s_BoardInfos.dw_MolduleConfiguration [2]=ret; + + ret=inl(devpriv->s_BoardInfos.ui_Address+252); + devpriv->s_BoardInfos.dw_MolduleConfiguration [3]=ret; + + // outl(0x80808082,devpriv->s_BoardInfos.ui_Address+0x60); + outl(0x83838383,devpriv->s_BoardInfos.ui_Address+0x60); + + devpriv->s_BoardInfos.b_BoardVersion = 1; + + // Enable the interrupt for the controler + dw_Dummy = inl(devpriv->s_BoardInfos.ui_Address+ 0x38); + outl(dw_Dummy | 0x2000,devpriv->s_BoardInfos.ui_Address+0x38); + + return 0; +} + + +/* ++----------------------------------------------------------------------------+ +| Function's Name : __VOID__ v_APCI1710_InterruptFunction | +| (BYTE b_Interrupt, __CPPARGS) | ++----------------------------------------------------------------------------+ +| Task : APCI-1710 interrupt function | ++----------------------------------------------------------------------------+ +| Input Parameters : BYTE b_Interrupt : Interrupt number | ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value : 0 : OK | +| -1 : Error | ++----------------------------------------------------------------------------+ +*/ + + + + + +VOID v_APCI1710_Interrupt(int irq, void *d, struct pt_regs *regs) +{ + comedi_device *dev = d; + BYTE b_ModuleCpt = 0; + BYTE b_InterruptFlag = 0; + BYTE b_PWMCpt = 0; + BYTE b_TorCounterCpt = 0; + BYTE b_PulseIncoderCpt = 0; + UINT ui_16BitValue; + ULONG ul_InterruptLatchReg = 0; + ULONG ul_LatchRegisterValue; + ULONG ul_82X54InterruptStatus; + ULONG ul_StatusRegister; + + str_ModuleInfo * ps_ModuleInfo; + + printk("APCI1710 Interrupt\n"); + for (b_ModuleCpt = 0; b_ModuleCpt < 4; b_ModuleCpt ++, ps_ModuleInfo ++) + { + + /**************************/ + /* 1199/0225 to 0100/0226 */ + /**************************/ + ps_ModuleInfo = &devpriv->s_ModuleInfo [b_ModuleCpt]; + + + /***********************/ + /* Test if 82X54 timer */ + /***********************/ + + if ((devpriv-> + s_BoardInfos. + dw_MolduleConfiguration [b_ModuleCpt] & 0xFFFF0000UL) == APCI1710_82X54_TIMER) + { + + //printk("TIMER Interrupt Occurred\n"); + ul_82X54InterruptStatus= inl(devpriv->s_BoardInfos. + ui_Address + 12 + (64 * b_ModuleCpt)); + + /***************************/ + /* Test if interrupt occur */ + /***************************/ + + if ((ul_82X54InterruptStatus & ps_ModuleInfo-> + s_82X54ModuleInfo. + b_InterruptMask) != 0) + { + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + ul_OldInterruptMask = (ul_82X54InterruptStatus & ps_ModuleInfo-> + s_82X54ModuleInfo. + b_InterruptMask) << 4; + + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + b_OldModuleMask = 1 << b_ModuleCpt; + + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + ul_OldCounterLatchValue = 0; + + devpriv-> + s_InterruptParameters. + ul_InterruptOccur ++; + + /****************************/ + /* Increment the write FIFO */ + /****************************/ + + devpriv-> + s_InterruptParameters. + ui_Write = (devpriv-> + s_InterruptParameters. + ui_Write + 1) % APCI1710_SAVE_INTERRUPT; + + b_InterruptFlag = 1; + + + + /**********************/ + /* Call user function */ + /**********************/ + //Send a signal to from kernel to user space + send_sig(SIGIO,devpriv->tsk_Current,0); + + } // if ((ul_82X54InterruptStatus & 0x7) != 0) + } // 82X54 timer + + + + + + /***************************/ + /* Test if increm. counter */ + /***************************/ + + if ((devpriv-> + s_BoardInfos. + dw_MolduleConfiguration [b_ModuleCpt] & 0xFFFF0000UL) == APCI1710_INCREMENTAL_COUNTER) + { + + ul_InterruptLatchReg=inl(devpriv->s_BoardInfos. + ui_Address + (64 * b_ModuleCpt)); + + /*********************/ + /* Test if interrupt */ + /*********************/ + + if ((ul_InterruptLatchReg & 0x22) && (ps_ModuleInfo-> + s_SiemensCounterInfo. + s_ModeRegister. + s_ByteModeRegister. + b_ModeRegister2 & 0x80)) + { + /************************************/ + /* Test if strobe latch I interrupt */ + /************************************/ + + if (ul_InterruptLatchReg & 2) + { + ul_LatchRegisterValue=inl(devpriv->s_BoardInfos. + ui_Address + 4 + (64 * b_ModuleCpt)); + + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + ul_OldInterruptMask = 1UL; + + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + b_OldModuleMask = 1 << b_ModuleCpt; + + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + ul_OldCounterLatchValue = ul_LatchRegisterValue; + + devpriv-> + s_InterruptParameters. + ul_InterruptOccur ++; + + /****************************/ + /* 0899/0224 to 1199/0225 */ + /****************************/ + /* Increment the write FIFO */ + /****************************/ + + devpriv-> + s_InterruptParameters. + ui_Write = (devpriv-> + s_InterruptParameters. + ui_Write + 1) % APCI1710_SAVE_INTERRUPT; + + b_InterruptFlag = 1; + + + + /**********************/ + /* Call user function */ + /**********************/ + //Send a signal to from kernel to user space + send_sig(SIGIO,devpriv->tsk_Current,0); + + + } + + /*************************************/ + /* Test if strobe latch II interrupt */ + /*************************************/ + + if (ul_InterruptLatchReg & 0x20) + { + + ul_LatchRegisterValue=inl(devpriv->s_BoardInfos. + ui_Address + 8 + (64 * b_ModuleCpt)); + + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + ul_OldInterruptMask = 2UL; + + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + b_OldModuleMask = 1 << b_ModuleCpt; + + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + ul_OldCounterLatchValue = ul_LatchRegisterValue; + + devpriv-> + s_InterruptParameters. + ul_InterruptOccur ++; + + /****************************/ + /* 0899/0224 to 1199/0225 */ + /****************************/ + /* Increment the write FIFO */ + /****************************/ + + devpriv-> + s_InterruptParameters. + ui_Write = (devpriv-> + s_InterruptParameters. + ui_Write + 1) % APCI1710_SAVE_INTERRUPT; + + b_InterruptFlag = 1; + + + /**********************/ + /* Call user function */ + /**********************/ + //Send a signal to from kernel to user space + send_sig(SIGIO,devpriv->tsk_Current,0); + + } + } + + + ul_InterruptLatchReg=inl(devpriv-> s_BoardInfos. + ui_Address + 24 + (64 * b_ModuleCpt)); + + /***************************/ + /* Test if index interrupt */ + /***************************/ + + if (ul_InterruptLatchReg & 0x8) + { + ps_ModuleInfo-> + s_SiemensCounterInfo. + s_InitFlag. + b_IndexInterruptOccur = 1; + + if (ps_ModuleInfo-> + s_SiemensCounterInfo. + s_ModeRegister. + s_ByteModeRegister. + b_ModeRegister2 & APCI1710_INDEX_AUTO_MODE) + { + + outl(ps_ModuleInfo-> + s_SiemensCounterInfo. + s_ModeRegister. + dw_ModeRegister1_2_3_4,devpriv-> + s_BoardInfos. + ui_Address + 20 + (64 * b_ModuleCpt)); + } + + /*****************************/ + /* Test if interrupt enabled */ + /*****************************/ + + if ((ps_ModuleInfo-> + s_SiemensCounterInfo. + s_ModeRegister. + s_ByteModeRegister. + b_ModeRegister3 & APCI1710_ENABLE_INDEX_INT) == APCI1710_ENABLE_INDEX_INT) + { + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + ul_OldInterruptMask = 4UL; + + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + b_OldModuleMask = 1 << b_ModuleCpt; + + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + ul_OldCounterLatchValue = ul_LatchRegisterValue; + + devpriv-> + s_InterruptParameters. + ul_InterruptOccur ++; + + /****************************/ + /* 0899/0224 to 1199/0225 */ + /****************************/ + /* Increment the write FIFO */ + /****************************/ + + devpriv-> + s_InterruptParameters. + ui_Write = (devpriv-> + s_InterruptParameters. + ui_Write + 1) % APCI1710_SAVE_INTERRUPT; + + b_InterruptFlag = 1; + + + + /**********************/ + /* Call user function */ + /**********************/ + //Send a signal to from kernel to user space + send_sig(SIGIO,devpriv->tsk_Current,0); + + } + } + + /*****************************/ + /* Test if compare interrupt */ + /*****************************/ + + if (ul_InterruptLatchReg & 0x10) + { + /*****************************/ + /* Test if interrupt enabled */ + /*****************************/ + + if ((ps_ModuleInfo-> + s_SiemensCounterInfo. + s_ModeRegister. + s_ByteModeRegister. + b_ModeRegister3 & APCI1710_ENABLE_COMPARE_INT) == APCI1710_ENABLE_COMPARE_INT) + { + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + ul_OldInterruptMask = 8UL; + + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + b_OldModuleMask = 1 << b_ModuleCpt; + + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + ul_OldCounterLatchValue = ul_LatchRegisterValue; + + devpriv-> + s_InterruptParameters. + ul_InterruptOccur ++; + + /****************************/ + /* 0899/0224 to 1199/0225 */ + /****************************/ + /* Increment the write FIFO */ + /****************************/ + + devpriv-> + s_InterruptParameters. + ui_Write = (devpriv-> + s_InterruptParameters. + ui_Write + 1) % APCI1710_SAVE_INTERRUPT; + + b_InterruptFlag = 1; + + + + /**********************/ + /* Call user function */ + /**********************/ + //Send a signal to from kernel to user space + send_sig(SIGIO,devpriv->tsk_Current,0); + + + } + } + + /*******************************************/ + /* Test if frequency measurement interrupt */ + /*******************************************/ + + if (ul_InterruptLatchReg & 0x20) + { + /*******************/ + /* Read the status */ + /*******************/ + + ul_StatusRegister=inl(devpriv->s_BoardInfos. + ui_Address + 32 + (64 * b_ModuleCpt)); + + /******************/ + /* Read the value */ + /******************/ + + + ul_LatchRegisterValue=inl(devpriv->s_BoardInfos. + ui_Address + 28 + (64 * b_ModuleCpt)); + + switch ((ul_StatusRegister >> 1) & 3) + { + case 0: + /*************************/ + /* Test the counter mode */ + /*************************/ + + if ((devpriv-> + s_ModuleInfo [b_ModuleCpt]. + s_SiemensCounterInfo. + s_ModeRegister. + s_ByteModeRegister. + b_ModeRegister1 & APCI1710_16BIT_COUNTER) == APCI1710_16BIT_COUNTER) + { + /****************************************/ + /* Test if 16-bit counter 1 pulse occur */ + /****************************************/ + + if ((ul_LatchRegisterValue & 0xFFFFU) != 0) + { + ui_16BitValue = (UINT) ul_LatchRegisterValue & 0xFFFFU; + ul_LatchRegisterValue = (ul_LatchRegisterValue & 0xFFFF0000UL) | (0xFFFFU - ui_16BitValue); + } + + /****************************************/ + /* Test if 16-bit counter 2 pulse occur */ + /****************************************/ + + if ((ul_LatchRegisterValue & 0xFFFF0000UL) != 0) + { + ui_16BitValue = (UINT) ((ul_LatchRegisterValue >> 16) & 0xFFFFU); + ul_LatchRegisterValue = (ul_LatchRegisterValue & 0xFFFFUL) | ((0xFFFFU - ui_16BitValue) << 16); + } + } + else + { + if (ul_LatchRegisterValue != 0) + { + ul_LatchRegisterValue = 0xFFFFFFFFUL - ul_LatchRegisterValue; + } + } + break; + + case 1: + /****************************************/ + /* Test if 16-bit counter 2 pulse occur */ + /****************************************/ + + if ((ul_LatchRegisterValue & 0xFFFF0000UL) != 0) + { + ui_16BitValue = (UINT) ((ul_LatchRegisterValue >> 16) & 0xFFFFU); + ul_LatchRegisterValue = (ul_LatchRegisterValue & 0xFFFFUL) | ((0xFFFFU - ui_16BitValue) << 16); + } + break; + + case 2: + /****************************************/ + /* Test if 16-bit counter 1 pulse occur */ + /****************************************/ + + if ((ul_LatchRegisterValue & 0xFFFFU) != 0) + { + ui_16BitValue = (UINT) ul_LatchRegisterValue & 0xFFFFU; + ul_LatchRegisterValue = (ul_LatchRegisterValue & 0xFFFF0000UL) | (0xFFFFU - ui_16BitValue); + } + break; + } + + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + ul_OldInterruptMask = 0x10000UL; + + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + b_OldModuleMask = 1 << b_ModuleCpt; + + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + ul_OldCounterLatchValue = ul_LatchRegisterValue; + + devpriv-> + s_InterruptParameters. + ul_InterruptOccur ++; + + /****************************/ + /* 0899/0224 to 1199/0225 */ + /****************************/ + /* Increment the write FIFO */ + /****************************/ + + devpriv-> + s_InterruptParameters. + ui_Write = (devpriv-> + s_InterruptParameters. + ui_Write + 1) % APCI1710_SAVE_INTERRUPT; + + b_InterruptFlag = 1; + + + + /**********************/ + /* Call user function */ + /**********************/ + //Send a signal to from kernel to user space + send_sig(SIGIO,devpriv->tsk_Current,0); + + + + } + } // Incremental counter + + + + + + + /***************/ + /* Test if CDA */ + /***************/ + + if ((devpriv-> + s_BoardInfos. + dw_MolduleConfiguration [b_ModuleCpt] & 0xFFFF0000UL) == APCI1710_CDA) + { + /******************************************/ + /* Test if CDA enable and functionality 0 */ + /******************************************/ + + if ((devpriv-> + s_ModuleInfo [b_ModuleCpt]. + s_CDAModuleInfo. + b_CDAEnable == APCI1710_ENABLE) && (devpriv-> + s_ModuleInfo [b_ModuleCpt]. + s_CDAModuleInfo. + b_FctSelection == 0)) + { + /****************************/ + /* Get the interrupt status */ + /****************************/ + + + ul_StatusRegister=inl(devpriv->s_BoardInfos. + ui_Address + 16 + (64 * b_ModuleCpt)); + /***************************/ + /* Test if interrupt occur */ + /***************************/ + + if (ul_StatusRegister & 1) + { + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + ul_OldInterruptMask = 0x80000UL; + + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + b_OldModuleMask = 1 << b_ModuleCpt; + + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + ul_OldCounterLatchValue = 0; + + devpriv-> + s_InterruptParameters. + ul_InterruptOccur ++; + + + /****************************/ + /* Increment the write FIFO */ + /****************************/ + + devpriv-> + s_InterruptParameters. + ui_Write = (devpriv-> + s_InterruptParameters. + ui_Write + 1) % APCI1710_SAVE_INTERRUPT; + + b_InterruptFlag = 1; + + + + /**********************/ + /* Call user function */ + /**********************/ + + //Send a signal to from kernel to user space + send_sig(SIGIO,devpriv->tsk_Current,0); + + } // if (ul_StatusRegister & 1) + + } + } // CDA + + + /***********************/ + /* Test if PWM counter */ + /***********************/ + + if ((devpriv-> + s_BoardInfos. + dw_MolduleConfiguration [b_ModuleCpt] & 0xFFFF0000UL) == APCI1710_PWM) + { + for (b_PWMCpt = 0; b_PWMCpt < 2; b_PWMCpt ++) + { + /*************************************/ + /* Test if PWM interrupt initialised */ + /*************************************/ + + if (devpriv-> + s_ModuleInfo [b_ModuleCpt]. + s_PWMModuleInfo. + s_PWMInfo [b_PWMCpt]. + b_InterruptEnable == APCI1710_ENABLE) + { + /*****************************/ + /* Read the interrupt status */ + /*****************************/ + + ul_StatusRegister=inl(devpriv->s_BoardInfos. + ui_Address + 16 + (20 * b_PWMCpt) + (64 * b_ModuleCpt)); + + + /***************************/ + /* Test if interrupt occur */ + /***************************/ + + if (ul_StatusRegister & 0x1) + { + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + ul_OldInterruptMask = 0x4000UL << b_PWMCpt; + + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + b_OldModuleMask = 1 << b_ModuleCpt; + + devpriv-> + s_InterruptParameters. + ul_InterruptOccur ++; + + /****************************/ + /* Increment the write FIFO */ + /****************************/ + + devpriv-> + s_InterruptParameters. + ui_Write = (devpriv-> + s_InterruptParameters. + ui_Write + 1) % APCI1710_SAVE_INTERRUPT; + + b_InterruptFlag = 1; + + + /**********************/ + /* Call user function */ + /**********************/ + //Send a signal to from kernel to user space + send_sig(SIGIO,devpriv->tsk_Current,0); + + + } // if (ul_StatusRegister & 0x1) + } // if (APCI1710_ENABLE) + } // for (b_PWMCpt == 0; b_PWMCpt < 0; b_PWMCpt ++) + } // PWM counter + + + + /***********************/ + /* Test if tor counter */ + /***********************/ + + if ((devpriv-> + s_BoardInfos. + dw_MolduleConfiguration [b_ModuleCpt] & 0xFFFF0000UL) == APCI1710_TOR_COUNTER) + { + for (b_TorCounterCpt = 0; b_TorCounterCpt < 2; b_TorCounterCpt ++) + { + /*************************************/ + /* Test if tor interrupt initialised */ + /*************************************/ + + if (devpriv-> + s_ModuleInfo [b_ModuleCpt]. + s_TorCounterModuleInfo. + s_TorCounterInfo [b_TorCounterCpt]. + b_InterruptEnable == APCI1710_ENABLE) + { + /*****************************/ + /* Read the interrupt status */ + /*****************************/ + + + ul_StatusRegister=inl(devpriv->s_BoardInfos. + ui_Address + 12 + (16 * b_TorCounterCpt) + (64 * b_ModuleCpt)); + + /***************************/ + /* Test if interrupt occur */ + /***************************/ + + if (ul_StatusRegister & 0x1) + { + /******************************/ + /* Read the tor counter value */ + /******************************/ + + + ul_LatchRegisterValue=inl(devpriv->s_BoardInfos. + ui_Address + 0 + (16 * b_TorCounterCpt) + (64 * b_ModuleCpt)); + + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + ul_OldInterruptMask = 0x1000UL << b_TorCounterCpt; + + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + b_OldModuleMask = 1 << b_ModuleCpt; + + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + ul_OldCounterLatchValue = ul_LatchRegisterValue; + + devpriv-> + s_InterruptParameters. + ul_InterruptOccur ++; + + + /****************************/ + /* Increment the write FIFO */ + /****************************/ + + devpriv-> + s_InterruptParameters. + ui_Write = (devpriv-> + s_InterruptParameters. + ui_Write + 1) % APCI1710_SAVE_INTERRUPT; + + b_InterruptFlag = 1; + + + /**********************/ + /* Call user function */ + /**********************/ + + //Send a signal to from kernel to user space + send_sig(SIGIO,devpriv->tsk_Current,0); + } // if (ul_StatusRegister & 0x1) + } // if (APCI1710_ENABLE) + } // for (b_TorCounterCpt == 0; b_TorCounterCpt < 0; b_TorCounterCpt ++) + } // Tor counter + + + + + /***********************/ + /* Test if chronometer */ + /***********************/ + + if ((devpriv-> + s_BoardInfos. + dw_MolduleConfiguration [b_ModuleCpt] & 0xFFFF0000UL) == APCI1710_CHRONOMETER) + { + + //printk("APCI1710 Chrono Interrupt\n"); + /*****************************/ + /* Read the interrupt status */ + /*****************************/ + + + ul_InterruptLatchReg=inl(devpriv->s_BoardInfos. + ui_Address + 12 + (64 * b_ModuleCpt)); + + /***************************/ + /* Test if interrupt occur */ + /***************************/ + + if ((ul_InterruptLatchReg & 0x8) == 0x8) + { + /****************************/ + /* Clear the interrupt flag */ + /****************************/ + + + outl(0,devpriv->s_BoardInfos. + ui_Address + 32 + (64 * b_ModuleCpt)); + + /***************************/ + /* Test if continuous mode */ + /***************************/ + + if (ps_ModuleInfo-> + s_ChronoModuleInfo. + b_CycleMode == APCI1710_ENABLE) + { + /********************/ + /* Clear the status */ + /********************/ + + + outl(0,devpriv->s_BoardInfos. + ui_Address + 36 + (64 * b_ModuleCpt)); + } + + /*************************/ + /* Read the timing value */ + /*************************/ + + + ul_LatchRegisterValue=inl(devpriv->s_BoardInfos. + ui_Address + 4 + (64 * b_ModuleCpt)); + + /*****************************/ + /* Test if interrupt enabled */ + /*****************************/ + + if (ps_ModuleInfo-> + s_ChronoModuleInfo. + b_InterruptMask) + { + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + ul_OldInterruptMask = 0x80; + + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + b_OldModuleMask = 1 << b_ModuleCpt; + + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + ul_OldCounterLatchValue = ul_LatchRegisterValue; + + devpriv-> + s_InterruptParameters. + ul_InterruptOccur ++; + + /****************************/ + /* Increment the write FIFO */ + /****************************/ + + devpriv-> + s_InterruptParameters. + ui_Write = (devpriv-> + s_InterruptParameters. + ui_Write + 1) % APCI1710_SAVE_INTERRUPT; + + b_InterruptFlag = 1; + + + + /**********************/ + /* Call user function */ + /**********************/ + //Send a signal to from kernel to user space + send_sig(SIGIO,devpriv->tsk_Current,0); + + } + } + } // Chronometer + + + + /*************************/ + /* Test if pulse encoder */ + /*************************/ + + if ((devpriv-> + s_BoardInfos. + dw_MolduleConfiguration [b_ModuleCpt] & 0xFFFF0000UL) == APCI1710_PULSE_ENCODER) + { + /****************************/ + /* Read the status register */ + /****************************/ + + + ul_StatusRegister=inl(devpriv->s_BoardInfos. + ui_Address + 20 + (64 * b_ModuleCpt)); + + if (ul_StatusRegister & 0xF) + { + for (b_PulseIncoderCpt = 0; b_PulseIncoderCpt < 4; b_PulseIncoderCpt ++) + { + /*************************************/ + /* Test if pulse encoder initialised */ + /*************************************/ + + if ((ps_ModuleInfo-> + s_PulseEncoderModuleInfo. + s_PulseEncoderInfo [b_PulseIncoderCpt]. + b_PulseEncoderInit == 1) && + (((ps_ModuleInfo-> + s_PulseEncoderModuleInfo. + dw_SetRegister >> b_PulseIncoderCpt) & 1) == 1) && + (((ul_StatusRegister >> (b_PulseIncoderCpt)) & 1) == 1)) + { + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + ul_OldInterruptMask = 0x100UL << b_PulseIncoderCpt; + + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + b_OldModuleMask = 1 << b_ModuleCpt; + + devpriv-> + s_InterruptParameters. + s_FIFOInterruptParameters [devpriv-> + s_InterruptParameters. + ui_Write]. + ul_OldCounterLatchValue = ul_LatchRegisterValue; + + devpriv-> + s_InterruptParameters. + ul_InterruptOccur ++; + + /****************************/ + /* 0899/0224 to 1199/0225 */ + /****************************/ + /* Increment the write FIFO */ + /****************************/ + + devpriv-> + s_InterruptParameters. + ui_Write = (devpriv-> + s_InterruptParameters. + ui_Write + 1) % APCI1710_SAVE_INTERRUPT; + + b_InterruptFlag = 1; + + /**********************/ + /* Call user function */ + /**********************/ + //Send a signal to from kernel to user space + send_sig(SIGIO,devpriv->tsk_Current,0); + + + } + } + } + }//pulse encoder + + } + return ; + +} + diff --git a/comedi/drivers/addi-data/hwdrv_APCI1710.h b/comedi/drivers/addi-data/hwdrv_APCI1710.h index 9d0777c4..6d2f9409 100644 --- a/comedi/drivers/addi-data/hwdrv_APCI1710.h +++ b/comedi/drivers/addi-data/hwdrv_APCI1710.h @@ -1,15 +1,37 @@ +/** +@verbatim - - - +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com -#define COMEDI_SUBD_TTLIO 11 /* Digital Input Output But TTL */ -#define COMEDI_SUBD_PWM 12 /* Pulse width Measurement */ -#define COMEDI_SUBD_SSI 13 /* Synchronous serial interface */ -#define COMEDI_SUBD_TOR 14 /* Tor counter */ -#define COMEDI_SUBD_CHRONO 15 /* Chrono meter*/ -#define COMEDI_SUBD_PULSEENCODER 16 /* Pulse Encoder INP CPT*/ -#define COMEDI_SUBD_INCREMENTALCOUNTER 17 /* Incremental Counter */ +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ + + + + +#define COMEDI_SUBD_TTLIO 11 /* Digital Input Output But TTL */ +#define COMEDI_SUBD_PWM 12 /* Pulse width Measurement */ +#define COMEDI_SUBD_SSI 13 /* Synchronous serial interface */ +#define COMEDI_SUBD_TOR 14 /* Tor counter */ +#define COMEDI_SUBD_CHRONO 15 /* Chrono meter*/ +#define COMEDI_SUBD_PULSEENCODER 16 /* Pulse Encoder INP CPT*/ +#define COMEDI_SUBD_INCREMENTALCOUNTER 17 /* Incremental Counter */ #define INT int @@ -51,28 +73,30 @@ //MODULE INFO STRUCTURE - - comedi_lrange range_apci1710_ttl={ 4, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2), - BIP_RANGE(1) - } -}; - - - comedi_lrange range_apci1710_ssi={ 4, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2), - BIP_RANGE(1) - } -}; - -comedi_lrange range_apci1710_inccpt={ 4, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2), - BIP_RANGE(1) - } -}; + + +comedi_lrange range_apci1710_ttl={ 4, { + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2), + BIP_RANGE(1) + } +}; + + + +comedi_lrange range_apci1710_ssi={ 4, { + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2), + BIP_RANGE(1) + } +}; + +comedi_lrange range_apci1710_inccpt={ 4, { + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2), + BIP_RANGE(1) + } +}; diff --git a/comedi/drivers/addi-data/hwdrv_apci035.c b/comedi/drivers/addi-data/hwdrv_apci035.c index 8d08c4f4..d6985372 100644 --- a/comedi/drivers/addi-data/hwdrv_apci035.c +++ b/comedi/drivers/addi-data/hwdrv_apci035.c @@ -1,14 +1,38 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ /* + +-----------------------------------------------------------------------+ | (C) ADDI-DATA GmbH Dieselstraße 3 D-77833 Ottersweier | +-----------------------------------------------------------------------+ | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | +-------------------------------+---------------------------------------+ - | Project : 13Card Linux Driver | Compiler : GCC | - | Module name : hwdrv_apci035.c| Version : 2.96 | + | Project : APCI-035 | Compiler : GCC | + | Module name : hwdrv_apci035.c | Version : 2.96 | +-------------------------------+---------------------------------------+ - | Author : Shitalkumar S Chavan | Date : 10.12.2001 | + | Project manager: Eric Stolz | Date : 02/12/2002 | +-------------------------------+---------------------------------------+ | Description : Hardware Layer Acces For APCI-035 | +-----------------------------------------------------------------------+ @@ -28,215 +52,215 @@ +----------------------------------------------------------------------------+ */ #include "hwdrv_apci035.h" -INT i_WatchdogNbr=0; -INT i_Temp=0; -INT i_Flag=1; -/* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI035_ConfigTimerWatchdog | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Configures The Timer , Counter or Watchdog | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | -| configuration parameters as below | -| | -| data[0] : 0 Configure As Timer | -| 1 Configure As Watchdog | - data[1] : Watchdog number -| data[2] : Time base Unit | -| data[3] : Reload Value | - data[4] : External Trigger | - 1:Enable - 0:Disable - data[5] :External Trigger Level - 00 Trigger Disabled - 01 Trigger Enabled (Low level) - 10 Trigger Enabled (High Level) - 11 Trigger Enabled (High/Low level) - data[6] : External Gate | - 1:Enable - 0:Disable - data[7] : External Gate level - 00 Gate Disabled - 01 Gate Enabled (Low level) - 10 Gate Enabled (High Level) - data[8] :Warning Relay - 1: ENABLE - 0: DISABLE - data[9] :Warning Delay available - data[10] :Warning Relay Time unit - data[11] :Warning Relay Time Reload value - data[12] :Reset Relay - 1 : ENABLE - 0 : DISABLE - data[13] :Interrupt - 1 : ENABLE - 0 : DISABLE - -| -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ -*/ -INT i_APCI035_ConfigTimerWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) -{ -UINT ui_Status=0; -UINT ui_Command=0; -UINT ui_Mode=0; -i_Temp=0; -devpriv->tsk_Current=current; -devpriv->b_TimerSelectMode=data[0]; -i_WatchdogNbr=data[1]; -if(data[0]==0) - { - ui_Mode=2; - } -else - { - ui_Mode=0; - } -//ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); -ui_Command=0; -//ui_Command = ui_Command & 0xFFFFF9FEUL; -outl(ui_Command,devpriv->iobase+((i_WatchdogNbr-1)*32)+12); -ui_Command=0; -ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); -/************************/ -/* Set the reload value */ -/************************/ -outl( data[3],devpriv->iobase+((i_WatchdogNbr-1)*32) + 4); -/*********************/ -/* Set the time unit */ -/*********************/ -outl(data[2],devpriv->iobase+((i_WatchdogNbr-1)*32) + 8); -if (data[0] == ADDIDATA_TIMER) - { - - - /******************************/ - /* Set the mode : */ - /* - Disable the hardware */ - /* - Disable the counter mode */ - /* - Disable the warning */ - /* - Disable the reset */ - /* - Enable the timer mode */ - /* - Set the timer mode */ - /******************************/ - - - ui_Command = (ui_Command & 0xFFF719E2UL) | ui_Mode << 13UL | 0x10UL; - +INT i_WatchdogNbr=0; +INT i_Temp=0; +INT i_Flag=1; +/* ++----------------------------------------------------------------------------+ +| Function Name : int i_APCI035_ConfigTimerWatchdog | +| (comedi_device *dev,comedi_subdevice *s, | +| comedi_insn *insn,lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Configures The Timer , Counter or Watchdog | ++----------------------------------------------------------------------------+ +| Input Parameters : comedi_device *dev : Driver handle | +| UINT *data : Data Pointer contains | +| configuration parameters as below | +| | +| data[0] : 0 Configure As Timer | +| 1 Configure As Watchdog | + data[1] : Watchdog number +| data[2] : Time base Unit | +| data[3] : Reload Value | + data[4] : External Trigger | + 1:Enable + 0:Disable + data[5] :External Trigger Level + 00 Trigger Disabled + 01 Trigger Enabled (Low level) + 10 Trigger Enabled (High Level) + 11 Trigger Enabled (High/Low level) + data[6] : External Gate | + 1:Enable + 0:Disable + data[7] : External Gate level + 00 Gate Disabled + 01 Gate Enabled (Low level) + 10 Gate Enabled (High Level) + data[8] :Warning Relay + 1: ENABLE + 0: DISABLE + data[9] :Warning Delay available + data[10] :Warning Relay Time unit + data[11] :Warning Relay Time Reload value + data[12] :Reset Relay + 1 : ENABLE + 0 : DISABLE + data[13] :Interrupt + 1 : ENABLE + 0 : DISABLE + +| ++----------------------------------------------------------------------------+ +| Output Parameters : -- | ++----------------------------------------------------------------------------+ +| Return Value : TRUE : No error occur | +| : FALSE : Error occur. Return the error | +| | ++----------------------------------------------------------------------------+ +*/ +INT i_APCI035_ConfigTimerWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) +{ +UINT ui_Status=0; +UINT ui_Command=0; +UINT ui_Mode=0; +i_Temp=0; +devpriv->tsk_Current=current; +devpriv->b_TimerSelectMode=data[0]; +i_WatchdogNbr=data[1]; +if(data[0]==0) + { + ui_Mode=2; + } +else + { + ui_Mode=0; + } +//ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); +ui_Command=0; +//ui_Command = ui_Command & 0xFFFFF9FEUL; +outl(ui_Command,devpriv->iobase+((i_WatchdogNbr-1)*32)+12); +ui_Command=0; +ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); +/************************/ +/* Set the reload value */ +/************************/ +outl( data[3],devpriv->iobase+((i_WatchdogNbr-1)*32) + 4); +/*********************/ +/* Set the time unit */ +/*********************/ +outl(data[2],devpriv->iobase+((i_WatchdogNbr-1)*32) + 8); +if (data[0] == ADDIDATA_TIMER) + { + + + /******************************/ + /* Set the mode : */ + /* - Disable the hardware */ + /* - Disable the counter mode */ + /* - Disable the warning */ + /* - Disable the reset */ + /* - Enable the timer mode */ + /* - Set the timer mode */ + /******************************/ + + + ui_Command = (ui_Command & 0xFFF719E2UL) | ui_Mode << 13UL | 0x10UL; + }//if (data[0] == ADDIDATA_TIMER) - else - { - if(data[0]==ADDIDATA_WATCHDOG) - { - - /******************************/ - /* Set the mode : */ - /* - Disable the hardware */ - /* - Disable the counter mode */ - /* - Disable the warning */ - /* - Disable the reset */ - /* - Disable the timer mode */ - /******************************/ - - - ui_Command = ui_Command & 0xFFF819E2UL; - - } - else - { - printk("\n The parameter for Timer/watchdog selection is in error\n"); - return -EINVAL; - } - } -outl(ui_Command,devpriv->iobase+((i_WatchdogNbr-1)*32)+12); -ui_Command=0; -ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); -/********************************/ -/* Disable the hardware trigger */ -/********************************/ -ui_Command = ui_Command & 0xFFFFF89FUL; - if (data[4] == ADDIDATA_ENABLE) - { - /**********************************/ - /* Set the hardware trigger level */ - /**********************************/ - ui_Command = ui_Command | ( data[5] << 5); - } -outl(ui_Command,devpriv->iobase+((i_WatchdogNbr-1)*32)+12); -ui_Command=0; -ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); -/*****************************/ -/* Disable the hardware gate */ -/*****************************/ -ui_Command = ui_Command & 0xFFFFF87FUL; -if (data[6] == ADDIDATA_ENABLE) - { -/*******************************/ -/* Set the hardware gate level */ -/*******************************/ - ui_Command = ui_Command |( data[7] << 7); - } -outl(ui_Command,devpriv->iobase+((i_WatchdogNbr-1)*32)+12); -ui_Command=0; -ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); -/*******************************/ -/* Disable the hardware output */ -/*******************************/ -ui_Command = ui_Command & 0xFFFFF9FBUL; -/*********************************/ -/* Set the hardware output level */ -/*********************************/ -ui_Command = ui_Command |( data[8] << 2); -outl(ui_Command,devpriv->iobase+((i_WatchdogNbr-1)*32)+12); -if(data[9]==ADDIDATA_ENABLE) - { - /************************/ - /* Set the reload value */ - /************************/ - outl (data[11],devpriv->iobase+((i_WatchdogNbr-1)*32) + 24); - /**********************/ - /* Set the time unite */ - /**********************/ - outl(data[10],devpriv->iobase+((i_WatchdogNbr-1)*32)+ 28); - } - - ui_Command=0; - ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); - /*******************************/ - /* Disable the hardware output */ - /*******************************/ - ui_Command = ui_Command & 0xFFFFF9F7UL; - /*********************************/ - /* Set the hardware output level */ - /*********************************/ - ui_Command = ui_Command |( data[12] << 3); - outl(ui_Command,devpriv->iobase+((i_WatchdogNbr-1)*32)+12); - /*************************************/ - /** Enable the watchdog interrupt **/ - /*************************************/ -ui_Command=0; -ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); -/*******************************/ -/* Set the interrupt selection */ -/*******************************/ -ui_Status =inl(devpriv->iobase+((i_WatchdogNbr-1)*32) + 16); - -ui_Command = (ui_Command & 0xFFFFF9FDUL) | ( data[13] << 1); -outl(ui_Command,devpriv->iobase+((i_WatchdogNbr-1)*32)+12); - -return insn->n; -} - + else + { + if(data[0]==ADDIDATA_WATCHDOG) + { + + /******************************/ + /* Set the mode : */ + /* - Disable the hardware */ + /* - Disable the counter mode */ + /* - Disable the warning */ + /* - Disable the reset */ + /* - Disable the timer mode */ + /******************************/ + + + ui_Command = ui_Command & 0xFFF819E2UL; + + } + else + { + printk("\n The parameter for Timer/watchdog selection is in error\n"); + return -EINVAL; + } + } +outl(ui_Command,devpriv->iobase+((i_WatchdogNbr-1)*32)+12); +ui_Command=0; +ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); +/********************************/ +/* Disable the hardware trigger */ +/********************************/ +ui_Command = ui_Command & 0xFFFFF89FUL; + if (data[4] == ADDIDATA_ENABLE) + { + /**********************************/ + /* Set the hardware trigger level */ + /**********************************/ + ui_Command = ui_Command | ( data[5] << 5); + } +outl(ui_Command,devpriv->iobase+((i_WatchdogNbr-1)*32)+12); +ui_Command=0; +ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); +/*****************************/ +/* Disable the hardware gate */ +/*****************************/ +ui_Command = ui_Command & 0xFFFFF87FUL; +if (data[6] == ADDIDATA_ENABLE) + { +/*******************************/ +/* Set the hardware gate level */ +/*******************************/ + ui_Command = ui_Command |( data[7] << 7); + } +outl(ui_Command,devpriv->iobase+((i_WatchdogNbr-1)*32)+12); +ui_Command=0; +ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); +/*******************************/ +/* Disable the hardware output */ +/*******************************/ +ui_Command = ui_Command & 0xFFFFF9FBUL; +/*********************************/ +/* Set the hardware output level */ +/*********************************/ +ui_Command = ui_Command |( data[8] << 2); +outl(ui_Command,devpriv->iobase+((i_WatchdogNbr-1)*32)+12); +if(data[9]==ADDIDATA_ENABLE) + { + /************************/ + /* Set the reload value */ + /************************/ + outl (data[11],devpriv->iobase+((i_WatchdogNbr-1)*32) + 24); + /**********************/ + /* Set the time unite */ + /**********************/ + outl(data[10],devpriv->iobase+((i_WatchdogNbr-1)*32)+ 28); + } + + ui_Command=0; + ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); + /*******************************/ + /* Disable the hardware output */ + /*******************************/ + ui_Command = ui_Command & 0xFFFFF9F7UL; + /*********************************/ + /* Set the hardware output level */ + /*********************************/ + ui_Command = ui_Command |( data[12] << 3); + outl(ui_Command,devpriv->iobase+((i_WatchdogNbr-1)*32)+12); + /*************************************/ + /** Enable the watchdog interrupt **/ + /*************************************/ +ui_Command=0; +ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); +/*******************************/ +/* Set the interrupt selection */ +/*******************************/ +ui_Status =inl(devpriv->iobase+((i_WatchdogNbr-1)*32) + 16); + +ui_Command = (ui_Command & 0xFFFFF9FDUL) | ( data[13] << 1); +outl(ui_Command,devpriv->iobase+((i_WatchdogNbr-1)*32)+12); + +return insn->n; +} + /* +----------------------------------------------------------------------------+ @@ -268,85 +292,87 @@ return insn->n; INT i_APCI035_StartStopWriteTimerWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) { UINT ui_Command = 0; - INT i_Count=0; + INT i_Count=0; if (data[0]==1) { - ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); - /**********************/ - /* Start the hardware */ - /**********************/ - ui_Command = (ui_Command & 0xFFFFF9FFUL) | 0x1UL; - outl(ui_Command,devpriv->iobase+((i_WatchdogNbr-1)*32)+12); + ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); + /**********************/ + /* Start the hardware */ + /**********************/ + ui_Command = (ui_Command & 0xFFFFF9FFUL) | 0x1UL; + outl(ui_Command,devpriv->iobase+((i_WatchdogNbr-1)*32)+12); } // if (data[0]==1) - if(data[0]==2) - { - ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); - /***************************/ - /* Set the trigger command */ - /***************************/ - ui_Command = (ui_Command & 0xFFFFF9FFUL) | 0x200UL; - outl(ui_Command,devpriv->iobase+((i_WatchdogNbr-1)*32)+12); - } - + if(data[0]==2) + { + ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); + /***************************/ + /* Set the trigger command */ + /***************************/ + ui_Command = (ui_Command & 0xFFFFF9FFUL) | 0x200UL; + outl(ui_Command,devpriv->iobase+((i_WatchdogNbr-1)*32)+12); + } + if (data[0]==0) //Stop The Watchdog { //Stop The Watchdog - ui_Command=0; - //ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); - //ui_Command = ui_Command & 0xFFFFF9FEUL; - outl(ui_Command,devpriv->iobase+((i_WatchdogNbr-1)*32)+12); + ui_Command=0; + //ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); + //ui_Command = ui_Command & 0xFFFFF9FEUL; + outl(ui_Command,devpriv->iobase+((i_WatchdogNbr-1)*32)+12); } // if (data[1]==0) if(data[0]==3)//stop all Watchdogs - { - ui_Command=0; - for(i_Count=1;i_Count<=4;i_Count++) + { + ui_Command=0; + for(i_Count=1;i_Count<=4;i_Count++) { - if(devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) - { - ui_Command=0x2UL; - } - else - { + if(devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) + { + ui_Command=0x2UL; + } + else + { ui_Command = 0x10UL; - } - i_WatchdogNbr=i_Count; - outl(ui_Command,devpriv->iobase+((i_WatchdogNbr-1)*32) + 0); + } + i_WatchdogNbr=i_Count; + outl(ui_Command,devpriv->iobase+((i_WatchdogNbr-1)*32) + 0); } - } + + } if(data[0]==4)//start all Watchdogs { - ui_Command = 0; - for(i_Count=1;i_Count<=4;i_Count++) - { - if(devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) - { - ui_Command = 0x1UL; - } - else - { - ui_Command = 0x8UL; - } - i_WatchdogNbr=i_Count; - outl(ui_Command,devpriv->iobase+((i_WatchdogNbr-1)*32) + 0); - } + ui_Command = 0; + for(i_Count=1;i_Count<=4;i_Count++) + { + if(devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) + { + ui_Command = 0x1UL; + } + else + { + ui_Command = 0x8UL; + } + i_WatchdogNbr=i_Count; + outl(ui_Command,devpriv->iobase+((i_WatchdogNbr-1)*32) + 0); + } } if(data[0]==5)//trigger all Watchdogs { - ui_Command =0; - for(i_Count=1;i_Count<=4;i_Count++) - { - if(devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) - { - ui_Command=0x4UL; - } - else - { - ui_Command = 0x20UL; - } - i_WatchdogNbr=i_Count; - outl(ui_Command,devpriv->iobase+((i_WatchdogNbr-1)*32) + 0); - } - i_Temp=1; + ui_Command =0; + for(i_Count=1;i_Count<=4;i_Count++) + { + if(devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) + { + ui_Command=0x4UL; + } + else + { + ui_Command = 0x20UL; + } + + i_WatchdogNbr=i_Count; + outl(ui_Command,devpriv->iobase+((i_WatchdogNbr-1)*32) + 0); + } + i_Temp=1; } return insn->n; } @@ -365,11 +391,13 @@ INT i_APCI035_StartStopWriteTimerWatchdog(comedi_device *dev,comedi_subdevice *s | | | | +----------------------------------------------------------------------------+ -| Output Parameters : data[0] : software trigger status data[1] : hardware trigger status -| data[2] : Software clear status - data[3] : Overflow status data[4] : Timer actual value - - +| Output Parameters : data[0] : software trigger status + data[1] : hardware trigger status +| data[2] : Software clear status + data[3] : Overflow status + data[4] : Timer actual value + + +----------------------------------------------------------------------------+ | Return Value : TRUE : No error occur | | : FALSE : Error occur. Return the error | @@ -379,34 +407,34 @@ INT i_APCI035_StartStopWriteTimerWatchdog(comedi_device *dev,comedi_subdevice *s INT i_APCI035_ReadTimerWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) { UINT ui_Status = 0; // Status register - i_WatchdogNbr=insn->unused[0]; - /******************/ - /* Get the status */ - /******************/ + i_WatchdogNbr=insn->unused[0]; + /******************/ + /* Get the status */ + /******************/ ui_Status =inl(devpriv->iobase+((i_WatchdogNbr-1)*32) + 16); - /***********************************/ - /* Get the software trigger status */ - /***********************************/ - data[0] = ((ui_Status >> 1) & 1); - /***********************************/ - /* Get the hardware trigger status */ - /***********************************/ - data[1] = ((ui_Status >> 2) & 1); - /*********************************/ - /* Get the software clear status */ - /*********************************/ - data[2] = ((ui_Status >> 3) & 1); - /***************************/ - /* Get the overflow status */ - /***************************/ - data[3] = ((ui_Status >> 0) & 1); + /***********************************/ + /* Get the software trigger status */ + /***********************************/ + data[0] = ((ui_Status >> 1) & 1); + /***********************************/ + /* Get the hardware trigger status */ + /***********************************/ + data[1] = ((ui_Status >> 2) & 1); + /*********************************/ + /* Get the software clear status */ + /*********************************/ + data[2] = ((ui_Status >> 3) & 1); + /***************************/ + /* Get the overflow status */ + /***************************/ + data[3] = ((ui_Status >> 0) & 1); if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) { - data[4]=inl(devpriv->iobase+((i_WatchdogNbr-1)*32) + 0); - + data[4]=inl(devpriv->iobase+((i_WatchdogNbr-1)*32) + 0); + } // if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) - - + + return insn->n; } @@ -423,7 +451,7 @@ UINT ui_Status = 0; // Status register | comedi_insn *insn : Insn Structure Pointer | | lsampl_t *data : Data Pointer contains | | configuration parameters as below | -| data[0] : Warning delay value +| data[0] : Warning delay value | | +----------------------------------------------------------------------------+ | Output Parameters : -- | @@ -435,16 +463,16 @@ UINT ui_Status = 0; // Status register */ INT i_APCI035_ConfigAnalogInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) { -devpriv->tsk_Current=current; -outl(0x200 | 0, devpriv->iobase+128 + 0x4); -outl(0, devpriv->iobase+128 + 0); -/********************************/ -/* Initialise the warning value */ -/********************************/ -outl(0x300 | 0, devpriv->iobase+128 + 0x4); -outl((data[0] << 8), devpriv->iobase+128 + 0); -outl(0x200000UL , devpriv->iobase+128 + 12); - +devpriv->tsk_Current=current; +outl(0x200 | 0, devpriv->iobase+128 + 0x4); +outl(0, devpriv->iobase+128 + 0); +/********************************/ +/* Initialise the warning value */ +/********************************/ +outl(0x300 | 0, devpriv->iobase+128 + 0x4); +outl((data[0] << 8), devpriv->iobase+128 + 0); +outl(0x200000UL , devpriv->iobase+128 + 12); + return insn->n; } @@ -470,29 +498,29 @@ return insn->n; +----------------------------------------------------------------------------+ */ INT i_APCI035_ReadAnalogInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) -{ -UINT ui_CommandRegister=0; -/******************/ -/* Set the start */ -/******************/ -ui_CommandRegister =0x80000; - /******************************/ - /* Write the command register */ - /******************************/ -outl(ui_CommandRegister, devpriv->iobase+128 + 8); - -/***************************************/ -/* Read the digital value of the input */ -/***************************************/ -data[0] = inl (devpriv->iobase+ 128 + 28); +{ +UINT ui_CommandRegister=0; +/******************/ +/* Set the start */ +/******************/ +ui_CommandRegister =0x80000; + /******************************/ + /* Write the command register */ + /******************************/ +outl(ui_CommandRegister, devpriv->iobase+128 + 8); + +/***************************************/ +/* Read the digital value of the input */ +/***************************************/ +data[0] = inl (devpriv->iobase+ 128 + 28); return insn->n; } - - - + + + /* +----------------------------------------------------------------------------+ @@ -510,15 +538,15 @@ return insn->n; +----------------------------------------------------------------------------+ */ INT i_APCI035_Reset(comedi_device *dev) -{ -INT i_Count=0; -for(i_Count=1;i_Count<=4;i_Count++) - { - i_WatchdogNbr=i_Count; - outl(0x0,devpriv->iobase+((i_WatchdogNbr-1)*32) + 0);//stop all timers - } -outl(0x0 , devpriv->iobase+128 + 12);//Disable the warning delay - +{ +INT i_Count=0; +for(i_Count=1;i_Count<=4;i_Count++) + { + i_WatchdogNbr=i_Count; + outl(0x0,devpriv->iobase+((i_WatchdogNbr-1)*32) + 0);//stop all timers + } +outl(0x0 , devpriv->iobase+128 + 12);//Disable the warning delay + return 0; } @@ -543,58 +571,58 @@ outl(0x0 , devpriv->iobase+128 + 12);//Disable the warning delay static void v_APCI035_Interrupt(int irq, void *d, struct pt_regs *regs) { comedi_device *dev = d; - UINT ui_StatusRegister1 = 0; - UINT ui_StatusRegister2=0; - UINT ui_ReadCommand =0; - UINT ui_ChannelNumber=0; - UINT ui_DigitalTemperature=0; - if(i_Temp==1) - { - i_WatchdogNbr=i_Flag; - i_Flag=i_Flag+1; - } - /**************************************/ - /* Read the interrupt status register of temperature Warning */ - /**************************************/ - ui_StatusRegister1 = inl(devpriv->iobase+128 + 16); - /**************************************/ - /* Read the interrupt status register for Watchdog/timer */ - /**************************************/ - - ui_StatusRegister2 = inl (devpriv->iobase+((i_WatchdogNbr-1)*32) + 20); - - if ((((ui_StatusRegister1 ) & 0x8) == 0x8))//Test if warning relay interrupt - { - /**********************************/ - /* Disable the temperature warning */ - /**********************************/ - ui_ReadCommand = inl (devpriv->iobase+128 + 12); - ui_ReadCommand = ui_ReadCommand & 0xFFDF0000UL; - outl(ui_ReadCommand , devpriv->iobase+128 + 12); - /***************************/ - /* Read the channel number */ - /***************************/ - ui_ChannelNumber = inl(devpriv->iobase+128 + 60); - /**************************************/ - /* Read the digital temperature value */ - /**************************************/ - ui_DigitalTemperature = inl(devpriv->iobase+128 + 60); - send_sig(SIGIO,devpriv->tsk_Current,0); // send signal to the sample - }//if (((ui_StatusRegister1 & 0x8) == 0x8)) - - else - { - if((ui_StatusRegister2 & 0x1) == 0x1) - { - send_sig(SIGIO,devpriv->tsk_Current,0); // send signal to the sample - } - }//else if (((ui_StatusRegister1 & 0x8) == 0x8)) - - + UINT ui_StatusRegister1 = 0; + UINT ui_StatusRegister2=0; + UINT ui_ReadCommand =0; + UINT ui_ChannelNumber=0; + UINT ui_DigitalTemperature=0; + if(i_Temp==1) + { + i_WatchdogNbr=i_Flag; + i_Flag=i_Flag+1; + } + /**************************************/ + /* Read the interrupt status register of temperature Warning */ + /**************************************/ + ui_StatusRegister1 = inl(devpriv->iobase+128 + 16); + /**************************************/ + /* Read the interrupt status register for Watchdog/timer */ + /**************************************/ + + ui_StatusRegister2 = inl (devpriv->iobase+((i_WatchdogNbr-1)*32) + 20); + + if ((((ui_StatusRegister1 ) & 0x8) == 0x8))//Test if warning relay interrupt + { + /**********************************/ + /* Disable the temperature warning */ + /**********************************/ + ui_ReadCommand = inl (devpriv->iobase+128 + 12); + ui_ReadCommand = ui_ReadCommand & 0xFFDF0000UL; + outl(ui_ReadCommand , devpriv->iobase+128 + 12); + /***************************/ + /* Read the channel number */ + /***************************/ + ui_ChannelNumber = inl(devpriv->iobase+128 + 60); + /**************************************/ + /* Read the digital temperature value */ + /**************************************/ + ui_DigitalTemperature = inl(devpriv->iobase+128 + 60); + send_sig(SIGIO,devpriv->tsk_Current,0); // send signal to the sample + }//if (((ui_StatusRegister1 & 0x8) == 0x8)) + + else + { + if((ui_StatusRegister2 & 0x1) == 0x1) + { + send_sig(SIGIO,devpriv->tsk_Current,0); // send signal to the sample + } + }//else if (((ui_StatusRegister1 & 0x8) == 0x8)) + + return; } - - - + + + diff --git a/comedi/drivers/addi-data/hwdrv_apci035.h b/comedi/drivers/addi-data/hwdrv_apci035.h index 853ad7f9..4b7b90e1 100644 --- a/comedi/drivers/addi-data/hwdrv_apci035.h +++ b/comedi/drivers/addi-data/hwdrv_apci035.h @@ -1,37 +1,60 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ // Card Specific information #define APCI035_BOARD_VENDOR_ID 0x15B8 #define APCI035_ADDRESS_RANGE 255 -INT i_TW_Number; -struct -{ - INT i_Gain ; - INT i_Polarity; - INT i_OffsetRange; - INT i_Coupling; - INT i_SingleDiff; - INT i_AutoCalibration; - UINT ui_ReloadValue; - UINT ui_TimeUnitReloadVal; - INT i_Interrupt; - INT i_ModuleSelection; -}Config_Parameters_Main; - - - -//ANALOG INPUT RANGE -comedi_lrange range_apci035_ai={ 8, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2), - BIP_RANGE(1), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2), - UNI_RANGE(1) - } -}; - +INT i_TW_Number; +struct +{ + INT i_Gain ; + INT i_Polarity; + INT i_OffsetRange; + INT i_Coupling; + INT i_SingleDiff; + INT i_AutoCalibration; + UINT ui_ReloadValue; + UINT ui_TimeUnitReloadVal; + INT i_Interrupt; + INT i_ModuleSelection; +}Config_Parameters_Main; + + + +//ANALOG INPUT RANGE +comedi_lrange range_apci035_ai={ 8, { + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2), + BIP_RANGE(1), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2), + UNI_RANGE(1) + } +}; + // Timer / Watchdog Related Defines #define APCI035_TCW_SYNC_ENABLEDISABLE 0 @@ -44,7 +67,7 @@ comedi_lrange range_apci035_ai={ 8, { #define APCI035_TCW_WARN_TIMEBASE 28 #define ADDIDATA_TIMER 0 -#define ADDIDATA_WATCHDOG 1 +#define ADDIDATA_WATCHDOG 1 #define APCI035_TW1 0 #define APCI035_TW2 32 @@ -64,18 +87,18 @@ comedi_lrange range_apci035_ai={ 8, { #define APCI035_RELOAD_CONV_TIME_VAL 32 #define APCI035_DELAY_TIME_TIME_BASE 44 #define APCI035_RELOAD_DELAY_TIME_VAL 40 -#define ENABLE_EXT_TRIG 1 -#define ENABLE_EXT_GATE 2 -#define ENABLE_EXT_TRIG_GATE 3 - -#define ANALOG_INPUT 0 -#define TEMPERATURE 1 -#define RESISTANCE 2 - -#define ADDIDATA_GREATER_THAN_TEST 0 -#define ADDIDATA_LESS_THAN_TEST 1 - - +#define ENABLE_EXT_TRIG 1 +#define ENABLE_EXT_GATE 2 +#define ENABLE_EXT_TRIG_GATE 3 + +#define ANALOG_INPUT 0 +#define TEMPERATURE 1 +#define RESISTANCE 2 + +#define ADDIDATA_GREATER_THAN_TEST 0 +#define ADDIDATA_LESS_THAN_TEST 1 + + #define APCI035_MAXVOLT 2.5 #define ADDIDATA_UNIPOLAR 1 @@ -99,26 +122,16 @@ comedi_lrange range_apci035_ai={ 8, { INT i_APCI035_ConfigTimerWatchdog (comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); INT i_APCI035_StartStopWriteTimerWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); INT i_APCI035_ReadTimerWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); - - -//Temperature Related Defines (Analog Input Subdevice) - -INT i_APCI035_ConfigAnalogInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); -INT i_APCI035_ReadAnalogInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); - - -//Interrupt -static void v_APCI035_Interrupt(int irq, void *d, struct pt_regs *regs) ; -//Reset functions -INT i_APCI035_Reset(comedi_device *dev); +//Temperature Related Defines (Analog Input Subdevice) - - - - - +INT i_APCI035_ConfigAnalogInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +INT i_APCI035_ReadAnalogInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +//Interrupt +static void v_APCI035_Interrupt(int irq, void *d, struct pt_regs *regs) ; +//Reset functions +INT i_APCI035_Reset(comedi_device *dev); diff --git a/comedi/drivers/addi-data/hwdrv_apci1032.c b/comedi/drivers/addi-data/hwdrv_apci1032.c index cef17cdb..f1de6f3d 100644 --- a/comedi/drivers/addi-data/hwdrv_apci1032.c +++ b/comedi/drivers/addi-data/hwdrv_apci1032.c @@ -1,14 +1,38 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ /* + +-----------------------------------------------------------------------+ | (C) ADDI-DATA GmbH Dieselstraße 3 D-77833 Ottersweier | +-----------------------------------------------------------------------+ | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | +-------------------------------+---------------------------------------+ - | Project : 13Card Linux Driver | Compiler : GCC | - | Module name : hwdrv_apci1032.c| Version : 2.96 | + | Project : APCI-1032 | Compiler : GCC | + | Module name : hwdrv_apci1032.c| Version : 2.96 | +-------------------------------+---------------------------------------+ - | Author : Shitalkumar S Chavan | Date : 31.10.2001 | + | Project manager: Eric Stolz | Date : 02/12/2002 | +-------------------------------+---------------------------------------+ | Description : Hardware Layer Acces For APCI-1032 | +-----------------------------------------------------------------------+ @@ -67,6 +91,7 @@ INT i_APCI1032_ConfigDigitalInput(comedi_device *dev,comedi_subdevice *s,comedi_ ULONG ul_Command1 = 0; ULONG ul_Command2 = 0; devpriv->tsk_Current=current; + /*******************************/ /* Set the digital input logic */ /*******************************/ @@ -85,7 +110,7 @@ INT i_APCI1032_ConfigDigitalInput(comedi_device *dev,comedi_subdevice *s,comedi_ { outl(0x6 ,devpriv->iobase+APCI1032_DIGITAL_IP_IRQ); }//else if(data[1] == ADDIDATA_OR) - }// if( data[0] == ADDIDATA_ENABLE) + }// if( data[0] == ADDIDATA_ENABLE) else { ul_Command1 = ul_Command1 & 0xFFFF0000; @@ -210,11 +235,11 @@ INT i_APCI1032_ReadMoreDigitalInput(comedi_device *dev,comedi_subdevice *s,comed | void *d : void pointer | | struct pt_regs *regs : structure pointer | +----------------------------------------------------------------------------+ -| Output Parameters : -- | +| Output Parameters : -- | +----------------------------------------------------------------------------+ | Return Value : TRUE : No error occur | | : FALSE : Error occur. Return the error | -| | +| | +----------------------------------------------------------------------------+ */ static VOID v_APCI1032_Interrupt(int irq,void* d, struct pt_regs *regs) diff --git a/comedi/drivers/addi-data/hwdrv_apci1032.h b/comedi/drivers/addi-data/hwdrv_apci1032.h index 8e55bf5c..467fe753 100644 --- a/comedi/drivers/addi-data/hwdrv_apci1032.h +++ b/comedi/drivers/addi-data/hwdrv_apci1032.h @@ -1,3 +1,27 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ + /********* Definitions for APCI-1032 card *****/ #define APCI1032_BOARD_VENDOR_ID 0x15B8 @@ -55,5 +79,3 @@ INT i_APCI1032_ReadMoreDigitalInput(comedi_device *dev,comedi_subdevice *s,comed static VOID v_APCI1032_Interrupt(int irq, void *d, struct pt_regs *regs) ; //Reset INT i_APCI1032_Reset(comedi_device *dev); - - \ No newline at end of file diff --git a/comedi/drivers/addi-data/hwdrv_apci1500.c b/comedi/drivers/addi-data/hwdrv_apci1500.c index c4e460a2..5ac61a46 100644 --- a/comedi/drivers/addi-data/hwdrv_apci1500.c +++ b/comedi/drivers/addi-data/hwdrv_apci1500.c @@ -1,14 +1,38 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ /* + +-----------------------------------------------------------------------+ | (C) ADDI-DATA GmbH Dieselstraße 3 D-77833 Ottersweier | +-----------------------------------------------------------------------+ | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | +-------------------------------+---------------------------------------+ - | Project : 13Card Linux Driver | Compiler : GCC | - | Module name : hwdrv_apci1500.c| Version : 2.96 | + | Project : APCI-1500 | Compiler : GCC | + | Module name : hwdrv_apci1500.c| Version : 2.96 | +-------------------------------+---------------------------------------+ - | Author : Karl Andrade | Date : 13.12.2001 | + | Project manager: Eric Stolz | Date : 02/12/2002 | +-------------------------------+---------------------------------------+ | Description : Hardware Layer Acces For APCI-1500 | +-----------------------------------------------------------------------+ @@ -2706,21 +2730,3 @@ outb(APCI1500_RW_CPT_TMR3_CMD_STATUS,devpriv->iobase+APCI1500_Z8536_CONTROL_REGI outb(0x00,devpriv->iobase+APCI1500_Z8536_CONTROL_REGISTER); return 0; } - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/comedi/drivers/addi-data/hwdrv_apci1500.h b/comedi/drivers/addi-data/hwdrv_apci1500.h index 479a0ead..631d0fb5 100644 --- a/comedi/drivers/addi-data/hwdrv_apci1500.h +++ b/comedi/drivers/addi-data/hwdrv_apci1500.h @@ -1,3 +1,27 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ + /********* Definitions for APCI-1500 card *****/ // Card Specific information @@ -123,4 +147,3 @@ static void v_APCI1500_Interrupt(int irq, void *d, struct pt_regs *regs); static int i_APCI1500_ConfigureInterrupt(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); /*----------RESET---------------*/ static int i_APCI1500_Reset(comedi_device *dev) ; - \ No newline at end of file diff --git a/comedi/drivers/addi-data/hwdrv_apci1516.c b/comedi/drivers/addi-data/hwdrv_apci1516.c index 45501fe6..a0ebb57c 100644 --- a/comedi/drivers/addi-data/hwdrv_apci1516.c +++ b/comedi/drivers/addi-data/hwdrv_apci1516.c @@ -1,14 +1,38 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ /* + +-----------------------------------------------------------------------+ | (C) ADDI-DATA GmbH Dieselstraße 3 D-77833 Ottersweier | +-----------------------------------------------------------------------+ | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | +-------------------------------+---------------------------------------+ - | Project : 13Card Linux Driver | Compiler : GCC | - | Module name : hwdrv_apci1516.c| Version : 2.96 | + | Project : APCI-1516 | Compiler : GCC | + | Module name : hwdrv_apci1516.c| Version : 2.96 | +-------------------------------+---------------------------------------+ - | Author : Shitalkumar S Chavan | Date : 31.10.2001 | + | Project manager: Eric Stolz | Date : 02/12/2002 | +-------------------------------+---------------------------------------+ | Description : Hardware Layer Acces For APCI-1516 | +-----------------------------------------------------------------------+ @@ -29,456 +53,469 @@ */ #include "hwdrv_apci1516.h" - -/* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI1516_Read1DigitalInput | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Return the status of the digital input | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| comedi_subdevice *s, :pointer to subdevice structure - comedi_insn *insn :pointer to insn structure | -| lsampl_t *data : Data Pointer to read status | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ -*/ -INT i_APCI1516_Read1DigitalInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) -{ - UINT ui_TmpValue=0; - UINT ui_Channel; - ui_Channel=CR_CHAN(insn->chanspec); - if (ui_Channel >= 0 && ui_Channel <=7) - { - ui_TmpValue=(UINT) inw(devpriv->iobase + APCI1516_DIGITAL_IP); - // since only 1 channel reqd to bring it to last bit it is rotated - // 8 +(chan - 1) times then ANDed with 1 for last bit. - *data = (ui_TmpValue >> ui_Channel)&0x1 ; - }//if(ui_Channel >= 0 && ui_Channel <=7) - else - { - //comedi_error(dev," \n chan spec wrong\n"); - return -EINVAL; // "sorry channel spec wrong " - }//else if(ui_Channel >= 0 && ui_Channel <=7) - - return insn->n; -} - -/* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI1516_ReadMoreDigitalInput | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Return the status of the Requested digital inputs | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| comedi_subdevice *s, :pointer to subdevice structure - comedi_insn *insn :pointer to insn structure | -| lsampl_t *data : Data Pointer to read status | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ -*/ - -INT i_APCI1516_ReadMoreDigitalInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) -{ - - UINT ui_PortValue=data[0]; - UINT ui_Mask=0; - UINT ui_NoOfChannels; - - ui_NoOfChannels=CR_CHAN(insn->chanspec); - - *data=(UINT)inw(devpriv->iobase + APCI1516_DIGITAL_IP ); - switch (ui_NoOfChannels) - { - case 2:ui_Mask=3; - *data=(*data >>(2*ui_PortValue))&ui_Mask; - break; - case 4:ui_Mask=15; - *data=(*data >>(4*ui_PortValue))&ui_Mask; - break; - case 7:break; - - default: - printk("\nWrong parameters\n"); - return -EINVAL; // "sorry channel spec wrong " - break; - }//switch(ui_NoOfChannels) - - - return insn->n; -} - -/* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI1516_ConfigDigitalOutput (comedi_device *dev, - comedi_subdevice *s comedi_insn *insn,lsampl_t *data) | -| | -+----------------------------------------------------------------------------+ -| Task : Configures The Digital Output Subdevice. | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| lsampl_t *data : Data Pointer contains | -| configuration parameters as below | -| comedi_subdevice *s, :pointer to subdevice structure - comedi_insn *insn :pointer to insn structure | -| data[0] :1:Memory on | -| 0:Memory off | -| | -| | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ -*/ -int i_APCI1516_ConfigDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data){ - devpriv->b_OutputMemoryStatus=data[0]; -return insn->n; -} - -/* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI1516_WriteDigitalOutput | -| (comedi_device *dev,comedi_subdevice *s,comedi_insn *insn, - lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Writes port value To the selected port | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| comedi_subdevice *s, :pointer to subdevice structure - comedi_insn *insn :pointer to insn structure | -| lsampl_t *data : Data Pointer to read status | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ -*/ - -INT i_APCI1516_WriteDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) -{ -UINT ui_Temp,ui_Temp1; -UINT ui_NoOfChannel = CR_CHAN(insn->chanspec); // get the channel - if(devpriv->b_OutputMemoryStatus ) - { - ui_Temp=inw(devpriv->iobase+APCI1516_DIGITAL_OP); - - }//if(devpriv->b_OutputMemoryStatus ) - else - { - ui_Temp=0; - }//if(devpriv->b_OutputMemoryStatus ) -if(data[3]==0) - { - if(data[1]==0) - { - data[0]=(data[0] << ui_NoOfChannel)|ui_Temp; - outw(data[0],devpriv->iobase+APCI1516_DIGITAL_OP); - }//if(data[1]==0) - else - { - if(data[1]==1) - { - switch( ui_NoOfChannel) - { - - case 2: data[0]=(data[0] << (2*data[2]))|ui_Temp; - break; - - - case 4:data[0]=(data[0] << (4*data[2]))|ui_Temp; - break; - - case 7:data[0]=data[0]|ui_Temp; - break; - - default: - comedi_error(dev," chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " - - - }//switch(ui_NoOfChannels) - - outw(data[0],devpriv->iobase+APCI1516_DIGITAL_OP); - }// if(data[1]==1) - else - { - printk("\nSpecified channel not supported\n"); - }//else if(data[1]==1) - }//elseif(data[1]==0) - }//if(data[3]==0) -else - { - if(data[3]==1) - { - if(data[1]==0) - { - data[0]=~data[0]&0x1; - ui_Temp1=1; - ui_Temp1=ui_Temp1<iobase+APCI1516_DIGITAL_OP); - }//if(data[1]==0) - else - { - if(data[1]==1) - { - switch( ui_NoOfChannel) - { - - case 2: data[0]=~data[0]&0x3; - ui_Temp1=3; - ui_Temp1=ui_Temp1<<2*data[2]; - ui_Temp=ui_Temp|ui_Temp1; - data[0]=((data[0] << (2*data[2]))^0xff)& ui_Temp; - break; - - - case 4:data[0]=~data[0]&0xf; - ui_Temp1=15; - ui_Temp1=ui_Temp1<<4*data[2]; - ui_Temp=ui_Temp|ui_Temp1; - data[0]=((data[0] << (4*data[2]))^0xff)&ui_Temp; - break; - - case 7: break; - - default: - comedi_error(dev," chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " - - - }//switch(ui_NoOfChannels) - - outw(data[0],devpriv->iobase+APCI1516_DIGITAL_OP); - }// if(data[1]==1) - else - { - printk("\nSpecified channel not supported\n"); - }//else if(data[1]==1) - }//elseif(data[1]==0) - }//if(data[3]==1); - else - { - printk("\nSpecified functionality does not exist\n"); - return -EINVAL; - }//if else data[3]==1) - }//if else data[3]==0) - return (insn->n);; -} - - -/* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI1516_ReadDigitalOutput | -| (comedi_device *dev,comedi_subdevice *s,comedi_insn *insn, - lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Read value of the selected channel or port | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| comedi_subdevice *s, :pointer to subdevice structure - comedi_insn *insn :pointer to insn structure | -| lsampl_t *data : Data Pointer to read status | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ -*/ - -INT i_APCI1516_ReadDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) -{ - -UINT ui_Temp; -UINT ui_NoOfChannel = CR_CHAN(insn->chanspec); // get the channel -ui_Temp=data[0]; -*data=inw(devpriv->iobase+APCI1516_DIGITAL_OP_RW); -if(ui_Temp==0) - { - *data=(*data >> ui_NoOfChannel)&0x1; - }//if(ui_Temp==0) -else - { - if(ui_Temp==1) - { - switch( ui_NoOfChannel) - { - - case 2:*data=(*data >>(2*data[1]))&3; - break; - - - case 4:*data=(*data >>(4*data[1]))&15; - break; - - case 7: break; - - default: - comedi_error(dev," chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " - - - }//switch(ui_NoOfChannels) - }//if(ui_Temp==1) - else - { - printk("\nSpecified channel not supported \n"); - }//elseif(ui_Temp==1) - }//elseif(ui_Temp==0) -return insn->n; -} - -/* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI1516_ConfigWatchdog(comedi_device *dev, - comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) | -| | -+----------------------------------------------------------------------------+ -| Task : Configures The Watchdog | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| comedi_subdevice *s, :pointer to subdevice structure - comedi_insn *insn :pointer to insn structure | -| lsampl_t *data : Data Pointer to read status | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ -*/ - -int i_APCI1516_ConfigWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) -{ -if(data[0]==0) - { - //Disable the watchdog - outw(0x0,devpriv->i_IobaseAddon+ APCI1516_WATCHDOG_ENABLEDISABLE); - //Loading the Reload value - outw(data[1],devpriv->i_IobaseAddon+APCI1516_WATCHDOG_RELOAD_VALUE); - data[1]=data[1]>>16; - outw(data[1],devpriv->i_IobaseAddon+APCI1516_WATCHDOG_RELOAD_VALUE+2); - }//if(data[0]==0) -else - { - printk("\nThe input parameters are wrong\n"); - return -EINVAL; - }//elseif(data[0]==0) - -return insn->n; -} - - /* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI1516_StartStopWriteWatchdog | -| (comedi_device *dev,comedi_subdevice *s, - comedi_insn *insn,lsampl_t *data); | -+----------------------------------------------------------------------------+ -| Task : Start / Stop The Watchdog | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| comedi_subdevice *s, :pointer to subdevice structure - comedi_insn *insn :pointer to insn structure | -| lsampl_t *data : Data Pointer to read status | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ -*/ - -int i_APCI1516_StartStopWriteWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) -{ - switch(data[0]) - { - case 0://stop the watchdog - outw(0x0,devpriv->i_IobaseAddon+ APCI1516_WATCHDOG_ENABLEDISABLE);//disable the watchdog - break; - case 1://start the watchdog - outw(0x0001,devpriv->i_IobaseAddon+ APCI1516_WATCHDOG_ENABLEDISABLE); - break; - case 2://Software trigger - outw(0x0201,devpriv->i_IobaseAddon+ APCI1516_WATCHDOG_ENABLEDISABLE); - break; - default:printk("\nSpecified functionality does not exist\n"); - return -EINVAL; - }// switch(data[0]) -return insn->n; -} -/* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI1516_ReadWatchdog | -| (comedi_device *dev,comedi_subdevice *s,comedi_insn *insn, - lsampl_t *data); | -+----------------------------------------------------------------------------+ -| Task : Read The Watchdog | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| comedi_subdevice *s, :pointer to subdevice structure - comedi_insn *insn :pointer to insn structure | -| lsampl_t *data : Data Pointer to read status | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ -*/ - -int i_APCI1516_ReadWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) - { - data[0]= inw(devpriv->i_IobaseAddon+APCI1516_WATCHDOG_STATUS)&0x1; -return insn->n; -} -/* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI1516_Reset(comedi_device *dev) | | -+----------------------------------------------------------------------------+ -| Task :resets all the registers | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : | -| | -+----------------------------------------------------------------------------+ -*/ - -INT i_APCI1516_Reset(comedi_device *dev) -{ - outw(0x0 ,devpriv->iobase+APCI1516_DIGITAL_OP);//RESETS THE DIGITAL OUTPUTS - outw(0x0,devpriv->i_IobaseAddon+ APCI1516_WATCHDOG_ENABLEDISABLE); - outw(0x0,devpriv->i_IobaseAddon+APCI1516_WATCHDOG_RELOAD_VALUE); - outw(0x0,devpriv->i_IobaseAddon+APCI1516_WATCHDOG_RELOAD_VALUE+2); - return 0; -} - - + +/* ++----------------------------------------------------------------------------+ +| Function Name : int i_APCI1516_Read1DigitalInput | +| (comedi_device *dev,comedi_subdevice *s, | +| comedi_insn *insn,lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Return the status of the digital input | ++----------------------------------------------------------------------------+ +| Input Parameters : comedi_device *dev : Driver handle | +| comedi_subdevice *s, :pointer to subdevice structure + comedi_insn *insn :pointer to insn structure | +| lsampl_t *data : Data Pointer to read status | ++----------------------------------------------------------------------------+ +| Output Parameters : -- | ++----------------------------------------------------------------------------+ +| Return Value : TRUE : No error occur | +| : FALSE : Error occur. Return the error | +| | ++----------------------------------------------------------------------------+ +*/ +INT i_APCI1516_Read1DigitalInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) +{ + UINT ui_TmpValue=0; + UINT ui_Channel; + ui_Channel=CR_CHAN(insn->chanspec); + if (ui_Channel >= 0 && ui_Channel <=7) + { + ui_TmpValue=(UINT) inw(devpriv->iobase + APCI1516_DIGITAL_IP); + // since only 1 channel reqd to bring it to last bit it is rotated + // 8 +(chan - 1) times then ANDed with 1 for last bit. + *data = (ui_TmpValue >> ui_Channel)&0x1 ; + }//if(ui_Channel >= 0 && ui_Channel <=7) + else + { + //comedi_error(dev," \n chan spec wrong\n"); + return -EINVAL; // "sorry channel spec wrong " + }//else if(ui_Channel >= 0 && ui_Channel <=7) + + return insn->n; +} + +/* ++----------------------------------------------------------------------------+ +| Function Name : int i_APCI1516_ReadMoreDigitalInput | +| (comedi_device *dev,comedi_subdevice *s, | +| comedi_insn *insn,lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Return the status of the Requested digital inputs | ++----------------------------------------------------------------------------+ +| Input Parameters : comedi_device *dev : Driver handle | +| comedi_subdevice *s, :pointer to subdevice structure + comedi_insn *insn :pointer to insn structure | +| lsampl_t *data : Data Pointer to read status | ++----------------------------------------------------------------------------+ +| Output Parameters : -- | ++----------------------------------------------------------------------------+ +| Return Value : TRUE : No error occur | +| : FALSE : Error occur. Return the error | +| | ++----------------------------------------------------------------------------+ +*/ + +INT i_APCI1516_ReadMoreDigitalInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) +{ + + UINT ui_PortValue=data[0]; + UINT ui_Mask=0; + UINT ui_NoOfChannels; + + ui_NoOfChannels=CR_CHAN(insn->chanspec); + + *data=(UINT)inw(devpriv->iobase + APCI1516_DIGITAL_IP ); + switch (ui_NoOfChannels) + { + case 2:ui_Mask=3; + *data=(*data >>(2*ui_PortValue))&ui_Mask; + break; + case 4:ui_Mask=15; + *data=(*data >>(4*ui_PortValue))&ui_Mask; + break; + case 7:break; + + default: + printk("\nWrong parameters\n"); + return -EINVAL; // "sorry channel spec wrong " + break; + }//switch(ui_NoOfChannels) + + + return insn->n; +} + +/* ++----------------------------------------------------------------------------+ +| Function Name : int i_APCI1516_ConfigDigitalOutput (comedi_device *dev, + comedi_subdevice *s comedi_insn *insn,lsampl_t *data) | +| | ++----------------------------------------------------------------------------+ +| Task : Configures The Digital Output Subdevice. | ++----------------------------------------------------------------------------+ +| Input Parameters : comedi_device *dev : Driver handle | +| lsampl_t *data : Data Pointer contains | +| configuration parameters as below | +| comedi_subdevice *s, :pointer to subdevice structure + comedi_insn *insn :pointer to insn structure | +| data[0] :1:Memory on | +| 0:Memory off | +| | +| | ++----------------------------------------------------------------------------+ +| Output Parameters : -- | ++----------------------------------------------------------------------------+ +| Return Value : TRUE : No error occur | +| : FALSE : Error occur. Return the error | +| | ++----------------------------------------------------------------------------+ +*/ +int i_APCI1516_ConfigDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data){ + devpriv->b_OutputMemoryStatus=data[0]; +return insn->n; +} + +/* ++----------------------------------------------------------------------------+ +| Function Name : int i_APCI1516_WriteDigitalOutput | +| (comedi_device *dev,comedi_subdevice *s,comedi_insn *insn, + lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Writes port value To the selected port | ++----------------------------------------------------------------------------+ +| Input Parameters : comedi_device *dev : Driver handle | +| comedi_subdevice *s, :pointer to subdevice structure + comedi_insn *insn :pointer to insn structure | +| lsampl_t *data : Data Pointer to read status | ++----------------------------------------------------------------------------+ +| Output Parameters : -- | ++----------------------------------------------------------------------------+ +| Return Value : TRUE : No error occur | +| : FALSE : Error occur. Return the error | +| | ++----------------------------------------------------------------------------+ +*/ + +INT i_APCI1516_WriteDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) +{ +UINT ui_Temp,ui_Temp1; +UINT ui_NoOfChannel = CR_CHAN(insn->chanspec); // get the channel + +printk("EL311003 : @=%x\n",devpriv->iobase+APCI1516_DIGITAL_OP); + + if(devpriv->b_OutputMemoryStatus ) + { + ui_Temp=inw(devpriv->iobase+APCI1516_DIGITAL_OP); + + }//if(devpriv->b_OutputMemoryStatus ) + else + { + ui_Temp=0; + }//if(devpriv->b_OutputMemoryStatus ) +if(data[3]==0) + { + if(data[1]==0) + { + data[0]=(data[0] << ui_NoOfChannel)|ui_Temp; + outw(data[0],devpriv->iobase+APCI1516_DIGITAL_OP); + + printk("EL311003 : d=%d @=%x\n",data[0],devpriv->iobase+APCI1516_DIGITAL_OP); + + }//if(data[1]==0) + else + { + if(data[1]==1) + { + switch( ui_NoOfChannel) + { + + case 2: data[0]=(data[0] << (2*data[2]))|ui_Temp; + break; + + + case 4:data[0]=(data[0] << (4*data[2]))|ui_Temp; + break; + + case 7:data[0]=data[0]|ui_Temp; + break; + + default: + comedi_error(dev," chan spec wrong"); + return -EINVAL; // "sorry channel spec wrong " + + + }//switch(ui_NoOfChannels) + + outw(data[0],devpriv->iobase+APCI1516_DIGITAL_OP); + + printk("EL311003 : d=%d @=%x\n",data[0],devpriv->iobase+APCI1516_DIGITAL_OP); + }// if(data[1]==1) + else + { + printk("\nSpecified channel not supported\n"); + }//else if(data[1]==1) + }//elseif(data[1]==0) + }//if(data[3]==0) +else + { + if(data[3]==1) + { + if(data[1]==0) + { + data[0]=~data[0]&0x1; + ui_Temp1=1; + ui_Temp1=ui_Temp1<iobase+APCI1516_DIGITAL_OP); + + printk("EL311003 : d=%d @=%x\n",data[0],devpriv->iobase+APCI1516_DIGITAL_OP); + + }//if(data[1]==0) + else + { + if(data[1]==1) + { + switch( ui_NoOfChannel) + { + + case 2: data[0]=~data[0]&0x3; + ui_Temp1=3; + ui_Temp1=ui_Temp1<<2*data[2]; + ui_Temp=ui_Temp|ui_Temp1; + data[0]=((data[0] << (2*data[2]))^0xff)& ui_Temp; + break; + + + case 4:data[0]=~data[0]&0xf; + ui_Temp1=15; + ui_Temp1=ui_Temp1<<4*data[2]; + ui_Temp=ui_Temp|ui_Temp1; + data[0]=((data[0] << (4*data[2]))^0xff)&ui_Temp; + break; + + case 7: break; + + default: + comedi_error(dev," chan spec wrong"); + return -EINVAL; // "sorry channel spec wrong " + + + }//switch(ui_NoOfChannels) + + outw(data[0],devpriv->iobase+APCI1516_DIGITAL_OP); + + printk("EL311003 : d=%d @=%x\n",data[0],devpriv->iobase+APCI1516_DIGITAL_OP); + }// if(data[1]==1) + else + { + printk("\nSpecified channel not supported\n"); + }//else if(data[1]==1) + }//elseif(data[1]==0) + }//if(data[3]==1); + else + { + printk("\nSpecified functionality does not exist\n"); + return -EINVAL; + }//if else data[3]==1) + }//if else data[3]==0) + return (insn->n);; +} + + +/* ++----------------------------------------------------------------------------+ +| Function Name : int i_APCI1516_ReadDigitalOutput | +| (comedi_device *dev,comedi_subdevice *s,comedi_insn *insn, + lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Read value of the selected channel or port | ++----------------------------------------------------------------------------+ +| Input Parameters : comedi_device *dev : Driver handle | +| comedi_subdevice *s, :pointer to subdevice structure + comedi_insn *insn :pointer to insn structure | +| lsampl_t *data : Data Pointer to read status | ++----------------------------------------------------------------------------+ +| Output Parameters : -- | ++----------------------------------------------------------------------------+ +| Return Value : TRUE : No error occur | +| : FALSE : Error occur. Return the error | +| | ++----------------------------------------------------------------------------+ +*/ + +INT i_APCI1516_ReadDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) +{ + +UINT ui_Temp; +UINT ui_NoOfChannel = CR_CHAN(insn->chanspec); // get the channel +ui_Temp=data[0]; +*data=inw(devpriv->iobase+APCI1516_DIGITAL_OP_RW); +if(ui_Temp==0) + { + *data=(*data >> ui_NoOfChannel)&0x1; + }//if(ui_Temp==0) +else + { + if(ui_Temp==1) + { + switch( ui_NoOfChannel) + { + + case 2:*data=(*data >>(2*data[1]))&3; + break; + + + case 4:*data=(*data >>(4*data[1]))&15; + break; + + case 7: break; + + default: + comedi_error(dev," chan spec wrong"); + return -EINVAL; // "sorry channel spec wrong " + + + }//switch(ui_NoOfChannels) + }//if(ui_Temp==1) + else + { + printk("\nSpecified channel not supported \n"); + }//elseif(ui_Temp==1) + }//elseif(ui_Temp==0) +return insn->n; +} + +/* ++----------------------------------------------------------------------------+ +| Function Name : int i_APCI1516_ConfigWatchdog(comedi_device *dev, + comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) | +| | ++----------------------------------------------------------------------------+ +| Task : Configures The Watchdog | ++----------------------------------------------------------------------------+ +| Input Parameters : comedi_device *dev : Driver handle | +| comedi_subdevice *s, :pointer to subdevice structure + comedi_insn *insn :pointer to insn structure | +| lsampl_t *data : Data Pointer to read status | ++----------------------------------------------------------------------------+ +| Output Parameters : -- | ++----------------------------------------------------------------------------+ +| Return Value : TRUE : No error occur | +| : FALSE : Error occur. Return the error | +| | ++----------------------------------------------------------------------------+ +*/ + +int i_APCI1516_ConfigWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) +{ +if(data[0]==0) + { + //Disable the watchdog + outw(0x0,devpriv->i_IobaseAddon+ APCI1516_WATCHDOG_ENABLEDISABLE); + //Loading the Reload value + outw(data[1],devpriv->i_IobaseAddon+APCI1516_WATCHDOG_RELOAD_VALUE); + data[1]=data[1]>>16; + outw(data[1],devpriv->i_IobaseAddon+APCI1516_WATCHDOG_RELOAD_VALUE+2); + }//if(data[0]==0) +else + { + printk("\nThe input parameters are wrong\n"); + return -EINVAL; + }//elseif(data[0]==0) + +return insn->n; +} + + /* ++----------------------------------------------------------------------------+ +| Function Name : int i_APCI1516_StartStopWriteWatchdog | +| (comedi_device *dev,comedi_subdevice *s, + comedi_insn *insn,lsampl_t *data); | ++----------------------------------------------------------------------------+ +| Task : Start / Stop The Watchdog | ++----------------------------------------------------------------------------+ +| Input Parameters : comedi_device *dev : Driver handle | +| comedi_subdevice *s, :pointer to subdevice structure + comedi_insn *insn :pointer to insn structure | +| lsampl_t *data : Data Pointer to read status | ++----------------------------------------------------------------------------+ +| Output Parameters : -- | ++----------------------------------------------------------------------------+ +| Return Value : TRUE : No error occur | +| : FALSE : Error occur. Return the error | +| | ++----------------------------------------------------------------------------+ +*/ + +int i_APCI1516_StartStopWriteWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) +{ + switch(data[0]) + { + case 0://stop the watchdog + outw(0x0,devpriv->i_IobaseAddon+ APCI1516_WATCHDOG_ENABLEDISABLE);//disable the watchdog + break; + case 1://start the watchdog + outw(0x0001,devpriv->i_IobaseAddon+ APCI1516_WATCHDOG_ENABLEDISABLE); + break; + case 2://Software trigger + outw(0x0201,devpriv->i_IobaseAddon+ APCI1516_WATCHDOG_ENABLEDISABLE); + break; + default:printk("\nSpecified functionality does not exist\n"); + return -EINVAL; + }// switch(data[0]) +return insn->n; +} +/* ++----------------------------------------------------------------------------+ +| Function Name : int i_APCI1516_ReadWatchdog | +| (comedi_device *dev,comedi_subdevice *s,comedi_insn *insn, + lsampl_t *data); | ++----------------------------------------------------------------------------+ +| Task : Read The Watchdog | ++----------------------------------------------------------------------------+ +| Input Parameters : comedi_device *dev : Driver handle | +| comedi_subdevice *s, :pointer to subdevice structure + comedi_insn *insn :pointer to insn structure | +| lsampl_t *data : Data Pointer to read status | ++----------------------------------------------------------------------------+ +| Output Parameters : -- | ++----------------------------------------------------------------------------+ +| Return Value : TRUE : No error occur | +| : FALSE : Error occur. Return the error | +| | ++----------------------------------------------------------------------------+ +*/ + +int i_APCI1516_ReadWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) + { + data[0]= inw(devpriv->i_IobaseAddon+APCI1516_WATCHDOG_STATUS)&0x1; +return insn->n; +} +/* ++----------------------------------------------------------------------------+ +| Function Name : int i_APCI1516_Reset(comedi_device *dev) | | ++----------------------------------------------------------------------------+ +| Task :resets all the registers | ++----------------------------------------------------------------------------+ +| Input Parameters : comedi_device *dev ++----------------------------------------------------------------------------+ +| Output Parameters : -- | ++----------------------------------------------------------------------------+ +| Return Value : | +| | ++----------------------------------------------------------------------------+ +*/ + +INT i_APCI1516_Reset(comedi_device *dev) +{ + outw(0x0 ,devpriv->iobase+APCI1516_DIGITAL_OP);//RESETS THE DIGITAL OUTPUTS + outw(0x0,devpriv->i_IobaseAddon+ APCI1516_WATCHDOG_ENABLEDISABLE); + outw(0x0,devpriv->i_IobaseAddon+APCI1516_WATCHDOG_RELOAD_VALUE); + outw(0x0,devpriv->i_IobaseAddon+APCI1516_WATCHDOG_RELOAD_VALUE+2); + return 0; +} + + diff --git a/comedi/drivers/addi-data/hwdrv_apci1516.h b/comedi/drivers/addi-data/hwdrv_apci1516.h index 28c6f1f1..e2888605 100644 --- a/comedi/drivers/addi-data/hwdrv_apci1516.h +++ b/comedi/drivers/addi-data/hwdrv_apci1516.h @@ -1,10 +1,34 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ + /********* Definitions for APCI-1516 card *****/ -// Card Specific information -#define APCI1516_BOARD_VENDOR_ID 0x15B8 -#define APCI1516_ADDRESS_RANGE 8 - - +// Card Specific information +#define APCI1516_BOARD_VENDOR_ID 0x15B8 +#define APCI1516_ADDRESS_RANGE 8 + + //DIGITAL INPUT-OUTPUT DEFINE #define APCI1516_DIGITAL_OP 4 @@ -12,7 +36,7 @@ #define APCI1516_DIGITAL_IP 0 - + // TIMER COUNTER WATCHDOG DEFINES @@ -27,25 +51,25 @@ //Digital Input -INT i_APCI1516_ReadMoreDigitalInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +INT i_APCI1516_ReadMoreDigitalInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); INT i_APCI1516_Read1DigitalInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); - -//Digital Output -int i_APCI1516_ConfigDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); -INT i_APCI1516_WriteDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); -INT i_APCI1516_ReadDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) ; + +//Digital Output +int i_APCI1516_ConfigDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +INT i_APCI1516_WriteDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +INT i_APCI1516_ReadDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) ; // TIMER // timer value is passed as u seconds -int i_APCI1516_ConfigWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +int i_APCI1516_ConfigWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); int i_APCI1516_StartStopWriteWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); -int i_APCI1516_ReadWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); - - -//reset -INT i_APCI1516_Reset(comedi_device *dev); - +int i_APCI1516_ReadWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); + + +//reset +INT i_APCI1516_Reset(comedi_device *dev); + diff --git a/comedi/drivers/addi-data/hwdrv_apci1564.c b/comedi/drivers/addi-data/hwdrv_apci1564.c index b4a55f23..28a62e7a 100644 --- a/comedi/drivers/addi-data/hwdrv_apci1564.c +++ b/comedi/drivers/addi-data/hwdrv_apci1564.c @@ -1,14 +1,38 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ /* + +-----------------------------------------------------------------------+ | (C) ADDI-DATA GmbH Dieselstraße 3 D-77833 Ottersweier | +-----------------------------------------------------------------------+ | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | +-------------------------------+---------------------------------------+ - | Project : 13Card Linux Driver | Compiler : GCC | - | Module name : hwdrv_apci1564.c| Version : 2.96 | + | Project : APCI-1564 | Compiler : GCC | + | Module name : hwdrv_apci1564.c| Version : 2.96 | +-------------------------------+---------------------------------------+ - | Author : Shitalkumar S Chavan | Date : 31.10.2001 | + | Project manager: Eric Stolz | Date : 02/12/2002 | +-------------------------------+---------------------------------------+ | Description : Hardware Layer Acces For APCI-1564 | +-----------------------------------------------------------------------+ @@ -27,904 +51,904 @@ | Included files | +----------------------------------------------------------------------------+ */ - -#include -#include "hwdrv_apci1564.h" - -//Global variables -UINT ui_InterruptStatus_1564=0 ; -UINT ui_InterruptData,ui_Type; - -/* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI1564_ConfigDigitalInput | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Configures the digital input Subdevice | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| lsampl_t *data : Data Pointer contains | -| configuration parameters as below | -| | -| data[0] : 1 Enable Digital Input Interrupt | -| 0 Disable Digital Input Interrupt | -| data[1] : 0 ADDIDATA Interrupt OR LOGIC | -| : 1 ADDIDATA Interrupt AND LOGIC | -| data[2] : Interrupt mask for the mode 1 | -| data[3] : Interrupt mask for the mode 2 | -| | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ -*/ -INT i_APCI1564_ConfigDigitalInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) -{ - devpriv->tsk_Current=current; - /*******************************/ - /* Set the digital input logic */ - /*******************************/ - if ( data[0] == ADDIDATA_ENABLE) - { - data[2]=data[2]<<4; - data[3]=data[3]<<4; - outl (data[2] , devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_INTERRUPT_MODE1); - outl (data[3] , devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_INTERRUPT_MODE2); - if (data[1] == ADDIDATA_OR) - { - outl(0x4 ,devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_IRQ); - } // if (data[1] == ADDIDATA_OR) - else - { - outl(0x6 ,devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_IRQ); - } // else if (data[1] == ADDIDATA_OR) - } // if (data[0] == ADDIDATA_ENABLE) - else - { - outl (0x0, devpriv->i_IobaseAmcc +APCI1564_DIGITAL_IP +APCI1564_DIGITAL_IP_INTERRUPT_MODE1); - outl (0x0, devpriv->i_IobaseAmcc +APCI1564_DIGITAL_IP +APCI1564_DIGITAL_IP_INTERRUPT_MODE2); - outl(0x0 ,devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP +APCI1564_DIGITAL_IP_IRQ); - } // else if (data[0] == ADDIDATA_ENABLE) - - return insn->n; -} - -/* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI1564_Read1DigitalInput | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Return the status of the digital input | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| UINT ui_Channel : Channel number to read | -| lsampl_t *data : Data Pointer to read status | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ -*/ -INT i_APCI1564_Read1DigitalInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) -{ - UINT ui_TmpValue=0; - UINT ui_Channel; - - ui_Channel=CR_CHAN(insn->chanspec); - if (ui_Channel >= 0 && ui_Channel <=31) - { - ui_TmpValue=(UINT) inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP ); - // since only 1 channel reqd to bring it to last bit it is rotated - // 8 +(chan - 1) times then ANDed with 1 for last bit. - *data = (ui_TmpValue >> ui_Channel)&0x1 ; - } // if (ui_Channel >= 0 && ui_Channel <=31) - else - { - comedi_error(dev,"Not a valid channel number !!! \n"); - return -EINVAL; // "sorry channel spec wrong " - } //else if (ui_Channel >= 0 && ui_Channel <=31) - return insn->n; -} - -/* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI1564_ReadMoreDigitalInput | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Return the status of the Requested digital inputs | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To be Read | -| UINT *data : Data Pointer to read status | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ -*/ -INT i_APCI1564_ReadMoreDigitalInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) -{ - UINT ui_PortValue=data[0]; - UINT ui_Mask=0; - UINT ui_NoOfChannels; - - ui_NoOfChannels=CR_CHAN(insn->chanspec); - if (data[1]==0) - { - *data=(UINT)inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP ); - switch (ui_NoOfChannels) - { - case 2: ui_Mask=3; - *data=(*data >>(2*ui_PortValue))&ui_Mask; - break; - case 4: ui_Mask=15; - *data=(*data >>(4*ui_PortValue))&ui_Mask; - break; - case 8: ui_Mask=255; - *data=(*data >>(8*ui_PortValue))&ui_Mask; - break; - case 16:ui_Mask=65535; - *data=(*data >>(16*ui_PortValue))&ui_Mask; - break; - case 31:break; - default: - comedi_error(dev,"Not a valid Channel number !!!\n"); - return -EINVAL; // "sorry channel spec wrong " - break; - } // switch (ui_NoOfChannels) - } // if (data[1]==0) - else - { - if (data[1]==1) - { - *data=ui_InterruptStatus_1564; - } // if (data[1]==1) - } // else if (data[1]==0) - return insn->n; -} - -/* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI1564_ConfigDigitalOutput | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Configures The Digital Output Subdevice. | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | -| configuration parameters as below | -| | -| data[1] : 1 Enable VCC Interrupt | -| 0 Disable VCC Interrupt | -| data[2] : 1 Enable CC Interrupt | -| 0 Disable CC Interrupt | -| | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ -*/ -INT i_APCI1564_ConfigDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) -{ - ULONG ul_Command = 0; - - if ((data[0]!=0) && (data[0]!=1)) - { - comedi_error(dev,"Not a valid Data !!! ,Data should be 1 or 0\n"); - return -EINVAL; - } // if ((data[0]!=0) && (data[0]!=1)) - if (data[0]) - { - devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE ; - } // if (data[0]) - else - { - devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE; - } // else if (data[0]) - if (data[1] == ADDIDATA_ENABLE) - { - ul_Command = ul_Command | 0x1; - } // if (data[1] == ADDIDATA_ENABLE) - else - { - ul_Command = ul_Command & 0xFFFFFFFE; - } // else if (data[1] == ADDIDATA_ENABLE) - if (data[2] == ADDIDATA_ENABLE) - { - ul_Command = ul_Command | 0x2; - } // if (data[2] == ADDIDATA_ENABLE) - else - { - ul_Command = ul_Command & 0xFFFFFFFD; - } // else if (data[2] == ADDIDATA_ENABLE) - outl( ul_Command , devpriv->i_IobaseAmcc+APCI1564_DIGITAL_OP+APCI1564_DIGITAL_OP_INTERRUPT); - ui_InterruptData=inl( devpriv->i_IobaseAmcc+APCI1564_DIGITAL_OP+APCI1564_DIGITAL_OP_INTERRUPT); - devpriv->tsk_Current=current; - return insn->n; -} - -/* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI1564_WriteDigitalOutput | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Writes port value To the selected port | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To Write | -| UINT *data : Data Pointer to read status | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ -*/ -INT i_APCI1564_WriteDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) { - UINT ui_Temp,ui_Temp1; - UINT ui_NoOfChannel; - - ui_NoOfChannel=CR_CHAN(insn->chanspec); - if (devpriv->b_OutputMemoryStatus ) - { - ui_Temp=inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_RW); - } // if (devpriv->b_OutputMemoryStatus ) - else - { - ui_Temp=0; - } // else if (devpriv->b_OutputMemoryStatus ) - if (data[3]==0) - { - if (data[1]==0) - { - data[0]=(data[0] << ui_NoOfChannel)|ui_Temp; - outl(data[0],devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_RW); - } // if (data[1]==0) - else - { - if (data[1]==1) - { - switch (ui_NoOfChannel) - { - case 2: data[0]=(data[0] << (2*data[2]))|ui_Temp; - break; - case 4: data[0]=(data[0] << (4*data[2]))|ui_Temp; - break; - case 8: data[0]=(data[0] <<(8*data[2]))|ui_Temp; - break; - case 16: data[0]=(data[0] <<(16*data[2]))|ui_Temp; - break; - case 31: data[0]=data[0]|ui_Temp; - break; - default: comedi_error(dev," chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " - } // switch (ui_NoOfChannels) - outl(data[0],devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_RW); - } // if (data[1]==1) - else - { - printk("\nSpecified channel not supported\n"); - } // else if (data[1]==1) - } // else if (data[1]==0) - }//if(data[3]==0) - else - { - if (data[3]==1) - { - if (data[1]==0) - { - data[0]=~data[0]&0x1; - ui_Temp1=1; - ui_Temp1=ui_Temp1<i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_RW); - } // if (data[1]==0) - else - { - if (data[1]==1) - { - switch (ui_NoOfChannel) - { - case 2: data[0]=~data[0]&0x3; - ui_Temp1=3; - ui_Temp1=ui_Temp1<<2*data[2]; - ui_Temp=ui_Temp|ui_Temp1; - data[0]=((data[0] << (2*data[2]))^0xffffffff)& ui_Temp; - break; - case 4: data[0]=~data[0]&0xf; - ui_Temp1=15; - ui_Temp1=ui_Temp1<<4*data[2]; - ui_Temp=ui_Temp|ui_Temp1; - data[0]=((data[0] << (4*data[2]))^0xffffffff)&ui_Temp; - break; - case 8: data[0]=~data[0]&0xff; - ui_Temp1=255; - ui_Temp1=ui_Temp1<<8*data[2]; - ui_Temp=ui_Temp|ui_Temp1; - data[0]=((data[0] << (8*data[2]))^0xffffffff)&ui_Temp; - break; - case 16: data[0]=~data[0]&0xffff; - ui_Temp1=65535; - ui_Temp1=ui_Temp1<<16*data[2]; - ui_Temp=ui_Temp|ui_Temp1; - data[0]=((data[0] << (16*data[2]))^0xffffffff)&ui_Temp; - break; - case 31: break; - default: comedi_error(dev," chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " - }//switch(ui_NoOfChannels) - outl(data[0],devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_RW); - } // if (data[1]==1) - else - { - printk("\nSpecified channel not supported\n"); - } // else if (data[1]==1) - } // else if (data[1]==0) - } // if (data[3]==1); - else - { - printk("\nSpecified functionality does not exist\n"); - return -EINVAL; - } // else if (data[3]==1) - } // else if (data[3]==0) - return insn->n; -} - -/* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI1564_ReadDigitalOutput | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Read value of the selected channel or port | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To read | -| UINT *data : Data Pointer to read status | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ -*/ -INT i_APCI1564_ReadDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) -{ - UINT ui_Temp; - UINT ui_NoOfChannel; - - ui_NoOfChannel=CR_CHAN(insn->chanspec); - ui_Temp=data[0]; - *data=inl(devpriv->i_IobaseAmcc+APCI1564_DIGITAL_OP+APCI1564_DIGITAL_OP_RW); - if (ui_Temp==0) - { - *data=(*data >> ui_NoOfChannel)&0x1; - } // if (ui_Temp==0) - else - { - if (ui_Temp==1) - { - switch (ui_NoOfChannel) - { - case 2: - *data=(*data >>(2*data[1]))&3; - break; - - case 4: - *data=(*data >>(4*data[1]))&15; - break; - - case 8: - *data=(*data >>(8*data[1]))&255; - break; - - case 16: - *data=(*data >>(16*data[1]))&65535; - break; - - case 31: break; - - default: - comedi_error(dev," chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " - break; - } // switch(ui_NoOfChannels) - } // if (ui_Temp==1) - else - { - printk("\nSpecified channel not supported \n"); - } // else if (ui_Temp==1) - } // else if (ui_Temp==0) - return insn->n; -} - -/* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI1564_ConfigTimerCounterWatchdog | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Configures The Timer , Counter or Watchdog | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | -| configuration parameters as below | -| | -| data[0] : 0 Configure As Timer | -| 1 Configure As Counter | -| 2 Configure As Watchdog | -| data[1] : 1 Enable Interrupt | -| 0 Disable Interrupt | -| data[2] : Time Unit | -| data[3] : Reload Value | -| data[4] : Timer Mode | -| data[5] : Timer Counter Watchdog Number| - data[6] : Counter Direction -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ -*/ -INT i_APCI1564_ConfigTimerCounterWatchdog (comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) -{ - ULONG ul_Command1 = 0; - devpriv->tsk_Current=current; - if (data[0]==ADDIDATA_WATCHDOG) - { - devpriv->b_TimerSelectMode = ADDIDATA_WATCHDOG; - - //Disable the watchdog - outl(0x0,devpriv->i_IobaseAmcc+ APCI1564_DIGITAL_OP_WATCHDOG+ APCI1564_TCW_PROG); - //Loading the Reload value - outl(data[3],devpriv->i_IobaseAmcc+APCI1564_DIGITAL_OP_WATCHDOG+APCI1564_TCW_RELOAD_VALUE); - } // if (data[0]==ADDIDATA_WATCHDOG) - else if (data[0]==ADDIDATA_TIMER) - { - //First Stop The Timer - ul_Command1 =inl(devpriv->i_IobaseAmcc+ APCI1564_TIMER+ APCI1564_TCW_PROG); - ul_Command1 =ul_Command1 & 0xFFFFF9FEUL; - outl(ul_Command1,devpriv->i_IobaseAmcc+ APCI1564_TIMER+ APCI1564_TCW_PROG);//Stop The Timer - - devpriv->b_TimerSelectMode =ADDIDATA_TIMER; - if (data[1]==1) - { - outl(0x02,devpriv->i_IobaseAmcc+ APCI1564_TIMER+ APCI1564_TCW_PROG);//Enable TIMER int & DISABLE ALL THE OTHER int SOURCES - outl(0x0,devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_IRQ); - outl(0x0,devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_IRQ); - outl(0x0,devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG + APCI1564_TCW_IRQ); - outl(0x0,devpriv->iobase+APCI1564_COUNTER1 + APCI1564_TCW_IRQ); - outl(0x0,devpriv->iobase+APCI1564_COUNTER2 + APCI1564_TCW_IRQ); - outl(0x0,devpriv->iobase+APCI1564_COUNTER3 + APCI1564_TCW_IRQ); - outl(0x0,devpriv->iobase+APCI1564_COUNTER4 + APCI1564_TCW_IRQ); - } // if (data[1]==1) - else - { - outl(0x0,devpriv->i_IobaseAmcc+ APCI1564_TIMER+ APCI1564_TCW_PROG);//disable Timer interrupt - } // else if (data[1]==1) - - // Loading Timebase - - outl(data[2],devpriv->i_IobaseAmcc+APCI1564_TIMER+APCI1564_TCW_TIMEBASE); - - //Loading the Reload value - outl(data[3],devpriv->i_IobaseAmcc+APCI1564_TIMER+APCI1564_TCW_RELOAD_VALUE); - - ul_Command1 =inl(devpriv->i_IobaseAmcc+ APCI1564_TIMER+ APCI1564_TCW_PROG); - ul_Command1 = (ul_Command1 & 0xFFF719E2UL) | 2UL << 13UL | 0x10UL; - outl(ul_Command1,devpriv->i_IobaseAmcc+ APCI1564_TIMER+ APCI1564_TCW_PROG);//mode 2 - } // else if (data[0]==ADDIDATA_TIMER) - else if (data[0]==ADDIDATA_COUNTER) - { - devpriv->b_TimerSelectMode =ADDIDATA_COUNTER; - devpriv->b_ModeSelectRegister=data[5]; - - //First Stop The Counter - ul_Command1 =inl(devpriv->iobase+((data[5]-1)*0x20)+APCI1564_TCW_PROG); - ul_Command1 =ul_Command1 & 0xFFFFF9FEUL; - outl(ul_Command1,devpriv->iobase+((data[5]-1)*0x20)+APCI1564_TCW_PROG);//Stop The Timer - - /************************/ - /* Set the reload value */ - /************************/ - outl(data[3] , devpriv->iobase+((data[5]-1)*0x20)+APCI1564_TCW_RELOAD_VALUE); - - /******************************/ - /* Set the mode : */ - /* - Disable the hardware */ - /* - Disable the counter mode */ - /* - Disable the warning */ - /* - Disable the reset */ - /* - Disable the timer mode */ - /* - Enable the counter mode */ - /******************************/ - ul_Command1 = (ul_Command1 & 0xFFFC19E2UL) | 0x80000UL | (ULONG) ((ULONG) data[4] << 16UL); - outl(ul_Command1 , devpriv->iobase+((data[5]-1)*0x20)+APCI1564_TCW_PROG); - - // Enable or Disable Interrupt - ul_Command1= (ul_Command1 & 0xFFFFF9FD) | (data[1] << 1); - outl(ul_Command1 , devpriv->iobase+((data[5]-1)*0x20)+APCI1564_TCW_PROG); - - /*****************************/ - /* Set the Up/Down selection */ - /*****************************/ - ul_Command1 = (ul_Command1 & 0xFFFBF9FFUL) | (data[6] << 18); - outl(ul_Command1 , devpriv->iobase+((data[5]-1)*0x20)+APCI1564_TCW_PROG); - } // else if (data[0]==ADDIDATA_COUNTER) - else - { - printk(" Invalid subdevice."); - } // else if (data[0]==ADDIDATA_WATCHDOG) - - return insn->n; -} - -/* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI1564_StartStopWriteTimerCounterWatchdog | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Start / Stop The Selected Timer , Counter or Watchdog | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | -| configuration parameters as below | -| | -| data[0] : 0 Timer | -| 1 Counter | -| 2 Watchdog | | data[1] : 1 Start | -| 0 Stop | -| 2 Trigger | -| Clear (Only Counter) | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ -*/ -INT i_APCI1564_StartStopWriteTimerCounterWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) -{ - ULONG ul_Command1 = 0; - if (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) - { - switch (data[1]) - { - case 0: //stop the watchdog - outl(0x0,devpriv->i_IobaseAmcc+ APCI1564_DIGITAL_OP_WATCHDOG+ APCI1564_TCW_PROG );//disable the watchdog - break; - case 1: //start the watchdog - outl(0x0001,devpriv->i_IobaseAmcc+ APCI1564_DIGITAL_OP_WATCHDOG+ APCI1564_TCW_PROG); - break; - case 2: //Software trigger - outl(0x0201,devpriv->i_IobaseAmcc+ APCI1564_DIGITAL_OP_WATCHDOG+ APCI1564_TCW_PROG); - break; - default: printk("\nSpecified functionality does not exist\n"); - return -EINVAL; - } // switch (data[1]) - } // if (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) - if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) - { - if (data[1]==1) - { - ul_Command1=inl(devpriv->i_IobaseAmcc+ APCI1564_TIMER+ APCI1564_TCW_PROG); - ul_Command1=(ul_Command1& 0xFFFFF9FFUL) | 0x1UL; - - //Enable the Timer - outl(ul_Command1,devpriv->i_IobaseAmcc+ APCI1564_TIMER+ APCI1564_TCW_PROG); - } // if (data[1]==1) - else if(data[1]==0) - { - //Stop The Timer - - ul_Command1=inl(devpriv->i_IobaseAmcc+ APCI1564_TIMER+ APCI1564_TCW_PROG); - ul_Command1 =ul_Command1 & 0xFFFFF9FEUL; - outl(ul_Command1,devpriv->i_IobaseAmcc+ APCI1564_TIMER+ APCI1564_TCW_PROG); - } // else if(data[1]==0) - } // if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) - if (devpriv->b_TimerSelectMode==ADDIDATA_COUNTER) - { - ul_Command1=inl(devpriv->iobase+((devpriv->b_ModeSelectRegister-1)*0x20)+APCI1564_TCW_PROG); - if (data[1] == 1) - { - //Start the Counter subdevice - ul_Command1= (ul_Command1 & 0xFFFFF9FFUL) | 0x1UL; - } // if (data[1] == 1) - else if (data[1] == 0) - { - // Stops the Counter subdevice - ul_Command1 = 0; - - } // else if (data[1] == 0) - else if (data[1] == 2) - { - // Clears the Counter subdevice - ul_Command1= (ul_Command1 & 0xFFFFF9FFUL)|0x400; - } // else if (data[1] == 3) - outl(ul_Command1 , devpriv->iobase+((devpriv->b_ModeSelectRegister-1)*0x20)+APCI1564_TCW_PROG); - } // if (devpriv->b_TimerSelectMode==ADDIDATA_COUNTER) - return insn->n; -} - -/* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI1564_ReadTimerCounterWatchdog | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Read The Selected Timer , Counter or Watchdog | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | -| configuration parameters as below | -| | - -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ -*/ -INT i_APCI1564_ReadTimerCounterWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) -{ - ULONG ul_Command1 = 0; - - if (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) - { - // Stores the status of the Watchdog - data[0]= inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG + APCI1564_TCW_TRIG_STATUS)&0x1; - data[1]= inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG); - } // if (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) - else if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) - { - // Stores the status of the Timer - data[0]= inl(devpriv->i_IobaseAmcc+APCI1564_TIMER+APCI1564_TCW_TRIG_STATUS)&0x1; - - // Stores the Actual value of the Timer - data[1]= inl(devpriv->i_IobaseAmcc + APCI1564_TIMER); - } // else if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) - else if (devpriv->b_TimerSelectMode==ADDIDATA_COUNTER) - { - // Read the Counter Actual Value. - data[0] = inl(devpriv->iobase+((devpriv->b_ModeSelectRegister-1)*0x20)+APCI1564_TCW_SYNC_ENABLEDISABLE); - ul_Command1 = inl(devpriv->iobase+((devpriv->b_ModeSelectRegister-1)*0x20)+APCI1564_TCW_TRIG_STATUS); - - /***********************************/ - /* Get the software trigger status */ - /***********************************/ - data[1]= (BYTE) ((ul_Command1 >> 1) & 1); - - /***********************************/ - /* Get the hardware trigger status */ - /***********************************/ - data[2]= (BYTE) ((ul_Command1 >> 2) & 1); - - /*********************************/ - /* Get the software clear status */ - /*********************************/ - data[3]= (BYTE) ((ul_Command1 >> 3) & 1); - - /***************************/ - /* Get the overflow status */ - /***************************/ - data[4]= (BYTE) ((ul_Command1 >> 0) & 1); - } // else if (devpriv->b_TimerSelectMode==ADDIDATA_COUNTER) - else if ((devpriv->b_TimerSelectMode!=ADDIDATA_TIMER) && (devpriv->b_TimerSelectMode!=ADDIDATA_WATCHDOG)&& (devpriv->b_TimerSelectMode!=ADDIDATA_COUNTER)) - { - printk ("\n Invalid Subdevice !!!\n"); - } // else if ((devpriv->b_TimerSelectMode!=ADDIDATA_TIMER) && (devpriv->b_TimerSelectMode!=ADDIDATA_WATCHDOG)&& (devpriv->b_TimerSelectMode!=ADDIDATA_COUNTER)) - return insn->n; -} - -/* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI1564_ReadInterruptStatus | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task :Reads the interrupt status register | -+----------------------------------------------------------------------------+ -| Input Parameters : | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : | -| | -+----------------------------------------------------------------------------+ -*/ - -int i_APCI1564_ReadInterruptStatus(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) -{ - *data=ui_Type; - return insn->n; -} - -/* -+----------------------------------------------------------------------------+ -| Function Name : static void v_APCI1564_Interrupt | -| (int irq , void *d, struct pt_regs *regs) | -+----------------------------------------------------------------------------+ -| Task : Interrupt handler for the interruptible digital inputs | -+----------------------------------------------------------------------------+ -| Input Parameters : int irq : irq number | -| void *d : void pointer | -| struct pt_regs *regs : structure pointer | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ -*/ -static VOID v_APCI1564_Interrupt(int irq,void* d, struct pt_regs *regs) -{ - comedi_device *dev =d; - UINT ui_DO, ui_DI; - UINT ui_Timer; - UINT ui_C1, ui_C2, ui_C3, ui_C4; - ULONG ul_Command2=0; - ui_DI = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_IRQ) & 0x01; - ui_DO = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_IRQ) & 0x01; - ui_Timer = inl(devpriv->i_IobaseAmcc + APCI1564_TIMER+ APCI1564_TCW_IRQ) & 0x01; - ui_C1=inl(devpriv->iobase + APCI1564_COUNTER1 + APCI1564_TCW_IRQ ) & 0x1; - ui_C2=inl(devpriv->iobase + APCI1564_COUNTER2 + APCI1564_TCW_IRQ ) & 0x1; - ui_C3=inl(devpriv->iobase + APCI1564_COUNTER3 + APCI1564_TCW_IRQ ) & 0x1; - ui_C4=inl(devpriv->iobase + APCI1564_COUNTER4 + APCI1564_TCW_IRQ ) & 0x1; - if(ui_DI==0 && ui_DO==0 && ui_Timer==0 && ui_C1==0 && ui_C2==0 && ui_C3==0 && ui_C4==0) - { - printk("\nInterrupt from unknown source\n"); - }// if(ui_DI==0 && ui_DO==0 && ui_Timer==0 && ui_C1==0 && ui_C2==0 && ui_C3==0 && ui_C4==0) - - if (ui_DI == 1) - { - ui_DI = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_IRQ); - outl(0x0 ,devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_IRQ); - ui_InterruptStatus_1564=inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_INTERRUPT_STATUS); - ui_InterruptStatus_1564=ui_InterruptStatus_1564 & 0X000FFFF0; - send_sig(SIGIO,devpriv->tsk_Current,0); // send signal to the sample - outl(ui_DI ,devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_IRQ);//enable the interrupt - return; - } - - if (ui_DO == 1) - { - // Check for Digital Output interrupt Type - 1: Vcc interrupt 2: CC interrupt. - ui_Type=inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_INTERRUPT_STATUS) & 0x3; - //Disable the Interrupt - outl(0x0,devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_INTERRUPT); - - //Sends signal to user space - send_sig(SIGIO,devpriv->tsk_Current,0); - - } // if (ui_DO) - - if ((ui_Timer == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_TIMER)) - { - // Disable Timer Interrupt - ul_Command2=inl(devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); - outl(0x0 , devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); - - //Send a signal to from kernel to user space - send_sig(SIGIO,devpriv->tsk_Current,0); - - // Enable Timer Interrupt - - outl(ul_Command2 , devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); - } // if ((ui_Timer == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_TIMER)) - - - if ((ui_C1 == 1) && (devpriv->b_TimerSelectMode = ADDIDATA_COUNTER)) - { - // Disable Counter Interrupt - ul_Command2=inl(devpriv->iobase + APCI1564_COUNTER1 + APCI1564_TCW_PROG); - outl(0x0 , devpriv->iobase + APCI1564_COUNTER1 + APCI1564_TCW_PROG); - - //Send a signal to from kernel to user space - send_sig(SIGIO,devpriv->tsk_Current,0); - - // Enable Counter Interrupt - outl(ul_Command2 , devpriv->iobase + APCI1564_COUNTER1 + APCI1564_TCW_PROG); - } // if ((ui_C1 == 1) && (devpriv->b_TimerSelectMode = ADDIDATA_COUNTER)) - - if ((ui_C2 == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_COUNTER)) - { - // Disable Counter Interrupt - ul_Command2=inl(devpriv->iobase + APCI1564_COUNTER2 + APCI1564_TCW_PROG); - outl(0x0 , devpriv->iobase + APCI1564_COUNTER2 + APCI1564_TCW_PROG); - - //Send a signal to from kernel to user space - send_sig(SIGIO,devpriv->tsk_Current,0); - - // Enable Counter Interrupt - outl(ul_Command2 , devpriv->iobase + APCI1564_COUNTER2 + APCI1564_TCW_PROG); - } // if ((ui_C2 == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_COUNTER)) - - if ((ui_C3 == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_COUNTER)) - { - // Disable Counter Interrupt - ul_Command2=inl(devpriv->iobase + APCI1564_COUNTER3 + APCI1564_TCW_PROG); - outl(0x0 , devpriv->iobase + APCI1564_COUNTER3 + APCI1564_TCW_PROG); - - //Send a signal to from kernel to user space - send_sig(SIGIO,devpriv->tsk_Current,0); - - // Enable Counter Interrupt - outl(ul_Command2 , devpriv->iobase + APCI1564_COUNTER3 + APCI1564_TCW_PROG); - } // if ((ui_C3 == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_COUNTER)) - - if ((ui_C4 == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_COUNTER)) - { - // Disable Counter Interrupt - ul_Command2=inl(devpriv->iobase + APCI1564_COUNTER4 + APCI1564_TCW_PROG); - outl(0x0 , devpriv->iobase + APCI1564_COUNTER4 + APCI1564_TCW_PROG); - - //Send a signal to from kernel to user space - send_sig(SIGIO,devpriv->tsk_Current,0); - - // Enable Counter Interrupt - outl(ul_Command2 , devpriv->iobase + APCI1564_COUNTER4 + APCI1564_TCW_PROG); - } // if ((ui_C4 == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_COUNTER)) - return; -} - -/* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI1564_Reset(comedi_device *dev) | | -+----------------------------------------------------------------------------+ -| Task :resets all the registers | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : | -| | -+----------------------------------------------------------------------------+ -*/ - -INT i_APCI1564_Reset(comedi_device *dev) -{ - outl(0x0 ,devpriv->i_IobaseAmcc+APCI1564_DIGITAL_IP_IRQ);//disable the interrupts - inl(devpriv->i_IobaseAmcc+APCI1564_DIGITAL_IP_INTERRUPT_STATUS);//Reset the interrupt status register - outl (0x0 , devpriv->i_IobaseAmcc+APCI1564_DIGITAL_IP_INTERRUPT_MODE1);//Disable the and/or interrupt - outl (0x0 , devpriv->i_IobaseAmcc+APCI1564_DIGITAL_IP_INTERRUPT_MODE2); - devpriv->b_DigitalOutputRegister=0; - ui_Type=0; - outl(0x0,devpriv->i_IobaseAmcc+APCI1564_DIGITAL_OP);//Resets the output channels - outl(0x0,devpriv->i_IobaseAmcc+APCI1564_DIGITAL_OP_INTERRUPT);//Disables the interrupt. - outl(0x0,devpriv->i_IobaseAmcc+APCI1564_DIGITAL_OP_WATCHDOG+APCI1564_TCW_RELOAD_VALUE); - outl(0x0,devpriv->i_IobaseAmcc+APCI1564_TIMER); - outl(0x0 , devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); - - outl(0x0 , devpriv->iobase + APCI1564_COUNTER1 + APCI1564_TCW_PROG); - outl(0x0 , devpriv->iobase + APCI1564_COUNTER2 + APCI1564_TCW_PROG); - outl(0x0 , devpriv->iobase + APCI1564_COUNTER3 + APCI1564_TCW_PROG); - outl(0x0 , devpriv->iobase + APCI1564_COUNTER4 + APCI1564_TCW_PROG); - return 0; -} + +#include +#include "hwdrv_apci1564.h" + +//Global variables +UINT ui_InterruptStatus_1564=0 ; +UINT ui_InterruptData,ui_Type; + +/* ++----------------------------------------------------------------------------+ +| Function Name : int i_APCI1564_ConfigDigitalInput | +| (comedi_device *dev,comedi_subdevice *s, | +| comedi_insn *insn,lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Configures the digital input Subdevice | ++----------------------------------------------------------------------------+ +| Input Parameters : comedi_device *dev : Driver handle | +| lsampl_t *data : Data Pointer contains | +| configuration parameters as below | +| | +| data[0] : 1 Enable Digital Input Interrupt | +| 0 Disable Digital Input Interrupt | +| data[1] : 0 ADDIDATA Interrupt OR LOGIC | +| : 1 ADDIDATA Interrupt AND LOGIC | +| data[2] : Interrupt mask for the mode 1 | +| data[3] : Interrupt mask for the mode 2 | +| | ++----------------------------------------------------------------------------+ +| Output Parameters : -- | ++----------------------------------------------------------------------------+ +| Return Value : TRUE : No error occur | +| : FALSE : Error occur. Return the error | +| | ++----------------------------------------------------------------------------+ +*/ +INT i_APCI1564_ConfigDigitalInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) +{ + devpriv->tsk_Current=current; + /*******************************/ + /* Set the digital input logic */ + /*******************************/ + if ( data[0] == ADDIDATA_ENABLE) + { + data[2]=data[2]<<4; + data[3]=data[3]<<4; + outl (data[2] , devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_INTERRUPT_MODE1); + outl (data[3] , devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_INTERRUPT_MODE2); + if (data[1] == ADDIDATA_OR) + { + outl(0x4 ,devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_IRQ); + } // if (data[1] == ADDIDATA_OR) + else + { + outl(0x6 ,devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_IRQ); + } // else if (data[1] == ADDIDATA_OR) + } // if (data[0] == ADDIDATA_ENABLE) + else + { + outl (0x0, devpriv->i_IobaseAmcc +APCI1564_DIGITAL_IP +APCI1564_DIGITAL_IP_INTERRUPT_MODE1); + outl (0x0, devpriv->i_IobaseAmcc +APCI1564_DIGITAL_IP +APCI1564_DIGITAL_IP_INTERRUPT_MODE2); + outl(0x0 ,devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP +APCI1564_DIGITAL_IP_IRQ); + } // else if (data[0] == ADDIDATA_ENABLE) + + return insn->n; +} + +/* ++----------------------------------------------------------------------------+ +| Function Name : int i_APCI1564_Read1DigitalInput | +| (comedi_device *dev,comedi_subdevice *s, | +| comedi_insn *insn,lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Return the status of the digital input | ++----------------------------------------------------------------------------+ +| Input Parameters : comedi_device *dev : Driver handle | +| UINT ui_Channel : Channel number to read | +| lsampl_t *data : Data Pointer to read status | ++----------------------------------------------------------------------------+ +| Output Parameters : -- | ++----------------------------------------------------------------------------+ +| Return Value : TRUE : No error occur | +| : FALSE : Error occur. Return the error | +| | ++----------------------------------------------------------------------------+ +*/ +INT i_APCI1564_Read1DigitalInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) +{ + UINT ui_TmpValue=0; + UINT ui_Channel; + + ui_Channel=CR_CHAN(insn->chanspec); + if (ui_Channel >= 0 && ui_Channel <=31) + { + ui_TmpValue=(UINT) inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP ); + // since only 1 channel reqd to bring it to last bit it is rotated + // 8 +(chan - 1) times then ANDed with 1 for last bit. + *data = (ui_TmpValue >> ui_Channel)&0x1 ; + } // if (ui_Channel >= 0 && ui_Channel <=31) + else + { + comedi_error(dev,"Not a valid channel number !!! \n"); + return -EINVAL; // "sorry channel spec wrong " + } //else if (ui_Channel >= 0 && ui_Channel <=31) + return insn->n; +} + +/* ++----------------------------------------------------------------------------+ +| Function Name : int i_APCI1564_ReadMoreDigitalInput | +| (comedi_device *dev,comedi_subdevice *s, | +| comedi_insn *insn,lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Return the status of the Requested digital inputs | ++----------------------------------------------------------------------------+ +| Input Parameters : comedi_device *dev : Driver handle | +| UINT ui_NoOfChannels : No Of Channels To be Read | +| UINT *data : Data Pointer to read status | ++----------------------------------------------------------------------------+ +| Output Parameters : -- | ++----------------------------------------------------------------------------+ +| Return Value : TRUE : No error occur | +| : FALSE : Error occur. Return the error | +| | ++----------------------------------------------------------------------------+ +*/ +INT i_APCI1564_ReadMoreDigitalInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) +{ + UINT ui_PortValue=data[0]; + UINT ui_Mask=0; + UINT ui_NoOfChannels; + + ui_NoOfChannels=CR_CHAN(insn->chanspec); + if (data[1]==0) + { + *data=(UINT)inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP ); + switch (ui_NoOfChannels) + { + case 2: ui_Mask=3; + *data=(*data >>(2*ui_PortValue))&ui_Mask; + break; + case 4: ui_Mask=15; + *data=(*data >>(4*ui_PortValue))&ui_Mask; + break; + case 8: ui_Mask=255; + *data=(*data >>(8*ui_PortValue))&ui_Mask; + break; + case 16:ui_Mask=65535; + *data=(*data >>(16*ui_PortValue))&ui_Mask; + break; + case 31:break; + default: + comedi_error(dev,"Not a valid Channel number !!!\n"); + return -EINVAL; // "sorry channel spec wrong " + break; + } // switch (ui_NoOfChannels) + } // if (data[1]==0) + else + { + if (data[1]==1) + { + *data=ui_InterruptStatus_1564; + } // if (data[1]==1) + } // else if (data[1]==0) + return insn->n; +} + +/* ++----------------------------------------------------------------------------+ +| Function Name : int i_APCI1564_ConfigDigitalOutput | +| (comedi_device *dev,comedi_subdevice *s, | +| comedi_insn *insn,lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Configures The Digital Output Subdevice. | ++----------------------------------------------------------------------------+ +| Input Parameters : comedi_device *dev : Driver handle | +| UINT *data : Data Pointer contains | +| configuration parameters as below | +| | +| data[1] : 1 Enable VCC Interrupt | +| 0 Disable VCC Interrupt | +| data[2] : 1 Enable CC Interrupt | +| 0 Disable CC Interrupt | +| | ++----------------------------------------------------------------------------+ +| Output Parameters : -- | ++----------------------------------------------------------------------------+ +| Return Value : TRUE : No error occur | +| : FALSE : Error occur. Return the error | +| | ++----------------------------------------------------------------------------+ +*/ +INT i_APCI1564_ConfigDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) +{ + ULONG ul_Command = 0; + + if ((data[0]!=0) && (data[0]!=1)) + { + comedi_error(dev,"Not a valid Data !!! ,Data should be 1 or 0\n"); + return -EINVAL; + } // if ((data[0]!=0) && (data[0]!=1)) + if (data[0]) + { + devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE ; + } // if (data[0]) + else + { + devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE; + } // else if (data[0]) + if (data[1] == ADDIDATA_ENABLE) + { + ul_Command = ul_Command | 0x1; + } // if (data[1] == ADDIDATA_ENABLE) + else + { + ul_Command = ul_Command & 0xFFFFFFFE; + } // else if (data[1] == ADDIDATA_ENABLE) + if (data[2] == ADDIDATA_ENABLE) + { + ul_Command = ul_Command | 0x2; + } // if (data[2] == ADDIDATA_ENABLE) + else + { + ul_Command = ul_Command & 0xFFFFFFFD; + } // else if (data[2] == ADDIDATA_ENABLE) + outl( ul_Command , devpriv->i_IobaseAmcc+APCI1564_DIGITAL_OP+APCI1564_DIGITAL_OP_INTERRUPT); + ui_InterruptData=inl( devpriv->i_IobaseAmcc+APCI1564_DIGITAL_OP+APCI1564_DIGITAL_OP_INTERRUPT); + devpriv->tsk_Current=current; + return insn->n; +} + +/* ++----------------------------------------------------------------------------+ +| Function Name : int i_APCI1564_WriteDigitalOutput | +| (comedi_device *dev,comedi_subdevice *s, | +| comedi_insn *insn,lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Writes port value To the selected port | ++----------------------------------------------------------------------------+ +| Input Parameters : comedi_device *dev : Driver handle | +| UINT ui_NoOfChannels : No Of Channels To Write | +| UINT *data : Data Pointer to read status | ++----------------------------------------------------------------------------+ +| Output Parameters : -- | ++----------------------------------------------------------------------------+ +| Return Value : TRUE : No error occur | +| : FALSE : Error occur. Return the error | +| | ++----------------------------------------------------------------------------+ +*/ +INT i_APCI1564_WriteDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) { + UINT ui_Temp,ui_Temp1; + UINT ui_NoOfChannel; + + ui_NoOfChannel=CR_CHAN(insn->chanspec); + if (devpriv->b_OutputMemoryStatus ) + { + ui_Temp=inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_RW); + } // if (devpriv->b_OutputMemoryStatus ) + else + { + ui_Temp=0; + } // else if (devpriv->b_OutputMemoryStatus ) + if (data[3]==0) + { + if (data[1]==0) + { + data[0]=(data[0] << ui_NoOfChannel)|ui_Temp; + outl(data[0],devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_RW); + } // if (data[1]==0) + else + { + if (data[1]==1) + { + switch (ui_NoOfChannel) + { + case 2: data[0]=(data[0] << (2*data[2]))|ui_Temp; + break; + case 4: data[0]=(data[0] << (4*data[2]))|ui_Temp; + break; + case 8: data[0]=(data[0] <<(8*data[2]))|ui_Temp; + break; + case 16: data[0]=(data[0] <<(16*data[2]))|ui_Temp; + break; + case 31: data[0]=data[0]|ui_Temp; + break; + default: comedi_error(dev," chan spec wrong"); + return -EINVAL; // "sorry channel spec wrong " + } // switch (ui_NoOfChannels) + outl(data[0],devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_RW); + } // if (data[1]==1) + else + { + printk("\nSpecified channel not supported\n"); + } // else if (data[1]==1) + } // else if (data[1]==0) + }//if(data[3]==0) + else + { + if (data[3]==1) + { + if (data[1]==0) + { + data[0]=~data[0]&0x1; + ui_Temp1=1; + ui_Temp1=ui_Temp1<i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_RW); + } // if (data[1]==0) + else + { + if (data[1]==1) + { + switch (ui_NoOfChannel) + { + case 2: data[0]=~data[0]&0x3; + ui_Temp1=3; + ui_Temp1=ui_Temp1<<2*data[2]; + ui_Temp=ui_Temp|ui_Temp1; + data[0]=((data[0] << (2*data[2]))^0xffffffff)& ui_Temp; + break; + case 4: data[0]=~data[0]&0xf; + ui_Temp1=15; + ui_Temp1=ui_Temp1<<4*data[2]; + ui_Temp=ui_Temp|ui_Temp1; + data[0]=((data[0] << (4*data[2]))^0xffffffff)&ui_Temp; + break; + case 8: data[0]=~data[0]&0xff; + ui_Temp1=255; + ui_Temp1=ui_Temp1<<8*data[2]; + ui_Temp=ui_Temp|ui_Temp1; + data[0]=((data[0] << (8*data[2]))^0xffffffff)&ui_Temp; + break; + case 16: data[0]=~data[0]&0xffff; + ui_Temp1=65535; + ui_Temp1=ui_Temp1<<16*data[2]; + ui_Temp=ui_Temp|ui_Temp1; + data[0]=((data[0] << (16*data[2]))^0xffffffff)&ui_Temp; + break; + case 31: break; + default: comedi_error(dev," chan spec wrong"); + return -EINVAL; // "sorry channel spec wrong " + }//switch(ui_NoOfChannels) + outl(data[0],devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_RW); + } // if (data[1]==1) + else + { + printk("\nSpecified channel not supported\n"); + } // else if (data[1]==1) + } // else if (data[1]==0) + } // if (data[3]==1); + else + { + printk("\nSpecified functionality does not exist\n"); + return -EINVAL; + } // else if (data[3]==1) + } // else if (data[3]==0) + return insn->n; +} + +/* ++----------------------------------------------------------------------------+ +| Function Name : int i_APCI1564_ReadDigitalOutput | +| (comedi_device *dev,comedi_subdevice *s, | +| comedi_insn *insn,lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Read value of the selected channel or port | ++----------------------------------------------------------------------------+ +| Input Parameters : comedi_device *dev : Driver handle | +| UINT ui_NoOfChannels : No Of Channels To read | +| UINT *data : Data Pointer to read status | ++----------------------------------------------------------------------------+ +| Output Parameters : -- | ++----------------------------------------------------------------------------+ +| Return Value : TRUE : No error occur | +| : FALSE : Error occur. Return the error | +| | ++----------------------------------------------------------------------------+ +*/ +INT i_APCI1564_ReadDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) +{ + UINT ui_Temp; + UINT ui_NoOfChannel; + + ui_NoOfChannel=CR_CHAN(insn->chanspec); + ui_Temp=data[0]; + *data=inl(devpriv->i_IobaseAmcc+APCI1564_DIGITAL_OP+APCI1564_DIGITAL_OP_RW); + if (ui_Temp==0) + { + *data=(*data >> ui_NoOfChannel)&0x1; + } // if (ui_Temp==0) + else + { + if (ui_Temp==1) + { + switch (ui_NoOfChannel) + { + case 2: + *data=(*data >>(2*data[1]))&3; + break; + + case 4: + *data=(*data >>(4*data[1]))&15; + break; + + case 8: + *data=(*data >>(8*data[1]))&255; + break; + + case 16: + *data=(*data >>(16*data[1]))&65535; + break; + + case 31: break; + + default: + comedi_error(dev," chan spec wrong"); + return -EINVAL; // "sorry channel spec wrong " + break; + } // switch(ui_NoOfChannels) + } // if (ui_Temp==1) + else + { + printk("\nSpecified channel not supported \n"); + } // else if (ui_Temp==1) + } // else if (ui_Temp==0) + return insn->n; +} + +/* ++----------------------------------------------------------------------------+ +| Function Name : int i_APCI1564_ConfigTimerCounterWatchdog | +| (comedi_device *dev,comedi_subdevice *s, | +| comedi_insn *insn,lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Configures The Timer , Counter or Watchdog | ++----------------------------------------------------------------------------+ +| Input Parameters : comedi_device *dev : Driver handle | +| UINT *data : Data Pointer contains | +| configuration parameters as below | +| | +| data[0] : 0 Configure As Timer | +| 1 Configure As Counter | +| 2 Configure As Watchdog | +| data[1] : 1 Enable Interrupt | +| 0 Disable Interrupt | +| data[2] : Time Unit | +| data[3] : Reload Value | +| data[4] : Timer Mode | +| data[5] : Timer Counter Watchdog Number| + data[6] : Counter Direction ++----------------------------------------------------------------------------+ +| Output Parameters : -- | ++----------------------------------------------------------------------------+ +| Return Value : TRUE : No error occur | +| : FALSE : Error occur. Return the error | +| | ++----------------------------------------------------------------------------+ +*/ +INT i_APCI1564_ConfigTimerCounterWatchdog (comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) +{ + ULONG ul_Command1 = 0; + devpriv->tsk_Current=current; + if (data[0]==ADDIDATA_WATCHDOG) + { + devpriv->b_TimerSelectMode = ADDIDATA_WATCHDOG; + + //Disable the watchdog + outl(0x0,devpriv->i_IobaseAmcc+ APCI1564_DIGITAL_OP_WATCHDOG+ APCI1564_TCW_PROG); + //Loading the Reload value + outl(data[3],devpriv->i_IobaseAmcc+APCI1564_DIGITAL_OP_WATCHDOG+APCI1564_TCW_RELOAD_VALUE); + } // if (data[0]==ADDIDATA_WATCHDOG) + else if (data[0]==ADDIDATA_TIMER) + { + //First Stop The Timer + ul_Command1 =inl(devpriv->i_IobaseAmcc+ APCI1564_TIMER+ APCI1564_TCW_PROG); + ul_Command1 =ul_Command1 & 0xFFFFF9FEUL; + outl(ul_Command1,devpriv->i_IobaseAmcc+ APCI1564_TIMER+ APCI1564_TCW_PROG);//Stop The Timer + + devpriv->b_TimerSelectMode =ADDIDATA_TIMER; + if (data[1]==1) + { + outl(0x02,devpriv->i_IobaseAmcc+ APCI1564_TIMER+ APCI1564_TCW_PROG);//Enable TIMER int & DISABLE ALL THE OTHER int SOURCES + outl(0x0,devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_IRQ); + outl(0x0,devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_IRQ); + outl(0x0,devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG + APCI1564_TCW_IRQ); + outl(0x0,devpriv->iobase+APCI1564_COUNTER1 + APCI1564_TCW_IRQ); + outl(0x0,devpriv->iobase+APCI1564_COUNTER2 + APCI1564_TCW_IRQ); + outl(0x0,devpriv->iobase+APCI1564_COUNTER3 + APCI1564_TCW_IRQ); + outl(0x0,devpriv->iobase+APCI1564_COUNTER4 + APCI1564_TCW_IRQ); + } // if (data[1]==1) + else + { + outl(0x0,devpriv->i_IobaseAmcc+ APCI1564_TIMER+ APCI1564_TCW_PROG);//disable Timer interrupt + } // else if (data[1]==1) + + // Loading Timebase + + outl(data[2],devpriv->i_IobaseAmcc+APCI1564_TIMER+APCI1564_TCW_TIMEBASE); + + //Loading the Reload value + outl(data[3],devpriv->i_IobaseAmcc+APCI1564_TIMER+APCI1564_TCW_RELOAD_VALUE); + + ul_Command1 =inl(devpriv->i_IobaseAmcc+ APCI1564_TIMER+ APCI1564_TCW_PROG); + ul_Command1 = (ul_Command1 & 0xFFF719E2UL) | 2UL << 13UL | 0x10UL; + outl(ul_Command1,devpriv->i_IobaseAmcc+ APCI1564_TIMER+ APCI1564_TCW_PROG);//mode 2 + } // else if (data[0]==ADDIDATA_TIMER) + else if (data[0]==ADDIDATA_COUNTER) + { + devpriv->b_TimerSelectMode =ADDIDATA_COUNTER; + devpriv->b_ModeSelectRegister=data[5]; + + //First Stop The Counter + ul_Command1 =inl(devpriv->iobase+((data[5]-1)*0x20)+APCI1564_TCW_PROG); + ul_Command1 =ul_Command1 & 0xFFFFF9FEUL; + outl(ul_Command1,devpriv->iobase+((data[5]-1)*0x20)+APCI1564_TCW_PROG);//Stop The Timer + + /************************/ + /* Set the reload value */ + /************************/ + outl(data[3] , devpriv->iobase+((data[5]-1)*0x20)+APCI1564_TCW_RELOAD_VALUE); + + /******************************/ + /* Set the mode : */ + /* - Disable the hardware */ + /* - Disable the counter mode */ + /* - Disable the warning */ + /* - Disable the reset */ + /* - Disable the timer mode */ + /* - Enable the counter mode */ + /******************************/ + ul_Command1 = (ul_Command1 & 0xFFFC19E2UL) | 0x80000UL | (ULONG) ((ULONG) data[4] << 16UL); + outl(ul_Command1 , devpriv->iobase+((data[5]-1)*0x20)+APCI1564_TCW_PROG); + + // Enable or Disable Interrupt + ul_Command1= (ul_Command1 & 0xFFFFF9FD) | (data[1] << 1); + outl(ul_Command1 , devpriv->iobase+((data[5]-1)*0x20)+APCI1564_TCW_PROG); + + /*****************************/ + /* Set the Up/Down selection */ + /*****************************/ + ul_Command1 = (ul_Command1 & 0xFFFBF9FFUL) | (data[6] << 18); + outl(ul_Command1 , devpriv->iobase+((data[5]-1)*0x20)+APCI1564_TCW_PROG); + } // else if (data[0]==ADDIDATA_COUNTER) + else + { + printk(" Invalid subdevice."); + } // else if (data[0]==ADDIDATA_WATCHDOG) + + return insn->n; +} + +/* ++----------------------------------------------------------------------------+ +| Function Name : int i_APCI1564_StartStopWriteTimerCounterWatchdog | +| (comedi_device *dev,comedi_subdevice *s, | +| comedi_insn *insn,lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Start / Stop The Selected Timer , Counter or Watchdog | ++----------------------------------------------------------------------------+ +| Input Parameters : comedi_device *dev : Driver handle | +| UINT *data : Data Pointer contains | +| configuration parameters as below | +| | +| data[0] : 0 Timer | +| 1 Counter | +| 2 Watchdog | | data[1] : 1 Start | +| 0 Stop | +| 2 Trigger | +| Clear (Only Counter) | ++----------------------------------------------------------------------------+ +| Output Parameters : -- | ++----------------------------------------------------------------------------+ +| Return Value : TRUE : No error occur | +| : FALSE : Error occur. Return the error | +| | ++----------------------------------------------------------------------------+ +*/ +INT i_APCI1564_StartStopWriteTimerCounterWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) +{ + ULONG ul_Command1 = 0; + if (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) + { + switch (data[1]) + { + case 0: //stop the watchdog + outl(0x0,devpriv->i_IobaseAmcc+ APCI1564_DIGITAL_OP_WATCHDOG+ APCI1564_TCW_PROG );//disable the watchdog + break; + case 1: //start the watchdog + outl(0x0001,devpriv->i_IobaseAmcc+ APCI1564_DIGITAL_OP_WATCHDOG+ APCI1564_TCW_PROG); + break; + case 2: //Software trigger + outl(0x0201,devpriv->i_IobaseAmcc+ APCI1564_DIGITAL_OP_WATCHDOG+ APCI1564_TCW_PROG); + break; + default: printk("\nSpecified functionality does not exist\n"); + return -EINVAL; + } // switch (data[1]) + } // if (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) + if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) + { + if (data[1]==1) + { + ul_Command1=inl(devpriv->i_IobaseAmcc+ APCI1564_TIMER+ APCI1564_TCW_PROG); + ul_Command1=(ul_Command1& 0xFFFFF9FFUL) | 0x1UL; + + //Enable the Timer + outl(ul_Command1,devpriv->i_IobaseAmcc+ APCI1564_TIMER+ APCI1564_TCW_PROG); + } // if (data[1]==1) + else if(data[1]==0) + { + //Stop The Timer + + ul_Command1=inl(devpriv->i_IobaseAmcc+ APCI1564_TIMER+ APCI1564_TCW_PROG); + ul_Command1 =ul_Command1 & 0xFFFFF9FEUL; + outl(ul_Command1,devpriv->i_IobaseAmcc+ APCI1564_TIMER+ APCI1564_TCW_PROG); + } // else if(data[1]==0) + } // if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) + if (devpriv->b_TimerSelectMode==ADDIDATA_COUNTER) + { + ul_Command1=inl(devpriv->iobase+((devpriv->b_ModeSelectRegister-1)*0x20)+APCI1564_TCW_PROG); + if (data[1] == 1) + { + //Start the Counter subdevice + ul_Command1= (ul_Command1 & 0xFFFFF9FFUL) | 0x1UL; + } // if (data[1] == 1) + else if (data[1] == 0) + { + // Stops the Counter subdevice + ul_Command1 = 0; + + } // else if (data[1] == 0) + else if (data[1] == 2) + { + // Clears the Counter subdevice + ul_Command1= (ul_Command1 & 0xFFFFF9FFUL)|0x400; + } // else if (data[1] == 3) + outl(ul_Command1 , devpriv->iobase+((devpriv->b_ModeSelectRegister-1)*0x20)+APCI1564_TCW_PROG); + } // if (devpriv->b_TimerSelectMode==ADDIDATA_COUNTER) + return insn->n; +} + +/* ++----------------------------------------------------------------------------+ +| Function Name : int i_APCI1564_ReadTimerCounterWatchdog | +| (comedi_device *dev,comedi_subdevice *s, | +| comedi_insn *insn,lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Read The Selected Timer , Counter or Watchdog | ++----------------------------------------------------------------------------+ +| Input Parameters : comedi_device *dev : Driver handle | +| UINT *data : Data Pointer contains | +| configuration parameters as below | +| | + ++----------------------------------------------------------------------------+ +| Output Parameters : -- | ++----------------------------------------------------------------------------+ +| Return Value : TRUE : No error occur | +| : FALSE : Error occur. Return the error | +| | ++----------------------------------------------------------------------------+ +*/ +INT i_APCI1564_ReadTimerCounterWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) +{ + ULONG ul_Command1 = 0; + + if (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) + { + // Stores the status of the Watchdog + data[0]= inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG + APCI1564_TCW_TRIG_STATUS)&0x1; + data[1]= inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG); + } // if (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) + else if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) + { + // Stores the status of the Timer + data[0]= inl(devpriv->i_IobaseAmcc+APCI1564_TIMER+APCI1564_TCW_TRIG_STATUS)&0x1; + + // Stores the Actual value of the Timer + data[1]= inl(devpriv->i_IobaseAmcc + APCI1564_TIMER); + } // else if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) + else if (devpriv->b_TimerSelectMode==ADDIDATA_COUNTER) + { + // Read the Counter Actual Value. + data[0] = inl(devpriv->iobase+((devpriv->b_ModeSelectRegister-1)*0x20)+APCI1564_TCW_SYNC_ENABLEDISABLE); + ul_Command1 = inl(devpriv->iobase+((devpriv->b_ModeSelectRegister-1)*0x20)+APCI1564_TCW_TRIG_STATUS); + + /***********************************/ + /* Get the software trigger status */ + /***********************************/ + data[1]= (BYTE) ((ul_Command1 >> 1) & 1); + + /***********************************/ + /* Get the hardware trigger status */ + /***********************************/ + data[2]= (BYTE) ((ul_Command1 >> 2) & 1); + + /*********************************/ + /* Get the software clear status */ + /*********************************/ + data[3]= (BYTE) ((ul_Command1 >> 3) & 1); + + /***************************/ + /* Get the overflow status */ + /***************************/ + data[4]= (BYTE) ((ul_Command1 >> 0) & 1); + } // else if (devpriv->b_TimerSelectMode==ADDIDATA_COUNTER) + else if ((devpriv->b_TimerSelectMode!=ADDIDATA_TIMER) && (devpriv->b_TimerSelectMode!=ADDIDATA_WATCHDOG)&& (devpriv->b_TimerSelectMode!=ADDIDATA_COUNTER)) + { + printk ("\n Invalid Subdevice !!!\n"); + } // else if ((devpriv->b_TimerSelectMode!=ADDIDATA_TIMER) && (devpriv->b_TimerSelectMode!=ADDIDATA_WATCHDOG)&& (devpriv->b_TimerSelectMode!=ADDIDATA_COUNTER)) + return insn->n; +} + +/* ++----------------------------------------------------------------------------+ +| Function Name : int i_APCI1564_ReadInterruptStatus | +| (comedi_device *dev,comedi_subdevice *s, | +| comedi_insn *insn,lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task :Reads the interrupt status register | ++----------------------------------------------------------------------------+ +| Input Parameters : | ++----------------------------------------------------------------------------+ +| Output Parameters : -- | ++----------------------------------------------------------------------------+ +| Return Value : | +| | ++----------------------------------------------------------------------------+ +*/ + +int i_APCI1564_ReadInterruptStatus(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) +{ + *data=ui_Type; + return insn->n; +} + +/* ++----------------------------------------------------------------------------+ +| Function Name : static void v_APCI1564_Interrupt | +| (int irq , void *d, struct pt_regs *regs) | ++----------------------------------------------------------------------------+ +| Task : Interrupt handler for the interruptible digital inputs | ++----------------------------------------------------------------------------+ +| Input Parameters : int irq : irq number | +| void *d : void pointer | +| struct pt_regs *regs : structure pointer | ++----------------------------------------------------------------------------+ +| Output Parameters : -- | ++----------------------------------------------------------------------------+ +| Return Value : TRUE : No error occur | +| : FALSE : Error occur. Return the error | +| | ++----------------------------------------------------------------------------+ +*/ +static VOID v_APCI1564_Interrupt(int irq,void* d, struct pt_regs *regs) +{ + comedi_device *dev =d; + UINT ui_DO, ui_DI; + UINT ui_Timer; + UINT ui_C1, ui_C2, ui_C3, ui_C4; + ULONG ul_Command2=0; + ui_DI = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_IRQ) & 0x01; + ui_DO = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_IRQ) & 0x01; + ui_Timer = inl(devpriv->i_IobaseAmcc + APCI1564_TIMER+ APCI1564_TCW_IRQ) & 0x01; + ui_C1=inl(devpriv->iobase + APCI1564_COUNTER1 + APCI1564_TCW_IRQ ) & 0x1; + ui_C2=inl(devpriv->iobase + APCI1564_COUNTER2 + APCI1564_TCW_IRQ ) & 0x1; + ui_C3=inl(devpriv->iobase + APCI1564_COUNTER3 + APCI1564_TCW_IRQ ) & 0x1; + ui_C4=inl(devpriv->iobase + APCI1564_COUNTER4 + APCI1564_TCW_IRQ ) & 0x1; + if(ui_DI==0 && ui_DO==0 && ui_Timer==0 && ui_C1==0 && ui_C2==0 && ui_C3==0 && ui_C4==0) + { + printk("\nInterrupt from unknown source\n"); + }// if(ui_DI==0 && ui_DO==0 && ui_Timer==0 && ui_C1==0 && ui_C2==0 && ui_C3==0 && ui_C4==0) + + if (ui_DI == 1) + { + ui_DI = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_IRQ); + outl(0x0 ,devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_IRQ); + ui_InterruptStatus_1564=inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_INTERRUPT_STATUS); + ui_InterruptStatus_1564=ui_InterruptStatus_1564 & 0X000FFFF0; + send_sig(SIGIO,devpriv->tsk_Current,0); // send signal to the sample + outl(ui_DI ,devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_IRQ);//enable the interrupt + return; + } + + if (ui_DO == 1) + { + // Check for Digital Output interrupt Type - 1: Vcc interrupt 2: CC interrupt. + ui_Type=inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_INTERRUPT_STATUS) & 0x3; + //Disable the Interrupt + outl(0x0,devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_INTERRUPT); + + //Sends signal to user space + send_sig(SIGIO,devpriv->tsk_Current,0); + + } // if (ui_DO) + + if ((ui_Timer == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_TIMER)) + { + // Disable Timer Interrupt + ul_Command2=inl(devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); + outl(0x0 , devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); + + //Send a signal to from kernel to user space + send_sig(SIGIO,devpriv->tsk_Current,0); + + // Enable Timer Interrupt + + outl(ul_Command2 , devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); + } // if ((ui_Timer == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_TIMER)) + + + if ((ui_C1 == 1) && (devpriv->b_TimerSelectMode = ADDIDATA_COUNTER)) + { + // Disable Counter Interrupt + ul_Command2=inl(devpriv->iobase + APCI1564_COUNTER1 + APCI1564_TCW_PROG); + outl(0x0 , devpriv->iobase + APCI1564_COUNTER1 + APCI1564_TCW_PROG); + + //Send a signal to from kernel to user space + send_sig(SIGIO,devpriv->tsk_Current,0); + + // Enable Counter Interrupt + outl(ul_Command2 , devpriv->iobase + APCI1564_COUNTER1 + APCI1564_TCW_PROG); + } // if ((ui_C1 == 1) && (devpriv->b_TimerSelectMode = ADDIDATA_COUNTER)) + + if ((ui_C2 == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_COUNTER)) + { + // Disable Counter Interrupt + ul_Command2=inl(devpriv->iobase + APCI1564_COUNTER2 + APCI1564_TCW_PROG); + outl(0x0 , devpriv->iobase + APCI1564_COUNTER2 + APCI1564_TCW_PROG); + + //Send a signal to from kernel to user space + send_sig(SIGIO,devpriv->tsk_Current,0); + + // Enable Counter Interrupt + outl(ul_Command2 , devpriv->iobase + APCI1564_COUNTER2 + APCI1564_TCW_PROG); + } // if ((ui_C2 == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_COUNTER)) + + if ((ui_C3 == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_COUNTER)) + { + // Disable Counter Interrupt + ul_Command2=inl(devpriv->iobase + APCI1564_COUNTER3 + APCI1564_TCW_PROG); + outl(0x0 , devpriv->iobase + APCI1564_COUNTER3 + APCI1564_TCW_PROG); + + //Send a signal to from kernel to user space + send_sig(SIGIO,devpriv->tsk_Current,0); + + // Enable Counter Interrupt + outl(ul_Command2 , devpriv->iobase + APCI1564_COUNTER3 + APCI1564_TCW_PROG); + } // if ((ui_C3 == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_COUNTER)) + + if ((ui_C4 == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_COUNTER)) + { + // Disable Counter Interrupt + ul_Command2=inl(devpriv->iobase + APCI1564_COUNTER4 + APCI1564_TCW_PROG); + outl(0x0 , devpriv->iobase + APCI1564_COUNTER4 + APCI1564_TCW_PROG); + + //Send a signal to from kernel to user space + send_sig(SIGIO,devpriv->tsk_Current,0); + + // Enable Counter Interrupt + outl(ul_Command2 , devpriv->iobase + APCI1564_COUNTER4 + APCI1564_TCW_PROG); + } // if ((ui_C4 == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_COUNTER)) + return; +} + +/* ++----------------------------------------------------------------------------+ +| Function Name : int i_APCI1564_Reset(comedi_device *dev) | | ++----------------------------------------------------------------------------+ +| Task :resets all the registers | ++----------------------------------------------------------------------------+ +| Input Parameters : comedi_device *dev ++----------------------------------------------------------------------------+ +| Output Parameters : -- | ++----------------------------------------------------------------------------+ +| Return Value : | +| | ++----------------------------------------------------------------------------+ +*/ + +INT i_APCI1564_Reset(comedi_device *dev) +{ + outl(0x0 ,devpriv->i_IobaseAmcc+APCI1564_DIGITAL_IP_IRQ);//disable the interrupts + inl(devpriv->i_IobaseAmcc+APCI1564_DIGITAL_IP_INTERRUPT_STATUS);//Reset the interrupt status register + outl (0x0 , devpriv->i_IobaseAmcc+APCI1564_DIGITAL_IP_INTERRUPT_MODE1);//Disable the and/or interrupt + outl (0x0 , devpriv->i_IobaseAmcc+APCI1564_DIGITAL_IP_INTERRUPT_MODE2); + devpriv->b_DigitalOutputRegister=0; + ui_Type=0; + outl(0x0,devpriv->i_IobaseAmcc+APCI1564_DIGITAL_OP);//Resets the output channels + outl(0x0,devpriv->i_IobaseAmcc+APCI1564_DIGITAL_OP_INTERRUPT);//Disables the interrupt. + outl(0x0,devpriv->i_IobaseAmcc+APCI1564_DIGITAL_OP_WATCHDOG+APCI1564_TCW_RELOAD_VALUE); + outl(0x0,devpriv->i_IobaseAmcc+APCI1564_TIMER); + outl(0x0 , devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); + + outl(0x0 , devpriv->iobase + APCI1564_COUNTER1 + APCI1564_TCW_PROG); + outl(0x0 , devpriv->iobase + APCI1564_COUNTER2 + APCI1564_TCW_PROG); + outl(0x0 , devpriv->iobase + APCI1564_COUNTER3 + APCI1564_TCW_PROG); + outl(0x0 , devpriv->iobase + APCI1564_COUNTER4 + APCI1564_TCW_PROG); + return 0; +} diff --git a/comedi/drivers/addi-data/hwdrv_apci1564.h b/comedi/drivers/addi-data/hwdrv_apci1564.h index 447223fa..89c3614f 100644 --- a/comedi/drivers/addi-data/hwdrv_apci1564.h +++ b/comedi/drivers/addi-data/hwdrv_apci1564.h @@ -1,21 +1,45 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ + /********* Definitions for APCI-1564 card *****/ -#define APCI1564_BOARD_VENDOR_ID 0x15B8 -#define APCI1564_ADDRESS_RANGE 128 - -//DIGITAL INPUT-OUTPUT DEFINE -// Input defines -#define APCI1564_DIGITAL_IP 0x04 -#define APCI1564_DIGITAL_IP_INTERRUPT_MODE1 4 -#define APCI1564_DIGITAL_IP_INTERRUPT_MODE2 8 -#define APCI1564_DIGITAL_IP_IRQ 16 - -// Output defines +#define APCI1564_BOARD_VENDOR_ID 0x15B8 +#define APCI1564_ADDRESS_RANGE 128 + +//DIGITAL INPUT-OUTPUT DEFINE +// Input defines +#define APCI1564_DIGITAL_IP 0x04 +#define APCI1564_DIGITAL_IP_INTERRUPT_MODE1 4 +#define APCI1564_DIGITAL_IP_INTERRUPT_MODE2 8 +#define APCI1564_DIGITAL_IP_IRQ 16 + +// Output defines #define APCI1564_DIGITAL_OP 0x18 #define APCI1564_DIGITAL_OP_RW 0 #define APCI1564_DIGITAL_OP_INTERRUPT 4 -#define APCI1564_DIGITAL_OP_IRQ 12 - +#define APCI1564_DIGITAL_OP_IRQ 12 + //Digital Input IRQ Function Selection #define ADDIDATA_OR 0 @@ -61,31 +85,32 @@ #define APCI1564_TCW_IRQ 20 #define APCI1564_TCW_WARN_TIMEVAL 24 #define APCI1564_TCW_WARN_TIMEBASE 28 - + // Hardware Layer functions for Apci1564 - -//DI -// for di read -INT i_APCI1564_ConfigDigitalInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); -INT i_APCI1564_Read1DigitalInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); -INT i_APCI1564_ReadMoreDigitalInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); - -//DO -int i_APCI1564_ConfigDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); -INT i_APCI1564_WriteDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); -INT i_APCI1564_ReadDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); + + +//DI +// for di read +INT i_APCI1564_ConfigDigitalInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +INT i_APCI1564_Read1DigitalInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +INT i_APCI1564_ReadMoreDigitalInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); + +//DO +int i_APCI1564_ConfigDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +INT i_APCI1564_WriteDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +INT i_APCI1564_ReadDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); int i_APCI1564_ReadInterruptStatus(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); // TIMER // timer value is passed as u seconds -INT i_APCI1564_ConfigTimerCounterWatchdog (comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); -int i_APCI1564_StartStopWriteTimerCounterWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); -int i_APCI1564_ReadTimerCounterWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); - -// INTERRUPT -static VOID v_APCI1564_Interrupt(int irq, void *d, struct pt_regs *regs) ; - -// RESET -INT i_APCI1564_Reset(comedi_device *dev); +INT i_APCI1564_ConfigTimerCounterWatchdog (comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +int i_APCI1564_StartStopWriteTimerCounterWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +int i_APCI1564_ReadTimerCounterWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); + +// INTERRUPT +static VOID v_APCI1564_Interrupt(int irq, void *d, struct pt_regs *regs) ; + +// RESET +INT i_APCI1564_Reset(comedi_device *dev); diff --git a/comedi/drivers/addi-data/hwdrv_apci16xx.c b/comedi/drivers/addi-data/hwdrv_apci16xx.c new file mode 100755 index 00000000..b4b737d7 --- /dev/null +++ b/comedi/drivers/addi-data/hwdrv_apci16xx.c @@ -0,0 +1,813 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ +/* + + +-----------------------------------------------------------------------+ + | (C) ADDI-DATA GmbH Dieselstraße 3 D-77833 Ottersweier | + +-----------------------------------------------------------------------+ + | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | + | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | + +-----------------------------------------------------------------------+ + | Project : API APCI1648 | Compiler : gcc | + | Module name : TTL.C | Version : 2.96 | + +-------------------------------+---------------------------------------+ + | Project manager: S. Weber | Date : 25/05/2005 | + +-----------------------------------------------------------------------+ + | Description : APCI-16XX TTL I/O module | + | | + | | + +-----------------------------------------------------------------------+ + | UPDATES | + +-----------------------------------------------------------------------+ + | Date | Author | Description of updates | + +----------+-----------+------------------------------------------------+ + |25.05.2005| S.Weber | Creation | + | | | | + +-----------------------------------------------------------------------+ +*/ + +/* ++----------------------------------------------------------------------------+ +| Included files | ++----------------------------------------------------------------------------+ +*/ + +#include "hwdrv_apci16xx.h" + + +/* ++----------------------------------------------------------------------------+ +| Function Name : INT i_APCI16XX_InsnConfigInitTTLIO | +| (comedi_device *dev, | +| comedi_subdevice *s, | +| comedi_insn *insn, | +| lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task APCI16XX_TTL_INIT (using defaults) : | +| Configure the TTL I/O operating mode from all ports | +| You must calling this function be | +| for you call any other function witch access of TTL. | +| APCI16XX_TTL_INITDIRECTION(user inputs for direction) | ++----------------------------------------------------------------------------+ +| Input Parameters : b_InitType = (BYTE) data[0]; | +| b_Port0Mode = (BYTE) data[1]; | +| b_Port1Mode = (BYTE) data[2]; | +| b_Port2Mode = (BYTE) data[3]; | +| b_Port3Mode = (BYTE) data[4]; | +| ........ | ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value :>0: No error | +| -1: Port 0 mode selection is wrong | +| -2: Port 1 mode selection is wrong | +| -3: Port 2 mode selection is wrong | +| -4: Port 3 mode selection is wrong | +| -X: Port X-1 mode selection is wrong | +| .... | +| -100 : Config command error | +| -101 : Data size error | ++----------------------------------------------------------------------------+ +*/ + + +int i_APCI16XX_InsnConfigInitTTLIO(comedi_device *dev, + comedi_subdevice *s, + comedi_insn *insn, + lsampl_t *data) + { + INT i_ReturnValue = insn->n; + BYTE b_Command = 0; + BYTE b_Cpt = 0; + BYTE b_NumberOfPort = (BYTE) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 8); + + + /************************/ + /* Test the buffer size */ + /************************/ + + if (insn->n >= 1) + { + /*******************/ + /* Get the command */ + /* *****************/ + + b_Command = (BYTE) data[0]; + + /********************/ + /* Test the command */ + /********************/ + + if ((b_Command == APCI16XX_TTL_INIT) || + (b_Command == APCI16XX_TTL_INITDIRECTION) || + (b_Command == APCI16XX_TTL_OUTPUTMEMORY)) + { + /***************************************/ + /* Test the initialisation buffer size */ + /***************************************/ + + if ((b_Command == APCI16XX_TTL_INITDIRECTION) && ((BYTE) (insn->n - 1) != b_NumberOfPort)) + { + /*******************/ + /* Data size error */ + /*******************/ + + printk("\nBuffer size error"); + i_ReturnValue = -101; + } + + if ((b_Command == APCI16XX_TTL_OUTPUTMEMORY) && ((BYTE) (insn->n) != 2)) + { + /*******************/ + /* Data size error */ + /*******************/ + + printk("\nBuffer size error"); + i_ReturnValue = -101; + } + } + else + { + /************************/ + /* Config command error */ + /************************/ + + printk("\nCommand selection error"); + i_ReturnValue = -100; + } + } + else + { + /*******************/ + /* Data size error */ + /*******************/ + + printk("\nBuffer size error"); + i_ReturnValue = -101; + } + + + /**************************************************************************/ + /* Test if no error occur and APCI16XX_TTL_INITDIRECTION command selected */ + /**************************************************************************/ + + if ((i_ReturnValue >= 0) && (b_Command == APCI16XX_TTL_INITDIRECTION)) + { + memset (devpriv->ul_TTLPortConfiguration, 0, sizeof(devpriv->ul_TTLPortConfiguration)); + + /*************************************/ + /* Test the port direction selection */ + /*************************************/ + + for (b_Cpt = 1; (b_Cpt <= b_NumberOfPort) && (i_ReturnValue >= 0); b_Cpt ++) + { + /**********************/ + /* Test the direction */ + /**********************/ + + if ((data[b_Cpt] != 0) && (data[b_Cpt] != 0xFF)) + { + /************************/ + /* Port direction error */ + /************************/ + + printk("\nPort %d direction selection error", (INT) b_Cpt); + i_ReturnValue = - (INT) b_Cpt; + } + + /**************************/ + /* Save the configuration */ + /**************************/ + + + devpriv->ul_TTLPortConfiguration[(b_Cpt - 1) / 4] = devpriv->ul_TTLPortConfiguration[(b_Cpt - 1) / 4] | + (data[b_Cpt] << (8 * ((b_Cpt - 1) % 4))); + } + } + + /**************************/ + /* Test if no error occur */ + /**************************/ + + if (i_ReturnValue >= 0) + { + /***********************************/ + /* Test if TTL port initilaisation */ + /***********************************/ + + if ((b_Command == APCI16XX_TTL_INIT) || (b_Command == APCI16XX_TTL_INITDIRECTION)) + { + /******************************/ + /* Set all port configuration */ + /******************************/ + + for (b_Cpt = 0; b_Cpt <= b_NumberOfPort; b_Cpt ++) + { + if ((b_Cpt % 4) == 0) + { + /*************************/ + /* Set the configuration */ + /*************************/ + + outl(devpriv->ul_TTLPortConfiguration[b_Cpt / 4],devpriv->iobase + 32 + b_Cpt); + } + } + } + } + + /************************************************/ + /* Test if output memory initialisation command */ + /************************************************/ + + if (b_Command == APCI16XX_TTL_OUTPUTMEMORY) + { + if (data[1]) + { + devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE; + } + else + { + devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE; + } + } + + return (i_ReturnValue); + } + + +/* ++----------------------------------------------------------------------------+ +| INPUT FUNCTIONS | ++----------------------------------------------------------------------------+ +*/ + + +/* ++----------------------------------------------------------------------------+ +| Function Name : INT i_APCI16XX_InsnBitsReadTTLIO | +| (comedi_device *dev, | +| comedi_subdevice *s, | +| comedi_insn *insn, | +| lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Read the status from selected TTL digital input | +| (b_InputChannel) | ++----------------------------------------------------------------------------+ +| Task : Read the status from digital input port | +| (b_SelectedPort) | ++----------------------------------------------------------------------------+ +| Input Parameters : | +| APCI16XX_TTL_READCHANNEL | +| b_SelectedPort= CR_RANGE(insn->chanspec); | +| b_InputChannel= CR_CHAN(insn->chanspec); | +| b_ReadType = (BYTE) data[0]; | +| | +| APCI16XX_TTL_READPORT | +| b_SelectedPort= CR_RANGE(insn->chanspec); | +| b_ReadType = (BYTE) data[0]; | ++----------------------------------------------------------------------------+ +| Output Parameters : data[0] 0 : Channle is not active | +| 1 : Channle is active | ++----------------------------------------------------------------------------+ +| Return Value : >0 : No error | +| -100 : Config command error | +| -101 : Data size error | +| -102 : The selected TTL input port is wrong | +| -103 : The selected TTL digital input is wrong | ++----------------------------------------------------------------------------+ +*/ + + +int i_APCI16XX_InsnBitsReadTTLIO (comedi_device *dev, + comedi_subdevice *s, + comedi_insn *insn, + lsampl_t *data) + { + INT i_ReturnValue = insn->n; + BYTE b_Command = 0; + BYTE b_NumberOfPort = (BYTE) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 8); + BYTE b_SelectedPort = CR_RANGE(insn->chanspec); + BYTE b_InputChannel = CR_CHAN(insn->chanspec); + BYTE * pb_Status; + DWORD dw_Status; + + /************************/ + /* Test the buffer size */ + /************************/ + + if (insn->n >= 1) + { + /*******************/ + /* Get the command */ + /* *****************/ + + b_Command = (BYTE) data[0]; + + /********************/ + /* Test the command */ + /********************/ + + if ((b_Command == APCI16XX_TTL_READCHANNEL) || (b_Command == APCI16XX_TTL_READPORT)) + { + /**************************/ + /* Test the selected port */ + /**************************/ + + if (b_SelectedPort < b_NumberOfPort) + { + /**********************/ + /* Test if input port */ + /**********************/ + + if (((devpriv->ul_TTLPortConfiguration[b_SelectedPort / 4] >> (8 * (b_SelectedPort % 4))) & 0xFF) == 0) + { + /***************************/ + /* Test the channel number */ + /***************************/ + + if ((b_Command == APCI16XX_TTL_READCHANNEL) && (b_InputChannel > 7)) + { + /*******************************************/ + /* The selected TTL digital input is wrong */ + /*******************************************/ + + printk("\nChannel selection error"); + i_ReturnValue = -103; + } + } + else + { + /****************************************/ + /* The selected TTL input port is wrong */ + /****************************************/ + + printk("\nPort selection error"); + i_ReturnValue = -102; + } + } + else + { + /****************************************/ + /* The selected TTL input port is wrong */ + /****************************************/ + + printk("\nPort selection error"); + i_ReturnValue = -102; + } + } + else + { + /************************/ + /* Config command error */ + /************************/ + + printk("\nCommand selection error"); + i_ReturnValue = -100; + } + } + else + { + /*******************/ + /* Data size error */ + /*******************/ + + printk("\nBuffer size error"); + i_ReturnValue = -101; + } + + + /**************************/ + /* Test if no error occur */ + /**************************/ + + if (i_ReturnValue >= 0) + { + pb_Status = (PBYTE) &data[0]; + + /*******************************/ + /* Get the digital inpu status */ + /*******************************/ + + dw_Status = inl(devpriv->iobase + 8 + ((b_SelectedPort / 4) * 4)); + dw_Status = (dw_Status >> (8 * (b_SelectedPort % 4))) & 0xFF; + + /***********************/ + /* Save the port value */ + /***********************/ + + *pb_Status = (BYTE) dw_Status; + + /***************************************/ + /* Test if read channel status command */ + /***************************************/ + + if (b_Command == APCI16XX_TTL_READCHANNEL) + { + *pb_Status = (*pb_Status >> b_InputChannel) & 1; + } + } + + return (i_ReturnValue); + } + + + +/* ++----------------------------------------------------------------------------+ +| Function Name : INT i_APCI16XX_InsnReadTTLIOAllPortValue | +| (comedi_device *dev, | +| comedi_subdevice *s, | +| comedi_insn *insn, | +| lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Read the status from all digital input ports | ++----------------------------------------------------------------------------+ +| Input Parameters : - | ++----------------------------------------------------------------------------+ +| Output Parameters : data[0] : Port 0 to 3 data | +| data[1] : Port 4 to 7 data | +| .... | ++----------------------------------------------------------------------------+ +| Return Value : 0: No error | +| -100 : Read command error | +| -101 : Data size error | ++----------------------------------------------------------------------------+ +*/ + +int i_APCI16XX_InsnReadTTLIOAllPortValue (comedi_device *dev, + comedi_subdevice *s, + comedi_insn *insn, + lsampl_t *data) + { + BYTE b_Command = (BYTE) CR_AREF(insn->chanspec); + INT i_ReturnValue = insn->n; + BYTE b_Cpt = 0; + BYTE b_NumberOfPort = 0; + lsampl_t * pls_ReadData = data; + + /********************/ + /* Test the command */ + /********************/ + + if ((b_Command == APCI16XX_TTL_READ_ALL_INPUTS) || (b_Command == APCI16XX_TTL_READ_ALL_OUTPUTS)) + { + /**********************************/ + /* Get the number of 32-Bit ports */ + /**********************************/ + + b_NumberOfPort = (BYTE) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 32); + if ((b_NumberOfPort * 32) < devpriv->ps_BoardInfo->i_NbrTTLChannel) + { + b_NumberOfPort = b_NumberOfPort + 1; + } + + /************************/ + /* Test the buffer size */ + /************************/ + + if (insn->n >= b_NumberOfPort) + { + if (b_Command == APCI16XX_TTL_READ_ALL_INPUTS) + { + /**************************/ + /* Read all digital input */ + /**************************/ + + for (b_Cpt = 0; b_Cpt < b_NumberOfPort; b_Cpt ++) + { + /************************/ + /* Read the 32-Bit port */ + /************************/ + + pls_ReadData [b_Cpt] = inl(devpriv->iobase + 8 + (b_Cpt * 4)); + + /**************************************/ + /* Mask all channels used als outputs */ + /**************************************/ + + pls_ReadData [b_Cpt] = pls_ReadData [b_Cpt] & (~devpriv->ul_TTLPortConfiguration[b_Cpt]); + } + } + else + { + /****************************/ + /* Read all digital outputs */ + /****************************/ + + for (b_Cpt = 0; b_Cpt < b_NumberOfPort; b_Cpt ++) + { + /************************/ + /* Read the 32-Bit port */ + /************************/ + + pls_ReadData [b_Cpt] = inl(devpriv->iobase + 20 + (b_Cpt * 4)); + + /**************************************/ + /* Mask all channels used als outputs */ + /**************************************/ + + pls_ReadData [b_Cpt] = pls_ReadData [b_Cpt] & devpriv->ul_TTLPortConfiguration[b_Cpt]; + } + } + } + else + { + /*******************/ + /* Data size error */ + /*******************/ + + printk("\nBuffer size error"); + i_ReturnValue = -101; + } + } + else + { + /*****************/ + /* Command error */ + /*****************/ + + printk("\nCommand selection error"); + i_ReturnValue = -100; + } + + return (i_ReturnValue); + } + +/* ++----------------------------------------------------------------------------+ +| OUTPUT FUNCTIONS | ++----------------------------------------------------------------------------+ +*/ + +/* ++----------------------------------------------------------------------------+ +| Function Name : INT i_APCI16XX_InsnBitsWriteTTLIO | +| (comedi_device *dev, | +| comedi_subdevice *s, | +| comedi_insn *insn, | +| lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Set the state from selected TTL digital output | +| (b_OutputChannel) | ++----------------------------------------------------------------------------+ +| Task : Set the state from digital output port | +| (b_SelectedPort) | ++----------------------------------------------------------------------------+ +| Input Parameters : | +| APCI16XX_TTL_WRITECHANNEL_ON | APCI16XX_TTL_WRITECHANNEL_OFF | +| b_SelectedPort = CR_RANGE(insn->chanspec); | +| b_OutputChannel= CR_CHAN(insn->chanspec); | +| b_Command = (BYTE) data[0]; | +| | +| APCI16XX_TTL_WRITEPORT_ON | APCI16XX_TTL_WRITEPORT_OFF | +| b_SelectedPort = CR_RANGE(insn->chanspec); | +| b_Command = (BYTE) data[0]; | ++----------------------------------------------------------------------------+ +| Output Parameters : data[0] : TTL output port 0 to 3 data | +| data[1] : TTL output port 4 to 7 data | +| .... | ++----------------------------------------------------------------------------+ +| Return Value : >0 : No error | +| -100 : Command error | +| -101 : Data size error | +| -102 : The selected TTL output port is wrong | +| -103 : The selected TTL digital output is wrong | +| -104 : Output memory disabled | ++----------------------------------------------------------------------------+ +*/ + + +int i_APCI16XX_InsnBitsWriteTTLIO (comedi_device *dev, + comedi_subdevice *s, + comedi_insn *insn, + lsampl_t *data) + { + INT i_ReturnValue = insn->n; + BYTE b_Command = 0; + BYTE b_NumberOfPort = (BYTE) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 8); + BYTE b_SelectedPort = CR_RANGE(insn->chanspec); + BYTE b_OutputChannel = CR_CHAN(insn->chanspec); + DWORD dw_Status = 0; + + + /************************/ + /* Test the buffer size */ + /************************/ + + if (insn->n >= 1) + { + /*******************/ + /* Get the command */ + /* *****************/ + + b_Command = (BYTE) data[0]; + + /********************/ + /* Test the command */ + /********************/ + + if ((b_Command == APCI16XX_TTL_WRITECHANNEL_ON) || + (b_Command == APCI16XX_TTL_WRITEPORT_ON) || + (b_Command == APCI16XX_TTL_WRITECHANNEL_OFF) || + (b_Command == APCI16XX_TTL_WRITEPORT_OFF)) + { + /**************************/ + /* Test the selected port */ + /**************************/ + + if (b_SelectedPort < b_NumberOfPort) + { + /***********************/ + /* Test if output port */ + /***********************/ + + if (((devpriv->ul_TTLPortConfiguration[b_SelectedPort / 4] >> (8 * (b_SelectedPort % 4))) & 0xFF) == 0xFF) + { + /***************************/ + /* Test the channel number */ + /***************************/ + + if (((b_Command == APCI16XX_TTL_WRITECHANNEL_ON) || + (b_Command == APCI16XX_TTL_WRITECHANNEL_OFF)) && (b_OutputChannel > 7)) + { + /********************************************/ + /* The selected TTL digital output is wrong */ + /********************************************/ + + printk("\nChannel selection error"); + i_ReturnValue = -103; + } + + if (((b_Command == APCI16XX_TTL_WRITECHANNEL_OFF) || + (b_Command == APCI16XX_TTL_WRITEPORT_OFF)) && (devpriv->b_OutputMemoryStatus == ADDIDATA_DISABLE)) + { + /********************************************/ + /* The selected TTL digital output is wrong */ + /********************************************/ + + printk("\nOutput memory disabled"); + i_ReturnValue = -104; + } + + /************************/ + /* Test the buffer size */ + /************************/ + + if (((b_Command == APCI16XX_TTL_WRITEPORT_ON) || + (b_Command == APCI16XX_TTL_WRITEPORT_OFF)) && (insn->n < 2)) + { + /*******************/ + /* Data size error */ + /*******************/ + + printk("\nBuffer size error"); + i_ReturnValue = -101; + } + } + else + { + /*****************************************/ + /* The selected TTL output port is wrong */ + /*****************************************/ + + printk("\nPort selection error %lX", devpriv->ul_TTLPortConfiguration[0]); + i_ReturnValue = -102; + } + } + else + { + /****************************************/ + /* The selected TTL output port is wrong */ + /****************************************/ + + printk("\nPort selection error %d %d",b_SelectedPort , b_NumberOfPort); + i_ReturnValue = -102; + } + } + else + { + /************************/ + /* Config command error */ + /************************/ + + printk("\nCommand selection error"); + i_ReturnValue = -100; + } + } + else + { + /*******************/ + /* Data size error */ + /*******************/ + + printk("\nBuffer size error"); + i_ReturnValue = -101; + } + + + /**************************/ + /* Test if no error occur */ + /**************************/ + + if (i_ReturnValue >= 0) + { + /********************************/ + /* Get the digital output state */ + /********************************/ + + dw_Status = inl(devpriv->iobase + 20 + ((b_SelectedPort / 4) * 4)); + + /**********************************/ + /* Test if output memory not used */ + /**********************************/ + + if (devpriv->b_OutputMemoryStatus == ADDIDATA_DISABLE) + { + /*********************************/ + /* Clear the selected port value */ + /*********************************/ + + dw_Status = dw_Status & (0xFFFFFFFFUL - (0xFFUL << (8 * (b_SelectedPort % 4)))); + } + + /******************************/ + /* Test if setting channel ON */ + /******************************/ + + if (b_Command == APCI16XX_TTL_WRITECHANNEL_ON) + { + dw_Status = dw_Status | (1UL << ((8 * (b_SelectedPort % 4)) + b_OutputChannel)); + } + + /***************************/ + /* Test if setting port ON */ + /***************************/ + + if (b_Command == APCI16XX_TTL_WRITEPORT_ON) + { + dw_Status = dw_Status | ((data[1] & 0xFF) << (8 * (b_SelectedPort % 4))); + } + + /*******************************/ + /* Test if setting channel OFF */ + /*******************************/ + + if (b_Command == APCI16XX_TTL_WRITECHANNEL_OFF) + { + dw_Status = dw_Status & (0xFFFFFFFFUL - (1UL << ((8 * (b_SelectedPort % 4)) + b_OutputChannel))); + } + + /****************************/ + /* Test if setting port OFF */ + /****************************/ + + if (b_Command == APCI16XX_TTL_WRITEPORT_OFF) + { + dw_Status = dw_Status & (0xFFFFFFFFUL - ((data[1] & 0xFF) << (8 * (b_SelectedPort % 4)))); + } + + + outl(dw_Status, devpriv->iobase + 20 + ((b_SelectedPort / 4) * 4)); + } + + return (i_ReturnValue); + } + +/* ++----------------------------------------------------------------------------+ +| Function Name : int i_APCI2200_Reset(comedi_device *dev) | +----------------------------------------------------------------------------+ +| Task :resets all the registers | ++----------------------------------------------------------------------------+ +| Input Parameters : comedi_device *dev | ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value : - | ++----------------------------------------------------------------------------+ +*/ + +int i_APCI16XX_Reset(comedi_device *dev) + { + return 0; + } diff --git a/comedi/drivers/addi-data/hwdrv_apci16xx.h b/comedi/drivers/addi-data/hwdrv_apci16xx.h new file mode 100755 index 00000000..4f1517c0 --- /dev/null +++ b/comedi/drivers/addi-data/hwdrv_apci16xx.h @@ -0,0 +1,111 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ + + + +#ifndef COMEDI_SUBD_TTLIO + #define COMEDI_SUBD_TTLIO 11 /* Digital Input Output But TTL */ +#endif + +#ifndef ADDIDATA_ENABLE + #define ADDIDATA_ENABLE 1 + #define ADDIDATA_DISABLE 0 +#endif + +#define APCI16XX_TTL_INIT 0 +#define APCI16XX_TTL_INITDIRECTION 1 +#define APCI16XX_TTL_OUTPUTMEMORY 2 + + +#define APCI16XX_TTL_READCHANNEL 0 +#define APCI16XX_TTL_READPORT 1 + +#define APCI16XX_TTL_WRITECHANNEL_ON 0 +#define APCI16XX_TTL_WRITECHANNEL_OFF 1 +#define APCI16XX_TTL_WRITEPORT_ON 2 +#define APCI16XX_TTL_WRITEPORT_OFF 3 + +#define APCI16XX_TTL_READ_ALL_INPUTS 0 +#define APCI16XX_TTL_READ_ALL_OUTPUTS 1 + +#ifdef __KERNEL__ + + +comedi_lrange range_apci16xx_ttl= + {12, + {BIP_RANGE(1), + BIP_RANGE(1), + BIP_RANGE(1), + BIP_RANGE(1), + BIP_RANGE(1), + BIP_RANGE(1), + BIP_RANGE(1), + BIP_RANGE(1), + BIP_RANGE(1), + BIP_RANGE(1), + BIP_RANGE(1), + BIP_RANGE(1)}}; + +/* ++----------------------------------------------------------------------------+ +| TTL INISIALISATION FUNCTION | ++----------------------------------------------------------------------------+ +*/ + +int i_APCI16XX_InsnConfigInitTTLIO(comedi_device *dev, + comedi_subdevice *s, + comedi_insn *insn, + lsampl_t *data); + + +/* ++----------------------------------------------------------------------------+ +| TTL INPUT FUNCTION | ++----------------------------------------------------------------------------+ +*/ + + +int i_APCI16XX_InsnBitsReadTTLIO (comedi_device *dev, + comedi_subdevice *s, + comedi_insn *insn, + lsampl_t *data); + +int i_APCI16XX_InsnReadTTLIOAllPortValue (comedi_device *dev, + comedi_subdevice *s, + comedi_insn *insn, + lsampl_t *data); + +/* ++----------------------------------------------------------------------------+ +| TTL OUTPUT FUNCTIONS | ++----------------------------------------------------------------------------+ +*/ + +int i_APCI16XX_InsnBitsWriteTTLIO (comedi_device *dev, + comedi_subdevice *s, + comedi_insn *insn, + lsampl_t *data); + +int i_APCI16XX_Reset(comedi_device *dev) ; +#endif diff --git a/comedi/drivers/addi-data/hwdrv_apci2016.c b/comedi/drivers/addi-data/hwdrv_apci2016.c index d8af1168..69a81ee2 100644 --- a/comedi/drivers/addi-data/hwdrv_apci2016.c +++ b/comedi/drivers/addi-data/hwdrv_apci2016.c @@ -1,14 +1,38 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ /* + +-----------------------------------------------------------------------+ | (C) ADDI-DATA GmbH Dieselstraße 3 D-77833 Ottersweier | +-----------------------------------------------------------------------+ | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | +-------------------------------+---------------------------------------+ - | Project : 13Card Linux Driver | Compiler : GCC | - | Module name : hwdrv_apci2016.c| Version : 2.96 | + | Project : APCI-2016 | Compiler : GCC | + | Module name : hwdrv_apci2016.c| Version : 2.96 | +-------------------------------+---------------------------------------+ - | Author : Shitalkumar S Chavan | Date : 31.10.2001 | + | Project manager: Eric Stolz | Date : 02/12/2002 | +-------------------------------+---------------------------------------+ | Description : Hardware Layer Acces For APCI-2016 | +-----------------------------------------------------------------------+ @@ -27,13 +51,13 @@ | Included files | +----------------------------------------------------------------------------+ */ -#include "hwdrv_apci2016.h" +#include "hwdrv_apci2016.h" /* +----------------------------------------------------------------------------+ | Function Name : int i_APCI2016_ConfigDigitalOutput | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | +| (comedi_device *dev,comedi_subdevice *s, | +| comedi_insn *insn,lsampl_t *data) | +----------------------------------------------------------------------------+ | Task : Configures The Digital Output Subdevice. | +----------------------------------------------------------------------------+ @@ -53,27 +77,27 @@ */ int i_APCI2016_ConfigDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) { - if ((data[0]!=0) && (data[0]!=1)) - { - comedi_error(dev,"Not a valid Data !!! ,Data should be 1 or 0\n"); - return -EINVAL; - } // if ((data[0]!=0) && (data[0]!=1)) - if (data[0]) - { - devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE ; - } // if (data[0] - else - { - devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE; - } // else if (data[0] + if ((data[0]!=0) && (data[0]!=1)) + { + comedi_error(dev,"Not a valid Data !!! ,Data should be 1 or 0\n"); + return -EINVAL; + } // if ((data[0]!=0) && (data[0]!=1)) + if (data[0]) + { + devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE ; + } // if (data[0] + else + { + devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE; + } // else if (data[0] return insn->n; } /* +----------------------------------------------------------------------------+ | Function Name : int i_APCI2016_WriteDigitalOutput | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | +| (comedi_device *dev,comedi_subdevice *s, | +| comedi_insn *insn,lsampl_t *data) | +----------------------------------------------------------------------------+ | Task : Writes port value To the selected port | +----------------------------------------------------------------------------+ @@ -90,202 +114,202 @@ int i_APCI2016_ConfigDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi */ int i_APCI2016_WriteDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) { - UINT ui_NoOfChannel; - UINT ui_Temp,ui_Temp1; - ui_NoOfChannel=CR_CHAN(insn->chanspec); - if ((ui_NoOfChannel<0) || (ui_NoOfChannel>15)) - { - comedi_error(dev,"Invalid Channel Numbers !!!, Channel Numbers must be between 0 and 15\n"); - return -EINVAL; - } // if ((ui_NoOfChannel<0) || (ui_NoOfChannel>15)) - if (devpriv->b_OutputMemoryStatus ) - { - ui_Temp=inw(devpriv->iobase+APCI2016_DIGITAL_OP); - } // if (devpriv->b_OutputMemoryStatus ) - else - { - ui_Temp=0; - } // else if (devpriv->b_OutputMemoryStatus ) - if ((data[1]!=0) && (data[1]!=1)) - { - comedi_error(dev,"Invalid Data[1] value !!!, Data[1] should be 0 or 1\n"); - return -EINVAL; - } // if ((data[1]!=0) && (data[1]!=1)) - - if (data[3]==0) - { - if (data[1]==0) - { - data[0]=(data[0] << ui_NoOfChannel)|ui_Temp; - outw(data[0],devpriv->iobase+APCI2016_DIGITAL_OP); - } // if (data[1]==0) - else - { - if (data[1]==1) - { - switch (ui_NoOfChannel) - { - case 2: data[0]=(data[0] << (2*data[2]))|ui_Temp; - break; - case 4: data[0]=(data[0] << (4*data[2]))|ui_Temp; - break; - case 8: data[0]=(data[0] << (8*data[2]))|ui_Temp; - break; - case 15: data[0]=data[0]|ui_Temp; - break; - default: comedi_error(dev," chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " - }//switch(ui_NoOfChannels) - outw(data[0],devpriv->iobase+APCI2016_DIGITAL_OP); - }// if (data[1]==1) - else - { - printk("\nSpecified channel not supported\n"); - } // else if (data[1]==1) - } // else if (data[1]==0) - } // if (data[3]==0) - else - { - if (data[3]==1) - { - if (data[1]==0) - { - data[0]=~data[0]&0x1; - ui_Temp1=1; - ui_Temp1=ui_Temp1<iobase+APCI2016_DIGITAL_OP); - } // if (data[1]==0) - else - { - if (data[1]==1) - { - switch (ui_NoOfChannel) - { - case 2: data[0]=~data[0]&0x3; - ui_Temp1=3; - ui_Temp1=ui_Temp1<<2*data[2]; - ui_Temp=ui_Temp|ui_Temp1; - data[0]=((data[0] << (2*data[2]))^0xffff)& ui_Temp; - break; - case 4: data[0]=~data[0]&0xf; - ui_Temp1=15; - ui_Temp1=ui_Temp1<<4*data[2]; - ui_Temp=ui_Temp|ui_Temp1; - data[0]=((data[0] << (4*data[2]))^0xffff)&ui_Temp; - break; - case 8: data[0]=~data[0]&0xff; - ui_Temp1=255; - ui_Temp1=ui_Temp1<<8*data[2]; - ui_Temp=ui_Temp|ui_Temp1; - data[0]=((data[0] << (8*data[2]))^0xffff)&ui_Temp; - break; - case 15: break; - default: comedi_error(dev," chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " - }//switch(ui_NoOfChannels) - outw(data[0],devpriv->iobase+APCI2016_DIGITAL_OP); - }// if(data[1]==1) - else - { - printk("\nSpecified channel not supported\n"); - }//else if(data[1]==1) - }//elseif(data[1]==0) - }//if(data[3]==1); - else - { - printk("\nSpecified functionality does not exist\n"); - return -EINVAL; - }//if else data[3]==1) - }//if else data[3]==0) - return insn->n; -} + UINT ui_NoOfChannel; + UINT ui_Temp,ui_Temp1; + ui_NoOfChannel=CR_CHAN(insn->chanspec); + if ((ui_NoOfChannel<0) || (ui_NoOfChannel>15)) + { + comedi_error(dev,"Invalid Channel Numbers !!!, Channel Numbers must be between 0 and 15\n"); + return -EINVAL; + } // if ((ui_NoOfChannel<0) || (ui_NoOfChannel>15)) + if (devpriv->b_OutputMemoryStatus ) + { + ui_Temp=inw(devpriv->iobase+APCI2016_DIGITAL_OP); + } // if (devpriv->b_OutputMemoryStatus ) + else + { + ui_Temp=0; + } // else if (devpriv->b_OutputMemoryStatus ) + if ((data[1]!=0) && (data[1]!=1)) + { + comedi_error(dev,"Invalid Data[1] value !!!, Data[1] should be 0 or 1\n"); + return -EINVAL; + } // if ((data[1]!=0) && (data[1]!=1)) + + if (data[3]==0) + { + if (data[1]==0) + { + data[0]=(data[0] << ui_NoOfChannel)|ui_Temp; + outw(data[0],devpriv->iobase+APCI2016_DIGITAL_OP); + } // if (data[1]==0) + else + { + if (data[1]==1) + { + switch (ui_NoOfChannel) + { + case 2: data[0]=(data[0] << (2*data[2]))|ui_Temp; + break; + case 4: data[0]=(data[0] << (4*data[2]))|ui_Temp; + break; + case 8: data[0]=(data[0] << (8*data[2]))|ui_Temp; + break; + case 15: data[0]=data[0]|ui_Temp; + break; + default: comedi_error(dev," chan spec wrong"); + return -EINVAL; // "sorry channel spec wrong " + }//switch(ui_NoOfChannels) + outw(data[0],devpriv->iobase+APCI2016_DIGITAL_OP); + }// if (data[1]==1) + else + { + printk("\nSpecified channel not supported\n"); + } // else if (data[1]==1) + } // else if (data[1]==0) + } // if (data[3]==0) + else + { + if (data[3]==1) + { + if (data[1]==0) + { + data[0]=~data[0]&0x1; + ui_Temp1=1; + ui_Temp1=ui_Temp1<iobase+APCI2016_DIGITAL_OP); + } // if (data[1]==0) + else + { + if (data[1]==1) + { + switch (ui_NoOfChannel) + { + case 2: data[0]=~data[0]&0x3; + ui_Temp1=3; + ui_Temp1=ui_Temp1<<2*data[2]; + ui_Temp=ui_Temp|ui_Temp1; + data[0]=((data[0] << (2*data[2]))^0xffff)& ui_Temp; + break; + case 4: data[0]=~data[0]&0xf; + ui_Temp1=15; + ui_Temp1=ui_Temp1<<4*data[2]; + ui_Temp=ui_Temp|ui_Temp1; + data[0]=((data[0] << (4*data[2]))^0xffff)&ui_Temp; + break; + case 8: data[0]=~data[0]&0xff; + ui_Temp1=255; + ui_Temp1=ui_Temp1<<8*data[2]; + ui_Temp=ui_Temp|ui_Temp1; + data[0]=((data[0] << (8*data[2]))^0xffff)&ui_Temp; + break; + case 15: break; + default: comedi_error(dev," chan spec wrong"); + return -EINVAL; // "sorry channel spec wrong " + }//switch(ui_NoOfChannels) + outw(data[0],devpriv->iobase+APCI2016_DIGITAL_OP); + }// if(data[1]==1) + else + { + printk("\nSpecified channel not supported\n"); + }//else if(data[1]==1) + }//elseif(data[1]==0) + }//if(data[3]==1); + else + { + printk("\nSpecified functionality does not exist\n"); + return -EINVAL; + }//if else data[3]==1) + }//if else data[3]==0) + return insn->n; +} + +/* ++----------------------------------------------------------------------------+ +| Function Name : int i_APCI2016_BitsDigitalOutput | +| (comedi_device *dev,comedi_subdevice *s, | +| comedi_insn *insn,lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Read value of the selected channel or port | ++----------------------------------------------------------------------------+ +| Input Parameters : comedi_device *dev : Driver handle | +| UINT ui_NoOfChannels : No Of Channels To read | +| UINT *data : Data Pointer to read status | ++----------------------------------------------------------------------------+ +| Output Parameters : -- | ++----------------------------------------------------------------------------+ +| Return Value : TRUE : No error occur | +| : FALSE : Error occur. Return the error | +| | ++----------------------------------------------------------------------------+ +*/ +int i_APCI2016_BitsDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) +{ + UINT ui_Temp; + UINT ui_NoOfChannel; + ui_NoOfChannel=CR_CHAN(insn->chanspec); + if ((ui_NoOfChannel<0) || (ui_NoOfChannel>15)) + { + comedi_error(dev,"Invalid Channel Numbers !!!, Channel Numbers must be between 0 and 15\n"); + return -EINVAL; + } // if ((ui_NoOfChannel<0) || (ui_NoOfChannel>15)) + if ((data[0]!=0) && (data[0]!=1)) + { + comedi_error(dev,"Invalid Data[0] value !!!, Data[0] should be 0 or 1\n"); + return -EINVAL; + } // if ((data[0]!=0) && (data[0]!=1)) + ui_Temp=data[0]; + *data=inw(devpriv->iobase+APCI2016_DIGITAL_OP_RW); + if (ui_Temp==0) + { + *data=(*data >> ui_NoOfChannel)&0x1; + } // if (ui_Temp==0) + else + { + if (ui_Temp==1) + { + switch (ui_NoOfChannel) + { + case 2: *data=(*data >>(2*data[1]))&3; + break; + + case 4: *data=(*data >>(4*data[1]))&15; + break; + + case 8: *data=(*data >>(8*data[1]))&255; + break; + + case 15: break; + + default: + comedi_error(dev," chan spec wrong"); + return -EINVAL; // "sorry channel spec wrong " + }//switch(ui_NoOfChannel) + } // if (ui_Temp==1) + else + { + printk("\nSpecified channel not supported \n"); + } // else if (ui_Temp==1) + } // if (ui_Temp==0) + return insn->n; +} + -/* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI2016_BitsDigitalOutput | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Read value of the selected channel or port | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To read | -| UINT *data : Data Pointer to read status | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ -*/ -int i_APCI2016_BitsDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) -{ - UINT ui_Temp; - UINT ui_NoOfChannel; - ui_NoOfChannel=CR_CHAN(insn->chanspec); - if ((ui_NoOfChannel<0) || (ui_NoOfChannel>15)) - { - comedi_error(dev,"Invalid Channel Numbers !!!, Channel Numbers must be between 0 and 15\n"); - return -EINVAL; - } // if ((ui_NoOfChannel<0) || (ui_NoOfChannel>15)) - if ((data[0]!=0) && (data[0]!=1)) - { - comedi_error(dev,"Invalid Data[0] value !!!, Data[0] should be 0 or 1\n"); - return -EINVAL; - } // if ((data[0]!=0) && (data[0]!=1)) - ui_Temp=data[0]; - *data=inw(devpriv->iobase+APCI2016_DIGITAL_OP_RW); - if (ui_Temp==0) - { - *data=(*data >> ui_NoOfChannel)&0x1; - } // if (ui_Temp==0) - else - { - if (ui_Temp==1) - { - switch (ui_NoOfChannel) - { - case 2: *data=(*data >>(2*data[1]))&3; - break; - - case 4: *data=(*data >>(4*data[1]))&15; - break; - - case 8: *data=(*data >>(8*data[1]))&255; - break; - - case 15: break; - - default: - comedi_error(dev," chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " - }//switch(ui_NoOfChannel) - } // if (ui_Temp==1) - else - { - printk("\nSpecified channel not supported \n"); - } // else if (ui_Temp==1) - } // if (ui_Temp==0) - return insn->n; -} - - /* +----------------------------------------------------------------------------+ | Function Name : int i_APCI2016_ConfigWatchdog | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | +| (comedi_device *dev,comedi_subdevice *s, | +| comedi_insn *insn,lsampl_t *data) | +----------------------------------------------------------------------------+ | Task : Configures The Watchdog | +----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| comedi_subdevice *s, :pointer to subdevice structure | -| comedi_insn *insn :pointer to insn structure | -| lsampl_t *data : Data Pointer to read status | +| Input Parameters : comedi_device *dev : Driver handle | +| comedi_subdevice *s, :pointer to subdevice structure | +| comedi_insn *insn :pointer to insn structure | +| lsampl_t *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -295,37 +319,37 @@ int i_APCI2016_BitsDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_i +----------------------------------------------------------------------------+ */ int i_APCI2016_ConfigWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) -{ - - if (data[0]==0) - { - //Disable the watchdog - outw(0x0,devpriv->i_IobaseAddon+ APCI2016_WATCHDOG_ENABLEDISABLE); - //Loading the Reload value - outw(data[1],devpriv->i_IobaseAddon+APCI2016_WATCHDOG_RELOAD_VALUE); - data[1]=data[1]>>16; - outw(data[1],devpriv->i_IobaseAddon+APCI2016_WATCHDOG_RELOAD_VALUE+2); - } - else - { - printk("\nThe input parameters are wrong\n"); - } - return insn->n; -} - - +{ + + if (data[0]==0) + { + //Disable the watchdog + outw(0x0,devpriv->i_IobaseAddon+ APCI2016_WATCHDOG_ENABLEDISABLE); + //Loading the Reload value + outw(data[1],devpriv->i_IobaseAddon+APCI2016_WATCHDOG_RELOAD_VALUE); + data[1]=data[1]>>16; + outw(data[1],devpriv->i_IobaseAddon+APCI2016_WATCHDOG_RELOAD_VALUE+2); + } + else + { + printk("\nThe input parameters are wrong\n"); + } + return insn->n; +} + + /* +----------------------------------------------------------------------------+ | Function Name : int i_APCI2016_StartStopWriteWatchdog | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | +| (comedi_device *dev,comedi_subdevice *s, | +| comedi_insn *insn,lsampl_t *data) | +----------------------------------------------------------------------------+ | Task : Start / Stop The Watchdog | +----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| comedi_subdevice *s, :pointer to subdevice structure | -| comedi_insn *insn :pointer to insn structure | -| lsampl_t *data : Data Pointer to read status | +| Input Parameters : comedi_device *dev : Driver handle | +| comedi_subdevice *s, :pointer to subdevice structure | +| comedi_insn *insn :pointer to insn structure | +| lsampl_t *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -335,38 +359,39 @@ int i_APCI2016_ConfigWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn +----------------------------------------------------------------------------+ */ int i_APCI2016_StartStopWriteWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) -{ - - switch(data[0]) - { - case 0://stop the watchdog - outw(0x0,devpriv->i_IobaseAddon+ APCI2016_WATCHDOG_ENABLEDISABLE);//disable the watchdog - break; - case 1://start the watchdog - outw(0x0001,devpriv->i_IobaseAddon+ APCI2016_WATCHDOG_ENABLEDISABLE); - break; - case 2://Software trigger - outw(0x0201,devpriv->i_IobaseAddon+ APCI2016_WATCHDOG_ENABLEDISABLE); - break; - default:printk("\nSpecified functionality does not exist\n"); - return -EINVAL; - }// switch(data[0]) - - return insn->n; -} - +{ + + switch(data[0]) + { + case 0://stop the watchdog + outw(0x0,devpriv->i_IobaseAddon+ APCI2016_WATCHDOG_ENABLEDISABLE);//disable the watchdog + break; + case 1://start the watchdog + outw(0x0001,devpriv->i_IobaseAddon+ APCI2016_WATCHDOG_ENABLEDISABLE); + break; + case 2://Software trigger + outw(0x0201,devpriv->i_IobaseAddon+ APCI2016_WATCHDOG_ENABLEDISABLE); + break; + default:printk("\nSpecified functionality does not exist\n"); + return -EINVAL; + }// switch(data[0]) + + return insn->n; +} + + /* +----------------------------------------------------------------------------+ | Function Name : int i_APCI2016_ReadWatchdog | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | +| (comedi_device *dev,comedi_subdevice *s, | +| comedi_insn *insn,lsampl_t *data) | +----------------------------------------------------------------------------+ | Task : Read The Watchdog | +----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| comedi_subdevice *s, :pointer to subdevice structure | -| comedi_insn *insn :pointer to insn structure | -| lsampl_t *data : Data Pointer to read status | +| Input Parameters : comedi_device *dev : Driver handle | +| comedi_subdevice *s, :pointer to subdevice structure | +| comedi_insn *insn :pointer to insn structure | +| lsampl_t *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -374,34 +399,35 @@ int i_APCI2016_StartStopWriteWatchdog(comedi_device *dev,comedi_subdevice *s,com | : FALSE : Error occur. Return the error | | | +----------------------------------------------------------------------------+ -*/ -int i_APCI2016_ReadWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) -{ - udelay(5); - data[0]= inw(devpriv->i_IobaseAddon+APCI2016_WATCHDOG_STATUS)&0x1; - return insn->n; -} - -/* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI2016_Reset(comedi_device *dev) | | -+----------------------------------------------------------------------------+ -| Task :resets all the registers | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : | -| | -+----------------------------------------------------------------------------+ -*/ - -INT i_APCI2016_Reset(comedi_device *dev) -{ - outw(0x0,devpriv->iobase+APCI2016_DIGITAL_OP); // Resets the digital output channels - outw(0x0,devpriv->i_IobaseAddon+ APCI2016_WATCHDOG_ENABLEDISABLE); - outw(0x0,devpriv->i_IobaseAddon+APCI2016_WATCHDOG_RELOAD_VALUE); - outw(0x0,devpriv->i_IobaseAddon+APCI2016_WATCHDOG_RELOAD_VALUE+2); - return 0; -} \ No newline at end of file +*/ + +int i_APCI2016_ReadWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) +{ + udelay(5); + data[0]= inw(devpriv->i_IobaseAddon+APCI2016_WATCHDOG_STATUS)&0x1; + return insn->n; +} + +/* ++----------------------------------------------------------------------------+ +| Function Name : int i_APCI2016_Reset(comedi_device *dev) | | ++----------------------------------------------------------------------------+ +| Task :resets all the registers | ++----------------------------------------------------------------------------+ +| Input Parameters : comedi_device *dev ++----------------------------------------------------------------------------+ +| Output Parameters : -- | ++----------------------------------------------------------------------------+ +| Return Value : | +| | ++----------------------------------------------------------------------------+ +*/ + +INT i_APCI2016_Reset(comedi_device *dev) +{ + outw(0x0,devpriv->iobase+APCI2016_DIGITAL_OP); // Resets the digital output channels + outw(0x0,devpriv->i_IobaseAddon+ APCI2016_WATCHDOG_ENABLEDISABLE); + outw(0x0,devpriv->i_IobaseAddon+APCI2016_WATCHDOG_RELOAD_VALUE); + outw(0x0,devpriv->i_IobaseAddon+APCI2016_WATCHDOG_RELOAD_VALUE+2); + return 0; +} diff --git a/comedi/drivers/addi-data/hwdrv_apci2016.h b/comedi/drivers/addi-data/hwdrv_apci2016.h index 2d1c8f2f..3659aa03 100644 --- a/comedi/drivers/addi-data/hwdrv_apci2016.h +++ b/comedi/drivers/addi-data/hwdrv_apci2016.h @@ -1,8 +1,31 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ /********* Definitions for APCI-2016 card *****/ -#define APCI2016_BOARD_VENDOR_ID 0x15B8 -#define APCI2016_ADDRESS_RANGE 8 - +#define APCI2016_BOARD_VENDOR_ID 0x15B8 +#define APCI2016_ADDRESS_RANGE 8 + //DIGITAL INPUT-OUTPUT DEFINE @@ -22,32 +45,32 @@ #define APCI2016_WATCHDOG_RELOAD_VALUE 4 #define APCI2016_WATCHDOG_STATUS 16 - + // Hardware Layer functions for Apci2016 //DO int i_APCI2016_ConfigDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) ; -int i_APCI2016_WriteDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); - +int i_APCI2016_WriteDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); + int i_APCI2016_BitsDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); // TIMER // timer value is passed as u seconds - + int i_APCI2016_ConfigWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) ; int i_APCI2016_StartStopWriteWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); -int i_APCI2016_ReadWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); - - -// Interrupt functions..... - -// VOID v_APCI2016_Interrupt(int irq, void *d, struct pt_regs *regs) ; - - //VOID v_APCI2016_Interrupt(int irq, void *d, struct pt_regs *regs); -// RESET -INT i_APCI2016_Reset(comedi_device *dev); +int i_APCI2016_ReadWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); + + +// Interrupt functions..... + +// VOID v_APCI2016_Interrupt(int irq, void *d, struct pt_regs *regs) ; + + //VOID v_APCI2016_Interrupt(int irq, void *d, struct pt_regs *regs); +// RESET +INT i_APCI2016_Reset(comedi_device *dev); diff --git a/comedi/drivers/addi-data/hwdrv_apci2032.c b/comedi/drivers/addi-data/hwdrv_apci2032.c index a22a1d7a..1b1535ab 100644 --- a/comedi/drivers/addi-data/hwdrv_apci2032.c +++ b/comedi/drivers/addi-data/hwdrv_apci2032.c @@ -1,14 +1,38 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ /* + +-----------------------------------------------------------------------+ | (C) ADDI-DATA GmbH Dieselstraße 3 D-77833 Ottersweier | +-----------------------------------------------------------------------+ | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | +-------------------------------+---------------------------------------+ - | Project : 13Card Linux Driver | Compiler : GCC | - | Module name : hwdrv_apci2032.c| Version : 2.96 | + | Project : APCI-2032 | Compiler : GCC | + | Module name : hwdrv_apci2032.c| Version : 2.96 | +-------------------------------+---------------------------------------+ - | Author : Shitalkumar S Chavan | Date : 31.10.2001 | + | Project manager: Eric Stolz | Date : 02/12/2002 | +-------------------------------+---------------------------------------+ | Description : Hardware Layer Acces For APCI-2032 | +-----------------------------------------------------------------------+ diff --git a/comedi/drivers/addi-data/hwdrv_apci2032.h b/comedi/drivers/addi-data/hwdrv_apci2032.h index 0e642866..839c84cb 100644 --- a/comedi/drivers/addi-data/hwdrv_apci2032.h +++ b/comedi/drivers/addi-data/hwdrv_apci2032.h @@ -1,9 +1,32 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ /********* Definitions for APCI-2032 card *****/ - -// Card Specific information -#define APCI2032_BOARD_VENDOR_ID 0x15B8 -#define APCI2032_ADDRESS_RANGE 63 - + +// Card Specific information +#define APCI2032_BOARD_VENDOR_ID 0x15B8 +#define APCI2032_ADDRESS_RANGE 63 + //DIGITAL INPUT-OUTPUT DEFINE @@ -11,7 +34,7 @@ #define APCI2032_DIGITAL_OP_RW 0 #define APCI2032_DIGITAL_OP_INTERRUPT 4 #define APCI2032_DIGITAL_OP_IRQ 12 - + //Digital Output Interrupt Status #define APCI2032_DIGITAL_OP_INTERRUPT_STATUS 8 @@ -29,13 +52,13 @@ // TIMER COUNTER WATCHDOG DEFINES #define ADDIDATA_WATCHDOG 2 -#define APCI2032_DIGITAL_OP_WATCHDOG 16 +#define APCI2032_DIGITAL_OP_WATCHDOG 16 #define APCI2032_TCW_RELOAD_VALUE 4 #define APCI2032_TCW_TIMEBASE 8 #define APCI2032_TCW_PROG 12 #define APCI2032_TCW_TRIG_STATUS 16 #define APCI2032_TCW_IRQ 20 - + @@ -44,19 +67,19 @@ //DO int i_APCI2032_ConfigDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); -INT i_APCI2032_WriteDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); -INT i_APCI2032_ReadDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); -int i_APCI2032_ReadInterruptStatus(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +INT i_APCI2032_WriteDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +INT i_APCI2032_ReadDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +int i_APCI2032_ReadInterruptStatus(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); // TIMER // timer value is passed as u seconds INT i_APCI2032_ConfigWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); -int i_APCI2032_StartStopWriteWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); -int i_APCI2032_ReadWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); - +int i_APCI2032_StartStopWriteWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +int i_APCI2032_ReadWatchdog(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); + // Interrupt functions..... void v_APCI2032_Interrupt(int irq, void *d, struct pt_regs *regs) ; - -//Reset functions - int i_APCI2032_Reset(comedi_device *dev); + +//Reset functions + int i_APCI2032_Reset(comedi_device *dev); diff --git a/comedi/drivers/addi-data/hwdrv_apci2200.c b/comedi/drivers/addi-data/hwdrv_apci2200.c index d530b0bb..46024efb 100644 --- a/comedi/drivers/addi-data/hwdrv_apci2200.c +++ b/comedi/drivers/addi-data/hwdrv_apci2200.c @@ -1,14 +1,38 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ /* + +-----------------------------------------------------------------------+ | (C) ADDI-DATA GmbH Dieselstraße 3 D-77833 Ottersweier | +-----------------------------------------------------------------------+ | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | +-------------------------------+---------------------------------------+ - | Project : 13Card Linux Driver | Compiler : GCC | - | Module name : hwdrv_apci2200.c| Version : 2.96 | + | Project : APCI-2200 | Compiler : GCC | + | Module name : hwdrv_apci2200.c| Version : 2.96 | +-------------------------------+---------------------------------------+ - | Author : Karl Andrade | Date : 18.12.2001 | + | Project manager: Eric Stolz | Date : 02/12/2002 | +-------------------------------+---------------------------------------+ | Description : Hardware Layer Acces For APCI-2200 | +-----------------------------------------------------------------------+ diff --git a/comedi/drivers/addi-data/hwdrv_apci2200.h b/comedi/drivers/addi-data/hwdrv_apci2200.h index a71d1668..574bacc2 100644 --- a/comedi/drivers/addi-data/hwdrv_apci2200.h +++ b/comedi/drivers/addi-data/hwdrv_apci2200.h @@ -1,3 +1,26 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ /********* Definitions for APCI-2200 card *****/ // Card Specific information diff --git a/comedi/drivers/addi-data/hwdrv_apci3120.c b/comedi/drivers/addi-data/hwdrv_apci3120.c index effd7b64..f6929a73 100644 --- a/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -1,6 +1,26 @@ +/** +@verbatim +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ /* +-----------------------------------------------------------------------+ | (C) ADDI-DATA GmbH Dieselstrasse 3 D-77833 Ottersweier | @@ -8,27 +28,19 @@ | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | +-----------------------------------------------------------------------+ - | Project : ADDI DATA | Compiler : GCC | - | Modulname : hwdrv_apci3120.c | Version : 2.96 Redhat Linux | - | | kernel-2.4.2 | + | Project : APCI-3120 | Compiler : GCC | + | Module name : hwdrv_apci3120.c| Version : 2.96 | +-------------------------------+---------------------------------------+ - | Author : | Date : | + | Project manager: Eric Stolz | Date : 02/12/2002 | +-----------------------------------------------------------------------+ - | Description :APCI3120 Module . Hardware abstraction Layer for APCI3120| + | Description :APCI3120 Module. Hardware abstraction Layer for APCI3120| +-----------------------------------------------------------------------+ | UPDATE'S | +-----------------------------------------------------------------------+ | Date | Author | Description of updates | +----------+-----------+------------------------------------------------+ - | | | | - | | | | - | | | | - | | | | - | | | | - +----------+-----------+------------------------------------------------+ - | | | | - | | | | - | | | | + | | | | + | | | | +----------+-----------+------------------------------------------------+ */ @@ -74,7 +86,7 @@ int i_APCI3120_InsnConfigAnalogInput(comedi_device *dev,comedi_subdevice *s,come lsampl_t *data) { UINT i; - + if((data[0] != APCI3120_EOC_MODE) && (data[0] != APCI3120_EOS_MODE)) return -1 ; @@ -160,6 +172,7 @@ int i_APCI3120_InsnReadAnalogInput(comedi_device *dev, comedi_subdevice *s, USHORT us_ConvertTiming,us_TmpValue,i; BYTE b_Tmp; + // fix convertion time to 10 us if(!devpriv->ui_EocEosConversionTime) { @@ -174,7 +187,7 @@ int i_APCI3120_InsnReadAnalogInput(comedi_device *dev, comedi_subdevice *s, devpriv->b_TimerSelectMode=0; devpriv->b_ModeSelectRegister=0; devpriv->us_OutputRegister=0; - devpriv->b_DigitalOutputRegister=0; +// devpriv->b_DigitalOutputRegister=0; if(insn->unused[0]==222)// second insn read { @@ -190,16 +203,17 @@ int i_APCI3120_InsnReadAnalogInput(comedi_device *dev, comedi_subdevice *s, devpriv->tsk_Current=current; // Save the current process task structure //Testing if board have the new Quartz and calculate the time value //to set in the timer + + us_TmpValue=(USHORT) inw(devpriv->iobase+APCI3120_RD_STATUS); - us_TmpValue=(USHORT) inw(devpriv->iobase+APCI3120_RD_STATUS); - if((us_TmpValue & 0x00B0)==0x00B0) + //EL250804: Testing if board APCI3120 have the new Quartz or if it is an APCI3001 + if((us_TmpValue & 0x00B0)==0x00B0 || !strcmp(this_board->pc_DriverName,"apci3001") ) { - us_ConvertTiming=(us_ConvertTiming * 2) -2; + us_ConvertTiming=(us_ConvertTiming * 2) -2; } else { - us_ConvertTiming=((us_ConvertTiming * 12926)/10000) -1; - + us_ConvertTiming=((us_ConvertTiming * 12926)/10000) -1; } us_TmpValue=(USHORT)devpriv->b_InterruptMode; @@ -249,7 +263,7 @@ int i_APCI3120_InsnReadAnalogInput(comedi_device *dev, comedi_subdevice *s, outw(devpriv->us_OutputRegister,devpriv->iobase+APCI3120_WR_ADDRESS); // Select Timer 0 - b_Tmp=((devpriv->b_DigitalOutputRegister<<4) & 0xF0) | APCI3120_SELECT_TIMER_0_WORD; + b_Tmp=((devpriv->b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_0_WORD; outb(b_Tmp,devpriv->iobase+APCI3120_TIMER_CRT0); @@ -286,19 +300,17 @@ int i_APCI3120_InsnReadAnalogInput(comedi_device *dev, comedi_subdevice *s, // clear PA PR and disable timer 0 devpriv->us_OutputRegister=(devpriv->us_OutputRegister & APCI3120_CLEAR_PA_PR) | APCI3120_DISABLE_TIMER0; - + outw(devpriv->us_OutputRegister,devpriv->iobase+APCI3120_WR_ADDRESS); - - + if (!i_APCI3120_SetupChannelList(dev,s,devpriv->ui_AiNbrofChannels,devpriv->ui_AiChannelList,0)) return -EINVAL; //Initialize Timer 0 mode 2 devpriv->b_TimerSelectMode = (devpriv->b_TimerSelectMode & 0xFC) | APCI3120_TIMER_0_MODE_2; outb(devpriv->b_TimerSelectMode,devpriv->iobase+APCI3120_TIMER_CRT1); - - + //Select Timer 0 - b_Tmp=((devpriv->b_DigitalOutputRegister<<4) & 0xF0) | APCI3120_SELECT_TIMER_0_WORD; + b_Tmp=((devpriv->b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_0_WORD; outb(b_Tmp,devpriv->iobase+APCI3120_TIMER_CRT0); //Set the convertion time @@ -307,7 +319,7 @@ int i_APCI3120_InsnReadAnalogInput(comedi_device *dev, comedi_subdevice *s, //Set the scan bit devpriv->b_ModeSelectRegister=devpriv->b_ModeSelectRegister | APCI3120_ENABLE_SCAN; outb(devpriv->b_ModeSelectRegister,devpriv->iobase+APCI3120_WRITE_MODE_SELECT); - + //If Interrupt function is loaded if(devpriv->b_EocEosInterrupt==APCI3120_ENABLE) { @@ -326,7 +338,7 @@ int i_APCI3120_InsnReadAnalogInput(comedi_device *dev, comedi_subdevice *s, //Sets gate 0 - devpriv->us_OutputRegister=devpriv->us_OutputRegister | APCI3120_ENABLE_TIMER0; + devpriv->us_OutputRegister=devpriv->us_OutputRegister | APCI3120_ENABLE_TIMER0; outw(devpriv->us_OutputRegister,devpriv->iobase+APCI3120_WR_ADDRESS); //Start conversion @@ -344,10 +356,9 @@ int i_APCI3120_InsnReadAnalogInput(comedi_device *dev, comedi_subdevice *s, for(i=0;i< devpriv->ui_AiNbrofChannels;i++) { - //Read the result in FIFO and write them in shared memory - us_TmpValue=inw(devpriv->iobase); - data[i]=(UINT) us_TmpValue; - + //Read the result in FIFO and write them in shared memory + us_TmpValue=inw(devpriv->iobase); + data[i]=(UINT) us_TmpValue; } devpriv->b_InterruptMode = APCI3120_EOC_MODE; // Restore defaults. @@ -428,8 +439,7 @@ int i_APCI3120_StopCyclicAcquisition(comedi_device *dev,comedi_subdevice *s) devpriv->b_AiCyclicAcquisition=APCI3120_DISABLE; devpriv->b_InterruptMode=APCI3120_EOC_MODE; devpriv->b_EocEosInterrupt=APCI3120_DISABLE; - i_APCI3120_Reset(dev); - //printk("Stopped cyclic acquisition\n"); + i_APCI3120_Reset(dev); return 0; } @@ -459,6 +469,7 @@ int i_APCI3120_CommandTestAnalogInput(comedi_device *dev,comedi_subdevice *s,com // step 1: make sure trigger sources are trivially valid + tmp=cmd->start_src; cmd->start_src &= TRIG_NOW|TRIG_EXT; if(!cmd->start_src || tmp!=cmd->start_src)err++; @@ -621,14 +632,17 @@ int i_APCI3120_CommandTestAnalogInput(comedi_device *dev,comedi_subdevice *s,com int i_APCI3120_CommandAnalogInput(comedi_device *dev,comedi_subdevice *s) { comedi_cmd *cmd=&s->async->cmd; - + //loading private structure with cmd structure inputs devpriv->ui_AiFlags=cmd->flags; devpriv->ui_AiNbrofChannels=cmd->chanlist_len; devpriv->ui_AiScanLength=cmd->scan_end_arg; devpriv->pui_AiChannelList=cmd->chanlist; - devpriv->AiData=s->async->data; - devpriv->ui_AiDataLength=s->async->data_len; + + //UPDATE-0.7.57->0.7.68devpriv->AiData=s->async->data; + devpriv->AiData=s->async->prealloc_buf; + //UPDATE-0.7.57->0.7.68devpriv->ui_AiDataLength=s->async->data_len; + devpriv->ui_AiDataLength=s->async->prealloc_bufsz; if (cmd->stop_src==TRIG_COUNT) { @@ -695,67 +709,93 @@ int i_APCI3120_CommandTestAnalogInput(comedi_device *dev,comedi_subdevice *s,com */ int i_APCI3120_CyclicAnalogInput(int mode, comedi_device * dev,comedi_subdevice * s) -{ - float f_DelayValue,f_ConvertValue; +{ BYTE b_Tmp; UINT ui_Tmp,ui_DelayTiming=0,ui_TimerValue1=0,dmalen0=0,dmalen1=0,ui_TimerValue2=0,ui_TimerValue0,ui_ConvertTiming; USHORT us_TmpValue; - - devpriv->b_AiCyclicAcquisition=APCI3120_ENABLE; - //Flush FIFO - inb(dev->iobase+APCI3120_RESET_FIFO); - inw(dev->iobase+APCI3120_RD_STATUS); - - - // clear software registers - - devpriv->b_TimerSelectMode=0; - devpriv->b_DigitalOutputRegister=0; - devpriv->us_OutputRegister=0; - devpriv->b_ModeSelectRegister=0; - - /****************************/ - /* Clear Timer Write TC INT */ - /****************************/ - - outl(APCI3120_CLEAR_WRITE_TC_INT,devpriv->i_IobaseAmcc+ APCI3120_AMCC_OP_REG_INTCSR); - - /************************************/ - /* Clears the timer status register */ - /************************************/ - inw(dev->iobase+APCI3120_TIMER_STATUS_REGISTER); - - - /**************************/ - /* Disables All Timer */ - /* Sets PR and PA to 0 */ - /**************************/ - - devpriv->us_OutputRegister = devpriv->us_OutputRegister &APCI3120_DISABLE_TIMER0 & APCI3120_DISABLE_TIMER1 &APCI3120_CLEAR_PA_PR ; - outw(devpriv->us_OutputRegister,dev->iobase+APCI3120_WR_ADDRESS); - - - devpriv->ui_AiActualScan=0; - devpriv->ui_AiActualScanPosition=0; - s->async->cur_chan=0; - devpriv->ui_AiBufferPtr=0; - devpriv->ui_DmaActualBuffer=0; - - + //BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver + //devpriv->b_AiCyclicAcquisition=APCI3120_ENABLE; + //END JK 07.05.04: Comparison between WIN32 and Linux driver + + /*******************/ + /* Resets the FIFO */ + /*******************/ + inb(dev->iobase + APCI3120_RESET_FIFO); + + //BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver + //inw(dev->iobase+APCI3120_RD_STATUS); + //END JK 07.05.04: Comparison between WIN32 and Linux driver + + /***************************/ + /* Acquisition initialized */ + /***************************/ + //BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver + devpriv->b_AiCyclicAcquisition = APCI3120_ENABLE; + //END JK 07.05.04: Comparison between WIN32 and Linux driver - ui_TimerValue2 = devpriv->ui_AiNbrofScans-2; // value for timer2 minus -2 has to be done .....dunno y?? - ui_ConvertTiming=devpriv->ui_AiTimer0; + + // clear software registers + devpriv->b_TimerSelectMode=0; + devpriv->us_OutputRegister=0; + devpriv->b_ModeSelectRegister=0; + //devpriv->b_DigitalOutputRegister=0; + + //COMMENT JK 07.05.04: Followings calls are in i_APCI3120_StartAnalogInputAcquisition + + /****************************/ + /* Clear Timer Write TC INT */ + /****************************/ + outl(APCI3120_CLEAR_WRITE_TC_INT,devpriv->i_IobaseAmcc+ APCI3120_AMCC_OP_REG_INTCSR); + + /************************************/ + /* Clears the timer status register */ + /************************************/ + //BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver + //inw(dev->iobase+APCI3120_TIMER_STATUS_REGISTER); + inb(dev->iobase+APCI3120_TIMER_STATUS_REGISTER); + //END JK 07.05.04: Comparison between WIN32 and Linux driver + + /**************************/ + /* Disables All Timer */ + /* Sets PR and PA to 0 */ + /**************************/ + devpriv->us_OutputRegister = devpriv->us_OutputRegister & + APCI3120_DISABLE_TIMER0 & + APCI3120_DISABLE_TIMER1 & + APCI3120_CLEAR_PA_PR; + + outw(devpriv->us_OutputRegister,dev->iobase + APCI3120_WR_ADDRESS); + + /*******************/ + /* Resets the FIFO */ + /*******************/ + //BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver + inb (devpriv->iobase + APCI3120_RESET_FIFO); + //END JK 07.05.04: Comparison between WIN32 and Linux driver + + devpriv->ui_AiActualScan=0; + devpriv->ui_AiActualScanPosition=0; + s->async->cur_chan=0; + devpriv->ui_AiBufferPtr=0; + devpriv->ui_DmaActualBuffer=0; + + // value for timer2 minus -2 has to be done .....dunno y?? + ui_TimerValue2 = devpriv->ui_AiNbrofScans-2; + ui_ConvertTiming=devpriv->ui_AiTimer0; - if(mode==2) ui_DelayTiming = devpriv->ui_AiTimer1; + if (mode==2) + ui_DelayTiming = devpriv->ui_AiTimer1; - // initialise sequence ram - + /**********************************/ + /* Initializes the sequence array */ + /**********************************/ if (!i_APCI3120_SetupChannelList(dev, s, devpriv->ui_AiNbrofChannels, devpriv->pui_AiChannelList, 0)) - return -EINVAL; + return -EINVAL; us_TmpValue=(USHORT) inw(dev->iobase+APCI3120_RD_STATUS); +/*** EL241003 : add this section in comment because floats must not be used if((us_TmpValue & 0x00B0)==0x00B0) { f_ConvertValue=(((float)ui_ConvertTiming * 0.002) - 2); @@ -776,6 +816,35 @@ int i_APCI3120_CyclicAnalogInput(int mode, comedi_device * dev,comedi_subdevice ui_TimerValue1 = (UINT) f_DelayValue; } } +***********************************************************************************************/ +/*** EL241003 Begin : add this section to replace floats calculation by integer calculations **/ + //EL250804: Testing if board APCI3120 have the new Quartz or if it is an APCI3001 + if((us_TmpValue & 0x00B0)==0x00B0 || !strcmp(this_board->pc_DriverName,"apci3001") ) + { + ui_TimerValue0 = ui_ConvertTiming * 2 - 2000; + ui_TimerValue0 = ui_TimerValue0 / 1000; + + if (mode==2) + { + ui_DelayTiming = ui_DelayTiming / 1000; + ui_TimerValue1 = ui_DelayTiming * 2 - 200; + ui_TimerValue1 = ui_TimerValue1 / 100; + } + } + else + { + ui_ConvertTiming = ui_ConvertTiming / 1000; + ui_TimerValue0 = ui_ConvertTiming * 12926 - 10000; + ui_TimerValue0 = ui_TimerValue0 / 10000; + + if (mode == 2) + { + ui_DelayTiming = ui_DelayTiming / 1000; + ui_TimerValue1 = ui_DelayTiming * 12926 -1; + ui_TimerValue1 = ui_TimerValue1 / 1000000; + } + } +/*** EL241003 End ******************************************************************************/ if(devpriv->b_ExttrigEnable==APCI3120_ENABLE) { @@ -789,9 +858,8 @@ int i_APCI3120_CyclicAnalogInput(int mode, comedi_device * dev,comedi_subdevice outb(devpriv->b_TimerSelectMode,dev->iobase+APCI3120_TIMER_CRT1); //Select Timer 0 - b_Tmp=((devpriv->b_DigitalOutputRegister<<4) & 0xF0) | APCI3120_SELECT_TIMER_0_WORD; + b_Tmp=((devpriv->b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_0_WORD; outb(b_Tmp,dev->iobase+APCI3120_TIMER_CRT0); - //Set the convertion time outw(((USHORT)ui_TimerValue0),dev->iobase+APCI3120_TIMER_VALUE); break; @@ -804,7 +872,6 @@ int i_APCI3120_CyclicAnalogInput(int mode, comedi_device * dev,comedi_subdevice //Select Timer 1 b_Tmp=((devpriv->b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_1_WORD; outb(b_Tmp,dev->iobase+APCI3120_TIMER_CRT0); - //Set the convertion time outw(((USHORT)ui_TimerValue1),dev->iobase+APCI3120_TIMER_VALUE); @@ -813,9 +880,10 @@ int i_APCI3120_CyclicAnalogInput(int mode, comedi_device * dev,comedi_subdevice outb(devpriv->b_TimerSelectMode,dev->iobase+APCI3120_TIMER_CRT1); //Select Timer 0 - b_Tmp=((devpriv->b_DigitalOutputRegister<<4) & 0xF0) | APCI3120_SELECT_TIMER_0_WORD; + b_Tmp=((devpriv->b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_0_WORD; outb(b_Tmp,dev->iobase+APCI3120_TIMER_CRT0); + //Set the convertion time outw(((USHORT)ui_TimerValue0),dev->iobase+APCI3120_TIMER_VALUE); break; @@ -823,8 +891,14 @@ int i_APCI3120_CyclicAnalogInput(int mode, comedi_device * dev,comedi_subdevice } // ##########common for all modes################# - //disable the scan bit - devpriv->b_ModeSelectRegister=devpriv->b_ModeSelectRegister | APCI3120_DISABLE_SCAN; + /***********************/ + /* Clears the SCAN bit */ + /***********************/ + //BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver + //devpriv->b_ModeSelectRegister=devpriv->b_ModeSelectRegister | APCI3120_DISABLE_SCAN; + devpriv->b_ModeSelectRegister = devpriv->b_ModeSelectRegister & + APCI3120_DISABLE_SCAN; + //END JK 07.05.04: Comparison between WIN32 and Linux driver outb(devpriv->b_ModeSelectRegister,dev->iobase+APCI3120_WRITE_MODE_SELECT); // If DMA is disabled @@ -854,12 +928,12 @@ int i_APCI3120_CyclicAnalogInput(int mode, comedi_device * dev,comedi_subdevice outb(devpriv->b_TimerSelectMode,dev->iobase+APCI3120_TIMER_CRT1); //Writing LOW WORD - b_Tmp=((devpriv->b_DigitalOutputRegister<<4) & 0xF0) | APCI3120_SELECT_TIMER_2_LOW_WORD; + b_Tmp=((devpriv->b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_LOW_WORD; outb(b_Tmp,dev->iobase+APCI3120_TIMER_CRT0); outw(LOWORD(ui_TimerValue2),dev->iobase+APCI3120_TIMER_VALUE); //Writing HIGH WORD - b_Tmp=((devpriv->b_DigitalOutputRegister<<4) & 0xF0) | APCI3120_SELECT_TIMER_2_HIGH_WORD; + b_Tmp=((devpriv->b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_HIGH_WORD; outb(b_Tmp,dev->iobase+APCI3120_TIMER_CRT0); outw(HIWORD(ui_TimerValue2),dev->iobase+APCI3120_TIMER_VALUE); @@ -879,11 +953,17 @@ int i_APCI3120_CyclicAnalogInput(int mode, comedi_device * dev,comedi_subdevice else { // If DMA Enabled - inw(dev->iobase+0);// reset EOC bit - devpriv->b_InterruptMode=APCI3120_DMA_MODE; - - // disable EOC and EOS interrupt - devpriv->b_ModeSelectRegister = devpriv->b_ModeSelectRegister & APCI3120_DISABLE_EOC_INT & APCI3120_DISABLE_EOS_INT; + //BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver + //inw(dev->iobase+0);// reset EOC bit + //END JK 07.05.04: Comparison between WIN32 and Linux driver + devpriv->b_InterruptMode=APCI3120_DMA_MODE; + + /************************************/ + /* Disables the EOC, EOS interrupt */ + /************************************/ + devpriv->b_ModeSelectRegister = devpriv->b_ModeSelectRegister & + APCI3120_DISABLE_EOC_INT & + APCI3120_DISABLE_EOS_INT; outb(devpriv->b_ModeSelectRegister,dev->iobase+APCI3120_WRITE_MODE_SELECT); @@ -941,14 +1021,28 @@ int i_APCI3120_CyclicAnalogInput(int mode, comedi_device * dev,comedi_subdevice outl(ui_Tmp,devpriv->i_IobaseAmcc+AMCC_OP_REG_AGCSTS); // changed since 16 bit interface for add on + /*********************/ + /* ENABLE BUS MASTER */ + /*********************/ outw(APCI3120_ADD_ON_AGCSTS_LOW,devpriv->i_IobaseAddon+0); outw(APCI3120_ENABLE_TRANSFER_ADD_ON_LOW,devpriv->i_IobaseAddon+2); + outw(APCI3120_ADD_ON_AGCSTS_HIGH,devpriv->i_IobaseAddon+0); outw(APCI3120_ENABLE_TRANSFER_ADD_ON_HIGH,devpriv->i_IobaseAddon+2); + + // TO VERIFIED + //BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver + outw(0x1000,devpriv->i_IobaseAddon+2); + //END JK 07.05.04: Comparison between WIN32 and Linux driver + //2 No change // A2P FIFO MANAGEMENT - // A2P fifo reset & transfer control enable - outl(APCI3120_A2P_FIFO_MANAGEMENT,devpriv->i_IobaseAmcc+AMCC_OP_REG_MCSR ); + // A2P fifo reset & transfer control enable + /***********************/ + /* A2P FIFO MANAGEMENT */ + /***********************/ + outl(APCI3120_A2P_FIFO_MANAGEMENT,devpriv->i_IobaseAmcc + + APCI3120_AMCC_OP_MCSR); //3 //beginning address of dma buf @@ -960,22 +1054,26 @@ int i_APCI3120_CyclicAnalogInput(int mode, comedi_device * dev,comedi_subdevice outw(APCI3120_ADD_ON_MWAR_LOW,devpriv->i_IobaseAddon+0); outw((devpriv->ul_DmaBufferHw[0]& 0xFFFF),devpriv->i_IobaseAddon+2); - // DMA Start Adress High + /*************************/ + /* DMA Start Adress High */ + /*************************/ outw(APCI3120_ADD_ON_MWAR_HIGH,devpriv->i_IobaseAddon+0); - - // outw((devpriv->ul_DmaBufferHw[0]/65536),devpriv->i_IobaseAddon+2); outw((devpriv->ul_DmaBufferHw[0]/65536),devpriv->i_IobaseAddon+2); //4 // amount of bytes to be transfered set transfer count // used ADDON MWTC register //commented testing outl(devpriv->ui_DmaBufferUsesize[0], devpriv->i_IobaseAddon+AMCC_OP_REG_AMWTC); - // Nbr of acquisition LOW - + + /**************************/ + /* Nbr of acquisition LOW */ + /**************************/ outw(APCI3120_ADD_ON_MWTC_LOW,devpriv->i_IobaseAddon + 0); outw((devpriv->ui_DmaBufferUsesize[0] & 0xFFFF),devpriv->i_IobaseAddon + 2); - // Nbr of acquisition HIGH + /***************************/ + /* Nbr of acquisition HIGH */ + /***************************/ outw(APCI3120_ADD_ON_MWTC_HIGH,devpriv->i_IobaseAddon + 0); outw((devpriv->ui_DmaBufferUsesize[0]/65536),devpriv->i_IobaseAddon + 2); @@ -983,15 +1081,42 @@ int i_APCI3120_CyclicAnalogInput(int mode, comedi_device * dev,comedi_subdevice // To configure A2P FIFO // testing outl( FIFO_ADVANCE_ON_BYTE_2,devpriv->i_IobaseAmcc+AMCC_OP_REG_INTCSR); + /******************/ + /* A2P FIFO RESET */ + /******************/ + // TO VERIFY + //BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver + outl(0x04000000UL, devpriv->i_IobaseAmcc+AMCC_OP_REG_MCSR); + //END JK 07.05.04: Comparison between WIN32 and Linux driver + //6 //ENABLE A2P FIFO WRITE AND ENABLE AMWEN // AMWEN_ENABLE | A2P_FIFO_WRITE_ENABLE (0x01|0x02)=0x03 - outw(3,devpriv->i_IobaseAddon + 4); + //BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver + //outw(3,devpriv->i_IobaseAddon + 4); + //END JK 07.05.04: Comparison between WIN32 and Linux driver //7 - //initialise end of dma interrupt AINT_WRITE_COMPL = ENABLE_WRITE_TC_INT(ADDI) - outl((APCI3120_FIFO_ADVANCE_ON_BYTE_2| APCI3120_ENABLE_WRITE_TC_INT), devpriv->i_IobaseAmcc+AMCC_OP_REG_INTCSR); - + //initialise end of dma interrupt AINT_WRITE_COMPL = ENABLE_WRITE_TC_INT(ADDI) + /***************************************************/ + /* A2P FIFO CONFIGURATE, END OF DMA INTERRUPT INIT */ + /***************************************************/ + outl((APCI3120_FIFO_ADVANCE_ON_BYTE_2 | APCI3120_ENABLE_WRITE_TC_INT), + devpriv->i_IobaseAmcc+AMCC_OP_REG_INTCSR); + + //BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver + /******************************************/ + /* ENABLE A2P FIFO WRITE AND ENABLE AMWEN */ + /******************************************/ + outw(3,devpriv->i_IobaseAddon + 4); + //END JK 07.05.04: Comparison between WIN32 and Linux driver + + /******************/ + /* A2P FIFO RESET */ + /******************/ + //BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver + outl(0x04000000UL, devpriv->i_IobaseAmcc+APCI3120_AMCC_OP_MCSR); + //END JK 07.05.04: Comparison between WIN32 and Linux driver } if ((devpriv->us_UseDma==APCI3120_DISABLE) && !devpriv->b_AiContinuous) @@ -1022,10 +1147,6 @@ int i_APCI3120_CyclicAnalogInput(int mode, comedi_device * dev,comedi_subdevice } - - - - /* +----------------------------------------------------------------------------+ | INTERNAL FUNCTIONS | @@ -1055,6 +1176,7 @@ int i_APCI3120_Reset(comedi_device *dev) { unsigned int i; unsigned short us_TmpValue; + devpriv->b_AiCyclicAcquisition=APCI3120_DISABLE; devpriv->b_EocEosInterrupt=APCI3120_DISABLE; devpriv->b_InterruptMode=APCI3120_EOC_MODE; @@ -1088,7 +1210,7 @@ int i_APCI3120_Reset(comedi_device *dev) // Reset digital output to L0W - outb(0x0,dev->iobase+APCI3120_DIGITAL_OUTPUT); +//ES05 outb(0x0,dev->iobase+APCI3120_DIGITAL_OUTPUT); udelay(10); inw(dev->iobase+0); //make a dummy read @@ -1133,9 +1255,10 @@ int i_APCI3120_Reset(comedi_device *dev) int i_APCI3120_SetupChannelList(comedi_device * dev, comedi_subdevice * s, int n_chan, unsigned int *chanlist,char check) { - unsigned int i;//, differencial=0, bipolar=0; + unsigned int i;//, differencial=0, bipolar=0; unsigned int gain; unsigned short us_TmpValue; + /* correct channel and range number check itself comedi/range.c */ if (n_chan<1) { @@ -1162,14 +1285,18 @@ int i_APCI3120_SetupChannelList(comedi_device * dev, comedi_subdevice * s, int n } else { - us_TmpValue|=APCI3120_UNIPOLAR; // enable unipolar...... + us_TmpValue|=APCI3120_UNIPOLAR; // enable unipolar...... } - gain=CR_RANGE(chanlist[i]); // get gain number - + + gain=CR_RANGE(chanlist[i]); // get gain number us_TmpValue|=((gain & 0x03)<<4); //<<4 for G0 and G1 bit in RAM - us_TmpValue|= i<<8; //To select the RAM LOCATION.... - + us_TmpValue|= i<<8; //To select the RAM LOCATION.... outw(us_TmpValue,dev->iobase+APCI3120_SEQ_RAM_ADDRESS); + + + printk ("\n Gain = %i", (((unsigned char) CR_RANGE(chanlist[i]) & 0x03) << 2)); + printk ("\n Channel = %i", CR_CHAN(chanlist[i])); + printk ("\n Polarity = %i", us_TmpValue & APCI3120_UNIPOLAR); } return 1; // we can serve this with scan logic } @@ -1178,6 +1305,7 @@ int i_APCI3120_SetupChannelList(comedi_device * dev, comedi_subdevice * s, int n + /* +----------------------------------------------------------------------------+ | Function name : int i_APCI3120_ExttrigEnable(comedi_device * dev) | @@ -1198,6 +1326,8 @@ int i_APCI3120_SetupChannelList(comedi_device * dev, comedi_subdevice * s, int n int i_APCI3120_ExttrigEnable(comedi_device * dev) { + + devpriv->us_OutputRegister|=APCI3120_ENABLE_EXT_TRIGGER; outw(devpriv->us_OutputRegister,dev->iobase+APCI3120_WR_ADDRESS); return 0; @@ -1269,14 +1399,15 @@ int i_APCI3120_ExttrigDisable(comedi_device * dev) { comedi_device *dev = d; USHORT int_daq; - + unsigned int int_amcc,ui_Check,i; USHORT us_TmpValue; BYTE b_DummyRead; comedi_subdevice *s = dev->subdevices + 0; ui_Check=1; - + + int_daq=inw(dev->iobase+APCI3120_RD_STATUS) & 0xf000; // get IRQ reasons int_amcc=inl(devpriv->i_IobaseAmcc+AMCC_OP_REG_INTCSR); // get AMCC INT register @@ -1390,7 +1521,11 @@ int i_APCI3120_ExttrigDisable(comedi_device * dev) //stop timer 0 and timer 1 i_APCI3120_StopCyclicAcquisition(dev,s); devpriv->b_AiCyclicAcquisition=APCI3120_DISABLE; - comedi_done(dev,s); + + //UPDATE-0.7.57->0.7.68comedi_done(dev,s); + s->async->events |= COMEDI_CB_EOA; + comedi_event(dev,s,s->async->events); + break; @@ -1426,8 +1561,6 @@ int i_APCI3120_ExttrigDisable(comedi_device * dev) if ((int_daq & 0x4) &&(devpriv->b_InterruptMode == APCI3120_DMA_MODE)) { - - //DPRINTK("\n interrupt is DMA\n"); if(devpriv->b_AiCyclicAcquisition==APCI3120_ENABLE) { @@ -1445,6 +1578,7 @@ int i_APCI3120_ExttrigDisable(comedi_device * dev) } else { + /* Stops the Timer */ outw(devpriv->us_OutputRegister & APCI3120_DISABLE_TIMER0 & APCI3120_DISABLE_TIMER1,dev->iobase+APCI3120_WR_ADDRESS); } @@ -1473,7 +1607,8 @@ int i_APCI3120_ExttrigDisable(comedi_device * dev) +----------------------------------------------------------------------------+ */ -int i_APCI3120_InterruptHandleEos(comedi_device *dev) + +/*int i_APCI3120_InterruptHandleEos(comedi_device *dev) { int n_chan,i; sampl_t *data; @@ -1481,6 +1616,7 @@ int i_APCI3120_InterruptHandleEos(comedi_device *dev) comedi_async *async = s->async; data=async->data+async->buf_int_ptr;//new samples added from here onwards n_chan=devpriv->ui_AiNbrofChannels; + for(i=0;iiobase+0); @@ -1490,15 +1626,34 @@ int i_APCI3120_InterruptHandleEos(comedi_device *dev) comedi_eos(dev,s); if (s->async->buf_int_ptr>=s->async->data_len) // for buffer rool over { - /* buffer rollover */ - s->async->buf_int_ptr=0; +*/ /* buffer rollover */ +/* s->async->buf_int_ptr=0; comedi_eobuf(dev,s); } return 0; -} - - - +}*/ +int i_APCI3120_InterruptHandleEos(comedi_device *dev) +{ + int n_chan,i; + comedi_subdevice *s=dev->subdevices+0; + int err=1; + + n_chan=devpriv->ui_AiNbrofChannels; + + s->async->events = 0; + + for(i=0;iasync, inw(dev->iobase+0)); + + s->async->events |= COMEDI_CB_EOS; + + if (err==0) + s->async->events |= COMEDI_CB_OVERFLOW; + + comedi_event(dev,s,s->async->events); + + return 0; +} @@ -1525,13 +1680,13 @@ int i_APCI3120_InterruptHandleEos(comedi_device *dev) void v_APCI3120_InterruptDma(int irq, void *d, struct pt_regs *regs) { comedi_device *dev = d; - comedi_subdevice *s = dev->subdevices + 0; - sampl_t *ptr; - unsigned int next_dma_buf, samplesinbuf,m; + comedi_subdevice *s = dev->subdevices + 0; + unsigned int next_dma_buf, samplesinbuf; unsigned long low_word,high_word,var; + UINT ui_Tmp; samplesinbuf=devpriv->ui_DmaBufferUsesize[devpriv->ui_DmaActualBuffer]-inl(devpriv->i_IobaseAmcc+AMCC_OP_REG_MWTC); - //rt_printk("\nSamples in buffer=%d \n", samplesinbuf); + if (samplesinbufui_DmaBufferUsesize[devpriv->ui_DmaActualBuffer]) { comedi_error(dev,"Interrupted DMA transfer!"); @@ -1541,7 +1696,7 @@ int i_APCI3120_InterruptHandleEos(comedi_device *dev) comedi_error(dev,"Odd count of bytes in DMA ring!"); i_APCI3120_StopCyclicAcquisition(dev,s); devpriv->b_AiCyclicAcquisition=APCI3120_DISABLE; - comedi_error_done(dev,s); + return; } samplesinbuf=samplesinbuf>>1; // number of received samples @@ -1549,33 +1704,42 @@ int i_APCI3120_InterruptHandleEos(comedi_device *dev) { // switch DMA buffers if is used double buffering next_dma_buf=1-devpriv->ui_DmaActualBuffer; + ui_Tmp=AGCSTS_TC_ENABLE | AGCSTS_RESET_A2P_FIFO ; outl(ui_Tmp,devpriv->i_IobaseAddon+AMCC_OP_REG_AGCSTS); + // changed since 16 bit interface for add on outw(APCI3120_ADD_ON_AGCSTS_LOW,devpriv->i_IobaseAddon+0); outw(APCI3120_ENABLE_TRANSFER_ADD_ON_LOW,devpriv->i_IobaseAddon+2); outw(APCI3120_ADD_ON_AGCSTS_HIGH,devpriv->i_IobaseAddon+0); outw(APCI3120_ENABLE_TRANSFER_ADD_ON_HIGH ,devpriv->i_IobaseAddon+2); // 0x1000 is out putted in windows driver - - // A2P FIFO MANAGEMENT - // A2P fifo reset & transfer control enable - outl(APCI3120_A2P_FIFO_MANAGEMENT,devpriv->i_IobaseAmcc+AMCC_OP_REG_MCSR ); + var=devpriv->ul_DmaBufferHw[next_dma_buf]; low_word=var & 0xffff; var=devpriv->ul_DmaBufferHw[next_dma_buf]; high_word=var /65536; + + /* DMA Start Adress Low */ outw(APCI3120_ADD_ON_MWAR_LOW,devpriv->i_IobaseAddon+0); outw(low_word,devpriv->i_IobaseAddon+2); + + /* DMA Start Adress High */ outw(APCI3120_ADD_ON_MWAR_HIGH,devpriv->i_IobaseAddon+0); outw(high_word,devpriv->i_IobaseAddon+2); - var=devpriv->ui_DmaBufferUsesize[next_dma_buf]; + + var=devpriv->ui_DmaBufferUsesize[next_dma_buf]; low_word=var & 0xffff; var=devpriv->ui_DmaBufferUsesize[next_dma_buf]; high_word=var /65536; + + /* Nbr of acquisition LOW */ outw(APCI3120_ADD_ON_MWTC_LOW,devpriv->i_IobaseAddon+0); outw(low_word,devpriv->i_IobaseAddon+2); + + /* Nbr of acquisition HIGH */ outw(APCI3120_ADD_ON_MWTC_HIGH,devpriv->i_IobaseAddon+0); outw(high_word,devpriv->i_IobaseAddon+2); + // To configure A2P FIFO // ENABLE A2P FIFO WRITE AND ENABLE AMWEN // AMWEN_ENABLE | A2P_FIFO_WRITE_ENABLE (0x01|0x02)=0x03 @@ -1584,10 +1748,11 @@ int i_APCI3120_InterruptHandleEos(comedi_device *dev) outl((APCI3120_FIFO_ADVANCE_ON_BYTE_2| APCI3120_ENABLE_WRITE_TC_INT), devpriv->i_IobaseAmcc+AMCC_OP_REG_INTCSR); } - +/*UPDATE-0.7.57->0.7.68 ptr=(sampl_t *)devpriv->ul_DmaBufferVirtual[devpriv->ui_DmaActualBuffer]; - + + // if there is not enough space left in the buffer to copy all data contained in the DMABufferVirtual if(s->async->buf_int_ptr+samplesinbuf*sizeof(sampl_t)>=devpriv->ui_AiDataLength) { m=(devpriv->ui_AiDataLength-s->async->buf_int_ptr)/sizeof(sampl_t); @@ -1620,11 +1785,31 @@ int i_APCI3120_InterruptHandleEos(comedi_device *dev) comedi_done(dev,s); return; } +*/ + if (samplesinbuf) + { + v_APCI3120_InterruptDmaMoveBlock16bit(dev,s,devpriv->ul_DmaBufferVirtual[devpriv->ui_DmaActualBuffer],samplesinbuf); + + if (!(devpriv->ui_AiFlags & TRIG_WAKE_EOS)) + { + s->async->events |= COMEDI_CB_EOS; + comedi_event(dev,s,s->async->events); + } + } + if (!devpriv->b_AiContinuous) + if ( devpriv->ui_AiActualScan>=devpriv->ui_AiNbrofScans ) + { + // all data sampled + i_APCI3120_StopCyclicAcquisition(dev,s); + devpriv->b_AiCyclicAcquisition=APCI3120_DISABLE; + s->async->events |= COMEDI_CB_EOA; + comedi_event(dev,s,s->async->events); + return; + } if (devpriv->b_DmaDoubleBuffer) { // switch dma buffers devpriv->ui_DmaActualBuffer=1-devpriv->ui_DmaActualBuffer; - } else { @@ -1691,7 +1876,7 @@ int i_APCI3120_InterruptHandleEos(comedi_device *dev) +----------------------------------------------------------------------------+ */ -void v_APCI3120_InterruptDmaMoveBlock16bit(comedi_device *dev,comedi_subdevice *s,sampl_t *dma,sampl_t *data,int n) +/*void v_APCI3120_InterruptDmaMoveBlock16bit(comedi_device *dev,comedi_subdevice *s,sampl_t *dma,sampl_t *data,int n) { int i,j,m; @@ -1711,7 +1896,7 @@ void v_APCI3120_InterruptDmaMoveBlock16bit(comedi_device *dev,comedi_subdevice * m=0; devpriv->ui_AiActualScan++; if (devpriv->ui_AiFlags & TRIG_WAKE_EOS) - comedi_eos(dev,s); +;//UPDATE-0.7.57->0.7.68 comedi_eos(dev,s); } } } @@ -1719,7 +1904,15 @@ void v_APCI3120_InterruptDmaMoveBlock16bit(comedi_device *dev,comedi_subdevice * s->async->cur_chan=j; } - +*/ +void v_APCI3120_InterruptDmaMoveBlock16bit(comedi_device *dev,comedi_subdevice *s,sampl_t *dma_buffer,unsigned int num_samples) +{ + devpriv->ui_AiActualScan += (s->async->cur_chan + num_samples) / devpriv->ui_AiScanLength; + s->async->cur_chan += num_samples; + s->async->cur_chan %= devpriv->ui_AiScanLength; + + cfc_write_array_to_buffer(s, dma_buffer, num_samples * sizeof(sampl_t)); +} @@ -1774,8 +1967,9 @@ int i_APCI3120_InsnConfigTimer(comedi_device *dev,comedi_subdevice *s,comedi_ins //this_board->i_hwdrv_InsnConfigTimer(dev, ui_Timervalue2,(BYTE)data[0]); us_TmpValue=(USHORT) inw(devpriv->iobase+APCI3120_RD_STATUS); - //Testing if board have the new Quartz and calculate the time value to set in the timer - if((us_TmpValue & 0x00B0)==0x00B0) + //EL250804: Testing if board APCI3120 have the new Quartz or if it is an APCI3001 + // and calculate the time value to set in the timer + if((us_TmpValue & 0x00B0)==0x00B0 || !strcmp(this_board->pc_DriverName,"apci3001") ) { //Calculate the time value to set in the timer ui_Timervalue2=ui_Timervalue2 / 50; @@ -1812,12 +2006,12 @@ int i_APCI3120_InsnConfigTimer(comedi_device *dev,comedi_subdevice *s,comedi_ins //are erase (Set to 0) //Writing LOW WORD - b_Tmp=((devpriv->b_DigitalOutputRegister<<4) & 0xF0) | APCI3120_SELECT_TIMER_2_LOW_WORD; + b_Tmp=((devpriv->b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_LOW_WORD; outb(b_Tmp,devpriv->iobase+APCI3120_TIMER_CRT0); outw(LOWORD(ui_Timervalue2),devpriv->iobase+APCI3120_TIMER_VALUE); //Writing HIGH WORD - b_Tmp=((devpriv->b_DigitalOutputRegister<<4) & 0xF0) | APCI3120_SELECT_TIMER_2_HIGH_WORD; + b_Tmp=((devpriv->b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_HIGH_WORD; outb(b_Tmp,devpriv->iobase+APCI3120_TIMER_CRT0); outw(HIWORD(ui_Timervalue2),devpriv->iobase+APCI3120_TIMER_VALUE); // timer2 in Timer mode enabled @@ -1839,13 +2033,14 @@ int i_APCI3120_InsnConfigTimer(comedi_device *dev,comedi_subdevice *s,comedi_ins //are erase (Set to 0) //Writing LOW WORD - b_Tmp=((devpriv->b_DigitalOutputRegister<<4) & 0xF0) | APCI3120_SELECT_TIMER_2_LOW_WORD; + b_Tmp=((devpriv->b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_LOW_WORD; outb(b_Tmp,devpriv->iobase+APCI3120_TIMER_CRT0); outw(LOWORD(ui_Timervalue2),devpriv->iobase+APCI3120_TIMER_VALUE); //Writing HIGH WORD - b_Tmp=((devpriv->b_DigitalOutputRegister<<4) & 0xF0) | APCI3120_SELECT_TIMER_2_HIGH_WORD; + b_Tmp=((devpriv->b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_HIGH_WORD; outb(b_Tmp,devpriv->iobase+APCI3120_TIMER_CRT0); + outw(HIWORD(ui_Timervalue2),devpriv->iobase+APCI3120_TIMER_VALUE); //watchdog enabled devpriv->b_Timer2Mode=APCI3120_WATCHDOG; @@ -1894,9 +2089,7 @@ int i_APCI3120_InsnWriteTimer(comedi_device *dev,comedi_subdevice *s, comedi_ins USHORT us_TmpValue; BYTE b_Tmp; - - - + if((devpriv->b_Timer2Mode!=APCI3120_WATCHDOG) && (devpriv->b_Timer2Mode!=APCI3120_TIMER)) { comedi_error(dev,"\nwrite:timer2 not configured "); @@ -1998,11 +2191,12 @@ int i_APCI3120_InsnWriteTimer(comedi_device *dev,comedi_subdevice *s, comedi_ins // ui_Timervalue2=data[1]; // passed as argument us_TmpValue=(USHORT) inw(devpriv->iobase+APCI3120_RD_STATUS); - //Testing if board have the new Quartz and calculate the time value to set in the timer - if((us_TmpValue & 0x00B0)==0x00B0) - { - //Calculate the time value to set in the timer - ui_Timervalue2=ui_Timervalue2 / 50; + //EL250804: Testing if board APCI3120 have the new Quartz or if it is an APCI3001 + // and calculate the time value to set in the timer + if((us_TmpValue & 0x00B0)==0x00B0 || !strcmp(this_board->pc_DriverName,"apci3001") ) + { + //Calculate the time value to set in the timer + ui_Timervalue2=ui_Timervalue2 / 50; } else { @@ -2010,13 +2204,15 @@ int i_APCI3120_InsnWriteTimer(comedi_device *dev,comedi_subdevice *s, comedi_ins ui_Timervalue2=ui_Timervalue2 / 70; } //Writing LOW WORD - b_Tmp=((devpriv->b_DigitalOutputRegister<<4) & 0xF0) | APCI3120_SELECT_TIMER_2_LOW_WORD; + b_Tmp=((devpriv->b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_LOW_WORD; outb(b_Tmp,devpriv->iobase+APCI3120_TIMER_CRT0); + outw(LOWORD(ui_Timervalue2),devpriv->iobase+APCI3120_TIMER_VALUE); //Writing HIGH WORD - b_Tmp=((devpriv->b_DigitalOutputRegister<<4) & 0xF0) | APCI3120_SELECT_TIMER_2_HIGH_WORD; + b_Tmp=((devpriv->b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_HIGH_WORD; outb(b_Tmp,devpriv->iobase+APCI3120_TIMER_CRT0); + outw(HIWORD(ui_Timervalue2),devpriv->iobase+APCI3120_TIMER_VALUE); break; @@ -2055,6 +2251,7 @@ int i_APCI3120_InsnReadTimer(comedi_device *dev,comedi_subdevice *s,comedi_insn BYTE b_Tmp; USHORT us_TmpValue,us_TmpValue_2,us_StatusValue; + if((devpriv->b_Timer2Mode!=APCI3120_WATCHDOG) && (devpriv->b_Timer2Mode!=APCI3120_TIMER)) { comedi_error(dev,"\nread:timer2 not configured "); @@ -2066,13 +2263,15 @@ int i_APCI3120_InsnReadTimer(comedi_device *dev,comedi_subdevice *s,comedi_insn { //Read the LOW WORD of Timer 2 register - b_Tmp=((devpriv->b_DigitalOutputRegister<<4) & 0xF0) | APCI3120_SELECT_TIMER_2_LOW_WORD; + b_Tmp=((devpriv->b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_LOW_WORD; outb(b_Tmp,devpriv->iobase+APCI3120_TIMER_CRT0); + us_TmpValue=inw(devpriv->iobase+APCI3120_TIMER_VALUE); //Read the HIGH WORD of Timer 2 register - b_Tmp=((devpriv->b_DigitalOutputRegister<<4) & 0xF0) | APCI3120_SELECT_TIMER_2_HIGH_WORD; + b_Tmp=((devpriv->b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_HIGH_WORD; outb(b_Tmp,devpriv->iobase+APCI3120_TIMER_CRT0); + us_TmpValue_2=inw(devpriv->iobase+APCI3120_TIMER_VALUE); // combining both words @@ -2131,6 +2330,7 @@ int i_APCI3120_InsnReadDigitalInput(comedi_device *dev,comedi_subdevice UINT ui_Chan,ui_TmpValue; ui_Chan = CR_CHAN(insn->chanspec); // channel specified + //this_board->i_hwdrv_InsnReadDigitalInput(dev,ui_Chan,data); if(ui_Chan >= 0 && ui_Chan <= 3) { @@ -2178,6 +2378,7 @@ int i_APCI3120_InsnBitsDigitalInput(comedi_device *dev,comedi_subdevice *s, rotated right 8 times to bring them to last four bits ANDed with oxf for value. *****/ + *data=(ui_TmpValue >>8) & 0xf; //this_board->i_hwdrv_InsnBitsDigitalInput(dev,data); return insn->n; @@ -2226,7 +2427,7 @@ int i_APCI3120_InsnConfigDigitalOutput(comedi_device *dev,comedi_subdevice *s, else { devpriv->b_OutputMemoryStatus = APCI3120_DISABLE; - + devpriv -> b_DigitalOutputRegister = 0; } if(!devpriv->b_OutputMemoryStatus ) { @@ -2265,8 +2466,6 @@ int i_APCI3120_InsnConfigDigitalOutput(comedi_device *dev,comedi_subdevice *s, int i_APCI3120_InsnBitsDigitalOutput(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data) { - - if ((data[0] > this_board->i_DoMaxdata) || (data[0]<0)) { @@ -2277,16 +2476,17 @@ int i_APCI3120_InsnBitsDigitalOutput(comedi_device *dev,comedi_subdevice switch(data[1]) { - case 1 :data[0]=(data[0]<<4)|ui_Temp; + case 1 :data[0]=(data[0]<<4)|devpriv -> b_DigitalOutputRegister; break; - case 2 :data[0]=data[0]<<4; + case 2 :data[0]=data[0]; break; default :printk("\nThe parameter passed is in error \n"); return -EINVAL; }// switch(data[1]) outb(data[0], devpriv->iobase + APCI3120_DIGITAL_OUTPUT); - ui_Temp=data[0]&0xF0; + + devpriv->b_DigitalOutputRegister = data[0]&0xF0; return insn->n; @@ -2339,7 +2539,8 @@ int i_APCI3120_InsnWriteDigitalOutput(comedi_device *dev,comedi_subdevice switch(data[1]) { case 1 :data[0]=(data[0] << ui_NoOfChannel); - data[0]=(data[0]<<4)|ui_Temp; +//ES05 data[0]=(data[0]<<4)|ui_Temp; + data[0]=(data[0]<<4)|devpriv -> b_DigitalOutputRegister; break; case 2 : @@ -2347,16 +2548,22 @@ int i_APCI3120_InsnWriteDigitalOutput(comedi_device *dev,comedi_subdevice ui_Temp1=1; ui_Temp1=ui_Temp1< b_DigitalOutputRegister = + devpriv -> b_DigitalOutputRegister | ui_Temp1; + data[0]=(data[0] << ui_NoOfChannel)^0xf; data[0]=data[0]<<4; - data[0]=data[0]& ui_Temp; +//ES05 data[0]=data[0]& ui_Temp; + data[0]=data[0] & devpriv -> b_DigitalOutputRegister; break; default :printk("\nThe parameter passed is in error \n"); return -EINVAL; }// switch(data[1]) outb(data[0], devpriv->iobase + APCI3120_DIGITAL_OUTPUT); - ui_Temp=data[0] & 0xf0; + +//ES05 ui_Temp=data[0] & 0xf0; + devpriv -> b_DigitalOutputRegister = data[0] & 0xf0; return (insn->n); } @@ -2400,6 +2607,7 @@ int i_APCI3120_InsnWriteAnalogOutput(comedi_device *dev,comedi_subdevice ui_Range = CR_RANGE(insn->chanspec); ui_Channel = CR_CHAN(insn->chanspec); + //this_board->i_hwdrv_InsnWriteAnalogOutput(dev, ui_Range, ui_Channel,data[0]); if(ui_Range) // if 1 then unipolar diff --git a/comedi/drivers/addi-data/hwdrv_apci3120.h b/comedi/drivers/addi-data/hwdrv_apci3120.h index c653d712..b93cf784 100644 --- a/comedi/drivers/addi-data/hwdrv_apci3120.h +++ b/comedi/drivers/addi-data/hwdrv_apci3120.h @@ -1,8 +1,32 @@ + // hwdrv_apci3120.h +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ /* + +-----------------------------------------------------------------------+ | (C) ADDI-DATA GmbH Dieselstrasse 3 D-77833 Ottersweier | +-----------------------------------------------------------------------+ @@ -215,7 +239,8 @@ int i_APCI3120_Reset(comedi_device *dev); int i_APCI3120_CyclicAnalogInput(int mode, comedi_device * dev,comedi_subdevice * s); // Interrupt functions void v_APCI3120_Interrupt(int irq, void *d, struct pt_regs *regs) ; -void v_APCI3120_InterruptDmaMoveBlock16bit(comedi_device *dev,comedi_subdevice *s,sampl_t *dma,sampl_t *data,int n); +//UPDATE-0.7.57->0.7.68 void v_APCI3120_InterruptDmaMoveBlock16bit(comedi_device *dev,comedi_subdevice *s,sampl_t *dma,sampl_t *data,int n); +void v_APCI3120_InterruptDmaMoveBlock16bit(comedi_device *dev,comedi_subdevice *s,sampl_t *dma_buffer,unsigned int num_samples); int i_APCI3120_InterruptHandleEos(comedi_device *dev); void v_APCI3120_InterruptDma(int irq, void *d, struct pt_regs *regs) ; diff --git a/comedi/drivers/addi-data/hwdrv_apci3200.c b/comedi/drivers/addi-data/hwdrv_apci3200.c index e099ca87..59a8b575 100644 --- a/comedi/drivers/addi-data/hwdrv_apci3200.c +++ b/comedi/drivers/addi-data/hwdrv_apci3200.c @@ -1,14 +1,38 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ /* + +-----------------------------------------------------------------------+ | (C) ADDI-DATA GmbH Dieselstraße 3 D-77833 Ottersweier | +-----------------------------------------------------------------------+ | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | +-------------------------------+---------------------------------------+ - | Project : 13Card Linux Driver | Compiler : GCC | - | Module name : hwdrv_apci3200.c| Version : 2.96 | + | Project : APCI-3200 | Compiler : GCC | + | Module name : hwdrv_apci3200.c| Version : 2.96 | +-------------------------------+---------------------------------------+ - | Author : Shitalkumar S Chavan | Date : 10.12.2001 | + | Project manager: Eric Stolz | Date : 02/12/2002 | +-------------------------------+---------------------------------------+ | Description : Hardware Layer Acces For APCI-3200 | +-----------------------------------------------------------------------+ @@ -16,289 +40,725 @@ +----------+-----------+------------------------------------------------+ | Date | Author | Description of updates | +----------+-----------+------------------------------------------------+ - | | | | + | 02.07.04 | J. Krauth | Modification from the driver in order to | + | | | correct some errors when using several boards. | | | | | | | | | +----------+-----------+------------------------------------------------+ + | 26.10.04 | J. Krauth | - Update for COMEDI 0.7.68 | + | | | - Read eeprom value | + | | | - Append APCI-3300 | + +----------+-----------+------------------------------------------------+ */ + /* -+----------------------------------------------------------------------------+ -| Included files | -+----------------------------------------------------------------------------+ + +----------------------------------------------------------------------------+ + | Included files | + +----------------------------------------------------------------------------+ */ #include "hwdrv_apci3200.h" -INT i_CJCAvailable=1; -INT i_CJCPolarity=0; -INT i_CJCGain=0; -INT i_InterruptFlag=0; -INT i_ADDIDATAPolarity; -INT i_ADDIDATAGain; -INT i_AutoCalibration=0; //: auto calibration -INT i_ADDIDATAConversionTime; -INT i_ADDIDATAConversionTimeUnit; -INT i_ADDIDATAType; -INT i_ChannelNo; -INT i_ChannelCount=0; -INT i_ScanType; -INT i_FirstChannel; -INT i_LastChannel; -INT i_Sum=0; -INT i_Offset; -UINT ui_Channel_num=0; -static int i_Count=0; -INT i_Initialised=0; -UINT ui_InterruptChannelValue[96]; //Buffer +//Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values +#include "addi_amcc_S5920.h" +//#define PRINT_INFO + +//End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + +//BEGIN JK 06.07.04: Management of sevrals boards /* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI3200_ReadDigitalInput | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Read value of the selected channel or port | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To read for Port - Channel Numberfor single channel -| UINT data[0] : 0: Read single channel - 1: Read port value - data[1] Port number -+----------------------------------------------------------------------------+ -| Output Parameters : -- data[0] :Read status value -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ + INT i_CJCAvailable=1; + INT i_CJCPolarity=0; + INT i_CJCGain=2;//changed from 0 to 2 + INT i_InterruptFlag=0; + INT i_ADDIDATAPolarity; + INT i_ADDIDATAGain; + INT i_AutoCalibration=0; //: auto calibration + INT i_ADDIDATAConversionTime; + INT i_ADDIDATAConversionTimeUnit; + INT i_ADDIDATAType; + INT i_ChannelNo; + INT i_ChannelCount=0; + INT i_ScanType; + INT i_FirstChannel; + INT i_LastChannel; + INT i_Sum=0; + INT i_Offset; + UINT ui_Channel_num=0; + static int i_Count=0; + INT i_Initialised=0; + UINT ui_InterruptChannelValue[96]; //Buffer */ +str_BoardInfos s_BoardInfos [100]; // 100 will be the max number of boards to be used +//END JK 06.07.04: Management of sevrals boards + +//Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + +/*+----------------------------------------------------------------------------+*/ +/*| Function Name : INT i_AddiHeaderRW_ReadEeprom |*/ +/*| (INT i_NbOfWordsToRead, |*/ +/*| DWORD dw_PCIBoardEepromAddress, |*/ +/*| WORD w_EepromStartAddress, |*/ +/*| PWORD pw_DataRead) |*/ +/*+----------------------------------------------------------------------------+*/ +/*| Task : Read word from the 5920 eeprom. |*/ +/*+----------------------------------------------------------------------------+*/ +/*| Input Parameters : INT i_NbOfWordsToRead : Nbr. of word to read |*/ +/*| DWORD dw_PCIBoardEepromAddress : Address of the eeprom |*/ +/*| WORD w_EepromStartAddress : Eeprom strat address |*/ +/*+----------------------------------------------------------------------------+*/ +/*| Output Parameters : PWORD pw_DataRead : Read data |*/ +/*+----------------------------------------------------------------------------+*/ +/*| Return Value : - |*/ +/*+----------------------------------------------------------------------------+*/ + +INT i_AddiHeaderRW_ReadEeprom (INT i_NbOfWordsToRead, + DWORD dw_PCIBoardEepromAddress, + WORD w_EepromStartAddress, + PWORD pw_DataRead) +{ + DWORD dw_eeprom_busy=0; + INT i_Counter=0; + INT i_WordCounter; + INT i; + BYTE pb_ReadByte[1]; + BYTE b_ReadLowByte = 0; + BYTE b_ReadHighByte = 0; + BYTE b_SelectedAddressLow = 0; + BYTE b_SelectedAddressHigh = 0; + WORD w_ReadWord = 0; + + for (i_WordCounter = 0;i_WordCounter> 4; + + /***************************/ + /** Read number of inputs **/ + /***************************/ + i_AddiHeaderRW_ReadEeprom (1, //i_NbOfWordsToRead + dw_PCIBoardEepromAddress, + w_AnalogInputComponentAddress + 0x06, // Number of inputs for the first modul + &w_NumberOfInputs); + + w_NumberOfInputs = w_NumberOfInputs >> 4; + + /***********************/ + /** Read the CJC flag **/ + /***********************/ + i_AddiHeaderRW_ReadEeprom (1, //i_NbOfWordsToRead + dw_PCIBoardEepromAddress, + w_AnalogInputComponentAddress + 0x08, // CJC flag + &w_CJCFlag); + + w_CJCFlag = (w_CJCFlag >> 3) & 0x1; // Get only the CJC flag + + /*******************************/ + /** Read number of gain value **/ + /*******************************/ + i_AddiHeaderRW_ReadEeprom (1, //i_NbOfWordsToRead + dw_PCIBoardEepromAddress, + w_AnalogInputComponentAddress + 0x44, // Number of gain value + &w_NumberOfGainValue); + + w_NumberOfGainValue = w_NumberOfGainValue & 0xFF; + + /***********************************/ + /** Compute single header address **/ + /***********************************/ + w_SingleHeaderAddress = w_AnalogInputComponentAddress + 0x46 + (((w_NumberOfGainValue / 16) + 1) * 2) + (6 * w_NumberOfGainValue) + (4 * (((w_NumberOfGainValue / 16) + 1) * 2)); + + /********************************************/ + /** Read current sources value for input 1 **/ + /********************************************/ + i_AddiHeaderRW_ReadEeprom (1, //i_NbOfWordsToRead + dw_PCIBoardEepromAddress, + w_SingleHeaderAddress ,//w_EepromStartAddress: Single header address + &w_SingleHeaderSize); + + w_SingleHeaderSize = w_SingleHeaderSize >> 4; + + /*************************************/ + /** Read gain factor for the module **/ + /*************************************/ + w_GainFactorAddress = w_AnalogInputComponentAddress; + + for (w_GainIndex = 0; w_GainIndex < w_NumberOfGainValue; w_GainIndex++) + { + /************************************/ + /** Read gain value for the module **/ + /************************************/ + i_AddiHeaderRW_ReadEeprom (1, //i_NbOfWordsToRead + dw_PCIBoardEepromAddress, + w_AnalogInputComponentAddress + 70 + (2 * (1 + ( w_NumberOfGainValue / 16))) + (0x02 * w_GainIndex), // Gain value + &w_GainValue); + + BoardInformations->s_Module [w_ModulCounter].w_GainValue [w_GainIndex] = w_GainValue; + +# ifdef PRINT_INFO + printk ("\n Gain value = %d", BoardInformations->s_Module [w_ModulCounter].w_GainValue [w_GainIndex]); +# endif + + /*************************************/ + /** Read gain factor for the module **/ + /*************************************/ + i_AddiHeaderRW_ReadEeprom (2, //i_NbOfWordsToRead + dw_PCIBoardEepromAddress, + w_AnalogInputComponentAddress + 70 + ((2 * w_NumberOfGainValue) + (2 * (1 + ( w_NumberOfGainValue / 16)))) + (0x04 * w_GainIndex), // Gain factor + w_GainFactorValue); + + BoardInformations->s_Module [w_ModulCounter].ul_GainFactor [w_GainIndex] = (w_GainFactorValue [1] << 16) + w_GainFactorValue [0]; + +# ifdef PRINT_INFO + printk ("\n w_GainFactorValue [%d] = %lu", w_GainIndex, BoardInformations->s_Module [w_ModulCounter].ul_GainFactor [w_GainIndex]); +# endif + } + + /***************************************************************/ + /** Read current source value for each channels of the module **/ + /***************************************************************/ + for (w_Input = 0; w_Input < w_NumberOfInputs; w_Input++) + { + /********************************************/ + /** Read current sources value for input 1 **/ + /********************************************/ + i_AddiHeaderRW_ReadEeprom (2, //i_NbOfWordsToRead + dw_PCIBoardEepromAddress, + (w_Input * w_SingleHeaderSize) + w_SingleHeaderAddress + 0x0C, + w_CurrentSources); + + + /************************************/ + /** Save the current sources value **/ + /************************************/ + BoardInformations->s_Module [w_ModulCounter].ul_CurrentSource [w_Input] = (w_CurrentSources [0] + ((w_CurrentSources [1] & 0xFFF) << 16)); + +# ifdef PRINT_INFO + printk ("\n Current sources [%d] = %lu", w_Input, BoardInformations->s_Module [w_ModulCounter].ul_CurrentSource [w_Input]); +# endif + } + + /***************************************/ + /** Read the CJC current source value **/ + /***************************************/ + i_AddiHeaderRW_ReadEeprom (2, //i_NbOfWordsToRead + dw_PCIBoardEepromAddress, + (w_Input * w_SingleHeaderSize) + w_SingleHeaderAddress + 0x0C, + w_CurrentSources); + + /************************************/ + /** Save the current sources value **/ + /************************************/ + BoardInformations->s_Module [w_ModulCounter].ul_CurrentSourceCJC = (w_CurrentSources [0] + ((w_CurrentSources [1] & 0xFFF) << 16)); + +# ifdef PRINT_INFO + printk ("\n Current sources CJC = %lu", BoardInformations->s_Module [w_ModulCounter].ul_CurrentSourceCJC); +# endif + } +} + +INT i_APCI3200_GetChannelCalibrationValue (comedi_device *dev, unsigned int ui_Channel_num, lsampl_t *CJCCurrentSource, + lsampl_t *ChannelCurrentSource, + lsampl_t *ChannelGainFactor) { - UINT ui_Temp=0; - UINT ui_NoOfChannel=0; - ui_NoOfChannel=CR_CHAN(insn->chanspec); - ui_Temp=data[0]; - *data=inl(devpriv->i_IobaseReserved); + int i_DiffChannel = 0; + int i_Module = 0; + +#ifdef PRINT_INFO + printk ("\n Channel = %u", ui_Channel_num); +#endif + + //Test if single or differential mode + if (s_BoardInfos [dev->minor].i_ConnectionType == 1) + { + //if diff - if (ui_Temp==0) - { + if((ui_Channel_num >=0) && (ui_Channel_num <=1)) + i_DiffChannel=ui_Channel_num, i_Module = 0; + else + if((ui_Channel_num >=2) && (ui_Channel_num <=3)) + i_DiffChannel=ui_Channel_num-2, i_Module = 1; + else + if((ui_Channel_num >=4) && (ui_Channel_num <=5)) + i_DiffChannel=ui_Channel_num-4, i_Module = 2; + else + if((ui_Channel_num >=6) && (ui_Channel_num <=7)) + i_DiffChannel=ui_Channel_num-6, i_Module = 3; + + } + else + { + // if single + if((ui_Channel_num == 0) || (ui_Channel_num == 1)) + i_DiffChannel=0, i_Module = 0; + else + if((ui_Channel_num == 2) || (ui_Channel_num == 3)) + i_DiffChannel=1, i_Module = 0; + else + if((ui_Channel_num == 4) || (ui_Channel_num == 5)) + i_DiffChannel=0, i_Module = 1; + else + if((ui_Channel_num == 6) || (ui_Channel_num == 7)) + i_DiffChannel=1, i_Module = 1; + else + if((ui_Channel_num == 8) || (ui_Channel_num == 9)) + i_DiffChannel=0, i_Module = 2; + else + if((ui_Channel_num == 10) || (ui_Channel_num == 11)) + i_DiffChannel=1, i_Module = 2; + else + if((ui_Channel_num == 12) || (ui_Channel_num == 13)) + i_DiffChannel=0, i_Module = 3; + else + if((ui_Channel_num == 14) || (ui_Channel_num == 15)) + i_DiffChannel=1, i_Module = 3; + } + + //Test if thermocouple or RTD mode + *CJCCurrentSource = s_BoardInfos [dev->minor].s_Module[i_Module].ul_CurrentSourceCJC; +#ifdef PRINT_INFO + printk ("\n CJCCurrentSource = %lu", *CJCCurrentSource); +#endif + + *ChannelCurrentSource = s_BoardInfos [dev->minor].s_Module[i_Module].ul_CurrentSource [i_DiffChannel]; +#ifdef PRINT_INFO + printk ("\n ChannelCurrentSource = %lu", *ChannelCurrentSource); +#endif + // } + // } + + //Channle gain factor + *ChannelGainFactor = s_BoardInfos [dev->minor].s_Module[i_Module].ul_GainFactor [s_BoardInfos [dev->minor].i_ADDIDATAGain]; +#ifdef PRINT_INFO + printk ("\n ChannelGainFactor = %lu", *ChannelGainFactor); +#endif + //End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + + return (0); +} + +//End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + + + + + + +/* + +----------------------------------------------------------------------------+ + | Function Name : int i_APCI3200_ReadDigitalInput | + | (comedi_device *dev,comedi_subdevice *s, | + | comedi_insn *insn,lsampl_t *data) | + +----------------------------------------------------------------------------+ + | Task : Read value of the selected channel or port | + +----------------------------------------------------------------------------+ + | Input Parameters : comedi_device *dev : Driver handle | + | UINT ui_NoOfChannels : No Of Channels To read for Port + Channel Numberfor single channel + | UINT data[0] : 0: Read single channel + 1: Read port value + data[1] Port number + +----------------------------------------------------------------------------+ + | Output Parameters : -- data[0] :Read status value + +----------------------------------------------------------------------------+ + | Return Value : TRUE : No error occur | + | : FALSE : Error occur. Return the error | + | | + +----------------------------------------------------------------------------+ +*/ + +INT i_APCI3200_ReadDigitalInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) +{ + UINT ui_Temp=0; + UINT ui_NoOfChannel=0; + ui_NoOfChannel=CR_CHAN(insn->chanspec); + ui_Temp=data[0]; + *data=inl(devpriv->i_IobaseReserved); + + if (ui_Temp==0) + { *data=(*data >> ui_NoOfChannel)&0x1; - } //if (ui_Temp==0) - else - { + } //if (ui_Temp==0) + else + { if (ui_Temp==1) - { - if(data[1] < 0 || data[1] >1) - { - printk("\nThe port number is in error\n"); - return -EINVAL; - }//if(data[1] < 0 || data[1] >1) - switch( ui_NoOfChannel) - { - - case 2: - *data=(*data >>(2*data[1]))&0x3; - break; - case 3: - *data=(*data & 15 ); - break; - default: - comedi_error(dev," chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + { + if(data[1] < 0 || data[1] >1) + { + printk("\nThe port number is in error\n"); + return -EINVAL; + }//if(data[1] < 0 || data[1] >1) + switch( ui_NoOfChannel) + { + + case 2: + *data=(*data >>(2*data[1]))&0x3; + break; + case 3: + *data=(*data & 15 ); + break; + default: + comedi_error(dev," chan spec wrong"); + return -EINVAL; // "sorry channel spec wrong " - }//switch(ui_NoOfChannels) - }//if (ui_Temp==1) - else - { - printk("\nSpecified channel not supported \n"); - }//elseif (ui_Temp==1) - } -return insn->n; + }//switch(ui_NoOfChannels) + }//if (ui_Temp==1) + else + { + printk("\nSpecified channel not supported \n"); + }//elseif (ui_Temp==1) + } + return insn->n; } /* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI3200_ConfigDigitalOutput | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Configures The Digital Output Subdevice. | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| data[0] :1 Memory enable - 0 Memory Disable -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ + +----------------------------------------------------------------------------+ + | Function Name : int i_APCI3200_ConfigDigitalOutput | + | (comedi_device *dev,comedi_subdevice *s, | + | comedi_insn *insn,lsampl_t *data) | + +----------------------------------------------------------------------------+ + | Task : Configures The Digital Output Subdevice. | + +----------------------------------------------------------------------------+ + | Input Parameters : comedi_device *dev : Driver handle | + | data[0] :1 Memory enable + 0 Memory Disable + +----------------------------------------------------------------------------+ + | Output Parameters : -- | + +----------------------------------------------------------------------------+ + | Return Value : TRUE : No error occur | + | : FALSE : Error occur. Return the error | + | | + +----------------------------------------------------------------------------+ */ int i_APCI3200_ConfigDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) { -if ( (data[0]!=0) && (data[0]!=1) ) - { - comedi_error(dev,"Not a valid Data !!! ,Data should be 1 or 0\n"); - return -EINVAL; - }//if ( (data[0]!=0) && (data[0]!=1) ) + if ( (data[0]!=0) && (data[0]!=1) ) + { + comedi_error(dev,"Not a valid Data !!! ,Data should be 1 or 0\n"); + return -EINVAL; + }//if ( (data[0]!=0) && (data[0]!=1) ) if (data[0]) - { - devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE ; - }// if (data[0]) + { + devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE ; + }// if (data[0]) else - { - devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE; - }//else if (data[0]) -return insn->n; + { + devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE; + }//else if (data[0]) + return insn->n; } /* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI3200_WriteDigitalOutput | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : writes To the digital Output Subdevice | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| comedi_subdevice *s : Subdevice Pointer | -| comedi_insn *insn : Insn Structure Pointer | -| lsampl_t *data : Data Pointer contains | -| configuration parameters as below | -| data[0] :Value to output - data[1] : 0 o/p single channel - 1 o/p port - data[2] : port no - data[3] :0 set the digital o/p on - 1 set the digital o/p off -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ + +----------------------------------------------------------------------------+ + | Function Name : int i_APCI3200_WriteDigitalOutput | + | (comedi_device *dev,comedi_subdevice *s, | + | comedi_insn *insn,lsampl_t *data) | + +----------------------------------------------------------------------------+ + | Task : writes To the digital Output Subdevice | + +----------------------------------------------------------------------------+ + | Input Parameters : comedi_device *dev : Driver handle | + | comedi_subdevice *s : Subdevice Pointer | + | comedi_insn *insn : Insn Structure Pointer | + | lsampl_t *data : Data Pointer contains | + | configuration parameters as below | + | data[0] :Value to output + data[1] : 0 o/p single channel + 1 o/p port + data[2] : port no + data[3] :0 set the digital o/p on + 1 set the digital o/p off + +----------------------------------------------------------------------------+ + | Output Parameters : -- | + +----------------------------------------------------------------------------+ + | Return Value : TRUE : No error occur | + | : FALSE : Error occur. Return the error | + | | + +----------------------------------------------------------------------------+ */ INT i_APCI3200_WriteDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) { -UINT ui_Temp=0,ui_Temp1=0; -UINT ui_NoOfChannel = CR_CHAN(insn->chanspec); // get the channel - if(devpriv->b_OutputMemoryStatus ) - { - ui_Temp=inl(devpriv->i_IobaseAddon); + UINT ui_Temp=0,ui_Temp1=0; + UINT ui_NoOfChannel = CR_CHAN(insn->chanspec); // get the channel + if(devpriv->b_OutputMemoryStatus ) + { + ui_Temp=inl(devpriv->i_IobaseAddon); - }//if(devpriv->b_OutputMemoryStatus ) - else - { - ui_Temp=0; }//if(devpriv->b_OutputMemoryStatus ) -if(data[3]==0) - { - if(data[1]==0) - { - data[0]=(data[0] << ui_NoOfChannel)|ui_Temp; - outl(data[0],devpriv->i_IobaseAddon); - }//if(data[1]==0) else { - if(data[1]==1) - { - switch( ui_NoOfChannel) - { - - case 2:data[0]=(data[0] << (2 * data[2]))|ui_Temp; - break; - case 3:data[0]=(data[0]|ui_Temp); - break; - }//switch(ui_NoOfChannels) + ui_Temp=0; + }//if(devpriv->b_OutputMemoryStatus ) + if(data[3]==0) + { + if(data[1]==0) + { + data[0]=(data[0] << ui_NoOfChannel)|ui_Temp; + outl(data[0],devpriv->i_IobaseAddon); + }//if(data[1]==0) + else + { + if(data[1]==1) + { + switch( ui_NoOfChannel) + { + + case 2:data[0]=(data[0] << (2 * data[2]))|ui_Temp; + break; + case 3:data[0]=(data[0]|ui_Temp); + break; + }//switch(ui_NoOfChannels) - outl(data[0],devpriv->i_IobaseAddon); - }// if(data[1]==1) - else - { - printk("\nSpecified channel not supported\n"); - }//else if(data[1]==1) - }//elseif(data[1]==0) - }//if(data[3]==0) -else - { - if(data[3]==1) - { - if(data[1]==0) - { - data[0]=~data[0]&0x1; - ui_Temp1=1; - ui_Temp1=ui_Temp1<i_IobaseAddon); - }//if(data[1]==0) - else - { - if(data[1]==1) - { - switch( ui_NoOfChannel) - { - - case 2: data[0]=~data[0]&0x3; - ui_Temp1=3; - ui_Temp1=ui_Temp1<<2 * data[2]; - ui_Temp=ui_Temp|ui_Temp1; - data[0]=((data[0] << (2 * data[2]))^0xf)& ui_Temp; - - break; - case 3: - break; - - default: + outl(data[0],devpriv->i_IobaseAddon); + }// if(data[1]==1) + else + { + printk("\nSpecified channel not supported\n"); + }//else if(data[1]==1) + }//elseif(data[1]==0) + }//if(data[3]==0) + else + { + if(data[3]==1) + { + if(data[1]==0) + { + data[0]=~data[0]&0x1; + ui_Temp1=1; + ui_Temp1=ui_Temp1<i_IobaseAddon); + }//if(data[1]==0) + else + { + if(data[1]==1) + { + switch( ui_NoOfChannel) + { + + case 2: data[0]=~data[0]&0x3; + ui_Temp1=3; + ui_Temp1=ui_Temp1<<2 * data[2]; + ui_Temp=ui_Temp|ui_Temp1; + data[0]=((data[0] << (2 * data[2]))^0xf)& ui_Temp; + + break; + case 3: + break; + + default: comedi_error(dev," chan spec wrong"); return -EINVAL; // "sorry channel spec wrong " - }//switch(ui_NoOfChannels) + }//switch(ui_NoOfChannels) - outl(data[0],devpriv->i_IobaseAddon); - }// if(data[1]==1) - else - { - printk("\nSpecified channel not supported\n"); - }//else if(data[1]==1) - }//elseif(data[1]==0) - }//if(data[3]==1); - else - { - printk("\nSpecified functionality does not exist\n"); - return -EINVAL; - }//if else data[3]==1) - }//if else data[3]==0) -return insn->n; + outl(data[0],devpriv->i_IobaseAddon); + }// if(data[1]==1) + else + { + printk("\nSpecified channel not supported\n"); + }//else if(data[1]==1) + }//elseif(data[1]==0) + }//if(data[3]==1); + else + { + printk("\nSpecified functionality does not exist\n"); + return -EINVAL; + }//if else data[3]==1) + }//if else data[3]==0) + return insn->n; } /* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI3200_ReadDigitalOutput | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Read value of the selected channel or port | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To read | -| UINT *data : Data Pointer to read status | - data[0] :0 read single channel - 1 read port value - data[1] port no + +----------------------------------------------------------------------------+ + | Function Name : int i_APCI3200_ReadDigitalOutput | + | (comedi_device *dev,comedi_subdevice *s, | + | comedi_insn *insn,lsampl_t *data) | + +----------------------------------------------------------------------------+ + | Task : Read value of the selected channel or port | + +----------------------------------------------------------------------------+ + | Input Parameters : comedi_device *dev : Driver handle | + | UINT ui_NoOfChannels : No Of Channels To read | + | UINT *data : Data Pointer to read status | + data[0] :0 read single channel + 1 read port value + data[1] port no -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ + +----------------------------------------------------------------------------+ + | Output Parameters : -- | + +----------------------------------------------------------------------------+ + | Return Value : TRUE : No error occur | + | : FALSE : Error occur. Return the error | + | | + +----------------------------------------------------------------------------+ */ INT i_APCI3200_ReadDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) { @@ -307,1669 +767,2132 @@ INT i_APCI3200_ReadDigitalOutput(comedi_device *dev,comedi_subdevice *s,comedi_i ui_NoOfChannel=CR_CHAN(insn->chanspec); ui_Temp=data[0]; *data=inl(devpriv->i_IobaseAddon); - if (ui_Temp==0) - { + if (ui_Temp==0) + { *data=(*data >> ui_NoOfChannel)&0x1; - } // if (ui_Temp==0) - else - { + } // if (ui_Temp==0) + else + { if (ui_Temp==1) - { - if(data[1] <0 ||data[1] >1) + { + if(data[1] <0 ||data[1] >1) { - printk("\nThe port selection is in error\n"); - return -EINVAL; + printk("\nThe port selection is in error\n"); + return -EINVAL; }//if(data[1] <0 ||data[1] >1) - switch (ui_NoOfChannel) - { - case 2: - *data=(*data >>(2*data[1]))&3; - break; + switch (ui_NoOfChannel) + { + case 2: + *data=(*data >>(2*data[1]))&3; + break; - case 3:break; + case 3:break; - default: - comedi_error(dev," chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " - break; - } // switch(ui_NoOfChannels) + default: + comedi_error(dev," chan spec wrong"); + return -EINVAL; // "sorry channel spec wrong " + break; + } // switch(ui_NoOfChannels) } // if (ui_Temp==1) - else + else { - printk("\nSpecified channel not supported \n"); + printk("\nSpecified channel not supported \n"); } // else if (ui_Temp==1) - } // else if (ui_Temp==0) - return insn->n; + } // else if (ui_Temp==0) + return insn->n; } /* - +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI3200_ConfigAnalogInput | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Configures The Analog Input Subdevice | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| comedi_subdevice *s : Subdevice Pointer | -| comedi_insn *insn : Insn Structure Pointer | -| lsampl_t *data : Data Pointer contains | -| configuration parameters as below | -| | -| data[0] -| 0:Normal AI | -| 1:RTD | -| 2:THERMOCOUPLE | -| data[1] : Gain To Use | -| | -| data[2] : Polarity -| 0:Bipolar | -| 1:Unipolar | -| | -| data[3] : Offset Range -| | -| data[4] : Coupling -| 0:DC Coupling | -| 1:AC Coupling | -| | -| data[5] :Differential/Single -| 0:Single | -| 1:Differential | -| | -| data[6] :TimerReloadValue -| | -| data[7] :ConvertingTimeUnit -| | -| data[8] :0 Analog voltage measurement - 1 Resistance measurement - 2 Temperature measurement -| data[9] :Interrupt -| 0:Disable -| 1:Enable - data[10] :Type of Thermocouple -| data[11] : 0: single channel - Module Number -| -| data[12] -| 0:Single Read -| 1:Read more channel - 2:Single scan -| 3:Continous Scan - data[13] :Number of channels to read -| data[14] :RTD connection type - :0:RTD not used - 1:RTD 2 wire connection - 2:RTD 3 wire connection - 3:RTD 4 wire connection -| | -| | -| | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ + +----------------------------------------------------------------------------+ + | Function Name : INT i_APCI3200_ConfigAnalogInput | + | (comedi_device *dev,comedi_subdevice *s, | + | comedi_insn *insn,lsampl_t *data) | + +----------------------------------------------------------------------------+ + | Task : Configures The Analog Input Subdevice | + +----------------------------------------------------------------------------+ + | Input Parameters : comedi_device *dev : Driver handle | + | comedi_subdevice *s : Subdevice Pointer | + | comedi_insn *insn : Insn Structure Pointer | + | lsampl_t *data : Data Pointer contains | + | configuration parameters as below | + | | + | data[0] + | 0:Normal AI | + | 1:RTD | + | 2:THERMOCOUPLE | + | data[1] : Gain To Use | + | | + | data[2] : Polarity + | 0:Bipolar | + | 1:Unipolar | + | | + | data[3] : Offset Range + | | + | data[4] : Coupling + | 0:DC Coupling | + | 1:AC Coupling | + | | + | data[5] :Differential/Single + | 0:Single | + | 1:Differential | + | | + | data[6] :TimerReloadValue + | | + | data[7] :ConvertingTimeUnit + | | + | data[8] :0 Analog voltage measurement + 1 Resistance measurement + 2 Temperature measurement + | data[9] :Interrupt + | 0:Disable + | 1:Enable + data[10] :Type of Thermocouple + | data[11] : 0: single channel + Module Number + | + | data[12] + | 0:Single Read + | 1:Read more channel + 2:Single scan + | 3:Continous Scan + data[13] :Number of channels to read + | data[14] :RTD connection type + :0:RTD not used + 1:RTD 2 wire connection + 2:RTD 3 wire connection + 3:RTD 4 wire connection + | | + | | + | | + +----------------------------------------------------------------------------+ + | Output Parameters : -- | + +----------------------------------------------------------------------------+ + | Return Value : TRUE : No error occur | + | : FALSE : Error occur. Return the error | + | | + +----------------------------------------------------------------------------+ */ INT i_APCI3200_ConfigAnalogInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) { - UINT ul_Config = 0,ul_Temp=0 ; - UINT ui_ChannelNo=0; - UINT ui_Dummy=0; - INT i_err=0; - if(data[0]!=0 && data[0]!=1 && data[0]!=2) - { - printk("\nThe selection of acquisition type is in error\n"); - i_err++; - }//if(data[0]!=0 && data[0]!=1 && data[0]!=2) - if(data[0]==1) - { - if(data[14]!=0 && data[14]!=1 && data[14]!=2 && data[14]!=4) - { + UINT ul_Config = 0,ul_Temp=0 ; + UINT ui_ChannelNo=0; + UINT ui_Dummy=0; + INT i_err=0; + + //Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + +#ifdef PRINT_INFO + INT i=0, i2=0; +#endif + //End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + + //BEGIN JK 06.07.04: Management of sevrals boards + // Initialize the structure + if (s_BoardInfos [dev->minor].b_StructInitialized != 1) + { + s_BoardInfos [dev->minor].i_CJCAvailable=1; + s_BoardInfos [dev->minor].i_CJCPolarity=0; + s_BoardInfos [dev->minor].i_CJCGain=2;//changed from 0 to 2 + s_BoardInfos [dev->minor].i_InterruptFlag=0; + s_BoardInfos [dev->minor].i_AutoCalibration=0; //: auto calibration + s_BoardInfos [dev->minor].i_ChannelCount=0; + s_BoardInfos [dev->minor].i_Sum=0; + s_BoardInfos [dev->minor].ui_Channel_num=0; + s_BoardInfos [dev->minor].i_Count=0; + s_BoardInfos [dev->minor].i_Initialised=0; + s_BoardInfos [dev->minor].b_StructInitialized = 1; + + //Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + s_BoardInfos [dev->minor].i_ConnectionType = 0; + //End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + + //Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + memset (s_BoardInfos [dev->minor].s_Module, 0, sizeof (s_BoardInfos [dev->minor].s_Module[MAX_MODULE])); + + v_GetAPCI3200EepromCalibrationValue (devpriv->i_IobaseAmcc, &s_BoardInfos [dev->minor]); + +#ifdef PRINT_INFO + for (i=0; iminor].s_Module[i].ul_CurrentSourceCJC); + + for (i2=0; i2<5; i2++) + { + printk ("\n s_Module[%i].ul_CurrentSource [%i] = %lu",i, i2, s_BoardInfos [dev->minor].s_Module[i].ul_CurrentSource [i2]); + } + + for (i2=0; i2<8; i2++) + { + printk ("\n s_Module[%i].ul_GainFactor [%i] = %lu",i, i2, s_BoardInfos [dev->minor].s_Module[i].ul_GainFactor [i2]); + } + + for (i2=0; i2<8; i2++) + { + printk ("\n s_Module[%i].w_GainValue [%i] = %u",i, i2, s_BoardInfos [dev->minor].s_Module[i].w_GainValue [i2]); + } + } +#endif + //End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + } + + if(data[0]!=0 && data[0]!=1 && data[0]!=2) + { + printk("\nThe selection of acquisition type is in error\n"); + i_err++; + }//if(data[0]!=0 && data[0]!=1 && data[0]!=2) + if(data[0]==1) + { + if(data[14]!=0 && data[14]!=1 && data[14]!=2 && data[14]!=4) + { printk("\n Error in selection of RTD connection type\n"); i_err++; - }//if(data[14]!=0 && data[14]!=1 && data[14]!=2 && data[14]!=4) - }//if(data[0]==1 ) - if(data[1]<0 || data[1]>7) - { - printk("\nThe selection of gain is in error\n"); - i_err++; - } // if(data[1]<0 || data[1]>7) - if(data[2]!=0 && data[2]!=1) - { - printk("\nThe selection of polarity is in error\n"); - i_err++; - }//if(data[2]!=0 && data[2]!=1) - if(data[3]!=0) - { - printk("\nThe selection of offset range is in error\n"); - i_err++; - }// if(data[3]!=0) - if(data[4]!=0 && data[4]!=1) - { - printk("\nThe selection of coupling is in error\n"); - i_err++; - }//if(data[4]!=0 && data[4]!=1) - if(data[5]!=0 && data[5]!=1) - { - printk("\nThe selection of single/differential mode is in error\n"); - i_err++; - }//if(data[5]!=0 && data[5]!=1) - if(data[8]!=0 && data[8]!=1 && data[2]!=2) - { - printk("\nError in selection of functionality\n"); - }//if(data[8]!=0 && data[8]!=1 && data[2]!=2) - if(data[12]==0 || data[12]==1) - { + }//if(data[14]!=0 && data[14]!=1 && data[14]!=2 && data[14]!=4) + }//if(data[0]==1 ) + if(data[1]<0 || data[1]>7) + { + printk("\nThe selection of gain is in error\n"); + i_err++; + } // if(data[1]<0 || data[1]>7) + if(data[2]!=0 && data[2]!=1) + { + printk("\nThe selection of polarity is in error\n"); + i_err++; + }//if(data[2]!=0 && data[2]!=1) + if(data[3]!=0) + { + printk("\nThe selection of offset range is in error\n"); + i_err++; + }// if(data[3]!=0) + if(data[4]!=0 && data[4]!=1) + { + printk("\nThe selection of coupling is in error\n"); + i_err++; + }//if(data[4]!=0 && data[4]!=1) + if(data[5]!=0 && data[5]!=1) + { + printk("\nThe selection of single/differential mode is in error\n"); + i_err++; + }//if(data[5]!=0 && data[5]!=1) + if(data[8]!=0 && data[8]!=1 && data[2]!=2) + { + printk("\nError in selection of functionality\n"); + }//if(data[8]!=0 && data[8]!=1 && data[2]!=2) + if(data[12]==0 || data[12]==1) + { if (data[6]!=20 && data[6]!=40 && data[6]!=80 && data[6]!=160 ) - { - printk("\nThe selection of conversion time reload value is in error\n"); - i_err++; - }// if (data[6]!=20 && data[6]!=40 && data[6]!=80 && data[6]!=160 ) + { + printk("\nThe selection of conversion time reload value is in error\n"); + i_err++; + }// if (data[6]!=20 && data[6]!=40 && data[6]!=80 && data[6]!=160 ) if(data[7]!=2) { - printk("\nThe selection of conversion time unit is in error\n"); - i_err++; + printk("\nThe selection of conversion time unit is in error\n"); + i_err++; }// if(data[7]!=2) - } - if(data[9]!=0 && data[9]!=1) - { - printk("\nThe selection of interrupt enable is in error\n"); - i_err++; - }//if(data[9]!=0 && data[9]!=1) - if(data[11] < 0 || data[11] > 4) - { - printk("\nThe selection of module is in error\n"); - i_err++; - }//if(data[11] <0 || data[11]>1) - if(data[12] < 0 || data[12] > 3) - { - printk("\nThe selection of singlechannel/scan selection is in error\n"); - i_err++; - }//if(data[12] < 0 || data[12]> 3) - if(data[13] <0 ||data[13] >16) - { - printk("\nThe selection of number of channels is in error\n"); - i_err++; - }// if(data[13] <0 ||data[13] >15) + } + if(data[9]!=0 && data[9]!=1) + { + printk("\nThe selection of interrupt enable is in error\n"); + i_err++; + }//if(data[9]!=0 && data[9]!=1) + if(data[11] < 0 || data[11] > 4) + { + printk("\nThe selection of module is in error\n"); + i_err++; + }//if(data[11] <0 || data[11]>1) + if(data[12] < 0 || data[12] > 3) + { + printk("\nThe selection of singlechannel/scan selection is in error\n"); + i_err++; + }//if(data[12] < 0 || data[12]> 3) + if(data[13] <0 ||data[13] >16) + { + printk("\nThe selection of number of channels is in error\n"); + i_err++; + }// if(data[13] <0 ||data[13] >15) - - i_ChannelCount=data[13]; - i_ScanType=data[12]; - i_ADDIDATAPolarity = data[2]; - i_ADDIDATAGain=data[1]; - i_ADDIDATAConversionTime=data[6]; - i_ADDIDATAConversionTimeUnit=data[7]; - i_ADDIDATAType=data[0]; - while(i_InterruptFlag==1) - { + + //BEGIN JK 06.07.04: Management of sevrals boards + /* + i_ChannelCount=data[13]; + i_ScanType=data[12]; + i_ADDIDATAPolarity = data[2]; + i_ADDIDATAGain=data[1]; + i_ADDIDATAConversionTime=data[6]; + i_ADDIDATAConversionTimeUnit=data[7]; + i_ADDIDATAType=data[0]; + */ + + // Save acquisition configuration for the actual board + s_BoardInfos [dev->minor].i_ChannelCount=data[13]; + s_BoardInfos [dev->minor].i_ScanType=data[12]; + s_BoardInfos [dev->minor].i_ADDIDATAPolarity = data[2]; + s_BoardInfos [dev->minor].i_ADDIDATAGain=data[1]; + s_BoardInfos [dev->minor].i_ADDIDATAConversionTime=data[6]; + s_BoardInfos [dev->minor].i_ADDIDATAConversionTimeUnit=data[7]; + s_BoardInfos [dev->minor].i_ADDIDATAType=data[0]; + //Begin JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 + s_BoardInfos [dev->minor].i_ConnectionType=data[5]; + //End JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 + //END JK 06.07.04: Management of sevrals boards + + //Begin JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 + memset (s_BoardInfos [dev->minor].ui_ScanValueArray, 0, (7+12)*sizeof (lsampl_t)); // 7 is the maximal number of channels + //End JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 + + //BEGIN JK 02.07.04 : This while can't be do, it block the process when using severals boards + //while(i_InterruptFlag==1) + while(s_BoardInfos [dev->minor].i_InterruptFlag==1) + { +#ifndef MSXBOX udelay(1); - } +#else + // In the case where the driver is compiled for the MSX-Box + // we used a printk to have a little delay because udelay + // seems to be broken under the MSX-Box. + // This solution hat to be studied. + printk(""); +#endif + } + //END JK 02.07.04 : This while can't be do, it block the process when using severals boards - ui_ChannelNo = CR_CHAN(insn->chanspec); // get the channel - i_ChannelNo=ui_ChannelNo; - ui_Channel_num =ui_ChannelNo; - if(data[5]==0) - { - if(ui_ChannelNo<0 || ui_ChannelNo>15) - { - printk("\nThe Selection of the channel is in error\n"); - i_err++; - }// if(ui_ChannelNo<0 || ui_ChannelNo>15) + ui_ChannelNo = CR_CHAN(insn->chanspec); // get the channel + //BEGIN JK 06.07.04: Management of sevrals boards + //i_ChannelNo=ui_ChannelNo; + //ui_Channel_num =ui_ChannelNo; + + s_BoardInfos [dev->minor].i_ChannelNo=ui_ChannelNo; + s_BoardInfos [dev->minor].ui_Channel_num=ui_ChannelNo; + + //END JK 06.07.04: Management of sevrals boards + + if(data[5]==0) + { + if(ui_ChannelNo<0 || ui_ChannelNo>15) + { + printk("\nThe Selection of the channel is in error\n"); + i_err++; + }// if(ui_ChannelNo<0 || ui_ChannelNo>15) }//if(data[5]==0) - else - { - if(data[14]==2) - { - if(ui_ChannelNo<0 || ui_ChannelNo>3) - { - printk("\nThe Selection of the channel is in error\n"); - i_err++; - }// if(ui_ChannelNo<0 || ui_ChannelNo>3) - }//if(data[14]==2) - else - { - if(ui_ChannelNo<0 || ui_ChannelNo>7) - { - printk("\nThe Selection of the channel is in error\n"); - i_err++; - }// if(ui_ChannelNo<0 || ui_ChannelNo>7) - }//elseif(data[14]==2) - }//elseif(data[5]==0) - if(data[12]==0 || data[12]==1) - { - switch(data[5]) - { - case 0: - if(ui_ChannelNo >=0 && ui_ChannelNo <=3) - { - i_Offset=0; - }//if(ui_ChannelNo >=0 && ui_ChannelNo <=3) - if(ui_ChannelNo >=4 && ui_ChannelNo <=7) - { - i_Offset=64; - }//if(ui_ChannelNo >=4 && ui_ChannelNo <=7) - if(ui_ChannelNo >=8 && ui_ChannelNo <=11) - { - i_Offset=128; - }//if(ui_ChannelNo >=8 && ui_ChannelNo <=11) - if(ui_ChannelNo >=12 && ui_ChannelNo <=15) - { - i_Offset=192; - }//if(ui_ChannelNo >=12 && ui_ChannelNo <=15) - break; - case 1: - if(data[14]==2) - { - if(ui_ChannelNo ==0 ) - { - i_Offset=0; - }//if(ui_ChannelNo ==0 ) - if(ui_ChannelNo ==1) - { - i_Offset=64; - }// if(ui_ChannelNo ==1) - if(ui_ChannelNo ==2 ) - { - i_Offset=128; - }//if(ui_ChannelNo ==2 ) - if(ui_ChannelNo ==3) - { - i_Offset=192; - }//if(ui_ChannelNo ==3) - i_ChannelNo=0; - ui_ChannelNo=0; - break; - }//if(data[14]==2) - if(ui_ChannelNo >=0 && ui_ChannelNo <=1) - { - i_Offset=0; - }//if(ui_ChannelNo >=0 && ui_ChannelNo <=1) - if(ui_ChannelNo >=2 && ui_ChannelNo <=3) - { - i_ChannelNo=i_ChannelNo-2; - ui_ChannelNo=ui_ChannelNo-2; - i_Offset=64; - }//if(ui_ChannelNo >=2 && ui_ChannelNo <=3) - if(ui_ChannelNo >=4 && ui_ChannelNo <=5) - { - i_ChannelNo=i_ChannelNo-4; - ui_ChannelNo=ui_ChannelNo-4; - i_Offset=128; - }//if(ui_ChannelNo >=4 && ui_ChannelNo <=5) - if(ui_ChannelNo >=6 && ui_ChannelNo <=7) - { - i_ChannelNo=i_ChannelNo-6; - ui_ChannelNo=ui_ChannelNo-6; - i_Offset=192; - }//if(ui_ChannelNo >=6 && ui_ChannelNo <=7) - break; + else + { + if(data[14]==2) + { + if(ui_ChannelNo<0 || ui_ChannelNo>3) + { + printk("\nThe Selection of the channel is in error\n"); + i_err++; + }// if(ui_ChannelNo<0 || ui_ChannelNo>3) + }//if(data[14]==2) + else + { + if(ui_ChannelNo<0 || ui_ChannelNo>7) + { + printk("\nThe Selection of the channel is in error\n"); + i_err++; + }// if(ui_ChannelNo<0 || ui_ChannelNo>7) + }//elseif(data[14]==2) + }//elseif(data[5]==0) + if(data[12]==0 || data[12]==1) + { + switch(data[5]) + { + case 0: + if(ui_ChannelNo >=0 && ui_ChannelNo <=3) + { + //BEGIN JK 06.07.04: Management of sevrals boards + //i_Offset=0; + s_BoardInfos [dev->minor].i_Offset=0; + //END JK 06.07.04: Management of sevrals boards + }//if(ui_ChannelNo >=0 && ui_ChannelNo <=3) + if(ui_ChannelNo >=4 && ui_ChannelNo <=7) + { + //BEGIN JK 06.07.04: Management of sevrals boards + //i_Offset=64; + s_BoardInfos [dev->minor].i_Offset=64; + //END JK 06.07.04: Management of sevrals boards + }//if(ui_ChannelNo >=4 && ui_ChannelNo <=7) + if(ui_ChannelNo >=8 && ui_ChannelNo <=11) + { + //BEGIN JK 06.07.04: Management of sevrals boards + //i_Offset=128; + s_BoardInfos [dev->minor].i_Offset=128; + //END JK 06.07.04: Management of sevrals boards + }//if(ui_ChannelNo >=8 && ui_ChannelNo <=11) + if(ui_ChannelNo >=12 && ui_ChannelNo <=15) + { + //BEGIN JK 06.07.04: Management of sevrals boards + //i_Offset=192; + s_BoardInfos [dev->minor].i_Offset=192; + //END JK 06.07.04: Management of sevrals boards + }//if(ui_ChannelNo >=12 && ui_ChannelNo <=15) + break; + case 1: + if(data[14]==2) + { + if(ui_ChannelNo ==0 ) + { + //BEGIN JK 06.07.04: Management of sevrals boards + //i_Offset=0; + s_BoardInfos [dev->minor].i_Offset=0; + //END JK 06.07.04: Management of sevrals boards + }//if(ui_ChannelNo ==0 ) + if(ui_ChannelNo ==1) + { + //BEGIN JK 06.07.04: Management of sevrals boards + //i_Offset=0; + s_BoardInfos [dev->minor].i_Offset=64; + //END JK 06.07.04: Management of sevrals boards + }// if(ui_ChannelNo ==1) + if(ui_ChannelNo ==2 ) + { + //BEGIN JK 06.07.04: Management of sevrals boards + //i_Offset=128; + s_BoardInfos [dev->minor].i_Offset=128; + //END JK 06.07.04: Management of sevrals boards + }//if(ui_ChannelNo ==2 ) + if(ui_ChannelNo ==3) + { + //BEGIN JK 06.07.04: Management of sevrals boards + //i_Offset=192; + s_BoardInfos [dev->minor].i_Offset=192; + //END JK 06.07.04: Management of sevrals boards + }//if(ui_ChannelNo ==3) + + //BEGIN JK 06.07.04: Management of sevrals boards + //i_ChannelNo=0; + s_BoardInfos [dev->minor].i_ChannelNo=0; + //END JK 06.07.04: Management of sevrals boards + ui_ChannelNo=0; + break; + }//if(data[14]==2) + if(ui_ChannelNo >=0 && ui_ChannelNo <=1) + { + //BEGIN JK 06.07.04: Management of sevrals boards + //i_Offset=0; + s_BoardInfos [dev->minor].i_Offset=0; + //END JK 06.07.04: Management of sevrals boards + }//if(ui_ChannelNo >=0 && ui_ChannelNo <=1) + if(ui_ChannelNo >=2 && ui_ChannelNo <=3) + { + //BEGIN JK 06.07.04: Management of sevrals boards + //i_ChannelNo=i_ChannelNo-2; + //i_Offset=64; + s_BoardInfos [dev->minor].i_ChannelNo=s_BoardInfos [dev->minor].i_ChannelNo-2; + s_BoardInfos [dev->minor].i_Offset=64; + //END JK 06.07.04: Management of sevrals boards + ui_ChannelNo=ui_ChannelNo-2; + }//if(ui_ChannelNo >=2 && ui_ChannelNo <=3) + if(ui_ChannelNo >=4 && ui_ChannelNo <=5) + { + //BEGIN JK 06.07.04: Management of sevrals boards + //i_ChannelNo=i_ChannelNo-4; + //i_Offset=128; + s_BoardInfos [dev->minor].i_ChannelNo=s_BoardInfos [dev->minor].i_ChannelNo-4; + s_BoardInfos [dev->minor].i_Offset=128; + //END JK 06.07.04: Management of sevrals boards + ui_ChannelNo=ui_ChannelNo-4; + }//if(ui_ChannelNo >=4 && ui_ChannelNo <=5) + if(ui_ChannelNo >=6 && ui_ChannelNo <=7) + { + //BEGIN JK 06.07.04: Management of sevrals boards + //i_ChannelNo=i_ChannelNo-6; + //i_Offset=192; + s_BoardInfos [dev->minor].i_ChannelNo=s_BoardInfos [dev->minor].i_ChannelNo-6; + s_BoardInfos [dev->minor].i_Offset=192; + //END JK 06.07.04: Management of sevrals boards + ui_ChannelNo=ui_ChannelNo-6; + }//if(ui_ChannelNo >=6 && ui_ChannelNo <=7) + break; default: printk("\n This selection of polarity does not exist\n"); - i_err++; + i_err++; }//switch(data[2]) - }//if(data[12]==0 || data[12]==1) - else - { - switch(data[11]) - { - case 1:i_Offset=0; - break; - case 2:i_Offset=64; - break; - case 3:i_Offset=128; - break; - case 4:i_Offset=192; - break; - default: - printk("\nError in module selection\n"); - i_err++; - }// switch(data[11]) - }// elseif(data[12]==0 || data[12]==1) - if(i_err) - { + }//if(data[12]==0 || data[12]==1) + else + { + switch(data[11]) + { + case 1: + //BEGIN JK 06.07.04: Management of sevrals boards + //i_Offset=0; + s_BoardInfos [dev->minor].i_Offset=0; + //END JK 06.07.04: Management of sevrals boards + break; + case 2: + //BEGIN JK 06.07.04: Management of sevrals boards + //i_Offset=64; + s_BoardInfos [dev->minor].i_Offset=64; + //END JK 06.07.04: Management of sevrals boards + break; + case 3: + //BEGIN JK 06.07.04: Management of sevrals boards + //i_Offset=128; + s_BoardInfos [dev->minor].i_Offset=128; + //END JK 06.07.04: Management of sevrals boards + break; + case 4: + //BEGIN JK 06.07.04: Management of sevrals boards + //i_Offset=192; + s_BoardInfos [dev->minor].i_Offset=192; + //END JK 06.07.04: Management of sevrals boards + break; + default: + printk("\nError in module selection\n"); + i_err++; + }// switch(data[11]) + }// elseif(data[12]==0 || data[12]==1) + if(i_err) + { i_APCI3200_Reset(dev); return -EINVAL; - } - if(i_ScanType!=1) - { - i_Count=0; - i_Sum=0; - }//if(i_ScanType!=1) - - - - ul_Config = data[1] |(data[2] << 6) |(data[5]<< 7) |(data[3] << 8) |(data[4] << 9); - - - - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - /*********************************/ - /* Write the channel to configure*/ - /*********************************/ - outl(0 | ui_ChannelNo , devpriv->iobase+i_Offset + 0x4); - - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - /**************************/ - /* Reset the configuration */ - /**************************/ - outl(0 , devpriv->iobase+i_Offset + 0x0); + } + //if(i_ScanType!=1) + if(s_BoardInfos [dev->minor].i_ScanType!=1) + { + //BEGIN JK 06.07.04: Management of sevrals boards + //i_Count=0; + //i_Sum=0; + s_BoardInfos [dev->minor].i_Count=0; + s_BoardInfos [dev->minor].i_Sum=0; + //END JK 06.07.04: Management of sevrals boards + }//if(i_ScanType!=1) - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + ul_Config = data[1] |(data[2] << 6) |(data[5]<< 7) |(data[3] << 8) |(data[4] << 9); + //BEGIN JK 06.07.04: Management of sevrals boards + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //END JK 06.07.04: Management of sevrals boards + /*********************************/ + /* Write the channel to configure*/ + /*********************************/ + //BEGIN JK 06.07.04: Management of sevrals boards + //outl(0 | ui_ChannelNo , devpriv->iobase+i_Offset + 0x4); + outl(0 | ui_ChannelNo , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 0x4); + //END JK 06.07.04: Management of sevrals boards + + //BEGIN JK 06.07.04: Management of sevrals boards + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //END JK 06.07.04: Management of sevrals boards + /**************************/ + /* Reset the configuration */ + /**************************/ + //BEGIN JK 06.07.04: Management of sevrals boards + //outl(0 , devpriv->iobase+i_Offset + 0x0); + outl(0 , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 0x0); + //END JK 06.07.04: Management of sevrals boards + + //BEGIN JK 06.07.04: Management of sevrals boards + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //END JK 06.07.04: Management of sevrals boards - /***************************/ - /* Write the configuration */ - /***************************/ - outl(ul_Config , devpriv->iobase+i_Offset + 0x0); - - /***************************/ - /*Reset the calibration bit*/ - /***************************/ - ul_Temp = inl(devpriv->iobase+i_Offset + 12); - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl((ul_Temp & 0xFFF9FFFF) , devpriv->iobase+i_Offset + 12); - if(data[9]==1) - { - devpriv->tsk_Current=current; - i_InterruptFlag=1; - }// if(data[9]==1) - else - { - i_InterruptFlag=0; - }//else if(data[9]==1) - i_Initialised=1; - if(i_ScanType==1) - { - i_Sum=i_Sum+1; - insn->unused[0]=0; - i_APCI3200_ReadAnalogInput(dev,s,insn,&ui_Dummy); - } -return insn->n; + /***************************/ + /* Write the configuration */ + /***************************/ + //BEGIN JK 06.07.04: Management of sevrals boards + //outl(ul_Config , devpriv->iobase+i_Offset + 0x0); + outl(ul_Config , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 0x0); + //END JK 06.07.04: Management of sevrals boards + + /***************************/ + /*Reset the calibration bit*/ + /***************************/ + //BEGIN JK 06.07.04: Management of sevrals boards + //ul_Temp = inl(devpriv->iobase+i_Offset + 12); + ul_Temp = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 12); + //END JK 06.07.04: Management of sevrals boards + + //BEGIN JK 06.07.04: Management of sevrals boards + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //END JK 06.07.04: Management of sevrals boards + + //BEGIN JK 06.07.04: Management of sevrals boards + //outl((ul_Temp & 0xFFF9FFFF) , devpriv->iobase+.i_Offset + 12); + outl((ul_Temp & 0xFFF9FFFF) , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 12); + //END JK 06.07.04: Management of sevrals boards + + if(data[9]==1) + { + devpriv->tsk_Current=current; + //BEGIN JK 06.07.04: Management of sevrals boards + //i_InterruptFlag=1; + s_BoardInfos [dev->minor].i_InterruptFlag=1; + //END JK 06.07.04: Management of sevrals boards + }// if(data[9]==1) + else + { + //BEGIN JK 06.07.04: Management of sevrals boards + //i_InterruptFlag=0; + s_BoardInfos [dev->minor].i_InterruptFlag=0; + //END JK 06.07.04: Management of sevrals boards + }//else if(data[9]==1) + + //BEGIN JK 06.07.04: Management of sevrals boards + //i_Initialised=1; + s_BoardInfos [dev->minor].i_Initialised=1; + //END JK 06.07.04: Management of sevrals boards + + //BEGIN JK 06.07.04: Management of sevrals boards + //if(i_ScanType==1) + if(s_BoardInfos [dev->minor].i_ScanType==1) + //END JK 06.07.04: Management of sevrals boards + { + //BEGIN JK 06.07.04: Management of sevrals boards + //i_Sum=i_Sum+1; + s_BoardInfos [dev->minor].i_Sum=s_BoardInfos [dev->minor].i_Sum+1; + //END JK 06.07.04: Management of sevrals boards + + insn->unused[0]=0; + i_APCI3200_ReadAnalogInput(dev,s,insn,&ui_Dummy); + } + + return insn->n; } /* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI3200_ReadAnalogInput | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Read value of the selected channel | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To read | -| UINT *data : Data Pointer to read status | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -| data[0] : Digital Value Of Input | -| data[1] : Calibration Offset Value | -| data[2] : Calibration Gain Value - data[3] : CJC value - data[4] : CJC offset value - data[5] : CJC gain value -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ + +----------------------------------------------------------------------------+ + | Function Name : int i_APCI3200_ReadAnalogInput | + | (comedi_device *dev,comedi_subdevice *s, | + | comedi_insn *insn,lsampl_t *data) | + +----------------------------------------------------------------------------+ + | Task : Read value of the selected channel | + +----------------------------------------------------------------------------+ + | Input Parameters : comedi_device *dev : Driver handle | + | UINT ui_NoOfChannels : No Of Channels To read | + | UINT *data : Data Pointer to read status | + +----------------------------------------------------------------------------+ + | Output Parameters : -- | + | data[0] : Digital Value Of Input | + | data[1] : Calibration Offset Value | + | data[2] : Calibration Gain Value + | data[3] : CJC value + | data[4] : CJC offset value + | data[5] : CJC gain value + | Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + | data[6] : CJC current source from eeprom + | data[7] : Channel current source from eeprom + | data[8] : Channle gain factor from eeprom + | End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + +----------------------------------------------------------------------------+ + | Return Value : TRUE : No error occur | + | : FALSE : Error occur. Return the error | + | | + +----------------------------------------------------------------------------+ */ INT i_APCI3200_ReadAnalogInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) { - UINT ui_DummyValue=0; - int i_ConvertCJCCalibration; - int i=0; - - - if(i_Initialised==0) - { - printk("\nThe channel is not initialised\n"); - i_APCI3200_Reset(dev); - return -EINVAL; - }//if(i_Initialised==0); + UINT ui_DummyValue=0; + int i_ConvertCJCCalibration; + int i=0; - - switch(insn->unused[0]) - { - case 0: + //BEGIN JK 06.07.04: Management of sevrals boards + //if(i_Initialised==0) + if(s_BoardInfos [dev->minor].i_Initialised==0) + //END JK 06.07.04: Management of sevrals boards + { + i_APCI3200_Reset(dev); + return -EINVAL; + }//if(i_Initialised==0); + +#ifdef PRINT_INFO + printk ("\n insn->unused[0] = %i", insn->unused[0]); +#endif + + switch(insn->unused[0]) + { + case 0: - i_APCI3200_Read1AnalogInputChannel(dev,s,insn,&ui_DummyValue); - ui_InterruptChannelValue[i_Count+0]=ui_DummyValue; - - if((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE) && (i_CJCAvailable==1)) - { - i_APCI3200_ReadCJCValue(dev,&ui_DummyValue); - ui_InterruptChannelValue[i_Count + 3]=ui_DummyValue; - }//if((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE)) - else - { - ui_InterruptChannelValue[i_Count + 3]=0; - }//elseif((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE) && (i_CJCAvailable==1)) - if (( i_AutoCalibration == FALSE) && (i_InterruptFlag == FALSE)) - { - i_APCI3200_ReadCalibrationOffsetValue(dev,&ui_DummyValue); - ui_InterruptChannelValue[i_Count + 1]=ui_DummyValue; - i_APCI3200_ReadCalibrationGainValue(dev,&ui_DummyValue); - ui_InterruptChannelValue[i_Count + 2]=ui_DummyValue; - }//if (( i_AutoCalibration == FALSE) && (i_InterruptFlag == FALSE)) - if((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE)&& (i_CJCAvailable==1)) - { - /**********************************************************/ - /*Test if the Calibration channel must be read for the CJC*/ - /**********************************************************/ - /**********************************/ - /*Test if the polarity is the same*/ - /**********************************/ - if(i_CJCPolarity!=i_ADDIDATAPolarity) - { - i_ConvertCJCCalibration=1; - }//if(i_CJCPolarity!=i_ADDIDATAPolarity) - else - { - if(i_CJCGain==i_ADDIDATAGain) - { - i_ConvertCJCCalibration=0; - }//if(i_CJCGain==i_ADDIDATAGain) - else - { - i_ConvertCJCCalibration=1; - }//elseif(i_CJCGain==i_ADDIDATAGain) - }//elseif(i_CJCPolarity!=i_ADDIDATAPolarity) - if(i_ConvertCJCCalibration==1) - { - i_APCI3200_ReadCJCCalOffset(dev,&ui_DummyValue); - ui_InterruptChannelValue[i_Count+4]=ui_DummyValue; - i_APCI3200_ReadCJCCalGain(dev,&ui_DummyValue); - ui_InterruptChannelValue[i_Count+5]=ui_DummyValue; - }//if(i_ConvertCJCCalibration==1) - else - { - ui_InterruptChannelValue[i_Count+4]=0; - ui_InterruptChannelValue[i_Count+5]=0; - }//elseif(i_ConvertCJCCalibration==1) - }//if((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE)) - if(i_ScanType!=1) - { - i_Count=0; - }//if(i_ScanType!=1) - else - { - i_Count=i_Count +6; - }//else if(i_ScanType!=1) - if((i_ScanType==1) &&(i_InterruptFlag==1)) - { - i_Count=i_Count-6; - } - if(i_ScanType==0) - { - data[0]= ui_InterruptChannelValue[0]; - data[1]= ui_InterruptChannelValue[1]; - data[2]= ui_InterruptChannelValue[2]; - data[3]= ui_InterruptChannelValue[3]; - data[4]= ui_InterruptChannelValue[4]; - data[5]= ui_InterruptChannelValue[5]; - - - } - break; - case 1 : - for(i=0;in;i++) - { - data[i]=ui_InterruptChannelValue[i]; - } - - i_Count=0; - i_Sum=0; - if(i_ScanType==1) - { - i_Initialised=0; - i_InterruptFlag=0; - } - break; - default:printk("\nThe parameters passed are in error\n"); - i_APCI3200_Reset(dev); - return -EINVAL; - }//switch(insn->unused[0]) -return insn->n; + i_APCI3200_Read1AnalogInputChannel(dev,s,insn,&ui_DummyValue); + //BEGIN JK 06.07.04: Management of sevrals boards + //ui_InterruptChannelValue[i_Count+0]=ui_DummyValue; + s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count+0]=ui_DummyValue; + //END JK 06.07.04: Management of sevrals boards + + //Begin JK 25.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + i_APCI3200_GetChannelCalibrationValue (dev,s_BoardInfos [dev->minor].ui_Channel_num, + &s_BoardInfos [dev->minor].ui_InterruptChannelValue [s_BoardInfos [dev->minor].i_Count+6], + &s_BoardInfos [dev->minor].ui_InterruptChannelValue [s_BoardInfos [dev->minor].i_Count+7], + &s_BoardInfos [dev->minor].ui_InterruptChannelValue [s_BoardInfos [dev->minor].i_Count+8]); + +#ifdef PRINT_INFO + printk ("\n s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count+6] = %lu", s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count+6]); + + printk ("\n s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count+7] = %lu", s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count+7]); + + printk ("\n s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count+8] = %lu", s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count+8]); +#endif + + //End JK 25.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + + //BEGIN JK 06.07.04: Management of sevrals boards + //if((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE) && (i_CJCAvailable==1)) + if((s_BoardInfos [dev->minor].i_ADDIDATAType==2) && (s_BoardInfos [dev->minor].i_InterruptFlag == FALSE) && (s_BoardInfos [dev->minor].i_CJCAvailable==1)) + //END JK 06.07.04: Management of sevrals boards + { + i_APCI3200_ReadCJCValue(dev,&ui_DummyValue); + //BEGIN JK 06.07.04: Management of sevrals boards + //ui_InterruptChannelValue[i_Count + 3]=ui_DummyValue; + s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count + 3]=ui_DummyValue; + //END JK 06.07.04: Management of sevrals boards + }//if((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE)) + else + { + //BEGIN JK 06.07.04: Management of sevrals boards + //ui_InterruptChannelValue[i_Count + 3]=0; + s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count + 3]=0; + //END JK 06.07.04: Management of sevrals boards + }//elseif((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE) && (i_CJCAvailable==1)) + + //BEGIN JK 06.07.04: Management of sevrals boards + //if (( i_AutoCalibration == FALSE) && (i_InterruptFlag == FALSE)) + if ((s_BoardInfos [dev->minor].i_AutoCalibration == FALSE) && (s_BoardInfos [dev->minor].i_InterruptFlag == FALSE)) + //END JK 06.07.04: Management of sevrals boards + { + i_APCI3200_ReadCalibrationOffsetValue(dev,&ui_DummyValue); + //BEGIN JK 06.07.04: Management of sevrals boards + //ui_InterruptChannelValue[i_Count + 1]=ui_DummyValue; + s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count + 1]=ui_DummyValue; + //END JK 06.07.04: Management of sevrals boards + i_APCI3200_ReadCalibrationGainValue(dev,&ui_DummyValue); + //BEGIN JK 06.07.04: Management of sevrals boards + //ui_InterruptChannelValue[i_Count + 2]=ui_DummyValue; + s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count + 2]=ui_DummyValue; + //END JK 06.07.04: Management of sevrals boards + }//if (( i_AutoCalibration == FALSE) && (i_InterruptFlag == FALSE)) + + //BEGIN JK 06.07.04: Management of sevrals boards + //if((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE)&& (i_CJCAvailable==1)) + if((s_BoardInfos [dev->minor].i_ADDIDATAType==2) && (s_BoardInfos [dev->minor].i_InterruptFlag == FALSE)&& (s_BoardInfos [dev->minor].i_CJCAvailable==1)) + //END JK 06.07.04: Management of sevrals boards + { + /**********************************************************/ + /*Test if the Calibration channel must be read for the CJC*/ + /**********************************************************/ + /**********************************/ + /*Test if the polarity is the same*/ + /**********************************/ + //BEGIN JK 06.07.04: Management of sevrals boards + //if(i_CJCPolarity!=i_ADDIDATAPolarity) + if(s_BoardInfos [dev->minor].i_CJCPolarity!=s_BoardInfos [dev->minor].i_ADDIDATAPolarity) + //END JK 06.07.04: Management of sevrals boards + { + i_ConvertCJCCalibration=1; + }//if(i_CJCPolarity!=i_ADDIDATAPolarity) + else + { + //BEGIN JK 06.07.04: Management of sevrals boards + //if(i_CJCGain==i_ADDIDATAGain) + if(s_BoardInfos [dev->minor].i_CJCGain==s_BoardInfos [dev->minor].i_ADDIDATAGain) + //END JK 06.07.04: Management of sevrals boards + { + i_ConvertCJCCalibration=0; + }//if(i_CJCGain==i_ADDIDATAGain) + else + { + i_ConvertCJCCalibration=1; + }//elseif(i_CJCGain==i_ADDIDATAGain) + }//elseif(i_CJCPolarity!=i_ADDIDATAPolarity) + if(i_ConvertCJCCalibration==1) + { + i_APCI3200_ReadCJCCalOffset(dev,&ui_DummyValue); + //BEGIN JK 06.07.04: Management of sevrals boards + //ui_InterruptChannelValue[i_Count+4]=ui_DummyValue; + s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count+4]=ui_DummyValue; + //END JK 06.07.04: Management of sevrals boards + + i_APCI3200_ReadCJCCalGain(dev,&ui_DummyValue); + + //BEGIN JK 06.07.04: Management of sevrals boards + //ui_InterruptChannelValue[i_Count+5]=ui_DummyValue; + s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count+5]=ui_DummyValue; + //END JK 06.07.04: Management of sevrals boards + }//if(i_ConvertCJCCalibration==1) + else + { + //BEGIN JK 06.07.04: Management of sevrals boards + //ui_InterruptChannelValue[i_Count+4]=0; + //ui_InterruptChannelValue[i_Count+5]=0; + + s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count+4]=0; + s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count+5]=0; + //END JK 06.07.04: Management of sevrals boards + }//elseif(i_ConvertCJCCalibration==1) + }//if((i_ADDIDATAType==2) && (i_InterruptFlag == FALSE)) + + //BEGIN JK 06.07.04: Management of sevrals boards + //if(i_ScanType!=1) + if(s_BoardInfos [dev->minor].i_ScanType!=1) + { + //i_Count=0; + s_BoardInfos [dev->minor].i_Count=0; + }//if(i_ScanType!=1) + else + { + //i_Count=i_Count +6; + //Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + //s_BoardInfos [dev->minor].i_Count=s_BoardInfos [dev->minor].i_Count +6; + s_BoardInfos [dev->minor].i_Count=s_BoardInfos [dev->minor].i_Count +9; + //End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + }//else if(i_ScanType!=1) + + //if((i_ScanType==1) &&(i_InterruptFlag==1)) + if((s_BoardInfos [dev->minor].i_ScanType==1) &&(s_BoardInfos [dev->minor].i_InterruptFlag==1)) + { + //i_Count=i_Count-6; + //Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + //s_BoardInfos [dev->minor].i_Count=s_BoardInfos [dev->minor].i_Count-6; + s_BoardInfos [dev->minor].i_Count=s_BoardInfos [dev->minor].i_Count-9; + //End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + } + //if(i_ScanType==0) + if(s_BoardInfos [dev->minor].i_ScanType==0) + { + /* + data[0]= ui_InterruptChannelValue[0]; + data[1]= ui_InterruptChannelValue[1]; + data[2]= ui_InterruptChannelValue[2]; + data[3]= ui_InterruptChannelValue[3]; + data[4]= ui_InterruptChannelValue[4]; + data[5]= ui_InterruptChannelValue[5]; + */ +#ifdef PRINT_INFO + printk("\n data[0]= s_BoardInfos [dev->minor].ui_InterruptChannelValue[0];"); +#endif + data[0]= s_BoardInfos [dev->minor].ui_InterruptChannelValue[0]; + data[1]= s_BoardInfos [dev->minor].ui_InterruptChannelValue[1]; + data[2]= s_BoardInfos [dev->minor].ui_InterruptChannelValue[2]; + data[3]= s_BoardInfos [dev->minor].ui_InterruptChannelValue[3]; + data[4]= s_BoardInfos [dev->minor].ui_InterruptChannelValue[4]; + data[5]= s_BoardInfos [dev->minor].ui_InterruptChannelValue[5]; + + //Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + //printk("\n 0 - i_APCI3200_GetChannelCalibrationValue data [6] = %lu, data [7] = %lu, data [8] = %lu", data [6], data [7], data [8]); + i_APCI3200_GetChannelCalibrationValue (dev, s_BoardInfos [dev->minor].ui_Channel_num, &data [6], &data [7], &data [8]); + //End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + } + break; + case 1 : + + for(i=0;in;i++) + { + //data[i]=ui_InterruptChannelValue[i]; + data[i]=s_BoardInfos [dev->minor].ui_InterruptChannelValue[i]; + } + + //i_Count=0; + //i_Sum=0; + //if(i_ScanType==1) + s_BoardInfos [dev->minor].i_Count=0; + s_BoardInfos [dev->minor].i_Sum=0; + if(s_BoardInfos [dev->minor].i_ScanType==1) + { + //i_Initialised=0; + //i_InterruptFlag=0; + s_BoardInfos [dev->minor].i_Initialised=0; + s_BoardInfos [dev->minor].i_InterruptFlag=0; + //END JK 06.07.04: Management of sevrals boards + } + break; + default:printk("\nThe parameters passed are in error\n"); + i_APCI3200_Reset(dev); + return -EINVAL; + }//switch(insn->unused[0]) + + + + return insn->n; } /* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI3200_Read1AnalogInputChannel | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Read value of the selected channel | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| UINT ui_NoOfChannel : Channel No to read | -| UINT *data : Data Pointer to read status | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -| data[0] : Digital Value read | -| -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ + +----------------------------------------------------------------------------+ + | Function Name : int i_APCI3200_Read1AnalogInputChannel | + | (comedi_device *dev,comedi_subdevice *s, | + | comedi_insn *insn,lsampl_t *data) | + +----------------------------------------------------------------------------+ + | Task : Read value of the selected channel | + +----------------------------------------------------------------------------+ + | Input Parameters : comedi_device *dev : Driver handle | + | UINT ui_NoOfChannel : Channel No to read | + | UINT *data : Data Pointer to read status | + +----------------------------------------------------------------------------+ + | Output Parameters : -- | + | data[0] : Digital Value read | + | + +----------------------------------------------------------------------------+ + | Return Value : TRUE : No error occur | + | : FALSE : Error occur. Return the error | + | | + +----------------------------------------------------------------------------+ */ INT i_APCI3200_Read1AnalogInputChannel(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data){ -UINT ui_EOC=0; -UINT ui_ChannelNo=0; -UINT ui_CommandRegister=0; - - ui_ChannelNo=i_ChannelNo; - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - /*********************************/ - /* Write the channel to configure*/ - /*********************************/ - outl(0 | ui_Channel_num , devpriv->iobase+i_Offset + 0x4); + UINT ui_EOC=0; + UINT ui_ChannelNo=0; + UINT ui_CommandRegister=0; + + //BEGIN JK 06.07.04: Management of sevrals boards + //ui_ChannelNo=i_ChannelNo; + ui_ChannelNo=s_BoardInfos [dev->minor].i_ChannelNo; + + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + /*********************************/ + /* Write the channel to configure*/ + /*********************************/ + //Begin JK 20.10.2004: Bad channel value is used when using differential mode + //outl(0 | ui_Channel_num , devpriv->iobase+i_Offset + 0x4); + //outl(0 | s_BoardInfos [dev->minor].ui_Channel_num , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 0x4); + outl(0 | s_BoardInfos [dev->minor].i_ChannelNo , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 0x4); + //End JK 20.10.2004: Bad channel value is used when using differential mode -/*******************************/ -/* Set the convert timing unit */ -/*******************************/ -while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); -outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); -/**************************/ -/* Set the convert timing */ -/**************************/ -while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); -outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); + /*******************************/ + /* Set the convert timing unit */ + /*******************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + + //outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); + outl(s_BoardInfos [dev->minor].i_ADDIDATAConversionTimeUnit , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 36); + + /**************************/ + /* Set the convert timing */ + /**************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + + //outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); + outl(s_BoardInfos [dev->minor].i_ADDIDATAConversionTime , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 32); -/**************************************************************************/ -/* Set the start end stop index to the selected channel and set the start */ -/**************************************************************************/ + /**************************************************************************/ + /* Set the start end stop index to the selected channel and set the start */ + /**************************************************************************/ - -ui_CommandRegister = ui_ChannelNo | (ui_ChannelNo << 8) | 0x80000; + ui_CommandRegister = ui_ChannelNo | (ui_ChannelNo << 8) | 0x80000; - /*********************************/ - /*Test if the interrupt is enable*/ - /*********************************/ + /*********************************/ + /*Test if the interrupt is enable*/ + /*********************************/ - if (i_InterruptFlag == ADDIDATA_ENABLE) - { - /************************/ - /* Enable the interrupt */ - /************************/ - ui_CommandRegister = ui_CommandRegister | 0x00100000; - }//if (i_InterruptFlag == ADDIDATA_ENABLE) + //if (i_InterruptFlag == ADDIDATA_ENABLE) + if (s_BoardInfos [dev->minor].i_InterruptFlag == ADDIDATA_ENABLE) + { + /************************/ + /* Enable the interrupt */ + /************************/ + ui_CommandRegister = ui_CommandRegister | 0x00100000; + }//if (i_InterruptFlag == ADDIDATA_ENABLE) - /******************************/ - /* Write the command register */ - /******************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl(ui_CommandRegister, devpriv->iobase+i_Offset + 8); - /*****************************/ - /*Test if interrupt is enable*/ - /*****************************/ -if (i_InterruptFlag == ADDIDATA_DISABLE) - { - do - { - /*************************/ - /*Read the EOC Status bit*/ - /*************************/ + /******************************/ + /* Write the command register */ + /******************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + + //outl(ui_CommandRegister, devpriv->iobase+i_Offset + 8); + outl(ui_CommandRegister, devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 8); + + /*****************************/ + /*Test if interrupt is enable*/ + /*****************************/ + //if (i_InterruptFlag == ADDIDATA_DISABLE) + if (s_BoardInfos [dev->minor].i_InterruptFlag == ADDIDATA_DISABLE) + { + do + { + /*************************/ + /*Read the EOC Status bit*/ + /*************************/ - ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1; + //ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1; + ui_EOC = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 20) & 1; - } while (ui_EOC != 1); + } while (ui_EOC != 1); - /***************************************/ - /* Read the digital value of the input */ - /***************************************/ + /***************************************/ + /* Read the digital value of the input */ + /***************************************/ - data[0] = inl (devpriv->iobase+i_Offset + 28); - + //data[0] = inl (devpriv->iobase+i_Offset + 28); + data[0] = inl (devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 28); + //END JK 06.07.04: Management of sevrals boards }// if (i_InterruptFlag == ADDIDATA_DISABLE) -return 0; + return 0; } /* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI3200_ReadCalibrationOffsetValue | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Read calibration offset value of the selected channel| -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| UINT *data : Data Pointer to read status | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -| data[0] : Calibration offset Value | -| -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ + +----------------------------------------------------------------------------+ + | Function Name : int i_APCI3200_ReadCalibrationOffsetValue | + | (comedi_device *dev,comedi_subdevice *s, | + | comedi_insn *insn,lsampl_t *data) | + +----------------------------------------------------------------------------+ + | Task : Read calibration offset value of the selected channel| + +----------------------------------------------------------------------------+ + | Input Parameters : comedi_device *dev : Driver handle | + | UINT *data : Data Pointer to read status | + +----------------------------------------------------------------------------+ + | Output Parameters : -- | + | data[0] : Calibration offset Value | + | + +----------------------------------------------------------------------------+ + | Return Value : TRUE : No error occur | + | : FALSE : Error occur. Return the error | + | | + +----------------------------------------------------------------------------+ */ int i_APCI3200_ReadCalibrationOffsetValue(comedi_device *dev,UINT *data) { - UINT ui_Temp=0 , ui_EOC=0; - UINT ui_CommandRegister=0; - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - /*********************************/ - /* Write the channel to configure*/ - /*********************************/ - outl(0 | ui_Channel_num , devpriv->iobase+i_Offset + 0x4); + UINT ui_Temp=0 , ui_EOC=0; + UINT ui_CommandRegister=0; + + //BEGIN JK 06.07.04: Management of sevrals boards + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + /*********************************/ + /* Write the channel to configure*/ + /*********************************/ + //Begin JK 20.10.2004: This seems not necessary ! + //outl(0 | ui_Channel_num , devpriv->iobase+i_Offset + 0x4); + //outl(0 | s_BoardInfos [dev->minor].ui_Channel_num , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 0x4); + //End JK 20.10.2004: This seems not necessary ! - /*******************************/ - /* Set the convert timing unit */ - /*******************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); - /**************************/ - /* Set the convert timing */ - /**************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); - /*****************************/ - /*Read the calibration offset*/ - /*****************************/ - ui_Temp = inl(devpriv->iobase+i_Offset + 12); - - /*********************************/ - /*Configure the Offset Conversion*/ - /*********************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl((ui_Temp | 0x00020000), devpriv->iobase+i_Offset + 12); - /*******************************/ - /*Initialise ui_CommandRegister*/ - /*******************************/ + /*******************************/ + /* Set the convert timing unit */ + /*******************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); + outl(s_BoardInfos [dev->minor].i_ADDIDATAConversionTimeUnit , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 36); + /**************************/ + /* Set the convert timing */ + /**************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); + outl(s_BoardInfos [dev->minor].i_ADDIDATAConversionTime , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 32); + /*****************************/ + /*Read the calibration offset*/ + /*****************************/ + //ui_Temp = inl(devpriv->iobase+i_Offset + 12); + ui_Temp = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 12); + + /*********************************/ + /*Configure the Offset Conversion*/ + /*********************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl((ui_Temp | 0x00020000), devpriv->iobase+i_Offset + 12); + outl((ui_Temp | 0x00020000), devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 12); + /*******************************/ + /*Initialise ui_CommandRegister*/ + /*******************************/ - ui_CommandRegister = 0; + ui_CommandRegister = 0; - /*********************************/ - /*Test if the interrupt is enable*/ - /*********************************/ + /*********************************/ + /*Test if the interrupt is enable*/ + /*********************************/ - if (i_InterruptFlag == ADDIDATA_ENABLE) - { + //if (i_InterruptFlag == ADDIDATA_ENABLE) + if (s_BoardInfos [dev->minor].i_InterruptFlag == ADDIDATA_ENABLE) + { - /**********************/ - /*Enable the interrupt*/ - /**********************/ + /**********************/ + /*Enable the interrupt*/ + /**********************/ - ui_CommandRegister = ui_CommandRegister | 0x00100000; + ui_CommandRegister = ui_CommandRegister | 0x00100000; - }//if (i_InterruptFlag == ADDIDATA_ENABLE) + }//if (i_InterruptFlag == ADDIDATA_ENABLE) - /**********************/ - /*Start the conversion*/ - /**********************/ - ui_CommandRegister = ui_CommandRegister | 0x00080000; - - - /***************************/ - /*Write the command regiter*/ - /***************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl(ui_CommandRegister, devpriv->iobase+i_Offset + 8); - - /*****************************/ - /*Test if interrupt is enable*/ - /*****************************/ + /**********************/ + /*Start the conversion*/ + /**********************/ + ui_CommandRegister = ui_CommandRegister | 0x00080000; + + + /***************************/ + /*Write the command regiter*/ + /***************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl(ui_CommandRegister, devpriv->iobase+i_Offset + 8); + outl(ui_CommandRegister, devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 8); + + /*****************************/ + /*Test if interrupt is enable*/ + /*****************************/ - if (i_InterruptFlag == ADDIDATA_DISABLE) - { + //if (i_InterruptFlag == ADDIDATA_DISABLE) + if (s_BoardInfos [dev->minor].i_InterruptFlag == ADDIDATA_DISABLE) + { - do - { - /*******************/ - /*Read the EOC flag*/ - /*******************/ + do + { + /*******************/ + /*Read the EOC flag*/ + /*******************/ - ui_EOC = inl (devpriv->iobase+i_Offset + 20) & 1; + //ui_EOC = inl (devpriv->iobase+i_Offset + 20) & 1; + ui_EOC = inl (devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 20) & 1; - } while (ui_EOC != 1); + } while (ui_EOC != 1); - /**************************************************/ - /*Read the digital value of the calibration Offset*/ - /**************************************************/ + /**************************************************/ + /*Read the digital value of the calibration Offset*/ + /**************************************************/ - data[0] = inl(devpriv->iobase+i_Offset+ 28); - }//if (i_InterruptFlag == ADDIDATA_DISABLE) -return 0; + //data[0] = inl(devpriv->iobase+i_Offset+ 28); + data[0] = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+ 28); + }//if (i_InterruptFlag == ADDIDATA_DISABLE) + return 0; } /* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI3200_ReadCalibrationGainValue | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Read calibration gain value of the selected channel | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| UINT *data : Data Pointer to read status | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -| data[0] : Calibration gain Value Of Input | -| -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ + +----------------------------------------------------------------------------+ + | Function Name : int i_APCI3200_ReadCalibrationGainValue | + | (comedi_device *dev,comedi_subdevice *s, | + | comedi_insn *insn,lsampl_t *data) | + +----------------------------------------------------------------------------+ + | Task : Read calibration gain value of the selected channel | + +----------------------------------------------------------------------------+ + | Input Parameters : comedi_device *dev : Driver handle | + | UINT *data : Data Pointer to read status | + +----------------------------------------------------------------------------+ + | Output Parameters : -- | + | data[0] : Calibration gain Value Of Input | + | + +----------------------------------------------------------------------------+ + | Return Value : TRUE : No error occur | + | : FALSE : Error occur. Return the error | + | | + +----------------------------------------------------------------------------+ */ int i_APCI3200_ReadCalibrationGainValue(comedi_device *dev,UINT *data) { UINT ui_EOC=0; INT ui_CommandRegister=0; - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - /*********************************/ - /* Write the channel to configure*/ - /*********************************/ - outl(0 | ui_Channel_num , devpriv->iobase+i_Offset + 0x4); + + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + /*********************************/ + /* Write the channel to configure*/ + /*********************************/ + //Begin JK 20.10.2004: This seems not necessary ! + //outl(0 | ui_Channel_num , devpriv->iobase+i_Offset + 0x4); + //outl(0 | s_BoardInfos [dev->minor].ui_Channel_num , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 0x4); + //End JK 20.10.2004: This seems not necessary ! - /***************************/ - /*Read the calibration gain*/ - /***************************/ - /*******************************/ - /* Set the convert timing unit */ - /*******************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); - /**************************/ - /* Set the convert timing */ - /**************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); - /*******************************/ - /*Configure the Gain Conversion*/ - /*******************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl(0x00040000 , devpriv->iobase+i_Offset + 12); + /***************************/ + /*Read the calibration gain*/ + /***************************/ + /*******************************/ + /* Set the convert timing unit */ + /*******************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); + outl(s_BoardInfos [dev->minor].i_ADDIDATAConversionTimeUnit , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 36); + /**************************/ + /* Set the convert timing */ + /**************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); + outl(s_BoardInfos [dev->minor].i_ADDIDATAConversionTime , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 32); + /*******************************/ + /*Configure the Gain Conversion*/ + /*******************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl(0x00040000 , devpriv->iobase+i_Offset + 12); + outl(0x00040000 , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 12); - /*******************************/ - /*Initialise ui_CommandRegister*/ - /*******************************/ + /*******************************/ + /*Initialise ui_CommandRegister*/ + /*******************************/ - ui_CommandRegister = 0; + ui_CommandRegister = 0; - /*********************************/ - /*Test if the interrupt is enable*/ - /*********************************/ + /*********************************/ + /*Test if the interrupt is enable*/ + /*********************************/ - if (i_InterruptFlag == ADDIDATA_ENABLE) - { + //if (i_InterruptFlag == ADDIDATA_ENABLE) + if (s_BoardInfos [dev->minor].i_InterruptFlag == ADDIDATA_ENABLE) + { - /**********************/ - /*Enable the interrupt*/ - /**********************/ + /**********************/ + /*Enable the interrupt*/ + /**********************/ - ui_CommandRegister = ui_CommandRegister | 0x00100000; + ui_CommandRegister = ui_CommandRegister | 0x00100000; - }//if (i_InterruptFlag == ADDIDATA_ENABLE) + }//if (i_InterruptFlag == ADDIDATA_ENABLE) - /**********************/ - /*Start the conversion*/ - /**********************/ + /**********************/ + /*Start the conversion*/ + /**********************/ - ui_CommandRegister = ui_CommandRegister | 0x00080000; - /***************************/ - /*Write the command regiter*/ - /***************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl(ui_CommandRegister , devpriv->iobase+i_Offset + 8); - - /*****************************/ - /*Test if interrupt is enable*/ - /*****************************/ + ui_CommandRegister = ui_CommandRegister | 0x00080000; + /***************************/ + /*Write the command regiter*/ + /***************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl(ui_CommandRegister , devpriv->iobase+i_Offset + 8); + outl(ui_CommandRegister , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 8); + + /*****************************/ + /*Test if interrupt is enable*/ + /*****************************/ - if (i_InterruptFlag == ADDIDATA_DISABLE) - { + //if (i_InterruptFlag == ADDIDATA_DISABLE) + if (s_BoardInfos [dev->minor].i_InterruptFlag == ADDIDATA_DISABLE) + { - do - { + do + { - /*******************/ - /*Read the EOC flag*/ - /*******************/ + /*******************/ + /*Read the EOC flag*/ + /*******************/ - ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1; + //ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1; + ui_EOC = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 20) & 1; - } while (ui_EOC != 1); + } while (ui_EOC != 1); - /************************************************/ - /*Read the digital value of the calibration Gain*/ - /************************************************/ + /************************************************/ + /*Read the digital value of the calibration Gain*/ + /************************************************/ - data[0] = inl(devpriv->iobase+i_Offset + 28); + //data[0] = inl(devpriv->iobase+i_Offset + 28); + data[0] = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 28); - }//if (i_InterruptFlag == ADDIDATA_DISABLE) -return 0; + }//if (i_InterruptFlag == ADDIDATA_DISABLE) + return 0; } /* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI3200_ReadCJCValue | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Read CJC value of the selected channel | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| UINT *data : Data Pointer to read status | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -| data[0] : CJC Value | -| -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ + +----------------------------------------------------------------------------+ + | Function Name : int i_APCI3200_ReadCJCValue | + | (comedi_device *dev,comedi_subdevice *s, | + | comedi_insn *insn,lsampl_t *data) | + +----------------------------------------------------------------------------+ + | Task : Read CJC value of the selected channel | + +----------------------------------------------------------------------------+ + | Input Parameters : comedi_device *dev : Driver handle | + | UINT *data : Data Pointer to read status | + +----------------------------------------------------------------------------+ + | Output Parameters : -- | + | data[0] : CJC Value | + | + +----------------------------------------------------------------------------+ + | Return Value : TRUE : No error occur | + | : FALSE : Error occur. Return the error | + | | + +----------------------------------------------------------------------------+ */ int i_APCI3200_ReadCJCValue(comedi_device *dev,lsampl_t *data) { - UINT ui_EOC=0; - INT ui_CommandRegister=0; + UINT ui_EOC=0; + INT ui_CommandRegister=0; - /******************************/ - /*Set the converting time unit*/ - /******************************/ + /******************************/ + /*Set the converting time unit*/ + /******************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); - /**************************/ - /* Set the convert timing */ - /**************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); - - /******************************/ - /*Configure the CJC Conversion*/ - /******************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl( 0x00000400 , devpriv->iobase+i_Offset + 4); - /*******************************/ - /*Initialise dw_CommandRegister*/ - /*******************************/ - ui_CommandRegister = 0; - /*********************************/ - /*Test if the interrupt is enable*/ - /*********************************/ - if (i_InterruptFlag == ADDIDATA_ENABLE) - { - /**********************/ - /*Enable the interrupt*/ - /**********************/ - ui_CommandRegister =ui_CommandRegister | 0x00100000; - } + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + + //outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); + outl(s_BoardInfos [dev->minor].i_ADDIDATAConversionTimeUnit , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 36); + /**************************/ + /* Set the convert timing */ + /**************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + + //outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); + outl(s_BoardInfos [dev->minor].i_ADDIDATAConversionTime , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 32); + + /******************************/ + /*Configure the CJC Conversion*/ + /******************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + + //outl( 0x00000400 , devpriv->iobase+i_Offset + 4); + outl( 0x00000400 , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 4); + /*******************************/ + /*Initialise dw_CommandRegister*/ + /*******************************/ + ui_CommandRegister = 0; + /*********************************/ + /*Test if the interrupt is enable*/ + /*********************************/ + //if (i_InterruptFlag == ADDIDATA_ENABLE) + if (s_BoardInfos [dev->minor].i_InterruptFlag == ADDIDATA_ENABLE) + { + /**********************/ + /*Enable the interrupt*/ + /**********************/ + ui_CommandRegister =ui_CommandRegister | 0x00100000; + } - /**********************/ - /*Start the conversion*/ - /**********************/ + /**********************/ + /*Start the conversion*/ + /**********************/ - ui_CommandRegister = ui_CommandRegister | 0x00080000; - - /***************************/ - /*Write the command regiter*/ - /***************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl(ui_CommandRegister , devpriv->iobase+i_Offset + 8); + ui_CommandRegister = ui_CommandRegister | 0x00080000; + + /***************************/ + /*Write the command regiter*/ + /***************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl(ui_CommandRegister , devpriv->iobase+i_Offset + 8); + outl(ui_CommandRegister , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 8); - /*****************************/ - /*Test if interrupt is enable*/ - /*****************************/ + /*****************************/ + /*Test if interrupt is enable*/ + /*****************************/ - if (i_InterruptFlag == ADDIDATA_DISABLE) - { - do - { + //if (i_InterruptFlag == ADDIDATA_DISABLE) + if (s_BoardInfos [dev->minor].i_InterruptFlag == ADDIDATA_DISABLE) + { + do + { - /*******************/ - /*Read the EOC flag*/ - /*******************/ + /*******************/ + /*Read the EOC flag*/ + /*******************/ - ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1; + //ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1; + ui_EOC = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 20) & 1; - } while (ui_EOC != 1); + } while (ui_EOC != 1); - /***********************************/ - /*Read the digital value of the CJC*/ - /***********************************/ + /***********************************/ + /*Read the digital value of the CJC*/ + /***********************************/ - data[0] = inl(devpriv->iobase+i_Offset + 28); + //data[0] = inl(devpriv->iobase+i_Offset + 28); + data[0] = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 28); - }//if (i_InterruptFlag == ADDIDATA_DISABLE) -return 0; + }//if (i_InterruptFlag == ADDIDATA_DISABLE) + return 0; } /* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI3200_ReadCJCCalOffset | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Read CJC calibration offset value of the selected channel -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| UINT *data : Data Pointer to read status | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -| data[0] : CJC calibration offset Value -| -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ + +----------------------------------------------------------------------------+ + | Function Name : int i_APCI3200_ReadCJCCalOffset | + | (comedi_device *dev,comedi_subdevice *s, | + | comedi_insn *insn,lsampl_t *data) | + +----------------------------------------------------------------------------+ + | Task : Read CJC calibration offset value of the selected channel + +----------------------------------------------------------------------------+ + | Input Parameters : comedi_device *dev : Driver handle | + | UINT *data : Data Pointer to read status | + +----------------------------------------------------------------------------+ + | Output Parameters : -- | + | data[0] : CJC calibration offset Value + | + +----------------------------------------------------------------------------+ + | Return Value : TRUE : No error occur | + | : FALSE : Error occur. Return the error | + | | + +----------------------------------------------------------------------------+ */ int i_APCI3200_ReadCJCCalOffset(comedi_device *dev,lsampl_t *data) { - UINT ui_EOC=0; - INT ui_CommandRegister=0; - /*******************************************/ - /*Read calibration offset value for the CJC*/ - /*******************************************/ - /*******************************/ - /* Set the convert timing unit */ - /*******************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); - /**************************/ - /* Set the convert timing */ - /**************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); - /******************************/ - /*Configure the CJC Conversion*/ - /******************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl(0x00000400 , devpriv->iobase+i_Offset + 4); - /*********************************/ - /*Configure the Offset Conversion*/ - /*********************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl(0x00020000, devpriv->iobase+i_Offset + 12); - - /*******************************/ - /*Initialise ui_CommandRegister*/ - /*******************************/ - ui_CommandRegister = 0; - /*********************************/ - /*Test if the interrupt is enable*/ - /*********************************/ + UINT ui_EOC=0; + INT ui_CommandRegister=0; + /*******************************************/ + /*Read calibration offset value for the CJC*/ + /*******************************************/ + /*******************************/ + /* Set the convert timing unit */ + /*******************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); + outl(s_BoardInfos [dev->minor].i_ADDIDATAConversionTimeUnit , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 36); + /**************************/ + /* Set the convert timing */ + /**************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); + outl(s_BoardInfos [dev->minor].i_ADDIDATAConversionTime , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 32); + /******************************/ + /*Configure the CJC Conversion*/ + /******************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl(0x00000400 , devpriv->iobase+i_Offset + 4); + outl(0x00000400 , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 4); + /*********************************/ + /*Configure the Offset Conversion*/ + /*********************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl(0x00020000, devpriv->iobase+i_Offset + 12); + outl(0x00020000, devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 12); + /*******************************/ + /*Initialise ui_CommandRegister*/ + /*******************************/ + ui_CommandRegister = 0; + /*********************************/ + /*Test if the interrupt is enable*/ + /*********************************/ - if (i_InterruptFlag == ADDIDATA_ENABLE) - { - /**********************/ - /*Enable the interrupt*/ - /**********************/ - ui_CommandRegister =ui_CommandRegister | 0x00100000; + //if (i_InterruptFlag == ADDIDATA_ENABLE) + if (s_BoardInfos [dev->minor].i_InterruptFlag == ADDIDATA_ENABLE) + { + /**********************/ + /*Enable the interrupt*/ + /**********************/ + ui_CommandRegister =ui_CommandRegister | 0x00100000; - } + } - /**********************/ - /*Start the conversion*/ - /**********************/ - ui_CommandRegister = ui_CommandRegister | 0x00080000; - /***************************/ - /*Write the command regiter*/ - /***************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl(ui_CommandRegister,devpriv->iobase+i_Offset + 8); - if (i_InterruptFlag == ADDIDATA_DISABLE) - { - do - { - /*******************/ - /*Read the EOC flag*/ - /*******************/ - ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1; - } while (ui_EOC != 1); + /**********************/ + /*Start the conversion*/ + /**********************/ + ui_CommandRegister = ui_CommandRegister | 0x00080000; + /***************************/ + /*Write the command regiter*/ + /***************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl(ui_CommandRegister,devpriv->iobase+i_Offset + 8); + outl(ui_CommandRegister,devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 8); + //if (i_InterruptFlag == ADDIDATA_DISABLE) + if (s_BoardInfos [dev->minor].i_InterruptFlag == ADDIDATA_DISABLE) + { + do + { + /*******************/ + /*Read the EOC flag*/ + /*******************/ + //ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1; + ui_EOC = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 20) & 1; + } while (ui_EOC != 1); - /**************************************************/ - /*Read the digital value of the calibration Offset*/ - /**************************************************/ - data[0] = inl(devpriv->iobase+i_Offset + 28); - }//if (i_InterruptFlag == ADDIDATA_DISABLE) -return 0; + /**************************************************/ + /*Read the digital value of the calibration Offset*/ + /**************************************************/ + //data[0] = inl(devpriv->iobase+i_Offset + 28); + data[0] = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 28); + }//if (i_InterruptFlag == ADDIDATA_DISABLE) + return 0; } /* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI3200_ReadCJCGainValue | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Read CJC calibration gain value -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To read | -| UINT *data : Data Pointer to read status | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -| data[0] : CJC calibration gain value -| -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ + +----------------------------------------------------------------------------+ + | Function Name : int i_APCI3200_ReadCJCGainValue | + | (comedi_device *dev,comedi_subdevice *s, | + | comedi_insn *insn,lsampl_t *data) | + +----------------------------------------------------------------------------+ + | Task : Read CJC calibration gain value + +----------------------------------------------------------------------------+ + | Input Parameters : comedi_device *dev : Driver handle | + | UINT ui_NoOfChannels : No Of Channels To read | + | UINT *data : Data Pointer to read status | + +----------------------------------------------------------------------------+ + | Output Parameters : -- | + | data[0] : CJC calibration gain value + | + +----------------------------------------------------------------------------+ + | Return Value : TRUE : No error occur | + | : FALSE : Error occur. Return the error | + | | + +----------------------------------------------------------------------------+ */ int i_APCI3200_ReadCJCCalGain(comedi_device *dev,lsampl_t *data) { - UINT ui_EOC=0; - INT ui_CommandRegister=0; - /*******************************/ - /* Set the convert timing unit */ - /*******************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); - /**************************/ - /* Set the convert timing */ - /**************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); - /******************************/ - /*Configure the CJC Conversion*/ - /******************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl(0x00000400,devpriv->iobase+i_Offset + 4); -/*******************************/ -/*Configure the Gain Conversion*/ -/*******************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl(0x00040000,devpriv->iobase+i_Offset + 12); - - /*******************************/ - /*Initialise dw_CommandRegister*/ - /*******************************/ - ui_CommandRegister = 0; -/*********************************/ -/*Test if the interrupt is enable*/ -/*********************************/ - if (i_InterruptFlag == ADDIDATA_ENABLE) -{ -/**********************/ -/*Enable the interrupt*/ -/**********************/ -ui_CommandRegister = ui_CommandRegister | 0x00100000; -} -/**********************/ -/*Start the conversion*/ -/**********************/ -ui_CommandRegister = ui_CommandRegister | 0x00080000; -/***************************/ -/*Write the command regiter*/ -/***************************/ -while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); -outl(ui_CommandRegister ,devpriv->iobase+i_Offset + 8); -if (i_InterruptFlag == ADDIDATA_DISABLE) + UINT ui_EOC=0; + INT ui_CommandRegister=0; + /*******************************/ + /* Set the convert timing unit */ + /*******************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl(i_ADDIDATAConversionTimeUnit , devpriv->iobase+i_Offset + 36); + outl(s_BoardInfos [dev->minor].i_ADDIDATAConversionTimeUnit , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 36); + /**************************/ + /* Set the convert timing */ + /**************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); + outl(s_BoardInfos [dev->minor].i_ADDIDATAConversionTime , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 32); + /******************************/ + /*Configure the CJC Conversion*/ + /******************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl(0x00000400,devpriv->iobase+i_Offset + 4); + outl(0x00000400,devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 4); + /*******************************/ + /*Configure the Gain Conversion*/ + /*******************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl(0x00040000,devpriv->iobase+i_Offset + 12); + outl(0x00040000,devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 12); + + /*******************************/ + /*Initialise dw_CommandRegister*/ + /*******************************/ + ui_CommandRegister = 0; + /*********************************/ + /*Test if the interrupt is enable*/ + /*********************************/ + //if (i_InterruptFlag == ADDIDATA_ENABLE) + if (s_BoardInfos [dev->minor].i_InterruptFlag == ADDIDATA_ENABLE) + { + /**********************/ + /*Enable the interrupt*/ + /**********************/ + ui_CommandRegister = ui_CommandRegister | 0x00100000; + } + /**********************/ + /*Start the conversion*/ + /**********************/ + ui_CommandRegister = ui_CommandRegister | 0x00080000; + /***************************/ + /*Write the command regiter*/ + /***************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl(ui_CommandRegister ,devpriv->iobase+i_Offset + 8); + outl(ui_CommandRegister ,devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 8); + //if (i_InterruptFlag == ADDIDATA_DISABLE) + if (s_BoardInfos [dev->minor].i_InterruptFlag == ADDIDATA_DISABLE) { do - { - /*******************/ - /*Read the EOC flag*/ - /*******************/ - ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1; - } while (ui_EOC != 1); - /************************************************/ - /*Read the digital value of the calibration Gain*/ - /************************************************/ - data[0] = inl (devpriv->iobase+i_Offset + 28); + { + /*******************/ + /*Read the EOC flag*/ + /*******************/ + //ui_EOC = inl(devpriv->iobase+i_Offset + 20) & 1; + ui_EOC = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 20) & 1; + } while (ui_EOC != 1); + /************************************************/ + /*Read the digital value of the calibration Gain*/ + /************************************************/ + //data[0] = inl (devpriv->iobase+i_Offset + 28); + data[0] = inl (devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 28); }//if (i_InterruptFlag == ADDIDATA_DISABLE) -return 0; + return 0; } /* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI3200_InsnBits_AnalogInput_Test | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Tests the Selected Anlog Input Channel | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| comedi_subdevice *s : Subdevice Pointer | -| comedi_insn *insn : Insn Structure Pointer | -| lsampl_t *data : Data Pointer contains | -| configuration parameters as below | -| -| -| data[0] : 0 TestAnalogInputShortCircuit -| 1 TestAnalogInputConnection | - -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -| data[0] : Digital value obtained | -| data[1] : calibration offset | -| data[2] : calibration gain | -| | -| | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ + +----------------------------------------------------------------------------+ + | Function Name : int i_APCI3200_InsnBits_AnalogInput_Test | + | (comedi_device *dev,comedi_subdevice *s, | + | comedi_insn *insn,lsampl_t *data) | + +----------------------------------------------------------------------------+ + | Task : Tests the Selected Anlog Input Channel | + +----------------------------------------------------------------------------+ + | Input Parameters : comedi_device *dev : Driver handle | + | comedi_subdevice *s : Subdevice Pointer | + | comedi_insn *insn : Insn Structure Pointer | + | lsampl_t *data : Data Pointer contains | + | configuration parameters as below | + | + | + | data[0] : 0 TestAnalogInputShortCircuit + | 1 TestAnalogInputConnection | + + +----------------------------------------------------------------------------+ + | Output Parameters : -- | + | data[0] : Digital value obtained | + | data[1] : calibration offset | + | data[2] : calibration gain | + | | + | | + +----------------------------------------------------------------------------+ + | Return Value : TRUE : No error occur | + | : FALSE : Error occur. Return the error | + | | + +----------------------------------------------------------------------------+ */ INT i_APCI3200_InsnBits_AnalogInput_Test(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) { -UINT ui_Configuration=0; -INT i_Temp,i_TimeUnit; -if(i_Initialised==0) - { - printk("\nThe channel is not initialised\n"); - i_APCI3200_Reset(dev); - return -EINVAL; - }//if(i_Initialised==0); -if(data[0]!=0 && data[0]!=1) - { - printk("\nError in selection of functionality\n"); - i_APCI3200_Reset(dev); - return -EINVAL; - }//if(data[0]!=0 && data[0]!=1) - -if(data[0]==1) //Perform Short Circuit TEST - { - /**************************/ - /*Set the short-cicuit bit*/ - /**************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl((0x00001000 |i_ChannelNo) , devpriv->iobase+i_Offset + 4); + UINT ui_Configuration=0; + //INT i_Temp,i_TimeUnit; + //if(i_Initialised==0) + + if(s_BoardInfos [dev->minor].i_Initialised==0) + { + i_APCI3200_Reset(dev); + return -EINVAL; + }//if(i_Initialised==0); + if(data[0]!=0 && data[0]!=1) + { + printk("\nError in selection of functionality\n"); + i_APCI3200_Reset(dev); + return -EINVAL; + }//if(data[0]!=0 && data[0]!=1) + + if(data[0]==1) //Perform Short Circuit TEST + { + /**************************/ + /*Set the short-cicuit bit*/ + /**************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl((0x00001000 |i_ChannelNo) , devpriv->iobase+i_Offset + 4); + outl((0x00001000 |s_BoardInfos [dev->minor].i_ChannelNo) , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 4); /*************************/ /*Set the time unit to ns*/ /*************************/ - /* i_TimeUnit= i_ADDIDATAConversionTimeUnit; - i_ADDIDATAConversionTimeUnit= 1;*/ - i_Temp= i_InterruptFlag ; - i_InterruptFlag = ADDIDATA_DISABLE; + /* i_TimeUnit= i_ADDIDATAConversionTimeUnit; + i_ADDIDATAConversionTimeUnit= 1;*/ + //i_Temp= i_InterruptFlag ; + i_Temp= s_BoardInfos [dev->minor].i_InterruptFlag ; + //i_InterruptFlag = ADDIDATA_DISABLE; + s_BoardInfos [dev->minor].i_InterruptFlag = ADDIDATA_DISABLE; i_APCI3200_Read1AnalogInputChannel(dev,s,insn,data); - if(i_AutoCalibration == FALSE) - { - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl((0x00001000 |i_ChannelNo) , devpriv->iobase+i_Offset + 4); + //if(i_AutoCalibration == FALSE) + if(s_BoardInfos [dev->minor].i_AutoCalibration == FALSE) + { + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + + //outl((0x00001000 |i_ChannelNo) , devpriv->iobase+i_Offset + 4); + outl((0x00001000 |s_BoardInfos [dev->minor].i_ChannelNo) , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 4); data++; i_APCI3200_ReadCalibrationOffsetValue(dev,data); data++; i_APCI3200_ReadCalibrationGainValue(dev,data); - } - } -else - { - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl((0x00000800|i_ChannelNo) , devpriv->iobase+i_Offset + 4); - ui_Configuration = inl(devpriv->iobase+i_Offset + 0); + } + } + else + { + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl((0x00000800|i_ChannelNo) , devpriv->iobase+i_Offset + 4); + outl((0x00000800|s_BoardInfos [dev->minor].i_ChannelNo) , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 4); + //ui_Configuration = inl(devpriv->iobase+i_Offset + 0); + ui_Configuration = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 0); /*************************/ /*Set the time unit to ns*/ /*************************/ - /* i_TimeUnit= i_ADDIDATAConversionTimeUnit; - i_ADDIDATAConversionTimeUnit= 1;*/ - i_Temp= i_InterruptFlag ; - i_InterruptFlag = ADDIDATA_DISABLE; + /* i_TimeUnit= i_ADDIDATAConversionTimeUnit; + i_ADDIDATAConversionTimeUnit= 1;*/ + //i_Temp= i_InterruptFlag ; + i_Temp= s_BoardInfos [dev->minor].i_InterruptFlag ; + //i_InterruptFlag = ADDIDATA_DISABLE; + s_BoardInfos [dev->minor].i_InterruptFlag = ADDIDATA_DISABLE; i_APCI3200_Read1AnalogInputChannel(dev,s,insn,data); - if(i_AutoCalibration == FALSE) - { - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl((0x00000800|i_ChannelNo) , devpriv->iobase+i_Offset + 4); + //if(i_AutoCalibration == FALSE) + if(s_BoardInfos [dev->minor].i_AutoCalibration == FALSE) + { + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl((0x00000800|i_ChannelNo) , devpriv->iobase+i_Offset + 4); + outl((0x00000800|s_BoardInfos [dev->minor].i_ChannelNo) , devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 4); data++; i_APCI3200_ReadCalibrationOffsetValue(dev,data); data++; i_APCI3200_ReadCalibrationGainValue(dev,data); - } - } - i_InterruptFlag=i_Temp ; -printk("\ni_InterruptFlag=%d\n",i_InterruptFlag); -return insn->n; + } + } + //i_InterruptFlag=i_Temp ; + s_BoardInfos [dev->minor].i_InterruptFlag=i_Temp ; + //printk("\ni_InterruptFlag=%d\n",i_InterruptFlag); + return insn->n; } /* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI3200_InsnWriteReleaseAnalogInput | -| (comedi_device *dev,comedi_subdevice *s, | -| comedi_insn *insn,lsampl_t *data) | -+----------------------------------------------------------------------------+ -| Task : Resets the channels | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev : Driver handle | -| comedi_subdevice *s : Subdevice Pointer | -| comedi_insn *insn : Insn Structure Pointer | -| lsampl_t *data : Data Pointer -+----------------------------------------------------------------------------+ -| Output Parameters : -- | - -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ + +----------------------------------------------------------------------------+ + | Function Name : int i_APCI3200_InsnWriteReleaseAnalogInput | + | (comedi_device *dev,comedi_subdevice *s, | + | comedi_insn *insn,lsampl_t *data) | + +----------------------------------------------------------------------------+ + | Task : Resets the channels | + +----------------------------------------------------------------------------+ + | Input Parameters : comedi_device *dev : Driver handle | + | comedi_subdevice *s : Subdevice Pointer | + | comedi_insn *insn : Insn Structure Pointer | + | lsampl_t *data : Data Pointer + +----------------------------------------------------------------------------+ + | Output Parameters : -- | + + +----------------------------------------------------------------------------+ + | Return Value : TRUE : No error occur | + | : FALSE : Error occur. Return the error | + | | + +----------------------------------------------------------------------------+ */ INT i_APCI3200_InsnWriteReleaseAnalogInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) { i_APCI3200_Reset(dev); return insn->n; - } +} - - - - - - - + /* -+----------------------------------------------------------------------------+ -| Function name :int i_APCI3200_CommandTestAnalogInput(comedi_device *dev| -| ,comedi_subdevice *s,comedi_cmd *cmd) | -| | -+----------------------------------------------------------------------------+ -| Task : Test validity for a command for cyclic anlog input | -| acquisition | -| | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev | -| comedi_subdevice *s | -| comedi_cmd *cmd | -| | -| -| | -| | -| | -+----------------------------------------------------------------------------+ -| Return Value :0 | -| | -+----------------------------------------------------------------------------+ + +----------------------------------------------------------------------------+ + | Function name :int i_APCI3200_CommandTestAnalogInput(comedi_device *dev| + | ,comedi_subdevice *s,comedi_cmd *cmd) | + | | + +----------------------------------------------------------------------------+ + | Task : Test validity for a command for cyclic anlog input | + | acquisition | + | | + +----------------------------------------------------------------------------+ + | Input Parameters : comedi_device *dev | + | comedi_subdevice *s | + | comedi_cmd *cmd | + | | + | + | | + | | + | | + +----------------------------------------------------------------------------+ + | Return Value :0 | + | | + +----------------------------------------------------------------------------+ */ int i_APCI3200_CommandTestAnalogInput(comedi_device *dev,comedi_subdevice *s,comedi_cmd *cmd) { - int err=0; - int tmp;// divisor1,divisor2; - UINT ui_ConvertTime=0; - UINT ui_ConvertTimeBase=0; - UINT ui_DelayTime=0; - UINT ui_DelayTimeBase=0; - INT i_Triggermode=0; - INT i_TriggerEdge=0; - INT i_NbrOfChannel=0; - INT i_Cpt=0; - double d_ConversionTimeForAllChannels=0.0; - double d_SCANTimeNewUnit=0.0; - // step 1: make sure trigger sources are trivially valid - - tmp=cmd->start_src; - cmd->start_src &= TRIG_NOW|TRIG_EXT; - if(!cmd->start_src || tmp!=cmd->start_src)err++; - tmp=cmd->scan_begin_src; - cmd->scan_begin_src &= TRIG_TIMER|TRIG_FOLLOW; - if(!cmd->scan_begin_src || tmp!=cmd->scan_begin_src)err++; - tmp=cmd->convert_src; - cmd->convert_src &= TRIG_TIMER; - if(!cmd->convert_src || tmp!=cmd->convert_src)err++; - tmp=cmd->scan_end_src; - cmd->scan_end_src &= TRIG_COUNT; - if(!cmd->scan_end_src || tmp!=cmd->scan_end_src)err++; - tmp=cmd->stop_src; - cmd->stop_src &= TRIG_COUNT|TRIG_NONE; - if(!cmd->stop_src || tmp!=cmd->stop_src)err++; - if(i_InterruptFlag==0) - { - err++; -// printk("\nThe interrupt should be enabled\n"); - } - if(err) - { - i_APCI3200_Reset(dev); - return 1; - } + int err=0; + int tmp;// divisor1,divisor2; + UINT ui_ConvertTime=0; + UINT ui_ConvertTimeBase=0; + UINT ui_DelayTime=0; + UINT ui_DelayTimeBase=0; + INT i_Triggermode=0; + INT i_TriggerEdge=0; + INT i_NbrOfChannel=0; + INT i_Cpt=0; + double d_ConversionTimeForAllChannels=0.0; + double d_SCANTimeNewUnit=0.0; + // step 1: make sure trigger sources are trivially valid + + tmp=cmd->start_src; + cmd->start_src &= TRIG_NOW|TRIG_EXT; + if(!cmd->start_src || tmp!=cmd->start_src)err++; + tmp=cmd->scan_begin_src; + cmd->scan_begin_src &= TRIG_TIMER|TRIG_FOLLOW; + if(!cmd->scan_begin_src || tmp!=cmd->scan_begin_src)err++; + tmp=cmd->convert_src; + cmd->convert_src &= TRIG_TIMER; + if(!cmd->convert_src || tmp!=cmd->convert_src)err++; + tmp=cmd->scan_end_src; + cmd->scan_end_src &= TRIG_COUNT; + if(!cmd->scan_end_src || tmp!=cmd->scan_end_src)err++; + tmp=cmd->stop_src; + cmd->stop_src &= TRIG_COUNT|TRIG_NONE; + if(!cmd->stop_src || tmp!=cmd->stop_src)err++; + //if(i_InterruptFlag==0) + if(s_BoardInfos [dev->minor].i_InterruptFlag==0) + { + err++; + // printk("\nThe interrupt should be enabled\n"); + } + if(err) + { + i_APCI3200_Reset(dev); + return 1; + } - if(cmd->start_src!=TRIG_NOW && cmd->start_src!=TRIG_EXT) - { - err++; + if(cmd->start_src!=TRIG_NOW && cmd->start_src!=TRIG_EXT) + { + err++; + } + if(cmd->start_src==TRIG_EXT) + { + i_TriggerEdge=cmd->start_arg & 0xFFFF; + i_Triggermode=cmd->start_arg >> 16; + if(i_TriggerEdge < 1 || i_TriggerEdge >3 ) + { + err++; + printk("\nThe trigger edge selection is in error\n") ; } - if(cmd->start_src==TRIG_EXT) - { - i_TriggerEdge=cmd->start_arg & 0xFFFF; - i_Triggermode=cmd->start_arg >> 16; - if(i_TriggerEdge < 1 || i_TriggerEdge >3 ) - { - err++; - printk("\nThe trigger edge selection is in error\n") ; - } - if(i_Triggermode!=2) - { - err++; - printk("\nThe trigger mode selection is in error\n") ; - } - } - - if(cmd->scan_begin_src!=TRIG_TIMER && - cmd->scan_begin_src!=TRIG_FOLLOW) err++; - - if(cmd->convert_src!=TRIG_TIMER ) err++; + if(i_Triggermode!=2) + { + err++; + printk("\nThe trigger mode selection is in error\n") ; + } + } + + if(cmd->scan_begin_src!=TRIG_TIMER && + cmd->scan_begin_src!=TRIG_FOLLOW) err++; + + if(cmd->convert_src!=TRIG_TIMER ) err++; - if(cmd->scan_end_src!=TRIG_COUNT) - { - cmd->scan_end_src=TRIG_COUNT; - err++; - } + if(cmd->scan_end_src!=TRIG_COUNT) + { + cmd->scan_end_src=TRIG_COUNT; + err++; + } - if(cmd->stop_src!=TRIG_NONE && - cmd->stop_src!=TRIG_COUNT ) err++; - - if(err) - { - i_APCI3200_Reset(dev); - return 2; - } + if(cmd->stop_src!=TRIG_NONE && + cmd->stop_src!=TRIG_COUNT ) err++; + + if(err) + { + i_APCI3200_Reset(dev); + return 2; + } - i_FirstChannel=cmd->chanlist[0]; - i_LastChannel=cmd->chanlist[1]; + //i_FirstChannel=cmd->chanlist[0]; + s_BoardInfos [dev->minor].i_FirstChannel=cmd->chanlist[0]; + //i_LastChannel=cmd->chanlist[1]; + s_BoardInfos [dev->minor].i_LastChannel=cmd->chanlist[1]; - if (cmd->convert_src==TRIG_TIMER) - { - ui_ConvertTime=cmd->convert_arg & 0xFFFF; - ui_ConvertTimeBase=cmd->convert_arg >> 16; - if (ui_ConvertTime!=20 && ui_ConvertTime!=40 && ui_ConvertTime!=80 && ui_ConvertTime!=160 ) + if (cmd->convert_src==TRIG_TIMER) + { + ui_ConvertTime=cmd->convert_arg & 0xFFFF; + ui_ConvertTimeBase=cmd->convert_arg >> 16; + if (ui_ConvertTime!=20 && ui_ConvertTime!=40 && ui_ConvertTime!=80 && ui_ConvertTime!=160 ) { - printk("\nThe selection of conversion time reload value is in error\n"); - err++; - }// if (ui_ConvertTime!=20 && ui_ConvertTime!=40 && ui_ConvertTime!=80 && ui_ConvertTime!=160 ) + printk("\nThe selection of conversion time reload value is in error\n"); + err++; + }// if (ui_ConvertTime!=20 && ui_ConvertTime!=40 && ui_ConvertTime!=80 && ui_ConvertTime!=160 ) if(ui_ConvertTimeBase!=2) { - printk("\nThe selection of conversion time unit is in error\n"); - err++; + printk("\nThe selection of conversion time unit is in error\n"); + err++; }//if(ui_ConvertTimeBase!=2) - } - else - { - ui_ConvertTime=0; - ui_ConvertTimeBase=0; - } - if(cmd->scan_begin_src==TRIG_FOLLOW) - { - ui_DelayTime=0; - ui_DelayTimeBase=0; - }//if(cmd->scan_begin_src==TRIG_FOLLOW) - else - { - ui_DelayTime=cmd->scan_begin_arg & 0xFFFF; - ui_DelayTimeBase=cmd->scan_begin_arg >> 16; - if(ui_DelayTimeBase!=2 && ui_DelayTimeBase!=3) - { - err++; - printk("\nThe Delay time base selection is in error\n"); - } - if(ui_DelayTime < 1 && ui_DelayTime >1023) - { - err++; - printk("\nThe Delay time value is in error\n"); - } - if(err) - { - i_APCI3200_Reset(dev); - return 3; - } - d_SCANTimeNewUnit = (double)ui_DelayTime; - i_NbrOfChannel= i_LastChannel-i_FirstChannel + 4; - /**********************************************************/ - /*calculate the total conversion time for all the channels*/ - /**********************************************************/ - d_ConversionTimeForAllChannels = (double)((double)ui_ConvertTime / (double)i_NbrOfChannel); + } + else + { + ui_ConvertTime=0; + ui_ConvertTimeBase=0; + } + if(cmd->scan_begin_src==TRIG_FOLLOW) + { + ui_DelayTime=0; + ui_DelayTimeBase=0; + }//if(cmd->scan_begin_src==TRIG_FOLLOW) + else + { + ui_DelayTime=cmd->scan_begin_arg & 0xFFFF; + ui_DelayTimeBase=cmd->scan_begin_arg >> 16; + if(ui_DelayTimeBase!=2 && ui_DelayTimeBase!=3) + { + err++; + printk("\nThe Delay time base selection is in error\n"); + } + if(ui_DelayTime < 1 && ui_DelayTime >1023) + { + err++; + printk("\nThe Delay time value is in error\n"); + } + if(err) + { + i_APCI3200_Reset(dev); + return 3; + } + fpu_begin (); + d_SCANTimeNewUnit = (double)ui_DelayTime; + //i_NbrOfChannel= i_LastChannel-i_FirstChannel + 4; + i_NbrOfChannel= s_BoardInfos [dev->minor].i_LastChannel-s_BoardInfos [dev->minor].i_FirstChannel + 4; + /**********************************************************/ + /*calculate the total conversion time for all the channels*/ + /**********************************************************/ + d_ConversionTimeForAllChannels = (double)((double)ui_ConvertTime / (double)i_NbrOfChannel); - /*******************************/ - /*Convert the frequence in time*/ - /*******************************/ - d_ConversionTimeForAllChannels =(double) 1.0/ d_ConversionTimeForAllChannels; - ui_ConvertTimeBase=3; - /***********************************/ - /*Test if the time unit is the same*/ - /***********************************/ + /*******************************/ + /*Convert the frequence in time*/ + /*******************************/ + d_ConversionTimeForAllChannels =(double) 1.0/ d_ConversionTimeForAllChannels; + ui_ConvertTimeBase=3; + /***********************************/ + /*Test if the time unit is the same*/ + /***********************************/ - if (ui_DelayTimeBase <= ui_ConvertTimeBase) - { + if (ui_DelayTimeBase <= ui_ConvertTimeBase) + { - for (i_Cpt = 0; i_Cpt < (ui_ConvertTimeBase-ui_DelayTimeBase);i_Cpt++) - { + for (i_Cpt = 0; i_Cpt < (ui_ConvertTimeBase-ui_DelayTimeBase);i_Cpt++) + { - d_ConversionTimeForAllChannels = d_ConversionTimeForAllChannels * 1000; - d_ConversionTimeForAllChannels=d_ConversionTimeForAllChannels+1; - } - } - else - { - for (i_Cpt = 0; i_Cpt < (ui_DelayTimeBase-ui_ConvertTimeBase);i_Cpt++) - { - d_SCANTimeNewUnit = d_SCANTimeNewUnit * 1000; - - } - } + d_ConversionTimeForAllChannels = d_ConversionTimeForAllChannels * 1000; + d_ConversionTimeForAllChannels=d_ConversionTimeForAllChannels+1; + } + } + else + { + for (i_Cpt = 0; i_Cpt < (ui_DelayTimeBase-ui_ConvertTimeBase);i_Cpt++) + { + d_SCANTimeNewUnit = d_SCANTimeNewUnit * 1000; + + } + } - if (d_ConversionTimeForAllChannels >= d_SCANTimeNewUnit) - { + if (d_ConversionTimeForAllChannels >= d_SCANTimeNewUnit) + { - printk("\nSCAN Delay value cannot be used\n"); - /*********************************/ - /*SCAN Delay value cannot be used*/ - /*********************************/ - err++; - } - }//else if(cmd->scan_begin_src==TRIG_FOLLOW) + printk("\nSCAN Delay value cannot be used\n"); + /*********************************/ + /*SCAN Delay value cannot be used*/ + /*********************************/ + err++; + } + fpu_end (); + }//else if(cmd->scan_begin_src==TRIG_FOLLOW) - if(err) - { - i_APCI3200_Reset(dev); - return 4; - } + if(err) + { + i_APCI3200_Reset(dev); + return 4; + } return 0; - } +} /* -+----------------------------------------------------------------------------+ -| Function name :int i_APCI3200_StopCyclicAcquisition(comedi_device *dev,| -| comedi_subdevice *s)| -| | -+----------------------------------------------------------------------------+ -| Task : Stop the acquisition | -| | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev | -| comedi_subdevice *s | -| | -+----------------------------------------------------------------------------+ -| Return Value :0 | -| | -+----------------------------------------------------------------------------+ + +----------------------------------------------------------------------------+ + | Function name :int i_APCI3200_StopCyclicAcquisition(comedi_device *dev,| + | comedi_subdevice *s)| + | | + +----------------------------------------------------------------------------+ + | Task : Stop the acquisition | + | | + +----------------------------------------------------------------------------+ + | Input Parameters : comedi_device *dev | + | comedi_subdevice *s | + | | + +----------------------------------------------------------------------------+ + | Return Value :0 | + | | + +----------------------------------------------------------------------------+ */ int i_APCI3200_StopCyclicAcquisition(comedi_device *dev,comedi_subdevice *s) { -UINT ui_Configuration=0; -i_InterruptFlag=0; -i_Initialised==0; -i_Count=0; -i_Sum=0; - /*******************/ - /*Read the register*/ - /*******************/ - ui_Configuration = inl(devpriv->iobase+i_Offset + 8); -/*****************************/ -/*Reset the START and IRQ bit*/ -/*****************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl((ui_Configuration & 0xFFE7FFFF),devpriv->iobase+i_Offset + 8); -return 0; + UINT ui_Configuration=0; + //i_InterruptFlag=0; + //i_Initialised=0; + //i_Count=0; + //i_Sum=0; + s_BoardInfos [dev->minor].i_InterruptFlag=0; + s_BoardInfos [dev->minor].i_Initialised=0; + s_BoardInfos [dev->minor].i_Count=0; + s_BoardInfos [dev->minor].i_Sum=0; + + /*******************/ + /*Read the register*/ + /*******************/ + //ui_Configuration = inl(devpriv->iobase+i_Offset + 8); + ui_Configuration = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 8); + /*****************************/ + /*Reset the START and IRQ bit*/ + /*****************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl((ui_Configuration & 0xFFE7FFFF),devpriv->iobase+i_Offset + 8); + outl((ui_Configuration & 0xFFE7FFFF),devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 8); + return 0; } /* -+----------------------------------------------------------------------------+ -| Function name : int i_APCI3200_CommandAnalogInput(comedi_device *dev, | -| comedi_subdevice *s) | -| | -+----------------------------------------------------------------------------+ -| Task : Does asynchronous acquisition | -| Determines the mode 1 or 2. | -| | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev | -| comedi_subdevice *s | -| | -| | -+----------------------------------------------------------------------------+ -| Return Value : | -| | -+----------------------------------------------------------------------------+ + +----------------------------------------------------------------------------+ + | Function name : int i_APCI3200_CommandAnalogInput(comedi_device *dev, | + | comedi_subdevice *s) | + | | + +----------------------------------------------------------------------------+ + | Task : Does asynchronous acquisition | + | Determines the mode 1 or 2. | + | | + +----------------------------------------------------------------------------+ + | Input Parameters : comedi_device *dev | + | comedi_subdevice *s | + | | + | | + +----------------------------------------------------------------------------+ + | Return Value : | + | | + +----------------------------------------------------------------------------+ */ - int i_APCI3200_CommandAnalogInput(comedi_device *dev,comedi_subdevice *s) +int i_APCI3200_CommandAnalogInput(comedi_device *dev,comedi_subdevice *s) { -comedi_cmd *cmd=&s->async->cmd; -UINT ui_Configuration=0; -INT i_CurrentSource = 0; -UINT ui_Trigger=0; -UINT ui_TriggerEdge=0; -UINT ui_Triggermode=0; -UINT ui_ScanMode=0; -UINT ui_ConvertTime=0; -UINT ui_ConvertTimeBase=0; -UINT ui_DelayTime=0; -UINT ui_DelayTimeBase=0; -UINT ui_DelayMode=0; - i_FirstChannel=cmd->chanlist[0]; - i_LastChannel=cmd->chanlist[1]; - if(cmd->start_src==TRIG_EXT) - { - ui_Trigger=1; - ui_TriggerEdge=cmd->start_arg &0xFFFF; - ui_Triggermode=cmd->start_arg >> 16; - }//if(cmd->start_src==TRIG_EXT) - else - { - ui_Trigger=0; - }//elseif(cmd->start_src==TRIG_EXT) + comedi_cmd *cmd=&s->async->cmd; + UINT ui_Configuration=0; + //INT i_CurrentSource = 0; + UINT ui_Trigger=0; + UINT ui_TriggerEdge=0; + UINT ui_Triggermode=0; + UINT ui_ScanMode=0; + UINT ui_ConvertTime=0; + UINT ui_ConvertTimeBase=0; + UINT ui_DelayTime=0; + UINT ui_DelayTimeBase=0; + UINT ui_DelayMode=0; + //i_FirstChannel=cmd->chanlist[0]; + //i_LastChannel=cmd->chanlist[1]; + s_BoardInfos [dev->minor].i_FirstChannel=cmd->chanlist[0]; + s_BoardInfos [dev->minor].i_LastChannel=cmd->chanlist[1]; + if(cmd->start_src==TRIG_EXT) + { + ui_Trigger=1; + ui_TriggerEdge=cmd->start_arg &0xFFFF; + ui_Triggermode=cmd->start_arg >> 16; + }//if(cmd->start_src==TRIG_EXT) + else + { + ui_Trigger=0; + }//elseif(cmd->start_src==TRIG_EXT) - if (cmd->stop_src==TRIG_COUNT) - { - ui_ScanMode=0; - }// if (cmd->stop_src==TRIG_COUNT) - else - { - ui_ScanMode=2; - }//else if (cmd->stop_src==TRIG_COUNT) + if (cmd->stop_src==TRIG_COUNT) + { + ui_ScanMode=0; + }// if (cmd->stop_src==TRIG_COUNT) + else + { + ui_ScanMode=2; + }//else if (cmd->stop_src==TRIG_COUNT) - if(cmd->scan_begin_src==TRIG_FOLLOW) - { - ui_DelayTime=0; - ui_DelayTimeBase=0; - ui_DelayMode=0; - }//if(cmd->scan_begin_src==TRIG_FOLLOW) - else - { - ui_DelayTime=cmd->scan_begin_arg & 0xFFFF; - ui_DelayTimeBase=cmd->scan_begin_arg >> 16; - ui_DelayMode =1; - }//else if(cmd->scan_begin_src==TRIG_FOLLOW) -// printk("\nui_DelayTime=%u\n",ui_DelayTime); -// printk("\nui_DelayTimeBase=%u\n",ui_DelayTimeBase); - if (cmd->convert_src==TRIG_TIMER) - { - ui_ConvertTime=cmd->convert_arg & 0xFFFF; - ui_ConvertTimeBase=cmd->convert_arg >> 16; - } - else - { - ui_ConvertTime=0; - ui_ConvertTimeBase=0; - } - printk("\nui_ConvertTime=%u\n",ui_ConvertTime); - printk("\nui_ConvertTimebase=%u\n",ui_ConvertTimeBase); - // if(i_ADDIDATAType ==1 || ((i_ADDIDATAType==2))) - // { - /**************************************************/ - /*Read the old configuration of the current source*/ - /**************************************************/ - ui_Configuration = inl(devpriv->iobase+i_Offset + 12); - /***********************************************/ - /*Write the configuration of the current source*/ - /***********************************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl((ui_Configuration & 0xFFC00000 ), devpriv->iobase+i_Offset +12); - // } - ui_Configuration=0; -// printk("\nfirstchannel=%u\n",i_FirstChannel); -// printk("\nlastchannel=%u\n",i_LastChannel); -// printk("\nui_Trigger=%u\n",ui_Trigger); -// printk("\nui_TriggerEdge=%u\n",ui_TriggerEdge); -// printk("\nui_Triggermode=%u\n",ui_Triggermode); -// printk("\nui_DelayMode=%u\n",ui_DelayMode); -// printk("\nui_ScanMode=%u\n",ui_ScanMode); - ui_Configuration = i_FirstChannel |(i_LastChannel << 8)| 0x00100000 | - (ui_Trigger << 24) | - (ui_TriggerEdge << 25)| - (ui_Triggermode << 27)| - (ui_DelayMode << 18) | - (ui_ScanMode << 16); + if(cmd->scan_begin_src==TRIG_FOLLOW) + { + ui_DelayTime=0; + ui_DelayTimeBase=0; + ui_DelayMode=0; + }//if(cmd->scan_begin_src==TRIG_FOLLOW) + else + { + ui_DelayTime=cmd->scan_begin_arg & 0xFFFF; + ui_DelayTimeBase=cmd->scan_begin_arg >> 16; + ui_DelayMode =1; + }//else if(cmd->scan_begin_src==TRIG_FOLLOW) + // printk("\nui_DelayTime=%u\n",ui_DelayTime); + // printk("\nui_DelayTimeBase=%u\n",ui_DelayTimeBase); + if (cmd->convert_src==TRIG_TIMER) + { + ui_ConvertTime=cmd->convert_arg & 0xFFFF; + ui_ConvertTimeBase=cmd->convert_arg >> 16; + } + else + { + ui_ConvertTime=0; + ui_ConvertTimeBase=0; + } + + // if(i_ADDIDATAType ==1 || ((i_ADDIDATAType==2))) + // { + /**************************************************/ + /*Read the old configuration of the current source*/ + /**************************************************/ + //ui_Configuration = inl(devpriv->iobase+i_Offset + 12); + ui_Configuration = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 12); + /***********************************************/ + /*Write the configuration of the current source*/ + /***********************************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl((ui_Configuration & 0xFFC00000 ), devpriv->iobase+i_Offset +12); + outl((ui_Configuration & 0xFFC00000 ), devpriv->iobase+s_BoardInfos [dev->minor].i_Offset +12); + // } + ui_Configuration=0; + // printk("\nfirstchannel=%u\n",i_FirstChannel); + // printk("\nlastchannel=%u\n",i_LastChannel); + // printk("\nui_Trigger=%u\n",ui_Trigger); + // printk("\nui_TriggerEdge=%u\n",ui_TriggerEdge); + // printk("\nui_Triggermode=%u\n",ui_Triggermode); + // printk("\nui_DelayMode=%u\n",ui_DelayMode); + // printk("\nui_ScanMode=%u\n",ui_ScanMode); + + //ui_Configuration = i_FirstChannel |(i_LastChannel << 8)| 0x00100000 | + ui_Configuration = s_BoardInfos [dev->minor].i_FirstChannel |(s_BoardInfos [dev->minor].i_LastChannel << 8)| 0x00100000 | + (ui_Trigger << 24) | + (ui_TriggerEdge << 25)| + (ui_Triggermode << 27)| + (ui_DelayMode << 18) | + (ui_ScanMode << 16); - /*************************/ - /*Write the Configuration*/ - /*************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl( ui_Configuration, devpriv->iobase+i_Offset + 0x8); - /***********************/ - /*Write the Delay Value*/ - /***********************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl(ui_DelayTime,devpriv->iobase+i_Offset + 40); - /***************************/ - /*Write the Delay time base*/ - /***************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl(ui_DelayTimeBase,devpriv->iobase+i_Offset + 44); - /*********************************/ - /*Write the conversion time value*/ - /*********************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl(ui_ConvertTime,devpriv->iobase+i_Offset + 32); - /********************************/ - /*Write the conversion time base*/ - /********************************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl(ui_ConvertTimeBase,devpriv->iobase+i_Offset + 36); - /*******************/ - /*Read the register*/ - /*******************/ - ui_Configuration = inl(devpriv->iobase+i_Offset + 4); - /******************/ - /*Set the SCAN bit*/ - /******************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - - outl(((ui_Configuration & 0x1E0FF) | 0x00002000),devpriv->iobase+i_Offset + 4); - /*******************/ - /*Read the register*/ - /*******************/ - ui_Configuration=0; - ui_Configuration = inl(devpriv->iobase+i_Offset + 8); - - /*******************/ - /*Set the START bit*/ - /*******************/ - while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); - outl((ui_Configuration | 0x00080000),devpriv->iobase+i_Offset + 8); + /*************************/ + /*Write the Configuration*/ + /*************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl( ui_Configuration, devpriv->iobase+i_Offset + 0x8); + outl( ui_Configuration, devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 0x8); + /***********************/ + /*Write the Delay Value*/ + /***********************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl(ui_DelayTime,devpriv->iobase+i_Offset + 40); + outl(ui_DelayTime,devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 40); + /***************************/ + /*Write the Delay time base*/ + /***************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl(ui_DelayTimeBase,devpriv->iobase+i_Offset + 44); + outl(ui_DelayTimeBase,devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 44); + /*********************************/ + /*Write the conversion time value*/ + /*********************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl(ui_ConvertTime,devpriv->iobase+i_Offset + 32); + outl(ui_ConvertTime,devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 32); + + /********************************/ + /*Write the conversion time base*/ + /********************************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl(ui_ConvertTimeBase,devpriv->iobase+i_Offset + 36); + outl(ui_ConvertTimeBase,devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 36); + /*******************/ + /*Read the register*/ + /*******************/ + //ui_Configuration = inl(devpriv->iobase+i_Offset + 4); + ui_Configuration = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 4); + /******************/ + /*Set the SCAN bit*/ + /******************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + + //outl(((ui_Configuration & 0x1E0FF) | 0x00002000),devpriv->iobase+i_Offset + 4); + outl(((ui_Configuration & 0x1E0FF) | 0x00002000),devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 4); + /*******************/ + /*Read the register*/ + /*******************/ + ui_Configuration=0; + //ui_Configuration = inl(devpriv->iobase+i_Offset + 8); + ui_Configuration = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 8); + + /*******************/ + /*Set the START bit*/ + /*******************/ + //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + while (((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset+12)>>19) & 1) != 1); + //outl((ui_Configuration | 0x00080000),devpriv->iobase+i_Offset + 8); + outl((ui_Configuration | 0x00080000),devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 8); return 0; } @@ -1978,140 +2901,172 @@ UINT ui_DelayMode=0; /* -+----------------------------------------------------------------------------+ -| Function Name : int i_APCI3200_Reset(comedi_device *dev) | -| | -+----------------------------------------------------------------------------+ -| Task :Resets the registers of the card | -+----------------------------------------------------------------------------+ -| Input Parameters : | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : | -| | -+----------------------------------------------------------------------------+ + +----------------------------------------------------------------------------+ + | Function Name : int i_APCI3200_Reset(comedi_device *dev) | + | | + +----------------------------------------------------------------------------+ + | Task :Resets the registers of the card | + +----------------------------------------------------------------------------+ + | Input Parameters : | + +----------------------------------------------------------------------------+ + | Output Parameters : -- | + +----------------------------------------------------------------------------+ + | Return Value : | + | | + +----------------------------------------------------------------------------+ */ int i_APCI3200_Reset(comedi_device *dev) { -INT i_Temp; -DWORD dw_Dummy; -i_InterruptFlag=0; -i_Initialised==0; -i_Count=0; -i_Sum=0; - -outl(0x83838383,devpriv->i_IobaseAmcc+0x60); + INT i_Temp; + DWORD dw_Dummy; + //i_InterruptFlag=0; + //i_Initialised==0; + //i_Count=0; + //i_Sum=0; + + s_BoardInfos [dev->minor].i_InterruptFlag=0; + s_BoardInfos [dev->minor].i_Initialised=0; + s_BoardInfos [dev->minor].i_Count=0; + s_BoardInfos [dev->minor].i_Sum=0; + s_BoardInfos [dev->minor].b_StructInitialized = 0; + + outl(0x83838383,devpriv->i_IobaseAmcc+0x60); - // Enable the interrupt for the controler - dw_Dummy = inl(devpriv->i_IobaseAmcc+ 0x38); - outl(dw_Dummy | 0x2000,devpriv->i_IobaseAmcc+0x38); -outl(0,devpriv->i_IobaseAddon);//Resets the output -/***************/ -/*Empty the buffer*/ -/**************/ -for(i_Temp=0;i_Temp<=95;i_Temp++) - { - ui_InterruptChannelValue[i_Temp]=0; - }//for(i_Temp=0;i_Temp<=95;i_Temp++) -/*****************************/ -/*Reset the START and IRQ bit*/ -/*****************************/ -for(i_Temp=0;i_Temp<=192;) - { - while (((inl(devpriv->iobase+i_Temp+12)>>19) & 1) != 1); - outl(0,devpriv->iobase+i_Temp + 8); - i_Temp=i_Temp+64; - }//for(i_Temp=0;i_Temp<=192;i_Temp+64) -return 0; + // Enable the interrupt for the controler + dw_Dummy = inl(devpriv->i_IobaseAmcc+ 0x38); + outl(dw_Dummy | 0x2000,devpriv->i_IobaseAmcc+0x38); + outl(0,devpriv->i_IobaseAddon);//Resets the output + /***************/ + /*Empty the buffer*/ + /**************/ + for(i_Temp=0;i_Temp<=95;i_Temp++) + { + //ui_InterruptChannelValue[i_Temp]=0; + s_BoardInfos [dev->minor].ui_InterruptChannelValue[i_Temp]=0; + }//for(i_Temp=0;i_Temp<=95;i_Temp++) + /*****************************/ + /*Reset the START and IRQ bit*/ + /*****************************/ + for(i_Temp=0;i_Temp<=192;) + { + while (((inl(devpriv->iobase+i_Temp+12)>>19) & 1) != 1); + outl(0,devpriv->iobase+i_Temp + 8); + i_Temp=i_Temp+64; + }//for(i_Temp=0;i_Temp<=192;i_Temp+64) + return 0; } /* -+----------------------------------------------------------------------------+ -| Function Name : static void v_APCI3200_Interrupt | -| (int irq , void *d, struct pt_regs *regs) | -+----------------------------------------------------------------------------+ -| Task : Interrupt processing Routine | -+----------------------------------------------------------------------------+ -| Input Parameters : int irq : irq number | -| void *d : void pointer | -| struct pt_regs *regs : structure pointer | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ + +----------------------------------------------------------------------------+ + | Function Name : static void v_APCI3200_Interrupt | + | (int irq , void *d, struct pt_regs *regs) | + +----------------------------------------------------------------------------+ + | Task : Interrupt processing Routine | + +----------------------------------------------------------------------------+ + | Input Parameters : int irq : irq number | + | void *d : void pointer | + | struct pt_regs *regs : structure pointer | + +----------------------------------------------------------------------------+ + | Output Parameters : -- | + +----------------------------------------------------------------------------+ + | Return Value : TRUE : No error occur | + | : FALSE : Error occur. Return the error | + | | + +----------------------------------------------------------------------------+ */ - void v_APCI3200_Interrupt(int irq, void *d, struct pt_regs *regs) +void v_APCI3200_Interrupt(int irq, void *d, struct pt_regs *regs) { - comedi_device *dev = d; - UINT ui_StatusRegister=0; - UINT ui_ChannelNumber = 0; - INT i_CalibrationFlag = 0; - INT i_CJCFlag=0; - UINT ui_DummyValue = 0; - UINT ui_DigitalTemperature=0; - UINT ui_DigitalInput =0; - int i_ConvertCJCCalibration; - int k; - -switch(i_ScanType) - { + comedi_device *dev = d; + UINT ui_StatusRegister=0; + UINT ui_ChannelNumber = 0; + INT i_CalibrationFlag = 0; + INT i_CJCFlag=0; + UINT ui_DummyValue = 0; + UINT ui_DigitalTemperature=0; + UINT ui_DigitalInput =0; + int i_ConvertCJCCalibration; + + //BEGIN JK TEST + int i_ReturnValue = 0; + //END JK TEST + + + //printk ("\n i_ScanType = %i i_ADDIDATAType = %i", s_BoardInfos [dev->minor].i_ScanType, s_BoardInfos [dev->minor].i_ADDIDATAType); + + //switch(i_ScanType) + switch(s_BoardInfos [dev->minor].i_ScanType) + { case 0: case 1: - switch(i_ADDIDATAType) - { - case 0: - case 1: + //switch(i_ADDIDATAType) + switch(s_BoardInfos [dev->minor].i_ADDIDATAType) + { + case 0: + case 1: - /************************************/ - /*Read the interrupt status register*/ - /************************************/ - ui_StatusRegister = inl(devpriv->iobase+i_Offset + 16); - if ((ui_StatusRegister & 0x2) == 0x2) - { - i_CalibrationFlag = ((inl(devpriv->iobase+i_Offset + 12) & 0x00060000) >> 17); - /*************************/ - /*Read the channel number*/ - /*************************/ - ui_ChannelNumber = inl(devpriv->iobase+i_Offset + 24); - /*************************************/ - /*Read the digital analog input value*/ - /*************************************/ - ui_DigitalInput = inl(devpriv->iobase+i_Offset + 28); - /***********************************************/ - /* Test if the value read is the channel value */ - /***********************************************/ - if (i_CalibrationFlag == 0) - { - ui_InterruptChannelValue[i_Count + 0] = ui_DigitalInput; - - /******************************************************/ - /*Start the conversion of the calibration offset value*/ - /******************************************************/ - i_APCI3200_ReadCalibrationOffsetValue(dev,&ui_DummyValue); - }//if (i_CalibrationFlag == 0) - /**********************************************************/ - /* Test if the value read is the calibration offset value */ - /**********************************************************/ - - if (i_CalibrationFlag == 1) - { + /************************************/ + /*Read the interrupt status register*/ + /************************************/ + //ui_StatusRegister = inl(devpriv->iobase+i_Offset + 16); + ui_StatusRegister = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 16); + if ((ui_StatusRegister & 0x2) == 0x2) + { + //i_CalibrationFlag = ((inl(devpriv->iobase+i_Offset + 12) & 0x00060000) >> 17); + i_CalibrationFlag = ((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 12) & 0x00060000) >> 17); + /*************************/ + /*Read the channel number*/ + /*************************/ + //ui_ChannelNumber = inl(devpriv->iobase+i_Offset + 24); + + /*************************************/ + /*Read the digital analog input value*/ + /*************************************/ + //ui_DigitalInput = inl(devpriv->iobase+i_Offset + 28); + ui_DigitalInput = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 28); + + /***********************************************/ + /* Test if the value read is the channel value */ + /***********************************************/ + if (i_CalibrationFlag == 0) + { + //ui_InterruptChannelValue[i_Count + 0] = ui_DigitalInput; + s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count + 0] = ui_DigitalInput; + + //Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + /* + printk("\n 1 - i_APCI3200_GetChannelCalibrationValue (dev, s_BoardInfos %i", ui_ChannelNumber); + i_APCI3200_GetChannelCalibrationValue (dev, s_BoardInfos [dev->minor].ui_Channel_num, + &s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count + 6], + &s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count + 7], + &s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count + 8]); + */ + //End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + + /******************************************************/ + /*Start the conversion of the calibration offset value*/ + /******************************************************/ + i_APCI3200_ReadCalibrationOffsetValue(dev,&ui_DummyValue); + }//if (i_CalibrationFlag == 0) + /**********************************************************/ + /* Test if the value read is the calibration offset value */ + /**********************************************************/ + + if (i_CalibrationFlag == 1) + { - /******************/ - /* Save the value */ - /******************/ + /******************/ + /* Save the value */ + /******************/ - ui_InterruptChannelValue[i_Count + 1] = ui_DigitalInput; - - /******************************************************/ - /* Start the conversion of the calibration gain value */ - /******************************************************/ - i_APCI3200_ReadCalibrationGainValue(dev,&ui_DummyValue); - }//if (i_CalibrationFlag == 1) + //ui_InterruptChannelValue[i_Count + 1] = ui_DigitalInput; + s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count + 1] = ui_DigitalInput; + + /******************************************************/ + /* Start the conversion of the calibration gain value */ + /******************************************************/ + i_APCI3200_ReadCalibrationGainValue(dev,&ui_DummyValue); + }//if (i_CalibrationFlag == 1) /******************************************************/ /*Test if the value read is the calibration gain value*/ /******************************************************/ @@ -2119,295 +3074,396 @@ switch(i_ScanType) if (i_CalibrationFlag == 2) { - /****************/ - /*Save the value*/ - /****************/ - ui_InterruptChannelValue[i_Count + 2] = ui_DigitalInput; - if(i_ScanType==1) - { - - i_InterruptFlag=0; - i_Count=i_Count + 6; - }//if(i_ScanType==1) - else - { - i_Count=0; - }//elseif(i_ScanType==1) - if(i_ScanType!=1) - { - - send_sig(SIGIO,devpriv->tsk_Current,0); // send signal to the sample - }//if(i_ScanType!=1) - else - { - if(i_ChannelCount==i_Sum) - { - - send_sig(SIGIO,devpriv->tsk_Current,0); // send signal to the sample - } - }//if(i_ScanType!=1) + /****************/ + /*Save the value*/ + /****************/ + //ui_InterruptChannelValue[i_Count + 2] = ui_DigitalInput; + s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count + 2] = ui_DigitalInput; + //if(i_ScanType==1) + if(s_BoardInfos [dev->minor].i_ScanType==1) + { + + //i_InterruptFlag=0; + s_BoardInfos [dev->minor].i_InterruptFlag=0; + //i_Count=i_Count + 6; + //Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + //s_BoardInfos [dev->minor].i_Count=s_BoardInfos [dev->minor].i_Count + 6; + s_BoardInfos [dev->minor].i_Count=s_BoardInfos [dev->minor].i_Count + 9; + //End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + }//if(i_ScanType==1) + else + { + //i_Count=0; + s_BoardInfos [dev->minor].i_Count=0; + }//elseif(i_ScanType==1) + //if(i_ScanType!=1) + if(s_BoardInfos [dev->minor].i_ScanType!=1) + { + i_ReturnValue = send_sig(SIGIO,devpriv->tsk_Current,0); // send signal to the sample + }//if(i_ScanType!=1) + else + { + //if(i_ChannelCount==i_Sum) + if(s_BoardInfos [dev->minor].i_ChannelCount==s_BoardInfos [dev->minor].i_Sum) + { + send_sig(SIGIO,devpriv->tsk_Current,0); // send signal to the sample + } + }//if(i_ScanType!=1) }//if (i_CalibrationFlag == 2) - }// if ((ui_StatusRegister & 0x2) == 0x2) - break; + }// if ((ui_StatusRegister & 0x2) == 0x2) + + break; - case 2: - /************************************/ - /*Read the interrupt status register*/ - /************************************/ - - ui_StatusRegister = inl(devpriv->iobase+i_Offset + 16); - /*************************/ - /*Test if interrupt occur*/ - /*************************/ + case 2: + /************************************/ + /*Read the interrupt status register*/ + /************************************/ + + //ui_StatusRegister = inl(devpriv->iobase+i_Offset + 16); + ui_StatusRegister = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 16); + /*************************/ + /*Test if interrupt occur*/ + /*************************/ - if ((ui_StatusRegister & 0x2) == 0x2) - { + if ((ui_StatusRegister & 0x2) == 0x2) + { - i_CJCFlag = ((inl(devpriv->iobase+i_Offset + 4) & 0x00000400) >> 10); + //i_CJCFlag = ((inl(devpriv->iobase+i_Offset + 4) & 0x00000400) >> 10); + i_CJCFlag = ((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 4) & 0x00000400) >> 10); - i_CalibrationFlag = ((inl(devpriv->iobase+i_Offset + 12) & 0x00060000) >> 17); + //i_CalibrationFlag = ((inl(devpriv->iobase+i_Offset + 12) & 0x00060000) >> 17); + i_CalibrationFlag = ((inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 12) & 0x00060000) >> 17); - /*************************/ - /*Read the channel number*/ - /*************************/ + /*************************/ + /*Read the channel number*/ + /*************************/ - ui_ChannelNumber = inl(devpriv->iobase+i_Offset + 24); - + //ui_ChannelNumber = inl(devpriv->iobase+i_Offset + 24); + ui_ChannelNumber = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 24); + //Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + s_BoardInfos [dev->minor].ui_Channel_num = ui_ChannelNumber; + //End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values - /************************************/ - /*Read the digital temperature value*/ - /************************************/ - ui_DigitalTemperature = inl(devpriv->iobase+i_Offset + 28); - + /************************************/ + /*Read the digital temperature value*/ + /************************************/ + //ui_DigitalTemperature = inl(devpriv->iobase+i_Offset + 28); + ui_DigitalTemperature = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 28); - - /*********************************************/ - /*Test if the value read is the channel value*/ - /*********************************************/ + /*********************************************/ + /*Test if the value read is the channel value*/ + /*********************************************/ - - if ((i_CalibrationFlag == 0) && (i_CJCFlag == 0)) - { - ui_InterruptChannelValue[i_Count + 0]=ui_DigitalTemperature; - - /*********************************/ - /*Start the conversion of the CJC*/ - /*********************************/ - i_APCI3200_ReadCJCValue(dev,&ui_DummyValue); - - }//if ((i_CalibrationFlag == 0) && (i_CJCFlag == 0)) + if ((i_CalibrationFlag == 0) && (i_CJCFlag == 0)) + { + //ui_InterruptChannelValue[i_Count + 0]=ui_DigitalTemperature; + s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count + 0]=ui_DigitalTemperature; + + /*********************************/ + /*Start the conversion of the CJC*/ + /*********************************/ + i_APCI3200_ReadCJCValue(dev,&ui_DummyValue); + + }//if ((i_CalibrationFlag == 0) && (i_CJCFlag == 0)) /*****************************************/ /*Test if the value read is the CJC value*/ /*****************************************/ - if ((i_CJCFlag == 1) && (i_CalibrationFlag == 0)) - { - ui_InterruptChannelValue[i_Count + 3]=ui_DigitalTemperature; + if ((i_CJCFlag == 1) && (i_CalibrationFlag == 0)) + { + //ui_InterruptChannelValue[i_Count + 3]=ui_DigitalTemperature; + s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count + 3]=ui_DigitalTemperature; - /******************************************************/ - /*Start the conversion of the calibration offset value*/ - /******************************************************/ - i_APCI3200_ReadCalibrationOffsetValue(dev,&ui_DummyValue); - }// if ((i_CJCFlag == 1) && (i_CalibrationFlag == 0)) + /******************************************************/ + /*Start the conversion of the calibration offset value*/ + /******************************************************/ + i_APCI3200_ReadCalibrationOffsetValue(dev,&ui_DummyValue); + }// if ((i_CJCFlag == 1) && (i_CalibrationFlag == 0)) /********************************************************/ /*Test if the value read is the calibration offset value*/ /********************************************************/ - if ((i_CalibrationFlag == 1) && (i_CJCFlag == 0)) - { - ui_InterruptChannelValue[i_Count + 1]=ui_DigitalTemperature; - - /****************************************************/ - /*Start the conversion of the calibration gain value*/ - /****************************************************/ + if ((i_CalibrationFlag == 1) && (i_CJCFlag == 0)) + { + //ui_InterruptChannelValue[i_Count + 1]=ui_DigitalTemperature; + s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count + 1]=ui_DigitalTemperature; + + /****************************************************/ + /*Start the conversion of the calibration gain value*/ + /****************************************************/ i_APCI3200_ReadCalibrationGainValue(dev,&ui_DummyValue); - }//if ((i_CalibrationFlag == 1) && (i_CJCFlag == 0)) + }//if ((i_CalibrationFlag == 1) && (i_CJCFlag == 0)) - /******************************************************/ - /*Test if the value read is the calibration gain value*/ - /******************************************************/ + /******************************************************/ + /*Test if the value read is the calibration gain value*/ + /******************************************************/ - if ((i_CalibrationFlag == 2) && (i_CJCFlag == 0)) - { - ui_InterruptChannelValue[i_Count + 2]=ui_DigitalTemperature; + if ((i_CalibrationFlag == 2) && (i_CJCFlag == 0)) + { + //ui_InterruptChannelValue[i_Count + 2]=ui_DigitalTemperature; + s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count + 2]=ui_DigitalTemperature; - /**********************************************************/ - /*Test if the Calibration channel must be read for the CJC*/ - /**********************************************************/ + /**********************************************************/ + /*Test if the Calibration channel must be read for the CJC*/ + /**********************************************************/ - /*Test if the polarity is the same*/ - /**********************************/ - if(i_CJCPolarity!=i_ADDIDATAPolarity) - { - i_ConvertCJCCalibration=1; - }//if(i_CJCPolarity!=i_ADDIDATAPolarity) - else - { - if(i_CJCGain==i_ADDIDATAGain) - { + /*Test if the polarity is the same*/ + /**********************************/ + //if(i_CJCPolarity!=i_ADDIDATAPolarity) + if(s_BoardInfos [dev->minor].i_CJCPolarity!=s_BoardInfos [dev->minor].i_ADDIDATAPolarity) + { + i_ConvertCJCCalibration=1; + }//if(i_CJCPolarity!=i_ADDIDATAPolarity) + else + { + //if(i_CJCGain==i_ADDIDATAGain) + if(s_BoardInfos [dev->minor].i_CJCGain==s_BoardInfos [dev->minor].i_ADDIDATAGain) + { i_ConvertCJCCalibration=0; - }//if(i_CJCGain==i_ADDIDATAGain) - else - { - i_ConvertCJCCalibration=1; - }//elseif(i_CJCGain==i_ADDIDATAGain) - }//elseif(i_CJCPolarity!=i_ADDIDATAPolarity) - if(i_ConvertCJCCalibration==1) - { - /****************************************************************/ - /*Start the conversion of the calibration gain value for the CJC*/ - /****************************************************************/ - i_APCI3200_ReadCJCCalOffset(dev,&ui_DummyValue); + }//if(i_CJCGain==i_ADDIDATAGain) + else + { + i_ConvertCJCCalibration=1; + }//elseif(i_CJCGain==i_ADDIDATAGain) + }//elseif(i_CJCPolarity!=i_ADDIDATAPolarity) + if(i_ConvertCJCCalibration==1) + { + /****************************************************************/ + /*Start the conversion of the calibration gain value for the CJC*/ + /****************************************************************/ + i_APCI3200_ReadCJCCalOffset(dev,&ui_DummyValue); - }//if(i_ConvertCJCCalibration==1) - else - { - ui_InterruptChannelValue[i_Count + 4]=0; - ui_InterruptChannelValue[i_Count + 5]=0; - - }//elseif(i_ConvertCJCCalibration==1) - }//else if ((i_CalibrationFlag == 2) && (i_CJCFlag == 0)) + }//if(i_ConvertCJCCalibration==1) + else + { + //ui_InterruptChannelValue[i_Count + 4]=0; + //ui_InterruptChannelValue[i_Count + 5]=0; + s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count + 4]=0; + s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count + 5]=0; + }//elseif(i_ConvertCJCCalibration==1) + }//else if ((i_CalibrationFlag == 2) && (i_CJCFlag == 0)) /********************************************************************/ /*Test if the value read is the calibration offset value for the CJC*/ /********************************************************************/ - if ((i_CalibrationFlag == 1) && (i_CJCFlag == 1)) - { - ui_InterruptChannelValue[i_Count + 4]=ui_DigitalTemperature; + if ((i_CalibrationFlag == 1) && (i_CJCFlag == 1)) + { + //ui_InterruptChannelValue[i_Count + 4]=ui_DigitalTemperature; + s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count + 4]=ui_DigitalTemperature; /****************************************************************/ /*Start the conversion of the calibration gain value for the CJC*/ /****************************************************************/ i_APCI3200_ReadCJCCalGain(dev,&ui_DummyValue); - }//if ((i_CalibrationFlag == 1) && (i_CJCFlag == 1)) + }//if ((i_CalibrationFlag == 1) && (i_CJCFlag == 1)) - /******************************************************************/ - /*Test if the value read is the calibration gain value for the CJC*/ - /******************************************************************/ + /******************************************************************/ + /*Test if the value read is the calibration gain value for the CJC*/ + /******************************************************************/ - if ((i_CalibrationFlag == 2) && (i_CJCFlag == 1)) - { - ui_InterruptChannelValue[i_Count + 5]=ui_DigitalTemperature; - - if(i_ScanType==1) - { - - i_InterruptFlag=0; - i_Count=i_Count + 6; - }//if(i_ScanType==1) + if ((i_CalibrationFlag == 2) && (i_CJCFlag == 1)) + { + //ui_InterruptChannelValue[i_Count + 5]=ui_DigitalTemperature; + s_BoardInfos [dev->minor].ui_InterruptChannelValue[s_BoardInfos [dev->minor].i_Count + 5]=ui_DigitalTemperature; + + //if(i_ScanType==1) + if(s_BoardInfos [dev->minor].i_ScanType==1) + { + + //i_InterruptFlag=0; + s_BoardInfos [dev->minor].i_InterruptFlag=0; + //i_Count=i_Count + 6; + //Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + //s_BoardInfos [dev->minor].i_Count=s_BoardInfos [dev->minor].i_Count + 6; + s_BoardInfos [dev->minor].i_Count=s_BoardInfos [dev->minor].i_Count + 9; + //End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + }//if(i_ScanType==1) else - { - i_Count=0; - }//elseif(i_ScanType==1) - if(i_ScanType!=1) + { + //i_Count=0; + s_BoardInfos [dev->minor].i_Count=0; + }//elseif(i_ScanType==1) + + //if(i_ScanType!=1) + if(s_BoardInfos [dev->minor].i_ScanType!=1) { - - send_sig(SIGIO,devpriv->tsk_Current,0); // send signal to the sample + send_sig(SIGIO,devpriv->tsk_Current,0); // send signal to the sample }//if(i_ScanType!=1) else { - if(i_ChannelCount==i_Sum) - { - send_sig(SIGIO,devpriv->tsk_Current,0); // send signal to the sample + //if(i_ChannelCount==i_Sum) + if(s_BoardInfos [dev->minor].i_ChannelCount==s_BoardInfos [dev->minor].i_Sum) + { + send_sig(SIGIO,devpriv->tsk_Current,0); // send signal to the sample - }//if(i_ChannelCount==i_Sum) + }//if(i_ChannelCount==i_Sum) }//else if(i_ScanType!=1) - }//if ((i_CalibrationFlag == 2) && (i_CJCFlag == 1)) - - }//else if ((ui_StatusRegister & 0x2) == 0x2) - break; - }//switch(i_ADDIDATAType) - break; - case 2: - case 3: - i_APCI3200_InterruptHandleEos(dev); - break; - }//switch(i_ScanType) -return; + }//if ((i_CalibrationFlag == 2) && (i_CJCFlag == 1)) + + }//else if ((ui_StatusRegister & 0x2) == 0x2) + break; + }//switch(i_ADDIDATAType) + break; + case 2: + case 3: + i_APCI3200_InterruptHandleEos(dev); + break; + }//switch(i_ScanType) + return; } /* -+----------------------------------------------------------------------------+ -| Function name :int i_APCI3200_InterruptHandleEos(comedi_device *dev) | -| | -| | -+----------------------------------------------------------------------------+ -| Task : . | -| This function copies the acquired data(from FIFO) | -| to Comedi buffer. | -| | -+----------------------------------------------------------------------------+ -| Input Parameters : comedi_device *dev | -| | -| | -+----------------------------------------------------------------------------+ -| Return Value : 0 | -| | -+----------------------------------------------------------------------------+ + +----------------------------------------------------------------------------+ + | Function name :int i_APCI3200_InterruptHandleEos(comedi_device *dev) | + | | + | | + +----------------------------------------------------------------------------+ + | Task : . | + | This function copies the acquired data(from FIFO) | + | to Comedi buffer. | + | | + +----------------------------------------------------------------------------+ + | Input Parameters : comedi_device *dev | + | | + | | + +----------------------------------------------------------------------------+ + | Return Value : 0 | + | | + +----------------------------------------------------------------------------+ */ int i_APCI3200_InterruptHandleEos(comedi_device *dev) { - UINT ui_StatusRegister=0; - UINT ui_ChannelNumber = 0; - UINT *data; - comedi_subdevice *s=dev->subdevices+0; - comedi_async *async = s->async; - data=async->data+async->buf_int_ptr;//new samples added from here onwards + UINT ui_StatusRegister=0; + comedi_subdevice *s=dev->subdevices+0; + + //BEGIN JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 + //comedi_async *async = s->async; + //UINT *data; + //data=async->data+async->buf_int_ptr;//new samples added from here onwards + int n = 0, i = 0; + //END JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 - /************************************/ - /*Read the interrupt status register*/ - /************************************/ - ui_StatusRegister = inl(devpriv->iobase+i_Offset + 16); - /*************************/ - /*Test if interrupt occur*/ - /*************************/ + /************************************/ + /*Read the interrupt status register*/ + /************************************/ + //ui_StatusRegister = inl(devpriv->iobase+i_Offset + 16); + ui_StatusRegister = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 16); + + /*************************/ + /*Test if interrupt occur*/ + /*************************/ - if ((ui_StatusRegister & 0x2) == 0x2) - { - /*************************/ - /*Read the channel number*/ - /*************************/ - ui_ChannelNumber = inl(devpriv->iobase+i_Offset + 24); - - /*************************************/ - /*Read the digital Analog Input value*/ - /*************************************/ - - data[i_Count] = inl(devpriv->iobase+i_Offset + 28); -// printk("\ndata[%d]=%x\n",i_Count,data[i_Count]); - if((i_Count == (i_LastChannel-i_FirstChannel+3))) - { - i_Count=-1; - async->buf_int_count+=(i_LastChannel-i_FirstChannel+4)*sizeof(UINT); - async->buf_int_ptr+=(i_LastChannel-i_FirstChannel+4)*sizeof(UINT); - comedi_eos(dev,s); - if (s->async->buf_int_ptr>=s->async->data_len) // for buffer rool over - { - /* buffer rollover */ - s->async->buf_int_ptr=0; - comedi_eobuf(dev,s); - } - } - i_Count++; - } - i_InterruptFlag=0; - return 0; + if ((ui_StatusRegister & 0x2) == 0x2) + { + /*************************/ + /*Read the channel number*/ + /*************************/ + //ui_ChannelNumber = inl(devpriv->iobase+i_Offset + 24); + //BEGIN JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 + //This value is not used + //ui_ChannelNumber = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 24); + s->async->events = 0; + //END JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 + + /*************************************/ + /*Read the digital Analog Input value*/ + /*************************************/ + + //data[i_Count] = inl(devpriv->iobase+i_Offset + 28); + //Begin JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 + //data[s_BoardInfos [dev->minor].i_Count] = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 28); + s_BoardInfos [dev->minor].ui_ScanValueArray [s_BoardInfos [dev->minor].i_Count] = inl(devpriv->iobase+s_BoardInfos [dev->minor].i_Offset + 28); + //End JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 + + //if((i_Count == (i_LastChannel-i_FirstChannel+3))) + if((s_BoardInfos [dev->minor].i_Count == (s_BoardInfos [dev->minor].i_LastChannel-s_BoardInfos [dev->minor].i_FirstChannel+3))) + { + + //Begin JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + s_BoardInfos [dev->minor].i_Count++; + + for (i=s_BoardInfos [dev->minor].i_FirstChannel; i<=s_BoardInfos [dev->minor].i_LastChannel; i++) + { + i_APCI3200_GetChannelCalibrationValue (dev, i, + &s_BoardInfos [dev->minor].ui_ScanValueArray [s_BoardInfos [dev->minor].i_Count + + ((i-s_BoardInfos [dev->minor].i_FirstChannel)*3)], + &s_BoardInfos [dev->minor].ui_ScanValueArray [s_BoardInfos [dev->minor].i_Count + + ((i-s_BoardInfos [dev->minor].i_FirstChannel)*3) + 1], + &s_BoardInfos [dev->minor].ui_ScanValueArray [s_BoardInfos [dev->minor].i_Count + + ((i-s_BoardInfos [dev->minor].i_FirstChannel)*3) + 2]); + } + + //End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + + //i_Count=-1; + + s_BoardInfos [dev->minor].i_Count=-1; + + //async->buf_int_count+=(i_LastChannel-i_FirstChannel+4)*sizeof(UINT); + //Begin JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 + //async->buf_int_count+=(s_BoardInfos [dev->minor].i_LastChannel-s_BoardInfos [dev->minor].i_FirstChannel+4)*sizeof(UINT); + //End JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 + //async->buf_int_ptr+=(i_LastChannel-i_FirstChannel+4)*sizeof(UINT); + //Begin JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 + //async->buf_int_ptr+=(s_BoardInfos [dev->minor].i_LastChannel-s_BoardInfos [dev->minor].i_FirstChannel+4)*sizeof(UINT); + //comedi_eos(dev,s); + + // Set the event type (Comedi Buffer End Of Scan) + s->async->events |= COMEDI_CB_EOS; + + // Test if enougth memory is available and allocate it for 7 values + //n = comedi_buf_write_alloc(s->async, 7*sizeof(lsampl_t)); + n = comedi_buf_write_alloc(s->async, (7+12)*sizeof(lsampl_t)); + + // If not enougth memory available, event is set to Comedi Buffer Errror + if (n > ((7+12)*sizeof(lsampl_t))) + { + printk ("\ncomedi_buf_write_alloc n = %i", n); + s->async->events |= COMEDI_CB_ERROR; + } + + // Write all 7 scan values in the comedi buffer + comedi_buf_memcpy_to(s->async, 0, (lsampl_t*)s_BoardInfos [dev->minor].ui_ScanValueArray, (7+12)*sizeof(lsampl_t)); + + // Update comedi buffer pinters indexes + comedi_buf_write_free(s->async, (7+12)*sizeof(lsampl_t)); + + // Send events + comedi_event(dev,s,s->async->events); + //End JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 + + //BEGIN JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 + // + //if (s->async->buf_int_ptr>=s->async->data_len) // for buffer rool over + // { + // /* buffer rollover */ + // s->async->buf_int_ptr=0; + // comedi_eobuf(dev,s); + // } + //End JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 + } + //i_Count++; + s_BoardInfos [dev->minor].i_Count++; + } + //i_InterruptFlag=0; + s_BoardInfos [dev->minor].i_InterruptFlag=0; + return 0; } diff --git a/comedi/drivers/addi-data/hwdrv_apci3200.h b/comedi/drivers/addi-data/hwdrv_apci3200.h index 8b123131..50e6f268 100644 --- a/comedi/drivers/addi-data/hwdrv_apci3200.h +++ b/comedi/drivers/addi-data/hwdrv_apci3200.h @@ -1,39 +1,71 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ + // Card Specific information #define APCI3200_BOARD_VENDOR_ID 0x15B8 //#define APCI3200_ADDRESS_RANGE 264 - - - -int MODULE_NO ; - struct -{ - INT i_Gain ; - INT i_Polarity; - INT i_OffsetRange; - INT i_Coupling; - INT i_SingleDiff; - INT i_AutoCalibration; - UINT ui_ReloadValue; - UINT ui_TimeUnitReloadVal; - INT i_Interrupt; - INT i_ModuleSelection; -}Config_Parameters_Module1,Config_Parameters_Module2,Config_Parameters_Module3,Config_Parameters_Module4; - - - -//ANALOG INPUT RANGE -comedi_lrange range_apci3200_ai={ 8, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2), - BIP_RANGE(1), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2), - UNI_RANGE(1) - } -}; - + + + +int MODULE_NO ; + struct +{ + INT i_Gain ; + INT i_Polarity; + INT i_OffsetRange; + INT i_Coupling; + INT i_SingleDiff; + INT i_AutoCalibration; + UINT ui_ReloadValue; + UINT ui_TimeUnitReloadVal; + INT i_Interrupt; + INT i_ModuleSelection; +}Config_Parameters_Module1,Config_Parameters_Module2,Config_Parameters_Module3,Config_Parameters_Module4; + + + +//ANALOG INPUT RANGE +comedi_lrange range_apci3200_ai={ 8, { + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2), + BIP_RANGE(1), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2), + UNI_RANGE(1) + } +}; + +comedi_lrange range_apci3300_ai={ 4, { + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2), + UNI_RANGE(1) + } +}; + //Analog Input related Defines #define APCI3200_AI_OFFSET_GAIN 0 #define APCI3200_AI_SC_TEST 4 @@ -47,8 +79,8 @@ comedi_lrange range_apci3200_ai={ 8, { #define APCI3200_AI_MODULE2 64 #define APCI3200_AI_MODULE3 128 #define APCI3200_AI_MODULE4 192 -#define TRUE 1 -#define FALSE 0 +#define TRUE 1 +#define FALSE 0 #define APCI3200_AI_EOSIRQ 16 #define APCI3200_AI_EOS 20 #define APCI3200_AI_CHAN_ID 24 @@ -72,38 +104,95 @@ comedi_lrange range_apci3200_ai={ 8, { //ADDIDATA Enable Disable #define ADDIDATA_ENABLE 1 #define ADDIDATA_DISABLE 0 - -typedef struct - { - ULONG ul_NumberOfValue; - ULONG *pul_ResistanceValue; - ULONG *pul_TemperatureValue; - }str_ADDIDATA_RTDStruct,*pstr_ADDIDATA_RTDStruct; + +//BEGIN JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values +#define MAX_MODULE 4 +//END JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + +typedef struct + { + ULONG ul_NumberOfValue; + ULONG *pul_ResistanceValue; + ULONG *pul_TemperatureValue; + }str_ADDIDATA_RTDStruct,*pstr_ADDIDATA_RTDStruct; + +//BEGIN JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values +typedef struct + { + // Begin JK 05/08/2003 change for Linux + unsigned long ul_CurrentSourceCJC; + unsigned long ul_CurrentSource [5]; + // End JK 05/08/2003 change for Linux + + // Begin CG 15/02/02 Rev 1.0 -> Rev 1.1 : Add Header Type 1 + unsigned long ul_GainFactor [8]; // Gain Factor + unsigned int w_GainValue [10]; + // End CG 15/02/02 Rev 1.0 -> Rev 1.1 : Add Header Type 1 + }str_Module; +//END JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + +//BEGIN JK 06.07.04: Management of sevrals boards +typedef struct + { + INT i_CJCAvailable; + INT i_CJCPolarity; + INT i_CJCGain; + INT i_InterruptFlag; + INT i_ADDIDATAPolarity; + INT i_ADDIDATAGain; + INT i_AutoCalibration; + INT i_ADDIDATAConversionTime; + INT i_ADDIDATAConversionTimeUnit; + INT i_ADDIDATAType; + INT i_ChannelNo; + INT i_ChannelCount; + INT i_ScanType; + INT i_FirstChannel; + INT i_LastChannel; + INT i_Sum; + INT i_Offset; + UINT ui_Channel_num; + INT i_Count; + INT i_Initialised; + //UINT ui_InterruptChannelValue[96]; //Buffer + UINT ui_InterruptChannelValue[144]; //Buffer + BYTE b_StructInitialized; + //Begin JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 + lsampl_t ui_ScanValueArray [7+12]; // 7 is the maximal number of channels + //End JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 + + //Begin JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + INT i_ConnectionType; + INT i_NbrOfModule; + str_Module s_Module [MAX_MODULE]; + //End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + } str_BoardInfos; +//END JK 06.07.04: Management of sevrals boards // Hardware Layer functions for Apci3200 //AI - + INT i_APCI3200_ConfigAnalogInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); INT i_APCI3200_ReadAnalogInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); -INT i_APCI3200_InsnWriteReleaseAnalogInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); -INT i_APCI3200_InsnBits_AnalogInput_Test(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); -INT i_APCI3200_StopCyclicAcquisition(comedi_device *dev,comedi_subdevice *s); -INT i_APCI3200_InterruptHandleEos(comedi_device *dev); -INT i_APCI3200_CommandTestAnalogInput(comedi_device *dev,comedi_subdevice *s,comedi_cmd *cmd) ; -INT i_APCI3200_CommandAnalogInput(comedi_device *dev,comedi_subdevice *s); -INT i_APCI3200_ReadDigitalInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +INT i_APCI3200_InsnWriteReleaseAnalogInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +INT i_APCI3200_InsnBits_AnalogInput_Test(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +INT i_APCI3200_StopCyclicAcquisition(comedi_device *dev,comedi_subdevice *s); +INT i_APCI3200_InterruptHandleEos(comedi_device *dev); +INT i_APCI3200_CommandTestAnalogInput(comedi_device *dev,comedi_subdevice *s,comedi_cmd *cmd) ; +INT i_APCI3200_CommandAnalogInput(comedi_device *dev,comedi_subdevice *s); +INT i_APCI3200_ReadDigitalInput(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); //Interrupt void v_APCI3200_Interrupt(int irq, void *d, struct pt_regs *regs) ; int i_APCI3200_InterruptHandleEos(comedi_device *dev); //Reset functions INT i_APCI3200_Reset(comedi_device *dev); - - + + int i_APCI3200_ReadCJCCalOffset(comedi_device *dev,lsampl_t *data); int i_APCI3200_ReadCJCValue(comedi_device *dev,lsampl_t *data); int i_APCI3200_ReadCalibrationGainValue(comedi_device *dev,UINT *data); -int i_APCI3200_ReadCalibrationOffsetValue(comedi_device *dev,UINT *data); -int i_APCI3200_Read1AnalogInputChannel(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +int i_APCI3200_ReadCalibrationOffsetValue(comedi_device *dev,UINT *data); +int i_APCI3200_Read1AnalogInputChannel(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); int i_APCI3200_ReadCJCCalGain(comedi_device *dev,lsampl_t *data); diff --git a/comedi/drivers/addi-data/hwdrv_apci3501.c b/comedi/drivers/addi-data/hwdrv_apci3501.c index a5850292..eed480e1 100644 --- a/comedi/drivers/addi-data/hwdrv_apci3501.c +++ b/comedi/drivers/addi-data/hwdrv_apci3501.c @@ -1,14 +1,38 @@ -/* +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ +/*. + +-----------------------------------------------------------------------+ | (C) ADDI-DATA GmbH Dieselstraße 3 D-77833 Ottersweier | +-----------------------------------------------------------------------+ | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | +-------------------------------+---------------------------------------+ - | Project : 13Card Linux Driver | Compiler : GCC | - | Module name : hwdrv_apci3501.c| Version : 2.96 | + | Project : APCI-3501 | Compiler : GCC | + | Module name : hwdrv_apci3501.c| Version : 2.96 | +-------------------------------+---------------------------------------+ - | Author : Shitalkumar S Chavan | Date : 10.12.2001 | + | Project manager: Eric Stolz | Date : 02/12/2002 | +-------------------------------+---------------------------------------+ | Description : Hardware Layer Acces For APCI-3501 | +-----------------------------------------------------------------------+ diff --git a/comedi/drivers/addi-data/hwdrv_apci3501.h b/comedi/drivers/addi-data/hwdrv_apci3501.h index 957abae5..1797eb6b 100644 --- a/comedi/drivers/addi-data/hwdrv_apci3501.h +++ b/comedi/drivers/addi-data/hwdrv_apci3501.h @@ -1,3 +1,26 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ // Card Specific information #define APCI3501_BOARD_VENDOR_ID 0x15B8 #define APCI3501_ADDRESS_RANGE 255 diff --git a/comedi/drivers/addi-data/hwdrv_apci3xxx.c b/comedi/drivers/addi-data/hwdrv_apci3xxx.c new file mode 100755 index 00000000..d1705d04 --- /dev/null +++ b/comedi/drivers/addi-data/hwdrv_apci3xxx.c @@ -0,0 +1,1771 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + + + +@endverbatim +*/ +/* + +-----------------------------------------------------------------------+ + | (C) ADDI-DATA GmbH Dieselstrasse 3 D-77833 Ottersweier | + +-----------------------------------------------------------------------+ + | Tel : +49 (0) 7223/9493-0 | email : info@addi-data.com | + | Fax : +49 (0) 7223/9493-92 | Internet : http://www.addi-data.com | + +-----------------------------------------------------------------------+ + | Project : APCI-3XXX | Compiler : GCC | + | Module name : hwdrv_apci3xxx.c| Version : 2.96 | + +-------------------------------+---------------------------------------+ + | Project manager: S. Weber | Date : 15/09/2005 | + +-----------------------------------------------------------------------+ + | Description :APCI3XXX Module. Hardware abstraction Layer for APCI3XXX| + +-----------------------------------------------------------------------+ + | UPDATE'S | + +-----------------------------------------------------------------------+ + | Date | Author | Description of updates | + +----------+-----------+------------------------------------------------+ + | | | | + | | | | + +----------+-----------+------------------------------------------------+ +*/ + + +#include "hwdrv_apci3xxx.h" + + +/* ++----------------------------------------------------------------------------+ +| ANALOG INPUT FUNCTIONS | ++----------------------------------------------------------------------------+ +*/ + +/* ++----------------------------------------------------------------------------+ +| Function Name : INT i_APCI3XXX_TestConversionStarted | +| (comedi_device *dev) | ++----------------------------------------------------------------------------+ +| Task Test if any conversion started | ++----------------------------------------------------------------------------+ +| Input Parameters : - | ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value : 0 : Conversion not started | +| 1 : Conversion started | ++----------------------------------------------------------------------------+ +*/ + +int i_APCI3XXX_TestConversionStarted (comedi_device *dev) + { + if ((readl ((void *) (devpriv->dw_AiBase + 8)) & 0x80000UL) == 0x80000UL) + { + return (1); + } + else + { + return (0); + } + } + + +/* ++----------------------------------------------------------------------------+ +| Function Name : INT i_APCI3XXX_AnalogInputConfigOperatingMode | +| (comedi_device *dev, | +| comedi_subdevice *s, | +| comedi_insn *insn, | +| lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task Converting mode and convert time selection | ++----------------------------------------------------------------------------+ +| Input Parameters : b_SingleDiff = (BYTE) data[1]; | +| b_TimeBase = (BYTE) data[2]; (0: ns, 1:micros 2:ms)| +| dw_ReloadValue = (DWORD) data[3]; | +| ........ | ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value :>0 : No error | +| -1 : Single/Diff selection error | +| -2 : Convert time base unity selection error | +| -3 : Convert time value selection error | +| -10: Any conversion started | +| .... | +| -100 : Config command error | +| -101 : Data size error | ++----------------------------------------------------------------------------+ +*/ + +int i_APCI3XXX_AnalogInputConfigOperatingMode (comedi_device *dev, + comedi_subdevice *s, + comedi_insn *insn, + lsampl_t *data) + { + INT i_ReturnValue = insn->n; + BYTE b_TimeBase = 0; + BYTE b_SingleDiff = 0; + DWORD dw_ReloadValue = 0; + DWORD dw_TestReloadValue = 0; + + /************************/ + /* Test the buffer size */ + /************************/ + + if (insn->n == 4) + { + /****************************/ + /* Get the Singel/Diff flag */ + /****************************/ + + b_SingleDiff = (BYTE) data[1]; + + /****************************/ + /* Get the time base unitiy */ + /****************************/ + + b_TimeBase = (BYTE) data[2]; + + /*************************************/ + /* Get the convert time reload value */ + /*************************************/ + + dw_ReloadValue = (DWORD) data[3]; + + /**********************/ + /* Test the time base */ + /**********************/ + + if ((devpriv->ps_BoardInfo->b_AvailableConvertUnit & (1 << b_TimeBase)) != 0) + { + /*******************************/ + /* Test the convert time value */ + /*******************************/ + + if ((dw_ReloadValue >= 0) && (dw_ReloadValue <= 65535)) + { + dw_TestReloadValue = dw_ReloadValue; + + if (b_TimeBase == 1) + { + dw_TestReloadValue = dw_TestReloadValue * 1000UL; + } + if (b_TimeBase == 2) + { + dw_TestReloadValue = dw_TestReloadValue * 1000000UL; + } + + /*******************************/ + /* Test the convert time value */ + /*******************************/ + + if (dw_TestReloadValue >= devpriv->ps_BoardInfo->ui_MinAcquisitiontimeNs) + { + if ((b_SingleDiff == APCI3XXX_SINGLE) || (b_SingleDiff == APCI3XXX_DIFF)) + { + if (((b_SingleDiff == APCI3XXX_SINGLE) && (devpriv->ps_BoardInfo->i_NbrAiChannel == 0)) || + ((b_SingleDiff == APCI3XXX_DIFF) && (devpriv->ps_BoardInfo->i_NbrAiChannelDiff == 0))) + { + /*******************************/ + /* Single/Diff selection error */ + /*******************************/ + + printk("Single/Diff selection error\n"); + i_ReturnValue = -1; + } + else + { + /**********************************/ + /* Test if conversion not started */ + /**********************************/ + + if (i_APCI3XXX_TestConversionStarted (dev) == 0) + { + devpriv->ui_EocEosConversionTime = (UINT) dw_ReloadValue; + devpriv->b_EocEosConversionTimeBase = b_TimeBase; + devpriv->b_SingelDiff = b_SingleDiff; + devpriv->b_AiInitialisation = 1; + + + /*******************************/ + /* Set the convert timing unit */ + /*******************************/ + + writel((DWORD) b_TimeBase, (void *) (devpriv->dw_AiBase + 36)); + + /**************************/ + /* Set the convert timing */ + /*************************/ + + writel(dw_ReloadValue, (void *) (devpriv->dw_AiBase + 32)); + } + else + { + /**************************/ + /* Any conversion started */ + /**************************/ + + printk("Any conversion started\n"); + i_ReturnValue = -10; + } + } + } + else + { + /*******************************/ + /* Single/Diff selection error */ + /*******************************/ + + printk("Single/Diff selection error\n"); + i_ReturnValue = -1; + } + } + else + { + /************************/ + /* Time selection error */ + /************************/ + + printk("Convert time value selection error\n"); + i_ReturnValue = -3; + } + } + else + { + /************************/ + /* Time selection error */ + /************************/ + + printk("Convert time value selection error\n"); + i_ReturnValue = -3; + } + } + else + { + /*****************************/ + /* Time base selection error */ + /*****************************/ + + printk("Convert time base unity selection error\n"); + i_ReturnValue = -2; + } + } + else + { + /*******************/ + /* Data size error */ + /*******************/ + + printk("Buffer size error\n"); + i_ReturnValue = -101; + } + + return (i_ReturnValue); + } + + + + + + + + +/* ++----------------------------------------------------------------------------+ +| Function Name : INT i_APCI3XXX_InsnConfigAnalogInput | +| (comedi_device *dev, | +| comedi_subdevice *s, | +| comedi_insn *insn, | +| lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task Converting mode and convert time selection | ++----------------------------------------------------------------------------+ +| Input Parameters : b_ConvertMode = (BYTE) data[0]; | +| b_TimeBase = (BYTE) data[1]; (0: ns, 1:micros 2:ms)| +| dw_ReloadValue = (DWORD) data[2]; | +| ........ | ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value :>0: No error | +| .... | +| -100 : Config command error | +| -101 : Data size error | ++----------------------------------------------------------------------------+ +*/ + + +int i_APCI3XXX_InsnConfigAnalogInput(comedi_device *dev, + comedi_subdevice *s, + comedi_insn *insn, + lsampl_t *data) + { + INT i_ReturnValue = insn->n; + + /************************/ + /* Test the buffer size */ + /************************/ + + if (insn->n >= 1) + { + switch ((BYTE) data[0]) + { + case APCI3XXX_CONFIGURATION: + i_ReturnValue = i_APCI3XXX_AnalogInputConfigOperatingMode (dev, s, insn, data) ; + break; + + default: + i_ReturnValue = -100; + printk("Config command error %d\n", data[0]); + break; + } + } + else + { + /*******************/ + /* Data size error */ + /*******************/ + + printk("Buffer size error\n"); + i_ReturnValue = -101; + } + + return (i_ReturnValue); + } + + +/* ++----------------------------------------------------------------------------+ +| Function Name : INT i_APCI3XXX_InsnReadAnalogInput | +| (comedi_device *dev, | +| comedi_subdevice *s, | +| comedi_insn *insn, | +| lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task Read 1 analog input | ++----------------------------------------------------------------------------+ +| Input Parameters : b_Range = CR_RANGE(insn->chanspec); | +| b_Channel = CR_CHAN(insn->chanspec); | +| dw_NbrOfAcquisition = insn->n; | ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value :>0: No error | +| -3 : Channel selection error | +| -4 : Configuration selelection error | +| -10: Any conversion started | +| .... | +| -100 : Config command error | +| -101 : Data size error | ++----------------------------------------------------------------------------+ +*/ + +int i_APCI3XXX_InsnReadAnalogInput (comedi_device *dev, + comedi_subdevice *s, + comedi_insn *insn, + lsampl_t *data) + { + INT i_ReturnValue = insn->n; + BYTE b_Configuration = (BYTE) CR_RANGE(insn->chanspec); + BYTE b_Channel = (BYTE) CR_CHAN(insn->chanspec); + DWORD dw_Temp = 0; + DWORD dw_Configuration = 0; + DWORD dw_AcquisitionCpt = 0; + BYTE b_Interrupt = 0; + + /*************************************/ + /* Test if operating mode configured */ + /*************************************/ + + if (devpriv->b_AiInitialisation) + { + /***************************/ + /* Test the channel number */ + /***************************/ + + if (((b_Channel < devpriv->ps_BoardInfo->i_NbrAiChannel) && (devpriv->b_SingelDiff == APCI3XXX_SINGLE)) || + ((b_Channel < devpriv->ps_BoardInfo->i_NbrAiChannelDiff) && (devpriv->b_SingelDiff == APCI3XXX_DIFF))) + { + /**********************************/ + /* Test the channel configuration */ + /**********************************/ + + if (b_Configuration > 7) + { + /***************************/ + /* Channel not initialised */ + /***************************/ + + i_ReturnValue = -4; + printk ("Channel %d range %d selection error\n", b_Channel, b_Configuration); + } + } + else + { + /***************************/ + /* Channel selection error */ + /***************************/ + + i_ReturnValue = -3; + printk ("Channel %d selection error\n", b_Channel); + } + + /**************************/ + /* Test if no error occur */ + /**************************/ + + if (i_ReturnValue >= 0) + { + /************************/ + /* Test the buffer size */ + /************************/ + + if ((b_Interrupt != 0) || ((b_Interrupt == 0) && (insn->n >= 1))) + { + /**********************************/ + /* Test if conversion not started */ + /**********************************/ + + if (i_APCI3XXX_TestConversionStarted (dev) == 0) + { + /******************/ + /* Clear the FIFO */ + /******************/ + + writel(0x10000UL, (void *) (devpriv->dw_AiBase + 12)); + + /*******************************/ + /* Get and save the delay mode */ + /*******************************/ + + dw_Temp = readl((void *) (devpriv->dw_AiBase + 4)); + dw_Temp = dw_Temp & 0xFFFFFEF0UL; + + /***********************************/ + /* Channel configuration selection */ + /***********************************/ + + writel(dw_Temp, (void *) (devpriv->dw_AiBase + 4)); + + /**************************/ + /* Make the configuration */ + /**************************/ + + dw_Configuration = (b_Configuration & 3) | + ((DWORD) (b_Configuration >> 2) << 6) | + ((DWORD) devpriv->b_SingelDiff << 7); + + /***************************/ + /* Write the configuration */ + /***************************/ + + writel(dw_Configuration, (void *) (devpriv->dw_AiBase + 0)); + + /*********************/ + /* Channel selection */ + /*********************/ + + writel(dw_Temp | 0x100UL, (void *) (devpriv->dw_AiBase + 4)); + writel((DWORD) b_Channel, (void *) (devpriv->dw_AiBase + 0)); + + /***********************/ + /* Restaure delay mode */ + /***********************/ + + writel(dw_Temp, (void *) (devpriv->dw_AiBase + 4)); + + /***********************************/ + /* Set the number of sequence to 1 */ + /***********************************/ + + writel(1, (void *) (devpriv->dw_AiBase + 48)); + + /***************************/ + /* Save the interrupt flag */ + /***************************/ + + devpriv->b_EocEosInterrupt = b_Interrupt; + + /*******************************/ + /* Save the number of channels */ + /*******************************/ + + devpriv->ui_AiNbrofChannels = 1; + + /******************************/ + /* Test if interrupt not used */ + /******************************/ + + if (b_Interrupt == 0) + { + for (dw_AcquisitionCpt = 0; dw_AcquisitionCpt < insn->n; dw_AcquisitionCpt ++) + { + /************************/ + /* Start the conversion */ + /************************/ + + writel(0x80000UL, (void *) (devpriv->dw_AiBase + 8)); + + /****************/ + /* Wait the EOS */ + /****************/ + + do + { + dw_Temp = readl((void *) (devpriv->dw_AiBase + 20)); + dw_Temp = dw_Temp & 1; + } + while (dw_Temp != 1); + + /*************************/ + /* Read the analog value */ + /*************************/ + + data[dw_AcquisitionCpt] = (lsampl_t) readl((void *) (devpriv->dw_AiBase + 28)); + } + } + else + { + /************************/ + /* Start the conversion */ + /************************/ + + writel(0x180000UL, (void *) (devpriv->dw_AiBase + 8)); + } + } + else + { + /**************************/ + /* Any conversion started */ + /**************************/ + + printk("Any conversion started\n"); + i_ReturnValue = -10; + } + } + else + { + /*******************/ + /* Data size error */ + /*******************/ + + printk("Buffer size error\n"); + i_ReturnValue = -101; + } + } + } + else + { + /***************************/ + /* Channel selection error */ + /***************************/ + + printk("Operating mode not configured\n"); + i_ReturnValue = -1; + } + + return (i_ReturnValue); + } + + + +/* ++----------------------------------------------------------------------------+ +| Function name : void v_APCI3XXX_Interrupt (int irq, | +| void *d, | +| struct pt_regs *regs) | ++----------------------------------------------------------------------------+ +| Task :Interrupt handler for APCI3XXX | +| When interrupt occurs this gets called. | +| First it finds which interrupt has been generated and | +| handles corresponding interrupt | ++----------------------------------------------------------------------------+ +| Input Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value : - | ++----------------------------------------------------------------------------+ +*/ + + +void v_APCI3XXX_Interrupt(int irq, void *d, struct pt_regs *regs) + { + comedi_device *dev = d; + BYTE b_CopyCpt = 0; + DWORD dw_Status = 0; + + + /***************************/ + /* Test if interrupt occur */ + /***************************/ + + if (((dw_Status = readl ((void *) (devpriv->dw_AiBase + 16))) & 0x2UL) == 0x2UL) + { + /***********************/ + /* Reset the interrupt */ + /***********************/ + + writel(dw_Status, (void *) (devpriv->dw_AiBase + 16)); + + /*****************************/ + /* Test if interrupt enabled */ + /*****************************/ + + if (devpriv->b_EocEosInterrupt == 1) + { + /********************************/ + /* Read all analog inputs value */ + /********************************/ + + for (b_CopyCpt = 0; b_CopyCpt < devpriv->ui_AiNbrofChannels; b_CopyCpt ++) + { + devpriv->ui_AiReadData[b_CopyCpt] = (UINT) readl((void *) (devpriv->dw_AiBase + 28)); + } + + /**************************/ + /* Set the interrupt flag */ + /**************************/ + + devpriv->b_EocEosInterrupt = 2; + + /**********************************************/ + /* Send a signal to from kernel to user space */ + /**********************************************/ + + send_sig(SIGIO,devpriv->tsk_Current,0); + } + } + } + + + +/* ++----------------------------------------------------------------------------+ +| ANALOG OUTPUT SUBDEVICE | ++----------------------------------------------------------------------------+ +*/ + + +/* ++----------------------------------------------------------------------------+ +| Function Name : INT i_APCI3XXX_InsnWriteAnalogOutput | +| (comedi_device *dev, | +| comedi_subdevice *s, | +| comedi_insn *insn, | +| lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task Read 1 analog input | ++----------------------------------------------------------------------------+ +| Input Parameters : b_Range = CR_RANGE(insn->chanspec); | +| b_Channel = CR_CHAN(insn->chanspec); | +| data[0] = analog value; | ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value :>0: No error | +| -3 : Channel selection error | +| -4 : Configuration selelection error | +| .... | +| -101 : Data size error | ++----------------------------------------------------------------------------+ +*/ + +int i_APCI3XXX_InsnWriteAnalogOutput (comedi_device *dev, + comedi_subdevice *s, + comedi_insn *insn, + lsampl_t *data) + { + BYTE b_Range = (BYTE) CR_RANGE(insn->chanspec); + BYTE b_Channel = (BYTE) CR_CHAN (insn->chanspec); + DWORD dw_Status = 0; + INT i_ReturnValue = insn->n; + + + /************************/ + /* Test the buffer size */ + /************************/ + + if (insn->n >= 1) + { + /***************************/ + /* Test the channel number */ + /***************************/ + + if (b_Channel < devpriv->ps_BoardInfo->i_NbrAoChannel) + { + /**********************************/ + /* Test the channel configuration */ + /**********************************/ + + if (b_Range < 2) + { + /***************************/ + /* Set the range selection */ + /***************************/ + + writel(b_Range, (void *) (devpriv->dw_AiBase + 96)); + + /**************************************************/ + /* Write the analog value to the selected channel */ + /**************************************************/ + + writel((data[0] << 8) | b_Channel, (void *) (devpriv->dw_AiBase + 100)); + + /****************************/ + /* Wait the end of transfer */ + /****************************/ + + do + { + dw_Status = readl ((void *) (devpriv->dw_AiBase + 96)); + } + while ((dw_Status & 0x100) != 0x100); + } + else + { + /***************************/ + /* Channel not initialised */ + /***************************/ + + i_ReturnValue = -4; + printk ("Channel %d range %d selection error\n", b_Channel, b_Range); + } + } + else + { + /***************************/ + /* Channel selection error */ + /***************************/ + + i_ReturnValue = -3; + printk ("Channel %d selection error\n", b_Channel); + } + } + else + { + /*******************/ + /* Data size error */ + /*******************/ + + printk("Buffer size error\n"); + i_ReturnValue = -101; + } + + return (i_ReturnValue); + } + + + +/* ++----------------------------------------------------------------------------+ +| TTL FUNCTIONS | ++----------------------------------------------------------------------------+ +*/ + +/* ++----------------------------------------------------------------------------+ +| Function Name : INT i_APCI3XXX_InsnConfigInitTTLIO | +| (comedi_device *dev, | +| comedi_subdevice *s, | +| comedi_insn *insn, | +| lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task You must calling this function be | +| for you call any other function witch access of TTL. | +| APCI3XXX_TTL_INIT_DIRECTION_PORT2(user inputs for direction)| ++----------------------------------------------------------------------------+ +| Input Parameters : b_InitType = (BYTE) data[0]; | +| b_Port2Mode = (BYTE) data[1]; | ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value :>0: No error | +| -1: Port 2 mode selection is wrong | +| .... | +| -100 : Config command error | +| -101 : Data size error | ++----------------------------------------------------------------------------+ +*/ + + +int i_APCI3XXX_InsnConfigInitTTLIO(comedi_device *dev, + comedi_subdevice *s, + comedi_insn *insn, + lsampl_t *data) + { + INT i_ReturnValue = insn->n; + BYTE b_Command = 0; + + /************************/ + /* Test the buffer size */ + /************************/ + + if (insn->n >= 1) + { + /*******************/ + /* Get the command */ + /* *****************/ + + b_Command = (BYTE) data[0]; + + /********************/ + /* Test the command */ + /********************/ + + if (b_Command == APCI3XXX_TTL_INIT_DIRECTION_PORT2) + { + /***************************************/ + /* Test the initialisation buffer size */ + /***************************************/ + + if ((b_Command == APCI3XXX_TTL_INIT_DIRECTION_PORT2) && (insn->n != 2)) + { + /*******************/ + /* Data size error */ + /*******************/ + + printk("Buffer size error\n"); + i_ReturnValue = -101; + } + } + else + { + /************************/ + /* Config command error */ + /************************/ + + printk("Command selection error\n"); + i_ReturnValue = -100; + } + } + else + { + /*******************/ + /* Data size error */ + /*******************/ + + printk("Buffer size error\n"); + i_ReturnValue = -101; + } + + + /*********************************************************************************/ + /* Test if no error occur and APCI3XXX_TTL_INIT_DIRECTION_PORT2 command selected */ + /*********************************************************************************/ + + if ((i_ReturnValue >= 0) && (b_Command == APCI3XXX_TTL_INIT_DIRECTION_PORT2)) + { + /**********************/ + /* Test the direction */ + /**********************/ + + if ((data[1] == 0) || (data[1] == 0xFF)) + { + /**************************/ + /* Save the configuration */ + /**************************/ + + devpriv->ul_TTLPortConfiguration[0] = devpriv->ul_TTLPortConfiguration[0] | data[1]; + } + else + { + /************************/ + /* Port direction error */ + /************************/ + + printk("Port 2 direction selection error\n"); + i_ReturnValue = - 1; + } + } + + /**************************/ + /* Test if no error occur */ + /**************************/ + + if (i_ReturnValue >= 0) + { + /***********************************/ + /* Test if TTL port initilaisation */ + /***********************************/ + + if (b_Command == APCI3XXX_TTL_INIT_DIRECTION_PORT2) + { + /*************************/ + /* Set the configuration */ + /*************************/ + + outl(data[1],devpriv->iobase + 224); + } + } + + return (i_ReturnValue); + } + + +/* ++----------------------------------------------------------------------------+ +| TTL INPUT FUNCTIONS | ++----------------------------------------------------------------------------+ +*/ + + +/* ++----------------------------------------------------------------------------+ +| Function Name : INT i_APCI3XXX_InsnBitsTTLIO | +| (comedi_device *dev, | +| comedi_subdevice *s, | +| comedi_insn *insn, | +| lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Write the selected output mask and read the status from| +| all TTL channles | ++----------------------------------------------------------------------------+ +| Input Parameters : dw_ChannelMask = data [0]; | +| dw_BitMask = data [1]; | ++----------------------------------------------------------------------------+ +| Output Parameters : data[1] : All TTL channles states | ++----------------------------------------------------------------------------+ +| Return Value : >0 : No error | +| -4 : Channel mask error | +| -101 : Data size error | ++----------------------------------------------------------------------------+ +*/ + + +int i_APCI3XXX_InsnBitsTTLIO (comedi_device *dev, + comedi_subdevice *s, + comedi_insn *insn, + lsampl_t *data) + { + INT i_ReturnValue = insn->n; + BYTE b_ChannelCpt = 0; + DWORD dw_ChannelMask = 0; + DWORD dw_BitMask = 0; + DWORD dw_Status = 0; + + /************************/ + /* Test the buffer size */ + /************************/ + + if (insn->n >= 2) + { + /*******************************/ + /* Get the channe and bit mask */ + /*******************************/ + + dw_ChannelMask = data [0]; + dw_BitMask = data [1]; + + /*************************/ + /* Test the channel mask */ + /*************************/ + + if (((dw_ChannelMask & 0XFF00FF00) == 0) && + (((devpriv->ul_TTLPortConfiguration[0] & 0xFF) == 0xFF) || + (((devpriv->ul_TTLPortConfiguration[0] & 0xFF) == 0) && ((dw_ChannelMask & 0XFF0000) == 0)))) + { + /*********************************/ + /* Test if set/reset any channel */ + /*********************************/ + + if (dw_ChannelMask) + { + /****************************************/ + /* Test if set/rest any port 0 channels */ + /****************************************/ + + if (dw_ChannelMask & 0xFF) + { + /*******************************************/ + /* Read port 0 (first digital output port) */ + /*******************************************/ + + dw_Status = inl(devpriv->iobase + 80); + + for (b_ChannelCpt = 0; b_ChannelCpt < 8; b_ChannelCpt ++) + { + if ((dw_ChannelMask >> b_ChannelCpt) & 1) + { + dw_Status = (dw_Status & (0xFF - (1 << b_ChannelCpt))) | (dw_BitMask & (1 << b_ChannelCpt)); + } + } + + outl (dw_Status, devpriv->iobase + 80); + } + + /****************************************/ + /* Test if set/rest any port 2 channels */ + /****************************************/ + + if (dw_ChannelMask & 0xFF0000) + { + dw_BitMask = dw_BitMask >> 16; + dw_ChannelMask = dw_ChannelMask >> 16; + + /********************************************/ + /* Read port 2 (second digital output port) */ + /********************************************/ + + dw_Status = inl(devpriv->iobase + 112); + + for (b_ChannelCpt = 0; b_ChannelCpt < 8; b_ChannelCpt ++) + { + if ((dw_ChannelMask >> b_ChannelCpt) & 1) + { + dw_Status = (dw_Status & (0xFF - (1 << b_ChannelCpt))) | (dw_BitMask & (1 << b_ChannelCpt)); + } + } + + outl (dw_Status, devpriv->iobase + 112); + } + } + + /*******************************************/ + /* Read port 0 (first digital output port) */ + /*******************************************/ + + data [1] = inl(devpriv->iobase + 80); + + /******************************************/ + /* Read port 1 (first digital input port) */ + /******************************************/ + + data [1] = data [1] | (inl(devpriv->iobase + 64) << 8); + + /************************/ + /* Test if port 2 input */ + /************************/ + + if ((devpriv->ul_TTLPortConfiguration[0] & 0xFF) == 0) + { + data [1] = data [1] | (inl(devpriv->iobase + 96) << 16); + } + else + { + data [1] = data [1] | (inl(devpriv->iobase + 112) << 16); + } + } + else + { + /************************/ + /* Config command error */ + /************************/ + + printk("Channel mask error\n"); + i_ReturnValue = -4; + } + } + else + { + /*******************/ + /* Data size error */ + /*******************/ + + printk("Buffer size error\n"); + i_ReturnValue = -101; + } + + + return (i_ReturnValue); + } + + +/* ++----------------------------------------------------------------------------+ +| Function Name : INT i_APCI3XXX_InsnReadTTLIO | +| (comedi_device *dev, | +| comedi_subdevice *s, | +| comedi_insn *insn, | +| lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Read the status from selected channel | ++----------------------------------------------------------------------------+ +| Input Parameters : b_Channel = CR_CHAN(insn->chanspec) | ++----------------------------------------------------------------------------+ +| Output Parameters : data[0] : Selected TTL channel state | ++----------------------------------------------------------------------------+ +| Return Value : 0 : No error | +| -3 : Channel selection error | +| -101 : Data size error | ++----------------------------------------------------------------------------+ +*/ + +int i_APCI3XXX_InsnReadTTLIO (comedi_device *dev, + comedi_subdevice *s, + comedi_insn *insn, + lsampl_t *data) + { + BYTE b_Channel = (BYTE) CR_CHAN(insn->chanspec); + INT i_ReturnValue = insn->n; + lsampl_t * pls_ReadData = data; + + /************************/ + /* Test the buffer size */ + /************************/ + + if (insn->n >= 1) + { + /***********************/ + /* Test if read port 0 */ + /***********************/ + + if (b_Channel < 8) + { + /*******************************************/ + /* Read port 0 (first digital output port) */ + /*******************************************/ + + pls_ReadData [0] = inl(devpriv->iobase + 80); + pls_ReadData [0] = (pls_ReadData [0] >> b_Channel) & 1; + } + else + { + /***********************/ + /* Test if read port 1 */ + /***********************/ + + if ((b_Channel > 7) && (b_Channel < 16)) + { + /******************************************/ + /* Read port 1 (first digital input port) */ + /******************************************/ + + pls_ReadData [0] = inl(devpriv->iobase + 64); + pls_ReadData [0] = (pls_ReadData [0] >> (b_Channel - 8)) & 1; + } + else + { + /***********************/ + /* Test if read port 2 */ + /***********************/ + + if ((b_Channel > 15) && (b_Channel < 24)) + { + /************************/ + /* Test if port 2 input */ + /************************/ + + if ((devpriv->ul_TTLPortConfiguration[0] & 0xFF) == 0) + { + pls_ReadData [0] = inl(devpriv->iobase + 96); + pls_ReadData [0] = (pls_ReadData [0] >> (b_Channel - 16)) & 1; + } + else + { + pls_ReadData [0] = inl(devpriv->iobase + 112); + pls_ReadData [0] = (pls_ReadData [0] >> (b_Channel - 16)) & 1; + } + } + else + { + /***************************/ + /* Channel selection error */ + /***************************/ + + i_ReturnValue = -3; + printk ("Channel %d selection error\n", b_Channel); + } + } + } + } + else + { + /*******************/ + /* Data size error */ + /*******************/ + + printk("Buffer size error\n"); + i_ReturnValue = -101; + } + + return (i_ReturnValue); + } + +/* ++----------------------------------------------------------------------------+ +| TTL OUTPUT FUNCTIONS | ++----------------------------------------------------------------------------+ +*/ + +/* ++----------------------------------------------------------------------------+ +| Function Name : INT i_APCI3XXX_InsnWriteTTLIO | +| (comedi_device *dev, | +| comedi_subdevice *s, | +| comedi_insn *insn, | +| lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Set the state from TTL output channel | ++----------------------------------------------------------------------------+ +| Input Parameters : b_Channel = CR_CHAN(insn->chanspec) | +| b_State = data [0] | ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value : 0 : No error | +| -3 : Channel selection error | +| -101 : Data size error | ++----------------------------------------------------------------------------+ +*/ + + +int i_APCI3XXX_InsnWriteTTLIO (comedi_device *dev, + comedi_subdevice *s, + comedi_insn *insn, + lsampl_t *data) + { + INT i_ReturnValue = insn->n; + BYTE b_Channel = (BYTE) CR_CHAN(insn->chanspec); + BYTE b_State = 0; + DWORD dw_Status = 0; + + /************************/ + /* Test the buffer size */ + /************************/ + + if (insn->n >= 1) + { + b_State = (BYTE) data [0]; + + /***********************/ + /* Test if read port 0 */ + /***********************/ + + if (b_Channel < 8) + { + /*****************************************************************************/ + /* Read port 0 (first digital output port) and set/reset the selcted channel */ + /*****************************************************************************/ + + dw_Status = inl(devpriv->iobase + 80); + dw_Status = (dw_Status & (0xFF - (1 << b_Channel))) | ((b_State & 1) << b_Channel); + outl(dw_Status, devpriv->iobase + 80); + } + else + { + /***********************/ + /* Test if read port 2 */ + /***********************/ + + if ((b_Channel > 15) && (b_Channel < 24)) + { + /*************************/ + /* Test if port 2 output */ + /*************************/ + + if ((devpriv->ul_TTLPortConfiguration[0] & 0xFF) == 0xFF) + { + /*****************************************************************************/ + /* Read port 2 (first digital output port) and set/reset the selcted channel */ + /*****************************************************************************/ + + dw_Status = inl(devpriv->iobase + 112); + dw_Status = (dw_Status & (0xFF - (1 << (b_Channel - 16)))) | ((b_State & 1) << (b_Channel - 16)); + outl(dw_Status, devpriv->iobase + 112); + } + else + { + /***************************/ + /* Channel selection error */ + /***************************/ + + i_ReturnValue = -3; + printk ("Channel %d selection error\n", b_Channel); + } + } + else + { + /***************************/ + /* Channel selection error */ + /***************************/ + + i_ReturnValue = -3; + printk ("Channel %d selection error\n", b_Channel); + } + } + } + else + { + /*******************/ + /* Data size error */ + /*******************/ + + printk("Buffer size error\n"); + i_ReturnValue = -101; + } + + return (i_ReturnValue); + } + +/* ++----------------------------------------------------------------------------+ +| DIGITAL INPUT SUBDEVICE | ++----------------------------------------------------------------------------+ +*/ + + +/* ++----------------------------------------------------------------------------+ +| Function name :int i_APCI3XXX_InsnReadDigitalInput | +| (comedi_device *dev, | +| comedi_subdevice *s, | +| comedi_insn *insn, | +| lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Reads the value of the specified Digital input channel | ++----------------------------------------------------------------------------+ +| Input Parameters : b_Channel = CR_CHAN(insn->chanspec) (0 to 3) | ++----------------------------------------------------------------------------+ +| Output Parameters : data[0] : Channel value | ++----------------------------------------------------------------------------+ +| Return Value : 0 : No error | +| -3 : Channel selection error | +| -101 : Data size error | ++----------------------------------------------------------------------------+ +*/ + +int i_APCI3XXX_InsnReadDigitalInput(comedi_device *dev, + comedi_subdevice *s, + comedi_insn *insn, + lsampl_t *data) + { + INT i_ReturnValue = insn->n; + BYTE b_Channel = (BYTE) CR_CHAN(insn->chanspec); + DWORD dw_Temp = 0; + + /***************************/ + /* Test the channel number */ + /***************************/ + + if(b_Channel <= devpriv->ps_BoardInfo->i_NbrDiChannel) + { + /************************/ + /* Test the buffer size */ + /************************/ + + if (insn->n >= 1) + { + dw_Temp = inl (devpriv->iobase + 32); + *data = (dw_Temp >> b_Channel) & 1; + } + else + { + /*******************/ + /* Data size error */ + /*******************/ + + printk("Buffer size error\n"); + i_ReturnValue = -101; + } + } + else + { + /***************************/ + /* Channel selection error */ + /***************************/ + + printk("Channel selection error\n"); + i_ReturnValue = -3; + } + + return (i_ReturnValue); + } + +/* ++----------------------------------------------------------------------------+ +| Function name :int i_APCI3XXX_InsnBitsDigitalInput | +| (comedi_device *dev, | +| comedi_subdevice *s, | +| comedi_insn *insn, | +| lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Reads the value of the Digital input Port i.e.4channels| ++----------------------------------------------------------------------------+ +| Input Parameters : - | ++----------------------------------------------------------------------------+ +| Output Parameters : data[0] : Port value | ++----------------------------------------------------------------------------+ +| Return Value :>0: No error | +| .... | +| -101 : Data size error | ++----------------------------------------------------------------------------+ +*/ +int i_APCI3XXX_InsnBitsDigitalInput (comedi_device *dev, + comedi_subdevice *s, + comedi_insn *insn, + lsampl_t *data) + { + INT i_ReturnValue = insn->n; + DWORD dw_Temp = 0; + + /************************/ + /* Test the buffer size */ + /************************/ + + if (insn->n >= 1) + { + dw_Temp= inl (devpriv->iobase + 32); + *data= dw_Temp & 0xf; + } + else + { + /*******************/ + /* Data size error */ + /*******************/ + + printk("Buffer size error\n"); + i_ReturnValue = -101; + } + + return (i_ReturnValue); + } + +/* ++----------------------------------------------------------------------------+ +| DIGITAL OUTPUT SUBDEVICE | ++----------------------------------------------------------------------------+ + +*/ + + + +/* ++----------------------------------------------------------------------------+ +| Function name :int i_APCI3XXX_InsnBitsDigitalOutput | +| (comedi_device *dev, | +| comedi_subdevice *s, | +| comedi_insn *insn, | +| lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Write the selected output mask and read the status from| +| all digital output channles | ++----------------------------------------------------------------------------+ +| Input Parameters : dw_ChannelMask = data [0]; | +| dw_BitMask = data [1]; | ++----------------------------------------------------------------------------+ +| Output Parameters : data[1] : All digital output channles states | ++----------------------------------------------------------------------------+ +| Return Value : >0 : No error | +| -4 : Channel mask error | +| -101 : Data size error | ++----------------------------------------------------------------------------+ +*/ +int i_APCI3XXX_InsnBitsDigitalOutput (comedi_device *dev, + comedi_subdevice *s, + comedi_insn *insn, + lsampl_t *data) + { + INT i_ReturnValue = insn->n; + BYTE b_ChannelCpt = 0; + DWORD dw_ChannelMask = 0; + DWORD dw_BitMask = 0; + DWORD dw_Status = 0; + + /************************/ + /* Test the buffer size */ + /************************/ + + if (insn->n >= 2) + { + /*******************************/ + /* Get the channe and bit mask */ + /*******************************/ + + dw_ChannelMask = data [0]; + dw_BitMask = data [1]; + + /*************************/ + /* Test the channel mask */ + /*************************/ + + if ((dw_ChannelMask & 0XFFFFFFF0) == 0) + { + /*********************************/ + /* Test if set/reset any channel */ + /*********************************/ + + if (dw_ChannelMask & 0xF) + { + /********************************/ + /* Read the digital output port */ + /********************************/ + + dw_Status = inl(devpriv->iobase + 48); + + for (b_ChannelCpt = 0; b_ChannelCpt < 4; b_ChannelCpt ++) + { + if ((dw_ChannelMask >> b_ChannelCpt) & 1) + { + dw_Status = (dw_Status & (0xF - (1 << b_ChannelCpt))) | (dw_BitMask & (1 << b_ChannelCpt)); + } + } + + outl (dw_Status, devpriv->iobase + 48); + } + + /********************************/ + /* Read the digital output port */ + /********************************/ + + data [1] = inl(devpriv->iobase + 48); + } + else + { + /************************/ + /* Config command error */ + /************************/ + + printk("Channel mask error\n"); + i_ReturnValue = -4; + } + } + else + { + /*******************/ + /* Data size error */ + /*******************/ + + printk("Buffer size error\n"); + i_ReturnValue = -101; + } + + + return (i_ReturnValue); + } + +/* ++----------------------------------------------------------------------------+ +| Function name :int i_APCI3XXX_InsnWriteDigitalOutput | +| (comedi_device *dev, | +| comedi_subdevice *s, | +| comedi_insn *insn, | +| lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Set the state from digital output channel | ++----------------------------------------------------------------------------+ +| Input Parameters : b_Channel = CR_CHAN(insn->chanspec) | +| b_State = data [0] | ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value : >0 : No error | +| -3 : Channel selection error | +| -101 : Data size error | ++----------------------------------------------------------------------------+ +*/ + + +int i_APCI3XXX_InsnWriteDigitalOutput (comedi_device *dev, + comedi_subdevice *s, + comedi_insn *insn, + lsampl_t *data) + { + INT i_ReturnValue = insn->n; + BYTE b_Channel = CR_CHAN(insn->chanspec); + BYTE b_State = 0; + DWORD dw_Status = 0; + + /************************/ + /* Test the buffer size */ + /************************/ + + if (insn->n >= 1) + { + /***************************/ + /* Test the channel number */ + /***************************/ + + if(b_Channel < devpriv->ps_BoardInfo->i_NbrDoChannel) + { + /*******************/ + /* Get the command */ + /*******************/ + + b_State = (BYTE) data[0]; + + /********************************/ + /* Read the digital output port */ + /********************************/ + + dw_Status = inl(devpriv->iobase + 48); + + dw_Status = (dw_Status & (0xF - (1 << b_Channel))) | ((b_State & 1) << b_Channel); + outl (dw_Status, devpriv->iobase + 48); + } + else + { + /***************************/ + /* Channel selection error */ + /***************************/ + + printk("Channel selection error\n"); + i_ReturnValue = -3; + } + } + else + { + /*******************/ + /* Data size error */ + /*******************/ + + printk("Buffer size error\n"); + i_ReturnValue = -101; + } + + return (i_ReturnValue); + } + +/* ++----------------------------------------------------------------------------+ +| Function name :int i_APCI3XXX_InsnReadDigitalOutput | +| (comedi_device *dev, | +| comedi_subdevice *s, | +| comedi_insn *insn, | +| lsampl_t *data) | ++----------------------------------------------------------------------------+ +| Task : Read the state from digital output channel | ++----------------------------------------------------------------------------+ +| Input Parameters : b_Channel = CR_CHAN(insn->chanspec) | ++----------------------------------------------------------------------------+ +| Output Parameters : b_State = data [0] | ++----------------------------------------------------------------------------+ +| Return Value : >0 : No error | +| -3 : Channel selection error | +| -101 : Data size error | ++----------------------------------------------------------------------------+ +*/ + + +int i_APCI3XXX_InsnReadDigitalOutput (comedi_device *dev, + comedi_subdevice *s, + comedi_insn *insn, + lsampl_t *data) + { + INT i_ReturnValue = insn->n; + BYTE b_Channel = CR_CHAN(insn->chanspec); + DWORD dw_Status = 0; + + /************************/ + /* Test the buffer size */ + /************************/ + + if (insn->n >= 1) + { + /***************************/ + /* Test the channel number */ + /***************************/ + + if(b_Channel < devpriv->ps_BoardInfo->i_NbrDoChannel) + { + /********************************/ + /* Read the digital output port */ + /********************************/ + + dw_Status = inl(devpriv->iobase + 48); + + dw_Status = (dw_Status >> b_Channel) & 1; + *data = dw_Status; + } + else + { + /***************************/ + /* Channel selection error */ + /***************************/ + + printk("Channel selection error\n"); + i_ReturnValue = -3; + } + } + else + { + /*******************/ + /* Data size error */ + /*******************/ + + printk("Buffer size error\n"); + i_ReturnValue = -101; + } + + return (i_ReturnValue); + } + + +/* ++----------------------------------------------------------------------------+ +| Function Name : int i_APCI3XXX_Reset(comedi_device *dev) | +----------------------------------------------------------------------------+ +| Task :resets all the registers | ++----------------------------------------------------------------------------+ +| Input Parameters : comedi_device *dev | ++----------------------------------------------------------------------------+ +| Output Parameters : - | ++----------------------------------------------------------------------------+ +| Return Value : - | ++----------------------------------------------------------------------------+ +*/ + +int i_APCI3XXX_Reset(comedi_device *dev) + { + unsigned char b_Cpt = 0; + + /*************************/ + /* Disable the interrupt */ + /*************************/ + + disable_irq(dev->irq); + + /****************************/ + /* Reset the interrupt flag */ + /****************************/ + + devpriv->b_EocEosInterrupt = 0; + + /***************************/ + /* Clear the start command */ + /***************************/ + + writel (0, (void *) (devpriv->dw_AiBase + 8)); + + /*****************************/ + /* Reset the interrupt flags */ + /*****************************/ + + writel (readl ((void *) (devpriv->dw_AiBase + 16)), (void *) (devpriv->dw_AiBase + 16)); + + /*****************/ + /* clear the EOS */ + /*****************/ + + readl ((void *) (devpriv->dw_AiBase + 20)); + + /******************/ + /* Clear the FIFO */ + /******************/ + + for (b_Cpt = 0; b_Cpt < 16; b_Cpt ++) + { + readl ((void *) (devpriv->dw_AiBase + 28)); + } + + /************************/ + /* Enable the interrupt */ + /************************/ + + enable_irq(dev->irq); + + return 0; + } diff --git a/comedi/drivers/addi-data/hwdrv_apci3xxx.h b/comedi/drivers/addi-data/hwdrv_apci3xxx.h new file mode 100755 index 00000000..1f670e92 --- /dev/null +++ b/comedi/drivers/addi-data/hwdrv_apci3xxx.h @@ -0,0 +1,70 @@ +/** +@verbatim + +Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. + + ADDI-DATA GmbH + Dieselstrasse 3 + D-77833 Ottersweier + Tel: +19(0)7223/9493-0 + Fax: +49(0)7223/9493-92 + http://www.addi-data-com + info@addi-data.com + +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +You shoud also find the complete GPL in the COPYING file accompanying this source code. + +@endverbatim +*/ + + + +#ifndef COMEDI_SUBD_TTLIO + #define COMEDI_SUBD_TTLIO 11 /* Digital Input Output But TTL */ +#endif + +#ifndef ADDIDATA_ENABLE + #define ADDIDATA_ENABLE 1 + #define ADDIDATA_DISABLE 0 +#endif + +#define APCI3XXX_SINGLE 0 +#define APCI3XXX_DIFF 1 +#define APCI3XXX_CONFIGURATION 0 + + +#define APCI3XXX_TTL_INIT_DIRECTION_PORT2 0 + +#ifdef __KERNEL__ + + +comedi_lrange range_apci3XXX_ai={ 8, {BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2), + BIP_RANGE(1), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2), + UNI_RANGE(1)}}; + +comedi_lrange range_apci3XXX_ttl= {12, {BIP_RANGE(1), + BIP_RANGE(1), + BIP_RANGE(1), + BIP_RANGE(1), + BIP_RANGE(1), + BIP_RANGE(1), + BIP_RANGE(1), + BIP_RANGE(1), + BIP_RANGE(1), + BIP_RANGE(1), + BIP_RANGE(1), + BIP_RANGE(1)}}; + +comedi_lrange range_apci3XXX_ao= { 2, {BIP_RANGE(10), + UNI_RANGE(10)}}; +#endif diff --git a/comedi/drivers/adl_pci6208.c b/comedi/drivers/adl_pci6208.c index 6023e274..ea50c970 100644 --- a/comedi/drivers/adl_pci6208.c +++ b/comedi/drivers/adl_pci6208.c @@ -368,11 +368,6 @@ pci6208_pci_setup(struct pci_dev *pci_dev, int *io_base_ptr, int 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 PCI6208 register base address [PCI_BASE_ADDRESS #2]. io_base = pci_resource_start (pci_dev, 2); io_range = pci_resource_end (pci_dev, 2) - io_base +1; @@ -382,13 +377,11 @@ pci6208_pci_setup(struct pci_dev *pci_dev, int *io_base_ptr, int dev_minor) io_base, io_range); - if (check_region (io_base, io_range) < 0) { + // Allocate IO ressources + if (pci_request_regions(pci_dev, PCI6208_DRIVER_NAME) < 0) { printk("comedi%d: I/O port conflict\n",dev_minor); return -EIO; } - - // Allocate IO ressources - pci_request_regions(pci_dev, PCI6208_DRIVER_NAME); *io_base_ptr = io_base; //devpriv->io_range = io_range; diff --git a/comedi/drivers/adl_pci9118.c b/comedi/drivers/adl_pci9118.c index 119c710f..0babd0a3 100644 --- a/comedi/drivers/adl_pci9118.c +++ b/comedi/drivers/adl_pci9118.c @@ -1706,16 +1706,10 @@ static int pci9118_attach(comedi_device *dev,comedi_devconfig *it) rt_printk(", b:s:f=%d:%d:%d, io=0x%4x, 0x%4x",pci_bus,pci_slot,pci_func,iobase_9,iobase_a); - if (check_region(iobase_9, this_board->iorange_9118) < 0) { + if (!request_region(iobase_9, this_board->iorange_9118, "ADLink PCI-9118")) { rt_printk("I/O port conflict\n"); return -EIO; } - if (check_region(iobase_a, this_board->iorange_amcc) < 0) { - rt_printk("I/O port conflict\n"); - return -EIO; - } - - request_region(iobase_9, this_board->iorange_9118, "ADLink PCI-9118"); dev->iobase=iobase_9; dev->board_name = this_board->name; @@ -1726,7 +1720,10 @@ static int pci9118_attach(comedi_device *dev,comedi_devconfig *it) devpriv->amcc=card; devpriv->pcidev=card->pcidev; - request_region(iobase_a, this_board->iorange_amcc, "ADLink PCI-9118"); + if (!request_region(iobase_a, this_board->iorange_amcc, "ADLink PCI-9118")) { + rt_printk("I/O port conflict\n"); + return -EIO; + } devpriv->iobase_a=iobase_a; if (it->options[3]&2) irq=0; // user don't want use IRQ @@ -1871,7 +1868,7 @@ static int pci9118_detach(comedi_device *dev) { if (dev->private) { if (devpriv->valid) pci9118_reset(dev); - release_region(devpriv->iobase_a,this_board->iorange_amcc); + if (devpriv->iobase_a) release_region(devpriv->iobase_a,this_board->iorange_amcc); if (devpriv->allocated) pci_card_free(devpriv->amcc); if (devpriv->dmabuf_virt[0]) free_pages((unsigned long)devpriv->dmabuf_virt[0],devpriv->dmabuf_pages[0]); if (devpriv->dmabuf_virt[1]) free_pages((unsigned long)devpriv->dmabuf_virt[1],devpriv->dmabuf_pages[1]); diff --git a/comedi/drivers/adv_pci1710.c b/comedi/drivers/adv_pci1710.c index 1fe2e30f..7c323524 100644 --- a/comedi/drivers/adv_pci1710.c +++ b/comedi/drivers/adv_pci1710.c @@ -235,7 +235,7 @@ static boardtype boardtypes[] = {"pci1713", 0x1713, IORANGE_171x, 1, TYPE_PCI1713, 32,16, 0, 0, 0, 0, 0x0fff, 0x0000, - &range_pci17x1, range_codes_pci1710_3, NULL, + &range_pci1710_3, range_codes_pci1710_3, NULL, 10000, 2048 }, {"pci1720", 0x1720, IORANGE_1720, 0, TYPE_PCI1720, @@ -1255,13 +1255,12 @@ static int pci1710_attach(comedi_device *dev,comedi_devconfig *it) rt_printk(", b:s:f=%d:%d:%d, io=0x%4x",pci_bus,pci_slot,pci_func,iobase); - if (check_region(iobase, this_board->iorange) < 0) { + if (!request_region(iobase, this_board->iorange, "Advantech PCI-1710")) { pci_card_free(card); rt_printk("I/O port conflict\n"); return -EIO; } - request_region(iobase, this_board->iorange, "Advantech PCI-1710"); dev->iobase=iobase; dev->board_name = this_board->name; diff --git a/comedi/drivers/adv_pci_dio.c b/comedi/drivers/adv_pci_dio.c index fe246aeb..c7387790 100644 --- a/comedi/drivers/adv_pci_dio.c +++ b/comedi/drivers/adv_pci_dio.c @@ -295,7 +295,7 @@ static boardtype boardtypes[] = { 4, PCI175x_BOARDID, 1, SDF_INTERNAL}, IO_16b }, - {"pci1760", PCI_VENDOR_ID_ADVANTECH, 0x1760, PCIDIO_MAINREG, + {"pci1760", PCI_VENDOR_ID_ADVANTECH, 0x1760, 0, TYPE_PCI1760, {{ 0, 0, 0, 0}, { 0, 0, 0, 0}}, // This card have own setup work {{ 0, 0, 0, 0}, { 0, 0, 0, 0}}, @@ -428,7 +428,7 @@ static int pci_dio_insn_bits_do_w(comedi_device *dev, comedi_subdevice *s, /* ============================================================================== */ -static int pci1760_mbxrequest(comedi_device *dev, comedi_subdevice *s, +static int pci1760_unchecked_mbxrequest(comedi_device *dev, unsigned char *omb, unsigned char *imb, int repeats) { @@ -456,49 +456,41 @@ static int pci1760_mbxrequest(comedi_device *dev, comedi_subdevice *s, return -ETIME; } -/* -============================================================================== -*/ -static int pci1760_insn_bits_di(comedi_device *dev, comedi_subdevice *s, - comedi_insn *insn, lsampl_t *data) +static int pci1760_clear_imb2(comedi_device *dev) { - int ret; - unsigned char omb[4]={ - 0x00, - 0x00, - CMD_ClearIMB2, - 0x00}; + unsigned char omb[4] = {0x0, 0x0, CMD_ClearIMB2, 0x0}; unsigned char imb[4]; - - if (!(ret=pci1760_mbxrequest(dev, s, omb, imb, OMBCMD_RETRY))) - return ret; - - data[1]=imb[3]; + /* check if imb2 is already clear */ + if(inb(dev->iobase + IMB2) == CMD_ClearIMB2) return 0; + return pci1760_unchecked_mbxrequest(dev, omb, imb, OMBCMD_RETRY); +} - return 2; +static int pci1760_mbxrequest(comedi_device *dev, + unsigned char *omb, unsigned char *imb) +{ + if(omb[2] == CMD_ClearIMB2) + { + comedi_error(dev, "bug! this function should not be used for CMD_ClearIMB2 command"); + return -EINVAL; + } + if(inb(dev->iobase + IMB2) == omb[2]) + { + int retval; + retval = pci1760_clear_imb2(dev); + if(retval < 0) return retval; + } + return pci1760_unchecked_mbxrequest(dev, omb, imb, OMBCMD_RETRY); } /* ============================================================================== */ -static int pci1760_insn_read_di(comedi_device *dev, comedi_subdevice *s, +static int pci1760_insn_bits_di(comedi_device *dev, comedi_subdevice *s, comedi_insn *insn, lsampl_t *data) { - int ret, n; - unsigned char omb[4]={ - 0x00, - 0x00, - CMD_ClearIMB2, - 0x00}; - unsigned char imb[4]; - - for (n=0; nn; n++) { - if (!(ret=pci1760_mbxrequest(dev, s, omb, imb, OMBCMD_RETRY))) - return ret; - data[n] = imb[3]; - } + data[1]=inb(dev->iobase + IMB3); - return n; + return 2; } /* @@ -519,7 +511,7 @@ static int pci1760_insn_bits_do(comedi_device *dev, comedi_subdevice *s, s->state &= ~data[0]; s->state |= (data[0]&data[1]); omb[0] = s->state; - if (!(ret=pci1760_mbxrequest(dev, s, omb, imb, OMBCMD_RETRY))) + if (!(ret=pci1760_mbxrequest(dev, omb, imb))) return ret; } data[1] = s->state; @@ -542,7 +534,7 @@ static int pci1760_insn_cnt_read(comedi_device *dev, comedi_subdevice *s, unsigned char imb[4]; for (n=0; nn; n++) { - if (!(ret=pci1760_mbxrequest(dev, s, omb, imb, OMBCMD_RETRY))) + if (!(ret=pci1760_mbxrequest(dev, omb, imb))) return ret; data[n] = (imb[1]<<8) + imb[0]; } @@ -567,20 +559,20 @@ static int pci1760_insn_cnt_write(comedi_device *dev, comedi_subdevice *s, unsigned char imb[4]; if (devpriv->CntResValue[chan] != (data[0]&0xffff)) { // Set reset value if different - if (!(ret=pci1760_mbxrequest(dev, s, omb, imb, OMBCMD_RETRY))) + if (!(ret=pci1760_mbxrequest(dev, omb, imb))) return ret; devpriv->CntResValue[chan] = data[0]&0xffff; } omb[0] = bitmask; // reset counter to it reset value omb[2] = CMD_ResetIDICounters; - if (!(ret=pci1760_mbxrequest(dev, s, omb, imb, OMBCMD_RETRY))) + if (!(ret=pci1760_mbxrequest(dev, omb, imb))) return ret; if (!(bitmask & devpriv->IDICntEnable)) { // start counter if it don't run omb[0] = bitmask; omb[2] = CMD_EnableIDICounters; - if (!(ret=pci1760_mbxrequest(dev, s, omb, imb, OMBCMD_RETRY))) + if (!(ret=pci1760_mbxrequest(dev, omb, imb))) return ret; devpriv->IDICntEnable |= bitmask; } @@ -604,28 +596,28 @@ static int pci1760_reset(comedi_device *dev) omb[0] = 0x00; omb[2] = CMD_SetRelaysOutput; // reset relay outputs - pci1760_mbxrequest(dev, NULL, omb, imb, OMBCMD_RETRY); + pci1760_mbxrequest(dev, omb, imb); omb[0] = 0x00; omb[2] = CMD_EnableIDICounters; // disable IDI up counters - pci1760_mbxrequest(dev, NULL, omb, imb, OMBCMD_RETRY); + pci1760_mbxrequest(dev, omb, imb); devpriv->IDICntEnable = 0; omb[0] = 0x00; omb[2] = CMD_OverflowIDICounters; // disable counters overflow interrupts - pci1760_mbxrequest(dev, NULL, omb, imb, OMBCMD_RETRY); + pci1760_mbxrequest(dev, omb, imb); devpriv->IDICntOverEnable = 0; omb[0] = 0x00; omb[2] = CMD_MatchIntIDICounters; // disable counters match value interrupts - pci1760_mbxrequest(dev, NULL, omb, imb, OMBCMD_RETRY); + pci1760_mbxrequest(dev, omb, imb); devpriv->IDICntMatchEnable = 0; omb[0] = 0x00; omb[1] = 0x80; for (i=0; i<8; i++) { // set IDI up counters match value omb[2] = CMD_SetIDI0CntMatchValue+i; - pci1760_mbxrequest(dev, NULL, omb, imb, OMBCMD_RETRY); + pci1760_mbxrequest(dev, omb, imb); devpriv->CntMatchValue[i] = 0x8000; } @@ -633,32 +625,32 @@ static int pci1760_reset(comedi_device *dev) omb[1] = 0x00; for (i=0; i<8; i++) { // set IDI up counters reset value omb[2] = CMD_SetIDI0CntResetValue+i; - pci1760_mbxrequest(dev, NULL, omb, imb, OMBCMD_RETRY); + pci1760_mbxrequest(dev, omb, imb); devpriv->CntResValue[i] = 0x0000; } omb[0] = 0xff; omb[2] = CMD_ResetIDICounters; // reset IDI up counters to reset values - pci1760_mbxrequest(dev, NULL, omb, imb, OMBCMD_RETRY); + pci1760_mbxrequest(dev, omb, imb); omb[0] = 0x00; omb[2] = CMD_EdgeIDICounters; // set IDI up counters count edge - pci1760_mbxrequest(dev, NULL, omb, imb, OMBCMD_RETRY); + pci1760_mbxrequest(dev, omb, imb); devpriv->IDICntEdge = 0x00; omb[0] = 0x00; omb[2] = CMD_EnableIDIFilters; // disable all digital in filters - pci1760_mbxrequest(dev, NULL, omb, imb, OMBCMD_RETRY); + pci1760_mbxrequest(dev, omb, imb); devpriv->IDIFiltersEn = 0x00; omb[0] = 0x00; omb[2] = CMD_EnableIDIPatternMatch; // disable pattern matching - pci1760_mbxrequest(dev, NULL, omb, imb, OMBCMD_RETRY); + pci1760_mbxrequest(dev, omb, imb); devpriv->IDIPatMatchEn = 0x00; omb[0] = 0x00; omb[2] = CMD_SetIDIPatternMatch; // set pattern match value - pci1760_mbxrequest(dev, NULL, omb, imb, OMBCMD_RETRY); + pci1760_mbxrequest(dev, omb, imb); devpriv->IDIPatMatchValue = 0x00; return 0; @@ -753,8 +745,6 @@ static int pci1760_attach(comedi_device *dev, comedi_devconfig *it) s->maxdata = 1; s->len_chanlist = 8; s->range_table = &range_digital; - s->io_bits=0; /* all bits input */ - s->insn_read=pci1760_insn_read_di; s->insn_bits=pci1760_insn_bits_di; subdev++; @@ -765,7 +755,6 @@ static int pci1760_attach(comedi_device *dev, comedi_devconfig *it) s->maxdata = 1; s->len_chanlist = 8; s->range_table = &range_digital; - s->io_bits=255; /* all bits output */ s->state=0; s->insn_bits=pci1760_insn_bits_do; subdev++; @@ -806,7 +795,6 @@ static int pci_dio_add_di(comedi_device *dev, comedi_subdevice *s, s->maxdata = 1; s->len_chanlist = d->chans; s->range_table = &range_digital; - s->io_bits=0; /* all bits input */ switch (this_board->io_access) { case IO_8b: s->insn_bits=pci_dio_insn_bits_di_b; @@ -833,7 +821,6 @@ static int pci_dio_add_do(comedi_device *dev, comedi_subdevice *s, s->maxdata = 1; s->len_chanlist = d->chans; s->range_table = &range_digital; - s->io_bits=(1 << d->chans)-1; /* all bits output */ s->state=0; switch (this_board->io_access) { case IO_8b: diff --git a/comedi/drivers/amplc_dio200.c b/comedi/drivers/amplc_dio200.c index c90b6983..d2569a5c 100644 --- a/comedi/drivers/amplc_dio200.c +++ b/comedi/drivers/amplc_dio200.c @@ -190,7 +190,7 @@ static dio200_layout dio200_layouts[] = { [pc272_layout] = { n_subdevs: 4, sdtype: { sd_8255, sd_8255, sd_8255, sd_intr }, - sdinfo: { 0x00, 0x08, 0x0C, 0x3F }, + sdinfo: { 0x00, 0x08, 0x10, 0x3F }, }, }; @@ -323,12 +323,11 @@ dio200_find_pci(comedi_device *dev, int bus, int slot, static int dio200_request_region(unsigned minor, unsigned long from, unsigned long extent) { - if (check_region(from, extent) < 0) { + if (!request_region(from, extent, DIO200_DRIVER_NAME)) { printk(KERN_ERR "comedi%d: I/O port conflict (%#lx,%lu)!\n", minor, from, extent); return -EIO; } - request_region(from, extent, DIO200_DRIVER_NAME); return 0; } diff --git a/comedi/drivers/amplc_pc236.c b/comedi/drivers/amplc_pc236.c index 2c4bab78..bccd7ca8 100644 --- a/comedi/drivers/amplc_pc236.c +++ b/comedi/drivers/amplc_pc236.c @@ -366,11 +366,10 @@ static int pc236_detach(comedi_device *dev) */ static int pc236_request_region(unsigned long from, unsigned long extent) { - if (check_region(from, extent) < 0) { + if (!request_region(from, extent, PC236_DRIVER_NAME)) { printk("I/O port conflict (%#lx,%lu)!\n", from, extent); return -EIO; } - request_region(from, extent, PC236_DRIVER_NAME); return 0; } diff --git a/comedi/drivers/amplc_pc263.c b/comedi/drivers/amplc_pc263.c index 6a44acfe..bfd5e1e6 100644 --- a/comedi/drivers/amplc_pc263.c +++ b/comedi/drivers/amplc_pc263.c @@ -169,9 +169,9 @@ static int pc263_attach(comedi_device *dev,comedi_devconfig *it) } /* Look for matching PCI device. */ - for(pci_dev = pci_find_device(pci_id->vendor, pci_id->device, + for(pci_dev = pci_get_device(pci_id->vendor, pci_id->device, NULL); pci_dev != NULL; - pci_dev = pci_find_device(pci_id->vendor, + pci_dev = pci_get_device(pci_id->vendor, pci_id->device, pci_dev)) { /* If bus/slot specified, check them. */ if (bus || slot) { @@ -300,11 +300,10 @@ static int pc263_detach(comedi_device *dev) */ static int pc263_request_region(unsigned long from, unsigned long extent) { - if (check_region(from, extent) < 0) { + if (!request_region(from, extent, PC263_DRIVER_NAME)) { printk("I/O port conflict (%#lx,%lu)!\n", from, extent); return -EIO; } - request_region(from, extent, PC263_DRIVER_NAME); return 0; } diff --git a/comedi/drivers/amplc_pci230.c b/comedi/drivers/amplc_pci230.c index abc01dae..08caa601 100644 --- a/comedi/drivers/amplc_pci230.c +++ b/comedi/drivers/amplc_pci230.c @@ -368,20 +368,12 @@ static int pci230_attach(comedi_device *dev,comedi_devconfig *it) } devpriv->pci_dev = pci_dev; - /* Reserve I/O space 1. */ - if(check_region(pci_iobase,PCI230_IO1_SIZE)<0){ - printk("comedi%d: amplc_pci230: I/O space 1 conflict\n",dev->minor); + /* Reserve I/O spaces. */ + if(pci_request_regions(pci_dev,"PCI230")<0){ + printk("comedi%d: amplc_pci230: I/O space conflict\n",dev->minor); return -EIO; } - request_region(pci_iobase,PCI230_IO1_SIZE,"PCI230"); devpriv->pci_iobase = pci_iobase; - - /* Reserve I/O space 2. */ - if(check_region(iobase,PCI230_IO2_SIZE)<0){ - printk("comedi%d: amplc_pci230: I/O space 2 conflict\n",dev->minor); - return -EIO; - } - request_region(iobase,PCI230_IO2_SIZE,"PCI230"); dev->iobase = iobase; /* @@ -481,17 +473,13 @@ static int pci230_detach(comedi_device *dev) if(dev->subdevices && thisboard->have_dio) subdev_8255_cleanup(dev,dev->subdevices + 2); /* Clean up dio subdevice. */ - if(dev->iobase) - release_region(dev->iobase,PCI230_IO2_SIZE); - if(dev->irq) comedi_free_irq(dev->irq, dev); if(devpriv){ - if(devpriv->pci_iobase){ - release_region(devpriv->pci_iobase, PCI230_IO1_SIZE); - } if(devpriv->pci_dev){ + if(devpriv->pci_iobase) + pci_release_regions(devpriv->pci_dev); pci_dev_put(devpriv->pci_dev); } } diff --git a/comedi/drivers/cb_das16_cs.c b/comedi/drivers/cb_das16_cs.c index c437b836..c654bc4f 100644 --- a/comedi/drivers/cb_das16_cs.c +++ b/comedi/drivers/cb_das16_cs.c @@ -481,32 +481,30 @@ static int das16cs_ao_winsn(comedi_device *dev,comedi_subdevice *s,comedi_insn * devpriv->ao_readback[chan] = data[i]; d = data[i]; - //devpriv->status1 |= 0x0009; outw(devpriv->status1, dev->iobase + 4); comedi_udelay(1); - status1 = devpriv->status1; - //if(chan)status1 &= ~0x0008; - //else status1 &= ~0x0001; - if(chan)status1 |= 0x0008; - else status1 |= 0x0001; + status1 = devpriv->status1 & ~0xf; + if(chan) status1 |= 0x0001; + else status1 |= 0x0008; - printk("0x%04x\n",status1); +/* printk("0x%04x\n",status1);*/ outw(status1, dev->iobase + 4); comedi_udelay(1); for(bit=15;bit>=0;bit--){ - int b = (d>>bit)&1; - - printk("0x%04x\n",status1 | b | 0x0000); + int b = (d >> bit) & 0x1; + b <<= 1; +/* printk("0x%04x\n",status1 | b | 0x0000);*/ outw(status1 | b | 0x0000, dev->iobase + 4); comedi_udelay(1); - printk("0x%04x\n",status1 | b | 0x0004); +/* printk("0x%04x\n",status1 | b | 0x0004);*/ outw(status1 | b | 0x0004, dev->iobase + 4); comedi_udelay(1); } - - outw(devpriv->status1, dev->iobase + 4); +/* make high both DAC0CS and DAC1CS to load + new data and update analog output*/ + outw(status1 | 0x9, dev->iobase + 4); } return i; diff --git a/comedi/drivers/cb_pcidas.c b/comedi/drivers/cb_pcidas.c index 25046ade..2420ff80 100644 --- a/comedi/drivers/cb_pcidas.c +++ b/comedi/drivers/cb_pcidas.c @@ -525,8 +525,8 @@ static int cb_pcidas_attach(comedi_device *dev, comedi_devconfig *it) */ printk("\n"); - for(pcidev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pcidev != NULL ; - pcidev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) + for(pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pcidev != NULL ; + pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { // is it not a computer boards card? if(pcidev->vendor != PCI_VENDOR_ID_CB) @@ -575,35 +575,34 @@ found: // reserve io ports err = 0; - if(check_region(s5933_config, AMCC_OP_REG_SIZE) < 0) + if(request_region(s5933_config, AMCC_OP_REG_SIZE, "cb_pcidas")) + devpriv->s5933_config = s5933_config; + else err++; - if(check_region(control_status, CONT_STAT_SIZE) < 0) + if(request_region(control_status, CONT_STAT_SIZE, "cb_pcidas")) + devpriv->control_status = control_status; + else err++; - if(check_region(adc_fifo, ADC_FIFO_SIZE) < 0) + if(request_region(adc_fifo, ADC_FIFO_SIZE, "cb_pcidas")) + devpriv->adc_fifo = adc_fifo; + else err++; - if(check_region(pacer_counter_dio, PACER_SIZE) < 0) + if(request_region(pacer_counter_dio, PACER_SIZE, "cb_pcidas")) + devpriv->pacer_counter_dio = pacer_counter_dio; + else err++; if(thisboard->ao_nchan) - if(check_region(ao_registers, AO_SIZE) < 0) + { + if(request_region(ao_registers, AO_SIZE, "cb_pcidas")) + devpriv->ao_registers = ao_registers; + else err++; + } if(err) { printk(" I/O port conflict\n"); return -EIO; } - request_region(s5933_config, AMCC_OP_REG_SIZE, "cb_pcidas"); - devpriv->s5933_config = s5933_config; - request_region(control_status, CONT_STAT_SIZE, "cb_pcidas"); - devpriv->control_status = control_status; - request_region(adc_fifo, ADC_FIFO_SIZE, "cb_pcidas"); - devpriv->adc_fifo = adc_fifo; - request_region(pacer_counter_dio, PACER_SIZE, "cb_pcidas"); - devpriv->pacer_counter_dio = pacer_counter_dio; - if(thisboard->ao_nchan) - { - request_region(ao_registers, AO_SIZE, "cb_pcidas"); - devpriv->ao_registers = ao_registers; - } // get irq if(comedi_request_irq(devpriv->pci_dev->irq, cb_pcidas_interrupt, SA_SHIRQ, "cb_pcidas", dev )) diff --git a/comedi/drivers/cb_pcidas64.c b/comedi/drivers/cb_pcidas64.c index d384819e..eb7ceeda 100644 --- a/comedi/drivers/cb_pcidas64.c +++ b/comedi/drivers/cb_pcidas64.c @@ -750,7 +750,7 @@ static const pcidas64_board pcidas64_boards[] = ai_bits: 12, ai_speed: 5000, ao_nchan: 2, - ao_bits: 16, + ao_bits: 12, ao_scan_speed: 100000, layout: LAYOUT_60XX, ai_range_table: &ai_ranges_60xx, @@ -867,7 +867,7 @@ static const pcidas64_board pcidas64_boards[] = ai_bits: 12, ai_speed: 2000, ao_nchan: 2, - ao_bits: 16, + ao_bits: 12, ao_scan_speed: 1000, layout: LAYOUT_60XX, ai_range_table: &ai_ranges_6052, @@ -1092,9 +1092,9 @@ typedef struct unsigned long main_phys_iobase; unsigned long dio_counter_phys_iobase; // base addresses (ioremapped) - unsigned long plx9080_iobase; - unsigned long main_iobase; - unsigned long dio_counter_iobase; + void *plx9080_iobase; + void *main_iobase; + void *dio_counter_iobase; // local address (used by dma controller) uint32_t local0_iobase; uint32_t local1_iobase; @@ -1269,7 +1269,7 @@ static inline int ao_cmd_is_supported(const pcidas64_board *board) static void init_plx9080(comedi_device *dev) { uint32_t bits; - unsigned long plx_iobase = priv(dev)->plx9080_iobase; + void *plx_iobase = priv(dev)->plx9080_iobase; priv(dev)->plx_control_bits = readl(priv(dev)->plx9080_iobase + PLX_CONTROL_REG); @@ -1345,7 +1345,7 @@ static void init_plx9080(comedi_device *dev) static int setup_subdevices(comedi_device *dev) { comedi_subdevice *s; - unsigned long dio_8255_iobase; + void *dio_8255_iobase; int i; if( alloc_subdevices( dev, 10 ) < 0 ) @@ -1387,7 +1387,6 @@ static int setup_subdevices(comedi_device *dev) s = dev->subdevices + 1; if(board(dev)->ao_nchan) { - dev->write_subdev = s; s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_GROUND; s->n_chan = board(dev)->ao_nchan; @@ -1397,6 +1396,7 @@ static int setup_subdevices(comedi_device *dev) s->insn_write = ao_winsn; if(ao_cmd_is_supported(board(dev))) { + dev->write_subdev = s; s->do_cmdtest = ao_cmdtest; s->do_cmd = ao_cmd; s->len_chanlist = board(dev)->ao_nchan; @@ -1405,7 +1405,6 @@ static int setup_subdevices(comedi_device *dev) } else { s->type = COMEDI_SUBD_UNUSED; - dev->write_subdev = NULL; } // digital input @@ -1441,11 +1440,11 @@ static int setup_subdevices(comedi_device *dev) if(board(dev)->layout == LAYOUT_4020) { dio_8255_iobase = priv(dev)->main_iobase + I8255_4020_REG; - subdev_8255_init(dev, s, dio_callback_4020, dio_8255_iobase); + subdev_8255_init(dev, s, dio_callback_4020, (unsigned long) dio_8255_iobase); } else { dio_8255_iobase = priv(dev)->dio_counter_iobase + DIO_8255_OFFSET; - subdev_8255_init(dev, s, dio_callback, dio_8255_iobase); + subdev_8255_init(dev, s, dio_callback, (unsigned long) dio_8255_iobase); } }else s->type = COMEDI_SUBD_UNUSED; @@ -1719,11 +1718,11 @@ static int attach(comedi_device *dev, comedi_devconfig *it) priv(dev)->dio_counter_phys_iobase = pci_resource_start(pcidev, DIO_COUNTER_BADDRINDEX); // remap, won't work with 2.0 kernels but who cares - priv(dev)->plx9080_iobase = (unsigned long)ioremap(priv(dev)->plx9080_phys_iobase, + priv(dev)->plx9080_iobase = ioremap(priv(dev)->plx9080_phys_iobase, pci_resource_len(pcidev, PLX9080_BADDRINDEX)); - priv(dev)->main_iobase = (unsigned long)ioremap(priv(dev)->main_phys_iobase, + priv(dev)->main_iobase = ioremap(priv(dev)->main_phys_iobase, pci_resource_len(pcidev, MAIN_BADDRINDEX)); - priv(dev)->dio_counter_iobase = (unsigned long)ioremap(priv(dev)->dio_counter_phys_iobase, + priv(dev)->dio_counter_iobase = ioremap(priv(dev)->dio_counter_phys_iobase, pci_resource_len(pcidev, DIO_COUNTER_BADDRINDEX)); DEBUG_PRINT(" plx9080 remapped to 0x%lx\n", priv(dev)->plx9080_iobase); @@ -1964,9 +1963,13 @@ static int ai_rinsn(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsa static int ai_config_calibration_source( comedi_device *dev, lsampl_t *data ) { - static const int num_calibration_sources = 8; lsampl_t source = data[1]; - + int num_calibration_sources; + + if( board(dev)->layout == LAYOUT_60XX) + num_calibration_sources = 16; + else + num_calibration_sources = 8; if(source >= num_calibration_sources) { printk( "invalid calibration source: %i\n", source ); @@ -2833,7 +2836,7 @@ static void drain_dma_buffers(comedi_device *dev, unsigned int channel) uint32_t next_transfer_addr; int j; int num_samples = 0; - unsigned long pci_addr_reg; + void *pci_addr_reg; if(channel) pci_addr_reg = priv(dev)->plx9080_iobase + PLX_DMA1_PCI_ADDRESS_REG; @@ -3143,7 +3146,7 @@ static int ao_readback_insn(comedi_device *dev,comedi_subdevice *s,comedi_insn * static void set_dac_control0_reg(comedi_device *dev, const comedi_cmd *cmd) { - unsigned int bits = DAC_ENABLE_BIT | WAVEFORM_GATE_LEVEL_BIT | + unsigned int bits = DAC_ENABLE_BIT | WAVEFORM_GATE_LEVEL_BIT | WAVEFORM_GATE_ENABLE_BIT | WAVEFORM_GATE_SELECT_BIT; if(cmd->start_src == TRIG_EXT) @@ -3255,7 +3258,7 @@ static void load_ao_dma(comedi_device *dev, const comedi_cmd *cmd) { unsigned int num_bytes; unsigned int next_transfer_addr; - unsigned long pci_addr_reg = priv(dev)->plx9080_iobase + PLX_DMA0_PCI_ADDRESS_REG; + void *pci_addr_reg = priv(dev)->plx9080_iobase + PLX_DMA0_PCI_ADDRESS_REG; unsigned int buffer_index; do @@ -3480,12 +3483,12 @@ static int dio_callback(int dir, int port, int data, unsigned long iobase) { if(dir) { - writeb(data, iobase + port); + writeb(data, (void*) (iobase + port)); DEBUG_PRINT("wrote 0x%x to port %i\n", data, port); return 0; }else { - return readb(iobase + port); + return readb((void*)(iobase + port)); } } @@ -3493,11 +3496,11 @@ static int dio_callback_4020(int dir, int port, int data, unsigned long iobase) { if(dir) { - writew(data, iobase + 2 * port); + writew(data, (void*)(iobase + 2 * port)); return 0; }else { - return readw(iobase + 2 * port); + return readw((void*)(iobase + 2 * port)); } } @@ -3670,7 +3673,7 @@ static uint16_t read_eeprom(comedi_device *dev, uint8_t address) static const int read_command = 0x6; unsigned int bitstream = (read_command << 8) | address; unsigned int bit; - const unsigned long plx_control_addr = priv(dev)->plx9080_iobase + PLX_CONTROL_REG; + void * const plx_control_addr = priv(dev)->plx9080_iobase + PLX_CONTROL_REG; uint16_t value; static const int value_length = 16; static const int eeprom_comedi_udelay = 1; @@ -3987,7 +3990,7 @@ static const int i2c_low_comedi_udelay = 10; static void i2c_set_sda(comedi_device *dev, int state) { static const int data_bit = CTL_EE_W; - unsigned long plx_control_addr = priv(dev)->plx9080_iobase + PLX_CONTROL_REG; + void *plx_control_addr = priv(dev)->plx9080_iobase + PLX_CONTROL_REG; if(state) { @@ -4007,7 +4010,7 @@ static void i2c_set_sda(comedi_device *dev, int state) static void i2c_set_scl(comedi_device *dev, int state) { static const int clock_bit = CTL_USERO; - unsigned long plx_control_addr = priv(dev)->plx9080_iobase + PLX_CONTROL_REG; + void *plx_control_addr = priv(dev)->plx9080_iobase + PLX_CONTROL_REG; if(state) { diff --git a/comedi/drivers/comedi_parport.c b/comedi/drivers/comedi_parport.c index 07f64fad..6bfa5189 100644 --- a/comedi/drivers/comedi_parport.c +++ b/comedi/drivers/comedi_parport.c @@ -290,11 +290,10 @@ static int parport_attach(comedi_device *dev,comedi_devconfig *it) iobase=it->options[0]; printk("comedi%d: parport: 0x%04x ",dev->minor,iobase); - if(check_region(iobase,PARPORT_SIZE)<0){ + if(!request_region(iobase,PARPORT_SIZE,"parport (comedi)")){ printk("I/O port conflict\n"); return -EIO; } - request_region(iobase,PARPORT_SIZE,"parport (comedi)"); dev->iobase=iobase; irq=it->options[1]; diff --git a/comedi/drivers/daqboard2000.c b/comedi/drivers/daqboard2000.c index 46e70327..8c863308 100644 --- a/comedi/drivers/daqboard2000.c +++ b/comedi/drivers/daqboard2000.c @@ -662,10 +662,10 @@ static int daqboard2000_8255_cb(int dir, int port, int data, unsigned long ioadd { int result = 0; if(dir){ - writew(data,ioaddr+port*2); + writew(data, (void*)(ioaddr+port*2)); result = 0; }else{ - result = readw(ioaddr+port*2); + result = readw((void*)(ioaddr+port*2)); } /* printk("daqboard2000_8255_cb %x %d %d %2.2x -> %2.2x\n", diff --git a/comedi/drivers/das08.c b/comedi/drivers/das08.c index c1677af0..69e40a57 100644 --- a/comedi/drivers/das08.c +++ b/comedi/drivers/das08.c @@ -162,6 +162,7 @@ static int das08jr_di_rbits(comedi_device *dev,comedi_subdevice *s,comedi_insn * static int das08jr_do_wbits(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); static int das08jr_ao_winsn(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); static int das08ao_ao_winsn(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +static void i8254_set_mode_low(unsigned int base, int channel, unsigned int mode); static comedi_lrange range_das08_pgl = { 9, { BIP_RANGE(10), @@ -718,19 +719,13 @@ static void i8254_write_channel(struct i8254_struct *st, int channel, unsigned i i8254_write_channel_low(st->iobase,chan,value); } -#define I8254_CH0_LM 0x30 -#define I8254_CH1_LM 0x60 -#define I8254_CH2_LM 0x80 - static void i8254_initialize(struct i8254_struct *st) { - unsigned int port=st->iobase+I8254_CTRL; - outb(I8254_CH0_LM | st->mode[0],port); - outb(I8254_CH1_LM | st->mode[1],port); - outb(I8254_CH2_LM | st->mode[2],port); + int i; + for(i = 0 ; i < 3; ++i) + i8254_set_mode_low(st->iobase, i, st->mode[i]); } - static void i8254_set_mode_low(unsigned int base, int channel, unsigned int mode) { outb((channel<<6) | 0x30 | (mode & 0x0F),base+I8254_CTRL); @@ -819,11 +814,10 @@ int das08_common_attach(comedi_device *dev, unsigned long iobase ) if(thisboard->bustype != pcmcia) { printk(" iobase 0x%lx\n", iobase); - if(check_region(iobase, thisboard->iosize)<0){ + if(!request_region(iobase, thisboard->iosize,"das08")){ printk(" I/O port conflict\n"); return -EIO; } - request_region(iobase, thisboard->iosize,"das08"); } dev->iobase = iobase; @@ -969,11 +963,10 @@ static int das08_attach(comedi_device *dev,comedi_devconfig *it) iobase = pci_resource_start(pdev, 2); printk("pcibase 0x%lx ", pci_iobase); // reserve io ports for 9052 pci chip - if(check_region(pci_iobase,PCIDAS08_SIZE)<0){ + if(!request_region(pci_iobase,PCIDAS08_SIZE,"das08")){ printk(" I/O port conflict\n"); return -EIO; } - request_region(pci_iobase,PCIDAS08_SIZE,"das08"); devpriv->pci_iobase = pci_iobase; #if 0 /* We could enable to pci-das08's interrupt here to make it possible diff --git a/comedi/drivers/das08_cs.c b/comedi/drivers/das08_cs.c index 948a0fbe..f9af08fb 100644 --- a/comedi/drivers/das08_cs.c +++ b/comedi/drivers/das08_cs.c @@ -43,6 +43,7 @@ Command support does not exist, but could be added for this board. #include #include +#include #include "das08.h" @@ -284,11 +285,13 @@ static dev_link_t *das08_pcmcia_attach(void) dev_list = link; client_reg.dev_info = &dev_info; client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE; - client_reg.EventMask = - CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | - CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | - CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME; - client_reg.event_handler = &das08_pcmcia_event; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) + client_reg.EventMask = + CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | + CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | + CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME; + client_reg.event_handler = &das08_pcmcia_event; +#endif client_reg.Version = 0x0210; client_reg.event_callback_args.client_data = link; ret = pcmcia_register_client(&link->handle, &client_reg); @@ -655,8 +658,11 @@ the device state and restart IO. struct pcmcia_driver das08_cs_driver = { - .attach = das08_pcmcia_attach, - .detach = das08_pcmcia_detach, + .attach = &das08_pcmcia_attach, + .detach = &das08_pcmcia_detach, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) + .event = &das08_pcmcia_event, +#endif .owner = THIS_MODULE, .drv = { .name = dev_info, diff --git a/comedi/drivers/das16.c b/comedi/drivers/das16.c index d211d10e..0b8de4cf 100644 --- a/comedi/drivers/das16.c +++ b/comedi/drivers/das16.c @@ -1171,6 +1171,41 @@ static void das16_timer_interrupt(unsigned long arg) mod_timer(&devpriv->timer, jiffies + timer_period()); } +/* the pc104-das16jr (at least) has problems if the dma + transfer is interrupted in the middle of transferring + a 16 bit sample, so this function takes care to get + an even transfer count after disabling dma + channel. +*/ +static int disable_dma_on_even(comedi_device *dev) +{ + int residue; + int i; + static const int disable_limit = 100; + static const int enable_timeout = 100; + disable_dma(devpriv->dma_chan); + residue = get_dma_residue(devpriv->dma_chan); + for(i = 0; i < disable_limit && (residue % 2); ++i) + { + int j; + enable_dma(devpriv->dma_chan); + for(j = 0; j < enable_timeout; ++j) + { + int new_residue; + comedi_udelay(2); + new_residue = get_dma_residue(devpriv->dma_chan); + if(new_residue != residue) break; + } + disable_dma(devpriv->dma_chan); + residue = get_dma_residue(devpriv->dma_chan); + } + if(i == disable_limit) + { + comedi_error(dev, "failed to get an even dma transfer, could be trouble."); + } + return residue; +} + static void das16_interrupt( comedi_device *dev ) { unsigned long dma_flags, spin_flags; @@ -1204,17 +1239,10 @@ static void das16_interrupt( comedi_device *dev ) } dma_flags = claim_dma_lock(); - disable_dma(devpriv->dma_chan); - /* clear flip-flop to make sure 2-byte registers for - * count and address get set correctly */ clear_dma_ff(devpriv->dma_chan); + residue = disable_dma_on_even(dev); // figure out how many points to read - - /* residue is the number of bytes left to be done on the dma - * transfer. - */ - residue = get_dma_residue(devpriv->dma_chan); if(residue > devpriv->dma_transfer_size) { comedi_error(dev, "residue > transfer size!\n"); @@ -1393,7 +1421,7 @@ static int das16_attach(comedi_device *dev, comedi_devconfig *it) if(thisboard->size<0x400){ printk(" 0x%04x-0x%04x\n", iobase, iobase+thisboard->size); - if(check_region(iobase,thisboard->size)<0){ + if(!request_region(iobase,thisboard->size,"das16")){ printk(" I/O port conflict\n"); return -EIO; } @@ -1401,12 +1429,13 @@ static int das16_attach(comedi_device *dev, comedi_devconfig *it) printk(" 0x%04x-0x%04x 0x%04x-0x%04x\n", iobase,iobase+0x0f, iobase+0x400,iobase+0x400+(thisboard->size&0x3ff)); - if(check_region(iobase,0x10) < 0) { + if(!request_region(iobase,0x10,"das16")){ printk(" I/O port conflict: 0x%04x-0x%04x\n", iobase,iobase+0x0f); return -EIO; } - if(check_region(iobase+0x400,thisboard->size&0x3ff)<0){ + if(!request_region(iobase+0x400,thisboard->size&0x3ff,"das16")){ + release_region(iobase, 0x10); printk(" I/O port conflict: 0x%04x-0x%04x\n", iobase+0x400, iobase+0x400+(thisboard->size&0x3ff)); @@ -1414,13 +1443,6 @@ static int das16_attach(comedi_device *dev, comedi_devconfig *it) } } - if(thisboard->size < 0x400){ - request_region(iobase,thisboard->size,"das16"); - }else{ - request_region(iobase,0x10,"das16"); - request_region(iobase+0x400,thisboard->size&0x3ff,"das16"); - } - dev->iobase = iobase; // probe id bits to make sure they are consistent diff --git a/comedi/drivers/das16m1.c b/comedi/drivers/das16m1.c index 0399476c..3472811a 100644 --- a/comedi/drivers/das16m1.c +++ b/comedi/drivers/das16m1.c @@ -648,16 +648,15 @@ static int das16m1_attach(comedi_device *dev, comedi_devconfig *it) printk(" io 0x%x-0x%x 0x%x-0x%x", iobase, iobase + DAS16M1_SIZE, iobase + DAS16M1_82C55, iobase + DAS16M1_82C55 + DAS16M1_SIZE2); - if(check_region(iobase, DAS16M1_SIZE) < 0) { + if(!request_region(iobase, DAS16M1_SIZE, driver_das16m1.driver_name)) { printk(" I/O port conflict\n"); return -EIO; } - if(check_region(iobase + DAS16M1_82C55, DAS16M1_SIZE2) < 0){ + if(!request_region(iobase + DAS16M1_82C55, DAS16M1_SIZE2, driver_das16m1.driver_name)) { + release_region(iobase , DAS16M1_SIZE); printk(" I/O port conflict\n"); return -EIO; } - request_region(iobase, DAS16M1_SIZE, driver_das16m1.driver_name); - request_region(iobase + DAS16M1_82C55, DAS16M1_SIZE2, driver_das16m1.driver_name); dev->iobase = iobase; /* now for the irq */ diff --git a/comedi/drivers/das1800.c b/comedi/drivers/das1800.c index 0c88596d..b799ab25 100644 --- a/comedi/drivers/das1800.c +++ b/comedi/drivers/das1800.c @@ -617,13 +617,12 @@ static int das1800_attach(comedi_device *dev, comedi_devconfig *it) } /* check if io addresses are available */ - if(check_region(iobase, DAS1800_SIZE) < 0) + if(!request_region(iobase, DAS1800_SIZE, driver_das1800.driver_name)) { printk(" I/O port conflict: failed to allocate ports 0x%x to 0x%x\n", iobase, iobase + DAS1800_SIZE - 1); return -EIO; } - request_region(iobase, DAS1800_SIZE, driver_das1800.driver_name); dev->iobase = iobase; board = das1800_probe(dev); @@ -640,13 +639,12 @@ static int das1800_attach(comedi_device *dev, comedi_devconfig *it) if(thisboard->ao_ability == 2) { iobase2 = iobase + IOBASE2; - if(check_region(iobase2, DAS1800_SIZE) < 0) + if(!request_region(iobase2, DAS1800_SIZE, driver_das1800.driver_name)) { printk(" I/O port conflict: failed to allocate ports 0x%x to 0x%x\n", iobase2, iobase2 + DAS1800_SIZE - 1); return -EIO; } - request_region(iobase2, DAS1800_SIZE, driver_das1800.driver_name); devpriv->iobase2 = iobase2; } diff --git a/comedi/drivers/das6402.c b/comedi/drivers/das6402.c index 5cdfe909..d9706151 100644 --- a/comedi/drivers/das6402.c +++ b/comedi/drivers/das6402.c @@ -311,11 +311,10 @@ static int das6402_attach(comedi_device *dev,comedi_devconfig *it) printk("comedi%d: das6402: 0x%04x",dev->minor,iobase); - if(check_region(iobase,DAS6402_SIZE)<0){ + if(!request_region(iobase,DAS6402_SIZE,"das6402")){ printk(" I/O port conflict\n"); return -EIO; } - request_region(iobase,DAS6402_SIZE,"das6402"); dev->iobase=iobase; /* should do a probe here */ diff --git a/comedi/drivers/das800.c b/comedi/drivers/das800.c index 1895853c..f1d83c4b 100644 --- a/comedi/drivers/das800.c +++ b/comedi/drivers/das800.c @@ -477,12 +477,11 @@ static int das800_attach(comedi_device *dev, comedi_devconfig *it) } /* check if io addresses are available */ - if(check_region(iobase, DAS800_SIZE) < 0) + if(!request_region(iobase, DAS800_SIZE, "das800")) { printk("I/O port conflict\n"); return -EIO; } - request_region(iobase, DAS800_SIZE, "das800"); dev->iobase = iobase; board = das800_probe(dev); diff --git a/comedi/drivers/dmm32at.c b/comedi/drivers/dmm32at.c new file mode 100644 index 00000000..677ffccc --- /dev/null +++ b/comedi/drivers/dmm32at.c @@ -0,0 +1,1079 @@ +/* + comedi/drivers/dmm32at.c + Diamond Systems mm32at code for a Comedi driver + + COMEDI - Linux Control and Measurement Device Interface + Copyright (C) 2000 David A. Schleef + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ +/* +Driver: dmm32at.o +Description: Diamond Systems mm32at driver. +Devices: +Author: Perry J. Piplani +Updated: Fri Jun 4 09:13:24 CDT 2004 +Status: experimental + +This driver is for the Diamond Systems MM-32-AT board +http://www.diamondsystems.com/products/diamondmm32at It is being used +on serveral projects inside NASA, without problems so far. For analog +input commands, TRIG_EXT is not yet supported at all.. + +Configuration Options: + comedi_config /dev/comedi0 dmm32at baseaddr,irq +*/ + +/* + * The previous block comment is used to automatically generate + * documentation in Comedi and Comedilib. The fields: + * + * Driver: the name of the driver + * Description: a short phrase describing the driver. Don't list boards. + * Devices: a full list of the boards that attempt to be supported by + * the driver. Format is "(manufacturer) board name [comedi name]", + * where comedi_name is the name that is used to configure the board. + * See the comment near board_name: in the comedi_driver structure + * below. If (manufacturer) or [comedi name] is missing, the previous + * value is used. + * Author: you + * Updated: date when the _documentation_ was last updated. Use 'date -R' + * to get a value for this. + * Status: a one-word description of the status. Valid values are: + * works - driver works correctly on most boards supported, and + * passes comedi_test. + * unknown - unknown. Usually put there by ds. + * experimental - may not work in any particular release. Author + * probably wants assistance testing it. + * bitrotten - driver has not been update in a long time, probably + * doesn't work, and probably is missing support for significant + * Comedi interface features. + * untested - author probably wrote it "blind", and is believed to + * work, but no confirmation. + * + * These headers should be followed by a blank line, and any comments + * you wish to say about the driver. The comment area is the place + * to put any known bugs, limitations, unsupported features, supported + * command triggers, whether or not commands are supported on particular + * subdevices, etc. + * + * Somewhere in the comment should be information about configuration + * options that are used with comedi_config. + */ + +#include +#include + + + +/* Board register addresses */ + +#define DMM32AT_MEMSIZE 0x10 + +#define DMM32AT_CONV 0x00 +#define DMM32AT_AILSB 0x00 +#define DMM32AT_AUXDOUT 0x01 +#define DMM32AT_AIMSB 0x01 +#define DMM32AT_AILOW 0x02 +#define DMM32AT_AIHIGH 0x03 + +#define DMM32AT_DACLSB 0x04 +#define DMM32AT_DACSTAT 0x04 +#define DMM32AT_DACMSB 0x05 + +#define DMM32AT_FIFOCNTRL 0x07 +#define DMM32AT_FIFOSTAT 0x07 + +#define DMM32AT_CNTRL 0x08 +#define DMM32AT_AISTAT 0x08 + +#define DMM32AT_INTCLOCK 0x09 + +#define DMM32AT_CNTRDIO 0x0a + +#define DMM32AT_AICONF 0x0b +#define DMM32AT_AIRBACK 0x0b + +#define DMM32AT_CLK1 0x0d +#define DMM32AT_CLK2 0x0e +#define DMM32AT_CLKCT 0x0f + +#define DMM32AT_DIOA 0x0c +#define DMM32AT_DIOB 0x0d +#define DMM32AT_DIOC 0x0e +#define DMM32AT_DIOCONF 0x0f + +#define dmm_inb(cdev,reg) inb((cdev->iobase)+reg) +#define dmm_outb(cdev,reg,valu) outb(valu,(cdev->iobase)+reg) + + +/* Board register values. */ + +/* DMM32AT_DACSTAT 0x04 */ +#define DMM32AT_DACBUSY 0x80 + +/* DMM32AT_FIFOCNTRL 0x07 */ +#define DMM32AT_FIFORESET 0x02 +#define DMM32AT_SCANENABLE 0x04 + +/* DMM32AT_CNTRL 0x08 */ +#define DMM32AT_RESET 0x20 +#define DMM32AT_INTRESET 0x08 +#define DMM32AT_CLKACC 0x00 +#define DMM32AT_DIOACC 0x01 + +/* DMM32AT_AISTAT 0x08 */ +#define DMM32AT_STATUS 0x80 + +/* DMM32AT_INTCLOCK 0x09 */ +#define DMM32AT_ADINT 0x80 +#define DMM32AT_CLKSEL 0x03 + +/* DMM32AT_CNTRDIO 0x0a */ +#define DMM32AT_FREQ12 0x80 + + +/* DMM32AT_AICONF 0x0b */ +#define DMM32AT_RANGE_U10 0x0c +#define DMM32AT_RANGE_U5 0x0d +#define DMM32AT_RANGE_B10 0x08 +#define DMM32AT_RANGE_B5 0x00 +#define DMM32AT_SCINT_20 0x00 +#define DMM32AT_SCINT_15 0x10 +#define DMM32AT_SCINT_10 0x20 +#define DMM32AT_SCINT_5 0x30 + +/* DMM32AT_CLKCT 0x0f */ +#define DMM32AT_CLKCT1 0x56 /* mode3 counter 1 - write low byte only */ +#define DMM32AT_CLKCT2 0xb6 /* mode3 counter 2 - write high and low byte */ + +/* DMM32AT_DIOCONF 0x0f */ +#define DMM32AT_DIENABLE 0x80 +#define DMM32AT_DIRA 0x10 +#define DMM32AT_DIRB 0x02 +#define DMM32AT_DIRCL 0x01 +#define DMM32AT_DIRCH 0x08 + +/* board AI ranges in comedi structure */ +static comedi_lrange dmm32at_airanges = +{ + 4, + { + UNI_RANGE(10), + UNI_RANGE(5), + BIP_RANGE(10), + BIP_RANGE(5), + } +}; + + +/* register values for above ranges */ +static unsigned char dmm32at_rangebits[] = { + DMM32AT_RANGE_U10, + DMM32AT_RANGE_U5, + DMM32AT_RANGE_B10, + DMM32AT_RANGE_B5, +}; + +/* only one of these ranges is valid, as set by a jumper on the + * board. The application should only use the range set by the jumper + */ +static comedi_lrange dmm32at_aoranges = +{ + 4, + { + UNI_RANGE(10), + UNI_RANGE(5), + BIP_RANGE(10), + BIP_RANGE(5), + } +}; + +/* + * Board descriptions for two imaginary boards. Describing the + * boards in this way is optional, and completely driver-dependent. + * Some drivers use arrays such as this, other do not. + */ +typedef struct dmm32at_board_struct{ + char *name; + int ai_chans; + int ai_bits; + comedi_lrange *ai_ranges; + int ao_chans; + int ao_bits; + comedi_lrange *ao_ranges; + int have_dio; + int dio_chans; +}dmm32at_board; +static dmm32at_board dmm32at_boards[] = { + { + name: "dmm32at", + ai_chans: 32, + ai_bits: 16, + ai_ranges: &dmm32at_airanges, + ao_chans: 4, + ao_bits: 12, + ao_ranges: &dmm32at_aoranges, + have_dio: 1, + dio_chans: 24, + }, +}; + + +/* + * Useful for shorthand access to the particular board structure + */ +#define thisboard ((dmm32at_board *)dev->board_ptr) + +/* 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. + */ +typedef struct { + + int data; + int ai_inuse; + unsigned int ai_scans_left; + + /* Used for AO readback */ + lsampl_t ao_readback[4]; + unsigned char dio_config; + + +} dmm32at_private; + +/* + * most drivers define the following macro to make it easy to + * access the private structure. + */ +#define devpriv ((dmm32at_private *)dev->private) + + +/* + * The comedi_driver structure tells the Comedi core module + * which functions to call to configure/deconfigure (attach/detach) + * the board, and also about the kernel module that contains + * the device code. + */ +static int dmm32at_attach(comedi_device *dev,comedi_devconfig *it); +static int dmm32at_detach(comedi_device *dev); +static comedi_driver driver_dmm32at={ + driver_name: "dmm32at", + module: THIS_MODULE, + attach: dmm32at_attach, + detach: dmm32at_detach, +/* It is not necessary to implement the following members if you are + * writing a driver for a ISA PnP or PCI card */ +/* Most drivers will support multiple types of boards by + * having an array of board structures. These were defined + * in dmm32at_boards[] above. Note that the element 'name' + * was first in the structure -- Comedi uses this fact to + * extract the name of the board without knowing any details + * about the structure except for its length. + * When a device is attached (by comedi_config), the name + * of the device is given to Comedi, and Comedi tries to + * match it by going through the list of board names. If + * there is a match, the address of the pointer is put + * into dev->board_ptr and driver->attach() is called. + * + * Note that these are not necessary if you can determine + * the type of board in software. ISA PnP, PCI, and PCMCIA + * devices are such boards. + */ + board_name: dmm32at_boards, + offset: sizeof(dmm32at_board), + num_names: sizeof(dmm32at_boards) / sizeof(dmm32at_board), +}; + + +/* prototypes for driver functions below */ +static int dmm32at_ai_rinsn(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +static int dmm32at_ao_winsn(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +static int dmm32at_ao_rinsn(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +static int dmm32at_dio_insn_bits(comedi_device *dev,comedi_subdevice *s, + comedi_insn *insn,lsampl_t *data); +static int dmm32at_dio_insn_config(comedi_device *dev,comedi_subdevice *s, + comedi_insn *insn,lsampl_t *data); +static int dmm32at_ai_cmdtest(comedi_device *dev,comedi_subdevice *s, + comedi_cmd *cmd); +static int dmm32at_ai_cmd(comedi_device *dev, comedi_subdevice *s); +static int dmm32at_ai_cancel(comedi_device *dev,comedi_subdevice *s); +static int dmm32at_ns_to_timer(unsigned int *ns,int round); +static irqreturn_t dmm32at_isr(int irq,void *d,struct pt_regs *regs); +void dmm32at_setaitimer(comedi_device *dev,unsigned int nansec); + + +/* + * Attach is called by the Comedi core to configure the driver + * for a particular board. If you specified a board_name array + * in the driver structure, dev->board_ptr contains that + * address. + */ +static int dmm32at_attach(comedi_device *dev,comedi_devconfig *it) +{ + int ret; + comedi_subdevice *s; + unsigned char aihi,ailo,fifostat,aistat,intstat,airback; + + dev->iobase = it->options[0]; + dev->irq = it->options[1]; + + printk("comedi%d: dmm32at: attaching\n",dev->minor); + printk("dmm32at: probing at address 0x%04x, irq %d\n", + dev->iobase, dev->irq); + + + /* the following just makes sure the board is there and gets + it to a known state */ + + /* reset the board */ + dmm_outb(dev,DMM32AT_CNTRL,DMM32AT_RESET); + + /* allow a millisecond to reset */ + udelay(1000); + + /* zero scan and fifo control */ + dmm_outb(dev,DMM32AT_FIFOCNTRL,0x0); + + /* zero interrupt and clock control */ + dmm_outb(dev,DMM32AT_INTCLOCK,0x0); + + /* write a test channel range, the high 3 bits should drop */ + dmm_outb(dev,DMM32AT_AILOW,0x80); + dmm_outb(dev,DMM32AT_AIHIGH,0xff); + + /* set the range at 10v unipolar */ + dmm_outb(dev,DMM32AT_AICONF,DMM32AT_RANGE_U10); + + /* should take 10 us to settle, here's a hundred */ + udelay(100); + + /* read back the values */ + ailo = dmm_inb(dev,DMM32AT_AILOW); + aihi = dmm_inb(dev,DMM32AT_AIHIGH); + fifostat = dmm_inb(dev,DMM32AT_FIFOSTAT); + aistat = dmm_inb(dev,DMM32AT_AISTAT); + intstat = dmm_inb(dev,DMM32AT_INTCLOCK); + airback = dmm_inb(dev,DMM32AT_AIRBACK); + + printk("dmm32at: lo=0x%02x hi=0x%02x fifostat=0x%02x\n", + ailo,aihi,fifostat); + printk("dmm32at: aistat=0x%02x intstat=0x%02x airback=0x%02x\n", + aistat,intstat,airback); + + if( (ailo != 0x00) || (aihi != 0x1f) || (fifostat != 0x80) || + (aistat != 0x60 || (intstat != 0x00) || airback != 0x0c) ){ + printk("dmmat32: board detection failed\n"); + return -1; + } + + /* board is there, register interrupt and address space */ + request_region(dev->iobase,DMM32AT_MEMSIZE,thisboard->name); + ret=comedi_request_irq(dev->irq, dmm32at_isr,0,thisboard->name,dev); + if(ret<0){ + printk("irq conflict\n"); + return ret; + } + + + +/* + * If you can probe the device to determine what device in a series + * it is, this is the place to do it. Otherwise, dev->board_ptr + * should already be initialized. + */ + //dev->board_ptr = dmm32at_probe(dev); + +/* + * Initialize dev->board_name. Note that we can use the "thisboard" + * macro now, since we just initialized it in the last line. + */ + dev->board_name = thisboard->name; + +/* + * Allocate the private structure area. alloc_private() is a + * convenient macro defined in comedidev.h. + */ + if(alloc_private(dev,sizeof(dmm32at_private))<0) + return -ENOMEM; + +/* + * Allocate the subdevice structures. alloc_subdevice() is a + * convenient macro defined in comedidev.h. + */ + if(alloc_subdevices(dev, 3)<0) + return -ENOMEM; + + s=dev->subdevices+0; + dev->read_subdev=s; + /* analog input subdevice */ + s->type=COMEDI_SUBD_AI; + /* we support single-ended (ground) and differential */ + s->subdev_flags=SDF_READABLE|SDF_GROUND|SDF_DIFF; + s->n_chan=thisboard->ai_chans; + s->maxdata=(1<ai_bits)-1; + s->range_table=thisboard->ai_ranges; + s->len_chanlist=32; /* This is the maximum chanlist length that + the board can handle */ + s->insn_read = dmm32at_ai_rinsn; + s->do_cmd = dmm32at_ai_cmd; + s->do_cmdtest = dmm32at_ai_cmdtest; + s->cancel = dmm32at_ai_cancel; + + s=dev->subdevices+1; + /* analog output subdevice */ + s->type=COMEDI_SUBD_AO; + s->subdev_flags=SDF_WRITABLE; + s->n_chan=thisboard->ao_chans; + s->maxdata=(1<ao_bits)-1; + s->range_table=thisboard->ao_ranges; + s->insn_write = dmm32at_ao_winsn; + s->insn_read = dmm32at_ao_rinsn; + + s=dev->subdevices+2; + /* digital i/o subdevice */ + if(thisboard->have_dio){ + + /* get access to the DIO regs */ + dmm_outb(dev,DMM32AT_CNTRL,DMM32AT_DIOACC); + /* set the DIO's to the defualt input setting */ + devpriv->dio_config = DMM32AT_DIRA|DMM32AT_DIRB| + DMM32AT_DIRCL|DMM32AT_DIRCH|DMM32AT_DIENABLE; + dmm_outb(dev,DMM32AT_DIOCONF,devpriv->dio_config); + + /* set up the subdevice */ + s->type=COMEDI_SUBD_DIO; + s->subdev_flags=SDF_READABLE|SDF_WRITABLE; + s->n_chan=thisboard->dio_chans; + s->maxdata=1; + s->state = 0; + s->range_table=&range_digital; + s->insn_bits = dmm32at_dio_insn_bits; + s->insn_config = dmm32at_dio_insn_config; + }else{ + s->type = COMEDI_SUBD_UNUSED; + } + + /* success */ + printk("comedi%d: dmm32at: attached\n",dev->minor); + + return 1; + +} + + +/* + * _detach is called to deconfigure a device. It should deallocate + * 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 + * deallocated automatically by the core. + */ +static int dmm32at_detach(comedi_device *dev) +{ + printk("comedi%d: dmm32at: remove\n",dev->minor); + if(dev->irq)comedi_free_irq(dev->irq,dev); + if(dev->iobase)release_region(dev->iobase,DMM32AT_MEMSIZE); + + return 0; +} + +/* + * "instructions" read/write data in "one-shot" or "software-triggered" + * mode. + */ + + +static int dmm32at_ai_rinsn(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) +{ + int n,i; + unsigned int d; + unsigned char status; + unsigned short msb, lsb; + unsigned char chan; + int range; + + /* get the channel and range number */ + + chan = CR_CHAN(insn->chanspec)&(s->n_chan-1); + range = CR_RANGE(insn->chanspec); + + //printk("channel=0x%02x, range=%d\n",chan,range); + + /* zero scan and fifo control and reset fifo*/ + dmm_outb(dev,DMM32AT_FIFOCNTRL,DMM32AT_FIFORESET); + + /* write the ai channel range regs */ + dmm_outb(dev,DMM32AT_AILOW,chan); + dmm_outb(dev,DMM32AT_AIHIGH,chan); + /* set the range bits */ + dmm_outb(dev,DMM32AT_AICONF,dmm32at_rangebits[range]); + + + /* wait for circuit to settle */ + for(i=0;i<40000;i++){ + status = dmm_inb(dev,DMM32AT_AIRBACK); + if( (status & DMM32AT_STATUS ) == 0) + break; + } + if(i==40000){ + printk("timeout\n"); + return -ETIMEDOUT; + } + + + /* convert n samples */ + for(n=0;nn;n++){ + /* trigger conversion */ + dmm_outb(dev,DMM32AT_CONV,0xff); + /* wait for conversion to end */ + for(i=0;i<40000;i++){ + status = dmm_inb(dev,DMM32AT_AISTAT); + if( (status & DMM32AT_STATUS ) == 0) + break; + } + if(i==40000){ + printk("timeout\n"); + return -ETIMEDOUT; + } + + /* read data */ + lsb = dmm_inb(dev,DMM32AT_AILSB); + msb = dmm_inb(dev,DMM32AT_AIMSB); + + /* invert sign bit to make range unsigned, this is an + idiosyncracy of the diamond board, it return + conversions as a signed value, i.e. -32768 to + 32767, flipping the bit and interpreting it as + signed gives you a range of 0 to 65535 which is + used by comedi */ + d = ((msb^0x0080)<<8) + lsb; + + + + data[n] = d; + } + + /* return the number of samples read/written */ + return n; +} + +static int dmm32at_ai_cmdtest(comedi_device *dev,comedi_subdevice *s, + comedi_cmd *cmd) +{ + int err=0; + int tmp; + int start_chan,gain,i; + + //printk("dmmat32 in command test\n"); + + /* cmdtest tests a particular command to see if it is valid. + * Using the cmdtest ioctl, a user can create a valid cmd + * and then have it executes by the cmd ioctl. + * + * cmdtest returns 1,2,3,4 or 0, depending on which tests + * the command passes. */ + + /* step 1: make sure trigger sources are trivially valid */ + + tmp=cmd->start_src; + cmd->start_src &= TRIG_NOW; + if(!cmd->start_src || tmp!=cmd->start_src)err++; + + tmp=cmd->scan_begin_src; + cmd->scan_begin_src &= TRIG_TIMER /*| TRIG_EXT */ ; + if(!cmd->scan_begin_src || tmp!=cmd->scan_begin_src)err++; + + tmp=cmd->convert_src; + cmd->convert_src &= TRIG_TIMER /*| TRIG_EXT */ ; + if(!cmd->convert_src || tmp!=cmd->convert_src)err++; + + tmp=cmd->scan_end_src; + cmd->scan_end_src &= TRIG_COUNT; + if(!cmd->scan_end_src || tmp!=cmd->scan_end_src)err++; + + tmp=cmd->stop_src; + cmd->stop_src &= TRIG_COUNT | TRIG_NONE ; + if(!cmd->stop_src || tmp!=cmd->stop_src)err++; + + if(err)return 1; + + + /* step 2: make sure trigger sources are unique and mutually compatible */ + + /* note that mutual compatiblity is not an issue here */ + if(cmd->scan_begin_src!=TRIG_TIMER && + cmd->scan_begin_src!=TRIG_EXT)err++; + if(cmd->convert_src!=TRIG_TIMER && + cmd->convert_src!=TRIG_EXT)err++; + if(cmd->stop_src!=TRIG_COUNT && + cmd->stop_src!=TRIG_NONE)err++; + + if(err)return 2; + + + + /* step 3: make sure arguments are trivially compatible */ + + if(cmd->start_arg!=0){ + cmd->start_arg=0; + err++; + } + +#define MAX_SCAN_SPEED 1000000 /* in nanoseconds */ +#define MIN_SCAN_SPEED 1000000000 /* in nanoseconds */ + + if(cmd->scan_begin_src==TRIG_TIMER){ + if(cmd->scan_begin_argscan_begin_arg=MAX_SCAN_SPEED; + err++; + } + if(cmd->scan_begin_arg>MIN_SCAN_SPEED){ + cmd->scan_begin_arg=MIN_SCAN_SPEED; + err++; + } + }else{ + /* external trigger */ + /* should be level/edge, hi/lo specification here */ + /* should specify multiple external triggers */ + if(cmd->scan_begin_arg>9){ + cmd->scan_begin_arg=9; + err++; + } + } + if(cmd->convert_src==TRIG_TIMER){ + if(cmd->convert_arg >= 17500) + cmd->convert_arg=20000; + else if(cmd->convert_arg >= 12500) + cmd->convert_arg=15000; + else if(cmd->convert_arg >= 7500) + cmd->convert_arg=10000; + else + cmd->convert_arg=5000; + + }else{ + /* external trigger */ + /* see above */ + if(cmd->convert_arg>9){ + cmd->convert_arg=9; + err++; + } + } + + if(cmd->scan_end_arg!=cmd->chanlist_len){ + cmd->scan_end_arg=cmd->chanlist_len; + err++; + } + if(cmd->stop_src==TRIG_COUNT){ + if(cmd->stop_arg>0xfffffff0){ + cmd->stop_arg=0xfffffff0; + err++; + } + if(cmd->stop_arg == 0){ + cmd->stop_arg=1; + err++; + } + }else{ + /* TRIG_NONE */ + if(cmd->stop_arg!=0){ + cmd->stop_arg=0; + err++; + } + } + + if(err)return 3; + + + /* step 4: fix up any arguments */ + + if(cmd->scan_begin_src==TRIG_TIMER){ + tmp=cmd->scan_begin_arg; + dmm32at_ns_to_timer(&cmd->scan_begin_arg,cmd->flags&TRIG_ROUND_MASK); + if(tmp!=cmd->scan_begin_arg)err++; + } + if(cmd->convert_src==TRIG_TIMER){ + tmp=cmd->convert_arg; + dmm32at_ns_to_timer(&cmd->convert_arg,cmd->flags&TRIG_ROUND_MASK); + if(tmp!=cmd->convert_arg)err++; + if(cmd->scan_begin_src==TRIG_TIMER && + cmd->scan_begin_argconvert_arg*cmd->scan_end_arg){ + cmd->scan_begin_arg=cmd->convert_arg*cmd->scan_end_arg; + err++; + } + } + + if(err)return 4; + + + /* step 5 check the channel list, the channel list for this + board must be consecutive and gains must be the same */ + + if(cmd->chanlist){ + gain = CR_RANGE(cmd->chanlist[0]); + start_chan = CR_CHAN(cmd->chanlist[0]); + for(i = 1; i < cmd->chanlist_len; i++){ + if(CR_CHAN(cmd->chanlist[i]) != (start_chan + i) % s->n_chan) + { + comedi_error(dev, "entries in chanlist must be consecutive channels, counting upwards\n"); + err++; + } + if(CR_RANGE(cmd->chanlist[i]) != gain) + { + comedi_error(dev, "entries in chanlist must all have the same gain\n"); + err++; + } + } + } + + + if(err)return 5; + + + return 0; +} + +static int dmm32at_ai_cmd(comedi_device *dev, comedi_subdevice *s) +{ + comedi_cmd *cmd = &s->async->cmd; + int i, range; + unsigned char chanlo,chanhi,status; + + if(!cmd->chanlist) + return -EINVAL; + + /* get the channel list and range */ + chanlo = CR_CHAN(cmd->chanlist[0])&(s->n_chan-1); + chanhi = chanlo + cmd->chanlist_len - 1; + if(chanhi >= s->n_chan) + return -EINVAL; + range = CR_RANGE(cmd->chanlist[0]); + + /* reset fifo*/ + dmm_outb(dev,DMM32AT_FIFOCNTRL,DMM32AT_FIFORESET); + + /* set scan enable */ + dmm_outb(dev,DMM32AT_FIFOCNTRL,DMM32AT_SCANENABLE); + + /* write the ai channel range regs */ + dmm_outb(dev,DMM32AT_AILOW,chanlo); + dmm_outb(dev,DMM32AT_AIHIGH,chanhi); + + /* set the range bits */ + dmm_outb(dev,DMM32AT_AICONF,dmm32at_rangebits[range]); + + /* reset the interrupt just in case */ + dmm_outb(dev,DMM32AT_CNTRL,DMM32AT_INTRESET); + + if(cmd->stop_src==TRIG_COUNT) + devpriv->ai_scans_left = cmd->stop_arg; + else { /* TRIG_NONE */ + devpriv->ai_scans_left = 0xffffffff; /* indicates TRIG_NONE to isr */ + } + + /* wait for circuit to settle */ + for(i=0;i<40000;i++){ + status = dmm_inb(dev,DMM32AT_AIRBACK); + if( (status & DMM32AT_STATUS ) == 0) + break; + } + if(i==40000){ + printk("timeout\n"); + return -ETIMEDOUT; + } + + + + if(devpriv->ai_scans_left > 1){ + /* start the clock and enable the interrupts */ + dmm32at_setaitimer(dev,cmd->scan_begin_arg); + } + else { + /* start the interrups and initiate a single scan */ + dmm_outb(dev,DMM32AT_INTCLOCK,DMM32AT_ADINT); + dmm_outb(dev,DMM32AT_CONV,0xff); + } + + +/* printk("dmmat32 in command\n"); */ + +/* for(i=0;ichanlist_len;i++) */ +/* comedi_buf_put(s->async,i*100); */ + +/* s->async->events |= COMEDI_CB_EOA; */ +/* comedi_event(dev,s,s->async->events); */ + + return 0; + +} + + +static int dmm32at_ai_cancel(comedi_device *dev,comedi_subdevice *s){ + devpriv->ai_scans_left = 1; + return 0; +} + +static irqreturn_t dmm32at_isr(int irq,void *d,struct pt_regs *regs){ + unsigned char intstat; + unsigned int samp; + unsigned short msb, lsb; + int i; + comedi_device *dev=d; + comedi_subdevice *s=dev->read_subdev; + comedi_cmd *cmd = &s->async->cmd; + + intstat = dmm_inb(dev,DMM32AT_INTCLOCK); + + if(intstat & DMM32AT_ADINT){ + for(i=0;ichanlist_len;i++){ + /* read data */ + lsb = dmm_inb(dev,DMM32AT_AILSB); + msb = dmm_inb(dev,DMM32AT_AIMSB); + + /* invert sign bit to make range unsigned */ + samp = ((msb^0x0080)<<8) + lsb; + comedi_buf_put(s->async,samp); + } + + if(devpriv->ai_scans_left != 0xffffffff){ /* TRIG_COUNT */ + devpriv->ai_scans_left--; + if(devpriv->ai_scans_left == 0){ + /* disable further interrupts and clocks */ + dmm_outb(dev,DMM32AT_INTCLOCK,0x0); + /* set the buffer to be flushed with an EOF */ + s->async->events |= COMEDI_CB_EOA; + } + + } + /* flush the buffer */ + comedi_event(dev,s,s->async->events); + } + + /* reset the interrupt */ + dmm_outb(dev,DMM32AT_CNTRL,DMM32AT_INTRESET); + return IRQ_HANDLED; +} + + +/* This function doesn't require a particular form, this is just + * what happens to be used in some of the drivers. It should + * convert ns nanoseconds to a counter value suitable for programming + * the device. Also, it should adjust ns so that it cooresponds to + * the actual time that the device will use. */ +static int dmm32at_ns_to_timer(unsigned int *ns,int round) +{ + /* trivial timer */ + /* if your timing is done through two cascaded timers, the + * i8253_cascade_ns_to_timer() function in 8253.h can be + * very helpful. There are also i8254_load() and i8254_mm_load() + * which can be used to load values into the ubiquitous 8254 counters + */ + + return *ns; +} + + +static int dmm32at_ao_winsn(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) +{ + int i; + int chan = CR_CHAN(insn->chanspec); + unsigned char hi,lo,status; + + /* Writing a list of values to an AO channel is probably not + * very useful, but that's how the interface is defined. */ + for(i=0;in;i++){ + + devpriv->ao_readback[chan] = data[i]; + + /* get the low byte */ + lo = data[i]&0x00ff; + /* high byte also contains channel number */ + hi = (data[i]>>8) + chan*(1<<6); + //printk("writing 0x%02x 0x%02x\n",hi,lo); + /* write the low and high values to the board */ + dmm_outb(dev,DMM32AT_DACLSB,lo); + dmm_outb(dev,DMM32AT_DACMSB,hi); + + /* wait for circuit to settle */ + for(i=0;i<40000;i++){ + status = dmm_inb(dev,DMM32AT_DACSTAT); + if( (status & DMM32AT_DACBUSY ) == 0) + break; + } + if(i==40000){ + printk("timeout\n"); + return -ETIMEDOUT; + } + /* dummy read to update trigger the output */ + status = dmm_inb(dev,DMM32AT_DACMSB); + + } + + /* return the number of samples read/written */ + return i; +} + +/* AO subdevices should have a read insn as well as a write insn. + * Usually this means copying a value stored in devpriv. */ +static int dmm32at_ao_rinsn(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) +{ + int i; + int chan = CR_CHAN(insn->chanspec); + + for(i=0;in;i++) + data[i] = devpriv->ao_readback[chan]; + + return i; +} + +/* DIO devices are slightly special. Although it is possible to + * implement the insn_read/insn_write interface, it is much more + * useful to applications if you implement the insn_bits interface. + * This allows packed reading/writing of the DIO channels. The + * comedi core can convert between insn_bits and insn_read/write */ +static int dmm32at_dio_insn_bits(comedi_device *dev,comedi_subdevice *s, + comedi_insn *insn,lsampl_t *data) +{ + unsigned char diobits; + + if(insn->n!=2)return -EINVAL; + + /* The insn data is a mask in data[0] and the new data + * in data[1], each channel cooresponding to a bit. */ + if(data[0]){ + s->state &= ~data[0]; + s->state |= data[0]&data[1]; + /* Write out the new digital output lines */ + //outw(s->state,dev->iobase + DMM32AT_DIO); + } + + /* get access to the DIO regs */ + dmm_outb(dev,DMM32AT_CNTRL,DMM32AT_DIOACC); + + + + + /* if either part of dio is set for output */ + if( ((devpriv->dio_config&DMM32AT_DIRCL) == 0) || + ((devpriv->dio_config&DMM32AT_DIRCH) == 0) ){ + diobits = (s->state&0x00ff0000)>>16; + dmm_outb(dev,DMM32AT_DIOC,diobits); + } + if((devpriv->dio_config&DMM32AT_DIRB) == 0){ + diobits = (s->state&0x0000ff00)>>8; + dmm_outb(dev,DMM32AT_DIOB,diobits); + } + if((devpriv->dio_config&DMM32AT_DIRA) == 0){ + diobits = (s->state&0x000000ff); + dmm_outb(dev,DMM32AT_DIOA,diobits); + } + + /* now read the state back in */ + s->state = dmm_inb(dev,DMM32AT_DIOC); + s->state <<= 8; + s->state |= dmm_inb(dev,DMM32AT_DIOB); + s->state <<= 8; + s->state |= dmm_inb(dev,DMM32AT_DIOA); + data[1]=s->state; + + + + /* on return, data[1] contains the value of the digital + * input and output lines. */ + //data[1]=inw(dev->iobase + DMM32AT_DIO); + /* or we could just return the software copy of the output values if + * it was a purely digital output subdevice */ + //data[1]=s->state; + + return 2; +} + +static int dmm32at_dio_insn_config(comedi_device *dev,comedi_subdevice *s, + comedi_insn *insn,lsampl_t *data) +{ + unsigned char chanbit; + int chan=CR_CHAN(insn->chanspec); + + if(insn->n!=1)return -EINVAL; + + if(chan < 8) + chanbit = DMM32AT_DIRA; + else if(chan < 16) + chanbit = DMM32AT_DIRB; + else if(chan < 20) + chanbit = DMM32AT_DIRCL; + else + chanbit = DMM32AT_DIRCH; + + + /* The input or output configuration of each digital line is + * configured by a special insn_config instruction. chanspec + * contains the channel to be changed, and data[0] contains the + * value COMEDI_INPUT or COMEDI_OUTPUT. */ + + /* if output clear the bit, otherwise set it */ + if(data[0]==COMEDI_OUTPUT){ + devpriv->dio_config &= ~chanbit; + }else{ + devpriv->dio_config |= chanbit; + } + /* get access to the DIO regs */ + dmm_outb(dev,DMM32AT_CNTRL,DMM32AT_DIOACC); + /* set the DIO's to the new configuration setting */ + dmm_outb(dev,DMM32AT_DIOCONF,devpriv->dio_config); + + return 1; +} + +void dmm32at_setaitimer(comedi_device *dev,unsigned int nansec){ + unsigned char lo1, lo2, hi2; + unsigned short both2; + + /* based on 10mhz clock */ + lo1=200; + both2 = nansec/20000; + hi2 = (both2&0xff00)>>8; + lo2 = both2&0x00ff; + + /* set the counter frequency to 10mhz*/ + dmm_outb(dev,DMM32AT_CNTRDIO,0); + + + /* get access to the clock regs */ + dmm_outb(dev,DMM32AT_CNTRL,DMM32AT_CLKACC); + + /* write the counter 1 control word and low byte to counter*/ + dmm_outb(dev,DMM32AT_CLKCT,DMM32AT_CLKCT1); + dmm_outb(dev,DMM32AT_CLK1,lo1); + + /* write the counter 2 control word and low byte then to counter*/ + dmm_outb(dev,DMM32AT_CLKCT,DMM32AT_CLKCT2); + dmm_outb(dev,DMM32AT_CLK2,lo2); + dmm_outb(dev,DMM32AT_CLK2,hi2); + + /* enable the ai conversion interrupt and the clock to start scans */ + dmm_outb(dev,DMM32AT_INTCLOCK,DMM32AT_ADINT|DMM32AT_CLKSEL); + + +} + + +/* + * A convenient macro that defines init_module() and cleanup_module(), + * as necessary. + */ +COMEDI_INITCLEANUP(driver_dmm32at); + diff --git a/comedi/drivers/dt2801.c b/comedi/drivers/dt2801.c index d7c6829d..eeea7072 100644 --- a/comedi/drivers/dt2801.c +++ b/comedi/drivers/dt2801.c @@ -492,11 +492,10 @@ static int dt2801_attach(comedi_device *dev,comedi_devconfig *it) int n_ai_chans; iobase=it->options[0]; - if(check_region(iobase,DT2801_IOSIZE)<0){ + if(!request_region(iobase, DT2801_IOSIZE, "dt2801")){ comedi_error(dev,"I/O port conflict"); return -EIO; } - request_region(iobase, DT2801_IOSIZE, "dt2801"); dev->iobase=iobase; /* do some checking */ diff --git a/comedi/drivers/dt2811.c b/comedi/drivers/dt2811.c index bcbd86ac..494e0d4b 100644 --- a/comedi/drivers/dt2811.c +++ b/comedi/drivers/dt2811.c @@ -307,11 +307,10 @@ static int dt2811_attach(comedi_device * dev, comedi_devconfig * it) printk("comedi%d: dt2811: base=0x%04x\n", dev->minor, iobase); - if (check_region(iobase, DT2811_SIZE) < 0) { + if (!request_region(iobase, DT2811_SIZE, driver_name)) { printk("I/O port conflict\n"); return -EIO; } - request_region(iobase, DT2811_SIZE, driver_name); dev->iobase = iobase; dev->board_name = this_board->name; diff --git a/comedi/drivers/dt2814.c b/comedi/drivers/dt2814.c index 0b16d549..eea18365 100644 --- a/comedi/drivers/dt2814.c +++ b/comedi/drivers/dt2814.c @@ -241,11 +241,10 @@ static int dt2814_attach(comedi_device *dev,comedi_devconfig *it) iobase=it->options[0]; printk("comedi%d: dt2814: 0x%04lx ",dev->minor,dev->iobase); - if(check_region(iobase,DT2814_SIZE)<0){ + if(!request_region(iobase,DT2814_SIZE,"dt2814")){ printk("I/O port conflict\n"); return -EIO; } - request_region(iobase,DT2814_SIZE,"dt2814"); dev->iobase=iobase; dev->board_name = "dt2814"; diff --git a/comedi/drivers/dt2815.c b/comedi/drivers/dt2815.c index 72faec62..aafe13de 100644 --- a/comedi/drivers/dt2815.c +++ b/comedi/drivers/dt2815.c @@ -182,11 +182,10 @@ static int dt2815_attach(comedi_device * dev, comedi_devconfig * it) iobase = it->options[0]; printk("comedi%d: dt2815: 0x%04x ", dev->minor, iobase); - if (check_region(iobase, DT2815_SIZE) < 0) { + if (!request_region(iobase, DT2815_SIZE, "dt2815")) { printk("I/O port conflict\n"); return -EIO; } - request_region(iobase, DT2815_SIZE, "dt2815"); dev->iobase = iobase; dev->board_name = "dt2815"; diff --git a/comedi/drivers/dt2817.c b/comedi/drivers/dt2817.c index 35421f98..9a86a62b 100644 --- a/comedi/drivers/dt2817.c +++ b/comedi/drivers/dt2817.c @@ -131,11 +131,10 @@ static int dt2817_attach(comedi_device *dev,comedi_devconfig *it) iobase=it->options[0]; printk("comedi%d: dt2817: 0x%04x ",dev->minor,iobase); - if(check_region(iobase,DT2817_SIZE)<0){ + if(!request_region(iobase,DT2817_SIZE,"dt2817")){ printk("I/O port conflict\n"); return -EIO; } - request_region(iobase,DT2817_SIZE,"dt2817"); dev->iobase = iobase; dev->board_name="dt2817"; diff --git a/comedi/drivers/dt282x.c b/comedi/drivers/dt282x.c index 01e179d4..4ce4fbdf 100644 --- a/comedi/drivers/dt282x.c +++ b/comedi/drivers/dt282x.c @@ -1218,11 +1218,10 @@ static int dt282x_attach(comedi_device * dev, comedi_devconfig * it) if(!iobase)iobase = 0x240; printk("comedi%d: dt282x: 0x%04x", dev->minor, iobase); - if (check_region(iobase, DT2821_SIZE) < 0) { + if (!request_region(iobase, DT2821_SIZE, "dt282x")) { printk(" I/O port conflict\n"); return -EBUSY; } - request_region(iobase, DT2821_SIZE, "dt282x"); dev->iobase = iobase; outw(DT2821_BDINIT, dev->iobase + DT2821_SUPCSR); diff --git a/comedi/drivers/dt3000.c b/comedi/drivers/dt3000.c index ae2827d8..d95d2201 100644 --- a/comedi/drivers/dt3000.c +++ b/comedi/drivers/dt3000.c @@ -289,10 +289,10 @@ static int dt3k_send_cmd(comedi_device *dev,unsigned int cmd) int i; unsigned int status = 0; - writew(cmd,dev->iobase+DPR_Command_Mbx); + writew(cmd,devpriv->io_addr+DPR_Command_Mbx); for(i=0;iiobase+DPR_Command_Mbx); + status=readw(devpriv->io_addr+DPR_Command_Mbx); if((status&DT3000_COMPLETION_MASK)!=DT3000_NOTPROCESSED) break; comedi_udelay(1); @@ -309,24 +309,24 @@ static int dt3k_send_cmd(comedi_device *dev,unsigned int cmd) static unsigned int dt3k_readsingle(comedi_device *dev,unsigned int subsys, unsigned int chan,unsigned int gain) { - writew(subsys,dev->iobase+DPR_SubSys); + writew(subsys,devpriv->io_addr+DPR_SubSys); - writew(chan,dev->iobase+DPR_Params(0)); - writew(gain,dev->iobase+DPR_Params(1)); + writew(chan,devpriv->io_addr+DPR_Params(0)); + writew(gain,devpriv->io_addr+DPR_Params(1)); dt3k_send_cmd(dev,CMD_READSINGLE); - return readw(dev->iobase+DPR_Params(2)); + return readw(devpriv->io_addr+DPR_Params(2)); } static void dt3k_writesingle(comedi_device *dev,unsigned int subsys, unsigned int chan,unsigned int data) { - writew(subsys,dev->iobase+DPR_SubSys); + writew(subsys,devpriv->io_addr+DPR_SubSys); - writew(chan,dev->iobase+DPR_Params(0)); - writew(0,dev->iobase+DPR_Params(1)); - writew(data,dev->iobase+DPR_Params(2)); + writew(chan,devpriv->io_addr+DPR_Params(0)); + writew(0,devpriv->io_addr+DPR_Params(1)); + writew(data,devpriv->io_addr+DPR_Params(2)); dt3k_send_cmd(dev,CMD_WRITESINGLE); } @@ -339,7 +339,7 @@ static irqreturn_t dt3k_interrupt(int irq, void *d, struct pt_regs *regs) comedi_subdevice *s = dev->subdevices + 0; unsigned int status; - status = readw(dev->iobase+DPR_Intr_Flag); + status = readw(devpriv->io_addr+DPR_Intr_Flag); debug_intr_flags(status); if(status & DT3000_ADFULL){ @@ -387,7 +387,7 @@ static void dt3k_ai_empty_fifo(comedi_device *dev,comedi_subdevice *s) int i; sampl_t data; - front = readw(dev->iobase + DPR_AD_Buf_Front); + front = readw(devpriv->io_addr + DPR_AD_Buf_Front); count = front - devpriv->ai_front; if(count<0)count += AI_FIFO_DEPTH; @@ -396,14 +396,14 @@ printk("reading %d samples\n",count); rear = devpriv->ai_rear; for(i=0;iiobase + DPR_ADC_buffer + rear); + data = readw(devpriv->io_addr + DPR_ADC_buffer + rear); comedi_buf_put(s->async, data); rear++; if(rear>=AI_FIFO_DEPTH)rear = 0; } devpriv->ai_rear = rear; - writew(rear,dev->iobase + DPR_AD_Buf_Rear); + writew(rear,devpriv->io_addr + DPR_AD_Buf_Rear); } @@ -573,19 +573,19 @@ printk("dt3k_ai_cmd:\n"); chan=CR_CHAN(cmd->chanlist[i]); range=CR_RANGE(cmd->chanlist[i]); - writew((range<<6)|chan,dev->iobase+DPR_ADC_buffer+i); + writew((range<<6)|chan,devpriv->io_addr+DPR_ADC_buffer+i); } aref=CR_AREF(cmd->chanlist[0]); - writew(cmd->scan_end_arg,dev->iobase+DPR_Params(0)); + writew(cmd->scan_end_arg,devpriv->io_addr+DPR_Params(0)); printk("param[0]=0x%04x\n",cmd->scan_end_arg); if(cmd->convert_src==TRIG_TIMER){ divider = dt3k_ns_to_timer(50,&cmd->convert_arg, cmd->flags&TRIG_ROUND_MASK); - writew((divider>>16),dev->iobase+DPR_Params(1)); + writew((divider>>16),devpriv->io_addr+DPR_Params(1)); printk("param[1]=0x%04x\n",divider>>16); - writew((divider&0xffff),dev->iobase+DPR_Params(2)); + writew((divider&0xffff),devpriv->io_addr+DPR_Params(2)); printk("param[2]=0x%04x\n",divider&0xffff); }else{ /* not supported */ @@ -594,32 +594,32 @@ printk("param[2]=0x%04x\n",divider&0xffff); if(cmd->scan_begin_src==TRIG_TIMER){ tscandiv = dt3k_ns_to_timer(100,&cmd->scan_begin_arg, cmd->flags&TRIG_ROUND_MASK); - writew((tscandiv>>16),dev->iobase+DPR_Params(3)); + writew((tscandiv>>16),devpriv->io_addr+DPR_Params(3)); printk("param[3]=0x%04x\n",tscandiv>>16); - writew((tscandiv&0xffff),dev->iobase+DPR_Params(4)); + writew((tscandiv&0xffff),devpriv->io_addr+DPR_Params(4)); printk("param[4]=0x%04x\n",tscandiv&0xffff); }else{ /* not supported */ } mode = DT3000_AD_RETRIG_INTERNAL | 0 | 0; - writew(mode,dev->iobase+DPR_Params(5)); + writew(mode,devpriv->io_addr+DPR_Params(5)); printk("param[5]=0x%04x\n",mode); - writew(aref==AREF_DIFF,dev->iobase+DPR_Params(6)); + writew(aref==AREF_DIFF,devpriv->io_addr+DPR_Params(6)); printk("param[6]=0x%04x\n",aref==AREF_DIFF); - writew(AI_FIFO_DEPTH/2,dev->iobase+DPR_Params(7)); + writew(AI_FIFO_DEPTH/2,devpriv->io_addr+DPR_Params(7)); printk("param[7]=0x%04x\n",AI_FIFO_DEPTH/2); - writew(SUBS_AI,dev->iobase+DPR_SubSys); + writew(SUBS_AI,devpriv->io_addr+DPR_SubSys); ret = dt3k_send_cmd(dev,CMD_CONFIG); writew(DT3000_ADFULL | DT3000_ADSWERR | DT3000_ADHWERR, - dev->iobase + DPR_Int_Mask); + devpriv->io_addr + DPR_Int_Mask); debug_n_ints = 0; - writew(SUBS_AI,dev->iobase+DPR_SubSys); + writew(SUBS_AI,devpriv->io_addr+DPR_SubSys); ret = dt3k_send_cmd(dev,CMD_START); return 0; @@ -629,10 +629,10 @@ static int dt3k_ai_cancel(comedi_device *dev,comedi_subdevice *s) { int ret; - writew(SUBS_AI,dev->iobase+DPR_SubSys); + writew(SUBS_AI,devpriv->io_addr+DPR_SubSys); ret = dt3k_send_cmd(dev,CMD_STOP); - writew(0, dev->iobase + DPR_Int_Mask); + writew(0, devpriv->io_addr + DPR_Int_Mask); return 0; } @@ -687,13 +687,13 @@ static int dt3k_ao_insn_read(comedi_device *dev,comedi_subdevice *s, static void dt3k_dio_config(comedi_device *dev,int bits) { /* XXX */ - writew(SUBS_DOUT,dev->iobase+DPR_SubSys); + writew(SUBS_DOUT,devpriv->io_addr+DPR_SubSys); - writew(bits,dev->iobase+DPR_Params(0)); + writew(bits,devpriv->io_addr+DPR_Params(0)); #if 0 /* don't know */ - writew(0,dev->iobase+DPR_Params(1)); - writew(0,dev->iobase+DPR_Params(2)); + writew(0,devpriv->io_addr+DPR_Params(1)); + writew(0,devpriv->io_addr+DPR_Params(2)); #endif dt3k_send_cmd(dev,CMD_CONFIG); @@ -750,13 +750,13 @@ static int dt3k_mem_insn_read(comedi_device *dev,comedi_subdevice *s, int i; for(i=0;in;i++){ - writew(SUBS_MEM,dev->iobase+DPR_SubSys); - writew(addr,dev->iobase+DPR_Params(0)); - writew(1,dev->iobase+DPR_Params(1)); + writew(SUBS_MEM,devpriv->io_addr+DPR_SubSys); + writew(addr,devpriv->io_addr+DPR_Params(0)); + writew(1,devpriv->io_addr+DPR_Params(1)); dt3k_send_cmd(dev,CMD_READCODE); - data[i]=readw(dev->iobase+DPR_Params(2)); + data[i]=readw(devpriv->io_addr+DPR_Params(2)); } return i; @@ -853,8 +853,11 @@ static int dt3000_detach(comedi_device *dev) { if(dev->irq)comedi_free_irq(dev->irq,dev); - if(devpriv && devpriv->pci_dev) pci_dev_put(devpriv->pci_dev); - + if(devpriv) + { + if(devpriv->pci_dev) pci_dev_put(devpriv->pci_dev); + if(devpriv->io_addr) iounmap(devpriv->io_addr); + } /* XXX */ return 0; @@ -897,8 +900,6 @@ static int setup_pci(comedi_device *dev) printk("0x%08lx mapped to %p, ",devpriv->phys_addr,devpriv->io_addr); #endif - dev->iobase = (unsigned long)devpriv->io_addr; - return 0; } diff --git a/comedi/drivers/fl512.c b/comedi/drivers/fl512.c index c2957f2e..fc42a641 100644 --- a/comedi/drivers/fl512.c +++ b/comedi/drivers/fl512.c @@ -141,11 +141,10 @@ static int fl512_attach(comedi_device *dev,comedi_devconfig *it) iobase = it->options[0]; printk("comedi:%d fl512: 0x%04x",dev->minor,iobase); - if (check_region(iobase, FL512_SIZE) < 0) { + if (!request_region(iobase, FL512_SIZE, "fl512")) { printk(" I/O port conflict\n"); return -EIO; } - request_region(iobase, FL512_SIZE, "fl512"); dev->iobase = iobase; dev->board_name = "fl512"; if(alloc_private(dev,sizeof(fl512_private)) < 0) diff --git a/comedi/drivers/gsc_hpdi.c b/comedi/drivers/gsc_hpdi.c index 79b3b944..e6743bfd 100644 --- a/comedi/drivers/gsc_hpdi.c +++ b/comedi/drivers/gsc_hpdi.c @@ -309,8 +309,8 @@ typedef struct unsigned long plx9080_phys_iobase; unsigned long hpdi_phys_iobase; // base addresses (ioremapped) - unsigned long plx9080_iobase; - unsigned long hpdi_iobase; + void *plx9080_iobase; + void *hpdi_iobase; uint32_t *dio_buffer[ NUM_DMA_BUFFERS ]; // dma buffers dma_addr_t dio_buffer_phys_addr[ NUM_DMA_BUFFERS ]; // physical addresses of dma buffers struct plx_dma_desc *dma_desc; // array of dma descriptors read by plx9080, allocated to get proper alignment @@ -377,7 +377,7 @@ static void disable_plx_interrupts( comedi_device *dev ) static void init_plx9080(comedi_device *dev) { uint32_t bits; - unsigned long plx_iobase = priv(dev)->plx9080_iobase; + void *plx_iobase = priv(dev)->plx9080_iobase; // plx9080 dump DEBUG_PRINT(" plx interrupt status 0x%x\n", readl(plx_iobase + PLX_INTRCS_REG)); @@ -598,9 +598,9 @@ static int hpdi_attach(comedi_device *dev, comedi_devconfig *it) priv(dev)->hpdi_phys_iobase = pci_resource_start(pcidev, HPDI_BADDRINDEX); // remap, won't work with 2.0 kernels but who cares - priv(dev)->plx9080_iobase = (unsigned long) ioremap( priv(dev)->plx9080_phys_iobase, + priv(dev)->plx9080_iobase = ioremap( priv(dev)->plx9080_phys_iobase, pci_resource_len( pcidev, PLX9080_BADDRINDEX ) ); - priv(dev)->hpdi_iobase = (unsigned long) ioremap( priv(dev)->hpdi_phys_iobase, + priv(dev)->hpdi_iobase = ioremap( priv(dev)->hpdi_phys_iobase, pci_resource_len( pcidev, HPDI_BADDRINDEX ) ); DEBUG_PRINT(" plx9080 remapped to 0x%lx\n", priv(dev)->plx9080_iobase); @@ -877,7 +877,7 @@ static void drain_dma_buffers(comedi_device *dev, unsigned int channel) uint32_t next_transfer_addr; int j; int num_samples = 0; - unsigned long pci_addr_reg; + void *pci_addr_reg; if(channel) pci_addr_reg = priv(dev)->plx9080_iobase + PLX_DMA1_PCI_ADDRESS_REG; diff --git a/comedi/drivers/icp_multi.c b/comedi/drivers/icp_multi.c index 9d1f656f..4653a1de 100644 --- a/comedi/drivers/icp_multi.c +++ b/comedi/drivers/icp_multi.c @@ -258,44 +258,44 @@ static int icp_multi_insn_read_ai(comedi_device * dev, comedi_subdevice * s, com #endif // Disable A/D conversion ready interrupt devpriv->IntEnable &= ~ADC_READY; - writew(devpriv->IntEnable,dev->iobase + ICP_MULTI_INT_EN); + writew(devpriv->IntEnable,devpriv->io_addr + ICP_MULTI_INT_EN); // Clear interrupt status devpriv->IntStatus |= ADC_READY; - writew(devpriv->IntStatus,dev->iobase + ICP_MULTI_INT_STAT); + writew(devpriv->IntStatus,devpriv->io_addr + ICP_MULTI_INT_STAT); // Set up appropriate channel, mode and range data, for specified channel setup_channel_list(dev, s, &insn->chanspec, 1); #ifdef ICP_MULTI_EXTDEBUG - printk("icp_multi A ST=%4x IO=%lx\n",readw(dev->iobase+ICP_MULTI_ADC_CSR), dev->iobase+ICP_MULTI_ADC_CSR); + printk("icp_multi A ST=%4x IO=%p\n",readw(devpriv->io_addr+ICP_MULTI_ADC_CSR), devpriv->io_addr+ICP_MULTI_ADC_CSR); #endif for (n=0; nn; n++) { // Set start ADC bit devpriv->AdcCmdStatus |= ADC_ST; - writew(devpriv->AdcCmdStatus, dev->iobase+ICP_MULTI_ADC_CSR); + writew(devpriv->AdcCmdStatus, devpriv->io_addr+ICP_MULTI_ADC_CSR); devpriv->AdcCmdStatus &= ~ADC_ST; #ifdef ICP_MULTI_EXTDEBUG - printk("icp multi B n=%d ST=%4x\n",n,readw(dev->iobase+ICP_MULTI_ADC_CSR)); + printk("icp multi B n=%d ST=%4x\n",n,readw(devpriv->io_addr+ICP_MULTI_ADC_CSR)); #endif comedi_udelay(1); #ifdef ICP_MULTI_EXTDEBUG - printk("icp multi C n=%d ST=%4x\n",n,readw(dev->iobase+ICP_MULTI_ADC_CSR)); + printk("icp multi C n=%d ST=%4x\n",n,readw(devpriv->io_addr+ICP_MULTI_ADC_CSR)); #endif // Wait for conversion to complete, or get fed up waiting timeout=100; while (timeout--) { - if (!(readw(dev->iobase+ICP_MULTI_ADC_CSR) & ADC_BSY)) + if (!(readw(devpriv->io_addr+ICP_MULTI_ADC_CSR) & ADC_BSY)) goto conv_finish; #ifdef ICP_MULTI_EXTDEBUG if (!(timeout%10)) - printk("icp multi D n=%d tm=%d ST=%4x\n",n,timeout,readw(dev->iobase+ICP_MULTI_ADC_CSR)); + printk("icp multi D n=%d tm=%d ST=%4x\n",n,timeout,readw(devpriv->io_addr+ICP_MULTI_ADC_CSR)); #endif comedi_udelay(1); @@ -306,11 +306,11 @@ static int icp_multi_insn_read_ai(comedi_device * dev, comedi_subdevice * s, com // Disable interrupt devpriv->IntEnable &= ~ADC_READY; - writew(devpriv->IntEnable,dev->iobase + ICP_MULTI_INT_EN); + writew(devpriv->IntEnable,devpriv->io_addr + ICP_MULTI_INT_EN); // Clear interrupt status devpriv->IntStatus |= ADC_READY; - writew(devpriv->IntStatus,dev->iobase + ICP_MULTI_INT_STAT); + writew(devpriv->IntStatus,devpriv->io_addr + ICP_MULTI_INT_STAT); // Clear data received data[n]=0; @@ -321,16 +321,16 @@ static int icp_multi_insn_read_ai(comedi_device * dev, comedi_subdevice * s, com return -ETIME; conv_finish: - data[n] = (readw(dev->iobase+ICP_MULTI_AI) >> 4 ) & 0x0fff; + data[n] = (readw(devpriv->io_addr+ICP_MULTI_AI) >> 4 ) & 0x0fff; } // Disable interrupt devpriv->IntEnable &= ~ADC_READY; - writew(devpriv->IntEnable,dev->iobase + ICP_MULTI_INT_EN); + writew(devpriv->IntEnable,devpriv->io_addr + ICP_MULTI_INT_EN); // Clear interrupt status devpriv->IntStatus |= ADC_READY; - writew(devpriv->IntStatus,dev->iobase + ICP_MULTI_INT_STAT); + writew(devpriv->IntStatus,devpriv->io_addr + ICP_MULTI_INT_STAT); #ifdef ICP_MULTI_EXTDEBUG printk("icp multi EDBG: END: icp_multi_insn_read_ai(...) n=%d\n",n); @@ -365,11 +365,11 @@ static int icp_multi_insn_write_ao(comedi_device * dev, comedi_subdevice * s, co #endif // Disable D/A conversion ready interrupt devpriv->IntEnable &= ~DAC_READY; - writew(devpriv->IntEnable,dev->iobase + ICP_MULTI_INT_EN); + writew(devpriv->IntEnable,devpriv->io_addr + ICP_MULTI_INT_EN); // Clear interrupt status devpriv->IntStatus |= DAC_READY; - writew(devpriv->IntStatus,dev->iobase + ICP_MULTI_INT_STAT); + writew(devpriv->IntStatus,devpriv->io_addr + ICP_MULTI_INT_STAT); // Get channel number and range chan = CR_CHAN(insn->chanspec); @@ -384,18 +384,18 @@ static int icp_multi_insn_write_ao(comedi_device * dev, comedi_subdevice * s, co devpriv->DacCmdStatus |= this_board->rangecode[range]; devpriv->DacCmdStatus |= (chan << 8); - writew(devpriv->DacCmdStatus, dev->iobase+ICP_MULTI_DAC_CSR); + writew(devpriv->DacCmdStatus, devpriv->io_addr+ICP_MULTI_DAC_CSR); for (n=0; nn; n++) { // Wait for analogue output data register to be ready for new data, or get fed up waiting timeout=100; while (timeout--) { - if (!(readw(dev->iobase+ICP_MULTI_DAC_CSR) & DAC_BSY)) + if (!(readw(devpriv->io_addr+ICP_MULTI_DAC_CSR) & DAC_BSY)) goto dac_ready; #ifdef ICP_MULTI_EXTDEBUG if (!(timeout%10)) - printk("icp multi A n=%d tm=%d ST=%4x\n",n,timeout,readw(dev->iobase+ICP_MULTI_DAC_CSR)); + printk("icp multi A n=%d tm=%d ST=%4x\n",n,timeout,readw(devpriv->io_addr+ICP_MULTI_DAC_CSR)); #endif comedi_udelay(1); @@ -406,11 +406,11 @@ static int icp_multi_insn_write_ao(comedi_device * dev, comedi_subdevice * s, co // Disable interrupt devpriv->IntEnable &= ~DAC_READY; - writew(devpriv->IntEnable,dev->iobase + ICP_MULTI_INT_EN); + writew(devpriv->IntEnable,devpriv->io_addr + ICP_MULTI_INT_EN); // Clear interrupt status devpriv->IntStatus |= DAC_READY; - writew(devpriv->IntStatus,dev->iobase + ICP_MULTI_INT_STAT); + writew(devpriv->IntStatus,devpriv->io_addr + ICP_MULTI_INT_STAT); // Clear data received devpriv->ao_data[chan]=0; @@ -422,11 +422,11 @@ static int icp_multi_insn_write_ao(comedi_device * dev, comedi_subdevice * s, co dac_ready: // Write data to analogue output data register - writew(data[n], dev->iobase + ICP_MULTI_AO); + writew(data[n], devpriv->io_addr + ICP_MULTI_AO); // Set DAC_ST bit to write the data to selected channel devpriv->DacCmdStatus |= DAC_ST; - writew(devpriv->DacCmdStatus, dev->iobase+ICP_MULTI_DAC_CSR); + writew(devpriv->DacCmdStatus, devpriv->io_addr+ICP_MULTI_DAC_CSR); devpriv->DacCmdStatus &= ~DAC_ST; // Save analogue output data @@ -491,7 +491,7 @@ static int icp_multi_insn_read_ao(comedi_device * dev, comedi_subdevice * s, com */ static int icp_multi_insn_bits_di(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn, lsampl_t *data) { - data[1] = readw(dev->iobase + ICP_MULTI_DI); + data[1] = readw(devpriv->io_addr + ICP_MULTI_DI); return 2; } @@ -526,10 +526,10 @@ static int icp_multi_insn_bits_do(comedi_device *dev,comedi_subdevice *s, comedi printk("Digital outputs = %4x \n", s->state); - writew(s->state, dev->iobase + ICP_MULTI_DO); + writew(s->state, devpriv->io_addr + ICP_MULTI_DO); } - data[1] = readw(dev->iobase + ICP_MULTI_DI); + data[1] = readw(devpriv->io_addr + ICP_MULTI_DI); #ifdef ICP_MULTI_EXTDEBUG printk("icp multi EDBG: END: icp_multi_insn_bits_do(...)\n"); @@ -613,13 +613,13 @@ static irqreturn_t interrupt_service_icp_multi(int irq, void *d, struct pt_regs #endif // Is this interrupt from our board? - int_no = readw(dev->iobase + ICP_MULTI_INT_STAT) & Status_IRQ; + int_no = readw(devpriv->io_addr + ICP_MULTI_INT_STAT) & Status_IRQ; if (!int_no) // No, exit return IRQ_NONE; #ifdef ICP_MULTI_EXTDEBUG - printk("icp multi EDBG: interrupt_service_icp_multi() ST: %4x\n",readw(dev->iobase + ICP_MULTI_INT_STAT)); + printk("icp multi EDBG: interrupt_service_icp_multi() ST: %4x\n",readw(devpriv->io_addr + ICP_MULTI_INT_STAT)); #endif // Determine which interrupt is active & handle it @@ -774,7 +774,7 @@ static void setup_channel_list(comedi_device * dev, comedi_subdevice * s, unsign devpriv->AdcCmdStatus |= range; /* Output channel, range, mode to ICP Multi*/ - writew(devpriv->AdcCmdStatus, dev->iobase+ICP_MULTI_ADC_CSR); + writew(devpriv->AdcCmdStatus, devpriv->io_addr+ICP_MULTI_ADC_CSR); #ifdef ICP_MULTI_EXTDEBUG printk("GS: %2d. [%4x]=%4x %4x\n", i, chanprog, range, devpriv->act_chanlist[i]); @@ -807,8 +807,8 @@ static int icp_multi_reset(comedi_device *dev) printk("icp_multi EDBG: BGN: icp_multi_reset(...)\n"); #endif // Clear INT enables and requests - writew(0, dev->iobase + ICP_MULTI_INT_EN); - writew(0x00ff, dev->iobase + ICP_MULTI_INT_STAT); + writew(0, devpriv->io_addr + ICP_MULTI_INT_EN); + writew(0x00ff, devpriv->io_addr + ICP_MULTI_INT_STAT); if (this_board->n_aochan) // Set DACs to 0..5V range and 0V output @@ -819,20 +819,20 @@ static int icp_multi_reset(comedi_device *dev) devpriv->DacCmdStatus |= (i << 8); // Output 0V - writew(0, dev->iobase+ICP_MULTI_AO); + writew(0, devpriv->io_addr+ICP_MULTI_AO); // Set start conversion bit devpriv->DacCmdStatus |= DAC_ST; // Output to command / status register - writew(devpriv->DacCmdStatus, dev->iobase+ICP_MULTI_DAC_CSR); + writew(devpriv->DacCmdStatus, devpriv->io_addr+ICP_MULTI_DAC_CSR); // Delay to allow DAC time to recover comedi_udelay(1); } // Digital outputs to 0 - writew(0, dev->iobase + ICP_MULTI_DO); + writew(0, devpriv->io_addr + ICP_MULTI_DO); #ifdef ICP_MULTI_EXTDEBUG printk("icp multi EDBG: END: icp_multi_reset(...)\n"); @@ -897,13 +897,12 @@ static int icp_multi_attach(comedi_device *dev,comedi_devconfig *it) iobase=io_addr[2]; -// if(check_mem_region(iobase, ICP_MULTI_SIZE)) -// { + if(!request_mem_region(iobase, ICP_MULTI_SIZE, "icp_multi")) + { /* Couldn't allocate io space */ -// printk(KERN_WARNING "couldn't allocate IO space\n"); -// return -EIO; -// } -// request_mem_region(iobase, ICP_MULTI_SIZE, "icp_multi"); + printk(KERN_WARNING "couldn't allocate IO space\n"); + return -EIO; + } devpriv->phys_iobase = iobase; printk(", b:s:f=%d:%d:%d, io=0x%8lx \n", pci_bus, pci_slot, pci_func, iobase); @@ -919,8 +918,6 @@ static int icp_multi_attach(comedi_device *dev,comedi_devconfig *it) printk("0x%08lx mapped to %p, ", iobase, devpriv->io_addr); #endif - dev->iobase = (unsigned long)devpriv->io_addr; - dev->board_name = this_board->name; n_subdevices = 0; @@ -1061,9 +1058,9 @@ static int icp_multi_detach(comedi_device *dev) if (dev->irq) comedi_free_irq(dev->irq,dev); - if (dev->iobase) { + if (dev->private && devpriv->io_addr) { iounmap(devpriv->io_addr); -// release_mem_region(iobase, ICP_MULTI_SIZE); + release_mem_region(devpriv->phys_iobase, ICP_MULTI_SIZE); } if (pci_list_builded) { diff --git a/comedi/drivers/ii_pci20kc.c b/comedi/drivers/ii_pci20kc.c index 0ee79c9b..3b057ef8 100644 --- a/comedi/drivers/ii_pci20kc.c +++ b/comedi/drivers/ii_pci20kc.c @@ -137,14 +137,14 @@ options for PCI-20341M: typedef union { - unsigned long iobase; + void *iobase; struct { - unsigned long iobase; + void *iobase; comedi_lrange *ao_range_list[2]; /* range of channels of ao module */ lsampl_t last_data[2]; }pci20006; struct { - unsigned long iobase; + void *iobase; int timebase; int settling_time; int ai_gain; @@ -152,6 +152,7 @@ typedef union { } pci20xxx_subdev_private; typedef struct { + void *ioaddr; pci20xxx_subdev_private subdev_private[PCI20000_MODULES]; } pci20xxx_private; @@ -214,32 +215,32 @@ static int pci20xxx_attach(comedi_device * dev, comedi_devconfig * it) if ((ret = alloc_private(dev, sizeof(pci20xxx_private))) < 0) return ret; - dev->iobase = it->options[0]; + devpriv->ioaddr = (void*) it->options[0]; dev->board_name = "pci20kc"; /* Check PCI-20001 C-2A Carrier Board ID */ - if ((readb(dev->iobase) & PCI20000_ID) != PCI20000_ID) { + if ((readb(devpriv->ioaddr) & PCI20000_ID) != PCI20000_ID) { printk("comedi%d: ii_pci20kc", dev->minor); - printk(" PCI-20001 C-2A Carrier Board at base=0x%05lx not found !\n", dev->iobase); + printk(" PCI-20001 C-2A Carrier Board at base=0x%p not found !\n", devpriv->ioaddr); return -EINVAL; } printk("comedi%d:\n", dev->minor); - printk("ii_pci20kc: PCI-20001 C-2A at base=0x%05lx\n", dev->iobase); + printk("ii_pci20kc: PCI-20001 C-2A at base=0x%p\n", devpriv->ioaddr); for (i = 0; i < PCI20000_MODULES; i++) { s = dev->subdevices + i; - id = readb(dev->iobase + (i+1) * PCI20000_OFFSET); + id = readb(devpriv->ioaddr + (i+1) * PCI20000_OFFSET); s->private = devpriv->subdev_private +i; sdp = s->private; switch(id){ case PCI20006_ID: - sdp->pci20006.iobase = dev->iobase + (i+1) * PCI20000_OFFSET; + sdp->pci20006.iobase = devpriv->ioaddr + (i+1) * PCI20000_OFFSET; pci20006_init(dev,s,it->options[2*i+2],it->options[2*i+3]); printk("comedi%d: ii_pci20kc", dev->minor); printk(" PCI-20006 module in slot %d \n", i+1); break; case PCI20341_ID: - sdp->pci20341.iobase = dev->iobase + (i+1) * PCI20000_OFFSET; + sdp->pci20341.iobase = devpriv->ioaddr + (i+1) * PCI20000_OFFSET; pci20341_init(dev,s,it->options[2*i+2],it->options[2*i+3]); printk("comedi%d: ii_pci20kc", dev->minor); printk(" PCI-20341 module in slot %d \n", i+1); @@ -502,18 +503,18 @@ static int pci20xxx_dio_insn_bits(comedi_device *dev,comedi_subdevice *s, mask &= s->io_bits; if(mask&0x000000ff) - writeb((s->state>>0)&0xff, dev->iobase + PCI20000_DIO_0 ); + writeb((s->state>>0)&0xff, devpriv->ioaddr + PCI20000_DIO_0 ); if(mask&0x0000ff00) - writeb((s->state>>8)&0xff, dev->iobase + PCI20000_DIO_1 ); + writeb((s->state>>8)&0xff, devpriv->ioaddr + PCI20000_DIO_1 ); if(mask&0x00ff0000) - writeb((s->state>>16)&0xff, dev->iobase + PCI20000_DIO_2 ); + writeb((s->state>>16)&0xff, devpriv->ioaddr + PCI20000_DIO_2 ); if(mask&0xff000000) - writeb((s->state>>24)&0xff, dev->iobase + PCI20000_DIO_3 ); + writeb((s->state>>24)&0xff, devpriv->ioaddr + PCI20000_DIO_3 ); - data[1] = readb(dev->iobase + PCI20000_DIO_0 ); - data[1] |= readb(dev->iobase + PCI20000_DIO_1 )<<8; - data[1] |= readb(dev->iobase + PCI20000_DIO_2 )<<16; - data[1] |= readb(dev->iobase + PCI20000_DIO_3 )<<24; + data[1] = readb(devpriv->ioaddr + PCI20000_DIO_0 ); + data[1] |= readb(devpriv->ioaddr + PCI20000_DIO_1 )<<8; + data[1] |= readb(devpriv->ioaddr + PCI20000_DIO_2 )<<16; + data[1] |= readb(devpriv->ioaddr + PCI20000_DIO_3 )<<24; return 2; } @@ -524,9 +525,9 @@ static void pci20xxx_dio_config(comedi_device * dev,comedi_subdevice *s) unsigned char control_23; unsigned char buffer; - control_01 = readb(dev->iobase + PCI20000_DIO_CONTROL_01); - control_23 = readb(dev->iobase + PCI20000_DIO_CONTROL_23); - buffer = readb(dev->iobase + PCI20000_DIO_BUFFER); + control_01 = readb(devpriv->ioaddr + PCI20000_DIO_CONTROL_01); + control_23 = readb(devpriv->ioaddr + PCI20000_DIO_CONTROL_23); + buffer = readb(devpriv->ioaddr + PCI20000_DIO_BUFFER); if(s->io_bits & 0x000000ff ){ /* output port 0 */ @@ -564,9 +565,9 @@ static void pci20xxx_dio_config(comedi_device * dev,comedi_subdevice *s) control_23 = (control_23 & DIO_CAND) | PCI20000_DIO_OIC; buffer = (buffer &(~(DIO_BI<iobase + PCI20000_DIO_CONTROL_01); - writeb(control_23, dev->iobase + PCI20000_DIO_CONTROL_23); - writeb(buffer, dev->iobase + PCI20000_DIO_BUFFER); + writeb(control_01, devpriv->ioaddr + PCI20000_DIO_CONTROL_01); + writeb(control_23, devpriv->ioaddr + PCI20000_DIO_CONTROL_23); + writeb(buffer, devpriv->ioaddr + PCI20000_DIO_BUFFER); } #if 0 @@ -577,10 +578,10 @@ static void pci20xxx_do(comedi_device * dev, comedi_subdevice * s) /* XXX it would be a good idea to only update the registers that _need_ to be updated. This requires changes to comedi, however. */ - writeb((s->state>>0)&0xff, dev->iobase + PCI20000_DIO_0 ); - writeb((s->state>>8)&0xff, dev->iobase + PCI20000_DIO_1 ); - writeb((s->state>>16)&0xff, dev->iobase + PCI20000_DIO_2 ); - writeb((s->state>>24)&0xff, dev->iobase + PCI20000_DIO_3 ); + writeb((s->state>>0)&0xff, devpriv->ioaddr + PCI20000_DIO_0 ); + writeb((s->state>>8)&0xff, devpriv->ioaddr + PCI20000_DIO_1 ); + writeb((s->state>>16)&0xff, devpriv->ioaddr + PCI20000_DIO_2 ); + writeb((s->state>>24)&0xff, devpriv->ioaddr + PCI20000_DIO_3 ); } static unsigned int pci20xxx_di(comedi_device * dev, comedi_subdevice * s) @@ -588,10 +589,10 @@ static unsigned int pci20xxx_di(comedi_device * dev, comedi_subdevice * s) /* XXX same note as above */ unsigned int bits; - bits = readb(dev->iobase + PCI20000_DIO_0 ); - bits |= readb(dev->iobase + PCI20000_DIO_1 )<<8; - bits |= readb(dev->iobase + PCI20000_DIO_2 )<<16; - bits |= readb(dev->iobase + PCI20000_DIO_3 )<<24; + bits = readb(devpriv->ioaddr + PCI20000_DIO_0 ); + bits |= readb(devpriv->ioaddr + PCI20000_DIO_1 )<<8; + bits |= readb(devpriv->ioaddr + PCI20000_DIO_2 )<<16; + bits |= readb(devpriv->ioaddr + PCI20000_DIO_3 )<<24; return bits; } diff --git a/comedi/drivers/me_daq.c b/comedi/drivers/me_daq.c index 1adcefc0..58daeb6f 100644 --- a/comedi/drivers/me_daq.c +++ b/comedi/drivers/me_daq.c @@ -268,8 +268,8 @@ COMEDI_INITCLEANUP(me_driver); typedef struct { struct pci_dev* pci_device; - unsigned long plx_regbase; // PLX configuration base address - unsigned long me_regbase; // Base address of the Meilhaus card + void *plx_regbase; // PLX configuration base address + void *me_regbase; // Base address of the Meilhaus card unsigned int plx_regbase_size; // Size of PLX configuration space unsigned int me_regbase_size; // Size of Meilhaus space @@ -794,7 +794,7 @@ found: plx_regbase_tmp &= PCI_BASE_ADDRESS_MEM_MASK; dev_private->plx_regbase_size = plx_regbase_size_tmp; - dev_private->plx_regbase = (unsigned int) ioremap(plx_regbase_tmp, plx_regbase_size_tmp); + dev_private->plx_regbase = ioremap(plx_regbase_tmp, plx_regbase_size_tmp); // Read Meilhaus register base address [PCI_BASE_ADDRESS #2]. @@ -809,7 +809,7 @@ found: me_regbase_tmp &= PCI_BASE_ADDRESS_MEM_MASK; dev_private->me_regbase_size = me_regbase_size_tmp; - dev_private->me_regbase = (unsigned int) ioremap(me_regbase_tmp, me_regbase_size_tmp); + dev_private->me_regbase = ioremap(me_regbase_tmp, me_regbase_size_tmp); // Download firmware and reset card if(board->device_id == ME2600_DEVICE_ID) diff --git a/comedi/drivers/mite.c b/comedi/drivers/mite.c index eddd1919..fe00bf7c 100644 --- a/comedi/drivers/mite.c +++ b/comedi/drivers/mite.c @@ -92,13 +92,23 @@ void mite_init(void) } } +static void dump_chip_signature(u32 csigr_bits) +{ + printk("mite: version = %i, type = %i, mite mode = %i, interface mode = %i\n", + mite_csigr_version(csigr_bits), mite_csigr_type(csigr_bits), + mite_csigr_mmode(csigr_bits), mite_csigr_imode(csigr_bits)); + printk("mite: num channels = %i, write post fifo depth = %i, wins = %i, iowins = %i\n", + mite_csigr_dmac(csigr_bits), mite_csigr_wpdep(csigr_bits), + mite_csigr_wins(csigr_bits), mite_csigr_iowins(csigr_bits)); +} int mite_setup(struct mite_struct *mite) { - unsigned long offset, start, length; - u32 addr; + unsigned long offset, start, length; + u32 addr; int i; - + u32 csigr_bits; + if(pci_enable_device(mite->pcidev)){ printk("error enabling mite\n"); return -EIO; @@ -140,7 +150,16 @@ int mite_setup(struct mite_struct *mite) } else writel(mite->daq_phys_addr | WENAB , mite->mite_io_addr + MITE_IODWBSR); - for( i = 0; i < NUM_MITE_DMA_CHANNELS; i++ ) { + csigr_bits = readl(mite->mite_io_addr + MITE_CSIGR); + mite->num_channels = mite_csigr_dmac(csigr_bits); + if(mite->num_channels > MAX_MITE_DMA_CHANNELS) + { + printk("mite: bug? chip claims to have %i dma channels. Setting to %i.\n", + mite->num_channels, MAX_MITE_DMA_CHANNELS); + mite->num_channels = MAX_MITE_DMA_CHANNELS; + } + dump_chip_signature(csigr_bits); + for( i = 0; i < mite->num_channels; i++ ) { writel(CHOR_DMARESET, mite->mite_io_addr + MITE_CHOR(i)); /* disable interrupts */ writel(0, mite->mite_io_addr + MITE_CHCR(i)); @@ -286,9 +305,6 @@ void mite_prep_dma( struct mite_struct *mite, unsigned int channel, * of buf_int_ptr and buf_int_count at each interrupt. A * better method is to poll the MITE before each user * "read()" to calculate the number of bytes available. - * mite_bytes_transferred(), mite_bytes_read(), and - * mite_bytes_in_transit() are provided to get the number - * of bytes transferred by the mite so far. */ chcr |= CHCR_SET_LC_IE; @@ -348,25 +364,54 @@ void mite_prep_dma( struct mite_struct *mite, unsigned int channel, MDPRINTK("exit mite_prep_dma\n"); } -unsigned int mite_bytes_read(struct mite_struct *mite, unsigned int chan) +u32 mite_device_bytes_transferred(struct mite_struct *mite, unsigned int chan) { - return readl(mite->mite_io_addr+MITE_DAR(chan)); + return readl(mite->mite_io_addr + MITE_DAR(chan)); } -unsigned int mite_bytes_in_transit(struct mite_struct *mite, unsigned int chan) +u32 mite_bytes_in_transit(struct mite_struct *mite, unsigned int chan) { return readl(mite->mite_io_addr + MITE_FCR(chan)) & 0x000000FF; } -unsigned int mite_bytes_transferred(struct mite_struct *mite, unsigned int chan) +// returns lower bound for number of bytes transferred from device to memory +u32 mite_bytes_written_to_memory_lb(struct mite_struct *mite, unsigned int chan) +{ + u32 device_byte_count; + + device_byte_count = mite_device_bytes_transferred(mite, chan); + rmb(); + return device_byte_count - mite_bytes_in_transit(mite, chan); +} + +// returns upper bound for number of bytes transferred from device to memory +u32 mite_bytes_written_to_memory_ub(struct mite_struct *mite, unsigned int chan) +{ + u32 in_transit_count; + + in_transit_count = mite_bytes_in_transit(mite, chan); + rmb(); + return mite_device_bytes_transferred(mite, chan) - in_transit_count; +} + +// returns lower bound for number of bytes read from memory for transfer to device +u32 mite_bytes_read_from_memory_lb(struct mite_struct *mite, unsigned int chan) +{ + u32 device_byte_count; + + device_byte_count = mite_device_bytes_transferred(mite, chan); + rmb(); + return device_byte_count + mite_bytes_in_transit(mite, chan); +} + +// returns upper bound for number of bytes read from memory for transfer to device +u32 mite_bytes_read_from_memory_ub(struct mite_struct *mite, unsigned int chan) { - unsigned int bytes_read; + u32 in_transit_count; - bytes_read = mite_bytes_read( mite, chan ); - /* to avoid race, we want to read bytes read before reading bytes - * in transit */ + in_transit_count = mite_bytes_in_transit(mite, chan); rmb(); - return bytes_read - mite_bytes_in_transit( mite, chan ); + return mite_device_bytes_transferred(mite, chan) + in_transit_count; } int mite_dma_tcr(struct mite_struct *mite, unsigned int channel) @@ -547,8 +592,10 @@ EXPORT_SYMBOL(mite_devices); EXPORT_SYMBOL(mite_list_devices); EXPORT_SYMBOL(mite_prep_dma); EXPORT_SYMBOL(mite_buf_change); -EXPORT_SYMBOL(mite_bytes_transferred); -EXPORT_SYMBOL(mite_bytes_read); +EXPORT_SYMBOL(mite_bytes_written_to_memory_lb); +EXPORT_SYMBOL(mite_bytes_written_to_memory_ub); +EXPORT_SYMBOL(mite_bytes_read_from_memory_lb); +EXPORT_SYMBOL(mite_bytes_read_from_memory_ub); EXPORT_SYMBOL(mite_bytes_in_transit); #ifdef DEBUG_MITE EXPORT_SYMBOL(mite_decode); diff --git a/comedi/drivers/mite.h b/comedi/drivers/mite.h index ff02017d..dd598045 100644 --- a/comedi/drivers/mite.h +++ b/comedi/drivers/mite.h @@ -39,7 +39,7 @@ #define MDPRINTK(format,args...) #endif -#define NUM_MITE_DMA_CHANNELS 4 +#define MAX_MITE_DMA_CHANNELS 4 struct mite_dma_chain{ u32 count; @@ -68,7 +68,8 @@ struct mite_struct{ unsigned long daq_phys_addr; void *daq_io_addr; - struct mite_channel channels[ NUM_MITE_DMA_CHANNELS ]; + struct mite_channel channels[MAX_MITE_DMA_CHANNELS]; + int num_channels; }; extern struct mite_struct *mite_devices; @@ -81,11 +82,6 @@ static inline unsigned int mite_device_id(struct mite_struct *mite) { return mite->pcidev->device; }; -static inline unsigned long mite_iobase(struct mite_struct *mite) -{ - return (unsigned long) mite->daq_io_addr; -}; - void mite_init(void); void mite_cleanup(void); @@ -96,9 +92,11 @@ void mite_list_devices(void); int mite_dma_tcr(struct mite_struct *mite, unsigned int channel ); void mite_dma_arm(struct mite_struct *mite, unsigned int channel ); void mite_dma_disarm(struct mite_struct *mite, unsigned int channel ); -unsigned int mite_bytes_transferred(struct mite_struct *mite, unsigned int chan); -unsigned int mite_bytes_read(struct mite_struct *mite, unsigned int chan); -unsigned int mite_bytes_in_transit(struct mite_struct *mite, unsigned int chan); +u32 mite_bytes_written_to_memory_lb(struct mite_struct *mite, unsigned int chan); +u32 mite_bytes_written_to_memory_ub(struct mite_struct *mite, unsigned int chan); +u32 mite_bytes_read_from_memory_lb(struct mite_struct *mite, unsigned int chan); +u32 mite_bytes_read_from_memory_ub(struct mite_struct *mite, unsigned int chan); +u32 mite_bytes_in_transit(struct mite_struct *mite, unsigned int chan); #if 0 unsigned long mite_ll_from_kvmem(struct mite_struct *mite,comedi_async *async,int len); @@ -201,15 +199,53 @@ enum MITE_IODWBSR_bits WENAB = 0x80, // window enable WENAB_6602 = 0x8c // window enable for 6602 boards }; + +static inline int mite_csigr_version(u32 csigr_bits) +{ + return csigr_bits & 0xf; +}; +static inline int mite_csigr_type(u32 csigr_bits) +{ // original mite = 0, minimite = 1 + return (csigr_bits >> 4) & 0xf; +}; +static inline int mite_csigr_mmode(u32 csigr_bits) +{ // mite mode, minimite = 1 + return (csigr_bits >> 8) & 0x3; +}; +static inline int mite_csigr_imode(u32 csigr_bits) +{ // cpu port interface mode, pci = 0x3 + return (csigr_bits >> 12) & 0x3; +}; +static inline int mite_csigr_dmac(u32 csigr_bits) +{ // number of dma channels + return (csigr_bits >> 16) & 0xf; +}; +static inline int mite_csigr_wpdep(u32 csigr_bits) +{ // write post fifo depth + unsigned int wpdep_bits = (csigr_bits >> 16) & 0xf; + if(wpdep_bits == 0) return 0; + else return 1 << (wpdep_bits - 1); +}; +static inline int mite_csigr_wins(u32 csigr_bits) +{ + return (csigr_bits >> 24) & 0x1f; +}; +static inline int mite_csigr_iowins(u32 csigr_bits) +{ // number of io windows + return (csigr_bits >> 29) & 0x7; +}; + enum MITE_MCR_bits { MCRPON = 0, }; + enum MITE_DCR_bits { DCR_NORMAL = (1<<29), DCRPON = 0, }; + enum MITE_CHOR_bits { CHOR_DMARESET = (1<<31), @@ -227,6 +263,7 @@ enum MITE_CHOR_bits CHOR_START = (1<<0), CHOR_PON = (CHOR_CLR_SEND_TC|CHOR_CLR_LPAUSE), }; + enum MITE_CHCR_bits { CHCR_SET_DMA_IE = (1<<31), @@ -261,6 +298,7 @@ enum MITE_CHCR_bits CHCR_LINKLONG = (5<<0), CHCRPON = (CHCR_CLR_DMA_IE | CHCR_CLR_LINKP_IE | CHCR_CLR_SAR_IE | CHCR_CLR_DONE_IE | CHCR_CLR_MRDY_IE | CHCR_CLR_DRDY_IE | CHCR_CLR_LC_IE | CHCR_CLR_CONT_RB_IE), }; + enum ConfigRegister_bits { CR_REQS_MASK = 0x7 << 16, diff --git a/comedi/drivers/multiq3.c b/comedi/drivers/multiq3.c index 83257a58..69175099 100644 --- a/comedi/drivers/multiq3.c +++ b/comedi/drivers/multiq3.c @@ -238,12 +238,11 @@ static int multiq3_attach(comedi_device * dev, comedi_devconfig * it) iobase = it->options[0]; printk("comedi%d: multiq3: 0x%04x ", dev->minor, iobase); - if (check_region(iobase, MULTIQ3_SIZE) < 0) { + if (!request_region(iobase, MULTIQ3_SIZE, "multiq3")) { printk("comedi%d: I/O port conflict\n", dev->minor); return -EIO; } - request_region(iobase, MULTIQ3_SIZE, "multiq3"); dev->iobase = iobase; irq = it->options[1]; diff --git a/comedi/drivers/ni_6527.c b/comedi/drivers/ni_6527.c index 9fc0fdc4..12885095 100644 --- a/comedi/drivers/ni_6527.c +++ b/comedi/drivers/ni_6527.c @@ -139,11 +139,11 @@ static int ni6527_di_insn_config(comedi_device *dev,comedi_subdevice *s, data[1] = interval*200; if(interval!=devpriv->filter_interval){ - writeb(interval&0xff, dev->iobase + Filter_Interval(0)); - writeb((interval>>8)&0xff, dev->iobase + Filter_Interval(1)); - writeb((interval>>16)&0x0f, dev->iobase + Filter_Interval(2)); + writeb(interval&0xff, devpriv->mite->daq_io_addr + Filter_Interval(0)); + writeb((interval>>8)&0xff, devpriv->mite->daq_io_addr + Filter_Interval(1)); + writeb((interval>>16)&0x0f, devpriv->mite->daq_io_addr + Filter_Interval(2)); - writeb(ClrInterval, dev->iobase + Clear_Register); + writeb(ClrInterval, devpriv->mite->daq_io_addr + Clear_Register); devpriv->filter_interval = interval; } @@ -153,9 +153,9 @@ static int ni6527_di_insn_config(comedi_device *dev,comedi_subdevice *s, devpriv->filter_enable &= ~(1<filter_enable, dev->iobase + Filter_Enable(0)); - writeb(devpriv->filter_enable>>8, dev->iobase + Filter_Enable(1)); - writeb(devpriv->filter_enable>>16, dev->iobase + Filter_Enable(2)); + writeb(devpriv->filter_enable, devpriv->mite->daq_io_addr + Filter_Enable(0)); + writeb(devpriv->filter_enable>>8, devpriv->mite->daq_io_addr + Filter_Enable(1)); + writeb(devpriv->filter_enable>>16, devpriv->mite->daq_io_addr + Filter_Enable(2)); return 2; } @@ -165,9 +165,9 @@ static int ni6527_di_insn_bits(comedi_device *dev,comedi_subdevice *s, { if(insn->n!=2)return -EINVAL; - data[1] = readb(dev->iobase+Port_Register(0)); - data[1] |= readb(dev->iobase+Port_Register(1))<<8; - data[1] |= readb(dev->iobase+Port_Register(2))<<16; + data[1] = readb(devpriv->mite->daq_io_addr+Port_Register(0)); + data[1] |= readb(devpriv->mite->daq_io_addr+Port_Register(1))<<8; + data[1] |= readb(devpriv->mite->daq_io_addr+Port_Register(2))<<16; return 2; } @@ -183,13 +183,13 @@ static int ni6527_do_insn_bits(comedi_device *dev,comedi_subdevice *s, /* The open relay state on the board cooresponds to 1, * but in Comedi, it is represented by 0. */ if(data[0]&0x0000ff){ - writeb((s->state^0xff),dev->iobase+Port_Register(3)); + writeb((s->state^0xff),devpriv->mite->daq_io_addr+Port_Register(3)); } if(data[0]&0x00ff00){ - writeb((s->state>>8)^0xff,dev->iobase+Port_Register(4)); + writeb((s->state>>8)^0xff,devpriv->mite->daq_io_addr+Port_Register(4)); } if(data[0]&0xff0000){ - writeb((s->state>>16)^0xff,dev->iobase+Port_Register(5)); + writeb((s->state>>16)^0xff,devpriv->mite->daq_io_addr+Port_Register(5)); } } data[1] = s->state; @@ -203,11 +203,11 @@ static irqreturn_t ni6527_interrupt(int irq, void *d, struct pt_regs *regs) comedi_subdevice *s = dev->subdevices + 2; unsigned int status; - status = readb(dev->iobase + Change_Status); + status = readb(devpriv->mite->daq_io_addr + Change_Status); if((status & MasterInterruptStatus) == 0) return IRQ_NONE; if((status & EdgeStatus) == 0) return IRQ_NONE; - writeb(ClrEdge | ClrOverflow, dev->iobase + Clear_Register); + writeb(ClrEdge | ClrOverflow, devpriv->mite->daq_io_addr + Clear_Register); comedi_buf_put(s->async, 0); s->async->events |= COMEDI_CB_EOS; @@ -286,17 +286,17 @@ static int ni6527_intr_cmd(comedi_device *dev,comedi_subdevice *s) { //comedi_cmd *cmd = &s->async->cmd; - writeb(ClrEdge|ClrOverflow, dev->iobase + Clear_Register); + writeb(ClrEdge|ClrOverflow, devpriv->mite->daq_io_addr + Clear_Register); writeb(FallingEdgeIntEnable|RisingEdgeIntEnable| MasterInterruptEnable|EdgeIntEnable, - dev->iobase + Master_Interrupt_Control); + devpriv->mite->daq_io_addr + Master_Interrupt_Control); return 0; } static int ni6527_intr_cancel(comedi_device *dev,comedi_subdevice *s) { - writeb(0x00, dev->iobase + Master_Interrupt_Control); + writeb(0x00, devpriv->mite->daq_io_addr + Master_Interrupt_Control); return 0; } @@ -316,13 +316,13 @@ static int ni6527_intr_insn_config(comedi_device *dev, comedi_subdevice *s, if(insn->n < 1)return -EINVAL; if(data[0] != INSN_CONFIG_CHANGE_NOTIFY)return -EINVAL; - writeb(data[1], dev->iobase + Rising_Edge_Detection_Enable(0)); - writeb(data[1]>>8, dev->iobase + Rising_Edge_Detection_Enable(1)); - writeb(data[1]>>16, dev->iobase + Rising_Edge_Detection_Enable(2)); + writeb(data[1], devpriv->mite->daq_io_addr + Rising_Edge_Detection_Enable(0)); + writeb(data[1]>>8, devpriv->mite->daq_io_addr + Rising_Edge_Detection_Enable(1)); + writeb(data[1]>>16, devpriv->mite->daq_io_addr + Rising_Edge_Detection_Enable(2)); - writeb(data[2], dev->iobase + Falling_Edge_Detection_Enable(0)); - writeb(data[2]>>8, dev->iobase + Falling_Edge_Detection_Enable(1)); - writeb(data[2]>>16, dev->iobase + Falling_Edge_Detection_Enable(2)); + writeb(data[2], devpriv->mite->daq_io_addr + Falling_Edge_Detection_Enable(0)); + writeb(data[2]>>8, devpriv->mite->daq_io_addr + Falling_Edge_Detection_Enable(1)); + writeb(data[2]>>16, devpriv->mite->daq_io_addr + Falling_Edge_Detection_Enable(2)); return 2; } @@ -347,13 +347,12 @@ static int ni6527_attach(comedi_device *dev,comedi_devconfig *it) printk("error setting up mite\n"); return ret; } - dev->iobase = mite_iobase(devpriv->mite); dev->board_name=this_board->name; dev->irq=mite_irq(devpriv->mite); printk(" %s",dev->board_name); - printk(" ID=0x%02x", readb(dev->iobase + ID_Register)); + printk(" ID=0x%02x", readb(devpriv->mite->daq_io_addr + ID_Register)); if((ret=alloc_subdevices(dev,3))<0) return ret; @@ -388,13 +387,13 @@ static int ni6527_attach(comedi_device *dev,comedi_devconfig *it) s->insn_bits = ni6527_intr_insn_bits; s->insn_config = ni6527_intr_insn_config; - writeb(0x00, dev->iobase + Filter_Enable(0)); - writeb(0x00, dev->iobase + Filter_Enable(1)); - writeb(0x00, dev->iobase + Filter_Enable(2)); + writeb(0x00, devpriv->mite->daq_io_addr + Filter_Enable(0)); + writeb(0x00, devpriv->mite->daq_io_addr + Filter_Enable(1)); + writeb(0x00, devpriv->mite->daq_io_addr + Filter_Enable(2)); writeb(ClrEdge|ClrOverflow|ClrFilter|ClrInterval, - dev->iobase + Clear_Register); - writeb(0x00, dev->iobase + Master_Interrupt_Control); + devpriv->mite->daq_io_addr + Clear_Register); + writeb(0x00, devpriv->mite->daq_io_addr + Master_Interrupt_Control); ret=comedi_request_irq(dev->irq,ni6527_interrupt,SA_SHIRQ,"ni6527",dev); if(ret<0){ @@ -409,8 +408,8 @@ static int ni6527_attach(comedi_device *dev,comedi_devconfig *it) static int ni6527_detach(comedi_device *dev) { - if(dev->iobase){ - writeb(0x00, dev->iobase + Master_Interrupt_Control); + if(devpriv && devpriv->mite && devpriv->mite->daq_io_addr){ + writeb(0x00, devpriv->mite->daq_io_addr + Master_Interrupt_Control); } if(dev->irq){ diff --git a/comedi/drivers/ni_660x.c b/comedi/drivers/ni_660x.c index 281a6659..de024226 100644 --- a/comedi/drivers/ni_660x.c +++ b/comedi/drivers/ni_660x.c @@ -729,7 +729,6 @@ static int ni_660x_attach(comedi_device *dev,comedi_devconfig *it) printk("error setting up mite\n"); return ret; } - dev->iobase = mite_iobase(devpriv->mite); dev->board_name = thisboard->name; /* we don't support the interrupt yet */ //dev->irq = mite_irq(devpriv->mite); @@ -850,7 +849,7 @@ ni_660x_GPCT_rinsn(comedi_device *dev, comedi_subdevice *s, value is */ int tmpdata[2]; - unsigned long address; + void *address; /* ============================================================ */ /* 1 subdevice with 8 channels, differentation based on channel */ @@ -865,9 +864,9 @@ ni_660x_GPCT_rinsn(comedi_device *dev, comedi_subdevice *s, return -EINVAL; } // Now proceed with reading data - address = dev->iobase - + GPCT_OFFSET[chipset] + - registerData[GxSWSaveRegister(counter_channel)].offset; + address = devpriv->mite->daq_io_addr + + GPCT_OFFSET[chipset] + + registerData[GxSWSaveRegister(counter_channel)].offset; for ( i=0 ; i < insn->n ; i++ ) { tmpdata[0] = readl(address); @@ -902,10 +901,10 @@ static void init_tio_chip(comedi_device *dev, int chipset) it will try to use the same pins as the first chip. */ if(chipset) - writel(CounterSwap,dev->iobase + GPCT_OFFSET[1] + writel(CounterSwap,devpriv->mite->daq_io_addr + GPCT_OFFSET[1] + registerData[ClockConfigRegister].offset); else - writel(0,dev->iobase + GPCT_OFFSET[0] + writel(0,devpriv->mite->daq_io_addr + GPCT_OFFSET[0] + registerData[ClockConfigRegister].offset); } @@ -970,16 +969,16 @@ ni_660x_GPCT_insn_config(comedi_device *dev, comedi_subdevice *s, (ni_660x_gpct_config[subdev_channel]).data[2] = 0; // Reset the counter - writew(GxReset(counter_channel),dev->iobase + GPCT_OFFSET[chipset] + writew(GxReset(counter_channel),devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxxJointResetRegister(counter_channel)].offset); // Disarm - writew(Disarm,dev->iobase + GPCT_OFFSET[chipset] + writew(Disarm,devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxCommandRegister(counter_channel)].offset); // Put 0 as initial counter value in the load register - writel(0x0,dev->iobase + GPCT_OFFSET[chipset] + writel(0x0,devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxLoadARegister(counter_channel)].offset); // Load (latch) this value into the counter - writew(Load,dev->iobase + GPCT_OFFSET[chipset] + writew(Load,devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxCommandRegister(counter_channel)].offset); /* - Set Counting Mode into GPCT_X1 / 2 / 4 (as set by user) - When to take into account index pulse (as set by user) @@ -988,17 +987,17 @@ ni_660x_GPCT_insn_config(comedi_device *dev, comedi_subdevice *s, writew(((ni_660x_gpct_config[subdev_channel]).data[0] | (ni_660x_gpct_config[subdev_channel]).data[1] | (ni_660x_gpct_config[subdev_channel]).data[2] ), - dev->iobase + GPCT_OFFSET[chipset] + devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxCountingModeRegister(counter_channel)].offset); // Put counter in input mode // Not necessary since this is the default ... - /* writel(Counter_A_Is_Input, dev->iobase + /* writel(Counter_A_Is_Input, devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[IOConfigReg36_39].offset); */ // Arm the counter and put it into Hardware UpDown mode (depending // on the UP/DOWN IO pin: 0 = down - writew(UpDownHardware|Arm,dev->iobase + GPCT_OFFSET[chipset] + writew(UpDownHardware|Arm,devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxCommandRegister(counter_channel)].offset); break; case INSN_CONFIG_GPCT_SINGLE_PULSE_GENERATOR: @@ -1021,21 +1020,21 @@ ni_660x_GPCT_insn_config(comedi_device *dev, comedi_subdevice *s, return -EINVAL; } // Reset the counter - writew(GxReset(counter_channel), dev->iobase + GPCT_OFFSET[chipset] + writew(GxReset(counter_channel), devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxxJointResetRegister(counter_channel)].offset); // Disarm - writew(Disarm, dev->iobase + GPCT_OFFSET[chipset] + writew(Disarm, devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxCommandRegister(counter_channel)].offset); /* Put PULSE_DELAY as initial counter value into load register A */ - writel((ni_660x_gpct_config[subdev_channel]).data[1], dev->iobase + writel((ni_660x_gpct_config[subdev_channel]).data[1], devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxLoadARegister(counter_channel)].offset); // Load (latch) this value into the counter - writew(Load,dev->iobase + GPCT_OFFSET[chipset] + writew(Load,devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxCommandRegister(counter_channel)].offset); // Now Put PULSE_WIDTH in the LOAD register A - writel((ni_660x_gpct_config[subdev_channel]).data[0],dev->iobase + writel((ni_660x_gpct_config[subdev_channel]).data[0],devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxLoadARegister(counter_channel)].offset); // Put Source input to internal 20 MHz clock @@ -1043,7 +1042,7 @@ ni_660x_GPCT_insn_config(comedi_device *dev, comedi_subdevice *s, TODO: MAKE THIS A DATA FIELD!! to allow different clocks (See TODO) ================================================== */ - writew(SourceSelectTimebase1, dev->iobase + writew(SourceSelectTimebase1, devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxInputSelectRegister(counter_channel)].offset); /* Choose to Load on reaching TC and @@ -1051,10 +1050,10 @@ ni_660x_GPCT_insn_config(comedi_device *dev, comedi_subdevice *s, Stop counting after second TC Choose Load register A to load from */ writew(LoadOnTC | OutputTogglesOnTC | StopOn2ndTC | LoadSourceSelectA, - dev->iobase + GPCT_OFFSET[chipset] + devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxModeRegister(counter_channel)].offset); // Configure Counter for output - writel(pin_is_output(0), dev->iobase + writel(pin_is_output(0), devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[IOConfigReg(chipset, counter_channel)].offset); case INSN_CONFIG_GPCT_PULSE_TRAIN_GENERATOR: @@ -1082,29 +1081,29 @@ ni_660x_GPCT_insn_config(comedi_device *dev, comedi_subdevice *s, return -EINVAL; } // Reset the counter - writew(GxReset(counter_channel),dev->iobase + GPCT_OFFSET[chipset] + writew(GxReset(counter_channel),devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxxJointResetRegister(counter_channel)].offset); // Disarm counter - writew(Disarm,dev->iobase + GPCT_OFFSET[chipset] + writew(Disarm,devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxCommandRegister(counter_channel)].offset); // Put PULSE_WIDTH as initial counter value into load register A - writel((ni_660x_gpct_config[subdev_channel]).data[0],dev->iobase + writel((ni_660x_gpct_config[subdev_channel]).data[0],devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxLoadARegister(counter_channel)].offset); // Load (latch) this value into the counter - writew(Load,dev->iobase + GPCT_OFFSET[chipset] + writew(Load,devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxCommandRegister(counter_channel)].offset); // Now Put (PULSE_PERIOD - PULSE_WIDTH) in the load register B writel((ni_660x_gpct_config[subdev_channel]).data[1] - (ni_660x_gpct_config[subdev_channel]).data[0], - dev->iobase + GPCT_OFFSET[chipset] + devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxLoadBRegister(counter_channel)].offset); // Put Source input to internal 20 MHz clock /* ================================================== TODO: MAKE THIS A DATA FIELD!! to allow different clocks (See TODO) ================================================== */ - writew(SourceSelectTimebase1,dev->iobase + writew(SourceSelectTimebase1,devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxInputSelectRegister(counter_channel)].offset); /* Switch between Load registers everytime @@ -1112,14 +1111,14 @@ ni_660x_GPCT_insn_config(comedi_device *dev, comedi_subdevice *s, Change State of G_OUT on TC (Terminal Count) Choose Load register A to load from */ writew(ReloadSourceSwitching|LoadOnTC|OutputTogglesOnTC, - dev->iobase + GPCT_OFFSET[chipset] + devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxModeRegister(counter_channel)].offset); // Configure Counter for output - writel(pin_is_output(0), dev->iobase + writel(pin_is_output(0), devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[IOConfigReg(chipset, counter_channel)].offset); // Arm the counter and tell it to count down - writew(Arm|UpDownDown,dev->iobase + GPCT_OFFSET[chipset] + writew(Arm|UpDownDown,devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxCommandRegister(counter_channel)].offset); break; case GPCT_SIMPLE_EVENT: @@ -1128,41 +1127,41 @@ ni_660x_GPCT_insn_config(comedi_device *dev, comedi_subdevice *s, CountingAndTimeMeasurement; // Reset the counter writew(GxReset(counter_channel), - dev->iobase + GPCT_OFFSET[chipset] + registerData[ + devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[ GxxJointResetRegister(counter_channel)].offset); // Disarm writew(Disarm, - dev->iobase + GPCT_OFFSET[chipset] + registerData[ + devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[ GxCommandRegister(counter_channel)].offset); // Put 0 as initial counter value in the load register writel(0x0, - dev->iobase + GPCT_OFFSET[chipset] + registerData[ + devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[ GxLoadARegister(counter_channel)].offset); // Load (latch) this value into the counter writew(Load, - dev->iobase + GPCT_OFFSET[chipset] + registerData[ + devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[ GxCommandRegister(counter_channel)].offset); // Set gate logic low, & select source pin dedicated to channel writew(GateSelectLogicLow|SourceSelectSourcePinI, - dev->iobase + GPCT_OFFSET[chipset] + registerData[ + devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[ GxInputSelectRegister(counter_channel)].offset); // Disable gate for simple event counting writew(GatingModeDisabled, - dev->iobase + GPCT_OFFSET[chipset] + registerData[ + devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[ GxModeRegister(counter_channel)].offset); // Use normal counting mode (instead of synchronous) writew(CountingModeNormal, - dev->iobase + GPCT_OFFSET[chipset] + registerData[ + devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[ GxCountingModeRegister(counter_channel)].offset ); // Put counter in input mode // Not necessary since this is the default ... /* writel(Counter_A_Is_Input, //NOT WORKING -- REFER KG's file. - * dev->iobase + GPCT_OFFSET[chipset] + registerData[ + * devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[ * IOConfigReg36_39].offset); */ // Arm the counter and put it into always counting up mode writew(UpDownUp|Arm, - dev->iobase + GPCT_OFFSET[chipset] + registerData[ + devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[ GxCommandRegister(counter_channel)].offset); break; default: @@ -1189,22 +1188,22 @@ static int ni_660x_GPCT_winsn(comedi_device *dev, { case PositionMeasurement: // Disarm the counter - writew(Disarm, dev->iobase + GPCT_OFFSET[chipset] + writew(Disarm, devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxCommandRegister(counter_channel)].offset); // Write the value into the load register - writel(*data, dev->iobase + GPCT_OFFSET[chipset] + writel(*data, devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxLoadARegister(counter_channel)].offset); // Latch the value into the counter - writew(Load, dev->iobase + GPCT_OFFSET[chipset] + writew(Load, devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxCommandRegister(counter_channel)].offset); // Arm the counter again and put UpDownHardware in! - writew(UpDownHardware|Arm, dev->iobase + GPCT_OFFSET[chipset] + writew(UpDownHardware|Arm, devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxCommandRegister(counter_channel)].offset); break; case SinglePulseGeneration: DPRINTK("NI_660X: INSN_WRITE: SPG: Arming the counter\n"); // Tell the counter to count down and arm - writew(Arm|UpDownDown, dev->iobase + GPCT_OFFSET[chipset] + writew(Arm|UpDownDown, devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxCommandRegister(counter_channel)].offset); break; case PulseTrainGeneration: @@ -1227,13 +1226,13 @@ static int ni_660x_GPCT_winsn(comedi_device *dev, return -EINVAL; } // Put PULSE_WIDTH as initial counter value into load register A - writel((ni_660x_gpct_config[subdev_channel]).data[0],dev->iobase + writel((ni_660x_gpct_config[subdev_channel]).data[0],devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxLoadARegister(counter_channel)].offset); // Put (PULSE_PERIOD - PULSE_WIDTH) in the load register B writel( (ni_660x_gpct_config[subdev_channel]).data[1] - (ni_660x_gpct_config[subdev_channel]).data[0], - dev->iobase + GPCT_OFFSET[chipset] + devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxLoadBRegister(counter_channel)].offset); break; default: // Impossible @@ -1260,7 +1259,7 @@ static int ni_660x_GPCT_inttrig(comedi_device *dev, DPRINTK("Triggering channel %d\n", subdev_channel); // Reset the counter - writew(GxReset(counter_channel),dev->iobase + GPCT_OFFSET[chipset] + writew(GxReset(counter_channel),devpriv->mite->daq_io_addr + GPCT_OFFSET[chipset] + registerData[GxxJointResetRegister(counter_channel)].offset); return 0; } @@ -1309,11 +1308,11 @@ static int ni_660x_dio_insn_bits(comedi_device *dev, s->state |= data[0]&data[1]; /* Write out the new digital output lines */ /* Check if data < n_chan ?? */ - writew(s->state,dev->iobase + registerData[STCDIOOutput].offset); + writew(s->state,devpriv->mite->daq_io_addr + registerData[STCDIOOutput].offset); } /* on return, data[1] contains the value of the digital * input and output lines. */ - data[1]=readw(dev->iobase + registerData[STCDIOParallelInput].offset); + data[1]=readw(devpriv->mite->daq_io_addr + registerData[STCDIOParallelInput].offset); return 2; } @@ -1345,7 +1344,7 @@ static int ni_660x_dio_insn_config(comedi_device *dev, break; }; // No GPCT_OFFSET[chipset] offset here?? - writew(s->io_bits,dev->iobase + registerData[STCDIOControl].offset); + writew(s->io_bits,devpriv->mite->daq_io_addr + registerData[STCDIOControl].offset); /* Should we do also something with the IO configuration registers, see p 3-38 of register level prog. manual */ diff --git a/comedi/drivers/ni_670x.c b/comedi/drivers/ni_670x.c index 7d29bbd8..de38ab00 100644 --- a/comedi/drivers/ni_670x.c +++ b/comedi/drivers/ni_670x.c @@ -152,7 +152,6 @@ static int ni_670x_attach(comedi_device *dev,comedi_devconfig *it) printk("error setting up mite\n"); return ret; } - dev->iobase=mite_iobase(devpriv->mite); dev->board_name=thisboard->name; dev->irq=mite_irq(devpriv->mite); printk(" %s",dev->board_name); @@ -189,8 +188,8 @@ static int ni_670x_attach(comedi_device *dev,comedi_devconfig *it) s->insn_bits = ni_670x_dio_insn_bits; s->insn_config = ni_670x_dio_insn_config; - writel(0x10 ,dev->iobase + MISC_CONTROL_OFFSET); /* Config of misc registers */ - writel(0x00 ,dev->iobase + AO_CONTROL_OFFSET); /* Config of ao registers */ + writel(0x10 ,devpriv->mite->daq_io_addr + MISC_CONTROL_OFFSET); /* Config of misc registers */ + writel(0x00 ,devpriv->mite->daq_io_addr + AO_CONTROL_OFFSET); /* Config of ao registers */ printk("attached\n"); @@ -235,8 +234,8 @@ static int ni_670x_ao_winsn(comedi_device *dev,comedi_subdevice *s,comedi_insn * for(i=0;in;i++){ writel(((chan&15)<<1) | ((chan&16)>>4), - dev->iobase + AO_CHAN_OFFSET); /* First write in channel register which channel to use */ - writel(data[i],dev->iobase + AO_VALUE_OFFSET); /* write channel value */ + devpriv->mite->daq_io_addr + AO_CHAN_OFFSET); /* First write in channel register which channel to use */ + writel(data[i],devpriv->mite->daq_io_addr + AO_VALUE_OFFSET); /* write channel value */ devpriv->ao_readback[chan] = data[i]; } @@ -264,12 +263,12 @@ static int ni_670x_dio_insn_bits(comedi_device *dev,comedi_subdevice *s,comedi_i { s->state &= ~data[0]; s->state |= data[0]&data[1]; - writel(s->state,dev->iobase + DIO_PORT0_DATA_OFFSET); + writel(s->state,devpriv->mite->daq_io_addr + DIO_PORT0_DATA_OFFSET); } /* on return, data[1] contains the value of the digital * input lines. */ - data[1]=readl(dev->iobase + DIO_PORT0_DATA_OFFSET); + data[1]=readl(devpriv->mite->daq_io_addr + DIO_PORT0_DATA_OFFSET); return 2; } @@ -294,7 +293,7 @@ static int ni_670x_dio_insn_config(comedi_device *dev,comedi_subdevice *s,comedi return -EINVAL; break; } - writel(s->io_bits,dev->iobase + DIO_PORT0_DIR_OFFSET); + writel(s->io_bits,devpriv->mite->daq_io_addr + DIO_PORT0_DIR_OFFSET); return insn->n; } diff --git a/comedi/drivers/ni_at_a2150.c b/comedi/drivers/ni_at_a2150.c index 77559c1c..cf421d55 100644 --- a/comedi/drivers/ni_at_a2150.c +++ b/comedi/drivers/ni_at_a2150.c @@ -365,12 +365,11 @@ static int a2150_attach(comedi_device *dev, comedi_devconfig *it) } /* check if io addresses are available */ - if(check_region(iobase, A2150_SIZE) < 0) + if(!request_region(iobase, A2150_SIZE, driver_a2150.driver_name)) { printk(" I/O port conflict\n"); return -EIO; } - request_region(iobase, A2150_SIZE, driver_a2150.driver_name); dev->iobase = iobase; /* grab our IRQ */ diff --git a/comedi/drivers/ni_at_ao.c b/comedi/drivers/ni_at_ao.c index 5f0e57d8..0e084ee2 100644 --- a/comedi/drivers/ni_at_ao.c +++ b/comedi/drivers/ni_at_ao.c @@ -216,11 +216,10 @@ static int atao_attach(comedi_device *dev,comedi_devconfig *it) printk("comedi%d: ni_at_ao: 0x%04lx",dev->minor,iobase); - if(check_region(iobase, ATAO_SIZE) < 0){ + if(!request_region(iobase, ATAO_SIZE, "ni_at_ao")){ printk(" I/O port conflict\n"); return -EIO; } - request_region(iobase, ATAO_SIZE, "ni_at_ao"); dev->iobase = iobase; //dev->board_ptr = atao_probe(dev); diff --git a/comedi/drivers/ni_atmio.c b/comedi/drivers/ni_atmio.c index 1ac604bd..b642dedf 100644 --- a/comedi/drivers/ni_atmio.c +++ b/comedi/drivers/ni_atmio.c @@ -165,7 +165,7 @@ static ni_board ni_boards[]={ has_8255: 0, }, { device_id: 37, - isapnp_id: 0x0000, /* XXX unknown */ + isapnp_id: 0x2500, name: "at-mio-16de-10", n_adchan: 16, adbits: 12, @@ -177,7 +177,7 @@ static ni_board ni_boards[]={ aobits: 12, ao_fifo_depth: 0, ao_unipolar: 1, - caldac: {mb88341}, + caldac: {ad8804_debug}, has_8255: 1, }, { device_id: 38, @@ -311,8 +311,10 @@ static inline unsigned short __win_in(comedi_device *dev, int addr) #ifdef __ISAPNP__ static struct isapnp_device_id device_ids[] = { - { ISAPNP_DEVICE_SINGLE('N','I','C',0x1900,'N','I','C',0x0000), }, + { ISAPNP_DEVICE_SINGLE('N','I','C',0x1900,'N','I','C',0x1900), }, { ISAPNP_DEVICE_SINGLE('N','I','C',0x2400,'N','I','C',0x2400), }, + { ISAPNP_DEVICE_SINGLE('N','I','C',0x2500,'N','I','C',0x2500), }, + { ISAPNP_DEVICE_SINGLE('N','I','C',0x2600,'N','I','C',0x2600), }, { ISAPNP_DEVICE_SINGLE('N','I','C',0x2700,'N','I','C',0x2700), }, { ISAPNP_DEVICE_SINGLE_END, }, }; @@ -434,11 +436,10 @@ static int ni_atmio_attach(comedi_device *dev,comedi_devconfig *it) /* reserve our I/O region */ printk("comedi%d: ni_atmio: 0x%04x",dev->minor,iobase); - if(check_region(iobase,NI_SIZE)<0){ + if(!request_region(iobase,NI_SIZE,"ni_atmio")){ printk(" I/O port conflict\n"); return -EIO; } - request_region(iobase,NI_SIZE,"ni_atmio"); dev->iobase=iobase; diff --git a/comedi/drivers/ni_atmio16d.c b/comedi/drivers/ni_atmio16d.c index cd38a0a5..0dd3fc95 100644 --- a/comedi/drivers/ni_atmio16d.c +++ b/comedi/drivers/ni_atmio16d.c @@ -706,11 +706,10 @@ static int atmio16d_attach(comedi_device * dev, comedi_devconfig * it) /* make sure the address range is free and allocate it */ iobase = it->options[0]; printk("comedi%d: atmio16d: 0x%04x ", dev->minor, iobase); - if (check_region(iobase, ATMIO16D_SIZE) < 0) { + if (!request_region(iobase, ATMIO16D_SIZE, "ni_atmio16d")) { printk("I/O port conflict\n"); return -EIO; } - request_region(iobase, ATMIO16D_SIZE, "ni_atmio16d"); dev->iobase = iobase; @@ -731,7 +730,10 @@ static int atmio16d_attach(comedi_device * dev, comedi_devconfig * it) if(irq>0){ if((ret=comedi_request_irq(irq,atmio16d_interrupt, 0, "atmio16d", dev))<0) + { + printk("failed to allocate irq %d\n", irq); return ret; + } dev->irq=irq; printk("( irq = %d )\n",irq); } else if(irq == 0){ diff --git a/comedi/drivers/ni_daq_dio24.c b/comedi/drivers/ni_daq_dio24.c index 8f1ca35d..788e99eb 100644 --- a/comedi/drivers/ni_daq_dio24.c +++ b/comedi/drivers/ni_daq_dio24.c @@ -43,6 +43,7 @@ the PCMCIA interface. #include #include +#include #include "8255.h" @@ -91,6 +92,12 @@ static dio24_board dio24_boards[] = bustype: pcmcia_bustype, have_dio: 1, }, + { + name: "ni_daq_dio24", + device_id: 0x475c, // 0x10b is manufacturer id, 0x475c is device id + bustype: pcmcia_bustype, + have_dio: 1, + }, }; /* @@ -361,11 +368,13 @@ static dev_link_t *dio24_cs_attach(void) pcmcia_dev_list = link; client_reg.dev_info = &dev_info; client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE; - client_reg.EventMask = - CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | - CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | - CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME; - client_reg.event_handler = &dio24_event; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) + client_reg.EventMask = + CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | + CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | + CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME; + client_reg.event_handler = &dio24_event; +#endif client_reg.Version = 0x0210; client_reg.event_callback_args.client_data = link; ret = pcmcia_register_client(&link->handle, &client_reg); @@ -778,8 +787,11 @@ static int dio24_event(event_t event, int priority, struct pcmcia_driver dio24_cs_driver = { - .attach = dio24_cs_attach, - .detach = dio24_cs_detach, + .attach = &dio24_cs_attach, + .detach = &dio24_cs_detach, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) + .event = &dio24_event, +#endif .owner = THIS_MODULE, .drv = { .name = "ni_daq_dio24", diff --git a/comedi/drivers/ni_labpc.c b/comedi/drivers/ni_labpc.c index 9b568024..494807bc 100644 --- a/comedi/drivers/ni_labpc.c +++ b/comedi/drivers/ni_labpc.c @@ -339,11 +339,11 @@ static inline void labpc_outb(unsigned int byte, unsigned long address) } static inline unsigned int labpc_readb(unsigned long address) { - return readb(address); + return readb((void*) address); } static inline void labpc_writeb(unsigned int byte, unsigned long address) { - writeb(byte, address); + writeb(byte, (void*) address); } static labpc_board labpc_boards[] = @@ -460,7 +460,7 @@ static inline int labpc_counter_load(comedi_device *dev, unsigned long base_addr unsigned int counter_number, unsigned int count, unsigned int mode) { if(thisboard->memory_mapped_io) - return i8254_mm_load(base_address, counter_number, count, mode); + return i8254_mm_load((void*)base_address, counter_number, count, mode); else return i8254_load(base_address, counter_number, count, mode); } @@ -494,12 +494,11 @@ int labpc_common_attach( comedi_device *dev, unsigned long iobase, if(thisboard->bustype == isa_bustype) { /* check if io addresses are available */ - if(check_region(iobase, LABPC_SIZE) < 0) + if(!request_region(iobase, LABPC_SIZE, driver_labpc.driver_name)) { printk("I/O port conflict\n"); return -EIO; } - request_region(iobase, LABPC_SIZE, driver_labpc.driver_name); } dev->iobase = iobase; @@ -699,7 +698,7 @@ static int labpc_attach(comedi_device *dev, comedi_devconfig *it) } ret = mite_setup(devpriv->mite); if(ret < 0) return ret; - iobase = mite_iobase(devpriv->mite); + iobase = (unsigned long) devpriv->mite->daq_io_addr; irq = mite_irq(devpriv->mite); break; case pcmcia_bustype: @@ -1803,11 +1802,11 @@ static int labpc_dio_mem_callback(int dir, int port, int data, unsigned long iob { if(dir) { - writeb(data, iobase + port); + writeb(data, (void*) (iobase + port)); return 0; }else { - return readb(iobase + port); + return readb((void*)(iobase + port)); } } diff --git a/comedi/drivers/ni_labpc_cs.c b/comedi/drivers/ni_labpc_cs.c index f34f69fe..3c22f3f7 100644 --- a/comedi/drivers/ni_labpc_cs.c +++ b/comedi/drivers/ni_labpc_cs.c @@ -64,6 +64,7 @@ NI manuals: #include #include +#include #include "8253.h" #include "8255.h" @@ -99,13 +100,13 @@ static int labpc_attach(comedi_device *dev,comedi_devconfig *it); static comedi_driver driver_labpc_cs = { - driver_name: "ni_labpc_cs", - module: THIS_MODULE, - attach: labpc_attach, - detach: labpc_common_detach, - num_names: sizeof(labpc_cs_boards) / sizeof(labpc_board), - board_name: (char **)labpc_cs_boards, - offset: sizeof(labpc_board), + .driver_name = "ni_labpc_cs", + .module = THIS_MODULE, + .attach = &labpc_attach, + .detach = &labpc_common_detach, + .num_names = sizeof(labpc_cs_boards) / sizeof(labpc_board), + .board_name = (char **)labpc_cs_boards, + .offset = sizeof(labpc_board), }; static int labpc_attach(comedi_device *dev, comedi_devconfig *it) @@ -299,12 +300,14 @@ static dev_link_t *labpc_cs_attach(void) pcmcia_dev_list = link; client_reg.dev_info = &dev_info; client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE; - client_reg.EventMask = - CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | - CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | - CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME; - client_reg.event_handler = &labpc_event; - client_reg.Version = 0x0210; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) + client_reg.EventMask = + CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | + CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | + CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME; + client_reg.event_handler = &labpc_event; +#endif + client_reg.Version = 0x0210; client_reg.event_callback_args.client_data = link; ret = pcmcia_register_client(&link->handle, &client_reg); if (ret != CS_SUCCESS) { @@ -709,6 +712,9 @@ struct pcmcia_driver labpc_cs_driver = { .attach = labpc_cs_attach, .detach = labpc_cs_detach, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) + .event = &labpc_event, +#endif .owner = THIS_MODULE, .drv = { .name = "daqcard-1200", diff --git a/comedi/drivers/ni_mio_common.c b/comedi/drivers/ni_mio_common.c index 502eaba0..06e505b9 100644 --- a/comedi/drivers/ni_mio_common.c +++ b/comedi/drivers/ni_mio_common.c @@ -410,13 +410,9 @@ static void ni_sync_ai_dma(struct mite_struct *mite, comedi_device *dev) // write alloc as much as we can comedi_buf_write_alloc(s->async, s->async->prealloc_bufsz); - nbytes = mite_bytes_transferred(mite, AI_DMA_CHAN); + nbytes = mite_bytes_written_to_memory_lb(mite, AI_DMA_CHAN); rmb(); - /* We use mite_bytes_read() for the overrun check - * because it returns an upper bound, and mite_bytes_transferred - * returns a lower bound on the number of bytes actually - * transferred */ - if( (int)(mite_bytes_read(mite, AI_DMA_CHAN) - old_alloc_count) > 0 ){ + if( (int)(mite_bytes_written_to_memory_ub(mite, AI_DMA_CHAN) - old_alloc_count) > 0 ){ printk("ni_mio_common: DMA overwrite of free area\n"); ni_ai_reset(dev,s); async->events |= COMEDI_CB_OVERFLOW; @@ -445,29 +441,35 @@ static void mite_handle_b_linkc(struct mite_struct *mite, comedi_device *dev) int count; comedi_subdevice *s = dev->subdevices + 1; comedi_async *async = s->async; - unsigned int nbytes, new_write_count; - + u32 nbytes_ub, nbytes_lb; + unsigned int new_write_count; + u32 stop_count = async->cmd.stop_arg * sizeof(sampl_t); + writel(CHOR_CLRLC, mite->mite_io_addr + MITE_CHOR(AO_DMA_CHAN)); new_write_count = async->buf_write_count; - - nbytes = mite_bytes_read(mite, AO_DMA_CHAN); - if( async->cmd.stop_src == TRIG_COUNT && - (int) (nbytes - async->cmd.stop_arg * sizeof( sampl_t ) ) > 0 ) - nbytes = async->cmd.stop_arg * sizeof( sampl_t ); - if( (int)(nbytes - devpriv->last_buf_write_count) > 0 ){ + mb(); + nbytes_lb = mite_bytes_read_from_memory_lb(mite, AO_DMA_CHAN); + if(async->cmd.stop_src == TRIG_COUNT && + (int) (nbytes_lb - stop_count) > 0) + nbytes_lb = stop_count; + mb(); + nbytes_ub = mite_bytes_read_from_memory_ub(mite, AO_DMA_CHAN); + if(async->cmd.stop_src == TRIG_COUNT && + (int) (nbytes_ub - stop_count) > 0) + nbytes_ub = stop_count; + if((int)(nbytes_ub - devpriv->last_buf_write_count) > 0){ rt_printk("ni_mio_common: DMA underrun\n"); ni_ao_reset(dev,s); async->events |= COMEDI_CB_OVERFLOW; return; } - + mb(); devpriv->last_buf_write_count = new_write_count; - count = nbytes - async->buf_read_count; - if( count < 0 ){ - rt_printk("ni_mio_common: BUG: negative ao count\n"); - count = 0; + count = nbytes_lb - async->buf_read_count; + if(count < 0){ + return; } comedi_buf_read_free(async, count); @@ -2248,6 +2250,8 @@ static int ni_ao_cmd(comedi_device *dev,comedi_subdevice *s) AO_TMRDACWR_Pulse_Width; if( boardtype.ao_fifo_depth ) bits |= AO_FIFO_Enable; + else + bits |= AO_DMA_PIO_Control; win_out(bits, AO_Personal_Register); // enable sending of ao dma requests win_out(AO_AOFREQ_Enable, AO_Start_Select_Register); @@ -2373,7 +2377,7 @@ static int ni_ao_reset(comedi_device *dev,comedi_subdevice *s) win_out(AO_Configuration_Start,Joint_Reset_Register); win_out(AO_Disarm,AO_Command_1_Register); ni_set_bits(dev,Interrupt_B_Enable_Register,~0,0); - win_out(0x0010,AO_Personal_Register); + win_out(AO_BC_Source_Select, AO_Personal_Register); win_out(0x3f98,Interrupt_B_Ack_Register); win_out(AO_BC_Source_Select | AO_UPDATE_Pulse_Width | AO_TMRDACWR_Pulse_Width, AO_Personal_Register); @@ -2720,7 +2724,11 @@ static int ni_E_init(comedi_device *dev,comedi_devconfig *it) }else{ s->insn_write=ni_ao_insn_write; } - if(boardtype.ao_fifo_depth){ +#ifdef PCIDMA + if(boardtype.n_aochan){ +#else + if(boardtype.ao_fifo_depth){ +#endif s->do_cmd=ni_ao_cmd; s->do_cmdtest=ni_ao_cmdtest; s->len_chanlist = boardtype.n_aochan; @@ -3700,6 +3708,10 @@ static int ni_pfi_insn_config(comedi_device *dev,comedi_subdevice *s, case COMEDI_INPUT: ni_set_bits(dev, IO_Bidirection_Pin_Register, 1<io_bidirection_pin_reg & (1<n; + break; default: return -EINVAL; } diff --git a/comedi/drivers/ni_mio_cs.c b/comedi/drivers/ni_mio_cs.c index ad43d16c..1d309fcd 100644 --- a/comedi/drivers/ni_mio_cs.c +++ b/comedi/drivers/ni_mio_cs.c @@ -44,6 +44,7 @@ See the notes in the ni_atmio.o driver. #include #include +#include #include "ni_stc.h" #include "8255.h" @@ -289,11 +290,13 @@ static dev_link_t *cs_attach(void) client_reg.dev_info = &dev_info; client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) client_reg.EventMask = CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME; client_reg.event_handler = &mio_cs_event; +#endif client_reg.Version = 0x0210; client_reg.event_callback_args.client_data = link; ret = pcmcia_register_client(&link->handle, &client_reg); @@ -606,8 +609,11 @@ MODULE_LICENSE("GPL"); struct pcmcia_driver ni_mio_cs_driver = { - .attach = cs_attach, - .detach = cs_detach, + .attach = &cs_attach, + .detach = &cs_detach, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) + .event = &mio_cs_event, +#endif .owner = THIS_MODULE, .drv = { .name = "ni_mio_cs", diff --git a/comedi/drivers/ni_pcidio.c b/comedi/drivers/ni_pcidio.c index ebe2d900..550c025d 100644 --- a/comedi/drivers/ni_pcidio.c +++ b/comedi/drivers/ni_pcidio.c @@ -413,10 +413,10 @@ static void ni_pcidio_print_status(unsigned int status); static int nidio96_8255_cb(int dir,int port,int data,unsigned long iobase) { if(dir){ - writeb(data,iobase+port); + writeb(data,(void*)(iobase + port)); return 0; }else{ - return readb(iobase+port); + return readb((void*)(iobase + port)); } } @@ -437,8 +437,8 @@ static irqreturn_t nidio_interrupt(int irq, void *d, struct pt_regs *regs) unsigned int m_status; int retval = 1; - status = readb(dev->iobase+Interrupt_And_Window_Status); - flags = readb(dev->iobase+Group_1_Flags); + status = readb(devpriv->mite->daq_io_addr+Interrupt_And_Window_Status); + flags = readb(devpriv->mite->daq_io_addr+Group_1_Flags); m_status = readl(mite->mite_io_addr + MITE_CHSR(DI_DMA_CHAN)); //interrupcions parasites @@ -494,7 +494,7 @@ static irqreturn_t nidio_interrupt(int irq, void *d, struct pt_regs *regs) work++; if(work>20){ DPRINTK("too much work in interrupt\n"); - writeb(0x00,dev->iobase+Master_DMA_And_Interrupt_Control); + writeb(0x00,devpriv->mite->daq_io_addr+Master_DMA_And_Interrupt_Control); break; } @@ -506,16 +506,16 @@ static irqreturn_t nidio_interrupt(int irq, void *d, struct pt_regs *regs) work++; if(work>100){ DPRINTK("too much work in interrupt\n"); - writeb(0x00,dev->iobase+Master_DMA_And_Interrupt_Control); + writeb(0x00,devpriv->mite->daq_io_addr+Master_DMA_And_Interrupt_Control); goto out; } - AuxData = readl(dev->iobase+Group_1_FIFO); + AuxData = readl(devpriv->mite->daq_io_addr+Group_1_FIFO); data1 = AuxData & 0xffff; data2 = (AuxData & 0xffff0000) >> 16; comedi_buf_put(async,data1); comedi_buf_put(async,data2); //DPRINTK("read:%d, %d\n",data1,data2); - flags = readb(dev->iobase+Group_1_Flags); + flags = readb(devpriv->mite->daq_io_addr+Group_1_Flags); } //DPRINTK("buf_int_count: %d\n",async->buf_int_count); //DPRINTK("1) IntEn=%d,flags=%d,status=%d\n",IntEn,flags,status); @@ -526,11 +526,11 @@ static irqreturn_t nidio_interrupt(int irq, void *d, struct pt_regs *regs) if(flags & CountExpired){ DPRINTK("CountExpired\n"); - writeb(ClearExpired,dev->iobase+Group_1_Second_Clear); + writeb(ClearExpired,devpriv->mite->daq_io_addr+Group_1_Second_Clear); async->events |= COMEDI_CB_EOA; - writeb(0x00,dev->iobase+OpMode); - writeb(0x00,dev->iobase+Master_DMA_And_Interrupt_Control); + writeb(0x00,devpriv->mite->daq_io_addr+OpMode); + writeb(0x00,devpriv->mite->daq_io_addr+Master_DMA_And_Interrupt_Control); #ifdef USE_DMA mite_dma_disarm(mite, DI_DMA_CHAN); writel(CHOR_DMARESET, mite->mite_io_addr + MITE_CHOR(DI_DMA_CHAN)); @@ -538,8 +538,8 @@ static irqreturn_t nidio_interrupt(int irq, void *d, struct pt_regs *regs) break; }else if(flags & Waited){ DPRINTK("Waited\n"); - writeb(ClearWaited,dev->iobase+Group_1_First_Clear); - writeb(0x00,dev->iobase+Master_DMA_And_Interrupt_Control); + writeb(ClearWaited,devpriv->mite->daq_io_addr+Group_1_First_Clear); + writeb(0x00,devpriv->mite->daq_io_addr+Master_DMA_And_Interrupt_Control); async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; #ifdef USE_DMA mite_dma_disarm(mite, DI_DMA_CHAN); @@ -548,24 +548,24 @@ static irqreturn_t nidio_interrupt(int irq, void *d, struct pt_regs *regs) break; }else if(flags & PrimaryTC){ DPRINTK("PrimaryTC\n"); - writeb(ClearPrimaryTC,dev->iobase+Group_1_First_Clear); + writeb(ClearPrimaryTC,devpriv->mite->daq_io_addr+Group_1_First_Clear); async->events |= COMEDI_CB_EOA; - writeb(0x00,dev->iobase+Master_DMA_And_Interrupt_Control); + writeb(0x00,devpriv->mite->daq_io_addr+Master_DMA_And_Interrupt_Control); }else if(flags & SecondaryTC){ DPRINTK("SecondaryTC\n"); - writeb(ClearSecondaryTC,dev->iobase+Group_1_First_Clear); + writeb(ClearSecondaryTC,devpriv->mite->daq_io_addr+Group_1_First_Clear); async->events |= COMEDI_CB_EOA; - writeb(0x00,dev->iobase+Master_DMA_And_Interrupt_Control); + writeb(0x00,devpriv->mite->daq_io_addr+Master_DMA_And_Interrupt_Control); } #if 0 else{ printk("ni_pcidio: unknown interrupt\n"); async->events |= COMEDI_CB_ERROR|COMEDI_CB_EOA; - writeb(0x00,dev->iobase+Master_DMA_And_Interrupt_Control); + writeb(0x00,devpriv->mite->daq_io_addr+Master_DMA_And_Interrupt_Control); } #endif - flags = readb(dev->iobase+Group_1_Flags); - status = readb(dev->iobase+Interrupt_And_Window_Status); + flags = readb(devpriv->mite->daq_io_addr+Group_1_Flags); + status = readb(devpriv->mite->daq_io_addr+Interrupt_And_Window_Status); //DPRINTK("loop end: IntEn=0x%02x,flags=0x%02x,status=0x%02x\n", // IntEn,flags,status); //ni_pcidio_print_flags(flags); @@ -577,7 +577,7 @@ out: #if unused if(!tag){ - writeb(0x03,dev->iobase+Master_DMA_And_Interrupt_Control); + writeb(0x03,devpriv->mite->daq_io_addr+Master_DMA_And_Interrupt_Control); } #endif return IRQ_RETVAL(retval); @@ -626,19 +626,19 @@ static void debug_int(comedi_device *dev) struct timeval tv; do_gettimeofday(&tv); - a=readb(dev->iobase+Group_Status); - b=readb(dev->iobase+Group_1_Flags); + a=readb(devpriv->mite->daq_io_addr+Group_Status); + b=readb(devpriv->mite->daq_io_addr+Group_1_Flags); if(n_int < 10){ DPRINTK("status 0x%02x flags 0x%02x time %06d\n",a,b,(int)tv.tv_usec); } while(b&1){ - writew(0xff,dev->iobase+Group_1_FIFO); - b=readb(dev->iobase+Group_1_Flags); + writew(0xff,devpriv->mite->daq_io_addr+Group_1_FIFO); + b=readb(devpriv->mite->daq_io_addr+Group_1_Flags); } - b=readb(dev->iobase+Group_1_Flags); + b=readb(devpriv->mite->daq_io_addr+Group_1_Flags); if(n_int < 10){ DPRINTK("new status 0x%02x\n",b); @@ -666,7 +666,7 @@ static int ni_pcidio_insn_config(comedi_device *dev,comedi_subdevice *s, default: return -EINVAL; } - writel(s->io_bits,dev->iobase+Port_Pin_Directions(0)); + writel(s->io_bits,devpriv->mite->daq_io_addr+Port_Pin_Directions(0)); return 1; } @@ -678,9 +678,9 @@ static int ni_pcidio_insn_bits(comedi_device *dev,comedi_subdevice *s, if(data[0]){ s->state &= ~data[0]; s->state |= (data[0]&data[1]); - writel(s->state,dev->iobase+Port_IO(0)); + writel(s->state,devpriv->mite->daq_io_addr+Port_IO(0)); } - data[1] = readl(dev->iobase+Port_IO(0)); + data[1] = readl(devpriv->mite->daq_io_addr+Port_IO(0)); return 2; } @@ -814,83 +814,83 @@ static int ni_pcidio_cmd(comedi_device *dev,comedi_subdevice *s) comedi_cmd *cmd = &s->async->cmd; /* XXX configure ports for input*/ - writel(0x0000,dev->iobase+Port_Pin_Directions(0)); + writel(0x0000,devpriv->mite->daq_io_addr+Port_Pin_Directions(0)); if(1){ /* enable fifos A B C D */ - writeb(0x0f,dev->iobase+Data_Path); + writeb(0x0f,devpriv->mite->daq_io_addr+Data_Path); /* set transfer width a 32 bits*/ writeb(TransferWidth(0) | TransferLength(0), - dev->iobase+Transfer_Size_Control); + devpriv->mite->daq_io_addr+Transfer_Size_Control); }else{ - writeb(0x03,dev->iobase+Data_Path); + writeb(0x03,devpriv->mite->daq_io_addr+Data_Path); writeb(TransferWidth(3) | TransferLength(0), - dev->iobase+Transfer_Size_Control); + devpriv->mite->daq_io_addr+Transfer_Size_Control); } /* protocol configuration */ if(cmd->scan_begin_src == TRIG_TIMER){ /* page 4-5, "input with internal REQs" */ - writeb( 0 ,dev->iobase+OpMode); - writeb(0x00,dev->iobase+ClockReg); - writeb( 1 ,dev->iobase+Sequence); - writeb(0x04,dev->iobase+ReqReg); - writeb( 4 ,dev->iobase+BlockMode); - writeb( 3 ,dev->iobase+LinePolarities); - writeb(0xc0,dev->iobase+AckSer); + writeb( 0 ,devpriv->mite->daq_io_addr+OpMode); + writeb(0x00,devpriv->mite->daq_io_addr+ClockReg); + writeb( 1 ,devpriv->mite->daq_io_addr+Sequence); + writeb(0x04,devpriv->mite->daq_io_addr+ReqReg); + writeb( 4 ,devpriv->mite->daq_io_addr+BlockMode); + writeb( 3 ,devpriv->mite->daq_io_addr+LinePolarities); + writeb(0xc0,devpriv->mite->daq_io_addr+AckSer); writel(ni_pcidio_ns_to_timer(&cmd->scan_begin_arg, - TRIG_ROUND_NEAREST),dev->iobase+StartDelay); - writeb( 1 ,dev->iobase+ReqDelay); - writeb( 1 ,dev->iobase+ReqNotDelay); - writeb( 1 ,dev->iobase+AckDelay); - writeb(0x0b,dev->iobase+AckNotDelay); - writeb(0x01,dev->iobase+Data1Delay); + TRIG_ROUND_NEAREST),devpriv->mite->daq_io_addr+StartDelay); + writeb( 1 ,devpriv->mite->daq_io_addr+ReqDelay); + writeb( 1 ,devpriv->mite->daq_io_addr+ReqNotDelay); + writeb( 1 ,devpriv->mite->daq_io_addr+AckDelay); + writeb(0x0b,devpriv->mite->daq_io_addr+AckNotDelay); + writeb(0x01,devpriv->mite->daq_io_addr+Data1Delay); /* manual, page 4-5: ClockSpeed comment is incorrectly listed * on DAQOptions */ - writew(0 ,dev->iobase+ClockSpeed); - writeb(0 ,dev->iobase+DAQOptions); + writew(0 ,devpriv->mite->daq_io_addr+ClockSpeed); + writeb(0 ,devpriv->mite->daq_io_addr+DAQOptions); }else{ /* TRIG_EXT */ /* page 4-5, "input with external REQs" */ - writeb( 0 ,dev->iobase+OpMode); - writeb(0x00,dev->iobase+ClockReg); - writeb( 0 ,dev->iobase+Sequence); - writeb(0x00,dev->iobase+ReqReg); - writeb( 4 ,dev->iobase+BlockMode); - writeb( 0 ,dev->iobase+LinePolarities); - writeb(0x00,dev->iobase+AckSer); - writel( 1 ,dev->iobase+StartDelay); - writeb( 1 ,dev->iobase+ReqDelay); - writeb( 1 ,dev->iobase+ReqNotDelay); - writeb( 1 ,dev->iobase+AckDelay); - writeb(0x0C,dev->iobase+AckNotDelay); - writeb(0x10,dev->iobase+Data1Delay); - writew( 0 ,dev->iobase+ClockSpeed); - writeb(0x60,dev->iobase+DAQOptions); + writeb( 0 ,devpriv->mite->daq_io_addr+OpMode); + writeb(0x00,devpriv->mite->daq_io_addr+ClockReg); + writeb( 0 ,devpriv->mite->daq_io_addr+Sequence); + writeb(0x00,devpriv->mite->daq_io_addr+ReqReg); + writeb( 4 ,devpriv->mite->daq_io_addr+BlockMode); + writeb( 0 ,devpriv->mite->daq_io_addr+LinePolarities); + writeb(0x00,devpriv->mite->daq_io_addr+AckSer); + writel( 1 ,devpriv->mite->daq_io_addr+StartDelay); + writeb( 1 ,devpriv->mite->daq_io_addr+ReqDelay); + writeb( 1 ,devpriv->mite->daq_io_addr+ReqNotDelay); + writeb( 1 ,devpriv->mite->daq_io_addr+AckDelay); + writeb(0x0C,devpriv->mite->daq_io_addr+AckNotDelay); + writeb(0x10,devpriv->mite->daq_io_addr+Data1Delay); + writew( 0 ,devpriv->mite->daq_io_addr+ClockSpeed); + writeb(0x60,devpriv->mite->daq_io_addr+DAQOptions); } if(cmd->stop_src == TRIG_COUNT){ - writel(cmd->stop_arg,dev->iobase+Transfer_Count); + writel(cmd->stop_arg,devpriv->mite->daq_io_addr+Transfer_Count); }else{ /* XXX */ } #ifdef USE_DMA - writeb(0x05,dev->iobase+DMA_Line_Control); - writeb(0x30,dev->iobase+Group_1_First_Clear); + writeb(0x05,devpriv->mite->daq_io_addr+DMA_Line_Control); + writeb(0x30,devpriv->mite->daq_io_addr+Group_1_First_Clear); setup_mite_dma(dev,s); #else - writeb(0x00,dev->iobase+DMA_Line_Control); + writeb(0x00,devpriv->mite->daq_io_addr+DMA_Line_Control); #endif /* clear and enable interrupts */ - writeb(0xff,dev->iobase+Group_1_First_Clear); - //writeb(ClearExpired,dev->iobase+Group_1_Second_Clear); + writeb(0xff,devpriv->mite->daq_io_addr+Group_1_First_Clear); + //writeb(ClearExpired,devpriv->mite->daq_io_addr+Group_1_Second_Clear); - writeb(IntEn,dev->iobase+Interrupt_Control); - writeb(0x03,dev->iobase+Master_DMA_And_Interrupt_Control); + writeb(IntEn,devpriv->mite->daq_io_addr+Interrupt_Control); + writeb(0x03,devpriv->mite->daq_io_addr+Master_DMA_And_Interrupt_Control); if(cmd->stop_src == TRIG_NONE) { devpriv->OpModeBits = DataLatching(0) | RunMode(7); @@ -899,7 +899,7 @@ static int ni_pcidio_cmd(comedi_device *dev,comedi_subdevice *s) } if(cmd->start_src == TRIG_NOW){ /* start */ - writeb(devpriv->OpModeBits, dev->iobase+OpMode); + writeb(devpriv->OpModeBits, devpriv->mite->daq_io_addr+OpMode); s->async->inttrig = NULL; }else{ /* TRIG_INT */ @@ -931,7 +931,7 @@ static int ni_pcidio_inttrig(comedi_device *dev, comedi_subdevice *s, { if(trignum!=0)return -EINVAL; - writeb(devpriv->OpModeBits, dev->iobase+OpMode); + writeb(devpriv->OpModeBits, devpriv->mite->daq_io_addr+OpMode); s->async->inttrig = NULL; return 1; @@ -940,7 +940,7 @@ static int ni_pcidio_inttrig(comedi_device *dev, comedi_subdevice *s, static int ni_pcidio_cancel(comedi_device *dev, comedi_subdevice *s) { - writeb(0x00,dev->iobase+Master_DMA_And_Interrupt_Control); + writeb(0x00,devpriv->mite->daq_io_addr+Master_DMA_And_Interrupt_Control); return 0; } @@ -963,9 +963,9 @@ static int pci_6534_load_fpga(comedi_device *dev, int fpga_index, u8 *data, int { static const int timeout = 1000; int i, j; - writew(0x80 | fpga_index, dev->iobase + Firmware_Control_Register); - writew(0xc0 | fpga_index, dev->iobase + Firmware_Control_Register); - for(i = 0; (readw(dev->iobase + Firmware_Status_Register) & 0x2) == 0 && i < timeout; ++i) + writew(0x80 | fpga_index, devpriv->mite->daq_io_addr + Firmware_Control_Register); + writew(0xc0 | fpga_index, devpriv->mite->daq_io_addr + Firmware_Control_Register); + for(i = 0; (readw(devpriv->mite->daq_io_addr + Firmware_Status_Register) & 0x2) == 0 && i < timeout; ++i) { udelay(1); } @@ -974,8 +974,8 @@ static int pci_6534_load_fpga(comedi_device *dev, int fpga_index, u8 *data, int printk("ni_pcidio: failed to load fpga %i, waiting for status 0x2\n", fpga_index); return -EIO; } - writew(0x80 | fpga_index, dev->iobase + Firmware_Control_Register); - for(i = 0; readw(dev->iobase + Firmware_Status_Register) != 0x3 && i < timeout; ++i) + writew(0x80 | fpga_index, devpriv->mite->daq_io_addr + Firmware_Control_Register); + for(i = 0; readw(devpriv->mite->daq_io_addr + Firmware_Status_Register) != 0x3 && i < timeout; ++i) { udelay(1); } @@ -988,8 +988,8 @@ static int pci_6534_load_fpga(comedi_device *dev, int fpga_index, u8 *data, int { unsigned int value = data[j++]; value |= data[j++] << 8; - writew(value, dev->iobase + Firmware_Data_Register); - for(i = 0; (readw(dev->iobase + Firmware_Status_Register) & 0x2) == 0 && i < timeout; ++i) + writew(value, devpriv->mite->daq_io_addr + Firmware_Data_Register); + for(i = 0; (readw(devpriv->mite->daq_io_addr + Firmware_Status_Register) & 0x2) == 0 && i < timeout; ++i) { udelay(1); } @@ -1001,7 +1001,7 @@ static int pci_6534_load_fpga(comedi_device *dev, int fpga_index, u8 *data, int if(need_resched()) schedule(); } - writew(0x0, dev->iobase + Firmware_Control_Register); + writew(0x0, devpriv->mite->daq_io_addr + Firmware_Control_Register); return 0; } @@ -1014,24 +1014,24 @@ static int pci_6534_reset_fpgas(comedi_device *dev) { int ret; int i; - writew(0x0, dev->iobase + Firmware_Control_Register); + writew(0x0, devpriv->mite->daq_io_addr + Firmware_Control_Register); for(i = 0; i < 3; ++i) { ret = pci_6534_reset_fpga(dev, i); if(ret < 0) break; } - writew(0x0, dev->iobase + Firmware_Mask_Register); + writew(0x0, devpriv->mite->daq_io_addr + Firmware_Mask_Register); return ret; } static void pci_6534_init_main_fpga(comedi_device *dev) { - writel(0, dev->iobase + FPGA_Control1_Register); - writel(0, dev->iobase + FPGA_Control2_Register); - writel(0, dev->iobase + FPGA_SCALS_Counter_Register); - writel(0, dev->iobase + FPGA_SCAMS_Counter_Register); - writel(0, dev->iobase + FPGA_SCBLS_Counter_Register); - writel(0, dev->iobase + FPGA_SCBMS_Counter_Register); + writel(0, devpriv->mite->daq_io_addr + FPGA_Control1_Register); + writel(0, devpriv->mite->daq_io_addr + FPGA_Control2_Register); + writel(0, devpriv->mite->daq_io_addr + FPGA_SCALS_Counter_Register); + writel(0, devpriv->mite->daq_io_addr + FPGA_SCAMS_Counter_Register); + writel(0, devpriv->mite->daq_io_addr + FPGA_SCBLS_Counter_Register); + writel(0, devpriv->mite->daq_io_addr + FPGA_SCBMS_Counter_Register); } static int pci_6534_upload_firmware(comedi_device *dev, int options[]) @@ -1080,7 +1080,6 @@ static int nidio_attach(comedi_device *dev,comedi_devconfig *it) printk("error setting up mite\n"); return ret; } - dev->iobase = mite_iobase(devpriv->mite); dev->board_name=this_board->name; dev->irq=mite_irq(devpriv->mite); @@ -1102,11 +1101,11 @@ static int nidio_attach(comedi_device *dev,comedi_devconfig *it) if(!this_board->is_diodaq){ for(i=0;in_8255;i++){ subdev_8255_init(dev,dev->subdevices+i, - nidio96_8255_cb,(unsigned long)(dev->iobase+NIDIO_8255_BASE(i))); + nidio96_8255_cb,(unsigned long)(devpriv->mite->daq_io_addr+NIDIO_8255_BASE(i))); } }else{ - printk(" rev=%d",readb(dev->iobase+Chip_Version)); + printk(" rev=%d",readb(devpriv->mite->daq_io_addr+Chip_Version)); s=dev->subdevices+0; @@ -1124,12 +1123,12 @@ static int nidio_attach(comedi_device *dev,comedi_devconfig *it) s->len_chanlist=32; /* XXX */ s->buf_change = ni_pcidio_change; - writel(0,dev->iobase+Port_IO(0)); - writel(0,dev->iobase+Port_Pin_Directions(0)); - writel(0,dev->iobase+Port_Pin_Mask(0)); + writel(0,devpriv->mite->daq_io_addr+Port_IO(0)); + writel(0,devpriv->mite->daq_io_addr+Port_Pin_Directions(0)); + writel(0,devpriv->mite->daq_io_addr+Port_Pin_Mask(0)); /* disable interrupts on board */ - writeb(0x00,dev->iobase+Master_DMA_And_Interrupt_Control); + writeb(0x00,devpriv->mite->daq_io_addr+Master_DMA_And_Interrupt_Control); ret=comedi_request_irq(dev->irq,nidio_interrupt,SA_SHIRQ,"ni_pcidio",dev); if(ret<0){ diff --git a/comedi/drivers/ni_pcimio.c b/comedi/drivers/ni_pcimio.c index 8673a443..1f6552ed 100644 --- a/comedi/drivers/ni_pcimio.c +++ b/comedi/drivers/ni_pcimio.c @@ -45,7 +45,7 @@ By default, the driver uses DMA to transfer analog input data to memory. When DMA is enabled, not all triggering features are supported. -PCI IDs are not known for PCI-6731 and PCI-6733. Digital I/O may not +PCI IDs are not known for PCI-6733. Digital I/O may not work on 673x. Information (number of channels, bits, etc.) for some devices may be @@ -112,31 +112,36 @@ Bugs: static struct pci_device_id ni_pci_table[] __devinitdata = { { PCI_VENDOR_ID_NATINST, 0x0162, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { PCI_VENDOR_ID_NATINST, 0x1170, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { PCI_VENDOR_ID_NATINST, 0x11d0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { PCI_VENDOR_ID_NATINST, 0x1180, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { PCI_VENDOR_ID_NATINST, 0x1190, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { PCI_VENDOR_ID_NATINST, 0x11b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { PCI_VENDOR_ID_NATINST, 0x11c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { PCI_VENDOR_ID_NATINST, 0x1330, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { PCI_VENDOR_ID_NATINST, 0x11d0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { PCI_VENDOR_ID_NATINST, 0x1270, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { PCI_VENDOR_ID_NATINST, 0x1330, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { PCI_VENDOR_ID_NATINST, 0x1340, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { PCI_VENDOR_ID_NATINST, 0x1350, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { PCI_VENDOR_ID_NATINST, 0x2a60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { PCI_VENDOR_ID_NATINST, 0x2a70, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { PCI_VENDOR_ID_NATINST, 0x2a80, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { PCI_VENDOR_ID_NATINST, 0x2ab0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { PCI_VENDOR_ID_NATINST, 0x2ca0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { PCI_VENDOR_ID_NATINST, 0x2c80, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { PCI_VENDOR_ID_NATINST, 0x18b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { PCI_VENDOR_ID_NATINST, 0x14e0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { PCI_VENDOR_ID_NATINST, 0x14f0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { PCI_VENDOR_ID_NATINST, 0x1580, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { PCI_VENDOR_ID_NATINST, 0x15b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { PCI_VENDOR_ID_NATINST, 0x1880, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { PCI_VENDOR_ID_NATINST, 0x1870, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { PCI_VENDOR_ID_NATINST, 0x15b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { PCI_VENDOR_ID_NATINST, 0x11b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { PCI_VENDOR_ID_NATINST, 0x18b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { PCI_VENDOR_ID_NATINST, 0x18c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - { PCI_VENDOR_ID_NATINST, 0x1580, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { PCI_VENDOR_ID_NATINST, 0x2410, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { PCI_VENDOR_ID_NATINST, 0x2420, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { PCI_VENDOR_ID_NATINST, 0x2430, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { PCI_VENDOR_ID_NATINST, 0x2890, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { PCI_VENDOR_ID_NATINST, 0x28c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { PCI_VENDOR_ID_NATINST, 0x2a60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { PCI_VENDOR_ID_NATINST, 0x2a70, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { PCI_VENDOR_ID_NATINST, 0x2a80, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { PCI_VENDOR_ID_NATINST, 0x2ab0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { PCI_VENDOR_ID_NATINST, 0x2b80, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { PCI_VENDOR_ID_NATINST, 0x2b90, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { PCI_VENDOR_ID_NATINST, 0x2c80, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { PCI_VENDOR_ID_NATINST, 0x2ca0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { 0 } }; MODULE_DEVICE_TABLE(pci, ni_pci_table); @@ -538,8 +543,7 @@ static ni_board ni_boards[]={ reg_type: ni_reg_6713, caldac: {ad8804_debug,ad8804_debug}, }, -#if 0 /* need device ids */ - { device_id: 0x0, + { device_id: 0x2430, name: "pci-6731", n_adchan: 0, /* no analog input */ n_aochan: 4, @@ -549,6 +553,7 @@ static ni_board ni_boards[]={ reg_type: ni_reg_6711, caldac: {ad8804_debug}, }, +#if 0 /* need device ids */ { device_id: 0x0, name: "pxi-6731", n_adchan: 0, /* no analog input */ @@ -677,12 +682,12 @@ typedef struct{ /* How we access registers */ -#define ni_writel(a,b) (writel((a),dev->iobase+(b))) -#define ni_readl(a) (readl(dev->iobase+(a))) -#define ni_writew(a,b) (writew((a),dev->iobase+(b))) -#define ni_readw(a) (readw(dev->iobase+(a))) -#define ni_writeb(a,b) (writeb((a),dev->iobase+(b))) -#define ni_readb(a) (readb(dev->iobase+(a))) +#define ni_writel(a,b) (writel((a), devpriv->mite->daq_io_addr + (b))) +#define ni_readl(a) (readl(devpriv->mite->daq_io_addr + (a))) +#define ni_writew(a,b) (writew((a), devpriv->mite->daq_io_addr + (b))) +#define ni_readw(a) (readw(devpriv->mite->daq_io_addr + (a))) +#define ni_writeb(a,b) (writeb((a), devpriv->mite->daq_io_addr + (b))) +#define ni_readb(a) (readb(devpriv->mite->daq_io_addr + (a))) /* How we access STC registers */ @@ -770,7 +775,6 @@ static int pcimio_attach(comedi_device *dev,comedi_devconfig *it) printk(" error setting up mite\n"); return ret; } - dev->iobase = mite_iobase(devpriv->mite); dev->irq=mite_irq(devpriv->mite); diff --git a/comedi/drivers/ni_stc.h b/comedi/drivers/ni_stc.h index 8952dd05..aca5c49c 100644 --- a/comedi/drivers/ni_stc.h +++ b/comedi/drivers/ni_stc.h @@ -422,6 +422,7 @@ enum AO_Personal_Bits { AO_BC_Source_Select = 1 << 4, AO_UPDATE_Pulse_Width = 1 << 5, + AO_DMA_PIO_Control = 1 << 8, AO_AOFREQ_Polarity = 1 << 9, AO_FIFO_Enable = 1 << 10, AO_TMRDACWR_Pulse_Width = 1 << 12, diff --git a/comedi/drivers/pcl711.c b/comedi/drivers/pcl711.c index a8e91316..6c05d029 100644 --- a/comedi/drivers/pcl711.c +++ b/comedi/drivers/pcl711.c @@ -499,11 +499,10 @@ static int pcl711_attach(comedi_device * dev, comedi_devconfig * it) iobase = it->options[0]; printk("comedi%d: pcl711: 0x%04x ", dev->minor, iobase); - if (check_region(iobase, PCL711_SIZE) < 0) { + if (!request_region(iobase, PCL711_SIZE, "pcl711")) { printk("I/O port conflict\n"); return -EIO; } - request_region(iobase, PCL711_SIZE, "pcl711"); dev->iobase = iobase; /* there should be a sanity check here */ diff --git a/comedi/drivers/pcl724.c b/comedi/drivers/pcl724.c index 522f0178..28bf8d61 100644 --- a/comedi/drivers/pcl724.c +++ b/comedi/drivers/pcl724.c @@ -133,12 +133,11 @@ static int pcl724_attach(comedi_device *dev,comedi_devconfig *it) iorange=PCL722_96_SIZE; // PCL-724 in 96 DIO configuration printk("comedi%d: pcl724: board=%s, 0x%03x ",dev->minor, this_board->name,iobase); - if(check_region(iobase,iorange)<0){ + if(!request_region(iobase, iorange, "pcl724")){ printk("I/O port conflict\n"); return -EIO; } - request_region(iobase, iorange, "pcl724"); dev->iobase=iobase; dev->board_name = this_board->name; diff --git a/comedi/drivers/pcl725.c b/comedi/drivers/pcl725.c index af864e76..a9d29b3e 100644 --- a/comedi/drivers/pcl725.c +++ b/comedi/drivers/pcl725.c @@ -64,11 +64,10 @@ static int pcl725_attach(comedi_device *dev,comedi_devconfig *it) iobase=it->options[0]; printk("comedi%d: pcl725: 0x%04x ",dev->minor,iobase); - if(check_region(iobase,PCL725_SIZE)<0){ + if(!request_region(iobase,PCL725_SIZE,"pcl725")){ printk("I/O port conflict\n"); return -EIO; } - request_region(iobase,PCL725_SIZE,"pcl725"); dev->board_name="pcl725"; dev->iobase=iobase; dev->irq=0; diff --git a/comedi/drivers/pcl726.c b/comedi/drivers/pcl726.c index 1f1bfadc..2f15431e 100644 --- a/comedi/drivers/pcl726.c +++ b/comedi/drivers/pcl726.c @@ -245,12 +245,11 @@ static int pcl726_attach(comedi_device *dev,comedi_devconfig *it) iobase=it->options[0]; iorange=this_board->io_range; printk("comedi%d: pcl726: board=%s, 0x%03x ",dev->minor,this_board->name,iobase); - if(check_region(iobase,iorange)<0){ + if(!request_region(iobase, iorange, "pcl726")){ printk("I/O port conflict\n"); return -EIO; } - request_region(iobase, iorange, "pcl726"); dev->iobase=iobase; dev->board_name = this_board->name; diff --git a/comedi/drivers/pcl730.c b/comedi/drivers/pcl730.c index 70c3f5e2..797213ea 100644 --- a/comedi/drivers/pcl730.c +++ b/comedi/drivers/pcl730.c @@ -95,13 +95,11 @@ static int pcl730_attach(comedi_device *dev,comedi_devconfig *it) iorange=this_board->io_range; printk("comedi%d: pcl730: board=%s 0x%04x ", dev->minor, this_board->name, iobase); - if( check_region(iobase, iorange) < 0 ) - { + if( !request_region(iobase, iorange, "pcl730") ) { printk("I/O port conflict\n"); return -EIO; } - request_region(iobase, iorange, "pcl730"); - dev->board_name=this_board->name; + dev->board_name=this_board->name; dev->iobase=iobase; dev->irq=0; diff --git a/comedi/drivers/pcl812.c b/comedi/drivers/pcl812.c index 88bf4525..3877404b 100644 --- a/comedi/drivers/pcl812.c +++ b/comedi/drivers/pcl812.c @@ -1183,11 +1183,10 @@ static int pcl812_attach(comedi_device * dev, comedi_devconfig * it) printk("comedi%d: pcl812: board=%s, ioport=0x%03x", dev->minor, this_board->name, iobase); - if (check_region(iobase, this_board->io_range) < 0) { + if (!request_region(iobase, this_board->io_range, "pcl812")) { printk("I/O port conflict\n"); return -EIO; } - request_region(iobase, this_board->io_range, "pcl812"); dev->iobase = iobase; if ((ret = alloc_private(dev, sizeof(pcl812_private))) < 0) { diff --git a/comedi/drivers/pcl816.c b/comedi/drivers/pcl816.c index 621a8c45..276e9553 100644 --- a/comedi/drivers/pcl816.c +++ b/comedi/drivers/pcl816.c @@ -1024,12 +1024,11 @@ pcl816_attach (comedi_device * dev, comedi_devconfig * it) printk("comedi%d: pcl816: board=%s, ioport=0x%03x", dev->minor, this_board->name, iobase); - if (check_region (iobase, this_board->io_range) < 0) { + if (!request_region (iobase, this_board->io_range, "pcl816")) { rt_printk ("I/O port conflict\n"); return -EIO; } - request_region (iobase, this_board->io_range, "pcl816"); dev->iobase = iobase; if (pcl816_check (iobase)) { @@ -1084,9 +1083,8 @@ pcl816_attach (comedi_device * dev, comedi_devconfig * it) { // we want to use DMA if (RTC_lock == 0) { - if (check_region (RTC_PORT (0), RTC_IO_EXTENT) < 0) + if (!request_region (RTC_PORT (0), RTC_IO_EXTENT, "pcl816 (RTC)")) goto no_rtc; - request_region (RTC_PORT (0), RTC_IO_EXTENT, "pcl816 (RTC)"); } devpriv->rtc_iobase = RTC_PORT (0); devpriv->rtc_iosize = RTC_IO_EXTENT; diff --git a/comedi/drivers/pcl818.c b/comedi/drivers/pcl818.c index be2a9b40..6c211801 100644 --- a/comedi/drivers/pcl818.c +++ b/comedi/drivers/pcl818.c @@ -1597,12 +1597,11 @@ static int pcl818_attach(comedi_device * dev, comedi_devconfig * it) devpriv->io_range=PCLx1xFIFO_RANGE; devpriv->usefifo = 1; } - if (check_region(iobase, this_board->io_range) < 0) { + if (!request_region(iobase, devpriv->io_range, "pcl818")) { rt_printk("I/O port conflict\n"); return -EIO; } - request_region(iobase, devpriv->io_range, "pcl818"); dev->iobase=iobase; if (pcl818_check(iobase)) { @@ -1642,8 +1641,8 @@ static int pcl818_attach(comedi_device * dev, comedi_devconfig * it) devpriv->dma_rtc=0; if (it->options[2]>0) { // we want to use DMA if (RTC_lock==0) { - if (check_region(RTC_PORT(0), RTC_IO_EXTENT) < 0) goto no_rtc; - request_region(RTC_PORT(0), RTC_IO_EXTENT, "pcl818 (RTC)"); + if (!request_region(RTC_PORT(0), RTC_IO_EXTENT, "pcl818 (RTC)")) + goto no_rtc; } devpriv->rtc_iobase=RTC_PORT(0); devpriv->rtc_iosize=RTC_IO_EXTENT; diff --git a/comedi/drivers/pcm3730.c b/comedi/drivers/pcm3730.c index 34be1f5c..bbe75eb3 100644 --- a/comedi/drivers/pcm3730.c +++ b/comedi/drivers/pcm3730.c @@ -69,11 +69,10 @@ static int pcm3730_attach(comedi_device *dev,comedi_devconfig *it) iobase=it->options[0]; printk("comedi%d: pcm3730: 0x%04x ",dev->minor,iobase); - if(check_region(iobase,PCM3730_SIZE)<0){ + if(!request_region(iobase,PCM3730_SIZE,"pcm3730")){ printk("I/O port conflict\n"); return -EIO; } - request_region(iobase,PCM3730_SIZE,"pcm3730"); dev->iobase=iobase; dev->board_name="pcm3730"; dev->iobase=dev->iobase; diff --git a/comedi/drivers/pcmad.c b/comedi/drivers/pcmad.c index 8b5c99b0..509f4f15 100644 --- a/comedi/drivers/pcmad.c +++ b/comedi/drivers/pcmad.c @@ -135,11 +135,10 @@ static int pcmad_attach(comedi_device *dev,comedi_devconfig *it) iobase=it->options[0]; printk("comedi%d: pcmad: 0x%04x ",dev->minor,iobase); - if(check_region(iobase,PCMAD_SIZE)<0){ + if(!request_region(iobase,PCMAD_SIZE,"pcmad")){ printk("I/O port conflict\n"); return -EIO; } - request_region(iobase,PCMAD_SIZE,"pcmad"); dev->iobase=iobase; if((ret=alloc_subdevices(dev, 1))<0) diff --git a/comedi/drivers/plx9080.h b/comedi/drivers/plx9080.h index c837f8a7..eed2ac55 100644 --- a/comedi/drivers/plx9080.h +++ b/comedi/drivers/plx9080.h @@ -391,9 +391,9 @@ enum bigend_bits #define MBX_ADDR_SPACE_360 0x80 /* wanXL100s/200/400 */ #define MBX_ADDR_MASK_360 (MBX_ADDR_SPACE_360-1) -static inline int plx9080_abort_dma( unsigned long iobase, unsigned int channel ) +static inline int plx9080_abort_dma(void *iobase, unsigned int channel ) { - unsigned long dma_cs_addr; + void *dma_cs_addr; uint8_t dma_status; const int timeout = 10000; unsigned int i; diff --git a/comedi/drivers/poc.c b/comedi/drivers/poc.c index 6dbeb823..8dc2dd1b 100644 --- a/comedi/drivers/poc.c +++ b/comedi/drivers/poc.c @@ -127,13 +127,12 @@ static int poc_attach(comedi_device *dev, comedi_devconfig *it) iosize = this_board->iosize; /* check if io addresses are available */ - if(check_region(iobase, iosize) < 0) + if(!request_region(iobase, iosize, "dac02")) { printk("I/O port conflict: failed to allocate ports 0x%x to 0x%x\n", iobase, iobase + iosize - 1); return -EIO; } - request_region(iobase, iosize, "dac02"); dev->iobase = iobase; if(alloc_subdevices(dev, 1) < 0) diff --git a/comedi/drivers/quatech_daqp_cs.c b/comedi/drivers/quatech_daqp_cs.c index 65d45348..6b0cebef 100644 --- a/comedi/drivers/quatech_daqp_cs.c +++ b/comedi/drivers/quatech_daqp_cs.c @@ -49,6 +49,7 @@ Devices: [Quatech] DAQP-208 (daqp), DAQP-308 #include +#include #include #include #include @@ -1147,11 +1148,13 @@ static dev_link_t *daqp_cs_attach(void) /* Register with Card Services */ client_reg.dev_info = &dev_info; client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE; - client_reg.EventMask = - CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | - CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | - CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME; - client_reg.event_handler = &daqp_cs_event; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) + client_reg.EventMask = + CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | + CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | + CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME; + client_reg.event_handler = &daqp_cs_event; +#endif client_reg.Version = 0x0210; client_reg.event_callback_args.client_data = link; ret = pcmcia_register_client(&link->handle, &client_reg); @@ -1517,6 +1520,9 @@ struct pcmcia_driver daqp_cs_driver = { .attach = daqp_cs_attach, .detach = daqp_cs_detach, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) + .event = daqp_cs_event, +#endif .owner = THIS_MODULE, .drv = { .name = "quatech_daqp_cs", diff --git a/comedi/drivers/rti800.c b/comedi/drivers/rti800.c index c0512cd8..f15fa47b 100644 --- a/comedi/drivers/rti800.c +++ b/comedi/drivers/rti800.c @@ -302,11 +302,10 @@ static int rti800_attach(comedi_device * dev, comedi_devconfig * it) iobase = it->options[0]; printk("comedi%d: rti800: 0x%04x ", dev->minor, iobase); - if (check_region(iobase, RTI800_SIZE) < 0) { + if (!request_region(iobase, RTI800_SIZE, "rti800")) { printk("I/O port conflict\n"); return -EIO; } - request_region(iobase, RTI800_SIZE, "rti800"); dev->iobase = iobase; #ifdef DEBUG diff --git a/comedi/drivers/rti802.c b/comedi/drivers/rti802.c index f5a50573..3b9612b0 100644 --- a/comedi/drivers/rti802.c +++ b/comedi/drivers/rti802.c @@ -105,11 +105,10 @@ static int rti802_attach(comedi_device * dev, comedi_devconfig * it) iobase = it->options[0]; printk("comedi%d: rti802: 0x%04x ", dev->minor, iobase); - if (check_region(iobase, RTI802_SIZE) < 0) { + if (!request_region(iobase, RTI802_SIZE, "rti802")) { printk("I/O port conflict\n"); return -EIO; } - request_region(iobase, RTI802_SIZE, "rti802"); dev->iobase = iobase; dev->board_name = "rti802"; diff --git a/comedi/drivers/s626.c b/comedi/drivers/s626.c new file mode 100644 index 00000000..a8210334 --- /dev/null +++ b/comedi/drivers/s626.c @@ -0,0 +1,3073 @@ +/* + comedi/drivers/s626.c + Sensoray s626 Comedi driver + + COMEDI - Linux Control and Measurement Device Interface + Copyright (C) 2000 David A. Schleef + + Based on Sensoray Model 626 Linux driver Version 0.2 + Copyright (C) 2002-2004 Sensoray Co., Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +/* + Driver: s626.o (s626.ko) + Description: Sensoray 626 driver + Devices: Sensoray s626 + Authors: Gianluca Palli , + Updated: Thu, 12 Jul 2005 + Status: experimental + + Configuration Options: + analog input: + none + + analog output: + none + + digital channel: + s626 has 3 dio subdevices (2,3 and 4) each with 16 i/o channels + supported configuration options: + INSN_CONFIG_DIO_QUERY + COMEDI_INPUT + COMEDI_OUTPUT + + encoder: + Every channel must be configured before reading. + + Example code + + insn.insn=INSN_CONFIG; //configuration instruction + insn.n=1; //number of operation (must be 1) + insn.data=&initialvalue; //initial value loaded into encoder + //during configuration + insn.subdev=5; //encoder subdevice + insn.chanspec=CR_PACK(encoder_channel,0,AREF_OTHER); //encoder_channel + //to configure + + comedi_do_insn(cf,&insn); //executing configuration +*/ + +#include +#include + +#include + +#include /* for PCI devices */ + +#include "comedi_fc.h" +#include "s626.h" + +MODULE_AUTHOR("Gianluca Palli "); +MODULE_DESCRIPTION("Sensoray 626 Comedi driver module"); +MODULE_LICENSE("GPL"); + +typedef struct s626_board_struct{ + char *name; + int ai_chans; + int ai_bits; + int ao_chans; + int ao_bits; + int dio_chans; + int dio_banks; + int enc_chans; +} s626_board; + +static s626_board s626_boards[] = { + { + name: "s626", + ai_chans: S626_ADC_CHANNELS, + ai_bits: 14, + ao_chans: S626_DAC_CHANNELS, + ao_bits: 13, + dio_chans: S626_DIO_CHANNELS, + dio_banks: S626_DIO_BANKS, + enc_chans: S626_ENCODER_CHANNELS, + } +}; + +#define thisboard ((s626_board *)dev->board_ptr) +#define PCI_VENDOR_ID_S626 0x1131 +#define PCI_DEVICE_ID_S626 0x7146 + +static struct pci_device_id s626_pci_table[] __devinitdata = { + { PCI_VENDOR_ID_S626, PCI_DEVICE_ID_S626, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { 0 } +}; + +MODULE_DEVICE_TABLE(pci, s626_pci_table); + +static int s626_attach(comedi_device *dev,comedi_devconfig *it); +static int s626_detach(comedi_device *dev); + +static comedi_driver driver_s626={ + driver_name: "s626", + module: THIS_MODULE, + attach: s626_attach, + detach: s626_detach, +}; + +typedef struct{ + struct pci_dev *pdev; + void *base_addr; + short allocatedBuf; + uint8_t ai_cmd_running; // ai_cmd is running + uint8_t ai_continous; // continous aquisition + int ai_sample_count; // number of samples to aquire + unsigned int ai_sample_timer; // time between samples in + // units of the timer + int ai_convert_count; // conversion counter + unsigned int ai_convert_timer; // time between conversion in + // units of the timer + uint16_t CounterIntEnabs; //Counter interrupt enable + //mask for MISC2 register. + uint8_t AdcItems; //Number of items in ADC poll + //list. + DMABUF RPSBuf; //DMA buffer used to hold ADC + //(RPS1) program. + DMABUF ANABuf; //DMA buffer used to receive + //ADC data and hold DAC data. + uint32_t *pDacWBuf; //Pointer to logical adrs of + //DMA buffer used to hold DAC + //data. + uint16_t Dacpol; //Image of DAC polarity + //register. + uint8_t TrimSetpoint[12]; //Images of TrimDAC setpoints. + //registers. + uint16_t ChargeEnabled; //Image of MISC2 Battery + //Charge Enabled (0 or + //WRMISC2_CHARGE_ENABLE). + uint16_t WDInterval; //Image of MISC2 watchdog + //interval control bits. + uint32_t I2CAdrs; //I2C device address for + //onboard EEPROM (board rev + //dependent). + // short I2Cards; + lsampl_t ao_readback[S626_DAC_CHANNELS]; +}s626_private; + +typedef struct { + uint16_t RDDIn; + uint16_t WRDOut; + uint16_t RDEdgSel; + uint16_t WREdgSel; + uint16_t RDCapSel; + uint16_t WRCapSel; + uint16_t RDCapFlg; + uint16_t RDIntSel; + uint16_t WRIntSel; +} dio_private; + +static dio_private dio_private_A={ + RDDIn: LP_RDDINA, + WRDOut: LP_WRDOUTA, + RDEdgSel: LP_RDEDGSELA, + WREdgSel: LP_WREDGSELA, + RDCapSel: LP_RDCAPSELA, + WRCapSel: LP_WRCAPSELA, + RDCapFlg: LP_RDCAPFLGA, + RDIntSel: LP_RDINTSELA, + WRIntSel: LP_WRINTSELA, +}; + +static dio_private dio_private_B={ + RDDIn: LP_RDDINB, + WRDOut: LP_WRDOUTB, + RDEdgSel: LP_RDEDGSELB, + WREdgSel: LP_WREDGSELB, + RDCapSel: LP_RDCAPSELB, + WRCapSel: LP_WRCAPSELB, + RDCapFlg: LP_RDCAPFLGB, + RDIntSel: LP_RDINTSELB, + WRIntSel: LP_WRINTSELB, +}; + +static dio_private dio_private_C={ + RDDIn: LP_RDDINC, + WRDOut: LP_WRDOUTC, + RDEdgSel: LP_RDEDGSELC, + WREdgSel: LP_WREDGSELC, + RDCapSel: LP_RDCAPSELC, + WRCapSel: LP_WRCAPSELC, + RDCapFlg: LP_RDCAPFLGC, + RDIntSel: LP_RDINTSELC, + WRIntSel: LP_WRINTSELC, +}; + +/* to group dio devices (48 bits mask and data are not allowed ???) +static dio_private *dio_private_word[]={ + &dio_private_A, + &dio_private_B, + &dio_private_C, +}; +*/ + +#define devpriv ((s626_private *)dev->private) +#define diopriv ((dio_private *)s->private) + +COMEDI_INITCLEANUP_NOMODULE(driver_s626); + +//ioctl routines +static int s626_ai_insn_config(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +/* static int s626_ai_rinsn(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); */ +static int s626_ai_insn_read(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +static int s626_ai_cmd(comedi_device *dev,comedi_subdevice *s); +static int s626_ai_cmdtest(comedi_device *dev,comedi_subdevice *s,comedi_cmd *cmd); +static int s626_ai_cancel(comedi_device *dev,comedi_subdevice *s); +static int s626_ao_winsn(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +static int s626_ao_rinsn(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +static int s626_dio_insn_bits(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +static int s626_dio_insn_config(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +static int s626_dio_set_irq(comedi_device *dev, unsigned int chan); +static int s626_dio_reset_irq(comedi_device *dev, unsigned int gruop, unsigned int mask); +static int s626_dio_clear_irq(comedi_device *dev); +static int s626_enc_insn_config(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +static int s626_enc_insn_read(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +static int s626_enc_insn_write(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data); +static int s626_ns_to_timer(int *nanosec,int round_mode); +static int s626_ai_load_polllist(uint8_t *ppl, comedi_cmd *cmd); +static int s626_ai_inttrig(comedi_device *dev,comedi_subdevice *s, + unsigned int trignum); +static irqreturn_t s626_irq_handler(int irq,void *d,struct pt_regs * regs); +static lsampl_t s626_ai_reg_to_uint(int data); +/* static lsampl_t s626_uint_to_reg(comedi_subdevice *s, int data); */ + +//end ioctl routines + +//internal routines +static void s626_dio_init(comedi_device *dev); +static void ResetADC(comedi_device *dev,uint8_t *ppl ); +static void LoadTrimDACs(comedi_device *dev); +static void WriteTrimDAC(comedi_device *dev,uint8_t LogicalChan, uint8_t DacData ); +static uint8_t I2Cread(comedi_device *dev, uint8_t addr ); +static uint32_t I2Chandshake(comedi_device *dev,uint32_t val ); +static void SetDAC(comedi_device *dev,uint16_t chan, short dacdata ); +static void SendDAC(comedi_device *dev,uint32_t val ); +static void WriteMISC2(comedi_device *dev,uint16_t NewImage ); +static void DEBItransfer(comedi_device *dev); +static uint16_t DEBIread(comedi_device *dev,uint16_t addr ); +static void DEBIwrite(comedi_device *dev,uint16_t addr, uint16_t wdata ); +static void DEBIreplace(comedi_device *dev, uint16_t addr, uint16_t mask, uint16_t wdata ); +static void CloseDMAB (comedi_device *dev,DMABUF * pdma,size_t bsize); + +// COUNTER OBJECT ------------------------------------------------ +typedef struct enc_private_struct { + // Pointers to functions that differ for A and B counters: + uint16_t (*GetEnable)(comedi_device *dev,struct enc_private_struct *); //Return clock enable. + uint16_t (*GetIntSrc)(comedi_device *dev,struct enc_private_struct *); //Return interrupt source. + uint16_t (*GetLoadTrig)(comedi_device *dev,struct enc_private_struct *); //Return preload trigger source. + uint16_t (*GetMode)(comedi_device *dev,struct enc_private_struct *); //Return standardized operating mode. + void (*PulseIndex)(comedi_device *dev,struct enc_private_struct *); //Generate soft index strobe. + void (*SetEnable)(comedi_device *dev,struct enc_private_struct *,uint16_t enab); //Program clock enable. + void (*SetIntSrc)(comedi_device *dev,struct enc_private_struct *,uint16_t IntSource); //Program interrupt source. + void (*SetLoadTrig)(comedi_device *dev,struct enc_private_struct *,uint16_t Trig); //Program preload trigger source. + void (*SetMode)(comedi_device *dev,struct enc_private_struct *,uint16_t Setup,uint16_t DisableIntSrc); //Program standardized operating mode. + void (*ResetCapFlags)(comedi_device *dev,struct enc_private_struct *); //Reset event capture flags. + + uint16_t MyCRA; // Address of CRA register. + uint16_t MyCRB; // Address of CRB register. + uint16_t MyLatchLsw; // Address of Latch least-significant-word + // register. + uint16_t MyEventBits[4]; // Bit translations for IntSrc -->RDMISC2. +} enc_private; //counter object + +#define encpriv ((enc_private *)(dev->subdevices+5)->private) + +//counters routines +static void s626_timer_load(comedi_device *dev, enc_private *k, int tick); +static uint32_t ReadLatch(comedi_device *dev, enc_private *k ); +static void ResetCapFlags_A( comedi_device *dev, enc_private *k ); +static void ResetCapFlags_B(comedi_device *dev, enc_private *k); +static uint16_t GetMode_A( comedi_device *dev, enc_private *k ); +static uint16_t GetMode_B(comedi_device *dev, enc_private *k); +static void SetMode_A(comedi_device *dev, enc_private *k, uint16_t Setup, uint16_t DisableIntSrc ); +static void SetMode_B(comedi_device *dev, enc_private *k, uint16_t Setup, uint16_t DisableIntSrc ); +static void SetEnable_A( comedi_device *dev,enc_private *k, uint16_t enab ); +static void SetEnable_B( comedi_device *dev,enc_private *k, uint16_t enab ); +static uint16_t GetEnable_A(comedi_device *dev, enc_private *k ); +static uint16_t GetEnable_B( comedi_device *dev,enc_private *k ); +static void SetLatchSource(comedi_device *dev, enc_private *k, uint16_t value ); +/* static uint16_t GetLatchSource(comedi_device *dev, enc_private *k ); */ +static void SetLoadTrig_A(comedi_device *dev, enc_private *k, uint16_t Trig ); +static void SetLoadTrig_B(comedi_device *dev, enc_private *k, uint16_t Trig ); +static uint16_t GetLoadTrig_A(comedi_device *dev, enc_private *k ); +static uint16_t GetLoadTrig_B(comedi_device *dev, enc_private *k ); +static void SetIntSrc_B(comedi_device *dev, enc_private *k, uint16_t IntSource ); +static void SetIntSrc_A(comedi_device *dev, enc_private *k, uint16_t IntSource ); +static uint16_t GetIntSrc_A(comedi_device *dev, enc_private *k ); +static uint16_t GetIntSrc_B(comedi_device *dev, enc_private *k ); +/* static void SetClkMult(comedi_device *dev, enc_private *k, uint16_t value ) ; */ +/* static uint16_t GetClkMult(comedi_device *dev, enc_private *k ) ; */ +/* static void SetIndexPol(comedi_device *dev, enc_private *k, uint16_t value ); */ +/* static uint16_t GetClkPol(comedi_device *dev, enc_private *k ) ; */ +/* static void SetIndexSrc( comedi_device *dev,enc_private *k, uint16_t value ); */ +/* static uint16_t GetClkSrc( comedi_device *dev,enc_private *k ); */ +/* static void SetIndexSrc( comedi_device *dev,enc_private *k, uint16_t value ); */ +/* static uint16_t GetIndexSrc( comedi_device *dev,enc_private *k ); */ +static void PulseIndex_A(comedi_device *dev, enc_private *k ); +static void PulseIndex_B( comedi_device *dev,enc_private *k ); +static void Preload( comedi_device *dev,enc_private *k, uint32_t value ); +static void CountersInit(comedi_device *dev); +//end internal routines + +///////////////////////////////////////////////////////////////////////// +// Counter objects constructor. + +// Counter overflow/index event flag masks for RDMISC2. +#define INDXMASK(C) ( 1 << ( ( (C) > 2 ) ? ( (C) * 2 - 1 ) : ( (C) * 2 + 4 ) ) ) +#define OVERMASK(C) ( 1 << ( ( (C) > 2 ) ? ( (C) * 2 + 5 ) : ( (C) * 2 + 10 ) ) ) +#define EVBITS(C) { 0, OVERMASK(C), INDXMASK(C), OVERMASK(C) | INDXMASK(C) } + +// Translation table to map IntSrc into equivalent RDMISC2 event flag +// bits. +//static const uint16_t EventBits[][4] = { EVBITS(0), EVBITS(1), EVBITS(2), EVBITS(3), EVBITS(4), EVBITS(5) }; + +/* enc_private; */ +static enc_private enc_private_data[]={ + { + GetEnable: GetEnable_A, + GetIntSrc: GetIntSrc_A, + GetLoadTrig: GetLoadTrig_A, + GetMode: GetMode_A, + PulseIndex: PulseIndex_A, + SetEnable: SetEnable_A, + SetIntSrc: SetIntSrc_A, + SetLoadTrig: SetLoadTrig_A, + SetMode: SetMode_A, + ResetCapFlags: ResetCapFlags_A, + MyCRA: LP_CR0A, + MyCRB: LP_CR0B, + MyLatchLsw: LP_CNTR0ALSW, + MyEventBits: EVBITS(0), + }, + { + GetEnable: GetEnable_A, + GetIntSrc: GetIntSrc_A, + GetLoadTrig: GetLoadTrig_A, + GetMode: GetMode_A, + PulseIndex: PulseIndex_A, + SetEnable: SetEnable_A, + SetIntSrc: SetIntSrc_A, + SetLoadTrig: SetLoadTrig_A, + SetMode: SetMode_A, + ResetCapFlags: ResetCapFlags_A, + MyCRA: LP_CR1A, + MyCRB: LP_CR1B, + MyLatchLsw: LP_CNTR1ALSW, + MyEventBits: EVBITS(1), + }, + { + GetEnable: GetEnable_A, + GetIntSrc: GetIntSrc_A, + GetLoadTrig: GetLoadTrig_A, + GetMode: GetMode_A, + PulseIndex: PulseIndex_A, + SetEnable: SetEnable_A, + SetIntSrc: SetIntSrc_A, + SetLoadTrig: SetLoadTrig_A, + SetMode: SetMode_A, + ResetCapFlags: ResetCapFlags_A, + MyCRA: LP_CR2A, + MyCRB: LP_CR2B, + MyLatchLsw: LP_CNTR2ALSW, + MyEventBits: EVBITS(2), + }, + { + GetEnable: GetEnable_B, + GetIntSrc: GetIntSrc_B, + GetLoadTrig: GetLoadTrig_B, + GetMode: GetMode_B, + PulseIndex: PulseIndex_B, + SetEnable: SetEnable_B, + SetIntSrc: SetIntSrc_B, + SetLoadTrig: SetLoadTrig_B, + SetMode: SetMode_B, + ResetCapFlags: ResetCapFlags_B, + MyCRA: LP_CR0A, + MyCRB: LP_CR0B, + MyLatchLsw: LP_CNTR0BLSW, + MyEventBits: EVBITS(3), + }, + { + GetEnable: GetEnable_B, + GetIntSrc: GetIntSrc_B, + GetLoadTrig: GetLoadTrig_B, + GetMode: GetMode_B, + PulseIndex: PulseIndex_B, + SetEnable: SetEnable_B, + SetIntSrc: SetIntSrc_B, + SetLoadTrig: SetLoadTrig_B, + SetMode: SetMode_B, + ResetCapFlags: ResetCapFlags_B, + MyCRA: LP_CR1A, + MyCRB: LP_CR1B, + MyLatchLsw: LP_CNTR1BLSW, + MyEventBits: EVBITS(4), + }, + { + GetEnable: GetEnable_B, + GetIntSrc: GetIntSrc_B, + GetLoadTrig: GetLoadTrig_B, + GetMode: GetMode_B, + PulseIndex: PulseIndex_B, + SetEnable: SetEnable_B, + SetIntSrc: SetIntSrc_B, + SetLoadTrig: SetLoadTrig_B, + SetMode: SetMode_B, + ResetCapFlags: ResetCapFlags_B, + MyCRA: LP_CR2A, + MyCRB: LP_CR2B, + MyLatchLsw: LP_CNTR2BLSW, + MyEventBits: EVBITS(5), + }, +}; + +// enab/disable a function or test status bit(s) that are accessed +// through Main Control Registers 1 or 2. +#define MC_ENABLE( REGADRS, CTRLWORD ) writel( ( (uint32_t)( CTRLWORD ) << 16 ) | (uint32_t)( CTRLWORD ),devpriv->base_addr+( REGADRS ) ) + +#define MC_DISABLE( REGADRS, CTRLWORD ) writel( (uint32_t)( CTRLWORD ) << 16 , devpriv->base_addr+( REGADRS ) ) + +#define MC_TEST( REGADRS, CTRLWORD ) ( ( readl(devpriv->base_addr+( REGADRS )) & CTRLWORD ) != 0 ) + +/* #define WR7146(REGARDS,CTRLWORD) + writel(CTRLWORD,(uint32_t)(devpriv->base_addr+(REGARDS))) */ +#define WR7146(REGARDS,CTRLWORD) writel(CTRLWORD,devpriv->base_addr+(REGARDS)) + +/* #define RR7146(REGARDS) + readl((uint32_t)(devpriv->base_addr+(REGARDS))) */ +#define RR7146(REGARDS) readl(devpriv->base_addr+(REGARDS)) + +#define BUGFIX_STREG(REGADRS) ( REGADRS - 4 ) + +// Write a time slot control record to TSL2. +#define VECTPORT( VECTNUM ) (P_TSL2 + ( (VECTNUM) << 2 )) +#define SETVECT( VECTNUM, VECTVAL ) WR7146(VECTPORT( VECTNUM ), (VECTVAL)) + +// Code macros used for constructing I2C command bytes. +#define I2C_B2(ATTR,VAL) ( ( (ATTR) << 6 ) | ( (VAL) << 24 ) ) +#define I2C_B1(ATTR,VAL) ( ( (ATTR) << 4 ) | ( (VAL) << 16 ) ) +#define I2C_B0(ATTR,VAL) ( ( (ATTR) << 2 ) | ( (VAL) << 8 ) ) + +static comedi_lrange s626_range_table={ 2,{ + RANGE(-5 , 5), + RANGE(-10, 10), +}}; + +static int s626_attach(comedi_device *dev,comedi_devconfig *it) +{ +/* uint8_t PollList; */ +/* uint16_t AdcData; */ +/* uint16_t StartVal; */ +/* uint16_t index; */ +/* unsigned int data[16]; */ + int result; + int i; + int ret; + uint64_t resourceStart; + dma_addr_t appdma; + + if(alloc_private(dev,sizeof(s626_private))<0) + return -ENOMEM; + + devpriv->pdev=NULL; + + devpriv->pdev=pci_find_device(PCI_VENDOR_ID_S626, PCI_DEVICE_ID_S626, NULL); + + if(devpriv->pdev==NULL) { + printk("s626_attach: Board not present!!!"); + return -ENODEV; + } + + if((result = pci_enable_device(devpriv->pdev))<0){ + printk("s626_attach: pci_enable_device fails\n"); + return -ENODEV; + } + + resourceStart=(uint64_t)pci_resource_start(devpriv->pdev,0); + + devpriv->base_addr=ioremap(resourceStart, SIZEOF_ADDRESS_SPACE); + if (devpriv->base_addr==NULL) { + printk("s626_attach: IOREMAP failed\n"); + return -ENODEV; + } + + if (devpriv->base_addr){ + //disable master interrupt + writel(0,devpriv->base_addr+P_IER); + + //soft reset + writel(MC1_SOFT_RESET,devpriv->base_addr+P_MC1); + + //DMA FIXME DMA// + DEBUG("s626_attach: DMA ALLOCATION\n"); + + //adc buffer allocation + devpriv->allocatedBuf=0; + + if((devpriv->ANABuf.LogicalBase = pci_alloc_consistent (devpriv->pdev, DMABUF_SIZE, &appdma))==NULL){ + printk("s626_attach: DMA Memory mapping error\n"); + return -ENOMEM; + } + + devpriv->ANABuf.PhysicalBase=(void*)appdma; + + DEBUG("s626_attach: AllocDMAB ADC Logical=0x%x, bsize=%d, Physical=0x%x\n", + (uint32_t) devpriv->ANABuf.LogicalBase, DMABUF_SIZE, (uint32_t)devpriv->ANABuf.PhysicalBase); + + devpriv->allocatedBuf++; + + if((devpriv->RPSBuf.LogicalBase = pci_alloc_consistent (devpriv->pdev, DMABUF_SIZE, &appdma)) ==NULL){ + printk("s626_attach: DMA Memory mapping error\n"); + return -ENOMEM; + } + + devpriv->RPSBuf.PhysicalBase=(void*)appdma; + + DEBUG("s626_attach: AllocDMAB RPS Logical=0x%x, bsize=%d, Physical=0x%x\n", + (uint32_t) devpriv->RPSBuf.LogicalBase, DMABUF_SIZE, (uint32_t)devpriv->RPSBuf.PhysicalBase); + + devpriv->allocatedBuf++; + + } + + comedi_subdevice *s; + + dev->board_ptr = s626_boards; + dev->board_name = thisboard->name; + + if(alloc_subdevices(dev, 6)<0) + return -ENOMEM; + + dev->iobase = (int)devpriv->base_addr; + dev->irq = devpriv->pdev->irq; + + //set up interrupt handler + if(dev->irq==0){ + printk(" unknown irq (bad)\n"); + }else{ + if( (ret=comedi_request_irq(dev->irq,s626_irq_handler,SA_SHIRQ,"s626",dev))<0 ){ + printk(" irq not available\n"); + dev->irq=0; + } + } + + DEBUG("s626_attach: -- it opts %d -- \n",it->options[0]); + + s=dev->subdevices+0; + /* analog input subdevice */ + dev->read_subdev = s; + /* we support single-ended (ground) and differential */ + s->type=COMEDI_SUBD_AI; + s->subdev_flags=SDF_READABLE|SDF_DIFF; + s->n_chan=thisboard->ai_chans; + s->maxdata=(0xffff >> 2); + s->range_table=&s626_range_table; + s->len_chanlist=thisboard->ai_chans; /* This is the maximum chanlist + length that the board can + handle */ + s->insn_config = s626_ai_insn_config; + s->insn_read = s626_ai_insn_read; + s->do_cmd = s626_ai_cmd; + s->do_cmdtest = s626_ai_cmdtest; + s->cancel = s626_ai_cancel; + + s=dev->subdevices+1; + /* analog output subdevice */ + s->type=COMEDI_SUBD_AO; + s->subdev_flags=SDF_WRITABLE|SDF_READABLE; + s->n_chan=thisboard->ao_chans; + s->maxdata=(0x3fff); + s->range_table=&range_bipolar10; + s->insn_write = s626_ao_winsn; + s->insn_read = s626_ao_rinsn; + + s=dev->subdevices+2; + /* digital I/O subdevice */ + s->type=COMEDI_SUBD_DIO; + s->subdev_flags=SDF_WRITABLE|SDF_READABLE; + s->n_chan=S626_DIO_CHANNELS; + s->maxdata=1; + s->io_bits=0xffff; + s->private=&dio_private_A; + s->range_table=&range_digital; + s->insn_config=s626_dio_insn_config; + s->insn_bits = s626_dio_insn_bits; + + s=dev->subdevices+3; + /* digital I/O subdevice */ + s->type=COMEDI_SUBD_DIO; + s->subdev_flags=SDF_WRITABLE|SDF_READABLE; + s->n_chan=16; + s->maxdata=1; + s->io_bits=0xffff; + s->private=&dio_private_B; + s->range_table=&range_digital; + s->insn_config=s626_dio_insn_config; + s->insn_bits = s626_dio_insn_bits; + + s=dev->subdevices+4; + /* digital I/O subdevice */ + s->type=COMEDI_SUBD_DIO; + s->subdev_flags=SDF_WRITABLE|SDF_READABLE; + s->n_chan=16; + s->maxdata=1; + s->io_bits=0xffff; + s->private=&dio_private_C; + s->range_table=&range_digital; + s->insn_config=s626_dio_insn_config; + s->insn_bits = s626_dio_insn_bits; + + s=dev->subdevices+5; + /* encoder (counter) subdevice */ + s->type = COMEDI_SUBD_COUNTER; + s->subdev_flags = SDF_WRITABLE | SDF_READABLE | SDF_LSAMPL; + s->n_chan = thisboard->enc_chans; + s->private=enc_private_data; + s->insn_config = s626_enc_insn_config; + s->insn_read = s626_enc_insn_read; + s->insn_write = s626_enc_insn_write; + s->maxdata = 0xffffff; + s->range_table = &range_unknown; + + //stop ai_command + devpriv->ai_cmd_running=0; + + if (devpriv->base_addr && (devpriv->allocatedBuf==2)){ + + // enab DEBI and audio pins, enable I2C interface. + MC_ENABLE( P_MC1, MC1_DEBI | MC1_AUDIO | MC1_I2C ); + // Configure DEBI operating mode. + WR7146( P_DEBICFG, DEBI_CFG_SLAVE16 // Local bus is 16 + // bits wide. + | ( DEBI_TOUT << DEBI_CFG_TOUT_BIT )// Declare DEBI + // transfer timeout + // interval. + | DEBI_SWAP // Set up byte lane + // steering. + | DEBI_CFG_INTEL ); // Intel-compatible + // local bus (DEBI + // never times out). + DEBUG("s626_attach: %d debi init -- %d\n", DEBI_CFG_SLAVE16| ( DEBI_TOUT << DEBI_CFG_TOUT_BIT )| DEBI_SWAP| DEBI_CFG_INTEL, DEBI_CFG_INTEL | DEBI_CFG_TOQ | DEBI_CFG_INCQ| DEBI_CFG_16Q); + + //DEBI INIT S626 WR7146( P_DEBICFG, DEBI_CFG_INTEL | DEBI_CFG_TOQ + //| DEBI_CFG_INCQ| DEBI_CFG_16Q); //end + + // Paging is disabled. + WR7146( P_DEBIPAGE, DEBI_PAGE_DISABLE ); // Disable MMU paging. + + // Init GPIO so that ADC Start* is negated. + WR7146( P_GPIO, GPIO_BASE | GPIO1_HI ); + + //IsBoardRevA is a boolean that indicates whether the board is + //RevA. + + // VERSION 2.01 CHANGE: REV A & B BOARDS NOW SUPPORTED BY DYNAMIC + // EEPROM ADDRESS SELECTION. Initialize the I2C interface, which + // is used to access the onboard serial EEPROM. The EEPROM's I2C + // DeviceAddress is hardwired to a value that is dependent on the + // 626 board revision. On all board revisions, the EEPROM stores + // TrimDAC calibration constants for analog I/O. On RevB and + // higher boards, the DeviceAddress is hardwired to 0 to enable + // the EEPROM to also store the PCI SubVendorID and SubDeviceID; + // this is the address at which the SAA7146 expects a + // configuration EEPROM to reside. On RevA boards, the EEPROM + // device address, which is hardwired to 4, prevents the SAA7146 + // from retrieving PCI sub-IDs, so the SAA7146 uses its built-in + // default values, instead. + + // devpriv->I2Cards= IsBoardRevA ? 0xA8 : 0xA0; // Set I2C EEPROM + // DeviceType (0xA0) + // and DeviceAddress<<1. + + devpriv->I2CAdrs=0xA0; // I2C device address for onboard + // eeprom(revb) + + // Issue an I2C ABORT command to halt any I2C operation in + //progress and reset BUSY flag. + WR7146( P_I2CSTAT, I2C_CLKSEL | I2C_ABORT );// Write I2C control: + // abort any I2C + // activity. + MC_ENABLE( P_MC2, MC2_UPLD_IIC ); // Invoke command + // upload + while ( ( RR7146(P_MC2) & MC2_UPLD_IIC ) == 0 );// and wait for + // upload to + // complete. + + // Per SAA7146 data sheet, write to STATUS reg twice to reset all + // I2C error flags. + for ( i = 0; i < 2; i++ ) + { + WR7146( P_I2CSTAT, I2C_CLKSEL ); // Write I2C control: reset + // error flags. + MC_ENABLE( P_MC2, MC2_UPLD_IIC ); // Invoke command upload + while ( !MC_TEST( P_MC2, MC2_UPLD_IIC ) ); // and wait for + // upload to + // complete. + } + + // Init audio interface functional attributes: set DAC/ADC serial + // clock rates, invert DAC serial clock so that DAC data setup + // times are satisfied, enable DAC serial clock out. + WR7146( P_ACON2, ACON2_INIT ); + + // Set up TSL1 slot list, which is used to control the + // accumulation of ADC data: RSD1 = shift data in on SD1. SIB_A1 + // = store data uint8_t at next available location in FB BUFFER1 + // register. + WR7146( P_TSL1 , RSD1 | SIB_A1 ); // Fetch ADC high data + // uint8_t. + WR7146( P_TSL1 + 4, RSD1 | SIB_A1 | EOS ); // Fetch ADC low data + // uint8_t; end of + // TSL1. + + // enab TSL1 slot list so that it executes all the time. + WR7146( P_ACON1, ACON1_ADCSTART ); + + // Initialize RPS registers used for ADC. + + //Physical start of RPS program. + WR7146( P_RPSADDR1, (uint32_t)devpriv->RPSBuf.PhysicalBase ); + + WR7146( P_RPSPAGE1, 0 ); // RPS program performs no + // explicit mem writes. + WR7146( P_RPS1_TOUT, 0 ); // Disable RPS timeouts. + + // SAA7146 BUG WORKAROUND. Initialize SAA7146 ADC interface to a + // known state by invoking ADCs until FB BUFFER 1 register shows + // that it is correctly receiving ADC data. This is necessary + // because the SAA7146 ADC interface does not start up in a + // defined state after a PCI reset. + +/* PollList = EOPL; // Create a simple polling */ +/* // list for analog input */ +/* // channel 0. */ +/* ResetADC( dev, &PollList ); */ + +/* s626_ai_rinsn(dev,dev->subdevices,NULL,data); //( &AdcData ); // */ +/* //Get initial ADC */ +/* //value. */ + +/* StartVal = data[0]; */ + +/* // VERSION 2.01 CHANGE: TIMEOUT ADDED TO PREVENT HANGED EXECUTION. */ +/* // Invoke ADCs until the new ADC value differs from the initial */ +/* // value or a timeout occurs. The timeout protects against the */ +/* // possibility that the driver is restarting and the ADC data is a */ +/* // fixed value resulting from the applied ADC analog input being */ +/* // unusually quiet or at the rail. */ + +/* for ( index = 0; index < 500; index++ ) */ +/* { */ +/* s626_ai_rinsn(dev,dev->subdevices,NULL,data); */ +/* AdcData = data[0]; //ReadADC( &AdcData ); */ +/* if ( AdcData != StartVal ) */ +/* break; */ +/* } */ + + // end initADC + + // init the DAC interface + uint32_t *pPhysBuf; + + // Init Audio2's output DMAC attributes: burst length = 1 DWORD, + // threshold = 1 DWORD. + WR7146( P_PCI_BT_A, 0 ); + + // Init Audio2's output DMA physical addresses. The protection + // address is set to 1 DWORD past the base address so that a + // single DWORD will be transferred each time a DMA transfer is + // enabled. + + pPhysBuf = (uint32_t *)devpriv->ANABuf.PhysicalBase + DAC_WDMABUF_OS; + + WR7146( P_BASEA2_OUT, (uint32_t) pPhysBuf ); // Buffer base adrs. + WR7146( P_PROTA2_OUT, (uint32_t) (pPhysBuf + 1) ); // Protection address. + + // Cache Audio2's output DMA buffer logical address. This is + // where DAC data is buffered for A2 output DMA transfers. + devpriv->pDacWBuf = (uint32_t *)devpriv->ANABuf.LogicalBase + DAC_WDMABUF_OS; + + // Audio2's output channels does not use paging. The protection + // violation handling bit is set so that the DMAC will + // automatically halt and its PCI address pointer will be reset + // when the protection address is reached. + WR7146( P_PAGEA2_OUT, 8 ); + + // Initialize time slot list 2 (TSL2), which is used to control + // the clock generation for and serialization of data to be sent + // to the DAC devices. Slot 0 is a NOP that is used to trap TSL + // execution; this permits other slots to be safely modified + // without first turning off the TSL sequencer (which is + // apparently impossible to do). Also, SD3 (which is driven by a + // pull-up resistor) is shifted in and stored to the MSB of + // FB_BUFFER2 to be used as evidence that the slot sequence has + // not yet finished executing. + SETVECT( 0, XSD2 | RSD3 | SIB_A2 | EOS ); // Slot 0: Trap TSL + // execution, shift 0xFF + // into FB_BUFFER2. + + // Initialize slot 1, which is constant. Slot 1 causes a DWORD to + // be transferred from audio channel 2's output FIFO to the FIFO's + // output buffer so that it can be serialized and sent to the DAC + // during subsequent slots. All remaining slots are dynamically + // populated as required by the target DAC device. + SETVECT( 1, LF_A2 ); // Slot 1: Fetch DWORD from Audio2's + // output FIFO. + + // Start DAC's audio interface (TSL2) running. + WR7146( P_ACON1, ACON1_DACSTART ); + + //////////////////////////////////////////////////////// + + // end init DAC interface + + // Init Trim DACs to calibrated values. Do it twice because the + // SAA7146 audio channel does not always reset properly and + // sometimes causes the first few TrimDAC writes to malfunction. + + LoadTrimDACs( dev); + LoadTrimDACs( dev); // Insurance. + + ////////////////////////////////////////////////////////////////// + // Manually init all gate array hardware in case this is a soft + // reset (we have no way of determining whether this is a warm or + // cold start). This is necessary because the gate array will + // reset only in response to a PCI hard reset; there is no soft + // reset function. + + // Init all DAC outputs to 0V and init all DAC setpoint and + // polarity images. + uint16_t chan; + for ( chan = 0; chan < S626_DAC_CHANNELS; chan++) + SetDAC(dev,chan, 0 ); + + // Init image of WRMISC2 Battery Charger Enabled control bit. + // This image is used when the state of the charger control bit, + // which has no direct hardware readback mechanism, is queried. + devpriv->ChargeEnabled = 0; + + // Init image of watchdog timer interval in WRMISC2. This image + // maintains the value of the control bits of MISC2 are + // continuously reset to zero as long as the WD timer is disabled. + devpriv->WDInterval = 0; + + // Init Counter Interrupt enab mask for RDMISC2. This mask is + // applied against MISC2 when testing to determine which timer + // events are requesting interrupt service. + devpriv->CounterIntEnabs = 0; + + // Init counters. + CountersInit(dev); + + // Without modifying the state of the Battery Backup enab, disable + // the watchdog timer, set DIO channels 0-5 to operate in the + // standard DIO (vs. counter overflow) mode, disable the battery + // charger, and reset the watchdog interval selector to zero. + WriteMISC2(dev, (uint16_t)( DEBIread( dev,LP_RDMISC2 ) & MISC2_BATT_ENABLE ) ); + + // Initialize the digital I/O subsystem. + s626_dio_init(dev); + + //enable interrupt test + // writel(IRQ_GPIO3 | IRQ_RPS1,devpriv->base_addr+P_IER); + } + + DEBUG("s626_attach: comedi%d s626 attached %04x\n",dev->minor,(uint32_t)devpriv->base_addr); + + return 1; +} + +static lsampl_t s626_ai_reg_to_uint(int data){ + lsampl_t tempdata; + + tempdata=(data >> 18); + if(tempdata&0x2000) + tempdata&=0x1fff; + else + tempdata+=(1<<13); + + return tempdata; +} + +/* static lsampl_t s626_uint_to_reg(comedi_subdevice *s, int data){ */ +/* return 0; */ +/* } */ + +static irqreturn_t s626_irq_handler(int irq,void *d,struct pt_regs * regs) +{ + comedi_device *dev=d; + comedi_subdevice *s; + comedi_cmd *cmd; + enc_private *k; + unsigned long flags; + int32_t *readaddr; + uint32_t irqtype,irqstatus,datacount; + int kernel_transfer=0; + int i=0; + sampl_t *databuf=NULL; + sampl_t tempdata; + uint8_t group; + uint16_t irqbit; + + DEBUG("s626_irq_handler: interrupt request recieved!!!\n"); + + if(dev->attached == 0) return IRQ_NONE; + // lock to avoid race with comedi_poll + comedi_spin_lock_irqsave(&dev->spinlock, flags); + + //save interrupt enable register state + irqstatus=readl(devpriv->base_addr+P_IER); + + //read interrupt type + irqtype=readl(devpriv->base_addr+P_ISR); + + //disable master interrupt + writel(0,devpriv->base_addr+P_IER); + + //clear interrupt + writel(irqtype,devpriv->base_addr+P_ISR); + + //do somethings + DEBUG("s626_irq_handler: interrupt type %d\n",irqtype); + + switch(irqtype){ + case IRQ_RPS1: // end_of_scan occurs + + DEBUG("s626_irq_handler: RPS1 irq detected\n"); + + // manage ai subdevice + s=dev->subdevices; + cmd=&(s->async->cmd); + + // verify if data buffer exists + if(s->async->cmd.data!=NULL){ + DEBUG("s626_irq_handler: Kernel transfer asserted\n"); + kernel_transfer=1; + databuf=s->async->cmd.data; + datacount=s->async->cmd.data_len; + } + + // Init ptr to DMA buffer that holds new ADC data. We skip the + // first uint16_t in the buffer because it contains junk data from + // the final ADC of the previous poll list scan. + readaddr = (int32_t *)devpriv->ANABuf.LogicalBase + 1; + + // get the data and hand it over to comedi + for(i=0;i<(s->async->cmd.chanlist_len);i++) { + // Convert ADC data to 16-bit integer values and copy to application + // buffer. + tempdata=s626_ai_reg_to_uint((int)*readaddr); + readaddr++; + + if(kernel_transfer){ + //send buffer overflow event + DEBUG("s626_irq_handler: in kernel transfer...\n"); + if(datacount<0){ + s->async->events|=COMEDI_CB_OVERFLOW; + } else { + datacount--; + // transfer data + *databuf++=tempdata; + } + } + + //put data into read buffer + // comedi_buf_put(s->async, tempdata); + if(cfc_write_to_buffer(s,tempdata)==0) printk("s626_irq_handler: cfc_write_to_buffer error!\n"); + + DEBUG("s626_irq_handler: ai channel %d acquired: %d\n",i,tempdata); + } + + //end of scan occurs + s->async->events|=COMEDI_CB_EOS; + + if(!(devpriv->ai_continous)) devpriv->ai_sample_count--; + if(devpriv->ai_sample_count<=0){ + devpriv->ai_cmd_running=0; + + // Stop RPS program. + MC_DISABLE( P_MC1, MC1_ERPS1 ); + + //send end of acquisition + s->async->events|=COMEDI_CB_EOA; + + //disable master interrupt + irqstatus=0; + } + + if(devpriv->ai_cmd_running && cmd->scan_begin_src==TRIG_EXT){ + DEBUG("s626_irq_handler: enable interrupt on dio channel %d\n",cmd->scan_begin_arg); + + s626_dio_set_irq(dev,cmd->scan_begin_arg); + + DEBUG("s626_irq_handler: External trigger is set!!!\n"); + } + + // tell comedi that data is there + DEBUG("s626_irq_handler: events %d\n",s->async->events); + comedi_event(dev, s, s->async->events); + break; + case IRQ_GPIO3: //check dio and conter interrupt + + DEBUG("s626_irq_handler: GPIO3 irq detected\n"); + + // manage ai subdevice + s=dev->subdevices; + cmd=&(s->async->cmd); + + //s626_dio_clear_irq(dev); + + for(group=0;groupsubdevices+2+group)->private)->RDCapFlg); + + //check if interrupt is generated from dio channels + if(irqbit){ + s626_dio_reset_irq(dev,group,irqbit); + DEBUG("s626_irq_handler: check interrupt on dio group %d %d\n",group,i); + if(devpriv->ai_cmd_running){ + //check if interrupt is an ai acquisition start trigger + if((irqbit>>(cmd->start_arg-(16*group)))==1 && cmd->start_src==TRIG_EXT){ + DEBUG("s626_irq_handler: Edge capture interrupt recieved from channel %d\n",cmd->start_arg); + + // Start executing the RPS program. + MC_ENABLE( P_MC1, MC1_ERPS1 ); + + DEBUG("s626_irq_handler: aquisition start triggered!!!\n"); + + if(cmd->scan_begin_src==TRIG_EXT){ + DEBUG("s626_ai_cmd: enable interrupt on dio channel %d\n",cmd->scan_begin_arg); + + s626_dio_set_irq(dev,cmd->scan_begin_arg); + + DEBUG("s626_irq_handler: External scan trigger is set!!!\n"); + } + } + if((irqbit>>(cmd->scan_begin_arg-(16*group)))==1 && cmd->scan_begin_src==TRIG_EXT){ + DEBUG("s626_irq_handler: Edge capture interrupt recieved from channel %d\n",cmd->scan_begin_arg); + + // Trigger ADC scan loop start by setting RPS Signal 0. + MC_ENABLE( P_MC2, MC2_ADC_RPS ); + + DEBUG("s626_irq_handler: scan triggered!!! %d\n",devpriv->ai_sample_count); + if(cmd->convert_src==TRIG_EXT){ + + DEBUG("s626_ai_cmd: enable interrupt on dio channel %d group %d\n",cmd->convert_arg-(16*group),group); + + devpriv->ai_convert_count=cmd->chanlist_len; + + s626_dio_set_irq(dev,cmd->convert_arg); + + DEBUG("s626_irq_handler: External convert trigger is set!!!\n"); + } + + if(cmd->convert_src==TRIG_TIMER){ + k=&encpriv[5]; + devpriv->ai_convert_count=cmd->chanlist_len; + k->SetEnable(dev,k,CLKENAB_ALWAYS); + } + } + if((irqbit>>(cmd->convert_arg-(16*group)))==1 && cmd->convert_src==TRIG_EXT){ + DEBUG("s626_irq_handler: Edge capture interrupt recieved from channel %d\n",cmd->convert_arg); + + // Trigger ADC scan loop start by setting RPS Signal 0. + MC_ENABLE( P_MC2, MC2_ADC_RPS ); + + DEBUG("s626_irq_handler: adc convert triggered!!!\n"); + + devpriv->ai_convert_count--; + + if(devpriv->ai_convert_count>0){ + + DEBUG("s626_ai_cmd: enable interrupt on dio channel %d group %d\n",cmd->convert_arg-(16*group),group); + + s626_dio_set_irq(dev,cmd->convert_arg); + + DEBUG("s626_irq_handler: External trigger is set!!!\n"); + } + } + } + break; + } + } + + //read interrupt type + irqbit=DEBIread(dev,LP_RDMISC2); + + //check interrupt on counters + DEBUG("s626_irq_handler: check counters interrupt %d\n",irqbit); + + if(irqbit&IRQ_COINT1A){ + DEBUG("s626_irq_handler: interrupt on counter 1A overflow\n"); + k=&encpriv[0]; + + //clear interrupt capture flag + k->ResetCapFlags(dev,k); + } + if(irqbit&IRQ_COINT2A){ + DEBUG("s626_irq_handler: interrupt on counter 2A overflow\n"); + k=&encpriv[1]; + + //clear interrupt capture flag + k->ResetCapFlags(dev,k); + } + if(irqbit&IRQ_COINT3A){ + DEBUG("s626_irq_handler: interrupt on counter 3A overflow\n"); + k=&encpriv[2]; + + //clear interrupt capture flag + k->ResetCapFlags(dev,k); + } + if(irqbit&IRQ_COINT1B){ + DEBUG("s626_irq_handler: interrupt on counter 1B overflow\n"); + k=&encpriv[3]; + + //clear interrupt capture flag + k->ResetCapFlags(dev,k); + } + if(irqbit&IRQ_COINT2B){ + DEBUG("s626_irq_handler: interrupt on counter 2B overflow\n"); + k=&encpriv[4]; + + //clear interrupt capture flag + k->ResetCapFlags(dev,k); + + if(devpriv->ai_convert_count>0){ + devpriv->ai_convert_count--; + if(devpriv->ai_convert_count==0) k->SetEnable(dev,k,CLKENAB_INDEX); + + if(cmd->convert_src==TRIG_TIMER){ + DEBUG("s626_irq_handler: conver timer trigger!!! %d\n",devpriv->ai_convert_count); + + // Trigger ADC scan loop start by setting RPS Signal 0. + MC_ENABLE( P_MC2, MC2_ADC_RPS ); + } + } + } + if(irqbit&IRQ_COINT3B){ + DEBUG("s626_irq_handler: interrupt on counter 3B overflow\n"); + k=&encpriv[5]; + + //clear interrupt capture flag + k->ResetCapFlags(dev,k); + + if(cmd->scan_begin_src==TRIG_TIMER){ + DEBUG("s626_irq_handler: scan timer trigger!!!\n"); + + // Trigger ADC scan loop start by setting RPS Signal 0. + MC_ENABLE( P_MC2, MC2_ADC_RPS ); + } + + if(cmd->convert_src==TRIG_TIMER){ + DEBUG("s626_irq_handler: convert timer trigger is set\n"); + k=&encpriv[4]; + devpriv->ai_convert_count=cmd->chanlist_len; + k->SetEnable(dev,k,CLKENAB_ALWAYS); + } + } + } + + //enable interrupt + writel(irqstatus,devpriv->base_addr+P_IER); + + DEBUG("s626_irq_handler: exit interrupt service routine.\n"); + + comedi_spin_unlock_irqrestore(&dev->spinlock, flags); + return IRQ_HANDLED; +} + +static int s626_detach(comedi_device *dev) +{ + + //stop ai_command + devpriv->ai_cmd_running=0; + + //interrupt mask + WR7146( P_IER, 0 ); // Disable master interrupt. + WR7146( P_ISR, IRQ_GPIO3 | IRQ_RPS1 ); // Clear board's IRQ status + // flag. + + // Disable the watchdog timer and battery charger. + WriteMISC2(dev,0); + + // Close all interfaces on 7146 device. + WR7146( P_MC1, MC1_SHUTDOWN ); + WR7146( P_ACON1, ACON1_BASE ); + + CloseDMAB(dev,&devpriv->RPSBuf,DMABUF_SIZE); + CloseDMAB(dev,&devpriv->ANABuf,DMABUF_SIZE); + + if(dev->irq){ + comedi_free_irq(dev->irq,dev); + } + + iounmap(devpriv->base_addr); + + DEBUG("s626_detach: S626 detached!\n"); + + return 0; +} + +/* + * this functions build the RPS program for hardware driven acquistion + */ +void ResetADC(comedi_device *dev,uint8_t *ppl ) +{ + register uint32_t *pRPS; + uint32_t JmpAdrs; + uint16_t i; + uint16_t n; + uint32_t LocalPPL; + comedi_cmd *cmd=&(dev->subdevices->async->cmd); + + // Stop RPS program in case it is currently running. + MC_DISABLE( P_MC1, MC1_ERPS1 ); + + // Set starting logical address to write RPS commands. + pRPS = (uint32_t *)devpriv->RPSBuf.LogicalBase; + + // Initialize RPS instruction pointer. + WR7146( P_RPSADDR1, (uint32_t)devpriv->RPSBuf.PhysicalBase ); + + // Construct RPS program in RPSBuf DMA buffer + + if(cmd!=NULL && cmd->scan_begin_src!=TRIG_FOLLOW){ + DEBUG("ResetADC: scan_begin pause inserted\n"); + // Wait for Start trigger. + *pRPS++= RPS_PAUSE | RPS_SIGADC ; + *pRPS++= RPS_CLRSIGNAL | RPS_SIGADC ; + } + + // SAA7146 BUG WORKAROUND Do a dummy DEBI Write. This is necessary + // because the first RPS DEBI Write following a non-RPS DEBI write + // seems to always fail. If we don't do this dummy write, the ADC + // gain might not be set to the value required for the first slot in + // the poll list; the ADC gain would instead remain unchanged from + // the previously programmed value. + *pRPS++=RPS_LDREG | (P_DEBICMD >> 2) ; // Write DEBI Write command + // and address to shadow RAM. + *pRPS++= DEBI_CMD_WRWORD | LP_GSEL ; + *pRPS++= RPS_LDREG | (P_DEBIAD >> 2) ; // Write DEBI immediate data + // to shadow RAM: + *pRPS++= GSEL_BIPOLAR5V ; // arbitrary immediate data + // value. + *pRPS++= RPS_CLRSIGNAL | RPS_DEBI ; // Reset "shadow RAM + // uploaded" flag. + *pRPS++= RPS_UPLOAD | RPS_DEBI ; // Invoke shadow RAM upload. + *pRPS++= RPS_PAUSE | RPS_DEBI ; // Wait for shadow upload to finish. + + // Digitize all slots in the poll list. This is implemented as a + // for loop to limit the slot count to 16 in case the application + // forgot to set the EOPL flag in the final slot. + for ( devpriv->AdcItems = 0; devpriv->AdcItems < 16; devpriv->AdcItems++ ) { + // Convert application's poll list item to private board class + // format. Each app poll list item is an uint8_t with form + // (EOPL,x,x,RANGE,CHAN<3:0>), where RANGE code indicates 0 = + // +-10V, 1 = +-5V, and EOPL = End of Poll List marker. + LocalPPL = ( *ppl << 8 ) | ( *ppl & 0x10 ? GSEL_BIPOLAR5V : GSEL_BIPOLAR10V ); + + // Switch ADC analog gain. + *pRPS++= RPS_LDREG | (P_DEBICMD >> 2) ; // Write DEBI command + // and address to + // shadow RAM. + *pRPS++= DEBI_CMD_WRWORD | LP_GSEL ; + *pRPS++ =RPS_LDREG | (P_DEBIAD >> 2) ; // Write DEBI + // immediate data to + // shadow RAM. + *pRPS++= LocalPPL ; + *pRPS++= RPS_CLRSIGNAL | RPS_DEBI ; // Reset "shadow RAM uploaded" + // flag. + *pRPS++= RPS_UPLOAD | RPS_DEBI ; // Invoke shadow RAM upload. + *pRPS++= RPS_PAUSE | RPS_DEBI ; // Wait for shadow upload to + // finish. + + // Select ADC analog input channel. + *pRPS++= RPS_LDREG | (P_DEBICMD >> 2) ; // Write DEBI command + // and address to + // shadow RAM. + *pRPS++= DEBI_CMD_WRWORD | LP_ISEL ; + *pRPS++= RPS_LDREG | (P_DEBIAD >> 2) ; // Write DEBI + // immediate data to + // shadow RAM. + *pRPS++= LocalPPL ; + *pRPS++= RPS_CLRSIGNAL | RPS_DEBI ; // Reset "shadow RAM uploaded" + // flag. + *pRPS++= RPS_UPLOAD | RPS_DEBI ; // Invoke shadow RAM upload. + *pRPS++= RPS_PAUSE | RPS_DEBI ; // Wait for shadow upload to + // finish. + + // Delay at least 10 microseconds for analog input settling. + // Instead of padding with NOPs, we use RPS_JUMP instructions + // here; this allows us to produce a longer delay than is + // possible with NOPs because each RPS_JUMP flushes the RPS' + // instruction prefetch pipeline. + JmpAdrs = (uint32_t)devpriv->RPSBuf.PhysicalBase + (uint32_t)pRPS - (uint32_t)devpriv->RPSBuf.LogicalBase; + for ( i = 0; i < ( 10 * RPSCLK_PER_US / 2); i++ ) { + JmpAdrs += 8; // Repeat to implement time delay: + * pRPS++= RPS_JUMP ; // Jump to next RPS instruction. + * pRPS++= JmpAdrs ; + } + + if(cmd!=NULL && cmd->convert_src!=TRIG_NOW){ + DEBUG("ResetADC: convert pause inserted\n"); + // Wait for Start trigger. + *pRPS++= RPS_PAUSE | RPS_SIGADC ; + *pRPS++= RPS_CLRSIGNAL | RPS_SIGADC ; + } + + // Start ADC by pulsing GPIO1. + *pRPS++= RPS_LDREG | (P_GPIO >> 2) ; // Begin ADC Start pulse. + *pRPS++= GPIO_BASE | GPIO1_LO ; + *pRPS++= RPS_NOP ; + // VERSION 2.03 CHANGE: STRETCH OUT ADC START PULSE. + *pRPS++= RPS_LDREG | (P_GPIO >> 2) ; // End ADC Start pulse. + *pRPS++= GPIO_BASE | GPIO1_HI ; + + // Wait for ADC to complete (GPIO2 is asserted high when ADC not + // busy) and for data from previous conversion to shift into FB + // BUFFER 1 register. + *pRPS++= RPS_PAUSE | RPS_GPIO2 ; // Wait for ADC done. + + // Transfer ADC data from FB BUFFER 1 register to DMA buffer. + *pRPS++=RPS_STREG | ( BUGFIX_STREG( P_FB_BUFFER1 ) >> 2 ) ; + *pRPS++= (uint32_t)devpriv->ANABuf.PhysicalBase + ( devpriv->AdcItems << 2 ) ; + + // If this slot's EndOfPollList flag is set, all channels have + // now been processed. + if ( *ppl++ & EOPL ) { + devpriv->AdcItems++; // Adjust poll list item count. + break; // Exit poll list processing loop. + } + } + DEBUG("ResetADC: ADC items %d \n",devpriv->AdcItems); + + // VERSION 2.01 CHANGE: DELAY CHANGED FROM 250NS to 2US. Allow the + // ADC to stabilize for 2 microseconds before starting the final + // (dummy) conversion. This delay is necessary to allow sufficient + // time between last conversion finished and the start of the dummy + // conversion. Without this delay, the last conversion's data value + // is sometimes set to the previous conversion's data value. + for ( n = 0; n < ( 2 * RPSCLK_PER_US ); n++ ) *pRPS++=RPS_NOP ; + + // Start a dummy conversion to cause the data from the last + // conversion of interest to be shifted in. + *pRPS++= RPS_LDREG | (P_GPIO >> 2) ; // Begin ADC Start pulse. + *pRPS++=GPIO_BASE | GPIO1_LO ; + *pRPS++=RPS_NOP ; + // VERSION 2.03 CHANGE: STRETCH OUT ADC START PULSE. + *pRPS++=RPS_LDREG | (P_GPIO >> 2) ; // End ADC Start pulse. + *pRPS++=GPIO_BASE | GPIO1_HI ; + + // Wait for the data from the last conversion of interest to arrive + // in FB BUFFER 1 register. + *pRPS++= RPS_PAUSE | RPS_GPIO2 ; // Wait for ADC done. + + // Transfer final ADC data from FB BUFFER 1 register to DMA buffer. + *pRPS++=RPS_STREG | ( BUGFIX_STREG( P_FB_BUFFER1 ) >> 2 ) ;// + *pRPS++=(uint32_t)devpriv->ANABuf.PhysicalBase + ( devpriv->AdcItems << 2 ) ; + + // Indicate ADC scan loop is finished. + // *pRPS++= RPS_CLRSIGNAL | RPS_SIGADC ; // Signal ReadADC() that scan is done. + + //invoke interrupt + if(devpriv->ai_cmd_running==1){ + DEBUG("ResetADC: insert irq in ADC RPS task\n"); + *pRPS++= RPS_IRQ ; + } + + // Restart RPS program at its beginning. + *pRPS++= RPS_JUMP ; // Branch to start of RPS program. + *pRPS++=(uint32_t)devpriv->RPSBuf.PhysicalBase ; + + // End of RPS program build + // ------------------------------------------------------------ +} + +/* TO COMPLETE, IF NECESSARY */ +static int s626_ai_insn_config(comedi_device*dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data){ + + return -EINVAL; +} + +/* static int s626_ai_rinsn(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) */ +/* { */ +/* register uint8_t i; */ +/* register int32_t *readaddr; */ + +/* DEBUG("as626_ai_rinsn: ai_rinsn enter \n"); */ + +/* // Trigger ADC scan loop start by setting RPS Signal 0. */ +/* MC_ENABLE( P_MC2, MC2_ADC_RPS ); */ + +/* // Wait until ADC scan loop is finished (RPS Signal 0 reset). */ +/* while ( MC_TEST( P_MC2, MC2_ADC_RPS ) ); */ + +/* // Init ptr to DMA buffer that holds new ADC data. We skip the */ +/* // first uint16_t in the buffer because it contains junk data from */ +/* // the final ADC of the previous poll list scan. */ +/* readaddr = (uint32_t *)devpriv->ANABuf.LogicalBase + 1; */ + +/* // Convert ADC data to 16-bit integer values and copy to application */ +/* // buffer. */ +/* for ( i = 0; i < devpriv->AdcItems; i++ ) { */ +/* *data = s626_ai_reg_to_uint( *readaddr++ ); */ +/* DEBUG("s626_ai_rinsn: data %d \n",*data); */ +/* data++; */ +/* } */ + +/* DEBUG("s626_ai_rinsn: ai_rinsn escape \n"); */ +/* return i; */ +/* } */ + +static int s626_ai_insn_read(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) +{ + uint16_t chan = CR_CHAN(insn->chanspec); + uint16_t range = CR_RANGE(insn->chanspec); + uint16_t AdcSpec=0; + uint32_t GpioImage; + int n; + +/* //interrupt call test */ +/* writel(IRQ_GPIO3,devpriv->base_addr+P_PSR); //Writing a logical 1 */ +/* //into any of the RPS_PSR */ +/* //bits causes the */ +/* //corresponding interrupt */ +/* //to be generated if */ +/* //enabled */ + + DEBUG("s626_ai_insn_read: entering\n"); + + // Convert application's ADC specification into form + // appropriate for register programming. + if(range==0) AdcSpec = ( chan << 8 ) | ( GSEL_BIPOLAR5V ); + else AdcSpec = ( chan << 8 ) | ( GSEL_BIPOLAR10V ); + + // Switch ADC analog gain. + DEBIwrite( dev, LP_GSEL, AdcSpec ); // Set gain. + + // Select ADC analog input channel. + DEBIwrite( dev, LP_ISEL, AdcSpec ); // Select channel. + + for(n=0; nn; n++){ + + // Delay 10 microseconds for analog input settling. + comedi_udelay(10); + + // Start ADC by pulsing GPIO1 low. + GpioImage = RR7146( P_GPIO ); + // Assert ADC Start command + WR7146( P_GPIO, GpioImage & ~GPIO1_HI ); + // and stretch it out. + WR7146( P_GPIO, GpioImage & ~GPIO1_HI ); + WR7146( P_GPIO, GpioImage & ~GPIO1_HI ); + // Negate ADC Start command. + WR7146( P_GPIO, GpioImage | GPIO1_HI ); + + // Wait for ADC to complete (GPIO2 is asserted high when + // ADC not busy) and for data from previous conversion to + // shift into FB BUFFER 1 register. + + // Wait for ADC done. + while ( !( RR7146( P_PSR ) & PSR_GPIO2 ) ); + + // Fetch ADC data. + if(n!=0) data[n-1]=s626_ai_reg_to_uint(RR7146( P_FB_BUFFER1 )); + + // Allow the ADC to stabilize for 4 microseconds before + // starting the next (final) conversion. This delay is + // necessary to allow sufficient time between last + // conversion finished and the start of the next + // conversion. Without this delay, the last conversion's + // data value is sometimes set to the previous + // conversion's data value. + comedi_udelay(4); + } + + // Start a dummy conversion to cause the data from the + // previous conversion to be shifted in. + GpioImage = RR7146( P_GPIO ); + + //Assert ADC Start command + WR7146( P_GPIO, GpioImage & ~GPIO1_HI ); + // and stretch it out. + WR7146( P_GPIO, GpioImage & ~GPIO1_HI ); + WR7146( P_GPIO, GpioImage & ~GPIO1_HI ); + // Negate ADC Start command. + WR7146( P_GPIO, GpioImage | GPIO1_HI ); + + // Wait for the data to arrive in FB BUFFER 1 register. + + // Wait for ADC done. + while ( !( RR7146( P_PSR ) & PSR_GPIO2 ) ); + + // Fetch ADC data from audio interface's input shift + // register. + + // Fetch ADC data. + if(n!=0) data[n-1]=s626_ai_reg_to_uint(RR7146( P_FB_BUFFER1 )); + + DEBUG("s626_ai_insn_read: samples %d, data %d\n",n,data[n-1]); + + return n; +} + +static int s626_ai_load_polllist(uint8_t *ppl, comedi_cmd *cmd){ + + int n; + + for(n=0;nchanlist_len;n++){ + if(CR_RANGE((cmd->chanlist)[n])==0) ppl[n]= ( CR_CHAN((cmd->chanlist)[n]) ) | ( RANGE_5V ); + else ppl[n] = ( CR_CHAN((cmd->chanlist)[n]) ) | ( RANGE_10V ); + } + ppl[n-1] |= EOPL; + + return n; +} + +static int s626_ai_inttrig(comedi_device *dev,comedi_subdevice *s, + unsigned int trignum) +{ + if(trignum!=0) return -EINVAL; + + DEBUG("s626_ai_inttrig: trigger adc start..."); + + // Start executing the RPS program. + MC_ENABLE( P_MC1, MC1_ERPS1 ); + + s->async->inttrig=NULL; + + DEBUG(" done\n"); + + return 1; +} + +/* TO COMPLETE */ +static int s626_ai_cmd(comedi_device *dev,comedi_subdevice *s){ + + uint8_t ppl[16]; + comedi_cmd *cmd=&s->async->cmd; + enc_private *k; + int tick; + + + DEBUG("s626_ai_cmd: entering command function\n"); + + if (devpriv->ai_cmd_running) { + printk("s626_ai_cmd: Another ai_cmd is running %d\n", dev->minor); + return -EBUSY; + } + + //disable interrupt + writel(0,devpriv->base_addr+P_IER); + + //clear interrupt request + writel(IRQ_RPS1|IRQ_GPIO3,devpriv->base_addr+P_ISR); + + //clear any pending interrupt + s626_dio_clear_irq(dev); + // s626_enc_clear_irq(dev); + + //reset ai_cmd_running flag + devpriv->ai_cmd_running=0; + + // test if cmd is valid + if(cmd==NULL){ + DEBUG("s626_ai_cmd: NULL command\n"); + return -EINVAL; + } else { + DEBUG("s626_ai_cmd: command recieved!!!\n"); + } + + if(dev->irq == 0){ + comedi_error(dev, "s626_ai_cmd: cannot run command without an irq"); + return -EIO; + } + + s626_ai_load_polllist(ppl,cmd); + devpriv->ai_cmd_running=1; + devpriv->ai_convert_count=0; + + switch(cmd->scan_begin_src){ + case TRIG_FOLLOW: + break; + case TRIG_TIMER: + // set a conter to generate adc trigger at scan_begin_arg interval + k=&encpriv[5]; + tick=s626_ns_to_timer((int *)&cmd->scan_begin_arg,cmd->flags&TRIG_ROUND_MASK); + + //load timer value and enable interrupt + s626_timer_load(dev, k, tick); + k->SetEnable(dev,k,CLKENAB_ALWAYS); + + DEBUG("s626_ai_cmd: scan trigger timer is set with value %d\n",tick); + + break; + case TRIG_EXT: + // set the digital line and interrupt for scan trigger + if(cmd->start_src!=TRIG_EXT) s626_dio_set_irq(dev,cmd->scan_begin_arg); + + DEBUG("s626_ai_cmd: External scan trigger is set!!!\n"); + + break; + } + + switch(cmd->convert_src){ + case TRIG_NOW: + break; + case TRIG_TIMER: + // set a conter to generate adc trigger at convert_arg interval + k=&encpriv[4]; + tick=s626_ns_to_timer((int *)&cmd->convert_arg,cmd->flags&TRIG_ROUND_MASK); + + //load timer value and enable interrupt + s626_timer_load(dev, k, tick); + k->SetEnable(dev,k,CLKENAB_INDEX); + + DEBUG("s626_ai_cmd: convert trigger timer is set with value %d\n",tick); + break; + case TRIG_EXT: + // set the digital line and interrupt for convert trigger + if(cmd->scan_begin_src!=TRIG_EXT && cmd->start_src==TRIG_EXT) + s626_dio_set_irq(dev, cmd->convert_arg); + + DEBUG("s626_ai_cmd: External convert trigger is set!!!\n"); + + break; + } + + switch(cmd->stop_src){ + case TRIG_COUNT: + // data arrives as one packet + devpriv->ai_sample_count=cmd->stop_arg; + devpriv->ai_continous=0; + break; + case TRIG_NONE: + // continous aquisition + devpriv->ai_continous=1; + devpriv->ai_sample_count=0; + break; + } + + ResetADC(dev,ppl); + + switch(cmd->start_src){ + case TRIG_NOW: + // Trigger ADC scan loop start by setting RPS Signal 0. + // MC_ENABLE( P_MC2, MC2_ADC_RPS ); + + // Start executing the RPS program. + MC_ENABLE( P_MC1, MC1_ERPS1 ); + + DEBUG("s626_ai_cmd: ADC triggered\n"); + s->async->inttrig=NULL; + break; + case TRIG_EXT: + //configure DIO channel for acquisition trigger + s626_dio_set_irq(dev, cmd->start_arg); + + DEBUG("s626_ai_cmd: External start trigger is set!!!\n"); + + s->async->inttrig=NULL; + break; + case TRIG_INT: + s->async->inttrig=s626_ai_inttrig; + break; + } + + //enable interrupt + writel(IRQ_GPIO3 | IRQ_RPS1,devpriv->base_addr+P_IER); + + DEBUG("s626_ai_cmd: command function terminated\n"); + + return 0; +} + +static int s626_ai_cmdtest(comedi_device *dev,comedi_subdevice *s, + comedi_cmd *cmd){ + int err=0; + int tmp; + + /* cmdtest tests a particular command to see if it is valid. Using + * the cmdtest ioctl, a user can create a valid cmd and then have it + * executes by the cmd ioctl. + * + * cmdtest returns 1,2,3,4 or 0, depending on which tests the + * command passes. */ + + /* step 1: make sure trigger sources are trivially valid */ + + tmp=cmd->start_src; + cmd->start_src &= TRIG_NOW|TRIG_INT|TRIG_EXT; + if(!cmd->start_src || tmp!=cmd->start_src)err++; + + tmp=cmd->scan_begin_src; + cmd->scan_begin_src &= TRIG_TIMER|TRIG_EXT|TRIG_FOLLOW; + if(!cmd->scan_begin_src || tmp!=cmd->scan_begin_src)err++; + + tmp=cmd->convert_src; + cmd->convert_src &= TRIG_TIMER|TRIG_EXT|TRIG_NOW; + if(!cmd->convert_src || tmp!=cmd->convert_src)err++; + + tmp=cmd->scan_end_src; + cmd->scan_end_src &= TRIG_COUNT; + if(!cmd->scan_end_src || tmp!=cmd->scan_end_src)err++; + + tmp=cmd->stop_src; + cmd->stop_src &= TRIG_COUNT|TRIG_NONE; + if(!cmd->stop_src || tmp!=cmd->stop_src)err++; + + if(err)return 1; + + /* step 2: make sure trigger sources are unique and mutually + compatible */ + + /* note that mutual compatiblity is not an issue here */ + if(cmd->scan_begin_src!=TRIG_TIMER && + cmd->scan_begin_src!=TRIG_EXT && cmd->scan_begin_src!=TRIG_FOLLOW)err++; + if(cmd->convert_src!=TRIG_TIMER && + cmd->convert_src!=TRIG_EXT && cmd->convert_src!=TRIG_NOW)err++; + if(cmd->stop_src!=TRIG_COUNT && + cmd->stop_src!=TRIG_NONE)err++; + + if(err)return 2; + + /* step 3: make sure arguments are trivially compatible */ + + if(cmd->start_src!=TRIG_EXT && cmd->start_arg!=0){ + cmd->start_arg=0; + err++; + } + + if(cmd->start_src==TRIG_EXT && cmd->start_arg<0){ + cmd->start_arg=0; + err++; + } + + if(cmd->start_src==TRIG_EXT && cmd->start_arg>39){ + cmd->start_arg=39; + err++; + } + + if(cmd->scan_begin_src==TRIG_EXT && cmd->scan_begin_arg<0){ + cmd->scan_begin_arg=0; + err++; + } + + if(cmd->scan_begin_src==TRIG_EXT && cmd->scan_begin_arg>39){ + cmd->scan_begin_arg=39; + err++; + } + + if(cmd->convert_src==TRIG_EXT && cmd->convert_arg<0){ + cmd->convert_arg=0; + err++; + } + + if(cmd->convert_src==TRIG_EXT && cmd->convert_arg>39){ + cmd->convert_arg=39; + err++; + } + +#define MAX_SPEED 200000 /* in nanoseconds */ +#define MIN_SPEED 2000000000 /* in nanoseconds */ + + if(cmd->scan_begin_src==TRIG_TIMER){ + if(cmd->scan_begin_argscan_begin_arg=MAX_SPEED; + err++; + } + if(cmd->scan_begin_arg>MIN_SPEED){ + cmd->scan_begin_arg=MIN_SPEED; + err++; + } + }else{ + /* external trigger */ + /* should be level/edge, hi/lo specification here */ + /* should specify multiple external triggers */ +/* if(cmd->scan_begin_arg>9){ */ +/* cmd->scan_begin_arg=9; */ +/* err++; */ +/* } */ + } + if(cmd->convert_src==TRIG_TIMER){ + if(cmd->convert_argconvert_arg=MAX_SPEED; + err++; + } + if(cmd->convert_arg>MIN_SPEED){ + cmd->convert_arg=MIN_SPEED; + err++; + } + }else{ + /* external trigger */ + /* see above */ +/* if(cmd->convert_arg>9){ */ +/* cmd->convert_arg=9; */ +/* err++; */ +/* } */ + } + + if(cmd->scan_end_arg!=cmd->chanlist_len){ + cmd->scan_end_arg=cmd->chanlist_len; + err++; + } + if(cmd->stop_src==TRIG_COUNT){ + if(cmd->stop_arg>0x00ffffff){ + cmd->stop_arg=0x00ffffff; + err++; + } + }else{ + /* TRIG_NONE */ + if(cmd->stop_arg!=0){ + cmd->stop_arg=0; + err++; + } + } + + if(err)return 3; + + /* step 4: fix up any arguments */ + + if(cmd->scan_begin_src==TRIG_TIMER){ + tmp=cmd->scan_begin_arg; + s626_ns_to_timer((int *)&cmd->scan_begin_arg,cmd->flags&TRIG_ROUND_MASK); + if(tmp!=cmd->scan_begin_arg)err++; + } + if(cmd->convert_src==TRIG_TIMER){ + tmp=cmd->convert_arg; + s626_ns_to_timer((int *)&cmd->convert_arg,cmd->flags&TRIG_ROUND_MASK); + if(tmp!=cmd->convert_arg)err++; + if(cmd->scan_begin_src==TRIG_TIMER && + cmd->scan_begin_argconvert_arg*cmd->scan_end_arg){ + cmd->scan_begin_arg=cmd->convert_arg*cmd->scan_end_arg; + err++; + } + } + + if(err)return 4; + + return 0; +} + +static int s626_ai_cancel(comedi_device *dev,comedi_subdevice *s) +{ + // Stop RPS program in case it is currently running. + MC_DISABLE( P_MC1, MC1_ERPS1 ); + + //disable master interrupt + writel(0,devpriv->base_addr+P_IER); + + devpriv->ai_cmd_running=0; + + return 0; +} + +/* This function doesn't require a particular form, this is just what + * happens to be used in some of the drivers. It should convert ns + * nanoseconds to a counter value suitable for programming the device. + * Also, it should adjust ns so that it cooresponds to the actual time + * that the device will use. */ +static int s626_ns_to_timer(int *nanosec,int round_mode) +{ + int divider,base; + + base=500; //2MHz internal clock + + switch(round_mode){ + case TRIG_ROUND_NEAREST: + default: + divider=(*nanosec+base/2)/base; + break; + case TRIG_ROUND_DOWN: + divider=(*nanosec)/base; + break; + case TRIG_ROUND_UP: + divider=(*nanosec+base-1)/base; + break; + } + + *nanosec=base*divider; + return divider-1; +} + +static int s626_ao_winsn(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data){ + + int i; + uint16_t chan = CR_CHAN(insn->chanspec); + int16_t dacdata; + + for(i=0;in;i++){ + dacdata=(int16_t)data[i]; + devpriv->ao_readback[CR_CHAN(insn->chanspec)]=data[i]; + dacdata-= ( 0x1fff ); + + SetDAC(dev,chan,dacdata); + } + + return i; +} + +static int s626_ao_rinsn(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) +{ + int i; + + for(i=0;in;i++){ + data[i] = devpriv->ao_readback[CR_CHAN(insn->chanspec)]; + } + + return i; +} + +///////////////////////////////////////////////////////////////////// +/////////////// DIGITAL I/O FUNCTIONS ///////////////////////////// +///////////////////////////////////////////////////////////////////// +// All DIO functions address a group of DIO channels by means of +// "group" argument. group may be 0, 1 or 2, which correspond to DIO +// ports A, B and C, respectively. +///////////////////////////////////////////////////////////////////// + +static void s626_dio_init(comedi_device *dev) +{ + uint16_t group; + comedi_subdevice *s; + + // Prepare to treat writes to WRCapSel as capture disables. + DEBIwrite(dev, LP_MISC1, MISC1_NOEDCAP ); + + // For each group of sixteen channels ... + for ( group = 0; group < S626_DIO_BANKS ; group++ ) + { + s=dev->subdevices+2+group; + DEBIwrite(dev, diopriv->WRIntSel, 0 ); // Disable all interrupts. + DEBIwrite(dev, diopriv->WRCapSel, 0xFFFF ); // Disable all event + // captures. + DEBIwrite(dev, diopriv->WREdgSel, 0 ); // Init all DIOs to + // default edge + // polarity. + DEBIwrite(dev, diopriv->WRDOut, 0 ); // Program all outputs + // to inactive state. + } + DEBUG("s626_dio_init: DIO initialized \n"); +} + +/* DIO devices are slightly special. Although it is possible to + * implement the insn_read/insn_write interface, it is much more + * useful to applications if you implement the insn_bits interface. + * This allows packed reading/writing of the DIO channels. The comedi + * core can convert between insn_bits and insn_read/write */ + +static int s626_dio_insn_bits(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data){ + + /* Length of data must be 2 (mask and new data, see below) */ + if(insn->n == 0){ + return 0; + } + if(insn->n != 2){ + printk("comedi%d: s626: s626_dio_insn_bits(): Invalid instruction length\n", dev->minor); + return -EINVAL; + } + + /* + * The insn data consists of a mask in data[0] and the new data in + * data[1]. The mask defines which bits we are concerning about. + * The new data must be anded with the mask. Each channel + * corresponds to a bit. + */ + if(data[0]){ + /* Check if requested ports are configured for output */ + if((s->io_bits & data[0]) != data[0]) + return -EIO; + + s->state &= ~data[0]; + s->state |= data[0] & data[1]; + + /* Write out the new digital output lines */ + + DEBIwrite(dev,diopriv->WRDOut,s->state); + } + data[1]=DEBIread(dev,diopriv->RDDIn); + + return 2; +} + +static int s626_dio_insn_config(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) +{ + + switch(data[0]){ + case INSN_CONFIG_DIO_QUERY: + data[1] = (s->io_bits & (1 << CR_CHAN(insn->chanspec))) ? COMEDI_OUTPUT : COMEDI_INPUT; + return insn->n; + break; + case COMEDI_INPUT: + s->io_bits&= ~(1 << CR_CHAN(insn->chanspec)); + break; + case COMEDI_OUTPUT: + s->io_bits|= 1 << CR_CHAN(insn->chanspec); + break; + default: + return -EINVAL; + break; + } + DEBIwrite(dev,diopriv->WRDOut,s->io_bits); + + return 1; +} + +static int s626_dio_set_irq(comedi_device *dev, unsigned int chan) +{ + unsigned int group; + unsigned int bitmask; + unsigned int status; + + //select dio bank + group=chan/16; + bitmask=1<<(chan-(16*group)); + DEBUG("s626_dio_set_irq: enable interrupt on dio channel %d group %d\n",chan-(16*group),group); + + //set channel to capture positive edge + status=DEBIread(dev,((dio_private *)(dev->subdevices+2+group)->private)->RDEdgSel); + DEBIwrite(dev,((dio_private *)(dev->subdevices+2+group)->private)->WREdgSel,bitmask|status); + + //enable interrupt on selected channel + status=DEBIread(dev,((dio_private *)(dev->subdevices+2+group)->private)->RDIntSel); + DEBIwrite(dev,((dio_private *)(dev->subdevices+2+group)->private)->WRIntSel,bitmask|status); + + //enable edge capture write command + DEBIwrite(dev,LP_MISC1,MISC1_EDCAP); + + //enable edge capture on selected channel + status=DEBIread(dev,((dio_private *)(dev->subdevices+2+group)->private)->RDCapSel); + DEBIwrite(dev,((dio_private *)(dev->subdevices+2+group)->private)->WRCapSel,bitmask|status); + + return 0; +} + +static int s626_dio_reset_irq(comedi_device *dev, unsigned int group, unsigned int mask) +{ + DEBUG("s626_dio_reset_irq: disable interrupt on dio channel %d group %d\n",mask,group); + + //disable edge capture write command + DEBIwrite(dev,LP_MISC1,MISC1_NOEDCAP); + + //enable edge capture on selected channel + DEBIwrite(dev,((dio_private *)(dev->subdevices+2+group)->private)->WRCapSel,mask); + + return 0; +} + +static int s626_dio_clear_irq(comedi_device *dev) +{ + unsigned int group; + + //disable edge capture write command + DEBIwrite(dev,LP_MISC1,MISC1_NOEDCAP); + + for(group=0;groupsubdevices+2+group)->private)->WRCapSel,0xffff); + } + + return 0; +} + +/* Now this function initializes the value of the counter (data[0]) + and set the subdevice. To complete with trigger and interrupt + configuration */ +static int s626_enc_insn_config(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data) +{ + uint16_t Setup = ( LOADSRC_INDX << BF_LOADSRC ) | // Preload upon + // index. + ( INDXSRC_SOFT << BF_INDXSRC ) | // Disable hardware index. + ( CLKSRC_COUNTER << BF_CLKSRC ) | // Operating mode is Counter. + ( CLKPOL_POS << BF_CLKPOL ) | // Active high clock. + //( CNTDIR_UP << BF_CLKPOL ) | // Count direction is Down. + ( CLKMULT_1X << BF_CLKMULT ) | // Clock multiplier is 1x. + ( CLKENAB_INDEX << BF_CLKENAB ); + /* uint16_t DisableIntSrc=TRUE; */ + // uint32_t Preloadvalue; //Counter initial value + uint16_t valueSrclatch=LATCHSRC_AB_READ ; + uint16_t enab=CLKENAB_ALWAYS; + enc_private *k=&encpriv[CR_CHAN(insn->chanspec)]; + + DEBUG("s626_enc_insn_config: encoder config\n"); + + // (data==NULL) ? (Preloadvalue=0) : (Preloadvalue=data[0]); + + k->SetMode(dev,k,Setup,TRUE); + Preload(dev,k,*(insn->data)); + k->PulseIndex(dev,k); + SetLatchSource(dev,k,valueSrclatch); + k->SetEnable(dev,k,(uint16_t)(enab != 0)); + + return insn->n; +} + +static int s626_enc_insn_read(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data){ + + int n; + enc_private *k=&encpriv[CR_CHAN(insn->chanspec)]; + + DEBUG("s626_enc_insn_read: encoder read channel %d \n",CR_CHAN(insn->chanspec)); + + for (n=0;nn;n++) data[n]=ReadLatch(dev,k); + + DEBUG("s626_enc_insn_read: encoder sample %d\n",data[n]); + + return n; +} + +static int s626_enc_insn_write(comedi_device *dev,comedi_subdevice *s,comedi_insn *insn,lsampl_t *data){ + + enc_private *k=&encpriv[CR_CHAN(insn->chanspec)]; + + DEBUG("s626_enc_insn_write: encoder write channel %d \n",CR_CHAN(insn->chanspec)); + + // Set the preload register + Preload(dev,k,data[0]); + + // Software index pulse forces the preload register to load + // into the counter + k->SetLoadTrig(dev, k, 0); + k->PulseIndex(dev, k); + k->SetLoadTrig(dev, k, 2); + + DEBUG("s626_enc_insn_write: End encoder write\n"); + + return 1; +} + +static void s626_timer_load(comedi_device *dev, enc_private *k, int tick) +{ + uint16_t Setup = ( LOADSRC_INDX << BF_LOADSRC ) | // Preload upon + // index. + ( INDXSRC_SOFT << BF_INDXSRC ) | // Disable hardware index. + ( CLKSRC_TIMER << BF_CLKSRC ) | // Operating mode is Timer. + ( CLKPOL_POS << BF_CLKPOL ) | // Active high clock. + ( CNTDIR_DOWN << BF_CLKPOL ) | // Count direction is Down. + ( CLKMULT_1X << BF_CLKMULT ) | // Clock multiplier is 1x. + ( CLKENAB_INDEX << BF_CLKENAB ); + uint16_t valueSrclatch=LATCHSRC_A_INDXA ; + // uint16_t enab=CLKENAB_ALWAYS; + + k->SetMode(dev,k,Setup,FALSE); + + // Set the preload register + Preload(dev,k,tick); + + // Software index pulse forces the preload register to load + // into the counter + k->SetLoadTrig(dev, k, 0); + k->PulseIndex(dev, k); + + //set reload on counter overflow + k->SetLoadTrig(dev, k, 1); + + //set interrupt on overflow + k->SetIntSrc(dev,k,INTSRC_OVER); + + SetLatchSource(dev,k,valueSrclatch); + // k->SetEnable(dev,k,(uint16_t)(enab != 0)); +} + +/////////////////////////////////////////////////////////////////////// +///////////////////// DAC FUNCTIONS ///////////////////////////////// +/////////////////////////////////////////////////////////////////////// + +// Slot 0 base settings. +#define VECT0 ( XSD2 | RSD3 | SIB_A2 ) // Slot 0 always shifts in + // 0xFF and store it to + // FB_BUFFER2. + +// TrimDac LogicalChan-to-PhysicalChan mapping table. +static uint8_t trimchan[] = { 10, 9, 8, 3, 2, 7, 6, 1, 0, 5, 4 }; + +// TrimDac LogicalChan-to-EepromAdrs mapping table. +static uint8_t trimadrs[] = { 0x40, 0x41, 0x42, 0x50, 0x51, 0x52, 0x53, 0x60, 0x61, 0x62, 0x63 }; + +static void LoadTrimDACs(comedi_device *dev){ + register uint8_t i; + + // Copy TrimDac setpoint values from EEPROM to TrimDacs. + for ( i = 0; i < (sizeof(trimchan)/sizeof(trimchan[0])); i++ ) + WriteTrimDAC(dev, i, I2Cread(dev,trimadrs[i] ) ); +} + +static void WriteTrimDAC(comedi_device *dev, uint8_t LogicalChan, uint8_t DacData ){ + uint32_t chan; + + // Save the new setpoint in case the application needs to read it back later. + devpriv->TrimSetpoint[LogicalChan] = (uint8_t)DacData; + + // Map logical channel number to physical channel number. + chan = (uint32_t)trimchan[LogicalChan]; + + // Set up TSL2 records for TrimDac write operation. All slots shift + // 0xFF in from pulled-up SD3 so that the end of the slot sequence + // can be detected. + SETVECT( 2, XSD2 | XFIFO_1 | WS3 ); // Slot 2: Send high uint8_t + // to target TrimDac. + SETVECT( 3, XSD2 | XFIFO_0 | WS3 ); // Slot 3: Send low uint8_t to + // target TrimDac. + SETVECT( 4, XSD2 | XFIFO_3 | WS1 ); // Slot 4: Send NOP high + // uint8_t to DAC0 to keep + // clock running. + SETVECT( 5, XSD2 | XFIFO_2 | WS1 | EOS ); // Slot 5: Send NOP low + // uint8_t to DAC0. + + // Construct and transmit target DAC's serial packet: ( 0000 AAAA + // ),( DDDD DDDD ),( 0x00 ),( 0x00 ) where A<3:0> is the DAC + // channel's address, and D<7:0> is the DAC setpoint. Append a WORD + // value (that writes a channel 0 NOP command to a non-existent main + // DAC channel) that serves to keep the clock running after the + // packet has been sent to the target DAC. + + SendDAC(dev, ( (uint32_t)chan << 8 ) // Address the DAC channel + // within the trimdac device. + | (uint32_t)DacData ); // Include DAC setpoint data. +} + +///////////////////////////////////////////////////////////////////////// +//////////////// EEPROM ACCESS FUNCTIONS ////////////////////////////// +///////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////// +// Read uint8_t from EEPROM. + +static uint8_t I2Cread(comedi_device *dev, uint8_t addr ) +{ + uint8_t rtnval; + + // Send EEPROM target address. + if ( I2Chandshake(dev, I2C_B2( I2C_ATTRSTART, I2CW ) // Byte2 = I2C + // command: + // write to + // I2C EEPROM + // device. + | I2C_B1( I2C_ATTRSTOP, addr ) // Byte1 = EEPROM + // internal target + // address. + | I2C_B0( I2C_ATTRNOP, 0 ) ) ) // Byte0 = Not + // sent. + { + // Abort function and declare error if handshake failed. + DEBUG("I2Cread: error handshake I2Cread a\n"); + return 0; + } + + // Execute EEPROM read. + if ( I2Chandshake(dev, + I2C_B2( I2C_ATTRSTART, I2CR ) // Byte2 = I2C + // command: read + // from I2C EEPROM + // device. + | I2C_B1( I2C_ATTRSTOP, 0 ) // Byte1 receives + // uint8_t from + // EEPROM. + | I2C_B0( I2C_ATTRNOP, 0 ) ) ) // Byte0 = Not + // sent. + { + // Abort function and declare error if handshake failed. + DEBUG("I2Cread: error handshake I2Cread b\n"); + return 0; + } + + // Return copy of EEPROM value. + rtnval = (uint8_t)( RR7146(P_I2CCTRL) >> 16 ); + return rtnval; +} + +static uint32_t I2Chandshake(comedi_device *dev, uint32_t val ) +{ + // Write I2C command to I2C Transfer Control shadow register. + WR7146( P_I2CCTRL, val ); + + // Upload I2C shadow registers into working registers and wait for + // upload confirmation. + + MC_ENABLE( P_MC2, MC2_UPLD_IIC ); + while ( !MC_TEST( P_MC2, MC2_UPLD_IIC ) ); + + // Wait until I2C bus transfer is finished or an error occurs. + while ( ( RR7146(P_I2CCTRL) & ( I2C_BUSY | I2C_ERR ) ) == I2C_BUSY ); + + // Return non-zero if I2C error occured. + return RR7146(P_I2CCTRL) & I2C_ERR; + +} + +// Private helper function: Write setpoint to an application DAC channel. + +static void SetDAC(comedi_device *dev,uint16_t chan, short dacdata ) +{ + register uint16_t signmask; + register uint32_t WSImage; + + // Adjust DAC data polarity and set up Polarity Control Register + // image. + signmask = 1 << chan; + if ( dacdata < 0 ) + { + dacdata = -dacdata; + devpriv->Dacpol |= signmask; + } + else + devpriv->Dacpol &= ~signmask; + + // Limit DAC setpoint value to valid range. + if ( (uint16_t)dacdata > 0x1FFF ) + dacdata = 0x1FFF; + + // Set up TSL2 records (aka "vectors") for DAC update. Vectors V2 + // and V3 transmit the setpoint to the target DAC. V4 and V5 send + // data to a non-existent TrimDac channel just to keep the clock + // running after sending data to the target DAC. This is necessary + // to eliminate the clock glitch that would otherwise occur at the + // end of the target DAC's serial data stream. When the sequence + // restarts at V0 (after executing V5), the gate array automatically + // disables gating for the DAC clock and all DAC chip selects. + WSImage = ( chan & 2 ) ? WS1 : WS2; // Choose DAC chip select to + // be asserted. + SETVECT( 2, XSD2 | XFIFO_1 | WSImage ); // Slot 2: Transmit high + // data byte to target DAC. + SETVECT( 3, XSD2 | XFIFO_0 | WSImage ); // Slot 3: Transmit low data + // byte to target DAC. + SETVECT( 4, XSD2 | XFIFO_3 | WS3 ); // Slot 4: Transmit to + // non-existent TrimDac + // channel to keep clock + SETVECT( 5, XSD2 | XFIFO_2 | WS3 | EOS ); // Slot 5: running after + // writing target DAC's + // low data byte. + + // Construct and transmit target DAC's serial packet: ( A10D DDDD + // ),( DDDD DDDD ),( 0x0F ),( 0x00 ) where A is chan<0>, and D<12:0> + // is the DAC setpoint. Append a WORD value (that writes to a + // non-existent TrimDac channel) that serves to keep the clock + // running after the packet has been sent to the target DAC. + SendDAC( dev, 0x0F000000 //Continue clock after target DAC + //data (write to non-existent + //trimdac). + | 0x00004000 // Address the two main dual-DAC + // devices (TSL's chip select enables + // target device). + | ( (uint32_t)( chan & 1 ) << 15 ) // Address the DAC + // channel within the + // device. + | (uint32_t)dacdata ); // Include DAC setpoint data. + +} + +//////////////////////////////////////////////////////// +// Private helper function: Transmit serial data to DAC via Audio +// channel 2. Assumes: (1) TSL2 slot records initialized, and (2) +// Dacpol contains valid target image. + +static void SendDAC( comedi_device *dev, uint32_t val ) +{ + + + // START THE SERIAL CLOCK RUNNING ------------- + + // Assert DAC polarity control and enable gating of DAC serial clock + // and audio bit stream signals. At this point in time we must be + // assured of being in time slot 0. If we are not in slot 0, the + // serial clock and audio stream signals will be disabled; this is + // because the following DEBIwrite statement (which enables signals + // to be passed through the gate array) would execute before the + // trailing edge of WS1/WS3 (which turns off the signals), thus + // causing the signals to be inactive during the DAC write. + DEBIwrite(dev, LP_DACPOL, devpriv->Dacpol ); + + // TRANSFER OUTPUT DWORD VALUE INTO A2'S OUTPUT FIFO ---------------- + + // Copy DAC setpoint value to DAC's output DMA buffer. + + //WR7146( (uint32_t)devpriv->pDacWBuf, val ); + *devpriv->pDacWBuf=val; + + // enab the output DMA transfer. This will cause the DMAC to copy + // the DAC's data value to A2's output FIFO. The DMA transfer will + // then immediately terminate because the protection address is + // reached upon transfer of the first DWORD value. + MC_ENABLE( P_MC1, MC1_A2OUT ); + + // While the DMA transfer is executing ... + + // Reset Audio2 output FIFO's underflow flag (along with any other + // FIFO underflow/overflow flags). When set, this flag will + // indicate that we have emerged from slot 0. + WR7146( P_ISR, ISR_AFOU ); + + // Wait for the DMA transfer to finish so that there will be data + // available in the FIFO when time slot 1 tries to transfer a DWORD + // from the FIFO to the output buffer register. We test for DMA + // Done by polling the DMAC enable flag; this flag is automatically + // cleared when the transfer has finished. + while ( ( RR7146( P_MC1 ) & MC1_A2OUT ) != 0 ); + + // START THE OUTPUT STREAM TO THE TARGET DAC -------------------- + + // FIFO data is now available, so we enable execution of time slots + // 1 and higher by clearing the EOS flag in slot 0. Note that SD3 + // will be shifted in and stored in FB_BUFFER2 for end-of-slot-list + // detection. + SETVECT( 0, XSD2 | RSD3 | SIB_A2 ); + + // Wait for slot 1 to execute to ensure that the Packet will be + // transmitted. This is detected by polling the Audio2 output FIFO + // underflow flag, which will be set when slot 1 execution has + // finished transferring the DAC's data DWORD from the output FIFO + // to the output buffer register. + while ( ( RR7146( P_SSR ) & SSR_AF2_OUT ) == 0 ); + + // Set up to trap execution at slot 0 when the TSL sequencer cycles + // back to slot 0 after executing the EOS in slot 5. Also, + // simultaneously shift out and in the 0x00 that is ALWAYS the value + // stored in the last byte to be shifted out of the FIFO's DWORD + // buffer register. + SETVECT( 0, XSD2 | XFIFO_2 | RSD2 | SIB_A2 | EOS ); + + // WAIT FOR THE TRANSACTION TO FINISH ----------------------- + + // Wait for the TSL to finish executing all time slots before + // exiting this function. We must do this so that the next DAC + // write doesn't start, thereby enabling clock/chip select signals: + // 1. Before the TSL sequence cycles back to slot 0, which disables + // the clock/cs signal gating and traps slot // list execution. If + // we have not yet finished slot 5 then the clock/cs signals are + // still gated and we have // not finished transmitting the stream. + // 2. While slots 2-5 are executing due to a late slot 0 trap. In + // this case, the slot sequence is currently // repeating, but with + // clock/cs signals disabled. We must wait for slot 0 to trap + // execution before setting // up the next DAC setpoint DMA transfer + // and enabling the clock/cs signals. To detect the end of slot 5, + // we test for the FB_BUFFER2 MSB contents to be equal to 0xFF. If + // the TSL has not yet finished executing slot 5 ... + if ( ( RR7146( P_FB_BUFFER2 ) & 0xFF000000 ) != 0 ) + { + // The trap was set on time and we are still executing somewhere + // in slots 2-5, so we now wait for slot 0 to execute and trap + // TSL execution. This is detected when FB_BUFFER2 MSB changes + // from 0xFF to 0x00, which slot 0 causes to happen by shifting + // out/in on SD2 the 0x00 that is always referenced by slot 5. + while ( ( RR7146( P_FB_BUFFER2 ) & 0xFF000000 ) != 0 ); + } + + // Either (1) we were too late setting the slot 0 trap; the TSL + // sequencer restarted slot 0 before we could set the EOS trap flag, + // or (2) we were not late and execution is now trapped at slot 0. + // In either case, we must now change slot 0 so that it will store + // value 0xFF (instead of 0x00) to FB_BUFFER2 next time it executes. + // In order to do this, we reprogram slot 0 so that it will shift in + // SD3, which is driven only by a pull-up resistor. + SETVECT( 0, RSD3 | SIB_A2 | EOS ); + + // Wait for slot 0 to execute, at which time the TSL is setup for + // the next DAC write. This is detected when FB_BUFFER2 MSB changes + // from 0x00 to 0xFF. + while ( ( RR7146( P_FB_BUFFER2 ) & 0xFF000000 ) == 0 ); +} + +static void WriteMISC2( comedi_device *dev, uint16_t NewImage ) +{ + DEBIwrite( dev, LP_MISC1, MISC1_WENABLE ); // enab writes to + // MISC2 register. + DEBIwrite(dev, LP_WRMISC2, NewImage ); // Write new image to MISC2. + DEBIwrite(dev, LP_MISC1, MISC1_WDISABLE ); // Disable writes to MISC2. +} + +///////////////////////////////////////////////////////////////////// +// Initialize the DEBI interface for all transfers. + +static uint16_t DEBIread( comedi_device *dev, uint16_t addr ) +{ + uint16_t retval; + + // Set up DEBI control register value in shadow RAM. + WR7146( P_DEBICMD, DEBI_CMD_RDWORD | addr ); + + // Execute the DEBI transfer. + DEBItransfer( dev); + + // Fetch target register value. + retval = (uint16_t)RR7146( P_DEBIAD ); + + // Return register value. + return retval; +} + +// Execute a DEBI transfer. This must be called from within a +// critical section. +static void DEBItransfer(comedi_device *dev ) +{ + // Initiate upload of shadow RAM to DEBI control register. + MC_ENABLE( P_MC2, MC2_UPLD_DEBI ); + + // Wait for completion of upload from shadow RAM to DEBI control + // register. + while ( !MC_TEST( P_MC2, MC2_UPLD_DEBI ) ); + + // Wait until DEBI transfer is done. + while ( RR7146(P_PSR) & PSR_DEBI_S ); +} + +// Write a value to a gate array register. +static void DEBIwrite(comedi_device *dev, uint16_t addr, uint16_t wdata ) +{ + + // Set up DEBI control register value in shadow RAM. + WR7146( P_DEBICMD, DEBI_CMD_WRWORD | addr ); + WR7146( P_DEBIAD, wdata ); + + // Execute the DEBI transfer. + DEBItransfer(dev); +} + +///////////////////////////////////////////////////////////////////////////// +// Replace the specified bits in a gate array register. Imports: mask +// specifies bits that are to be preserved, wdata is new value to be +// or'd with the masked original. +static void DEBIreplace(comedi_device *dev, uint16_t addr, uint16_t mask, uint16_t wdata ) +{ + + // Copy target gate array register into P_DEBIAD register. + WR7146( P_DEBICMD, DEBI_CMD_RDWORD | addr ); // Set up DEBI control + // reg value in shadow + // RAM. + DEBItransfer( dev); // Execute the DEBI + // Read transfer. + + // Write back the modified image. + WR7146( P_DEBICMD, DEBI_CMD_WRWORD | addr ); // Set up DEBI control + // reg value in shadow + // RAM. + + WR7146( P_DEBIAD, wdata | ( (uint16_t)RR7146( P_DEBIAD ) & mask ) ); // Modify the register image. + DEBItransfer(dev ); // Execute the DEBI Write transfer. +} + +static void CloseDMAB (comedi_device *dev,DMABUF * pdma,size_t bsize ) +{ + void *vbptr, *vpptr; + + DEBUG("CloseDMAB: Entering S626DRV_CloseDMAB():\n"); + if (pdma == NULL) + return; + //find the matching allocation from the board struct + + vbptr=pdma->LogicalBase; + vpptr=pdma->PhysicalBase; + if (vbptr) + { + pci_free_consistent (devpriv->pdev, bsize, vbptr, + (int) vpptr); + pdma->LogicalBase = 0; + pdma->PhysicalBase = 0; + + DEBUG ("CloseDMAB(): Logical=0x%x, bsize=%d, Physical=0x%x\n", (uint32_t) vbptr, bsize, (uint32_t) vpptr); + } +} + +//////////////////////////////////////////////////////////////////////// +///////////////// COUNTER FUNCTIONS ////////////////////////////////// +//////////////////////////////////////////////////////////////////////// +// All counter functions address a specific counter by means of the +// "Counter" argument, which is a logical counter number. The Counter +// argument may have any of the following legal values: 0=0A, 1=1A, +// 2=2A, 3=0B, 4=1B, 5=2B. +//////////////////////////////////////////////////////////////////////// + +// Forward declarations for functions that are common to both A and B +// counters: + +///////////////////////////////////////////////////////////////////// +//////////////////// PRIVATE COUNTER FUNCTIONS ///////////////////// +///////////////////////////////////////////////////////////////////// + +///////////////////////////////////////////////////////////////// +// Read a counter's output latch. + +static uint32_t ReadLatch(comedi_device *dev, enc_private *k ) +{ + register uint32_t value; + //DEBUG FIXME DEBUG("ReadLatch: Read Latch enter\n"); + + // Latch counts and fetch LSW of latched counts value. + value = (uint32_t)DEBIread(dev,k->MyLatchLsw ); + + // Fetch MSW of latched counts and combine with LSW. + value |= ( (uint32_t) DEBIread(dev,k->MyLatchLsw + 2 ) << 16 ); + + // DEBUG FIXME DEBUG("ReadLatch: Read Latch exit\n"); + + // Return latched counts. + return value; +} + +/////////////////////////////////////////////////////////////////// +// Reset a counter's index and overflow event capture flags. + +static void ResetCapFlags_A(comedi_device *dev, enc_private *k ) +{ + DEBIreplace(dev, k->MyCRB, (uint16_t)( ~CRBMSK_INTCTRL ), CRBMSK_INTRESETCMD | CRBMSK_INTRESET_A ); +} + +static void ResetCapFlags_B(comedi_device *dev, enc_private *k ) +{ + DEBIreplace(dev, k->MyCRB, (uint16_t)( ~CRBMSK_INTCTRL ), CRBMSK_INTRESETCMD | CRBMSK_INTRESET_B ); +} + +///////////////////////////////////////////////////////////////////////// +// Return counter setup in a format (COUNTER_SETUP) that is consistent +// for both A and B counters. + +static uint16_t GetMode_A(comedi_device *dev, enc_private *k ) +{ + register uint16_t cra; + register uint16_t crb; + register uint16_t setup; + + // Fetch CRA and CRB register images. + cra = DEBIread(dev,k->MyCRA ); + crb = DEBIread(dev,k->MyCRB ); + + // Populate the standardized counter setup bit fields. Note: + // IndexSrc is restricted to ENC_X or IndxPol. + setup = ( ( cra & STDMSK_LOADSRC ) // LoadSrc = LoadSrcA. + | ( ( crb << ( STDBIT_LATCHSRC - CRBBIT_LATCHSRC ) ) & STDMSK_LATCHSRC ) // LatchSrc = LatchSrcA. + | ( ( cra << ( STDBIT_INTSRC - CRABIT_INTSRC_A ) ) & STDMSK_INTSRC ) // IntSrc = IntSrcA. + | ( ( cra << ( STDBIT_INDXSRC - (CRABIT_INDXSRC_A + 1) ) ) & STDMSK_INDXSRC ) // IndxSrc = IndxSrcA<1>. + | ( ( cra >> ( CRABIT_INDXPOL_A - STDBIT_INDXPOL ) ) & STDMSK_INDXPOL ) // IndxPol = IndxPolA. + | ( ( crb >> ( CRBBIT_CLKENAB_A - STDBIT_CLKENAB ) ) & STDMSK_CLKENAB ) ); // ClkEnab = ClkEnabA. + + // Adjust mode-dependent parameters. + if ( cra & ( 2 << CRABIT_CLKSRC_A ) ) // If Timer mode (ClkSrcA<1> == 1): + setup |= ( ( CLKSRC_TIMER << STDBIT_CLKSRC ) // Indicate Timer mode. + | ( ( cra << ( STDBIT_CLKPOL - CRABIT_CLKSRC_A ) ) & STDMSK_CLKPOL ) // Set ClkPol to indicate count direction (ClkSrcA<0>). + | ( MULT_X1 << STDBIT_CLKMULT ) ); // ClkMult must be 1x in Timer mode. + + else // If Counter mode (ClkSrcA<1> == 0): + setup |= ( ( CLKSRC_COUNTER << STDBIT_CLKSRC ) // Indicate Counter mode. + | ( ( cra >> ( CRABIT_CLKPOL_A - STDBIT_CLKPOL ) ) & STDMSK_CLKPOL ) // Pass through ClkPol. + | ( ( ( cra & CRAMSK_CLKMULT_A ) == ( MULT_X0 << CRABIT_CLKMULT_A ) ) ? // Force ClkMult to 1x if not legal, else pass through. + ( MULT_X1 << STDBIT_CLKMULT ) : + ( ( cra >> ( CRABIT_CLKMULT_A - STDBIT_CLKMULT ) ) & STDMSK_CLKMULT ) ) ); + + // Return adjusted counter setup. + return setup; +} + +static uint16_t GetMode_B(comedi_device *dev, enc_private *k ) +{ + register uint16_t cra; + register uint16_t crb; + register uint16_t setup; + + // Fetch CRA and CRB register images. + cra = DEBIread(dev,k->MyCRA ); + crb = DEBIread(dev,k->MyCRB ); + + // Populate the standardized counter setup bit fields. Note: + // IndexSrc is restricted to ENC_X or IndxPol. + setup = + ( ( ( crb << ( STDBIT_INTSRC - CRBBIT_INTSRC_B ) ) & STDMSK_INTSRC ) // IntSrc = IntSrcB. + | ( ( crb << ( STDBIT_LATCHSRC - CRBBIT_LATCHSRC ) ) & STDMSK_LATCHSRC ) // LatchSrc = LatchSrcB. + | ( ( crb << ( STDBIT_LOADSRC - CRBBIT_LOADSRC_B ) ) & STDMSK_LOADSRC ) // LoadSrc = LoadSrcB. + | ( ( crb << ( STDBIT_INDXPOL - CRBBIT_INDXPOL_B ) ) & STDMSK_INDXPOL ) // IndxPol = IndxPolB. + | ( ( crb >> ( CRBBIT_CLKENAB_B - STDBIT_CLKENAB ) ) & STDMSK_CLKENAB ) // ClkEnab = ClkEnabB. + | ( ( cra >> ( (CRABIT_INDXSRC_B + 1) - STDBIT_INDXSRC ) ) & STDMSK_INDXSRC ) ); // IndxSrc = IndxSrcB<1>. + + // Adjust mode-dependent parameters. + if ( ( crb & CRBMSK_CLKMULT_B ) == ( MULT_X0 << CRBBIT_CLKMULT_B ) ) // If Extender mode (ClkMultB == MULT_X0): + setup |= ( ( CLKSRC_EXTENDER << STDBIT_CLKSRC ) // Indicate Extender mode. + | ( MULT_X1 << STDBIT_CLKMULT ) // Indicate multiplier is 1x. + | ( ( cra >> ( CRABIT_CLKSRC_B - STDBIT_CLKPOL ) ) & STDMSK_CLKPOL ) ); // Set ClkPol equal to Timer count direction (ClkSrcB<0>). + + else if ( cra & ( 2 << CRABIT_CLKSRC_B ) ) // If Timer mode (ClkSrcB<1> == 1): + setup |= ( ( CLKSRC_TIMER << STDBIT_CLKSRC ) // Indicate Timer mode. + | ( MULT_X1 << STDBIT_CLKMULT ) // Indicate multiplier is 1x. + | ( ( cra >> ( CRABIT_CLKSRC_B - STDBIT_CLKPOL ) ) & STDMSK_CLKPOL ) ); // Set ClkPol equal to Timer count direction (ClkSrcB<0>). + + else // If Counter mode (ClkSrcB<1> == 0): + setup |= ( ( CLKSRC_COUNTER << STDBIT_CLKSRC ) // Indicate Timer mode. + | ( ( crb >> ( CRBBIT_CLKMULT_B - STDBIT_CLKMULT ) ) & STDMSK_CLKMULT ) // Clock multiplier is passed through. + | ( ( crb << ( STDBIT_CLKPOL - CRBBIT_CLKPOL_B ) ) & STDMSK_CLKPOL ) ); // Clock polarity is passed through. + + // Return adjusted counter setup. + return setup; +} + +///////////////////////////////////////////////////////////////////////////////////////////// +// Set the operating mode for the specified counter. The setup +// parameter is treated as a COUNTER_SETUP data type. The following +// parameters are programmable (all other parms are ignored): ClkMult, +// ClkPol, ClkEnab, IndexSrc, IndexPol, LoadSrc. + +static void SetMode_A(comedi_device *dev, enc_private *k, uint16_t Setup, uint16_t DisableIntSrc ) +{ + register uint16_t cra; + register uint16_t crb; + register uint16_t setup = Setup; // Cache the Standard Setup. + + // Initialize CRA and CRB images. + cra = ( ( setup & CRAMSK_LOADSRC_A ) // Preload trigger is passed through. + | ( ( setup & STDMSK_INDXSRC ) >> ( STDBIT_INDXSRC - (CRABIT_INDXSRC_A + 1) ) ) ); // IndexSrc is restricted to ENC_X or IndxPol. + + crb = ( CRBMSK_INTRESETCMD | CRBMSK_INTRESET_A // Reset any pending CounterA event captures. + | ( ( setup & STDMSK_CLKENAB ) << ( CRBBIT_CLKENAB_A - STDBIT_CLKENAB ) ) ); // Clock enable is passed through. + + // Force IntSrc to Disabled if DisableIntSrc is asserted. + if ( !DisableIntSrc ) + cra |= ( ( setup & STDMSK_INTSRC ) >> ( STDBIT_INTSRC - CRABIT_INTSRC_A ) ); + + // Populate all mode-dependent attributes of CRA & CRB images. + switch ( ( setup & STDMSK_CLKSRC ) >> STDBIT_CLKSRC ) + { + case CLKSRC_EXTENDER: // Extender Mode: Force to Timer mode + // (Extender valid only for B counters). + + case CLKSRC_TIMER: // Timer Mode: + cra |= ( ( 2 << CRABIT_CLKSRC_A ) // ClkSrcA<1> selects system clock + | ( ( setup & STDMSK_CLKPOL ) >> ( STDBIT_CLKPOL - CRABIT_CLKSRC_A ) ) // with count direction (ClkSrcA<0>) obtained from ClkPol. + | ( 1 << CRABIT_CLKPOL_A ) // ClkPolA behaves as always-on clock enable. + | ( MULT_X1 << CRABIT_CLKMULT_A ) ); // ClkMult must be 1x. + break; + + default: // Counter Mode: + cra |= ( CLKSRC_COUNTER // Select ENC_C and ENC_D as clock/direction inputs. + | ( ( setup & STDMSK_CLKPOL ) << ( CRABIT_CLKPOL_A - STDBIT_CLKPOL ) ) // Clock polarity is passed through. + | ( ( ( setup & STDMSK_CLKMULT ) == ( MULT_X0 << STDBIT_CLKMULT ) ) ? // Force multiplier to x1 if not legal, otherwise pass through. + ( MULT_X1 << CRABIT_CLKMULT_A ) : + ( ( setup & STDMSK_CLKMULT ) << ( CRABIT_CLKMULT_A - STDBIT_CLKMULT ) ) ) ); + } + + // Force positive index polarity if IndxSrc is software-driven only, + // otherwise pass it through. + if ( ~setup & STDMSK_INDXSRC ) + cra |= ( ( setup & STDMSK_INDXPOL ) << ( CRABIT_INDXPOL_A - STDBIT_INDXPOL ) ); + + // If IntSrc has been forced to Disabled, update the MISC2 interrupt + // enable mask to indicate the counter interrupt is disabled. + if ( DisableIntSrc ) + devpriv->CounterIntEnabs &= ~k->MyEventBits[3]; + + // While retaining CounterB and LatchSrc configurations, program the + // new counter operating mode. + DEBIreplace(dev, k->MyCRA, CRAMSK_INDXSRC_B | CRAMSK_CLKSRC_B, cra ); + DEBIreplace(dev, k->MyCRB, (uint16_t)( ~( CRBMSK_INTCTRL | CRBMSK_CLKENAB_A ) ), crb ); +} + +static void SetMode_B(comedi_device *dev, enc_private *k, uint16_t Setup, uint16_t DisableIntSrc ) +{ + register uint16_t cra; + register uint16_t crb; + register uint16_t setup = Setup; // Cache the Standard Setup. + + // Initialize CRA and CRB images. + cra = ( ( setup & STDMSK_INDXSRC ) << ( (CRABIT_INDXSRC_B + 1) - STDBIT_INDXSRC ) ); // IndexSrc field is restricted to ENC_X or IndxPol. + + crb = ( CRBMSK_INTRESETCMD | CRBMSK_INTRESET_B // Reset event captures and disable interrupts. + | ( ( setup & STDMSK_CLKENAB ) << ( CRBBIT_CLKENAB_B - STDBIT_CLKENAB ) ) // Clock enable is passed through. + | ( ( setup & STDMSK_LOADSRC ) >> ( STDBIT_LOADSRC - CRBBIT_LOADSRC_B ) ) ); // Preload trigger source is passed through. + + // Force IntSrc to Disabled if DisableIntSrc is asserted. + if ( !DisableIntSrc ) + crb |= ( ( setup & STDMSK_INTSRC ) >> ( STDBIT_INTSRC - CRBBIT_INTSRC_B ) ); + + // Populate all mode-dependent attributes of CRA & CRB images. + switch ( ( setup & STDMSK_CLKSRC ) >> STDBIT_CLKSRC ) + { + case CLKSRC_TIMER: // Timer Mode: + cra |= ( ( 2 << CRABIT_CLKSRC_B ) // ClkSrcB<1> selects system clock + | ( ( setup & STDMSK_CLKPOL ) << ( CRABIT_CLKSRC_B - STDBIT_CLKPOL ) ) ); // with direction (ClkSrcB<0>) obtained from ClkPol. + crb |= ( ( 1 << CRBBIT_CLKPOL_B ) // ClkPolB behaves as always-on clock enable. + | ( MULT_X1 << CRBBIT_CLKMULT_B ) ); // ClkMultB must be 1x. + break; + + case CLKSRC_EXTENDER: // Extender Mode: + cra |= ( ( 2 << CRABIT_CLKSRC_B ) // ClkSrcB source is OverflowA (same as "timer") + | ( ( setup & STDMSK_CLKPOL ) << ( CRABIT_CLKSRC_B - STDBIT_CLKPOL ) ) ); // with direction obtained from ClkPol. + crb |= ( ( 1 << CRBBIT_CLKPOL_B ) // ClkPolB controls IndexB -- always set to active. + | ( MULT_X0 << CRBBIT_CLKMULT_B ) ); // ClkMultB selects OverflowA as the clock source. + break; + + default: // Counter Mode: + cra |= ( CLKSRC_COUNTER << CRABIT_CLKSRC_B ); // Select ENC_C and ENC_D as clock/direction inputs. + crb |= ( ( ( setup & STDMSK_CLKPOL ) >> ( STDBIT_CLKPOL - CRBBIT_CLKPOL_B ) ) // ClkPol is passed through. + | ( ( ( setup & STDMSK_CLKMULT ) == ( MULT_X0 << STDBIT_CLKMULT ) ) ? // Force ClkMult to x1 if not legal, otherwise pass through. + ( MULT_X1 << CRBBIT_CLKMULT_B ) : + ( ( setup & STDMSK_CLKMULT ) << ( CRBBIT_CLKMULT_B - STDBIT_CLKMULT ) ) ) ); + } + + // Force positive index polarity if IndxSrc is software-driven only, + // otherwise pass it through. + if ( ~setup & STDMSK_INDXSRC ) + crb |= ( ( setup & STDMSK_INDXPOL ) >> ( STDBIT_INDXPOL - CRBBIT_INDXPOL_B ) ); + + // If IntSrc has been forced to Disabled, update the MISC2 interrupt + // enable mask to indicate the counter interrupt is disabled. + if ( DisableIntSrc ) + devpriv->CounterIntEnabs &= ~k->MyEventBits[3]; + + // While retaining CounterA and LatchSrc configurations, program the + // new counter operating mode. + DEBIreplace( dev, k->MyCRA, (uint16_t)( ~( CRAMSK_INDXSRC_B | CRAMSK_CLKSRC_B ) ), cra ); + DEBIreplace( dev, k->MyCRB, CRBMSK_CLKENAB_A | CRBMSK_LATCHSRC, crb ); +} + +//////////////////////////////////////////////////////////////////////// +// Return/set a counter's enable. enab: 0=always enabled, 1=enabled by index. + +static void SetEnable_A(comedi_device *dev, enc_private *k, uint16_t enab ) +{ DEBUG("SetEnable_A: SetEnable_A enter 3541\n"); + DEBIreplace( dev,k->MyCRB, (uint16_t)( ~( CRBMSK_INTCTRL | CRBMSK_CLKENAB_A ) ), (uint16_t)( enab << CRBBIT_CLKENAB_A ) ); +} + +static void SetEnable_B(comedi_device *dev, enc_private *k, uint16_t enab ) +{ + DEBIreplace( dev,k->MyCRB, (uint16_t)( ~( CRBMSK_INTCTRL | CRBMSK_CLKENAB_B ) ), (uint16_t)( enab << CRBBIT_CLKENAB_B ) ); +} + +static uint16_t GetEnable_A( comedi_device *dev,enc_private *k ) +{ + return ( DEBIread( dev, k->MyCRB) >> CRBBIT_CLKENAB_A ) & 1; +} + +static uint16_t GetEnable_B(comedi_device *dev, enc_private *k ) +{ + return ( DEBIread(dev, k->MyCRB) >> CRBBIT_CLKENAB_B ) & 1; +} + +//////////////////////////////////////////////////////////////////////// +// Return/set a counter pair's latch trigger source. 0: On read +// access, 1: A index latches A, 2: B index latches B, 3: A overflow +// latches B. + +static void SetLatchSource(comedi_device *dev, enc_private *k, uint16_t value ) +{ DEBUG("SetLatchSource: SetLatchSource enter 3550 \n"); + DEBIreplace(dev, k->MyCRB, (uint16_t)( ~( CRBMSK_INTCTRL | CRBMSK_LATCHSRC ) ), (uint16_t)( value << CRBBIT_LATCHSRC ) ); + + DEBUG("SetLatchSource: SetLatchSource exit \n"); +} + +/* static uint16_t GetLatchSource(comedi_device *dev, enc_private *k ) */ +/* { */ +/* return ( DEBIread( dev, k->MyCRB) >> CRBBIT_LATCHSRC ) & 3; */ +/* } */ + +///////////////////////////////////////////////////////////////////////// +// Return/set the event that will trigger transfer of the preload +// register into the counter. 0=ThisCntr_Index, 1=ThisCntr_Overflow, +// 2=OverflowA (B counters only), 3=disabled. + +static void SetLoadTrig_A(comedi_device *dev, enc_private *k, uint16_t Trig ) +{ + DEBIreplace(dev, k->MyCRA, (uint16_t)( ~CRAMSK_LOADSRC_A ), (uint16_t)( Trig << CRABIT_LOADSRC_A ) ); +} + +static void SetLoadTrig_B(comedi_device *dev, enc_private *k, uint16_t Trig ) +{ + DEBIreplace(dev, k->MyCRB, (uint16_t)( ~( CRBMSK_LOADSRC_B | CRBMSK_INTCTRL ) ), (uint16_t)( Trig << CRBBIT_LOADSRC_B ) ); +} + +static uint16_t GetLoadTrig_A(comedi_device *dev, enc_private *k ) +{ + return ( DEBIread( dev,k->MyCRA) >> CRABIT_LOADSRC_A ) & 3; +} + +static uint16_t GetLoadTrig_B(comedi_device *dev, enc_private *k ) +{ + return ( DEBIread(dev,k->MyCRB) >> CRBBIT_LOADSRC_B ) & 3; +} + + +//////////////////// +// Return/set counter interrupt source and clear any captured +// index/overflow events. IntSource: 0=Disabled, 1=OverflowOnly, +// 2=IndexOnly, 3=IndexAndOverflow. + +static void SetIntSrc_A(comedi_device *dev, enc_private *k, uint16_t IntSource ) +{ + // Reset any pending counter overflow or index captures. + DEBIreplace( dev, k->MyCRB, (uint16_t)( ~CRBMSK_INTCTRL ), CRBMSK_INTRESETCMD | CRBMSK_INTRESET_A ); + + // Program counter interrupt source. + DEBIreplace( dev, k->MyCRA, ~CRAMSK_INTSRC_A, (uint16_t)( IntSource << CRABIT_INTSRC_A ) ); + + // Update MISC2 interrupt enable mask. + devpriv->CounterIntEnabs = ( devpriv->CounterIntEnabs & ~k->MyEventBits[3] ) | k->MyEventBits[IntSource]; +} + +static void SetIntSrc_B( comedi_device *dev,enc_private *k, uint16_t IntSource ) +{ + uint16_t crb; + + // Cache writeable CRB register image. + crb = DEBIread(dev, k->MyCRB ) & ~CRBMSK_INTCTRL; + + // Reset any pending counter overflow or index captures. + DEBIwrite(dev, k->MyCRB, (uint16_t)( crb | CRBMSK_INTRESETCMD | CRBMSK_INTRESET_B ) ); + + // Program counter interrupt source. + DEBIwrite(dev, k->MyCRB, (uint16_t)( ( crb & ~CRBMSK_INTSRC_B ) | ( IntSource << CRBBIT_INTSRC_B ) ) ); + + // Update MISC2 interrupt enable mask. + devpriv->CounterIntEnabs = ( devpriv->CounterIntEnabs & ~k->MyEventBits[3] ) | k->MyEventBits[IntSource]; +} + + +static uint16_t GetIntSrc_A( comedi_device *dev,enc_private *k ) +{ + return ( DEBIread(dev, k->MyCRA) >> CRABIT_INTSRC_A ) & 3; +} + +static uint16_t GetIntSrc_B( comedi_device *dev,enc_private *k ) +{ + return ( DEBIread( dev, k->MyCRB) >> CRBBIT_INTSRC_B ) & 3; +} + + +///////////////////////////////////////////////////////////////////////// +// Return/set the clock multiplier. + +/* static void SetClkMult(comedi_device *dev, enc_private *k, uint16_t value ) */ +/* { */ +/* k->SetMode(dev, k, (uint16_t)( ( k->GetMode(dev, k ) & ~STDMSK_CLKMULT ) | ( value << STDBIT_CLKMULT ) ), FALSE ); */ +/* } */ + +/* static uint16_t GetClkMult(comedi_device *dev, enc_private *k ) */ +/* { */ +/* return ( k->GetMode(dev, k ) >> STDBIT_CLKMULT ) & 3; */ +/* } */ + +/* ////////////////////////////////////////////////////////////////////////// */ +/* // Return/set the clock polarity. */ + +/* static void SetClkPol( comedi_device *dev,enc_private *k, uint16_t value ) */ +/* { */ +/* k->SetMode(dev, k, (uint16_t)( ( k->GetMode(dev, k ) & ~STDMSK_CLKPOL ) | ( value << STDBIT_CLKPOL ) ), FALSE ); */ +/* } */ + +/* static uint16_t GetClkPol(comedi_device *dev, enc_private *k ) */ +/* { */ +/* return ( k->GetMode(dev, k ) >> STDBIT_CLKPOL ) & 1; */ +/* } */ + +/* /////////////////////////////////////////////////////////////////////// */ +/* // Return/set the clock source. */ + +/* static void SetClkSrc( comedi_device *dev,enc_private *k, uint16_t value ) */ +/* { */ +/* k->SetMode(dev, k, (uint16_t)( ( k->GetMode(dev, k ) & ~STDMSK_CLKSRC ) | ( value << STDBIT_CLKSRC ) ), FALSE ); */ +/* } */ + +/* static uint16_t GetClkSrc( comedi_device *dev,enc_private *k ) */ +/* { */ +/* return ( k->GetMode(dev, k ) >> STDBIT_CLKSRC ) & 3; */ +/* } */ + +/* //////////////////////////////////////////////////////////////////////// */ +/* // Return/set the index polarity. */ + +/* static void SetIndexPol(comedi_device *dev, enc_private *k, uint16_t value ) */ +/* { */ +/* k->SetMode(dev, k, (uint16_t)( ( k->GetMode(dev, k ) & ~STDMSK_INDXPOL ) | ( (value != 0) << STDBIT_INDXPOL ) ), FALSE ); */ +/* } */ + +/* static uint16_t GetIndexPol(comedi_device *dev, enc_private *k ) */ +/* { */ +/* return ( k->GetMode(dev, k ) >> STDBIT_INDXPOL ) & 1; */ +/* } */ + +/* //////////////////////////////////////////////////////////////////////// */ +/* // Return/set the index source. */ + +/* static void SetIndexSrc(comedi_device *dev, enc_private *k, uint16_t value ) */ +/* { */ +/* DEBUG("SetIndexSrc: set index src enter 3700\n"); */ +/* k->SetMode(dev, k, (uint16_t)( ( k->GetMode(dev, k ) & ~STDMSK_INDXSRC ) | ( (value != 0) << STDBIT_INDXSRC ) ), FALSE ); */ +/* } */ + +/* static uint16_t GetIndexSrc(comedi_device *dev, enc_private *k ) */ +/* { */ +/* return ( k->GetMode(dev, k ) >> STDBIT_INDXSRC ) & 1; */ +/* } */ + +/////////////////////////////////////////////////////////////////// +// Generate an index pulse. + +static void PulseIndex_A( comedi_device *dev,enc_private *k ) +{ + register uint16_t cra; + + + DEBUG("PulseIndex_A: pulse index enter\n"); + + cra = DEBIread(dev, k->MyCRA ); // Pulse index. + DEBIwrite( dev, k->MyCRA, (uint16_t)( cra ^ CRAMSK_INDXPOL_A ) ); + DEBUG("PulseIndex_A: pulse index step1\n"); + DEBIwrite( dev, k->MyCRA, cra ); +} + +static void PulseIndex_B( comedi_device *dev,enc_private *k ) +{ + register uint16_t crb; + + crb = DEBIread(dev, k->MyCRB ) & ~CRBMSK_INTCTRL; // Pulse index. + DEBIwrite(dev, k->MyCRB, (uint16_t)( crb ^ CRBMSK_INDXPOL_B ) ); + DEBIwrite(dev, k->MyCRB, crb); +} + +///////////////////////////////////////////////////////// +// Write value into counter preload register. + +static void Preload(comedi_device *dev, enc_private *k, uint32_t value ) +{ + DEBUG("Preload: preload enter\n"); + DEBIwrite(dev, (uint16_t)( k->MyLatchLsw ), (uint16_t) value ); // Write value to preload register. + DEBUG("Preload: preload step 1\n"); + DEBIwrite(dev, (uint16_t)( k->MyLatchLsw + 2 ), (uint16_t)( value >> 16 ) ); +} + +static void CountersInit(comedi_device *dev) +{ + int chan; + enc_private *k; + uint16_t Setup = ( LOADSRC_INDX << BF_LOADSRC ) | // Preload upon + // index. + ( INDXSRC_SOFT << BF_INDXSRC ) | // Disable hardware index. + ( CLKSRC_COUNTER << BF_CLKSRC ) | // Operating mode is counter. + ( CLKPOL_POS << BF_CLKPOL ) | // Active high clock. + ( CNTDIR_UP << BF_CLKPOL ) | // Count direction is up. + ( CLKMULT_1X << BF_CLKMULT ) | // Clock multiplier is 1x. + ( CLKENAB_INDEX << BF_CLKENAB ); // Enabled by index + + // Disable all counter interrupts and clear any captured counter events. + for ( chan = 0; chan < S626_ENCODER_CHANNELS; chan++ ) + { + k = &encpriv[chan]; + k->SetMode(dev,k,Setup,TRUE); + k->SetIntSrc( dev,k, 0 ); + k->ResetCapFlags(dev,k); + k->SetEnable(dev,k,CLKENAB_ALWAYS); + } + DEBUG("CountersInit: counters initialized \n"); + +} + + diff --git a/comedi/drivers/s626.h b/comedi/drivers/s626.h new file mode 100644 index 00000000..5b3bdb1c --- /dev/null +++ b/comedi/drivers/s626.h @@ -0,0 +1,814 @@ +/* + comedi/drivers/s626.h + Sensoray s626 Comedi driver, header file + + COMEDI - Linux Control and Measurement Device Interface + Copyright (C) 2000 David A. Schleef + + Based on Sensoray Model 626 Linux driver Version 0.2 + Copyright (C) 2002-2004 Sensoray Co., Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +/* + Driver: s626.o (s626.ko) + Description: Sensoray 626 driver + Devices: Sensoray s626 + Authors: Gianluca Palli , + Updated: Thu, 12 Jul 2005 + Status: experimental + + Configuration Options: + analog input: + none + + analog output: + none + + digital channel: + s626 has 3 dio subdevices (2,3 and 4) each with 16 i/o channels + supported configuration options: + INSN_CONFIG_DIO_QUERY + COMEDI_INPUT + COMEDI_OUTPUT + + encoder: + Every channel must be configured before reading. + + Example code + + insn.insn=INSN_CONFIG; //configuration instruction + insn.n=1; //number of operation (must be 1) + insn.data=&initialvalue; //initial value loaded into encoder + //during configuration + insn.subdev=5; //encoder subdevice + insn.chanspec=CR_PACK(encoder_channel,0,AREF_OTHER); //encoder_channel + //to configure + + comedi_do_insn(cf,&insn); //executing configuration +*/ + +#ifdef _DEBUG_ +#define DEBUG(...); rt_printk(__VA_ARGS__); +#else +#define DEBUG(...) +#endif + +#if !defined(TRUE) +#define TRUE (1) +#endif + +#if !defined(FALSE) +#define FALSE (0) +#endif + +#if !defined(EXTERN) +#if defined(__cplusplus) +#define EXTERN extern "C" +#else +#define EXTERN extern +#endif +#endif + +#if !defined(INLINE) +#define INLINE static __inline +#endif + +///////////////////////////////////////////////////// +#include + +#define S626_SIZE 0x0200 +#define SIZEOF_ADDRESS_SPACE 0x0200 +#define DMABUF_SIZE 4096 // 4k pages + +#define S626_ADC_CHANNELS 16 +#define S626_DAC_CHANNELS 4 +#define S626_ENCODER_CHANNELS 6 +#define S626_DIO_CHANNELS 48 +#define S626_DIO_BANKS 3 // Number of DIO groups. +#define S626_DIO_EXTCHANS 40 // Number of + // extended-capability + // DIO channels. + +#define NUM_TRIMDACS 12 // Number of valid TrimDAC channels. + + +// PCI bus interface types. +#define INTEL 1 // Intel bus type. +#define MOTOROLA 2 // Motorola bus type. + +////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////// +#define PLATFORM INTEL // *** SELECT PLATFORM TYPE *** +////////////////////////////////////////////////////////// + +#define RANGE_5V 0x10 // +/-5V range +#define RANGE_10V 0x00 // +/-10V range + + +#define EOPL 0x80 // End of ADC poll list marker. +#define GSEL_BIPOLAR5V 0x00F0 // LP_GSEL setting for 5V bipolar range. +#define GSEL_BIPOLAR10V 0x00A0 // LP_GSEL setting for 10V bipolar range. + +// Error codes that must be visible to this base class. +#define ERR_ILLEGAL_PARM 0x00010000 // Illegal function parameter value was specified. +#define ERR_I2C 0x00020000 // I2C error. +#define ERR_COUNTERSETUP 0x00200000 // Illegal setup specified for counter channel. +#define ERR_DEBI_TIMEOUT 0x00400000 // DEBI transfer timed out. + + +// Organization (physical order) and size (in DWORDs) of logical DMA buffers contained by ANA_DMABUF. +#define ADC_DMABUF_DWORDS 40 // ADC DMA buffer must hold 16 samples, plus pre/post garbage samples. +#define DAC_WDMABUF_DWORDS 1 // DAC output DMA buffer holds a single sample. + +// All remaining space in 4KB DMA buffer is available for the RPS1 program. + +// Address offsets, in DWORDS, from base of DMA buffer. +#define DAC_WDMABUF_OS ADC_DMABUF_DWORDS + +// Interrupt enab bit in ISR and IER. +#define IRQ_GPIO3 0x00000040 // IRQ enable for GPIO3. +#define IRQ_RPS1 0x10000000 +#define ISR_AFOU 0x00000800 // Audio fifo + // under/overflow + // detected. +#define IRQ_COINT1A 0x0400 // conter 1A overflow + // interrupt mask +#define IRQ_COINT1B 0x0800 // conter 1B overflow + // interrupt mask +#define IRQ_COINT2A 0x1000 // conter 2A overflow + // interrupt mask +#define IRQ_COINT2B 0x2000 // conter 2B overflow + // interrupt mask +#define IRQ_COINT3A 0x4000 // conter 3A overflow + // interrupt mask +#define IRQ_COINT3B 0x8000 // conter 3B overflow + // interrupt mask + + +// RPS command codes. +#define RPS_CLRSIGNAL 0x00000000 // CLEAR SIGNAL +#define RPS_SETSIGNAL 0x10000000 // SET SIGNAL +#define RPS_NOP 0x00000000 // NOP +#define RPS_PAUSE 0x20000000 // PAUSE +#define RPS_UPLOAD 0x40000000 // UPLOAD +#define RPS_JUMP 0x80000000 // JUMP +#define RPS_LDREG 0x90000100 // LDREG (1 uint32_t only) +#define RPS_STREG 0xA0000100 // STREG (1 uint32_t only) +#define RPS_STOP 0x50000000 // STOP +#define RPS_IRQ 0x60000000 // IRQ + +#define RPS_LOGICAL_OR 0x08000000 // Logical OR conditionals. +#define RPS_INVERT 0x04000000 // Test for negated semaphores. +#define RPS_DEBI 0x00000002 // DEBI done + +#define RPS_SIG0 0x00200000 // RPS semaphore 0 (used by ADC). +#define RPS_SIG1 0x00400000 // RPS semaphore 1 (used by DAC). +#define RPS_SIG2 0x00800000 // RPS semaphore 2 (not used). +#define RPS_GPIO2 0x00080000 // RPS GPIO2 +#define RPS_GPIO3 0x00100000 // RPS GPIO3 + +#define RPS_SIGADC RPS_SIG0 // Trigger/status for ADC's RPS program. +#define RPS_SIGDAC RPS_SIG1 // Trigger/status for DAC's RPS program. + +// RPS clock parameters. +#define RPSCLK_SCALAR 8 // This is apparent ratio of PCI/RPS clks (undocumented!!). +#define RPSCLK_PER_US ( 33 / RPSCLK_SCALAR ) // Number of RPS clocks in one microsecond. + +// Event counter source addresses. +#define SBA_RPS_A0 0x27 // Time of RPS0 busy, in PCI clocks. + +// GPIO constants. +#define GPIO_BASE 0x10004000 // GPIO 0,2,3 = inputs, GPIO3 = IRQ; GPIO1 = out. +#define GPIO1_LO 0x00000000 // GPIO1 set to LOW. +#define GPIO1_HI 0x00001000 // GPIO1 set to HIGH. + +// Primary Status Register (PSR) constants. +#define PSR_DEBI_E 0x00040000 // DEBI event flag. +#define PSR_DEBI_S 0x00080000 // DEBI status flag. +#define PSR_A2_IN 0x00008000 // Audio output DMA2 protection address reached. +#define PSR_AFOU 0x00000800 // Audio FIFO under/overflow detected. +#define PSR_GPIO2 0x00000020 // GPIO2 input pin: 0=AdcBusy, 1=AdcIdle. +#define PSR_EC0S 0x00000001 // Event counter 0 threshold reached. + +// Secondary Status Register (SSR) constants. +#define SSR_AF2_OUT 0x00000200 // Audio 2 output FIFO under/overflow detected. + +// Master Control Register 1 (MC1) constants. +#define MC1_SOFT_RESET 0x80000000 // Invoke 7146 soft reset. +#define MC1_SHUTDOWN 0x3FFF0000 // Shut down all MC1-controlled enables. + +#define MC1_ERPS1 0x2000 // enab/disable RPS task 1. +#define MC1_ERPS0 0x1000 // enab/disable RPS task 0. +#define MC1_DEBI 0x0800 // enab/disable DEBI pins. +#define MC1_AUDIO 0x0200 // enab/disable audio port pins. +#define MC1_I2C 0x0100 // enab/disable I2C interface. +#define MC1_A2OUT 0x0008 // enab/disable transfer on A2 out. +#define MC1_A2IN 0x0004 // enab/disable transfer on A2 in. +#define MC1_A1IN 0x0001 // enab/disable transfer on A1 in. + +// Master Control Register 2 (MC2) constants. +#define MC2_UPLD_DEBIq 0x00020002 // Upload DEBI registers. +#define MC2_UPLD_IICq 0x00010001 // Upload I2C registers. +#define MC2_RPSSIG2_ONq 0x20002000 // Assert RPS_SIG2. +#define MC2_RPSSIG1_ONq 0x10001000 // Assert RPS_SIG1. +#define MC2_RPSSIG0_ONq 0x08000800 // Assert RPS_SIG0. +#define MC2_UPLD_DEBI_MASKq 0x00000002 // Upload DEBI mask. +#define MC2_UPLD_IIC_MASKq 0x00000001 // Upload I2C mask. +#define MC2_RPSSIG2_MASKq 0x00002000 // RPS_SIG2 bit mask. +#define MC2_RPSSIG1_MASKq 0x00001000 // RPS_SIG1 bit mask. +#define MC2_RPSSIG0_MASKq 0x00000800 // RPS_SIG0 bit mask. + +#define MC2_DELAYTRIG_4USq MC2_RPSSIG1_ON +#define MC2_DELAYBUSY_4USq MC2_RPSSIG1_MASK + +#define MC2_DELAYTRIG_6USq MC2_RPSSIG2_ON +#define MC2_DELAYBUSY_6USq MC2_RPSSIG2_MASK + + +#define MC2_UPLD_DEBI 0x0002 // Upload DEBI. +#define MC2_UPLD_IIC 0x0001 // Upload I2C. +#define MC2_RPSSIG2 0x2000 // RPS signal 2 (not used). +#define MC2_RPSSIG1 0x1000 // RPS signal 1 (DAC RPS busy). +#define MC2_RPSSIG0 0x0800 // RPS signal 0 (ADC RPS busy). + +#define MC2_ADC_RPS MC2_RPSSIG0 // ADC RPS busy. +#define MC2_DAC_RPS MC2_RPSSIG1 // DAC RPS busy. + +///////////////////oldies/////////// +#define MC2_UPLD_DEBIQ 0x00020002 // Upload DEBI registers. +#define MC2_UPLD_IICQ 0x00010001 // Upload I2C registers. +//////////////////////////////////////// + + +// PCI BUS (SAA7146) REGISTER ADDRESS OFFSETS //////////////////////// +#define P_PCI_BT_A 0x004C // Audio DMA + // burst/threshold + // control. +#define P_DEBICFG 0x007C // DEBI configuration. +#define P_DEBICMD 0x0080 // DEBI command. +#define P_DEBIPAGE 0x0084 // DEBI page. +#define P_DEBIAD 0x0088 // DEBI target address. +#define P_I2CCTRL 0x008C // I2C control. +#define P_I2CSTAT 0x0090 // I2C status. +#define P_BASEA2_IN 0x00AC // Audio input 2 base + // physical DMAbuf + // address. +#define P_PROTA2_IN 0x00B0 // Audio input 2 + // physical DMAbuf + // protection address. +#define P_PAGEA2_IN 0x00B4 // Audio input 2 + // paging attributes. +#define P_BASEA2_OUT 0x00B8 // Audio output 2 base + // physical DMAbuf + // address. +#define P_PROTA2_OUT 0x00BC // Audio output 2 + // physical DMAbuf + // protection address. +#define P_PAGEA2_OUT 0x00C0 // Audio output 2 + // paging attributes. +#define P_RPSPAGE0 0x00C4 // RPS0 page. +#define P_RPSPAGE1 0x00C8 // RPS1 page. +#define P_RPS0_TOUT 0x00D4 // RPS0 time-out. +#define P_RPS1_TOUT 0x00D8 // RPS1 time-out. +#define P_IER 0x00DC // Interrupt enable. +#define P_GPIO 0x00E0 // General-purpose I/O. +#define P_EC1SSR 0x00E4 // Event counter set 1 + // source select. +#define P_ECT1R 0x00EC // Event counter + // threshold set 1. +#define P_ACON1 0x00F4 // Audio control 1. +#define P_ACON2 0x00F8 // Audio control 2. +#define P_MC1 0x00FC // Master control 1. +#define P_MC2 0x0100 // Master control 2. +#define P_RPSADDR0 0x0104 // RPS0 instruction pointer. +#define P_RPSADDR1 0x0108 // RPS1 instruction pointer. +#define P_ISR 0x010C // Interrupt status. +#define P_PSR 0x0110 // Primary status. +#define P_SSR 0x0114 // Secondary status. +#define P_EC1R 0x0118 // Event counter set 1. +#define P_ADP4 0x0138 // Logical audio DMA + // pointer of audio + // input FIFO A2_IN. +#define P_FB_BUFFER1 0x0144 // Audio feedback buffer 1. +#define P_FB_BUFFER2 0x0148 // Audio feedback buffer 2. +#define P_TSL1 0x0180 // Audio time slot list 1. +#define P_TSL2 0x01C0 // Audio time slot list 2. + +// LOCAL BUS (GATE ARRAY) REGISTER ADDRESS OFFSETS ///////////////// +// Analog I/O registers: +#define LP_DACPOL 0x0082 // Write DAC polarity. +#define LP_GSEL 0x0084 // Write ADC gain. +#define LP_ISEL 0x0086 // Write ADC channel select. +// Digital I/O (write only): +#define LP_WRINTSELA 0x0042 // Write A interrupt enable. +#define LP_WREDGSELA 0x0044 // Write A edge selection. +#define LP_WRCAPSELA 0x0046 // Write A capture enable. +#define LP_WRDOUTA 0x0048 // Write A digital output. +#define LP_WRINTSELB 0x0052 // Write B interrupt enable. +#define LP_WREDGSELB 0x0054 // Write B edge selection. +#define LP_WRCAPSELB 0x0056 // Write B capture enable. +#define LP_WRDOUTB 0x0058 // Write B digital output. +#define LP_WRINTSELC 0x0062 // Write C interrupt enable. +#define LP_WREDGSELC 0x0064 // Write C edge selection. +#define LP_WRCAPSELC 0x0066 // Write C capture enable. +#define LP_WRDOUTC 0x0068 // Write C digital output. + +// Digital I/O (read only): +#define LP_RDDINA 0x0040 // Read digital input. +#define LP_RDCAPFLGA 0x0048 // Read edges captured. +#define LP_RDINTSELA 0x004A // Read interrupt + // enable register. +#define LP_RDEDGSELA 0x004C // Read edge + // selection + // register. +#define LP_RDCAPSELA 0x004E // Read capture + // enable register. +#define LP_RDDINB 0x0050 // Read digital input. +#define LP_RDCAPFLGB 0x0058 // Read edges captured. +#define LP_RDINTSELB 0x005A // Read interrupt + // enable register. +#define LP_RDEDGSELB 0x005C // Read edge + // selection + // register. +#define LP_RDCAPSELB 0x005E // Read capture + // enable register. +#define LP_RDDINC 0x0060 // Read digital input. +#define LP_RDCAPFLGC 0x0068 // Read edges captured. +#define LP_RDINTSELC 0x006A // Read interrupt + // enable register. +#define LP_RDEDGSELC 0x006C // Read edge + // selection + // register. +#define LP_RDCAPSELC 0x006E // Read capture + // enable register. +// Counter Registers (read/write): +#define LP_CR0A 0x0000 // 0A setup register. +#define LP_CR0B 0x0002 // 0B setup register. +#define LP_CR1A 0x0004 // 1A setup register. +#define LP_CR1B 0x0006 // 1B setup register. +#define LP_CR2A 0x0008 // 2A setup register. +#define LP_CR2B 0x000A // 2B setup register. +// Counter PreLoad (write) and Latch (read) Registers: +#define LP_CNTR0ALSW 0x000C // 0A lsw. +#define LP_CNTR0AMSW 0x000E // 0A msw. +#define LP_CNTR0BLSW 0x0010 // 0B lsw. +#define LP_CNTR0BMSW 0x0012 // 0B msw. +#define LP_CNTR1ALSW 0x0014 // 1A lsw. +#define LP_CNTR1AMSW 0x0016 // 1A msw. +#define LP_CNTR1BLSW 0x0018 // 1B lsw. +#define LP_CNTR1BMSW 0x001A // 1B msw. +#define LP_CNTR2ALSW 0x001C // 2A lsw. +#define LP_CNTR2AMSW 0x001E // 2A msw. +#define LP_CNTR2BLSW 0x0020 // 2B lsw. +#define LP_CNTR2BMSW 0x0022 // 2B msw. +// Miscellaneous Registers (read/write): +#define LP_MISC1 0x0088 // Read/write Misc1. +#define LP_WRMISC2 0x0090 // Write Misc2. +#define LP_RDMISC2 0x0082 // Read Misc2. + +// Bit masks for MISC1 register that are the same for reads and writes. +#define MISC1_WENABLE 0x8000 // enab writes to + // MISC2 (except Clear + // Watchdog bit). +#define MISC1_WDISABLE 0x0000 // Disable writes to MISC2. +#define MISC1_EDCAP 0x1000 // enab edge capture + // on DIO chans + // specified by + // LP_WRCAPSELx. +#define MISC1_NOEDCAP 0x0000 // Disable edge + // capture on + // specified DIO + // chans. + +// Bit masks for MISC1 register reads. +#define RDMISC1_WDTIMEOUT 0x4000 // Watchdog timer timed out. + +// Bit masks for MISC2 register writes. +#define WRMISC2_WDCLEAR 0x8000 // Reset watchdog + // timer to zero. +#define WRMISC2_CHARGE_ENABLE 0x4000 // enab battery + // trickle charging. + +// Bit masks for MISC2 register that are the same for reads and writes. +#define MISC2_BATT_ENABLE 0x0008 // Backup battery enable. +#define MISC2_WDENABLE 0x0004 // Watchdog timer enable. +#define MISC2_WDPERIOD_MASK 0x0003 // Watchdog interval + // select mask. + +// Bit masks for ACON1 register. +#define A2_RUN 0x40000000 // Run A2 based on TSL2. +#define A1_RUN 0x20000000 // Run A1 based on TSL1. +#define A1_SWAP 0x00200000 // Use big-endian for A1. +#define A2_SWAP 0x00100000 // Use big-endian for A2. +#define WS_MODES 0x00019999 // WS0 = TSL1 trigger + // input, WS1-WS4 = + // CS* outputs. + +#if PLATFORM == INTEL // Base ACON1 config: + // always run A1 based + // on TSL1. +#define ACON1_BASE ( WS_MODES | A1_RUN ) +#elif PLATFORM == MOTOROLA +#define ACON1_BASE ( WS_MODES | A1_RUN | A1_SWAP | A2_SWAP ) +#endif + +#define ACON1_ADCSTART ACON1_BASE // Start ADC: run A1 + // based on TSL1. +#define ACON1_DACSTART ( ACON1_BASE | A2_RUN ) // Start + // transmit to + // DAC: run A2 + // based on + // TSL2. +#define ACON1_DACSTOP ACON1_BASE // Halt A2. + +// Bit masks for ACON2 register. +#define A1_CLKSRC_BCLK1 0x00000000 // A1 bit rate = BCLK1 (ADC). +#define A2_CLKSRC_X1 0x00800000 // A2 bit rate = ACLK/1 (DACs). +#define A2_CLKSRC_X2 0x00C00000 // A2 bit rate = ACLK/2 (DACs). +#define A2_CLKSRC_X4 0x01400000 // A2 bit rate = ACLK/4 (DACs). +#define INVERT_BCLK2 0x00100000 // Invert BCLK2 (DACs). +#define BCLK2_OE 0x00040000 // enab BCLK2 (DACs). +#define ACON2_XORMASK 0x000C0000 // XOR mask for ACON2 + // active-low bits. + +#define ACON2_INIT ( ACON2_XORMASK ^ ( A1_CLKSRC_BCLK1 | A2_CLKSRC_X2 | INVERT_BCLK2 | BCLK2_OE ) ) + +// Bit masks for timeslot records. +#define WS1 0x40000000 // WS output to assert. +#define WS2 0x20000000 +#define WS3 0x10000000 +#define WS4 0x08000000 +#define RSD1 0x01000000 // Shift A1 data in on SD1. +#define SDW_A1 0x00800000 // Store rcv'd char at + // next char slot of + // DWORD1 buffer. +#define SIB_A1 0x00400000 // Store rcv'd char at + // next char slot of + // FB1 buffer. +#define SF_A1 0x00200000 // Write unsigned long + // buffer to input + // FIFO. + +//Select parallel-to-serial converter's data source: +#define XFIFO_0 0x00000000 // Data fifo byte 0. +#define XFIFO_1 0x00000010 // Data fifo byte 1. +#define XFIFO_2 0x00000020 // Data fifo byte 2. +#define XFIFO_3 0x00000030 // Data fifo byte 3. +#define XFB0 0x00000040 // FB_BUFFER byte 0. +#define XFB1 0x00000050 // FB_BUFFER byte 1. +#define XFB2 0x00000060 // FB_BUFFER byte 2. +#define XFB3 0x00000070 // FB_BUFFER byte 3. +#define SIB_A2 0x00000200 // Store next dword + // from A2's input + // shifter to FB2 + // buffer. +#define SF_A2 0x00000100 // Store next dword + // from A2's input + // shifter to its + // input fifo. +#define LF_A2 0x00000080 // Load next dword + // from A2's output + // fifo into its + // output dword + // buffer. +#define XSD2 0x00000008 // Shift data out on SD2. +#define RSD3 0x00001800 // Shift data in on SD3. +#define RSD2 0x00001000 // Shift data in on SD2. +#define LOW_A2 0x00000002 // Drive last SD low + // for 7 clks, then + // tri-state. +#define EOS 0x00000001 // End of superframe. + + +////////////////////// + +// I2C configuration constants. +#define I2C_CLKSEL 0x0400 // I2C bit rate = + // PCIclk/480 = 68.75 + // KHz. +#define I2C_BITRATE 68.75 // I2C bus data bit + // rate (determined by + // I2C_CLKSEL) in KHz. +#define I2C_WRTIME 15.0 // Worst case time,in + // msec, for EEPROM + // internal write op. + +// I2C manifest constants. + +// Max retries to wait for EEPROM write. +#define I2C_RETRIES ( I2C_WRTIME * I2C_BITRATE / 9.0 ) +#define I2C_ERR 0x0002 // I2C control/status + // flag ERROR. +#define I2C_BUSY 0x0001 // I2C control/status + // flag BUSY. +#define I2C_ABORT 0x0080 // I2C status flag ABORT. +#define I2C_ATTRSTART 0x3 // I2C attribute START. +#define I2C_ATTRCONT 0x2 // I2C attribute CONT. +#define I2C_ATTRSTOP 0x1 // I2C attribute STOP. +#define I2C_ATTRNOP 0x0 // I2C attribute NOP. + +// I2C read command | EEPROM address. +#define I2CR ( devpriv->I2CAdrs | 1 ) + +// I2C write command | EEPROM address. +#define I2CW ( devpriv->I2CAdrs ) + +// Code macros used for constructing I2C command bytes. +#define I2C_B2(ATTR,VAL) ( ( (ATTR) << 6 ) | ( (VAL) << 24 ) ) +#define I2C_B1(ATTR,VAL) ( ( (ATTR) << 4 ) | ( (VAL) << 16 ) ) +#define I2C_B0(ATTR,VAL) ( ( (ATTR) << 2 ) | ( (VAL) << 8 ) ) + + +//////////////////////////////////////////////////////// +//oldest +#define P_DEBICFGq 0x007C // DEBI configuration. +#define P_DEBICMDq 0x0080 // DEBI command. +#define P_DEBIPAGEq 0x0084 // DEBI page. +#define P_DEBIADq 0x0088 // DEBI target address. + +#define DEBI_CFG_TOQ 0x03C00000 // timeout (15 PCI cycles) +#define DEBI_CFG_FASTQ 0x10000000 // fast mode enable +#define DEBI_CFG_16Q 0x00080000 // 16-bit access enable +#define DEBI_CFG_INCQ 0x00040000 // enable address increment +#define DEBI_CFG_TIMEROFFQ 0x00010000 // disable timer +#define DEBI_CMD_RDQ 0x00050000 // read immediate 2 bytes +#define DEBI_CMD_WRQ 0x00040000 // write immediate 2 bytes +#define DEBI_PAGE_DISABLEQ 0x00000000 // paging disable + +/////////////////////////////////////////// +// DEBI command constants. +#define DEBI_CMD_SIZE16 ( 2 << 17 ) // Transfer size is + // always 2 bytes. +#define DEBI_CMD_READ 0x00010000 // Read operation. +#define DEBI_CMD_WRITE 0x00000000 // Write operation. + +// Read immediate 2 bytes. +#define DEBI_CMD_RDWORD ( DEBI_CMD_READ | DEBI_CMD_SIZE16 ) + +// Write immediate 2 bytes. +#define DEBI_CMD_WRWORD ( DEBI_CMD_WRITE | DEBI_CMD_SIZE16 ) + +// DEBI configuration constants. +#define DEBI_CFG_XIRQ_EN 0x80000000 // enab external + // interrupt on GPIO3. +#define DEBI_CFG_XRESUME 0x40000000 // Resume block + // transfer when XIRQ + // deasserted. +#define DEBI_CFG_FAST 0x10000000 // Fast mode enable. + +// 4-bit field that specifies DEBI timeout value in PCI clock cycles: +#define DEBI_CFG_TOUT_BIT 22 // Finish DEBI cycle after + // this many clocks. + +// 2-bit field that specifies Endian byte lane steering: +#define DEBI_CFG_SWAP_NONE 0x00000000 // Straight - don't + // swap any bytes + // (Intel). +#define DEBI_CFG_SWAP_2 0x00100000 // 2-byte swap (Motorola). +#define DEBI_CFG_SWAP_4 0x00200000 // 4-byte swap. +#define DEBI_CFG_16 0x00080000 // Slave is able to + // serve 16-bit + // cycles. + +#define DEBI_CFG_SLAVE16 0x00080000 // Slave is able to + // serve 16-bit + // cycles. +#define DEBI_CFG_INC 0x00040000 // enab address + // increment for block + // transfers. +#define DEBI_CFG_INTEL 0x00020000 // Intel style local bus. +#define DEBI_CFG_TIMEROFF 0x00010000 // Disable timer. + +#if PLATFORM == INTEL + +#define DEBI_TOUT 7 // Wait 7 PCI clocks + // (212 ns) before + // polling RDY. + +// Intel byte lane steering (pass through all byte lanes). +#define DEBI_SWAP DEBI_CFG_SWAP_NONE + +#elif PLATFORM == MOTOROLA + +#define DEBI_TOUT 15 // Wait 15 PCI clocks (454 ns) + // maximum before timing out. +#define DEBI_SWAP DEBI_CFG_SWAP_2 // Motorola byte lane steering. + +#endif + +// DEBI page table constants. +#define DEBI_PAGE_DISABLE 0x00000000 // Paging disable. + +///////////////////EXTRA FROM OTHER SANSORAY * .h//////// + +// LoadSrc values: +#define LOADSRC_INDX 0 // Preload core in response to + // Index. +#define LOADSRC_OVER 1 // Preload core in response to + // Overflow. +#define LOADSRCB_OVERA 2 // Preload B core in response + // to A Overflow. +#define LOADSRC_NONE 3 // Never preload core. + + +// IntSrc values: +#define INTSRC_NONE 0 // Interrupts disabled. +#define INTSRC_OVER 1 // Interrupt on Overflow. +#define INTSRC_INDX 2 // Interrupt on Index. +#define INTSRC_BOTH 3 // Interrupt on Index or Overflow. + +// LatchSrc values: +#define LATCHSRC_AB_READ 0 // Latch on read. +#define LATCHSRC_A_INDXA 1 // Latch A on A Index. +#define LATCHSRC_B_INDXB 2 // Latch B on B Index. +#define LATCHSRC_B_OVERA 3 // Latch B on A Overflow. + +// IndxSrc values: +#define INDXSRC_HARD 0 // Hardware or software index. +#define INDXSRC_SOFT 1 // Software index only. + +// IndxPol values: +#define INDXPOL_POS 0 // Index input is active high. +#define INDXPOL_NEG 1 // Index input is active low. + +// ClkSrc values: +#define CLKSRC_COUNTER 0 // Counter mode. +#define CLKSRC_TIMER 2 // Timer mode. +#define CLKSRC_EXTENDER 3 // Extender mode. + +// ClkPol values: +#define CLKPOL_POS 0 // Counter/Extender clock is + // active high. +#define CLKPOL_NEG 1 // Counter/Extender clock is + // active low. +#define CNTDIR_UP 0 // Timer counts up. +#define CNTDIR_DOWN 1 // Timer counts down. + +// ClkEnab values: +#define CLKENAB_ALWAYS 0 // Clock always enabled. +#define CLKENAB_INDEX 1 // Clock is enabled by index. + +// ClkMult values: +#define CLKMULT_4X 0 // 4x clock multiplier. +#define CLKMULT_2X 1 // 2x clock multiplier. +#define CLKMULT_1X 2 // 1x clock multiplier. + +// Bit Field positions in COUNTER_SETUP structure: +#define BF_LOADSRC 9 // Preload trigger. +#define BF_INDXSRC 7 // Index source. +#define BF_INDXPOL 6 // Index polarity. +#define BF_CLKSRC 4 // Clock source. +#define BF_CLKPOL 3 // Clock polarity/count direction. +#define BF_CLKMULT 1 // Clock multiplier. +#define BF_CLKENAB 0 // Clock enable. + +// Enumerated counter operating modes specified by ClkSrc bit field in +// a COUNTER_SETUP. + +#define CLKSRC_COUNTER 0 // Counter: ENC_C clock, ENC_D + // direction. +#define CLKSRC_TIMER 2 // Timer: SYS_C clock, + // direction specified by + // ClkPol. +#define CLKSRC_EXTENDER 3 // Extender: OVR_A clock, + // ENC_D direction. + +// Enumerated counter clock multipliers. + +#define MULT_X0 0x0003 // Supports no multipliers; + // fixed physical multiplier = + // 3. +#define MULT_X1 0x0002 // Supports multiplier x1; + // fixed physical multiplier = + // 2. +#define MULT_X2 0x0001 // Supports multipliers x1, + // x2; physical multipliers = + // 1 or 2. +#define MULT_X4 0x0000 // Supports multipliers x1, + // x2, x4; physical + // multipliers = 0, 1 or 2. + +// Sanity-check limits for parameters. + +#define NUM_COUNTERS 6 // Maximum valid counter + // logical channel number. +#define NUM_INTSOURCES 4 +#define NUM_LATCHSOURCES 4 +#define NUM_CLKMULTS 4 +#define NUM_CLKSOURCES 4 +#define NUM_CLKPOLS 2 +#define NUM_INDEXPOLS 2 +#define NUM_INDEXSOURCES 2 +#define NUM_LOADTRIGS 4 + +// Bit field positions in CRA and CRB counter control registers. + +// Bit field positions in CRA: +#define CRABIT_INDXSRC_B 14 // B index source. +#define CRABIT_CLKSRC_B 12 // B clock source. +#define CRABIT_INDXPOL_A 11 // A index polarity. +#define CRABIT_LOADSRC_A 9 // A preload trigger. +#define CRABIT_CLKMULT_A 7 // A clock multiplier. +#define CRABIT_INTSRC_A 5 // A interrupt source. +#define CRABIT_CLKPOL_A 4 // A clock polarity. +#define CRABIT_INDXSRC_A 2 // A index source. +#define CRABIT_CLKSRC_A 0 // A clock source. + +// Bit field positions in CRB: +#define CRBBIT_INTRESETCMD 15 // Interrupt reset command. +#define CRBBIT_INTRESET_B 14 // B interrupt reset enable. +#define CRBBIT_INTRESET_A 13 // A interrupt reset enable. +#define CRBBIT_CLKENAB_A 12 // A clock enable. +#define CRBBIT_INTSRC_B 10 // B interrupt source. +#define CRBBIT_LATCHSRC 8 // A/B latch source. +#define CRBBIT_LOADSRC_B 6 // B preload trigger. +#define CRBBIT_CLKMULT_B 3 // B clock multiplier. +#define CRBBIT_CLKENAB_B 2 // B clock enable. +#define CRBBIT_INDXPOL_B 1 // B index polarity. +#define CRBBIT_CLKPOL_B 0 // B clock polarity. + +// Bit field masks for CRA and CRB. + +#define CRAMSK_INDXSRC_B ( (uint16_t)( 3 << CRABIT_INDXSRC_B) ) +#define CRAMSK_CLKSRC_B ( (uint16_t)( 3 << CRABIT_CLKSRC_B) ) +#define CRAMSK_INDXPOL_A ( (uint16_t)( 1 << CRABIT_INDXPOL_A) ) +#define CRAMSK_LOADSRC_A ( (uint16_t)( 3 << CRABIT_LOADSRC_A) ) +#define CRAMSK_CLKMULT_A ( (uint16_t)( 3 << CRABIT_CLKMULT_A) ) +#define CRAMSK_INTSRC_A ( (uint16_t)( 3 << CRABIT_INTSRC_A) ) +#define CRAMSK_CLKPOL_A ( (uint16_t)( 3 << CRABIT_CLKPOL_A) ) +#define CRAMSK_INDXSRC_A ( (uint16_t)( 3 << CRABIT_INDXSRC_A) ) +#define CRAMSK_CLKSRC_A ( (uint16_t)( 3 << CRABIT_CLKSRC_A) ) + +#define CRBMSK_INTRESETCMD ( (uint16_t)( 1 << CRBBIT_INTRESETCMD) ) +#define CRBMSK_INTRESET_B ( (uint16_t)( 1 << CRBBIT_INTRESET_B) ) +#define CRBMSK_INTRESET_A ( (uint16_t)( 1 << CRBBIT_INTRESET_A) ) +#define CRBMSK_CLKENAB_A ( (uint16_t)( 1 << CRBBIT_CLKENAB_A) ) +#define CRBMSK_INTSRC_B ( (uint16_t)( 3 << CRBBIT_INTSRC_B) ) +#define CRBMSK_LATCHSRC ( (uint16_t)( 3 << CRBBIT_LATCHSRC) ) +#define CRBMSK_LOADSRC_B ( (uint16_t)( 3 << CRBBIT_LOADSRC_B) ) +#define CRBMSK_CLKMULT_B ( (uint16_t)( 3 << CRBBIT_CLKMULT_B) ) +#define CRBMSK_CLKENAB_B ( (uint16_t)( 1 << CRBBIT_CLKENAB_B) ) +#define CRBMSK_INDXPOL_B ( (uint16_t)( 1 << CRBBIT_INDXPOL_B) ) +#define CRBMSK_CLKPOL_B ( (uint16_t)( 1 << CRBBIT_CLKPOL_B) ) + +#define CRBMSK_INTCTRL ( CRBMSK_INTRESETCMD | CRBMSK_INTRESET_A | CRBMSK_INTRESET_B ) // Interrupt reset control bits. + +// Bit field positions for standardized SETUP structure. + +#define STDBIT_INTSRC 13 +#define STDBIT_LATCHSRC 11 +#define STDBIT_LOADSRC 9 +#define STDBIT_INDXSRC 7 +#define STDBIT_INDXPOL 6 +#define STDBIT_CLKSRC 4 +#define STDBIT_CLKPOL 3 +#define STDBIT_CLKMULT 1 +#define STDBIT_CLKENAB 0 + +// Bit field masks for standardized SETUP structure. + +#define STDMSK_INTSRC ( (uint16_t)( 3 << STDBIT_INTSRC ) ) +#define STDMSK_LATCHSRC ( (uint16_t)( 3 << STDBIT_LATCHSRC ) ) +#define STDMSK_LOADSRC ( (uint16_t)( 3 << STDBIT_LOADSRC ) ) +#define STDMSK_INDXSRC ( (uint16_t)( 1 << STDBIT_INDXSRC ) ) +#define STDMSK_INDXPOL ( (uint16_t)( 1 << STDBIT_INDXPOL ) ) +#define STDMSK_CLKSRC ( (uint16_t)( 3 << STDBIT_CLKSRC ) ) +#define STDMSK_CLKPOL ( (uint16_t)( 1 << STDBIT_CLKPOL ) ) +#define STDMSK_CLKMULT ( (uint16_t)( 3 << STDBIT_CLKMULT ) ) +#define STDMSK_CLKENAB ( (uint16_t)( 1 << STDBIT_CLKENAB ) ) + +////////////////////////////////////////////////////////// + +/* typedef struct indexCounter */ +/* { */ +/* unsigned int ao; */ +/* unsigned int ai; */ +/* unsigned int digout; */ +/* unsigned int digin; */ +/* unsigned int enc; */ +/* }CallCounter; */ + +typedef struct bufferDMA +{ + void *PhysicalBase; + void *LogicalBase; + uint32_t DMAHandle; +} DMABUF; + + diff --git a/comedi/drivers/usbdux.c b/comedi/drivers/usbdux.c index 7be9a81e..1d110324 100644 --- a/comedi/drivers/usbdux.c +++ b/comedi/drivers/usbdux.c @@ -1,4 +1,4 @@ -#define DRIVER_VERSION "v1.00pre11" +#define DRIVER_VERSION "v1.00pre12" #define DRIVER_AUTHOR "Bernd Porr, BerndPorr@f2s.com" #define DRIVER_DESC "Stirling/ITL USB-DUX -- Bernd.Porr@f2s.com" /* @@ -25,7 +25,7 @@ Driver: usbdux.c Description: University of Stirling USB DAQ & INCITE Technology Limited Devices: [ITL] USB-DUX (usbdux.o) Author: Bernd Porr -Updated: 13 Apr 2005 +Updated: 23 May 2005 Status: Stable Configuration options: You have to upload firmware with the -i option. The @@ -81,13 +81,6 @@ sampling rate. If you sample two channels you get 4kHz and so on. // generates loads of debug info // #define NOISY_DUX_DEBUGBUG -// generates moderate amount of debug info -#define CONFIG_COMEDI_DEBUG - -// uncomment this if you don't want to have debug infos from CVS versions -#undef CONFIG_COMEDI_DEBUG - - #include #include #include @@ -104,7 +97,7 @@ sampling rate. If you sample two channels you get 4kHz and so on. #define BOARDNAME "usbdux" // timeout for the USB-transfer -#define EZTIMEOUT 3 +#define EZTIMEOUT 30 // constants for "firmware" upload and download #define USBDUXSUB_FIRMWARE 0xA0 @@ -299,13 +292,16 @@ static DECLARE_MUTEX (start_stop_sem); // Stops the data acquision // It should be safe to call this function from any context static int usbduxsub_unlink_InURBs(usbduxsub_t* usbduxsub_tmp) { - int i,j=0; + int i=0; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8) + int j=0; +#endif int err=0; if (usbduxsub_tmp && usbduxsub_tmp->urbIn) { for (i=0; i < usbduxsub_tmp->numOfInBuffers; i++) { if (usbduxsub_tmp->urbIn[i]) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8) j=usb_unlink_urb(usbduxsub_tmp->urbIn[i]); if (j<0) { err=j; @@ -316,10 +312,9 @@ static int usbduxsub_unlink_InURBs(usbduxsub_t* usbduxsub_tmp) { usb_kill_urb(usbduxsub_tmp->urbIn[i]); #endif } -#ifdef CONFIG_COMEDI_DEBUG - printk("comedi: usbdux: unlinked InURB %d: res=%d\n", - i, - j); +#ifdef NOISY_DUX_DEBUGBUG + printk("comedi: usbdux: unlinked InURB %d, err=%d\n", + i,err); #endif } } @@ -341,7 +336,7 @@ static int usbdux_ai_stop(usbduxsub_t* this_usbduxsub, return -EFAULT; } -#ifdef CONFIG_COMEDI_DEBUG +#ifdef NOISY_DUX_DEBUGBUG printk("comedi: usbdux_ai_stop\n"); #endif @@ -367,7 +362,7 @@ static int usbdux_ai_cancel(comedi_device *dev, int res=0; // force unlink of all urbs -#ifdef CONFIG_COMEDI_DEBUG +#ifdef NOISY_DUX_DEBUGBUG printk("comedi: usbdux_ai_cancel\n"); #endif this_usbduxsub=dev->private; @@ -565,13 +560,17 @@ static void usbduxsub_ai_IsocIrq(struct urb *urb, struct pt_regs *regs) static int usbduxsub_unlink_OutURBs(usbduxsub_t* usbduxsub_tmp) { - int i,j=0; + int i=0; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8) + int j=0; +#endif + int err=0; if (usbduxsub_tmp && usbduxsub_tmp->urbOut) { for (i=0; i < usbduxsub_tmp->numOfOutBuffers; i++) { if (usbduxsub_tmp->urbOut[i]) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8) j=usb_unlink_urb(usbduxsub_tmp->urbOut[i]); if (jurbOut[i]); #endif } -#ifdef CONFIG_COMEDI_DEBUG - printk("comedi: usbdux: unlinked OutURB %d: res=%d\n",i,j); +#ifdef NOISY_DUX_DEBUGBUG + printk("comedi: usbdux: unlinked OutURB %d: res=%d\n", + i,err); #endif } } @@ -600,13 +600,13 @@ static int usbdux_ao_stop(usbduxsub_t* this_usbduxsub, int ret=0; if (!this_usbduxsub) { -#ifdef CONFIG_COMEDI_DEBUG +#ifdef NOISY_DUX_DEBUGBUG printk("comedi?: usbdux_ao_stop: this_usbduxsub=NULL!\n"); #endif return -EFAULT; } -#ifdef CONFIG_COMEDI_DEBUG +#ifdef NOISY_DUX_DEBUGBUG printk("comedi: usbdux_ao_cancel\n"); #endif if (do_unlink) { @@ -829,7 +829,7 @@ static int usbduxsub_start(usbduxsub_t* usbduxsub) { if (usbduxsub->probed) { // 7f92 to zero local_transfer_buffer[0]=0; - errcode=usb_control_msg + errcode=USB_CONTROL_MSG (usbduxsub->usbdev, // create a pipe for a control transfer usb_sndctrlpipe(usbduxsub->usbdev,0), @@ -866,7 +866,7 @@ static int usbduxsub_stop(usbduxsub_t* usbduxsub) { if (usbduxsub->probed) { // 7f92 to one local_transfer_buffer[0]=1; - errcode=usb_control_msg + errcode=USB_CONTROL_MSG (usbduxsub->usbdev, usb_sndctrlpipe(usbduxsub->usbdev,0), // bRequest, "Firmware" @@ -909,7 +909,7 @@ static int usbduxsub_upload(usbduxsub_t* usbduxsub, startAddr, local_transfer_buffer[0]); #endif - errcode=usb_control_msg + errcode=USB_CONTROL_MSG (usbduxsub->usbdev, usb_sndctrlpipe(usbduxsub->usbdev, 0), // brequest, firmware @@ -927,7 +927,7 @@ static int usbduxsub_upload(usbduxsub_t* usbduxsub, // timeout EZTIMEOUT ); -#ifdef CONFIG_COMEDI_DEBUG +#ifdef NOISY_DUX_DEBUGBUG printk("comedi_: usbdux: result=%d\n",errcode); #endif if (errcode<0) { @@ -993,7 +993,7 @@ int usbduxsub_submit_InURBs(usbduxsub_t* usbduxsub) { usbduxsub->urbIn[i]->dev = usbduxsub->usbdev; usbduxsub->urbIn[i]->status = 0; usbduxsub->urbIn[i]->transfer_flags = URB_ISO_ASAP; -#ifdef CONFIG_COMEDI_DEBUG +#ifdef NOISY_DUX_DEBUGBUG printk("comedi%d: usbdux: submitting in-urb[%d]: %p,%p intv=%d\n", usbduxsub->comedidev->minor, i, @@ -1023,7 +1023,7 @@ int usbduxsub_submit_OutURBs(usbduxsub_t* usbduxsub) { return -EFAULT; } for (i=0; i < usbduxsub->numOfOutBuffers; i++) { -#ifdef CONFIG_COMEDI_DEBUG +#ifdef NOISY_DUX_DEBUGBUG printk("comedi_: usbdux: submitting out-urb[%d]\n",i); #endif // in case of a resubmission after an unlink... @@ -1052,12 +1052,13 @@ static int usbdux_ai_cmdtest(comedi_device *dev, comedi_cmd *cmd) { int err=0,tmp,i; + unsigned int tmpTimer; usbduxsub_t* this_usbduxsub=dev->private; if (!(this_usbduxsub->probed)) { return -ENODEV; } -#ifdef CONFIG_COMEDI_DEBUG +#ifdef NOISY_DUX_DEBUGBUG printk("comedi%d: usbdux_ai_cmdtest\n",dev->minor); #endif /* make sure triggers are valid */ @@ -1130,12 +1131,24 @@ static int usbdux_ai_cmdtest(comedi_device *dev, cmd->scan_begin_arg=1000000/8*i; err++; } + // now calc the real sampling rate with all the rounding errors + tmpTimer = ((unsigned int)(cmd->scan_begin_arg/125000))*125000; + if (cmd->scan_begin_arg != tmpTimer) { + cmd->scan_begin_arg = tmpTimer; + err++; + } } else { // full speed // 1kHz scans every USB frame if(cmd->scan_begin_arg<1000000){ cmd->scan_begin_arg=1000000; err++; } + // calc the real sampling rate with the rounding errors + tmpTimer = ((unsigned int)(cmd->scan_begin_arg/1000000))*1000000; + if (cmd->scan_begin_arg != tmpTimer) { + cmd->scan_begin_arg = tmpTimer; + err++; + } } } // the same argument @@ -1196,7 +1209,7 @@ static int send_dux_commands(usbduxsub_t* this_usbduxsub,int cmd_type) { } printk("\n"); #endif - result = usb_bulk_msg(this_usbduxsub->usbdev, + result = USB_BULK_MSG(this_usbduxsub->usbdev, usb_sndbulkpipe(this_usbduxsub->usbdev, COMMAND_OUT_EP), this_usbduxsub->dux_commands, @@ -1221,7 +1234,7 @@ static int receive_dux_commands(usbduxsub_t* this_usbduxsub,int command) { int i; for(i=0;iusbdev, + result = USB_BULK_MSG(this_usbduxsub->usbdev, usb_rcvbulkpipe(this_usbduxsub->usbdev, COMMAND_IN_EP), this_usbduxsub->insnBuffer, @@ -1269,7 +1282,7 @@ static int usbdux_ai_inttrig(comedi_device *dev, return -ENODEV; } -#ifdef CONFIG_COMEDI_DEBUG +#ifdef NOISY_DUX_DEBUGBUG printk("comedi%d: usbdux_ai_inttrig\n",dev->minor); #endif @@ -1313,7 +1326,7 @@ static int usbdux_ai_cmd(comedi_device *dev, comedi_subdevice *s) usbduxsub_t* this_usbduxsub=dev->private; int result; -#ifdef CONFIG_COMEDI_DEBUG +#ifdef NOISY_DUX_DEBUGBUG printk("comedi%d: usbdux_ai_cmd\n",dev->minor); #endif if (!this_usbduxsub) { @@ -1349,7 +1362,7 @@ static int usbdux_ai_cmd(comedi_device *dev, comedi_subdevice *s) } -#ifdef CONFIG_COMEDI_DEBUG +#ifdef NOISY_DUX_DEBUGBUG printk("comedi %d: sending commands to the usb device: ", dev->minor); printk("size=%u\n", @@ -1627,7 +1640,7 @@ static int usbdux_ao_cmdtest(comedi_device *dev, if (!(this_usbduxsub->probed)) { return -ENODEV; } -#ifdef CONFIG_COMEDI_DEBUG +#ifdef NOISY_DUX_DEBUGBUG printk("comedi%d: usbdux_ao_cmdtest\n",dev->minor); #endif /* make sure triggers are valid */ @@ -1735,7 +1748,7 @@ static int usbdux_ao_cmdtest(comedi_device *dev, } } -#ifdef CONFIG_COMEDI_DEBUG +#ifdef NOISY_DUX_DEBUGBUG printk("comedi%d: err=%d, scan_begin_src=%d, scan_begin_arg=%d, convert_src=%d, convert_arg=%d\n", dev->minor, err, @@ -1768,7 +1781,7 @@ static int usbdux_ao_cmd(comedi_device *dev, comedi_subdevice *s) up(&this_usbduxsub->sem); return -ENODEV; } -#ifdef CONFIG_COMEDI_DEBUG +#ifdef NOISY_DUX_DEBUGBUG printk("comedi%d: usbdux_ao_cmd\n",dev->minor); #endif @@ -1782,7 +1795,7 @@ static int usbdux_ao_cmd(comedi_device *dev, comedi_subdevice *s) break; } this_usbduxsub->dac_commands[i]=(chan<<6); -#ifdef CONFIG_COMEDI_DEBUG +#ifdef NOISY_DUX_DEBUGBUG printk("comedi%d: dac command for ch %d is %x\n", dev->minor, i, @@ -1801,7 +1814,7 @@ static int usbdux_ao_cmd(comedi_device *dev, comedi_subdevice *s) // 1ms // timing of the scan: we get all channels at once this_usbduxsub->ao_timer = cmd->scan_begin_arg/1000000; -#ifdef CONFIG_COMEDI_DEBUG +#ifdef NOISY_DUX_DEBUGBUG printk("comedi%d: usbdux: scan_begin_src=%d, scan_begin_arg=%d, convert_src=%d, convert_arg=%d\n", dev->minor, cmd->scan_begin_src, @@ -2056,6 +2069,9 @@ static void tidy_up(usbduxsub_t* usbduxsub_tmp) { usbduxsub_tmp->urbIn[i]->transfer_buffer=NULL; } if (usbduxsub_tmp->urbIn[i]) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,8) + usb_kill_urb(usbduxsub_tmp->urbIn[i]); +#endif usb_free_urb (usbduxsub_tmp->urbIn[i]); usbduxsub_tmp->urbIn[i]=NULL; } @@ -2074,6 +2090,9 @@ static void tidy_up(usbduxsub_t* usbduxsub_tmp) { usbduxsub_tmp->urbOut[i]->transfer_buffer=NULL; } if (usbduxsub_tmp->urbOut[i]) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,8) + usb_kill_urb(usbduxsub_tmp->urbOut[i]); +#endif usb_free_urb (usbduxsub_tmp->urbOut[i]); usbduxsub_tmp->urbOut[i]=NULL; } @@ -2464,7 +2483,7 @@ static int usbduxsub_probe(struct usb_interface *uinterf, // we've reached the bottom of the function usbduxsub[index].probed=1; up(&start_stop_sem); - printk("comedi_: usbdux%d has been successfully initialized.\n",index); + printk("comedi_: usbdux%d has been successfully initialised.\n",index); #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) return (void*)(&usbduxsub[index]); #else @@ -2647,7 +2666,7 @@ static int usbdux_attach(comedi_device * dev, comedi_devconfig * it) up(&start_stop_sem); - printk("comedi%d: successfully attached to usbdux.\n", + printk("comedi%d: attached to usbdux.\n", dev->minor); return 0; diff --git a/comedi/drivers/usbduxfast.c b/comedi/drivers/usbduxfast.c index 3362c3ed..dc88bcb8 100644 --- a/comedi/drivers/usbduxfast.c +++ b/comedi/drivers/usbduxfast.c @@ -1,4 +1,4 @@ -#define DRIVER_VERSION "v0.92" +#define DRIVER_VERSION "v0.94" #define DRIVER_AUTHOR "Bernd Porr, BerndPorr@f2s.com" #define DRIVER_DESC "USB-DUXfast, BerndPorr@f2s.com" /* @@ -25,7 +25,7 @@ Driver: usbduxfast.c Description: ITL USB-DUXfast Devices: [ITL] USB-DUX (usbduxfast.o) Author: Bernd Porr -Updated: 07 Feb 2005 +Updated: 12 Jun 2005 Status: testing */ @@ -66,7 +66,7 @@ Status: testing #define BOARDNAME "usbduxfast" // timeout for the USB-transfer -#define EZTIMEOUT 3 +#define EZTIMEOUT 30 // constants for "firmware" upload and download #define USBDUXFASTSUB_FIRMWARE 0xA0 @@ -115,7 +115,7 @@ Status: testing // Analogue in subdevice #define SUBDEV_AD 0 -// minimal time in nanoseconds between two samples +// min delay steps #define MIN_SAMPLING_PERIOD 9 // steps at 30MHz in the FX2 // Max number of 1/30MHz delay steps: @@ -208,13 +208,13 @@ static int send_dux_commands(usbduxfastsub_t* this_usbduxfastsub,int cmd_type) { } printk("\n"); #endif - result = usb_bulk_msg(this_usbduxfastsub->usbdev, + result = USB_BULK_MSG(this_usbduxfastsub->usbdev, usb_sndbulkpipe(this_usbduxfastsub->usbdev, CHANNELLISTEP), this_usbduxfastsub->dux_commands, SIZEOFDUXBUFFER, &nsent, - 10*HZ); + 10000); if (result<0) { printk("comedi%d: could not transmit dux_commands to the usb-device, err=%d\n", this_usbduxfastsub->comedidev->minor,result); @@ -234,7 +234,7 @@ static int usbduxfastsub_unlink_InURBs(usbduxfastsub_t* usbduxfastsub_tmp) { if (usbduxfastsub_tmp && usbduxfastsub_tmp->urbIn) { usbduxfastsub_tmp->ai_cmd_running=0; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8) j=usb_unlink_urb(usbduxfastsub_tmp->urbIn); if (j<0) { err=j; @@ -466,7 +466,7 @@ static int usbduxfastsub_start(usbduxfastsub_t* usbduxfastsub) { if (usbduxfastsub->probed) { // 7f92 to zero local_transfer_buffer[0]=0; - errcode=usb_control_msg + errcode=USB_CONTROL_MSG (usbduxfastsub->usbdev, // create a pipe for a control transfer usb_sndctrlpipe(usbduxfastsub->usbdev,0), @@ -503,7 +503,7 @@ static int usbduxfastsub_stop(usbduxfastsub_t* usbduxfastsub) { if (usbduxfastsub->probed) { // 7f92 to one local_transfer_buffer[0]=1; - errcode=usb_control_msg + errcode=USB_CONTROL_MSG (usbduxfastsub->usbdev, usb_sndctrlpipe(usbduxfastsub->usbdev,0), // bRequest, "Firmware" @@ -546,7 +546,7 @@ static int usbduxfastsub_upload(usbduxfastsub_t* usbduxfastsub, startAddr, local_transfer_buffer[0]); #endif - errcode=usb_control_msg + errcode=USB_CONTROL_MSG (usbduxfastsub->usbdev, usb_sndctrlpipe(usbduxfastsub->usbdev, 0), // brequest, firmware @@ -656,6 +656,7 @@ static int usbduxfast_ai_cmdtest(comedi_device *dev, { int err=0, stop_mask=0; long int steps,tmp=0; + int minSamplPer; usbduxfastsub_t* this_usbduxfastsub=dev->private; if (!(this_usbduxfastsub->probed)) { return -ENODEV; @@ -730,11 +731,17 @@ static int usbduxfast_ai_cmdtest(comedi_device *dev, err++; } + if (cmd->chanlist_len==1) { + minSamplPer=1; + } else { + minSamplPer=MIN_SAMPLING_PERIOD; + } + if(cmd->convert_src == TRIG_TIMER) { steps=cmd->convert_arg*30; - if (steps<(MIN_SAMPLING_PERIOD*1000)) { - steps=MIN_SAMPLING_PERIOD*1000; + if (steps<(minSamplPer*1000)) { + steps=minSamplPer*1000; } if (steps>(MAX_SAMPLING_PERIOD*1000)) { steps=MAX_SAMPLING_PERIOD*1000; @@ -906,7 +913,7 @@ static int usbduxfast_ai_cmd(comedi_device *dev, comedi_subdevice *s) if(cmd->convert_src == TRIG_TIMER) { steps=(cmd->convert_arg*30)/1000; } - if (stepschanlist_len!=1)) { printk("comedi%d: usbduxfast: ai_cmd: steps=%ld, scan_begin_arg=%d. Not properly tested by cmdtest?\n", dev->minor, steps, @@ -934,45 +941,66 @@ static int usbduxfast_ai_cmd(comedi_device *dev, comedi_subdevice *s) case 1: if (CR_RANGE(cmd->chanlist[0])>0) rngmask=0xff-0x04; else rngmask=0xff; // commit data to the FIFO - this_usbduxfastsub->dux_commands[LENBASE+0]=1; - this_usbduxfastsub->dux_commands[OPBASE+0]=0x02; // data - this_usbduxfastsub->dux_commands[OUTBASE+0]=0xFF & rngmask; - this_usbduxfastsub->dux_commands[LOGBASE+0]=0; - - // we have 6 states with duration 1 - steps=steps-6; - // do the first part of the delay - this_usbduxfastsub->dux_commands[LENBASE+1]=steps/2; - this_usbduxfastsub->dux_commands[OPBASE+1]=0; - this_usbduxfastsub->dux_commands[OUTBASE+1]=0xFF & rngmask; - this_usbduxfastsub->dux_commands[LOGBASE+1]=0; - - // and the second part - this_usbduxfastsub->dux_commands[LENBASE+2]=steps-steps/2; - this_usbduxfastsub->dux_commands[OPBASE+2]=0; - this_usbduxfastsub->dux_commands[OUTBASE+2]=0xFF & rngmask; - this_usbduxfastsub->dux_commands[LOGBASE+2]=0; - - this_usbduxfastsub->dux_commands[LENBASE+3]=1; - this_usbduxfastsub->dux_commands[OPBASE+3]=0; - this_usbduxfastsub->dux_commands[OUTBASE+3]=0xFF & rngmask; - this_usbduxfastsub->dux_commands[LOGBASE+3]=0; - - this_usbduxfastsub->dux_commands[LENBASE+4]=1; - this_usbduxfastsub->dux_commands[OPBASE+4]=0; - this_usbduxfastsub->dux_commands[OUTBASE+4]=0xFF & rngmask; - this_usbduxfastsub->dux_commands[LOGBASE+4]=0; - - this_usbduxfastsub->dux_commands[LENBASE+5]=1; - this_usbduxfastsub->dux_commands[OPBASE+5]=0; - this_usbduxfastsub->dux_commands[OUTBASE+5]=0xFF & rngmask; - this_usbduxfastsub->dux_commands[LOGBASE+5]=0; - - this_usbduxfastsub->dux_commands[LENBASE+6]=1; - this_usbduxfastsub->dux_commands[OPBASE+6]=0; - this_usbduxfastsub->dux_commands[OUTBASE+6]=0xFF & rngmask; - this_usbduxfastsub->dux_commands[LOGBASE+6]=0; + if (stepsdux_commands[LENBASE+0]=0x80; // branch back to state 0 + this_usbduxfastsub->dux_commands[OPBASE+0]=0x03; // deceision state with data + this_usbduxfastsub->dux_commands[OUTBASE+0]=0xFF & rngmask; + this_usbduxfastsub->dux_commands[LOGBASE+0]=0xFF; // doesn't matter + } else { + this_usbduxfastsub->dux_commands[LENBASE+0]=steps-1; + this_usbduxfastsub->dux_commands[OPBASE+0]=0x02; // data + this_usbduxfastsub->dux_commands[OUTBASE+0]=0xFF & rngmask; + this_usbduxfastsub->dux_commands[LOGBASE+0]=0; + } + this_usbduxfastsub->dux_commands[LENBASE+1]=0x00; // branch back to state 0 + this_usbduxfastsub->dux_commands[OPBASE+1]=0x01; // deceision state w/o data + this_usbduxfastsub->dux_commands[OUTBASE+1]=0xFF & rngmask; + this_usbduxfastsub->dux_commands[LOGBASE+1]=0xFF; // doesn't matter + } else { + // for slower sampling rate we loop through the idle state + this_usbduxfastsub->dux_commands[LENBASE+0]=1; + this_usbduxfastsub->dux_commands[OPBASE+0]=0x02; // data + this_usbduxfastsub->dux_commands[OUTBASE+0]=0xFF & rngmask; + this_usbduxfastsub->dux_commands[LOGBASE+0]=0; + + // we have 6 states with duration 1 + steps=steps-6; + + // do the first part of the delay + this_usbduxfastsub->dux_commands[LENBASE+1]=steps/2; + this_usbduxfastsub->dux_commands[OPBASE+1]=0; + this_usbduxfastsub->dux_commands[OUTBASE+1]=0xFF & rngmask; + this_usbduxfastsub->dux_commands[LOGBASE+1]=0; + + // and the second part + this_usbduxfastsub->dux_commands[LENBASE+2]=steps-steps/2; + this_usbduxfastsub->dux_commands[OPBASE+2]=0; + this_usbduxfastsub->dux_commands[OUTBASE+2]=0xFF & rngmask; + this_usbduxfastsub->dux_commands[LOGBASE+2]=0; + + this_usbduxfastsub->dux_commands[LENBASE+3]=1; + this_usbduxfastsub->dux_commands[OPBASE+3]=0; + this_usbduxfastsub->dux_commands[OUTBASE+3]=0xFF & rngmask; + this_usbduxfastsub->dux_commands[LOGBASE+3]=0; + + this_usbduxfastsub->dux_commands[LENBASE+4]=1; + this_usbduxfastsub->dux_commands[OPBASE+4]=0; + this_usbduxfastsub->dux_commands[OUTBASE+4]=0xFF & rngmask; + this_usbduxfastsub->dux_commands[LOGBASE+4]=0; + + this_usbduxfastsub->dux_commands[LENBASE+5]=1; + this_usbduxfastsub->dux_commands[OPBASE+5]=0; + this_usbduxfastsub->dux_commands[OUTBASE+5]=0xFF & rngmask; + this_usbduxfastsub->dux_commands[LOGBASE+5]=0; + + this_usbduxfastsub->dux_commands[LENBASE+6]=1; + this_usbduxfastsub->dux_commands[OPBASE+6]=0; + this_usbduxfastsub->dux_commands[OUTBASE+6]=0xFF & rngmask; + this_usbduxfastsub->dux_commands[LOGBASE+6]=0; + } break; case 2: @@ -1267,12 +1295,12 @@ static int usbduxfast_ai_insn_read(comedi_device * dev, (int)(usbduxfastsub->urbIn->dev)); #endif for(i=0;iusbdev, + err=USB_BULK_MSG(usbduxfastsub->usbdev, usb_rcvbulkpipe(usbduxfastsub->usbdev,BULKINEP), usbduxfastsub->transfer_buffer, SIZEINBUF, &actual_length, - 10*HZ); + 10000); if (err<0) { printk("comedi%d: insn timeout. No data.\n", dev->minor); @@ -1282,12 +1310,12 @@ static int usbduxfast_ai_insn_read(comedi_device * dev, } // data points for(i=0;in;) { - err=usb_bulk_msg(usbduxfastsub->usbdev, + err=USB_BULK_MSG(usbduxfastsub->usbdev, usb_rcvbulkpipe(usbduxfastsub->usbdev,BULKINEP), usbduxfastsub->transfer_buffer, SIZEINBUF, &actual_length, - 10*HZ); + 10000); if (err<0) { printk("comedi%d: insn data error: %d\n", dev->minor,err); @@ -1448,7 +1476,7 @@ static void tidy_up(usbduxfastsub_t* usbduxfastsub_tmp) { usbduxfastsub_tmp->probed=0; if (usbduxfastsub_tmp->urbIn) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,8) // waits until a running transfer is over // thus, under 2.4 hotplugging while a command // is running is not safe @@ -1716,8 +1744,8 @@ static int usbduxfast_attach(comedi_device * dev, comedi_devconfig * it) s->do_cmdtest=usbduxfast_ai_cmdtest; s->do_cmd=usbduxfast_ai_cmd; s->cancel=usbduxfast_ai_cancel; - // max value from the A/D converter (12bit) - s->maxdata=0xfff; + // max value from the A/D converter (12bit+1 bit for overflow) + s->maxdata=0x1000; // range table to convert to physical units s->range_table = &range_usbduxfast_ai_range; diff --git a/configure.ac b/configure.ac index aab11fd6..667c62a2 100644 --- a/configure.ac +++ b/configure.ac @@ -81,7 +81,7 @@ AC_OUTPUT([ Makefile comedi/Makefile comedi/drivers/Makefile +comedi/drivers/addi-data/Makefile comedi/kcomedilib/Makefile ]) -#comedi/drivers/addi-data/Makefile diff --git a/include/asm/pgtable.h b/include/asm/pgtable.h index 20fe5b8d..b883905b 100644 --- a/include/asm/pgtable.h +++ b/include/asm/pgtable.h @@ -19,6 +19,13 @@ #ifndef __COMPAT_ASM_PGTABLE_H_ #define __COMPAT_ASM_PGTABLE_H_ +#include + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12) +#define pud_t pgd_t +#define pud_offset(pgd, start) (pgd) +#endif + #include_next #ifndef pte_offset_kernel diff --git a/include/linux/comedi_rt.h b/include/linux/comedi_rt.h index f54699ed..8e23dfb3 100644 --- a/include/linux/comedi_rt.h +++ b/include/linux/comedi_rt.h @@ -29,7 +29,6 @@ #endif #include -#include #include #include #include diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 658110c5..2e0495e5 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -7,7 +7,8 @@ #include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,4) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,10)) \ + || (LINUX_VERSION_CODE == KERNEL_VERSION(2,4,4)) #include_next diff --git a/include/linux/device.h b/include/linux/device.h index 7f3bf34e..47da6ddd 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -15,32 +15,42 @@ struct device_driver char *name; }; -typedef void class_simple; +struct class; +struct class_device; +struct device; -struct device -{ - void *dummy; -}; - -static inline struct class_simple *class_simple_create(struct module *owner, char *name) +static inline struct class *class_create(struct module *owner, char *name) { return NULL; }; -static inline void class_simple_destroy(struct class_simple *cs) +static inline void class_destroy(struct class *cs) {}; -static inline struct class_device *class_simple_device_add(struct class_simple *cs, +static inline struct class_device *class_device_create(struct class *cs, dev_t dev, struct device *device, const char *fmt, ...) { return NULL; }; -static inline void class_simple_device_remove(dev_t dev) +static inline void class_device_destroy(struct class *cs, dev_t dev) {}; #else #include_next + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) +#define class_create(owner, name) \ + (struct class *)class_simple_create(owner, name) +#define class_destroy(cs) \ + class_simple_destroy((struct class_simple *)(cs)) +#define class_device_create(cs, dev, device, fmt...) \ + class_simple_device_add((struct class_simple *)(cs), \ + dev, device, fmt) +#define class_device_destroy(cs, dev) \ + class_simple_device_remove(dev) +#endif + #endif #endif // __COMPAT_LINUX_DEVICE_H_ diff --git a/include/linux/ioport.h b/include/linux/ioport.h index 1755fe3a..28af4048 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -7,8 +7,7 @@ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,20) -#define check_mem_region(start,n) 0 -#define request_mem_region(start,n,name) ((void*) 0) +#define request_mem_region(start,n,name) ((void*) 1) #define release_mem_region(start,n) #endif -- 2.26.2