David Schleef | ed9eccb | 2008-11-04 20:29:31 -0800 | [diff] [blame^] | 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 <linux/comedi.h> |
| 28 | |
| 29 | /* Kernel internal stuff. Needed by real-time modules and such. */ |
| 30 | |
| 31 | #ifndef __KERNEL__ |
| 32 | #error linux/comedilib.h should not be included by non-kernel-space code |
| 33 | #endif |
| 34 | |
| 35 | /* exported functions */ |
| 36 | |
| 37 | #ifndef KCOMEDILIB_DEPRECATED |
| 38 | |
| 39 | typedef void comedi_t; |
| 40 | |
| 41 | /* these functions may not be called at real-time priority */ |
| 42 | |
| 43 | comedi_t *comedi_open(const char *path); |
| 44 | int comedi_close(comedi_t * dev); |
| 45 | |
| 46 | /* these functions may be called at any priority, but may fail at |
| 47 | real-time priority */ |
| 48 | |
| 49 | int comedi_lock(comedi_t * dev, unsigned int subdev); |
| 50 | int comedi_unlock(comedi_t * dev, unsigned int subdev); |
| 51 | |
| 52 | /* these functions may be called at any priority, but you must hold |
| 53 | the lock for the subdevice */ |
| 54 | |
| 55 | int comedi_loglevel(int loglevel); |
| 56 | void comedi_perror(const char *s); |
| 57 | char *comedi_strerror(int errnum); |
| 58 | int comedi_errno(void); |
| 59 | int comedi_fileno(comedi_t * dev); |
| 60 | |
| 61 | int comedi_cancel(comedi_t * dev, unsigned int subdev); |
| 62 | int comedi_register_callback(comedi_t * dev, unsigned int subdev, |
| 63 | unsigned int mask, int (*cb) (unsigned int, void *), void *arg); |
| 64 | |
| 65 | int comedi_command(comedi_t * dev, comedi_cmd * cmd); |
| 66 | int comedi_command_test(comedi_t * dev, comedi_cmd * cmd); |
| 67 | int comedi_trigger(comedi_t * dev, unsigned int subdev, comedi_trig * it); |
| 68 | int __comedi_trigger(comedi_t * dev, unsigned int subdev, comedi_trig * it); |
| 69 | int comedi_data_write(comedi_t * dev, unsigned int subdev, unsigned int chan, |
| 70 | unsigned int range, unsigned int aref, lsampl_t data); |
| 71 | int comedi_data_read(comedi_t * dev, unsigned int subdev, unsigned int chan, |
| 72 | unsigned int range, unsigned int aref, lsampl_t * data); |
| 73 | int comedi_data_read_hint(comedi_t * dev, unsigned int subdev, |
| 74 | unsigned int chan, unsigned int range, unsigned int aref); |
| 75 | int comedi_data_read_delayed(comedi_t * dev, unsigned int subdev, |
| 76 | unsigned int chan, unsigned int range, unsigned int aref, |
| 77 | lsampl_t * data, unsigned int nano_sec); |
| 78 | int comedi_dio_config(comedi_t * dev, unsigned int subdev, unsigned int chan, |
| 79 | unsigned int io); |
| 80 | int comedi_dio_read(comedi_t * dev, unsigned int subdev, unsigned int chan, |
| 81 | unsigned int *val); |
| 82 | int comedi_dio_write(comedi_t * dev, unsigned int subdev, unsigned int chan, |
| 83 | unsigned int val); |
| 84 | int comedi_dio_bitfield(comedi_t * dev, unsigned int subdev, unsigned int mask, |
| 85 | unsigned int *bits); |
| 86 | int comedi_get_n_subdevices(comedi_t * dev); |
| 87 | int comedi_get_version_code(comedi_t * dev); |
| 88 | const char *comedi_get_driver_name(comedi_t * dev); |
| 89 | const char *comedi_get_board_name(comedi_t * dev); |
| 90 | int comedi_get_subdevice_type(comedi_t * dev, unsigned int subdevice); |
| 91 | int comedi_find_subdevice_by_type(comedi_t * dev, int type, unsigned int subd); |
| 92 | int comedi_get_n_channels(comedi_t * dev, unsigned int subdevice); |
| 93 | lsampl_t comedi_get_maxdata(comedi_t * dev, unsigned int subdevice, unsigned |
| 94 | int chan); |
| 95 | int comedi_get_n_ranges(comedi_t * dev, unsigned int subdevice, unsigned int |
| 96 | chan); |
| 97 | int comedi_do_insn(comedi_t * dev, comedi_insn * insn); |
| 98 | int comedi_poll(comedi_t * dev, unsigned int subdev); |
| 99 | |
| 100 | /* DEPRECATED functions */ |
| 101 | int comedi_get_rangetype(comedi_t * dev, unsigned int subdevice, |
| 102 | unsigned int chan); |
| 103 | |
| 104 | /* ALPHA functions */ |
| 105 | unsigned int comedi_get_subdevice_flags(comedi_t * dev, unsigned int subdevice); |
| 106 | int comedi_get_len_chanlist(comedi_t * dev, unsigned int subdevice); |
| 107 | int comedi_get_krange(comedi_t * dev, unsigned int subdevice, unsigned int |
| 108 | chan, unsigned int range, comedi_krange * krange); |
| 109 | unsigned int comedi_get_buf_head_pos(comedi_t * dev, unsigned int subdevice); |
| 110 | int comedi_set_user_int_count(comedi_t * dev, unsigned int subdevice, |
| 111 | unsigned int buf_user_count); |
| 112 | int comedi_map(comedi_t * dev, unsigned int subdev, void *ptr); |
| 113 | int comedi_unmap(comedi_t * dev, unsigned int subdev); |
| 114 | int comedi_get_buffer_size(comedi_t * dev, unsigned int subdev); |
| 115 | int comedi_mark_buffer_read(comedi_t * dev, unsigned int subdevice, |
| 116 | unsigned int num_bytes); |
| 117 | int comedi_mark_buffer_written(comedi_t * d, unsigned int subdevice, |
| 118 | unsigned int num_bytes); |
| 119 | int comedi_get_buffer_contents(comedi_t * dev, unsigned int subdevice); |
| 120 | int comedi_get_buffer_offset(comedi_t * dev, unsigned int subdevice); |
| 121 | |
| 122 | #else |
| 123 | |
| 124 | /* these functions may not be called at real-time priority */ |
| 125 | |
| 126 | int comedi_open(unsigned int minor); |
| 127 | void comedi_close(unsigned int minor); |
| 128 | |
| 129 | /* these functions may be called at any priority, but may fail at |
| 130 | real-time priority */ |
| 131 | |
| 132 | int comedi_lock(unsigned int minor, unsigned int subdev); |
| 133 | int comedi_unlock(unsigned int minor, unsigned int subdev); |
| 134 | |
| 135 | /* these functions may be called at any priority, but you must hold |
| 136 | the lock for the subdevice */ |
| 137 | |
| 138 | int comedi_cancel(unsigned int minor, unsigned int subdev); |
| 139 | int comedi_register_callback(unsigned int minor, unsigned int subdev, |
| 140 | unsigned int mask, int (*cb) (unsigned int, void *), void *arg); |
| 141 | |
| 142 | int comedi_command(unsigned int minor, comedi_cmd * cmd); |
| 143 | int comedi_command_test(unsigned int minor, comedi_cmd * cmd); |
| 144 | int comedi_trigger(unsigned int minor, unsigned int subdev, comedi_trig * it); |
| 145 | int __comedi_trigger(unsigned int minor, unsigned int subdev, comedi_trig * it); |
| 146 | int comedi_data_write(unsigned int dev, unsigned int subdev, unsigned int chan, |
| 147 | unsigned int range, unsigned int aref, lsampl_t data); |
| 148 | int comedi_data_read(unsigned int dev, unsigned int subdev, unsigned int chan, |
| 149 | unsigned int range, unsigned int aref, lsampl_t * data); |
| 150 | int comedi_dio_config(unsigned int dev, unsigned int subdev, unsigned int chan, |
| 151 | unsigned int io); |
| 152 | int comedi_dio_read(unsigned int dev, unsigned int subdev, unsigned int chan, |
| 153 | unsigned int *val); |
| 154 | int comedi_dio_write(unsigned int dev, unsigned int subdev, unsigned int chan, |
| 155 | unsigned int val); |
| 156 | int comedi_dio_bitfield(unsigned int dev, unsigned int subdev, |
| 157 | unsigned int mask, unsigned int *bits); |
| 158 | int comedi_get_n_subdevices(unsigned int dev); |
| 159 | int comedi_get_version_code(unsigned int dev); |
| 160 | char *comedi_get_driver_name(unsigned int dev); |
| 161 | char *comedi_get_board_name(unsigned int minor); |
| 162 | int comedi_get_subdevice_type(unsigned int minor, unsigned int subdevice); |
| 163 | int comedi_find_subdevice_by_type(unsigned int minor, int type, |
| 164 | unsigned int subd); |
| 165 | int comedi_get_n_channels(unsigned int minor, unsigned int subdevice); |
| 166 | lsampl_t comedi_get_maxdata(unsigned int minor, unsigned int subdevice, unsigned |
| 167 | int chan); |
| 168 | int comedi_get_n_ranges(unsigned int minor, unsigned int subdevice, unsigned int |
| 169 | chan); |
| 170 | int comedi_do_insn(unsigned int minor, comedi_insn * insn); |
| 171 | int comedi_poll(unsigned int minor, unsigned int subdev); |
| 172 | |
| 173 | /* DEPRECATED functions */ |
| 174 | int comedi_get_rangetype(unsigned int minor, unsigned int subdevice, |
| 175 | unsigned int chan); |
| 176 | |
| 177 | /* ALPHA functions */ |
| 178 | unsigned int comedi_get_subdevice_flags(unsigned int minor, unsigned int |
| 179 | subdevice); |
| 180 | int comedi_get_len_chanlist(unsigned int minor, unsigned int subdevice); |
| 181 | int comedi_get_krange(unsigned int minor, unsigned int subdevice, unsigned int |
| 182 | chan, unsigned int range, comedi_krange * krange); |
| 183 | unsigned int comedi_get_buf_head_pos(unsigned int minor, unsigned int |
| 184 | subdevice); |
| 185 | int comedi_set_user_int_count(unsigned int minor, unsigned int subdevice, |
| 186 | unsigned int buf_user_count); |
| 187 | int comedi_map(unsigned int minor, unsigned int subdev, void **ptr); |
| 188 | int comedi_unmap(unsigned int minor, unsigned int subdev); |
| 189 | |
| 190 | #endif |
| 191 | |
| 192 | #endif |