3 Header file for NI general purpose counter support code (ni_tio.c)
5 COMEDI - Linux Control and Measurement Device Interface
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
18 #ifndef _COMEDI_NI_TIO_H
19 #define _COMEDI_NI_TIO_H
21 #include "../comedidev.h"
23 /* forward declarations */
25 struct ni_gpct_device;
27 enum ni_gpct_register {
101 enum ni_gpct_variant {
102 ni_gpct_variant_e_series,
103 ni_gpct_variant_m_series,
108 struct ni_gpct_device *counter_dev;
109 unsigned counter_index;
111 uint64_t clock_period_ps; /* clock period in picoseconds */
112 struct mite_channel *mite_chan;
116 struct ni_gpct_device {
117 struct comedi_device *dev;
118 void (*write)(struct ni_gpct *, unsigned int value,
119 enum ni_gpct_register);
120 unsigned int (*read)(struct ni_gpct *, enum ni_gpct_register);
121 enum ni_gpct_variant variant;
122 struct ni_gpct *counters;
123 unsigned int num_counters;
124 unsigned int regs[NITIO_NUM_REGS];
125 spinlock_t regs_lock; /* protects 'regs' */
128 struct ni_gpct_device *
129 ni_gpct_device_construct(struct comedi_device *,
130 void (*write)(struct ni_gpct *,
132 enum ni_gpct_register),
133 unsigned int (*read)(struct ni_gpct *,
134 enum ni_gpct_register),
135 enum ni_gpct_variant,
136 unsigned int num_counters);
137 void ni_gpct_device_destroy(struct ni_gpct_device *);
138 void ni_tio_init_counter(struct ni_gpct *);
139 int ni_tio_insn_read(struct comedi_device *, struct comedi_subdevice *,
140 struct comedi_insn *, unsigned int *data);
141 int ni_tio_insn_config(struct comedi_device *, struct comedi_subdevice *,
142 struct comedi_insn *, unsigned int *data);
143 int ni_tio_insn_write(struct comedi_device *, struct comedi_subdevice *,
144 struct comedi_insn *, unsigned int *data);
145 int ni_tio_cmd(struct comedi_device *, struct comedi_subdevice *);
146 int ni_tio_cmdtest(struct comedi_device *, struct comedi_subdevice *,
147 struct comedi_cmd *);
148 int ni_tio_cancel(struct ni_gpct *);
149 void ni_tio_handle_interrupt(struct ni_gpct *, struct comedi_subdevice *);
150 void ni_tio_set_mite_channel(struct ni_gpct *, struct mite_channel *);
151 void ni_tio_acknowledge(struct ni_gpct *);
153 #endif /* _COMEDI_NI_TIO_H */