comedilib.h revision ed9eccbe8970f6eedc1b978c157caf1251a896d4
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 39typedef void comedi_t; 40 41/* these functions may not be called at real-time priority */ 42 43comedi_t *comedi_open(const char *path); 44int comedi_close(comedi_t * dev); 45 46/* these functions may be called at any priority, but may fail at 47 real-time priority */ 48 49int comedi_lock(comedi_t * dev, unsigned int subdev); 50int 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 55int comedi_loglevel(int loglevel); 56void comedi_perror(const char *s); 57char *comedi_strerror(int errnum); 58int comedi_errno(void); 59int comedi_fileno(comedi_t * dev); 60 61int comedi_cancel(comedi_t * dev, unsigned int subdev); 62int comedi_register_callback(comedi_t * dev, unsigned int subdev, 63 unsigned int mask, int (*cb) (unsigned int, void *), void *arg); 64 65int comedi_command(comedi_t * dev, comedi_cmd * cmd); 66int comedi_command_test(comedi_t * dev, comedi_cmd * cmd); 67int comedi_trigger(comedi_t * dev, unsigned int subdev, comedi_trig * it); 68int __comedi_trigger(comedi_t * dev, unsigned int subdev, comedi_trig * it); 69int comedi_data_write(comedi_t * dev, unsigned int subdev, unsigned int chan, 70 unsigned int range, unsigned int aref, lsampl_t data); 71int comedi_data_read(comedi_t * dev, unsigned int subdev, unsigned int chan, 72 unsigned int range, unsigned int aref, lsampl_t * data); 73int comedi_data_read_hint(comedi_t * dev, unsigned int subdev, 74 unsigned int chan, unsigned int range, unsigned int aref); 75int 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); 78int comedi_dio_config(comedi_t * dev, unsigned int subdev, unsigned int chan, 79 unsigned int io); 80int comedi_dio_read(comedi_t * dev, unsigned int subdev, unsigned int chan, 81 unsigned int *val); 82int comedi_dio_write(comedi_t * dev, unsigned int subdev, unsigned int chan, 83 unsigned int val); 84int comedi_dio_bitfield(comedi_t * dev, unsigned int subdev, unsigned int mask, 85 unsigned int *bits); 86int comedi_get_n_subdevices(comedi_t * dev); 87int comedi_get_version_code(comedi_t * dev); 88const char *comedi_get_driver_name(comedi_t * dev); 89const char *comedi_get_board_name(comedi_t * dev); 90int comedi_get_subdevice_type(comedi_t * dev, unsigned int subdevice); 91int comedi_find_subdevice_by_type(comedi_t * dev, int type, unsigned int subd); 92int comedi_get_n_channels(comedi_t * dev, unsigned int subdevice); 93lsampl_t comedi_get_maxdata(comedi_t * dev, unsigned int subdevice, unsigned 94 int chan); 95int comedi_get_n_ranges(comedi_t * dev, unsigned int subdevice, unsigned int 96 chan); 97int comedi_do_insn(comedi_t * dev, comedi_insn * insn); 98int comedi_poll(comedi_t * dev, unsigned int subdev); 99 100/* DEPRECATED functions */ 101int comedi_get_rangetype(comedi_t * dev, unsigned int subdevice, 102 unsigned int chan); 103 104/* ALPHA functions */ 105unsigned int comedi_get_subdevice_flags(comedi_t * dev, unsigned int subdevice); 106int comedi_get_len_chanlist(comedi_t * dev, unsigned int subdevice); 107int comedi_get_krange(comedi_t * dev, unsigned int subdevice, unsigned int 108 chan, unsigned int range, comedi_krange * krange); 109unsigned int comedi_get_buf_head_pos(comedi_t * dev, unsigned int subdevice); 110int comedi_set_user_int_count(comedi_t * dev, unsigned int subdevice, 111 unsigned int buf_user_count); 112int comedi_map(comedi_t * dev, unsigned int subdev, void *ptr); 113int comedi_unmap(comedi_t * dev, unsigned int subdev); 114int comedi_get_buffer_size(comedi_t * dev, unsigned int subdev); 115int comedi_mark_buffer_read(comedi_t * dev, unsigned int subdevice, 116 unsigned int num_bytes); 117int comedi_mark_buffer_written(comedi_t * d, unsigned int subdevice, 118 unsigned int num_bytes); 119int comedi_get_buffer_contents(comedi_t * dev, unsigned int subdevice); 120int 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 126int comedi_open(unsigned int minor); 127void comedi_close(unsigned int minor); 128 129/* these functions may be called at any priority, but may fail at 130 real-time priority */ 131 132int comedi_lock(unsigned int minor, unsigned int subdev); 133int 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 138int comedi_cancel(unsigned int minor, unsigned int subdev); 139int comedi_register_callback(unsigned int minor, unsigned int subdev, 140 unsigned int mask, int (*cb) (unsigned int, void *), void *arg); 141 142int comedi_command(unsigned int minor, comedi_cmd * cmd); 143int comedi_command_test(unsigned int minor, comedi_cmd * cmd); 144int comedi_trigger(unsigned int minor, unsigned int subdev, comedi_trig * it); 145int __comedi_trigger(unsigned int minor, unsigned int subdev, comedi_trig * it); 146int comedi_data_write(unsigned int dev, unsigned int subdev, unsigned int chan, 147 unsigned int range, unsigned int aref, lsampl_t data); 148int comedi_data_read(unsigned int dev, unsigned int subdev, unsigned int chan, 149 unsigned int range, unsigned int aref, lsampl_t * data); 150int comedi_dio_config(unsigned int dev, unsigned int subdev, unsigned int chan, 151 unsigned int io); 152int comedi_dio_read(unsigned int dev, unsigned int subdev, unsigned int chan, 153 unsigned int *val); 154int comedi_dio_write(unsigned int dev, unsigned int subdev, unsigned int chan, 155 unsigned int val); 156int comedi_dio_bitfield(unsigned int dev, unsigned int subdev, 157 unsigned int mask, unsigned int *bits); 158int comedi_get_n_subdevices(unsigned int dev); 159int comedi_get_version_code(unsigned int dev); 160char *comedi_get_driver_name(unsigned int dev); 161char *comedi_get_board_name(unsigned int minor); 162int comedi_get_subdevice_type(unsigned int minor, unsigned int subdevice); 163int comedi_find_subdevice_by_type(unsigned int minor, int type, 164 unsigned int subd); 165int comedi_get_n_channels(unsigned int minor, unsigned int subdevice); 166lsampl_t comedi_get_maxdata(unsigned int minor, unsigned int subdevice, unsigned 167 int chan); 168int comedi_get_n_ranges(unsigned int minor, unsigned int subdevice, unsigned int 169 chan); 170int comedi_do_insn(unsigned int minor, comedi_insn * insn); 171int comedi_poll(unsigned int minor, unsigned int subdev); 172 173/* DEPRECATED functions */ 174int comedi_get_rangetype(unsigned int minor, unsigned int subdevice, 175 unsigned int chan); 176 177/* ALPHA functions */ 178unsigned int comedi_get_subdevice_flags(unsigned int minor, unsigned int 179 subdevice); 180int comedi_get_len_chanlist(unsigned int minor, unsigned int subdevice); 181int comedi_get_krange(unsigned int minor, unsigned int subdevice, unsigned int 182 chan, unsigned int range, comedi_krange * krange); 183unsigned int comedi_get_buf_head_pos(unsigned int minor, unsigned int 184 subdevice); 185int comedi_set_user_int_count(unsigned int minor, unsigned int subdevice, 186 unsigned int buf_user_count); 187int comedi_map(unsigned int minor, unsigned int subdev, void **ptr); 188int comedi_unmap(unsigned int minor, unsigned int subdev); 189 190#endif 191 192#endif 193