3 internal definitions for comedilib
5 COMEDILIB - Linux Control and Measurement Device Interface Library
6 Copyright (C) 1997-2001 David A. Schleef <ds@schleef.org>
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation, version 2.1
13 This library 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 GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 #ifndef _LIBINTERNAL_H
25 #define _LIBINTERNAL_H
27 #define _COMEDILIB_DEPRECATED
29 #include <comedilib.h>
30 #include <sys/ioctl.h>
37 #include <comedi_errno.h>
39 /* This indicates a symbol that should not be exported as part of
40 * the library. But I don't know how to make it useful yet. */
43 /* gettext()ization */
46 #define _(a) gettext((a))
53 #define debug_ptr(a) if(!(a))fprintf(stderr," ** NULL pointer: " __FILE__ ", line %d\n",__LINE__);
54 #define debug_int(a) if((a)<0)fprintf(stderr," ** error: " __FILE__ ", line %d\n",__LINE__);
56 #define DEBUG(level,format,args...) do{if(__comedi_loglevel>=(level))fprintf(stderr,__FUNCTION__ ": " format, ## args);}while(0)
58 #define COMEDILIB_MAGIC 0xc001dafe
60 extern int __comedi_init;
61 extern int __comedi_loglevel;
62 extern int __comedi_errno;
66 #define libc_error() (__comedi_errno=errno)
67 #define internal_error(a) (__comedi_errno=(a))
71 void libc_error(void);
72 void internal_error(int error_number);
77 typedef struct subdevice_struct subdevice;
78 typedef struct device_struct device;
80 struct comedi_t_struct{
86 comedi_devinfo devinfo;
88 subdevice *subdevices;
90 unsigned int has_insnlist_ioctl;
91 unsigned int has_insn_ioctl;
94 struct subdevice_struct{
97 unsigned int subd_flags;
98 unsigned int timer_type;
99 unsigned int len_chanlist;
102 unsigned int range_type;
104 lsampl_t *maxdata_list;
105 unsigned int *range_type_list;
106 unsigned int *flags_list;
108 comedi_range *rangeinfo;
109 comedi_range **rangeinfo_list;
111 unsigned int has_cmd;
112 unsigned int has_insn_bits;
115 comedi_cmd *cmd_mask;
117 comedi_cmd *cmd_timed;
124 int ioctl_devinfo(int fd,comedi_devinfo *it);
125 int ioctl_subdinfo(int fd,comedi_subdinfo *it);
126 int ioctl_chaninfo(int fd,unsigned int subdev,lsampl_t *maxdata_list,
127 unsigned int *flaglist,unsigned int *rangelist);
128 int ioctl_trigger(int fd,comedi_trig *it);
129 int ioctl_rangeinfo(int fd,int range_type,comedi_krange *range_ptr);
130 int ioctl_bufconfig(int fd, comedi_bufconfig *bc);
131 int ioctl_bufinfo(int fd, comedi_bufinfo *bi);
133 /* filler routines */
135 int get_subdevices(comedi_t *it);
136 comedi_range *get_rangeinfo(int fd,unsigned int range_type);
140 int valid_dev(comedi_t *it);
141 int valid_subd(comedi_t *it,unsigned int subdevice);
142 int valid_chan(comedi_t *it,unsigned int subdevice,unsigned int chan);
145 COMEDILIB_NOERROR = 0x1000,
152 // used by range.c, was in comedilib.h but apparently deprecated so I put it here - fmhess
153 int comedi_get_rangetype(comedi_t *it,unsigned int subdevice,unsigned int chan);