You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
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:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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 */
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
@@ -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");
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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 */
|
||||||
|
|||||||
@@ -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*/
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ TODO:
|
|||||||
/* #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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user