Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ni_tio.h
Go to the documentation of this file.
1 /*
2  drivers/ni_tio.h
3  Header file for NI general purpose counter support code (ni_tio.c)
4 
5  COMEDI - Linux Control and Measurement Device Interface
6 
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.
11 
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.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
23 #ifndef _COMEDI_NI_TIO_H
24 #define _COMEDI_NI_TIO_H
25 
26 #include "../comedidev.h"
27 
28 /* forward declarations */
29 struct mite_struct;
30 struct ni_gpct_device;
31 
104 };
105 
110 };
111 
112 struct ni_gpct {
114  unsigned counter_index;
115  unsigned chip_index;
116  uint64_t clock_period_ps; /* clock period in picoseconds */
119 };
120 
123  void (*write_register) (struct ni_gpct * counter, unsigned bits,
124  enum ni_gpct_register reg);
125  unsigned (*read_register) (struct ni_gpct * counter,
126  enum ni_gpct_register reg);
128  struct ni_gpct *counters;
129  unsigned num_counters;
132 };
133 
135  *dev,
136  void (*write_register)
137  (struct ni_gpct *
138  counter, unsigned bits,
139  enum ni_gpct_register
140  reg),
141  unsigned (*read_register)
142  (struct ni_gpct *
143  counter,
144  enum ni_gpct_register
145  reg),
146  enum ni_gpct_variant
147  variant,
148  unsigned num_counters);
149 extern void ni_gpct_device_destroy(struct ni_gpct_device *counter_dev);
150 extern void ni_tio_init_counter(struct ni_gpct *counter);
151 extern int ni_tio_rinsn(struct ni_gpct *counter,
152  struct comedi_insn *insn, unsigned int *data);
153 extern int ni_tio_insn_config(struct ni_gpct *counter,
154  struct comedi_insn *insn, unsigned int *data);
155 extern int ni_tio_winsn(struct ni_gpct *counter,
156  struct comedi_insn *insn, unsigned int *data);
157 extern int ni_tio_cmd(struct ni_gpct *counter, struct comedi_async *async);
158 extern int ni_tio_cmdtest(struct ni_gpct *counter, struct comedi_cmd *cmd);
159 extern int ni_tio_cancel(struct ni_gpct *counter);
160 extern void ni_tio_handle_interrupt(struct ni_gpct *counter,
161  struct comedi_subdevice *s);
162 extern void ni_tio_set_mite_channel(struct ni_gpct *counter,
163  struct mite_channel *mite_chan);
164 extern void ni_tio_acknowledge_and_confirm(struct ni_gpct *counter,
165  int *gate_error, int *tc_error,
166  int *perm_stale_data,
167  int *stale_data);
168 
169 static inline struct ni_gpct *subdev_to_counter(struct comedi_subdevice *s)
170 {
171  return s->private;
172 }
173 
174 #endif /* _COMEDI_NI_TIO_H */