63 #include "../comedidev.h"
69 #define DAS16M1_SIZE 16
70 #define DAS16M1_SIZE2 8
72 #define DAS16M1_XTAL 100
74 #define FIFO_SIZE 1024
97 #define AI_CHAN(x) ((x) & 0xf)
99 #define EXT_TRIG_BIT 0x1
102 #define DAS16M1_DIO 3
103 #define DAS16M1_CLEAR_INTR 4
104 #define DAS16M1_INTR_CONTROL 5
105 #define EXT_PACER 0x2
106 #define INT_PACER 0x3
107 #define PACER_MASK 0x3
109 #define DAS16M1_QUEUE_ADDR 6
110 #define DAS16M1_QUEUE_DATA 7
111 #define Q_CHAN(x) ((x) & 0x7)
112 #define Q_RANGE(x) (((x) & 0xf) << 4)
113 #define UNIPOLAR 0x40
114 #define DAS16M1_8254_FIRST 0x8
115 #define DAS16M1_8254_FIRST_CNTRL 0xb
116 #define TOTAL_CLEAR 0x30
117 #define DAS16M1_8254_SECOND 0xc
118 #define DAS16M1_82C55 0x400
119 #define DAS16M1_8254_THIRD 0x404
152 #define devpriv ((struct das16m1_private_struct *)(dev->private))
154 static inline short munge_sample(
short data)
156 return (data >> 4) & 0xfff;
159 static void munge_sample_array(
short *array,
unsigned int num_elements)
164 array[i] = munge_sample(array[i]);
186 err |= cfc_check_trigger_is_unique(cmd->
start_src);
187 err |= cfc_check_trigger_is_unique(cmd->
convert_src);
188 err |= cfc_check_trigger_is_unique(cmd->
stop_src);
257 " even/odd channels must go have even/odd chanlist indices");
263 "chanlist must be of even length or length 1");
277 static unsigned int das16m1_set_pacer(
struct comedi_device *dev,
278 unsigned int ns,
int rounding_flags)
298 unsigned int byte,
i;
301 comedi_error(dev,
"irq required to execute comedi_cmd");
383 for (n = 0; n < insn->
n; n++) {
389 for (i = 0; i < timeout; i++) {
428 wbits |= data[0] & data[1];
454 if (
devpriv->adc_count == 0 && hw_counter ==
devpriv->initial_hw_count) {
463 num_samples = -hw_counter -
devpriv->adc_count;
474 munge_sample_array(
devpriv->ai_buffer, num_samples);
476 num_samples *
sizeof(
short));
477 devpriv->adc_count += num_samples;
481 das16m1_cancel(dev, s);
488 if (status &
OVRUN) {
489 das16m1_cancel(dev, s);
506 das16m1_handler(dev, status);
507 spin_unlock_irqrestore(&dev->
spinlock, flags);
509 return s->
async->buf_write_count - s->
async->buf_read_count;
532 das16m1_handler(dev, status);
541 static int das16m1_irq_bits(
unsigned int irq)
604 dev->
driver->driver_name)) {
614 if (das16m1_irq_bits(irq) >= 0) {
616 dev->
driver->driver_name, dev);
622 }
else if (irq == 0) {
627 " valid irqs are 2, 3, 5, 7, 10, 11, 12, or 15\n");
647 s->
do_cmd = das16m1_cmd_exec;
648 s->
cancel = das16m1_cancel;
649 s->
poll = das16m1_poll;
681 devpriv->control_state = das16m1_irq_bits(dev->
irq);
703 .name =
"cio-das16/m1",
709 .driver_name =
"das16m1",
711 .attach = das16m1_attach,
712 .detach = das16m1_detach,
713 .board_name = &das16m1_boards[0].
name,
715 .offset =
sizeof(das16m1_boards[0]),