2 * comedi/drivers/pcl812.c
4 * Author: Michal Dobes <dobes@tesnet.cz>
6 * hardware driver for Advantech cards
7 * card: PCL-812, PCL-812PG, PCL-813, PCL-813B
8 * driver: pcl812, pcl812pg, pcl813, pcl813b
10 * card: ACL-8112DG, ACL-8112HG, ACL-8112PG, ACL-8113, ACL-8216
11 * driver: acl8112dg, acl8112hg, acl8112pg, acl8113, acl8216
12 * and for ICP DAS cards
13 * card: ISO-813, A-821PGH, A-821PGL, A-821PGL-NDA, A-822PGH, A-822PGL,
14 * driver: iso813, a821pgh, a-821pgl, a-821pglnda, a822pgh, a822pgl,
15 * card: A-823PGH, A-823PGL, A-826PG
16 * driver: a823pgh, a823pgl, a826pg
21 * Description: Advantech PCL-812/PG, PCL-813/B,
22 * ADLink ACL-8112DG/HG/PG, ACL-8113, ACL-8216,
23 * ICP DAS A-821PGH/PGL/PGL-NDA, A-822PGH/PGL, A-823PGH/PGL, A-826PG,
25 * Author: Michal Dobes <dobes@tesnet.cz>
26 * Devices: [Advantech] PCL-812 (pcl812), PCL-812PG (pcl812pg),
27 * PCL-813 (pcl813), PCL-813B (pcl813b), [ADLink] ACL-8112DG (acl8112dg),
28 * ACL-8112HG (acl8112hg), ACL-8113 (acl-8113), ACL-8216 (acl8216),
29 * [ICP] ISO-813 (iso813), A-821PGH (a821pgh), A-821PGL (a821pgl),
30 * A-821PGL-NDA (a821pclnda), A-822PGH (a822pgh), A-822PGL (a822pgl),
31 * A-823PGH (a823pgh), A-823PGL (a823pgl), A-826PG (a826pg)
32 * Updated: Mon, 06 Aug 2007 12:03:15 +0100
33 * Status: works (I hope. My board fire up under my hands
34 * and I cann't test all features.)
36 * This driver supports insn and cmd interfaces. Some boards support only insn
37 * because their hardware don't allow more (PCL-813/B, ACL-8113, ISO-813).
38 * Data transfer over DMA is supported only when you measure only one
39 * channel, this is too hardware limitation of these boards.
41 * Options for PCL-812:
43 * [1] - IRQ (0=disable, 2, 3, 4, 5, 6, 7; 10, 11, 12, 14, 15)
44 * [2] - DMA (0=disable, 1, 3)
45 * [3] - 0=trigger source is internal 8253 with 2MHz clock
46 * 1=trigger source is external
47 * [4] - 0=A/D input range is +/-10V
48 * 1=A/D input range is +/-5V
49 * 2=A/D input range is +/-2.5V
50 * 3=A/D input range is +/-1.25V
51 * 4=A/D input range is +/-0.625V
52 * 5=A/D input range is +/-0.3125V
53 * [5] - 0=D/A outputs 0-5V (internal reference -5V)
54 * 1=D/A outputs 0-10V (internal reference -10V)
55 * 2=D/A outputs unknown (external reference)
57 * Options for PCL-812PG, ACL-8112PG:
59 * [1] - IRQ (0=disable, 2, 3, 4, 5, 6, 7; 10, 11, 12, 14, 15)
60 * [2] - DMA (0=disable, 1, 3)
61 * [3] - 0=trigger source is internal 8253 with 2MHz clock
62 * 1=trigger source is external
63 * [4] - 0=A/D have max +/-5V input
64 * 1=A/D have max +/-10V input
65 * [5] - 0=D/A outputs 0-5V (internal reference -5V)
66 * 1=D/A outputs 0-10V (internal reference -10V)
67 * 2=D/A outputs unknown (external reference)
69 * Options for ACL-8112DG/HG, A-822PGL/PGH, A-823PGL/PGH, ACL-8216, A-826PG:
71 * [1] - IRQ (0=disable, 2, 3, 4, 5, 6, 7; 10, 11, 12, 14, 15)
72 * [2] - DMA (0=disable, 1, 3)
73 * [3] - 0=trigger source is internal 8253 with 2MHz clock
74 * 1=trigger source is external
75 * [4] - 0=A/D channels are S.E.
76 * 1=A/D channels are DIFF
77 * [5] - 0=D/A outputs 0-5V (internal reference -5V)
78 * 1=D/A outputs 0-10V (internal reference -10V)
79 * 2=D/A outputs unknown (external reference)
81 * Options for A-821PGL/PGH:
83 * [1] - IRQ (0=disable, 2, 3, 4, 5, 6, 7)
84 * [2] - 0=A/D channels are S.E.
85 * 1=A/D channels are DIFF
86 * [3] - 0=D/A output 0-5V (internal reference -5V)
87 * 1=D/A output 0-10V (internal reference -10V)
89 * Options for A-821PGL-NDA:
91 * [1] - IRQ (0=disable, 2, 3, 4, 5, 6, 7)
92 * [2] - 0=A/D channels are S.E.
93 * 1=A/D channels are DIFF
95 * Options for PCL-813:
98 * Options for PCL-813B:
100 * [1] - 0= bipolar inputs
103 * Options for ACL-8113, ISO-813:
105 * [1] - 0= 10V bipolar inputs
106 * 1= 10V unipolar inputs
107 * 2= 20V bipolar inputs
108 * 3= 20V unipolar inputs
111 #include <linux/interrupt.h>
112 #include <linux/gfp.h>
113 #include "../comedidev.h"
115 #include <linux/delay.h>
116 #include <linux/ioport.h>
117 #include <linux/io.h>
120 #include "comedi_fc.h"
123 /* hardware types of the cards */
124 #define boardPCL812PG 0 /* and ACL-8112PG */
125 #define boardPCL813B 1
126 #define boardPCL812 2
127 #define boardPCL813 3
128 #define boardISO813 5
129 #define boardACL8113 6
130 #define boardACL8112 7 /* ACL-8112DG/HG, A-822PGL/PGH, A-823PGL/PGH */
131 #define boardACL8216 8 /* and ICP DAS A-826PG */
132 #define boardA821 9 /* PGH, PGL, PGL/NDA versions */
134 #define PCLx1x_IORANGE 16
136 #define PCL812_CTR0 0
137 #define PCL812_CTR1 1
138 #define PCL812_CTR2 2
139 #define PCL812_CTRCTL 3
140 #define PCL812_AD_LO 4
141 #define PCL812_DA1_LO 4
142 #define PCL812_AD_HI 5
143 #define PCL812_DA1_HI 5
144 #define PCL812_DA2_LO 6
145 #define PCL812_DI_LO 6
146 #define PCL812_DA2_HI 7
147 #define PCL812_DI_HI 7
148 #define PCL812_CLRINT 8
149 #define PCL812_GAIN 9
150 #define PCL812_MUX 10
151 #define PCL812_MODE 11
152 #define PCL812_CNTENABLE 10
153 #define PCL812_SOFTTRIG 12
154 #define PCL812_DO_LO 13
155 #define PCL812_DO_HI 14
157 #define PCL812_DRDY 0x10 /* =0 data ready */
159 #define ACL8216_STATUS 8 /* 5. bit signalize data ready */
161 #define ACL8216_DRDY 0x20 /* =0 data ready */
163 #define MAX_CHANLIST_LEN 256 /* length of scan list */
165 static const struct comedi_lrange range_pcl812pg_ai
= { 5, {
174 static const struct comedi_lrange range_pcl812pg2_ai
= { 5, {
183 static const struct comedi_lrange range812_bipolar1_25
= { 1, {
188 static const struct comedi_lrange range812_bipolar0_625
= { 1, {
194 static const struct comedi_lrange range812_bipolar0_3125
= { 1, {
200 static const struct comedi_lrange range_pcl813b_ai
= { 4, {
208 static const struct comedi_lrange range_pcl813b2_ai
= { 4, {
216 static const struct comedi_lrange range_iso813_1_ai
= { 5, {
225 static const struct comedi_lrange range_iso813_1_2_ai
= { 5, {
234 static const struct comedi_lrange range_iso813_2_ai
= { 4, {
242 static const struct comedi_lrange range_iso813_2_2_ai
= { 4, {
250 static const struct comedi_lrange range_acl8113_1_ai
= { 4, {
258 static const struct comedi_lrange range_acl8113_1_2_ai
= { 4, {
266 static const struct comedi_lrange range_acl8113_2_ai
= { 3, {
273 static const struct comedi_lrange range_acl8113_2_2_ai
= { 3, {
280 static const struct comedi_lrange range_acl8112dg_ai
= { 9, {
293 static const struct comedi_lrange range_acl8112hg_ai
= { 12, {
309 static const struct comedi_lrange range_a821pgh_ai
= { 4, {
317 struct pcl812_board
{
319 const char *name
; /* board name */
320 int board_type
; /* type of this board */
321 int n_aichan
; /* num of AI chans in S.E. */
322 int n_aichan_diff
; /* DIFF num of chans */
323 int n_aochan
; /* num of DA chans */
324 int n_dichan
; /* DI and DO chans */
326 int ai_maxdata
; /* AI resolution */
327 unsigned int ai_ns_min
; /* max sample speed of card v ns */
328 unsigned int i8254_osc_base
; /* clock base */
329 const struct comedi_lrange
*rangelist_ai
; /* rangelist for A/D */
330 const struct comedi_lrange
*rangelist_ao
; /* rangelist for D/A */
331 unsigned int IRQbits
; /* allowed IRQ */
332 unsigned char DMAbits
; /* allowed DMA chans */
333 unsigned char io_range
; /* iorange for this board */
334 unsigned char haveMPC508
; /* 1=board use MPC508A multiplexor */
337 struct pcl812_private
{
339 unsigned char valid
; /* =1 device is OK */
340 unsigned char dma
; /* >0 use dma ( usedDMA channel) */
341 unsigned char use_diff
; /* =1 diff inputs */
342 unsigned char use_MPC
; /* 1=board uses MPC508A multiplexor */
343 unsigned char use_ext_trg
; /* 1=board uses external trigger */
344 unsigned char range_correction
; /* =1 we must add 1 to range number */
345 unsigned char old_chan_reg
; /* lastly used chan/gain pair */
346 unsigned char old_gain_reg
;
347 unsigned char mode_reg_int
; /* there is stored INT number for some card */
348 unsigned char ai_neverending
; /* =1 we do unlimited AI */
349 unsigned char ai_eos
; /* 1=EOS wake up */
350 unsigned char ai_dma
; /* =1 we use DMA */
351 unsigned int ai_poll_ptr
; /* how many sampes transfer poll */
352 unsigned int ai_scans
; /* len of scanlist */
353 unsigned int ai_act_scan
; /* how many scans we finished */
354 unsigned int ai_chanlist
[MAX_CHANLIST_LEN
]; /* our copy of channel/range list */
355 unsigned int ai_n_chan
; /* how many channels is measured */
356 unsigned int ai_flags
; /* flaglist */
357 unsigned int ai_data_len
; /* len of data buffer */
358 short *ai_data
; /* data buffer */
359 unsigned int ai_is16b
; /* =1 we have 16 bit card */
360 unsigned long dmabuf
[2]; /* PTR to DMA buf */
361 unsigned int dmapages
[2]; /* how many pages we have allocated */
362 unsigned int hwdmaptr
[2]; /* HW PTR to DMA buf */
363 unsigned int hwdmasize
[2]; /* DMA buf size in bytes */
364 unsigned int dmabytestomove
[2]; /* how many bytes DMA transfer */
365 int next_dma_buf
; /* which buffer is next to use */
366 unsigned int dma_runs_to_end
; /* how many times we must switch DMA buffers */
367 unsigned int last_dma_run
; /* how many bytes to transfer on last DMA buffer */
368 unsigned int max_812_ai_mode0_rangewait
; /* setling time for gain */
369 unsigned int ao_readback
[2]; /* data for AO readback */
373 ==============================================================================
375 static void start_pacer(struct comedi_device
*dev
, int mode
,
376 unsigned int divisor1
, unsigned int divisor2
);
377 static void setup_range_channel(struct comedi_device
*dev
,
378 struct comedi_subdevice
*s
,
379 unsigned int rangechan
, char wait
);
380 static int pcl812_ai_cancel(struct comedi_device
*dev
,
381 struct comedi_subdevice
*s
);
383 ==============================================================================
385 static int pcl812_ai_insn_read(struct comedi_device
*dev
,
386 struct comedi_subdevice
*s
,
387 struct comedi_insn
*insn
, unsigned int *data
)
389 struct pcl812_private
*devpriv
= dev
->private;
393 /* select software trigger */
394 outb(devpriv
->mode_reg_int
| 1, dev
->iobase
+ PCL812_MODE
);
395 /* select channel and renge */
396 setup_range_channel(dev
, s
, insn
->chanspec
, 1);
397 for (n
= 0; n
< insn
->n
; n
++) {
398 /* start conversion */
399 outb(255, dev
->iobase
+ PCL812_SOFTTRIG
);
401 timeout
= 50; /* wait max 50us, it must finish under 33us */
403 hi
= inb(dev
->iobase
+ PCL812_AD_HI
);
404 if (!(hi
& PCL812_DRDY
))
409 ("comedi%d: pcl812: (%s at 0x%lx) A/D insn read timeout\n",
410 dev
->minor
, dev
->board_name
, dev
->iobase
);
411 outb(devpriv
->mode_reg_int
| 0, dev
->iobase
+ PCL812_MODE
);
415 data
[n
] = ((hi
& 0xf) << 8) | inb(dev
->iobase
+ PCL812_AD_LO
);
417 outb(devpriv
->mode_reg_int
| 0, dev
->iobase
+ PCL812_MODE
);
422 ==============================================================================
424 static int acl8216_ai_insn_read(struct comedi_device
*dev
,
425 struct comedi_subdevice
*s
,
426 struct comedi_insn
*insn
, unsigned int *data
)
431 /* select software trigger */
432 outb(1, dev
->iobase
+ PCL812_MODE
);
433 /* select channel and renge */
434 setup_range_channel(dev
, s
, insn
->chanspec
, 1);
435 for (n
= 0; n
< insn
->n
; n
++) {
436 /* start conversion */
437 outb(255, dev
->iobase
+ PCL812_SOFTTRIG
);
439 timeout
= 50; /* wait max 50us, it must finish under 33us */
441 if (!(inb(dev
->iobase
+ ACL8216_STATUS
) & ACL8216_DRDY
))
446 ("comedi%d: pcl812: (%s at 0x%lx) A/D insn read timeout\n",
447 dev
->minor
, dev
->board_name
, dev
->iobase
);
448 outb(0, dev
->iobase
+ PCL812_MODE
);
454 PCL812_AD_HI
) << 8) | inb(dev
->iobase
+ PCL812_AD_LO
);
456 outb(0, dev
->iobase
+ PCL812_MODE
);
461 ==============================================================================
463 static int pcl812_ao_insn_write(struct comedi_device
*dev
,
464 struct comedi_subdevice
*s
,
465 struct comedi_insn
*insn
, unsigned int *data
)
467 struct pcl812_private
*devpriv
= dev
->private;
468 int chan
= CR_CHAN(insn
->chanspec
);
471 for (i
= 0; i
< insn
->n
; i
++) {
472 outb((data
[i
] & 0xff),
473 dev
->iobase
+ (chan
? PCL812_DA2_LO
: PCL812_DA1_LO
));
474 outb((data
[i
] >> 8) & 0x0f,
475 dev
->iobase
+ (chan
? PCL812_DA2_HI
: PCL812_DA1_HI
));
476 devpriv
->ao_readback
[chan
] = data
[i
];
483 ==============================================================================
485 static int pcl812_ao_insn_read(struct comedi_device
*dev
,
486 struct comedi_subdevice
*s
,
487 struct comedi_insn
*insn
, unsigned int *data
)
489 struct pcl812_private
*devpriv
= dev
->private;
490 int chan
= CR_CHAN(insn
->chanspec
);
493 for (i
= 0; i
< insn
->n
; i
++)
494 data
[i
] = devpriv
->ao_readback
[chan
];
500 ==============================================================================
502 static int pcl812_di_insn_bits(struct comedi_device
*dev
,
503 struct comedi_subdevice
*s
,
504 struct comedi_insn
*insn
, unsigned int *data
)
506 data
[1] = inb(dev
->iobase
+ PCL812_DI_LO
);
507 data
[1] |= inb(dev
->iobase
+ PCL812_DI_HI
) << 8;
513 ==============================================================================
515 static int pcl812_do_insn_bits(struct comedi_device
*dev
,
516 struct comedi_subdevice
*s
,
517 struct comedi_insn
*insn
, unsigned int *data
)
520 s
->state
&= ~data
[0];
521 s
->state
|= data
[0] & data
[1];
522 outb(s
->state
& 0xff, dev
->iobase
+ PCL812_DO_LO
);
523 outb((s
->state
>> 8), dev
->iobase
+ PCL812_DO_HI
);
531 ==============================================================================
533 static int pcl812_ai_cmdtest(struct comedi_device
*dev
,
534 struct comedi_subdevice
*s
, struct comedi_cmd
*cmd
)
536 const struct pcl812_board
*board
= comedi_board(dev
);
537 struct pcl812_private
*devpriv
= dev
->private;
540 int tmp
, divisor1
, divisor2
;
542 /* Step 1 : check if triggers are trivially valid */
544 err
|= cfc_check_trigger_src(&cmd
->start_src
, TRIG_NOW
);
545 err
|= cfc_check_trigger_src(&cmd
->scan_begin_src
, TRIG_FOLLOW
);
547 if (devpriv
->use_ext_trg
)
551 err
|= cfc_check_trigger_src(&cmd
->convert_src
, flags
);
553 err
|= cfc_check_trigger_src(&cmd
->scan_end_src
, TRIG_COUNT
);
554 err
|= cfc_check_trigger_src(&cmd
->stop_src
, TRIG_COUNT
| TRIG_NONE
);
559 /* Step 2a : make sure trigger sources are unique */
561 err
|= cfc_check_trigger_is_unique(cmd
->stop_src
);
563 /* Step 2b : and mutually compatible */
568 /* Step 3: check if arguments are trivially valid */
570 err
|= cfc_check_trigger_arg_is(&cmd
->start_arg
, 0);
571 err
|= cfc_check_trigger_arg_is(&cmd
->scan_begin_arg
, 0);
573 if (cmd
->convert_src
== TRIG_TIMER
)
574 err
|= cfc_check_trigger_arg_min(&cmd
->convert_arg
,
577 err
|= cfc_check_trigger_arg_is(&cmd
->convert_arg
, 0);
579 err
|= cfc_check_trigger_arg_min(&cmd
->chanlist_len
, 1);
580 err
|= cfc_check_trigger_arg_max(&cmd
->chanlist_len
, MAX_CHANLIST_LEN
);
581 err
|= cfc_check_trigger_arg_is(&cmd
->scan_end_arg
, cmd
->chanlist_len
);
583 if (cmd
->stop_src
== TRIG_COUNT
)
584 err
|= cfc_check_trigger_arg_min(&cmd
->stop_arg
, 1);
586 err
|= cfc_check_trigger_arg_is(&cmd
->stop_arg
, 0);
591 /* step 4: fix up any arguments */
593 if (cmd
->convert_src
== TRIG_TIMER
) {
594 tmp
= cmd
->convert_arg
;
595 i8253_cascade_ns_to_timer(board
->i8254_osc_base
, &divisor1
,
596 &divisor2
, &cmd
->convert_arg
,
597 cmd
->flags
& TRIG_ROUND_MASK
);
598 if (cmd
->convert_arg
< board
->ai_ns_min
)
599 cmd
->convert_arg
= board
->ai_ns_min
;
600 if (tmp
!= cmd
->convert_arg
)
611 ==============================================================================
613 static int pcl812_ai_cmd(struct comedi_device
*dev
, struct comedi_subdevice
*s
)
615 const struct pcl812_board
*board
= comedi_board(dev
);
616 struct pcl812_private
*devpriv
= dev
->private;
617 unsigned int divisor1
= 0, divisor2
= 0, i
, dma_flags
, bytes
;
618 struct comedi_cmd
*cmd
= &s
->async
->cmd
;
620 if (cmd
->start_src
!= TRIG_NOW
)
622 if (cmd
->scan_begin_src
!= TRIG_FOLLOW
)
624 if (devpriv
->use_ext_trg
) {
625 if (cmd
->convert_src
!= TRIG_EXT
)
628 if (cmd
->convert_src
!= TRIG_TIMER
)
631 if (cmd
->scan_end_src
!= TRIG_COUNT
)
633 if (cmd
->scan_end_arg
!= cmd
->chanlist_len
)
635 if (cmd
->chanlist_len
> MAX_CHANLIST_LEN
)
638 if (cmd
->convert_src
== TRIG_TIMER
) {
639 if (cmd
->convert_arg
< board
->ai_ns_min
)
640 cmd
->convert_arg
= board
->ai_ns_min
;
641 i8253_cascade_ns_to_timer(board
->i8254_osc_base
,
642 &divisor1
, &divisor2
,
644 cmd
->flags
& TRIG_ROUND_MASK
);
647 start_pacer(dev
, -1, 0, 0); /* stop pacer */
649 devpriv
->ai_n_chan
= cmd
->chanlist_len
;
650 memcpy(devpriv
->ai_chanlist
, cmd
->chanlist
,
651 sizeof(unsigned int) * cmd
->scan_end_arg
);
652 /* select first channel and range */
653 setup_range_channel(dev
, s
, devpriv
->ai_chanlist
[0], 1);
655 if (devpriv
->dma
) { /* check if we can use DMA transfer */
657 for (i
= 1; i
< devpriv
->ai_n_chan
; i
++)
658 if (devpriv
->ai_chanlist
[0] != devpriv
->ai_chanlist
[i
]) {
659 /* we cann't use DMA :-( */
666 devpriv
->ai_flags
= cmd
->flags
;
667 devpriv
->ai_data_len
= s
->async
->prealloc_bufsz
;
668 devpriv
->ai_data
= s
->async
->prealloc_buf
;
669 if (cmd
->stop_src
== TRIG_COUNT
) {
670 devpriv
->ai_scans
= cmd
->stop_arg
;
671 devpriv
->ai_neverending
= 0;
673 devpriv
->ai_scans
= 0;
674 devpriv
->ai_neverending
= 1;
677 devpriv
->ai_act_scan
= 0;
678 devpriv
->ai_poll_ptr
= 0;
679 s
->async
->cur_chan
= 0;
681 /* don't we want wake up every scan? */
682 if ((devpriv
->ai_flags
& TRIG_WAKE_EOS
)) {
685 /* DMA is useless for this situation */
686 if (devpriv
->ai_n_chan
== 1)
690 if (devpriv
->ai_dma
) {
691 /* we use EOS, so adapt DMA buffer to one scan */
692 if (devpriv
->ai_eos
) {
693 devpriv
->dmabytestomove
[0] =
694 devpriv
->ai_n_chan
* sizeof(short);
695 devpriv
->dmabytestomove
[1] =
696 devpriv
->ai_n_chan
* sizeof(short);
697 devpriv
->dma_runs_to_end
= 1;
699 devpriv
->dmabytestomove
[0] = devpriv
->hwdmasize
[0];
700 devpriv
->dmabytestomove
[1] = devpriv
->hwdmasize
[1];
701 if (devpriv
->ai_data_len
< devpriv
->hwdmasize
[0])
702 devpriv
->dmabytestomove
[0] =
703 devpriv
->ai_data_len
;
704 if (devpriv
->ai_data_len
< devpriv
->hwdmasize
[1])
705 devpriv
->dmabytestomove
[1] =
706 devpriv
->ai_data_len
;
707 if (devpriv
->ai_neverending
) {
708 devpriv
->dma_runs_to_end
= 1;
710 /* how many samples we must transfer? */
711 bytes
= devpriv
->ai_n_chan
*
712 devpriv
->ai_scans
* sizeof(short);
714 /* how many DMA pages we must fill */
715 devpriv
->dma_runs_to_end
=
716 bytes
/ devpriv
->dmabytestomove
[0];
718 /* on last dma transfer must be moved */
719 devpriv
->last_dma_run
=
720 bytes
% devpriv
->dmabytestomove
[0];
721 if (devpriv
->dma_runs_to_end
== 0)
722 devpriv
->dmabytestomove
[0] =
723 devpriv
->last_dma_run
;
724 devpriv
->dma_runs_to_end
--;
727 if (devpriv
->dmabytestomove
[0] > devpriv
->hwdmasize
[0]) {
728 devpriv
->dmabytestomove
[0] = devpriv
->hwdmasize
[0];
731 if (devpriv
->dmabytestomove
[1] > devpriv
->hwdmasize
[1]) {
732 devpriv
->dmabytestomove
[1] = devpriv
->hwdmasize
[1];
735 devpriv
->next_dma_buf
= 0;
736 set_dma_mode(devpriv
->dma
, DMA_MODE_READ
);
737 dma_flags
= claim_dma_lock();
738 clear_dma_ff(devpriv
->dma
);
739 set_dma_addr(devpriv
->dma
, devpriv
->hwdmaptr
[0]);
740 set_dma_count(devpriv
->dma
, devpriv
->dmabytestomove
[0]);
741 release_dma_lock(dma_flags
);
742 enable_dma(devpriv
->dma
);
745 switch (cmd
->convert_src
) {
747 start_pacer(dev
, 1, divisor1
, divisor2
);
751 if (devpriv
->ai_dma
) /* let's go! */
752 outb(devpriv
->mode_reg_int
| 2, dev
->iobase
+ PCL812_MODE
);
754 outb(devpriv
->mode_reg_int
| 6, dev
->iobase
+ PCL812_MODE
);
760 ==============================================================================
762 static irqreturn_t
interrupt_pcl812_ai_int(int irq
, void *d
)
765 unsigned int mask
, timeout
;
766 struct comedi_device
*dev
= d
;
767 struct pcl812_private
*devpriv
= dev
->private;
768 struct comedi_subdevice
*s
= &dev
->subdevices
[0];
769 unsigned int next_chan
;
771 s
->async
->events
= 0;
773 timeout
= 50; /* wait max 50us, it must finish under 33us */
774 if (devpriv
->ai_is16b
) {
777 if (!(inb(dev
->iobase
+ ACL8216_STATUS
) & ACL8216_DRDY
)) {
786 if (!(inb(dev
->iobase
+ PCL812_AD_HI
) & PCL812_DRDY
)) {
796 ("comedi%d: pcl812: (%s at 0x%lx) "
797 "A/D cmd IRQ without DRDY!\n",
798 dev
->minor
, dev
->board_name
, dev
->iobase
);
799 pcl812_ai_cancel(dev
, s
);
800 s
->async
->events
|= COMEDI_CB_EOA
| COMEDI_CB_ERROR
;
801 comedi_event(dev
, s
);
805 comedi_buf_put(s
->async
,
806 ((inb(dev
->iobase
+ PCL812_AD_HI
) << 8) |
807 inb(dev
->iobase
+ PCL812_AD_LO
)) & mask
);
809 /* Set up next channel. Added by abbotti 2010-01-20, but untested. */
810 next_chan
= s
->async
->cur_chan
+ 1;
811 if (next_chan
>= devpriv
->ai_n_chan
)
813 if (devpriv
->ai_chanlist
[s
->async
->cur_chan
] !=
814 devpriv
->ai_chanlist
[next_chan
])
815 setup_range_channel(dev
, s
, devpriv
->ai_chanlist
[next_chan
], 0);
817 outb(0, dev
->iobase
+ PCL812_CLRINT
); /* clear INT request */
819 s
->async
->cur_chan
= next_chan
;
820 if (next_chan
== 0) { /* one scan done */
821 devpriv
->ai_act_scan
++;
822 if (!(devpriv
->ai_neverending
))
823 /* all data sampled */
824 if (devpriv
->ai_act_scan
>= devpriv
->ai_scans
) {
825 pcl812_ai_cancel(dev
, s
);
826 s
->async
->events
|= COMEDI_CB_EOA
;
830 comedi_event(dev
, s
);
835 ==============================================================================
837 static void transfer_from_dma_buf(struct comedi_device
*dev
,
838 struct comedi_subdevice
*s
, short *ptr
,
839 unsigned int bufptr
, unsigned int len
)
841 struct pcl812_private
*devpriv
= dev
->private;
844 s
->async
->events
= 0;
845 for (i
= len
; i
; i
--) {
847 comedi_buf_put(s
->async
, ptr
[bufptr
++]);
849 s
->async
->cur_chan
++;
850 if (s
->async
->cur_chan
>= devpriv
->ai_n_chan
) {
851 s
->async
->cur_chan
= 0;
852 devpriv
->ai_act_scan
++;
853 if (!devpriv
->ai_neverending
)
854 /* all data sampled */
855 if (devpriv
->ai_act_scan
>= devpriv
->ai_scans
) {
856 pcl812_ai_cancel(dev
, s
);
857 s
->async
->events
|= COMEDI_CB_EOA
;
863 comedi_event(dev
, s
);
867 ==============================================================================
869 static irqreturn_t
interrupt_pcl812_ai_dma(int irq
, void *d
)
871 struct comedi_device
*dev
= d
;
872 struct pcl812_private
*devpriv
= dev
->private;
873 struct comedi_subdevice
*s
= &dev
->subdevices
[0];
874 unsigned long dma_flags
;
878 ptr
= (short *)devpriv
->dmabuf
[devpriv
->next_dma_buf
];
879 len
= (devpriv
->dmabytestomove
[devpriv
->next_dma_buf
] >> 1) -
880 devpriv
->ai_poll_ptr
;
882 devpriv
->next_dma_buf
= 1 - devpriv
->next_dma_buf
;
883 disable_dma(devpriv
->dma
);
884 set_dma_mode(devpriv
->dma
, DMA_MODE_READ
);
885 dma_flags
= claim_dma_lock();
886 set_dma_addr(devpriv
->dma
, devpriv
->hwdmaptr
[devpriv
->next_dma_buf
]);
887 if (devpriv
->ai_eos
) {
888 set_dma_count(devpriv
->dma
,
889 devpriv
->dmabytestomove
[devpriv
->next_dma_buf
]);
891 if (devpriv
->dma_runs_to_end
) {
892 set_dma_count(devpriv
->dma
,
893 devpriv
->dmabytestomove
[devpriv
->
896 set_dma_count(devpriv
->dma
, devpriv
->last_dma_run
);
898 devpriv
->dma_runs_to_end
--;
900 release_dma_lock(dma_flags
);
901 enable_dma(devpriv
->dma
);
903 outb(0, dev
->iobase
+ PCL812_CLRINT
); /* clear INT request */
905 bufptr
= devpriv
->ai_poll_ptr
;
906 devpriv
->ai_poll_ptr
= 0;
908 transfer_from_dma_buf(dev
, s
, ptr
, bufptr
, len
);
914 ==============================================================================
916 static irqreturn_t
interrupt_pcl812(int irq
, void *d
)
918 struct comedi_device
*dev
= d
;
919 struct pcl812_private
*devpriv
= dev
->private;
921 if (!dev
->attached
) {
922 comedi_error(dev
, "spurious interrupt");
926 return interrupt_pcl812_ai_dma(irq
, d
);
928 return interrupt_pcl812_ai_int(irq
, d
);
932 ==============================================================================
934 static int pcl812_ai_poll(struct comedi_device
*dev
, struct comedi_subdevice
*s
)
936 struct pcl812_private
*devpriv
= dev
->private;
938 unsigned int top1
, top2
, i
;
940 if (!devpriv
->ai_dma
)
941 return 0; /* poll is valid only for DMA transfer */
943 spin_lock_irqsave(&dev
->spinlock
, flags
);
945 for (i
= 0; i
< 10; i
++) {
946 /* where is now DMA */
947 top1
= get_dma_residue(devpriv
->ai_dma
);
948 top2
= get_dma_residue(devpriv
->ai_dma
);
954 spin_unlock_irqrestore(&dev
->spinlock
, flags
);
957 /* where is now DMA in buffer */
958 top1
= devpriv
->dmabytestomove
[1 - devpriv
->next_dma_buf
] - top1
;
959 top1
>>= 1; /* sample position */
960 top2
= top1
- devpriv
->ai_poll_ptr
;
961 if (top2
< 1) { /* no new samples */
962 spin_unlock_irqrestore(&dev
->spinlock
, flags
);
966 transfer_from_dma_buf(dev
, s
,
967 (void *)devpriv
->dmabuf
[1 -
968 devpriv
->next_dma_buf
],
969 devpriv
->ai_poll_ptr
, top2
);
971 devpriv
->ai_poll_ptr
= top1
; /* new buffer position */
973 spin_unlock_irqrestore(&dev
->spinlock
, flags
);
975 return s
->async
->buf_write_count
- s
->async
->buf_read_count
;
979 ==============================================================================
981 static void setup_range_channel(struct comedi_device
*dev
,
982 struct comedi_subdevice
*s
,
983 unsigned int rangechan
, char wait
)
985 struct pcl812_private
*devpriv
= dev
->private;
986 unsigned char chan_reg
= CR_CHAN(rangechan
); /* normal board */
988 unsigned char gain_reg
= CR_RANGE(rangechan
) +
989 devpriv
->range_correction
;
991 if ((chan_reg
== devpriv
->old_chan_reg
)
992 && (gain_reg
== devpriv
->old_gain_reg
))
993 return; /* we can return, no change */
995 devpriv
->old_chan_reg
= chan_reg
;
996 devpriv
->old_gain_reg
= gain_reg
;
998 if (devpriv
->use_MPC
) {
999 if (devpriv
->use_diff
) {
1000 chan_reg
= chan_reg
| 0x30; /* DIFF inputs */
1002 if (chan_reg
& 0x80)
1003 /* SE inputs 8-15 */
1004 chan_reg
= chan_reg
| 0x20;
1007 chan_reg
= chan_reg
| 0x10;
1011 outb(chan_reg
, dev
->iobase
+ PCL812_MUX
); /* select channel */
1012 outb(gain_reg
, dev
->iobase
+ PCL812_GAIN
); /* select gain */
1017 * XXX this depends on selected range and can be very long for
1018 * some high gain ranges!
1020 udelay(devpriv
->max_812_ai_mode0_rangewait
);
1024 ==============================================================================
1026 static void start_pacer(struct comedi_device
*dev
, int mode
,
1027 unsigned int divisor1
, unsigned int divisor2
)
1029 outb(0xb4, dev
->iobase
+ PCL812_CTRCTL
);
1030 outb(0x74, dev
->iobase
+ PCL812_CTRCTL
);
1034 outb(divisor2
& 0xff, dev
->iobase
+ PCL812_CTR2
);
1035 outb((divisor2
>> 8) & 0xff, dev
->iobase
+ PCL812_CTR2
);
1036 outb(divisor1
& 0xff, dev
->iobase
+ PCL812_CTR1
);
1037 outb((divisor1
>> 8) & 0xff, dev
->iobase
+ PCL812_CTR1
);
1042 ==============================================================================
1044 static int pcl812_ai_cancel(struct comedi_device
*dev
,
1045 struct comedi_subdevice
*s
)
1047 struct pcl812_private
*devpriv
= dev
->private;
1049 if (devpriv
->ai_dma
)
1050 disable_dma(devpriv
->dma
);
1051 outb(0, dev
->iobase
+ PCL812_CLRINT
); /* clear INT request */
1053 outb(devpriv
->mode_reg_int
| 0, dev
->iobase
+ PCL812_MODE
);
1054 start_pacer(dev
, -1, 0, 0); /* stop 8254 */
1055 outb(0, dev
->iobase
+ PCL812_CLRINT
); /* clear INT request */
1060 ==============================================================================
1062 static void pcl812_reset(struct comedi_device
*dev
)
1064 const struct pcl812_board
*board
= comedi_board(dev
);
1065 struct pcl812_private
*devpriv
= dev
->private;
1067 outb(0, dev
->iobase
+ PCL812_MUX
);
1068 outb(0 + devpriv
->range_correction
, dev
->iobase
+ PCL812_GAIN
);
1069 devpriv
->old_chan_reg
= -1; /* invalidate chain/gain memory */
1070 devpriv
->old_gain_reg
= -1;
1072 switch (board
->board_type
) {
1077 outb(0, dev
->iobase
+ PCL812_DA2_LO
);
1078 outb(0, dev
->iobase
+ PCL812_DA2_HI
);
1080 outb(0, dev
->iobase
+ PCL812_DA1_LO
);
1081 outb(0, dev
->iobase
+ PCL812_DA1_HI
);
1082 start_pacer(dev
, -1, 0, 0); /* stop 8254 */
1083 outb(0, dev
->iobase
+ PCL812_DO_HI
);
1084 outb(0, dev
->iobase
+ PCL812_DO_LO
);
1085 outb(devpriv
->mode_reg_int
| 0, dev
->iobase
+ PCL812_MODE
);
1086 outb(0, dev
->iobase
+ PCL812_CLRINT
);
1098 static int pcl812_attach(struct comedi_device
*dev
, struct comedi_devconfig
*it
)
1100 const struct pcl812_board
*board
= comedi_board(dev
);
1101 struct pcl812_private
*devpriv
;
1105 unsigned long pages
;
1106 struct comedi_subdevice
*s
;
1109 ret
= comedi_request_region(dev
, it
->options
[0], board
->io_range
);
1113 devpriv
= kzalloc(sizeof(*devpriv
), GFP_KERNEL
);
1116 dev
->private = devpriv
;
1119 if (board
->IRQbits
!= 0) { /* board support IRQ */
1120 irq
= it
->options
[1];
1121 if (irq
) { /* we want to use IRQ */
1122 if (((1 << irq
) & board
->IRQbits
) == 0) {
1124 (", IRQ %u is out of allowed range, "
1125 "DISABLING IT", irq
);
1126 irq
= 0; /* Bad IRQ */
1128 if (request_irq(irq
, interrupt_pcl812
, 0,
1129 dev
->board_name
, dev
)) {
1131 (", unable to allocate IRQ %u, "
1132 "DISABLING IT", irq
);
1133 irq
= 0; /* Can't use IRQ */
1135 printk(KERN_INFO
", irq=%u", irq
);
1146 goto no_dma
; /* if we haven't IRQ, we can't use DMA */
1147 if (board
->DMAbits
!= 0) { /* board support DMA */
1148 dma
= it
->options
[2];
1149 if (((1 << dma
) & board
->DMAbits
) == 0) {
1150 printk(", DMA is out of allowed range, FAIL!\n");
1151 return -EINVAL
; /* Bad DMA */
1153 ret
= request_dma(dma
, dev
->board_name
);
1155 printk(KERN_ERR
", unable to allocate DMA %u, FAIL!\n",
1157 return -EBUSY
; /* DMA isn't free */
1160 printk(KERN_INFO
", dma=%u", dma
);
1161 pages
= 1; /* we want 8KB */
1162 devpriv
->dmabuf
[0] = __get_dma_pages(GFP_KERNEL
, pages
);
1163 if (!devpriv
->dmabuf
[0]) {
1164 printk(", unable to allocate DMA buffer, FAIL!\n");
1166 * maybe experiment with try_to_free_pages()
1169 return -EBUSY
; /* no buffer :-( */
1171 devpriv
->dmapages
[0] = pages
;
1172 devpriv
->hwdmaptr
[0] = virt_to_bus((void *)devpriv
->dmabuf
[0]);
1173 devpriv
->hwdmasize
[0] = PAGE_SIZE
* (1 << pages
);
1174 devpriv
->dmabuf
[1] = __get_dma_pages(GFP_KERNEL
, pages
);
1175 if (!devpriv
->dmabuf
[1]) {
1176 printk(KERN_ERR
", unable to allocate DMA buffer, FAIL!\n");
1179 devpriv
->dmapages
[1] = pages
;
1180 devpriv
->hwdmaptr
[1] = virt_to_bus((void *)devpriv
->dmabuf
[1]);
1181 devpriv
->hwdmasize
[1] = PAGE_SIZE
* (1 << pages
);
1186 if (board
->n_aichan
> 0)
1188 if (board
->n_aochan
> 0)
1190 if (board
->n_dichan
> 0)
1192 if (board
->n_dochan
> 0)
1195 ret
= comedi_alloc_subdevices(dev
, n_subdevices
);
1202 if (board
->n_aichan
> 0) {
1203 s
= &dev
->subdevices
[subdev
];
1204 s
->type
= COMEDI_SUBD_AI
;
1205 s
->subdev_flags
= SDF_READABLE
;
1206 switch (board
->board_type
) {
1208 if (it
->options
[2] == 1) {
1209 s
->n_chan
= board
->n_aichan_diff
;
1210 s
->subdev_flags
|= SDF_DIFF
;
1211 devpriv
->use_diff
= 1;
1213 s
->n_chan
= board
->n_aichan
;
1214 s
->subdev_flags
|= SDF_GROUND
;
1219 if (it
->options
[4] == 1) {
1220 s
->n_chan
= board
->n_aichan_diff
;
1221 s
->subdev_flags
|= SDF_DIFF
;
1222 devpriv
->use_diff
= 1;
1224 s
->n_chan
= board
->n_aichan
;
1225 s
->subdev_flags
|= SDF_GROUND
;
1229 s
->n_chan
= board
->n_aichan
;
1230 s
->subdev_flags
|= SDF_GROUND
;
1233 s
->maxdata
= board
->ai_maxdata
;
1234 s
->len_chanlist
= MAX_CHANLIST_LEN
;
1235 s
->range_table
= board
->rangelist_ai
;
1236 if (board
->board_type
== boardACL8216
)
1237 s
->insn_read
= acl8216_ai_insn_read
;
1239 s
->insn_read
= pcl812_ai_insn_read
;
1241 devpriv
->use_MPC
= board
->haveMPC508
;
1242 s
->cancel
= pcl812_ai_cancel
;
1244 dev
->read_subdev
= s
;
1245 s
->subdev_flags
|= SDF_CMD_READ
;
1246 s
->do_cmdtest
= pcl812_ai_cmdtest
;
1247 s
->do_cmd
= pcl812_ai_cmd
;
1248 s
->poll
= pcl812_ai_poll
;
1250 switch (board
->board_type
) {
1252 if (it
->options
[4] == 1)
1253 s
->range_table
= &range_pcl812pg2_ai
;
1256 switch (it
->options
[4]) {
1258 s
->range_table
= &range_bipolar10
;
1261 s
->range_table
= &range_bipolar5
;
1264 s
->range_table
= &range_bipolar2_5
;
1267 s
->range_table
= &range812_bipolar1_25
;
1270 s
->range_table
= &range812_bipolar0_625
;
1273 s
->range_table
= &range812_bipolar0_3125
;
1276 s
->range_table
= &range_bipolar10
;
1279 (", incorrect range number %d, changing "
1280 "to 0 (+/-10V)", it
->options
[4]);
1286 if (it
->options
[1] == 1)
1287 s
->range_table
= &range_pcl813b2_ai
;
1290 switch (it
->options
[1]) {
1292 s
->range_table
= &range_iso813_1_ai
;
1295 s
->range_table
= &range_iso813_1_2_ai
;
1298 s
->range_table
= &range_iso813_2_ai
;
1299 devpriv
->range_correction
= 1;
1302 s
->range_table
= &range_iso813_2_2_ai
;
1303 devpriv
->range_correction
= 1;
1306 s
->range_table
= &range_iso813_1_ai
;
1309 (", incorrect range number %d, "
1310 "changing to 0 ", it
->options
[1]);
1315 switch (it
->options
[1]) {
1317 s
->range_table
= &range_acl8113_1_ai
;
1320 s
->range_table
= &range_acl8113_1_2_ai
;
1323 s
->range_table
= &range_acl8113_2_ai
;
1324 devpriv
->range_correction
= 1;
1327 s
->range_table
= &range_acl8113_2_2_ai
;
1328 devpriv
->range_correction
= 1;
1331 s
->range_table
= &range_acl8113_1_ai
;
1334 (", incorrect range number %d, "
1335 "changing to 0 ", it
->options
[1]);
1344 if (board
->n_aochan
> 0) {
1345 s
= &dev
->subdevices
[subdev
];
1346 s
->type
= COMEDI_SUBD_AO
;
1347 s
->subdev_flags
= SDF_WRITABLE
| SDF_GROUND
;
1348 s
->n_chan
= board
->n_aochan
;
1350 s
->len_chanlist
= 1;
1351 s
->range_table
= board
->rangelist_ao
;
1352 s
->insn_read
= pcl812_ao_insn_read
;
1353 s
->insn_write
= pcl812_ao_insn_write
;
1354 switch (board
->board_type
) {
1356 if (it
->options
[3] == 1)
1357 s
->range_table
= &range_unipolar10
;
1363 if (it
->options
[5] == 1)
1364 s
->range_table
= &range_unipolar10
;
1365 if (it
->options
[5] == 2)
1366 s
->range_table
= &range_unknown
;
1373 if (board
->n_dichan
> 0) {
1374 s
= &dev
->subdevices
[subdev
];
1375 s
->type
= COMEDI_SUBD_DI
;
1376 s
->subdev_flags
= SDF_READABLE
;
1377 s
->n_chan
= board
->n_dichan
;
1379 s
->len_chanlist
= board
->n_dichan
;
1380 s
->range_table
= &range_digital
;
1381 s
->insn_bits
= pcl812_di_insn_bits
;
1385 /* digital output */
1386 if (board
->n_dochan
> 0) {
1387 s
= &dev
->subdevices
[subdev
];
1388 s
->type
= COMEDI_SUBD_DO
;
1389 s
->subdev_flags
= SDF_WRITABLE
;
1390 s
->n_chan
= board
->n_dochan
;
1392 s
->len_chanlist
= board
->n_dochan
;
1393 s
->range_table
= &range_digital
;
1394 s
->insn_bits
= pcl812_do_insn_bits
;
1398 switch (board
->board_type
) {
1400 devpriv
->ai_is16b
= 1;
1404 devpriv
->max_812_ai_mode0_rangewait
= 1;
1405 if (it
->options
[3] > 0)
1406 /* we use external trigger */
1407 devpriv
->use_ext_trg
= 1;
1409 devpriv
->max_812_ai_mode0_rangewait
= 1;
1410 devpriv
->mode_reg_int
= (irq
<< 4) & 0xf0;
1416 /* maybe there must by greatest timeout */
1417 devpriv
->max_812_ai_mode0_rangewait
= 5;
1421 printk(KERN_INFO
"\n");
1429 static void pcl812_detach(struct comedi_device
*dev
)
1431 struct pcl812_private
*devpriv
= dev
->private;
1434 if (devpriv
->dmabuf
[0])
1435 free_pages(devpriv
->dmabuf
[0], devpriv
->dmapages
[0]);
1436 if (devpriv
->dmabuf
[1])
1437 free_pages(devpriv
->dmabuf
[1], devpriv
->dmapages
[1]);
1439 free_dma(devpriv
->dma
);
1441 comedi_legacy_detach(dev
);
1444 static const struct pcl812_board boardtypes
[] = {
1445 {"pcl812", boardPCL812
, 16, 0, 2, 16, 16, 0x0fff,
1446 33000, 500, &range_bipolar10
, &range_unipolar5
,
1447 0xdcfc, 0x0a, PCLx1x_IORANGE
, 0},
1448 {"pcl812pg", boardPCL812PG
, 16, 0, 2, 16, 16, 0x0fff,
1449 33000, 500, &range_pcl812pg_ai
, &range_unipolar5
,
1450 0xdcfc, 0x0a, PCLx1x_IORANGE
, 0},
1451 {"acl8112pg", boardPCL812PG
, 16, 0, 2, 16, 16, 0x0fff,
1452 10000, 500, &range_pcl812pg_ai
, &range_unipolar5
,
1453 0xdcfc, 0x0a, PCLx1x_IORANGE
, 0},
1454 {"acl8112dg", boardACL8112
, 16, 8, 2, 16, 16, 0x0fff,
1455 10000, 500, &range_acl8112dg_ai
, &range_unipolar5
,
1456 0xdcfc, 0x0a, PCLx1x_IORANGE
, 1},
1457 {"acl8112hg", boardACL8112
, 16, 8, 2, 16, 16, 0x0fff,
1458 10000, 500, &range_acl8112hg_ai
, &range_unipolar5
,
1459 0xdcfc, 0x0a, PCLx1x_IORANGE
, 1},
1460 {"a821pgl", boardA821
, 16, 8, 1, 16, 16, 0x0fff,
1461 10000, 500, &range_pcl813b_ai
, &range_unipolar5
,
1462 0x000c, 0x00, PCLx1x_IORANGE
, 0},
1463 {"a821pglnda", boardA821
, 16, 8, 0, 0, 0, 0x0fff,
1464 10000, 500, &range_pcl813b_ai
, NULL
,
1465 0x000c, 0x00, PCLx1x_IORANGE
, 0},
1466 {"a821pgh", boardA821
, 16, 8, 1, 16, 16, 0x0fff,
1467 10000, 500, &range_a821pgh_ai
, &range_unipolar5
,
1468 0x000c, 0x00, PCLx1x_IORANGE
, 0},
1469 {"a822pgl", boardACL8112
, 16, 8, 2, 16, 16, 0x0fff,
1470 10000, 500, &range_acl8112dg_ai
, &range_unipolar5
,
1471 0xdcfc, 0x0a, PCLx1x_IORANGE
, 0},
1472 {"a822pgh", boardACL8112
, 16, 8, 2, 16, 16, 0x0fff,
1473 10000, 500, &range_acl8112hg_ai
, &range_unipolar5
,
1474 0xdcfc, 0x0a, PCLx1x_IORANGE
, 0},
1475 {"a823pgl", boardACL8112
, 16, 8, 2, 16, 16, 0x0fff,
1476 8000, 500, &range_acl8112dg_ai
, &range_unipolar5
,
1477 0xdcfc, 0x0a, PCLx1x_IORANGE
, 0},
1478 {"a823pgh", boardACL8112
, 16, 8, 2, 16, 16, 0x0fff,
1479 8000, 500, &range_acl8112hg_ai
, &range_unipolar5
,
1480 0xdcfc, 0x0a, PCLx1x_IORANGE
, 0},
1481 {"pcl813", boardPCL813
, 32, 0, 0, 0, 0, 0x0fff,
1482 0, 0, &range_pcl813b_ai
, NULL
,
1483 0x0000, 0x00, PCLx1x_IORANGE
, 0},
1484 {"pcl813b", boardPCL813B
, 32, 0, 0, 0, 0, 0x0fff,
1485 0, 0, &range_pcl813b_ai
, NULL
,
1486 0x0000, 0x00, PCLx1x_IORANGE
, 0},
1487 {"acl8113", boardACL8113
, 32, 0, 0, 0, 0, 0x0fff,
1488 0, 0, &range_acl8113_1_ai
, NULL
,
1489 0x0000, 0x00, PCLx1x_IORANGE
, 0},
1490 {"iso813", boardISO813
, 32, 0, 0, 0, 0, 0x0fff,
1491 0, 0, &range_iso813_1_ai
, NULL
,
1492 0x0000, 0x00, PCLx1x_IORANGE
, 0},
1493 {"acl8216", boardACL8216
, 16, 8, 2, 16, 16, 0xffff,
1494 10000, 500, &range_pcl813b2_ai
, &range_unipolar5
,
1495 0xdcfc, 0x0a, PCLx1x_IORANGE
, 1},
1496 {"a826pg", boardACL8216
, 16, 8, 2, 16, 16, 0xffff,
1497 10000, 500, &range_pcl813b2_ai
, &range_unipolar5
,
1498 0xdcfc, 0x0a, PCLx1x_IORANGE
, 0},
1501 static struct comedi_driver pcl812_driver
= {
1502 .driver_name
= "pcl812",
1503 .module
= THIS_MODULE
,
1504 .attach
= pcl812_attach
,
1505 .detach
= pcl812_detach
,
1506 .board_name
= &boardtypes
[0].name
,
1507 .num_names
= ARRAY_SIZE(boardtypes
),
1508 .offset
= sizeof(struct pcl812_board
),
1510 module_comedi_driver(pcl812_driver
);
1512 MODULE_AUTHOR("Comedi http://www.comedi.org");
1513 MODULE_DESCRIPTION("Comedi low-level driver");
1514 MODULE_LICENSE("GPL");