diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2009-04-21 13:33:46 +1000 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2009-04-21 13:33:46 +1000 |
commit | e9883232685343208d39d1a613c634f3f03a850a (patch) | |
tree | f2162de73ec66d5bb3ab3eee492843ce4f39e5b6 | |
parent | 1d84f6ce3c182240af9877494713157d0b6affb2 (diff) | |
parent | f8c1baa5231eaddf2ef57413f2023ad5c0223434 (diff) |
Merge branch 'quilt/staging'
156 files changed, 8943 insertions, 8683 deletions
diff --git a/drivers/staging/agnx/pci.c b/drivers/staging/agnx/pci.c index 25c0ffd2faa0..590159625133 100644 --- a/drivers/staging/agnx/pci.c +++ b/drivers/staging/agnx/pci.c @@ -452,47 +452,36 @@ static int __devinit agnx_pci_probe(struct pci_dev *pdev, { struct ieee80211_hw *dev; struct agnx_priv *priv; - u32 mem_addr0, mem_len0; - u32 mem_addr1, mem_len1; int err; DECLARE_MAC_BUF(mac); err = pci_enable_device(pdev); if (err) { - printk(KERN_ERR PFX "Can't enable new PCI device\n"); + dev_err(&pdev->dev, "can't enable pci device\n"); return err; } - /* get pci resource */ - mem_addr0 = pci_resource_start(pdev, 0); - mem_len0 = pci_resource_len(pdev, 0); - mem_addr1 = pci_resource_start(pdev, 1); - mem_len1 = pci_resource_len(pdev, 1); - printk(KERN_DEBUG PFX "Memaddr0 is %x, length is %x\n", mem_addr0, mem_len0); - printk(KERN_DEBUG PFX "Memaddr1 is %x, length is %x\n", mem_addr1, mem_len1); - err = pci_request_regions(pdev, "agnx-pci"); if (err) { - printk(KERN_ERR PFX "Can't obtain PCI resource\n"); + dev_err(&pdev->dev, "can't reserve PCI resources\n"); return err; } if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) || pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { - printk(KERN_ERR PFX "No suitable DMA available\n"); + dev_err(&pdev->dev, "no suitable DMA available\n"); + err = -EIO; goto err_free_reg; } pci_set_master(pdev); - printk(KERN_DEBUG PFX "pdev->irq is %d\n", pdev->irq); dev = ieee80211_alloc_hw(sizeof(*priv), &agnx_ops); if (!dev) { - printk(KERN_ERR PFX "ieee80211 alloc failed\n"); + dev_err(&pdev->dev, "ieee80211 alloc failed\n"); err = -ENOMEM; goto err_free_reg; } - /* init priv */ priv = dev->priv; memset(priv, 0, sizeof(*priv)); priv->mode = NL80211_IFTYPE_MONITOR; @@ -501,17 +490,17 @@ static int __devinit agnx_pci_probe(struct pci_dev *pdev, spin_lock_init(&priv->lock); priv->init_status = AGNX_UNINIT; - /* Map mem #1 and #2 */ - priv->ctl = pci_iomap(pdev, 0, mem_len0); -/* printk(KERN_DEBUG PFX"MEM1 mapped address is 0x%p\n", priv->ctl); */ + priv->ctl = pci_iomap(pdev, 0, 0); +/* dev_dbg(&pdev->dev, "MEM1 mapped address is 0x%p\n", priv->ctl); */ if (!priv->ctl) { - printk(KERN_ERR PFX "Can't map device memory\n"); + dev_err(&pdev->dev, "can't map device memory\n"); + err = -ENOMEM; goto err_free_dev; } - priv->data = pci_iomap(pdev, 1, mem_len1); - printk(KERN_DEBUG PFX "MEM2 mapped address is 0x%p\n", priv->data); + priv->data = pci_iomap(pdev, 1, 0); if (!priv->data) { - printk(KERN_ERR PFX "Can't map device memory\n"); + dev_err(&pdev->dev, "can't map device memory\n"); + err = -ENOMEM; goto err_iounmap2; } @@ -552,15 +541,15 @@ static int __devinit agnx_pci_probe(struct pci_dev *pdev, err = ieee80211_register_hw(dev); if (err) { - printk(KERN_ERR PFX "Can't register hardware\n"); + dev_err(&pdev->dev, "can't register hardware\n"); goto err_iounmap; } agnx_hw_reset(priv); - - printk(PFX "%s: hwaddr %s, Rev 0x%02x\n", wiphy_name(dev->wiphy), - print_mac(mac, dev->wiphy->perm_addr), priv->revid); + dev_info(&pdev->dev, "%s: hwaddr %s, Rev 0x%02x\n", + wiphy_name(dev->wiphy), + print_mac(mac, dev->wiphy->perm_addr), priv->revid); return 0; err_iounmap: diff --git a/drivers/staging/agnx/phy.c b/drivers/staging/agnx/phy.c index 2be63312b727..ec1ca86fa0c4 100644 --- a/drivers/staging/agnx/phy.c +++ b/drivers/staging/agnx/phy.c @@ -118,7 +118,7 @@ static void mac_address_set(struct agnx_priv *priv) iowrite32(reg, ctl + AGNX_RXM_MACLO); } -static void receiver_bssid_set(struct agnx_priv *priv, u8 *bssid) +static void receiver_bssid_set(struct agnx_priv *priv, const u8 *bssid) { void __iomem *ctl = priv->ctl; u32 reg; @@ -954,7 +954,7 @@ int agnx_set_ssid(struct agnx_priv *priv, u8 *ssid, size_t ssid_len) return 0; } -void agnx_set_bssid(struct agnx_priv *priv, u8 *bssid) +void agnx_set_bssid(struct agnx_priv *priv, const u8 *bssid) { receiver_bssid_set(priv, bssid); } diff --git a/drivers/staging/agnx/phy.h b/drivers/staging/agnx/phy.h index 55e1e222179e..a955f05361e7 100644 --- a/drivers/staging/agnx/phy.h +++ b/drivers/staging/agnx/phy.h @@ -401,7 +401,7 @@ u8 read_from_eeprom(struct agnx_priv *priv, u16 address); void agnx_hw_init(struct agnx_priv *priv); int agnx_hw_reset(struct agnx_priv *priv); int agnx_set_ssid(struct agnx_priv *priv, u8 *ssid, size_t ssid_len); -void agnx_set_bssid(struct agnx_priv *priv, u8 *bssid); +void agnx_set_bssid(struct agnx_priv *priv, const u8 *bssid); void enable_power_saving(struct agnx_priv *priv); void disable_power_saving(struct agnx_priv *priv); void calibrate_antenna_period(unsigned long data); diff --git a/drivers/staging/agnx/sta.c b/drivers/staging/agnx/sta.c index 5b2d54a587c8..3e7db5e2811a 100644 --- a/drivers/staging/agnx/sta.c +++ b/drivers/staging/agnx/sta.c @@ -22,7 +22,7 @@ void hash_read(struct agnx_priv *priv, u32 reghi, u32 reglo, u8 sta_id) printk(PFX "RX hash cmd are : %.8x%.8x\n", reghi, reglo); } -void hash_write(struct agnx_priv *priv, u8 *mac_addr, u8 sta_id) +void hash_write(struct agnx_priv *priv, const u8 *mac_addr, u8 sta_id) { void __iomem *ctl = priv->ctl; u32 reghi, reglo; diff --git a/drivers/staging/agnx/sta.h b/drivers/staging/agnx/sta.h index 94e2cf1f973f..fd504e3f3870 100644 --- a/drivers/staging/agnx/sta.h +++ b/drivers/staging/agnx/sta.h @@ -201,7 +201,7 @@ struct agnx_beacon_hdr { /* 802.11(abg) beacon */ } __attribute__((__packed__)); -void hash_write(struct agnx_priv *priv, u8 *mac_addr, u8 sta_id); +void hash_write(struct agnx_priv *priv, const u8 *mac_addr, u8 sta_id); void hash_dump(struct agnx_priv *priv, u8 sta_id); void hash_read(struct agnx_priv *priv, u32 reghi, u32 reglo, u8 sta_id); void hash_delete(struct agnx_priv *priv, u32 reghi, u32 reglo, u8 sta_id); diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 2d819d278b0e..0759c98f8e1c 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -29,7 +29,7 @@ config COMEDI_PCI_DRIVERS config COMEDI_PCMCIA_DRIVERS tristate "Comedi PCMCIA drivers" - depends on COMEDI && PCMCIAI + depends on COMEDI && PCMCIA default N ---help--- Enable lots of comedi PCMCIA drivers to be built diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 19dce2ebfc19..bb4a2897feae 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -44,6 +44,7 @@ #include <linux/fs.h> #include "comedidev.h" #include <linux/cdev.h> +#include <linux/stat.h> #include <linux/io.h> #include <linux/uaccess.h> @@ -92,6 +93,15 @@ static int do_cancel(struct comedi_device *dev, struct comedi_subdevice *s); static int comedi_fasync(int fd, struct file *file, int on); static int is_device_busy(struct comedi_device *dev); +static int resize_async_buffer(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_async *async, unsigned new_size); + +/* declarations for sysfs attribute files */ +static struct device_attribute dev_attr_max_read_buffer_kb; +static struct device_attribute dev_attr_read_buffer_kb; +static struct device_attribute dev_attr_max_write_buffer_kb; +static struct device_attribute dev_attr_write_buffer_kb; #ifdef HAVE_UNLOCKED_IOCTL static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd, @@ -277,7 +287,7 @@ static int do_bufconfig_ioctl(struct comedi_device *dev, void *arg) struct comedi_bufconfig bc; struct comedi_async *async; struct comedi_subdevice *s; - int ret = 0; + int retval = 0; if (copy_from_user(&bc, arg, sizeof(struct comedi_bufconfig))) return -EFAULT; @@ -303,37 +313,9 @@ static int do_bufconfig_ioctl(struct comedi_device *dev, void *arg) } if (bc.size) { - if (bc.size > async->max_bufsize) - return -EPERM; - - if (s->busy) { - DPRINTK("subdevice is busy, cannot resize buffer\n"); - return -EBUSY; - } - if (async->mmap_count) { - DPRINTK("subdevice is mmapped, cannot resize buffer\n"); - return -EBUSY; - } - - if (!async->prealloc_buf) - return -EINVAL; - - /* make sure buffer is an integral number of pages - * (we round up) */ - bc.size = (bc.size + PAGE_SIZE - 1) & PAGE_MASK; - - ret = comedi_buf_alloc(dev, s, bc.size); - if (ret < 0) - return ret; - - if (s->buf_change) { - ret = s->buf_change(dev, s, bc.size); - if (ret < 0) - return ret; - } - - DPRINTK("comedi%i subd %d buffer resized to %i bytes\n", - dev->minor, bc.subdevice, async->prealloc_bufsz); + retval = resize_async_buffer(dev, s, async, bc.size); + if (retval < 0) + return retval; } bc.size = async->prealloc_bufsz; @@ -2132,6 +2114,7 @@ int comedi_alloc_board_minor(struct device *hardware_device) struct comedi_device_file_info *info; struct device *csdev; unsigned i; + int retval; info = kzalloc(sizeof(struct comedi_device_file_info), GFP_KERNEL); if (info == NULL) @@ -2154,8 +2137,7 @@ int comedi_alloc_board_minor(struct device *hardware_device) comedi_device_cleanup(info->device); kfree(info->device); kfree(info); - rt_printk - ("comedi: error: ran out of minor numbers for board device files.\n"); + printk(KERN_ERR "comedi: error: ran out of minor numbers for board device files.\n"); return -EBUSY; } info->device->minor = i; @@ -2164,7 +2146,35 @@ int comedi_alloc_board_minor(struct device *hardware_device) hardware_device, "comedi%i", i); if (!IS_ERR(csdev)) info->device->class_dev = csdev; - + dev_set_drvdata(csdev, info); + retval = device_create_file(csdev, &dev_attr_max_read_buffer_kb); + if (retval) { + printk(KERN_ERR "comedi: failed to create sysfs attribute file \"%s\".\n", + dev_attr_max_read_buffer_kb.attr.name); + comedi_free_board_minor(i); + return retval; + } + retval = device_create_file(csdev, &dev_attr_read_buffer_kb); + if (retval) { + printk(KERN_ERR "comedi: failed to create sysfs attribute file \"%s\".\n", + dev_attr_read_buffer_kb.attr.name); + comedi_free_board_minor(i); + return retval; + } + retval = device_create_file(csdev, &dev_attr_max_write_buffer_kb); + if (retval) { + printk(KERN_ERR "comedi: failed to create sysfs attribute file \"%s\".\n", + dev_attr_max_write_buffer_kb.attr.name); + comedi_free_board_minor(i); + return retval; + } + retval = device_create_file(csdev, &dev_attr_write_buffer_kb); + if (retval) { + printk(KERN_ERR "comedi: failed to create sysfs attribute file \"%s\".\n", + dev_attr_write_buffer_kb.attr.name); + comedi_free_board_minor(i); + return retval; + } return i; } @@ -2193,12 +2203,14 @@ void comedi_free_board_minor(unsigned minor) } } -int comedi_alloc_subdevice_minor(struct comedi_device *dev, struct comedi_subdevice *s) +int comedi_alloc_subdevice_minor(struct comedi_device *dev, + struct comedi_subdevice *s) { unsigned long flags; struct comedi_device_file_info *info; struct device *csdev; unsigned i; + int retval; info = kmalloc(sizeof(struct comedi_device_file_info), GFP_KERNEL); if (info == NULL) @@ -2216,8 +2228,7 @@ int comedi_alloc_subdevice_minor(struct comedi_device *dev, struct comedi_subdev comedi_spin_unlock_irqrestore(&comedi_file_info_table_lock, flags); if (i == COMEDI_NUM_MINORS) { kfree(info); - rt_printk - ("comedi: error: ran out of minor numbers for board device files.\n"); + printk(KERN_ERR "comedi: error: ran out of minor numbers for board device files.\n"); return -EBUSY; } s->minor = i; @@ -2227,7 +2238,35 @@ int comedi_alloc_subdevice_minor(struct comedi_device *dev, struct comedi_subdev (int)(s - dev->subdevices)); if (!IS_ERR(csdev)) s->class_dev = csdev; - + dev_set_drvdata(csdev, info); + retval = device_create_file(csdev, &dev_attr_max_read_buffer_kb); + if (retval) { + printk(KERN_ERR "comedi: failed to create sysfs attribute file \"%s\".\n", + dev_attr_max_read_buffer_kb.attr.name); + comedi_free_subdevice_minor(s); + return retval; + } + retval = device_create_file(csdev, &dev_attr_read_buffer_kb); + if (retval) { + printk(KERN_ERR "comedi: failed to create sysfs attribute file \"%s\".\n", + dev_attr_read_buffer_kb.attr.name); + comedi_free_subdevice_minor(s); + return retval; + } + retval = device_create_file(csdev, &dev_attr_max_write_buffer_kb); + if (retval) { + printk(KERN_ERR "comedi: failed to create sysfs attribute file \"%s\".\n", + dev_attr_max_write_buffer_kb.attr.name); + comedi_free_subdevice_minor(s); + return retval; + } + retval = device_create_file(csdev, &dev_attr_write_buffer_kb); + if (retval) { + printk(KERN_ERR "comedi: failed to create sysfs attribute file \"%s\".\n", + dev_attr_write_buffer_kb.attr.name); + comedi_free_subdevice_minor(s); + return retval; + } return i; } @@ -2267,3 +2306,304 @@ struct comedi_device_file_info *comedi_get_device_file_info(unsigned minor) comedi_spin_unlock_irqrestore(&comedi_file_info_table_lock, flags); return info; } + +static int resize_async_buffer(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_async *async, unsigned new_size) +{ + int retval; + + if (new_size > async->max_bufsize) + return -EPERM; + + if (s->busy) { + DPRINTK("subdevice is busy, cannot resize buffer\n"); + return -EBUSY; + } + if (async->mmap_count) { + DPRINTK("subdevice is mmapped, cannot resize buffer\n"); + return -EBUSY; + } + + if (!async->prealloc_buf) + return -EINVAL; + + /* make sure buffer is an integral number of pages + * (we round up) */ + new_size = (new_size + PAGE_SIZE - 1) & PAGE_MASK; + + retval = comedi_buf_alloc(dev, s, new_size); + if (retval < 0) + return retval; + + if (s->buf_change) { + retval = s->buf_change(dev, s, new_size); + if (retval < 0) + return retval; + } + + DPRINTK("comedi%i subd %d buffer resized to %i bytes\n", + dev->minor, s - dev->subdevices, async->prealloc_bufsz); + return 0; +} + +/* sysfs attribute files */ + +static const unsigned bytes_per_kibi = 1024; + +static ssize_t show_max_read_buffer_kb(struct device *dev, + struct device_attribute *attr, char *buf) +{ + ssize_t retval; + struct comedi_device_file_info *info = dev_get_drvdata(dev); + unsigned max_buffer_size_kb = 0; + struct comedi_subdevice *const read_subdevice = + comedi_get_read_subdevice(info); + + mutex_lock(&info->device->mutex); + if (read_subdevice && + (read_subdevice->subdev_flags & SDF_CMD_READ) && + read_subdevice->async) { + max_buffer_size_kb = read_subdevice->async->max_bufsize / + bytes_per_kibi; + } + retval = snprintf(buf, PAGE_SIZE, "%i\n", max_buffer_size_kb); + mutex_unlock(&info->device->mutex); + + return retval; +} + +static ssize_t store_max_read_buffer_kb(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct comedi_device_file_info *info = dev_get_drvdata(dev); + unsigned long new_max_size_kb; + uint64_t new_max_size; + struct comedi_subdevice *const read_subdevice = + comedi_get_read_subdevice(info); + + if (strict_strtoul(buf, 10, &new_max_size_kb)) + return -EINVAL; + if (new_max_size_kb != (uint32_t)new_max_size_kb) + return -EINVAL; + new_max_size = ((uint64_t)new_max_size_kb) * bytes_per_kibi; + if (new_max_size != (uint32_t)new_max_size) + return -EINVAL; + + mutex_lock(&info->device->mutex); + if (read_subdevice == NULL || + (read_subdevice->subdev_flags & SDF_CMD_READ) == 0 || + read_subdevice->async == NULL) { + mutex_unlock(&info->device->mutex); + return -EINVAL; + } + read_subdevice->async->max_bufsize = new_max_size; + mutex_unlock(&info->device->mutex); + + return count; +} + +static struct device_attribute dev_attr_max_read_buffer_kb = { + .attr = { + .name = "max_read_buffer_kb", + .mode = S_IRUGO | S_IWUSR + }, + .show = &show_max_read_buffer_kb, + .store = &store_max_read_buffer_kb +}; + +static ssize_t show_read_buffer_kb(struct device *dev, + struct device_attribute *attr, char *buf) +{ + ssize_t retval; + struct comedi_device_file_info *info = dev_get_drvdata(dev); + unsigned buffer_size_kb = 0; + struct comedi_subdevice *const read_subdevice = + comedi_get_read_subdevice(info); + + mutex_lock(&info->device->mutex); + if (read_subdevice && + (read_subdevice->subdev_flags & SDF_CMD_READ) && + read_subdevice->async) { + buffer_size_kb = read_subdevice->async->prealloc_bufsz / + bytes_per_kibi; + } + retval = snprintf(buf, PAGE_SIZE, "%i\n", buffer_size_kb); + mutex_unlock(&info->device->mutex); + + return retval; +} + +static ssize_t store_read_buffer_kb(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct comedi_device_file_info *info = dev_get_drvdata(dev); + unsigned long new_size_kb; + uint64_t new_size; + int retval; + struct comedi_subdevice *const read_subdevice = + comedi_get_read_subdevice(info); + + if (strict_strtoul(buf, 10, &new_size_kb)) + return -EINVAL; + if (new_size_kb != (uint32_t)new_size_kb) + return -EINVAL; + new_size = ((uint64_t)new_size_kb) * bytes_per_kibi; + if (new_size != (uint32_t)new_size) + return -EINVAL; + + mutex_lock(&info->device->mutex); + if (read_subdevice == NULL || + (read_subdevice->subdev_flags & SDF_CMD_READ) == 0 || + read_subdevice->async == NULL) { + mutex_unlock(&info->device->mutex); + return -EINVAL; + } + retval = resize_async_buffer(info->device, read_subdevice, + read_subdevice->async, new_size); + mutex_unlock(&info->device->mutex); + + if (retval < 0) + return retval; + return count; +} + +static struct device_attribute dev_attr_read_buffer_kb = { + .attr = { + .name = "read_buffer_kb", + .mode = S_IRUGO | S_IWUSR | S_IWGRP + }, + .show = &show_read_buffer_kb, + .store = &store_read_buffer_kb +}; + +static ssize_t show_max_write_buffer_kb(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + ssize_t retval; + struct comedi_device_file_info *info = dev_get_drvdata(dev); + unsigned max_buffer_size_kb = 0; + struct comedi_subdevice *const write_subdevice = + comedi_get_write_subdevice(info); + + mutex_lock(&info->device->mutex); + if (write_subdevice && + (write_subdevice->subdev_flags & SDF_CMD_WRITE) && + write_subdevice->async) { + max_buffer_size_kb = write_subdevice->async->max_bufsize / + bytes_per_kibi; + } + retval = snprintf(buf, PAGE_SIZE, "%i\n", max_buffer_size_kb); + mutex_unlock(&info->device->mutex); + + return retval; +} + +static ssize_t store_max_write_buffer_kb(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct comedi_device_file_info *info = dev_get_drvdata(dev); + unsigned long new_max_size_kb; + uint64_t new_max_size; + struct comedi_subdevice *const write_subdevice = + comedi_get_write_subdevice(info); + + if (strict_strtoul(buf, 10, &new_max_size_kb)) + return -EINVAL; + if (new_max_size_kb != (uint32_t)new_max_size_kb) + return -EINVAL; + new_max_size = ((uint64_t)new_max_size_kb) * bytes_per_kibi; + if (new_max_size != (uint32_t)new_max_size) + return -EINVAL; + + mutex_lock(&info->device->mutex); + if (write_subdevice == NULL || + (write_subdevice->subdev_flags & SDF_CMD_WRITE) == 0 || + write_subdevice->async == NULL) { + mutex_unlock(&info->device->mutex); + return -EINVAL; + } + write_subdevice->async->max_bufsize = new_max_size; + mutex_unlock(&info->device->mutex); + + return count; +} + +static struct device_attribute dev_attr_max_write_buffer_kb = { + .attr = { + .name = "max_write_buffer_kb", + .mode = S_IRUGO | S_IWUSR + }, + .show = &show_max_write_buffer_kb, + .store = &store_max_write_buffer_kb +}; + +static ssize_t show_write_buffer_kb(struct device *dev, + struct device_attribute *attr, char *buf) +{ + ssize_t retval; + struct comedi_device_file_info *info = dev_get_drvdata(dev); + unsigned buffer_size_kb = 0; + struct comedi_subdevice *const write_subdevice = + comedi_get_write_subdevice(info); + + mutex_lock(&info->device->mutex); + if (write_subdevice && + (write_subdevice->subdev_flags & SDF_CMD_WRITE) && + write_subdevice->async) { + buffer_size_kb = write_subdevice->async->prealloc_bufsz / + bytes_per_kibi; + } + retval = snprintf(buf, PAGE_SIZE, "%i\n", buffer_size_kb); + mutex_unlock(&info->device->mutex); + + return retval; +} + +static ssize_t store_write_buffer_kb(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct comedi_device_file_info *info = dev_get_drvdata(dev); + unsigned long new_size_kb; + uint64_t new_size; + int retval; + struct comedi_subdevice *const write_subdevice = + comedi_get_write_subdevice(info); + + if (strict_strtoul(buf, 10, &new_size_kb)) + return -EINVAL; + if (new_size_kb != (uint32_t)new_size_kb) + return -EINVAL; + new_size = ((uint64_t)new_size_kb) * bytes_per_kibi; + if (new_size != (uint32_t)new_size) + return -EINVAL; + + mutex_lock(&info->device->mutex); + if (write_subdevice == NULL || + (write_subdevice->subdev_flags & SDF_CMD_WRITE) == 0 || + write_subdevice->async == NULL) { + mutex_unlock(&info->device->mutex); + return -EINVAL; + } + retval = resize_async_buffer(info->device, write_subdevice, + write_subdevice->async, new_size); + mutex_unlock(&info->device->mutex); + + if (retval < 0) + return retval; + return count; +} + +static struct device_attribute dev_attr_write_buffer_kb = { + .attr = { + .name = "write_buffer_kb", + .mode = S_IRUGO | S_IWUSR | S_IWGRP + }, + .show = &show_write_buffer_kb, + .store = &store_write_buffer_kb +}; diff --git a/drivers/staging/comedi/comedi_rt.h b/drivers/staging/comedi/comedi_rt.h index 169ca963312a..cddd5406abfc 100644 --- a/drivers/staging/comedi/comedi_rt.h +++ b/drivers/staging/comedi/comedi_rt.h @@ -33,6 +33,7 @@ #include <linux/errno.h> #include <linux/spinlock.h> #include <linux/delay.h> +#include <linux/interrupt.h> #ifdef CONFIG_COMEDI_RT @@ -56,8 +57,8 @@ #define rt_printk printk #endif -int comedi_request_irq(unsigned int irq, irqreturn_t(*handler) (int, - void *PT_REGS_ARG), unsigned long flags, const char *device, +int comedi_request_irq(unsigned int irq, irq_handler_t handler, + unsigned long flags, const char *device, struct comedi_device *dev_id); void comedi_free_irq(unsigned int irq, struct comedi_device *dev_id); void comedi_rt_init(void); diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index ea319360ae68..753d3ab312c0 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -35,7 +35,6 @@ #include <linux/mm.h> #include <linux/init.h> #include <linux/vmalloc.h> -#include "interrupt.h" #include <linux/dma-mapping.h> #include <linux/uaccess.h> #include <linux/io.h> @@ -526,4 +525,17 @@ void comedi_usb_auto_unconfig(struct usb_device *usbdev); #include "comedi_rt.h" +#ifdef CONFIG_COMEDI_PCI_DRIVERS + #define CONFIG_COMEDI_PCI +#endif +#ifdef CONFIG_COMEDI_PCI_DRIVERS_MODULE + #define CONFIG_COMEDI_PCI +#endif +#ifdef CONFIG_COMEDI_PCMCIA_DRIVERS + #define CONFIG_COMEDI_PCMCIA +#endif +#ifdef CONFIG_COMEDI_PCMCIA_DRIVERS_MODULE + #define CONFIG_COMEDI_PCMCIA +#endif + #endif /* _COMEDIDEV_H */ diff --git a/drivers/staging/comedi/drivers/8253.h b/drivers/staging/comedi/drivers/8253.h index 08a11a5a16e6..bcf0170e93d7 100644 --- a/drivers/staging/comedi/drivers/8253.h +++ b/drivers/staging/comedi/drivers/8253.h @@ -205,7 +205,7 @@ static inline void i8253_cascade_ns_to_timer_2div(int i8253_osc_base, } *nanosec = div1 * div2 * i8253_osc_base; - *d1 = div1 & 0xffff; // masking is done since counter maps zero to 0x10000 + *d1 = div1 & 0xffff; /* masking is done since counter maps zero to 0x10000 */ *d2 = div2 & 0xffff; return; } @@ -247,12 +247,12 @@ static inline int i8254_load(unsigned long base_address, unsigned int regshift, return -1; byte = counter_number << 6; - byte |= 0x30; // load low then high byte - byte |= (mode << 1); // set counter mode + byte |= 0x30; /* load low then high byte */ + byte |= (mode << 1); /* set counter mode */ outb(byte, base_address + (i8254_control_reg << regshift)); - byte = count & 0xff; // lsb of counter value + byte = count & 0xff; /* lsb of counter value */ outb(byte, base_address + (counter_number << regshift)); - byte = (count >> 8) & 0xff; // msb of counter value + byte = (count >> 8) & 0xff; /* msb of counter value */ outb(byte, base_address + (counter_number << regshift)); return 0; @@ -273,12 +273,12 @@ static inline int i8254_mm_load(void *base_address, unsigned int regshift, return -1; byte = counter_number << 6; - byte |= 0x30; // load low then high byte - byte |= (mode << 1); // set counter mode + byte |= 0x30; /* load low then high byte */ + byte |= (mode << 1); /* set counter mode */ writeb(byte, base_address + (i8254_control_reg << regshift)); - byte = count & 0xff; // lsb of counter value + byte = count & 0xff; /* lsb of counter value */ writeb(byte, base_address + (counter_number << regshift)); - byte = (count >> 8) & 0xff; // msb of counter value + byte = (count >> 8) & 0xff; /* msb of counter value */ writeb(byte, base_address + (counter_number << regshift)); return 0; @@ -294,13 +294,13 @@ static inline int i8254_read(unsigned long base_address, unsigned int regshift, if (counter_number > 2) return -1; - // latch counter + /* latch counter */ byte = counter_number << 6; outb(byte, base_address + (i8254_control_reg << regshift)); - // read lsb + /* read lsb */ ret = inb(base_address + (counter_number << regshift)); - // read msb + /* read msb */ ret += inb(base_address + (counter_number << regshift)) << 8; return ret; @@ -315,13 +315,13 @@ static inline int i8254_mm_read(void *base_address, unsigned int regshift, if (counter_number > 2) return -1; - // latch counter + /* latch counter */ byte = counter_number << 6; writeb(byte, base_address + (i8254_control_reg << regshift)); - // read lsb + /* read lsb */ ret = readb(base_address + (counter_number << regshift)); - // read msb + /* read msb */ ret += readb(base_address + (counter_number << regshift)) << 8; return ret; @@ -336,9 +336,9 @@ static inline void i8254_write(unsigned long base_address, if (counter_number > 2) return; - byte = count & 0xff; // lsb of counter value + byte = count & 0xff; /* lsb of counter value */ outb(byte, base_address + (counter_number << regshift)); - byte = (count >> 8) & 0xff; // msb of counter value + byte = (count >> 8) & 0xff; /* msb of counter value */ outb(byte, base_address + (counter_number << regshift)); } @@ -350,9 +350,9 @@ static inline void i8254_mm_write(void *base_address, if (counter_number > 2) return; - byte = count & 0xff; // lsb of counter value + byte = count & 0xff; /* lsb of counter value */ writeb(byte, base_address + (counter_number << regshift)); - byte = (count >> 8) & 0xff; // msb of counter value + byte = (count >> 8) & 0xff; /* msb of counter value */ writeb(byte, base_address + (counter_number << regshift)); } @@ -374,8 +374,8 @@ static inline int i8254_set_mode(unsigned long base_address, return -1; byte = counter_number << 6; - byte |= 0x30; // load low then high byte - byte |= mode; // set counter mode and BCD|binary + byte |= 0x30; /* load low then high byte */ + byte |= mode; /* set counter mode and BCD|binary */ outb(byte, base_address + (i8254_control_reg << regshift)); return 0; @@ -392,8 +392,8 @@ static inline int i8254_mm_set_mode(void *base_address, return -1; byte = counter_number << 6; - byte |= 0x30; // load low then high byte - byte |= mode; // set counter mode and BCD|binary + byte |= 0x30; /* load low then high byte */ + byte |= mode; /* set counter mode and BCD|binary */ writeb(byte, base_address + (i8254_control_reg << regshift)); return 0; diff --git a/drivers/staging/comedi/drivers/acl7225b.c b/drivers/staging/comedi/drivers/acl7225b.c index b21320f0959f..057753991323 100644 --- a/drivers/staging/comedi/drivers/acl7225b.c +++ b/drivers/staging/comedi/drivers/acl7225b.c @@ -26,8 +26,8 @@ static int acl7225b_attach(struct comedi_device *dev, struct comedi_devconfig * static int acl7225b_detach(struct comedi_device *dev); struct boardtype { - const char *name; // driver name - int io_range; // len of I/O space + const char *name; /* driver name */ + int io_range; /* len of I/O space */ }; static const struct boardtype boardtypes[] = { diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_82x54.c b/drivers/staging/comedi/drivers/addi-data/APCI1710_82x54.c index c96aee09e1b6..b3ee729c50ca 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_82x54.c +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_82x54.c @@ -23,16 +23,16 @@ /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_InitTimer | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_TimerNbr, | -| BYTE_ b_TimerMode, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_TimerNbr, | +| unsigned char_ b_TimerMode, | | ULONG_ ul_ReloadValue, | -| BYTE_ b_InputClockSelection, | -| BYTE_ b_InputClockLevel, | -| BYTE_ b_OutputLevel, | -| BYTE_ b_HardwareGateLevel) -INT i_InsnConfig_InitTimer(struct comedi_device *dev,struct comedi_subdevice *s, +| unsigned char_ b_InputClockSelection, | +| unsigned char_ b_InputClockLevel, | +| unsigned char_ b_OutputLevel, | +| unsigned char_ b_HardwareGateLevel) +int i_InsnConfig_InitTimer(struct comedi_device *dev,struct comedi_subdevice *s, struct comedi_insn *insn,unsigned int *data) | +----------------------------------------------------------------------------+ @@ -148,13 +148,13 @@ INT i_InsnConfig_InitTimer(struct comedi_device *dev,struct comedi_subdevice *s, | +--------------------------------+------------------------------------+ | | | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board | | APCI-1710 | -| BYTE_ b_ModulNbr : Module number to | +| unsigned char_ b_ModulNbr : Module number to | | configure (0 to 3) | -| BYTE_ b_TimerNbr : Timer number to | +| unsigned char_ b_TimerNbr : Timer number to | | configure (0 to 2) | -| BYTE_ b_TimerMode : Timer mode selection | +| unsigned char_ b_TimerMode : Timer mode selection | | (0 to 5) | | 0: Interrupt on terminal| | count | @@ -173,21 +173,21 @@ INT i_InsnConfig_InitTimer(struct comedi_device *dev,struct comedi_subdevice *s, | or division factor | | See timer mode | | description table. | -| BYTE_ b_InputClockSelection : Selection from input | +| unsigned char_ b_InputClockSelection : Selection from input | | timer clock. | | See input clock | | selection table. | -| BYTE_ b_InputClockLevel : Selection from input | +| unsigned char_ b_InputClockLevel : Selection from input | | clock level. | | 0 : Low active | | (Input inverted) | | 1 : High active | -| BYTE_ b_OutputLevel, : Selection from output | +| unsigned char_ b_OutputLevel, : Selection from output | | clock level. | | 0 : Low active | | 1 : High active | | (Output inverted) | -| BYTE_ b_HardwareGateLevel : Selection from | +| unsigned char_ b_HardwareGateLevel : Selection from | | hardware gate level. | | 0 : Low active | | (Input inverted) | @@ -195,14 +195,14 @@ INT i_InsnConfig_InitTimer(struct comedi_device *dev,struct comedi_subdevice *s, | 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]; +|b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_TimerNbr = (unsigned char) CR_CHAN(insn->chanspec); + b_TimerMode = (unsigned char) data[0]; + ul_ReloadValue = (unsigned int) data[1]; + b_InputClockSelection =(unsigned char) data[2]; + b_InputClockLevel =(unsigned char) data[3]; + b_OutputLevel =(unsigned char) data[4]; + b_HardwareGateLevel =(unsigned char) data[5]; +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -219,33 +219,33 @@ INT i_InsnConfig_InitTimer(struct comedi_device *dev,struct comedi_subdevice *s, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * 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; + int i_ReturnValue = 0; + unsigned char b_ModulNbr; + unsigned char b_TimerNbr; + unsigned char b_TimerMode; + unsigned int ul_ReloadValue; + unsigned char b_InputClockSelection; + unsigned char b_InputClockLevel; + unsigned char b_OutputLevel; + unsigned char 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 + /* BEGIN JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz */ + unsigned int 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]; + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_TimerNbr = (unsigned char) CR_CHAN(insn->chanspec); + b_TimerMode = (unsigned char) data[0]; + ul_ReloadValue = (unsigned int) data[1]; + b_InputClockSelection = (unsigned char) data[2]; + b_InputClockLevel = (unsigned char) data[3]; + b_OutputLevel = (unsigned char) data[4]; + b_HardwareGateLevel = (unsigned char) data[5]; /* Test the module number */ if (b_ModulNbr < 4) { @@ -256,7 +256,7 @@ INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_sub 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 + /* 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)) || @@ -271,11 +271,11 @@ INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_sub ((b_InputClockSelection == APCI1710_PCI_BUS_CLOCK) || (b_InputClockSelection == APCI1710_FRONT_CONNECTOR_INPUT) || (b_InputClockSelection == APCI1710_10MHZ)))) { - //BEGIN 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 + /* END JK 27.10.2003 : Add the possibility to use a 40 Mhz quartz */ /* Test the input clock level selection */ if ((b_InputClockLevel == 0) || @@ -284,7 +284,7 @@ INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_sub 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 + /* 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 */ @@ -297,7 +297,7 @@ INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_sub /* Test if detection OK */ if (dw_Test == 1) { - //END JK 27.10.03 : Add the possibility to use a 40 Mhz quartz + /* 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; @@ -314,12 +314,12 @@ INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_sub 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 + /* 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) | + dw_ConfigurationWord = (unsigned int) (((b_HardwareGateLevel << 0) & 0x1) | ((b_InputClockLevel << 1) & 0x2) | (((~b_OutputLevel & 1) << 2) & 0x4) | ((b_InputClockSelection << 4) & 0x10)); @@ -329,40 +329,40 @@ INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_sub 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 + devpriv->s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].dw_ConfigurationWord = (unsigned int)(((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((DWORD) b_TimerMode, devpriv->s_BoardInfos.ui_Address + 16 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); + outl((unsigned int) 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) + /* 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)) + } /* 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)) + } /* 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)) + } /* 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)) + } /* if ((b_InputClockLevel == 0) || (b_InputClockLevel == 1)) */ } else { /* Input timer clock selection is wrong */ DPRINTK("Input timer clock selection is wrong\n"); @@ -373,18 +373,18 @@ INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_sub DPRINTK("Input timer clock selection is wrong\n"); i_ReturnValue = -6; } - } // if ((b_TimerMode >= 0) && (b_TimerMode <= 5)) + } /* 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)) + } /* 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)) + } /* if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) */ } else { /* The module is not a TIMER module */ DPRINTK("The module is not a TIMER module\n"); @@ -402,11 +402,11 @@ INT i_APCI1710_InsnConfigInitTimer(struct comedi_device * dev, struct comedi_sub /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_EnableTimer | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_TimerNbr, | -| BYTE_ b_InterruptEnable) -INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device *dev,struct comedi_subdevice *s, +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_TimerNbr, | +| unsigned char_ b_InterruptEnable) +int i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device *dev,struct comedi_subdevice *s, struct comedi_insn *insn,unsigned int *data) | +----------------------------------------------------------------------------+ | Task : Enable OR Disable the Timer (b_TimerNbr) from selected module | @@ -416,22 +416,22 @@ INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device *dev,struct come | generate a interrupt after the timer value reach | | the zero. See function "i_APCI1710_SetBoardIntRoutineX"| +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board | | APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number | +| unsigned char_ b_ModulNbr : Selected module number | | (0 to 3) | -| BYTE_ b_TimerNbr : Timer number to enable | +| unsigned char_ b_TimerNbr : Timer number to enable | | (0 to 2) | -| BYTE_ b_InterruptEnable : Enable or disable the | +| unsigned char_ 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 + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_TimerNbr = (unsigned char) CR_CHAN(insn->chanspec); + b_ActionType = (unsigned char) data[0]; /* enable disable */ +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -448,21 +448,21 @@ i_ReturnValue=insn->n; +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device * dev, +int i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = 0; - DWORD dw_DummyRead; - BYTE b_ModulNbr; - BYTE b_TimerNbr; - BYTE b_ActionType; - BYTE b_InterruptEnable; + int i_ReturnValue = 0; + unsigned int dw_DummyRead; + unsigned char b_ModulNbr; + unsigned char b_TimerNbr; + unsigned char b_ActionType; + unsigned char 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 + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_TimerNbr = (unsigned char) CR_CHAN(insn->chanspec); + b_ActionType = (unsigned char) data[0]; /* enable disable */ /* Test the module number */ if (b_ModulNbr < 4) { @@ -475,7 +475,7 @@ INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device * dev, switch (b_ActionType) { case APCI1710_ENABLE: - b_InterruptEnable = (BYTE) data[1]; + b_InterruptEnable = (unsigned char) data[1]; /* Test the interrupt selection */ if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) { @@ -487,9 +487,9 @@ INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device * dev, 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) + } /* 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; @@ -498,7 +498,7 @@ INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device * dev, /* 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) + } /* if (b_InterruptEnable == APCI1710_ENABLE) */ /* Test if error occur */ if (i_ReturnValue >= 0) { @@ -530,7 +530,7 @@ INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device * dev, /* Disable the timer */ outl(0, devpriv->s_BoardInfos.ui_Address + 44 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); break; - } // Switch end + } /* Switch end */ } else { /* Timer not initialised see function */ DPRINTK ("Timer not initialised see function\n"); @@ -540,7 +540,7 @@ INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device * dev, /* Timer selection wrong */ DPRINTK("Timer selection wrong\n"); i_ReturnValue = -3; - } // if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) + } /* if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) */ } else { /* The module is not a TIMER module */ DPRINTK("The module is not a TIMER module\n"); @@ -558,18 +558,18 @@ INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ReadAllTimerValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | | PULONG_ pul_TimerValueArray) -INT i_APCI1710_InsnReadAllTimerValue(struct comedi_device *dev,struct comedi_subdevice *s, +int i_APCI1710_InsnReadAllTimerValue(struct comedi_device *dev,struct comedi_subdevice *s, struct comedi_insn *insn,unsigned int *data) | +----------------------------------------------------------------------------+ | Task : Return the all timer values from selected timer | | module (b_ModulNbr). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board | | APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number | +| unsigned char_ b_ModulNbr : Selected module number | | (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : PULONG_ pul_TimerValueArray : Timer value array. | @@ -590,16 +590,16 @@ INT i_APCI1710_InsnReadAllTimerValue(struct comedi_device *dev,struct comedi_sub +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnReadAllTimerValue(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnReadAllTimerValue(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - INT i_ReturnValue = 0; - BYTE b_ModulNbr, b_ReadType; - PULONG pul_TimerValueArray; + int i_ReturnValue = 0; + unsigned char b_ModulNbr, b_ReadType; + unsigned int * pul_TimerValueArray; b_ModulNbr = CR_AREF(insn->chanspec); b_ReadType = CR_CHAN(insn->chanspec); - pul_TimerValueArray = (PULONG) data; + pul_TimerValueArray = (unsigned int *) data; i_ReturnValue = insn->n; switch (b_ReadType) { @@ -662,7 +662,7 @@ INT i_APCI1710_InsnReadAllTimerValue(struct comedi_device *dev, struct comedi_su i_ReturnValue = -2; } - } // End of Switch + } /* End of Switch */ return (i_ReturnValue); } @@ -681,11 +681,11 @@ struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data) +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnBitsTimer(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1710_InsnBitsTimer(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - BYTE b_BitsType; - INT i_ReturnValue = 0; + unsigned char b_BitsType; + int i_ReturnValue = 0; b_BitsType = data[0]; printk("\n82X54"); @@ -693,30 +693,30 @@ INT i_APCI1710_InsnBitsTimer(struct comedi_device * dev, struct comedi_subdevice switch (b_BitsType) { case APCI1710_TIMER_READVALUE: i_ReturnValue = i_APCI1710_ReadTimerValue(dev, - (BYTE)CR_AREF(insn->chanspec), - (BYTE)CR_CHAN(insn->chanspec), - (PULONG) & data[0]); + (unsigned char)CR_AREF(insn->chanspec), + (unsigned char)CR_CHAN(insn->chanspec), + (unsigned int *) & data[0]); break; case APCI1710_TIMER_GETOUTPUTLEVEL: i_ReturnValue = i_APCI1710_GetTimerOutputLevel(dev, - (BYTE)CR_AREF(insn->chanspec), - (BYTE)CR_CHAN(insn->chanspec), - (PBYTE) &data[0]); + (unsigned char)CR_AREF(insn->chanspec), + (unsigned char)CR_CHAN(insn->chanspec), + (unsigned char *) &data[0]); break; case APCI1710_TIMER_GETPROGRESSSTATUS: i_ReturnValue = i_APCI1710_GetTimerProgressStatus(dev, - (BYTE)CR_AREF(insn->chanspec), - (BYTE)CR_CHAN(insn->chanspec), - (PBYTE)&data[0]); + (unsigned char)CR_AREF(insn->chanspec), + (unsigned char)CR_CHAN(insn->chanspec), + (unsigned char *)&data[0]); break; case APCI1710_TIMER_WRITEVALUE: i_ReturnValue = i_APCI1710_WriteTimerValue(dev, - (BYTE)CR_AREF(insn->chanspec), - (BYTE)CR_CHAN(insn->chanspec), - (ULONG)data[1]); + (unsigned char)CR_AREF(insn->chanspec), + (unsigned char)CR_CHAN(insn->chanspec), + (unsigned int)data[1]); break; @@ -733,19 +733,19 @@ INT i_APCI1710_InsnBitsTimer(struct comedi_device * dev, struct comedi_subdevice /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ReadTimerValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_TimerNbr, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_TimerNbr, | | PULONG_ pul_TimerValue) | +----------------------------------------------------------------------------+ | Task : Return the timer value from selected digital timer | | (b_TimerNbr) from selected timer module (b_ModulNbr). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board | | APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number | +| unsigned char_ b_ModulNbr : Selected module number | | (0 to 3) | -| BYTE_ b_TimerNbr : Timer number to read | +| unsigned char_ b_TimerNbr : Timer number to read | | (0 to 2) | +----------------------------------------------------------------------------+ | Output Parameters : PULONG_ pul_TimerValue : Timer value | @@ -760,11 +760,11 @@ INT i_APCI1710_InsnBitsTimer(struct comedi_device * dev, struct comedi_subdevice +----------------------------------------------------------------------------+ */ -INT i_APCI1710_ReadTimerValue(struct comedi_device * dev, - BYTE b_ModulNbr, BYTE b_TimerNbr, - PULONG pul_TimerValue) +int i_APCI1710_ReadTimerValue(struct comedi_device * dev, + unsigned char b_ModulNbr, unsigned char b_TimerNbr, + unsigned int * pul_TimerValue) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /* Test the module number */ if (b_ModulNbr < 4) { @@ -800,7 +800,7 @@ INT i_APCI1710_ReadTimerValue(struct comedi_device * dev, /* Timer selection wrong */ DPRINTK("Timer selection wrong\n"); i_ReturnValue = -3; - } // if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) + } /* if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) */ } else { /* The module is not a TIMER module */ DPRINTK("The module is not a TIMER module\n"); @@ -818,23 +818,23 @@ INT i_APCI1710_ReadTimerValue(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_GetTimerOutputLevel | - | (BYTE_ b_BoardHandle, | - | BYTE_ b_ModulNbr, | - | BYTE_ b_TimerNbr, | - | PBYTE_ pb_OutputLevel) | + | (unsigned char_ b_BoardHandle, | + | unsigned char_ b_ModulNbr, | + | unsigned char_ b_TimerNbr, | + | unsigned char *_ pb_OutputLevel) | +----------------------------------------------------------------------------+ | Task : Return the output signal level (pb_OutputLevel) from | | selected digital timer (b_TimerNbr) from selected timer| | module (b_ModulNbr). | +----------------------------------------------------------------------------+ - | Input Parameters : BYTE_ b_BoardHandle : Handle of board | + | Input Parameters : unsigned char_ b_BoardHandle : Handle of board | | APCI-1710 | - | BYTE_ b_ModulNbr : Selected module number | + | unsigned char_ b_ModulNbr : Selected module number | | (0 to 3) | - | BYTE_ b_TimerNbr : Timer number to test | + | unsigned char_ b_TimerNbr : Timer number to test | | (0 to 2) | +----------------------------------------------------------------------------+ - | Output Parameters : PBYTE_ pb_OutputLevel : Output signal level | + | Output Parameters : unsigned char *_ pb_OutputLevel : Output signal level | | 0 : The output is low | | 1 : The output is high | +----------------------------------------------------------------------------+ @@ -848,12 +848,12 @@ INT i_APCI1710_ReadTimerValue(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_GetTimerOutputLevel(struct comedi_device * dev, - BYTE b_ModulNbr, BYTE b_TimerNbr, - PBYTE pb_OutputLevel) +int i_APCI1710_GetTimerOutputLevel(struct comedi_device * dev, + unsigned char b_ModulNbr, unsigned char b_TimerNbr, + unsigned char * pb_OutputLevel) { - INT i_ReturnValue = 0; - DWORD dw_TimerStatus; + int i_ReturnValue = 0; + unsigned int dw_TimerStatus; /* Test the module number */ if (b_ModulNbr < 4) { @@ -869,7 +869,7 @@ INT i_APCI1710_GetTimerOutputLevel(struct comedi_device * dev, /* Read the timer status */ dw_TimerStatus = inl(devpriv->s_BoardInfos.ui_Address + 16 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); - *pb_OutputLevel = (BYTE) (((dw_TimerStatus >> 7) & 1) ^ devpriv-> s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].b_OutputLevel); + *pb_OutputLevel = (unsigned char) (((dw_TimerStatus >> 7) & 1) ^ devpriv-> s_ModuleInfo[b_ModulNbr].s_82X54ModuleInfo.s_82X54TimerInfo[b_TimerNbr].b_OutputLevel); } else { /* Timer not initialised see function */ DPRINTK("Timer not initialised see function\n"); @@ -879,7 +879,7 @@ INT i_APCI1710_GetTimerOutputLevel(struct comedi_device * dev, /* Timer selection wrong */ DPRINTK("Timer selection wrong\n"); i_ReturnValue = -3; - } // if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) + } /* if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) */ } else { /* The module is not a TIMER module */ DPRINTK("The module is not a TIMER module\n"); @@ -897,23 +897,23 @@ INT i_APCI1710_GetTimerOutputLevel(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_GetTimerProgressStatus | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_TimerNbr, | -| PBYTE_ pb_TimerStatus) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_TimerNbr, | +| unsigned char *_ pb_TimerStatus) | +----------------------------------------------------------------------------+ | Task : Return the progress status (pb_TimerStatus) from | | selected digital timer (b_TimerNbr) from selected timer| | module (b_ModulNbr). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board | | APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number | +| unsigned char_ b_ModulNbr : Selected module number | | (0 to 3) | -| BYTE_ b_TimerNbr : Timer number to test | +| unsigned char_ b_TimerNbr : Timer number to test | | (0 to 2) | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_TimerStatus : Output signal level | +| Output Parameters : unsigned char *_ pb_TimerStatus : Output signal level | | 0 : Timer not in progress | | 1 : Timer in progress | +----------------------------------------------------------------------------+ @@ -927,12 +927,12 @@ INT i_APCI1710_GetTimerOutputLevel(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev, - BYTE b_ModulNbr, BYTE b_TimerNbr, - PBYTE pb_TimerStatus) +int i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_TimerNbr, + unsigned char * pb_TimerStatus) { - INT i_ReturnValue = 0; - DWORD dw_TimerStatus; + int i_ReturnValue = 0; + unsigned int dw_TimerStatus; /* Test the module number */ if (b_ModulNbr < 4) { @@ -949,7 +949,7 @@ INT i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev, /* Read the timer status */ dw_TimerStatus = inl(devpriv->s_BoardInfos.ui_Address + 16 + (b_TimerNbr * 4) + (64 * b_ModulNbr)); - *pb_TimerStatus = (BYTE) ((dw_TimerStatus) >> 8) & 1; + *pb_TimerStatus = (unsigned char) ((dw_TimerStatus) >> 8) & 1; printk("ProgressStatus : %d", *pb_TimerStatus); } else { /* Timer not initialised see function */ @@ -958,7 +958,7 @@ INT i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev, } else { /* Timer selection wrong */ i_ReturnValue = -3; - } // if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) + } /* if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) */ } else { /* The module is not a TIMER module */ @@ -976,9 +976,9 @@ INT i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_WriteTimerValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_TimerNbr, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_TimerNbr, | | ULONG_ ul_WriteValue) | +----------------------------------------------------------------------------+ | Task : Write the value (ul_WriteValue) into the selected timer| @@ -986,11 +986,11 @@ INT i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev, | The action in depend of the time mode selection. | | See timer mode description table. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board | | APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number | +| unsigned char_ b_ModulNbr : Selected module number | | (0 to 3) | -| BYTE_ b_TimerNbr : Timer number to write | +| unsigned char_ b_TimerNbr : Timer number to write | | (0 to 2) | | ULONG_ ul_WriteValue : Value to write | +----------------------------------------------------------------------------+ @@ -1006,11 +1006,11 @@ INT i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_WriteTimerValue(struct comedi_device * dev, - BYTE b_ModulNbr, BYTE b_TimerNbr, - ULONG ul_WriteValue) +int i_APCI1710_WriteTimerValue(struct comedi_device * dev, + unsigned char b_ModulNbr, unsigned char b_TimerNbr, + unsigned int ul_WriteValue) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /* Test the module number */ if (b_ModulNbr < 4) { @@ -1031,7 +1031,7 @@ INT i_APCI1710_WriteTimerValue(struct comedi_device * dev, /* Timer selection wrong */ DPRINTK("Timer selection wrong\n"); i_ReturnValue = -3; - } // if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) + } /* if ((b_TimerNbr >= 0) && (b_TimerNbr <= 2)) */ } else { /* The module is not a TIMER module */ DPRINTK("The module is not a TIMER module\n"); diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_82x54.h b/drivers/staging/comedi/drivers/addi-data/APCI1710_82x54.h index 4797c0b77a43..cf6de0912a24 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_82x54.h +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_82x54.h @@ -34,40 +34,40 @@ /* * 82X54 TIMER INISIALISATION FUNCTION */ -INT i_APCI1710_InsnConfigInitTimer(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnConfigInitTimer(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device *dev, +int i_APCI1710_InsnWriteEnableDisableTimer(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); /* * 82X54 READ FUNCTION */ -INT i_APCI1710_InsnReadAllTimerValue(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnReadAllTimerValue(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_InsnBitsTimer(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnBitsTimer(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); /* * 82X54 READ & WRITE FUNCTION */ -INT i_APCI1710_ReadTimerValue(struct comedi_device *dev, - BYTE b_ModulNbr, BYTE b_TimerNbr, - PULONG pul_TimerValue); +int i_APCI1710_ReadTimerValue(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_TimerNbr, + unsigned int * pul_TimerValue); -INT i_APCI1710_GetTimerOutputLevel(struct comedi_device *dev, - BYTE b_ModulNbr, BYTE b_TimerNbr, - PBYTE pb_OutputLevel); +int i_APCI1710_GetTimerOutputLevel(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_TimerNbr, + unsigned char * pb_OutputLevel); -INT i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev, - BYTE b_ModulNbr, BYTE b_TimerNbr, - PBYTE pb_TimerStatus); +int i_APCI1710_GetTimerProgressStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_TimerNbr, + unsigned char * pb_TimerStatus); /* * 82X54 WRITE FUNCTION */ -INT i_APCI1710_WriteTimerValue(struct comedi_device *dev, - BYTE b_ModulNbr, BYTE b_TimerNbr, - ULONG ul_WriteValue); +int i_APCI1710_WriteTimerValue(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_TimerNbr, + unsigned int ul_WriteValue); diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.c b/drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.c index 1a54d3b2c694..6c3be314303d 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.c +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.c @@ -62,11 +62,11 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_InitChrono | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_ChronoMode, | -| BYTE_ b_PCIInputClock, | -| BYTE_ b_TimingUnit, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_ChronoMode, | +| unsigned char_ b_PCIInputClock, | +| unsigned char_ b_TimingUnit, | | ULONG_ ul_TimingInterval, | | PULONG_ pul_RealTimingInterval) @@ -88,12 +88,12 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc | The mode 4 to 7 is appropriate for measuring the timing| | between two event. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr CR_AREF(insn->chanspec) : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr CR_AREF(insn->chanspec) : Module number to configure | | (0 to 3) | -| BYTE_ b_ChronoMode data[0] : Chronometer action mode | +| unsigned char_ b_ChronoMode data[0] : Chronometer action mode | | (0 to 7). | -| BYTE_ b_PCIInputClock data[1] : Selection from PCI bus clock| +| unsigned char_ b_PCIInputClock data[1] : Selection from PCI bus clock| | - APCI1710_30MHZ : | | The PC have a PCI bus | | clock from 30 MHz | @@ -104,7 +104,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc | The APCI-1710 have a | | integrated 40Mhz | | quartz. | -| BYTE_ b_TimingUnit data[2] : Base timing unity (0 to 4) | +| unsigned char_ b_TimingUnit data[2] : Base timing unity (0 to 4) | | 0 : ns | | 1 : µs | | 2 : ms | @@ -131,23 +131,23 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = 0; - ULONG ul_TimerValue = 0; - ULONG ul_TimingInterval = 0; - ULONG ul_RealTimingInterval = 0; + int i_ReturnValue = 0; + unsigned int ul_TimerValue = 0; + unsigned int ul_TimingInterval = 0; + unsigned int ul_RealTimingInterval = 0; double d_RealTimingInterval = 0; - DWORD dw_ModeArray[8] = + unsigned int dw_ModeArray[8] = { 0x01, 0x05, 0x00, 0x04, 0x02, 0x0E, 0x0A, 0x06 }; - BYTE b_ModulNbr, b_ChronoMode, b_PCIInputClock, b_TimingUnit; + unsigned char b_ModulNbr, b_ChronoMode, b_PCIInputClock, b_TimingUnit; b_ModulNbr = CR_AREF(insn->chanspec); - b_ChronoMode = (BYTE) data[0]; - b_PCIInputClock = (BYTE) data[1]; - b_TimingUnit = (BYTE) data[2]; - ul_TimingInterval = (ULONG) data[3]; + b_ChronoMode = (unsigned char) data[0]; + b_PCIInputClock = (unsigned char) data[1]; + b_TimingUnit = (unsigned char) data[2]; + ul_TimingInterval = (unsigned int) data[3]; i_ReturnValue = insn->n; /**************************/ @@ -214,7 +214,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su ul_TimerValue = - (ULONG) + (unsigned int) (ul_TimingInterval * (0.001 * b_PCIInputClock)); @@ -237,7 +237,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su ul_RealTimingInterval = - (ULONG) + (unsigned int) (ul_TimerValue / (0.001 * (double)b_PCIInputClock)); @@ -272,7 +272,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su if (b_PCIInputClock != APCI1710_40MHZ) { ul_TimerValue = - (ULONG) + (unsigned int) ( (double) (ul_TimerValue) @@ -294,7 +294,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su ul_TimerValue = - (ULONG) + (unsigned int) (ul_TimingInterval * (1.0 * b_PCIInputClock)); @@ -317,7 +317,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su ul_RealTimingInterval = - (ULONG) + (unsigned int) (ul_TimerValue / (1.0 * (double)b_PCIInputClock)); @@ -354,7 +354,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su if (b_PCIInputClock != APCI1710_40MHZ) { ul_TimerValue = - (ULONG) + (unsigned int) ( (double) (ul_TimerValue) @@ -400,7 +400,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su ul_RealTimingInterval = - (ULONG) + (unsigned int) (ul_TimerValue / (1000.0 * (double)b_PCIInputClock)); @@ -435,7 +435,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su if (b_PCIInputClock != APCI1710_40MHZ) { ul_TimerValue = - (ULONG) + (unsigned int) ( (double) (ul_TimerValue) @@ -457,7 +457,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su ul_TimerValue = - (ULONG) + (unsigned int) (ul_TimingInterval * (1000000.0 @@ -482,7 +482,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su ul_RealTimingInterval = - (ULONG) + (unsigned int) (ul_TimerValue / (1000000.0 @@ -520,7 +520,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su if (b_PCIInputClock != APCI1710_40MHZ) { ul_TimerValue = - (ULONG) + (unsigned int) ( (double) (ul_TimerValue) @@ -542,7 +542,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su ul_TimerValue = - (ULONG) + (unsigned int) ( (ul_TimingInterval * @@ -570,7 +570,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su ul_RealTimingInterval = - (ULONG) + (unsigned int) (ul_TimerValue / (1000000.0 @@ -608,7 +608,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su if (b_PCIInputClock != APCI1710_40MHZ) { ul_TimerValue = - (ULONG) + (unsigned int) ( (double) (ul_TimerValue) @@ -736,7 +736,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su DPRINTK("Base timing selection is wrong\n"); i_ReturnValue = -7; } - } // if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) + } /* if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */ else { /***********************************/ /* Timing unity selection is wrong */ @@ -744,8 +744,8 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su 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)) + } /* if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */ + } /* if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ)) */ else { /*****************************************/ /* The selected PCI input clock is wrong */ @@ -753,8 +753,8 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su 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) + } /* if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ)) */ + } /* if (b_ChronoMode >= 0 && b_ChronoMode <= 7) */ else { /***************************************/ /* Chronometer mode selection is wrong */ @@ -762,7 +762,7 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su DPRINTK("Chronometer mode selection is wrong\n"); i_ReturnValue = -4; - } // if (b_ChronoMode >= 0 && b_ChronoMode <= 7) + } /* if (b_ChronoMode >= 0 && b_ChronoMode <= 7) */ } else { /******************************************/ /* The module is not a Chronometer module */ @@ -786,11 +786,11 @@ INT i_APCI1710_InsnConfigInitChrono(struct comedi_device * dev, struct comedi_su /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_EnableChrono | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_CycleMode, | -| BYTE_ b_InterruptEnable) -INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device *dev, +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_CycleMode, | +| unsigned char_ b_InterruptEnable) +int i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device *dev, struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data) | +----------------------------------------------------------------------------+ | Task : Enable the chronometer from selected module | @@ -810,12 +810,12 @@ struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data) | | witch the " i_APCI1710_EnableChrono" function, if no | | stop signal occur this start signal is ignored. +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr CR_AREF(chanspec) : Selected module number (0 to 3) | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr CR_AREF(chanspec) : Selected module number (0 to 3) | data[0] ENABle/Disable chrono -| BYTE_ b_CycleMode : Selected the chronometer | +| unsigned char_ b_CycleMode : Selected the chronometer | | data[1] acquisition mode | -| BYTE_ b_InterruptEnable : Enable or disable the | +| unsigned char_ b_InterruptEnable : Enable or disable the | | data[2] chronometer interrupt. | | APCI1710_ENABLE: | | Enable the chronometer | @@ -840,15 +840,15 @@ struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data) | +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device * dev, +int i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = 0; - BYTE b_ModulNbr, b_CycleMode, b_InterruptEnable, b_Action; + int i_ReturnValue = 0; + unsigned char b_ModulNbr, b_CycleMode, b_InterruptEnable, b_Action; b_ModulNbr = CR_AREF(insn->chanspec); - b_Action = (BYTE) data[0]; - b_CycleMode = (BYTE) data[1]; - b_InterruptEnable = (BYTE) data[2]; + b_Action = (unsigned char) data[0]; + b_CycleMode = (unsigned char) data[1]; + b_InterruptEnable = (unsigned char) data[2]; i_ReturnValue = insn->n; /**************************/ @@ -951,7 +951,7 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device * dev, 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 */ } /***********************************/ @@ -980,7 +980,7 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device * dev, 36 + (64 * b_ModulNbr)); - } // if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) + } /* if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) */ else { /********************************/ /* Interrupt parameter is wrong */ @@ -988,8 +988,8 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device * dev, 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)) + } /* if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) */ + } /* if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS)) */ else { /***********************************************/ /* Chronometer acquisition mode cycle is wrong */ @@ -997,7 +997,7 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device * dev, DPRINTK("Chronometer acquisition mode cycle is wrong\n"); i_ReturnValue = -5; - } // if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS)) + } /* if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS)) */ break; case APCI1710_DISABLE: @@ -1046,7 +1046,7 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device * dev, default: DPRINTK("Inputs wrong! Enable or Disable chrono\n"); i_ReturnValue = -8; - } // switch ENABLE/DISABLE + } /* switch ENABLE/DISABLE */ } else { /*******************************/ /* Chronometer not initialised */ @@ -1090,36 +1090,36 @@ struct comedi_insn *insn,unsigned int *data) | +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnReadChrono(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1710_InsnReadChrono(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - BYTE b_ReadType; - INT i_ReturnValue = insn->n; + unsigned char 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]); + (unsigned char) CR_AREF(insn->chanspec), (unsigned char *) & 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]); + (unsigned char) CR_AREF(insn->chanspec), + (unsigned int) insn->unused[0], + (unsigned char *) & data[0], (unsigned int *) & 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]); + (unsigned char) CR_AREF(insn->chanspec), + (unsigned int) insn->unused[0], + (unsigned int *) & data[0], + (unsigned char *) & data[1], + (unsigned char *) & data[2], + (unsigned int *) & data[3], + (unsigned int *) & data[4], (unsigned int *) & data[5]); break; case APCI1710_CHRONO_READINTERRUPT: @@ -1159,15 +1159,15 @@ INT i_APCI1710_InsnReadChrono(struct comedi_device * dev, struct comedi_subdevic /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_GetChronoProgressStatus | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| PBYTE_ pb_ChronoStatus) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char *_ 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) | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : PULONG_ pb_ChronoStatus : Return the chronometer | | status. | @@ -1194,11 +1194,11 @@ INT i_APCI1710_InsnReadChrono(struct comedi_device * dev, struct comedi_subdevic +----------------------------------------------------------------------------+ */ -INT i_APCI1710_GetChronoProgressStatus(struct comedi_device * dev, - BYTE b_ModulNbr, PBYTE pb_ChronoStatus) +int i_APCI1710_GetChronoProgressStatus(struct comedi_device * dev, + unsigned char b_ModulNbr, unsigned char * pb_ChronoStatus) { - INT i_ReturnValue = 0; - DWORD dw_Status; + int i_ReturnValue = 0; + unsigned int dw_Status; /**************************/ /* Test the module number */ @@ -1233,7 +1233,7 @@ INT i_APCI1710_GetChronoProgressStatus(struct comedi_device * dev, /******************/ *pb_ChronoStatus = 3; - } // if ((dw_Status & 8) == 8) + } /* if ((dw_Status & 8) == 8) */ else { /*******************************/ /* Test if measurement stopped */ @@ -1245,7 +1245,7 @@ INT i_APCI1710_GetChronoProgressStatus(struct comedi_device * dev, /***********************/ *pb_ChronoStatus = 2; - } // if ((dw_Status & 2) == 2) + } /* if ((dw_Status & 2) == 2) */ else { /*******************************/ /* Test if measurement started */ @@ -1257,16 +1257,16 @@ INT i_APCI1710_GetChronoProgressStatus(struct comedi_device * dev, /************************/ *pb_ChronoStatus = 1; - } // if ((dw_Status & 1) == 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_Status & 1) == 1) */ + } /* if ((dw_Status & 2) == 2) */ + } /* if ((dw_Status & 8) == 8) */ } else { /*******************************/ /* Chronometer not initialised */ @@ -1295,10 +1295,10 @@ INT i_APCI1710_GetChronoProgressStatus(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ReadChronoValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| UINT_ ui_TimeOut, | -| PBYTE_ pb_ChronoStatus, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned int_ ui_TimeOut, | +| unsigned char *_ pb_ChronoStatus, | | PULONG_ pul_ChronoValue) | +----------------------------------------------------------------------------+ | Task : Return the chronometer status (pb_ChronoStatus) and the| @@ -1323,8 +1323,8 @@ INT i_APCI1710_GetChronoProgressStatus(struct comedi_device * dev, | "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) | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : PULONG_ pb_ChronoStatus : Return the chronometer | | status. | @@ -1341,7 +1341,7 @@ INT i_APCI1710_GetChronoProgressStatus(struct comedi_device * dev, | timing witch the | | function | | "i_APCI1710_InitChrono" | -| PULONG pul_ChronoValue : Chronometer timing value. | +| unsigned int * pul_ChronoValue : Chronometer timing value. | +----------------------------------------------------------------------------+ | Return Value : 0: No error | | -1: The handle parameter of the board is wrong | @@ -1355,13 +1355,13 @@ INT i_APCI1710_GetChronoProgressStatus(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_ReadChronoValue(struct comedi_device * dev, - BYTE b_ModulNbr, - UINT ui_TimeOut, PBYTE pb_ChronoStatus, PULONG pul_ChronoValue) +int i_APCI1710_ReadChronoValue(struct comedi_device * dev, + unsigned char b_ModulNbr, + unsigned int ui_TimeOut, unsigned char * pb_ChronoStatus, unsigned int * pul_ChronoValue) { - INT i_ReturnValue = 0; - DWORD dw_Status; - DWORD dw_TimeOut = 0; + int i_ReturnValue = 0; + unsigned int dw_Status; + unsigned int dw_TimeOut = 0; /**************************/ /* Test the module number */ @@ -1430,7 +1430,7 @@ INT i_APCI1710_ReadChronoValue(struct comedi_device * dev, } break; - } // if ((dw_Status & 8) == 8) + } /* if ((dw_Status & 8) == 8) */ else { /*******************************/ /* Test if measurement stopped */ @@ -1464,7 +1464,7 @@ INT i_APCI1710_ReadChronoValue(struct comedi_device * dev, outl(0, devpriv->s_BoardInfos.ui_Address + 36 + (64 * b_ModulNbr)); } break; - } // if ((dw_Status & 2) == 2) + } /* if ((dw_Status & 2) == 2) */ else { /*******************************/ /* Test if measurement started */ @@ -1478,7 +1478,7 @@ INT i_APCI1710_ReadChronoValue(struct comedi_device * dev, *pb_ChronoStatus = 1; - } // if ((dw_Status & 1) == 1) + } /* if ((dw_Status & 1) == 1) */ else { /***************************/ /* Measurement not started */ @@ -1487,9 +1487,9 @@ INT i_APCI1710_ReadChronoValue(struct comedi_device * dev, *pb_ChronoStatus = 0; - } // if ((dw_Status & 1) == 1) - } // if ((dw_Status & 2) == 2) - } // if ((dw_Status & 8) == 8) + } /* if ((dw_Status & 1) == 1) */ + } /* if ((dw_Status & 2) == 2) */ + } /* if ((dw_Status & 8) == 8) */ if (dw_TimeOut == ui_TimeOut) { /*****************/ @@ -1507,7 +1507,7 @@ INT i_APCI1710_ReadChronoValue(struct comedi_device * dev, mdelay(1000); } - } // for (;;) + } /* for (;;) */ /*****************************/ /* Test if stop signal occur */ @@ -1581,33 +1581,33 @@ INT i_APCI1710_ReadChronoValue(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ConvertChronoValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | | ULONG_ ul_ChronoValue, | | PULONG_ pul_Hour, | -| PBYTE_ pb_Minute, | -| PBYTE_ pb_Second, | -| PUINT_ pui_MilliSecond, | -| PUINT_ pui_MicroSecond, | -| PUINT_ pui_NanoSecond) | +| unsigned char *_ pb_Minute, | +| unsigned char *_ pb_Second, | +| unsigned int *_ pui_MilliSecond, | +| unsigned int *_ pui_MicroSecond, | +| unsigned int *_ 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)| +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ 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 | +| unsigned char *_ pb_Minute : Chronometer timing minute | +| unsigned char *_ pb_Second : Chronometer timing second | +| unsigned int *_ pui_MilliSecond : Chronometer timing mini | | second | -| PUINT_ pui_MicroSecond : Chronometer timing micro | +| unsigned int *_ pui_MicroSecond : Chronometer timing micro | | second | -| PUINT_ pui_NanoSecond : Chronometer timing nano | +| unsigned int *_ pui_NanoSecond : Chronometer timing nano | | second | +----------------------------------------------------------------------------+ | Return Value : 0: No error | @@ -1619,15 +1619,15 @@ INT i_APCI1710_ReadChronoValue(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_ConvertChronoValue(struct 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_APCI1710_ConvertChronoValue(struct comedi_device * dev, + unsigned char b_ModulNbr, + unsigned int ul_ChronoValue, + unsigned int * pul_Hour, + unsigned char * pb_Minute, + unsigned char * pb_Second, + unsigned int * pui_MilliSecond, unsigned int * pui_MicroSecond, unsigned int * pui_NanoSecond) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; double d_Hour; double d_Minute; double d_Second; @@ -1681,7 +1681,7 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev, /**********************/ d_Hour = d_Hour / (double)60.0; - *pul_Hour = (ULONG) d_Hour; + *pul_Hour = (unsigned int) d_Hour; /************************/ /* Calculate the minute */ @@ -1689,7 +1689,7 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev, d_Minute = d_Hour - *pul_Hour; d_Minute = d_Minute * 60; - *pb_Minute = (BYTE) d_Minute; + *pb_Minute = (unsigned char) d_Minute; /************************/ /* Calculate the second */ @@ -1697,7 +1697,7 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev, d_Second = d_Minute - *pb_Minute; d_Second = d_Second * 60; - *pb_Second = (BYTE) d_Second; + *pb_Second = (unsigned char) d_Second; /*****************************/ /* Calculate the mini second */ @@ -1705,7 +1705,7 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev, d_MilliSecond = d_Second - *pb_Second; d_MilliSecond = d_MilliSecond * 1000; - *pui_MilliSecond = (UINT) d_MilliSecond; + *pui_MilliSecond = (unsigned int) d_MilliSecond; /******************************/ /* Calculate the micro second */ @@ -1715,7 +1715,7 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev, d_MilliSecond - *pui_MilliSecond; d_MicroSecond = d_MicroSecond * 1000; - *pui_MicroSecond = (UINT) d_MicroSecond; + *pui_MicroSecond = (unsigned int) d_MicroSecond; /******************************/ /* Calculate the micro second */ @@ -1725,7 +1725,7 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev, d_MicroSecond - *pui_MicroSecond; d_NanoSecond = d_NanoSecond * 1000; - *pui_NanoSecond = (UINT) d_NanoSecond; + *pui_NanoSecond = (unsigned int) d_NanoSecond; break; } @@ -1757,16 +1757,16 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device *dev,struct comedi_subdevice *s, +| Function Name : int i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device *dev,struct comedi_subdevice *s, struct comedi_insn *insn,unsigned int *data) | +----------------------------------------------------------------------------+ | Task : Sets the output witch has been passed with the | | parameter b_Channel. Setting an output means setting an| | output high. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number (0 to 3)| -| BYTE_ b_OutputChannel : Selection from digital output | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3)| +| unsigned char_ b_OutputChannel : Selection from digital output | | CR_CHAN() channel (0 to 2) | | 0 : Channel H | | 1 : Channel A | @@ -1787,19 +1787,19 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_SetChronoChlOff | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_OutputChannel) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_OutputChannel) | +----------------------------------------------------------------------------+ | Task : Resets the output witch has been passed with the | | parameter b_Channel. Resetting an output means setting | | an output low. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 data[0] : Chl ON, Chl OFF , Chl Read , Port Read -| BYTE_ b_ModulNbr CR_AREF : Selected module number (0 to 3)| -| BYTE_ b_OutputChannel CR_CHAN : Selection from digital output | +| unsigned char_ b_ModulNbr CR_AREF : Selected module number (0 to 3)| +| unsigned char_ b_OutputChannel CR_CHAN : Selection from digital output | | channel (0 to 2) | | 0 : Channel H | | 1 : Channel A | @@ -1820,24 +1820,24 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ReadChronoChlValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_InputChannel, | -| PBYTE_ pb_ChannelStatus) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_InputChannel, | +| unsigned char *_ pb_ChannelStatus) | +----------------------------------------------------------------------------+ | Task : Return the status from selected digital input | | (b_InputChannel) 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)| -| BYTE_ b_InputChannel : Selection from digital input | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3)| +| unsigned char_ b_InputChannel : Selection from digital input | | channel (0 to 2) | | CR_CHAN() 0 : Channel E | | 1 : Channel F | | 2 : Channel G | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_ChannelStatus : Digital input channel status.| +| Output Parameters : unsigned char *_ pb_ChannelStatus : Digital input channel status.| | data[0] 0 : Channel is not active | | 1 : Channel is active | +----------------------------------------------------------------------------+ @@ -1854,17 +1854,17 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ReadChronoPortValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| PBYTE_ pb_PortValue) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char *_ pb_PortValue) | +----------------------------------------------------------------------------+ | Task : Return the status from digital inputs port from | | selected (b_ModulNbr) chronometer module. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number (0 to 3)| +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3)| +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_PortValue : Digital inputs port status. +| Output Parameters : unsigned char *_ pb_PortValue : Digital inputs port status. | data[0] +----------------------------------------------------------------------------+ | Return Value : 0: No error | @@ -1876,18 +1876,18 @@ INT i_APCI1710_ConvertChronoValue(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev, +int i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = 0; - BYTE b_ModulNbr, b_OutputChannel, b_InputChannel, b_IOType; - DWORD dw_Status; - PBYTE pb_ChannelStatus; - PBYTE pb_PortValue; + int i_ReturnValue = 0; + unsigned char b_ModulNbr, b_OutputChannel, b_InputChannel, b_IOType; + unsigned int dw_Status; + unsigned char * pb_ChannelStatus; + unsigned char * pb_PortValue; b_ModulNbr = CR_AREF(insn->chanspec); i_ReturnValue = insn->n; - b_IOType = (BYTE) data[0]; + b_IOType = (unsigned char) data[0]; /**************************/ /* Test the module number */ @@ -1915,14 +1915,14 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev, case APCI1710_CHRONO_SET_CHANNELOFF: b_OutputChannel = - (BYTE) CR_CHAN(insn->chanspec); + (unsigned char) CR_CHAN(insn->chanspec); 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)) + } /* if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2)) */ else { /****************************************/ /* The selected digital output is wrong */ @@ -1931,21 +1931,21 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev, DPRINTK("The selected digital output is wrong\n"); i_ReturnValue = -4; - } // if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2)) + } /* if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2)) */ break; case APCI1710_CHRONO_SET_CHANNELON: b_OutputChannel = - (BYTE) CR_CHAN(insn->chanspec); + (unsigned char) CR_CHAN(insn->chanspec); 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)) + } /* if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2)) */ else { /****************************************/ /* The selected digital output is wrong */ @@ -1954,7 +1954,7 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev, DPRINTK("The selected digital output is wrong\n"); i_ReturnValue = -4; - } // if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2)) + } /* if ((b_OutputChannel >= 0) && (b_OutputChannel <= 2)) */ break; @@ -1962,9 +1962,9 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev, /**********************************/ /* Test the digital input channel */ /**********************************/ - pb_ChannelStatus = (PBYTE) & data[0]; + pb_ChannelStatus = (unsigned char *) & data[0]; b_InputChannel = - (BYTE) CR_CHAN(insn->chanspec); + (unsigned char) CR_CHAN(insn->chanspec); if (b_InputChannel <= 2) { @@ -1975,10 +1975,10 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev, (64 * b_ModulNbr)); *pb_ChannelStatus = - (BYTE) (((dw_Status >> + (unsigned char) (((dw_Status >> b_InputChannel) & 1) ^ 1); - } // if ((b_InputChannel >= 0) && (b_InputChannel <= 2)) + } /* if ((b_InputChannel >= 0) && (b_InputChannel <= 2)) */ else { /***************************************/ /* The selected digital input is wrong */ @@ -1986,13 +1986,13 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev, DPRINTK("The selected digital input is wrong\n"); i_ReturnValue = -4; - } // if ((b_InputChannel >= 0) && (b_InputChannel <= 2)) + } /* if ((b_InputChannel >= 0) && (b_InputChannel <= 2)) */ break; case APCI1710_CHRONO_READ_PORT: - pb_PortValue = (PBYTE) & data[0]; + pb_PortValue = (unsigned char *) & data[0]; dw_Status = inl(devpriv->s_BoardInfos. @@ -2000,7 +2000,7 @@ INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device * dev, (64 * b_ModulNbr)); *pb_PortValue = - (BYTE) ((dw_Status & 0x7) ^ 7); + (unsigned char) ((dw_Status & 0x7) ^ 7); break; } } else { diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.h b/drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.h index 26b50cefee5a..16c6aff8859f 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.h +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Chrono.h @@ -35,10 +35,10 @@ /* * CHRONOMETER INISIALISATION FUNCTION */ -INT i_APCI1710_InsnConfigInitChrono(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnConfigInitChrono(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device *dev, +int i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); @@ -46,29 +46,29 @@ INT i_APCI1710_InsnWriteEnableDisableChrono(struct comedi_device *dev, /* * CHRONOMETER READ FUNCTION */ -INT i_APCI1710_InsnReadChrono(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnReadChrono(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_GetChronoProgressStatus(struct comedi_device *dev, - BYTE b_ModulNbr, PBYTE pb_ChronoStatus); +int i_APCI1710_GetChronoProgressStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char * pb_ChronoStatus); -INT i_APCI1710_ReadChronoValue(struct comedi_device *dev, - BYTE b_ModulNbr, - UINT ui_TimeOut, PBYTE pb_ChronoStatus, - PULONG pul_ChronoValue); +int i_APCI1710_ReadChronoValue(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned int ui_TimeOut, unsigned char * pb_ChronoStatus, + unsigned int * pul_ChronoValue); -INT i_APCI1710_ConvertChronoValue(struct 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_APCI1710_ConvertChronoValue(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned int ul_ChronoValue, + unsigned int * pul_Hour, + unsigned char * pb_Minute, + unsigned char * pb_Second, + unsigned int * pui_MilliSecond, unsigned int * pui_MicroSecond, + unsigned int * pui_NanoSecond); /* * CHRONOMETER DIGITAL INPUT OUTPUT FUNCTION */ -INT i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device *dev, +int i_APCI1710_InsnBitsChronoDigitalIO(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Dig_io.c b/drivers/staging/comedi/drivers/addi-data/APCI1710_Dig_io.c index 8be27aedaaf5..a3266ba92846 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Dig_io.c +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Dig_io.c @@ -61,7 +61,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device *dev, | +| Function Name : int i_APCI1710_InsnConfigDigitalIO(struct comedi_device *dev, | | struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)| +----------------------------------------------------------------------------+ | Task : Configure the digital I/O operating mode from selected | @@ -70,14 +70,14 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc | I/O. | +----------------------------------------------------------------------------+ | Input Parameters : | -| BYTE_ b_ModulNbr data[0]: Module number to | +| unsigned char_ b_ModulNbr data[0]: Module number to | | configure (0 to 3) | -| BYTE_ b_ChannelAMode data[1] : Channel A mode selection | +| unsigned char_ b_ChannelAMode data[1] : Channel A mode selection | | 0 : Channel used for digital | | input | | 1 : Channel used for digital | | output | -| BYTE_ b_ChannelBMode data[2] : Channel B mode selection | +| unsigned char_ b_ChannelBMode data[2] : Channel B mode selection | | 0 : Channel used for digital | | input | | 1 : Channel used for digital | @@ -99,19 +99,19 @@ Activates and deactivates the digital output memory. +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1710_InsnConfigDigitalIO(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - 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_ChannelAMode = (BYTE) data[1]; - b_ChannelBMode = (BYTE) data[2]; - b_MemoryOnOff = (BYTE) data[1]; // if memory operation + unsigned char b_ModulNbr, b_ChannelAMode, b_ChannelBMode; + unsigned char b_MemoryOnOff, b_ConfigType; + int i_ReturnValue = 0; + unsigned int dw_WriteConfig = 0; + + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_ConfigType = (unsigned char) data[0]; /* Memory or Init */ + b_ChannelAMode = (unsigned char) data[1]; + b_ChannelBMode = (unsigned char) data[2]; + b_MemoryOnOff = (unsigned char) data[1]; /* if memory operation */ i_ReturnValue = insn->n; /**************************/ @@ -126,7 +126,7 @@ INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device * dev, struct comedi_sub switch (b_ConfigType) { case APCI1710_DIGIO_MEMORYONOFF: - if (b_MemoryOnOff) // If Memory ON + if (b_MemoryOnOff) /* If Memory ON */ { /****************************/ /* Set the output memory on */ @@ -140,7 +140,7 @@ INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device * dev, struct comedi_sub /***************************/ devpriv->s_ModuleInfo[b_ModulNbr]. s_DigitalIOInfo.dw_OutputMemory = 0; - } else // If memory off + } else /* If memory off */ { /*****************************/ /* Set the output memory off */ @@ -197,7 +197,7 @@ INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device * dev, struct comedi_sub /*****************************************/ dw_WriteConfig = - (DWORD) (b_ChannelAMode | + (unsigned int) (b_ChannelAMode | (b_ChannelBMode * 2)); /***************************/ @@ -233,7 +233,7 @@ INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device * dev, struct comedi_sub 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; } @@ -257,9 +257,9 @@ INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device * dev, struct comedi_sub | -| BYTE_ b_ModulNbr CR_AREF(chanspec) : Selected module number | +| unsigned char_ b_ModulNbr CR_AREF(chanspec) : Selected module number | | (0 to 3) | -| BYTE_ b_InputChannel CR_CHAN(chanspec) : Selection from digital | +| unsigned char_ b_InputChannel CR_CHAN(chanspec) : Selection from digital | | input ( 0 to 6) | | 0 : Channel C | | 1 : Channel D | @@ -288,22 +288,22 @@ INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device * dev, struct comedi_sub +----------------------------------------------------------------------------+ */ -//_INT_ i_APCI1710_ReadDigitalIOChlValue (BYTE_ b_BoardHandle, -// BYTE_ b_ModulNbr, -// BYTE_ b_InputChannel, -// -// PBYTE_ pb_ChannelStatus) -INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev, +/* _INT_ i_APCI1710_ReadDigitalIOChlValue (unsigned char_ b_BoardHandle, */ +/* +* unsigned char_ b_ModulNbr, unsigned char_ b_InputChannel, +* unsigned char *_ pb_ChannelStatus) +*/ +int i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = 0; - DWORD dw_StatusReg; - BYTE b_ModulNbr, b_InputChannel; - PBYTE pb_ChannelStatus; - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_InputChannel = (BYTE) CR_CHAN(insn->chanspec); + int i_ReturnValue = 0; + unsigned int dw_StatusReg; + unsigned char b_ModulNbr, b_InputChannel; + unsigned char * pb_ChannelStatus; + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_InputChannel = (unsigned char) CR_CHAN(insn->chanspec); data[0] = 0; - pb_ChannelStatus = (PBYTE) & data[0]; + pb_ChannelStatus = (unsigned char *) & data[0]; i_ReturnValue = insn->n; /**************************/ @@ -356,7 +356,7 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev, i_ReturnValue = -6; } - } // if (b_InputChannel == 5) + } /* if (b_InputChannel == 5) */ else { /***************************/ /* Test the channel B mode */ @@ -375,8 +375,8 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev, i_ReturnValue = -7; } - } // if (b_InputChannel == 5) - } // if (b_InputChannel > 4) + } /* if (b_InputChannel == 5) */ + } /* if (b_InputChannel > 4) */ /***********************/ /* Test if error occur */ @@ -387,11 +387,10 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev, /* Read all digital input */ /**************************/ - //INPDW (ps_APCI1710Variable-> - // s_Board [b_BoardHandle]. - // s_BoardInfos. - // ui_Address + (64 * b_ModulNbr), - // &dw_StatusReg); +/* +* INPDW (ps_APCI1710Variable-> s_Board [b_BoardHandle]. +* s_BoardInfos. ui_Address + (64 * b_ModulNbr), &dw_StatusReg); +*/ dw_StatusReg = inl(devpriv-> @@ -400,11 +399,11 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev, (64 * b_ModulNbr)); *pb_ChannelStatus = - (BYTE) ((dw_StatusReg ^ + (unsigned char) ((dw_StatusReg ^ 0x1C) >> b_InputChannel) & 1; - } // if (i_ReturnValue == 0) + } /* if (i_ReturnValue == 0) */ } else { /*******************************/ /* Digital I/O not initialised */ @@ -445,7 +444,7 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI1710_InsnWriteDigitalIOChlOnOff(comedi_device +| Function Name : int i_APCI1710_InsnWriteDigitalIOChlOnOff(comedi_device |*dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data) +----------------------------------------------------------------------------+ @@ -453,9 +452,9 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev, | parameter b_Channel. Setting an output means setting | | an ouput high. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr (aref ) : Selected module number (0 to 3)| -| BYTE_ b_OutputChannel (CR_CHAN) : Selection from digital output | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr (aref ) : Selected module number (0 to 3)| +| unsigned char_ b_OutputChannel (CR_CHAN) : Selection from digital output | | channel (0 to 2) | | 0 : Channel H | | 1 : Channel A | @@ -478,15 +477,16 @@ INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -//_INT_ i_APCI1710_SetDigitalIOChlOn (BYTE_ b_BoardHandle, -// BYTE_ b_ModulNbr, -// BYTE_ b_OutputChannel) -INT i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device * dev, +/* +* _INT_ i_APCI1710_SetDigitalIOChlOn (unsigned char_ b_BoardHandle, +* unsigned char_ b_ModulNbr, unsigned char_ b_OutputChannel) +*/ +int i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = 0; - DWORD dw_WriteValue = 0; - BYTE b_ModulNbr, b_OutputChannel; + int i_ReturnValue = 0; + unsigned int dw_WriteValue = 0; + unsigned char b_ModulNbr, b_OutputChannel; i_ReturnValue = insn->n; b_ModulNbr = CR_AREF(insn->chanspec); b_OutputChannel = CR_CHAN(insn->chanspec); @@ -602,7 +602,7 @@ INT i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device * dev, 1 << b_OutputChannel; } - } // set channel off + } /* set channel off */ else { if (devpriv-> s_ModuleInfo @@ -627,23 +627,24 @@ INT i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device * dev, dw_OutputMemory = dw_WriteValue; } else { - /*****************************/ + /*****************************/ /* Digital Output Memory OFF */ - /*****************************/ - // +Use previously the function "i_APCI1710_SetDigitalIOMemoryOn" + /*****************************/ + /* +Use previously the function "i_APCI1710_SetDigitalIOMemoryOn" */ i_ReturnValue = -8; } } - /*******************/ + /*******************/ /* Write the value */ - /*******************/ + /*******************/ - //OUTPDW (ps_APCI1710Variable-> - // s_Board [b_BoardHandle]. - // s_BoardInfos. - // ui_Address + (64 * b_ModulNbr), - // dw_WriteValue); + /* OUTPDW (ps_APCI1710Variable-> + * s_Board [b_BoardHandle]. + * s_BoardInfos. ui_Address + (64 * b_ModulNbr), + * dw_WriteValue); + */ +*/ outl(dw_WriteValue, devpriv->s_BoardInfos. ui_Address + (64 * b_ModulNbr)); @@ -690,9 +691,9 @@ INT i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device * dev, | from selected digital I/O module (b_ModulNbr) +----------------------------------------------------------------------------+ | Input Parameters : - BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr CR_AREF(aref) : Selected module number (0 to 3)| -| BYTE_ b_PortValue CR_CHAN(chanspec) : Output Value ( 0 To 7 ) + unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr CR_AREF(aref) : Selected module number (0 to 3)| +| unsigned char_ b_PortValue CR_CHAN(chanspec) : Output Value ( 0 To 7 ) | data[0] read or write port data[1] if write then indicate ON or OFF @@ -725,75 +726,78 @@ INT i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -//_INT_ i_APCI1710_SetDigitalIOPortOn (BYTE_ b_BoardHandle, -// BYTE_ b_ModulNbr, -// BYTE_ b_PortValue) -INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev, +/* + * _INT_ i_APCI1710_SetDigitalIOPortOn (unsigned char_ + * b_BoardHandle, unsigned char_ b_ModulNbr, unsigned char_ + * b_PortValue) +*/ +int i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = 0; - 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_PortValue = (BYTE) data[2]; // if out put then Value + int i_ReturnValue = 0; + unsigned int dw_WriteValue = 0; + unsigned int dw_StatusReg; + unsigned char b_ModulNbr, b_PortValue; + unsigned char b_PortOperation, b_PortOnOFF; + + unsigned char * pb_PortValue; + + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_PortOperation = (unsigned char) data[0]; /* Input or output */ + b_PortOnOFF = (unsigned char) data[1]; /* if output then On or Off */ + b_PortValue = (unsigned char) data[2]; /* if out put then Value */ i_ReturnValue = insn->n; - pb_PortValue = (PBYTE) & data[0]; -// if input then read value + pb_PortValue = (unsigned char *) & data[0]; +/* if input then read value */ switch (b_PortOperation) { case APCI1710_INPUT: - /**************************/ + /**************************/ /* Test the module number */ - /**************************/ + /**************************/ if (b_ModulNbr < 4) { - /*******************************/ + /*******************************/ /* Test if digital I/O counter */ - /*******************************/ + /*******************************/ if ((devpriv->s_BoardInfos. dw_MolduleConfiguration[b_ModulNbr] & 0xFFFF0000UL) == APCI1710_DIGITAL_IO) { - /**********************************************/ + /**********************************************/ /* Test if the digital I/O module initialised */ - /**********************************************/ + /**********************************************/ if (devpriv->s_ModuleInfo[b_ModulNbr]. s_DigitalIOInfo.b_DigitalInit == 1) { - /**************************/ + /**************************/ /* Read all digital input */ - /**************************/ + /**************************/ - //INPDW (ps_APCI1710Variable-> - // s_Board [b_BoardHandle]. - // s_BoardInfos. - // ui_Address + (64 * b_ModulNbr), - // &dw_StatusReg); + /* INPDW (ps_APCI1710Variable-> + * s_Board [b_BoardHandle]. + * s_BoardInfos. + * ui_Address + (64 * b_ModulNbr), + * &dw_StatusReg); + */ dw_StatusReg = inl(devpriv->s_BoardInfos. ui_Address + (64 * b_ModulNbr)); *pb_PortValue = - (BYTE) (dw_StatusReg ^ 0x1C); + (unsigned char) (dw_StatusReg ^ 0x1C); } else { - /*******************************/ + /*******************************/ /* Digital I/O not initialised */ - /*******************************/ + /*******************************/ i_ReturnValue = -4; } } else { - /******************************************/ + /******************************************/ /* The module is not a digital I/O module */ - /******************************************/ + /******************************************/ i_ReturnValue = -3; } @@ -853,11 +857,11 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev, i_ReturnValue = -6; } - } // if ((b_PortValue & 2) == 2) + } /* if ((b_PortValue & 2) == 2) */ - /**************************/ + /**************************/ /* Test if channel B used */ - /**************************/ + /**************************/ if ((b_PortValue & 4) == 4) { if (devpriv-> @@ -866,33 +870,33 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev, s_DigitalIOInfo. b_ChannelBMode != 1) { - /*******************************************/ + /*******************************************/ /* The digital channel B is used for input */ - /*******************************************/ + /*******************************************/ i_ReturnValue = -7; } - } // if ((b_PortValue & 4) == 4) + } /* if ((b_PortValue & 4) == 4) */ - /***********************/ + /***********************/ /* Test if error occur */ - /***********************/ + /***********************/ if (i_ReturnValue >= 0) { - //if(data[1]) - //{ + /* if(data[1]) { */ + switch (b_PortOnOFF) { - /*********************************/ + /*********************************/ /* Test if set Port ON */ - /*********************************/ + /*********************************/ case APCI1710_ON: - /*********************************/ + /*********************************/ /* Test if output memory enabled */ - /*********************************/ + /*********************************/ if (devpriv-> s_ModuleInfo @@ -924,7 +928,7 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev, } break; - // If Set PORT OFF + /* If Set PORT OFF */ case APCI1710_OFF: /*********************************/ @@ -957,25 +961,26 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev, = dw_WriteValue; } else { - /*****************************/ + /*****************************/ /* Digital Output Memory OFF */ - /*****************************/ + /*****************************/ i_ReturnValue = -8; } - } // switch + } /* switch */ - /*******************/ + /*******************/ /* Write the value */ - /*******************/ + /*******************/ + + /* OUTPDW (ps_APCI1710Variable-> + * s_Board [b_BoardHandle]. + * s_BoardInfos. + * ui_Address + (64 * b_ModulNbr), + * dw_WriteValue); */ - // OUTPDW (ps_APCI1710Variable-> - // s_Board [b_BoardHandle]. - // s_BoardInfos. - // ui_Address + (64 * b_ModulNbr), - // dw_WriteValue); outl(dw_WriteValue, devpriv-> s_BoardInfos. @@ -983,16 +988,16 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev, (64 * b_ModulNbr)); } } else { - /**********************/ + /**********************/ /* Output value wrong */ - /**********************/ + /**********************/ i_ReturnValue = -4; } } else { - /*******************************/ + /*******************************/ /* Digital I/O not initialised */ - /*******************************/ + /*******************************/ i_ReturnValue = -5; } @@ -1015,6 +1020,6 @@ INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device * dev, default: i_ReturnValue = -9; DPRINTK("NO INPUT/OUTPUT specified\n"); - } //switch INPUT / OUTPUT + } /* switch INPUT / OUTPUT */ return (i_ReturnValue); } diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Dig_io.h b/drivers/staging/comedi/drivers/addi-data/APCI1710_Dig_io.h index 5ef157a55ca1..af1b9cdecfb3 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Dig_io.h +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Dig_io.h @@ -27,20 +27,20 @@ /* * DIGITAL I/O INISIALISATION FUNCTION */ -INT i_APCI1710_InsnConfigDigitalIO(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnConfigDigitalIO(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); /* * INPUT OUTPUT FUNCTIONS */ -INT i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device *dev, +int i_APCI1710_InsnReadDigitalIOChlValue(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device *dev, +int i_APCI1710_InsnWriteDigitalIOChlOnOff(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device *dev, +int i_APCI1710_InsnBitsDigitalIOPortOnOff(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.c b/drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.c index 1062f2fdec30..821edbae3f27 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.c +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.c @@ -61,7 +61,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc /* +----------------------------------------------------------------------------+ -| INT i_APCI1710_InsnConfigINCCPT(struct comedi_device *dev,struct comedi_subdevice *s, +| int i_APCI1710_InsnConfigINCCPT(struct comedi_device *dev,struct comedi_subdevice *s, struct comedi_insn *insn,unsigned int *data) +----------------------------------------------------------------------------+ @@ -75,58 +75,58 @@ struct comedi_insn *insn,unsigned int *data) +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnConfigINCCPT(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1710_InsnConfigINCCPT(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_ConfigType; - INT i_ReturnValue = 0; + unsigned int ui_ConfigType; + int i_ReturnValue = 0; ui_ConfigType = CR_CHAN(insn->chanspec); printk("\nINC_CPT"); - devpriv->tsk_Current = current; // Save the current process task structure + devpriv->tsk_Current = current; /* Save the current process task structure */ switch (ui_ConfigType) { case APCI1710_INCCPT_INITCOUNTER: i_ReturnValue = i_APCI1710_InitCounter(dev, CR_AREF(insn->chanspec), - (BYTE) data[0], - (BYTE) data[1], - (BYTE) data[2], (BYTE) data[3], (BYTE) data[4]); + (unsigned char) data[0], + (unsigned char) data[1], + (unsigned char) data[2], (unsigned char) data[3], (unsigned char) data[4]); break; case APCI1710_INCCPT_COUNTERAUTOTEST: i_ReturnValue = i_APCI1710_CounterAutoTest(dev, - (PBYTE) & data[0]); + (unsigned char *) & data[0]); break; case APCI1710_INCCPT_INITINDEX: i_ReturnValue = i_APCI1710_InitIndex(dev, CR_AREF(insn->chanspec), - (BYTE) data[0], - (BYTE) data[1], (BYTE) data[2], (BYTE) data[3]); + (unsigned char) data[0], + (unsigned char) data[1], (unsigned char) data[2], (unsigned char) data[3]); break; case APCI1710_INCCPT_INITREFERENCE: i_ReturnValue = i_APCI1710_InitReference(dev, - CR_AREF(insn->chanspec), (BYTE) data[0]); + CR_AREF(insn->chanspec), (unsigned char) data[0]); break; case APCI1710_INCCPT_INITEXTERNALSTROBE: i_ReturnValue = i_APCI1710_InitExternalStrobe(dev, CR_AREF(insn->chanspec), - (BYTE) data[0], (BYTE) data[1]); + (unsigned char) data[0], (unsigned char) data[1]); break; case APCI1710_INCCPT_INITCOMPARELOGIC: i_ReturnValue = i_APCI1710_InitCompareLogic(dev, - CR_AREF(insn->chanspec), (UINT) data[0]); + CR_AREF(insn->chanspec), (unsigned int) data[0]); break; case APCI1710_INCCPT_INITFREQUENCYMEASUREMENT: i_ReturnValue = i_APCI1710_InitFrequencyMeasurement(dev, CR_AREF(insn->chanspec), - (BYTE) data[0], - (BYTE) data[1], (ULONG) data[2], (PULONG) & data[0]); + (unsigned char) data[0], + (unsigned char) data[1], (unsigned int) data[2], (unsigned int *) & data[0]); break; default: @@ -142,13 +142,13 @@ INT i_APCI1710_InsnConfigINCCPT(struct comedi_device * dev, struct comedi_subdev /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_InitCounter | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_CounterRange, | -| BYTE_ b_FirstCounterModus, | -| BYTE_ b_FirstCounterOption, | -| BYTE_ b_SecondCounterModus, | -| BYTE_ b_SecondCounterOption) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_CounterRange, | +| unsigned char_ b_FirstCounterModus, | +| unsigned char_ b_FirstCounterOption, | +| unsigned char_ b_SecondCounterModus, | +| unsigned char_ b_SecondCounterOption) | +----------------------------------------------------------------------------+ | Task : Configure the counter operating mode from selected | | module (b_ModulNbr). You must calling this function be | @@ -273,17 +273,17 @@ INT i_APCI1710_InsnConfigINCCPT(struct comedi_device * dev, struct comedi_subdev | +----------------------+--------------------+----------------------------+ | | | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710| -| BYTE_ b_ModulNbr : Module number to | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710| +| unsigned char_ b_ModulNbr : Module number to | | configure (0 to 3) | -| BYTE_ b_CounterRange : Selection form counter | +| unsigned char_ b_CounterRange : Selection form counter | | range. | -| BYTE_ b_FirstCounterModus : First counter operating | +| unsigned char_ b_FirstCounterModus : First counter operating | | mode. | -| BYTE_ b_FirstCounterOption : First counter option. | -| BYTE_ b_SecondCounterModus : Second counter operating | +| unsigned char_ b_FirstCounterOption : First counter option. | +| unsigned char_ b_SecondCounterModus : Second counter operating | | mode. | -| BYTE_ b_SecondCounterOption : Second counter option. | +| unsigned char_ b_SecondCounterOption : Second counter option. | +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -299,14 +299,14 @@ INT i_APCI1710_InsnConfigINCCPT(struct comedi_device * dev, struct comedi_subdev +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InitCounter(struct comedi_device * dev, - BYTE b_ModulNbr, - BYTE b_CounterRange, - BYTE b_FirstCounterModus, - BYTE b_FirstCounterOption, - BYTE b_SecondCounterModus, BYTE b_SecondCounterOption) +int i_APCI1710_InitCounter(struct comedi_device * dev, + unsigned char b_ModulNbr, + unsigned char b_CounterRange, + unsigned char b_FirstCounterModus, + unsigned char b_FirstCounterOption, + unsigned char b_SecondCounterModus, unsigned char b_SecondCounterOption) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /*******************************/ /* Test if incremental counter */ @@ -508,8 +508,8 @@ INT i_APCI1710_InitCounter(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_CounterAutoTest | -| (BYTE_ b_BoardHandle, | -| PBYTE_ pb_TestStatus) | +| (unsigned char_ b_BoardHandle, | +| unsigned char *_ pb_TestStatus) | +----------------------------------------------------------------------------+ | Task : A test mode is intended for testing the component and | | the connected periphery. All the 8-bit counter chains | @@ -535,9 +535,9 @@ INT i_APCI1710_InitCounter(struct comedi_device * dev, | | 1000 | Error detected of counter 3 | | | +-----------------+-----------------------------+ | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_TestStatus : Auto test conclusion. See table| +| Output Parameters : unsigned char *_ pb_TestStatus : Auto test conclusion. See table| +----------------------------------------------------------------------------+ | Return Value : 0: No error | | -1: The handle parameter of the board is wrong | @@ -545,11 +545,11 @@ INT i_APCI1710_InitCounter(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_CounterAutoTest(struct comedi_device * dev, PBYTE pb_TestStatus) +int i_APCI1710_CounterAutoTest(struct comedi_device * dev, unsigned char * pb_TestStatus) { - BYTE b_ModulCpt = 0; - INT i_ReturnValue = 0; - DWORD dw_LathchValue; + unsigned char b_ModulCpt = 0; + int i_ReturnValue = 0; + unsigned int dw_LathchValue; *pb_TestStatus = 0; @@ -632,12 +632,12 @@ INT i_APCI1710_CounterAutoTest(struct comedi_device * dev, PBYTE pb_TestStatus) /* +----------------------------------------------------------------------------+ -| Function Name : _INT_ i_APCI1710_InitIndex (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_ReferenceAction, | -| BYTE_ b_IndexOperation, | -| BYTE_ b_AutoMode, | -| BYTE_ b_InterruptEnable) | +| Function Name : _INT_ i_APCI1710_InitIndex (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_ReferenceAction, | +| unsigned char_ b_IndexOperation, | +| unsigned char_ b_AutoMode, | +| unsigned char_ b_InterruptEnable) | +----------------------------------------------------------------------------+ | Task : Initialise the index corresponding to the selected | | module (b_ModulNbr). If a INDEX flag occur, you have | @@ -665,10 +665,10 @@ INT i_APCI1710_CounterAutoTest(struct comedi_device * dev, PBYTE pb_TestStatus) | | | value is cleared (32-Bit) | | | +------------------------+------------------------------------+ | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | -| BYTE_ b_ReferenceAction : Determine if the reference | +| unsigned char_ b_ReferenceAction : Determine if the reference | | must set or no for the | | acceptance from index | | APCI1710_ENABLE : | @@ -677,15 +677,15 @@ INT i_APCI1710_CounterAutoTest(struct comedi_device * dev, PBYTE pb_TestStatus) | APCI1710_DISABLE : | | Reference have not | | importance | -| BYTE_ b_IndexOperation : Index operating mode. | +| unsigned char_ b_IndexOperation : Index operating mode. | | See table. | -| BYTE_ b_AutoMode : Enable or disable the | +| unsigned char_ b_AutoMode : Enable or disable the | | automatic index reset. | | APCI1710_ENABLE : | | Enable the automatic mode | | APCI1710_DISABLE : | | Disable the automatic mode | -| BYTE_ b_InterruptEnable : Enable or disable the | +| unsigned char_ b_InterruptEnable : Enable or disable the | | interrupt. | | APCI1710_ENABLE : | | Enable the interrupt | @@ -708,12 +708,12 @@ INT i_APCI1710_CounterAutoTest(struct comedi_device * dev, PBYTE pb_TestStatus) +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InitIndex(struct comedi_device * dev, - BYTE b_ModulNbr, - BYTE b_ReferenceAction, - BYTE b_IndexOperation, BYTE b_AutoMode, BYTE b_InterruptEnable) +int i_APCI1710_InitIndex(struct comedi_device * dev, + unsigned char b_ModulNbr, + unsigned char b_ReferenceAction, + unsigned char b_IndexOperation, unsigned char b_AutoMode, unsigned char b_InterruptEnable) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -902,7 +902,7 @@ INT i_APCI1710_InitIndex(struct comedi_device * dev, b_ModeRegister4 | APCI1710_ENABLE_LATCH_AND_CLEAR; - } // if (b_IndexOperation == APCI1710_HIGH_EDGE_LATCH_AND_CLEAR_COUNTER || b_IndexOperation == APCI1710_LOW_EDGE_LATCH_AND_CLEAR_COUNTER) + } /* if (b_IndexOperation == APCI1710_HIGH_EDGE_LATCH_AND_CLEAR_COUNTER || b_IndexOperation == APCI1710_LOW_EDGE_LATCH_AND_CLEAR_COUNTER) */ else { /*****************************************/ /* Clear the latch and clear flag (DQ27) */ @@ -975,7 +975,7 @@ INT i_APCI1710_InitIndex(struct comedi_device * dev, & (~APCI1710_INDEX_LATCH_COUNTER); } - } // // if (b_IndexOperation == APCI1710_HIGH_EDGE_LATCH_AND_CLEAR_COUNTER || b_IndexOperation == APCI1710_LOW_EDGE_LATCH_AND_CLEAR_COUNTER) + } /* // if (b_IndexOperation == APCI1710_HIGH_EDGE_LATCH_AND_CLEAR_COUNTER || b_IndexOperation == APCI1710_LOW_EDGE_LATCH_AND_CLEAR_COUNTER) */ if (b_AutoMode == APCI1710_DISABLE) @@ -1119,9 +1119,9 @@ INT i_APCI1710_InitIndex(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_InitReference | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_ReferenceLevel) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_ReferenceLevel) | +----------------------------------------------------------------------------+ | Task : Initialise the reference corresponding to the selected | | module (b_ModulNbr). | @@ -1136,10 +1136,10 @@ INT i_APCI1710_InitIndex(struct comedi_device * dev, | | APCI1710_HIGH | Reference occur if "1" | | | +--------------------+-------------------------+ | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | -| BYTE_ b_ReferenceLevel : Reference level. | +| unsigned char_ b_ReferenceLevel : Reference level. | +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -1152,10 +1152,10 @@ INT i_APCI1710_InitIndex(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InitReference(struct comedi_device * dev, - BYTE b_ModulNbr, BYTE b_ReferenceLevel) +int i_APCI1710_InitReference(struct comedi_device * dev, + unsigned char b_ModulNbr, unsigned char b_ReferenceLevel) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -1245,21 +1245,21 @@ INT i_APCI1710_InitReference(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_InitExternalStrobe | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_ExternalStrobe, | -| BYTE_ b_ExternalStrobeLevel) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_ExternalStrobe, | +| unsigned char_ b_ExternalStrobeLevel) | +----------------------------------------------------------------------------+ | Task : Initialises the external strobe level corresponding to | | the selected module (b_ModulNbr). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | -| BYTE_ b_ExternalStrobe : External strobe selection | +| unsigned char_ b_ExternalStrobe : External strobe selection | | 0 : External strobe A | | 1 : External strobe B | -| BYTE_ b_ExternalStrobeLevel : External strobe level | +| unsigned char_ b_ExternalStrobeLevel : External strobe level | | APCI1710_LOW : | | External latch occurs if "0" | | APCI1710_HIGH : | @@ -1277,10 +1277,10 @@ INT i_APCI1710_InitReference(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InitExternalStrobe(struct comedi_device * dev, - BYTE b_ModulNbr, BYTE b_ExternalStrobe, BYTE b_ExternalStrobeLevel) +int i_APCI1710_InitExternalStrobe(struct comedi_device * dev, + unsigned char b_ModulNbr, unsigned char b_ExternalStrobe, unsigned char b_ExternalStrobeLevel) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -1335,7 +1335,7 @@ INT i_APCI1710_InitExternalStrobe(struct comedi_device * dev, DPRINTK("External strobe level parameter is wrong\n"); i_ReturnValue = -5; } - } // if (b_ExternalStrobe == 0 || b_ExternalStrobe == 1) + } /* if (b_ExternalStrobe == 0 || b_ExternalStrobe == 1) */ else { /**************************************/ /* External strobe selection is wrong */ @@ -1343,7 +1343,7 @@ INT i_APCI1710_InitExternalStrobe(struct comedi_device * dev, DPRINTK("External strobe selection is wrong\n"); i_ReturnValue = -4; - } // if (b_ExternalStrobe == 0 || b_ExternalStrobe == 1) + } /* if (b_ExternalStrobe == 0 || b_ExternalStrobe == 1) */ } else { /****************************************/ /* Counter not initialised see function */ @@ -1368,18 +1368,18 @@ INT i_APCI1710_InitExternalStrobe(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_InitCompareLogic | - | (BYTE_ b_BoardHandle, | - | BYTE_ b_ModulNbr, | - | UINT_ ui_CompareValue) | + | (unsigned char_ b_BoardHandle, | + | unsigned char_ b_ModulNbr, | + | unsigned int_ ui_CompareValue) | +----------------------------------------------------------------------------+ | Task : Set the 32-Bit compare value. At that moment that the | | incremental counter arrive to the compare value | | (ui_CompareValue) a interrupt is generated. | +----------------------------------------------------------------------------+ - | Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | - | BYTE_ b_ModulNbr : Module number to configure | + | Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | + | unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | - | UINT_ ui_CompareValue : 32-Bit compare value | + | unsigned int_ ui_CompareValue : 32-Bit compare value | +----------------------------------------------------------------------------+ | Output Parameters : - +----------------------------------------------------------------------------+ @@ -1391,10 +1391,10 @@ INT i_APCI1710_InitExternalStrobe(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InitCompareLogic(struct comedi_device * dev, - BYTE b_ModulNbr, UINT ui_CompareValue) +int i_APCI1710_InitCompareLogic(struct comedi_device * dev, + unsigned char b_ModulNbr, unsigned int ui_CompareValue) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -1440,10 +1440,10 @@ INT i_APCI1710_InitCompareLogic(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_InitFrequencyMeasurement | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_PCIInputClock, | -| BYTE_ b_TimingUnity, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_PCIInputClock, | +| unsigned char_ b_TimingUnity, | | ULONG_ ul_TimingInterval, | | PULONG_ pul_RealTimingInterval) | +----------------------------------------------------------------------------+ @@ -1456,10 +1456,10 @@ INT i_APCI1710_InitCompareLogic(struct comedi_device * dev, | you call up any other function which gives access to | | the frequency measurement. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Number of the module to be | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Number of the module to be | | configured (0 to 3) | -| BYTE_ b_PCIInputClock : Selection of the PCI bus | +| unsigned char_ b_PCIInputClock : Selection of the PCI bus | | clock | | - APCI1710_30MHZ : | | The PC has a PCI bus clock | @@ -1467,7 +1467,7 @@ INT i_APCI1710_InitCompareLogic(struct comedi_device * dev, | - APCI1710_33MHZ : | | The PC has a PCI bus clock | | of 33 MHz | -| BYTE_ b_TimingUnity : Base time unit (0 to 2) | +| unsigned char_ b_TimingUnity : Base time unit (0 to 2) | | 0 : ns | | 1 : æs | | 2 : ms | @@ -1487,16 +1487,16 @@ INT i_APCI1710_InitCompareLogic(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev, - BYTE b_ModulNbr, - BYTE b_PCIInputClock, - BYTE b_TimingUnity, - ULONG ul_TimingInterval, PULONG pul_RealTimingInterval) +int i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev, + unsigned char b_ModulNbr, + unsigned char b_PCIInputClock, + unsigned char b_TimingUnity, + unsigned int ul_TimingInterval, unsigned int * pul_RealTimingInterval) { - INT i_ReturnValue = 0; - ULONG ul_TimerValue = 0; + int i_ReturnValue = 0; + unsigned int ul_TimerValue = 0; double d_RealTimingInterval; - DWORD dw_Status = 0; + unsigned int dw_Status = 0; /**************************/ /* Test the module number */ @@ -1637,7 +1637,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev, i_ReturnValue = -7; } - } // if (b_PCIInputClock == APCI1710_40MHZ) + } /* if (b_PCIInputClock == APCI1710_40MHZ) */ /***************************/ /* Test if not error occur */ @@ -1676,7 +1676,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev, b_ModeRegister4 | APCI1710_ENABLE_40MHZ_FREQUENCY; - } // if (b_PCIInputClock == APCI1710_40MHZ) + } /* if (b_PCIInputClock == APCI1710_40MHZ) */ else { /**********************************/ /* Disable the 40MHz quarz (DQ30) */ @@ -1700,7 +1700,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev, & APCI1710_DISABLE_40MHZ_FREQUENCY; - } // if (b_PCIInputClock == APCI1710_40MHZ) + } /* if (b_PCIInputClock == APCI1710_40MHZ) */ /********************************/ /* Calculate the division fator */ @@ -1720,7 +1720,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev, ul_TimerValue = - (ULONG) + (unsigned int) (ul_TimingInterval * (0.00025 * b_PCIInputClock)); @@ -1743,7 +1743,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev, *pul_RealTimingInterval = - (ULONG) + (unsigned int) (ul_TimerValue / (0.00025 * (double)b_PCIInputClock)); @@ -1790,7 +1790,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev, ul_TimerValue = - (ULONG) + (unsigned int) (ul_TimingInterval * (0.25 * b_PCIInputClock)); @@ -1813,7 +1813,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev, *pul_RealTimingInterval = - (ULONG) + (unsigned int) (ul_TimerValue / (0.25 * (double)b_PCIInputClock)); @@ -1886,7 +1886,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev, *pul_RealTimingInterval = - (ULONG) + (unsigned int) (ul_TimerValue / (250.0 * (double)b_PCIInputClock)); @@ -1949,7 +1949,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev, i_ReturnValue = -3; } - } // if (i_ReturnValue == 0) + } /* if (i_ReturnValue == 0) */ } else { /**********************************/ /* Base timing selection is wrong */ @@ -1997,7 +1997,7 @@ INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device * dev, /*########################################################################### */ - //INSN BITS + /* INSN BITS */ /*########################################################################### */ /* @@ -2015,18 +2015,18 @@ struct comedi_insn *insn,unsigned int *data) | +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnBitsINCCPT(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1710_InsnBitsINCCPT(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_BitsType; - INT i_ReturnValue = 0; + unsigned int 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) { case APCI1710_INCCPT_CLEARCOUNTERVALUE: i_ReturnValue = i_APCI1710_ClearCounterValue(dev, - (BYTE) CR_AREF(insn->chanspec)); + (unsigned char) CR_AREF(insn->chanspec)); break; case APCI1710_INCCPT_CLEARALLCOUNTERVALUE: @@ -2035,28 +2035,28 @@ INT i_APCI1710_InsnBitsINCCPT(struct comedi_device * dev, struct comedi_subdevic case APCI1710_INCCPT_SETINPUTFILTER: i_ReturnValue = i_APCI1710_SetInputFilter(dev, - (BYTE) CR_AREF(insn->chanspec), - (BYTE) data[0], (BYTE) data[1]); + (unsigned char) CR_AREF(insn->chanspec), + (unsigned char) data[0], (unsigned char) data[1]); break; case APCI1710_INCCPT_LATCHCOUNTER: i_ReturnValue = i_APCI1710_LatchCounter(dev, - (BYTE) CR_AREF(insn->chanspec), (BYTE) data[0]); + (unsigned char) CR_AREF(insn->chanspec), (unsigned char) data[0]); break; case APCI1710_INCCPT_SETINDEXANDREFERENCESOURCE: i_ReturnValue = i_APCI1710_SetIndexAndReferenceSource(dev, - (BYTE) CR_AREF(insn->chanspec), (BYTE) data[0]); + (unsigned char) CR_AREF(insn->chanspec), (unsigned char) data[0]); break; case APCI1710_INCCPT_SETDIGITALCHLON: i_ReturnValue = i_APCI1710_SetDigitalChlOn(dev, - (BYTE) CR_AREF(insn->chanspec)); + (unsigned char) CR_AREF(insn->chanspec)); break; case APCI1710_INCCPT_SETDIGITALCHLOFF: i_ReturnValue = i_APCI1710_SetDigitalChlOff(dev, - (BYTE) CR_AREF(insn->chanspec)); + (unsigned char) CR_AREF(insn->chanspec)); break; default: @@ -2071,14 +2071,14 @@ INT i_APCI1710_InsnBitsINCCPT(struct comedi_device * dev, struct comedi_subdevic /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ClearCounterValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr) | +----------------------------------------------------------------------------+ | Task : Clear the counter value from selected module | | (b_ModulNbr). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -2091,9 +2091,9 @@ INT i_APCI1710_InsnBitsINCCPT(struct comedi_device * dev, struct comedi_subdevic +----------------------------------------------------------------------------+ */ -INT i_APCI1710_ClearCounterValue(struct comedi_device * dev, BYTE b_ModulNbr) +int i_APCI1710_ClearCounterValue(struct comedi_device * dev, unsigned char b_ModulNbr) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -2137,11 +2137,11 @@ INT i_APCI1710_ClearCounterValue(struct comedi_device * dev, BYTE b_ModulNbr) /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ClearAllCounterValue | -| (BYTE_ b_BoardHandle) | +| (unsigned char_ b_BoardHandle) | +----------------------------------------------------------------------------+ | Task : Clear all counter value. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -2151,10 +2151,10 @@ INT i_APCI1710_ClearCounterValue(struct comedi_device * dev, BYTE b_ModulNbr) +----------------------------------------------------------------------------+ */ -INT i_APCI1710_ClearAllCounterValue(struct comedi_device * dev) +int i_APCI1710_ClearAllCounterValue(struct comedi_device * dev) { - BYTE b_ModulCpt = 0; - INT i_ReturnValue = 0; + unsigned char b_ModulCpt = 0; + int i_ReturnValue = 0; /********************************/ /* Test if counter module found */ @@ -2204,18 +2204,18 @@ INT i_APCI1710_ClearAllCounterValue(struct comedi_device * dev) /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_SetInputFilter | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_Module, | -| BYTE_ b_PCIInputClock, | -| BYTE_ b_Filter) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_Module, | +| unsigned char_ b_PCIInputClock, | +| unsigned char_ b_Filter) | +----------------------------------------------------------------------------+ | Task : Disable or enable the software filter from selected | | module (b_ModulNbr). b_Filter determine the filter time| +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Number of the module to be | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Number of the module to be | | configured (0 to 3) | -| BYTE_ b_PCIInputClock : Selection of the PCI bus | +| unsigned char_ b_PCIInputClock : Selection of the PCI bus | | clock | | - APCI1710_30MHZ : | | The PC has a PCI bus clock | @@ -2226,7 +2226,7 @@ INT i_APCI1710_ClearAllCounterValue(struct comedi_device * dev) | - APCI1710_40MHZ : | | The APCI1710 has a 40MHz | | quartz | -| BYTE_ b_Filter : Filter selection | +| unsigned char_ b_Filter : Filter selection | | | | 30 MHz | | ------ | @@ -2297,11 +2297,11 @@ INT i_APCI1710_ClearAllCounterValue(struct comedi_device * dev) +----------------------------------------------------------------------------+ */ -INT i_APCI1710_SetInputFilter(struct comedi_device * dev, - BYTE b_ModulNbr, BYTE b_PCIInputClock, BYTE b_Filter) +int i_APCI1710_SetInputFilter(struct comedi_device * dev, + unsigned char b_ModulNbr, unsigned char b_PCIInputClock, unsigned char b_Filter) { - INT i_ReturnValue = 0; - DWORD dw_Status = 0; + int i_ReturnValue = 0; + unsigned int dw_Status = 0; /**************************/ /* Test the module number */ @@ -2365,7 +2365,7 @@ INT i_APCI1710_SetInputFilter(struct comedi_device * dev, i_ReturnValue = -6; } - } // if (b_PCIInputClock == APCI1710_40MHZ) + } /* if (b_PCIInputClock == APCI1710_40MHZ) */ /***************************/ /* Test if error not occur */ @@ -2401,7 +2401,7 @@ INT i_APCI1710_SetInputFilter(struct comedi_device * dev, | APCI1710_ENABLE_40MHZ_FILTER; - } // if (b_PCIInputClock == APCI1710_40MHZ) + } /* if (b_PCIInputClock == APCI1710_40MHZ) */ else { /**********************************/ /* Disable the 40MHz quarz (DQ31) */ @@ -2425,7 +2425,7 @@ INT i_APCI1710_SetInputFilter(struct comedi_device * dev, & APCI1710_DISABLE_40MHZ_FILTER; - } // if (b_PCIInputClock == APCI1710_40MHZ) + } /* if (b_PCIInputClock == APCI1710_40MHZ) */ /************************/ /* Set the filter value */ @@ -2486,8 +2486,8 @@ INT i_APCI1710_SetInputFilter(struct comedi_device * dev, ui_Address + 20 + (64 * b_ModulNbr)); - } // if (i_ReturnValue == 0) - } // if (b_Filter < 16) + } /* if (i_ReturnValue == 0) */ + } /* if (b_Filter < 16) */ else { /**************************************/ /* The selected filter value is wrong */ @@ -2495,8 +2495,8 @@ INT i_APCI1710_SetInputFilter(struct comedi_device * dev, 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)) + } /* if (b_Filter < 16) */ + } /* if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ) || (b_PCIInputClock == APCI1710_40MHZ)) */ else { /*****************************************/ /* The selected PCI input clock is wrong */ @@ -2504,7 +2504,7 @@ INT i_APCI1710_SetInputFilter(struct comedi_device * dev, 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)) + } /* if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ) || (b_PCIInputClock == APCI1710_40MHZ)) */ } else { /**************************************/ /* The module is not a counter module */ @@ -2535,18 +2535,18 @@ INT i_APCI1710_SetInputFilter(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ -| Function Name : _INT_ i_APCI1710_LatchCounter (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_LatchReg) | +| Function Name : _INT_ i_APCI1710_LatchCounter (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_LatchReg) | +----------------------------------------------------------------------------+ | Task : Latch the courant value from selected module | | (b_ModulNbr) in to the selected latch register | | (b_LatchReg). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | -| BYTE_ b_LatchReg : Selected latch register | +| unsigned char_ b_LatchReg : Selected latch register | | 0 : for the first latch register | | 1 : for the second latch register | +----------------------------------------------------------------------------+ @@ -2561,10 +2561,10 @@ INT i_APCI1710_SetInputFilter(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_LatchCounter(struct comedi_device * dev, - BYTE b_ModulNbr, BYTE b_LatchReg) +int i_APCI1710_LatchCounter(struct comedi_device * dev, + unsigned char b_ModulNbr, unsigned char b_LatchReg) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -2622,19 +2622,19 @@ INT i_APCI1710_LatchCounter(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_SetIndexAndReferenceSource | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_SourceSelection) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_SourceSelection) | +----------------------------------------------------------------------------+ | Task : Determine the hardware source for the index and the | | reference logic. Per default the index logic is | | connected to the difference input C and the reference | | logic is connected to the 24V input E | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | -| BYTE_ b_SourceSelection : APCI1710_SOURCE_0 : | +| unsigned char_ b_SourceSelection : APCI1710_SOURCE_0 : | | The index logic is connected | | to the difference input C and| | the reference logic is | @@ -2658,10 +2658,10 @@ INT i_APCI1710_LatchCounter(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_SetIndexAndReferenceSource(struct comedi_device * dev, - BYTE b_ModulNbr, BYTE b_SourceSelection) +int i_APCI1710_SetIndexAndReferenceSource(struct comedi_device * dev, + unsigned char b_ModulNbr, unsigned char b_SourceSelection) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -2735,7 +2735,7 @@ INT i_APCI1710_SetIndexAndReferenceSource(struct comedi_device * dev, b_ModeRegister4 & APCI1710_DEFAULT_INDEX_RFERENCE; } - } // if (b_SourceSelection == APCI1710_SOURCE_0 ||b_SourceSelection == APCI1710_SOURCE_1) + } /* if (b_SourceSelection == APCI1710_SOURCE_0 ||b_SourceSelection == APCI1710_SOURCE_1) */ else { /*********************************/ /* The source selection is wrong */ @@ -2743,7 +2743,7 @@ INT i_APCI1710_SetIndexAndReferenceSource(struct comedi_device * dev, DPRINTK("The source selection is wrong\n"); i_ReturnValue = -4; - } // if (b_SourceSelection == APCI1710_SOURCE_0 ||b_SourceSelection == APCI1710_SOURCE_1) + } /* if (b_SourceSelection == APCI1710_SOURCE_0 ||b_SourceSelection == APCI1710_SOURCE_1) */ } else { /**************************************/ /* The module is not a counter module */ @@ -2775,14 +2775,14 @@ INT i_APCI1710_SetIndexAndReferenceSource(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_SetDigitalChlOn | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr) | +----------------------------------------------------------------------------+ | Task : Sets the digital output H Setting an output means | | setting an ouput high. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Number of the module to be | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Number of the module to be | | configured (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -2795,9 +2795,9 @@ INT i_APCI1710_SetIndexAndReferenceSource(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_SetDigitalChlOn(struct comedi_device * dev, BYTE b_ModulNbr) +int i_APCI1710_SetDigitalChlOn(struct comedi_device * dev, unsigned char b_ModulNbr) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -2855,14 +2855,14 @@ INT i_APCI1710_SetDigitalChlOn(struct comedi_device * dev, BYTE b_ModulNbr) /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_SetDigitalChlOff | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr) | +----------------------------------------------------------------------------+ | Task : Resets the digital output H. Resetting an output means | | setting an ouput low. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Number of the module to be | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Number of the module to be | | configured (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -2875,9 +2875,9 @@ INT i_APCI1710_SetDigitalChlOn(struct comedi_device * dev, BYTE b_ModulNbr) +----------------------------------------------------------------------------+ */ -INT i_APCI1710_SetDigitalChlOff(struct comedi_device * dev, BYTE b_ModulNbr) +int i_APCI1710_SetDigitalChlOff(struct comedi_device * dev, unsigned char b_ModulNbr) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -2934,7 +2934,7 @@ INT i_APCI1710_SetDigitalChlOff(struct comedi_device * dev, BYTE b_ModulNbr) /*########################################################################### */ - // INSN WRITE + /* INSN WRITE */ /*########################################################################### */ /* @@ -2951,65 +2951,65 @@ struct comedi_insn *insn,unsigned int *data) | | Return Value : +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnWriteINCCPT(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1710_InsnWriteINCCPT(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_WriteType; - INT i_ReturnValue = 0; + unsigned int ui_WriteType; + 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) { case APCI1710_INCCPT_ENABLELATCHINTERRUPT: i_ReturnValue = i_APCI1710_EnableLatchInterrupt(dev, - (BYTE) CR_AREF(insn->chanspec)); + (unsigned char) CR_AREF(insn->chanspec)); break; case APCI1710_INCCPT_DISABLELATCHINTERRUPT: i_ReturnValue = i_APCI1710_DisableLatchInterrupt(dev, - (BYTE) CR_AREF(insn->chanspec)); + (unsigned char) CR_AREF(insn->chanspec)); break; case APCI1710_INCCPT_WRITE16BITCOUNTERVALUE: i_ReturnValue = i_APCI1710_Write16BitCounterValue(dev, - (BYTE) CR_AREF(insn->chanspec), - (BYTE) data[0], (UINT) data[1]); + (unsigned char) CR_AREF(insn->chanspec), + (unsigned char) data[0], (unsigned int) data[1]); break; case APCI1710_INCCPT_WRITE32BITCOUNTERVALUE: i_ReturnValue = i_APCI1710_Write32BitCounterValue(dev, - (BYTE) CR_AREF(insn->chanspec), (ULONG) data[0]); + (unsigned char) CR_AREF(insn->chanspec), (unsigned int) data[0]); break; case APCI1710_INCCPT_ENABLEINDEX: - i_APCI1710_EnableIndex(dev, (BYTE) CR_AREF(insn->chanspec)); + i_APCI1710_EnableIndex(dev, (unsigned char) CR_AREF(insn->chanspec)); break; case APCI1710_INCCPT_DISABLEINDEX: i_ReturnValue = i_APCI1710_DisableIndex(dev, - (BYTE) CR_AREF(insn->chanspec)); + (unsigned char) CR_AREF(insn->chanspec)); break; case APCI1710_INCCPT_ENABLECOMPARELOGIC: i_ReturnValue = i_APCI1710_EnableCompareLogic(dev, - (BYTE) CR_AREF(insn->chanspec)); + (unsigned char) CR_AREF(insn->chanspec)); break; case APCI1710_INCCPT_DISABLECOMPARELOGIC: i_ReturnValue = i_APCI1710_DisableCompareLogic(dev, - (BYTE) CR_AREF(insn->chanspec)); + (unsigned char) CR_AREF(insn->chanspec)); break; case APCI1710_INCCPT_ENABLEFREQUENCYMEASUREMENT: i_ReturnValue = i_APCI1710_EnableFrequencyMeasurement(dev, - (BYTE) CR_AREF(insn->chanspec), (BYTE) data[0]); + (unsigned char) CR_AREF(insn->chanspec), (unsigned char) data[0]); break; case APCI1710_INCCPT_DISABLEFREQUENCYMEASUREMENT: i_ReturnValue = i_APCI1710_DisableFrequencyMeasurement(dev, - (BYTE) CR_AREF(insn->chanspec)); + (unsigned char) CR_AREF(insn->chanspec)); break; default: @@ -3024,15 +3024,15 @@ INT i_APCI1710_InsnWriteINCCPT(struct comedi_device * dev, struct comedi_subdevi /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_EnableLatchInterrupt | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr) | +----------------------------------------------------------------------------+ | Task : Enable the latch interrupt from selected module | | (b_ModulNbr). Each software or hardware latch occur a | | interrupt. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -3047,9 +3047,9 @@ INT i_APCI1710_InsnWriteINCCPT(struct comedi_device * dev, struct comedi_subdevi +----------------------------------------------------------------------------+ */ -INT i_APCI1710_EnableLatchInterrupt(struct comedi_device * dev, BYTE b_ModulNbr) +int i_APCI1710_EnableLatchInterrupt(struct comedi_device * dev, unsigned char b_ModulNbr) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -3111,14 +3111,14 @@ INT i_APCI1710_EnableLatchInterrupt(struct comedi_device * dev, BYTE b_ModulNbr) /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_DisableLatchInterrupt | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr) | +----------------------------------------------------------------------------+ | Task : Disable the latch interrupt from selected module | | (b_ModulNbr). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -3133,9 +3133,9 @@ INT i_APCI1710_EnableLatchInterrupt(struct comedi_device * dev, BYTE b_ModulNbr) +----------------------------------------------------------------------------+ */ -INT i_APCI1710_DisableLatchInterrupt(struct comedi_device * dev, BYTE b_ModulNbr) +int i_APCI1710_DisableLatchInterrupt(struct comedi_device * dev, unsigned char b_ModulNbr) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -3204,21 +3204,21 @@ INT i_APCI1710_DisableLatchInterrupt(struct comedi_device * dev, BYTE b_ModulNbr /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_Write16BitCounterValue | -| (BYTE_ b_BoardHandle | -| BYTE_ b_ModulNbr, | -| BYTE_ b_SelectedCounter, | -| UINT_ ui_WriteValue) | +| (unsigned char_ b_BoardHandle | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_SelectedCounter, | +| unsigned int_ ui_WriteValue) | +----------------------------------------------------------------------------+ | Task : Write a 16-Bit value (ui_WriteValue) in to the selected| | 16-Bit counter (b_SelectedCounter) from selected module| | (b_ModulNbr). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | -| BYTE_ b_SelectedCounter : Selected 16-Bit counter | +| unsigned char_ b_SelectedCounter : Selected 16-Bit counter | | (0 or 1) | -| UINT_ ui_WriteValue : 16-Bit write value | +| unsigned int_ ui_WriteValue : 16-Bit write value | +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -3231,10 +3231,10 @@ INT i_APCI1710_DisableLatchInterrupt(struct comedi_device * dev, BYTE b_ModulNbr +----------------------------------------------------------------------------+ */ -INT i_APCI1710_Write16BitCounterValue(struct comedi_device * dev, - BYTE b_ModulNbr, BYTE b_SelectedCounter, UINT ui_WriteValue) +int i_APCI1710_Write16BitCounterValue(struct comedi_device * dev, + unsigned char b_ModulNbr, unsigned char b_SelectedCounter, unsigned int ui_WriteValue) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -3257,7 +3257,7 @@ INT i_APCI1710_Write16BitCounterValue(struct comedi_device * dev, /* Write the value */ /*******************/ - outl((ULONG) ((ULONG) (ui_WriteValue) << (16 * + outl((unsigned int) ((unsigned int) (ui_WriteValue) << (16 * b_SelectedCounter)), devpriv->s_BoardInfos.ui_Address + 8 + (b_SelectedCounter * 4) + @@ -3294,15 +3294,15 @@ INT i_APCI1710_Write16BitCounterValue(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_Write32BitCounterValue | -| (BYTE_ b_BoardHandle | -| BYTE_ b_ModulNbr, | +| (unsigned char_ b_BoardHandle | +| unsigned char_ b_ModulNbr, | | ULONG_ ul_WriteValue) | +----------------------------------------------------------------------------+ | Task : Write a 32-Bit value (ui_WriteValue) in to the selected| | module (b_ModulNbr). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | | ULONG_ ul_WriteValue : 32-Bit write value | +----------------------------------------------------------------------------+ @@ -3316,10 +3316,10 @@ INT i_APCI1710_Write16BitCounterValue(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_Write32BitCounterValue(struct comedi_device * dev, - BYTE b_ModulNbr, ULONG ul_WriteValue) +int i_APCI1710_Write32BitCounterValue(struct comedi_device * dev, + unsigned char b_ModulNbr, unsigned int ul_WriteValue) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -3362,13 +3362,13 @@ INT i_APCI1710_Write32BitCounterValue(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ -| Function Name : _INT_ i_APCI1710_EnableIndex (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr) | +| Function Name : _INT_ i_APCI1710_EnableIndex (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr) | +----------------------------------------------------------------------------+ | Task : Enable the INDEX actions | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -3383,10 +3383,10 @@ INT i_APCI1710_Write32BitCounterValue(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_EnableIndex(struct comedi_device * dev, BYTE b_ModulNbr) +int i_APCI1710_EnableIndex(struct comedi_device * dev, unsigned char b_ModulNbr) { - INT i_ReturnValue = 0; - ULONG ul_InterruptLatchReg; + int i_ReturnValue = 0; + unsigned int ul_InterruptLatchReg; /**************************/ /* Test the module number */ @@ -3460,13 +3460,13 @@ INT i_APCI1710_EnableIndex(struct comedi_device * dev, BYTE b_ModulNbr) /* +----------------------------------------------------------------------------+ -| Function Name : _INT_ i_APCI1710_DisableIndex (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr) | +| Function Name : _INT_ i_APCI1710_DisableIndex (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr) | +----------------------------------------------------------------------------+ | Task : Disable the INDEX actions | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -3481,9 +3481,9 @@ INT i_APCI1710_EnableIndex(struct comedi_device * dev, BYTE b_ModulNbr) +----------------------------------------------------------------------------+ */ -INT i_APCI1710_DisableIndex(struct comedi_device * dev, BYTE b_ModulNbr) +int i_APCI1710_DisableIndex(struct comedi_device * dev, unsigned char b_ModulNbr) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -3555,15 +3555,15 @@ INT i_APCI1710_DisableIndex(struct comedi_device * dev, BYTE b_ModulNbr) /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_EnableCompareLogic | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr) | +----------------------------------------------------------------------------+ | Task : Enable the 32-Bit compare logic. At that moment that | | the incremental counter arrive to the compare value a | | interrupt is generated. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : - @@ -3580,9 +3580,9 @@ INT i_APCI1710_DisableIndex(struct comedi_device * dev, BYTE b_ModulNbr) +----------------------------------------------------------------------------+ */ -INT i_APCI1710_EnableCompareLogic(struct comedi_device * dev, BYTE b_ModulNbr) +int i_APCI1710_EnableCompareLogic(struct comedi_device * dev, unsigned char b_ModulNbr) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -3659,13 +3659,13 @@ INT i_APCI1710_EnableCompareLogic(struct comedi_device * dev, BYTE b_ModulNbr) /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_DisableCompareLogic | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr) | +----------------------------------------------------------------------------+ | Task : Disable the 32-Bit compare logic. +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : - @@ -3680,9 +3680,9 @@ INT i_APCI1710_EnableCompareLogic(struct comedi_device * dev, BYTE b_ModulNbr) +----------------------------------------------------------------------------+ */ -INT i_APCI1710_DisableCompareLogic(struct comedi_device * dev, BYTE b_ModulNbr) +int i_APCI1710_DisableCompareLogic(struct comedi_device * dev, unsigned char b_ModulNbr) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -3759,16 +3759,16 @@ INT i_APCI1710_DisableCompareLogic(struct comedi_device * dev, BYTE b_ModulNbr) /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_EnableFrequencyMeasurement | - | (BYTE_ b_BoardHandle, | - | BYTE_ b_ModulNbr, | - | BYTE_ b_InterruptEnable) | + | (unsigned char_ b_BoardHandle, | + | unsigned char_ b_ModulNbr, | + | unsigned char_ b_InterruptEnable) | +----------------------------------------------------------------------------+ | Task : Enables the frequency measurement function | +----------------------------------------------------------------------------+ - | Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | - | BYTE_ b_ModulNbr : Number of the module to be | + | Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | + | unsigned char_ b_ModulNbr : Number of the module to be | | configured (0 to 3) | - | BYTE_ b_InterruptEnable: Enable or disable the | + | unsigned char_ b_InterruptEnable: Enable or disable the | | interrupt. | | APCI1710_ENABLE: | | Enable the interrupt | @@ -3789,10 +3789,10 @@ INT i_APCI1710_DisableCompareLogic(struct comedi_device * dev, BYTE b_ModulNbr) +----------------------------------------------------------------------------+ */ -INT i_APCI1710_EnableFrequencyMeasurement(struct comedi_device * dev, - BYTE b_ModulNbr, BYTE b_InterruptEnable) +int i_APCI1710_EnableFrequencyMeasurement(struct comedi_device * dev, + unsigned char b_ModulNbr, unsigned char b_InterruptEnable) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -3915,13 +3915,13 @@ INT i_APCI1710_EnableFrequencyMeasurement(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_DisableFrequencyMeasurement | - | (BYTE_ b_BoardHandle, | - | BYTE_ b_ModulNbr) | + | (unsigned char_ b_BoardHandle, | + | unsigned char_ b_ModulNbr) | +----------------------------------------------------------------------------+ | Task : Disables the frequency measurement function | +----------------------------------------------------------------------------+ - | Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | - | BYTE_ b_ModulNbr : Number of the module to be | + | Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | + | unsigned char_ b_ModulNbr : Number of the module to be | | configured (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -3936,9 +3936,9 @@ INT i_APCI1710_EnableFrequencyMeasurement(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_DisableFrequencyMeasurement(struct comedi_device * dev, BYTE b_ModulNbr) +int i_APCI1710_DisableFrequencyMeasurement(struct comedi_device * dev, unsigned char b_ModulNbr) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -3976,9 +3976,9 @@ INT i_APCI1710_DisableFrequencyMeasurement(struct comedi_device * dev, BYTE b_Mo s_ByteModeRegister. b_ModeRegister3 & APCI1710_DISABLE_FREQUENCY - // Begin CG 29/06/01 CG 1100/0231 -> 0701/0232 Frequence measure IRQ must be cleared + /* Begin CG 29/06/01 CG 1100/0231 -> 0701/0232 Frequence measure IRQ must be cleared */ & APCI1710_DISABLE_FREQUENCY_INT; - // End CG 29/06/01 CG 1100/0231 -> 0701/0232 Frequence measure IRQ must be cleared + /* End CG 29/06/01 CG 1100/0231 -> 0701/0232 Frequence measure IRQ must be cleared */ /***************************/ /* Write the configuration */ @@ -4031,7 +4031,7 @@ INT i_APCI1710_DisableFrequencyMeasurement(struct comedi_device * dev, BYTE b_Mo /*########################################################################### */ - // INSN READ + /* INSN READ */ /*########################################################################### */ @@ -4049,82 +4049,82 @@ struct comedi_insn *insn,unsigned int *data) | | Return Value : +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnReadINCCPT(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1710_InsnReadINCCPT(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_ReadType; - INT i_ReturnValue = 0; + unsigned int ui_ReadType; + 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: i_ReturnValue = i_APCI1710_ReadLatchRegisterStatus(dev, - (BYTE) CR_AREF(insn->chanspec), - (BYTE) CR_RANGE(insn->chanspec), (PBYTE) & data[0]); + (unsigned char) CR_AREF(insn->chanspec), + (unsigned char) CR_RANGE(insn->chanspec), (unsigned char *) & data[0]); break; case APCI1710_INCCPT_READLATCHREGISTERVALUE: i_ReturnValue = i_APCI1710_ReadLatchRegisterValue(dev, - (BYTE) CR_AREF(insn->chanspec), - (BYTE) CR_RANGE(insn->chanspec), (PULONG) & data[0]); + (unsigned char) CR_AREF(insn->chanspec), + (unsigned char) CR_RANGE(insn->chanspec), (unsigned int *) & data[0]); printk("Latch Register Value %d\n", data[0]); break; case APCI1710_INCCPT_READ16BITCOUNTERVALUE: i_ReturnValue = i_APCI1710_Read16BitCounterValue(dev, - (BYTE) CR_AREF(insn->chanspec), - (BYTE) CR_RANGE(insn->chanspec), (PUINT) & data[0]); + (unsigned char) CR_AREF(insn->chanspec), + (unsigned char) CR_RANGE(insn->chanspec), (unsigned int *) & data[0]); break; case APCI1710_INCCPT_READ32BITCOUNTERVALUE: i_ReturnValue = i_APCI1710_Read32BitCounterValue(dev, - (BYTE) CR_AREF(insn->chanspec), (PULONG) & data[0]); + (unsigned char) CR_AREF(insn->chanspec), (unsigned int *) & data[0]); break; case APCI1710_INCCPT_GETINDEXSTATUS: i_ReturnValue = i_APCI1710_GetIndexStatus(dev, - (BYTE) CR_AREF(insn->chanspec), (PBYTE) & data[0]); + (unsigned char) CR_AREF(insn->chanspec), (unsigned char *) & data[0]); break; case APCI1710_INCCPT_GETREFERENCESTATUS: i_ReturnValue = i_APCI1710_GetReferenceStatus(dev, - (BYTE) CR_AREF(insn->chanspec), (PBYTE) & data[0]); + (unsigned char) CR_AREF(insn->chanspec), (unsigned char *) & data[0]); break; case APCI1710_INCCPT_GETUASSTATUS: i_ReturnValue = i_APCI1710_GetUASStatus(dev, - (BYTE) CR_AREF(insn->chanspec), (PBYTE) & data[0]); + (unsigned char) CR_AREF(insn->chanspec), (unsigned char *) & data[0]); break; case APCI1710_INCCPT_GETCBSTATUS: i_ReturnValue = i_APCI1710_GetCBStatus(dev, - (BYTE) CR_AREF(insn->chanspec), (PBYTE) & data[0]); + (unsigned char) CR_AREF(insn->chanspec), (unsigned char *) & data[0]); break; case APCI1710_INCCPT_GET16BITCBSTATUS: i_ReturnValue = i_APCI1710_Get16BitCBStatus(dev, - (BYTE) CR_AREF(insn->chanspec), - (PBYTE) & data[0], (PBYTE) & data[1]); + (unsigned char) CR_AREF(insn->chanspec), + (unsigned char *) & data[0], (unsigned char *) & data[1]); break; case APCI1710_INCCPT_GETUDSTATUS: i_ReturnValue = i_APCI1710_GetUDStatus(dev, - (BYTE) CR_AREF(insn->chanspec), (PBYTE) & data[0]); + (unsigned char) CR_AREF(insn->chanspec), (unsigned char *) & data[0]); break; case APCI1710_INCCPT_GETINTERRUPTUDLATCHEDSTATUS: i_ReturnValue = i_APCI1710_GetInterruptUDLatchedStatus(dev, - (BYTE) CR_AREF(insn->chanspec), (PBYTE) & data[0]); + (unsigned char) CR_AREF(insn->chanspec), (unsigned char *) & data[0]); break; case APCI1710_INCCPT_READFREQUENCYMEASUREMENT: i_ReturnValue = i_APCI1710_ReadFrequencyMeasurement(dev, - (BYTE) CR_AREF(insn->chanspec), - (PBYTE) & data[0], - (PBYTE) & data[1], (PULONG) & data[2]); + (unsigned char) CR_AREF(insn->chanspec), + (unsigned char *) & data[0], + (unsigned char *) & data[1], (unsigned int *) & data[2]); break; case APCI1710_INCCPT_READINTERRUPT: @@ -4162,22 +4162,22 @@ INT i_APCI1710_InsnReadINCCPT(struct comedi_device * dev, struct comedi_subdevic /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ReadLatchRegisterStatus | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_LatchReg, | -| PBYTE_ pb_LatchStatus) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_LatchReg, | +| unsigned char *_ pb_LatchStatus) | +----------------------------------------------------------------------------+ | Task : Read the latch register status from selected module | | (b_ModulNbr) and selected latch register (b_LatchReg). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | -| BYTE_ b_LatchReg : Selected latch register | +| unsigned char_ b_LatchReg : Selected latch register | | 0 : for the first latch register | | 1 : for the second latch register | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_LatchStatus : Latch register status. | +| Output Parameters : unsigned char *_ pb_LatchStatus : Latch register status. | | 0 : No latch occur | | 1 : A software latch occur | | 2 : A hardware latch occur | @@ -4193,11 +4193,11 @@ INT i_APCI1710_InsnReadINCCPT(struct comedi_device * dev, struct comedi_subdevic +----------------------------------------------------------------------------+ */ -INT i_APCI1710_ReadLatchRegisterStatus(struct comedi_device * dev, - BYTE b_ModulNbr, BYTE b_LatchReg, PBYTE pb_LatchStatus) +int i_APCI1710_ReadLatchRegisterStatus(struct comedi_device * dev, + unsigned char b_ModulNbr, unsigned char b_LatchReg, unsigned char * pb_LatchStatus) { - INT i_ReturnValue = 0; - DWORD dw_LatchReg; + int i_ReturnValue = 0; + unsigned int dw_LatchReg; /**************************/ /* Test the module number */ @@ -4220,7 +4220,7 @@ INT i_APCI1710_ReadLatchRegisterStatus(struct comedi_device * dev, ui_Address + (64 * b_ModulNbr)); *pb_LatchStatus = - (BYTE) ((dw_LatchReg >> (b_LatchReg * + (unsigned char) ((dw_LatchReg >> (b_LatchReg * 4)) & 0x3); } else { /**************************************************/ @@ -4254,18 +4254,18 @@ INT i_APCI1710_ReadLatchRegisterStatus(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ReadLatchRegisterValue | -| (BYTE_ b_BoardHandle,| -| BYTE_ b_ModulNbr, | -| BYTE_ b_LatchReg, | +| (unsigned char_ b_BoardHandle,| +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_LatchReg, | | PULONG_ pul_LatchValue) | +----------------------------------------------------------------------------+ | Task : Read the latch register value from selected module | | (b_ModulNbr) and selected latch register (b_LatchReg). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | -| BYTE_ b_LatchReg : Selected latch register | +| unsigned char_ b_LatchReg : Selected latch register | | 0 : for the first latch register | | 1 : for the second latch register | +----------------------------------------------------------------------------+ @@ -4280,10 +4280,10 @@ INT i_APCI1710_ReadLatchRegisterStatus(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_ReadLatchRegisterValue(struct comedi_device * dev, - BYTE b_ModulNbr, BYTE b_LatchReg, PULONG pul_LatchValue) +int i_APCI1710_ReadLatchRegisterValue(struct comedi_device * dev, + unsigned char b_ModulNbr, unsigned char b_LatchReg, unsigned int * pul_LatchValue) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -4338,22 +4338,22 @@ INT i_APCI1710_ReadLatchRegisterValue(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_Read16BitCounterValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_SelectedCounter, | -| PUINT_ pui_CounterValue) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_SelectedCounter, | +| unsigned int *_ pui_CounterValue) | +----------------------------------------------------------------------------+ | Task : Latch the selected 16-Bit counter (b_SelectedCounter) | | from selected module (b_ModulNbr) in to the first | | latch register and return the latched value. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | -| BYTE_ b_SelectedCounter : Selected 16-Bit counter | +| unsigned char_ b_SelectedCounter : Selected 16-Bit counter | | (0 or 1) | +----------------------------------------------------------------------------+ -| Output Parameters : PUINT_ pui_CounterValue : 16-Bit counter value | +| Output Parameters : unsigned int *_ pui_CounterValue : 16-Bit counter value | +----------------------------------------------------------------------------+ | Return Value : 0: No error | | -1: The handle parameter of the board is wrong | @@ -4364,11 +4364,11 @@ INT i_APCI1710_ReadLatchRegisterValue(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_Read16BitCounterValue(struct comedi_device * dev, - BYTE b_ModulNbr, BYTE b_SelectedCounter, PUINT pui_CounterValue) +int i_APCI1710_Read16BitCounterValue(struct comedi_device * dev, + unsigned char b_ModulNbr, unsigned char b_SelectedCounter, unsigned int * pui_CounterValue) { - INT i_ReturnValue = 0; - DWORD dw_LathchValue = 0; + int i_ReturnValue = 0; + unsigned int dw_LathchValue = 0; /**************************/ /* Test the module number */ @@ -4402,7 +4402,7 @@ INT i_APCI1710_Read16BitCounterValue(struct comedi_device * dev, ui_Address + 4 + (64 * b_ModulNbr)); *pui_CounterValue = - (UINT) ((dw_LathchValue >> (16 * + (unsigned int) ((dw_LathchValue >> (16 * b_SelectedCounter)) & 0xFFFFU); } else { @@ -4437,16 +4437,16 @@ INT i_APCI1710_Read16BitCounterValue(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_Read32BitCounterValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | | PULONG_ pul_CounterValue) | +----------------------------------------------------------------------------+ | Task : Latch the 32-Bit counter from selected module | | (b_ModulNbr) in to the first latch register and return | | the latched value. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : PULONG_ pul_CounterValue : 32-Bit counter value | @@ -4459,10 +4459,10 @@ INT i_APCI1710_Read16BitCounterValue(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_Read32BitCounterValue(struct comedi_device * dev, - BYTE b_ModulNbr, PULONG pul_CounterValue) +int i_APCI1710_Read32BitCounterValue(struct comedi_device * dev, + unsigned char b_ModulNbr, unsigned int * pul_CounterValue) { - INT i_ReturnValue = 0; + int i_ReturnValue = 0; /**************************/ /* Test the module number */ @@ -4512,17 +4512,17 @@ INT i_APCI1710_Read32BitCounterValue(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ -| Function Name : _INT_ i_APCI1710_GetIndexStatus (BYTE_ b_BoardHandle,| -| BYTE_ b_ModulNbr, | -| PBYTE_ pb_IndexStatus)| +| Function Name : _INT_ i_APCI1710_GetIndexStatus (unsigned char_ b_BoardHandle,| +| unsigned char_ b_ModulNbr, | +| unsigned char *_ pb_IndexStatus)| +----------------------------------------------------------------------------+ | Task : Return the index status | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_IndexStatus : 0 : No INDEX occur | +| Output Parameters : unsigned char *_ pb_IndexStatus : 0 : No INDEX occur | | 1 : A INDEX occur | +----------------------------------------------------------------------------+ | Return Value : 0: No error | @@ -4535,11 +4535,11 @@ INT i_APCI1710_Read32BitCounterValue(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_GetIndexStatus(struct comedi_device * dev, - BYTE b_ModulNbr, PBYTE pb_IndexStatus) +int i_APCI1710_GetIndexStatus(struct comedi_device * dev, + unsigned char b_ModulNbr, unsigned char * pb_IndexStatus) { - INT i_ReturnValue = 0; - DWORD dw_StatusReg = 0; + int i_ReturnValue = 0; + unsigned int dw_StatusReg = 0; /**************************/ /* Test the module number */ @@ -4563,7 +4563,7 @@ INT i_APCI1710_GetIndexStatus(struct comedi_device * dev, dw_StatusReg = inl(devpriv->s_BoardInfos. ui_Address + 12 + (64 * b_ModulNbr)); - *pb_IndexStatus = (BYTE) (dw_StatusReg & 1); + *pb_IndexStatus = (unsigned char) (dw_StatusReg & 1); } else { /*************************************************************/ /* Index not initialised see function "i_APCI1710_InitIndex" */ @@ -4596,17 +4596,17 @@ INT i_APCI1710_GetIndexStatus(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_GetReferenceStatus | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| PBYTE_ pb_ReferenceStatus) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char *_ pb_ReferenceStatus) | +----------------------------------------------------------------------------+ | Task : Return the reference status | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_ReferenceStatus : 0 : No REFERENCE occur | +| Output Parameters : unsigned char *_ pb_ReferenceStatus : 0 : No REFERENCE occur | | 1 : A REFERENCE occur | +----------------------------------------------------------------------------+ | Return Value : 0: No error | @@ -4619,11 +4619,11 @@ INT i_APCI1710_GetIndexStatus(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_GetReferenceStatus(struct comedi_device * dev, - BYTE b_ModulNbr, PBYTE pb_ReferenceStatus) +int i_APCI1710_GetReferenceStatus(struct comedi_device * dev, + unsigned char b_ModulNbr, unsigned char * pb_ReferenceStatus) { - INT i_ReturnValue = 0; - DWORD dw_StatusReg = 0; + int i_ReturnValue = 0; + unsigned int dw_StatusReg = 0; /**************************/ /* Test the module number */ @@ -4649,7 +4649,7 @@ INT i_APCI1710_GetReferenceStatus(struct comedi_device * dev, ui_Address + 24 + (64 * b_ModulNbr)); *pb_ReferenceStatus = - (BYTE) (~dw_StatusReg & 1); + (unsigned char) (~dw_StatusReg & 1); } else { /*********************************************************************/ /* Reference not initialised see function "i_APCI1710_InitReference" */ @@ -4682,17 +4682,17 @@ INT i_APCI1710_GetReferenceStatus(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_GetUASStatus | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| PBYTE_ pb_UASStatus) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char *_ pb_UASStatus) | +----------------------------------------------------------------------------+ | Task : Return the error signal (UAS) status | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_UASStatus : 0 : UAS is low "0" | +| Output Parameters : unsigned char *_ pb_UASStatus : 0 : UAS is low "0" | | 1 : UAS is high "1" | +----------------------------------------------------------------------------+ | Return Value : 0: No error | @@ -4703,11 +4703,11 @@ INT i_APCI1710_GetReferenceStatus(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_GetUASStatus(struct comedi_device * dev, - BYTE b_ModulNbr, PBYTE pb_UASStatus) +int i_APCI1710_GetUASStatus(struct comedi_device * dev, + unsigned char b_ModulNbr, unsigned char * pb_UASStatus) { - INT i_ReturnValue = 0; - DWORD dw_StatusReg = 0; + int i_ReturnValue = 0; + unsigned int dw_StatusReg = 0; /**************************/ /* Test the module number */ @@ -4724,7 +4724,7 @@ INT i_APCI1710_GetUASStatus(struct comedi_device * dev, dw_StatusReg = inl(devpriv->s_BoardInfos. ui_Address + 24 + (64 * b_ModulNbr)); - *pb_UASStatus = (BYTE) ((dw_StatusReg >> 1) & 1); + *pb_UASStatus = (unsigned char) ((dw_StatusReg >> 1) & 1); } else { /****************************************/ /* Counter not initialised see function */ @@ -4750,17 +4750,17 @@ INT i_APCI1710_GetUASStatus(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_GetCBStatus | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| PBYTE_ pb_CBStatus) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char *_ pb_CBStatus) | +----------------------------------------------------------------------------+ | Task : Return the counter overflow status | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_CBStatus : 0 : Counter no overflow | +| Output Parameters : unsigned char *_ pb_CBStatus : 0 : Counter no overflow | | 1 : Counter overflow | +----------------------------------------------------------------------------+ | Return Value : 0: No error | @@ -4771,11 +4771,11 @@ INT i_APCI1710_GetUASStatus(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_GetCBStatus(struct comedi_device * dev, - BYTE b_ModulNbr, PBYTE pb_CBStatus) +int i_APCI1710_GetCBStatus(struct comedi_device * dev, + unsigned char b_ModulNbr, unsigned char * pb_CBStatus) { - INT i_ReturnValue = 0; - DWORD dw_StatusReg = 0; + int i_ReturnValue = 0; + unsigned int dw_StatusReg = 0; /**************************/ /* Test the module number */ @@ -4792,7 +4792,7 @@ INT i_APCI1710_GetCBStatus(struct comedi_device * dev, dw_StatusReg = inl(devpriv->s_BoardInfos. ui_Address + 16 + (64 * b_ModulNbr)); - *pb_CBStatus = (BYTE) (dw_StatusReg & 1); + *pb_CBStatus = (unsigned char) (dw_StatusReg & 1); } else { /****************************************/ @@ -4818,25 +4818,25 @@ INT i_APCI1710_GetCBStatus(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_Get16BitCBStatus | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| PBYTE_ pb_CBStatusCounter0, | -| PBYTE_ pb_CBStatusCounter1) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char *_ pb_CBStatusCounter0, | +| unsigned char *_ pb_CBStatusCounter1) | +----------------------------------------------------------------------------+ | Task : Returns the counter overflow (counter initialised to | | 2*16-bit) status from selected incremental counter | | module | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_CBStatusCounter0 : 0 : No overflow occur for | +| Output Parameters : unsigned char *_ pb_CBStatusCounter0 : 0 : No overflow occur for | | the first 16-bit | | counter | | 1 : Overflow occur for the| | first 16-bit counter | -| PBYTE_ pb_CBStatusCounter1 : 0 : No overflow occur for | +| unsigned char *_ pb_CBStatusCounter1 : 0 : No overflow occur for | | the second 16-bit | | counter | | 1 : Overflow occur for the| @@ -4853,11 +4853,11 @@ INT i_APCI1710_GetCBStatus(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_Get16BitCBStatus(struct comedi_device * dev, - BYTE b_ModulNbr, PBYTE pb_CBStatusCounter0, PBYTE pb_CBStatusCounter1) +int i_APCI1710_Get16BitCBStatus(struct comedi_device * dev, + unsigned char b_ModulNbr, unsigned char * pb_CBStatusCounter0, unsigned char * pb_CBStatusCounter1) { - INT i_ReturnValue = 0; - DWORD dw_StatusReg = 0; + int i_ReturnValue = 0; + unsigned int dw_StatusReg = 0; /**************************/ /* Test the module number */ @@ -4894,20 +4894,20 @@ INT i_APCI1710_Get16BitCBStatus(struct comedi_device * dev, (64 * b_ModulNbr)); *pb_CBStatusCounter1 = - (BYTE) ((dw_StatusReg >> 0) & + (unsigned char) ((dw_StatusReg >> 0) & 1); *pb_CBStatusCounter0 = - (BYTE) ((dw_StatusReg >> 1) & + (unsigned char) ((dw_StatusReg >> 1) & 1); - } // if ((ps_APCI1710Variable->s_Board [b_BoardHandle].s_BoardInfos.dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3136) + } /* if ((ps_APCI1710Variable->s_Board [b_BoardHandle].s_BoardInfos.dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3136) */ else { /****************************/ /* Firmware revision error */ /****************************/ i_ReturnValue = -5; - } // if ((ps_APCI1710Variable->s_Board [b_BoardHandle].s_BoardInfos.dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3136) - } // 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_BoardInfos.dw_MolduleConfiguration [b_ModulNbr] & 0xFFFF) >= 0x3136) */ + } /* if ((ps_APCI1710Variable->s_Board [b_BoardHandle].s_ModuleInfo [b_ModulNbr].s_SiemensCounterInfo.s_ModeRegister.s_ByteModeRegister.b_ModeRegister1 & 0x10) == 0x10) */ else { /********************************************/ /* Counter not initialised to 2*16-bit mode */ @@ -4916,8 +4916,8 @@ INT i_APCI1710_Get16BitCBStatus(struct comedi_device * dev, 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) + } /* 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) */ else { /****************************************/ /* Counter not initialised see function */ @@ -4926,8 +4926,8 @@ INT i_APCI1710_Get16BitCBStatus(struct comedi_device * dev, 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) + } /* if (ps_APCI1710Variable->s_Board [b_BoardHandle].s_ModuleInfo [b_ModulNbr].s_SiemensCounterInfo.s_InitFlag.b_CounterInit == 1) */ + } /* if (b_ModulNbr < 4) */ else { /*************************************************/ /* The selected module number parameter is wrong */ @@ -4935,7 +4935,7 @@ INT i_APCI1710_Get16BitCBStatus(struct comedi_device * dev, DPRINTK("The selected module number parameter is wrong\n"); i_ReturnValue = -2; - } // if (b_ModulNbr < 4) + } /* if (b_ModulNbr < 4) */ return (i_ReturnValue); } @@ -4943,17 +4943,17 @@ INT i_APCI1710_Get16BitCBStatus(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_GetUDStatus | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| PBYTE_ pb_UDStatus) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char *_ pb_UDStatus) | +----------------------------------------------------------------------------+ | Task : Return the counter progress status | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_UDStatus : 0 : Counter progress in the | +| Output Parameters : unsigned char *_ pb_UDStatus : 0 : Counter progress in the | | selected mode down | | 1 : Counter progress in the | | selected mode up | @@ -4966,11 +4966,11 @@ INT i_APCI1710_Get16BitCBStatus(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_GetUDStatus(struct comedi_device * dev, - BYTE b_ModulNbr, PBYTE pb_UDStatus) +int i_APCI1710_GetUDStatus(struct comedi_device * dev, + unsigned char b_ModulNbr, unsigned char * pb_UDStatus) { - INT i_ReturnValue = 0; - DWORD dw_StatusReg = 0; + int i_ReturnValue = 0; + unsigned int dw_StatusReg = 0; /**************************/ /* Test the module number */ @@ -4987,7 +4987,7 @@ INT i_APCI1710_GetUDStatus(struct comedi_device * dev, dw_StatusReg = inl(devpriv->s_BoardInfos. ui_Address + 24 + (64 * b_ModulNbr)); - *pb_UDStatus = (BYTE) ((dw_StatusReg >> 2) & 1); + *pb_UDStatus = (unsigned char) ((dw_StatusReg >> 2) & 1); } else { /****************************************/ @@ -5013,18 +5013,18 @@ INT i_APCI1710_GetUDStatus(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_GetInterruptUDLatchedStatus | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| PBYTE_ pb_UDStatus) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char *_ pb_UDStatus) | +----------------------------------------------------------------------------+ | Task : Return the counter progress latched status after a | | index interrupt occur. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Module number to configure | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_UDStatus : 0 : Counter progress in the | +| Output Parameters : unsigned char *_ pb_UDStatus : 0 : Counter progress in the | | selected mode down | | 1 : Counter progress in the | | selected mode up | @@ -5040,11 +5040,11 @@ INT i_APCI1710_GetUDStatus(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device * dev, - BYTE b_ModulNbr, PBYTE pb_UDStatus) +int i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device * dev, + unsigned char b_ModulNbr, unsigned char * pb_UDStatus) { - INT i_ReturnValue = 0; - DWORD dw_StatusReg = 0; + int i_ReturnValue = 0; + unsigned int dw_StatusReg = 0; /**************************/ /* Test the module number */ @@ -5074,7 +5074,7 @@ INT i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device * dev, dw_StatusReg = inl(devpriv->s_BoardInfos. ui_Address + 12 + (64 * b_ModulNbr)); - *pb_UDStatus = (BYTE) ((dw_StatusReg >> 1) & 1); + *pb_UDStatus = (unsigned char) ((dw_StatusReg >> 1) & 1); } else { /****************************/ /* No index interrupt occur */ @@ -5106,20 +5106,20 @@ INT i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ReadFrequencyMeasurement | - | (BYTE_ b_BoardHandle, | - | BYTE_ b_ModulNbr, | - | PBYTE_ pb_Status, | + | (unsigned char_ b_BoardHandle, | + | unsigned char_ b_ModulNbr, | + | unsigned char *_ pb_Status, | | PULONG_ pul_ReadValue) | +----------------------------------------------------------------------------+ | Task : Returns the status (pb_Status) and the number of | | increments in the set time. | | See function " i_APCI1710_InitFrequencyMeasurement " | +----------------------------------------------------------------------------+ - | Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | - | BYTE_ b_ModulNbr : Number of the module to be | + | Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | + | unsigned char_ b_ModulNbr : Number of the module to be | | configured (0 to 3) | +----------------------------------------------------------------------------+ - | Output Parameters : PBYTE_ pb_Status : Returns the frequency | + | Output Parameters : unsigned char *_ pb_Status : Returns the frequency | | measurement status | | 0 : Counting cycle not | | started. | @@ -5127,7 +5127,7 @@ INT i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device * dev, | 2 : Counting cycle stopped. | | The measurement cycle is | | completed. | - | PBYTE_ pb_UDStatus : 0 : Counter progress in the | + | unsigned char *_ pb_UDStatus : 0 : Counter progress in the | | selected mode down | | 1 : Counter progress in the | | selected mode up | @@ -5145,13 +5145,13 @@ INT i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_ReadFrequencyMeasurement(struct comedi_device * dev, - BYTE b_ModulNbr, - PBYTE pb_Status, PBYTE pb_UDStatus, PULONG pul_ReadValue) +int i_APCI1710_ReadFrequencyMeasurement(struct comedi_device * dev, + unsigned char b_ModulNbr, + unsigned char * pb_Status, unsigned char * pb_UDStatus, unsigned int * pul_ReadValue) { - INT i_ReturnValue = 0; - UINT ui_16BitValue; - DWORD dw_StatusReg; + int i_ReturnValue = 0; + unsigned int ui_16BitValue; + unsigned int dw_StatusReg; /**************************/ /* Test the module number */ @@ -5198,7 +5198,7 @@ INT i_APCI1710_ReadFrequencyMeasurement(struct comedi_device * dev, if (dw_StatusReg & 1) { *pb_Status = 2; *pb_UDStatus = - (BYTE) ((dw_StatusReg >> + (unsigned char) ((dw_StatusReg >> 1) & 3); /******************/ @@ -5224,7 +5224,7 @@ INT i_APCI1710_ReadFrequencyMeasurement(struct comedi_device * dev, if ((*pul_ReadValue & 0xFFFFU) != 0) { ui_16BitValue = - (UINT) + (unsigned int) * pul_ReadValue & @@ -5247,7 +5247,7 @@ INT i_APCI1710_ReadFrequencyMeasurement(struct comedi_device * dev, if ((*pul_ReadValue & 0xFFFF0000UL) != 0) { ui_16BitValue = - (UINT) + (unsigned int) ( (*pul_ReadValue >> @@ -5281,7 +5281,7 @@ INT i_APCI1710_ReadFrequencyMeasurement(struct comedi_device * dev, if ((*pul_ReadValue & 0xFFFF0000UL) != 0) { ui_16BitValue = - (UINT) + (unsigned int) ( (*pul_ReadValue >> @@ -5307,7 +5307,7 @@ INT i_APCI1710_ReadFrequencyMeasurement(struct comedi_device * dev, if ((*pul_ReadValue & 0xFFFFU) != 0) { ui_16BitValue = - (UINT) + (unsigned int) * pul_ReadValue & diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.h b/drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.h index 5153cf686658..51c759bdc3b0 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.h +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_INCCPT.h @@ -132,140 +132,140 @@ #define APCI1710_INCCPT_DISABLEFREQUENCYMEASUREMENT 409 /************ Main Functions *************/ -INT i_APCI1710_InsnConfigINCCPT(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnConfigINCCPT(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int * data); -INT i_APCI1710_InsnBitsINCCPT(struct comedi_device *dev, struct comedi_subdevice * s, +int i_APCI1710_InsnBitsINCCPT(struct comedi_device *dev, struct comedi_subdevice * s, struct comedi_insn *insn, unsigned int * data); -INT i_APCI1710_InsnWriteINCCPT(struct comedi_device *dev, struct comedi_subdevice * s, +int i_APCI1710_InsnWriteINCCPT(struct comedi_device *dev, struct comedi_subdevice * s, struct comedi_insn *insn, unsigned int * data); -INT i_APCI1710_InsnReadINCCPT(struct comedi_device *dev, struct comedi_subdevice * s, +int i_APCI1710_InsnReadINCCPT(struct comedi_device *dev, struct comedi_subdevice * s, struct comedi_insn *insn, unsigned int * data); /*********** Supplementary Functions********/ /* INSN CONFIG */ -INT i_APCI1710_InitCounter(struct comedi_device *dev, - BYTE b_ModulNbr, - BYTE b_CounterRange, - BYTE b_FirstCounterModus, - BYTE b_FirstCounterOption, - BYTE b_SecondCounterModus, - BYTE b_SecondCounterOption); - -INT i_APCI1710_CounterAutoTest(struct comedi_device *dev, PBYTE pb_TestStatus); - -INT i_APCI1710_InitIndex(struct comedi_device *dev, - BYTE b_ModulNbr, - BYTE b_ReferenceAction, - BYTE b_IndexOperation, BYTE b_AutoMode, - BYTE b_InterruptEnable); - -INT i_APCI1710_InitReference(struct comedi_device *dev, - BYTE b_ModulNbr, BYTE b_ReferenceLevel); - -INT i_APCI1710_InitExternalStrobe(struct comedi_device *dev, - BYTE b_ModulNbr, BYTE b_ExternalStrobe, - BYTE b_ExternalStrobeLevel); - -INT i_APCI1710_InitCompareLogic(struct comedi_device *dev, - BYTE b_ModulNbr, UINT ui_CompareValue); - -INT i_APCI1710_InitFrequencyMeasurement(struct comedi_device *dev, - BYTE b_ModulNbr, - BYTE b_PCIInputClock, - BYTE b_TimingUnity, - ULONG ul_TimingInterval, - PULONG pul_RealTimingInterval); +int i_APCI1710_InitCounter(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned char b_CounterRange, + unsigned char b_FirstCounterModus, + unsigned char b_FirstCounterOption, + unsigned char b_SecondCounterModus, + unsigned char b_SecondCounterOption); + +int i_APCI1710_CounterAutoTest(struct comedi_device *dev, unsigned char * pb_TestStatus); + +int i_APCI1710_InitIndex(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned char b_ReferenceAction, + unsigned char b_IndexOperation, unsigned char b_AutoMode, + unsigned char b_InterruptEnable); + +int i_APCI1710_InitReference(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_ReferenceLevel); + +int i_APCI1710_InitExternalStrobe(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_ExternalStrobe, + unsigned char b_ExternalStrobeLevel); + +int i_APCI1710_InitCompareLogic(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned int ui_CompareValue); + +int i_APCI1710_InitFrequencyMeasurement(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned char b_PCIInputClock, + unsigned char b_TimingUnity, + unsigned int ul_TimingInterval, + unsigned int * pul_RealTimingInterval); /* INSN BITS */ -INT i_APCI1710_ClearCounterValue(struct comedi_device *dev, BYTE b_ModulNbr); +int i_APCI1710_ClearCounterValue(struct comedi_device *dev, unsigned char b_ModulNbr); -INT i_APCI1710_ClearAllCounterValue(struct comedi_device *dev); +int i_APCI1710_ClearAllCounterValue(struct comedi_device *dev); -INT i_APCI1710_SetInputFilter(struct comedi_device *dev, - BYTE b_ModulNbr, BYTE b_PCIInputClock, - BYTE b_Filter); +int i_APCI1710_SetInputFilter(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_PCIInputClock, + unsigned char b_Filter); -INT i_APCI1710_LatchCounter(struct comedi_device *dev, - BYTE b_ModulNbr, BYTE b_LatchReg); +int i_APCI1710_LatchCounter(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_LatchReg); -INT i_APCI1710_SetIndexAndReferenceSource(struct comedi_device *dev, - BYTE b_ModulNbr, - BYTE b_SourceSelection); +int i_APCI1710_SetIndexAndReferenceSource(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned char b_SourceSelection); -INT i_APCI1710_SetDigitalChlOn(struct comedi_device *dev, BYTE b_ModulNbr); +int i_APCI1710_SetDigitalChlOn(struct comedi_device *dev, unsigned char b_ModulNbr); -INT i_APCI1710_SetDigitalChlOff(struct comedi_device *dev, BYTE b_ModulNbr); +int i_APCI1710_SetDigitalChlOff(struct comedi_device *dev, unsigned char b_ModulNbr); /* INSN WRITE */ -INT i_APCI1710_EnableLatchInterrupt(struct comedi_device *dev, BYTE b_ModulNbr); +int i_APCI1710_EnableLatchInterrupt(struct comedi_device *dev, unsigned char b_ModulNbr); -INT i_APCI1710_DisableLatchInterrupt(struct comedi_device *dev, BYTE b_ModulNbr); +int i_APCI1710_DisableLatchInterrupt(struct comedi_device *dev, unsigned char b_ModulNbr); -INT i_APCI1710_Write16BitCounterValue(struct comedi_device *dev, - BYTE b_ModulNbr, BYTE b_SelectedCounter, - UINT ui_WriteValue); +int i_APCI1710_Write16BitCounterValue(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_SelectedCounter, + unsigned int ui_WriteValue); -INT i_APCI1710_Write32BitCounterValue(struct comedi_device *dev, - BYTE b_ModulNbr, ULONG ul_WriteValue); +int i_APCI1710_Write32BitCounterValue(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned int ul_WriteValue); -INT i_APCI1710_EnableIndex(struct comedi_device *dev, BYTE b_ModulNbr); +int i_APCI1710_EnableIndex(struct comedi_device *dev, unsigned char b_ModulNbr); -INT i_APCI1710_DisableIndex(struct comedi_device *dev, BYTE b_ModulNbr); +int i_APCI1710_DisableIndex(struct comedi_device *dev, unsigned char b_ModulNbr); -INT i_APCI1710_EnableCompareLogic(struct comedi_device *dev, BYTE b_ModulNbr); +int i_APCI1710_EnableCompareLogic(struct comedi_device *dev, unsigned char b_ModulNbr); -INT i_APCI1710_DisableCompareLogic(struct comedi_device *dev, BYTE b_ModulNbr); +int i_APCI1710_DisableCompareLogic(struct comedi_device *dev, unsigned char b_ModulNbr); -INT i_APCI1710_EnableFrequencyMeasurement(struct comedi_device *dev, - BYTE b_ModulNbr, - BYTE b_InterruptEnable); +int i_APCI1710_EnableFrequencyMeasurement(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned char b_InterruptEnable); -INT i_APCI1710_DisableFrequencyMeasurement(struct comedi_device *dev, - BYTE b_ModulNbr); +int i_APCI1710_DisableFrequencyMeasurement(struct comedi_device *dev, + unsigned char b_ModulNbr); /* INSN READ */ -INT i_APCI1710_ReadLatchRegisterStatus(struct comedi_device *dev, - BYTE b_ModulNbr, BYTE b_LatchReg, - PBYTE pb_LatchStatus); +int i_APCI1710_ReadLatchRegisterStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_LatchReg, + unsigned char * pb_LatchStatus); -INT i_APCI1710_ReadLatchRegisterValue(struct comedi_device *dev, - BYTE b_ModulNbr, BYTE b_LatchReg, - PULONG pul_LatchValue); +int i_APCI1710_ReadLatchRegisterValue(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_LatchReg, + unsigned int * pul_LatchValue); -INT i_APCI1710_Read16BitCounterValue(struct comedi_device *dev, - BYTE b_ModulNbr, BYTE b_SelectedCounter, - PUINT pui_CounterValue); +int i_APCI1710_Read16BitCounterValue(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char b_SelectedCounter, + unsigned int * pui_CounterValue); -INT i_APCI1710_Read32BitCounterValue(struct comedi_device *dev, - BYTE b_ModulNbr, PULONG pul_CounterValue); +int i_APCI1710_Read32BitCounterValue(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned int * pul_CounterValue); -INT i_APCI1710_GetIndexStatus(struct comedi_device *dev, - BYTE b_ModulNbr, PBYTE pb_IndexStatus); +int i_APCI1710_GetIndexStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char * pb_IndexStatus); -INT i_APCI1710_GetReferenceStatus(struct comedi_device *dev, - BYTE b_ModulNbr, PBYTE pb_ReferenceStatus); +int i_APCI1710_GetReferenceStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char * pb_ReferenceStatus); -INT i_APCI1710_GetUASStatus(struct comedi_device *dev, - BYTE b_ModulNbr, PBYTE pb_UASStatus); +int i_APCI1710_GetUASStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char * pb_UASStatus); -INT i_APCI1710_GetCBStatus(struct comedi_device *dev, - BYTE b_ModulNbr, PBYTE pb_CBStatus); +int i_APCI1710_GetCBStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char * pb_CBStatus); -INT i_APCI1710_Get16BitCBStatus(struct comedi_device *dev, - BYTE b_ModulNbr, PBYTE pb_CBStatusCounter0, - PBYTE pb_CBStatusCounter1); +int i_APCI1710_Get16BitCBStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char * pb_CBStatusCounter0, + unsigned char * pb_CBStatusCounter1); -INT i_APCI1710_GetUDStatus(struct comedi_device *dev, - BYTE b_ModulNbr, PBYTE pb_UDStatus); +int i_APCI1710_GetUDStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char * pb_UDStatus); -INT i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device *dev, - BYTE b_ModulNbr, PBYTE pb_UDStatus); +int i_APCI1710_GetInterruptUDLatchedStatus(struct comedi_device *dev, + unsigned char b_ModulNbr, unsigned char * pb_UDStatus); -INT i_APCI1710_ReadFrequencyMeasurement(struct comedi_device *dev, - BYTE b_ModulNbr, - PBYTE pb_Status, PBYTE pb_UDStatus, - PULONG pul_ReadValue); +int i_APCI1710_ReadFrequencyMeasurement(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned char * pb_Status, unsigned char * pb_UDStatus, + unsigned int * pul_ReadValue); diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Inp_cpt.c b/drivers/staging/comedi/drivers/addi-data/APCI1710_Inp_cpt.c index 3ac6a264ef54..966aba855d0c 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Inp_cpt.c +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Inp_cpt.c @@ -60,11 +60,11 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_InitPulseEncoder | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_PulseEncoderNbr, | -| BYTE_ b_InputLevelSelection, | -| BYTE_ b_TriggerOutputAction, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_PulseEncoderNbr, | +| unsigned char_ b_InputLevelSelection, | +| unsigned char_ b_TriggerOutputAction, | | ULONG_ ul_StartValue) | +----------------------------------------------------------------------------+ | Task : Configure the pulse encoder operating mode selected via| @@ -74,12 +74,12 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc | You must calling this function be for you call any | | other function witch access of pulse encoders. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710| -| BYTE_ b_ModulNbr : Module number to | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710| +| unsigned char_ b_ModulNbr : Module number to | | configure (0 to 3) | -| BYTE_ b_PulseEncoderNbr : Pulse encoder selection | +| unsigned char_ b_PulseEncoderNbr : Pulse encoder selection | | (0 to 3) | -| BYTE_ b_InputLevelSelection : Input level selection | +| unsigned char_ b_InputLevelSelection : Input level selection | | (0 or 1) | | 0 : Set pulse encoder| | count the the low| @@ -87,7 +87,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc | 1 : Set pulse encoder| | count the the | | high level pulse.| -| BYTE_ b_TriggerOutputAction : Digital TRIGGER output | +| unsigned char_ b_TriggerOutputAction : Digital TRIGGER output | | action | | 0 : No action | | 1 : Set the trigger | @@ -104,11 +104,11 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc | encoder | | ULONG_ ul_StartValue : Pulse encoder start value| | (1 to 4294967295) - b_ModulNbr =(BYTE) CR_AREF(insn->chanspec); - b_PulseEncoderNbr =(BYTE) data[0]; - b_InputLevelSelection =(BYTE) data[1]; - b_TriggerOutputAction =(BYTE) data[2]; - ul_StartValue =(ULONG) data[3]; + b_ModulNbr =(unsigned char) CR_AREF(insn->chanspec); + b_PulseEncoderNbr =(unsigned char) data[0]; + b_InputLevelSelection =(unsigned char) data[1]; + b_TriggerOutputAction =(unsigned char) data[2]; + ul_StartValue =(unsigned int) data[3]; | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -123,23 +123,23 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device * dev, +int i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = 0; - DWORD dw_IntRegister; + int i_ReturnValue = 0; + unsigned int dw_IntRegister; - BYTE b_ModulNbr; - BYTE b_PulseEncoderNbr; - BYTE b_InputLevelSelection; - BYTE b_TriggerOutputAction; - ULONG ul_StartValue; + unsigned char b_ModulNbr; + unsigned char b_PulseEncoderNbr; + unsigned char b_InputLevelSelection; + unsigned char b_TriggerOutputAction; + unsigned int ul_StartValue; - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_PulseEncoderNbr = (BYTE) data[0]; - b_InputLevelSelection = (BYTE) data[1]; - b_TriggerOutputAction = (BYTE) data[2]; - ul_StartValue = (ULONG) data[3]; + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_PulseEncoderNbr = (unsigned char) data[0]; + b_InputLevelSelection = (unsigned char) data[1]; + b_TriggerOutputAction = (unsigned char) data[2]; + ul_StartValue = (unsigned int) data[3]; i_ReturnValue = insn->n; @@ -352,11 +352,11 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_EnablePulseEncoder | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_PulseEncoderNbr, | -| BYTE_ b_CycleSelection, | -| BYTE_ b_InterruptHandling) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_PulseEncoderNbr, | +| unsigned char_ b_CycleSelection, | +| unsigned char_ b_InterruptHandling) | +----------------------------------------------------------------------------+ | Task : Enableor disable the selected pulse encoder (b_PulseEncoderNbr) | | from selected module (b_ModulNbr). Each input pulse | @@ -365,12 +365,12 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device * dev, | interrupt is generated when the pulse encoder has run | | down. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710| -| BYTE_ b_ModulNbr : Module number to | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710| +| unsigned char_ b_ModulNbr : Module number to | | configure (0 to 3) | -| BYTE_ b_PulseEncoderNbr : Pulse encoder selection | +| unsigned char_ b_PulseEncoderNbr : Pulse encoder selection | | (0 to 3) | -| BYTE_ b_CycleSelection : APCI1710_CONTINUOUS: | +| unsigned char_ b_CycleSelection : APCI1710_CONTINUOUS: | | Each time the | | counting value is set| | on "0", the pulse | @@ -381,7 +381,7 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device * dev, | If the counter is set| | on "0", the pulse | | encoder is stopped. | -| BYTE_ b_InterruptHandling : Interrupts can be | +| unsigned char_ b_InterruptHandling : Interrupts can be | | generated, when the pulse| | encoder has run down. | | With this parameter the | @@ -393,11 +393,11 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device * dev, | APCI1710_DISABLE: | | Interrupts are disabled - b_ModulNbr =(BYTE) CR_AREF(insn->chanspec); - b_Action =(BYTE) data[0]; - b_PulseEncoderNbr =(BYTE) data[1]; - b_CycleSelection =(BYTE) data[2]; - b_InterruptHandling =(BYTE) data[3];| + b_ModulNbr =(unsigned char) CR_AREF(insn->chanspec); + b_Action =(unsigned char) data[0]; + b_PulseEncoderNbr =(unsigned char) data[1]; + b_CycleSelection =(unsigned char) data[2]; + b_InterruptHandling =(unsigned char) data[3];| +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -414,22 +414,22 @@ INT i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device * dev, +int i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = 0; - BYTE b_ModulNbr; - BYTE b_PulseEncoderNbr; - BYTE b_CycleSelection; - BYTE b_InterruptHandling; - BYTE b_Action; + int i_ReturnValue = 0; + unsigned char b_ModulNbr; + unsigned char b_PulseEncoderNbr; + unsigned char b_CycleSelection; + unsigned char b_InterruptHandling; + unsigned char b_Action; i_ReturnValue = insn->n; - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_Action = (BYTE) data[0]; - b_PulseEncoderNbr = (BYTE) data[1]; - b_CycleSelection = (BYTE) data[2]; - b_InterruptHandling = (BYTE) data[3]; + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_Action = (unsigned char) data[0]; + b_PulseEncoderNbr = (unsigned char) data[1]; + b_CycleSelection = (unsigned char) data[2]; + b_InterruptHandling = (unsigned char) data[3]; /***********************************/ /* Test the selected module number */ @@ -515,7 +515,7 @@ INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device * dev, | (1UL << b_PulseEncoderNbr); - devpriv->tsk_Current = current; // Save the current process task structure + devpriv->tsk_Current = current; /* Save the current process task structure */ } @@ -629,7 +629,7 @@ INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device * dev, (64 * b_ModulNbr)); break; - } // switch End + } /* switch End */ } else { /*********************************/ @@ -662,33 +662,33 @@ INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ReadPulseEncoderStatus | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_PulseEncoderNbr, | -| PBYTE_ pb_Status) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_PulseEncoderNbr, | +| unsigned char *_ pb_Status) | +----------------------------------------------------------------------------+ | Task APCI1710_PULSEENCODER_READ : Reads the pulse encoder status and valuefrom selected pulse | | encoder (b_PulseEncoderNbr) from selected module | | (b_ModulNbr). | +----------------------------------------------------------------------------+ - BYTE b_Type; data[0] + unsigned char b_Type; data[0] APCI1710_PULSEENCODER_WRITE Writes a 32-bit value (ul_WriteValue) into the selected| | pulse encoder (b_PulseEncoderNbr) from selected module | | (b_ModulNbr). This operation set the new start pulse | | encoder value. APCI1710_PULSEENCODER_READ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710| -| CRAREF() BYTE_ b_ModulNbr : Module number to | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710| +| CRAREF() unsigned char_ b_ModulNbr : Module number to | | configure (0 to 3) | -| data[1] BYTE_ b_PulseEncoderNbr : Pulse encoder selection | +| data[1] unsigned char_ b_PulseEncoderNbr : Pulse encoder selection | | (0 to 3) APCI1710_PULSEENCODER_WRITE data[2] ULONG_ ul_WriteValue : 32-bit value to be | | written | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_Status : Pulse encoder status. | +| Output Parameters : unsigned char *_ pb_Status : Pulse encoder status. | | 0 : No overflow occur| | 1 : Overflow occur PULONG_ pul_ReadValue : Pulse encoder value | | @@ -702,30 +702,30 @@ INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -/*_INT_ i_APCI1710_ReadPulseEncoderStatus (BYTE_ b_BoardHandle, - BYTE_ b_ModulNbr, - BYTE_ b_PulseEncoderNbr, +/*_INT_ i_APCI1710_ReadPulseEncoderStatus (unsigned char_ b_BoardHandle, + unsigned char_ b_ModulNbr, + unsigned char_ b_PulseEncoderNbr, - PBYTE_ pb_Status) + unsigned char *_ pb_Status) */ -INT i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device * dev, +int i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = 0; - DWORD dw_StatusRegister; - BYTE b_ModulNbr; - BYTE b_PulseEncoderNbr; - PBYTE pb_Status; - BYTE b_Type; - PULONG pul_ReadValue; - ULONG ul_WriteValue; + int i_ReturnValue = 0; + unsigned int dw_StatusRegister; + unsigned char b_ModulNbr; + unsigned char b_PulseEncoderNbr; + unsigned char * pb_Status; + unsigned char b_Type; + unsigned int * pul_ReadValue; + unsigned int ul_WriteValue; i_ReturnValue = insn->n; - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_Type = (BYTE) data[0]; - b_PulseEncoderNbr = (BYTE) data[1]; - pb_Status = (PBYTE) & data[0]; - pul_ReadValue = (PULONG) & data[1]; + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_Type = (unsigned char) data[0]; + b_PulseEncoderNbr = (unsigned char) data[1]; + pb_Status = (unsigned char *) & data[0]; + pul_ReadValue = (unsigned int *) & data[1]; /***********************************/ /* Test the selected module number */ @@ -766,7 +766,7 @@ INT i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device * dev, dw_StatusRegister; *pb_Status = - (BYTE) (devpriv-> + (unsigned char) (devpriv-> s_ModuleInfo[b_ModulNbr]. s_PulseEncoderModuleInfo. dw_StatusRegister >> (1 + @@ -794,7 +794,7 @@ INT i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device * dev, break; case APCI1710_PULSEENCODER_WRITE: - ul_WriteValue = (ULONG) data[2]; + ul_WriteValue = (unsigned int) data[2]; /*******************/ /* Write the value */ /*******************/ @@ -805,7 +805,7 @@ INT i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device * dev, (4 * b_PulseEncoderNbr) + (64 * b_ModulNbr)); - } //end of switch + } /* end of switch */ } else { /*********************************/ /* Pulse encoder not initialised */ @@ -834,7 +834,7 @@ INT i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device * dev, return (i_ReturnValue); } -INT i_APCI1710_InsnReadInterruptPulseEncoder(struct comedi_device * dev, +int i_APCI1710_InsnReadInterruptPulseEncoder(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Inp_cpt.h b/drivers/staging/comedi/drivers/addi-data/APCI1710_Inp_cpt.h index 28252873e862..61a21cc94063 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Inp_cpt.h +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Inp_cpt.h @@ -21,11 +21,11 @@ #define APCI1710_PULSEENCODER_READ 0 #define APCI1710_PULSEENCODER_WRITE 1 -INT i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device *dev, +int i_APCI1710_InsnConfigInitPulseEncoder(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device *dev, +int i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); @@ -33,7 +33,7 @@ INT i_APCI1710_InsnWriteEnableDisablePulseEncoder(struct comedi_device *dev, /* * READ PULSE ENCODER FUNCTIONS */ -INT i_APCI1710_InsnReadInterruptPulseEncoder(struct comedi_device *dev, +int i_APCI1710_InsnReadInterruptPulseEncoder(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); @@ -41,7 +41,7 @@ INT i_APCI1710_InsnReadInterruptPulseEncoder(struct comedi_device *dev, /* * WRITE PULSE ENCODER FUNCTIONS */ -INT i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device *dev, +int i_APCI1710_InsnBitsReadWritePulseEncoder(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Pwm.c b/drivers/staging/comedi/drivers/addi-data/APCI1710_Pwm.c index 5ddd092a656a..976fe5863e49 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Pwm.c +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Pwm.c @@ -70,38 +70,38 @@ struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data) +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnConfigPWM(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1710_InsnConfigPWM(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - BYTE b_ConfigType; - INT i_ReturnValue = 0; + unsigned char 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 + i_ReturnValue = i_APCI1710_InitPWM(dev, (unsigned char) CR_AREF(insn->chanspec), /* b_ModulNbr */ + (unsigned char) data[0], /* b_PWM */ + (unsigned char) data[1], /* b_ClockSelection */ + (unsigned char) data[2], /* b_TimingUnit */ + (unsigned int) data[3], /* ul_LowTiming */ + (unsigned int) data[4], /* ul_HighTiming */ + (unsigned int *) & data[0], /* pul_RealLowTiming */ + (unsigned int *) & 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 + i_ReturnValue = i_APCI1710_GetPWMInitialisation(dev, (unsigned char) CR_AREF(insn->chanspec), /* b_ModulNbr */ + (unsigned char) data[0], /* b_PWM */ + (unsigned char *) & data[0], /* pb_TimingUnit */ + (unsigned int *) & data[1], /* pul_LowTiming */ + (unsigned int *) & data[2], /* pul_HighTiming */ + (unsigned char *) & data[3], /* pb_StartLevel */ + (unsigned char *) & data[4], /* pb_StopMode */ + (unsigned char *) & data[5], /* pb_StopLevel */ + (unsigned char *) & data[6], /* pb_ExternGate */ + (unsigned char *) & data[7], /* pb_InterruptEnable */ + (unsigned char *) & data[8] /* pb_Enable */ ); break; @@ -117,11 +117,11 @@ INT i_APCI1710_InsnConfigPWM(struct comedi_device * dev, struct comedi_subdevice /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_InitPWM | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_PWM, | -| BYTE_ b_ClockSelection, | -| BYTE_ b_TimingUnit, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_PWM, | +| unsigned char_ b_ClockSelection, | +| unsigned char_ b_TimingUnit, | | ULONG_ ul_LowTiming, | | ULONG_ ul_HighTiming, | | PULONG_ pul_RealLowTiming, | @@ -135,11 +135,11 @@ INT i_APCI1710_InsnConfigPWM(struct comedi_device * dev, struct comedi_subdevice | 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| +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Module number to configure| | (0 to 3) | -| BYTE_ b_PWM : Selected PWM (0 or 1). | -| BYTE_ b_ClockSelection : Selection from PCI bus | +| unsigned char_ b_PWM : Selected PWM (0 or 1). | +| unsigned char_ b_ClockSelection : Selection from PCI bus | | clock | | - APCI1710_30MHZ : | | The PC have a 30 MHz | @@ -151,7 +151,7 @@ INT i_APCI1710_InsnConfigPWM(struct comedi_device * dev, struct comedi_subdevice | The APCI-1710 have a | | integrated 40Mhz | | quartz. | -| BYTE_ b_TimingUnit : Base timing Unit (0 to 4) | +| unsigned char_ b_TimingUnit : Base timing Unit (0 to 4) | | 0 : ns | | 1 : æs | | 2 : ms | @@ -179,19 +179,19 @@ INT i_APCI1710_InsnConfigPWM(struct comedi_device * dev, struct comedi_subdevice +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InitPWM(struct 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_InitPWM(struct comedi_device * dev, + unsigned char b_ModulNbr, + unsigned char b_PWM, + unsigned char b_ClockSelection, + unsigned char b_TimingUnit, + unsigned int ul_LowTiming, + unsigned int ul_HighTiming, + unsigned int * pul_RealLowTiming, unsigned int * pul_RealHighTiming) { - INT i_ReturnValue = 0; - ULONG ul_LowTimerValue = 0; - ULONG ul_HighTimerValue = 0; - DWORD dw_Command; + int i_ReturnValue = 0; + unsigned int ul_LowTimerValue = 0; + unsigned int ul_HighTimerValue = 0; + unsigned int dw_Command; double d_RealLowTiming = 0; double d_RealHighTiming = 0; @@ -200,33 +200,33 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, /**************************/ 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) @@ -361,45 +361,45 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, && (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) + (unsigned int) (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 @@ -409,13 +409,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ *pul_RealLowTiming = - (ULONG) + (unsigned int) (ul_LowTimerValue / (0.00025 * (double)b_ClockSelection)); @@ -451,7 +451,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_LowTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_LowTimerValue) @@ -461,26 +461,26 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, break; - /******/ + /******/ /* æs */ - /******/ + /******/ case 1: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_LowTimerValue = - (ULONG) + (unsigned int) (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 @@ -490,13 +490,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ *pul_RealLowTiming = - (ULONG) + (unsigned int) (ul_LowTimerValue / (0.25 * (double)b_ClockSelection)); @@ -534,7 +534,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_LowTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_LowTimerValue) @@ -544,15 +544,15 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, break; - /******/ + /******/ /* ms */ - /******/ + /******/ case 2: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_LowTimerValue = @@ -562,9 +562,9 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, * b_ClockSelection); - /*******************/ + /*******************/ /* Round the value */ - /*******************/ + /*******************/ if ((double)((double)ul_LowTiming * (250.0 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) { ul_LowTimerValue @@ -574,13 +574,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ *pul_RealLowTiming = - (ULONG) + (unsigned int) (ul_LowTimerValue / (250.0 * (double)b_ClockSelection)); @@ -616,7 +616,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_LowTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_LowTimerValue) @@ -626,27 +626,27 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, break; - /*****/ + /*****/ /* s */ - /*****/ + /*****/ case 3: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_LowTimerValue = - (ULONG) + (unsigned int) (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 @@ -656,13 +656,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ *pul_RealLowTiming = - (ULONG) + (unsigned int) (ul_LowTimerValue / (250000.0 @@ -701,7 +701,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_LowTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_LowTimerValue) @@ -711,19 +711,19 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, break; - /******/ + /******/ /* mn */ - /******/ + /******/ case 4: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_LowTimerValue = - (ULONG) + (unsigned int) ( (ul_LowTiming * @@ -733,9 +733,9 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, * 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 @@ -745,13 +745,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ *pul_RealLowTiming = - (ULONG) + (unsigned int) (ul_LowTimerValue / (250000.0 @@ -795,7 +795,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_LowTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_LowTimerValue) @@ -806,31 +806,31 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, break; } - /*************************************/ + /*************************************/ /* Calculate the high division fator */ - /*************************************/ + /*************************************/ switch (b_TimingUnit) { - /******/ + /******/ /* ns */ - /******/ + /******/ case 0: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_HighTimerValue = - (ULONG) + (unsigned int) (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 @@ -840,13 +840,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ *pul_RealHighTiming = - (ULONG) + (unsigned int) (ul_HighTimerValue / (0.00025 * (double)b_ClockSelection)); @@ -882,7 +882,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_HighTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_HighTimerValue) @@ -892,26 +892,26 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, break; - /******/ + /******/ /* æs */ - /******/ + /******/ case 1: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_HighTimerValue = - (ULONG) + (unsigned int) (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 @@ -921,13 +921,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ *pul_RealHighTiming = - (ULONG) + (unsigned int) (ul_HighTimerValue / (0.25 * (double)b_ClockSelection)); @@ -965,7 +965,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_HighTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_HighTimerValue) @@ -975,15 +975,15 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, break; - /******/ + /******/ /* ms */ - /******/ + /******/ case 2: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_HighTimerValue = @@ -993,9 +993,9 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, * b_ClockSelection); - /*******************/ + /*******************/ /* Round the value */ - /*******************/ + /*******************/ if ((double)((double)ul_HighTiming * (250.0 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) { ul_HighTimerValue @@ -1005,13 +1005,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ *pul_RealHighTiming = - (ULONG) + (unsigned int) (ul_HighTimerValue / (250.0 * (double)b_ClockSelection)); @@ -1047,7 +1047,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_HighTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_HighTimerValue) @@ -1057,28 +1057,28 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, break; - /*****/ + /*****/ /* s */ - /*****/ + /*****/ case 3: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_HighTimerValue = - (ULONG) + (unsigned int) (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 @@ -1088,13 +1088,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ *pul_RealHighTiming = - (ULONG) + (unsigned int) (ul_HighTimerValue / (250000.0 @@ -1133,7 +1133,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_HighTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_HighTimerValue) @@ -1143,19 +1143,19 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, break; - /******/ + /******/ /* mn */ - /******/ + /******/ case 4: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_HighTimerValue = - (ULONG) + (unsigned int) ( (ul_HighTiming * @@ -1165,9 +1165,9 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, * 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 @@ -1177,13 +1177,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ *pul_RealHighTiming = - (ULONG) + (unsigned int) (ul_HighTimerValue / (250000.0 @@ -1227,7 +1227,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_HighTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_HighTimerValue) @@ -1239,9 +1239,9 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, } fpu_end(); - /****************************/ + /****************************/ /* Save the clock selection */ - /****************************/ + /****************************/ devpriv-> s_ModuleInfo @@ -1251,9 +1251,9 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, = b_ClockSelection; - /************************/ + /************************/ /* Save the timing unit */ - /************************/ + /************************/ devpriv-> s_ModuleInfo @@ -1265,9 +1265,9 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, = b_TimingUnit; - /****************************/ + /****************************/ /* Save the low base timing */ - /****************************/ + /****************************/ devpriv-> s_ModuleInfo @@ -1289,9 +1289,9 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, = *pul_RealLowTiming; - /****************************/ + /****************************/ /* Save the high base timing */ - /****************************/ + /****************************/ devpriv-> s_ModuleInfo @@ -1313,21 +1313,21 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, = *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 = @@ -1354,15 +1354,15 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, 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]. @@ -1373,65 +1373,65 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, = 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)) + } /* 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)) + } /* 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) + } /* 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) + } /* 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; } @@ -1442,29 +1442,29 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_GetPWMInitialisation | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_PWM, | -| PBYTE_ pb_TimingUnit, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_PWM, | +| unsigned char *_ 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) | +| unsigned char *_ pb_StartLevel, | +| unsigned char *_ pb_StopMode, | +| unsigned char *_ pb_StopLevel, | +| unsigned char *_ pb_ExternGate, | +| unsigned char *_ pb_InterruptEnable, | +| unsigned char *_ 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) | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3) | +| unsigned char_ b_PWM : Selected PWM (0 or 1) | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_TimingUnit : Base timing Unit (0 to 4) | +| Output Parameters : unsigned char *_ pb_TimingUnit : Base timing Unit (0 to 4) | | 0 : ns | | 1 : æs | | 2 : ms | @@ -1472,13 +1472,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, | 4 : mn | | PULONG_ pul_LowTiming : Low base timing value. | | PULONG_ pul_HighTiming : High base timing value. | -| PBYTE_ pb_StartLevel : Start period level | +| unsigned char *_ 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 | +| unsigned char *_ pb_StopMode : Stop mode selection | | 0 : The PWM is stopped | | directly after the | | "i_APCI1710_DisablePWM"| @@ -1489,7 +1489,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, | function the PWM is | | stopped at the end | | from last period cycle| -| PBYTE_ pb_StopLevel : Stop PWM level selection | +| unsigned char *_ pb_StopLevel : Stop PWM level selection | | 0 : The output signal | | keep the level after| | the | @@ -1504,13 +1504,13 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, | the | | "i_APCI1710_DisablePWM"| | function | -| PBYTE_ pb_ExternGate : Extern gate action | +| unsigned char *_ 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 | +| unsigned char *_ pb_InterruptEnable : Enable or disable the PWM | | interrupt. | | - APCI1710_ENABLE : | | Enable the PWM interrupt| @@ -1519,7 +1519,7 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, | - APCI1710_DISABLE : | | Disable the PWM | | interrupt | -| PBYTE_ pb_Enable : Indicate if the PWM is | +| unsigned char *_ pb_Enable : Indicate if the PWM is | | enabled or no | | 0 : PWM not enabled | | 1 : PWM enabled | @@ -1534,133 +1534,133 @@ INT i_APCI1710_InitPWM(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_GetPWMInitialisation(struct 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_GetPWMInitialisation(struct comedi_device * dev, + unsigned char b_ModulNbr, + unsigned char b_PWM, + unsigned char * pb_TimingUnit, + unsigned int * pul_LowTiming, + unsigned int * pul_HighTiming, + unsigned char * pb_StartLevel, + unsigned char * pb_StopMode, + unsigned char * pb_StopLevel, + unsigned char * pb_ExternGate, unsigned char * pb_InterruptEnable, unsigned char * pb_Enable) { - INT i_ReturnValue = 0; - DWORD dw_Status; - DWORD dw_Command; + int i_ReturnValue = 0; + unsigned int dw_Status; + unsigned int 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); + (unsigned char) ((dw_Command >> 5) & 1); *pb_StopMode = - (BYTE) ((dw_Command >> 0) & 1); + (unsigned char) ((dw_Command >> 0) & 1); *pb_StopLevel = - (BYTE) ((dw_Command >> 1) & 1); + (unsigned char) ((dw_Command >> 1) & 1); *pb_ExternGate = - (BYTE) ((dw_Command >> 4) & 1); + (unsigned char) ((dw_Command >> 4) & 1); *pb_InterruptEnable = - (BYTE) ((dw_Command >> 3) & 1); + (unsigned char) ((dw_Command >> 3) & 1); if (*pb_StopLevel) { *pb_StopLevel = *pb_StopLevel + - (BYTE) ((dw_Command >> + (unsigned char) ((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); + (unsigned char) ((dw_Command >> 0) & 1); *pb_TimingUnit = devpriv-> s_ModuleInfo[b_ModulNbr]. s_PWMModuleInfo. s_PWMInfo[b_PWM].b_TimingUnit; - } // if (dw_Status & 0x10) + } /* 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) + } /* 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) + } /* 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; } @@ -1683,33 +1683,33 @@ struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data) +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnWritePWM(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1710_InsnWritePWM(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - BYTE b_WriteType; - INT i_ReturnValue = 0; + unsigned char 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]); + (unsigned char) CR_AREF(insn->chanspec), + (unsigned char) data[0], + (unsigned char) data[1], + (unsigned char) data[2], + (unsigned char) data[3], (unsigned char) data[4], (unsigned char) data[5]); break; case APCI1710_PWM_DISABLE: i_ReturnValue = i_APCI1710_DisablePWM(dev, - (BYTE) CR_AREF(insn->chanspec), (BYTE) data[0]); + (unsigned char) CR_AREF(insn->chanspec), (unsigned char) 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]); + (unsigned char) CR_AREF(insn->chanspec), + (unsigned char) data[0], + (unsigned char) data[1], (unsigned int) data[2], (unsigned int) data[3]); break; default: @@ -1724,14 +1724,14 @@ INT i_APCI1710_InsnWritePWM(struct comedi_device * dev, struct comedi_subdevice /* +----------------------------------------------------------------------------+ | 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) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_PWM, | +| unsigned char_ b_StartLevel, | +| unsigned char_ b_StopMode, | +| unsigned char_ b_StopLevel, | +| unsigned char_ b_ExternGate, | +| unsigned char_ b_InterruptEnable) | +----------------------------------------------------------------------------+ | Task : Enable the selected PWM (b_PWM) from selected module | | (b_ModulNbr). You must calling the "i_APCI1710_InitPWM"| @@ -1741,16 +1741,16 @@ INT i_APCI1710_InsnWritePWM(struct comedi_device * dev, struct comedi_subdevice | 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 | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Selected module number | | (0 to 3) | -| BYTE_ b_PWM : Selected PWM (0 or 1) | -| BYTE_ b_StartLevel : Start period level selection | +| unsigned char_ b_PWM : Selected PWM (0 or 1) | +| unsigned char_ 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 | +| unsigned char_ b_StopMode : Stop mode selection | | 0 : The PWM is stopped | | directly after the | | "i_APCI1710_DisablePWM" | @@ -1761,7 +1761,7 @@ INT i_APCI1710_InsnWritePWM(struct comedi_device * dev, struct comedi_subdevice | function the PWM is | | stopped at the end from| | last period cycle. | -| BYTE_ b_StopLevel : Stop PWM level selection | +| unsigned char_ b_StopLevel : Stop PWM level selection | | 0 : The output signal keep | | the level after the | | "i_APCI1710_DisablePWM" | @@ -1774,11 +1774,11 @@ INT i_APCI1710_InsnWritePWM(struct comedi_device * dev, struct comedi_subdevice | to high after the | | "i_APCI1710_DisablePWM" | | function | -| BYTE_ b_ExternGate : Extern gate action selection | +| unsigned char_ 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 | +| unsigned char_ b_InterruptEnable : Enable or disable the PWM | | interrupt. | | - APCI1710_ENABLE : | | Enable the PWM interrupt | @@ -1806,77 +1806,77 @@ INT i_APCI1710_InsnWritePWM(struct comedi_device * dev, struct comedi_subdevice +----------------------------------------------------------------------------+ */ -INT i_APCI1710_EnablePWM(struct 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_EnablePWM(struct comedi_device * dev, + unsigned char b_ModulNbr, + unsigned char b_PWM, + unsigned char b_StartLevel, + unsigned char b_StopMode, + unsigned char b_StopLevel, unsigned char b_ExternGate, unsigned char b_InterruptEnable) { - INT i_ReturnValue = 0; - DWORD dw_Status; - DWORD dw_Command; + int i_ReturnValue = 0; + unsigned int dw_Status; + unsigned int dw_Command; - devpriv->tsk_Current = current; // Save the current process task structure + 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 = @@ -1895,9 +1895,9 @@ INT i_APCI1710_EnablePWM(struct comedi_device * dev, & 0x80; - /********************/ + /********************/ /* Make the command */ - /********************/ + /********************/ dw_Command = @@ -1943,88 +1943,88 @@ INT i_APCI1710_EnablePWM(struct comedi_device * dev, = 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) + } /* 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) + } /* 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) + } /* 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) + } /* 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) + } /* 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) + } /* 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) + } /* 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) + } /* 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; } @@ -2034,9 +2034,9 @@ INT i_APCI1710_EnablePWM(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ -| Function Name : _INT_ i_APCI1710_DisablePWM (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_PWM) | +| Function Name : _INT_ i_APCI1710_DisablePWM (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_PWM) | +----------------------------------------------------------------------------+ | Task : Disable the selected PWM (b_PWM) from selected module | | (b_ModulNbr). The output signal level depend of the | @@ -2045,8 +2045,8 @@ INT i_APCI1710_EnablePWM(struct comedi_device * dev, | 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) | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3) | +| unsigned char_ b_PWM : Selected PWM (0 or 1) | +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -2062,84 +2062,84 @@ INT i_APCI1710_EnablePWM(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_DisablePWM(struct comedi_device * dev, BYTE b_ModulNbr, BYTE b_PWM) +int i_APCI1710_DisablePWM(struct comedi_device * dev, unsigned char b_ModulNbr, unsigned char b_PWM) { - INT i_ReturnValue = 0; - DWORD dw_Status; + int i_ReturnValue = 0; + unsigned int 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) + } /* if (dw_Status & 0x1) */ else { - /*******************/ + /*******************/ /* PWM not enabled */ - /*******************/ + /*******************/ DPRINTK("PWM not enabled\n"); i_ReturnValue = -6; - } // if (dw_Status & 0x1) - } // if (dw_Status & 0x10) + } /* 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) + } /* 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) + } /* 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; } @@ -2150,11 +2150,11 @@ INT i_APCI1710_DisablePWM(struct comedi_device * dev, BYTE b_ModulNbr, BYTE b_PW /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_SetNewPWMTiming | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_PWM, | -| BYTE_ b_ClockSelection, | -| BYTE_ b_TimingUnit, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_PWM, | +| unsigned char_ b_ClockSelection, | +| unsigned char_ b_TimingUnit, | | ULONG_ ul_LowTiming, | | ULONG_ ul_HighTiming) | +----------------------------------------------------------------------------+ @@ -2162,11 +2162,11 @@ INT i_APCI1710_DisablePWM(struct comedi_device * dev, BYTE b_ModulNbr, BYTE b_PW | 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| +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ 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) | +| unsigned char_ b_PWM : Selected PWM (0 or 1). | +| unsigned char_ b_TimingUnit : Base timing Unit (0 to 4) | | 0 : ns | | 1 : æs | | 2 : ms | @@ -2189,18 +2189,18 @@ INT i_APCI1710_DisablePWM(struct comedi_device * dev, BYTE b_ModulNbr, BYTE b_PW +----------------------------------------------------------------------------+ */ -INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, - BYTE b_ModulNbr, - BYTE b_PWM, BYTE b_TimingUnit, ULONG ul_LowTiming, ULONG ul_HighTiming) +int i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, + unsigned char b_ModulNbr, + unsigned char b_PWM, unsigned char b_TimingUnit, unsigned int ul_LowTiming, unsigned int 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; + unsigned char b_ClockSelection; + int i_ReturnValue = 0; + unsigned int ul_LowTimerValue = 0; + unsigned int ul_HighTimerValue = 0; + unsigned int ul_RealLowTiming = 0; + unsigned int ul_RealHighTiming = 0; + unsigned int dw_Status; + unsigned int dw_Command; double d_RealLowTiming = 0; double d_RealHighTiming = 0; @@ -2209,21 +2209,21 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, /**************************/ 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) + @@ -2235,14 +2235,14 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, s_PWMModuleInfo. b_ClockSelection; - /************************/ + /************************/ /* Test the timing unit */ - /************************/ + /************************/ if (b_TimingUnit <= 4) { - /*********************************/ + /*********************************/ /* Test the low timing selection */ - /*********************************/ + /*********************************/ if (((b_ClockSelection == APCI1710_30MHZ) @@ -2377,37 +2377,37 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, && (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) + (unsigned int) (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 @@ -2417,13 +2417,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ ul_RealLowTiming = - (ULONG) + (unsigned int) (ul_LowTimerValue / (0.00025 * (double)b_ClockSelection)); @@ -2459,7 +2459,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_LowTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_LowTimerValue) @@ -2469,26 +2469,26 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, break; - /******/ + /******/ /* æs */ - /******/ + /******/ case 1: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_LowTimerValue = - (ULONG) + (unsigned int) (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 @@ -2498,13 +2498,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ ul_RealLowTiming = - (ULONG) + (unsigned int) (ul_LowTimerValue / (0.25 * (double)b_ClockSelection)); @@ -2542,7 +2542,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_LowTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_LowTimerValue) @@ -2552,15 +2552,15 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, break; - /******/ + /******/ /* ms */ - /******/ + /******/ case 2: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_LowTimerValue = @@ -2570,9 +2570,9 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, * b_ClockSelection); - /*******************/ + /*******************/ /* Round the value */ - /*******************/ + /*******************/ if ((double)((double)ul_LowTiming * (250.0 * (double)b_ClockSelection)) >= ((double)((double)ul_LowTimerValue + 0.5))) { ul_LowTimerValue @@ -2582,13 +2582,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ ul_RealLowTiming = - (ULONG) + (unsigned int) (ul_LowTimerValue / (250.0 * (double)b_ClockSelection)); @@ -2624,7 +2624,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_LowTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_LowTimerValue) @@ -2634,28 +2634,28 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, break; - /*****/ + /*****/ /* s */ - /*****/ + /*****/ case 3: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_LowTimerValue = - (ULONG) + (unsigned int) (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 @@ -2665,13 +2665,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ ul_RealLowTiming = - (ULONG) + (unsigned int) (ul_LowTimerValue / (250000.0 @@ -2710,7 +2710,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_LowTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_LowTimerValue) @@ -2720,19 +2720,19 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, break; - /******/ + /******/ /* mn */ - /******/ + /******/ case 4: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_LowTimerValue = - (ULONG) + (unsigned int) ( (ul_LowTiming * @@ -2742,9 +2742,9 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, * 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 @@ -2754,13 +2754,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ ul_RealLowTiming = - (ULONG) + (unsigned int) (ul_LowTimerValue / (250000.0 @@ -2804,7 +2804,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_LowTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_LowTimerValue) @@ -2815,31 +2815,31 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, break; } - /*************************************/ + /*************************************/ /* Calculate the high division fator */ - /*************************************/ + /*************************************/ switch (b_TimingUnit) { - /******/ + /******/ /* ns */ - /******/ + /******/ case 0: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_HighTimerValue = - (ULONG) + (unsigned int) (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 @@ -2849,13 +2849,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ ul_RealHighTiming = - (ULONG) + (unsigned int) (ul_HighTimerValue / (0.00025 * (double)b_ClockSelection)); @@ -2891,7 +2891,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_HighTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_HighTimerValue) @@ -2901,26 +2901,26 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, break; - /******/ + /******/ /* æs */ - /******/ + /******/ case 1: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_HighTimerValue = - (ULONG) + (unsigned int) (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 @@ -2930,13 +2930,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ ul_RealHighTiming = - (ULONG) + (unsigned int) (ul_HighTimerValue / (0.25 * (double)b_ClockSelection)); @@ -2974,7 +2974,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_HighTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_HighTimerValue) @@ -2984,15 +2984,15 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, break; - /******/ + /******/ /* ms */ - /******/ + /******/ case 2: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_HighTimerValue = @@ -3002,9 +3002,9 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, * b_ClockSelection); - /*******************/ + /*******************/ /* Round the value */ - /*******************/ + /*******************/ if ((double)((double)ul_HighTiming * (250.0 * (double)b_ClockSelection)) >= ((double)((double)ul_HighTimerValue + 0.5))) { ul_HighTimerValue @@ -3014,13 +3014,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ ul_RealHighTiming = - (ULONG) + (unsigned int) (ul_HighTimerValue / (250.0 * (double)b_ClockSelection)); @@ -3056,7 +3056,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_HighTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_HighTimerValue) @@ -3066,28 +3066,28 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, break; - /*****/ + /*****/ /* s */ - /*****/ + /*****/ case 3: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_HighTimerValue = - (ULONG) + (unsigned int) (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 @@ -3097,13 +3097,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ ul_RealHighTiming = - (ULONG) + (unsigned int) (ul_HighTimerValue / (250000.0 @@ -3142,7 +3142,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_HighTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_HighTimerValue) @@ -3152,19 +3152,19 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, break; - /******/ + /******/ /* mn */ - /******/ + /******/ case 4: - /******************/ + /******************/ /* Timer 0 factor */ - /******************/ + /******************/ ul_HighTimerValue = - (ULONG) + (unsigned int) ( (ul_HighTiming * @@ -3174,9 +3174,9 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, * 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 @@ -3186,13 +3186,13 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, 1; } - /*****************************/ + /*****************************/ /* Calculate the real timing */ - /*****************************/ + /*****************************/ ul_RealHighTiming = - (ULONG) + (unsigned int) (ul_HighTimerValue / (250000.0 @@ -3236,7 +3236,7 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, if (b_ClockSelection != APCI1710_40MHZ) { ul_HighTimerValue = - (ULONG) + (unsigned int) ( (double) (ul_HighTimerValue) @@ -3249,9 +3249,9 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, fpu_end(); - /************************/ + /************************/ /* Save the timing unit */ - /************************/ + /************************/ devpriv-> s_ModuleInfo @@ -3263,9 +3263,9 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, = b_TimingUnit; - /****************************/ + /****************************/ /* Save the low base timing */ - /****************************/ + /****************************/ devpriv-> s_ModuleInfo @@ -3287,9 +3287,9 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, = ul_RealLowTiming; - /****************************/ + /****************************/ /* Save the high base timing */ - /****************************/ + /****************************/ devpriv-> s_ModuleInfo @@ -3311,21 +3311,21 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, = 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 @@ -3347,9 +3347,9 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, 0x80; } - /***************************/ + /***************************/ /* Set the clock selection */ - /***************************/ + /***************************/ outl(dw_Command, devpriv-> @@ -3358,55 +3358,55 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, + 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)) + } /* 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) + } /* 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) + } /* 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) + } /* 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; } @@ -3417,37 +3417,37 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_GetPWMStatus | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_PWM, | -| PBYTE_ pb_PWMOutputStatus, | -| PBYTE_ pb_ExternGateStatus) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_PWM, | +| unsigned char *_ pb_PWMOutputStatus, | +| unsigned char *_ pb_ExternGateStatus) | +----------------------------------------------------------------------------+ | Task : Return the status from selected PWM (b_PWM) from | | selected module (b_ModulNbr). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_PWM : Selected PWM (0 or 1) | -| BYTE_ b_ModulNbr : Selected module number (0 to 3) - b_ModulNbr =(BYTE) CR_AREF(insn->chanspec); - b_PWM =(BYTE) data[0]; +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_PWM : Selected PWM (0 or 1) | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3) + b_ModulNbr =(unsigned char) CR_AREF(insn->chanspec); + b_PWM =(unsigned char) data[0]; | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_PWMOutputStatus : Return the PWM output | +| Output Parameters : unsigned char *_ pb_PWMOutputStatus : Return the PWM output | | level status. | | 0 : The PWM output level| | is low. | | 1 : The PWM output level| | is high. | -| PBYTE_ pb_ExternGateStatus : Return the extern gate | +| unsigned char *_ pb_ExternGateStatus : Return the extern gate | | level status. | | 0 : The extern gate is | | low. | | 1 : The extern gate is | | high. - pb_PWMOutputStatus =(PBYTE) data[0]; - pb_ExternGateStatus =(PBYTE) data[1]; | + pb_PWMOutputStatus =(unsigned char *) data[0]; + pb_ExternGateStatus =(unsigned char *) data[1]; | +----------------------------------------------------------------------------+ | Return Value : 0: No error | | -1: The handle parameter of the board is wrong | @@ -3460,99 +3460,99 @@ INT i_APCI1710_SetNewPWMTiming(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnReadGetPWMStatus(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1710_InsnReadGetPWMStatus(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = 0; - DWORD dw_Status; + int i_ReturnValue = 0; + unsigned int dw_Status; - BYTE b_ModulNbr; - BYTE b_PWM; - PBYTE pb_PWMOutputStatus; - PBYTE pb_ExternGateStatus; + unsigned char b_ModulNbr; + unsigned char b_PWM; + unsigned char * pb_PWMOutputStatus; + unsigned char * pb_ExternGateStatus; i_ReturnValue = insn->n; - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_PWM = (BYTE) CR_CHAN(insn->chanspec); - pb_PWMOutputStatus = (PBYTE) & data[0]; - pb_ExternGateStatus = (PBYTE) & data[1]; + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_PWM = (unsigned char) CR_CHAN(insn->chanspec); + pb_PWMOutputStatus = (unsigned char *) & data[0]; + pb_ExternGateStatus = (unsigned char *) & data[1]; /**************************/ /* 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) { *pb_PWMOutputStatus = - (BYTE) ((dw_Status >> 7) + (unsigned char) ((dw_Status >> 7) & 1); *pb_ExternGateStatus = - (BYTE) ((dw_Status >> 6) + (unsigned char) ((dw_Status >> 6) & 1); - } // if (dw_Status & 0x1) + } /* if (dw_Status & 0x1) */ else { - /*******************/ + /*******************/ /* PWM not enabled */ - /*******************/ + /*******************/ DPRINTK("PWM not enabled \n"); i_ReturnValue = -6; - } // if (dw_Status & 0x1) - } // if (dw_Status & 0x10) + } /* 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) + } /* 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) + } /* 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; @@ -3561,7 +3561,7 @@ INT i_APCI1710_InsnReadGetPWMStatus(struct comedi_device * dev, struct comedi_su return (i_ReturnValue); } -INT i_APCI1710_InsnBitsReadPWMInterrupt(struct comedi_device * dev, +int i_APCI1710_InsnBitsReadPWMInterrupt(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { data[0] = devpriv->s_InterruptParameters. @@ -3574,9 +3574,9 @@ INT i_APCI1710_InsnBitsReadPWMInterrupt(struct comedi_device * dev, s_FIFOInterruptParameters[devpriv-> s_InterruptParameters.ui_Read].ul_OldCounterLatchValue; - /**************************/ + /**************************/ /* Increment the read FIFO */ - /***************************/ + /***************************/ devpriv-> s_InterruptParameters. diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Pwm.h b/drivers/staging/comedi/drivers/addi-data/APCI1710_Pwm.h index c1b7f4ca47c3..07abf9126f78 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Pwm.h +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Pwm.h @@ -26,51 +26,51 @@ #define APCI1710_PWM_ENABLE 1 #define APCI1710_PWM_NEWTIMING 2 -INT i_APCI1710_InsnConfigPWM(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnConfigPWM(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_InitPWM(struct 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_InitPWM(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned char b_PWM, + unsigned char b_ClockSelection, + unsigned char b_TimingUnit, + unsigned int ul_LowTiming, + unsigned int ul_HighTiming, + unsigned int * pul_RealLowTiming, unsigned int * pul_RealHighTiming); -INT i_APCI1710_GetPWMInitialisation(struct 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_GetPWMInitialisation(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned char b_PWM, + unsigned char * pb_TimingUnit, + unsigned int * pul_LowTiming, + unsigned int * pul_HighTiming, + unsigned char * pb_StartLevel, + unsigned char * pb_StopMode, + unsigned char * pb_StopLevel, + unsigned char * pb_ExternGate, + unsigned char * pb_InterruptEnable, unsigned char * pb_Enable); -INT i_APCI1710_InsnWritePWM(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnWritePWM(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_EnablePWM(struct 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_EnablePWM(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned char b_PWM, + unsigned char b_StartLevel, + unsigned char b_StopMode, + unsigned char b_StopLevel, unsigned char b_ExternGate, + unsigned char b_InterruptEnable); -INT i_APCI1710_SetNewPWMTiming(struct comedi_device *dev, - BYTE b_ModulNbr, - BYTE b_PWM, BYTE b_TimingUnit, - ULONG ul_LowTiming, ULONG ul_HighTiming); +int i_APCI1710_SetNewPWMTiming(struct comedi_device *dev, + unsigned char b_ModulNbr, + unsigned char b_PWM, unsigned char b_TimingUnit, + unsigned int ul_LowTiming, unsigned int ul_HighTiming); -INT i_APCI1710_DisablePWM(struct comedi_device *dev, BYTE b_ModulNbr, BYTE b_PWM); +int i_APCI1710_DisablePWM(struct comedi_device *dev, unsigned char b_ModulNbr, unsigned char b_PWM); -INT i_APCI1710_InsnReadGetPWMStatus(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnReadGetPWMStatus(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_InsnBitsReadPWMInterrupt(struct comedi_device *dev, +int i_APCI1710_InsnBitsReadPWMInterrupt(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Ssi.c b/drivers/staging/comedi/drivers/addi-data/APCI1710_Ssi.c index bb6e1622e379..238fcc88b15c 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Ssi.c +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Ssi.c @@ -65,31 +65,31 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_InitSSI | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_SSIProfile, | -| BYTE_ b_PositionTurnLength, | -| BYTE_ b_TurnCptLength, | -| BYTE_ b_PCIInputClock, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_SSIProfile, | +| unsigned char_ b_PositionTurnLength, | +| unsigned char_ b_TurnCptLength, | +| unsigned char_ b_PCIInputClock, | | ULONG_ ul_SSIOutputClock, | -| BYTE_ b_SSICountingMode) | +| unsigned char_ b_SSICountingMode) | +----------------------------------------------------------------------------+ | Task : Configure the SSI operating mode from selected module | | (b_ModulNbr). You must calling this function be for you| | call any other function witch access of SSI. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710| -| BYTE_ b_ModulNbr : Module number to | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710| +| unsigned char_ b_ModulNbr : Module number to | | configure (0 to 3) | -| BYTE_ b_SSIProfile : Selection from SSI | +| unsigned char_ b_SSIProfile : Selection from SSI | | profile length (2 to 32).| -| BYTE_ b_PositionTurnLength : Selection from SSI | +| unsigned char_ b_PositionTurnLength : Selection from SSI | | position data length | | (1 to 31). | -| BYTE_ b_TurnCptLength : Selection from SSI turn | +| unsigned char_ b_TurnCptLength : Selection from SSI turn | | counter data length | | (1 to 31). | -| BYTE b_PCIInputClock : Selection from PCI bus | +| unsigned char b_PCIInputClock : Selection from PCI bus | | clock | | - APCI1710_30MHZ : | | The PC have a PCI bus | @@ -103,7 +103,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc | for 30 MHz selection. | | From 252 to 5 000 000 Hz| | for 33 MHz selection. | -| BYTE b_SSICountingMode : SSI counting mode | +| unsigned char b_SSICountingMode : SSI counting mode | | selection | | - APCI1710_BINARY_MODE : | | Binary counting mode. | @@ -111,12 +111,12 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc | Gray counting mode. b_ModulNbr = CR_AREF(insn->chanspec); - b_SSIProfile = (BYTE) data[0]; - b_PositionTurnLength= (BYTE) data[1]; - b_TurnCptLength = (BYTE) data[2]; - b_PCIInputClock = (BYTE) data[3]; - ul_SSIOutputClock = (ULONG) data[4]; - b_SSICountingMode = (BYTE) data[5]; | + b_SSIProfile = (unsigned char) data[0]; + b_PositionTurnLength= (unsigned char) data[1]; + b_TurnCptLength = (unsigned char) data[2]; + b_PCIInputClock = (unsigned char) data[3]; + ul_SSIOutputClock = (unsigned int) data[4]; + b_SSICountingMode = (unsigned char) data[5]; | +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -133,22 +133,22 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnConfigInitSSI(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1710_InsnConfigInitSSI(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = 0; - UINT ui_TimerValue; - BYTE b_ModulNbr, b_SSIProfile, b_PositionTurnLength, b_TurnCptLength, + int i_ReturnValue = 0; + unsigned int ui_TimerValue; + unsigned char b_ModulNbr, b_SSIProfile, b_PositionTurnLength, b_TurnCptLength, b_PCIInputClock, b_SSICountingMode; - ULONG ul_SSIOutputClock; + unsigned int ul_SSIOutputClock; b_ModulNbr = CR_AREF(insn->chanspec); - b_SSIProfile = (BYTE) data[0]; - b_PositionTurnLength = (BYTE) data[1]; - b_TurnCptLength = (BYTE) data[2]; - b_PCIInputClock = (BYTE) data[3]; - ul_SSIOutputClock = (ULONG) data[4]; - b_SSICountingMode = (BYTE) data[5]; + b_SSIProfile = (unsigned char) data[0]; + b_PositionTurnLength = (unsigned char) data[1]; + b_TurnCptLength = (unsigned char) data[2]; + b_PCIInputClock = (unsigned char) data[3]; + ul_SSIOutputClock = (unsigned int) data[4]; + b_SSICountingMode = (unsigned char) data[5]; i_ReturnValue = insn->n; /**************************/ @@ -167,7 +167,7 @@ INT i_APCI1710_InsnConfigInitSSI(struct comedi_device * dev, struct comedi_subde /* Test the SSI profile length */ /*******************************/ - // CG 22/03/00 b_SSIProfile >= 2 anstatt b_SSIProfile > 2 + /* CG 22/03/00 b_SSIProfile >= 2 anstatt b_SSIProfile > 2 */ if (b_SSIProfile >= 2 && b_SSIProfile < 33) { /*************************************/ /* Test the SSI position data length */ @@ -250,9 +250,9 @@ INT i_APCI1710_InsnConfigInitSSI(struct comedi_device * dev, struct comedi_subde ui_TimerValue = - (UINT) + (unsigned int) ( - ((ULONG) (b_PCIInputClock) * 500000UL) / ul_SSIOutputClock); + ((unsigned int) (b_PCIInputClock) * 500000UL) / ul_SSIOutputClock); /************************/ /* Initialise the timer */ @@ -357,12 +357,12 @@ INT i_APCI1710_InsnConfigInitSSI(struct comedi_device * dev, struct comedi_subde /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_Read1SSIValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_SelectedSSI, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_SelectedSSI, | | PULONG_ pul_Position, | | PULONG_ pul_TurnCpt) - INT i_APCI1710_ReadSSIValue(struct comedi_device *dev,struct comedi_subdevice *s, + int i_APCI1710_ReadSSIValue(struct comedi_device *dev,struct comedi_subdevice *s, struct comedi_insn *insn,unsigned int *data) | +----------------------------------------------------------------------------+ | Task : @@ -373,22 +373,22 @@ INT i_APCI1710_InsnConfigInitSSI(struct comedi_device * dev, struct comedi_subde or Read all SSI counter (b_SelectedSSI) from | | selected module (b_ModulNbr). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710| -| BYTE_ b_ModulNbr : Module number to | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710| +| unsigned char_ b_ModulNbr : Module number to | | configure (0 to 3) | -| BYTE_ b_SelectedSSI : Selection from SSI | +| unsigned char_ b_SelectedSSI : Selection from SSI | | counter (0 to 2) - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_SelectedSSI = (BYTE) CR_CHAN(insn->chanspec); (in case of single ssi) - b_ReadType = (BYTE) CR_RANGE(insn->chanspec); + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_SelectedSSI = (unsigned char) CR_CHAN(insn->chanspec); (in case of single ssi) + b_ReadType = (unsigned char) CR_RANGE(insn->chanspec); | +----------------------------------------------------------------------------+ | Output Parameters : PULONG_ pul_Position : SSI position in the turn | | PULONG_ pul_TurnCpt : Number of turns -pul_Position = (PULONG) &data[0]; - pul_TurnCpt = (PULONG) &data[1]; | +pul_Position = (unsigned int *) &data[0]; + pul_TurnCpt = (unsigned int *) &data[1]; | +----------------------------------------------------------------------------+ | Return Value : 0: No error | | -1: The handle parameter of the board is wrong | @@ -400,37 +400,37 @@ pul_Position = (PULONG) &data[0]; +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnReadSSIValue(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1710_InsnReadSSIValue(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = 0; - BYTE b_Cpt; - BYTE b_Length; - BYTE b_Schift; - BYTE b_SSICpt; - DWORD dw_And; - DWORD dw_And1; - DWORD dw_And2; - DWORD dw_StatusReg; - DWORD dw_CounterValue; - BYTE b_ModulNbr; - BYTE b_SelectedSSI; - BYTE b_ReadType; - PULONG pul_Position; - PULONG pul_TurnCpt; - PULONG pul_Position1; - PULONG pul_TurnCpt1; + int i_ReturnValue = 0; + unsigned char b_Cpt; + unsigned char b_Length; + unsigned char b_Schift; + unsigned char b_SSICpt; + unsigned int dw_And; + unsigned int dw_And1; + unsigned int dw_And2; + unsigned int dw_StatusReg; + unsigned int dw_CounterValue; + unsigned char b_ModulNbr; + unsigned char b_SelectedSSI; + unsigned char b_ReadType; + unsigned int * pul_Position; + unsigned int * pul_TurnCpt; + unsigned int * pul_Position1; + unsigned int * 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 - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_SelectedSSI = (BYTE) CR_CHAN(insn->chanspec); - b_ReadType = (BYTE) CR_RANGE(insn->chanspec); + pul_Position1 = (unsigned int *) & data[0]; +/* For Read1 */ + pul_TurnCpt1 = (unsigned int *) & data[1]; +/* For Read all */ + pul_Position = (unsigned int *) & data[0]; /* 0-2 */ + pul_TurnCpt = (unsigned int *) & data[3]; /* 3-5 */ + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_SelectedSSI = (unsigned char) CR_CHAN(insn->chanspec); + b_ReadType = (unsigned char) CR_RANGE(insn->chanspec); /**************************/ /* Test the module number */ @@ -667,7 +667,7 @@ INT i_APCI1710_InsnReadSSIValue(struct comedi_device * dev, struct comedi_subdev default: printk("Read Type Inputs Wrong\n"); - } // switch ending + } /* switch ending */ } else { /***********************/ @@ -701,10 +701,10 @@ INT i_APCI1710_InsnReadSSIValue(struct comedi_device * dev, struct comedi_subdev /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ReadSSI1DigitalInput | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_InputChannel, | -| PBYTE_ pb_ChannelStatus) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_InputChannel, | +| unsigned char *_ pb_ChannelStatus) | +----------------------------------------------------------------------------+ | Task : (0) Set the digital output from selected SSI moule | @@ -716,13 +716,13 @@ INT i_APCI1710_InsnReadSSIValue(struct comedi_device * dev, struct comedi_subdev (3)Read the status from all SSI digital inputs from | | selected SSI module (b_ModulNbr) | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710| -| BYTE_ b_ModulNbr CR_AREF : Module number to | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710| +| unsigned char_ b_ModulNbr CR_AREF : Module number to | | configure (0 to 3) | -| BYTE_ b_InputChannel CR_CHAN : Selection from digital | +| unsigned char_ b_InputChannel CR_CHAN : Selection from digital | | data[0] which IOTYPE input ( 0 to 2) | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_ChannelStatus : Digital input channel | +| Output Parameters : unsigned char *_ pb_ChannelStatus : Digital input channel | | data[0] status | | 0 : Channle is not active| | 1 : Channle is active | @@ -735,19 +735,19 @@ INT i_APCI1710_InsnReadSSIValue(struct comedi_device * dev, struct comedi_subdev +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = 0; - DWORD dw_StatusReg; - BYTE b_ModulNbr; - BYTE b_InputChannel; - PBYTE pb_ChannelStatus; - PBYTE pb_InputStatus; - BYTE b_IOType; + int i_ReturnValue = 0; + unsigned int dw_StatusReg; + unsigned char b_ModulNbr; + unsigned char b_InputChannel; + unsigned char * pb_ChannelStatus; + unsigned char * pb_InputStatus; + unsigned char b_IOType; i_ReturnValue = insn->n; - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_IOType = (BYTE) data[0]; + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_IOType = (unsigned char) data[0]; /**************************/ /* Test the module number */ @@ -785,8 +785,8 @@ INT i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device * dev, struct comedi_su /* Test the digital imnput channel number */ /******************************************/ - b_InputChannel = (BYTE) CR_CHAN(insn->chanspec); - pb_ChannelStatus = (PBYTE) & data[0]; + b_InputChannel = (unsigned char) CR_CHAN(insn->chanspec); + pb_ChannelStatus = (unsigned char *) & data[0]; if (b_InputChannel <= 2) { /**************************/ @@ -797,7 +797,7 @@ INT i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device * dev, struct comedi_su inl(devpriv->s_BoardInfos. ui_Address + (64 * b_ModulNbr)); *pb_ChannelStatus = - (BYTE) (((~dw_StatusReg) >> (4 + + (unsigned char) (((~dw_StatusReg) >> (4 + b_InputChannel)) & 1); } else { @@ -814,19 +814,19 @@ INT i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device * dev, struct comedi_su /**************************/ /* Read all digital input */ /**************************/ - pb_InputStatus = (PBYTE) & data[0]; + pb_InputStatus = (unsigned char *) & data[0]; dw_StatusReg = inl(devpriv->s_BoardInfos.ui_Address + (64 * b_ModulNbr)); *pb_InputStatus = - (BYTE) (((~dw_StatusReg) >> 4) & 7); + (unsigned char) (((~dw_StatusReg) >> 4) & 7); break; default: printk("IO type wrong\n"); - } //switch end + } /* switch end */ } else { /**********************************/ /* The module is not a SSI module */ diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Ssi.h b/drivers/staging/comedi/drivers/addi-data/APCI1710_Ssi.h index 88daad1a3912..eb7f101d2d61 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Ssi.h +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Ssi.h @@ -33,11 +33,11 @@ /* * SSI INISIALISATION FUNCTION */ -INT i_APCI1710_InsnConfigInitSSI(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnConfigInitSSI(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_InsnReadSSIValue(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnReadSSIValue(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnBitsSSIDigitalIO(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Tor.c b/drivers/staging/comedi/drivers/addi-data/APCI1710_Tor.c index 90316e10a3bd..dc35124a7584 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Tor.c +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Tor.c @@ -63,11 +63,11 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_InitTorCounter | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_TorCounter, | -| BYTE_ b_PCIInputClock, | -| BYTE_ b_TimingUnit, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_TorCounter, | +| unsigned char_ b_PCIInputClock, | +| unsigned char_ b_TimingUnit, | | ULONG_ ul_TimingInterval, | | PULONG_ pul_RealTimingInterval) | +----------------------------------------------------------------------------+ @@ -82,11 +82,11 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc +----------------------------------------------------------------------------+ | Input Parameters : | | - CR_AREF BYTE_ b_ModulNbr : Module number to configure | + CR_AREF unsigned char_ b_ModulNbr : Module number to configure | | (0 to 3) | -| data[0] BYTE_ b_TorCounter : Tor counter selection | +| data[0] unsigned char_ b_TorCounter : Tor counter selection | | (0 or 1). | -| data[1] BYTE_ b_PCIInputClock : Selection from PCI bus clock| +| data[1] unsigned char_ b_PCIInputClock : Selection from PCI bus clock| | - APCI1710_30MHZ : | | The PC have a PCI bus | | clock from 30 MHz | @@ -104,7 +104,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc | than it is not possibl to | | used the gate input for | | enabled the acquisition | -| data[2] BYTE_ b_TimingUnit : Base timing unit (0 to 4) | +| data[2] unsigned char_ b_TimingUnit : Base timing unit (0 to 4) | | 0 : ns | | 1 : µs | | 2 : ms | @@ -130,27 +130,27 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, +int i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = 0; - ULONG ul_TimerValue = 0; - DWORD dw_Command; + int i_ReturnValue = 0; + unsigned int ul_TimerValue = 0; + unsigned int dw_Command; double d_RealTimingInterval = 0; - BYTE b_ModulNbr; - BYTE b_TorCounter; - BYTE b_PCIInputClock; - BYTE b_TimingUnit; - ULONG ul_TimingInterval; - ULONG ul_RealTimingInterval = 0; + unsigned char b_ModulNbr; + unsigned char b_TorCounter; + unsigned char b_PCIInputClock; + unsigned char b_TimingUnit; + unsigned int ul_TimingInterval; + unsigned int ul_RealTimingInterval = 0; i_ReturnValue = insn->n; - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); - b_TorCounter = (BYTE) data[0]; - b_PCIInputClock = (BYTE) data[1]; - b_TimingUnit = (BYTE) data[2]; - ul_TimingInterval = (ULONG) data[3]; + b_TorCounter = (unsigned char) data[0]; + b_PCIInputClock = (unsigned char) data[1]; + b_TimingUnit = (unsigned char) data[2]; + ul_TimingInterval = (unsigned int) data[3]; printk("INPUT clock %d\n", b_PCIInputClock); /**************************/ @@ -225,7 +225,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, ul_TimerValue = - (ULONG) + (unsigned int) (ul_TimingInterval * (0.00025 * b_PCIInputClock)); @@ -248,7 +248,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, ul_RealTimingInterval = - (ULONG) + (unsigned int) (ul_TimerValue / (0.00025 * (double)b_PCIInputClock)); @@ -284,7 +284,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, if (b_PCIInputClock != APCI1710_40MHZ) { ul_TimerValue = - (ULONG) + (unsigned int) ( (double) (ul_TimerValue) @@ -306,7 +306,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, ul_TimerValue = - (ULONG) + (unsigned int) (ul_TimingInterval * (0.25 * b_PCIInputClock)); @@ -329,7 +329,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, ul_RealTimingInterval = - (ULONG) + (unsigned int) (ul_TimerValue / (0.25 * (double)b_PCIInputClock)); @@ -367,7 +367,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, if (b_PCIInputClock != APCI1710_40MHZ) { ul_TimerValue = - (ULONG) + (unsigned int) ( (double) (ul_TimerValue) @@ -413,7 +413,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, ul_RealTimingInterval = - (ULONG) + (unsigned int) (ul_TimerValue / (250.0 * (double)b_PCIInputClock)); @@ -449,7 +449,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, if (b_PCIInputClock != APCI1710_40MHZ) { ul_TimerValue = - (ULONG) + (unsigned int) ( (double) (ul_TimerValue) @@ -471,7 +471,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, ul_TimerValue = - (ULONG) + (unsigned int) (ul_TimingInterval * (250000.0 @@ -496,7 +496,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, ul_RealTimingInterval = - (ULONG) + (unsigned int) (ul_TimerValue / (250000.0 @@ -535,7 +535,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, if (b_PCIInputClock != APCI1710_40MHZ) { ul_TimerValue = - (ULONG) + (unsigned int) ( (double) (ul_TimerValue) @@ -557,7 +557,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, ul_TimerValue = - (ULONG) + (unsigned int) ( (ul_TimingInterval * @@ -585,7 +585,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, ul_RealTimingInterval = - (ULONG) + (unsigned int) (ul_TimerValue / (250000.0 @@ -629,7 +629,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, if (b_PCIInputClock != APCI1710_40MHZ) { ul_TimerValue = - (ULONG) + (unsigned int) ( (double) (ul_TimerValue) @@ -641,7 +641,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, } fpu_end(); - } // if (b_PCIInputClock != APCI1710_GATE_INPUT) + } /* if (b_PCIInputClock != APCI1710_GATE_INPUT) */ else { /*************************************************************/ /* 2 Clock used for the overflow and the reload from counter */ @@ -652,7 +652,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, ul_TimingInterval - 2; - } // if (b_PCIInputClock != APCI1710_GATE_INPUT) + } /* if (b_PCIInputClock != APCI1710_GATE_INPUT) */ /****************************/ /* Save the PCI input clock */ @@ -814,7 +814,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, DPRINTK("Base timing selection is wrong\n"); i_ReturnValue = -7; } - } // if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) + } /* if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */ else { /**********************************/ /* Timing unit selection is wrong */ @@ -822,8 +822,8 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, 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)) + } /* if ((b_TimingUnit >= 0) && (b_TimingUnit <= 4)) */ + } /* if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ)) */ else { /*****************************************/ /* The selected PCI input clock is wrong */ @@ -831,8 +831,8 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, 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) + } /* if ((b_PCIInputClock == APCI1710_30MHZ) || (b_PCIInputClock == APCI1710_33MHZ)) */ + } /* if (b_TorCounterMode >= 0 && b_TorCounterMode <= 7) */ else { /**********************************/ /* Tor Counter selection is wrong */ @@ -840,7 +840,7 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, DPRINTK("Tor Counter selection is wrong\n"); i_ReturnValue = -4; - } // if (b_TorCounterMode >= 0 && b_TorCounterMode <= 7) + } /* if (b_TorCounterMode >= 0 && b_TorCounterMode <= 7) */ } else { /******************************************/ /* The module is not a tor counter module */ @@ -857,20 +857,20 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, DPRINTK("Module number error\n"); i_ReturnValue = -2; } - data[0] = (UINT) ul_RealTimingInterval; + data[0] = (unsigned int) ul_RealTimingInterval; return (i_ReturnValue); } /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_EnableTorCounter | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_TorCounter, | -| BYTE_ b_InputMode, | -| BYTE_ b_ExternGate, | -| BYTE_ b_CycleMode, | -| BYTE_ b_InterruptEnable) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_TorCounter, | +| unsigned char_ b_InputMode, | +| unsigned char_ b_ExternGate, | +| unsigned char_ b_CycleMode, | +| unsigned char_ b_InterruptEnable) | +----------------------------------------------------------------------------+ | Task : Enable the tor counter (b_TorCounter) from selected | | module (b_ModulNbr). You must calling the | @@ -883,13 +883,13 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, | The b_CycleMode parameter determine if you will | | measured a single or more cycle. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number (0 to 3) | -| BYTE_ b_TorCounter : Tor counter selection (0 or 1). | -| BYTE_ b_InputMode : Input signal level selection | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3) | +| unsigned char_ b_TorCounter : Tor counter selection (0 or 1). | +| unsigned char_ b_InputMode : Input signal level selection | | 0 : Tor count each low level | | 1 : Tor count each high level| -| BYTE_ b_ExternGate : Extern gate action selection | +| unsigned char_ b_ExternGate : Extern gate action selection | | 0 : Extern gate signal not | | used | | 1 : Extern gate signal used. | @@ -928,9 +928,9 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, | The gate input is used for the | | signal B | | | -| BYTE_ b_CycleMode : Selected the tor counter | +| unsigned char_ b_CycleMode : Selected the tor counter | | acquisition mode | -| BYTE_ b_InterruptEnable : Enable or disable the | +| unsigned char_ b_InterruptEnable : Enable or disable the | | tor counter interrupt. | | APCI1710_ENABLE: | | Enable the tor counter | @@ -959,9 +959,9 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_DisableTorCounter | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_TorCounter) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_TorCounter) | +----------------------------------------------------------------------------+ | Task : Disable the tor counter (b_TorCounter) from selected | | module (b_ModulNbr). If you disable the tor counter | @@ -969,9 +969,9 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, | counter witch the " i_APCI1710_EnableTorCounter" | | function, the status register is cleared | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number (0 to 3) | -| BYTE_ b_TorCounter : Tor counter selection (0 or 1). | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3) | +| unsigned char_ b_TorCounter : Tor counter selection (0 or 1). | +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -987,29 +987,29 @@ INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, +int i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = 0; - DWORD dw_Status; - DWORD dw_DummyRead; - DWORD dw_ConfigReg; - BYTE b_ModulNbr, b_Action; - BYTE b_TorCounter; - BYTE b_InputMode; - BYTE b_ExternGate; - BYTE b_CycleMode; - BYTE b_InterruptEnable; - - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_Action = (BYTE) data[0]; // enable or disable - b_TorCounter = (BYTE) data[1]; - b_InputMode = (BYTE) data[2]; - b_ExternGate = (BYTE) data[3]; - b_CycleMode = (BYTE) data[4]; - b_InterruptEnable = (BYTE) data[5]; + int i_ReturnValue = 0; + unsigned int dw_Status; + unsigned int dw_DummyRead; + unsigned int dw_ConfigReg; + unsigned char b_ModulNbr, b_Action; + unsigned char b_TorCounter; + unsigned char b_InputMode; + unsigned char b_ExternGate; + unsigned char b_CycleMode; + unsigned char b_InterruptEnable; + + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_Action = (unsigned char) data[0]; /* enable or disable */ + b_TorCounter = (unsigned char) data[1]; + b_InputMode = (unsigned char) data[2]; + b_ExternGate = (unsigned char) data[3]; + b_CycleMode = (unsigned char) data[4]; + b_InterruptEnable = (unsigned char) data[5]; i_ReturnValue = insn->n;; - devpriv->tsk_Current = current; // Save the current process task structure + devpriv->tsk_Current = current; /* Save the current process task structure */ /**************************/ /* Test the module number */ /**************************/ @@ -1027,7 +1027,7 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, /**********************************/ if (b_TorCounter <= 1) { - switch (b_Action) // Enable or Disable + switch (b_Action) /* Enable or Disable */ { case APCI1710_ENABLE: /***********************************/ @@ -1149,7 +1149,7 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, | 0x780; - } // if (b_InputMode == APCI1710_TOR_SIMPLE_MODE) + } /* if (b_InputMode == APCI1710_TOR_SIMPLE_MODE) */ /***********************/ /* Test if double mode */ @@ -1166,12 +1166,12 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, | 0x180; - } // if (b_InputMode == APCI1710_TOR_DOUBLE_MODE) + } /* if (b_InputMode == APCI1710_TOR_DOUBLE_MODE) */ b_InputMode = 0; - } // if (b_InputMode > 1) + } /* if (b_InputMode > 1) */ /*******************/ /* Set the command */ @@ -1237,7 +1237,7 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, outl(1, devpriv->s_BoardInfos.ui_Address + 8 + (16 * b_TorCounter) + (64 * b_ModulNbr)); - } // if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) + } /* if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) */ else { /********************************/ /* Interrupt parameter is wrong */ @@ -1247,8 +1247,8 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, i_ReturnValue = -9; - } // if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) - } // if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS)) + } /* if ((b_InterruptEnable == APCI1710_ENABLE) || (b_InterruptEnable == APCI1710_DISABLE)) */ + } /* if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS)) */ else { /***********************************************/ /* Tor counter acquisition mode cycle is wrong */ @@ -1258,8 +1258,8 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, i_ReturnValue = -8; - } // if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS)) - } // if (b_ExternGate >= 0 && b_ExternGate <= 1) + } /* if ((b_CycleMode == APCI1710_SINGLE) || (b_CycleMode == APCI1710_CONTINUOUS)) */ + } /* if (b_ExternGate >= 0 && b_ExternGate <= 1) */ else { /***********************************/ /* Extern gate input mode is wrong */ @@ -1268,8 +1268,8 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, 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) + } /* if (b_ExternGate >= 0 && b_ExternGate <= 1) */ + } /* if (b_InputMode >= 0 && b_InputMode <= 1) */ else { /***************************************/ /* Tor input signal selection is wrong */ @@ -1329,7 +1329,7 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, s_BoardInfos. ui_Address + 8 + (16 * b_TorCounter) + (64 * b_ModulNbr)); - } // if (dw_Status & 0x1) + } /* if (dw_Status & 0x1) */ else { /***************************/ /* Tor counter not enabled */ @@ -1337,8 +1337,8 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, DPRINTK("Tor counter not enabled \n"); i_ReturnValue = -6; - } // if (dw_Status & 0x1) - } // if (dw_Status & 0x10) + } /* if (dw_Status & 0x1) */ + } /* if (dw_Status & 0x10) */ else { /*******************************/ /* Tor counter not initialised */ @@ -1346,10 +1346,10 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, DPRINTK("Tor counter not initialised\n"); i_ReturnValue = -5; - } // // if (dw_Status & 0x10) + } /* // if (dw_Status & 0x10) */ - } // switch - } // if (b_TorCounter <= 1) + } /* switch */ + } /* if (b_TorCounter <= 1) */ else { /**********************************/ /* Tor counter selection is wrong */ @@ -1357,7 +1357,7 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, DPRINTK("Tor counter selection is wrong\n"); i_ReturnValue = -4; - } // if (b_TorCounter <= 1) + } /* if (b_TorCounter <= 1) */ } else { /******************************************/ /* The module is not a tor counter module */ @@ -1381,16 +1381,16 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_GetTorCounterInitialisation | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_TorCounter, | -| PBYTE_ pb_TimingUnit, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_TorCounter, | +| unsigned char *_ pb_TimingUnit, | | PULONG_ pul_TimingInterval, | -| PBYTE_ pb_InputMode, | -| PBYTE_ pb_ExternGate, | -| PBYTE_ pb_CycleMode, | -| PBYTE_ pb_Enable, | -| PBYTE_ pb_InterruptEnable)| +| unsigned char *_ pb_InputMode, | +| unsigned char *_ pb_ExternGate, | +| unsigned char *_ pb_CycleMode, | +| unsigned char *_ pb_Enable, | +| unsigned char *_ pb_InterruptEnable)| +----------------------------------------------------------------------------+ | Task : Enable the tor counter (b_TorCounter) from selected | | module (b_ModulNbr). You must calling the | @@ -1403,37 +1403,37 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, | The b_CycleMode parameter determine if you will | | measured a single or more cycle. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number (0 to 3) | -| BYTE_ b_TorCounter : Tor counter selection (0 or 1) +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3) | +| unsigned char_ b_TorCounter : Tor counter selection (0 or 1) b_ModulNbr = CR_AREF(insn->chanspec); b_TorCounter = CR_CHAN(insn->chanspec); . | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_TimingUnit : Base timing unit (0 to 4) | +| Output Parameters : unsigned char *_ pb_TimingUnit : Base timing unit (0 to 4) | | 0 : ns | | 1 : µs | | 2 : ms | | 3 : s | | 4 : mn | | PULONG_ pul_TimingInterval : Base timing value. | -| PBYTE_ pb_InputMode : Input signal level | +| unsigned char *_ pb_InputMode : Input signal level | | selection | | 0 : Tor count each low level | | 1 : Tor count each high level| -| PBYTE_ pb_ExternGate : Extern gate action | +| unsigned char *_ pb_ExternGate : Extern gate action | | selection | | 0 : Extern gate signal not | | used | | 1 : Extern gate signal used| -| PBYTE_ pb_CycleMode : Tor counter acquisition | +| unsigned char *_ pb_CycleMode : Tor counter acquisition | | mode | -| PBYTE_ pb_Enable : Indicate if the tor counter| +| unsigned char *_ pb_Enable : Indicate if the tor counter| | is enabled or no | | 0 : Tor counter disabled | | 1 : Tor counter enabled | -| PBYTE_ pb_InterruptEnable : Enable or disable the | +| unsigned char *_ pb_InterruptEnable : Enable or disable the | | tor counter interrupt. | | APCI1710_ENABLE: | | Enable the tor counter | @@ -1441,13 +1441,13 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, | APCI1710_DISABLE: | | Disable the tor counter | | interrupt - pb_TimingUnit = (PBYTE) &data[0]; - pul_TimingInterval = (PULONG) &data[1]; - pb_InputMode = (PBYTE) &data[2]; - pb_ExternGate = (PBYTE) &data[3]; - pb_CycleMode = (PBYTE) &data[4]; - pb_Enable = (PBYTE) &data[5]; - pb_InterruptEnable = (PBYTE) &data[6]; + pb_TimingUnit = (unsigned char *) &data[0]; + pul_TimingInterval = (unsigned int *) &data[1]; + pb_InputMode = (unsigned char *) &data[2]; + pb_ExternGate = (unsigned char *) &data[3]; + pb_CycleMode = (unsigned char *) &data[4]; + pb_Enable = (unsigned char *) &data[5]; + pb_InterruptEnable = (unsigned char *) &data[6]; | +----------------------------------------------------------------------------+ | Return Value : 0: No error | @@ -1460,32 +1460,32 @@ INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev, +int i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = 0; - DWORD dw_Status; - BYTE b_ModulNbr; - BYTE b_TorCounter; - PBYTE pb_TimingUnit; - PULONG pul_TimingInterval; - PBYTE pb_InputMode; - PBYTE pb_ExternGate; - PBYTE pb_CycleMode; - PBYTE pb_Enable; - PBYTE pb_InterruptEnable; + int i_ReturnValue = 0; + unsigned int dw_Status; + unsigned char b_ModulNbr; + unsigned char b_TorCounter; + unsigned char * pb_TimingUnit; + unsigned int * pul_TimingInterval; + unsigned char * pb_InputMode; + unsigned char * pb_ExternGate; + unsigned char * pb_CycleMode; + unsigned char * pb_Enable; + unsigned char * pb_InterruptEnable; i_ReturnValue = insn->n; b_ModulNbr = CR_AREF(insn->chanspec); b_TorCounter = CR_CHAN(insn->chanspec); - pb_TimingUnit = (PBYTE) & data[0]; - pul_TimingInterval = (PULONG) & data[1]; - pb_InputMode = (PBYTE) & data[2]; - pb_ExternGate = (PBYTE) & data[3]; - pb_CycleMode = (PBYTE) & data[4]; - pb_Enable = (PBYTE) & data[5]; - pb_InterruptEnable = (PBYTE) & data[6]; + pb_TimingUnit = (unsigned char *) & data[0]; + pul_TimingInterval = (unsigned int *) & data[1]; + pb_InputMode = (unsigned char *) & data[2]; + pb_ExternGate = (unsigned char *) & data[3]; + pb_CycleMode = (unsigned char *) & data[4]; + pb_Enable = (unsigned char *) & data[5]; + pb_InterruptEnable = (unsigned char *) & data[6]; /**************************/ /* Test the module number */ @@ -1526,9 +1526,9 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev, (64 * b_ModulNbr)); *pb_CycleMode = - (BYTE) ((dw_Status >> 4) & 1); + (unsigned char) ((dw_Status >> 4) & 1); *pb_InterruptEnable = - (BYTE) ((dw_Status >> 5) & 1); + (unsigned char) ((dw_Status >> 5) & 1); /******************************************************/ /* Test if extern gate used for clock or for signal B */ @@ -1569,25 +1569,25 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev, *pb_InputMode = APCI1710_TOR_QUADRUPLE_MODE; } - } // if (dw_Status & 0x400) + } /* if (dw_Status & 0x400) */ else { *pb_InputMode = 1; - } // // if (dw_Status & 0x400) + } /* // if (dw_Status & 0x400) */ /************************/ /* Extern gate not used */ /************************/ *pb_ExternGate = 0; - } // if (dw_Status & 0x600) + } /* if (dw_Status & 0x600) */ else { *pb_InputMode = - (BYTE) ((dw_Status >> 6) + (unsigned char) ((dw_Status >> 6) & 1); *pb_ExternGate = - (BYTE) ((dw_Status >> 7) + (unsigned char) ((dw_Status >> 7) & 1); - } // if (dw_Status & 0x600) + } /* if (dw_Status & 0x600) */ *pb_TimingUnit = devpriv-> @@ -1611,7 +1611,7 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev, i_ReturnValue = -5; } - } // if (b_TorCounter <= 1) + } /* if (b_TorCounter <= 1) */ else { /**********************************/ /* Tor counter selection is wrong */ @@ -1619,7 +1619,7 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev, DPRINTK("Tor counter selection is wrong \n"); i_ReturnValue = -4; - } // if (b_TorCounter <= 1) + } /* if (b_TorCounter <= 1) */ } else { /******************************************/ /* The module is not a tor counter module */ @@ -1643,11 +1643,11 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ReadTorCounterValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_TorCounter, | -| UINT_ ui_TimeOut, | -| PBYTE_ pb_TorCounterStatus, | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_TorCounter, | +| unsigned int_ ui_TimeOut, | +| unsigned char *_ pb_TorCounterStatus, | | PULONG_ pul_TorCounterValue) | +----------------------------------------------------------------------------+ | Task case APCI1710_TOR_GETPROGRESSSTATUS: Return the tor counter @@ -1660,15 +1660,15 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev, | (pul_TorCounterValue) after a conting cycle stop | | from selected tor counter module (b_ModulNbr). | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number (0 to 3) | -| BYTE_ b_TorCounter : Tor counter selection (0 or 1). +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3) | +| unsigned char_ b_TorCounter : Tor counter selection (0 or 1). b_ModulNbr = CR_AREF(insn->chanspec); - b_ReadType = (BYTE) data[0]; - b_TorCounter = (BYTE) data[1]; - ui_TimeOut = (UINT) data[2]; | + b_ReadType = (unsigned char) data[0]; + b_TorCounter = (unsigned char) data[1]; + ui_TimeOut = (unsigned int) data[2]; | +----------------------------------------------------------------------------+ -| Output Parameters : PBYTE_ pb_TorCounterStatus : Return the tor counter | +| Output Parameters : unsigned char *_ pb_TorCounterStatus : Return the tor counter | | status. | | 0 : Conting cycle not started| | Software gate not set. | @@ -1683,9 +1683,9 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev, | function | | "i_APCI1710_InitTorCounter"| | 4 : Timeeout occur | -| PULONG pul_TorCounterValue : Tor counter value. - pb_TorCounterStatus=(PBYTE) &data[0]; - pul_TorCounterValue=(PULONG) &data[1]; | +| unsigned int * pul_TorCounterValue : Tor counter value. + pb_TorCounterStatus=(unsigned char *) &data[0]; + pul_TorCounterValue=(unsigned int *) &data[1]; | +----------------------------------------------------------------------------+ | Return Value : 0: No error | | -1: The handle parameter of the board is wrong | @@ -1700,27 +1700,27 @@ INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device * dev, +int i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = 0; - DWORD dw_Status; - DWORD dw_TimeOut = 0; + int i_ReturnValue = 0; + unsigned int dw_Status; + unsigned int dw_TimeOut = 0; - BYTE b_ModulNbr; - BYTE b_TorCounter; - BYTE b_ReadType; - UINT ui_TimeOut; - PBYTE pb_TorCounterStatus; - PULONG pul_TorCounterValue; + unsigned char b_ModulNbr; + unsigned char b_TorCounter; + unsigned char b_ReadType; + unsigned int ui_TimeOut; + unsigned char * pb_TorCounterStatus; + unsigned int * pul_TorCounterValue; i_ReturnValue = insn->n; b_ModulNbr = CR_AREF(insn->chanspec); - b_ReadType = (BYTE) data[0]; - b_TorCounter = (BYTE) data[1]; - ui_TimeOut = (UINT) data[2]; - pb_TorCounterStatus = (PBYTE) & data[0]; - pul_TorCounterValue = (PULONG) & data[1]; + b_ReadType = (unsigned char) data[0]; + b_TorCounter = (unsigned char) data[1]; + ui_TimeOut = (unsigned int) data[2]; + pb_TorCounterStatus = (unsigned char *) & data[0]; + pul_TorCounterValue = (unsigned int *) & data[1]; /**************************/ /* Test the module number */ @@ -1896,7 +1896,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device + (16 * b_TorCounter) + (64 * b_ModulNbr)); break; - } // if ((dw_Status & 4) == 4) + } /* if ((dw_Status & 4) == 4) */ else { /*******************************/ /* Test if measurement stopped */ @@ -1927,7 +1927,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device (16 * b_TorCounter) + (64 * b_ModulNbr)); break; - } // if ((dw_Status & 2) == 2) + } /* if ((dw_Status & 2) == 2) */ else { /*******************************/ /* Test if measurement started */ @@ -1941,7 +1941,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device *pb_TorCounterStatus = 1; - } // if ((dw_Status & 1) == 1) + } /* if ((dw_Status & 1) == 1) */ else { /***************************/ /* Measurement not started */ @@ -1950,9 +1950,9 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device *pb_TorCounterStatus = 0; - } // if ((dw_Status & 1) == 1) - } // if ((dw_Status & 2) == 2) - } // if ((dw_Status & 8) == 8) + } /* if ((dw_Status & 1) == 1) */ + } /* if ((dw_Status & 2) == 2) */ + } /* if ((dw_Status & 8) == 8) */ if (dw_TimeOut == ui_TimeOut) { /*****************/ @@ -1973,7 +1973,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device mdelay(1000); } - } // for (;;) + } /* for (;;) */ /*************************/ /* Test if timeout occur */ @@ -2001,8 +2001,8 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device default: printk("Inputs wrong\n"); - } // switch end - } // if (dw_Status & 0x1) + } /* switch end */ + } /* if (dw_Status & 0x1) */ else { /***************************/ /* Tor counter not enabled */ @@ -2010,7 +2010,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device DPRINTK("Tor counter not enabled\n"); i_ReturnValue = -6; - } // if (dw_Status & 0x1) + } /* if (dw_Status & 0x1) */ } else { /*******************************/ /* Tor counter not initialised */ @@ -2019,7 +2019,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device DPRINTK("Tor counter not initialised\n"); i_ReturnValue = -5; } - } // if (b_TorCounter <= 1) + } /* if (b_TorCounter <= 1) */ else { /**********************************/ /* Tor counter selection is wrong */ @@ -2027,7 +2027,7 @@ INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device DPRINTK("Tor counter selection is wrong\n"); i_ReturnValue = -4; - } // if (b_TorCounter <= 1) + } /* if (b_TorCounter <= 1) */ } else { /******************************************/ /* The module is not a tor counter module */ diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Tor.h b/drivers/staging/comedi/drivers/addi-data/APCI1710_Tor.h index c245d16207b8..03a93cb26d7a 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Tor.h +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Tor.h @@ -35,23 +35,23 @@ /* * TOR_COUNTER INISIALISATION FUNCTION */ -INT i_APCI1710_InsnConfigInitTorCounter(struct comedi_device *dev, +int i_APCI1710_InsnConfigInitTorCounter(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device *dev, +int i_APCI1710_InsnWriteEnableDisableTorCounter(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device *dev, +int i_APCI1710_InsnReadGetTorCounterInitialisation(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); /* * TOR_COUNTER READ FUNCTION */ -INT i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device *dev, +int i_APCI1710_InsnBitsGetTorCounterProgressStatusAndValue(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Ttl.c b/drivers/staging/comedi/drivers/addi-data/APCI1710_Ttl.c index 68b1d26bae13..1b8f5dfdd4c7 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Ttl.c +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Ttl.c @@ -63,12 +63,12 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_InitTTLIODirection | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_PortAMode, | -| BYTE_ b_PortBMode, | -| BYTE_ b_PortCMode, | -| BYTE_ b_PortDMode) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_PortAMode, | +| unsigned char_ b_PortBMode, | +| unsigned char_ b_PortCMode, | +| unsigned char_ b_PortDMode) | +----------------------------------------------------------------------------+ | Task APCI1710_TTL_INIT (using defaults) : Configure the TTL I/O operating mode from selected | | module (b_ModulNbr). You must calling this function be| @@ -76,15 +76,15 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc APCI1710_TTL_INITDIRECTION(user inputs for direction) +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710| -| BYTE_ b_ModulNbr : Module number to | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710| +| unsigned char_ b_ModulNbr : Module number to | | configure (0 to 3) - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_InitType = (BYTE) data[0]; - b_PortAMode = (BYTE) data[1]; - b_PortBMode = (BYTE) data[2]; - b_PortCMode = (BYTE) data[3]; - b_PortDMode = (BYTE) data[4];| + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_InitType = (unsigned char) data[0]; + b_PortAMode = (unsigned char) data[1]; + b_PortBMode = (unsigned char) data[2]; + b_PortCMode = (unsigned char) data[3]; + b_PortDMode = (unsigned char) data[4];| +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -100,19 +100,19 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnConfigInitTTLIO(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1710_InsnConfigInitTTLIO(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = 0; - BYTE b_ModulNbr; - BYTE b_InitType; - BYTE b_PortAMode; - BYTE b_PortBMode; - BYTE b_PortCMode; - BYTE b_PortDMode; - - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); - b_InitType = (BYTE) data[0]; + int i_ReturnValue = 0; + unsigned char b_ModulNbr; + unsigned char b_InitType; + unsigned char b_PortAMode; + unsigned char b_PortBMode; + unsigned char b_PortCMode; + unsigned char b_PortDMode; + + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); + b_InitType = (unsigned char) data[0]; i_ReturnValue = insn->n; /**************************/ @@ -172,10 +172,10 @@ INT i_APCI1710_InsnConfigInitTTLIO(struct comedi_device * dev, struct comedi_sub case APCI1710_TTL_INITDIRECTION: - b_PortAMode = (BYTE) data[1]; - b_PortBMode = (BYTE) data[2]; - b_PortCMode = (BYTE) data[3]; - b_PortDMode = (BYTE) data[4]; + b_PortAMode = (unsigned char) data[1]; + b_PortBMode = (unsigned char) data[2]; + b_PortCMode = (unsigned char) data[3]; + b_PortDMode = (unsigned char) data[4]; /********************/ /* Test the version */ @@ -322,7 +322,7 @@ INT i_APCI1710_InsnConfigInitTTLIO(struct comedi_device * dev, struct comedi_sub DPRINTK("\n"); default: printk("Bad Config Type\n"); - } // switch end + } /* switch end */ } else { /**********************************/ /* The module is not a TTL module */ @@ -352,11 +352,11 @@ INT i_APCI1710_InsnConfigInitTTLIO(struct comedi_device * dev, struct comedi_sub /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_ReadTTLIOChannelValue | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_SelectedPort, | -| BYTE_ b_InputChannel, | -| PBYTE_ pb_ChannelStatus) | +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_SelectedPort, | +| unsigned char_ b_InputChannel, | +| unsigned char *_ pb_ChannelStatus) | +----------------------------------------------------------------------------+ | Task : Read the status from selected TTL digital input | | (b_InputChannel) @@ -366,32 +366,32 @@ INT i_APCI1710_InsnConfigInitTTLIO(struct comedi_device * dev, struct comedi_sub +----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710| -| BYTE_ b_ModulNbr : Module number to | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710| +| unsigned char_ b_ModulNbr : Module number to | | configure (0 to 7) | -| BYTE_ b_SelectedPort, : Selection from TTL I/O | +| unsigned char_ b_SelectedPort, : Selection from TTL I/O | | port (0 to 2) | | 0 : Port A selection | | 1 : Port B selection | | 2 : Port C selection | | 3 : Port D selection | -| BYTE_ b_InputChannel : Selection from digital | +| unsigned char_ b_InputChannel : Selection from digital | | input ( 0 to 2) APCI1710_TTL_READCHANNEL b_ModulNbr = CR_AREF(insn->chanspec); b_SelectedPort= CR_RANGE(insn->chanspec); b_InputChannel= CR_CHAN(insn->chanspec); - b_ReadType = (BYTE) data[0]; + b_ReadType = (unsigned char) data[0]; APCI1710_TTL_READPORT| b_ModulNbr = CR_AREF(insn->chanspec); b_SelectedPort= CR_RANGE(insn->chanspec); - b_ReadType = (BYTE) data[0]; + b_ReadType = (unsigned char) data[0]; +----------------------------------------------------------------------------+ | Output Parameters : data[0] - PBYTE_ pb_ChannelStatus : Digital input channel | + unsigned char *_ pb_ChannelStatus : Digital input channel | | status | | 0 : Channle is not active| | 1 : Channle is active | @@ -406,20 +406,20 @@ APCI1710_TTL_READCHANNEL +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = 0; - DWORD dw_StatusReg; - BYTE b_ModulNbr; - BYTE b_SelectedPort; - BYTE b_InputChannel; - BYTE b_ReadType; - PBYTE pb_ChannelStatus; - PBYTE pb_PortValue; + int i_ReturnValue = 0; + unsigned int dw_StatusReg; + unsigned char b_ModulNbr; + unsigned char b_SelectedPort; + unsigned char b_InputChannel; + unsigned char b_ReadType; + unsigned char * pb_ChannelStatus; + unsigned char * pb_PortValue; i_ReturnValue = insn->n; - b_ReadType = (BYTE) data[0]; + b_ReadType = (unsigned char) data[0]; b_ModulNbr = CR_AREF(insn->chanspec); b_SelectedPort = CR_RANGE(insn->chanspec); b_InputChannel = CR_CHAN(insn->chanspec); @@ -439,7 +439,7 @@ INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subde switch (b_ReadType) { case APCI1710_TTL_READCHANNEL: - pb_ChannelStatus = (PBYTE) & data[0]; + pb_ChannelStatus = (unsigned char *) & data[0]; /********************************/ /* Test the TTL I/O port number */ /********************************/ @@ -493,7 +493,7 @@ INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subde *pb_ChannelStatus = - (BYTE) ( + (unsigned char) ( (dw_StatusReg >> (8 * b_SelectedPort)) >> b_InputChannel) & 1; @@ -533,7 +533,7 @@ INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subde break; case APCI1710_TTL_READPORT: - pb_PortValue = (PBYTE) & data[0]; + pb_PortValue = (unsigned char *) & data[0]; /********************************/ /* Test the TTL I/O port number */ /********************************/ @@ -578,7 +578,7 @@ INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subde (64 * b_ModulNbr)); *pb_PortValue = - (BYTE) ( + (unsigned char) ( (dw_StatusReg >> (8 * b_SelectedPort)) & 0xFF); } else { @@ -610,7 +610,7 @@ INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subde default: printk("Bad ReadType\n"); - } //End Switch + } /* End Switch */ } else { /**********************************/ /* The module is not a TTL module */ @@ -633,15 +633,15 @@ INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subde /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI1710_InsnReadTTLIOAllPortValue(comedi_device +| Function Name : int i_APCI1710_InsnReadTTLIOAllPortValue(comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *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 | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710| +| unsigned char_ b_ModulNbr : Module number to | | configure (0 to 3) | +----------------------------------------------------------------------------+ | Output Parameters : PULONG_ pul_PortValue : Digital TTL inputs port | @@ -655,17 +655,17 @@ INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subde +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnReadTTLIOAllPortValue(struct comedi_device * dev, +int i_APCI1710_InsnReadTTLIOAllPortValue(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = 0; - DWORD dw_StatusReg; - BYTE b_ModulNbr; - PULONG pul_PortValue; + int i_ReturnValue = 0; + unsigned int dw_StatusReg; + unsigned char b_ModulNbr; + unsigned int * pul_PortValue; - b_ModulNbr = (BYTE) CR_AREF(insn->chanspec); + b_ModulNbr = (unsigned char) CR_AREF(insn->chanspec); i_ReturnValue = insn->n; - pul_PortValue = (PULONG) & data[0]; + pul_PortValue = (unsigned int *) & data[0]; /**************************/ /* Test the module number */ @@ -789,19 +789,19 @@ INT i_APCI1710_InsnReadTTLIOAllPortValue(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ | Function Name : _INT_ i_APCI1710_SetTTLIOChlOn | -| (BYTE_ b_BoardHandle, | -| BYTE_ b_ModulNbr, | -| BYTE_ b_OutputChannel) -INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device *dev,struct comedi_subdevice *s, +| (unsigned char_ b_BoardHandle, | +| unsigned char_ b_ModulNbr, | +| unsigned char_ b_OutputChannel) +int i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device *dev,struct comedi_subdevice *s, struct comedi_insn *insn,unsigned int *data) | +----------------------------------------------------------------------------+ | Task : Sets or resets the output witch has been passed with the | | parameter b_Channel. Setting an output means setting | | an ouput high. | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE_ b_BoardHandle : Handle of board APCI-1710 | -| BYTE_ b_ModulNbr : Selected module number (0 to 3)| -| BYTE_ b_OutputChannel : Selection from digital output | +| Input Parameters : unsigned char_ b_BoardHandle : Handle of board APCI-1710 | +| unsigned char_ b_ModulNbr : Selected module number (0 to 3)| +| unsigned char_ b_OutputChannel : Selection from digital output | | channel (0 or 1) | | 0 : PD0 | | 1 : PD1 | @@ -811,7 +811,7 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device *dev,struct comedi b_ModulNbr = CR_AREF(insn->chanspec); b_OutputChannel= CR_CHAN(insn->chanspec); - ui_State = data[0]; // ON or OFF + ui_State = data[0]; /* ON or OFF */ +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -825,19 +825,19 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device *dev,struct comedi +----------------------------------------------------------------------------+ */ -INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device * dev, +int i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = 0; - DWORD dw_StatusReg = 0; - BYTE b_ModulNbr; - BYTE b_OutputChannel; - UINT ui_State; + int i_ReturnValue = 0; + unsigned int dw_StatusReg = 0; + unsigned char b_ModulNbr; + unsigned char b_OutputChannel; + unsigned int ui_State; i_ReturnValue = insn->n; b_ModulNbr = CR_AREF(insn->chanspec); b_OutputChannel = CR_CHAN(insn->chanspec); - ui_State = data[0]; // ON or OFF + ui_State = data[0]; /* ON or OFF */ /**************************/ /* Test the module number */ @@ -953,7 +953,7 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device * dev, ui_Address + (64 * b_ModulNbr)); - if (ui_State) // ON + if (ui_State) /* ON */ { dw_StatusReg = @@ -969,7 +969,7 @@ INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device * dev, (b_OutputChannel % 8)); - } else // Off + } else /* Off */ { dw_StatusReg = diff --git a/drivers/staging/comedi/drivers/addi-data/APCI1710_Ttl.h b/drivers/staging/comedi/drivers/addi-data/APCI1710_Ttl.h index 00915ddf9218..c4f11347f243 100644 --- a/drivers/staging/comedi/drivers/addi-data/APCI1710_Ttl.h +++ b/drivers/staging/comedi/drivers/addi-data/APCI1710_Ttl.h @@ -24,21 +24,21 @@ /* * TTL INISIALISATION FUNCTION */ -INT i_APCI1710_InsnConfigInitTTLIO(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnConfigInitTTLIO(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); /* * TTL INPUT FUNCTION */ -INT i_APCI1710_InsnBitsReadTTLIO(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1710_InsnBitsReadTTLIO(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1710_InsnReadTTLIOAllPortValue(struct comedi_device *dev, +int i_APCI1710_InsnReadTTLIOAllPortValue(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); /* * TTL OUTPUT FUNCTIONS */ -INT i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device *dev, +int i_APCI1710_InsnWriteSetTTLIOChlOnOff(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); diff --git a/drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.c b/drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.c index b0907ec14667..fe7c8e1d0586 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.c +++ b/drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.c @@ -49,37 +49,37 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc #include "addi_amcc_S5920.h" /*+----------------------------------------------------------------------------+*/ -/*| Function Name : INT i_AddiHeaderRW_ReadEeprom |*/ -/*| (INT i_NbOfWordsToRead, |*/ -/*| DWORD dw_PCIBoardEepromAddress, |*/ -/*| WORD w_EepromStartAddress, |*/ -/*| PWORD pw_DataRead) |*/ +/*| Function Name : int i_AddiHeaderRW_ReadEeprom |*/ +/*| (int i_NbOfWordsToRead, |*/ +/*| unsigned int dw_PCIBoardEepromAddress, |*/ +/*| unsigned short w_EepromStartAddress, |*/ +/*| unsigned short * 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 |*/ +/*| Input Parameters : int i_NbOfWordsToRead : Nbr. of word to read |*/ +/*| unsigned int dw_PCIBoardEepromAddress : Address of the eeprom |*/ +/*| unsigned short w_EepromStartAddress : Eeprom strat address |*/ /*+----------------------------------------------------------------------------+*/ -/*| Output Parameters : PWORD pw_DataRead : Read data |*/ +/*| Output Parameters : unsigned short * pw_DataRead : Read data |*/ /*+----------------------------------------------------------------------------+*/ /*| Return Value : - |*/ /*+----------------------------------------------------------------------------+*/ -INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, - DWORD dw_PCIBoardEepromAddress, - WORD w_EepromStartAddress, PWORD pw_DataRead) +int i_AddiHeaderRW_ReadEeprom(int i_NbOfWordsToRead, + unsigned int dw_PCIBoardEepromAddress, + unsigned short w_EepromStartAddress, unsigned short * 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; + unsigned int dw_eeprom_busy = 0; + int i_Counter = 0; + int i_WordCounter; + int i; + unsigned char pb_ReadByte[1]; + unsigned char b_ReadLowByte = 0; + unsigned char b_ReadHighByte = 0; + unsigned char b_SelectedAddressLow = 0; + unsigned char b_SelectedAddressHigh = 0; + unsigned short w_ReadWord = 0; for (i_WordCounter = 0; i_WordCounter < i_NbOfWordsToRead; i_WordCounter++) { @@ -92,15 +92,15 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, while (dw_eeprom_busy == EEPROM_BUSY); for (i_Counter = 0; i_Counter < 2; i_Counter++) { - b_SelectedAddressLow = (w_EepromStartAddress + i_Counter) % 256; //Read the low 8 bit part - b_SelectedAddressHigh = (w_EepromStartAddress + i_Counter) / 256; //Read the high 8 bit part + b_SelectedAddressLow = (w_EepromStartAddress + i_Counter) % 256; /* Read the low 8 bit part */ + b_SelectedAddressHigh = (w_EepromStartAddress + i_Counter) / 256; /* Read the high 8 bit part */ - //Select the load low address mode + /* Select the load low address mode */ outb(NVCMD_LOAD_LOW, dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR + 3); - //Wait on busy + /* Wait on busy */ do { dw_eeprom_busy = inl(dw_PCIBoardEepromAddress + @@ -109,12 +109,12 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, } while (dw_eeprom_busy == EEPROM_BUSY); - //Load the low address + /* Load the low address */ outb(b_SelectedAddressLow, dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR + 2); - //Wait on busy + /* Wait on busy */ do { dw_eeprom_busy = inl(dw_PCIBoardEepromAddress + @@ -123,12 +123,12 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, } while (dw_eeprom_busy == EEPROM_BUSY); - //Select the load high address mode + /* Select the load high address mode */ outb(NVCMD_LOAD_HIGH, dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR + 3); - //Wait on busy + /* Wait on busy */ do { dw_eeprom_busy = inl(dw_PCIBoardEepromAddress + @@ -137,12 +137,12 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, } while (dw_eeprom_busy == EEPROM_BUSY); - //Load the high address + /* Load the high address */ outb(b_SelectedAddressHigh, dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR + 2); - //Wait on busy + /* Wait on busy */ do { dw_eeprom_busy = inl(dw_PCIBoardEepromAddress + @@ -151,12 +151,12 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, } while (dw_eeprom_busy == EEPROM_BUSY); - //Select the READ mode + /* Select the READ mode */ outb(NVCMD_BEGIN_READ, dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR + 3); - //Wait on busy + /* Wait on busy */ do { dw_eeprom_busy = inl(dw_PCIBoardEepromAddress + @@ -165,12 +165,12 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, } while (dw_eeprom_busy == EEPROM_BUSY); - //Read data into the EEPROM + /* Read data into the EEPROM */ *pb_ReadByte = inb(dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR + 2); - //Wait on busy + /* Wait on busy */ do { dw_eeprom_busy = inl(dw_PCIBoardEepromAddress + @@ -179,14 +179,14 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, } while (dw_eeprom_busy == EEPROM_BUSY); - //Select the upper address part + /* Select the upper address part */ if (i_Counter == 0) { b_ReadLowByte = pb_ReadByte[0]; } else { b_ReadHighByte = pb_ReadByte[0]; } - //Sleep + /* Sleep */ for (i = 0; i < 10000; i++) ; } @@ -196,8 +196,8 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, pw_DataRead[i_WordCounter] = w_ReadWord; - w_EepromStartAddress += 2; // to read the next word + w_EepromStartAddress += 2; /* to read the next word */ - } // for (...) i_NbOfWordsToRead + } /* for (...) i_NbOfWordsToRead */ return (0); } diff --git a/drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.h b/drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.h index 9ae56bc3adad..1e5ddd4516aa 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.h +++ b/drivers/staging/comedi/drivers/addi-data/addi_amcc_S5920.h @@ -22,6 +22,6 @@ #define NVCMD_BEGIN_READ (0x7 << 5) /* nvRam begin read command */ #define NVCMD_BEGIN_WRITE (0x6 << 5) /* EEPROM begin write command */ -INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, - DWORD dw_PCIBoardEepromAddress, - WORD w_EepromStartAddress, PWORD pw_DataRead); +int i_AddiHeaderRW_ReadEeprom(int i_NbOfWordsToRead, + unsigned int dw_PCIBoardEepromAddress, + unsigned short w_EepromStartAddress, unsigned short * pw_DataRead); diff --git a/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h b/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h index b50774cdcf77..4ad8253dc08f 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h +++ b/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h @@ -85,7 +85,7 @@ #define AMCC_OP_REG_MRTC 0x30 #define AMCC_OP_REG_MBEF 0x34 #define AMCC_OP_REG_INTCSR 0x38 -/* INT source */ +/* int source */ #define AMCC_OP_REG_INTCSR_SRC (AMCC_OP_REG_INTCSR + 2) /* FIFO ctrl */ #define AMCC_OP_REG_INTCSR_FEC (AMCC_OP_REG_INTCSR + 3) diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.c b/drivers/staging/comedi/drivers/addi-data/addi_common.c index 618c69b6838d..38cd7cf79b7f 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.c +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.c @@ -68,25 +68,25 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc #include "addi_common.h" #include "addi_amcc_s5933.h" -//Update-0.7.57->0.7.68MODULE_AUTHOR("ADDI-DATA GmbH <info@addi-data.com>"); -//Update-0.7.57->0.7.68MODULE_DESCRIPTION("Comedi ADDI-DATA module"); -//Update-0.7.57->0.7.68MODULE_LICENSE("GPL"); +/* Update-0.7.57->0.7.68MODULE_AUTHOR("ADDI-DATA GmbH <info@addi-data.com>"); */ +/* 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) +#define devpriv ((struct addi_private *)dev->private) +#define this_board ((struct addi_board *)dev->board_ptr) #if defined(CONFIG_APCI_1710) || defined(CONFIG_APCI_3200) || defined(CONFIG_APCI_3300) -//BYTE b_SaveFPUReg [94]; +/* BYTE b_SaveFPUReg [94]; */ void fpu_begin(void) { - //asm ("fstenv b_SaveFPUReg"); + /* asm ("fstenv b_SaveFPUReg"); */ kernel_fpu_begin(); } void fpu_end(void) { - // asm ("frstor b_SaveFPUReg"); + /* asm ("frstor b_SaveFPUReg"); */ kernel_fpu_end(); } #endif @@ -219,7 +219,7 @@ static DEFINE_PCI_DEVICE_TABLE(addi_apci_tbl) = { MODULE_DEVICE_TABLE(pci, addi_apci_tbl); -static const boardtype boardtypes[] = { +static const struct addi_board boardtypes[] = { #ifdef CONFIG_APCI_3120 {"apci3120", APCI3120_BOARD_VENDOR_ID, @@ -901,7 +901,7 @@ static const boardtype boardtypes[] = { NULL}, #endif #ifdef CONFIG_APCI_3300 - //Begin JK 20.10.2004: APCI-3300 integration + /* Begin JK 20.10.2004: APCI-3300 integration */ {"apci3300", APCI3200_BOARD_VENDOR_ID, 0x3007, @@ -2525,7 +2525,7 @@ static const boardtype boardtypes[] = { #endif }; -#define n_boardtypes (sizeof(boardtypes)/sizeof(boardtype)) +#define n_boardtypes (sizeof(boardtypes)/sizeof(struct addi_board)) struct comedi_driver driver_addi = { driver_name:"addi_common", @@ -2534,7 +2534,7 @@ struct comedi_driver driver_addi = { detach:i_ADDI_Detach, num_names:n_boardtypes, board_name:&boardtypes[0].pc_DriverName, - offset:sizeof(boardtype), + offset:sizeof(struct addi_board), }; COMEDI_PCI_INITCLEANUP(driver_addi, addi_apci_tbl); @@ -2563,7 +2563,7 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i { struct comedi_subdevice *s; int ret, pages, i, n_subdevices; - DWORD dw_Dummy; + unsigned int dw_Dummy; resource_size_t io_addr[5]; unsigned int irq; resource_size_t iobase_a, iobase_main, iobase_addon, iobase_reserved; @@ -2575,15 +2575,15 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i sprintf(c_Identifier, "Addi-Data GmbH Comedi %s", this_board->pc_DriverName); - if ((ret = alloc_private(dev, sizeof(addi_private))) < 0) { + if ((ret = alloc_private(dev, sizeof(struct addi_private))) < 0) { return -ENOMEM; } if (!pci_list_builded) { - v_pci_card_list_init(this_board->i_VendorId, 1); //1 for displaying the list.. + 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); + /* rt_printk("comedi%d: addi_common: board=%s",dev->minor,this_board->pc_DriverName); */ if ((this_board->i_Dma) && (it->options[2] == 0)) { i_Dma = 1; @@ -2617,33 +2617,33 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i /************************************/ if (this_board->i_IorangeBase1 != 0) { - dev->iobase = (unsigned long)iobase_main; // DAQ base address... + dev->iobase = (unsigned long)iobase_main; /* DAQ base address... */ } else { - dev->iobase = (unsigned long)iobase_a; // DAQ base address... + dev->iobase = (unsigned long)iobase_a; /* DAQ base address... */ } dev->board_name = this_board->pc_DriverName; devpriv->amcc = card; - devpriv->iobase = (INT) dev->iobase; - devpriv->i_IobaseAmcc = (INT) iobase_a; //AMCC base address... - devpriv->i_IobaseAddon = (INT) iobase_addon; //ADD ON base address.... - devpriv->i_IobaseReserved = (INT) iobase_reserved; + devpriv->iobase = (int) dev->iobase; + devpriv->i_IobaseAmcc = (int) iobase_a; /* AMCC base address... */ + devpriv->i_IobaseAddon = (int) iobase_addon; /* ADD ON base address.... */ + devpriv->i_IobaseReserved = (int) iobase_reserved; devpriv->ps_BoardInfo = this_board; } else { dev->board_name = this_board->pc_DriverName; dev->iobase = (unsigned long)io_addr[2]; devpriv->amcc = card; - devpriv->iobase = (INT) io_addr[2]; + devpriv->iobase = (int) io_addr[2]; devpriv->ps_BoardInfo = this_board; - devpriv->i_IobaseReserved = (INT) io_addr[3]; + devpriv->i_IobaseReserved = (int) io_addr[3]; printk("\nioremap begin"); devpriv->dw_AiBase = - (ULONG_PTR) ioremap(io_addr[3], + (unsigned long ) ioremap(io_addr[3], this_board->i_IorangeBase3); printk("\nioremap end"); } - //## + /* ## */ if (irq > 0) { if (comedi_request_irq(irq, v_ADDI_Interrupt, IRQF_SHARED, @@ -2662,18 +2662,18 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i it->options[2]); dev->irq = irq; - // Read eepeom and fill boardtype Structure + /* Read eepeom and fill addi_board Structure */ if (this_board->i_PCIEeprom) { printk("\nPCI Eeprom used"); if (!(strcmp(this_board->pc_EepromChip, "S5920"))) { - // Set 3 wait stait + /* 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 + /* 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"); @@ -2694,7 +2694,7 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i if (this_board->i_Dma) { printk("\nDMA used"); if (devpriv->us_UseDma == ADDI_ENABLE) { - // alloc DMA buffers + /* alloc DMA buffers */ devpriv->b_DmaDoubleBuffer = 0; for (i = 0; i < 2; i++) { for (pages = 4; pages >= 0; pages--) { @@ -2739,16 +2739,16 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i #ifdef CONFIG_APCI_1710 i_ADDI_AttachPCI1710(dev); - // save base address + /* save base address */ devpriv->s_BoardInfos.ui_Address = io_addr[2]; #endif } else { - //Update-0.7.57->0.7.68dev->n_subdevices = 7; + /* 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 + /* Allocate and Initialise AI Subdevice Structures */ s = dev->subdevices + 0; if ((this_board->i_NbrAiChannel) || (this_board->i_NbrAiChannelDiff)) { @@ -2786,7 +2786,7 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i s->type = COMEDI_SUBD_UNUSED; } - // Allocate and Initialise AO Subdevice Structures + /* Allocate and Initialise AO Subdevice Structures */ s = dev->subdevices + 1; if (this_board->i_NbrAoChannel) { s->type = COMEDI_SUBD_AO; @@ -2804,7 +2804,7 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i } else { s->type = COMEDI_SUBD_UNUSED; } - // Allocate and Initialise DI Subdevice Structures + /* Allocate and Initialise DI Subdevice Structures */ s = dev->subdevices + 2; if (this_board->i_NbrDiChannel) { s->type = COMEDI_SUBD_DI; @@ -2824,7 +2824,7 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i } else { s->type = COMEDI_SUBD_UNUSED; } - // Allocate and Initialise DO Subdevice Structures + /* Allocate and Initialise DO Subdevice Structures */ s = dev->subdevices + 3; if (this_board->i_NbrDoChannel) { s->type = COMEDI_SUBD_DO; @@ -2837,7 +2837,7 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i s->range_table = &range_digital; s->io_bits = 0xf; /* all bits output */ - s->insn_config = this_board->i_hwdrv_InsnConfigDigitalOutput; //for digital output memory.. + s->insn_config = this_board->i_hwdrv_InsnConfigDigitalOutput; /* for digital output memory.. */ s->insn_write = this_board->i_hwdrv_InsnWriteDigitalOutput; s->insn_bits = @@ -2848,7 +2848,7 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i s->type = COMEDI_SUBD_UNUSED; } - // Allocate and Initialise Timer Subdevice Structures + /* Allocate and Initialise Timer Subdevice Structures */ s = dev->subdevices + 4; if (this_board->i_Timer) { s->type = COMEDI_SUBD_TIMER; @@ -2868,7 +2868,7 @@ static int i_ADDI_Attach(struct comedi_device * dev, struct comedi_devconfig * i s->type = COMEDI_SUBD_UNUSED; } - // Allocate and Initialise TTL + /* Allocate and Initialise TTL */ s = dev->subdevices + 5; if (this_board->i_NbrTTLChannel) { s->type = COMEDI_SUBD_TTLIO; @@ -2965,7 +2965,7 @@ static int i_ADDI_Detach(struct comedi_device * dev) } if (pci_list_builded) { - //v_pci_card_list_cleanup(PCI_VENDOR_ID_AMCC); + /* v_pci_card_list_cleanup(PCI_VENDOR_ID_AMCC); */ v_pci_card_list_cleanup(this_board->i_VendorId); pci_list_builded = 0; } @@ -2999,11 +2999,11 @@ static int i_ADDI_Reset(struct comedi_device * dev) return 0; } -// Interrupt function +/* Interrupt function */ /* +----------------------------------------------------------------------------+ | Function name : | -|static void v_ADDI_Interrupt(int irq, void *d PT_REGS_ARG) | +|static void v_ADDI_Interrupt(int irq, void *d) | | | +----------------------------------------------------------------------------+ | Task : Registerd interrupt routine | @@ -3018,14 +3018,14 @@ static int i_ADDI_Reset(struct comedi_device * dev) +----------------------------------------------------------------------------+ */ -static irqreturn_t v_ADDI_Interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t v_ADDI_Interrupt(int irq, void *d) { struct comedi_device *dev = d; this_board->v_hwdrv_Interrupt(irq, d); return IRQ_RETVAL(1); } -// EEPROM Read Function +/* EEPROM Read Function */ /* +----------------------------------------------------------------------------+ | Function name : | @@ -3049,14 +3049,14 @@ static irqreturn_t v_ADDI_Interrupt(int irq, void *d PT_REGS_ARG) static int i_ADDIDATA_InsnReadEeprom(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - WORD w_Data; - WORD w_Address; - w_Address = CR_CHAN(insn->chanspec); // address to be read as 0,1,2,3...255 + unsigned short w_Data; + unsigned short w_Address; + w_Address = CR_CHAN(insn->chanspec); /* address to be read as 0,1,2,3...255 */ w_Data = w_EepromReadWord(devpriv->i_IobaseAmcc, this_board->pc_EepromChip, 0x100 + (2 * w_Address)); data[0] = w_Data; - //multiplied by 2 bcozinput will be like 0,1,2...255 + /* multiplied by 2 bcozinput will be like 0,1,2...255 */ return insn->n; } diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.h b/drivers/staging/comedi/drivers/addi-data/addi_common.h index 19df5c1444a4..0640a05339a3 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.h +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.h @@ -36,26 +36,12 @@ #define ERROR -1 #define SUCCESS 1 -/* variable type definition */ -typedef unsigned char BYTE, *PBYTE; -typedef short SHORT, *PSHORT; -typedef unsigned short USHORT, *PUSHORT; -typedef unsigned short WORD, *PWORD; -typedef int INT, *PINT;; -typedef unsigned int UINT, *PUINT; -typedef int LONG, *PLONG; /* 32-bit */ -typedef unsigned int ULONG, *PULONG; /* 32-bit */ -typedef unsigned int DWORD, *PDWORD; /* 32-bit */ -typedef unsigned long ULONG_PTR; - -typedef const struct comedi_lrange *PCRANGE; - -#define LOBYTE(W) (BYTE)((W) & 0xFF) -#define HIBYTE(W) (BYTE)(((W) >> 8) & 0xFF) -#define MAKEWORD(H, L) (USHORT)((L) | ((H) << 8)) -#define LOWORD(W) (USHORT)((W) & 0xFFFF) -#define HIWORD(W) (USHORT)(((W) >> 16) & 0xFFFF) -#define MAKEDWORD(H, L) (UINT)((L) | ((H) << 16)) +#define LOBYTE(W) (unsigned char)((W) & 0xFF) +#define HIBYTE(W) (unsigned char)(((W) >> 8) & 0xFF) +#define MAKEWORD(H, L) (unsigned short)((L) | ((H) << 8)) +#define LOWORD(W) (unsigned short)((W) & 0xFFFF) +#define HIWORD(W) (unsigned short)(((W) >> 16) & 0xFFFF) +#define MAKEDWORD(H, L) (unsigned int)((L) | ((H) << 16)) #define ADDI_ENABLE 1 #define ADDI_DISABLE 0 @@ -75,37 +61,37 @@ typedef const struct comedi_lrange *PCRANGE; /* Structures */ /* structure for the boardtype */ -typedef struct { - const char *pc_DriverName; // driver name - INT i_VendorId; //PCI vendor a device ID of card - INT i_DeviceId; - INT i_IorangeBase0; - INT i_IorangeBase1; - INT i_IorangeBase2; // base 2 range - INT i_IorangeBase3; // base 3 range - INT i_PCIEeprom; // eeprom present or not - char *pc_EepromChip; // type of chip - INT i_NbrAiChannel; // num of A/D chans - INT i_NbrAiChannelDiff; // num of A/D chans in diff mode - INT i_AiChannelList; // len of chanlist - INT i_NbrAoChannel; // num of D/A chans - INT i_AiMaxdata; // resolution of A/D - INT i_AoMaxdata; // resolution of D/A - PCRANGE pr_AiRangelist; // rangelist for A/D - PCRANGE pr_AoRangelist; // rangelist for D/A - - 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 - PCRANGE 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 +struct addi_board { + const char *pc_DriverName; /* driver name */ + int i_VendorId; /* PCI vendor a device ID of card */ + int i_DeviceId; + int i_IorangeBase0; + int i_IorangeBase1; + int i_IorangeBase2; /* base 2 range */ + int i_IorangeBase3; /* base 3 range */ + int i_PCIEeprom; /* eeprom present or not */ + char *pc_EepromChip; /* type of chip */ + int i_NbrAiChannel; /* num of A/D chans */ + int i_NbrAiChannelDiff; /* num of A/D chans in diff mode */ + int i_AiChannelList; /* len of chanlist */ + int i_NbrAoChannel; /* num of D/A chans */ + int i_AiMaxdata; /* resolution of A/D */ + int i_AoMaxdata; /* resolution of D/A */ + const struct comedi_lrange *pr_AiRangelist; /* rangelist for A/D */ + const struct comedi_lrange *pr_AoRangelist; /* rangelist for D/A */ + + 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 */ + const struct comedi_lrange *pr_TTLRangelist; /* rangelist for TTL */ + + int i_Dma; /* dma present or not */ + int i_Timer; /* timer subdevice present or not */ + unsigned char b_AvailableConvertUnit; + unsigned int ui_MinAcquisitiontimeNs; /* Minimum Acquisition in Nano secs */ + unsigned int ui_MinDelaytimeNs; /* Minimum Delay in Nano secs */ /* interrupt and reset */ void (*v_hwdrv_Interrupt)(int irq, void *d); @@ -213,21 +199,21 @@ typedef struct { int (*i_hwdr_WriteTTLIOChlOnOff)(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -} boardtype; +}; -//MODULE INFO STRUCTURE +/* MODULE INFO STRUCTURE */ -typedef union { +union str_ModuleInfo { /* Incremental counter infos */ struct { union { struct { - BYTE b_ModeRegister1; - BYTE b_ModeRegister2; - BYTE b_ModeRegister3; - BYTE b_ModeRegister4; + unsigned char b_ModeRegister1; + unsigned char b_ModeRegister2; + unsigned char b_ModeRegister3; + unsigned char b_ModeRegister4; } s_ByteModeRegister; - DWORD dw_ModeRegister1_2_3_4; + unsigned int dw_ModeRegister1_2_3_4; } s_ModeRegister; struct { @@ -244,25 +230,25 @@ typedef union { /* SSI infos */ struct { - BYTE b_SSIProfile; - BYTE b_PositionTurnLength; - BYTE b_TurnCptLength; - BYTE b_SSIInit; + unsigned char b_SSIProfile; + unsigned char b_PositionTurnLength; + unsigned char b_TurnCptLength; + unsigned char b_SSIInit; } s_SSICounterInfo; /* TTL I/O infos */ struct { - BYTE b_TTLInit; - BYTE b_PortConfiguration[4]; + unsigned char b_TTLInit; + unsigned char b_PortConfiguration[4]; } s_TTLIOInfo; /* Digital I/O infos */ struct { - BYTE b_DigitalInit; - BYTE b_ChannelAMode; - BYTE b_ChannelBMode; - BYTE b_OutputMemoryEnabled; - DWORD dw_OutputMemory; + unsigned char b_DigitalInit; + unsigned char b_ChannelAMode; + unsigned char b_ChannelBMode; + unsigned char b_OutputMemoryEnabled; + unsigned int dw_OutputMemory; } s_DigitalIOInfo; /*********************/ @@ -271,14 +257,14 @@ typedef union { struct { struct { - BYTE b_82X54Init; - BYTE b_InputClockSelection; - BYTE b_InputClockLevel; - BYTE b_OutputLevel; - BYTE b_HardwareGateLevel; - DWORD dw_ConfigurationWord; + unsigned char b_82X54Init; + unsigned char b_InputClockSelection; + unsigned char b_InputClockLevel; + unsigned char b_OutputLevel; + unsigned char b_HardwareGateLevel; + unsigned int dw_ConfigurationWord; } s_82X54TimerInfo[3]; - BYTE b_InterruptMask; + unsigned char b_InterruptMask; } s_82X54ModuleInfo; /*********************/ @@ -286,13 +272,13 @@ typedef union { /*********************/ struct { - BYTE b_ChronoInit; - BYTE b_InterruptMask; - BYTE b_PCIInputClock; - BYTE b_TimingUnit; - BYTE b_CycleMode; + unsigned char b_ChronoInit; + unsigned char b_InterruptMask; + unsigned char b_PCIInputClock; + unsigned char b_TimingUnit; + unsigned char b_CycleMode; double d_TimingInterval; - DWORD dw_ConfigReg; + unsigned int dw_ConfigReg; } s_ChronoModuleInfo; /***********************/ @@ -301,154 +287,154 @@ typedef union { struct { struct { - BYTE b_PulseEncoderInit; + unsigned char b_PulseEncoderInit; } s_PulseEncoderInfo[4]; - DWORD dw_SetRegister; - DWORD dw_ControlRegister; - DWORD dw_StatusRegister; + unsigned int dw_SetRegister; + unsigned int dw_ControlRegister; + unsigned int dw_StatusRegister; } s_PulseEncoderModuleInfo; /* Tor conter infos */ struct { struct { - BYTE b_TorCounterInit; - BYTE b_TimingUnit; - BYTE b_InterruptEnable; + unsigned char b_TorCounterInit; + unsigned char b_TimingUnit; + unsigned char b_InterruptEnable; double d_TimingInterval; - ULONG ul_RealTimingInterval; + unsigned int ul_RealTimingInterval; } s_TorCounterInfo[2]; - BYTE b_PCIInputClock; + unsigned char b_PCIInputClock; } s_TorCounterModuleInfo; /* PWM infos */ struct { struct { - BYTE b_PWMInit; - BYTE b_TimingUnit; - BYTE b_InterruptEnable; + unsigned char b_PWMInit; + unsigned char b_TimingUnit; + unsigned char b_InterruptEnable; double d_LowTiming; double d_HighTiming; - ULONG ul_RealLowTiming; - ULONG ul_RealHighTiming; + unsigned int ul_RealLowTiming; + unsigned int ul_RealHighTiming; } s_PWMInfo[2]; - BYTE b_ClockSelection; + unsigned char b_ClockSelection; } s_PWMModuleInfo; /* ETM infos */ struct { struct { - BYTE b_ETMEnable; - BYTE b_ETMInterrupt; + unsigned char b_ETMEnable; + unsigned char b_ETMInterrupt; } s_ETMInfo[2]; - BYTE b_ETMInit; - BYTE b_TimingUnit; - BYTE b_ClockSelection; + unsigned char b_ETMInit; + unsigned char b_TimingUnit; + unsigned char b_ClockSelection; double d_TimingInterval; - ULONG ul_Timing; + unsigned int ul_Timing; } s_ETMModuleInfo; /* CDA infos */ struct { - BYTE b_CDAEnable; - BYTE b_CDAInterrupt; - BYTE b_CDAInit; - BYTE b_FctSelection; - BYTE b_CDAReadFIFOOverflow; + unsigned char b_CDAEnable; + unsigned char b_CDAInterrupt; + unsigned char b_CDAInit; + unsigned char b_FctSelection; + unsigned char b_CDAReadFIFOOverflow; } s_CDAModuleInfo; -} str_ModuleInfo; +}; /* Private structure for the addi_apci3120 driver */ -typedef struct { - - INT iobase; - INT i_IobaseAmcc; // base+size for AMCC chip - INT i_IobaseAddon; //addon base address - INT i_IobaseReserved; - ULONG_PTR dw_AiBase; - struct pcilst_struct *amcc; // ptr too AMCC data - 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 - UINT ui_AiScanLength; // Length of actual scanlist - 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; - UINT ui_AiDataLength; - short *AiData; // Pointer to sample data - UINT ui_AiNbrofScans; // number of scans to do - USHORT us_UseDma; // To use Dma or not - BYTE b_DmaDoubleBuffer; // we can use double buffering - UINT ui_DmaActualBuffer; // which buffer is used now - //*UPDATE-0.7.57->0.7.68 - //ULONG ul_DmaBufferVirtual[2];// pointers to begin of DMA buffer - short *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 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 - BYTE b_OutputMemoryStatus; - BYTE b_AnalogInputChannelNbr; // Analog input channel Nbr - BYTE b_AnalogOutputChannelNbr; // Analog input Output Nbr - BYTE b_TimerSelectMode; // Contain data written at iobase + 0C - BYTE b_ModeSelectRegister; // Contain data written at iobase + 0E - USHORT us_OutputRegister; // Contain data written at iobase + 0 - BYTE b_InterruptState; - BYTE b_TimerInit; // Specify if InitTimerWatchdog was load - BYTE b_TimerStarted; // Specify if timer 2 is running or not - BYTE b_Timer2Mode; // Specify the timer 2 mode - BYTE b_Timer2Interrupt; //Timer2 interrupt enable or disable - BYTE b_AiCyclicAcquisition; // indicate cyclic acquisition - 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 addi_private { + + int iobase; + int i_IobaseAmcc; /* base+size for AMCC chip */ + int i_IobaseAddon; /* addon base address */ + int i_IobaseReserved; + unsigned long dw_AiBase; + struct pcilst_struct *amcc; /* ptr too AMCC data */ + unsigned char allocated; /* we have blocked card */ + unsigned char b_ValidDriver; /* driver is ok */ + unsigned char b_AiContinuous; /* we do unlimited AI */ + unsigned char b_AiInitialisation; + unsigned int ui_AiActualScan; /* how many scans we finished */ + unsigned int ui_AiBufferPtr; /* data buffer ptr in samples */ + unsigned int ui_AiNbrofChannels; /* how many channels is measured */ + unsigned int ui_AiScanLength; /* Length of actual scanlist */ + unsigned int ui_AiActualScanPosition; /* position in actual scan */ + unsigned int * pui_AiChannelList; /* actual chanlist */ + unsigned int ui_AiChannelList[32]; /* actual chanlist */ + unsigned char b_AiChannelConfiguration[32]; /* actual chanlist */ + unsigned int ui_AiReadData[32]; + unsigned int dw_AiInitialised; + unsigned int ui_AiTimer0; /* Timer Constant for Timer0 */ + unsigned int ui_AiTimer1; /* Timer constant for Timer1 */ + unsigned int ui_AiFlags; + unsigned int ui_AiDataLength; + short *AiData; /* Pointer to sample data */ + unsigned int ui_AiNbrofScans; /* number of scans to do */ + unsigned short us_UseDma; /* To use Dma or not */ + unsigned char b_DmaDoubleBuffer; /* we can use double buffering */ + unsigned int ui_DmaActualBuffer; /* which buffer is used now */ + /* UPDATE-0.7.57->0.7.68 */ + /* unsigned int ul_DmaBufferVirtual[2]; pointers to begin of DMA buffer */ + short *ul_DmaBufferVirtual[2]; /* pointers to begin of DMA buffer */ + unsigned int ul_DmaBufferHw[2]; /* hw address of DMA buff */ + unsigned int ui_DmaBufferSize[2]; /* size of dma buffer in bytes */ + unsigned int ui_DmaBufferUsesize[2]; /* which size we may now used for transfer */ + unsigned int ui_DmaBufferSamples[2]; /* size in samples */ + unsigned int ui_DmaBufferPages[2]; /* number of pages in buffer */ + unsigned char b_DigitalOutputRegister; /* Digital Output Register */ + unsigned char b_OutputMemoryStatus; + unsigned char b_AnalogInputChannelNbr; /* Analog input channel Nbr */ + unsigned char b_AnalogOutputChannelNbr; /* Analog input Output Nbr */ + unsigned char b_TimerSelectMode; /* Contain data written at iobase + 0C */ + unsigned char b_ModeSelectRegister; /* Contain data written at iobase + 0E */ + unsigned short us_OutputRegister; /* Contain data written at iobase + 0 */ + unsigned char b_InterruptState; + unsigned char b_TimerInit; /* Specify if InitTimerWatchdog was load */ + unsigned char b_TimerStarted; /* Specify if timer 2 is running or not */ + unsigned char b_Timer2Mode; /* Specify the timer 2 mode */ + unsigned char b_Timer2Interrupt; /* Timer2 interrupt enable or disable */ + unsigned char b_AiCyclicAcquisition; /* indicate cyclic acquisition */ + unsigned char b_InterruptMode; /* eoc eos or dma */ + unsigned char b_EocEosInterrupt; /* Enable disable eoc eos interrupt */ + unsigned int ui_EocEosConversionTime; + unsigned char b_EocEosConversionTimeBase; + unsigned char b_SingelDiff; + unsigned char b_ExttrigEnable; /* To enable or disable external trigger */ /* Pointer to the current process */ struct task_struct *tsk_Current; - boardtype *ps_BoardInfo; + struct addi_board *ps_BoardInfo; /* Hardware board infos for 1710 */ struct { - UINT ui_Address; /* Board address */ - UINT ui_FlashAddress; - BYTE b_InterruptNbr; /* Board interrupt number */ - BYTE b_SlotNumber; /* PCI slot number */ - BYTE b_BoardVersion; - DWORD dw_MolduleConfiguration[4]; /* Module config */ + unsigned int ui_Address; /* Board address */ + unsigned int ui_FlashAddress; + unsigned char b_InterruptNbr; /* Board interrupt number */ + unsigned char b_SlotNumber; /* PCI slot number */ + unsigned char b_BoardVersion; + unsigned int dw_MolduleConfiguration[4]; /* Module config */ } s_BoardInfos; /* Interrupt infos */ struct { - ULONG ul_InterruptOccur; /* 0 : No interrupt occur */ + unsigned int ul_InterruptOccur; /* 0 : No interrupt occur */ /* > 0 : Interrupt occur */ - UINT ui_Read; /* Read FIFO */ - UINT ui_Write; /* Write FIFO */ + unsigned int ui_Read; /* Read FIFO */ + unsigned int ui_Write; /* Write FIFO */ struct { - BYTE b_OldModuleMask; - ULONG ul_OldInterruptMask; /* Interrupt mask */ - ULONG ul_OldCounterLatchValue; /* Interrupt counter value */ + unsigned char b_OldModuleMask; + unsigned int ul_OldInterruptMask; /* Interrupt mask */ + unsigned int ul_OldCounterLatchValue; /* Interrupt counter value */ } s_FIFOInterruptParameters[APCI1710_SAVE_INTERRUPT]; } s_InterruptParameters; - str_ModuleInfo s_ModuleInfo[4]; - ULONG ul_TTLPortConfiguration[10]; + union str_ModuleInfo s_ModuleInfo[4]; + unsigned int ul_TTLPortConfiguration[10]; -} addi_private; +}; static unsigned short pci_list_builded; /* set to 1 when list of card is known */ @@ -457,6 +443,6 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it) static int i_ADDI_Detach(struct comedi_device *dev); static int i_ADDI_Reset(struct comedi_device *dev); -static irqreturn_t v_ADDI_Interrupt(int irq, void *d PT_REGS_ARG); +static irqreturn_t v_ADDI_Interrupt(int irq, void *d); static int i_ADDIDATA_InsnReadEeprom(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); diff --git a/drivers/staging/comedi/drivers/addi-data/addi_eeprom.c b/drivers/staging/comedi/drivers/addi-data/addi_eeprom.c index a8a1bb2e8fa5..1de291750736 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_eeprom.c +++ b/drivers/staging/comedi/drivers/addi-data/addi_eeprom.c @@ -45,19 +45,11 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc +----------+-----------+------------------------------------------------+ */ -#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 * - -#ifndef DWORD -#define DWORD unsigned int -#endif +#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 EEPROM_DIGITALINPUT 0 #define EEPROM_DIGITALOUTPUT 1 @@ -68,107 +60,114 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc #define EEPROM_TIMER_WATCHDOG_COUNTER 10 struct str_Functionality { - BYTE b_Type; - WORD w_Address; + unsigned char b_Type; + unsigned short w_Address; }; -typedef struct { - WORD w_HeaderSize; - BYTE b_Nfunctions; +struct str_MainHeader { + unsigned short w_HeaderSize; + unsigned char b_Nfunctions; struct str_Functionality s_Functions[7]; -} str_MainHeader; +}; -typedef struct { - WORD w_Nchannel; - BYTE b_Interruptible; - WORD w_NinterruptLogic; -} str_DigitalInputHeader; +struct str_DigitalInputHeader { + unsigned short w_Nchannel; + unsigned char b_Interruptible; + unsigned short w_NinterruptLogic; +}; -typedef struct { - WORD w_Nchannel; -} str_DigitalOutputHeader; +struct str_DigitalOutputHeader { -// used for timer as well as watchdog + unsigned short w_Nchannel; +}; -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; +/* used for timer as well as watchdog */ + +struct str_TimerDetails { + + unsigned short w_HeaderSize; + unsigned char b_Resolution; + unsigned char b_Mode; /* in case of Watchdog it is functionality */ + unsigned short w_MinTiming; + unsigned char b_TimeBase; +}; + +struct str_TimerMainHeader { + + + unsigned short w_Ntimer; + struct str_TimerDetails s_TimerDetails[4]; /* supports 4 timers */ +}; + typedef struct { - WORD w_Nchannel; - BYTE b_Resolution; + unsigned short w_Nchannel; + unsigned char b_Resolution; } str_AnalogOutputHeader; -typedef struct { - WORD w_Nchannel; - WORD w_MinConvertTiming; - WORD w_MinDelayTiming; - BYTE b_HasDma; - BYTE b_Resolution; -} str_AnalogInputHeader; +struct str_AnalogInputHeader { + unsigned short w_Nchannel; + unsigned short w_MinConvertTiming; + unsigned short w_MinDelayTiming; + unsigned char b_HasDma; + unsigned char b_Resolution; +}; + /*****************************************/ /* Read Header Functions */ /*****************************************/ -INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress, +int i_EepromReadMainHeader(unsigned short w_PCIBoardEepromAddress, char *pc_PCIChipInformation, struct comedi_device *dev); -INT i_EepromReadDigitalInputHeader(WORD w_PCIBoardEepromAddress, - char *pc_PCIChipInformation, WORD w_Address, - str_DigitalInputHeader * s_Header); +int i_EepromReadDigitalInputHeader(unsigned short w_PCIBoardEepromAddress, + char *pc_PCIChipInformation, unsigned short w_Address, + struct str_DigitalInputHeader * s_Header); -INT i_EepromReadDigitalOutputHeader(WORD w_PCIBoardEepromAddress, - char *pc_PCIChipInformation, WORD w_Address, - str_DigitalOutputHeader * s_Header); +int i_EepromReadDigitalOutputHeader(unsigned short w_PCIBoardEepromAddress, + char *pc_PCIChipInformation, unsigned short w_Address, + struct str_DigitalOutputHeader * s_Header); -INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress, - char *pc_PCIChipInformation, WORD w_Address, - str_TimerMainHeader * s_Header); +int i_EepromReadTimerHeader(unsigned short w_PCIBoardEepromAddress, + char *pc_PCIChipInformation, unsigned short w_Address, + struct str_TimerMainHeader * s_Header); -INT i_EepromReadAnlogOutputHeader(WORD w_PCIBoardEepromAddress, - char *pc_PCIChipInformation, WORD w_Address, +int i_EepromReadAnlogOutputHeader(unsigned short w_PCIBoardEepromAddress, + char *pc_PCIChipInformation, unsigned short w_Address, str_AnalogOutputHeader * s_Header); -INT i_EepromReadAnlogInputHeader(WORD w_PCIBoardEepromAddress, - char *pc_PCIChipInformation, WORD w_Address, - str_AnalogInputHeader * s_Header); +int i_EepromReadAnlogInputHeader(unsigned short w_PCIBoardEepromAddress, + char *pc_PCIChipInformation, unsigned short w_Address, + struct str_AnalogInputHeader * s_Header); /******************************************/ /* Eeprom Specific Functions */ /******************************************/ -WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress, char *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); +unsigned short w_EepromReadWord(unsigned short w_PCIBoardEepromAddress, char *pc_PCIChipInformation, + unsigned short w_EepromStartAddress); +void v_EepromWaitBusy(unsigned short w_PCIBoardEepromAddress); +void v_EepromClock76(unsigned int dw_Address, unsigned int dw_RegisterValue); +void v_EepromWaitBusy(unsigned short w_PCIBoardEepromAddress); +void v_EepromSendCommand76(unsigned int dw_Address, unsigned int dw_EepromCommand, + unsigned char b_DataLengthInBits); +void v_EepromCs76Read(unsigned int dw_Address, unsigned short w_offset, unsigned short * pw_Value); /* +----------------------------------------------------------------------------+ -| Function Name : WORD w_EepromReadWord | -| (WORD w_PCIBoardEepromAddress, | +| Function Name : unsigned short w_EepromReadWord | +| (unsigned short w_PCIBoardEepromAddress, | | char * pc_PCIChipInformation, | -| WORD w_EepromStartAddress) | +| unsigned short w_EepromStartAddress) | +----------------------------------------------------------------------------+ | Task : Read from eepromn a word | +----------------------------------------------------------------------------+ -| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | +| Input Parameters : unsigned short w_PCIBoardEepromAddress : PCI eeprom address | | | | char *pc_PCIChipInformation : PCI Chip Type. | | | -| WORD w_EepromStartAddress : Selected eeprom address | +| unsigned short w_EepromStartAddress : Selected eeprom address | +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -176,23 +175,23 @@ void v_EepromCs76Read(DWORD dw_Address, WORD w_offset, PWORD pw_Value); +----------------------------------------------------------------------------+ */ -WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress, char *pc_PCIChipInformation, - WORD w_EepromStartAddress) +unsigned short w_EepromReadWord(unsigned short w_PCIBoardEepromAddress, char *pc_PCIChipInformation, + unsigned short w_EepromStartAddress) { - BYTE b_Counter = 0; + unsigned char b_Counter = 0; - BYTE b_ReadByte = 0; + unsigned char b_ReadByte = 0; - BYTE b_ReadLowByte = 0; + unsigned char b_ReadLowByte = 0; - BYTE b_ReadHighByte = 0; + unsigned char b_ReadHighByte = 0; - BYTE b_SelectedAddressLow = 0; + unsigned char b_SelectedAddressLow = 0; - BYTE b_SelectedAddressHigh = 0; + unsigned char b_SelectedAddressHigh = 0; - WORD w_ReadWord = 0; + unsigned short w_ReadWord = 0; /**************************/ @@ -207,9 +206,9 @@ WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress, char *pc_PCIChipInformation, for (b_Counter = 0; b_Counter < 2; b_Counter++) { - b_SelectedAddressLow = (w_EepromStartAddress + b_Counter) % 256; //Read the low 8 bit part + 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 + b_SelectedAddressHigh = (w_EepromStartAddress + b_Counter) / 256; /* Read the high 8 bit part */ /************************************/ @@ -320,20 +319,20 @@ WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress, char *pc_PCIChipInformation, b_ReadLowByte = b_ReadByte; - } // if(b_Counter==0) + } /* if(b_Counter==0) */ else { b_ReadHighByte = b_ReadByte; - } // if(b_Counter==0) + } /* if(b_Counter==0) */ - } // for (b_Counter=0; b_Counter<2; b_Counter++) + } /* for (b_Counter=0; b_Counter<2; b_Counter++) */ - w_ReadWord = (b_ReadLowByte | (((WORD) b_ReadHighByte) * 256)); + w_ReadWord = (b_ReadLowByte | (((unsigned short) b_ReadHighByte) * 256)); - } // end of if ((!strcmp(pc_PCIChipInformation, "S5920")) || (!strcmp(pc_PCIChipInformation, "S5933"))) + } /* end of if ((!strcmp(pc_PCIChipInformation, "S5920")) || (!strcmp(pc_PCIChipInformation, "S5933"))) */ if (!strcmp(pc_PCIChipInformation, "93C76")) { @@ -359,7 +358,7 @@ WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress, char *pc_PCIChipInformation, | Function Name : void v_EepromWaitBusy | -| (WORD w_PCIBoardEepromAddress) | +| (unsigned short w_PCIBoardEepromAddress) | +----------------------------------------------------------------------------+ @@ -367,7 +366,7 @@ WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress, char *pc_PCIChipInformation, +----------------------------------------------------------------------------+ -| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom base address | +| Input Parameters : unsigned short w_PCIBoardEepromAddress : PCI eeprom base address | +----------------------------------------------------------------------------+ @@ -381,10 +380,10 @@ WORD w_EepromReadWord(WORD w_PCIBoardEepromAddress, char *pc_PCIChipInformation, */ -void v_EepromWaitBusy(WORD w_PCIBoardEepromAddress) +void v_EepromWaitBusy(unsigned short w_PCIBoardEepromAddress) { - BYTE b_EepromBusy = 0; + unsigned char b_EepromBusy = 0; do { @@ -403,9 +402,9 @@ void v_EepromWaitBusy(WORD w_PCIBoardEepromAddress) /* the operator register is AMCC_OP_REG_MCSR+3 */ - /* WORD read EEPROM=0x8000 andAMCC_OP_REG_MCSR+2 */ + /* unsigned short read EEPROM=0x8000 andAMCC_OP_REG_MCSR+2 */ - /* DWORD read EEPROM=0x80000000 and AMCC_OP_REG_MCSR */ + /* unsigned int read EEPROM=0x80000000 and AMCC_OP_REG_MCSR */ /************************************************************************/ @@ -421,9 +420,9 @@ void v_EepromWaitBusy(WORD w_PCIBoardEepromAddress) +---------------------------------------------------------------------------------+ -| Function Name : void v_EepromClock76(DWORD dw_Address, | +| Function Name : void v_EepromClock76(unsigned int dw_Address, | -| DWORD dw_RegisterValue) | +| unsigned int dw_RegisterValue) | +---------------------------------------------------------------------------------+ @@ -431,9 +430,9 @@ void v_EepromWaitBusy(WORD w_PCIBoardEepromAddress) +---------------------------------------------------------------------------------+ -| Input Parameters : DWORD dw_Address : PCI eeprom base address | +| Input Parameters : unsigned int dw_Address : PCI eeprom base address | -| DWORD dw_RegisterValue : PCI eeprom register value to write.| +| unsigned int dw_RegisterValue : PCI eeprom register value to write.| +---------------------------------------------------------------------------------+ @@ -447,7 +446,7 @@ void v_EepromWaitBusy(WORD w_PCIBoardEepromAddress) */ -void v_EepromClock76(DWORD dw_Address, DWORD dw_RegisterValue) +void v_EepromClock76(unsigned int dw_Address, unsigned int dw_RegisterValue) { /************************/ @@ -488,11 +487,11 @@ void v_EepromClock76(DWORD dw_Address, DWORD dw_RegisterValue) +---------------------------------------------------------------------------------+ -| Function Name : void v_EepromSendCommand76(DWORD dw_Address, | +| Function Name : void v_EepromSendCommand76(unsigned int dw_Address, | -| DWORD dw_EepromCommand, | +| unsigned int dw_EepromCommand, | -| BYTE b_DataLengthInBits) | +| unsigned char b_DataLengthInBits) | +---------------------------------------------------------------------------------+ @@ -500,11 +499,11 @@ void v_EepromClock76(DWORD dw_Address, DWORD dw_RegisterValue) +---------------------------------------------------------------------------------+ -| Input Parameters : DWORD dw_Address : PCI eeprom base address | +| Input Parameters : unsigned int dw_Address : PCI eeprom base address | -| DWORD dw_EepromCommand : PCI eeprom command to write. | +| unsigned int dw_EepromCommand : PCI eeprom command to write. | -| BYTE b_DataLengthInBits : PCI eeprom command data length. | +| unsigned char b_DataLengthInBits : PCI eeprom command data length. | +---------------------------------------------------------------------------------+ @@ -518,13 +517,13 @@ void v_EepromClock76(DWORD dw_Address, DWORD dw_RegisterValue) */ -void v_EepromSendCommand76(DWORD dw_Address, DWORD dw_EepromCommand, - BYTE b_DataLengthInBits) +void v_EepromSendCommand76(unsigned int dw_Address, unsigned int dw_EepromCommand, + unsigned char b_DataLengthInBits) { char c_BitPos = 0; - DWORD dw_RegisterValue = 0; + unsigned int dw_RegisterValue = 0; /*****************************/ @@ -623,11 +622,11 @@ void v_EepromSendCommand76(DWORD dw_Address, DWORD dw_EepromCommand, +---------------------------------------------------------------------------------+ -| Function Name : void v_EepromCs76Read(DWORD dw_Address, | +| Function Name : void v_EepromCs76Read(unsigned int dw_Address, | -| WORD w_offset, | +| unsigned short w_offset, | -| PWORD pw_Value) | +| unsigned short * pw_Value) | +---------------------------------------------------------------------------------+ @@ -635,11 +634,11 @@ void v_EepromSendCommand76(DWORD dw_Address, DWORD dw_EepromCommand, +---------------------------------------------------------------------------------+ -| Input Parameters : DWORD dw_Address : PCI eeprom base address | +| Input Parameters : unsigned int dw_Address : PCI eeprom base address | -| WORD w_offset : Offset of the adress to read | +| unsigned short w_offset : Offset of the adress to read | -| PWORD pw_Value : PCI eeprom 16 bit read value. | +| unsigned short * pw_Value : PCI eeprom 16 bit read value. | +---------------------------------------------------------------------------------+ @@ -653,14 +652,14 @@ void v_EepromSendCommand76(DWORD dw_Address, DWORD dw_EepromCommand, */ -void v_EepromCs76Read(DWORD dw_Address, WORD w_offset, PWORD pw_Value) +void v_EepromCs76Read(unsigned int dw_Address, unsigned short w_offset, unsigned short * pw_Value) { char c_BitPos = 0; - DWORD dw_RegisterValue = 0; + unsigned int dw_RegisterValue = 0; - DWORD dw_RegisterValueRead = 0; + unsigned int dw_RegisterValueRead = 0; /*************************************************/ @@ -786,12 +785,12 @@ void v_EepromCs76Read(DWORD dw_Address, WORD w_offset, PWORD pw_Value) /* +----------------------------------------------------------------------------+ -| Function Name : INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress, | +| Function Name : int i_EepromReadMainHeader(unsigned short w_PCIBoardEepromAddress, | | char * pc_PCIChipInformation,struct comedi_device *dev) | +----------------------------------------------------------------------------+ | Task : Read from eeprom Main Header | +----------------------------------------------------------------------------+ -| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | +| Input Parameters : unsigned short w_PCIBoardEepromAddress : PCI eeprom address | | | | char *pc_PCIChipInformation : PCI Chip Type. | | | @@ -804,17 +803,17 @@ void v_EepromCs76Read(DWORD dw_Address, WORD w_offset, PWORD pw_Value) +----------------------------------------------------------------------------+ */ -INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress, +int i_EepromReadMainHeader(unsigned short w_PCIBoardEepromAddress, char *pc_PCIChipInformation, struct 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; + unsigned short w_Temp, i, w_Count = 0; + unsigned int ui_Temp; + struct str_MainHeader s_MainHeader; + struct str_DigitalInputHeader s_DigitalInputHeader; + struct str_DigitalOutputHeader s_DigitalOutputHeader; + //struct str_TimerMainHeader s_TimerMainHeader,s_WatchdogMainHeader; str_AnalogOutputHeader s_AnalogOutputHeader; - str_AnalogInputHeader s_AnalogInputHeader; + struct str_AnalogInputHeader s_AnalogInputHeader; // Read size s_MainHeader.w_HeaderSize = @@ -824,14 +823,14 @@ INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress, // Read nbr of functionality w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation, 0x100 + 10); - s_MainHeader.b_Nfunctions = (BYTE) w_Temp & 0x00FF; + s_MainHeader.b_Nfunctions = (unsigned char) w_Temp & 0x00FF; // Read functionality details for (i = 0; i < s_MainHeader.b_Nfunctions; i++) { // Read Type w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation, 0x100 + 12 + w_Count); - s_MainHeader.s_Functions[i].b_Type = (BYTE) w_Temp & 0x3F; + s_MainHeader.s_Functions[i].b_Type = (unsigned char) w_Temp & 0x3F; w_Count = w_Count + 2; //Read Address s_MainHeader.s_Functions[i].w_Address = @@ -878,10 +877,10 @@ INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress, s_AnalogInputHeader.w_Nchannel; this_board->i_Dma = s_AnalogInputHeader.b_HasDma; this_board->ui_MinAcquisitiontimeNs = - (UINT) s_AnalogInputHeader.w_MinConvertTiming * + (unsigned int) s_AnalogInputHeader.w_MinConvertTiming * 1000; this_board->ui_MinDelaytimeNs = - (UINT) s_AnalogInputHeader.w_MinDelayTiming * + (unsigned int) s_AnalogInputHeader.w_MinDelayTiming * 1000; ui_Temp = 0xffff; this_board->i_AiMaxdata = @@ -903,15 +902,15 @@ INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress, break; case EEPROM_TIMER: - this_board->i_Timer = 1; //Timer subdevice present + this_board->i_Timer = 1; /* Timer subdevice present */ break; case EEPROM_WATCHDOG: - this_board->i_Timer = 1; //Timer subdevice present + this_board->i_Timer = 1; /* Timer subdevice present */ break; case EEPROM_TIMER_WATCHDOG_COUNTER: - this_board->i_Timer = 1; //Timer subdevice present + this_board->i_Timer = 1; /* Timer subdevice present */ } } @@ -920,18 +919,18 @@ INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress, /* +----------------------------------------------------------------------------+ -| Function Name : INT i_EepromReadDigitalInputHeader(WORD | +| Function Name : int i_EepromReadDigitalInputHeader(unsigned short | | w_PCIBoardEepromAddress,char *pc_PCIChipInformation, | -| WORD w_Address,str_DigitalInputHeader *s_Header) | +| unsigned short w_Address,struct str_DigitalInputHeader *s_Header) | | | +----------------------------------------------------------------------------+ | Task : Read Digital Input Header | +----------------------------------------------------------------------------+ -| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | +| Input Parameters : unsigned short w_PCIBoardEepromAddress : PCI eeprom address | | | | char *pc_PCIChipInformation : PCI Chip Type. | | | -| str_DigitalInputHeader *s_Header: Digita Input Header | +| struct str_DigitalInputHeader *s_Header: Digita Input Header | | Pointer | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -939,23 +938,23 @@ INT i_EepromReadMainHeader(WORD w_PCIBoardEepromAddress, | Return Value : 0 | +----------------------------------------------------------------------------+ */ -INT i_EepromReadDigitalInputHeader(WORD w_PCIBoardEepromAddress, - char *pc_PCIChipInformation, WORD w_Address, - str_DigitalInputHeader * s_Header) +int i_EepromReadDigitalInputHeader(unsigned short w_PCIBoardEepromAddress, + char *pc_PCIChipInformation, unsigned short w_Address, + struct str_DigitalInputHeader *s_Header) { - WORD w_Temp; + unsigned short w_Temp; - // read nbr of channels + /* read nbr of channels */ s_Header->w_Nchannel = w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation, 0x100 + w_Address + 6); - // interruptible or not + /* interruptible or not */ w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation, 0x100 + w_Address + 8); - s_Header->b_Interruptible = (BYTE) (w_Temp >> 7) & 0x01; + s_Header->b_Interruptible = (unsigned char) (w_Temp >> 7) & 0x01; -// How many interruptible logic +/* How many interruptible logic */ s_Header->w_NinterruptLogic = w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation, 0x100 + w_Address + 10); @@ -965,18 +964,18 @@ INT i_EepromReadDigitalInputHeader(WORD w_PCIBoardEepromAddress, /* +----------------------------------------------------------------------------+ -| Function Name : INT i_EepromReadDigitalOutputHeader(WORD | +| Function Name : int i_EepromReadDigitalOutputHeader(unsigned short | | w_PCIBoardEepromAddress,char *pc_PCIChipInformation, | -| WORD w_Address,str_DigitalOutputHeader *s_Header) | +| unsigned short w_Address,struct str_DigitalOutputHeader *s_Header) | | | +----------------------------------------------------------------------------+ | Task : Read Digital Output Header | +----------------------------------------------------------------------------+ -| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | +| Input Parameters : unsigned short w_PCIBoardEepromAddress : PCI eeprom address | | | | char *pc_PCIChipInformation : PCI Chip Type. | | | -| str_DigitalOutputHeader *s_Header: Digital Output Header| +| struct str_DigitalOutputHeader *s_Header: Digital Output Header| | Pointer | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -984,11 +983,11 @@ INT i_EepromReadDigitalInputHeader(WORD w_PCIBoardEepromAddress, | Return Value : 0 | +----------------------------------------------------------------------------+ */ -INT i_EepromReadDigitalOutputHeader(WORD w_PCIBoardEepromAddress, - char *pc_PCIChipInformation, WORD w_Address, - str_DigitalOutputHeader * s_Header) +int i_EepromReadDigitalOutputHeader(unsigned short w_PCIBoardEepromAddress, + char *pc_PCIChipInformation, unsigned short w_Address, + struct str_DigitalOutputHeader * s_Header) { -// Read Nbr channels +/* Read Nbr channels */ s_Header->w_Nchannel = w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation, 0x100 + w_Address + 6); @@ -997,17 +996,17 @@ INT i_EepromReadDigitalOutputHeader(WORD w_PCIBoardEepromAddress, /* +----------------------------------------------------------------------------+ -| Function Name : INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress, | +| Function Name : int i_EepromReadTimerHeader(unsigned short w_PCIBoardEepromAddress, | | char *pc_PCIChipInformation,WORD w_Address, | -| str_TimerMainHeader *s_Header) | +| struct str_TimerMainHeader *s_Header) | +----------------------------------------------------------------------------+ | Task : Read Timer or Watchdog Header | +----------------------------------------------------------------------------+ -| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | +| Input Parameters : unsigned short w_PCIBoardEepromAddress : PCI eeprom address | | | | char *pc_PCIChipInformation : PCI Chip Type. | | | -| str_TimerMainHeader *s_Header: Timer Header | +| struct str_TimerMainHeader *s_Header: Timer Header | | Pointer | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -1015,18 +1014,18 @@ INT i_EepromReadDigitalOutputHeader(WORD w_PCIBoardEepromAddress, | Return Value : 0 | +----------------------------------------------------------------------------+ */ -INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress, - char *pc_PCIChipInformation, WORD w_Address, - str_TimerMainHeader * s_Header) +int i_EepromReadTimerHeader(unsigned short w_PCIBoardEepromAddress, + char *pc_PCIChipInformation, unsigned short w_Address, + struct str_TimerMainHeader * s_Header) { - WORD i, w_Size = 0, w_Temp; + unsigned short i, w_Size = 0, w_Temp; -//Read No of Timer +/* Read No of Timer */ s_Header->w_Ntimer = w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation, 0x100 + w_Address + 6); -//Read header size +/* Read header size */ for (i = 0; i < s_Header->w_Ntimer; i++) { s_Header->s_TimerDetails[i].w_HeaderSize = @@ -1037,23 +1036,23 @@ INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress, pc_PCIChipInformation, 0x100 + w_Address + 8 + w_Size + 2); - //Read Resolution + /* Read Resolution */ s_Header->s_TimerDetails[i].b_Resolution = - (BYTE) (w_Temp >> 10) & 0x3F; + (unsigned char) (w_Temp >> 10) & 0x3F; - //Read Mode + /* Read Mode */ s_Header->s_TimerDetails[i].b_Mode = - (BYTE) (w_Temp >> 4) & 0x3F; + (unsigned char) (w_Temp >> 4) & 0x3F; w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation, 0x100 + w_Address + 8 + w_Size + 4); - //Read MinTiming + /* 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; + /* Read Timebase */ + s_Header->s_TimerDetails[i].b_TimeBase = (unsigned char) (w_Temp) & 0x3F; w_Size += s_Header->s_TimerDetails[i].w_HeaderSize; } @@ -1062,13 +1061,13 @@ INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress, /* +----------------------------------------------------------------------------+ -| Function Name : INT i_EepromReadAnlogOutputHeader(WORD | +| Function Name : int i_EepromReadAnlogOutputHeader(unsigned short | | w_PCIBoardEepromAddress,char *pc_PCIChipInformation, | -| WORD w_Address,str_AnalogOutputHeader *s_Header) | +| unsigned short w_Address,str_AnalogOutputHeader *s_Header) | +----------------------------------------------------------------------------+ | Task : Read Nalog Output Header | +----------------------------------------------------------------------------+ -| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | +| Input Parameters : unsigned short w_PCIBoardEepromAddress : PCI eeprom address | | | | char *pc_PCIChipInformation : PCI Chip Type. | | | @@ -1081,35 +1080,35 @@ INT i_EepromReadTimerHeader(WORD w_PCIBoardEepromAddress, +----------------------------------------------------------------------------+ */ -INT i_EepromReadAnlogOutputHeader(WORD w_PCIBoardEepromAddress, - char *pc_PCIChipInformation, WORD w_Address, +int i_EepromReadAnlogOutputHeader(unsigned short w_PCIBoardEepromAddress, + char *pc_PCIChipInformation, unsigned short w_Address, str_AnalogOutputHeader * s_Header) { - WORD w_Temp; - // No of channels for 1st hard component + unsigned short 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 + /* 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; + s_Header->b_Resolution = (unsigned char) (w_Temp >> 8) & 0xFF; return 0; } /* +----------------------------------------------------------------------------+ -| Function Name : INT i_EepromReadAnlogInputHeader(WORD | +| Function Name : int i_EepromReadAnlogInputHeader(unsigned short | | w_PCIBoardEepromAddress,char *pc_PCIChipInformation, | -| WORD w_Address,str_AnalogInputHeader *s_Header) | +| unsigned short w_Address,struct str_AnalogInputHeader *s_Header) | +----------------------------------------------------------------------------+ | Task : Read Nalog Output Header | +----------------------------------------------------------------------------+ -| Input Parameters : WORD w_PCIBoardEepromAddress : PCI eeprom address | +| Input Parameters : unsigned short w_PCIBoardEepromAddress : PCI eeprom address | | | | char *pc_PCIChipInformation : PCI Chip Type. | | | -| str_AnalogInputHeader *s_Header:Anlog Input Header | +| struct str_AnalogInputHeader *s_Header:Anlog Input Header | | Pointer | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -1118,12 +1117,12 @@ INT i_EepromReadAnlogOutputHeader(WORD w_PCIBoardEepromAddress, +----------------------------------------------------------------------------+ */ -// Reads only for ONE hardware component -INT i_EepromReadAnlogInputHeader(WORD w_PCIBoardEepromAddress, - char *pc_PCIChipInformation, WORD w_Address, - str_AnalogInputHeader * s_Header) +/* Reads only for ONE hardware component */ +int i_EepromReadAnlogInputHeader(unsigned short w_PCIBoardEepromAddress, + char *pc_PCIChipInformation, unsigned short w_Address, + struct str_AnalogInputHeader * s_Header) { - WORD w_Temp, w_Offset; + unsigned short w_Temp, w_Offset; w_Temp = w_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation, 0x100 + w_Address + 10); s_Header->w_Nchannel = (w_Temp >> 4) & 0x03FF; @@ -1135,24 +1134,24 @@ INT i_EepromReadAnlogInputHeader(WORD w_PCIBoardEepromAddress, 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 + 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_EepromReadWord(w_PCIBoardEepromAddress, pc_PCIChipInformation, 0x100 + w_Address + 72); /* reading Y */ w_Temp = w_Temp & 0x00FF; - if (w_Temp) //Y>0 + 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 + (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 + w_Offset = w_Offset + 2; /* resolution */ } -// read 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 + s_Header->b_Resolution = w_Temp & 0x001F; /* last 5 bits */ return 0; } diff --git a/drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h b/drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h index 617dc087dcbf..bee6101d2e87 100644 --- a/drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h +++ b/drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h @@ -31,15 +31,15 @@ *************************/ -#define FIFO_ADVANCE_ON_BYTE_2 0x20000000 // written on base0 +#define FIFO_ADVANCE_ON_BYTE_2 0x20000000 /* written on base0 */ -#define AMWEN_ENABLE 0x02 // added for step 6 dma written on base2 +#define AMWEN_ENABLE 0x02 /* added for step 6 dma written on base2 */ #define A2P_FIFO_WRITE_ENABLE 0x01 -#define AGCSTS_TC_ENABLE 0x10000000 // Added for transfer count enable bit +#define AGCSTS_TC_ENABLE 0x10000000 /* Added for transfer count enable bit */ -// ADDON RELATED ADDITIONS -// Constant +/* ADDON RELATED ADDITIONS */ +/* Constant */ #define APCI3120_ENABLE_TRANSFER_ADD_ON_LOW 0x00 #define APCI3120_ENABLE_TRANSFER_ADD_ON_HIGH 0x1200 #define APCI3120_A2P_FIFO_MANAGEMENT 0x04000400L @@ -52,7 +52,7 @@ #define APCI3120_DISABLE_BUS_MASTER_ADD_ON 0x0 #define APCI3120_DISABLE_BUS_MASTER_PCI 0x0 - // ADD_ON ::: this needed since apci supports 16 bit interface to add on + /* ADD_ON ::: this needed since apci supports 16 bit interface to add on */ #define APCI3120_ADD_ON_AGCSTS_LOW 0x3C #define APCI3120_ADD_ON_AGCSTS_HIGH APCI3120_ADD_ON_AGCSTS_LOW + 2 #define APCI3120_ADD_ON_MWAR_LOW 0x24 @@ -60,7 +60,7 @@ #define APCI3120_ADD_ON_MWTC_LOW 0x058 #define APCI3120_ADD_ON_MWTC_HIGH APCI3120_ADD_ON_MWTC_LOW + 2 -// AMCC +/* AMCC */ #define APCI3120_AMCC_OP_MCSR 0x3C #define APCI3120_AMCC_OP_REG_INTCSR 0x38 @@ -85,7 +85,7 @@ #define AMCC_OP_REG_MRTC 0x30 #define AMCC_OP_REG_MBEF 0x34 #define AMCC_OP_REG_INTCSR 0x38 -#define AMCC_OP_REG_INTCSR_SRC (AMCC_OP_REG_INTCSR + 2) /* INT source */ +#define AMCC_OP_REG_INTCSR_SRC (AMCC_OP_REG_INTCSR + 2) /* int source */ #define AMCC_OP_REG_INTCSR_FEC (AMCC_OP_REG_INTCSR + 3) /* FIFO ctrl */ #define AMCC_OP_REG_MCSR 0x3c #define AMCC_OP_REG_MCSR_NVDATA (AMCC_OP_REG_MCSR + 2) /* Data in byte 2 */ @@ -212,7 +212,7 @@ struct pcilst_struct { unsigned int irq; }; -struct pcilst_struct *amcc_devices; // ptr to root list of all amcc devices +struct pcilst_struct *amcc_devices; /* ptr to root list of all amcc devices */ /****************************************************************************/ @@ -267,7 +267,7 @@ void v_pci_card_list_init(unsigned short pci_vendor, char display) amcc->vendor = pcidev->vendor; amcc->device = pcidev->device; #if 0 - amcc->master = pcidev->master; // how get this information under 2.4 kernels? + amcc->master = pcidev->master; /* how get this information under 2.4 kernels? */ #endif amcc->pci_bus = pcidev->bus->number; amcc->pci_slot = PCI_SLOT(pcidev->devfn); @@ -333,17 +333,17 @@ int i_find_free_pci_card_by_position(unsigned short vendor_id, && (amcc->pci_slot == pci_slot)) { if (!(amcc->used)) { *card = amcc; - return 0; // ok, card is found + return 0; /* ok, card is found */ } else { rt_printk (" - \nCard on requested position is used b:s %d:%d!\n", pci_bus, pci_slot); - return 2; // card exist but is used + return 2; /* card exist but is used */ } } } - return 1; // no card found + return 1; /* no card found */ } /****************************************************************************/ @@ -422,7 +422,7 @@ struct pcilst_struct *ptr_select_and_alloc_pci_card(unsigned short vendor_id, { struct pcilst_struct *card; - if ((pci_bus < 1) & (pci_slot < 1)) { // use autodetection + if ((pci_bus < 1) & (pci_slot < 1)) { /* use autodetection */ if ((card = ptr_find_free_pci_card_by_device(vendor_id, device_id)) == NULL) { diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.c index 3f8929c09070..502aaeaa8020 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.c @@ -62,11 +62,11 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev) int ret = 0; int n_subdevices = 9; - //Update-0.7.57->0.7.68dev->n_subdevices = 9; + /* Update-0.7.57->0.7.68dev->n_subdevices = 9; */ if ((ret = alloc_subdevices(dev, n_subdevices)) < 0) return; - // Allocate and Initialise Timer Subdevice Structures + /* Allocate and Initialise Timer Subdevice Structures */ s = dev->subdevices + 0; s->type = COMEDI_SUBD_TIMER; @@ -80,7 +80,7 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev) s->insn_config = i_APCI1710_InsnConfigInitTimer; s->insn_bits = i_APCI1710_InsnBitsTimer; - // Allocate and Initialise DIO Subdevice Structures + /* Allocate and Initialise DIO Subdevice Structures */ s = dev->subdevices + 1; s->type = COMEDI_SUBD_DIO; @@ -95,7 +95,7 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev) s->insn_bits = i_APCI1710_InsnBitsDigitalIOPortOnOff; s->insn_write = i_APCI1710_InsnWriteDigitalIOChlOnOff; - // Allocate and Initialise Chrono Subdevice Structures + /* Allocate and Initialise Chrono Subdevice Structures */ s = dev->subdevices + 2; s->type = COMEDI_SUBD_CHRONO; @@ -109,7 +109,7 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev) s->insn_config = i_APCI1710_InsnConfigInitChrono; s->insn_bits = i_APCI1710_InsnBitsChronoDigitalIO; - // Allocate and Initialise PWM Subdevice Structures + /* Allocate and Initialise PWM Subdevice Structures */ s = dev->subdevices + 3; s->type = COMEDI_SUBD_PWM; s->subdev_flags = @@ -118,13 +118,13 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev) s->maxdata = 1; s->len_chanlist = 3; s->range_table = &range_digital; - s->io_bits = 0; //all bits input + 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 + /* Allocate and Initialise TTLIO Subdevice Structures */ s = dev->subdevices + 4; s->type = COMEDI_SUBD_TTLIO; s->subdev_flags = @@ -132,13 +132,13 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev) s->n_chan = 8; s->maxdata = 1; s->len_chanlist = 8; - s->range_table = &range_apci1710_ttl; // to pass arguments in range + 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 + /* Allocate and Initialise TOR Subdevice Structures */ s = dev->subdevices + 5; s->type = COMEDI_SUBD_TOR; s->subdev_flags = @@ -147,13 +147,13 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev) s->maxdata = 1; s->len_chanlist = 8; s->range_table = &range_digital; - s->io_bits = 0; //all bits input + 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 + /* Allocate and Initialise SSI Subdevice Structures */ s = dev->subdevices + 6; s->type = COMEDI_SUBD_SSI; s->subdev_flags = @@ -166,7 +166,7 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev) s->insn_read = i_APCI1710_InsnReadSSIValue; s->insn_bits = i_APCI1710_InsnBitsSSIDigitalIO; - // Allocate and Initialise PULSEENCODER Subdevice Structures + /* Allocate and Initialise PULSEENCODER Subdevice Structures */ s = dev->subdevices + 7; s->type = COMEDI_SUBD_PULSEENCODER; s->subdev_flags = @@ -180,7 +180,7 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev) s->insn_bits = i_APCI1710_InsnBitsReadWritePulseEncoder; s->insn_read = i_APCI1710_InsnReadInterruptPulseEncoder; - // Allocate and Initialise INCREMENTALCOUNTER Subdevice Structures + /* Allocate and Initialise INCREMENTALCOUNTER Subdevice Structures */ s = dev->subdevices + 8; s->type = COMEDI_SUBD_INCREMENTALCOUNTER; s->subdev_flags = @@ -197,12 +197,12 @@ void i_ADDI_AttachPCI1710(struct comedi_device * dev) int i_APCI1710_Reset(struct comedi_device * dev); void v_APCI1710_Interrupt(int irq, void *d); -//for 1710 +/* for 1710 */ int i_APCI1710_Reset(struct comedi_device * dev) { int ret; - DWORD dw_Dummy; + unsigned int dw_Dummy; /*********************************/ /* Read all module configuration */ @@ -219,12 +219,12 @@ int i_APCI1710_Reset(struct comedi_device * dev) ret = inl(devpriv->s_BoardInfos.ui_Address + 252); devpriv->s_BoardInfos.dw_MolduleConfiguration[3] = ret; - // outl(0x80808082,devpriv->s_BoardInfos.ui_Address+0x60); + /* 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 + /* 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); @@ -234,11 +234,11 @@ int i_APCI1710_Reset(struct comedi_device * dev) /* +----------------------------------------------------------------------------+ | Function's Name : __void__ v_APCI1710_InterruptFunction | -| (BYTE b_Interrupt, __CPPARGS) | +| (unsigned char b_Interrupt, __CPPARGS) | +----------------------------------------------------------------------------+ | Task : APCI-1710 interrupt function | +----------------------------------------------------------------------------+ -| Input Parameters : BYTE b_Interrupt : Interrupt number | +| Input Parameters : unsigned char b_Interrupt : Interrupt number | +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -250,18 +250,18 @@ int i_APCI1710_Reset(struct comedi_device * dev) void v_APCI1710_Interrupt(int irq, void *d) { struct 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 = 0; - ULONG ul_82X54InterruptStatus; - ULONG ul_StatusRegister; - - str_ModuleInfo *ps_ModuleInfo; + unsigned char b_ModuleCpt = 0; + unsigned char b_InterruptFlag = 0; + unsigned char b_PWMCpt = 0; + unsigned char b_TorCounterCpt = 0; + unsigned char b_PulseIncoderCpt = 0; + unsigned int ui_16BitValue; + unsigned int ul_InterruptLatchReg = 0; + unsigned int ul_LatchRegisterValue = 0; + unsigned int ul_82X54InterruptStatus; + unsigned int ul_StatusRegister; + + union str_ModuleInfo *ps_ModuleInfo; printk("APCI1710 Interrupt\n"); for (b_ModuleCpt = 0; b_ModuleCpt < 4; b_ModuleCpt++, ps_ModuleInfo++) { @@ -279,7 +279,7 @@ void v_APCI1710_Interrupt(int irq, void *d) dw_MolduleConfiguration[b_ModuleCpt] & 0xFFFF0000UL) == APCI1710_82X54_TIMER) { - //printk("TIMER Interrupt Occurred\n"); + /* printk("TIMER Interrupt Occurred\n"); */ ul_82X54InterruptStatus = inl(devpriv->s_BoardInfos. ui_Address + 12 + (64 * b_ModuleCpt)); @@ -332,11 +332,11 @@ void v_APCI1710_Interrupt(int irq, void *d) /**********************/ /* Call user function */ /**********************/ - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); - } // if ((ul_82X54InterruptStatus & 0x7) != 0) - } // 82X54 timer + } /* if ((ul_82X54InterruptStatus & 0x7) != 0) */ + } /* 82X54 timer */ /***************************/ /* Test if increm. counter */ @@ -412,7 +412,7 @@ void v_APCI1710_Interrupt(int irq, void *d) /**********************/ /* Call user function */ /**********************/ - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); @@ -473,7 +473,7 @@ void v_APCI1710_Interrupt(int irq, void *d) /**********************/ /* Call user function */ /**********************/ - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); @@ -562,7 +562,7 @@ void v_APCI1710_Interrupt(int irq, void *d) /**********************/ /* Call user function */ /**********************/ - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); @@ -628,7 +628,7 @@ void v_APCI1710_Interrupt(int irq, void *d) /**********************/ /* Call user function */ /**********************/ - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); @@ -675,7 +675,7 @@ void v_APCI1710_Interrupt(int irq, void *d) if ((ul_LatchRegisterValue & 0xFFFFU) != 0) { ui_16BitValue = - (UINT) + (unsigned int) ul_LatchRegisterValue & 0xFFFFU; ul_LatchRegisterValue = @@ -693,7 +693,7 @@ void v_APCI1710_Interrupt(int irq, void *d) 0xFFFF0000UL) != 0) { ui_16BitValue = - (UINT) ( + (unsigned int) ( (ul_LatchRegisterValue >> 16) & 0xFFFFU); @@ -721,7 +721,7 @@ void v_APCI1710_Interrupt(int irq, void *d) if ((ul_LatchRegisterValue & 0xFFFF0000UL) != 0) { ui_16BitValue = - (UINT) ( + (unsigned int) ( (ul_LatchRegisterValue >> 16) & 0xFFFFU); @@ -741,7 +741,7 @@ void v_APCI1710_Interrupt(int irq, void *d) if ((ul_LatchRegisterValue & 0xFFFFU) != 0) { ui_16BitValue = - (UINT) + (unsigned int) ul_LatchRegisterValue & 0xFFFFU; ul_LatchRegisterValue = @@ -795,11 +795,11 @@ void v_APCI1710_Interrupt(int irq, void *d) /**********************/ /* Call user function */ /**********************/ - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); } - } // Incremental counter + } /* Incremental counter */ /***************/ /* Test if CDA */ @@ -870,14 +870,14 @@ void v_APCI1710_Interrupt(int irq, void *d) /* Call user function */ /**********************/ - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); - } // if (ul_StatusRegister & 1) + } /* if (ul_StatusRegister & 1) */ } - } // CDA + } /* CDA */ /***********************/ /* Test if PWM counter */ @@ -950,15 +950,15 @@ void v_APCI1710_Interrupt(int irq, void *d) /**********************/ /* Call user function */ /**********************/ - //Send a signal to from kernel to user space + /* 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 + } /* if (ul_StatusRegister & 0x1) */ + } /* if (APCI1710_ENABLE) */ + } /* for (b_PWMCpt == 0; b_PWMCpt < 0; b_PWMCpt ++) */ + } /* PWM counter */ /***********************/ /* Test if tor counter */ @@ -1054,14 +1054,14 @@ void v_APCI1710_Interrupt(int irq, void *d) /* Call user function */ /**********************/ - //Send a signal to from kernel to user space + /* 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 + } /* if (ul_StatusRegister & 0x1) */ + } /* if (APCI1710_ENABLE) */ + } /* for (b_TorCounterCpt == 0; b_TorCounterCpt < 0; b_TorCounterCpt ++) */ + } /* Tor counter */ /***********************/ /* Test if chronometer */ @@ -1071,7 +1071,7 @@ void v_APCI1710_Interrupt(int irq, void *d) dw_MolduleConfiguration[b_ModuleCpt] & 0xFFFF0000UL) == APCI1710_CHRONOMETER) { - //printk("APCI1710 Chrono Interrupt\n"); + /* printk("APCI1710 Chrono Interrupt\n"); */ /*****************************/ /* Read the interrupt status */ /*****************************/ @@ -1163,13 +1163,13 @@ void v_APCI1710_Interrupt(int irq, void *d) /**********************/ /* Call user function */ /**********************/ - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); } } - } // Chronometer + } /* Chronometer */ /*************************/ /* Test if pulse encoder */ @@ -1249,7 +1249,7 @@ void v_APCI1710_Interrupt(int irq, void *d) /**********************/ /* Call user function */ /**********************/ - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); @@ -1257,7 +1257,7 @@ void v_APCI1710_Interrupt(int irq, void *d) } } } - } //pulse encoder + } /* pulse encoder */ } return; diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.h index 998cbba8afeb..22b3e569ecd5 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_APCI1710.h @@ -44,7 +44,7 @@ #define APCI1710_SYNCHRONOUS_MODE 1 #define APCI1710_ASYNCHRONOUS_MODE 0 -//MODULE INFO STRUCTURE +/* MODULE INFO STRUCTURE */ static const struct comedi_lrange range_apci1710_ttl = { 4, { BIP_RANGE(10), diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c index e4527926c2df..e9c7a3c1c39f 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c @@ -52,9 +52,9 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc +----------------------------------------------------------------------------+ */ #include "hwdrv_apci035.h" -INT i_WatchdogNbr = 0; -INT i_Temp = 0; -INT i_Flag = 1; +int i_WatchdogNbr = 0; +int i_Temp = 0; +int i_Flag = 1; /* +----------------------------------------------------------------------------+ | Function Name : int i_APCI035_ConfigTimerWatchdog | @@ -64,7 +64,7 @@ INT i_Flag = 1; | Task : Configures The Timer , Counter or Watchdog | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | +| unsigned int *data : Data Pointer contains | | configuration parameters as below | | | | data[0] : 0 Configure As Timer | @@ -109,12 +109,12 @@ INT i_Flag = 1; | | +----------------------------------------------------------------------------+ */ -INT i_APCI035_ConfigTimerWatchdog(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI035_ConfigTimerWatchdog(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_Status = 0; - UINT ui_Command = 0; - UINT ui_Mode = 0; + unsigned int ui_Status = 0; + unsigned int ui_Command = 0; + unsigned int ui_Mode = 0; i_Temp = 0; devpriv->tsk_Current = current; devpriv->b_TimerSelectMode = data[0]; @@ -124,9 +124,9 @@ INT i_APCI035_ConfigTimerWatchdog(struct comedi_device * dev, struct comedi_subd } else { ui_Mode = 0; } -//ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); +/* ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); */ ui_Command = 0; -//ui_Command = ui_Command & 0xFFFFF9FEUL; +/* 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); @@ -153,7 +153,7 @@ INT i_APCI035_ConfigTimerWatchdog(struct comedi_device * dev, struct comedi_subd ui_Command = (ui_Command & 0xFFF719E2UL) | ui_Mode << 13UL | 0x10UL; - } //if (data[0] == ADDIDATA_TIMER) + } /* if (data[0] == ADDIDATA_TIMER) */ else { if (data[0] == ADDIDATA_WATCHDOG) { @@ -260,7 +260,7 @@ INT i_APCI035_ConfigTimerWatchdog(struct comedi_device * dev, struct comedi_subd | Task : Start / Stop The Selected Timer , or Watchdog | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | +| unsigned int *data : Data Pointer contains | | configuration parameters as below | | | | data[0] : 0 - Stop Selected Timer/Watchdog | @@ -278,11 +278,11 @@ INT i_APCI035_ConfigTimerWatchdog(struct comedi_device * dev, struct comedi_subd | | +----------------------------------------------------------------------------+ */ -INT i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device * dev, +int i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_Command = 0; - INT i_Count = 0; + unsigned int ui_Command = 0; + int i_Count = 0; if (data[0] == 1) { ui_Command = inl(devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12); @@ -292,7 +292,7 @@ INT i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device * dev, ui_Command = (ui_Command & 0xFFFFF9FFUL) | 0x1UL; outl(ui_Command, devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12); - } // if (data[0]==1) + } /* if (data[0]==1) */ if (data[0] == 2) { ui_Command = inl(devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12); @@ -304,16 +304,18 @@ INT i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device * dev, devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 12); } - if (data[0] == 0) //Stop The Watchdog + if (data[0] == 0) /* Stop The Watchdog */ { - //Stop The Watchdog + /* Stop The Watchdog */ ui_Command = 0; - //ui_Command = inl(devpriv->iobase+((i_WatchdogNbr-1)*32)+12); - //ui_Command = ui_Command & 0xFFFFF9FEUL; +/* +* 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 + } /* if (data[1]==0) */ + if (data[0] == 3) /* stop all Watchdogs */ { ui_Command = 0; for (i_Count = 1; i_Count <= 4; i_Count++) { @@ -329,7 +331,7 @@ INT i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device * dev, } } - if (data[0] == 4) //start all Watchdogs + if (data[0] == 4) /* start all Watchdogs */ { ui_Command = 0; for (i_Count = 1; i_Count <= 4; i_Count++) { @@ -344,7 +346,7 @@ INT i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device * dev, 0); } } - if (data[0] == 5) //trigger all Watchdogs + if (data[0] == 5) /* trigger all Watchdogs */ { ui_Command = 0; for (i_Count = 1; i_Count <= 4; i_Count++) { @@ -373,7 +375,7 @@ INT i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device * dev, | Task : Read The Selected Timer , Counter or Watchdog | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | +| unsigned int *data : Data Pointer contains | | configuration parameters as below | | | | | @@ -391,10 +393,10 @@ INT i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device * dev, | | +----------------------------------------------------------------------------+ */ -INT i_APCI035_ReadTimerWatchdog(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI035_ReadTimerWatchdog(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_Status = 0; // Status register + unsigned int ui_Status = 0; /* Status register */ i_WatchdogNbr = insn->unused[0]; /******************/ /* Get the status */ @@ -419,14 +421,14 @@ INT i_APCI035_ReadTimerWatchdog(struct comedi_device * dev, struct comedi_subdev if (devpriv->b_TimerSelectMode == ADDIDATA_TIMER) { data[4] = inl(devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 0); - } // if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) + } /* if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) */ return insn->n; } /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI035_ConfigAnalogInput | +| Function Name : int i_APCI035_ConfigAnalogInput | | (struct comedi_device *dev,struct comedi_subdevice *s, | | struct comedi_insn *insn,unsigned int *data) | +----------------------------------------------------------------------------+ @@ -447,7 +449,7 @@ INT i_APCI035_ReadTimerWatchdog(struct comedi_device * dev, struct comedi_subdev | | +----------------------------------------------------------------------------+ */ -INT i_APCI035_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI035_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { devpriv->tsk_Current = current; @@ -472,8 +474,8 @@ INT i_APCI035_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subdev | Task : Read value of the selected channel | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To read | -| UINT *data : Data Pointer to read status | +| unsigned int ui_NoOfChannels : No Of Channels To read | +| unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | | data[0] : Digital Value Of Input | @@ -484,10 +486,10 @@ INT i_APCI035_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subdev | | +----------------------------------------------------------------------------+ */ -INT i_APCI035_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI035_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_CommandRegister = 0; + unsigned int ui_CommandRegister = 0; /******************/ /* Set the start */ /******************/ @@ -519,14 +521,14 @@ INT i_APCI035_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevic | | +----------------------------------------------------------------------------+ */ -INT i_APCI035_Reset(struct comedi_device * dev) +int i_APCI035_Reset(struct comedi_device * dev) { - INT i_Count = 0; + 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 + ((i_WatchdogNbr - 1) * 32) + 0); /* stop all timers */ } - outl(0x0, devpriv->iobase + 128 + 12); //Disable the warning delay + outl(0x0, devpriv->iobase + 128 + 12); /* Disable the warning delay */ return 0; } @@ -551,11 +553,11 @@ INT i_APCI035_Reset(struct comedi_device * dev) static void v_APCI035_Interrupt(int irq, void *d) { struct comedi_device *dev = d; - UINT ui_StatusRegister1 = 0; - UINT ui_StatusRegister2 = 0; - UINT ui_ReadCommand = 0; - UINT ui_ChannelNumber = 0; - UINT ui_DigitalTemperature = 0; + unsigned int ui_StatusRegister1 = 0; + unsigned int ui_StatusRegister2 = 0; + unsigned int ui_ReadCommand = 0; + unsigned int ui_ChannelNumber = 0; + unsigned int ui_DigitalTemperature = 0; if (i_Temp == 1) { i_WatchdogNbr = i_Flag; i_Flag = i_Flag + 1; @@ -571,7 +573,7 @@ static void v_APCI035_Interrupt(int irq, void *d) ui_StatusRegister2 = inl(devpriv->iobase + ((i_WatchdogNbr - 1) * 32) + 20); - if ((((ui_StatusRegister1) & 0x8) == 0x8)) //Test if warning relay interrupt + if ((((ui_StatusRegister1) & 0x8) == 0x8)) /* Test if warning relay interrupt */ { /**********************************/ /* Disable the temperature warning */ @@ -587,14 +589,14 @@ static void v_APCI035_Interrupt(int irq, void *d) /* 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)) + 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 + send_sig(SIGIO, devpriv->tsk_Current, 0); /* send signal to the sample */ } - } //else if (((ui_StatusRegister1 & 0x8) == 0x8)) + } /* else if (((ui_StatusRegister1 & 0x8) == 0x8)) */ return; } diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.h index 80d7c0d39aab..e0023c8cb628 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.h @@ -19,18 +19,18 @@ #define APCI035_BOARD_VENDOR_ID 0x15B8 #define APCI035_ADDRESS_RANGE 255 -INT i_TW_Number; +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; + int i_Gain; + int i_Polarity; + int i_OffsetRange; + int i_Coupling; + int i_SingleDiff; + int i_AutoCalibration; + unsigned int ui_ReloadValue; + unsigned int ui_TimeUnitReloadVal; + int i_Interrupt; + int i_ModuleSelection; } Config_Parameters_Main; /* ANALOG INPUT RANGE */ @@ -101,23 +101,23 @@ struct comedi_lrange range_apci035_ai = { 8, { /* TIMER */ /* timer value is passed as u seconds */ -INT i_APCI035_ConfigTimerWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI035_ConfigTimerWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device *dev, +int i_APCI035_StartStopWriteTimerWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI035_ReadTimerWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI035_ReadTimerWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); /* Temperature Related Defines (Analog Input Subdevice) */ -INT i_APCI035_ConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI035_ConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI035_ReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI035_ReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); /* Interrupt */ static void v_APCI035_Interrupt(int irq, void *d); /* Reset functions */ -INT i_APCI035_Reset(struct comedi_device *dev); +int i_APCI035_Reset(struct comedi_device *dev); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.c index 32796ceb946e..0966ad6214a5 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.c @@ -53,8 +53,8 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc */ #include "hwdrv_apci1032.h" #include <linux/delay.h> -//Global variables -UINT ui_InterruptStatus = 0; +/* Global variables */ +unsigned int ui_InterruptStatus = 0; /* +----------------------------------------------------------------------------+ @@ -84,13 +84,13 @@ UINT ui_InterruptStatus = 0; +----------------------------------------------------------------------------+ */ -INT i_APCI1032_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1032_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_TmpValue; + unsigned int ui_TmpValue; - ULONG ul_Command1 = 0; - ULONG ul_Command2 = 0; + unsigned int ul_Command1 = 0; + unsigned int ul_Command2 = 0; devpriv->tsk_Current = current; /*******************************/ @@ -107,11 +107,11 @@ INT i_APCI1032_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd outl(0x4, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ); ui_TmpValue = inl(devpriv->iobase + APCI1032_DIGITAL_IP_IRQ); - } //if (data[1] == ADDIDATA_OR) + } /* if (data[1] == ADDIDATA_OR) */ else { outl(0x6, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ); - } //else if(data[1] == ADDIDATA_OR) - } // if( data[0] == ADDIDATA_ENABLE) + } /* else if(data[1] == ADDIDATA_OR) */ + } /* if( data[0] == ADDIDATA_ENABLE) */ else { ul_Command1 = ul_Command1 & 0xFFFF0000; ul_Command2 = ul_Command2 & 0xFFFF0000; @@ -120,7 +120,7 @@ INT i_APCI1032_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd outl(ul_Command2, devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_MODE2); outl(0x0, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ); - } //else if ( data[0] == ADDIDATA_ENABLE) + } /* else if ( data[0] == ADDIDATA_ENABLE) */ return insn->n; } @@ -134,7 +134,7 @@ INT i_APCI1032_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd | Task : Return the status of the digital input | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_Channel : Channel number to read | +| unsigned int ui_Channel : Channel number to read | | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | @@ -144,22 +144,24 @@ INT i_APCI1032_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd | | +----------------------------------------------------------------------------+ */ -INT i_APCI1032_Read1DigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1032_Read1DigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_TmpValue = 0; - UINT ui_Channel; + unsigned int ui_TmpValue = 0; + unsigned int ui_Channel; ui_Channel = CR_CHAN(insn->chanspec); if (ui_Channel >= 0 && ui_Channel <= 31) { - ui_TmpValue = (UINT) inl(devpriv->iobase + APCI1032_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. + ui_TmpValue = (unsigned int) inl(devpriv->iobase + APCI1032_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) + } /* if(ui_Channel >= 0 && ui_Channel <=31) */ else { - //comedi_error(dev," \n chan spec wrong\n"); - return -EINVAL; // "sorry channel spec wrong " - } //else if(ui_Channel >= 0 && ui_Channel <=31) + /* comedi_error(dev," \n chan spec wrong\n"); */ + return -EINVAL; /* "sorry channel spec wrong " */ + } /* else if(ui_Channel >= 0 && ui_Channel <=31) */ return insn->n; } @@ -172,8 +174,8 @@ INT i_APCI1032_Read1DigitalInput(struct comedi_device * dev, struct comedi_subde | Task : Return the status of the Requested digital inputs | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To be Read | -| UINT *data : Data Pointer to read status | +| unsigned int ui_NoOfChannels : No Of Channels To be Read | +| unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -183,16 +185,16 @@ INT i_APCI1032_Read1DigitalInput(struct comedi_device * dev, struct comedi_subde +----------------------------------------------------------------------------+ */ -INT i_APCI1032_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1032_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_PortValue = data[0]; - UINT ui_Mask = 0; - UINT ui_NoOfChannels; + unsigned int ui_PortValue = data[0]; + unsigned int ui_Mask = 0; + unsigned int ui_NoOfChannels; ui_NoOfChannels = CR_CHAN(insn->chanspec); if (data[1] == 0) { - *data = (UINT) inl(devpriv->iobase + APCI1032_DIGITAL_IP); + *data = (unsigned int) inl(devpriv->iobase + APCI1032_DIGITAL_IP); switch (ui_NoOfChannels) { case 2: ui_Mask = 3; @@ -213,16 +215,16 @@ INT i_APCI1032_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su case 31: break; default: - //comedi_error(dev," \nchan spec wrong\n"); - return -EINVAL; // "sorry channel spec wrong " + /* comedi_error(dev," \nchan spec wrong\n"); */ + return -EINVAL; /* "sorry channel spec wrong " */ break; - } //switch(ui_NoOfChannels) - } //if(data[1]==0) + } /* switch(ui_NoOfChannels) */ + } /* if(data[1]==0) */ else { if (data[1] == 1) { *data = ui_InterruptStatus; - } //if(data[1]==1) - } //else if(data[1]==0) + } /* if(data[1]==1) */ + } /* else if(data[1]==0) */ return insn->n; } @@ -247,16 +249,16 @@ static void v_APCI1032_Interrupt(int irq, void *d) { struct comedi_device *dev = d; - UINT ui_Temp; - //disable the interrupt + unsigned int ui_Temp; + /* disable the interrupt */ ui_Temp = inl(devpriv->iobase + APCI1032_DIGITAL_IP_IRQ); outl(ui_Temp & APCI1032_DIGITAL_IP_INTERRUPT_DISABLE, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ); ui_InterruptStatus = inl(devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_STATUS); ui_InterruptStatus = ui_InterruptStatus & 0X0000FFFF; - send_sig(SIGIO, devpriv->tsk_Current, 0); // send signal to the sample - outl(ui_Temp, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ); //enable the interrupt + send_sig(SIGIO, devpriv->tsk_Current, 0); /* send signal to the sample */ + outl(ui_Temp, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ); /* enable the interrupt */ return; } @@ -275,11 +277,11 @@ static void v_APCI1032_Interrupt(int irq, void *d) +----------------------------------------------------------------------------+ */ -INT i_APCI1032_Reset(struct comedi_device * dev) +int i_APCI1032_Reset(struct comedi_device * dev) { - outl(0x0, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ); //disable the interrupts - inl(devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_STATUS); //Reset the interrupt status register - outl(0x0, devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_MODE1); //Disable the and/or interrupt + outl(0x0, devpriv->iobase + APCI1032_DIGITAL_IP_IRQ); /* disable the interrupts */ + inl(devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_STATUS); /* Reset the interrupt status register */ + outl(0x0, devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_MODE1); /* Disable the and/or interrupt */ outl(0x0, devpriv->iobase + APCI1032_DIGITAL_IP_INTERRUPT_MODE2); return 0; } diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.h index 659ef85088cd..e29a72a568f3 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.h @@ -19,45 +19,46 @@ #define APCI1032_BOARD_VENDOR_ID 0x15B8 #define APCI1032_ADDRESS_RANGE 20 -//DIGITAL INPUT DEFINE +/* DIGITAL INPUT DEFINE */ #define APCI1032_DIGITAL_IP 0 #define APCI1032_DIGITAL_IP_INTERRUPT_MODE1 4 #define APCI1032_DIGITAL_IP_INTERRUPT_MODE2 8 #define APCI1032_DIGITAL_IP_IRQ 16 -//Digital Input IRQ Function Selection +/* Digital Input IRQ Function Selection */ #define ADDIDATA_OR 0 #define ADDIDATA_AND 1 -//Digital Input Interrupt Status +/* Digital Input Interrupt Status */ #define APCI1032_DIGITAL_IP_INTERRUPT_STATUS 12 -//Digital Input Interrupt Enable Disable. +/* Digital Input Interrupt Enable Disable. */ #define APCI1032_DIGITAL_IP_INTERRUPT_ENABLE 0x4 #define APCI1032_DIGITAL_IP_INTERRUPT_DISABLE 0xFFFFFFFB -//ADDIDATA Enable Disable +/* ADDIDATA Enable Disable */ #define ADDIDATA_ENABLE 1 #define ADDIDATA_DISABLE 0 -// Hardware Layer functions for Apci1032 +/* Hardware Layer functions for Apci1032 */ -//DI -// for di read +/* +* DI for di read +*/ -INT i_APCI1032_ConfigDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1032_ConfigDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1032_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1032_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1032_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1032_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -// Interrupt functions..... +/* Interrupt functions..... */ static void v_APCI1032_Interrupt(int irq, void *d); -//Reset -INT i_APCI1032_Reset(struct comedi_device *dev); +/* Reset */ +int i_APCI1032_Reset(struct comedi_device *dev); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c index 2d6adcff41e3..8f2cae90be79 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c @@ -137,7 +137,7 @@ int i_TimerCounter1Enabled = 0, i_TimerCounter2Enabled = +----------------------------------------------------------------------------+ */ -INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev, +int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { int i_PatternPolarity = 0, i_PatternTransition = 0, i_PatternMask = 0; @@ -157,16 +157,16 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev, if (data[0] == 1) { i_MaxChannel = 8; - } // if (data[0] == 1) + } /* if (data[0] == 1) */ else { if (data[0] == 2) { i_MaxChannel = 6; - } // if(data[0]==2) + } /* if(data[0]==2) */ else { printk("\nThe specified port event does not exist\n"); return -EINVAL; - } //else if(data[0]==2) - } //else if (data[0] == 1) + } /* else if(data[0]==2) */ + } /* else if (data[0] == 1) */ switch (data[1]) { case 0: data[1] = APCI1500_AND; @@ -180,7 +180,7 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev, default: printk("\nThe specified interrupt logic does not exist\n"); return -EINVAL; - } //switch(data[1]); + } /* switch(data[1]); */ i_Logic = data[1]; for (i_Count = i_MaxChannel, i = 0; i_Count > 0; i_Count--, i++) { @@ -224,8 +224,8 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev, default: printk("\nThe option indicated in the event mask does not exist\n"); return -EINVAL; - } // switch(i_EventMask) - } //for (i_Count = i_MaxChannel; i_Count >0;i_Count --) + } /* switch(i_EventMask) */ + } /* for (i_Count = i_MaxChannel; i_Count >0;i_Count --) */ if (data[0] == 1) { /****************************/ @@ -247,7 +247,7 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev, /********************************************/ printk("\nTransition error on an OR PRIORITY logic\n"); return -EINVAL; - } // if (data[1]== APCI1500_OR_PRIORITY && i_PatternTransition != 0) + } /* if (data[1]== APCI1500_OR_PRIORITY && i_PatternTransition != 0) */ /*************************************/ /* Tests if more than one transition */ @@ -261,7 +261,7 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev, ((i_PatternTransition >> i_Count) & 0x1); - } //for (i_Count = 0; i_Count < 8; i_Count++) + } /* for (i_Count = 0; i_Count < 8; i_Count++) */ if (i_PatternTransitionCount > 1) { /****************************************/ @@ -269,8 +269,8 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev, /****************************************/ printk("\n Transition error on an AND logic\n"); return -EINVAL; - } // if (i_PatternTransitionCount > 1) - } // if (data[1]== APCI1500_AND) + } /* if (i_PatternTransitionCount > 1) */ + } /* if (data[1]== APCI1500_AND) */ /*****************************************************************/ /* Selects the APCI1500_RW_MASTER_CONFIGURATION_CONTROL register */ @@ -359,12 +359,12 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } // if(data[1]==APCI1500_AND||data[1]==APCI1500_OR||data[1]==APCI1500_OR_PRIORITY) + } /* if(data[1]==APCI1500_AND||data[1]==APCI1500_OR||data[1]==APCI1500_OR_PRIORITY) */ else { printk("\nThe choice for interrupt logic does not exist\n"); return -EINVAL; - } // else }// if(data[1]==APCI1500_AND||data[1]==APCI1500_OR||data[1]==APCI1500_OR_PRIORITY) - } // if (data[0]== 1) + } /* else }// if(data[1]==APCI1500_AND||data[1]==APCI1500_OR||data[1]==APCI1500_OR_PRIORITY) */ + } /* if (data[0]== 1) */ /************************************/ /* Test if event setting for port 2 */ @@ -487,12 +487,12 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev, outb(0xF4, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } // if (data[1] == APCI1500_OR) + } /* if (data[1] == APCI1500_OR) */ else { printk("\nThe choice for interrupt logic does not exist\n"); return -EINVAL; - } //elseif (data[1] == APCI1500_OR) - } //if(data[0]==2) + } /* elseif (data[1] == APCI1500_OR) */ + } /* if(data[0]==2) */ return insn->n; } @@ -506,7 +506,7 @@ INT i_APCI1500_ConfigDigitalInputEvent(struct comedi_device * dev, | Task : Allows or disallows a port event | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_Channel : Channel number to read | +| unsigned int ui_Channel : Channel number to read | | unsigned int *data : Data Pointer to read status | data[0] :0 Start input event 1 Stop input event @@ -589,12 +589,12 @@ int i_APCI1500_StartStopInputEvent(struct comedi_device * dev, struct comedi_sub devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } // if(i_Event1Status==1) + } /* if(i_Event1Status==1) */ else { printk("\nEvent 1 not initialised\n"); return -EINVAL; - } //else if(i_Event1Status==1) - } //if (data[1]==1) + } /* else if(i_Event1Status==1) */ + } /* if (data[1]==1) */ if (data[1] == 2) { if (i_Event2Status == 1) { @@ -640,17 +640,17 @@ int i_APCI1500_StartStopInputEvent(struct comedi_device * dev, struct comedi_sub devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); i_Event2InterruptStatus = 1; - } // if(i_Event2Status==1) + } /* if(i_Event2Status==1) */ else { printk("\nEvent 2 not initialised\n"); return -EINVAL; - } //else if(i_Event2Status==1) - } // if(data[1]==2) - } // if (data[1] == 1 || data[0] == 2) + } /* else if(i_Event2Status==1) */ + } /* if(data[1]==2) */ + } /* if (data[1] == 1 || data[0] == 2) */ else { printk("\nThe port parameter is in error\n"); return -EINVAL; - } //else if (data[1] == 1 || data[0] == 2) + } /* else if (data[1] == 1 || data[0] == 2) */ break; @@ -701,12 +701,12 @@ int i_APCI1500_StartStopInputEvent(struct comedi_device * dev, struct comedi_sub devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); i_Event1InterruptStatus = 0; - } // if(i_Event1Status==1) + } /* if(i_Event1Status==1) */ else { printk("\nEvent 1 not initialised\n"); return -EINVAL; - } //else if(i_Event1Status==1) - } //if (data[1]==1) + } /* else if(i_Event1Status==1) */ + } /* if (data[1]==1) */ if (data[1] == 2) { /*****************************/ /* Test if event initialised */ @@ -744,23 +744,23 @@ int i_APCI1500_StartStopInputEvent(struct comedi_device * dev, struct comedi_sub devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); i_Event2InterruptStatus = 0; - } // if(i_Event2Status==1) + } /* if(i_Event2Status==1) */ else { printk("\nEvent 2 not initialised\n"); return -EINVAL; - } //else if(i_Event2Status==1) - } //if(data[1]==2) + } /* else if(i_Event2Status==1) */ + } /* if(data[1]==2) */ - } // if (data[1] == 1 || data[1] == 2) + } /* if (data[1] == 1 || data[1] == 2) */ else { printk("\nThe port parameter is in error\n"); return -EINVAL; - } //else if (data[1] == 1 || data[1] == 2) + } /* else if (data[1] == 1 || data[1] == 2) */ break; default: printk("\nThe option of START/STOP logic does not exist\n"); return -EINVAL; - } //switch(data[0]) + } /* switch(data[0]) */ return insn->n; } @@ -774,7 +774,7 @@ int i_APCI1500_StartStopInputEvent(struct comedi_device * dev, struct comedi_sub | Task : Return the status of the digital input | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_Channel : Channel number to read | +| unsigned int ui_Channel : Channel number to read | | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | @@ -784,7 +784,7 @@ int i_APCI1500_StartStopInputEvent(struct comedi_device * dev, struct comedi_sub | | +----------------------------------------------------------------------------+ */ -INT i_APCI1500_Initialisation(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1500_Initialisation(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { int i_DummyRead = 0; @@ -943,8 +943,8 @@ INT i_APCI1500_Initialisation(struct comedi_device * dev, struct comedi_subdevic | Task : Return the status of the Requested digital inputs | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To be Read | -| UINT *data : Data Pointer +| unsigned int ui_NoOfChannels : No Of Channels To be Read | +| unsigned int *data : Data Pointer data[0] : 0 Read a single channel 1 read a port value data[1] : port value @@ -957,31 +957,31 @@ INT i_APCI1500_Initialisation(struct comedi_device * dev, struct comedi_subdevic +----------------------------------------------------------------------------+ */ -INT i_APCI1500_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1500_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_PortValue = data[1]; - UINT ui_Mask = 0; - UINT ui_Channel; - UINT ui_TmpValue = 0; + unsigned int ui_PortValue = data[1]; + unsigned int ui_Mask = 0; + unsigned int ui_Channel; + unsigned int ui_TmpValue = 0; ui_Channel = CR_CHAN(insn->chanspec); switch (data[0]) { case 0: if (ui_Channel >= 0 && ui_Channel <= 15) { ui_TmpValue = - (UINT) inw(devpriv->i_IobaseAddon + + (unsigned int) inw(devpriv->i_IobaseAddon + APCI1500_DIGITAL_IP); *data = (ui_TmpValue >> ui_Channel) & 0x1; - } //if(ui_Channel >= 0 && ui_Channel <=15) + } /* if(ui_Channel >= 0 && ui_Channel <=15) */ else { printk("\nThe channel specification are in error\n"); - return -EINVAL; // "sorry channel spec wrong " - } //else if(ui_Channel >= 0 && ui_Channel <=15) + return -EINVAL; /* "sorry channel spec wrong " */ + } /* else if(ui_Channel >= 0 && ui_Channel <=15) */ break; case 1: - *data = (UINT) inw(devpriv->i_IobaseAddon + + *data = (unsigned int) inw(devpriv->i_IobaseAddon + APCI1500_DIGITAL_IP); switch (ui_Channel) { case 2: @@ -1001,14 +1001,14 @@ INT i_APCI1500_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su default: printk("\nSpecified channel cannot be read \n"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ break; - } //switch(ui_Channel) + } /* switch(ui_Channel) */ break; default: printk("\nThe specified functionality does not exist\n"); return -EINVAL; - } //switch(data[0]) + } /* switch(data[0]) */ return insn->n; } @@ -1056,8 +1056,8 @@ int i_APCI1500_ConfigDigitalOutputErrorInterrupt(struct comedi_device * dev, | Task : Writes port value To the selected port | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To Write | -| UINT *data : Data Pointer to read status | +| unsigned int ui_NoOfChannels : No Of Channels To Write | +| unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -1067,24 +1067,24 @@ int i_APCI1500_ConfigDigitalOutputErrorInterrupt(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI1500_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1500_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - static UINT ui_Temp = 0; - UINT ui_Temp1; + static unsigned int ui_Temp = 0; + unsigned int ui_Temp1; - UINT ui_NoOfChannel = CR_CHAN(insn->chanspec); // get the channel + unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */ if (!devpriv->b_OutputMemoryStatus) { ui_Temp = 0; - } //if(!devpriv->b_OutputMemoryStatus ) + } /* if(!devpriv->b_OutputMemoryStatus ) */ if (data[3] == 0) { if (data[1] == 0) { data[0] = (data[0] << ui_NoOfChannel) | ui_Temp; outw(data[0], devpriv->i_IobaseAddon + APCI1500_DIGITAL_OP); - } //if(data[1]==0) + } /* if(data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -1113,19 +1113,19 @@ INT i_APCI1500_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ - } //switch(ui_NoOfChannels) + } /* switch(ui_NoOfChannels) */ outw(data[0], devpriv->i_IobaseAddon + APCI1500_DIGITAL_OP); - } // if(data[1]==1) + } /* 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[1]==1) */ + } /* elseif(data[1]==0) */ + } /* if(data[3]==0) */ else { if (data[3] == 1) { if (data[1] == 0) { @@ -1140,7 +1140,7 @@ INT i_APCI1500_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd outw(data[0], devpriv->i_IobaseAddon + APCI1500_DIGITAL_OP); - } //if(data[1]==0) + } /* if(data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -1190,24 +1190,24 @@ INT i_APCI1500_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ - } //switch(ui_NoOfChannels) + } /* switch(ui_NoOfChannels) */ outw(data[0], devpriv->i_IobaseAddon + APCI1500_DIGITAL_OP); - } // if(data[1]==1) + } /* 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 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) + } /* if else data[3]==1) */ + } /* if else data[3]==0) */ ui_Temp = data[0]; return (insn->n);; } @@ -1268,20 +1268,20 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, devpriv->tsk_Current = current; -//Selection of the input clock +/* Selection of the input clock */ if (data[0] == 0 || data[0] == 1 || data[0] == 2) { outw(data[0], devpriv->i_IobaseAddon + APCI1500_CLK_SELECT); - } // if(data[0]==0||data[0]==1||data[0]==2) + } /* if(data[0]==0||data[0]==1||data[0]==2) */ else { if (data[0] != 3) { printk("\nThe option for input clock selection does not exist\n"); return -EINVAL; - } // if(data[0]!=3) - } //elseif(data[0]==0||data[0]==1||data[0]==2) - //Select the counter/timer + } /* if(data[0]!=3) */ + } /* elseif(data[0]==0||data[0]==1||data[0]==2) */ + /* Select the counter/timer */ switch (data[1]) { case COUNTER1: - //selecting counter or timer + /* selecting counter or timer */ switch (data[2]) { case 0: data[2] = APCI1500_COUNTER; @@ -1292,9 +1292,9 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, default: printk("\nThis choice is not a timer nor a counter\n"); return -EINVAL; - } // switch(data[2]) + } /* switch(data[2]) */ - //Selecting single or continuous mode + /* Selecting single or continuous mode */ switch (data[4]) { case 0: data[4] = APCI1500_CONTINUOUS; @@ -1305,7 +1305,7 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, default: printk("\nThis option for single/continuous mode does not exist\n"); return -EINVAL; - } // switch(data[4]) + } /* switch(data[4]) */ i_TimerCounterMode = data[2] | data[4] | 7; /*************************/ @@ -1428,21 +1428,21 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, outb(0x2, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } //if(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) + } /* if(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) */ else { printk("\nError in selection of interrupt enable or disable\n"); return -EINVAL; - } //elseif(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) - } // if ((data[3]>= 0) && (data[3] <= 65535)) + } /* elseif(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) */ + } /* if ((data[3]>= 0) && (data[3] <= 65535)) */ else { printk("\nError in selection of reload value\n"); return -EINVAL; - } //else if ((data[3]>= 0) && (data[3] <= 65535)) + } /* else if ((data[3]>= 0) && (data[3] <= 65535)) */ i_TimerCounterWatchdogInterrupt = data[7]; i_TimerCounter1Init = 1; break; - case COUNTER2: //selecting counter or timer + case COUNTER2: /* selecting counter or timer */ switch (data[2]) { case 0: data[2] = APCI1500_COUNTER; @@ -1453,9 +1453,9 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, default: printk("\nThis choice is not a timer nor a counter\n"); return -EINVAL; - } // switch(data[2]) + } /* switch(data[2]) */ - //Selecting single or continuous mode + /* Selecting single or continuous mode */ switch (data[4]) { case 0: data[4] = APCI1500_CONTINUOUS; @@ -1466,9 +1466,9 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, default: printk("\nThis option for single/continuous mode does not exist\n"); return -EINVAL; - } // switch(data[4]) + } /* switch(data[4]) */ - //Selecting software or hardware trigger + /* Selecting software or hardware trigger */ switch (data[5]) { case 0: data[5] = APCI1500_SOFTWARE_TRIGGER; @@ -1479,9 +1479,9 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, default: printk("\nThis choice for software or hardware trigger does not exist\n"); return -EINVAL; - } // switch(data[5]) + } /* switch(data[5]) */ - //Selecting software or hardware gate + /* Selecting software or hardware gate */ switch (data[6]) { case 0: data[6] = APCI1500_SOFTWARE_GATE; @@ -1492,7 +1492,7 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, default: printk("\nThis choice for software or hardware gate does not exist\n"); return -EINVAL; - } // switch(data[6]) + } /* switch(data[6]) */ i_TimerCounterMode = data[2] | data[4] | data[5] | data[6] | 7; @@ -1616,21 +1616,21 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, outb(0x2, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } //if(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) + } /* if(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) */ else { printk("\nError in selection of interrupt enable or disable\n"); return -EINVAL; - } //elseif(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) - } // if ((data[3]>= 0) && (data[3] <= 65535)) + } /* elseif(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) */ + } /* if ((data[3]>= 0) && (data[3] <= 65535)) */ else { printk("\nError in selection of reload value\n"); return -EINVAL; - } //else if ((data[3]>= 0) && (data[3] <= 65535)) + } /* else if ((data[3]>= 0) && (data[3] <= 65535)) */ i_TimerCounterWatchdogInterrupt = data[7]; i_TimerCounter2Init = 1; break; - case COUNTER3: //selecting counter or watchdog + case COUNTER3: /* selecting counter or watchdog */ switch (data[2]) { case 0: data[2] = APCI1500_COUNTER; @@ -1641,9 +1641,9 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, default: printk("\nThis choice is not a watchdog nor a counter\n"); return -EINVAL; - } // switch(data[2]) + } /* switch(data[2]) */ - //Selecting single or continuous mode + /* Selecting single or continuous mode */ switch (data[4]) { case 0: data[4] = APCI1500_CONTINUOUS; @@ -1654,9 +1654,9 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, default: printk("\nThis option for single/continuous mode does not exist\n"); return -EINVAL; - } // switch(data[4]) + } /* switch(data[4]) */ - //Selecting software or hardware gate + /* Selecting software or hardware gate */ switch (data[6]) { case 0: data[6] = APCI1500_SOFTWARE_GATE; @@ -1667,7 +1667,7 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, default: printk("\nThis choice for software or hardware gate does not exist\n"); return -EINVAL; - } // switch(data[6]) + } /* switch(data[6]) */ /*****************************/ /* Test if used for watchdog */ @@ -1680,10 +1680,10 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, /* - Pulses output */ /*****************************/ i_TimerCounterMode = data[2] | data[4] | 0x54; - } //if (data[2] == APCI1500_WATCHDOG) + } /* if (data[2] == APCI1500_WATCHDOG) */ else { i_TimerCounterMode = data[2] | data[4] | data[6] | 7; - } //elseif (data[2] == APCI1500_WATCHDOG) + } /* elseif (data[2] == APCI1500_WATCHDOG) */ /*************************/ /* Test the reload value */ /*************************/ @@ -1809,25 +1809,25 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device * dev, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } //elseif(data[2]==APCI1500_COUNTER) + } /* elseif(data[2]==APCI1500_COUNTER) */ - } //if(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) + } /* if(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) */ else { printk("\nError in selection of interrupt enable or disable\n"); return -EINVAL; - } //elseif(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) - } // if ((data[3]>= 0) && (data[3] <= 65535)) + } /* elseif(data[7]== APCI1500_ENABLE ||data[7]== APCI1500_DISABLE) */ + } /* if ((data[3]>= 0) && (data[3] <= 65535)) */ else { printk("\nError in selection of reload value\n"); return -EINVAL; - } //else if ((data[3]>= 0) && (data[3] <= 65535)) + } /* else if ((data[3]>= 0) && (data[3] <= 65535)) */ i_TimerCounterWatchdogInterrupt = data[7]; i_WatchdogCounter3Init = 1; break; default: printk("\nThe specified counter\timer option does not exist\n"); - } //switch(data[1]) + } /* switch(data[1]) */ i_CounterLogic = data[2]; return insn->n; } @@ -1871,11 +1871,11 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, case START: if (i_TimerCounter1Init == 1) { if (i_TimerCounterWatchdogInterrupt == 1) { - i_CommandAndStatusValue = 0xC4; //Enable the interrupt - } // if(i_TimerCounterWatchdogInterrupt==1) + i_CommandAndStatusValue = 0xC4; /* Enable the interrupt */ + } /* if(i_TimerCounterWatchdogInterrupt==1) */ else { - i_CommandAndStatusValue = 0xE4; //disable the interrupt - } //elseif(i_TimerCounterWatchdogInterrupt==1) + i_CommandAndStatusValue = 0xE4; /* disable the interrupt */ + } /* elseif(i_TimerCounterWatchdogInterrupt==1) */ /**************************/ /* Starts timer/counter 1 */ /**************************/ @@ -1889,7 +1889,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, outb(i_CommandAndStatusValue, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } //if( i_TimerCounter1Init==1) + } /* if( i_TimerCounter1Init==1) */ else { printk("\nCounter/Timer1 not configured\n"); return -EINVAL; @@ -1922,14 +1922,14 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, /************************/ i_CommandAndStatusValue = 0x6; - } //if( i_TimerCounter1Enabled==1) + } /* if( i_TimerCounter1Enabled==1) */ else { /***************/ /* Set Trigger */ /***************/ i_CommandAndStatusValue = 0x2; - } //elseif(i_TimerCounter1Enabled==1) + } /* elseif(i_TimerCounter1Enabled==1) */ /********************************************/ /* Selects the commands and status register */ @@ -1940,7 +1940,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, outb(i_CommandAndStatusValue, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } //if( i_TimerCounter1Init==1) + } /* if( i_TimerCounter1Init==1) */ else { printk("\nCounter/Timer1 not configured\n"); return -EINVAL; @@ -1950,7 +1950,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, default: printk("\nThe specified option for start/stop/trigger does not exist\n"); return -EINVAL; - } //switch(data[1]) + } /* switch(data[1]) */ break; case COUNTER2: @@ -1958,11 +1958,11 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, case START: if (i_TimerCounter2Init == 1) { if (i_TimerCounterWatchdogInterrupt == 1) { - i_CommandAndStatusValue = 0xC4; //Enable the interrupt - } // if(i_TimerCounterWatchdogInterrupt==1) + i_CommandAndStatusValue = 0xC4; /* Enable the interrupt */ + } /* if(i_TimerCounterWatchdogInterrupt==1) */ else { - i_CommandAndStatusValue = 0xE4; //disable the interrupt - } //elseif(i_TimerCounterWatchdogInterrupt==1) + i_CommandAndStatusValue = 0xE4; /* disable the interrupt */ + } /* elseif(i_TimerCounterWatchdogInterrupt==1) */ /**************************/ /* Starts timer/counter 2 */ /**************************/ @@ -1976,7 +1976,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, outb(i_CommandAndStatusValue, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } //if( i_TimerCounter2Init==1) + } /* if( i_TimerCounter2Init==1) */ else { printk("\nCounter/Timer2 not configured\n"); return -EINVAL; @@ -2008,14 +2008,14 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, /************************/ i_CommandAndStatusValue = 0x6; - } //if( i_TimerCounter2Enabled==1) + } /* if( i_TimerCounter2Enabled==1) */ else { /***************/ /* Set Trigger */ /***************/ i_CommandAndStatusValue = 0x2; - } //elseif(i_TimerCounter2Enabled==1) + } /* elseif(i_TimerCounter2Enabled==1) */ /********************************************/ /* Selects the commands and status register */ @@ -2026,7 +2026,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, outb(i_CommandAndStatusValue, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } //if( i_TimerCounter2Init==1) + } /* if( i_TimerCounter2Init==1) */ else { printk("\nCounter/Timer2 not configured\n"); return -EINVAL; @@ -2035,7 +2035,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, default: printk("\nThe specified option for start/stop/trigger does not exist\n"); return -EINVAL; - } //switch(data[1]) + } /* switch(data[1]) */ break; case COUNTER3: switch (data[1]) { @@ -2043,11 +2043,11 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, if (i_WatchdogCounter3Init == 1) { if (i_TimerCounterWatchdogInterrupt == 1) { - i_CommandAndStatusValue = 0xC4; //Enable the interrupt - } // if(i_TimerCounterWatchdogInterrupt==1) + i_CommandAndStatusValue = 0xC4; /* Enable the interrupt */ + } /* if(i_TimerCounterWatchdogInterrupt==1) */ else { - i_CommandAndStatusValue = 0xE4; //disable the interrupt - } //elseif(i_TimerCounterWatchdogInterrupt==1) + i_CommandAndStatusValue = 0xE4; /* disable the interrupt */ + } /* elseif(i_TimerCounterWatchdogInterrupt==1) */ /**************************/ /* Starts Watchdog/counter 3 */ /**************************/ @@ -2062,7 +2062,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } // if( i_WatchdogCounter3init==1) + } /* if( i_WatchdogCounter3init==1) */ else { printk("\nWatchdog/Counter3 not configured\n"); return -EINVAL; @@ -2089,7 +2089,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, case TRIGGER: switch (data[2]) { - case 0: //triggering counter 3 + case 0: /* triggering counter 3 */ if (i_WatchdogCounter3Init == 1) { if (i_WatchdogCounter3Enabled == 1) { /************************/ @@ -2097,14 +2097,14 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, /************************/ i_CommandAndStatusValue = 0x6; - } //if( i_WatchdogCounter3Enabled==1) + } /* if( i_WatchdogCounter3Enabled==1) */ else { /***************/ /* Set Trigger */ /***************/ i_CommandAndStatusValue = 0x2; - } //elseif(i_WatchdogCounter3Enabled==1) + } /* elseif(i_WatchdogCounter3Enabled==1) */ /********************************************/ /* Selects the commands and status register */ @@ -2115,14 +2115,14 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, outb(i_CommandAndStatusValue, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } //if( i_WatchdogCounter3Init==1) + } /* if( i_WatchdogCounter3Init==1) */ else { printk("\nCounter3 not configured\n"); return -EINVAL; } break; case 1: - //triggering Watchdog 3 + /* triggering Watchdog 3 */ if (i_WatchdogCounter3Init == 1) { /********************************************/ @@ -2134,7 +2134,7 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, outb(0x6, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } //if( i_WatchdogCounter3Init==1) + } /* if( i_WatchdogCounter3Init==1) */ else { printk("\nWatchdog 3 not configured\n"); return -EINVAL; @@ -2143,17 +2143,17 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device * dev, default: printk("\nWrong choice of watchdog/counter3\n"); return -EINVAL; - } //switch(data[2]) + } /* switch(data[2]) */ break; default: printk("\nThe specified option for start/stop/trigger does not exist\n"); return -EINVAL; - } //switch(data[1]) + } /* switch(data[1]) */ break; default: printk("\nThe specified choice for counter/watchdog/timer does not exist\n"); return -EINVAL; - } //switch(data[0]) + } /* switch(data[0]) */ return insn->n; } @@ -2188,7 +2188,7 @@ int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device * dev, int i_CommandAndStatusValue; switch (data[0]) { case COUNTER1: - //Read counter/timer1 + /* Read counter/timer1 */ if (i_TimerCounter1Init == 1) { if (i_TimerCounter1Enabled == 1) { /************************/ @@ -2196,14 +2196,14 @@ int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device * dev, /************************/ i_CommandAndStatusValue = 0xC; - } //if( i_TimerCounter1Init==1) + } /* if( i_TimerCounter1Init==1) */ else { /***************/ /* Set RCC */ /***************/ i_CommandAndStatusValue = 0x8; - } //elseif(i_TimerCounter1Init==1) + } /* elseif(i_TimerCounter1Init==1) */ /********************************************/ /* Selects the commands and status register */ @@ -2232,14 +2232,14 @@ int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device * dev, data[0] = data[0] | inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } //if( i_TimerCounter1Init==1) + } /* if( i_TimerCounter1Init==1) */ else { printk("\nTimer/Counter1 not configured\n"); return -EINVAL; - } //elseif( i_TimerCounter1Init==1) + } /* elseif( i_TimerCounter1Init==1) */ break; case COUNTER2: - //Read counter/timer2 + /* Read counter/timer2 */ if (i_TimerCounter2Init == 1) { if (i_TimerCounter2Enabled == 1) { /************************/ @@ -2247,14 +2247,14 @@ int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device * dev, /************************/ i_CommandAndStatusValue = 0xC; - } //if( i_TimerCounter2Init==1) + } /* if( i_TimerCounter2Init==1) */ else { /***************/ /* Set RCC */ /***************/ i_CommandAndStatusValue = 0x8; - } //elseif(i_TimerCounter2Init==1) + } /* elseif(i_TimerCounter2Init==1) */ /********************************************/ /* Selects the commands and status register */ @@ -2283,14 +2283,14 @@ int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device * dev, data[0] = data[0] | inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } //if( i_TimerCounter2Init==1) + } /* if( i_TimerCounter2Init==1) */ else { printk("\nTimer/Counter2 not configured\n"); return -EINVAL; - } //elseif( i_TimerCounter2Init==1) + } /* elseif( i_TimerCounter2Init==1) */ break; case COUNTER3: - //Read counter/watchdog2 + /* Read counter/watchdog2 */ if (i_WatchdogCounter3Init == 1) { if (i_WatchdogCounter3Enabled == 1) { /************************/ @@ -2298,14 +2298,14 @@ int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device * dev, /************************/ i_CommandAndStatusValue = 0xC; - } //if( i_TimerCounter2Init==1) + } /* if( i_TimerCounter2Init==1) */ else { /***************/ /* Set RCC */ /***************/ i_CommandAndStatusValue = 0x8; - } //elseif(i_WatchdogCounter3Init==1) + } /* elseif(i_WatchdogCounter3Init==1) */ /********************************************/ /* Selects the commands and status register */ @@ -2334,16 +2334,16 @@ int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device * dev, data[0] = data[0] | inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } //if( i_WatchdogCounter3Init==1) + } /* if( i_WatchdogCounter3Init==1) */ else { printk("\nWatchdogCounter3 not configured\n"); return -EINVAL; - } //elseif( i_WatchdogCounter3Init==1) + } /* elseif( i_WatchdogCounter3Init==1) */ break; default: printk("\nThe choice of timer/counter/watchdog does not exist\n"); return -EINVAL; - } //switch(data[0]) + } /* switch(data[0]) */ return insn->n; } @@ -2404,23 +2404,23 @@ int i_APCI1500_ReadInterruptMask(struct comedi_device * dev, struct comedi_subde int i_APCI1500_ConfigureInterrupt(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_Status; + unsigned int ui_Status; int i_RegValue; int i_Constant; devpriv->tsk_Current = current; outl(0x0, devpriv->i_IobaseAmcc + 0x38); if (data[0] == 1) { i_Constant = 0xC0; - } //if(data[0]==1) + } /* if(data[0]==1) */ else { if (data[0] == 0) { i_Constant = 0x00; - } //if{data[0]==0) + } /* if{data[0]==0) */ else { printk("\nThe parameter passed to driver is in error for enabling the voltage interrupt\n"); return -EINVAL; - } //else if(data[0]==0) - } //elseif(data[0]==1) + } /* else if(data[0]==0) */ + } /* elseif(data[0]==1) */ /*****************************************************/ /* Selects the mode specification register of port B */ @@ -2580,7 +2580,7 @@ static void v_APCI1500_Interrupt(int irq, void *d) { struct comedi_device *dev = d; - UINT ui_InterruptStatus = 0; + unsigned int ui_InterruptStatus = 0; int i_RegValue = 0; i_InterruptMask = 0; @@ -2599,11 +2599,11 @@ static void v_APCI1500_Interrupt(int irq, void *d) /*************************************************/ /* Selects the master interrupt control register */ /*************************************************/ - //outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL,devpriv->iobase+APCI1500_Z8536_CONTROL_REGISTER); + /* outb(APCI1500_RW_MASTER_INTERRUPT_CONTROL,devpriv->iobase+APCI1500_Z8536_CONTROL_REGISTER); */ /**********************************************/ /* Disables the main interrupt on the board */ /**********************************************/ - //outb(0x00,devpriv->iobase+APCI1500_Z8536_CONTROL_REGISTER); + /* outb(0x00,devpriv->iobase+APCI1500_Z8536_CONTROL_REGISTER); */ /*****************************************************/ /* Selects the command and status register of port A */ @@ -2647,11 +2647,11 @@ static void v_APCI1500_Interrupt(int irq, void *d) i_InputChannel = 1 + (i_RegValue >> 1); - } // if(i_Logic==APCI1500_OR_PRIORITY) + } /* if(i_Logic==APCI1500_OR_PRIORITY) */ else { i_InputChannel = 0; - } //elseif(i_Logic==APCI1500_OR_PRIORITY) - } // if ((i_RegValue & 0x60) == 0x60) + } /* elseif(i_Logic==APCI1500_OR_PRIORITY) */ + } /* if ((i_RegValue & 0x60) == 0x60) */ /*****************************************************/ /* Selects the command and status register of port B */ @@ -2679,7 +2679,7 @@ static void v_APCI1500_Interrupt(int irq, void *d) /* Reads port B */ /****************/ i_RegValue = - inb((UINT) devpriv->iobase + + inb((unsigned int) devpriv->iobase + APCI1500_Z8536_PORT_B); i_RegValue = i_RegValue & 0xC0; @@ -2688,7 +2688,7 @@ static void v_APCI1500_Interrupt(int irq, void *d) /**************************************/ if (i_RegValue) { - //Disable the interrupt + /* Disable the interrupt */ /*****************************************************/ /* Selects the command and status register of port B */ /*****************************************************/ @@ -2697,17 +2697,17 @@ static void v_APCI1500_Interrupt(int irq, void *d) if (i_RegValue & 0x80) { i_InterruptMask = i_InterruptMask | 0x40; - } //if (i_RegValue & 0x80) + } /* if (i_RegValue & 0x80) */ if (i_RegValue & 0x40) { i_InterruptMask = i_InterruptMask | 0x80; - } //if (i_RegValue & 0x40) - } // if (i_RegValue) + } /* if (i_RegValue & 0x40) */ + } /* if (i_RegValue) */ else { i_InterruptMask = i_InterruptMask | 2; - } // if (i_RegValue) - } //if ((i_RegValue & 0x60) == 0x60) + } /* if (i_RegValue) */ + } /* if ((i_RegValue & 0x60) == 0x60) */ /*****************************************************/ /* Selects the command and status register of timer 1 */ @@ -2731,7 +2731,7 @@ static void v_APCI1500_Interrupt(int irq, void *d) devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); i_InterruptMask = i_InterruptMask | 4; - } // if ((i_RegValue & 0x60) == 0x60) + } /* if ((i_RegValue & 0x60) == 0x60) */ /*****************************************************/ /* Selects the command and status register of timer 2 */ /*****************************************************/ @@ -2754,7 +2754,7 @@ static void v_APCI1500_Interrupt(int irq, void *d) devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); i_InterruptMask = i_InterruptMask | 8; - } // if ((i_RegValue & 0x60) == 0x60) + } /* if ((i_RegValue & 0x60) == 0x60) */ /*****************************************************/ /* Selects the command and status register of timer 3 */ @@ -2779,13 +2779,13 @@ static void v_APCI1500_Interrupt(int irq, void *d) APCI1500_Z8536_CONTROL_REGISTER); if (i_CounterLogic == APCI1500_COUNTER) { i_InterruptMask = i_InterruptMask | 0x10; - } //if(i_CounterLogic==APCI1500_COUNTER) + } /* if(i_CounterLogic==APCI1500_COUNTER) */ else { i_InterruptMask = i_InterruptMask | 0x20; } - } // if ((i_RegValue & 0x60) == 0x60) + } /* if ((i_RegValue & 0x60) == 0x60) */ - send_sig(SIGIO, devpriv->tsk_Current, 0); // send signal to the sample + send_sig(SIGIO, devpriv->tsk_Current, 0); /* send signal to the sample */ /***********************/ /* Enable all Interrupts */ /***********************/ @@ -2799,11 +2799,11 @@ static void v_APCI1500_Interrupt(int irq, void *d) /* Authorizes the main interrupt on the board */ /**********************************************/ outb(0xD0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - } // if ((ui_InterruptStatus & 0x800000) == 0x800000) + } /* if ((ui_InterruptStatus & 0x800000) == 0x800000) */ else { printk("\nInterrupt from unknown source\n"); - } //else if ((ui_InterruptStatus & 0x800000) == 0x800000) + } /* else if ((ui_InterruptStatus & 0x800000) == 0x800000) */ return; } @@ -2822,7 +2822,7 @@ static void v_APCI1500_Interrupt(int irq, void *d) +----------------------------------------------------------------------------+ */ -INT i_APCI1500_Reset(struct comedi_device * dev) +int i_APCI1500_Reset(struct comedi_device * dev) { int i_DummyRead = 0; i_TimerCounter1Init = 0; @@ -2982,7 +2982,7 @@ INT i_APCI1500_Reset(struct comedi_device * dev) devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); /* Deletes all interrupts */ outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - //reset all the digital outputs + /* reset all the digital outputs */ outw(0x0, devpriv->i_IobaseAddon + APCI1500_DIGITAL_OP); /*******************************/ /* Disable the board interrupt */ diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.h index 5d960b40a6a8..057903366a80 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.h @@ -17,11 +17,11 @@ /********* Definitions for APCI-1500 card *****/ -// Card Specific information +/* Card Specific information */ #define APCI1500_BOARD_VENDOR_ID 0x10e8 #define APCI1500_ADDRESS_RANGE 4 -//DIGITAL INPUT-OUTPUT DEFINE +/* DIGITAL INPUT-OUTPUT DEFINE */ #define APCI1500_DIGITAL_OP 2 #define APCI1500_DIGITAL_IP 0 diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c index 5ae9a93844e7..bcc9b7a67f2e 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c @@ -73,22 +73,22 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc | | +----------------------------------------------------------------------------+ */ -INT i_APCI1516_Read1DigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1516_Read1DigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_TmpValue = 0; - UINT ui_Channel; + unsigned int ui_TmpValue = 0; + unsigned int 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. + ui_TmpValue = (unsigned int) 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) + } /* 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) + /* 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; } @@ -114,17 +114,17 @@ INT i_APCI1516_Read1DigitalInput(struct comedi_device * dev, struct comedi_subde +----------------------------------------------------------------------------+ */ -INT i_APCI1516_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1516_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_PortValue = data[0]; - UINT ui_Mask = 0; - UINT ui_NoOfChannels; + unsigned int ui_PortValue = data[0]; + unsigned int ui_Mask = 0; + unsigned int ui_NoOfChannels; ui_NoOfChannels = CR_CHAN(insn->chanspec); - *data = (UINT) inw(devpriv->iobase + APCI1516_DIGITAL_IP); + *data = (unsigned int) inw(devpriv->iobase + APCI1516_DIGITAL_IP); switch (ui_NoOfChannels) { case 2: ui_Mask = 3; @@ -139,9 +139,9 @@ INT i_APCI1516_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su default: printk("\nWrong parameters\n"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ break; - } //switch(ui_NoOfChannels) + } /* switch(ui_NoOfChannels) */ return insn->n; } @@ -199,21 +199,21 @@ int i_APCI1516_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub +----------------------------------------------------------------------------+ */ -INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_Temp, ui_Temp1; - UINT ui_NoOfChannel = CR_CHAN(insn->chanspec); // get the channel + unsigned int ui_Temp, ui_Temp1; + unsigned int 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 ) + } /* if(devpriv->b_OutputMemoryStatus ) */ else { ui_Temp = 0; - } //if(devpriv->b_OutputMemoryStatus ) + } /* if(devpriv->b_OutputMemoryStatus ) */ if (data[3] == 0) { if (data[1] == 0) { data[0] = (data[0] << ui_NoOfChannel) | ui_Temp; @@ -222,7 +222,7 @@ INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd printk("EL311003 : d=%d @=%x\n", data[0], devpriv->iobase + APCI1516_DIGITAL_OP); - } //if(data[1]==0) + } /* if(data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -245,21 +245,21 @@ INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ - } //switch(ui_NoOfChannels) + } /* 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) + } /* 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[1]==1) */ + } /* elseif(data[1]==0) */ + } /* if(data[3]==0) */ else { if (data[3] == 1) { if (data[1] == 0) { @@ -275,7 +275,7 @@ INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd printk("EL311003 : d=%d @=%x\n", data[0], devpriv->iobase + APCI1516_DIGITAL_OP); - } //if(data[1]==0) + } /* if(data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -312,9 +312,9 @@ INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ - } //switch(ui_NoOfChannels) + } /* switch(ui_NoOfChannels) */ outw(data[0], devpriv->iobase + @@ -324,17 +324,17 @@ INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd data[0], devpriv->iobase + APCI1516_DIGITAL_OP); - } // if(data[1]==1) + } /* 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 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) + } /* if else data[3]==1) */ + } /* if else data[3]==0) */ return (insn->n);; } @@ -359,17 +359,17 @@ INT i_APCI1516_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd +----------------------------------------------------------------------------+ */ -INT i_APCI1516_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1516_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_Temp; - UINT ui_NoOfChannel = CR_CHAN(insn->chanspec); // get the channel + unsigned int ui_Temp; + unsigned int 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) + } /* if(ui_Temp==0) */ else { if (ui_Temp == 1) { switch (ui_NoOfChannel) { @@ -387,14 +387,14 @@ INT i_APCI1516_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ - } //switch(ui_NoOfChannels) - } //if(ui_Temp==1) + } /* switch(ui_NoOfChannels) */ + } /* if(ui_Temp==1) */ else { printk("\nSpecified channel not supported \n"); - } //elseif(ui_Temp==1) - } //elseif(ui_Temp==0) + } /* elseif(ui_Temp==1) */ + } /* elseif(ui_Temp==0) */ return insn->n; } @@ -423,11 +423,11 @@ int i_APCI1516_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevic struct comedi_insn * insn, unsigned int * data) { if (data[0] == 0) { - //Disable the watchdog + /* Disable the watchdog */ outw(0x0, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_ENABLEDISABLE); - //Loading the Reload value + /* Loading the Reload value */ outw(data[1], devpriv->i_IobaseAddon + APCI1516_WATCHDOG_RELOAD_VALUE); @@ -435,11 +435,11 @@ int i_APCI1516_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevic outw(data[1], devpriv->i_IobaseAddon + APCI1516_WATCHDOG_RELOAD_VALUE + 2); - } //if(data[0]==0) + } /* if(data[0]==0) */ else { printk("\nThe input parameters are wrong\n"); return -EINVAL; - } //elseif(data[0]==0) + } /* elseif(data[0]==0) */ return insn->n; } @@ -469,15 +469,15 @@ int i_APCI1516_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_ struct comedi_insn * insn, unsigned int * data) { switch (data[0]) { - case 0: //stop the watchdog - outw(0x0, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_ENABLEDISABLE); //disable the watchdog + case 0: /* stop the watchdog */ + outw(0x0, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_ENABLEDISABLE); /* disable the watchdog */ break; - case 1: //start the watchdog + case 1: /* start the watchdog */ outw(0x0001, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_ENABLEDISABLE); break; - case 2: //Software trigger + case 2: /* Software trigger */ outw(0x0201, devpriv->i_IobaseAddon + APCI1516_WATCHDOG_ENABLEDISABLE); @@ -485,7 +485,7 @@ int i_APCI1516_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_ default: printk("\nSpecified functionality does not exist\n"); return -EINVAL; - } // switch(data[0]) + } /* switch(data[0]) */ return insn->n; } @@ -532,9 +532,9 @@ int i_APCI1516_ReadWatchdog(struct comedi_device * dev, struct comedi_subdevice +----------------------------------------------------------------------------+ */ -INT i_APCI1516_Reset(struct comedi_device * dev) +int i_APCI1516_Reset(struct comedi_device * dev) { - outw(0x0, devpriv->iobase + APCI1516_DIGITAL_OP); //RESETS THE DIGITAL OUTPUTS + 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); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.h index 398baa04a163..21c09ed01b1d 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.h @@ -17,17 +17,17 @@ /********* Definitions for APCI-1516 card *****/ -// Card Specific information +/* Card Specific information */ #define APCI1516_BOARD_VENDOR_ID 0x15B8 #define APCI1516_ADDRESS_RANGE 8 -//DIGITAL INPUT-OUTPUT DEFINE +/* DIGITAL INPUT-OUTPUT DEFINE */ #define APCI1516_DIGITAL_OP 4 #define APCI1516_DIGITAL_OP_RW 4 #define APCI1516_DIGITAL_IP 0 -// TIMER COUNTER WATCHDOG DEFINES +/* TIMER COUNTER WATCHDOG DEFINES */ #define ADDIDATA_WATCHDOG 2 #define APCI1516_DIGITAL_OP_WATCHDOG 0 @@ -35,24 +35,25 @@ #define APCI1516_WATCHDOG_RELOAD_VALUE 4 #define APCI1516_WATCHDOG_STATUS 16 -// Hardware Layer functions for Apci1516 +/* Hardware Layer functions for Apci1516 */ -//Digital Input -INT i_APCI1516_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, +/* Digital Input */ +int i_APCI1516_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1516_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1516_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -//Digital Output +/* Digital Output */ int i_APCI1516_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1516_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1516_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1516_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1516_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -// TIMER -// timer value is passed as u seconds +/* +* TIMER timer value is passed as u seconds +*/ int i_APCI1516_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); int i_APCI1516_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, @@ -60,5 +61,5 @@ int i_APCI1516_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_s int i_APCI1516_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -//reset -INT i_APCI1516_Reset(struct comedi_device *dev); +/* reset */ +int i_APCI1516_Reset(struct comedi_device *dev); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c index a6b504c3d391..304079bbb80a 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c @@ -55,9 +55,9 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc #include <linux/delay.h> #include "hwdrv_apci1564.h" -//Global variables -UINT ui_InterruptStatus_1564 = 0; -UINT ui_InterruptData, ui_Type; +/* Global variables */ +unsigned int ui_InterruptStatus_1564 = 0; +unsigned int ui_InterruptData, ui_Type; /* +----------------------------------------------------------------------------+ @@ -86,7 +86,7 @@ UINT ui_InterruptData, ui_Type; | | +----------------------------------------------------------------------------+ */ -INT i_APCI1564_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1564_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { devpriv->tsk_Current = current; @@ -106,13 +106,13 @@ INT i_APCI1564_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd outl(0x4, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_IRQ); - } // if (data[1] == ADDIDATA_OR) + } /* 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 if (data[1] == ADDIDATA_OR) */ + } /* if (data[0] == ADDIDATA_ENABLE) */ else { outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + @@ -123,7 +123,7 @@ INT i_APCI1564_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP + APCI1564_DIGITAL_IP_IRQ); - } // else if (data[0] == ADDIDATA_ENABLE) + } /* else if (data[0] == ADDIDATA_ENABLE) */ return insn->n; } @@ -137,7 +137,7 @@ INT i_APCI1564_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd | Task : Return the status of the digital input | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_Channel : Channel number to read | +| unsigned int ui_Channel : Channel number to read | | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | @@ -147,24 +147,26 @@ INT i_APCI1564_ConfigDigitalInput(struct comedi_device * dev, struct comedi_subd | | +----------------------------------------------------------------------------+ */ -INT i_APCI1564_Read1DigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1564_Read1DigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_TmpValue = 0; - UINT ui_Channel; + unsigned int ui_TmpValue = 0; + unsigned int 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. + (unsigned int) 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) + } /* 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 -EINVAL; /* "sorry channel spec wrong " */ + } /* else if (ui_Channel >= 0 && ui_Channel <=31) */ return insn->n; } @@ -177,8 +179,8 @@ INT i_APCI1564_Read1DigitalInput(struct comedi_device * dev, struct comedi_subde | Task : Return the status of the Requested digital inputs | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To be Read | -| UINT *data : Data Pointer to read status | +| unsigned int ui_NoOfChannels : No Of Channels To be Read | +| unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -187,16 +189,16 @@ INT i_APCI1564_Read1DigitalInput(struct comedi_device * dev, struct comedi_subde | | +----------------------------------------------------------------------------+ */ -INT i_APCI1564_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1564_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_PortValue = data[0]; - UINT ui_Mask = 0; - UINT ui_NoOfChannels; + unsigned int ui_PortValue = data[0]; + unsigned int ui_Mask = 0; + unsigned int ui_NoOfChannels; ui_NoOfChannels = CR_CHAN(insn->chanspec); if (data[1] == 0) { - *data = (UINT) inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP); + *data = (unsigned int) inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_IP); switch (ui_NoOfChannels) { case 2: ui_Mask = 3; @@ -218,15 +220,15 @@ INT i_APCI1564_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su break; default: comedi_error(dev, "Not a valid Channel number !!!\n"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ break; - } // switch (ui_NoOfChannels) - } // if (data[1]==0) + } /* 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) + } /* if (data[1]==1) */ + } /* else if (data[1]==0) */ return insn->n; } @@ -239,7 +241,7 @@ INT i_APCI1564_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su | Task : Configures The Digital Output Subdevice. | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | +| unsigned int *data : Data Pointer contains | | configuration parameters as below | | | | data[1] : 1 Enable VCC Interrupt | @@ -255,34 +257,34 @@ INT i_APCI1564_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su | | +----------------------------------------------------------------------------+ */ -INT i_APCI1564_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1564_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - ULONG ul_Command = 0; + unsigned int 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]!=0) && (data[0]!=1)) */ if (data[0]) { devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE; - } // if (data[0]) + } /* if (data[0]) */ else { devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE; - } // else if (data[0]) + } /* else if (data[0]) */ if (data[1] == ADDIDATA_ENABLE) { ul_Command = ul_Command | 0x1; - } // if (data[1] == ADDIDATA_ENABLE) + } /* if (data[1] == ADDIDATA_ENABLE) */ else { ul_Command = ul_Command & 0xFFFFFFFE; - } // else if (data[1] == ADDIDATA_ENABLE) + } /* else if (data[1] == ADDIDATA_ENABLE) */ if (data[2] == ADDIDATA_ENABLE) { ul_Command = ul_Command | 0x2; - } // if (data[2] == ADDIDATA_ENABLE) + } /* if (data[2] == ADDIDATA_ENABLE) */ else { ul_Command = ul_Command & 0xFFFFFFFD; - } // else if (data[2] == ADDIDATA_ENABLE) + } /* else if (data[2] == ADDIDATA_ENABLE) */ outl(ul_Command, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_INTERRUPT); @@ -302,8 +304,8 @@ INT i_APCI1564_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub | Task : Writes port value To the selected port | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To Write | -| UINT *data : Data Pointer to read status | +| unsigned int ui_NoOfChannels : No Of Channels To Write | +| unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -312,28 +314,28 @@ INT i_APCI1564_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub | | +----------------------------------------------------------------------------+ */ -INT i_APCI1564_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1564_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_Temp, ui_Temp1; - UINT ui_NoOfChannel; + unsigned int ui_Temp, ui_Temp1; + unsigned int 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 ) + } /* if (devpriv->b_OutputMemoryStatus ) */ else { ui_Temp = 0; - } // else if (devpriv->b_OutputMemoryStatus ) + } /* 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) + } /* if (data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -362,18 +364,18 @@ INT i_APCI1564_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd break; default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " - } // switch (ui_NoOfChannels) + 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) + } /* 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[1]==1) */ + } /* else if (data[1]==0) */ + } /* if(data[3]==0) */ else { if (data[3] == 1) { if (data[1] == 0) { @@ -389,7 +391,7 @@ INT i_APCI1564_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_RW); - } // if (data[1]==0) + } /* if (data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -447,23 +449,23 @@ INT i_APCI1564_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " - } //switch(ui_NoOfChannels) + 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) + } /* 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 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) + } /* else if (data[3]==1) */ + } /* else if (data[3]==0) */ return insn->n; } @@ -476,8 +478,8 @@ INT i_APCI1564_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd | Task : Read value of the selected channel or port | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To read | -| UINT *data : Data Pointer to read status | +| unsigned int ui_NoOfChannels : No Of Channels To read | +| unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -486,11 +488,11 @@ INT i_APCI1564_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd | | +----------------------------------------------------------------------------+ */ -INT i_APCI1564_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI1564_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_Temp; - UINT ui_NoOfChannel; + unsigned int ui_Temp; + unsigned int ui_NoOfChannel; ui_NoOfChannel = CR_CHAN(insn->chanspec); ui_Temp = data[0]; @@ -498,7 +500,7 @@ INT i_APCI1564_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde APCI1564_DIGITAL_OP_RW); if (ui_Temp == 0) { *data = (*data >> ui_NoOfChannel) & 0x1; - } // if (ui_Temp==0) + } /* if (ui_Temp==0) */ else { if (ui_Temp == 1) { switch (ui_NoOfChannel) { @@ -523,14 +525,14 @@ INT i_APCI1564_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ break; - } // switch(ui_NoOfChannels) - } // if (ui_Temp==1) + } /* switch(ui_NoOfChannels) */ + } /* if (ui_Temp==1) */ else { printk("\nSpecified channel not supported \n"); - } // else if (ui_Temp==1) - } // else if (ui_Temp==0) + } /* else if (ui_Temp==1) */ + } /* else if (ui_Temp==0) */ return insn->n; } @@ -543,7 +545,7 @@ INT i_APCI1564_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde | Task : Configures The Timer , Counter or Watchdog | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | +| unsigned int *data : Data Pointer contains | | configuration parameters as below | | | | data[0] : 0 Configure As Timer | @@ -564,34 +566,34 @@ INT i_APCI1564_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde | | +----------------------------------------------------------------------------+ */ -INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev, +int i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - ULONG ul_Command1 = 0; + unsigned int ul_Command1 = 0; devpriv->tsk_Current = current; if (data[0] == ADDIDATA_WATCHDOG) { devpriv->b_TimerSelectMode = ADDIDATA_WATCHDOG; - //Disable the watchdog + /* Disable the watchdog */ outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG + APCI1564_TCW_PROG); - //Loading the Reload value + /* Loading the Reload value */ outl(data[3], devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG + APCI1564_TCW_RELOAD_VALUE); - } // if (data[0]==ADDIDATA_WATCHDOG) + } /* if (data[0]==ADDIDATA_WATCHDOG) */ else if (data[0] == ADDIDATA_TIMER) { - //First Stop The 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 + 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(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); @@ -614,18 +616,18 @@ INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev, outl(0x0, devpriv->iobase + APCI1564_COUNTER4 + APCI1564_TCW_IRQ); - } // if (data[1]==1) + } /* if (data[1]==1) */ else { - outl(0x0, devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); //disable Timer interrupt - } // else if (data[1]==1) + outl(0x0, devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); /* disable Timer interrupt */ + } /* else if (data[1]==1) */ - // Loading Timebase + /* Loading Timebase */ outl(data[2], devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_TIMEBASE); - //Loading the Reload value + /* Loading the Reload value */ outl(data[3], devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_RELOAD_VALUE); @@ -635,18 +637,18 @@ INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev, 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) + 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 + /* 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 + outl(ul_Command1, devpriv->iobase + ((data[5] - 1) * 0x20) + APCI1564_TCW_PROG); /* Stop The Timer */ /************************/ /* Set the reload value */ @@ -666,12 +668,12 @@ INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev, /******************************/ ul_Command1 = (ul_Command1 & 0xFFFC19E2UL) | 0x80000UL | - (ULONG) ((ULONG) data[4] << 16UL); + (unsigned int) ((unsigned int) data[4] << 16UL); outl(ul_Command1, devpriv->iobase + ((data[5] - 1) * 0x20) + APCI1564_TCW_PROG); - // Enable or Disable Interrupt + /* Enable or Disable Interrupt */ ul_Command1 = (ul_Command1 & 0xFFFFF9FD) | (data[1] << 1); outl(ul_Command1, devpriv->iobase + ((data[5] - 1) * 0x20) + @@ -684,10 +686,10 @@ INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev, outl(ul_Command1, devpriv->iobase + ((data[5] - 1) * 0x20) + APCI1564_TCW_PROG); - } // else if (data[0]==ADDIDATA_COUNTER) + } /* else if (data[0]==ADDIDATA_COUNTER) */ else { printk(" Invalid subdevice."); - } // else if (data[0]==ADDIDATA_WATCHDOG) + } /* else if (data[0]==ADDIDATA_WATCHDOG) */ return insn->n; } @@ -701,7 +703,7 @@ INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev, | Task : Start / Stop The Selected Timer , Counter or Watchdog | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | +| unsigned int *data : Data Pointer contains | | configuration parameters as below | | | | data[0] : 0 Timer | @@ -718,22 +720,22 @@ INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device * dev, | | +----------------------------------------------------------------------------+ */ -INT i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, +int i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - ULONG ul_Command1 = 0; + unsigned int 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 + 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 + case 1: /* start the watchdog */ outl(0x0001, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG + APCI1564_TCW_PROG); break; - case 2: //Software trigger + case 2: /* Software trigger */ outl(0x0201, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG + @@ -742,8 +744,8 @@ INT i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, default: printk("\nSpecified functionality does not exist\n"); return -EINVAL; - } // switch (data[1]) - } // if (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) + } /* switch (data[1]) */ + } /* if (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) */ if (devpriv->b_TimerSelectMode == ADDIDATA_TIMER) { if (data[1] == 1) { ul_Command1 = @@ -751,13 +753,13 @@ INT i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, APCI1564_TCW_PROG); ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x1UL; - //Enable the Timer + /* Enable the Timer */ outl(ul_Command1, devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); - } // if (data[1]==1) + } /* if (data[1]==1) */ else if (data[1] == 0) { - //Stop The Timer + /* Stop The Timer */ ul_Command1 = inl(devpriv->i_IobaseAmcc + APCI1564_TIMER + @@ -766,29 +768,29 @@ INT i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, outl(ul_Command1, devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); - } // else if(data[1]==0) - } // if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) + } /* 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 + /* Start the Counter subdevice */ ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x1UL; - } // if (data[1] == 1) + } /* if (data[1] == 1) */ else if (data[1] == 0) { - // Stops the Counter subdevice + /* Stops the Counter subdevice */ ul_Command1 = 0; - } // else if (data[1] == 0) + } /* else if (data[1] == 0) */ else if (data[1] == 2) { - // Clears the Counter subdevice + /* Clears the Counter subdevice */ ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x400; - } // else if (data[1] == 3) + } /* else if (data[1] == 3) */ outl(ul_Command1, devpriv->iobase + ((devpriv->b_ModeSelectRegister - 1) * 0x20) + APCI1564_TCW_PROG); - } // if (devpriv->b_TimerSelectMode==ADDIDATA_COUNTER) + } /* if (devpriv->b_TimerSelectMode==ADDIDATA_COUNTER) */ return insn->n; } @@ -801,7 +803,7 @@ INT i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, | Task : Read The Selected Timer , Counter or Watchdog | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | +| unsigned int *data : Data Pointer contains | | configuration parameters as below | | | @@ -813,13 +815,13 @@ INT i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, | | +----------------------------------------------------------------------------+ */ -INT i_APCI1564_ReadTimerCounterWatchdog(struct comedi_device * dev, +int i_APCI1564_ReadTimerCounterWatchdog(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - ULONG ul_Command1 = 0; + unsigned int ul_Command1 = 0; if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) { - // Stores the status of the Watchdog + /* Stores the status of the Watchdog */ data[0] = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG + @@ -827,18 +829,18 @@ INT i_APCI1564_ReadTimerCounterWatchdog(struct comedi_device * dev, data[1] = inl(devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP_WATCHDOG); - } // if (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) + } /* if (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) */ else if (devpriv->b_TimerSelectMode == ADDIDATA_TIMER) { - // Stores the status of the 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 + /* 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_TIMER) */ else if (devpriv->b_TimerSelectMode == ADDIDATA_COUNTER) { - // Read the Counter Actual Value. + /* Read the Counter Actual Value. */ data[0] = inl(devpriv->iobase + ((devpriv->b_ModeSelectRegister - 1) * 0x20) + @@ -850,28 +852,28 @@ INT i_APCI1564_ReadTimerCounterWatchdog(struct comedi_device * dev, /***********************************/ /* Get the software trigger status */ /***********************************/ - data[1] = (BYTE) ((ul_Command1 >> 1) & 1); + data[1] = (unsigned char) ((ul_Command1 >> 1) & 1); /***********************************/ /* Get the hardware trigger status */ /***********************************/ - data[2] = (BYTE) ((ul_Command1 >> 2) & 1); + data[2] = (unsigned char) ((ul_Command1 >> 2) & 1); /*********************************/ /* Get the software clear status */ /*********************************/ - data[3] = (BYTE) ((ul_Command1 >> 3) & 1); + data[3] = (unsigned char) ((ul_Command1 >> 3) & 1); /***************************/ /* Get the overflow status */ /***************************/ - data[4] = (BYTE) ((ul_Command1 >> 0) & 1); - } // else if (devpriv->b_TimerSelectMode==ADDIDATA_COUNTER) + data[4] = (unsigned char) ((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)) + } /* else if ((devpriv->b_TimerSelectMode!=ADDIDATA_TIMER) && (devpriv->b_TimerSelectMode!=ADDIDATA_WATCHDOG)&& (devpriv->b_TimerSelectMode!=ADDIDATA_COUNTER)) */ return insn->n; } @@ -919,10 +921,10 @@ int i_APCI1564_ReadInterruptStatus(struct comedi_device * dev, struct comedi_sub static void v_APCI1564_Interrupt(int irq, void *d) { struct 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; + unsigned int ui_DO, ui_DI; + unsigned int ui_Timer; + unsigned int ui_C1, ui_C2, ui_C3, ui_C4; + unsigned int 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 + @@ -941,7 +943,7 @@ static void v_APCI1564_Interrupt(int irq, void *d) 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==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 + @@ -953,28 +955,28 @@ static void v_APCI1564_Interrupt(int irq, void *d) 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 + 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. + /* 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 + /* Disable the Interrupt */ outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DIGITAL_OP + APCI1564_DIGITAL_OP_INTERRUPT); - //Sends signal to user space + /* Sends signal to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); - } // if (ui_DO) + } /* if (ui_DO) */ if ((ui_Timer == 1) && (devpriv->b_TimerSelectMode = ADDIDATA_TIMER)) { - // Disable Timer Interrupt + /* Disable Timer Interrupt */ ul_Command2 = inl(devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); @@ -982,18 +984,18 @@ static void v_APCI1564_Interrupt(int irq, void *d) devpriv->i_IobaseAmcc + APCI1564_TIMER + APCI1564_TCW_PROG); - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); - // Enable Timer Interrupt + /* 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_Timer == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_TIMER)) */ if ((ui_C1 == 1) && (devpriv->b_TimerSelectMode = ADDIDATA_COUNTER)) { - // Disable Counter Interrupt + /* Disable Counter Interrupt */ ul_Command2 = inl(devpriv->iobase + APCI1564_COUNTER1 + APCI1564_TCW_PROG); @@ -1001,17 +1003,17 @@ static void v_APCI1564_Interrupt(int irq, void *d) devpriv->iobase + APCI1564_COUNTER1 + APCI1564_TCW_PROG); - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); - // Enable Counter Interrupt + /* Enable Counter Interrupt */ outl(ul_Command2, devpriv->iobase + APCI1564_COUNTER1 + APCI1564_TCW_PROG); - } // if ((ui_C1 == 1) && (devpriv->b_TimerSelectMode = ADDIDATA_COUNTER)) + } /* if ((ui_C1 == 1) && (devpriv->b_TimerSelectMode = ADDIDATA_COUNTER)) */ if ((ui_C2 == 1) && (devpriv->b_TimerSelectMode = ADDIDATA_COUNTER)) { - // Disable Counter Interrupt + /* Disable Counter Interrupt */ ul_Command2 = inl(devpriv->iobase + APCI1564_COUNTER2 + APCI1564_TCW_PROG); @@ -1019,17 +1021,17 @@ static void v_APCI1564_Interrupt(int irq, void *d) devpriv->iobase + APCI1564_COUNTER2 + APCI1564_TCW_PROG); - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); - // Enable Counter Interrupt + /* Enable Counter Interrupt */ outl(ul_Command2, devpriv->iobase + APCI1564_COUNTER2 + APCI1564_TCW_PROG); - } // if ((ui_C2 == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_COUNTER)) + } /* if ((ui_C2 == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_COUNTER)) */ if ((ui_C3 == 1) && (devpriv->b_TimerSelectMode = ADDIDATA_COUNTER)) { - // Disable Counter Interrupt + /* Disable Counter Interrupt */ ul_Command2 = inl(devpriv->iobase + APCI1564_COUNTER3 + APCI1564_TCW_PROG); @@ -1037,17 +1039,17 @@ static void v_APCI1564_Interrupt(int irq, void *d) devpriv->iobase + APCI1564_COUNTER3 + APCI1564_TCW_PROG); - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); - // Enable Counter Interrupt + /* Enable Counter Interrupt */ outl(ul_Command2, devpriv->iobase + APCI1564_COUNTER3 + APCI1564_TCW_PROG); - } // if ((ui_C3 == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_COUNTER)) + } /* if ((ui_C3 == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_COUNTER)) */ if ((ui_C4 == 1) && (devpriv->b_TimerSelectMode = ADDIDATA_COUNTER)) { - // Disable Counter Interrupt + /* Disable Counter Interrupt */ ul_Command2 = inl(devpriv->iobase + APCI1564_COUNTER4 + APCI1564_TCW_PROG); @@ -1055,14 +1057,14 @@ static void v_APCI1564_Interrupt(int irq, void *d) devpriv->iobase + APCI1564_COUNTER4 + APCI1564_TCW_PROG); - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); - // Enable Counter Interrupt + /* Enable Counter Interrupt */ outl(ul_Command2, devpriv->iobase + APCI1564_COUNTER4 + APCI1564_TCW_PROG); - } // if ((ui_C4 == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_COUNTER)) + } /* if ((ui_C4 == 1) && (devpriv->b_TimerSelectMode =ADDIDATA_COUNTER)) */ return; } @@ -1081,16 +1083,16 @@ static void v_APCI1564_Interrupt(int irq, void *d) +----------------------------------------------------------------------------+ */ -INT i_APCI1564_Reset(struct comedi_device * dev) +int i_APCI1564_Reset(struct 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_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); /* 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); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.h index f0c461ca5396..0780c440c44a 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.h @@ -20,45 +20,45 @@ #define APCI1564_BOARD_VENDOR_ID 0x15B8 #define APCI1564_ADDRESS_RANGE 128 -//DIGITAL INPUT-OUTPUT DEFINE -// Input defines +/* 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 +/* 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 -//Digital Input IRQ Function Selection +/* Digital Input IRQ Function Selection */ #define ADDIDATA_OR 0 #define ADDIDATA_AND 1 -//Digital Input Interrupt Status +/* Digital Input Interrupt Status */ #define APCI1564_DIGITAL_IP_INTERRUPT_STATUS 12 -//Digital Output Interrupt Status +/* Digital Output Interrupt Status */ #define APCI1564_DIGITAL_OP_INTERRUPT_STATUS 8 -//Digital Input Interrupt Enable Disable. +/* Digital Input Interrupt Enable Disable. */ #define APCI1564_DIGITAL_IP_INTERRUPT_ENABLE 0x4 #define APCI1564_DIGITAL_IP_INTERRUPT_DISABLE 0xFFFFFFFB -//Digital Output Interrupt Enable Disable. +/* Digital Output Interrupt Enable Disable. */ #define APCI1564_DIGITAL_OP_VCC_INTERRUPT_ENABLE 0x1 #define APCI1564_DIGITAL_OP_VCC_INTERRUPT_DISABLE 0xFFFFFFFE #define APCI1564_DIGITAL_OP_CC_INTERRUPT_ENABLE 0x2 #define APCI1564_DIGITAL_OP_CC_INTERRUPT_DISABLE 0xFFFFFFFD -//ADDIDATA Enable Disable +/* ADDIDATA Enable Disable */ #define ADDIDATA_ENABLE 1 #define ADDIDATA_DISABLE 0 -// TIMER COUNTER WATCHDOG DEFINES +/* TIMER COUNTER WATCHDOG DEFINES */ #define ADDIDATA_TIMER 0 #define ADDIDATA_COUNTER 1 @@ -78,30 +78,32 @@ #define APCI1564_TCW_WARN_TIMEVAL 24 #define APCI1564_TCW_WARN_TIMEBASE 28 -// Hardware Layer functions for Apci1564 +/* Hardware Layer functions for Apci1564 */ -//DI -// for di read -INT i_APCI1564_ConfigDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, +/* +* DI for di read +*/ +int i_APCI1564_ConfigDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1564_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1564_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1564_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1564_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -//DO +/* DO */ int i_APCI1564_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1564_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1564_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI1564_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI1564_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); int i_APCI1564_ReadInterruptStatus(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -// TIMER -// timer value is passed as u seconds -INT i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device *dev, +/* +* TIMER timer value is passed as u seconds +*/ +int i_APCI1564_ConfigTimerCounterWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); int i_APCI1564_StartStopWriteTimerCounterWatchdog(struct comedi_device *dev, @@ -112,8 +114,8 @@ int i_APCI1564_ReadTimerCounterWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -// INTERRUPT +/* intERRUPT */ static void v_APCI1564_Interrupt(int irq, void *d); -// RESET -INT i_APCI1564_Reset(struct comedi_device *dev); +/* RESET */ +int i_APCI1564_Reset(struct comedi_device *dev); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci16xx.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci16xx.c index 906d635da6b2..b22739a6c9a6 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci16xx.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci16xx.c @@ -57,7 +57,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI16XX_InsnConfigInitTTLIO | +| Function Name : int i_APCI16XX_InsnConfigInitTTLIO | | (struct comedi_device *dev, | | struct comedi_subdevice *s, | | struct comedi_insn *insn, | @@ -69,11 +69,11 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc | 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]; | +| Input Parameters : b_InitType = (unsigned char) data[0]; | +| b_Port0Mode = (unsigned char) data[1]; | +| b_Port1Mode = (unsigned char) data[2]; | +| b_Port2Mode = (unsigned char) data[3]; | +| b_Port3Mode = (unsigned char) data[4]; | | ........ | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -93,11 +93,11 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = insn->n; - BYTE b_Command = 0; - BYTE b_Cpt = 0; - BYTE b_NumberOfPort = - (BYTE) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 8); + int i_ReturnValue = insn->n; + unsigned char b_Command = 0; + unsigned char b_Cpt = 0; + unsigned char b_NumberOfPort = + (unsigned char) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 8); /************************/ /* Test the buffer size */ @@ -108,7 +108,7 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev, /* Get the command */ /* **************** */ - b_Command = (BYTE) data[0]; + b_Command = (unsigned char) data[0]; /********************/ /* Test the command */ @@ -122,7 +122,7 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev, /***************************************/ if ((b_Command == APCI16XX_TTL_INITDIRECTION) - && ((BYTE) (insn->n - 1) != b_NumberOfPort)) { + && ((unsigned char) (insn->n - 1) != b_NumberOfPort)) { /*******************/ /* Data size error */ /*******************/ @@ -132,7 +132,7 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev, } if ((b_Command == APCI16XX_TTL_OUTPUTMEMORY) - && ((BYTE) (insn->n) != 2)) { + && ((unsigned char) (insn->n) != 2)) { /*******************/ /* Data size error */ /*******************/ @@ -182,8 +182,8 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev, /************************/ printk("\nPort %d direction selection error", - (INT) b_Cpt); - i_ReturnValue = -(INT) b_Cpt; + (int) b_Cpt); + i_ReturnValue = -(int) b_Cpt; } /**************************/ @@ -250,7 +250,7 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI16XX_InsnBitsReadTTLIO | +| Function Name : int i_APCI16XX_InsnBitsReadTTLIO | | (struct comedi_device *dev, | | struct comedi_subdevice *s, | | struct comedi_insn *insn, | @@ -266,11 +266,11 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev, | APCI16XX_TTL_READCHANNEL | | b_SelectedPort= CR_RANGE(insn->chanspec); | | b_InputChannel= CR_CHAN(insn->chanspec); | -| b_ReadType = (BYTE) data[0]; | +| b_ReadType = (unsigned char) data[0]; | | | | APCI16XX_TTL_READPORT | | b_SelectedPort= CR_RANGE(insn->chanspec); | -| b_ReadType = (BYTE) data[0]; | +| b_ReadType = (unsigned char) data[0]; | +----------------------------------------------------------------------------+ | Output Parameters : data[0] 0 : Channle is not active | | 1 : Channle is active | @@ -286,14 +286,14 @@ int i_APCI16XX_InsnConfigInitTTLIO(struct comedi_device * dev, int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * 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; + int i_ReturnValue = insn->n; + unsigned char b_Command = 0; + unsigned char b_NumberOfPort = + (unsigned char) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 8); + unsigned char b_SelectedPort = CR_RANGE(insn->chanspec); + unsigned char b_InputChannel = CR_CHAN(insn->chanspec); + unsigned char *pb_Status; + unsigned int dw_Status; /************************/ /* Test the buffer size */ @@ -304,7 +304,7 @@ int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device * dev, /* Get the command */ /* **************** */ - b_Command = (BYTE) data[0]; + b_Command = (unsigned char) data[0]; /********************/ /* Test the command */ @@ -380,7 +380,7 @@ int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device * dev, /**************************/ if (i_ReturnValue >= 0) { - pb_Status = (PBYTE) & data[0]; + pb_Status = (unsigned char *) & data[0]; /*******************************/ /* Get the digital inpu status */ @@ -394,7 +394,7 @@ int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device * dev, /* Save the port value */ /***********************/ - *pb_Status = (BYTE) dw_Status; + *pb_Status = (unsigned char) dw_Status; /***************************************/ /* Test if read channel status command */ @@ -410,7 +410,7 @@ int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI16XX_InsnReadTTLIOAllPortValue | +| Function Name : int i_APCI16XX_InsnReadTTLIOAllPortValue | | (struct comedi_device *dev, | | struct comedi_subdevice *s, | | struct comedi_insn *insn, | @@ -433,10 +433,10 @@ int i_APCI16XX_InsnBitsReadTTLIO(struct comedi_device * dev, int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - BYTE b_Command = (BYTE) CR_AREF(insn->chanspec); - INT i_ReturnValue = insn->n; - BYTE b_Cpt = 0; - BYTE b_NumberOfPort = 0; + unsigned char b_Command = (unsigned char) CR_AREF(insn->chanspec); + int i_ReturnValue = insn->n; + unsigned char b_Cpt = 0; + unsigned char b_NumberOfPort = 0; unsigned int *pls_ReadData = data; /********************/ @@ -450,7 +450,7 @@ int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device * dev, /**********************************/ b_NumberOfPort = - (BYTE) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 32); + (unsigned char) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 32); if ((b_NumberOfPort * 32) < devpriv->ps_BoardInfo->i_NbrTTLChannel) { b_NumberOfPort = b_NumberOfPort + 1; @@ -535,7 +535,7 @@ int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI16XX_InsnBitsWriteTTLIO | +| Function Name : int i_APCI16XX_InsnBitsWriteTTLIO | | (struct comedi_device *dev, | | struct comedi_subdevice *s, | | struct comedi_insn *insn, | @@ -551,11 +551,11 @@ int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device * dev, | 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]; | +| b_Command = (unsigned char) data[0]; | | | | APCI16XX_TTL_WRITEPORT_ON | APCI16XX_TTL_WRITEPORT_OFF | | b_SelectedPort = CR_RANGE(insn->chanspec); | -| b_Command = (BYTE) data[0]; | +| b_Command = (unsigned char) data[0]; | +----------------------------------------------------------------------------+ | Output Parameters : data[0] : TTL output port 0 to 3 data | | data[1] : TTL output port 4 to 7 data | @@ -573,13 +573,13 @@ int i_APCI16XX_InsnReadTTLIOAllPortValue(struct comedi_device * dev, int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * 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; + int i_ReturnValue = insn->n; + unsigned char b_Command = 0; + unsigned char b_NumberOfPort = + (unsigned char) (devpriv->ps_BoardInfo->i_NbrTTLChannel / 8); + unsigned char b_SelectedPort = CR_RANGE(insn->chanspec); + unsigned char b_OutputChannel = CR_CHAN(insn->chanspec); + unsigned int dw_Status = 0; /************************/ /* Test the buffer size */ @@ -590,7 +590,7 @@ int i_APCI16XX_InsnBitsWriteTTLIO(struct comedi_device * dev, /* Get the command */ /* **************** */ - b_Command = (BYTE) data[0]; + b_Command = (unsigned char) data[0]; /********************/ /* Test the command */ diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2016.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2016.c index 31f55da39ea8..1969e8df7378 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2016.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2016.c @@ -62,7 +62,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc | Task : Configures The Digital Output Subdevice. | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | +| unsigned int *data : Data Pointer contains | | configuration parameters as below | | | | data[0] : 1 Digital Memory On | @@ -82,13 +82,13 @@ int i_APCI2016_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub 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)) */ if (data[0]) { devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE; - } // if (data[0] + } /* if (data[0] */ else { devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE; - } // else if (data[0] + } /* else if (data[0] */ return insn->n; } @@ -101,8 +101,8 @@ int i_APCI2016_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub | Task : Writes port value To the selected port | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To Write | -| UINT *data : Data Pointer to read status | +| unsigned int ui_NoOfChannels : No Of Channels To Write | +| unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -114,31 +114,31 @@ int i_APCI2016_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub int i_APCI2016_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_NoOfChannel; - UINT ui_Temp, ui_Temp1; + unsigned int ui_NoOfChannel; + unsigned int 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 ((ui_NoOfChannel<0) || (ui_NoOfChannel>15)) */ if (devpriv->b_OutputMemoryStatus) { ui_Temp = inw(devpriv->iobase + APCI2016_DIGITAL_OP); - } // if (devpriv->b_OutputMemoryStatus ) + } /* if (devpriv->b_OutputMemoryStatus ) */ else { ui_Temp = 0; - } // else if (devpriv->b_OutputMemoryStatus ) + } /* 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[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) + } /* if (data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -162,16 +162,16 @@ int i_APCI2016_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd break; default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " - } //switch(ui_NoOfChannels) + return -EINVAL; /* "sorry channel spec wrong " */ + } /* switch(ui_NoOfChannels) */ outw(data[0], devpriv->iobase + APCI2016_DIGITAL_OP); - } // if (data[1]==1) + } /* 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[1]==1) */ + } /* else if (data[1]==0) */ + } /* if (data[3]==0) */ else { if (data[3] == 1) { if (data[1] == 0) { @@ -183,7 +183,7 @@ int i_APCI2016_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd data[0] = data[0] & ui_Temp; outw(data[0], devpriv->iobase + APCI2016_DIGITAL_OP); - } // if (data[1]==0) + } /* if (data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -228,22 +228,22 @@ int i_APCI2016_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " - } //switch(ui_NoOfChannels) + return -EINVAL; /* "sorry channel spec wrong " */ + } /* switch(ui_NoOfChannels) */ outw(data[0], devpriv->iobase + APCI2016_DIGITAL_OP); - } // if(data[1]==1) + } /* 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 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) + } /* if else data[3]==1) */ + } /* if else data[3]==0) */ return insn->n; } @@ -256,8 +256,8 @@ int i_APCI2016_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd | Task : Read value of the selected channel or port | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To read | -| UINT *data : Data Pointer to read status | +| unsigned int ui_NoOfChannels : No Of Channels To read | +| unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -269,24 +269,24 @@ int i_APCI2016_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd int i_APCI2016_BitsDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_Temp; - UINT ui_NoOfChannel; + unsigned int ui_Temp; + unsigned int 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 ((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)) + } /* 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) + } /* if (ui_Temp==0) */ else { if (ui_Temp == 1) { switch (ui_NoOfChannel) { @@ -307,13 +307,13 @@ int i_APCI2016_BitsDigitalOutput(struct comedi_device * dev, struct comedi_subde default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " - } //switch(ui_NoOfChannel) - } // if (ui_Temp==1) + 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) + } /* else if (ui_Temp==1) */ + } /* if (ui_Temp==0) */ return insn->n; } @@ -342,11 +342,11 @@ int i_APCI2016_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevic { if (data[0] == 0) { - //Disable the watchdog + /* Disable the watchdog */ outw(0x0, devpriv->i_IobaseAddon + APCI2016_WATCHDOG_ENABLEDISABLE); - //Loading the Reload value + /* Loading the Reload value */ outw(data[1], devpriv->i_IobaseAddon + APCI2016_WATCHDOG_RELOAD_VALUE); @@ -385,15 +385,15 @@ int i_APCI2016_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_ { switch (data[0]) { - case 0: //stop the watchdog - outw(0x0, devpriv->i_IobaseAddon + APCI2016_WATCHDOG_ENABLEDISABLE); //disable the watchdog + case 0: /* stop the watchdog */ + outw(0x0, devpriv->i_IobaseAddon + APCI2016_WATCHDOG_ENABLEDISABLE); /* disable the watchdog */ break; - case 1: //start the watchdog + case 1: /* start the watchdog */ outw(0x0001, devpriv->i_IobaseAddon + APCI2016_WATCHDOG_ENABLEDISABLE); break; - case 2: //Software trigger + case 2: /* Software trigger */ outw(0x0201, devpriv->i_IobaseAddon + APCI2016_WATCHDOG_ENABLEDISABLE); @@ -401,7 +401,7 @@ int i_APCI2016_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_ default: printk("\nSpecified functionality does not exist\n"); return -EINVAL; - } // switch(data[0]) + } /* switch(data[0]) */ return insn->n; } @@ -450,9 +450,9 @@ int i_APCI2016_ReadWatchdog(struct comedi_device * dev, struct comedi_subdevice +----------------------------------------------------------------------------+ */ -INT i_APCI2016_Reset(struct comedi_device * dev) +int i_APCI2016_Reset(struct comedi_device * dev) { - outw(0x0, devpriv->iobase + APCI2016_DIGITAL_OP); // Resets the digital output channels + 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); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2016.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2016.h index 9261aacd25f1..639944c44469 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2016.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2016.h @@ -19,17 +19,17 @@ #define APCI2016_BOARD_VENDOR_ID 0x15B8 #define APCI2016_ADDRESS_RANGE 8 -//DIGITAL INPUT-OUTPUT DEFINE +/* DIGITAL INPUT-OUTPUT DEFINE */ #define APCI2016_DIGITAL_OP 0x04 #define APCI2016_DIGITAL_OP_RW 4 -//ADDIDATA Enable Disable +/* ADDIDATA Enable Disable */ #define ADDIDATA_ENABLE 1 #define ADDIDATA_DISABLE 0 -// TIMER COUNTER WATCHDOG DEFINES +/* TIMER COUNTER WATCHDOG DEFINES */ #define ADDIDATA_WATCHDOG 2 #define APCI2016_DIGITAL_OP_WATCHDOG 0 @@ -37,9 +37,9 @@ #define APCI2016_WATCHDOG_RELOAD_VALUE 4 #define APCI2016_WATCHDOG_STATUS 16 -// Hardware Layer functions for Apci2016 +/* Hardware Layer functions for Apci2016 */ -//DO +/* DO */ int i_APCI2016_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); @@ -49,8 +49,10 @@ int i_APCI2016_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subde int i_APCI2016_BitsDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -// TIMER -// timer value is passed as u seconds +/* +* TIMER +* timer value is passed as u seconds +*/ int i_APCI2016_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); @@ -61,10 +63,10 @@ int i_APCI2016_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_s int i_APCI2016_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -// Interrupt functions..... +/* Interrupt functions..... */ -// void v_APCI2016_Interrupt(int irq, void *d) ; +/* void v_APCI2016_Interrupt(int irq, void *d); */ - //void v_APCI2016_Interrupt(int irq, void *d); -// RESET -INT i_APCI2016_Reset(struct comedi_device *dev); +/* void v_APCI2016_Interrupt(int irq, void *d); */ +/* RESET */ +int i_APCI2016_Reset(struct comedi_device *dev); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.c index 1347bc388f3e..c2580c6e0d4d 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.c @@ -53,7 +53,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc */ #include "hwdrv_apci2032.h" -UINT ui_InterruptData, ui_Type; +unsigned int ui_InterruptData, ui_Type; /* +----------------------------------------------------------------------------+ | Function Name : int i_APCI2032_ConfigDigitalOutput | @@ -63,7 +63,7 @@ UINT ui_InterruptData, ui_Type; | Task : Configures The Digital Output Subdevice. | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | +| unsigned int *data : Data Pointer contains | | configuration parameters as below | | | | data[1] : 1 Enable VCC Interrupt | @@ -82,33 +82,33 @@ UINT ui_InterruptData, ui_Type; int i_APCI2032_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - ULONG ul_Command = 0; + unsigned int ul_Command = 0; devpriv->tsk_Current = current; 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) ) */ if (data[0]) { devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE; - } // if (data[0]) + } /* if (data[0]) */ else { devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE; - } //else if (data[0]) + } /* else if (data[0]) */ if (data[1] == ADDIDATA_ENABLE) { ul_Command = ul_Command | 0x1; - } //if (data[1] == ADDIDATA_ENABLE) + } /* if (data[1] == ADDIDATA_ENABLE) */ else { ul_Command = ul_Command & 0xFFFFFFFE; - } //elseif (data[1] == ADDIDATA_ENABLE) + } /* elseif (data[1] == ADDIDATA_ENABLE) */ if (data[2] == ADDIDATA_ENABLE) { ul_Command = ul_Command | 0x2; - } //if (data[2] == ADDIDATA_ENABLE) + } /* if (data[2] == ADDIDATA_ENABLE) */ else { ul_Command = ul_Command & 0xFFFFFFFD; - } //elseif (data[2] == ADDIDATA_ENABLE) + } /* elseif (data[2] == ADDIDATA_ENABLE) */ outl(ul_Command, devpriv->iobase + APCI2032_DIGITAL_OP_INTERRUPT); ui_InterruptData = inl(devpriv->iobase + APCI2032_DIGITAL_OP_INTERRUPT); return insn->n; @@ -123,8 +123,8 @@ int i_APCI2032_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub | Task : Writes port value To the selected port | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To Write | -| UINT *data : Data Pointer to read status | +| unsigned int ui_NoOfChannels : No Of Channels To Write | +| unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -134,23 +134,23 @@ int i_APCI2032_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub +----------------------------------------------------------------------------+ */ -INT i_APCI2032_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI2032_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_Temp, ui_Temp1; - UINT ui_NoOfChannel = CR_CHAN(insn->chanspec); // get the channel + unsigned int ui_Temp, ui_Temp1; + unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */ if (devpriv->b_OutputMemoryStatus) { ui_Temp = inl(devpriv->iobase + APCI2032_DIGITAL_OP); - } //if(devpriv->b_OutputMemoryStatus ) + } /* if(devpriv->b_OutputMemoryStatus ) */ else { ui_Temp = 0; - } //if(devpriv->b_OutputMemoryStatus ) + } /* if(devpriv->b_OutputMemoryStatus ) */ if (data[3] == 0) { if (data[1] == 0) { data[0] = (data[0] << ui_NoOfChannel) | ui_Temp; outl(data[0], devpriv->iobase + APCI2032_DIGITAL_OP); - } //if(data[1]==0) + } /* if(data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -184,18 +184,18 @@ INT i_APCI2032_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ - } //switch(ui_NoOfChannels) + } /* switch(ui_NoOfChannels) */ outl(data[0], devpriv->iobase + APCI2032_DIGITAL_OP); - } // if(data[1]==1) + } /* 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[1]==1) */ + } /* elseif(data[1]==0) */ + } /* if(data[3]==0) */ else { if (data[3] == 1) { if (data[1] == 0) { @@ -209,7 +209,7 @@ INT i_APCI2032_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd data[0] = data[0] & ui_Temp; outl(data[0], devpriv->iobase + APCI2032_DIGITAL_OP); - } //if(data[1]==0) + } /* if(data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -272,24 +272,24 @@ INT i_APCI2032_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ - } //switch(ui_NoOfChannels) + } /* switch(ui_NoOfChannels) */ outl(data[0], devpriv->iobase + APCI2032_DIGITAL_OP); - } // if(data[1]==1) + } /* 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 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) + } /* if else data[3]==1) */ + } /* if else data[3]==0) */ return (insn->n);; } @@ -302,8 +302,8 @@ INT i_APCI2032_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd | Task : Read value of the selected channel or port | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To read | -| UINT *data : Data Pointer to read status | +| unsigned int ui_NoOfChannels : No Of Channels To read | +| unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -313,17 +313,17 @@ INT i_APCI2032_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd +----------------------------------------------------------------------------+ */ -INT i_APCI2032_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI2032_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_Temp; - UINT ui_NoOfChannel; + unsigned int ui_Temp; + unsigned int ui_NoOfChannel; ui_NoOfChannel = CR_CHAN(insn->chanspec); ui_Temp = data[0]; *data = inl(devpriv->iobase + APCI2032_DIGITAL_OP_RW); if (ui_Temp == 0) { *data = (*data >> ui_NoOfChannel) & 0x1; - } //if (ui_Temp==0) + } /* if (ui_Temp==0) */ else { if (ui_Temp == 1) { switch (ui_NoOfChannel) { @@ -349,20 +349,20 @@ INT i_APCI2032_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ - } //switch(ui_NoOfChannels) - } //if (ui_Temp==1) + } /* switch(ui_NoOfChannels) */ + } /* if (ui_Temp==1) */ else { printk("\nSpecified channel not supported \n"); - } //elseif (ui_Temp==1) + } /* elseif (ui_Temp==1) */ } return insn->n; } /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI2032_ConfigWatchdog(comedi_device +| Function Name : int i_APCI2032_ConfigWatchdog(comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data)| | | +----------------------------------------------------------------------------+ @@ -380,15 +380,15 @@ INT i_APCI2032_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde | | +----------------------------------------------------------------------------+ */ -INT i_APCI2032_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI2032_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { if (data[0] == 0) { - //Disable the watchdog + /* Disable the watchdog */ outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_PROG); - //Loading the Reload value + /* Loading the Reload value */ outl(data[1], devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_RELOAD_VALUE); @@ -425,15 +425,15 @@ int i_APCI2032_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_ struct comedi_insn * insn, unsigned int * data) { switch (data[0]) { - case 0: //stop the watchdog - outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_PROG); //disable the watchdog + case 0: /* stop the watchdog */ + outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_PROG); /* disable the watchdog */ break; - case 1: //start the watchdog + case 1: /* start the watchdog */ outl(0x0001, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_PROG); break; - case 2: //Software trigger + case 2: /* Software trigger */ outl(0x0201, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_PROG); @@ -498,13 +498,13 @@ void v_APCI2032_Interrupt(int irq, void *d) struct comedi_device *dev = d; unsigned int ui_DO; - ui_DO = inl(devpriv->iobase + APCI2032_DIGITAL_OP_IRQ) & 0x1; //Check if VCC OR CC interrupt has occured. + ui_DO = inl(devpriv->iobase + APCI2032_DIGITAL_OP_IRQ) & 0x1; /* Check if VCC OR CC interrupt has occured. */ if (ui_DO == 0) { printk("\nInterrupt from unKnown source\n"); - } // if(ui_DO==0) + } /* if(ui_DO==0) */ if (ui_DO) { - // Check for Digital Output interrupt Type - 1: Vcc interrupt 2: CC interrupt. + /* Check for Digital Output interrupt Type - 1: Vcc interrupt 2: CC interrupt. */ ui_Type = inl(devpriv->iobase + APCI2032_DIGITAL_OP_INTERRUPT_STATUS) & 0x3; @@ -512,16 +512,16 @@ void v_APCI2032_Interrupt(int irq, void *d) devpriv->iobase + APCI2032_DIGITAL_OP + APCI2032_DIGITAL_OP_INTERRUPT); if (ui_Type == 1) { - //Sends signal to user space + /* Sends signal to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); - } // if (ui_Type==1) + } /* if (ui_Type==1) */ else { if (ui_Type == 2) { - // Sends signal to user space + /* Sends signal to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); - } //if (ui_Type==2) - } //else if (ui_Type==1) - } //if(ui_DO) + } /* if (ui_Type==2) */ + } /* else if (ui_Type==1) */ + } /* if(ui_DO) */ return; @@ -571,9 +571,9 @@ int i_APCI2032_Reset(struct comedi_device * dev) { devpriv->b_DigitalOutputRegister = 0; ui_Type = 0; - outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP); //Resets the output channels - outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_INTERRUPT); //Disables the interrupt. - outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_PROG); //disable the watchdog - outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_RELOAD_VALUE); //reload=0 + outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP); /* Resets the output channels */ + outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_INTERRUPT); /* Disables the interrupt. */ + outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_PROG); /* disable the watchdog */ + outl(0x0, devpriv->iobase + APCI2032_DIGITAL_OP_WATCHDOG + APCI2032_TCW_RELOAD_VALUE); /* reload=0 */ return 0; } diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.h index 55002e0288b5..c971d143c249 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.h @@ -17,32 +17,32 @@ /********* Definitions for APCI-2032 card *****/ -// Card Specific information +/* Card Specific information */ #define APCI2032_BOARD_VENDOR_ID 0x15B8 #define APCI2032_ADDRESS_RANGE 63 -//DIGITAL INPUT-OUTPUT DEFINE +/* DIGITAL INPUT-OUTPUT DEFINE */ #define APCI2032_DIGITAL_OP 0 #define APCI2032_DIGITAL_OP_RW 0 #define APCI2032_DIGITAL_OP_INTERRUPT 4 #define APCI2032_DIGITAL_OP_IRQ 12 -//Digital Output Interrupt Status +/* Digital Output Interrupt Status */ #define APCI2032_DIGITAL_OP_INTERRUPT_STATUS 8 -//Digital Output Interrupt Enable Disable. +/* Digital Output Interrupt Enable Disable. */ #define APCI2032_DIGITAL_OP_VCC_INTERRUPT_ENABLE 0x1 #define APCI2032_DIGITAL_OP_VCC_INTERRUPT_DISABLE 0xFFFFFFFE #define APCI2032_DIGITAL_OP_CC_INTERRUPT_ENABLE 0x2 #define APCI2032_DIGITAL_OP_CC_INTERRUPT_DISABLE 0xFFFFFFFD -//ADDIDATA Enable Disable +/* ADDIDATA Enable Disable */ #define ADDIDATA_ENABLE 1 #define ADDIDATA_DISABLE 0 -// TIMER COUNTER WATCHDOG DEFINES +/* TIMER COUNTER WATCHDOG DEFINES */ #define ADDIDATA_WATCHDOG 2 #define APCI2032_DIGITAL_OP_WATCHDOG 16 @@ -52,30 +52,32 @@ #define APCI2032_TCW_TRIG_STATUS 16 #define APCI2032_TCW_IRQ 20 -// Hardware Layer functions for Apci2032 +/* Hardware Layer functions for Apci2032 */ -//DO +/* DO */ int i_APCI2032_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI2032_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI2032_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI2032_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI2032_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); int i_APCI2032_ReadInterruptStatus(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -// TIMER -// timer value is passed as u seconds -INT i_APCI2032_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, +/* TIMER + * timer value is passed as u seconds +*/ + +int i_APCI2032_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); int i_APCI2032_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); int i_APCI2032_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -// Interrupt functions..... +/* Interrupt functions..... */ void v_APCI2032_Interrupt(int irq, void *d); -//Reset functions +/* Reset functions */ int i_APCI2032_Reset(struct comedi_device *dev); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2200.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2200.c index 947e18ef3ab3..530629bcdaca 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2200.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2200.c @@ -73,20 +73,20 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc | | +----------------------------------------------------------------------------+ */ -INT i_APCI2200_Read1DigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI2200_Read1DigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_TmpValue = 0; - UINT ui_Channel; + unsigned int ui_TmpValue = 0; + unsigned int ui_Channel; ui_Channel = CR_CHAN(insn->chanspec); if (ui_Channel >= 0 && ui_Channel <= 7) { - ui_TmpValue = (UINT) inw(devpriv->iobase + APCI2200_DIGITAL_IP); + ui_TmpValue = (unsigned int) inw(devpriv->iobase + APCI2200_DIGITAL_IP); *data = (ui_TmpValue >> ui_Channel) & 0x1; - } //if(ui_Channel >= 0 && ui_Channel <=7) + } /* if(ui_Channel >= 0 && ui_Channel <=7) */ else { printk("\nThe specified channel does not exist\n"); - return -EINVAL; // "sorry channel spec wrong " - } //else if(ui_Channel >= 0 && ui_Channel <=7) + return -EINVAL; /* "sorry channel spec wrong " */ + } /* else if(ui_Channel >= 0 && ui_Channel <=7) */ return insn->n; } @@ -112,17 +112,17 @@ INT i_APCI2200_Read1DigitalInput(struct comedi_device * dev, struct comedi_subde +----------------------------------------------------------------------------+ */ -INT i_APCI2200_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI2200_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_PortValue = data[0]; - UINT ui_Mask = 0; - UINT ui_NoOfChannels; + unsigned int ui_PortValue = data[0]; + unsigned int ui_Mask = 0; + unsigned int ui_NoOfChannels; ui_NoOfChannels = CR_CHAN(insn->chanspec); - *data = (UINT) inw(devpriv->iobase + APCI2200_DIGITAL_IP); + *data = (unsigned int) inw(devpriv->iobase + APCI2200_DIGITAL_IP); switch (ui_NoOfChannels) { case 2: ui_Mask = 3; @@ -137,9 +137,9 @@ INT i_APCI2200_ReadMoreDigitalInput(struct comedi_device * dev, struct comedi_su default: printk("\nWrong parameters\n"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ break; - } //switch(ui_NoOfChannels) + } /* switch(ui_NoOfChannels) */ return insn->n; } @@ -197,23 +197,23 @@ int i_APCI2200_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub +----------------------------------------------------------------------------+ */ -INT i_APCI2200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI2200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_Temp, ui_Temp1; - UINT ui_NoOfChannel = CR_CHAN(insn->chanspec); // get the channel + unsigned int ui_Temp, ui_Temp1; + unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */ if (devpriv->b_OutputMemoryStatus) { ui_Temp = inw(devpriv->iobase + APCI2200_DIGITAL_OP); - } //if(devpriv->b_OutputMemoryStatus ) + } /* if(devpriv->b_OutputMemoryStatus ) */ else { ui_Temp = 0; - } //if(devpriv->b_OutputMemoryStatus ) + } /* 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 + APCI2200_DIGITAL_OP); - } //if(data[1]==0) + } /* if(data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -240,18 +240,18 @@ INT i_APCI2200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd break; default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ - } //switch(ui_NoOfChannels) + } /* switch(ui_NoOfChannels) */ outw(data[0], devpriv->iobase + APCI2200_DIGITAL_OP); - } // if(data[1]==1) + } /* 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[1]==1) */ + } /* elseif(data[1]==0) */ + } /* if(data[3]==0) */ else { if (data[3] == 1) { if (data[1] == 0) { @@ -263,7 +263,7 @@ INT i_APCI2200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd data[0] = data[0] & ui_Temp; outw(data[0], devpriv->iobase + APCI2200_DIGITAL_OP); - } //if(data[1]==0) + } /* if(data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -312,24 +312,24 @@ INT i_APCI2200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ - } //switch(ui_NoOfChannels) + } /* switch(ui_NoOfChannels) */ outw(data[0], devpriv->iobase + APCI2200_DIGITAL_OP); - } // if(data[1]==1) + } /* 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 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) + } /* if else data[3]==1) */ + } /* if else data[3]==0) */ return (insn->n);; } @@ -354,17 +354,17 @@ INT i_APCI2200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd +----------------------------------------------------------------------------+ */ -INT i_APCI2200_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI2200_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_Temp; - UINT ui_NoOfChannel = CR_CHAN(insn->chanspec); // get the channel + unsigned int ui_Temp; + unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */ ui_Temp = data[0]; *data = inw(devpriv->iobase + APCI2200_DIGITAL_OP); if (ui_Temp == 0) { *data = (*data >> ui_NoOfChannel) & 0x1; - } //if(ui_Temp==0) + } /* if(ui_Temp==0) */ else { if (ui_Temp == 1) { switch (ui_NoOfChannel) { @@ -386,14 +386,14 @@ INT i_APCI2200_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ - } //switch(ui_NoOfChannels) - } //if(ui_Temp==1) + } /* switch(ui_NoOfChannels) */ + } /* if(ui_Temp==1) */ else { printk("\nSpecified channel not supported \n"); - } //elseif(ui_Temp==1) - } //elseif(ui_Temp==0) + } /* elseif(ui_Temp==1) */ + } /* elseif(ui_Temp==0) */ return insn->n; } @@ -422,11 +422,11 @@ int i_APCI2200_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevic struct comedi_insn * insn, unsigned int * data) { if (data[0] == 0) { - //Disable the watchdog + /* Disable the watchdog */ outw(0x0, devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_ENABLEDISABLE); - //Loading the Reload value + /* Loading the Reload value */ outw(data[1], devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_RELOAD_VALUE); @@ -434,11 +434,11 @@ int i_APCI2200_ConfigWatchdog(struct comedi_device * dev, struct comedi_subdevic outw(data[1], devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_RELOAD_VALUE + 2); - } //if(data[0]==0) + } /* if(data[0]==0) */ else { printk("\nThe input parameters are wrong\n"); return -EINVAL; - } //elseif(data[0]==0) + } /* elseif(data[0]==0) */ return insn->n; } @@ -468,15 +468,15 @@ int i_APCI2200_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_ struct comedi_insn * insn, unsigned int * data) { switch (data[0]) { - case 0: //stop the watchdog - outw(0x0, devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_ENABLEDISABLE); //disable the watchdog + case 0: /* stop the watchdog */ + outw(0x0, devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_ENABLEDISABLE); /* disable the watchdog */ break; - case 1: //start the watchdog + case 1: /* start the watchdog */ outw(0x0001, devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_ENABLEDISABLE); break; - case 2: //Software trigger + case 2: /* Software trigger */ outw(0x0201, devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_ENABLEDISABLE); @@ -484,7 +484,7 @@ int i_APCI2200_StartStopWriteWatchdog(struct comedi_device * dev, struct comedi_ default: printk("\nSpecified functionality does not exist\n"); return -EINVAL; - } // switch(data[0]) + } /* switch(data[0]) */ return insn->n; } @@ -533,9 +533,9 @@ int i_APCI2200_ReadWatchdog(struct comedi_device * dev, struct comedi_subdevice +----------------------------------------------------------------------------+ */ -INT i_APCI2200_Reset(struct comedi_device * dev) +int i_APCI2200_Reset(struct comedi_device * dev) { - outw(0x0, devpriv->iobase + APCI2200_DIGITAL_OP); //RESETS THE DIGITAL OUTPUTS + outw(0x0, devpriv->iobase + APCI2200_DIGITAL_OP); /* RESETS THE DIGITAL OUTPUTS */ outw(0x0, devpriv->iobase + APCI2200_WATCHDOG + APCI2200_WATCHDOG_ENABLEDISABLE); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2200.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2200.h index 0a115b4c44c9..63e5f1fcecc7 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2200.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2200.h @@ -17,39 +17,39 @@ /********* Definitions for APCI-2200 card *****/ -// Card Specific information +/* Card Specific information */ #define APCI2200_BOARD_VENDOR_ID 0x15b8 #define APCI2200_ADDRESS_RANGE 64 -//DIGITAL INPUT-OUTPUT DEFINE +/* DIGITAL INPUT-OUTPUT DEFINE */ #define APCI2200_DIGITAL_OP 4 #define APCI2200_DIGITAL_IP 0 -// TIMER COUNTER WATCHDOG DEFINES +/* TIMER COUNTER WATCHDOG DEFINES */ #define APCI2200_WATCHDOG 0x08 #define APCI2200_WATCHDOG_ENABLEDISABLE 12 #define APCI2200_WATCHDOG_RELOAD_VALUE 4 #define APCI2200_WATCHDOG_STATUS 16 -// Hardware Layer functions for Apci2200 +/* Hardware Layer functions for Apci2200 */ -//Digital Input -INT i_APCI2200_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, +/* Digital Input */ +int i_APCI2200_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI2200_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI2200_Read1DigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -//Digital Output +/* Digital Output */ int i_APCI2200_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI2200_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI2200_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI2200_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI2200_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -// TIMER +/* TIMER */ int i_APCI2200_ConfigWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); int i_APCI2200_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, @@ -57,5 +57,5 @@ int i_APCI2200_StartStopWriteWatchdog(struct comedi_device *dev, struct comedi_s int i_APCI2200_ReadWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -//reset -INT i_APCI2200_Reset(struct comedi_device *dev); +/* reset */ +int i_APCI2200_Reset(struct comedi_device *dev); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index 68eb8dfd5139..4808acbebd8c 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -45,9 +45,9 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc */ #include "hwdrv_apci3120.h" -static UINT ui_Temp = 0; +static unsigned int ui_Temp = 0; -// FUNCTION DEFINITIONS +/* FUNCTION DEFINITIONS */ /* +----------------------------------------------------------------------------+ @@ -77,17 +77,17 @@ static UINT ui_Temp = 0; int i_APCI3120_InsnConfigAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT i; + unsigned int i; if ((data[0] != APCI3120_EOC_MODE) && (data[0] != APCI3120_EOS_MODE)) return -1; - // Check for Conversion time to be added ?? + /* Check for Conversion time to be added ?? */ devpriv->ui_EocEosConversionTime = data[2]; if (data[0] == APCI3120_EOS_MODE) { - //Test the number of the channel + /* Test the number of the channel */ for (i = 0; i < data[3]; i++) { if (CR_CHAN(data[4 + i]) >= this_board->i_NbrAiChannel) { @@ -102,14 +102,14 @@ int i_APCI3120_InsnConfigAnalogInput(struct comedi_device * dev, struct comedi_s devpriv->b_EocEosInterrupt = APCI3120_ENABLE; } else devpriv->b_EocEosInterrupt = APCI3120_DISABLE; - // Copy channel list and Range List to devpriv + /* Copy channel list and Range List to devpriv */ devpriv->ui_AiNbrofChannels = data[3]; for (i = 0; i < devpriv->ui_AiNbrofChannels; i++) { devpriv->ui_AiChannelList[i] = data[4 + i]; } - } else // EOC + } else /* EOC */ { devpriv->b_InterruptMode = APCI3120_EOC_MODE; if (data[1]) { @@ -148,25 +148,25 @@ int i_APCI3120_InsnConfigAnalogInput(struct comedi_device * dev, struct comedi_s int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - USHORT us_ConvertTiming, us_TmpValue, i; - BYTE b_Tmp; + unsigned short us_ConvertTiming, us_TmpValue, i; + unsigned char b_Tmp; - // fix convertion time to 10 us + /* fix convertion time to 10 us */ if (!devpriv->ui_EocEosConversionTime) { printk("No timer0 Value using 10 us\n"); us_ConvertTiming = 10; } else - us_ConvertTiming = (USHORT) (devpriv->ui_EocEosConversionTime / 1000); // nano to useconds + us_ConvertTiming = (unsigned short) (devpriv->ui_EocEosConversionTime / 1000); /* nano to useconds */ - // this_board->i_hwdrv_InsnReadAnalogInput(dev,us_ConvertTiming,insn->n,&insn->chanspec,data,insn->unused[0]); + /* this_board->i_hwdrv_InsnReadAnalogInput(dev,us_ConvertTiming,insn->n,&insn->chanspec,data,insn->unused[0]); */ - // Clear software registers + /* Clear software registers */ 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 + if (insn->unused[0] == 222) /* second insn read */ { for (i = 0; i < insn->n; i++) { @@ -174,14 +174,16 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub } } else { - 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 + 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); + (unsigned short) inw(devpriv->iobase + APCI3120_RD_STATUS); - //EL250804: Testing if board APCI3120 have the new Quartz or if it is an APCI3001 + /* 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; @@ -190,25 +192,26 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub ((us_ConvertTiming * 12926) / 10000) - 1; } - us_TmpValue = (USHORT) devpriv->b_InterruptMode; + us_TmpValue = (unsigned short) devpriv->b_InterruptMode; switch (us_TmpValue) { case APCI3120_EOC_MODE: - // Testing the interrupt flag and set the EOC bit - // Clears the FIFO +/* + * Testing the interrupt flag and set the EOC bit Clears the FIFO + */ inw(devpriv->iobase + APCI3120_RESET_FIFO); - // Initialize the sequence array + /* Initialize the sequence array */ - //if (!i_APCI3120_SetupChannelList(dev,s,1,chanlist,0)) return -EINVAL; + /* if (!i_APCI3120_SetupChannelList(dev,s,1,chanlist,0)) return -EINVAL; */ if (!i_APCI3120_SetupChannelList(dev, s, 1, &insn->chanspec, 0)) return -EINVAL; - //Initialize Timer 0 mode 4 + /* Initialize Timer 0 mode 4 */ devpriv->b_TimerSelectMode = (devpriv-> b_TimerSelectMode & 0xFC) | @@ -216,14 +219,14 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub outb(devpriv->b_TimerSelectMode, devpriv->iobase + APCI3120_TIMER_CRT1); - // Reset the scan bit and Disables the EOS, DMA, EOC interrupt + /* Reset the scan bit and Disables the EOS, DMA, EOC interrupt */ devpriv->b_ModeSelectRegister = devpriv-> b_ModeSelectRegister & APCI3120_DISABLE_SCAN; if (devpriv->b_EocEosInterrupt == APCI3120_ENABLE) { - //Disables the EOS,DMA and enables the EOC interrupt + /* Disables the EOS,DMA and enables the EOC interrupt */ devpriv->b_ModeSelectRegister = (devpriv-> b_ModeSelectRegister & @@ -241,7 +244,7 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub outb(devpriv->b_ModeSelectRegister, devpriv->iobase + APCI3120_WRITE_MODE_SELECT); - // Sets gate 0 + /* Sets gate 0 */ devpriv->us_OutputRegister = (devpriv-> us_OutputRegister & APCI3120_CLEAR_PA_PR) | @@ -249,30 +252,30 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub outw(devpriv->us_OutputRegister, devpriv->iobase + APCI3120_WR_ADDRESS); - // Select Timer 0 + /* Select Timer 0 */ b_Tmp = ((devpriv-> b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_0_WORD; outb(b_Tmp, devpriv->iobase + APCI3120_TIMER_CRT0); - //Set the convertion time + /* Set the convertion time */ outw(us_ConvertTiming, devpriv->iobase + APCI3120_TIMER_VALUE); us_TmpValue = - (USHORT) inw(dev->iobase + APCI3120_RD_STATUS); + (unsigned short) inw(dev->iobase + APCI3120_RD_STATUS); if (devpriv->b_EocEosInterrupt == APCI3120_DISABLE) { do { - // Waiting for the end of conversion + /* Waiting for the end of conversion */ us_TmpValue = inw(devpriv->iobase + APCI3120_RD_STATUS); } while ((us_TmpValue & APCI3120_EOC) == APCI3120_EOC); - //Read the result in FIFO and put it in insn data pointer + /* Read the result in FIFO and put it in insn data pointer */ us_TmpValue = inw(devpriv->iobase + 0); *data = us_TmpValue; @@ -284,9 +287,9 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub case APCI3120_EOS_MODE: inw(devpriv->iobase); - // Clears the FIFO + /* Clears the FIFO */ inw(devpriv->iobase + APCI3120_RESET_FIFO); - // clear PA PR and disable timer 0 + /* clear PA PR and disable timer 0 */ devpriv->us_OutputRegister = (devpriv-> @@ -301,7 +304,7 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub devpriv->ui_AiChannelList, 0)) return -EINVAL; - //Initialize Timer 0 mode 2 + /* Initialize Timer 0 mode 2 */ devpriv->b_TimerSelectMode = (devpriv-> b_TimerSelectMode & 0xFC) | @@ -309,26 +312,26 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub outb(devpriv->b_TimerSelectMode, devpriv->iobase + APCI3120_TIMER_CRT1); - //Select Timer 0 + /* Select Timer 0 */ b_Tmp = ((devpriv-> b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_0_WORD; outb(b_Tmp, devpriv->iobase + APCI3120_TIMER_CRT0); - //Set the convertion time + /* Set the convertion time */ outw(us_ConvertTiming, devpriv->iobase + APCI3120_TIMER_VALUE); - //Set the scan bit + /* 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 Interrupt function is loaded */ if (devpriv->b_EocEosInterrupt == APCI3120_ENABLE) { - //Disables the EOC,DMA and enables the EOS interrupt + /* Disables the EOC,DMA and enables the EOS interrupt */ devpriv->b_ModeSelectRegister = (devpriv-> b_ModeSelectRegister & @@ -347,7 +350,7 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub inw(devpriv->iobase + APCI3120_RD_STATUS); - //Sets gate 0 + /* Sets gate 0 */ devpriv->us_OutputRegister = devpriv-> @@ -355,12 +358,12 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub outw(devpriv->us_OutputRegister, devpriv->iobase + APCI3120_WR_ADDRESS); - //Start conversion + /* Start conversion */ outw(0, devpriv->iobase + APCI3120_START_CONVERSION); - //Waiting of end of convertion if interrupt is not installed + /* Waiting of end of convertion if interrupt is not installed */ if (devpriv->b_EocEosInterrupt == APCI3120_DISABLE) { - //Waiting the end of convertion + /* Waiting the end of convertion */ do { us_TmpValue = inw(devpriv->iobase + @@ -371,12 +374,12 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub for (i = 0; i < devpriv->ui_AiNbrofChannels; i++) { - //Read the result in FIFO and write them in shared memory + /* Read the result in FIFO and write them in shared memory */ us_TmpValue = inw(devpriv->iobase); - data[i] = (UINT) us_TmpValue; + data[i] = (unsigned int) us_TmpValue; } - devpriv->b_InterruptMode = APCI3120_EOC_MODE; // Restore defaults. + devpriv->b_InterruptMode = APCI3120_EOC_MODE; /* Restore defaults. */ } break; @@ -384,7 +387,7 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub printk("inputs wrong\n"); } - devpriv->ui_EocEosConversionTime = 0; // re initializing the variable; + devpriv->ui_EocEosConversionTime = 0; /* re initializing the variable; */ } return insn->n; @@ -411,36 +414,39 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_sub int i_APCI3120_StopCyclicAcquisition(struct comedi_device * dev, struct comedi_subdevice * s) { - // Disable A2P Fifo write and AMWEN signal + /* Disable A2P Fifo write and AMWEN signal */ outw(0, devpriv->i_IobaseAddon + 4); - //Disable Bus Master ADD ON + /* Disable Bus Master ADD ON */ outw(APCI3120_ADD_ON_AGCSTS_LOW, devpriv->i_IobaseAddon + 0); outw(0, devpriv->i_IobaseAddon + 2); outw(APCI3120_ADD_ON_AGCSTS_HIGH, devpriv->i_IobaseAddon + 0); outw(0, devpriv->i_IobaseAddon + 2); - //Disable BUS Master PCI + /* Disable BUS Master PCI */ outl(0, devpriv->i_IobaseAmcc + AMCC_OP_REG_MCSR); - //outl(inl(devpriv->i_IobaseAmcc+AMCC_OP_REG_INTCSR)&(~AINT_WRITE_COMPL), devpriv->i_IobaseAmcc+AMCC_OP_REG_INTCSR); // stop amcc irqs - //outl(inl(devpriv->i_IobaseAmcc+AMCC_OP_REG_MCSR)&(~EN_A2P_TRANSFERS), devpriv->i_IobaseAmcc+AMCC_OP_REG_MCSR); // stop DMA + /* outl(inl(devpriv->i_IobaseAmcc+AMCC_OP_REG_INTCSR)&(~AINT_WRITE_COMPL), + * devpriv->i_IobaseAmcc+AMCC_OP_REG_INTCSR); stop amcc irqs */ - //Disable ext trigger + /* outl(inl(devpriv->i_IobaseAmcc+AMCC_OP_REG_MCSR)&(~EN_A2P_TRANSFERS), + * devpriv->i_IobaseAmcc+AMCC_OP_REG_MCSR); stop DMA */ + + /* Disable ext trigger */ i_APCI3120_ExttrigDisable(dev); devpriv->us_OutputRegister = 0; - //stop counters + /* stop counters */ outw(devpriv-> us_OutputRegister & APCI3120_DISABLE_TIMER0 & APCI3120_DISABLE_TIMER1, dev->iobase + APCI3120_WR_ADDRESS); outw(APCI3120_DISABLE_ALL_TIMER, dev->iobase + APCI3120_WR_ADDRESS); - //DISABLE_ALL_INTERRUPT + /* DISABLE_ALL_INTERRUPT */ outb(APCI3120_DISABLE_ALL_INTERRUPT, dev->iobase + APCI3120_WRITE_MODE_SELECT); - //Flush FIFO + /* Flush FIFO */ inb(dev->iobase + APCI3120_RESET_FIFO); inw(dev->iobase + APCI3120_RD_STATUS); devpriv->ui_AiActualScan = 0; @@ -480,9 +486,9 @@ int i_APCI3120_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ struct comedi_cmd * cmd) { int err = 0; - int tmp; // divisor1,divisor2; + int tmp; /* divisor1,divisor2; */ - // step 1: make sure trigger sources are trivially valid + /* step 1: make sure trigger sources are trivially valid */ tmp = cmd->start_src; cmd->start_src &= TRIG_NOW | TRIG_EXT; @@ -512,7 +518,7 @@ int i_APCI3120_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ if (err) return 1; - //step 2: make sure trigger sources are unique and mutually compatible + /* step 2: make sure trigger sources are unique and mutually compatible */ if (cmd->start_src != TRIG_NOW && cmd->start_src != TRIG_EXT) { err++; @@ -536,14 +542,14 @@ int i_APCI3120_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ if (err) return 2; - // step 3: make sure arguments are trivially compatible + /* step 3: make sure arguments are trivially compatible */ if (cmd->start_arg != 0) { cmd->start_arg = 0; err++; } - if (cmd->scan_begin_src == TRIG_TIMER) // Test Delay timing + if (cmd->scan_begin_src == TRIG_TIMER) /* Test Delay timing */ { if (cmd->scan_begin_arg < this_board->ui_MinDelaytimeNs) { cmd->scan_begin_arg = this_board->ui_MinDelaytimeNs; @@ -551,7 +557,7 @@ int i_APCI3120_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ } } - if (cmd->convert_src == TRIG_TIMER) // Test Acquisition timing + if (cmd->convert_src == TRIG_TIMER) /* Test Acquisition timing */ { if (cmd->scan_begin_src == TRIG_TIMER) { if ((cmd->convert_arg) @@ -585,7 +591,7 @@ int i_APCI3120_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ cmd->stop_arg = 1; err++; } - } else { // TRIG_NONE + } else { /* TRIG_NONE */ if (cmd->stop_arg != 0) { cmd->stop_arg = 0; err++; @@ -595,7 +601,7 @@ int i_APCI3120_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ if (err) return 3; - // step 4: fix up any arguments + /* step 4: fix up any arguments */ if (cmd->convert_src == TRIG_TIMER) { @@ -637,15 +643,15 @@ int i_APCI3120_CommandAnalogInput(struct comedi_device * dev, struct comedi_subd { struct comedi_cmd *cmd = &s->async->cmd; - //loading private structure with cmd structure inputs + /* 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; - //UPDATE-0.7.57->0.7.68devpriv->AiData=s->async->data; + /* 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; + /* 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) { @@ -654,11 +660,11 @@ int i_APCI3120_CommandAnalogInput(struct comedi_device * dev, struct comedi_subd devpriv->ui_AiNbrofScans = 0; } - devpriv->ui_AiTimer0 = 0; // variables changed to timer0,timer1 + devpriv->ui_AiTimer0 = 0; /* variables changed to timer0,timer1 */ devpriv->ui_AiTimer1 = 0; if ((devpriv->ui_AiNbrofScans == 0) || (devpriv->ui_AiNbrofScans == -1)) - devpriv->b_AiContinuous = 1; // user want neverending analog acquisition - // stopped using cancel + devpriv->b_AiContinuous = 1; /* user want neverending analog acquisition */ + /* stopped using cancel */ if (cmd->start_src == TRIG_EXT) devpriv->b_ExttrigEnable = APCI3120_ENABLE; @@ -666,22 +672,22 @@ int i_APCI3120_CommandAnalogInput(struct comedi_device * dev, struct comedi_subd devpriv->b_ExttrigEnable = APCI3120_DISABLE; if (cmd->scan_begin_src == TRIG_FOLLOW) { - // mode 1 or 3 + /* mode 1 or 3 */ if (cmd->convert_src == TRIG_TIMER) { - // mode 1 + /* mode 1 */ - devpriv->ui_AiTimer0 = cmd->convert_arg; // timer constant in nano seconds - //return this_board->i_hwdrv_CommandAnalogInput(1,dev,s); + devpriv->ui_AiTimer0 = cmd->convert_arg; /* timer constant in nano seconds */ + /* return this_board->i_hwdrv_CommandAnalogInput(1,dev,s); */ return i_APCI3120_CyclicAnalogInput(1, dev, s); } } if ((cmd->scan_begin_src == TRIG_TIMER) && (cmd->convert_src == TRIG_TIMER)) { - // mode 2 + /* mode 2 */ devpriv->ui_AiTimer1 = cmd->scan_begin_arg; - devpriv->ui_AiTimer0 = cmd->convert_arg; // variable changed timer2 to timer0 - //return this_board->i_hwdrv_CommandAnalogInput(2,dev,s); + devpriv->ui_AiTimer0 = cmd->convert_arg; /* variable changed timer2 to timer0 */ + /* return this_board->i_hwdrv_CommandAnalogInput(2,dev,s); */ return i_APCI3120_CyclicAnalogInput(2, dev, s); } return -1; @@ -710,70 +716,71 @@ int i_APCI3120_CommandAnalogInput(struct comedi_device * dev, struct comedi_subd int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, struct comedi_subdevice * s) { - BYTE b_Tmp; - UINT ui_Tmp, ui_DelayTiming = 0, ui_TimerValue1 = 0, dmalen0 = + unsigned char b_Tmp; + unsigned int ui_Tmp, ui_DelayTiming = 0, ui_TimerValue1 = 0, dmalen0 = 0, dmalen1 = 0, ui_TimerValue2 = 0, ui_TimerValue0, ui_ConvertTiming; - USHORT us_TmpValue; + unsigned short us_TmpValue; - //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 + /* 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 + /* 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 + /* 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 + /* END JK 07.05.04: Comparison between WIN32 and Linux driver */ - // clear software registers + /* clear software registers */ devpriv->b_TimerSelectMode = 0; devpriv->us_OutputRegister = 0; devpriv->b_ModeSelectRegister = 0; - //devpriv->b_DigitalOutputRegister=0; + /* devpriv->b_DigitalOutputRegister=0; */ - //COMMENT JK 07.05.04: Followings calls are in i_APCI3120_StartAnalogInputAcquisition + /* COMMENT JK 07.05.04: Followings calls are in i_APCI3120_StartAnalogInputAcquisition */ - /****************************/ - /* Clear Timer Write TC INT */ - /****************************/ + /****************************/ + /* 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 + /************************************/ - /**************************/ + /* 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 + /*******************/ + /* 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 + /* END JK 07.05.04: Comparison between WIN32 and Linux driver */ devpriv->ui_AiActualScan = 0; devpriv->ui_AiActualScanPosition = 0; @@ -781,7 +788,7 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, devpriv->ui_AiBufferPtr = 0; devpriv->ui_DmaActualBuffer = 0; - // value for timer2 minus -2 has to be done .....dunno y?? + /* value for timer2 minus -2 has to be done .....dunno y?? */ ui_TimerValue2 = devpriv->ui_AiNbrofScans - 2; ui_ConvertTiming = devpriv->ui_AiTimer0; @@ -795,31 +802,31 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, devpriv->pui_AiChannelList, 0)) return -EINVAL; - us_TmpValue = (USHORT) inw(dev->iobase + APCI3120_RD_STATUS); + us_TmpValue = (unsigned short) 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); - ui_TimerValue0=(UINT)f_ConvertValue; + ui_TimerValue0=(unsigned int)f_ConvertValue; if (mode==2) { f_DelayValue = (((float)ui_DelayTiming * 0.00002) - 2); - ui_TimerValue1 = (UINT) f_DelayValue; + ui_TimerValue1 = (unsigned int) f_DelayValue; } } else { f_ConvertValue=(((float)ui_ConvertTiming * 0.0012926) - 1); - ui_TimerValue0=(UINT)f_ConvertValue; + ui_TimerValue0=(unsigned int)f_ConvertValue; if (mode == 2) { f_DelayValue = (((float)ui_DelayTiming * 0.000012926) - 1); - ui_TimerValue1 = (UINT) f_DelayValue; + ui_TimerValue1 = (unsigned int) 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 + /* 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; @@ -844,79 +851,82 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, /*** EL241003 End ******************************************************************************/ if (devpriv->b_ExttrigEnable == APCI3120_ENABLE) { - i_APCI3120_ExttrigEnable(dev); // activate EXT trigger + i_APCI3120_ExttrigEnable(dev); /* activate EXT trigger */ } switch (mode) { case 1: - // init timer0 in mode 2 + /* init timer0 in mode 2 */ devpriv->b_TimerSelectMode = (devpriv-> b_TimerSelectMode & 0xFC) | APCI3120_TIMER_0_MODE_2; outb(devpriv->b_TimerSelectMode, dev->iobase + APCI3120_TIMER_CRT1); - //Select Timer 0 + /* Select Timer 0 */ 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), + /* Set the convertion time */ + outw(((unsigned short) ui_TimerValue0), dev->iobase + APCI3120_TIMER_VALUE); break; case 2: - // init timer1 in mode 2 + /* init timer1 in mode 2 */ devpriv->b_TimerSelectMode = (devpriv-> b_TimerSelectMode & 0xF3) | APCI3120_TIMER_1_MODE_2; outb(devpriv->b_TimerSelectMode, dev->iobase + APCI3120_TIMER_CRT1); - //Select Timer 1 + /* 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), + /* Set the convertion time */ + outw(((unsigned short) ui_TimerValue1), dev->iobase + APCI3120_TIMER_VALUE); - // init timer0 in mode 2 + /* init timer0 in mode 2 */ devpriv->b_TimerSelectMode = (devpriv-> b_TimerSelectMode & 0xFC) | APCI3120_TIMER_0_MODE_2; outb(devpriv->b_TimerSelectMode, dev->iobase + APCI3120_TIMER_CRT1); - //Select Timer 0 + /* Select Timer 0 */ 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), + /* Set the convertion time */ + outw(((unsigned short) ui_TimerValue0), dev->iobase + APCI3120_TIMER_VALUE); break; } - // ##########common for all modes################# + /* ##########common for all modes################# */ /***********************/ /* Clears the SCAN bit */ /***********************/ - //BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver - //devpriv->b_ModeSelectRegister=devpriv->b_ModeSelectRegister | APCI3120_DISABLE_SCAN; + + /* 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 + /* 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 + /* If DMA is disabled */ if (devpriv->us_UseDma == APCI3120_DISABLE) { - // disable EOC and enable EOS + /* disable EOC and enable EOS */ devpriv->b_InterruptMode = APCI3120_EOS_MODE; devpriv->b_EocEosInterrupt = APCI3120_ENABLE; @@ -928,15 +938,17 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, dev->iobase + APCI3120_WRITE_MODE_SELECT); if (!devpriv->b_AiContinuous) { - // configure Timer2 For counting EOS - //Reset gate 2 of Timer 2 to disable it (Set Bit D14 to 0) +/* + * configure Timer2 For counting EOS Reset gate 2 of Timer 2 to + * disable it (Set Bit D14 to 0) + */ devpriv->us_OutputRegister = devpriv-> us_OutputRegister & APCI3120_DISABLE_TIMER2; outw(devpriv->us_OutputRegister, dev->iobase + APCI3120_WR_ADDRESS); - // DISABLE TIMER INTERRUPT + /* DISABLE TIMER intERRUPT */ devpriv->b_ModeSelectRegister = devpriv-> b_ModeSelectRegister & @@ -944,7 +956,7 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, outb(devpriv->b_ModeSelectRegister, dev->iobase + APCI3120_WRITE_MODE_SELECT); - //(1) Init timer 2 in mode 0 and write timer value + /* (1) Init timer 2 in mode 0 and write timer value */ devpriv->b_TimerSelectMode = (devpriv-> b_TimerSelectMode & 0x0F) | @@ -952,7 +964,7 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, outb(devpriv->b_TimerSelectMode, dev->iobase + APCI3120_TIMER_CRT1); - //Writing LOW WORD + /* Writing LOW unsigned short */ b_Tmp = ((devpriv-> b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_LOW_WORD; @@ -960,7 +972,7 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, outw(LOWORD(ui_TimerValue2), dev->iobase + APCI3120_TIMER_VALUE); - //Writing HIGH WORD + /* Writing HIGH unsigned short */ b_Tmp = ((devpriv-> b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_HIGH_WORD; @@ -968,20 +980,20 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, outw(HIWORD(ui_TimerValue2), dev->iobase + APCI3120_TIMER_VALUE); - //(2) Reset FC_TIMER BIT Clearing timer status register + /* (2) Reset FC_TIMER BIT Clearing timer status register */ inb(dev->iobase + APCI3120_TIMER_STATUS_REGISTER); - // enable timer counter and disable watch dog + /* enable timer counter and disable watch dog */ devpriv->b_ModeSelectRegister = (devpriv-> b_ModeSelectRegister | APCI3120_ENABLE_TIMER_COUNTER) & APCI3120_DISABLE_WATCHDOG; - // select EOS clock input for timer 2 + /* select EOS clock input for timer 2 */ devpriv->b_ModeSelectRegister = devpriv-> b_ModeSelectRegister | APCI3120_TIMER2_SELECT_EOS; - // Enable timer2 interrupt + /* Enable timer2 interrupt */ devpriv->b_ModeSelectRegister = devpriv-> b_ModeSelectRegister | @@ -992,15 +1004,16 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, devpriv->b_Timer2Interrupt = APCI3120_ENABLE; } } else { - // If DMA Enabled - //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 + /* If DMA Enabled */ + + /* 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; @@ -1012,18 +1025,18 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, if (!devpriv->b_AiContinuous) { - if (dmalen0 > (devpriv->ui_AiNbrofScans * devpriv->ui_AiScanLength * 2)) { // must we fill full first buffer? + if (dmalen0 > (devpriv->ui_AiNbrofScans * devpriv->ui_AiScanLength * 2)) { /* must we fill full first buffer? */ dmalen0 = devpriv->ui_AiNbrofScans * devpriv->ui_AiScanLength * 2; - } else if (dmalen1 > (devpriv->ui_AiNbrofScans * devpriv->ui_AiScanLength * 2 - dmalen0)) // and must we fill full second buffer when first is once filled? + } else if (dmalen1 > (devpriv->ui_AiNbrofScans * devpriv->ui_AiScanLength * 2 - dmalen0)) /* and must we fill full second buffer when first is once filled? */ dmalen1 = devpriv->ui_AiNbrofScans * devpriv->ui_AiScanLength * 2 - dmalen0; } if (devpriv->ui_AiFlags & TRIG_WAKE_EOS) { - // don't we want wake up every scan? + /* don't we want wake up every scan? */ if (dmalen0 > (devpriv->ui_AiScanLength * 2)) { dmalen0 = devpriv->ui_AiScanLength * 2; if (devpriv->ui_AiScanLength & 1) @@ -1036,7 +1049,7 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, if (dmalen1 < 4) dmalen1 = 4; } - } else { // isn't output buff smaller that our DMA buff? + } else { /* isn't output buff smaller that our DMA buff? */ if (dmalen0 > (devpriv->ui_AiDataLength)) { dmalen0 = devpriv->ui_AiDataLength; } @@ -1047,14 +1060,16 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, devpriv->ui_DmaBufferUsesize[0] = dmalen0; devpriv->ui_DmaBufferUsesize[1] = dmalen1; - //Initialize DMA + /* Initialize DMA */ - // Set Transfer count enable bit and A2P_fifo reset bit in AGCSTS register - //1 +/* + * Set Transfer count enable bit and A2P_fifo reset bit in AGCSTS + * register 1 + */ ui_Tmp = AGCSTS_TC_ENABLE | AGCSTS_RESET_A2P_FIFO; outl(ui_Tmp, devpriv->i_IobaseAmcc + AMCC_OP_REG_AGCSTS); - // changed since 16 bit interface for add on + /* changed since 16 bit interface for add on */ /*********************/ /* ENABLE BUS MASTER */ /*********************/ @@ -1066,104 +1081,121 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, outw(APCI3120_ENABLE_TRANSFER_ADD_ON_HIGH, devpriv->i_IobaseAddon + 2); - // TO VERIFIED - //BEGIN JK 07.05.04: Comparison between WIN32 and Linux driver +/* + * 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 + /* END JK 07.05.04: Comparison between WIN32 and Linux driver */ - //2 No change - // A2P FIFO MANAGEMENT - // A2P fifo reset & transfer control enable - /***********************/ + /* 2 No change */ /* A2P FIFO MANAGEMENT */ - /***********************/ + /* 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 - //The 32 bit address of dma buffer is converted into two 16 bit addresses - // Can done by using _attach and put into into an array - // array used may be for differnet pages +/* + * 3 + * beginning address of dma buf The 32 bit address of dma buffer + * is converted into two 16 bit addresses Can done by using _attach + * and put into into an array array used may be for differnet pages + */ - // DMA Start Adress Low + /* DMA Start Adress Low */ outw(APCI3120_ADD_ON_MWAR_LOW, devpriv->i_IobaseAddon + 0); outw((devpriv->ul_DmaBufferHw[0] & 0xFFFF), devpriv->i_IobaseAddon + 2); - /*************************/ + /*************************/ /* DMA Start Adress High */ - /*************************/ + /*************************/ outw(APCI3120_ADD_ON_MWAR_HIGH, devpriv->i_IobaseAddon + 0); 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); - - /**************************/ +/* + * 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 */ - /**************************/ + /**************************/ outw(APCI3120_ADD_ON_MWTC_LOW, devpriv->i_IobaseAddon + 0); outw((devpriv->ui_DmaBufferUsesize[0] & 0xFFFF), devpriv->i_IobaseAddon + 2); - /***************************/ + /***************************/ /* Nbr of acquisition HIGH */ - /***************************/ + /***************************/ outw(APCI3120_ADD_ON_MWTC_HIGH, devpriv->i_IobaseAddon + 0); outw((devpriv->ui_DmaBufferUsesize[0] / 65536), devpriv->i_IobaseAddon + 2); - //5 - // To configure A2P FIFO - // testing outl( FIFO_ADVANCE_ON_BYTE_2,devpriv->i_IobaseAmcc+AMCC_OP_REG_INTCSR); +/* + * 5 + * 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 +/* + * 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 + /* 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 + */ - //6 - //ENABLE A2P FIFO WRITE AND ENABLE AMWEN - // AMWEN_ENABLE | A2P_FIFO_WRITE_ENABLE (0x01|0x02)=0x03 - //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 + /* 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) +/* + * 7 + * initialise end of dma interrupt AINT_WRITE_COMPL = + * ENABLE_WRITE_TC_INT(ADDI) + */ /***************************************************/ - /* A2P FIFO CONFIGURATE, END OF DMA INTERRUPT INIT */ + /* 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 + /* 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 + /* 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 + /* 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 + /* END JK 07.05.04: Comparison between WIN32 and Linux driver */ } if ((devpriv->us_UseDma == APCI3120_DISABLE) && !devpriv->b_AiContinuous) { - // set gate 2 to start conversion + /* set gate 2 to start conversion */ devpriv->us_OutputRegister = devpriv->us_OutputRegister | APCI3120_ENABLE_TIMER2; outw(devpriv->us_OutputRegister, @@ -1172,14 +1204,14 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, switch (mode) { case 1: - // set gate 0 to start conversion + /* set gate 0 to start conversion */ devpriv->us_OutputRegister = devpriv->us_OutputRegister | APCI3120_ENABLE_TIMER0; outw(devpriv->us_OutputRegister, dev->iobase + APCI3120_WR_ADDRESS); break; case 2: - // set gate 0 and gate 1 + /* set gate 0 and gate 1 */ devpriv->us_OutputRegister = devpriv->us_OutputRegister | APCI3120_ENABLE_TIMER1; devpriv->us_OutputRegister = @@ -1196,7 +1228,7 @@ int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device * dev, /* +----------------------------------------------------------------------------+ -| INTERNAL FUNCTIONS | +| intERNAL FUNCTIONS | +----------------------------------------------------------------------------+ */ @@ -1226,47 +1258,49 @@ int i_APCI3120_Reset(struct comedi_device * dev) devpriv->b_AiCyclicAcquisition = APCI3120_DISABLE; devpriv->b_EocEosInterrupt = APCI3120_DISABLE; devpriv->b_InterruptMode = APCI3120_EOC_MODE; - devpriv->ui_EocEosConversionTime = 0; // set eoc eos conv time to 0 + devpriv->ui_EocEosConversionTime = 0; /* set eoc eos conv time to 0 */ devpriv->b_OutputMemoryStatus = 0; - // variables used in timer subdevice + /* variables used in timer subdevice */ devpriv->b_Timer2Mode = 0; devpriv->b_Timer2Interrupt = 0; - devpriv->b_ExttrigEnable = 0; // Disable ext trigger + devpriv->b_ExttrigEnable = 0; /* Disable ext trigger */ /* Disable all interrupts, watchdog for the anolog output */ devpriv->b_ModeSelectRegister = 0; outb(devpriv->b_ModeSelectRegister, dev->iobase + APCI3120_WRITE_MODE_SELECT); - // Disables all counters, ext trigger and clears PA, PR + /* Disables all counters, ext trigger and clears PA, PR */ devpriv->us_OutputRegister = 0; outw(devpriv->us_OutputRegister, dev->iobase + APCI3120_WR_ADDRESS); - //Code to set the all anolog o/p channel to 0v - //8191 is decimal value for zero(0 v)volt in bipolar mode(default) - outw(8191 | APCI3120_ANALOG_OP_CHANNEL_1, dev->iobase + APCI3120_ANALOG_OUTPUT_1); //channel 1 - outw(8191 | APCI3120_ANALOG_OP_CHANNEL_2, dev->iobase + APCI3120_ANALOG_OUTPUT_1); //channel 2 - outw(8191 | APCI3120_ANALOG_OP_CHANNEL_3, dev->iobase + APCI3120_ANALOG_OUTPUT_1); //channel 3 - outw(8191 | APCI3120_ANALOG_OP_CHANNEL_4, dev->iobase + APCI3120_ANALOG_OUTPUT_1); //channel 4 - - outw(8191 | APCI3120_ANALOG_OP_CHANNEL_5, dev->iobase + APCI3120_ANALOG_OUTPUT_2); //channel 5 - outw(8191 | APCI3120_ANALOG_OP_CHANNEL_6, dev->iobase + APCI3120_ANALOG_OUTPUT_2); //channel 6 - outw(8191 | APCI3120_ANALOG_OP_CHANNEL_7, dev->iobase + APCI3120_ANALOG_OUTPUT_2); //channel 7 - outw(8191 | APCI3120_ANALOG_OP_CHANNEL_8, dev->iobase + APCI3120_ANALOG_OUTPUT_2); //channel 8 - - // Reset digital output to L0W - -//ES05 outb(0x0,dev->iobase+APCI3120_DIGITAL_OUTPUT); +/* + * Code to set the all anolog o/p channel to 0v 8191 is decimal + * value for zero(0 v)volt in bipolar mode(default) + */ + outw(8191 | APCI3120_ANALOG_OP_CHANNEL_1, dev->iobase + APCI3120_ANALOG_OUTPUT_1); /* channel 1 */ + outw(8191 | APCI3120_ANALOG_OP_CHANNEL_2, dev->iobase + APCI3120_ANALOG_OUTPUT_1); /* channel 2 */ + outw(8191 | APCI3120_ANALOG_OP_CHANNEL_3, dev->iobase + APCI3120_ANALOG_OUTPUT_1); /* channel 3 */ + outw(8191 | APCI3120_ANALOG_OP_CHANNEL_4, dev->iobase + APCI3120_ANALOG_OUTPUT_1); /* channel 4 */ + + outw(8191 | APCI3120_ANALOG_OP_CHANNEL_5, dev->iobase + APCI3120_ANALOG_OUTPUT_2); /* channel 5 */ + outw(8191 | APCI3120_ANALOG_OP_CHANNEL_6, dev->iobase + APCI3120_ANALOG_OUTPUT_2); /* channel 6 */ + outw(8191 | APCI3120_ANALOG_OP_CHANNEL_7, dev->iobase + APCI3120_ANALOG_OUTPUT_2); /* channel 7 */ + outw(8191 | APCI3120_ANALOG_OP_CHANNEL_8, dev->iobase + APCI3120_ANALOG_OUTPUT_2); /* channel 8 */ + + /* Reset digital output to L0W */ + +/* ES05 outb(0x0,dev->iobase+APCI3120_DIGITAL_OUTPUT); */ udelay(10); - inw(dev->iobase + 0); //make a dummy read - inb(dev->iobase + APCI3120_RESET_FIFO); // flush FIFO - inw(dev->iobase + APCI3120_RD_STATUS); // flush A/D status register + inw(dev->iobase + 0); /* make a dummy read */ + inb(dev->iobase + APCI3120_RESET_FIFO); /* flush FIFO */ + inw(dev->iobase + APCI3120_RD_STATUS); /* flush A/D status register */ - //code to reset the RAM sequence + /* code to reset the RAM sequence */ for (i = 0; i < 16; i++) { - us_TmpValue = i << 8; //select the location + us_TmpValue = i << 8; /* select the location */ outw(us_TmpValue, dev->iobase + APCI3120_SEQ_RAM_ADDRESS); } return 0; @@ -1299,7 +1333,7 @@ int i_APCI3120_Reset(struct comedi_device * dev) int i_APCI3120_SetupChannelList(struct comedi_device * dev, struct 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; @@ -1309,29 +1343,29 @@ int i_APCI3120_SetupChannelList(struct comedi_device * dev, struct comedi_subdev comedi_error(dev, "range/channel list is empty!"); return 0; } - // All is ok, so we can setup channel/range list + /* All is ok, so we can setup channel/range list */ if (check) return 1; - //Code to set the PA and PR...Here it set PA to 0.. + /* Code to set the PA and PR...Here it set PA to 0.. */ devpriv->us_OutputRegister = devpriv->us_OutputRegister & APCI3120_CLEAR_PA_PR; devpriv->us_OutputRegister = ((n_chan - 1) & 0xf) << 8; outw(devpriv->us_OutputRegister, dev->iobase + APCI3120_WR_ADDRESS); for (i = 0; i < n_chan; i++) { - // store range list to card - us_TmpValue = CR_CHAN(chanlist[i]); // get channel number; + /* store range list to card */ + us_TmpValue = CR_CHAN(chanlist[i]); /* get channel number; */ if (CR_RANGE(chanlist[i]) < APCI3120_BIPOLAR_RANGES) { - us_TmpValue &= ((~APCI3120_UNIPOLAR) & 0xff); // set bipolar + us_TmpValue &= ((~APCI3120_UNIPOLAR) & 0xff); /* set bipolar */ } else { - us_TmpValue |= APCI3120_UNIPOLAR; // enable unipolar...... + us_TmpValue |= APCI3120_UNIPOLAR; /* enable unipolar...... */ } - 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.... + 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.... */ outw(us_TmpValue, dev->iobase + APCI3120_SEQ_RAM_ADDRESS); printk("\n Gain = %i", @@ -1339,7 +1373,7 @@ int i_APCI3120_SetupChannelList(struct comedi_device * dev, struct comedi_subdev 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 + return 1; /* we can serve this with scan logic */ } /* @@ -1394,7 +1428,7 @@ int i_APCI3120_ExttrigDisable(struct comedi_device * dev) /* +----------------------------------------------------------------------------+ -| INTERRUPT FUNCTIONS | +| intERRUPT FUNCTIONS | +----------------------------------------------------------------------------+ */ @@ -1422,33 +1456,33 @@ int i_APCI3120_ExttrigDisable(struct comedi_device * dev) void v_APCI3120_Interrupt(int irq, void *d) { struct comedi_device *dev = d; - USHORT int_daq; + unsigned short int_daq; unsigned int int_amcc, ui_Check, i; - USHORT us_TmpValue; - BYTE b_DummyRead; + unsigned short us_TmpValue; + unsigned char b_DummyRead; struct 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 + 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 */ if ((!int_daq) && (!(int_amcc & ANY_S593X_INT))) { comedi_error(dev, "IRQ from unknow source"); return; } - outl(int_amcc | 0x00ff0000, devpriv->i_IobaseAmcc + AMCC_OP_REG_INTCSR); // shutdown IRQ reasons in AMCC + outl(int_amcc | 0x00ff0000, devpriv->i_IobaseAmcc + AMCC_OP_REG_INTCSR); /* shutdown IRQ reasons in AMCC */ int_daq = (int_daq >> 12) & 0xF; if (devpriv->b_ExttrigEnable == APCI3120_ENABLE) { - //Disable ext trigger + /* Disable ext trigger */ i_APCI3120_ExttrigDisable(dev); devpriv->b_ExttrigEnable = APCI3120_DISABLE; } - //clear the timer 2 interrupt + /* clear the timer 2 interrupt */ inb(devpriv->i_IobaseAmcc + APCI3120_TIMER_STATUS_REGISTER); if (int_amcc & MASTER_ABORT_INT) @@ -1456,19 +1490,19 @@ void v_APCI3120_Interrupt(int irq, void *d) if (int_amcc & TARGET_ABORT_INT) comedi_error(dev, "AMCC IRQ - TARGET DMA ABORT!"); - // Ckeck if EOC interrupt + /* Ckeck if EOC interrupt */ if (((int_daq & 0x8) == 0) && (devpriv->b_InterruptMode == APCI3120_EOC_MODE)) { if (devpriv->b_EocEosInterrupt == APCI3120_ENABLE) { - // Read the AI Value + /* Read the AI Value */ devpriv->ui_AiReadData[0] = - (UINT) inw(devpriv->iobase + 0); + (unsigned int) inw(devpriv->iobase + 0); devpriv->b_EocEosInterrupt = APCI3120_DISABLE; - send_sig(SIGIO, devpriv->tsk_Current, 0); // send signal to the sample + send_sig(SIGIO, devpriv->tsk_Current, 0); /* send signal to the sample */ } else { - //Disable EOC Interrupt + /* Disable EOC Interrupt */ devpriv->b_ModeSelectRegister = devpriv-> b_ModeSelectRegister & APCI3120_DISABLE_EOC_INT; @@ -1478,10 +1512,10 @@ void v_APCI3120_Interrupt(int irq, void *d) } } - // Check If EOS interrupt + /* Check If EOS interrupt */ if ((int_daq & 0x2) && (devpriv->b_InterruptMode == APCI3120_EOS_MODE)) { - if (devpriv->b_EocEosInterrupt == APCI3120_ENABLE) // enable this in without DMA ??? + if (devpriv->b_EocEosInterrupt == APCI3120_ENABLE) /* enable this in without DMA ??? */ { if (devpriv->b_AiCyclicAcquisition == APCI3120_ENABLE) { @@ -1501,12 +1535,12 @@ void v_APCI3120_Interrupt(int irq, void *d) i++) { us_TmpValue = inw(devpriv->iobase + 0); devpriv->ui_AiReadData[i] = - (UINT) us_TmpValue; + (unsigned int) us_TmpValue; } devpriv->b_EocEosInterrupt = APCI3120_DISABLE; devpriv->b_InterruptMode = APCI3120_EOC_MODE; - send_sig(SIGIO, devpriv->tsk_Current, 0); // send signal to the sample + send_sig(SIGIO, devpriv->tsk_Current, 0); /* send signal to the sample */ } @@ -1516,12 +1550,12 @@ void v_APCI3120_Interrupt(int irq, void *d) b_ModeSelectRegister & APCI3120_DISABLE_EOS_INT; outb(devpriv->b_ModeSelectRegister, dev->iobase + APCI3120_WRITE_MODE_SELECT); - devpriv->b_EocEosInterrupt = APCI3120_DISABLE; //Default settings + devpriv->b_EocEosInterrupt = APCI3120_DISABLE; /* Default settings */ devpriv->b_InterruptMode = APCI3120_EOC_MODE; } } - //Timer2 interrupt + /* Timer2 interrupt */ if (int_daq & 0x1) { switch (devpriv->b_Timer2Mode) { @@ -1534,18 +1568,18 @@ void v_APCI3120_Interrupt(int irq, void *d) outb(devpriv->b_ModeSelectRegister, dev->iobase + APCI3120_WRITE_MODE_SELECT); - // stop timer 2 + /* stop timer 2 */ devpriv->us_OutputRegister = devpriv-> us_OutputRegister & APCI3120_DISABLE_ALL_TIMER; outw(devpriv->us_OutputRegister, dev->iobase + APCI3120_WR_ADDRESS); - //stop timer 0 and timer 1 + /* stop timer 0 and timer 1 */ i_APCI3120_StopCyclicAcquisition(dev, s); devpriv->b_AiCyclicAcquisition = APCI3120_DISABLE; - //UPDATE-0.7.57->0.7.68comedi_done(dev,s); + /* UPDATE-0.7.57->0.7.68comedi_done(dev,s); */ s->async->events |= COMEDI_CB_EOA; comedi_event(dev, s); @@ -1553,19 +1587,19 @@ void v_APCI3120_Interrupt(int irq, void *d) case APCI3120_TIMER: - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); break; case APCI3120_WATCHDOG: - //Send a signal to from kernel to user space + /* Send a signal to from kernel to user space */ send_sig(SIGIO, devpriv->tsk_Current, 0); break; default: - // disable Timer Interrupt + /* disable Timer Interrupt */ devpriv->b_ModeSelectRegister = devpriv-> @@ -1585,7 +1619,7 @@ void v_APCI3120_Interrupt(int irq, void *d) if (devpriv->b_AiCyclicAcquisition == APCI3120_ENABLE) { /****************************/ - /* Clear Timer Write TC INT */ + /* Clear Timer Write TC int */ /****************************/ outl(APCI3120_CLEAR_WRITE_TC_INT, @@ -1596,7 +1630,7 @@ void v_APCI3120_Interrupt(int irq, void *d) /* Clears the timer status register */ /************************************/ inw(dev->iobase + APCI3120_TIMER_STATUS_REGISTER); - v_APCI3120_InterruptDma(irq, d); // do some data transfer + v_APCI3120_InterruptDma(irq, d); /* do some data transfer */ } else { /* Stops the Timer */ outw(devpriv-> @@ -1630,31 +1664,7 @@ void v_APCI3120_Interrupt(int irq, void *d) +----------------------------------------------------------------------------+ */ -/* - * int i_APCI3120_InterruptHandleEos(struct comedi_device *dev) -{ - int n_chan,i; - short *data; - struct comedi_subdevice *s=dev->subdevices+0; - struct comedi_async *async = s->async; - data=async->data+async->buf_int_ptr; - n_chan=devpriv->ui_AiNbrofChannels; - - for(i=0;i<n_chan;i++) - { - data[i]=inw(dev->iobase+0); - } - async->buf_int_count+=n_chan*sizeof(short); - async->buf_int_ptr+=n_chan*sizeof(short); - 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); - } - return 0; -}*/ + int i_APCI3120_InterruptHandleEos(struct comedi_device * dev) { int n_chan, i; @@ -1704,7 +1714,7 @@ void v_APCI3120_InterruptDma(int irq, void *d) unsigned int next_dma_buf, samplesinbuf; unsigned long low_word, high_word, var; - UINT ui_Tmp; + unsigned int ui_Tmp; samplesinbuf = devpriv->ui_DmaBufferUsesize[devpriv->ui_DmaActualBuffer] - inl(devpriv->i_IobaseAmcc + AMCC_OP_REG_MWTC); @@ -1720,20 +1730,20 @@ void v_APCI3120_InterruptDma(int irq, void *d) return; } - samplesinbuf = samplesinbuf >> 1; // number of received samples + samplesinbuf = samplesinbuf >> 1; /* number of received samples */ if (devpriv->b_DmaDoubleBuffer) { - // switch DMA buffers if is used double buffering + /* 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 + /* 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 + outw(APCI3120_ENABLE_TRANSFER_ADD_ON_HIGH, devpriv->i_IobaseAddon + 2); /* 0x1000 is out putted in windows driver */ var = devpriv->ul_DmaBufferHw[next_dma_buf]; low_word = var & 0xffff; @@ -1761,54 +1771,18 @@ void v_APCI3120_InterruptDma(int irq, void *d) 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 +/* + * To configure A2P FIFO + * ENABLE A2P FIFO WRITE AND ENABLE AMWEN + * AMWEN_ENABLE | A2P_FIFO_WRITE_ENABLE (0x01|0x02)=0x03 + */ outw(3, devpriv->i_IobaseAddon + 4); - //initialise end of dma interrupt AINT_WRITE_COMPL = ENABLE_WRITE_TC_INT(ADDI) + /* 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); } -/*UPDATE-0.7.57->0.7.68 - ptr=(short *)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(short)>=devpriv->ui_AiDataLength) - { - m=(devpriv->ui_AiDataLength-s->async->buf_int_ptr)/sizeof(short); - v_APCI3120_InterruptDmaMoveBlock16bit(dev,s,(void *)ptr,((void *)(devpriv->AiData))+s->async->buf_int_ptr,m); - s->async->buf_int_count+=m*sizeof(short); - ptr+=m*sizeof(short); - samplesinbuf-=m; - s->async->buf_int_ptr=0; - comedi_eobuf(dev,s); - } - - if (samplesinbuf) - { - v_APCI3120_InterruptDmaMoveBlock16bit(dev,s,(void *)ptr,((void *)(devpriv->AiData))+s->async->buf_int_ptr,samplesinbuf); - - s->async->buf_int_count+=samplesinbuf*sizeof(short); - s->async->buf_int_ptr+=samplesinbuf*sizeof(short); - if (!(devpriv->ui_AiFlags & TRIG_WAKE_EOS)) - { - comedi_bufcheck(dev,s); - } - } - if (!devpriv->b_AiContinuous) - if ( devpriv->ui_AiActualScan>=devpriv->ui_AiNbrofScans ) - { - // all data sampled - i_APCI3120_StopCyclicAcquisition(dev,s); - devpriv->b_AiCyclicAcquisition=APCI3120_DISABLE; - //DPRINTK("\n Single DMA completed..\n"); - comedi_done(dev,s); - return; - } -*/ if (samplesinbuf) { v_APCI3120_InterruptDmaMoveBlock16bit(dev, s, devpriv->ul_DmaBufferVirtual[devpriv-> @@ -1821,7 +1795,7 @@ void v_APCI3120_InterruptDma(int irq, void *d) } if (!devpriv->b_AiContinuous) if (devpriv->ui_AiActualScan >= devpriv->ui_AiNbrofScans) { - // all data sampled + /* all data sampled */ i_APCI3120_StopCyclicAcquisition(dev, s); devpriv->b_AiCyclicAcquisition = APCI3120_DISABLE; s->async->events |= COMEDI_CB_EOA; @@ -1829,22 +1803,26 @@ void v_APCI3120_InterruptDma(int irq, void *d) return; } - if (devpriv->b_DmaDoubleBuffer) { // switch dma buffers + if (devpriv->b_DmaDoubleBuffer) { /* switch dma buffers */ devpriv->ui_DmaActualBuffer = 1 - devpriv->ui_DmaActualBuffer; } else { - // restart DMA if is not used double buffering - //ADDED REINITIALISE THE DMA +/* + * restart DMA if is not used double buffering + * ADDED REINITIALISE THE DMA + */ 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 + /* 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); // - // A2P FIFO MANAGEMENT - // A2P fifo reset & transfer control enable + outw(APCI3120_ENABLE_TRANSFER_ADD_ON_HIGH, devpriv->i_IobaseAddon + 2); /* */ +/* + * A2P FIFO MANAGEMENT + * A2P fifo reset & transfer control enable + */ outl(APCI3120_A2P_FIFO_MANAGEMENT, devpriv->i_IobaseAmcc + AMCC_OP_REG_MCSR); @@ -1858,7 +1836,7 @@ void v_APCI3120_InterruptDma(int irq, void *d) outw(high_word, devpriv->i_IobaseAddon + 2); var = devpriv->ui_DmaBufferUsesize[0]; - low_word = var & 0xffff; //changed + low_word = var & 0xffff; /* changed */ var = devpriv->ui_DmaBufferUsesize[0]; high_word = var / 65536; outw(APCI3120_ADD_ON_MWTC_LOW, devpriv->i_IobaseAddon + 0); @@ -1866,11 +1844,13 @@ void v_APCI3120_InterruptDma(int irq, void *d) 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 +/* + * To configure A2P FIFO + * ENABLE A2P FIFO WRITE AND ENABLE AMWEN + * AMWEN_ENABLE | A2P_FIFO_WRITE_ENABLE (0x01|0x02)=0x03 + */ outw(3, devpriv->i_IobaseAddon + 4); - //initialise end of dma interrupt AINT_WRITE_COMPL = ENABLE_WRITE_TC_INT(ADDI) + /* 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); @@ -1897,35 +1877,6 @@ void v_APCI3120_InterruptDma(int irq, void *d) +----------------------------------------------------------------------------+ */ -/*void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev,struct comedi_subdevice *s,short *dma,short *data,int n) -{ - int i,j,m; - - j=s->async->cur_chan; - m=devpriv->ui_AiActualScanPosition; - for(i=0;i<n;i++) - { - *data=*dma; - data++; dma++; - j++; - if(j>=devpriv->ui_AiNbrofChannels) - { - m+=j; - j=0; - if(m>=devpriv->ui_AiScanLength) - { - m=0; - devpriv->ui_AiActualScan++; - if (devpriv->ui_AiFlags & TRIG_WAKE_EOS) -;//UPDATE-0.7.57->0.7.68 comedi_eos(dev,s); - } - } - } - devpriv->ui_AiActualScanPosition=m; - s->async->cur_chan=j; - -} -*/ void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device * dev, struct comedi_subdevice * s, short * dma_buffer, unsigned int num_samples) { @@ -1972,67 +1923,73 @@ int i_APCI3120_InsnConfigTimer(struct comedi_device * dev, struct comedi_subdevi struct comedi_insn * insn, unsigned int * data) { - UINT ui_Timervalue2; - USHORT us_TmpValue; - BYTE b_Tmp; + unsigned int ui_Timervalue2; + unsigned short us_TmpValue; + unsigned char b_Tmp; if (!data[1]) comedi_error(dev, "config:No timer constant !"); - devpriv->b_Timer2Interrupt = (BYTE) data[2]; // save info whether to enable or disable interrupt + devpriv->b_Timer2Interrupt = (unsigned char) data[2]; /* save info whether to enable or disable interrupt */ - ui_Timervalue2 = data[1] / 1000; // convert nano seconds to u seconds + ui_Timervalue2 = data[1] / 1000; /* convert nano seconds to u seconds */ - //this_board->i_hwdrv_InsnConfigTimer(dev, ui_Timervalue2,(BYTE)data[0]); - us_TmpValue = (USHORT) inw(devpriv->iobase + APCI3120_RD_STATUS); + /* this_board->i_hwdrv_InsnConfigTimer(dev, ui_Timervalue2,(unsigned char)data[0]); */ + us_TmpValue = (unsigned short) inw(devpriv->iobase + APCI3120_RD_STATUS); - //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 +/* + * 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 + /* Calculate the time value to set in the timer */ ui_Timervalue2 = ui_Timervalue2 / 50; } else { - //Calculate the time value to set in the timer + /* Calculate the time value to set in the timer */ ui_Timervalue2 = ui_Timervalue2 / 70; } - //Reset gate 2 of Timer 2 to disable it (Set Bit D14 to 0) + /* Reset gate 2 of Timer 2 to disable it (Set Bit D14 to 0) */ devpriv->us_OutputRegister = devpriv->us_OutputRegister & APCI3120_DISABLE_TIMER2; outw(devpriv->us_OutputRegister, devpriv->iobase + APCI3120_WR_ADDRESS); - // Disable TIMER Interrupt + /* Disable TIMER Interrupt */ devpriv->b_ModeSelectRegister = devpriv-> b_ModeSelectRegister & APCI3120_DISABLE_TIMER_INT & 0xEF; - // Disable Eoc and Eos Interrupts + /* Disable Eoc and Eos Interrupts */ devpriv->b_ModeSelectRegister = devpriv-> b_ModeSelectRegister & APCI3120_DISABLE_EOC_INT & APCI3120_DISABLE_EOS_INT; outb(devpriv->b_ModeSelectRegister, devpriv->iobase + APCI3120_WRITE_MODE_SELECT); - if (data[0] == APCI3120_TIMER) //initialize timer + if (data[0] == APCI3120_TIMER) /* initialize timer */ { + /* devpriv->b_ModeSelectRegister=devpriv->b_ModeSelectRegister | + * APCI3120_ENABLE_TIMER_INT; */ - //devpriv->b_ModeSelectRegister=devpriv->b_ModeSelectRegister| APCI3120_ENABLE_TIMER_INT ; - //outb(devpriv->b_ModeSelectRegister,devpriv->iobase+APCI3120_WRITE_MODE_SELECT); + /* outb(devpriv->b_ModeSelectRegister,devpriv->iobase+APCI3120_WRITE_MODE_SELECT); */ - //Set the Timer 2 in mode 2(Timer) + /* Set the Timer 2 in mode 2(Timer) */ devpriv->b_TimerSelectMode = (devpriv-> b_TimerSelectMode & 0x0F) | APCI3120_TIMER_2_MODE_2; outb(devpriv->b_TimerSelectMode, devpriv->iobase + APCI3120_TIMER_CRT1); - //Configure the timer 2 for writing the LOW WORD of timer is Delay value - //You must make a b_tmp variable with DigitalOutPutRegister because at Address_1+APCI3120_TIMER_CRT0 - //you can set the digital output and configure the timer 2,and if you don't make this, digital output - //are erase (Set to 0) - - //Writing LOW WORD +/* + * Configure the timer 2 for writing the LOW unsigned short of timer + * is Delay value You must make a b_tmp variable with + * DigitalOutPutRegister because at Address_1+APCI3120_TIMER_CRT0 + * you can set the digital output and configure the timer 2,and if + * you don't make this, digital output are erase (Set to 0) + */ + + /* Writing LOW unsigned short */ b_Tmp = ((devpriv-> b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_LOW_WORD; @@ -2040,20 +1997,20 @@ int i_APCI3120_InsnConfigTimer(struct comedi_device * dev, struct comedi_subdevi outw(LOWORD(ui_Timervalue2), devpriv->iobase + APCI3120_TIMER_VALUE); - //Writing HIGH WORD + /* Writing HIGH unsigned short */ 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 + /* timer2 in Timer mode enabled */ devpriv->b_Timer2Mode = APCI3120_TIMER; - } else // Initialize Watch dog + } else /* Initialize Watch dog */ { - //Set the Timer 2 in mode 5(Watchdog) + /* Set the Timer 2 in mode 5(Watchdog) */ devpriv->b_TimerSelectMode = (devpriv-> @@ -2061,12 +2018,15 @@ int i_APCI3120_InsnConfigTimer(struct comedi_device * dev, struct comedi_subdevi outb(devpriv->b_TimerSelectMode, devpriv->iobase + APCI3120_TIMER_CRT1); - //Configure the timer 2 for writing the LOW WORD of timer is Delay value - //You must make a b_tmp variable with DigitalOutPutRegister because at Address_1+APCI3120_TIMER_CRT0 - //you can set the digital output and configure the timer 2,and if you don't make this, digital output - //are erase (Set to 0) - - //Writing LOW WORD +/* + * Configure the timer 2 for writing the LOW unsigned short of timer + * is Delay value You must make a b_tmp variable with + * DigitalOutPutRegister because at Address_1+APCI3120_TIMER_CRT0 + * you can set the digital output and configure the timer 2,and if + * you don't make this, digital output are erase (Set to 0) + */ + + /* Writing LOW unsigned short */ b_Tmp = ((devpriv-> b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_LOW_WORD; @@ -2074,7 +2034,7 @@ int i_APCI3120_InsnConfigTimer(struct comedi_device * dev, struct comedi_subdevi outw(LOWORD(ui_Timervalue2), devpriv->iobase + APCI3120_TIMER_VALUE); - //Writing HIGH WORD + /* Writing HIGH unsigned short */ b_Tmp = ((devpriv-> b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_HIGH_WORD; @@ -2082,7 +2042,7 @@ int i_APCI3120_InsnConfigTimer(struct comedi_device * dev, struct comedi_subdevi outw(HIWORD(ui_Timervalue2), devpriv->iobase + APCI3120_TIMER_VALUE); - //watchdog enabled + /* watchdog enabled */ devpriv->b_Timer2Mode = APCI3120_WATCHDOG; } @@ -2123,9 +2083,9 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device * dev, struct comedi_subdevic struct comedi_insn * insn, unsigned int * data) { - UINT ui_Timervalue2 = 0; - USHORT us_TmpValue; - BYTE b_Tmp; + unsigned int ui_Timervalue2 = 0; + unsigned short us_TmpValue; + unsigned char b_Tmp; if ((devpriv->b_Timer2Mode != APCI3120_WATCHDOG) && (devpriv->b_Timer2Mode != APCI3120_TIMER)) { @@ -2133,7 +2093,7 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device * dev, struct comedi_subdevic return -EINVAL; } - if (data[0] == 2) // write new value + if (data[0] == 2) /* write new value */ { if (devpriv->b_Timer2Mode != APCI3120_TIMER) { comedi_error(dev, @@ -2147,35 +2107,35 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device * dev, struct comedi_subdevic ui_Timervalue2 = 0; } - //this_board->i_hwdrv_InsnWriteTimer(dev,data[0],ui_Timervalue2); + /* this_board->i_hwdrv_InsnWriteTimer(dev,data[0],ui_Timervalue2); */ switch (data[0]) { case APCI3120_START: - // Reset FC_TIMER BIT + /* Reset FC_TIMER BIT */ inb(devpriv->iobase + APCI3120_TIMER_STATUS_REGISTER); - if (devpriv->b_Timer2Mode == APCI3120_TIMER) //start timer + if (devpriv->b_Timer2Mode == APCI3120_TIMER) /* start timer */ { - //Enable Timer + /* Enable Timer */ devpriv->b_ModeSelectRegister = devpriv->b_ModeSelectRegister & 0x0B; - } else //start watch dog + } else /* start watch dog */ { - //Enable WatchDog + /* Enable WatchDog */ devpriv->b_ModeSelectRegister = (devpriv-> b_ModeSelectRegister & 0x0B) | APCI3120_ENABLE_WATCHDOG; } - //enable disable interrupt + /* enable disable interrupt */ if ((devpriv->b_Timer2Interrupt) == APCI3120_ENABLE) { devpriv->b_ModeSelectRegister = devpriv-> b_ModeSelectRegister | APCI3120_ENABLE_TIMER_INT; - // save the task structure to pass info to user + /* save the task structure to pass info to user */ devpriv->tsk_Current = current; } else { @@ -2187,9 +2147,9 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device * dev, struct comedi_subdevic outb(devpriv->b_ModeSelectRegister, devpriv->iobase + APCI3120_WRITE_MODE_SELECT); - if (devpriv->b_Timer2Mode == APCI3120_TIMER) //start timer + if (devpriv->b_Timer2Mode == APCI3120_TIMER) /* start timer */ { - //For Timer mode is Gate2 must be activated **timer started + /* For Timer mode is Gate2 must be activated **timer started */ devpriv->us_OutputRegister = devpriv-> us_OutputRegister | APCI3120_ENABLE_TIMER2; @@ -2201,62 +2161,64 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device * dev, struct comedi_subdevic case APCI3120_STOP: if (devpriv->b_Timer2Mode == APCI3120_TIMER) { - //Disable timer + /* Disable timer */ devpriv->b_ModeSelectRegister = devpriv-> b_ModeSelectRegister & APCI3120_DISABLE_TIMER_COUNTER; } else { - //Disable WatchDog + /* Disable WatchDog */ devpriv->b_ModeSelectRegister = devpriv-> b_ModeSelectRegister & APCI3120_DISABLE_WATCHDOG; } - // Disable timer interrupt + /* Disable timer interrupt */ devpriv->b_ModeSelectRegister = devpriv-> b_ModeSelectRegister & APCI3120_DISABLE_TIMER_INT; - // Write above states to register + /* Write above states to register */ outb(devpriv->b_ModeSelectRegister, devpriv->iobase + APCI3120_WRITE_MODE_SELECT); - // Reset Gate 2 + /* Reset Gate 2 */ devpriv->us_OutputRegister = devpriv->us_OutputRegister & APCI3120_DISABLE_TIMER_INT; outw(devpriv->us_OutputRegister, devpriv->iobase + APCI3120_WR_ADDRESS); - // Reset FC_TIMER BIT + /* Reset FC_TIMER BIT */ inb(devpriv->iobase + APCI3120_TIMER_STATUS_REGISTER); - // Disable timer - //devpriv->b_Timer2Mode=APCI3120_DISABLE; + /* Disable timer */ + /* devpriv->b_Timer2Mode=APCI3120_DISABLE; */ break; - case 2: //write new value to Timer + case 2: /* write new value to Timer */ if (devpriv->b_Timer2Mode != APCI3120_TIMER) { comedi_error(dev, "write :timer2 not configured in TIMER MODE"); return -EINVAL; } - // ui_Timervalue2=data[1]; // passed as argument + /* ui_Timervalue2=data[1]; // passed as argument */ us_TmpValue = - (USHORT) inw(devpriv->iobase + APCI3120_RD_STATUS); + (unsigned short) inw(devpriv->iobase + APCI3120_RD_STATUS); - //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 +/* + * 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 + /* Calculate the time value to set in the timer */ ui_Timervalue2 = ui_Timervalue2 / 50; } else { - //Calculate the time value to set in the timer + /* Calculate the time value to set in the timer */ ui_Timervalue2 = ui_Timervalue2 / 70; } - //Writing LOW WORD + /* Writing LOW unsigned short */ b_Tmp = ((devpriv-> b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_LOW_WORD; @@ -2265,7 +2227,7 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device * dev, struct comedi_subdevic outw(LOWORD(ui_Timervalue2), devpriv->iobase + APCI3120_TIMER_VALUE); - //Writing HIGH WORD + /* Writing HIGH unsigned short */ b_Tmp = ((devpriv-> b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_HIGH_WORD; @@ -2276,7 +2238,7 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device * dev, struct comedi_subdevic break; default: - return -EINVAL; // Not a valid input + return -EINVAL; /* Not a valid input */ } return insn->n; @@ -2308,18 +2270,18 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device * dev, struct comedi_subdevic int i_APCI3120_InsnReadTimer(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - BYTE b_Tmp; - USHORT us_TmpValue, us_TmpValue_2, us_StatusValue; + unsigned char b_Tmp; + unsigned short 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 "); } - //this_board->i_hwdrv_InsnReadTimer(dev,data); + /* this_board->i_hwdrv_InsnReadTimer(dev,data); */ if (devpriv->b_Timer2Mode == APCI3120_TIMER) { - //Read the LOW WORD of Timer 2 register + /* Read the LOW unsigned short of Timer 2 register */ b_Tmp = ((devpriv-> b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_LOW_WORD; @@ -2327,7 +2289,7 @@ int i_APCI3120_InsnReadTimer(struct comedi_device * dev, struct comedi_subdevice us_TmpValue = inw(devpriv->iobase + APCI3120_TIMER_VALUE); - //Read the HIGH WORD of Timer 2 register + /* Read the HIGH unsigned short of Timer 2 register */ b_Tmp = ((devpriv-> b_DigitalOutputRegister) & 0xF0) | APCI3120_SELECT_TIMER_2_HIGH_WORD; @@ -2335,20 +2297,20 @@ int i_APCI3120_InsnReadTimer(struct comedi_device * dev, struct comedi_subdevice us_TmpValue_2 = inw(devpriv->iobase + APCI3120_TIMER_VALUE); - // combining both words - data[0] = (UINT) ((us_TmpValue) | ((us_TmpValue_2) << 16)); + /* combining both words */ + data[0] = (unsigned int) ((us_TmpValue) | ((us_TmpValue_2) << 16)); - } else // Read watch dog status + } else /* Read watch dog status */ { us_StatusValue = inw(devpriv->iobase + APCI3120_RD_STATUS); us_StatusValue = ((us_StatusValue & APCI3120_FC_TIMER) >> 12) & 1; if (us_StatusValue == 1) { - // RESET FC_TIMER BIT + /* RESET FC_TIMER BIT */ inb(devpriv->iobase + APCI3120_TIMER_STATUS_REGISTER); } - data[0] = us_StatusValue; // when data[0] = 1 then the watch dog has rundown + data[0] = us_StatusValue; /* when data[0] = 1 then the watch dog has rundown */ } return insn->n; } @@ -2384,21 +2346,23 @@ int i_APCI3120_InsnReadDigitalInput(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - UINT ui_Chan, ui_TmpValue; + unsigned int ui_Chan, ui_TmpValue; - ui_Chan = CR_CHAN(insn->chanspec); // channel specified + ui_Chan = CR_CHAN(insn->chanspec); /* channel specified */ - //this_board->i_hwdrv_InsnReadDigitalInput(dev,ui_Chan,data); + /* this_board->i_hwdrv_InsnReadDigitalInput(dev,ui_Chan,data); */ if (ui_Chan >= 0 && ui_Chan <= 3) { - ui_TmpValue = (UINT) inw(devpriv->iobase + APCI3120_RD_STATUS); + ui_TmpValue = (unsigned int) inw(devpriv->iobase + APCI3120_RD_STATUS); - // 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. +/* + * 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_Chan + 8)) & 1; - //return 0; + /* return 0; */ } else { - // comedi_error(dev," chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + /* comedi_error(dev," chan spec wrong"); */ + return -EINVAL; /* "sorry channel spec wrong " */ } return insn->n; @@ -2426,15 +2390,15 @@ int i_APCI3120_InsnReadDigitalInput(struct comedi_device *dev, int i_APCI3120_InsnBitsDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_TmpValue; - ui_TmpValue = (UINT) inw(devpriv->iobase + APCI3120_RD_STATUS); + unsigned int ui_TmpValue; + ui_TmpValue = (unsigned int) inw(devpriv->iobase + APCI3120_RD_STATUS); /***** state of 4 channels in the 11, 10, 9, 8 bits of status reg 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); + /* this_board->i_hwdrv_InsnBitsDigitalInput(dev,data); */ return insn->n; } @@ -2481,7 +2445,7 @@ int i_APCI3120_InsnConfigDigitalOutput(struct comedi_device * dev, if (!devpriv->b_OutputMemoryStatus) { ui_Temp = 0; - } //if(!devpriv->b_OutputMemoryStatus ) + } /* if(!devpriv->b_OutputMemoryStatus ) */ return insn->n; } @@ -2530,7 +2494,7 @@ int i_APCI3120_InsnBitsDigitalOutput(struct comedi_device * dev, default: printk("\nThe parameter passed is in error \n"); return -EINVAL; - } // switch(data[1]) + } /* switch(data[1]) */ outb(data[0], devpriv->iobase + APCI3120_DIGITAL_OUTPUT); devpriv->b_DigitalOutputRegister = data[0] & 0xF0; @@ -2567,9 +2531,9 @@ int i_APCI3120_InsnWriteDigitalOutput(struct comedi_device *dev, unsigned int *data) { - UINT ui_Temp1; + unsigned int ui_Temp1; - UINT ui_NoOfChannel = CR_CHAN(insn->chanspec); // get the channel + unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */ if ((data[0] != 0) && (data[0] != 1)) { comedi_error(dev, @@ -2586,7 +2550,7 @@ int i_APCI3120_InsnWriteDigitalOutput(struct comedi_device *dev, switch (data[1]) { case 1: data[0] = (data[0] << ui_NoOfChannel); -//ES05 data[0]=(data[0]<<4)|ui_Temp; +/* ES05 data[0]=(data[0]<<4)|ui_Temp; */ data[0] = (data[0] << 4) | devpriv->b_DigitalOutputRegister; break; @@ -2595,22 +2559,22 @@ int i_APCI3120_InsnWriteDigitalOutput(struct comedi_device *dev, ui_Temp1 = 1; ui_Temp1 = ui_Temp1 << ui_NoOfChannel; ui_Temp1 = ui_Temp1 << 4; -//ES05 ui_Temp=ui_Temp|ui_Temp1; +/* ES05 ui_Temp=ui_Temp|ui_Temp1; */ devpriv->b_DigitalOutputRegister = devpriv->b_DigitalOutputRegister | ui_Temp1; data[0] = (data[0] << ui_NoOfChannel) ^ 0xf; data[0] = data[0] << 4; -//ES05 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]) + } /* switch(data[1]) */ outb(data[0], devpriv->iobase + APCI3120_DIGITAL_OUTPUT); -//ES05 ui_Temp=data[0] & 0xf0; +/* ES05 ui_Temp=data[0] & 0xf0; */ devpriv->b_DigitalOutputRegister = data[0] & 0xf0; return (insn->n); @@ -2646,14 +2610,14 @@ int i_APCI3120_InsnWriteAnalogOutput(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - UINT ui_Range, ui_Channel; - USHORT us_TmpValue; + unsigned int ui_Range, ui_Channel; + unsigned short us_TmpValue; 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 + /* this_board->i_hwdrv_InsnWriteAnalogOutput(dev, ui_Range, ui_Channel,data[0]); */ + if (ui_Range) /* if 1 then unipolar */ { if (data[0] != 0) @@ -2665,7 +2629,7 @@ int i_APCI3120_InsnWriteAnalogOutput(struct comedi_device *dev, ((((ui_Channel & 0x03) << 14) & 0xC000) | (1 << 13) | 8192); - } else // if 0 then bipolar + } else /* if 0 then bipolar */ { data[0] = ((((ui_Channel & 0x03) << 14) & 0xC000) | (0 << 13) | @@ -2673,24 +2637,30 @@ int i_APCI3120_InsnWriteAnalogOutput(struct comedi_device *dev, } - //out put n values at the given channel. - // rt_printk("\nwaiting for DA_READY BIT"); - do //Waiting of DA_READY BIT +/* + * out put n values at the given channel. rt_printk("\nwaiting for + * DA_READY BIT"); + */ + do /* Waiting of DA_READY BIT */ { us_TmpValue = - ((USHORT) inw(devpriv->iobase + + ((unsigned short) inw(devpriv->iobase + APCI3120_RD_STATUS)) & 0x0001; } while (us_TmpValue != 0x0001); if (ui_Channel <= 3) - // for channel 0-3 out at the register 1 (wrDac1-8) - // data[i] typecasted to ushort since word write is to be done - outw((USHORT) data[0], +/* + * for channel 0-3 out at the register 1 (wrDac1-8) data[i] + * typecasted to ushort since word write is to be done + */ + outw((unsigned short) data[0], devpriv->iobase + APCI3120_ANALOG_OUTPUT_1); else - // for channel 4-7 out at the register 2 (wrDac5-8) - //data[i] typecasted to ushort since word write is to be done - outw((USHORT) data[0], +/* + * for channel 4-7 out at the register 2 (wrDac5-8) data[i] + * typecasted to ushort since word write is to be done + */ + outw((unsigned short) data[0], devpriv->iobase + APCI3120_ANALOG_OUTPUT_2); return insn->n; diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.h index 59d5d87a845b..ab3a46dc1332 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.h @@ -1,5 +1,5 @@ -// hwdrv_apci3120.h +/* hwdrv_apci3120.h */ /* * Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. @@ -18,9 +18,9 @@ * any later version. */ -// comedi related defines +/* comedi related defines */ -//ANALOG INPUT RANGE +/* ANALOG INPUT RANGE */ static const struct comedi_lrange range_apci3120_ai = { 8, { BIP_RANGE(10), BIP_RANGE(5), @@ -33,14 +33,14 @@ static const struct comedi_lrange range_apci3120_ai = { 8, { } }; -// ANALOG OUTPUT RANGE +/* ANALOG OUTPUT RANGE */ static const struct comedi_lrange range_apci3120_ao = { 2, { BIP_RANGE(10), UNI_RANGE(10) } }; -#define APCI3120_BIPOLAR_RANGES 4 // used for test on mixture of BIP/UNI ranges +#define APCI3120_BIPOLAR_RANGES 4 /* used for test on mixture of BIP/UNI ranges */ #define APCI3120_BOARD_VENDOR_ID 0x10E8 #define APCI3120_ADDRESS_RANGE 16 @@ -55,17 +55,17 @@ static const struct comedi_lrange range_apci3120_ao = { 2, { #define APCI3120_EOS_MODE 2 #define APCI3120_DMA_MODE 3 -//DIGITAL INPUT-OUTPUT DEFINE +/* DIGITAL INPUT-OUTPUT DEFINE */ #define APCI3120_DIGITAL_OUTPUT 0x0D #define APCI3120_RD_STATUS 0x02 #define APCI3120_RD_FIFO 0x00 -// digital output insn_write ON /OFF selection +/* digital output insn_write ON /OFF selection */ #define APCI3120_SET4DIGITALOUTPUTON 1 #define APCI3120_SET4DIGITALOUTPUTOFF 0 -// analog output SELECT BIT +/* analog output SELECT BIT */ #define APCI3120_ANALOG_OP_CHANNEL_1 0x0000 #define APCI3120_ANALOG_OP_CHANNEL_2 0x4000 #define APCI3120_ANALOG_OP_CHANNEL_3 0x8000 @@ -75,32 +75,32 @@ static const struct comedi_lrange range_apci3120_ao = { 2, { #define APCI3120_ANALOG_OP_CHANNEL_7 0x8000 #define APCI3120_ANALOG_OP_CHANNEL_8 0xC000 -// Enable external trigger bit in nWrAddress +/* Enable external trigger bit in nWrAddress */ #define APCI3120_ENABLE_EXT_TRIGGER 0x8000 -//ANALOG OUTPUT AND INPUT DEFINE -#define APCI3120_UNIPOLAR 0x80 //$$ RAM sequence polarity BIT -#define APCI3120_BIPOLAR 0x00 //$$ RAM sequence polarity BIT -#define APCI3120_ANALOG_OUTPUT_1 0x08 // (ADDRESS ) -#define APCI3120_ANALOG_OUTPUT_2 0x0A // (ADDRESS ) -#define APCI3120_1_GAIN 0x00 //$$ RAM sequence Gain Bits for gain 1 -#define APCI3120_2_GAIN 0x10 //$$ RAM sequence Gain Bits for gain 2 -#define APCI3120_5_GAIN 0x20 //$$ RAM sequence Gain Bits for gain 5 -#define APCI3120_10_GAIN 0x30 //$$ RAM sequence Gain Bits for gain 10 -#define APCI3120_SEQ_RAM_ADDRESS 0x06 //$$ EARLIER NAMED APCI3120_FIFO_ADDRESS -#define APCI3120_RESET_FIFO 0x0C //(ADDRESS) -#define APCI3120_TIMER_0_MODE_2 0x01 //$$ Bits for timer mode +/* ANALOG OUTPUT AND INPUT DEFINE */ +#define APCI3120_UNIPOLAR 0x80 /* $$ RAM sequence polarity BIT */ +#define APCI3120_BIPOLAR 0x00 /* $$ RAM sequence polarity BIT */ +#define APCI3120_ANALOG_OUTPUT_1 0x08 /* (ADDRESS ) */ +#define APCI3120_ANALOG_OUTPUT_2 0x0A /* (ADDRESS ) */ +#define APCI3120_1_GAIN 0x00 /* $$ RAM sequence Gain Bits for gain 1 */ +#define APCI3120_2_GAIN 0x10 /* $$ RAM sequence Gain Bits for gain 2 */ +#define APCI3120_5_GAIN 0x20 /* $$ RAM sequence Gain Bits for gain 5 */ +#define APCI3120_10_GAIN 0x30 /* $$ RAM sequence Gain Bits for gain 10 */ +#define APCI3120_SEQ_RAM_ADDRESS 0x06 /* $$ EARLIER NAMED APCI3120_FIFO_ADDRESS */ +#define APCI3120_RESET_FIFO 0x0C /* (ADDRESS) */ +#define APCI3120_TIMER_0_MODE_2 0x01 /* $$ Bits for timer mode */ #define APCI3120_TIMER_0_MODE_4 0x2 #define APCI3120_SELECT_TIMER_0_WORD 0x00 -#define APCI3120_ENABLE_TIMER0 0x1000 //$$Gatebit 0 in nWrAddress +#define APCI3120_ENABLE_TIMER0 0x1000 /* $$Gatebit 0 in nWrAddress */ #define APCI3120_CLEAR_PR 0xF0FF #define APCI3120_CLEAR_PA 0xFFF0 #define APCI3120_CLEAR_PA_PR (APCI3120_CLEAR_PR & APCI3120_CLEAR_PA) -// nWrMode_Select -#define APCI3120_ENABLE_SCAN 0x8 //$$ bit in nWrMode_Select +/* nWrMode_Select */ +#define APCI3120_ENABLE_SCAN 0x8 /* $$ bit in nWrMode_Select */ #define APCI3120_DISABLE_SCAN (~APCI3120_ENABLE_SCAN) -#define APCI3120_ENABLE_EOS_INT 0x2 //$$ bit in nWrMode_Select +#define APCI3120_ENABLE_EOS_INT 0x2 /* $$ bit in nWrMode_Select */ #define APCI3120_DISABLE_EOS_INT (~APCI3120_ENABLE_EOS_INT) #define APCI3120_ENABLE_EOC_INT 0x1 @@ -108,50 +108,50 @@ static const struct comedi_lrange range_apci3120_ao = { 2, { #define APCI3120_DISABLE_ALL_INTERRUPT_WITHOUT_TIMER (APCI3120_DISABLE_EOS_INT & APCI3120_DISABLE_EOC_INT) #define APCI3120_DISABLE_ALL_INTERRUPT (APCI3120_DISABLE_TIMER_INT & APCI3120_DISABLE_EOS_INT & APCI3120_DISABLE_EOC_INT) -//status register bits +/* status register bits */ #define APCI3120_EOC 0x8000 #define APCI3120_EOS 0x2000 -// software trigger dummy register -#define APCI3120_START_CONVERSION 0x02 //(ADDRESS) +/* software trigger dummy register */ +#define APCI3120_START_CONVERSION 0x02 /* (ADDRESS) */ -//TIMER DEFINE +/* TIMER DEFINE */ #define APCI3120_QUARTZ_A 70 #define APCI3120_QUARTZ_B 50 #define APCI3120_TIMER 1 #define APCI3120_WATCHDOG 2 #define APCI3120_TIMER_DISABLE 0 #define APCI3120_TIMER_ENABLE 1 -#define APCI3120_ENABLE_TIMER2 0x4000 //$$ gatebit 2 in nWrAddress +#define APCI3120_ENABLE_TIMER2 0x4000 /* $$ gatebit 2 in nWrAddress */ #define APCI3120_DISABLE_TIMER2 (~APCI3120_ENABLE_TIMER2) -#define APCI3120_ENABLE_TIMER_INT 0x04 //$$ ENAIRQ_FC_Bit in nWrModeSelect +#define APCI3120_ENABLE_TIMER_INT 0x04 /* $$ ENAIRQ_FC_Bit in nWrModeSelect */ #define APCI3120_DISABLE_TIMER_INT (~APCI3120_ENABLE_TIMER_INT) -#define APCI3120_WRITE_MODE_SELECT 0x0E // (ADDRESS) +#define APCI3120_WRITE_MODE_SELECT 0x0E /* (ADDRESS) */ #define APCI3120_SELECT_TIMER_0_WORD 0x00 #define APCI3120_SELECT_TIMER_1_WORD 0x01 #define APCI3120_TIMER_1_MODE_2 0x4 -//$$ BIT FOR MODE IN nCsTimerCtr1 +/* $$ BIT FOR MODE IN nCsTimerCtr1 */ #define APCI3120_TIMER_2_MODE_0 0x0 #define APCI3120_TIMER_2_MODE_2 0x10 #define APCI3120_TIMER_2_MODE_5 0x30 -//$$ BIT FOR MODE IN nCsTimerCtr0 +/* $$ BIT FOR MODE IN nCsTimerCtr0 */ #define APCI3120_SELECT_TIMER_2_LOW_WORD 0x02 #define APCI3120_SELECT_TIMER_2_HIGH_WORD 0x03 -#define APCI3120_TIMER_CRT0 0x0D //(ADDRESS for cCsTimerCtr0) -#define APCI3120_TIMER_CRT1 0x0C //(ADDRESS for cCsTimerCtr1) +#define APCI3120_TIMER_CRT0 0x0D /* (ADDRESS for cCsTimerCtr0) */ +#define APCI3120_TIMER_CRT1 0x0C /* (ADDRESS for cCsTimerCtr1) */ -#define APCI3120_TIMER_VALUE 0x04 //ADDRESS for nCsTimerWert -#define APCI3120_TIMER_STATUS_REGISTER 0x0D //ADDRESS for delete timer 2 interrupt -#define APCI3120_RD_STATUS 0x02 //ADDRESS -#define APCI3120_WR_ADDRESS 0x00 //ADDRESS -#define APCI3120_ENABLE_WATCHDOG 0x20 //$$BIT in nWrMode_Select +#define APCI3120_TIMER_VALUE 0x04 /* ADDRESS for nCsTimerWert */ +#define APCI3120_TIMER_STATUS_REGISTER 0x0D /* ADDRESS for delete timer 2 interrupt */ +#define APCI3120_RD_STATUS 0x02 /* ADDRESS */ +#define APCI3120_WR_ADDRESS 0x00 /* ADDRESS */ +#define APCI3120_ENABLE_WATCHDOG 0x20 /* $$BIT in nWrMode_Select */ #define APCI3120_DISABLE_WATCHDOG (~APCI3120_ENABLE_WATCHDOG) -#define APCI3120_ENABLE_TIMER_COUNTER 0x10 //$$BIT in nWrMode_Select +#define APCI3120_ENABLE_TIMER_COUNTER 0x10 /* $$BIT in nWrMode_Select */ #define APCI3120_DISABLE_TIMER_COUNTER (~APCI3120_ENABLE_TIMER_COUNTER) -#define APCI3120_FC_TIMER 0x1000 //bit in status register +#define APCI3120_FC_TIMER 0x1000 /* bit in status register */ #define APCI3120_ENABLE_TIMER0 0x1000 #define APCI3120_ENABLE_TIMER1 0x2000 #define APCI3120_ENABLE_TIMER2 0x4000 @@ -159,25 +159,27 @@ static const struct comedi_lrange range_apci3120_ao = { 2, { #define APCI3120_DISABLE_TIMER1 (~APCI3120_ENABLE_TIMER1) #define APCI3120_DISABLE_TIMER2 (~APCI3120_ENABLE_TIMER2) -#define APCI3120_TIMER2_SELECT_EOS 0xC0 // ADDED on 20-6 -#define APCI3120_COUNTER 3 // on 20-6 -#define APCI3120_DISABLE_ALL_TIMER ( APCI3120_DISABLE_TIMER0 & APCI3120_DISABLE_TIMER1 & APCI3120_DISABLE_TIMER2 ) // on 20-6 +#define APCI3120_TIMER2_SELECT_EOS 0xC0 /* ADDED on 20-6 */ +#define APCI3120_COUNTER 3 /* on 20-6 */ +#define APCI3120_DISABLE_ALL_TIMER ( APCI3120_DISABLE_TIMER0 & APCI3120_DISABLE_TIMER1 & APCI3120_DISABLE_TIMER2 ) /* on 20-6 */ #define MAX_ANALOGINPUT_CHANNELS 32 -typedef struct { - BYTE b_Type; /* EOC or EOS */ - BYTE b_InterruptFlag; /* Interrupt use or not */ - UINT ui_ConvertTiming; /* Selection of the convertion time */ - BYTE b_NbrOfChannel; /* Number of channel to read */ - UINT ui_ChannelList[MAX_ANALOGINPUT_CHANNELS]; /* Number of the channel to be read */ - UINT ui_RangeList[MAX_ANALOGINPUT_CHANNELS]; /* Gain of each channel */ +struct str_AnalogReadInformation { -} str_AnalogReadInformation; + unsigned char b_Type; /* EOC or EOS */ + unsigned char b_InterruptFlag; /* Interrupt use or not */ + unsigned int ui_ConvertTiming; /* Selection of the convertion time */ + unsigned char b_NbrOfChannel; /* Number of channel to read */ + unsigned int ui_ChannelList[MAX_ANALOGINPUT_CHANNELS]; /* Number of the channel to be read */ + unsigned int ui_RangeList[MAX_ANALOGINPUT_CHANNELS]; /* Gain of each channel */ + +}; -// Function Declaration For APCI-3120 -// Internal functions +/* Function Declaration For APCI-3120 */ + +/* Internal functions */ int i_APCI3120_SetupChannelList(struct comedi_device *dev, struct comedi_subdevice *s, int n_chan, unsigned int *chanlist, char check); int i_APCI3120_ExttrigEnable(struct comedi_device *dev); @@ -186,9 +188,9 @@ int i_APCI3120_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_su int i_APCI3120_Reset(struct comedi_device *dev); int i_APCI3120_CyclicAnalogInput(int mode, struct comedi_device *dev, struct comedi_subdevice *s); -// Interrupt functions +/* Interrupt functions */ void v_APCI3120_Interrupt(int irq, void *d); -//UPDATE-0.7.57->0.7.68 void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev,struct comedi_subdevice *s,short *dma,short *data,int n); +/* UPDATE-0.7.57->0.7.68 void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev,struct comedi_subdevice *s,short *dma,short *data,int n); */ void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev, struct comedi_subdevice *s, short *dma_buffer, @@ -196,7 +198,7 @@ void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev, int i_APCI3120_InterruptHandleEos(struct comedi_device *dev); void v_APCI3120_InterruptDma(int irq, void *d); -// TIMER +/* TIMER */ int i_APCI3120_InsnConfigTimer(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); @@ -205,16 +207,19 @@ int i_APCI3120_InsnWriteTimer(struct comedi_device *dev, struct comedi_subdevice int i_APCI3120_InsnReadTimer(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -//DI -// for di read +/* +* DI for di read +*/ int i_APCI3120_InsnBitsDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); int i_APCI3120_InsnReadDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -//DO -//int i_APCI3120_WriteDigitalOutput(struct comedi_device *dev, BYTE data); +/* DO */ +/* int i_APCI3120_WriteDigitalOutput(struct comedi_device *dev, + * unsigned char data); + */ int i_APCI3120_InsnConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); @@ -223,12 +228,15 @@ int i_APCI3120_InsnBitsDigitalOutput(struct comedi_device *dev, struct comedi_su int i_APCI3120_InsnWriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -//AO -//int i_APCI3120_Write1AnalogValue(struct comedi_device *dev,UINT ui_Range,UINT ui_Channel,UINT data ); +/* AO */ +/* int i_APCI3120_Write1AnalogValue(struct comedi_device *dev,UINT ui_Range, + * UINT ui_Channel,UINT data ); + */ + int i_APCI3120_InsnWriteAnalogOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -//AI HArdware layer +/* AI HArdware layer */ int i_APCI3120_InsnConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); @@ -237,5 +245,5 @@ int i_APCI3120_InsnReadAnalogInput(struct comedi_device *dev, struct comedi_subd int i_APCI3120_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd); int i_APCI3120_CommandAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s); -//int i_APCI3120_CancelAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s); +/* int i_APCI3120_CancelAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s); */ int i_APCI3120_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_subdevice *s); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c index 1ff66bee548d..8981b0feaba7 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c @@ -57,73 +57,73 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc +----------------------------------------------------------------------------+ */ #include "hwdrv_apci3200.h" -//Begin 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 */ #include "addi_amcc_S5920.h" -//#define PRINT_INFO +/* #define PRINT_INFO */ -//End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values +/* End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ -//BEGIN JK 06.07.04: Management of sevrals boards +/* BEGIN JK 06.07.04: Management of sevrals boards */ /* - 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; + 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; + unsigned int ui_Channel_num=0; static int i_Count=0; - INT i_Initialised=0; - UINT ui_InterruptChannelValue[96]; //Buffer + int i_Initialised=0; + unsigned int 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 +struct 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 +/* 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) |*/ +/*| Function Name : int i_AddiHeaderRW_ReadEeprom |*/ +/*| (int i_NbOfWordsToRead, |*/ +/*| unsigned int dw_PCIBoardEepromAddress, |*/ +/*| unsigned short w_EepromStartAddress, |*/ +/*| unsigned short * 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 |*/ +/*| Input Parameters : int i_NbOfWordsToRead : Nbr. of word to read |*/ +/*| unsigned int dw_PCIBoardEepromAddress : Address of the eeprom |*/ +/*| unsigned short w_EepromStartAddress : Eeprom strat address |*/ /*+----------------------------------------------------------------------------+*/ -/*| Output Parameters : PWORD pw_DataRead : Read data |*/ +/*| Output Parameters : unsigned short * pw_DataRead : Read data |*/ /*+----------------------------------------------------------------------------+*/ /*| Return Value : - |*/ /*+----------------------------------------------------------------------------+*/ -INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, - DWORD dw_PCIBoardEepromAddress, - WORD w_EepromStartAddress, PWORD pw_DataRead) +int i_AddiHeaderRW_ReadEeprom(int i_NbOfWordsToRead, + unsigned int dw_PCIBoardEepromAddress, + unsigned short w_EepromStartAddress, unsigned short * 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; + unsigned int dw_eeprom_busy = 0; + int i_Counter = 0; + int i_WordCounter; + int i; + unsigned char pb_ReadByte[1]; + unsigned char b_ReadLowByte = 0; + unsigned char b_ReadHighByte = 0; + unsigned char b_SelectedAddressLow = 0; + unsigned char b_SelectedAddressHigh = 0; + unsigned short w_ReadWord = 0; for (i_WordCounter = 0; i_WordCounter < i_NbOfWordsToRead; i_WordCounter++) { @@ -136,15 +136,15 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, while (dw_eeprom_busy == EEPROM_BUSY); for (i_Counter = 0; i_Counter < 2; i_Counter++) { - b_SelectedAddressLow = (w_EepromStartAddress + i_Counter) % 256; //Read the low 8 bit part - b_SelectedAddressHigh = (w_EepromStartAddress + i_Counter) / 256; //Read the high 8 bit part + b_SelectedAddressLow = (w_EepromStartAddress + i_Counter) % 256; /* Read the low 8 bit part */ + b_SelectedAddressHigh = (w_EepromStartAddress + i_Counter) / 256; /* Read the high 8 bit part */ - //Select the load low address mode + /* Select the load low address mode */ outb(NVCMD_LOAD_LOW, dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR + 3); - //Wait on busy + /* Wait on busy */ do { dw_eeprom_busy = inl(dw_PCIBoardEepromAddress + @@ -153,12 +153,12 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, } while (dw_eeprom_busy == EEPROM_BUSY); - //Load the low address + /* Load the low address */ outb(b_SelectedAddressLow, dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR + 2); - //Wait on busy + /* Wait on busy */ do { dw_eeprom_busy = inl(dw_PCIBoardEepromAddress + @@ -167,12 +167,12 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, } while (dw_eeprom_busy == EEPROM_BUSY); - //Select the load high address mode + /* Select the load high address mode */ outb(NVCMD_LOAD_HIGH, dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR + 3); - //Wait on busy + /* Wait on busy */ do { dw_eeprom_busy = inl(dw_PCIBoardEepromAddress + @@ -181,12 +181,12 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, } while (dw_eeprom_busy == EEPROM_BUSY); - //Load the high address + /* Load the high address */ outb(b_SelectedAddressHigh, dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR + 2); - //Wait on busy + /* Wait on busy */ do { dw_eeprom_busy = inl(dw_PCIBoardEepromAddress + @@ -195,12 +195,12 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, } while (dw_eeprom_busy == EEPROM_BUSY); - //Select the READ mode + /* Select the READ mode */ outb(NVCMD_BEGIN_READ, dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR + 3); - //Wait on busy + /* Wait on busy */ do { dw_eeprom_busy = inl(dw_PCIBoardEepromAddress + @@ -209,12 +209,12 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, } while (dw_eeprom_busy == EEPROM_BUSY); - //Read data into the EEPROM + /* Read data into the EEPROM */ *pb_ReadByte = inb(dw_PCIBoardEepromAddress + AMCC_OP_REG_MCSR + 2); - //Wait on busy + /* Wait on busy */ do { dw_eeprom_busy = inl(dw_PCIBoardEepromAddress + @@ -223,14 +223,14 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, } while (dw_eeprom_busy == EEPROM_BUSY); - //Select the upper address part + /* Select the upper address part */ if (i_Counter == 0) { b_ReadLowByte = pb_ReadByte[0]; } else { b_ReadHighByte = pb_ReadByte[0]; } - //Sleep + /* Sleep */ for (i = 0; i < 10000; i++) ; } @@ -240,9 +240,9 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, pw_DataRead[i_WordCounter] = w_ReadWord; - w_EepromStartAddress += 2; // to read the next word + w_EepromStartAddress += 2; /* to read the next word */ - } // for (...) i_NbOfWordsToRead + } /* for (...) i_NbOfWordsToRead */ return (0); } @@ -258,31 +258,31 @@ INT i_AddiHeaderRW_ReadEeprom(INT i_NbOfWordsToRead, /*| Return Value : - |*/ /*+----------------------------------------------------------------------------+*/ -void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress, - str_BoardInfos * BoardInformations) +void v_GetAPCI3200EepromCalibrationValue(unsigned int dw_PCIBoardEepromAddress, + struct str_BoardInfos *BoardInformations) { - WORD w_AnalogInputMainHeaderAddress; - WORD w_AnalogInputComponentAddress; - WORD w_NumberOfModuls = 0; - WORD w_CurrentSources[2]; - WORD w_ModulCounter = 0; - WORD w_FirstHeaderSize = 0; - WORD w_NumberOfInputs = 0; - WORD w_CJCFlag = 0; - WORD w_NumberOfGainValue = 0; - WORD w_SingleHeaderAddress = 0; - WORD w_SingleHeaderSize = 0; - WORD w_Input = 0; - WORD w_GainFactorAddress = 0; - WORD w_GainFactorValue[2]; - WORD w_GainIndex = 0; - WORD w_GainValue = 0; + unsigned short w_AnalogInputMainHeaderAddress; + unsigned short w_AnalogInputComponentAddress; + unsigned short w_NumberOfModuls = 0; + unsigned short w_CurrentSources[2]; + unsigned short w_ModulCounter = 0; + unsigned short w_FirstHeaderSize = 0; + unsigned short w_NumberOfInputs = 0; + unsigned short w_CJCFlag = 0; + unsigned short w_NumberOfGainValue = 0; + unsigned short w_SingleHeaderAddress = 0; + unsigned short w_SingleHeaderSize = 0; + unsigned short w_Input = 0; + unsigned short w_GainFactorAddress = 0; + unsigned short w_GainFactorValue[2]; + unsigned short w_GainIndex = 0; + unsigned short w_GainValue = 0; /*****************************************/ /** Get the Analog input header address **/ /*****************************************/ - i_AddiHeaderRW_ReadEeprom(1, //i_NbOfWordsToRead - dw_PCIBoardEepromAddress, 0x116, //w_EepromStartAddress: Analog input header address + i_AddiHeaderRW_ReadEeprom(1, /* i_NbOfWordsToRead */ + dw_PCIBoardEepromAddress, 0x116, /* w_EepromStartAddress: Analog input header address */ &w_AnalogInputMainHeaderAddress); /*******************************************/ @@ -293,8 +293,8 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress, /******************************/ /** Get the number of moduls **/ /******************************/ - i_AddiHeaderRW_ReadEeprom(1, //i_NbOfWordsToRead - dw_PCIBoardEepromAddress, w_AnalogInputMainHeaderAddress + 0x02, //w_EepromStartAddress: Number of conponment + i_AddiHeaderRW_ReadEeprom(1, /* i_NbOfWordsToRead */ + dw_PCIBoardEepromAddress, w_AnalogInputMainHeaderAddress + 0x02, /* w_EepromStartAddress: Number of conponment */ &w_NumberOfModuls); for (w_ModulCounter = 0; w_ModulCounter < w_NumberOfModuls; @@ -309,8 +309,8 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress, /****************************/ /** Read first header size **/ /****************************/ - i_AddiHeaderRW_ReadEeprom(1, //i_NbOfWordsToRead - dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress, // Address of the first header + i_AddiHeaderRW_ReadEeprom(1, /* i_NbOfWordsToRead */ + dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress, /* Address of the first header */ &w_FirstHeaderSize); w_FirstHeaderSize = w_FirstHeaderSize >> 4; @@ -318,8 +318,8 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress, /***************************/ /** Read number of inputs **/ /***************************/ - i_AddiHeaderRW_ReadEeprom(1, //i_NbOfWordsToRead - dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress + 0x06, // Number of inputs for the first modul + 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; @@ -327,17 +327,17 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress, /***********************/ /** Read the CJC flag **/ /***********************/ - i_AddiHeaderRW_ReadEeprom(1, //i_NbOfWordsToRead - dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress + 0x08, // 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 + 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 + i_AddiHeaderRW_ReadEeprom(1, /* i_NbOfWordsToRead */ + dw_PCIBoardEepromAddress, w_AnalogInputComponentAddress + 0x44, /* Number of gain value */ &w_NumberOfGainValue); w_NumberOfGainValue = w_NumberOfGainValue & 0xFF; @@ -354,8 +354,8 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress, /********************************************/ /** Read current sources value for input 1 **/ /********************************************/ - i_AddiHeaderRW_ReadEeprom(1, //i_NbOfWordsToRead - dw_PCIBoardEepromAddress, w_SingleHeaderAddress, //w_EepromStartAddress: Single header address + i_AddiHeaderRW_ReadEeprom(1, /* i_NbOfWordsToRead */ + dw_PCIBoardEepromAddress, w_SingleHeaderAddress, /* w_EepromStartAddress: Single header address */ &w_SingleHeaderSize); w_SingleHeaderSize = w_SingleHeaderSize >> 4; @@ -370,8 +370,8 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress, /************************************/ /** 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 + 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]. @@ -386,8 +386,8 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress, /*************************************/ /** 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 + 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]. @@ -409,7 +409,7 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress, /********************************************/ /** Read current sources value for input 1 **/ /********************************************/ - i_AddiHeaderRW_ReadEeprom(2, //i_NbOfWordsToRead + i_AddiHeaderRW_ReadEeprom(2, /* i_NbOfWordsToRead */ dw_PCIBoardEepromAddress, (w_Input * w_SingleHeaderSize) + w_SingleHeaderAddress + 0x0C, w_CurrentSources); @@ -432,7 +432,7 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress, /***************************************/ /** Read the CJC current source value **/ /***************************************/ - i_AddiHeaderRW_ReadEeprom(2, //i_NbOfWordsToRead + i_AddiHeaderRW_ReadEeprom(2, /* i_NbOfWordsToRead */ dw_PCIBoardEepromAddress, (w_Input * w_SingleHeaderSize) + w_SingleHeaderAddress + 0x0C, w_CurrentSources); @@ -453,7 +453,7 @@ void v_GetAPCI3200EepromCalibrationValue(DWORD dw_PCIBoardEepromAddress, } } -INT i_APCI3200_GetChannelCalibrationValue(struct comedi_device * dev, +int i_APCI3200_GetChannelCalibrationValue(struct comedi_device * dev, unsigned int ui_Channel_num, unsigned int * CJCCurrentSource, unsigned int * ChannelCurrentSource, unsigned int * ChannelGainFactor) { @@ -464,9 +464,9 @@ INT i_APCI3200_GetChannelCalibrationValue(struct comedi_device * dev, printk("\n Channel = %u", ui_Channel_num); #endif - //Test if single or differential mode + /* Test if single or differential mode */ if (s_BoardInfos[dev->minor].i_ConnectionType == 1) { - //if diff + /* if diff */ if ((ui_Channel_num >= 0) && (ui_Channel_num <= 1)) i_DiffChannel = ui_Channel_num, i_Module = 0; @@ -478,7 +478,7 @@ INT i_APCI3200_GetChannelCalibrationValue(struct comedi_device * dev, i_DiffChannel = ui_Channel_num - 6, i_Module = 3; } else { - // if single + /* 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)) @@ -497,7 +497,7 @@ INT i_APCI3200_GetChannelCalibrationValue(struct comedi_device * dev, i_DiffChannel = 1, i_Module = 3; } - //Test if thermocouple or RTD mode + /* Test if thermocouple or RTD mode */ *CJCCurrentSource = s_BoardInfos[dev->minor].s_Module[i_Module].ul_CurrentSourceCJC; #ifdef PRINT_INFO @@ -510,22 +510,22 @@ INT i_APCI3200_GetChannelCalibrationValue(struct comedi_device * dev, #ifdef PRINT_INFO printk("\n ChannelCurrentSource = %lu", *ChannelCurrentSource); #endif - // } - // } + /* } */ + /* } */ - //Channle gain factor + /* 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 + /* 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 +/* End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ /* +----------------------------------------------------------------------------+ @@ -536,9 +536,9 @@ INT i_APCI3200_GetChannelCalibrationValue(struct comedi_device * dev, | Task : Read value of the selected channel or port | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | - | UINT ui_NoOfChannels : No Of Channels To read for Port + | unsigned int ui_NoOfChannels : No Of Channels To read for Port Channel Numberfor single channel - | UINT data[0] : 0: Read single channel + | unsigned int data[0] : 0: Read single channel 1: Read port value data[1] Port number +----------------------------------------------------------------------------+ @@ -550,24 +550,24 @@ INT i_APCI3200_GetChannelCalibrationValue(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI3200_ReadDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI3200_ReadDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_Temp = 0; - UINT ui_NoOfChannel = 0; + unsigned int ui_Temp = 0; + unsigned int 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) + } /* 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) + } /* if(data[1] < 0 || data[1] >1) */ switch (ui_NoOfChannel) { case 2: @@ -578,13 +578,13 @@ INT i_APCI3200_ReadDigitalInput(struct comedi_device * dev, struct comedi_subdev break; default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ - } //switch(ui_NoOfChannels) - } //if (ui_Temp==1) + } /* switch(ui_NoOfChannels) */ + } /* if (ui_Temp==1) */ else { printk("\nSpecified channel not supported \n"); - } //elseif (ui_Temp==1) + } /* elseif (ui_Temp==1) */ } return insn->n; } @@ -616,13 +616,13 @@ int i_APCI3200_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub 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) ) */ if (data[0]) { devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE; - } // if (data[0]) + } /* if (data[0]) */ else { devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE; - } //else if (data[0]) + } /* else if (data[0]) */ return insn->n; } @@ -653,23 +653,23 @@ int i_APCI3200_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub | | +----------------------------------------------------------------------------+ */ -INT i_APCI3200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI3200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_Temp = 0, ui_Temp1 = 0; - UINT ui_NoOfChannel = CR_CHAN(insn->chanspec); // get the channel + unsigned int ui_Temp = 0, ui_Temp1 = 0; + unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */ if (devpriv->b_OutputMemoryStatus) { ui_Temp = inl(devpriv->i_IobaseAddon); - } //if(devpriv->b_OutputMemoryStatus ) + } /* if(devpriv->b_OutputMemoryStatus ) */ else { ui_Temp = 0; - } //if(devpriv->b_OutputMemoryStatus ) + } /* 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) + } /* if(data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -682,15 +682,15 @@ INT i_APCI3200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd case 3: data[0] = (data[0] | ui_Temp); break; - } //switch(ui_NoOfChannels) + } /* switch(ui_NoOfChannels) */ outl(data[0], devpriv->i_IobaseAddon); - } // if(data[1]==1) + } /* 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[1]==1) */ + } /* elseif(data[1]==0) */ + } /* if(data[3]==0) */ else { if (data[3] == 1) { if (data[1] == 0) { @@ -701,7 +701,7 @@ INT i_APCI3200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd data[0] = (data[0] << ui_NoOfChannel) ^ 0xf; data[0] = data[0] & ui_Temp; outl(data[0], devpriv->i_IobaseAddon); - } //if(data[1]==0) + } /* if(data[1]==0) */ else { if (data[1] == 1) { switch (ui_NoOfChannel) { @@ -725,21 +725,21 @@ INT i_APCI3200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " - } //switch(ui_NoOfChannels) + return -EINVAL; /* "sorry channel spec wrong " */ + } /* switch(ui_NoOfChannels) */ outl(data[0], devpriv->i_IobaseAddon); - } // if(data[1]==1) + } /* 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 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) + } /* if else data[3]==1) */ + } /* if else data[3]==0) */ return insn->n; } @@ -752,8 +752,8 @@ INT i_APCI3200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd | Task : Read value of the selected channel or port | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | - | UINT ui_NoOfChannels : No Of Channels To read | - | UINT *data : Data Pointer to read status | + | unsigned int ui_NoOfChannels : No Of Channels To read | + | unsigned int *data : Data Pointer to read status | data[0] :0 read single channel 1 read port value data[1] port no @@ -766,23 +766,23 @@ INT i_APCI3200_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd | | +----------------------------------------------------------------------------+ */ -INT i_APCI3200_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI3200_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_Temp; - UINT ui_NoOfChannel; + unsigned int ui_Temp; + unsigned int ui_NoOfChannel; ui_NoOfChannel = CR_CHAN(insn->chanspec); ui_Temp = data[0]; *data = inl(devpriv->i_IobaseAddon); if (ui_Temp == 0) { *data = (*data >> ui_NoOfChannel) & 0x1; - } // if (ui_Temp==0) + } /* if (ui_Temp==0) */ else { if (ui_Temp == 1) { if (data[1] < 0 || data[1] > 1) { printk("\nThe port selection is in error\n"); return -EINVAL; - } //if(data[1] <0 ||data[1] >1) + } /* if(data[1] <0 ||data[1] >1) */ switch (ui_NoOfChannel) { case 2: *data = (*data >> (2 * data[1])) & 3; @@ -793,20 +793,20 @@ INT i_APCI3200_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde default: comedi_error(dev, " chan spec wrong"); - return -EINVAL; // "sorry channel spec wrong " + return -EINVAL; /* "sorry channel spec wrong " */ break; - } // switch(ui_NoOfChannels) - } // if (ui_Temp==1) + } /* switch(ui_NoOfChannels) */ + } /* if (ui_Temp==1) */ else { printk("\nSpecified channel not supported \n"); - } // else if (ui_Temp==1) - } // else if (ui_Temp==0) + } /* else if (ui_Temp==1) */ + } /* else if (ui_Temp==0) */ return insn->n; } /* +----------------------------------------------------------------------------+ - | Function Name : INT i_APCI3200_ConfigAnalogInput | + | Function Name : int i_APCI3200_ConfigAnalogInput | | (struct comedi_device *dev,struct comedi_subdevice *s, | | struct comedi_insn *insn,unsigned int *data) | +----------------------------------------------------------------------------+ @@ -874,30 +874,30 @@ INT i_APCI3200_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde | | +----------------------------------------------------------------------------+ */ -INT i_APCI3200_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI3200_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ul_Config = 0, ul_Temp = 0; - UINT ui_ChannelNo = 0; - UINT ui_Dummy = 0; - INT i_err = 0; + unsigned int ul_Config = 0, ul_Temp = 0; + unsigned int ui_ChannelNo = 0; + unsigned int ui_Dummy = 0; + int i_err = 0; - //Begin 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 */ #ifdef PRINT_INFO - INT i = 0, i2 = 0; + int i = 0, i2 = 0; #endif - //End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + /* 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 + /* 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_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_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; @@ -905,11 +905,11 @@ INT i_APCI3200_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subde 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 + /* 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 + /* 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 + /* 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])); @@ -938,72 +938,72 @@ INT i_APCI3200_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subde } } #endif - //End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + /* 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]!=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[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[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[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[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[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[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[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 ) + } /* 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++; - } // if(data[7]!=2) + } /* 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[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[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[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[13] <0 ||data[13] >15) */ - //BEGIN JK 06.07.04: Management of sevrals boards + /* BEGIN JK 06.07.04: Management of sevrals boards */ /* i_ChannelCount=data[13]; i_ScanType=data[12]; @@ -1014,7 +1014,7 @@ INT i_APCI3200_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subde i_ADDIDATAType=data[0]; */ - // Save acquisition configuration for the actual board + /* 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]; @@ -1022,307 +1022,307 @@ INT i_APCI3200_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subde 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 + /* 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 + /* 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(unsigned int)); // 7 is the maximal number of channels - //End JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 + /* 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(unsigned int)); /* 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) + /* 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. + /* 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 + /* 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 - //BEGIN JK 06.07.04: Management of sevrals boards - //i_ChannelNo=ui_ChannelNo; - //ui_Channel_num =ui_ChannelNo; + 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 + /* 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) + } /* 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) + } /* 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(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; + /* 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) + /* 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; + /* 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) + /* 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; + /* 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) + /* 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; + /* 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) + /* 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; + /* 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 ) + /* 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; + /* 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) + /* 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; + /* 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 ) + /* 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; + /* 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) + /* 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; + /* 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 + /* END JK 06.07.04: Management of sevrals boards */ ui_ChannelNo = 0; break; - } //if(data[14]==2) + } /* if(data[14]==2) */ if (ui_ChannelNo >= 0 && ui_ChannelNo <= 1) { - //BEGIN JK 06.07.04: Management of sevrals boards - //i_Offset=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 && ui_ChannelNo <=1) + /* 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; + /* 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 + /* END JK 06.07.04: Management of sevrals boards */ ui_ChannelNo = ui_ChannelNo - 2; - } //if(ui_ChannelNo >=2 && ui_ChannelNo <=3) + } /* 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; + /* 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 + /* END JK 06.07.04: Management of sevrals boards */ ui_ChannelNo = ui_ChannelNo - 4; - } //if(ui_ChannelNo >=4 && ui_ChannelNo <=5) + } /* 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; + /* 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 + /* END JK 06.07.04: Management of sevrals boards */ ui_ChannelNo = ui_ChannelNo - 6; - } //if(ui_ChannelNo >=6 && ui_ChannelNo <=7) + } /* if(ui_ChannelNo >=6 && ui_ChannelNo <=7) */ break; default: printk("\n This selection of polarity does not exist\n"); i_err++; - } //switch(data[2]) - } //if(data[12]==0 || data[12]==1) + } /* switch(data[2]) */ + } /* 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; + /* 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 + /* END JK 06.07.04: Management of sevrals boards */ break; case 2: - //BEGIN JK 06.07.04: Management of sevrals boards - //i_Offset=64; + /* 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 + /* END JK 06.07.04: Management of sevrals boards */ break; case 3: - //BEGIN JK 06.07.04: Management of sevrals boards - //i_Offset=128; + /* 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 + /* END JK 06.07.04: Management of sevrals boards */ break; case 4: - //BEGIN JK 06.07.04: Management of sevrals boards - //i_Offset=192; + /* 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 + /* 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) + } /* switch(data[11]) */ + } /* elseif(data[12]==0 || data[12]==1) */ if (i_err) { i_APCI3200_Reset(dev); return -EINVAL; } - //if(i_ScanType!=1) + /* 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; + /* 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) + /* END JK 06.07.04: Management of sevrals boards */ + } /* if(i_ScanType!=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); + /* 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 + /* 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); + /* 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 + /* 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); + /* 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 + /* 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); + /* 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 + /* 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); + /* 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 + /* END JK 06.07.04: Management of sevrals boards */ /***************************/ /* Write the configuration */ /***************************/ - //BEGIN JK 06.07.04: Management of sevrals boards - //outl(ul_Config , devpriv->iobase+i_Offset + 0x0); + /* 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 + /* 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); + /* 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 + /* 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); + /* 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 + /* 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); + /* 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 + /* 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; + /* 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) + /* 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; + /* 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) + /* 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; + /* 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 + /* END JK 06.07.04: Management of sevrals boards */ - //BEGIN JK 06.07.04: Management of sevrals boards - //if(i_ScanType==1) + /* 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 + /* END JK 06.07.04: Management of sevrals boards */ { - //BEGIN JK 06.07.04: Management of sevrals boards - //i_Sum=i_Sum+1; + /* 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 + /* END JK 06.07.04: Management of sevrals boards */ insn->unused[0] = 0; i_APCI3200_ReadAnalogInput(dev, s, insn, &ui_Dummy); @@ -1340,8 +1340,8 @@ INT i_APCI3200_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subde | Task : Read value of the selected channel | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | - | UINT ui_NoOfChannels : No Of Channels To read | - | UINT *data : Data Pointer to read status | + | unsigned int ui_NoOfChannels : No Of Channels To read | + | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | | data[0] : Digital Value Of Input | @@ -1361,21 +1361,21 @@ INT i_APCI3200_ConfigAnalogInput(struct comedi_device * dev, struct comedi_subde | | +----------------------------------------------------------------------------+ */ -INT i_APCI3200_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI3200_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_DummyValue = 0; + unsigned int ui_DummyValue = 0; int i_ConvertCJCCalibration; int i = 0; - //BEGIN JK 06.07.04: Management of sevrals boards - //if(i_Initialised==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 + /* END JK 06.07.04: Management of sevrals boards */ { i_APCI3200_Reset(dev); return -EINVAL; - } //if(i_Initialised==0); + } /* if(i_Initialised==0); */ #ifdef PRINT_INFO printk("\n insn->unused[0] = %i", insn->unused[0]); @@ -1386,14 +1386,14 @@ INT i_APCI3200_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevi i_APCI3200_Read1AnalogInputChannel(dev, s, insn, &ui_DummyValue); - //BEGIN JK 06.07.04: Management of sevrals boards - //ui_InterruptChannelValue[i_Count+0]=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 + /* END JK 06.07.04: Management of sevrals boards */ - //Begin JK 25.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + /* 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]. @@ -1414,62 +1414,62 @@ INT i_APCI3200_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevi 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 + /* 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)) + /* 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 + /* 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; + /* 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)) + /* 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; + /* 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)) + /* 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)) + /* 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 + /* 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; + /* 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 + /* 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; + /* 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)) + /* 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)) + /* 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 + /* END JK 06.07.04: Management of sevrals boards */ { /**********************************************************/ /*Test if the Calibration channel must be read for the CJC */ @@ -1477,52 +1477,52 @@ INT i_APCI3200_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevi /**********************************/ /*Test if the polarity is the same */ /**********************************/ - //BEGIN JK 06.07.04: Management of sevrals boards - //if(i_CJCPolarity!=i_ADDIDATAPolarity) + /* 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 + /* END JK 06.07.04: Management of sevrals boards */ { i_ConvertCJCCalibration = 1; - } //if(i_CJCPolarity!=i_ADDIDATAPolarity) + } /* if(i_CJCPolarity!=i_ADDIDATAPolarity) */ else { - //BEGIN JK 06.07.04: Management of sevrals boards - //if(i_CJCGain==i_ADDIDATAGain) + /* 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 + /* END JK 06.07.04: Management of sevrals boards */ { i_ConvertCJCCalibration = 0; - } //if(i_CJCGain==i_ADDIDATAGain) + } /* if(i_CJCGain==i_ADDIDATAGain) */ else { i_ConvertCJCCalibration = 1; - } //elseif(i_CJCGain==i_ADDIDATAGain) - } //elseif(i_CJCPolarity!=i_ADDIDATAPolarity) + } /* 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; + /* 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 + /* 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; + /* 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) + /* 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; + /* 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 @@ -1530,36 +1530,36 @@ INT i_APCI3200_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevi 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)) + /* 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) + /* BEGIN JK 06.07.04: Management of sevrals boards */ + /* if(i_ScanType!=1) */ if (s_BoardInfos[dev->minor].i_ScanType != 1) { - //i_Count=0; + /* i_Count=0; */ s_BoardInfos[dev->minor].i_Count = 0; - } //if(i_ScanType!=1) + } /* 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; + /* 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) + /* 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((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; + /* 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 + /* End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ } - //if(i_ScanType==0) + /* if(i_ScanType==0) */ if (s_BoardInfos[dev->minor].i_ScanType == 0) { /* data[0]= ui_InterruptChannelValue[0]; @@ -1591,41 +1591,41 @@ INT i_APCI3200_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevi 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]); + /* 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 + /* End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ } break; case 1: for (i = 0; i < insn->n; i++) { - //data[i]=ui_InterruptChannelValue[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) + /* 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; + /* 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 + /* 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]) + } /* switch(insn->unused[0]) */ return insn->n; } @@ -1639,8 +1639,8 @@ INT i_APCI3200_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevi | Task : Read value of the selected channel | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | - | UINT ui_NoOfChannel : Channel No to read | - | UINT *data : Data Pointer to read status | + | unsigned int ui_NoOfChannel : Channel No to read | + | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | | data[0] : Digital Value read | @@ -1651,49 +1651,49 @@ INT i_APCI3200_ReadAnalogInput(struct comedi_device * dev, struct comedi_subdevi | | +----------------------------------------------------------------------------+ */ -INT i_APCI3200_Read1AnalogInputChannel(struct comedi_device * dev, +int i_APCI3200_Read1AnalogInputChannel(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_EOC = 0; - UINT ui_ChannelNo = 0; - UINT ui_CommandRegister = 0; + unsigned int ui_EOC = 0; + unsigned int ui_ChannelNo = 0; + unsigned int ui_CommandRegister = 0; - //BEGIN JK 06.07.04: Management of sevrals boards - //ui_ChannelNo=i_ChannelNo; + /* 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+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); + /* 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 + /* 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); + /* 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(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+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(i_ADDIDATAConversionTime , devpriv->iobase+i_Offset + 32); */ outl(s_BoardInfos[dev->minor].i_ADDIDATAConversionTime, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 32); @@ -1707,36 +1707,36 @@ INT i_APCI3200_Read1AnalogInputChannel(struct comedi_device * dev, /*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 */ /************************/ ui_CommandRegister = ui_CommandRegister | 0x00100000; - } //if (i_InterruptFlag == ADDIDATA_ENABLE) + } /* if (i_InterruptFlag == ADDIDATA_ENABLE) */ /******************************/ /* Write the command register */ /******************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* 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+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 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; @@ -1746,13 +1746,13 @@ INT i_APCI3200_Read1AnalogInputChannel(struct comedi_device * dev, /* 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 + /* END JK 06.07.04: Management of sevrals boards */ - } // if (i_InterruptFlag == ADDIDATA_DISABLE) + } /* if (i_InterruptFlag == ADDIDATA_DISABLE) */ return 0; } @@ -1765,7 +1765,7 @@ INT i_APCI3200_Read1AnalogInputChannel(struct comedi_device * dev, | Task : Read calibration offset value of the selected channel| +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | - | UINT *data : Data Pointer to read status | + | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | | data[0] : Calibration offset Value | @@ -1776,54 +1776,54 @@ INT i_APCI3200_Read1AnalogInputChannel(struct comedi_device * dev, | | +----------------------------------------------------------------------------+ */ -int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * data) +int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, unsigned int * data) { - UINT ui_Temp = 0, ui_EOC = 0; - UINT ui_CommandRegister = 0; + unsigned int ui_Temp = 0, ui_EOC = 0; + unsigned int ui_CommandRegister = 0; - //BEGIN JK 06.07.04: Management of sevrals boards - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* 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 ! + /* 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); + /* 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(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+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(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+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+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+i_Offset + 12); */ outl((ui_Temp | 0x00020000), devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12); /*******************************/ @@ -1836,7 +1836,7 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * dat /*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) { /**********************/ @@ -1845,7 +1845,7 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * dat ui_CommandRegister = ui_CommandRegister | 0x00100000; - } //if (i_InterruptFlag == ADDIDATA_ENABLE) + } /* if (i_InterruptFlag == ADDIDATA_ENABLE) */ /**********************/ /*Start the conversion */ @@ -1855,10 +1855,10 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * dat /***************************/ /*Write the command regiter */ /***************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* 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+i_Offset + 8); */ outl(ui_CommandRegister, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8); @@ -1866,7 +1866,7 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * dat /*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 { @@ -1874,7 +1874,7 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * dat /*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; @@ -1884,11 +1884,11 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * dat /*Read the digital value of the calibration Offset */ /**************************************************/ - //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) + } /* if (i_InterruptFlag == ADDIDATA_DISABLE) */ return 0; } @@ -1901,7 +1901,7 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * dat | Task : Read calibration gain value of the selected channel | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | - | UINT *data : Data Pointer to read status | + | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | | data[0] : Calibration gain Value Of Input | @@ -1912,21 +1912,21 @@ int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device * dev, UINT * dat | | +----------------------------------------------------------------------------+ */ -int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data) +int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, unsigned int * data) { - UINT ui_EOC = 0; - INT ui_CommandRegister = 0; + unsigned int ui_EOC = 0; + int ui_CommandRegister = 0; - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* 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 ! + /* 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 */ @@ -1934,28 +1934,28 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data) /*******************************/ /* Set the convert timing unit */ /*******************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* 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(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+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(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+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+i_Offset + 12); */ outl(0x00040000, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12); @@ -1969,7 +1969,7 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data) /*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) { /**********************/ @@ -1978,7 +1978,7 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data) ui_CommandRegister = ui_CommandRegister | 0x00100000; - } //if (i_InterruptFlag == ADDIDATA_ENABLE) + } /* if (i_InterruptFlag == ADDIDATA_ENABLE) */ /**********************/ /*Start the conversion */ @@ -1988,10 +1988,10 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data) /***************************/ /*Write the command regiter */ /***************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* 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+i_Offset + 8); */ outl(ui_CommandRegister, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8); @@ -1999,7 +1999,7 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data) /*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 { @@ -2008,7 +2008,7 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data) /*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; @@ -2018,12 +2018,12 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data) /*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) + } /* if (i_InterruptFlag == ADDIDATA_DISABLE) */ return 0; } @@ -2036,7 +2036,7 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data) | Task : Read CJC value of the selected channel | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | - | UINT *data : Data Pointer to read status | + | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | | data[0] : CJC Value | @@ -2050,39 +2050,39 @@ int i_APCI3200_ReadCalibrationGainValue(struct comedi_device * dev, UINT * data) int i_APCI3200_ReadCJCValue(struct comedi_device * dev, unsigned int * data) { - UINT ui_EOC = 0; - INT ui_CommandRegister = 0; + unsigned int ui_EOC = 0; + int ui_CommandRegister = 0; /******************************/ /*Set the converting time unit */ /******************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* 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(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+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(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+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+i_Offset + 4); */ outl(0x00000400, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 4); /*******************************/ @@ -2092,7 +2092,7 @@ int i_APCI3200_ReadCJCValue(struct comedi_device * dev, unsigned int * data) /*********************************/ /*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 */ @@ -2109,10 +2109,10 @@ int i_APCI3200_ReadCJCValue(struct comedi_device * dev, unsigned int * data) /***************************/ /*Write the command regiter */ /***************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* 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+i_Offset + 8); */ outl(ui_CommandRegister, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8); @@ -2120,7 +2120,7 @@ int i_APCI3200_ReadCJCValue(struct comedi_device * dev, unsigned int * data) /*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 { @@ -2128,7 +2128,7 @@ int i_APCI3200_ReadCJCValue(struct comedi_device * dev, unsigned int * data) /*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; @@ -2138,12 +2138,12 @@ int i_APCI3200_ReadCJCValue(struct comedi_device * dev, unsigned int * data) /*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) + } /* if (i_InterruptFlag == ADDIDATA_DISABLE) */ return 0; } @@ -2156,7 +2156,7 @@ int i_APCI3200_ReadCJCValue(struct comedi_device * dev, unsigned int * data) | Task : Read CJC calibration offset value of the selected channel +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | - | UINT *data : Data Pointer to read status | + | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | | data[0] : CJC calibration offset Value @@ -2169,45 +2169,45 @@ int i_APCI3200_ReadCJCValue(struct comedi_device * dev, unsigned int * data) */ int i_APCI3200_ReadCJCCalOffset(struct comedi_device * dev, unsigned int * data) { - UINT ui_EOC = 0; - INT ui_CommandRegister = 0; + unsigned int 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+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(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+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(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+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+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+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+i_Offset + 12); */ outl(0x00020000, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12); /*******************************/ @@ -2218,7 +2218,7 @@ int i_APCI3200_ReadCJCCalOffset(struct comedi_device * dev, unsigned int * data) /*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 */ @@ -2234,19 +2234,19 @@ int i_APCI3200_ReadCJCCalOffset(struct comedi_device * dev, unsigned int * data) /***************************/ /*Write the command regiter */ /***************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* 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+i_Offset + 8); */ outl(ui_CommandRegister, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8); - //if (i_InterruptFlag == ADDIDATA_DISABLE) + /* 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+i_Offset + 20) & 1; */ ui_EOC = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 20) & 1; } while (ui_EOC != 1); @@ -2254,11 +2254,11 @@ int i_APCI3200_ReadCJCCalOffset(struct comedi_device * dev, unsigned int * data) /**************************************************/ /*Read the digital value of the calibration Offset */ /**************************************************/ - //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) + } /* if (i_InterruptFlag == ADDIDATA_DISABLE) */ return 0; } @@ -2271,8 +2271,8 @@ int i_APCI3200_ReadCJCCalOffset(struct comedi_device * dev, unsigned int * data) | Task : Read CJC calibration gain value +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | - | UINT ui_NoOfChannels : No Of Channels To read | - | UINT *data : Data Pointer to read status | + | unsigned int ui_NoOfChannels : No Of Channels To read | + | unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | | data[0] : CJC calibration gain value @@ -2285,42 +2285,42 @@ int i_APCI3200_ReadCJCCalOffset(struct comedi_device * dev, unsigned int * data) */ int i_APCI3200_ReadCJCCalGain(struct comedi_device * dev, unsigned int * data) { - UINT ui_EOC = 0; - INT ui_CommandRegister = 0; + unsigned int 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+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(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+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(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+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+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+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+i_Offset + 12); */ outl(0x00040000, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 12); @@ -2331,7 +2331,7 @@ int i_APCI3200_ReadCJCCalGain(struct comedi_device * dev, unsigned int * data) /*********************************/ /*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 */ @@ -2345,30 +2345,30 @@ int i_APCI3200_ReadCJCCalGain(struct comedi_device * dev, unsigned int * data) /***************************/ /*Write the command regiter */ /***************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* 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+i_Offset + 8); */ outl(ui_CommandRegister, devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8); - //if (i_InterruptFlag == ADDIDATA_DISABLE) + /* 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+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+i_Offset + 28); */ data[0] = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 28); - } //if (i_InterruptFlag == ADDIDATA_DISABLE) + } /* if (i_InterruptFlag == ADDIDATA_DISABLE) */ return 0; } @@ -2404,33 +2404,33 @@ int i_APCI3200_ReadCJCCalGain(struct comedi_device * dev, unsigned int * data) +----------------------------------------------------------------------------+ */ -INT i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device * dev, +int i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_Configuration = 0; - INT i_Temp; //,i_TimeUnit; - //if(i_Initialised==0) + unsigned int 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(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]!=0 && data[0]!=1) */ - if (data[0] == 1) //Perform Short Circuit TEST + 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+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 |i_ChannelNo) , devpriv->iobase+i_Offset + 4); */ outl((0x00001000 | s_BoardInfos[dev->minor].i_ChannelNo), devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 4); @@ -2439,19 +2439,19 @@ INT i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device * dev, /*************************/ /* i_TimeUnit= i_ADDIDATAConversionTimeUnit; i_ADDIDATAConversionTimeUnit= 1; */ - //i_Temp= i_InterruptFlag ; + /* i_Temp= i_InterruptFlag ; */ i_Temp = s_BoardInfos[dev->minor].i_InterruptFlag; - //i_InterruptFlag = ADDIDATA_DISABLE; + /* i_InterruptFlag = ADDIDATA_DISABLE; */ s_BoardInfos[dev->minor].i_InterruptFlag = ADDIDATA_DISABLE; i_APCI3200_Read1AnalogInputChannel(dev, s, insn, data); - //if(i_AutoCalibration == FALSE) + /* 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+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 |i_ChannelNo) , devpriv->iobase+i_Offset + 4); */ outl((0x00001000 | s_BoardInfos[dev->minor]. i_ChannelNo), devpriv->iobase + @@ -2462,15 +2462,15 @@ INT i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device * dev, i_APCI3200_ReadCalibrationGainValue(dev, data); } } else { - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* 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|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+i_Offset + 0); */ ui_Configuration = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 0); @@ -2479,18 +2479,18 @@ INT i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device * dev, /*************************/ /* i_TimeUnit= i_ADDIDATAConversionTimeUnit; i_ADDIDATAConversionTimeUnit= 1; */ - //i_Temp= i_InterruptFlag ; + /* i_Temp= i_InterruptFlag ; */ i_Temp = s_BoardInfos[dev->minor].i_InterruptFlag; - //i_InterruptFlag = ADDIDATA_DISABLE; + /* i_InterruptFlag = ADDIDATA_DISABLE; */ s_BoardInfos[dev->minor].i_InterruptFlag = ADDIDATA_DISABLE; i_APCI3200_Read1AnalogInputChannel(dev, s, insn, data); - //if(i_AutoCalibration == FALSE) + /* 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+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|i_ChannelNo) , devpriv->iobase+i_Offset + 4); */ outl((0x00000800 | s_BoardInfos[dev->minor]. i_ChannelNo), devpriv->iobase + @@ -2501,9 +2501,9 @@ INT i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device * dev, i_APCI3200_ReadCalibrationGainValue(dev, data); } } - //i_InterruptFlag=i_Temp ; + /* i_InterruptFlag=i_Temp ; */ s_BoardInfos[dev->minor].i_InterruptFlag = i_Temp; - //printk("\ni_InterruptFlag=%d\n",i_InterruptFlag); + /* printk("\ni_InterruptFlag=%d\n",i_InterruptFlag); */ return insn->n; } @@ -2529,7 +2529,7 @@ INT i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device * dev, +----------------------------------------------------------------------------+ */ -INT i_APCI3200_InsnWriteReleaseAnalogInput(struct comedi_device * dev, +int i_APCI3200_InsnWriteReleaseAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { i_APCI3200_Reset(dev); @@ -2565,18 +2565,18 @@ int i_APCI3200_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ { 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; + int tmp; /* divisor1,divisor2; */ + unsigned int ui_ConvertTime = 0; + unsigned int ui_ConvertTimeBase = 0; + unsigned int ui_DelayTime = 0; + unsigned int 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 + /* step 1: make sure trigger sources are trivially valid */ tmp = cmd->start_src; cmd->start_src &= TRIG_NOW | TRIG_EXT; @@ -2598,10 +2598,10 @@ int i_APCI3200_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ cmd->stop_src &= TRIG_COUNT | TRIG_NONE; if (!cmd->stop_src || tmp != cmd->stop_src) err++; - //if(i_InterruptFlag==0) + /* if(i_InterruptFlag==0) */ if (s_BoardInfos[dev->minor].i_InterruptFlag == 0) { err++; - // printk("\nThe interrupt should be enabled\n"); + /* printk("\nThe interrupt should be enabled\n"); */ } if (err) { i_APCI3200_Reset(dev); @@ -2643,9 +2643,9 @@ int i_APCI3200_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ i_APCI3200_Reset(dev); return 2; } - //i_FirstChannel=cmd->chanlist[0]; + /* i_FirstChannel=cmd->chanlist[0]; */ s_BoardInfos[dev->minor].i_FirstChannel = cmd->chanlist[0]; - //i_LastChannel=cmd->chanlist[1]; + /* i_LastChannel=cmd->chanlist[1]; */ s_BoardInfos[dev->minor].i_LastChannel = cmd->chanlist[1]; if (cmd->convert_src == TRIG_TIMER) { @@ -2656,11 +2656,11 @@ int i_APCI3200_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ { 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_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++; - } //if(ui_ConvertTimeBase!=2) + } /* if(ui_ConvertTimeBase!=2) */ } else { ui_ConvertTime = 0; ui_ConvertTimeBase = 0; @@ -2668,7 +2668,7 @@ int i_APCI3200_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ if (cmd->scan_begin_src == TRIG_FOLLOW) { ui_DelayTime = 0; ui_DelayTimeBase = 0; - } //if(cmd->scan_begin_src==TRIG_FOLLOW) + } /* if(cmd->scan_begin_src==TRIG_FOLLOW) */ else { ui_DelayTime = cmd->scan_begin_arg & 0xFFFF; ui_DelayTimeBase = cmd->scan_begin_arg >> 16; @@ -2686,7 +2686,7 @@ int i_APCI3200_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ } fpu_begin(); d_SCANTimeNewUnit = (double)ui_DelayTime; - //i_NbrOfChannel= i_LastChannel-i_FirstChannel + 4; + /* i_NbrOfChannel= i_LastChannel-i_FirstChannel + 4; */ i_NbrOfChannel = s_BoardInfos[dev->minor].i_LastChannel - s_BoardInfos[dev->minor].i_FirstChannel + 4; @@ -2736,7 +2736,7 @@ int i_APCI3200_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ err++; } fpu_end(); - } //else if(cmd->scan_begin_src==TRIG_FOLLOW) + } /* else if(cmd->scan_begin_src==TRIG_FOLLOW) */ if (err) { i_APCI3200_Reset(dev); @@ -2766,11 +2766,11 @@ int i_APCI3200_CommandTestAnalogInput(struct comedi_device * dev, struct comedi_ int i_APCI3200_StopCyclicAcquisition(struct comedi_device * dev, struct comedi_subdevice * s) { - UINT ui_Configuration = 0; - //i_InterruptFlag=0; - //i_Initialised=0; - //i_Count=0; - //i_Sum=0; + unsigned int 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; @@ -2779,16 +2779,16 @@ int i_APCI3200_StopCyclicAcquisition(struct comedi_device * dev, struct comedi_s /*******************/ /*Read the register */ /*******************/ - //ui_Configuration = inl(devpriv->iobase+i_Offset + 8); + /* 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+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+i_Offset + 8); */ outl((ui_Configuration & 0xFFE7FFFF), devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8); return 0; @@ -2817,49 +2817,49 @@ int i_APCI3200_StopCyclicAcquisition(struct comedi_device * dev, struct comedi_s int i_APCI3200_CommandAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s) { struct 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]; + unsigned int ui_Configuration = 0; + /* INT i_CurrentSource = 0; */ + unsigned int ui_Trigger = 0; + unsigned int ui_TriggerEdge = 0; + unsigned int ui_Triggermode = 0; + unsigned int ui_ScanMode = 0; + unsigned int ui_ConvertTime = 0; + unsigned int ui_ConvertTimeBase = 0; + unsigned int ui_DelayTime = 0; + unsigned int ui_DelayTimeBase = 0; + unsigned int 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) + } /* if(cmd->start_src==TRIG_EXT) */ else { ui_Trigger = 0; - } //elseif(cmd->start_src==TRIG_EXT) + } /* elseif(cmd->start_src==TRIG_EXT) */ if (cmd->stop_src == TRIG_COUNT) { ui_ScanMode = 0; - } // if (cmd->stop_src==TRIG_COUNT) + } /* if (cmd->stop_src==TRIG_COUNT) */ else { ui_ScanMode = 2; - } //else if (cmd->stop_src==TRIG_COUNT) + } /* 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) + } /* 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); + } /* 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; @@ -2868,34 +2868,34 @@ int i_APCI3200_CommandAnalogInput(struct comedi_device * dev, struct comedi_subd ui_ConvertTimeBase = 0; } - // if(i_ADDIDATAType ==1 || ((i_ADDIDATAType==2))) - // { + /* 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+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+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+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 | + /* 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]. @@ -2906,80 +2906,80 @@ int i_APCI3200_CommandAnalogInput(struct comedi_device * dev, struct comedi_subd /*************************/ /*Write the Configuration */ /*************************/ - //while (((inl(devpriv->iobase+i_Offset+12)>>19) & 1) != 1); + /* 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+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+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+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+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+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+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+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+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+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+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+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+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+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+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+i_Offset + 8); */ outl((ui_Configuration | 0x00080000), devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 8); return 0; @@ -3003,12 +3003,12 @@ int i_APCI3200_CommandAnalogInput(struct comedi_device * dev, struct comedi_subd int i_APCI3200_Reset(struct comedi_device * dev) { - INT i_Temp; - DWORD dw_Dummy; - //i_InterruptFlag=0; - //i_Initialised==0; - //i_Count=0; - //i_Sum=0; + int i_Temp; + unsigned int 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; @@ -3018,17 +3018,17 @@ int i_APCI3200_Reset(struct comedi_device * dev) outl(0x83838383, devpriv->i_IobaseAmcc + 0x60); - // Enable the interrupt for the controler + /* 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 + 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; + /* ui_InterruptChannelValue[i_Temp]=0; */ s_BoardInfos[dev->minor].ui_InterruptChannelValue[i_Temp] = 0; - } //for(i_Temp=0;i_Temp<=95;i_Temp++) + } /* for(i_Temp=0;i_Temp<=95;i_Temp++) */ /*****************************/ /*Reset the START and IRQ bit */ /*****************************/ @@ -3036,7 +3036,7 @@ int i_APCI3200_Reset(struct comedi_device * dev) 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) + } /* for(i_Temp=0;i_Temp<=192;i_Temp+64) */ return 0; } @@ -3060,26 +3060,26 @@ int i_APCI3200_Reset(struct comedi_device * dev) void v_APCI3200_Interrupt(int irq, void *d) { struct 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; + unsigned int ui_StatusRegister = 0; + unsigned int ui_ChannelNumber = 0; + int i_CalibrationFlag = 0; + int i_CJCFlag = 0; + unsigned int ui_DummyValue = 0; + unsigned int ui_DigitalTemperature = 0; + unsigned int ui_DigitalInput = 0; int i_ConvertCJCCalibration; - //BEGIN JK TEST + /* BEGIN JK TEST */ int i_ReturnValue = 0; - //END JK TEST + /* END JK TEST */ - //printk ("\n i_ScanType = %i i_ADDIDATAType = %i", s_BoardInfos [dev->minor].i_ScanType, s_BoardInfos [dev->minor].i_ADDIDATAType); + /* printk ("\n i_ScanType = %i i_ADDIDATAType = %i", s_BoardInfos [dev->minor].i_ScanType, s_BoardInfos [dev->minor].i_ADDIDATAType); */ - //switch(i_ScanType) + /* switch(i_ScanType) */ switch (s_BoardInfos[dev->minor].i_ScanType) { case 0: case 1: - //switch(i_ADDIDATAType) + /* switch(i_ADDIDATAType) */ switch (s_BoardInfos[dev->minor].i_ADDIDATAType) { case 0: case 1: @@ -3087,12 +3087,12 @@ void v_APCI3200_Interrupt(int irq, void *d) /************************************/ /*Read the interrupt status register */ /************************************/ - //ui_StatusRegister = inl(devpriv->iobase+i_Offset + 16); + /* 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+i_Offset + 12) & 0x00060000) >> 17); */ i_CalibrationFlag = ((inl(devpriv->iobase + s_BoardInfos[dev-> @@ -3103,12 +3103,12 @@ void v_APCI3200_Interrupt(int irq, void *d) /*************************/ /*Read the channel number */ /*************************/ - //ui_ChannelNumber = inl(devpriv->iobase+i_Offset + 24); + /* 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+i_Offset + 28); */ ui_DigitalInput = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 28); @@ -3117,13 +3117,13 @@ void v_APCI3200_Interrupt(int irq, void *d) /* Test if the value read is the channel value */ /***********************************************/ if (i_CalibrationFlag == 0) { - //ui_InterruptChannelValue[i_Count + 0] = ui_DigitalInput; + /* 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 + /* 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, @@ -3131,14 +3131,14 @@ void v_APCI3200_Interrupt(int irq, void *d) &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 + /* 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) + } /* if (i_CalibrationFlag == 0) */ /**********************************************************/ /* Test if the value read is the calibration offset value */ /**********************************************************/ @@ -3149,7 +3149,7 @@ void v_APCI3200_Interrupt(int irq, void *d) /* Save the value */ /******************/ - //ui_InterruptChannelValue[i_Count + 1] = ui_DigitalInput; + /* ui_InterruptChannelValue[i_Count + 1] = ui_DigitalInput; */ s_BoardInfos[dev->minor]. ui_InterruptChannelValue [s_BoardInfos[dev->minor]. @@ -3160,7 +3160,7 @@ void v_APCI3200_Interrupt(int irq, void *d) /******************************************************/ i_APCI3200_ReadCalibrationGainValue(dev, &ui_DummyValue); - } //if (i_CalibrationFlag == 1) + } /* if (i_CalibrationFlag == 1) */ /******************************************************/ /*Test if the value read is the calibration gain value */ /******************************************************/ @@ -3170,48 +3170,48 @@ void v_APCI3200_Interrupt(int irq, void *d) /****************/ /*Save the value */ /****************/ - //ui_InterruptChannelValue[i_Count + 2] = ui_DigitalInput; + /* 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(i_ScanType==1) */ if (s_BoardInfos[dev->minor]. i_ScanType == 1) { - //i_InterruptFlag=0; + /* 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; + /* 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) + /* End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ + } /* if(i_ScanType==1) */ else { - //i_Count=0; + /* i_Count=0; */ s_BoardInfos[dev->minor]. i_Count = 0; - } //elseif(i_ScanType==1) - //if(i_ScanType!=1) + } /* 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) + 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(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 + 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) + } /* if(i_ScanType!=1) */ + } /* if (i_CalibrationFlag == 2) */ + } /* if ((ui_StatusRegister & 0x2) == 0x2) */ break; @@ -3220,7 +3220,7 @@ void v_APCI3200_Interrupt(int irq, void *d) /*Read the interrupt status register */ /************************************/ - //ui_StatusRegister = inl(devpriv->iobase+i_Offset + 16); + /* ui_StatusRegister = inl(devpriv->iobase+i_Offset + 16); */ ui_StatusRegister = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 16); @@ -3230,7 +3230,7 @@ void v_APCI3200_Interrupt(int irq, void *d) 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-> @@ -3238,7 +3238,7 @@ void v_APCI3200_Interrupt(int irq, void *d) 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-> @@ -3251,19 +3251,19 @@ void v_APCI3200_Interrupt(int irq, void *d) /*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 + /* 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 + /* 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); + /* ui_DigitalTemperature = inl(devpriv->iobase+i_Offset + 28); */ ui_DigitalTemperature = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 28); @@ -3274,7 +3274,7 @@ void v_APCI3200_Interrupt(int irq, void *d) if ((i_CalibrationFlag == 0) && (i_CJCFlag == 0)) { - //ui_InterruptChannelValue[i_Count + 0]=ui_DigitalTemperature; + /* ui_InterruptChannelValue[i_Count + 0]=ui_DigitalTemperature; */ s_BoardInfos[dev->minor]. ui_InterruptChannelValue [s_BoardInfos[dev->minor]. @@ -3287,7 +3287,7 @@ void v_APCI3200_Interrupt(int irq, void *d) i_APCI3200_ReadCJCValue(dev, &ui_DummyValue); - } //if ((i_CalibrationFlag == 0) && (i_CJCFlag == 0)) + } /* if ((i_CalibrationFlag == 0) && (i_CJCFlag == 0)) */ /*****************************************/ /*Test if the value read is the CJC value */ @@ -3295,7 +3295,7 @@ void v_APCI3200_Interrupt(int irq, void *d) if ((i_CJCFlag == 1) && (i_CalibrationFlag == 0)) { - //ui_InterruptChannelValue[i_Count + 3]=ui_DigitalTemperature; + /* ui_InterruptChannelValue[i_Count + 3]=ui_DigitalTemperature; */ s_BoardInfos[dev->minor]. ui_InterruptChannelValue [s_BoardInfos[dev->minor]. @@ -3307,7 +3307,7 @@ void v_APCI3200_Interrupt(int irq, void *d) /******************************************************/ i_APCI3200_ReadCalibrationOffsetValue (dev, &ui_DummyValue); - } // if ((i_CJCFlag == 1) && (i_CalibrationFlag == 0)) + } /* if ((i_CJCFlag == 1) && (i_CalibrationFlag == 0)) */ /********************************************************/ /*Test if the value read is the calibration offset value */ @@ -3315,7 +3315,7 @@ void v_APCI3200_Interrupt(int irq, void *d) if ((i_CalibrationFlag == 1) && (i_CJCFlag == 0)) { - //ui_InterruptChannelValue[i_Count + 1]=ui_DigitalTemperature; + /* ui_InterruptChannelValue[i_Count + 1]=ui_DigitalTemperature; */ s_BoardInfos[dev->minor]. ui_InterruptChannelValue [s_BoardInfos[dev->minor]. @@ -3328,7 +3328,7 @@ void v_APCI3200_Interrupt(int irq, void *d) 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 */ @@ -3336,7 +3336,7 @@ void v_APCI3200_Interrupt(int irq, void *d) if ((i_CalibrationFlag == 2) && (i_CJCFlag == 0)) { - //ui_InterruptChannelValue[i_Count + 2]=ui_DigitalTemperature; + /* ui_InterruptChannelValue[i_Count + 2]=ui_DigitalTemperature; */ s_BoardInfos[dev->minor]. ui_InterruptChannelValue [s_BoardInfos[dev->minor]. @@ -3349,15 +3349,15 @@ void v_APCI3200_Interrupt(int irq, void *d) /*Test if the polarity is the same */ /**********************************/ - //if(i_CJCPolarity!=i_ADDIDATAPolarity) + /* 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) + } /* if(i_CJCPolarity!=i_ADDIDATAPolarity) */ else { - //if(i_CJCGain==i_ADDIDATAGain) + /* if(i_CJCGain==i_ADDIDATAGain) */ if (s_BoardInfos[dev->minor]. i_CJCGain == s_BoardInfos[dev-> @@ -3365,12 +3365,12 @@ void v_APCI3200_Interrupt(int irq, void *d) i_ADDIDATAGain) { i_ConvertCJCCalibration = 0; - } //if(i_CJCGain==i_ADDIDATAGain) + } /* if(i_CJCGain==i_ADDIDATAGain) */ else { i_ConvertCJCCalibration = 1; - } //elseif(i_CJCGain==i_ADDIDATAGain) - } //elseif(i_CJCPolarity!=i_ADDIDATAPolarity) + } /* 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 */ @@ -3378,10 +3378,10 @@ void v_APCI3200_Interrupt(int irq, void *d) i_APCI3200_ReadCJCCalOffset(dev, &ui_DummyValue); - } //if(i_ConvertCJCCalibration==1) + } /* if(i_ConvertCJCCalibration==1) */ else { - //ui_InterruptChannelValue[i_Count + 4]=0; - //ui_InterruptChannelValue[i_Count + 5]=0; + /* ui_InterruptChannelValue[i_Count + 4]=0; */ + /* ui_InterruptChannelValue[i_Count + 5]=0; */ s_BoardInfos[dev->minor]. ui_InterruptChannelValue [s_BoardInfos[dev-> @@ -3392,8 +3392,8 @@ void v_APCI3200_Interrupt(int irq, void *d) [s_BoardInfos[dev-> minor].i_Count + 5] = 0; - } //elseif(i_ConvertCJCCalibration==1) - } //else if ((i_CalibrationFlag == 2) && (i_CJCFlag == 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 */ @@ -3401,7 +3401,7 @@ void v_APCI3200_Interrupt(int irq, void *d) if ((i_CalibrationFlag == 1) && (i_CJCFlag == 1)) { - //ui_InterruptChannelValue[i_Count + 4]=ui_DigitalTemperature; + /* ui_InterruptChannelValue[i_Count + 4]=ui_DigitalTemperature; */ s_BoardInfos[dev->minor]. ui_InterruptChannelValue [s_BoardInfos[dev->minor]. @@ -3414,7 +3414,7 @@ void v_APCI3200_Interrupt(int irq, void *d) 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 */ @@ -3422,61 +3422,61 @@ void v_APCI3200_Interrupt(int irq, void *d) if ((i_CalibrationFlag == 2) && (i_CJCFlag == 1)) { - //ui_InterruptChannelValue[i_Count + 5]=ui_DigitalTemperature; + /* 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(i_ScanType==1) */ if (s_BoardInfos[dev->minor]. i_ScanType == 1) { - //i_InterruptFlag=0; + /* 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; + /* 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) + /* End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ + } /* if(i_ScanType==1) */ else { - //i_Count=0; + /* i_Count=0; */ s_BoardInfos[dev->minor]. i_Count = 0; - } //elseif(i_ScanType==1) + } /* elseif(i_ScanType==1) */ - //if(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 - } //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) + /* 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 + send_sig(SIGIO, devpriv->tsk_Current, 0); /* send signal to the sample */ - } //if(i_ChannelCount==i_Sum) - } //else if(i_ScanType!=1) - } //if ((i_CalibrationFlag == 2) && (i_CJCFlag == 1)) + } /* if(i_ChannelCount==i_Sum) */ + } /* else if(i_ScanType!=1) */ + } /* if ((i_CalibrationFlag == 2) && (i_CJCFlag == 1)) */ - } //else if ((ui_StatusRegister & 0x2) == 0x2) + } /* else if ((ui_StatusRegister & 0x2) == 0x2) */ break; - } //switch(i_ADDIDATAType) + } /* switch(i_ADDIDATAType) */ break; case 2: case 3: i_APCI3200_InterruptHandleEos(dev); break; - } //switch(i_ScanType) + } /* switch(i_ScanType) */ return; } @@ -3501,20 +3501,20 @@ void v_APCI3200_Interrupt(int irq, void *d) */ int i_APCI3200_InterruptHandleEos(struct comedi_device * dev) { - UINT ui_StatusRegister = 0; + unsigned int ui_StatusRegister = 0; struct 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 + /* 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 + /* 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); + /* ui_StatusRegister = inl(devpriv->iobase+i_Offset + 16); */ ui_StatusRegister = inl(devpriv->iobase + s_BoardInfos[dev->minor].i_Offset + 16); @@ -3526,33 +3526,33 @@ int i_APCI3200_InterruptHandleEos(struct comedi_device * dev) /*************************/ /*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); + /* 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 + /* 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); + /* 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 + /* End JK 18.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */ - //if((i_Count == (i_LastChannel-i_FirstChannel+3))) + /* 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 + /* 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; @@ -3582,61 +3582,61 @@ int i_APCI3200_InterruptHandleEos(struct comedi_device * dev) * 3) + 2]); } - //End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values + /* End JK 22.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ - //i_Count=-1; + /* 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); + /* async->buf_int_count+=(i_LastChannel-i_FirstChannel+4)*sizeof(unsigned int); */ + /* 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(unsigned int); */ + /* 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(unsigned int); */ + /* 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(unsigned int); */ + /* comedi_eos(dev,s); */ - // Set the event type (Comedi Buffer End Of Scan) + /* 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(unsigned int)); + /* Test if enougth memory is available and allocate it for 7 values */ + /* n = comedi_buf_write_alloc(s->async, 7*sizeof(unsigned int)); */ n = comedi_buf_write_alloc(s->async, (7 + 12) * sizeof(unsigned int)); - // If not enougth memory available, event is set to Comedi Buffer Errror + /* If not enougth memory available, event is set to Comedi Buffer Errror */ if (n > ((7 + 12) * sizeof(unsigned int))) { printk("\ncomedi_buf_write_alloc n = %i", n); s->async->events |= COMEDI_CB_ERROR; } - // Write all 7 scan values in the comedi buffer + /* Write all 7 scan values in the comedi buffer */ comedi_buf_memcpy_to(s->async, 0, (unsigned int *) s_BoardInfos[dev->minor]. ui_ScanValueArray, (7 + 12) * sizeof(unsigned int)); - // Update comedi buffer pinters indexes + /* Update comedi buffer pinters indexes */ comedi_buf_write_free(s->async, (7 + 12) * sizeof(unsigned int)); - // Send events + /* Send events */ comedi_event(dev, s); - //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 + /* 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++; + /* i_Count++; */ s_BoardInfos[dev->minor].i_Count++; } - //i_InterruptFlag=0; + /* i_InterruptFlag=0; */ s_BoardInfos[dev->minor].i_InterruptFlag = 0; return 0; } diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.h index a6f57f55e79c..f3e7ebf8c1f3 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.h @@ -15,26 +15,26 @@ * any later version. */ -// Card Specific information +/* Card Specific information */ #define APCI3200_BOARD_VENDOR_ID 0x15B8 -//#define APCI3200_ADDRESS_RANGE 264 +/* #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; + int i_Gain; + int i_Polarity; + int i_OffsetRange; + int i_Coupling; + int i_SingleDiff; + int i_AutoCalibration; + unsigned int ui_ReloadValue; + unsigned int ui_TimeUnitReloadVal; + int i_Interrupt; + int i_ModuleSelection; } Config_Parameters_Module1, Config_Parameters_Module2, Config_Parameters_Module3, Config_Parameters_Module4; -//ANALOG INPUT RANGE +/* ANALOG INPUT RANGE */ static const struct comedi_lrange range_apci3200_ai = { 8, { BIP_RANGE(10), BIP_RANGE(5), @@ -55,7 +55,7 @@ static const struct comedi_lrange range_apci3300_ai = { 4, { } }; -//Analog Input related Defines +/* Analog Input related Defines */ #define APCI3200_AI_OFFSET_GAIN 0 #define APCI3200_AI_SC_TEST 4 #define APCI3200_AI_IRQ 8 @@ -89,98 +89,102 @@ static const struct comedi_lrange range_apci3300_ai = { 4, { #define ADDIDATA_UNIPOLAR 1 #define ADDIDATA_BIPOLAR 2 -//BEGIN 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 */ #define MAX_MODULE 4 -//END JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values +/* 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; +struct str_ADDIDATA_RTDStruct { + unsigned int ul_NumberOfValue; + unsigned int *pul_ResistanceValue; + unsigned int *pul_TemperatureValue; +}; + +/* BEGIN JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ +struct str_Module { -//BEGIN JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values -typedef struct { - // Begin JK 05/08/2003 change for Linux + /* 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 + /* 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 + /* 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 - unsigned int 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(struct comedi_device *dev, struct comedi_subdevice *s, + /* End CG 15/02/02 Rev 1.0 -> Rev 1.1 : Add Header Type 1 */ +}; + +/* END JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ + +/* BEGIN JK 06.07.04: Management of sevrals boards */ +struct str_BoardInfos { + + 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; + unsigned int ui_Channel_num; + int i_Count; + int i_Initialised; + /* UINT ui_InterruptChannelValue[96]; //Buffer */ + unsigned int ui_InterruptChannelValue[144]; /* Buffer */ + unsigned char b_StructInitialized; + /* Begin JK 19.10.2004: APCI-3200 Driver update 0.7.57 -> 0.7.68 */ + unsigned int 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; + struct str_Module s_Module[MAX_MODULE]; + /* End JK 21.10.2004: APCI-3200 / APCI-3300 Reading of EEPROM values */ +}; + +/* END JK 06.07.04: Management of sevrals boards */ + +/* Hardware Layer functions for Apci3200 */ + +/* AI */ + +int i_APCI3200_ConfigAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI3200_ReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI3200_ReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI3200_InsnWriteReleaseAnalogInput(struct comedi_device *dev, +int i_APCI3200_InsnWriteReleaseAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device *dev, +int i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI3200_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_subdevice *s); -INT i_APCI3200_InterruptHandleEos(struct comedi_device *dev); -INT i_APCI3200_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI3200_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_subdevice *s); +int i_APCI3200_InterruptHandleEos(struct comedi_device *dev); +int i_APCI3200_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd); -INT i_APCI3200_CommandAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s); -INT i_APCI3200_ReadDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI3200_CommandAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s); +int i_APCI3200_ReadDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -//Interrupt +/* Interrupt */ void v_APCI3200_Interrupt(int irq, void *d); int i_APCI3200_InterruptHandleEos(struct comedi_device *dev); -//Reset functions -INT i_APCI3200_Reset(struct comedi_device *dev); +/* Reset functions */ +int i_APCI3200_Reset(struct comedi_device *dev); int i_APCI3200_ReadCJCCalOffset(struct comedi_device *dev, unsigned int *data); int i_APCI3200_ReadCJCValue(struct comedi_device *dev, unsigned int *data); -int i_APCI3200_ReadCalibrationGainValue(struct comedi_device *dev, UINT *data); -int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device *dev, UINT *data); +int i_APCI3200_ReadCalibrationGainValue(struct comedi_device *dev, unsigned int *data); +int i_APCI3200_ReadCalibrationOffsetValue(struct comedi_device *dev, unsigned int *data); int i_APCI3200_Read1AnalogInputChannel(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c index 20391a91da03..dfca2e6d4d8c 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c @@ -62,8 +62,8 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc | Task : Read value of the selected channel or port | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To read | -| UINT *data : Data Pointer to read status | +| unsigned int ui_NoOfChannels : No Of Channels To read | +| unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -73,26 +73,26 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc +----------------------------------------------------------------------------+ */ -INT i_APCI3501_ReadDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI3501_ReadDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_Temp; - UINT ui_NoOfChannel; + unsigned int ui_Temp; + unsigned int ui_NoOfChannel; ui_NoOfChannel = CR_CHAN(insn->chanspec); ui_Temp = data[0]; *data = inl(devpriv->iobase + APCI3501_DIGITAL_IP); if (ui_Temp == 0) { *data = (*data >> ui_NoOfChannel) & 0x1; - } //if (ui_Temp==0) + } /* if (ui_Temp==0) */ else { if (ui_Temp == 1) { *data = *data & 0x3; - } //if (ui_Temp==1) + } /* if (ui_Temp==1) */ else { printk("\nSpecified channel not supported \n"); - } //elseif (ui_Temp==1) - } //elseif (ui_Temp==0) + } /* elseif (ui_Temp==1) */ + } /* elseif (ui_Temp==0) */ return insn->n; } @@ -105,7 +105,7 @@ INT i_APCI3501_ReadDigitalInput(struct comedi_device * dev, struct comedi_subdev | Task : Configures The Digital Output Subdevice. | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | +| unsigned int *data : Data Pointer contains | | configuration parameters as below | | | | data[1] : 1 Enable VCC Interrupt | @@ -129,13 +129,13 @@ int i_APCI3501_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub 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) ) */ if (data[0]) { devpriv->b_OutputMemoryStatus = ADDIDATA_ENABLE; - } // if (data[0]) + } /* if (data[0]) */ else { devpriv->b_OutputMemoryStatus = ADDIDATA_DISABLE; - } //else if (data[0]) + } /* else if (data[0]) */ return insn->n; } @@ -161,33 +161,33 @@ int i_APCI3501_ConfigDigitalOutput(struct comedi_device * dev, struct comedi_sub | | +----------------------------------------------------------------------------+ */ -INT i_APCI3501_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI3501_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_Temp, ui_Temp1; - UINT ui_NoOfChannel = CR_CHAN(insn->chanspec); // get the channel + unsigned int ui_Temp, ui_Temp1; + unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */ if (devpriv->b_OutputMemoryStatus) { ui_Temp = inl(devpriv->iobase + APCI3501_DIGITAL_OP); - } //if(devpriv->b_OutputMemoryStatus ) + } /* if(devpriv->b_OutputMemoryStatus ) */ else { ui_Temp = 0; - } //if(devpriv->b_OutputMemoryStatus ) + } /* if(devpriv->b_OutputMemoryStatus ) */ if (data[3] == 0) { if (data[1] == 0) { data[0] = (data[0] << ui_NoOfChannel) | ui_Temp; outl(data[0], devpriv->iobase + APCI3501_DIGITAL_OP); - } //if(data[1]==0) + } /* if(data[1]==0) */ else { if (data[1] == 1) { data[0] = (data[0] << (2 * data[2])) | ui_Temp; outl(data[0], devpriv->iobase + APCI3501_DIGITAL_OP); - } // if(data[1]==1) + } /* 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[1]==1) */ + } /* elseif(data[1]==0) */ + } /* if(data[3]==0) */ else { if (data[3] == 1) { if (data[1] == 0) { @@ -201,7 +201,7 @@ INT i_APCI3501_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd data[0] = data[0] & ui_Temp; outl(data[0], devpriv->iobase + APCI3501_DIGITAL_OP); - } //if(data[1]==0) + } /* if(data[1]==0) */ else { if (data[1] == 1) { data[0] = ~data[0] & 0x3; @@ -215,17 +215,17 @@ INT i_APCI3501_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd outl(data[0], devpriv->iobase + APCI3501_DIGITAL_OP); - } // if(data[1]==1) + } /* 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 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) + } /* if else data[3]==1) */ + } /* if else data[3]==0) */ return insn->n; } @@ -238,8 +238,8 @@ INT i_APCI3501_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd | Task : Read value of the selected channel or port | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT ui_NoOfChannels : No Of Channels To read | -| UINT *data : Data Pointer to read status | +| unsigned int ui_NoOfChannels : No Of Channels To read | +| unsigned int *data : Data Pointer to read status | +----------------------------------------------------------------------------+ | Output Parameters : -- | +----------------------------------------------------------------------------+ @@ -248,27 +248,27 @@ INT i_APCI3501_WriteDigitalOutput(struct comedi_device * dev, struct comedi_subd | | +----------------------------------------------------------------------------+ */ -INT i_APCI3501_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI3501_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - UINT ui_Temp; - UINT ui_NoOfChannel; + unsigned int ui_Temp; + unsigned int ui_NoOfChannel; ui_NoOfChannel = CR_CHAN(insn->chanspec); ui_Temp = data[0]; *data = inl(devpriv->iobase + APCI3501_DIGITAL_OP); if (ui_Temp == 0) { *data = (*data >> ui_NoOfChannel) & 0x1; - } // if (ui_Temp==0) + } /* if (ui_Temp==0) */ else { if (ui_Temp == 1) { *data = *data & 0x3; - } // if (ui_Temp==1) + } /* if (ui_Temp==1) */ else { printk("\nSpecified channel not supported \n"); - } // else if (ui_Temp==1) - } // else if (ui_Temp==0) + } /* else if (ui_Temp==1) */ + } /* else if (ui_Temp==0) */ return insn->n; } @@ -298,7 +298,7 @@ INT i_APCI3501_ReadDigitalOutput(struct comedi_device * dev, struct comedi_subde | | +----------------------------------------------------------------------------+ */ -INT i_APCI3501_ConfigAnalogOutput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI3501_ConfigAnalogOutput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { outl(data[0], @@ -336,10 +336,10 @@ INT i_APCI3501_ConfigAnalogOutput(struct comedi_device * dev, struct comedi_subd | | +----------------------------------------------------------------------------+ */ -INT i_APCI3501_WriteAnalogOutput(struct comedi_device * dev, struct comedi_subdevice * s, +int i_APCI3501_WriteAnalogOutput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - ULONG ul_Command1 = 0, ul_Channel_no, ul_Polarity, ul_DAC_Ready = 0;; + unsigned int ul_Command1 = 0, ul_Channel_no, ul_Polarity, ul_DAC_Ready = 0;; ul_Channel_no = CR_CHAN(insn->chanspec); @@ -349,18 +349,18 @@ INT i_APCI3501_WriteAnalogOutput(struct comedi_device * dev, struct comedi_subde printk("\nIn WriteAnalogOutput :: Not Valid Data\n"); } - } // end if(devpriv->b_InterruptMode==MODE1) + } /* end if(devpriv->b_InterruptMode==MODE1) */ else { ul_Polarity = 0; if ((*data < 0) || (*data > 8192)) { printk("\nIn WriteAnalogOutput :: Not Valid Data\n"); } - } // end else + } /* end else */ if ((ul_Channel_no < 0) || (ul_Channel_no > 7)) { printk("\nIn WriteAnalogOutput :: Not Valid Channel\n"); - } // end if((ul_Channel_no<0)||(ul_Channel_no>7)) + } /* end if((ul_Channel_no<0)||(ul_Channel_no>7)) */ ul_DAC_Ready = inl(devpriv->iobase + APCI3501_ANALOG_OUTPUT); @@ -370,11 +370,11 @@ INT i_APCI3501_WriteAnalogOutput(struct comedi_device * dev, struct comedi_subde } if (ul_DAC_Ready) { -// Output the Value on the output channels. +/* Output the Value on the output channels. */ ul_Command1 = - (ULONG) ((ULONG) (ul_Channel_no & 0xFF) | - (ULONG) ((*data << 0x8) & 0x7FFFFF00L) | - (ULONG) (ul_Polarity)); + (unsigned int) ((unsigned int) (ul_Channel_no & 0xFF) | + (unsigned int) ((*data << 0x8) & 0x7FFFFF00L) | + (unsigned int) (ul_Polarity)); outl(ul_Command1, devpriv->iobase + APCI3501_ANALOG_OUTPUT + APCI3501_AO_PROG); @@ -392,7 +392,7 @@ INT i_APCI3501_WriteAnalogOutput(struct comedi_device * dev, struct comedi_subde | Task : Configures The Timer , Counter or Watchdog | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | +| unsigned int *data : Data Pointer contains | | configuration parameters as below | | | | data[0] : 0 Configure As Timer | @@ -410,78 +410,78 @@ INT i_APCI3501_WriteAnalogOutput(struct comedi_device * dev, struct comedi_subde | | +----------------------------------------------------------------------------+ */ -INT i_APCI3501_ConfigTimerCounterWatchdog(struct comedi_device * dev, +int i_APCI3501_ConfigTimerCounterWatchdog(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - ULONG ul_Command1 = 0; + unsigned int ul_Command1 = 0; devpriv->tsk_Current = current; if (data[0] == ADDIDATA_WATCHDOG) { devpriv->b_TimerSelectMode = ADDIDATA_WATCHDOG; - //Disable the watchdog - outl(0x0, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); //disable Wa + /* Disable the watchdog */ + outl(0x0, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); /* disable Wa */ if (data[1] == 1) { - //Enable TIMER int & DISABLE ALL THE OTHER int SOURCES + /* Enable TIMER int & DISABLE ALL THE OTHER int SOURCES */ outl(0x02, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); } else { - outl(0x0, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); //disable Timer interrupt + outl(0x0, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); /* disable Timer interrupt */ } - //Loading the Timebase value + /* Loading the Timebase value */ outl(data[2], devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_TIMEBASE); - //Loading the Reload value + /* Loading the Reload value */ outl(data[3], devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_RELOAD_VALUE); - //Set the mode - ul_Command1 = inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG) | 0xFFF819E0UL; //e2->e0 + /* Set the mode */ + ul_Command1 = inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG) | 0xFFF819E0UL; /* e2->e0 */ outl(ul_Command1, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); - } //end if(data[0]==ADDIDATA_WATCHDOG) + } /* end if(data[0]==ADDIDATA_WATCHDOG) */ else if (data[0] == ADDIDATA_TIMER) { - //First Stop The Timer + /* First Stop The Timer */ ul_Command1 = inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); ul_Command1 = ul_Command1 & 0xFFFFF9FEUL; - outl(ul_Command1, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); //Stop The Timer + outl(ul_Command1, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); /* Stop The Timer */ devpriv->b_TimerSelectMode = ADDIDATA_TIMER; if (data[1] == 1) { - //Enable TIMER int & DISABLE ALL THE OTHER int SOURCES + /* Enable TIMER int & DISABLE ALL THE OTHER int SOURCES */ outl(0x02, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); } else { - outl(0x0, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); //disable Timer interrupt + outl(0x0, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); /* disable Timer interrupt */ } - // Loading Timebase + /* Loading Timebase */ outl(data[2], devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_TIMEBASE); - //Loading the Reload value + /* Loading the Reload value */ outl(data[3], devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_RELOAD_VALUE); - // printk ("\nTimer Address :: %x\n", (devpriv->iobase+APCI3501_WATCHDOG)); + /* printk ("\nTimer Address :: %x\n", (devpriv->iobase+APCI3501_WATCHDOG)); */ ul_Command1 = inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); ul_Command1 = (ul_Command1 & 0xFFF719E2UL) | 2UL << 13UL | 0x10UL; - outl(ul_Command1, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); //mode 2 + outl(ul_Command1, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); /* mode 2 */ - } //end if(data[0]==ADDIDATA_TIMER) + } /* end if(data[0]==ADDIDATA_TIMER) */ return insn->n; } @@ -495,7 +495,7 @@ INT i_APCI3501_ConfigTimerCounterWatchdog(struct comedi_device * dev, | Task : Start / Stop The Selected Timer , Counter or Watchdog | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | +| unsigned int *data : Data Pointer contains | | configuration parameters as below | | | | data[0] : 0 Timer | @@ -514,7 +514,7 @@ INT i_APCI3501_ConfigTimerCounterWatchdog(struct comedi_device * dev, int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - ULONG ul_Command1 = 0; + unsigned int ul_Command1 = 0; int i_Temp; if (devpriv->b_TimerSelectMode == ADDIDATA_WATCHDOG) { @@ -523,15 +523,15 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x1UL; - //Enable the Watchdog + /* Enable the Watchdog */ outl(ul_Command1, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); } - else if (data[1] == 0) //Stop The Watchdog + else if (data[1] == 0) /* Stop The Watchdog */ { - //Stop The Watchdog + /* Stop The Watchdog */ ul_Command1 = inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); @@ -547,8 +547,8 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, outl(ul_Command1, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); - } //if(data[1]==2) - } // end if (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) + } /* if(data[1]==2) */ + } /* end if (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) */ if (devpriv->b_TimerSelectMode == ADDIDATA_TIMER) { if (data[1] == 1) { @@ -557,12 +557,12 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); ul_Command1 = (ul_Command1 & 0xFFFFF9FFUL) | 0x1UL; - //Enable the Timer + /* Enable the Timer */ outl(ul_Command1, devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); } else if (data[1] == 0) { - //Stop The Timer + /* Stop The Timer */ ul_Command1 = inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); @@ -573,7 +573,7 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, } else if (data[1] == 2) { - //Trigger the Timer + /* Trigger the Timer */ ul_Command1 = inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); @@ -583,7 +583,7 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, APCI3501_TCW_PROG); } - } // end if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) + } /* end if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) */ i_Temp = inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_TRIG_STATUS) & 0x1; return insn->n; @@ -598,7 +598,7 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device * dev, | Task : Read The Selected Timer , Counter or Watchdog | +----------------------------------------------------------------------------+ | Input Parameters : struct comedi_device *dev : Driver handle | -| UINT *data : Data Pointer contains | +| unsigned int *data : Data Pointer contains | | configuration parameters as below | | | | data[0] : 0 Timer | @@ -622,14 +622,14 @@ int i_APCI3501_ReadTimerCounterWatchdog(struct comedi_device * dev, inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_TRIG_STATUS) & 0x1; data[1] = inl(devpriv->iobase + APCI3501_WATCHDOG); - } // end if (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) + } /* end if (devpriv->b_TimerSelectMode==ADDIDATA_WATCHDOG) */ else if (devpriv->b_TimerSelectMode == ADDIDATA_TIMER) { data[0] = inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_TRIG_STATUS) & 0x1; data[1] = inl(devpriv->iobase + APCI3501_WATCHDOG); - } // end if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) + } /* end if (devpriv->b_TimerSelectMode==ADDIDATA_TIMER) */ else if ((devpriv->b_TimerSelectMode != ADDIDATA_TIMER) && (devpriv->b_TimerSelectMode != ADDIDATA_WATCHDOG)) { @@ -657,7 +657,7 @@ int i_APCI3501_ReadTimerCounterWatchdog(struct comedi_device * dev, int i_APCI3501_Reset(struct comedi_device * dev) { int i_Count = 0, i_temp = 0; - ULONG ul_Command1 = 0, ul_Polarity, ul_DAC_Ready = 0; + unsigned int ul_Command1 = 0, ul_Polarity, ul_DAC_Ready = 0; outl(0x0, devpriv->iobase + APCI3501_DIGITAL_OP); outl(1, devpriv->iobase + APCI3501_ANALOG_OUTPUT + APCI3501_AO_VOLT_MODE); @@ -674,11 +674,11 @@ int i_APCI3501_Reset(struct comedi_device * dev) } if (ul_DAC_Ready) { - // Output the Value on the output channels. + /* Output the Value on the output channels. */ ul_Command1 = - (ULONG) ((ULONG) (i_Count & 0xFF) | - (ULONG) ((i_temp << 0x8) & 0x7FFFFF00L) | - (ULONG) (ul_Polarity)); + (unsigned int) ((unsigned int) (i_Count & 0xFF) | + (unsigned int) ((i_temp << 0x8) & 0x7FFFFF00L) | + (unsigned int) (ul_Polarity)); outl(ul_Command1, devpriv->iobase + APCI3501_ANALOG_OUTPUT + APCI3501_AO_PROG); @@ -711,7 +711,7 @@ void v_APCI3501_Interrupt(int irq, void *d) struct comedi_device *dev = d; unsigned int ui_Timer_AOWatchdog; unsigned long ul_Command1; - // Disable Interrupt + /* Disable Interrupt */ ul_Command1 = inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); @@ -728,8 +728,9 @@ void v_APCI3501_Interrupt(int irq, void *d) return; } - // Enable Interrupt - //Send a signal to from kernel to user space +/* +* Enable Interrupt Send a signal to from kernel to user space +*/ send_sig(SIGIO, devpriv->tsk_Current, 0); ul_Command1 = inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.h index 51e7b66544ac..c456d75674b8 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.h @@ -15,7 +15,7 @@ * any later version. */ -// Card Specific information +/* Card Specific information */ #define APCI3501_BOARD_VENDOR_ID 0x15B8 #define APCI3501_ADDRESS_RANGE 255 @@ -23,7 +23,7 @@ #define APCI3501_DIGITAL_OP 0x40 #define APCI3501_ANALOG_OUTPUT 0x00 -//Analog Output related Defines +/* Analog Output related Defines */ #define APCI3501_AO_VOLT_MODE 0 #define APCI3501_AO_PROG 4 #define APCI3501_AO_TRIG_SCS 8 @@ -31,14 +31,14 @@ #define BIPOLAR 1 #define MODE0 0 #define MODE1 1 -// ANALOG OUTPUT RANGE +/* ANALOG OUTPUT RANGE */ struct comedi_lrange range_apci3501_ao = { 2, { BIP_RANGE(10), UNI_RANGE(10) } }; -//Watchdog Related Defines +/* Watchdog Related Defines */ #define APCI3501_WATCHDOG 0x20 #define APCI3501_TCW_SYNC_ENABLEDISABLE 0 @@ -52,32 +52,36 @@ struct comedi_lrange range_apci3501_ao = { 2, { #define ADDIDATA_TIMER 0 #define ADDIDATA_WATCHDOG 2 -// Hardware Layer functions for Apci3501 +/* Hardware Layer functions for Apci3501 */ -//AO -INT i_APCI3501_ConfigAnalogOutput(struct comedi_device *dev, struct comedi_subdevice *s, +/* AO */ +int i_APCI3501_ConfigAnalogOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI3501_WriteAnalogOutput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI3501_WriteAnalogOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -//DI -// for di read -//INT i_APCI3501_ReadDigitalInput(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data); +/* +* DI for di read INT i_APCI3501_ReadDigitalInput(struct +* comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn +* *insn,unsigned int *data); +*/ -INT i_APCI3501_ReadDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI3501_ReadDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -//DO +/* DO */ int i_APCI3501_ConfigDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI3501_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI3501_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -INT i_APCI3501_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, +int i_APCI3501_ReadDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -// TIMER -// timer value is passed as u seconds -INT i_APCI3501_ConfigTimerCounterWatchdog(struct comedi_device *dev, +/* TIMER + * timer value is passed as u seconds + */ + +int i_APCI3501_ConfigTimerCounterWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device *dev, @@ -87,8 +91,8 @@ int i_APCI3501_StartStopWriteTimerCounterWatchdog(struct comedi_device *dev, int i_APCI3501_ReadTimerCounterWatchdog(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -//Interrupt +/* Interrupt */ void v_APCI3501_Interrupt(int irq, void *d); -//Reset functions +/* Reset functions */ int i_APCI3501_Reset(struct comedi_device *dev); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c index b7268e4da64e..8c630d72ad41 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c @@ -54,7 +54,7 @@ You shoud also find the complete GPL in the COPYING file accompanying this sourc /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI3XXX_TestConversionStarted | +| Function Name : int i_APCI3XXX_TestConversionStarted | | (struct comedi_device *dev) | +----------------------------------------------------------------------------+ | Task Test if any conversion started | @@ -79,7 +79,7 @@ int i_APCI3XXX_TestConversionStarted(struct comedi_device * dev) /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI3XXX_AnalogInputConfigOperatingMode | +| Function Name : int i_APCI3XXX_AnalogInputConfigOperatingMode | | (struct comedi_device *dev, | | struct comedi_subdevice *s, | | struct comedi_insn *insn, | @@ -87,9 +87,9 @@ int i_APCI3XXX_TestConversionStarted(struct comedi_device * dev) +----------------------------------------------------------------------------+ | 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]; | +| Input Parameters : b_SingleDiff = (unsigned char) data[1]; | +| b_TimeBase = (unsigned char) data[2]; (0: ns, 1:micros 2:ms)| +| dw_ReloadValue = (unsigned int) data[3]; | | ........ | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -108,11 +108,11 @@ int i_APCI3XXX_TestConversionStarted(struct comedi_device * dev) int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = insn->n; - BYTE b_TimeBase = 0; - BYTE b_SingleDiff = 0; - DWORD dw_ReloadValue = 0; - DWORD dw_TestReloadValue = 0; + int i_ReturnValue = insn->n; + unsigned char b_TimeBase = 0; + unsigned char b_SingleDiff = 0; + unsigned int dw_ReloadValue = 0; + unsigned int dw_TestReloadValue = 0; /************************/ /* Test the buffer size */ @@ -123,19 +123,19 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device * dev, /* Get the Singel/Diff flag */ /****************************/ - b_SingleDiff = (BYTE) data[1]; + b_SingleDiff = (unsigned char) data[1]; /****************************/ /* Get the time base unitiy */ /****************************/ - b_TimeBase = (BYTE) data[2]; + b_TimeBase = (unsigned char) data[2]; /*************************************/ /* Get the convert time reload value */ /*************************************/ - dw_ReloadValue = (DWORD) data[3]; + dw_ReloadValue = (unsigned int) data[3]; /**********************/ /* Test the time base */ @@ -186,7 +186,7 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device * dev, devpriv-> ui_EocEosConversionTime = - (UINT) + (unsigned int) dw_ReloadValue; devpriv-> b_EocEosConversionTimeBase @@ -204,7 +204,7 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device * dev, /* Set the convert timing unit */ /*******************************/ - writel((DWORD) + writel((unsigned int) b_TimeBase, (void *) (devpriv-> @@ -273,7 +273,7 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI3XXX_InsnConfigAnalogInput | +| Function Name : int i_APCI3XXX_InsnConfigAnalogInput | | (struct comedi_device *dev, | | struct comedi_subdevice *s, | | struct comedi_insn *insn, | @@ -281,9 +281,9 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device * dev, +----------------------------------------------------------------------------+ | 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]; | +| Input Parameters : b_ConvertMode = (unsigned char) data[0]; | +| b_TimeBase = (unsigned char) data[1]; (0: ns, 1:micros 2:ms)| +| dw_ReloadValue = (unsigned int) data[2]; | | ........ | +----------------------------------------------------------------------------+ | Output Parameters : - | @@ -298,14 +298,14 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device * dev, int i_APCI3XXX_InsnConfigAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = insn->n; + int i_ReturnValue = insn->n; /************************/ /* Test the buffer size */ /************************/ if (insn->n >= 1) { - switch ((BYTE) data[0]) { + switch ((unsigned char) data[0]) { case APCI3XXX_CONFIGURATION: i_ReturnValue = i_APCI3XXX_AnalogInputConfigOperatingMode(dev, @@ -331,7 +331,7 @@ int i_APCI3XXX_InsnConfigAnalogInput(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI3XXX_InsnReadAnalogInput | +| Function Name : int i_APCI3XXX_InsnReadAnalogInput | | (struct comedi_device *dev, | | struct comedi_subdevice *s, | | struct comedi_insn *insn, | @@ -358,13 +358,13 @@ int i_APCI3XXX_InsnConfigAnalogInput(struct comedi_device * dev, int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * 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; + int i_ReturnValue = insn->n; + unsigned char b_Configuration = (unsigned char) CR_RANGE(insn->chanspec); + unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); + unsigned int dw_Temp = 0; + unsigned int dw_Configuration = 0; + unsigned int dw_AcquisitionCpt = 0; + unsigned char b_Interrupt = 0; /*************************************/ /* Test if operating mode configured */ @@ -449,8 +449,8 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device * dev, dw_Configuration = (b_Configuration & 3) | - ((DWORD) (b_Configuration >> 2) - << 6) | ((DWORD) devpriv-> + ((unsigned int) (b_Configuration >> 2) + << 6) | ((unsigned int) devpriv-> b_SingelDiff << 7); /***************************/ @@ -468,7 +468,7 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device * dev, writel(dw_Temp | 0x100UL, (void *)(devpriv->dw_AiBase + 4)); - writel((DWORD) b_Channel, + writel((unsigned int) b_Channel, (void *)(devpriv->dw_AiBase + 0)); @@ -607,8 +607,8 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device * dev, void v_APCI3XXX_Interrupt(int irq, void *d) { struct comedi_device *dev = d; - BYTE b_CopyCpt = 0; - DWORD dw_Status = 0; + unsigned char b_CopyCpt = 0; + unsigned int dw_Status = 0; /***************************/ /* Test if interrupt occur */ @@ -635,7 +635,7 @@ void v_APCI3XXX_Interrupt(int irq, void *d) b_CopyCpt < devpriv->ui_AiNbrofChannels; b_CopyCpt++) { devpriv->ui_AiReadData[b_CopyCpt] = - (UINT) readl((void *)(devpriv-> + (unsigned int) readl((void *)(devpriv-> dw_AiBase + 28)); } @@ -662,7 +662,7 @@ void v_APCI3XXX_Interrupt(int irq, void *d) /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI3XXX_InsnWriteAnalogOutput | +| Function Name : int i_APCI3XXX_InsnWriteAnalogOutput | | (struct comedi_device *dev, | | struct comedi_subdevice *s, | | struct comedi_insn *insn, | @@ -687,10 +687,10 @@ void v_APCI3XXX_Interrupt(int irq, void *d) int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * 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; + unsigned char b_Range = (unsigned char) CR_RANGE(insn->chanspec); + unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); + unsigned int dw_Status = 0; + int i_ReturnValue = insn->n; /************************/ /* Test the buffer size */ @@ -768,7 +768,7 @@ int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI3XXX_InsnConfigInitTTLIO | +| Function Name : int i_APCI3XXX_InsnConfigInitTTLIO | | (struct comedi_device *dev, | | struct comedi_subdevice *s, | | struct comedi_insn *insn, | @@ -778,8 +778,8 @@ int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device * dev, | 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]; | +| Input Parameters : b_InitType = (unsigned char) data[0]; | +| b_Port2Mode = (unsigned char) data[1]; | +----------------------------------------------------------------------------+ | Output Parameters : - | +----------------------------------------------------------------------------+ @@ -794,8 +794,8 @@ int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device * dev, int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = insn->n; - BYTE b_Command = 0; + int i_ReturnValue = insn->n; + unsigned char b_Command = 0; /************************/ /* Test the buffer size */ @@ -806,7 +806,7 @@ int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device * dev, /* Get the command */ /* **************** */ - b_Command = (BYTE) data[0]; + b_Command = (unsigned char) data[0]; /********************/ /* Test the command */ @@ -899,7 +899,7 @@ int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI3XXX_InsnBitsTTLIO | +| Function Name : int i_APCI3XXX_InsnBitsTTLIO | | (struct comedi_device *dev, | | struct comedi_subdevice *s, | | struct comedi_insn *insn, | @@ -922,11 +922,11 @@ int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device * dev, int i_APCI3XXX_InsnBitsTTLIO(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = insn->n; - BYTE b_ChannelCpt = 0; - DWORD dw_ChannelMask = 0; - DWORD dw_BitMask = 0; - DWORD dw_Status = 0; + int i_ReturnValue = insn->n; + unsigned char b_ChannelCpt = 0; + unsigned int dw_ChannelMask = 0; + unsigned int dw_BitMask = 0; + unsigned int dw_Status = 0; /************************/ /* Test the buffer size */ @@ -1056,7 +1056,7 @@ int i_APCI3XXX_InsnBitsTTLIO(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI3XXX_InsnReadTTLIO | +| Function Name : int i_APCI3XXX_InsnReadTTLIO | | (struct comedi_device *dev, | | struct comedi_subdevice *s, | | struct comedi_insn *insn, | @@ -1077,8 +1077,8 @@ int i_APCI3XXX_InsnBitsTTLIO(struct comedi_device * dev, int i_APCI3XXX_InsnReadTTLIO(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - BYTE b_Channel = (BYTE) CR_CHAN(insn->chanspec); - INT i_ReturnValue = insn->n; + unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); + int i_ReturnValue = insn->n; unsigned int *pls_ReadData = data; /************************/ @@ -1168,7 +1168,7 @@ int i_APCI3XXX_InsnReadTTLIO(struct comedi_device * dev, /* +----------------------------------------------------------------------------+ -| Function Name : INT i_APCI3XXX_InsnWriteTTLIO | +| Function Name : int i_APCI3XXX_InsnWriteTTLIO | | (struct comedi_device *dev, | | struct comedi_subdevice *s, | | struct comedi_insn *insn, | @@ -1190,17 +1190,17 @@ int i_APCI3XXX_InsnReadTTLIO(struct comedi_device * dev, int i_APCI3XXX_InsnWriteTTLIO(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = insn->n; - BYTE b_Channel = (BYTE) CR_CHAN(insn->chanspec); - BYTE b_State = 0; - DWORD dw_Status = 0; + int i_ReturnValue = insn->n; + unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); + unsigned char b_State = 0; + unsigned int dw_Status = 0; /************************/ /* Test the buffer size */ /************************/ if (insn->n >= 1) { - b_State = (BYTE) data[0]; + b_State = (unsigned char) data[0]; /***********************/ /* Test if read port 0 */ @@ -1301,9 +1301,9 @@ int i_APCI3XXX_InsnWriteTTLIO(struct comedi_device * dev, int i_APCI3XXX_InsnReadDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = insn->n; - BYTE b_Channel = (BYTE) CR_CHAN(insn->chanspec); - DWORD dw_Temp = 0; + int i_ReturnValue = insn->n; + unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); + unsigned int dw_Temp = 0; /***************************/ /* Test the channel number */ @@ -1359,8 +1359,8 @@ int i_APCI3XXX_InsnReadDigitalInput(struct comedi_device * dev, int i_APCI3XXX_InsnBitsDigitalInput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = insn->n; - DWORD dw_Temp = 0; + int i_ReturnValue = insn->n; + unsigned int dw_Temp = 0; /************************/ /* Test the buffer size */ @@ -1412,11 +1412,11 @@ int i_APCI3XXX_InsnBitsDigitalInput(struct comedi_device * dev, int i_APCI3XXX_InsnBitsDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = insn->n; - BYTE b_ChannelCpt = 0; - DWORD dw_ChannelMask = 0; - DWORD dw_BitMask = 0; - DWORD dw_Status = 0; + int i_ReturnValue = insn->n; + unsigned char b_ChannelCpt = 0; + unsigned int dw_ChannelMask = 0; + unsigned int dw_BitMask = 0; + unsigned int dw_Status = 0; /************************/ /* Test the buffer size */ @@ -1508,10 +1508,10 @@ int i_APCI3XXX_InsnBitsDigitalOutput(struct comedi_device * dev, int i_APCI3XXX_InsnWriteDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = insn->n; - BYTE b_Channel = CR_CHAN(insn->chanspec); - BYTE b_State = 0; - DWORD dw_Status = 0; + int i_ReturnValue = insn->n; + unsigned char b_Channel = CR_CHAN(insn->chanspec); + unsigned char b_State = 0; + unsigned int dw_Status = 0; /************************/ /* Test the buffer size */ @@ -1527,7 +1527,7 @@ int i_APCI3XXX_InsnWriteDigitalOutput(struct comedi_device * dev, /* Get the command */ /*******************/ - b_State = (BYTE) data[0]; + b_State = (unsigned char) data[0]; /********************************/ /* Read the digital output port */ @@ -1583,9 +1583,9 @@ int i_APCI3XXX_InsnWriteDigitalOutput(struct comedi_device * dev, int i_APCI3XXX_InsnReadDigitalOutput(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - INT i_ReturnValue = insn->n; - BYTE b_Channel = CR_CHAN(insn->chanspec); - DWORD dw_Status = 0; + int i_ReturnValue = insn->n; + unsigned char b_Channel = CR_CHAN(insn->chanspec); + unsigned int dw_Status = 0; /************************/ /* Test the buffer size */ diff --git a/drivers/staging/comedi/drivers/addi_apci_035.c b/drivers/staging/comedi/drivers/addi_apci_035.c index bac018202fe8..da454e854c4c 100644 --- a/drivers/staging/comedi/drivers/addi_apci_035.c +++ b/drivers/staging/comedi/drivers/addi_apci_035.c @@ -1,5 +1,5 @@ #define CONFIG_APCI_035 1 -#define ADDIDATA_WATCHDOG 2 // Or shold it be something else +#define ADDIDATA_WATCHDOG 2 /* Or shold it be something else */ #include "addi-data/addi_common.c" diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index f710f551820d..7e27f92a9e6d 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -61,35 +61,35 @@ struct pci6208_board { const char *name; unsigned short dev_id; /* `lspci` will show you this */ int ao_chans; - //int ao_bits; + /* int ao_bits; */ }; static const struct pci6208_board pci6208_boards[] = { /*{ name : "pci6208v", - dev_id : 0x6208, //not sure + dev_id : 0x6208, // not sure ao_chans: 8 - //, ao_bits : 16 + // , ao_bits : 16 }, { name : "pci6216v", - dev_id : 0x6208, //not sure + dev_id : 0x6208, // not sure ao_chans: 16 - //, ao_bits : 16 + // , ao_bits : 16 }, */ { name: "pci6208a", dev_id: 0x6208, ao_chans:8 - //, ao_bits : 16 + /* , ao_bits : 16 */ } }; /* This is used by modprobe to translate PCI IDs to drivers. Should * only be used for PCI and ISA-PnP devices */ static DEFINE_PCI_DEVICE_TABLE(pci6208_pci_table) = { - //{ PCI_VENDOR_ID_ADLINK, 0x6208, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, - //{ PCI_VENDOR_ID_ADLINK, 0x6208, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + /* { PCI_VENDOR_ID_ADLINK, 0x6208, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, */ + /* { PCI_VENDOR_ID_ADLINK, 0x6208, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, */ {PCI_VENDOR_ID_ADLINK, 0x6208, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {0} }; @@ -132,10 +132,10 @@ static int pci6208_ao_winsn(struct comedi_device * dev, struct comedi_subdevice struct comedi_insn * insn, unsigned int * data); static int pci6208_ao_rinsn(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data); -//static int pci6208_dio_insn_bits(struct comedi_device *dev,struct comedi_subdevice *s, -// struct comedi_insn *insn,unsigned int *data); -//static int pci6208_dio_insn_config(struct comedi_device *dev,struct comedi_subdevice *s, -// struct comedi_insn *insn,unsigned int *data); +/* static int pci6208_dio_insn_bits(struct comedi_device *dev,struct comedi_subdevice *s, */ +/* struct comedi_insn *insn,unsigned int *data); */ +/* static int pci6208_dio_insn_config(struct comedi_device *dev,struct comedi_subdevice *s, */ +/* struct comedi_insn *insn,unsigned int *data); */ /* * Attach is called by the Comedi core to configure the driver @@ -176,22 +176,22 @@ static int pci6208_attach(struct comedi_device * dev, struct comedi_devconfig * s = dev->subdevices + 0; /* analog output subdevice */ s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; //anything else to add here?? + s->subdev_flags = SDF_WRITABLE; /* anything else to add here?? */ s->n_chan = thisboard->ao_chans; - s->maxdata = 0xffff; //16-bit DAC - s->range_table = &range_bipolar10; //this needs to be checked. + s->maxdata = 0xffff; /* 16-bit DAC */ + s->range_table = &range_bipolar10; /* this needs to be checked. */ s->insn_write = pci6208_ao_winsn; s->insn_read = pci6208_ao_rinsn; - //s=dev->subdevices+1; + /* s=dev->subdevices+1; */ /* digital i/o subdevice */ - //s->type=COMEDI_SUBD_DIO; - //s->subdev_flags=SDF_READABLE|SDF_WRITABLE; - //s->n_chan=16; - //s->maxdata=1; - //s->range_table=&range_digital; - //s->insn_bits = pci6208_dio_insn_bits; - //s->insn_config = pci6208_dio_insn_config; + /* s->type=COMEDI_SUBD_DIO; */ + /* s->subdev_flags=SDF_READABLE|SDF_WRITABLE; */ + /* s->n_chan=16; */ + /* s->maxdata=1; */ + /* s->range_table=&range_digital; */ + /* s->insn_bits = pci6208_dio_insn_bits; */ + /* s->insn_config = pci6208_dio_insn_config; */ printk("attached\n"); @@ -262,49 +262,49 @@ static int pci6208_ao_rinsn(struct comedi_device * dev, struct comedi_subdevice * 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 pci6208_dio_insn_bits(struct comedi_device *dev,struct comedi_subdevice *s, -// struct comedi_insn *insn,unsigned int *data) -//{ -// if(insn->n!=2)return -EINVAL; +/* static int pci6208_dio_insn_bits(struct comedi_device *dev,struct comedi_subdevice *s, */ +/* struct comedi_insn *insn,unsigned int *data) */ +/* { */ +/* 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]; +/* 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 + SKEL_DIO); -// } + /* outw(s->state,dev->iobase + SKEL_DIO); */ +/* } */ /* on return, data[1] contains the value of the digital * input and output lines. */ - //data[1]=inw(dev->iobase + SKEL_DIO); + /* data[1]=inw(dev->iobase + SKEL_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; + /* data[1]=s->state; */ -// return 2; -//} +/* return 2; */ +/* } */ -//static int pci6208_dio_insn_config(struct comedi_device *dev,struct comedi_subdevice *s, -// struct comedi_insn *insn,unsigned int *data) -//{ -// int chan=CR_CHAN(insn->chanspec); +/* static int pci6208_dio_insn_config(struct comedi_device *dev,struct comedi_subdevice *s, */ +/* struct comedi_insn *insn,unsigned int *data) */ +/* { */ +/* int chan=CR_CHAN(insn->chanspec); */ /* 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(data[0]==COMEDI_OUTPUT){ -// s->io_bits |= 1<<chan; -// }else{ -// s->io_bits &= ~(1<<chan); -// } - //outw(s->io_bits,dev->iobase + SKEL_DIO_CONFIG); +/* if(data[0]==COMEDI_OUTPUT){ */ +/* s->io_bits |= 1<<chan; */ +/* }else{ */ +/* s->io_bits &= ~(1<<chan); */ +/* } */ + /* outw(s->io_bits,dev->iobase + SKEL_DIO_CONFIG); */ -// return 1; -//} +/* return 1; */ +/* } */ static int pci6208_find_device(struct comedi_device * dev, int bus, int slot) { @@ -317,9 +317,9 @@ static int pci6208_find_device(struct comedi_device * dev, int bus, int slot) if (pci_dev->vendor == PCI_VENDOR_ID_ADLINK) { for (i = 0; i < pci6208_board_nbr; i++) { if (pci6208_boards[i].dev_id == pci_dev->device) { - // was a particular bus/slot requested? + /* was a particular bus/slot requested? */ if ((bus != 0) || (slot != 0)) { - // are we on the wrong bus/slot? + /* are we on the wrong bus/slot? */ if (pci_dev->bus->number != bus || PCI_SLOT(pci_dev->devfn) @@ -346,10 +346,10 @@ static int pci6208_find_device(struct comedi_device * dev, int bus, int slot) PCI_SLOT(pci_dev->devfn), PCI_FUNC(pci_dev->devfn), pci_dev->irq); - // TODO: Warn about non-tested boards. - //switch(board->device_id) - //{ - //}; + /* TODO: Warn about non-tested boards. */ + /* switch(board->device_id) */ + /* { */ + /* }; */ devpriv->pci_dev = pci_dev; @@ -362,19 +362,19 @@ pci6208_pci_setup(struct pci_dev *pci_dev, unsigned long *io_base_ptr, { unsigned long io_base, io_range, lcr_io_base, lcr_io_range; - // Enable PCI device and request regions + /* Enable PCI device and request regions */ if (comedi_pci_enable(pci_dev, PCI6208_DRIVER_NAME) < 0) { printk("comedi%d: Failed to enable PCI device and request regions\n", dev_minor); return -EIO; } - // Read local configuration register base address [PCI_BASE_ADDRESS #1]. + /* Read local configuration register base address [PCI_BASE_ADDRESS #1]. */ lcr_io_base = pci_resource_start(pci_dev, 1); lcr_io_range = pci_resource_len(pci_dev, 1); printk("comedi%d: local config registers at address 0x%4lx [0x%4lx]\n", dev_minor, lcr_io_base, lcr_io_range); - // Read PCI6208 register base address [PCI_BASE_ADDRESS #2]. + /* 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,10 +382,10 @@ pci6208_pci_setup(struct pci_dev *pci_dev, unsigned long *io_base_ptr, dev_minor, io_base, io_range); *io_base_ptr = io_base; - //devpriv->io_range = io_range; - //devpriv->is_valid=0; - //devpriv->lcr_io_base=lcr_io_base; - //devpriv->lcr_io_range=lcr_io_range; + /* devpriv->io_range = io_range; */ + /* devpriv->is_valid=0; */ + /* devpriv->lcr_io_base=lcr_io_base; */ + /* devpriv->lcr_io_range=lcr_io_range; */ return 0; } diff --git a/drivers/staging/comedi/drivers/adl_pci7296.c b/drivers/staging/comedi/drivers/adl_pci7296.c index bd0f9ab226ef..1d9f5ad69722 100644 --- a/drivers/staging/comedi/drivers/adl_pci7296.c +++ b/drivers/staging/comedi/drivers/adl_pci7296.c @@ -39,7 +39,7 @@ Configuration Options: #include "comedi_pci.h" #include "8255.h" -// #include "8253.h" +/* #include "8253.h" */ #define PORT1A 0 #define PORT2A 4 @@ -115,7 +115,7 @@ static int adl_pci7296_attach(struct comedi_device * dev, struct comedi_devconfi dev->iobase = pci_resource_start(pcidev, 2); printk("comedi: base addr %4lx\n", dev->iobase); - // four 8255 digital io subdevices + /* four 8255 digital io subdevices */ s = dev->subdevices + 0; subdev_8255_init(dev, s, NULL, (unsigned long)(dev->iobase)); @@ -159,7 +159,7 @@ static int adl_pci7296_detach(struct comedi_device * dev) } pci_dev_put(devpriv->pci_dev); } - // detach four 8255 digital io subdevices + /* detach four 8255 digital io subdevices */ if (dev->subdevices) { subdev_8255_cleanup(dev, dev->subdevices + 0); subdev_8255_cleanup(dev, dev->subdevices + 1); diff --git a/drivers/staging/comedi/drivers/adl_pci8164.c b/drivers/staging/comedi/drivers/adl_pci8164.c index adf90be79983..dd376b69bde3 100644 --- a/drivers/staging/comedi/drivers/adl_pci8164.c +++ b/drivers/staging/comedi/drivers/adl_pci8164.c @@ -149,7 +149,7 @@ static int adl_pci8164_attach(struct comedi_device * dev, struct comedi_devconfi s->n_chan = 4; s->maxdata = 0xffff; s->len_chanlist = 4; - //s->range_table = &range_axis; + /* s->range_table = &range_axis; */ s->insn_read = adl_pci8164_insn_read_msts; s->insn_write = adl_pci8164_insn_write_cmd; @@ -159,7 +159,7 @@ static int adl_pci8164_attach(struct comedi_device * dev, struct comedi_devconfi s->n_chan = 4; s->maxdata = 0xffff; s->len_chanlist = 4; - //s->range_table = &range_axis; + /* s->range_table = &range_axis; */ s->insn_read = adl_pci8164_insn_read_ssts; s->insn_write = adl_pci8164_insn_write_otp; @@ -169,7 +169,7 @@ static int adl_pci8164_attach(struct comedi_device * dev, struct comedi_devconfi s->n_chan = 4; s->maxdata = 0xffff; s->len_chanlist = 4; - //s->range_table = &range_axis; + /* s->range_table = &range_axis; */ s->insn_read = adl_pci8164_insn_read_buf0; s->insn_write = adl_pci8164_insn_write_buf0; @@ -179,7 +179,7 @@ static int adl_pci8164_attach(struct comedi_device * dev, struct comedi_devconfi s->n_chan = 4; s->maxdata = 0xffff; s->len_chanlist = 4; - //s->range_table = &range_axis; + /* s->range_table = &range_axis; */ s->insn_read = adl_pci8164_insn_read_buf1; s->insn_write = adl_pci8164_insn_write_buf1; diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c b/drivers/staging/comedi/drivers/adl_pci9111.c index b4a61c560c5b..28b6b8d3c664 100644 --- a/drivers/staging/comedi/drivers/adl_pci9111.c +++ b/drivers/staging/comedi/drivers/adl_pci9111.c @@ -77,6 +77,7 @@ TODO: #include "../comedidev.h" #include <linux/delay.h> +#include <linux/interrupt.h> #include "8253.h" #include "comedi_pci.h" @@ -884,7 +885,7 @@ static void pci9111_ai_munge(struct comedi_device * dev, struct comedi_subdevice #undef INTERRUPT_DEBUG -static irqreturn_t pci9111_interrupt(int irq, void *p_device PT_REGS_ARG) +static irqreturn_t pci9111_interrupt(int irq, void *p_device) { struct comedi_device *dev = p_device; struct comedi_subdevice *subdevice = dev->read_subdev; diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 278cf30cc4a3..6a8a4e2d45aa 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -66,6 +66,7 @@ Configuration options: #include "../pci_ids.h" #include <linux/delay.h> +#include <linux/interrupt.h> #include "amcc_s5933.h" #include "8253.h" @@ -107,7 +108,7 @@ Configuration options: #define PCI9118_INTSRC 0x38 /* R: interrupt reason register */ #define PCI9118_INTCTRL 0x38 /* W: interrupt control register */ -// bits from A/D control register (PCI9118_ADCNTRL) +/* bits from A/D control register (PCI9118_ADCNTRL) */ #define AdControl_UniP 0x80 /* 1=bipolar, 0=unipolar */ #define AdControl_Diff 0x40 /* 1=differential, 0= single end inputs */ #define AdControl_SoftG 0x20 /* 1=8254 counter works, 0=counter stops */ @@ -117,7 +118,7 @@ Configuration options: #define AdControl_Int 0x02 /* 1=enable INT, 0=disable */ #define AdControl_Dma 0x01 /* 1=enable DMA, 0=disable */ -// bits from A/D function register (PCI9118_ADFUNC) +/* bits from A/D function register (PCI9118_ADFUNC) */ #define AdFunction_PDTrg 0x80 /* 1=positive, 0=negative digital trigger (only positive is correct) */ #define AdFunction_PETrg 0x40 /* 1=positive, 0=negative external trigger (only positive is correct) */ #define AdFunction_BSSH 0x20 /* 1=with sample&hold, 0=without */ @@ -127,7 +128,7 @@ Configuration options: #define AdFunction_AM 0x02 /* 1=about trigger mode, 0=not about trigger */ #define AdFunction_Start 0x01 /* 1=trigger start, 0=trigger stop */ -// bits from A/D status register (PCI9118_ADSTAT) +/* bits from A/D status register (PCI9118_ADSTAT) */ #define AdStatus_nFull 0x100 /* 0=FIFO full (fatal), 1=not full */ #define AdStatus_nHfull 0x080 /* 0=FIFO half full, 1=FIFO not half full */ #define AdStatus_nEpty 0x040 /* 0=FIFO empty, 1=FIFO not empty */ @@ -138,8 +139,8 @@ Configuration options: #define AdStatus_ADOR 0x002 /* 1=A/D overrun (fatal) */ #define AdStatus_ADrdy 0x001 /* 1=A/D already ready, 0=not ready */ -// bits for interrupt reason and control (PCI9118_INTSRC, PCI9118_INTCTRL) -// 1=interrupt occur, enable source, 0=interrupt not occur, disable source +/* bits for interrupt reason and control (PCI9118_INTSRC, PCI9118_INTCTRL) */ +/* 1=interrupt occur, enable source, 0=interrupt not occur, disable source */ #define Int_Timer 0x08 /* timer interrupt */ #define Int_About 0x04 /* about trigger complete */ #define Int_Hfull 0x02 /* A/D FIFO hlaf full */ @@ -182,23 +183,23 @@ static int pci9118_attach(struct comedi_device * dev, struct comedi_devconfig * static int pci9118_detach(struct comedi_device * dev); struct boardtype { - const char *name; // board name - int vendor_id; // PCI vendor a device ID of card + const char *name; /* board name */ + int vendor_id; /* PCI vendor a device ID of card */ int device_id; - int iorange_amcc; // iorange for own S5933 region - int iorange_9118; // pass thru card region size - int n_aichan; // num of A/D chans - int n_aichand; // num of A/D chans in diff mode - int mux_aichan; // num of A/D chans with external multiplexor - int n_aichanlist; // len of chanlist - int n_aochan; // num of D/A chans - int ai_maxdata; // resolution of A/D - int ao_maxdata; // resolution of D/A - const struct comedi_lrange *rangelist_ai; // rangelist for A/D - const struct comedi_lrange *rangelist_ao; // rangelist for D/A - unsigned int ai_ns_min; // max sample speed of card v ns - unsigned int ai_pacer_min; // minimal pacer value (c1*c2 or c1 in burst) - int half_fifo_size; // size of FIFO/2 + int iorange_amcc; /* iorange for own S5933 region */ + int iorange_9118; /* pass thru card region size */ + int n_aichan; /* num of A/D chans */ + int n_aichand; /* num of A/D chans in diff mode */ + int mux_aichan; /* num of A/D chans with external multiplexor */ + int n_aichanlist; /* len of chanlist */ + int n_aochan; /* num of D/A chans */ + int ai_maxdata; /* resolution of A/D */ + int ao_maxdata; /* resolution of D/A */ + const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */ + const struct comedi_lrange *rangelist_ao; /* rangelist for D/A */ + unsigned int ai_ns_min; /* max sample speed of card v ns */ + unsigned int ai_pacer_min; /* minimal pacer value (c1*c2 or c1 in burst) */ + int half_fifo_size; /* size of FIFO/2 */ }; @@ -242,63 +243,63 @@ static struct comedi_driver driver_pci9118 = { COMEDI_PCI_INITCLEANUP(driver_pci9118, pci9118_pci_table); struct pci9118_private { - unsigned long iobase_a; // base+size for AMCC chip - unsigned int master; // master capable - struct pci_dev *pcidev; // ptr to actual pcidev - unsigned int usemux; // we want to use external multiplexor! + unsigned long iobase_a; /* base+size for AMCC chip */ + unsigned int master; /* master capable */ + struct pci_dev *pcidev; /* ptr to actual pcidev */ + unsigned int usemux; /* we want to use external multiplexor! */ #ifdef PCI9118_PARANOIDCHECK - unsigned short chanlist[PCI9118_CHANLEN + 1]; // list of scaned channel - unsigned char chanlistlen; // number of scanlist + unsigned short chanlist[PCI9118_CHANLEN + 1]; /* list of scaned channel */ + unsigned char chanlistlen; /* number of scanlist */ #endif - unsigned char AdControlReg; // A/D control register - unsigned char IntControlReg; // Interrupt control register - unsigned char AdFunctionReg; // A/D function register - char valid; // driver is ok - char ai_neverending; // we do unlimited AI - unsigned int i8254_osc_base; // frequence of onboard oscilator - unsigned int ai_do; // what do AI? 0=nothing, 1 to 4 mode - unsigned int ai_act_scan; // how many scans we finished - unsigned int ai_buf_ptr; // data buffer ptr in samples - unsigned int ai_n_chan; // how many channels is measured - unsigned int ai_n_scanlen; // len of actual scanlist - unsigned int ai_n_realscanlen; // what we must transfer for one outgoing scan include front/back adds - unsigned int ai_act_dmapos; // position in actual real stream - unsigned int ai_add_front; // how many channels we must add before scan to satisfy S&H? - unsigned int ai_add_back; // how many channels we must add before scan to satisfy DMA? - unsigned int *ai_chanlist; // actaul chanlist + unsigned char AdControlReg; /* A/D control register */ + unsigned char IntControlReg; /* Interrupt control register */ + unsigned char AdFunctionReg; /* A/D function register */ + char valid; /* driver is ok */ + char ai_neverending; /* we do unlimited AI */ + unsigned int i8254_osc_base; /* frequence of onboard oscilator */ + unsigned int ai_do; /* what do AI? 0=nothing, 1 to 4 mode */ + unsigned int ai_act_scan; /* how many scans we finished */ + unsigned int ai_buf_ptr; /* data buffer ptr in samples */ + unsigned int ai_n_chan; /* how many channels is measured */ + unsigned int ai_n_scanlen; /* len of actual scanlist */ + unsigned int ai_n_realscanlen; /* what we must transfer for one outgoing scan include front/back adds */ + unsigned int ai_act_dmapos; /* position in actual real stream */ + unsigned int ai_add_front; /* how many channels we must add before scan to satisfy S&H? */ + unsigned int ai_add_back; /* how many channels we must add before scan to satisfy DMA? */ + unsigned int *ai_chanlist; /* actaul chanlist */ unsigned int ai_timer1; unsigned int ai_timer2; unsigned int ai_flags; - char ai12_startstop; // measure can start/stop on external trigger - unsigned int ai_divisor1, ai_divisor2; // divisors for start of measure on external start + char ai12_startstop; /* measure can start/stop on external trigger */ + unsigned int ai_divisor1, ai_divisor2; /* divisors for start of measure on external start */ unsigned int ai_data_len; short *ai_data; - short ao_data[2]; // data output buffer - unsigned int ai_scans; // number of scans to do - char dma_doublebuf; // we can use double buffring - unsigned int dma_actbuf; // which buffer is used now - short *dmabuf_virt[2]; // pointers to begin of DMA buffer - unsigned long dmabuf_hw[2]; // hw address of DMA buff - unsigned int dmabuf_size[2]; // size of dma buffer in bytes - unsigned int dmabuf_use_size[2]; // which size we may now used for transfer - unsigned int dmabuf_used_size[2]; // which size was trully used + short ao_data[2]; /* data output buffer */ + unsigned int ai_scans; /* number of scans to do */ + char dma_doublebuf; /* we can use double buffring */ + unsigned int dma_actbuf; /* which buffer is used now */ + short *dmabuf_virt[2]; /* pointers to begin of DMA buffer */ + unsigned long dmabuf_hw[2]; /* hw address of DMA buff */ + unsigned int dmabuf_size[2]; /* size of dma buffer in bytes */ + unsigned int dmabuf_use_size[2]; /* which size we may now used for transfer */ + unsigned int dmabuf_used_size[2]; /* which size was trully used */ unsigned int dmabuf_panic_size[2]; - unsigned int dmabuf_samples[2]; // size in samples - int dmabuf_pages[2]; // number of pages in buffer - unsigned char cnt0_users; // bit field of 8254 CNT0 users (0-unused, 1-AO, 2-DI, 3-DO) - unsigned char exttrg_users; // bit field of external trigger users (0-AI, 1-AO, 2-DI, 3-DO) - unsigned int cnt0_divisor; // actual CNT0 divisor - void (*int_ai_func) (struct comedi_device *, struct comedi_subdevice *, unsigned short, unsigned int, unsigned short); // ptr to actual interrupt AI function - unsigned char ai16bits; // =1 16 bit card - unsigned char usedma; // =1 use DMA transfer and not INT - unsigned char useeoshandle; // =1 change WAKE_EOS DMA transfer to fit on every second - unsigned char usessh; // =1 turn on S&H support - int softsshdelay; // >0 use software S&H, numer is requested delay in ns - unsigned char softsshsample; // polarity of S&H signal in sample state - unsigned char softsshhold; // polarity of S&H signal in hold state - unsigned int ai_maskerr; // which warning was printed - unsigned int ai_maskharderr; // on which error bits stops - unsigned int ai_inttrig_start; // TRIG_INT for start + unsigned int dmabuf_samples[2]; /* size in samples */ + int dmabuf_pages[2]; /* number of pages in buffer */ + unsigned char cnt0_users; /* bit field of 8254 CNT0 users (0-unused, 1-AO, 2-DI, 3-DO) */ + unsigned char exttrg_users; /* bit field of external trigger users (0-AI, 1-AO, 2-DI, 3-DO) */ + unsigned int cnt0_divisor; /* actual CNT0 divisor */ + void (*int_ai_func) (struct comedi_device *, struct comedi_subdevice *, unsigned short, unsigned int, unsigned short); /* ptr to actual interrupt AI function */ + unsigned char ai16bits; /* =1 16 bit card */ + unsigned char usedma; /* =1 use DMA transfer and not INT */ + unsigned char useeoshandle; /* =1 change WAKE_EOS DMA transfer to fit on every second */ + unsigned char usessh; /* =1 turn on S&H support */ + int softsshdelay; /* >0 use software S&H, numer is requested delay in ns */ + unsigned char softsshsample; /* polarity of S&H signal in sample state */ + unsigned char softsshhold; /* polarity of S&H signal in hold state */ + unsigned int ai_maskerr; /* which warning was printed */ + unsigned int ai_maskharderr; /* on which error bits stops */ + unsigned int ai_inttrig_start; /* TRIG_INT for start */ }; #define devpriv ((struct pci9118_private *)dev->private) @@ -335,12 +336,12 @@ static int pci9118_insn_read_ai(struct comedi_device * dev, struct comedi_subdev devpriv->AdControlReg = AdControl_Int & 0xff; devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg; - outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); // positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop + outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); /* positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop */ if (!setup_channel_list(dev, s, 1, &insn->chanspec, 0, 0, 0, 0, 0)) return -EINVAL; - outl(0, dev->iobase + PCI9118_DELFIFO); // flush FIFO + outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ for (n = 0; n < insn->n; n++) { outw(0, dev->iobase + PCI9118_SOFTTRG); /* start conversion */ @@ -354,7 +355,7 @@ static int pci9118_insn_read_ai(struct comedi_device * dev, struct comedi_subdev comedi_error(dev, "A/D insn timeout"); data[n] = 0; - outl(0, dev->iobase + PCI9118_DELFIFO); // flush FIFO + outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ return -ETIME; conv_finish: @@ -369,7 +370,7 @@ static int pci9118_insn_read_ai(struct comedi_device * dev, struct comedi_subdev } } - outl(0, dev->iobase + PCI9118_DELFIFO); // flush FIFO + outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ return n; } @@ -567,7 +568,7 @@ static void interrupt_pci9118_ai_onesample(struct comedi_device * dev, #ifdef PCI9118_PARANOIDCHECK if (devpriv->ai16bits == 0) { - if ((sampl & 0x000f) != devpriv->chanlist[s->async->cur_chan]) { // data dropout! + if ((sampl & 0x000f) != devpriv->chanlist[s->async->cur_chan]) { /* data dropout! */ rt_printk ("comedi: A/D SAMPL - data dropout: received channel %d, expected %d!\n", sampl & 0x000f, @@ -621,14 +622,14 @@ static void interrupt_pci9118_ai_dma(struct comedi_device * dev, struct comedi_s } if (int_adstat & devpriv->ai_maskerr) -// if (int_adstat & 0x106) +/* if (int_adstat & 0x106) */ if (pci9118_decode_error_status(dev, s, int_adstat)) return; - samplesinbuf = devpriv->dmabuf_use_size[devpriv->dma_actbuf] >> 1; // number of received real samples -// DPRINTK("dma_actbuf=%d\n",devpriv->dma_actbuf); + samplesinbuf = devpriv->dmabuf_use_size[devpriv->dma_actbuf] >> 1; /* number of received real samples */ +/* DPRINTK("dma_actbuf=%d\n",devpriv->dma_actbuf); */ - if (devpriv->dma_doublebuf) { // switch DMA buffers if is used double buffering + if (devpriv->dma_doublebuf) { /* switch DMA buffers if is used double buffering */ next_dma_buf = 1 - devpriv->dma_actbuf; outl(devpriv->dmabuf_hw[next_dma_buf], devpriv->iobase_a + AMCC_OP_REG_MWAR); @@ -641,15 +642,15 @@ static void interrupt_pci9118_ai_dma(struct comedi_device * dev, struct comedi_s } if (samplesinbuf) { - m = devpriv->ai_data_len >> 1; // how many samples is to end of buffer -// DPRINTK("samps=%d m=%d %d %d\n",samplesinbuf,m,s->async->buf_int_count,s->async->buf_int_ptr); + m = devpriv->ai_data_len >> 1; /* how many samples is to end of buffer */ +/* DPRINTK("samps=%d m=%d %d %d\n",samplesinbuf,m,s->async->buf_int_count,s->async->buf_int_ptr); */ sampls = m; move_block_from_dma(dev, s, devpriv->dmabuf_virt[devpriv->dma_actbuf], samplesinbuf); - m = m - sampls; // m= how many samples was transfered + m = m - sampls; /* m= how many samples was transfered */ } -// DPRINTK("YYY\n"); +/* DPRINTK("YYY\n"); */ if (!devpriv->ai_neverending) if (devpriv->ai_act_scan >= devpriv->ai_scans) { /* all data sampled */ @@ -657,9 +658,9 @@ static void interrupt_pci9118_ai_dma(struct comedi_device * dev, struct comedi_s s->async->events |= COMEDI_CB_EOA; } - if (devpriv->dma_doublebuf) { // switch dma buffers + if (devpriv->dma_doublebuf) { /* switch dma buffers */ devpriv->dma_actbuf = 1 - devpriv->dma_actbuf; - } else { // restart DMA if is not used double buffering + } else { /* restart DMA if is not used double buffering */ outl(devpriv->dmabuf_hw[0], devpriv->iobase_a + AMCC_OP_REG_MWAR); outl(devpriv->dmabuf_use_size[0], @@ -674,36 +675,36 @@ static void interrupt_pci9118_ai_dma(struct comedi_device * dev, struct comedi_s /* ============================================================================== */ -static irqreturn_t interrupt_pci9118(int irq, void *d PT_REGS_ARG) +static irqreturn_t interrupt_pci9118(int irq, void *d) { struct comedi_device *dev = d; unsigned int int_daq = 0, int_amcc, int_adstat; if (!dev->attached) - return IRQ_NONE; // not fully initialized + return IRQ_NONE; /* not fully initialized */ - int_daq = inl(dev->iobase + PCI9118_INTSRC) & 0xf; // get IRQ reasons from card - int_amcc = inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR); // get INT register from AMCC chip + int_daq = inl(dev->iobase + PCI9118_INTSRC) & 0xf; /* get IRQ reasons from card */ + int_amcc = inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* get INT register from AMCC chip */ -// DPRINTK("INT daq=0x%01x amcc=0x%08x MWAR=0x%08x MWTC=0x%08x ADSTAT=0x%02x ai_do=%d\n", int_daq, int_amcc, inl(devpriv->iobase_a+AMCC_OP_REG_MWAR), inl(devpriv->iobase_a+AMCC_OP_REG_MWTC), inw(dev->iobase+PCI9118_ADSTAT)&0x1ff,devpriv->ai_do); +/* DPRINTK("INT daq=0x%01x amcc=0x%08x MWAR=0x%08x MWTC=0x%08x ADSTAT=0x%02x ai_do=%d\n", int_daq, int_amcc, inl(devpriv->iobase_a+AMCC_OP_REG_MWAR), inl(devpriv->iobase_a+AMCC_OP_REG_MWTC), inw(dev->iobase+PCI9118_ADSTAT)&0x1ff,devpriv->ai_do); */ if ((!int_daq) && (!(int_amcc & ANY_S593X_INT))) - return IRQ_NONE; // interrupt from other source + return IRQ_NONE; /* interrupt from other source */ - outl(int_amcc | 0x00ff0000, devpriv->iobase_a + AMCC_OP_REG_INTCSR); // shutdown IRQ reasons in AMCC + outl(int_amcc | 0x00ff0000, devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* shutdown IRQ reasons in AMCC */ - int_adstat = inw(dev->iobase + PCI9118_ADSTAT) & 0x1ff; // get STATUS register + int_adstat = inw(dev->iobase + PCI9118_ADSTAT) & 0x1ff; /* get STATUS register */ if (devpriv->ai_do) { if (devpriv->ai12_startstop) - if ((int_adstat & AdStatus_DTH) && (int_daq & Int_DTrg)) { // start stop of measure + if ((int_adstat & AdStatus_DTH) && (int_daq & Int_DTrg)) { /* start stop of measure */ if (devpriv->ai12_startstop & START_AI_EXT) { devpriv->ai12_startstop &= ~START_AI_EXT; if (!(devpriv->ai12_startstop & STOP_AI_EXT)) - pci9118_exttrg_del(dev, EXTTRG_AI); // deactivate EXT trigger - start_pacer(dev, devpriv->ai_do, devpriv->ai_divisor1, devpriv->ai_divisor2); // start pacer + pci9118_exttrg_del(dev, EXTTRG_AI); /* deactivate EXT trigger */ + start_pacer(dev, devpriv->ai_do, devpriv->ai_divisor1, devpriv->ai_divisor2); /* start pacer */ outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); } else { @@ -711,8 +712,8 @@ static irqreturn_t interrupt_pci9118(int irq, void *d PT_REGS_ARG) ai12_startstop & STOP_AI_EXT) { devpriv->ai12_startstop &= ~STOP_AI_EXT; - pci9118_exttrg_del(dev, EXTTRG_AI); // deactivate EXT trigger - devpriv->ai_neverending = 0; //well, on next interrupt from DMA/EOC measure will stop + pci9118_exttrg_del(dev, EXTTRG_AI); /* deactivate EXT trigger */ + devpriv->ai_neverending = 0; /* well, on next interrupt from DMA/EOC measure will stop */ } } } @@ -949,11 +950,11 @@ static int pci9118_ai_cmdtest(struct comedi_device * dev, struct comedi_subdevic if (cmd->scan_begin_src == TRIG_TIMER) { tmp = cmd->scan_begin_arg; -// rt_printk("S1 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg); +/* rt_printk("S1 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg); */ i8253_cascade_ns_to_timer(devpriv->i8254_osc_base, &divisor1, &divisor2, &cmd->scan_begin_arg, cmd->flags & TRIG_ROUND_MASK); -// rt_printk("S2 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg); +/* rt_printk("S2 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg); */ if (cmd->scan_begin_arg < this_board->ai_ns_min) cmd->scan_begin_arg = this_board->ai_ns_min; if (tmp != cmd->scan_begin_arg) @@ -965,7 +966,7 @@ static int pci9118_ai_cmdtest(struct comedi_device * dev, struct comedi_subdevic i8253_cascade_ns_to_timer(devpriv->i8254_osc_base, &divisor1, &divisor2, &cmd->convert_arg, cmd->flags & TRIG_ROUND_MASK); -// rt_printk("s1 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg); +/* rt_printk("s1 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg); */ if (cmd->convert_arg < this_board->ai_ns_min) cmd->convert_arg = this_board->ai_ns_min; if (tmp != cmd->convert_arg) @@ -979,7 +980,7 @@ static int pci9118_ai_cmdtest(struct comedi_device * dev, struct comedi_subdevic cmd->scan_begin_arg = this_board->ai_ns_min * (cmd->scan_end_arg + 2); -// rt_printk("s2 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg); +/* rt_printk("s2 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg); */ err++; } } else { @@ -988,7 +989,7 @@ static int pci9118_ai_cmdtest(struct comedi_device * dev, struct comedi_subdevic cmd->scan_begin_arg = cmd->convert_arg * cmd->chanlist_len; -// rt_printk("s3 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg); +/* rt_printk("s3 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg); */ err++; } } @@ -1001,7 +1002,7 @@ static int pci9118_ai_cmdtest(struct comedi_device * dev, struct comedi_subdevic if (cmd->chanlist) if (!check_channel_list(dev, s, cmd->chanlist_len, cmd->chanlist, 0, 0)) - return 5; // incorrect channels list + return 5; /* incorrect channels list */ return 0; } @@ -1018,26 +1019,26 @@ static int Compute_and_setup_dma(struct comedi_device * dev) dmalen1 = devpriv->dmabuf_size[1]; DPRINTK("1 dmalen0=%d dmalen1=%d ai_data_len=%d\n", dmalen0, dmalen1, devpriv->ai_data_len); - // isn't output buff smaller that our DMA buff? + /* isn't output buff smaller that our DMA buff? */ if (dmalen0 > (devpriv->ai_data_len)) { - dmalen0 = devpriv->ai_data_len & ~3L; // allign to 32bit down + dmalen0 = devpriv->ai_data_len & ~3L; /* allign to 32bit down */ } if (dmalen1 > (devpriv->ai_data_len)) { - dmalen1 = devpriv->ai_data_len & ~3L; // allign to 32bit down + dmalen1 = devpriv->ai_data_len & ~3L; /* allign to 32bit down */ } DPRINTK("2 dmalen0=%d dmalen1=%d \n", dmalen0, dmalen1); - // we want wake up every scan? + /* we want wake up every scan? */ if (devpriv->ai_flags & TRIG_WAKE_EOS) { if (dmalen0 < (devpriv->ai_n_realscanlen << 1)) { - // uff, too short DMA buffer, disable EOS support! + /* uff, too short DMA buffer, disable EOS support! */ devpriv->ai_flags &= (~TRIG_WAKE_EOS); rt_printk ("comedi%d: WAR: DMA0 buf too short, cann't support TRIG_WAKE_EOS (%d<%d)\n", dev->minor, dmalen0, devpriv->ai_n_realscanlen << 1); } else { - // short first DMA buffer to one scan + /* short first DMA buffer to one scan */ dmalen0 = devpriv->ai_n_realscanlen << 1; DPRINTK("21 dmalen0=%d ai_n_realscanlen=%d useeoshandle=%d\n", dmalen0, devpriv->ai_n_realscanlen, devpriv->useeoshandle); if (devpriv->useeoshandle) @@ -1052,14 +1053,14 @@ static int Compute_and_setup_dma(struct comedi_device * dev) } if (devpriv->ai_flags & TRIG_WAKE_EOS) { if (dmalen1 < (devpriv->ai_n_realscanlen << 1)) { - // uff, too short DMA buffer, disable EOS support! + /* uff, too short DMA buffer, disable EOS support! */ devpriv->ai_flags &= (~TRIG_WAKE_EOS); rt_printk ("comedi%d: WAR: DMA1 buf too short, cann't support TRIG_WAKE_EOS (%d<%d)\n", dev->minor, dmalen1, devpriv->ai_n_realscanlen << 1); } else { - // short second DMA buffer to one scan + /* short second DMA buffer to one scan */ dmalen1 = devpriv->ai_n_realscanlen << 1; DPRINTK("22 dmalen1=%d ai_n_realscanlen=%d useeoshandle=%d\n", dmalen1, devpriv->ai_n_realscanlen, devpriv->useeoshandle); if (devpriv->useeoshandle) @@ -1074,26 +1075,26 @@ static int Compute_and_setup_dma(struct comedi_device * dev) } DPRINTK("3 dmalen0=%d dmalen1=%d \n", dmalen0, dmalen1); - // transfer without TRIG_WAKE_EOS + /* transfer without TRIG_WAKE_EOS */ if (!(devpriv->ai_flags & TRIG_WAKE_EOS)) { - // if it's possible then allign DMA buffers to length of scan + /* if it's possible then allign DMA buffers to length of scan */ i = dmalen0; dmalen0 = (dmalen0 / (devpriv->ai_n_realscanlen << 1)) * (devpriv->ai_n_realscanlen << 1); dmalen0 &= ~3L; if (!dmalen0) - dmalen0 = i; // uff. very long scan? + dmalen0 = i; /* uff. very long scan? */ i = dmalen1; dmalen1 = (dmalen1 / (devpriv->ai_n_realscanlen << 1)) * (devpriv->ai_n_realscanlen << 1); dmalen1 &= ~3L; if (!dmalen1) - dmalen1 = i; // uff. very long scan? - // if measure isn't neverending then test, if it whole fits into one or two DMA buffers + dmalen1 = i; /* uff. very long scan? */ + /* if measure isn't neverending then test, if it whole fits into one or two DMA buffers */ if (!devpriv->ai_neverending) { - // fits whole measure into one DMA buffer? + /* fits whole measure into one DMA buffer? */ if (dmalen0 > ((devpriv->ai_n_realscanlen << 1) * devpriv->ai_scans)) { @@ -1104,7 +1105,7 @@ static int Compute_and_setup_dma(struct comedi_device * dev) DPRINTK("3.1 dmalen0=%d dmalen1=%d \n", dmalen0, dmalen1); dmalen0 &= ~3L; - } else { // fits whole measure into two DMA buffer? + } else { /* fits whole measure into two DMA buffer? */ if (dmalen1 > ((devpriv->ai_n_realscanlen << 1) * devpriv->ai_scans - dmalen0)) @@ -1121,7 +1122,7 @@ static int Compute_and_setup_dma(struct comedi_device * dev) DPRINTK("4 dmalen0=%d dmalen1=%d \n", dmalen0, dmalen1); - // these DMA buffer size we'll be used + /* these DMA buffer size we'll be used */ devpriv->dma_actbuf = 0; devpriv->dmabuf_use_size[0] = dmalen0; devpriv->dmabuf_use_size[1] = dmalen1; @@ -1143,18 +1144,18 @@ static int Compute_and_setup_dma(struct comedi_device * dev) } #endif - outl(inl(devpriv->iobase_a + AMCC_OP_REG_MCSR) & (~EN_A2P_TRANSFERS), devpriv->iobase_a + AMCC_OP_REG_MCSR); // stop DMA + outl(inl(devpriv->iobase_a + AMCC_OP_REG_MCSR) & (~EN_A2P_TRANSFERS), devpriv->iobase_a + AMCC_OP_REG_MCSR); /* stop DMA */ outl(devpriv->dmabuf_hw[0], devpriv->iobase_a + AMCC_OP_REG_MWAR); outl(devpriv->dmabuf_use_size[0], devpriv->iobase_a + AMCC_OP_REG_MWTC); - // init DMA transfer + /* init DMA transfer */ outl(0x00000000 | AINT_WRITE_COMPL, devpriv->iobase_a + AMCC_OP_REG_INTCSR); -// outl(0x02000000|AINT_WRITE_COMPL, devpriv->iobase_a+AMCC_OP_REG_INTCSR); +/* outl(0x02000000|AINT_WRITE_COMPL, devpriv->iobase_a+AMCC_OP_REG_INTCSR); */ outl(inl(devpriv->iobase_a + AMCC_OP_REG_MCSR) | RESET_A2P_FLAGS | A2P_HI_PRIORITY | EN_A2P_TRANSFERS, devpriv->iobase_a + AMCC_OP_REG_MCSR); - outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | EN_A2P_TRANSFERS, devpriv->iobase_a + AMCC_OP_REG_INTCSR); // allow bus mastering + outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | EN_A2P_TRANSFERS, devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* allow bus mastering */ DPRINTK("adl_pci9118 EDBG: END: Compute_and_setup_dma()\n"); return 0; @@ -1186,17 +1187,17 @@ static int pci9118_ai_docmd_sampl(struct comedi_device * dev, struct comedi_subd return -EIO; }; - devpriv->int_ai_func = interrupt_pci9118_ai_onesample; //transfer function + devpriv->int_ai_func = interrupt_pci9118_ai_onesample; /* transfer function */ if (devpriv->ai12_startstop) - pci9118_exttrg_add(dev, EXTTRG_AI); // activate EXT trigger + pci9118_exttrg_add(dev, EXTTRG_AI); /* activate EXT trigger */ if ((devpriv->ai_do == 1) || (devpriv->ai_do == 2)) devpriv->IntControlReg |= Int_Timer; devpriv->AdControlReg |= AdControl_Int; - outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, devpriv->iobase_a + AMCC_OP_REG_INTCSR); // allow INT in AMCC + outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* allow INT in AMCC */ if (!(devpriv->ai12_startstop & (START_AI_EXT | START_AI_INT))) { outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); @@ -1261,10 +1262,10 @@ static int pci9118_ai_docmd_dma(struct comedi_device * dev, struct comedi_subdev }; if (devpriv->ai12_startstop) { - pci9118_exttrg_add(dev, EXTTRG_AI); // activate EXT trigger + pci9118_exttrg_add(dev, EXTTRG_AI); /* activate EXT trigger */ } - devpriv->int_ai_func = interrupt_pci9118_ai_dma; //transfer function + devpriv->int_ai_func = interrupt_pci9118_ai_dma; /* transfer function */ outl(0x02000000 | AINT_WRITE_COMPL, devpriv->iobase_a + AMCC_OP_REG_INTCSR); @@ -1307,7 +1308,7 @@ static int pci9118_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * devpriv->ai_add_back = 0; devpriv->ai_maskerr = 0x10e; - // prepare for start/stop conditions + /* prepare for start/stop conditions */ if (cmd->start_src == TRIG_EXT) devpriv->ai12_startstop |= START_AI_EXT; if (cmd->stop_src == TRIG_EXT) { @@ -1334,19 +1335,19 @@ static int pci9118_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * devpriv->ai_scans = 0; } - // use sample&hold signal? + /* use sample&hold signal? */ if (cmd->convert_src == TRIG_NOW) { devpriv->usessh = 1; - } // yes + } /* yes */ else { devpriv->usessh = 0; - } // no + } /* no */ DPRINTK("1 neverending=%d scans=%u usessh=%d ai_startstop=0x%2x\n", devpriv->ai_neverending, devpriv->ai_scans, devpriv->usessh, devpriv->ai12_startstop); - // use additional sample at end of every scan to satisty DMA 32 bit transfer? + /* use additional sample at end of every scan to satisty DMA 32 bit transfer? */ devpriv->ai_add_front = 0; devpriv->ai_add_back = 0; devpriv->useeoshandle = 0; @@ -1358,27 +1359,27 @@ static int pci9118_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * devpriv->ai_add_back = 1; } if (cmd->convert_src == TRIG_TIMER) { - devpriv->usedma = 0; // use INT transfer if scanlist have only one channel + devpriv->usedma = 0; /* use INT transfer if scanlist have only one channel */ } } if ((cmd->flags & TRIG_WAKE_EOS) && (devpriv->ai_n_scanlen & 1) && (devpriv->ai_n_scanlen > 1)) { if (cmd->scan_begin_src == TRIG_FOLLOW) { - //vpriv->useeoshandle=1; // change DMA transfer block to fit EOS on every second call - devpriv->usedma = 0; // XXX maybe can be corrected to use 16 bit DMA - } else { // well, we must insert one sample to end of EOS to meet 32 bit transfer + /* vpriv->useeoshandle=1; // change DMA transfer block to fit EOS on every second call */ + devpriv->usedma = 0; /* XXX maybe can be corrected to use 16 bit DMA */ + } else { /* well, we must insert one sample to end of EOS to meet 32 bit transfer */ devpriv->ai_add_back = 1; } } - } else { // interrupt transfer don't need any correction + } else { /* interrupt transfer don't need any correction */ devpriv->usedma = 0; } - // we need software S&H signal? It add two samples before every scan as minimum + /* we need software S&H signal? It add two samples before every scan as minimum */ if (devpriv->usessh && devpriv->softsshdelay) { devpriv->ai_add_front = 2; - if ((devpriv->usedma == 1) && (devpriv->ai_add_back == 1)) { // move it to front + if ((devpriv->usedma == 1) && (devpriv->ai_add_back == 1)) { /* move it to front */ devpriv->ai_add_front++; devpriv->ai_add_back = 0; } @@ -1387,17 +1388,17 @@ static int pci9118_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * addchans = devpriv->softsshdelay / cmd->convert_arg; if (devpriv->softsshdelay % cmd->convert_arg) addchans++; - if (addchans > (devpriv->ai_add_front - 1)) { // uff, still short :-( + if (addchans > (devpriv->ai_add_front - 1)) { /* uff, still short :-( */ devpriv->ai_add_front = addchans + 1; if (devpriv->usedma == 1) if ((devpriv->ai_add_front + devpriv->ai_n_chan + devpriv->ai_add_back) & 1) - devpriv->ai_add_front++; // round up to 32 bit + devpriv->ai_add_front++; /* round up to 32 bit */ } - } // well, we now know what must be all added + } /* well, we now know what must be all added */ - devpriv->ai_n_realscanlen = // what we must take from card in real to have ai_n_scanlen on output? + devpriv->ai_n_realscanlen = /* what we must take from card in real to have ai_n_scanlen on output? */ (devpriv->ai_add_front + devpriv->ai_n_chan + devpriv->ai_add_back) * (devpriv->ai_n_scanlen / devpriv->ai_n_chan); @@ -1408,7 +1409,7 @@ static int pci9118_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * devpriv->ai_n_chan, devpriv->ai_add_back, devpriv->ai_n_scanlen); - // check and setup channel list + /* check and setup channel list */ if (!check_channel_list(dev, s, devpriv->ai_n_chan, devpriv->ai_chanlist, devpriv->ai_add_front, devpriv->ai_add_back)) @@ -1419,9 +1420,9 @@ static int pci9118_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * devpriv->useeoshandle)) return -EINVAL; - // compute timers settings - // simplest way, fr=4Mhz/(tim1*tim2), channel manipulation without timers effect - if (((cmd->scan_begin_src == TRIG_FOLLOW) || (cmd->scan_begin_src == TRIG_EXT) || (cmd->scan_begin_src == TRIG_INT)) && (cmd->convert_src == TRIG_TIMER)) { // both timer is used for one time + /* compute timers settings */ + /* simplest way, fr=4Mhz/(tim1*tim2), channel manipulation without timers effect */ + if (((cmd->scan_begin_src == TRIG_FOLLOW) || (cmd->scan_begin_src == TRIG_EXT) || (cmd->scan_begin_src == TRIG_INT)) && (cmd->convert_src == TRIG_TIMER)) { /* both timer is used for one time */ if (cmd->scan_begin_src == TRIG_EXT) { devpriv->ai_do = 4; } else { @@ -1435,7 +1436,7 @@ static int pci9118_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * devpriv->ai_timer2 = cmd->convert_arg; } - if ((cmd->scan_begin_src == TRIG_TIMER) && ((cmd->convert_src == TRIG_TIMER) || (cmd->convert_src == TRIG_NOW))) { // double timed action + if ((cmd->scan_begin_src == TRIG_TIMER) && ((cmd->convert_src == TRIG_TIMER) || (cmd->convert_src == TRIG_NOW))) { /* double timed action */ if (!devpriv->usedma) { comedi_error(dev, "cmd->scan_begin_src=TRIG_TIMER works only with bus mastering!"); @@ -1457,15 +1458,15 @@ static int pci9118_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * devpriv->ai_do = 3; } - start_pacer(dev, -1, 0, 0); // stop pacer + start_pacer(dev, -1, 0, 0); /* stop pacer */ - devpriv->AdControlReg = 0; // bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable DMA + devpriv->AdControlReg = 0; /* bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable DMA */ outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); - devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg; // positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop + devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg; /* positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop */ outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); comedi_udelay(1); - outl(0, dev->iobase + PCI9118_DELFIFO); // flush FIFO - inl(dev->iobase + PCI9118_ADSTAT); // flush A/D and INT status register + outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ + inl(dev->iobase + PCI9118_ADSTAT); /* flush A/D and INT status register */ inl(dev->iobase + PCI9118_INTSRC); devpriv->ai_act_scan = 0; @@ -1505,11 +1506,11 @@ static int check_channel_list(struct comedi_device * dev, struct comedi_subdevic } if (CR_AREF(chanlist[0]) == AREF_DIFF) - differencial = 1; // all input must be diff + differencial = 1; /* all input must be diff */ if (CR_RANGE(chanlist[0]) < PCI9118_BIPOLAR_RANGES) - bipolar = 1; // all input must be bipolar + bipolar = 1; /* all input must be bipolar */ if (n_chan > 1) - for (i = 1; i < n_chan; i++) { // check S.E/diff + for (i = 1; i < n_chan; i++) { /* check S.E/diff */ if ((CR_AREF(chanlist[i]) == AREF_DIFF) != (differencial)) { comedi_error(dev, @@ -1552,27 +1553,27 @@ static int setup_channel_list(struct comedi_device * dev, struct comedi_subdevic } if (CR_AREF(chanlist[0]) == AREF_DIFF) - differencial = 1; // all input must be diff + differencial = 1; /* all input must be diff */ if (CR_RANGE(chanlist[0]) < PCI9118_BIPOLAR_RANGES) - bipolar = 1; // all input must be bipolar + bipolar = 1; /* all input must be bipolar */ - // All is ok, so we can setup channel/range list + /* All is ok, so we can setup channel/range list */ if (!bipolar) { - devpriv->AdControlReg |= AdControl_UniP; // set unibipolar + devpriv->AdControlReg |= AdControl_UniP; /* set unibipolar */ } else { - devpriv->AdControlReg &= ((~AdControl_UniP) & 0xff); // enable bipolar + devpriv->AdControlReg &= ((~AdControl_UniP) & 0xff); /* enable bipolar */ } if (differencial) { - devpriv->AdControlReg |= AdControl_Diff; // enable diff inputs + devpriv->AdControlReg |= AdControl_Diff; /* enable diff inputs */ } else { - devpriv->AdControlReg &= ((~AdControl_Diff) & 0xff); // set single ended inputs + devpriv->AdControlReg &= ((~AdControl_Diff) & 0xff); /* set single ended inputs */ } - outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); // setup mode + outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); /* setup mode */ - outl(2, dev->iobase + PCI9118_SCANMOD); // gods know why this sequence! + outl(2, dev->iobase + PCI9118_SCANMOD); /* gods know why this sequence! */ outl(0, dev->iobase + PCI9118_SCANMOD); outl(1, dev->iobase + PCI9118_SCANMOD); @@ -1582,12 +1583,12 @@ static int setup_channel_list(struct comedi_device * dev, struct comedi_subdevic devpriv->chanlist[i] = 0x55aa; #endif - if (frontadd) { // insert channels for S&H + if (frontadd) { /* insert channels for S&H */ ssh = devpriv->softsshsample; DPRINTK("FA: %04x: ", ssh); - for (i = 0; i < frontadd; i++) { // store range list to card - scanquad = CR_CHAN(chanlist[0]); // get channel number; - gain = CR_RANGE(chanlist[0]); // get gain number + for (i = 0; i < frontadd; i++) { /* store range list to card */ + scanquad = CR_CHAN(chanlist[0]); /* get channel number; */ + gain = CR_RANGE(chanlist[0]); /* get gain number */ scanquad |= ((gain & 0x03) << 8); outl(scanquad | ssh, dev->iobase + PCI9118_GAIN); DPRINTK("%02x ", scanquad | ssh); @@ -1597,23 +1598,23 @@ static int setup_channel_list(struct comedi_device * dev, struct comedi_subdevic } DPRINTK("SL: ", ssh); - for (i = 0; i < n_chan; i++) { // store range list to card - scanquad = CR_CHAN(chanlist[i]); // get channel number; + for (i = 0; i < n_chan; i++) { /* store range list to card */ + scanquad = CR_CHAN(chanlist[i]); /* get channel number; */ #ifdef PCI9118_PARANOIDCHECK devpriv->chanlist[i ^ usedma] = (scanquad & 0xf) << rot; #endif - gain = CR_RANGE(chanlist[i]); // get gain number + gain = CR_RANGE(chanlist[i]); /* get gain number */ scanquad |= ((gain & 0x03) << 8); outl(scanquad | ssh, dev->iobase + PCI9118_GAIN); DPRINTK("%02x ", scanquad | ssh); } DPRINTK("\n "); - if (backadd) { // insert channels for fit onto 32bit DMA + if (backadd) { /* insert channels for fit onto 32bit DMA */ DPRINTK("BA: %04x: ", ssh); - for (i = 0; i < backadd; i++) { // store range list to card - scanquad = CR_CHAN(chanlist[0]); // get channel number; - gain = CR_RANGE(chanlist[0]); // get gain number + for (i = 0; i < backadd; i++) { /* store range list to card */ + scanquad = CR_CHAN(chanlist[0]); /* get channel number; */ + gain = CR_RANGE(chanlist[0]); /* get gain number */ scanquad |= ((gain & 0x03) << 8); outl(scanquad | ssh, dev->iobase + PCI9118_GAIN); DPRINTK("%02x ", scanquad | ssh); @@ -1621,13 +1622,13 @@ static int setup_channel_list(struct comedi_device * dev, struct comedi_subdevic DPRINTK("\n "); } #ifdef PCI9118_PARANOIDCHECK - devpriv->chanlist[n_chan ^ usedma] = devpriv->chanlist[0 ^ usedma]; // for 32bit oerations + devpriv->chanlist[n_chan ^ usedma] = devpriv->chanlist[0 ^ usedma]; /* for 32bit oerations */ if (useeos) { - for (i = 1; i < n_chan; i++) { // store range list to card + for (i = 1; i < n_chan; i++) { /* store range list to card */ devpriv->chanlist[(n_chan + i) ^ usedma] = (CR_CHAN(chanlist[i]) & 0xf) << rot; } - devpriv->chanlist[(2 * n_chan) ^ usedma] = devpriv->chanlist[0 ^ usedma]; // for 32bit oerations + devpriv->chanlist[(2 * n_chan) ^ usedma] = devpriv->chanlist[0 ^ usedma]; /* for 32bit oerations */ useeos = 2; } else { useeos = 1; @@ -1640,11 +1641,11 @@ static int setup_channel_list(struct comedi_device * dev, struct comedi_subdevic DPRINTK("\n "); #endif #endif - outl(0, dev->iobase + PCI9118_SCANMOD); // close scan queue -// comedi_udelay(100); // important delay, or first sample will be cripled + outl(0, dev->iobase + PCI9118_SCANMOD); /* close scan queue */ +/* comedi_udelay(100); important delay, or first sample will be cripled */ DPRINTK("adl_pci9118 EDBG: END: setup_channel_list()\n"); - return 1; // we can serve this with scan logic + return 1; /* we can serve this with scan logic */ } /* @@ -1672,17 +1673,17 @@ static void pci9118_calc_divisors(char mode, struct comedi_device * dev, *tim2 = this_board->ai_ns_min; DPRINTK("1 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2, *tim1, *tim2); - *div1 = *tim2 / devpriv->i8254_osc_base; // convert timer (burst) + *div1 = *tim2 / devpriv->i8254_osc_base; /* convert timer (burst) */ DPRINTK("2 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2, *tim1, *tim2); if (*div1 < this_board->ai_pacer_min) *div1 = this_board->ai_pacer_min; DPRINTK("3 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2, *tim1, *tim2); - *div2 = *tim1 / devpriv->i8254_osc_base; // scan timer + *div2 = *tim1 / devpriv->i8254_osc_base; /* scan timer */ DPRINTK("4 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2, *tim1, *tim2); - *div2 = *div2 / *div1; // major timer is c1*c2 + *div2 = *div2 / *div1; /* major timer is c1*c2 */ DPRINTK("5 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2, *tim1, *tim2); if (*div2 < chans) @@ -1690,9 +1691,9 @@ static void pci9118_calc_divisors(char mode, struct comedi_device * dev, DPRINTK("6 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2, *tim1, *tim2); - *tim2 = *div1 * devpriv->i8254_osc_base; // real convert timer + *tim2 = *div1 * devpriv->i8254_osc_base; /* real convert timer */ - if (usessh & (chnsshfront == 0)) // use BSSH signal + if (usessh & (chnsshfront == 0)) /* use BSSH signal */ if (*div2 < (chans + 2)) *div2 = chans + 2; @@ -1715,7 +1716,7 @@ static void start_pacer(struct comedi_device * dev, int mode, unsigned int divis { outl(0x74, dev->iobase + PCI9118_CNTCTRL); outl(0xb4, dev->iobase + PCI9118_CNTCTRL); -// outl(0x30, dev->iobase + PCI9118_CNTCTRL); +/* outl(0x30, dev->iobase + PCI9118_CNTCTRL); */ comedi_udelay(1); if ((mode == 1) || (mode == 2) || (mode == 4)) { @@ -1732,11 +1733,11 @@ static void start_pacer(struct comedi_device * dev, int mode, unsigned int divis static int pci9118_exttrg_add(struct comedi_device * dev, unsigned char source) { if (source > 3) - return -1; // incorrect source + return -1; /* incorrect source */ devpriv->exttrg_users |= (1 << source); devpriv->IntControlReg |= Int_DTrg; outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); - outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, devpriv->iobase_a + AMCC_OP_REG_INTCSR); // allow INT in AMCC + outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* allow INT in AMCC */ return 0; } @@ -1746,12 +1747,12 @@ static int pci9118_exttrg_add(struct comedi_device * dev, unsigned char source) static int pci9118_exttrg_del(struct comedi_device * dev, unsigned char source) { if (source > 3) - return -1; // incorrect source + return -1; /* incorrect source */ devpriv->exttrg_users &= ~(1 << source); - if (!devpriv->exttrg_users) { // shutdown ext trg intterrupts + if (!devpriv->exttrg_users) { /* shutdown ext trg intterrupts */ devpriv->IntControlReg &= ~Int_DTrg; - if (!devpriv->IntControlReg) // all IRQ disabled - outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) & (~0x00001f00), devpriv->iobase_a + AMCC_OP_REG_INTCSR); // disable int in AMCC + if (!devpriv->IntControlReg) /* all IRQ disabled */ + outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) & (~0x00001f00), devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* disable int in AMCC */ outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); } return 0; @@ -1763,17 +1764,17 @@ static int pci9118_exttrg_del(struct comedi_device * dev, unsigned char source) static int pci9118_ai_cancel(struct comedi_device * dev, struct comedi_subdevice * s) { if (devpriv->usedma) - outl(inl(devpriv->iobase_a + AMCC_OP_REG_MCSR) & (~EN_A2P_TRANSFERS), devpriv->iobase_a + AMCC_OP_REG_MCSR); // stop DMA + outl(inl(devpriv->iobase_a + AMCC_OP_REG_MCSR) & (~EN_A2P_TRANSFERS), devpriv->iobase_a + AMCC_OP_REG_MCSR); /* stop DMA */ pci9118_exttrg_del(dev, EXTTRG_AI); - start_pacer(dev, 0, 0, 0); // stop 8254 counters + start_pacer(dev, 0, 0, 0); /* stop 8254 counters */ devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg; - outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); // positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop + outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); /* positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop */ devpriv->AdControlReg = 0x00; - outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); // bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable INT and DMA + outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); /* bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable INT and DMA */ outl(0, dev->iobase + PCI9118_BURST); outl(1, dev->iobase + PCI9118_SCANMOD); - outl(2, dev->iobase + PCI9118_SCANMOD); // reset scan queue - outl(0, dev->iobase + PCI9118_DELFIFO); // flush FIFO + outl(2, dev->iobase + PCI9118_SCANMOD); /* reset scan queue */ + outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ devpriv->ai_do = 0; devpriv->usedma = 0; @@ -1787,7 +1788,7 @@ static int pci9118_ai_cancel(struct comedi_device * dev, struct comedi_subdevice devpriv->dma_actbuf = 0; if (!devpriv->IntControlReg) - outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, devpriv->iobase_a + AMCC_OP_REG_INTCSR); // allow INT in AMCC + outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* allow INT in AMCC */ return 0; } @@ -1800,31 +1801,31 @@ static int pci9118_reset(struct comedi_device * dev) devpriv->IntControlReg = 0; devpriv->exttrg_users = 0; inl(dev->iobase + PCI9118_INTCTRL); - outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); // disable interrupts source + outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); /* disable interrupts source */ outl(0x30, dev->iobase + PCI9118_CNTCTRL); -// outl(0xb4, dev->iobase + PCI9118_CNTCTRL); - start_pacer(dev, 0, 0, 0); // stop 8254 counters +/* outl(0xb4, dev->iobase + PCI9118_CNTCTRL); */ + start_pacer(dev, 0, 0, 0); /* stop 8254 counters */ devpriv->AdControlReg = 0; - outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); // bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable INT and DMA + outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); /* bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable INT and DMA */ outl(0, dev->iobase + PCI9118_BURST); outl(1, dev->iobase + PCI9118_SCANMOD); - outl(2, dev->iobase + PCI9118_SCANMOD); // reset scan queue + outl(2, dev->iobase + PCI9118_SCANMOD); /* reset scan queue */ devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg; - outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); // positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop + outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); /* positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop */ devpriv->ao_data[0] = 2047; devpriv->ao_data[1] = 2047; - outl(devpriv->ao_data[0], dev->iobase + PCI9118_DA1); // reset A/D outs to 0V + outl(devpriv->ao_data[0], dev->iobase + PCI9118_DA1); /* reset A/D outs to 0V */ outl(devpriv->ao_data[1], dev->iobase + PCI9118_DA2); - outl(0, dev->iobase + PCI9118_DO); // reset digi outs to L + outl(0, dev->iobase + PCI9118_DO); /* reset digi outs to L */ comedi_udelay(10); inl(dev->iobase + PCI9118_AD_DATA); - outl(0, dev->iobase + PCI9118_DELFIFO); // flush FIFO - outl(0, dev->iobase + PCI9118_INTSRC); // remove INT requests - inl(dev->iobase + PCI9118_ADSTAT); // flush A/D status register - inl(dev->iobase + PCI9118_INTSRC); // flush INT requests + outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ + outl(0, dev->iobase + PCI9118_INTSRC); /* remove INT requests */ + inl(dev->iobase + PCI9118_ADSTAT); /* flush A/D status register */ + inl(dev->iobase + PCI9118_INTSRC); /* flush INT requests */ devpriv->AdControlReg = 0; - outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); // bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable INT and DMA + outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); /* bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable INT and DMA */ devpriv->cnt0_users = 0; devpriv->exttrg_users = 0; @@ -1854,7 +1855,7 @@ static int pci9118_attach(struct comedi_device * dev, struct comedi_devconfig * opt_bus = it->options[0]; opt_slot = it->options[1]; if (it->options[3] & 1) { - master = 0; // user don't want use bus master + master = 0; /* user don't want use bus master */ } else { master = 1; } @@ -1920,7 +1921,7 @@ static int pci9118_attach(struct comedi_device * dev, struct comedi_devconfig * pci9118_reset(dev); if (it->options[3] & 2) - irq = 0; // user don't want use IRQ + irq = 0; /* user don't want use IRQ */ if (irq > 0) { if (comedi_request_irq(irq, interrupt_pci9118, IRQF_SHARED, "ADLink PCI-9118", dev)) { @@ -1936,7 +1937,7 @@ static int pci9118_attach(struct comedi_device * dev, struct comedi_devconfig * dev->irq = irq; - if (master) { // alloc DMA buffers + if (master) { /* alloc DMA buffers */ devpriv->dma_doublebuf = 0; for (i = 0; i < 2; i++) { for (pages = 4; pages >= 0; pages--) @@ -1974,16 +1975,16 @@ static int pci9118_attach(struct comedi_device * dev, struct comedi_devconfig * if (it->options[2] > 0) { devpriv->usemux = it->options[2]; if (devpriv->usemux > 256) - devpriv->usemux = 256; // max 256 channels! + devpriv->usemux = 256; /* max 256 channels! */ if (it->options[4] > 0) if (devpriv->usemux > 128) { - devpriv->usemux = 128; // max 128 channels with softare S&H! + devpriv->usemux = 128; /* max 128 channels with softare S&H! */ } rt_printk(", ext. mux %d channels", devpriv->usemux); } devpriv->softsshdelay = it->options[4]; - if (devpriv->softsshdelay < 0) { // select sample&hold signal polarity + if (devpriv->softsshdelay < 0) { /* select sample&hold signal polarity */ devpriv->softsshdelay = -devpriv->softsshdelay; devpriv->softsshsample = 0x80; devpriv->softsshhold = 0x00; @@ -1995,7 +1996,7 @@ static int pci9118_attach(struct comedi_device * dev, struct comedi_devconfig * rt_printk(".\n"); pci_read_config_word(devpriv->pcidev, PCI_COMMAND, &u16w); - pci_write_config_word(devpriv->pcidev, PCI_COMMAND, u16w | 64); // Enable parity check for parity error + pci_write_config_word(devpriv->pcidev, PCI_COMMAND, u16w | 64); /* Enable parity check for parity error */ if ((ret = alloc_subdevices(dev, 4)) < 0) return ret; @@ -2052,9 +2053,9 @@ static int pci9118_attach(struct comedi_device * dev, struct comedi_devconfig * s->insn_bits = pci9118_insn_bits_do; devpriv->valid = 1; - devpriv->i8254_osc_base = 250; // 250ns=4MHz - devpriv->ai_maskharderr = 0x10a; // default measure crash condition - if (it->options[5]) // disable some requested + devpriv->i8254_osc_base = 250; /* 250ns=4MHz */ + devpriv->ai_maskharderr = 0x10a; /* default measure crash condition */ + if (it->options[5]) /* disable some requested */ devpriv->ai_maskharderr &= ~it->options[5]; switch (this_board->ai_maxdata) { diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 29eac743c8e0..b8b5001c5d24 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -41,6 +41,8 @@ Configuration options: device will be used. */ +#include <linux/interrupt.h> + #include "../comedidev.h" #include "comedi_pci.h" @@ -61,7 +63,7 @@ Configuration options: #define DPRINTK(fmt, args...) #endif -// hardware types of the cards +/* hardware types of the cards */ #define TYPE_PCI171X 0 #define TYPE_PCI1713 2 #define TYPE_PCI1720 3 @@ -87,12 +89,12 @@ Configuration options: #define PCI171x_CNT2 28 /* R/W: 8254 couter 2 */ #define PCI171x_CNTCTRL 30 /* W: 8254 counter control */ -// upper bits from status register (PCI171x_STATUS) (lower is same woth control reg) +/* upper bits from status register (PCI171x_STATUS) (lower is same woth control reg) */ #define Status_FE 0x0100 /* 1=FIFO is empty */ #define Status_FH 0x0200 /* 1=FIFO is half full */ #define Status_FF 0x0400 /* 1=FIFO is full, fatal error */ #define Status_IRQ 0x0800 /* 1=IRQ occured */ -// bits from control register (PCI171x_CONTROL) +/* bits from control register (PCI171x_CONTROL) */ #define Control_CNT0 0x0040 /* 1=CNT0 have external source, 0=have internal 100kHz source */ #define Control_ONEFH 0x0020 /* 1=IRQ on FIFO is half full, 0=every sample */ #define Control_IRQEN 0x0010 /* 1=enable IRQ */ @@ -100,7 +102,7 @@ Configuration options: #define Control_EXT 0x0004 /* 1=external trigger source */ #define Control_PACER 0x0002 /* 1=enable internal 8254 trigger source */ #define Control_SW 0x0001 /* 1=enable software trigger source */ -// bits from counter control register (PCI171x_CNTCTRL) +/* bits from counter control register (PCI171x_CNTCTRL) */ #define Counter_BCD 0x0001 /* 0 = binary counter, 1 = BCD counter */ #define Counter_M0 0x0002 /* M0-M2 select modes 0-5 */ #define Counter_M1 0x0004 /* 000 = mode 0, 010 = mode 2 ... */ @@ -118,7 +120,7 @@ Configuration options: #define PCI1720_SYNCOUT 9 /* W: D/A synchronized output register */ #define PCI1720_SYNCONT 15 /* R/W: D/A synchronized control */ -// D/A synchronized control (PCI1720_SYNCONT) +/* D/A synchronized control (PCI1720_SYNCONT) */ #define Syncont_SC0 1 /* set synchronous output mode */ static const struct comedi_lrange range_pci1710_3 = { 9, { @@ -186,24 +188,24 @@ static int pci1710_attach(struct comedi_device * dev, struct comedi_devconfig * static int pci1710_detach(struct comedi_device * dev); struct boardtype { - const char *name; // board name + const char *name; /* board name */ int device_id; - int iorange; // I/O range len - char have_irq; // 1=card support IRQ - char cardtype; // 0=1710& co. 2=1713, ... - int n_aichan; // num of A/D chans - int n_aichand; // num of A/D chans in diff mode - int n_aochan; // num of D/A chans - int n_dichan; // num of DI chans - int n_dochan; // num of DO chans - int n_counter; // num of counters - int ai_maxdata; // resolution of A/D - int ao_maxdata; // resolution of D/A - const struct comedi_lrange *rangelist_ai; // rangelist for A/D - const char *rangecode_ai; // range codes for programming - const struct comedi_lrange *rangelist_ao; // rangelist for D/A - unsigned int ai_ns_min; // max sample speed of card v ns - unsigned int fifo_half_size; // size of FIFO/2 + int iorange; /* I/O range len */ + char have_irq; /* 1=card support IRQ */ + char cardtype; /* 0=1710& co. 2=1713, ... */ + int n_aichan; /* num of A/D chans */ + int n_aichand; /* num of A/D chans in diff mode */ + int n_aochan; /* num of D/A chans */ + int n_dichan; /* num of DI chans */ + int n_dochan; /* num of DO chans */ + int n_counter; /* num of counters */ + int ai_maxdata; /* resolution of A/D */ + int ao_maxdata; /* resolution of D/A */ + const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */ + const char *rangecode_ai; /* range codes for programming */ + const struct comedi_lrange *rangelist_ao; /* rangelist for D/A */ + unsigned int ai_ns_min; /* max sample speed of card v ns */ + unsigned int fifo_half_size; /* size of FIFO/2 */ }; static DEFINE_PCI_DEVICE_TABLE(pci1710_pci_table) = { @@ -250,7 +252,7 @@ static const struct boardtype boardtypes[] = { 16, 0, 0, 16, 16, 0, 0x0fff, 0x0000, &range_pci17x1, range_codes_pci17x1, NULL, 10000, 512}, - // dummy entry corresponding to driver name + /* dummy entry corresponding to driver name */ {.name = DRV_NAME}, }; @@ -267,34 +269,34 @@ static struct comedi_driver driver_pci1710 = { }; struct pci1710_private { - struct pci_dev *pcidev; // ptr to PCI device - char valid; // card is usable - char neverending_ai; // we do unlimited AI - unsigned int CntrlReg; // Control register - unsigned int i8254_osc_base; // frequence of onboard oscilator - unsigned int ai_do; // what do AI? 0=nothing, 1 to 4 mode - unsigned int ai_act_scan; // how many scans we finished - unsigned int ai_act_chan; // actual position in actual scan - unsigned int ai_buf_ptr; // data buffer ptr in samples - unsigned char ai_eos; // 1=EOS wake up + struct pci_dev *pcidev; /* ptr to PCI device */ + char valid; /* card is usable */ + char neverending_ai; /* we do unlimited AI */ + unsigned int CntrlReg; /* Control register */ + unsigned int i8254_osc_base; /* frequence of onboard oscilator */ + unsigned int ai_do; /* what do AI? 0=nothing, 1 to 4 mode */ + unsigned int ai_act_scan; /* how many scans we finished */ + unsigned int ai_act_chan; /* actual position in actual scan */ + unsigned int ai_buf_ptr; /* data buffer ptr in samples */ + unsigned char ai_eos; /* 1=EOS wake up */ unsigned char ai_et; unsigned int ai_et_CntrlReg; unsigned int ai_et_MuxVal; unsigned int ai_et_div1, ai_et_div2; - unsigned int act_chanlist[32]; // list of scaned channel - unsigned char act_chanlist_len; // len of scanlist - unsigned char act_chanlist_pos; // actual position in MUX list - unsigned char da_ranges; // copy of D/A outpit range register - unsigned int ai_scans; // len of scanlist - unsigned int ai_n_chan; // how many channels is measured - unsigned int *ai_chanlist; // actaul chanlist - unsigned int ai_flags; // flaglist - unsigned int ai_data_len; // len of data buffer - short *ai_data; // data buffer - unsigned int ai_timer1; // timers + unsigned int act_chanlist[32]; /* list of scaned channel */ + unsigned char act_chanlist_len; /* len of scanlist */ + unsigned char act_chanlist_pos; /* actual position in MUX list */ + unsigned char da_ranges; /* copy of D/A outpit range register */ + unsigned int ai_scans; /* len of scanlist */ + unsigned int ai_n_chan; /* how many channels is measured */ + unsigned int *ai_chanlist; /* actaul chanlist */ + unsigned int ai_flags; /* flaglist */ + unsigned int ai_data_len; /* len of data buffer */ + short *ai_data; /* data buffer */ + unsigned int ai_timer1; /* timers */ unsigned int ai_timer2; - short ao_data[4]; // data output buffer - unsigned int cnt0_write_wait; // after a write, wait for update of the internal state + short ao_data[4]; /* data output buffer */ + unsigned int cnt0_write_wait; /* after a write, wait for update of the internal state */ }; #define devpriv ((struct pci1710_private *)dev->private) @@ -313,7 +315,7 @@ static void start_pacer(struct comedi_device * dev, int mode, unsigned int divis static int pci1710_reset(struct comedi_device * dev); static int pci171x_ai_cancel(struct comedi_device * dev, struct comedi_subdevice * s); -static const unsigned int muxonechan[] = { 0x0000, 0x0101, 0x0202, 0x0303, 0x0404, 0x0505, 0x0606, 0x0707, // used for gain list programming +static const unsigned int muxonechan[] = { 0x0000, 0x0101, 0x0202, 0x0303, 0x0404, 0x0505, 0x0606, 0x0707, /* used for gain list programming */ 0x0808, 0x0909, 0x0a0a, 0x0b0b, 0x0c0c, 0x0d0d, 0x0e0e, 0x0f0f, 0x1010, 0x1111, 0x1212, 0x1313, 0x1414, 0x1515, 0x1616, 0x1717, 0x1818, 0x1919, 0x1a1a, 0x1b1b, 0x1c1c, 0x1d1d, 0x1e1e, 0x1f1f @@ -332,7 +334,7 @@ static int pci171x_insn_read_ai(struct comedi_device * dev, struct comedi_subdev DPRINTK("adv_pci1710 EDBG: BGN: pci171x_insn_read_ai(...)\n"); devpriv->CntrlReg &= Control_CNT0; - devpriv->CntrlReg |= Control_SW; // set software trigger + devpriv->CntrlReg |= Control_SW; /* set software trigger */ outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL); outb(0, dev->iobase + PCI171x_CLRFIFO); outb(0, dev->iobase + PCI171x_CLRINT); @@ -346,7 +348,7 @@ static int pci171x_insn_read_ai(struct comedi_device * dev, struct comedi_subdev outw(0, dev->iobase + PCI171x_SOFTTRG); /* start conversion */ DPRINTK("adv_pci1710 B n=%d ST=%4x\n", n, inw(dev->iobase + PCI171x_STATUS)); - //comedi_udelay(1); + /* comedi_udelay(1); */ DPRINTK("adv_pci1710 C n=%d ST=%4x\n", n, inw(dev->iobase + PCI171x_STATUS)); timeout = 100; @@ -563,7 +565,7 @@ static int pci1720_insn_write_ao(struct comedi_device * dev, struct comedi_subde for (n = 0; n < insn->n; n++) { outw(data[n], dev->iobase + PCI1720_DA0 + (chan << 1)); - outb(0, dev->iobase + PCI1720_SYNCOUT); // update outputs + outb(0, dev->iobase + PCI1720_SYNCOUT); /* update outputs */ } devpriv->ao_data[chan] = data[n]; @@ -602,7 +604,7 @@ static void interrupt_pci1710_every_sample(void *d) return; } - outb(0, dev->iobase + PCI171x_CLRINT); // clear our INT request + outb(0, dev->iobase + PCI171x_CLRINT); /* clear our INT request */ DPRINTK("FOR "); for (; !(inw(dev->iobase + PCI171x_STATUS) & Status_FE);) { @@ -637,11 +639,11 @@ static void interrupt_pci1710_every_sample(void *d) s->async->cur_chan = 0; } - if (s->async->cur_chan == 0) { // one scan done + if (s->async->cur_chan == 0) { /* one scan done */ devpriv->ai_act_scan++; DPRINTK("adv_pci1710 EDBG: EOS1 bic %d bip %d buc %d bup %d\n", s->async->buf_int_count, s->async->buf_int_ptr, s->async->buf_user_count, s->async->buf_user_ptr); DPRINTK("adv_pci1710 EDBG: EOS2\n"); - if ((!devpriv->neverending_ai) && (devpriv->ai_act_scan >= devpriv->ai_scans)) { // all data sampled + if ((!devpriv->neverending_ai) && (devpriv->ai_act_scan >= devpriv->ai_scans)) { /* all data sampled */ pci171x_ai_cancel(dev, s); s->async->events |= COMEDI_CB_EOA; comedi_event(dev, s); @@ -650,7 +652,7 @@ static void interrupt_pci1710_every_sample(void *d) } } - outb(0, dev->iobase + PCI171x_CLRINT); // clear our INT request + outb(0, dev->iobase + PCI171x_CLRINT); /* clear our INT request */ DPRINTK("adv_pci1710 EDBG: END: interrupt_pci1710_every_sample(...)\n"); comedi_event(dev, s); @@ -751,7 +753,7 @@ static void interrupt_pci1710_half_fifo(void *d) comedi_event(dev, s); return; } - outb(0, dev->iobase + PCI171x_CLRINT); // clear our INT request + outb(0, dev->iobase + PCI171x_CLRINT); /* clear our INT request */ DPRINTK("adv_pci1710 EDBG: END: interrupt_pci1710_half_fifo(...)\n"); comedi_event(dev, s); @@ -760,36 +762,36 @@ static void interrupt_pci1710_half_fifo(void *d) /* ============================================================================== */ -static irqreturn_t interrupt_service_pci1710(int irq, void *d PT_REGS_ARG) +static irqreturn_t interrupt_service_pci1710(int irq, void *d) { struct comedi_device *dev = d; DPRINTK("adv_pci1710 EDBG: BGN: interrupt_service_pci1710(%d,...)\n", irq); - if (!dev->attached) // is device attached? - return IRQ_NONE; // no, exit + if (!dev->attached) /* is device attached? */ + return IRQ_NONE; /* no, exit */ - if (!(inw(dev->iobase + PCI171x_STATUS) & Status_IRQ)) // is this interrupt from our board? - return IRQ_NONE; // no, exit + if (!(inw(dev->iobase + PCI171x_STATUS) & Status_IRQ)) /* is this interrupt from our board? */ + return IRQ_NONE; /* no, exit */ DPRINTK("adv_pci1710 EDBG: interrupt_service_pci1710() ST: %4x\n", inw(dev->iobase + PCI171x_STATUS)); - if (devpriv->ai_et) { // Switch from initial TRIG_EXT to TRIG_xxx. + if (devpriv->ai_et) { /* Switch from initial TRIG_EXT to TRIG_xxx. */ devpriv->ai_et = 0; devpriv->CntrlReg &= Control_CNT0; - devpriv->CntrlReg |= Control_SW; // set software trigger + devpriv->CntrlReg |= Control_SW; /* set software trigger */ outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL); devpriv->CntrlReg = devpriv->ai_et_CntrlReg; outb(0, dev->iobase + PCI171x_CLRFIFO); outb(0, dev->iobase + PCI171x_CLRINT); outw(devpriv->ai_et_MuxVal, dev->iobase + PCI171x_MUX); outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL); - // start pacer + /* start pacer */ start_pacer(dev, 1, devpriv->ai_et_div1, devpriv->ai_et_div2); return IRQ_HANDLED; } - if (devpriv->ai_eos) { // We use FIFO half full INT or not? + if (devpriv->ai_eos) { /* We use FIFO half full INT or not? */ interrupt_pci1710_every_sample(d); } else { interrupt_pci1710_half_fifo(d); @@ -809,7 +811,7 @@ static int pci171x_ai_docmd_and_mode(int mode, struct comedi_device * dev, DPRINTK("adv_pci1710 EDBG: BGN: pci171x_ai_docmd_and_mode(%d,...)\n", mode); - start_pacer(dev, -1, 0, 0); // stop pacer + start_pacer(dev, -1, 0, 0); /* stop pacer */ seglen = check_channel_list(dev, s, devpriv->ai_chanlist, devpriv->ai_n_chan); @@ -829,7 +831,7 @@ static int pci171x_ai_docmd_and_mode(int mode, struct comedi_device * dev, devpriv->neverending_ai = 0; devpriv->CntrlReg &= Control_CNT0; - if ((devpriv->ai_flags & TRIG_WAKE_EOS)) { // don't we want wake up every scan? devpriv->ai_eos=1; + if ((devpriv->ai_flags & TRIG_WAKE_EOS)) { /* don't we want wake up every scan? devpriv->ai_eos=1; */ devpriv->ai_eos = 1; } else { devpriv->CntrlReg |= Control_ONEFH; @@ -838,7 +840,7 @@ static int pci171x_ai_docmd_and_mode(int mode, struct comedi_device * dev, if ((devpriv->ai_scans == 0) || (devpriv->ai_scans == -1)) { devpriv->neverending_ai = 1; - } //well, user want neverending + } /* well, user want neverending */ else { devpriv->neverending_ai = 0; } @@ -863,7 +865,7 @@ static int pci171x_ai_docmd_and_mode(int mode, struct comedi_device * dev, DPRINTK("adv_pci1710 EDBG: OSC base=%u div1=%u div2=%u timer=%u\n", devpriv->i8254_osc_base, divisor1, divisor2, devpriv->ai_timer1); outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL); if (mode != 2) { - // start pacer + /* start pacer */ start_pacer(dev, mode, divisor1, divisor2); } else { devpriv->ai_et_div1 = divisor1; @@ -1055,7 +1057,7 @@ static int pci171x_ai_cmdtest(struct comedi_device * dev, struct comedi_subdevic if (cmd->chanlist) { if (!check_channel_list(dev, s, cmd->chanlist, cmd->chanlist_len)) - return 5; // incorrect channels list + return 5; /* incorrect channels list */ } DPRINTK("adv_pci1710 EDBG: BGN: pci171x_ai_cmdtest(...) ret=0\n"); @@ -1084,13 +1086,13 @@ static int pci171x_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * devpriv->ai_scans = 0; } - if (cmd->scan_begin_src == TRIG_FOLLOW) { // mode 1, 2, 3 - if (cmd->convert_src == TRIG_TIMER) { // mode 1 and 2 + if (cmd->scan_begin_src == TRIG_FOLLOW) { /* mode 1, 2, 3 */ + if (cmd->convert_src == TRIG_TIMER) { /* mode 1 and 2 */ devpriv->ai_timer1 = cmd->convert_arg; return pci171x_ai_docmd_and_mode(cmd->start_src == TRIG_EXT ? 2 : 1, dev, s); } - if (cmd->convert_src == TRIG_EXT) { // mode 3 + if (cmd->convert_src == TRIG_EXT) { /* mode 3 */ return pci171x_ai_docmd_and_mode(3, dev, s); } } @@ -1118,12 +1120,12 @@ static int check_channel_list(struct comedi_device * dev, struct comedi_subdevic } if (n_chan > 1) { - chansegment[0] = chanlist[0]; // first channel is everytime ok - for (i = 1, seglen = 1; i < n_chan; i++, seglen++) { // build part of chanlist - // rt_printk("%d. %d %d\n",i,CR_CHAN(chanlist[i]),CR_RANGE(chanlist[i])); + chansegment[0] = chanlist[0]; /* first channel is everytime ok */ + for (i = 1, seglen = 1; i < n_chan; i++, seglen++) { /* build part of chanlist */ + /* rt_printk("%d. %d %d\n",i,CR_CHAN(chanlist[i]),CR_RANGE(chanlist[i])); */ if (chanlist[0] == chanlist[i]) - break; // we detect loop, this must by finish - if (CR_CHAN(chanlist[i]) & 1) // odd channel cann't by differencial + break; /* we detect loop, this must by finish */ + if (CR_CHAN(chanlist[i]) & 1) /* odd channel cann't by differencial */ if (CR_AREF(chanlist[i]) == AREF_DIFF) { comedi_error(dev, "Odd channel can't be differential input!\n"); @@ -1133,18 +1135,18 @@ static int check_channel_list(struct comedi_device * dev, struct comedi_subdevic (CR_CHAN(chansegment[i - 1]) + 1) % s->n_chan; if (CR_AREF(chansegment[i - 1]) == AREF_DIFF) nowmustbechan = (nowmustbechan + 1) % s->n_chan; - if (nowmustbechan != CR_CHAN(chanlist[i])) { // channel list isn't continous :-( + if (nowmustbechan != CR_CHAN(chanlist[i])) { /* channel list isn't continous :-( */ rt_printk ("channel list must be continous! chanlist[%i]=%d but must be %d or %d!\n", i, CR_CHAN(chanlist[i]), nowmustbechan, CR_CHAN(chanlist[0])); return 0; } - chansegment[i] = chanlist[i]; // well, this is next correct channel in list + chansegment[i] = chanlist[i]; /* well, this is next correct channel in list */ } - for (i = 0, segpos = 0; i < n_chan; i++) { // check whole chanlist - //rt_printk("%d %d=%d %d\n",CR_CHAN(chansegment[i%seglen]),CR_RANGE(chansegment[i%seglen]),CR_CHAN(chanlist[i]),CR_RANGE(chanlist[i])); + for (i = 0, segpos = 0; i < n_chan; i++) { /* check whole chanlist */ + /* rt_printk("%d %d=%d %d\n",CR_CHAN(chansegment[i%seglen]),CR_RANGE(chansegment[i%seglen]),CR_CHAN(chanlist[i]),CR_RANGE(chanlist[i])); */ if (chanlist[i] != chansegment[i % seglen]) { rt_printk ("bad channel, reference or range number! chanlist[%i]=%d,%d,%d and not %d,%d,%d!\n", @@ -1154,7 +1156,7 @@ static int check_channel_list(struct comedi_device * dev, struct comedi_subdevic CR_CHAN(chanlist[i % seglen]), CR_RANGE(chanlist[i % seglen]), CR_AREF(chansegment[i % seglen])); - return 0; // chan/gain list is strange + return 0; /* chan/gain list is strange */ } } } else { @@ -1174,7 +1176,7 @@ static void setup_channel_list(struct comedi_device * dev, struct comedi_subdevi devpriv->act_chanlist_pos = 0; DPRINTK("SegLen: %d\n", seglen); - for (i = 0; i < seglen; i++) { // store range list to card + for (i = 0; i < seglen; i++) { /* store range list to card */ chanprog = muxonechan[CR_CHAN(chanlist[i])]; outw(chanprog, dev->iobase + PCI171x_MUX); /* select channel */ range = this_board->rangecode_ai[CR_RANGE(chanlist[i])]; @@ -1229,7 +1231,7 @@ static int pci171x_ai_cancel(struct comedi_device * dev, struct comedi_subdevice devpriv->CntrlReg &= Control_CNT0; devpriv->CntrlReg |= Control_SW; - outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL); // reset any operations + outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL); /* reset any operations */ start_pacer(dev, -1, 0, 0); outb(0, dev->iobase + PCI171x_CLRFIFO); outb(0, dev->iobase + PCI171x_CLRINT); @@ -1253,24 +1255,24 @@ static int pci171x_reset(struct comedi_device * dev) { DPRINTK("adv_pci1710 EDBG: BGN: pci171x_reset(...)\n"); outw(0x30, dev->iobase + PCI171x_CNTCTRL); - devpriv->CntrlReg = Control_SW | Control_CNT0; // Software trigger, CNT0=external - outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL); // reset any operations - outb(0, dev->iobase + PCI171x_CLRFIFO); // clear FIFO - outb(0, dev->iobase + PCI171x_CLRINT); // clear INT request - start_pacer(dev, -1, 0, 0); // stop 8254 + devpriv->CntrlReg = Control_SW | Control_CNT0; /* Software trigger, CNT0=external */ + outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL); /* reset any operations */ + outb(0, dev->iobase + PCI171x_CLRFIFO); /* clear FIFO */ + outb(0, dev->iobase + PCI171x_CLRINT); /* clear INT request */ + start_pacer(dev, -1, 0, 0); /* stop 8254 */ devpriv->da_ranges = 0; if (this_board->n_aochan) { - outb(devpriv->da_ranges, dev->iobase + PCI171x_DAREF); // set DACs to 0..5V - outw(0, dev->iobase + PCI171x_DA1); // set DA outputs to 0V + outb(devpriv->da_ranges, dev->iobase + PCI171x_DAREF); /* set DACs to 0..5V */ + outw(0, dev->iobase + PCI171x_DA1); /* set DA outputs to 0V */ devpriv->ao_data[0] = 0x0000; if (this_board->n_aochan > 1) { outw(0, dev->iobase + PCI171x_DA2); devpriv->ao_data[1] = 0x0000; } } - outw(0, dev->iobase + PCI171x_DO); // digital outputs to 0 - outb(0, dev->iobase + PCI171x_CLRFIFO); // clear FIFO - outb(0, dev->iobase + PCI171x_CLRINT); // clear INT request + outw(0, dev->iobase + PCI171x_DO); /* digital outputs to 0 */ + outb(0, dev->iobase + PCI171x_CLRFIFO); /* clear FIFO */ + outb(0, dev->iobase + PCI171x_CLRINT); /* clear INT request */ DPRINTK("adv_pci1710 EDBG: END: pci171x_reset(...)\n"); return 0; @@ -1282,14 +1284,14 @@ static int pci171x_reset(struct comedi_device * dev) static int pci1720_reset(struct comedi_device * dev) { DPRINTK("adv_pci1710 EDBG: BGN: pci1720_reset(...)\n"); - outb(Syncont_SC0, dev->iobase + PCI1720_SYNCONT); // set synchronous output mode + outb(Syncont_SC0, dev->iobase + PCI1720_SYNCONT); /* set synchronous output mode */ devpriv->da_ranges = 0xAA; - outb(devpriv->da_ranges, dev->iobase + PCI1720_RANGE); // set all ranges to +/-5V - outw(0x0800, dev->iobase + PCI1720_DA0); // set outputs to 0V + outb(devpriv->da_ranges, dev->iobase + PCI1720_RANGE); /* set all ranges to +/-5V */ + outw(0x0800, dev->iobase + PCI1720_DA0); /* set outputs to 0V */ outw(0x0800, dev->iobase + PCI1720_DA1); outw(0x0800, dev->iobase + PCI1720_DA2); outw(0x0800, dev->iobase + PCI1720_DA3); - outb(0, dev->iobase + PCI1720_SYNCOUT); // update outputs + outb(0, dev->iobase + PCI1720_SYNCOUT); /* update outputs */ devpriv->ao_data[0] = 0x0800; devpriv->ao_data[1] = 0x0800; devpriv->ao_data[2] = 0x0800; @@ -1376,7 +1378,7 @@ static int pci1710_attach(struct comedi_device * dev, struct comedi_devconfig * errstr = "failed to enable PCI device and request regions!"; continue; } - // fixup board_ptr in case we were using the dummy entry with the driver name + /* fixup board_ptr in case we were using the dummy entry with the driver name */ dev->board_ptr = &boardtypes[board_index]; break; } @@ -1467,7 +1469,7 @@ static int pci1710_attach(struct comedi_device * dev, struct comedi_devconfig * s->do_cmdtest = pci171x_ai_cmdtest; s->do_cmd = pci171x_ai_cmd; } - devpriv->i8254_osc_base = 100; // 100ns=10MHz + devpriv->i8254_osc_base = 100; /* 100ns=10MHz */ subdev++; } diff --git a/drivers/staging/comedi/drivers/adv_pci1723.c b/drivers/staging/comedi/drivers/adv_pci1723.c index 81f7ee18c150..eb4bf1f47b30 100644 --- a/drivers/staging/comedi/drivers/adv_pci1723.c +++ b/drivers/staging/comedi/drivers/adv_pci1723.c @@ -54,7 +54,7 @@ TODO: #define ADVANTECH_VENDOR 0x13fe /* Advantech PCI vendor ID */ -// hardware types of the cards +/* hardware types of the cards */ #define TYPE_PCI1723 0 #define IORANGE_1723 0x2A @@ -92,7 +92,7 @@ TODO: #define PCI1723_SELECT_CALIBRATION 0x28 /* Select the calibration Ref_V */ -//static unsigned short pci_list_builded=0; /*=1 list of card is know */ +/* static unsigned short pci_list_builded=0; =1 list of card is know */ static const struct comedi_lrange range_pci1723 = { 1, { BIP_RANGE(10) @@ -104,14 +104,14 @@ static const struct comedi_lrange range_pci1723 = { 1, { */ struct pci1723_board { const char *name; - int vendor_id; // PCI vendor a device ID of card + int vendor_id; /* PCI vendor a device ID of card */ int device_id; int iorange; char cardtype; - int n_aochan; // num of D/A chans - int n_diochan; // num of DIO chans - int ao_maxdata; // resolution of D/A - const struct comedi_lrange *rangelist_ao; // rangelist for D/A + int n_aochan; /* num of D/A chans */ + int n_diochan; /* num of DIO chans */ + int ao_maxdata; /* resolution of D/A */ + const struct comedi_lrange *rangelist_ao; /* rangelist for D/A */ }; static const struct pci1723_board boardtypes[] = { @@ -157,12 +157,12 @@ static struct comedi_driver driver_pci1723 = { /* this structure is for data unique to this hardware driver. */ struct pci1723_private { - int valid; //card is usable; + int valid; /* card is usable; */ struct pci_dev *pcidev; - unsigned char da_range[8]; // D/A output range for each channel + unsigned char da_range[8]; /* D/A output range for each channel */ - short ao_data[8]; // data output buffer + short ao_data[8]; /* data output buffer */ }; /*the following macro to make it easy to @@ -180,22 +180,22 @@ static int pci1723_reset(struct comedi_device * dev) int i; DPRINTK("adv_pci1723 EDBG: BGN: pci1723_reset(...)\n"); - outw(0x01, dev->iobase + PCI1723_SYN_SET); // set synchronous output mode + outw(0x01, dev->iobase + PCI1723_SYN_SET); /* set synchronous output mode */ for (i = 0; i < 8; i++) { - // set all outputs to 0V + /* set all outputs to 0V */ devpriv->ao_data[i] = 0x8000; outw(devpriv->ao_data[i], dev->iobase + PCI1723_DA(i)); - // set all ranges to +/- 10V + /* set all ranges to +/- 10V */ devpriv->da_range[i] = 0; outw(((devpriv->da_range[i] << 4) | i), PCI1723_RANGE_CALIBRATION_MODE); } - outw(0, dev->iobase + PCI1723_CHANGE_CHA_OUTPUT_TYPE_STROBE); // update ranges - outw(0, dev->iobase + PCI1723_SYN_STROBE); // update outputs + outw(0, dev->iobase + PCI1723_CHANGE_CHA_OUTPUT_TYPE_STROBE); /* update ranges */ + outw(0, dev->iobase + PCI1723_SYN_STROBE); /* update outputs */ - // set asynchronous output mode + /* set asynchronous output mode */ outw(0, dev->iobase + PCI1723_SYN_SET); DPRINTK("adv_pci1723 EDBG: END: pci1723_reset(...)\n"); @@ -265,12 +265,12 @@ static int pci1723_dio_insn_config(struct comedi_device * dev, struct comedi_sub return -EINVAL; } - // update hardware DIO mode - dio_mode = 0x0000; // low byte output, high byte output + /* update hardware DIO mode */ + dio_mode = 0x0000; /* low byte output, high byte output */ if ((s->io_bits & 0x00FF) == 0) - dio_mode |= 0x0001; // low byte input + dio_mode |= 0x0001; /* low byte input */ if ((s->io_bits & 0xFF00) == 0) - dio_mode |= 0x0002; // high byte input + dio_mode |= 0x0002; /* high byte input */ outw(dio_mode, dev->iobase + PCI1723_DIGITAL_IO_PORT_SET); return 1; } @@ -389,22 +389,22 @@ static int pci1723_attach(struct comedi_device * dev, struct comedi_devconfig * s->insn_write = pci1723_ao_write_winsn; s->insn_read = pci1723_insn_read_ao; - // read DIO config + /* read DIO config */ switch (inw(dev->iobase + PCI1723_DIGITAL_IO_PORT_MODE) & 0x03) { - case 0x00: // low byte output, high byte output + case 0x00: /* low byte output, high byte output */ s->io_bits = 0xFFFF; break; - case 0x01: // low byte input, high byte output + case 0x01: /* low byte input, high byte output */ s->io_bits = 0xFF00; break; - case 0x02: // low byte output, high byte input + case 0x02: /* low byte output, high byte input */ s->io_bits = 0x00FF; break; - case 0x03: // low byte input, high byte input + case 0x03: /* low byte input, high byte input */ s->io_bits = 0x0000; break; } - // read DIO port state + /* read DIO port state */ s->state = inw(dev->iobase + PCI1723_READ_DIGITAL_INPUT_DATA); subdev++; diff --git a/drivers/staging/comedi/drivers/aio_aio12_8.c b/drivers/staging/comedi/drivers/aio_aio12_8.c index b97b4d82611b..b21c23b8ba52 100644 --- a/drivers/staging/comedi/drivers/aio_aio12_8.c +++ b/drivers/staging/comedi/drivers/aio_aio12_8.c @@ -96,16 +96,16 @@ static int aio_aio12_8_ai_read(struct comedi_device * dev, struct comedi_subdevi ADC_MODE_NORMAL | (CR_RANGE(insn->chanspec) << 3) | CR_CHAN(insn->chanspec); - //read status to clear EOC latch + /* read status to clear EOC latch */ inb(dev->iobase + AIO12_8_STATUS); for (n = 0; n < insn->n; n++) { int timeout = 5; - // Setup and start conversion + /* Setup and start conversion */ outb(control, dev->iobase + AIO12_8_ADC); - // Wait for conversion to complete + /* Wait for conversion to complete */ while (timeout && !(inb(dev->iobase + AIO12_8_STATUS) & STATUS_ADC_EOC)) { timeout--; @@ -140,12 +140,12 @@ static int aio_aio12_8_ao_write(struct comedi_device * dev, struct comedi_subdev int chan = CR_CHAN(insn->chanspec); unsigned long port = dev->iobase + AIO12_8_DAC_0 + (2 * chan); - //enable DACs + /* enable DACs */ outb(0x01, dev->iobase + DAC_ENABLE); for (i = 0; i < insn->n; i++) { - outb(data[i] & 0xFF, port); // LSB - outb((data[i] >> 8) & 0x0F, port + 1); // MSB + outb(data[i] & 0xFF, port); /* LSB */ + outb((data[i] >> 8) & 0x0F, port + 1); /* MSB */ devpriv->ao_readback[chan] = data[i]; } return insn->n; diff --git a/drivers/staging/comedi/drivers/amcc_s5933.h b/drivers/staging/comedi/drivers/amcc_s5933.h index aceffce7ef3f..b810d5f3d971 100644 --- a/drivers/staging/comedi/drivers/amcc_s5933.h +++ b/drivers/staging/comedi/drivers/amcc_s5933.h @@ -48,12 +48,12 @@ /****************************************************************************/ #define INTCSR_OUTBOX_BYTE(x) ((x) & 0x3) #define INTCSR_OUTBOX_SELECT(x) (((x) & 0x3) << 2) -#define INTCSR_OUTBOX_EMPTY_INT 0x10 // enable outbox empty interrupt +#define INTCSR_OUTBOX_EMPTY_INT 0x10 /* enable outbox empty interrupt */ #define INTCSR_INBOX_BYTE(x) (((x) & 0x3) << 8) #define INTCSR_INBOX_SELECT(x) (((x) & 0x3) << 10) -#define INTCSR_INBOX_FULL_INT 0x1000 // enable inbox full interrupt -#define INTCSR_INBOX_INTR_STATUS 0x20000 // read, or write clear inbox full interrupt -#define INTCSR_INTR_ASSERTED 0x800000 // read only, interrupt asserted +#define INTCSR_INBOX_FULL_INT 0x1000 /* enable inbox full interrupt */ +#define INTCSR_INBOX_INTR_STATUS 0x20000 /* read, or write clear inbox full interrupt */ +#define INTCSR_INTR_ASSERTED 0x800000 /* read only, interrupt asserted */ /****************************************************************************/ /* AMCC - PCI non-volatile ram command register (byte 3 of master control/status register) */ @@ -153,7 +153,7 @@ #define AINT_IMB_SELECT 0x0000000c #define AINT_IMB_BYTE 0x00000003 -// these are bits from various different registers, needs cleanup XXX +/* these are bits from various different registers, needs cleanup XXX */ /* Enable Bus Mastering */ #define EN_A2P_TRANSFERS 0x00000400 /* FIFO Flag Reset */ diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index 8555e272a861..771e88ca873d 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c @@ -205,6 +205,8 @@ is packed into a short value, one bit per requested channel, in the order they appear in the channel list. */ +#include <linux/interrupt.h> + #include "../comedidev.h" #include "comedi_pci.h" @@ -1010,7 +1012,7 @@ dio200_subdev_intr_cleanup(struct comedi_device * dev, struct comedi_subdevice * /* * Interrupt service routine. */ -static irqreturn_t dio200_interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t dio200_interrupt(int irq, void *d) { struct comedi_device *dev = d; int handled; diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c index 2027c75feaca..fc1a8f1b611a 100644 --- a/drivers/staging/comedi/drivers/amplc_pc236.c +++ b/drivers/staging/comedi/drivers/amplc_pc236.c @@ -27,7 +27,7 @@ Driver: amplc_pc236 Description: Amplicon PC36AT, PCI236 Author: Ian Abbott <abbotti@mev.co.uk> Devices: [Amplicon] PC36AT (pc36at), PCI236 (pci236 or amplc_pc236) -Updated: Wed, 22 Oct 2008 13:40:03 +0100 +Updated: Wed, 01 Apr 2009 15:41:25 +0100 Status: works Configuration options - PC36AT: @@ -45,13 +45,15 @@ as subdevice 0. Subdevice 1 pretends to be a digital input device, but it always returns 0 when read. However, if you run a command with scan_begin_src=TRIG_EXT, -a rising edge on port C bit 7 acts as an external trigger, which can be +a rising edge on port C bit 3 acts as an external trigger, which can be used to wake up tasks. This is like the comedi_parport device, but the only way to physically disable the interrupt on the PC36AT is to remove the IRQ jumper. If no interrupt is connected, then subdevice 1 is unused. */ +#include <linux/interrupt.h> + #include "../comedidev.h" #include "comedi_pci.h" @@ -194,7 +196,7 @@ static int pc236_intr_cmdtest(struct comedi_device * dev, struct comedi_subdevic struct comedi_cmd * cmd); static int pc236_intr_cmd(struct comedi_device * dev, struct comedi_subdevice * s); static int pc236_intr_cancel(struct comedi_device * dev, struct comedi_subdevice * s); -static irqreturn_t pc236_interrupt(int irq, void *d PT_REGS_ARG); +static irqreturn_t pc236_interrupt(int irq, void *d); /* * This function looks for a PCI device matching the requested board name, @@ -638,7 +640,7 @@ static int pc236_intr_cancel(struct comedi_device * dev, struct comedi_subdevice * Interrupt service routine. * Based on the comedi_parport driver. */ -static irqreturn_t pc236_interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t pc236_interrupt(int irq, void *d) { struct comedi_device *dev = d; struct comedi_subdevice *s = dev->subdevices + 1; diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index 770b96648932..70381b5c015b 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -103,6 +103,8 @@ Caveats: correctly. */ +#include <linux/interrupt.h> + #include "../comedidev.h" #include "comedi_pci.h" @@ -1212,7 +1214,7 @@ pci224_ao_munge(struct comedi_device * dev, struct comedi_subdevice * s, void *d /* * Interrupt handler. */ -static irqreturn_t pci224_interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t pci224_interrupt(int irq, void *d) { struct comedi_device *dev = d; struct comedi_subdevice *s = &dev->subdevices[0]; diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index 0c9e5737e100..0fa228f6edc4 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -187,9 +187,11 @@ Extra triggered scan functionality, interrupt bug-fix added by Steve Sharples. Support for PCI230+/260+, more triggered scan functionality, and workarounds for (or detection of) various hardware problems added by Ian Abbott. */ + #include "../comedidev.h" #include <linux/delay.h> +#include <linux/interrupt.h> #include "comedi_pci.h" #include "8253.h" @@ -625,7 +627,7 @@ static void pci230_ct_setup_ns_mode(struct comedi_device * dev, unsigned int ct, unsigned int mode, uint64_t ns, unsigned int round); static void pci230_ns_to_single_timer(unsigned int *ns, unsigned int round); static void pci230_cancel_ct(struct comedi_device * dev, unsigned int ct); -static irqreturn_t pci230_interrupt(int irq, void *d PT_REGS_ARG); +static irqreturn_t pci230_interrupt(int irq, void *d); static int pci230_ao_cmdtest(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_cmd * cmd); static int pci230_ao_cmd(struct comedi_device * dev, struct comedi_subdevice * s); @@ -2559,7 +2561,7 @@ static void pci230_cancel_ct(struct comedi_device * dev, unsigned int ct) } /* Interrupt handler */ -static irqreturn_t pci230_interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t pci230_interrupt(int irq, void *d) { unsigned char status_int, valid_status_int; struct comedi_device *dev = (struct comedi_device *) d; diff --git a/drivers/staging/comedi/drivers/c6xdigio.c b/drivers/staging/comedi/drivers/c6xdigio.c index 2efffb14610d..c8ffddf4add4 100644 --- a/drivers/staging/comedi/drivers/c6xdigio.c +++ b/drivers/staging/comedi/drivers/c6xdigio.c @@ -77,7 +77,7 @@ struct pwmbitstype { unsigned sb4:2; }; union pwmcmdtype { - unsigned cmd; // assuming here that int is 32bit + unsigned cmd; /* assuming here that int is 32bit */ struct pwmbitstype bits; }; struct encbitstype { @@ -110,7 +110,7 @@ static void C6X_pwmInit(unsigned long baseAddr) { int timeout = 0; -//printk("Inside C6X_pwmInit\n"); +/* printk("Inside C6X_pwmInit\n"); */ WriteByteToHwPort(baseAddr, 0x70); while (((ReadByteFromHwPort(baseAddr + 1) & 0x80) == 0) @@ -148,7 +148,7 @@ static void C6X_pwmOutput(unsigned long baseAddr, unsigned channel, int value) int timeout = 0; unsigned tmp; - //printk("Inside C6X_pwmOutput\n"); + /* printk("Inside C6X_pwmOutput\n"); */ pwm.cmd = value; if (pwm.cmd > 498) @@ -158,7 +158,7 @@ static void C6X_pwmOutput(unsigned long baseAddr, unsigned channel, int value) if (channel == 0) { ppcmd = 0x28; - } else { // if channel == 1 + } else { /* if channel == 1 */ ppcmd = 0x30; } /* endif */ @@ -216,7 +216,7 @@ static int C6X_encInput(unsigned long baseAddr, unsigned channel) int timeout = 0; int tmp; - //printk("Inside C6X_encInput\n"); + /* printk("Inside C6X_encInput\n"); */ enc.value = 0; if (channel == 0) { @@ -311,7 +311,7 @@ static void C6X_encResetAll(unsigned long baseAddr) { unsigned timeout = 0; -//printk("Inside C6X_encResetAll\n"); +/* printk("Inside C6X_encResetAll\n"); */ WriteByteToHwPort(baseAddr, 0x68); while (((ReadByteFromHwPort(baseAddr + 1) & 0x80) == 0) @@ -351,7 +351,7 @@ static int c6xdigio_pwmo_insn_write(struct comedi_device * dev, int i; int chan = CR_CHAN(insn->chanspec); - // printk("c6xdigio_pwmo_insn_write %x\n", insn->n); + /* printk("c6xdigio_pwmo_insn_write %x\n", insn->n); */ for (i = 0; i < insn->n; i++) { C6X_pwmOutput(dev->iobase, chan, data[i]); /* devpriv->ao_readback[chan] = data[i]; */ @@ -359,32 +359,30 @@ static int c6xdigio_pwmo_insn_write(struct comedi_device * dev, return i; } -//static int c6xdigio_ei_init_insn_read(struct comedi_device *dev, -// struct comedi_subdevice *s, -// struct comedi_insn *insn, -// unsigned int *data) -//{ -// printk("c6xdigio_ei_init_insn_read %x\n", insn->n); -// return insn->n; -//} - -//static int c6xdigio_ei_init_insn_write(struct comedi_device *dev, -// struct comedi_subdevice *s, -// struct comedi_insn *insn, -// unsigned int *data) -//{ -// int i; -// int chan = CR_CHAN(insn->chanspec); -// -// C6X_encResetAll( dev->iobase ); -// -// return insn->n; -//} +/* static int c6xdigio_ei_init_insn_read(struct comedi_device *dev, */ +/* struct comedi_subdevice *s, */ +/* struct comedi_insn *insn, */ +/* unsigned int *data) */ +/* { */ +/* printk("c6xdigio_ei_init_insn_read %x\n", insn->n); */ +/* return insn->n; */ +/* } */ + +/* static int c6xdigio_ei_init_insn_write(struct comedi_device *dev, */ +/* struct comedi_subdevice *s, */ +/* struct comedi_insn *insn, */ +/* unsigned int *data) */ +/* { */ +/* int i; */ +/* int chan = CR_CHAN(insn->chanspec); */ +/* *//* C6X_encResetAll( dev->iobase ); */ +/* *//* return insn->n; */ +/* } */ static int c6xdigio_ei_insn_read(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - // printk("c6xdigio_ei__insn_read %x\n", insn->n); + /* printk("c6xdigio_ei__insn_read %x\n", insn->n); */ int n; int chan = CR_CHAN(insn->chanspec); @@ -398,16 +396,16 @@ static int c6xdigio_ei_insn_read(struct comedi_device * dev, static void board_init(struct comedi_device * dev) { - //printk("Inside board_init\n"); + /* printk("Inside board_init\n"); */ C6X_pwmInit(dev->iobase); C6X_encResetAll(dev->iobase); } -//static void board_halt(struct comedi_device *dev) { -// C6X_pwmInit(dev->iobase); -//} +/* static void board_halt(struct comedi_device *dev) { */ +/* C6X_pwmInit(dev->iobase); */ +/* } */ /* options[0] - I/O port @@ -444,11 +442,11 @@ static int c6xdigio_attach(struct comedi_device * dev, struct comedi_devconfig * dev->iobase = iobase; dev->board_name = "c6xdigio"; - result = alloc_subdevices(dev, 2); // 3 with encoder_init write + result = alloc_subdevices(dev, 2); /* 3 with encoder_init write */ if (result < 0) return result; - // Make sure that PnP ports gets activated + /* Make sure that PnP ports gets activated */ pnp_register_driver(&c6xdigio_pnp_driver); irq = it->options[1]; @@ -460,14 +458,14 @@ static int c6xdigio_attach(struct comedi_device * dev, struct comedi_devconfig * s = dev->subdevices + 0; /* pwm output subdevice */ - s->type = COMEDI_SUBD_AO; // Not sure what to put here + s->type = COMEDI_SUBD_AO; /* Not sure what to put here */ s->subdev_flags = SDF_WRITEABLE; s->n_chan = 2; /* s->trig[0] = c6xdigio_pwmo; */ s->insn_read = c6xdigio_pwmo_insn_read; s->insn_write = c6xdigio_pwmo_insn_write; s->maxdata = 500; - s->range_table = &range_bipolar10; // A suitable lie + s->range_table = &range_bipolar10; /* A suitable lie */ s = dev->subdevices + 1; /* encoder (counter) subdevice */ @@ -479,19 +477,19 @@ static int c6xdigio_attach(struct comedi_device * dev, struct comedi_devconfig * s->maxdata = 0xffffff; s->range_table = &range_unknown; - // s = dev->subdevices + 2; - // /* pwm output subdevice */ - // s->type = COMEDI_SUBD_COUNTER; // Not sure what to put here - // s->subdev_flags = SDF_WRITEABLE; - // s->n_chan = 1; - // /* s->trig[0] = c6xdigio_ei_init; */ - // s->insn_read = c6xdigio_ei_init_insn_read; - // s->insn_write = c6xdigio_ei_init_insn_write; - // s->maxdata = 0xFFFF; // Really just a don't care - // s->range_table = &range_unknown; // Not sure what to put here - - // I will call this init anyway but more than likely the DSP board will not be connect - // when device driver is loaded. + /* s = dev->subdevices + 2; */ + /* pwm output subdevice */ + /* s->type = COMEDI_SUBD_COUNTER; // Not sure what to put here */ + /* s->subdev_flags = SDF_WRITEABLE; */ + /* s->n_chan = 1; */ + /* s->trig[0] = c6xdigio_ei_init; */ + /* s->insn_read = c6xdigio_ei_init_insn_read; */ + /* s->insn_write = c6xdigio_ei_init_insn_write; */ + /* s->maxdata = 0xFFFF; // Really just a don't care */ + /* s->range_table = &range_unknown; // Not sure what to put here */ + + /* I will call this init anyway but more than likely the DSP board will not be connect */ + /* when device driver is loaded. */ board_init(dev); return 0; @@ -499,7 +497,7 @@ static int c6xdigio_attach(struct comedi_device * dev, struct comedi_devconfig * static int c6xdigio_detach(struct comedi_device * dev) { -// board_halt(dev); // may not need this +/* board_halt(dev); may not need this */ printk("comedi%d: c6xdigio: remove\n", dev->minor); @@ -508,7 +506,7 @@ static int c6xdigio_detach(struct comedi_device * dev) } if (dev->irq) { free_irq(dev->irq, dev); - } // Not using IRQ so I am not sure if I need this + } /* Not using IRQ so I am not sure if I need this */ pnp_unregister_driver(&c6xdigio_pnp_driver); return 0; diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 0bfe4c954eb5..e7ba3e4288a1 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -108,7 +108,7 @@ static const struct comedi_lrange das16cs_ai_range = { 4, { } }; -static irqreturn_t das16cs_interrupt(int irq, void *d PT_REGS_ARG); +static irqreturn_t das16cs_interrupt(int irq, void *d); static int das16cs_ai_rinsn(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data); static int das16cs_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s); @@ -276,9 +276,9 @@ static int das16cs_detach(struct comedi_device * dev) return 0; } -static irqreturn_t das16cs_interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t das16cs_interrupt(int irq, void *d) { - //struct comedi_device *dev = d; + /* struct comedi_device *dev = d; */ return IRQ_HANDLED; } @@ -773,7 +773,7 @@ static void das16cs_pcmcia_config(struct pcmcia_device *link) if ((last_ret = pcmcia_get_tuple_data(link, &tuple)) != 0) goto cs_failed; last_fn = ParseTuple; - if ((last_ret = pcmcia_parse_tuple(link, &tuple, &parse)) != 0) + if ((last_ret = pcmcia_parse_tuple(&tuple, &parse)) != 0) goto cs_failed; link->conf.ConfigBase = parse.config.base; link->conf.Present = parse.config.rmask[0]; @@ -798,7 +798,7 @@ static void das16cs_pcmcia_config(struct pcmcia_device *link) cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); if (pcmcia_get_tuple_data(link, &tuple)) goto next_entry; - if (pcmcia_parse_tuple(link, &tuple, &parse)) + if (pcmcia_parse_tuple(&tuple, &parse)) goto next_entry; if (cfg->flags & CISTPL_CFTABLE_DEFAULT) @@ -973,4 +973,4 @@ void __exit cleanup_module(void) #else COMEDI_INITCLEANUP(driver_das16cs); -#endif //CONFIG_PCMCIA +#endif /* CONFIG_PCMCIA */ diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index fcc551651367..0b09fc9bd4fb 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -63,6 +63,7 @@ analog triggering on 1602 series #include "../comedidev.h" #include <linux/delay.h> +#include <linux/interrupt.h> #include "8253.h" #include "8255.h" @@ -70,14 +71,14 @@ analog triggering on 1602 series #include "comedi_pci.h" #include "comedi_fc.h" -#undef CB_PCIDAS_DEBUG // disable debugging code -//#define CB_PCIDAS_DEBUG // enable debugging code +#undef CB_PCIDAS_DEBUG /* disable debugging code */ +/* #define CB_PCIDAS_DEBUG enable debugging code */ -// PCI vendor number of ComputerBoards/MeasurementComputing +/* PCI vendor number of ComputerBoards/MeasurementComputing */ #define PCI_VENDOR_ID_CB 0x1307 -#define TIMER_BASE 100 // 10MHz master clock -#define AI_BUFFER_SIZE 1024 // maximum fifo size of any supported board -#define AO_BUFFER_SIZE 1024 // maximum fifo size of any supported board +#define TIMER_BASE 100 /* 10MHz master clock */ +#define AI_BUFFER_SIZE 1024 /* maximum fifo size of any supported board */ +#define AO_BUFFER_SIZE 1024 /* maximum fifo size of any supported board */ #define NUM_CHANNELS_8800 8 #define NUM_CHANNELS_7376 1 #define NUM_CHANNELS_8402 2 @@ -85,71 +86,71 @@ analog triggering on 1602 series /* PCI-DAS base addresses */ -// indices of base address regions +/* indices of base address regions */ #define S5933_BADRINDEX 0 #define CONT_STAT_BADRINDEX 1 #define ADC_FIFO_BADRINDEX 2 #define PACER_BADRINDEX 3 #define AO_BADRINDEX 4 -// sizes of io regions +/* sizes of io regions */ #define CONT_STAT_SIZE 10 #define ADC_FIFO_SIZE 4 #define PACER_SIZE 12 #define AO_SIZE 4 /* Control/Status registers */ -#define INT_ADCFIFO 0 // INTERRUPT / ADC FIFO register -#define INT_EOS 0x1 // interrupt end of scan -#define INT_FHF 0x2 // interrupt fifo half full -#define INT_FNE 0x3 // interrupt fifo not empty -#define INT_MASK 0x3 // mask of interrupt select bits -#define INTE 0x4 // interrupt enable -#define DAHFIE 0x8 // dac half full interrupt enable -#define EOAIE 0x10 // end of aquisition interrupt enable -#define DAHFI 0x20 // dac half full read status / write interrupt clear -#define EOAI 0x40 // read end of acq. interrupt status / write clear -#define INT 0x80 // read interrupt status / write clear -#define EOBI 0x200 // read end of burst interrupt status -#define ADHFI 0x400 // read half-full interrupt status -#define ADNEI 0x800 // read fifo not empty interrupt latch status -#define ADNE 0x1000 // read, fifo not empty (realtime, not latched) status -#define DAEMIE 0x1000 // write, dac empty interrupt enable -#define LADFUL 0x2000 // read fifo overflow / write clear -#define DAEMI 0x4000 // dac fifo empty interrupt status / write clear - -#define ADCMUX_CONT 2 // ADC CHANNEL MUX AND CONTROL register +#define INT_ADCFIFO 0 /* INTERRUPT / ADC FIFO register */ +#define INT_EOS 0x1 /* interrupt end of scan */ +#define INT_FHF 0x2 /* interrupt fifo half full */ +#define INT_FNE 0x3 /* interrupt fifo not empty */ +#define INT_MASK 0x3 /* mask of interrupt select bits */ +#define INTE 0x4 /* interrupt enable */ +#define DAHFIE 0x8 /* dac half full interrupt enable */ +#define EOAIE 0x10 /* end of aquisition interrupt enable */ +#define DAHFI 0x20 /* dac half full read status / write interrupt clear */ +#define EOAI 0x40 /* read end of acq. interrupt status / write clear */ +#define INT 0x80 /* read interrupt status / write clear */ +#define EOBI 0x200 /* read end of burst interrupt status */ +#define ADHFI 0x400 /* read half-full interrupt status */ +#define ADNEI 0x800 /* read fifo not empty interrupt latch status */ +#define ADNE 0x1000 /* read, fifo not empty (realtime, not latched) status */ +#define DAEMIE 0x1000 /* write, dac empty interrupt enable */ +#define LADFUL 0x2000 /* read fifo overflow / write clear */ +#define DAEMI 0x4000 /* dac fifo empty interrupt status / write clear */ + +#define ADCMUX_CONT 2 /* ADC CHANNEL MUX AND CONTROL register */ #define BEGIN_SCAN(x) ((x) & 0xf) #define END_SCAN(x) (((x) & 0xf) << 4) #define GAIN_BITS(x) (((x) & 0x3) << 8) -#define UNIP 0x800 // Analog front-end unipolar for range -#define SE 0x400 // Inputs in single-ended mode -#define PACER_MASK 0x3000 // pacer source bits -#define PACER_INT 0x1000 // internal pacer -#define PACER_EXT_FALL 0x2000 // external falling edge -#define PACER_EXT_RISE 0x3000 // external rising edge -#define EOC 0x4000 // adc not busy - -#define TRIG_CONTSTAT 4 // TRIGGER CONTROL/STATUS register -#define SW_TRIGGER 0x1 // software start trigger -#define EXT_TRIGGER 0x2 // external start trigger -#define ANALOG_TRIGGER 0x3 // external analog trigger -#define TRIGGER_MASK 0x3 // mask of bits that determine start trigger -#define TGEN 0x10 // enable external start trigger -#define BURSTE 0x20 // burst mode enable -#define XTRCL 0x80 // clear external trigger - -#define CALIBRATION_REG 6 // CALIBRATION register -#define SELECT_8800_BIT 0x100 // select 8800 caldac -#define SELECT_TRIMPOT_BIT 0x200 // select ad7376 trim pot -#define SELECT_DAC08_BIT 0x400 // select dac08 caldac +#define UNIP 0x800 /* Analog front-end unipolar for range */ +#define SE 0x400 /* Inputs in single-ended mode */ +#define PACER_MASK 0x3000 /* pacer source bits */ +#define PACER_INT 0x1000 /* internal pacer */ +#define PACER_EXT_FALL 0x2000 /* external falling edge */ +#define PACER_EXT_RISE 0x3000 /* external rising edge */ +#define EOC 0x4000 /* adc not busy */ + +#define TRIG_CONTSTAT 4 /* TRIGGER CONTROL/STATUS register */ +#define SW_TRIGGER 0x1 /* software start trigger */ +#define EXT_TRIGGER 0x2 /* external start trigger */ +#define ANALOG_TRIGGER 0x3 /* external analog trigger */ +#define TRIGGER_MASK 0x3 /* mask of bits that determine start trigger */ +#define TGEN 0x10 /* enable external start trigger */ +#define BURSTE 0x20 /* burst mode enable */ +#define XTRCL 0x80 /* clear external trigger */ + +#define CALIBRATION_REG 6 /* CALIBRATION register */ +#define SELECT_8800_BIT 0x100 /* select 8800 caldac */ +#define SELECT_TRIMPOT_BIT 0x200 /* select ad7376 trim pot */ +#define SELECT_DAC08_BIT 0x400 /* select dac08 caldac */ #define CAL_SRC_BITS(x) (((x) & 0x7) << 11) -#define CAL_EN_BIT 0x4000 // read calibration source instead of analog input channel 0 -#define SERIAL_DATA_IN_BIT 0x8000 // serial data stream going to 8800 and 7376 +#define CAL_EN_BIT 0x4000 /* read calibration source instead of analog input channel 0 */ +#define SERIAL_DATA_IN_BIT 0x8000 /* serial data stream going to 8800 and 7376 */ -#define DAC_CSR 0x8 // dac control and status register +#define DAC_CSR 0x8 /* dac control and status register */ enum dac_csr_bits { - DACEN = 0x2, // dac enable - DAC_MODE_UPDATE_BOTH = 0x80, // update both dacs when dac0 is written + DACEN = 0x2, /* dac enable */ + DAC_MODE_UPDATE_BOTH = 0x80, /* update both dacs when dac0 is written */ }; static inline unsigned int DAC_RANGE(unsigned int channel, unsigned int range) { @@ -160,42 +161,42 @@ static inline unsigned int DAC_RANGE_MASK(unsigned int channel) return 0x3 << (8 + 2 * (channel & 0x1)); }; -// bits for 1602 series only +/* bits for 1602 series only */ enum dac_csr_bits_1602 { - DAC_EMPTY = 0x1, // dac fifo empty, read, write clear - DAC_START = 0x4, // start/arm dac fifo operations - DAC_PACER_MASK = 0x18, // bits that set dac pacer source - DAC_PACER_INT = 0x8, // dac internal pacing - DAC_PACER_EXT_FALL = 0x10, // dac external pacing, falling edge - DAC_PACER_EXT_RISE = 0x18, // dac external pacing, rising edge + DAC_EMPTY = 0x1, /* dac fifo empty, read, write clear */ + DAC_START = 0x4, /* start/arm dac fifo operations */ + DAC_PACER_MASK = 0x18, /* bits that set dac pacer source */ + DAC_PACER_INT = 0x8, /* dac internal pacing */ + DAC_PACER_EXT_FALL = 0x10, /* dac external pacing, falling edge */ + DAC_PACER_EXT_RISE = 0x18, /* dac external pacing, rising edge */ }; static inline unsigned int DAC_CHAN_EN(unsigned int channel) { - return 1 << (5 + (channel & 0x1)); // enable channel 0 or 1 + return 1 << (5 + (channel & 0x1)); /* enable channel 0 or 1 */ }; /* analog input fifo */ -#define ADCDATA 0 // ADC DATA register -#define ADCFIFOCLR 2 // ADC FIFO CLEAR +#define ADCDATA 0 /* ADC DATA register */ +#define ADCFIFOCLR 2 /* ADC FIFO CLEAR */ -// pacer, counter, dio registers +/* pacer, counter, dio registers */ #define ADC8254 0 #define DIO_8255 4 #define DAC8254 8 -// analog output registers for 100x, 1200 series +/* analog output registers for 100x, 1200 series */ static inline unsigned int DAC_DATA_REG(unsigned int channel) { return 2 * (channel & 0x1); } /* analog output registers for 1602 series*/ -#define DACDATA 0 // DAC DATA register -#define DACFIFOCLR 2 // DAC FIFO CLEAR +#define DACDATA 0 /* DAC DATA register */ +#define DACFIFOCLR 2 /* DAC FIFO CLEAR */ -// bit in hexadecimal representation of range index that indicates unipolar input range +/* bit in hexadecimal representation of range index that indicates unipolar input range */ #define IS_UNIPOLAR 0x4 -// analog input ranges for most boards +/* analog input ranges for most boards */ static const struct comedi_lrange cb_pcidas_ranges = { 8, { @@ -210,7 +211,7 @@ static const struct comedi_lrange cb_pcidas_ranges = { } }; -// pci-das1001 input ranges +/* pci-das1001 input ranges */ static const struct comedi_lrange cb_pcidas_alt_ranges = { 8, { @@ -225,7 +226,7 @@ static const struct comedi_lrange cb_pcidas_alt_ranges = { } }; -// analog output ranges +/* analog output ranges */ static const struct comedi_lrange cb_pcidas_ao_ranges = { 4, { @@ -244,14 +245,14 @@ enum trimpot_model { struct cb_pcidas_board { const char *name; unsigned short device_id; - int ai_se_chans; // Inputs in single-ended mode - int ai_diff_chans; // Inputs in differential mode - int ai_bits; // analog input resolution - int ai_speed; // fastest conversion period in ns - int ao_nchan; // number of analog out channels - int has_ao_fifo; // analog output has fifo - int ao_scan_speed; // analog output speed for 1602 series (for a scan, not conversion) - int fifo_size; // number of samples fifo can hold + int ai_se_chans; /* Inputs in single-ended mode */ + int ai_diff_chans; /* Inputs in differential mode */ + int ai_bits; /* analog input resolution */ + int ai_speed; /* fastest conversion period in ns */ + int ao_nchan; /* number of analog out channels */ + int has_ao_fifo; /* analog output has fifo */ + int ao_scan_speed; /* analog output speed for 1602 series (for a scan, not conversion) */ + int fifo_size; /* number of samples fifo can hold */ const struct comedi_lrange *ranges; enum trimpot_model trimpot; unsigned has_dac08:1; @@ -374,7 +375,7 @@ static const struct cb_pcidas_board cb_pcidas_boards[] = { }, }; -// Number of boards in cb_pcidas_boards +/* Number of boards in cb_pcidas_boards */ #define N_BOARDS (sizeof(cb_pcidas_boards) / sizeof(struct cb_pcidas_board)) static DEFINE_PCI_DEVICE_TABLE(cb_pcidas_pci_table) = { @@ -402,28 +403,28 @@ MODULE_DEVICE_TABLE(pci, cb_pcidas_pci_table); struct cb_pcidas_private { /* would be useful for a PCI device */ struct pci_dev *pci_dev; - // base addresses + /* base addresses */ unsigned long s5933_config; unsigned long control_status; unsigned long adc_fifo; unsigned long pacer_counter_dio; unsigned long ao_registers; - // divisors of master clock for analog input pacing + /* divisors of master clock for analog input pacing */ unsigned int divisor1; unsigned int divisor2; - volatile unsigned int count; // number of analog input samples remaining - volatile unsigned int adc_fifo_bits; // bits to write to interupt/adcfifo register - volatile unsigned int s5933_intcsr_bits; // bits to write to amcc s5933 interrupt control/status register - volatile unsigned int ao_control_bits; // bits to write to ao control and status register + volatile unsigned int count; /* number of analog input samples remaining */ + volatile unsigned int adc_fifo_bits; /* bits to write to interupt/adcfifo register */ + volatile unsigned int s5933_intcsr_bits; /* bits to write to amcc s5933 interrupt control/status register */ + volatile unsigned int ao_control_bits; /* bits to write to ao control and status register */ short ai_buffer[AI_BUFFER_SIZE]; short ao_buffer[AO_BUFFER_SIZE]; - // divisors of master clock for analog output pacing + /* divisors of master clock for analog output pacing */ unsigned int ao_divisor1; unsigned int ao_divisor2; - volatile unsigned int ao_count; // number of analog output samples remaining - int ao_value[2]; // remember what the analog outputs are set to, to allow readback - unsigned int caldac_value[NUM_CHANNELS_8800]; // for readback of caldac - unsigned int trimpot_value[NUM_CHANNELS_8402]; // for readback of trimpot + volatile unsigned int ao_count; /* number of analog output samples remaining */ + int ao_value[2]; /* remember what the analog outputs are set to, to allow readback */ + unsigned int caldac_value[NUM_CHANNELS_8800]; /* for readback of caldac */ + unsigned int trimpot_value[NUM_CHANNELS_8402]; /* for readback of trimpot */ unsigned int dac08_value; unsigned int calibration_source; }; @@ -468,7 +469,7 @@ static int cb_pcidas_ao_inttrig(struct comedi_device *dev, unsigned int trig_num); static int cb_pcidas_ao_cmdtest(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_cmd * cmd); -static irqreturn_t cb_pcidas_interrupt(int irq, void *d PT_REGS_ARG); +static irqreturn_t cb_pcidas_interrupt(int irq, void *d); static void handle_ao_interrupt(struct comedi_device * dev, unsigned int status); static int cb_pcidas_cancel(struct comedi_device * dev, struct comedi_subdevice * s); static int cb_pcidas_ao_cancel(struct comedi_device * dev, struct comedi_subdevice * s); @@ -531,16 +532,16 @@ static int cb_pcidas_attach(struct comedi_device * dev, struct comedi_devconfig 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? + /* is it not a computer boards card? */ if (pcidev->vendor != PCI_VENDOR_ID_CB) continue; - // loop through cards supported by this driver + /* loop through cards supported by this driver */ for (index = 0; index < N_BOARDS; index++) { if (cb_pcidas_boards[index].device_id != pcidev->device) continue; - // was a particular bus/slot requested? + /* was a particular bus/slot requested? */ if (it->options[0] || it->options[1]) { - // are we on the wrong bus/slot? + /* are we on the wrong bus/slot? */ if (pcidev->bus->number != it->options[0] || PCI_SLOT(pcidev->devfn) != it->options[1]) { @@ -585,11 +586,11 @@ static int cb_pcidas_attach(struct comedi_device * dev, struct comedi_devconfig devpriv->ao_registers = pci_resource_start(devpriv->pci_dev, AO_BADRINDEX); } - // disable and clear interrupts on amcc s5933 + /* disable and clear interrupts on amcc s5933 */ outl(INTCSR_INBOX_INTR_STATUS, devpriv->s5933_config + AMCC_OP_REG_INTCSR); - // get irq + /* get irq */ if (comedi_request_irq(devpriv->pci_dev->irq, cb_pcidas_interrupt, IRQF_SHARED, "cb_pcidas", dev)) { printk(" unable to allocate irq %d\n", devpriv->pci_dev->irq); @@ -597,7 +598,7 @@ static int cb_pcidas_attach(struct comedi_device * dev, struct comedi_devconfig } dev->irq = devpriv->pci_dev->irq; - //Initialize dev->board_name + /* Initialize dev->board_name */ dev->board_name = thisboard->name; /* @@ -628,7 +629,7 @@ static int cb_pcidas_attach(struct comedi_device * dev, struct comedi_devconfig s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_GROUND; s->n_chan = thisboard->ao_nchan; - // analog out resolution is the same as analog input resolution, so use ai_bits + /* analog out resolution is the same as analog input resolution, so use ai_bits */ s->maxdata = (1 << thisboard->ai_bits) - 1; s->range_table = &cb_pcidas_ao_ranges; s->insn_read = cb_pcidas_ao_readback_insn; @@ -650,7 +651,7 @@ static int cb_pcidas_attach(struct comedi_device * dev, struct comedi_devconfig s = dev->subdevices + 2; subdev_8255_init(dev, s, NULL, devpriv->pacer_counter_dio + DIO_8255); - // serial EEPROM, + /* serial EEPROM, */ s = dev->subdevices + 3; s->type = COMEDI_SUBD_MEMORY; s->subdev_flags = SDF_READABLE | SDF_INTERNAL; @@ -658,7 +659,7 @@ static int cb_pcidas_attach(struct comedi_device * dev, struct comedi_devconfig s->maxdata = 0xff; s->insn_read = eeprom_read_insn; - // 8800 caldac + /* 8800 caldac */ s = dev->subdevices + 4; s->type = COMEDI_SUBD_CALIB; s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL; @@ -669,7 +670,7 @@ static int cb_pcidas_attach(struct comedi_device * dev, struct comedi_devconfig for (i = 0; i < s->n_chan; i++) caldac_8800_write(dev, i, s->maxdata / 2); - // trim potentiometer + /* trim potentiometer */ s = dev->subdevices + 5; s->type = COMEDI_SUBD_CALIB; s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL; @@ -685,7 +686,7 @@ static int cb_pcidas_attach(struct comedi_device * dev, struct comedi_devconfig for (i = 0; i < s->n_chan; i++) cb_pcidas_trimpot_write(dev, i, s->maxdata / 2); - // dac08 caldac + /* dac08 caldac */ s = dev->subdevices + 6; if (thisboard->has_dac08) { s->type = COMEDI_SUBD_CALIB; @@ -698,13 +699,13 @@ static int cb_pcidas_attach(struct comedi_device * dev, struct comedi_devconfig } else s->type = COMEDI_SUBD_UNUSED; - // make sure mailbox 4 is empty + /* make sure mailbox 4 is empty */ inl(devpriv->s5933_config + AMCC_OP_REG_IMB4); /* Set bits to enable incoming mailbox interrupts on amcc s5933. */ devpriv->s5933_intcsr_bits = INTCSR_INBOX_BYTE(3) | INTCSR_INBOX_SELECT(3) | INTCSR_INBOX_FULL_INT; - // clear and enable interrupt on amcc s5933 + /* clear and enable interrupt on amcc s5933 */ outl(devpriv->s5933_intcsr_bits | INTCSR_INBOX_INTR_STATUS, devpriv->s5933_config + AMCC_OP_REG_INTCSR); @@ -725,7 +726,7 @@ static int cb_pcidas_detach(struct comedi_device * dev) if (devpriv) { if (devpriv->s5933_config) { - // disable and clear interrupts on amcc s5933 + /* disable and clear interrupts on amcc s5933 */ outl(INTCSR_INBOX_INTR_STATUS, devpriv->s5933_config + AMCC_OP_REG_INTCSR); #ifdef CB_PCIDAS_DEBUG @@ -760,7 +761,7 @@ static int cb_pcidas_ai_rinsn(struct comedi_device * dev, struct comedi_subdevic unsigned int bits; static const int timeout = 10000; int channel; - // enable calibration input if appropriate + /* enable calibration input if appropriate */ if (insn->chanspec & CR_ALT_SOURCE) { outw(cal_enable_bits(dev), devpriv->control_status + CALIBRATION_REG); @@ -769,13 +770,13 @@ static int cb_pcidas_ai_rinsn(struct comedi_device * dev, struct comedi_subdevic outw(0, devpriv->control_status + CALIBRATION_REG); channel = CR_CHAN(insn->chanspec); } - // set mux limits and gain + /* set mux limits and gain */ bits = BEGIN_SCAN(channel) | END_SCAN(channel) | GAIN_BITS(CR_RANGE(insn->chanspec)); - // set unipolar/bipolar + /* set unipolar/bipolar */ if (CR_RANGE(insn->chanspec) & IS_UNIPOLAR) bits |= UNIP; - // set singleended/differential + /* set singleended/differential */ if (CR_AREF(insn->chanspec) != AREF_DIFF) bits |= SE; outw(bits, devpriv->control_status + ADCMUX_CONT); @@ -836,14 +837,14 @@ static int ai_config_insn(struct comedi_device * dev, struct comedi_subdevice * return -EINVAL; } -// analog output insn for pcidas-1000 and 1200 series +/* analog output insn for pcidas-1000 and 1200 series */ static int cb_pcidas_ao_nofifo_winsn(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { int channel; unsigned long flags; - // set channel and range + /* set channel and range */ channel = CR_CHAN(insn->chanspec); comedi_spin_lock_irqsave(&dev->spinlock, flags); devpriv->ao_control_bits &= @@ -853,25 +854,25 @@ static int cb_pcidas_ao_nofifo_winsn(struct comedi_device * dev, struct comedi_s outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR); comedi_spin_unlock_irqrestore(&dev->spinlock, flags); - // remember value for readback + /* remember value for readback */ devpriv->ao_value[channel] = data[0]; - // send data + /* send data */ outw(data[0], devpriv->ao_registers + DAC_DATA_REG(channel)); return 1; } -// analog output insn for pcidas-1602 series +/* analog output insn for pcidas-1602 series */ static int cb_pcidas_ao_fifo_winsn(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { int channel; unsigned long flags; - // clear dac fifo + /* clear dac fifo */ outw(0, devpriv->ao_registers + DACFIFOCLR); - // set channel and range + /* set channel and range */ channel = CR_CHAN(insn->chanspec); comedi_spin_lock_irqsave(&dev->spinlock, flags); devpriv->ao_control_bits &= @@ -883,16 +884,16 @@ static int cb_pcidas_ao_fifo_winsn(struct comedi_device * dev, struct comedi_sub outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR); comedi_spin_unlock_irqrestore(&dev->spinlock, flags); - // remember value for readback + /* remember value for readback */ devpriv->ao_value[channel] = data[0]; - // send data + /* send data */ outw(data[0], devpriv->ao_registers + DACDATA); return 1; } -// analog output readback insn -// XXX loses track of analog output value back after an analog ouput command is executed +/* analog output readback insn */ +/* XXX loses track of analog output value back after an analog ouput command is executed */ static int cb_pcidas_ao_readback_insn(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { @@ -1066,7 +1067,7 @@ static int cb_pcidas_ai_cmdtest(struct comedi_device * dev, struct comedi_subdev if (cmd->stop_src != TRIG_COUNT && cmd->stop_src != TRIG_NONE) err++; - // make sure trigger sources are compatible with each other + /* make sure trigger sources are compatible with each other */ if (cmd->scan_begin_src == TRIG_FOLLOW && cmd->convert_src == TRIG_NOW) err++; if (cmd->scan_begin_src != TRIG_FOLLOW && cmd->convert_src != TRIG_NOW) @@ -1138,7 +1139,7 @@ static int cb_pcidas_ai_cmdtest(struct comedi_device * dev, struct comedi_subdev if (err) return 4; - // check channel/gain list against card's limitations + /* check channel/gain list against card's limitations */ if (cmd->chanlist) { gain = CR_RANGE(cmd->chanlist[0]); start_chan = CR_CHAN(cmd->chanlist[0]); @@ -1170,24 +1171,24 @@ static int cb_pcidas_ai_cmd(struct comedi_device * dev, struct comedi_subdevice unsigned int bits; unsigned long flags; - // make sure CAL_EN_BIT is disabled + /* make sure CAL_EN_BIT is disabled */ outw(0, devpriv->control_status + CALIBRATION_REG); - // initialize before settings pacer source and count values + /* initialize before settings pacer source and count values */ outw(0, devpriv->control_status + TRIG_CONTSTAT); - // clear fifo + /* clear fifo */ outw(0, devpriv->adc_fifo + ADCFIFOCLR); - // set mux limits, gain and pacer source + /* set mux limits, gain and pacer source */ bits = BEGIN_SCAN(CR_CHAN(cmd->chanlist[0])) | END_SCAN(CR_CHAN(cmd->chanlist[cmd->chanlist_len - 1])) | GAIN_BITS(CR_RANGE(cmd->chanlist[0])); - // set unipolar/bipolar + /* set unipolar/bipolar */ if (CR_RANGE(cmd->chanlist[0]) & IS_UNIPOLAR) bits |= UNIP; - // set singleended/differential + /* set singleended/differential */ if (CR_AREF(cmd->chanlist[0]) != AREF_DIFF) bits |= SE; - // set pacer source + /* set pacer source */ if (cmd->convert_src == TRIG_EXT || cmd->scan_begin_src == TRIG_EXT) bits |= PACER_EXT_RISE; else @@ -1198,7 +1199,7 @@ static int cb_pcidas_ai_cmd(struct comedi_device * dev, struct comedi_subdevice rt_printk("comedi: sent 0x%x to adcmux control\n", bits); #endif - // load counters + /* load counters */ if (cmd->convert_src == TRIG_TIMER) cb_pcidas_load_counters(dev, &cmd->convert_arg, cmd->flags & TRIG_ROUND_MASK); @@ -1206,31 +1207,31 @@ static int cb_pcidas_ai_cmd(struct comedi_device * dev, struct comedi_subdevice cb_pcidas_load_counters(dev, &cmd->scan_begin_arg, cmd->flags & TRIG_ROUND_MASK); - // set number of conversions + /* set number of conversions */ if (cmd->stop_src == TRIG_COUNT) { devpriv->count = cmd->chanlist_len * cmd->stop_arg; } - // enable interrupts + /* enable interrupts */ comedi_spin_lock_irqsave(&dev->spinlock, flags); devpriv->adc_fifo_bits |= INTE; devpriv->adc_fifo_bits &= ~INT_MASK; if (cmd->flags & TRIG_WAKE_EOS) { if (cmd->convert_src == TRIG_NOW && cmd->chanlist_len > 1) - devpriv->adc_fifo_bits |= INT_EOS; // interrupt end of burst + devpriv->adc_fifo_bits |= INT_EOS; /* interrupt end of burst */ else - devpriv->adc_fifo_bits |= INT_FNE; // interrupt fifo not empty + devpriv->adc_fifo_bits |= INT_FNE; /* interrupt fifo not empty */ } else { - devpriv->adc_fifo_bits |= INT_FHF; //interrupt fifo half full + devpriv->adc_fifo_bits |= INT_FHF; /* interrupt fifo half full */ } #ifdef CB_PCIDAS_DEBUG rt_printk("comedi: adc_fifo_bits are 0x%x\n", devpriv->adc_fifo_bits); #endif - // enable (and clear) interrupts + /* enable (and clear) interrupts */ outw(devpriv->adc_fifo_bits | EOAI | INT | LADFUL, devpriv->control_status + INT_ADCFIFO); comedi_spin_unlock_irqrestore(&dev->spinlock, flags); - // set start trigger and burst mode + /* set start trigger and burst mode */ bits = 0; if (cmd->start_src == TRIG_NOW) bits |= SW_TRIGGER; @@ -1347,7 +1348,7 @@ static int cb_pcidas_ao_cmdtest(struct comedi_device * dev, struct comedi_subdev if (err) return 4; - // check channel/gain list against card's limitations + /* check channel/gain list against card's limitations */ if (cmd->chanlist && cmd->chanlist_len > 1) { if (CR_CHAN(cmd->chanlist[0]) != 0 || CR_CHAN(cmd->chanlist[1]) != 1) { @@ -1370,25 +1371,25 @@ static int cb_pcidas_ao_cmd(struct comedi_device * dev, struct comedi_subdevice unsigned int i; unsigned long flags; - // set channel limits, gain + /* set channel limits, gain */ comedi_spin_lock_irqsave(&dev->spinlock, flags); for (i = 0; i < cmd->chanlist_len; i++) { - // enable channel + /* enable channel */ devpriv->ao_control_bits |= DAC_CHAN_EN(CR_CHAN(cmd->chanlist[i])); - // set range + /* set range */ devpriv->ao_control_bits |= DAC_RANGE(CR_CHAN(cmd->chanlist[i]), CR_RANGE(cmd->chanlist[i])); } - // disable analog out before settings pacer source and count values + /* disable analog out before settings pacer source and count values */ outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR); comedi_spin_unlock_irqrestore(&dev->spinlock, flags); - // clear fifo + /* clear fifo */ outw(0, devpriv->ao_registers + DACFIFOCLR); - // load counters + /* load counters */ if (cmd->scan_begin_src == TRIG_TIMER) { i8253_cascade_ns_to_timer_2div(TIMER_BASE, &(devpriv->ao_divisor1), &(devpriv->ao_divisor2), @@ -1400,11 +1401,11 @@ static int cb_pcidas_ao_cmd(struct comedi_device * dev, struct comedi_subdevice i8254_load(devpriv->pacer_counter_dio + DAC8254, 0, 2, devpriv->ao_divisor2, 2); } - // set number of conversions + /* set number of conversions */ if (cmd->stop_src == TRIG_COUNT) { devpriv->ao_count = cmd->chanlist_len * cmd->stop_arg; } - // set pacer source + /* set pacer source */ comedi_spin_lock_irqsave(&dev->spinlock, flags); switch (cmd->scan_begin_src) { case TRIG_TIMER: @@ -1438,7 +1439,7 @@ static int cb_pcidas_ao_inttrig(struct comedi_device *dev, if (trig_num != 0) return -EINVAL; - // load up fifo + /* load up fifo */ if (cmd->stop_src == TRIG_COUNT && devpriv->ao_count < num_points) num_points = devpriv->ao_count; @@ -1449,20 +1450,20 @@ static int cb_pcidas_ao_inttrig(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) { devpriv->ao_count -= num_points; } - // write data to board's fifo + /* write data to board's fifo */ outsw(devpriv->ao_registers + DACDATA, devpriv->ao_buffer, num_bytes); - // enable dac half-full and empty interrupts + /* enable dac half-full and empty interrupts */ comedi_spin_lock_irqsave(&dev->spinlock, flags); devpriv->adc_fifo_bits |= DAEMIE | DAHFIE; #ifdef CB_PCIDAS_DEBUG rt_printk("comedi: adc_fifo_bits are 0x%x\n", devpriv->adc_fifo_bits); #endif - // enable and clear interrupts + /* enable and clear interrupts */ outw(devpriv->adc_fifo_bits | DAEMI | DAHFI, devpriv->control_status + INT_ADCFIFO); - // start dac + /* start dac */ devpriv->ao_control_bits |= DAC_START | DACEN | DAC_EMPTY; outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR); #ifdef CB_PCIDAS_DEBUG @@ -1476,7 +1477,7 @@ static int cb_pcidas_ao_inttrig(struct comedi_device *dev, return 0; } -static irqreturn_t cb_pcidas_interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t cb_pcidas_interrupt(int irq, void *d) { struct comedi_device *dev = (struct comedi_device *) d; struct comedi_subdevice *s = dev->read_subdev; @@ -1503,9 +1504,9 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d PT_REGS_ARG) if ((INTCSR_INTR_ASSERTED & s5933_status) == 0) return IRQ_NONE; - // make sure mailbox 4 is empty + /* make sure mailbox 4 is empty */ inl_p(devpriv->s5933_config + AMCC_OP_REG_IMB4); - // clear interrupt on amcc s5933 + /* clear interrupt on amcc s5933 */ outl(devpriv->s5933_intcsr_bits | INTCSR_INBOX_INTR_STATUS, devpriv->s5933_config + AMCC_OP_REG_INTCSR); @@ -1516,14 +1517,14 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d PT_REGS_ARG) } #endif - // check for analog output interrupt + /* check for analog output interrupt */ if (status & (DAHFI | DAEMI)) { handle_ao_interrupt(dev, status); } - // check for analog input interrupts - // if fifo half-full + /* check for analog input interrupts */ + /* if fifo half-full */ if (status & ADHFI) { - // read data + /* read data */ num_samples = half_fifo; if (async->cmd.stop_src == TRIG_COUNT && num_samples > devpriv->count) { @@ -1538,15 +1539,15 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d PT_REGS_ARG) async->events |= COMEDI_CB_EOA; cb_pcidas_cancel(dev, s); } - // clear half-full interrupt latch + /* clear half-full interrupt latch */ comedi_spin_lock_irqsave(&dev->spinlock, flags); outw(devpriv->adc_fifo_bits | INT, devpriv->control_status + INT_ADCFIFO); comedi_spin_unlock_irqrestore(&dev->spinlock, flags); - // else if fifo not empty + /* else if fifo not empty */ } else if (status & (ADNEI | EOBI)) { for (i = 0; i < timeout; i++) { - // break if fifo is empty + /* break if fifo is empty */ if ((ADNE & inw(devpriv->control_status + INT_ADCFIFO)) == 0) break; @@ -1557,7 +1558,7 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d PT_REGS_ARG) break; } } - // clear not-empty interrupt latch + /* clear not-empty interrupt latch */ comedi_spin_lock_irqsave(&dev->spinlock, flags); outw(devpriv->adc_fifo_bits | INT, devpriv->control_status + INT_ADCFIFO); @@ -1565,16 +1566,16 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d PT_REGS_ARG) } else if (status & EOAI) { comedi_error(dev, "bug! encountered end of aquisition interrupt?"); - // clear EOA interrupt latch + /* clear EOA interrupt latch */ comedi_spin_lock_irqsave(&dev->spinlock, flags); outw(devpriv->adc_fifo_bits | EOAI, devpriv->control_status + INT_ADCFIFO); comedi_spin_unlock_irqrestore(&dev->spinlock, flags); } - //check for fifo overflow + /* check for fifo overflow */ if (status & LADFUL) { comedi_error(dev, "fifo overflow"); - // clear overflow interrupt latch + /* clear overflow interrupt latch */ comedi_spin_lock_irqsave(&dev->spinlock, flags); outw(devpriv->adc_fifo_bits | LADFUL, devpriv->control_status + INT_ADCFIFO); @@ -1600,7 +1601,7 @@ static void handle_ao_interrupt(struct comedi_device * dev, unsigned int status) async->events = 0; if (status & DAEMI) { - // clear dac empty interrupt latch + /* clear dac empty interrupt latch */ comedi_spin_lock_irqsave(&dev->spinlock, flags); outw(devpriv->adc_fifo_bits | DAEMI, devpriv->control_status + INT_ADCFIFO); @@ -1618,7 +1619,7 @@ static void handle_ao_interrupt(struct comedi_device * dev, unsigned int status) } else if (status & DAHFI) { unsigned int num_bytes; - // figure out how many points we are writing to fifo + /* figure out how many points we are writing to fifo */ num_points = half_fifo; if (cmd->stop_src == TRIG_COUNT && devpriv->ao_count < num_points) @@ -1631,10 +1632,10 @@ static void handle_ao_interrupt(struct comedi_device * dev, unsigned int status) if (async->cmd.stop_src == TRIG_COUNT) { devpriv->ao_count -= num_points; } - // write data to board's fifo + /* write data to board's fifo */ outsw(devpriv->ao_registers + DACDATA, devpriv->ao_buffer, num_points); - // clear half-full interrupt latch + /* clear half-full interrupt latch */ comedi_spin_lock_irqsave(&dev->spinlock, flags); outw(devpriv->adc_fifo_bits | DAHFI, devpriv->control_status + INT_ADCFIFO); @@ -1650,14 +1651,14 @@ static int cb_pcidas_cancel(struct comedi_device * dev, struct comedi_subdevice unsigned long flags; comedi_spin_lock_irqsave(&dev->spinlock, flags); - // disable interrupts + /* disable interrupts */ devpriv->adc_fifo_bits &= ~INTE & ~EOAIE; outw(devpriv->adc_fifo_bits, devpriv->control_status + INT_ADCFIFO); comedi_spin_unlock_irqrestore(&dev->spinlock, flags); - // disable start trigger source and burst mode + /* disable start trigger source and burst mode */ outw(0, devpriv->control_status + TRIG_CONTSTAT); - // software pacer source + /* software pacer source */ outw(0, devpriv->control_status + ADCMUX_CONT); return 0; @@ -1670,11 +1671,11 @@ static int cb_pcidas_ao_cancel(struct comedi_device *dev, unsigned long flags; comedi_spin_lock_irqsave(&dev->spinlock, flags); - // disable interrupts + /* disable interrupts */ devpriv->adc_fifo_bits &= ~DAHFIE & ~DAEMIE; outw(devpriv->adc_fifo_bits, devpriv->control_status + INT_ADCFIFO); - // disable output + /* disable output */ devpriv->ao_control_bits &= ~DACEN & ~DAC_PACER_MASK; outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR); comedi_spin_unlock_irqrestore(&dev->spinlock, flags); diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index 1a580bd2247a..10401d91113e 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -85,6 +85,7 @@ TODO: #include "../comedidev.h" #include <linux/delay.h> +#include <linux/interrupt.h> #include <asm/system.h> #include "comedi_pci.h" @@ -93,8 +94,8 @@ TODO: #include "plx9080.h" #include "comedi_fc.h" -#undef PCIDAS64_DEBUG // disable debugging code -//#define PCIDAS64_DEBUG // enable debugging code +#undef PCIDAS64_DEBUG /* disable debugging code */ +/* #define PCIDAS64_DEBUG enable debugging code */ #ifdef PCIDAS64_DEBUG #define DEBUG_PRINT(format, args...) rt_printk(format , ## args ) @@ -102,8 +103,8 @@ TODO: #define DEBUG_PRINT(format, args...) #endif -#define TIMER_BASE 25 // 40MHz master clock -#define PRESCALED_TIMER_BASE 10000 // 100kHz 'prescaled' clock for slow aquisition, maybe I'll support this someday +#define TIMER_BASE 25 /* 40MHz master clock */ +#define PRESCALED_TIMER_BASE 10000 /* 100kHz 'prescaled' clock for slow aquisition, maybe I'll support this someday */ #define DMA_BUFFER_SIZE 0x1000 /* maximum value that can be loaded into board's 24-bit counters*/ @@ -111,41 +112,41 @@ static const int max_counter_value = 0xffffff; /* PCI-DAS64xxx base addresses */ -// indices of base address regions +/* indices of base address regions */ enum base_address_regions { PLX9080_BADDRINDEX = 0, MAIN_BADDRINDEX = 2, DIO_COUNTER_BADDRINDEX = 3, }; -// priv(dev)->main_iobase registers +/* priv(dev)->main_iobase registers */ enum write_only_registers { - INTR_ENABLE_REG = 0x0, // interrupt enable register - HW_CONFIG_REG = 0x2, // hardware config register + INTR_ENABLE_REG = 0x0, /* interrupt enable register */ + HW_CONFIG_REG = 0x2, /* hardware config register */ DAQ_SYNC_REG = 0xc, DAQ_ATRIG_LOW_4020_REG = 0xc, - ADC_CONTROL0_REG = 0x10, // adc control register 0 - ADC_CONTROL1_REG = 0x12, // adc control register 1 + ADC_CONTROL0_REG = 0x10, /* adc control register 0 */ + ADC_CONTROL1_REG = 0x12, /* adc control register 1 */ CALIBRATION_REG = 0x14, - ADC_SAMPLE_INTERVAL_LOWER_REG = 0x16, // lower 16 bits of adc sample interval counter - ADC_SAMPLE_INTERVAL_UPPER_REG = 0x18, // upper 8 bits of adc sample interval counter - ADC_DELAY_INTERVAL_LOWER_REG = 0x1a, // lower 16 bits of delay interval counter - ADC_DELAY_INTERVAL_UPPER_REG = 0x1c, // upper 8 bits of delay interval counter - ADC_COUNT_LOWER_REG = 0x1e, // lower 16 bits of hardware conversion/scan counter - ADC_COUNT_UPPER_REG = 0x20, // upper 8 bits of hardware conversion/scan counter - ADC_START_REG = 0x22, // software trigger to start aquisition - ADC_CONVERT_REG = 0x24, // initiates single conversion - ADC_QUEUE_CLEAR_REG = 0x26, // clears adc queue - ADC_QUEUE_LOAD_REG = 0x28, // loads adc queue + ADC_SAMPLE_INTERVAL_LOWER_REG = 0x16, /* lower 16 bits of adc sample interval counter */ + ADC_SAMPLE_INTERVAL_UPPER_REG = 0x18, /* upper 8 bits of adc sample interval counter */ + ADC_DELAY_INTERVAL_LOWER_REG = 0x1a, /* lower 16 bits of delay interval counter */ + ADC_DELAY_INTERVAL_UPPER_REG = 0x1c, /* upper 8 bits of delay interval counter */ + ADC_COUNT_LOWER_REG = 0x1e, /* lower 16 bits of hardware conversion/scan counter */ + ADC_COUNT_UPPER_REG = 0x20, /* upper 8 bits of hardware conversion/scan counter */ + ADC_START_REG = 0x22, /* software trigger to start aquisition */ + ADC_CONVERT_REG = 0x24, /* initiates single conversion */ + ADC_QUEUE_CLEAR_REG = 0x26, /* clears adc queue */ + ADC_QUEUE_LOAD_REG = 0x28, /* loads adc queue */ ADC_BUFFER_CLEAR_REG = 0x2a, - ADC_QUEUE_HIGH_REG = 0x2c, // high channel for internal queue, use adc_chan_bits() inline above - DAC_CONTROL0_REG = 0x50, // dac control register 0 - DAC_CONTROL1_REG = 0x52, // dac control register 0 - DAC_SAMPLE_INTERVAL_LOWER_REG = 0x54, // lower 16 bits of dac sample interval counter - DAC_SAMPLE_INTERVAL_UPPER_REG = 0x56, // upper 8 bits of dac sample interval counter + ADC_QUEUE_HIGH_REG = 0x2c, /* high channel for internal queue, use adc_chan_bits() inline above */ + DAC_CONTROL0_REG = 0x50, /* dac control register 0 */ + DAC_CONTROL1_REG = 0x52, /* dac control register 0 */ + DAC_SAMPLE_INTERVAL_LOWER_REG = 0x54, /* lower 16 bits of dac sample interval counter */ + DAC_SAMPLE_INTERVAL_UPPER_REG = 0x56, /* upper 8 bits of dac sample interval counter */ DAC_SELECT_REG = 0x60, DAC_START_REG = 0x64, - DAC_BUFFER_CLEAR_REG = 0x66, // clear dac buffer + DAC_BUFFER_CLEAR_REG = 0x66, /* clear dac buffer */ }; static inline unsigned int dac_convert_reg(unsigned int channel) { @@ -161,7 +162,7 @@ static inline unsigned int dac_msb_4020_reg(unsigned int channel) } enum read_only_registers { - HW_STATUS_REG = 0x0, // hardware status register, reading this apparently clears pending interrupts as well + HW_STATUS_REG = 0x0, /* hardware status register, reading this apparently clears pending interrupts as well */ PIPE1_READ_REG = 0x4, ADC_READ_PNTR_REG = 0x8, LOWER_XFER_REG = 0x10, @@ -170,13 +171,13 @@ enum read_only_registers { }; enum read_write_registers { - I8255_4020_REG = 0x48, // 8255 offset, for 4020 only - ADC_QUEUE_FIFO_REG = 0x100, // external channel/gain queue, uses same bits as ADC_QUEUE_LOAD_REG + I8255_4020_REG = 0x48, /* 8255 offset, for 4020 only */ + ADC_QUEUE_FIFO_REG = 0x100, /* external channel/gain queue, uses same bits as ADC_QUEUE_LOAD_REG */ ADC_FIFO_REG = 0x200, /* adc data fifo */ DAC_FIFO_REG = 0x300, /* dac data fifo, has weird interactions with external channel queue */ }; -// priv(dev)->dio_counter_iobase registers +/* priv(dev)->dio_counter_iobase registers */ enum dio_counter_registers { DIO_8255_OFFSET = 0x0, DO_REG = 0x20, @@ -185,47 +186,47 @@ enum dio_counter_registers { DIO_DATA_60XX_REG = 0x48, }; -// bit definitions for write-only registers +/* bit definitions for write-only registers */ enum intr_enable_contents { - ADC_INTR_SRC_MASK = 0x3, // bits that set adc interrupt source - ADC_INTR_QFULL_BITS = 0x0, // interrupt fifo quater full - ADC_INTR_EOC_BITS = 0x1, // interrupt end of conversion - ADC_INTR_EOSCAN_BITS = 0x2, // interrupt end of scan - ADC_INTR_EOSEQ_BITS = 0x3, // interrupt end of sequence (probably wont use this it's pretty fancy) - EN_ADC_INTR_SRC_BIT = 0x4, // enable adc interrupt source - EN_ADC_DONE_INTR_BIT = 0x8, // enable adc aquisition done interrupt + ADC_INTR_SRC_MASK = 0x3, /* bits that set adc interrupt source */ + ADC_INTR_QFULL_BITS = 0x0, /* interrupt fifo quater full */ + ADC_INTR_EOC_BITS = 0x1, /* interrupt end of conversion */ + ADC_INTR_EOSCAN_BITS = 0x2, /* interrupt end of scan */ + ADC_INTR_EOSEQ_BITS = 0x3, /* interrupt end of sequence (probably wont use this it's pretty fancy) */ + EN_ADC_INTR_SRC_BIT = 0x4, /* enable adc interrupt source */ + EN_ADC_DONE_INTR_BIT = 0x8, /* enable adc aquisition done interrupt */ DAC_INTR_SRC_MASK = 0x30, DAC_INTR_QEMPTY_BITS = 0x0, DAC_INTR_HIGH_CHAN_BITS = 0x10, - EN_DAC_INTR_SRC_BIT = 0x40, // enable dac interrupt source + EN_DAC_INTR_SRC_BIT = 0x40, /* enable dac interrupt source */ EN_DAC_DONE_INTR_BIT = 0x80, - EN_ADC_ACTIVE_INTR_BIT = 0x200, // enable adc active interrupt - EN_ADC_STOP_INTR_BIT = 0x400, // enable adc stop trigger interrupt - EN_DAC_ACTIVE_INTR_BIT = 0x800, // enable dac active interrupt - EN_DAC_UNDERRUN_BIT = 0x4000, // enable dac underrun status bit - EN_ADC_OVERRUN_BIT = 0x8000, // enable adc overrun status bit + EN_ADC_ACTIVE_INTR_BIT = 0x200, /* enable adc active interrupt */ + EN_ADC_STOP_INTR_BIT = 0x400, /* enable adc stop trigger interrupt */ + EN_DAC_ACTIVE_INTR_BIT = 0x800, /* enable dac active interrupt */ + EN_DAC_UNDERRUN_BIT = 0x4000, /* enable dac underrun status bit */ + EN_ADC_OVERRUN_BIT = 0x8000, /* enable adc overrun status bit */ }; enum hw_config_contents { - MASTER_CLOCK_4020_MASK = 0x3, // bits that specify master clock source for 4020 - INTERNAL_CLOCK_4020_BITS = 0x1, // use 40 MHz internal master clock for 4020 - BNC_CLOCK_4020_BITS = 0x2, // use BNC input for master clock - EXT_CLOCK_4020_BITS = 0x3, // use dio input for master clock - EXT_QUEUE_BIT = 0x200, // use external channel/gain queue (more versatile than internal queue) - SLOW_DAC_BIT = 0x400, // use 225 nanosec strobe when loading dac instead of 50 nanosec - HW_CONFIG_DUMMY_BITS = 0x2000, // bit with unknown function yet given as default value in pci-das64 manual - DMA_CH_SELECT_BIT = 0x8000, // bit selects channels 1/0 for analog input/output, otherwise 0/1 - FIFO_SIZE_REG = 0x4, // allows adjustment of fifo sizes - DAC_FIFO_SIZE_MASK = 0xff00, // bits that set dac fifo size + MASTER_CLOCK_4020_MASK = 0x3, /* bits that specify master clock source for 4020 */ + INTERNAL_CLOCK_4020_BITS = 0x1, /* use 40 MHz internal master clock for 4020 */ + BNC_CLOCK_4020_BITS = 0x2, /* use BNC input for master clock */ + EXT_CLOCK_4020_BITS = 0x3, /* use dio input for master clock */ + EXT_QUEUE_BIT = 0x200, /* use external channel/gain queue (more versatile than internal queue) */ + SLOW_DAC_BIT = 0x400, /* use 225 nanosec strobe when loading dac instead of 50 nanosec */ + HW_CONFIG_DUMMY_BITS = 0x2000, /* bit with unknown function yet given as default value in pci-das64 manual */ + DMA_CH_SELECT_BIT = 0x8000, /* bit selects channels 1/0 for analog input/output, otherwise 0/1 */ + FIFO_SIZE_REG = 0x4, /* allows adjustment of fifo sizes */ + DAC_FIFO_SIZE_MASK = 0xff00, /* bits that set dac fifo size */ DAC_FIFO_BITS = 0xf800, /* 8k sample ao fifo */ }; #define DAC_FIFO_SIZE 0x2000 enum daq_atrig_low_4020_contents { - EXT_AGATE_BNC_BIT = 0x8000, // use trig/ext clk bnc input for analog gate signal - EXT_STOP_TRIG_BNC_BIT = 0x4000, // use trig/ext clk bnc input for external stop trigger signal - EXT_START_TRIG_BNC_BIT = 0x2000, // use trig/ext clk bnc input for external start trigger signal + EXT_AGATE_BNC_BIT = 0x8000, /* use trig/ext clk bnc input for analog gate signal */ + EXT_STOP_TRIG_BNC_BIT = 0x4000, /* use trig/ext clk bnc input for external stop trigger signal */ + EXT_START_TRIG_BNC_BIT = 0x2000, /* use trig/ext clk bnc input for external start trigger signal */ }; static inline uint16_t analog_trig_low_threshold_bits(uint16_t threshold) { @@ -233,34 +234,34 @@ static inline uint16_t analog_trig_low_threshold_bits(uint16_t threshold) } enum adc_control0_contents { - ADC_GATE_SRC_MASK = 0x3, // bits that select gate - ADC_SOFT_GATE_BITS = 0x1, // software gate - ADC_EXT_GATE_BITS = 0x2, // external digital gate - ADC_ANALOG_GATE_BITS = 0x3, // analog level gate - ADC_GATE_LEVEL_BIT = 0x4, // level-sensitive gate (for digital) - ADC_GATE_POLARITY_BIT = 0x8, // gate active low + ADC_GATE_SRC_MASK = 0x3, /* bits that select gate */ + ADC_SOFT_GATE_BITS = 0x1, /* software gate */ + ADC_EXT_GATE_BITS = 0x2, /* external digital gate */ + ADC_ANALOG_GATE_BITS = 0x3, /* analog level gate */ + ADC_GATE_LEVEL_BIT = 0x4, /* level-sensitive gate (for digital) */ + ADC_GATE_POLARITY_BIT = 0x8, /* gate active low */ ADC_START_TRIG_SOFT_BITS = 0x10, ADC_START_TRIG_EXT_BITS = 0x20, ADC_START_TRIG_ANALOG_BITS = 0x30, ADC_START_TRIG_MASK = 0x30, - ADC_START_TRIG_FALLING_BIT = 0x40, // trig 1 uses falling edge - ADC_EXT_CONV_FALLING_BIT = 0x800, // external pacing uses falling edge - ADC_SAMPLE_COUNTER_EN_BIT = 0x1000, // enable hardware scan counter - ADC_DMA_DISABLE_BIT = 0x4000, // disables dma - ADC_ENABLE_BIT = 0x8000, // master adc enable + ADC_START_TRIG_FALLING_BIT = 0x40, /* trig 1 uses falling edge */ + ADC_EXT_CONV_FALLING_BIT = 0x800, /* external pacing uses falling edge */ + ADC_SAMPLE_COUNTER_EN_BIT = 0x1000, /* enable hardware scan counter */ + ADC_DMA_DISABLE_BIT = 0x4000, /* disables dma */ + ADC_ENABLE_BIT = 0x8000, /* master adc enable */ }; enum adc_control1_contents { - ADC_QUEUE_CONFIG_BIT = 0x1, // should be set for boards with > 16 channels + ADC_QUEUE_CONFIG_BIT = 0x1, /* should be set for boards with > 16 channels */ CONVERT_POLARITY_BIT = 0x10, EOC_POLARITY_BIT = 0x20, - ADC_SW_GATE_BIT = 0x40, // software gate of adc - ADC_DITHER_BIT = 0x200, // turn on extra noise for dithering + ADC_SW_GATE_BIT = 0x40, /* software gate of adc */ + ADC_DITHER_BIT = 0x200, /* turn on extra noise for dithering */ RETRIGGER_BIT = 0x800, ADC_LO_CHANNEL_4020_MASK = 0x300, ADC_HI_CHANNEL_4020_MASK = 0xc00, - TWO_CHANNEL_4020_BITS = 0x1000, // two channel mode for 4020 - FOUR_CHANNEL_4020_BITS = 0x2000, // four channel mode for 4020 + TWO_CHANNEL_4020_BITS = 0x1000, /* two channel mode for 4020 */ + FOUR_CHANNEL_4020_BITS = 0x2000, /* four channel mode for 4020 */ CHANNEL_MODE_4020_MASK = 0x3000, ADC_MODE_MASK = 0xf000, }; @@ -281,10 +282,10 @@ enum calibration_contents { SELECT_8800_BIT = 0x1, SELECT_8402_64XX_BIT = 0x2, SELECT_1590_60XX_BIT = 0x2, - CAL_EN_64XX_BIT = 0x40, // calibration enable for 64xx series + CAL_EN_64XX_BIT = 0x40, /* calibration enable for 64xx series */ SERIAL_DATA_IN_BIT = 0x80, SERIAL_CLOCK_BIT = 0x100, - CAL_EN_60XX_BIT = 0x200, // calibration enable for 60xx series + CAL_EN_60XX_BIT = 0x200, /* calibration enable for 60xx series */ CAL_GAIN_BIT = 0x800, }; /* calibration sources for 6025 are: @@ -308,11 +309,11 @@ static inline uint16_t adc_convert_chan_4020_bits(unsigned int channel) }; enum adc_queue_load_contents { - UNIP_BIT = 0x800, // unipolar/bipolar bit - ADC_SE_DIFF_BIT = 0x1000, // single-ended/ differential bit - ADC_COMMON_BIT = 0x2000, // non-referenced single-ended (common-mode input) - QUEUE_EOSEQ_BIT = 0x4000, // queue end of sequence - QUEUE_EOSCAN_BIT = 0x8000, // queue end of scan + UNIP_BIT = 0x800, /* unipolar/bipolar bit */ + ADC_SE_DIFF_BIT = 0x1000, /* single-ended/ differential bit */ + ADC_COMMON_BIT = 0x2000, /* non-referenced single-ended (common-mode input) */ + QUEUE_EOSEQ_BIT = 0x4000, /* queue end of sequence */ + QUEUE_EOSCAN_BIT = 0x8000, /* queue end of scan */ }; static inline uint16_t adc_chan_bits(unsigned int channel) { @@ -320,7 +321,7 @@ static inline uint16_t adc_chan_bits(unsigned int channel) }; enum dac_control0_contents { - DAC_ENABLE_BIT = 0x8000, // dac controller enable bit + DAC_ENABLE_BIT = 0x8000, /* dac controller enable bit */ DAC_CYCLIC_STOP_BIT = 0x4000, DAC_WAVEFORM_MODE_BIT = 0x100, DAC_EXT_UPDATE_FALLING_BIT = 0x80, @@ -340,14 +341,14 @@ enum dac_control1_contents { DAC_WRITE_POLARITY_BIT = 0x800, /* board-dependent setting */ DAC1_EXT_REF_BIT = 0x200, DAC0_EXT_REF_BIT = 0x100, - DAC_OUTPUT_ENABLE_BIT = 0x80, // dac output enable bit + DAC_OUTPUT_ENABLE_BIT = 0x80, /* dac output enable bit */ DAC_UPDATE_POLARITY_BIT = 0x40, /* board-dependent setting */ DAC_SW_GATE_BIT = 0x20, DAC1_UNIPOLAR_BIT = 0x8, DAC0_UNIPOLAR_BIT = 0x2, }; -// bit definitions for read-only registers +/* bit definitions for read-only registers */ enum hw_status_contents { DAC_UNDERRUN_BIT = 0x1, ADC_OVERRUN_BIT = 0x2, @@ -378,7 +379,7 @@ static inline unsigned int adc_upper_write_ptr_code(uint16_t prepost_bits) return (prepost_bits >> 14) & 0x3; } -// I2C addresses for 4020 +/* I2C addresses for 4020 */ enum i2c_addresses { RANGE_CAL_I2C_ADDR = 0x20, CALDAC0_I2C_ADDR = 0xc, @@ -386,8 +387,8 @@ enum i2c_addresses { }; enum range_cal_i2c_contents { - ADC_SRC_4020_MASK = 0x70, // bits that set what source the adc converter measures - BNC_TRIG_THRESHOLD_0V_BIT = 0x80, // make bnc trig/ext clock threshold 0V instead of 2.5V + ADC_SRC_4020_MASK = 0x70, /* bits that set what source the adc converter measures */ + BNC_TRIG_THRESHOLD_0V_BIT = 0x80, /* make bnc trig/ext clock threshold 0V instead of 2.5V */ }; static inline uint8_t adc_src_4020_bits(unsigned int source) { @@ -395,11 +396,11 @@ static inline uint8_t adc_src_4020_bits(unsigned int source) }; static inline uint8_t attenuate_bit(unsigned int channel) { - // attenuate channel (+-5V input range) + /* attenuate channel (+-5V input range) */ return 1 << (channel & 0x3); }; -// analog input ranges for 64xx boards +/* analog input ranges for 64xx boards */ static const struct comedi_lrange ai_ranges_64xx = { 8, { @@ -468,7 +469,7 @@ static const struct comedi_lrange ai_ranges_6052 = { } }; -// analog input ranges for 4020 board +/* analog input ranges for 4020 board */ static const struct comedi_lrange ai_ranges_4020 = { 2, { @@ -477,7 +478,7 @@ static const struct comedi_lrange ai_ranges_4020 = { } }; -// analog output ranges +/* analog output ranges */ static const struct comedi_lrange ao_ranges_64xx = { 4, { @@ -543,18 +544,18 @@ struct hw_fifo_info { struct pcidas64_board { const char *name; - int device_id; // pci device id - int ai_se_chans; // number of ai inputs in single-ended mode - int ai_bits; // analog input resolution - int ai_speed; // fastest conversion period in ns + int device_id; /* pci device id */ + int ai_se_chans; /* number of ai inputs in single-ended mode */ + int ai_bits; /* analog input resolution */ + int ai_speed; /* fastest conversion period in ns */ const struct comedi_lrange *ai_range_table; - int ao_nchan; // number of analog out channels - int ao_bits; // analog output resolution - int ao_scan_speed; // analog output speed (for a scan, not conversion) + int ao_nchan; /* number of analog out channels */ + int ao_bits; /* analog output resolution */ + int ao_scan_speed; /* analog output speed (for a scan, not conversion) */ const struct comedi_lrange *ao_range_table; const int *ao_range_code; const struct hw_fifo_info *const ai_fifo; - enum register_layout layout; // different board families have slightly different registers + enum register_layout layout; /* different board families have slightly different registers */ unsigned has_8255:1; }; @@ -612,7 +613,7 @@ static const struct pcidas64_board pcidas64_boards[] = { has_8255:1, }, { - name: "pci-das6402/12", // XXX check + name: "pci-das6402/12", /* XXX check */ device_id:0x1e, ai_se_chans:64, ai_bits: 12, @@ -910,7 +911,7 @@ static const struct pcidas64_board pcidas64_boards[] = { ai_speed:50, ao_bits: 12, ao_nchan:2, - ao_scan_speed:0, // no hardware pacing on ao + ao_scan_speed:0, /* no hardware pacing on ao */ layout: LAYOUT_4020, ai_range_table:&ai_ranges_4020, ao_range_table:&ao_ranges_4020, @@ -921,7 +922,7 @@ static const struct pcidas64_board pcidas64_boards[] = { #if 0 { name: "pci-das6402/16/jr", - device_id:0 // XXX, + device_id:0 /* XXX, */ ai_se_chans:64, ai_bits: 16, ai_speed:5000, @@ -934,7 +935,7 @@ static const struct pcidas64_board pcidas64_boards[] = { }, { name: "pci-das64/m1/16/jr", - device_id:0 // XXX, + device_id:0 /* XXX, */ ai_se_chans:64, ai_bits: 16, ai_speed:1000, @@ -947,7 +948,7 @@ static const struct pcidas64_board pcidas64_boards[] = { }, { name: "pci-das64/m2/16/jr", - device_id:0 // XXX, + device_id:0 /* XXX, */ ai_se_chans:64, ai_bits: 16, ai_speed:500, @@ -960,7 +961,7 @@ static const struct pcidas64_board pcidas64_boards[] = { }, { name: "pci-das64/m3/16/jr", - device_id:0 // XXX, + device_id:0 /* XXX, */ ai_se_chans:64, ai_bits: 16, ai_speed:333, @@ -973,7 +974,7 @@ static const struct pcidas64_board pcidas64_boards[] = { }, { name: "pci-das64/m1/14", - device_id:0, // XXX + device_id:0, /* XXX */ ai_se_chans:64, ai_bits: 14, ai_speed:1000, @@ -986,7 +987,7 @@ static const struct pcidas64_board pcidas64_boards[] = { }, { name: "pci-das64/m2/14", - device_id:0, // XXX + device_id:0, /* XXX */ ai_se_chans:64, ai_bits: 14, ai_speed:500, @@ -999,7 +1000,7 @@ static const struct pcidas64_board pcidas64_boards[] = { }, { name: "pci-das64/m3/14", - device_id:0, // XXX + device_id:0, /* XXX */ ai_se_chans:64, ai_bits: 14, ai_speed:333, @@ -1013,7 +1014,7 @@ static const struct pcidas64_board pcidas64_boards[] = { #endif }; -// Number of boards in cb_pcidas_boards +/* Number of boards in cb_pcidas_boards */ static inline unsigned int num_boards(void) { return sizeof(pcidas64_boards) / sizeof(struct pcidas64_board); @@ -1060,50 +1061,50 @@ static inline unsigned short se_diff_bit_6xxx(struct comedi_device * dev, }; struct ext_clock_info { - unsigned int divisor; // master clock divisor to use for scans with external master clock - unsigned int chanspec; // chanspec for master clock input when used as scan begin src + unsigned int divisor; /* master clock divisor to use for scans with external master clock */ + unsigned int chanspec; /* chanspec for master clock input when used as scan begin src */ }; /* this structure is for data unique to this hardware driver. */ struct pcidas64_private { - struct pci_dev *hw_dev; // pointer to board's pci_dev struct - // base addresses (physical) + struct pci_dev *hw_dev; /* pointer to board's pci_dev struct */ + /* base addresses (physical) */ resource_size_t plx9080_phys_iobase; resource_size_t main_phys_iobase; resource_size_t dio_counter_phys_iobase; - // base addresses (ioremapped) + /* base addresses (ioremapped) */ void *plx9080_iobase; void *main_iobase; void *dio_counter_iobase; - // local address (used by dma controller) + /* local address (used by dma controller) */ uint32_t local0_iobase; uint32_t local1_iobase; - volatile unsigned int ai_count; // number of analog input samples remaining - uint16_t *ai_buffer[MAX_AI_DMA_RING_COUNT]; // dma buffers for analog input - dma_addr_t ai_buffer_bus_addr[MAX_AI_DMA_RING_COUNT]; // physical addresses of ai dma buffers - struct plx_dma_desc *ai_dma_desc; // array of ai dma descriptors read by plx9080, allocated to get proper alignment - dma_addr_t ai_dma_desc_bus_addr; // physical address of ai dma descriptor array - volatile unsigned int ai_dma_index; // index of the ai dma descriptor/buffer that is currently being used - uint16_t *ao_buffer[AO_DMA_RING_COUNT]; // dma buffers for analog output - dma_addr_t ao_buffer_bus_addr[AO_DMA_RING_COUNT]; // physical addresses of ao dma buffers + volatile unsigned int ai_count; /* number of analog input samples remaining */ + uint16_t *ai_buffer[MAX_AI_DMA_RING_COUNT]; /* dma buffers for analog input */ + dma_addr_t ai_buffer_bus_addr[MAX_AI_DMA_RING_COUNT]; /* physical addresses of ai dma buffers */ + struct plx_dma_desc *ai_dma_desc; /* array of ai dma descriptors read by plx9080, allocated to get proper alignment */ + dma_addr_t ai_dma_desc_bus_addr; /* physical address of ai dma descriptor array */ + volatile unsigned int ai_dma_index; /* index of the ai dma descriptor/buffer that is currently being used */ + uint16_t *ao_buffer[AO_DMA_RING_COUNT]; /* dma buffers for analog output */ + dma_addr_t ao_buffer_bus_addr[AO_DMA_RING_COUNT]; /* physical addresses of ao dma buffers */ struct plx_dma_desc *ao_dma_desc; dma_addr_t ao_dma_desc_bus_addr; - volatile unsigned int ao_dma_index; // keeps track of buffer where the next ao sample should go - volatile unsigned long ao_count; // number of analog output samples remaining - volatile unsigned int ao_value[2]; // remember what the analog outputs are set to, to allow readback - unsigned int hw_revision; // stc chip hardware revision number - volatile unsigned int intr_enable_bits; // last bits sent to INTR_ENABLE_REG register - volatile uint16_t adc_control1_bits; // last bits sent to ADC_CONTROL1_REG register - volatile uint16_t fifo_size_bits; // last bits sent to FIFO_SIZE_REG register - volatile uint16_t hw_config_bits; // last bits sent to HW_CONFIG_REG register + volatile unsigned int ao_dma_index; /* keeps track of buffer where the next ao sample should go */ + volatile unsigned long ao_count; /* number of analog output samples remaining */ + volatile unsigned int ao_value[2]; /* remember what the analog outputs are set to, to allow readback */ + unsigned int hw_revision; /* stc chip hardware revision number */ + volatile unsigned int intr_enable_bits; /* last bits sent to INTR_ENABLE_REG register */ + volatile uint16_t adc_control1_bits; /* last bits sent to ADC_CONTROL1_REG register */ + volatile uint16_t fifo_size_bits; /* last bits sent to FIFO_SIZE_REG register */ + volatile uint16_t hw_config_bits; /* last bits sent to HW_CONFIG_REG register */ volatile uint16_t dac_control1_bits; - volatile uint32_t plx_control_bits; // last bits written to plx9080 control register - volatile uint32_t plx_intcsr_bits; // last bits written to plx interrupt control and status register - volatile int calibration_source; // index of calibration source readable through ai ch0 - volatile uint8_t i2c_cal_range_bits; // bits written to i2c calibration/range register - volatile unsigned int ext_trig_falling; // configure digital triggers to trigger on falling edge - // states of various devices stored to enable read-back + volatile uint32_t plx_control_bits; /* last bits written to plx9080 control register */ + volatile uint32_t plx_intcsr_bits; /* last bits written to plx interrupt control and status register */ + volatile int calibration_source; /* index of calibration source readable through ai ch0 */ + volatile uint8_t i2c_cal_range_bits; /* bits written to i2c calibration/range register */ + volatile unsigned int ext_trig_falling; /* configure digital triggers to trigger on falling edge */ + /* states of various devices stored to enable read-back */ unsigned int ad8402_state[2]; unsigned int caldac_state[8]; volatile short ai_cmd_running; @@ -1152,7 +1153,7 @@ static int ao_inttrig(struct comedi_device * dev, struct comedi_subdevice * subd unsigned int trig_num); static int ao_cmdtest(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_cmd * cmd); -static irqreturn_t handle_interrupt(int irq, void *d PT_REGS_ARG); +static irqreturn_t handle_interrupt(int irq, void *d); static int ai_cancel(struct comedi_device * dev, struct comedi_subdevice * s); static int ao_cancel(struct comedi_device * dev, struct comedi_subdevice * s); static int dio_callback(int dir, int port, int data, unsigned long arg); @@ -1185,7 +1186,7 @@ static void caldac_write(struct comedi_device * dev, unsigned int channel, unsigned int value); static int caldac_8800_write(struct comedi_device * dev, unsigned int address, uint8_t value); -//static int dac_1590_write(struct comedi_device *dev, unsigned int dac_a, unsigned int dac_b); +/* static int dac_1590_write(struct comedi_device *dev, unsigned int dac_a, unsigned int dac_b); */ static int caldac_i2c_write(struct comedi_device * dev, unsigned int caldac_channel, unsigned int value); static void abort_dma(struct comedi_device * dev, unsigned int channel); @@ -1274,7 +1275,7 @@ static inline int ao_cmd_is_supported(const struct pcidas64_board * board) return board->ao_nchan && board->layout != LAYOUT_4020; } -// initialize plx9080 chip +/* initialize plx9080 chip */ static void init_plx9080(struct comedi_device * dev) { uint32_t bits; @@ -1283,7 +1284,7 @@ static void init_plx9080(struct comedi_device * dev) priv(dev)->plx_control_bits = readl(priv(dev)->plx9080_iobase + PLX_CONTROL_REG); - // plx9080 dump + /* plx9080 dump */ DEBUG_PRINT(" plx interrupt status 0x%x\n", readl(plx_iobase + PLX_INTRCS_REG)); DEBUG_PRINT(" plx id bits 0x%x\n", readl(plx_iobase + PLX_ID_REG)); @@ -1327,35 +1328,35 @@ static void init_plx9080(struct comedi_device * dev) abort_dma(dev, 0); abort_dma(dev, 1); - // configure dma0 mode + /* configure dma0 mode */ bits = 0; - // enable ready input, not sure if this is necessary + /* enable ready input, not sure if this is necessary */ bits |= PLX_DMA_EN_READYIN_BIT; - // enable bterm, not sure if this is necessary + /* enable bterm, not sure if this is necessary */ bits |= PLX_EN_BTERM_BIT; - // enable dma chaining + /* enable dma chaining */ bits |= PLX_EN_CHAIN_BIT; - // enable interrupt on dma done (probably don't need this, since chain never finishes) + /* enable interrupt on dma done (probably don't need this, since chain never finishes) */ bits |= PLX_EN_DMA_DONE_INTR_BIT; - // don't increment local address during transfers (we are transferring from a fixed fifo register) + /* don't increment local address during transfers (we are transferring from a fixed fifo register) */ bits |= PLX_LOCAL_ADDR_CONST_BIT; - // route dma interrupt to pci bus + /* route dma interrupt to pci bus */ bits |= PLX_DMA_INTR_PCI_BIT; - // enable demand mode + /* enable demand mode */ bits |= PLX_DEMAND_MODE_BIT; - // enable local burst mode + /* enable local burst mode */ bits |= PLX_DMA_LOCAL_BURST_EN_BIT; - // 4020 uses 32 bit dma + /* 4020 uses 32 bit dma */ if (board(dev)->layout == LAYOUT_4020) { bits |= PLX_LOCAL_BUS_32_WIDE_BITS; - } else { // localspace0 bus is 16 bits wide + } else { /* localspace0 bus is 16 bits wide */ bits |= PLX_LOCAL_BUS_16_WIDE_BITS; } writel(bits, plx_iobase + PLX_DMA1_MODE_REG); if (ao_cmd_is_supported(board(dev))) writel(bits, plx_iobase + PLX_DMA0_MODE_REG); - // enable interrupts on plx 9080 + /* enable interrupts on plx 9080 */ priv(dev)->plx_intcsr_bits |= ICS_AERR | ICS_PERR | ICS_PIE | ICS_PLIE | ICS_PAIE | ICS_LIE | ICS_DMA0_E | ICS_DMA1_E; @@ -1396,9 +1397,9 @@ static int setup_subdevices(struct comedi_device * dev) if (board(dev)->layout == LAYOUT_4020) { unsigned int i; uint8_t data; - // set adc to read from inputs (not internal calibration sources) + /* set adc to read from inputs (not internal calibration sources) */ priv(dev)->i2c_cal_range_bits = adc_src_4020_bits(4); - // set channels to +-5 volt input ranges + /* set channels to +-5 volt input ranges */ for (i = 0; i < s->n_chan; i++) priv(dev)->i2c_cal_range_bits |= attenuate_bit(i); data = priv(dev)->i2c_cal_range_bits; @@ -1428,7 +1429,7 @@ static int setup_subdevices(struct comedi_device * dev) s->type = COMEDI_SUBD_UNUSED; } - // digital input + /* digital input */ s = dev->subdevices + 2; if (board(dev)->layout == LAYOUT_64XX) { s->type = COMEDI_SUBD_DI; @@ -1440,7 +1441,7 @@ static int setup_subdevices(struct comedi_device * dev) } else s->type = COMEDI_SUBD_UNUSED; - // digital output + /* digital output */ if (board(dev)->layout == LAYOUT_64XX) { s = dev->subdevices + 3; s->type = COMEDI_SUBD_DO; @@ -1469,7 +1470,7 @@ static int setup_subdevices(struct comedi_device * dev) } else s->type = COMEDI_SUBD_UNUSED; - // 8 channel dio for 60xx + /* 8 channel dio for 60xx */ s = dev->subdevices + 5; if (board(dev)->layout == LAYOUT_60XX) { s->type = COMEDI_SUBD_DIO; @@ -1482,7 +1483,7 @@ static int setup_subdevices(struct comedi_device * dev) } else s->type = COMEDI_SUBD_UNUSED; - // caldac + /* caldac */ s = dev->subdevices + 6; s->type = COMEDI_SUBD_CALIB; s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL; @@ -1496,7 +1497,7 @@ static int setup_subdevices(struct comedi_device * dev) for (i = 0; i < s->n_chan; i++) caldac_write(dev, i, s->maxdata / 2); - // 2 channel ad8402 potentiometer + /* 2 channel ad8402 potentiometer */ s = dev->subdevices + 7; if (board(dev)->layout == LAYOUT_64XX) { s->type = COMEDI_SUBD_CALIB; @@ -1510,7 +1511,7 @@ static int setup_subdevices(struct comedi_device * dev) } else s->type = COMEDI_SUBD_UNUSED; - //serial EEPROM, if present + /* serial EEPROM, if present */ s = dev->subdevices + 8; if (readl(priv(dev)->plx9080_iobase + PLX_CONTROL_REG) & CTL_EECHK) { s->type = COMEDI_SUBD_MEMORY; @@ -1521,7 +1522,7 @@ static int setup_subdevices(struct comedi_device * dev) } else s->type = COMEDI_SUBD_UNUSED; - // user counter subd XXX + /* user counter subd XXX */ s = dev->subdevices + 9; s->type = COMEDI_SUBD_UNUSED; @@ -1542,13 +1543,13 @@ static void init_stc_registers(struct comedi_device * dev) comedi_spin_lock_irqsave(&dev->spinlock, flags); - // bit should be set for 6025, although docs say boards with <= 16 chans should be cleared XXX + /* bit should be set for 6025, although docs say boards with <= 16 chans should be cleared XXX */ if (1) priv(dev)->adc_control1_bits |= ADC_QUEUE_CONFIG_BIT; writew(priv(dev)->adc_control1_bits, priv(dev)->main_iobase + ADC_CONTROL1_REG); - // 6402/16 manual says this register must be initialized to 0xff? + /* 6402/16 manual says this register must be initialized to 0xff? */ writew(0xff, priv(dev)->main_iobase + ADC_SAMPLE_INTERVAL_UPPER_REG); bits = SLOW_DAC_BIT | DMA_CH_SELECT_BIT; @@ -1563,7 +1564,7 @@ static void init_stc_registers(struct comedi_device * dev) comedi_spin_unlock_irqrestore(&dev->spinlock, flags); - // set fifos to maximum size + /* set fifos to maximum size */ priv(dev)->fifo_size_bits |= DAC_FIFO_BITS; set_ai_fifo_segment_length(dev, board(dev)->ai_fifo->max_segment_length); @@ -1581,7 +1582,7 @@ int alloc_and_init_dma_members(struct comedi_device * dev) { int i; - // alocate pci dma buffers + /* alocate pci dma buffers */ for (i = 0; i < ai_dma_ring_count(board(dev)); i++) { priv(dev)->ai_buffer[i] = pci_alloc_consistent(priv(dev)->hw_dev, DMA_BUFFER_SIZE, @@ -1601,7 +1602,7 @@ int alloc_and_init_dma_members(struct comedi_device * dev) } } } - // allocate dma descriptors + /* allocate dma descriptors */ priv(dev)->ai_dma_desc = pci_alloc_consistent(priv(dev)->hw_dev, sizeof(struct plx_dma_desc) * ai_dma_ring_count(board(dev)), @@ -1622,7 +1623,7 @@ int alloc_and_init_dma_members(struct comedi_device * dev) DEBUG_PRINT("ao dma descriptors start at bus addr 0x%x\n", priv(dev)->ao_dma_desc_bus_addr); } - // initialize dma descriptors + /* initialize dma descriptors */ for (i = 0; i < ai_dma_ring_count(board(dev)); i++) { priv(dev)->ai_dma_desc[i].pci_start_addr = cpu_to_le32(priv(dev)->ai_buffer_bus_addr[i]); @@ -1697,16 +1698,16 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it) 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? + /* is it not a computer boards card? */ if (pcidev->vendor != PCI_VENDOR_ID_COMPUTERBOARDS) continue; - // loop through cards supported by this driver + /* loop through cards supported by this driver */ for (index = 0; index < num_boards(); index++) { if (pcidas64_boards[index].device_id != pcidev->device) continue; - // was a particular bus/slot requested? + /* was a particular bus/slot requested? */ if (it->options[0] || it->options[1]) { - // are we on the wrong bus/slot? + /* are we on the wrong bus/slot? */ if (pcidev->bus->number != it->options[0] || PCI_SLOT(pcidev->devfn) != it->options[1]) { @@ -1736,7 +1737,7 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it) } pci_set_master(pcidev); - //Initialize dev->board_name + /* Initialize dev->board_name */ dev->board_name = board(dev)->name; priv(dev)->plx9080_phys_iobase = @@ -1746,7 +1747,7 @@ static int attach(struct comedi_device *dev, struct 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 + /* remap, won't work with 2.0 kernels but who cares */ priv(dev)->plx9080_iobase = ioremap(priv(dev)->plx9080_phys_iobase, pci_resource_len(pcidev, PLX9080_BADDRINDEX)); priv(dev)->main_iobase = ioremap(priv(dev)->main_phys_iobase, @@ -1766,7 +1767,7 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it) DEBUG_PRINT(" diocounter remapped to 0x%p\n", priv(dev)->dio_counter_iobase); - // figure out what local addresses are + /* figure out what local addresses are */ local_range = readl(priv(dev)->plx9080_iobase + PLX_LAS0RNG_REG) & LRNG_MEM_MASK; @@ -1798,7 +1799,7 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it) printk(" stc hardware revision %i\n", priv(dev)->hw_revision); init_plx9080(dev); init_stc_registers(dev); - // get irq + /* get irq */ if (comedi_request_irq(pcidev->irq, handle_interrupt, IRQF_SHARED, "cb_pcidas64", dev)) { printk(" unable to allocate irq %u\n", pcidev->irq); @@ -1841,7 +1842,7 @@ static int detach(struct comedi_device * dev) iounmap((void *)priv(dev)->main_iobase); if (priv(dev)->dio_counter_iobase) iounmap((void *)priv(dev)->dio_counter_iobase); - // free pci dma buffers + /* free pci dma buffers */ for (i = 0; i < ai_dma_ring_count(board(dev)); i++) { if (priv(dev)->ai_buffer[i]) pci_free_consistent(priv(dev)->hw_dev, @@ -1858,7 +1859,7 @@ static int detach(struct comedi_device * dev) priv(dev)-> ao_buffer_bus_addr[i]); } - // free dma descriptors + /* free dma descriptors */ if (priv(dev)->ai_dma_desc) pci_free_consistent(priv(dev)->hw_dev, sizeof(struct plx_dma_desc) * @@ -1896,8 +1897,8 @@ static int ai_rinsn(struct comedi_device * dev, struct comedi_subdevice * s, range = CR_RANGE(insn->chanspec); aref = CR_AREF(insn->chanspec); - // disable card's analog input interrupt sources and pacing - // 4020 generates dac done interrupts even though they are disabled + /* disable card's analog input interrupt sources and pacing */ + /* 4020 generates dac done interrupts even though they are disabled */ disable_ai_pacing(dev); comedi_spin_lock_irqsave(&dev->spinlock, flags); @@ -1910,12 +1911,12 @@ static int ai_rinsn(struct comedi_device * dev, struct comedi_subdevice * s, comedi_spin_unlock_irqrestore(&dev->spinlock, flags); if (board(dev)->layout != LAYOUT_4020) { - // use internal queue + /* use internal queue */ priv(dev)->hw_config_bits &= ~EXT_QUEUE_BIT; writew(priv(dev)->hw_config_bits, priv(dev)->main_iobase + HW_CONFIG_REG); - // ALT_SOURCE is internal calibration reference + /* ALT_SOURCE is internal calibration reference */ if (insn->chanspec & CR_ALT_SOURCE) { unsigned int cal_en_bit; @@ -1924,27 +1925,27 @@ static int ai_rinsn(struct comedi_device * dev, struct comedi_subdevice * s, cal_en_bit = CAL_EN_60XX_BIT; else cal_en_bit = CAL_EN_64XX_BIT; - // select internal reference source to connect to channel 0 + /* select internal reference source to connect to channel 0 */ writew(cal_en_bit | adc_src_bits(priv(dev)-> calibration_source), priv(dev)->main_iobase + CALIBRATION_REG); } else { - // make sure internal calibration source is turned off + /* make sure internal calibration source is turned off */ writew(0, priv(dev)->main_iobase + CALIBRATION_REG); } - // load internal queue + /* load internal queue */ bits = 0; - // set gain + /* set gain */ bits |= ai_range_bits_6xxx(dev, CR_RANGE(insn->chanspec)); - // set single-ended / differential + /* set single-ended / differential */ bits |= se_diff_bit_6xxx(dev, aref == AREF_DIFF); if (aref == AREF_COMMON) bits |= ADC_COMMON_BIT; bits |= adc_chan_bits(channel); - // set stop channel + /* set stop channel */ writew(adc_chan_bits(channel), priv(dev)->main_iobase + ADC_QUEUE_HIGH_REG); - // set start channel, and rest of settings + /* set start channel, and rest of settings */ writew(bits, priv(dev)->main_iobase + ADC_QUEUE_LOAD_REG); } else { uint8_t old_cal_range_bits = priv(dev)->i2c_cal_range_bits; @@ -1955,16 +1956,16 @@ static int ai_rinsn(struct comedi_device * dev, struct comedi_subdevice * s, priv(dev)->i2c_cal_range_bits |= adc_src_4020_bits(priv(dev)-> calibration_source); - } else { //select BNC inputs + } else { /* select BNC inputs */ priv(dev)->i2c_cal_range_bits |= adc_src_4020_bits(4); } - // select range + /* select range */ if (range == 0) priv(dev)->i2c_cal_range_bits |= attenuate_bit(channel); else priv(dev)->i2c_cal_range_bits &= ~attenuate_bit(channel); - // update calibration/range i2c register only if necessary, as it is very slow + /* update calibration/range i2c register only if necessary, as it is very slow */ if (old_cal_range_bits != priv(dev)->i2c_cal_range_bits) { uint8_t i2c_data = priv(dev)->i2c_cal_range_bits; i2c_write(dev, RANGE_CAL_I2C_ADDR, &i2c_data, @@ -1981,14 +1982,14 @@ static int ai_rinsn(struct comedi_device * dev, struct comedi_subdevice * s, for (n = 0; n < insn->n; n++) { - // clear adc buffer (inside loop for 4020 sake) + /* clear adc buffer (inside loop for 4020 sake) */ writew(0, priv(dev)->main_iobase + ADC_BUFFER_CLEAR_REG); /* trigger conversion, bits sent only matter for 4020 */ writew(adc_convert_chan_4020_bits(CR_CHAN(insn->chanspec)), priv(dev)->main_iobase + ADC_CONVERT_REG); - // wait for data + /* wait for data */ for (i = 0; i < timeout; i++) { bits = readw(priv(dev)->main_iobase + HW_STATUS_REG); DEBUG_PRINT(" pipe bits 0x%x\n", pipe_full_bits(bits)); @@ -2092,7 +2093,7 @@ static int ai_config_master_clock_4020(struct comedi_device * dev, unsigned int return retval ? retval : 5; } -// XXX could add support for 60xx series +/* XXX could add support for 60xx series */ static int ai_config_master_clock(struct comedi_device * dev, unsigned int * data) { @@ -2182,7 +2183,7 @@ static int ai_cmdtest(struct comedi_device * dev, struct comedi_subdevice * s, /* step 2: make sure trigger sources are unique and mutually compatible */ - // uniqueness check + /* uniqueness check */ if (cmd->start_src != TRIG_NOW && cmd->start_src != TRIG_EXT) err++; if (cmd->scan_begin_src != TRIG_TIMER && @@ -2196,7 +2197,7 @@ static int ai_cmdtest(struct comedi_device * dev, struct comedi_subdevice * s, cmd->stop_src != TRIG_NONE && cmd->stop_src != TRIG_EXT) err++; - // compatibility check + /* compatibility check */ if (cmd->convert_src == TRIG_EXT && cmd->scan_begin_src == TRIG_TIMER) err++; if (cmd->stop_src != TRIG_COUNT && @@ -2220,7 +2221,7 @@ static int ai_cmdtest(struct comedi_device * dev, struct comedi_subdevice * s, err++; } if (cmd->scan_begin_src == TRIG_TIMER) { - // if scans are timed faster than conversion rate allows + /* if scans are timed faster than conversion rate allows */ if (cmd->convert_arg * cmd->chanlist_len > cmd->scan_begin_arg) { cmd->scan_begin_arg = @@ -2278,7 +2279,7 @@ static int ai_cmdtest(struct comedi_device * dev, struct comedi_subdevice * s, if (err) return 4; - // make sure user is doesn't change analog reference mid chanlist + /* make sure user is doesn't change analog reference mid chanlist */ if (cmd->chanlist) { aref = CR_AREF(cmd->chanlist[0]); for (i = 1; i < cmd->chanlist_len; i++) { @@ -2289,7 +2290,7 @@ static int ai_cmdtest(struct comedi_device * dev, struct comedi_subdevice * s, break; } } - // check 4020 chanlist + /* check 4020 chanlist */ if (board(dev)->layout == LAYOUT_4020) { unsigned int first_channel = CR_CHAN(cmd->chanlist[0]); for (i = 1; i < cmd->chanlist_len; i++) { @@ -2317,7 +2318,7 @@ static int ai_cmdtest(struct comedi_device * dev, struct comedi_subdevice * s, static int use_hw_sample_counter(struct comedi_cmd * cmd) { -// disable for now until I work out a race +/* disable for now until I work out a race */ return 0; if (cmd->stop_src == TRIG_COUNT && cmd->stop_arg <= max_counter_value) @@ -2329,10 +2330,10 @@ static int use_hw_sample_counter(struct comedi_cmd * cmd) static void setup_sample_counters(struct comedi_device * dev, struct comedi_cmd * cmd) { if (cmd->stop_src == TRIG_COUNT) { - // set software count + /* set software count */ priv(dev)->ai_count = cmd->stop_arg * cmd->chanlist_len; } - // load hardware conversion counter + /* load hardware conversion counter */ if (use_hw_sample_counter(cmd)) { writew(cmd->stop_arg & 0xffff, priv(dev)->main_iobase + ADC_COUNT_LOWER_REG); @@ -2396,9 +2397,9 @@ static void enable_ai_interrupts(struct comedi_device * dev, const struct comedi bits = EN_ADC_OVERRUN_BIT | EN_ADC_DONE_INTR_BIT | EN_ADC_ACTIVE_INTR_BIT | EN_ADC_STOP_INTR_BIT; - // Use pio transfer and interrupt on end of conversion if TRIG_WAKE_EOS flag is set. + /* Use pio transfer and interrupt on end of conversion if TRIG_WAKE_EOS flag is set. */ if (cmd->flags & TRIG_WAKE_EOS) { - // 4020 doesn't support pio transfers except for fifo dregs + /* 4020 doesn't support pio transfers except for fifo dregs */ if (board(dev)->layout != LAYOUT_4020) bits |= ADC_INTR_EOSCAN_BITS | EN_ADC_INTR_SRC_BIT; } @@ -2413,14 +2414,14 @@ static void enable_ai_interrupts(struct comedi_device * dev, const struct comedi static uint32_t ai_convert_counter_6xxx(const struct comedi_device * dev, const struct comedi_cmd * cmd) { - // supposed to load counter with desired divisor minus 3 + /* supposed to load counter with desired divisor minus 3 */ return cmd->convert_arg / TIMER_BASE - 3; } static uint32_t ai_scan_counter_6xxx(struct comedi_device * dev, struct comedi_cmd * cmd) { uint32_t count; - // figure out how long we need to delay at end of scan + /* figure out how long we need to delay at end of scan */ switch (cmd->scan_begin_src) { case TRIG_TIMER: count = (cmd->scan_begin_arg - @@ -2448,20 +2449,20 @@ static uint32_t ai_convert_counter_4020(struct comedi_device * dev, struct comed case TRIG_OTHER: divisor = priv(dev)->ext_clock.divisor; break; - default: // should never happen + default: /* should never happen */ comedi_error(dev, "bug! failed to set ai pacing!"); divisor = 1000; break; } - // supposed to load counter with desired divisor minus 2 for 4020 + /* supposed to load counter with desired divisor minus 2 for 4020 */ return divisor - 2; } static void select_master_clock_4020(struct comedi_device * dev, const struct comedi_cmd * cmd) { - // select internal/external master clock + /* select internal/external master clock */ priv(dev)->hw_config_bits &= ~MASTER_CLOCK_4020_MASK; if (cmd->scan_begin_src == TRIG_OTHER) { int chanspec = priv(dev)->ext_clock.chanspec; @@ -2492,7 +2493,7 @@ static inline void dma_start_sync(struct comedi_device * dev, unsigned int chann { unsigned long flags; - // spinlock for plx dma control/status reg + /* spinlock for plx dma control/status reg */ comedi_spin_lock_irqsave(&dev->spinlock, flags); if (channel) writeb(PLX_DMA_EN_BIT | PLX_DMA_START_BIT | @@ -2520,17 +2521,17 @@ static void set_ai_pacing(struct comedi_device * dev, struct comedi_cmd * cmd) scan_counter = ai_scan_counter_6xxx(dev, cmd); } - // load lower 16 bits of convert interval + /* load lower 16 bits of convert interval */ writew(convert_counter & 0xffff, priv(dev)->main_iobase + ADC_SAMPLE_INTERVAL_LOWER_REG); DEBUG_PRINT("convert counter 0x%x\n", convert_counter); - // load upper 8 bits of convert interval + /* load upper 8 bits of convert interval */ writew((convert_counter >> 16) & 0xff, priv(dev)->main_iobase + ADC_SAMPLE_INTERVAL_UPPER_REG); - // load lower 16 bits of scan delay + /* load lower 16 bits of scan delay */ writew(scan_counter & 0xffff, priv(dev)->main_iobase + ADC_DELAY_INTERVAL_LOWER_REG); - // load upper 8 bits of scan delay + /* load upper 8 bits of scan delay */ writew((scan_counter >> 16) & 0xff, priv(dev)->main_iobase + ADC_DELAY_INTERVAL_UPPER_REG); DEBUG_PRINT("scan counter 0x%x\n", scan_counter); @@ -2563,25 +2564,25 @@ static int setup_channel_queue(struct comedi_device * dev, const struct comedi_c writew(priv(dev)->hw_config_bits, priv(dev)->main_iobase + HW_CONFIG_REG); bits = 0; - // set channel + /* set channel */ bits |= adc_chan_bits(CR_CHAN(cmd->chanlist[0])); - // set gain + /* set gain */ bits |= ai_range_bits_6xxx(dev, CR_RANGE(cmd->chanlist[0])); - // set single-ended / differential + /* set single-ended / differential */ bits |= se_diff_bit_6xxx(dev, CR_AREF(cmd->chanlist[0]) == AREF_DIFF); if (CR_AREF(cmd->chanlist[0]) == AREF_COMMON) bits |= ADC_COMMON_BIT; - // set stop channel + /* set stop channel */ writew(adc_chan_bits(CR_CHAN(cmd->chanlist[cmd-> chanlist_len - 1])), priv(dev)->main_iobase + ADC_QUEUE_HIGH_REG); - // set start channel, and rest of settings + /* set start channel, and rest of settings */ writew(bits, priv(dev)->main_iobase + ADC_QUEUE_LOAD_REG); } else { - // use external queue + /* use external queue */ if (dev->write_subdev && dev->write_subdev->busy) { warn_external_queue(dev); return -EBUSY; @@ -2589,26 +2590,26 @@ static int setup_channel_queue(struct comedi_device * dev, const struct comedi_c priv(dev)->hw_config_bits |= EXT_QUEUE_BIT; writew(priv(dev)->hw_config_bits, priv(dev)->main_iobase + HW_CONFIG_REG); - // clear DAC buffer to prevent weird interactions + /* clear DAC buffer to prevent weird interactions */ writew(0, priv(dev)->main_iobase + DAC_BUFFER_CLEAR_REG); - // clear queue pointer + /* clear queue pointer */ writew(0, priv(dev)->main_iobase + ADC_QUEUE_CLEAR_REG); - // load external queue + /* load external queue */ for (i = 0; i < cmd->chanlist_len; i++) { bits = 0; - // set channel + /* set channel */ bits |= adc_chan_bits(CR_CHAN(cmd-> chanlist[i])); - // set gain + /* set gain */ bits |= ai_range_bits_6xxx(dev, CR_RANGE(cmd->chanlist[i])); - // set single-ended / differential + /* set single-ended / differential */ bits |= se_diff_bit_6xxx(dev, CR_AREF(cmd->chanlist[i]) == AREF_DIFF); if (CR_AREF(cmd->chanlist[i]) == AREF_COMMON) bits |= ADC_COMMON_BIT; - // mark end of queue + /* mark end of queue */ if (i == cmd->chanlist_len - 1) bits |= QUEUE_EOSCAN_BIT | QUEUE_EOSEQ_BIT; @@ -2622,7 +2623,7 @@ static int setup_channel_queue(struct comedi_device * dev, const struct comedi_c /* doing a queue clear is not specified in board docs, * but required for reliable operation */ writew(0, priv(dev)->main_iobase + ADC_QUEUE_CLEAR_REG); - // prime queue holding register + /* prime queue holding register */ writew(0, priv(dev)->main_iobase + ADC_QUEUE_LOAD_REG); } } else { @@ -2630,9 +2631,9 @@ static int setup_channel_queue(struct comedi_device * dev, const struct comedi_c priv(dev)->i2c_cal_range_bits; priv(dev)->i2c_cal_range_bits &= ~ADC_SRC_4020_MASK; - //select BNC inputs + /* select BNC inputs */ priv(dev)->i2c_cal_range_bits |= adc_src_4020_bits(4); - // select ranges + /* select ranges */ for (i = 0; i < cmd->chanlist_len; i++) { unsigned int channel = CR_CHAN(cmd->chanlist[i]); unsigned int range = CR_RANGE(cmd->chanlist[i]); @@ -2644,7 +2645,7 @@ static int setup_channel_queue(struct comedi_device * dev, const struct comedi_c priv(dev)->i2c_cal_range_bits &= ~attenuate_bit(channel); } - // update calibration/range i2c register only if necessary, as it is very slow + /* update calibration/range i2c register only if necessary, as it is very slow */ if (old_cal_range_bits != priv(dev)->i2c_cal_range_bits) { uint8_t i2c_data = priv(dev)->i2c_cal_range_bits; i2c_write(dev, RANGE_CAL_I2C_ADDR, &i2c_data, @@ -2697,7 +2698,7 @@ static int ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) if (retval < 0) return retval; - // make sure internal calibration source is turned off + /* make sure internal calibration source is turned off */ writew(0, priv(dev)->main_iobase + CALIBRATION_REG); set_ai_pacing(dev, cmd); @@ -2713,9 +2714,9 @@ static int ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) if (board(dev)->layout != LAYOUT_4020) { priv(dev)->adc_control1_bits &= ~ADC_MODE_MASK; if (cmd->convert_src == TRIG_EXT) - priv(dev)->adc_control1_bits |= adc_mode_bits(13); // good old mode 13 + priv(dev)->adc_control1_bits |= adc_mode_bits(13); /* good old mode 13 */ else - priv(dev)->adc_control1_bits |= adc_mode_bits(8); // mode 8. What else could you need? + priv(dev)->adc_control1_bits |= adc_mode_bits(8); /* mode 8. What else could you need? */ } else { priv(dev)->adc_control1_bits &= ~CHANNEL_MODE_4020_MASK; if (cmd->chanlist_len == 4) @@ -2735,20 +2736,20 @@ static int ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) DEBUG_PRINT("control1 bits 0x%x\n", priv(dev)->adc_control1_bits); comedi_spin_unlock_irqrestore(&dev->spinlock, flags); - // clear adc buffer + /* clear adc buffer */ writew(0, priv(dev)->main_iobase + ADC_BUFFER_CLEAR_REG); if ((cmd->flags & TRIG_WAKE_EOS) == 0 || board(dev)->layout == LAYOUT_4020) { priv(dev)->ai_dma_index = 0; - // set dma transfer size + /* set dma transfer size */ for (i = 0; i < ai_dma_ring_count(board(dev)); i++) priv(dev)->ai_dma_desc[i].transfer_size = cpu_to_le32(dma_transfer_size(dev) * sizeof(uint16_t)); - // give location of first dma descriptor + /* give location of first dma descriptor */ load_first_dma_descriptor(dev, 1, priv(dev)-> ai_dma_desc_bus_addr | PLX_DESC_IN_PCI_BIT | @@ -2773,7 +2774,7 @@ static int ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) bits = ADC_ENABLE_BIT | ADC_SOFT_GATE_BITS | ADC_GATE_LEVEL_BIT; if (cmd->flags & TRIG_WAKE_EOS) bits |= ADC_DMA_DISABLE_BIT; - // set start trigger + /* set start trigger */ if (cmd->start_src == TRIG_EXT) { bits |= ADC_START_TRIG_EXT_BITS; if (cmd->start_arg & CR_INVERT) @@ -2789,7 +2790,7 @@ static int ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) comedi_spin_unlock_irqrestore(&dev->spinlock, flags); - // start aquisition + /* start aquisition */ if (cmd->start_src == TRIG_NOW) { writew(0, priv(dev)->main_iobase + ADC_START_REG); DEBUG_PRINT("soft trig\n"); @@ -2798,7 +2799,7 @@ static int ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) return 0; } -// read num_samples from 16 bit wide ai fifo +/* read num_samples from 16 bit wide ai fifo */ static void pio_drain_ai_fifo_16(struct comedi_device * dev) { struct comedi_subdevice *s = dev->read_subdev; @@ -2810,7 +2811,7 @@ static void pio_drain_ai_fifo_16(struct comedi_device * dev) int num_samples; do { - // get least significant 15 bits + /* get least significant 15 bits */ read_index = readw(priv(dev)->main_iobase + ADC_READ_PNTR_REG) & 0x7fff; @@ -2899,7 +2900,7 @@ static void pio_drain_ai_fifo_32(struct comedi_device * dev) priv(dev)->ai_count -= i; } -// empty fifo +/* empty fifo */ static void pio_drain_ai_fifo(struct comedi_device * dev) { if (board(dev)->layout == LAYOUT_4020) { @@ -2923,7 +2924,7 @@ static void drain_dma_buffers(struct comedi_device * dev, unsigned int channel) pci_addr_reg = priv(dev)->plx9080_iobase + PLX_DMA0_PCI_ADDRESS_REG; - // loop until we have read all the full buffers + /* loop until we have read all the full buffers */ for (j = 0, next_transfer_addr = readl(pci_addr_reg); (next_transfer_addr < priv(dev)->ai_buffer_bus_addr[priv(dev)->ai_dma_index] @@ -2931,7 +2932,7 @@ static void drain_dma_buffers(struct comedi_device * dev, unsigned int channel) priv(dev)->ai_buffer_bus_addr[priv(dev)->ai_dma_index] + DMA_BUFFER_SIZE) && j < ai_dma_ring_count(board(dev)); j++) { - // transfer data from dma buffer to comedi buffer + /* transfer data from dma buffer to comedi buffer */ num_samples = dma_transfer_size(dev); if (async->cmd.stop_src == TRIG_COUNT) { if (num_samples > priv(dev)->ai_count) @@ -2963,15 +2964,15 @@ void handle_ai_interrupt(struct comedi_device * dev, unsigned short status, uint8_t dma1_status; unsigned long flags; - // check for fifo overrun + /* check for fifo overrun */ if (status & ADC_OVERRUN_BIT) { comedi_error(dev, "fifo overrun"); async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; } - // spin lock makes sure noone else changes plx dma control reg + /* spin lock makes sure noone else changes plx dma control reg */ comedi_spin_lock_irqsave(&dev->spinlock, flags); dma1_status = readb(priv(dev)->plx9080_iobase + PLX_DMA1_CS_REG); - if (plx_status & ICS_DMA1_A) { // dma chan 1 interrupt + if (plx_status & ICS_DMA1_A) { /* dma chan 1 interrupt */ writeb((dma1_status & PLX_DMA_EN_BIT) | PLX_CLEAR_DMA_INTR_BIT, priv(dev)->plx9080_iobase + PLX_DMA1_CS_REG); DEBUG_PRINT("dma1 status 0x%x\n", dma1_status); @@ -2986,7 +2987,7 @@ void handle_ai_interrupt(struct comedi_device * dev, unsigned short status, if (status & ADC_DONE_BIT) DEBUG_PRINT("adc done interrupt\n"); - // drain fifo with pio + /* drain fifo with pio */ if ((status & ADC_DONE_BIT) || ((cmd->flags & TRIG_WAKE_EOS) && (status & ADC_INTR_PENDING_BIT) && @@ -2999,7 +3000,7 @@ void handle_ai_interrupt(struct comedi_device * dev, unsigned short status, } else comedi_spin_unlock_irqrestore(&dev->spinlock, flags); } - // if we are have all the data, then quit + /* if we are have all the data, then quit */ if ((cmd->stop_src == TRIG_COUNT && priv(dev)->ai_count <= 0) || (cmd->stop_src == TRIG_EXT && (status & ADC_STOP_BIT))) { async->events |= COMEDI_CB_EOA; @@ -3091,10 +3092,10 @@ static void handle_ao_interrupt(struct comedi_device * dev, unsigned short statu async = s->async; cmd = &async->cmd; - // spin lock makes sure noone else changes plx dma control reg + /* spin lock makes sure noone else changes plx dma control reg */ comedi_spin_lock_irqsave(&dev->spinlock, flags); dma0_status = readb(priv(dev)->plx9080_iobase + PLX_DMA0_CS_REG); - if (plx_status & ICS_DMA0_A) { // dma chan 0 interrupt + if (plx_status & ICS_DMA0_A) { /* dma chan 0 interrupt */ if ((dma0_status & PLX_DMA_EN_BIT) && !(dma0_status & PLX_DMA_DONE_BIT)) writeb(PLX_DMA_EN_BIT | PLX_CLEAR_DMA_INTR_BIT, @@ -3128,7 +3129,7 @@ static void handle_ao_interrupt(struct comedi_device * dev, unsigned short statu cfc_handle_events(dev, s); } -static irqreturn_t handle_interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t handle_interrupt(int irq, void *d) { struct comedi_device *dev = d; unsigned short status; @@ -3152,8 +3153,8 @@ static irqreturn_t handle_interrupt(int irq, void *d PT_REGS_ARG) handle_ai_interrupt(dev, status, plx_status); handle_ao_interrupt(dev, status, plx_status); - // clear possible plx9080 interrupt sources - if (plx_status & ICS_LDIA) { // clear local doorbell interrupt + /* clear possible plx9080 interrupt sources */ + if (plx_status & ICS_LDIA) { /* clear local doorbell interrupt */ plx_bits = readl(priv(dev)->plx9080_iobase + PLX_DBR_OUT_REG); writel(plx_bits, priv(dev)->plx9080_iobase + PLX_DBR_OUT_REG); DEBUG_PRINT(" cleared local doorbell bits 0x%x\n", plx_bits); @@ -3168,7 +3169,7 @@ void abort_dma(struct comedi_device * dev, unsigned int channel) { unsigned long flags; - // spinlock for plx dma control/status reg + /* spinlock for plx dma control/status reg */ comedi_spin_lock_irqsave(&dev->spinlock, flags); plx9080_abort_dma(priv(dev)->plx9080_iobase, channel); @@ -3202,15 +3203,15 @@ static int ao_winsn(struct comedi_device * dev, struct comedi_subdevice * s, int chan = CR_CHAN(insn->chanspec); int range = CR_RANGE(insn->chanspec); - // do some initializing + /* do some initializing */ writew(0, priv(dev)->main_iobase + DAC_CONTROL0_REG); - // set range + /* set range */ set_dac_range_bits(dev, &priv(dev)->dac_control1_bits, chan, range); writew(priv(dev)->dac_control1_bits, priv(dev)->main_iobase + DAC_CONTROL1_REG); - // write to channel + /* write to channel */ if (board(dev)->layout == LAYOUT_4020) { writew(data[0] & 0xff, priv(dev)->main_iobase + dac_lsb_4020_reg(chan)); @@ -3220,7 +3221,7 @@ static int ao_winsn(struct comedi_device * dev, struct comedi_subdevice * s, writew(data[0], priv(dev)->main_iobase + dac_convert_reg(chan)); } - // remember output value + /* remember output value */ priv(dev)->ao_value[chan] = data[0]; return 1; @@ -3503,14 +3504,14 @@ static int ao_cmdtest(struct comedi_device * dev, struct comedi_subdevice * s, /* step 2: make sure trigger sources are unique and mutually compatible */ - // uniqueness check + /* uniqueness check */ if (cmd->start_src != TRIG_INT && cmd->start_src != TRIG_EXT) err++; if (cmd->scan_begin_src != TRIG_TIMER && cmd->scan_begin_src != TRIG_EXT) err++; - // compatibility check + /* compatibility check */ if (cmd->convert_src == TRIG_EXT && cmd->scan_begin_src == TRIG_TIMER) err++; if (cmd->stop_src != TRIG_COUNT && @@ -3624,9 +3625,9 @@ static int do_wbits(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { data[0] &= 0xf; - // zero bits we are going to change + /* zero bits we are going to change */ s->state &= ~data[0]; - // set new bits + /* set new bits */ s->state |= data[0] & data[1]; writeb(s->state, priv(dev)->dio_counter_iobase + DO_REG); @@ -3793,24 +3794,24 @@ static uint16_t read_eeprom(struct comedi_device * dev, uint8_t address) comedi_udelay(eeprom_comedi_udelay); priv(dev)->plx_control_bits &= ~CTL_EE_CLK & ~CTL_EE_CS; - // make sure we don't send anything to the i2c bus on 4020 + /* make sure we don't send anything to the i2c bus on 4020 */ priv(dev)->plx_control_bits |= CTL_USERO; writel(priv(dev)->plx_control_bits, plx_control_addr); - // activate serial eeprom + /* activate serial eeprom */ comedi_udelay(eeprom_comedi_udelay); priv(dev)->plx_control_bits |= CTL_EE_CS; writel(priv(dev)->plx_control_bits, plx_control_addr); - // write read command and desired memory address + /* write read command and desired memory address */ for (bit = 1 << (bitstream_length - 1); bit; bit >>= 1) { - // set bit to be written + /* set bit to be written */ comedi_udelay(eeprom_comedi_udelay); if (bitstream & bit) priv(dev)->plx_control_bits |= CTL_EE_W; else priv(dev)->plx_control_bits &= ~CTL_EE_W; writel(priv(dev)->plx_control_bits, plx_control_addr); - // clock in bit + /* clock in bit */ comedi_udelay(eeprom_comedi_udelay); priv(dev)->plx_control_bits |= CTL_EE_CLK; writel(priv(dev)->plx_control_bits, plx_control_addr); @@ -3818,10 +3819,10 @@ static uint16_t read_eeprom(struct comedi_device * dev, uint8_t address) priv(dev)->plx_control_bits &= ~CTL_EE_CLK; writel(priv(dev)->plx_control_bits, plx_control_addr); } - // read back value from eeprom memory location + /* read back value from eeprom memory location */ value = 0; for (bit = 1 << (value_length - 1); bit; bit >>= 1) { - // clock out bit + /* clock out bit */ comedi_udelay(eeprom_comedi_udelay); priv(dev)->plx_control_bits |= CTL_EE_CLK; writel(priv(dev)->plx_control_bits, plx_control_addr); @@ -3833,7 +3834,7 @@ static uint16_t read_eeprom(struct comedi_device * dev, uint8_t address) value |= bit; } - // deactivate eeprom serial input + /* deactivate eeprom serial input */ comedi_udelay(eeprom_comedi_udelay); priv(dev)->plx_control_bits &= ~CTL_EE_CS; writel(priv(dev)->plx_control_bits, plx_control_addr); @@ -3880,7 +3881,7 @@ static void check_adc_timing(struct comedi_device *dev, struct comedi_cmd *cmd) if (cmd->scan_begin_src == TRIG_TIMER) { scan_divisor = get_divisor(cmd->scan_begin_arg, cmd->flags); if (cmd->convert_src == TRIG_TIMER) { - // XXX check for integer overflows + /* XXX check for integer overflows */ min_scan_divisor = convert_divisor * cmd->chanlist_len; max_scan_divisor = (convert_divisor * cmd->chanlist_len - 1) + @@ -3926,7 +3927,7 @@ static unsigned int get_ao_divisor(unsigned int ns, unsigned int flags) return get_divisor(ns, flags) - 2; } -// adjusts the size of hardware fifo (which determines block size for dma xfers) +/* adjusts the size of hardware fifo (which determines block size for dma xfers) */ static int set_ai_fifo_size(struct comedi_device * dev, unsigned int num_samples) { unsigned int num_fifo_entries; @@ -3947,7 +3948,7 @@ static int set_ai_fifo_size(struct comedi_device * dev, unsigned int num_samples return num_samples; } -// query length of fifo +/* query length of fifo */ static unsigned int ai_fifo_size(struct comedi_device * dev) { return priv(dev)->ai_fifo_segment_length * @@ -3968,7 +3969,7 @@ static int set_ai_fifo_segment_length(struct comedi_device * dev, if (num_entries > fifo->max_segment_length) num_entries = fifo->max_segment_length; - // 1 == 256 entries, 2 == 512 entries, etc + /* 1 == 256 entries, 2 == 512 entries, etc */ num_increments = (num_entries + increment_size / 2) / increment_size; bits = (~(num_increments - 1)) & fifo->fifo_size_reg_mask; @@ -4037,14 +4038,14 @@ static int caldac_8800_write(struct comedi_device * dev, unsigned int address, return 0; } -// 4020 caldacs +/* 4020 caldacs */ static int caldac_i2c_write(struct comedi_device * dev, unsigned int caldac_channel, unsigned int value) { uint8_t serial_bytes[3]; uint8_t i2c_addr; enum pointer_bits { - // manual has gain and offset bits switched + /* manual has gain and offset bits switched */ OFFSET_0_2 = 0x1, GAIN_0_2 = 0x2, OFFSET_1_3 = 0x4, @@ -4055,35 +4056,35 @@ static int caldac_i2c_write(struct comedi_device * dev, unsigned int caldac_chan }; switch (caldac_channel) { - case 0: // chan 0 offset + case 0: /* chan 0 offset */ i2c_addr = CALDAC0_I2C_ADDR; serial_bytes[0] = OFFSET_0_2; break; - case 1: // chan 1 offset + case 1: /* chan 1 offset */ i2c_addr = CALDAC0_I2C_ADDR; serial_bytes[0] = OFFSET_1_3; break; - case 2: // chan 2 offset + case 2: /* chan 2 offset */ i2c_addr = CALDAC1_I2C_ADDR; serial_bytes[0] = OFFSET_0_2; break; - case 3: // chan 3 offset + case 3: /* chan 3 offset */ i2c_addr = CALDAC1_I2C_ADDR; serial_bytes[0] = OFFSET_1_3; break; - case 4: // chan 0 gain + case 4: /* chan 0 gain */ i2c_addr = CALDAC0_I2C_ADDR; serial_bytes[0] = GAIN_0_2; break; - case 5: // chan 1 gain + case 5: /* chan 1 gain */ i2c_addr = CALDAC0_I2C_ADDR; serial_bytes[0] = GAIN_1_3; break; - case 6: // chan 2 gain + case 6: /* chan 2 gain */ i2c_addr = CALDAC1_I2C_ADDR; serial_bytes[0] = GAIN_0_2; break; - case 7: // chan 3 gain + case 7: /* chan 3 gain */ i2c_addr = CALDAC1_I2C_ADDR; serial_bytes[0] = GAIN_1_3; break; @@ -4098,22 +4099,22 @@ static int caldac_i2c_write(struct comedi_device * dev, unsigned int caldac_chan return 0; } -// Their i2c requires a huge delay on setting clock or data high for some reason +/* Their i2c requires a huge delay on setting clock or data high for some reason */ static const int i2c_high_comedi_udelay = 1000; static const int i2c_low_comedi_udelay = 10; -// set i2c data line high or low +/* set i2c data line high or low */ static void i2c_set_sda(struct comedi_device * dev, int state) { static const int data_bit = CTL_EE_W; void *plx_control_addr = priv(dev)->plx9080_iobase + PLX_CONTROL_REG; if (state) { - // set data line high + /* set data line high */ priv(dev)->plx_control_bits &= ~data_bit; writel(priv(dev)->plx_control_bits, plx_control_addr); comedi_udelay(i2c_high_comedi_udelay); - } else // set data line low + } else /* set data line low */ { priv(dev)->plx_control_bits |= data_bit; writel(priv(dev)->plx_control_bits, plx_control_addr); @@ -4121,18 +4122,18 @@ static void i2c_set_sda(struct comedi_device * dev, int state) } } -// set i2c clock line high or low +/* set i2c clock line high or low */ static void i2c_set_scl(struct comedi_device * dev, int state) { static const int clock_bit = CTL_USERO; void *plx_control_addr = priv(dev)->plx9080_iobase + PLX_CONTROL_REG; if (state) { - // set clock line high + /* set clock line high */ priv(dev)->plx_control_bits &= ~clock_bit; writel(priv(dev)->plx_control_bits, plx_control_addr); comedi_udelay(i2c_high_comedi_udelay); - } else // set clock line low + } else /* set clock line low */ { priv(dev)->plx_control_bits |= clock_bit; writel(priv(dev)->plx_control_bits, plx_control_addr); @@ -4157,17 +4158,17 @@ static void i2c_write_byte(struct comedi_device * dev, uint8_t byte) } } -// we can't really read the lines, so fake it +/* we can't really read the lines, so fake it */ static int i2c_read_ack(struct comedi_device * dev) { i2c_set_scl(dev, 0); i2c_set_sda(dev, 1); i2c_set_scl(dev, 1); - return 0; // return fake acknowledge bit + return 0; /* return fake acknowledge bit */ } -// send start bit +/* send start bit */ static void i2c_start(struct comedi_device * dev) { i2c_set_scl(dev, 1); @@ -4175,7 +4176,7 @@ static void i2c_start(struct comedi_device * dev) i2c_set_sda(dev, 0); } -// send stop bit +/* send stop bit */ static void i2c_stop(struct comedi_device * dev) { i2c_set_scl(dev, 0); @@ -4191,25 +4192,25 @@ static void i2c_write(struct comedi_device * dev, unsigned int address, uint8_t bitstream; static const int read_bit = 0x1; -//XXX need mutex to prevent simultaneous attempts to access eeprom and i2c bus +/* XXX need mutex to prevent simultaneous attempts to access eeprom and i2c bus */ - // make sure we dont send anything to eeprom + /* make sure we dont send anything to eeprom */ priv(dev)->plx_control_bits &= ~CTL_EE_CS; i2c_stop(dev); i2c_start(dev); - // send address and write bit + /* send address and write bit */ bitstream = (address << 1) & ~read_bit; i2c_write_byte(dev, bitstream); - // get acknowledge + /* get acknowledge */ if (i2c_read_ack(dev) != 0) { comedi_error(dev, "i2c write failed: no acknowledge"); i2c_stop(dev); return; } - // write data bytes + /* write data bytes */ for (i = 0; i < length; i++) { i2c_write_byte(dev, data[i]); if (i2c_read_ack(dev) != 0) { diff --git a/drivers/staging/comedi/drivers/cb_pcidda.c b/drivers/staging/comedi/drivers/cb_pcidda.c index ed0a5eb3dd91..581ff7a81cea 100644 --- a/drivers/staging/comedi/drivers/cb_pcidda.c +++ b/drivers/staging/comedi/drivers/cb_pcidda.c @@ -51,66 +51,66 @@ Please report success/failure with other different cards to #include "comedi_pci.h" #include "8255.h" -#define PCI_VENDOR_ID_CB 0x1307 // PCI vendor number of ComputerBoards -#define N_BOARDS 10 // Number of boards in cb_pcidda_boards -#define EEPROM_SIZE 128 // number of entries in eeprom -#define MAX_AO_CHANNELS 8 // maximum number of ao channels for supported boards +#define PCI_VENDOR_ID_CB 0x1307 /* PCI vendor number of ComputerBoards */ +#define N_BOARDS 10 /* Number of boards in cb_pcidda_boards */ +#define EEPROM_SIZE 128 /* number of entries in eeprom */ +#define MAX_AO_CHANNELS 8 /* maximum number of ao channels for supported boards */ /* PCI-DDA base addresses */ #define DIGITALIO_BADRINDEX 2 - // DIGITAL I/O is pci_dev->resource[2] + /* DIGITAL I/O is pci_dev->resource[2] */ #define DIGITALIO_SIZE 8 - // DIGITAL I/O uses 8 I/O port addresses + /* DIGITAL I/O uses 8 I/O port addresses */ #define DAC_BADRINDEX 3 - // DAC is pci_dev->resource[3] + /* DAC is pci_dev->resource[3] */ /* Digital I/O registers */ -#define PORT1A 0 // PORT 1A DATA +#define PORT1A 0 /* PORT 1A DATA */ -#define PORT1B 1 // PORT 1B DATA +#define PORT1B 1 /* PORT 1B DATA */ -#define PORT1C 2 // PORT 1C DATA +#define PORT1C 2 /* PORT 1C DATA */ -#define CONTROL1 3 // CONTROL REGISTER 1 +#define CONTROL1 3 /* CONTROL REGISTER 1 */ -#define PORT2A 4 // PORT 2A DATA +#define PORT2A 4 /* PORT 2A DATA */ -#define PORT2B 5 // PORT 2B DATA +#define PORT2B 5 /* PORT 2B DATA */ -#define PORT2C 6 // PORT 2C DATA +#define PORT2C 6 /* PORT 2C DATA */ -#define CONTROL2 7 // CONTROL REGISTER 2 +#define CONTROL2 7 /* CONTROL REGISTER 2 */ /* DAC registers */ -#define DACONTROL 0 // D/A CONTROL REGISTER -#define SU 0000001 // Simultaneous update enabled -#define NOSU 0000000 // Simultaneous update disabled -#define ENABLEDAC 0000002 // Enable specified DAC -#define DISABLEDAC 0000000 // Disable specified DAC -#define RANGE2V5 0000000 // 2.5V -#define RANGE5V 0000200 // 5V -#define RANGE10V 0000300 // 10V -#define UNIP 0000400 // Unipolar outputs -#define BIP 0000000 // Bipolar outputs - -#define DACALIBRATION1 4 // D/A CALIBRATION REGISTER 1 -//write bits -#define SERIAL_IN_BIT 0x1 // serial data input for eeprom, caldacs, reference dac +#define DACONTROL 0 /* D/A CONTROL REGISTER */ +#define SU 0000001 /* Simultaneous update enabled */ +#define NOSU 0000000 /* Simultaneous update disabled */ +#define ENABLEDAC 0000002 /* Enable specified DAC */ +#define DISABLEDAC 0000000 /* Disable specified DAC */ +#define RANGE2V5 0000000 /* 2.5V */ +#define RANGE5V 0000200 /* 5V */ +#define RANGE10V 0000300 /* 10V */ +#define UNIP 0000400 /* Unipolar outputs */ +#define BIP 0000000 /* Bipolar outputs */ + +#define DACALIBRATION1 4 /* D/A CALIBRATION REGISTER 1 */ +/* write bits */ +#define SERIAL_IN_BIT 0x1 /* serial data input for eeprom, caldacs, reference dac */ #define CAL_CHANNEL_MASK (0x7 << 1) #define CAL_CHANNEL_BITS(channel) (((channel) << 1) & CAL_CHANNEL_MASK) -//read bits +/* read bits */ #define CAL_COUNTER_MASK 0x1f -#define CAL_COUNTER_OVERFLOW_BIT 0x20 // calibration counter overflow status bit -#define AO_BELOW_REF_BIT 0x40 // analog output is less than reference dac voltage -#define SERIAL_OUT_BIT 0x80 // serial data out, for reading from eeprom +#define CAL_COUNTER_OVERFLOW_BIT 0x20 /* calibration counter overflow status bit */ +#define AO_BELOW_REF_BIT 0x40 /* analog output is less than reference dac voltage */ +#define SERIAL_OUT_BIT 0x80 /* serial data out, for reading from eeprom */ -#define DACALIBRATION2 6 // D/A CALIBRATION REGISTER 2 -#define SELECT_EEPROM_BIT 0x1 // send serial data in to eeprom -#define DESELECT_REF_DAC_BIT 0x2 // don't send serial data to MAX542 reference dac -#define DESELECT_CALDAC_BIT(n) (0x4 << (n)) // don't send serial data to caldac n -#define DUMMY_BIT 0x40 // manual says to set this bit with no explanation +#define DACALIBRATION2 6 /* D/A CALIBRATION REGISTER 2 */ +#define SELECT_EEPROM_BIT 0x1 /* send serial data in to eeprom */ +#define DESELECT_REF_DAC_BIT 0x2 /* don't send serial data to MAX542 reference dac */ +#define DESELECT_CALDAC_BIT(n) (0x4 << (n)) /* don't send serial data to caldac n */ +#define DUMMY_BIT 0x40 /* manual says to set this bit with no explanation */ -#define DADATA 8 // FIRST D/A DATA REGISTER (0) +#define DADATA 8 /* FIRST D/A DATA REGISTER (0) */ static const struct comedi_lrange cb_pcidda_ranges = { 6, @@ -131,15 +131,20 @@ static const struct comedi_lrange cb_pcidda_ranges = { */ struct cb_pcidda_board { const char *name; - char status; // Driver status: - // 0 - tested - // 1 - manual read, not tested - // 2 - manual not read + char status; /* Driver status: */ + + /* + * 0 - tested + * 1 - manual read, not tested + * 2 - manual not read + */ + unsigned short device_id; int ao_chans; int ao_bits; const struct comedi_lrange *ranges; }; + static const struct cb_pcidda_board cb_pcidda_boards[] = { { name: "pci-dda02/12", @@ -219,11 +224,13 @@ struct cb_pcidda_private { unsigned long digitalio; unsigned long dac; - //unsigned long control_status; - //unsigned long adc_fifo; - unsigned int dac_cal1_bits; // bits last written to da calibration register 1 - unsigned int ao_range[MAX_AO_CHANNELS]; // current range settings for output channels - u16 eeprom_data[EEPROM_SIZE]; // software copy of board's eeprom + + /* unsigned long control_status; */ + /* unsigned long adc_fifo; */ + + unsigned int dac_cal1_bits; /* bits last written to da calibration register 1 */ + unsigned int ao_range[MAX_AO_CHANNELS]; /* current range settings for output channels */ + u16 eeprom_data[EEPROM_SIZE]; /* software copy of board's eeprom */ }; /* @@ -234,12 +241,14 @@ struct cb_pcidda_private { static int cb_pcidda_attach(struct comedi_device * dev, struct comedi_devconfig * it); static int cb_pcidda_detach(struct comedi_device * dev); -//static int cb_pcidda_ai_rinsn(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data); +/* static int cb_pcidda_ai_rinsn(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data); */ static int cb_pcidda_ao_winsn(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data); -//static int cb_pcidda_ai_cmd(struct comedi_device *dev,struct comedi_subdevice *s); -//static int cb_pcidda_ai_cmdtest(struct comedi_device *dev,struct comedi_subdevice *s, struct comedi_cmd *cmd); -//static int cb_pcidda_ns_to_timer(unsigned int *ns,int round); + +/* static int cb_pcidda_ai_cmd(struct comedi_device *dev, struct *comedi_subdevice *s);*/ +/* static int cb_pcidda_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd); */ +/* static int cb_pcidda_ns_to_timer(unsigned int *ns,int *round); */ + static unsigned int cb_pcidda_serial_in(struct comedi_device * dev); static void cb_pcidda_serial_out(struct comedi_device * dev, unsigned int value, unsigned int num_bits); @@ -310,7 +319,7 @@ static int cb_pcidda_attach(struct comedi_device * dev, struct comedi_devconfig found: devpriv->pci_dev = pcidev; dev->board_ptr = cb_pcidda_boards + index; - // "thisboard" macro can be used from here. + /* "thisboard" macro can be used from here. */ printk("Found %s at requested position\n", thisboard->name); /* @@ -353,11 +362,12 @@ static int cb_pcidda_attach(struct comedi_device * dev, struct comedi_devconfig s->maxdata = (1 << thisboard->ao_bits) - 1; s->range_table = thisboard->ranges; s->insn_write = cb_pcidda_ao_winsn; -// s->subdev_flags |= SDF_CMD_READ; -// s->do_cmd = cb_pcidda_ai_cmd; -// s->do_cmdtest = cb_pcidda_ai_cmdtest; - // two 8255 digital io subdevices + /* s->subdev_flags |= SDF_CMD_READ; */ + /* s->do_cmd = cb_pcidda_ai_cmd; */ + /* s->do_cmdtest = cb_pcidda_ai_cmdtest; */ + + /* two 8255 digital io subdevices */ s = dev->subdevices + 1; subdev_8255_init(dev, s, NULL, devpriv->digitalio); s = dev->subdevices + 2; @@ -370,7 +380,7 @@ static int cb_pcidda_attach(struct comedi_device * dev, struct comedi_devconfig } printk("\n"); - // set calibrations dacs + /* set calibrations dacs */ for (index = 0; index < thisboard->ao_chans; index++) cb_pcidda_calibrate(dev, index, devpriv->ao_range[index]); @@ -398,7 +408,7 @@ static int cb_pcidda_detach(struct comedi_device * dev) pci_dev_put(devpriv->pci_dev); } } - // cleanup 8255 + /* cleanup 8255 */ if (dev->subdevices) { subdev_8255_cleanup(dev, dev->subdevices + 1); subdev_8255_cleanup(dev, dev->subdevices + 2); @@ -607,7 +617,7 @@ static int cb_pcidda_ao_winsn(struct comedi_device * dev, struct comedi_subdevic channel = CR_CHAN(insn->chanspec); range = CR_RANGE(insn->chanspec); - // adjust calibration dacs if range has changed + /* adjust calibration dacs if range has changed */ if (range != devpriv->ao_range[channel]) cb_pcidda_calibrate(dev, channel, range); @@ -647,15 +657,15 @@ static int cb_pcidda_ao_winsn(struct comedi_device * dev, struct comedi_subdevic return 1; } -// lowlevel read from eeprom +/* lowlevel read from eeprom */ static unsigned int cb_pcidda_serial_in(struct comedi_device * dev) { unsigned int value = 0; int i; - const int value_width = 16; // number of bits wide values are + const int value_width = 16; /* number of bits wide values are */ for (i = 1; i <= value_width; i++) { - // read bits most significant bit first + /* read bits most significant bit first */ if (inw_p(devpriv->dac + DACALIBRATION1) & SERIAL_OUT_BIT) { value |= 1 << (value_width - i); } @@ -664,14 +674,14 @@ static unsigned int cb_pcidda_serial_in(struct comedi_device * dev) return value; } -// lowlevel write to eeprom/dac +/* lowlevel write to eeprom/dac */ static void cb_pcidda_serial_out(struct comedi_device * dev, unsigned int value, unsigned int num_bits) { int i; for (i = 1; i <= num_bits; i++) { - // send bits most significant bit first + /* send bits most significant bit first */ if (value & (1 << (num_bits - i))) devpriv->dac_cal1_bits |= SERIAL_IN_BIT; else @@ -680,136 +690,137 @@ static void cb_pcidda_serial_out(struct comedi_device * dev, unsigned int value, } } -// reads a 16 bit value from board's eeprom +/* reads a 16 bit value from board's eeprom */ static unsigned int cb_pcidda_read_eeprom(struct comedi_device * dev, unsigned int address) { unsigned int i; unsigned int cal2_bits; unsigned int value; - const int max_num_caldacs = 4; // one caldac for every two dac channels - const int read_instruction = 0x6; // bits to send to tell eeprom we want to read + const int max_num_caldacs = 4; /* one caldac for every two dac channels */ + const int read_instruction = 0x6; /* bits to send to tell eeprom we want to read */ const int instruction_length = 3; const int address_length = 8; - // send serial output stream to eeprom + /* send serial output stream to eeprom */ cal2_bits = SELECT_EEPROM_BIT | DESELECT_REF_DAC_BIT | DUMMY_BIT; - // deactivate caldacs (one caldac for every two channels) + /* deactivate caldacs (one caldac for every two channels) */ for (i = 0; i < max_num_caldacs; i++) { cal2_bits |= DESELECT_CALDAC_BIT(i); } outw_p(cal2_bits, devpriv->dac + DACALIBRATION2); - // tell eeprom we want to read + /* tell eeprom we want to read */ cb_pcidda_serial_out(dev, read_instruction, instruction_length); - // send address we want to read from + /* send address we want to read from */ cb_pcidda_serial_out(dev, address, address_length); value = cb_pcidda_serial_in(dev); - // deactivate eeprom + /* deactivate eeprom */ cal2_bits &= ~SELECT_EEPROM_BIT; outw_p(cal2_bits, devpriv->dac + DACALIBRATION2); return value; } -// writes to 8 bit calibration dacs +/* writes to 8 bit calibration dacs */ static void cb_pcidda_write_caldac(struct comedi_device * dev, unsigned int caldac, unsigned int channel, unsigned int value) { unsigned int cal2_bits; unsigned int i; - const int num_channel_bits = 3; // caldacs use 3 bit channel specification - const int num_caldac_bits = 8; // 8 bit calibration dacs - const int max_num_caldacs = 4; // one caldac for every two dac channels + const int num_channel_bits = 3; /* caldacs use 3 bit channel specification */ + const int num_caldac_bits = 8; /* 8 bit calibration dacs */ + const int max_num_caldacs = 4; /* one caldac for every two dac channels */ /* write 3 bit channel */ cb_pcidda_serial_out(dev, channel, num_channel_bits); - // write 8 bit caldac value + /* write 8 bit caldac value */ cb_pcidda_serial_out(dev, value, num_caldac_bits); - // latch stream into appropriate caldac - // deselect reference dac +/* +* latch stream into appropriate caldac deselect reference dac +*/ cal2_bits = DESELECT_REF_DAC_BIT | DUMMY_BIT; - // deactivate caldacs (one caldac for every two channels) + /* deactivate caldacs (one caldac for every two channels) */ for (i = 0; i < max_num_caldacs; i++) { cal2_bits |= DESELECT_CALDAC_BIT(i); } - // activate the caldac we want + /* activate the caldac we want */ cal2_bits &= ~DESELECT_CALDAC_BIT(caldac); outw_p(cal2_bits, devpriv->dac + DACALIBRATION2); - // deactivate caldac + /* deactivate caldac */ cal2_bits |= DESELECT_CALDAC_BIT(caldac); outw_p(cal2_bits, devpriv->dac + DACALIBRATION2); } -// returns caldac that calibrates given analog out channel +/* returns caldac that calibrates given analog out channel */ static unsigned int caldac_number(unsigned int channel) { return channel / 2; } -// returns caldac channel that provides fine gain for given ao channel +/* returns caldac channel that provides fine gain for given ao channel */ static unsigned int fine_gain_channel(unsigned int ao_channel) { return 4 * (ao_channel % 2); } -// returns caldac channel that provides coarse gain for given ao channel +/* returns caldac channel that provides coarse gain for given ao channel */ static unsigned int coarse_gain_channel(unsigned int ao_channel) { return 1 + 4 * (ao_channel % 2); } -// returns caldac channel that provides coarse offset for given ao channel +/* returns caldac channel that provides coarse offset for given ao channel */ static unsigned int coarse_offset_channel(unsigned int ao_channel) { return 2 + 4 * (ao_channel % 2); } -// returns caldac channel that provides fine offset for given ao channel +/* returns caldac channel that provides fine offset for given ao channel */ static unsigned int fine_offset_channel(unsigned int ao_channel) { return 3 + 4 * (ao_channel % 2); } -// returns eeprom address that provides offset for given ao channel and range +/* returns eeprom address that provides offset for given ao channel and range */ static unsigned int offset_eeprom_address(unsigned int ao_channel, unsigned int range) { return 0x7 + 2 * range + 12 * ao_channel; } -// returns eeprom address that provides gain calibration for given ao channel and range +/* returns eeprom address that provides gain calibration for given ao channel and range */ static unsigned int gain_eeprom_address(unsigned int ao_channel, unsigned int range) { return 0x8 + 2 * range + 12 * ao_channel; } -// returns upper byte of eeprom entry, which gives the coarse adjustment values +/* returns upper byte of eeprom entry, which gives the coarse adjustment values */ static unsigned int eeprom_coarse_byte(unsigned int word) { return (word >> 8) & 0xff; } -// returns lower byte of eeprom entry, which gives the fine adjustment values +/* returns lower byte of eeprom entry, which gives the fine adjustment values */ static unsigned int eeprom_fine_byte(unsigned int word) { return word & 0xff; } -// set caldacs to eeprom values for given channel and range +/* set caldacs to eeprom values for given channel and range */ static void cb_pcidda_calibrate(struct comedi_device * dev, unsigned int channel, unsigned int range) { unsigned int coarse_offset, fine_offset, coarse_gain, fine_gain; - // remember range so we can tell when we need to readjust calibration + /* remember range so we can tell when we need to readjust calibration */ devpriv->ao_range[channel] = range; - // get values from eeprom data + /* get values from eeprom data */ coarse_offset = eeprom_coarse_byte(devpriv-> eeprom_data[offset_eeprom_address(channel, range)]); @@ -823,7 +834,7 @@ static void cb_pcidda_calibrate(struct comedi_device * dev, unsigned int channel eeprom_fine_byte(devpriv-> eeprom_data[gain_eeprom_address(channel, range)]); - // set caldacs + /* set caldacs */ cb_pcidda_write_caldac(dev, caldac_number(channel), coarse_offset_channel(channel), coarse_offset); cb_pcidda_write_caldac(dev, caldac_number(channel), diff --git a/drivers/staging/comedi/drivers/cb_pcidio.c b/drivers/staging/comedi/drivers/cb_pcidio.c index 71a4b1482e36..eeda0b3dc5b1 100644 --- a/drivers/staging/comedi/drivers/cb_pcidio.c +++ b/drivers/staging/comedi/drivers/cb_pcidio.c @@ -53,10 +53,10 @@ Passing a zero for an option is the same as leaving it unspecified. * Some drivers use arrays such as this, other do not. */ struct pcidio_board { - const char *name; // anme of the board - int n_8255; // number of 8255 chips on board + const char *name; /* anme of the board */ + int n_8255; /* number of 8255 chips on board */ - // indices of base address regions + /* indices of base address regions */ int pcicontroler_badrindex; int dioregs_badrindex; }; @@ -104,7 +104,7 @@ MODULE_DEVICE_TABLE(pci, pcidio_pci_table); several hardware drivers keep similar information in this structure, feel free to suggest moving the variable to the struct comedi_device struct. */ struct pcidio_private { - int data; // curently unused + int data; /* curently unused */ /* would be useful for a PCI device */ struct pci_dev *pci_dev; @@ -112,7 +112,7 @@ struct pcidio_private { /* used for DO readback, curently unused */ unsigned int do_readback[4]; /* up to 4 unsigned int suffice to hold 96 bits for PCI-DIO96 */ - unsigned long dio_reg_base; // address of port A of the first 8255 chip on board + unsigned long dio_reg_base; /* address of port A of the first 8255 chip on board */ }; /* @@ -134,8 +134,10 @@ static struct comedi_driver driver_cb_pcidio = { module:THIS_MODULE, attach:pcidio_attach, detach:pcidio_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 pcidio_boards[] above. Note that the element 'name' @@ -152,10 +154,15 @@ static struct comedi_driver driver_cb_pcidio = { * the type of board in software. ISA PnP, PCI, and PCMCIA * devices are such boards. */ -// The following fields should NOT be initialized if you are dealing with PCI devices -// board_name: pcidio_boards, -// offset: sizeof(struct pcidio_board), -// num_names: sizeof(pcidio_boards) / sizeof(struct pcidio_board), + +/* The following fields should NOT be initialized if you are dealing + * with PCI devices + * + * board_name: pcidio_boards, + * offset: sizeof(struct pcidio_board), + * num_names: sizeof(pcidio_boards) / sizeof(structpcidio_board), + */ + }; /*------------------------------- FUNCTIONS -----------------------------------*/ @@ -192,19 +199,19 @@ static int pcidio_attach(struct comedi_device * dev, struct comedi_devconfig * i 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? + /* is it not a computer boards card? */ if (pcidev->vendor != PCI_VENDOR_ID_CB) continue; - // loop through cards supported by this driver + /* loop through cards supported by this driver */ for (index = 0; index < sizeof pcidio_boards / sizeof(struct pcidio_board); index++) { if (pcidio_pci_table[index].device != pcidev->device) continue; - // was a particular bus/slot requested? + /* was a particular bus/slot requested? */ if (it->options[0] || it->options[1]) { - // are we on the wrong bus/slot? + /* are we on the wrong bus/slot? */ if (pcidev->bus->number != it->options[0] || PCI_SLOT(pcidev->devfn) != it->options[1]) { diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index af705fa092c0..49d32fb4a4b4 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -48,24 +48,24 @@ See http://www.measurementcomputing.com/PDFManuals/pcim-das1602_16.pdf for more #include "plx9052.h" #include "8255.h" -//#define CBPCIMDAS_DEBUG +/* #define CBPCIMDAS_DEBUG */ #undef CBPCIMDAS_DEBUG /* Registers for the PCIM-DAS1602/16 */ -// sizes of io regions (bytes) -#define BADR0_SIZE 2 //?? +/* sizes of io regions (bytes) */ +#define BADR0_SIZE 2 /* ?? */ #define BADR1_SIZE 4 #define BADR2_SIZE 6 #define BADR3_SIZE 16 #define BADR4_SIZE 4 -//DAC Offsets +/* DAC Offsets */ #define ADC_TRIG 0 #define DAC0_OFFSET 2 #define DAC1_OFFSET 4 -//AI and Counter Constants +/* AI and Counter Constants */ #define MUX_LIMITS 0 #define MAIN_CONN_DIO 1 #define ADC_STAT 2 @@ -86,17 +86,17 @@ See http://www.measurementcomputing.com/PDFManuals/pcim-das1602_16.pdf for more struct cb_pcimdas_board { const char *name; unsigned short device_id; - int ai_se_chans; // Inputs in single-ended mode - int ai_diff_chans; // Inputs in differential mode - int ai_bits; // analog input resolution - int ai_speed; // fastest conversion period in ns - int ao_nchan; // number of analog out channels - int ao_bits; // analogue output resolution - int has_ao_fifo; // analog output has fifo - int ao_scan_speed; // analog output speed for 1602 series (for a scan, not conversion) - int fifo_size; // number of samples fifo can hold - int dio_bits; // number of dio bits - int has_dio; // has DIO + int ai_se_chans; /* Inputs in single-ended mode */ + int ai_diff_chans; /* Inputs in differential mode */ + int ai_bits; /* analog input resolution */ + int ai_speed; /* fastest conversion period in ns */ + int ao_nchan; /* number of analog out channels */ + int ao_bits; /* analogue output resolution */ + int has_ao_fifo; /* analog output has fifo */ + int ao_scan_speed; /* analog output speed for 1602 series (for a scan, not conversion) */ + int fifo_size; /* number of samples fifo can hold */ + int dio_bits; /* number of dio bits */ + int has_dio; /* has DIO */ const struct comedi_lrange *ranges; }; @@ -107,16 +107,16 @@ static const struct cb_pcimdas_board cb_pcimdas_boards[] = { ai_se_chans:16, ai_diff_chans:8, ai_bits: 16, - ai_speed:10000, //?? + ai_speed:10000, /* ?? */ ao_nchan:2, ao_bits: 12, - has_ao_fifo:0, //?? + has_ao_fifo:0, /* ?? */ ao_scan_speed:10000, - //?? + /* ?? */ fifo_size:1024, dio_bits:24, has_dio: 1, -// ranges: &cb_pcimdas_ranges, +/* ranges: &cb_pcimdas_ranges, */ }, }; @@ -129,7 +129,7 @@ static DEFINE_PCI_DEVICE_TABLE(cb_pcimdas_pci_table) = { MODULE_DEVICE_TABLE(pci, cb_pcimdas_pci_table); -#define N_BOARDS 1 // Max number of boards supported +#define N_BOARDS 1 /* Max number of boards supported */ /* * Useful for shorthand access to the particular board structure @@ -142,10 +142,10 @@ MODULE_DEVICE_TABLE(pci, cb_pcimdas_pci_table); struct cb_pcimdas_private { int data; - // would be useful for a PCI device + /* would be useful for a PCI device */ struct pci_dev *pci_dev; - //base addresses + /* base addresses */ unsigned long BADR0; unsigned long BADR1; unsigned long BADR2; @@ -155,11 +155,11 @@ struct cb_pcimdas_private { /* Used for AO readback */ unsigned int ao_readback[2]; - // Used for DIO - unsigned short int port_a; // copy of BADR4+0 - unsigned short int port_b; // copy of BADR4+1 - unsigned short int port_c; // copy of BADR4+2 - unsigned short int dio_mode; // copy of BADR4+3 + /* Used for DIO */ + unsigned short int port_a; /* copy of BADR4+0 */ + unsigned short int port_b; /* copy of BADR4+1 */ + unsigned short int port_c; /* copy of BADR4+2 */ + unsigned short int dio_mode; /* copy of BADR4+3 */ }; @@ -202,7 +202,7 @@ static int cb_pcimdas_attach(struct comedi_device * dev, struct comedi_devconfig struct comedi_subdevice *s; struct pci_dev *pcidev; int index; - //int i; + /* int i; */ printk("comedi%d: cb_pcimdas: ", dev->minor); @@ -220,17 +220,17 @@ static int cb_pcimdas_attach(struct comedi_device * dev, struct comedi_devconfig 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? + /* is it not a computer boards card? */ if (pcidev->vendor != PCI_VENDOR_ID_COMPUTERBOARDS) continue; - // loop through cards supported by this driver + /* loop through cards supported by this driver */ for (index = 0; index < N_BOARDS; index++) { if (cb_pcimdas_boards[index].device_id != pcidev->device) continue; - // was a particular bus/slot requested? + /* was a particular bus/slot requested? */ if (it->options[0] || it->options[1]) { - // are we on the wrong bus/slot? + /* are we on the wrong bus/slot? */ if (pcidev->bus->number != it->options[0] || PCI_SLOT(pcidev->devfn) != it->options[1]) { @@ -252,7 +252,7 @@ static int cb_pcimdas_attach(struct comedi_device * dev, struct comedi_devconfig printk("Found %s on bus %i, slot %i\n", cb_pcimdas_boards[index].name, pcidev->bus->number, PCI_SLOT(pcidev->devfn)); - // Warn about non-tested features + /* Warn about non-tested features */ switch (thisboard->device_id) { case 0x56: break; @@ -280,16 +280,16 @@ static int cb_pcimdas_attach(struct comedi_device * dev, struct comedi_devconfig printk("devpriv->BADR4 = 0x%lx\n", devpriv->BADR4); #endif -// Dont support IRQ yet -// // get irq -// if(comedi_request_irq(devpriv->pci_dev->irq, cb_pcimdas_interrupt, IRQF_SHARED, "cb_pcimdas", dev )) -// { -// printk(" unable to allocate irq %u\n", devpriv->pci_dev->irq); -// return -EINVAL; -// } -// dev->irq = devpriv->pci_dev->irq; +/* Dont support IRQ yet */ +/* get irq */ +/* if(comedi_request_irq(devpriv->pci_dev->irq, cb_pcimdas_interrupt, IRQF_SHARED, "cb_pcimdas", dev )) */ +/* { */ +/* printk(" unable to allocate irq %u\n", devpriv->pci_dev->irq); */ +/* return -EINVAL; */ +/* } */ +/* dev->irq = devpriv->pci_dev->irq; */ - //Initialize dev->board_name + /* Initialize dev->board_name */ dev->board_name = thisboard->name; /* @@ -300,24 +300,24 @@ static int cb_pcimdas_attach(struct comedi_device * dev, struct comedi_devconfig return -ENOMEM; s = dev->subdevices + 0; - //dev->read_subdev=s; - // analog input subdevice + /* dev->read_subdev=s; */ + /* analog input subdevice */ s->type = COMEDI_SUBD_AI; s->subdev_flags = SDF_READABLE | SDF_GROUND; s->n_chan = thisboard->ai_se_chans; s->maxdata = (1 << thisboard->ai_bits) - 1; s->range_table = &range_unknown; - s->len_chanlist = 1; // This is the maximum chanlist length that - // the board can handle + s->len_chanlist = 1; /* This is the maximum chanlist length that */ + /* the board can handle */ s->insn_read = cb_pcimdas_ai_rinsn; s = dev->subdevices + 1; - // analog output subdevice + /* analog output subdevice */ s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_WRITABLE; s->n_chan = thisboard->ao_nchan; s->maxdata = 1 << thisboard->ao_bits; - s->range_table = &range_unknown; //ranges are hardware settable, but not software readable. + s->range_table = &range_unknown; /* ranges are hardware settable, but not software readable. */ s->insn_write = &cb_pcimdas_ao_winsn; s->insn_read = &cb_pcimdas_ao_rinsn; @@ -382,27 +382,27 @@ static int cb_pcimdas_ai_rinsn(struct comedi_device * dev, struct comedi_subdevi unsigned short chanlims; int maxchans; - // only support sw initiated reads from a single channel + /* only support sw initiated reads from a single channel */ - //check channel number - if ((inb(devpriv->BADR3 + 2) & 0x20) == 0) //differential mode + /* check channel number */ + if ((inb(devpriv->BADR3 + 2) & 0x20) == 0) /* differential mode */ maxchans = thisboard->ai_diff_chans; else maxchans = thisboard->ai_se_chans; if (chan > (maxchans - 1)) - return -ETIMEDOUT; //*** Wrong error code. Fixme. + return -ETIMEDOUT; /* *** Wrong error code. Fixme. */ - //configure for sw initiated read + /* configure for sw initiated read */ d = inb(devpriv->BADR3 + 5); - if ((d & 0x03) > 0) { //only reset if needed. + if ((d & 0x03) > 0) { /* only reset if needed. */ d = d & 0xfd; outb(d, devpriv->BADR3 + 5); } - outb(0x01, devpriv->BADR3 + 6); //set bursting off, conversions on - outb(0x00, devpriv->BADR3 + 7); //set range to 10V. UP/BP is controlled by a switch on the board + outb(0x01, devpriv->BADR3 + 6); /* set bursting off, conversions on */ + outb(0x00, devpriv->BADR3 + 7); /* set range to 10V. UP/BP is controlled by a switch on the board */ - // write channel limits to multiplexer, set Low (bits 0-3) and High (bits 4-7) channels to chan. + /* write channel limits to multiplexer, set Low (bits 0-3) and High (bits 4-7) channels to chan. */ chanlims = chan | (chan << 4); outb(chanlims, devpriv->BADR3 + 0); @@ -411,8 +411,8 @@ static int cb_pcimdas_ai_rinsn(struct comedi_device * dev, struct comedi_subdevi /* trigger conversion */ outw(0, devpriv->BADR2 + 0); -#define TIMEOUT 1000 //typically takes 5 loops on a lightly loaded Pentium 100MHz, - //this is likely to be 100 loops on a 2GHz machine, so set 1000 as the limit. +#define TIMEOUT 1000 /* typically takes 5 loops on a lightly loaded Pentium 100MHz, */ + /* this is likely to be 100 loops on a 2GHz machine, so set 1000 as the limit. */ /* wait for conversion to end */ for (i = 0; i < TIMEOUT; i++) { @@ -428,7 +428,7 @@ static int cb_pcimdas_ai_rinsn(struct comedi_device * dev, struct comedi_subdevi d = inw(devpriv->BADR2 + 0); /* mangle the data as necessary */ - //d ^= 1<<(thisboard->ai_bits-1); // 16 bit data from ADC, so no mangle needed. + /* d ^= 1<<(thisboard->ai_bits-1); // 16 bit data from ADC, so no mangle needed. */ data[n] = d; } diff --git a/drivers/staging/comedi/drivers/cb_pcimdda.c b/drivers/staging/comedi/drivers/cb_pcimdda.c index e4c5b460fbd5..4e6002c8dfb6 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdda.c +++ b/drivers/staging/comedi/drivers/cb_pcimdda.c @@ -434,16 +434,16 @@ static int probe(struct comedi_device * dev, const struct comedi_devconfig * it) 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? + /* is it not a computer boards card? */ if (pcidev->vendor != PCI_VENDOR_ID_COMPUTERBOARDS) continue; - // loop through cards supported by this driver + /* loop through cards supported by this driver */ for (index = 0; index < N_BOARDS; index++) { if (boards[index].device_id != pcidev->device) continue; - // was a particular bus/slot requested? + /* was a particular bus/slot requested? */ if (it->options[0] || it->options[1]) { - // are we on the wrong bus/slot? + /* are we on the wrong bus/slot? */ if (pcidev->bus->number != it->options[0] || PCI_SLOT(pcidev->devfn) != it->options[1]) { diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index a23339155ffc..3848fd475583 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -82,6 +82,7 @@ pin, which can be used to wake up tasks. */ #include "../comedidev.h" +#include <linux/interrupt.h> #include <linux/ioport.h> #define PARPORT_SIZE 3 @@ -274,7 +275,7 @@ static int parport_intr_cancel(struct comedi_device *dev, struct comedi_subdevic return 0; } -static irqreturn_t parport_interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t parport_interrupt(int irq, void *d) { struct comedi_device *dev = d; struct comedi_subdevice *s = dev->subdevices + 3; diff --git a/drivers/staging/comedi/drivers/comedi_rt_timer.c b/drivers/staging/comedi/drivers/comedi_rt_timer.c index f40c8cffd4bb..c19ca8d3fb9e 100644 --- a/drivers/staging/comedi/drivers/comedi_rt_timer.c +++ b/drivers/staging/comedi/drivers/comedi_rt_timer.c @@ -73,9 +73,9 @@ TODO: #define RTLINUX_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) #endif -// begin hack to workaround broken HRT_TO_8254() function on rtlinux +/* begin hack to workaround broken HRT_TO_8254() function on rtlinux */ #if RTLINUX_VERSION_CODE <= RTLINUX_VERSION(3,0,100) -// this function sole purpose is to divide a long long by 838 +/* this function sole purpose is to divide a long long by 838 */ static inline RTIME nano2count(long long ns) { do_div(ns, 838); @@ -91,9 +91,9 @@ static inline RTIME nano2count(long long ns) #define nano2count(x) HRT_TO_8254(x) #endif -// end hack +/* end hack */ -// rtl-rtai compatibility +/* rtl-rtai compatibility */ #define rt_task_wait_period() rt_task_wait() #define rt_pend_linux_srq(irq) rtl_global_pend_irq(irq) #define rt_free_srq(irq) rtl_free_soft_irq(irq) @@ -104,10 +104,27 @@ static inline RTIME nano2count(long long ns) #define start_rt_timer(x) #define stop_rt_timer() +#define comedi_rt_task_context_t int + #endif #ifdef CONFIG_COMEDI_RTAI #include <rtai.h> #include <rtai_sched.h> +#include <rtai_version.h> + +/* RTAI_VERSION_CODE doesn't work for rtai-3.6-cv and other strange versions. + * These are characterized by CONFIG_RTAI_REVISION_LEVEL being defined as an + * empty macro and CONFIG_RTAI_VERSION_MINOR being defined as something like + * '6-cv' or '7-test1'. The problem has been noted by the RTAI folks and they + * promise not to do it again. :-) Try and work around it here. */ +#if !(CONFIG_RTAI_REVISION_LEVEL + 0) +#undef CONFIG_RTAI_REVISION_LEVEL +#define CONFIG_RTAI_REVISION_LEVEL 0 +#define cv 0 +#define test1 0 +#define test2 0 +#define test3 0 +#endif #if RTAI_VERSION_CODE < RTAI_MANGLE_VERSION(3,3,0) #define comedi_rt_task_context_t int @@ -115,6 +132,12 @@ static inline RTIME nano2count(long long ns) #define comedi_rt_task_context_t long #endif +/* Finished checking RTAI_VERSION_CODE. */ +#undef cv +#undef test1 +#undef test2 +#undef test3 + #endif /* This defines the fastest speed we will emulate. Note that @@ -133,31 +156,33 @@ static struct comedi_driver driver_timer = { driver_name:"comedi_rt_timer", attach:timer_attach, detach:timer_detach, -// open: timer_open, +/* open: timer_open, */ }; COMEDI_INITCLEANUP(driver_timer); struct timer_private { - comedi_t *device; // device we are emulating commands for - int subd; // subdevice we are emulating commands for - RT_TASK *rt_task; // rt task that starts scans - RT_TASK *scan_task; // rt task that controls conversion timing in a scan + comedi_t *device; /* device we are emulating commands for */ + int subd; /* subdevice we are emulating commands for */ + RT_TASK *rt_task; /* rt task that starts scans */ + RT_TASK *scan_task; /* rt task that controls conversion timing in a scan */ /* io_function can point to either an input or output function * depending on what kind of subdevice we are emulating for */ int (*io_function) (struct comedi_device * dev, struct comedi_cmd * cmd, unsigned int index); - // RTIME has units of 1 = 838 nanoseconds - // time at which first scan started, used to check scan timing +/* +* RTIME has units of 1 = 838 nanoseconds time at which first scan +* started, used to check scan timing +*/ RTIME start; - // time between scans + /* time between scans */ RTIME scan_period; - // time between conversions in a scan + /* time between conversions in a scan */ RTIME convert_period; - // flags - volatile int stop; // indicates we should stop - volatile int rt_task_active; // indicates rt_task is servicing a struct comedi_cmd - volatile int scan_task_active; // indicates scan_task is servicing a struct comedi_cmd + /* flags */ + volatile int stop; /* indicates we should stop */ + volatile int rt_task_active; /* indicates rt_task is servicing a struct comedi_cmd */ + volatile int scan_task_active; /* indicates scan_task is servicing a struct comedi_cmd */ unsigned timer_running:1; }; #define devpriv ((struct timer_private *)dev->private) @@ -169,7 +194,7 @@ static int timer_cancel(struct comedi_device * dev, struct comedi_subdevice * s) return 0; } -// checks for scan timing error +/* checks for scan timing error */ inline static int check_scan_timing(struct comedi_device * dev, unsigned long long scan) { @@ -186,7 +211,7 @@ inline static int check_scan_timing(struct comedi_device * dev, return 0; } -// checks for conversion timing error +/* checks for conversion timing error */ inline static int check_conversion_timing(struct comedi_device * dev, RTIME scan_start, unsigned int conversion) { @@ -205,7 +230,7 @@ inline static int check_conversion_timing(struct comedi_device * dev, return 0; } -// devpriv->io_function for an input subdevice +/* devpriv->io_function for an input subdevice */ static int timer_data_read(struct comedi_device * dev, struct comedi_cmd * cmd, unsigned int index) { @@ -230,7 +255,7 @@ static int timer_data_read(struct comedi_device * dev, struct comedi_cmd * cmd, return 0; } -// devpriv->io_function for an output subdevice +/* devpriv->io_function for an output subdevice */ static int timer_data_write(struct comedi_device * dev, struct comedi_cmd * cmd, unsigned int index) { @@ -265,7 +290,7 @@ static int timer_data_write(struct comedi_device * dev, struct comedi_cmd * cmd, return 0; } -// devpriv->io_function for DIO subdevices +/* devpriv->io_function for DIO subdevices */ static int timer_dio_read(struct comedi_device * dev, struct comedi_cmd * cmd, unsigned int index) { @@ -287,7 +312,7 @@ static int timer_dio_read(struct comedi_device * dev, struct comedi_cmd * cmd, return 0; } -// performs scans +/* performs scans */ static void scan_task_func(comedi_rt_task_context_t d) { struct comedi_device *dev = (struct comedi_device *) d; @@ -298,14 +323,14 @@ static void scan_task_func(comedi_rt_task_context_t d) unsigned long long n; RTIME scan_start; - // every struct comedi_cmd causes one execution of while loop + /* every struct comedi_cmd causes one execution of while loop */ while (1) { devpriv->scan_task_active = 1; - // each for loop completes one scan + /* each for loop completes one scan */ for (n = 0; n < cmd->stop_arg || cmd->stop_src == TRIG_NONE; n++) { if (n) { - // suspend task until next scan + /* suspend task until next scan */ ret = rt_task_suspend(devpriv->scan_task); if (ret < 0) { comedi_error(dev, @@ -314,7 +339,7 @@ static void scan_task_func(comedi_rt_task_context_t d) goto cleanup; } } - // check if stop flag was set (by timer_cancel()) + /* check if stop flag was set (by timer_cancel()) */ if (devpriv->stop) goto cleanup; ret = check_scan_timing(dev, n); @@ -324,7 +349,7 @@ static void scan_task_func(comedi_rt_task_context_t d) } scan_start = rt_get_time(); for (i = 0; i < cmd->scan_end_arg; i++) { - // conversion timing + /* conversion timing */ if (cmd->convert_src == TRIG_TIMER && i) { rt_task_wait_period(); ret = check_conversion_timing(dev, @@ -353,7 +378,7 @@ static void scan_task_func(comedi_rt_task_context_t d) comedi_event(dev, s); async->events = 0; devpriv->scan_task_active = 0; - // suspend task until next struct comedi_cmd + /* suspend task until next struct comedi_cmd */ rt_task_suspend(devpriv->scan_task); } } @@ -366,7 +391,7 @@ static void timer_task_func(comedi_rt_task_context_t d) int ret; unsigned long long n; - // every struct comedi_cmd causes one execution of while loop + /* every struct comedi_cmd causes one execution of while loop */ while (1) { devpriv->rt_task_active = 1; devpriv->scan_task_active = 1; @@ -374,7 +399,7 @@ static void timer_task_func(comedi_rt_task_context_t d) for (n = 0; n < cmd->stop_arg || cmd->stop_src == TRIG_NONE; n++) { - // scan timing + /* scan timing */ if (n) rt_task_wait_period(); if (devpriv->scan_task_active == 0) { @@ -391,7 +416,7 @@ static void timer_task_func(comedi_rt_task_context_t d) cleanup: devpriv->rt_task_active = 0; - // suspend until next struct comedi_cmd + /* suspend until next struct comedi_cmd */ rt_task_suspend(devpriv->rt_task); } } @@ -485,7 +510,7 @@ static int timer_cmdtest(struct comedi_device * dev, struct comedi_subdevice * s return 2; /* step 3: make sure arguments are trivially compatible */ - // limit frequency, this is fairly arbitrary + /* limit frequency, this is fairly arbitrary */ if (cmd->scan_begin_src == TRIG_TIMER) { if (cmd->scan_begin_arg < SPEED_LIMIT) { cmd->scan_begin_arg = SPEED_LIMIT; @@ -498,7 +523,7 @@ static int timer_cmdtest(struct comedi_device * dev, struct comedi_subdevice * s err++; } } - // make sure conversion and scan frequencies are compatible + /* make sure conversion and scan frequencies are compatible */ if (cmd->convert_src == TRIG_TIMER && cmd->scan_begin_src == TRIG_TIMER) { if (cmd->convert_arg * cmd->scan_end_arg > cmd->scan_begin_arg) { cmd->scan_begin_arg = @@ -524,7 +549,7 @@ static int timer_cmd(struct comedi_device * dev, struct comedi_subdevice * s) /* hack attack: drivers are not supposed to do this: */ dev->rt = 1; - // make sure tasks have finished cleanup of last struct comedi_cmd + /* make sure tasks have finished cleanup of last struct comedi_cmd */ if (devpriv->rt_task_active || devpriv->scan_task_active) return -EBUSY; @@ -636,7 +661,7 @@ static int timer_attach(struct comedi_device * dev, struct comedi_devconfig * it emul_dev = devpriv->device; emul_s = emul_dev->subdevices + devpriv->subd; - // input or output subdevice + /* input or output subdevice */ s = dev->subdevices + 0; s->type = emul_s->type; s->subdev_flags = emul_s->subdev_flags; /* SDF_GROUND (to fool check_driver) */ @@ -681,7 +706,7 @@ static int timer_attach(struct comedi_device * dev, struct comedi_devconfig * it devpriv->rt_task = kzalloc(sizeof(RT_TASK), GFP_KERNEL); - // initialize real-time tasks + /* initialize real-time tasks */ ret = rt_task_init(devpriv->rt_task, timer_task_func, (comedi_rt_task_context_t) dev, 3000, timer_priority, 0, 0); if (ret < 0) { @@ -705,7 +730,7 @@ static int timer_attach(struct comedi_device * dev, struct comedi_devconfig * it return 1; } -// free allocated resources +/* free allocated resources */ static int timer_detach(struct comedi_device * dev) { printk("comedi%d: timer: remove\n", dev->minor); diff --git a/drivers/staging/comedi/drivers/daqboard2000.c b/drivers/staging/comedi/drivers/daqboard2000.c index 3b8444f09f28..4afc88cb7173 100644 --- a/drivers/staging/comedi/drivers/daqboard2000.c +++ b/drivers/staging/comedi/drivers/daqboard2000.c @@ -129,7 +129,7 @@ Configuration options: #define DAQBOARD2000_DAQ_SIZE 0x1002 #define DAQBOARD2000_PLX_SIZE 0x100 -// Initialization bits for the Serial EEPROM Control Register +/* Initialization bits for the Serial EEPROM Control Register */ #define DAQBOARD2000_SECRProgPinHi 0x8001767e #define DAQBOARD2000_SECRProgPinLo 0x8000767e #define DAQBOARD2000_SECRLocalBusHi 0xc000767e @@ -137,14 +137,14 @@ Configuration options: #define DAQBOARD2000_SECRReloadHi 0xa000767e #define DAQBOARD2000_SECRReloadLo 0x8000767e -// SECR status bits +/* SECR status bits */ #define DAQBOARD2000_EEPROM_PRESENT 0x10000000 -// CPLD status bits +/* CPLD status bits */ #define DAQBOARD2000_CPLD_INIT 0x0002 #define DAQBOARD2000_CPLD_DONE 0x0004 -// Available ranges +/* Available ranges */ static const struct comedi_lrange range_daqboard2000_ai = { 13, { RANGE(-10, 10), RANGE(-5, 5), @@ -168,65 +168,65 @@ static const struct comedi_lrange range_daqboard2000_ao = { 1, { }; struct daqboard2000_hw { - volatile u16 acqControl; // 0x00 - volatile u16 acqScanListFIFO; // 0x02 - volatile u32 acqPacerClockDivLow; // 0x04 - - volatile u16 acqScanCounter; // 0x08 - volatile u16 acqPacerClockDivHigh; // 0x0a - volatile u16 acqTriggerCount; // 0x0c - volatile u16 fill2; // 0x0e - volatile u16 acqResultsFIFO; // 0x10 - volatile u16 fill3; // 0x12 - volatile u16 acqResultsShadow; // 0x14 - volatile u16 fill4; // 0x16 - volatile u16 acqAdcResult; // 0x18 - volatile u16 fill5; // 0x1a - volatile u16 dacScanCounter; // 0x1c - volatile u16 fill6; // 0x1e - - volatile u16 dacControl; // 0x20 - volatile u16 fill7; // 0x22 - volatile s16 dacFIFO; // 0x24 - volatile u16 fill8[2]; // 0x26 - volatile u16 dacPacerClockDiv; // 0x2a - volatile u16 refDacs; // 0x2c - volatile u16 fill9; // 0x2e - - volatile u16 dioControl; // 0x30 - volatile s16 dioP3hsioData; // 0x32 - volatile u16 dioP3Control; // 0x34 - volatile u16 calEepromControl; // 0x36 - volatile s16 dacSetting[4]; // 0x38 - volatile s16 dioP2ExpansionIO8Bit[32]; // 0x40 - - volatile u16 ctrTmrControl; // 0x80 - volatile u16 fill10[3]; // 0x82 - volatile s16 ctrInput[4]; // 0x88 - volatile u16 fill11[8]; // 0x90 - volatile u16 timerDivisor[2]; // 0xa0 - volatile u16 fill12[6]; // 0xa4 - - volatile u16 dmaControl; // 0xb0 - volatile u16 trigControl; // 0xb2 - volatile u16 fill13[2]; // 0xb4 - volatile u16 calEeprom; // 0xb8 - volatile u16 acqDigitalMark; // 0xba - volatile u16 trigDacs; // 0xbc - volatile u16 fill14; // 0xbe - volatile s16 dioP2ExpansionIO16Bit[32]; // 0xc0 + volatile u16 acqControl; /* 0x00 */ + volatile u16 acqScanListFIFO; /* 0x02 */ + volatile u32 acqPacerClockDivLow; /* 0x04 */ + + volatile u16 acqScanCounter; /* 0x08 */ + volatile u16 acqPacerClockDivHigh; /* 0x0a */ + volatile u16 acqTriggerCount; /* 0x0c */ + volatile u16 fill2; /* 0x0e */ + volatile u16 acqResultsFIFO; /* 0x10 */ + volatile u16 fill3; /* 0x12 */ + volatile u16 acqResultsShadow; /* 0x14 */ + volatile u16 fill4; /* 0x16 */ + volatile u16 acqAdcResult; /* 0x18 */ + volatile u16 fill5; /* 0x1a */ + volatile u16 dacScanCounter; /* 0x1c */ + volatile u16 fill6; /* 0x1e */ + + volatile u16 dacControl; /* 0x20 */ + volatile u16 fill7; /* 0x22 */ + volatile s16 dacFIFO; /* 0x24 */ + volatile u16 fill8[2]; /* 0x26 */ + volatile u16 dacPacerClockDiv; /* 0x2a */ + volatile u16 refDacs; /* 0x2c */ + volatile u16 fill9; /* 0x2e */ + + volatile u16 dioControl; /* 0x30 */ + volatile s16 dioP3hsioData; /* 0x32 */ + volatile u16 dioP3Control; /* 0x34 */ + volatile u16 calEepromControl; /* 0x36 */ + volatile s16 dacSetting[4]; /* 0x38 */ + volatile s16 dioP2ExpansionIO8Bit[32]; /* 0x40 */ + + volatile u16 ctrTmrControl; /* 0x80 */ + volatile u16 fill10[3]; /* 0x82 */ + volatile s16 ctrInput[4]; /* 0x88 */ + volatile u16 fill11[8]; /* 0x90 */ + volatile u16 timerDivisor[2]; /* 0xa0 */ + volatile u16 fill12[6]; /* 0xa4 */ + + volatile u16 dmaControl; /* 0xb0 */ + volatile u16 trigControl; /* 0xb2 */ + volatile u16 fill13[2]; /* 0xb4 */ + volatile u16 calEeprom; /* 0xb8 */ + volatile u16 acqDigitalMark; /* 0xba */ + volatile u16 trigDacs; /* 0xbc */ + volatile u16 fill14; /* 0xbe */ + volatile s16 dioP2ExpansionIO16Bit[32]; /* 0xc0 */ }; /* Scan Sequencer programming */ #define DAQBOARD2000_SeqStartScanList 0x0011 #define DAQBOARD2000_SeqStopScanList 0x0010 -// Prepare for acquisition +/* Prepare for acquisition */ #define DAQBOARD2000_AcqResetScanListFifo 0x0004 #define DAQBOARD2000_AcqResetResultsFifo 0x0002 #define DAQBOARD2000_AcqResetConfigPipe 0x0001 -// Acqusition status bits +/* Acqusition status bits */ #define DAQBOARD2000_AcqResultsFIFOMore1Sample 0x0001 #define DAQBOARD2000_AcqResultsFIFOHasValidData 0x0002 #define DAQBOARD2000_AcqResultsFIFOOverrun 0x0004 @@ -239,7 +239,7 @@ struct daqboard2000_hw { #define DAQBOARD2000_DacPacerOverrun 0x0200 #define DAQBOARD2000_AcqHardwareError 0x01c0 -// Scan Sequencer programming +/* Scan Sequencer programming */ #define DAQBOARD2000_SeqStartScanList 0x0011 #define DAQBOARD2000_SeqStopScanList 0x0010 @@ -254,7 +254,7 @@ struct daqboard2000_hw { #define DAQBOARD2000_AdcPacerInternalOutEnable 0x0008 #define DAQBOARD2000_AdcPacerExternalRising 0x0100 -// DAC status +/* DAC status */ #define DAQBOARD2000_DacFull 0x0001 #define DAQBOARD2000_RefBusy 0x0002 #define DAQBOARD2000_TrgBusy 0x0004 @@ -264,7 +264,7 @@ struct daqboard2000_hw { #define DAQBOARD2000_Dac2Busy 0x0040 #define DAQBOARD2000_Dac3Busy 0x0080 -// DAC control +/* DAC control */ #define DAQBOARD2000_Dac0Enable 0x0021 #define DAQBOARD2000_Dac1Enable 0x0031 #define DAQBOARD2000_Dac2Enable 0x0041 @@ -292,7 +292,7 @@ struct daqboard2000_hw { #define DAQBOARD2000_TrigEnable 0x0001 #define DAQBOARD2000_TrigDisable 0x0000 -// Reference Dac Selection +/* Reference Dac Selection */ #define DAQBOARD2000_PosRefDacSelect 0x0100 #define DAQBOARD2000_NegRefDacSelect 0x0000 @@ -342,9 +342,9 @@ static void writeAcqScanListEntry(struct comedi_device * dev, u16 entry) { struct daqboard2000_hw *fpga = devpriv->daq; -// comedi_udelay(4); +/* comedi_udelay(4); */ fpga->acqScanListFIFO = entry & 0x00ff; -// comedi_udelay(4); +/* comedi_udelay(4); */ fpga->acqScanListFIFO = (entry >> 8) & 0x00ff; } @@ -425,14 +425,14 @@ static int daqboard2000_ai_insn_read(struct comedi_device * dev, struct comedi_s if (fpga->acqControl & DAQBOARD2000_AcqConfigPipeFull) { break; } - //comedi_udelay(2); + /* comedi_udelay(2); */ } fpga->acqControl = DAQBOARD2000_AdcPacerEnable; for (timeout = 0; timeout < 20; timeout++) { if (fpga->acqControl & DAQBOARD2000_AcqLogicScanning) { break; } - //comedi_udelay(2); + /* comedi_udelay(2); */ } for (timeout = 0; timeout < 20; timeout++) { if (fpga-> @@ -440,7 +440,7 @@ static int daqboard2000_ai_insn_read(struct comedi_device * dev, struct comedi_s DAQBOARD2000_AcqResultsFIFOHasValidData) { break; } - //comedi_udelay(2); + /* comedi_udelay(2); */ } data[i] = fpga->acqResultsFIFO; fpga->acqControl = DAQBOARD2000_AdcPacerDisable; @@ -476,13 +476,13 @@ static int daqboard2000_ao_insn_write(struct comedi_device * dev, struct comedi_ * OK, since it works OK without enabling the DAC's, let's keep * it as simple as possible... */ - //fpga->dacControl = (chan + 2) * 0x0010 | 0x0001; comedi_udelay(1000); + /* fpga->dacControl = (chan + 2) * 0x0010 | 0x0001; comedi_udelay(1000); */ fpga->dacSetting[chan] = data[i]; for (timeout = 0; timeout < 20; timeout++) { if ((fpga->dacControl & ((chan + 1) * 0x0010)) == 0) { break; } - //comedi_udelay(2); + /* comedi_udelay(2); */ } devpriv->ao_readback[chan] = data[i]; /* @@ -645,7 +645,7 @@ static void daqboard2000_activateReferenceDacs(struct comedi_device * dev) struct daqboard2000_hw *fpga = devpriv->daq; int timeout; - // Set the + reference dac value in the FPGA + /* Set the + reference dac value in the FPGA */ fpga->refDacs = 0x80 | DAQBOARD2000_PosRefDacSelect; for (timeout = 0; timeout < 20; timeout++) { if ((fpga->dacControl & DAQBOARD2000_RefBusy) == 0) { @@ -655,7 +655,7 @@ static void daqboard2000_activateReferenceDacs(struct comedi_device * dev) } /* printk("DAQBOARD2000_PosRefDacSelect %d\n", timeout);*/ - // Set the - reference dac value in the FPGA + /* Set the - reference dac value in the FPGA */ fpga->refDacs = 0x80 | DAQBOARD2000_NegRefDacSelect; for (timeout = 0; timeout < 20; timeout++) { if ((fpga->dacControl & DAQBOARD2000_RefBusy) == 0) { diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index e4563331e963..a2e261c96ba5 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -65,12 +65,12 @@ driver. #define PCI_DEVICE_ID_PCIDAS08 0x29 #define PCIDAS08_SIZE 0x54 -// pci configuration registers +/* pci configuration registers */ #define INTCSR 0x4c #define INTR1_ENABLE 0x1 #define INTR1_HIGH_POLARITY 0x2 #define PCI_INTR_ENABLE 0x40 -#define INTR1_EDGE_TRIG 0x100 // requires high polarity +#define INTR1_EDGE_TRIG 0x100 /* requires high polarity */ #define CNTRL 0x50 #define CNTRL_DIR 0x2 #define CNTRL_INTR 0x4 @@ -248,7 +248,7 @@ static const int *const das08_gainlists[] = { static const struct das08_board_struct das08_boards[] = { { - name: "isa-das08", // cio-das08.pdf + name: "isa-das08", /* cio-das08.pdf */ bustype: isa, ai: das08_ai_rinsn, ai_nbits:12, @@ -261,10 +261,10 @@ static const struct das08_board_struct das08_boards[] = { do_nchan:4, i8255_offset:8, i8254_offset:4, - iosize: 16, // unchecked + iosize: 16, /* unchecked */ }, { - name: "das08-pgm", // cio-das08pgx.pdf + name: "das08-pgm", /* cio-das08pgx.pdf */ bustype: isa, ai: das08_ai_rinsn, ai_nbits:12, @@ -276,10 +276,10 @@ static const struct das08_board_struct das08_boards[] = { do_nchan:4, i8255_offset:0, i8254_offset:0x04, - iosize: 16, // unchecked + iosize: 16, /* unchecked */ }, { - name: "das08-pgh", // cio-das08pgx.pdf + name: "das08-pgh", /* cio-das08pgx.pdf */ bustype: isa, ai: das08_ai_rinsn, ai_nbits:12, @@ -291,10 +291,10 @@ static const struct das08_board_struct das08_boards[] = { do_nchan:4, i8255_offset:0, i8254_offset:0x04, - iosize: 16, // unchecked + iosize: 16, /* unchecked */ }, { - name: "das08-pgl", // cio-das08pgx.pdf + name: "das08-pgl", /* cio-das08pgx.pdf */ bustype: isa, ai: das08_ai_rinsn, ai_nbits:12, @@ -306,58 +306,58 @@ static const struct das08_board_struct das08_boards[] = { do_nchan:4, i8255_offset:0, i8254_offset:0x04, - iosize: 16, // unchecked + iosize: 16, /* unchecked */ }, { - name: "das08-aoh", // cio-das08_aox.pdf + name: "das08-aoh", /* cio-das08_aox.pdf */ bustype: isa, ai: das08_ai_rinsn, ai_nbits:12, ai_pg: das08_pgh, ai_encoding:das08_encode12, - ao: das08ao_ao_winsn, // 8 + ao: das08ao_ao_winsn, /* 8 */ ao_nbits:12, di: das08_di_rbits, do_: das08_do_wbits, do_nchan:4, i8255_offset:0x0c, i8254_offset:0x04, - iosize: 16, // unchecked + iosize: 16, /* unchecked */ }, { - name: "das08-aol", // cio-das08_aox.pdf + name: "das08-aol", /* cio-das08_aox.pdf */ bustype: isa, ai: das08_ai_rinsn, ai_nbits:12, ai_pg: das08_pgl, ai_encoding:das08_encode12, - ao: das08ao_ao_winsn, // 8 + ao: das08ao_ao_winsn, /* 8 */ ao_nbits:12, di: das08_di_rbits, do_: das08_do_wbits, do_nchan:4, i8255_offset:0x0c, i8254_offset:0x04, - iosize: 16, // unchecked + iosize: 16, /* unchecked */ }, { - name: "das08-aom", // cio-das08_aox.pdf + name: "das08-aom", /* cio-das08_aox.pdf */ bustype: isa, ai: das08_ai_rinsn, ai_nbits:12, ai_pg: das08_pgm, ai_encoding:das08_encode12, - ao: das08ao_ao_winsn, // 8 + ao: das08ao_ao_winsn, /* 8 */ ao_nbits:12, di: das08_di_rbits, do_: das08_do_wbits, do_nchan:4, i8255_offset:0x0c, i8254_offset:0x04, - iosize: 16, // unchecked + iosize: 16, /* unchecked */ }, { - name: "das08/jr-ao", // cio-das08-jr-ao.pdf + name: "das08/jr-ao", /* cio-das08-jr-ao.pdf */ bustype: isa, ai: das08_ai_rinsn, ai_nbits:12, @@ -370,10 +370,10 @@ static const struct das08_board_struct das08_boards[] = { do_nchan:8, i8255_offset:0, i8254_offset:0, - iosize: 16, // unchecked + iosize: 16, /* unchecked */ }, { - name: "das08jr-16-ao", // cio-das08jr-16-ao.pdf + name: "das08jr-16-ao", /* cio-das08jr-16-ao.pdf */ bustype: isa, ai: das08_ai_rinsn, ai_nbits:16, @@ -386,11 +386,11 @@ static const struct das08_board_struct das08_boards[] = { do_nchan:8, i8255_offset:0, i8254_offset:0x04, - iosize: 16, // unchecked + iosize: 16, /* unchecked */ }, #ifdef CONFIG_COMEDI_PCI { - name: "das08", // pci-das08 + name: "das08", /* pci-das08 */ id: PCI_DEVICE_ID_PCIDAS08, bustype: pci, ai: das08_ai_rinsn, @@ -421,7 +421,7 @@ static const struct das08_board_struct das08_boards[] = { do_nchan:4, i8255_offset:0, i8254_offset:4, - iosize: 16, // unchecked + iosize: 16, /* unchecked */ }, #if 0 { @@ -445,14 +445,14 @@ static const struct das08_board_struct das08_boards[] = { do_nchan:8, i8255_offset:0, i8254_offset:0, - iosize: 16, // unchecked + iosize: 16, /* unchecked */ }, #if 0 { - name: "das48-pga", // cio-das48-pga.pdf + name: "das48-pga", /* cio-das48-pga.pdf */ }, { - name: "das08-pga-g2", // a KM board + name: "das08-pga-g2", /* a KM board */ }, #endif }; @@ -461,7 +461,7 @@ static const struct das08_board_struct das08_boards[] = { struct das08_board_struct das08_cs_boards[NUM_DAS08_CS_BOARDS] = { { name: "pcm-das08", - id: 0x0, // XXX + id: 0x0, /* XXX */ bustype: pcmcia, ai: das08_ai_rinsn, ai_nbits:12, @@ -476,10 +476,10 @@ struct das08_board_struct das08_cs_boards[NUM_DAS08_CS_BOARDS] = { i8254_offset:0, iosize: 16, }, - // duplicate so driver name can be used also + /* duplicate so driver name can be used also */ { name: "das08_cs", - id: 0x0, // XXX + id: 0x0, /* XXX */ bustype: pcmcia, ai: das08_ai_rinsn, ai_nbits:12, @@ -528,7 +528,7 @@ static int das08_ai_rinsn(struct comedi_device * dev, struct comedi_subdevice * inb(dev->iobase + DAS08_MSB); /* set multiplexer */ - spin_lock(&dev->spinlock); // lock to prevent race with digital output + spin_lock(&dev->spinlock); /* lock to prevent race with digital output */ devpriv->do_mux_bits &= ~DAS08_MUX_MASK; devpriv->do_mux_bits |= DAS08_MUX(chan); outb(devpriv->do_mux_bits, dev->iobase + DAS08_CONTROL); @@ -593,14 +593,14 @@ static int das08_do_wbits(struct comedi_device * dev, struct comedi_subdevice * { int wbits; - // get current settings of digital output lines + /* get current settings of digital output lines */ wbits = (devpriv->do_mux_bits >> 4) & 0xf; - // null bits we are going to set + /* null bits we are going to set */ wbits &= ~data[0]; - // set new bit values + /* set new bit values */ wbits |= data[0] & data[1]; - // remember digital output bits - spin_lock(&dev->spinlock); // prevent race with setting of analog input mux + /* remember digital output bits */ + spin_lock(&dev->spinlock); /* prevent race with setting of analog input mux */ devpriv->do_mux_bits &= ~DAS08_DO_MASK; devpriv->do_mux_bits |= DAS08_OP(wbits); outb(devpriv->do_mux_bits, dev->iobase + DAS08_CONTROL); @@ -623,9 +623,9 @@ static int das08jr_di_rbits(struct comedi_device * dev, struct comedi_subdevice static int das08jr_do_wbits(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - // null bits we are going to set + /* null bits we are going to set */ devpriv->do_bits &= ~data[0]; - // set new bit values + /* set new bit values */ devpriv->do_bits |= data[0] & data[1]; outb(devpriv->do_bits, dev->iobase + DAS08JR_DIO); @@ -787,9 +787,9 @@ static int das08_counter_read(struct comedi_device * dev, struct comedi_subdevic { int chan = insn->chanspec; - //printk("Reading counter channel %d ",chan); + /* printk("Reading counter channel %d ",chan); */ data[0] = i8254_read_channel(&devpriv->i8254, chan); - //printk("=> 0x%08X\n",data[0]); + /* printk("=> 0x%08X\n",data[0]); */ return 1; } @@ -799,7 +799,7 @@ static int das08_counter_write(struct comedi_device * dev, struct comedi_subdevi { int chan = insn->chanspec; - //printk("Writing counter channel %d with 0x%04X\n",chan,data[0]); + /* printk("Writing counter channel %d with 0x%04X\n",chan,data[0]); */ i8254_write_channel(&devpriv->i8254, chan, data[0]); return 1; @@ -845,7 +845,7 @@ int das08_common_attach(struct comedi_device * dev, unsigned long iobase) struct comedi_subdevice *s; int ret; - // allocate ioports for non-pcmcia, non-pci boards + /* allocate ioports for non-pcmcia, non-pci boards */ if ((thisboard->bustype != pcmcia) && (thisboard->bustype != pci)) { printk(" iobase 0x%lx\n", iobase); if (!request_region(iobase, thisboard->iosize, DRV_NAME)) { @@ -880,7 +880,7 @@ int das08_common_attach(struct comedi_device * dev, unsigned long iobase) /* ao */ if (thisboard->ao) { s->type = COMEDI_SUBD_AO; -// XXX lacks read-back insn +/* XXX lacks read-back insn */ s->subdev_flags = SDF_WRITABLE; s->n_chan = 2; s->maxdata = (1 << thisboard->ao_nbits) - 1; @@ -965,7 +965,7 @@ static int das08_attach(struct comedi_device * dev, struct comedi_devconfig * it return ret; printk("comedi%d: das08: ", dev->minor); - // deal with a pci board + /* deal with a pci board */ if (thisboard->bustype == pci) { #ifdef CONFIG_COMEDI_PCI if (it->options[0] || it->options[1]) { @@ -973,7 +973,7 @@ static int das08_attach(struct comedi_device * dev, struct comedi_devconfig * it it->options[0], it->options[1]); } printk("\n"); - // find card + /* find card */ for (pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pdev != NULL; pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) { @@ -995,12 +995,12 @@ static int das08_attach(struct comedi_device * dev, struct comedi_devconfig * it return -EIO; } devpriv->pdev = pdev; - // enable PCI device and reserve I/O spaces + /* enable PCI device and reserve I/O spaces */ if (comedi_pci_enable(pdev, DRV_NAME)) { printk(" Error enabling PCI device and requesting regions\n"); return -EIO; } - // read base addresses + /* read base addresses */ pci_iobase = pci_resource_start(pdev, 1); iobase = pci_resource_start(pdev, 2); printk("pcibase 0x%lx iobase 0x%lx\n", pci_iobase, iobase); @@ -1035,7 +1035,7 @@ int das08_common_detach(struct comedi_device * dev) if (dev->subdevices) subdev_8255_cleanup(dev, dev->subdevices + 4); - // deallocate ioports for non-pcmcia, non-pci boards + /* deallocate ioports for non-pcmcia, non-pci boards */ if ((thisboard->bustype != pcmcia) && (thisboard->bustype != pci)) { if (dev->iobase) release_region(dev->iobase, thisboard->iosize); diff --git a/drivers/staging/comedi/drivers/das08.h b/drivers/staging/comedi/drivers/das08.h index 69089ce690f2..b870e88ab834 100644 --- a/drivers/staging/comedi/drivers/das08.h +++ b/drivers/staging/comedi/drivers/das08.h @@ -25,14 +25,14 @@ #define _DAS08_H enum das08_bustype { isa, pci, pcmcia, pc104 }; -// different ways ai data is encoded in first two registers +/* different ways ai data is encoded in first two registers */ enum das08_ai_encoding { das08_encode12, das08_encode16, das08_pcm_encode12 }; enum das08_lrange { das08_pg_none, das08_bipolar5, das08_pgh, das08_pgl, das08_pgm }; struct das08_board_struct { const char *name; - unsigned int id; // id for pci/pcmcia boards + unsigned int id; /* id for pci/pcmcia boards */ enum das08_bustype bustype; void *ai; unsigned int ai_nbits; @@ -45,13 +45,13 @@ struct das08_board_struct { unsigned int do_nchan; unsigned int i8255_offset; unsigned int i8254_offset; - unsigned int iosize; // number of ioports used + unsigned int iosize; /* number of ioports used */ }; struct i8254_struct { - int channels; // available channels. Some could be used internally. - int logic2phys[3]; // to know which physical channel is. - int mode[3]; // the index is the real counter. + int channels; /* available channels. Some could be used internally. */ + int logic2phys[3]; /* to know which physical channel is. */ + int mode[3]; /* the index is the real counter. */ unsigned int iobase; }; @@ -61,11 +61,11 @@ struct i8254_struct { #define I8254_CTRL 3 struct das08_private_struct { - unsigned int do_mux_bits; // bits for do/mux register on boards without seperate do register - unsigned int do_bits; // bits for do register on boards with register dedicated to digital out only + unsigned int do_mux_bits; /* bits for do/mux register on boards without seperate do register */ + unsigned int do_bits; /* bits for do register on boards with register dedicated to digital out only */ const unsigned int *pg_gainlist; - struct pci_dev *pdev; // struct for pci-das08 - unsigned int pci_iobase; // additional base address for pci-das08 + struct pci_dev *pdev; /* struct for pci-das08 */ + unsigned int pci_iobase; /* additional base address for pci-das08 */ struct i8254_struct i8254; }; diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index be6c88788c4b..9fbcbf966386 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -46,7 +46,7 @@ Command support does not exist, but could be added for this board. #include "das08.h" -// pcmcia includes +/* pcmcia includes */ #include <pcmcia/cs_types.h> #include <pcmcia/cs.h> #include <pcmcia/cistpl.h> @@ -73,13 +73,13 @@ static int das08_cs_attach(struct comedi_device * dev, struct comedi_devconfig * { int ret; unsigned long iobase; - struct pcmcia_device *link = cur_dev; // XXX hack + struct pcmcia_device *link = cur_dev; /* XXX hack */ if ((ret = alloc_private(dev, sizeof(struct das08_private_struct))) < 0) return ret; printk("comedi%d: das08_cs: ", dev->minor); - // deal with a pci board + /* deal with a pci board */ if (thisboard->bustype == pcmcia) { if (link == NULL) { diff --git a/drivers/staging/comedi/drivers/das16.c b/drivers/staging/comedi/drivers/das16.c index 6b6b042099de..991e3330d11f 100644 --- a/drivers/staging/comedi/drivers/das16.c +++ b/drivers/staging/comedi/drivers/das16.c @@ -87,7 +87,7 @@ Computer boards manuals also available from their website www.measurementcomputi #include "comedi_fc.h" #undef DEBUG -//#define DEBUG +/* #define DEBUG */ #ifdef DEBUG #define DEBUG_PRINT(format, args...) rt_printk("das16: " format, ## args) @@ -95,8 +95,8 @@ Computer boards manuals also available from their website www.measurementcomputi #define DEBUG_PRINT(format, args...) #endif -#define DAS16_SIZE 20 // number of ioports -#define DAS16_DMA_SIZE 0xff00 // size in bytes of allocated dma buffer +#define DAS16_SIZE 20 /* number of ioports */ +#define DAS16_DMA_SIZE 0xff00 /* size in bytes of allocated dma buffer */ /* cio-das16.pdf @@ -184,7 +184,7 @@ Computer boards manuals also available from their website www.measurementcomputi */ -static const int sample_size = 2; // size in bytes of a sample from board +static const int sample_size = 2; /* size in bytes of a sample from board */ #define DAS16_TRIG 0 #define DAS16_AI_LSB 0 @@ -265,7 +265,7 @@ static const struct comedi_lrange range_das1x02_unip = { 4, { } }; static const struct comedi_lrange range_das16jr = { 9, { - // also used by 16/330 + /* also used by 16/330 */ BIP_RANGE(10), BIP_RANGE(5), BIP_RANGE(2.5), @@ -343,7 +343,7 @@ static void das16_ai_munge(struct comedi_device * dev, struct comedi_subdevice * void *array, unsigned int num_bytes, unsigned int start_chan_index); static void das16_reset(struct comedi_device * dev); -static irqreturn_t das16_dma_interrupt(int irq, void *d PT_REGS_ARG); +static irqreturn_t das16_dma_interrupt(int irq, void *d); static void das16_timer_interrupt(unsigned long arg); static void das16_interrupt(struct comedi_device * dev); @@ -359,7 +359,7 @@ struct das16_board { const char *name; void *ai; unsigned int ai_nbits; - unsigned int ai_speed; // max conversion speed in nanosec + unsigned int ai_speed; /* max conversion speed in nanosec */ unsigned int ai_pg; void *ao; unsigned int ao_nbits; @@ -420,7 +420,7 @@ static const struct das16_board das16_boards[] = { id: 0x00, }, { - name: "cio-das16", // cio-das16.pdf + name: "cio-das16", /* cio-das16.pdf */ ai: das16_ai_rinsn, ai_nbits:12, ai_speed:20000, @@ -435,7 +435,7 @@ static const struct das16_board das16_boards[] = { id: 0x80, }, { - name: "cio-das16/f", // das16.pdf + name: "cio-das16/f", /* das16.pdf */ ai: das16_ai_rinsn, ai_nbits:12, ai_speed:10000, @@ -450,7 +450,7 @@ static const struct das16_board das16_boards[] = { id: 0x80, }, { - name: "cio-das16/jr", // cio-das16jr.pdf + name: "cio-das16/jr", /* cio-das16jr.pdf */ ai: das16_ai_rinsn, ai_nbits:12, ai_speed:7692, @@ -464,7 +464,7 @@ static const struct das16_board das16_boards[] = { id: 0x00, }, { - name: "pc104-das16jr", // pc104-das16jr_xx.pdf + name: "pc104-das16jr", /* pc104-das16jr_xx.pdf */ ai: das16_ai_rinsn, ai_nbits:12, ai_speed:3300, @@ -478,7 +478,7 @@ static const struct das16_board das16_boards[] = { id: 0x00, }, { - name: "cio-das16jr/16", // cio-das16jr_16.pdf + name: "cio-das16jr/16", /* cio-das16jr_16.pdf */ ai: das16_ai_rinsn, ai_nbits:16, ai_speed:10000, @@ -492,7 +492,7 @@ static const struct das16_board das16_boards[] = { id: 0x00, }, { - name: "pc104-das16jr/16", // pc104-das16jr_xx.pdf + name: "pc104-das16jr/16", /* pc104-das16jr_xx.pdf */ ai: das16_ai_rinsn, ai_nbits:16, ai_speed:10000, @@ -506,7 +506,7 @@ static const struct das16_board das16_boards[] = { id: 0x00, }, { - name: "das-1201", // 4924.pdf (keithley user's manual) + name: "das-1201", /* 4924.pdf (keithley user's manual) */ ai: das16_ai_rinsn, ai_nbits:12, ai_speed:20000, @@ -520,7 +520,7 @@ static const struct das16_board das16_boards[] = { id: 0x20, }, { - name: "das-1202", // 4924.pdf (keithley user's manual) + name: "das-1202", /* 4924.pdf (keithley user's manual) */ ai: das16_ai_rinsn, ai_nbits:12, ai_speed:10000, @@ -534,7 +534,7 @@ static const struct das16_board das16_boards[] = { id: 0x20, }, { - name: "das-1401", // 4919.pdf and 4922.pdf (keithley user's manual) + name: "das-1401", /* 4919.pdf and 4922.pdf (keithley user's manual) */ ai: das16_ai_rinsn, ai_nbits:12, ai_speed:10000, @@ -545,10 +545,10 @@ static const struct das16_board das16_boards[] = { i8255_offset:0x0, i8254_offset:0x0c, size: 0x408, - id: 0xc0 // 4919.pdf says id bits are 0xe0, 4922.pdf says 0xc0 + id: 0xc0 /* 4919.pdf says id bits are 0xe0, 4922.pdf says 0xc0 */ }, { - name: "das-1402", // 4919.pdf and 4922.pdf (keithley user's manual) + name: "das-1402", /* 4919.pdf and 4922.pdf (keithley user's manual) */ ai: das16_ai_rinsn, ai_nbits:12, ai_speed:10000, @@ -559,10 +559,10 @@ static const struct das16_board das16_boards[] = { i8255_offset:0x0, i8254_offset:0x0c, size: 0x408, - id: 0xc0 // 4919.pdf says id bits are 0xe0, 4922.pdf says 0xc0 + id: 0xc0 /* 4919.pdf says id bits are 0xe0, 4922.pdf says 0xc0 */ }, { - name: "das-1601", // 4919.pdf + name: "das-1601", /* 4919.pdf */ ai: das16_ai_rinsn, ai_nbits:12, ai_speed:10000, @@ -576,7 +576,7 @@ static const struct das16_board das16_boards[] = { size: 0x408, id: 0xc0}, { - name: "das-1602", // 4919.pdf + name: "das-1602", /* 4919.pdf */ ai: das16_ai_rinsn, ai_nbits:12, ai_speed:10000, @@ -590,7 +590,7 @@ static const struct das16_board das16_boards[] = { size: 0x408, id: 0xc0}, { - name: "cio-das1401/12", // cio-das1400_series.pdf + name: "cio-das1401/12", /* cio-das1400_series.pdf */ ai: das16_ai_rinsn, ai_nbits:12, ai_speed:6250, @@ -603,7 +603,7 @@ static const struct das16_board das16_boards[] = { size: 0x408, id: 0xc0}, { - name: "cio-das1402/12", // cio-das1400_series.pdf + name: "cio-das1402/12", /* cio-das1400_series.pdf */ ai: das16_ai_rinsn, ai_nbits:12, ai_speed:6250, @@ -616,7 +616,7 @@ static const struct das16_board das16_boards[] = { size: 0x408, id: 0xc0}, { - name: "cio-das1402/16", // cio-das1400_series.pdf + name: "cio-das1402/16", /* cio-das1400_series.pdf */ ai: das16_ai_rinsn, ai_nbits:16, ai_speed:10000, @@ -629,7 +629,7 @@ static const struct das16_board das16_boards[] = { size: 0x408, id: 0xc0}, { - name: "cio-das1601/12", // cio-das160x-1x.pdf + name: "cio-das1601/12", /* cio-das160x-1x.pdf */ ai: das16_ai_rinsn, ai_nbits:12, ai_speed:6250, @@ -643,7 +643,7 @@ static const struct das16_board das16_boards[] = { size: 0x408, id: 0xc0}, { - name: "cio-das1602/12", // cio-das160x-1x.pdf + name: "cio-das1602/12", /* cio-das160x-1x.pdf */ ai: das16_ai_rinsn, ai_nbits:12, ai_speed:10000, @@ -657,7 +657,7 @@ static const struct das16_board das16_boards[] = { size: 0x408, id: 0xc0}, { - name: "cio-das1602/16", // cio-das160x-1x.pdf + name: "cio-das1602/16", /* cio-das160x-1x.pdf */ ai: das16_ai_rinsn, ai_nbits:16, ai_speed:10000, @@ -671,7 +671,7 @@ static const struct das16_board das16_boards[] = { size: 0x408, id: 0xc0}, { - name: "cio-das16/330", // ? + name: "cio-das16/330", /* ? */ ai: das16_ai_rinsn, ai_nbits:12, ai_speed:3030, @@ -685,13 +685,13 @@ static const struct das16_board das16_boards[] = { id: 0xf0}, #if 0 { - name: "das16/330i", // ? + name: "das16/330i", /* ? */ }, { - name: "das16/jr/ctr5", // ? + name: "das16/jr/ctr5", /* ? */ }, { - name: "cio-das16/m1/16", // cio-das16_m1_16.pdf, this board is a bit quirky, no dma + name: "cio-das16/m1/16", /* cio-das16_m1_16.pdf, this board is a bit quirky, no dma */ }, #endif }; @@ -719,25 +719,25 @@ static inline int timer_period(void) return HZ / 20; } struct das16_private_struct { - unsigned int ai_unipolar; // unipolar flag - unsigned int ai_singleended; // single ended flag - unsigned int clockbase; // master clock speed in ns - volatile unsigned int control_state; // dma, interrupt and trigger control bits - volatile unsigned long adc_byte_count; // number of bytes remaining - unsigned int divisor1; // divisor dividing master clock to get conversion frequency - unsigned int divisor2; // divisor dividing master clock to get conversion frequency - unsigned int dma_chan; // dma channel + unsigned int ai_unipolar; /* unipolar flag */ + unsigned int ai_singleended; /* single ended flag */ + unsigned int clockbase; /* master clock speed in ns */ + volatile unsigned int control_state; /* dma, interrupt and trigger control bits */ + volatile unsigned long adc_byte_count; /* number of bytes remaining */ + unsigned int divisor1; /* divisor dividing master clock to get conversion frequency */ + unsigned int divisor2; /* divisor dividing master clock to get conversion frequency */ + unsigned int dma_chan; /* dma channel */ uint16_t *dma_buffer[2]; dma_addr_t dma_buffer_addr[2]; unsigned int current_buffer; - volatile unsigned int dma_transfer_size; // target number of bytes to transfer per dma shot - // user-defined analog input and output ranges defined from config options + volatile unsigned int dma_transfer_size; /* target number of bytes to transfer per dma shot */ + /* user-defined analog input and output ranges defined from config options */ struct comedi_lrange *user_ai_range_table; struct comedi_lrange *user_ao_range_table; - struct timer_list timer; // for timed interrupt + struct timer_list timer; /* for timed interrupt */ volatile short timer_running; - volatile short timer_mode; // true if using timer mode + volatile short timer_mode; /* true if using timer mode */ }; #define devpriv ((struct das16_private_struct *)(dev->private)) #define thisboard ((struct das16_board *)(dev->board_ptr)) @@ -757,7 +757,7 @@ static int das16_cmd_test(struct comedi_device * dev, struct comedi_subdevice * tmp = cmd->scan_begin_src; mask = TRIG_FOLLOW; - // if board supports burst mode + /* if board supports burst mode */ if (thisboard->size > 0x400) mask |= TRIG_TIMER | TRIG_EXT; cmd->scan_begin_src &= mask; @@ -766,7 +766,7 @@ static int das16_cmd_test(struct comedi_device * dev, struct comedi_subdevice * tmp = cmd->convert_src; mask = TRIG_TIMER | TRIG_EXT; - // if board supports burst mode + /* if board supports burst mode */ if (thisboard->size > 0x400) mask |= TRIG_NOW; cmd->convert_src &= mask; @@ -797,7 +797,7 @@ static int das16_cmd_test(struct comedi_device * dev, struct comedi_subdevice * if (cmd->stop_src != TRIG_NONE && cmd->stop_src != TRIG_COUNT) err++; - // make sure scan_begin_src and convert_src dont conflict + /* make sure scan_begin_src and convert_src dont conflict */ if (cmd->scan_begin_src == TRIG_FOLLOW && cmd->convert_src == TRIG_NOW) err++; if (cmd->scan_begin_src != TRIG_FOLLOW && cmd->convert_src != TRIG_NOW) @@ -824,7 +824,7 @@ static int das16_cmd_test(struct comedi_device * dev, struct comedi_subdevice * cmd->scan_end_arg = cmd->chanlist_len; err++; } - // check against maximum frequency + /* check against maximum frequency */ if (cmd->scan_begin_src == TRIG_TIMER) { if (cmd->scan_begin_arg < thisboard->ai_speed * cmd->chanlist_len) { @@ -849,10 +849,10 @@ static int das16_cmd_test(struct comedi_device * dev, struct comedi_subdevice * if (err) return 3; - // step 4: fix up arguments + /* step 4: fix up arguments */ if (cmd->scan_begin_src == TRIG_TIMER) { unsigned int tmp = cmd->scan_begin_arg; - // set divisors, correct timing arguments + /* set divisors, correct timing arguments */ i8253_cascade_ns_to_timer_2div(devpriv->clockbase, &(devpriv->divisor1), &(devpriv->divisor2), &(cmd->scan_begin_arg), cmd->flags & TRIG_ROUND_MASK); @@ -860,7 +860,7 @@ static int das16_cmd_test(struct comedi_device * dev, struct comedi_subdevice * } if (cmd->convert_src == TRIG_TIMER) { unsigned int tmp = cmd->convert_arg; - // set divisors, correct timing arguments + /* set divisors, correct timing arguments */ i8253_cascade_ns_to_timer_2div(devpriv->clockbase, &(devpriv->divisor1), &(devpriv->divisor2), &(cmd->convert_arg), cmd->flags & TRIG_ROUND_MASK); @@ -869,7 +869,7 @@ static int das16_cmd_test(struct comedi_device * dev, struct comedi_subdevice * if (err) return 4; - // check channel/gain list against card's limitations + /* check channel/gain list against card's limitations */ if (cmd->chanlist) { gain = CR_RANGE(cmd->chanlist[0]); start_chan = CR_CHAN(cmd->chanlist[0]); @@ -916,11 +916,11 @@ static int das16_cmd_exec(struct comedi_device * dev, struct comedi_subdevice * devpriv->adc_byte_count = cmd->stop_arg * cmd->chanlist_len * sizeof(uint16_t); - // disable conversions for das1600 mode + /* disable conversions for das1600 mode */ if (thisboard->size > 0x400) { outb(DAS1600_CONV_DISABLE, dev->iobase + DAS1600_CONV); } - // set scan limits + /* set scan limits */ byte = CR_CHAN(cmd->chanlist[0]); byte |= CR_CHAN(cmd->chanlist[cmd->chanlist_len - 1]) << 4; outb(byte, dev->iobase + DAS16_MUX); @@ -945,7 +945,7 @@ static int das16_cmd_exec(struct comedi_device * dev, struct comedi_subdevice * if (thisboard->size > 0x400) { if (cmd->convert_src == TRIG_NOW) { outb(DAS1600_BURST_VAL, dev->iobase + DAS1600_BURST); - // set burst length + /* set burst length */ byte |= BURST_LEN_BITS(cmd->chanlist_len - 1); } else { outb(0, dev->iobase + DAS1600_BURST); @@ -953,7 +953,7 @@ static int das16_cmd_exec(struct comedi_device * dev, struct comedi_subdevice * } outb(byte, dev->iobase + DAS16_PACER); - // set up dma transfer + /* set up dma transfer */ flags = claim_dma_lock(); disable_dma(devpriv->dma_chan); /* clear flip-flop to make sure 2-byte registers for @@ -962,13 +962,13 @@ static int das16_cmd_exec(struct comedi_device * dev, struct comedi_subdevice * devpriv->current_buffer = 0; set_dma_addr(devpriv->dma_chan, devpriv->dma_buffer_addr[devpriv->current_buffer]); - // set appropriate size of transfer + /* set appropriate size of transfer */ devpriv->dma_transfer_size = das16_suggest_transfer_size(dev, *cmd); set_dma_count(devpriv->dma_chan, devpriv->dma_transfer_size); enable_dma(devpriv->dma_chan); release_dma_lock(flags); - // set up interrupt + /* set up interrupt */ if (devpriv->timer_mode) { devpriv->timer_running = 1; devpriv->timer.expires = jiffies + timer_period(); @@ -1007,7 +1007,7 @@ static int das16_cancel(struct comedi_device * dev, struct comedi_subdevice * s) if (devpriv->dma_chan) disable_dma(devpriv->dma_chan); - // disable SW timer + /* disable SW timer */ if (devpriv->timer_mode && devpriv->timer_running) { devpriv->timer_running = 0; del_timer(&devpriv->timer); @@ -1039,7 +1039,7 @@ static int das16_ai_rinsn(struct comedi_device * dev, struct comedi_subdevice * int chan; int msb, lsb; - // disable interrupts and pacing + /* disable interrupts and pacing */ devpriv->control_state &= ~DAS16_INTE & ~DMA_ENABLE & ~PACING_MASK; outb(devpriv->control_state, dev->iobase + DAS16_CONTROL); @@ -1096,12 +1096,12 @@ static int das16_do_wbits(struct comedi_device * dev, struct comedi_subdevice * { unsigned int wbits; - // only set bits that have been masked + /* only set bits that have been masked */ data[0] &= 0xf; wbits = s->state; - // zero bits that have been masked + /* zero bits that have been masked */ wbits &= ~data[0]; - // set masked bits + /* set masked bits */ wbits |= data[0] & data[1]; s->state = wbits; data[1] = wbits; @@ -1135,7 +1135,7 @@ static int das16_ao_winsn(struct comedi_device * dev, struct comedi_subdevice * return i; } -static irqreturn_t das16_dma_interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t das16_dma_interrupt(int irq, void *d) { int status; struct comedi_device *dev = d; @@ -1210,7 +1210,7 @@ static void das16_interrupt(struct comedi_device * dev) comedi_error(dev, "premature interrupt"); return; } - // initialize async here to make sure it is not NULL + /* initialize async here to make sure it is not NULL */ async = s->async; cmd = &async->cmd; @@ -1230,7 +1230,7 @@ static void das16_interrupt(struct comedi_device * dev) clear_dma_ff(devpriv->dma_chan); residue = disable_dma_on_even(dev); - // figure out how many points to read + /* figure out how many points to read */ if (residue > devpriv->dma_transfer_size) { comedi_error(dev, "residue > transfer size!\n"); async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; @@ -1247,12 +1247,12 @@ static void das16_interrupt(struct comedi_device * dev) devpriv->current_buffer = (devpriv->current_buffer + 1) % 2; devpriv->adc_byte_count -= num_bytes; - // figure out how many bytes for next transfer + /* figure out how many bytes for next transfer */ if (cmd->stop_src == TRIG_COUNT && devpriv->timer_mode == 0 && devpriv->dma_transfer_size > devpriv->adc_byte_count) devpriv->dma_transfer_size = devpriv->adc_byte_count; - // re-enable dma + /* re-enable dma */ if ((async->events & COMEDI_CB_EOA) == 0) { set_dma_addr(devpriv->dma_chan, devpriv->dma_buffer_addr[devpriv->current_buffer]); @@ -1391,7 +1391,7 @@ static int das16_attach(struct comedi_device * dev, struct comedi_devconfig * it printk("comedi%d: das16:", dev->minor); - // check that clock setting is valid + /* check that clock setting is valid */ if (it->options[3]) { if (it->options[3] != 0 && it->options[3] != 1 && it->options[3] != 10) { @@ -1431,19 +1431,19 @@ static int das16_attach(struct comedi_device * dev, struct comedi_devconfig * it dev->iobase = iobase; - // probe id bits to make sure they are consistent + /* probe id bits to make sure they are consistent */ if (das16_probe(dev, it)) { printk(" id bits do not match selected board, aborting\n"); return -EINVAL; } dev->board_name = thisboard->name; - // get master clock speed + /* get master clock speed */ if (thisboard->size < 0x400) { if (it->options[3]) devpriv->clockbase = 1000 / it->options[3]; else - devpriv->clockbase = 1000; // 1 MHz default + devpriv->clockbase = 1000; /* 1 MHz default */ } else { das1600_mode_detect(dev); } @@ -1462,10 +1462,10 @@ static int das16_attach(struct comedi_device * dev, struct comedi_devconfig * it return -EINVAL; } - // initialize dma + /* initialize dma */ dma_chan = it->options[2]; if (dma_chan == 1 || dma_chan == 3) { - // allocate dma buffers + /* allocate dma buffers */ int i; for (i = 0; i < 2; i++) { devpriv->dma_buffer[i] = pci_alloc_consistent(NULL, @@ -1491,27 +1491,27 @@ static int das16_attach(struct comedi_device * dev, struct comedi_devconfig * it return -EINVAL; } - // get any user-defined input range + /* get any user-defined input range */ if (thisboard->ai_pg == das16_pg_none && (it->options[4] || it->options[5])) { - // allocate single-range range table + /* allocate single-range range table */ devpriv->user_ai_range_table = kmalloc(sizeof(struct comedi_lrange) + sizeof(struct comedi_krange), GFP_KERNEL); - // initialize ai range + /* initialize ai range */ devpriv->user_ai_range_table->length = 1; user_ai_range = devpriv->user_ai_range_table->range; user_ai_range->min = it->options[4]; user_ai_range->max = it->options[5]; user_ai_range->flags = UNIT_volt; } - // get any user-defined output range + /* get any user-defined output range */ if (it->options[6] || it->options[7]) { - // allocate single-range range table + /* allocate single-range range table */ devpriv->user_ao_range_table = kmalloc(sizeof(struct comedi_lrange) + sizeof(struct comedi_krange), GFP_KERNEL); - // initialize ao range + /* initialize ao range */ devpriv->user_ao_range_table->length = 1; user_ao_range = devpriv->user_ao_range_table->range; user_ao_range->min = it->options[6]; @@ -1545,7 +1545,7 @@ static int das16_attach(struct comedi_device * dev, struct comedi_devconfig * it s->subdev_flags |= SDF_DIFF; } s->maxdata = (1 << thisboard->ai_nbits) - 1; - if (devpriv->user_ai_range_table) { // user defined ai range + if (devpriv->user_ai_range_table) { /* user defined ai range */ s->range_table = devpriv->user_ai_range_table; } else if (devpriv->ai_unipolar) { s->range_table = das16_ai_uni_lranges[thisboard->ai_pg]; @@ -1568,7 +1568,7 @@ static int das16_attach(struct comedi_device * dev, struct comedi_devconfig * it s->subdev_flags = SDF_WRITABLE; s->n_chan = 2; s->maxdata = (1 << thisboard->ao_nbits) - 1; - if (devpriv->user_ao_range_table) { // user defined ao range + if (devpriv->user_ao_range_table) { /* user defined ao range */ s->range_table = devpriv->user_ao_range_table; } else { s->range_table = &range_unknown; @@ -1600,7 +1600,7 @@ static int das16_attach(struct comedi_device * dev, struct comedi_devconfig * it s->maxdata = 1; s->range_table = &range_digital; s->insn_bits = thisboard->do_; - // initialize digital output lines + /* initialize digital output lines */ outb(s->state, dev->iobase + DAS16_DIO); } else { s->type = COMEDI_SUBD_UNUSED; @@ -1620,7 +1620,7 @@ static int das16_attach(struct comedi_device * dev, struct comedi_devconfig * it devpriv->control_state = DAS16_IRQ(dev->irq); outb(devpriv->control_state, dev->iobase + DAS16_CONTROL); - // turn on das1600 mode if available + /* turn on das1600 mode if available */ if (thisboard->size > 0x400) { outb(DAS1600_ENABLE_VAL, dev->iobase + DAS1600_ENABLE); outb(0, dev->iobase + DAS1600_CONV); @@ -1673,7 +1673,7 @@ static int das16_detach(struct comedi_device * dev) COMEDI_INITCLEANUP(driver_das16); -// utility function that suggests a dma transfer size in bytes +/* utility function that suggests a dma transfer size in bytes */ static unsigned int das16_suggest_transfer_size(struct comedi_device * dev, struct comedi_cmd cmd) { @@ -1692,18 +1692,18 @@ static unsigned int das16_suggest_transfer_size(struct comedi_device * dev, freq = 1000000000 / cmd.convert_arg; else if (cmd.scan_begin_src == TRIG_TIMER) freq = (1000000000 / cmd.scan_begin_arg) * cmd.chanlist_len; - // return some default value + /* return some default value */ else freq = 0xffffffff; if (cmd.flags & TRIG_WAKE_EOS) { size = sample_size * cmd.chanlist_len; } else { - // make buffer fill in no more than 1/3 second + /* make buffer fill in no more than 1/3 second */ size = (freq / 3) * sample_size; } - // set a minimum and maximum size allowed + /* set a minimum and maximum size allowed */ if (size > DAS16_DMA_SIZE) size = DAS16_DMA_SIZE - DAS16_DMA_SIZE % sample_size; else if (size < sample_size) diff --git a/drivers/staging/comedi/drivers/das16m1.c b/drivers/staging/comedi/drivers/das16m1.c index 0e423e199ed6..5b1d96cea046 100644 --- a/drivers/staging/comedi/drivers/das16m1.c +++ b/drivers/staging/comedi/drivers/das16m1.c @@ -68,9 +68,9 @@ irq can be omitted, although the cmd interface will not work without it. #define DAS16M1_SIZE 16 #define DAS16M1_SIZE2 8 -#define DAS16M1_XTAL 100 //10 MHz master clock +#define DAS16M1_XTAL 100 /* 10 MHz master clock */ -#define FIFO_SIZE 1024 // 1024 sample fifo +#define FIFO_SIZE 1024 /* 1024 sample fifo */ /* CIO-DAS16_M1.pdf @@ -92,7 +92,7 @@ irq can be omitted, although the cmd interface will not work without it. */ -#define DAS16M1_AI 0 // 16-bit wide register +#define DAS16M1_AI 0 /* 16-bit wide register */ #define AI_CHAN(x) ((x) & 0xf) #define DAS16M1_CS 2 #define EXT_TRIG_BIT 0x1 @@ -144,7 +144,7 @@ static int das16m1_cmd_exec(struct comedi_device * dev, struct comedi_subdevice static int das16m1_cancel(struct comedi_device * dev, struct comedi_subdevice * s); static int das16m1_poll(struct comedi_device * dev, struct comedi_subdevice * s); -static irqreturn_t das16m1_interrupt(int irq, void *d PT_REGS_ARG); +static irqreturn_t das16m1_interrupt(int irq, void *d); static void das16m1_handler(struct comedi_device * dev, unsigned int status); static unsigned int das16m1_set_pacer(struct comedi_device * dev, unsigned int ns, @@ -159,8 +159,8 @@ struct das16m1_board { static const struct das16m1_board das16m1_boards[] = { { - name: "cio-das16/m1", // CIO-DAS16_M1.pdf - ai_speed:1000, // 1MHz max speed + name: "cio-das16/m1", /* CIO-DAS16_M1.pdf */ + ai_speed:1000, /* 1MHz max speed */ }, }; @@ -180,15 +180,15 @@ static struct comedi_driver driver_das16m1 = { struct das16m1_private_struct { unsigned int control_state; - volatile unsigned int adc_count; // number of samples completed + volatile unsigned int adc_count; /* number of samples completed */ /* initial value in lower half of hardware conversion counter, * needed to keep track of whether new count has been loaded into * counter yet (loaded by first sample conversion) */ u16 initial_hw_count; short ai_buffer[FIFO_SIZE]; - unsigned int do_bits; // saves status of digital output bits - unsigned int divisor1; // divides master clock to obtain conversion speed - unsigned int divisor2; // divides master clock to obtain conversion speed + unsigned int do_bits; /* saves status of digital output bits */ + unsigned int divisor1; /* divides master clock to obtain conversion speed */ + unsigned int divisor2; /* divides master clock to obtain conversion speed */ }; #define devpriv ((struct das16m1_private_struct *)(dev->private)) #define thisboard ((const struct das16m1_board *)(dev->board_ptr)) @@ -299,10 +299,10 @@ static int das16m1_cmd_test(struct comedi_device * dev, struct comedi_subdevice if (err) return 4; - // check chanlist against board's peculiarities + /* check chanlist against board's peculiarities */ if (cmd->chanlist && cmd->chanlist_len > 1) { for (i = 0; i < cmd->chanlist_len; i++) { - // even/odd channels must go into even/odd queue addresses + /* even/odd channels must go into even/odd queue addresses */ if ((i % 2) != (CR_CHAN(cmd->chanlist[i]) % 2)) { comedi_error(dev, "bad chanlist:\n" " even/odd channels must go have even/odd chanlist indices"); @@ -337,7 +337,7 @@ static int das16m1_cmd_exec(struct comedi_device * dev, struct comedi_subdevice devpriv->control_state &= ~INTE & ~PACER_MASK; outb(devpriv->control_state, dev->iobase + DAS16M1_INTR_CONTROL); - // set software count + /* set software count */ devpriv->adc_count = 0; /* Initialize lower half of hardware counter, used to determine how * many samples are in fifo. Value doesn't actually load into counter @@ -361,7 +361,7 @@ static int das16m1_cmd_exec(struct comedi_device * dev, struct comedi_subdevice das16m1_set_pacer(dev, cmd->convert_arg, cmd->flags & TRIG_ROUND_MASK); - // set control & status register + /* set control & status register */ byte = 0; /* if we are using external start trigger (also board dislikes having * both start and conversion triggers external simultaneously) */ @@ -447,12 +447,12 @@ static int das16m1_do_wbits(struct comedi_device * dev, struct comedi_subdevice { unsigned int wbits; - // only set bits that have been masked + /* only set bits that have been masked */ data[0] &= 0xf; wbits = devpriv->do_bits; - // zero bits that have been masked + /* zero bits that have been masked */ wbits &= ~data[0]; - // set masked bits + /* set masked bits */ wbits |= data[0] & data[1]; devpriv->do_bits = wbits; data[1] = wbits; @@ -467,7 +467,7 @@ static int das16m1_poll(struct comedi_device * dev, struct comedi_subdevice * s) unsigned long flags; unsigned int status; - // prevent race with interrupt handler + /* prevent race with interrupt handler */ comedi_spin_lock_irqsave(&dev->spinlock, flags); status = inb(dev->iobase + DAS16M1_CS); das16m1_handler(dev, status); @@ -476,7 +476,7 @@ static int das16m1_poll(struct comedi_device * dev, struct comedi_subdevice * s) return s->async->buf_write_count - s->async->buf_read_count; } -static irqreturn_t das16m1_interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t das16m1_interrupt(int irq, void *d) { int status; struct comedi_device *dev = d; @@ -485,7 +485,7 @@ static irqreturn_t das16m1_interrupt(int irq, void *d PT_REGS_ARG) comedi_error(dev, "premature interrupt"); return IRQ_HANDLED; } - // prevent race with comedi_poll() + /* prevent race with comedi_poll() */ spin_lock(&dev->spinlock); status = inb(dev->iobase + DAS16M1_CS); @@ -527,7 +527,7 @@ static void das16m1_handler(struct comedi_device * dev, unsigned int status) async->events = 0; cmd = &async->cmd; - // figure out how many samples are in fifo + /* figure out how many samples are in fifo */ hw_counter = i8254_read(dev->iobase + DAS16M1_8254_FIRST, 0, 1); /* make sure hardware counter reading is not bogus due to initial value * not having been loaded yet */ @@ -542,12 +542,12 @@ static void das16m1_handler(struct comedi_device * dev, unsigned int status) * hardware counter. Work it out, and this is what you get. */ num_samples = -hw_counter - devpriv->adc_count; } - // check if we only need some of the points + /* check if we only need some of the points */ if (cmd->stop_src == TRIG_COUNT) { if (num_samples > cmd->stop_arg * cmd->chanlist_len) num_samples = cmd->stop_arg * cmd->chanlist_len; } - // make sure we dont try to get too many points if fifo has overrun + /* make sure we dont try to get too many points if fifo has overrun */ if (num_samples > FIFO_SIZE) num_samples = FIFO_SIZE; insw(dev->iobase, devpriv->ai_buffer, num_samples); @@ -669,7 +669,7 @@ static int das16m1_attach(struct comedi_device * dev, struct comedi_devconfig * /* now for the irq */ irq = it->options[1]; - // make sure it is valid + /* make sure it is valid */ if (das16m1_irq_bits(irq) >= 0) { ret = comedi_request_irq(irq, das16m1_interrupt, 0, driver_das16m1.driver_name, dev); @@ -728,10 +728,10 @@ static int das16m1_attach(struct comedi_device * dev, struct comedi_devconfig * /* 8255 */ subdev_8255_init(dev, s, NULL, dev->iobase + DAS16M1_82C55); - // disable upper half of hardware conversion counter so it doesn't mess with us + /* disable upper half of hardware conversion counter so it doesn't mess with us */ outb(TOTAL_CLEAR, dev->iobase + DAS16M1_8254_FIRST_CNTRL); - // initialize digital output lines + /* initialize digital output lines */ outb(devpriv->do_bits, dev->iobase + DAS16M1_DIO); /* set the interrupt level */ @@ -748,7 +748,7 @@ static int das16m1_detach(struct comedi_device * dev) { printk("comedi%d: das16m1: remove\n", dev->minor); -// das16m1_reset(dev); +/* das16m1_reset(dev); */ if (dev->subdevices) subdev_8255_cleanup(dev, dev->subdevices + 3); diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c index cd4cd4e6a79b..7e1b8f8fec57 100644 --- a/drivers/staging/comedi/drivers/das1800.c +++ b/drivers/staging/comedi/drivers/das1800.c @@ -108,12 +108,12 @@ TODO: #include "8253.h" #include "comedi_fc.h" -// misc. defines -#define DAS1800_SIZE 16 //uses 16 io addresses -#define FIFO_SIZE 1024 // 1024 sample fifo -#define TIMER_BASE 200 // 5 Mhz master clock -#define UNIPOLAR 0x4 // bit that determines whether input range is uni/bipolar -#define DMA_BUF_SIZE 0x1ff00 // size in bytes of dma buffers +/* misc. defines */ +#define DAS1800_SIZE 16 /* uses 16 io addresses */ +#define FIFO_SIZE 1024 /* 1024 sample fifo */ +#define TIMER_BASE 200 /* 5 Mhz master clock */ +#define UNIPOLAR 0x4 /* bit that determines whether input range is uni/bipolar */ +#define DMA_BUF_SIZE 0x1ff00 /* size in bytes of dma buffers */ /* Registers for the das1800 */ #define DAS1800_FIFO 0x0 @@ -138,7 +138,7 @@ TODO: #define DMA_CH5_CH6 0x5 #define DMA_CH6_CH7 0x6 #define DMA_CH7_CH5 0x7 -#define DMA_ENABLED 0x3 //mask used to determine if dma is enabled +#define DMA_ENABLED 0x3 /* mask used to determine if dma is enabled */ #define DMA_DUAL 0x4 #define IRQ3 0x8 #define IRQ5 0x10 @@ -156,7 +156,7 @@ TODO: #define SD 0x40 #define UB 0x80 #define DAS1800_STATUS 0x7 -// bits that prevent interrupt status bits (and CVEN) from being cleared on write +/* bits that prevent interrupt status bits (and CVEN) from being cleared on write */ #define CLEAR_INTR_MASK (CVEN_MASK | 0x1f) #define INT 0x1 #define DMATC 0x2 @@ -164,14 +164,14 @@ TODO: #define OVF 0x10 #define FHF 0x20 #define FNE 0x40 -#define CVEN_MASK 0x40 // masks CVEN on write +#define CVEN_MASK 0x40 /* masks CVEN on write */ #define CVEN 0x80 #define DAS1800_BURST_LENGTH 0x8 #define DAS1800_BURST_RATE 0x9 #define DAS1800_QRAM_ADDRESS 0xa #define DAS1800_COUNTER 0xc -#define IOBASE2 0x400 //offset of additional ioports used on 'ao' cards +#define IOBASE2 0x400 /* offset of additional ioports used on 'ao' cards */ enum { das1701st, das1701st_da, das1702st, das1702st_da, das1702hr, @@ -184,7 +184,7 @@ static int das1800_attach(struct comedi_device * dev, struct comedi_devconfig * static int das1800_detach(struct comedi_device * dev); static int das1800_probe(struct comedi_device * dev); static int das1800_cancel(struct comedi_device * dev, struct comedi_subdevice * s); -static irqreturn_t das1800_interrupt(int irq, void *d PT_REGS_ARG); +static irqreturn_t das1800_interrupt(int irq, void *d); static int das1800_ai_poll(struct comedi_device * dev, struct comedi_subdevice * s); static void das1800_ai_handler(struct comedi_device * dev); static void das1800_handle_dma(struct comedi_device * dev, struct comedi_subdevice * s, @@ -212,7 +212,7 @@ static int das1800_set_frequency(struct comedi_device * dev); static unsigned int burst_convert_arg(unsigned int convert_arg, int round_mode); static unsigned int suggest_transfer_size(struct comedi_cmd * cmd); -// analog input ranges +/* analog input ranges */ static const struct comedi_lrange range_ai_das1801 = { 8, { @@ -485,7 +485,7 @@ struct das1800_private { #define devpriv ((struct das1800_private *)dev->private) -// analog out range for boards with basic analog out +/* analog out range for boards with basic analog out */ static const struct comedi_lrange range_ao_1 = { 1, { @@ -493,7 +493,7 @@ static const struct comedi_lrange range_ao_1 = { } }; -// analog out range for 'ao' boards +/* analog out range for 'ao' boards */ /* static const struct comedi_lrange range_ao_2 = { 2, @@ -525,26 +525,26 @@ static int das1800_init_dma(struct comedi_device * dev, unsigned int dma0, { unsigned long flags; - // need an irq to do dma + /* need an irq to do dma */ if (dev->irq && dma0) { - //encode dma0 and dma1 into 2 digit hexadecimal for switch + /* encode dma0 and dma1 into 2 digit hexadecimal for switch */ switch ((dma0 & 0x7) | (dma1 << 4)) { - case 0x5: // dma0 == 5 + case 0x5: /* dma0 == 5 */ devpriv->dma_bits |= DMA_CH5; break; - case 0x6: // dma0 == 6 + case 0x6: /* dma0 == 6 */ devpriv->dma_bits |= DMA_CH6; break; - case 0x7: // dma0 == 7 + case 0x7: /* dma0 == 7 */ devpriv->dma_bits |= DMA_CH7; break; - case 0x65: // dma0 == 5, dma1 == 6 + case 0x65: /* dma0 == 5, dma1 == 6 */ devpriv->dma_bits |= DMA_CH5_CH6; break; - case 0x76: // dma0 == 6, dma1 == 7 + case 0x76: /* dma0 == 6, dma1 == 7 */ devpriv->dma_bits |= DMA_CH6_CH7; break; - case 0x57: // dma0 == 7, dma1 == 5 + case 0x57: /* dma0 == 7, dma1 == 5 */ devpriv->dma_bits |= DMA_CH7_CH5; break; default: @@ -638,7 +638,7 @@ static int das1800_attach(struct comedi_device * dev, struct comedi_devconfig * dev->board_ptr = das1800_boards + board; dev->board_name = thisboard->name; - // if it is an 'ao' board with fancy analog out then we need extra io ports + /* if it is an 'ao' board with fancy analog out then we need extra io ports */ if (thisboard->ao_ability == 2) { iobase2 = iobase + IOBASE2; if (!request_region(iobase2, DAS1800_SIZE, @@ -659,7 +659,7 @@ static int das1800_attach(struct comedi_device * dev, struct comedi_devconfig * } dev->irq = irq; - // set bits that tell card which irq to use + /* set bits that tell card which irq to use */ switch (irq) { case 0: break; @@ -751,12 +751,12 @@ static int das1800_attach(struct comedi_device * dev, struct comedi_devconfig * das1800_cancel(dev, dev->read_subdev); - // initialize digital out channels + /* initialize digital out channels */ outb(devpriv->do_bits, dev->iobase + DAS1800_DIGITAL); - // initialize analog out channels + /* initialize analog out channels */ if (thisboard->ao_ability == 1) { - // select 'update' dac channel for baseAddress + 0x0 + /* select 'update' dac channel for baseAddress + 0x0 */ outb(DAC(thisboard->ao_n_chan - 1), dev->iobase + DAS1800_SELECT); outw(devpriv->ao_update_bits, dev->iobase + DAS1800_DAC); @@ -871,7 +871,7 @@ static int das1800_ai_poll(struct comedi_device * dev, struct comedi_subdevice * { unsigned long flags; - // prevent race with interrupt handler + /* prevent race with interrupt handler */ comedi_spin_lock_irqsave(&dev->spinlock, flags); das1800_ai_handler(dev); comedi_spin_unlock_irqrestore(&dev->spinlock, flags); @@ -879,7 +879,7 @@ static int das1800_ai_poll(struct comedi_device * dev, struct comedi_subdevice * return s->async->buf_write_count - s->async->buf_read_count; } -static irqreturn_t das1800_interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t das1800_interrupt(int irq, void *d) { struct comedi_device *dev = d; unsigned int status; @@ -901,14 +901,14 @@ static irqreturn_t das1800_interrupt(int irq, void *d PT_REGS_ARG) } /* clear the interrupt status bit INT */ outb(CLEAR_INTR_MASK & ~INT, dev->iobase + DAS1800_STATUS); - // handle interrupt + /* handle interrupt */ das1800_ai_handler(dev); spin_unlock(&dev->spinlock); return IRQ_HANDLED; } -// the guts of the interrupt handler, that is shared with das1800_ai_poll +/* the guts of the interrupt handler, that is shared with das1800_ai_poll */ static void das1800_ai_handler(struct comedi_device * dev) { struct comedi_subdevice *s = dev->subdevices + 0; /* analog input subdevice */ @@ -917,22 +917,22 @@ static void das1800_ai_handler(struct comedi_device * dev) unsigned int status = inb(dev->iobase + DAS1800_STATUS); async->events = 0; - // select adc for base address + 0 + /* select adc for base address + 0 */ outb(ADC, dev->iobase + DAS1800_SELECT); - // dma buffer full + /* dma buffer full */ if (devpriv->irq_dma_bits & DMA_ENABLED) { - // look for data from dma transfer even if dma terminal count hasn't happened yet + /* look for data from dma transfer even if dma terminal count hasn't happened yet */ das1800_handle_dma(dev, s, status); - } else if (status & FHF) { // if fifo half full + } else if (status & FHF) { /* if fifo half full */ das1800_handle_fifo_half_full(dev, s); - } else if (status & FNE) { // if fifo not empty + } else if (status & FNE) { /* if fifo not empty */ das1800_handle_fifo_not_empty(dev, s); } async->events |= COMEDI_CB_BLOCK; /* if the card's fifo has overflowed */ if (status & OVF) { - // clear OVF interrupt bit + /* clear OVF interrupt bit */ outb(CLEAR_INTR_MASK & ~OVF, dev->iobase + DAS1800_STATUS); comedi_error(dev, "DAS1800 FIFO overflow"); das1800_cancel(dev, s); @@ -940,19 +940,19 @@ static void das1800_ai_handler(struct comedi_device * dev) comedi_event(dev, s); return; } - // stop taking data if appropriate + /* stop taking data if appropriate */ /* stop_src TRIG_EXT */ if (status & CT0TC) { - // clear CT0TC interrupt bit + /* clear CT0TC interrupt bit */ outb(CLEAR_INTR_MASK & ~CT0TC, dev->iobase + DAS1800_STATUS); - // make sure we get all remaining data from board before quitting + /* make sure we get all remaining data from board before quitting */ if (devpriv->irq_dma_bits & DMA_ENABLED) das1800_flush_dma(dev, s); else das1800_handle_fifo_not_empty(dev, s); das1800_cancel(dev, s); /* disable hardware conversions */ async->events |= COMEDI_CB_EOA; - } else if (cmd->stop_src == TRIG_COUNT && devpriv->count == 0) { // stop_src TRIG_COUNT + } else if (cmd->stop_src == TRIG_COUNT && devpriv->count == 0) { /* stop_src TRIG_COUNT */ das1800_cancel(dev, s); /* disable hardware conversions */ async->events |= COMEDI_CB_EOA; } @@ -971,7 +971,7 @@ static void das1800_handle_dma(struct comedi_device * dev, struct comedi_subdevi flags = claim_dma_lock(); das1800_flush_dma_channel(dev, s, devpriv->dma_current, devpriv->dma_current_buf); - // re-enable dma channel + /* re-enable dma channel */ set_dma_addr(devpriv->dma_current, virt_to_bus(devpriv->dma_current_buf)); set_dma_count(devpriv->dma_current, devpriv->dma_transfer_size); @@ -979,11 +979,11 @@ static void das1800_handle_dma(struct comedi_device * dev, struct comedi_subdevi release_dma_lock(flags); if (status & DMATC) { - // clear DMATC interrupt bit + /* clear DMATC interrupt bit */ outb(CLEAR_INTR_MASK & ~DMATC, dev->iobase + DAS1800_STATUS); - // switch dma channels for next time, if appropriate + /* switch dma channels for next time, if appropriate */ if (dual_dma) { - // read data from the other channel next time + /* read data from the other channel next time */ if (devpriv->dma_current == devpriv->dma0) { devpriv->dma_current = devpriv->dma1; devpriv->dma_current_buf = devpriv->ai_buf1; @@ -1035,7 +1035,7 @@ static void das1800_flush_dma_channel(struct comedi_device * dev, struct comedi_ * get set correctly */ clear_dma_ff(channel); - // figure out how many points to read + /* figure out how many points to read */ num_bytes = devpriv->dma_transfer_size - get_dma_residue(channel); num_samples = num_bytes / sizeof(short); @@ -1063,7 +1063,7 @@ static void das1800_flush_dma(struct comedi_device * dev, struct comedi_subdevic devpriv->dma_current_buf); if (dual_dma) { - // switch to other channel and flush it + /* switch to other channel and flush it */ if (devpriv->dma_current == devpriv->dma0) { devpriv->dma_current = devpriv->dma1; devpriv->dma_current_buf = devpriv->ai_buf1; @@ -1077,7 +1077,7 @@ static void das1800_flush_dma(struct comedi_device * dev, struct comedi_subdevic release_dma_lock(flags); - // get any remaining samples in fifo + /* get any remaining samples in fifo */ das1800_handle_fifo_not_empty(dev, s); return; @@ -1180,7 +1180,7 @@ static int das1800_ai_do_cmdtest(struct comedi_device * dev, struct comedi_subde /* step 2: make sure trigger sources are unique and mutually compatible */ - // uniqueness check + /* uniqueness check */ if (cmd->start_src != TRIG_NOW && cmd->start_src != TRIG_EXT) err++; if (cmd->scan_begin_src != TRIG_FOLLOW && @@ -1192,7 +1192,7 @@ static int das1800_ai_do_cmdtest(struct comedi_device * dev, struct comedi_subde if (cmd->stop_src != TRIG_COUNT && cmd->stop_src != TRIG_NONE && cmd->stop_src != TRIG_EXT) err++; - //compatibility check + /* compatibility check */ if (cmd->scan_begin_src != TRIG_FOLLOW && cmd->convert_src != TRIG_TIMER) err++; @@ -1244,7 +1244,7 @@ static int das1800_ai_do_cmdtest(struct comedi_device * dev, struct comedi_subde /* step 4: fix up any arguments */ if (cmd->convert_src == TRIG_TIMER) { - // if we are not in burst mode + /* if we are not in burst mode */ if (cmd->scan_begin_src == TRIG_FOLLOW) { tmp_arg = cmd->convert_arg; /* calculate counter values that give desired timing */ @@ -1255,9 +1255,9 @@ static int das1800_ai_do_cmdtest(struct comedi_device * dev, struct comedi_subde if (tmp_arg != cmd->convert_arg) err++; } - // if we are in burst mode + /* if we are in burst mode */ else { - // check that convert_arg is compatible + /* check that convert_arg is compatible */ tmp_arg = cmd->convert_arg; cmd->convert_arg = burst_convert_arg(cmd->convert_arg, @@ -1266,7 +1266,7 @@ static int das1800_ai_do_cmdtest(struct comedi_device * dev, struct comedi_subde err++; if (cmd->scan_begin_src == TRIG_TIMER) { - // if scans are timed faster than conversion rate allows + /* if scans are timed faster than conversion rate allows */ if (cmd->convert_arg * cmd->chanlist_len > cmd->scan_begin_arg) { cmd->scan_begin_arg = @@ -1290,7 +1290,7 @@ static int das1800_ai_do_cmdtest(struct comedi_device * dev, struct comedi_subde if (err) return 4; - // make sure user is not trying to mix unipolar and bipolar ranges + /* make sure user is not trying to mix unipolar and bipolar ranges */ if (cmd->chanlist) { unipolar = CR_RANGE(cmd->chanlist[0]) & UNIPOLAR; for (i = 1; i < cmd->chanlist_len; i++) { @@ -1311,14 +1311,14 @@ static int das1800_ai_do_cmdtest(struct comedi_device * dev, struct comedi_subde /* analog input cmd interface */ -// first, some utility functions used in the main ai_do_cmd() +/* first, some utility functions used in the main ai_do_cmd() */ -// returns appropriate bits for control register a, depending on command +/* returns appropriate bits for control register a, depending on command */ static int control_a_bits(struct comedi_cmd cmd) { int control_a; - control_a = FFEN; //enable fifo + control_a = FFEN; /* enable fifo */ if (cmd.stop_src == TRIG_EXT) { control_a |= ATEN; } @@ -1336,7 +1336,7 @@ static int control_a_bits(struct comedi_cmd cmd) return control_a; } -// returns appropriate bits for control register c, depending on command +/* returns appropriate bits for control register c, depending on command */ static int control_c_bits(struct comedi_cmd cmd) { int control_c; @@ -1346,7 +1346,7 @@ static int control_c_bits(struct comedi_cmd cmd) * select unipolar / bipolar */ aref = CR_AREF(cmd.chanlist[0]); - control_c = UQEN; //enable upper qram addresses + control_c = UQEN; /* enable upper qram addresses */ if (aref != AREF_DIFF) control_c |= SD; if (aref == AREF_COMMON) @@ -1355,7 +1355,7 @@ static int control_c_bits(struct comedi_cmd cmd) if (CR_RANGE(cmd.chanlist[0]) & UNIPOLAR) control_c |= UB; switch (cmd.scan_begin_src) { - case TRIG_FOLLOW: // not in burst mode + case TRIG_FOLLOW: /* not in burst mode */ switch (cmd.convert_src) { case TRIG_TIMER: /* trig on cascaded counters */ @@ -1370,11 +1370,11 @@ static int control_c_bits(struct comedi_cmd cmd) } break; case TRIG_TIMER: - // burst mode with internal pacer clock + /* burst mode with internal pacer clock */ control_c |= BMDE | IPCLK; break; case TRIG_EXT: - // burst mode with external trigger + /* burst mode with external trigger */ control_c |= BMDE | XPCLK; break; default: @@ -1384,12 +1384,12 @@ static int control_c_bits(struct comedi_cmd cmd) return control_c; } -// sets up counters +/* sets up counters */ static int setup_counters(struct comedi_device * dev, struct comedi_cmd cmd) { - // setup cascaded counters for conversion/scan frequency + /* setup cascaded counters for conversion/scan frequency */ switch (cmd.scan_begin_src) { - case TRIG_FOLLOW: // not in burst mode + case TRIG_FOLLOW: /* not in burst mode */ if (cmd.convert_src == TRIG_TIMER) { /* set conversion frequency */ i8253_cascade_ns_to_timer_2div(TIMER_BASE, @@ -1401,7 +1401,7 @@ static int setup_counters(struct comedi_device * dev, struct comedi_cmd cmd) } } break; - case TRIG_TIMER: // in burst mode + case TRIG_TIMER: /* in burst mode */ /* set scan frequency */ i8253_cascade_ns_to_timer_2div(TIMER_BASE, &(devpriv->divisor1), &(devpriv->divisor2), &(cmd.scan_begin_arg), @@ -1414,16 +1414,16 @@ static int setup_counters(struct comedi_device * dev, struct comedi_cmd cmd) break; } - // setup counter 0 for 'about triggering' + /* setup counter 0 for 'about triggering' */ if (cmd.stop_src == TRIG_EXT) { - // load counter 0 in mode 0 + /* load counter 0 in mode 0 */ i8254_load(dev->iobase + DAS1800_COUNTER, 0, 0, 1, 0); } return 0; } -// sets up dma +/* sets up dma */ static void setup_dma(struct comedi_device * dev, struct comedi_cmd cmd) { unsigned long lock_flags; @@ -1440,19 +1440,19 @@ static void setup_dma(struct comedi_device * dev, struct comedi_cmd cmd) * count and address get set correctly */ clear_dma_ff(devpriv->dma0); set_dma_addr(devpriv->dma0, virt_to_bus(devpriv->ai_buf0)); - // set appropriate size of transfer + /* set appropriate size of transfer */ set_dma_count(devpriv->dma0, devpriv->dma_transfer_size); devpriv->dma_current = devpriv->dma0; devpriv->dma_current_buf = devpriv->ai_buf0; enable_dma(devpriv->dma0); - // set up dual dma if appropriate + /* set up dual dma if appropriate */ if (dual_dma) { disable_dma(devpriv->dma1); /* clear flip-flop to make sure 2-byte registers for * count and address get set correctly */ clear_dma_ff(devpriv->dma1); set_dma_addr(devpriv->dma1, virt_to_bus(devpriv->ai_buf1)); - // set appropriate size of transfer + /* set appropriate size of transfer */ set_dma_count(devpriv->dma1, devpriv->dma_transfer_size); enable_dma(devpriv->dma1); } @@ -1461,16 +1461,16 @@ static void setup_dma(struct comedi_device * dev, struct comedi_cmd cmd) return; } -// programs channel/gain list into card +/* programs channel/gain list into card */ static void program_chanlist(struct comedi_device * dev, struct comedi_cmd cmd) { int i, n, chan_range; unsigned long irq_flags; - const int range_mask = 0x3; //masks unipolar/bipolar bit off range + const int range_mask = 0x3; /* masks unipolar/bipolar bit off range */ const int range_bitshift = 8; n = cmd.chanlist_len; - // spinlock protects indirect addressing + /* spinlock protects indirect addressing */ comedi_spin_lock_irqsave(&dev->spinlock, irq_flags); outb(QRAM, dev->iobase + DAS1800_SELECT); /* select QRAM for baseAddress + 0x0 */ outb(n - 1, dev->iobase + DAS1800_QRAM_ADDRESS); /*set QRAM address start */ @@ -1488,7 +1488,7 @@ static void program_chanlist(struct comedi_device * dev, struct comedi_cmd cmd) return; } -// analog input do_cmd +/* analog input do_cmd */ static int das1800_ai_do_cmd(struct comedi_device * dev, struct comedi_subdevice * s) { int ret; @@ -1509,22 +1509,22 @@ static int das1800_ai_do_cmd(struct comedi_device * dev, struct comedi_subdevice } else { devpriv->irq_dma_bits |= devpriv->dma_bits; } - // interrupt on end of conversion for TRIG_WAKE_EOS + /* interrupt on end of conversion for TRIG_WAKE_EOS */ if (cmd.flags & TRIG_WAKE_EOS) { - // interrupt fifo not empty + /* interrupt fifo not empty */ devpriv->irq_dma_bits &= ~FIMD; } else { - // interrupt fifo half full + /* interrupt fifo half full */ devpriv->irq_dma_bits |= FIMD; } - // determine how many conversions we need + /* determine how many conversions we need */ if (cmd.stop_src == TRIG_COUNT) { devpriv->count = cmd.stop_arg * cmd.chanlist_len; } das1800_cancel(dev, s); - // determine proper bits for control registers + /* determine proper bits for control registers */ control_a = control_a_bits(cmd); control_c = control_c_bits(cmd); @@ -1537,14 +1537,14 @@ static int das1800_ai_do_cmd(struct comedi_device * dev, struct comedi_subdevice } setup_dma(dev, cmd); outb(control_c, dev->iobase + DAS1800_CONTROL_C); - // set conversion rate and length for burst mode + /* set conversion rate and length for burst mode */ if (control_c & BMDE) { - // program conversion period with number of microseconds minus 1 + /* program conversion period with number of microseconds minus 1 */ outb(cmd.convert_arg / 1000 - 1, dev->iobase + DAS1800_BURST_RATE); outb(cmd.chanlist_len - 1, dev->iobase + DAS1800_BURST_LENGTH); } - outb(devpriv->irq_dma_bits, dev->iobase + DAS1800_CONTROL_B); // enable irq/dma + outb(devpriv->irq_dma_bits, dev->iobase + DAS1800_CONTROL_B); /* enable irq/dma */ outb(control_a, dev->iobase + DAS1800_CONTROL_A); /* enable fifo and triggering */ outb(CVEN, dev->iobase + DAS1800_STATUS); /* enable conversions */ @@ -1616,21 +1616,21 @@ static int das1800_ao_winsn(struct comedi_device * dev, struct comedi_subdevice struct comedi_insn * insn, unsigned int * data) { int chan = CR_CHAN(insn->chanspec); -// int range = CR_RANGE(insn->chanspec); +/* int range = CR_RANGE(insn->chanspec); */ int update_chan = thisboard->ao_n_chan - 1; short output; unsigned long irq_flags; - // card expects two's complement data + /* card expects two's complement data */ output = data[0] - (1 << (thisboard->resolution - 1)); - // if the write is to the 'update' channel, we need to remember its value + /* if the write is to the 'update' channel, we need to remember its value */ if (chan == update_chan) devpriv->ao_update_bits = output; - // write to channel + /* write to channel */ comedi_spin_lock_irqsave(&dev->spinlock, irq_flags); outb(DAC(chan), dev->iobase + DAS1800_SELECT); /* select dac channel for baseAddress + 0x0 */ outw(output, dev->iobase + DAS1800_DAC); - // now we need to write to 'update' channel to update all dac channels + /* now we need to write to 'update' channel to update all dac channels */ if (chan != update_chan) { outb(DAC(update_chan), dev->iobase + DAS1800_SELECT); /* select 'update' channel for baseAddress + 0x0 */ outw(devpriv->ao_update_bits, dev->iobase + DAS1800_DAC); @@ -1657,7 +1657,7 @@ static int das1800_do_wbits(struct comedi_device * dev, struct comedi_subdevice { unsigned int wbits; - // only set bits that have been masked + /* only set bits that have been masked */ data[0] &= (1 << s->n_chan) - 1; wbits = devpriv->do_bits; wbits &= ~data[0]; @@ -1676,11 +1676,11 @@ static int das1800_set_frequency(struct comedi_device * dev) { int err = 0; - // counter 1, mode 2 + /* counter 1, mode 2 */ if (i8254_load(dev->iobase + DAS1800_COUNTER, 0, 1, devpriv->divisor1, 2)) err++; - // counter 2, mode 2 + /* counter 2, mode 2 */ if (i8254_load(dev->iobase + DAS1800_COUNTER, 0, 2, devpriv->divisor2, 2)) err++; @@ -1697,11 +1697,11 @@ static unsigned int burst_convert_arg(unsigned int convert_arg, int round_mode) { unsigned int micro_sec; - // in burst mode, the maximum conversion time is 64 microseconds + /* in burst mode, the maximum conversion time is 64 microseconds */ if (convert_arg > 64000) convert_arg = 64000; - // the conversion time must be an integral number of microseconds + /* the conversion time must be an integral number of microseconds */ switch (round_mode) { case TRIG_ROUND_NEAREST: default: @@ -1715,21 +1715,21 @@ static unsigned int burst_convert_arg(unsigned int convert_arg, int round_mode) break; } - // return number of nanoseconds + /* return number of nanoseconds */ return micro_sec * 1000; } -// utility function that suggests a dma transfer size based on the conversion period 'ns' +/* utility function that suggests a dma transfer size based on the conversion period 'ns' */ static unsigned int suggest_transfer_size(struct comedi_cmd * cmd) { unsigned int size = DMA_BUF_SIZE; - static const int sample_size = 2; // size in bytes of one sample from board - unsigned int fill_time = 300000000; // target time in nanoseconds for filling dma buffer - unsigned int max_size; // maximum size we will allow for a transfer + static const int sample_size = 2; /* size in bytes of one sample from board */ + unsigned int fill_time = 300000000; /* target time in nanoseconds for filling dma buffer */ + unsigned int max_size; /* maximum size we will allow for a transfer */ - // make dma buffer fill in 0.3 seconds for timed modes + /* make dma buffer fill in 0.3 seconds for timed modes */ switch (cmd->scan_begin_src) { - case TRIG_FOLLOW: // not in burst mode + case TRIG_FOLLOW: /* not in burst mode */ if (cmd->convert_src == TRIG_TIMER) size = (fill_time / cmd->convert_arg) * sample_size; break; @@ -1742,9 +1742,9 @@ static unsigned int suggest_transfer_size(struct comedi_cmd * cmd) break; } - // set a minimum and maximum size allowed + /* set a minimum and maximum size allowed */ max_size = DMA_BUF_SIZE; - // if we are taking limited number of conversions, limit transfer size to that + /* if we are taking limited number of conversions, limit transfer size to that */ if (cmd->stop_src == TRIG_COUNT && cmd->stop_arg * cmd->chanlist_len * sample_size < max_size) max_size = cmd->stop_arg * cmd->chanlist_len * sample_size; diff --git a/drivers/staging/comedi/drivers/das6402.c b/drivers/staging/comedi/drivers/das6402.c index 2a8ca0525104..ed9409d41a32 100644 --- a/drivers/staging/comedi/drivers/das6402.c +++ b/drivers/staging/comedi/drivers/das6402.c @@ -151,7 +151,7 @@ static void das6402_setcounter(struct comedi_device * dev) outb_p(p, dev->iobase + 14); } -static irqreturn_t intr_handler(int irq, void *d PT_REGS_ARG) +static irqreturn_t intr_handler(int irq, void *d) { struct comedi_device *dev = d; struct comedi_subdevice *s = dev->subdevices; @@ -342,7 +342,7 @@ static int das6402_attach(struct comedi_device * dev, struct comedi_devconfig * s->type = COMEDI_SUBD_AI; s->subdev_flags = SDF_READABLE | SDF_GROUND; s->n_chan = 8; - //s->trig[2]=das6402_ai_mode2; + /* s->trig[2]=das6402_ai_mode2; */ s->cancel = das6402_ai_cancel; s->maxdata = (1 << 12) - 1; s->len_chanlist = 16; /* ? */ diff --git a/drivers/staging/comedi/drivers/das800.c b/drivers/staging/comedi/drivers/das800.c index 7a6656bf809c..eafee0c655aa 100644 --- a/drivers/staging/comedi/drivers/das800.c +++ b/drivers/staging/comedi/drivers/das800.c @@ -72,7 +72,7 @@ cmd triggers supported: #define DAS800_SIZE 8 #define TIMER_BASE 1000 -#define N_CHAN_AI 8 // number of analog input channels +#define N_CHAN_AI 8 /* number of analog input channels */ /* Registers for the das800 */ @@ -94,8 +94,8 @@ cmd triggers supported: #define IRQ 0x8 #define BUSY 0x80 #define DAS800_GAIN 3 -#define CIO_FFOV 0x8 // fifo overflow for cio-das802/16 -#define CIO_ENHF 0x90 // interrupt fifo half full for cio-das802/16 +#define CIO_FFOV 0x8 /* fifo overflow for cio-das802/16 */ +#define CIO_ENHF 0x90 /* interrupt fifo half full for cio-das802/16 */ #define CONTROL1 0x80 #define CONV_CONTROL 0xa0 #define SCAN_LIMITS 0xc0 @@ -113,7 +113,7 @@ struct das800_board { int resolution; }; -//analog input ranges +/* analog input ranges */ static const struct comedi_lrange range_das800_ai = { 1, { @@ -256,7 +256,7 @@ static struct comedi_driver driver_das800 = { offset:sizeof(struct das800_board), }; -static irqreturn_t das800_interrupt(int irq, void *d PT_REGS_ARG); +static irqreturn_t das800_interrupt(int irq, void *d); static void enable_das800(struct comedi_device * dev); static void disable_das800(struct comedi_device * dev); static int das800_ai_do_cmdtest(struct comedi_device * dev, struct comedi_subdevice * s, @@ -278,7 +278,7 @@ static int das800_probe(struct comedi_device * dev) unsigned long irq_flags; int board; - // 'comedi spin lock irqsave' disables even rt interrupts, we use them to protect indirect addressing + /* 'comedi spin lock irqsave' disables even rt interrupts, we use them to protect indirect addressing */ comedi_spin_lock_irqsave(&dev->spinlock, irq_flags); outb(ID, dev->iobase + DAS800_GAIN); /* select base address + 7 to be ID register */ id_bits = inb(dev->iobase + DAS800_ID) & 0x3; /* get id bits */ @@ -343,7 +343,7 @@ static int das800_probe(struct comedi_device * dev) COMEDI_INITCLEANUP(driver_das800); /* interrupt service routine */ -static irqreturn_t das800_interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t das800_interrupt(int irq, void *d) { short i; /* loop index */ short dataPoint = 0; @@ -352,8 +352,8 @@ static irqreturn_t das800_interrupt(int irq, void *d PT_REGS_ARG) struct comedi_async *async; int status; unsigned long irq_flags; - static const int max_loops = 128; // half-fifo size for cio-das802/16 - // flags + static const int max_loops = 128; /* half-fifo size for cio-das802/16 */ + /* flags */ int fifo_empty = 0; int fifo_overflow = 0; @@ -369,7 +369,7 @@ static irqreturn_t das800_interrupt(int irq, void *d PT_REGS_ARG) */ async = s->async; - // if hardware conversions are not enabled, then quit + /* if hardware conversions are not enabled, then quit */ comedi_spin_lock_irqsave(&dev->spinlock, irq_flags); outb(CONTROL1, dev->iobase + DAS800_GAIN); /* select base address + 7 to be STATUS2 register */ status = inb(dev->iobase + DAS800_STATUS2) & STATUS2_HCEN; @@ -390,7 +390,7 @@ static irqreturn_t das800_interrupt(int irq, void *d PT_REGS_ARG) if (fifo_overflow) break; } else { - fifo_empty = 0; // cio-das802/16 has no fifo empty status bit + fifo_empty = 0; /* cio-das802/16 has no fifo empty status bit */ } if (fifo_empty) { break; @@ -410,7 +410,7 @@ static irqreturn_t das800_interrupt(int irq, void *d PT_REGS_ARG) /* check for fifo overflow */ if (thisboard->resolution == 12) { fifo_overflow = dataPoint & FIFO_OVF; - // else cio-das802/16 + /* else cio-das802/16 */ } else { fifo_overflow = inb(dev->iobase + DAS800_GAIN) & CIO_FFOV; } @@ -564,7 +564,7 @@ static void enable_das800(struct comedi_device * dev) { unsigned long irq_flags; comedi_spin_lock_irqsave(&dev->spinlock, irq_flags); - // enable fifo-half full interrupts for cio-das802/16 + /* enable fifo-half full interrupts for cio-das802/16 */ if (thisboard->resolution == 16) outb(CIO_ENHF, dev->iobase + DAS800_GAIN); outb(CONV_CONTROL, dev->iobase + DAS800_GAIN); /* select dev->iobase + 2 to be conversion control register */ @@ -684,7 +684,7 @@ static int das800_ai_do_cmdtest(struct comedi_device * dev, struct comedi_subdev if (err) return 4; - // check channel/gain list against card's limitations + /* check channel/gain list against card's limitations */ if (cmd->chanlist) { gain = CR_RANGE(cmd->chanlist[0]); startChan = CR_CHAN(cmd->chanlist[0]); @@ -861,7 +861,7 @@ static int das800_do_wbits(struct comedi_device * dev, struct comedi_subdevice * int wbits; unsigned long irq_flags; - // only set bits that have been masked + /* only set bits that have been masked */ data[0] &= 0xf; wbits = devpriv->do_bits >> 4; wbits &= ~data[0]; diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c index 829083651edc..d627479ff71a 100644 --- a/drivers/staging/comedi/drivers/dmm32at.c +++ b/drivers/staging/comedi/drivers/dmm32at.c @@ -304,7 +304,7 @@ static int dmm32at_ai_cmdtest(struct comedi_device * dev, struct comedi_subdevic static int dmm32at_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s); static int dmm32at_ai_cancel(struct comedi_device * dev, struct comedi_subdevice * s); static int dmm32at_ns_to_timer(unsigned int *ns, int round); -static irqreturn_t dmm32at_isr(int irq, void *d PT_REGS_ARG); +static irqreturn_t dmm32at_isr(int irq, void *d); void dmm32at_setaitimer(struct comedi_device * dev, unsigned int nansec); /* @@ -394,7 +394,7 @@ static int dmm32at_attach(struct comedi_device * dev, struct comedi_devconfig * * it is, this is the place to do it. Otherwise, dev->board_ptr * should already be initialized. */ - //dev->board_ptr = dmm32at_probe(dev); + /* dev->board_ptr = dmm32at_probe(dev); */ /* * Initialize dev->board_name. Note that we can use the "thisboard" @@ -512,7 +512,7 @@ static int dmm32at_ai_rinsn(struct comedi_device * dev, struct comedi_subdevice chan = CR_CHAN(insn->chanspec) & (s->n_chan - 1); range = CR_RANGE(insn->chanspec); - //printk("channel=0x%02x, range=%d\n",chan,range); + /* printk("channel=0x%02x, range=%d\n",chan,range); */ /* zero scan and fifo control and reset fifo */ dmm_outb(dev, DMM32AT_FIFOCNTRL, DMM32AT_FIFORESET); @@ -575,7 +575,7 @@ static int dmm32at_ai_cmdtest(struct comedi_device * dev, struct comedi_subdevic int tmp; int start_chan, gain, i; - //printk("dmmat32 in command test\n"); + /* 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 @@ -828,7 +828,7 @@ static int dmm32at_ai_cancel(struct comedi_device * dev, struct comedi_subdevice return 0; } -static irqreturn_t dmm32at_isr(int irq, void *d PT_REGS_ARG) +static irqreturn_t dmm32at_isr(int irq, void *d) { unsigned char intstat; unsigned int samp; @@ -910,7 +910,7 @@ static int dmm32at_ao_winsn(struct comedi_device * dev, struct comedi_subdevice 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); + /* 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); @@ -967,7 +967,7 @@ static int dmm32at_dio_insn_bits(struct comedi_device * dev, struct comedi_subde s->state &= ~data[0]; s->state |= data[0] & data[1]; /* Write out the new digital output lines */ - //outw(s->state,dev->iobase + DMM32AT_DIO); + /* outw(s->state,dev->iobase + DMM32AT_DIO); */ } /* get access to the DIO regs */ @@ -998,10 +998,10 @@ static int dmm32at_dio_insn_bits(struct comedi_device * dev, struct comedi_subde /* on return, data[1] contains the value of the digital * input and output lines. */ - //data[1]=inw(dev->iobase + DMM32AT_DIO); + /* 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; + /* data[1]=s->state; */ return 2; } diff --git a/drivers/staging/comedi/drivers/dt2801.c b/drivers/staging/comedi/drivers/dt2801.c index 5e0eed835d1a..c3b927dc8886 100644 --- a/drivers/staging/comedi/drivers/dt2801.c +++ b/drivers/staging/comedi/drivers/dt2801.c @@ -100,7 +100,7 @@ static struct comedi_driver driver_dt2801 = { COMEDI_INITCLEANUP(driver_dt2801); #if 0 -// ignore 'defined but not used' warning +/* ignore 'defined but not used' warning */ static const struct comedi_lrange range_dt2801_ai_pgh_bipolar = { 4, { RANGE(-10, 10), RANGE(-5, 5), @@ -118,7 +118,7 @@ static const struct comedi_lrange range_dt2801_ai_pgl_bipolar = { 4, { }; #if 0 -// ignore 'defined but not used' warning +/* ignore 'defined but not used' warning */ static const struct comedi_lrange range_dt2801_ai_pgh_unipolar = { 4, { RANGE(0, 10), RANGE(0, 5), @@ -381,10 +381,10 @@ static int dt2801_reset(struct comedi_device * dev) inb_p(dev->iobase + DT2801_DATA); DPRINTK("dt2801: stop\n"); - //dt2801_writecmd(dev,DT_C_STOP); + /* dt2801_writecmd(dev,DT_C_STOP); */ outb_p(DT_C_STOP, dev->iobase + DT2801_CMD); - //dt2801_wait_for_ready(dev); + /* dt2801_wait_for_ready(dev); */ comedi_udelay(100); timeout = 10000; do { @@ -395,12 +395,13 @@ static int dt2801_reset(struct comedi_device * dev) if (!timeout) { printk("dt2801: timeout 1 status=0x%02x\n", stat); } - //printk("dt2801: reading dummy\n"); - //dt2801_readdata(dev,&board_code); + + /* printk("dt2801: reading dummy\n"); */ + /* dt2801_readdata(dev,&board_code); */ DPRINTK("dt2801: reset\n"); outb_p(DT_C_RESET, dev->iobase + DT2801_CMD); - //dt2801_writecmd(dev,DT_C_RESET); + /* dt2801_writecmd(dev,DT_C_RESET); */ comedi_udelay(100); timeout = 10000; diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index 795932ec67d3..c6908075ab04 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -265,7 +265,7 @@ static const struct comedi_lrange *dac_range_types[] = { #define DT2811_TIMEOUT 5 #if 0 -static irqreturn_t dt2811_interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t dt2811_interrupt(int irq, void *d) { int lo, hi; int data; @@ -313,9 +313,10 @@ static irqreturn_t dt2811_interrupt(int irq, void *d PT_REGS_ARG) static int dt2811_attach(struct comedi_device * dev, struct comedi_devconfig * it) { - //int i, irq; - //unsigned long irqs; - //long flags; + /* int i, irq; */ + /* unsigned long irqs; */ + /* long flags; */ + int ret; struct comedi_subdevice *s; unsigned long iobase; @@ -531,7 +532,7 @@ int dt2811_adtrig(kdev_t minor, comedi_adtrig * adtrig) case COMEDI_MDEMAND: dev->ntrig = adtrig->n - 1; /*printk("dt2811: AD soft trigger\n"); */ - /*outb(DT2811_CLRERROR|DT2811_INTENB,dev->iobase+DT2811_ADCSR); *//* not neccessary */ + /*outb(DT2811_CLRERROR|DT2811_INTENB,dev->iobase+DT2811_ADCSR); */ /* not neccessary */ outb(dev->curadchan, dev->iobase + DT2811_ADGCR); do_gettimeofday(&trigtime); break; diff --git a/drivers/staging/comedi/drivers/dt2814.c b/drivers/staging/comedi/drivers/dt2814.c index 8320139160a4..e806520b5879 100644 --- a/drivers/staging/comedi/drivers/dt2814.c +++ b/drivers/staging/comedi/drivers/dt2814.c @@ -70,7 +70,7 @@ static struct comedi_driver driver_dt2814 = { COMEDI_INITCLEANUP(driver_dt2814); -static irqreturn_t dt2814_interrupt(int irq, void *dev PT_REGS_ARG); +static irqreturn_t dt2814_interrupt(int irq, void *dev); struct dt2814_private { @@ -343,7 +343,7 @@ static int dt2814_detach(struct comedi_device * dev) return 0; } -static irqreturn_t dt2814_interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t dt2814_interrupt(int irq, void *d) { int lo, hi; struct comedi_device *dev = d; diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c index 4882c3e679cc..275644ac4b94 100644 --- a/drivers/staging/comedi/drivers/dt282x.c +++ b/drivers/staging/comedi/drivers/dt282x.c @@ -577,7 +577,7 @@ static int prep_ao_dma(struct comedi_device * dev, int dma_index, int n) return n; } -static irqreturn_t dt282x_interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t dt282x_interrupt(int irq, void *d) { struct comedi_device *dev = d; struct comedi_subdevice *s; diff --git a/drivers/staging/comedi/drivers/dt3000.c b/drivers/staging/comedi/drivers/dt3000.c index d9467984706e..dabc09705048 100644 --- a/drivers/staging/comedi/drivers/dt3000.c +++ b/drivers/staging/comedi/drivers/dt3000.c @@ -345,9 +345,9 @@ static void dt3k_writesingle(struct comedi_device * dev, unsigned int subsys, static int debug_n_ints = 0; -// FIXME! Assumes shared interrupt is for this card. -// What's this debug_n_ints stuff? Obviously needs some work... -static irqreturn_t dt3k_interrupt(int irq, void *d PT_REGS_ARG) +/* FIXME! Assumes shared interrupt is for this card. */ +/* What's this debug_n_ints stuff? Obviously needs some work... */ +static irqreturn_t dt3k_interrupt(int irq, void *d) { struct comedi_device *dev = d; struct comedi_subdevice *s; diff --git a/drivers/staging/comedi/drivers/gsc_hpdi.c b/drivers/staging/comedi/drivers/gsc_hpdi.c index 49e5c86c2dd8..cd5772f90aa1 100644 --- a/drivers/staging/comedi/drivers/gsc_hpdi.c +++ b/drivers/staging/comedi/drivers/gsc_hpdi.c @@ -59,11 +59,11 @@ static int hpdi_cmd(struct comedi_device * dev, struct comedi_subdevice * s); static int hpdi_cmd_test(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_cmd * cmd); static int hpdi_cancel(struct comedi_device * dev, struct comedi_subdevice * s); -static irqreturn_t handle_interrupt(int irq, void *d PT_REGS_ARG); +static irqreturn_t handle_interrupt(int irq, void *d); static int dio_config_block_size(struct comedi_device * dev, unsigned int * data); -#undef HPDI_DEBUG // disable debugging messages -//#define HPDI_DEBUG // enable debugging code +#undef HPDI_DEBUG /* disable debugging messages */ +/* #define HPDI_DEBUG enable debugging code */ #ifdef HPDI_DEBUG #define DEBUG_PRINT(format, args...) rt_printk(format , ## args ) @@ -71,12 +71,12 @@ static int dio_config_block_size(struct comedi_device * dev, unsigned int * data #define DEBUG_PRINT(format, args...) #endif -#define TIMER_BASE 50 // 20MHz master clock +#define TIMER_BASE 50 /* 20MHz master clock */ #define DMA_BUFFER_SIZE 0x10000 #define NUM_DMA_BUFFERS 4 #define NUM_DMA_DESCRIPTORS 256 -// indices of base address regions +/* indices of base address regions */ enum base_address_regions { PLX9080_BADDRINDEX = 0, HPDI_BADDRINDEX = 2, @@ -115,7 +115,7 @@ int command_channel_valid(unsigned int channel) return 1; } -// bit definitions +/* bit definitions */ enum firmware_revision_bits { FEATURES_REG_PRESENT_BIT = 0x8000, @@ -184,7 +184,7 @@ enum board_status_bits { uint32_t almost_full_bits(unsigned int num_words) { -// XXX need to add or subtract one? +/* XXX need to add or subtract one? */ return (num_words << 16) & 0xff0000; } @@ -194,7 +194,7 @@ uint32_t almost_empty_bits(unsigned int num_words) } unsigned int almost_full_num_words(uint32_t bits) { -// XXX need to add or subtract one? +/* XXX need to add or subtract one? */ return (bits >> 16) & 0xffff; } unsigned int almost_empty_num_words(uint32_t bits) @@ -263,8 +263,8 @@ uint32_t intr_active_high_bit(int interrupt_source) struct hpdi_board { char *name; - int device_id; // pci device id - int subdevice_id; // pci subdevice id + int device_id; /* pci device id */ + int subdevice_id; /* pci subdevice id */ }; @@ -303,25 +303,25 @@ static inline struct hpdi_board *board(const struct comedi_device * dev) struct hpdi_private { - struct pci_dev *hw_dev; // pointer to board's pci_dev struct - // base addresses (physical) + struct pci_dev *hw_dev; /* pointer to board's pci_dev struct */ + /* base addresses (physical) */ resource_size_t plx9080_phys_iobase; resource_size_t hpdi_phys_iobase; - // base addresses (ioremapped) + /* base addresses (ioremapped) */ 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 - dma_addr_t dma_desc_phys_addr; // physical address of dma descriptor array + 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 */ + dma_addr_t dma_desc_phys_addr; /* physical address of dma descriptor array */ unsigned int num_dma_descriptors; - uint32_t *desc_dio_buffer[NUM_DMA_DESCRIPTORS]; // pointer to start of buffers indexed by descriptor - volatile unsigned int dma_desc_index; // index of the dma descriptor that is currently being used + uint32_t *desc_dio_buffer[NUM_DMA_DESCRIPTORS]; /* pointer to start of buffers indexed by descriptor */ + volatile unsigned int dma_desc_index; /* index of the dma descriptor that is currently being used */ unsigned int tx_fifo_size; unsigned int rx_fifo_size; volatile unsigned long dio_count; - volatile uint32_t bits[24]; // software copies of values written to hpdi registers - volatile unsigned int block_size; // number of bytes at which to generate COMEDI_CB_BLOCK events + volatile uint32_t bits[24]; /* software copies of values written to hpdi registers */ + volatile unsigned int block_size; /* number of bytes at which to generate COMEDI_CB_BLOCK events */ unsigned dio_config_output:1; }; @@ -373,13 +373,13 @@ static void disable_plx_interrupts(struct comedi_device * dev) writel(0, priv(dev)->plx9080_iobase + PLX_INTRCS_REG); } -// initialize plx9080 chip +/* initialize plx9080 chip */ static void init_plx9080(struct comedi_device * dev) { uint32_t bits; void *plx_iobase = priv(dev)->plx9080_iobase; - // plx9080 dump + /* plx9080 dump */ DEBUG_PRINT(" plx interrupt status 0x%x\n", readl(plx_iobase + PLX_INTRCS_REG)); DEBUG_PRINT(" plx id bits 0x%x\n", readl(plx_iobase + PLX_ID_REG)); @@ -417,21 +417,21 @@ static void init_plx9080(struct comedi_device * dev) abort_dma(dev, 0); abort_dma(dev, 1); - // configure dma0 mode + /* configure dma0 mode */ bits = 0; - // enable ready input + /* enable ready input */ bits |= PLX_DMA_EN_READYIN_BIT; - // enable dma chaining + /* enable dma chaining */ bits |= PLX_EN_CHAIN_BIT; - // enable interrupt on dma done (probably don't need this, since chain never finishes) + /* enable interrupt on dma done (probably don't need this, since chain never finishes) */ bits |= PLX_EN_DMA_DONE_INTR_BIT; - // don't increment local address during transfers (we are transferring from a fixed fifo register) + /* don't increment local address during transfers (we are transferring from a fixed fifo register) */ bits |= PLX_LOCAL_ADDR_CONST_BIT; - // route dma interrupt to pci bus + /* route dma interrupt to pci bus */ bits |= PLX_DMA_INTR_PCI_BIT; - // enable demand mode + /* enable demand mode */ bits |= PLX_DEMAND_MODE_BIT; - // enable local burst mode + /* enable local burst mode */ bits |= PLX_DMA_LOCAL_BURST_EN_BIT; bits |= PLX_LOCAL_BUS_32_WIDE_BITS; writel(bits, plx_iobase + PLX_DMA0_MODE_REG); @@ -484,7 +484,7 @@ static int init_hpdi(struct comedi_device * dev) writel(0, priv(dev)->hpdi_iobase + INTERRUPT_CONTROL_REG); - // enable interrupts + /* enable interrupts */ plx_intcsr_bits = ICS_AERR | ICS_PERR | ICS_PIE | ICS_PLIE | ICS_PAIE | ICS_LIE | ICS_DMA0_E; @@ -493,7 +493,7 @@ static int init_hpdi(struct comedi_device * dev) return 0; } -// setup dma descriptors so a link completes every 'transfer_size' bytes +/* setup dma descriptors so a link completes every 'transfer_size' bytes */ static int setup_dma_descriptors(struct comedi_device * dev, unsigned int transfer_size) { @@ -545,7 +545,7 @@ static int setup_dma_descriptors(struct comedi_device * dev, (unsigned long)priv(dev)->dma_desc[i].next); } priv(dev)->num_dma_descriptors = i; - // fix last descriptor to point back to first + /* fix last descriptor to point back to first */ priv(dev)->dma_desc[i - 1].next = cpu_to_le32(priv(dev)->dma_desc_phys_addr | next_bits); DEBUG_PRINT(" desc %i next fixup 0x%lx\n", i - 1, @@ -573,9 +573,9 @@ static int hpdi_attach(struct comedi_device * dev, struct comedi_devconfig * it) pcidev = pci_get_subsys(PCI_VENDOR_ID_PLX, hpdi_boards[i].device_id, PCI_VENDOR_ID_PLX, hpdi_boards[i].subdevice_id, pcidev); - // was a particular bus/slot requested? + /* was a particular bus/slot requested? */ if (it->options[0] || it->options[1]) { - // are we on the wrong bus/slot? + /* are we on the wrong bus/slot? */ if (pcidev->bus->number != it->options[0] || PCI_SLOT(pcidev->devfn) != it->options[1]) @@ -603,7 +603,7 @@ static int hpdi_attach(struct comedi_device * dev, struct comedi_devconfig * it) } pci_set_master(pcidev); - //Initialize dev->board_name + /* Initialize dev->board_name */ dev->board_name = board(dev)->name; priv(dev)->plx9080_phys_iobase = @@ -611,7 +611,7 @@ static int hpdi_attach(struct comedi_device * dev, struct 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 + /* remap, won't work with 2.0 kernels but who cares */ priv(dev)->plx9080_iobase = ioremap(priv(dev)->plx9080_phys_iobase, pci_resource_len(pcidev, PLX9080_BADDRINDEX)); priv(dev)->hpdi_iobase = ioremap(priv(dev)->hpdi_phys_iobase, @@ -626,7 +626,7 @@ static int hpdi_attach(struct comedi_device * dev, struct comedi_devconfig * it) init_plx9080(dev); - // get irq + /* get irq */ if (comedi_request_irq(pcidev->irq, handle_interrupt, IRQF_SHARED, driver_hpdi.driver_name, dev)) { printk(" unable to allocate irq %u\n", pcidev->irq); @@ -636,7 +636,7 @@ static int hpdi_attach(struct comedi_device * dev, struct comedi_devconfig * it) printk(" irq %u\n", dev->irq); - // alocate pci dma buffers + /* alocate pci dma buffers */ for (i = 0; i < NUM_DMA_BUFFERS; i++) { priv(dev)->dio_buffer[i] = pci_alloc_consistent(priv(dev)->hw_dev, DMA_BUFFER_SIZE, @@ -645,7 +645,7 @@ static int hpdi_attach(struct comedi_device * dev, struct comedi_devconfig * it) priv(dev)->dio_buffer[i], (unsigned long)priv(dev)->dio_buffer_phys_addr[i]); } - // allocate dma descriptors + /* allocate dma descriptors */ priv(dev)->dma_desc = pci_alloc_consistent(priv(dev)->hw_dev, sizeof(struct plx_dma_desc) * NUM_DMA_DESCRIPTORS, &priv(dev)->dma_desc_phys_addr); @@ -681,7 +681,7 @@ static int hpdi_detach(struct comedi_device * dev) } if (priv(dev)->hpdi_iobase) iounmap((void *)priv(dev)->hpdi_iobase); - // free pci dma buffers + /* free pci dma buffers */ for (i = 0; i < NUM_DMA_BUFFERS; i++) { if (priv(dev)->dio_buffer[i]) pci_free_consistent(priv(dev)->hw_dev, @@ -690,7 +690,7 @@ static int hpdi_detach(struct comedi_device * dev) priv(dev)-> dio_buffer_phys_addr[i]); } - // free dma descriptors + /* free dma descriptors */ if (priv(dev)->dma_desc) pci_free_consistent(priv(dev)->hw_dev, sizeof(struct plx_dma_desc) * @@ -761,7 +761,7 @@ static int di_cmd_test(struct comedi_device * dev, struct comedi_subdevice * s, /* step 2: make sure trigger sources are unique and mutually compatible */ - // uniqueness check + /* uniqueness check */ if (cmd->stop_src != TRIG_COUNT && cmd->stop_src != TRIG_NONE) err++; @@ -807,7 +807,7 @@ static int di_cmd_test(struct comedi_device * dev, struct comedi_subdevice * s, if (cmd->chanlist) { for (i = 1; i < cmd->chanlist_len; i++) { if (CR_CHAN(cmd->chanlist[i]) != i) { - // XXX could support 8 channels or 16 channels + /* XXX could support 8 channels or 16 channels */ comedi_error(dev, "chanlist must be channels 0 to 31 in order"); err++; @@ -860,15 +860,15 @@ static int di_cmd(struct comedi_device * dev, struct comedi_subdevice * s) writel(0, priv(dev)->plx9080_iobase + PLX_DMA0_TRANSFER_SIZE_REG); writel(0, priv(dev)->plx9080_iobase + PLX_DMA0_PCI_ADDRESS_REG); writel(0, priv(dev)->plx9080_iobase + PLX_DMA0_LOCAL_ADDRESS_REG); - // give location of first dma descriptor + /* give location of first dma descriptor */ bits = priv(dev)-> dma_desc_phys_addr | PLX_DESC_IN_PCI_BIT | PLX_INTR_TERM_COUNT | PLX_XFER_LOCAL_TO_PCI; writel(bits, priv(dev)->plx9080_iobase + PLX_DMA0_DESCRIPTOR_REG); - // spinlock for plx dma control/status reg + /* spinlock for plx dma control/status reg */ comedi_spin_lock_irqsave(&dev->spinlock, flags); - // enable dma transfer + /* enable dma transfer */ writeb(PLX_DMA_EN_BIT | PLX_DMA_START_BIT | PLX_CLEAR_DMA_INTR_BIT, priv(dev)->plx9080_iobase + PLX_DMA0_CS_REG); comedi_spin_unlock_irqrestore(&dev->spinlock, flags); @@ -878,10 +878,10 @@ static int di_cmd(struct comedi_device * dev, struct comedi_subdevice * s) else priv(dev)->dio_count = 1; - // clear over/under run status flags + /* clear over/under run status flags */ writel(RX_UNDERRUN_BIT | RX_OVERRUN_BIT, priv(dev)->hpdi_iobase + BOARD_STATUS_REG); - // enable interrupts + /* enable interrupts */ writel(intr_bit(RX_FULL_INTR), priv(dev)->hpdi_iobase + INTERRUPT_CONTROL_REG); @@ -914,7 +914,7 @@ static void drain_dma_buffers(struct comedi_device * dev, unsigned int channel) pci_addr_reg = priv(dev)->plx9080_iobase + PLX_DMA0_PCI_ADDRESS_REG; - // loop until we have read all the full buffers + /* loop until we have read all the full buffers */ j = 0; for (next_transfer_addr = readl(pci_addr_reg); (next_transfer_addr < @@ -925,7 +925,7 @@ static void drain_dma_buffers(struct comedi_device * dev, unsigned int channel) dma_desc_index].pci_start_addr) + priv(dev)->block_size) && j < priv(dev)->num_dma_descriptors; j++) { - // transfer data from dma buffer to comedi buffer + /* transfer data from dma buffer to comedi buffer */ num_samples = priv(dev)->block_size / sizeof(uint32_t); if (async->cmd.stop_src == TRIG_COUNT) { if (num_samples > priv(dev)->dio_count) @@ -942,10 +942,10 @@ static void drain_dma_buffers(struct comedi_device * dev, unsigned int channel) priv(dev)->dma_desc[priv(dev)->dma_desc_index].next); DEBUG_PRINT("pci addr reg 0x%x\n", next_transfer_addr); } - // XXX check for buffer overrun somehow + /* XXX check for buffer overrun somehow */ } -static irqreturn_t handle_interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t handle_interrupt(int irq, void *d) { struct comedi_device *dev = d; struct comedi_subdevice *s = dev->read_subdev; @@ -975,10 +975,10 @@ static irqreturn_t handle_interrupt(int irq, void *d PT_REGS_ARG) writel(hpdi_intr_status, priv(dev)->hpdi_iobase + INTERRUPT_STATUS_REG); } - // spin lock makes sure noone else changes plx dma control reg + /* spin lock makes sure noone else changes plx dma control reg */ comedi_spin_lock_irqsave(&dev->spinlock, flags); dma0_status = readb(priv(dev)->plx9080_iobase + PLX_DMA0_CS_REG); - if (plx_status & ICS_DMA0_A) { // dma chan 0 interrupt + if (plx_status & ICS_DMA0_A) { /* dma chan 0 interrupt */ writeb((dma0_status & PLX_DMA_EN_BIT) | PLX_CLEAR_DMA_INTR_BIT, priv(dev)->plx9080_iobase + PLX_DMA0_CS_REG); @@ -990,11 +990,11 @@ static irqreturn_t handle_interrupt(int irq, void *d PT_REGS_ARG) } comedi_spin_unlock_irqrestore(&dev->spinlock, flags); - // spin lock makes sure noone else changes plx dma control reg + /* spin lock makes sure noone else changes plx dma control reg */ comedi_spin_lock_irqsave(&dev->spinlock, flags); dma1_status = readb(priv(dev)->plx9080_iobase + PLX_DMA1_CS_REG); - if (plx_status & ICS_DMA1_A) // XXX - { // dma chan 1 interrupt + if (plx_status & ICS_DMA1_A) /* XXX */ + { /* dma chan 1 interrupt */ writeb((dma1_status & PLX_DMA_EN_BIT) | PLX_CLEAR_DMA_INTR_BIT, priv(dev)->plx9080_iobase + PLX_DMA1_CS_REG); DEBUG_PRINT("dma1 status 0x%x\n", dma1_status); @@ -1003,8 +1003,8 @@ static irqreturn_t handle_interrupt(int irq, void *d PT_REGS_ARG) } comedi_spin_unlock_irqrestore(&dev->spinlock, flags); - // clear possible plx9080 interrupt sources - if (plx_status & ICS_LDIA) { // clear local doorbell interrupt + /* clear possible plx9080 interrupt sources */ + if (plx_status & ICS_LDIA) { /* clear local doorbell interrupt */ plx_bits = readl(priv(dev)->plx9080_iobase + PLX_DBR_OUT_REG); writel(plx_bits, priv(dev)->plx9080_iobase + PLX_DBR_OUT_REG); DEBUG_PRINT(" cleared local doorbell bits 0x%x\n", plx_bits); @@ -1040,7 +1040,7 @@ void abort_dma(struct comedi_device * dev, unsigned int channel) { unsigned long flags; - // spinlock for plx dma control/status reg + /* spinlock for plx dma control/status reg */ comedi_spin_lock_irqsave(&dev->spinlock, flags); plx9080_abort_dma(priv(dev)->plx9080_iobase, channel); diff --git a/drivers/staging/comedi/drivers/icp_multi.c b/drivers/staging/comedi/drivers/icp_multi.c index 15fce0190b2f..7121b37b5ea1 100644 --- a/drivers/staging/comedi/drivers/icp_multi.c +++ b/drivers/staging/comedi/drivers/icp_multi.c @@ -618,7 +618,7 @@ static int icp_multi_insn_write_ctr(struct comedi_device *dev, struct comedi_sub ============================================================================== */ -static irqreturn_t interrupt_service_icp_multi(int irq, void *d PT_REGS_ARG) +static irqreturn_t interrupt_service_icp_multi(int irq, void *d) { struct comedi_device *dev = d; int int_no; diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c index a3c887f3b2c6..c360492159b2 100644 --- a/drivers/staging/comedi/drivers/jr3_pci.c +++ b/drivers/staging/comedi/drivers/jr3_pci.c @@ -48,55 +48,6 @@ Devices: [JR3] PCI force sensor board (jr3_pci) #include "comedi_pci.h" #include "jr3_pci.h" -/* Hotplug firmware loading stuff */ - -static void comedi_fw_release(struct device *dev) -{ - printk(KERN_DEBUG "firmware_sample_driver: ghost_release\n"); -} - -static struct device comedi_fw_device = { - .init_name = "comedi", - .release = comedi_fw_release -}; - -typedef int comedi_firmware_callback(struct comedi_device * dev, - const u8 * data, size_t size); - -static int comedi_load_firmware(struct comedi_device * dev, - char *name, comedi_firmware_callback cb) -{ - int result = 0; - const struct firmware *fw; - char *firmware_path; - static const char *prefix = "comedi/"; - - firmware_path = kmalloc(strlen(prefix) + strlen(name) + 1, GFP_KERNEL); - if (!firmware_path) { - result = -ENOMEM; - } else { - firmware_path[0] = '\0'; - strcat(firmware_path, prefix); - strcat(firmware_path, name); - result = device_register(&comedi_fw_device); - if (result == 0) { - result = request_firmware(&fw, firmware_path, - &comedi_fw_device); - if (result == 0) { - if (!cb) { - result = -EINVAL; - } else { - result = cb(dev, fw->data, fw->size); - } - release_firmware(fw); - } - device_unregister(&comedi_fw_device); - } - kfree(firmware_path); - } - return result; -} - #define PCI_VENDOR_ID_JR3 0x1762 #define PCI_DEVICE_ID_JR3_1_CHANNEL 0x3111 #define PCI_DEVICE_ID_JR3_2_CHANNEL 0x3112 @@ -168,6 +119,41 @@ struct jr3_pci_subdev_private { int retries; }; +/* Hotplug firmware loading stuff */ + +typedef int comedi_firmware_callback(struct comedi_device *dev, + const u8 *data, size_t size); + +static int comedi_load_firmware(struct comedi_device *dev, char *name, + comedi_firmware_callback cb) +{ + int result = 0; + const struct firmware *fw; + char *firmware_path; + static const char *prefix = "comedi/"; + struct jr3_pci_dev_private *devpriv = dev->private; + + firmware_path = kmalloc(strlen(prefix) + strlen(name) + 1, GFP_KERNEL); + if (!firmware_path) { + result = -ENOMEM; + } else { + firmware_path[0] = '\0'; + strcat(firmware_path, prefix); + strcat(firmware_path, name); + result = request_firmware(&fw, firmware_path, + &devpriv->pci_dev->dev); + if (result == 0) { + if (!cb) + result = -EINVAL; + else + result = cb(dev, fw->data, fw->size); + release_firmware(fw); + } + kfree(firmware_path); + } + return result; +} + static struct poll_delay_t poll_delay_min_max(int min, int max) { struct poll_delay_t result; @@ -194,7 +180,7 @@ static void set_transforms(volatile struct jr3_channel *channel, { int i; - num &= 0x000f; // Make sure that 0 <= num <= 15 + num &= 0x000f; /* Make sure that 0 <= num <= 15 */ for (i = 0; i < 8; i++) { set_u16(&channel->transforms[num].link[i].link_type, @@ -410,10 +396,10 @@ int read_idm_word(const u8 * data, size_t size, int *pos, unsigned int *val) { int result = 0; if (pos != 0 && val != 0) { - // Skip over non hex + /* Skip over non hex */ for (; *pos < size && !isxdigit(data[*pos]); (*pos)++) { } - // Collect value + /* Collect value */ *val = 0; for (; *pos < size && isxdigit(data[*pos]); (*pos)++) { char ch = tolower(data[*pos]); @@ -485,17 +471,17 @@ static int jr3_download_firmware(struct comedi_device * dev, const u8 * data, count, addr); while (more && count > 0) { if (addr & 0x4000) { - // 16 bit data, never seen in real life!! + /* 16 bit data, never seen in real life!! */ unsigned int data1; more = more && read_idm_word(data, size, &pos, &data1); count--; - // printk("jr3_data, not tested\n"); - // jr3[addr + 0x20000 * pnum] = data1; + /* printk("jr3_data, not tested\n"); */ + /* jr3[addr + 0x20000 * pnum] = data1; */ } else { - // Download 24 bit program + /* Download 24 bit program */ unsigned int data1, data2; more = more @@ -541,7 +527,7 @@ static struct poll_delay_t jr3_pci_poll_subdevice(struct comedi_subdevice * s) p->errors = errors; } if (errors & (watch_dog | watch_dog2 | sensor_change)) { - // Sensor communication lost, force poll mode + /* Sensor communication lost, force poll mode */ p->state = state_jr3_poll; } @@ -551,9 +537,10 @@ static struct poll_delay_t jr3_pci_poll_subdevice(struct comedi_subdevice * s) u16 serial_no = get_u16(&channel->serial_no); if ((errors & (watch_dog | watch_dog2)) || model_no == 0 || serial_no == 0) { - // Still no sensor, keep on polling. Since it takes up to - // 10 seconds for offsets to stabilize, polling each - // second should suffice. +/* + * Still no sensor, keep on polling. Since it takes up to 10 seconds + * for offsets to stabilize, polling each second should suffice. + */ result = poll_delay_min_max(1000, 2000); } else { p->retries = 0; @@ -566,7 +553,7 @@ static struct poll_delay_t jr3_pci_poll_subdevice(struct comedi_subdevice * s) case state_jr3_init_wait_for_offset:{ p->retries++; if (p->retries < 10) { - // Wait for offeset to stabilize (< 10 s according to manual) + /* Wait for offeset to stabilize (< 10 s according to manual) */ result = poll_delay_min_max(1000, 2000); } else { struct transform_t transf; @@ -582,7 +569,7 @@ static struct poll_delay_t jr3_pci_poll_subdevice(struct comedi_subdevice * s) printk("Sensor Serial = %i\n", p->serial_no); - // Transformation all zeros + /* Transformation all zeros */ transf.link[0].link_type = (enum link_types)0; transf.link[0].link_amount = 0; @@ -600,7 +587,7 @@ static struct poll_delay_t jr3_pci_poll_subdevice(struct comedi_subdevice * s) use_transform(channel, 0); p->state = state_jr3_init_transform_complete; - result = poll_delay_min_max(20, 100); // Allow 20 ms for completion + result = poll_delay_min_max(20, 100); /* Allow 20 ms for completion */ } } break; case state_jr3_init_transform_complete:{ @@ -608,7 +595,7 @@ static struct poll_delay_t jr3_pci_poll_subdevice(struct comedi_subdevice * s) printk("state_jr3_init_transform_complete complete = %d\n", is_complete(channel)); result = poll_delay_min_max(20, 100); } else { - // Set full scale + /* Set full scale */ struct six_axis_t min_full_scale; struct six_axis_t max_full_scale; @@ -639,7 +626,7 @@ static struct poll_delay_t jr3_pci_poll_subdevice(struct comedi_subdevice * s) p->state = state_jr3_init_set_full_scale_complete; - result = poll_delay_min_max(20, 100); // Allow 20 ms for completion + result = poll_delay_min_max(20, 100); /* Allow 20 ms for completion */ } } break; @@ -650,7 +637,7 @@ static struct poll_delay_t jr3_pci_poll_subdevice(struct comedi_subdevice * s) } else { volatile struct force_array *full_scale; - // Use ranges in kN or we will overflow arount 2000N! + /* Use ranges in kN or we will overflow arount 2000N! */ full_scale = &channel->full_scale; p->range[0].range.min = -get_s16(&full_scale->fx) * @@ -679,10 +666,10 @@ static struct poll_delay_t jr3_pci_poll_subdevice(struct comedi_subdevice * s) -get_s16(&full_scale->mz) * 100; p->range[5].range.max = get_s16(&full_scale->mz) * 100; - p->range[6].range.min = -get_s16(&full_scale->v1) * 100; // ?? - p->range[6].range.max = get_s16(&full_scale->v1) * 100; // ?? - p->range[7].range.min = -get_s16(&full_scale->v2) * 100; // ?? - p->range[7].range.max = get_s16(&full_scale->v2) * 100; // ?? + p->range[6].range.min = -get_s16(&full_scale->v1) * 100; /* ?? */ + p->range[6].range.max = get_s16(&full_scale->v1) * 100; /* ?? */ + p->range[7].range.min = -get_s16(&full_scale->v2) * 100; /* ?? */ + p->range[7].range.max = get_s16(&full_scale->v2) * 100; /* ?? */ p->range[8].range.min = 0; p->range[8].range.max = 65535; @@ -701,7 +688,7 @@ static struct poll_delay_t jr3_pci_poll_subdevice(struct comedi_subdevice * s) use_offset(channel, 0); p->state = state_jr3_init_use_offset_complete; - result = poll_delay_min_max(40, 100); // Allow 40 ms for completion + result = poll_delay_min_max(40, 100); /* Allow 40 ms for completion */ } } break; @@ -750,7 +737,7 @@ static void jr3_pci_poll_dev(unsigned long data) comedi_spin_lock_irqsave(&dev->spinlock, flags); delay = 1000; now = jiffies; - // Poll all channels that are ready to be polled + /* Poll all channels that are ready to be polled */ for (i = 0; i < devpriv->n_channels; i++) { struct jr3_pci_subdev_private *subdevpriv = dev->subdevices[i].private; if (now > subdevpriv->next_time_min) { @@ -762,8 +749,10 @@ static void jr3_pci_poll_dev(unsigned long data) subdevpriv->next_time_max = jiffies + msecs_to_jiffies(sub_delay.max); if (sub_delay.max && sub_delay.max < delay) { - // Wake up as late as possible -> poll as many channels as - // possible at once +/* +* Wake up as late as possible -> poll as many channels as possible +* at once +*/ delay = sub_delay.max; } } @@ -895,7 +884,7 @@ static int jr3_pci_attach(struct comedi_device * dev, struct comedi_devconfig * (struct comedi_lrange *) & p->range[8]; p->maxdata_list[56] = 0xffff; p->maxdata_list[57] = 0xffff; - // Channel specific range and maxdata + /* Channel specific range and maxdata */ dev->subdevices[i].range_table = 0; dev->subdevices[i].range_table_list = p->range_table_list; @@ -904,7 +893,7 @@ static int jr3_pci_attach(struct comedi_device * dev, struct comedi_devconfig * } } - // Reset DSP card + /* Reset DSP card */ devpriv->iobase->channel[0].reset = 0; result = comedi_load_firmware(dev, "jr3pci.idm", jr3_download_firmware); @@ -913,13 +902,18 @@ static int jr3_pci_attach(struct comedi_device * dev, struct comedi_devconfig * if (result < 0) { goto out; } - // TODO: use firmware to load preferred offset tables. Suggested format: - // model serial Fx Fy Fz Mx My Mz\n - // - // comedi_load_firmware(dev, "jr3_offsets_table", jr3_download_firmware); +/* + * TODO: use firmware to load preferred offset tables. Suggested + * format: + * model serial Fx Fy Fz Mx My Mz\n + * + * comedi_load_firmware(dev, "jr3_offsets_table", jr3_download_firmware); + */ - // It takes a few milliseconds for software to settle - // as much as we can read firmware version +/* + * It takes a few milliseconds for software to settle as much as we + * can read firmware version + */ msleep_interruptible(25); for (i = 0; i < 0x18; i++) { printk("%c", @@ -927,7 +921,7 @@ static int jr3_pci_attach(struct comedi_device * dev, struct comedi_devconfig * copyright[i]) >> 8); } - // Start card timer + /* Start card timer */ for (i = 0; i < devpriv->n_channels; i++) { struct jr3_pci_subdev_private *p = dev->subdevices[i].private; diff --git a/drivers/staging/comedi/drivers/ke_counter.c b/drivers/staging/comedi/drivers/ke_counter.c index 79f6fe5646c5..e72845767068 100644 --- a/drivers/staging/comedi/drivers/ke_counter.c +++ b/drivers/staging/comedi/drivers/ke_counter.c @@ -227,10 +227,10 @@ static int cnt_attach(struct comedi_device * dev, struct comedi_devconfig * it) subdevice->insn_read = cnt_rinsn; subdevice->insn_write = cnt_winsn; - // select 20MHz clock + /* select 20MHz clock */ outb(3, dev->iobase + 248); - // reset all counters + /* reset all counters */ outb(0, dev->iobase); outb(0, dev->iobase + 0x20); outb(0, dev->iobase + 0x40); diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 12481a032b9f..c3db3b80eba4 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -183,7 +183,7 @@ static int ai_prepare(struct comedi_device *dev, static int ai_write_chanlist(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd); -static irqreturn_t me4000_ai_isr(int irq, void *dev_id PT_REGS_ARG); +static irqreturn_t me4000_ai_isr(int irq, void *dev_id); static int me4000_ai_do_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd); @@ -1740,7 +1740,7 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, return 0; } -static irqreturn_t me4000_ai_isr(int irq, void *dev_id PT_REGS_ARG) +static irqreturn_t me4000_ai_isr(int irq, void *dev_id) { unsigned int tmp; struct comedi_device *dev = dev_id; diff --git a/drivers/staging/comedi/drivers/mpc624.c b/drivers/staging/comedi/drivers/mpc624.c index a151602929d9..c3fb504feb1e 100644 --- a/drivers/staging/comedi/drivers/mpc624.c +++ b/drivers/staging/comedi/drivers/mpc624.c @@ -61,19 +61,19 @@ Configuration Options: #include <linux/ioport.h> #include <linux/delay.h> -// Consecutive I/O port addresses +/* Consecutive I/O port addresses */ #define MPC624_SIZE 16 -// Offsets of different ports -#define MPC624_MASTER_CONTROL 0 // not used -#define MPC624_GNMUXCH 1 // Gain, Mux, Channel of ADC -#define MPC624_ADC 2 // read/write to/from ADC -#define MPC624_EE 3 // read/write to/from serial EEPROM via I2C -#define MPC624_LEDS 4 // write to LEDs -#define MPC624_DIO 5 // read/write to/from digital I/O ports -#define MPC624_IRQ_MASK 6 // IRQ masking enable/disable +/* Offsets of different ports */ +#define MPC624_MASTER_CONTROL 0 /* not used */ +#define MPC624_GNMUXCH 1 /* Gain, Mux, Channel of ADC */ +#define MPC624_ADC 2 /* read/write to/from ADC */ +#define MPC624_EE 3 /* read/write to/from serial EEPROM via I2C */ +#define MPC624_LEDS 4 /* write to LEDs */ +#define MPC624_DIO 5 /* read/write to/from digital I/O ports */ +#define MPC624_IRQ_MASK 6 /* IRQ masking enable/disable */ -// Register bits' names +/* Register bits' names */ #define MPC624_ADBUSY (1<<5) #define MPC624_ADSDO (1<<4) #define MPC624_ADFO (1<<3) @@ -81,19 +81,19 @@ Configuration Options: #define MPC624_ADSCK (1<<1) #define MPC624_ADSDI (1<<0) -// SDI Speed/Resolution Programming bits +/* SDI Speed/Resolution Programming bits */ #define MPC624_OSR4 (1<<31) #define MPC624_OSR3 (1<<30) #define MPC624_OSR2 (1<<29) #define MPC624_OSR1 (1<<28) #define MPC624_OSR0 (1<<27) -// 32-bit output value bits' names +/* 32-bit output value bits' names */ #define MPC624_EOC_BIT (1<<31) #define MPC624_DMY_BIT (1<<30) #define MPC624_SGN_BIT (1<<29) -// Convertion speeds +/* Convertion speeds */ /* OSR4 OSR3 OSR2 OSR1 OSR0 Convertion rate RMS noise ENOB^ * X 0 0 0 1 3.52kHz 23uV 17 * X 0 0 1 0 1.76kHz 3.5uV 20 @@ -119,36 +119,36 @@ Configuration Options: #define MPC624_SPEED_27_5_Hz (MPC624_OSR4 | MPC624_OSR3 ) #define MPC624_SPEED_13_75_Hz (MPC624_OSR4 | MPC624_OSR3 | MPC624_OSR0) #define MPC624_SPEED_6_875_Hz (MPC624_OSR4 | MPC624_OSR3 | MPC624_OSR2 | MPC624_OSR1 | MPC624_OSR0) -//---------------------------------------------------------------------------- +/* ---------------------------------------------------------------------------- */ struct skel_private { - unsigned long int ulConvertionRate; // set by mpc624_attach() from driver's parameters + unsigned long int ulConvertionRate; /* set by mpc624_attach() from driver's parameters */ }; #define devpriv ((struct skel_private *)dev->private) -//---------------------------------------------------------------------------- +/* ---------------------------------------------------------------------------- */ static const struct comedi_lrange range_mpc624_bipolar1 = { 1, { -// BIP_RANGE(1.01) // this is correct, - // but my MPC-624 actually seems to have a range of 2.02 +/* BIP_RANGE(1.01) this is correct, */ + /* but my MPC-624 actually seems to have a range of 2.02 */ BIP_RANGE(2.02) } }; static const struct comedi_lrange range_mpc624_bipolar10 = { 1, { -// BIP_RANGE(10.1) // this is correct, - // but my MPC-624 actually seems to have a range of 20.2 +/* BIP_RANGE(10.1) this is correct, */ + /* but my MPC-624 actually seems to have a range of 20.2 */ BIP_RANGE(20.2) } }; -//---------------------------------------------------------------------------- +/* ---------------------------------------------------------------------------- */ static int mpc624_attach(struct comedi_device * dev, struct comedi_devconfig * it); static int mpc624_detach(struct comedi_device * dev); -//---------------------------------------------------------------------------- +/* ---------------------------------------------------------------------------- */ static struct comedi_driver driver_mpc624 = { driver_name:"mpc624", module:THIS_MODULE, @@ -156,10 +156,10 @@ static struct comedi_driver driver_mpc624 = { detach:mpc624_detach }; -//---------------------------------------------------------------------------- +/* ---------------------------------------------------------------------------- */ static int mpc624_ai_rinsn(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data); -//---------------------------------------------------------------------------- +/* ---------------------------------------------------------------------------- */ static int mpc624_attach(struct comedi_device * dev, struct comedi_devconfig * it) { struct comedi_subdevice *s; @@ -175,7 +175,7 @@ static int mpc624_attach(struct comedi_device * dev, struct comedi_devconfig * i dev->iobase = iobase; dev->board_name = "mpc624"; - // Private structure initialization + /* Private structure initialization */ if (alloc_private(dev, sizeof(struct skel_private)) < 0) return -ENOMEM; @@ -226,7 +226,7 @@ static int mpc624_attach(struct comedi_device * dev, struct comedi_devconfig * i devpriv->ulConvertionRate = MPC624_SPEED_3_52_kHz; } - // Subdevices structures + /* Subdevices structures */ if (alloc_subdevices(dev, 1) < 0) return -ENOMEM; @@ -267,7 +267,7 @@ static int mpc624_detach(struct comedi_device * dev) return 0; } -// Timeout 200ms +/* Timeout 200ms */ #define TIMEOUT 200 static int mpc624_ai_rinsn(struct comedi_device * dev, struct comedi_subdevice * s, @@ -277,16 +277,16 @@ static int mpc624_ai_rinsn(struct comedi_device * dev, struct comedi_subdevice * unsigned long int data_in, data_out; unsigned char ucPort; - // WARNING: We always write 0 to GNSWA bit, so the channel range is +-/10.1Vdc + /* WARNING: We always write 0 to GNSWA bit, so the channel range is +-/10.1Vdc */ outb(insn->chanspec, dev->iobase + MPC624_GNMUXCH); -// rt_printk("Channel %d: \n", insn->chanspec); +/* rt_printk("Channel %d: \n", insn->chanspec); */ if (!insn->n) { rt_printk("MPC624: Warning, no data to aquire\n"); return 0; } for (n = 0; n < insn->n; n++) { - // Trigger the convertion + /* Trigger the convertion */ outb(MPC624_ADSCK, dev->iobase + MPC624_ADC); comedi_udelay(1); outb(MPC624_ADCS | MPC624_ADSCK, dev->iobase + MPC624_ADC); @@ -294,7 +294,7 @@ static int mpc624_ai_rinsn(struct comedi_device * dev, struct comedi_subdevice * outb(0, dev->iobase + MPC624_ADC); comedi_udelay(1); - // Wait for the convertion to end + /* Wait for the convertion to end */ for (i = 0; i < TIMEOUT; i++) { ucPort = inb(dev->iobase + MPC624_ADC); if (ucPort & MPC624_ADBUSY) @@ -307,32 +307,32 @@ static int mpc624_ai_rinsn(struct comedi_device * dev, struct comedi_subdevice * data[n] = 0; return -ETIMEDOUT; } - // Start reading data + /* Start reading data */ data_in = 0; data_out = devpriv->ulConvertionRate; comedi_udelay(1); for (i = 0; i < 32; i++) { - // Set the clock low + /* Set the clock low */ outb(0, dev->iobase + MPC624_ADC); comedi_udelay(1); - if (data_out & (1 << 31)) // the next bit is a 1 + if (data_out & (1 << 31)) /* the next bit is a 1 */ { - // Set the ADSDI line (send to MPC624) + /* Set the ADSDI line (send to MPC624) */ outb(MPC624_ADSDI, dev->iobase + MPC624_ADC); comedi_udelay(1); - // Set the clock high + /* Set the clock high */ outb(MPC624_ADSCK | MPC624_ADSDI, dev->iobase + MPC624_ADC); - } else // the next bit is a 0 + } else /* the next bit is a 0 */ { - // Set the ADSDI line (send to MPC624) + /* Set the ADSDI line (send to MPC624) */ outb(0, dev->iobase + MPC624_ADC); comedi_udelay(1); - // Set the clock high + /* Set the clock high */ outb(MPC624_ADSCK, dev->iobase + MPC624_ADC); } - // Read ADSDO on high clock (receive from MPC624) + /* Read ADSDO on high clock (receive from MPC624) */ comedi_udelay(1); data_in <<= 1; data_in |= @@ -343,18 +343,18 @@ static int mpc624_ai_rinsn(struct comedi_device * dev, struct comedi_subdevice * data_out <<= 1; } - // Received 32-bit long value consist of: - // 31: EOC (End Of Transmission) bit - should be 0 - // 30: DMY (Dummy) bit - should be 0 - // 29: SIG (Sign) bit - 1 if the voltage is positive, 0 if negative - // 28: MSB (Most Significant Bit) - the first bit of convertion result - // .... - // 05: LSB (Least Significant Bit) - the last bit of convertion result - // 04: sub-LSB - sub-LSBs are basically noise, but when - // 03: sub-LSB averaged properly, they can increase convertion - // 02: sub-LSB precision up to 29 bits; they can be discarded - // 01: sub-LSB without loss of resolution. - // 00: sub-LSB + /* Received 32-bit long value consist of: */ + /* 31: EOC (End Of Transmission) bit - should be 0 */ + /* 30: DMY (Dummy) bit - should be 0 */ + /* 29: SIG (Sign) bit - 1 if the voltage is positive, 0 if negative */ + /* 28: MSB (Most Significant Bit) - the first bit of convertion result */ + /* .... */ + /* 05: LSB (Least Significant Bit) - the last bit of convertion result */ + /* 04: sub-LSB - sub-LSBs are basically noise, but when */ + /* 03: sub-LSB averaged properly, they can increase convertion */ + /* 02: sub-LSB precision up to 29 bits; they can be discarded */ + /* 01: sub-LSB without loss of resolution. */ + /* 00: sub-LSB */ if (data_in & MPC624_EOC_BIT) rt_printk("MPC624: EOC bit is set (data_in=%lu)!", @@ -362,24 +362,24 @@ static int mpc624_ai_rinsn(struct comedi_device * dev, struct comedi_subdevice * if (data_in & MPC624_DMY_BIT) rt_printk("MPC624: DMY bit is set (data_in=%lu)!", data_in); - if (data_in & MPC624_SGN_BIT) // check the sign bit - { // The voltage is positive - data_in &= 0x3FFFFFFF; // EOC and DMY should be 0, but we will mask them out just to be sure - data[n] = data_in; // comedi operates on unsigned numbers, so we don't clear the SGN bit - // SGN bit is still set! It's correct, since we're converting to unsigned. - } else { // The voltage is negative - // data_in contains a number in 30-bit two's complement code and we must deal with it + if (data_in & MPC624_SGN_BIT) /* check the sign bit */ + { /* The voltage is positive */ + data_in &= 0x3FFFFFFF; /* EOC and DMY should be 0, but we will mask them out just to be sure */ + data[n] = data_in; /* comedi operates on unsigned numbers, so we don't clear the SGN bit */ + /* SGN bit is still set! It's correct, since we're converting to unsigned. */ + } else { /* The voltage is negative */ + /* data_in contains a number in 30-bit two's complement code and we must deal with it */ data_in |= MPC624_SGN_BIT; data_in = ~data_in; data_in += 1; data_in &= ~(MPC624_EOC_BIT | MPC624_DMY_BIT); - // clear EOC and DMY bits + /* clear EOC and DMY bits */ data_in = 0x20000000 - data_in; data[n] = data_in; } } - // Return the number of samples read/written + /* Return the number of samples read/written */ return n; } diff --git a/drivers/staging/comedi/drivers/ni_6527.c b/drivers/staging/comedi/drivers/ni_6527.c index e01ecb6760f9..d7c7c0f6be8b 100644 --- a/drivers/staging/comedi/drivers/ni_6527.c +++ b/drivers/staging/comedi/drivers/ni_6527.c @@ -212,7 +212,7 @@ static int ni6527_do_insn_bits(struct comedi_device * dev, struct comedi_subdevi return 2; } -static irqreturn_t ni6527_interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t ni6527_interrupt(int irq, void *d) { struct comedi_device *dev = d; struct comedi_subdevice *s = dev->subdevices + 2; @@ -311,7 +311,7 @@ static int ni6527_intr_cmdtest(struct comedi_device * dev, struct comedi_subdevi static int ni6527_intr_cmd(struct comedi_device * dev, struct comedi_subdevice * s) { - //struct comedi_cmd *cmd = &s->async->cmd; + /* struct comedi_cmd *cmd = &s->async->cmd; */ writeb(ClrEdge | ClrOverflow, devpriv->mite->daq_io_addr + Clear_Register); diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index 6e85da16a241..60dfec593330 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -437,12 +437,12 @@ static int ni_65xx_dio_insn_bits(struct comedi_device * dev, struct comedi_subde writeb(bits, private(dev)->mite->daq_io_addr + Port_Data(port)); -// rt_printk("wrote 0x%x to port %i\n", bits, port); +/* rt_printk("wrote 0x%x to port %i\n", bits, port); */ } port_read_bits = readb(private(dev)->mite->daq_io_addr + Port_Data(port)); -// rt_printk("read 0x%x from port %i\n", port_read_bits, port); +/* rt_printk("read 0x%x from port %i\n", port_read_bits, port); */ if (bitshift > 0) { port_read_bits <<= bitshift; } else { @@ -454,7 +454,7 @@ static int ni_65xx_dio_insn_bits(struct comedi_device * dev, struct comedi_subde return insn->n; } -static irqreturn_t ni_65xx_interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t ni_65xx_interrupt(int irq, void *d) { struct comedi_device *dev = d; struct comedi_subdevice *s = dev->subdevices + 2; @@ -553,7 +553,7 @@ static int ni_65xx_intr_cmdtest(struct comedi_device * dev, struct comedi_subdev static int ni_65xx_intr_cmd(struct comedi_device * dev, struct comedi_subdevice * s) { - //struct comedi_cmd *cmd = &s->async->cmd; + /* struct comedi_cmd *cmd = &s->async->cmd; */ writeb(ClrEdge | ClrOverflow, private(dev)->mite->daq_io_addr + Clear_Register); @@ -700,7 +700,7 @@ static int ni_65xx_attach(struct comedi_device * dev, struct comedi_devconfig * return -ENOMEM; sprivate(s)->base_port = 0; for (i = 0; i < board(dev)->num_dio_ports; ++i) { - // configure all ports for input + /* configure all ports for input */ writeb(0x1, private(dev)->mite->daq_io_addr + Port_Select(i)); diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 14e35ba721e9..43aab610f326 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -51,7 +51,7 @@ enum ni_660x_constants { }; #define NUM_PFI_CHANNELS 40 -// really there are only up to 3 dma channels, but the register layout allows for 4 +/* really there are only up to 3 dma channels, but the register layout allows for 4 */ #define MAX_DMA_CHANNEL 4 /* See Register-Level Programmer Manual page 3.1 */ @@ -194,10 +194,10 @@ static inline unsigned NI_660X_GPCT_SUBDEV(unsigned index) struct NI_660xRegisterData { - const char *name; // Register Name - int offset; // Offset from base address from GPCT chip + const char *name; /* Register Name */ + int offset; /* Offset from base address from GPCT chip */ enum ni_660x_register_direction direction; - enum ni_660x_register_width size; // 1 byte, 2 bytes, or 4 bytes + enum ni_660x_register_width size; /* 1 byte, 2 bytes, or 4 bytes */ }; @@ -302,12 +302,12 @@ static const struct NI_660xRegisterData registerData[NumRegisters] = { {"IO Config Register 38-39", 0x7A2, NI_660x_READ_WRITE, DATA_2B} }; -// kind of ENABLE for the second counter +/* kind of ENABLE for the second counter */ enum clock_config_register_bits { CounterSwap = 0x1 << 21 }; -// ioconfigreg +/* ioconfigreg */ static inline unsigned ioconfig_bitshift(unsigned pfi_channel) { if (pfi_channel % 2) @@ -334,7 +334,7 @@ static inline unsigned pfi_input_select_bits(unsigned pfi_channel, return (input_select & 0x7) << (4 + ioconfig_bitshift(pfi_channel)); } -// dma configuration register bits +/* dma configuration register bits */ static inline unsigned dma_select_mask(unsigned dma_channel) { BUG_ON(dma_channel >= MAX_DMA_CHANNEL); @@ -374,7 +374,7 @@ enum global_interrupt_config_register_bits { Global_Int_Enable_Bit = 0x80000000 }; -// Offset of the GPCT chips from the base-adress of the card +/* Offset of the GPCT chips from the base-adress of the card */ static const unsigned GPCT_OFFSET[2] = { 0x0, 0x800 }; /* First chip is at base-address + 0x00, etc. */ @@ -428,6 +428,8 @@ struct ni_660x_private { struct mite_dma_descriptor_ring *mite_rings[NI_660X_MAX_NUM_CHIPS][counters_per_chip]; spinlock_t mite_channel_lock; + /* interrupt_lock prevents races between interrupt and comedi_poll */ + spinlock_t interrupt_lock; unsigned dma_configuration_soft_copies[NI_660X_MAX_NUM_CHIPS]; spinlock_t soft_reg_copy_lock; unsigned short pfi_output_selects[NUM_PFI_CHANNELS]; @@ -850,7 +852,7 @@ static int ni_660x_cmd(struct comedi_device * dev, struct comedi_subdevice * s) int retval; struct ni_gpct *counter = subdev_to_counter(s); -// const struct comedi_cmd *cmd = &s->async->cmd; +/* const struct comedi_cmd *cmd = &s->async->cmd; */ retval = ni_660x_request_mite_channel(dev, counter, COMEDI_INPUT); if (retval) { @@ -909,22 +911,37 @@ static void ni_660x_handle_gpct_interrupt(struct comedi_device * dev, } } -static irqreturn_t ni_660x_interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t ni_660x_interrupt(int irq, void *d) { struct comedi_device *dev = d; struct comedi_subdevice *s; unsigned i; + unsigned long flags; if (dev->attached == 0) return IRQ_NONE; + /* lock to avoid race with comedi_poll */ + comedi_spin_lock_irqsave(&private(dev)->interrupt_lock, flags); smp_mb(); for (i = 0; i < ni_660x_num_counters(dev); ++i) { s = dev->subdevices + NI_660X_GPCT_SUBDEV(i); ni_660x_handle_gpct_interrupt(dev, s); } + comedi_spin_unlock_irqrestore(&private(dev)->interrupt_lock, flags); return IRQ_HANDLED; } +static int ni_660x_input_poll(struct comedi_device *dev, + struct comedi_subdevice *s) +{ + unsigned long flags; + /* lock to avoid race with comedi_poll */ + comedi_spin_lock_irqsave(&private(dev)->interrupt_lock, flags); + mite_sync_input_dma(subdev_to_counter(s)->mite_chan, s->async); + comedi_spin_unlock_irqrestore(&private(dev)->interrupt_lock, flags); + return comedi_buf_read_n_available(s->async); +} + static int ni_660x_buf_change(struct comedi_device * dev, struct comedi_subdevice * s, unsigned long new_size) { @@ -946,6 +963,7 @@ static int ni_660x_allocate_private(struct comedi_device * dev) if ((retval = alloc_private(dev, sizeof(struct ni_660x_private))) < 0) return retval; spin_lock_init(&private(dev)->mite_channel_lock); + spin_lock_init(&private(dev)->interrupt_lock); spin_lock_init(&private(dev)->soft_reg_copy_lock); for (i = 0; i < NUM_PFI_CHANNELS; ++i) { private(dev)->pfi_output_selects[i] = pfi_output_select_counter; @@ -1031,7 +1049,7 @@ static int ni_660x_attach(struct comedi_device * dev, struct comedi_devconfig * s->insn_bits = ni_660x_dio_insn_bits; s->insn_config = ni_660x_dio_insn_config; s->io_bits = 0; /* all bits default to input */ - // we use the ioconfig registers to control dio direction, so zero output enables in stc dio control reg + /* we use the ioconfig registers to control dio direction, so zero output enables in stc dio control reg */ ni_660x_write_register(dev, 0, 0, STCDIOControl); private(dev)->counter_dev = ni_gpct_device_construct(dev, @@ -1055,6 +1073,7 @@ static int ni_660x_attach(struct comedi_device * dev, struct comedi_devconfig * s->len_chanlist = 1; s->do_cmdtest = &ni_660x_cmdtest; s->cancel = &ni_660x_cancel; + s->poll = &ni_660x_input_poll; s->async_dma_dir = DMA_BIDIRECTIONAL; s->buf_change = &ni_660x_buf_change; s->private = &private(dev)->counter_dev->counters[i]; @@ -1132,7 +1151,7 @@ static void init_tio_chip(struct comedi_device * dev, int chipset) { unsigned i; - // init dma configuration register + /* init dma configuration register */ private(dev)->dma_configuration_soft_copies[chipset] = 0; for (i = 0; i < MAX_DMA_CHANNEL; ++i) { private(dev)->dma_configuration_soft_copies[chipset] |= @@ -1193,7 +1212,7 @@ static int ni_660x_dio_insn_bits(struct comedi_device * dev, { unsigned base_bitfield_channel = CR_CHAN(insn->chanspec); - // Check if we have to write some bits + /* Check if we have to write some bits */ if (data[0]) { s->state &= ~(data[0] << base_bitfield_channel); s->state |= (data[0] & data[1]) << base_bitfield_channel; diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c index d1312e073a65..05dcc5ba255c 100644 --- a/drivers/staging/comedi/drivers/ni_670x.c +++ b/drivers/staging/comedi/drivers/ni_670x.c @@ -91,7 +91,7 @@ static const struct ni_670x_board ni_670x_boards[] = { static DEFINE_PCI_DEVICE_TABLE(ni_670x_pci_table) = { {PCI_VENDOR_ID_NATINST, 0x2c90, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {PCI_VENDOR_ID_NATINST, 0x1920, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - //{ PCI_VENDOR_ID_NATINST, 0x0000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + /* { PCI_VENDOR_ID_NATINST, 0x0000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, */ {0} }; diff --git a/drivers/staging/comedi/drivers/ni_at_a2150.c b/drivers/staging/comedi/drivers/ni_at_a2150.c index 5d45bf24a5ef..8b73a793ad0f 100644 --- a/drivers/staging/comedi/drivers/ni_at_a2150.c +++ b/drivers/staging/comedi/drivers/ni_at_a2150.c @@ -73,10 +73,10 @@ TRIG_WAKE_EOS #include "comedi_fc.h" #define A2150_SIZE 28 -#define A2150_DMA_BUFFER_SIZE 0xff00 // size in bytes of dma buffer +#define A2150_DMA_BUFFER_SIZE 0xff00 /* size in bytes of dma buffer */ -//#define A2150_DEBUG // enable debugging code -#undef A2150_DEBUG // disable debugging code +/* #define A2150_DEBUG enable debugging code */ +#undef A2150_DEBUG /* disable debugging code */ /* Registers and bits */ #define CONFIG_REG 0x0 @@ -85,48 +85,48 @@ TRIG_WAKE_EOS #define CLOCK_SELECT_BITS(x) (((x) & 0x3) << 3) #define CLOCK_DIVISOR_BITS(x) (((x) & 0x3) << 5) #define CLOCK_MASK (0xf << 3) -#define ENABLE0_BIT 0x80 // enable (don't internally ground) channels 0 and 1 -#define ENABLE1_BIT 0x100 // enable (don't internally ground) channels 2 and 3 -#define AC0_BIT 0x200 // ac couple channels 0,1 -#define AC1_BIT 0x400 // ac couple channels 2,3 -#define APD_BIT 0x800 // analog power down -#define DPD_BIT 0x1000 // digital power down -#define TRIGGER_REG 0x2 // trigger config register +#define ENABLE0_BIT 0x80 /* enable (don't internally ground) channels 0 and 1 */ +#define ENABLE1_BIT 0x100 /* enable (don't internally ground) channels 2 and 3 */ +#define AC0_BIT 0x200 /* ac couple channels 0,1 */ +#define AC1_BIT 0x400 /* ac couple channels 2,3 */ +#define APD_BIT 0x800 /* analog power down */ +#define DPD_BIT 0x1000 /* digital power down */ +#define TRIGGER_REG 0x2 /* trigger config register */ #define POST_TRIGGER_BITS 0x2 #define DELAY_TRIGGER_BITS 0x3 -#define HW_TRIG_EN 0x10 // enable hardware trigger -#define FIFO_START_REG 0x6 // software start aquistion trigger -#define FIFO_RESET_REG 0x8 // clears fifo + fifo flags -#define FIFO_DATA_REG 0xa // read data -#define DMA_TC_CLEAR_REG 0xe // clear dma terminal count interrupt -#define STATUS_REG 0x12 // read only -#define FNE_BIT 0x1 // fifo not empty -#define OVFL_BIT 0x8 // fifo overflow -#define EDAQ_BIT 0x10 // end of aquisition interrupt -#define DCAL_BIT 0x20 // offset calibration in progress -#define INTR_BIT 0x40 // interrupt has occured -#define DMA_TC_BIT 0x80 // dma terminal count interrupt has occured +#define HW_TRIG_EN 0x10 /* enable hardware trigger */ +#define FIFO_START_REG 0x6 /* software start aquistion trigger */ +#define FIFO_RESET_REG 0x8 /* clears fifo + fifo flags */ +#define FIFO_DATA_REG 0xa /* read data */ +#define DMA_TC_CLEAR_REG 0xe /* clear dma terminal count interrupt */ +#define STATUS_REG 0x12 /* read only */ +#define FNE_BIT 0x1 /* fifo not empty */ +#define OVFL_BIT 0x8 /* fifo overflow */ +#define EDAQ_BIT 0x10 /* end of aquisition interrupt */ +#define DCAL_BIT 0x20 /* offset calibration in progress */ +#define INTR_BIT 0x40 /* interrupt has occured */ +#define DMA_TC_BIT 0x80 /* dma terminal count interrupt has occured */ #define ID_BITS(x) (((x) >> 8) & 0x3) -#define IRQ_DMA_CNTRL_REG 0x12 // write only -#define DMA_CHAN_BITS(x) ((x) & 0x7) // sets dma channel -#define DMA_EN_BIT 0x8 // enables dma -#define IRQ_LVL_BITS(x) (((x) & 0xf) << 4) // sets irq level -#define FIFO_INTR_EN_BIT 0x100 // enable fifo interrupts -#define FIFO_INTR_FHF_BIT 0x200 // interrupt fifo half full -#define DMA_INTR_EN_BIT 0x800 // enable interrupt on dma terminal count -#define DMA_DEM_EN_BIT 0x1000 // enables demand mode dma +#define IRQ_DMA_CNTRL_REG 0x12 /* write only */ +#define DMA_CHAN_BITS(x) ((x) & 0x7) /* sets dma channel */ +#define DMA_EN_BIT 0x8 /* enables dma */ +#define IRQ_LVL_BITS(x) (((x) & 0xf) << 4) /* sets irq level */ +#define FIFO_INTR_EN_BIT 0x100 /* enable fifo interrupts */ +#define FIFO_INTR_FHF_BIT 0x200 /* interrupt fifo half full */ +#define DMA_INTR_EN_BIT 0x800 /* enable interrupt on dma terminal count */ +#define DMA_DEM_EN_BIT 0x1000 /* enables demand mode dma */ #define I8253_BASE_REG 0x14 #define I8253_MODE_REG 0x17 -#define HW_COUNT_DISABLE 0x30 // disable hardware counting of conversions +#define HW_COUNT_DISABLE 0x30 /* disable hardware counting of conversions */ struct a2150_board { const char *name; - int clock[4]; // master clock periods, in nanoseconds - int num_clocks; // number of available master clock speeds - int ai_speed; // maximum conversion rate in nanoseconds + int clock[4]; /* master clock periods, in nanoseconds */ + int num_clocks; /* number of available master clock speeds */ + int ai_speed; /* maximum conversion rate in nanoseconds */ }; -//analog input range +/* analog input range */ static const struct comedi_lrange range_a2150 = { 1, { @@ -134,7 +134,7 @@ static const struct comedi_lrange range_a2150 = { } }; -// enum must match board indices +/* enum must match board indices */ enum { a2150_c, a2150_s }; static const struct a2150_board a2150_boards[] = { { @@ -159,11 +159,11 @@ static const struct a2150_board a2150_boards[] = { struct a2150_private { volatile unsigned int count; /* number of data points left to be taken */ - unsigned int dma; // dma channel - s16 *dma_buffer; // dma buffer - unsigned int dma_transfer_size; // size in bytes of dma transfers - int irq_dma_bits; // irq/dma register bits - int config_bits; // config register bits + unsigned int dma; /* dma channel */ + s16 *dma_buffer; /* dma buffer */ + unsigned int dma_transfer_size; /* size in bytes of dma transfers */ + int irq_dma_bits; /* irq/dma register bits */ + int config_bits; /* config register bits */ }; @@ -180,7 +180,7 @@ static struct comedi_driver driver_a2150 = { detach:a2150_detach, }; -static irqreturn_t a2150_interrupt(int irq, void *d PT_REGS_ARG); +static irqreturn_t a2150_interrupt(int irq, void *d); static int a2150_ai_cmdtest(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_cmd * cmd); static int a2150_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s); @@ -209,7 +209,7 @@ static void ni_dump_regs(struct comedi_device * dev) #endif /* interrupt service routine */ -static irqreturn_t a2150_interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t a2150_interrupt(int irq, void *d) { int i; int status; @@ -226,7 +226,7 @@ static irqreturn_t a2150_interrupt(int irq, void *d PT_REGS_ARG) comedi_error(dev, "premature interrupt"); return IRQ_HANDLED; } - // initialize async here to make sure s is not NULL + /* initialize async here to make sure s is not NULL */ async = s->async; async->events = 0; cmd = &async->cmd; @@ -258,7 +258,7 @@ static irqreturn_t a2150_interrupt(int irq, void *d PT_REGS_ARG) * count and address get set correctly */ clear_dma_ff(devpriv->dma); - // figure out how many points to read + /* figure out how many points to read */ max_points = devpriv->dma_transfer_size / sample_size; /* residue is the number of points left to be done on the dma * transfer. It should always be zero at this point unless @@ -269,7 +269,7 @@ static irqreturn_t a2150_interrupt(int irq, void *d PT_REGS_ARG) if (devpriv->count < num_points && cmd->stop_src == TRIG_COUNT) num_points = devpriv->count; - // figure out how many points will be stored next time + /* figure out how many points will be stored next time */ leftover = 0; if (cmd->stop_src == TRIG_NONE) { leftover = devpriv->dma_transfer_size / sample_size; @@ -288,7 +288,7 @@ static irqreturn_t a2150_interrupt(int irq, void *d PT_REGS_ARG) for (i = 0; i < num_points; i++) { /* write data point to comedi buffer */ dpnt = devpriv->dma_buffer[i]; - // convert from 2's complement to unsigned coding + /* convert from 2's complement to unsigned coding */ dpnt ^= 0x8000; cfc_write_to_buffer(s, dpnt); if (cmd->stop_src == TRIG_COUNT) { @@ -299,7 +299,7 @@ static irqreturn_t a2150_interrupt(int irq, void *d PT_REGS_ARG) } } } - // re-enable dma + /* re-enable dma */ if (leftover) { set_dma_addr(devpriv->dma, virt_to_bus(devpriv->dma_buffer)); set_dma_count(devpriv->dma, leftover * sample_size); @@ -317,7 +317,7 @@ static irqreturn_t a2150_interrupt(int irq, void *d PT_REGS_ARG) return IRQ_HANDLED; } -// probes board type, returns offset +/* probes board type, returns offset */ static int a2150_probe(struct comedi_device * dev) { int status = inw(dev->iobase + STATUS_REG); @@ -365,7 +365,7 @@ static int a2150_attach(struct comedi_device * dev, struct comedi_devconfig * it /* grab our IRQ */ if (irq) { - // check that irq is supported + /* check that irq is supported */ if (irq < 3 || irq == 8 || irq == 13 || irq > 15) { printk(" invalid irq line %u\n", irq); return -EINVAL; @@ -378,7 +378,7 @@ static int a2150_attach(struct comedi_device * dev, struct comedi_devconfig * it devpriv->irq_dma_bits |= IRQ_LVL_BITS(irq); dev->irq = irq; } - // initialize dma + /* initialize dma */ if (dma) { if (dma == 4 || dma > 7) { printk(" invalid dma channel %u\n", dma); @@ -424,16 +424,16 @@ static int a2150_attach(struct comedi_device * dev, struct comedi_devconfig * it * prevent hardware count from stopping aquisition */ outw(HW_COUNT_DISABLE, dev->iobase + I8253_MODE_REG); - // set card's irq and dma levels + /* set card's irq and dma levels */ outw(devpriv->irq_dma_bits, dev->iobase + IRQ_DMA_CNTRL_REG); - // reset and sync adc clock circuitry + /* reset and sync adc clock circuitry */ outw_p(DPD_BIT | APD_BIT, dev->iobase + CONFIG_REG); outw_p(DPD_BIT, dev->iobase + CONFIG_REG); - // initialize configuration register + /* initialize configuration register */ devpriv->config_bits = 0; outw(devpriv->config_bits, dev->iobase + CONFIG_REG); - // wait until offset calibration is done, then enable analog inputs + /* wait until offset calibration is done, then enable analog inputs */ for (i = 0; i < timeout; i++) { if ((DCAL_BIT & inw(dev->iobase + STATUS_REG)) == 0) break; @@ -455,7 +455,7 @@ static int a2150_detach(struct comedi_device * dev) /* only free stuff if it has been allocated by _attach */ if (dev->iobase) { - // put board in power-down mode + /* put board in power-down mode */ outw(APD_BIT | DPD_BIT, dev->iobase + CONFIG_REG); release_region(dev->iobase, A2150_SIZE); } @@ -474,14 +474,14 @@ static int a2150_detach(struct comedi_device * dev) static int a2150_cancel(struct comedi_device * dev, struct comedi_subdevice * s) { - // disable dma on card + /* disable dma on card */ devpriv->irq_dma_bits &= ~DMA_INTR_EN_BIT & ~DMA_EN_BIT; outw(devpriv->irq_dma_bits, dev->iobase + IRQ_DMA_CNTRL_REG); - // disable computer's dma + /* disable computer's dma */ disable_dma(devpriv->dma); - // clear fifo and reset triggering circuitry + /* clear fifo and reset triggering circuitry */ outw(0, dev->iobase + FIFO_RESET_REG); return 0; @@ -582,7 +582,7 @@ static int a2150_ai_cmdtest(struct comedi_device * dev, struct comedi_subdevice if (err) return 4; - // check channel/gain list against card's limitations + /* check channel/gain list against card's limitations */ if (cmd->chanlist) { startChan = CR_CHAN(cmd->chanlist[0]); for (i = 1; i < cmd->chanlist_len; i++) { @@ -635,7 +635,7 @@ static int a2150_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) " dma incompatible with hard real-time interrupt (TRIG_RT), aborting"); return -1; } - // clear fifo and reset triggering circuitry + /* clear fifo and reset triggering circuitry */ outw(0, dev->iobase + FIFO_RESET_REG); /* setup chanlist */ @@ -643,7 +643,7 @@ static int a2150_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) cmd->chanlist_len) < 0) return -1; - // setup ac/dc coupling + /* setup ac/dc coupling */ if (CR_AREF(cmd->chanlist[0]) == AREF_OTHER) devpriv->config_bits |= AC0_BIT; else @@ -653,23 +653,23 @@ static int a2150_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) else devpriv->config_bits &= ~AC1_BIT; - // setup timing + /* setup timing */ a2150_get_timing(dev, &cmd->scan_begin_arg, cmd->flags); - // send timing, channel, config bits + /* send timing, channel, config bits */ outw(devpriv->config_bits, dev->iobase + CONFIG_REG); - // initialize number of samples remaining + /* initialize number of samples remaining */ devpriv->count = cmd->stop_arg * cmd->chanlist_len; - // enable computer's dma + /* enable computer's dma */ lock_flags = claim_dma_lock(); disable_dma(devpriv->dma); /* clear flip-flop to make sure 2-byte registers for * count and address get set correctly */ clear_dma_ff(devpriv->dma); set_dma_addr(devpriv->dma, virt_to_bus(devpriv->dma_buffer)); - // set size of transfer to fill in 1/3 second + /* set size of transfer to fill in 1/3 second */ #define ONE_THIRD_SECOND 333333333 devpriv->dma_transfer_size = sizeof(devpriv->dma_buffer[0]) * cmd->chanlist_len * @@ -688,36 +688,36 @@ static int a2150_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) * one spurious interrupt that has been happening */ outw(0x00, dev->iobase + DMA_TC_CLEAR_REG); - // enable dma on card + /* enable dma on card */ devpriv->irq_dma_bits |= DMA_INTR_EN_BIT | DMA_EN_BIT; outw(devpriv->irq_dma_bits, dev->iobase + IRQ_DMA_CNTRL_REG); - // may need to wait 72 sampling periods if timing was changed + /* may need to wait 72 sampling periods if timing was changed */ i8254_load(dev->iobase + I8253_BASE_REG, 0, 2, 72, 0); - // setup start triggering + /* setup start triggering */ trigger_bits = 0; - // decide if we need to wait 72 periods for valid data + /* decide if we need to wait 72 periods for valid data */ if (cmd->start_src == TRIG_NOW && (old_config_bits & CLOCK_MASK) != (devpriv->config_bits & CLOCK_MASK)) { - // set trigger source to delay trigger + /* set trigger source to delay trigger */ trigger_bits |= DELAY_TRIGGER_BITS; } else { - // otherwise no delay + /* otherwise no delay */ trigger_bits |= POST_TRIGGER_BITS; } - // enable external hardware trigger + /* enable external hardware trigger */ if (cmd->start_src == TRIG_EXT) { trigger_bits |= HW_TRIG_EN; } else if (cmd->start_src == TRIG_OTHER) { - // XXX add support for level/slope start trigger using TRIG_OTHER + /* XXX add support for level/slope start trigger using TRIG_OTHER */ comedi_error(dev, "you shouldn't see this?"); } - // send trigger config bits + /* send trigger config bits */ outw(trigger_bits, dev->iobase + TRIGGER_REG); - // start aquisition for soft trigger + /* start aquisition for soft trigger */ if (cmd->start_src == TRIG_NOW) { outw(0, dev->iobase + FIFO_START_REG); } @@ -735,28 +735,28 @@ static int a2150_ai_rinsn(struct comedi_device * dev, struct comedi_subdevice * static const int timeout = 100000; static const int filter_delay = 36; - // clear fifo and reset triggering circuitry + /* clear fifo and reset triggering circuitry */ outw(0, dev->iobase + FIFO_RESET_REG); /* setup chanlist */ if (a2150_set_chanlist(dev, CR_CHAN(insn->chanspec), 1) < 0) return -1; - // set dc coupling + /* set dc coupling */ devpriv->config_bits &= ~AC0_BIT; devpriv->config_bits &= ~AC1_BIT; - // send timing, channel, config bits + /* send timing, channel, config bits */ outw(devpriv->config_bits, dev->iobase + CONFIG_REG); - // disable dma on card + /* disable dma on card */ devpriv->irq_dma_bits &= ~DMA_INTR_EN_BIT & ~DMA_EN_BIT; outw(devpriv->irq_dma_bits, dev->iobase + IRQ_DMA_CNTRL_REG); - // setup start triggering + /* setup start triggering */ outw(0, dev->iobase + TRIGGER_REG); - // start aquisition for soft trigger + /* start aquisition for soft trigger */ outw(0, dev->iobase + FIFO_START_REG); /* there is a 35.6 sample delay for data to get through the antialias filter */ @@ -773,7 +773,7 @@ static int a2150_ai_rinsn(struct comedi_device * dev, struct comedi_subdevice * inw(dev->iobase + FIFO_DATA_REG); } - // read data + /* read data */ for (n = 0; n < insn->n; n++) { for (i = 0; i < timeout; i++) { if (inw(dev->iobase + STATUS_REG) & FNE_BIT) @@ -794,7 +794,7 @@ static int a2150_ai_rinsn(struct comedi_device * dev, struct comedi_subdevice * data[n] ^= 0x8000; } - // clear fifo and reset triggering circuitry + /* clear fifo and reset triggering circuitry */ outw(0, dev->iobase + FIFO_RESET_REG); return n; @@ -809,7 +809,7 @@ static int a2150_get_timing(struct comedi_device * dev, unsigned int *period, int lub_divisor_shift, lub_index, glb_divisor_shift, glb_index; int i, j; - // initialize greatest lower and least upper bounds + /* initialize greatest lower and least upper bounds */ lub_divisor_shift = 3; lub_index = 0; lub = thisboard->clock[lub_index] * (1 << lub_divisor_shift); @@ -817,19 +817,19 @@ static int a2150_get_timing(struct comedi_device * dev, unsigned int *period, glb_index = thisboard->num_clocks - 1; glb = thisboard->clock[glb_index] * (1 << glb_divisor_shift); - // make sure period is in available range + /* make sure period is in available range */ if (*period < glb) *period = glb; if (*period > lub) *period = lub; - // we can multiply period by 1, 2, 4, or 8, using (1 << i) + /* we can multiply period by 1, 2, 4, or 8, using (1 << i) */ for (i = 0; i < 4; i++) { - // there are a maximum of 4 master clocks + /* there are a maximum of 4 master clocks */ for (j = 0; j < thisboard->num_clocks; j++) { - // temp is the period in nanosec we are evaluating + /* temp is the period in nanosec we are evaluating */ temp = thisboard->clock[j] * (1 << i); - // if it is the best match yet + /* if it is the best match yet */ if (temp < lub && temp >= *period) { lub_divisor_shift = i; lub_index = j; @@ -846,7 +846,7 @@ static int a2150_get_timing(struct comedi_device * dev, unsigned int *period, switch (flags) { case TRIG_ROUND_NEAREST: default: - // if least upper bound is better approximation + /* if least upper bound is better approximation */ if (lub - *period < *period - glb) { *period = lub; } else { @@ -861,7 +861,7 @@ static int a2150_get_timing(struct comedi_device * dev, unsigned int *period, break; } - // set clock bits for config register appropriately + /* set clock bits for config register appropriately */ devpriv->config_bits &= ~CLOCK_MASK; if (*period == lub) { devpriv->config_bits |= diff --git a/drivers/staging/comedi/drivers/ni_at_ao.c b/drivers/staging/comedi/drivers/ni_at_ao.c index 2cc46b672588..089fb428b411 100644 --- a/drivers/staging/comedi/drivers/ni_at_ao.c +++ b/drivers/staging/comedi/drivers/ni_at_ao.c @@ -229,7 +229,7 @@ static int atao_attach(struct comedi_device * dev, struct comedi_devconfig * it) } dev->iobase = iobase; - //dev->board_ptr = atao_probe(dev); + /* dev->board_ptr = atao_probe(dev); */ dev->board_name = thisboard->name; @@ -273,7 +273,7 @@ static int atao_attach(struct comedi_device * dev, struct comedi_devconfig * it) s = dev->subdevices + 3; /* eeprom subdevice */ - //s->type=COMEDI_SUBD_EEPROM; + /* s->type=COMEDI_SUBD_EEPROM; */ s->type = COMEDI_SUBD_UNUSED; atao_reset(dev); diff --git a/drivers/staging/comedi/drivers/ni_atmio.c b/drivers/staging/comedi/drivers/ni_atmio.c index fcc38535afc5..dcd44874aaf3 100644 --- a/drivers/staging/comedi/drivers/ni_atmio.c +++ b/drivers/staging/comedi/drivers/ni_atmio.c @@ -114,7 +114,7 @@ are not supported. #define MAX_N_CALDACS 32 -static const ni_board ni_boards[] = { +static const struct ni_board_struct ni_boards[] = { {device_id:44, isapnp_id:0x0000,/* XXX unknown */ name: "at-mio-16e-1", @@ -276,10 +276,11 @@ static const int ni_irqpin[] = #define NI_E_IRQ_FLAGS 0 -typedef struct { +struct ni_private { struct pnp_dev *isapnp_dev; - NI_PRIVATE_COMMON} ni_private; -#define devpriv ((ni_private *)dev->private) + NI_PRIVATE_COMMON +}; +#define devpriv ((struct ni_private *)dev->private) /* How we access registers */ diff --git a/drivers/staging/comedi/drivers/ni_atmio16d.c b/drivers/staging/comedi/drivers/ni_atmio16d.c index 35fcd172af2e..44b67ec86c3a 100644 --- a/drivers/staging/comedi/drivers/ni_atmio16d.c +++ b/drivers/staging/comedi/drivers/ni_atmio16d.c @@ -127,7 +127,7 @@ static const struct atmio16_board_t atmio16_boards[] = { /* function prototypes */ static int atmio16d_attach(struct comedi_device * dev, struct comedi_devconfig * it); static int atmio16d_detach(struct comedi_device * dev); -static irqreturn_t atmio16d_interrupt(int irq, void *d PT_REGS_ARG); +static irqreturn_t atmio16d_interrupt(int irq, void *d); static int atmio16d_ai_cmdtest(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_cmd * cmd); static int atmio16d_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s); @@ -257,12 +257,12 @@ static void reset_atmio16d(struct comedi_device * dev) outw(2048, dev->iobase + DAC1_REG); } -static irqreturn_t atmio16d_interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t atmio16d_interrupt(int irq, void *d) { struct comedi_device *dev = d; struct comedi_subdevice *s = dev->subdevices + 0; -// printk("atmio16d_interrupt!\n"); +/* printk("atmio16d_interrupt!\n"); */ comedi_buf_put(s->async, inw(dev->iobase + AD_FIFO_REG)); @@ -542,9 +542,9 @@ static int atmio16d_ai_insn_read(struct comedi_device * dev, struct comedi_subde gain = CR_RANGE(insn->chanspec); /* reset the Analog input circuitry */ - //outw( 0, dev->iobase+AD_CLEAR_REG ); + /* outw( 0, dev->iobase+AD_CLEAR_REG ); */ /* reset the Analog Input MUX Counter to 0 */ - //outw( 0, dev->iobase+MUX_CNTR_REG ); + /* outw( 0, dev->iobase+MUX_CNTR_REG ); */ /* set the Input MUX gain */ outw(chan | (gain << 6), dev->iobase + MUX_GAIN_REG); diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 61a31ad2d030..cbefda8e9de4 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -53,7 +53,7 @@ IRQ is assigned but not used. static struct pcmcia_device *pcmcia_cur_dev = NULL; -#define DIO700_SIZE 8 // size of io region used by board +#define DIO700_SIZE 8 /* size of io region used by board */ static int dio700_attach(struct comedi_device * dev, struct comedi_devconfig * it); static int dio700_detach(struct comedi_device * dev); @@ -62,11 +62,11 @@ enum dio700_bustype { pcmcia_bustype }; struct dio700_board { const char *name; - int device_id; // device id for pcmcia board - enum dio700_bustype bustype; // PCMCIA - int have_dio; // have daqcard-700 dio - // function pointers so we can use inb/outb or readb/writeb - // as appropriate + int device_id; /* device id for pcmcia board */ + enum dio700_bustype bustype; /* PCMCIA */ + int have_dio; /* have daqcard-700 dio */ + /* function pointers so we can use inb/outb or readb/writeb */ + /* as appropriate */ unsigned int (*read_byte) (unsigned int address); void (*write_byte) (unsigned int byte, unsigned int address); }; @@ -74,13 +74,13 @@ struct dio700_board { static const struct dio700_board dio700_boards[] = { { name: "daqcard-700", - device_id:0x4743,// 0x10b is manufacturer id, 0x4743 is device id + device_id:0x4743,/* 0x10b is manufacturer id, 0x4743 is device id */ bustype: pcmcia_bustype, have_dio:1, }, { name: "ni_daq_700", - device_id:0x4743,// 0x10b is manufacturer id, 0x4743 is device id + device_id:0x4743,/* 0x10b is manufacturer id, 0x4743 is device id */ bustype: pcmcia_bustype, have_dio:1, }, @@ -365,7 +365,7 @@ static int dio700_attach(struct comedi_device * dev, struct comedi_devconfig * i if (alloc_private(dev, sizeof(struct dio700_private)) < 0) return -ENOMEM; - // get base address, irq etc. based on bustype + /* get base address, irq etc. based on bustype */ switch (thisboard->bustype) { case pcmcia_bustype: link = pcmcia_cur_dev; /* XXX hack */ @@ -430,7 +430,7 @@ static int dio700_detach(struct comedi_device * dev) return 0; }; -// PCMCIA crap +/* PCMCIA crap */ /* All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c b/drivers/staging/comedi/drivers/ni_daq_dio24.c index daec5c4b4c95..7f9e502403c8 100644 --- a/drivers/staging/comedi/drivers/ni_daq_dio24.c +++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c @@ -37,7 +37,7 @@ This is just a wrapper around the 8255.o driver to properly handle the PCMCIA interface. */ -//#define LABPC_DEBUG // enable debugging messages +/* #define LABPC_DEBUG */ /* enable debugging messages */ #undef LABPC_DEBUG #include "../comedidev.h" @@ -54,33 +54,33 @@ the PCMCIA interface. static struct pcmcia_device *pcmcia_cur_dev = NULL; -#define DIO24_SIZE 4 // size of io region used by board +#define DIO24_SIZE 4 /* size of io region used by board */ static int dio24_attach(struct comedi_device * dev, struct comedi_devconfig * it); static int dio24_detach(struct comedi_device * dev); enum dio24_bustype { pcmcia_bustype }; -typedef struct dio24_board_struct { +struct dio24_board_struct { const char *name; - int device_id; // device id for pcmcia board - enum dio24_bustype bustype; // PCMCIA - int have_dio; // have 8255 chip - // function pointers so we can use inb/outb or readb/writeb as appropriate + int device_id; /* device id for pcmcia board */ + enum dio24_bustype bustype; /* PCMCIA */ + int have_dio; /* have 8255 chip */ + /* function pointers so we can use inb/outb or readb/writeb as appropriate */ unsigned int (*read_byte) (unsigned int address); void (*write_byte) (unsigned int byte, unsigned int address); -} dio24_board; +}; -static const dio24_board dio24_boards[] = { +static const struct dio24_board_struct dio24_boards[] = { { name: "daqcard-dio24", - device_id:0x475c,// 0x10b is manufacturer id, 0x475c is device id + device_id:0x475c,/* 0x10b is manufacturer id, 0x475c is device id */ bustype: pcmcia_bustype, have_dio:1, }, { name: "ni_daq_dio24", - device_id:0x475c,// 0x10b is manufacturer id, 0x475c is device id + device_id:0x475c,/* 0x10b is manufacturer id, 0x475c is device id */ bustype: pcmcia_bustype, have_dio:1, }, @@ -89,7 +89,7 @@ static const dio24_board dio24_boards[] = { /* * Useful for shorthand access to the particular board structure */ -#define thisboard ((const dio24_board *)dev->board_ptr) +#define thisboard ((const struct dio24_board_struct *)dev->board_ptr) struct dio24_private { @@ -104,9 +104,9 @@ static struct comedi_driver driver_dio24 = { module:THIS_MODULE, attach:dio24_attach, detach:dio24_detach, - num_names:sizeof(dio24_boards) / sizeof(dio24_board), + num_names:sizeof(dio24_boards) / sizeof(struct dio24_board_struct), board_name:&dio24_boards[0].name, - offset:sizeof(dio24_board), + offset:sizeof(struct dio24_board_struct), }; static int dio24_attach(struct comedi_device * dev, struct comedi_devconfig * it) @@ -122,7 +122,7 @@ static int dio24_attach(struct comedi_device * dev, struct comedi_devconfig * it if (alloc_private(dev, sizeof(struct dio24_private)) < 0) return -ENOMEM; - // get base address, irq etc. based on bustype + /* get base address, irq etc. based on bustype */ switch (thisboard->bustype) { case pcmcia_bustype: link = pcmcia_cur_dev; /* XXX hack */ @@ -187,7 +187,7 @@ static int dio24_detach(struct comedi_device * dev) return 0; }; -// PCMCIA crap +/* PCMCIA crap */ /* All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If @@ -236,12 +236,12 @@ static void dio24_cs_detach(struct pcmcia_device *); static const dev_info_t dev_info = "ni_daq_dio24"; -typedef struct local_info_t { +struct local_info_t { struct pcmcia_device *link; dev_node_t node; int stop; struct bus_operations *bus; -} local_info_t; +}; /*====================================================================== @@ -257,14 +257,14 @@ typedef struct local_info_t { static int dio24_cs_attach(struct pcmcia_device *link) { - local_info_t *local; + struct local_info_t *local; printk(KERN_INFO "ni_daq_dio24: HOLA SOY YO - CS-attach!\n"); DEBUG(0, "dio24_cs_attach()\n"); /* Allocate space for private device-specific data */ - local = kzalloc(sizeof(local_info_t), GFP_KERNEL); + local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); if (!local) return -ENOMEM; local->link = link; @@ -309,7 +309,7 @@ static void dio24_cs_detach(struct pcmcia_device *link) DEBUG(0, "dio24_cs_detach(0x%p)\n", link); if (link->dev_node) { - ((local_info_t *) link->priv)->stop = 1; + ((struct local_info_t *) link->priv)->stop = 1; dio24_release(link); } @@ -329,7 +329,7 @@ static void dio24_cs_detach(struct pcmcia_device *link) static void dio24_config(struct pcmcia_device *link) { - local_info_t *dev = link->priv; + struct local_info_t *dev = link->priv; tuple_t tuple; cisparse_t parse; int last_ret; @@ -529,7 +529,7 @@ static void dio24_release(struct pcmcia_device *link) static int dio24_cs_suspend(struct pcmcia_device *link) { - local_info_t *local = link->priv; + struct local_info_t *local = link->priv; /* Mark the device as stopped, to block IO until later */ local->stop = 1; @@ -538,7 +538,7 @@ static int dio24_cs_suspend(struct pcmcia_device *link) static int dio24_cs_resume(struct pcmcia_device *link) { - local_info_t *local = link->priv; + struct local_info_t *local = link->priv; local->stop = 0; return 0; diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c index 37898d8474cd..15172c20251d 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.c +++ b/drivers/staging/comedi/drivers/ni_labpc.c @@ -74,7 +74,7 @@ NI manuals: */ #undef LABPC_DEBUG -//#define LABPC_DEBUG // enable debugging messages +/* #define LABPC_DEBUG enable debugging messages */ #include "../comedidev.h" @@ -89,83 +89,83 @@ NI manuals: #define DRV_NAME "ni_labpc" -#define LABPC_SIZE 32 // size of io region used by board -#define LABPC_TIMER_BASE 500 // 2 MHz master clock +#define LABPC_SIZE 32 /* size of io region used by board */ +#define LABPC_TIMER_BASE 500 /* 2 MHz master clock */ /* Registers for the lab-pc+ */ -//write-only registers +/* write-only registers */ #define COMMAND1_REG 0x0 #define ADC_GAIN_MASK (0x7 << 4) #define ADC_CHAN_BITS(x) ((x) & 0x7) -#define ADC_SCAN_EN_BIT 0x80 // enables multi channel scans +#define ADC_SCAN_EN_BIT 0x80 /* enables multi channel scans */ #define COMMAND2_REG 0x1 -#define PRETRIG_BIT 0x1 // enable pretriggering (used in conjunction with SWTRIG) -#define HWTRIG_BIT 0x2 // enable paced conversions on external trigger -#define SWTRIG_BIT 0x4 // enable paced conversions -#define CASCADE_BIT 0x8 // use two cascaded counters for pacing +#define PRETRIG_BIT 0x1 /* enable pretriggering (used in conjunction with SWTRIG) */ +#define HWTRIG_BIT 0x2 /* enable paced conversions on external trigger */ +#define SWTRIG_BIT 0x4 /* enable paced conversions */ +#define CASCADE_BIT 0x8 /* use two cascaded counters for pacing */ #define DAC_PACED_BIT(channel) (0x40 << ((channel) & 0x1)) #define COMMAND3_REG 0x2 -#define DMA_EN_BIT 0x1 // enable dma transfers -#define DIO_INTR_EN_BIT 0x2 // enable interrupts for 8255 -#define DMATC_INTR_EN_BIT 0x4 // enable dma terminal count interrupt -#define TIMER_INTR_EN_BIT 0x8 // enable timer interrupt -#define ERR_INTR_EN_BIT 0x10 // enable error interrupt -#define ADC_FNE_INTR_EN_BIT 0x20 // enable fifo not empty interrupt +#define DMA_EN_BIT 0x1 /* enable dma transfers */ +#define DIO_INTR_EN_BIT 0x2 /* enable interrupts for 8255 */ +#define DMATC_INTR_EN_BIT 0x4 /* enable dma terminal count interrupt */ +#define TIMER_INTR_EN_BIT 0x8 /* enable timer interrupt */ +#define ERR_INTR_EN_BIT 0x10 /* enable error interrupt */ +#define ADC_FNE_INTR_EN_BIT 0x20 /* enable fifo not empty interrupt */ #define ADC_CONVERT_REG 0x3 #define DAC_LSB_REG(channel) (0x4 + 2 * ((channel) & 0x1)) #define DAC_MSB_REG(channel) (0x5 + 2 * ((channel) & 0x1)) #define ADC_CLEAR_REG 0x8 #define DMATC_CLEAR_REG 0xa #define TIMER_CLEAR_REG 0xc -#define COMMAND6_REG 0xe // 1200 boards only -#define ADC_COMMON_BIT 0x1 // select ground or common-mode reference -#define ADC_UNIP_BIT 0x2 // adc unipolar -#define DAC_UNIP_BIT(channel) (0x4 << ((channel) & 0x1)) // dac unipolar -#define ADC_FHF_INTR_EN_BIT 0x20 // enable fifo half full interrupt -#define A1_INTR_EN_BIT 0x40 // enable interrupt on end of hardware count -#define ADC_SCAN_UP_BIT 0x80 // scan up from channel zero instead of down to zero +#define COMMAND6_REG 0xe /* 1200 boards only */ +#define ADC_COMMON_BIT 0x1 /* select ground or common-mode reference */ +#define ADC_UNIP_BIT 0x2 /* adc unipolar */ +#define DAC_UNIP_BIT(channel) (0x4 << ((channel) & 0x1)) /* dac unipolar */ +#define ADC_FHF_INTR_EN_BIT 0x20 /* enable fifo half full interrupt */ +#define A1_INTR_EN_BIT 0x40 /* enable interrupt on end of hardware count */ +#define ADC_SCAN_UP_BIT 0x80 /* scan up from channel zero instead of down to zero */ #define COMMAND4_REG 0xf -#define INTERVAL_SCAN_EN_BIT 0x1 // enables 'interval' scanning -#define EXT_SCAN_EN_BIT 0x2 // enables external signal on counter b1 output to trigger scan -#define EXT_CONVERT_OUT_BIT 0x4 // chooses direction (output or input) for EXTCONV* line -#define ADC_DIFF_BIT 0x8 // chooses differential inputs for adc (in conjunction with board jumper) +#define INTERVAL_SCAN_EN_BIT 0x1 /* enables 'interval' scanning */ +#define EXT_SCAN_EN_BIT 0x2 /* enables external signal on counter b1 output to trigger scan */ +#define EXT_CONVERT_OUT_BIT 0x4 /* chooses direction (output or input) for EXTCONV* line */ +#define ADC_DIFF_BIT 0x8 /* chooses differential inputs for adc (in conjunction with board jumper) */ #define EXT_CONVERT_DISABLE_BIT 0x10 -#define COMMAND5_REG 0x1c // 1200 boards only, calibration stuff -#define EEPROM_WRITE_UNPROTECT_BIT 0x4 // enable eeprom for write -#define DITHER_EN_BIT 0x8 // enable dithering -#define CALDAC_LOAD_BIT 0x10 // load calibration dac -#define SCLOCK_BIT 0x20 // serial clock - rising edge writes, falling edge reads -#define SDATA_BIT 0x40 // serial data bit for writing to eeprom or calibration dacs -#define EEPROM_EN_BIT 0x80 // enable eeprom for read/write +#define COMMAND5_REG 0x1c /* 1200 boards only, calibration stuff */ +#define EEPROM_WRITE_UNPROTECT_BIT 0x4 /* enable eeprom for write */ +#define DITHER_EN_BIT 0x8 /* enable dithering */ +#define CALDAC_LOAD_BIT 0x10 /* load calibration dac */ +#define SCLOCK_BIT 0x20 /* serial clock - rising edge writes, falling edge reads */ +#define SDATA_BIT 0x40 /* serial data bit for writing to eeprom or calibration dacs */ +#define EEPROM_EN_BIT 0x80 /* enable eeprom for read/write */ #define INTERVAL_COUNT_REG 0x1e #define INTERVAL_LOAD_REG 0x1f #define INTERVAL_LOAD_BITS 0x1 -// read-only registers +/* read-only registers */ #define STATUS1_REG 0x0 -#define DATA_AVAIL_BIT 0x1 // data is available in fifo -#define OVERRUN_BIT 0x2 // overrun has occurred -#define OVERFLOW_BIT 0x4 // fifo overflow -#define TIMER_BIT 0x8 // timer interrupt has occured -#define DMATC_BIT 0x10 // dma terminal count has occured -#define EXT_TRIG_BIT 0x40 // external trigger has occured -#define STATUS2_REG 0x1d // 1200 boards only -#define EEPROM_OUT_BIT 0x1 // programmable eeprom serial output -#define A1_TC_BIT 0x2 // counter A1 terminal count -#define FNHF_BIT 0x4 // fifo not half full +#define DATA_AVAIL_BIT 0x1 /* data is available in fifo */ +#define OVERRUN_BIT 0x2 /* overrun has occurred */ +#define OVERFLOW_BIT 0x4 /* fifo overflow */ +#define TIMER_BIT 0x8 /* timer interrupt has occured */ +#define DMATC_BIT 0x10 /* dma terminal count has occured */ +#define EXT_TRIG_BIT 0x40 /* external trigger has occured */ +#define STATUS2_REG 0x1d /* 1200 boards only */ +#define EEPROM_OUT_BIT 0x1 /* programmable eeprom serial output */ +#define A1_TC_BIT 0x2 /* counter A1 terminal count */ +#define FNHF_BIT 0x4 /* fifo not half full */ #define ADC_FIFO_REG 0xa #define DIO_BASE_REG 0x10 #define COUNTER_A_BASE_REG 0x14 #define COUNTER_A_CONTROL_REG (COUNTER_A_BASE_REG + 0x3) -#define INIT_A0_BITS 0x14 // check modes put conversion pacer output in harmless state (a0 mode 2) -#define INIT_A1_BITS 0x70 // put hardware conversion counter output in harmless state (a1 mode 0) +#define INIT_A0_BITS 0x14 /* check modes put conversion pacer output in harmless state (a0 mode 2) */ +#define INIT_A1_BITS 0x70 /* put hardware conversion counter output in harmless state (a1 mode 0) */ #define COUNTER_B_BASE_REG 0x18 static int labpc_attach(struct comedi_device * dev, struct comedi_devconfig * it); static int labpc_cancel(struct comedi_device * dev, struct comedi_subdevice * s); -static irqreturn_t labpc_interrupt(int irq, void *d PT_REGS_ARG); +static irqreturn_t labpc_interrupt(int irq, void *d); static int labpc_drain_fifo(struct comedi_device * dev); static void labpc_drain_dma(struct comedi_device * dev); static void handle_isa_dma(struct comedi_device * dev); @@ -212,9 +212,9 @@ enum scan_mode { MODE_MULT_CHAN_DOWN, }; -//analog input ranges +/* analog input ranges */ #define NUM_LABPC_PLUS_AI_RANGES 16 -// indicates unipolar ranges +/* indicates unipolar ranges */ static const int labpc_plus_is_unipolar[NUM_LABPC_PLUS_AI_RANGES] = { 0, 0, @@ -234,7 +234,7 @@ static const int labpc_plus_is_unipolar[NUM_LABPC_PLUS_AI_RANGES] = { 1, }; -// map range index to gain bits +/* map range index to gain bits */ static const int labpc_plus_ai_gain_bits[NUM_LABPC_PLUS_AI_RANGES] = { 0x00, 0x10, @@ -276,7 +276,7 @@ static const struct comedi_lrange range_labpc_plus_ai = { }; #define NUM_LABPC_1200_AI_RANGES 14 -// indicates unipolar ranges +/* indicates unipolar ranges */ const int labpc_1200_is_unipolar[NUM_LABPC_1200_AI_RANGES] = { 0, 0, @@ -294,7 +294,7 @@ const int labpc_1200_is_unipolar[NUM_LABPC_1200_AI_RANGES] = { 1, }; -// map range index to gain bits +/* map range index to gain bits */ const int labpc_1200_ai_gain_bits[NUM_LABPC_1200_AI_RANGES] = { 0x00, 0x20, @@ -331,7 +331,7 @@ const struct comedi_lrange range_labpc_1200_ai = { } }; -//analog output ranges +/* analog output ranges */ #define AO_RANGE_IS_UNIPOLAR 0x1 static const struct comedi_lrange range_labpc_ao = { 2, @@ -360,7 +360,7 @@ static inline void labpc_writeb(unsigned int byte, unsigned long address) writeb(byte, (void *)address); } -static const labpc_board labpc_boards[] = { +static const struct labpc_board_struct labpc_boards[] = { { name: "lab-pc-1200", ai_speed:10000, @@ -411,7 +411,7 @@ static const labpc_board labpc_boards[] = { ai_scan_up:1, memory_mapped_io:1, }, - // dummy entry so pci board works when comedi_config is passed driver name + /* dummy entry so pci board works when comedi_config is passed driver name */ { .name = DRV_NAME, .bustype = pci_bustype, @@ -422,21 +422,21 @@ static const labpc_board labpc_boards[] = { /* * Useful for shorthand access to the particular board structure */ -#define thisboard ((labpc_board *)dev->board_ptr) +#define thisboard ((struct labpc_board_struct *)dev->board_ptr) -static const int dma_buffer_size = 0xff00; // size in bytes of dma buffer -static const int sample_size = 2; // 2 bytes per sample +static const int dma_buffer_size = 0xff00; /* size in bytes of dma buffer */ +static const int sample_size = 2; /* 2 bytes per sample */ -#define devpriv ((labpc_private *)dev->private) +#define devpriv ((struct labpc_private *)dev->private) static struct comedi_driver driver_labpc = { .driver_name = DRV_NAME, .module = THIS_MODULE, .attach = labpc_attach, .detach = labpc_common_detach, - .num_names = sizeof(labpc_boards) / sizeof(labpc_board), + .num_names = sizeof(labpc_boards) / sizeof(struct labpc_board_struct), .board_name = &labpc_boards[0].name, - .offset = sizeof(labpc_board), + .offset = sizeof(struct labpc_board_struct), }; #ifdef CONFIG_COMEDI_PCI @@ -481,7 +481,7 @@ int labpc_common_attach(struct comedi_device * dev, unsigned long iobase, printk("io base address is zero!\n"); return -EINVAL; } - // request io regions for isa boards + /* request io regions for isa boards */ if (thisboard->bustype == isa_bustype) { /* check if io addresses are available */ if (!request_region(iobase, LABPC_SIZE, @@ -499,7 +499,7 @@ int labpc_common_attach(struct comedi_device * dev, unsigned long iobase, devpriv->read_byte = labpc_inb; devpriv->write_byte = labpc_outb; } - // initialize board's command registers + /* initialize board's command registers */ devpriv->write_byte(devpriv->command1_bits, dev->iobase + COMMAND1_REG); devpriv->write_byte(devpriv->command2_bits, dev->iobase + COMMAND2_REG); devpriv->write_byte(devpriv->command3_bits, dev->iobase + COMMAND3_REG); @@ -524,12 +524,12 @@ int labpc_common_attach(struct comedi_device * dev, unsigned long iobase, } dev->irq = irq; - // grab dma channel + /* grab dma channel */ if (dma_chan > 3) { printk(" invalid dma channel %u\n", dma_chan); return -EINVAL; } else if (dma_chan) { - // allocate dma buffer + /* allocate dma buffer */ devpriv->dma_buffer = kmalloc(dma_buffer_size, GFP_KERNEL | GFP_DMA); if (devpriv->dma_buffer == NULL) { @@ -562,7 +562,7 @@ int labpc_common_attach(struct comedi_device * dev, unsigned long iobase, SDF_CMD_READ; s->n_chan = 8; s->len_chanlist = 8; - s->maxdata = (1 << 12) - 1; // 12 bit resolution + s->maxdata = (1 << 12) - 1; /* 12 bit resolution */ s->range_table = thisboard->ai_range_table; s->do_cmd = labpc_ai_cmd; s->do_cmdtest = labpc_ai_cmdtest; @@ -577,7 +577,7 @@ int labpc_common_attach(struct comedi_device * dev, unsigned long iobase, s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_GROUND; s->n_chan = NUM_AO_CHAN; - s->maxdata = (1 << 12) - 1; // 12 bit resolution + s->maxdata = (1 << 12) - 1; /* 12 bit resolution */ s->range_table = &range_labpc_ao; s->insn_read = labpc_ao_rinsn; s->insn_write = labpc_ao_winsn; @@ -595,14 +595,14 @@ int labpc_common_attach(struct comedi_device * dev, unsigned long iobase, /* 8255 dio */ s = dev->subdevices + 2; - // if board uses io memory we have to give a custom callback function to the 8255 driver + /* if board uses io memory we have to give a custom callback function to the 8255 driver */ if (thisboard->memory_mapped_io) subdev_8255_init(dev, s, labpc_dio_mem_callback, (unsigned long)(dev->iobase + DIO_BASE_REG)); else subdev_8255_init(dev, s, NULL, dev->iobase + DIO_BASE_REG); - // calibration subdevices for boards that have one + /* calibration subdevices for boards that have one */ s = dev->subdevices + 3; if (thisboard->register_layout == labpc_1200_layout) { s->type = COMEDI_SUBD_CALIB; @@ -653,10 +653,10 @@ static int labpc_attach(struct comedi_device * dev, struct comedi_devconfig * it #endif /* allocate and initialize dev->private */ - if (alloc_private(dev, sizeof(labpc_private)) < 0) + if (alloc_private(dev, sizeof(struct labpc_private)) < 0) return -ENOMEM; - // get base address, irq etc. based on bustype + /* get base address, irq etc. based on bustype */ switch (thisboard->bustype) { case isa_bustype: iobase = it->options[0]; @@ -692,7 +692,7 @@ static int labpc_attach(struct comedi_device * dev, struct comedi_devconfig * it return labpc_common_attach(dev, iobase, irq, dma_chan); } -// adapted from ni_pcimio for finding mite based boards (pc-1200) +/* adapted from ni_pcimio for finding mite based boards (pc-1200) */ #ifdef CONFIG_COMEDI_PCI static int labpc_find_device(struct comedi_device *dev, int bus, int slot) { @@ -701,7 +701,7 @@ static int labpc_find_device(struct comedi_device *dev, int bus, int slot) for (mite = mite_devices; mite; mite = mite->next) { if (mite->used) continue; - // if bus/slot are specified then make sure we have the right bus/slot + /* if bus/slot are specified then make sure we have the right bus/slot */ if (bus || slot) { if (bus != mite->pcidev->bus->number || slot != PCI_SLOT(mite->pcidev->devfn)) @@ -712,7 +712,7 @@ static int labpc_find_device(struct comedi_device *dev, int bus, int slot) continue; if (mite_device_id(mite) == labpc_boards[i].device_id) { devpriv->mite = mite; - // fixup board pointer, in case we were using the dummy "ni_labpc" entry + /* fixup board pointer, in case we were using the dummy "ni_labpc" entry */ dev->board_ptr = &labpc_boards[i]; return 0; } @@ -980,7 +980,7 @@ static int labpc_ai_cmdtest(struct comedi_device * dev, struct comedi_subdevice cmd->stop_src != TRIG_EXT && cmd->stop_src != TRIG_NONE) err++; - // can't have external stop and start triggers at once + /* can't have external stop and start triggers at once */ if (cmd->start_src == TRIG_EXT && cmd->stop_src == TRIG_EXT) err++; @@ -1008,7 +1008,7 @@ static int labpc_ai_cmdtest(struct comedi_device * dev, struct comedi_subdevice err++; } } - // make sure scan timing is not too fast + /* make sure scan timing is not too fast */ if (cmd->scan_begin_src == TRIG_TIMER) { if (cmd->convert_src == TRIG_TIMER && cmd->scan_begin_arg < @@ -1024,7 +1024,7 @@ static int labpc_ai_cmdtest(struct comedi_device * dev, struct comedi_subdevice err++; } } - // stop source + /* stop source */ switch (cmd->stop_src) { case TRIG_COUNT: if (!cmd->stop_arg) { @@ -1038,7 +1038,7 @@ static int labpc_ai_cmdtest(struct comedi_device * dev, struct comedi_subdevice err++; } break; - // TRIG_EXT doesn't care since it doesn't trigger off a numbered channel + /* TRIG_EXT doesn't care since it doesn't trigger off a numbered channel */ default: break; } @@ -1081,7 +1081,7 @@ static int labpc_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) range = CR_RANGE(cmd->chanlist[0]); aref = CR_AREF(cmd->chanlist[0]); - // make sure board is disabled before setting up aquisition + /* make sure board is disabled before setting up aquisition */ comedi_spin_lock_irqsave(&dev->spinlock, flags); devpriv->command2_bits &= ~SWTRIG_BIT & ~HWTRIG_BIT & ~PRETRIG_BIT; devpriv->write_byte(devpriv->command2_bits, dev->iobase + COMMAND2_REG); @@ -1090,68 +1090,68 @@ static int labpc_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) devpriv->command3_bits = 0; devpriv->write_byte(devpriv->command3_bits, dev->iobase + COMMAND3_REG); - // initialize software conversion count + /* initialize software conversion count */ if (cmd->stop_src == TRIG_COUNT) { devpriv->count = cmd->stop_arg * cmd->chanlist_len; } - // setup hardware conversion counter + /* setup hardware conversion counter */ if (cmd->stop_src == TRIG_EXT) { - // load counter a1 with count of 3 (pc+ manual says this is minimum allowed) using mode 0 + /* load counter a1 with count of 3 (pc+ manual says this is minimum allowed) using mode 0 */ ret = labpc_counter_load(dev, dev->iobase + COUNTER_A_BASE_REG, 1, 3, 0); if (ret < 0) { comedi_error(dev, "error loading counter a1"); return -1; } - } else // otherwise, just put a1 in mode 0 with no count to set its output low + } else /* otherwise, just put a1 in mode 0 with no count to set its output low */ devpriv->write_byte(INIT_A1_BITS, dev->iobase + COUNTER_A_CONTROL_REG); - // figure out what method we will use to transfer data - if (devpriv->dma_chan && // need a dma channel allocated - // dma unsafe at RT priority, and too much setup time for TRIG_WAKE_EOS for + /* figure out what method we will use to transfer data */ + if (devpriv->dma_chan && /* need a dma channel allocated */ + /* dma unsafe at RT priority, and too much setup time for TRIG_WAKE_EOS for */ (cmd->flags & (TRIG_WAKE_EOS | TRIG_RT)) == 0 && - // only available on the isa boards + /* only available on the isa boards */ thisboard->bustype == isa_bustype) { xfer = isa_dma_transfer; - } else if (thisboard->register_layout == labpc_1200_layout && // pc-plus has no fifo-half full interrupt - // wake-end-of-scan should interrupt on fifo not empty + } else if (thisboard->register_layout == labpc_1200_layout && /* pc-plus has no fifo-half full interrupt */ + /* wake-end-of-scan should interrupt on fifo not empty */ (cmd->flags & TRIG_WAKE_EOS) == 0 && - // make sure we are taking more than just a few points + /* make sure we are taking more than just a few points */ (cmd->stop_src != TRIG_COUNT || devpriv->count > 256)) { xfer = fifo_half_full_transfer; } else xfer = fifo_not_empty_transfer; devpriv->current_transfer = xfer; - // setup command6 register for 1200 boards + /* setup command6 register for 1200 boards */ if (thisboard->register_layout == labpc_1200_layout) { - // reference inputs to ground or common? + /* reference inputs to ground or common? */ if (aref != AREF_GROUND) devpriv->command6_bits |= ADC_COMMON_BIT; else devpriv->command6_bits &= ~ADC_COMMON_BIT; - // bipolar or unipolar range? + /* bipolar or unipolar range? */ if (thisboard->ai_range_is_unipolar[range]) devpriv->command6_bits |= ADC_UNIP_BIT; else devpriv->command6_bits &= ~ADC_UNIP_BIT; - // interrupt on fifo half full? + /* interrupt on fifo half full? */ if (xfer == fifo_half_full_transfer) devpriv->command6_bits |= ADC_FHF_INTR_EN_BIT; else devpriv->command6_bits &= ~ADC_FHF_INTR_EN_BIT; - // enable interrupt on counter a1 terminal count? + /* enable interrupt on counter a1 terminal count? */ if (cmd->stop_src == TRIG_EXT) devpriv->command6_bits |= A1_INTR_EN_BIT; else devpriv->command6_bits &= ~A1_INTR_EN_BIT; - // are we scanning up or down through channels? + /* are we scanning up or down through channels? */ if (labpc_ai_scan_mode(cmd) == MODE_MULT_CHAN_UP) devpriv->command6_bits |= ADC_SCAN_UP_BIT; else devpriv->command6_bits &= ~ADC_SCAN_UP_BIT; - // write to register + /* write to register */ devpriv->write_byte(devpriv->command6_bits, dev->iobase + COMMAND6_REG); } @@ -1162,13 +1162,13 @@ static int labpc_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) channel = CR_CHAN(cmd->chanlist[cmd->chanlist_len - 1]); else channel = CR_CHAN(cmd->chanlist[0]); - // munge channel bits for differential / scan disabled mode + /* munge channel bits for differential / scan disabled mode */ if (labpc_ai_scan_mode(cmd) != MODE_SINGLE_CHAN && aref == AREF_DIFF) channel *= 2; devpriv->command1_bits |= ADC_CHAN_BITS(channel); devpriv->command1_bits |= thisboard->ai_range_code[range]; devpriv->write_byte(devpriv->command1_bits, dev->iobase + COMMAND1_REG); - // manual says to set scan enable bit on second pass + /* manual says to set scan enable bit on second pass */ if (labpc_ai_scan_mode(cmd) == MODE_MULT_CHAN_UP || labpc_ai_scan_mode(cmd) == MODE_MULT_CHAN_DOWN) { devpriv->command1_bits |= ADC_SCAN_EN_BIT; @@ -1178,7 +1178,7 @@ static int labpc_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) devpriv->write_byte(devpriv->command1_bits, dev->iobase + COMMAND1_REG); } - // setup any external triggering/pacing (command4 register) + /* setup any external triggering/pacing (command4 register) */ devpriv->command4_bits = 0; if (cmd->convert_src != TRIG_EXT) devpriv->command4_bits |= EXT_CONVERT_DISABLE_BIT; @@ -1189,21 +1189,21 @@ static int labpc_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) if (cmd->scan_begin_src == TRIG_EXT) devpriv->command4_bits |= EXT_SCAN_EN_BIT; } - // single-ended/differential + /* single-ended/differential */ if (aref == AREF_DIFF) devpriv->command4_bits |= ADC_DIFF_BIT; devpriv->write_byte(devpriv->command4_bits, dev->iobase + COMMAND4_REG); devpriv->write_byte(cmd->chanlist_len, dev->iobase + INTERVAL_COUNT_REG); - // load count + /* load count */ devpriv->write_byte(INTERVAL_LOAD_BITS, dev->iobase + INTERVAL_LOAD_REG); if (cmd->convert_src == TRIG_TIMER || cmd->scan_begin_src == TRIG_TIMER) { - // set up pacing + /* set up pacing */ labpc_adc_timing(dev, cmd); - // load counter b0 in mode 3 + /* load counter b0 in mode 3 */ ret = labpc_counter_load(dev, dev->iobase + COUNTER_B_BASE_REG, 0, devpriv->divisor_b0, 3); if (ret < 0) { @@ -1211,9 +1211,9 @@ static int labpc_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) return -1; } } - // set up conversion pacing + /* set up conversion pacing */ if (labpc_ai_convert_period(cmd)) { - // load counter a0 in mode 2 + /* load counter a0 in mode 2 */ ret = labpc_counter_load(dev, dev->iobase + COUNTER_A_BASE_REG, 0, devpriv->divisor_a0, 2); if (ret < 0) { @@ -1224,9 +1224,9 @@ static int labpc_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) devpriv->write_byte(INIT_A0_BITS, dev->iobase + COUNTER_A_CONTROL_REG); - // set up scan pacing + /* set up scan pacing */ if (labpc_ai_scan_period(cmd)) { - // load counter b1 in mode 2 + /* load counter b1 in mode 2 */ ret = labpc_counter_load(dev, dev->iobase + COUNTER_B_BASE_REG, 1, devpriv->divisor_b1, 2); if (ret < 0) { @@ -1237,7 +1237,7 @@ static int labpc_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) labpc_clear_adc_fifo(dev); - // set up dma transfer + /* set up dma transfer */ if (xfer == isa_dma_transfer) { irq_flags = claim_dma_lock(); disable_dma(devpriv->dma_chan); @@ -1246,7 +1246,7 @@ static int labpc_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) clear_dma_ff(devpriv->dma_chan); set_dma_addr(devpriv->dma_chan, virt_to_bus(devpriv->dma_buffer)); - // set appropriate size of transfer + /* set appropriate size of transfer */ devpriv->dma_transfer_size = labpc_suggest_transfer_size(*cmd); if (cmd->stop_src == TRIG_COUNT && devpriv->count * sample_size < @@ -1257,24 +1257,24 @@ static int labpc_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) set_dma_count(devpriv->dma_chan, devpriv->dma_transfer_size); enable_dma(devpriv->dma_chan); release_dma_lock(irq_flags); - // enable board's dma + /* enable board's dma */ devpriv->command3_bits |= DMA_EN_BIT | DMATC_INTR_EN_BIT; } else devpriv->command3_bits &= ~DMA_EN_BIT & ~DMATC_INTR_EN_BIT; - // enable error interrupts + /* enable error interrupts */ devpriv->command3_bits |= ERR_INTR_EN_BIT; - // enable fifo not empty interrupt? + /* enable fifo not empty interrupt? */ if (xfer == fifo_not_empty_transfer) devpriv->command3_bits |= ADC_FNE_INTR_EN_BIT; else devpriv->command3_bits &= ~ADC_FNE_INTR_EN_BIT; devpriv->write_byte(devpriv->command3_bits, dev->iobase + COMMAND3_REG); - // startup aquisition + /* startup aquisition */ - // command2 reg - // use 2 cascaded counters for pacing + /* command2 reg */ + /* use 2 cascaded counters for pacing */ comedi_spin_lock_irqsave(&dev->spinlock, flags); devpriv->command2_bits |= CASCADE_BIT; switch (cmd->start_src) { @@ -1309,7 +1309,7 @@ static int labpc_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) } /* interrupt service routine */ -static irqreturn_t labpc_interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t labpc_interrupt(int irq, void *d) { struct comedi_device *dev = d; struct comedi_subdevice *s = dev->read_subdev; @@ -1325,7 +1325,7 @@ static irqreturn_t labpc_interrupt(int irq, void *d PT_REGS_ARG) cmd = &async->cmd; async->events = 0; - // read board status + /* read board status */ devpriv->status1_bits = devpriv->read_byte(dev->iobase + STATUS1_REG); if (thisboard->register_layout == labpc_1200_layout) devpriv->status2_bits = @@ -1339,7 +1339,7 @@ static irqreturn_t labpc_interrupt(int irq, void *d PT_REGS_ARG) } if (devpriv->status1_bits & OVERRUN_BIT) { - // clear error interrupt + /* clear error interrupt */ devpriv->write_byte(0x1, dev->iobase + ADC_CLEAR_REG); async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; comedi_event(dev, s); @@ -1348,7 +1348,7 @@ static irqreturn_t labpc_interrupt(int irq, void *d PT_REGS_ARG) } if (devpriv->current_transfer == isa_dma_transfer) { - // if a dma terminal count of external stop trigger has occurred + /* if a dma terminal count of external stop trigger has occurred */ if (devpriv->status1_bits & DMATC_BIT || (thisboard->register_layout == labpc_1200_layout && devpriv->status2_bits & A1_TC_BIT)) { @@ -1359,19 +1359,19 @@ static irqreturn_t labpc_interrupt(int irq, void *d PT_REGS_ARG) if (devpriv->status1_bits & TIMER_BIT) { comedi_error(dev, "handled timer interrupt?"); - // clear it + /* clear it */ devpriv->write_byte(0x1, dev->iobase + TIMER_CLEAR_REG); } if (devpriv->status1_bits & OVERFLOW_BIT) { - // clear error interrupt + /* clear error interrupt */ devpriv->write_byte(0x1, dev->iobase + ADC_CLEAR_REG); async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; comedi_event(dev, s); comedi_error(dev, "overflow"); return IRQ_HANDLED; } - // handle external stop trigger + /* handle external stop trigger */ if (cmd->stop_src == TRIG_EXT) { if (devpriv->status2_bits & A1_TC_BIT) { labpc_drain_dregs(dev); @@ -1392,7 +1392,7 @@ static irqreturn_t labpc_interrupt(int irq, void *d PT_REGS_ARG) return IRQ_HANDLED; } -// read all available samples from ai fifo +/* read all available samples from ai fifo */ static int labpc_drain_fifo(struct comedi_device * dev) { unsigned int lsb, msb; @@ -1405,7 +1405,7 @@ static int labpc_drain_fifo(struct comedi_device * dev) for (i = 0; (devpriv->status1_bits & DATA_AVAIL_BIT) && i < timeout; i++) { - // quit if we have all the data we want + /* quit if we have all the data we want */ if (async->cmd.stop_src == TRIG_COUNT) { if (devpriv->count == 0) break; @@ -1444,7 +1444,7 @@ static void labpc_drain_dma(struct comedi_device * dev) * count and address get set correctly */ clear_dma_ff(devpriv->dma_chan); - // figure out how many points to read + /* figure out how many points to read */ max_points = devpriv->dma_transfer_size / sample_size; /* residue is the number of points left to be done on the dma * transfer. It should always be zero at this point unless @@ -1455,7 +1455,7 @@ static void labpc_drain_dma(struct comedi_device * dev) if (devpriv->count < num_points && async->cmd.stop_src == TRIG_COUNT) num_points = devpriv->count; - // figure out how many points will be stored next time + /* figure out how many points will be stored next time */ leftover = 0; if (async->cmd.stop_src != TRIG_COUNT) { leftover = devpriv->dma_transfer_size / sample_size; @@ -1472,7 +1472,7 @@ static void labpc_drain_dma(struct comedi_device * dev) if (async->cmd.stop_src == TRIG_COUNT) devpriv->count -= num_points; - // set address and count for next transfer + /* set address and count for next transfer */ set_dma_addr(devpriv->dma_chan, virt_to_bus(devpriv->dma_buffer)); set_dma_count(devpriv->dma_chan, leftover * sample_size); release_dma_lock(flags); @@ -1486,7 +1486,7 @@ static void handle_isa_dma(struct comedi_device * dev) enable_dma(devpriv->dma_chan); - // clear dma tc interrupt + /* clear dma tc interrupt */ devpriv->write_byte(0x1, dev->iobase + DMATC_CLEAR_REG); } @@ -1509,13 +1509,13 @@ static int labpc_ai_rinsn(struct comedi_device * dev, struct comedi_subdevice * int timeout = 1000; unsigned long flags; - // disable timed conversions + /* disable timed conversions */ comedi_spin_lock_irqsave(&dev->spinlock, flags); devpriv->command2_bits &= ~SWTRIG_BIT & ~HWTRIG_BIT & ~PRETRIG_BIT; devpriv->write_byte(devpriv->command2_bits, dev->iobase + COMMAND2_REG); comedi_spin_unlock_irqrestore(&dev->spinlock, flags); - // disable interrupt generation and dma + /* disable interrupt generation and dma */ devpriv->command3_bits = 0; devpriv->write_byte(devpriv->command3_bits, dev->iobase + COMMAND3_REG); @@ -1524,41 +1524,41 @@ static int labpc_ai_rinsn(struct comedi_device * dev, struct comedi_subdevice * chan = CR_CHAN(insn->chanspec); range = CR_RANGE(insn->chanspec); devpriv->command1_bits |= thisboard->ai_range_code[range]; - // munge channel bits for differential/scan disabled mode + /* munge channel bits for differential/scan disabled mode */ if (CR_AREF(insn->chanspec) == AREF_DIFF) chan *= 2; devpriv->command1_bits |= ADC_CHAN_BITS(chan); devpriv->write_byte(devpriv->command1_bits, dev->iobase + COMMAND1_REG); - // setup command6 register for 1200 boards + /* setup command6 register for 1200 boards */ if (thisboard->register_layout == labpc_1200_layout) { - // reference inputs to ground or common? + /* reference inputs to ground or common? */ if (CR_AREF(insn->chanspec) != AREF_GROUND) devpriv->command6_bits |= ADC_COMMON_BIT; else devpriv->command6_bits &= ~ADC_COMMON_BIT; - // bipolar or unipolar range? + /* bipolar or unipolar range? */ if (thisboard->ai_range_is_unipolar[range]) devpriv->command6_bits |= ADC_UNIP_BIT; else devpriv->command6_bits &= ~ADC_UNIP_BIT; - // don't interrupt on fifo half full + /* don't interrupt on fifo half full */ devpriv->command6_bits &= ~ADC_FHF_INTR_EN_BIT; - // don't enable interrupt on counter a1 terminal count? + /* don't enable interrupt on counter a1 terminal count? */ devpriv->command6_bits &= ~A1_INTR_EN_BIT; - // write to register + /* write to register */ devpriv->write_byte(devpriv->command6_bits, dev->iobase + COMMAND6_REG); } - // setup command4 register + /* setup command4 register */ devpriv->command4_bits = 0; devpriv->command4_bits |= EXT_CONVERT_DISABLE_BIT; - // single-ended/differential + /* single-ended/differential */ if (CR_AREF(insn->chanspec) == AREF_DIFF) devpriv->command4_bits |= ADC_DIFF_BIT; devpriv->write_byte(devpriv->command4_bits, dev->iobase + COMMAND4_REG); - // initialize pacer counter output to make sure it doesn't cause any problems + /* initialize pacer counter output to make sure it doesn't cause any problems */ devpriv->write_byte(INIT_A0_BITS, dev->iobase + COUNTER_A_CONTROL_REG); labpc_clear_adc_fifo(dev); @@ -1585,7 +1585,7 @@ static int labpc_ai_rinsn(struct comedi_device * dev, struct comedi_subdevice * return n; } -// analog output insn +/* analog output insn */ static int labpc_ao_winsn(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { @@ -1595,7 +1595,7 @@ static int labpc_ao_winsn(struct comedi_device * dev, struct comedi_subdevice * channel = CR_CHAN(insn->chanspec); - // turn off pacing of analog output channel + /* turn off pacing of analog output channel */ /* note: hardware bug in daqcard-1200 means pacing cannot * be independently enabled/disabled for its the two channels */ comedi_spin_lock_irqsave(&dev->spinlock, flags); @@ -1603,30 +1603,30 @@ static int labpc_ao_winsn(struct comedi_device * dev, struct comedi_subdevice * devpriv->write_byte(devpriv->command2_bits, dev->iobase + COMMAND2_REG); comedi_spin_unlock_irqrestore(&dev->spinlock, flags); - // set range + /* set range */ if (thisboard->register_layout == labpc_1200_layout) { range = CR_RANGE(insn->chanspec); if (range & AO_RANGE_IS_UNIPOLAR) devpriv->command6_bits |= DAC_UNIP_BIT(channel); else devpriv->command6_bits &= ~DAC_UNIP_BIT(channel); - // write to register + /* write to register */ devpriv->write_byte(devpriv->command6_bits, dev->iobase + COMMAND6_REG); } - // send data + /* send data */ lsb = data[0] & 0xff; msb = (data[0] >> 8) & 0xff; devpriv->write_byte(lsb, dev->iobase + DAC_LSB_REG(channel)); devpriv->write_byte(msb, dev->iobase + DAC_MSB_REG(channel)); - // remember value for readback + /* remember value for readback */ devpriv->ao_value[channel] = data[0]; return 1; } -// analog output readback insn +/* analog output readback insn */ static int labpc_ao_rinsn(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { @@ -1666,7 +1666,7 @@ static int labpc_eeprom_write_insn(struct comedi_device * dev, struct comedi_sub int channel = CR_CHAN(insn->chanspec); int ret; - // only allow writes to user area of eeprom + /* only allow writes to user area of eeprom */ if (channel < 16 || channel > 127) { printk("eeprom writes are only allowed to channels 16 through 127 (the pointer and user areas)"); return -EINVAL; @@ -1679,7 +1679,7 @@ static int labpc_eeprom_write_insn(struct comedi_device * dev, struct comedi_sub return 1; } -// utility function that suggests a dma transfer size in bytes +/* utility function that suggests a dma transfer size in bytes */ static unsigned int labpc_suggest_transfer_size(struct comedi_cmd cmd) { unsigned int size; @@ -1687,14 +1687,14 @@ static unsigned int labpc_suggest_transfer_size(struct comedi_cmd cmd) if (cmd.convert_src == TRIG_TIMER) freq = 1000000000 / cmd.convert_arg; - // return some default value + /* return some default value */ else freq = 0xffffffff; - // make buffer fill in no more than 1/3 second + /* make buffer fill in no more than 1/3 second */ size = (freq / 3) * sample_size; - // set a minimum and maximum size allowed + /* set a minimum and maximum size allowed */ if (size > dma_buffer_size) size = dma_buffer_size - dma_buffer_size % sample_size; else if (size < sample_size) @@ -1703,16 +1703,16 @@ static unsigned int labpc_suggest_transfer_size(struct comedi_cmd cmd) return size; } -// figures out what counter values to use based on command +/* figures out what counter values to use based on command */ static void labpc_adc_timing(struct comedi_device * dev, struct comedi_cmd * cmd) { - const int max_counter_value = 0x10000; // max value for 16 bit counter in mode 2 - const int min_counter_value = 2; // min value for 16 bit counter in mode 2 + const int max_counter_value = 0x10000; /* max value for 16 bit counter in mode 2 */ + const int min_counter_value = 2; /* min value for 16 bit counter in mode 2 */ unsigned int base_period; - // if both convert and scan triggers are TRIG_TIMER, then they both rely on counter b0 + /* if both convert and scan triggers are TRIG_TIMER, then they both rely on counter b0 */ if (labpc_ai_convert_period(cmd) && labpc_ai_scan_period(cmd)) { - // pick the lowest b0 divisor value we can (for maximum input clock speed on convert and scan counters) + /* pick the lowest b0 divisor value we can (for maximum input clock speed on convert and scan counters) */ devpriv->divisor_b0 = (labpc_ai_scan_period(cmd) - 1) / (LABPC_TIMER_BASE * max_counter_value) + 1; if (devpriv->divisor_b0 < min_counter_value) @@ -1722,7 +1722,7 @@ static void labpc_adc_timing(struct comedi_device * dev, struct comedi_cmd * cmd base_period = LABPC_TIMER_BASE * devpriv->divisor_b0; - // set a0 for conversion frequency and b1 for scan frequency + /* set a0 for conversion frequency and b1 for scan frequency */ switch (cmd->flags & TRIG_ROUND_MASK) { default: case TRIG_ROUND_NEAREST: @@ -1748,7 +1748,7 @@ static void labpc_adc_timing(struct comedi_device * dev, struct comedi_cmd * cmd labpc_ai_scan_period(cmd) / base_period; break; } - // make sure a0 and b1 values are acceptable + /* make sure a0 and b1 values are acceptable */ if (devpriv->divisor_a0 < min_counter_value) devpriv->divisor_a0 = min_counter_value; if (devpriv->divisor_a0 > max_counter_value) @@ -1757,12 +1757,12 @@ static void labpc_adc_timing(struct comedi_device * dev, struct comedi_cmd * cmd devpriv->divisor_b1 = min_counter_value; if (devpriv->divisor_b1 > max_counter_value) devpriv->divisor_b1 = max_counter_value; - // write corrected timings to command + /* write corrected timings to command */ labpc_set_ai_convert_period(cmd, base_period * devpriv->divisor_a0); labpc_set_ai_scan_period(cmd, base_period * devpriv->divisor_b1); - // if only one TRIG_TIMER is used, we can employ the generic cascaded timing functions + /* if only one TRIG_TIMER is used, we can employ the generic cascaded timing functions */ } else if (labpc_ai_scan_period(cmd)) { unsigned int scan_period; @@ -1795,16 +1795,16 @@ static int labpc_dio_mem_callback(int dir, int port, int data, } } -// lowlevel write to eeprom/dac +/* lowlevel write to eeprom/dac */ static void labpc_serial_out(struct comedi_device * dev, unsigned int value, unsigned int value_width) { int i; for (i = 1; i <= value_width; i++) { - // clear serial clock + /* clear serial clock */ devpriv->command5_bits &= ~SCLOCK_BIT; - // send bits most significant bit first + /* send bits most significant bit first */ if (value & (1 << (value_width - i))) devpriv->command5_bits |= SDATA_BIT; else @@ -1812,7 +1812,7 @@ static void labpc_serial_out(struct comedi_device * dev, unsigned int value, comedi_udelay(1); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); - // set clock to load bit + /* set clock to load bit */ devpriv->command5_bits |= SCLOCK_BIT; comedi_udelay(1); devpriv->write_byte(devpriv->command5_bits, @@ -1820,25 +1820,25 @@ static void labpc_serial_out(struct comedi_device * dev, unsigned int value, } } -// lowlevel read from eeprom +/* lowlevel read from eeprom */ static unsigned int labpc_serial_in(struct comedi_device * dev) { unsigned int value = 0; int i; - const int value_width = 8; // number of bits wide values are + const int value_width = 8; /* number of bits wide values are */ for (i = 1; i <= value_width; i++) { - // set serial clock + /* set serial clock */ devpriv->command5_bits |= SCLOCK_BIT; comedi_udelay(1); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); - // clear clock bit + /* clear clock bit */ devpriv->command5_bits &= ~SCLOCK_BIT; comedi_udelay(1); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); - // read bits most significant bit first + /* read bits most significant bit first */ comedi_udelay(1); devpriv->status2_bits = devpriv->read_byte(dev->iobase + STATUS2_REG); @@ -1853,10 +1853,10 @@ static unsigned int labpc_serial_in(struct comedi_device * dev) static unsigned int labpc_eeprom_read(struct comedi_device * dev, unsigned int address) { unsigned int value; - const int read_instruction = 0x3; // bits to tell eeprom to expect a read - const int write_length = 8; // 8 bit write lengths to eeprom + const int read_instruction = 0x3; /* bits to tell eeprom to expect a read */ + const int write_length = 8; /* 8 bit write lengths to eeprom */ - // enable read/write to eeprom + /* enable read/write to eeprom */ devpriv->command5_bits &= ~EEPROM_EN_BIT; comedi_udelay(1); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); @@ -1864,14 +1864,14 @@ static unsigned int labpc_eeprom_read(struct comedi_device * dev, unsigned int a comedi_udelay(1); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); - // send read instruction + /* send read instruction */ labpc_serial_out(dev, read_instruction, write_length); - // send 8 bit address to read from + /* send 8 bit address to read from */ labpc_serial_out(dev, address, write_length); - // read result + /* read result */ value = labpc_serial_in(dev); - // disable read/write to eeprom + /* disable read/write to eeprom */ devpriv->command5_bits &= ~EEPROM_EN_BIT & ~EEPROM_WRITE_UNPROTECT_BIT; comedi_udelay(1); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); @@ -1884,12 +1884,12 @@ static unsigned int labpc_eeprom_write(struct comedi_device * dev, { const int write_enable_instruction = 0x6; const int write_instruction = 0x2; - const int write_length = 8; // 8 bit write lengths to eeprom + const int write_length = 8; /* 8 bit write lengths to eeprom */ const int write_in_progress_bit = 0x1; const int timeout = 10000; int i; - // make sure there isn't already a write in progress + /* make sure there isn't already a write in progress */ for (i = 0; i < timeout; i++) { if ((labpc_eeprom_read_status(dev) & write_in_progress_bit) == 0) @@ -1899,10 +1899,10 @@ static unsigned int labpc_eeprom_write(struct comedi_device * dev, comedi_error(dev, "eeprom write timed out"); return -ETIME; } - // update software copy of eeprom + /* update software copy of eeprom */ devpriv->eeprom_data[address] = value; - // enable read/write to eeprom + /* enable read/write to eeprom */ devpriv->command5_bits &= ~EEPROM_EN_BIT; comedi_udelay(1); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); @@ -1910,26 +1910,26 @@ static unsigned int labpc_eeprom_write(struct comedi_device * dev, comedi_udelay(1); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); - // send write_enable instruction + /* send write_enable instruction */ labpc_serial_out(dev, write_enable_instruction, write_length); devpriv->command5_bits &= ~EEPROM_EN_BIT; comedi_udelay(1); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); - // send write instruction + /* send write instruction */ devpriv->command5_bits |= EEPROM_EN_BIT; comedi_udelay(1); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); labpc_serial_out(dev, write_instruction, write_length); - // send 8 bit address to write to + /* send 8 bit address to write to */ labpc_serial_out(dev, address, write_length); - // write value + /* write value */ labpc_serial_out(dev, value, write_length); devpriv->command5_bits &= ~EEPROM_EN_BIT; comedi_udelay(1); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); - // disable read/write to eeprom + /* disable read/write to eeprom */ devpriv->command5_bits &= ~EEPROM_EN_BIT & ~EEPROM_WRITE_UNPROTECT_BIT; comedi_udelay(1); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); @@ -1941,9 +1941,9 @@ static unsigned int labpc_eeprom_read_status(struct comedi_device * dev) { unsigned int value; const int read_status_instruction = 0x5; - const int write_length = 8; // 8 bit write lengths to eeprom + const int write_length = 8; /* 8 bit write lengths to eeprom */ - // enable read/write to eeprom + /* enable read/write to eeprom */ devpriv->command5_bits &= ~EEPROM_EN_BIT; comedi_udelay(1); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); @@ -1951,12 +1951,12 @@ static unsigned int labpc_eeprom_read_status(struct comedi_device * dev) comedi_udelay(1); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); - // send read status instruction + /* send read status instruction */ labpc_serial_out(dev, read_status_instruction, write_length); - // read result + /* read result */ value = labpc_serial_in(dev); - // disable read/write to eeprom + /* disable read/write to eeprom */ devpriv->command5_bits &= ~EEPROM_EN_BIT & ~EEPROM_WRITE_UNPROTECT_BIT; comedi_udelay(1); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); @@ -1964,7 +1964,7 @@ static unsigned int labpc_eeprom_read_status(struct comedi_device * dev) return value; } -// writes to 8 bit calibration dacs +/* writes to 8 bit calibration dacs */ static void write_caldac(struct comedi_device * dev, unsigned int channel, unsigned int value) { @@ -1972,18 +1972,18 @@ static void write_caldac(struct comedi_device * dev, unsigned int channel, return; devpriv->caldac[channel] = value; - // clear caldac load bit and make sure we don't write to eeprom + /* clear caldac load bit and make sure we don't write to eeprom */ devpriv->command5_bits &= ~CALDAC_LOAD_BIT & ~EEPROM_EN_BIT & ~EEPROM_WRITE_UNPROTECT_BIT; comedi_udelay(1); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); - // write 4 bit channel + /* write 4 bit channel */ labpc_serial_out(dev, channel, 4); - // write 8 bit caldac value + /* write 8 bit caldac value */ labpc_serial_out(dev, value, 8); - // set and clear caldac bit to load caldac value + /* set and clear caldac bit to load caldac value */ devpriv->command5_bits |= CALDAC_LOAD_BIT; comedi_udelay(1); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); diff --git a/drivers/staging/comedi/drivers/ni_labpc.h b/drivers/staging/comedi/drivers/ni_labpc.h index b44b0d3d02f1..1171ec816b61 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.h +++ b/drivers/staging/comedi/drivers/ni_labpc.h @@ -24,55 +24,55 @@ #ifndef _NI_LABPC_H #define _NI_LABPC_H -#define EEPROM_SIZE 256 // 256 byte eeprom -#define NUM_AO_CHAN 2 // boards have two analog output channels +#define EEPROM_SIZE 256 /* 256 byte eeprom */ +#define NUM_AO_CHAN 2 /* boards have two analog output channels */ enum labpc_bustype { isa_bustype, pci_bustype, pcmcia_bustype }; enum labpc_register_layout { labpc_plus_layout, labpc_1200_layout }; enum transfer_type { fifo_not_empty_transfer, fifo_half_full_transfer, isa_dma_transfer }; -typedef struct labpc_board_struct { +struct labpc_board_struct { const char *name; - int device_id; // device id for pci and pcmcia boards - int ai_speed; // maximum input speed in nanoseconds - enum labpc_bustype bustype; // ISA/PCI/etc. - enum labpc_register_layout register_layout; // 1200 has extra registers compared to pc+ - int has_ao; // has analog output true/false + int device_id; /* device id for pci and pcmcia boards */ + int ai_speed; /* maximum input speed in nanoseconds */ + enum labpc_bustype bustype; /* ISA/PCI/etc. */ + enum labpc_register_layout register_layout; /* 1200 has extra registers compared to pc+ */ + int has_ao; /* has analog output true/false */ const struct comedi_lrange *ai_range_table; const int *ai_range_code; const int *ai_range_is_unipolar; - unsigned ai_scan_up:1; // board can auto scan up in ai channels, not just down + unsigned ai_scan_up:1; /* board can auto scan up in ai channels, not just down */ unsigned memory_mapped_io:1; /* uses memory mapped io instead of ioports */ -} labpc_board; +}; -typedef struct { - struct mite_struct *mite; // for mite chip on pci-1200 +struct labpc_private { + struct mite_struct *mite; /* for mite chip on pci-1200 */ volatile unsigned long long count; /* number of data points left to be taken */ - unsigned int ao_value[NUM_AO_CHAN]; // software copy of analog output values - // software copys of bits written to command registers + unsigned int ao_value[NUM_AO_CHAN]; /* software copy of analog output values */ + /* software copys of bits written to command registers */ volatile unsigned int command1_bits; volatile unsigned int command2_bits; volatile unsigned int command3_bits; volatile unsigned int command4_bits; volatile unsigned int command5_bits; volatile unsigned int command6_bits; - // store last read of board status registers + /* store last read of board status registers */ volatile unsigned int status1_bits; volatile unsigned int status2_bits; unsigned int divisor_a0; /* value to load into board's counter a0 (conversion pacing) for timed conversions */ unsigned int divisor_b0; /* value to load into board's counter b0 (master) for timed conversions */ unsigned int divisor_b1; /* value to load into board's counter b1 (scan pacing) for timed conversions */ - unsigned int dma_chan; // dma channel to use - u16 *dma_buffer; // buffer ai will dma into - unsigned int dma_transfer_size; // transfer size in bytes for current transfer - enum transfer_type current_transfer; // we are using dma/fifo-half-full/etc. - unsigned int eeprom_data[EEPROM_SIZE]; // stores contents of board's eeprom - unsigned int caldac[16]; // stores settings of calibration dacs - // function pointers so we can use inb/outb or readb/writeb as appropriate + unsigned int dma_chan; /* dma channel to use */ + u16 *dma_buffer; /* buffer ai will dma into */ + unsigned int dma_transfer_size; /* transfer size in bytes for current transfer */ + enum transfer_type current_transfer; /* we are using dma/fifo-half-full/etc. */ + unsigned int eeprom_data[EEPROM_SIZE]; /* stores contents of board's eeprom */ + unsigned int caldac[16]; /* stores settings of calibration dacs */ + /* function pointers so we can use inb/outb or readb/writeb as appropriate */ unsigned int (*read_byte) (unsigned long address); void (*write_byte) (unsigned int byte, unsigned long address); -} labpc_private; +}; int labpc_common_attach(struct comedi_device * dev, unsigned long iobase, unsigned int irq, unsigned int dma); diff --git a/drivers/staging/comedi/drivers/ni_labpc_cs.c b/drivers/staging/comedi/drivers/ni_labpc_cs.c index ac0ce2f58f5f..ac3352fed6d6 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_cs.c +++ b/drivers/staging/comedi/drivers/ni_labpc_cs.c @@ -60,7 +60,7 @@ NI manuals: */ #undef LABPC_DEBUG -//#define LABPC_DEBUG // enable debugging messages +/* #define LABPC_DEBUG */ /* enable debugging messages */ #include "../comedidev.h" @@ -81,10 +81,10 @@ static struct pcmcia_device *pcmcia_cur_dev = NULL; static int labpc_attach(struct comedi_device * dev, struct comedi_devconfig * it); -static const labpc_board labpc_cs_boards[] = { +static const struct labpc_board_struct labpc_cs_boards[] = { { name: "daqcard-1200", - device_id:0x103, // 0x10b is manufacturer id, 0x103 is device id + device_id:0x103, /* 0x10b is manufacturer id, 0x103 is device id */ ai_speed:10000, bustype: pcmcia_bustype, register_layout:labpc_1200_layout, @@ -114,16 +114,16 @@ static const labpc_board labpc_cs_boards[] = { /* * Useful for shorthand access to the particular board structure */ -#define thisboard ((const labpc_board *)dev->board_ptr) +#define thisboard ((const struct labpc_board_struct *)dev->board_ptr) static struct 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), + .num_names = sizeof(labpc_cs_boards) / sizeof(struct labpc_board_struct), .board_name = &labpc_cs_boards[0].name, - .offset = sizeof(labpc_board), + .offset = sizeof(struct labpc_board_struct), }; static int labpc_attach(struct comedi_device * dev, struct comedi_devconfig * it) @@ -133,10 +133,10 @@ static int labpc_attach(struct comedi_device * dev, struct comedi_devconfig * it struct pcmcia_device *link; /* allocate and initialize dev->private */ - if (alloc_private(dev, sizeof(labpc_private)) < 0) + if (alloc_private(dev, sizeof(struct labpc_private)) < 0) return -ENOMEM; - // get base address, irq etc. based on bustype + /* get base address, irq etc. based on bustype */ switch (thisboard->bustype) { case pcmcia_bustype: link = pcmcia_cur_dev; /* XXX hack */ @@ -213,12 +213,12 @@ static void labpc_cs_detach(struct pcmcia_device *); static const dev_info_t dev_info = "daqcard-1200"; -typedef struct local_info_t { +struct local_info_t { struct pcmcia_device *link; dev_node_t node; int stop; struct bus_operations *bus; -} local_info_t; +}; /*====================================================================== @@ -234,12 +234,12 @@ typedef struct local_info_t { static int labpc_cs_attach(struct pcmcia_device *link) { - local_info_t *local; + struct local_info_t *local; DEBUG(0, "labpc_cs_attach()\n"); /* Allocate space for private device-specific data */ - local = kzalloc(sizeof(local_info_t), GFP_KERNEL); + local = kzalloc(sizeof(struct local_info_t), GFP_KERNEL); if (!local) return -ENOMEM; local->link = link; @@ -287,7 +287,7 @@ static void labpc_cs_detach(struct pcmcia_device *link) detach(). */ if (link->dev_node) { - ((local_info_t *) link->priv)->stop = 1; + ((struct local_info_t *) link->priv)->stop = 1; labpc_release(link); } @@ -307,7 +307,7 @@ static void labpc_cs_detach(struct pcmcia_device *link) static void labpc_config(struct pcmcia_device *link) { - local_info_t *dev = link->priv; + struct local_info_t *dev = link->priv; tuple_t tuple; cisparse_t parse; int last_ret; @@ -501,7 +501,7 @@ static void labpc_release(struct pcmcia_device *link) static int labpc_cs_suspend(struct pcmcia_device *link) { - local_info_t *local = link->priv; + struct local_info_t *local = link->priv; /* Mark the device as stopped, to block IO until later */ local->stop = 1; @@ -510,7 +510,7 @@ static int labpc_cs_suspend(struct pcmcia_device *link) static int labpc_cs_resume(struct pcmcia_device *link) { - local_info_t *local = link->priv; + struct local_info_t *local = link->priv; local->stop = 0; return 0; diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 542bd0dcd44d..dfc2f86c5a25 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -57,9 +57,9 @@ fully tested as yet. Terry Barnaby, BEAM Ltd. */ -//#define DEBUG_INTERRUPT -//#define DEBUG_STATUS_A -//#define DEBUG_STATUS_B +/* #define DEBUG_INTERRUPT */ +/* #define DEBUG_STATUS_A */ +/* #define DEBUG_STATUS_B */ #include "8255.h" #include "mite.h" @@ -410,7 +410,7 @@ static int ni_ai_drain_dma(struct comedi_device * dev); /* DMA channel setup */ -// negative channel means no channel +/* negative channel means no channel */ static inline void ni_set_ai_dma_channel(struct comedi_device * dev, int channel) { unsigned bitfield; @@ -425,7 +425,7 @@ static inline void ni_set_ai_dma_channel(struct comedi_device * dev, int channel ni_set_bitfield(dev, AI_AO_Select, AI_DMA_Select_Mask, bitfield); } -// negative channel means no channel +/* negative channel means no channel */ static inline void ni_set_ao_dma_channel(struct comedi_device * dev, int channel) { unsigned bitfield; @@ -440,7 +440,7 @@ static inline void ni_set_ao_dma_channel(struct comedi_device * dev, int channel ni_set_bitfield(dev, AI_AO_Select, AO_DMA_Select_Mask, bitfield); } -// negative mite_channel means no channel +/* negative mite_channel means no channel */ static inline void ni_set_gpct_dma_channel(struct comedi_device * dev, unsigned gpct_index, int mite_channel) { @@ -455,7 +455,7 @@ static inline void ni_set_gpct_dma_channel(struct comedi_device * dev, bitfield); } -// negative mite_channel means no channel +/* negative mite_channel means no channel */ static inline void ni_set_cdo_dma_channel(struct comedi_device * dev, int mite_channel) { unsigned long flags; @@ -544,7 +544,7 @@ static int ni_request_gpct_mite_channel(struct comedi_device * dev, return 0; } -#endif // PCIDMA +#endif /* PCIDMA */ static int ni_request_cdo_mite_channel(struct comedi_device * dev) { @@ -565,7 +565,7 @@ static int ni_request_cdo_mite_channel(struct comedi_device * dev) devpriv->cdo_mite_chan->dir = COMEDI_OUTPUT; ni_set_cdo_dma_channel(dev, devpriv->cdo_mite_chan->channel); comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); -#endif // PCIDMA +#endif /* PCIDMA */ return 0; } @@ -581,7 +581,7 @@ static void ni_release_ai_mite_channel(struct comedi_device * dev) devpriv->ai_mite_chan = NULL; } comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); -#endif // PCIDMA +#endif /* PCIDMA */ } static void ni_release_ao_mite_channel(struct comedi_device * dev) @@ -596,7 +596,7 @@ static void ni_release_ao_mite_channel(struct comedi_device * dev) devpriv->ao_mite_chan = NULL; } comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); -#endif // PCIDMA +#endif /* PCIDMA */ } void ni_release_gpct_mite_channel(struct comedi_device * dev, unsigned gpct_index) @@ -616,7 +616,7 @@ void ni_release_gpct_mite_channel(struct comedi_device * dev, unsigned gpct_inde mite_release_channel(mite_chan); } comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); -#endif // PCIDMA +#endif /* PCIDMA */ } static void ni_release_cdo_mite_channel(struct comedi_device * dev) @@ -631,10 +631,10 @@ static void ni_release_cdo_mite_channel(struct comedi_device * dev) devpriv->cdo_mite_chan = NULL; } comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); -#endif // PCIDMA +#endif /* PCIDMA */ } -// e-series boards use the second irq signals to generate dma requests for their counters +/* e-series boards use the second irq signals to generate dma requests for their counters */ #ifdef PCIDMA static void ni_e_series_enable_second_irq(struct comedi_device * dev, unsigned gpct_index, short enable) @@ -665,15 +665,15 @@ static void ni_e_series_enable_second_irq(struct comedi_device * dev, break; } } -#endif // PCIDMA +#endif /* PCIDMA */ static void ni_clear_ai_fifo(struct comedi_device * dev) { if (boardtype.reg_type == ni_reg_6143) { - // Flush the 6143 data FIFO - ni_writel(0x10, AIFIFO_Control_6143); // Flush fifo - ni_writel(0x00, AIFIFO_Control_6143); // Flush fifo - while (ni_readl(AIFIFO_Status_6143) & 0x10) ; // Wait for complete + /* Flush the 6143 data FIFO */ + ni_writel(0x10, AIFIFO_Control_6143); /* Flush fifo */ + ni_writel(0x00, AIFIFO_Control_6143); /* Flush fifo */ + while (ni_readl(AIFIFO_Status_6143) & 0x10) ; /* Wait for complete */ } else { devpriv->stc_writew(dev, 1, ADC_FIFO_Clear); if (boardtype.reg_type == ni_reg_625x) { @@ -762,7 +762,7 @@ static inline void ni_set_bits(struct comedi_device * dev, int reg, unsigned bit ni_set_bitfield(dev, reg, bits, bit_values); } -static irqreturn_t ni_E_interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t ni_E_interrupt(int irq, void *d) { struct comedi_device *dev = d; unsigned short a_status; @@ -776,9 +776,9 @@ static irqreturn_t ni_E_interrupt(int irq, void *d PT_REGS_ARG) if (dev->attached == 0) return IRQ_NONE; - smp_mb(); // make sure dev->attached is checked before handler does anything else. + smp_mb(); /* make sure dev->attached is checked before handler does anything else. */ - // lock to avoid race with comedi_poll + /* lock to avoid race with comedi_poll */ comedi_spin_lock_irqsave(&dev->spinlock, flags); a_status = devpriv->stc_readw(dev, AI_Status_1_Register); b_status = devpriv->stc_readw(dev, AO_Status_1_Register); @@ -867,7 +867,7 @@ static int ni_ao_wait_for_dma_load(struct comedi_device * dev) return 0; } -#endif //PCIDMA +#endif /* PCIDMA */ static void ni_handle_eos(struct comedi_device * dev, struct comedi_subdevice * s) { if (devpriv->aimode == AIMODE_SCAN) { @@ -971,7 +971,7 @@ static void handle_a_interrupt(struct comedi_device * dev, unsigned short status { struct comedi_subdevice *s = dev->subdevices + NI_AI_SUBDEV; - //67xx boards don't have ai subdevice, but their gpct0 might generate an a interrupt + /* 67xx boards don't have ai subdevice, but their gpct0 might generate an a interrupt */ if (s->type == COMEDI_SUBD_UNUSED) return; @@ -992,9 +992,9 @@ static void handle_a_interrupt(struct comedi_device * dev, unsigned short status rt_printk ("unknown mite interrupt, ack! (ai_mite_status=%08x)\n", ai_mite_status); - //mite_print_chsr(ai_mite_status); + /* mite_print_chsr(ai_mite_status); */ s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; - //disable_irq(dev->irq); + /* disable_irq(dev->irq); */ } #endif @@ -1052,7 +1052,7 @@ static void handle_a_interrupt(struct comedi_device * dev, unsigned short status break; } } -#endif // !PCIDMA +#endif /* !PCIDMA */ if ((status & AI_STOP_St)) { ni_handle_eos(dev, s); @@ -1102,7 +1102,7 @@ static void handle_b_interrupt(struct comedi_device * dev, unsigned short b_stat unsigned ao_mite_status) { struct comedi_subdevice *s = dev->subdevices + NI_AO_SUBDEV; - //unsigned short ack=0; + /* unsigned short ack=0; */ #ifdef DEBUG_INTERRUPT rt_printk("ni_mio_common: interrupt: b_status=%04x m1_status=%08x\n", b_status, ao_mite_status); @@ -1121,7 +1121,7 @@ static void handle_b_interrupt(struct comedi_device * dev, unsigned short b_stat rt_printk ("unknown mite interrupt, ack! (ao_mite_status=%08x)\n", ao_mite_status); - //mite_print_chsr(ao_mite_status); + /* mite_print_chsr(ao_mite_status); */ s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; } #endif @@ -1333,7 +1333,7 @@ static void ni_ai_fifo_read(struct comedi_device * dev, struct comedi_subdevice short data[2]; u32 dl; - // This just reads the FIFO assuming the data is present, no checks on the FIFO status are performed + /* This just reads the FIFO assuming the data is present, no checks on the FIFO status are performed */ for (i = 0; i < n / 2; i++) { dl = ni_readl(AIFIFO_Data_6143); @@ -1343,7 +1343,7 @@ static void ni_ai_fifo_read(struct comedi_device * dev, struct comedi_subdevice } if (n % 2) { /* Assume there is a single sample stuck in the FIFO */ - ni_writel(0x01, AIFIFO_Control_6143); // Get stranded sample into FIFO + ni_writel(0x01, AIFIFO_Control_6143); /* Get stranded sample into FIFO */ dl = ni_readl(AIFIFO_Data_6143); data[0] = (dl >> 16) & 0xffff; cfc_write_to_buffer(s, data[0]); @@ -1444,9 +1444,9 @@ static void ni_handle_fifo_dregs(struct comedi_device * dev) cfc_write_array_to_buffer(s, data, sizeof(data)); i += 2; } - // Check if stranded sample is present + /* Check if stranded sample is present */ if (ni_readl(AIFIFO_Status_6143) & 0x01) { - ni_writel(0x01, AIFIFO_Control_6143); // Get stranded sample into FIFO + ni_writel(0x01, AIFIFO_Control_6143); /* Get stranded sample into FIFO */ dl = ni_readl(AIFIFO_Data_6143); data[0] = (dl >> 16) & 0xffff; cfc_write_to_buffer(s, data[0]); @@ -1504,7 +1504,7 @@ static void get_last_sample_6143(struct comedi_device * dev) /* Check if there's a single sample stuck in the FIFO */ if (ni_readl(AIFIFO_Status_6143) & 0x01) { - ni_writel(0x01, AIFIFO_Control_6143); // Get stranded sample into FIFO + ni_writel(0x01, AIFIFO_Control_6143); /* Get stranded sample into FIFO */ dl = ni_readl(AIFIFO_Data_6143); /* This may get the hi/lo data in the wrong order */ @@ -1548,7 +1548,7 @@ static int ni_ai_setup_MITE_dma(struct comedi_device * dev) retval = ni_request_ai_mite_channel(dev); if (retval) return retval; -// rt_printk("comedi_debug: using mite channel %i for ai.\n", devpriv->ai_mite_chan->channel); +/* rt_printk("comedi_debug: using mite channel %i for ai.\n", devpriv->ai_mite_chan->channel); */ /* write alloc the entire buffer */ comedi_buf_write_alloc(s->async, s->async->prealloc_bufsz); @@ -1609,7 +1609,7 @@ static int ni_ao_setup_MITE_dma(struct comedi_device * dev) return retval; } -#endif // PCIDMA +#endif /* PCIDMA */ /* used for both cancel ioctl and board initialization @@ -1703,7 +1703,7 @@ static int ni_ai_poll(struct comedi_device * dev, struct comedi_subdevice * s) unsigned long flags = 0; int count; - // lock to avoid race with interrupt handler + /* lock to avoid race with interrupt handler */ if (in_interrupt() == 0) comedi_spin_lock_irqsave(&dev->spinlock, flags); #ifndef PCIDMA @@ -1774,7 +1774,7 @@ static int ni_ai_insn_read(struct comedi_device * dev, struct comedi_subdevice * dl = 0; for (i = 0; i < NI_TIMEOUT; i++) { if (ni_readl(AIFIFO_Status_6143) & 0x01) { - ni_writel(0x01, AIFIFO_Control_6143); // Get stranded sample into FIFO + ni_writel(0x01, AIFIFO_Control_6143); /* Get stranded sample into FIFO */ dl = ni_readl(AIFIFO_Data_6143); break; } @@ -1841,7 +1841,7 @@ static void ni_m_series_load_channelgain_list(struct comedi_device * dev, devpriv->stc_writew(dev, 1, Configuration_Memory_Clear); -// offset = 1 << (boardtype.adbits - 1); +/* offset = 1 << (boardtype.adbits - 1); */ if ((list[0] & CR_ALT_SOURCE)) { unsigned bypass_bits; chan = CR_CHAN(list[0]); @@ -1859,7 +1859,7 @@ static void ni_m_series_load_channelgain_list(struct comedi_device * dev, bypass_bits |= MSeries_AI_Bypass_Gain_Bits(range_code); if (dither) bypass_bits |= MSeries_AI_Bypass_Dither_Bit; - // don't use 2's complement encoding + /* don't use 2's complement encoding */ bypass_bits |= MSeries_AI_Bypass_Polarity_Bit; ni_writel(bypass_bits, M_Offset_AI_Config_FIFO_Bypass); } else { @@ -1899,7 +1899,7 @@ static void ni_m_series_load_channelgain_list(struct comedi_device * dev, config_bits |= MSeries_AI_Config_Last_Channel_Bit; if (dither) config_bits |= MSeries_AI_Config_Dither_Bit; - // don't use 2's complement encoding + /* don't use 2's complement encoding */ config_bits |= MSeries_AI_Config_Polarity_Bit; ni_writew(config_bits, M_Offset_AI_Config_FIFO_Data); } @@ -1952,7 +1952,7 @@ static void ni_load_channelgain_list(struct comedi_device * dev, unsigned int n_ && (boardtype.reg_type != ni_reg_6143)) { if (devpriv->changain_state && devpriv->changain_spec == list[0]) { - // ready to go. + /* ready to go. */ return; } devpriv->changain_state = 1; @@ -1963,11 +1963,11 @@ static void ni_load_channelgain_list(struct comedi_device * dev, unsigned int n_ devpriv->stc_writew(dev, 1, Configuration_Memory_Clear); - // Set up Calibration mode if required + /* Set up Calibration mode if required */ if (boardtype.reg_type == ni_reg_6143) { if ((list[0] & CR_ALT_SOURCE) && !devpriv->ai_calib_source_enabled) { - // Strobe Relay enable bit + /* Strobe Relay enable bit */ ni_writew(devpriv-> ai_calib_source | Calibration_Channel_6143_RelayOn, @@ -1975,10 +1975,10 @@ static void ni_load_channelgain_list(struct comedi_device * dev, unsigned int n_ ni_writew(devpriv->ai_calib_source, Calibration_Channel_6143); devpriv->ai_calib_source_enabled = 1; - msleep_interruptible(100); // Allow relays to change + msleep_interruptible(100); /* Allow relays to change */ } else if (!(list[0] & CR_ALT_SOURCE) && devpriv->ai_calib_source_enabled) { - // Strobe Relay disable bit + /* Strobe Relay disable bit */ ni_writew(devpriv-> ai_calib_source | Calibration_Channel_6143_RelayOff, @@ -1986,7 +1986,7 @@ static void ni_load_channelgain_list(struct comedi_device * dev, unsigned int n_ ni_writew(devpriv->ai_calib_source, Calibration_Channel_6143); devpriv->ai_calib_source_enabled = 0; - msleep_interruptible(100); // Allow relays to change + msleep_interruptible(100); /* Allow relays to change */ } } @@ -2085,11 +2085,11 @@ static unsigned ni_min_ai_scan_period_ns(struct comedi_device * dev, switch (boardtype.reg_type) { case ni_reg_611x: case ni_reg_6143: - // simultaneously-sampled inputs + /* simultaneously-sampled inputs */ return boardtype.ai_speed; break; default: - // multiplexed inputs + /* multiplexed inputs */ break; }; return boardtype.ai_speed * num_channels; @@ -2367,10 +2367,10 @@ static int ni_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) if (cmd->chanlist_len == 1 || (boardtype.reg_type == ni_reg_611x) || (boardtype.reg_type == ni_reg_6143)) { start_stop_select |= AI_STOP_Polarity; - start_stop_select |= AI_STOP_Select(31); // logic low + start_stop_select |= AI_STOP_Select(31); /* logic low */ start_stop_select |= AI_STOP_Sync; } else { - start_stop_select |= AI_STOP_Select(19); // ai configuration memory + start_stop_select |= AI_STOP_Select(19); /* ai configuration memory */ } devpriv->stc_writew(dev, start_stop_select, AI_START_STOP_Select_Register); @@ -2381,7 +2381,7 @@ static int ni_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) stop_count = cmd->stop_arg - 1; if (boardtype.reg_type == ni_reg_611x) { - // have to take 3 stage adc pipeline into account + /* have to take 3 stage adc pipeline into account */ stop_count += num_adc_stages_611x; } /* stage number of scans */ @@ -2396,7 +2396,7 @@ static int ni_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) if (stop_count == 0) { devpriv->ai_cmd2 |= AI_End_On_End_Of_Scan; interrupt_a_enable |= AI_STOP_Interrupt_Enable; - // this is required to get the last sample for chanlist_len > 1, not sure why + /* this is required to get the last sample for chanlist_len > 1, not sure why */ if (cmd->chanlist_len > 1) start_stop_select |= AI_STOP_Polarity | AI_STOP_Edge; @@ -2440,7 +2440,7 @@ static int ni_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) mode2 |= AI_SI_Reload_Mode(0); /* AI_SI_Initial_Load_Source=A */ mode2 &= ~AI_SI_Initial_Load_Source; - //mode2 |= AI_SC_Reload_Mode; + /* mode2 |= AI_SC_Reload_Mode; */ devpriv->stc_writew(dev, mode2, AI_Mode_2_Register); /* load SI */ @@ -2486,8 +2486,8 @@ static int ni_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) /* AI_SI2_Load */ devpriv->stc_writew(dev, AI_SI2_Load, AI_Command_1_Register); - mode2 |= AI_SI2_Reload_Mode; // alternate - mode2 |= AI_SI2_Initial_Load_Source; // B + mode2 |= AI_SI2_Reload_Mode; /* alternate */ + mode2 |= AI_SI2_Initial_Load_Source; /* B */ devpriv->stc_writew(dev, mode2, AI_Mode_2_Register); break; @@ -2589,7 +2589,7 @@ static int ni_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) if (retval) return retval; } - //mite_dump_regs(devpriv->mite); + /* mite_dump_regs(devpriv->mite); */ #endif switch (cmd->start_src) { @@ -3044,7 +3044,7 @@ static int ni_ao_inttrig(struct comedi_device * dev, struct comedi_subdevice * s "timed out waiting for AO_TMRDACWRs_In_Progress_St to clear"); return -EIO; } - // stc manual says we are need to clear error interrupt after AO_TMRDACWRs_In_Progress_St clears + /* stc manual says we are need to clear error interrupt after AO_TMRDACWRs_In_Progress_St clears */ devpriv->stc_writew(dev, AO_Error_Interrupt_Ack, Interrupt_B_Ack_Register); @@ -3114,9 +3114,9 @@ static int ni_ao_cmd(struct comedi_device * dev, struct comedi_subdevice * s) case TRIG_EXT: devpriv->ao_trigger_select = AO_START1_Select(CR_CHAN(cmd->start_arg)+1); if (cmd->start_arg & CR_INVERT) - devpriv->ao_trigger_select |= AO_START1_Polarity; // 0=active high, 1=active low. see daq-stc 3-24 (p186) + devpriv->ao_trigger_select |= AO_START1_Polarity; /* 0=active high, 1=active low. see daq-stc 3-24 (p186) */ if (cmd->start_arg & CR_EDGE) - devpriv->ao_trigger_select |= AO_START1_Edge; // 0=edge detection disabled, 1=enabled + devpriv->ao_trigger_select |= AO_START1_Edge; /* 0=edge detection disabled, 1=enabled */ devpriv->stc_writew(dev, devpriv->ao_trigger_select, AO_Trigger_Select_Register); break; default: @@ -3141,7 +3141,7 @@ static int ni_ao_cmd(struct comedi_device * dev, struct comedi_subdevice * s) case TRIG_COUNT: if(boardtype.reg_type & ni_reg_m_series_mask) { - // this is how the NI example code does it for m-series boards, verified correct with 6259 + /* this is how the NI example code does it for m-series boards, verified correct with 6259 */ devpriv->stc_writel(dev, cmd->stop_arg - 1, AO_UC_Load_A_Register); devpriv->stc_writew(dev, AO_UC_Load, AO_Command_1_Register); }else @@ -3244,7 +3244,7 @@ static int ni_ao_cmd(struct comedi_device * dev, struct comedi_subdevice * s) bits |= AO_Number_Of_DAC_Packages; #endif devpriv->stc_writew(dev, bits, AO_Personal_Register); - // enable sending of ao dma requests + /* enable sending of ao dma requests */ devpriv->stc_writew(dev, AO_AOFREQ_Enable, AO_Start_Select_Register); devpriv->stc_writew(dev, AO_Configuration_End, Joint_Reset_Register); @@ -3386,11 +3386,11 @@ static int ni_ao_cmdtest(struct comedi_device * dev, struct comedi_subdevice * s static int ni_ao_reset(struct comedi_device * dev, struct comedi_subdevice * s) { - //devpriv->ao0p=0x0000; - //ni_writew(devpriv->ao0p,AO_Configuration); + /* devpriv->ao0p=0x0000; */ + /* ni_writew(devpriv->ao0p,AO_Configuration); */ - //devpriv->ao1p=AO_Channel(1); - //ni_writew(devpriv->ao1p,AO_Configuration); + /* devpriv->ao1p=AO_Channel(1); */ + /* ni_writew(devpriv->ao1p,AO_Configuration); */ ni_release_ao_mite_channel(dev); @@ -3434,7 +3434,7 @@ static int ni_ao_reset(struct comedi_device * dev, struct comedi_subdevice * s) return 0; } -// digital io +/* digital io */ static int ni_dio_insn_config(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) @@ -3718,9 +3718,11 @@ static int ni_cdo_inttrig(struct comedi_device * dev, struct comedi_subdevice * if (retval < 0) return retval; #endif -// XXX not sure what interrupt C group does -// ni_writeb(Interrupt_Group_C_Enable_Bit, M_Offset_Interrupt_C_Enable); - //wait for dma to fill output fifo +/* +* XXX not sure what interrupt C group does +* ni_writeb(Interrupt_Group_C_Enable_Bit, +* M_Offset_Interrupt_C_Enable); wait for dma to fill output fifo +*/ for (i = 0; i < timeout; ++i) { if (ni_readl(M_Offset_CDIO_Status) & CDO_FIFO_Full_Bit) break; @@ -3742,8 +3744,10 @@ static int ni_cdio_cancel(struct comedi_device * dev, struct comedi_subdevice * CDO_Empty_FIFO_Interrupt_Enable_Clear_Bit | CDO_FIFO_Request_Interrupt_Enable_Clear_Bit, M_Offset_CDIO_Command); -// XXX not sure what interrupt C group does -// ni_writeb(0, M_Offset_Interrupt_C_Enable); +/* +* XXX not sure what interrupt C group does ni_writeb(0, +* M_Offset_Interrupt_C_Enable); +*/ ni_writel(0, M_Offset_CDO_Mask_Enable); ni_release_cdo_mite_channel(dev); return 0; @@ -3777,15 +3781,15 @@ static void handle_cdio_interrupt(struct comedi_device * dev) cdio_status = ni_readl(M_Offset_CDIO_Status); if (cdio_status & (CDO_Overrun_Bit | CDO_Underflow_Bit)) { -// rt_printk("cdio error: statux=0x%x\n", cdio_status); - ni_writel(CDO_Error_Interrupt_Confirm_Bit, M_Offset_CDIO_Command); // XXX just guessing this is needed and does something useful +/* rt_printk("cdio error: statux=0x%x\n", cdio_status); */ + ni_writel(CDO_Error_Interrupt_Confirm_Bit, M_Offset_CDIO_Command); /* XXX just guessing this is needed and does something useful */ s->async->events |= COMEDI_CB_OVERFLOW; } if (cdio_status & CDO_FIFO_Empty_Bit) { -// rt_printk("cdio fifo empty\n"); +/* rt_printk("cdio fifo empty\n"); */ ni_writel(CDO_Empty_FIFO_Interrupt_Enable_Clear_Bit, M_Offset_CDIO_Command); -// s->async->events |= COMEDI_CB_EOA; +/* s->async->events |= COMEDI_CB_EOA; */ } ni_event(dev, s); } @@ -4278,7 +4282,7 @@ static int ni_alloc_private(struct comedi_device * dev) { int ret; - ret = alloc_private(dev, sizeof(ni_private)); + ret = alloc_private(dev, sizeof(struct ni_private)); if (ret < 0) return ret; @@ -4419,14 +4423,14 @@ static int ni_E_init(struct comedi_device * dev, struct comedi_devconfig * it) s = dev->subdevices + NI_CALIBRATION_SUBDEV; s->type = COMEDI_SUBD_CALIB; if (boardtype.reg_type & ni_reg_m_series_mask) { - // internal PWM analog output used for AI nonlinearity calibration + /* internal PWM analog output used for AI nonlinearity calibration */ s->subdev_flags = SDF_INTERNAL; s->insn_config = &ni_m_series_pwm_config; s->n_chan = 1; s->maxdata = 0; ni_writel(0x0, M_Offset_Cal_PWM); } else if (boardtype.reg_type == ni_reg_6143) { - // internal PWM analog output used for AI nonlinearity calibration + /* internal PWM analog output used for AI nonlinearity calibration */ s->subdev_flags = SDF_INTERNAL; s->insn_config = &ni_6143_pwm_config; s->n_chan = 1; @@ -4478,7 +4482,7 @@ static int ni_E_init(struct comedi_device * dev, struct comedi_devconfig * it) if (boardtype.reg_type & ni_reg_67xx_mask) { s->type = COMEDI_SUBD_AI; s->subdev_flags = SDF_READABLE | SDF_DIFF | SDF_INTERNAL; - // one channel for each analog output channel + /* one channel for each analog output channel */ s->n_chan = boardtype.n_aochan; s->maxdata = (1 << 16) - 1; s->range_table = &range_unknown; /* XXX */ @@ -4557,7 +4561,7 @@ static int ni_E_init(struct comedi_device * dev, struct comedi_devconfig * it) /* ai configuration */ ni_ai_reset(dev, dev->subdevices + NI_AI_SUBDEV); if ((boardtype.reg_type & ni_reg_6xxx_mask) == 0) { - // BEAM is this needed for PCI-6143 ?? + /* BEAM is this needed for PCI-6143 ?? */ devpriv->clock_and_fout = Slow_Internal_Time_Divide_By_2 | Slow_Internal_Timebase | @@ -4904,7 +4908,7 @@ static void ni_write_caldac(struct comedi_device * dev, int addr, int val) int i; int type; - //printk("ni_write_caldac: chan=%d val=%d\n",addr,val); + /* printk("ni_write_caldac: chan=%d val=%d\n",addr,val); */ if (devpriv->caldacs[addr] == val) return; devpriv->caldacs[addr] = val; @@ -4916,7 +4920,7 @@ static void ni_write_caldac(struct comedi_device * dev, int addr, int val) if (addr < caldacs[type].n_chans) { bits = caldacs[type].packbits(addr, val, &bitstring); loadbit = SerDacLd(i); - //printk("caldac: using i=%d addr=%d %x\n",i,addr,bitstring); + /* printk("caldac: using i=%d addr=%d %x\n",i,addr,bitstring); */ break; } addr -= caldacs[type].n_chans; @@ -5012,7 +5016,7 @@ static void GPCT_Reset(struct comedi_device * dev, int chan) { int temp_ack_reg = 0; - //printk("GPCT_Reset..."); + /* printk("GPCT_Reset..."); */ devpriv->gpct_cur_operation[chan] = GPCT_RESET; switch (chan) { @@ -5029,7 +5033,7 @@ static void GPCT_Reset(struct comedi_device * dev, int chan) devpriv->stc_writew(dev, temp_ack_reg, Interrupt_A_Ack_Register); - //problem...this interferes with the other ctr... + /* problem...this interferes with the other ctr... */ devpriv->an_trig_etc_reg |= GPFO_0_Output_Enable; devpriv->stc_writew(dev, devpriv->an_trig_etc_reg, Analog_Trigger_Etc_Register); @@ -5065,7 +5069,7 @@ static void GPCT_Reset(struct comedi_device * dev, int chan) G_Input_Select_Register(chan)); devpriv->stc_writew(dev, 0, G_Autoincrement_Register(chan)); - //printk("exit GPCT_Reset\n"); + /* printk("exit GPCT_Reset\n"); */ } #endif @@ -5096,7 +5100,7 @@ static int ni_gpct_cmd(struct comedi_device * dev, struct comedi_subdevice * s) int retval; #ifdef PCIDMA struct ni_gpct *counter = s->private; -// const struct comedi_cmd *cmd = &s->async->cmd; +/* const struct comedi_cmd *cmd = &s->async->cmd; */ retval = ni_request_gpct_mite_channel(dev, counter->counter_index, COMEDI_INPUT); @@ -5168,7 +5172,7 @@ static int ni_m_series_set_pfi_routing(struct comedi_device * dev, unsigned chan static int ni_old_set_pfi_routing(struct comedi_device * dev, unsigned chan, unsigned source) { - // pre-m-series boards have fixed signals on pfi pins + /* pre-m-series boards have fixed signals on pfi pins */ if (source != ni_old_get_pfi_routing(dev, chan)) return -EINVAL; return 2; @@ -5192,7 +5196,7 @@ static unsigned ni_m_series_get_pfi_routing(struct comedi_device * dev, unsigned static unsigned ni_old_get_pfi_routing(struct comedi_device * dev, unsigned chan) { - // pre-m-series boards have fixed signals on pfi pins + /* pre-m-series boards have fixed signals on pfi pins */ switch (chan) { case 0: return NI_PFI_OUTPUT_AI_START1; @@ -5314,14 +5318,14 @@ static int ni_pfi_insn_config(struct comedi_device * dev, struct comedi_subdevic */ static void ni_rtsi_init(struct comedi_device * dev) { - // Initialises the RTSI bus signal switch to a default state + /* Initialises the RTSI bus signal switch to a default state */ - // Set clock mode to internal + /* Set clock mode to internal */ devpriv->clock_and_fout2 = MSeries_RTSI_10MHz_Bit; if (ni_set_master_clock(dev, NI_MIO_INTERNAL_CLOCK, 0) < 0) { rt_printk("ni_set_master_clock failed, bug?"); } - // default internal lines routing to RTSI bus lines + /* default internal lines routing to RTSI bus lines */ devpriv->rtsi_trig_a_output_reg = RTSI_Trig_Output_Bits(0, NI_RTSI_OUTPUT_ADR_START1) | RTSI_Trig_Output_Bits(1, @@ -5341,8 +5345,10 @@ static void ni_rtsi_init(struct comedi_device * dev) devpriv->stc_writew(dev, devpriv->rtsi_trig_b_output_reg, RTSI_Trig_B_Output_Register); - // Sets the source and direction of the 4 on board lines -// devpriv->stc_writew(dev, 0x0000, RTSI_Board_Register); +/* +* Sets the source and direction of the 4 on board lines +* devpriv->stc_writew(dev, 0x0000, RTSI_Board_Register); +*/ } static int ni_rtsi_insn_bits(struct comedi_device * dev, struct comedi_subdevice * s, @@ -5422,7 +5428,7 @@ static int ni_mseries_set_pll_master_clock(struct comedi_device * dev, unsigned int retval; if (source == NI_MIO_PLL_PXI10_CLOCK) period_ns = 100; - // these limits are somewhat arbitrary, but NI advertises 1 to 20MHz range so we'll use that + /* these limits are somewhat arbitrary, but NI advertises 1 to 20MHz range so we'll use that */ if (period_ns < min_period_ns || period_ns > max_period_ns) { rt_printk ("%s: you must specify an input clock frequency between %i and %i nanosec " @@ -5484,8 +5490,10 @@ static int ni_mseries_set_pll_master_clock(struct comedi_device * dev, unsigned pll_control_bits |= MSeries_PLL_Divisor_Bits(freq_divider) | MSeries_PLL_Multiplier_Bits(freq_multiplier); -// rt_printk("using divider=%i, multiplier=%i for PLL. pll_control_bits = 0x%x\n", freq_divider, freq_multiplier, pll_control_bits); -// rt_printk("clock_ns=%d\n", devpriv->clock_ns); + + /* rt_printk("using divider=%i, multiplier=%i for PLL. pll_control_bits = 0x%x\n", + * freq_divider, freq_multiplier, pll_control_bits); */ + /* rt_printk("clock_ns=%d\n", devpriv->clock_ns); */ ni_writew(pll_control_bits, M_Offset_PLL_Control); devpriv->clock_source = source; /* it seems to typically take a few hundred microseconds for PLL to lock */ @@ -5714,7 +5722,7 @@ static int cs5529_wait_for_idle(struct comedi_device * dev) return -EIO; } } -//printk("looped %i times waiting for idle\n", i); +/* printk("looped %i times waiting for idle\n", i); */ if (i == timeout) { rt_printk("%s: %s: timeout\n", __FILE__, __FUNCTION__); return -ETIME; @@ -5737,7 +5745,7 @@ static void cs5529_command(struct comedi_device * dev, unsigned short value) break; comedi_udelay(1); } -//printk("looped %i times writing command to cs5529\n", i); +/* printk("looped %i times writing command to cs5529\n", i); */ if (i == timeout) { comedi_error(dev, "possible problem - never saw adc go busy?"); } diff --git a/drivers/staging/comedi/drivers/ni_mio_cs.c b/drivers/staging/comedi/drivers/ni_mio_cs.c index d6357c25aca5..eef01984ab2a 100644 --- a/drivers/staging/comedi/drivers/ni_mio_cs.c +++ b/drivers/staging/comedi/drivers/ni_mio_cs.c @@ -66,7 +66,7 @@ See the notes in the ni_atmio.o driver. #define MAX_N_CALDACS 32 -static const ni_board ni_boards[] = { +static const struct ni_board_struct ni_boards[] = { {device_id:0x010d, name: "DAQCard-ai-16xe-50", n_adchan:16, @@ -344,7 +344,7 @@ static void mio_cs_config(struct pcmcia_device *link) manfid = le16_to_cpu(buf[0]); prodid = le16_to_cpu(buf[1]); } - //printk("manfid = 0x%04x, 0x%04x\n",manfid,prodid); + /* printk("manfid = 0x%04x, 0x%04x\n",manfid,prodid); */ tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.Attributes = 0; @@ -381,7 +381,7 @@ static void mio_cs_config(struct pcmcia_device *link) for (base = 0x000; base < 0x400; base += 0x20) { link->io.BasePort1 = base; ret = pcmcia_request_io(link, &link->io); - //printk("RequestIO 0x%02x\n",ret); + /* printk("RequestIO 0x%02x\n",ret); */ if (!ret) break; } @@ -393,12 +393,12 @@ static void mio_cs_config(struct pcmcia_device *link) if (ret) { printk("pcmcia_request_irq() returned error: %i\n", ret); } - //printk("RequestIRQ 0x%02x\n",ret); + /* printk("RequestIRQ 0x%02x\n",ret); */ link->conf.ConfigIndex = 1; ret = pcmcia_request_configuration(link, &link->conf); - //printk("RequestConfiguration %d\n",ret); + /* printk("RequestConfiguration %d\n",ret); */ link->dev_node = &dev_node; } diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c index 87def2cc9a29..55c7ad439180 100644 --- a/drivers/staging/comedi/drivers/ni_pcidio.c +++ b/drivers/staging/comedi/drivers/ni_pcidio.c @@ -479,7 +479,7 @@ void ni_pcidio_event(struct comedi_device * dev, struct comedi_subdevice * s) comedi_event(dev, s); } -static irqreturn_t nidio_interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t nidio_interrupt(int irq, void *d) { struct comedi_device *dev = d; struct comedi_subdevice *s = dev->subdevices; diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c b/drivers/staging/comedi/drivers/ni_pcimio.c index 3a2aba7c8dd3..a09622b60238 100644 --- a/drivers/staging/comedi/drivers/ni_pcimio.c +++ b/drivers/staging/comedi/drivers/ni_pcimio.c @@ -117,7 +117,7 @@ Bugs: #include "ni_stc.h" #include "mite.h" -//#define PCI_DEBUG +/* #define PCI_DEBUG */ #define PCIDMA @@ -216,9 +216,9 @@ static const struct comedi_lrange range_ni_M_622x_ao = { 1, { } }; -static const ni_board ni_boards[] = { +static const struct ni_board_struct ni_boards[] = { { - .device_id = 0x0162, // NI also says 0x1620. typo? + .device_id = 0x0162, /* NI also says 0x1620. typo? */ .name = "pci-mio-16xe-50", .n_adchan = 16, .adbits = 16, @@ -238,7 +238,7 @@ static const ni_board ni_boards[] = { }, { .device_id = 0x1170, - .name = "pci-mio-16xe-10", // aka pci-6030E + .name = "pci-mio-16xe-10", /* aka pci-6030E */ .n_adchan = 16, .adbits = 16, .ai_fifo_depth = 512, @@ -330,7 +330,7 @@ static const ni_board ni_boards[] = { .ao_unipolar = 1, .ao_speed = 1000, .num_p0_dio_channels = 8, - .caldac = {ad8804_debug}, // doc says mb88341 + .caldac = {ad8804_debug}, /* doc says mb88341 */ .has_8255 = 0, }, { @@ -846,7 +846,7 @@ static const ni_board ni_boards[] = { .n_adchan = 16, .adbits = 16, .ai_fifo_depth = 512, - //FIXME: guess + /* FIXME: guess */ .gainlkup = ai_gain_622x, .ai_speed = 4000, .n_aochan = 0, @@ -1218,9 +1218,10 @@ static struct comedi_driver driver_pcimio = { COMEDI_PCI_INITCLEANUP(driver_pcimio, ni_pci_table) -typedef struct { -NI_PRIVATE_COMMON} ni_private; -#define devpriv ((ni_private *)dev->private) +struct ni_private { + NI_PRIVATE_COMMON +}; +#define devpriv ((struct ni_private *)dev->private) /* How we access registers */ @@ -1293,12 +1294,12 @@ static void m_series_stc_writew(struct comedi_device * dev, uint16_t data, int r offset = M_Offset_AI_Personal; break; case AI_SI2_Load_A_Register: - // this is actually a 32 bit register on m series boards + /* this is actually a 32 bit register on m series boards */ ni_writel(data, M_Offset_AI_SI2_Load_A); return; break; case AI_SI2_Load_B_Register: - // this is actually a 32 bit register on m series boards + /* this is actually a 32 bit register on m series boards */ ni_writel(data, M_Offset_AI_SI2_Load_B); return; break; @@ -1579,17 +1580,17 @@ static void m_series_init_eeprom_buffer(struct comedi_device * dev) static void init_6143(struct comedi_device * dev) { - // Disable interrupts + /* Disable interrupts */ devpriv->stc_writew(dev, 0, Interrupt_Control_Register); - // Initialise 6143 AI specific bits - ni_writeb(0x00, Magic_6143); // Set G0,G1 DMA mode to E series version - ni_writeb(0x80, PipelineDelay_6143); // Set EOCMode, ADCMode and pipelinedelay - ni_writeb(0x00, EOC_Set_6143); // Set EOC Delay + /* Initialise 6143 AI specific bits */ + ni_writeb(0x00, Magic_6143); /* Set G0,G1 DMA mode to E series version */ + ni_writeb(0x80, PipelineDelay_6143); /* Set EOCMode, ADCMode and pipelinedelay */ + ni_writeb(0x00, EOC_Set_6143); /* Set EOC Delay */ - ni_writel(boardtype.ai_fifo_depth / 2, AIFIFO_Flag_6143); // Set the FIFO half full level + ni_writel(boardtype.ai_fifo_depth / 2, AIFIFO_Flag_6143); /* Set the FIFO half full level */ - // Strobe Relay disable bit + /* Strobe Relay disable bit */ devpriv->ai_calib_source_enabled = 0; ni_writew(devpriv->ai_calib_source | Calibration_Channel_6143_RelayOff, Calibration_Channel_6143); diff --git a/drivers/staging/comedi/drivers/ni_stc.h b/drivers/staging/comedi/drivers/ni_stc.h index 1ebf521ab773..ceee30c7972c 100644 --- a/drivers/staging/comedi/drivers/ni_stc.h +++ b/drivers/staging/comedi/drivers/ni_stc.h @@ -521,13 +521,13 @@ enum AO_Personal_Bits { AO_FIFO_Flags_Polarity = 1 << 11, /* M Series: reserved */ AO_TMRDACWR_Pulse_Width = 1 << 12, AO_Fast_CPU = 1 << 13, /* M Series: reserved */ - AO_Number_Of_DAC_Packages = 1 << 14, // 1 for "single" mode, 0 for "dual" - AO_Multiple_DACS_Per_Package = 1 << 15 // m-series only + AO_Number_Of_DAC_Packages = 1 << 14, /* 1 for "single" mode, 0 for "dual" */ + AO_Multiple_DACS_Per_Package = 1 << 15 /* m-series only */ }; #define RTSI_Trig_A_Output_Register 79 #define RTSI_Trig_B_Output_Register 80 enum RTSI_Trig_B_Output_Bits { - RTSI_Sub_Selection_1_Bit = 0x8000 // not for m-series + RTSI_Sub_Selection_1_Bit = 0x8000 /* not for m-series */ }; static inline unsigned RTSI_Trig_Output_Bits(unsigned rtsi_channel, unsigned source) @@ -539,7 +539,7 @@ static inline unsigned RTSI_Trig_Output_Mask(unsigned rtsi_channel) return 0xf << ((rtsi_channel % 4) * 4); }; -// inverse to RTSI_Trig_Output_Bits() +/* inverse to RTSI_Trig_Output_Bits() */ static inline unsigned RTSI_Trig_Output_Source(unsigned rtsi_channel, unsigned bits) { @@ -920,42 +920,42 @@ enum ni_reg_type { static const struct comedi_lrange range_ni_E_ao_ext; enum m_series_register_offsets { - M_Offset_CDIO_DMA_Select = 0x7, // write - M_Offset_SCXI_Status = 0x7, // read - M_Offset_AI_AO_Select = 0x9, // write, same offset as e-series - M_Offset_SCXI_Serial_Data_In = 0x9, // read - M_Offset_G0_G1_Select = 0xb, // write, same offset as e-series + M_Offset_CDIO_DMA_Select = 0x7, /* write */ + M_Offset_SCXI_Status = 0x7, /* read */ + M_Offset_AI_AO_Select = 0x9, /* write, same offset as e-series */ + M_Offset_SCXI_Serial_Data_In = 0x9, /* read */ + M_Offset_G0_G1_Select = 0xb, /* write, same offset as e-series */ M_Offset_Misc_Command = 0xf, M_Offset_SCXI_Serial_Data_Out = 0x11, M_Offset_SCXI_Control = 0x13, M_Offset_SCXI_Output_Enable = 0x15, M_Offset_AI_FIFO_Data = 0x1c, - M_Offset_Static_Digital_Output = 0x24, // write - M_Offset_Static_Digital_Input = 0x24, // read + M_Offset_Static_Digital_Output = 0x24, /* write */ + M_Offset_Static_Digital_Input = 0x24, /* read */ M_Offset_DIO_Direction = 0x28, M_Offset_Cal_PWM = 0x40, M_Offset_AI_Config_FIFO_Data = 0x5e, - M_Offset_Interrupt_C_Enable = 0x88, // write - M_Offset_Interrupt_C_Status = 0x88, // read + M_Offset_Interrupt_C_Enable = 0x88, /* write */ + M_Offset_Interrupt_C_Status = 0x88, /* read */ M_Offset_Analog_Trigger_Control = 0x8c, M_Offset_AO_Serial_Interrupt_Enable = 0xa0, - M_Offset_AO_Serial_Interrupt_Ack = 0xa1, // write - M_Offset_AO_Serial_Interrupt_Status = 0xa1, // read + M_Offset_AO_Serial_Interrupt_Ack = 0xa1, /* write */ + M_Offset_AO_Serial_Interrupt_Status = 0xa1, /* read */ M_Offset_AO_Calibration = 0xa3, M_Offset_AO_FIFO_Data = 0xa4, M_Offset_PFI_Filter = 0xb0, M_Offset_RTSI_Filter = 0xb4, M_Offset_SCXI_Legacy_Compatibility = 0xbc, - M_Offset_Interrupt_A_Ack = 0x104, // write - M_Offset_AI_Status_1 = 0x104, // read - M_Offset_Interrupt_B_Ack = 0x106, // write - M_Offset_AO_Status_1 = 0x106, // read - M_Offset_AI_Command_2 = 0x108, // write - M_Offset_G01_Status = 0x108, // read + M_Offset_Interrupt_A_Ack = 0x104, /* write */ + M_Offset_AI_Status_1 = 0x104, /* read */ + M_Offset_Interrupt_B_Ack = 0x106, /* write */ + M_Offset_AO_Status_1 = 0x106, /* read */ + M_Offset_AI_Command_2 = 0x108, /* write */ + M_Offset_G01_Status = 0x108, /* read */ M_Offset_AO_Command_2 = 0x10a, - M_Offset_AO_Status_2 = 0x10c, // read - M_Offset_G0_Command = 0x10c, // write - M_Offset_G1_Command = 0x10e, // write + M_Offset_AO_Status_2 = 0x10c, /* read */ + M_Offset_G0_Command = 0x10c, /* write */ + M_Offset_G1_Command = 0x10e, /* write */ M_Offset_G0_HW_Save = 0x110, M_Offset_G0_HW_Save_High = 0x110, M_Offset_AI_Command_1 = 0x110, @@ -973,17 +973,17 @@ enum m_series_register_offsets { M_Offset_G1_Save = 0x11c, M_Offset_G1_Save_High = 0x11c, M_Offset_G1_Save_Low = 0x11e, - M_Offset_AI_SI_Load_B = 0x120, // write - M_Offset_AO_UI_Save = 0x120, // read - M_Offset_AI_SC_Load_A = 0x124, // write - M_Offset_AO_BC_Save = 0x124, // read - M_Offset_AI_SC_Load_B = 0x128, // write - M_Offset_AO_UC_Save = 0x128, //read + M_Offset_AI_SI_Load_B = 0x120, /* write */ + M_Offset_AO_UI_Save = 0x120, /* read */ + M_Offset_AI_SC_Load_A = 0x124, /* write */ + M_Offset_AO_BC_Save = 0x124, /* read */ + M_Offset_AI_SC_Load_B = 0x128, /* write */ + M_Offset_AO_UC_Save = 0x128, /* read */ M_Offset_AI_SI2_Load_A = 0x12c, M_Offset_AI_SI2_Load_B = 0x130, M_Offset_G0_Mode = 0x134, - M_Offset_G1_Mode = 0x136, // write - M_Offset_Joint_Status_1 = 0x136, // read + M_Offset_G1_Mode = 0x136, /* write */ + M_Offset_Joint_Status_1 = 0x136, /* read */ M_Offset_G0_Load_A = 0x138, M_Offset_Joint_Status_2 = 0x13a, M_Offset_G0_Load_B = 0x13c, @@ -1007,10 +1007,10 @@ enum m_series_register_offsets { M_Offset_Analog_Trigger_Etc = 0x17a, M_Offset_AI_START_STOP_Select = 0x17c, M_Offset_AI_Trigger_Select = 0x17e, - M_Offset_AI_SI_Save = 0x180, // read - M_Offset_AI_DIV_Load_A = 0x180, // write - M_Offset_AI_SC_Save = 0x184, // read - M_Offset_AO_Start_Select = 0x184, // write + M_Offset_AI_SI_Save = 0x180, /* read */ + M_Offset_AI_DIV_Load_A = 0x180, /* write */ + M_Offset_AI_SC_Save = 0x184, /* read */ + M_Offset_AO_Start_Select = 0x184, /* write */ M_Offset_AO_Trigger_Select = 0x186, M_Offset_AO_Mode_3 = 0x18c, M_Offset_G0_Autoincrement = 0x188, @@ -1032,10 +1032,10 @@ enum m_series_register_offsets { M_Offset_G1_Counting_Mode = 0x1b2, M_Offset_G0_Second_Gate = 0x1b4, M_Offset_G1_Second_Gate = 0x1b6, - M_Offset_G0_DMA_Config = 0x1b8, // write - M_Offset_G0_DMA_Status = 0x1b8, // read - M_Offset_G1_DMA_Config = 0x1ba, // write - M_Offset_G1_DMA_Status = 0x1ba, // read + M_Offset_G0_DMA_Config = 0x1b8, /* write */ + M_Offset_G0_DMA_Status = 0x1b8, /* read */ + M_Offset_G1_DMA_Config = 0x1ba, /* write */ + M_Offset_G1_DMA_Status = 0x1ba, /* read */ M_Offset_G0_MSeries_ABZ = 0x1c0, M_Offset_G1_MSeries_ABZ = 0x1c2, M_Offset_Clock_and_Fout2 = 0x1c4, @@ -1051,10 +1051,10 @@ enum m_series_register_offsets { M_Offset_PFI_DO = 0x1de, M_Offset_AI_Config_FIFO_Bypass = 0x218, M_Offset_SCXI_DIO_Enable = 0x21c, - M_Offset_CDI_FIFO_Data = 0x220, // read - M_Offset_CDO_FIFO_Data = 0x220, // write - M_Offset_CDIO_Status = 0x224, // read - M_Offset_CDIO_Command = 0x224, // write + M_Offset_CDI_FIFO_Data = 0x220, /* read */ + M_Offset_CDO_FIFO_Data = 0x220, /* write */ + M_Offset_CDIO_Status = 0x224, /* read */ + M_Offset_CDIO_Command = 0x224, /* write */ M_Offset_CDI_Mode = 0x228, M_Offset_CDO_Mode = 0x22c, M_Offset_CDI_Mask_Enable = 0x230, @@ -1122,7 +1122,7 @@ enum MSeries_AI_Config_FIFO_Data_Bits { MSeries_AI_Config_Channel_Type_Ground_Ref_Bits = 0x3 << 6, MSeries_AI_Config_Channel_Type_Aux_Bits = 0x5 << 6, MSeries_AI_Config_Channel_Type_Ghost_Bits = 0x7 << 6, - MSeries_AI_Config_Polarity_Bit = 0x1000, // 0 for 2's complement encoding + MSeries_AI_Config_Polarity_Bit = 0x1000, /* 0 for 2's complement encoding */ MSeries_AI_Config_Dither_Bit = 0x2000, MSeries_AI_Config_Last_Channel_Bit = 0x4000, }; @@ -1151,8 +1151,8 @@ enum MSeries_Clock_and_Fout2_Bits { MSeries_PLL_In_Source_Select_RTSI7_Bits = 0x1b, MSeries_PLL_In_Source_Select_PXI_Clock10 = 0x1d, MSeries_PLL_In_Source_Select_Mask = 0x1f, - MSeries_Timebase1_Select_Bit = 0x20, // use PLL for timebase 1 - MSeries_Timebase3_Select_Bit = 0x40, // use PLL for timebase 3 + MSeries_Timebase1_Select_Bit = 0x20, /* use PLL for timebase 1 */ + MSeries_Timebase3_Select_Bit = 0x40, /* use PLL for timebase 3 */ /* use 10MHz instead of 20MHz for RTSI clock frequency. Appears to have no effect, at least on pxi-6281, which always uses 20MHz rtsi clock frequency */ @@ -1213,7 +1213,7 @@ enum MSeries_AI_Config_FIFO_Bypass_Bits { MSeries_AO_Bypass_AO_Cal_Sel_Mask = 0x38000, MSeries_AI_Bypass_Gain_Mask = 0x1c0000, MSeries_AI_Bypass_Dither_Bit = 0x200000, - MSeries_AI_Bypass_Polarity_Bit = 0x400000, // 0 for 2's complement encoding + MSeries_AI_Bypass_Polarity_Bit = 0x400000, /* 0 for 2's complement encoding */ MSeries_AI_Bypass_Config_FIFO_Bit = 0x80000000 }; static inline unsigned MSeries_AI_Bypass_Cal_Sel_Pos_Bits(int @@ -1239,7 +1239,7 @@ enum MSeries_AO_Config_Bank_Bits { MSeries_AO_DAC_Reference_10V_Internal_Bits = 0x0, MSeries_AO_DAC_Reference_5V_Internal_Bits = 0x8, MSeries_AO_Update_Timed_Bit = 0x40, - MSeries_AO_Bipolar_Bit = 0x80 // turns on 2's complement encoding + MSeries_AO_Bipolar_Bit = 0x80 /* turns on 2's complement encoding */ }; enum MSeries_AO_Reference_Attenuation_Bits { @@ -1266,7 +1266,7 @@ static inline unsigned MSeries_PFI_Output_Select_Bits(unsigned channel, return (source & 0x1f) << ((channel % 3) * 5); }; -// inverse to MSeries_PFI_Output_Select_Bits +/* inverse to MSeries_PFI_Output_Select_Bits */ static inline unsigned MSeries_PFI_Output_Select_Source(unsigned channel, unsigned bits) { @@ -1338,9 +1338,9 @@ enum CDIO_Command_Bits { enum CDI_Mode_Bits { CDI_Sample_Source_Select_Mask = 0x3f, CDI_Halt_On_Error_Bit = 0x200, - CDI_Polarity_Bit = 0x400, // sample clock on falling edge - CDI_FIFO_Mode_Bit = 0x800, // set for half full mode, clear for not empty mode - CDI_Data_Lane_Mask = 0x3000, // data lanes specify which dio channels map to byte or word accesses to the dio fifos + CDI_Polarity_Bit = 0x400, /* sample clock on falling edge */ + CDI_FIFO_Mode_Bit = 0x800, /* set for half full mode, clear for not empty mode */ + CDI_Data_Lane_Mask = 0x3000, /* data lanes specify which dio channels map to byte or word accesses to the dio fifos */ CDI_Data_Lane_0_15_Bits = 0x0, CDI_Data_Lane_16_31_Bits = 0x1000, CDI_Data_Lane_0_7_Bits = 0x0, @@ -1353,9 +1353,9 @@ enum CDO_Mode_Bits { CDO_Sample_Source_Select_Mask = 0x3f, CDO_Retransmit_Bit = 0x100, CDO_Halt_On_Error_Bit = 0x200, - CDO_Polarity_Bit = 0x400, // sample clock on falling edge - CDO_FIFO_Mode_Bit = 0x800, // set for half full mode, clear for not full mode - CDO_Data_Lane_Mask = 0x3000, // data lanes specify which dio channels map to byte or word accesses to the dio fifos + CDO_Polarity_Bit = 0x400, /* sample clock on falling edge */ + CDO_FIFO_Mode_Bit = 0x800, /* set for half full mode, clear for not full mode */ + CDO_Data_Lane_Mask = 0x3000, /* data lanes specify which dio channels map to byte or word accesses to the dio fifos */ CDO_Data_Lane_0_15_Bits = 0x0, CDO_Data_Lane_16_31_Bits = 0x1000, CDO_Data_Lane_0_7_Bits = 0x0, @@ -1374,7 +1374,7 @@ enum Interrupt_C_Status_Bits { #define M_SERIES_EEPROM_SIZE 1024 -typedef struct ni_board_struct { +struct ni_board_struct { int device_id; int isapnp_id; char *name; @@ -1401,11 +1401,11 @@ typedef struct ni_board_struct { unsigned int has_analog_trig:1; enum caldac_enum caldac[3]; -} ni_board; +}; -#define n_ni_boards (sizeof(ni_boards)/sizeof(ni_board)) +#define n_ni_boards (sizeof(ni_boards)/sizeof(struct ni_board_struct)) -#define boardtype (*(ni_board *)dev->board_ptr) +#define boardtype (*(struct ni_board_struct *)dev->board_ptr) #define MAX_N_AO_CHAN 8 #define NUM_GPCT 2 diff --git a/drivers/staging/comedi/drivers/ni_tio.c b/drivers/staging/comedi/drivers/ni_tio.c index 05a957540398..53966e9816c1 100644 --- a/drivers/staging/comedi/drivers/ni_tio.c +++ b/drivers/staging/comedi/drivers/ni_tio.c @@ -1273,7 +1273,7 @@ static int ni_tio_set_other_src(struct ni_gpct *counter, unsigned index, counter_dev->regs[abz_reg] &= ~mask; counter_dev->regs[abz_reg] |= (source << shift) & mask; write_register(counter, counter_dev->regs[abz_reg], abz_reg); -// rt_printk("%s %x %d %d\n", __FUNCTION__, counter_dev->regs[abz_reg], index, source); +/* rt_printk("%s %x %d %d\n", __FUNCTION__, counter_dev->regs[abz_reg], index, source); */ return 0; } return -EINVAL; diff --git a/drivers/staging/comedi/drivers/ni_tio.h b/drivers/staging/comedi/drivers/ni_tio.h index 0729d60b01cc..f9e7b8343aef 100644 --- a/drivers/staging/comedi/drivers/ni_tio.h +++ b/drivers/staging/comedi/drivers/ni_tio.h @@ -25,7 +25,7 @@ #include "../comedidev.h" -// forward declarations +/* forward declarations */ struct mite_struct; struct ni_gpct_device; diff --git a/drivers/staging/comedi/drivers/ni_tio_internal.h b/drivers/staging/comedi/drivers/ni_tio_internal.h index ac5b171cbe18..850e1ea3ad9f 100644 --- a/drivers/staging/comedi/drivers/ni_tio_internal.h +++ b/drivers/staging/comedi/drivers/ni_tio_internal.h @@ -487,8 +487,8 @@ enum Gi_Counting_Mode_Reg_Bits { #define Gi_Source_Select_Shift 2 #define Gi_Gate_Select_Shift 7 enum Gi_Input_Select_Bits { - Gi_Read_Acknowledges_Irq = 0x1, // not present on 660x - Gi_Write_Acknowledges_Irq = 0x2, // not present on 660x + Gi_Read_Acknowledges_Irq = 0x1, /* not present on 660x */ + Gi_Write_Acknowledges_Irq = 0x2, /* not present on 660x */ Gi_Source_Select_Mask = 0x7c, Gi_Gate_Select_Mask = 0x1f << Gi_Gate_Select_Shift, Gi_Gate_Select_Load_Source_Bit = 0x1000, @@ -656,7 +656,7 @@ static inline unsigned Gi_TC_Error_Confirm_Bit(unsigned counter_index) return G0_TC_Error_Confirm_Bit; } -// bits that are the same in G0/G2 and G1/G3 interrupt acknowledge registers +/* bits that are the same in G0/G2 and G1/G3 interrupt acknowledge registers */ enum Gxx_Interrupt_Acknowledge_Bits { Gi_TC_Interrupt_Ack_Bit = 0x4000, Gi_Gate_Interrupt_Ack_Bit = 0x8000 diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c b/drivers/staging/comedi/drivers/ni_tiocmd.c index 16a26e73c994..a3c55979cf4c 100644 --- a/drivers/staging/comedi/drivers/ni_tiocmd.c +++ b/drivers/staging/comedi/drivers/ni_tiocmd.c @@ -365,7 +365,7 @@ static int should_ack_gate(struct ni_gpct *counter) switch (counter->counter_dev->variant) { case ni_gpct_variant_m_series: - case ni_gpct_variant_660x: // not sure if 660x really supports gate interrupts (the bits are not listed in register-level manual) + case ni_gpct_variant_660x: /* not sure if 660x really supports gate interrupts (the bits are not listed in register-level manual) */ return 1; break; case ni_gpct_variant_e_series: diff --git a/drivers/staging/comedi/drivers/pcl711.c b/drivers/staging/comedi/drivers/pcl711.c index ce42506d47b5..7b99471a4369 100644 --- a/drivers/staging/comedi/drivers/pcl711.c +++ b/drivers/staging/comedi/drivers/pcl711.c @@ -185,7 +185,7 @@ struct pcl711_private { #define devpriv ((struct pcl711_private *)dev->private) -static irqreturn_t pcl711_interrupt(int irq, void *d PT_REGS_ARG) +static irqreturn_t pcl711_interrupt(int irq, void *d) { int lo, hi; int data; diff --git a/drivers/staging/comedi/drivers/pcl724.c b/drivers/staging/comedi/drivers/pcl724.c index cd1e784f25f9..1f7763b2b653 100644 --- a/drivers/staging/comedi/drivers/pcl724.c +++ b/drivers/staging/comedi/drivers/pcl724.c @@ -54,18 +54,18 @@ See the source for configuration details. #define SIZE_8255 4 -// #define PCL724_IRQ 1 /* no IRQ support now */ +/* #define PCL724_IRQ 1 no IRQ support now */ static int pcl724_attach(struct comedi_device * dev, struct comedi_devconfig * it); static int pcl724_detach(struct comedi_device * dev); struct pcl724_board { - const char *name; // board name - int dio; // num of DIO - int numofports; // num of 8255 subdevices - unsigned int IRQbits; // allowed interrupts - unsigned int io_range; // len of IO space + const char *name; /* board name */ + int dio; /* num of DIO */ + int numofports; /* num of 8255 subdevices */ + unsigned int IRQbits; /* allowed interrupts */ + unsigned int io_range; /* len of IO space */ char can_have96; char is_pet48; }; @@ -137,7 +137,7 @@ static int pcl724_attach(struct comedi_device * dev, struct comedi_devconfig * i iorange = this_board->io_range; if ((this_board->can_have96) && ((it->options[1] == 1) || (it->options[1] == 96))) - iorange = PCL722_96_SIZE; // PCL-724 in 96 DIO configuration + iorange = PCL722_96_SIZE; /* PCL-724 in 96 DIO configuration */ printk("comedi%d: pcl724: board=%s, 0x%03lx ", dev->minor, this_board->name, iobase); if (!request_region(iobase, iorange, "pcl724")) { @@ -181,7 +181,7 @@ static int pcl724_attach(struct comedi_device * dev, struct comedi_devconfig * i n_subdevices = this_board->numofports; if ((this_board->can_have96) && ((it->options[1] == 1) || (it->options[1] == 96))) - n_subdevices = 4; // PCL-724 in 96 DIO configuration + n_subdevices = 4; /* PCL-724 in 96 DIO configuration */ if ((ret = alloc_subdevices(dev, n_subdevices)) < 0) return ret; @@ -204,7 +204,7 @@ static int pcl724_detach(struct comedi_device * dev) { int i; -// printk("comedi%d: pcl724: remove\n",dev->minor); +/* printk("comedi%d: pcl724: remove\n",dev->minor); */ for (i = 0; i < dev->n_subdevices; i++) { subdev_8255_cleanup(dev, dev->subdevices + i); diff --git a/drivers/staging/comedi/drivers/pcl726.c b/drivers/staging/comedi/drivers/pcl726.c index 6dbd33d7907b..c92ffca0b9ab 100644 --- a/drivers/staging/comedi/drivers/pcl726.c +++ b/drivers/staging/comedi/drivers/pcl726.c @@ -116,17 +116,17 @@ static int pcl726_detach(struct comedi_device * dev); struct pcl726_board { - const char *name; // driver name - int n_aochan; // num of D/A chans - int num_of_ranges; // num of ranges - unsigned int IRQbits; // allowed interrupts - unsigned int io_range; // len of IO space - char have_dio; // 1=card have DI/DO ports - int di_hi; // ports for DI/DO operations + const char *name; /* driver name */ + int n_aochan; /* num of D/A chans */ + int num_of_ranges; /* num of ranges */ + unsigned int IRQbits; /* allowed interrupts */ + unsigned int io_range; /* len of IO space */ + char have_dio; /* 1=card have DI/DO ports */ + int di_hi; /* ports for DI/DO operations */ int di_lo; int do_hi; int do_lo; - const struct comedi_lrange *const *range_type_list; // list of supported ranges + const struct comedi_lrange *const *range_type_list; /* list of supported ranges */ }; @@ -362,7 +362,7 @@ static int pcl726_attach(struct comedi_device * dev, struct comedi_devconfig * i static int pcl726_detach(struct comedi_device * dev) { -// printk("comedi%d: pcl726: remove\n",dev->minor); +/* printk("comedi%d: pcl726: remove\n",dev->minor); */ #ifdef ACL6126_IRQ if (dev->irq) { diff --git a/drivers/staging/comedi/drivers/pcl730.c b/drivers/staging/comedi/drivers/pcl730.c index f2c6d7c5693c..c411a16f71d2 100644 --- a/drivers/staging/comedi/drivers/pcl730.c +++ b/drivers/staging/comedi/drivers/pcl730.c @@ -31,8 +31,8 @@ static int pcl730_detach(struct comedi_device * dev); struct pcl730_board { - const char *name; // board name - unsigned int io_range; // len of I/O space + const char *name; /* board name */ + unsigned int io_range; /* len of I/O space */ }; diff --git a/drivers/staging/comedi/drivers/pcl812.c b/drivers/staging/comedi/drivers/pcl812.c index 11dfd230e565..dc1a1e4a303f 100644 --- a/drivers/staging/comedi/drivers/pcl812.c +++ b/drivers/staging/comedi/drivers/pcl812.c @@ -117,7 +117,7 @@ Options for ACL-8113, ISO-813: #undef PCL812_EXTDEBUG /* if this is defined then a lot of messages is printed */ -// hardware types of the cards +/* hardware types of the cards */ #define boardPCL812PG 0 /* and ACL-8112PG */ #define boardPCL813B 1 #define boardPCL812 2 @@ -297,22 +297,22 @@ static int pcl812_detach(struct comedi_device * dev); struct pcl812_board { - const char *name; // board name - int board_type; // type of this board - int n_aichan; // num of AI chans in S.E. - int n_aichan_diff; // DIFF num of chans - int n_aochan; // num of DA chans - int n_dichan; // DI and DO chans + const char *name; /* board name */ + int board_type; /* type of this board */ + int n_aichan; /* num of AI chans in S.E. */ + int n_aichan_diff; /* DIFF num of chans */ + int n_aochan; /* num of DA chans */ + int n_dichan; /* DI and DO chans */ int n_dochan; - int ai_maxdata; // AI resolution - unsigned int ai_ns_min; // max sample speed of card v ns - unsigned int i8254_osc_base; // clock base - const struct comedi_lrange *rangelist_ai; // rangelist for A/D - const struct comedi_lrange *rangelist_ao; // rangelist for D/A - unsigned int IRQbits; // allowed IRQ - unsigned char DMAbits; // allowed DMA chans - unsigned char io_range; // iorange for this board - unsigned char haveMPC508; // 1=board use MPC508A multiplexor + int ai_maxdata; /* AI resolution */ + unsigned int ai_ns_min; /* max sample speed of card v ns */ + unsigned int i8254_osc_base; /* clock base */ + const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */ + const struct comedi_lrange *rangelist_ao; /* rangelist for D/A */ + unsigned int IRQbits; /* allowed IRQ */ + unsigned char DMAbits; /* allowed DMA chans */ + unsigned char io_range; /* iorange for this board */ + unsigned char haveMPC508; /* 1=board use MPC508A multiplexor */ }; @@ -390,37 +390,37 @@ COMEDI_INITCLEANUP(driver_pcl812); struct pcl812_private { - unsigned char valid; // =1 device is OK - unsigned char dma; // >0 use dma ( usedDMA channel) - unsigned char use_diff; // =1 diff inputs - unsigned char use_MPC; // 1=board uses MPC508A multiplexor - unsigned char use_ext_trg; // 1=board uses external trigger - unsigned char range_correction; // =1 we must add 1 to range number - unsigned char old_chan_reg; // lastly used chan/gain pair + unsigned char valid; /* =1 device is OK */ + unsigned char dma; /* >0 use dma ( usedDMA channel) */ + unsigned char use_diff; /* =1 diff inputs */ + unsigned char use_MPC; /* 1=board uses MPC508A multiplexor */ + unsigned char use_ext_trg; /* 1=board uses external trigger */ + unsigned char range_correction; /* =1 we must add 1 to range number */ + unsigned char old_chan_reg; /* lastly used chan/gain pair */ unsigned char old_gain_reg; - unsigned char mode_reg_int; // there is stored INT number for some card - unsigned char ai_neverending; // =1 we do unlimited AI - unsigned char ai_eos; // 1=EOS wake up - unsigned char ai_dma; // =1 we use DMA - unsigned int ai_poll_ptr; // how many sampes transfer poll - unsigned int ai_scans; // len of scanlist - unsigned int ai_act_scan; // how many scans we finished - unsigned int ai_chanlist[MAX_CHANLIST_LEN]; // our copy of channel/range list - unsigned int ai_n_chan; // how many channels is measured - unsigned int ai_flags; // flaglist - unsigned int ai_data_len; // len of data buffer - short *ai_data; // data buffer - unsigned int ai_is16b; // =1 we have 16 bit card - unsigned long dmabuf[2]; // PTR to DMA buf - unsigned int dmapages[2]; // how many pages we have allocated - unsigned int hwdmaptr[2]; // HW PTR to DMA buf - unsigned int hwdmasize[2]; // DMA buf size in bytes - unsigned int dmabytestomove[2]; // how many bytes DMA transfer - int next_dma_buf; // which buffer is next to use - unsigned int dma_runs_to_end; // how many times we must switch DMA buffers - unsigned int last_dma_run; // how many bytes to transfer on last DMA buffer - unsigned int max_812_ai_mode0_rangewait; // setling time for gain - unsigned int ao_readback[2]; // data for AO readback + unsigned char mode_reg_int; /* there is stored INT number for some card */ + unsigned char ai_neverending; /* =1 we do unlimited AI */ + unsigned char ai_eos; /* 1=EOS wake up */ + unsigned char ai_dma; /* =1 we use DMA */ + unsigned int ai_poll_ptr; /* how many sampes transfer poll */ + unsigned int ai_scans; /* len of scanlist */ + unsigned int ai_act_scan; /* how many scans we finished */ + unsigned int ai_chanlist[MAX_CHANLIST_LEN]; /* our copy of channel/range list */ + unsigned int ai_n_chan; /* how many channels is measured */ + unsigned int ai_flags; /* flaglist */ + unsigned int ai_data_len; /* len of data buffer */ + short *ai_data; /* data buffer */ + unsigned int ai_is16b; /* =1 we have 16 bit card */ + unsigned long dmabuf[2]; /* PTR to DMA buf */ + unsigned int dmapages[2]; /* how many pages we have allocated */ + unsigned int hwdmaptr[2]; /* HW PTR to DMA buf */ + unsigned int hwdmasize[2]; /* DMA buf size in bytes */ + unsigned int dmabytestomove[2]; /* how many bytes DMA transfer */ + int next_dma_buf; /* which buffer is next to use */ + unsigned int dma_runs_to_end; /* how many times we must switch DMA buffers */ + unsigned int last_dma_run; /* how many bytes to transfer on last DMA buffer */ + unsigned int max_812_ai_mode0_rangewait; /* setling time for gain */ + unsigned int ao_readback[2]; /* data for AO readback */ }; @@ -444,7 +444,7 @@ static int pcl812_ai_insn_read(struct comedi_device * dev, struct comedi_subdevi int timeout, hi; outb(devpriv->mode_reg_int | 1, dev->iobase + PCL812_MODE); /* select software trigger */ - setup_range_channel(dev, s, insn->chanspec, 1); // select channel and renge + setup_range_channel(dev, s, insn->chanspec, 1); /* select channel and renge */ for (n = 0; n < insn->n; n++) { outb(255, dev->iobase + PCL812_SOFTTRIG); /* start conversion */ comedi_udelay(5); @@ -478,7 +478,7 @@ static int acl8216_ai_insn_read(struct comedi_device * dev, struct comedi_subdev int timeout; outb(1, dev->iobase + PCL812_MODE); /* select software trigger */ - setup_range_channel(dev, s, insn->chanspec, 1); // select channel and renge + setup_range_channel(dev, s, insn->chanspec, 1); /* select channel and renge */ for (n = 0; n < insn->n; n++) { outb(255, dev->iobase + PCL812_SOFTTRIG); /* start conversion */ comedi_udelay(5); @@ -809,18 +809,18 @@ static int pcl812_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s cmd->flags & TRIG_ROUND_MASK); } - start_pacer(dev, -1, 0, 0); // stop pacer + start_pacer(dev, -1, 0, 0); /* stop pacer */ devpriv->ai_n_chan = cmd->chanlist_len; memcpy(devpriv->ai_chanlist, cmd->chanlist, sizeof(unsigned int) * cmd->scan_end_arg); - setup_range_channel(dev, s, devpriv->ai_chanlist[0], 1); // select first channel and range + setup_range_channel(dev, s, devpriv->ai_chanlist[0], 1); /* select first channel and range */ - if (devpriv->dma) { // check if we can use DMA transfer + if (devpriv->dma) { /* check if we can use DMA transfer */ devpriv->ai_dma = 1; for (i = 1; i < devpriv->ai_n_chan; i++) if (devpriv->ai_chanlist[0] != devpriv->ai_chanlist[i]) { - devpriv->ai_dma = 0; // we cann't use DMA :-( + devpriv->ai_dma = 0; /* we cann't use DMA :-( */ break; } } else @@ -841,14 +841,14 @@ static int pcl812_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s devpriv->ai_poll_ptr = 0; s->async->cur_chan = 0; - if ((devpriv->ai_flags & TRIG_WAKE_EOS)) { // don't we want wake up every scan? + if ((devpriv->ai_flags & TRIG_WAKE_EOS)) { /* don't we want wake up every scan? */ devpriv->ai_eos = 1; if (devpriv->ai_n_chan == 1) - devpriv->ai_dma = 0; // DMA is useless for this situation + devpriv->ai_dma = 0; /* DMA is useless for this situation */ } if (devpriv->ai_dma) { - if (devpriv->ai_eos) { // we use EOS, so adapt DMA buffer to one scan + if (devpriv->ai_eos) { /* we use EOS, so adapt DMA buffer to one scan */ devpriv->dmabytestomove[0] = devpriv->ai_n_chan * sizeof(short); devpriv->dmabytestomove[1] = @@ -866,9 +866,9 @@ static int pcl812_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s if (devpriv->ai_neverending) { devpriv->dma_runs_to_end = 1; } else { - bytes = devpriv->ai_n_chan * devpriv->ai_scans * sizeof(short); // how many samples we must transfer? - devpriv->dma_runs_to_end = bytes / devpriv->dmabytestomove[0]; // how many DMA pages we must fill - devpriv->last_dma_run = bytes % devpriv->dmabytestomove[0]; //on last dma transfer must be moved + bytes = devpriv->ai_n_chan * devpriv->ai_scans * sizeof(short); /* how many samples we must transfer? */ + devpriv->dma_runs_to_end = bytes / devpriv->dmabytestomove[0]; /* how many DMA pages we must fill */ + devpriv->last_dma_run = bytes % devpriv->dmabytestomove[0]; /* on last dma transfer must be moved */ if (devpriv->dma_runs_to_end == 0) devpriv->dmabytestomove[0] = devpriv->last_dma_run; @@ -907,9 +907,9 @@ static int pcl812_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s } if (devpriv->ai_dma) { - outb(devpriv->mode_reg_int | 2, dev->iobase + PCL812_MODE); // let's go! + outb(devpriv->mode_reg_int | 2, dev->iobase + PCL812_MODE); /* let's go! */ } else { - outb(devpriv->mode_reg_int | 6, dev->iobase + PCL812_MODE); // let's go! + outb(devpriv->mode_reg_int | 6, dev->iobase + PCL812_MODE); /* let's go! */ } #ifdef PCL812_EXTDEBUG @@ -991,7 +991,7 @@ static void transfer_from_dma_buf(struct comedi_device * dev, struct comedi_subd s->async->events = 0; for (i = len; i; i--) { - comedi_buf_put(s->async, ptr[bufptr++]); // get one sample + comedi_buf_put(s->async, ptr[bufptr++]); /* get one sample */ if (s->async->cur_chan == 0) { devpriv->ai_act_scan++; @@ -1061,7 +1061,7 @@ static irqreturn_t interrupt_pcl812_ai_dma(int irq, void *d) /* ============================================================================== */ -static irqreturn_t interrupt_pcl812(int irq, void *d PT_REGS_ARG) +static irqreturn_t interrupt_pcl812(int irq, void *d) { struct comedi_device *dev = d; @@ -1085,12 +1085,12 @@ static int pcl812_ai_poll(struct comedi_device * dev, struct comedi_subdevice * unsigned int top1, top2, i; if (!devpriv->ai_dma) - return 0; // poll is valid only for DMA transfer + return 0; /* poll is valid only for DMA transfer */ comedi_spin_lock_irqsave(&dev->spinlock, flags); for (i = 0; i < 10; i++) { - top1 = get_dma_residue(devpriv->ai_dma); // where is now DMA + top1 = get_dma_residue(devpriv->ai_dma); /* where is now DMA */ top2 = get_dma_residue(devpriv->ai_dma); if (top1 == top2) break; @@ -1101,10 +1101,10 @@ static int pcl812_ai_poll(struct comedi_device * dev, struct comedi_subdevice * return 0; } - top1 = devpriv->dmabytestomove[1 - devpriv->next_dma_buf] - top1; // where is now DMA in buffer - top1 >>= 1; // sample position + top1 = devpriv->dmabytestomove[1 - devpriv->next_dma_buf] - top1; /* where is now DMA in buffer */ + top1 >>= 1; /* sample position */ top2 = top1 - devpriv->ai_poll_ptr; - if (top2 < 1) { // no new samples + if (top2 < 1) { /* no new samples */ comedi_spin_unlock_irqrestore(&dev->spinlock, flags); return 0; } @@ -1113,7 +1113,7 @@ static int pcl812_ai_poll(struct comedi_device * dev, struct comedi_subdevice * (void *)devpriv->dmabuf[1 - devpriv->next_dma_buf], devpriv->ai_poll_ptr, top2); - devpriv->ai_poll_ptr = top1; // new buffer position + devpriv->ai_poll_ptr = top1; /* new buffer position */ comedi_spin_unlock_irqrestore(&dev->spinlock, flags); @@ -1126,24 +1126,24 @@ static int pcl812_ai_poll(struct comedi_device * dev, struct comedi_subdevice * static void setup_range_channel(struct comedi_device * dev, struct comedi_subdevice * s, unsigned int rangechan, char wait) { - unsigned char chan_reg = CR_CHAN(rangechan); // normal board - unsigned char gain_reg = CR_RANGE(rangechan) + devpriv->range_correction; // gain index + unsigned char chan_reg = CR_CHAN(rangechan); /* normal board */ + unsigned char gain_reg = CR_RANGE(rangechan) + devpriv->range_correction; /* gain index */ if ((chan_reg == devpriv->old_chan_reg) && (gain_reg == devpriv->old_gain_reg)) - return; // we can return, no change + return; /* we can return, no change */ devpriv->old_chan_reg = chan_reg; devpriv->old_gain_reg = gain_reg; if (devpriv->use_MPC) { if (devpriv->use_diff) { - chan_reg = chan_reg | 0x30; // DIFF inputs + chan_reg = chan_reg | 0x30; /* DIFF inputs */ } else { if (chan_reg & 0x80) { - chan_reg = chan_reg | 0x20; // SE inputs 8-15 + chan_reg = chan_reg | 0x20; /* SE inputs 8-15 */ } else { - chan_reg = chan_reg | 0x10; // SE inputs 0-7 + chan_reg = chan_reg | 0x10; /* SE inputs 0-7 */ } } } @@ -1152,7 +1152,7 @@ static void setup_range_channel(struct comedi_device * dev, struct comedi_subdev outb(gain_reg, dev->iobase + PCL812_GAIN); /* select gain */ if (wait) { - comedi_udelay(devpriv->max_812_ai_mode0_rangewait); // XXX this depends on selected range and can be very long for some high gain ranges! + comedi_udelay(devpriv->max_812_ai_mode0_rangewait); /* XXX this depends on selected range and can be very long for some high gain ranges! */ } } @@ -1213,7 +1213,7 @@ static int pcl812_ai_cancel(struct comedi_device * dev, struct comedi_subdevice disable_dma(devpriv->dma); outb(0, dev->iobase + PCL812_CLRINT); /* clear INT request */ outb(devpriv->mode_reg_int | 0, dev->iobase + PCL812_MODE); /* Stop A/D */ - start_pacer(dev, -1, 0, 0); // stop 8254 + start_pacer(dev, -1, 0, 0); /* stop 8254 */ outb(0, dev->iobase + PCL812_CLRINT); /* clear INT request */ #ifdef PCL812_EXTDEBUG rt_printk("pcl812 EDBG: END: pcl812_ai_cancel(...)\n"); @@ -1231,7 +1231,7 @@ static void pcl812_reset(struct comedi_device * dev) #endif outb(0, dev->iobase + PCL812_MUX); outb(0 + devpriv->range_correction, dev->iobase + PCL812_GAIN); - devpriv->old_chan_reg = -1; // invalidate chain/gain memory + devpriv->old_chan_reg = -1; /* invalidate chain/gain memory */ devpriv->old_gain_reg = -1; switch (this_board->board_type) { @@ -1244,7 +1244,7 @@ static void pcl812_reset(struct comedi_device * dev) case boardA821: outb(0, dev->iobase + PCL812_DA1_LO); outb(0, dev->iobase + PCL812_DA1_HI); - start_pacer(dev, -1, 0, 0); // stop 8254 + start_pacer(dev, -1, 0, 0); /* stop 8254 */ outb(0, dev->iobase + PCL812_DO_HI); outb(0, dev->iobase + PCL812_DO_LO); outb(devpriv->mode_reg_int | 0, dev->iobase + PCL812_MODE); @@ -1570,7 +1570,7 @@ static int pcl812_attach(struct comedi_device * dev, struct comedi_devconfig * i case boardACL8112: devpriv->max_812_ai_mode0_rangewait = 1; if (it->options[3] > 0) - devpriv->use_ext_trg = 1; // we use external trigger + devpriv->use_ext_trg = 1; /* we use external trigger */ case boardA821: devpriv->max_812_ai_mode0_rangewait = 1; devpriv->mode_reg_int = (irq << 4) & 0xf0; diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c index 515ba74cc7fe..2241fa9f5b63 100644 --- a/drivers/staging/comedi/drivers/pcl816.c +++ b/drivers/staging/comedi/drivers/pcl816.c @@ -43,38 +43,38 @@ Configuration Options: #define DEBUG(x) x -// boards constants -// IO space len +/* boards constants */ +/* IO space len */ #define PCLx1x_RANGE 16 -//#define outb(x,y) printk("OUTB(%x, 200+%d)\n", x,y-0x200); outb(x,y) +/* #define outb(x,y) printk("OUTB(%x, 200+%d)\n", x,y-0x200); outb(x,y) */ -// INTEL 8254 counters +/* INTEL 8254 counters */ #define PCL816_CTR0 4 #define PCL816_CTR1 5 #define PCL816_CTR2 6 -// R: counter read-back register W: counter control +/* R: counter read-back register W: counter control */ #define PCL816_CTRCTL 7 -// R: A/D high byte W: A/D range control +/* R: A/D high byte W: A/D range control */ #define PCL816_RANGE 9 -// W: clear INT request +/* W: clear INT request */ #define PCL816_CLRINT 10 -// R: next mux scan channel W: mux scan channel & range control pointer +/* R: next mux scan channel W: mux scan channel & range control pointer */ #define PCL816_MUX 11 -// R/W: operation control register +/* R/W: operation control register */ #define PCL816_CONTROL 12 -// R: return status byte W: set DMA/IRQ +/* R: return status byte W: set DMA/IRQ */ #define PCL816_STATUS 13 #define PCL816_STATUS_DRDY_MASK 0x80 -// R: low byte of A/D W: soft A/D trigger +/* R: low byte of A/D W: soft A/D trigger */ #define PCL816_AD_LO 8 -// R: high byte of A/D W: A/D range control +/* R: high byte of A/D W: A/D range control */ #define PCL816_AD_HI 9 -// type of interrupt handler +/* type of interrupt handler */ #define INT_TYPE_AI1_INT 1 #define INT_TYPE_AI1_DMA 2 #define INT_TYPE_AI3_INT 4 @@ -83,7 +83,7 @@ Configuration Options: #define INT_TYPE_AI1_DMA_RTC 9 #define INT_TYPE_AI3_DMA_RTC 10 -// RTC stuff... +/* RTC stuff... */ #define RTC_IRQ 8 #define RTC_IO_EXTENT 0x10 #endif @@ -103,35 +103,35 @@ static const struct comedi_lrange range_pcl816 = { 8, { }; struct pcl816_board { - const char *name; // board name - int n_ranges; // len of range list - int n_aichan; // num of A/D chans in diferencial mode - unsigned int ai_ns_min; // minimal alllowed delay between samples (in ns) - int n_aochan; // num of D/A chans - int n_dichan; // num of DI chans - int n_dochan; // num of DO chans - const struct comedi_lrange *ai_range_type; // default A/D rangelist - const struct comedi_lrange *ao_range_type; // dafault D/A rangelist - unsigned int io_range; // len of IO space - unsigned int IRQbits; // allowed interrupts - unsigned int DMAbits; // allowed DMA chans - int ai_maxdata; // maxdata for A/D - int ao_maxdata; // maxdata for D/A - int ai_chanlist; // allowed len of channel list A/D - int ao_chanlist; // allowed len of channel list D/A - int i8254_osc_base; // 1/frequency of on board oscilator in ns + const char *name; /* board name */ + int n_ranges; /* len of range list */ + int n_aichan; /* num of A/D chans in diferencial mode */ + unsigned int ai_ns_min; /* minimal alllowed delay between samples (in ns) */ + int n_aochan; /* num of D/A chans */ + int n_dichan; /* num of DI chans */ + int n_dochan; /* num of DO chans */ + const struct comedi_lrange *ai_range_type; /* default A/D rangelist */ + const struct comedi_lrange *ao_range_type; /* dafault D/A rangelist */ + unsigned int io_range; /* len of IO space */ + unsigned int IRQbits; /* allowed interrupts */ + unsigned int DMAbits; /* allowed DMA chans */ + int ai_maxdata; /* maxdata for A/D */ + int ao_maxdata; /* maxdata for D/A */ + int ai_chanlist; /* allowed len of channel list A/D */ + int ao_chanlist; /* allowed len of channel list D/A */ + int i8254_osc_base; /* 1/frequency of on board oscilator in ns */ }; static const struct pcl816_board boardtypes[] = { {"pcl816", 8, 16, 10000, 1, 16, 16, &range_pcl816, &range_pcl816, PCLx1x_RANGE, - 0x00fc, // IRQ mask - 0x0a, // DMA mask - 0xffff, // 16-bit card - 0xffff, // D/A maxdata + 0x00fc, /* IRQ mask */ + 0x0a, /* DMA mask */ + 0xffff, /* 16-bit card */ + 0xffff, /* D/A maxdata */ 1024, - 1, // ao chan list + 1, /* ao chan list */ 100}, {"pcl814b", 8, 16, 10000, 1, 16, 16, &range_pcl816, &range_pcl816, PCLx1x_RANGE, @@ -170,42 +170,42 @@ COMEDI_INITCLEANUP(driver_pcl816); struct pcl816_private { - unsigned int dma; // used DMA, 0=don't use DMA - int dma_rtc; // 1=RTC used with DMA, 0=no RTC alloc + unsigned int dma; /* used DMA, 0=don't use DMA */ + int dma_rtc; /* 1=RTC used with DMA, 0=no RTC alloc */ #ifdef unused - unsigned long rtc_iobase; // RTC port region + unsigned long rtc_iobase; /* RTC port region */ unsigned int rtc_iosize; unsigned int rtc_irq; #endif - unsigned long dmabuf[2]; // pointers to begin of DMA buffers - unsigned int dmapages[2]; // len of DMA buffers in PAGE_SIZEs - unsigned int hwdmaptr[2]; // hardware address of DMA buffers - unsigned int hwdmasize[2]; // len of DMA buffers in Bytes - unsigned int dmasamplsize; // size in samples hwdmasize[0]/2 - unsigned int last_top_dma; // DMA pointer in last RTC int - int next_dma_buf; // which DMA buffer will be used next round - long dma_runs_to_end; // how many we must permorm DMA transfer to end of record - unsigned long last_dma_run; // how many bytes we must transfer on last DMA page - - unsigned int ai_scans; // len of scanlist - unsigned char ai_neverending; // if=1, then we do neverending record (you must use cancel()) - int irq_free; // 1=have allocated IRQ - int irq_blocked; // 1=IRQ now uses any subdev + unsigned long dmabuf[2]; /* pointers to begin of DMA buffers */ + unsigned int dmapages[2]; /* len of DMA buffers in PAGE_SIZEs */ + unsigned int hwdmaptr[2]; /* hardware address of DMA buffers */ + unsigned int hwdmasize[2]; /* len of DMA buffers in Bytes */ + unsigned int dmasamplsize; /* size in samples hwdmasize[0]/2 */ + unsigned int last_top_dma; /* DMA pointer in last RTC int */ + int next_dma_buf; /* which DMA buffer will be used next round */ + long dma_runs_to_end; /* how many we must permorm DMA transfer to end of record */ + unsigned long last_dma_run; /* how many bytes we must transfer on last DMA page */ + + unsigned int ai_scans; /* len of scanlist */ + unsigned char ai_neverending; /* if=1, then we do neverending record (you must use cancel()) */ + int irq_free; /* 1=have allocated IRQ */ + int irq_blocked; /* 1=IRQ now uses any subdev */ #ifdef unused - int rtc_irq_blocked; // 1=we now do AI with DMA&RTC + int rtc_irq_blocked; /* 1=we now do AI with DMA&RTC */ #endif - int irq_was_now_closed; // when IRQ finish, there's stored int816_mode for last interrupt - int int816_mode; // who now uses IRQ - 1=AI1 int, 2=AI1 dma, 3=AI3 int, 4AI3 dma - struct comedi_subdevice *last_int_sub; // ptr to subdevice which now finish - int ai_act_scan; // how many scans we finished - unsigned int ai_act_chanlist[16]; // MUX setting for actual AI operations - unsigned int ai_act_chanlist_len; // how long is actual MUX list - unsigned int ai_act_chanlist_pos; // actual position in MUX list - unsigned int ai_poll_ptr; // how many sampes transfer poll - struct comedi_subdevice *sub_ai; // ptr to AI subdevice + int irq_was_now_closed; /* when IRQ finish, there's stored int816_mode for last interrupt */ + int int816_mode; /* who now uses IRQ - 1=AI1 int, 2=AI1 dma, 3=AI3 int, 4AI3 dma */ + struct comedi_subdevice *last_int_sub; /* ptr to subdevice which now finish */ + int ai_act_scan; /* how many scans we finished */ + unsigned int ai_act_chanlist[16]; /* MUX setting for actual AI operations */ + unsigned int ai_act_chanlist_len; /* how long is actual MUX list */ + unsigned int ai_act_chanlist_pos; /* actual position in MUX list */ + unsigned int ai_poll_ptr; /* how many sampes transfer poll */ + struct comedi_subdevice *sub_ai; /* ptr to AI subdevice */ #ifdef unused - struct timer_list rtc_irq_timer; // timer for RTC sanity check - unsigned long rtc_freq; // RTC int freq + struct timer_list rtc_irq_timer; /* timer for RTC sanity check */ + unsigned long rtc_freq; /* RTC int freq */ #endif }; @@ -237,12 +237,12 @@ static int pcl816_ai_insn_read(struct comedi_device * dev, struct comedi_subdevi int timeout; DPRINTK("mode 0 analog input\n"); - // software trigger, DMA and INT off + /* software trigger, DMA and INT off */ outb(0, dev->iobase + PCL816_CONTROL); - // clear INT (conversion end) flag + /* clear INT (conversion end) flag */ outb(0, dev->iobase + PCL816_CLRINT); - // Set the input channel + /* Set the input channel */ outb(CR_CHAN(insn->chanspec) & 0xf, dev->iobase + PCL816_MUX); outb(CR_RANGE(insn->chanspec), dev->iobase + PCL816_RANGE); /* select gain */ @@ -254,7 +254,7 @@ static int pcl816_ai_insn_read(struct comedi_device * dev, struct comedi_subdevi while (timeout--) { if (!(inb(dev->iobase + PCL816_STATUS) & PCL816_STATUS_DRDY_MASK)) { - // return read value + /* return read value */ data[n] = ((inb(dev->iobase + PCL816_AD_HI) << 8) | @@ -265,7 +265,7 @@ static int pcl816_ai_insn_read(struct comedi_device * dev, struct comedi_subdevi } comedi_udelay(1); } - // Return timeout error + /* Return timeout error */ if (!timeout) { comedi_error(dev, "A/D insn timeout\n"); data[0] = 0; @@ -295,7 +295,7 @@ static irqreturn_t interrupt_pcl816_ai_mode13_int(int irq, void *d) break; comedi_udelay(1); } - if (!timeout) { // timeout, bail error + if (!timeout) { /* timeout, bail error */ outb(0, dev->iobase + PCL816_CLRINT); /* clear INT request */ comedi_error(dev, "A/D mode1/3 IRQ without DRDY!"); pcl816_ai_cancel(dev, s); @@ -305,7 +305,7 @@ static irqreturn_t interrupt_pcl816_ai_mode13_int(int irq, void *d) } - // get the sample + /* get the sample */ low = inb(dev->iobase + PCL816_AD_LO); hi = inb(dev->iobase + PCL816_AD_HI); @@ -352,7 +352,7 @@ static void transfer_from_dma_buf(struct comedi_device * dev, struct comedi_subd } if (!devpriv->ai_neverending) - if (devpriv->ai_act_scan >= devpriv->ai_scans) { // all data sampled + if (devpriv->ai_act_scan >= devpriv->ai_scans) { /* all data sampled */ pcl816_ai_cancel(dev, s); s->async->events |= COMEDI_CB_EOA; s->async->events |= COMEDI_CB_BLOCK; @@ -374,12 +374,12 @@ static irqreturn_t interrupt_pcl816_ai_mode13_dma(int irq, void *d) disable_dma(devpriv->dma); this_dma_buf = devpriv->next_dma_buf; - if ((devpriv->dma_runs_to_end > -1) || devpriv->ai_neverending) { // switch dma bufs + if ((devpriv->dma_runs_to_end > -1) || devpriv->ai_neverending) { /* switch dma bufs */ devpriv->next_dma_buf = 1 - devpriv->next_dma_buf; set_dma_mode(devpriv->dma, DMA_MODE_READ); dma_flags = claim_dma_lock(); -// clear_dma_ff (devpriv->dma); +/* clear_dma_ff (devpriv->dma); */ set_dma_addr(devpriv->dma, devpriv->hwdmaptr[devpriv->next_dma_buf]); if (devpriv->dma_runs_to_end) { @@ -409,7 +409,7 @@ static irqreturn_t interrupt_pcl816_ai_mode13_dma(int irq, void *d) ============================================================================== INT procedure */ -static irqreturn_t interrupt_pcl816(int irq, void *d PT_REGS_ARG) +static irqreturn_t interrupt_pcl816(int irq, void *d) { struct comedi_device *dev = d; DPRINTK("<I>"); @@ -433,7 +433,7 @@ static irqreturn_t interrupt_pcl816(int irq, void *d PT_REGS_ARG) (!devpriv->int816_mode)) { if (devpriv->irq_was_now_closed) { devpriv->irq_was_now_closed = 0; - // comedi_error(dev,"last IRQ.."); + /* comedi_error(dev,"last IRQ.."); */ return IRQ_HANDLED; } comedi_error(dev, "bad IRQ!"); @@ -610,7 +610,7 @@ static int pcl816_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s return -EINVAL; if (cmd->scan_end_arg != cmd->chanlist_len) return -EINVAL; -// if(cmd->chanlist_len>MAX_CHANLIST_LEN) return -EINVAL; +/* if(cmd->chanlist_len>MAX_CHANLIST_LEN) return -EINVAL; */ if (devpriv->irq_blocked) return -EBUSY; @@ -621,7 +621,7 @@ static int pcl816_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s i8253_cascade_ns_to_timer(this_board->i8254_osc_base, &divisor1, &divisor2, &cmd->convert_arg, cmd->flags & TRIG_ROUND_MASK); - if (divisor1 == 1) { // PCL816 crash if any divisor is set to 1 + if (divisor1 == 1) { /* PCL816 crash if any divisor is set to 1 */ divisor1 = 2; divisor2 /= 2; } @@ -631,7 +631,7 @@ static int pcl816_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s } } - start_pacer(dev, -1, 0, 0); // stop pacer + start_pacer(dev, -1, 0, 0); /* stop pacer */ if (!check_and_setup_channel_list(dev, s, cmd->chanlist, cmd->chanlist_len)) @@ -652,19 +652,19 @@ static int pcl816_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s devpriv->ai_neverending = 1; } - if ((cmd->flags & TRIG_WAKE_EOS)) { // don't we want wake up every scan? + if ((cmd->flags & TRIG_WAKE_EOS)) { /* don't we want wake up every scan? */ printk("pl816: You wankt WAKE_EOS but I dont want handle it"); - // devpriv->ai_eos=1; - //if (devpriv->ai_n_chan==1) - // devpriv->dma=0; // DMA is useless for this situation + /* devpriv->ai_eos=1; */ + /* if (devpriv->ai_n_chan==1) */ + /* devpriv->dma=0; // DMA is useless for this situation */ } if (devpriv->dma) { bytes = devpriv->hwdmasize[0]; if (!devpriv->ai_neverending) { - bytes = s->async->cmd.chanlist_len * s->async->cmd.chanlist_len * sizeof(short); // how many - devpriv->dma_runs_to_end = bytes / devpriv->hwdmasize[0]; // how many DMA pages we must fill - devpriv->last_dma_run = bytes % devpriv->hwdmasize[0]; //on last dma transfer must be moved + bytes = s->async->cmd.chanlist_len * s->async->cmd.chanlist_len * sizeof(short); /* how many */ + devpriv->dma_runs_to_end = bytes / devpriv->hwdmasize[0]; /* how many DMA pages we must fill */ + devpriv->last_dma_run = bytes % devpriv->hwdmasize[0]; /* on last dma transfer must be moved */ devpriv->dma_runs_to_end--; if (devpriv->dma_runs_to_end >= 0) bytes = devpriv->hwdmasize[0]; @@ -687,14 +687,14 @@ static int pcl816_ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s switch (cmd->convert_src) { case TRIG_TIMER: devpriv->int816_mode = INT_TYPE_AI1_DMA; - outb(0x32, dev->iobase + PCL816_CONTROL); // Pacer+IRQ+DMA - outb(dmairq, dev->iobase + PCL816_STATUS); // write irq and DMA to card + outb(0x32, dev->iobase + PCL816_CONTROL); /* Pacer+IRQ+DMA */ + outb(dmairq, dev->iobase + PCL816_STATUS); /* write irq and DMA to card */ break; default: devpriv->int816_mode = INT_TYPE_AI3_DMA; - outb(0x34, dev->iobase + PCL816_CONTROL); // Ext trig+IRQ+DMA - outb(dmairq, dev->iobase + PCL816_STATUS); // write irq to card + outb(0x34, dev->iobase + PCL816_CONTROL); /* Ext trig+IRQ+DMA */ + outb(dmairq, dev->iobase + PCL816_STATUS); /* write irq to card */ break; } @@ -708,12 +708,12 @@ static int pcl816_ai_poll(struct comedi_device * dev, struct comedi_subdevice * unsigned int top1, top2, i; if (!devpriv->dma) - return 0; // poll is valid only for DMA transfer + return 0; /* poll is valid only for DMA transfer */ comedi_spin_lock_irqsave(&dev->spinlock, flags); for (i = 0; i < 20; i++) { - top1 = get_dma_residue(devpriv->dma); // where is now DMA + top1 = get_dma_residue(devpriv->dma); /* where is now DMA */ top2 = get_dma_residue(devpriv->dma); if (top1 == top2) break; @@ -723,10 +723,10 @@ static int pcl816_ai_poll(struct comedi_device * dev, struct comedi_subdevice * return 0; } - top1 = devpriv->hwdmasize[0] - top1; // where is now DMA in buffer - top1 >>= 1; // sample position + top1 = devpriv->hwdmasize[0] - top1; /* where is now DMA in buffer */ + top1 >>= 1; /* sample position */ top2 = top1 - devpriv->ai_poll_ptr; - if (top2 < 1) { // no new samples + if (top2 < 1) { /* no new samples */ comedi_spin_unlock_irqrestore(&dev->spinlock, flags); return 0; } @@ -735,7 +735,7 @@ static int pcl816_ai_poll(struct comedi_device * dev, struct comedi_subdevice * (short *) devpriv->dmabuf[devpriv->next_dma_buf], devpriv->ai_poll_ptr, top2); - devpriv->ai_poll_ptr = top1; // new buffer position + devpriv->ai_poll_ptr = top1; /* new buffer position */ comedi_spin_unlock_irqrestore(&dev->spinlock, flags); return s->async->buf_write_count - s->async->buf_read_count; @@ -747,14 +747,14 @@ static int pcl816_ai_poll(struct comedi_device * dev, struct comedi_subdevice * */ static int pcl816_ai_cancel(struct comedi_device * dev, struct comedi_subdevice * s) { -// DEBUG(rt_printk("pcl816_ai_cancel()\n");) +/* DEBUG(rt_printk("pcl816_ai_cancel()\n");) */ if (devpriv->irq_blocked > 0) { switch (devpriv->int816_mode) { #ifdef unused case INT_TYPE_AI1_DMA_RTC: case INT_TYPE_AI3_DMA_RTC: - set_rtc_irq_bit(0); // stop RTC + set_rtc_irq_bit(0); /* stop RTC */ del_timer(&devpriv->rtc_irq_timer); #endif case INT_TYPE_AI1_DMA: @@ -776,7 +776,7 @@ static int pcl816_ai_cancel(struct comedi_device * dev, struct comedi_subdevice devpriv->irq_was_now_closed = devpriv->int816_mode; devpriv->int816_mode = 0; devpriv->last_int_sub = s; -// s->busy = 0; +/* s->busy = 0; */ break; } } @@ -795,18 +795,18 @@ static int pcl816_check(unsigned long iobase) outb(0x00, iobase + PCL816_MUX); comedi_udelay(1); if (inb(iobase + PCL816_MUX) != 0x00) - return 1; //there isn't card + return 1; /* there isn't card */ outb(0x55, iobase + PCL816_MUX); comedi_udelay(1); if (inb(iobase + PCL816_MUX) != 0x55) - return 1; //there isn't card + return 1; /* there isn't card */ outb(0x00, iobase + PCL816_MUX); comedi_udelay(1); outb(0x18, iobase + PCL816_CONTROL); comedi_udelay(1); if (inb(iobase + PCL816_CONTROL) != 0x18) - return 1; //there isn't card - return 0; // ok, card exist + return 1; /* there isn't card */ + return 0; /* ok, card exist */ } /* @@ -815,12 +815,12 @@ static int pcl816_check(unsigned long iobase) */ static void pcl816_reset(struct comedi_device * dev) { -// outb (0, dev->iobase + PCL818_DA_LO); // DAC=0V -// outb (0, dev->iobase + PCL818_DA_HI); -// comedi_udelay (1); -// outb (0, dev->iobase + PCL818_DO_HI); // DO=$0000 -// outb (0, dev->iobase + PCL818_DO_LO); -// comedi_udelay (1); +/* outb (0, dev->iobase + PCL818_DA_LO); DAC=0V */ +/* outb (0, dev->iobase + PCL818_DA_HI); */ +/* comedi_udelay (1); */ +/* outb (0, dev->iobase + PCL818_DO_HI); DO=$0000 */ +/* outb (0, dev->iobase + PCL818_DO_LO); */ +/* comedi_udelay (1); */ outb(0, dev->iobase + PCL816_CONTROL); outb(0, dev->iobase + PCL816_MUX); outb(0, dev->iobase + PCL816_CLRINT); @@ -842,8 +842,8 @@ start_pacer(struct comedi_device * dev, int mode, unsigned int divisor1, outb(0xff, dev->iobase + PCL816_CTR0); outb(0x00, dev->iobase + PCL816_CTR0); comedi_udelay(1); - outb(0xb4, dev->iobase + PCL816_CTRCTL); // set counter 2 as mode 3 - outb(0x74, dev->iobase + PCL816_CTRCTL); // set counter 1 as mode 3 + outb(0xb4, dev->iobase + PCL816_CTRCTL); /* set counter 2 as mode 3 */ + outb(0x74, dev->iobase + PCL816_CTRCTL); /* set counter 1 as mode 3 */ comedi_udelay(1); if (mode == 1) { @@ -856,7 +856,7 @@ start_pacer(struct comedi_device * dev, int mode, unsigned int divisor1, } /* clear pending interrupts (just in case) */ -// outb(0, dev->iobase + PCL816_CLRINT); +/* outb(0, dev->iobase + PCL816_CLRINT); */ } /* @@ -871,35 +871,35 @@ check_and_setup_channel_list(struct comedi_device * dev, struct comedi_subdevice unsigned int chansegment[16]; unsigned int i, nowmustbechan, seglen, segpos; - // correct channel and range number check itself comedi/range.c + /* correct channel and range number check itself comedi/range.c */ if (chanlen < 1) { comedi_error(dev, "range/channel list is empty!"); return 0; } if (chanlen > 1) { - chansegment[0] = chanlist[0]; // first channel is everytime ok + chansegment[0] = chanlist[0]; /* first channel is everytime ok */ for (i = 1, seglen = 1; i < chanlen; i++, seglen++) { - // build part of chanlist + /* build part of chanlist */ DEBUG(rt_printk("%d. %d %d\n", i, CR_CHAN(chanlist[i]), CR_RANGE(chanlist[i])); ) if (chanlist[0] == chanlist[i]) - break; // we detect loop, this must by finish + break; /* we detect loop, this must by finish */ nowmustbechan = (CR_CHAN(chansegment[i - 1]) + 1) % chanlen; if (nowmustbechan != CR_CHAN(chanlist[i])) { - // channel list isn't continous :-( + /* channel list isn't continous :-( */ rt_printk ("comedi%d: pcl816: channel list must be continous! chanlist[%i]=%d but must be %d or %d!\n", dev->minor, i, CR_CHAN(chanlist[i]), nowmustbechan, CR_CHAN(chanlist[0])); return 0; } - chansegment[i] = chanlist[i]; // well, this is next correct channel in list + chansegment[i] = chanlist[i]; /* well, this is next correct channel in list */ } - for (i = 0, segpos = 0; i < chanlen; i++) { // check whole chanlist + for (i = 0, segpos = 0; i < chanlen; i++) { /* check whole chanlist */ DEBUG(rt_printk("%d %d=%d %d\n", CR_CHAN(chansegment[i % seglen]), CR_RANGE(chansegment[i % seglen]), @@ -915,7 +915,7 @@ check_and_setup_channel_list(struct comedi_device * dev, struct comedi_subdevice CR_CHAN(chanlist[i % seglen]), CR_RANGE(chanlist[i % seglen]), CR_AREF(chansegment[i % seglen])); - return 0; // chan/gain list is strange + return 0; /* chan/gain list is strange */ } } } else { @@ -925,7 +925,7 @@ check_and_setup_channel_list(struct comedi_device * dev, struct comedi_subdevice devpriv->ai_act_chanlist_len = seglen; devpriv->ai_act_chanlist_pos = 0; - for (i = 0; i < seglen; i++) { // store range list to card + for (i = 0; i < seglen; i++) { /* store range list to card */ devpriv->ai_act_chanlist[i] = CR_CHAN(chanlist[i]); outb(CR_CHAN(chanlist[0]) & 0xf, dev->iobase + PCL816_MUX); outb(CR_RANGE(chanlist[0]), dev->iobase + PCL816_RANGE); /* select gain */ @@ -935,7 +935,7 @@ check_and_setup_channel_list(struct comedi_device * dev, struct comedi_subdevice outb(devpriv->ai_act_chanlist[0] | (devpriv->ai_act_chanlist[seglen - 1] << 4), dev->iobase + PCL816_MUX); /* select channel interval to scan */ - return 1; // we can serve this with MUX logic + return 1; /* we can serve this with MUX logic */ } #ifdef unused @@ -981,7 +981,7 @@ static int set_rtc_irq_bit(unsigned char bit) */ static void free_resources(struct comedi_device * dev) { - //rt_printk("free_resource()\n"); + /* rt_printk("free_resource()\n"); */ if (dev->private) { pcl816_ai_cancel(dev, devpriv->sub_ai); pcl816_reset(dev); @@ -1006,7 +1006,7 @@ static void free_resources(struct comedi_device * dev) free_irq(dev->irq, dev); if (dev->iobase) release_region(dev->iobase, this_board->io_range); - //rt_printk("free_resource() end\n"); + /* rt_printk("free_resource() end\n"); */ } /* @@ -1021,7 +1021,7 @@ static int pcl816_attach(struct comedi_device * dev, struct comedi_devconfig * i unsigned long iobase; unsigned int irq, dma; unsigned long pages; - //int i; + /* int i; */ struct comedi_subdevice *s; /* claim our I/O space */ @@ -1084,7 +1084,7 @@ static int pcl816_attach(struct comedi_device * dev, struct comedi_devconfig * i #ifdef unused /* grab RTC for DMA operations */ devpriv->dma_rtc = 0; - if (it->options[2] > 0) { // we want to use DMA + if (it->options[2] > 0) { /* we want to use DMA */ if (RTC_lock == 0) { if (!request_region(RTC_PORT(0), RTC_IO_EXTENT, "pcl816 (RTC)")) @@ -1152,9 +1152,9 @@ static int pcl816_attach(struct comedi_device * dev, struct comedi_devconfig * i devpriv->dmapages[0] = pages; devpriv->hwdmaptr[0] = virt_to_bus((void *)devpriv->dmabuf[0]); devpriv->hwdmasize[0] = (1 << pages) * PAGE_SIZE; - //rt_printk("%d %d %ld, ",devpriv->dmapages[0],devpriv->hwdmasize[0],PAGE_SIZE); + /* rt_printk("%d %d %ld, ",devpriv->dmapages[0],devpriv->hwdmasize[0],PAGE_SIZE); */ - if (devpriv->dma_rtc == 0) { // we must do duble buff :-( + if (devpriv->dma_rtc == 0) { /* we must do duble buff :-( */ devpriv->dmabuf[1] = __get_dma_pages(GFP_KERNEL, pages); if (!devpriv->dmabuf[1]) { rt_printk @@ -1188,7 +1188,7 @@ static int pcl816_attach(struct comedi_device * dev, struct comedi_devconfig * i s->subdev_flags = SDF_READABLE | SDF_CMD_READ; s->n_chan = this_board->n_aichan; s->subdev_flags |= SDF_DIFF; - //printk (", %dchans DIFF DAC - %d", s->n_chan, i); + /* printk (", %dchans DIFF DAC - %d", s->n_chan, i); */ s->maxdata = this_board->ai_maxdata; s->len_chanlist = this_board->ai_chanlist; s->range_table = this_board->ai_range_type; diff --git a/drivers/staging/comedi/drivers/pcl818.c b/drivers/staging/comedi/drivers/pcl818.c index 43a9d56c6a43..495f802c39ac 100644 --- a/drivers/staging/comedi/drivers/pcl818.c +++ b/drivers/staging/comedi/drivers/pcl818.c @@ -107,9 +107,9 @@ A word or two about DMA. Driver support DMA operations at two ways: #include "8253.h" -// #define PCL818_MODE13_AO 1 +/* #define PCL818_MODE13_AO 1 */ -// boards constants +/* boards constants */ #define boardPCL818L 0 #define boardPCL818H 1 @@ -118,60 +118,60 @@ A word or two about DMA. Driver support DMA operations at two ways: #define boardPCL818 4 #define boardPCL718 5 -// IO space len +/* IO space len */ #define PCLx1x_RANGE 16 -// IO space len if we use FIFO +/* IO space len if we use FIFO */ #define PCLx1xFIFO_RANGE 32 -// W: clear INT request +/* W: clear INT request */ #define PCL818_CLRINT 8 -// R: return status byte +/* R: return status byte */ #define PCL818_STATUS 8 -// R: A/D high byte W: A/D range control +/* R: A/D high byte W: A/D range control */ #define PCL818_RANGE 1 -// R: next mux scan channel W: mux scan channel & range control pointer +/* R: next mux scan channel W: mux scan channel & range control pointer */ #define PCL818_MUX 2 -// R/W: operation control register +/* R/W: operation control register */ #define PCL818_CONTROL 9 -// W: counter enable +/* W: counter enable */ #define PCL818_CNTENABLE 10 -// R: low byte of A/D W: soft A/D trigger +/* R: low byte of A/D W: soft A/D trigger */ #define PCL818_AD_LO 0 -// R: high byte of A/D W: A/D range control +/* R: high byte of A/D W: A/D range control */ #define PCL818_AD_HI 1 -// W: D/A low&high byte +/* W: D/A low&high byte */ #define PCL818_DA_LO 4 #define PCL818_DA_HI 5 -// R: low&high byte of DI +/* R: low&high byte of DI */ #define PCL818_DI_LO 3 #define PCL818_DI_HI 11 -// W: low&high byte of DO +/* W: low&high byte of DO */ #define PCL818_DO_LO 3 #define PCL818_DO_HI 11 -// W: PCL718 second D/A +/* W: PCL718 second D/A */ #define PCL718_DA2_LO 6 #define PCL718_DA2_HI 7 -// counters +/* counters */ #define PCL818_CTR0 12 #define PCL818_CTR1 13 #define PCL818_CTR2 14 -// W: counter control +/* W: counter control */ #define PCL818_CTRCTL 15 -// W: fifo enable/disable +/* W: fifo enable/disable */ #define PCL818_FI_ENABLE 6 -// W: fifo interrupt clear +/* W: fifo interrupt clear */ #define PCL818_FI_INTCLR 20 -// W: fifo interrupt clear +/* W: fifo interrupt clear */ #define PCL818_FI_FLUSH 25 -// R: fifo status +/* R: fifo status */ #define PCL818_FI_STATUS 25 -// R: one record from FIFO +/* R: one record from FIFO */ #define PCL818_FI_DATALO 23 #define PCL818_FI_DATAHI 23 -// type of interrupt handler +/* type of interrupt handler */ #define INT_TYPE_AI1_INT 1 #define INT_TYPE_AI1_DMA 2 #define INT_TYPE_AI1_FIFO 3 @@ -184,7 +184,7 @@ A word or two about DMA. Driver support DMA operations at two ways: #endif #ifdef unused -// RTC stuff... +/* RTC stuff... */ #define INT_TYPE_AI1_DMA_RTC 9 #define INT_TYPE_AI3_DMA_RTC 10 @@ -254,22 +254,22 @@ static int RTC_timer_lock = 0; /* RTC int lock */ struct pcl818_board { - const char *name; // driver name - int n_ranges; // len of range list - int n_aichan_se; // num of A/D chans in single ended mode - int n_aichan_diff; // num of A/D chans in diferencial mode - unsigned int ns_min; // minimal alllowed delay between samples (in ns) - int n_aochan; // num of D/A chans - int n_dichan; // num of DI chans - int n_dochan; // num of DO chans - const struct comedi_lrange *ai_range_type; // default A/D rangelist - const struct comedi_lrange *ao_range_type; // default D/A rangelist - unsigned int io_range; // len of IO space - unsigned int IRQbits; // allowed interrupts - unsigned int DMAbits; // allowed DMA chans - int ai_maxdata; // maxdata for A/D - int ao_maxdata; // maxdata for D/A - unsigned char fifo; // 1=board has FIFO + const char *name; /* driver name */ + int n_ranges; /* len of range list */ + int n_aichan_se; /* num of A/D chans in single ended mode */ + int n_aichan_diff; /* num of A/D chans in diferencial mode */ + unsigned int ns_min; /* minimal alllowed delay between samples (in ns) */ + int n_aochan; /* num of D/A chans */ + int n_dichan; /* num of DI chans */ + int n_dochan; /* num of DO chans */ + const struct comedi_lrange *ai_range_type; /* default A/D rangelist */ + const struct comedi_lrange *ao_range_type; /* default D/A rangelist */ + unsigned int io_range; /* len of IO space */ + unsigned int IRQbits; /* allowed interrupts */ + unsigned int DMAbits; /* allowed DMA chans */ + int ai_maxdata; /* maxdata for A/D */ + int ao_maxdata; /* maxdata for D/A */ + unsigned char fifo; /* 1=board has FIFO */ int is_818; }; @@ -315,54 +315,54 @@ COMEDI_INITCLEANUP(driver_pcl818); struct pcl818_private { - unsigned int dma; // used DMA, 0=don't use DMA - int dma_rtc; // 1=RTC used with DMA, 0=no RTC alloc + unsigned int dma; /* used DMA, 0=don't use DMA */ + int dma_rtc; /* 1=RTC used with DMA, 0=no RTC alloc */ unsigned int io_range; #ifdef unused - unsigned long rtc_iobase; // RTC port region + unsigned long rtc_iobase; /* RTC port region */ unsigned int rtc_iosize; unsigned int rtc_irq; - struct timer_list rtc_irq_timer; // timer for RTC sanity check - unsigned long rtc_freq; // RTC int freq - int rtc_irq_blocked; // 1=we now do AI with DMA&RTC + struct timer_list rtc_irq_timer; /* timer for RTC sanity check */ + unsigned long rtc_freq; /* RTC int freq */ + int rtc_irq_blocked; /* 1=we now do AI with DMA&RTC */ #endif - unsigned long dmabuf[2]; // pointers to begin of DMA buffers - unsigned int dmapages[2]; // len of DMA buffers in PAGE_SIZEs - unsigned int hwdmaptr[2]; // hardware address of DMA buffers - unsigned int hwdmasize[2]; // len of DMA buffers in Bytes - unsigned int dmasamplsize; // size in samples hwdmasize[0]/2 - unsigned int last_top_dma; // DMA pointer in last RTC int - int next_dma_buf; // which DMA buffer will be used next round - long dma_runs_to_end; // how many we must permorm DMA transfer to end of record - unsigned long last_dma_run; // how many bytes we must transfer on last DMA page - unsigned char neverending_ai; // if=1, then we do neverending record (you must use cancel()) - unsigned int ns_min; // manimal alllowed delay between samples (in us) for actual card - int i8253_osc_base; // 1/frequency of on board oscilator in ns - int irq_free; // 1=have allocated IRQ - int irq_blocked; // 1=IRQ now uses any subdev - int irq_was_now_closed; // when IRQ finish, there's stored int818_mode for last interrupt - int ai_mode; // who now uses IRQ - 1=AI1 int, 2=AI1 dma, 3=AI3 int, 4AI3 dma - struct comedi_subdevice *last_int_sub; // ptr to subdevice which now finish - int ai_act_scan; // how many scans we finished - int ai_act_chan; // actual position in actual scan - unsigned int act_chanlist[16]; // MUX setting for actual AI operations - unsigned int act_chanlist_len; // how long is actual MUX list - unsigned int act_chanlist_pos; // actual position in MUX list - unsigned int ai_scans; // len of scanlist - unsigned int ai_n_chan; // how many channels is measured - unsigned int *ai_chanlist; // actaul chanlist - unsigned int ai_flags; // flaglist - unsigned int ai_data_len; // len of data buffer - short *ai_data; // data buffer - unsigned int ai_timer1; // timers + unsigned long dmabuf[2]; /* pointers to begin of DMA buffers */ + unsigned int dmapages[2]; /* len of DMA buffers in PAGE_SIZEs */ + unsigned int hwdmaptr[2]; /* hardware address of DMA buffers */ + unsigned int hwdmasize[2]; /* len of DMA buffers in Bytes */ + unsigned int dmasamplsize; /* size in samples hwdmasize[0]/2 */ + unsigned int last_top_dma; /* DMA pointer in last RTC int */ + int next_dma_buf; /* which DMA buffer will be used next round */ + long dma_runs_to_end; /* how many we must permorm DMA transfer to end of record */ + unsigned long last_dma_run; /* how many bytes we must transfer on last DMA page */ + unsigned char neverending_ai; /* if=1, then we do neverending record (you must use cancel()) */ + unsigned int ns_min; /* manimal alllowed delay between samples (in us) for actual card */ + int i8253_osc_base; /* 1/frequency of on board oscilator in ns */ + int irq_free; /* 1=have allocated IRQ */ + int irq_blocked; /* 1=IRQ now uses any subdev */ + int irq_was_now_closed; /* when IRQ finish, there's stored int818_mode for last interrupt */ + int ai_mode; /* who now uses IRQ - 1=AI1 int, 2=AI1 dma, 3=AI3 int, 4AI3 dma */ + struct comedi_subdevice *last_int_sub; /* ptr to subdevice which now finish */ + int ai_act_scan; /* how many scans we finished */ + int ai_act_chan; /* actual position in actual scan */ + unsigned int act_chanlist[16]; /* MUX setting for actual AI operations */ + unsigned int act_chanlist_len; /* how long is actual MUX list */ + unsigned int act_chanlist_pos; /* actual position in MUX list */ + unsigned int ai_scans; /* len of scanlist */ + unsigned int ai_n_chan; /* how many channels is measured */ + unsigned int *ai_chanlist; /* actaul chanlist */ + unsigned int ai_flags; /* flaglist */ + unsigned int ai_data_len; /* len of data buffer */ + short *ai_data; /* data buffer */ + unsigned int ai_timer1; /* timers */ unsigned int ai_timer2; - struct comedi_subdevice *sub_ai; // ptr to AI subdevice - unsigned char usefifo; // 1=use fifo + struct comedi_subdevice *sub_ai; /* ptr to AI subdevice */ + unsigned char usefifo; /* 1=use fifo */ unsigned int ao_readback[2]; }; -static const unsigned int muxonechan[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, // used for gain list programming +static const unsigned int muxonechan[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, /* used for gain list programming */ 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }; @@ -535,10 +535,10 @@ static irqreturn_t interrupt_pcl818_ai_mode13_int(int irq, void *d) conv_finish: low = inb(dev->iobase + PCL818_AD_LO); - comedi_buf_put(s->async, ((inb(dev->iobase + PCL818_AD_HI) << 4) | (low >> 4))); // get one sample + comedi_buf_put(s->async, ((inb(dev->iobase + PCL818_AD_HI) << 4) | (low >> 4))); /* get one sample */ outb(0, dev->iobase + PCL818_CLRINT); /* clear INT request */ - if ((low & 0xf) != devpriv->act_chanlist[devpriv->act_chanlist_pos]) { // dropout! + if ((low & 0xf) != devpriv->act_chanlist[devpriv->act_chanlist_pos]) { /* dropout! */ rt_printk ("comedi: A/D mode1/3 IRQ - channel dropout %x!=%x !\n", (low & 0xf), @@ -549,7 +549,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_int(int irq, void *d) return IRQ_HANDLED; } if (s->async->cur_chan == 0) { - // rt_printk("E"); + /* rt_printk("E"); */ devpriv->ai_act_scan--; } @@ -577,7 +577,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_dma(int irq, void *d) disable_dma(devpriv->dma); devpriv->next_dma_buf = 1 - devpriv->next_dma_buf; - if ((devpriv->dma_runs_to_end) > -1 || devpriv->neverending_ai) { // switch dma bufs + if ((devpriv->dma_runs_to_end) > -1 || devpriv->neverending_ai) { /* switch dma bufs */ set_dma_mode(devpriv->dma, DMA_MODE_READ); flags = claim_dma_lock(); set_dma_addr(devpriv->dma, @@ -601,7 +601,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_dma(int irq, void *d) bufptr = 0; for (i = 0; i < len; i++) { - if ((ptr[bufptr] & 0xf) != devpriv->act_chanlist[devpriv->act_chanlist_pos]) { // dropout! + if ((ptr[bufptr] & 0xf) != devpriv->act_chanlist[devpriv->act_chanlist_pos]) { /* dropout! */ rt_printk ("comedi: A/D mode1/3 DMA - channel dropout %d(card)!=%d(chanlist) at %d !\n", (ptr[bufptr] & 0xf), @@ -614,7 +614,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_dma(int irq, void *d) return IRQ_HANDLED; } - comedi_buf_put(s->async, ptr[bufptr++] >> 4); // get one sample + comedi_buf_put(s->async, ptr[bufptr++] >> 4); /* get one sample */ devpriv->act_chanlist_pos++; if (devpriv->act_chanlist_pos >= devpriv->act_chanlist_len) { @@ -627,7 +627,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_dma(int irq, void *d) pcl818_ai_cancel(dev, s); s->async->events |= COMEDI_CB_EOA; comedi_event(dev, s); - // printk("done int ai13 dma\n"); + /* printk("done int ai13 dma\n"); */ return IRQ_HANDLED; } } @@ -651,7 +651,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_dma_rtc(int irq, void *d) long ofs_dats; short *dmabuf = (short *) devpriv->dmabuf[0]; - //outb(2,0x378); + /* outb(2,0x378); */ switch (devpriv->ai_mode) { case INT_TYPE_AI1_DMA_RTC: case INT_TYPE_AI3_DMA_RTC: @@ -668,31 +668,31 @@ static irqreturn_t interrupt_pcl818_ai_mode13_dma_rtc(int irq, void *d) if (top1 != top2) return IRQ_HANDLED; - top1 = devpriv->hwdmasize[0] - top1; // where is now DMA in buffer + top1 = devpriv->hwdmasize[0] - top1; /* where is now DMA in buffer */ top1 >>= 1; - ofs_dats = top1 - devpriv->last_top_dma; // new samples from last call + ofs_dats = top1 - devpriv->last_top_dma; /* new samples from last call */ if (ofs_dats < 0) ofs_dats = (devpriv->dmasamplsize) + ofs_dats; if (!ofs_dats) - return IRQ_HANDLED; // exit=no new samples from last call - // obsluz data + return IRQ_HANDLED; /* exit=no new samples from last call */ + /* obsluz data */ i = devpriv->last_top_dma - 1; i &= (devpriv->dmasamplsize - 1); - if (dmabuf[i] != MAGIC_DMA_WORD) { // DMA overflow! + if (dmabuf[i] != MAGIC_DMA_WORD) { /* DMA overflow! */ comedi_error(dev, "A/D mode1/3 DMA buffer overflow!"); - //rt_printk("I %d dmabuf[i] %d %d\n",i,dmabuf[i],devpriv->dmasamplsize); + /* rt_printk("I %d dmabuf[i] %d %d\n",i,dmabuf[i],devpriv->dmasamplsize); */ pcl818_ai_cancel(dev, s); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; comedi_event(dev, s); return IRQ_HANDLED; } - //rt_printk("r %ld ",ofs_dats); + /* rt_printk("r %ld ",ofs_dats); */ bufptr = devpriv->last_top_dma; for (i = 0; i < ofs_dats; i++) { - if ((dmabuf[bufptr] & 0xf) != devpriv->act_chanlist[devpriv->act_chanlist_pos]) { // dropout! + if ((dmabuf[bufptr] & 0xf) != devpriv->act_chanlist[devpriv->act_chanlist_pos]) { /* dropout! */ rt_printk ("comedi: A/D mode1/3 DMA - channel dropout %d!=%d !\n", (dmabuf[bufptr] & 0xf), @@ -705,7 +705,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_dma_rtc(int irq, void *d) return IRQ_HANDLED; } - comedi_buf_put(s->async, dmabuf[bufptr++] >> 4); // get one sample + comedi_buf_put(s->async, dmabuf[bufptr++] >> 4); /* get one sample */ bufptr &= (devpriv->dmasamplsize - 1); if (s->async->cur_chan == 0) { @@ -717,7 +717,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_dma_rtc(int irq, void *d) pcl818_ai_cancel(dev, s); s->async->events |= COMEDI_CB_EOA; comedi_event(dev, s); - //printk("done int ai13 dma\n"); + /* printk("done int ai13 dma\n"); */ return IRQ_HANDLED; } } @@ -727,11 +727,11 @@ static irqreturn_t interrupt_pcl818_ai_mode13_dma_rtc(int irq, void *d) bufptr &= (devpriv->dmasamplsize - 1); dmabuf[bufptr] = MAGIC_DMA_WORD; comedi_event(dev, s); - //outb(0,0x378); + /* outb(0,0x378); */ return IRQ_HANDLED; } - //outb(0,0x378); + /* outb(0,0x378); */ return IRQ_HANDLED; } #endif @@ -746,7 +746,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_fifo(int irq, void *d) struct comedi_subdevice *s = dev->subdevices + 0; int i, len, lo; - outb(0, dev->iobase + PCL818_FI_INTCLR); // clear fifo int request + outb(0, dev->iobase + PCL818_FI_INTCLR); /* clear fifo int request */ lo = inb(dev->iobase + PCL818_FI_STATUS); @@ -774,7 +774,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_fifo(int irq, void *d) for (i = 0; i < len; i++) { lo = inb(dev->iobase + PCL818_FI_DATALO); - if ((lo & 0xf) != devpriv->act_chanlist[devpriv->act_chanlist_pos]) { // dropout! + if ((lo & 0xf) != devpriv->act_chanlist[devpriv->act_chanlist_pos]) { /* dropout! */ rt_printk ("comedi: A/D mode1/3 FIFO - channel dropout %d!=%d !\n", (lo & 0xf), @@ -786,7 +786,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_fifo(int irq, void *d) return IRQ_HANDLED; } - comedi_buf_put(s->async, (lo >> 4) | (inb(dev->iobase + PCL818_FI_DATAHI) << 4)); // get one sample + comedi_buf_put(s->async, (lo >> 4) | (inb(dev->iobase + PCL818_FI_DATAHI) << 4)); /* get one sample */ if (s->async->cur_chan == 0) { devpriv->ai_act_scan--; @@ -810,7 +810,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_fifo(int irq, void *d) ============================================================================== INT procedure */ -static irqreturn_t interrupt_pcl818(int irq, void *d PT_REGS_ARG) +static irqreturn_t interrupt_pcl818(int irq, void *d) { struct comedi_device *dev = d; @@ -818,7 +818,28 @@ static irqreturn_t interrupt_pcl818(int irq, void *d PT_REGS_ARG) comedi_error(dev, "premature interrupt"); return IRQ_HANDLED; } - //rt_printk("I\n"); + /* rt_printk("I\n"); */ + + if (devpriv->irq_blocked && devpriv->irq_was_now_closed) { + if ((devpriv->neverending_ai || (!devpriv->neverending_ai && + devpriv->ai_act_scan > 0)) && + (devpriv->ai_mode == INT_TYPE_AI1_DMA || + devpriv->ai_mode == INT_TYPE_AI3_DMA)) { + /* The cleanup from ai_cancel() has been delayed + until now because the card doesn't seem to like + being reprogrammed while a DMA transfer is in + progress. + */ + struct comedi_subdevice *s = dev->subdevices + 0; + devpriv->ai_act_scan = 0; + devpriv->neverending_ai = 0; + pcl818_ai_cancel(dev, s); + } + + outb(0, dev->iobase + PCL818_CLRINT); /* clear INT request */ + + return IRQ_HANDLED; + } switch (devpriv->ai_mode) { case INT_TYPE_AI1_DMA: @@ -843,25 +864,6 @@ static irqreturn_t interrupt_pcl818(int irq, void *d PT_REGS_ARG) if ((!dev->irq) || (!devpriv->irq_free) || (!devpriv->irq_blocked) || (!devpriv->ai_mode)) { - if (devpriv->irq_was_now_closed) { - if (devpriv->neverending_ai && - (devpriv->ai_mode == INT_TYPE_AI1_DMA - || devpriv->ai_mode == - INT_TYPE_AI3_DMA)) { - /* we had neverending ai but ai_cancel() has been called - the cleanup from ai_cancel() has been delayed until know - because the card doesn't seem to like being reprogrammed - while a DMA transfer is in progress - */ - struct comedi_subdevice *s = dev->subdevices + 0; - devpriv->ai_mode = devpriv->irq_was_now_closed; - devpriv->irq_was_now_closed = 0; - devpriv->neverending_ai = 0; - pcl818_ai_cancel(dev, s); - } - devpriv->irq_was_now_closed = 0; - return IRQ_HANDLED; - } comedi_error(dev, "bad IRQ!"); return IRQ_NONE; } @@ -881,12 +883,12 @@ static void pcl818_ai_mode13dma_int(int mode, struct comedi_device * dev, unsigned int bytes; rt_printk("mode13dma_int, mode: %d\n", mode); - disable_dma(devpriv->dma); // disable dma + disable_dma(devpriv->dma); /* disable dma */ bytes = devpriv->hwdmasize[0]; if (!devpriv->neverending_ai) { - bytes = devpriv->ai_n_chan * devpriv->ai_scans * sizeof(short); // how many - devpriv->dma_runs_to_end = bytes / devpriv->hwdmasize[0]; // how many DMA pages we must fiil - devpriv->last_dma_run = bytes % devpriv->hwdmasize[0]; //on last dma transfer must be moved + bytes = devpriv->ai_n_chan * devpriv->ai_scans * sizeof(short); /* how many */ + devpriv->dma_runs_to_end = bytes / devpriv->hwdmasize[0]; /* how many DMA pages we must fiil */ + devpriv->last_dma_run = bytes % devpriv->hwdmasize[0]; /* on last dma transfer must be moved */ devpriv->dma_runs_to_end--; if (devpriv->dma_runs_to_end >= 0) bytes = devpriv->hwdmasize[0]; @@ -928,7 +930,7 @@ static void pcl818_ai_mode13dma_rtc(int mode, struct comedi_device * dev, set_dma_count(devpriv->dma, devpriv->hwdmasize[0]); release_dma_lock(flags); enable_dma(devpriv->dma); - devpriv->last_top_dma = 0; //devpriv->hwdmasize[0]; + devpriv->last_top_dma = 0; /* devpriv->hwdmasize[0]; */ pole = (short *) devpriv->dmabuf[0]; devpriv->dmasamplsize = devpriv->hwdmasize[0] / 2; pole[devpriv->dmasamplsize - 1] = MAGIC_DMA_WORD; @@ -972,7 +974,7 @@ static int pcl818_ai_cmd_mode(int mode, struct comedi_device * dev, if (devpriv->irq_blocked) return -EBUSY; - start_pacer(dev, -1, 0, 0); // stop pacer + start_pacer(dev, -1, 0, 0); /* stop pacer */ seglen = check_channel_list(dev, s, devpriv->ai_chanlist, devpriv->ai_n_chan); @@ -992,7 +994,7 @@ static int pcl818_ai_cmd_mode(int mode, struct comedi_device * dev, devpriv->dma_runs_to_end = 0; if ((devpriv->ai_scans == 0) || (devpriv->ai_scans == -1)) - devpriv->neverending_ai = 1; //well, user want neverending + devpriv->neverending_ai = 1; /* well, user want neverending */ if (mode == 1) { i8253_cascade_ns_to_timer(devpriv->i8253_osc_base, &divisor1, @@ -1010,7 +1012,7 @@ static int pcl818_ai_cmd_mode(int mode, struct comedi_device * dev, outb(0, dev->iobase + PCL818_CNTENABLE); /* enable pacer */ switch (devpriv->dma) { - case 1: // DMA + case 1: /* DMA */ case 3: if (devpriv->dma_rtc == 0) { pcl818_ai_mode13dma_int(mode, dev, s); @@ -1025,26 +1027,32 @@ static int pcl818_ai_cmd_mode(int mode, struct comedi_device * dev, } #endif break; - case 0: // IRQ - // rt_printk("IRQ\n"); - if (mode == 1) { - devpriv->ai_mode = INT_TYPE_AI1_INT; - outb(0x83 | (dev->irq << 4), dev->iobase + PCL818_CONTROL); /* Pacer+IRQ */ - } else { - devpriv->ai_mode = INT_TYPE_AI3_INT; - outb(0x82 | (dev->irq << 4), dev->iobase + PCL818_CONTROL); /* Ext trig+IRQ */ - }; - break; - case -1: // FIFO - outb(1, dev->iobase + PCL818_FI_ENABLE); // enable FIFO - if (mode == 1) { - devpriv->ai_mode = INT_TYPE_AI1_FIFO; - outb(0x03, dev->iobase + PCL818_CONTROL); /* Pacer */ + case 0: + if (!devpriv->usefifo) { + /* IRQ */ + /* rt_printk("IRQ\n"); */ + if (mode == 1) { + devpriv->ai_mode = INT_TYPE_AI1_INT; + /* Pacer+IRQ */ + outb(0x83 | (dev->irq << 4), dev->iobase + PCL818_CONTROL); + } else { + devpriv->ai_mode = INT_TYPE_AI3_INT; + /* Ext trig+IRQ */ + outb(0x82 | (dev->irq << 4), dev->iobase + PCL818_CONTROL); + } } else { - devpriv->ai_mode = INT_TYPE_AI3_FIFO; - outb(0x02, dev->iobase + PCL818_CONTROL); - }; /* Ext trig */ - break; + /* FIFO */ + /* enable FIFO */ + outb(1, dev->iobase + PCL818_FI_ENABLE); + if (mode == 1) { + devpriv->ai_mode = INT_TYPE_AI1_FIFO; + /* Pacer */ + outb(0x03, dev->iobase + PCL818_CONTROL); + } else { + devpriv->ai_mode = INT_TYPE_AI3_FIFO; + outb(0x02, dev->iobase + PCL818_CONTROL); + } + } } start_pacer(dev, mode, divisor1, divisor2); @@ -1080,7 +1088,7 @@ static int pcl818_ao_mode13(int mode, struct comedi_device * dev, struct comedi_ if (devpriv->irq_blocked) return -EBUSY; - start_pacer(dev, -1, 0, 0); // stop pacer + start_pacer(dev, -1, 0, 0); /* stop pacer */ devpriv->int13_act_scan = it->n; devpriv->int13_act_chan = 0; @@ -1175,30 +1183,34 @@ static int check_channel_list(struct comedi_device * dev, struct comedi_subdevic } if (n_chan > 1) { - // first channel is everytime ok + /* first channel is everytime ok */ chansegment[0] = chanlist[0]; - // build part of chanlist + /* build part of chanlist */ for (i = 1, seglen = 1; i < n_chan; i++, seglen++) { - // rt_printk("%d. %d %d\n",i,CR_CHAN(it->chanlist[i]),CR_RANGE(it->chanlist[i])); - // we detect loop, this must by finish + + /* rt_printk("%d. %d * %d\n",i, + * CR_CHAN(it->chanlist[i]),CR_RANGE(it->chanlist[i]));*/ + + /* we detect loop, this must by finish */ + if (chanlist[0] == chanlist[i]) break; nowmustbechan = (CR_CHAN(chansegment[i - 1]) + 1) % s->n_chan; - if (nowmustbechan != CR_CHAN(chanlist[i])) { // channel list isn't continous :-( + if (nowmustbechan != CR_CHAN(chanlist[i])) { /* channel list isn't continous :-( */ rt_printk ("comedi%d: pcl818: channel list must be continous! chanlist[%i]=%d but must be %d or %d!\n", dev->minor, i, CR_CHAN(chanlist[i]), nowmustbechan, CR_CHAN(chanlist[0])); return 0; } - // well, this is next correct channel in list + /* well, this is next correct channel in list */ chansegment[i] = chanlist[i]; } - // check whole chanlist + /* check whole chanlist */ for (i = 0, segpos = 0; i < n_chan; i++) { - //rt_printk("%d %d=%d %d\n",CR_CHAN(chansegment[i%seglen]),CR_RANGE(chansegment[i%seglen]),CR_CHAN(it->chanlist[i]),CR_RANGE(it->chanlist[i])); + /* rt_printk("%d %d=%d %d\n",CR_CHAN(chansegment[i%seglen]),CR_RANGE(chansegment[i%seglen]),CR_CHAN(it->chanlist[i]),CR_RANGE(it->chanlist[i])); */ if (chanlist[i] != chansegment[i % seglen]) { rt_printk ("comedi%d: pcl818: bad channel or range number! chanlist[%i]=%d,%d,%d and not %d,%d,%d!\n", @@ -1208,7 +1220,7 @@ static int check_channel_list(struct comedi_device * dev, struct comedi_subdevic CR_CHAN(chanlist[i % seglen]), CR_RANGE(chanlist[i % seglen]), CR_AREF(chansegment[i % seglen])); - return 0; // chan/gain list is strange + return 0; /* chan/gain list is strange */ } } } else { @@ -1226,7 +1238,7 @@ static void setup_channel_list(struct comedi_device * dev, struct comedi_subdevi devpriv->act_chanlist_len = seglen; devpriv->act_chanlist_pos = 0; - for (i = 0; i < seglen; i++) { // store range list to card + for (i = 0; i < seglen; i++) { /* store range list to card */ devpriv->act_chanlist[i] = CR_CHAN(chanlist[i]); outb(muxonechan[CR_CHAN(chanlist[i])], dev->iobase + PCL818_MUX); /* select channel */ outb(CR_RANGE(chanlist[i]), dev->iobase + PCL818_RANGE); /* select gain */ @@ -1391,7 +1403,7 @@ static int ai_cmdtest(struct comedi_device * dev, struct comedi_subdevice * s, if (cmd->chanlist) { if (!check_channel_list(dev, s, cmd->chanlist, cmd->chanlist_len)) - return 5; // incorrect channels list + return 5; /* incorrect channels list */ } return 0; @@ -1420,14 +1432,14 @@ static int ai_cmd(struct comedi_device * dev, struct comedi_subdevice * s) devpriv->ai_scans = 0; } - if (cmd->scan_begin_src == TRIG_FOLLOW) { // mode 1, 3 - if (cmd->convert_src == TRIG_TIMER) { // mode 1 + if (cmd->scan_begin_src == TRIG_FOLLOW) { /* mode 1, 3 */ + if (cmd->convert_src == TRIG_TIMER) { /* mode 1 */ devpriv->ai_timer1 = cmd->convert_arg; retval = pcl818_ai_cmd_mode(1, dev, s); rt_printk("pcl818_ai_cmd() end\n"); return retval; } - if (cmd->convert_src == TRIG_EXT) { // mode 3 + if (cmd->convert_src == TRIG_EXT) { /* mode 3 */ return pcl818_ai_cmd_mode(3, dev, s); } } @@ -1443,19 +1455,20 @@ static int pcl818_ai_cancel(struct comedi_device * dev, struct comedi_subdevice { if (devpriv->irq_blocked > 0) { rt_printk("pcl818_ai_cancel()\n"); - devpriv->irq_was_now_closed = devpriv->ai_mode; - devpriv->ai_mode = 0; + devpriv->irq_was_now_closed = 1; - switch (devpriv->irq_was_now_closed) { + switch (devpriv->ai_mode) { #ifdef unused case INT_TYPE_AI1_DMA_RTC: case INT_TYPE_AI3_DMA_RTC: - set_rtc_irq_bit(0); // stop RTC + set_rtc_irq_bit(0); /* stop RTC */ del_timer(&devpriv->rtc_irq_timer); #endif case INT_TYPE_AI1_DMA: case INT_TYPE_AI3_DMA: - if (devpriv->neverending_ai) { + if (devpriv->neverending_ai || + (!devpriv->neverending_ai && + devpriv->ai_act_scan > 0)) { /* wait for running dma transfer to end, do cleanup in interrupt */ goto end; } @@ -1476,7 +1489,7 @@ static int pcl818_ai_cancel(struct comedi_device * dev, struct comedi_subdevice inb(dev->iobase + PCL818_AD_HI); outb(0, dev->iobase + PCL818_CLRINT); /* clear INT request */ outb(0, dev->iobase + PCL818_CONTROL); /* Stop A/D */ - if (devpriv->usefifo) { // FIFO shutdown + if (devpriv->usefifo) { /* FIFO shutdown */ outb(0, dev->iobase + PCL818_FI_INTCLR); outb(0, dev->iobase + PCL818_FI_FLUSH); outb(0, dev->iobase + PCL818_FI_ENABLE); @@ -1484,6 +1497,8 @@ static int pcl818_ai_cancel(struct comedi_device * dev, struct comedi_subdevice devpriv->irq_blocked = 0; devpriv->last_int_sub = s; devpriv->neverending_ai = 0; + devpriv->ai_mode = 0; + devpriv->irq_was_now_closed = 0; break; } } @@ -1502,18 +1517,18 @@ static int pcl818_check(unsigned long iobase) outb(0x00, iobase + PCL818_MUX); comedi_udelay(1); if (inb(iobase + PCL818_MUX) != 0x00) - return 1; //there isn't card + return 1; /* there isn't card */ outb(0x55, iobase + PCL818_MUX); comedi_udelay(1); if (inb(iobase + PCL818_MUX) != 0x55) - return 1; //there isn't card + return 1; /* there isn't card */ outb(0x00, iobase + PCL818_MUX); comedi_udelay(1); outb(0x18, iobase + PCL818_CONTROL); comedi_udelay(1); if (inb(iobase + PCL818_CONTROL) != 0x18) - return 1; //there isn't card - return 0; // ok, card exist + return 1; /* there isn't card */ + return 0; /* ok, card exist */ } /* @@ -1522,15 +1537,15 @@ static int pcl818_check(unsigned long iobase) */ static void pcl818_reset(struct comedi_device * dev) { - if (devpriv->usefifo) { // FIFO shutdown + if (devpriv->usefifo) { /* FIFO shutdown */ outb(0, dev->iobase + PCL818_FI_INTCLR); outb(0, dev->iobase + PCL818_FI_FLUSH); outb(0, dev->iobase + PCL818_FI_ENABLE); } - outb(0, dev->iobase + PCL818_DA_LO); // DAC=0V + outb(0, dev->iobase + PCL818_DA_LO); /* DAC=0V */ outb(0, dev->iobase + PCL818_DA_HI); comedi_udelay(1); - outb(0, dev->iobase + PCL818_DO_HI); // DO=$0000 + outb(0, dev->iobase + PCL818_DO_HI); /* DO=$0000 */ outb(0, dev->iobase + PCL818_DO_LO); comedi_udelay(1); outb(0, dev->iobase + PCL818_CONTROL); @@ -1643,7 +1658,7 @@ static int rtc_setfreq_irq(int freq) */ static void free_resources(struct comedi_device * dev) { - //rt_printk("free_resource()\n"); + /* rt_printk("free_resource()\n"); */ if (dev->private) { pcl818_ai_cancel(dev, devpriv->sub_ai); pcl818_reset(dev); @@ -1670,7 +1685,7 @@ static void free_resources(struct comedi_device * dev) free_irq(dev->irq, dev); if (dev->iobase) release_region(dev->iobase, devpriv->io_range); - //rt_printk("free_resource() end\n"); + /* rt_printk("free_resource() end\n"); */ } /* @@ -1683,7 +1698,8 @@ static int pcl818_attach(struct comedi_device * dev, struct comedi_devconfig * i { int ret; unsigned long iobase; - unsigned int irq, dma; + unsigned int irq; + int dma; unsigned long pages; struct comedi_subdevice *s; @@ -1695,7 +1711,7 @@ static int pcl818_attach(struct comedi_device * dev, struct comedi_devconfig * i printk("comedi%d: pcl818: board=%s, ioport=0x%03lx", dev->minor, this_board->name, iobase); devpriv->io_range = this_board->io_range; - if ((this_board->fifo) && (it->options[2] == -1)) { // we've board with FIFO and we want to use FIFO + if ((this_board->fifo) && (it->options[2] == -1)) { /* we've board with FIFO and we want to use FIFO */ devpriv->io_range = PCLx1xFIFO_RANGE; devpriv->usefifo = 1; } @@ -1750,7 +1766,7 @@ static int pcl818_attach(struct comedi_device * dev, struct comedi_devconfig * i #ifdef unused /* grab RTC for DMA operations */ devpriv->dma_rtc = 0; - if (it->options[2] > 0) { // we want to use DMA + if (it->options[2] > 0) { /* we want to use DMA */ if (RTC_lock == 0) { if (!request_region(RTC_PORT(0), RTC_IO_EXTENT, "pcl818 (RTC)")) @@ -1809,8 +1825,8 @@ static int pcl818_attach(struct comedi_device * dev, struct comedi_devconfig * i devpriv->dmapages[0] = pages; devpriv->hwdmaptr[0] = virt_to_bus((void *)devpriv->dmabuf[0]); devpriv->hwdmasize[0] = (1 << pages) * PAGE_SIZE; - //rt_printk("%d %d %ld, ",devpriv->dmapages[0],devpriv->hwdmasize[0],PAGE_SIZE); - if (devpriv->dma_rtc == 0) { // we must do duble buff :-( + /* rt_printk("%d %d %ld, ",devpriv->dmapages[0],devpriv->hwdmasize[0],PAGE_SIZE); */ + if (devpriv->dma_rtc == 0) { /* we must do duble buff :-( */ devpriv->dmabuf[1] = __get_dma_pages(GFP_KERNEL, pages); if (!devpriv->dmabuf[1]) { rt_printk @@ -1858,7 +1874,7 @@ static int pcl818_attach(struct comedi_device * dev, struct comedi_devconfig * i } if (this_board->is_818) { if ((it->options[4] == 1) || (it->options[4] == 10)) - s->range_table = &range_pcl818l_h_ai; // secondary range list jumper selectable + s->range_table = &range_pcl818l_h_ai; /* secondary range list jumper selectable */ } else { switch (it->options[4]) { case 0: @@ -1982,7 +1998,7 @@ static int pcl818_attach(struct comedi_device * dev, struct comedi_devconfig * i */ static int pcl818_detach(struct comedi_device * dev) { - // rt_printk("comedi%d: pcl818: remove\n", dev->minor); + /* rt_printk("comedi%d: pcl818: remove\n", dev->minor); */ free_resources(dev); return 0; } diff --git a/drivers/staging/comedi/drivers/pcm3724.c b/drivers/staging/comedi/drivers/pcm3724.c index a3ed3a0e855a..747882d7846f 100644 --- a/drivers/staging/comedi/drivers/pcm3724.c +++ b/drivers/staging/comedi/drivers/pcm3724.c @@ -66,14 +66,14 @@ static int pcm3724_attach(struct comedi_device * dev, struct comedi_devconfig * static int pcm3724_detach(struct comedi_device * dev); struct pcm3724_board { - const char *name; // driver name - int dio; // num of DIO - int numofports; // num of 8255 subdevices - unsigned int IRQbits; // allowed interrupts - unsigned int io_range; // len of IO space + const char *name; /* driver name */ + int dio; /* num of DIO */ + int numofports; /* num of 8255 subdevices */ + unsigned int IRQbits; /* allowed interrupts */ + unsigned int io_range; /* len of IO space */ }; -//used to track configured dios +/* used to track configured dios */ struct priv_pcm3724 { int dio_1; int dio_2; @@ -98,20 +98,20 @@ static struct comedi_driver driver_pcm3724 = { COMEDI_INITCLEANUP(driver_pcm3724); -// (setq c-basic-offset 8) +/* (setq c-basic-offset 8) */ static int subdev_8255_cb(int dir, int port, int data, unsigned long arg) { unsigned long iobase = arg; unsigned char inbres; - //printk("8255cb %d %d %d %lx\n", dir,port,data,arg); + /* printk("8255cb %d %d %d %lx\n", dir,port,data,arg); */ if (dir) { - //printk("8255 cb outb(%x, %lx)\n", data, iobase+port); + /* printk("8255 cb outb(%x, %lx)\n", data, iobase+port); */ outb(data, iobase + port); return 0; } else { inbres = inb(iobase + port); - //printk("8255 cb inb(%lx) = %x\n", iobase+port, inbres); + /* printk("8255 cb inb(%lx) = %x\n", iobase+port, inbres); */ return inbres; } } @@ -173,7 +173,7 @@ static void do_3724_config(struct comedi_device * dev, struct comedi_subdevice * port_8255_cfg = dev->iobase + SIZE_8255 + _8255_CR; } outb(buffer_config, dev->iobase + 8); /* update buffer register */ - //printk("pcm3724 buffer_config (%lx) %d, %x\n", dev->iobase + _8255_CR, chanspec, buffer_config); + /* printk("pcm3724 buffer_config (%lx) %d, %x\n", dev->iobase + _8255_CR, chanspec, buffer_config); */ outb(config, port_8255_cfg); } @@ -187,9 +187,9 @@ static void enable_chan(struct comedi_device * dev, struct comedi_subdevice * s, priv = (struct priv_pcm3724 *) (dev->private); mask = 1 << CR_CHAN(chanspec); - if (s == dev->subdevices) { // subdev 0 + if (s == dev->subdevices) { /* subdev 0 */ priv->dio_1 |= mask; - } else { //subdev 1 + } else { /* subdev 1 */ priv->dio_2 |= mask; } if (priv->dio_1 & 0xff0000) { @@ -210,7 +210,7 @@ static void enable_chan(struct comedi_device * dev, struct comedi_subdevice * s, if (priv->dio_2 & 0xff) { gatecfg |= GATE_A1; } - // printk("gate control %x\n", gatecfg); + /* printk("gate control %x\n", gatecfg); */ outb(gatecfg, dev->iobase + 9); } diff --git a/drivers/staging/comedi/drivers/pcm3730.c b/drivers/staging/comedi/drivers/pcm3730.c index 1de555fe645c..41983d03dabf 100644 --- a/drivers/staging/comedi/drivers/pcm3730.c +++ b/drivers/staging/comedi/drivers/pcm3730.c @@ -19,9 +19,9 @@ Configuration options: #include <linux/ioport.h> -#define PCM3730_SIZE 4 // consecutive io port addresses +#define PCM3730_SIZE 4 /* consecutive io port addresses */ -#define PCM3730_DOA 0 // offsets for each port +#define PCM3730_DOA 0 /* offsets for each port */ #define PCM3730_DOB 2 #define PCM3730_DOC 3 #define PCM3730_DIA 0 diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c index 01e40f1b5628..8c332c2f421a 100644 --- a/drivers/staging/comedi/drivers/pcmmio.c +++ b/drivers/staging/comedi/drivers/pcmmio.c @@ -300,7 +300,7 @@ static int pcmmio_dio_insn_bits(struct comedi_device * dev, struct comedi_subdev static int pcmmio_dio_insn_config(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data); -static irqreturn_t interrupt_pcmmio(int irq, void *d PT_REGS_ARG); +static irqreturn_t interrupt_pcmmio(int irq, void *d); static void pcmmio_stop_intr(struct comedi_device *, struct comedi_subdevice *); static int pcmmio_cancel(struct comedi_device * dev, struct comedi_subdevice * s); static int pcmmio_cmd(struct comedi_device * dev, struct comedi_subdevice * s); @@ -765,7 +765,7 @@ static void unlock_port(struct comedi_device * dev, int asic, int port) } #endif /* notused */ -static irqreturn_t interrupt_pcmmio(int irq, void *d PT_REGS_ARG) +static irqreturn_t interrupt_pcmmio(int irq, void *d) { int asic, got1 = 0; struct comedi_device *dev = (struct comedi_device *) d; diff --git a/drivers/staging/comedi/drivers/pcmuio.c b/drivers/staging/comedi/drivers/pcmuio.c index 4e7d8b6327fd..de9c13554ca1 100644 --- a/drivers/staging/comedi/drivers/pcmuio.c +++ b/drivers/staging/comedi/drivers/pcmuio.c @@ -258,7 +258,7 @@ static int pcmuio_dio_insn_bits(struct comedi_device * dev, struct comedi_subdev static int pcmuio_dio_insn_config(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data); -static irqreturn_t interrupt_pcmuio(int irq, void *d PT_REGS_ARG); +static irqreturn_t interrupt_pcmuio(int irq, void *d); static void pcmuio_stop_intr(struct comedi_device *, struct comedi_subdevice *); static int pcmuio_cancel(struct comedi_device * dev, struct comedi_subdevice * s); static int pcmuio_cmd(struct comedi_device * dev, struct comedi_subdevice * s); @@ -688,7 +688,7 @@ static void unlock_port(struct comedi_device * dev, int asic, int port) } #endif /* notused */ -static irqreturn_t interrupt_pcmuio(int irq, void *d PT_REGS_ARG) +static irqreturn_t interrupt_pcmuio(int irq, void *d) { int asic, got1 = 0; struct comedi_device *dev = (struct comedi_device *) d; diff --git a/drivers/staging/comedi/drivers/poc.c b/drivers/staging/comedi/drivers/poc.c index 8a0bf6854939..ca439ba5c01d 100644 --- a/drivers/staging/comedi/drivers/poc.c +++ b/drivers/staging/comedi/drivers/poc.c @@ -72,7 +72,7 @@ static const struct boarddef_struct boards[] = { { name: "dac02", iosize: 8, - //setup: dac02_setup, + /* setup: dac02_setup, */ type: COMEDI_SUBD_AO, n_chan: 2, n_bits: 12, @@ -196,7 +196,7 @@ static int dac02_ao_winsn(struct comedi_device * dev, struct comedi_subdevice * ((unsigned int *) dev->private)[chan] = data[0]; output = data[0]; #ifdef wrong - // convert to complementary binary if range is bipolar + /* convert to complementary binary if range is bipolar */ if ((CR_RANGE(insn->chanspec) & 0x2) == 0) output = ~output; #endif diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index 795c4522867f..d05f33bac4a1 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -262,7 +262,7 @@ static int daqp_ai_cancel(struct comedi_device * dev, struct comedi_subdevice * * which run pretty quick. */ -static void daqp_interrupt(int irq, void *dev_id PT_REGS_ARG) +static void daqp_interrupt(int irq, void *dev_id) { struct local_info_t *local = (struct local_info_t *) dev_id; struct comedi_device *dev; diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index ca347f21d140..700090dc2a88 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -706,7 +706,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s); static int rtd_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s); /* static int rtd_ai_poll (struct comedi_device *dev,struct comedi_subdevice *s); */ static int rtd_ns_to_timer(unsigned int *ns, int roundMode); -static irqreturn_t rtd_interrupt(int irq, void *d PT_REGS_ARG); +static irqreturn_t rtd_interrupt(int irq, void *d); static int rtd520_probe_fifo_depth(struct comedi_device *dev); /* @@ -1494,8 +1494,7 @@ static int ai_process_dma(struct comedi_device *dev, struct comedi_subdevice *s) The data conversion may someday happen in a "bottom half". */ static irqreturn_t rtd_interrupt(int irq, /* interrupt number (ignored) */ - void *d /* our data */ - PT_REGS_ARG) + void *d) /* our data */ { /* cpu context (ignored) */ struct comedi_device *dev = d; /* must be called "dev" for devpriv */ u16 status; diff --git a/drivers/staging/comedi/drivers/rti800.c b/drivers/staging/comedi/drivers/rti800.c index 334ac5773a13..14bb8d19353e 100644 --- a/drivers/staging/comedi/drivers/rti800.c +++ b/drivers/staging/comedi/drivers/rti800.c @@ -145,7 +145,7 @@ static struct comedi_driver driver_rti800 = { COMEDI_INITCLEANUP(driver_rti800); -static irqreturn_t rti800_interrupt(int irq, void *dev PT_REGS_ARG); +static irqreturn_t rti800_interrupt(int irq, void *dev); struct rti800_private { enum { @@ -172,12 +172,12 @@ struct rti800_private { #define RTI800_TIMEOUT 100 -static irqreturn_t rti800_interrupt(int irq, void *dev PT_REGS_ARG) +static irqreturn_t rti800_interrupt(int irq, void *dev) { return IRQ_HANDLED; } -// settling delay times in usec for different gains +/* settling delay times in usec for different gains */ static const int gaindelay[] = { 10, 20, 40, 80 }; static int rti800_ai_insn_read(struct comedi_device * dev, struct comedi_subdevice * s, diff --git a/drivers/staging/comedi/drivers/s526.c b/drivers/staging/comedi/drivers/s526.c index a7b6f711afca..e419a7c6943d 100644 --- a/drivers/staging/comedi/drivers/s526.c +++ b/drivers/staging/comedi/drivers/s526.c @@ -277,8 +277,8 @@ static int s526_attach(struct comedi_device * dev, struct comedi_devconfig * it) struct comedi_subdevice *s; int iobase; int i, n; -// short value; -// int subdev_channel = 0; +/* short value; */ +/* int subdev_channel = 0; */ printk("comedi%d: s526: ", dev->minor); @@ -334,12 +334,12 @@ static int s526_attach(struct comedi_device * dev, struct comedi_devconfig * it) /* Command are not implemented yet, however they are necessary to allocate the necessary memory for the comedi_async struct (used to trigger the GPCT in case of pulsegenerator function */ - //s->do_cmd = s526_gpct_cmd; - //s->do_cmdtest = s526_gpct_cmdtest; - //s->cancel = s526_gpct_cancel; + /* s->do_cmd = s526_gpct_cmd; */ + /* s->do_cmdtest = s526_gpct_cmdtest; */ + /* s->cancel = s526_gpct_cancel; */ s = dev->subdevices + 1; - //dev->read_subdev=s; + /* dev->read_subdev=s; */ /* analog input subdevice */ s->type = COMEDI_SUBD_AI; /* we support differential */ @@ -383,18 +383,18 @@ static int s526_attach(struct comedi_device * dev, struct comedi_devconfig * it) return 1; #if 0 - // Example of Counter Application - //One-shot (software trigger) - cmReg.reg.coutSource = 0; // out RCAP - cmReg.reg.coutPolarity = 1; // Polarity inverted - cmReg.reg.autoLoadResetRcap = 1; // Auto load 0:disabled, 1:enabled - cmReg.reg.hwCtEnableSource = 3; // NOT RCAP - cmReg.reg.ctEnableCtrl = 2; // Hardware - cmReg.reg.clockSource = 2; // Internal - cmReg.reg.countDir = 1; // Down - cmReg.reg.countDirCtrl = 1; // Software - cmReg.reg.outputRegLatchCtrl = 0; // latch on read - cmReg.reg.preloadRegSel = 0; // PR0 + /* Example of Counter Application */ + /* One-shot (software trigger) */ + cmReg.reg.coutSource = 0; /* out RCAP */ + cmReg.reg.coutPolarity = 1; /* Polarity inverted */ + cmReg.reg.autoLoadResetRcap = 1; /* Auto load 0:disabled, 1:enabled */ + cmReg.reg.hwCtEnableSource = 3; /* NOT RCAP */ + cmReg.reg.ctEnableCtrl = 2; /* Hardware */ + cmReg.reg.clockSource = 2; /* Internal */ + cmReg.reg.countDir = 1; /* Down */ + cmReg.reg.countDirCtrl = 1; /* Software */ + cmReg.reg.outputRegLatchCtrl = 0; /* latch on read */ + cmReg.reg.preloadRegSel = 0; /* PR0 */ cmReg.reg.reserved = 0; outw(cmReg.value, ADDR_CHAN_REG(REG_C0M, subdev_channel)); @@ -402,24 +402,24 @@ static int s526_attach(struct comedi_device * dev, struct comedi_devconfig * it) outw(0x0001, ADDR_CHAN_REG(REG_C0H, subdev_channel)); outw(0x3C68, ADDR_CHAN_REG(REG_C0L, subdev_channel)); - outw(0x8000, ADDR_CHAN_REG(REG_C0C, subdev_channel)); // Reset the counter - outw(0x4000, ADDR_CHAN_REG(REG_C0C, subdev_channel)); // Load the counter from PR0 + outw(0x8000, ADDR_CHAN_REG(REG_C0C, subdev_channel)); /* Reset the counter */ + outw(0x4000, ADDR_CHAN_REG(REG_C0C, subdev_channel)); /* Load the counter from PR0 */ - outw(0x0008, ADDR_CHAN_REG(REG_C0C, subdev_channel)); // Reset RCAP (fires one-shot) + outw(0x0008, ADDR_CHAN_REG(REG_C0C, subdev_channel)); /* Reset RCAP (fires one-shot) */ #else - // Set Counter Mode Register - cmReg.reg.coutSource = 0; // out RCAP - cmReg.reg.coutPolarity = 0; // Polarity inverted - cmReg.reg.autoLoadResetRcap = 0; // Auto load disabled - cmReg.reg.hwCtEnableSource = 2; // NOT RCAP - cmReg.reg.ctEnableCtrl = 1; // 1: Software, >1 : Hardware - cmReg.reg.clockSource = 3; // x4 - cmReg.reg.countDir = 0; // up - cmReg.reg.countDirCtrl = 0; // quadrature - cmReg.reg.outputRegLatchCtrl = 0; // latch on read - cmReg.reg.preloadRegSel = 0; // PR0 + /* Set Counter Mode Register */ + cmReg.reg.coutSource = 0; /* out RCAP */ + cmReg.reg.coutPolarity = 0; /* Polarity inverted */ + cmReg.reg.autoLoadResetRcap = 0; /* Auto load disabled */ + cmReg.reg.hwCtEnableSource = 2; /* NOT RCAP */ + cmReg.reg.ctEnableCtrl = 1; /* 1: Software, >1 : Hardware */ + cmReg.reg.clockSource = 3; /* x4 */ + cmReg.reg.countDir = 0; /* up */ + cmReg.reg.countDirCtrl = 0; /* quadrature */ + cmReg.reg.outputRegLatchCtrl = 0; /* latch on read */ + cmReg.reg.preloadRegSel = 0; /* PR0 */ cmReg.reg.reserved = 0; n = 0; @@ -429,21 +429,21 @@ static int s526_attach(struct comedi_device * dev, struct comedi_devconfig * it) udelay(1000); printk("Read back mode reg=0x%04x\n", inw(ADDR_CHAN_REG(REG_C0M, n))); - // Load the pre-laod register high word -// value = (short) (0x55); -// outw(value, ADDR_CHAN_REG(REG_C0H, n)); + /* Load the pre-laod register high word */ +/* value = (short) (0x55); */ +/* outw(value, ADDR_CHAN_REG(REG_C0H, n)); */ - // Load the pre-laod register low word -// value = (short)(0xaa55); -// outw(value, ADDR_CHAN_REG(REG_C0L, n)); + /* Load the pre-laod register low word */ +/* value = (short)(0xaa55); */ +/* outw(value, ADDR_CHAN_REG(REG_C0L, n)); */ - // Write the Counter Control Register -// outw(value, ADDR_CHAN_REG(REG_C0C, 0)); + /* Write the Counter Control Register */ +/* outw(value, ADDR_CHAN_REG(REG_C0C, 0)); */ - // Reset the counter if it is software preload + /* Reset the counter if it is software preload */ if (cmReg.reg.autoLoadResetRcap == 0) { - outw(0x8000, ADDR_CHAN_REG(REG_C0C, n)); // Reset the counter - outw(0x4000, ADDR_CHAN_REG(REG_C0C, n)); // Load the counter from PR0 + outw(0x8000, ADDR_CHAN_REG(REG_C0C, n)); /* Reset the counter */ + outw(0x4000, ADDR_CHAN_REG(REG_C0C, n)); /* Load the counter from PR0 */ } outw(cmReg.value, ADDR_CHAN_REG(REG_C0M, n)); @@ -481,23 +481,23 @@ static int s526_detach(struct comedi_device * dev) static int s526_gpct_rinsn(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - int i; // counts the Data + int i; /* counts the Data */ int counter_channel = CR_CHAN(insn->chanspec); unsigned short datalow; unsigned short datahigh; - // Check if (n > 0) + /* Check if (n > 0) */ if (insn->n <= 0) { printk("s526: INSN_READ: n should be > 0\n"); return -EINVAL; } - // Read the low word first + /* Read the low word first */ for (i = 0; i < insn->n; i++) { datalow = inw(ADDR_CHAN_REG(REG_C0L, counter_channel)); datahigh = inw(ADDR_CHAN_REG(REG_C0H, counter_channel)); data[i] = (int)(datahigh & 0x00FF); data[i] = (data[i] << 16) | (datalow & 0xFFFF); -// printk("s526 GPCT[%d]: %x(0x%04x, 0x%04x)\n", counter_channel, data[i], datahigh, datalow); +/* printk("s526 GPCT[%d]: %x(0x%04x, 0x%04x)\n", counter_channel, data[i], datahigh, datalow); */ } return i; } @@ -505,20 +505,20 @@ static int s526_gpct_rinsn(struct comedi_device * dev, struct comedi_subdevice * static int s526_gpct_insn_config(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - int subdev_channel = CR_CHAN(insn->chanspec); // Unpack chanspec + int subdev_channel = CR_CHAN(insn->chanspec); /* Unpack chanspec */ int i; short value; -// printk("s526: GPCT_INSN_CONFIG: Configuring Channel %d\n", subdev_channel); +/* printk("s526: GPCT_INSN_CONFIG: Configuring Channel %d\n", subdev_channel); */ for (i = 0; i < MAX_GPCT_CONFIG_DATA; i++) { devpriv->s526_gpct_config[subdev_channel].data[i] = insn->data[i]; -// printk("data[%d]=%x\n", i, insn->data[i]); +/* printk("data[%d]=%x\n", i, insn->data[i]); */ } - // Check what type of Counter the user requested, data[0] contains - // the Application type + /* Check what type of Counter the user requested, data[0] contains */ + /* the Application type */ switch (insn->data[0]) { case INSN_CONFIG_GPCT_QUADRATURE_ENCODER: /* @@ -531,19 +531,19 @@ static int s526_gpct_insn_config(struct comedi_device * dev, struct comedi_subde devpriv->s526_gpct_config[subdev_channel].app = PositionMeasurement; -/* - // Example of Counter Application - //One-shot (software trigger) - cmReg.reg.coutSource = 0; // out RCAP - cmReg.reg.coutPolarity = 1; // Polarity inverted - cmReg.reg.autoLoadResetRcap = 0; // Auto load disabled - cmReg.reg.hwCtEnableSource = 3; // NOT RCAP - cmReg.reg.ctEnableCtrl = 2; // Hardware - cmReg.reg.clockSource = 2; // Internal - cmReg.reg.countDir = 1; // Down - cmReg.reg.countDirCtrl = 1; // Software - cmReg.reg.outputRegLatchCtrl = 0; // latch on read - cmReg.reg.preloadRegSel = 0; // PR0 +#if 0 + /* Example of Counter Application */ + /* One-shot (software trigger) */ + cmReg.reg.coutSource = 0; /* out RCAP */ + cmReg.reg.coutPolarity = 1; /* Polarity inverted */ + cmReg.reg.autoLoadResetRcap = 0; /* Auto load disabled */ + cmReg.reg.hwCtEnableSource = 3; /* NOT RCAP */ + cmReg.reg.ctEnableCtrl = 2; /* Hardware */ + cmReg.reg.clockSource = 2; /* Internal */ + cmReg.reg.countDir = 1; /* Down */ + cmReg.reg.countDirCtrl = 1; /* Software */ + cmReg.reg.outputRegLatchCtrl = 0; /* latch on read */ + cmReg.reg.preloadRegSel = 0; /* PR0 */ cmReg.reg.reserved = 0; outw(cmReg.value, ADDR_CHAN_REG(REG_C0M, subdev_channel)); @@ -551,40 +551,40 @@ static int s526_gpct_insn_config(struct comedi_device * dev, struct comedi_subde outw(0x0001, ADDR_CHAN_REG(REG_C0H, subdev_channel)); outw(0x3C68, ADDR_CHAN_REG(REG_C0L, subdev_channel)); - outw(0x8000, ADDR_CHAN_REG(REG_C0C, subdev_channel)); // Reset the counter - outw(0x4000, ADDR_CHAN_REG(REG_C0C, subdev_channel)); // Load the counter from PR0 + outw(0x8000, ADDR_CHAN_REG(REG_C0C, subdev_channel)); /* Reset the counter */ + outw(0x4000, ADDR_CHAN_REG(REG_C0C, subdev_channel)); /* Load the counter from PR0 */ - outw(0x0008, ADDR_CHAN_REG(REG_C0C, subdev_channel)); // Reset RCAP (fires one-shot) + outw(0x0008, ADDR_CHAN_REG(REG_C0C, subdev_channel)); /* Reset RCAP (fires one-shot) */ -*/ +#endif #if 1 - // Set Counter Mode Register - cmReg.reg.coutSource = 0; // out RCAP - cmReg.reg.coutPolarity = 0; // Polarity inverted - cmReg.reg.autoLoadResetRcap = 0; // Auto load disabled - cmReg.reg.hwCtEnableSource = 2; // NOT RCAP - cmReg.reg.ctEnableCtrl = 1; // 1: Software, >1 : Hardware - cmReg.reg.clockSource = 3; // x4 - cmReg.reg.countDir = 0; // up - cmReg.reg.countDirCtrl = 0; // quadrature - cmReg.reg.outputRegLatchCtrl = 0; // latch on read - cmReg.reg.preloadRegSel = 0; // PR0 + /* Set Counter Mode Register */ + cmReg.reg.coutSource = 0; /* out RCAP */ + cmReg.reg.coutPolarity = 0; /* Polarity inverted */ + cmReg.reg.autoLoadResetRcap = 0; /* Auto load disabled */ + cmReg.reg.hwCtEnableSource = 2; /* NOT RCAP */ + cmReg.reg.ctEnableCtrl = 1; /* 1: Software, >1 : Hardware */ + cmReg.reg.clockSource = 3; /* x4 */ + cmReg.reg.countDir = 0; /* up */ + cmReg.reg.countDirCtrl = 0; /* quadrature */ + cmReg.reg.outputRegLatchCtrl = 0; /* latch on read */ + cmReg.reg.preloadRegSel = 0; /* PR0 */ cmReg.reg.reserved = 0; - // Set Counter Mode Register -// printk("s526: Counter Mode register=%x\n", cmReg.value); + /* Set Counter Mode Register */ +/* printk("s526: Counter Mode register=%x\n", cmReg.value); */ outw(cmReg.value, ADDR_CHAN_REG(REG_C0M, subdev_channel)); - // Reset the counter if it is software preload + /* Reset the counter if it is software preload */ if (cmReg.reg.autoLoadResetRcap == 0) { - outw(0x8000, ADDR_CHAN_REG(REG_C0C, subdev_channel)); // Reset the counter -// outw(0x4000, ADDR_CHAN_REG(REG_C0C, subdev_channel)); // Load the counter from PR0 + outw(0x8000, ADDR_CHAN_REG(REG_C0C, subdev_channel)); /* Reset the counter */ +/* outw(0x4000, ADDR_CHAN_REG(REG_C0C, subdev_channel)); Load the counter from PR0 */ } #else - cmReg.reg.countDirCtrl = 0; // 0 quadrature, 1 software control + cmReg.reg.countDirCtrl = 0; /* 0 quadrature, 1 software control */ - // data[1] contains GPCT_X1, GPCT_X2 or GPCT_X4 + /* data[1] contains GPCT_X1, GPCT_X2 or GPCT_X4 */ if (insn->data[1] == GPCT_X2) { cmReg.reg.clockSource = 1; } else if (insn->data[1] == GPCT_X4) { @@ -593,37 +593,37 @@ static int s526_gpct_insn_config(struct comedi_device * dev, struct comedi_subde cmReg.reg.clockSource = 0; } - // When to take into account the indexpulse: + /* When to take into account the indexpulse: */ if (insn->data[2] == GPCT_IndexPhaseLowLow) { } else if (insn->data[2] == GPCT_IndexPhaseLowHigh) { } else if (insn->data[2] == GPCT_IndexPhaseHighLow) { } else if (insn->data[2] == GPCT_IndexPhaseHighHigh) { } - // Take into account the index pulse? + /* Take into account the index pulse? */ if (insn->data[3] == GPCT_RESET_COUNTER_ON_INDEX) - cmReg.reg.autoLoadResetRcap = 4; // Auto load with INDEX^ + cmReg.reg.autoLoadResetRcap = 4; /* Auto load with INDEX^ */ - // Set Counter Mode Register + /* Set Counter Mode Register */ cmReg.value = (short) (insn->data[1] & 0xFFFF); outw(cmReg.value, ADDR_CHAN_REG(REG_C0M, subdev_channel)); - // Load the pre-laod register high word + /* Load the pre-laod register high word */ value = (short) ((insn->data[2] >> 16) & 0xFFFF); outw(value, ADDR_CHAN_REG(REG_C0H, subdev_channel)); - // Load the pre-laod register low word + /* Load the pre-laod register low word */ value = (short) (insn->data[2] & 0xFFFF); outw(value, ADDR_CHAN_REG(REG_C0L, subdev_channel)); - // Write the Counter Control Register + /* Write the Counter Control Register */ if (insn->data[3] != 0) { value = (short) (insn->data[3] & 0xFFFF); outw(value, ADDR_CHAN_REG(REG_C0C, subdev_channel)); } - // Reset the counter if it is software preload + /* Reset the counter if it is software preload */ if (cmReg.reg.autoLoadResetRcap == 0) { - outw(0x8000, ADDR_CHAN_REG(REG_C0C, subdev_channel)); // Reset the counter - outw(0x4000, ADDR_CHAN_REG(REG_C0C, subdev_channel)); // Load the counter from PR0 + outw(0x8000, ADDR_CHAN_REG(REG_C0C, subdev_channel)); /* Reset the counter */ + outw(0x4000, ADDR_CHAN_REG(REG_C0C, subdev_channel)); /* Load the counter from PR0 */ } #endif break; @@ -640,33 +640,33 @@ static int s526_gpct_insn_config(struct comedi_device * dev, struct comedi_subde devpriv->s526_gpct_config[subdev_channel].app = SinglePulseGeneration; - // Set Counter Mode Register + /* Set Counter Mode Register */ cmReg.value = (short) (insn->data[1] & 0xFFFF); - cmReg.reg.preloadRegSel = 0; // PR0 + cmReg.reg.preloadRegSel = 0; /* PR0 */ outw(cmReg.value, ADDR_CHAN_REG(REG_C0M, subdev_channel)); - // Load the pre-laod register 0 high word + /* Load the pre-laod register 0 high word */ value = (short) ((insn->data[2] >> 16) & 0xFFFF); outw(value, ADDR_CHAN_REG(REG_C0H, subdev_channel)); - // Load the pre-laod register 0 low word + /* Load the pre-laod register 0 low word */ value = (short) (insn->data[2] & 0xFFFF); outw(value, ADDR_CHAN_REG(REG_C0L, subdev_channel)); - // Set Counter Mode Register + /* Set Counter Mode Register */ cmReg.value = (short) (insn->data[1] & 0xFFFF); - cmReg.reg.preloadRegSel = 1; // PR1 + cmReg.reg.preloadRegSel = 1; /* PR1 */ outw(cmReg.value, ADDR_CHAN_REG(REG_C0M, subdev_channel)); - // Load the pre-laod register 1 high word + /* Load the pre-laod register 1 high word */ value = (short) ((insn->data[3] >> 16) & 0xFFFF); outw(value, ADDR_CHAN_REG(REG_C0H, subdev_channel)); - // Load the pre-laod register 1 low word + /* Load the pre-laod register 1 low word */ value = (short) (insn->data[3] & 0xFFFF); outw(value, ADDR_CHAN_REG(REG_C0L, subdev_channel)); - // Write the Counter Control Register + /* Write the Counter Control Register */ if (insn->data[3] != 0) { value = (short) (insn->data[3] & 0xFFFF); outw(value, ADDR_CHAN_REG(REG_C0C, subdev_channel)); @@ -685,33 +685,33 @@ static int s526_gpct_insn_config(struct comedi_device * dev, struct comedi_subde devpriv->s526_gpct_config[subdev_channel].app = PulseTrainGeneration; - // Set Counter Mode Register + /* Set Counter Mode Register */ cmReg.value = (short) (insn->data[1] & 0xFFFF); - cmReg.reg.preloadRegSel = 0; // PR0 + cmReg.reg.preloadRegSel = 0; /* PR0 */ outw(cmReg.value, ADDR_CHAN_REG(REG_C0M, subdev_channel)); - // Load the pre-laod register 0 high word + /* Load the pre-laod register 0 high word */ value = (short) ((insn->data[2] >> 16) & 0xFFFF); outw(value, ADDR_CHAN_REG(REG_C0H, subdev_channel)); - // Load the pre-laod register 0 low word + /* Load the pre-laod register 0 low word */ value = (short) (insn->data[2] & 0xFFFF); outw(value, ADDR_CHAN_REG(REG_C0L, subdev_channel)); - // Set Counter Mode Register + /* Set Counter Mode Register */ cmReg.value = (short) (insn->data[1] & 0xFFFF); - cmReg.reg.preloadRegSel = 1; // PR1 + cmReg.reg.preloadRegSel = 1; /* PR1 */ outw(cmReg.value, ADDR_CHAN_REG(REG_C0M, subdev_channel)); - // Load the pre-laod register 1 high word + /* Load the pre-laod register 1 high word */ value = (short) ((insn->data[3] >> 16) & 0xFFFF); outw(value, ADDR_CHAN_REG(REG_C0H, subdev_channel)); - // Load the pre-laod register 1 low word + /* Load the pre-laod register 1 low word */ value = (short) (insn->data[3] & 0xFFFF); outw(value, ADDR_CHAN_REG(REG_C0L, subdev_channel)); - // Write the Counter Control Register + /* Write the Counter Control Register */ if (insn->data[3] != 0) { value = (short) (insn->data[3] & 0xFFFF); outw(value, ADDR_CHAN_REG(REG_C0C, subdev_channel)); @@ -730,13 +730,13 @@ static int s526_gpct_insn_config(struct comedi_device * dev, struct comedi_subde static int s526_gpct_winsn(struct comedi_device * dev, struct comedi_subdevice * s, struct comedi_insn * insn, unsigned int * data) { - int subdev_channel = CR_CHAN(insn->chanspec); // Unpack chanspec + int subdev_channel = CR_CHAN(insn->chanspec); /* Unpack chanspec */ short value; printk("s526: GPCT_INSN_WRITE on channel %d\n", subdev_channel); cmReg.value = inw(ADDR_CHAN_REG(REG_C0M, subdev_channel)); printk("s526: Counter Mode Register: %x\n", cmReg.value); - // Check what Application of Counter this channel is configured for + /* Check what Application of Counter this channel is configured for */ switch (devpriv->s526_gpct_config[subdev_channel].app) { case PositionMeasurement: printk("S526: INSN_WRITE: PM\n"); @@ -776,12 +776,12 @@ static int s526_gpct_winsn(struct comedi_device * dev, struct comedi_subdevice * value = (short) (*data & 0xFFFF); outw(value, ADDR_CHAN_REG(REG_C0L, subdev_channel)); break; - default: // Impossible + default: /* Impossible */ printk("s526: INSN_WRITE: Functionality %d not implemented yet\n", devpriv->s526_gpct_config[subdev_channel].app); return -EINVAL; break; } - // return the number of samples written + /* return the number of samples written */ return insn->n; } @@ -803,14 +803,14 @@ static int s526_ai_insn_config(struct comedi_device * dev, struct comedi_subdevi * enable channels here. The channel should be enabled in the * INSN_READ handler. */ - // Enable ADC interrupt + /* Enable ADC interrupt */ outw(ISR_ADC_DONE, ADDR_REG(REG_IER)); -// printk("s526: ADC current value: 0x%04x\n", inw(ADDR_REG(REG_ADC))); +/* printk("s526: ADC current value: 0x%04x\n", inw(ADDR_REG(REG_ADC))); */ devpriv->s526_ai_config = (data[0] & 0x3FF) << 5; if (data[1] > 0) - devpriv->s526_ai_config |= 0x8000; //set the delay + devpriv->s526_ai_config |= 0x8000; /* set the delay */ - devpriv->s526_ai_config |= 0x0001; // ADC start bit. + devpriv->s526_ai_config |= 0x0001; /* ADC start bit. */ return result; } @@ -837,8 +837,8 @@ static int s526_ai_rinsn(struct comedi_device * dev, struct comedi_subdevice * s for (n = 0; n < insn->n; n++) { /* trigger conversion */ outw(value, ADDR_REG(REG_ADC)); -// printk("s526: Wrote 0x%04x to ADC\n", value); -// printk("s526: ADC reg=0x%04x\n", inw(ADDR_REG(REG_ADC))); +/* printk("s526: Wrote 0x%04x to ADC\n", value); */ +/* printk("s526: ADC reg=0x%04x\n", inw(ADDR_REG(REG_ADC))); */ #define TIMEOUT 100 /* wait for conversion to end */ @@ -859,7 +859,7 @@ static int s526_ai_rinsn(struct comedi_device * dev, struct comedi_subdevice * s /* read data */ d = inw(ADDR_REG(REG_ADD)); -// printk("AI[%d]=0x%04x\n", n, (unsigned short)(d & 0xFFFF)); +/* printk("AI[%d]=0x%04x\n", n, (unsigned short)(d & 0xFFFF)); */ /* munge data */ data[n] = d ^ 0x8000; @@ -876,20 +876,20 @@ static int s526_ao_winsn(struct comedi_device * dev, struct comedi_subdevice * s int chan = CR_CHAN(insn->chanspec); unsigned short val; -// printk("s526_ao_winsn\n"); +/* printk("s526_ao_winsn\n"); */ val = chan << 1; -// outw(val, dev->iobase + REG_DAC); +/* outw(val, dev->iobase + REG_DAC); */ outw(val, ADDR_REG(REG_DAC)); /* 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; i < insn->n; i++) { /* a typical programming sequence */ -// outw(data[i], dev->iobase + REG_ADD); // write the data to preload register - outw(data[i], ADDR_REG(REG_ADD)); // write the data to preload register +/* outw(data[i], dev->iobase + REG_ADD); write the data to preload register */ + outw(data[i], ADDR_REG(REG_ADD)); /* write the data to preload register */ devpriv->ao_readback[chan] = data[i]; -// outw(val + 1, dev->iobase + REG_DAC); // starts the D/A conversion. - outw(val + 1, ADDR_REG(REG_DAC)); // starts the D/A conversion. +/* outw(val + 1, dev->iobase + REG_DAC); starts the D/A conversion. */ + outw(val + 1, ADDR_REG(REG_DAC)); /* starts the D/A conversion. */ } /* return the number of samples read/written */ @@ -932,10 +932,10 @@ static int s526_dio_insn_bits(struct comedi_device * dev, struct comedi_subdevic /* on return, data[1] contains the value of the digital * input and output lines. */ - data[1] = inw(ADDR_REG(REG_DIO)) & 0xFF; // low 8 bits are the data + data[1] = inw(ADDR_REG(REG_DIO)) & 0xFF; /* low 8 bits are the data */ /* or we could just return the software copy of the output values if * it was a purely digital output subdevice */ - //data[1]=s->state; + /* data[1]=s->state; */ return 2; } @@ -959,10 +959,10 @@ static int s526_dio_insn_config(struct comedi_device * dev, struct comedi_subdev * value COMEDI_INPUT or COMEDI_OUTPUT. */ if (data[0] == COMEDI_OUTPUT) { - value |= 1 << (chan + 10); // bit 10/11 set the group 1/2's mode + value |= 1 << (chan + 10); /* bit 10/11 set the group 1/2's mode */ s->io_bits |= (0xF << chan); } else { - value &= ~(1 << (chan + 10)); // 1 is output, 0 is input. + value &= ~(1 << (chan + 10)); /* 1 is output, 0 is input. */ s->io_bits &= ~(0xF << chan); } outw(value, ADDR_REG(REG_DIO)); diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index 30dec9dab19b..bf7e20492b28 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -253,7 +253,7 @@ static int s626_ns_to_timer(int *nanosec, int round_mode); static int s626_ai_load_polllist(uint8_t *ppl, struct comedi_cmd *cmd); static int s626_ai_inttrig(struct comedi_device *dev, struct comedi_subdevice *s, unsigned int trignum); -static irqreturn_t s626_irq_handler(int irq, void *d PT_REGS_ARG); +static irqreturn_t s626_irq_handler(int irq, void *d); static unsigned int s626_ai_reg_to_uint(int data); /* static unsigned int s626_uint_to_reg(struct comedi_subdevice *s, int data); */ @@ -968,7 +968,7 @@ static unsigned int s626_ai_reg_to_uint(int data) /* return 0; */ /* } */ -static irqreturn_t s626_irq_handler(int irq, void *d PT_REGS_ARG) +static irqreturn_t s626_irq_handler(int irq, void *d) { struct comedi_device *dev = d; struct comedi_subdevice *s; diff --git a/drivers/staging/comedi/drivers/serial2002.c b/drivers/staging/comedi/drivers/serial2002.c index 844fd5e2e3a9..602fa85dc70f 100644 --- a/drivers/staging/comedi/drivers/serial2002.c +++ b/drivers/staging/comedi/drivers/serial2002.c @@ -62,7 +62,7 @@ static const struct serial2002_board serial2002_boards[] = { struct serial2002_range_table_t { - // HACK... + /* HACK... */ int length; struct comedi_krange range; }; @@ -70,8 +70,8 @@ struct serial2002_range_table_t { struct serial2002_private { - int port; // /dev/ttyS<port> - int speed; // baudrate + int port; /* /dev/ttyS<port> */ + int speed; /* baudrate */ struct file *tty; unsigned int ao_readback[32]; unsigned char digital_in_mapping[32]; @@ -238,11 +238,11 @@ static void tty_setspeed(struct file *f, int speed) oldfs = get_fs(); set_fs(KERNEL_DS); { - // Set speed + /* Set speed */ struct termios settings; tty_ioctl(f, TCGETS, (unsigned long)&settings); -// printk("Speed: %d\n", settings.c_cflag & (CBAUD | CBAUDEX)); +/* printk("Speed: %d\n", settings.c_cflag & (CBAUD | CBAUDEX)); */ settings.c_iflag = 0; settings.c_oflag = 0; settings.c_lflag = 0; @@ -284,10 +284,10 @@ static void tty_setspeed(struct file *f, int speed) break; } tty_ioctl(f, TCSETS, (unsigned long)&settings); -// printk("Speed: %d\n", settings.c_cflag & (CBAUD | CBAUDEX)); +/* printk("Speed: %d\n", settings.c_cflag & (CBAUD | CBAUDEX)); */ } { - // Set low latency + /* Set low latency */ struct serial_struct settings; tty_ioctl(f, TIOCGSERIAL, (unsigned long)&settings); @@ -437,7 +437,7 @@ static void serial_2002_open(struct comedi_device * dev) } tty_setspeed(devpriv->tty, devpriv->speed); - poll_channel(devpriv->tty, 31); // Start reading configuration + poll_channel(devpriv->tty, 31); /* Start reading configuration */ while (1) { struct serial_data data; @@ -557,7 +557,7 @@ static void serial_2002_open(struct comedi_device * dev) } } for (i = 0; i <= 4; i++) { - // Fill in subdev data + /* Fill in subdev data */ struct config_t *c; unsigned char *mapping = 0; struct serial2002_range_table_t *range = 0; diff --git a/drivers/staging/comedi/drivers/ssv_dnp.c b/drivers/staging/comedi/drivers/ssv_dnp.c index 1628d216cdd4..c9a8fb5e8524 100644 --- a/drivers/staging/comedi/drivers/ssv_dnp.c +++ b/drivers/staging/comedi/drivers/ssv_dnp.c @@ -74,7 +74,6 @@ static const struct dnp_board dnp_boards[] = { /* we only support one DNP 'board /* This structure is for data unique to the DNP driver --------------------- */ struct dnp_private_data { - // }; @@ -126,7 +125,7 @@ static int dnp_attach(struct comedi_device * dev, struct comedi_devconfig * it) /* Autoprobing: this should find out which board we have. Currently only */ /* the 1486 board is supported and autoprobing is not implemented :-) */ - //dev->board_ptr = dnp_probe(dev); + /* dev->board_ptr = dnp_probe(dev); */ /* Initialize the name of the board. We can use the "thisboard" macro now. */ dev->board_name = thisboard->name; diff --git a/drivers/staging/comedi/drivers/unioxx5.c b/drivers/staging/comedi/drivers/unioxx5.c index dd3b1119319b..96284f020be1 100644 --- a/drivers/staging/comedi/drivers/unioxx5.c +++ b/drivers/staging/comedi/drivers/unioxx5.c @@ -94,7 +94,7 @@ static int __unioxx5_digital_write(struct unioxx5_subd_priv * usp, unsigned int int channel, int minor); static int __unioxx5_digital_read(struct unioxx5_subd_priv * usp, unsigned int * data, int channel, int minor); -//static void __unioxx5_digital_config(struct unioxx5_subd_priv* usp, int mode); +/* static void __unioxx5_digital_config(struct unioxx5_subd_priv* usp, int mode); */ static int __unioxx5_analog_write(struct unioxx5_subd_priv * usp, unsigned int * data, int channel, int minor); static int __unioxx5_analog_read(struct unioxx5_subd_priv * usp, unsigned int * data, @@ -418,7 +418,7 @@ static int __unioxx5_analog_write(struct unioxx5_subd_priv * usp, unsigned int * /* saving major byte */ usp->usp_extra_data[module][i] = (unsigned char)((*data & 0xFF00) >> 8); - //while(!((inb(usp->usp_iobase + 0)) & TxBE)); + /* while(!((inb(usp->usp_iobase + 0)) & TxBE)); */ outb(module + 1, usp->usp_iobase + 5); /* sending module number to card(1 .. 12) */ outb('W', usp->usp_iobase + 6); /* sends (W)rite command to module */ diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c index 2fb64de3f86b..6435f6c4191a 100644 --- a/drivers/staging/comedi/drivers/usbduxfast.c +++ b/drivers/staging/comedi/drivers/usbduxfast.c @@ -314,7 +314,7 @@ static int usbduxfast_ai_cancel(struct comedi_device *dev, struct comedi_subdevi * analogue IN * interrupt service routine */ -static void usbduxfastsub_ai_Irq(struct urb *urb PT_REGS_ARG) +static void usbduxfastsub_ai_Irq(struct urb *urb) { int n, err; struct usbduxfastsub_s *udfs; diff --git a/drivers/staging/comedi/interrupt.h b/drivers/staging/comedi/interrupt.h deleted file mode 100644 index d1f09892da2e..000000000000 --- a/drivers/staging/comedi/interrupt.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - linux/interrupt.h compatibility header - - 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. - */ - -#ifndef __COMPAT_LINUX_INTERRUPT_H_ -#define __COMPAT_LINUX_INTERRUPT_H_ - -#include <linux/interrupt.h> - -#ifndef IRQF_DISABLED -#define IRQF_DISABLED SA_INTERRUPT -#define IRQF_SAMPLE_RANDOM SA_SAMPLE_RANDOM -#define IRQF_SHARED SA_SHIRQ -#define IRQF_PROBE_SHARED SA_PROBEIRQ -#define IRQF_PERCPU SA_PERCPU -#ifdef SA_TRIGGER_MASK -#define IRQF_TRIGGER_NONE 0 -#define IRQF_TRIGGER_LOW SA_TRIGGER_LOW -#define IRQF_TRIGGER_HIGH SA_TRIGGER_HIGH -#define IRQF_TRIGGER_FALLING SA_TRIGGER_FALLING -#define IRQF_TRIGGER_RISING SA_TRIGGER_RISING -#define IRQF_TRIGGER_MASK SA_TRIGGER_MASK -#else -#define IRQF_TRIGGER_NONE 0 -#define IRQF_TRIGGER_LOW 0 -#define IRQF_TRIGGER_HIGH 0 -#define IRQF_TRIGGER_FALLING 0 -#define IRQF_TRIGGER_RISING 0 -#define IRQF_TRIGGER_MASK 0 -#endif -#endif - -#define PT_REGS_ARG -#define PT_REGS_CALL -#define PT_REGS_NULL - -#endif diff --git a/drivers/staging/comedi/kcomedilib/ksyms.c b/drivers/staging/comedi/kcomedilib/ksyms.c index 3db86dabf878..314765db51fe 100644 --- a/drivers/staging/comedi/kcomedilib/ksyms.c +++ b/drivers/staging/comedi/kcomedilib/ksyms.c @@ -59,7 +59,7 @@ EXPORT_SYMBOL(comedi_close); EXPORT_SYMBOL(comedi_loglevel); EXPORT_SYMBOL(comedi_perror); EXPORT_SYMBOL(comedi_strerror); -//EXPORT_SYMBOL(comedi_errno); +/* EXPORT_SYMBOL(comedi_errno); */ EXPORT_SYMBOL(comedi_fileno); /* device queries */ @@ -73,8 +73,10 @@ EXPORT_SYMBOL(comedi_get_subdevice_type); EXPORT_SYMBOL(comedi_find_subdevice_by_type); EXPORT_SYMBOL(comedi_get_subdevice_flags); EXPORT_SYMBOL(comedi_get_n_channels); -//EXPORT_SYMBOL(comedi_range_is_chan_specific); -//EXPORT_SYMBOL(comedi_maxdata_is_chan_specific); +/* +* EXPORT_SYMBOL(comedi_range_is_chan_specific); +* EXPORT_SYMBOL(comedi_maxdata_is_chan_specific); +*/ /* channel queries */ EXPORT_SYMBOL(comedi_get_maxdata); @@ -82,25 +84,29 @@ EXPORT_SYMBOL(comedi_get_maxdata); EXPORT_SYMBOL(comedi_get_rangetype); #endif EXPORT_SYMBOL(comedi_get_n_ranges); -//EXPORT_SYMBOL(comedi_find_range); +/* EXPORT_SYMBOL(comedi_find_range); */ /* buffer queries */ EXPORT_SYMBOL(comedi_get_buffer_size); -//EXPORT_SYMBOL(comedi_get_max_buffer_size); -//EXPORT_SYMBOL(comedi_set_buffer_size); +/* +* EXPORT_SYMBOL(comedi_get_max_buffer_size); +* EXPORT_SYMBOL(comedi_set_buffer_size); +*/ EXPORT_SYMBOL(comedi_get_buffer_contents); EXPORT_SYMBOL(comedi_get_buffer_offset); /* low-level stuff */ -//EXPORT_SYMBOL(comedi_trigger); -//EXPORT_SYMBOL(comedi_do_insnlist); +/* +* EXPORT_SYMBOL(comedi_trigger); EXPORT_SYMBOL(comedi_do_insnlist); +*/ EXPORT_SYMBOL(comedi_do_insn); EXPORT_SYMBOL(comedi_lock); EXPORT_SYMBOL(comedi_unlock); /* physical units */ -//EXPORT_SYMBOL(comedi_to_phys); -//EXPORT_SYMBOL(comedi_from_phys); +/* +* EXPORT_SYMBOL(comedi_to_phys); EXPORT_SYMBOL(comedi_from_phys); +*/ /* synchronous stuff */ EXPORT_SYMBOL(comedi_data_read); @@ -113,13 +119,16 @@ EXPORT_SYMBOL(comedi_dio_write); EXPORT_SYMBOL(comedi_dio_bitfield); /* slowly varying stuff */ -//EXPORT_SYMBOL(comedi_sv_init); -//EXPORT_SYMBOL(comedi_sv_update); -//EXPORT_SYMBOL(comedi_sv_measure); +/* +* EXPORT_SYMBOL(comedi_sv_init); EXPORT_SYMBOL(comedi_sv_update); +* EXPORT_SYMBOL(comedi_sv_measure); +*/ /* commands */ -//EXPORT_SYMBOL(comedi_get_cmd_src_mask); -//EXPORT_SYMBOL(comedi_get_cmd_generic_timed); +/* +* EXPORT_SYMBOL(comedi_get_cmd_src_mask); +* EXPORT_SYMBOL(comedi_get_cmd_generic_timed); +*/ EXPORT_SYMBOL(comedi_cancel); EXPORT_SYMBOL(comedi_command); EXPORT_SYMBOL(comedi_command_test); @@ -129,12 +138,14 @@ EXPORT_SYMBOL(comedi_poll); EXPORT_SYMBOL(comedi_mark_buffer_read); EXPORT_SYMBOL(comedi_mark_buffer_written); -//EXPORT_SYMBOL(comedi_get_range); +/* EXPORT_SYMBOL(comedi_get_range); */ EXPORT_SYMBOL(comedi_get_len_chanlist); /* deprecated */ -//EXPORT_SYMBOL(comedi_get_timer); -//EXPORT_SYMBOL(comedi_timed_1chan); +/* +* EXPORT_SYMBOL(comedi_get_timer); +* EXPORT_SYMBOL(comedi_timed_1chan); +*/ /* alpha */ -//EXPORT_SYMBOL(comedi_set_global_oor_behavior); +/* EXPORT_SYMBOL(comedi_set_global_oor_behavior); */ diff --git a/drivers/staging/comedi/rt.c b/drivers/staging/comedi/rt.c index e9f5777595ab..ace360d4a492 100644 --- a/drivers/staging/comedi/rt.c +++ b/drivers/staging/comedi/rt.c @@ -27,6 +27,7 @@ #include <linux/comedidev.h> #include <linux/errno.h> +#include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/fcntl.h> @@ -54,7 +55,7 @@ struct comedi_irq_struct { int rt; int irq; - irqreturn_t(*handler) (int irq, void *dev_id PT_REGS_ARG); + irq_handler_t handler; unsigned long flags; const char *device; struct comedi_device *dev_id; @@ -65,9 +66,8 @@ static int comedi_rt_release_irq(struct comedi_irq_struct *it); static struct comedi_irq_struct *comedi_irqs[NR_IRQS]; -int comedi_request_irq(unsigned irq, irqreturn_t(*handler) (int, - void *PT_REGS_ARG), unsigned long flags, const char *device, - struct comedi_device *dev_id) +int comedi_request_irq(unsigned irq, irq_handler_t handler, unsigned long flags, + const char *device, struct comedi_device *dev_id) { struct comedi_irq_struct *it; int ret; @@ -191,7 +191,7 @@ static void handle_void_irq(int irq) rt_printk("comedi: null irq struct?\n"); return; } - it->handler(irq, it->dev_id PT_REGS_NULL); + it->handler(irq, it->dev_id); rt_enable_irq(irq); /* needed by rtai-adeos, seems like it shouldn't hurt earlier versions */ } @@ -307,7 +307,7 @@ static void fusion_handle_irq(unsigned int irq, void *cookie) { struct comedi_irq_struct *it = cookie; - it->handler(irq, it->dev_id PT_REGS_NULL); + it->handler(irq, it->dev_id); rthal_irq_enable(irq); } @@ -340,14 +340,14 @@ void comedi_rt_cleanup(void) /* RTLinux section */ #ifdef CONFIG_COMEDI_RTL -static unsigned int handle_rtl_irq(unsigned int irq PT_REGS_ARG) +static unsigned int handle_rtl_irq(unsigned int irq) { struct comedi_irq_struct *it; it = comedi_irqs[irq]; if (it == NULL) return 0; - it->handler(irq, it->dev_id PT_REGS_NULL); + it->handler(irq, it->dev_id); rtl_hard_enable_irq(irq); return 0; } diff --git a/drivers/staging/comedi/rt_pend_tq.c b/drivers/staging/comedi/rt_pend_tq.c index f9dfd9d40cd3..a374284b1864 100644 --- a/drivers/staging/comedi/rt_pend_tq.c +++ b/drivers/staging/comedi/rt_pend_tq.c @@ -69,7 +69,7 @@ void rt_pend_irq_handler(void) #elif defined(CONFIG_COMEDI_FUSION) void rt_pend_irq_handler(void *cookie) #elif defined(CONFIG_COMEDI_RTL) -void rt_pend_irq_handler(int irq, void *dev PT_REGS_ARG) +void rt_pend_irq_handler(int irq, void *dev) #endif { while (rt_pend_head != rt_pend_tail) { diff --git a/drivers/staging/meilhaus/memain.c b/drivers/staging/meilhaus/memain.c index fd9f079b0ed1..0dc2878931bb 100644 --- a/drivers/staging/meilhaus/memain.c +++ b/drivers/staging/meilhaus/memain.c @@ -38,7 +38,7 @@ //#include <linux/usb.h> #include <linux/errno.h> #include <linux/uaccess.h> -#include <linux/cdev.h> +#include <linux/miscdevice.h> #include <linux/rwsem.h> #include "medefines.h" @@ -68,13 +68,6 @@ MODULE_PARM_DESC(me_bosch_fw, "Flags which signals the ME-4600 driver to load the bosch firmware (default = 0)."); #endif //BOSCH -static unsigned int major = 0; -#ifdef module_param -module_param(major, int, S_IRUGO); -#else -MODULE_PARM(major, "i"); -#endif - /* Global Driver Lock */ @@ -100,29 +93,131 @@ static int me_ioctl(struct inode *, struct file *, unsigned int, unsigned long); //static int me_probe_usb(struct usb_interface *interface, const struct usb_device_id *id); //static void me_disconnect_usb(struct usb_interface *interface); -/* Character device structure -*/ - -static struct cdev *cdevp; - /* File operations provided by the module */ -static struct file_operations me_file_operations = { +static const struct file_operations me_file_operations = { .owner = THIS_MODULE, .ioctl = me_ioctl, .open = me_open, .release = me_release, }; -struct pci_driver me_pci_driver = { +static const struct pci_device_id me_pci_table[] = { + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME1000) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME1000_A) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME1000_B) }, + + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME1400) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME140A) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME140B) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME14E0) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME14EA) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME14EB) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME140C) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME140D) }, + + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME1600_4U) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME1600_8U) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME1600_12U) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME1600_16U) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME1600_16U_8I) }, + + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME4610) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME4650) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME4660) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME4660I) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME4670) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME4670I) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME4670S) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME4670IS) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME4680) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME4680I) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME4680S) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME4680IS) }, + + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6004) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6008) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME600F) }, + + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6014) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6018) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME601F) }, + + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6034) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6038) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME603F) }, + + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6104) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6108) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME610F) }, + + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6114) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6118) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME611F) }, + + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6134) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6138) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME613F) }, + + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6044) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6048) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME604F) }, + + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6054) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6058) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME605F) }, + + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6074) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6078) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME607F) }, + + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6144) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6148) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME614F) }, + + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6154) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6158) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME615F) }, + + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6174) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6178) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME617F) }, + + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6259) }, + + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6359) }, + + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME0630) }, + + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME8100_A) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME8100_B) }, + + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME8200_A) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME8200_B) }, + + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME0940) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME0950) }, + { PCI_VDEVICE(MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME0960) }, + + { } +}; +MODULE_DEVICE_TABLE(pci, me_pci_table); + +static struct pci_driver me_pci_driver = { .name = MEMAIN_NAME, .id_table = me_pci_table, .probe = me_probe_pci, - .remove = me_remove_pci + .remove = __devexit_p(me_remove_pci), }; -/* //me_usb_driver +/* +static struct usb_device_id me_usb_table[] = { + { USB_DEVICE(USB_VENDOR_ID_MEPHISTO_S1, USB_DEVICE_ID_MEPHISTO_S1) }, + { 0 } +}; +MODULE_DEVICE_TABLE (usb, me_usb_table); + static struct usb_driver me_usb_driver = { .name = MEMAIN_NAME, @@ -396,7 +491,8 @@ static me_device_t *get_dummy_instance(unsigned short vendor_id, return instance; } -static int me_probe_pci(struct pci_dev *dev, const struct pci_device_id *id) +static int __devinit me_probe_pci(struct pci_dev *dev, + const struct pci_device_id *id) { int err; me_pci_constructor_t constructor = NULL; @@ -594,7 +690,7 @@ static int insert_to_device_list(me_device_t *n_device) return 0; } -static void me_remove_pci(struct pci_dev *dev) +static void __devexit me_remove_pci(struct pci_dev *dev) { int vendor_id = dev->vendor; int device_id = dev->device; @@ -1910,11 +2006,16 @@ static int me_ioctl(struct inode *inodep, return -ENOTTY; } +static struct miscdevice me_miscdev = { + .minor = MISC_DYNAMIC_MINOR, + .name = MEMAIN_NAME, + .fops = &me_file_operations, +}; + // Init and exit of module. static int memain_init(void) { int result = 0; - dev_t dev = MKDEV(major, 0); PDEBUG("executed.\n"); @@ -1943,46 +2044,14 @@ static int memain_init(void) } } */ - // Register the character device. - if (major) { - result = register_chrdev_region(dev, 1, MEMAIN_NAME); - } else { - result = alloc_chrdev_region(&dev, 0, 1, MEMAIN_NAME); - major = MAJOR(dev); - } - + result = misc_register(&me_miscdev); if (result < 0) { - PERROR("Can't get major driver no.\n"); + printk(KERN_ERR MEMAIN_NAME ": can't register misc device\n"); goto INIT_ERROR_3; } - cdevp = cdev_alloc(); - - if (!cdevp) { - PERROR("Can't get character device structure.\n"); - result = -ENOMEM; - goto INIT_ERROR_4; - } - - cdevp->ops = &me_file_operations; - - cdevp->owner = THIS_MODULE; - - result = cdev_add(cdevp, dev, 1); - - if (result < 0) { - PERROR("Cannot add character device structure.\n"); - goto INIT_ERROR_5; - } - return 0; - INIT_ERROR_5: - cdev_del(cdevp); - - INIT_ERROR_4: - unregister_chrdev_region(dev, 1); - INIT_ERROR_3: // usb_deregister(&me_usb_driver); @@ -1996,12 +2065,9 @@ static int memain_init(void) static void __exit memain_exit(void) { - dev_t dev = MKDEV(major, 0); - PDEBUG("executed.\n"); - cdev_del(cdevp); - unregister_chrdev_region(dev, 1); + misc_deregister(&me_miscdev); pci_unregister_driver(&me_pci_driver); // usb_deregister(&me_usb_driver); clear_device_list(); diff --git a/drivers/staging/meilhaus/memain.h b/drivers/staging/meilhaus/memain.h index 7616ff7f65cb..48f83679379e 100644 --- a/drivers/staging/meilhaus/memain.h +++ b/drivers/staging/meilhaus/memain.h @@ -28,200 +28,6 @@ #ifdef __KERNEL__ /*============================================================================= - PCI device table. - This is used by modprobe to translate PCI IDs to drivers. - ===========================================================================*/ - -static struct pci_device_id me_pci_table[] __devinitdata = { - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME1000, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME1000_A, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME1000_B, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME1400, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME140A, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME140B, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME14E0, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME14EA, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME14EB, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME140C, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME140D, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME1600_4U, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME1600_8U, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME1600_12U, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME1600_16U, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME1600_16U_8I, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME4610, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME4650, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME4660, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME4660I, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME4670, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME4670I, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME4670S, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME4670IS, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME4680, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME4680I, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME4680S, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME4680IS, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6004, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6008, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME600F, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6014, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6018, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME601F, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6034, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6038, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME603F, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6104, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6108, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME610F, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6114, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6118, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME611F, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6134, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6138, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME613F, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6044, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6048, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME604F, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6054, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6058, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME605F, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6074, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6078, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME607F, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6144, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6148, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME614F, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6154, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6158, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME615F, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6174, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6178, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME617F, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6259, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME6359, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME0630, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME8100_A, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME8100_B, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME8200_A, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME8200_B, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME0940, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME0950, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - {PCI_VENDOR_ID_MEILHAUS, PCI_DEVICE_ID_MEILHAUS_ME0960, PCI_ANY_ID, - PCI_ANY_ID, 0, 0, 0}, - - {0} -}; - -MODULE_DEVICE_TABLE(pci, me_pci_table); - -/*============================================================================= - USB device table. - This is used by modprobe to translate USB IDs to drivers. - ===========================================================================*/ -/* -static struct usb_device_id me_usb_table[] __devinitdata = { - { USB_DEVICE(USB_VENDOR_ID_MEPHISTO_S1, USB_DEVICE_ID_MEPHISTO_S1) }, - { 0 } -}; - -MODULE_DEVICE_TABLE (usb, me_usb_table); -*/ - -/*============================================================================= Templates ===========================================================================*/ |