#include "8253.h"
#include "amcc_s5933.h"
-/* hardware types of the cards */
-#define TYPE_PCI171X 0
-#define TYPE_PCI1713 2
-#define TYPE_PCI1720 3
-
#define PCI171x_AD_DATA 0 /* R: A/D data */
#define PCI171x_SOFTTRG 0 /* W: soft trigger for A/D */
#define PCI171x_RANGE 2 /* W: A/D gain/range register */
struct boardtype {
const char *name; /* board name */
- char cardtype; /* 0=1710& co. 2=1713, ... */
int n_aichan; /* num of A/D chans */
const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */
const char *rangecode_ai; /* range codes for programming */
+ unsigned int is_pci1713:1;
+ unsigned int is_pci1720:1;
unsigned int has_irq:1;
unsigned int has_large_fifo:1; /* 4K or 1K FIFO */
unsigned int has_diff_ai:1;
static const struct boardtype boardtypes[] = {
[BOARD_PCI1710] = {
.name = "pci1710",
- .cardtype = TYPE_PCI171X,
.n_aichan = 16,
.rangelist_ai = &range_pci1710_3,
.rangecode_ai = range_codes_pci1710_3,
},
[BOARD_PCI1710HG] = {
.name = "pci1710hg",
- .cardtype = TYPE_PCI171X,
.n_aichan = 16,
.rangelist_ai = &range_pci1710hg,
.rangecode_ai = range_codes_pci1710hg,
},
[BOARD_PCI1711] = {
.name = "pci1711",
- .cardtype = TYPE_PCI171X,
.n_aichan = 16,
.rangelist_ai = &range_pci17x1,
.rangecode_ai = range_codes_pci17x1,
},
[BOARD_PCI1713] = {
.name = "pci1713",
- .cardtype = TYPE_PCI1713,
.n_aichan = 32,
.rangelist_ai = &range_pci1710_3,
.rangecode_ai = range_codes_pci1710_3,
+ .is_pci1713 = 1,
.has_irq = 1,
.has_large_fifo = 1,
.has_diff_ai = 1,
},
[BOARD_PCI1720] = {
.name = "pci1720",
- .cardtype = TYPE_PCI1720,
+ .is_pci1720 = 1,
.has_ao = 1,
},
[BOARD_PCI1731] = {
.name = "pci1731",
- .cardtype = TYPE_PCI171X,
.n_aichan = 16,
.rangelist_ai = &range_pci17x1,
.rangecode_ai = range_codes_pci17x1,
const struct boardtype *board = dev->board_ptr;
struct pci1710_private *devpriv = dev->private;
- if (board->cardtype != TYPE_PCI1713) {
+ if (!board->is_pci1713) {
if ((val & 0xf000) != devpriv->act_chanlist[chan]) {
dev_err(dev->class_dev,
"A/D data droput: received from channel %d, expected %d\n",
static int pci171x_ai_cancel(struct comedi_device *dev,
struct comedi_subdevice *s)
{
- const struct boardtype *board = dev->board_ptr;
struct pci1710_private *devpriv = dev->private;
- switch (board->cardtype) {
- default:
- devpriv->CntrlReg &= Control_CNT0;
- devpriv->CntrlReg |= Control_SW;
- /* reset any operations */
- outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL);
- pci171x_start_pacer(dev, false);
- outb(0, dev->iobase + PCI171x_CLRFIFO);
- outb(0, dev->iobase + PCI171x_CLRINT);
- break;
- }
+ devpriv->CntrlReg &= Control_CNT0;
+ devpriv->CntrlReg |= Control_SW;
+ /* reset any operations */
+ outw(devpriv->CntrlReg, dev->iobase + PCI171x_CONTROL);
+ pci171x_start_pacer(dev, false);
+ outb(0, dev->iobase + PCI171x_CLRFIFO);
+ outb(0, dev->iobase + PCI171x_CLRINT);
return 0;
}
{
const struct boardtype *board = dev->board_ptr;
- switch (board->cardtype) {
- case TYPE_PCI1720:
+ if (board->is_pci1720)
return pci1720_reset(dev);
- default:
- return pci171x_reset(dev);
- }
+
+ return pci171x_reset(dev);
}
static int pci1710_auto_attach(struct comedi_device *dev,
s->type = COMEDI_SUBD_AO;
s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON;
s->maxdata = 0x0fff;
- switch (board->cardtype) {
- case TYPE_PCI1720:
+ if (board->is_pci1720) {
s->n_chan = 4;
s->range_table = &pci1720_ao_range;
s->insn_write = pci1720_ao_insn_write;
- break;
- default:
+ } else {
s->n_chan = 2;
s->range_table = &pci171x_ao_range;
s->insn_write = pci171x_ao_insn_write;
- break;
}
ret = comedi_alloc_subdev_readback(s);
return ret;
/* initialize the readback values to match the board reset */
- if (board->cardtype == TYPE_PCI1720) {
+ if (board->is_pci1720) {
int i;
for (i = 0; i < s->n_chan; i++)