Staging: comedi: remove comedi-specific wrappers

There are a number of comedi "wrappers" for some RT functions that are
about to go away.  This patch removes all of the wrapper calls within
the comedi drivers and core in order to prepare for removing the RT
comedi code.

Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Greg Kroah-Hartman 2009-04-27 14:44:31 -07:00
parent 81874ff789
commit 5f74ea14c0
86 changed files with 1026 additions and 1061 deletions

View File

@ -728,7 +728,7 @@ static int check_insn_config_length(struct comedi_insn *insn, unsigned int *data
/* by default we allow the insn since we don't have checks for /* by default we allow the insn since we don't have checks for
* all possible cases yet */ * all possible cases yet */
default: default:
rt_printk("comedi: no check for data length of config insn id " printk("comedi: no check for data length of config insn id "
"%i is implemented.\n" "%i is implemented.\n"
" Add a check to %s in %s.\n" " Add a check to %s in %s.\n"
" Assuming n=%i is correct.\n", data[0], __func__, " Assuming n=%i is correct.\n", data[0], __func__,
@ -1219,12 +1219,12 @@ static int do_lock_ioctl(struct comedi_device *dev, unsigned int arg, void *file
return -EINVAL; return -EINVAL;
s = dev->subdevices + arg; s = dev->subdevices + arg;
comedi_spin_lock_irqsave(&s->spin_lock, flags); spin_lock_irqsave(&s->spin_lock, flags);
if (s->busy || s->lock) if (s->busy || s->lock)
ret = -EBUSY; ret = -EBUSY;
else else
s->lock = file; s->lock = file;
comedi_spin_unlock_irqrestore(&s->spin_lock, flags); spin_unlock_irqrestore(&s->spin_lock, flags);
if (ret < 0) if (ret < 0)
return ret; return ret;
@ -1984,8 +1984,7 @@ module_exit(comedi_cleanup);
void comedi_error(const struct comedi_device *dev, const char *s) void comedi_error(const struct comedi_device *dev, const char *s)
{ {
rt_printk("comedi%d: %s: %s\n", dev->minor, dev->driver->driver_name, printk("comedi%d: %s: %s\n", dev->minor, dev->driver->driver_name, s);
s);
} }
void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s) void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s)
@ -2054,10 +2053,10 @@ void comedi_set_subdevice_runflags(struct comedi_subdevice *s, unsigned mask,
{ {
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&s->spin_lock, flags); spin_lock_irqsave(&s->spin_lock, flags);
s->runflags &= ~mask; s->runflags &= ~mask;
s->runflags |= (bits & mask); s->runflags |= (bits & mask);
comedi_spin_unlock_irqrestore(&s->spin_lock, flags); spin_unlock_irqrestore(&s->spin_lock, flags);
} }
unsigned comedi_get_subdevice_runflags(struct comedi_subdevice *s) unsigned comedi_get_subdevice_runflags(struct comedi_subdevice *s)
@ -2065,9 +2064,9 @@ unsigned comedi_get_subdevice_runflags(struct comedi_subdevice *s)
unsigned long flags; unsigned long flags;
unsigned runflags; unsigned runflags;
comedi_spin_lock_irqsave(&s->spin_lock, flags); spin_lock_irqsave(&s->spin_lock, flags);
runflags = s->runflags; runflags = s->runflags;
comedi_spin_unlock_irqrestore(&s->spin_lock, flags); spin_unlock_irqrestore(&s->spin_lock, flags);
return runflags; return runflags;
} }
@ -2125,14 +2124,14 @@ int comedi_alloc_board_minor(struct device *hardware_device)
return -ENOMEM; return -ENOMEM;
} }
comedi_device_init(info->device); comedi_device_init(info->device);
comedi_spin_lock_irqsave(&comedi_file_info_table_lock, flags); spin_lock_irqsave(&comedi_file_info_table_lock, flags);
for (i = 0; i < COMEDI_NUM_BOARD_MINORS; ++i) { for (i = 0; i < COMEDI_NUM_BOARD_MINORS; ++i) {
if (comedi_file_info_table[i] == NULL) { if (comedi_file_info_table[i] == NULL) {
comedi_file_info_table[i] = info; comedi_file_info_table[i] = info;
break; break;
} }
} }
comedi_spin_unlock_irqrestore(&comedi_file_info_table_lock, flags); spin_unlock_irqrestore(&comedi_file_info_table_lock, flags);
if (i == COMEDI_NUM_BOARD_MINORS) { if (i == COMEDI_NUM_BOARD_MINORS) {
comedi_device_cleanup(info->device); comedi_device_cleanup(info->device);
kfree(info->device); kfree(info->device);
@ -2184,10 +2183,10 @@ void comedi_free_board_minor(unsigned minor)
struct comedi_device_file_info *info; struct comedi_device_file_info *info;
BUG_ON(minor >= COMEDI_NUM_BOARD_MINORS); BUG_ON(minor >= COMEDI_NUM_BOARD_MINORS);
comedi_spin_lock_irqsave(&comedi_file_info_table_lock, flags); spin_lock_irqsave(&comedi_file_info_table_lock, flags);
info = comedi_file_info_table[minor]; info = comedi_file_info_table[minor];
comedi_file_info_table[minor] = NULL; comedi_file_info_table[minor] = NULL;
comedi_spin_unlock_irqrestore(&comedi_file_info_table_lock, flags); spin_unlock_irqrestore(&comedi_file_info_table_lock, flags);
if (info) { if (info) {
struct comedi_device *dev = info->device; struct comedi_device *dev = info->device;
@ -2218,14 +2217,14 @@ int comedi_alloc_subdevice_minor(struct comedi_device *dev,
info->device = dev; info->device = dev;
info->read_subdevice = s; info->read_subdevice = s;
info->write_subdevice = s; info->write_subdevice = s;
comedi_spin_lock_irqsave(&comedi_file_info_table_lock, flags); spin_lock_irqsave(&comedi_file_info_table_lock, flags);
for (i = COMEDI_FIRST_SUBDEVICE_MINOR; i < COMEDI_NUM_MINORS; ++i) { for (i = COMEDI_FIRST_SUBDEVICE_MINOR; i < COMEDI_NUM_MINORS; ++i) {
if (comedi_file_info_table[i] == NULL) { if (comedi_file_info_table[i] == NULL) {
comedi_file_info_table[i] = info; comedi_file_info_table[i] = info;
break; break;
} }
} }
comedi_spin_unlock_irqrestore(&comedi_file_info_table_lock, flags); spin_unlock_irqrestore(&comedi_file_info_table_lock, flags);
if (i == COMEDI_NUM_MINORS) { if (i == COMEDI_NUM_MINORS) {
kfree(info); kfree(info);
printk(KERN_ERR "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");
@ -2283,10 +2282,10 @@ void comedi_free_subdevice_minor(struct comedi_subdevice *s)
BUG_ON(s->minor >= COMEDI_NUM_MINORS); BUG_ON(s->minor >= COMEDI_NUM_MINORS);
BUG_ON(s->minor < COMEDI_FIRST_SUBDEVICE_MINOR); BUG_ON(s->minor < COMEDI_FIRST_SUBDEVICE_MINOR);
comedi_spin_lock_irqsave(&comedi_file_info_table_lock, flags); spin_lock_irqsave(&comedi_file_info_table_lock, flags);
info = comedi_file_info_table[s->minor]; info = comedi_file_info_table[s->minor];
comedi_file_info_table[s->minor] = NULL; comedi_file_info_table[s->minor] = NULL;
comedi_spin_unlock_irqrestore(&comedi_file_info_table_lock, flags); spin_unlock_irqrestore(&comedi_file_info_table_lock, flags);
if (s->class_dev) { if (s->class_dev) {
device_destroy(comedi_class, MKDEV(COMEDI_MAJOR, s->minor)); device_destroy(comedi_class, MKDEV(COMEDI_MAJOR, s->minor));
@ -2301,9 +2300,9 @@ struct comedi_device_file_info *comedi_get_device_file_info(unsigned minor)
struct comedi_device_file_info *info; struct comedi_device_file_info *info;
BUG_ON(minor >= COMEDI_NUM_MINORS); BUG_ON(minor >= COMEDI_NUM_MINORS);
comedi_spin_lock_irqsave(&comedi_file_info_table_lock, flags); spin_lock_irqsave(&comedi_file_info_table_lock, flags);
info = comedi_file_info_table[minor]; info = comedi_file_info_table[minor];
comedi_spin_unlock_irqrestore(&comedi_file_info_table_lock, flags); spin_unlock_irqrestore(&comedi_file_info_table_lock, flags);
return info; return info;
} }

View File

@ -554,7 +554,7 @@ unsigned int comedi_buf_munge(struct comedi_async *async, unsigned int num_bytes
block_size = num_bytes - count; block_size = num_bytes - count;
if (block_size < 0) { if (block_size < 0) {
rt_printk("%s: %s: bug! block_size is negative\n", printk("%s: %s: bug! block_size is negative\n",
__FILE__, __func__); __FILE__, __func__);
break; break;
} }
@ -633,8 +633,7 @@ unsigned comedi_buf_write_free(struct comedi_async *async, unsigned int nbytes)
{ {
if ((int)(async->buf_write_count + nbytes - if ((int)(async->buf_write_count + nbytes -
async->buf_write_alloc_count) > 0) { async->buf_write_alloc_count) > 0) {
rt_printk printk("comedi: attempted to write-free more bytes than have been write-allocated.\n");
("comedi: attempted to write-free more bytes than have been write-allocated.\n");
nbytes = async->buf_write_alloc_count - async->buf_write_count; nbytes = async->buf_write_alloc_count - async->buf_write_count;
} }
async->buf_write_count += nbytes; async->buf_write_count += nbytes;
@ -667,8 +666,7 @@ unsigned comedi_buf_read_free(struct comedi_async *async, unsigned int nbytes)
smp_mb(); smp_mb();
if ((int)(async->buf_read_count + nbytes - if ((int)(async->buf_read_count + nbytes -
async->buf_read_alloc_count) > 0) { async->buf_read_alloc_count) > 0) {
rt_printk printk("comedi: attempted to read-free more bytes than have been read-allocated.\n");
("comedi: attempted to read-free more bytes than have been read-allocated.\n");
nbytes = async->buf_read_alloc_count - async->buf_read_count; nbytes = async->buf_read_alloc_count - async->buf_read_count;
} }
async->buf_read_count += nbytes; async->buf_read_count += nbytes;

View File

@ -343,7 +343,7 @@ int i_find_free_pci_card_by_position(unsigned short vendor_id,
*card = amcc; *card = amcc;
return 0; /* ok, card is found */ return 0; /* ok, card is found */
} else { } else {
rt_printk(" - \nCard on requested position is used b:s %d:%d!\n", printk(" - \nCard on requested position is used b:s %d:%d!\n",
pci_bus, pci_slot); pci_bus, pci_slot);
return 2; /* card exist but is used */ return 2; /* card exist but is used */
} }
@ -447,7 +447,7 @@ struct pcilst_struct *ptr_select_and_alloc_pci_card(unsigned short vendor_id,
/* use autodetection */ /* use autodetection */
card = ptr_find_free_pci_card_by_device(vendor_id, device_id); card = ptr_find_free_pci_card_by_device(vendor_id, device_id);
if (card == NULL) { if (card == NULL) {
rt_printk(" - Unused card not found in system!\n"); printk(" - Unused card not found in system!\n");
return NULL; return NULL;
} }
} else { } else {
@ -455,18 +455,18 @@ struct pcilst_struct *ptr_select_and_alloc_pci_card(unsigned short vendor_id,
pci_bus, pci_slot, pci_bus, pci_slot,
&card)) { &card)) {
case 1: case 1:
rt_printk(" - Card not found on requested position b:s %d:%d!\n", printk(" - Card not found on requested position b:s %d:%d!\n",
pci_bus, pci_slot); pci_bus, pci_slot);
return NULL; return NULL;
case 2: case 2:
rt_printk(" - Card on requested position is used b:s %d:%d!\n", printk(" - Card on requested position is used b:s %d:%d!\n",
pci_bus, pci_slot); pci_bus, pci_slot);
return NULL; return NULL;
} }
} }
if (pci_card_alloc(card, i_Master) != 0) { if (pci_card_alloc(card, i_Master) != 0) {
rt_printk(" - Can't allocate card!\n"); printk(" - Can't allocate card!\n");
return NULL; return NULL;
} }

View File

@ -2583,7 +2583,7 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it)
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; pci_list_builded = 1;
} }
/* rt_printk("comedi%d: addi_common: board=%s",dev->minor,this_board->pc_DriverName); */ /* printk("comedi%d: addi_common: board=%s",dev->minor,this_board->pc_DriverName); */
if ((this_board->i_Dma) && (it->options[2] == 0)) { if ((this_board->i_Dma) && (it->options[2] == 0)) {
i_Dma = 1; i_Dma = 1;
@ -2648,16 +2648,16 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it)
/* ## */ /* ## */
if (irq > 0) { if (irq > 0) {
if (comedi_request_irq(irq, v_ADDI_Interrupt, IRQF_SHARED, if (request_irq(irq, v_ADDI_Interrupt, IRQF_SHARED,
c_Identifier, dev) < 0) { c_Identifier, dev) < 0) {
printk(", unable to allocate IRQ %u, DISABLING IT", printk(", unable to allocate IRQ %u, DISABLING IT",
irq); irq);
irq = 0; /* Can't use IRQ */ irq = 0; /* Can't use IRQ */
} else { } else {
rt_printk("\nirq=%u", irq); printk("\nirq=%u", irq);
} }
} else { } else {
rt_printk(", IRQ disabled"); printk(", IRQ disabled");
} }
printk("\nOption %d %d %d\n", it->options[0], it->options[1], printk("\nOption %d %d %d\n", it->options[0], it->options[1],
@ -2719,7 +2719,7 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it)
} }
} }
if (!devpriv->ul_DmaBufferVirtual[0]) { if (!devpriv->ul_DmaBufferVirtual[0]) {
rt_printk printk
(", Can't allocate DMA buffer, DMA disabled!"); (", Can't allocate DMA buffer, DMA disabled!");
devpriv->us_UseDma = ADDI_DISABLE; devpriv->us_UseDma = ADDI_DISABLE;
} }
@ -2730,7 +2730,7 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it)
} }
if ((devpriv->us_UseDma == ADDI_ENABLE)) { if ((devpriv->us_UseDma == ADDI_ENABLE)) {
rt_printk("\nDMA ENABLED\n"); printk("\nDMA ENABLED\n");
} else { } else {
printk("\nDMA DISABLED\n"); printk("\nDMA DISABLED\n");
} }
@ -2937,7 +2937,7 @@ static int i_ADDI_Detach(struct comedi_device *dev)
} }
if (dev->irq) { if (dev->irq) {
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
} }
if ((devpriv->ps_BoardInfo->pc_EepromChip == NULL) if ((devpriv->ps_BoardInfo->pc_EepromChip == NULL)

View File

@ -335,7 +335,7 @@ int i_find_free_pci_card_by_position(unsigned short vendor_id,
*card = amcc; *card = amcc;
return 0; /* ok, card is found */ return 0; /* ok, card is found */
} else { } else {
rt_printk printk
(" - \nCard on requested position is used b:s %d:%d!\n", (" - \nCard on requested position is used b:s %d:%d!\n",
pci_bus, pci_slot); pci_bus, pci_slot);
return 2; /* card exist but is used */ return 2; /* card exist but is used */
@ -425,7 +425,7 @@ struct pcilst_struct *ptr_select_and_alloc_pci_card(unsigned short vendor_id,
if ((pci_bus < 1) & (pci_slot < 1)) { /* use autodetection */ if ((pci_bus < 1) & (pci_slot < 1)) { /* use autodetection */
card = ptr_find_free_pci_card_by_device(vendor_id, device_id); card = ptr_find_free_pci_card_by_device(vendor_id, device_id);
if (card == NULL) { if (card == NULL) {
rt_printk(" - Unused card not found in system!\n"); printk(" - Unused card not found in system!\n");
return NULL; return NULL;
} }
} else { } else {
@ -433,12 +433,12 @@ struct pcilst_struct *ptr_select_and_alloc_pci_card(unsigned short vendor_id,
pci_bus, pci_slot, pci_bus, pci_slot,
&card)) { &card)) {
case 1: case 1:
rt_printk printk
(" - Card not found on requested position b:s %d:%d!\n", (" - Card not found on requested position b:s %d:%d!\n",
pci_bus, pci_slot); pci_bus, pci_slot);
return NULL; return NULL;
case 2: case 2:
rt_printk printk
(" - Card on requested position is used b:s %d:%d!\n", (" - Card on requested position is used b:s %d:%d!\n",
pci_bus, pci_slot); pci_bus, pci_slot);
return NULL; return NULL;
@ -446,7 +446,7 @@ struct pcilst_struct *ptr_select_and_alloc_pci_card(unsigned short vendor_id,
} }
if (i_pci_card_alloc(card) != 0) { if (i_pci_card_alloc(card) != 0) {
rt_printk(" - Can't allocate card!\n"); printk(" - Can't allocate card!\n");
return NULL; return NULL;
} }

View File

@ -2637,7 +2637,7 @@ int i_APCI3120_InsnWriteAnalogOutput(struct comedi_device *dev,
} }
/* /*
* out put n values at the given channel. rt_printk("\nwaiting for * out put n values at the given channel. printk("\nwaiting for
* DA_READY BIT"); * DA_READY BIT");
*/ */
do /* Waiting of DA_READY BIT */ do /* Waiting of DA_READY BIT */

View File

@ -420,7 +420,7 @@ static void pci9111_timer_set(struct comedi_device *dev)
PCI9111_8254_READ_LOAD_LSB_MSB | PCI9111_8254_READ_LOAD_LSB_MSB |
PCI9111_8254_MODE_2 | PCI9111_8254_BINARY_COUNTER); PCI9111_8254_MODE_2 | PCI9111_8254_BINARY_COUNTER);
comedi_udelay(1); udelay(1);
pci9111_8254_counter_2_set(dev_private->timer_divisor_2); pci9111_8254_counter_2_set(dev_private->timer_divisor_2);
pci9111_8254_counter_1_set(dev_private->timer_divisor_1); pci9111_8254_counter_1_set(dev_private->timer_divisor_1);
@ -901,7 +901,7 @@ static irqreturn_t pci9111_interrupt(int irq, void *p_device)
async = subdevice->async; async = subdevice->async;
comedi_spin_lock_irqsave(&dev->spinlock, irq_flags); spin_lock_irqsave(&dev->spinlock, irq_flags);
/* Check if we are source of interrupt */ /* Check if we are source of interrupt */
intcsr = inb(dev_private->lcr_io_base + intcsr = inb(dev_private->lcr_io_base +
@ -919,7 +919,7 @@ static irqreturn_t pci9111_interrupt(int irq, void *p_device)
PLX9050_LINTI2_STATUS))))) { PLX9050_LINTI2_STATUS))))) {
/* Not the source of the interrupt. */ /* Not the source of the interrupt. */
/* (N.B. not using PLX9050_SOFTWARE_INTERRUPT) */ /* (N.B. not using PLX9050_SOFTWARE_INTERRUPT) */
comedi_spin_unlock_irqrestore(&dev->spinlock, irq_flags); spin_unlock_irqrestore(&dev->spinlock, irq_flags);
return IRQ_NONE; return IRQ_NONE;
} }
@ -928,7 +928,7 @@ static irqreturn_t pci9111_interrupt(int irq, void *p_device)
/* Interrupt comes from fifo_half-full signal */ /* Interrupt comes from fifo_half-full signal */
if (pci9111_is_fifo_full()) { if (pci9111_is_fifo_full()) {
comedi_spin_unlock_irqrestore(&dev->spinlock, spin_unlock_irqrestore(&dev->spinlock,
irq_flags); irq_flags);
comedi_error(dev, PCI9111_DRIVER_NAME " fifo overflow"); comedi_error(dev, PCI9111_DRIVER_NAME " fifo overflow");
pci9111_interrupt_clear(); pci9111_interrupt_clear();
@ -1028,7 +1028,7 @@ static irqreturn_t pci9111_interrupt(int irq, void *p_device)
pci9111_interrupt_clear(); pci9111_interrupt_clear();
comedi_spin_unlock_irqrestore(&dev->spinlock, irq_flags); spin_unlock_irqrestore(&dev->spinlock, irq_flags);
comedi_event(dev, subdevice); comedi_event(dev, subdevice);
@ -1298,8 +1298,7 @@ static int pci9111_attach(struct comedi_device *dev, struct comedi_devconfig *it
dev->irq = 0; dev->irq = 0;
if (pci_device->irq > 0) { if (pci_device->irq > 0) {
if (comedi_request_irq(pci_device->irq, if (request_irq(pci_device->irq, pci9111_interrupt,
pci9111_interrupt,
IRQF_SHARED, PCI9111_DRIVER_NAME, dev) != 0) { IRQF_SHARED, PCI9111_DRIVER_NAME, dev) != 0) {
printk("comedi%d: unable to allocate irq %u\n", printk("comedi%d: unable to allocate irq %u\n",
dev->minor, pci_device->irq); dev->minor, pci_device->irq);
@ -1379,7 +1378,7 @@ static int pci9111_detach(struct comedi_device *dev)
/* Release previously allocated irq */ /* Release previously allocated irq */
if (dev->irq != 0) { if (dev->irq != 0) {
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
} }
if (dev_private != 0 && dev_private->pci_device != 0) { if (dev_private != 0 && dev_private->pci_device != 0) {

View File

@ -80,7 +80,7 @@ Configuration options:
#undef DPRINTK #undef DPRINTK
#ifdef PCI9118_EXTDEBUG #ifdef PCI9118_EXTDEBUG
#define DPRINTK(fmt, args...) rt_printk(fmt, ## args) #define DPRINTK(fmt, args...) printk(fmt, ## args)
#else #else
#define DPRINTK(fmt, args...) #define DPRINTK(fmt, args...)
#endif #endif
@ -345,12 +345,12 @@ static int pci9118_insn_read_ai(struct comedi_device *dev, struct comedi_subdevi
for (n = 0; n < insn->n; n++) { for (n = 0; n < insn->n; n++) {
outw(0, dev->iobase + PCI9118_SOFTTRG); /* start conversion */ outw(0, dev->iobase + PCI9118_SOFTTRG); /* start conversion */
comedi_udelay(2); udelay(2);
timeout = 100; timeout = 100;
while (timeout--) { while (timeout--) {
if (inl(dev->iobase + PCI9118_ADSTAT) & AdStatus_ADrdy) if (inl(dev->iobase + PCI9118_ADSTAT) & AdStatus_ADrdy)
goto conv_finish; goto conv_finish;
comedi_udelay(1); udelay(1);
} }
comedi_error(dev, "A/D insn timeout"); comedi_error(dev, "A/D insn timeout");
@ -569,7 +569,7 @@ static void interrupt_pci9118_ai_onesample(struct comedi_device *dev,
#ifdef PCI9118_PARANOIDCHECK #ifdef PCI9118_PARANOIDCHECK
if (devpriv->ai16bits == 0) { 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 printk
("comedi: A/D SAMPL - data dropout: received channel %d, expected %d!\n", ("comedi: A/D SAMPL - data dropout: received channel %d, expected %d!\n",
sampl & 0x000f, sampl & 0x000f,
devpriv->chanlist[s->async->cur_chan]); devpriv->chanlist[s->async->cur_chan]);
@ -950,11 +950,11 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice
if (cmd->scan_begin_src == TRIG_TIMER) { if (cmd->scan_begin_src == TRIG_TIMER) {
tmp = cmd->scan_begin_arg; tmp = cmd->scan_begin_arg;
/* rt_printk("S1 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg); */ /* printk("S1 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg); */
i8253_cascade_ns_to_timer(devpriv->i8254_osc_base, &divisor1, i8253_cascade_ns_to_timer(devpriv->i8254_osc_base, &divisor1,
&divisor2, &cmd->scan_begin_arg, &divisor2, &cmd->scan_begin_arg,
cmd->flags & TRIG_ROUND_MASK); cmd->flags & TRIG_ROUND_MASK);
/* rt_printk("S2 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg); */ /* printk("S2 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg); */
if (cmd->scan_begin_arg < this_board->ai_ns_min) if (cmd->scan_begin_arg < this_board->ai_ns_min)
cmd->scan_begin_arg = this_board->ai_ns_min; cmd->scan_begin_arg = this_board->ai_ns_min;
if (tmp != cmd->scan_begin_arg) if (tmp != cmd->scan_begin_arg)
@ -966,7 +966,7 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice
i8253_cascade_ns_to_timer(devpriv->i8254_osc_base, &divisor1, i8253_cascade_ns_to_timer(devpriv->i8254_osc_base, &divisor1,
&divisor2, &cmd->convert_arg, &divisor2, &cmd->convert_arg,
cmd->flags & TRIG_ROUND_MASK); cmd->flags & TRIG_ROUND_MASK);
/* rt_printk("s1 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg); */ /* printk("s1 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg); */
if (cmd->convert_arg < this_board->ai_ns_min) if (cmd->convert_arg < this_board->ai_ns_min)
cmd->convert_arg = this_board->ai_ns_min; cmd->convert_arg = this_board->ai_ns_min;
if (tmp != cmd->convert_arg) if (tmp != cmd->convert_arg)
@ -980,7 +980,7 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice
cmd->scan_begin_arg = cmd->scan_begin_arg =
this_board->ai_ns_min * this_board->ai_ns_min *
(cmd->scan_end_arg + 2); (cmd->scan_end_arg + 2);
/* rt_printk("s2 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg); */ /* printk("s2 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg); */
err++; err++;
} }
} else { } else {
@ -989,7 +989,7 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice
cmd->scan_begin_arg = cmd->scan_begin_arg =
cmd->convert_arg * cmd->convert_arg *
cmd->chanlist_len; cmd->chanlist_len;
/* rt_printk("s3 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg); */ /* printk("s3 timer1=%u timer2=%u\n",cmd->scan_begin_arg,cmd->convert_arg); */
err++; err++;
} }
} }
@ -1033,7 +1033,7 @@ static int Compute_and_setup_dma(struct comedi_device *dev)
if (dmalen0 < (devpriv->ai_n_realscanlen << 1)) { 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); devpriv->ai_flags &= (~TRIG_WAKE_EOS);
rt_printk printk
("comedi%d: WAR: DMA0 buf too short, cann't support TRIG_WAKE_EOS (%d<%d)\n", ("comedi%d: WAR: DMA0 buf too short, cann't support TRIG_WAKE_EOS (%d<%d)\n",
dev->minor, dmalen0, dev->minor, dmalen0,
devpriv->ai_n_realscanlen << 1); devpriv->ai_n_realscanlen << 1);
@ -1044,7 +1044,7 @@ static int Compute_and_setup_dma(struct comedi_device *dev)
if (devpriv->useeoshandle) if (devpriv->useeoshandle)
dmalen0 += 2; dmalen0 += 2;
if (dmalen0 < 4) { if (dmalen0 < 4) {
rt_printk printk
("comedi%d: ERR: DMA0 buf len bug? (%d<4)\n", ("comedi%d: ERR: DMA0 buf len bug? (%d<4)\n",
dev->minor, dmalen0); dev->minor, dmalen0);
dmalen0 = 4; dmalen0 = 4;
@ -1055,7 +1055,7 @@ static int Compute_and_setup_dma(struct comedi_device *dev)
if (dmalen1 < (devpriv->ai_n_realscanlen << 1)) { 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); devpriv->ai_flags &= (~TRIG_WAKE_EOS);
rt_printk printk
("comedi%d: WAR: DMA1 buf too short, cann't support TRIG_WAKE_EOS (%d<%d)\n", ("comedi%d: WAR: DMA1 buf too short, cann't support TRIG_WAKE_EOS (%d<%d)\n",
dev->minor, dmalen1, dev->minor, dmalen1,
devpriv->ai_n_realscanlen << 1); devpriv->ai_n_realscanlen << 1);
@ -1066,7 +1066,7 @@ static int Compute_and_setup_dma(struct comedi_device *dev)
if (devpriv->useeoshandle) if (devpriv->useeoshandle)
dmalen1 -= 2; dmalen1 -= 2;
if (dmalen1 < 4) { if (dmalen1 < 4) {
rt_printk printk
("comedi%d: ERR: DMA1 buf len bug? (%d<4)\n", ("comedi%d: ERR: DMA1 buf len bug? (%d<4)\n",
dev->minor, dmalen1); dev->minor, dmalen1);
dmalen1 = 4; dmalen1 = 4;
@ -1464,7 +1464,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); 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); outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC);
comedi_udelay(1); udelay(1);
outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */
inl(dev->iobase + PCI9118_ADSTAT); /* flush A/D and INT status register */ inl(dev->iobase + PCI9118_ADSTAT); /* flush A/D and INT status register */
inl(dev->iobase + PCI9118_INTSRC); inl(dev->iobase + PCI9118_INTSRC);
@ -1497,7 +1497,7 @@ static int check_channel_list(struct comedi_device *dev, struct comedi_subdevice
return 0; return 0;
} }
if ((frontadd + n_chan + backadd) > s->len_chanlist) { if ((frontadd + n_chan + backadd) > s->len_chanlist) {
rt_printk printk
("comedi%d: range/channel list is too long for actual configuration (%d>%d)!", ("comedi%d: range/channel list is too long for actual configuration (%d>%d)!",
dev->minor, n_chan, dev->minor, n_chan,
s->len_chanlist - frontadd - backadd); s->len_chanlist - frontadd - backadd);
@ -1641,7 +1641,7 @@ static int setup_channel_list(struct comedi_device *dev, struct comedi_subdevice
#endif #endif
#endif #endif
outl(0, dev->iobase + PCI9118_SCANMOD); /* close scan queue */ outl(0, dev->iobase + PCI9118_SCANMOD); /* close scan queue */
/* comedi_udelay(100); important delay, or first sample will be cripled */ /* udelay(100); important delay, or first sample will be cripled */
DPRINTK("adl_pci9118 EDBG: END: setup_channel_list()\n"); 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 */
@ -1716,7 +1716,7 @@ static void start_pacer(struct comedi_device *dev, int mode, unsigned int diviso
outl(0x74, dev->iobase + PCI9118_CNTCTRL); outl(0x74, dev->iobase + PCI9118_CNTCTRL);
outl(0xb4, 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); udelay(1);
if ((mode == 1) || (mode == 2) || (mode == 4)) { if ((mode == 1) || (mode == 2) || (mode == 4)) {
outl(divisor2 & 0xff, dev->iobase + PCI9118_CNT2); outl(divisor2 & 0xff, dev->iobase + PCI9118_CNT2);
@ -1817,7 +1817,7 @@ static int pci9118_reset(struct comedi_device *dev)
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(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); udelay(10);
inl(dev->iobase + PCI9118_AD_DATA); inl(dev->iobase + PCI9118_AD_DATA);
outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */
outl(0, dev->iobase + PCI9118_INTSRC); /* remove INT requests */ outl(0, dev->iobase + PCI9118_INTSRC); /* remove INT requests */
@ -1848,7 +1848,7 @@ static int pci9118_attach(struct comedi_device *dev, struct comedi_devconfig *it
unsigned char pci_bus, pci_slot, pci_func; unsigned char pci_bus, pci_slot, pci_func;
u16 u16w; u16 u16w;
rt_printk("comedi%d: adl_pci9118: board=%s", dev->minor, printk("comedi%d: adl_pci9118: board=%s", dev->minor,
this_board->name); this_board->name);
opt_bus = it->options[0]; opt_bus = it->options[0];
@ -1861,7 +1861,7 @@ static int pci9118_attach(struct comedi_device *dev, struct comedi_devconfig *it
ret = alloc_private(dev, sizeof(struct pci9118_private)); ret = alloc_private(dev, sizeof(struct pci9118_private));
if (ret < 0) { if (ret < 0) {
rt_printk(" - Allocation failed!\n"); printk(" - Allocation failed!\n");
return -ENOMEM; return -ENOMEM;
} }
@ -1890,10 +1890,10 @@ static int pci9118_attach(struct comedi_device *dev, struct comedi_devconfig *it
if (!pcidev) { if (!pcidev) {
if (opt_bus || opt_slot) { if (opt_bus || opt_slot) {
rt_printk(" - Card at b:s %d:%d %s\n", printk(" - Card at b:s %d:%d %s\n",
opt_bus, opt_slot, errstr); opt_bus, opt_slot, errstr);
} else { } else {
rt_printk(" - Card %s\n", errstr); printk(" - Card %s\n", errstr);
} }
return -EIO; return -EIO;
} }
@ -1909,7 +1909,7 @@ static int pci9118_attach(struct comedi_device *dev, struct comedi_devconfig *it
iobase_a = pci_resource_start(pcidev, 0); iobase_a = pci_resource_start(pcidev, 0);
iobase_9 = pci_resource_start(pcidev, 2); iobase_9 = pci_resource_start(pcidev, 2);
rt_printk(", b:s:f=%d:%d:%d, io=0x%4lx, 0x%4lx", pci_bus, pci_slot, printk(", b:s:f=%d:%d:%d, io=0x%4lx, 0x%4lx", pci_bus, pci_slot,
pci_func, iobase_9, iobase_a); pci_func, iobase_9, iobase_a);
dev->iobase = iobase_9; dev->iobase = iobase_9;
@ -1923,16 +1923,16 @@ static int pci9118_attach(struct comedi_device *dev, struct comedi_devconfig *it
if (it->options[3] & 2) 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 (irq > 0) {
if (comedi_request_irq(irq, interrupt_pci9118, IRQF_SHARED, if (request_irq(irq, interrupt_pci9118, IRQF_SHARED,
"ADLink PCI-9118", dev)) { "ADLink PCI-9118", dev)) {
rt_printk(", unable to allocate IRQ %d, DISABLING IT", printk(", unable to allocate IRQ %d, DISABLING IT",
irq); irq);
irq = 0; /* Can't use IRQ */ irq = 0; /* Can't use IRQ */
} else { } else {
rt_printk(", irq=%u", irq); printk(", irq=%u", irq);
} }
} else { } else {
rt_printk(", IRQ disabled"); printk(", IRQ disabled");
} }
dev->irq = irq; dev->irq = irq;
@ -1958,7 +1958,7 @@ static int pci9118_attach(struct comedi_device *dev, struct comedi_devconfig *it
} }
} }
if (!devpriv->dmabuf_virt[0]) { if (!devpriv->dmabuf_virt[0]) {
rt_printk(", Can't allocate DMA buffer, DMA disabled!"); printk(", Can't allocate DMA buffer, DMA disabled!");
master = 0; master = 0;
} }
@ -1969,9 +1969,9 @@ static int pci9118_attach(struct comedi_device *dev, struct comedi_devconfig *it
devpriv->master = master; devpriv->master = master;
if (devpriv->master) if (devpriv->master)
rt_printk(", bus master"); printk(", bus master");
else else
rt_printk(", no bus master"); printk(", no bus master");
devpriv->usemux = 0; devpriv->usemux = 0;
if (it->options[2] > 0) { if (it->options[2] > 0) {
@ -1982,7 +1982,7 @@ static int pci9118_attach(struct comedi_device *dev, struct comedi_devconfig *it
if (devpriv->usemux > 128) { 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); printk(", ext. mux %d channels", devpriv->usemux);
} }
devpriv->softsshdelay = it->options[4]; devpriv->softsshdelay = it->options[4];
@ -1995,7 +1995,7 @@ static int pci9118_attach(struct comedi_device *dev, struct comedi_devconfig *it
devpriv->softsshhold = 0x80; devpriv->softsshhold = 0x80;
} }
rt_printk(".\n"); printk(".\n");
pci_read_config_word(devpriv->pcidev, PCI_COMMAND, &u16w); 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 */
@ -2081,7 +2081,7 @@ static int pci9118_detach(struct comedi_device *dev)
if (devpriv->valid) if (devpriv->valid)
pci9118_reset(dev); pci9118_reset(dev);
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (devpriv->pcidev) { if (devpriv->pcidev) {
if (dev->iobase) { if (dev->iobase) {
comedi_pci_disable(devpriv->pcidev); comedi_pci_disable(devpriv->pcidev);

View File

@ -325,7 +325,7 @@ static int adq12b_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s
channel = CR_CHAN(insn->chanspec); channel = CR_CHAN(insn->chanspec);
if (channel != devpriv->last_channel || range != devpriv->last_range) { if (channel != devpriv->last_channel || range != devpriv->last_range) {
outb((range << 4) | channel, dev->iobase + ADQ12B_CTREG); outb((range << 4) | channel, dev->iobase + ADQ12B_CTREG);
comedi_udelay(50); /* wait for the mux to settle */ udelay(50); /* wait for the mux to settle */
} }
/* trigger conversion */ /* trigger conversion */
@ -337,7 +337,7 @@ static int adq12b_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s
/* wait for end of convertion */ /* wait for end of convertion */
i = 0; i = 0;
do { do {
/* comedi_udelay(1); */ /* udelay(1); */
status = inb(dev->iobase + ADQ12B_STINR); status = inb(dev->iobase + ADQ12B_STINR);
status = status & ADQ12B_EOC; status = status & ADQ12B_EOC;
} while (status == 0 && ++i < TIMEOUT); } while (status == 0 && ++i < TIMEOUT);
@ -347,7 +347,7 @@ static int adq12b_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s
hi = inb(dev->iobase + ADQ12B_ADHIG); hi = inb(dev->iobase + ADQ12B_ADHIG);
lo = inb(dev->iobase + ADQ12B_ADLOW); lo = inb(dev->iobase + ADQ12B_ADLOW);
/* rt_printk("debug: chan=%d range=%d status=%d hi=%d lo=%d\n", channel, range, status, hi, lo); */ /* printk("debug: chan=%d range=%d status=%d hi=%d lo=%d\n", channel, range, status, hi, lo); */
data[n] = (hi << 8) | lo; data[n] = (hi << 8) | lo;
} }

View File

@ -58,7 +58,7 @@ Configuration options:
#undef DPRINTK #undef DPRINTK
#ifdef PCI171X_EXTDEBUG #ifdef PCI171X_EXTDEBUG
#define DPRINTK(fmt, args...) rt_printk(fmt, ## args) #define DPRINTK(fmt, args...) printk(fmt, ## args)
#else #else
#define DPRINTK(fmt, args...) #define DPRINTK(fmt, args...)
#endif #endif
@ -348,7 +348,7 @@ static int pci171x_insn_read_ai(struct comedi_device *dev, struct comedi_subdevi
outw(0, dev->iobase + PCI171x_SOFTTRG); /* start conversion */ outw(0, dev->iobase + PCI171x_SOFTTRG); /* start conversion */
DPRINTK("adv_pci1710 B n=%d ST=%4x\n", n, DPRINTK("adv_pci1710 B n=%d ST=%4x\n", n,
inw(dev->iobase + PCI171x_STATUS)); inw(dev->iobase + PCI171x_STATUS));
/* comedi_udelay(1); */ /* udelay(1); */
DPRINTK("adv_pci1710 C n=%d ST=%4x\n", n, DPRINTK("adv_pci1710 C n=%d ST=%4x\n", n,
inw(dev->iobase + PCI171x_STATUS)); inw(dev->iobase + PCI171x_STATUS));
timeout = 100; timeout = 100;
@ -588,14 +588,14 @@ static void interrupt_pci1710_every_sample(void *d)
DPRINTK("adv_pci1710 EDBG: BGN: interrupt_pci1710_every_sample(...)\n"); DPRINTK("adv_pci1710 EDBG: BGN: interrupt_pci1710_every_sample(...)\n");
m = inw(dev->iobase + PCI171x_STATUS); m = inw(dev->iobase + PCI171x_STATUS);
if (m & Status_FE) { if (m & Status_FE) {
rt_printk("comedi%d: A/D FIFO empty (%4x)\n", dev->minor, m); printk("comedi%d: A/D FIFO empty (%4x)\n", dev->minor, m);
pci171x_ai_cancel(dev, s); pci171x_ai_cancel(dev, s);
s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
comedi_event(dev, s); comedi_event(dev, s);
return; return;
} }
if (m & Status_FF) { if (m & Status_FF) {
rt_printk printk
("comedi%d: A/D FIFO Full status (Fatal Error!) (%4x)\n", ("comedi%d: A/D FIFO Full status (Fatal Error!) (%4x)\n",
dev->minor, m); dev->minor, m);
pci171x_ai_cancel(dev, s); pci171x_ai_cancel(dev, s);
@ -614,7 +614,7 @@ static void interrupt_pci1710_every_sample(void *d)
if (this_board->cardtype != TYPE_PCI1713) if (this_board->cardtype != TYPE_PCI1713)
if ((sampl & 0xf000) != if ((sampl & 0xf000) !=
devpriv->act_chanlist[s->async->cur_chan]) { devpriv->act_chanlist[s->async->cur_chan]) {
rt_printk printk
("comedi: A/D data dropout: received data from channel %d, expected %d!\n", ("comedi: A/D data dropout: received data from channel %d, expected %d!\n",
(sampl & 0xf000) >> 12, (sampl & 0xf000) >> 12,
(devpriv->act_chanlist[s->async-> (devpriv->act_chanlist[s->async->
@ -676,7 +676,7 @@ static int move_block_from_fifo(struct comedi_device *dev, struct comedi_subdevi
sampl = inw(dev->iobase + PCI171x_AD_DATA); sampl = inw(dev->iobase + PCI171x_AD_DATA);
if (this_board->cardtype != TYPE_PCI1713) if (this_board->cardtype != TYPE_PCI1713)
if ((sampl & 0xf000) != devpriv->act_chanlist[j]) { if ((sampl & 0xf000) != devpriv->act_chanlist[j]) {
rt_printk printk
("comedi%d: A/D FIFO data dropout: received data from channel %d, expected %d! (%d/%d/%d/%d/%d/%4x)\n", ("comedi%d: A/D FIFO data dropout: received data from channel %d, expected %d! (%d/%d/%d/%d/%d/%4x)\n",
dev->minor, (sampl & 0xf000) >> 12, dev->minor, (sampl & 0xf000) >> 12,
(devpriv-> (devpriv->
@ -716,7 +716,7 @@ static void interrupt_pci1710_half_fifo(void *d)
DPRINTK("adv_pci1710 EDBG: BGN: interrupt_pci1710_half_fifo(...)\n"); DPRINTK("adv_pci1710 EDBG: BGN: interrupt_pci1710_half_fifo(...)\n");
m = inw(dev->iobase + PCI171x_STATUS); m = inw(dev->iobase + PCI171x_STATUS);
if (!(m & Status_FH)) { if (!(m & Status_FH)) {
rt_printk("comedi%d: A/D FIFO not half full! (%4x)\n", printk("comedi%d: A/D FIFO not half full! (%4x)\n",
dev->minor, m); dev->minor, m);
pci171x_ai_cancel(dev, s); pci171x_ai_cancel(dev, s);
s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
@ -724,7 +724,7 @@ static void interrupt_pci1710_half_fifo(void *d)
return; return;
} }
if (m & Status_FF) { if (m & Status_FF) {
rt_printk printk
("comedi%d: A/D FIFO Full status (Fatal Error!) (%4x)\n", ("comedi%d: A/D FIFO Full status (Fatal Error!) (%4x)\n",
dev->minor, m); dev->minor, m);
pci171x_ai_cancel(dev, s); pci171x_ai_cancel(dev, s);
@ -888,13 +888,13 @@ static int pci171x_ai_docmd_and_mode(int mode, struct comedi_device *dev,
*/ */
static void pci171x_cmdtest_out(int e, struct comedi_cmd *cmd) static void pci171x_cmdtest_out(int e, struct comedi_cmd *cmd)
{ {
rt_printk("adv_pci1710 e=%d startsrc=%x scansrc=%x convsrc=%x\n", e, printk("adv_pci1710 e=%d startsrc=%x scansrc=%x convsrc=%x\n", e,
cmd->start_src, cmd->scan_begin_src, cmd->convert_src); cmd->start_src, cmd->scan_begin_src, cmd->convert_src);
rt_printk("adv_pci1710 e=%d startarg=%d scanarg=%d convarg=%d\n", e, printk("adv_pci1710 e=%d startarg=%d scanarg=%d convarg=%d\n", e,
cmd->start_arg, cmd->scan_begin_arg, cmd->convert_arg); cmd->start_arg, cmd->scan_begin_arg, cmd->convert_arg);
rt_printk("adv_pci1710 e=%d stopsrc=%x scanend=%x\n", e, cmd->stop_src, printk("adv_pci1710 e=%d stopsrc=%x scanend=%x\n", e, cmd->stop_src,
cmd->scan_end_src); cmd->scan_end_src);
rt_printk("adv_pci1710 e=%d stoparg=%d scanendarg=%d chanlistlen=%d\n", printk("adv_pci1710 e=%d stoparg=%d scanendarg=%d chanlistlen=%d\n",
e, cmd->stop_arg, cmd->scan_end_arg, cmd->chanlist_len); e, cmd->stop_arg, cmd->scan_end_arg, cmd->chanlist_len);
} }
#endif #endif
@ -1122,7 +1122,7 @@ static int check_channel_list(struct comedi_device *dev, struct comedi_subdevice
if (n_chan > 1) { if (n_chan > 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 < n_chan; i++, seglen++) { /* build part of chanlist */ 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])); */ /* printk("%d. %d %d\n",i,CR_CHAN(chanlist[i]),CR_RANGE(chanlist[i])); */
if (chanlist[0] == chanlist[i]) if (chanlist[0] == chanlist[i])
break; /* we detect loop, this must by finish */ break; /* we detect loop, this must by finish */
if (CR_CHAN(chanlist[i]) & 1) /* odd channel cann't by differencial */ if (CR_CHAN(chanlist[i]) & 1) /* odd channel cann't by differencial */
@ -1136,7 +1136,7 @@ static int check_channel_list(struct comedi_device *dev, struct comedi_subdevice
if (CR_AREF(chansegment[i - 1]) == AREF_DIFF) if (CR_AREF(chansegment[i - 1]) == AREF_DIFF)
nowmustbechan = (nowmustbechan + 1) % s->n_chan; 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 printk
("channel list must be continous! chanlist[%i]=%d but must be %d or %d!\n", ("channel list must be continous! chanlist[%i]=%d but must be %d or %d!\n",
i, CR_CHAN(chanlist[i]), nowmustbechan, i, CR_CHAN(chanlist[i]), nowmustbechan,
CR_CHAN(chanlist[0])); CR_CHAN(chanlist[0]));
@ -1146,9 +1146,9 @@ static int check_channel_list(struct comedi_device *dev, struct comedi_subdevice
} }
for (i = 0, segpos = 0; i < n_chan; i++) { /* check whole chanlist */ 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])); */ /* 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]) { if (chanlist[i] != chansegment[i % seglen]) {
rt_printk printk
("bad channel, reference or range number! chanlist[%i]=%d,%d,%d and not %d,%d,%d!\n", ("bad channel, reference or range number! chanlist[%i]=%d,%d,%d and not %d,%d,%d!\n",
i, CR_CHAN(chansegment[i]), i, CR_CHAN(chansegment[i]),
CR_RANGE(chansegment[i]), CR_RANGE(chansegment[i]),
@ -1331,14 +1331,14 @@ static int pci1710_attach(struct comedi_device *dev, struct comedi_devconfig *it
int i; int i;
int board_index; int board_index;
rt_printk("comedi%d: adv_pci1710: ", dev->minor); printk("comedi%d: adv_pci1710: ", dev->minor);
opt_bus = it->options[0]; opt_bus = it->options[0];
opt_slot = it->options[1]; opt_slot = it->options[1];
ret = alloc_private(dev, sizeof(struct pci1710_private)); ret = alloc_private(dev, sizeof(struct pci1710_private));
if (ret < 0) { if (ret < 0) {
rt_printk(" - Allocation failed!\n"); printk(" - Allocation failed!\n");
return -ENOMEM; return -ENOMEM;
} }
@ -1386,10 +1386,10 @@ static int pci1710_attach(struct comedi_device *dev, struct comedi_devconfig *it
if (!pcidev) { if (!pcidev) {
if (opt_bus || opt_slot) { if (opt_bus || opt_slot) {
rt_printk(" - Card at b:s %d:%d %s\n", printk(" - Card at b:s %d:%d %s\n",
opt_bus, opt_slot, errstr); opt_bus, opt_slot, errstr);
} else { } else {
rt_printk(" - Card %s\n", errstr); printk(" - Card %s\n", errstr);
} }
return -EIO; return -EIO;
} }
@ -1400,7 +1400,7 @@ static int pci1710_attach(struct comedi_device *dev, struct comedi_devconfig *it
irq = pcidev->irq; irq = pcidev->irq;
iobase = pci_resource_start(pcidev, 2); iobase = pci_resource_start(pcidev, 2);
rt_printk(", b:s:f=%d:%d:%d, io=0x%4lx", pci_bus, pci_slot, pci_func, printk(", b:s:f=%d:%d:%d, io=0x%4lx", pci_bus, pci_slot, pci_func,
iobase); iobase);
dev->iobase = iobase; dev->iobase = iobase;
@ -1422,7 +1422,7 @@ static int pci1710_attach(struct comedi_device *dev, struct comedi_devconfig *it
ret = alloc_subdevices(dev, n_subdevices); ret = alloc_subdevices(dev, n_subdevices);
if (ret < 0) { if (ret < 0) {
rt_printk(" - Allocation failed!\n"); printk(" - Allocation failed!\n");
return ret; return ret;
} }
@ -1430,18 +1430,18 @@ static int pci1710_attach(struct comedi_device *dev, struct comedi_devconfig *it
if (this_board->have_irq) { if (this_board->have_irq) {
if (irq) { if (irq) {
if (comedi_request_irq(irq, interrupt_service_pci1710, if (request_irq(irq, interrupt_service_pci1710,
IRQF_SHARED, "Advantech PCI-1710", IRQF_SHARED, "Advantech PCI-1710",
dev)) { dev)) {
rt_printk printk
(", unable to allocate IRQ %d, DISABLING IT", (", unable to allocate IRQ %d, DISABLING IT",
irq); irq);
irq = 0; /* Can't use IRQ */ irq = 0; /* Can't use IRQ */
} else { } else {
rt_printk(", irq=%u", irq); printk(", irq=%u", irq);
} }
} else { } else {
rt_printk(", IRQ disabled"); printk(", IRQ disabled");
} }
} else { } else {
irq = 0; irq = 0;
@ -1551,7 +1551,7 @@ static int pci1710_detach(struct comedi_device *dev)
if (devpriv->valid) if (devpriv->valid)
pci1710_reset(dev); pci1710_reset(dev);
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (devpriv->pcidev) { if (devpriv->pcidev) {
if (dev->iobase) { if (dev->iobase) {
comedi_pci_disable(devpriv->pcidev); comedi_pci_disable(devpriv->pcidev);

View File

@ -304,7 +304,7 @@ static int pci1723_attach(struct comedi_device *dev, struct comedi_devconfig *it
int opt_bus, opt_slot; int opt_bus, opt_slot;
const char *errstr; const char *errstr;
rt_printk("comedi%d: adv_pci1723: board=%s", dev->minor, printk("comedi%d: adv_pci1723: board=%s", dev->minor,
this_board->name); this_board->name);
opt_bus = it->options[0]; opt_bus = it->options[0];
@ -312,7 +312,7 @@ static int pci1723_attach(struct comedi_device *dev, struct comedi_devconfig *it
ret = alloc_private(dev, sizeof(struct pci1723_private)); ret = alloc_private(dev, sizeof(struct pci1723_private));
if (ret < 0) { if (ret < 0) {
rt_printk(" - Allocation failed!\n"); printk(" - Allocation failed!\n");
return -ENOMEM; return -ENOMEM;
} }
@ -342,10 +342,10 @@ static int pci1723_attach(struct comedi_device *dev, struct comedi_devconfig *it
if (!pcidev) { if (!pcidev) {
if (opt_bus || opt_slot) { if (opt_bus || opt_slot) {
rt_printk(" - Card at b:s %d:%d %s\n", printk(" - Card at b:s %d:%d %s\n",
opt_bus, opt_slot, errstr); opt_bus, opt_slot, errstr);
} else { } else {
rt_printk(" - Card %s\n", errstr); printk(" - Card %s\n", errstr);
} }
return -EIO; return -EIO;
} }
@ -355,7 +355,7 @@ static int pci1723_attach(struct comedi_device *dev, struct comedi_devconfig *it
pci_func = PCI_FUNC(pcidev->devfn); pci_func = PCI_FUNC(pcidev->devfn);
iobase = pci_resource_start(pcidev, 2); iobase = pci_resource_start(pcidev, 2);
rt_printk(", b:s:f=%d:%d:%d, io=0x%4x", pci_bus, pci_slot, pci_func, printk(", b:s:f=%d:%d:%d, io=0x%4x", pci_bus, pci_slot, pci_func,
iobase); iobase);
dev->iobase = iobase; dev->iobase = iobase;
@ -372,7 +372,7 @@ static int pci1723_attach(struct comedi_device *dev, struct comedi_devconfig *it
ret = alloc_subdevices(dev, n_subdevices); ret = alloc_subdevices(dev, n_subdevices);
if (ret < 0) { if (ret < 0) {
rt_printk(" - Allocation failed!\n"); printk(" - Allocation failed!\n");
return ret; return ret;
} }

View File

@ -40,7 +40,7 @@ Configuration options:
#undef DPRINTK #undef DPRINTK
#ifdef PCI_DIO_EXTDEBUG #ifdef PCI_DIO_EXTDEBUG
#define DPRINTK(fmt, args...) rt_printk(fmt, ## args) #define DPRINTK(fmt, args...) printk(fmt, ## args)
#else #else
#define DPRINTK(fmt, args...) #define DPRINTK(fmt, args...)
#endif #endif
@ -451,7 +451,7 @@ static int pci1760_unchecked_mbxrequest(struct comedi_device *dev,
ok = 1; ok = 1;
break; break;
} }
comedi_udelay(1); udelay(1);
} }
if (ok) if (ok)
return 0; return 0;
@ -896,11 +896,11 @@ static int pci_dio_attach(struct comedi_device *dev, struct comedi_devconfig *it
unsigned long iobase; unsigned long iobase;
struct pci_dev *pcidev; struct pci_dev *pcidev;
rt_printk("comedi%d: adv_pci_dio: ", dev->minor); printk("comedi%d: adv_pci_dio: ", dev->minor);
ret = alloc_private(dev, sizeof(struct pci_dio_private)); ret = alloc_private(dev, sizeof(struct pci_dio_private));
if (ret < 0) { if (ret < 0) {
rt_printk(", Error: Cann't allocate private memory!\n"); printk(", Error: Cann't allocate private memory!\n");
return -ENOMEM; return -ENOMEM;
} }
@ -932,18 +932,18 @@ static int pci_dio_attach(struct comedi_device *dev, struct comedi_devconfig *it
} }
if (!dev->board_ptr) { if (!dev->board_ptr) {
rt_printk printk
(", Error: Requested type of the card was not found!\n"); (", Error: Requested type of the card was not found!\n");
return -EIO; return -EIO;
} }
if (comedi_pci_enable(pcidev, driver_pci_dio.driver_name)) { if (comedi_pci_enable(pcidev, driver_pci_dio.driver_name)) {
rt_printk printk
(", Error: Can't enable PCI device and request regions!\n"); (", Error: Can't enable PCI device and request regions!\n");
return -EIO; return -EIO;
} }
iobase = pci_resource_start(pcidev, this_board->main_pci_region); iobase = pci_resource_start(pcidev, this_board->main_pci_region);
rt_printk(", b:s:f=%d:%d:%d, io=0x%4lx", printk(", b:s:f=%d:%d:%d, io=0x%4lx",
pcidev->bus->number, PCI_SLOT(pcidev->devfn), pcidev->bus->number, PCI_SLOT(pcidev->devfn),
PCI_FUNC(pcidev->devfn), iobase); PCI_FUNC(pcidev->devfn), iobase);
@ -968,11 +968,11 @@ static int pci_dio_attach(struct comedi_device *dev, struct comedi_devconfig *it
ret = alloc_subdevices(dev, n_subdevices); ret = alloc_subdevices(dev, n_subdevices);
if (ret < 0) { if (ret < 0) {
rt_printk(", Error: Cann't allocate subdevice memory!\n"); printk(", Error: Cann't allocate subdevice memory!\n");
return ret; return ret;
} }
rt_printk(".\n"); printk(".\n");
subdev = 0; subdev = 0;

View File

@ -110,7 +110,7 @@ static int aio_aio12_8_ai_read(struct comedi_device *dev, struct comedi_subdevic
!(inb(dev->iobase + AIO12_8_STATUS) & STATUS_ADC_EOC)) { !(inb(dev->iobase + AIO12_8_STATUS) & STATUS_ADC_EOC)) {
timeout--; timeout--;
printk("timeout %d\n", timeout); printk("timeout %d\n", timeout);
comedi_udelay(1); udelay(1);
} }
if (timeout == 0) { if (timeout == 0) {
comedi_error(dev, "ADC timeout"); comedi_error(dev, "ADC timeout");

View File

@ -655,12 +655,12 @@ dio200_inttrig_start_intr(struct comedi_device *dev, struct comedi_subdevice *s,
subpriv = s->private; subpriv = s->private;
comedi_spin_lock_irqsave(&subpriv->spinlock, flags); spin_lock_irqsave(&subpriv->spinlock, flags);
s->async->inttrig = 0; s->async->inttrig = 0;
if (subpriv->active) { if (subpriv->active) {
event = dio200_start_intr(dev, s); event = dio200_start_intr(dev, s);
} }
comedi_spin_unlock_irqrestore(&subpriv->spinlock, flags); spin_unlock_irqrestore(&subpriv->spinlock, flags);
if (event) { if (event) {
comedi_event(dev, s); comedi_event(dev, s);
@ -684,7 +684,7 @@ static int dio200_handle_read_intr(struct comedi_device *dev, struct comedi_subd
triggered = 0; triggered = 0;
comedi_spin_lock_irqsave(&subpriv->spinlock, flags); spin_lock_irqsave(&subpriv->spinlock, flags);
oldevents = s->async->events; oldevents = s->async->events;
if (subpriv->has_int_sce) { if (subpriv->has_int_sce) {
/* /*
@ -773,7 +773,7 @@ static int dio200_handle_read_intr(struct comedi_device *dev, struct comedi_subd
} }
} }
} }
comedi_spin_unlock_irqrestore(&subpriv->spinlock, flags); spin_unlock_irqrestore(&subpriv->spinlock, flags);
if (oldevents != s->async->events) { if (oldevents != s->async->events) {
comedi_event(dev, s); comedi_event(dev, s);
@ -790,11 +790,11 @@ static int dio200_subdev_intr_cancel(struct comedi_device *dev, struct comedi_su
struct dio200_subdev_intr *subpriv = s->private; struct dio200_subdev_intr *subpriv = s->private;
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&subpriv->spinlock, flags); spin_lock_irqsave(&subpriv->spinlock, flags);
if (subpriv->active) { if (subpriv->active) {
dio200_stop_intr(dev, s); dio200_stop_intr(dev, s);
} }
comedi_spin_unlock_irqrestore(&subpriv->spinlock, flags); spin_unlock_irqrestore(&subpriv->spinlock, flags);
return 0; return 0;
} }
@ -916,7 +916,7 @@ static int dio200_subdev_intr_cmd(struct comedi_device *dev, struct comedi_subde
unsigned long flags; unsigned long flags;
int event = 0; int event = 0;
comedi_spin_lock_irqsave(&subpriv->spinlock, flags); spin_lock_irqsave(&subpriv->spinlock, flags);
subpriv->active = 1; subpriv->active = 1;
/* Set up end of acquisition. */ /* Set up end of acquisition. */
@ -942,7 +942,7 @@ static int dio200_subdev_intr_cmd(struct comedi_device *dev, struct comedi_subde
event = dio200_start_intr(dev, s); event = dio200_start_intr(dev, s);
break; break;
} }
comedi_spin_unlock_irqrestore(&subpriv->spinlock, flags); spin_unlock_irqrestore(&subpriv->spinlock, flags);
if (event) { if (event) {
comedi_event(dev, s); comedi_event(dev, s);
@ -1398,7 +1398,7 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
if (irq) { if (irq) {
unsigned long flags = share_irq ? IRQF_SHARED : 0; unsigned long flags = share_irq ? IRQF_SHARED : 0;
if (comedi_request_irq(irq, dio200_interrupt, flags, if (request_irq(irq, dio200_interrupt, flags,
DIO200_DRIVER_NAME, dev) >= 0) { DIO200_DRIVER_NAME, dev) >= 0) {
dev->irq = irq; dev->irq = irq;
} else { } else {
@ -1444,7 +1444,7 @@ static int dio200_detach(struct comedi_device *dev)
DIO200_DRIVER_NAME); DIO200_DRIVER_NAME);
if (dev->irq) { if (dev->irq) {
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
} }
if (dev->subdevices) { if (dev->subdevices) {
layout = thislayout; layout = thislayout;

View File

@ -372,7 +372,7 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it)
if (irq) { if (irq) {
unsigned long flags = share_irq ? IRQF_SHARED : 0; unsigned long flags = share_irq ? IRQF_SHARED : 0;
if (comedi_request_irq(irq, pc236_interrupt, flags, if (request_irq(irq, pc236_interrupt, flags,
PC236_DRIVER_NAME, dev) >= 0) { PC236_DRIVER_NAME, dev) >= 0) {
dev->irq = irq; dev->irq = irq;
s->type = COMEDI_SUBD_DI; s->type = COMEDI_SUBD_DI;
@ -421,7 +421,7 @@ static int pc236_detach(struct comedi_device *dev)
pc236_intr_disable(dev); pc236_intr_disable(dev);
} }
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (dev->subdevices) { if (dev->subdevices) {
subdev_8255_cleanup(dev, dev->subdevices + 0); subdev_8255_cleanup(dev, dev->subdevices + 0);
} }
@ -471,13 +471,13 @@ static void pc236_intr_disable(struct comedi_device *dev)
{ {
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
devpriv->enable_irq = 0; devpriv->enable_irq = 0;
#ifdef CONFIG_COMEDI_PCI #ifdef CONFIG_COMEDI_PCI
if (devpriv->lcr_iobase) if (devpriv->lcr_iobase)
outl(PCI236_INTR_DISABLE, devpriv->lcr_iobase + PLX9052_INTCSR); outl(PCI236_INTR_DISABLE, devpriv->lcr_iobase + PLX9052_INTCSR);
#endif #endif
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
} }
/* /*
@ -489,13 +489,13 @@ static void pc236_intr_enable(struct comedi_device *dev)
{ {
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
devpriv->enable_irq = 1; devpriv->enable_irq = 1;
#ifdef CONFIG_COMEDI_PCI #ifdef CONFIG_COMEDI_PCI
if (devpriv->lcr_iobase) if (devpriv->lcr_iobase)
outl(PCI236_INTR_ENABLE, devpriv->lcr_iobase + PLX9052_INTCSR); outl(PCI236_INTR_ENABLE, devpriv->lcr_iobase + PLX9052_INTCSR);
#endif #endif
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
} }
/* /*
@ -510,7 +510,7 @@ static int pc236_intr_check(struct comedi_device *dev)
int retval = 0; int retval = 0;
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
if (devpriv->enable_irq) { if (devpriv->enable_irq) {
retval = 1; retval = 1;
#ifdef CONFIG_COMEDI_PCI #ifdef CONFIG_COMEDI_PCI
@ -527,7 +527,7 @@ static int pc236_intr_check(struct comedi_device *dev)
} }
#endif #endif
} }
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
return retval; return retval;
} }

View File

@ -542,7 +542,7 @@ static void pci224_ao_stop(struct comedi_device *dev, struct comedi_subdevice *s
return; return;
} }
comedi_spin_lock_irqsave(&devpriv->ao_spinlock, flags); spin_lock_irqsave(&devpriv->ao_spinlock, flags);
/* Kill the interrupts. */ /* Kill the interrupts. */
devpriv->intsce = 0; devpriv->intsce = 0;
outb(0, devpriv->iobase1 + PCI224_INT_SCE); outb(0, devpriv->iobase1 + PCI224_INT_SCE);
@ -558,10 +558,10 @@ static void pci224_ao_stop(struct comedi_device *dev, struct comedi_subdevice *s
* routine. * routine.
*/ */
while (devpriv->intr_running && devpriv->intr_cpuid != THISCPU) { while (devpriv->intr_running && devpriv->intr_cpuid != THISCPU) {
comedi_spin_unlock_irqrestore(&devpriv->ao_spinlock, flags); spin_unlock_irqrestore(&devpriv->ao_spinlock, flags);
comedi_spin_lock_irqsave(&devpriv->ao_spinlock, flags); spin_lock_irqsave(&devpriv->ao_spinlock, flags);
} }
comedi_spin_unlock_irqrestore(&devpriv->ao_spinlock, flags); spin_unlock_irqrestore(&devpriv->ao_spinlock, flags);
/* Reconfigure DAC for insn_write usage. */ /* Reconfigure DAC for insn_write usage. */
outw(0, dev->iobase + PCI224_DACCEN); /* Disable channels. */ outw(0, dev->iobase + PCI224_DACCEN); /* Disable channels. */
devpriv->daccon = COMBINE(devpriv->daccon, devpriv->daccon = COMBINE(devpriv->daccon,
@ -587,14 +587,14 @@ static void pci224_ao_start(struct comedi_device *dev, struct comedi_subdevice *
comedi_event(dev, s); comedi_event(dev, s);
} else { } else {
/* Enable interrupts. */ /* Enable interrupts. */
comedi_spin_lock_irqsave(&devpriv->ao_spinlock, flags); spin_lock_irqsave(&devpriv->ao_spinlock, flags);
if (cmd->stop_src == TRIG_EXT) { if (cmd->stop_src == TRIG_EXT) {
devpriv->intsce = PCI224_INTR_EXT | PCI224_INTR_DAC; devpriv->intsce = PCI224_INTR_EXT | PCI224_INTR_DAC;
} else { } else {
devpriv->intsce = PCI224_INTR_DAC; devpriv->intsce = PCI224_INTR_DAC;
} }
outb(devpriv->intsce, devpriv->iobase1 + PCI224_INT_SCE); outb(devpriv->intsce, devpriv->iobase1 + PCI224_INT_SCE);
comedi_spin_unlock_irqrestore(&devpriv->ao_spinlock, flags); spin_unlock_irqrestore(&devpriv->ao_spinlock, flags);
} }
} }
@ -655,7 +655,7 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev, struct comedi_subde
/* Nothing left to put in the FIFO. */ /* Nothing left to put in the FIFO. */
pci224_ao_stop(dev, s); pci224_ao_stop(dev, s);
s->async->events |= COMEDI_CB_OVERFLOW; s->async->events |= COMEDI_CB_OVERFLOW;
rt_printk(KERN_ERR "comedi%d: " printk(KERN_ERR "comedi%d: "
"AO buffer underrun\n", dev->minor); "AO buffer underrun\n", dev->minor);
} }
} }
@ -1155,16 +1155,16 @@ static int pci224_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
*/ */
switch (cmd->start_src) { switch (cmd->start_src) {
case TRIG_INT: case TRIG_INT:
comedi_spin_lock_irqsave(&devpriv->ao_spinlock, flags); spin_lock_irqsave(&devpriv->ao_spinlock, flags);
s->async->inttrig = &pci224_ao_inttrig_start; s->async->inttrig = &pci224_ao_inttrig_start;
comedi_spin_unlock_irqrestore(&devpriv->ao_spinlock, flags); spin_unlock_irqrestore(&devpriv->ao_spinlock, flags);
break; break;
case TRIG_EXT: case TRIG_EXT:
/* Enable external interrupt trigger to start acquisition. */ /* Enable external interrupt trigger to start acquisition. */
comedi_spin_lock_irqsave(&devpriv->ao_spinlock, flags); spin_lock_irqsave(&devpriv->ao_spinlock, flags);
devpriv->intsce |= PCI224_INTR_EXT; devpriv->intsce |= PCI224_INTR_EXT;
outb(devpriv->intsce, devpriv->iobase1 + PCI224_INT_SCE); outb(devpriv->intsce, devpriv->iobase1 + PCI224_INT_SCE);
comedi_spin_unlock_irqrestore(&devpriv->ao_spinlock, flags); spin_unlock_irqrestore(&devpriv->ao_spinlock, flags);
break; break;
} }
@ -1227,14 +1227,14 @@ static irqreturn_t pci224_interrupt(int irq, void *d)
intstat = inb(devpriv->iobase1 + PCI224_INT_SCE) & 0x3F; intstat = inb(devpriv->iobase1 + PCI224_INT_SCE) & 0x3F;
if (intstat) { if (intstat) {
retval = 1; retval = 1;
comedi_spin_lock_irqsave(&devpriv->ao_spinlock, flags); spin_lock_irqsave(&devpriv->ao_spinlock, flags);
valid_intstat = devpriv->intsce & intstat; valid_intstat = devpriv->intsce & intstat;
/* Temporarily disable interrupt sources. */ /* Temporarily disable interrupt sources. */
curenab = devpriv->intsce & ~intstat; curenab = devpriv->intsce & ~intstat;
outb(curenab, devpriv->iobase1 + PCI224_INT_SCE); outb(curenab, devpriv->iobase1 + PCI224_INT_SCE);
devpriv->intr_running = 1; devpriv->intr_running = 1;
devpriv->intr_cpuid = THISCPU; devpriv->intr_cpuid = THISCPU;
comedi_spin_unlock_irqrestore(&devpriv->ao_spinlock, flags); spin_unlock_irqrestore(&devpriv->ao_spinlock, flags);
if (valid_intstat != 0) { if (valid_intstat != 0) {
cmd = &s->async->cmd; cmd = &s->async->cmd;
if (valid_intstat & PCI224_INTR_EXT) { if (valid_intstat & PCI224_INTR_EXT) {
@ -1250,13 +1250,13 @@ static irqreturn_t pci224_interrupt(int irq, void *d)
} }
} }
/* Reenable interrupt sources. */ /* Reenable interrupt sources. */
comedi_spin_lock_irqsave(&devpriv->ao_spinlock, flags); spin_lock_irqsave(&devpriv->ao_spinlock, flags);
if (curenab != devpriv->intsce) { if (curenab != devpriv->intsce) {
outb(devpriv->intsce, outb(devpriv->intsce,
devpriv->iobase1 + PCI224_INT_SCE); devpriv->iobase1 + PCI224_INT_SCE);
} }
devpriv->intr_running = 0; devpriv->intr_running = 0;
comedi_spin_unlock_irqrestore(&devpriv->ao_spinlock, flags); spin_unlock_irqrestore(&devpriv->ao_spinlock, flags);
} }
return IRQ_RETVAL(retval); return IRQ_RETVAL(retval);
} }
@ -1478,8 +1478,8 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it)
dev->board_name = thisboard->name; dev->board_name = thisboard->name;
if (irq) { if (irq) {
ret = comedi_request_irq(irq, pci224_interrupt, IRQF_SHARED, ret = request_irq(irq, pci224_interrupt, IRQF_SHARED,
DRIVER_NAME, dev); DRIVER_NAME, dev);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "comedi%d: error! " printk(KERN_ERR "comedi%d: error! "
"unable to allocate irq %u\n", dev->minor, irq); "unable to allocate irq %u\n", dev->minor, irq);
@ -1515,7 +1515,7 @@ static int pci224_detach(struct comedi_device *dev)
printk(KERN_DEBUG "comedi%d: %s: detach\n", dev->minor, DRIVER_NAME); printk(KERN_DEBUG "comedi%d: %s: detach\n", dev->minor, DRIVER_NAME);
if (dev->irq) { if (dev->irq) {
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
} }
if (dev->subdevices) { if (dev->subdevices) {
struct comedi_subdevice *s; struct comedi_subdevice *s;

View File

@ -876,8 +876,8 @@ static int pci230_attach(struct comedi_device *dev, struct comedi_devconfig *it)
dev->iobase + PCI230_ADCCON); dev->iobase + PCI230_ADCCON);
/* Register the interrupt handler. */ /* Register the interrupt handler. */
irq_hdl = comedi_request_irq(devpriv->pci_dev->irq, pci230_interrupt, irq_hdl = request_irq(devpriv->pci_dev->irq, pci230_interrupt,
IRQF_SHARED, "amplc_pci230", dev); IRQF_SHARED, "amplc_pci230", dev);
if (irq_hdl < 0) { if (irq_hdl < 0) {
printk("comedi%d: unable to register irq, " printk("comedi%d: unable to register irq, "
"commands will not be available %d\n", dev->minor, "commands will not be available %d\n", dev->minor,
@ -970,7 +970,7 @@ static int pci230_detach(struct comedi_device *dev)
subdev_8255_cleanup(dev, dev->subdevices + 2); subdev_8255_cleanup(dev, dev->subdevices + 2);
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (devpriv) { if (devpriv) {
if (devpriv->pci_dev) { if (devpriv->pci_dev) {
@ -995,7 +995,7 @@ static int get_resources(struct comedi_device *dev, unsigned int res_mask,
ok = 1; ok = 1;
claimed = 0; claimed = 0;
comedi_spin_lock_irqsave(&devpriv->res_spinlock, irqflags); spin_lock_irqsave(&devpriv->res_spinlock, irqflags);
for (b = 1, i = 0; (i < NUM_RESOURCES) for (b = 1, i = 0; (i < NUM_RESOURCES)
&& (res_mask != 0); b <<= 1, i++) { && (res_mask != 0); b <<= 1, i++) {
if ((res_mask & b) != 0) { if ((res_mask & b) != 0) {
@ -1016,7 +1016,7 @@ static int get_resources(struct comedi_device *dev, unsigned int res_mask,
} }
} }
} }
comedi_spin_unlock_irqrestore(&devpriv->res_spinlock, irqflags); spin_unlock_irqrestore(&devpriv->res_spinlock, irqflags);
return ok; return ok;
} }
@ -1033,7 +1033,7 @@ static void put_resources(struct comedi_device *dev, unsigned int res_mask,
unsigned int b; unsigned int b;
unsigned long irqflags; unsigned long irqflags;
comedi_spin_lock_irqsave(&devpriv->res_spinlock, irqflags); spin_lock_irqsave(&devpriv->res_spinlock, irqflags);
for (b = 1, i = 0; (i < NUM_RESOURCES) for (b = 1, i = 0; (i < NUM_RESOURCES)
&& (res_mask != 0); b <<= 1, i++) { && (res_mask != 0); b <<= 1, i++) {
if ((res_mask & b) != 0) { if ((res_mask & b) != 0) {
@ -1043,7 +1043,7 @@ static void put_resources(struct comedi_device *dev, unsigned int res_mask,
} }
} }
} }
comedi_spin_unlock_irqrestore(&devpriv->res_spinlock, irqflags); spin_unlock_irqrestore(&devpriv->res_spinlock, irqflags);
} }
static inline void put_one_resource(struct comedi_device *dev, unsigned int resource, static inline void put_one_resource(struct comedi_device *dev, unsigned int resource,
@ -1145,12 +1145,12 @@ static int pci230_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s
status = inw(dev->iobase + PCI230_ADCCON); status = inw(dev->iobase + PCI230_ADCCON);
if (!(status & PCI230_ADC_FIFO_EMPTY)) if (!(status & PCI230_ADC_FIFO_EMPTY))
break; break;
comedi_udelay(1); udelay(1);
} }
if (i == TIMEOUT) { if (i == TIMEOUT) {
/* rt_printk() should be used instead of printk() /* printk() should be used instead of printk()
* whenever the code can be called from real-time. */ * whenever the code can be called from real-time. */
rt_printk("timeout\n"); printk("timeout\n");
return -ETIMEDOUT; return -ETIMEDOUT;
} }
@ -1426,12 +1426,12 @@ static int pci230_ao_inttrig_scan_begin(struct comedi_device *dev,
if (trig_num != 0) if (trig_num != 0)
return -EINVAL; return -EINVAL;
comedi_spin_lock_irqsave(&devpriv->ao_stop_spinlock, irqflags); spin_lock_irqsave(&devpriv->ao_stop_spinlock, irqflags);
if (test_bit(AO_CMD_STARTED, &devpriv->state)) { if (test_bit(AO_CMD_STARTED, &devpriv->state)) {
/* Perform scan. */ /* Perform scan. */
if (devpriv->hwver < 2) { if (devpriv->hwver < 2) {
/* Not using DAC FIFO. */ /* Not using DAC FIFO. */
comedi_spin_unlock_irqrestore(&devpriv-> spin_unlock_irqrestore(&devpriv->
ao_stop_spinlock, irqflags); ao_stop_spinlock, irqflags);
pci230_handle_ao_nofifo(dev, s); pci230_handle_ao_nofifo(dev, s);
comedi_event(dev, s); comedi_event(dev, s);
@ -1439,12 +1439,12 @@ static int pci230_ao_inttrig_scan_begin(struct comedi_device *dev,
/* Using DAC FIFO. */ /* Using DAC FIFO. */
/* Read DACSWTRIG register to trigger conversion. */ /* Read DACSWTRIG register to trigger conversion. */
inw(dev->iobase + PCI230P2_DACSWTRIG); inw(dev->iobase + PCI230P2_DACSWTRIG);
comedi_spin_unlock_irqrestore(&devpriv-> spin_unlock_irqrestore(&devpriv->
ao_stop_spinlock, irqflags); ao_stop_spinlock, irqflags);
} }
/* Delay. Should driver be responsible for this? */ /* Delay. Should driver be responsible for this? */
/* XXX TODO: See if DAC busy bit can be used. */ /* XXX TODO: See if DAC busy bit can be used. */
comedi_udelay(8); udelay(8);
} }
return 1; return 1;
@ -1508,13 +1508,13 @@ static void pci230_ao_start(struct comedi_device *dev, struct comedi_subdevice *
if (devpriv->hwver < 2) { if (devpriv->hwver < 2) {
/* Not using DAC FIFO. */ /* Not using DAC FIFO. */
/* Enable CT1 timer interrupt. */ /* Enable CT1 timer interrupt. */
comedi_spin_lock_irqsave(&devpriv->isr_spinlock, spin_lock_irqsave(&devpriv->isr_spinlock,
irqflags); irqflags);
devpriv->int_en |= PCI230_INT_ZCLK_CT1; devpriv->int_en |= PCI230_INT_ZCLK_CT1;
devpriv->ier |= PCI230_INT_ZCLK_CT1; devpriv->ier |= PCI230_INT_ZCLK_CT1;
outb(devpriv->ier, outb(devpriv->ier,
devpriv->iobase1 + PCI230_INT_SCE); devpriv->iobase1 + PCI230_INT_SCE);
comedi_spin_unlock_irqrestore(&devpriv-> spin_unlock_irqrestore(&devpriv->
isr_spinlock, irqflags); isr_spinlock, irqflags);
} }
/* Set CT1 gate high to start counting. */ /* Set CT1 gate high to start counting. */
@ -1527,12 +1527,12 @@ static void pci230_ao_start(struct comedi_device *dev, struct comedi_subdevice *
} }
if (devpriv->hwver >= 2) { if (devpriv->hwver >= 2) {
/* Using DAC FIFO. Enable DAC FIFO interrupt. */ /* Using DAC FIFO. Enable DAC FIFO interrupt. */
comedi_spin_lock_irqsave(&devpriv->isr_spinlock, spin_lock_irqsave(&devpriv->isr_spinlock,
irqflags); irqflags);
devpriv->int_en |= PCI230P2_INT_DAC; devpriv->int_en |= PCI230P2_INT_DAC;
devpriv->ier |= PCI230P2_INT_DAC; devpriv->ier |= PCI230P2_INT_DAC;
outb(devpriv->ier, devpriv->iobase1 + PCI230_INT_SCE); outb(devpriv->ier, devpriv->iobase1 + PCI230_INT_SCE);
comedi_spin_unlock_irqrestore(&devpriv->isr_spinlock, spin_unlock_irqrestore(&devpriv->isr_spinlock,
irqflags); irqflags);
} }
} }
@ -2088,7 +2088,7 @@ static int pci230_ai_inttrig_convert(struct comedi_device *dev, struct comedi_su
if (trig_num != 0) if (trig_num != 0)
return -EINVAL; return -EINVAL;
comedi_spin_lock_irqsave(&devpriv->ai_stop_spinlock, irqflags); spin_lock_irqsave(&devpriv->ai_stop_spinlock, irqflags);
if (test_bit(AI_CMD_STARTED, &devpriv->state)) { if (test_bit(AI_CMD_STARTED, &devpriv->state)) {
unsigned int delayus; unsigned int delayus;
@ -2112,11 +2112,11 @@ static int pci230_ai_inttrig_convert(struct comedi_device *dev, struct comedi_su
/* single-ended or PCI230+/260+ */ /* single-ended or PCI230+/260+ */
delayus = 4; delayus = 4;
} }
comedi_spin_unlock_irqrestore(&devpriv->ai_stop_spinlock, spin_unlock_irqrestore(&devpriv->ai_stop_spinlock,
irqflags); irqflags);
comedi_udelay(delayus); udelay(delayus);
} else { } else {
comedi_spin_unlock_irqrestore(&devpriv->ai_stop_spinlock, spin_unlock_irqrestore(&devpriv->ai_stop_spinlock,
irqflags); irqflags);
} }
@ -2132,7 +2132,7 @@ static int pci230_ai_inttrig_scan_begin(struct comedi_device *dev,
if (trig_num != 0) if (trig_num != 0)
return -EINVAL; return -EINVAL;
comedi_spin_lock_irqsave(&devpriv->ai_stop_spinlock, irqflags); spin_lock_irqsave(&devpriv->ai_stop_spinlock, irqflags);
if (test_bit(AI_CMD_STARTED, &devpriv->state)) { if (test_bit(AI_CMD_STARTED, &devpriv->state)) {
/* Trigger scan by waggling CT0 gate source. */ /* Trigger scan by waggling CT0 gate source. */
zgat = GAT_CONFIG(0, GAT_GND); zgat = GAT_CONFIG(0, GAT_GND);
@ -2140,7 +2140,7 @@ static int pci230_ai_inttrig_scan_begin(struct comedi_device *dev,
zgat = GAT_CONFIG(0, GAT_VCC); zgat = GAT_CONFIG(0, GAT_VCC);
outb(zgat, devpriv->iobase1 + PCI230_ZGAT_SCE); outb(zgat, devpriv->iobase1 + PCI230_ZGAT_SCE);
} }
comedi_spin_unlock_irqrestore(&devpriv->ai_stop_spinlock, irqflags); spin_unlock_irqrestore(&devpriv->ai_stop_spinlock, irqflags);
return 1; return 1;
} }
@ -2160,11 +2160,11 @@ static void pci230_ai_start(struct comedi_device *dev, struct comedi_subdevice *
comedi_event(dev, s); comedi_event(dev, s);
} else { } else {
/* Enable ADC FIFO trigger level interrupt. */ /* Enable ADC FIFO trigger level interrupt. */
comedi_spin_lock_irqsave(&devpriv->isr_spinlock, irqflags); spin_lock_irqsave(&devpriv->isr_spinlock, irqflags);
devpriv->int_en |= PCI230_INT_ADC; devpriv->int_en |= PCI230_INT_ADC;
devpriv->ier |= PCI230_INT_ADC; devpriv->ier |= PCI230_INT_ADC;
outb(devpriv->ier, devpriv->iobase1 + PCI230_INT_SCE); outb(devpriv->ier, devpriv->iobase1 + PCI230_INT_SCE);
comedi_spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags); spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags);
/* Update conversion trigger source which is currently set /* Update conversion trigger source which is currently set
* to CT2 output, which is currently stuck high. */ * to CT2 output, which is currently stuck high. */
@ -2426,7 +2426,7 @@ static int pci230_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
* FIFO reset (above) and the second FIFO reset (below). Setting the * FIFO reset (above) and the second FIFO reset (below). Setting the
* channel gains and scan list _before_ the first FIFO reset also * channel gains and scan list _before_ the first FIFO reset also
* helps, though only slightly. */ * helps, though only slightly. */
comedi_udelay(25); udelay(25);
/* Reset FIFO again. */ /* Reset FIFO again. */
outw(adccon | PCI230_ADC_FIFO_RESET, dev->iobase + PCI230_ADCCON); outw(adccon | PCI230_ADC_FIFO_RESET, dev->iobase + PCI230_ADCCON);
@ -2575,7 +2575,7 @@ static irqreturn_t pci230_interrupt(int irq, void *d)
return IRQ_NONE; return IRQ_NONE;
} }
comedi_spin_lock_irqsave(&devpriv->isr_spinlock, irqflags); spin_lock_irqsave(&devpriv->isr_spinlock, irqflags);
valid_status_int = devpriv->int_en & status_int; valid_status_int = devpriv->int_en & status_int;
/* Disable triggered interrupts. /* Disable triggered interrupts.
* (Only those interrupts that need re-enabling, are, later in the * (Only those interrupts that need re-enabling, are, later in the
@ -2584,7 +2584,7 @@ static irqreturn_t pci230_interrupt(int irq, void *d)
outb(devpriv->ier, devpriv->iobase1 + PCI230_INT_SCE); outb(devpriv->ier, devpriv->iobase1 + PCI230_INT_SCE);
devpriv->intr_running = 1; devpriv->intr_running = 1;
devpriv->intr_cpuid = THISCPU; devpriv->intr_cpuid = THISCPU;
comedi_spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags); spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags);
/* /*
* Check the source of interrupt and handle it. * Check the source of interrupt and handle it.
@ -2613,13 +2613,13 @@ static irqreturn_t pci230_interrupt(int irq, void *d)
} }
/* Reenable interrupts. */ /* Reenable interrupts. */
comedi_spin_lock_irqsave(&devpriv->isr_spinlock, irqflags); spin_lock_irqsave(&devpriv->isr_spinlock, irqflags);
if (devpriv->ier != devpriv->int_en) { if (devpriv->ier != devpriv->int_en) {
devpriv->ier = devpriv->int_en; devpriv->ier = devpriv->int_en;
outb(devpriv->ier, devpriv->iobase1 + PCI230_INT_SCE); outb(devpriv->ier, devpriv->iobase1 + PCI230_INT_SCE);
} }
devpriv->intr_running = 0; devpriv->intr_running = 0;
comedi_spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags); spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
@ -2870,9 +2870,9 @@ static void pci230_ao_stop(struct comedi_device *dev, struct comedi_subdevice *s
int started; int started;
struct comedi_cmd *cmd; struct comedi_cmd *cmd;
comedi_spin_lock_irqsave(&devpriv->ao_stop_spinlock, irqflags); spin_lock_irqsave(&devpriv->ao_stop_spinlock, irqflags);
started = test_and_clear_bit(AO_CMD_STARTED, &devpriv->state); started = test_and_clear_bit(AO_CMD_STARTED, &devpriv->state);
comedi_spin_unlock_irqrestore(&devpriv->ao_stop_spinlock, irqflags); spin_unlock_irqrestore(&devpriv->ao_stop_spinlock, irqflags);
if (!started) { if (!started) {
return; return;
} }
@ -2893,17 +2893,17 @@ static void pci230_ao_stop(struct comedi_device *dev, struct comedi_subdevice *s
} }
/* Disable interrupt and wait for interrupt routine to finish running /* Disable interrupt and wait for interrupt routine to finish running
* unless we are called from the interrupt routine. */ * unless we are called from the interrupt routine. */
comedi_spin_lock_irqsave(&devpriv->isr_spinlock, irqflags); spin_lock_irqsave(&devpriv->isr_spinlock, irqflags);
devpriv->int_en &= ~intsrc; devpriv->int_en &= ~intsrc;
while (devpriv->intr_running && devpriv->intr_cpuid != THISCPU) { while (devpriv->intr_running && devpriv->intr_cpuid != THISCPU) {
comedi_spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags); spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags);
comedi_spin_lock_irqsave(&devpriv->isr_spinlock, irqflags); spin_lock_irqsave(&devpriv->isr_spinlock, irqflags);
} }
if (devpriv->ier != devpriv->int_en) { if (devpriv->ier != devpriv->int_en) {
devpriv->ier = devpriv->int_en; devpriv->ier = devpriv->int_en;
outb(devpriv->ier, devpriv->iobase1 + PCI230_INT_SCE); outb(devpriv->ier, devpriv->iobase1 + PCI230_INT_SCE);
} }
comedi_spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags); spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags);
if (devpriv->hwver >= 2) { if (devpriv->hwver >= 2) {
/* Using DAC FIFO. Reset FIFO, clear underrun error, /* Using DAC FIFO. Reset FIFO, clear underrun error,
@ -2930,9 +2930,9 @@ static void pci230_ai_stop(struct comedi_device *dev, struct comedi_subdevice *s
struct comedi_cmd *cmd; struct comedi_cmd *cmd;
int started; int started;
comedi_spin_lock_irqsave(&devpriv->ai_stop_spinlock, irqflags); spin_lock_irqsave(&devpriv->ai_stop_spinlock, irqflags);
started = test_and_clear_bit(AI_CMD_STARTED, &devpriv->state); started = test_and_clear_bit(AI_CMD_STARTED, &devpriv->state);
comedi_spin_unlock_irqrestore(&devpriv->ai_stop_spinlock, irqflags); spin_unlock_irqrestore(&devpriv->ai_stop_spinlock, irqflags);
if (!started) { if (!started) {
return; return;
} }
@ -2947,19 +2947,19 @@ static void pci230_ai_stop(struct comedi_device *dev, struct comedi_subdevice *s
pci230_cancel_ct(dev, 0); pci230_cancel_ct(dev, 0);
} }
comedi_spin_lock_irqsave(&devpriv->isr_spinlock, irqflags); spin_lock_irqsave(&devpriv->isr_spinlock, irqflags);
/* Disable ADC interrupt and wait for interrupt routine to finish /* Disable ADC interrupt and wait for interrupt routine to finish
* running unless we are called from the interrupt routine. */ * running unless we are called from the interrupt routine. */
devpriv->int_en &= ~PCI230_INT_ADC; devpriv->int_en &= ~PCI230_INT_ADC;
while (devpriv->intr_running && devpriv->intr_cpuid != THISCPU) { while (devpriv->intr_running && devpriv->intr_cpuid != THISCPU) {
comedi_spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags); spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags);
comedi_spin_lock_irqsave(&devpriv->isr_spinlock, irqflags); spin_lock_irqsave(&devpriv->isr_spinlock, irqflags);
} }
if (devpriv->ier != devpriv->int_en) { if (devpriv->ier != devpriv->int_en) {
devpriv->ier = devpriv->int_en; devpriv->ier = devpriv->int_en;
outb(devpriv->ier, devpriv->iobase1 + PCI230_INT_SCE); outb(devpriv->ier, devpriv->iobase1 + PCI230_INT_SCE);
} }
comedi_spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags); spin_unlock_irqrestore(&devpriv->isr_spinlock, irqflags);
/* Reset FIFO, disable FIFO and set start conversion source to none. /* Reset FIFO, disable FIFO and set start conversion source to none.
* Keep se/diff and bip/uni settings */ * Keep se/diff and bip/uni settings */

View File

@ -187,8 +187,8 @@ static int das16cs_attach(struct comedi_device *dev, struct comedi_devconfig *it
} }
printk("\n"); printk("\n");
ret = comedi_request_irq(link->irq.AssignedIRQ, das16cs_interrupt, ret = request_irq(link->irq.AssignedIRQ, das16cs_interrupt,
IRQF_SHARED, "cb_das16_cs", dev); IRQF_SHARED, "cb_das16_cs", dev);
if (ret < 0) { if (ret < 0) {
return ret; return ret;
} }
@ -270,7 +270,7 @@ static int das16cs_detach(struct comedi_device *dev)
printk("comedi%d: das16cs: remove\n", dev->minor); printk("comedi%d: das16cs: remove\n", dev->minor);
if (dev->irq) { if (dev->irq) {
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
} }
return 0; return 0;
@ -503,7 +503,7 @@ static int das16cs_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *
d = data[i]; d = data[i];
outw(devpriv->status1, dev->iobase + 4); outw(devpriv->status1, dev->iobase + 4);
comedi_udelay(1); udelay(1);
status1 = devpriv->status1 & ~0xf; status1 = devpriv->status1 & ~0xf;
if (chan) if (chan)
@ -513,17 +513,17 @@ static int das16cs_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *
/* printk("0x%04x\n",status1);*/ /* printk("0x%04x\n",status1);*/
outw(status1, dev->iobase + 4); outw(status1, dev->iobase + 4);
comedi_udelay(1); udelay(1);
for (bit = 15; bit >= 0; bit--) { for (bit = 15; bit >= 0; bit--) {
int b = (d >> bit) & 0x1; int b = (d >> bit) & 0x1;
b <<= 1; b <<= 1;
/* printk("0x%04x\n",status1 | b | 0x0000);*/ /* printk("0x%04x\n",status1 | b | 0x0000);*/
outw(status1 | b | 0x0000, dev->iobase + 4); outw(status1 | b | 0x0000, dev->iobase + 4);
comedi_udelay(1); udelay(1);
/* printk("0x%04x\n",status1 | b | 0x0004);*/ /* printk("0x%04x\n",status1 | b | 0x0004);*/
outw(status1 | b | 0x0004, dev->iobase + 4); outw(status1 | b | 0x0004, dev->iobase + 4);
comedi_udelay(1); udelay(1);
} }
/* make high both DAC0CS and DAC1CS to load /* make high both DAC0CS and DAC1CS to load
new data and update analog output*/ new data and update analog output*/

View File

@ -588,7 +588,7 @@ static int cb_pcidas_attach(struct comedi_device *dev, struct comedi_devconfig *
devpriv->s5933_config + AMCC_OP_REG_INTCSR); devpriv->s5933_config + AMCC_OP_REG_INTCSR);
/* get irq */ /* get irq */
if (comedi_request_irq(devpriv->pci_dev->irq, cb_pcidas_interrupt, if (request_irq(devpriv->pci_dev->irq, cb_pcidas_interrupt,
IRQF_SHARED, "cb_pcidas", dev)) { IRQF_SHARED, "cb_pcidas", dev)) {
printk(" unable to allocate irq %d\n", devpriv->pci_dev->irq); printk(" unable to allocate irq %d\n", devpriv->pci_dev->irq);
return -EINVAL; return -EINVAL;
@ -727,14 +727,14 @@ static int cb_pcidas_detach(struct comedi_device *dev)
outl(INTCSR_INBOX_INTR_STATUS, outl(INTCSR_INBOX_INTR_STATUS,
devpriv->s5933_config + AMCC_OP_REG_INTCSR); devpriv->s5933_config + AMCC_OP_REG_INTCSR);
#ifdef CB_PCIDAS_DEBUG #ifdef CB_PCIDAS_DEBUG
rt_printk("detaching, incsr is 0x%x\n", printk("detaching, incsr is 0x%x\n",
inl(devpriv->s5933_config + inl(devpriv->s5933_config +
AMCC_OP_REG_INTCSR)); AMCC_OP_REG_INTCSR));
#endif #endif
} }
} }
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (dev->subdevices) if (dev->subdevices)
subdev_8255_cleanup(dev, dev->subdevices + 2); subdev_8255_cleanup(dev, dev->subdevices + 2);
if (devpriv && devpriv->pci_dev) { if (devpriv && devpriv->pci_dev) {
@ -843,13 +843,13 @@ static int cb_pcidas_ao_nofifo_winsn(struct comedi_device *dev, struct comedi_su
/* set channel and range */ /* set channel and range */
channel = CR_CHAN(insn->chanspec); channel = CR_CHAN(insn->chanspec);
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
devpriv->ao_control_bits &= devpriv->ao_control_bits &=
~DAC_MODE_UPDATE_BOTH & ~DAC_RANGE_MASK(channel); ~DAC_MODE_UPDATE_BOTH & ~DAC_RANGE_MASK(channel);
devpriv->ao_control_bits |= devpriv->ao_control_bits |=
DACEN | DAC_RANGE(channel, CR_RANGE(insn->chanspec)); DACEN | DAC_RANGE(channel, CR_RANGE(insn->chanspec));
outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR); outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
/* remember value for readback */ /* remember value for readback */
devpriv->ao_value[channel] = data[0]; devpriv->ao_value[channel] = data[0];
@ -871,7 +871,7 @@ static int cb_pcidas_ao_fifo_winsn(struct comedi_device *dev, struct comedi_subd
/* set channel and range */ /* set channel and range */
channel = CR_CHAN(insn->chanspec); channel = CR_CHAN(insn->chanspec);
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
devpriv->ao_control_bits &= devpriv->ao_control_bits &=
~DAC_CHAN_EN(0) & ~DAC_CHAN_EN(1) & ~DAC_RANGE_MASK(channel) & ~DAC_CHAN_EN(0) & ~DAC_CHAN_EN(1) & ~DAC_RANGE_MASK(channel) &
~DAC_PACER_MASK; ~DAC_PACER_MASK;
@ -879,7 +879,7 @@ static int cb_pcidas_ao_fifo_winsn(struct comedi_device *dev, struct comedi_subd
DACEN | DAC_RANGE(channel, DACEN | DAC_RANGE(channel,
CR_RANGE(insn->chanspec)) | DAC_CHAN_EN(channel) | DAC_START; CR_RANGE(insn->chanspec)) | DAC_CHAN_EN(channel) | DAC_START;
outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR); outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
/* remember value for readback */ /* remember value for readback */
devpriv->ao_value[channel] = data[0]; devpriv->ao_value[channel] = data[0];
@ -940,13 +940,13 @@ static int dac08_write(struct comedi_device *dev, unsigned int value)
outw(cal_enable_bits(dev) | (value & 0xff), outw(cal_enable_bits(dev) | (value & 0xff),
devpriv->control_status + CALIBRATION_REG); devpriv->control_status + CALIBRATION_REG);
comedi_udelay(1); udelay(1);
outw(cal_enable_bits(dev) | SELECT_DAC08_BIT | (value & 0xff), outw(cal_enable_bits(dev) | SELECT_DAC08_BIT | (value & 0xff),
devpriv->control_status + CALIBRATION_REG); devpriv->control_status + CALIBRATION_REG);
comedi_udelay(1); udelay(1);
outw(cal_enable_bits(dev) | (value & 0xff), outw(cal_enable_bits(dev) | (value & 0xff),
devpriv->control_status + CALIBRATION_REG); devpriv->control_status + CALIBRATION_REG);
comedi_udelay(1); udelay(1);
return 1; return 1;
} }
@ -1193,7 +1193,7 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *
outw(bits, devpriv->control_status + ADCMUX_CONT); outw(bits, devpriv->control_status + ADCMUX_CONT);
#ifdef CB_PCIDAS_DEBUG #ifdef CB_PCIDAS_DEBUG
rt_printk("comedi: sent 0x%x to adcmux control\n", bits); printk("comedi: sent 0x%x to adcmux control\n", bits);
#endif #endif
/* load counters */ /* load counters */
@ -1209,7 +1209,7 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *
devpriv->count = cmd->chanlist_len * cmd->stop_arg; devpriv->count = cmd->chanlist_len * cmd->stop_arg;
} }
/* enable interrupts */ /* enable interrupts */
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
devpriv->adc_fifo_bits |= INTE; devpriv->adc_fifo_bits |= INTE;
devpriv->adc_fifo_bits &= ~INT_MASK; devpriv->adc_fifo_bits &= ~INT_MASK;
if (cmd->flags & TRIG_WAKE_EOS) { if (cmd->flags & TRIG_WAKE_EOS) {
@ -1221,12 +1221,12 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *
devpriv->adc_fifo_bits |= INT_FHF; /* interrupt fifo half full */ devpriv->adc_fifo_bits |= INT_FHF; /* interrupt fifo half full */
} }
#ifdef CB_PCIDAS_DEBUG #ifdef CB_PCIDAS_DEBUG
rt_printk("comedi: adc_fifo_bits are 0x%x\n", devpriv->adc_fifo_bits); printk("comedi: adc_fifo_bits are 0x%x\n", devpriv->adc_fifo_bits);
#endif #endif
/* enable (and clear) interrupts */ /* enable (and clear) interrupts */
outw(devpriv->adc_fifo_bits | EOAI | INT | LADFUL, outw(devpriv->adc_fifo_bits | EOAI | INT | LADFUL,
devpriv->control_status + INT_ADCFIFO); devpriv->control_status + INT_ADCFIFO);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
/* set start trigger and burst mode */ /* set start trigger and burst mode */
bits = 0; bits = 0;
@ -1242,7 +1242,7 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *
bits |= BURSTE; bits |= BURSTE;
outw(bits, devpriv->control_status + TRIG_CONTSTAT); outw(bits, devpriv->control_status + TRIG_CONTSTAT);
#ifdef CB_PCIDAS_DEBUG #ifdef CB_PCIDAS_DEBUG
rt_printk("comedi: sent 0x%x to trig control\n", bits); printk("comedi: sent 0x%x to trig control\n", bits);
#endif #endif
return 0; return 0;
@ -1369,7 +1369,7 @@ static int cb_pcidas_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *
unsigned long flags; unsigned long flags;
/* set channel limits, gain */ /* set channel limits, gain */
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
for (i = 0; i < cmd->chanlist_len; i++) { for (i = 0; i < cmd->chanlist_len; i++) {
/* enable channel */ /* enable channel */
devpriv->ao_control_bits |= devpriv->ao_control_bits |=
@ -1381,7 +1381,7 @@ static int cb_pcidas_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *
/* 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); outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
/* clear fifo */ /* clear fifo */
outw(0, devpriv->ao_registers + DACFIFOCLR); outw(0, devpriv->ao_registers + DACFIFOCLR);
@ -1403,7 +1403,7 @@ static int cb_pcidas_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *
devpriv->ao_count = cmd->chanlist_len * cmd->stop_arg; devpriv->ao_count = cmd->chanlist_len * cmd->stop_arg;
} }
/* set pacer source */ /* set pacer source */
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
switch (cmd->scan_begin_src) { switch (cmd->scan_begin_src) {
case TRIG_TIMER: case TRIG_TIMER:
devpriv->ao_control_bits |= DAC_PACER_INT; devpriv->ao_control_bits |= DAC_PACER_INT;
@ -1412,12 +1412,12 @@ static int cb_pcidas_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *
devpriv->ao_control_bits |= DAC_PACER_EXT_RISE; devpriv->ao_control_bits |= DAC_PACER_EXT_RISE;
break; break;
default: default:
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
comedi_error(dev, "error setting dac pacer source"); comedi_error(dev, "error setting dac pacer source");
return -1; return -1;
break; break;
} }
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
async->inttrig = cb_pcidas_ao_inttrig; async->inttrig = cb_pcidas_ao_inttrig;
@ -1451,10 +1451,10 @@ static int cb_pcidas_ao_inttrig(struct comedi_device *dev,
outsw(devpriv->ao_registers + DACDATA, devpriv->ao_buffer, num_bytes); 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); spin_lock_irqsave(&dev->spinlock, flags);
devpriv->adc_fifo_bits |= DAEMIE | DAHFIE; devpriv->adc_fifo_bits |= DAEMIE | DAHFIE;
#ifdef CB_PCIDAS_DEBUG #ifdef CB_PCIDAS_DEBUG
rt_printk("comedi: adc_fifo_bits are 0x%x\n", devpriv->adc_fifo_bits); printk("comedi: adc_fifo_bits are 0x%x\n", devpriv->adc_fifo_bits);
#endif #endif
/* enable and clear interrupts */ /* enable and clear interrupts */
outw(devpriv->adc_fifo_bits | DAEMI | DAHFI, outw(devpriv->adc_fifo_bits | DAEMI | DAHFI,
@ -1464,10 +1464,10 @@ static int cb_pcidas_ao_inttrig(struct comedi_device *dev,
devpriv->ao_control_bits |= DAC_START | DACEN | DAC_EMPTY; devpriv->ao_control_bits |= DAC_START | DACEN | DAC_EMPTY;
outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR); outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR);
#ifdef CB_PCIDAS_DEBUG #ifdef CB_PCIDAS_DEBUG
rt_printk("comedi: sent 0x%x to dac control\n", printk("comedi: sent 0x%x to dac control\n",
devpriv->ao_control_bits); devpriv->ao_control_bits);
#endif #endif
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
async->inttrig = NULL; async->inttrig = NULL;
@ -1494,8 +1494,8 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d)
s5933_status = inl(devpriv->s5933_config + AMCC_OP_REG_INTCSR); s5933_status = inl(devpriv->s5933_config + AMCC_OP_REG_INTCSR);
#ifdef CB_PCIDAS_DEBUG #ifdef CB_PCIDAS_DEBUG
rt_printk("intcsr 0x%x\n", s5933_status); printk("intcsr 0x%x\n", s5933_status);
rt_printk("mbef 0x%x\n", inl(devpriv->s5933_config + AMCC_OP_REG_MBEF)); printk("mbef 0x%x\n", inl(devpriv->s5933_config + AMCC_OP_REG_MBEF));
#endif #endif
if ((INTCSR_INTR_ASSERTED & s5933_status) == 0) if ((INTCSR_INTR_ASSERTED & s5933_status) == 0)
@ -1537,10 +1537,10 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d)
cb_pcidas_cancel(dev, s); cb_pcidas_cancel(dev, s);
} }
/* clear half-full interrupt latch */ /* clear half-full interrupt latch */
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
outw(devpriv->adc_fifo_bits | INT, outw(devpriv->adc_fifo_bits | INT,
devpriv->control_status + INT_ADCFIFO); devpriv->control_status + INT_ADCFIFO);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
/* else if fifo not empty */ /* else if fifo not empty */
} else if (status & (ADNEI | EOBI)) { } else if (status & (ADNEI | EOBI)) {
for (i = 0; i < timeout; i++) { for (i = 0; i < timeout; i++) {
@ -1556,27 +1556,27 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d)
} }
} }
/* clear not-empty interrupt latch */ /* clear not-empty interrupt latch */
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
outw(devpriv->adc_fifo_bits | INT, outw(devpriv->adc_fifo_bits | INT,
devpriv->control_status + INT_ADCFIFO); devpriv->control_status + INT_ADCFIFO);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
} else if (status & EOAI) { } else if (status & EOAI) {
comedi_error(dev, comedi_error(dev,
"bug! encountered end of aquisition interrupt?"); "bug! encountered end of aquisition interrupt?");
/* clear EOA interrupt latch */ /* clear EOA interrupt latch */
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
outw(devpriv->adc_fifo_bits | EOAI, outw(devpriv->adc_fifo_bits | EOAI,
devpriv->control_status + INT_ADCFIFO); devpriv->control_status + INT_ADCFIFO);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
} }
/* check for fifo overflow */ /* check for fifo overflow */
if (status & LADFUL) { if (status & LADFUL) {
comedi_error(dev, "fifo overflow"); comedi_error(dev, "fifo overflow");
/* clear overflow interrupt latch */ /* clear overflow interrupt latch */
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
outw(devpriv->adc_fifo_bits | LADFUL, outw(devpriv->adc_fifo_bits | LADFUL,
devpriv->control_status + INT_ADCFIFO); devpriv->control_status + INT_ADCFIFO);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
cb_pcidas_cancel(dev, s); cb_pcidas_cancel(dev, s);
async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
} }
@ -1599,10 +1599,10 @@ static void handle_ao_interrupt(struct comedi_device *dev, unsigned int status)
if (status & DAEMI) { if (status & DAEMI) {
/* clear dac empty interrupt latch */ /* clear dac empty interrupt latch */
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
outw(devpriv->adc_fifo_bits | DAEMI, outw(devpriv->adc_fifo_bits | DAEMI,
devpriv->control_status + INT_ADCFIFO); devpriv->control_status + INT_ADCFIFO);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
if (inw(devpriv->ao_registers + DAC_CSR) & DAC_EMPTY) { if (inw(devpriv->ao_registers + DAC_CSR) & DAC_EMPTY) {
if (cmd->stop_src == TRIG_NONE || if (cmd->stop_src == TRIG_NONE ||
(cmd->stop_src == TRIG_COUNT (cmd->stop_src == TRIG_COUNT
@ -1633,10 +1633,10 @@ static void handle_ao_interrupt(struct comedi_device *dev, unsigned int status)
outsw(devpriv->ao_registers + DACDATA, devpriv->ao_buffer, outsw(devpriv->ao_registers + DACDATA, devpriv->ao_buffer,
num_points); num_points);
/* clear half-full interrupt latch */ /* clear half-full interrupt latch */
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
outw(devpriv->adc_fifo_bits | DAHFI, outw(devpriv->adc_fifo_bits | DAHFI,
devpriv->control_status + INT_ADCFIFO); devpriv->control_status + INT_ADCFIFO);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
} }
comedi_event(dev, s); comedi_event(dev, s);
@ -1647,11 +1647,11 @@ static int cb_pcidas_cancel(struct comedi_device *dev, struct comedi_subdevice *
{ {
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
/* disable interrupts */ /* disable interrupts */
devpriv->adc_fifo_bits &= ~INTE & ~EOAIE; devpriv->adc_fifo_bits &= ~INTE & ~EOAIE;
outw(devpriv->adc_fifo_bits, devpriv->control_status + INT_ADCFIFO); outw(devpriv->adc_fifo_bits, devpriv->control_status + INT_ADCFIFO);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); 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); outw(0, devpriv->control_status + TRIG_CONTSTAT);
@ -1667,7 +1667,7 @@ static int cb_pcidas_ao_cancel(struct comedi_device *dev,
{ {
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
/* disable interrupts */ /* disable interrupts */
devpriv->adc_fifo_bits &= ~DAHFIE & ~DAEMIE; devpriv->adc_fifo_bits &= ~DAHFIE & ~DAEMIE;
outw(devpriv->adc_fifo_bits, devpriv->control_status + INT_ADCFIFO); outw(devpriv->adc_fifo_bits, devpriv->control_status + INT_ADCFIFO);
@ -1675,7 +1675,7 @@ static int cb_pcidas_ao_cancel(struct comedi_device *dev,
/* disable output */ /* disable output */
devpriv->ao_control_bits &= ~DACEN & ~DAC_PACER_MASK; devpriv->ao_control_bits &= ~DACEN & ~DAC_PACER_MASK;
outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR); outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
return 0; return 0;
} }
@ -1705,7 +1705,7 @@ static void write_calibration_bitstream(struct comedi_device *dev,
register_bits |= SERIAL_DATA_IN_BIT; register_bits |= SERIAL_DATA_IN_BIT;
else else
register_bits &= ~SERIAL_DATA_IN_BIT; register_bits &= ~SERIAL_DATA_IN_BIT;
comedi_udelay(write_delay); udelay(write_delay);
outw(register_bits, devpriv->control_status + CALIBRATION_REG); outw(register_bits, devpriv->control_status + CALIBRATION_REG);
} }
} }
@ -1716,7 +1716,7 @@ static int caldac_8800_write(struct comedi_device *dev, unsigned int address,
static const int num_caldac_channels = 8; static const int num_caldac_channels = 8;
static const int bitstream_length = 11; static const int bitstream_length = 11;
unsigned int bitstream = ((address & 0x7) << 8) | value; unsigned int bitstream = ((address & 0x7) << 8) | value;
static const int caldac_8800_comedi_udelay = 1; static const int caldac_8800_udelay = 1;
if (address >= num_caldac_channels) { if (address >= num_caldac_channels) {
comedi_error(dev, "illegal caldac channel"); comedi_error(dev, "illegal caldac channel");
@ -1731,10 +1731,10 @@ static int caldac_8800_write(struct comedi_device *dev, unsigned int address,
write_calibration_bitstream(dev, cal_enable_bits(dev), bitstream, write_calibration_bitstream(dev, cal_enable_bits(dev), bitstream,
bitstream_length); bitstream_length);
comedi_udelay(caldac_8800_comedi_udelay); udelay(caldac_8800_udelay);
outw(cal_enable_bits(dev) | SELECT_8800_BIT, outw(cal_enable_bits(dev) | SELECT_8800_BIT,
devpriv->control_status + CALIBRATION_REG); devpriv->control_status + CALIBRATION_REG);
comedi_udelay(caldac_8800_comedi_udelay); udelay(caldac_8800_udelay);
outw(cal_enable_bits(dev), devpriv->control_status + CALIBRATION_REG); outw(cal_enable_bits(dev), devpriv->control_status + CALIBRATION_REG);
return 1; return 1;
@ -1745,16 +1745,16 @@ static int trimpot_7376_write(struct comedi_device *dev, uint8_t value)
static const int bitstream_length = 7; static const int bitstream_length = 7;
unsigned int bitstream = value & 0x7f; unsigned int bitstream = value & 0x7f;
unsigned int register_bits; unsigned int register_bits;
static const int ad7376_comedi_udelay = 1; static const int ad7376_udelay = 1;
register_bits = cal_enable_bits(dev) | SELECT_TRIMPOT_BIT; register_bits = cal_enable_bits(dev) | SELECT_TRIMPOT_BIT;
comedi_udelay(ad7376_comedi_udelay); udelay(ad7376_udelay);
outw(register_bits, devpriv->control_status + CALIBRATION_REG); outw(register_bits, devpriv->control_status + CALIBRATION_REG);
write_calibration_bitstream(dev, register_bits, bitstream, write_calibration_bitstream(dev, register_bits, bitstream,
bitstream_length); bitstream_length);
comedi_udelay(ad7376_comedi_udelay); udelay(ad7376_udelay);
outw(cal_enable_bits(dev), devpriv->control_status + CALIBRATION_REG); outw(cal_enable_bits(dev), devpriv->control_status + CALIBRATION_REG);
return 0; return 0;
@ -1769,16 +1769,16 @@ static int trimpot_8402_write(struct comedi_device *dev, unsigned int channel,
static const int bitstream_length = 10; static const int bitstream_length = 10;
unsigned int bitstream = ((channel & 0x3) << 8) | (value & 0xff); unsigned int bitstream = ((channel & 0x3) << 8) | (value & 0xff);
unsigned int register_bits; unsigned int register_bits;
static const int ad8402_comedi_udelay = 1; static const int ad8402_udelay = 1;
register_bits = cal_enable_bits(dev) | SELECT_TRIMPOT_BIT; register_bits = cal_enable_bits(dev) | SELECT_TRIMPOT_BIT;
comedi_udelay(ad8402_comedi_udelay); udelay(ad8402_udelay);
outw(register_bits, devpriv->control_status + CALIBRATION_REG); outw(register_bits, devpriv->control_status + CALIBRATION_REG);
write_calibration_bitstream(dev, register_bits, bitstream, write_calibration_bitstream(dev, register_bits, bitstream,
bitstream_length); bitstream_length);
comedi_udelay(ad8402_comedi_udelay); udelay(ad8402_udelay);
outw(cal_enable_bits(dev), devpriv->control_status + CALIBRATION_REG); outw(cal_enable_bits(dev), devpriv->control_status + CALIBRATION_REG);
return 0; return 0;
@ -1794,7 +1794,7 @@ static int wait_for_nvram_ready(unsigned long s5933_base_addr)
AMCC_OP_REG_MCSR_NVCMD) & MCSR_NV_BUSY) AMCC_OP_REG_MCSR_NVCMD) & MCSR_NV_BUSY)
== 0) == 0)
return 0; return 0;
comedi_udelay(1); udelay(1);
} }
return -1; return -1;
} }

View File

@ -98,7 +98,7 @@ known. If you have such a board, please file a bug report at
/* #define PCIDAS64_DEBUG enable debugging code */ /* #define PCIDAS64_DEBUG enable debugging code */
#ifdef PCIDAS64_DEBUG #ifdef PCIDAS64_DEBUG
#define DEBUG_PRINT(format, args...) rt_printk(format , ## args) #define DEBUG_PRINT(format, args...) printk(format , ## args)
#else #else
#define DEBUG_PRINT(format, args...) #define DEBUG_PRINT(format, args...)
#endif #endif
@ -1535,7 +1535,7 @@ static void init_stc_registers(struct comedi_device *dev)
uint16_t bits; uint16_t bits;
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&dev->spinlock, flags); 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) if (1)
@ -1556,7 +1556,7 @@ static void init_stc_registers(struct comedi_device *dev)
writew(0, priv(dev)->main_iobase + DAQ_SYNC_REG); writew(0, priv(dev)->main_iobase + DAQ_SYNC_REG);
writew(0, priv(dev)->main_iobase + CALIBRATION_REG); writew(0, priv(dev)->main_iobase + CALIBRATION_REG);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
/* set fifos to maximum size */ /* set fifos to maximum size */
priv(dev)->fifo_size_bits |= DAC_FIFO_BITS; priv(dev)->fifo_size_bits |= DAC_FIFO_BITS;
@ -1794,7 +1794,7 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it)
init_plx9080(dev); init_plx9080(dev);
init_stc_registers(dev); init_stc_registers(dev);
/* get irq */ /* get irq */
if (comedi_request_irq(pcidev->irq, handle_interrupt, IRQF_SHARED, if (request_irq(pcidev->irq, handle_interrupt, IRQF_SHARED,
"cb_pcidas64", dev)) { "cb_pcidas64", dev)) {
printk(" unable to allocate irq %u\n", pcidev->irq); printk(" unable to allocate irq %u\n", pcidev->irq);
return -EINVAL; return -EINVAL;
@ -1825,7 +1825,7 @@ static int detach(struct comedi_device *dev)
printk("comedi%d: cb_pcidas: remove\n", dev->minor); printk("comedi%d: cb_pcidas: remove\n", dev->minor);
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (priv(dev)) { if (priv(dev)) {
if (priv(dev)->hw_dev) { if (priv(dev)->hw_dev) {
if (priv(dev)->plx9080_iobase) { if (priv(dev)->plx9080_iobase) {
@ -1895,14 +1895,14 @@ static int ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
/* 4020 generates dac done interrupts even though they are disabled */ /* 4020 generates dac done interrupts even though they are disabled */
disable_ai_pacing(dev); disable_ai_pacing(dev);
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
if (insn->chanspec & CR_ALT_FILTER) if (insn->chanspec & CR_ALT_FILTER)
priv(dev)->adc_control1_bits |= ADC_DITHER_BIT; priv(dev)->adc_control1_bits |= ADC_DITHER_BIT;
else else
priv(dev)->adc_control1_bits &= ~ADC_DITHER_BIT; priv(dev)->adc_control1_bits &= ~ADC_DITHER_BIT;
writew(priv(dev)->adc_control1_bits, writew(priv(dev)->adc_control1_bits,
priv(dev)->main_iobase + ADC_CONTROL1_REG); priv(dev)->main_iobase + ADC_CONTROL1_REG);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
if (board(dev)->layout != LAYOUT_4020) { if (board(dev)->layout != LAYOUT_4020) {
/* use internal queue */ /* use internal queue */
@ -1995,12 +1995,12 @@ static int ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
if (pipe_full_bits(bits)) if (pipe_full_bits(bits))
break; break;
} }
comedi_udelay(1); udelay(1);
} }
DEBUG_PRINT(" looped %i times waiting for data\n", i); DEBUG_PRINT(" looped %i times waiting for data\n", i);
if (i == timeout) { if (i == timeout) {
comedi_error(dev, " analog input read insn timed out"); comedi_error(dev, " analog input read insn timed out");
rt_printk(" status 0x%x\n", bits); printk(" status 0x%x\n", bits);
return -ETIME; return -ETIME;
} }
if (board(dev)->layout == LAYOUT_4020) if (board(dev)->layout == LAYOUT_4020)
@ -2357,11 +2357,11 @@ static void disable_ai_pacing(struct comedi_device *dev)
disable_ai_interrupts(dev); disable_ai_interrupts(dev);
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
priv(dev)->adc_control1_bits &= ~ADC_SW_GATE_BIT; priv(dev)->adc_control1_bits &= ~ADC_SW_GATE_BIT;
writew(priv(dev)->adc_control1_bits, writew(priv(dev)->adc_control1_bits,
priv(dev)->main_iobase + ADC_CONTROL1_REG); priv(dev)->main_iobase + ADC_CONTROL1_REG);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
/* disable pacing, triggering, etc */ /* disable pacing, triggering, etc */
writew(ADC_DMA_DISABLE_BIT | ADC_SOFT_GATE_BITS | ADC_GATE_LEVEL_BIT, writew(ADC_DMA_DISABLE_BIT | ADC_SOFT_GATE_BITS | ADC_GATE_LEVEL_BIT,
@ -2372,14 +2372,14 @@ static void disable_ai_interrupts(struct comedi_device *dev)
{ {
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
priv(dev)->intr_enable_bits &= priv(dev)->intr_enable_bits &=
~EN_ADC_INTR_SRC_BIT & ~EN_ADC_DONE_INTR_BIT & ~EN_ADC_INTR_SRC_BIT & ~EN_ADC_DONE_INTR_BIT &
~EN_ADC_ACTIVE_INTR_BIT & ~EN_ADC_STOP_INTR_BIT & ~EN_ADC_ACTIVE_INTR_BIT & ~EN_ADC_STOP_INTR_BIT &
~EN_ADC_OVERRUN_BIT & ~ADC_INTR_SRC_MASK; ~EN_ADC_OVERRUN_BIT & ~ADC_INTR_SRC_MASK;
writew(priv(dev)->intr_enable_bits, writew(priv(dev)->intr_enable_bits,
priv(dev)->main_iobase + INTR_ENABLE_REG); priv(dev)->main_iobase + INTR_ENABLE_REG);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
DEBUG_PRINT("intr enable bits 0x%x\n", priv(dev)->intr_enable_bits); DEBUG_PRINT("intr enable bits 0x%x\n", priv(dev)->intr_enable_bits);
} }
@ -2397,12 +2397,12 @@ static void enable_ai_interrupts(struct comedi_device *dev, const struct comedi_
if (board(dev)->layout != LAYOUT_4020) if (board(dev)->layout != LAYOUT_4020)
bits |= ADC_INTR_EOSCAN_BITS | EN_ADC_INTR_SRC_BIT; bits |= ADC_INTR_EOSCAN_BITS | EN_ADC_INTR_SRC_BIT;
} }
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
priv(dev)->intr_enable_bits |= bits; priv(dev)->intr_enable_bits |= bits;
writew(priv(dev)->intr_enable_bits, writew(priv(dev)->intr_enable_bits,
priv(dev)->main_iobase + INTR_ENABLE_REG); priv(dev)->main_iobase + INTR_ENABLE_REG);
DEBUG_PRINT("intr enable bits 0x%x\n", priv(dev)->intr_enable_bits); DEBUG_PRINT("intr enable bits 0x%x\n", priv(dev)->intr_enable_bits);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
} }
static uint32_t ai_convert_counter_6xxx(const struct comedi_device *dev, static uint32_t ai_convert_counter_6xxx(const struct comedi_device *dev,
@ -2488,7 +2488,7 @@ static inline void dma_start_sync(struct comedi_device *dev, unsigned int channe
unsigned long flags; unsigned long flags;
/* spinlock for plx dma control/status reg */ /* spinlock for plx dma control/status reg */
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
if (channel) if (channel)
writeb(PLX_DMA_EN_BIT | PLX_DMA_START_BIT | writeb(PLX_DMA_EN_BIT | PLX_DMA_START_BIT |
PLX_CLEAR_DMA_INTR_BIT, PLX_CLEAR_DMA_INTR_BIT,
@ -2497,7 +2497,7 @@ static inline void dma_start_sync(struct comedi_device *dev, unsigned int channe
writeb(PLX_DMA_EN_BIT | PLX_DMA_START_BIT | writeb(PLX_DMA_EN_BIT | PLX_DMA_START_BIT |
PLX_CLEAR_DMA_INTR_BIT, PLX_CLEAR_DMA_INTR_BIT,
priv(dev)->plx9080_iobase + PLX_DMA0_CS_REG); priv(dev)->plx9080_iobase + PLX_DMA0_CS_REG);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
} }
static void set_ai_pacing(struct comedi_device *dev, struct comedi_cmd *cmd) static void set_ai_pacing(struct comedi_device *dev, struct comedi_cmd *cmd)
@ -2701,7 +2701,7 @@ static int ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
enable_ai_interrupts(dev, cmd); enable_ai_interrupts(dev, cmd);
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
/* set mode, allow conversions through software gate */ /* set mode, allow conversions through software gate */
priv(dev)->adc_control1_bits |= ADC_SW_GATE_BIT; priv(dev)->adc_control1_bits |= ADC_SW_GATE_BIT;
priv(dev)->adc_control1_bits &= ~ADC_DITHER_BIT; priv(dev)->adc_control1_bits &= ~ADC_DITHER_BIT;
@ -2728,7 +2728,7 @@ static int ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
writew(priv(dev)->adc_control1_bits, writew(priv(dev)->adc_control1_bits,
priv(dev)->main_iobase + ADC_CONTROL1_REG); priv(dev)->main_iobase + ADC_CONTROL1_REG);
DEBUG_PRINT("control1 bits 0x%x\n", priv(dev)->adc_control1_bits); DEBUG_PRINT("control1 bits 0x%x\n", priv(dev)->adc_control1_bits);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
/* clear adc buffer */ /* clear adc buffer */
writew(0, priv(dev)->main_iobase + ADC_BUFFER_CLEAR_REG); writew(0, priv(dev)->main_iobase + ADC_BUFFER_CLEAR_REG);
@ -2762,7 +2762,7 @@ static int ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
writew(bits, priv(dev)->main_iobase + DAQ_ATRIG_LOW_4020_REG); writew(bits, priv(dev)->main_iobase + DAQ_ATRIG_LOW_4020_REG);
} }
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
/* enable pacing, triggering, etc */ /* enable pacing, triggering, etc */
bits = ADC_ENABLE_BIT | ADC_SOFT_GATE_BITS | ADC_GATE_LEVEL_BIT; bits = ADC_ENABLE_BIT | ADC_SOFT_GATE_BITS | ADC_GATE_LEVEL_BIT;
@ -2782,7 +2782,7 @@ static int ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
priv(dev)->ai_cmd_running = 1; priv(dev)->ai_cmd_running = 1;
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
/* start aquisition */ /* start aquisition */
if (cmd->start_src == TRIG_NOW) { if (cmd->start_src == TRIG_NOW) {
@ -2842,7 +2842,7 @@ static void pio_drain_ai_fifo_16(struct comedi_device *dev)
} }
if (num_samples < 0) { if (num_samples < 0) {
rt_printk(" cb_pcidas64: bug! num_samples < 0\n"); printk(" cb_pcidas64: bug! num_samples < 0\n");
break; break;
} }
@ -2964,7 +2964,7 @@ void handle_ai_interrupt(struct comedi_device *dev, unsigned short status,
async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; 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); spin_lock_irqsave(&dev->spinlock, flags);
dma1_status = readb(priv(dev)->plx9080_iobase + PLX_DMA1_CS_REG); 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, writeb((dma1_status & PLX_DMA_EN_BIT) | PLX_CLEAR_DMA_INTR_BIT,
@ -2976,7 +2976,7 @@ void handle_ai_interrupt(struct comedi_device *dev, unsigned short status,
} }
DEBUG_PRINT(" cleared dma ch1 interrupt\n"); DEBUG_PRINT(" cleared dma ch1 interrupt\n");
} }
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
if (status & ADC_DONE_BIT) if (status & ADC_DONE_BIT)
DEBUG_PRINT("adc done interrupt\n"); DEBUG_PRINT("adc done interrupt\n");
@ -2987,12 +2987,12 @@ void handle_ai_interrupt(struct comedi_device *dev, unsigned short status,
(status & ADC_INTR_PENDING_BIT) && (status & ADC_INTR_PENDING_BIT) &&
(board(dev)->layout != LAYOUT_4020))) { (board(dev)->layout != LAYOUT_4020))) {
DEBUG_PRINT("pio fifo drain\n"); DEBUG_PRINT("pio fifo drain\n");
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
if (priv(dev)->ai_cmd_running) { if (priv(dev)->ai_cmd_running) {
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
pio_drain_ai_fifo(dev); pio_drain_ai_fifo(dev);
} else } else
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); 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) || if ((cmd->stop_src == TRIG_COUNT && priv(dev)->ai_count <= 0) ||
@ -3087,7 +3087,7 @@ static void handle_ao_interrupt(struct comedi_device *dev, unsigned short status
cmd = &async->cmd; 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); spin_lock_irqsave(&dev->spinlock, flags);
dma0_status = readb(priv(dev)->plx9080_iobase + PLX_DMA0_CS_REG); 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) if ((dma0_status & PLX_DMA_EN_BIT)
@ -3097,7 +3097,7 @@ static void handle_ao_interrupt(struct comedi_device *dev, unsigned short status
else else
writeb(PLX_CLEAR_DMA_INTR_BIT, writeb(PLX_CLEAR_DMA_INTR_BIT,
priv(dev)->plx9080_iobase + PLX_DMA0_CS_REG); priv(dev)->plx9080_iobase + PLX_DMA0_CS_REG);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
DEBUG_PRINT("dma0 status 0x%x\n", dma0_status); DEBUG_PRINT("dma0 status 0x%x\n", dma0_status);
if (dma0_status & PLX_DMA_EN_BIT) { if (dma0_status & PLX_DMA_EN_BIT) {
load_ao_dma(dev, cmd); load_ao_dma(dev, cmd);
@ -3107,7 +3107,7 @@ static void handle_ao_interrupt(struct comedi_device *dev, unsigned short status
} }
DEBUG_PRINT(" cleared dma ch0 interrupt\n"); DEBUG_PRINT(" cleared dma ch0 interrupt\n");
} else } else
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
if ((status & DAC_DONE_BIT)) { if ((status & DAC_DONE_BIT)) {
async->events |= COMEDI_CB_EOA; async->events |= COMEDI_CB_EOA;
@ -3164,24 +3164,24 @@ void abort_dma(struct comedi_device *dev, unsigned int channel)
unsigned long flags; unsigned long flags;
/* spinlock for plx dma control/status reg */ /* spinlock for plx dma control/status reg */
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
plx9080_abort_dma(priv(dev)->plx9080_iobase, channel); plx9080_abort_dma(priv(dev)->plx9080_iobase, channel);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
} }
static int ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) static int ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
{ {
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
if (priv(dev)->ai_cmd_running == 0) { if (priv(dev)->ai_cmd_running == 0) {
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
return 0; return 0;
} }
priv(dev)->ai_cmd_running = 0; priv(dev)->ai_cmd_running = 0;
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
disable_ai_pacing(dev); disable_ai_pacing(dev);
@ -3722,12 +3722,12 @@ static void ad8402_write(struct comedi_device *dev, unsigned int channel,
static const int bitstream_length = 10; static const int bitstream_length = 10;
unsigned int bit, register_bits; unsigned int bit, register_bits;
unsigned int bitstream = ((channel & 0x3) << 8) | (value & 0xff); unsigned int bitstream = ((channel & 0x3) << 8) | (value & 0xff);
static const int ad8402_comedi_udelay = 1; static const int ad8402_udelay = 1;
priv(dev)->ad8402_state[channel] = value; priv(dev)->ad8402_state[channel] = value;
register_bits = SELECT_8402_64XX_BIT; register_bits = SELECT_8402_64XX_BIT;
comedi_udelay(ad8402_comedi_udelay); udelay(ad8402_udelay);
writew(register_bits, priv(dev)->main_iobase + CALIBRATION_REG); writew(register_bits, priv(dev)->main_iobase + CALIBRATION_REG);
for (bit = 1 << (bitstream_length - 1); bit; bit >>= 1) { for (bit = 1 << (bitstream_length - 1); bit; bit >>= 1) {
@ -3735,14 +3735,14 @@ static void ad8402_write(struct comedi_device *dev, unsigned int channel,
register_bits |= SERIAL_DATA_IN_BIT; register_bits |= SERIAL_DATA_IN_BIT;
else else
register_bits &= ~SERIAL_DATA_IN_BIT; register_bits &= ~SERIAL_DATA_IN_BIT;
comedi_udelay(ad8402_comedi_udelay); udelay(ad8402_udelay);
writew(register_bits, priv(dev)->main_iobase + CALIBRATION_REG); writew(register_bits, priv(dev)->main_iobase + CALIBRATION_REG);
comedi_udelay(ad8402_comedi_udelay); udelay(ad8402_udelay);
writew(register_bits | SERIAL_CLOCK_BIT, writew(register_bits | SERIAL_CLOCK_BIT,
priv(dev)->main_iobase + CALIBRATION_REG); priv(dev)->main_iobase + CALIBRATION_REG);
} }
comedi_udelay(ad8402_comedi_udelay); udelay(ad8402_udelay);
writew(0, priv(dev)->main_iobase + CALIBRATION_REG); writew(0, priv(dev)->main_iobase + CALIBRATION_REG);
} }
@ -3784,32 +3784,32 @@ static uint16_t read_eeprom(struct comedi_device *dev, uint8_t address)
priv(dev)->plx9080_iobase + PLX_CONTROL_REG; priv(dev)->plx9080_iobase + PLX_CONTROL_REG;
uint16_t value; uint16_t value;
static const int value_length = 16; static const int value_length = 16;
static const int eeprom_comedi_udelay = 1; static const int eeprom_udelay = 1;
comedi_udelay(eeprom_comedi_udelay); udelay(eeprom_udelay);
priv(dev)->plx_control_bits &= ~CTL_EE_CLK & ~CTL_EE_CS; 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; priv(dev)->plx_control_bits |= CTL_USERO;
writel(priv(dev)->plx_control_bits, plx_control_addr); writel(priv(dev)->plx_control_bits, plx_control_addr);
/* activate serial eeprom */ /* activate serial eeprom */
comedi_udelay(eeprom_comedi_udelay); udelay(eeprom_udelay);
priv(dev)->plx_control_bits |= CTL_EE_CS; priv(dev)->plx_control_bits |= CTL_EE_CS;
writel(priv(dev)->plx_control_bits, plx_control_addr); 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) { for (bit = 1 << (bitstream_length - 1); bit; bit >>= 1) {
/* set bit to be written */ /* set bit to be written */
comedi_udelay(eeprom_comedi_udelay); udelay(eeprom_udelay);
if (bitstream & bit) if (bitstream & bit)
priv(dev)->plx_control_bits |= CTL_EE_W; priv(dev)->plx_control_bits |= CTL_EE_W;
else else
priv(dev)->plx_control_bits &= ~CTL_EE_W; priv(dev)->plx_control_bits &= ~CTL_EE_W;
writel(priv(dev)->plx_control_bits, plx_control_addr); writel(priv(dev)->plx_control_bits, plx_control_addr);
/* clock in bit */ /* clock in bit */
comedi_udelay(eeprom_comedi_udelay); udelay(eeprom_udelay);
priv(dev)->plx_control_bits |= CTL_EE_CLK; priv(dev)->plx_control_bits |= CTL_EE_CLK;
writel(priv(dev)->plx_control_bits, plx_control_addr); writel(priv(dev)->plx_control_bits, plx_control_addr);
comedi_udelay(eeprom_comedi_udelay); udelay(eeprom_udelay);
priv(dev)->plx_control_bits &= ~CTL_EE_CLK; priv(dev)->plx_control_bits &= ~CTL_EE_CLK;
writel(priv(dev)->plx_control_bits, plx_control_addr); writel(priv(dev)->plx_control_bits, plx_control_addr);
} }
@ -3817,19 +3817,19 @@ static uint16_t read_eeprom(struct comedi_device *dev, uint8_t address)
value = 0; value = 0;
for (bit = 1 << (value_length - 1); bit; bit >>= 1) { for (bit = 1 << (value_length - 1); bit; bit >>= 1) {
/* clock out bit */ /* clock out bit */
comedi_udelay(eeprom_comedi_udelay); udelay(eeprom_udelay);
priv(dev)->plx_control_bits |= CTL_EE_CLK; priv(dev)->plx_control_bits |= CTL_EE_CLK;
writel(priv(dev)->plx_control_bits, plx_control_addr); writel(priv(dev)->plx_control_bits, plx_control_addr);
comedi_udelay(eeprom_comedi_udelay); udelay(eeprom_udelay);
priv(dev)->plx_control_bits &= ~CTL_EE_CLK; priv(dev)->plx_control_bits &= ~CTL_EE_CLK;
writel(priv(dev)->plx_control_bits, plx_control_addr); writel(priv(dev)->plx_control_bits, plx_control_addr);
comedi_udelay(eeprom_comedi_udelay); udelay(eeprom_udelay);
if (readl(plx_control_addr) & CTL_EE_R) if (readl(plx_control_addr) & CTL_EE_R)
value |= bit; value |= bit;
} }
/* deactivate eeprom serial input */ /* deactivate eeprom serial input */
comedi_udelay(eeprom_comedi_udelay); udelay(eeprom_udelay);
priv(dev)->plx_control_bits &= ~CTL_EE_CS; priv(dev)->plx_control_bits &= ~CTL_EE_CS;
writel(priv(dev)->plx_control_bits, plx_control_addr); writel(priv(dev)->plx_control_bits, plx_control_addr);
@ -4018,17 +4018,17 @@ static int caldac_8800_write(struct comedi_device *dev, unsigned int address,
register_bits = 0; register_bits = 0;
if (bitstream & bit) if (bitstream & bit)
register_bits |= SERIAL_DATA_IN_BIT; register_bits |= SERIAL_DATA_IN_BIT;
comedi_udelay(caldac_8800_udelay); udelay(caldac_8800_udelay);
writew(register_bits, priv(dev)->main_iobase + CALIBRATION_REG); writew(register_bits, priv(dev)->main_iobase + CALIBRATION_REG);
register_bits |= SERIAL_CLOCK_BIT; register_bits |= SERIAL_CLOCK_BIT;
comedi_udelay(caldac_8800_udelay); udelay(caldac_8800_udelay);
writew(register_bits, priv(dev)->main_iobase + CALIBRATION_REG); writew(register_bits, priv(dev)->main_iobase + CALIBRATION_REG);
} }
comedi_udelay(caldac_8800_udelay); udelay(caldac_8800_udelay);
writew(SELECT_8800_BIT, priv(dev)->main_iobase + CALIBRATION_REG); writew(SELECT_8800_BIT, priv(dev)->main_iobase + CALIBRATION_REG);
comedi_udelay(caldac_8800_udelay); udelay(caldac_8800_udelay);
writew(0, priv(dev)->main_iobase + CALIBRATION_REG); writew(0, priv(dev)->main_iobase + CALIBRATION_REG);
comedi_udelay(caldac_8800_udelay); udelay(caldac_8800_udelay);
return 0; return 0;
} }
@ -4094,8 +4094,8 @@ static int caldac_i2c_write(struct comedi_device *dev, unsigned int caldac_chann
} }
/* 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_high_udelay = 1000;
static const int i2c_low_comedi_udelay = 10; static const int i2c_low_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 void i2c_set_sda(struct comedi_device *dev, int state)
@ -4107,12 +4107,12 @@ static void i2c_set_sda(struct comedi_device *dev, int state)
/* set data line high */ /* set data line high */
priv(dev)->plx_control_bits &= ~data_bit; priv(dev)->plx_control_bits &= ~data_bit;
writel(priv(dev)->plx_control_bits, plx_control_addr); writel(priv(dev)->plx_control_bits, plx_control_addr);
comedi_udelay(i2c_high_comedi_udelay); udelay(i2c_high_udelay);
} else /* set data line low */ } else /* set data line low */
{ {
priv(dev)->plx_control_bits |= data_bit; priv(dev)->plx_control_bits |= data_bit;
writel(priv(dev)->plx_control_bits, plx_control_addr); writel(priv(dev)->plx_control_bits, plx_control_addr);
comedi_udelay(i2c_low_comedi_udelay); udelay(i2c_low_udelay);
} }
} }
@ -4126,12 +4126,12 @@ static void i2c_set_scl(struct comedi_device *dev, int state)
/* set clock line high */ /* set clock line high */
priv(dev)->plx_control_bits &= ~clock_bit; priv(dev)->plx_control_bits &= ~clock_bit;
writel(priv(dev)->plx_control_bits, plx_control_addr); writel(priv(dev)->plx_control_bits, plx_control_addr);
comedi_udelay(i2c_high_comedi_udelay); udelay(i2c_high_udelay);
} else /* set clock line low */ } else /* set clock line low */
{ {
priv(dev)->plx_control_bits |= clock_bit; priv(dev)->plx_control_bits |= clock_bit;
writel(priv(dev)->plx_control_bits, plx_control_addr); writel(priv(dev)->plx_control_bits, plx_control_addr);
comedi_udelay(i2c_low_comedi_udelay); udelay(i2c_low_udelay);
} }
} }

View File

@ -282,7 +282,7 @@ static int cb_pcimdas_attach(struct comedi_device *dev, struct comedi_devconfig
/* Dont support IRQ yet */ /* Dont support IRQ yet */
/* get irq */ /* get irq */
/* if(comedi_request_irq(devpriv->pci_dev->irq, cb_pcimdas_interrupt, IRQF_SHARED, "cb_pcimdas", dev )) */ /* if(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); */ /* printk(" unable to allocate irq %u\n", devpriv->pci_dev->irq); */
/* return -EINVAL; */ /* return -EINVAL; */
@ -355,7 +355,7 @@ static int cb_pcimdas_detach(struct comedi_device *dev)
#endif #endif
printk("comedi%d: cb_pcimdas: remove\n", dev->minor); printk("comedi%d: cb_pcimdas: remove\n", dev->minor);
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (devpriv) { if (devpriv) {
if (devpriv->pci_dev) { if (devpriv->pci_dev) {
if (devpriv->BADR0) { if (devpriv->BADR0) {

View File

@ -53,7 +53,7 @@ unsigned int cfc_write_array_to_buffer(struct comedi_subdevice *subd, void *data
retval = comedi_buf_write_alloc(async, num_bytes); retval = comedi_buf_write_alloc(async, num_bytes);
if (retval != num_bytes) { if (retval != num_bytes) {
rt_printk("comedi: buffer overrun\n"); printk("comedi: buffer overrun\n");
async->events |= COMEDI_CB_OVERFLOW; async->events |= COMEDI_CB_OVERFLOW;
return 0; return 0;
} }

View File

@ -310,8 +310,8 @@ static int parport_attach(struct comedi_device *dev, struct comedi_devconfig *it
irq = it->options[1]; irq = it->options[1];
if (irq) { if (irq) {
printk(" irq=%u", irq); printk(" irq=%u", irq);
ret = comedi_request_irq(irq, parport_interrupt, 0, ret = request_irq(irq, parport_interrupt, 0, "comedi_parport",
"comedi_parport", dev); dev);
if (ret < 0) { if (ret < 0) {
printk(" irq not available\n"); printk(" irq not available\n");
return -EINVAL; return -EINVAL;
@ -385,7 +385,7 @@ static int parport_detach(struct comedi_device *dev)
release_region(dev->iobase, PARPORT_SIZE); release_region(dev->iobase, PARPORT_SIZE);
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
return 0; return 0;
} }

View File

@ -204,7 +204,7 @@ inline static int check_scan_timing(struct comedi_device *dev,
timing_error = now - (devpriv->start + scan * devpriv->scan_period); timing_error = now - (devpriv->start + scan * devpriv->scan_period);
if (timing_error > devpriv->scan_period) { if (timing_error > devpriv->scan_period) {
comedi_error(dev, "timing error"); comedi_error(dev, "timing error");
rt_printk("scan started %i ns late\n", timing_error * 838); printk("scan started %i ns late\n", timing_error * 838);
return -1; return -1;
} }
@ -222,7 +222,7 @@ inline static int check_conversion_timing(struct comedi_device *dev,
now - (scan_start + conversion * devpriv->convert_period); now - (scan_start + conversion * devpriv->convert_period);
if (timing_error > devpriv->convert_period) { if (timing_error > devpriv->convert_period) {
comedi_error(dev, "timing error"); comedi_error(dev, "timing error");
rt_printk("conversion started %i ns late\n", printk("conversion started %i ns late\n",
timing_error * 838); timing_error * 838);
return -1; return -1;
} }

View File

@ -205,7 +205,7 @@ static int contec_do_insn_bits(struct comedi_device *dev, struct comedi_subdevic
if (data[0]) { if (data[0]) {
s->state &= ~data[0]; s->state &= ~data[0];
s->state |= data[0] & data[1]; s->state |= data[0] & data[1];
rt_printk(" out: %d on %lx\n", s->state, printk(" out: %d on %lx\n", s->state,
dev->iobase + thisboard->out_offs); dev->iobase + thisboard->out_offs);
outw(s->state, dev->iobase + thisboard->out_offs); outw(s->state, dev->iobase + thisboard->out_offs);
} }
@ -216,8 +216,8 @@ static int contec_di_insn_bits(struct comedi_device *dev, struct comedi_subdevic
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
rt_printk("contec_di_insn_bits called\n"); printk("contec_di_insn_bits called\n");
rt_printk(" data: %d %d\n", data[0], data[1]); printk(" data: %d %d\n", data[0], data[1]);
if (insn->n != 2) if (insn->n != 2)
return -EINVAL; return -EINVAL;

View File

@ -342,9 +342,9 @@ static void writeAcqScanListEntry(struct comedi_device *dev, u16 entry)
{ {
struct daqboard2000_hw *fpga = devpriv->daq; struct daqboard2000_hw *fpga = devpriv->daq;
/* comedi_udelay(4); */ /* udelay(4); */
fpga->acqScanListFIFO = entry & 0x00ff; fpga->acqScanListFIFO = entry & 0x00ff;
/* comedi_udelay(4); */ /* udelay(4); */
fpga->acqScanListFIFO = (entry >> 8) & 0x00ff; fpga->acqScanListFIFO = (entry >> 8) & 0x00ff;
} }
@ -425,14 +425,14 @@ static int daqboard2000_ai_insn_read(struct comedi_device *dev, struct comedi_su
if (fpga->acqControl & DAQBOARD2000_AcqConfigPipeFull) { if (fpga->acqControl & DAQBOARD2000_AcqConfigPipeFull) {
break; break;
} }
/* comedi_udelay(2); */ /* udelay(2); */
} }
fpga->acqControl = DAQBOARD2000_AdcPacerEnable; fpga->acqControl = DAQBOARD2000_AdcPacerEnable;
for (timeout = 0; timeout < 20; timeout++) { for (timeout = 0; timeout < 20; timeout++) {
if (fpga->acqControl & DAQBOARD2000_AcqLogicScanning) { if (fpga->acqControl & DAQBOARD2000_AcqLogicScanning) {
break; break;
} }
/* comedi_udelay(2); */ /* udelay(2); */
} }
for (timeout = 0; timeout < 20; timeout++) { for (timeout = 0; timeout < 20; timeout++) {
if (fpga-> if (fpga->
@ -440,7 +440,7 @@ static int daqboard2000_ai_insn_read(struct comedi_device *dev, struct comedi_su
DAQBOARD2000_AcqResultsFIFOHasValidData) { DAQBOARD2000_AcqResultsFIFOHasValidData) {
break; break;
} }
/* comedi_udelay(2); */ /* udelay(2); */
} }
data[i] = fpga->acqResultsFIFO; data[i] = fpga->acqResultsFIFO;
fpga->acqControl = DAQBOARD2000_AdcPacerDisable; fpga->acqControl = DAQBOARD2000_AdcPacerDisable;
@ -476,18 +476,18 @@ static int daqboard2000_ao_insn_write(struct comedi_device *dev, struct comedi_s
* OK, since it works OK without enabling the DAC's, let's keep * OK, since it works OK without enabling the DAC's, let's keep
* it as simple as possible... * it as simple as possible...
*/ */
/* fpga->dacControl = (chan + 2) * 0x0010 | 0x0001; comedi_udelay(1000); */ /* fpga->dacControl = (chan + 2) * 0x0010 | 0x0001; udelay(1000); */
fpga->dacSetting[chan] = data[i]; fpga->dacSetting[chan] = data[i];
for (timeout = 0; timeout < 20; timeout++) { for (timeout = 0; timeout < 20; timeout++) {
if ((fpga->dacControl & ((chan + 1) * 0x0010)) == 0) { if ((fpga->dacControl & ((chan + 1) * 0x0010)) == 0) {
break; break;
} }
/* comedi_udelay(2); */ /* udelay(2); */
} }
devpriv->ao_readback[chan] = data[i]; devpriv->ao_readback[chan] = data[i];
/* /*
* Since we never enabled the DAC's, we don't need to disable it... * Since we never enabled the DAC's, we don't need to disable it...
* fpga->dacControl = (chan + 2) * 0x0010 | 0x0000; comedi_udelay(1000); * fpga->dacControl = (chan + 2) * 0x0010 | 0x0000; udelay(1000);
*/ */
} }
@ -498,29 +498,29 @@ static void daqboard2000_resetLocalBus(struct comedi_device *dev)
{ {
printk("daqboard2000_resetLocalBus\n"); printk("daqboard2000_resetLocalBus\n");
writel(DAQBOARD2000_SECRLocalBusHi, devpriv->plx + 0x6c); writel(DAQBOARD2000_SECRLocalBusHi, devpriv->plx + 0x6c);
comedi_udelay(10000); udelay(10000);
writel(DAQBOARD2000_SECRLocalBusLo, devpriv->plx + 0x6c); writel(DAQBOARD2000_SECRLocalBusLo, devpriv->plx + 0x6c);
comedi_udelay(10000); udelay(10000);
} }
static void daqboard2000_reloadPLX(struct comedi_device *dev) static void daqboard2000_reloadPLX(struct comedi_device *dev)
{ {
printk("daqboard2000_reloadPLX\n"); printk("daqboard2000_reloadPLX\n");
writel(DAQBOARD2000_SECRReloadLo, devpriv->plx + 0x6c); writel(DAQBOARD2000_SECRReloadLo, devpriv->plx + 0x6c);
comedi_udelay(10000); udelay(10000);
writel(DAQBOARD2000_SECRReloadHi, devpriv->plx + 0x6c); writel(DAQBOARD2000_SECRReloadHi, devpriv->plx + 0x6c);
comedi_udelay(10000); udelay(10000);
writel(DAQBOARD2000_SECRReloadLo, devpriv->plx + 0x6c); writel(DAQBOARD2000_SECRReloadLo, devpriv->plx + 0x6c);
comedi_udelay(10000); udelay(10000);
} }
static void daqboard2000_pulseProgPin(struct comedi_device *dev) static void daqboard2000_pulseProgPin(struct comedi_device *dev)
{ {
printk("daqboard2000_pulseProgPin 1\n"); printk("daqboard2000_pulseProgPin 1\n");
writel(DAQBOARD2000_SECRProgPinHi, devpriv->plx + 0x6c); writel(DAQBOARD2000_SECRProgPinHi, devpriv->plx + 0x6c);
comedi_udelay(10000); udelay(10000);
writel(DAQBOARD2000_SECRProgPinLo, devpriv->plx + 0x6c); writel(DAQBOARD2000_SECRProgPinLo, devpriv->plx + 0x6c);
comedi_udelay(10000); /* Not in the original code, but I like symmetry... */ udelay(10000); /* Not in the original code, but I like symmetry... */
} }
static int daqboard2000_pollCPLD(struct comedi_device *dev, int mask) static int daqboard2000_pollCPLD(struct comedi_device *dev, int mask)
@ -536,9 +536,9 @@ static int daqboard2000_pollCPLD(struct comedi_device *dev, int mask)
result = 1; result = 1;
break; break;
} }
comedi_udelay(100); udelay(100);
} }
comedi_udelay(5); udelay(5);
return result; return result;
} }
@ -546,7 +546,7 @@ static int daqboard2000_writeCPLD(struct comedi_device *dev, int data)
{ {
int result = 0; int result = 0;
comedi_udelay(10); udelay(10);
writew(data, devpriv->daq + 0x1000); writew(data, devpriv->daq + 0x1000);
if ((readw(devpriv->daq + 0x1000) & DAQBOARD2000_CPLD_INIT) == if ((readw(devpriv->daq + 0x1000) & DAQBOARD2000_CPLD_INIT) ==
DAQBOARD2000_CPLD_INIT) { DAQBOARD2000_CPLD_INIT) {
@ -623,17 +623,17 @@ static void daqboard2000_adcDisarm(struct comedi_device *dev)
struct daqboard2000_hw *fpga = devpriv->daq; struct daqboard2000_hw *fpga = devpriv->daq;
/* Disable hardware triggers */ /* Disable hardware triggers */
comedi_udelay(2); udelay(2);
fpga->trigControl = DAQBOARD2000_TrigAnalog | DAQBOARD2000_TrigDisable; fpga->trigControl = DAQBOARD2000_TrigAnalog | DAQBOARD2000_TrigDisable;
comedi_udelay(2); udelay(2);
fpga->trigControl = DAQBOARD2000_TrigTTL | DAQBOARD2000_TrigDisable; fpga->trigControl = DAQBOARD2000_TrigTTL | DAQBOARD2000_TrigDisable;
/* Stop the scan list FIFO from loading the configuration pipe */ /* Stop the scan list FIFO from loading the configuration pipe */
comedi_udelay(2); udelay(2);
fpga->acqControl = DAQBOARD2000_SeqStopScanList; fpga->acqControl = DAQBOARD2000_SeqStopScanList;
/* Stop the pacer clock */ /* Stop the pacer clock */
comedi_udelay(2); udelay(2);
fpga->acqControl = DAQBOARD2000_AdcPacerDisable; fpga->acqControl = DAQBOARD2000_AdcPacerDisable;
/* Stop the input dma (abort channel 1) */ /* Stop the input dma (abort channel 1) */
@ -651,7 +651,7 @@ static void daqboard2000_activateReferenceDacs(struct comedi_device *dev)
if ((fpga->dacControl & DAQBOARD2000_RefBusy) == 0) { if ((fpga->dacControl & DAQBOARD2000_RefBusy) == 0) {
break; break;
} }
comedi_udelay(2); udelay(2);
} }
/* printk("DAQBOARD2000_PosRefDacSelect %d\n", timeout);*/ /* printk("DAQBOARD2000_PosRefDacSelect %d\n", timeout);*/
@ -661,7 +661,7 @@ static void daqboard2000_activateReferenceDacs(struct comedi_device *dev)
if ((fpga->dacControl & DAQBOARD2000_RefBusy) == 0) { if ((fpga->dacControl & DAQBOARD2000_RefBusy) == 0) {
break; break;
} }
comedi_udelay(2); udelay(2);
} }
/* printk("DAQBOARD2000_NegRefDacSelect %d\n", timeout);*/ /* printk("DAQBOARD2000_NegRefDacSelect %d\n", timeout);*/
} }

View File

@ -545,7 +545,7 @@ static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
/* clear over-range bits for 16-bit boards */ /* clear over-range bits for 16-bit boards */
if (thisboard->ai_nbits == 16) if (thisboard->ai_nbits == 16)
if (inb(dev->iobase + DAS08_MSB) & 0x80) if (inb(dev->iobase + DAS08_MSB) & 0x80)
rt_printk("das08: over-range\n"); printk("das08: over-range\n");
/* trigger conversion */ /* trigger conversion */
outb_p(0, dev->iobase + DAS08_TRIG_12BIT); outb_p(0, dev->iobase + DAS08_TRIG_12BIT);
@ -555,7 +555,7 @@ static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
break; break;
} }
if (i == TIMEOUT) { if (i == TIMEOUT) {
rt_printk("das08: timeout\n"); printk("das08: timeout\n");
return -ETIME; return -ETIME;
} }
msb = inb(dev->iobase + DAS08_MSB); msb = inb(dev->iobase + DAS08_MSB);

View File

@ -90,7 +90,7 @@ Computer boards manuals also available from their website www.measurementcomputi
/* #define DEBUG */ /* #define DEBUG */
#ifdef DEBUG #ifdef DEBUG
#define DEBUG_PRINT(format, args...) rt_printk("das16: " format, ## args) #define DEBUG_PRINT(format, args...) printk("das16: " format, ## args)
#else #else
#define DEBUG_PRINT(format, args...) #define DEBUG_PRINT(format, args...)
#endif #endif
@ -998,7 +998,7 @@ static int das16_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
{ {
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
/* disable interrupts, dma and pacer clocked conversions */ /* disable interrupts, dma and pacer clocked conversions */
devpriv->control_state &= ~DAS16_INTE & ~PACING_MASK & ~DMA_ENABLE; devpriv->control_state &= ~DAS16_INTE & ~PACING_MASK & ~DMA_ENABLE;
outb(devpriv->control_state, dev->iobase + DAS16_CONTROL); outb(devpriv->control_state, dev->iobase + DAS16_CONTROL);
@ -1016,7 +1016,7 @@ static int das16_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
outb(0, dev->iobase + DAS1600_BURST); outb(0, dev->iobase + DAS1600_BURST);
} }
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
return 0; return 0;
} }
@ -1062,7 +1062,7 @@ static int das16_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
break; break;
} }
if (i == DAS16_TIMEOUT) { if (i == DAS16_TIMEOUT) {
rt_printk("das16: timeout\n"); printk("das16: timeout\n");
return -ETIME; return -ETIME;
} }
msb = inb(dev->iobase + DAS16_AI_MSB); msb = inb(dev->iobase + DAS16_AI_MSB);
@ -1180,7 +1180,7 @@ static int disable_dma_on_even(struct comedi_device *dev)
enable_dma(devpriv->dma_chan); enable_dma(devpriv->dma_chan);
for (j = 0; j < enable_timeout; ++j) { for (j = 0; j < enable_timeout; ++j) {
int new_residue; int new_residue;
comedi_udelay(2); udelay(2);
new_residue = get_dma_residue(devpriv->dma_chan); new_residue = get_dma_residue(devpriv->dma_chan);
if (new_residue != residue) if (new_residue != residue)
break; break;
@ -1217,9 +1217,9 @@ static void das16_interrupt(struct comedi_device *dev)
return; return;
} }
comedi_spin_lock_irqsave(&dev->spinlock, spin_flags); spin_lock_irqsave(&dev->spinlock, spin_flags);
if ((devpriv->control_state & DMA_ENABLE) == 0) { if ((devpriv->control_state & DMA_ENABLE) == 0) {
comedi_spin_unlock_irqrestore(&dev->spinlock, spin_flags); spin_unlock_irqrestore(&dev->spinlock, spin_flags);
DEBUG_PRINT("interrupt while dma disabled?\n"); DEBUG_PRINT("interrupt while dma disabled?\n");
return; return;
} }
@ -1263,7 +1263,7 @@ static void das16_interrupt(struct comedi_device *dev)
} }
release_dma_lock(dma_flags); release_dma_lock(dma_flags);
comedi_spin_unlock_irqrestore(&dev->spinlock, spin_flags); spin_unlock_irqrestore(&dev->spinlock, spin_flags);
cfc_write_array_to_buffer(s, cfc_write_array_to_buffer(s,
devpriv->dma_buffer[buffer_index], num_bytes); devpriv->dma_buffer[buffer_index], num_bytes);
@ -1449,8 +1449,7 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it)
/* now for the irq */ /* now for the irq */
if (irq > 1 && irq < 8) { if (irq > 1 && irq < 8) {
ret = comedi_request_irq(irq, das16_dma_interrupt, 0, ret = request_irq(irq, das16_dma_interrupt, 0, "das16", dev);
"das16", dev);
if (ret < 0) if (ret < 0)
return ret; return ret;
@ -1658,7 +1657,7 @@ static int das16_detach(struct comedi_device *dev)
} }
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (dev->iobase) { if (dev->iobase) {
if (thisboard->size < 0x400) { if (thisboard->size < 0x400) {

View File

@ -466,10 +466,10 @@ static int das16m1_poll(struct comedi_device *dev, struct comedi_subdevice *s)
unsigned int status; unsigned int status;
/* prevent race with interrupt handler */ /* prevent race with interrupt handler */
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
status = inb(dev->iobase + DAS16M1_CS); status = inb(dev->iobase + DAS16M1_CS);
das16m1_handler(dev, status); das16m1_handler(dev, status);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
return s->async->buf_write_count - s->async->buf_read_count; return s->async->buf_write_count - s->async->buf_read_count;
} }
@ -669,8 +669,8 @@ static int das16m1_attach(struct comedi_device *dev, struct comedi_devconfig *it
irq = it->options[1]; irq = it->options[1];
/* make sure it is valid */ /* make sure it is valid */
if (das16m1_irq_bits(irq) >= 0) { if (das16m1_irq_bits(irq) >= 0) {
ret = comedi_request_irq(irq, das16m1_interrupt, 0, ret = request_irq(irq, das16m1_interrupt, 0,
driver_das16m1.driver_name, dev); driver_das16m1.driver_name, dev);
if (ret < 0) { if (ret < 0) {
printk(", irq unavailable\n"); printk(", irq unavailable\n");
return ret; return ret;
@ -753,7 +753,7 @@ static int das16m1_detach(struct comedi_device *dev)
subdev_8255_cleanup(dev, dev->subdevices + 3); subdev_8255_cleanup(dev, dev->subdevices + 3);
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (dev->iobase) { if (dev->iobase) {
release_region(dev->iobase, DAS16M1_SIZE); release_region(dev->iobase, DAS16M1_SIZE);

View File

@ -651,7 +651,7 @@ static int das1800_attach(struct comedi_device *dev, struct comedi_devconfig *it
/* grab our IRQ */ /* grab our IRQ */
if (irq) { if (irq) {
if (comedi_request_irq(irq, das1800_interrupt, 0, if (request_irq(irq, das1800_interrupt, 0,
driver_das1800.driver_name, dev)) { driver_das1800.driver_name, dev)) {
printk(" unable to allocate irq %u\n", irq); printk(" unable to allocate irq %u\n", irq);
return -EINVAL; return -EINVAL;
@ -771,7 +771,7 @@ static int das1800_detach(struct comedi_device *dev)
if (dev->iobase) if (dev->iobase)
release_region(dev->iobase, DAS1800_SIZE); release_region(dev->iobase, DAS1800_SIZE);
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (dev->private) { if (dev->private) {
if (devpriv->iobase2) if (devpriv->iobase2)
release_region(devpriv->iobase2, DAS1800_SIZE); release_region(devpriv->iobase2, DAS1800_SIZE);
@ -872,9 +872,9 @@ static int das1800_ai_poll(struct comedi_device *dev, struct comedi_subdevice *s
unsigned long flags; unsigned long flags;
/* prevent race with interrupt handler */ /* prevent race with interrupt handler */
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
das1800_ai_handler(dev); das1800_ai_handler(dev);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
return s->async->buf_write_count - s->async->buf_read_count; return s->async->buf_write_count - s->async->buf_read_count;
} }
@ -1471,7 +1471,7 @@ static void program_chanlist(struct comedi_device *dev, struct comedi_cmd cmd)
n = cmd.chanlist_len; n = cmd.chanlist_len;
/* spinlock protects indirect addressing */ /* spinlock protects indirect addressing */
comedi_spin_lock_irqsave(&dev->spinlock, irq_flags); spin_lock_irqsave(&dev->spinlock, irq_flags);
outb(QRAM, dev->iobase + DAS1800_SELECT); /* select QRAM for baseAddress + 0x0 */ outb(QRAM, dev->iobase + DAS1800_SELECT); /* select QRAM for baseAddress + 0x0 */
outb(n - 1, dev->iobase + DAS1800_QRAM_ADDRESS); /*set QRAM address start */ outb(n - 1, dev->iobase + DAS1800_QRAM_ADDRESS); /*set QRAM address start */
/* make channel / gain list */ /* make channel / gain list */
@ -1483,7 +1483,7 @@ static void program_chanlist(struct comedi_device *dev, struct comedi_cmd cmd)
outw(chan_range, dev->iobase + DAS1800_QRAM); outw(chan_range, dev->iobase + DAS1800_QRAM);
} }
outb(n - 1, dev->iobase + DAS1800_QRAM_ADDRESS); /*finish write to QRAM */ outb(n - 1, dev->iobase + DAS1800_QRAM_ADDRESS); /*finish write to QRAM */
comedi_spin_unlock_irqrestore(&dev->spinlock, irq_flags); spin_unlock_irqrestore(&dev->spinlock, irq_flags);
return; return;
} }
@ -1582,7 +1582,7 @@ static int das1800_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *
/* mask of unipolar/bipolar bit from range */ /* mask of unipolar/bipolar bit from range */
range = CR_RANGE(insn->chanspec) & 0x3; range = CR_RANGE(insn->chanspec) & 0x3;
chan_range = chan | (range << 8); chan_range = chan | (range << 8);
comedi_spin_lock_irqsave(&dev->spinlock, irq_flags); spin_lock_irqsave(&dev->spinlock, irq_flags);
outb(QRAM, dev->iobase + DAS1800_SELECT); /* select QRAM for baseAddress + 0x0 */ outb(QRAM, dev->iobase + DAS1800_SELECT); /* select QRAM for baseAddress + 0x0 */
outb(0x0, dev->iobase + DAS1800_QRAM_ADDRESS); /* set QRAM address start */ outb(0x0, dev->iobase + DAS1800_QRAM_ADDRESS); /* set QRAM address start */
outw(chan_range, dev->iobase + DAS1800_QRAM); outw(chan_range, dev->iobase + DAS1800_QRAM);
@ -1606,7 +1606,7 @@ static int das1800_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *
dpnt += 1 << (thisboard->resolution - 1); dpnt += 1 << (thisboard->resolution - 1);
data[n] = dpnt; data[n] = dpnt;
} }
comedi_spin_unlock_irqrestore(&dev->spinlock, irq_flags); spin_unlock_irqrestore(&dev->spinlock, irq_flags);
return n; return n;
} }
@ -1627,7 +1627,7 @@ static int das1800_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *
if (chan == update_chan) if (chan == update_chan)
devpriv->ao_update_bits = output; devpriv->ao_update_bits = output;
/* write to channel */ /* write to channel */
comedi_spin_lock_irqsave(&dev->spinlock, irq_flags); spin_lock_irqsave(&dev->spinlock, irq_flags);
outb(DAC(chan), dev->iobase + DAS1800_SELECT); /* select dac channel for baseAddress + 0x0 */ outb(DAC(chan), dev->iobase + DAS1800_SELECT); /* select dac channel for baseAddress + 0x0 */
outw(output, dev->iobase + DAS1800_DAC); 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 */
@ -1635,7 +1635,7 @@ static int das1800_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *
outb(DAC(update_chan), dev->iobase + DAS1800_SELECT); /* select 'update' channel for baseAddress + 0x0 */ outb(DAC(update_chan), dev->iobase + DAS1800_SELECT); /* select 'update' channel for baseAddress + 0x0 */
outw(devpriv->ao_update_bits, dev->iobase + DAS1800_DAC); outw(devpriv->ao_update_bits, dev->iobase + DAS1800_DAC);
} }
comedi_spin_unlock_irqrestore(&dev->spinlock, irq_flags); spin_unlock_irqrestore(&dev->spinlock, irq_flags);
return 1; return 1;
} }

View File

@ -292,7 +292,7 @@ static int board_init(struct comedi_device *dev)
static int das6402_detach(struct comedi_device *dev) static int das6402_detach(struct comedi_device *dev)
{ {
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (dev->iobase) if (dev->iobase)
release_region(dev->iobase, DAS6402_SIZE); release_region(dev->iobase, DAS6402_SIZE);
@ -324,7 +324,7 @@ static int das6402_attach(struct comedi_device *dev, struct comedi_devconfig *it
irq = it->options[0]; irq = it->options[0];
printk(" ( irq = %u )", irq); printk(" ( irq = %u )", irq);
ret = comedi_request_irq(irq, intr_handler, 0, "das6402", dev); ret = request_irq(irq, intr_handler, 0, "das6402", dev);
if (ret < 0) { if (ret < 0) {
printk("irq conflict\n"); printk("irq conflict\n");
return ret; return ret;

View File

@ -279,10 +279,10 @@ static int das800_probe(struct comedi_device *dev)
int board; 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); spin_lock_irqsave(&dev->spinlock, irq_flags);
outb(ID, dev->iobase + DAS800_GAIN); /* select base address + 7 to be ID register */ 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 */ id_bits = inb(dev->iobase + DAS800_ID) & 0x3; /* get id bits */
comedi_spin_unlock_irqrestore(&dev->spinlock, irq_flags); spin_unlock_irqrestore(&dev->spinlock, irq_flags);
board = thisboard - das800_boards; board = thisboard - das800_boards;
@ -370,12 +370,12 @@ static irqreturn_t das800_interrupt(int irq, void *d)
async = s->async; 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); spin_lock_irqsave(&dev->spinlock, irq_flags);
outb(CONTROL1, dev->iobase + DAS800_GAIN); /* select base address + 7 to be STATUS2 register */ outb(CONTROL1, dev->iobase + DAS800_GAIN); /* select base address + 7 to be STATUS2 register */
status = inb(dev->iobase + DAS800_STATUS2) & STATUS2_HCEN; status = inb(dev->iobase + DAS800_STATUS2) & STATUS2_HCEN;
/* don't release spinlock yet since we want to make sure noone else disables hardware conversions */ /* don't release spinlock yet since we want to make sure noone else disables hardware conversions */
if (status == 0) { if (status == 0) {
comedi_spin_unlock_irqrestore(&dev->spinlock, irq_flags); spin_unlock_irqrestore(&dev->spinlock, irq_flags);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
@ -415,7 +415,7 @@ static irqreturn_t das800_interrupt(int irq, void *d)
fifo_overflow = inb(dev->iobase + DAS800_GAIN) & CIO_FFOV; fifo_overflow = inb(dev->iobase + DAS800_GAIN) & CIO_FFOV;
} }
if (fifo_overflow) { if (fifo_overflow) {
comedi_spin_unlock_irqrestore(&dev->spinlock, irq_flags); spin_unlock_irqrestore(&dev->spinlock, irq_flags);
comedi_error(dev, "DAS800 FIFO overflow"); comedi_error(dev, "DAS800 FIFO overflow");
das800_cancel(dev, dev->subdevices + 0); das800_cancel(dev, dev->subdevices + 0);
async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA;
@ -429,10 +429,10 @@ static irqreturn_t das800_interrupt(int irq, void *d)
outb(CONTROL1, dev->iobase + DAS800_GAIN); /* select dev->iobase + 2 to be control register 1 */ outb(CONTROL1, dev->iobase + DAS800_GAIN); /* select dev->iobase + 2 to be control register 1 */
outb(CONTROL1_INTE | devpriv->do_bits, outb(CONTROL1_INTE | devpriv->do_bits,
dev->iobase + DAS800_CONTROL1); dev->iobase + DAS800_CONTROL1);
comedi_spin_unlock_irqrestore(&dev->spinlock, irq_flags); spin_unlock_irqrestore(&dev->spinlock, irq_flags);
/* otherwise, stop taking data */ /* otherwise, stop taking data */
} else { } else {
comedi_spin_unlock_irqrestore(&dev->spinlock, irq_flags); spin_unlock_irqrestore(&dev->spinlock, irq_flags);
disable_das800(dev); /* diable hardware triggered conversions */ disable_das800(dev); /* diable hardware triggered conversions */
async->events |= COMEDI_CB_EOA; async->events |= COMEDI_CB_EOA;
} }
@ -484,7 +484,7 @@ static int das800_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return -EINVAL; return -EINVAL;
} }
if (irq) { if (irq) {
if (comedi_request_irq(irq, das800_interrupt, 0, "das800", dev)) { if (request_irq(irq, das800_interrupt, 0, "das800", dev)) {
printk("unable to allocate irq %u\n", irq); printk("unable to allocate irq %u\n", irq);
return -EINVAL; return -EINVAL;
} }
@ -531,10 +531,10 @@ static int das800_attach(struct comedi_device *dev, struct comedi_devconfig *it)
disable_das800(dev); disable_das800(dev);
/* initialize digital out channels */ /* initialize digital out channels */
comedi_spin_lock_irqsave(&dev->spinlock, irq_flags); spin_lock_irqsave(&dev->spinlock, irq_flags);
outb(CONTROL1, dev->iobase + DAS800_GAIN); /* select dev->iobase + 2 to be control register 1 */ outb(CONTROL1, dev->iobase + DAS800_GAIN); /* select dev->iobase + 2 to be control register 1 */
outb(CONTROL1_INTE | devpriv->do_bits, dev->iobase + DAS800_CONTROL1); outb(CONTROL1_INTE | devpriv->do_bits, dev->iobase + DAS800_CONTROL1);
comedi_spin_unlock_irqrestore(&dev->spinlock, irq_flags); spin_unlock_irqrestore(&dev->spinlock, irq_flags);
return 0; return 0;
}; };
@ -547,7 +547,7 @@ static int das800_detach(struct comedi_device *dev)
if (dev->iobase) if (dev->iobase)
release_region(dev->iobase, DAS800_SIZE); release_region(dev->iobase, DAS800_SIZE);
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
return 0; return 0;
}; };
@ -563,7 +563,7 @@ static int das800_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
static void enable_das800(struct comedi_device *dev) static void enable_das800(struct comedi_device *dev)
{ {
unsigned long irq_flags; unsigned long irq_flags;
comedi_spin_lock_irqsave(&dev->spinlock, irq_flags); 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) if (thisboard->resolution == 16)
outb(CIO_ENHF, dev->iobase + DAS800_GAIN); outb(CIO_ENHF, dev->iobase + DAS800_GAIN);
@ -571,17 +571,17 @@ static void enable_das800(struct comedi_device *dev)
outb(CONV_HCEN, dev->iobase + DAS800_CONV_CONTROL); /* enable hardware triggering */ outb(CONV_HCEN, dev->iobase + DAS800_CONV_CONTROL); /* enable hardware triggering */
outb(CONTROL1, dev->iobase + DAS800_GAIN); /* select dev->iobase + 2 to be control register 1 */ outb(CONTROL1, dev->iobase + DAS800_GAIN); /* select dev->iobase + 2 to be control register 1 */
outb(CONTROL1_INTE | devpriv->do_bits, dev->iobase + DAS800_CONTROL1); /* enable card's interrupt */ outb(CONTROL1_INTE | devpriv->do_bits, dev->iobase + DAS800_CONTROL1); /* enable card's interrupt */
comedi_spin_unlock_irqrestore(&dev->spinlock, irq_flags); spin_unlock_irqrestore(&dev->spinlock, irq_flags);
} }
/* disable_das800 stops hardware triggered conversions */ /* disable_das800 stops hardware triggered conversions */
static void disable_das800(struct comedi_device *dev) static void disable_das800(struct comedi_device *dev)
{ {
unsigned long irq_flags; unsigned long irq_flags;
comedi_spin_lock_irqsave(&dev->spinlock, irq_flags); spin_lock_irqsave(&dev->spinlock, irq_flags);
outb(CONV_CONTROL, dev->iobase + DAS800_GAIN); /* select dev->iobase + 2 to be conversion control register */ outb(CONV_CONTROL, dev->iobase + DAS800_GAIN); /* select dev->iobase + 2 to be conversion control register */
outb(0x0, dev->iobase + DAS800_CONV_CONTROL); /* disable hardware triggering of conversions */ outb(0x0, dev->iobase + DAS800_CONV_CONTROL); /* disable hardware triggering of conversions */
comedi_spin_unlock_irqrestore(&dev->spinlock, irq_flags); spin_unlock_irqrestore(&dev->spinlock, irq_flags);
} }
static int das800_ai_do_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, static int das800_ai_do_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
@ -729,10 +729,10 @@ static int das800_ai_do_cmd(struct comedi_device *dev, struct comedi_subdevice *
endChan = (startChan + async->cmd.chanlist_len - 1) % 8; endChan = (startChan + async->cmd.chanlist_len - 1) % 8;
scan = (endChan << 3) | startChan; scan = (endChan << 3) | startChan;
comedi_spin_lock_irqsave(&dev->spinlock, irq_flags); spin_lock_irqsave(&dev->spinlock, irq_flags);
outb(SCAN_LIMITS, dev->iobase + DAS800_GAIN); /* select base address + 2 to be scan limits register */ outb(SCAN_LIMITS, dev->iobase + DAS800_GAIN); /* select base address + 2 to be scan limits register */
outb(scan, dev->iobase + DAS800_SCAN_LIMITS); /* set scan limits */ outb(scan, dev->iobase + DAS800_SCAN_LIMITS); /* set scan limits */
comedi_spin_unlock_irqrestore(&dev->spinlock, irq_flags); spin_unlock_irqrestore(&dev->spinlock, irq_flags);
/* set gain */ /* set gain */
gain = CR_RANGE(async->cmd.chanlist[0]); gain = CR_RANGE(async->cmd.chanlist[0]);
@ -779,10 +779,10 @@ static int das800_ai_do_cmd(struct comedi_device *dev, struct comedi_subdevice *
break; break;
} }
comedi_spin_lock_irqsave(&dev->spinlock, irq_flags); spin_lock_irqsave(&dev->spinlock, irq_flags);
outb(CONV_CONTROL, dev->iobase + DAS800_GAIN); /* select dev->iobase + 2 to be conversion control register */ outb(CONV_CONTROL, dev->iobase + DAS800_GAIN); /* select dev->iobase + 2 to be conversion control register */
outb(conv_bits, dev->iobase + DAS800_CONV_CONTROL); outb(conv_bits, dev->iobase + DAS800_CONV_CONTROL);
comedi_spin_unlock_irqrestore(&dev->spinlock, irq_flags); spin_unlock_irqrestore(&dev->spinlock, irq_flags);
async->events = 0; async->events = 0;
enable_das800(dev); enable_das800(dev);
return 0; return 0;
@ -803,10 +803,10 @@ static int das800_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s
/* set multiplexer */ /* set multiplexer */
chan = CR_CHAN(insn->chanspec); chan = CR_CHAN(insn->chanspec);
comedi_spin_lock_irqsave(&dev->spinlock, irq_flags); spin_lock_irqsave(&dev->spinlock, irq_flags);
outb(CONTROL1, dev->iobase + DAS800_GAIN); /* select dev->iobase + 2 to be control register 1 */ outb(CONTROL1, dev->iobase + DAS800_GAIN); /* select dev->iobase + 2 to be control register 1 */
outb(chan | devpriv->do_bits, dev->iobase + DAS800_CONTROL1); outb(chan | devpriv->do_bits, dev->iobase + DAS800_CONTROL1);
comedi_spin_unlock_irqrestore(&dev->spinlock, irq_flags); spin_unlock_irqrestore(&dev->spinlock, irq_flags);
/* set gain / range */ /* set gain / range */
range = CR_RANGE(insn->chanspec); range = CR_RANGE(insn->chanspec);
@ -815,7 +815,7 @@ static int das800_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s
range &= 0xf; range &= 0xf;
outb(range, dev->iobase + DAS800_GAIN); outb(range, dev->iobase + DAS800_GAIN);
comedi_udelay(5); udelay(5);
for (n = 0; n < insn->n; n++) { for (n = 0; n < insn->n; n++) {
/* trigger conversion */ /* trigger conversion */
@ -868,10 +868,10 @@ static int das800_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s
wbits |= data[0] & data[1]; wbits |= data[0] & data[1];
devpriv->do_bits = wbits << 4; devpriv->do_bits = wbits << 4;
comedi_spin_lock_irqsave(&dev->spinlock, irq_flags); spin_lock_irqsave(&dev->spinlock, irq_flags);
outb(CONTROL1, dev->iobase + DAS800_GAIN); /* select dev->iobase + 2 to be control register 1 */ outb(CONTROL1, dev->iobase + DAS800_GAIN); /* select dev->iobase + 2 to be control register 1 */
outb(devpriv->do_bits | CONTROL1_INTE, dev->iobase + DAS800_CONTROL1); outb(devpriv->do_bits | CONTROL1_INTE, dev->iobase + DAS800_CONTROL1);
comedi_spin_unlock_irqrestore(&dev->spinlock, irq_flags); spin_unlock_irqrestore(&dev->spinlock, irq_flags);
data[1] = wbits; data[1] = wbits;

View File

@ -380,8 +380,7 @@ static int dmm32at_attach(struct comedi_device *dev, struct comedi_devconfig *it
/* board is there, register interrupt */ /* board is there, register interrupt */
if (irq) { if (irq) {
ret = comedi_request_irq(irq, dmm32at_isr, 0, thisboard->name, ret = request_irq(irq, dmm32at_isr, 0, thisboard->name, dev);
dev);
if (ret < 0) { if (ret < 0) {
printk("irq conflict\n"); printk("irq conflict\n");
return ret; return ret;
@ -485,7 +484,7 @@ static int dmm32at_detach(struct comedi_device *dev)
{ {
printk("comedi%d: dmm32at: remove\n", dev->minor); printk("comedi%d: dmm32at: remove\n", dev->minor);
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (dev->iobase) if (dev->iobase)
release_region(dev->iobase, DMM32AT_MEMSIZE); release_region(dev->iobase, DMM32AT_MEMSIZE);

View File

@ -384,7 +384,7 @@ static int dt2801_reset(struct comedi_device *dev)
outb_p(DT_C_STOP, dev->iobase + DT2801_CMD); outb_p(DT_C_STOP, dev->iobase + DT2801_CMD);
/* dt2801_wait_for_ready(dev); */ /* dt2801_wait_for_ready(dev); */
comedi_udelay(100); udelay(100);
timeout = 10000; timeout = 10000;
do { do {
stat = inb_p(dev->iobase + DT2801_STATUS); stat = inb_p(dev->iobase + DT2801_STATUS);
@ -402,7 +402,7 @@ static int dt2801_reset(struct comedi_device *dev)
outb_p(DT_C_RESET, dev->iobase + DT2801_CMD); outb_p(DT_C_RESET, dev->iobase + DT2801_CMD);
/* dt2801_writecmd(dev,DT_C_RESET); */ /* dt2801_writecmd(dev,DT_C_RESET); */
comedi_udelay(100); udelay(100);
timeout = 10000; timeout = 10000;
do { do {
stat = inb_p(dev->iobase + DT2801_STATUS); stat = inb_p(dev->iobase + DT2801_STATUS);

View File

@ -335,7 +335,7 @@ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it)
#if 0 #if 0
outb(0, dev->iobase + DT2811_ADCSR); outb(0, dev->iobase + DT2811_ADCSR);
comedi_udelay(100); udelay(100);
i = inb(dev->iobase + DT2811_ADDATLO); i = inb(dev->iobase + DT2811_ADDATLO);
i = inb(dev->iobase + DT2811_ADDATHI); i = inb(dev->iobase + DT2811_ADDATHI);
#endif #endif
@ -351,7 +351,7 @@ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it)
dev->iobase + DT2811_ADCSR); dev->iobase + DT2811_ADCSR);
outb(0, dev->iobase + DT2811_ADGCR); outb(0, dev->iobase + DT2811_ADGCR);
comedi_udelay(100); udelay(100);
irq = probe_irq_off(irqs); irq = probe_irq_off(irqs);
restore_flags(flags); restore_flags(flags);
@ -366,7 +366,7 @@ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it)
i = inb(dev->iobase + DT2811_ADDATLO); i = inb(dev->iobase + DT2811_ADDATLO);
i = inb(dev->iobase + DT2811_ADDATHI); i = inb(dev->iobase + DT2811_ADDATHI);
printk("(irq = %d)\n", irq); printk("(irq = %d)\n", irq);
ret = comedi_request_irq(irq, dt2811_interrupt, 0, ret = request_irq(irq, dt2811_interrupt, 0,
driver_name, dev); driver_name, dev);
if (ret < 0) if (ret < 0)
return -EIO; return -EIO;
@ -489,7 +489,7 @@ static int dt2811_detach(struct comedi_device *dev)
printk("comedi%d: dt2811: remove\n", dev->minor); printk("comedi%d: dt2811: remove\n", dev->minor);
if (dev->irq) { if (dev->irq) {
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
} }
if (dev->iobase) { if (dev->iobase) {
release_region(dev->iobase, DT2811_SIZE); release_region(dev->iobase, DT2811_SIZE);

View File

@ -97,7 +97,7 @@ static int dt2814_ai_insn_read(struct comedi_device *dev, struct comedi_subdevic
for (i = 0; i < DT2814_TIMEOUT; i++) { for (i = 0; i < DT2814_TIMEOUT; i++) {
status = inb(dev->iobase + DT2814_CSR); status = inb(dev->iobase + DT2814_CSR);
printk("dt2814: status: %02x\n", status); printk("dt2814: status: %02x\n", status);
comedi_udelay(10); udelay(10);
if (status & DT2814_FINISH) if (status & DT2814_FINISH)
break; break;
} }
@ -262,7 +262,7 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it)
dev->board_name = "dt2814"; dev->board_name = "dt2814";
outb(0, dev->iobase + DT2814_CSR); outb(0, dev->iobase + DT2814_CSR);
comedi_udelay(100); udelay(100);
if (inb(dev->iobase + DT2814_CSR) & DT2814_ERR) { if (inb(dev->iobase + DT2814_CSR) & DT2814_ERR) {
printk("reset error (fatal)\n"); printk("reset error (fatal)\n");
return -EIO; return -EIO;
@ -279,7 +279,7 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it)
outb(0, dev->iobase + DT2814_CSR); outb(0, dev->iobase + DT2814_CSR);
comedi_udelay(100); udelay(100);
irq = probe_irq_off(irqs); irq = probe_irq_off(irqs);
restore_flags(flags); restore_flags(flags);
@ -293,7 +293,7 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it)
#endif #endif
dev->irq = 0; dev->irq = 0;
if (irq > 0) { if (irq > 0) {
if (comedi_request_irq(irq, dt2814_interrupt, 0, "dt2814", dev)) { if (request_irq(irq, dt2814_interrupt, 0, "dt2814", dev)) {
printk("(irq %d unavailable)\n", irq); printk("(irq %d unavailable)\n", irq);
} else { } else {
printk("( irq = %d )\n", irq); printk("( irq = %d )\n", irq);
@ -337,7 +337,7 @@ static int dt2814_detach(struct comedi_device *dev)
printk("comedi%d: dt2814: remove\n", dev->minor); printk("comedi%d: dt2814: remove\n", dev->minor);
if (dev->irq) { if (dev->irq) {
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
} }
if (dev->iobase) { if (dev->iobase) {
release_region(dev->iobase, DT2814_SIZE); release_region(dev->iobase, DT2814_SIZE);

View File

@ -135,7 +135,7 @@ static int dt2815_ao_insn(struct comedi_device *dev, struct comedi_subdevice *s,
status = dt2815_wait_for_status(dev, 0x00); status = dt2815_wait_for_status(dev, 0x00);
if (status != 0) { if (status != 0) {
rt_printk printk
("dt2815: failed to write low byte on %d reason %x\n", ("dt2815: failed to write low byte on %d reason %x\n",
chan, status); chan, status);
return -EBUSY; return -EBUSY;
@ -145,7 +145,7 @@ static int dt2815_ao_insn(struct comedi_device *dev, struct comedi_subdevice *s,
status = dt2815_wait_for_status(dev, 0x10); status = dt2815_wait_for_status(dev, 0x10);
if (status != 0x10) { if (status != 0x10) {
rt_printk printk
("dt2815: failed to write high byte on %d reason %x\n", ("dt2815: failed to write high byte on %d reason %x\n",
chan, status); chan, status);
return -EBUSY; return -EBUSY;
@ -226,7 +226,7 @@ static int dt2815_attach(struct comedi_device *dev, struct comedi_devconfig *it)
/* This is incredibly slow (approx 20 ms) */ /* This is incredibly slow (approx 20 ms) */
unsigned int status; unsigned int status;
comedi_udelay(1000); udelay(1000);
status = inb(dev->iobase + DT2815_STATUS); status = inb(dev->iobase + DT2815_STATUS);
if (status == 4) { if (status == 4) {
unsigned int program; unsigned int program;

View File

@ -389,7 +389,7 @@ struct dt282x_private {
int _i; \ int _i; \
for (_i=0;_i<DT2821_TIMEOUT;_i++){ \ for (_i=0;_i<DT2821_TIMEOUT;_i++){ \
if (a){_i=0;break;} \ if (a){_i=0;break;} \
comedi_udelay(5); \ udelay(5); \
} \ } \
if (_i){b} \ if (_i){b} \
}while (0) }while (0)
@ -463,7 +463,7 @@ static void dt282x_ao_dma_interrupt(struct comedi_device *dev)
size = cfc_read_array_from_buffer(s, ptr, devpriv->dma_maxsize); size = cfc_read_array_from_buffer(s, ptr, devpriv->dma_maxsize);
if (size == 0) { if (size == 0) {
rt_printk("dt282x: AO underrun\n"); printk("dt282x: AO underrun\n");
dt282x_ao_cancel(dev, s); dt282x_ao_cancel(dev, s);
s->async->events |= COMEDI_CB_OVERFLOW; s->async->events |= COMEDI_CB_OVERFLOW;
return; return;
@ -1080,7 +1080,7 @@ static int dt282x_ao_inttrig(struct comedi_device *dev, struct comedi_subdevice
size = cfc_read_array_from_buffer(s, devpriv->dma[0].buf, size = cfc_read_array_from_buffer(s, devpriv->dma[0].buf,
devpriv->dma_maxsize); devpriv->dma_maxsize);
if (size == 0) { if (size == 0) {
rt_printk("dt282x: AO underrun\n"); printk("dt282x: AO underrun\n");
return -EPIPE; return -EPIPE;
} }
prep_ao_dma(dev, 0, size); prep_ao_dma(dev, 0, size);
@ -1088,7 +1088,7 @@ static int dt282x_ao_inttrig(struct comedi_device *dev, struct comedi_subdevice
size = cfc_read_array_from_buffer(s, devpriv->dma[1].buf, size = cfc_read_array_from_buffer(s, devpriv->dma[1].buf,
devpriv->dma_maxsize); devpriv->dma_maxsize);
if (size == 0) { if (size == 0) {
rt_printk("dt282x: AO underrun\n"); printk("dt282x: AO underrun\n");
return -EPIPE; return -EPIPE;
} }
prep_ao_dma(dev, 1, size); prep_ao_dma(dev, 1, size);
@ -1298,7 +1298,7 @@ static int dt282x_attach(struct comedi_device *dev, struct comedi_devconfig *it)
/* trigger interrupt */ /* trigger interrupt */
comedi_udelay(100); udelay(100);
irq = probe_irq_off(irqs); irq = probe_irq_off(irqs);
restore_flags(flags); restore_flags(flags);
@ -1309,8 +1309,7 @@ static int dt282x_attach(struct comedi_device *dev, struct comedi_devconfig *it)
#endif #endif
if (irq > 0) { if (irq > 0) {
printk(" ( irq = %d )", irq); printk(" ( irq = %d )", irq);
ret = comedi_request_irq(irq, dt282x_interrupt, 0, "dt282x", ret = request_irq(irq, dt282x_interrupt, 0, "dt282x", dev);
dev);
if (ret < 0) { if (ret < 0) {
printk(" failed to get irq\n"); printk(" failed to get irq\n");
return -EIO; return -EIO;
@ -1403,7 +1402,7 @@ static int dt282x_attach(struct comedi_device *dev, struct comedi_devconfig *it)
static void free_resources(struct comedi_device *dev) static void free_resources(struct comedi_device *dev)
{ {
if (dev->irq) { if (dev->irq) {
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
} }
if (dev->iobase) if (dev->iobase)
release_region(dev->iobase, DT2821_SIZE); release_region(dev->iobase, DT2821_SIZE);

View File

@ -307,7 +307,7 @@ static int dt3k_send_cmd(struct comedi_device *dev, unsigned int cmd)
status = readw(devpriv->io_addr + DPR_Command_Mbx); status = readw(devpriv->io_addr + DPR_Command_Mbx);
if ((status & DT3000_COMPLETION_MASK) != DT3000_NOTPROCESSED) if ((status & DT3000_COMPLETION_MASK) != DT3000_NOTPROCESSED)
break; break;
comedi_udelay(1); udelay(1);
} }
if ((status & DT3000_COMPLETION_MASK) == DT3000_NOERROR) { if ((status & DT3000_COMPLETION_MASK) == DT3000_NOERROR) {
return 0; return 0;
@ -825,8 +825,8 @@ static int dt3000_attach(struct comedi_device *dev, struct comedi_devconfig *it)
dev->board_name = this_board->name; dev->board_name = this_board->name;
if (comedi_request_irq(devpriv->pci_dev->irq, dt3k_interrupt, if (request_irq(devpriv->pci_dev->irq, dt3k_interrupt, IRQF_SHARED,
IRQF_SHARED, "dt3000", dev)) { "dt3000", dev)) {
printk(" unable to allocate IRQ %u\n", devpriv->pci_dev->irq); printk(" unable to allocate IRQ %u\n", devpriv->pci_dev->irq);
return -EINVAL; return -EINVAL;
} }
@ -895,7 +895,7 @@ static int dt3000_attach(struct comedi_device *dev, struct comedi_devconfig *it)
static int dt3000_detach(struct comedi_device *dev) static int dt3000_detach(struct comedi_device *dev)
{ {
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (devpriv) { if (devpriv) {
if (devpriv->pci_dev) { if (devpriv->pci_dev) {

View File

@ -78,7 +78,7 @@ static int fl512_ai_insn(struct comedi_device *dev,
outb(chan, iobase + 2); /* select chan */ outb(chan, iobase + 2); /* select chan */
outb(0, iobase + 3); /* start conversion */ outb(0, iobase + 3); /* start conversion */
/* XXX should test "done" flag instead of delay */ /* XXX should test "done" flag instead of delay */
comedi_udelay(30); /* sleep 30 usec */ udelay(30); /* sleep 30 usec */
lo_byte = inb(iobase + 2); /* low 8 byte */ lo_byte = inb(iobase + 2); /* low 8 byte */
hi_byte = inb(iobase + 3) & 0xf; /* high 4 bit and mask */ hi_byte = inb(iobase + 3) & 0xf; /* high 4 bit and mask */
data[n] = lo_byte + (hi_byte << 8); data[n] = lo_byte + (hi_byte << 8);

View File

@ -66,7 +66,7 @@ static int dio_config_block_size(struct comedi_device *dev, unsigned int *data);
/* #define HPDI_DEBUG enable debugging code */ /* #define HPDI_DEBUG enable debugging code */
#ifdef HPDI_DEBUG #ifdef HPDI_DEBUG
#define DEBUG_PRINT(format, args...) rt_printk(format , ## args) #define DEBUG_PRINT(format, args...) printk(format , ## args)
#else #else
#define DEBUG_PRINT(format, args...) #define DEBUG_PRINT(format, args...)
#endif #endif
@ -109,7 +109,7 @@ enum hpdi_registers {
int command_channel_valid(unsigned int channel) int command_channel_valid(unsigned int channel)
{ {
if (channel == 0 || channel > 6) { if (channel == 0 || channel > 6) {
rt_printk("gsc_hpdi: bug! invalid cable command channel\n"); printk("gsc_hpdi: bug! invalid cable command channel\n");
return 0; return 0;
} }
return 1; return 1;
@ -465,7 +465,7 @@ static int init_hpdi(struct comedi_device *dev)
uint32_t plx_intcsr_bits; uint32_t plx_intcsr_bits;
writel(BOARD_RESET_BIT, priv(dev)->hpdi_iobase + BOARD_CONTROL_REG); writel(BOARD_RESET_BIT, priv(dev)->hpdi_iobase + BOARD_CONTROL_REG);
comedi_udelay(10); udelay(10);
writel(almost_empty_bits(32) | almost_full_bits(32), writel(almost_empty_bits(32) | almost_full_bits(32),
priv(dev)->hpdi_iobase + RX_PROG_ALMOST_REG); priv(dev)->hpdi_iobase + RX_PROG_ALMOST_REG);
@ -622,7 +622,7 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
init_plx9080(dev); init_plx9080(dev);
/* get irq */ /* get irq */
if (comedi_request_irq(pcidev->irq, handle_interrupt, IRQF_SHARED, if (request_irq(pcidev->irq, handle_interrupt, IRQF_SHARED,
driver_hpdi.driver_name, dev)) { driver_hpdi.driver_name, dev)) {
printk(" unable to allocate irq %u\n", pcidev->irq); printk(" unable to allocate irq %u\n", pcidev->irq);
return -EINVAL; return -EINVAL;
@ -667,7 +667,7 @@ static int hpdi_detach(struct comedi_device *dev)
printk("comedi%d: gsc_hpdi: remove\n", dev->minor); printk("comedi%d: gsc_hpdi: remove\n", dev->minor);
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (priv(dev)) { if (priv(dev)) {
if (priv(dev)->hw_dev) { if (priv(dev)->hw_dev) {
if (priv(dev)->plx9080_iobase) { if (priv(dev)->plx9080_iobase) {
@ -862,11 +862,11 @@ static int di_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
writel(bits, priv(dev)->plx9080_iobase + PLX_DMA0_DESCRIPTOR_REG); 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); 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, writeb(PLX_DMA_EN_BIT | PLX_DMA_START_BIT | PLX_CLEAR_DMA_INTR_BIT,
priv(dev)->plx9080_iobase + PLX_DMA0_CS_REG); priv(dev)->plx9080_iobase + PLX_DMA0_CS_REG);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
if (cmd->stop_src == TRIG_COUNT) if (cmd->stop_src == TRIG_COUNT)
priv(dev)->dio_count = cmd->stop_arg; priv(dev)->dio_count = cmd->stop_arg;
@ -971,7 +971,7 @@ static irqreturn_t handle_interrupt(int irq, void *d)
priv(dev)->hpdi_iobase + INTERRUPT_STATUS_REG); 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); spin_lock_irqsave(&dev->spinlock, flags);
dma0_status = readb(priv(dev)->plx9080_iobase + PLX_DMA0_CS_REG); 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, writeb((dma0_status & PLX_DMA_EN_BIT) | PLX_CLEAR_DMA_INTR_BIT,
@ -983,10 +983,10 @@ static irqreturn_t handle_interrupt(int irq, void *d)
} }
DEBUG_PRINT(" cleared dma ch0 interrupt\n"); DEBUG_PRINT(" cleared dma ch0 interrupt\n");
} }
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); 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); spin_lock_irqsave(&dev->spinlock, flags);
dma1_status = readb(priv(dev)->plx9080_iobase + PLX_DMA1_CS_REG); dma1_status = readb(priv(dev)->plx9080_iobase + PLX_DMA1_CS_REG);
if (plx_status & ICS_DMA1_A) /* XXX */ if (plx_status & ICS_DMA1_A) /* XXX */
{ /* dma chan 1 interrupt */ { /* dma chan 1 interrupt */
@ -996,7 +996,7 @@ static irqreturn_t handle_interrupt(int irq, void *d)
DEBUG_PRINT(" cleared dma ch1 interrupt\n"); DEBUG_PRINT(" cleared dma ch1 interrupt\n");
} }
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
/* clear possible plx9080 interrupt sources */ /* clear possible plx9080 interrupt sources */
if (plx_status & ICS_LDIA) { /* clear local doorbell interrupt */ if (plx_status & ICS_LDIA) { /* clear local doorbell interrupt */
@ -1036,11 +1036,11 @@ void abort_dma(struct comedi_device *dev, unsigned int channel)
unsigned long flags; unsigned long flags;
/* spinlock for plx dma control/status reg */ /* spinlock for plx dma control/status reg */
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
plx9080_abort_dma(priv(dev)->plx9080_iobase, channel); plx9080_abort_dma(priv(dev)->plx9080_iobase, channel);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
} }
static int hpdi_cancel(struct comedi_device *dev, struct comedi_subdevice *s) static int hpdi_cancel(struct comedi_device *dev, struct comedi_subdevice *s)

View File

@ -282,7 +282,7 @@ static int icp_multi_insn_read_ai(struct comedi_device *dev, struct comedi_subde
readw(devpriv->io_addr + ICP_MULTI_ADC_CSR)); readw(devpriv->io_addr + ICP_MULTI_ADC_CSR));
#endif #endif
comedi_udelay(1); udelay(1);
#ifdef ICP_MULTI_EXTDEBUG #ifdef ICP_MULTI_EXTDEBUG
printk("icp multi C n=%d ST=%4x\n", n, printk("icp multi C n=%d ST=%4x\n", n,
@ -304,7 +304,7 @@ static int icp_multi_insn_read_ai(struct comedi_device *dev, struct comedi_subde
ICP_MULTI_ADC_CSR)); ICP_MULTI_ADC_CSR));
#endif #endif
comedi_udelay(1); udelay(1);
} }
/* If we reach here, a timeout has occurred */ /* If we reach here, a timeout has occurred */
@ -411,7 +411,7 @@ static int icp_multi_insn_write_ao(struct comedi_device *dev, struct comedi_subd
ICP_MULTI_DAC_CSR)); ICP_MULTI_DAC_CSR));
#endif #endif
comedi_udelay(1); udelay(1);
} }
/* If we reach here, a timeout has occurred */ /* If we reach here, a timeout has occurred */
@ -842,7 +842,7 @@ static int icp_multi_reset(struct comedi_device *dev)
devpriv->io_addr + ICP_MULTI_DAC_CSR); devpriv->io_addr + ICP_MULTI_DAC_CSR);
/* Delay to allow DAC time to recover */ /* Delay to allow DAC time to recover */
comedi_udelay(1); udelay(1);
} }
/* Digital outputs to 0 */ /* Digital outputs to 0 */
writew(0, devpriv->io_addr + ICP_MULTI_DO); writew(0, devpriv->io_addr + ICP_MULTI_DO);
@ -954,7 +954,7 @@ static int icp_multi_attach(struct comedi_device *dev, struct comedi_devconfig *
if (this_board->have_irq) { if (this_board->have_irq) {
if (irq) { if (irq) {
if (comedi_request_irq(irq, interrupt_service_icp_multi, if (request_irq(irq, interrupt_service_icp_multi,
IRQF_SHARED, "Inova Icp Multi", dev)) { IRQF_SHARED, "Inova Icp Multi", dev)) {
printk(", unable to allocate IRQ %u, DISABLING IT", irq); printk(", unable to allocate IRQ %u, DISABLING IT", irq);
irq = 0; /* Can't use IRQ */ irq = 0; /* Can't use IRQ */
@ -1072,7 +1072,7 @@ static int icp_multi_detach(struct comedi_device *dev)
icp_multi_reset(dev); icp_multi_reset(dev);
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (dev->private && devpriv->io_addr) if (dev->private && devpriv->io_addr)
iounmap(devpriv->io_addr); iounmap(devpriv->io_addr);

View File

@ -168,14 +168,14 @@ static int pci_card_alloc(struct pcilst_struct *inova)
int i; int i;
if (!inova) { if (!inova) {
rt_printk(" - BUG!! inova is NULL!\n"); printk(" - BUG!! inova is NULL!\n");
return -1; return -1;
} }
if (inova->used) if (inova->used)
return 1; return 1;
if (comedi_pci_enable(inova->pcidev, "icp_multi")) { if (comedi_pci_enable(inova->pcidev, "icp_multi")) {
rt_printk(" - Can't enable PCI device and request regions!\n"); printk(" - Can't enable PCI device and request regions!\n");
return -1; return -1;
} }
/* Resources will be accurate now. */ /* Resources will be accurate now. */
@ -248,19 +248,19 @@ static struct pcilst_struct *select_and_alloc_pci_card(unsigned short vendor_id,
card = find_free_pci_card_by_device(vendor_id, device_id); card = find_free_pci_card_by_device(vendor_id, device_id);
if (card == NULL) { if (card == NULL) {
rt_printk(" - Unused card not found in system!\n"); printk(" - Unused card not found in system!\n");
return NULL; return NULL;
} }
} else { } else {
switch (find_free_pci_card_by_position(vendor_id, device_id, switch (find_free_pci_card_by_position(vendor_id, device_id,
pci_bus, pci_slot, &card)) { pci_bus, pci_slot, &card)) {
case 1: case 1:
rt_printk printk
(" - Card not found on requested position b:s %d:%d!\n", (" - Card not found on requested position b:s %d:%d!\n",
pci_bus, pci_slot); pci_bus, pci_slot);
return NULL; return NULL;
case 2: case 2:
rt_printk printk
(" - Card on requested position is used b:s %d:%d!\n", (" - Card on requested position is used b:s %d:%d!\n",
pci_bus, pci_slot); pci_bus, pci_slot);
return NULL; return NULL;
@ -270,7 +270,7 @@ static struct pcilst_struct *select_and_alloc_pci_card(unsigned short vendor_id,
err = pci_card_alloc(card); err = pci_card_alloc(card);
if (err != 0) { if (err != 0) {
if (err > 0) if (err > 0)
rt_printk(" - Can't allocate card!\n"); printk(" - Can't allocate card!\n");
/* else: error already printed. */ /* else: error already printed. */
return NULL; return NULL;
} }

View File

@ -185,10 +185,10 @@ static void set_transforms(volatile struct jr3_channel *channel,
set_u16(&channel->transforms[num].link[i].link_type, set_u16(&channel->transforms[num].link[i].link_type,
transf.link[i].link_type); transf.link[i].link_type);
comedi_udelay(1); udelay(1);
set_s16(&channel->transforms[num].link[i].link_amount, set_s16(&channel->transforms[num].link[i].link_amount,
transf.link[i].link_amount); transf.link[i].link_amount);
comedi_udelay(1); udelay(1);
if (transf.link[i].link_type == end_x_form) { if (transf.link[i].link_type == end_x_form) {
break; break;
} }
@ -496,12 +496,12 @@ static int jr3_download_firmware(struct comedi_device *dev, const u8 *data,
channel[i]. channel[i].
program_low program_low
[addr], data1); [addr], data1);
comedi_udelay(1); udelay(1);
set_u16(&p->iobase-> set_u16(&p->iobase->
channel[i]. channel[i].
program_high program_high
[addr], data2); [addr], data2);
comedi_udelay(1); udelay(1);
} }
} }
@ -734,7 +734,7 @@ static void jr3_pci_poll_dev(unsigned long data)
int delay; int delay;
int i; int i;
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
delay = 1000; delay = 1000;
now = jiffies; now = jiffies;
/* Poll all channels that are ready to be polled */ /* Poll all channels that are ready to be polled */
@ -757,7 +757,7 @@ static void jr3_pci_poll_dev(unsigned long data)
} }
} }
} }
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
devpriv->timer.expires = jiffies + msecs_to_jiffies(delay); devpriv->timer.expires = jiffies + msecs_to_jiffies(delay);
add_timer(&devpriv->timer); add_timer(&devpriv->timer);

View File

@ -283,7 +283,7 @@ static int me4000_attach(struct comedi_device *dev, struct comedi_devconfig *it)
s->insn_read = me4000_ai_insn_read; s->insn_read = me4000_ai_insn_read;
if (info->irq > 0) { if (info->irq > 0) {
if (comedi_request_irq(info->irq, me4000_ai_isr, if (request_irq(info->irq, me4000_ai_isr,
IRQF_SHARED, "ME-4000", dev)) { IRQF_SHARED, "ME-4000", dev)) {
printk("comedi%d: me4000: me4000_attach(): Unable to allocate irq\n", dev->minor); printk("comedi%d: me4000: me4000_attach(): Unable to allocate irq\n", dev->minor);
} else { } else {

View File

@ -258,7 +258,7 @@ struct mite_channel *mite_request_channel_in_range(struct mite_struct *mite,
struct mite_channel *channel = NULL; struct mite_channel *channel = NULL;
/* spin lock so mite_release_channel can be called safely from interrupts */ /* spin lock so mite_release_channel can be called safely from interrupts */
comedi_spin_lock_irqsave(&mite->lock, flags); spin_lock_irqsave(&mite->lock, flags);
for (i = min_channel; i <= max_channel; ++i) { for (i = min_channel; i <= max_channel; ++i) {
if (mite->channel_allocated[i] == 0) { if (mite->channel_allocated[i] == 0) {
mite->channel_allocated[i] = 1; mite->channel_allocated[i] = 1;
@ -267,7 +267,7 @@ struct mite_channel *mite_request_channel_in_range(struct mite_struct *mite,
break; break;
} }
} }
comedi_spin_unlock_irqrestore(&mite->lock, flags); spin_unlock_irqrestore(&mite->lock, flags);
return channel; return channel;
} }
@ -277,7 +277,7 @@ void mite_release_channel(struct mite_channel *mite_chan)
unsigned long flags; unsigned long flags;
/* spin lock to prevent races with mite_request_channel */ /* spin lock to prevent races with mite_request_channel */
comedi_spin_lock_irqsave(&mite->lock, flags); spin_lock_irqsave(&mite->lock, flags);
if (mite->channel_allocated[mite_chan->channel]) { if (mite->channel_allocated[mite_chan->channel]) {
mite_dma_disarm(mite_chan); mite_dma_disarm(mite_chan);
mite_dma_reset(mite_chan); mite_dma_reset(mite_chan);
@ -292,7 +292,7 @@ MITE_CHCR reg isn't changed while dma is still active!) */
mite_chan->ring = NULL; mite_chan->ring = NULL;
mmiowb(); mmiowb();
} }
comedi_spin_unlock_irqrestore(&mite->lock, flags); spin_unlock_irqrestore(&mite->lock, flags);
} }
void mite_dma_arm(struct mite_channel *mite_chan) void mite_dma_arm(struct mite_channel *mite_chan)
@ -307,11 +307,11 @@ void mite_dma_arm(struct mite_channel *mite_chan)
smp_mb(); smp_mb();
/* arm */ /* arm */
chor = CHOR_START; chor = CHOR_START;
comedi_spin_lock_irqsave(&mite->lock, flags); spin_lock_irqsave(&mite->lock, flags);
mite_chan->done = 0; mite_chan->done = 0;
writel(chor, mite->mite_io_addr + MITE_CHOR(mite_chan->channel)); writel(chor, mite->mite_io_addr + MITE_CHOR(mite_chan->channel));
mmiowb(); mmiowb();
comedi_spin_unlock_irqrestore(&mite->lock, flags); spin_unlock_irqrestore(&mite->lock, flags);
/* mite_dma_tcr(mite, channel); */ /* mite_dma_tcr(mite, channel); */
} }
@ -413,7 +413,7 @@ void mite_prep_dma(struct mite_channel *mite_chan,
mcr |= CR_PSIZE32; mcr |= CR_PSIZE32;
break; break;
default: default:
rt_printk printk
("mite: bug! invalid mem bit width for dma transfer\n"); ("mite: bug! invalid mem bit width for dma transfer\n");
break; break;
} }
@ -433,7 +433,7 @@ void mite_prep_dma(struct mite_channel *mite_chan,
dcr |= CR_PSIZE32; dcr |= CR_PSIZE32;
break; break;
default: default:
rt_printk printk
("mite: bug! invalid dev bit width for dma transfer\n"); ("mite: bug! invalid dev bit width for dma transfer\n");
break; break;
} }
@ -539,7 +539,7 @@ int mite_sync_input_dma(struct mite_channel *mite_chan, struct comedi_async * as
nbytes = mite_bytes_written_to_memory_lb(mite_chan); nbytes = mite_bytes_written_to_memory_lb(mite_chan);
if ((int)(mite_bytes_written_to_memory_ub(mite_chan) - if ((int)(mite_bytes_written_to_memory_ub(mite_chan) -
old_alloc_count) > 0) { old_alloc_count) > 0) {
rt_printk("mite: DMA overwrite of free area\n"); printk("mite: DMA overwrite of free area\n");
async->events |= COMEDI_CB_OVERFLOW; async->events |= COMEDI_CB_OVERFLOW;
return -1; return -1;
} }
@ -581,7 +581,7 @@ int mite_sync_output_dma(struct mite_channel *mite_chan, struct comedi_async * a
(int)(nbytes_ub - stop_count) > 0) (int)(nbytes_ub - stop_count) > 0)
nbytes_ub = stop_count; nbytes_ub = stop_count;
if ((int)(nbytes_ub - old_alloc_count) > 0) { if ((int)(nbytes_ub - old_alloc_count) > 0) {
rt_printk("mite: DMA underrun\n"); printk("mite: DMA underrun\n");
async->events |= COMEDI_CB_OVERFLOW; async->events |= COMEDI_CB_OVERFLOW;
return -1; return -1;
} }
@ -602,7 +602,7 @@ unsigned mite_get_status(struct mite_channel *mite_chan)
unsigned status; unsigned status;
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&mite->lock, flags); spin_lock_irqsave(&mite->lock, flags);
status = readl(mite->mite_io_addr + MITE_CHSR(mite_chan->channel)); status = readl(mite->mite_io_addr + MITE_CHSR(mite_chan->channel));
if (status & CHSR_DONE) { if (status & CHSR_DONE) {
mite_chan->done = 1; mite_chan->done = 1;
@ -610,7 +610,7 @@ unsigned mite_get_status(struct mite_channel *mite_chan)
mite->mite_io_addr + MITE_CHOR(mite_chan->channel)); mite->mite_io_addr + MITE_CHOR(mite_chan->channel));
} }
mmiowb(); mmiowb();
comedi_spin_unlock_irqrestore(&mite->lock, flags); spin_unlock_irqrestore(&mite->lock, flags);
return status; return status;
} }
@ -621,9 +621,9 @@ int mite_done(struct mite_channel *mite_chan)
int done; int done;
mite_get_status(mite_chan); mite_get_status(mite_chan);
comedi_spin_lock_irqsave(&mite->lock, flags); spin_lock_irqsave(&mite->lock, flags);
done = mite_chan->done; done = mite_chan->done;
comedi_spin_unlock_irqrestore(&mite->lock, flags); spin_unlock_irqrestore(&mite->lock, flags);
return done; return done;
} }

View File

@ -405,7 +405,7 @@ static inline int CR_RL(unsigned int retry_limit)
value++; value++;
} }
if (value > 0x7) if (value > 0x7)
rt_printk("comedi: bug! retry_limit too large\n"); printk("comedi: bug! retry_limit too large\n");
return (value & 0x7) << 21; return (value & 0x7) << 21;
} }

View File

@ -166,9 +166,9 @@ static int mpc624_attach(struct comedi_device *dev, struct comedi_devconfig *it)
unsigned long iobase; unsigned long iobase;
iobase = it->options[0]; iobase = it->options[0];
rt_printk("comedi%d: mpc624 [0x%04lx, ", dev->minor, iobase); printk("comedi%d: mpc624 [0x%04lx, ", dev->minor, iobase);
if (request_region(iobase, MPC624_SIZE, "mpc624") == NULL) { if (request_region(iobase, MPC624_SIZE, "mpc624") == NULL) {
rt_printk("I/O port(s) in use\n"); printk("I/O port(s) in use\n");
return -EIO; return -EIO;
} }
@ -182,46 +182,46 @@ static int mpc624_attach(struct comedi_device *dev, struct comedi_devconfig *it)
switch (it->options[1]) { switch (it->options[1]) {
case 0: case 0:
devpriv->ulConvertionRate = MPC624_SPEED_3_52_kHz; devpriv->ulConvertionRate = MPC624_SPEED_3_52_kHz;
rt_printk("3.52 kHz, "); printk("3.52 kHz, ");
break; break;
case 1: case 1:
devpriv->ulConvertionRate = MPC624_SPEED_1_76_kHz; devpriv->ulConvertionRate = MPC624_SPEED_1_76_kHz;
rt_printk("1.76 kHz, "); printk("1.76 kHz, ");
break; break;
case 2: case 2:
devpriv->ulConvertionRate = MPC624_SPEED_880_Hz; devpriv->ulConvertionRate = MPC624_SPEED_880_Hz;
rt_printk("880 Hz, "); printk("880 Hz, ");
break; break;
case 3: case 3:
devpriv->ulConvertionRate = MPC624_SPEED_440_Hz; devpriv->ulConvertionRate = MPC624_SPEED_440_Hz;
rt_printk("440 Hz, "); printk("440 Hz, ");
break; break;
case 4: case 4:
devpriv->ulConvertionRate = MPC624_SPEED_220_Hz; devpriv->ulConvertionRate = MPC624_SPEED_220_Hz;
rt_printk("220 Hz, "); printk("220 Hz, ");
break; break;
case 5: case 5:
devpriv->ulConvertionRate = MPC624_SPEED_110_Hz; devpriv->ulConvertionRate = MPC624_SPEED_110_Hz;
rt_printk("110 Hz, "); printk("110 Hz, ");
break; break;
case 6: case 6:
devpriv->ulConvertionRate = MPC624_SPEED_55_Hz; devpriv->ulConvertionRate = MPC624_SPEED_55_Hz;
rt_printk("55 Hz, "); printk("55 Hz, ");
break; break;
case 7: case 7:
devpriv->ulConvertionRate = MPC624_SPEED_27_5_Hz; devpriv->ulConvertionRate = MPC624_SPEED_27_5_Hz;
rt_printk("27.5 Hz, "); printk("27.5 Hz, ");
break; break;
case 8: case 8:
devpriv->ulConvertionRate = MPC624_SPEED_13_75_Hz; devpriv->ulConvertionRate = MPC624_SPEED_13_75_Hz;
rt_printk("13.75 Hz, "); printk("13.75 Hz, ");
break; break;
case 9: case 9:
devpriv->ulConvertionRate = MPC624_SPEED_6_875_Hz; devpriv->ulConvertionRate = MPC624_SPEED_6_875_Hz;
rt_printk("6.875 Hz, "); printk("6.875 Hz, ");
break; break;
default: default:
rt_printk printk
("illegal convertion rate setting! Valid numbers are 0..9. Using 9 => 6.875 Hz, "); ("illegal convertion rate setting! Valid numbers are 0..9. Using 9 => 6.875 Hz, ");
devpriv->ulConvertionRate = MPC624_SPEED_3_52_kHz; devpriv->ulConvertionRate = MPC624_SPEED_3_52_kHz;
} }
@ -237,29 +237,29 @@ static int mpc624_attach(struct comedi_device *dev, struct comedi_devconfig *it)
switch (it->options[1]) { switch (it->options[1]) {
default: default:
s->maxdata = 0x3FFFFFFF; s->maxdata = 0x3FFFFFFF;
rt_printk("30 bit, "); printk("30 bit, ");
} }
switch (it->options[1]) { switch (it->options[1]) {
case 0: case 0:
s->range_table = &range_mpc624_bipolar1; s->range_table = &range_mpc624_bipolar1;
rt_printk("1.01V]: "); printk("1.01V]: ");
break; break;
default: default:
s->range_table = &range_mpc624_bipolar10; s->range_table = &range_mpc624_bipolar10;
rt_printk("10.1V]: "); printk("10.1V]: ");
} }
s->len_chanlist = 1; s->len_chanlist = 1;
s->insn_read = mpc624_ai_rinsn; s->insn_read = mpc624_ai_rinsn;
rt_printk("attached\n"); printk("attached\n");
return 1; return 1;
} }
static int mpc624_detach(struct comedi_device *dev) static int mpc624_detach(struct comedi_device *dev)
{ {
rt_printk("comedi%d: mpc624: remove\n", dev->minor); printk("comedi%d: mpc624: remove\n", dev->minor);
if (dev->iobase) if (dev->iobase)
release_region(dev->iobase, MPC624_SIZE); release_region(dev->iobase, MPC624_SIZE);
@ -279,48 +279,48 @@ static int mpc624_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s
/* 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); outb(insn->chanspec, dev->iobase + MPC624_GNMUXCH);
/* rt_printk("Channel %d: \n", insn->chanspec); */ /* printk("Channel %d: \n", insn->chanspec); */
if (!insn->n) { if (!insn->n) {
rt_printk("MPC624: Warning, no data to aquire\n"); printk("MPC624: Warning, no data to aquire\n");
return 0; return 0;
} }
for (n = 0; n < insn->n; n++) { for (n = 0; n < insn->n; n++) {
/* Trigger the convertion */ /* Trigger the convertion */
outb(MPC624_ADSCK, dev->iobase + MPC624_ADC); outb(MPC624_ADSCK, dev->iobase + MPC624_ADC);
comedi_udelay(1); udelay(1);
outb(MPC624_ADCS | MPC624_ADSCK, dev->iobase + MPC624_ADC); outb(MPC624_ADCS | MPC624_ADSCK, dev->iobase + MPC624_ADC);
comedi_udelay(1); udelay(1);
outb(0, dev->iobase + MPC624_ADC); outb(0, dev->iobase + MPC624_ADC);
comedi_udelay(1); udelay(1);
/* Wait for the convertion to end */ /* Wait for the convertion to end */
for (i = 0; i < TIMEOUT; i++) { for (i = 0; i < TIMEOUT; i++) {
ucPort = inb(dev->iobase + MPC624_ADC); ucPort = inb(dev->iobase + MPC624_ADC);
if (ucPort & MPC624_ADBUSY) if (ucPort & MPC624_ADBUSY)
comedi_udelay(1000); udelay(1000);
else else
break; break;
} }
if (i == TIMEOUT) { if (i == TIMEOUT) {
rt_printk("MPC624: timeout (%dms)\n", TIMEOUT); printk("MPC624: timeout (%dms)\n", TIMEOUT);
data[n] = 0; data[n] = 0;
return -ETIMEDOUT; return -ETIMEDOUT;
} }
/* Start reading data */ /* Start reading data */
data_in = 0; data_in = 0;
data_out = devpriv->ulConvertionRate; data_out = devpriv->ulConvertionRate;
comedi_udelay(1); udelay(1);
for (i = 0; i < 32; i++) { for (i = 0; i < 32; i++) {
/* Set the clock low */ /* Set the clock low */
outb(0, dev->iobase + MPC624_ADC); outb(0, dev->iobase + MPC624_ADC);
comedi_udelay(1); 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); outb(MPC624_ADSDI, dev->iobase + MPC624_ADC);
comedi_udelay(1); udelay(1);
/* Set the clock high */ /* Set the clock high */
outb(MPC624_ADSCK | MPC624_ADSDI, outb(MPC624_ADSCK | MPC624_ADSDI,
dev->iobase + MPC624_ADC); dev->iobase + MPC624_ADC);
@ -328,17 +328,17 @@ static int mpc624_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s
{ {
/* Set the ADSDI line (send to MPC624) */ /* Set the ADSDI line (send to MPC624) */
outb(0, dev->iobase + MPC624_ADC); outb(0, dev->iobase + MPC624_ADC);
comedi_udelay(1); udelay(1);
/* Set the clock high */ /* Set the clock high */
outb(MPC624_ADSCK, dev->iobase + MPC624_ADC); 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); udelay(1);
data_in <<= 1; data_in <<= 1;
data_in |= data_in |=
(inb(dev->iobase + (inb(dev->iobase +
MPC624_ADC) & MPC624_ADSDO) >> 4; MPC624_ADC) & MPC624_ADSDO) >> 4;
comedi_udelay(1); udelay(1);
data_out <<= 1; data_out <<= 1;
} }
@ -357,10 +357,10 @@ static int mpc624_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s
/* 00: sub-LSB */ /* 00: sub-LSB */
if (data_in & MPC624_EOC_BIT) if (data_in & MPC624_EOC_BIT)
rt_printk("MPC624: EOC bit is set (data_in=%lu)!", printk("MPC624: EOC bit is set (data_in=%lu)!",
data_in); data_in);
if (data_in & MPC624_DMY_BIT) if (data_in & MPC624_DMY_BIT)
rt_printk("MPC624: DMY bit is set (data_in=%lu)!", printk("MPC624: DMY bit is set (data_in=%lu)!",
data_in); data_in);
if (data_in & MPC624_SGN_BIT) /* check the sign bit */ if (data_in & MPC624_SGN_BIT) /* check the sign bit */
{ /* The voltage is positive */ { /* The voltage is positive */

View File

@ -432,8 +432,8 @@ static int ni6527_attach(struct comedi_device *dev, struct comedi_devconfig *it)
devpriv->mite->daq_io_addr + Clear_Register); devpriv->mite->daq_io_addr + Clear_Register);
writeb(0x00, devpriv->mite->daq_io_addr + Master_Interrupt_Control); writeb(0x00, devpriv->mite->daq_io_addr + Master_Interrupt_Control);
ret = comedi_request_irq(mite_irq(devpriv->mite), ni6527_interrupt, ret = request_irq(mite_irq(devpriv->mite), ni6527_interrupt,
IRQF_SHARED, "ni6527", dev); IRQF_SHARED, "ni6527", dev);
if (ret < 0) { if (ret < 0) {
printk(" irq not available"); printk(" irq not available");
} else } else
@ -452,7 +452,7 @@ static int ni6527_detach(struct comedi_device *dev)
} }
if (dev->irq) { if (dev->irq) {
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
} }
if (devpriv && devpriv->mite) { if (devpriv && devpriv->mite) {

View File

@ -437,12 +437,12 @@ static int ni_65xx_dio_insn_bits(struct comedi_device *dev, struct comedi_subdev
writeb(bits, writeb(bits,
private(dev)->mite->daq_io_addr + private(dev)->mite->daq_io_addr +
Port_Data(port)); Port_Data(port));
/* rt_printk("wrote 0x%x to port %i\n", bits, port); */ /* printk("wrote 0x%x to port %i\n", bits, port); */
} }
port_read_bits = port_read_bits =
readb(private(dev)->mite->daq_io_addr + readb(private(dev)->mite->daq_io_addr +
Port_Data(port)); Port_Data(port));
/* rt_printk("read 0x%x from port %i\n", port_read_bits, port); */ /* printk("read 0x%x from port %i\n", port_read_bits, port); */
if (bitshift > 0) { if (bitshift > 0) {
port_read_bits <<= bitshift; port_read_bits <<= bitshift;
} else { } else {
@ -742,8 +742,8 @@ static int ni_65xx_attach(struct comedi_device *dev, struct comedi_devconfig *it
/* Set filter interval to 0 (32bit reg) */ /* Set filter interval to 0 (32bit reg) */
writeb(0x00000000, private(dev)->mite->daq_io_addr + Filter_Interval); writeb(0x00000000, private(dev)->mite->daq_io_addr + Filter_Interval);
ret = comedi_request_irq(dev->irq, ni_65xx_interrupt, IRQF_SHARED, ret = request_irq(dev->irq, ni_65xx_interrupt, IRQF_SHARED,
"ni_65xx", dev); "ni_65xx", dev);
if (ret < 0) { if (ret < 0) {
dev->irq = 0; dev->irq = 0;
printk(" irq not available"); printk(" irq not available");
@ -764,7 +764,7 @@ static int ni_65xx_detach(struct comedi_device *dev)
} }
if (dev->irq) { if (dev->irq) {
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
} }
if (private(dev)) { if (private(dev)) {

View File

@ -695,7 +695,7 @@ static enum NI_660x_Register ni_gpct_to_660x_register(enum ni_gpct_register reg)
ni_660x_register = G3InterruptEnable; ni_660x_register = G3InterruptEnable;
break; break;
default: default:
rt_printk("%s: unhandled register 0x%x in switch.\n", printk("%s: unhandled register 0x%x in switch.\n",
__func__, reg); __func__, reg);
BUG(); BUG();
return 0; return 0;
@ -719,7 +719,7 @@ static inline void ni_660x_write_register(struct comedi_device *dev,
writel(bits, write_address); writel(bits, write_address);
break; break;
default: default:
rt_printk("%s: %s: bug! unhandled case (reg=0x%x) in switch.\n", printk("%s: %s: bug! unhandled case (reg=0x%x) in switch.\n",
__FILE__, __func__, reg); __FILE__, __func__, reg);
BUG(); BUG();
break; break;
@ -741,7 +741,7 @@ static inline unsigned ni_660x_read_register(struct comedi_device *dev,
return readl(read_address); return readl(read_address);
break; break;
default: default:
rt_printk("%s: %s: bug! unhandled case (reg=0x%x) in switch.\n", printk("%s: %s: bug! unhandled case (reg=0x%x) in switch.\n",
__FILE__, __func__, reg); __FILE__, __func__, reg);
BUG(); BUG();
break; break;
@ -777,7 +777,7 @@ static inline void ni_660x_set_dma_channel(struct comedi_device *dev,
unsigned mite_channel, struct ni_gpct *counter) unsigned mite_channel, struct ni_gpct *counter)
{ {
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&private(dev)->soft_reg_copy_lock, flags); spin_lock_irqsave(&private(dev)->soft_reg_copy_lock, flags);
private(dev)->dma_configuration_soft_copies[counter->chip_index] &= private(dev)->dma_configuration_soft_copies[counter->chip_index] &=
~dma_select_mask(mite_channel); ~dma_select_mask(mite_channel);
private(dev)->dma_configuration_soft_copies[counter->chip_index] |= private(dev)->dma_configuration_soft_copies[counter->chip_index] |=
@ -788,14 +788,14 @@ static inline void ni_660x_set_dma_channel(struct comedi_device *dev,
chip_index] | dma_reset_bit(mite_channel), chip_index] | dma_reset_bit(mite_channel),
DMAConfigRegister); DMAConfigRegister);
mmiowb(); mmiowb();
comedi_spin_unlock_irqrestore(&private(dev)->soft_reg_copy_lock, flags); spin_unlock_irqrestore(&private(dev)->soft_reg_copy_lock, flags);
} }
static inline void ni_660x_unset_dma_channel(struct comedi_device *dev, static inline void ni_660x_unset_dma_channel(struct comedi_device *dev,
unsigned mite_channel, struct ni_gpct *counter) unsigned mite_channel, struct ni_gpct *counter)
{ {
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&private(dev)->soft_reg_copy_lock, flags); spin_lock_irqsave(&private(dev)->soft_reg_copy_lock, flags);
private(dev)->dma_configuration_soft_copies[counter->chip_index] &= private(dev)->dma_configuration_soft_copies[counter->chip_index] &=
~dma_select_mask(mite_channel); ~dma_select_mask(mite_channel);
private(dev)->dma_configuration_soft_copies[counter->chip_index] |= private(dev)->dma_configuration_soft_copies[counter->chip_index] |=
@ -804,7 +804,7 @@ static inline void ni_660x_unset_dma_channel(struct comedi_device *dev,
private(dev)->dma_configuration_soft_copies[counter-> private(dev)->dma_configuration_soft_copies[counter->
chip_index], DMAConfigRegister); chip_index], DMAConfigRegister);
mmiowb(); mmiowb();
comedi_spin_unlock_irqrestore(&private(dev)->soft_reg_copy_lock, flags); spin_unlock_irqrestore(&private(dev)->soft_reg_copy_lock, flags);
} }
static int ni_660x_request_mite_channel(struct comedi_device *dev, static int ni_660x_request_mite_channel(struct comedi_device *dev,
@ -813,13 +813,13 @@ static int ni_660x_request_mite_channel(struct comedi_device *dev,
unsigned long flags; unsigned long flags;
struct mite_channel *mite_chan; struct mite_channel *mite_chan;
comedi_spin_lock_irqsave(&private(dev)->mite_channel_lock, flags); spin_lock_irqsave(&private(dev)->mite_channel_lock, flags);
BUG_ON(counter->mite_chan); BUG_ON(counter->mite_chan);
mite_chan = mite_chan =
mite_request_channel(private(dev)->mite, mite_ring(private(dev), mite_request_channel(private(dev)->mite, mite_ring(private(dev),
counter)); counter));
if (mite_chan == NULL) { if (mite_chan == NULL) {
comedi_spin_unlock_irqrestore(&private(dev)->mite_channel_lock, spin_unlock_irqrestore(&private(dev)->mite_channel_lock,
flags); flags);
comedi_error(dev, comedi_error(dev,
"failed to reserve mite dma channel for counter."); "failed to reserve mite dma channel for counter.");
@ -828,7 +828,7 @@ static int ni_660x_request_mite_channel(struct comedi_device *dev,
mite_chan->dir = direction; mite_chan->dir = direction;
ni_tio_set_mite_channel(counter, mite_chan); ni_tio_set_mite_channel(counter, mite_chan);
ni_660x_set_dma_channel(dev, mite_chan->channel, counter); ni_660x_set_dma_channel(dev, mite_chan->channel, counter);
comedi_spin_unlock_irqrestore(&private(dev)->mite_channel_lock, flags); spin_unlock_irqrestore(&private(dev)->mite_channel_lock, flags);
return 0; return 0;
} }
@ -836,7 +836,7 @@ void ni_660x_release_mite_channel(struct comedi_device *dev, struct ni_gpct *cou
{ {
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&private(dev)->mite_channel_lock, flags); spin_lock_irqsave(&private(dev)->mite_channel_lock, flags);
if (counter->mite_chan) { if (counter->mite_chan) {
struct mite_channel *mite_chan = counter->mite_chan; struct mite_channel *mite_chan = counter->mite_chan;
@ -844,7 +844,7 @@ void ni_660x_release_mite_channel(struct comedi_device *dev, struct ni_gpct *cou
ni_tio_set_mite_channel(counter, NULL); ni_tio_set_mite_channel(counter, NULL);
mite_release_channel(mite_chan); mite_release_channel(mite_chan);
} }
comedi_spin_unlock_irqrestore(&private(dev)->mite_channel_lock, flags); spin_unlock_irqrestore(&private(dev)->mite_channel_lock, flags);
} }
static int ni_660x_cmd(struct comedi_device *dev, struct comedi_subdevice *s) static int ni_660x_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
@ -921,13 +921,13 @@ static irqreturn_t ni_660x_interrupt(int irq, void *d)
if (dev->attached == 0) if (dev->attached == 0)
return IRQ_NONE; return IRQ_NONE;
/* lock to avoid race with comedi_poll */ /* lock to avoid race with comedi_poll */
comedi_spin_lock_irqsave(&private(dev)->interrupt_lock, flags); spin_lock_irqsave(&private(dev)->interrupt_lock, flags);
smp_mb(); smp_mb();
for (i = 0; i < ni_660x_num_counters(dev); ++i) { for (i = 0; i < ni_660x_num_counters(dev); ++i) {
s = dev->subdevices + NI_660X_GPCT_SUBDEV(i); s = dev->subdevices + NI_660X_GPCT_SUBDEV(i);
ni_660x_handle_gpct_interrupt(dev, s); ni_660x_handle_gpct_interrupt(dev, s);
} }
comedi_spin_unlock_irqrestore(&private(dev)->interrupt_lock, flags); spin_unlock_irqrestore(&private(dev)->interrupt_lock, flags);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
@ -936,9 +936,9 @@ static int ni_660x_input_poll(struct comedi_device *dev,
{ {
unsigned long flags; unsigned long flags;
/* lock to avoid race with comedi_poll */ /* lock to avoid race with comedi_poll */
comedi_spin_lock_irqsave(&private(dev)->interrupt_lock, flags); spin_lock_irqsave(&private(dev)->interrupt_lock, flags);
mite_sync_input_dma(subdev_to_counter(s)->mite_chan, s->async); mite_sync_input_dma(subdev_to_counter(s)->mite_chan, s->async);
comedi_spin_unlock_irqrestore(&private(dev)->interrupt_lock, flags); spin_unlock_irqrestore(&private(dev)->interrupt_lock, flags);
return comedi_buf_read_n_available(s->async); return comedi_buf_read_n_available(s->async);
} }
@ -1107,10 +1107,8 @@ static int ni_660x_attach(struct comedi_device *dev, struct comedi_devconfig *it
for (i = 0; i < board(dev)->n_chips; ++i) { for (i = 0; i < board(dev)->n_chips; ++i) {
set_tio_counterswap(dev, i); set_tio_counterswap(dev, i);
} }
ret = comedi_request_irq(mite_irq(private(dev)->mite), ret = request_irq(mite_irq(private(dev)->mite), ni_660x_interrupt,
ni_660x_interrupt, IRQF_SHARED, "ni_660x", IRQF_SHARED, "ni_660x", dev);
dev);
if (ret < 0) { if (ret < 0) {
printk(" irq not available\n"); printk(" irq not available\n");
return ret; return ret;
@ -1131,7 +1129,7 @@ static int ni_660x_detach(struct comedi_device *dev)
/* Free irq */ /* Free irq */
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (dev->private) { if (dev->private) {
if (private(dev)->counter_dev) if (private(dev)->counter_dev)

View File

@ -217,7 +217,7 @@ static int ni_670x_detach(struct comedi_device *dev)
mite_unsetup(devpriv->mite); mite_unsetup(devpriv->mite);
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
return 0; return 0;
} }

View File

@ -201,9 +201,9 @@ COMEDI_INITCLEANUP(driver_a2150);
static void ni_dump_regs(struct comedi_device *dev) static void ni_dump_regs(struct comedi_device *dev)
{ {
rt_printk("config bits 0x%x\n", devpriv->config_bits); printk("config bits 0x%x\n", devpriv->config_bits);
rt_printk("irq dma bits 0x%x\n", devpriv->irq_dma_bits); printk("irq dma bits 0x%x\n", devpriv->irq_dma_bits);
rt_printk("status bits 0x%x\n", inw(dev->iobase + STATUS_REG)); printk("status bits 0x%x\n", inw(dev->iobase + STATUS_REG));
} }
#endif #endif
@ -370,7 +370,7 @@ static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it)
printk(" invalid irq line %u\n", irq); printk(" invalid irq line %u\n", irq);
return -EINVAL; return -EINVAL;
} }
if (comedi_request_irq(irq, a2150_interrupt, 0, if (request_irq(irq, a2150_interrupt, 0,
driver_a2150.driver_name, dev)) { driver_a2150.driver_name, dev)) {
printk("unable to allocate irq %u\n", irq); printk("unable to allocate irq %u\n", irq);
return -EINVAL; return -EINVAL;
@ -437,7 +437,7 @@ static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it)
for (i = 0; i < timeout; i++) { for (i = 0; i < timeout; i++) {
if ((DCAL_BIT & inw(dev->iobase + STATUS_REG)) == 0) if ((DCAL_BIT & inw(dev->iobase + STATUS_REG)) == 0)
break; break;
comedi_udelay(1000); udelay(1000);
} }
if (i == timeout) { if (i == timeout) {
printk(" timed out waiting for offset calibration to complete\n"); printk(" timed out waiting for offset calibration to complete\n");
@ -461,7 +461,7 @@ static int a2150_detach(struct comedi_device *dev)
} }
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (devpriv) { if (devpriv) {
if (devpriv->dma) if (devpriv->dma)
free_dma(devpriv->dma); free_dma(devpriv->dma);
@ -764,7 +764,7 @@ static int a2150_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
for (i = 0; i < timeout; i++) { for (i = 0; i < timeout; i++) {
if (inw(dev->iobase + STATUS_REG) & FNE_BIT) if (inw(dev->iobase + STATUS_REG) & FNE_BIT)
break; break;
comedi_udelay(1); udelay(1);
} }
if (i == timeout) { if (i == timeout) {
comedi_error(dev, "timeout"); comedi_error(dev, "timeout");
@ -778,7 +778,7 @@ static int a2150_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
for (i = 0; i < timeout; i++) { for (i = 0; i < timeout; i++) {
if (inw(dev->iobase + STATUS_REG) & FNE_BIT) if (inw(dev->iobase + STATUS_REG) & FNE_BIT)
break; break;
comedi_udelay(1); udelay(1);
} }
if (i == timeout) { if (i == timeout) {
comedi_error(dev, "timeout"); comedi_error(dev, "timeout");
@ -789,7 +789,7 @@ static int a2150_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
#endif #endif
data[n] = inw(dev->iobase + FIFO_DATA_REG); data[n] = inw(dev->iobase + FIFO_DATA_REG);
#ifdef A2150_DEBUG #ifdef A2150_DEBUG
rt_printk(" data is %i\n", data[n]); printk(" data is %i\n", data[n]);
#endif #endif
data[n] ^= 0x8000; data[n] ^= 0x8000;
} }

View File

@ -301,14 +301,14 @@ static void ni_atmio_win_out(struct comedi_device *dev, uint16_t data, int addr)
{ {
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&devpriv->window_lock, flags); spin_lock_irqsave(&devpriv->window_lock, flags);
if ((addr) < 8) { if ((addr) < 8) {
ni_writew(data, addr * 2); ni_writew(data, addr * 2);
} else { } else {
ni_writew(addr, Window_Address); ni_writew(addr, Window_Address);
ni_writew(data, Window_Data); ni_writew(data, Window_Data);
} }
comedi_spin_unlock_irqrestore(&devpriv->window_lock, flags); spin_unlock_irqrestore(&devpriv->window_lock, flags);
} }
static uint16_t ni_atmio_win_in(struct comedi_device *dev, int addr) static uint16_t ni_atmio_win_in(struct comedi_device *dev, int addr)
@ -316,14 +316,14 @@ static uint16_t ni_atmio_win_in(struct comedi_device *dev, int addr)
unsigned long flags; unsigned long flags;
uint16_t ret; uint16_t ret;
comedi_spin_lock_irqsave(&devpriv->window_lock, flags); spin_lock_irqsave(&devpriv->window_lock, flags);
if (addr < 8) { if (addr < 8) {
ret = ni_readw(addr * 2); ret = ni_readw(addr * 2);
} else { } else {
ni_writew(addr, Window_Address); ni_writew(addr, Window_Address);
ret = ni_readw(Window_Data); ret = ni_readw(Window_Data);
} }
comedi_spin_unlock_irqrestore(&devpriv->window_lock, flags); spin_unlock_irqrestore(&devpriv->window_lock, flags);
return ret; return ret;
} }
@ -362,7 +362,7 @@ static int ni_atmio_detach(struct comedi_device *dev)
if (dev->iobase) if (dev->iobase)
release_region(dev->iobase, NI_SIZE); release_region(dev->iobase, NI_SIZE);
if (dev->irq) { if (dev->irq) {
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
} }
if (devpriv->isapnp_dev) if (devpriv->isapnp_dev)
pnp_device_detach(devpriv->isapnp_dev); pnp_device_detach(devpriv->isapnp_dev);
@ -478,8 +478,8 @@ static int ni_atmio_attach(struct comedi_device *dev, struct comedi_devconfig *i
return -EINVAL; return -EINVAL;
} }
printk(" ( irq = %u )", irq); printk(" ( irq = %u )", irq);
ret = comedi_request_irq(irq, ni_E_interrupt, ret = request_irq(irq, ni_E_interrupt, NI_E_IRQ_FLAGS,
NI_E_IRQ_FLAGS, "ni_atmio", dev); "ni_atmio", dev);
if (ret < 0) { if (ret < 0) {
printk(" irq not available\n"); printk(" irq not available\n");

View File

@ -579,7 +579,7 @@ static int atmio16d_ai_insn_read(struct comedi_device *dev, struct comedi_subdev
} }
/* end waiting, now check if it timed out */ /* end waiting, now check if it timed out */
if (t == ATMIO16D_TIMEOUT) { if (t == ATMIO16D_TIMEOUT) {
rt_printk("atmio16d: timeout\n"); printk("atmio16d: timeout\n");
return -ETIME; return -ETIME;
} }
@ -743,8 +743,7 @@ static int atmio16d_attach(struct comedi_device *dev, struct comedi_devconfig *i
irq = it->options[1]; irq = it->options[1];
if (irq) { if (irq) {
ret = comedi_request_irq(irq, atmio16d_interrupt, ret = request_irq(irq, atmio16d_interrupt, 0, "atmio16d", dev);
0, "atmio16d", dev);
if (ret < 0) { if (ret < 0) {
printk("failed to allocate irq %u\n", irq); printk("failed to allocate irq %u\n", irq);
return ret; return ret;
@ -856,7 +855,7 @@ static int atmio16d_detach(struct comedi_device *dev)
subdev_8255_cleanup(dev, dev->subdevices + 3); subdev_8255_cleanup(dev, dev->subdevices + 3);
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
reset_atmio16d(dev); reset_atmio16d(dev);

View File

@ -425,7 +425,7 @@ static int dio700_detach(struct comedi_device *dev)
if (thisboard->bustype != pcmcia_bustype && dev->iobase) if (thisboard->bustype != pcmcia_bustype && dev->iobase)
release_region(dev->iobase, DIO700_SIZE); release_region(dev->iobase, DIO700_SIZE);
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
return 0; return 0;
}; };

View File

@ -182,7 +182,7 @@ static int dio24_detach(struct comedi_device *dev)
if (thisboard->bustype != pcmcia_bustype && dev->iobase) if (thisboard->bustype != pcmcia_bustype && dev->iobase)
release_region(dev->iobase, DIO24_SIZE); release_region(dev->iobase, DIO24_SIZE);
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
return 0; return 0;
}; };

View File

@ -516,7 +516,7 @@ int labpc_common_attach(struct comedi_device *dev, unsigned long iobase,
isr_flags = 0; isr_flags = 0;
if (thisboard->bustype == pci_bustype) if (thisboard->bustype == pci_bustype)
isr_flags |= IRQF_SHARED; isr_flags |= IRQF_SHARED;
if (comedi_request_irq(irq, labpc_interrupt, isr_flags, if (request_irq(irq, labpc_interrupt, isr_flags,
driver_labpc.driver_name, dev)) { driver_labpc.driver_name, dev)) {
printk("unable to allocate irq %u\n", irq); printk("unable to allocate irq %u\n", irq);
return -EINVAL; return -EINVAL;
@ -737,7 +737,7 @@ int labpc_common_detach(struct comedi_device *dev)
if (devpriv->dma_chan) if (devpriv->dma_chan)
free_dma(devpriv->dma_chan); free_dma(devpriv->dma_chan);
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (thisboard->bustype == isa_bustype && dev->iobase) if (thisboard->bustype == isa_bustype && dev->iobase)
release_region(dev->iobase, LABPC_SIZE); release_region(dev->iobase, LABPC_SIZE);
#ifdef CONFIG_COMEDI_PCI #ifdef CONFIG_COMEDI_PCI
@ -759,10 +759,10 @@ static int labpc_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
{ {
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
devpriv->command2_bits &= ~SWTRIG_BIT & ~HWTRIG_BIT & ~PRETRIG_BIT; devpriv->command2_bits &= ~SWTRIG_BIT & ~HWTRIG_BIT & ~PRETRIG_BIT;
devpriv->write_byte(devpriv->command2_bits, dev->iobase + COMMAND2_REG); devpriv->write_byte(devpriv->command2_bits, dev->iobase + COMMAND2_REG);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
devpriv->command3_bits = 0; devpriv->command3_bits = 0;
devpriv->write_byte(devpriv->command3_bits, dev->iobase + COMMAND3_REG); devpriv->write_byte(devpriv->command3_bits, dev->iobase + COMMAND3_REG);
@ -788,7 +788,7 @@ static enum scan_mode labpc_ai_scan_mode(const struct comedi_cmd *cmd)
if (CR_CHAN(cmd->chanlist[0]) > CR_CHAN(cmd->chanlist[1])) if (CR_CHAN(cmd->chanlist[0]) > CR_CHAN(cmd->chanlist[1]))
return MODE_MULT_CHAN_DOWN; return MODE_MULT_CHAN_DOWN;
rt_printk("ni_labpc: bug! this should never happen\n"); printk("ni_labpc: bug! this should never happen\n");
return 0; return 0;
} }
@ -844,7 +844,7 @@ static int labpc_ai_chanlist_invalid(const struct comedi_device *dev,
} }
break; break;
default: default:
rt_printk("ni_labpc: bug! in chanlist check\n"); printk("ni_labpc: bug! in chanlist check\n");
return 1; return 1;
break; break;
} }
@ -1082,10 +1082,10 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
aref = CR_AREF(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); spin_lock_irqsave(&dev->spinlock, flags);
devpriv->command2_bits &= ~SWTRIG_BIT & ~HWTRIG_BIT & ~PRETRIG_BIT; devpriv->command2_bits &= ~SWTRIG_BIT & ~HWTRIG_BIT & ~PRETRIG_BIT;
devpriv->write_byte(devpriv->command2_bits, dev->iobase + COMMAND2_REG); devpriv->write_byte(devpriv->command2_bits, dev->iobase + COMMAND2_REG);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
devpriv->command3_bits = 0; devpriv->command3_bits = 0;
devpriv->write_byte(devpriv->command3_bits, dev->iobase + COMMAND3_REG); devpriv->write_byte(devpriv->command3_bits, dev->iobase + COMMAND3_REG);
@ -1174,7 +1174,7 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
devpriv->command1_bits |= ADC_SCAN_EN_BIT; devpriv->command1_bits |= ADC_SCAN_EN_BIT;
/* need a brief delay before enabling scan, or scan list will get screwed when you switch /* need a brief delay before enabling scan, or scan list will get screwed when you switch
* between scan up to scan down mode - dunno why */ * between scan up to scan down mode - dunno why */
comedi_udelay(1); udelay(1);
devpriv->write_byte(devpriv->command1_bits, devpriv->write_byte(devpriv->command1_bits,
dev->iobase + COMMAND1_REG); dev->iobase + COMMAND1_REG);
} }
@ -1275,7 +1275,7 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
/* command2 reg */ /* command2 reg */
/* use 2 cascaded counters for pacing */ /* use 2 cascaded counters for pacing */
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
devpriv->command2_bits |= CASCADE_BIT; devpriv->command2_bits |= CASCADE_BIT;
switch (cmd->start_src) { switch (cmd->start_src) {
case TRIG_EXT: case TRIG_EXT:
@ -1303,7 +1303,7 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
return -1; return -1;
} }
devpriv->write_byte(devpriv->command2_bits, dev->iobase + COMMAND2_REG); devpriv->write_byte(devpriv->command2_bits, dev->iobase + COMMAND2_REG);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
return 0; return 0;
} }
@ -1510,10 +1510,10 @@ static int labpc_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
unsigned long flags; unsigned long flags;
/* disable timed conversions */ /* disable timed conversions */
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
devpriv->command2_bits &= ~SWTRIG_BIT & ~HWTRIG_BIT & ~PRETRIG_BIT; devpriv->command2_bits &= ~SWTRIG_BIT & ~HWTRIG_BIT & ~PRETRIG_BIT;
devpriv->write_byte(devpriv->command2_bits, dev->iobase + COMMAND2_REG); devpriv->write_byte(devpriv->command2_bits, dev->iobase + COMMAND2_REG);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
/* disable interrupt generation and dma */ /* disable interrupt generation and dma */
devpriv->command3_bits = 0; devpriv->command3_bits = 0;
@ -1571,7 +1571,7 @@ static int labpc_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
if (devpriv->read_byte(dev->iobase + if (devpriv->read_byte(dev->iobase +
STATUS1_REG) & DATA_AVAIL_BIT) STATUS1_REG) & DATA_AVAIL_BIT)
break; break;
comedi_udelay(1); udelay(1);
} }
if (i == timeout) { if (i == timeout) {
comedi_error(dev, "timeout"); comedi_error(dev, "timeout");
@ -1598,10 +1598,10 @@ static int labpc_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s,
/* turn off pacing of analog output channel */ /* turn off pacing of analog output channel */
/* note: hardware bug in daqcard-1200 means pacing cannot /* note: hardware bug in daqcard-1200 means pacing cannot
* be independently enabled/disabled for its the two channels */ * be independently enabled/disabled for its the two channels */
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
devpriv->command2_bits &= ~DAC_PACED_BIT(channel); devpriv->command2_bits &= ~DAC_PACED_BIT(channel);
devpriv->write_byte(devpriv->command2_bits, dev->iobase + COMMAND2_REG); devpriv->write_byte(devpriv->command2_bits, dev->iobase + COMMAND2_REG);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
/* set range */ /* set range */
if (thisboard->register_layout == labpc_1200_layout) { if (thisboard->register_layout == labpc_1200_layout) {
@ -1809,12 +1809,12 @@ static void labpc_serial_out(struct comedi_device *dev, unsigned int value,
devpriv->command5_bits |= SDATA_BIT; devpriv->command5_bits |= SDATA_BIT;
else else
devpriv->command5_bits &= ~SDATA_BIT; devpriv->command5_bits &= ~SDATA_BIT;
comedi_udelay(1); udelay(1);
devpriv->write_byte(devpriv->command5_bits, devpriv->write_byte(devpriv->command5_bits,
dev->iobase + COMMAND5_REG); dev->iobase + COMMAND5_REG);
/* set clock to load bit */ /* set clock to load bit */
devpriv->command5_bits |= SCLOCK_BIT; devpriv->command5_bits |= SCLOCK_BIT;
comedi_udelay(1); udelay(1);
devpriv->write_byte(devpriv->command5_bits, devpriv->write_byte(devpriv->command5_bits,
dev->iobase + COMMAND5_REG); dev->iobase + COMMAND5_REG);
} }
@ -1830,16 +1830,16 @@ static unsigned int labpc_serial_in(struct comedi_device *dev)
for (i = 1; i <= value_width; i++) { for (i = 1; i <= value_width; i++) {
/* set serial clock */ /* set serial clock */
devpriv->command5_bits |= SCLOCK_BIT; devpriv->command5_bits |= SCLOCK_BIT;
comedi_udelay(1); udelay(1);
devpriv->write_byte(devpriv->command5_bits, devpriv->write_byte(devpriv->command5_bits,
dev->iobase + COMMAND5_REG); dev->iobase + COMMAND5_REG);
/* clear clock bit */ /* clear clock bit */
devpriv->command5_bits &= ~SCLOCK_BIT; devpriv->command5_bits &= ~SCLOCK_BIT;
comedi_udelay(1); udelay(1);
devpriv->write_byte(devpriv->command5_bits, devpriv->write_byte(devpriv->command5_bits,
dev->iobase + COMMAND5_REG); dev->iobase + COMMAND5_REG);
/* read bits most significant bit first */ /* read bits most significant bit first */
comedi_udelay(1); udelay(1);
devpriv->status2_bits = devpriv->status2_bits =
devpriv->read_byte(dev->iobase + STATUS2_REG); devpriv->read_byte(dev->iobase + STATUS2_REG);
if (devpriv->status2_bits & EEPROM_OUT_BIT) { if (devpriv->status2_bits & EEPROM_OUT_BIT) {
@ -1858,10 +1858,10 @@ static unsigned int labpc_eeprom_read(struct comedi_device *dev, unsigned int ad
/* enable read/write to eeprom */ /* enable read/write to eeprom */
devpriv->command5_bits &= ~EEPROM_EN_BIT; devpriv->command5_bits &= ~EEPROM_EN_BIT;
comedi_udelay(1); udelay(1);
devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG);
devpriv->command5_bits |= EEPROM_EN_BIT | EEPROM_WRITE_UNPROTECT_BIT; devpriv->command5_bits |= EEPROM_EN_BIT | EEPROM_WRITE_UNPROTECT_BIT;
comedi_udelay(1); udelay(1);
devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG);
/* send read instruction */ /* send read instruction */
@ -1873,7 +1873,7 @@ static unsigned int labpc_eeprom_read(struct comedi_device *dev, unsigned int ad
/* disable read/write to eeprom */ /* disable read/write to eeprom */
devpriv->command5_bits &= ~EEPROM_EN_BIT & ~EEPROM_WRITE_UNPROTECT_BIT; devpriv->command5_bits &= ~EEPROM_EN_BIT & ~EEPROM_WRITE_UNPROTECT_BIT;
comedi_udelay(1); udelay(1);
devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG);
return value; return value;
@ -1904,21 +1904,21 @@ static unsigned int labpc_eeprom_write(struct comedi_device *dev,
/* enable read/write to eeprom */ /* enable read/write to eeprom */
devpriv->command5_bits &= ~EEPROM_EN_BIT; devpriv->command5_bits &= ~EEPROM_EN_BIT;
comedi_udelay(1); udelay(1);
devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG);
devpriv->command5_bits |= EEPROM_EN_BIT | EEPROM_WRITE_UNPROTECT_BIT; devpriv->command5_bits |= EEPROM_EN_BIT | EEPROM_WRITE_UNPROTECT_BIT;
comedi_udelay(1); udelay(1);
devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); 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); labpc_serial_out(dev, write_enable_instruction, write_length);
devpriv->command5_bits &= ~EEPROM_EN_BIT; devpriv->command5_bits &= ~EEPROM_EN_BIT;
comedi_udelay(1); udelay(1);
devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG);
/* send write instruction */ /* send write instruction */
devpriv->command5_bits |= EEPROM_EN_BIT; devpriv->command5_bits |= EEPROM_EN_BIT;
comedi_udelay(1); udelay(1);
devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG);
labpc_serial_out(dev, write_instruction, write_length); labpc_serial_out(dev, write_instruction, write_length);
/* send 8 bit address to write to */ /* send 8 bit address to write to */
@ -1926,12 +1926,12 @@ static unsigned int labpc_eeprom_write(struct comedi_device *dev,
/* write value */ /* write value */
labpc_serial_out(dev, value, write_length); labpc_serial_out(dev, value, write_length);
devpriv->command5_bits &= ~EEPROM_EN_BIT; devpriv->command5_bits &= ~EEPROM_EN_BIT;
comedi_udelay(1); udelay(1);
devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); 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; devpriv->command5_bits &= ~EEPROM_EN_BIT & ~EEPROM_WRITE_UNPROTECT_BIT;
comedi_udelay(1); udelay(1);
devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG);
return 0; return 0;
@ -1945,10 +1945,10 @@ static unsigned int labpc_eeprom_read_status(struct comedi_device *dev)
/* enable read/write to eeprom */ /* enable read/write to eeprom */
devpriv->command5_bits &= ~EEPROM_EN_BIT; devpriv->command5_bits &= ~EEPROM_EN_BIT;
comedi_udelay(1); udelay(1);
devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG);
devpriv->command5_bits |= EEPROM_EN_BIT | EEPROM_WRITE_UNPROTECT_BIT; devpriv->command5_bits |= EEPROM_EN_BIT | EEPROM_WRITE_UNPROTECT_BIT;
comedi_udelay(1); udelay(1);
devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG);
/* send read status instruction */ /* send read status instruction */
@ -1958,7 +1958,7 @@ static unsigned int labpc_eeprom_read_status(struct comedi_device *dev)
/* disable read/write to eeprom */ /* disable read/write to eeprom */
devpriv->command5_bits &= ~EEPROM_EN_BIT & ~EEPROM_WRITE_UNPROTECT_BIT; devpriv->command5_bits &= ~EEPROM_EN_BIT & ~EEPROM_WRITE_UNPROTECT_BIT;
comedi_udelay(1); udelay(1);
devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG);
return value; return value;
@ -1975,7 +1975,7 @@ static void write_caldac(struct comedi_device *dev, unsigned int channel,
/* 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 &= devpriv->command5_bits &=
~CALDAC_LOAD_BIT & ~EEPROM_EN_BIT & ~EEPROM_WRITE_UNPROTECT_BIT; ~CALDAC_LOAD_BIT & ~EEPROM_EN_BIT & ~EEPROM_WRITE_UNPROTECT_BIT;
comedi_udelay(1); udelay(1);
devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG);
/* write 4 bit channel */ /* write 4 bit channel */
@ -1985,10 +1985,10 @@ static void write_caldac(struct comedi_device *dev, unsigned int channel,
/* set and clear caldac bit to load caldac value */ /* set and clear caldac bit to load caldac value */
devpriv->command5_bits |= CALDAC_LOAD_BIT; devpriv->command5_bits |= CALDAC_LOAD_BIT;
comedi_udelay(1); udelay(1);
devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG);
devpriv->command5_bits &= ~CALDAC_LOAD_BIT; devpriv->command5_bits &= ~CALDAC_LOAD_BIT;
comedi_udelay(1); udelay(1);
devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG);
} }

View File

@ -365,7 +365,7 @@ static inline void ni_set_bitfield(struct comedi_device *dev, int reg,
{ {
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&devpriv->soft_reg_copy_lock, flags); spin_lock_irqsave(&devpriv->soft_reg_copy_lock, flags);
switch (reg) { switch (reg) {
case Interrupt_A_Enable_Register: case Interrupt_A_Enable_Register:
devpriv->int_a_enable_reg &= ~bit_mask; devpriv->int_a_enable_reg &= ~bit_mask;
@ -396,13 +396,13 @@ static inline void ni_set_bitfield(struct comedi_device *dev, int reg,
ni_writeb(devpriv->g0_g1_select_reg, G0_G1_Select); ni_writeb(devpriv->g0_g1_select_reg, G0_G1_Select);
break; break;
default: default:
rt_printk("Warning %s() called with invalid register\n", printk("Warning %s() called with invalid register\n",
__func__); __func__);
rt_printk("reg is %d\n", reg); printk("reg is %d\n", reg);
break; break;
} }
mmiowb(); mmiowb();
comedi_spin_unlock_irqrestore(&devpriv->soft_reg_copy_lock, flags); spin_unlock_irqrestore(&devpriv->soft_reg_copy_lock, flags);
} }
#ifdef PCIDMA #ifdef PCIDMA
@ -460,7 +460,7 @@ static inline void ni_set_cdo_dma_channel(struct comedi_device *dev, int mite_ch
{ {
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&devpriv->soft_reg_copy_lock, flags); spin_lock_irqsave(&devpriv->soft_reg_copy_lock, flags);
devpriv->cdio_dma_select_reg &= ~CDO_DMA_Select_Mask; devpriv->cdio_dma_select_reg &= ~CDO_DMA_Select_Mask;
if (mite_channel >= 0) { if (mite_channel >= 0) {
/*XXX just guessing ni_stc_dma_channel_select_bitfield() returns the right bits, /*XXX just guessing ni_stc_dma_channel_select_bitfield() returns the right bits,
@ -472,19 +472,19 @@ static inline void ni_set_cdo_dma_channel(struct comedi_device *dev, int mite_ch
} }
ni_writeb(devpriv->cdio_dma_select_reg, M_Offset_CDIO_DMA_Select); ni_writeb(devpriv->cdio_dma_select_reg, M_Offset_CDIO_DMA_Select);
mmiowb(); mmiowb();
comedi_spin_unlock_irqrestore(&devpriv->soft_reg_copy_lock, flags); spin_unlock_irqrestore(&devpriv->soft_reg_copy_lock, flags);
} }
static int ni_request_ai_mite_channel(struct comedi_device *dev) static int ni_request_ai_mite_channel(struct comedi_device *dev)
{ {
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&devpriv->mite_channel_lock, flags); spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
BUG_ON(devpriv->ai_mite_chan); BUG_ON(devpriv->ai_mite_chan);
devpriv->ai_mite_chan = devpriv->ai_mite_chan =
mite_request_channel(devpriv->mite, devpriv->ai_mite_ring); mite_request_channel(devpriv->mite, devpriv->ai_mite_ring);
if (devpriv->ai_mite_chan == NULL) { if (devpriv->ai_mite_chan == NULL) {
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, spin_unlock_irqrestore(&devpriv->mite_channel_lock,
flags); flags);
comedi_error(dev, comedi_error(dev,
"failed to reserve mite dma channel for analog input."); "failed to reserve mite dma channel for analog input.");
@ -492,7 +492,7 @@ static int ni_request_ai_mite_channel(struct comedi_device *dev)
} }
devpriv->ai_mite_chan->dir = COMEDI_INPUT; devpriv->ai_mite_chan->dir = COMEDI_INPUT;
ni_set_ai_dma_channel(dev, devpriv->ai_mite_chan->channel); ni_set_ai_dma_channel(dev, devpriv->ai_mite_chan->channel);
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
return 0; return 0;
} }
@ -500,12 +500,12 @@ static int ni_request_ao_mite_channel(struct comedi_device *dev)
{ {
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&devpriv->mite_channel_lock, flags); spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
BUG_ON(devpriv->ao_mite_chan); BUG_ON(devpriv->ao_mite_chan);
devpriv->ao_mite_chan = devpriv->ao_mite_chan =
mite_request_channel(devpriv->mite, devpriv->ao_mite_ring); mite_request_channel(devpriv->mite, devpriv->ao_mite_ring);
if (devpriv->ao_mite_chan == NULL) { if (devpriv->ao_mite_chan == NULL) {
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, spin_unlock_irqrestore(&devpriv->mite_channel_lock,
flags); flags);
comedi_error(dev, comedi_error(dev,
"failed to reserve mite dma channel for analog outut."); "failed to reserve mite dma channel for analog outut.");
@ -513,7 +513,7 @@ static int ni_request_ao_mite_channel(struct comedi_device *dev)
} }
devpriv->ao_mite_chan->dir = COMEDI_OUTPUT; devpriv->ao_mite_chan->dir = COMEDI_OUTPUT;
ni_set_ao_dma_channel(dev, devpriv->ao_mite_chan->channel); ni_set_ao_dma_channel(dev, devpriv->ao_mite_chan->channel);
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
return 0; return 0;
} }
@ -524,13 +524,13 @@ static int ni_request_gpct_mite_channel(struct comedi_device *dev,
struct mite_channel *mite_chan; struct mite_channel *mite_chan;
BUG_ON(gpct_index >= NUM_GPCT); BUG_ON(gpct_index >= NUM_GPCT);
comedi_spin_lock_irqsave(&devpriv->mite_channel_lock, flags); spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
BUG_ON(devpriv->counter_dev->counters[gpct_index].mite_chan); BUG_ON(devpriv->counter_dev->counters[gpct_index].mite_chan);
mite_chan = mite_chan =
mite_request_channel(devpriv->mite, mite_request_channel(devpriv->mite,
devpriv->gpct_mite_ring[gpct_index]); devpriv->gpct_mite_ring[gpct_index]);
if (mite_chan == NULL) { if (mite_chan == NULL) {
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, spin_unlock_irqrestore(&devpriv->mite_channel_lock,
flags); flags);
comedi_error(dev, comedi_error(dev,
"failed to reserve mite dma channel for counter."); "failed to reserve mite dma channel for counter.");
@ -540,7 +540,7 @@ static int ni_request_gpct_mite_channel(struct comedi_device *dev,
ni_tio_set_mite_channel(&devpriv->counter_dev->counters[gpct_index], ni_tio_set_mite_channel(&devpriv->counter_dev->counters[gpct_index],
mite_chan); mite_chan);
ni_set_gpct_dma_channel(dev, gpct_index, mite_chan->channel); ni_set_gpct_dma_channel(dev, gpct_index, mite_chan->channel);
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
return 0; return 0;
} }
@ -551,12 +551,12 @@ static int ni_request_cdo_mite_channel(struct comedi_device *dev)
#ifdef PCIDMA #ifdef PCIDMA
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&devpriv->mite_channel_lock, flags); spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
BUG_ON(devpriv->cdo_mite_chan); BUG_ON(devpriv->cdo_mite_chan);
devpriv->cdo_mite_chan = devpriv->cdo_mite_chan =
mite_request_channel(devpriv->mite, devpriv->cdo_mite_ring); mite_request_channel(devpriv->mite, devpriv->cdo_mite_ring);
if (devpriv->cdo_mite_chan == NULL) { if (devpriv->cdo_mite_chan == NULL) {
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, spin_unlock_irqrestore(&devpriv->mite_channel_lock,
flags); flags);
comedi_error(dev, comedi_error(dev,
"failed to reserve mite dma channel for correlated digital outut."); "failed to reserve mite dma channel for correlated digital outut.");
@ -564,7 +564,7 @@ static int ni_request_cdo_mite_channel(struct comedi_device *dev)
} }
devpriv->cdo_mite_chan->dir = COMEDI_OUTPUT; devpriv->cdo_mite_chan->dir = COMEDI_OUTPUT;
ni_set_cdo_dma_channel(dev, devpriv->cdo_mite_chan->channel); ni_set_cdo_dma_channel(dev, devpriv->cdo_mite_chan->channel);
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
#endif /* PCIDMA */ #endif /* PCIDMA */
return 0; return 0;
} }
@ -574,13 +574,13 @@ static void ni_release_ai_mite_channel(struct comedi_device *dev)
#ifdef PCIDMA #ifdef PCIDMA
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&devpriv->mite_channel_lock, flags); spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
if (devpriv->ai_mite_chan) { if (devpriv->ai_mite_chan) {
ni_set_ai_dma_channel(dev, -1); ni_set_ai_dma_channel(dev, -1);
mite_release_channel(devpriv->ai_mite_chan); mite_release_channel(devpriv->ai_mite_chan);
devpriv->ai_mite_chan = NULL; devpriv->ai_mite_chan = NULL;
} }
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
#endif /* PCIDMA */ #endif /* PCIDMA */
} }
@ -589,13 +589,13 @@ static void ni_release_ao_mite_channel(struct comedi_device *dev)
#ifdef PCIDMA #ifdef PCIDMA
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&devpriv->mite_channel_lock, flags); spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
if (devpriv->ao_mite_chan) { if (devpriv->ao_mite_chan) {
ni_set_ao_dma_channel(dev, -1); ni_set_ao_dma_channel(dev, -1);
mite_release_channel(devpriv->ao_mite_chan); mite_release_channel(devpriv->ao_mite_chan);
devpriv->ao_mite_chan = NULL; devpriv->ao_mite_chan = NULL;
} }
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
#endif /* PCIDMA */ #endif /* PCIDMA */
} }
@ -605,7 +605,7 @@ void ni_release_gpct_mite_channel(struct comedi_device *dev, unsigned gpct_index
unsigned long flags; unsigned long flags;
BUG_ON(gpct_index >= NUM_GPCT); BUG_ON(gpct_index >= NUM_GPCT);
comedi_spin_lock_irqsave(&devpriv->mite_channel_lock, flags); spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
if (devpriv->counter_dev->counters[gpct_index].mite_chan) { if (devpriv->counter_dev->counters[gpct_index].mite_chan) {
struct mite_channel *mite_chan = struct mite_channel *mite_chan =
devpriv->counter_dev->counters[gpct_index].mite_chan; devpriv->counter_dev->counters[gpct_index].mite_chan;
@ -615,7 +615,7 @@ void ni_release_gpct_mite_channel(struct comedi_device *dev, unsigned gpct_index
counters[gpct_index], NULL); counters[gpct_index], NULL);
mite_release_channel(mite_chan); mite_release_channel(mite_chan);
} }
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
#endif /* PCIDMA */ #endif /* PCIDMA */
} }
@ -624,13 +624,13 @@ static void ni_release_cdo_mite_channel(struct comedi_device *dev)
#ifdef PCIDMA #ifdef PCIDMA
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&devpriv->mite_channel_lock, flags); spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
if (devpriv->cdo_mite_chan) { if (devpriv->cdo_mite_chan) {
ni_set_cdo_dma_channel(dev, -1); ni_set_cdo_dma_channel(dev, -1);
mite_release_channel(devpriv->cdo_mite_chan); mite_release_channel(devpriv->cdo_mite_chan);
devpriv->cdo_mite_chan = NULL; devpriv->cdo_mite_chan = NULL;
} }
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
#endif /* PCIDMA */ #endif /* PCIDMA */
} }
@ -712,20 +712,20 @@ static inline void ni_ao_win_outw(struct comedi_device *dev, uint16_t data, int
{ {
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&devpriv->window_lock, flags); spin_lock_irqsave(&devpriv->window_lock, flags);
ni_writew(addr, AO_Window_Address_611x); ni_writew(addr, AO_Window_Address_611x);
ni_writew(data, AO_Window_Data_611x); ni_writew(data, AO_Window_Data_611x);
comedi_spin_unlock_irqrestore(&devpriv->window_lock, flags); spin_unlock_irqrestore(&devpriv->window_lock, flags);
} }
static inline void ni_ao_win_outl(struct comedi_device *dev, uint32_t data, int addr) static inline void ni_ao_win_outl(struct comedi_device *dev, uint32_t data, int addr)
{ {
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&devpriv->window_lock, flags); spin_lock_irqsave(&devpriv->window_lock, flags);
ni_writew(addr, AO_Window_Address_611x); ni_writew(addr, AO_Window_Address_611x);
ni_writel(data, AO_Window_Data_611x); ni_writel(data, AO_Window_Data_611x);
comedi_spin_unlock_irqrestore(&devpriv->window_lock, flags); spin_unlock_irqrestore(&devpriv->window_lock, flags);
} }
static inline unsigned short ni_ao_win_inw(struct comedi_device *dev, int addr) static inline unsigned short ni_ao_win_inw(struct comedi_device *dev, int addr)
@ -733,10 +733,10 @@ static inline unsigned short ni_ao_win_inw(struct comedi_device *dev, int addr)
unsigned long flags; unsigned long flags;
unsigned short data; unsigned short data;
comedi_spin_lock_irqsave(&devpriv->window_lock, flags); spin_lock_irqsave(&devpriv->window_lock, flags);
ni_writew(addr, AO_Window_Address_611x); ni_writew(addr, AO_Window_Address_611x);
data = ni_readw(AO_Window_Data_611x); data = ni_readw(AO_Window_Data_611x);
comedi_spin_unlock_irqrestore(&devpriv->window_lock, flags); spin_unlock_irqrestore(&devpriv->window_lock, flags);
return data; return data;
} }
@ -779,15 +779,14 @@ static irqreturn_t ni_E_interrupt(int irq, void *d)
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); spin_lock_irqsave(&dev->spinlock, flags);
a_status = devpriv->stc_readw(dev, AI_Status_1_Register); a_status = devpriv->stc_readw(dev, AI_Status_1_Register);
b_status = devpriv->stc_readw(dev, AO_Status_1_Register); b_status = devpriv->stc_readw(dev, AO_Status_1_Register);
#ifdef PCIDMA #ifdef PCIDMA
if (mite) { if (mite) {
unsigned long flags_too; unsigned long flags_too;
comedi_spin_lock_irqsave(&devpriv->mite_channel_lock, spin_lock_irqsave(&devpriv->mite_channel_lock, flags_too);
flags_too);
if (devpriv->ai_mite_chan) { if (devpriv->ai_mite_chan) {
ai_mite_status = mite_get_status(devpriv->ai_mite_chan); ai_mite_status = mite_get_status(devpriv->ai_mite_chan);
if (ai_mite_status & CHSR_LINKC) if (ai_mite_status & CHSR_LINKC)
@ -804,8 +803,7 @@ static irqreturn_t ni_E_interrupt(int irq, void *d)
MITE_CHOR(devpriv->ao_mite_chan-> MITE_CHOR(devpriv->ao_mite_chan->
channel)); channel));
} }
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags_too);
flags_too);
} }
#endif #endif
ack_a_interrupt(dev, a_status); ack_a_interrupt(dev, a_status);
@ -818,7 +816,7 @@ static irqreturn_t ni_E_interrupt(int irq, void *d)
handle_gpct_interrupt(dev, 1); handle_gpct_interrupt(dev, 1);
handle_cdio_interrupt(dev); handle_cdio_interrupt(dev);
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
@ -828,10 +826,10 @@ static void ni_sync_ai_dma(struct comedi_device *dev)
struct comedi_subdevice *s = dev->subdevices + NI_AI_SUBDEV; struct comedi_subdevice *s = dev->subdevices + NI_AI_SUBDEV;
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&devpriv->mite_channel_lock, flags); spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
if (devpriv->ai_mite_chan) if (devpriv->ai_mite_chan)
mite_sync_input_dma(devpriv->ai_mite_chan, s->async); mite_sync_input_dma(devpriv->ai_mite_chan, s->async);
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
} }
static void mite_handle_b_linkc(struct mite_struct *mite, struct comedi_device * dev) static void mite_handle_b_linkc(struct mite_struct *mite, struct comedi_device * dev)
@ -839,11 +837,11 @@ static void mite_handle_b_linkc(struct mite_struct *mite, struct comedi_device *
struct comedi_subdevice *s = dev->subdevices + NI_AO_SUBDEV; struct comedi_subdevice *s = dev->subdevices + NI_AO_SUBDEV;
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&devpriv->mite_channel_lock, flags); spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
if (devpriv->ao_mite_chan) { if (devpriv->ao_mite_chan) {
mite_sync_output_dma(devpriv->ao_mite_chan, s->async); mite_sync_output_dma(devpriv->ao_mite_chan, s->async);
} }
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
} }
static int ni_ao_wait_for_dma_load(struct comedi_device *dev) static int ni_ao_wait_for_dma_load(struct comedi_device *dev)
@ -858,7 +856,7 @@ static int ni_ao_wait_for_dma_load(struct comedi_device *dev)
break; break;
/* if we poll too often, the pci bus activity seems /* if we poll too often, the pci bus activity seems
to slow the dma transfer down */ to slow the dma transfer down */
comedi_udelay(10); udelay(10);
} }
if (i == timeout) { if (i == timeout) {
comedi_error(dev, "timed out waiting for dma load"); comedi_error(dev, "timed out waiting for dma load");
@ -879,7 +877,7 @@ static void ni_handle_eos(struct comedi_device *dev, struct comedi_subdevice *s)
ni_sync_ai_dma(dev); ni_sync_ai_dma(dev);
if ((s->async->events & COMEDI_CB_EOS)) if ((s->async->events & COMEDI_CB_EOS))
break; break;
comedi_udelay(1); udelay(1);
} }
#else #else
ni_handle_fifo_dregs(dev); ni_handle_fifo_dregs(dev);
@ -976,7 +974,7 @@ static void handle_a_interrupt(struct comedi_device *dev, unsigned short status,
return; return;
#ifdef DEBUG_INTERRUPT #ifdef DEBUG_INTERRUPT
rt_printk printk
("ni_mio_common: interrupt: a_status=%04x ai_mite_status=%08x\n", ("ni_mio_common: interrupt: a_status=%04x ai_mite_status=%08x\n",
status, ai_mite_status); status, ai_mite_status);
ni_mio_print_status_a(status); ni_mio_print_status_a(status);
@ -989,7 +987,7 @@ static void handle_a_interrupt(struct comedi_device *dev, unsigned short status,
if (ai_mite_status & ~(CHSR_INT | CHSR_LINKC | CHSR_DONE | CHSR_MRDY | if (ai_mite_status & ~(CHSR_INT | CHSR_LINKC | CHSR_DONE | CHSR_MRDY |
CHSR_DRDY | CHSR_DRQ1 | CHSR_DRQ0 | CHSR_ERROR | CHSR_DRDY | CHSR_DRQ1 | CHSR_DRQ0 | CHSR_ERROR |
CHSR_SABORT | CHSR_XFERR | CHSR_LxERR_mask)) { CHSR_SABORT | CHSR_XFERR | CHSR_LxERR_mask)) {
rt_printk printk
("unknown mite interrupt, ack! (ai_mite_status=%08x)\n", ("unknown mite interrupt, ack! (ai_mite_status=%08x)\n",
ai_mite_status); ai_mite_status);
/* mite_print_chsr(ai_mite_status); */ /* mite_print_chsr(ai_mite_status); */
@ -1002,7 +1000,7 @@ static void handle_a_interrupt(struct comedi_device *dev, unsigned short status,
if (status & (AI_Overrun_St | AI_Overflow_St | AI_SC_TC_Error_St | if (status & (AI_Overrun_St | AI_Overflow_St | AI_SC_TC_Error_St |
AI_SC_TC_St | AI_START1_St)) { AI_SC_TC_St | AI_START1_St)) {
if (status == 0xffff) { if (status == 0xffff) {
rt_printk printk
("ni_mio_common: a_status=0xffff. Card removed?\n"); ("ni_mio_common: a_status=0xffff. Card removed?\n");
/* we probably aren't even running a command now, /* we probably aren't even running a command now,
* so it's a good idea to be careful. */ * so it's a good idea to be careful. */
@ -1015,7 +1013,7 @@ static void handle_a_interrupt(struct comedi_device *dev, unsigned short status,
} }
if (status & (AI_Overrun_St | AI_Overflow_St | if (status & (AI_Overrun_St | AI_Overflow_St |
AI_SC_TC_Error_St)) { AI_SC_TC_Error_St)) {
rt_printk("ni_mio_common: ai error a_status=%04x\n", printk("ni_mio_common: ai error a_status=%04x\n",
status); status);
ni_mio_print_status_a(status); ni_mio_print_status_a(status);
@ -1031,7 +1029,7 @@ static void handle_a_interrupt(struct comedi_device *dev, unsigned short status,
} }
if (status & AI_SC_TC_St) { if (status & AI_SC_TC_St) {
#ifdef DEBUG_INTERRUPT #ifdef DEBUG_INTERRUPT
rt_printk("ni_mio_common: SC_TC interrupt\n"); printk("ni_mio_common: SC_TC interrupt\n");
#endif #endif
if (!devpriv->ai_continuous) { if (!devpriv->ai_continuous) {
shutdown_ai_command(dev); shutdown_ai_command(dev);
@ -1063,7 +1061,7 @@ static void handle_a_interrupt(struct comedi_device *dev, unsigned short status,
#ifdef DEBUG_INTERRUPT #ifdef DEBUG_INTERRUPT
status = devpriv->stc_readw(dev, AI_Status_1_Register); status = devpriv->stc_readw(dev, AI_Status_1_Register);
if (status & Interrupt_A_St) { if (status & Interrupt_A_St) {
rt_printk printk
("handle_a_interrupt: didn't clear interrupt? status=0x%x\n", ("handle_a_interrupt: didn't clear interrupt? status=0x%x\n",
status); status);
} }
@ -1104,7 +1102,7 @@ static void handle_b_interrupt(struct comedi_device *dev, unsigned short b_statu
struct comedi_subdevice *s = dev->subdevices + NI_AO_SUBDEV; struct comedi_subdevice *s = dev->subdevices + NI_AO_SUBDEV;
/* unsigned short ack=0; */ /* unsigned short ack=0; */
#ifdef DEBUG_INTERRUPT #ifdef DEBUG_INTERRUPT
rt_printk("ni_mio_common: interrupt: b_status=%04x m1_status=%08x\n", printk("ni_mio_common: interrupt: b_status=%04x m1_status=%08x\n",
b_status, ao_mite_status); b_status, ao_mite_status);
ni_mio_print_status_b(b_status); ni_mio_print_status_b(b_status);
#endif #endif
@ -1118,7 +1116,7 @@ static void handle_b_interrupt(struct comedi_device *dev, unsigned short b_statu
if (ao_mite_status & ~(CHSR_INT | CHSR_LINKC | CHSR_DONE | CHSR_MRDY | if (ao_mite_status & ~(CHSR_INT | CHSR_LINKC | CHSR_DONE | CHSR_MRDY |
CHSR_DRDY | CHSR_DRQ1 | CHSR_DRQ0 | CHSR_ERROR | CHSR_DRDY | CHSR_DRQ1 | CHSR_DRQ0 | CHSR_ERROR |
CHSR_SABORT | CHSR_XFERR | CHSR_LxERR_mask)) { CHSR_SABORT | CHSR_XFERR | CHSR_LxERR_mask)) {
rt_printk printk
("unknown mite interrupt, ack! (ao_mite_status=%08x)\n", ("unknown mite interrupt, ack! (ao_mite_status=%08x)\n",
ao_mite_status); ao_mite_status);
/* mite_print_chsr(ao_mite_status); */ /* mite_print_chsr(ao_mite_status); */
@ -1129,7 +1127,7 @@ static void handle_b_interrupt(struct comedi_device *dev, unsigned short b_statu
if (b_status == 0xffff) if (b_status == 0xffff)
return; return;
if (b_status & AO_Overrun_St) { if (b_status & AO_Overrun_St) {
rt_printk printk
("ni_mio_common: AO FIFO underrun status=0x%04x status2=0x%04x\n", ("ni_mio_common: AO FIFO underrun status=0x%04x status2=0x%04x\n",
b_status, devpriv->stc_readw(dev, b_status, devpriv->stc_readw(dev,
AO_Status_2_Register)); AO_Status_2_Register));
@ -1146,7 +1144,7 @@ static void handle_b_interrupt(struct comedi_device *dev, unsigned short b_statu
ret = ni_ao_fifo_half_empty(dev, s); ret = ni_ao_fifo_half_empty(dev, s);
if (!ret) { if (!ret) {
rt_printk("ni_mio_common: AO buffer underrun\n"); printk("ni_mio_common: AO buffer underrun\n");
ni_set_bits(dev, Interrupt_B_Enable_Register, ni_set_bits(dev, Interrupt_B_Enable_Register,
AO_FIFO_Interrupt_Enable | AO_FIFO_Interrupt_Enable |
AO_Error_Interrupt_Enable, 0); AO_Error_Interrupt_Enable, 0);
@ -1170,13 +1168,13 @@ static void ni_mio_print_status_a(int status)
{ {
int i; int i;
rt_printk("A status:"); printk("A status:");
for (i = 15; i >= 0; i--) { for (i = 15; i >= 0; i--) {
if (status & (1 << i)) { if (status & (1 << i)) {
rt_printk(" %s", status_a_strings[i]); printk(" %s", status_a_strings[i]);
} }
} }
rt_printk("\n"); printk("\n");
} }
#endif #endif
@ -1192,13 +1190,13 @@ static void ni_mio_print_status_b(int status)
{ {
int i; int i;
rt_printk("B status:"); printk("B status:");
for (i = 15; i >= 0; i--) { for (i = 15; i >= 0; i--) {
if (status & (1 << i)) { if (status & (1 << i)) {
rt_printk(" %s", status_b_strings[i]); printk(" %s", status_b_strings[i]);
} }
} }
rt_printk("\n"); printk("\n");
} }
#endif #endif
@ -1383,7 +1381,7 @@ static int ni_ai_drain_dma(struct comedi_device *dev)
unsigned long flags; unsigned long flags;
int retval = 0; int retval = 0;
comedi_spin_lock_irqsave(&devpriv->mite_channel_lock, flags); spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
if (devpriv->ai_mite_chan) { if (devpriv->ai_mite_chan) {
for (i = 0; i < timeout; i++) { for (i = 0; i < timeout; i++) {
if ((devpriv->stc_readw(dev, if ((devpriv->stc_readw(dev,
@ -1392,19 +1390,19 @@ static int ni_ai_drain_dma(struct comedi_device *dev)
&& mite_bytes_in_transit(devpriv-> && mite_bytes_in_transit(devpriv->
ai_mite_chan) == 0) ai_mite_chan) == 0)
break; break;
comedi_udelay(5); udelay(5);
} }
if (i == timeout) { if (i == timeout) {
rt_printk printk
("ni_mio_common: wait for dma drain timed out\n"); ("ni_mio_common: wait for dma drain timed out\n");
rt_printk printk
("mite_bytes_in_transit=%i, AI_Status1_Register=0x%x\n", ("mite_bytes_in_transit=%i, AI_Status1_Register=0x%x\n",
mite_bytes_in_transit(devpriv->ai_mite_chan), mite_bytes_in_transit(devpriv->ai_mite_chan),
devpriv->stc_readw(dev, AI_Status_1_Register)); devpriv->stc_readw(dev, AI_Status_1_Register));
retval = -1; retval = -1;
} }
} }
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
ni_sync_ai_dma(dev); ni_sync_ai_dma(dev);
@ -1548,15 +1546,14 @@ static int ni_ai_setup_MITE_dma(struct comedi_device *dev)
retval = ni_request_ai_mite_channel(dev); retval = ni_request_ai_mite_channel(dev);
if (retval) if (retval)
return retval; return retval;
/* rt_printk("comedi_debug: using mite channel %i for ai.\n", devpriv->ai_mite_chan->channel); */ /* printk("comedi_debug: using mite channel %i for ai.\n", devpriv->ai_mite_chan->channel); */
/* write alloc the entire buffer */ /* write alloc the entire buffer */
comedi_buf_write_alloc(s->async, s->async->prealloc_bufsz); comedi_buf_write_alloc(s->async, s->async->prealloc_bufsz);
comedi_spin_lock_irqsave(&devpriv->mite_channel_lock, flags); spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
if (devpriv->ai_mite_chan == NULL) if (devpriv->ai_mite_chan == NULL) {
{ spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
return -EIO; return -EIO;
} }
@ -1574,7 +1571,7 @@ static int ni_ai_setup_MITE_dma(struct comedi_device *dev)
}; };
/*start the MITE */ /*start the MITE */
mite_dma_arm(devpriv->ai_mite_chan); mite_dma_arm(devpriv->ai_mite_chan);
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
return 0; return 0;
} }
@ -1592,7 +1589,7 @@ static int ni_ao_setup_MITE_dma(struct comedi_device *dev)
/* read alloc the entire buffer */ /* read alloc the entire buffer */
comedi_buf_read_alloc(s->async, s->async->prealloc_bufsz); comedi_buf_read_alloc(s->async, s->async->prealloc_bufsz);
comedi_spin_lock_irqsave(&devpriv->mite_channel_lock, flags); spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
if (devpriv->ao_mite_chan) { if (devpriv->ao_mite_chan) {
if (boardtype.reg_type & (ni_reg_611x | ni_reg_6713)) { if (boardtype.reg_type & (ni_reg_611x | ni_reg_6713)) {
mite_prep_dma(devpriv->ao_mite_chan, 32, 32); mite_prep_dma(devpriv->ao_mite_chan, 32, 32);
@ -1604,7 +1601,7 @@ static int ni_ao_setup_MITE_dma(struct comedi_device *dev)
mite_dma_arm(devpriv->ao_mite_chan); mite_dma_arm(devpriv->ao_mite_chan);
} else } else
retval = -EIO; retval = -EIO;
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
return retval; return retval;
} }
@ -1705,7 +1702,7 @@ static int ni_ai_poll(struct comedi_device *dev, struct comedi_subdevice *s)
/* lock to avoid race with interrupt handler */ /* lock to avoid race with interrupt handler */
if (in_interrupt() == 0) if (in_interrupt() == 0)
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
#ifndef PCIDMA #ifndef PCIDMA
ni_handle_fifo_dregs(dev); ni_handle_fifo_dregs(dev);
#else #else
@ -1713,7 +1710,7 @@ static int ni_ai_poll(struct comedi_device *dev, struct comedi_subdevice *s)
#endif #endif
count = s->async->buf_write_count - s->async->buf_read_count; count = s->async->buf_write_count - s->async->buf_read_count;
if (in_interrupt() == 0) if (in_interrupt() == 0)
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
return count; return count;
} }
@ -1736,7 +1733,7 @@ static int ni_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s
for (n = 0; n < num_adc_stages_611x; n++) { for (n = 0; n < num_adc_stages_611x; n++) {
devpriv->stc_writew(dev, AI_CONVERT_Pulse, devpriv->stc_writew(dev, AI_CONVERT_Pulse,
AI_Command_1_Register); AI_Command_1_Register);
comedi_udelay(1); udelay(1);
} }
for (n = 0; n < insn->n; n++) { for (n = 0; n < insn->n; n++) {
devpriv->stc_writew(dev, AI_CONVERT_Pulse, devpriv->stc_writew(dev, AI_CONVERT_Pulse,
@ -1758,7 +1755,7 @@ static int ni_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s
} }
} }
if (i == NI_TIMEOUT) { if (i == NI_TIMEOUT) {
rt_printk printk
("ni_mio_common: timeout in 611x ni_ai_insn_read\n"); ("ni_mio_common: timeout in 611x ni_ai_insn_read\n");
return -ETIME; return -ETIME;
} }
@ -1780,7 +1777,7 @@ static int ni_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s
} }
} }
if (i == NI_TIMEOUT) { if (i == NI_TIMEOUT) {
rt_printk printk
("ni_mio_common: timeout in 6143 ni_ai_insn_read\n"); ("ni_mio_common: timeout in 6143 ni_ai_insn_read\n");
return -ETIME; return -ETIME;
} }
@ -1797,7 +1794,7 @@ static int ni_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s
break; break;
} }
if (i == NI_TIMEOUT) { if (i == NI_TIMEOUT) {
rt_printk printk
("ni_mio_common: timeout in ni_ai_insn_read\n"); ("ni_mio_common: timeout in ni_ai_insn_read\n");
return -ETIME; return -ETIME;
} }
@ -1825,9 +1822,9 @@ void ni_prime_channelgain_list(struct comedi_device *dev)
devpriv->stc_writew(dev, 1, ADC_FIFO_Clear); devpriv->stc_writew(dev, 1, ADC_FIFO_Clear);
return; return;
} }
comedi_udelay(1); udelay(1);
} }
rt_printk("ni_mio_common: timeout loading channel/gain list\n"); printk("ni_mio_common: timeout loading channel/gain list\n");
} }
static void ni_m_series_load_channelgain_list(struct comedi_device *dev, static void ni_m_series_load_channelgain_list(struct comedi_device *dev,
@ -2844,7 +2841,7 @@ static int ni_m_series_ao_config_chanlist(struct comedi_device *dev,
M_Offset_AO_Reference_Attenuation(chan)); M_Offset_AO_Reference_Attenuation(chan));
break; break;
default: default:
rt_printk("%s: bug! unhandled ao reference voltage\n", printk("%s: bug! unhandled ao reference voltage\n",
__func__); __func__);
break; break;
} }
@ -2856,7 +2853,7 @@ static int ni_m_series_ao_config_chanlist(struct comedi_device *dev,
conf |= MSeries_AO_DAC_Offset_5V_Bits; conf |= MSeries_AO_DAC_Offset_5V_Bits;
break; break;
default: default:
rt_printk("%s: bug! unhandled ao offset voltage\n", printk("%s: bug! unhandled ao offset voltage\n",
__func__); __func__);
break; break;
} }
@ -3033,7 +3030,7 @@ static int ni_ao_inttrig(struct comedi_device *dev, struct comedi_subdevice *s,
devpriv->stc_writew(dev, devpriv->ao_mode3, AO_Mode_3_Register); devpriv->stc_writew(dev, devpriv->ao_mode3, AO_Mode_3_Register);
/* wait for DACs to be loaded */ /* wait for DACs to be loaded */
for (i = 0; i < timeout; i++) { for (i = 0; i < timeout; i++) {
comedi_udelay(1); udelay(1);
if ((devpriv->stc_readw(dev, if ((devpriv->stc_readw(dev,
Joint_Status_2_Register) & Joint_Status_2_Register) &
AO_TMRDACWRs_In_Progress_St) == 0) AO_TMRDACWRs_In_Progress_St) == 0)
@ -3440,7 +3437,7 @@ static int ni_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
#ifdef DEBUG_DIO #ifdef DEBUG_DIO
rt_printk("ni_dio_insn_config() chan=%d io=%d\n", printk("ni_dio_insn_config() chan=%d io=%d\n",
CR_CHAN(insn->chanspec), data[0]); CR_CHAN(insn->chanspec), data[0]);
#endif #endif
switch (data[0]) { switch (data[0]) {
@ -3472,7 +3469,7 @@ static int ni_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
#ifdef DEBUG_DIO #ifdef DEBUG_DIO
rt_printk("ni_dio_insn_bits() mask=0x%x bits=0x%x\n", data[0], data[1]); printk("ni_dio_insn_bits() mask=0x%x bits=0x%x\n", data[0], data[1]);
#endif #endif
if (insn->n != 2) if (insn->n != 2)
return -EINVAL; return -EINVAL;
@ -3499,7 +3496,7 @@ static int ni_m_series_dio_insn_config(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
{ {
#ifdef DEBUG_DIO #ifdef DEBUG_DIO
rt_printk("ni_m_series_dio_insn_config() chan=%d io=%d\n", printk("ni_m_series_dio_insn_config() chan=%d io=%d\n",
CR_CHAN(insn->chanspec), data[0]); CR_CHAN(insn->chanspec), data[0]);
#endif #endif
switch (data[0]) { switch (data[0]) {
@ -3529,7 +3526,7 @@ static int ni_m_series_dio_insn_bits(struct comedi_device *dev, struct comedi_su
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
#ifdef DEBUG_DIO #ifdef DEBUG_DIO
rt_printk("ni_m_series_dio_insn_bits() mask=0x%x bits=0x%x\n", data[0], printk("ni_m_series_dio_insn_bits() mask=0x%x bits=0x%x\n", data[0],
data[1]); data[1]);
#endif #endif
if (insn->n != 2) if (insn->n != 2)
@ -3706,7 +3703,7 @@ static int ni_cdo_inttrig(struct comedi_device *dev, struct comedi_subdevice *s,
comedi_buf_read_alloc(s->async, s->async->prealloc_bufsz); comedi_buf_read_alloc(s->async, s->async->prealloc_bufsz);
#ifdef PCIDMA #ifdef PCIDMA
comedi_spin_lock_irqsave(&devpriv->mite_channel_lock, flags); spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
if (devpriv->cdo_mite_chan) { if (devpriv->cdo_mite_chan) {
mite_prep_dma(devpriv->cdo_mite_chan, 32, 32); mite_prep_dma(devpriv->cdo_mite_chan, 32, 32);
mite_dma_arm(devpriv->cdo_mite_chan); mite_dma_arm(devpriv->cdo_mite_chan);
@ -3714,7 +3711,7 @@ static int ni_cdo_inttrig(struct comedi_device *dev, struct comedi_subdevice *s,
comedi_error(dev, "BUG: no cdo mite channel?"); comedi_error(dev, "BUG: no cdo mite channel?");
retval = -EIO; retval = -EIO;
} }
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
if (retval < 0) if (retval < 0)
return retval; return retval;
#endif #endif
@ -3726,7 +3723,7 @@ static int ni_cdo_inttrig(struct comedi_device *dev, struct comedi_subdevice *s,
for (i = 0; i < timeout; ++i) { for (i = 0; i < timeout; ++i) {
if (ni_readl(M_Offset_CDIO_Status) & CDO_FIFO_Full_Bit) if (ni_readl(M_Offset_CDIO_Status) & CDO_FIFO_Full_Bit)
break; break;
comedi_udelay(10); udelay(10);
} }
if (i == timeout) { if (i == timeout) {
comedi_error(dev, "dma failed to fill cdo fifo!"); comedi_error(dev, "dma failed to fill cdo fifo!");
@ -3765,7 +3762,7 @@ static void handle_cdio_interrupt(struct comedi_device *dev)
return; return;
} }
#ifdef PCIDMA #ifdef PCIDMA
comedi_spin_lock_irqsave(&devpriv->mite_channel_lock, flags); spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
if (devpriv->cdo_mite_chan) { if (devpriv->cdo_mite_chan) {
unsigned cdo_mite_status = unsigned cdo_mite_status =
mite_get_status(devpriv->cdo_mite_chan); mite_get_status(devpriv->cdo_mite_chan);
@ -3776,17 +3773,17 @@ static void handle_cdio_interrupt(struct comedi_device *dev)
} }
mite_sync_output_dma(devpriv->cdo_mite_chan, s->async); mite_sync_output_dma(devpriv->cdo_mite_chan, s->async);
} }
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
#endif #endif
cdio_status = ni_readl(M_Offset_CDIO_Status); cdio_status = ni_readl(M_Offset_CDIO_Status);
if (cdio_status & (CDO_Overrun_Bit | CDO_Underflow_Bit)) { if (cdio_status & (CDO_Overrun_Bit | CDO_Underflow_Bit)) {
/* rt_printk("cdio error: statux=0x%x\n", cdio_status); */ /* 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 */ 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; s->async->events |= COMEDI_CB_OVERFLOW;
} }
if (cdio_status & CDO_FIFO_Empty_Bit) { if (cdio_status & CDO_FIFO_Empty_Bit) {
/* rt_printk("cdio fifo empty\n"); */ /* printk("cdio fifo empty\n"); */
ni_writel(CDO_Empty_FIFO_Interrupt_Enable_Clear_Bit, ni_writel(CDO_Empty_FIFO_Interrupt_Enable_Clear_Bit,
M_Offset_CDIO_Command); M_Offset_CDIO_Command);
/* s->async->events |= COMEDI_CB_EOA; */ /* s->async->events |= COMEDI_CB_EOA; */
@ -3807,7 +3804,7 @@ static int ni_serial_insn_config(struct comedi_device *dev, struct comedi_subdev
case INSN_CONFIG_SERIAL_CLOCK: case INSN_CONFIG_SERIAL_CLOCK:
#ifdef DEBUG_DIO #ifdef DEBUG_DIO
rt_printk("SPI serial clock Config cd\n", data[1]); printk("SPI serial clock Config cd\n", data[1]);
#endif #endif
devpriv->serial_hw_mode = 1; devpriv->serial_hw_mode = 1;
devpriv->dio_control |= DIO_HW_Serial_Enable; devpriv->dio_control |= DIO_HW_Serial_Enable;
@ -3873,7 +3870,7 @@ static int ni_serial_insn_config(struct comedi_device *dev, struct comedi_subdev
err = ni_serial_sw_readwrite8(dev, s, byte_out, err = ni_serial_sw_readwrite8(dev, s, byte_out,
&byte_in); &byte_in);
} else { } else {
rt_printk("ni_serial_insn_config: serial disabled!\n"); printk("ni_serial_insn_config: serial disabled!\n");
return -EINVAL; return -EINVAL;
} }
if (err < 0) if (err < 0)
@ -3895,7 +3892,7 @@ static int ni_serial_hw_readwrite8(struct comedi_device *dev, struct comedi_subd
int err = 0, count = 20; int err = 0, count = 20;
#ifdef DEBUG_DIO #ifdef DEBUG_DIO
rt_printk("ni_serial_hw_readwrite8: outputting 0x%x\n", data_out); printk("ni_serial_hw_readwrite8: outputting 0x%x\n", data_out);
#endif #endif
devpriv->dio_output &= ~DIO_Serial_Data_Mask; devpriv->dio_output &= ~DIO_Serial_Data_Mask;
@ -3918,9 +3915,9 @@ static int ni_serial_hw_readwrite8(struct comedi_device *dev, struct comedi_subd
Joint_Status_1_Register)) & Joint_Status_1_Register)) &
DIO_Serial_IO_In_Progress_St) { DIO_Serial_IO_In_Progress_St) {
/* Delay one bit per loop */ /* Delay one bit per loop */
comedi_udelay((devpriv->serial_interval_ns + 999) / 1000); udelay((devpriv->serial_interval_ns + 999) / 1000);
if (--count < 0) { if (--count < 0) {
rt_printk printk
("ni_serial_hw_readwrite8: SPI serial I/O didn't finish in time!\n"); ("ni_serial_hw_readwrite8: SPI serial I/O didn't finish in time!\n");
err = -ETIME; err = -ETIME;
goto Error; goto Error;
@ -3929,12 +3926,12 @@ static int ni_serial_hw_readwrite8(struct comedi_device *dev, struct comedi_subd
/* Delay for last bit. This delay is absolutely necessary, because /* Delay for last bit. This delay is absolutely necessary, because
DIO_Serial_IO_In_Progress_St goes high one bit too early. */ DIO_Serial_IO_In_Progress_St goes high one bit too early. */
comedi_udelay((devpriv->serial_interval_ns + 999) / 1000); udelay((devpriv->serial_interval_ns + 999) / 1000);
if (data_in != NULL) { if (data_in != NULL) {
*data_in = devpriv->stc_readw(dev, DIO_Serial_Input_Register); *data_in = devpriv->stc_readw(dev, DIO_Serial_Input_Register);
#ifdef DEBUG_DIO #ifdef DEBUG_DIO
rt_printk("ni_serial_hw_readwrite8: inputted 0x%x\n", *data_in); printk("ni_serial_hw_readwrite8: inputted 0x%x\n", *data_in);
#endif #endif
} }
@ -3950,11 +3947,11 @@ static int ni_serial_sw_readwrite8(struct comedi_device *dev, struct comedi_subd
unsigned char mask, input = 0; unsigned char mask, input = 0;
#ifdef DEBUG_DIO #ifdef DEBUG_DIO
rt_printk("ni_serial_sw_readwrite8: outputting 0x%x\n", data_out); printk("ni_serial_sw_readwrite8: outputting 0x%x\n", data_out);
#endif #endif
/* Wait for one bit before transfer */ /* Wait for one bit before transfer */
comedi_udelay((devpriv->serial_interval_ns + 999) / 1000); udelay((devpriv->serial_interval_ns + 999) / 1000);
for (mask = 0x80; mask; mask >>= 1) { for (mask = 0x80; mask; mask >>= 1) {
/* Output current bit; note that we cannot touch s->state /* Output current bit; note that we cannot touch s->state
@ -3973,23 +3970,23 @@ static int ni_serial_sw_readwrite8(struct comedi_device *dev, struct comedi_subd
devpriv->stc_writew(dev, devpriv->dio_control, devpriv->stc_writew(dev, devpriv->dio_control,
DIO_Control_Register); DIO_Control_Register);
comedi_udelay((devpriv->serial_interval_ns + 999) / 2000); udelay((devpriv->serial_interval_ns + 999) / 2000);
devpriv->dio_control &= ~DIO_Software_Serial_Control; devpriv->dio_control &= ~DIO_Software_Serial_Control;
devpriv->stc_writew(dev, devpriv->dio_control, devpriv->stc_writew(dev, devpriv->dio_control,
DIO_Control_Register); DIO_Control_Register);
comedi_udelay((devpriv->serial_interval_ns + 999) / 2000); udelay((devpriv->serial_interval_ns + 999) / 2000);
/* Input current bit */ /* Input current bit */
if (devpriv->stc_readw(dev, if (devpriv->stc_readw(dev,
DIO_Parallel_Input_Register) & DIO_SDIN) { DIO_Parallel_Input_Register) & DIO_SDIN) {
/* rt_printk("DIO_P_I_R: 0x%x\n", devpriv->stc_readw(dev, DIO_Parallel_Input_Register)); */ /* printk("DIO_P_I_R: 0x%x\n", devpriv->stc_readw(dev, DIO_Parallel_Input_Register)); */
input |= mask; input |= mask;
} }
} }
#ifdef DEBUG_DIO #ifdef DEBUG_DIO
rt_printk("ni_serial_sw_readwrite8: inputted 0x%x\n", input); printk("ni_serial_sw_readwrite8: inputted 0x%x\n", input);
#endif #endif
if (data_in) if (data_in)
*data_in = input; *data_in = input;
@ -4103,7 +4100,7 @@ static unsigned ni_gpct_to_stc_register(enum ni_gpct_register reg)
stc_register = Interrupt_B_Enable_Register; stc_register = Interrupt_B_Enable_Register;
break; break;
default: default:
rt_printk("%s: unhandled register 0x%x in switch.\n", printk("%s: unhandled register 0x%x in switch.\n",
__func__, reg); __func__, reg);
BUG(); BUG();
return 0; return 0;
@ -4928,12 +4925,12 @@ static void ni_write_caldac(struct comedi_device *dev, int addr, int val)
for (bit = 1 << (bits - 1); bit; bit >>= 1) { for (bit = 1 << (bits - 1); bit; bit >>= 1) {
ni_writeb(((bit & bitstring) ? 0x02 : 0), Serial_Command); ni_writeb(((bit & bitstring) ? 0x02 : 0), Serial_Command);
comedi_udelay(1); udelay(1);
ni_writeb(1 | ((bit & bitstring) ? 0x02 : 0), Serial_Command); ni_writeb(1 | ((bit & bitstring) ? 0x02 : 0), Serial_Command);
comedi_udelay(1); udelay(1);
} }
ni_writeb(loadbit, Serial_Command); ni_writeb(loadbit, Serial_Command);
comedi_udelay(1); udelay(1);
ni_writeb(0, Serial_Command); ni_writeb(0, Serial_Command);
} }
@ -5229,7 +5226,7 @@ static unsigned ni_old_get_pfi_routing(struct comedi_device *dev, unsigned chan)
return NI_PFI_OUTPUT_G_GATE0; return NI_PFI_OUTPUT_G_GATE0;
break; break;
default: default:
rt_printk("%s: bug, unhandled case in switch.\n", __func__); printk("%s: bug, unhandled case in switch.\n", __func__);
break; break;
} }
return 0; return 0;
@ -5323,7 +5320,7 @@ static void ni_rtsi_init(struct comedi_device *dev)
/* Set clock mode to internal */ /* Set clock mode to internal */
devpriv->clock_and_fout2 = MSeries_RTSI_10MHz_Bit; devpriv->clock_and_fout2 = MSeries_RTSI_10MHz_Bit;
if (ni_set_master_clock(dev, NI_MIO_INTERNAL_CLOCK, 0) < 0) { if (ni_set_master_clock(dev, NI_MIO_INTERNAL_CLOCK, 0) < 0) {
rt_printk("ni_set_master_clock failed, bug?"); 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 = devpriv->rtsi_trig_a_output_reg =
@ -5395,7 +5392,7 @@ static int ni_mseries_get_pll_parameters(unsigned reference_period_ns,
} }
} }
if (best_period_picosec == 0) { if (best_period_picosec == 0) {
rt_printk("%s: bug, failed to find pll parameters\n", printk("%s: bug, failed to find pll parameters\n",
__func__); __func__);
return -EIO; return -EIO;
} }
@ -5430,7 +5427,7 @@ static int ni_mseries_set_pll_master_clock(struct comedi_device *dev, unsigned s
period_ns = 100; 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) { if (period_ns < min_period_ns || period_ns > max_period_ns) {
rt_printk printk
("%s: you must specify an input clock frequency between %i and %i nanosec " ("%s: you must specify an input clock frequency between %i and %i nanosec "
"for the phased-lock loop.\n", __func__, "for the phased-lock loop.\n", __func__,
min_period_ns, max_period_ns); min_period_ns, max_period_ns);
@ -5491,9 +5488,9 @@ static int ni_mseries_set_pll_master_clock(struct comedi_device *dev, unsigned s
MSeries_PLL_Divisor_Bits(freq_divider) | MSeries_PLL_Divisor_Bits(freq_divider) |
MSeries_PLL_Multiplier_Bits(freq_multiplier); MSeries_PLL_Multiplier_Bits(freq_multiplier);
/* rt_printk("using divider=%i, multiplier=%i for PLL. pll_control_bits = 0x%x\n", /* printk("using divider=%i, multiplier=%i for PLL. pll_control_bits = 0x%x\n",
* freq_divider, freq_multiplier, pll_control_bits); */ * freq_divider, freq_multiplier, pll_control_bits); */
/* rt_printk("clock_ns=%d\n", devpriv->clock_ns); */ /* printk("clock_ns=%d\n", devpriv->clock_ns); */
ni_writew(pll_control_bits, M_Offset_PLL_Control); ni_writew(pll_control_bits, M_Offset_PLL_Control);
devpriv->clock_source = source; devpriv->clock_source = source;
/* it seems to typically take a few hundred microseconds for PLL to lock */ /* it seems to typically take a few hundred microseconds for PLL to lock */
@ -5504,7 +5501,7 @@ static int ni_mseries_set_pll_master_clock(struct comedi_device *dev, unsigned s
udelay(1); udelay(1);
} }
if (i == timeout) { if (i == timeout) {
rt_printk printk
("%s: timed out waiting for PLL to lock to reference clock source %i with period %i ns.\n", ("%s: timed out waiting for PLL to lock to reference clock source %i with period %i ns.\n",
__func__, source, period_ns); __func__, source, period_ns);
return -ETIMEDOUT; return -ETIMEDOUT;
@ -5541,7 +5538,7 @@ static int ni_set_master_clock(struct comedi_device *dev, unsigned source,
devpriv->rtsi_trig_direction_reg, devpriv->rtsi_trig_direction_reg,
RTSI_Trig_Direction_Register); RTSI_Trig_Direction_Register);
if (period_ns == 0) { if (period_ns == 0) {
rt_printk printk
("%s: we don't handle an unspecified clock period correctly yet, returning error.\n", ("%s: we don't handle an unspecified clock period correctly yet, returning error.\n",
__func__); __func__);
return -EINVAL; return -EINVAL;
@ -5564,7 +5561,7 @@ static int ni_valid_rtsi_output_source(struct comedi_device *dev, unsigned chan,
if (source == NI_RTSI_OUTPUT_RTSI_OSC) if (source == NI_RTSI_OUTPUT_RTSI_OSC)
return 1; return 1;
else { else {
rt_printk printk
("%s: invalid source for channel=%i, channel %i is always the RTSI clock for pre-m-series boards.\n", ("%s: invalid source for channel=%i, channel %i is always the RTSI clock for pre-m-series boards.\n",
__func__, chan, __func__, chan,
old_RTSI_clock_channel); old_RTSI_clock_channel);
@ -5629,7 +5626,7 @@ static unsigned ni_get_rtsi_routing(struct comedi_device *dev, unsigned chan)
} else { } else {
if (chan == old_RTSI_clock_channel) if (chan == old_RTSI_clock_channel)
return NI_RTSI_OUTPUT_RTSI_OSC; return NI_RTSI_OUTPUT_RTSI_OSC;
rt_printk("%s: bug! should never get here?\n", __func__); printk("%s: bug! should never get here?\n", __func__);
return 0; return 0;
} }
} }
@ -5724,7 +5721,7 @@ static int cs5529_wait_for_idle(struct comedi_device *dev)
} }
/* printk("looped %i times waiting for idle\n", i); */ /* printk("looped %i times waiting for idle\n", i); */
if (i == timeout) { if (i == timeout) {
rt_printk("%s: %s: timeout\n", __FILE__, __func__); printk("%s: %s: timeout\n", __FILE__, __func__);
return -ETIME; return -ETIME;
} }
return 0; return 0;
@ -5743,7 +5740,7 @@ static void cs5529_command(struct comedi_device *dev, unsigned short value)
for (i = 0; i < timeout; i++) { for (i = 0; i < timeout; i++) {
if ((ni_ao_win_inw(dev, CAL_ADC_Status_67xx) & CSS_ADC_BUSY)) if ((ni_ao_win_inw(dev, CAL_ADC_Status_67xx) & CSS_ADC_BUSY))
break; break;
comedi_udelay(1); 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) { if (i == timeout) {
@ -5797,12 +5794,12 @@ static int cs5529_do_conversion(struct comedi_device *dev, unsigned short *data)
} }
status = ni_ao_win_inw(dev, CAL_ADC_Status_67xx); status = ni_ao_win_inw(dev, CAL_ADC_Status_67xx);
if (status & CSS_OSC_DETECT) { if (status & CSS_OSC_DETECT) {
rt_printk printk
("ni_mio_common: cs5529 conversion error, status CSS_OSC_DETECT\n"); ("ni_mio_common: cs5529 conversion error, status CSS_OSC_DETECT\n");
return -EIO; return -EIO;
} }
if (status & CSS_OVERRANGE) { if (status & CSS_OVERRANGE) {
rt_printk printk
("ni_mio_common: cs5529 conversion error, overrange (ignoring)\n"); ("ni_mio_common: cs5529 conversion error, overrange (ignoring)\n");
} }
if (data) { if (data) {
@ -5859,11 +5856,11 @@ static int init_cs5529(struct comedi_device *dev)
comedi_error(dev, "timeout or signal in init_cs5529()\n"); comedi_error(dev, "timeout or signal in init_cs5529()\n");
#endif #endif
#ifdef NI_CS5529_DEBUG #ifdef NI_CS5529_DEBUG
rt_printk("config: 0x%x\n", cs5529_config_read(dev, printk("config: 0x%x\n", cs5529_config_read(dev,
CSCMD_CONFIG_REGISTER)); CSCMD_CONFIG_REGISTER));
rt_printk("gain: 0x%x\n", cs5529_config_read(dev, printk("gain: 0x%x\n", cs5529_config_read(dev,
CSCMD_GAIN_REGISTER)); CSCMD_GAIN_REGISTER));
rt_printk("offset: 0x%x\n", cs5529_config_read(dev, printk("offset: 0x%x\n", cs5529_config_read(dev,
CSCMD_OFFSET_REGISTER)); CSCMD_OFFSET_REGISTER));
#endif #endif
return 0; return 0;

View File

@ -200,14 +200,14 @@ static void mio_cs_win_out(struct comedi_device *dev, uint16_t data, int addr)
{ {
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&devpriv->window_lock, flags); spin_lock_irqsave(&devpriv->window_lock, flags);
if (addr < 8) { if (addr < 8) {
ni_writew(data, addr * 2); ni_writew(data, addr * 2);
} else { } else {
ni_writew(addr, Window_Address); ni_writew(addr, Window_Address);
ni_writew(data, Window_Data); ni_writew(data, Window_Data);
} }
comedi_spin_unlock_irqrestore(&devpriv->window_lock, flags); spin_unlock_irqrestore(&devpriv->window_lock, flags);
} }
static uint16_t mio_cs_win_in(struct comedi_device *dev, int addr) static uint16_t mio_cs_win_in(struct comedi_device *dev, int addr)
@ -215,14 +215,14 @@ static uint16_t mio_cs_win_in(struct comedi_device *dev, int addr)
unsigned long flags; unsigned long flags;
uint16_t ret; uint16_t ret;
comedi_spin_lock_irqsave(&devpriv->window_lock, flags); spin_lock_irqsave(&devpriv->window_lock, flags);
if (addr < 8) { if (addr < 8) {
ret = ni_readw(addr * 2); ret = ni_readw(addr * 2);
} else { } else {
ni_writew(addr, Window_Address); ni_writew(addr, Window_Address);
ret = ni_readw(Window_Data); ret = ni_readw(Window_Data);
} }
comedi_spin_unlock_irqrestore(&devpriv->window_lock, flags); spin_unlock_irqrestore(&devpriv->window_lock, flags);
return ret; return ret;
} }
@ -249,7 +249,7 @@ static int mio_cs_detach(struct comedi_device *dev)
/* PCMCIA layer frees the IO region */ /* PCMCIA layer frees the IO region */
if (dev->irq) { if (dev->irq) {
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
} }
return 0; return 0;
@ -446,7 +446,7 @@ static int mio_cs_attach(struct comedi_device *dev, struct comedi_devconfig *it)
printk(" %s", boardtype.name); printk(" %s", boardtype.name);
dev->board_name = boardtype.name; dev->board_name = boardtype.name;
ret = comedi_request_irq(irq, ni_E_interrupt, NI_E_IRQ_FLAGS, ret = request_irq(irq, ni_E_interrupt, NI_E_IRQ_FLAGS,
"ni_mio_cs", dev); "ni_mio_cs", dev);
if (ret < 0) { if (ret < 0) {
printk(" irq not available\n"); printk(" irq not available\n");

View File

@ -422,14 +422,13 @@ static int ni_pcidio_request_di_mite_channel(struct comedi_device *dev)
{ {
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&devpriv->mite_channel_lock, flags); spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
BUG_ON(devpriv->di_mite_chan); BUG_ON(devpriv->di_mite_chan);
devpriv->di_mite_chan = devpriv->di_mite_chan =
mite_request_channel_in_range(devpriv->mite, mite_request_channel_in_range(devpriv->mite,
devpriv->di_mite_ring, 1, 2); devpriv->di_mite_ring, 1, 2);
if (devpriv->di_mite_chan == NULL) { if (devpriv->di_mite_chan == NULL) {
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
flags);
comedi_error(dev, "failed to reserve mite dma channel."); comedi_error(dev, "failed to reserve mite dma channel.");
return -EBUSY; return -EBUSY;
} }
@ -437,7 +436,7 @@ static int ni_pcidio_request_di_mite_channel(struct comedi_device *dev)
secondary_DMAChannel_bits(devpriv->di_mite_chan->channel), secondary_DMAChannel_bits(devpriv->di_mite_chan->channel),
devpriv->mite->daq_io_addr + DMA_Line_Control_Group1); devpriv->mite->daq_io_addr + DMA_Line_Control_Group1);
mmiowb(); mmiowb();
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
return 0; return 0;
} }
@ -445,7 +444,7 @@ static void ni_pcidio_release_di_mite_channel(struct comedi_device *dev)
{ {
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&devpriv->mite_channel_lock, flags); spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
if (devpriv->di_mite_chan) { if (devpriv->di_mite_chan) {
mite_dma_disarm(devpriv->di_mite_chan); mite_dma_disarm(devpriv->di_mite_chan);
mite_dma_reset(devpriv->di_mite_chan); mite_dma_reset(devpriv->di_mite_chan);
@ -456,7 +455,7 @@ static void ni_pcidio_release_di_mite_channel(struct comedi_device *dev)
devpriv->mite->daq_io_addr + DMA_Line_Control_Group1); devpriv->mite->daq_io_addr + DMA_Line_Control_Group1);
mmiowb(); mmiowb();
} }
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
} }
static int nidio96_8255_cb(int dir, int port, int data, unsigned long iobase) static int nidio96_8255_cb(int dir, int port, int data, unsigned long iobase)
@ -514,7 +513,7 @@ static irqreturn_t nidio_interrupt(int irq, void *d)
/* printk("buf[0]=%08x\n",*(unsigned int *)async->prealloc_buf); */ /* printk("buf[0]=%08x\n",*(unsigned int *)async->prealloc_buf); */
/* printk("buf[4096]=%08x\n",*(unsigned int *)(async->prealloc_buf+4096)); */ /* printk("buf[4096]=%08x\n",*(unsigned int *)(async->prealloc_buf+4096)); */
comedi_spin_lock_irqsave(&devpriv->mite_channel_lock, irq_flags); spin_lock_irqsave(&devpriv->mite_channel_lock, irq_flags);
if (devpriv->di_mite_chan) if (devpriv->di_mite_chan)
m_status = mite_get_status(devpriv->di_mite_chan); m_status = mite_get_status(devpriv->di_mite_chan);
#ifdef MITE_DEBUG #ifdef MITE_DEBUG
@ -537,7 +536,7 @@ static irqreturn_t nidio_interrupt(int irq, void *d)
disable_irq(dev->irq); disable_irq(dev->irq);
} }
} }
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, irq_flags); spin_unlock_irqrestore(&devpriv->mite_channel_lock, irq_flags);
while (status & DataLeft) { while (status & DataLeft) {
work++; work++;
@ -1235,8 +1234,8 @@ static int nidio_attach(struct comedi_device * dev, struct comedi_devconfig * it
devpriv->mite->daq_io_addr + devpriv->mite->daq_io_addr +
Master_DMA_And_Interrupt_Control); Master_DMA_And_Interrupt_Control);
ret = comedi_request_irq(irq, nidio_interrupt, IRQF_SHARED, ret = request_irq(irq, nidio_interrupt, IRQF_SHARED,
"ni_pcidio", dev); "ni_pcidio", dev);
if (ret < 0) { if (ret < 0) {
printk(" irq not available"); printk(" irq not available");
} }
@ -1259,7 +1258,7 @@ static int nidio_detach(struct comedi_device * dev)
} }
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (devpriv) { if (devpriv) {
if (devpriv->di_mite_ring) { if (devpriv->di_mite_ring) {

View File

@ -101,7 +101,7 @@ SCXI is probably broken for m-series boards.
need to slow down DAC loading. I don't trust NI's claim that need to slow down DAC loading. I don't trust NI's claim that
two writes to the PCI bus slows IO enough. I would prefer to two writes to the PCI bus slows IO enough. I would prefer to
use comedi_udelay(). Timing specs: (clock) use udelay(). Timing specs: (clock)
AD8522 30ns AD8522 30ns
DAC8043 120ns DAC8043 120ns
DAC8800 60ns DAC8800 60ns
@ -1246,10 +1246,10 @@ static void e_series_win_out(struct comedi_device *dev, uint16_t data, int reg)
{ {
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&devpriv->window_lock, flags); spin_lock_irqsave(&devpriv->window_lock, flags);
ni_writew(reg, Window_Address); ni_writew(reg, Window_Address);
ni_writew(data, Window_Data); ni_writew(data, Window_Data);
comedi_spin_unlock_irqrestore(&devpriv->window_lock, flags); spin_unlock_irqrestore(&devpriv->window_lock, flags);
} }
static uint16_t e_series_win_in(struct comedi_device *dev, int reg) static uint16_t e_series_win_in(struct comedi_device *dev, int reg)
@ -1257,10 +1257,10 @@ static uint16_t e_series_win_in(struct comedi_device *dev, int reg)
unsigned long flags; unsigned long flags;
uint16_t ret; uint16_t ret;
comedi_spin_lock_irqsave(&devpriv->window_lock, flags); spin_lock_irqsave(&devpriv->window_lock, flags);
ni_writew(reg, Window_Address); ni_writew(reg, Window_Address);
ret = ni_readw(Window_Data); ret = ni_readw(Window_Data);
comedi_spin_unlock_irqrestore(&devpriv->window_lock, flags); spin_unlock_irqrestore(&devpriv->window_lock, flags);
return ret; return ret;
} }
@ -1349,7 +1349,7 @@ static void m_series_stc_writew(struct comedi_device *dev, uint16_t data, int re
offset = M_Offset_AO_FIFO_Clear; offset = M_Offset_AO_FIFO_Clear;
break; break;
case DIO_Control_Register: case DIO_Control_Register:
rt_printk printk
("%s: FIXME: register 0x%x does not map cleanly on to m-series boards.\n", ("%s: FIXME: register 0x%x does not map cleanly on to m-series boards.\n",
__func__, reg); __func__, reg);
return; return;
@ -1411,7 +1411,7 @@ static void m_series_stc_writew(struct comedi_device *dev, uint16_t data, int re
/* FIXME: DIO_Output_Register (16 bit reg) is replaced by M_Offset_Static_Digital_Output (32 bit) /* FIXME: DIO_Output_Register (16 bit reg) is replaced by M_Offset_Static_Digital_Output (32 bit)
and M_Offset_SCXI_Serial_Data_Out (8 bit) */ and M_Offset_SCXI_Serial_Data_Out (8 bit) */
default: default:
rt_printk("%s: bug! unhandled register=0x%x in switch.\n", printk("%s: bug! unhandled register=0x%x in switch.\n",
__func__, reg); __func__, reg);
BUG(); BUG();
return; return;
@ -1446,7 +1446,7 @@ static uint16_t m_series_stc_readw(struct comedi_device *dev, int reg)
offset = M_Offset_G01_Status; offset = M_Offset_G01_Status;
break; break;
default: default:
rt_printk("%s: bug! unhandled register=0x%x in switch.\n", printk("%s: bug! unhandled register=0x%x in switch.\n",
__func__, reg); __func__, reg);
BUG(); BUG();
return 0; return 0;
@ -1487,7 +1487,7 @@ static void m_series_stc_writel(struct comedi_device *dev, uint32_t data, int re
offset = M_Offset_G1_Load_B; offset = M_Offset_G1_Load_B;
break; break;
default: default:
rt_printk("%s: bug! unhandled register=0x%x in switch.\n", printk("%s: bug! unhandled register=0x%x in switch.\n",
__func__, reg); __func__, reg);
BUG(); BUG();
return; return;
@ -1513,7 +1513,7 @@ static uint32_t m_series_stc_readl(struct comedi_device *dev, int reg)
offset = M_Offset_G1_Save; offset = M_Offset_G1_Save;
break; break;
default: default:
rt_printk("%s: bug! unhandled register=0x%x in switch.\n", printk("%s: bug! unhandled register=0x%x in switch.\n",
__func__, reg); __func__, reg);
BUG(); BUG();
return 0; return 0;
@ -1602,7 +1602,7 @@ static int pcimio_detach(struct comedi_device *dev)
{ {
mio_common_detach(dev); mio_common_detach(dev);
if (dev->irq) { if (dev->irq) {
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
} }
if (dev->private) { if (dev->private) {
mite_free_ring(devpriv->ai_mite_ring); mite_free_ring(devpriv->ai_mite_ring);
@ -1679,9 +1679,8 @@ static int pcimio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
printk(" unknown irq (bad)\n"); printk(" unknown irq (bad)\n");
} else { } else {
printk(" ( irq = %u )", dev->irq); printk(" ( irq = %u )", dev->irq);
ret = comedi_request_irq(dev->irq, ni_E_interrupt, ret = request_irq(dev->irq, ni_E_interrupt, NI_E_IRQ_FLAGS,
NI_E_IRQ_FLAGS, DRV_NAME, DRV_NAME, dev);
dev);
if (ret < 0) { if (ret < 0) {
printk(" irq not available\n"); printk(" irq not available\n");
dev->irq = 0; dev->irq = 0;

View File

@ -339,7 +339,7 @@ static inline unsigned RTSI_Output_Bit(unsigned channel, int is_mseries)
max_channel = 6; max_channel = 6;
} }
if (channel > max_channel) { if (channel > max_channel) {
rt_printk("%s: bug, invalid RTSI_channel=%i\n", __func__, printk("%s: bug, invalid RTSI_channel=%i\n", __func__,
channel); channel);
return 0; return 0;
} }
@ -1085,7 +1085,7 @@ static inline int M_Offset_Static_AI_Control(int i)
0x263, 0x263,
}; };
if (((unsigned)i) >= ARRAY_SIZE(offset)) { if (((unsigned)i) >= ARRAY_SIZE(offset)) {
rt_printk("%s: invalid channel=%i\n", __func__, i); printk("%s: invalid channel=%i\n", __func__, i);
return offset[0]; return offset[0];
} }
return offset[i]; return offset[i];
@ -1099,7 +1099,7 @@ static inline int M_Offset_AO_Reference_Attenuation(int channel)
0x267 0x267
}; };
if (((unsigned)channel) >= ARRAY_SIZE(offset)) { if (((unsigned)channel) >= ARRAY_SIZE(offset)) {
rt_printk("%s: invalid channel=%i\n", __func__, channel); printk("%s: invalid channel=%i\n", __func__, channel);
return offset[0]; return offset[0];
} }
return offset[channel]; return offset[channel];
@ -1107,7 +1107,7 @@ static inline int M_Offset_AO_Reference_Attenuation(int channel)
static inline unsigned M_Offset_PFI_Output_Select(unsigned n) static inline unsigned M_Offset_PFI_Output_Select(unsigned n)
{ {
if (n < 1 || n > NUM_PFI_OUTPUT_SELECT_REGS) { if (n < 1 || n > NUM_PFI_OUTPUT_SELECT_REGS) {
rt_printk("%s: invalid pfi output select register=%i\n", printk("%s: invalid pfi output select register=%i\n",
__func__, n); __func__, n);
return M_Offset_PFI_Output_Select_1; return M_Offset_PFI_Output_Select_1;
} }
@ -1162,7 +1162,7 @@ static inline unsigned MSeries_PLL_In_Source_Select_RTSI_Bits(unsigned
RTSI_channel) RTSI_channel)
{ {
if (RTSI_channel > 7) { if (RTSI_channel > 7) {
rt_printk("%s: bug, invalid RTSI_channel=%i\n", __func__, printk("%s: bug, invalid RTSI_channel=%i\n", __func__,
RTSI_channel); RTSI_channel);
return 0; return 0;
} }
@ -1183,7 +1183,7 @@ static inline unsigned MSeries_PLL_Divisor_Bits(unsigned divisor)
{ {
static const unsigned max_divisor = 0x10; static const unsigned max_divisor = 0x10;
if (divisor < 1 || divisor > max_divisor) { if (divisor < 1 || divisor > max_divisor) {
rt_printk("%s: bug, invalid divisor=%i\n", __func__, printk("%s: bug, invalid divisor=%i\n", __func__,
divisor); divisor);
return 0; return 0;
} }
@ -1193,7 +1193,7 @@ static inline unsigned MSeries_PLL_Multiplier_Bits(unsigned multiplier)
{ {
static const unsigned max_multiplier = 0x100; static const unsigned max_multiplier = 0x100;
if (multiplier < 1 || multiplier > max_multiplier) { if (multiplier < 1 || multiplier > max_multiplier) {
rt_printk("%s: bug, invalid multiplier=%i\n", __func__, printk("%s: bug, invalid multiplier=%i\n", __func__,
multiplier); multiplier);
return 0; return 0;
} }

View File

@ -669,7 +669,7 @@ static unsigned ni_m_series_source_select_bits(unsigned int clock_source)
} }
if (i <= ni_m_series_max_pfi_channel) if (i <= ni_m_series_max_pfi_channel)
break; break;
rt_printk("invalid clock source 0x%lx\n", printk("invalid clock source 0x%lx\n",
(unsigned long)clock_source); (unsigned long)clock_source);
BUG(); BUG();
ni_m_series_clock = 0; ni_m_series_clock = 0;
@ -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] &= ~mask;
counter_dev->regs[abz_reg] |= (source << shift) & mask; counter_dev->regs[abz_reg] |= (source << shift) & mask;
write_register(counter, counter_dev->regs[abz_reg], abz_reg); write_register(counter, counter_dev->regs[abz_reg], abz_reg);
/* rt_printk("%s %x %d %d\n", __func__, counter_dev->regs[abz_reg], index, source); */ /* printk("%s %x %d %d\n", __func__, counter_dev->regs[abz_reg], index, source); */
return 0; return 0;
} }
return -EINVAL; return -EINVAL;

View File

@ -728,14 +728,14 @@ static inline void ni_tio_set_bits_transient(struct ni_gpct *counter,
unsigned long flags; unsigned long flags;
BUG_ON(register_index >= NITIO_Num_Registers); BUG_ON(register_index >= NITIO_Num_Registers);
comedi_spin_lock_irqsave(&counter_dev->regs_lock, flags); spin_lock_irqsave(&counter_dev->regs_lock, flags);
counter_dev->regs[register_index] &= ~bit_mask; counter_dev->regs[register_index] &= ~bit_mask;
counter_dev->regs[register_index] |= (bit_values & bit_mask); counter_dev->regs[register_index] |= (bit_values & bit_mask);
write_register(counter, write_register(counter,
counter_dev->regs[register_index] | transient_bit_values, counter_dev->regs[register_index] | transient_bit_values,
register_index); register_index);
mmiowb(); mmiowb();
comedi_spin_unlock_irqrestore(&counter_dev->regs_lock, flags); spin_unlock_irqrestore(&counter_dev->regs_lock, flags);
} }
/* ni_tio_set_bits( ) is for safely writing to registers whose bits may be /* ni_tio_set_bits( ) is for safely writing to registers whose bits may be
@ -761,9 +761,9 @@ static inline unsigned ni_tio_get_soft_copy(const struct ni_gpct *counter,
unsigned value; unsigned value;
BUG_ON(register_index >= NITIO_Num_Registers); BUG_ON(register_index >= NITIO_Num_Registers);
comedi_spin_lock_irqsave(&counter_dev->regs_lock, flags); spin_lock_irqsave(&counter_dev->regs_lock, flags);
value = counter_dev->regs[register_index]; value = counter_dev->regs[register_index];
comedi_spin_unlock_irqrestore(&counter_dev->regs_lock, flags); spin_unlock_irqrestore(&counter_dev->regs_lock, flags);
return value; return value;
} }

View File

@ -107,12 +107,12 @@ static int ni_tio_input_inttrig(struct comedi_device *dev, struct comedi_subdevi
if (trignum != 0) if (trignum != 0)
return -EINVAL; return -EINVAL;
comedi_spin_lock_irqsave(&counter->lock, flags); spin_lock_irqsave(&counter->lock, flags);
if (counter->mite_chan) if (counter->mite_chan)
mite_dma_arm(counter->mite_chan); mite_dma_arm(counter->mite_chan);
else else
retval = -EIO; retval = -EIO;
comedi_spin_unlock_irqrestore(&counter->lock, flags); spin_unlock_irqrestore(&counter->lock, flags);
if (retval < 0) if (retval < 0)
return retval; return retval;
retval = ni_tio_arm(counter, 1, NI_GPCT_ARM_IMMEDIATE); retval = ni_tio_arm(counter, 1, NI_GPCT_ARM_IMMEDIATE);
@ -171,7 +171,7 @@ static int ni_tio_input_cmd(struct ni_gpct *counter, struct comedi_async *async)
static int ni_tio_output_cmd(struct ni_gpct *counter, struct comedi_async *async) static int ni_tio_output_cmd(struct ni_gpct *counter, struct comedi_async *async)
{ {
rt_printk("ni_tio: output commands not yet implemented.\n"); printk("ni_tio: output commands not yet implemented.\n");
return -ENOTSUPP; return -ENOTSUPP;
counter->mite_chan->dir = COMEDI_OUTPUT; counter->mite_chan->dir = COMEDI_OUTPUT;
@ -213,9 +213,9 @@ int ni_tio_cmd(struct ni_gpct *counter, struct comedi_async *async)
int retval = 0; int retval = 0;
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&counter->lock, flags); spin_lock_irqsave(&counter->lock, flags);
if (counter->mite_chan == NULL) { if (counter->mite_chan == NULL) {
rt_printk printk
("ni_tio: commands only supported with DMA. Interrupt-driven commands not yet implemented.\n"); ("ni_tio: commands only supported with DMA. Interrupt-driven commands not yet implemented.\n");
retval = -EIO; retval = -EIO;
} else { } else {
@ -228,7 +228,7 @@ int ni_tio_cmd(struct ni_gpct *counter, struct comedi_async *async)
} }
} }
} }
comedi_spin_unlock_irqrestore(&counter->lock, flags); spin_unlock_irqrestore(&counter->lock, flags);
return retval; return retval;
} }
@ -342,11 +342,11 @@ int ni_tio_cancel(struct ni_gpct *counter)
unsigned long flags; unsigned long flags;
ni_tio_arm(counter, 0, 0); ni_tio_arm(counter, 0, 0);
comedi_spin_lock_irqsave(&counter->lock, flags); spin_lock_irqsave(&counter->lock, flags);
if (counter->mite_chan) { if (counter->mite_chan) {
mite_dma_disarm(counter->mite_chan); mite_dma_disarm(counter->mite_chan);
} }
comedi_spin_unlock_irqrestore(&counter->lock, flags); spin_unlock_irqrestore(&counter->lock, flags);
ni_tio_configure_dma(counter, 0, 0); ni_tio_configure_dma(counter, 0, 0);
ni_tio_set_bits(counter, ni_tio_set_bits(counter,
@ -369,7 +369,7 @@ static int should_ack_gate(struct ni_gpct *counter)
return 1; return 1;
break; break;
case ni_gpct_variant_e_series: case ni_gpct_variant_e_series:
comedi_spin_lock_irqsave(&counter->lock, flags); spin_lock_irqsave(&counter->lock, flags);
{ {
if (counter->mite_chan == NULL || if (counter->mite_chan == NULL ||
counter->mite_chan->dir != COMEDI_INPUT || counter->mite_chan->dir != COMEDI_INPUT ||
@ -377,7 +377,7 @@ static int should_ack_gate(struct ni_gpct *counter)
retval = 1; retval = 1;
} }
} }
comedi_spin_unlock_irqrestore(&counter->lock, flags); spin_unlock_irqrestore(&counter->lock, flags);
break; break;
} }
return retval; return retval;
@ -439,7 +439,7 @@ void ni_tio_acknowledge_and_confirm(struct ni_gpct *counter, int *gate_error,
NITIO_Gxx_Joint_Status2_Reg(counter-> NITIO_Gxx_Joint_Status2_Reg(counter->
counter_index)) & counter_index)) &
Gi_Permanent_Stale_Bit(counter->counter_index)) { Gi_Permanent_Stale_Bit(counter->counter_index)) {
rt_printk("%s: Gi_Permanent_Stale_Data detected.\n", printk("%s: Gi_Permanent_Stale_Data detected.\n",
__FUNCTION__); __FUNCTION__);
if (perm_stale_data) if (perm_stale_data)
*perm_stale_data = 1; *perm_stale_data = 1;
@ -458,7 +458,7 @@ void ni_tio_handle_interrupt(struct ni_gpct *counter, struct comedi_subdevice *
ni_tio_acknowledge_and_confirm(counter, &gate_error, &tc_error, ni_tio_acknowledge_and_confirm(counter, &gate_error, &tc_error,
&perm_stale_data, NULL); &perm_stale_data, NULL);
if (gate_error) { if (gate_error) {
rt_printk("%s: Gi_Gate_Error detected.\n", __FUNCTION__); printk("%s: Gi_Gate_Error detected.\n", __FUNCTION__);
s->async->events |= COMEDI_CB_OVERFLOW; s->async->events |= COMEDI_CB_OVERFLOW;
} }
if (perm_stale_data) { if (perm_stale_data) {
@ -470,16 +470,16 @@ void ni_tio_handle_interrupt(struct ni_gpct *counter, struct comedi_subdevice *
if (read_register(counter, if (read_register(counter,
NITIO_Gi_DMA_Status_Reg(counter-> NITIO_Gi_DMA_Status_Reg(counter->
counter_index)) & Gi_DRQ_Error_Bit) { counter_index)) & Gi_DRQ_Error_Bit) {
rt_printk("%s: Gi_DRQ_Error detected.\n", __FUNCTION__); printk("%s: Gi_DRQ_Error detected.\n", __FUNCTION__);
s->async->events |= COMEDI_CB_OVERFLOW; s->async->events |= COMEDI_CB_OVERFLOW;
} }
break; break;
case ni_gpct_variant_e_series: case ni_gpct_variant_e_series:
break; break;
} }
comedi_spin_lock_irqsave(&counter->lock, flags); spin_lock_irqsave(&counter->lock, flags);
if (counter->mite_chan == NULL) { if (counter->mite_chan == NULL) {
comedi_spin_unlock_irqrestore(&counter->lock, flags); spin_unlock_irqrestore(&counter->lock, flags);
return; return;
} }
gpct_mite_status = mite_get_status(counter->mite_chan); gpct_mite_status = mite_get_status(counter->mite_chan);
@ -489,7 +489,7 @@ void ni_tio_handle_interrupt(struct ni_gpct *counter, struct comedi_subdevice *
MITE_CHOR(counter->mite_chan->channel)); MITE_CHOR(counter->mite_chan->channel));
} }
mite_sync_input_dma(counter->mite_chan, s->async); mite_sync_input_dma(counter->mite_chan, s->async);
comedi_spin_unlock_irqrestore(&counter->lock, flags); spin_unlock_irqrestore(&counter->lock, flags);
} }
void ni_tio_set_mite_channel(struct ni_gpct *counter, void ni_tio_set_mite_channel(struct ni_gpct *counter,
@ -497,9 +497,9 @@ void ni_tio_set_mite_channel(struct ni_gpct *counter,
{ {
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&counter->lock, flags); spin_lock_irqsave(&counter->lock, flags);
counter->mite_chan = mite_chan; counter->mite_chan = mite_chan;
comedi_spin_unlock_irqrestore(&counter->lock, flags); spin_unlock_irqrestore(&counter->lock, flags);
} }
static int __init ni_tiocmd_init_module(void) static int __init ni_tiocmd_init_module(void)

View File

@ -269,9 +269,9 @@ static int pcl711_ai_insn(struct comedi_device *dev, struct comedi_subdevice *s,
hi = inb(dev->iobase + PCL711_AD_HI); hi = inb(dev->iobase + PCL711_AD_HI);
if (!(hi & PCL711_DRDY)) if (!(hi & PCL711_DRDY))
goto ok; goto ok;
comedi_udelay(1); udelay(1);
} }
rt_printk("comedi%d: pcl711: A/D timeout\n", dev->minor); printk("comedi%d: pcl711: A/D timeout\n", dev->minor);
return -ETIME; return -ETIME;
ok: ok:
@ -503,7 +503,7 @@ static int pcl711_detach(struct comedi_device *dev)
printk("comedi%d: pcl711: remove\n", dev->minor); printk("comedi%d: pcl711: remove\n", dev->minor);
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (dev->iobase) if (dev->iobase)
release_region(dev->iobase, PCL711_SIZE); release_region(dev->iobase, PCL711_SIZE);
@ -541,7 +541,7 @@ static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return -EINVAL; return -EINVAL;
} }
if (irq) { if (irq) {
if (comedi_request_irq(irq, pcl711_interrupt, 0, "pcl711", dev)) { if (request_irq(irq, pcl711_interrupt, 0, "pcl711", dev)) {
printk("unable to allocate irq %u\n", irq); printk("unable to allocate irq %u\n", irq);
return -EINVAL; return -EINVAL;
} else { } else {

View File

@ -155,19 +155,18 @@ static int pcl724_attach(struct comedi_device *dev, struct comedi_devconfig *it)
irq = it->options[1]; irq = it->options[1];
if (irq) { /* we want to use IRQ */ if (irq) { /* we want to use IRQ */
if (((1 << irq) & this_board->IRQbits) == 0) { if (((1 << irq) & this_board->IRQbits) == 0) {
rt_printk printk
(", IRQ %u is out of allowed range, DISABLING IT", (", IRQ %u is out of allowed range, DISABLING IT",
irq); irq);
irq = 0; /* Bad IRQ */ irq = 0; /* Bad IRQ */
} else { } else {
if (comedi_request_irq(irq, interrupt_pcl724, 0, if (request_irq(irq, interrupt_pcl724, 0, "pcl724", dev)) {
"pcl724", dev)) { printk
rt_printk
(", unable to allocate IRQ %u, DISABLING IT", (", unable to allocate IRQ %u, DISABLING IT",
irq); irq);
irq = 0; /* Can't use IRQ */ irq = 0; /* Can't use IRQ */
} else { } else {
rt_printk(", irq=%u", irq); printk(", irq=%u", irq);
} }
} }
} }
@ -213,7 +212,7 @@ static int pcl724_detach(struct comedi_device *dev)
#ifdef PCL724_IRQ #ifdef PCL724_IRQ
if (dev->irq) { if (dev->irq) {
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
} }
#endif #endif

View File

@ -280,19 +280,19 @@ static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it)
devpriv->first_chan = 2; devpriv->first_chan = 2;
if (irq) { /* we want to use IRQ */ if (irq) { /* we want to use IRQ */
if (((1 << irq) & boardtypes[board].IRQbits) == 0) { if (((1 << irq) & boardtypes[board].IRQbits) == 0) {
rt_printk printk
(", IRQ %d is out of allowed range, DISABLING IT", (", IRQ %d is out of allowed range, DISABLING IT",
irq); irq);
irq = 0; /* Bad IRQ */ irq = 0; /* Bad IRQ */
} else { } else {
if (comedi_request_irq(irq, interrupt_pcl818, 0, if (request_irq(irq, interrupt_pcl818, 0,
"pcl726", dev)) { "pcl726", dev)) {
rt_printk printk
(", unable to allocate IRQ %d, DISABLING IT", (", unable to allocate IRQ %d, DISABLING IT",
irq); irq);
irq = 0; /* Can't use IRQ */ irq = 0; /* Can't use IRQ */
} else { } else {
rt_printk(", irq=%d", irq); printk(", irq=%d", irq);
} }
} }
} }
@ -368,7 +368,7 @@ static int pcl726_detach(struct comedi_device *dev)
#ifdef ACL6126_IRQ #ifdef ACL6126_IRQ
if (dev->irq) { if (dev->irq) {
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
} }
#endif #endif

View File

@ -447,15 +447,15 @@ static int pcl812_ai_insn_read(struct comedi_device *dev, struct comedi_subdevic
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++) { for (n = 0; n < insn->n; n++) {
outb(255, dev->iobase + PCL812_SOFTTRIG); /* start conversion */ outb(255, dev->iobase + PCL812_SOFTTRIG); /* start conversion */
comedi_udelay(5); udelay(5);
timeout = 50; /* wait max 50us, it must finish under 33us */ timeout = 50; /* wait max 50us, it must finish under 33us */
while (timeout--) { while (timeout--) {
hi = inb(dev->iobase + PCL812_AD_HI); hi = inb(dev->iobase + PCL812_AD_HI);
if (!(hi & PCL812_DRDY)) if (!(hi & PCL812_DRDY))
goto conv_finish; goto conv_finish;
comedi_udelay(1); udelay(1);
} }
rt_printk printk
("comedi%d: pcl812: (%s at 0x%lx) A/D insn read timeout\n", ("comedi%d: pcl812: (%s at 0x%lx) A/D insn read timeout\n",
dev->minor, dev->board_name, dev->iobase); dev->minor, dev->board_name, dev->iobase);
outb(devpriv->mode_reg_int | 0, dev->iobase + PCL812_MODE); outb(devpriv->mode_reg_int | 0, dev->iobase + PCL812_MODE);
@ -481,14 +481,14 @@ static int acl8216_ai_insn_read(struct comedi_device *dev, struct comedi_subdevi
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++) { for (n = 0; n < insn->n; n++) {
outb(255, dev->iobase + PCL812_SOFTTRIG); /* start conversion */ outb(255, dev->iobase + PCL812_SOFTTRIG); /* start conversion */
comedi_udelay(5); udelay(5);
timeout = 50; /* wait max 50us, it must finish under 33us */ timeout = 50; /* wait max 50us, it must finish under 33us */
while (timeout--) { while (timeout--) {
if (!(inb(dev->iobase + ACL8216_STATUS) & ACL8216_DRDY)) if (!(inb(dev->iobase + ACL8216_STATUS) & ACL8216_DRDY))
goto conv_finish; goto conv_finish;
comedi_udelay(1); udelay(1);
} }
rt_printk printk
("comedi%d: pcl812: (%s at 0x%lx) A/D insn read timeout\n", ("comedi%d: pcl812: (%s at 0x%lx) A/D insn read timeout\n",
dev->minor, dev->board_name, dev->iobase); dev->minor, dev->board_name, dev->iobase);
outb(0, dev->iobase + PCL812_MODE); outb(0, dev->iobase + PCL812_MODE);
@ -581,13 +581,13 @@ static int pcl812_do_insn_bits(struct comedi_device *dev, struct comedi_subdevic
*/ */
static void pcl812_cmdtest_out(int e, struct comedi_cmd *cmd) static void pcl812_cmdtest_out(int e, struct comedi_cmd *cmd)
{ {
rt_printk("pcl812 e=%d startsrc=%x scansrc=%x convsrc=%x\n", e, printk("pcl812 e=%d startsrc=%x scansrc=%x convsrc=%x\n", e,
cmd->start_src, cmd->scan_begin_src, cmd->convert_src); cmd->start_src, cmd->scan_begin_src, cmd->convert_src);
rt_printk("pcl812 e=%d startarg=%d scanarg=%d convarg=%d\n", e, printk("pcl812 e=%d startarg=%d scanarg=%d convarg=%d\n", e,
cmd->start_arg, cmd->scan_begin_arg, cmd->convert_arg); cmd->start_arg, cmd->scan_begin_arg, cmd->convert_arg);
rt_printk("pcl812 e=%d stopsrc=%x scanend=%x\n", e, cmd->stop_src, printk("pcl812 e=%d stopsrc=%x scanend=%x\n", e, cmd->stop_src,
cmd->scan_end_src); cmd->scan_end_src);
rt_printk("pcl812 e=%d stoparg=%d scanendarg=%d chanlistlen=%d\n", e, printk("pcl812 e=%d stoparg=%d scanendarg=%d chanlistlen=%d\n", e,
cmd->stop_arg, cmd->scan_end_arg, cmd->chanlist_len); cmd->stop_arg, cmd->scan_end_arg, cmd->chanlist_len);
} }
#endif #endif
@ -602,7 +602,7 @@ static int pcl812_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice
int tmp, divisor1, divisor2; int tmp, divisor1, divisor2;
#ifdef PCL812_EXTDEBUG #ifdef PCL812_EXTDEBUG
rt_printk("pcl812 EDBG: BGN: pcl812_ai_cmdtest(...)\n"); printk("pcl812 EDBG: BGN: pcl812_ai_cmdtest(...)\n");
pcl812_cmdtest_out(-1, cmd); pcl812_cmdtest_out(-1, cmd);
#endif #endif
/* step 1: make sure trigger sources are trivially valid */ /* step 1: make sure trigger sources are trivially valid */
@ -639,7 +639,7 @@ static int pcl812_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice
if (err) { if (err) {
#ifdef PCL812_EXTDEBUG #ifdef PCL812_EXTDEBUG
pcl812_cmdtest_out(1, cmd); pcl812_cmdtest_out(1, cmd);
rt_printk printk
("pcl812 EDBG: BGN: pcl812_ai_cmdtest(...) err=%d ret=1\n", ("pcl812 EDBG: BGN: pcl812_ai_cmdtest(...) err=%d ret=1\n",
err); err);
#endif #endif
@ -681,7 +681,7 @@ static int pcl812_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice
if (err) { if (err) {
#ifdef PCL812_EXTDEBUG #ifdef PCL812_EXTDEBUG
pcl812_cmdtest_out(2, cmd); pcl812_cmdtest_out(2, cmd);
rt_printk printk
("pcl812 EDBG: BGN: pcl812_ai_cmdtest(...) err=%d ret=2\n", ("pcl812 EDBG: BGN: pcl812_ai_cmdtest(...) err=%d ret=2\n",
err); err);
#endif #endif
@ -739,7 +739,7 @@ static int pcl812_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice
if (err) { if (err) {
#ifdef PCL812_EXTDEBUG #ifdef PCL812_EXTDEBUG
pcl812_cmdtest_out(3, cmd); pcl812_cmdtest_out(3, cmd);
rt_printk printk
("pcl812 EDBG: BGN: pcl812_ai_cmdtest(...) err=%d ret=3\n", ("pcl812 EDBG: BGN: pcl812_ai_cmdtest(...) err=%d ret=3\n",
err); err);
#endif #endif
@ -761,7 +761,7 @@ static int pcl812_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice
if (err) { if (err) {
#ifdef PCL812_EXTDEBUG #ifdef PCL812_EXTDEBUG
rt_printk printk
("pcl812 EDBG: BGN: pcl812_ai_cmdtest(...) err=%d ret=4\n", ("pcl812 EDBG: BGN: pcl812_ai_cmdtest(...) err=%d ret=4\n",
err); err);
#endif #endif
@ -780,7 +780,7 @@ static int pcl812_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
struct comedi_cmd *cmd = &s->async->cmd; struct comedi_cmd *cmd = &s->async->cmd;
#ifdef PCL812_EXTDEBUG #ifdef PCL812_EXTDEBUG
rt_printk("pcl812 EDBG: BGN: pcl812_ai_cmd(...)\n"); printk("pcl812 EDBG: BGN: pcl812_ai_cmd(...)\n");
#endif #endif
if (cmd->start_src != TRIG_NOW) if (cmd->start_src != TRIG_NOW)
@ -892,7 +892,7 @@ static int pcl812_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
release_dma_lock(dma_flags); release_dma_lock(dma_flags);
enable_dma(devpriv->dma); enable_dma(devpriv->dma);
#ifdef PCL812_EXTDEBUG #ifdef PCL812_EXTDEBUG
rt_printk printk
("pcl812 EDBG: DMA %d PTR 0x%0x/0x%0x LEN %u/%u EOS %d\n", ("pcl812 EDBG: DMA %d PTR 0x%0x/0x%0x LEN %u/%u EOS %d\n",
devpriv->dma, devpriv->hwdmaptr[0], devpriv->dma, devpriv->hwdmaptr[0],
devpriv->hwdmaptr[1], devpriv->dmabytestomove[0], devpriv->hwdmaptr[1], devpriv->dmabytestomove[0],
@ -913,7 +913,7 @@ static int pcl812_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
} }
#ifdef PCL812_EXTDEBUG #ifdef PCL812_EXTDEBUG
rt_printk("pcl812 EDBG: END: pcl812_ai_cmd(...)\n"); printk("pcl812 EDBG: END: pcl812_ai_cmd(...)\n");
#endif #endif
return 0; return 0;
@ -939,7 +939,7 @@ static irqreturn_t interrupt_pcl812_ai_int(int irq, void *d)
err = 0; err = 0;
break; break;
} }
comedi_udelay(1); udelay(1);
} }
} else { } else {
mask = 0x0fff; mask = 0x0fff;
@ -948,12 +948,12 @@ static irqreturn_t interrupt_pcl812_ai_int(int irq, void *d)
err = 0; err = 0;
break; break;
} }
comedi_udelay(1); udelay(1);
} }
} }
if (err) { if (err) {
rt_printk printk
("comedi%d: pcl812: (%s at 0x%lx) A/D cmd IRQ without DRDY!\n", ("comedi%d: pcl812: (%s at 0x%lx) A/D cmd IRQ without DRDY!\n",
dev->minor, dev->board_name, dev->iobase); dev->minor, dev->board_name, dev->iobase);
pcl812_ai_cancel(dev, s); pcl812_ai_cancel(dev, s);
@ -1019,7 +1019,7 @@ static irqreturn_t interrupt_pcl812_ai_dma(int irq, void *d)
short *ptr; short *ptr;
#ifdef PCL812_EXTDEBUG #ifdef PCL812_EXTDEBUG
rt_printk("pcl812 EDBG: BGN: interrupt_pcl812_ai_dma(...)\n"); printk("pcl812 EDBG: BGN: interrupt_pcl812_ai_dma(...)\n");
#endif #endif
ptr = (short *) devpriv->dmabuf[devpriv->next_dma_buf]; ptr = (short *) devpriv->dmabuf[devpriv->next_dma_buf];
len = (devpriv->dmabytestomove[devpriv->next_dma_buf] >> 1) - len = (devpriv->dmabytestomove[devpriv->next_dma_buf] >> 1) -
@ -1053,7 +1053,7 @@ static irqreturn_t interrupt_pcl812_ai_dma(int irq, void *d)
transfer_from_dma_buf(dev, s, ptr, bufptr, len); transfer_from_dma_buf(dev, s, ptr, bufptr, len);
#ifdef PCL812_EXTDEBUG #ifdef PCL812_EXTDEBUG
rt_printk("pcl812 EDBG: END: interrupt_pcl812_ai_dma(...)\n"); printk("pcl812 EDBG: END: interrupt_pcl812_ai_dma(...)\n");
#endif #endif
return IRQ_HANDLED; return IRQ_HANDLED;
} }
@ -1087,7 +1087,7 @@ static int pcl812_ai_poll(struct comedi_device *dev, struct comedi_subdevice *s)
if (!devpriv->ai_dma) 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); spin_lock_irqsave(&dev->spinlock, flags);
for (i = 0; i < 10; i++) { 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 */
@ -1097,7 +1097,7 @@ static int pcl812_ai_poll(struct comedi_device *dev, struct comedi_subdevice *s)
} }
if (top1 != top2) { if (top1 != top2) {
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
return 0; return 0;
} }
@ -1105,7 +1105,7 @@ static int pcl812_ai_poll(struct comedi_device *dev, struct comedi_subdevice *s)
top1 >>= 1; /* sample position */ top1 >>= 1; /* sample position */
top2 = top1 - devpriv->ai_poll_ptr; 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); spin_unlock_irqrestore(&dev->spinlock, flags);
return 0; return 0;
} }
@ -1115,7 +1115,7 @@ static int pcl812_ai_poll(struct comedi_device *dev, struct comedi_subdevice *s)
devpriv->ai_poll_ptr = top1; /* new buffer position */ devpriv->ai_poll_ptr = top1; /* new buffer position */
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
return s->async->buf_write_count - s->async->buf_read_count; return s->async->buf_write_count - s->async->buf_read_count;
} }
@ -1152,7 +1152,7 @@ static void setup_range_channel(struct comedi_device *dev, struct comedi_subdevi
outb(gain_reg, dev->iobase + PCL812_GAIN); /* select gain */ outb(gain_reg, dev->iobase + PCL812_GAIN); /* select gain */
if (wait) { 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! */ udelay(devpriv->max_812_ai_mode0_rangewait); /* XXX this depends on selected range and can be very long for some high gain ranges! */
} }
} }
@ -1163,12 +1163,12 @@ static void start_pacer(struct comedi_device *dev, int mode, unsigned int diviso
unsigned int divisor2) unsigned int divisor2)
{ {
#ifdef PCL812_EXTDEBUG #ifdef PCL812_EXTDEBUG
rt_printk("pcl812 EDBG: BGN: start_pacer(%d,%u,%u)\n", mode, divisor1, printk("pcl812 EDBG: BGN: start_pacer(%d,%u,%u)\n", mode, divisor1,
divisor2); divisor2);
#endif #endif
outb(0xb4, dev->iobase + PCL812_CTRCTL); outb(0xb4, dev->iobase + PCL812_CTRCTL);
outb(0x74, dev->iobase + PCL812_CTRCTL); outb(0x74, dev->iobase + PCL812_CTRCTL);
comedi_udelay(1); udelay(1);
if (mode == 1) { if (mode == 1) {
outb(divisor2 & 0xff, dev->iobase + PCL812_CTR2); outb(divisor2 & 0xff, dev->iobase + PCL812_CTR2);
@ -1177,7 +1177,7 @@ static void start_pacer(struct comedi_device *dev, int mode, unsigned int diviso
outb((divisor1 >> 8) & 0xff, dev->iobase + PCL812_CTR1); outb((divisor1 >> 8) & 0xff, dev->iobase + PCL812_CTR1);
} }
#ifdef PCL812_EXTDEBUG #ifdef PCL812_EXTDEBUG
rt_printk("pcl812 EDBG: END: start_pacer(...)\n"); printk("pcl812 EDBG: END: start_pacer(...)\n");
#endif #endif
} }
@ -1196,7 +1196,7 @@ static void free_resources(struct comedi_device *dev)
free_dma(devpriv->dma); free_dma(devpriv->dma);
} }
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (dev->iobase) if (dev->iobase)
release_region(dev->iobase, this_board->io_range); release_region(dev->iobase, this_board->io_range);
} }
@ -1207,7 +1207,7 @@ static void free_resources(struct comedi_device *dev)
static int pcl812_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) static int pcl812_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
{ {
#ifdef PCL812_EXTDEBUG #ifdef PCL812_EXTDEBUG
rt_printk("pcl812 EDBG: BGN: pcl812_ai_cancel(...)\n"); printk("pcl812 EDBG: BGN: pcl812_ai_cancel(...)\n");
#endif #endif
if (devpriv->ai_dma) if (devpriv->ai_dma)
disable_dma(devpriv->dma); disable_dma(devpriv->dma);
@ -1216,7 +1216,7 @@ static int pcl812_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *
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 */ outb(0, dev->iobase + PCL812_CLRINT); /* clear INT request */
#ifdef PCL812_EXTDEBUG #ifdef PCL812_EXTDEBUG
rt_printk("pcl812 EDBG: END: pcl812_ai_cancel(...)\n"); printk("pcl812 EDBG: END: pcl812_ai_cancel(...)\n");
#endif #endif
return 0; return 0;
} }
@ -1227,7 +1227,7 @@ static int pcl812_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *
static void pcl812_reset(struct comedi_device *dev) static void pcl812_reset(struct comedi_device *dev)
{ {
#ifdef PCL812_EXTDEBUG #ifdef PCL812_EXTDEBUG
rt_printk("pcl812 EDBG: BGN: pcl812_reset(...)\n"); printk("pcl812 EDBG: BGN: pcl812_reset(...)\n");
#endif #endif
outb(0, dev->iobase + PCL812_MUX); outb(0, dev->iobase + PCL812_MUX);
outb(0 + devpriv->range_correction, dev->iobase + PCL812_GAIN); outb(0 + devpriv->range_correction, dev->iobase + PCL812_GAIN);
@ -1254,12 +1254,12 @@ static void pcl812_reset(struct comedi_device *dev)
case boardPCL813: case boardPCL813:
case boardISO813: case boardISO813:
case boardACL8113: case boardACL8113:
comedi_udelay(5); udelay(5);
break; break;
} }
comedi_udelay(5); udelay(5);
#ifdef PCL812_EXTDEBUG #ifdef PCL812_EXTDEBUG
rt_printk("pcl812 EDBG: END: pcl812_reset(...)\n"); printk("pcl812 EDBG: END: pcl812_reset(...)\n");
#endif #endif
} }
@ -1302,8 +1302,7 @@ static int pcl812_attach(struct comedi_device *dev, struct comedi_devconfig *it)
printk(", IRQ %u is out of allowed range, DISABLING IT", irq); printk(", IRQ %u is out of allowed range, DISABLING IT", irq);
irq = 0; /* Bad IRQ */ irq = 0; /* Bad IRQ */
} else { } else {
if (comedi_request_irq(irq, interrupt_pcl812, 0, if (request_irq(irq, interrupt_pcl812, 0, "pcl812", dev)) {
"pcl812", dev)) {
printk(", unable to allocate IRQ %u, DISABLING IT", irq); printk(", unable to allocate IRQ %u, DISABLING IT", irq);
irq = 0; /* Can't use IRQ */ irq = 0; /* Can't use IRQ */
} else { } else {
@ -1600,7 +1599,7 @@ static int pcl812_detach(struct comedi_device *dev)
{ {
#ifdef PCL812_EXTDEBUG #ifdef PCL812_EXTDEBUG
rt_printk("comedi%d: pcl812: remove\n", dev->minor); printk("comedi%d: pcl812: remove\n", dev->minor);
#endif #endif
free_resources(dev); free_resources(dev);
return 0; return 0;

View File

@ -263,7 +263,7 @@ static int pcl816_ai_insn_read(struct comedi_device *dev, struct comedi_subdevic
outb(0, dev->iobase + PCL816_CLRINT); /* clear INT (conversion end) flag */ outb(0, dev->iobase + PCL816_CLRINT); /* clear INT (conversion end) flag */
break; break;
} }
comedi_udelay(1); udelay(1);
} }
/* Return timeout error */ /* Return timeout error */
if (!timeout) { if (!timeout) {
@ -293,7 +293,7 @@ static irqreturn_t interrupt_pcl816_ai_mode13_int(int irq, void *d)
if (!(inb(dev->iobase + PCL816_STATUS) & if (!(inb(dev->iobase + PCL816_STATUS) &
PCL816_STATUS_DRDY_MASK)) PCL816_STATUS_DRDY_MASK))
break; break;
comedi_udelay(1); udelay(1);
} }
if (!timeout) { /* timeout, bail error */ if (!timeout) { /* timeout, bail error */
outb(0, dev->iobase + PCL816_CLRINT); /* clear INT request */ outb(0, dev->iobase + PCL816_CLRINT); /* clear INT request */
@ -449,13 +449,13 @@ static irqreturn_t interrupt_pcl816(int irq, void *d)
*/ */
static void pcl816_cmdtest_out(int e, struct comedi_cmd *cmd) static void pcl816_cmdtest_out(int e, struct comedi_cmd *cmd)
{ {
rt_printk("pcl816 e=%d startsrc=%x scansrc=%x convsrc=%x\n", e, printk("pcl816 e=%d startsrc=%x scansrc=%x convsrc=%x\n", e,
cmd->start_src, cmd->scan_begin_src, cmd->convert_src); cmd->start_src, cmd->scan_begin_src, cmd->convert_src);
rt_printk("pcl816 e=%d startarg=%d scanarg=%d convarg=%d\n", e, printk("pcl816 e=%d startarg=%d scanarg=%d convarg=%d\n", e,
cmd->start_arg, cmd->scan_begin_arg, cmd->convert_arg); cmd->start_arg, cmd->scan_begin_arg, cmd->convert_arg);
rt_printk("pcl816 e=%d stopsrc=%x scanend=%x\n", e, cmd->stop_src, printk("pcl816 e=%d stopsrc=%x scanend=%x\n", e, cmd->stop_src,
cmd->scan_end_src); cmd->scan_end_src);
rt_printk("pcl816 e=%d stoparg=%d scanendarg=%d chanlistlen=%d\n", e, printk("pcl816 e=%d stoparg=%d scanendarg=%d chanlistlen=%d\n", e,
cmd->stop_arg, cmd->scan_end_arg, cmd->chanlist_len); cmd->stop_arg, cmd->scan_end_arg, cmd->chanlist_len);
} }
@ -468,7 +468,7 @@ static int pcl816_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice
int err = 0; int err = 0;
int tmp, divisor1, divisor2; int tmp, divisor1, divisor2;
DEBUG(rt_printk("pcl816 pcl812_ai_cmdtest\n"); DEBUG(printk("pcl816 pcl812_ai_cmdtest\n");
pcl816_cmdtest_out(-1, cmd);); pcl816_cmdtest_out(-1, cmd););
/* step 1: make sure trigger sources are trivially valid */ /* step 1: make sure trigger sources are trivially valid */
@ -636,7 +636,7 @@ static int pcl816_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
if (!check_and_setup_channel_list(dev, s, cmd->chanlist, if (!check_and_setup_channel_list(dev, s, cmd->chanlist,
cmd->chanlist_len)) cmd->chanlist_len))
return -EINVAL; return -EINVAL;
comedi_udelay(1); udelay(1);
devpriv->ai_act_scan = 0; devpriv->ai_act_scan = 0;
s->async->cur_chan = 0; s->async->cur_chan = 0;
@ -710,7 +710,7 @@ static int pcl816_ai_poll(struct comedi_device *dev, struct comedi_subdevice *s)
if (!devpriv->dma) 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); spin_lock_irqsave(&dev->spinlock, flags);
for (i = 0; i < 20; i++) { 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 */
@ -719,7 +719,7 @@ static int pcl816_ai_poll(struct comedi_device *dev, struct comedi_subdevice *s)
break; break;
} }
if (top1 != top2) { if (top1 != top2) {
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
return 0; return 0;
} }
@ -727,7 +727,7 @@ static int pcl816_ai_poll(struct comedi_device *dev, struct comedi_subdevice *s)
top1 >>= 1; /* sample position */ top1 >>= 1; /* sample position */
top2 = top1 - devpriv->ai_poll_ptr; 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); spin_unlock_irqrestore(&dev->spinlock, flags);
return 0; return 0;
} }
@ -736,7 +736,7 @@ static int pcl816_ai_poll(struct comedi_device *dev, struct comedi_subdevice *s)
devpriv->ai_poll_ptr, top2); 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); spin_unlock_irqrestore(&dev->spinlock, flags);
return s->async->buf_write_count - s->async->buf_read_count; return s->async->buf_write_count - s->async->buf_read_count;
} }
@ -747,7 +747,7 @@ static int pcl816_ai_poll(struct comedi_device *dev, struct comedi_subdevice *s)
*/ */
static int pcl816_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) static int pcl816_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
{ {
/* DEBUG(rt_printk("pcl816_ai_cancel()\n");) */ /* DEBUG(printk("pcl816_ai_cancel()\n");) */
if (devpriv->irq_blocked > 0) { if (devpriv->irq_blocked > 0) {
switch (devpriv->int816_mode) { switch (devpriv->int816_mode) {
@ -763,7 +763,7 @@ static int pcl816_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *
case INT_TYPE_AI1_INT: case INT_TYPE_AI1_INT:
case INT_TYPE_AI3_INT: case INT_TYPE_AI3_INT:
outb(inb(dev->iobase + PCL816_CONTROL) & 0x73, dev->iobase + PCL816_CONTROL); /* Stop A/D */ outb(inb(dev->iobase + PCL816_CONTROL) & 0x73, dev->iobase + PCL816_CONTROL); /* Stop A/D */
comedi_udelay(1); udelay(1);
outb(0, dev->iobase + PCL816_CONTROL); /* Stop A/D */ outb(0, dev->iobase + PCL816_CONTROL); /* Stop A/D */
outb(0xb0, dev->iobase + PCL816_CTRCTL); /* Stop pacer */ outb(0xb0, dev->iobase + PCL816_CTRCTL); /* Stop pacer */
outb(0x70, dev->iobase + PCL816_CTRCTL); outb(0x70, dev->iobase + PCL816_CTRCTL);
@ -781,7 +781,7 @@ static int pcl816_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *
} }
} }
DEBUG(rt_printk("comedi: pcl816_ai_cancel() successful\n"); DEBUG(printk("comedi: pcl816_ai_cancel() successful\n");
) )
return 0; return 0;
} }
@ -793,17 +793,17 @@ static int pcl816_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *
static int pcl816_check(unsigned long iobase) static int pcl816_check(unsigned long iobase)
{ {
outb(0x00, iobase + PCL816_MUX); outb(0x00, iobase + PCL816_MUX);
comedi_udelay(1); udelay(1);
if (inb(iobase + PCL816_MUX) != 0x00) if (inb(iobase + PCL816_MUX) != 0x00)
return 1; /* there isn't card */ return 1; /* there isn't card */
outb(0x55, iobase + PCL816_MUX); outb(0x55, iobase + PCL816_MUX);
comedi_udelay(1); udelay(1);
if (inb(iobase + PCL816_MUX) != 0x55) if (inb(iobase + PCL816_MUX) != 0x55)
return 1; /* there isn't card */ return 1; /* there isn't card */
outb(0x00, iobase + PCL816_MUX); outb(0x00, iobase + PCL816_MUX);
comedi_udelay(1); udelay(1);
outb(0x18, iobase + PCL816_CONTROL); outb(0x18, iobase + PCL816_CONTROL);
comedi_udelay(1); udelay(1);
if (inb(iobase + PCL816_CONTROL) != 0x18) if (inb(iobase + PCL816_CONTROL) != 0x18)
return 1; /* there isn't card */ return 1; /* there isn't card */
return 0; /* ok, card exist */ return 0; /* ok, card exist */
@ -817,10 +817,10 @@ static void pcl816_reset(struct comedi_device *dev)
{ {
/* 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); */ /* outb (0, dev->iobase + PCL818_DA_HI); */
/* comedi_udelay (1); */ /* 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); */ /* outb (0, dev->iobase + PCL818_DO_LO); */
/* comedi_udelay (1); */ /* udelay (1); */
outb(0, dev->iobase + PCL816_CONTROL); outb(0, dev->iobase + PCL816_CONTROL);
outb(0, dev->iobase + PCL816_MUX); outb(0, dev->iobase + PCL816_MUX);
outb(0, dev->iobase + PCL816_CLRINT); outb(0, dev->iobase + PCL816_CLRINT);
@ -841,10 +841,10 @@ start_pacer(struct comedi_device *dev, int mode, unsigned int divisor1,
outb(0x32, dev->iobase + PCL816_CTRCTL); outb(0x32, dev->iobase + PCL816_CTRCTL);
outb(0xff, dev->iobase + PCL816_CTR0); outb(0xff, dev->iobase + PCL816_CTR0);
outb(0x00, dev->iobase + PCL816_CTR0); outb(0x00, dev->iobase + PCL816_CTR0);
comedi_udelay(1); udelay(1);
outb(0xb4, dev->iobase + PCL816_CTRCTL); /* set counter 2 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 */ outb(0x74, dev->iobase + PCL816_CTRCTL); /* set counter 1 as mode 3 */
comedi_udelay(1); udelay(1);
if (mode == 1) { if (mode == 1) {
DPRINTK("mode %d, divisor1 %d, divisor2 %d\n", mode, divisor1, DPRINTK("mode %d, divisor1 %d, divisor2 %d\n", mode, divisor1,
@ -881,7 +881,7 @@ check_and_setup_channel_list(struct comedi_device *dev, struct comedi_subdevice
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++) { 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]), DEBUG(printk("%d. %d %d\n", i, CR_CHAN(chanlist[i]),
CR_RANGE(chanlist[i])); CR_RANGE(chanlist[i]));
) )
if (chanlist[0] == chanlist[i]) if (chanlist[0] == chanlist[i])
@ -890,7 +890,7 @@ check_and_setup_channel_list(struct comedi_device *dev, struct comedi_subdevice
(CR_CHAN(chansegment[i - 1]) + 1) % chanlen; (CR_CHAN(chansegment[i - 1]) + 1) % chanlen;
if (nowmustbechan != CR_CHAN(chanlist[i])) { if (nowmustbechan != CR_CHAN(chanlist[i])) {
/* channel list isn't continous :-( */ /* channel list isn't continous :-( */
rt_printk printk
("comedi%d: pcl816: channel list must be continous! chanlist[%i]=%d but must be %d or %d!\n", ("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]), dev->minor, i, CR_CHAN(chanlist[i]),
nowmustbechan, CR_CHAN(chanlist[0])); nowmustbechan, CR_CHAN(chanlist[0]));
@ -900,14 +900,14 @@ check_and_setup_channel_list(struct comedi_device *dev, struct comedi_subdevice
} }
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", DEBUG(printk("%d %d=%d %d\n",
CR_CHAN(chansegment[i % seglen]), CR_CHAN(chansegment[i % seglen]),
CR_RANGE(chansegment[i % seglen]), CR_RANGE(chansegment[i % seglen]),
CR_CHAN(chanlist[i]), CR_CHAN(chanlist[i]),
CR_RANGE(chanlist[i])); CR_RANGE(chanlist[i]));
) )
if (chanlist[i] != chansegment[i % seglen]) { if (chanlist[i] != chansegment[i % seglen]) {
rt_printk printk
("comedi%d: pcl816: bad channel or range number! chanlist[%i]=%d,%d,%d and not %d,%d,%d!\n", ("comedi%d: pcl816: bad channel or range number! chanlist[%i]=%d,%d,%d and not %d,%d,%d!\n",
dev->minor, i, CR_CHAN(chansegment[i]), dev->minor, i, CR_CHAN(chansegment[i]),
CR_RANGE(chansegment[i]), CR_RANGE(chansegment[i]),
@ -931,7 +931,7 @@ check_and_setup_channel_list(struct comedi_device *dev, struct comedi_subdevice
outb(CR_RANGE(chanlist[0]), dev->iobase + PCL816_RANGE); /* select gain */ outb(CR_RANGE(chanlist[0]), dev->iobase + PCL816_RANGE); /* select gain */
} }
comedi_udelay(1); udelay(1);
outb(devpriv->ai_act_chanlist[0] | (devpriv->ai_act_chanlist[seglen - 1] << 4), dev->iobase + PCL816_MUX); /* select channel interval to scan */ outb(devpriv->ai_act_chanlist[0] | (devpriv->ai_act_chanlist[seglen - 1] << 4), dev->iobase + PCL816_MUX); /* select channel interval to scan */
@ -981,7 +981,7 @@ static int set_rtc_irq_bit(unsigned char bit)
*/ */
static void free_resources(struct comedi_device *dev) static void free_resources(struct comedi_device *dev)
{ {
/* rt_printk("free_resource()\n"); */ /* printk("free_resource()\n"); */
if (dev->private) { if (dev->private) {
pcl816_ai_cancel(dev, devpriv->sub_ai); pcl816_ai_cancel(dev, devpriv->sub_ai);
pcl816_reset(dev); pcl816_reset(dev);
@ -993,7 +993,7 @@ static void free_resources(struct comedi_device *dev)
free_pages(devpriv->dmabuf[1], devpriv->dmapages[1]); free_pages(devpriv->dmabuf[1], devpriv->dmapages[1]);
#ifdef unused #ifdef unused
if (devpriv->rtc_irq) if (devpriv->rtc_irq)
comedi_free_irq(devpriv->rtc_irq, dev); free_irq(devpriv->rtc_irq, dev);
if ((devpriv->dma_rtc) && (RTC_lock == 1)) { if ((devpriv->dma_rtc) && (RTC_lock == 1)) {
if (devpriv->rtc_iobase) if (devpriv->rtc_iobase)
release_region(devpriv->rtc_iobase, release_region(devpriv->rtc_iobase,
@ -1006,7 +1006,7 @@ static void free_resources(struct comedi_device *dev)
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (dev->iobase) if (dev->iobase)
release_region(dev->iobase, this_board->io_range); release_region(dev->iobase, this_board->io_range);
/* rt_printk("free_resource() end\n"); */ /* printk("free_resource() end\n"); */
} }
/* /*
@ -1030,14 +1030,14 @@ static int pcl816_attach(struct comedi_device *dev, struct comedi_devconfig *it)
this_board->name, iobase); this_board->name, iobase);
if (!request_region(iobase, this_board->io_range, "pcl816")) { if (!request_region(iobase, this_board->io_range, "pcl816")) {
rt_printk("I/O port conflict\n"); printk("I/O port conflict\n");
return -EIO; return -EIO;
} }
dev->iobase = iobase; dev->iobase = iobase;
if (pcl816_check(iobase)) { if (pcl816_check(iobase)) {
rt_printk(", I cann't detect board. FAIL!\n"); printk(", I cann't detect board. FAIL!\n");
return -EIO; return -EIO;
} }
@ -1054,19 +1054,18 @@ static int pcl816_attach(struct comedi_device *dev, struct comedi_devconfig *it)
irq = it->options[1]; irq = it->options[1];
if (irq) { /* we want to use IRQ */ if (irq) { /* we want to use IRQ */
if (((1 << irq) & this_board->IRQbits) == 0) { if (((1 << irq) & this_board->IRQbits) == 0) {
rt_printk printk
(", IRQ %u is out of allowed range, DISABLING IT", (", IRQ %u is out of allowed range, DISABLING IT",
irq); irq);
irq = 0; /* Bad IRQ */ irq = 0; /* Bad IRQ */
} else { } else {
if (comedi_request_irq(irq, interrupt_pcl816, 0, if (request_irq(irq, interrupt_pcl816, 0, "pcl816", dev)) {
"pcl816", dev)) { printk
rt_printk
(", unable to allocate IRQ %u, DISABLING IT", (", unable to allocate IRQ %u, DISABLING IT",
irq); irq);
irq = 0; /* Can't use IRQ */ irq = 0; /* Can't use IRQ */
} else { } else {
rt_printk(", irq=%u", irq); printk(", irq=%u", irq);
} }
} }
} }
@ -1095,12 +1094,11 @@ static int pcl816_attach(struct comedi_device *dev, struct comedi_devconfig *it)
devpriv->rtc_iosize = RTC_IO_EXTENT; devpriv->rtc_iosize = RTC_IO_EXTENT;
RTC_lock++; RTC_lock++;
#ifdef UNTESTED_CODE #ifdef UNTESTED_CODE
if (!comedi_request_irq(RTC_IRQ, if (!request_irq(RTC_IRQ, interrupt_pcl816_ai_mode13_dma_rtc, 0,
interrupt_pcl816_ai_mode13_dma_rtc, 0,
"pcl816 DMA (RTC)", dev)) { "pcl816 DMA (RTC)", dev)) {
devpriv->dma_rtc = 1; devpriv->dma_rtc = 1;
devpriv->rtc_irq = RTC_IRQ; devpriv->rtc_irq = RTC_IRQ;
rt_printk(", dma_irq=%u", devpriv->rtc_irq); printk(", dma_irq=%u", devpriv->rtc_irq);
} else { } else {
RTC_lock--; RTC_lock--;
if (RTC_lock == 0) { if (RTC_lock == 0) {
@ -1131,34 +1129,34 @@ static int pcl816_attach(struct comedi_device *dev, struct comedi_devconfig *it)
goto no_dma; /* DMA disabled */ goto no_dma; /* DMA disabled */
if (((1 << dma) & this_board->DMAbits) == 0) { if (((1 << dma) & this_board->DMAbits) == 0) {
rt_printk(", DMA is out of allowed range, FAIL!\n"); printk(", DMA is out of allowed range, FAIL!\n");
return -EINVAL; /* Bad DMA */ return -EINVAL; /* Bad DMA */
} }
ret = request_dma(dma, "pcl816"); ret = request_dma(dma, "pcl816");
if (ret) { if (ret) {
rt_printk(", unable to allocate DMA %u, FAIL!\n", dma); printk(", unable to allocate DMA %u, FAIL!\n", dma);
return -EBUSY; /* DMA isn't free */ return -EBUSY; /* DMA isn't free */
} }
devpriv->dma = dma; devpriv->dma = dma;
rt_printk(", dma=%u", dma); printk(", dma=%u", dma);
pages = 2; /* we need 16KB */ pages = 2; /* we need 16KB */
devpriv->dmabuf[0] = __get_dma_pages(GFP_KERNEL, pages); devpriv->dmabuf[0] = __get_dma_pages(GFP_KERNEL, pages);
if (!devpriv->dmabuf[0]) { if (!devpriv->dmabuf[0]) {
rt_printk(", unable to allocate DMA buffer, FAIL!\n"); printk(", unable to allocate DMA buffer, FAIL!\n");
/* maybe experiment with try_to_free_pages() will help .... */ /* maybe experiment with try_to_free_pages() will help .... */
return -EBUSY; /* no buffer :-( */ return -EBUSY; /* no buffer :-( */
} }
devpriv->dmapages[0] = pages; devpriv->dmapages[0] = pages;
devpriv->hwdmaptr[0] = virt_to_bus((void *)devpriv->dmabuf[0]); devpriv->hwdmaptr[0] = virt_to_bus((void *)devpriv->dmabuf[0]);
devpriv->hwdmasize[0] = (1 << pages) * PAGE_SIZE; devpriv->hwdmasize[0] = (1 << pages) * PAGE_SIZE;
/* rt_printk("%d %d %ld, ",devpriv->dmapages[0],devpriv->hwdmasize[0],PAGE_SIZE); */ /* 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); devpriv->dmabuf[1] = __get_dma_pages(GFP_KERNEL, pages);
if (!devpriv->dmabuf[1]) { if (!devpriv->dmabuf[1]) {
rt_printk printk
(", unable to allocate DMA buffer, FAIL!\n"); (", unable to allocate DMA buffer, FAIL!\n");
return -EBUSY; return -EBUSY;
} }
@ -1232,7 +1230,7 @@ case COMEDI_SUBD_DO:
pcl816_reset(dev); pcl816_reset(dev);
rt_printk("\n"); printk("\n");
return 0; return 0;
} }
@ -1243,7 +1241,7 @@ case COMEDI_SUBD_DO:
*/ */
static int pcl816_detach(struct comedi_device *dev) static int pcl816_detach(struct comedi_device *dev)
{ {
DEBUG(rt_printk("comedi%d: pcl816: remove\n", dev->minor); DEBUG(printk("comedi%d: pcl816: remove\n", dev->minor);
) )
free_resources(dev); free_resources(dev);
#ifdef unused #ifdef unused

View File

@ -418,7 +418,7 @@ static int pcl818_ai_insn_read(struct comedi_device *dev, struct comedi_subdevic
while (timeout--) { while (timeout--) {
if (inb(dev->iobase + PCL818_STATUS) & 0x10) if (inb(dev->iobase + PCL818_STATUS) & 0x10)
goto conv_finish; goto conv_finish;
comedi_udelay(1); udelay(1);
} }
comedi_error(dev, "A/D insn timeout"); comedi_error(dev, "A/D insn timeout");
/* clear INT (conversion end) flag */ /* clear INT (conversion end) flag */
@ -524,7 +524,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_int(int irq, void *d)
while (timeout--) { while (timeout--) {
if (inb(dev->iobase + PCL818_STATUS) & 0x10) if (inb(dev->iobase + PCL818_STATUS) & 0x10)
goto conv_finish; goto conv_finish;
comedi_udelay(1); udelay(1);
} }
outb(0, dev->iobase + PCL818_STATUS); /* clear INT request */ outb(0, dev->iobase + PCL818_STATUS); /* clear INT request */
comedi_error(dev, "A/D mode1/3 IRQ without DRDY!"); comedi_error(dev, "A/D mode1/3 IRQ without DRDY!");
@ -539,7 +539,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_int(int irq, void *d)
outb(0, dev->iobase + PCL818_CLRINT); /* clear INT request */ 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 printk
("comedi: A/D mode1/3 IRQ - channel dropout %x!=%x !\n", ("comedi: A/D mode1/3 IRQ - channel dropout %x!=%x !\n",
(low & 0xf), (low & 0xf),
devpriv->act_chanlist[devpriv->act_chanlist_pos]); devpriv->act_chanlist[devpriv->act_chanlist_pos]);
@ -549,7 +549,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_int(int irq, void *d)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
if (s->async->cur_chan == 0) { if (s->async->cur_chan == 0) {
/* rt_printk("E"); */ /* printk("E"); */
devpriv->ai_act_scan--; devpriv->ai_act_scan--;
} }
@ -591,7 +591,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_dma(int irq, void *d)
release_dma_lock(flags); release_dma_lock(flags);
enable_dma(devpriv->dma); enable_dma(devpriv->dma);
} }
rt_printk("comedi: A/D mode1/3 IRQ \n"); printk("comedi: A/D mode1/3 IRQ \n");
devpriv->dma_runs_to_end--; devpriv->dma_runs_to_end--;
outb(0, dev->iobase + PCL818_CLRINT); /* clear INT request */ outb(0, dev->iobase + PCL818_CLRINT); /* clear INT request */
@ -602,7 +602,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_dma(int irq, void *d)
for (i = 0; i < len; i++) { 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 printk
("comedi: A/D mode1/3 DMA - channel dropout %d(card)!=%d(chanlist) at %d !\n", ("comedi: A/D mode1/3 DMA - channel dropout %d(card)!=%d(chanlist) at %d !\n",
(ptr[bufptr] & 0xf), (ptr[bufptr] & 0xf),
devpriv->act_chanlist[devpriv-> devpriv->act_chanlist[devpriv->
@ -681,19 +681,19 @@ static irqreturn_t interrupt_pcl818_ai_mode13_dma_rtc(int irq, void *d)
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!"); comedi_error(dev, "A/D mode1/3 DMA buffer overflow!");
/* rt_printk("I %d dmabuf[i] %d %d\n",i,dmabuf[i],devpriv->dmasamplsize); */ /* printk("I %d dmabuf[i] %d %d\n",i,dmabuf[i],devpriv->dmasamplsize); */
pcl818_ai_cancel(dev, s); pcl818_ai_cancel(dev, s);
s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
comedi_event(dev, s); comedi_event(dev, s);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
/* rt_printk("r %ld ",ofs_dats); */ /* printk("r %ld ",ofs_dats); */
bufptr = devpriv->last_top_dma; bufptr = devpriv->last_top_dma;
for (i = 0; i < ofs_dats; i++) { 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 printk
("comedi: A/D mode1/3 DMA - channel dropout %d!=%d !\n", ("comedi: A/D mode1/3 DMA - channel dropout %d!=%d !\n",
(dmabuf[bufptr] & 0xf), (dmabuf[bufptr] & 0xf),
devpriv->act_chanlist[devpriv-> devpriv->act_chanlist[devpriv->
@ -775,7 +775,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_fifo(int irq, void *d)
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
lo = inb(dev->iobase + PCL818_FI_DATALO); 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 printk
("comedi: A/D mode1/3 FIFO - channel dropout %d!=%d !\n", ("comedi: A/D mode1/3 FIFO - channel dropout %d!=%d !\n",
(lo & 0xf), (lo & 0xf),
devpriv->act_chanlist[devpriv-> devpriv->act_chanlist[devpriv->
@ -818,7 +818,7 @@ static irqreturn_t interrupt_pcl818(int irq, void *d)
comedi_error(dev, "premature interrupt"); comedi_error(dev, "premature interrupt");
return IRQ_HANDLED; return IRQ_HANDLED;
} }
/* rt_printk("I\n"); */ /* printk("I\n"); */
if (devpriv->irq_blocked && devpriv->irq_was_now_closed) { if (devpriv->irq_blocked && devpriv->irq_was_now_closed) {
if ((devpriv->neverending_ai || (!devpriv->neverending_ai && if ((devpriv->neverending_ai || (!devpriv->neverending_ai &&
@ -882,7 +882,7 @@ static void pcl818_ai_mode13dma_int(int mode, struct comedi_device *dev,
unsigned int flags; unsigned int flags;
unsigned int bytes; unsigned int bytes;
rt_printk("mode13dma_int, mode: %d\n", mode); printk("mode13dma_int, mode: %d\n", mode);
disable_dma(devpriv->dma); /* disable dma */ disable_dma(devpriv->dma); /* disable dma */
bytes = devpriv->hwdmasize[0]; bytes = devpriv->hwdmasize[0];
if (!devpriv->neverending_ai) { if (!devpriv->neverending_ai) {
@ -965,7 +965,7 @@ static int pcl818_ai_cmd_mode(int mode, struct comedi_device *dev,
int divisor1, divisor2; int divisor1, divisor2;
unsigned int seglen; unsigned int seglen;
rt_printk("pcl818_ai_cmd_mode()\n"); printk("pcl818_ai_cmd_mode()\n");
if ((!dev->irq) && (!devpriv->dma_rtc)) { if ((!dev->irq) && (!devpriv->dma_rtc)) {
comedi_error(dev, "IRQ not defined!"); comedi_error(dev, "IRQ not defined!");
return -EINVAL; return -EINVAL;
@ -983,7 +983,7 @@ static int pcl818_ai_cmd_mode(int mode, struct comedi_device *dev,
setup_channel_list(dev, s, devpriv->ai_chanlist, setup_channel_list(dev, s, devpriv->ai_chanlist,
devpriv->ai_n_chan, seglen); devpriv->ai_n_chan, seglen);
comedi_udelay(1); udelay(1);
devpriv->ai_act_scan = devpriv->ai_scans; devpriv->ai_act_scan = devpriv->ai_scans;
devpriv->ai_act_chan = 0; devpriv->ai_act_chan = 0;
@ -1030,7 +1030,7 @@ static int pcl818_ai_cmd_mode(int mode, struct comedi_device *dev,
case 0: case 0:
if (!devpriv->usefifo) { if (!devpriv->usefifo) {
/* IRQ */ /* IRQ */
/* rt_printk("IRQ\n"); */ /* printk("IRQ\n"); */
if (mode == 1) { if (mode == 1) {
devpriv->ai_mode = INT_TYPE_AI1_INT; devpriv->ai_mode = INT_TYPE_AI1_INT;
/* Pacer+IRQ */ /* Pacer+IRQ */
@ -1065,7 +1065,7 @@ static int pcl818_ai_cmd_mode(int mode, struct comedi_device *dev,
break; break;
} }
#endif #endif
rt_printk("pcl818_ai_cmd_mode() end\n"); printk("pcl818_ai_cmd_mode() end\n");
return 0; return 0;
} }
@ -1155,7 +1155,7 @@ static void start_pacer(struct comedi_device *dev, int mode, unsigned int diviso
{ {
outb(0xb4, dev->iobase + PCL818_CTRCTL); outb(0xb4, dev->iobase + PCL818_CTRCTL);
outb(0x74, dev->iobase + PCL818_CTRCTL); outb(0x74, dev->iobase + PCL818_CTRCTL);
comedi_udelay(1); udelay(1);
if (mode == 1) { if (mode == 1) {
outb(divisor2 & 0xff, dev->iobase + PCL818_CTR2); outb(divisor2 & 0xff, dev->iobase + PCL818_CTR2);
@ -1188,7 +1188,7 @@ static int check_channel_list(struct comedi_device *dev, struct comedi_subdevice
/* build part of chanlist */ /* build part of chanlist */
for (i = 1, seglen = 1; i < n_chan; i++, seglen++) { for (i = 1, seglen = 1; i < n_chan; i++, seglen++) {
/* rt_printk("%d. %d * %d\n",i, /* printk("%d. %d * %d\n",i,
* CR_CHAN(it->chanlist[i]),CR_RANGE(it->chanlist[i]));*/ * CR_CHAN(it->chanlist[i]),CR_RANGE(it->chanlist[i]));*/
/* we detect loop, this must by finish */ /* we detect loop, this must by finish */
@ -1198,7 +1198,7 @@ static int check_channel_list(struct comedi_device *dev, struct comedi_subdevice
nowmustbechan = nowmustbechan =
(CR_CHAN(chansegment[i - 1]) + 1) % s->n_chan; (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 printk
("comedi%d: pcl818: channel list must be continous! chanlist[%i]=%d but must be %d or %d!\n", ("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]), dev->minor, i, CR_CHAN(chanlist[i]),
nowmustbechan, CR_CHAN(chanlist[0])); nowmustbechan, CR_CHAN(chanlist[0]));
@ -1210,9 +1210,9 @@ static int check_channel_list(struct comedi_device *dev, struct comedi_subdevice
/* check whole chanlist */ /* check whole chanlist */
for (i = 0, segpos = 0; i < n_chan; i++) { 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])); */ /* 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]) { if (chanlist[i] != chansegment[i % seglen]) {
rt_printk printk
("comedi%d: pcl818: bad channel or range number! chanlist[%i]=%d,%d,%d and not %d,%d,%d!\n", ("comedi%d: pcl818: bad channel or range number! chanlist[%i]=%d,%d,%d and not %d,%d,%d!\n",
dev->minor, i, CR_CHAN(chansegment[i]), dev->minor, i, CR_CHAN(chansegment[i]),
CR_RANGE(chansegment[i]), CR_RANGE(chansegment[i]),
@ -1226,7 +1226,7 @@ static int check_channel_list(struct comedi_device *dev, struct comedi_subdevice
} else { } else {
seglen = 1; seglen = 1;
} }
rt_printk("check_channel_list: seglen %d\n", seglen); printk("check_channel_list: seglen %d\n", seglen);
return seglen; return seglen;
} }
@ -1244,7 +1244,7 @@ static void setup_channel_list(struct comedi_device *dev, struct comedi_subdevic
outb(CR_RANGE(chanlist[i]), dev->iobase + PCL818_RANGE); /* select gain */ outb(CR_RANGE(chanlist[i]), dev->iobase + PCL818_RANGE); /* select gain */
} }
comedi_udelay(1); udelay(1);
/* select channel interval to scan */ /* select channel interval to scan */
outb(devpriv->act_chanlist[0] | (devpriv->act_chanlist[seglen - outb(devpriv->act_chanlist[0] | (devpriv->act_chanlist[seglen -
@ -1417,7 +1417,7 @@ static int ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
struct comedi_cmd *cmd = &s->async->cmd; struct comedi_cmd *cmd = &s->async->cmd;
int retval; int retval;
rt_printk("pcl818_ai_cmd()\n"); printk("pcl818_ai_cmd()\n");
devpriv->ai_n_chan = cmd->chanlist_len; devpriv->ai_n_chan = cmd->chanlist_len;
devpriv->ai_chanlist = cmd->chanlist; devpriv->ai_chanlist = cmd->chanlist;
devpriv->ai_flags = cmd->flags; devpriv->ai_flags = cmd->flags;
@ -1436,7 +1436,7 @@ static int ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
if (cmd->convert_src == TRIG_TIMER) { /* mode 1 */ if (cmd->convert_src == TRIG_TIMER) { /* mode 1 */
devpriv->ai_timer1 = cmd->convert_arg; devpriv->ai_timer1 = cmd->convert_arg;
retval = pcl818_ai_cmd_mode(1, dev, s); retval = pcl818_ai_cmd_mode(1, dev, s);
rt_printk("pcl818_ai_cmd() end\n"); printk("pcl818_ai_cmd() end\n");
return retval; return retval;
} }
if (cmd->convert_src == TRIG_EXT) { /* mode 3 */ if (cmd->convert_src == TRIG_EXT) { /* mode 3 */
@ -1454,7 +1454,7 @@ static int ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
static int pcl818_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) static int pcl818_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
{ {
if (devpriv->irq_blocked > 0) { if (devpriv->irq_blocked > 0) {
rt_printk("pcl818_ai_cancel()\n"); printk("pcl818_ai_cancel()\n");
devpriv->irq_was_now_closed = 1; devpriv->irq_was_now_closed = 1;
switch (devpriv->ai_mode) { switch (devpriv->ai_mode) {
@ -1482,7 +1482,7 @@ static int pcl818_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *
case INT_TYPE_AO3_INT: case INT_TYPE_AO3_INT:
#endif #endif
outb(inb(dev->iobase + PCL818_CONTROL) & 0x73, dev->iobase + PCL818_CONTROL); /* Stop A/D */ outb(inb(dev->iobase + PCL818_CONTROL) & 0x73, dev->iobase + PCL818_CONTROL); /* Stop A/D */
comedi_udelay(1); udelay(1);
start_pacer(dev, -1, 0, 0); start_pacer(dev, -1, 0, 0);
outb(0, dev->iobase + PCL818_AD_LO); outb(0, dev->iobase + PCL818_AD_LO);
inb(dev->iobase + PCL818_AD_LO); inb(dev->iobase + PCL818_AD_LO);
@ -1504,7 +1504,7 @@ static int pcl818_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *
} }
end: end:
rt_printk("pcl818_ai_cancel() end\n"); printk("pcl818_ai_cancel() end\n");
return 0; return 0;
} }
@ -1515,17 +1515,17 @@ static int pcl818_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *
static int pcl818_check(unsigned long iobase) static int pcl818_check(unsigned long iobase)
{ {
outb(0x00, iobase + PCL818_MUX); outb(0x00, iobase + PCL818_MUX);
comedi_udelay(1); udelay(1);
if (inb(iobase + PCL818_MUX) != 0x00) if (inb(iobase + PCL818_MUX) != 0x00)
return 1; /* there isn't card */ return 1; /* there isn't card */
outb(0x55, iobase + PCL818_MUX); outb(0x55, iobase + PCL818_MUX);
comedi_udelay(1); udelay(1);
if (inb(iobase + PCL818_MUX) != 0x55) if (inb(iobase + PCL818_MUX) != 0x55)
return 1; /* there isn't card */ return 1; /* there isn't card */
outb(0x00, iobase + PCL818_MUX); outb(0x00, iobase + PCL818_MUX);
comedi_udelay(1); udelay(1);
outb(0x18, iobase + PCL818_CONTROL); outb(0x18, iobase + PCL818_CONTROL);
comedi_udelay(1); udelay(1);
if (inb(iobase + PCL818_CONTROL) != 0x18) if (inb(iobase + PCL818_CONTROL) != 0x18)
return 1; /* there isn't card */ return 1; /* there isn't card */
return 0; /* ok, card exist */ return 0; /* ok, card exist */
@ -1544,10 +1544,10 @@ static void pcl818_reset(struct comedi_device *dev)
} }
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); outb(0, dev->iobase + PCL818_DA_HI);
comedi_udelay(1); 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); outb(0, dev->iobase + PCL818_DO_LO);
comedi_udelay(1); udelay(1);
outb(0, dev->iobase + PCL818_CONTROL); outb(0, dev->iobase + PCL818_CONTROL);
outb(0, dev->iobase + PCL818_CNTENABLE); outb(0, dev->iobase + PCL818_CNTENABLE);
outb(0, dev->iobase + PCL818_MUX); outb(0, dev->iobase + PCL818_MUX);
@ -1658,7 +1658,7 @@ static int rtc_setfreq_irq(int freq)
*/ */
static void free_resources(struct comedi_device *dev) static void free_resources(struct comedi_device *dev)
{ {
/* rt_printk("free_resource()\n"); */ /* printk("free_resource()\n"); */
if (dev->private) { if (dev->private) {
pcl818_ai_cancel(dev, devpriv->sub_ai); pcl818_ai_cancel(dev, devpriv->sub_ai);
pcl818_reset(dev); pcl818_reset(dev);
@ -1670,7 +1670,7 @@ static void free_resources(struct comedi_device *dev)
free_pages(devpriv->dmabuf[1], devpriv->dmapages[1]); free_pages(devpriv->dmabuf[1], devpriv->dmapages[1]);
#ifdef unused #ifdef unused
if (devpriv->rtc_irq) if (devpriv->rtc_irq)
comedi_free_irq(devpriv->rtc_irq, dev); free_irq(devpriv->rtc_irq, dev);
if ((devpriv->dma_rtc) && (RTC_lock == 1)) { if ((devpriv->dma_rtc) && (RTC_lock == 1)) {
if (devpriv->rtc_iobase) if (devpriv->rtc_iobase)
release_region(devpriv->rtc_iobase, release_region(devpriv->rtc_iobase,
@ -1685,7 +1685,7 @@ static void free_resources(struct comedi_device *dev)
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (dev->iobase) if (dev->iobase)
release_region(dev->iobase, devpriv->io_range); release_region(dev->iobase, devpriv->io_range);
/* rt_printk("free_resource() end\n"); */ /* printk("free_resource() end\n"); */
} }
/* /*
@ -1717,14 +1717,14 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it)
devpriv->usefifo = 1; devpriv->usefifo = 1;
} }
if (!request_region(iobase, devpriv->io_range, "pcl818")) { if (!request_region(iobase, devpriv->io_range, "pcl818")) {
rt_printk("I/O port conflict\n"); printk("I/O port conflict\n");
return -EIO; return -EIO;
} }
dev->iobase = iobase; dev->iobase = iobase;
if (pcl818_check(iobase)) { if (pcl818_check(iobase)) {
rt_printk(", I can't detect board. FAIL!\n"); printk(", I can't detect board. FAIL!\n");
return -EIO; return -EIO;
} }
@ -1736,19 +1736,18 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it)
irq = it->options[1]; irq = it->options[1];
if (irq) { /* we want to use IRQ */ if (irq) { /* we want to use IRQ */
if (((1 << irq) & this_board->IRQbits) == 0) { if (((1 << irq) & this_board->IRQbits) == 0) {
rt_printk printk
(", IRQ %u is out of allowed range, DISABLING IT", (", IRQ %u is out of allowed range, DISABLING IT",
irq); irq);
irq = 0; /* Bad IRQ */ irq = 0; /* Bad IRQ */
} else { } else {
if (comedi_request_irq(irq, interrupt_pcl818, 0, if (request_irq(irq, interrupt_pcl818, 0, "pcl818", dev)) {
"pcl818", dev)) { printk
rt_printk
(", unable to allocate IRQ %u, DISABLING IT", (", unable to allocate IRQ %u, DISABLING IT",
irq); irq);
irq = 0; /* Can't use IRQ */ irq = 0; /* Can't use IRQ */
} else { } else {
rt_printk(", irq=%u", irq); printk(", irq=%u", irq);
} }
} }
} }
@ -1776,12 +1775,11 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it)
devpriv->rtc_iobase = RTC_PORT(0); devpriv->rtc_iobase = RTC_PORT(0);
devpriv->rtc_iosize = RTC_IO_EXTENT; devpriv->rtc_iosize = RTC_IO_EXTENT;
RTC_lock++; RTC_lock++;
if (!comedi_request_irq(RTC_IRQ, if (!request_irq(RTC_IRQ, interrupt_pcl818_ai_mode13_dma_rtc, 0,
interrupt_pcl818_ai_mode13_dma_rtc, 0,
"pcl818 DMA (RTC)", dev)) { "pcl818 DMA (RTC)", dev)) {
devpriv->dma_rtc = 1; devpriv->dma_rtc = 1;
devpriv->rtc_irq = RTC_IRQ; devpriv->rtc_irq = RTC_IRQ;
rt_printk(", dma_irq=%u", devpriv->rtc_irq); printk(", dma_irq=%u", devpriv->rtc_irq);
} else { } else {
RTC_lock--; RTC_lock--;
if (RTC_lock == 0) { if (RTC_lock == 0) {
@ -1806,31 +1804,31 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it)
if (dma < 1) if (dma < 1)
goto no_dma; /* DMA disabled */ goto no_dma; /* DMA disabled */
if (((1 << dma) & this_board->DMAbits) == 0) { if (((1 << dma) & this_board->DMAbits) == 0) {
rt_printk(", DMA is out of allowed range, FAIL!\n"); printk(", DMA is out of allowed range, FAIL!\n");
return -EINVAL; /* Bad DMA */ return -EINVAL; /* Bad DMA */
} }
ret = request_dma(dma, "pcl818"); ret = request_dma(dma, "pcl818");
if (ret) { if (ret) {
rt_printk(", unable to allocate DMA %u, FAIL!\n", dma); printk(", unable to allocate DMA %u, FAIL!\n", dma);
return -EBUSY; /* DMA isn't free */ return -EBUSY; /* DMA isn't free */
} }
devpriv->dma = dma; devpriv->dma = dma;
rt_printk(", dma=%u", dma); printk(", dma=%u", dma);
pages = 2; /* we need 16KB */ pages = 2; /* we need 16KB */
devpriv->dmabuf[0] = __get_dma_pages(GFP_KERNEL, pages); devpriv->dmabuf[0] = __get_dma_pages(GFP_KERNEL, pages);
if (!devpriv->dmabuf[0]) { if (!devpriv->dmabuf[0]) {
rt_printk(", unable to allocate DMA buffer, FAIL!\n"); printk(", unable to allocate DMA buffer, FAIL!\n");
/* maybe experiment with try_to_free_pages() will help .... */ /* maybe experiment with try_to_free_pages() will help .... */
return -EBUSY; /* no buffer :-( */ return -EBUSY; /* no buffer :-( */
} }
devpriv->dmapages[0] = pages; devpriv->dmapages[0] = pages;
devpriv->hwdmaptr[0] = virt_to_bus((void *)devpriv->dmabuf[0]); devpriv->hwdmaptr[0] = virt_to_bus((void *)devpriv->dmabuf[0]);
devpriv->hwdmasize[0] = (1 << pages) * PAGE_SIZE; devpriv->hwdmasize[0] = (1 << pages) * PAGE_SIZE;
/* rt_printk("%d %d %ld, ",devpriv->dmapages[0],devpriv->hwdmasize[0],PAGE_SIZE); */ /* 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); devpriv->dmabuf[1] = __get_dma_pages(GFP_KERNEL, pages);
if (!devpriv->dmabuf[1]) { if (!devpriv->dmabuf[1]) {
rt_printk printk
(", unable to allocate DMA buffer, FAIL!\n"); (", unable to allocate DMA buffer, FAIL!\n");
return -EBUSY; return -EBUSY;
} }
@ -1989,7 +1987,7 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it)
pcl818_reset(dev); pcl818_reset(dev);
rt_printk("\n"); printk("\n");
return 0; return 0;
} }
@ -2000,7 +1998,7 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it)
*/ */
static int pcl818_detach(struct comedi_device *dev) static int pcl818_detach(struct comedi_device *dev)
{ {
/* rt_printk("comedi%d: pcl818: remove\n", dev->minor); */ /* printk("comedi%d: pcl818: remove\n", dev->minor); */
free_resources(dev); free_resources(dev);
return 0; return 0;
} }

View File

@ -364,7 +364,7 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
dev->iobase + 16 + asic * ASIC_IOSIZE; dev->iobase + 16 + asic * ASIC_IOSIZE;
devpriv->asics[asic].irq = 0; /* this gets actually set at the end of devpriv->asics[asic].irq = 0; /* this gets actually set at the end of
this function when we this function when we
comedi_request_irqs */ request_irqs */
spin_lock_init(&devpriv->asics[asic].spinlock); spin_lock_init(&devpriv->asics[asic].spinlock);
} }
@ -489,12 +489,12 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
for (asic = 0; irq[0] && asic < MAX_ASICS; ++asic) { for (asic = 0; irq[0] && asic < MAX_ASICS; ++asic) {
if (irq[asic] if (irq[asic]
&& comedi_request_irq(irq[asic], interrupt_pcmmio, && request_irq(irq[asic], interrupt_pcmmio,
IRQF_SHARED, thisboard->name, dev)) { IRQF_SHARED, thisboard->name, dev)) {
int i; int i;
/* unroll the allocated irqs.. */ /* unroll the allocated irqs.. */
for (i = asic - 1; i >= 0; --i) { for (i = asic - 1; i >= 0; --i) {
comedi_free_irq(irq[i], dev); free_irq(irq[i], dev);
devpriv->asics[i].irq = irq[i] = 0; devpriv->asics[i].irq = irq[i] = 0;
} }
irq[asic] = 0; irq[asic] = 0;
@ -536,7 +536,7 @@ static int pcmmio_detach(struct comedi_device *dev)
for (i = 0; i < MAX_ASICS; ++i) { for (i = 0; i < MAX_ASICS; ++i) {
if (devpriv && devpriv->asics[i].irq) if (devpriv && devpriv->asics[i].irq)
comedi_free_irq(devpriv->asics[i].irq, dev); free_irq(devpriv->asics[i].irq, dev);
} }
if (devpriv && devpriv->sprivs) if (devpriv && devpriv->sprivs)
@ -778,8 +778,7 @@ static irqreturn_t interrupt_pcmmio(int irq, void *d)
/* it is an interrupt for ASIC #asic */ /* it is an interrupt for ASIC #asic */
unsigned char int_pend; unsigned char int_pend;
comedi_spin_lock_irqsave(&devpriv->asics[asic].spinlock, spin_lock_irqsave(&devpriv->asics[asic].spinlock, flags);
flags);
int_pend = inb(iobase + REG_INT_PENDING) & 0x07; int_pend = inb(iobase + REG_INT_PENDING) & 0x07;
@ -811,8 +810,7 @@ static irqreturn_t interrupt_pcmmio(int irq, void *d)
++got1; ++got1;
} }
comedi_spin_unlock_irqrestore(&devpriv->asics[asic]. spin_unlock_irqrestore(&devpriv->asics[asic]. spinlock, flags);
spinlock, flags);
if (triggered) { if (triggered) {
struct comedi_subdevice *s; struct comedi_subdevice *s;
@ -825,9 +823,7 @@ static irqreturn_t interrupt_pcmmio(int irq, void *d)
unsigned long flags; unsigned long flags;
unsigned oldevents; unsigned oldevents;
comedi_spin_lock_irqsave spin_lock_irqsave(&subpriv->dio.intr.spinlock, flags);
(&subpriv->dio.intr.
spinlock, flags);
oldevents = s->async->events; oldevents = s->async->events;
@ -896,9 +892,7 @@ static irqreturn_t interrupt_pcmmio(int irq, void *d)
} }
} }
comedi_spin_unlock_irqrestore spin_unlock_irqrestore(&subpriv->dio.intr.spinlock, flags);
(&subpriv->dio.intr.
spinlock, flags);
if (oldevents != if (oldevents !=
s->async->events) { s->async->events) {
@ -1001,10 +995,10 @@ static int pcmmio_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
{ {
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&subpriv->dio.intr.spinlock, flags); spin_lock_irqsave(&subpriv->dio.intr.spinlock, flags);
if (subpriv->dio.intr.active) if (subpriv->dio.intr.active)
pcmmio_stop_intr(dev, s); pcmmio_stop_intr(dev, s);
comedi_spin_unlock_irqrestore(&subpriv->dio.intr.spinlock, flags); spin_unlock_irqrestore(&subpriv->dio.intr.spinlock, flags);
return 0; return 0;
} }
@ -1022,12 +1016,12 @@ pcmmio_inttrig_start_intr(struct comedi_device *dev, struct comedi_subdevice *s,
if (trignum != 0) if (trignum != 0)
return -EINVAL; return -EINVAL;
comedi_spin_lock_irqsave(&subpriv->dio.intr.spinlock, flags); spin_lock_irqsave(&subpriv->dio.intr.spinlock, flags);
s->async->inttrig = 0; s->async->inttrig = 0;
if (subpriv->dio.intr.active) { if (subpriv->dio.intr.active) {
event = pcmmio_start_intr(dev, s); event = pcmmio_start_intr(dev, s);
} }
comedi_spin_unlock_irqrestore(&subpriv->dio.intr.spinlock, flags); spin_unlock_irqrestore(&subpriv->dio.intr.spinlock, flags);
if (event) { if (event) {
comedi_event(dev, s); comedi_event(dev, s);
@ -1045,7 +1039,7 @@ static int pcmmio_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
unsigned long flags; unsigned long flags;
int event = 0; int event = 0;
comedi_spin_lock_irqsave(&subpriv->dio.intr.spinlock, flags); spin_lock_irqsave(&subpriv->dio.intr.spinlock, flags);
subpriv->dio.intr.active = 1; subpriv->dio.intr.active = 1;
/* Set up end of acquisition. */ /* Set up end of acquisition. */
@ -1071,7 +1065,7 @@ static int pcmmio_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
event = pcmmio_start_intr(dev, s); event = pcmmio_start_intr(dev, s);
break; break;
} }
comedi_spin_unlock_irqrestore(&subpriv->dio.intr.spinlock, flags); spin_unlock_irqrestore(&subpriv->dio.intr.spinlock, flags);
if (event) { if (event) {
comedi_event(dev, s); comedi_event(dev, s);

View File

@ -322,7 +322,7 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
devpriv->asics[asic].iobase = dev->iobase + asic * ASIC_IOSIZE; devpriv->asics[asic].iobase = dev->iobase + asic * ASIC_IOSIZE;
devpriv->asics[asic].irq = 0; /* this gets actually set at the end of devpriv->asics[asic].irq = 0; /* this gets actually set at the end of
this function when we this function when we
comedi_request_irqs */ request_irqs */
spin_lock_init(&devpriv->asics[asic].spinlock); spin_lock_init(&devpriv->asics[asic].spinlock);
} }
@ -413,12 +413,12 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
for (asic = 0; irq[0] && asic < MAX_ASICS; ++asic) { for (asic = 0; irq[0] && asic < MAX_ASICS; ++asic) {
if (irq[asic] if (irq[asic]
&& comedi_request_irq(irq[asic], interrupt_pcmuio, && request_irq(irq[asic], interrupt_pcmuio,
IRQF_SHARED, thisboard->name, dev)) { IRQF_SHARED, thisboard->name, dev)) {
int i; int i;
/* unroll the allocated irqs.. */ /* unroll the allocated irqs.. */
for (i = asic - 1; i >= 0; --i) { for (i = asic - 1; i >= 0; --i) {
comedi_free_irq(irq[i], dev); free_irq(irq[i], dev);
devpriv->asics[i].irq = irq[i] = 0; devpriv->asics[i].irq = irq[i] = 0;
} }
irq[asic] = 0; irq[asic] = 0;
@ -460,7 +460,7 @@ static int pcmuio_detach(struct comedi_device *dev)
for (i = 0; i < MAX_ASICS; ++i) { for (i = 0; i < MAX_ASICS; ++i) {
if (devpriv->asics[i].irq) if (devpriv->asics[i].irq)
comedi_free_irq(devpriv->asics[i].irq, dev); free_irq(devpriv->asics[i].irq, dev);
} }
if (devpriv && devpriv->sprivs) if (devpriv && devpriv->sprivs)
@ -701,8 +701,7 @@ static irqreturn_t interrupt_pcmuio(int irq, void *d)
/* it is an interrupt for ASIC #asic */ /* it is an interrupt for ASIC #asic */
unsigned char int_pend; unsigned char int_pend;
comedi_spin_lock_irqsave(&devpriv->asics[asic].spinlock, spin_lock_irqsave(&devpriv->asics[asic].spinlock, flags);
flags);
int_pend = inb(iobase + REG_INT_PENDING) & 0x07; int_pend = inb(iobase + REG_INT_PENDING) & 0x07;
@ -734,8 +733,7 @@ static irqreturn_t interrupt_pcmuio(int irq, void *d)
++got1; ++got1;
} }
comedi_spin_unlock_irqrestore(&devpriv->asics[asic]. spin_unlock_irqrestore(&devpriv->asics[asic].spinlock, flags);
spinlock, flags);
if (triggered) { if (triggered) {
struct comedi_subdevice *s; struct comedi_subdevice *s;
@ -748,9 +746,7 @@ static irqreturn_t interrupt_pcmuio(int irq, void *d)
unsigned long flags; unsigned long flags;
unsigned oldevents; unsigned oldevents;
comedi_spin_lock_irqsave spin_lock_irqsave (&subpriv->intr.spinlock, flags);
(&subpriv->intr.
spinlock, flags);
oldevents = s->async->events; oldevents = s->async->events;
@ -816,9 +812,7 @@ static irqreturn_t interrupt_pcmuio(int irq, void *d)
} }
} }
comedi_spin_unlock_irqrestore spin_unlock_irqrestore(&subpriv->intr.spinlock, flags);
(&subpriv->intr.
spinlock, flags);
if (oldevents != if (oldevents !=
s->async->events) { s->async->events) {
@ -911,10 +905,10 @@ static int pcmuio_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
{ {
unsigned long flags; unsigned long flags;
comedi_spin_lock_irqsave(&subpriv->intr.spinlock, flags); spin_lock_irqsave(&subpriv->intr.spinlock, flags);
if (subpriv->intr.active) if (subpriv->intr.active)
pcmuio_stop_intr(dev, s); pcmuio_stop_intr(dev, s);
comedi_spin_unlock_irqrestore(&subpriv->intr.spinlock, flags); spin_unlock_irqrestore(&subpriv->intr.spinlock, flags);
return 0; return 0;
} }
@ -932,12 +926,12 @@ pcmuio_inttrig_start_intr(struct comedi_device *dev, struct comedi_subdevice *s,
if (trignum != 0) if (trignum != 0)
return -EINVAL; return -EINVAL;
comedi_spin_lock_irqsave(&subpriv->intr.spinlock, flags); spin_lock_irqsave(&subpriv->intr.spinlock, flags);
s->async->inttrig = 0; s->async->inttrig = 0;
if (subpriv->intr.active) { if (subpriv->intr.active) {
event = pcmuio_start_intr(dev, s); event = pcmuio_start_intr(dev, s);
} }
comedi_spin_unlock_irqrestore(&subpriv->intr.spinlock, flags); spin_unlock_irqrestore(&subpriv->intr.spinlock, flags);
if (event) { if (event) {
comedi_event(dev, s); comedi_event(dev, s);
@ -955,7 +949,7 @@ static int pcmuio_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
unsigned long flags; unsigned long flags;
int event = 0; int event = 0;
comedi_spin_lock_irqsave(&subpriv->intr.spinlock, flags); spin_lock_irqsave(&subpriv->intr.spinlock, flags);
subpriv->intr.active = 1; subpriv->intr.active = 1;
/* Set up end of acquisition. */ /* Set up end of acquisition. */
@ -981,7 +975,7 @@ static int pcmuio_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
event = pcmuio_start_intr(dev, s); event = pcmuio_start_intr(dev, s);
break; break;
} }
comedi_spin_unlock_irqrestore(&subpriv->intr.spinlock, flags); spin_unlock_irqrestore(&subpriv->intr.spinlock, flags);
if (event) { if (event) {
comedi_event(dev, s); comedi_event(dev, s);

View File

@ -399,11 +399,11 @@ static inline int plx9080_abort_dma(void *iobase, unsigned int channel)
/* wait to make sure done bit is zero */ /* wait to make sure done bit is zero */
for (i = 0; (dma_status & PLX_DMA_DONE_BIT) && i < timeout; i++) { for (i = 0; (dma_status & PLX_DMA_DONE_BIT) && i < timeout; i++) {
comedi_udelay(1); udelay(1);
dma_status = readb(dma_cs_addr); dma_status = readb(dma_cs_addr);
} }
if (i == timeout) { if (i == timeout) {
rt_printk printk
("plx9080: cancel() timed out waiting for dma %i done clear\n", ("plx9080: cancel() timed out waiting for dma %i done clear\n",
channel); channel);
return -ETIMEDOUT; return -ETIMEDOUT;
@ -413,11 +413,11 @@ static inline int plx9080_abort_dma(void *iobase, unsigned int channel)
/* wait for dma done bit */ /* wait for dma done bit */
dma_status = readb(dma_cs_addr); dma_status = readb(dma_cs_addr);
for (i = 0; (dma_status & PLX_DMA_DONE_BIT) == 0 && i < timeout; i++) { for (i = 0; (dma_status & PLX_DMA_DONE_BIT) == 0 && i < timeout; i++) {
comedi_udelay(1); udelay(1);
dma_status = readb(dma_cs_addr); dma_status = readb(dma_cs_addr);
} }
if (i == timeout) { if (i == timeout) {
rt_printk printk
("plx9080: cancel() timed out waiting for dma %i done set\n", ("plx9080: cancel() timed out waiting for dma %i done set\n",
channel); channel);
return -ETIMEDOUT; return -ETIMEDOUT;

View File

@ -135,7 +135,7 @@ Configuration options:
#define RTD_DMA_TIMEOUT 33000 /* 1 msec */ #define RTD_DMA_TIMEOUT 33000 /* 1 msec */
#else #else
/* by delaying, power and electrical noise are reduced somewhat */ /* by delaying, power and electrical noise are reduced somewhat */
#define WAIT_QUIETLY comedi_udelay (1) #define WAIT_QUIETLY udelay (1)
#define RTD_ADC_TIMEOUT 2000 /* in usec */ #define RTD_ADC_TIMEOUT 2000 /* in usec */
#define RTD_DAC_TIMEOUT 2000 /* in usec */ #define RTD_DAC_TIMEOUT 2000 /* in usec */
#define RTD_DMA_TIMEOUT 1000 /* in usec */ #define RTD_DMA_TIMEOUT 1000 /* in usec */
@ -900,7 +900,7 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it)
/* initialize board, per RTD spec */ /* initialize board, per RTD spec */
/* also, initialize shadow registers */ /* also, initialize shadow registers */
RtdResetBoard(dev); RtdResetBoard(dev);
comedi_udelay(100); /* needed? */ udelay(100); /* needed? */
RtdPlxInterruptWrite(dev, 0); RtdPlxInterruptWrite(dev, 0);
RtdInterruptMask(dev, 0); /* and sets shadow */ RtdInterruptMask(dev, 0); /* and sets shadow */
RtdInterruptClearMask(dev, ~0); /* and sets shadow */ RtdInterruptClearMask(dev, ~0); /* and sets shadow */
@ -919,7 +919,7 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it)
/* TODO: set user out source ??? */ /* TODO: set user out source ??? */
/* check if our interrupt is available and get it */ /* check if our interrupt is available and get it */
ret = comedi_request_irq(devpriv->pci_dev->irq, rtd_interrupt, ret = request_irq(devpriv->pci_dev->irq, rtd_interrupt,
IRQF_SHARED, DRV_NAME, dev); IRQF_SHARED, DRV_NAME, dev);
if (ret < 0) { if (ret < 0) {
@ -1032,7 +1032,7 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it)
/* disable interrupt controller */ /* disable interrupt controller */
RtdPlxInterruptWrite(dev, RtdPlxInterruptRead(dev) RtdPlxInterruptWrite(dev, RtdPlxInterruptRead(dev)
& ~(ICS_PLIE | ICS_DMA0_E | ICS_DMA1_E)); & ~(ICS_PLIE | ICS_DMA0_E | ICS_DMA1_E));
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
} }
/* release all regions that were allocated */ /* release all regions that were allocated */
@ -1111,7 +1111,7 @@ static int rtd_detach(struct comedi_device *dev)
/* disable interrupt controller */ /* disable interrupt controller */
RtdPlxInterruptWrite(dev, RtdPlxInterruptRead(dev) RtdPlxInterruptWrite(dev, RtdPlxInterruptRead(dev)
& ~(ICS_PLIE | ICS_DMA0_E | ICS_DMA1_E)); & ~(ICS_PLIE | ICS_DMA0_E | ICS_DMA1_E));
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
} }
/* release all regions that were allocated */ /* release all regions that were allocated */
@ -1224,7 +1224,7 @@ static int rtd520_probe_fifo_depth(struct comedi_device *dev)
unsigned fifo_status; unsigned fifo_status;
/* trigger conversion */ /* trigger conversion */
RtdAdcStart(dev); RtdAdcStart(dev);
comedi_udelay(1); udelay(1);
fifo_status = RtdFifoStatus(dev); fifo_status = RtdFifoStatus(dev);
if ((fifo_status & FS_ADC_HEMPTY) == 0) { if ((fifo_status & FS_ADC_HEMPTY) == 0) {
fifo_size = 2 * i; fifo_size = 2 * i;
@ -1233,13 +1233,13 @@ static int rtd520_probe_fifo_depth(struct comedi_device *dev)
} }
if (i == limit) if (i == limit)
{ {
rt_printk("\ncomedi: %s: failed to probe fifo size.\n", DRV_NAME); printk("\ncomedi: %s: failed to probe fifo size.\n", DRV_NAME);
return -EIO; return -EIO;
} }
RtdAdcClearFifo(dev); RtdAdcClearFifo(dev);
if (fifo_size != 0x400 && fifo_size != 0x2000) if (fifo_size != 0x400 && fifo_size != 0x2000)
{ {
rt_printk("\ncomedi: %s: unexpected fifo size of %i, expected 1024 or 8192.\n", printk("\ncomedi: %s: unexpected fifo size of %i, expected 1024 or 8192.\n",
DRV_NAME, fifo_size); DRV_NAME, fifo_size);
return -EIO; return -EIO;
} }
@ -1386,7 +1386,7 @@ void abort_dma(struct comedi_device *dev, unsigned int channel)
+ ((channel == 0) ? LCFG_DMACSR0 : LCFG_DMACSR1); + ((channel == 0) ? LCFG_DMACSR0 : LCFG_DMACSR1);
/* spinlock for plx dma control/status reg */ /* spinlock for plx dma control/status reg */
/* comedi_spin_lock_irqsave( &dev->spinlock, flags ); */ /* spin_lock_irqsave( &dev->spinlock, flags ); */
/* abort dma transfer if necessary */ /* abort dma transfer if necessary */
status = readb(dma_cs_addr); status = readb(dma_cs_addr);
@ -1409,7 +1409,7 @@ void abort_dma(struct comedi_device *dev, unsigned int channel)
/* disable channel (required) */ /* disable channel (required) */
writeb(0, dma_cs_addr); writeb(0, dma_cs_addr);
comedi_udelay(1); /* needed?? */ udelay(1); /* needed?? */
/* set abort bit for channel */ /* set abort bit for channel */
writeb(PLX_DMA_ABORT_BIT, dma_cs_addr); writeb(PLX_DMA_ABORT_BIT, dma_cs_addr);
@ -1427,7 +1427,7 @@ void abort_dma(struct comedi_device *dev, unsigned int channel)
} }
abortDmaExit: abortDmaExit:
/* comedi_spin_unlock_irqrestore( &dev->spinlock, flags ); */ /* spin_unlock_irqrestore( &dev->spinlock, flags ); */
} }
/* /*

View File

@ -200,7 +200,7 @@ static int rti800_ai_insn_read(struct comedi_device *dev, struct comedi_subdevic
* gets set, and you will have an error. */ * gets set, and you will have an error. */
if (insn->n > 0) { if (insn->n > 0) {
BUG_ON(gain >= ARRAY_SIZE(gaindelay)); BUG_ON(gain >= ARRAY_SIZE(gaindelay));
comedi_udelay(gaindelay[gain]); udelay(gaindelay[gain]);
} }
} }
@ -209,16 +209,16 @@ static int rti800_ai_insn_read(struct comedi_device *dev, struct comedi_subdevic
for (t = RTI800_TIMEOUT; t; t--) { for (t = RTI800_TIMEOUT; t; t--) {
status = inb(dev->iobase + RTI800_CSR); status = inb(dev->iobase + RTI800_CSR);
if (status & RTI800_OVERRUN) { if (status & RTI800_OVERRUN) {
rt_printk("rti800: a/d overrun\n"); printk("rti800: a/d overrun\n");
outb(0, dev->iobase + RTI800_CLRFLAGS); outb(0, dev->iobase + RTI800_CLRFLAGS);
return -EIO; return -EIO;
} }
if (status & RTI800_DONE) if (status & RTI800_DONE)
break; break;
comedi_udelay(1); udelay(1);
} }
if (t == 0) { if (t == 0) {
rt_printk("rti800: timeout\n"); printk("rti800: timeout\n");
return -ETIME; return -ETIME;
} }
data[i] = inb(dev->iobase + RTI800_ADCLO); data[i] = inb(dev->iobase + RTI800_ADCLO);
@ -338,8 +338,7 @@ static int rti800_attach(struct comedi_device *dev, struct comedi_devconfig *it)
irq = it->options[1]; irq = it->options[1];
if (irq) { if (irq) {
printk("( irq = %u )", irq); printk("( irq = %u )", irq);
ret = comedi_request_irq(irq, rti800_interrupt, 0, ret = request_irq(irq, rti800_interrupt, 0, "rti800", dev);
"rti800", dev);
if (ret < 0) { if (ret < 0) {
printk(" Failed to allocate IRQ\n"); printk(" Failed to allocate IRQ\n");
return ret; return ret;
@ -455,7 +454,7 @@ static int rti800_detach(struct comedi_device *dev)
release_region(dev->iobase, RTI800_SIZE); release_region(dev->iobase, RTI800_SIZE);
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
return 0; return 0;
} }

View File

@ -850,9 +850,9 @@ static int s526_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
} }
} }
if (i == TIMEOUT) { if (i == TIMEOUT) {
/* rt_printk() should be used instead of printk() /* printk() should be used instead of printk()
* whenever the code can be called from real-time. */ * whenever the code can be called from real-time. */
rt_printk("s526: ADC(0x%04x) timeout\n", printk("s526: ADC(0x%04x) timeout\n",
inw(ADDR_REG(REG_ISR))); inw(ADDR_REG(REG_ISR)));
return -ETIMEDOUT; return -ETIMEDOUT;
} }

View File

@ -596,8 +596,8 @@ static int s626_attach(struct comedi_device *dev, struct comedi_devconfig *it)
if (dev->irq == 0) { if (dev->irq == 0) {
printk(" unknown irq (bad)\n"); printk(" unknown irq (bad)\n");
} else { } else {
ret = comedi_request_irq(dev->irq, s626_irq_handler, ret = request_irq(dev->irq, s626_irq_handler, IRQF_SHARED,
IRQF_SHARED, "s626", dev); "s626", dev);
if (ret < 0) { if (ret < 0) {
printk(" irq not available\n"); printk(" irq not available\n");
@ -987,7 +987,7 @@ static irqreturn_t s626_irq_handler(int irq, void *d)
if (dev->attached == 0) if (dev->attached == 0)
return IRQ_NONE; return IRQ_NONE;
/* lock to avoid race with comedi_poll */ /* lock to avoid race with comedi_poll */
comedi_spin_lock_irqsave(&dev->spinlock, flags); spin_lock_irqsave(&dev->spinlock, flags);
/* save interrupt enable register state */ /* save interrupt enable register state */
irqstatus = readl(devpriv->base_addr + P_IER); irqstatus = readl(devpriv->base_addr + P_IER);
@ -1264,7 +1264,7 @@ static irqreturn_t s626_irq_handler(int irq, void *d)
DEBUG("s626_irq_handler: exit interrupt service routine.\n"); DEBUG("s626_irq_handler: exit interrupt service routine.\n");
comedi_spin_unlock_irqrestore(&dev->spinlock, flags); spin_unlock_irqrestore(&dev->spinlock, flags);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
@ -1291,7 +1291,7 @@ static int s626_detach(struct comedi_device *dev)
} }
if (dev->irq) if (dev->irq)
comedi_free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (devpriv->base_addr) if (devpriv->base_addr)
iounmap(devpriv->base_addr); iounmap(devpriv->base_addr);
@ -1574,7 +1574,7 @@ static int s626_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice
for (n = 0; n < insn->n; n++) { for (n = 0; n < insn->n; n++) {
/* Delay 10 microseconds for analog input settling. */ /* Delay 10 microseconds for analog input settling. */
comedi_udelay(10); udelay(10);
/* Start ADC by pulsing GPIO1 low. */ /* Start ADC by pulsing GPIO1 low. */
GpioImage = RR7146(P_GPIO); GpioImage = RR7146(P_GPIO);
@ -1606,7 +1606,7 @@ static int s626_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice
* data value is sometimes set to the previous * data value is sometimes set to the previous
* conversion's data value. * conversion's data value.
*/ */
comedi_udelay(4); udelay(4);
} }
/* Start a dummy conversion to cause the data from the /* Start a dummy conversion to cause the data from the

View File

@ -63,7 +63,7 @@
*/ */
#ifdef _DEBUG_ #ifdef _DEBUG_
#define DEBUG(...); rt_printk(__VA_ARGS__); #define DEBUG(...); printk(__VA_ARGS__);
#else #else
#define DEBUG(...) #define DEBUG(...)
#endif #endif

View File

@ -223,7 +223,7 @@ static int tty_read(struct file *f, int timeout)
result = ch; result = ch;
break; break;
} }
comedi_udelay(100); udelay(100);
} }
} }
set_fs(oldfs); set_fs(oldfs);

View File

@ -331,9 +331,9 @@ static int skel_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
break; break;
} }
if (i == TIMEOUT) { if (i == TIMEOUT) {
/* rt_printk() should be used instead of printk() /* printk() should be used instead of printk()
* whenever the code can be called from real-time. */ * whenever the code can be called from real-time. */
rt_printk("timeout\n"); printk("timeout\n");
return -ETIMEDOUT; return -ETIMEDOUT;
} }

View File

@ -311,7 +311,7 @@ static int __unioxx5_subdev_init(struct comedi_subdevice *subdev, int subdev_iob
usp->usp_module_type[i] = inb(subdev_iobase + 6); usp->usp_module_type[i] = inb(subdev_iobase + 6);
printk(" [%d] 0x%02x |", i, usp->usp_module_type[i]); printk(" [%d] 0x%02x |", i, usp->usp_module_type[i]);
comedi_udelay(1); udelay(1);
} }
printk("\n"); printk("\n");

View File

@ -23,7 +23,7 @@
#include "../comedi.h" #include "../comedi.h"
#include "../comedilib.h" #include "../comedilib.h"
#include "../comedidev.h" /* for comedi_udelay() */ #include "../comedidev.h"
#include <linux/string.h> #include <linux/string.h>
@ -83,7 +83,7 @@ int comedi_data_read_delayed(void *dev, unsigned int subdev,
if (retval < 0) if (retval < 0)
return retval; return retval;
comedi_udelay((nano_sec + 999) / 1000); udelay((nano_sec + 999) / 1000);
return comedi_data_read(dev, subdev, chan, range, aref, data); return comedi_data_read(dev, subdev, chan, range, aref, data);
} }

View File

@ -105,7 +105,7 @@ int comedi_loglevel(int newlevel)
void comedi_perror(const char *message) void comedi_perror(const char *message)
{ {
rt_printk("%s: unknown error\n", message); printk("%s: unknown error\n", message);
} }
char *comedi_strerror(int err) char *comedi_strerror(int err)
@ -208,7 +208,7 @@ int comedi_do_insn(void *d, struct comedi_insn *insn)
ret = -EINVAL; ret = -EINVAL;
break; break;
} }
comedi_udelay(insn->data[0]); udelay(insn->data[0]);
ret = 1; ret = 1;
break; break;
case INSN_INTTRIG: case INSN_INTTRIG:
@ -217,19 +217,19 @@ int comedi_do_insn(void *d, struct comedi_insn *insn)
break; break;
} }
if (insn->subdev >= dev->n_subdevices) { if (insn->subdev >= dev->n_subdevices) {
rt_printk("%d not usable subdevice\n", printk("%d not usable subdevice\n",
insn->subdev); insn->subdev);
ret = -EINVAL; ret = -EINVAL;
break; break;
} }
s = dev->subdevices + insn->subdev; s = dev->subdevices + insn->subdev;
if (!s->async) { if (!s->async) {
rt_printk("no async\n"); printk("no async\n");
ret = -EINVAL; ret = -EINVAL;
break; break;
} }
if (!s->async->inttrig) { if (!s->async->inttrig) {
rt_printk("no inttrig\n"); printk("no inttrig\n");
ret = -EAGAIN; ret = -EAGAIN;
break; break;
} }
@ -249,7 +249,7 @@ int comedi_do_insn(void *d, struct comedi_insn *insn)
s = dev->subdevices + insn->subdev; s = dev->subdevices + insn->subdev;
if (s->type == COMEDI_SUBD_UNUSED) { if (s->type == COMEDI_SUBD_UNUSED) {
rt_printk("%d not useable subdevice\n", insn->subdev); printk("%d not useable subdevice\n", insn->subdev);
ret = -EIO; ret = -EIO;
goto error; goto error;
} }
@ -258,7 +258,7 @@ int comedi_do_insn(void *d, struct comedi_insn *insn)
ret = check_chanlist(s, 1, &insn->chanspec); ret = check_chanlist(s, 1, &insn->chanspec);
if (ret < 0) { if (ret < 0) {
rt_printk("bad chanspec\n"); printk("bad chanspec\n");
ret = -EINVAL; ret = -EINVAL;
goto error; goto error;
} }
@ -295,7 +295,7 @@ int comedi_do_insn(void *d, struct comedi_insn *insn)
#if 0 #if 0
/* XXX do we want this? -- abbotti #if'ed it out for now. */ /* XXX do we want this? -- abbotti #if'ed it out for now. */
if (ret != insn->n) { if (ret != insn->n) {
rt_printk("BUG: result of insn != insn.n\n"); printk("BUG: result of insn != insn.n\n");
ret = -EINVAL; ret = -EINVAL;
goto error; goto error;
} }
@ -336,7 +336,7 @@ int comedi_lock(void *d, unsigned int subdevice)
s = dev->subdevices + subdevice; s = dev->subdevices + subdevice;
comedi_spin_lock_irqsave(&s->spin_lock, flags); spin_lock_irqsave(&s->spin_lock, flags);
if (s->busy) { if (s->busy) {
ret = -EBUSY; ret = -EBUSY;
@ -348,7 +348,7 @@ int comedi_lock(void *d, unsigned int subdevice)
} }
} }
comedi_spin_unlock_irqrestore(&s->spin_lock, flags); spin_unlock_irqrestore(&s->spin_lock, flags);
return ret; return ret;
} }
@ -382,7 +382,7 @@ int comedi_unlock(void *d, unsigned int subdevice)
async = s->async; async = s->async;
comedi_spin_lock_irqsave(&s->spin_lock, flags); spin_lock_irqsave(&s->spin_lock, flags);
if (s->busy) { if (s->busy) {
ret = -EBUSY; ret = -EBUSY;
@ -400,7 +400,7 @@ int comedi_unlock(void *d, unsigned int subdevice)
ret = 0; ret = 0;
} }
comedi_spin_unlock_irqrestore(&s->spin_lock, flags); spin_unlock_irqrestore(&s->spin_lock, flags);
return ret; return ret;
} }

View File

@ -130,8 +130,7 @@ int check_chanlist(struct comedi_subdevice *s, int n, unsigned int *chanlist)
if (CR_CHAN(chanlist[i]) >= s->n_chan || if (CR_CHAN(chanlist[i]) >= s->n_chan ||
CR_RANGE(chanlist[i]) >= s->range_table->length CR_RANGE(chanlist[i]) >= s->range_table->length
|| aref_invalid(s, chanlist[i])) { || aref_invalid(s, chanlist[i])) {
rt_printk printk("bad chanlist[%d]=0x%08x n_chan=%d range length=%d\n",
("bad chanlist[%d]=0x%08x n_chan=%d range length=%d\n",
i, chanlist[i], s->n_chan, i, chanlist[i], s->n_chan,
s->range_table->length); s->range_table->length);
#if 0 #if 0
@ -147,13 +146,13 @@ int check_chanlist(struct comedi_subdevice *s, int n, unsigned int *chanlist)
CR_RANGE(chanlist[i]) >= CR_RANGE(chanlist[i]) >=
s->range_table_list[chan]->length s->range_table_list[chan]->length
|| aref_invalid(s, chanlist[i])) { || aref_invalid(s, chanlist[i])) {
rt_printk("bad chanlist[%d]=0x%08x\n", i, printk("bad chanlist[%d]=0x%08x\n", i,
chanlist[i]); chanlist[i]);
return -EINVAL; return -EINVAL;
} }
} }
} else { } else {
rt_printk("comedi: (bug) no range type list!\n"); printk("comedi: (bug) no range type list!\n");
return -EINVAL; return -EINVAL;
} }
return 0; return 0;