66 #include "../comedidev.h"
75 #define TIMER_BASE 1000
81 #define FIFO_EMPTY 0x1
84 #define DAS800_CONTROL1 2
85 #define CONTROL1_INTE 0x8
86 #define DAS800_CONV_CONTROL 2
92 #define CONV_HCEN 0x80
93 #define DAS800_SCAN_LIMITS 2
94 #define DAS800_STATUS 2
100 #define CONTROL1 0x80
101 #define CONV_CONTROL 0xa0
102 #define SCAN_LIMITS 0xc0
104 #define DAS800_8254 4
105 #define DAS800_STATUS2 7
106 #define STATUS2_HCEN 0x80
107 #define STATUS2_INTE 0X20
150 RANGE(-0.005, 0.005),
165 RANGE(-0.625, 0.625),
190 .ai_range = &range_das800_ai,
194 .name =
"cio-das800",
196 .ai_range = &range_das800_ai,
202 .ai_range = &range_das801_ai,
206 .name =
"cio-das801",
208 .ai_range = &range_cio_das801_ai,
214 .ai_range = &range_das802_ai,
218 .name =
"cio-das802",
220 .ai_range = &range_das802_ai,
224 .name =
"cio-das802/16",
226 .ai_range = &range_das80216_ai,
234 #define thisboard ((const struct das800_board *)dev->board_ptr)
244 #define devpriv ((struct das800_private *)dev->private)
252 .driver_name =
"das800",
254 .attach = das800_attach,
255 .detach = das800_detach,
257 .board_name = &das800_boards[0].
name,
285 unsigned long irq_flags;
292 spin_unlock_irqrestore(&dev->
spinlock, irq_flags);
339 "Board model: probe returned 0x%x (unknown)\n",
351 static int __init driver_das800_init_module(
void)
356 static void __exit driver_das800_cleanup_module(
void)
373 unsigned long irq_flags;
374 static const int max_loops = 128;
377 int fifo_overflow = 0;
397 spin_unlock_irqrestore(&dev->
spinlock, irq_flags);
402 for (i = 0; i < max_loops; i++) {
408 fifo_overflow = dataPoint &
FIFO_OVF;
418 dataPoint = (dataPoint >> 4) & 0xfff;
422 cfc_write_to_buffer(s, dataPoint);
430 fifo_overflow = dataPoint &
FIFO_OVF;
436 spin_unlock_irqrestore(&dev->
spinlock, irq_flags);
438 das800_cancel(dev, s);
450 spin_unlock_irqrestore(&dev->
spinlock, irq_flags);
453 spin_unlock_irqrestore(&dev->
spinlock, irq_flags);
466 unsigned int irq = it->
options[1];
467 unsigned long irq_flags;
481 "io base address required for das800\n");
492 board = das800_probe(dev);
500 if (irq == 1 || irq > 7) {
505 if (
request_irq(irq, das800_interrupt, 0,
"das800", dev)) {
528 s->
do_cmd = das800_ai_do_cmd;
531 s->
cancel = das800_cancel;
557 spin_unlock_irqrestore(&dev->
spinlock, irq_flags);
581 unsigned long irq_flags;
590 spin_unlock_irqrestore(&dev->
spinlock, irq_flags);
596 unsigned long irq_flags;
600 spin_unlock_irqrestore(&dev->
spinlock, irq_flags);
625 err |= cfc_check_trigger_is_unique(cmd->
start_src);
626 err |= cfc_check_trigger_is_unique(cmd->
convert_src);
627 err |= cfc_check_trigger_is_unique(cmd->
stop_src);
693 "entries in chanlist must be consecutive channels, counting upwards\n");
698 "entries in chanlist must all have the same gain\n");
715 unsigned long irq_flags;
720 "no irq assigned for das-800, cannot do hardware conversions");
728 endChan = (startChan + async->
cmd.chanlist_len - 1) % 8;
729 scan = (endChan << 3) | startChan;
734 spin_unlock_irqrestore(&dev->
spinlock, irq_flags);
738 if (
thisboard->resolution == 12 && gain > 0)
743 switch (async->
cmd.stop_src) {
745 devpriv->count = async->
cmd.stop_arg * async->
cmd.chanlist_len;
763 switch (async->
cmd.convert_src) {
769 &(async->
cmd.convert_arg),
772 if (das800_set_frequency(dev) < 0) {
786 spin_unlock_irqrestore(&dev->
spinlock, irq_flags);
801 unsigned long irq_flags;
811 spin_unlock_irqrestore(&dev->
spinlock, irq_flags);
815 if (
thisboard->resolution == 12 && range)
822 for (n = 0; n < insn->
n; n++) {
826 for (i = 0; i < timeout; i++) {
837 data[
n] = (lsb >> 4) & 0xff;
838 data[
n] |= (msb << 4);
840 data[
n] = (msb << 8) | lsb;
866 unsigned long irq_flags;
872 wbits |= data[0] & data[1];
878 spin_unlock_irqrestore(&dev->
spinlock, irq_flags);