39 #include "../comedidev.h"
47 #define COM_REG_1 0x00
49 #define COM_REG_2 0x02
51 #define START_CONVERT_REG 0x08
52 #define START_DAQ_REG 0x0A
53 #define AD_CLEAR_REG 0x0C
54 #define EXT_STROBE_REG 0x0E
58 #define INT2CLR_REG 0x14
60 #define MUX_CNTR_REG 0x04
61 #define MUX_GAIN_REG 0x06
62 #define AD_FIFO_REG 0x16
63 #define DMA_TC_INT_CLR_REG 0x16
65 #define AM9513A_DATA_REG 0x18
66 #define AM9513A_COM_REG 0x1A
67 #define AM9513A_STAT_REG 0x1A
69 #define MIO_16_DIG_IN_REG 0x1C
70 #define MIO_16_DIG_OUT_REG 0x1C
72 #define RTSI_SW_SHIFT_REG 0x1E
73 #define RTSI_SW_STROBE_REG 0x1F
75 #define DIO_24_PORTA_REG 0x00
76 #define DIO_24_PORTB_REG 0x01
77 #define DIO_24_PORTC_REG 0x02
78 #define DIO_24_CNFG_REG 0x03
81 #define COMREG1_2SCADC 0x0001
82 #define COMREG1_1632CNT 0x0002
83 #define COMREG1_SCANEN 0x0008
84 #define COMREG1_DAQEN 0x0010
85 #define COMREG1_DMAEN 0x0020
86 #define COMREG1_CONVINTEN 0x0080
87 #define COMREG2_SCN2 0x0010
88 #define COMREG2_INTEN 0x0080
89 #define COMREG2_DOUTEN0 0x0100
90 #define COMREG2_DOUTEN1 0x0200
92 #define STAT_AD_OVERRUN 0x0100
93 #define STAT_AD_OVERFLOW 0x0200
94 #define STAT_AD_DAQPROG 0x0800
95 #define STAT_AD_CONVAVAIL 0x2000
96 #define STAT_AD_DAQSTOPINT 0x4000
98 #define CLOCK_1_MHZ 0x8B25
99 #define CLOCK_100_KHZ 0x8C25
100 #define CLOCK_10_KHZ 0x8D25
101 #define CLOCK_1_KHZ 0x8E25
102 #define CLOCK_100_HZ 0x8F25
104 #define ATMIO16D_SIZE 32
105 #define devpriv ((struct atmio16d_private *)dev->private)
106 #define ATMIO16D_TIMEOUT 10
115 static const struct comedi_lrange range_atmio16d_ai_10_bipolar = { 4, {
127 static const struct comedi_lrange range_atmio16d_ai_5_bipolar = { 4, {
139 static const struct comedi_lrange range_atmio16d_ai_unipolar = { 4, {
216 for (i = 1; i <= 5; ++
i) {
229 devpriv->adc_coding = adc_straight;
267 err |= cfc_check_trigger_is_unique(cmd->
stop_src);
331 unsigned int timer, base_clock;
339 s->
async->cur_chan = 0;
357 tmp = chan | (gain << 6);
394 if (sample_count < 65536) {
405 tmp = sample_count & 0xFFFF;
417 tmp = sample_count & 0xFFFF;
418 if ((tmp == 0) || (tmp == 1)) {
419 outw((sample_count >> 16) & 0xFFFF,
422 outw(((sample_count >> 16) & 0xFFFF) + 1,
505 for (i = 0; i < insn->
n; i++) {
516 if (
devpriv->adc_coding == adc_2comp)
528 if (t == ATMIO16D_TIMEOUT) {
544 for (i = 0; i < insn->
n; i++)
559 for (i = 0; i < insn->
n; i++) {
563 if (
devpriv->dac0_coding == dac_2comp)
568 if (
devpriv->dac1_coding == dac_2comp)
575 devpriv->ao_readback[chan] = data[
i];
585 s->
state &= ~data[0];
586 s->
state |= (data[0] | data[1]);
594 static int atmio16d_dio_insn_config(
struct comedi_device *dev,
602 for (i = 0; i < insn->
n; i++) {
664 printk(
"I/O port conflict\n");
686 ret =
request_irq(irq, atmio16d_interrupt, 0,
"atmio16d", dev);
718 s->
do_cmd = atmio16d_ai_cmd;
719 s->
cancel = atmio16d_ai_cancel;
816 .driver_name =
"atmio16",
818 .attach = atmio16d_attach,
819 .detach = atmio16d_detach,
820 .board_name = &atmio16_boards[0].
name,