3 header file for comedilib internals
5 COMEDI - Linux Control and Measurement Device Interface
6 Copyright (C) 1998 David A. Schleef <ds@stm.lbl.gov>
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.
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.
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.
25 #ifndef _LIBINTERNAL_H
26 #define _LIBINTERNAL_H
28 #include <comedilib.h>
29 #include <sys/ioctl.h>
34 #define debug_ptr(a) if(!(a))fprintf(stderr," ** NULL pointer: " __FILE__ ", line %d\n",__LINE__);
35 #define debug_int(a) if((a)<0)fprintf(stderr," ** error: " __FILE__ ", line %d\n",__LINE__);
37 #define COMEDILIB_MAGIC 0xc001dafe
40 extern int __comedi_init;
41 extern int __comedi_loglevel;
42 extern int __comedi_errno;
46 #define libc_error() (__comedi_errno=errno)
47 #define internal_error(a) (__comedi_errno=(a))
51 void libc_error(void);
52 void internal_error(int error_number);
57 typedef struct subdevice_struct subdevice;
58 typedef struct device_struct device;
60 struct comedi_t_struct{
66 comedi_devinfo devinfo;
68 subdevice *subdevices;
71 struct subdevice_struct{
74 unsigned int subd_flags;
75 unsigned int timer_type;
76 unsigned int len_chanlist;
79 unsigned int range_type;
81 lsampl_t *maxdata_list;
82 unsigned int *range_type_list;
83 unsigned int *flags_list;
85 comedi_range *rangeinfo;
86 comedi_range **rangeinfo_list;
89 unsigned int has_insn;
90 unsigned int has_insn_bits;
97 int ioctl_devinfo(int fd,comedi_devinfo *it);
98 int ioctl_subdinfo(int fd,comedi_subdinfo *it);
99 int ioctl_chaninfo(int fd,unsigned int subdev,lsampl_t *maxdata_list,
100 unsigned int *flaglist,unsigned int *rangelist);
101 int ioctl_trigger(int fd,comedi_trig *it);
102 int ioctl_rangeinfo(int fd,int range_type,comedi_krange *range_ptr);
104 /* filler routines */
106 int get_subdevices(comedi_t *it);
107 comedi_range *get_rangeinfo(int fd,unsigned int range_type);
111 int valid_dev(comedi_t *it);
112 int valid_subd(comedi_t *it,unsigned int subdevice);
113 int valid_chan(comedi_t *it,unsigned int subdevice,unsigned int chan);
116 COMEDILIB_NOERROR = 0x1000,
124 /* comedi version compatibility */
127 #define TRIG_WRITE 0x0040
131 #define HAVE_COMEDI_CMD
134 #ifdef COMEDI_INSNLIST
135 #define HAVE_COMEDI_INSN