Commit 242467bd authored by Maurice Dawson's avatar Maurice Dawson Committed by Greg Kroah-Hartman

Staging: comedi: fix 80 character coding style issue in adl_pci9118.c

Fixes all over 80 character warnings in the adl_pci9118.c file found by the checkpatch.pl tool
Signed-off-by: default avatarMaurice Dawson <mauricedawson2699@googlemail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent d607c781
...@@ -75,9 +75,15 @@ Configuration options: ...@@ -75,9 +75,15 @@ Configuration options:
#include "comedi_fc.h" #include "comedi_fc.h"
/* paranoid checks are broken */ /* paranoid checks are broken */
#undef PCI9118_PARANOIDCHECK /* if defined, then is used code which control correct channel number on every 12 bit sample */ #undef PCI9118_PARANOIDCHECK /*
* if defined, then is used code which control
* correct channel number on every 12 bit sample
*/
#undef PCI9118_EXTDEBUG /* if defined then driver prints a lot of messages */ #undef PCI9118_EXTDEBUG /*
* if defined then driver prints
* a lot of messages
*/
#undef DPRINTK #undef DPRINTK
#ifdef PCI9118_EXTDEBUG #ifdef PCI9118_EXTDEBUG
...@@ -87,7 +93,10 @@ Configuration options: ...@@ -87,7 +93,10 @@ Configuration options:
#endif #endif
#define IORANGE_9118 64 /* I hope */ #define IORANGE_9118 64 /* I hope */
#define PCI9118_CHANLEN 255 /* len of chanlist, some source say 256, but reality looks like 255 :-( */ #define PCI9118_CHANLEN 255 /*
* len of chanlist, some source say 256,
* but reality looks like 255 :-(
*/
#define PCI9118_CNT0 0x00 /* R/W: 8254 counter 0 */ #define PCI9118_CNT0 0x00 /* R/W: 8254 counter 0 */
#define PCI9118_CNT1 0x04 /* R/W: 8254 counter 0 */ #define PCI9118_CNT1 0x04 /* R/W: 8254 counter 0 */
...@@ -113,20 +122,47 @@ Configuration options: ...@@ -113,20 +122,47 @@ Configuration options:
#define AdControl_UniP 0x80 /* 1=bipolar, 0=unipolar */ #define AdControl_UniP 0x80 /* 1=bipolar, 0=unipolar */
#define AdControl_Diff 0x40 /* 1=differential, 0= single end inputs */ #define AdControl_Diff 0x40 /* 1=differential, 0= single end inputs */
#define AdControl_SoftG 0x20 /* 1=8254 counter works, 0=counter stops */ #define AdControl_SoftG 0x20 /* 1=8254 counter works, 0=counter stops */
#define AdControl_ExtG 0x10 /* 1=8254 countrol controlled by TGIN(pin 46), 0=controled by SoftG */ #define AdControl_ExtG 0x10 /*
#define AdControl_ExtM 0x08 /* 1=external hardware trigger (pin 44), 0=internal trigger */ * 1=8254 countrol controlled by TGIN(pin 46),
#define AdControl_TmrTr 0x04 /* 1=8254 is iternal trigger source, 0=software trigger is source (register PCI9118_SOFTTRG) */ * 0=controlled by SoftG
*/
#define AdControl_ExtM 0x08 /*
* 1=external hardware trigger (pin 44),
* 0=internal trigger
*/
#define AdControl_TmrTr 0x04 /*
* 1=8254 is iternal trigger source,
* 0=software trigger is source
* (register PCI9118_SOFTTRG)
*/
#define AdControl_Int 0x02 /* 1=enable INT, 0=disable */ #define AdControl_Int 0x02 /* 1=enable INT, 0=disable */
#define AdControl_Dma 0x01 /* 1=enable DMA, 0=disable */ #define AdControl_Dma 0x01 /* 1=enable DMA, 0=disable */
/* bits from A/D function register (PCI9118_ADFUNC) */ /* bits from A/D function register (PCI9118_ADFUNC) */
#define AdFunction_PDTrg 0x80 /* 1=positive, 0=negative digital trigger (only positive is correct) */ #define AdFunction_PDTrg 0x80 /*
#define AdFunction_PETrg 0x40 /* 1=positive, 0=negative external trigger (only positive is correct) */ * 1=positive,
* 0=negative digital trigger
* (only positive is correct)
*/
#define AdFunction_PETrg 0x40 /*
* 1=positive,
* 0=negative external trigger
* (only positive is correct)
*/
#define AdFunction_BSSH 0x20 /* 1=with sample&hold, 0=without */ #define AdFunction_BSSH 0x20 /* 1=with sample&hold, 0=without */
#define AdFunction_BM 0x10 /* 1=burst mode, 0=normal mode */ #define AdFunction_BM 0x10 /* 1=burst mode, 0=normal mode */
#define AdFunction_BS 0x08 /* 1=burst mode start, 0=burst mode stop */ #define AdFunction_BS 0x08 /*
#define AdFunction_PM 0x04 /* 1=post trigger mode, 0=not post trigger */ * 1=burst mode start,
#define AdFunction_AM 0x02 /* 1=about trigger mode, 0=not about trigger */ * 0=burst mode stop
*/
#define AdFunction_PM 0x04 /*
* 1=post trigger mode,
* 0=not post trigger
*/
#define AdFunction_AM 0x02 /*
* 1=about trigger mode,
* 0=not about trigger
*/
#define AdFunction_Start 0x01 /* 1=trigger start, 0=trigger stop */ #define AdFunction_Start 0x01 /* 1=trigger start, 0=trigger stop */
/* bits from A/D status register (PCI9118_ADSTAT) */ /* bits from A/D status register (PCI9118_ADSTAT) */
...@@ -178,7 +214,10 @@ static const struct comedi_lrange range_pci9118hg = { 8, { ...@@ -178,7 +214,10 @@ static const struct comedi_lrange range_pci9118hg = { 8, {
} }
}; };
#define PCI9118_BIPOLAR_RANGES 4 /* used for test on mixture of BIP/UNI ranges */ #define PCI9118_BIPOLAR_RANGES 4 /*
* used for test on mixture
* of BIP/UNI ranges
*/
static int pci9118_attach(struct comedi_device *dev, static int pci9118_attach(struct comedi_device *dev,
struct comedi_devconfig *it); struct comedi_devconfig *it);
...@@ -192,7 +231,10 @@ struct boardtype { ...@@ -192,7 +231,10 @@ struct boardtype {
int iorange_9118; /* pass thru card region size */ int iorange_9118; /* pass thru card region size */
int n_aichan; /* num of A/D chans */ int n_aichan; /* num of A/D chans */
int n_aichand; /* num of A/D chans in diff mode */ int n_aichand; /* num of A/D chans in diff mode */
int mux_aichan; /* num of A/D chans with external multiplexor */ int mux_aichan; /*
* num of A/D chans with
* external multiplexor
*/
int n_aichanlist; /* len of chanlist */ int n_aichanlist; /* len of chanlist */
int n_aochan; /* num of D/A chans */ int n_aochan; /* num of D/A chans */
int ai_maxdata; /* resolution of A/D */ int ai_maxdata; /* resolution of A/D */
...@@ -200,7 +242,10 @@ struct boardtype { ...@@ -200,7 +242,10 @@ struct boardtype {
const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */ const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */
const struct comedi_lrange *rangelist_ao; /* rangelist for D/A */ const struct comedi_lrange *rangelist_ao; /* rangelist for D/A */
unsigned int ai_ns_min; /* max sample speed of card v ns */ unsigned int ai_ns_min; /* max sample speed of card v ns */
unsigned int ai_pacer_min; /* minimal pacer value (c1*c2 or c1 in burst) */ unsigned int ai_pacer_min; /*
* minimal pacer value
* (c1*c2 or c1 in burst)
*/
int half_fifo_size; /* size of FIFO/2 */ int half_fifo_size; /* size of FIFO/2 */
}; };
...@@ -251,7 +296,10 @@ struct pci9118_private { ...@@ -251,7 +296,10 @@ struct pci9118_private {
struct pci_dev *pcidev; /* ptr to actual pcidev */ struct pci_dev *pcidev; /* ptr to actual pcidev */
unsigned int usemux; /* we want to use external multiplexor! */ unsigned int usemux; /* we want to use external multiplexor! */
#ifdef PCI9118_PARANOIDCHECK #ifdef PCI9118_PARANOIDCHECK
unsigned short chanlist[PCI9118_CHANLEN + 1]; /* list of scaned channel */ unsigned short chanlist[PCI9118_CHANLEN + 1]; /*
* list of
* scanned channel
*/
unsigned char chanlistlen; /* number of scanlist */ unsigned char chanlistlen; /* number of scanlist */
#endif #endif
unsigned char AdControlReg; /* A/D control register */ unsigned char AdControlReg; /* A/D control register */
...@@ -265,41 +313,88 @@ struct pci9118_private { ...@@ -265,41 +313,88 @@ struct pci9118_private {
unsigned int ai_buf_ptr; /* data buffer ptr in samples */ unsigned int ai_buf_ptr; /* data buffer ptr in samples */
unsigned int ai_n_chan; /* how many channels is measured */ unsigned int ai_n_chan; /* how many channels is measured */
unsigned int ai_n_scanlen; /* len of actual scanlist */ unsigned int ai_n_scanlen; /* len of actual scanlist */
unsigned int ai_n_realscanlen; /* what we must transfer for one outgoing scan include front/back adds */ unsigned int ai_n_realscanlen; /*
* what we must transfer for one
* outgoing scan include front/back adds
*/
unsigned int ai_act_dmapos; /* position in actual real stream */ unsigned int ai_act_dmapos; /* position in actual real stream */
unsigned int ai_add_front; /* how many channels we must add before scan to satisfy S&H? */ unsigned int ai_add_front; /*
unsigned int ai_add_back; /* how many channels we must add before scan to satisfy DMA? */ * how many channels we must add
unsigned int *ai_chanlist; /* actaul chanlist */ * before scan to satisfy S&H?
*/
unsigned int ai_add_back; /*
* how many channels we must add
* before scan to satisfy DMA?
*/
unsigned int *ai_chanlist; /* actual chanlist */
unsigned int ai_timer1; unsigned int ai_timer1;
unsigned int ai_timer2; unsigned int ai_timer2;
unsigned int ai_flags; unsigned int ai_flags;
char ai12_startstop; /* measure can start/stop on external trigger */ char ai12_startstop; /*
unsigned int ai_divisor1, ai_divisor2; /* divisors for start of measure on external start */ * measure can start/stop
* on external trigger
*/
unsigned int ai_divisor1, ai_divisor2; /*
* divisors for start of measure
* on external start
*/
unsigned int ai_data_len; unsigned int ai_data_len;
short *ai_data; short *ai_data;
short ao_data[2]; /* data output buffer */ short ao_data[2]; /* data output buffer */
unsigned int ai_scans; /* number of scans to do */ unsigned int ai_scans; /* number of scans to do */
char dma_doublebuf; /* we can use double buffring */ char dma_doublebuf; /* we can use double buffring */
unsigned int dma_actbuf; /* which buffer is used now */ unsigned int dma_actbuf; /* which buffer is used now */
short *dmabuf_virt[2]; /* pointers to begin of DMA buffer */ short *dmabuf_virt[2]; /*
* pointers to begin of
* DMA buffer
*/
unsigned long dmabuf_hw[2]; /* hw address of DMA buff */ unsigned long dmabuf_hw[2]; /* hw address of DMA buff */
unsigned int dmabuf_size[2]; /* size of dma buffer in bytes */ unsigned int dmabuf_size[2]; /*
unsigned int dmabuf_use_size[2]; /* which size we may now used for transfer */ * size of dma buffer in bytes
unsigned int dmabuf_used_size[2]; /* which size was trully used */ */
unsigned int dmabuf_use_size[2]; /*
* which size we may now use
* for transfer
*/
unsigned int dmabuf_used_size[2]; /* which size was truly used */
unsigned int dmabuf_panic_size[2]; unsigned int dmabuf_panic_size[2];
unsigned int dmabuf_samples[2]; /* size in samples */ unsigned int dmabuf_samples[2]; /* size in samples */
int dmabuf_pages[2]; /* number of pages in buffer */ int dmabuf_pages[2]; /* number of pages in buffer */
unsigned char cnt0_users; /* bit field of 8254 CNT0 users (0-unused, 1-AO, 2-DI, 3-DO) */ unsigned char cnt0_users; /*
unsigned char exttrg_users; /* bit field of external trigger users (0-AI, 1-AO, 2-DI, 3-DO) */ * bit field of 8254 CNT0 users
* (0-unused, 1-AO, 2-DI, 3-DO)
*/
unsigned char exttrg_users; /*
* bit field of external trigger
* users(0-AI, 1-AO, 2-DI, 3-DO)
*/
unsigned int cnt0_divisor; /* actual CNT0 divisor */ unsigned int cnt0_divisor; /* actual CNT0 divisor */
void (*int_ai_func) (struct comedi_device *, struct comedi_subdevice *, unsigned short, unsigned int, unsigned short); /* ptr to actual interrupt AI function */ void (*int_ai_func) (struct comedi_device *, struct comedi_subdevice *,
unsigned short,
unsigned int,
unsigned short); /*
* ptr to actual interrupt
* AI function
*/
unsigned char ai16bits; /* =1 16 bit card */ unsigned char ai16bits; /* =1 16 bit card */
unsigned char usedma; /* =1 use DMA transfer and not INT */ unsigned char usedma; /* =1 use DMA transfer and not INT */
unsigned char useeoshandle; /* =1 change WAKE_EOS DMA transfer to fit on every second */ unsigned char useeoshandle; /*
* =1 change WAKE_EOS DMA transfer
* to fit on every second
*/
unsigned char usessh; /* =1 turn on S&H support */ unsigned char usessh; /* =1 turn on S&H support */
int softsshdelay; /* >0 use software S&H, numer is requested delay in ns */ int softsshdelay; /*
unsigned char softsshsample; /* polarity of S&H signal in sample state */ * >0 use software S&H,
unsigned char softsshhold; /* polarity of S&H signal in hold state */ * numer is requested delay in ns
*/
unsigned char softsshsample; /*
* polarity of S&H signal
* in sample state
*/
unsigned char softsshhold; /*
* polarity of S&H signal
* in hold state
*/
unsigned int ai_maskerr; /* which warning was printed */ unsigned int ai_maskerr; /* which warning was printed */
unsigned int ai_maskharderr; /* on which error bits stops */ unsigned int ai_maskharderr; /* on which error bits stops */
unsigned int ai_inttrig_start; /* TRIG_INT for start */ unsigned int ai_inttrig_start; /* TRIG_INT for start */
...@@ -346,7 +441,14 @@ static int pci9118_insn_read_ai(struct comedi_device *dev, ...@@ -346,7 +441,14 @@ static int pci9118_insn_read_ai(struct comedi_device *dev,
devpriv->AdControlReg = AdControl_Int & 0xff; devpriv->AdControlReg = AdControl_Int & 0xff;
devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg; devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg;
outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); /* positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop */ outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC);
/*
* positive triggers, no S&H,
* no burst, burst stop,
* no post trigger,
* no about trigger,
* trigger stop
*/
if (!setup_channel_list(dev, s, 1, &insn->chanspec, 0, 0, 0, 0, 0)) if (!setup_channel_list(dev, s, 1, &insn->chanspec, 0, 0, 0, 0, 0))
return -EINVAL; return -EINVAL;
...@@ -590,9 +692,11 @@ static void interrupt_pci9118_ai_onesample(struct comedi_device *dev, ...@@ -590,9 +692,11 @@ 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! */
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]);
s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA;
...@@ -604,11 +708,13 @@ static void interrupt_pci9118_ai_onesample(struct comedi_device *dev, ...@@ -604,11 +708,13 @@ static void interrupt_pci9118_ai_onesample(struct comedi_device *dev,
#endif #endif
cfc_write_to_buffer(s, sampl); cfc_write_to_buffer(s, sampl);
s->async->cur_chan++; s->async->cur_chan++;
if (s->async->cur_chan >= devpriv->ai_n_scanlen) { /* one scan done */ if (s->async->cur_chan >= devpriv->ai_n_scanlen) {
/* one scan done */
s->async->cur_chan %= devpriv->ai_n_scanlen; s->async->cur_chan %= devpriv->ai_n_scanlen;
devpriv->ai_act_scan++; devpriv->ai_act_scan++;
if (!(devpriv->ai_neverending)) if (!(devpriv->ai_neverending))
if (devpriv->ai_act_scan >= devpriv->ai_scans) { /* all data sampled */ if (devpriv->ai_act_scan >= devpriv->ai_scans) {
/* all data sampled */
pci9118_ai_cancel(dev, s); pci9118_ai_cancel(dev, s);
s->async->events |= COMEDI_CB_EOA; s->async->events |= COMEDI_CB_EOA;
} }
...@@ -650,10 +756,14 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev, ...@@ -650,10 +756,14 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev,
if (pci9118_decode_error_status(dev, s, int_adstat)) if (pci9118_decode_error_status(dev, s, int_adstat))
return; return;
samplesinbuf = devpriv->dmabuf_use_size[devpriv->dma_actbuf] >> 1; /* number of received real samples */ samplesinbuf = devpriv->dmabuf_use_size[devpriv->dma_actbuf] >> 1;
/* number of received real samples */
/* DPRINTK("dma_actbuf=%d\n",devpriv->dma_actbuf); */ /* DPRINTK("dma_actbuf=%d\n",devpriv->dma_actbuf); */
if (devpriv->dma_doublebuf) { /* switch DMA buffers if is used double buffering */ if (devpriv->dma_doublebuf) { /*
* switch DMA buffers if is used
* double buffering
*/
next_dma_buf = 1 - devpriv->dma_actbuf; next_dma_buf = 1 - devpriv->dma_actbuf;
outl(devpriv->dmabuf_hw[next_dma_buf], outl(devpriv->dmabuf_hw[next_dma_buf],
devpriv->iobase_a + AMCC_OP_REG_MWAR); devpriv->iobase_a + AMCC_OP_REG_MWAR);
...@@ -666,8 +776,14 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev, ...@@ -666,8 +776,14 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev,
} }
if (samplesinbuf) { if (samplesinbuf) {
m = devpriv->ai_data_len >> 1; /* how many samples is to end of buffer */ m = devpriv->ai_data_len >> 1; /*
/* DPRINTK("samps=%d m=%d %d %d\n",samplesinbuf,m,s->async->buf_int_count,s->async->buf_int_ptr); */ * how many samples is to
* end of buffer
*/
/*
* DPRINTK("samps=%d m=%d %d %d\n",
* samplesinbuf,m,s->async->buf_int_count,s->async->buf_int_ptr);
*/
sampls = m; sampls = m;
move_block_from_dma(dev, s, move_block_from_dma(dev, s,
devpriv->dmabuf_virt[devpriv->dma_actbuf], devpriv->dmabuf_virt[devpriv->dma_actbuf],
...@@ -677,7 +793,8 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev, ...@@ -677,7 +793,8 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev,
/* DPRINTK("YYY\n"); */ /* DPRINTK("YYY\n"); */
if (!devpriv->ai_neverending) if (!devpriv->ai_neverending)
if (devpriv->ai_act_scan >= devpriv->ai_scans) { /* all data sampled */ if (devpriv->ai_act_scan >= devpriv->ai_scans) {
/* all data sampled */
pci9118_ai_cancel(dev, s); pci9118_ai_cancel(dev, s);
s->async->events |= COMEDI_CB_EOA; s->async->events |= COMEDI_CB_EOA;
} }
...@@ -707,28 +824,45 @@ static irqreturn_t interrupt_pci9118(int irq, void *d) ...@@ -707,28 +824,45 @@ static irqreturn_t interrupt_pci9118(int irq, void *d)
if (!dev->attached) if (!dev->attached)
return IRQ_NONE; /* not fully initialized */ return IRQ_NONE; /* not fully initialized */
int_daq = inl(dev->iobase + PCI9118_INTSRC) & 0xf; /* get IRQ reasons from card */ int_daq = inl(dev->iobase + PCI9118_INTSRC) & 0xf;
int_amcc = inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* get INT register from AMCC chip */ /* get IRQ reasons from card */
int_amcc = inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR);
/* get INT register from AMCC chip */
/* DPRINTK("INT daq=0x%01x amcc=0x%08x MWAR=0x%08x MWTC=0x%08x ADSTAT=0x%02x ai_do=%d\n", int_daq, int_amcc, inl(devpriv->iobase_a+AMCC_OP_REG_MWAR), inl(devpriv->iobase_a+AMCC_OP_REG_MWTC), inw(dev->iobase+PCI9118_ADSTAT)&0x1ff,devpriv->ai_do); */ /*
* DPRINTK("INT daq=0x%01x amcc=0x%08x MWAR=0x%08x
* MWTC=0x%08x ADSTAT=0x%02x ai_do=%d\n",
* int_daq, int_amcc, inl(devpriv->iobase_a+AMCC_OP_REG_MWAR),
* inl(devpriv->iobase_a+AMCC_OP_REG_MWTC),
* inw(dev->iobase+PCI9118_ADSTAT)&0x1ff,devpriv->ai_do);
*/
if ((!int_daq) && (!(int_amcc & ANY_S593X_INT))) if ((!int_daq) && (!(int_amcc & ANY_S593X_INT)))
return IRQ_NONE; /* interrupt from other source */ return IRQ_NONE; /* interrupt from other source */
outl(int_amcc | 0x00ff0000, devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* shutdown IRQ reasons in AMCC */ outl(int_amcc | 0x00ff0000, devpriv->iobase_a + AMCC_OP_REG_INTCSR);
/* shutdown IRQ reasons in AMCC */
int_adstat = inw(dev->iobase + PCI9118_ADSTAT) & 0x1ff; /* get STATUS register */ int_adstat = inw(dev->iobase + PCI9118_ADSTAT) & 0x1ff;
/* get STATUS register */
if (devpriv->ai_do) { if (devpriv->ai_do) {
if (devpriv->ai12_startstop) if (devpriv->ai12_startstop)
if ((int_adstat & AdStatus_DTH) && (int_daq & Int_DTrg)) { /* start stop of measure */ if ((int_adstat & AdStatus_DTH) &&
(int_daq & Int_DTrg)) {
/* start stop of measure */
if (devpriv->ai12_startstop & START_AI_EXT) { if (devpriv->ai12_startstop & START_AI_EXT) {
devpriv->ai12_startstop &= devpriv->ai12_startstop &=
~START_AI_EXT; ~START_AI_EXT;
if (!(devpriv->ai12_startstop & if (!(devpriv->ai12_startstop &
STOP_AI_EXT)) STOP_AI_EXT))
pci9118_exttrg_del(dev, EXTTRG_AI); /* deactivate EXT trigger */ pci9118_exttrg_del
start_pacer(dev, devpriv->ai_do, devpriv->ai_divisor1, devpriv->ai_divisor2); /* start pacer */ (dev, EXTTRG_AI);
/* deactivate EXT trigger */
start_pacer(dev, devpriv->ai_do,
devpriv->ai_divisor1,
devpriv->ai_divisor2);
/* start pacer */
outl(devpriv->AdControlReg, outl(devpriv->AdControlReg,
dev->iobase + PCI9118_ADCNTRL); dev->iobase + PCI9118_ADCNTRL);
} else { } else {
...@@ -736,8 +870,14 @@ static irqreturn_t interrupt_pci9118(int irq, void *d) ...@@ -736,8 +870,14 @@ static irqreturn_t interrupt_pci9118(int irq, void *d)
STOP_AI_EXT) { STOP_AI_EXT) {
devpriv->ai12_startstop &= devpriv->ai12_startstop &=
~STOP_AI_EXT; ~STOP_AI_EXT;
pci9118_exttrg_del(dev, EXTTRG_AI); /* deactivate EXT trigger */ pci9118_exttrg_del
devpriv->ai_neverending = 0; /* well, on next interrupt from DMA/EOC measure will stop */ (dev, EXTTRG_AI);
/* deactivate EXT trigger */
devpriv->ai_neverending = 0;
/*
* well, on next interrupt from
* DMA/EOC measure will stop
*/
} }
} }
} }
...@@ -821,7 +961,11 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, ...@@ -821,7 +961,11 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev,
if (err) if (err)
return 1; return 1;
/* step 2: make sure trigger sources are unique and mutually compatible */ /*
* step 2:
* make sure trigger sources are
* unique and mutually compatible
*/
if (cmd->start_src != TRIG_NOW && if (cmd->start_src != TRIG_NOW &&
cmd->start_src != TRIG_INT && cmd->start_src != TRIG_EXT) { cmd->start_src != TRIG_INT && cmd->start_src != TRIG_EXT) {
...@@ -1045,10 +1189,14 @@ static int Compute_and_setup_dma(struct comedi_device *dev) ...@@ -1045,10 +1189,14 @@ static int Compute_and_setup_dma(struct comedi_device *dev)
devpriv->ai_data_len); devpriv->ai_data_len);
/* isn't output buff smaller that our DMA buff? */ /* isn't output buff smaller that our DMA buff? */
if (dmalen0 > (devpriv->ai_data_len)) { if (dmalen0 > (devpriv->ai_data_len)) {
dmalen0 = devpriv->ai_data_len & ~3L; /* allign to 32bit down */ dmalen0 = devpriv->ai_data_len & ~3L; /*
* align to 32bit down
*/
} }
if (dmalen1 > (devpriv->ai_data_len)) { if (dmalen1 > (devpriv->ai_data_len)) {
dmalen1 = devpriv->ai_data_len & ~3L; /* allign to 32bit down */ dmalen1 = devpriv->ai_data_len & ~3L; /*
* align to 32bit down
*/
} }
DPRINTK("2 dmalen0=%d dmalen1=%d \n", dmalen0, dmalen1); DPRINTK("2 dmalen0=%d dmalen1=%d \n", dmalen0, dmalen1);
...@@ -1058,21 +1206,24 @@ static int Compute_and_setup_dma(struct comedi_device *dev) ...@@ -1058,21 +1206,24 @@ static int Compute_and_setup_dma(struct comedi_device *dev)
/* 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);
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, can't "
"support TRIG_WAKE_EOS (%d<%d)\n",
dev->minor, dmalen0, dev->minor, dmalen0,
devpriv->ai_n_realscanlen << 1); devpriv->ai_n_realscanlen << 1);
} else { } else {
/* short first DMA buffer to one scan */ /* short first DMA buffer to one scan */
dmalen0 = devpriv->ai_n_realscanlen << 1; dmalen0 = devpriv->ai_n_realscanlen << 1;
DPRINTK DPRINTK
("21 dmalen0=%d ai_n_realscanlen=%d useeoshandle=%d\n", ("21 dmalen0=%d ai_n_realscanlen=%d "
"useeoshandle=%d\n",
dmalen0, devpriv->ai_n_realscanlen, dmalen0, devpriv->ai_n_realscanlen,
devpriv->useeoshandle); devpriv->useeoshandle);
if (devpriv->useeoshandle) if (devpriv->useeoshandle)
dmalen0 += 2; dmalen0 += 2;
if (dmalen0 < 4) { if (dmalen0 < 4) {
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;
} }
...@@ -1083,21 +1234,24 @@ static int Compute_and_setup_dma(struct comedi_device *dev) ...@@ -1083,21 +1234,24 @@ static int Compute_and_setup_dma(struct comedi_device *dev)
/* 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);
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, "
"can't support TRIG_WAKE_EOS (%d<%d)\n",
dev->minor, dmalen1, dev->minor, dmalen1,
devpriv->ai_n_realscanlen << 1); devpriv->ai_n_realscanlen << 1);
} else { } else {
/* short second DMA buffer to one scan */ /* short second DMA buffer to one scan */
dmalen1 = devpriv->ai_n_realscanlen << 1; dmalen1 = devpriv->ai_n_realscanlen << 1;
DPRINTK DPRINTK
("22 dmalen1=%d ai_n_realscanlen=%d useeoshandle=%d\n", ("22 dmalen1=%d ai_n_realscanlen=%d "
"useeoshandle=%d\n",
dmalen1, devpriv->ai_n_realscanlen, dmalen1, devpriv->ai_n_realscanlen,
devpriv->useeoshandle); devpriv->useeoshandle);
if (devpriv->useeoshandle) if (devpriv->useeoshandle)
dmalen1 -= 2; dmalen1 -= 2;
if (dmalen1 < 4) { if (dmalen1 < 4) {
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;
} }
...@@ -1122,7 +1276,10 @@ static int Compute_and_setup_dma(struct comedi_device *dev) ...@@ -1122,7 +1276,10 @@ static int Compute_and_setup_dma(struct comedi_device *dev)
dmalen1 &= ~3L; dmalen1 &= ~3L;
if (!dmalen1) if (!dmalen1)
dmalen1 = i; /* uff. very long scan? */ dmalen1 = i; /* uff. very long scan? */
/* if measure isn't neverending then test, if it whole fits into one or two DMA buffers */ /*
* if measure isn't neverending then test, if it fits whole
* into one or two DMA buffers
*/
if (!devpriv->ai_neverending) { if (!devpriv->ai_neverending) {
/* fits whole measure into one DMA buffer? */ /* fits whole measure into one DMA buffer? */
if (dmalen0 > if (dmalen0 >
...@@ -1138,7 +1295,10 @@ static int Compute_and_setup_dma(struct comedi_device *dev) ...@@ -1138,7 +1295,10 @@ static int Compute_and_setup_dma(struct comedi_device *dev)
DPRINTK("3.1 dmalen0=%d dmalen1=%d \n", dmalen0, DPRINTK("3.1 dmalen0=%d dmalen1=%d \n", dmalen0,
dmalen1); dmalen1);
dmalen0 &= ~3L; dmalen0 &= ~3L;
} else { /* fits whole measure into two DMA buffer? */ } else { /*
* fits whole measure into
* two DMA buffer?
*/
if (dmalen1 > if (dmalen1 >
((devpriv->ai_n_realscanlen << 1) * ((devpriv->ai_n_realscanlen << 1) *
devpriv->ai_scans - dmalen0)) devpriv->ai_scans - dmalen0))
...@@ -1154,7 +1314,7 @@ static int Compute_and_setup_dma(struct comedi_device *dev) ...@@ -1154,7 +1314,7 @@ static int Compute_and_setup_dma(struct comedi_device *dev)
DPRINTK("4 dmalen0=%d dmalen1=%d \n", dmalen0, dmalen1); DPRINTK("4 dmalen0=%d dmalen1=%d \n", dmalen0, dmalen1);
/* these DMA buffer size we'll be used */ /* these DMA buffer size will be used */
devpriv->dma_actbuf = 0; devpriv->dma_actbuf = 0;
devpriv->dmabuf_use_size[0] = dmalen0; devpriv->dmabuf_use_size[0] = dmalen0;
devpriv->dmabuf_use_size[1] = dmalen1; devpriv->dmabuf_use_size[1] = dmalen1;
...@@ -1176,7 +1336,8 @@ static int Compute_and_setup_dma(struct comedi_device *dev) ...@@ -1176,7 +1336,8 @@ static int Compute_and_setup_dma(struct comedi_device *dev)
} }
#endif #endif
outl(inl(devpriv->iobase_a + AMCC_OP_REG_MCSR) & (~EN_A2P_TRANSFERS), devpriv->iobase_a + AMCC_OP_REG_MCSR); /* stop DMA */ outl(inl(devpriv->iobase_a + AMCC_OP_REG_MCSR) & (~EN_A2P_TRANSFERS),
devpriv->iobase_a + AMCC_OP_REG_MCSR); /* stop DMA */
outl(devpriv->dmabuf_hw[0], devpriv->iobase_a + AMCC_OP_REG_MWAR); outl(devpriv->dmabuf_hw[0], devpriv->iobase_a + AMCC_OP_REG_MWAR);
outl(devpriv->dmabuf_use_size[0], devpriv->iobase_a + AMCC_OP_REG_MWTC); outl(devpriv->dmabuf_use_size[0], devpriv->iobase_a + AMCC_OP_REG_MWTC);
/* init DMA transfer */ /* init DMA transfer */
...@@ -1187,7 +1348,9 @@ static int Compute_and_setup_dma(struct comedi_device *dev) ...@@ -1187,7 +1348,9 @@ static int Compute_and_setup_dma(struct comedi_device *dev)
outl(inl(devpriv->iobase_a + outl(inl(devpriv->iobase_a +
AMCC_OP_REG_MCSR) | RESET_A2P_FLAGS | A2P_HI_PRIORITY | AMCC_OP_REG_MCSR) | RESET_A2P_FLAGS | A2P_HI_PRIORITY |
EN_A2P_TRANSFERS, devpriv->iobase_a + AMCC_OP_REG_MCSR); EN_A2P_TRANSFERS, devpriv->iobase_a + AMCC_OP_REG_MCSR);
outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | EN_A2P_TRANSFERS, devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* allow bus mastering */ outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | EN_A2P_TRANSFERS,
devpriv->iobase_a + AMCC_OP_REG_INTCSR);
/* allow bus mastering */
DPRINTK("adl_pci9118 EDBG: END: Compute_and_setup_dma()\n"); DPRINTK("adl_pci9118 EDBG: END: Compute_and_setup_dma()\n");
return 0; return 0;
...@@ -1220,17 +1383,21 @@ static int pci9118_ai_docmd_sampl(struct comedi_device *dev, ...@@ -1220,17 +1383,21 @@ static int pci9118_ai_docmd_sampl(struct comedi_device *dev,
return -EIO; return -EIO;
}; };
devpriv->int_ai_func = interrupt_pci9118_ai_onesample; /* transfer function */ devpriv->int_ai_func = interrupt_pci9118_ai_onesample;
/* transfer function */
if (devpriv->ai12_startstop) if (devpriv->ai12_startstop)
pci9118_exttrg_add(dev, EXTTRG_AI); /* activate EXT trigger */ pci9118_exttrg_add(dev, EXTTRG_AI);
/* activate EXT trigger */
if ((devpriv->ai_do == 1) || (devpriv->ai_do == 2)) if ((devpriv->ai_do == 1) || (devpriv->ai_do == 2))
devpriv->IntControlReg |= Int_Timer; devpriv->IntControlReg |= Int_Timer;
devpriv->AdControlReg |= AdControl_Int; devpriv->AdControlReg |= AdControl_Int;
outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* allow INT in AMCC */ outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00,
devpriv->iobase_a + AMCC_OP_REG_INTCSR);
/* allow INT in AMCC */
if (!(devpriv->ai12_startstop & (START_AI_EXT | START_AI_INT))) { if (!(devpriv->ai12_startstop & (START_AI_EXT | START_AI_INT))) {
outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL);
...@@ -1296,10 +1463,12 @@ static int pci9118_ai_docmd_dma(struct comedi_device *dev, ...@@ -1296,10 +1463,12 @@ static int pci9118_ai_docmd_dma(struct comedi_device *dev,
}; };
if (devpriv->ai12_startstop) { if (devpriv->ai12_startstop) {
pci9118_exttrg_add(dev, EXTTRG_AI); /* activate EXT trigger */ pci9118_exttrg_add(dev, EXTTRG_AI);
/* activate EXT trigger */
} }
devpriv->int_ai_func = interrupt_pci9118_ai_dma; /* transfer function */ devpriv->int_ai_func = interrupt_pci9118_ai_dma;
/* transfer function */
outl(0x02000000 | AINT_WRITE_COMPL, outl(0x02000000 | AINT_WRITE_COMPL,
devpriv->iobase_a + AMCC_OP_REG_INTCSR); devpriv->iobase_a + AMCC_OP_REG_INTCSR);
...@@ -1381,7 +1550,10 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -1381,7 +1550,10 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
devpriv->ai_neverending, devpriv->ai_scans, devpriv->usessh, devpriv->ai_neverending, devpriv->ai_scans, devpriv->usessh,
devpriv->ai12_startstop); devpriv->ai12_startstop);
/* use additional sample at end of every scan to satisty DMA 32 bit transfer? */ /*
* use additional sample at end of every scan
* to satisty DMA 32 bit transfer?
*/
devpriv->ai_add_front = 0; devpriv->ai_add_front = 0;
devpriv->ai_add_back = 0; devpriv->ai_add_back = 0;
devpriv->useeoshandle = 0; devpriv->useeoshandle = 0;
...@@ -1393,16 +1565,29 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -1393,16 +1565,29 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
devpriv->ai_add_back = 1; devpriv->ai_add_back = 1;
} }
if (cmd->convert_src == TRIG_TIMER) { if (cmd->convert_src == TRIG_TIMER) {
devpriv->usedma = 0; /* use INT transfer if scanlist have only one channel */ devpriv->usedma = 0;
/*
* use INT transfer if scanlist
* have only one channel
*/
} }
} }
if ((cmd->flags & TRIG_WAKE_EOS) && if ((cmd->flags & TRIG_WAKE_EOS) &&
(devpriv->ai_n_scanlen & 1) && (devpriv->ai_n_scanlen & 1) &&
(devpriv->ai_n_scanlen > 1)) { (devpriv->ai_n_scanlen > 1)) {
if (cmd->scan_begin_src == TRIG_FOLLOW) { if (cmd->scan_begin_src == TRIG_FOLLOW) {
/* vpriv->useeoshandle=1; // change DMA transfer block to fit EOS on every second call */ /*
devpriv->usedma = 0; /* XXX maybe can be corrected to use 16 bit DMA */ * vpriv->useeoshandle=1; // change DMA transfer
} else { /* well, we must insert one sample to end of EOS to meet 32 bit transfer */ * block to fit EOS on every second call
*/
devpriv->usedma = 0;
/*
* XXX maybe can be corrected to use 16 bit DMA
*/
} else { /*
* well, we must insert one sample
* to end of EOS to meet 32 bit transfer
*/
devpriv->ai_add_back = 1; devpriv->ai_add_back = 1;
} }
} }
...@@ -1410,10 +1595,14 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -1410,10 +1595,14 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
devpriv->usedma = 0; devpriv->usedma = 0;
} }
/* we need software S&H signal? It add two samples before every scan as minimum */ /*
* we need software S&H signal?
* It adds two samples before every scan as minimum
*/
if (devpriv->usessh && devpriv->softsshdelay) { if (devpriv->usessh && devpriv->softsshdelay) {
devpriv->ai_add_front = 2; devpriv->ai_add_front = 2;
if ((devpriv->usedma == 1) && (devpriv->ai_add_back == 1)) { /* move it to front */ if ((devpriv->usedma == 1) && (devpriv->ai_add_back == 1)) {
/* move it to front */
devpriv->ai_add_front++; devpriv->ai_add_front++;
devpriv->ai_add_back = 0; devpriv->ai_add_back = 0;
} }
...@@ -1422,17 +1611,22 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -1422,17 +1611,22 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
addchans = devpriv->softsshdelay / cmd->convert_arg; addchans = devpriv->softsshdelay / cmd->convert_arg;
if (devpriv->softsshdelay % cmd->convert_arg) if (devpriv->softsshdelay % cmd->convert_arg)
addchans++; addchans++;
if (addchans > (devpriv->ai_add_front - 1)) { /* uff, still short :-( */ if (addchans > (devpriv->ai_add_front - 1)) {
/* uff, still short */
devpriv->ai_add_front = addchans + 1; devpriv->ai_add_front = addchans + 1;
if (devpriv->usedma == 1) if (devpriv->usedma == 1)
if ((devpriv->ai_add_front + if ((devpriv->ai_add_front +
devpriv->ai_n_chan + devpriv->ai_n_chan +
devpriv->ai_add_back) & 1) devpriv->ai_add_back) & 1)
devpriv->ai_add_front++; /* round up to 32 bit */ devpriv->ai_add_front++;
/* round up to 32 bit */
} }
} }
/* well, we now know what must be all added */ /* well, we now know what must be all added */
devpriv->ai_n_realscanlen = /* what we must take from card in real to have ai_n_scanlen on output? */ devpriv->ai_n_realscanlen = /*
* what we must take from card in real
* to have ai_n_scanlen on output?
*/
(devpriv->ai_add_front + devpriv->ai_n_chan + (devpriv->ai_add_front + devpriv->ai_n_chan +
devpriv->ai_add_back) * (devpriv->ai_n_scanlen / devpriv->ai_add_back) * (devpriv->ai_n_scanlen /
devpriv->ai_n_chan); devpriv->ai_n_chan);
...@@ -1455,8 +1649,15 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -1455,8 +1649,15 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
return -EINVAL; return -EINVAL;
/* compute timers settings */ /* compute timers settings */
/* simplest way, fr=4Mhz/(tim1*tim2), channel manipulation without timers effect */ /*
if (((cmd->scan_begin_src == TRIG_FOLLOW) || (cmd->scan_begin_src == TRIG_EXT) || (cmd->scan_begin_src == TRIG_INT)) && (cmd->convert_src == TRIG_TIMER)) { /* both timer is used for one time */ * simplest way, fr=4Mhz/(tim1*tim2),
* channel manipulation without timers effect
*/
if (((cmd->scan_begin_src == TRIG_FOLLOW) ||
(cmd->scan_begin_src == TRIG_EXT) ||
(cmd->scan_begin_src == TRIG_INT)) &&
(cmd->convert_src == TRIG_TIMER)) {
/* both timer is used for one time */
if (cmd->scan_begin_src == TRIG_EXT) { if (cmd->scan_begin_src == TRIG_EXT) {
devpriv->ai_do = 4; devpriv->ai_do = 4;
} else { } else {
...@@ -1472,10 +1673,14 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -1472,10 +1673,14 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
devpriv->ai_timer2 = cmd->convert_arg; devpriv->ai_timer2 = cmd->convert_arg;
} }
if ((cmd->scan_begin_src == TRIG_TIMER) && ((cmd->convert_src == TRIG_TIMER) || (cmd->convert_src == TRIG_NOW))) { /* double timed action */ if ((cmd->scan_begin_src == TRIG_TIMER) &&
((cmd->convert_src == TRIG_TIMER) ||
(cmd->convert_src == TRIG_NOW))) {
/* double timed action */
if (!devpriv->usedma) { if (!devpriv->usedma) {
comedi_error(dev, comedi_error(dev,
"cmd->scan_begin_src=TRIG_TIMER works only with bus mastering!"); "cmd->scan_begin_src=TRIG_TIMER works "
"only with bus mastering!");
return -EIO; return -EIO;
} }
...@@ -1498,13 +1703,25 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -1498,13 +1703,25 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
start_pacer(dev, -1, 0, 0); /* stop pacer */ start_pacer(dev, -1, 0, 0); /* stop pacer */
devpriv->AdControlReg = 0; /* bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable DMA */ devpriv->AdControlReg = 0; /*
* bipolar, S.E., use 8254, stop 8354,
* internal trigger, soft trigger,
* disable DMA
*/
outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); 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);
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);
devpriv->ai_act_scan = 0; devpriv->ai_act_scan = 0;
...@@ -1537,7 +1754,8 @@ static int check_channel_list(struct comedi_device *dev, ...@@ -1537,7 +1754,8 @@ static int check_channel_list(struct comedi_device *dev,
} }
if ((frontadd + n_chan + backadd) > s->len_chanlist) { if ((frontadd + n_chan + backadd) > s->len_chanlist) {
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, s->len_chanlist - frontadd - backadd); dev->minor, n_chan, s->len_chanlist - frontadd - backadd);
return 0; return 0;
} }
...@@ -1551,19 +1769,22 @@ static int check_channel_list(struct comedi_device *dev, ...@@ -1551,19 +1769,22 @@ static int check_channel_list(struct comedi_device *dev,
if ((CR_AREF(chanlist[i]) == AREF_DIFF) != if ((CR_AREF(chanlist[i]) == AREF_DIFF) !=
(differencial)) { (differencial)) {
comedi_error(dev, comedi_error(dev,
"Differencial and single ended inputs cann't be mixtured!"); "Differencial and single ended "
"inputs can't be mixtured!");
return 0; return 0;
} }
if ((CR_RANGE(chanlist[i]) < PCI9118_BIPOLAR_RANGES) != if ((CR_RANGE(chanlist[i]) < PCI9118_BIPOLAR_RANGES) !=
(bipolar)) { (bipolar)) {
comedi_error(dev, comedi_error(dev,
"Bipolar and unipolar ranges cann't be mixtured!"); "Bipolar and unipolar ranges "
"can't be mixtured!");
return 0; return 0;
} }
if ((!devpriv->usemux) & (differencial) & if ((!devpriv->usemux) & (differencial) &
(CR_CHAN(chanlist[i]) >= this_board->n_aichand)) { (CR_CHAN(chanlist[i]) >= this_board->n_aichand)) {
comedi_error(dev, comedi_error(dev,
"If AREF_DIFF is used then is available only first 8 channels!"); "If AREF_DIFF is used then is "
"available only first 8 channels!");
return 0; return 0;
} }
} }
...@@ -1583,7 +1804,8 @@ static int setup_channel_list(struct comedi_device *dev, ...@@ -1583,7 +1804,8 @@ static int setup_channel_list(struct comedi_device *dev,
unsigned int scanquad, gain, ssh = 0x00; unsigned int scanquad, gain, ssh = 0x00;
DPRINTK DPRINTK
("adl_pci9118 EDBG: BGN: setup_channel_list(%d,.,%d,.,%d,%d,%d,%d)\n", ("adl_pci9118 EDBG: BGN: setup_channel_list"
"(%d,.,%d,.,%d,%d,%d,%d)\n",
dev->minor, n_chan, rot, frontadd, backadd, usedma); dev->minor, n_chan, rot, frontadd, backadd, usedma);
if (usedma == 1) { if (usedma == 1) {
...@@ -1599,20 +1821,26 @@ static int setup_channel_list(struct comedi_device *dev, ...@@ -1599,20 +1821,26 @@ static int setup_channel_list(struct comedi_device *dev,
/* All is ok, so we can setup channel/range list */ /* All is ok, so we can setup channel/range list */
if (!bipolar) { if (!bipolar) {
devpriv->AdControlReg |= AdControl_UniP; /* set unibipolar */ devpriv->AdControlReg |= AdControl_UniP;
/* set unibipolar */
} else { } else {
devpriv->AdControlReg &= ((~AdControl_UniP) & 0xff); /* enable bipolar */ devpriv->AdControlReg &= ((~AdControl_UniP) & 0xff);
/* enable bipolar */
} }
if (differencial) { if (differencial) {
devpriv->AdControlReg |= AdControl_Diff; /* enable diff inputs */ devpriv->AdControlReg |= AdControl_Diff;
/* enable diff inputs */
} else { } else {
devpriv->AdControlReg &= ((~AdControl_Diff) & 0xff); /* set single ended inputs */ devpriv->AdControlReg &= ((~AdControl_Diff) & 0xff);
/* set single ended inputs */
} }
outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); /* setup mode */ outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL);
/* setup mode */
outl(2, dev->iobase + PCI9118_SCANMOD); /* gods know why this sequence! */ outl(2, dev->iobase + PCI9118_SCANMOD);
/* gods know why this sequence! */
outl(0, dev->iobase + PCI9118_SCANMOD); outl(0, dev->iobase + PCI9118_SCANMOD);
outl(1, dev->iobase + PCI9118_SCANMOD); outl(1, dev->iobase + PCI9118_SCANMOD);
...@@ -1625,9 +1853,12 @@ static int setup_channel_list(struct comedi_device *dev, ...@@ -1625,9 +1853,12 @@ static int setup_channel_list(struct comedi_device *dev,
if (frontadd) { /* insert channels for S&H */ if (frontadd) { /* insert channels for S&H */
ssh = devpriv->softsshsample; ssh = devpriv->softsshsample;
DPRINTK("FA: %04x: ", ssh); DPRINTK("FA: %04x: ", ssh);
for (i = 0; i < frontadd; i++) { /* store range list to card */ for (i = 0; i < frontadd; i++) {
scanquad = CR_CHAN(chanlist[0]); /* get channel number; */ /* store range list to card */
gain = CR_RANGE(chanlist[0]); /* get gain number */ scanquad = CR_CHAN(chanlist[0]);
/* get channel number; */
gain = CR_RANGE(chanlist[0]);
/* get gain number */
scanquad |= ((gain & 0x03) << 8); scanquad |= ((gain & 0x03) << 8);
outl(scanquad | ssh, dev->iobase + PCI9118_GAIN); outl(scanquad | ssh, dev->iobase + PCI9118_GAIN);
DPRINTK("%02x ", scanquad | ssh); DPRINTK("%02x ", scanquad | ssh);
...@@ -1638,7 +1869,7 @@ static int setup_channel_list(struct comedi_device *dev, ...@@ -1638,7 +1869,7 @@ static int setup_channel_list(struct comedi_device *dev,
DPRINTK("SL: ", ssh); DPRINTK("SL: ", ssh);
for (i = 0; i < n_chan; i++) { /* store range list to card */ for (i = 0; i < n_chan; i++) { /* store range list to card */
scanquad = CR_CHAN(chanlist[i]); /* get channel number; */ scanquad = CR_CHAN(chanlist[i]); /* get channel number */
#ifdef PCI9118_PARANOIDCHECK #ifdef PCI9118_PARANOIDCHECK
devpriv->chanlist[i ^ usedma] = (scanquad & 0xf) << rot; devpriv->chanlist[i ^ usedma] = (scanquad & 0xf) << rot;
#endif #endif
...@@ -1652,7 +1883,8 @@ static int setup_channel_list(struct comedi_device *dev, ...@@ -1652,7 +1883,8 @@ static int setup_channel_list(struct comedi_device *dev,
if (backadd) { /* insert channels for fit onto 32bit DMA */ if (backadd) { /* insert channels for fit onto 32bit DMA */
DPRINTK("BA: %04x: ", ssh); DPRINTK("BA: %04x: ", ssh);
for (i = 0; i < backadd; i++) { /* store range list to card */ for (i = 0; i < backadd; i++) { /* store range list to card */
scanquad = CR_CHAN(chanlist[0]); /* get channel number; */ scanquad = CR_CHAN(chanlist[0]);
/* get channel number */
gain = CR_RANGE(chanlist[0]); /* get gain number */ gain = CR_RANGE(chanlist[0]); /* get gain number */
scanquad |= ((gain & 0x03) << 8); scanquad |= ((gain & 0x03) << 8);
outl(scanquad | ssh, dev->iobase + PCI9118_GAIN); outl(scanquad | ssh, dev->iobase + PCI9118_GAIN);
...@@ -1661,13 +1893,16 @@ static int setup_channel_list(struct comedi_device *dev, ...@@ -1661,13 +1893,16 @@ static int setup_channel_list(struct comedi_device *dev,
DPRINTK("\n "); DPRINTK("\n ");
} }
#ifdef PCI9118_PARANOIDCHECK #ifdef PCI9118_PARANOIDCHECK
devpriv->chanlist[n_chan ^ usedma] = devpriv->chanlist[0 ^ usedma]; /* for 32bit oerations */ devpriv->chanlist[n_chan ^ usedma] = devpriv->chanlist[0 ^ usedma];
/* for 32bit operations */
if (useeos) { if (useeos) {
for (i = 1; i < n_chan; i++) { /* store range list to card */ for (i = 1; i < n_chan; i++) { /* store range list to card */
devpriv->chanlist[(n_chan + i) ^ usedma] = devpriv->chanlist[(n_chan + i) ^ usedma] =
(CR_CHAN(chanlist[i]) & 0xf) << rot; (CR_CHAN(chanlist[i]) & 0xf) << rot;
} }
devpriv->chanlist[(2 * n_chan) ^ usedma] = devpriv->chanlist[0 ^ usedma]; /* for 32bit oerations */ devpriv->chanlist[(2 * n_chan) ^ usedma] =
devpriv->chanlist[0 ^ usedma];
/* for 32bit operations */
useeos = 2; useeos = 2;
} else { } else {
useeos = 1; useeos = 1;
...@@ -1681,7 +1916,7 @@ static int setup_channel_list(struct comedi_device *dev, ...@@ -1681,7 +1916,7 @@ static int setup_channel_list(struct comedi_device *dev,
#endif #endif
#endif #endif
outl(0, dev->iobase + PCI9118_SCANMOD); /* close scan queue */ outl(0, dev->iobase + PCI9118_SCANMOD); /* close scan queue */
/* udelay(100); important delay, or first sample will be cripled */ /* udelay(100); important delay, or first sample will be crippled */
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 */
...@@ -1699,7 +1934,8 @@ static void pci9118_calc_divisors(char mode, struct comedi_device *dev, ...@@ -1699,7 +1934,8 @@ static void pci9118_calc_divisors(char mode, struct comedi_device *dev,
char usessh, unsigned int chnsshfront) char usessh, unsigned int chnsshfront)
{ {
DPRINTK DPRINTK
("adl_pci9118 EDBG: BGN: pci9118_calc_divisors(%d,%d,.,%u,%u,%u,%d,.,.,,%u,%u)\n", ("adl_pci9118 EDBG: BGN: pci9118_calc_divisors"
"(%d,%d,.,%u,%u,%u,%d,.,.,,%u,%u)\n",
mode, dev->minor, *tim1, *tim2, flags, chans, usessh, chnsshfront); mode, dev->minor, *tim1, *tim2, flags, chans, usessh, chnsshfront);
switch (mode) { switch (mode) {
case 1: case 1:
...@@ -1716,7 +1952,8 @@ static void pci9118_calc_divisors(char mode, struct comedi_device *dev, ...@@ -1716,7 +1952,8 @@ static void pci9118_calc_divisors(char mode, struct comedi_device *dev,
*tim2 = this_board->ai_ns_min; *tim2 = this_board->ai_ns_min;
DPRINTK("1 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2, DPRINTK("1 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2,
*tim1, *tim2); *tim1, *tim2);
*div1 = *tim2 / devpriv->i8254_osc_base; /* convert timer (burst) */ *div1 = *tim2 / devpriv->i8254_osc_base;
/* convert timer (burst) */
DPRINTK("2 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2, DPRINTK("2 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2,
*tim1, *tim2); *tim1, *tim2);
if (*div1 < this_board->ai_pacer_min) if (*div1 < this_board->ai_pacer_min)
...@@ -1734,7 +1971,8 @@ static void pci9118_calc_divisors(char mode, struct comedi_device *dev, ...@@ -1734,7 +1971,8 @@ static void pci9118_calc_divisors(char mode, struct comedi_device *dev,
DPRINTK("6 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2, DPRINTK("6 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2,
*tim1, *tim2); *tim1, *tim2);
*tim2 = *div1 * devpriv->i8254_osc_base; /* real convert timer */ *tim2 = *div1 * devpriv->i8254_osc_base;
/* real convert timer */
if (usessh & (chnsshfront == 0)) /* use BSSH signal */ if (usessh & (chnsshfront == 0)) /* use BSSH signal */
if (*div2 < (chans + 2)) if (*div2 < (chans + 2))
...@@ -1780,7 +2018,9 @@ static int pci9118_exttrg_add(struct comedi_device *dev, unsigned char source) ...@@ -1780,7 +2018,9 @@ static int pci9118_exttrg_add(struct comedi_device *dev, unsigned char source)
devpriv->exttrg_users |= (1 << source); devpriv->exttrg_users |= (1 << source);
devpriv->IntControlReg |= Int_DTrg; devpriv->IntControlReg |= Int_DTrg;
outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL);
outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* allow INT in AMCC */ outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00,
devpriv->iobase_a + AMCC_OP_REG_INTCSR);
/* allow INT in AMCC */
return 0; return 0;
} }
...@@ -1795,7 +2035,10 @@ static int pci9118_exttrg_del(struct comedi_device *dev, unsigned char source) ...@@ -1795,7 +2035,10 @@ static int pci9118_exttrg_del(struct comedi_device *dev, unsigned char source)
if (!devpriv->exttrg_users) { /* shutdown ext trg intterrupts */ if (!devpriv->exttrg_users) { /* shutdown ext trg intterrupts */
devpriv->IntControlReg &= ~Int_DTrg; devpriv->IntControlReg &= ~Int_DTrg;
if (!devpriv->IntControlReg) /* all IRQ disabled */ if (!devpriv->IntControlReg) /* all IRQ disabled */
outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) & (~0x00001f00), devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* disable int in AMCC */ outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) &
(~0x00001f00),
devpriv->iobase_a + AMCC_OP_REG_INTCSR);
/* disable int in AMCC */
outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL);
} }
return 0; return 0;
...@@ -1808,13 +2051,25 @@ static int pci9118_ai_cancel(struct comedi_device *dev, ...@@ -1808,13 +2051,25 @@ static int pci9118_ai_cancel(struct comedi_device *dev,
struct comedi_subdevice *s) struct comedi_subdevice *s)
{ {
if (devpriv->usedma) if (devpriv->usedma)
outl(inl(devpriv->iobase_a + AMCC_OP_REG_MCSR) & (~EN_A2P_TRANSFERS), devpriv->iobase_a + AMCC_OP_REG_MCSR); /* stop DMA */ outl(inl(devpriv->iobase_a + AMCC_OP_REG_MCSR) &
(~EN_A2P_TRANSFERS),
devpriv->iobase_a + AMCC_OP_REG_MCSR); /* stop DMA */
pci9118_exttrg_del(dev, EXTTRG_AI); pci9118_exttrg_del(dev, EXTTRG_AI);
start_pacer(dev, 0, 0, 0); /* stop 8254 counters */ start_pacer(dev, 0, 0, 0); /* stop 8254 counters */
devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg; devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg;
outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); /* positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop */ outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC);
/*
* positive triggers, no S&H, no burst,
* burst stop, no post trigger,
* no about trigger, trigger stop
*/
devpriv->AdControlReg = 0x00; devpriv->AdControlReg = 0x00;
outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); /* bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable INT and DMA */ outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL);
/*
* bipolar, S.E., use 8254, stop 8354,
* internal trigger, soft trigger,
* disable INT and DMA
*/
outl(0, dev->iobase + PCI9118_BURST); outl(0, dev->iobase + PCI9118_BURST);
outl(1, dev->iobase + PCI9118_SCANMOD); outl(1, dev->iobase + PCI9118_SCANMOD);
outl(2, dev->iobase + PCI9118_SCANMOD); /* reset scan queue */ outl(2, dev->iobase + PCI9118_SCANMOD); /* reset scan queue */
...@@ -1832,7 +2087,9 @@ static int pci9118_ai_cancel(struct comedi_device *dev, ...@@ -1832,7 +2087,9 @@ static int pci9118_ai_cancel(struct comedi_device *dev,
devpriv->dma_actbuf = 0; devpriv->dma_actbuf = 0;
if (!devpriv->IntControlReg) if (!devpriv->IntControlReg)
outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* allow INT in AMCC */ outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00,
devpriv->iobase_a + AMCC_OP_REG_INTCSR);
/* allow INT in AMCC */
return 0; return 0;
} }
...@@ -1845,21 +2102,36 @@ static int pci9118_reset(struct comedi_device *dev) ...@@ -1845,21 +2102,36 @@ static int pci9118_reset(struct comedi_device *dev)
devpriv->IntControlReg = 0; devpriv->IntControlReg = 0;
devpriv->exttrg_users = 0; devpriv->exttrg_users = 0;
inl(dev->iobase + PCI9118_INTCTRL); inl(dev->iobase + PCI9118_INTCTRL);
outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); /* disable interrupts source */ outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL);
/* disable interrupts source */
outl(0x30, dev->iobase + PCI9118_CNTCTRL); outl(0x30, dev->iobase + PCI9118_CNTCTRL);
/* outl(0xb4, dev->iobase + PCI9118_CNTCTRL); */ /* outl(0xb4, dev->iobase + PCI9118_CNTCTRL); */
start_pacer(dev, 0, 0, 0); /* stop 8254 counters */ start_pacer(dev, 0, 0, 0); /* stop 8254 counters */
devpriv->AdControlReg = 0; devpriv->AdControlReg = 0;
outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); /* bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable INT and DMA */ outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL);
/*
* bipolar, S.E., use 8254,
* stop 8354, internal trigger,
* soft trigger,
* disable INT and DMA
*/
outl(0, dev->iobase + PCI9118_BURST); outl(0, dev->iobase + PCI9118_BURST);
outl(1, dev->iobase + PCI9118_SCANMOD); outl(1, dev->iobase + PCI9118_SCANMOD);
outl(2, dev->iobase + PCI9118_SCANMOD); /* reset scan queue */ outl(2, dev->iobase + PCI9118_SCANMOD); /* reset scan queue */
devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg; devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg;
outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); /* positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop */ outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC);
/*
* positive triggers, no S&H,
* no burst, burst stop,
* no post trigger,
* no about trigger,
* trigger stop
*/
devpriv->ao_data[0] = 2047; devpriv->ao_data[0] = 2047;
devpriv->ao_data[1] = 2047; devpriv->ao_data[1] = 2047;
outl(devpriv->ao_data[0], dev->iobase + PCI9118_DA1); /* reset A/D outs to 0V */ outl(devpriv->ao_data[0], dev->iobase + PCI9118_DA1);
/* reset A/D outs to 0V */
outl(devpriv->ao_data[1], dev->iobase + PCI9118_DA2); outl(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 */
udelay(10); udelay(10);
...@@ -1869,7 +2141,13 @@ static int pci9118_reset(struct comedi_device *dev) ...@@ -1869,7 +2141,13 @@ static int pci9118_reset(struct comedi_device *dev)
inl(dev->iobase + PCI9118_ADSTAT); /* flush A/D status register */ inl(dev->iobase + PCI9118_ADSTAT); /* flush A/D status register */
inl(dev->iobase + PCI9118_INTSRC); /* flush INT requests */ inl(dev->iobase + PCI9118_INTSRC); /* flush INT requests */
devpriv->AdControlReg = 0; devpriv->AdControlReg = 0;
outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); /* bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable INT and DMA */ outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL);
/*
* bipolar, S.E., use 8254,
* stop 8354, internal trigger,
* soft trigger,
* disable INT and DMA
*/
devpriv->cnt0_users = 0; devpriv->cnt0_users = 0;
devpriv->exttrg_users = 0; devpriv->exttrg_users = 0;
...@@ -2027,13 +2305,15 @@ static int pci9118_attach(struct comedi_device *dev, ...@@ -2027,13 +2305,15 @@ static int pci9118_attach(struct comedi_device *dev,
devpriv->usemux = 256; /* max 256 channels! */ devpriv->usemux = 256; /* max 256 channels! */
if (it->options[4] > 0) if (it->options[4] > 0)
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! */
} }
printk(", ext. mux %d channels", devpriv->usemux); printk(", ext. mux %d channels", devpriv->usemux);
} }
devpriv->softsshdelay = it->options[4]; devpriv->softsshdelay = it->options[4];
if (devpriv->softsshdelay < 0) { /* select sample&hold signal polarity */ if (devpriv->softsshdelay < 0) {
/* select sample&hold signal polarity */
devpriv->softsshdelay = -devpriv->softsshdelay; devpriv->softsshdelay = -devpriv->softsshdelay;
devpriv->softsshsample = 0x80; devpriv->softsshsample = 0x80;
devpriv->softsshhold = 0x00; devpriv->softsshhold = 0x00;
...@@ -2045,7 +2325,8 @@ static int pci9118_attach(struct comedi_device *dev, ...@@ -2045,7 +2325,8 @@ static int pci9118_attach(struct comedi_device *dev,
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 */
ret = alloc_subdevices(dev, 4); ret = alloc_subdevices(dev, 4);
if (ret < 0) if (ret < 0)
...@@ -2104,7 +2385,8 @@ static int pci9118_attach(struct comedi_device *dev, ...@@ -2104,7 +2385,8 @@ static int pci9118_attach(struct comedi_device *dev,
devpriv->valid = 1; devpriv->valid = 1;
devpriv->i8254_osc_base = 250; /* 250ns=4MHz */ devpriv->i8254_osc_base = 250; /* 250ns=4MHz */
devpriv->ai_maskharderr = 0x10a; /* default measure crash condition */ devpriv->ai_maskharderr = 0x10a;
/* default measure crash condition */
if (it->options[5]) /* disable some requested */ if (it->options[5]) /* disable some requested */
devpriv->ai_maskharderr &= ~it->options[5]; devpriv->ai_maskharderr &= ~it->options[5];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment