Staging: comedi: clean up comedilib.h
[firefly-linux-kernel-4.4.55.git] / drivers / staging / comedi / comedilib.h
1 /*
2     linux/include/comedilib.h
3     header file for kcomedilib
4
5     COMEDI - Linux Control and Measurement Device Interface
6     Copyright (C) 1998-2001 David A. Schleef <ds@schleef.org>
7
8     This program is free software; you can redistribute it and/or modify
9     it under the terms of the GNU General Public License as published by
10     the Free Software Foundation; either version 2 of the License, or
11     (at your option) any later version.
12
13     This program is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16     GNU General Public License for more details.
17
18     You should have received a copy of the GNU General Public License
19     along with this program; if not, write to the Free Software
20     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
22 */
23
24 #ifndef _LINUX_COMEDILIB_H
25 #define _LINUX_COMEDILIB_H
26
27 #include "comedi.h"
28
29 /* these functions may not be called at real-time priority */
30
31 void *comedi_open(const char *path);
32 int comedi_close(void *dev);
33
34 /* these functions may be called at any priority, but may fail at
35    real-time priority */
36
37 int comedi_lock(void *dev, unsigned int subdev);
38 int comedi_unlock(void *dev, unsigned int subdev);
39
40 /* these functions may be called at any priority, but you must hold
41    the lock for the subdevice */
42
43 int comedi_loglevel(int loglevel);
44 void comedi_perror(const char *s);
45 char *comedi_strerror(int errnum);
46 int comedi_errno(void);
47 int comedi_fileno(void *dev);
48
49 int comedi_cancel(void *dev, unsigned int subdev);
50 int comedi_register_callback(void *dev, unsigned int subdev,
51                              unsigned int mask, int (*cb) (unsigned int,
52                                                            void *), void *arg);
53
54 int comedi_command(void *dev, struct comedi_cmd *cmd);
55 int comedi_command_test(void *dev, struct comedi_cmd *cmd);
56 int comedi_trigger(void *dev, unsigned int subdev, struct comedi_trig *it);
57 int __comedi_trigger(void *dev, unsigned int subdev, struct comedi_trig *it);
58 int comedi_data_write(void *dev, unsigned int subdev, unsigned int chan,
59                       unsigned int range, unsigned int aref, unsigned int data);
60 int comedi_data_read(void *dev, unsigned int subdev, unsigned int chan,
61                      unsigned int range, unsigned int aref, unsigned int *data);
62 int comedi_data_read_hint(void *dev, unsigned int subdev,
63                           unsigned int chan, unsigned int range,
64                           unsigned int aref);
65 int comedi_data_read_delayed(void *dev, unsigned int subdev, unsigned int chan,
66                              unsigned int range, unsigned int aref,
67                              unsigned int *data, unsigned int nano_sec);
68 int comedi_dio_config(void *dev, unsigned int subdev, unsigned int chan,
69                       unsigned int io);
70 int comedi_dio_read(void *dev, unsigned int subdev, unsigned int chan,
71                     unsigned int *val);
72 int comedi_dio_write(void *dev, unsigned int subdev, unsigned int chan,
73                      unsigned int val);
74 int comedi_dio_bitfield(void *dev, unsigned int subdev, unsigned int mask,
75                         unsigned int *bits);
76 int comedi_get_n_subdevices(void *dev);
77 int comedi_get_version_code(void *dev);
78 const char *comedi_get_driver_name(void *dev);
79 const char *comedi_get_board_name(void *dev);
80 int comedi_get_subdevice_type(void *dev, unsigned int subdevice);
81 int comedi_find_subdevice_by_type(void *dev, int type, unsigned int subd);
82 int comedi_get_n_channels(void *dev, unsigned int subdevice);
83 unsigned int comedi_get_maxdata(void *dev, unsigned int subdevice, unsigned
84                                 int chan);
85 int comedi_get_n_ranges(void *dev, unsigned int subdevice, unsigned int chan);
86 int comedi_do_insn(void *dev, struct comedi_insn *insn);
87 int comedi_poll(void *dev, unsigned int subdev);
88
89 /* DEPRECATED functions */
90 int comedi_get_rangetype(void *dev, unsigned int subdevice, unsigned int chan);
91
92 /* ALPHA functions */
93 unsigned int comedi_get_subdevice_flags(void *dev, unsigned int subdevice);
94 int comedi_get_len_chanlist(void *dev, unsigned int subdevice);
95 int comedi_get_krange(void *dev, unsigned int subdevice, unsigned int
96                       chan, unsigned int range, struct comedi_krange *krange);
97 unsigned int comedi_get_buf_head_pos(void *dev, unsigned int subdevice);
98 int comedi_set_user_int_count(void *dev, unsigned int subdevice,
99                               unsigned int buf_user_count);
100 int comedi_map(void *dev, unsigned int subdev, void *ptr);
101 int comedi_unmap(void *dev, unsigned int subdev);
102 int comedi_get_buffer_size(void *dev, unsigned int subdev);
103 int comedi_mark_buffer_read(void *dev, unsigned int subdevice,
104                             unsigned int num_bytes);
105 int comedi_mark_buffer_written(void *d, unsigned int subdevice,
106                                unsigned int num_bytes);
107 int comedi_get_buffer_contents(void *dev, unsigned int subdevice);
108 int comedi_get_buffer_offset(void *dev, unsigned int subdevice);
109
110
111 #endif