bunch of changes for kcomedilib r0_7_55
authorDavid Schleef <ds@schleef.org>
Tue, 16 Jan 2001 22:21:29 +0000 (22:21 +0000)
committerDavid Schleef <ds@schleef.org>
Tue, 16 Jan 2001 22:21:29 +0000 (22:21 +0000)
comedi/kcomedilib/Makefile
comedi/kcomedilib/data.c
comedi/kcomedilib/dio.c
comedi/kcomedilib/kcomedilib_main.c
comedi/kcomedilib/ksyms.c [new file with mode: 0644]
include/linux/comedi.h
include/linux/comedilib.h [new file with mode: 0644]

index 02f64c723fbcafdd49218d50b46654989b57f57d..e2368532bb97a1edc27d6913ab47739b13865059 100644 (file)
@@ -8,11 +8,11 @@ EXTRA_CFLAGS := -I ../
 
 ifeq ($(CONFIG_COMEDI_KLIB),y)
   O_TARGET := kcomedilib.o
-  OX_OBJS := kcomedilib_main.o
-  O_OBJS := data.o dio.o
+  OX_OBJS := ksyms.o
+  O_OBJS := data.o dio.o kcomedilib_main.o
 else
-  MI_OBJS := data.o dio.o
-  MIX_OBJS := kcomedilib_main.o
+  MI_OBJS := data.o dio.o kcomedilib_main.o
+  MIX_OBJS := ksyms.o
   M_OBJS := kcomedilib.o
 endif
 
index 6aa42f333ec8e6f3f7a5df48d5618a3a72e0e016..a9e6fe0346f0fa96ffde9381d642214a251822fa 100644 (file)
@@ -23,7 +23,9 @@
 
 
 
+#include <linux/comedi.h>
 #include <linux/comedidev.h>
+#include <linux/comedilib.h>
 
 #include <linux/errno.h>
 #include <linux/kernel.h>
index cfffa260a50c95c071255029916c833e0a8dd4bc..01a545604fe0fdf8b9d3d3acd2bad2627005bf03 100644 (file)
@@ -23,7 +23,9 @@
 
 
 
+#include <linux/comedi.h>
 #include <linux/comedidev.h>
+#include <linux/comedilib.h>
 
 #include <linux/errno.h>
 #include <linux/kernel.h>
index 0c78ec7661ef6aef18e7efde087298b49586f898..ecf0c5019c6df46f1e55125c76dd93e2c68a7668 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <linux/comedidev.h>
 #include <linux/comedi.h>
+#include <linux/comedilib.h>
 
 #include <linux/module.h>
 
@@ -832,49 +833,3 @@ int comedi_register_callback(unsigned int minor,unsigned int subdev,
 }
 
 
-#ifdef LINUX_V22
-
-EXPORT_SYMBOL(comedi_open);
-EXPORT_SYMBOL(comedi_close);
-//EXPORT_SYMBOL(comedi_loglevel);
-//EXPORT_SYMBOL(comedi_perror);
-//EXPORT_SYMBOL(comedi_strerror);
-//EXPORT_SYMBOL(comedi_errno);
-//EXPORT_SYMBOL(comedi_fileno);
-EXPORT_SYMBOL(comedi_get_n_subdevices);
-EXPORT_SYMBOL(comedi_find_subdevice_by_type);
-EXPORT_SYMBOL(comedi_get_n_channels);
-EXPORT_SYMBOL(comedi_get_maxdata);
-EXPORT_SYMBOL(comedi_get_rangetype);
-//EXPORT_SYMBOL(comedi_get_range);
-//EXPORT_SYMBOL(comedi_find_range);
-EXPORT_SYMBOL(comedi_get_n_ranges);
-//EXPORT_SYMBOL(comedi_range_is_chan_specific);
-//EXPORT_SYMBOL(comedi_maxdata_is_chan_specific);
-EXPORT_SYMBOL(comedi_cancel);
-EXPORT_SYMBOL(comedi_trigger);
-EXPORT_SYMBOL(__comedi_trigger);
-//EXPORT_SYMBOL(comedi_command);
-//EXPORT_SYMBOL(comedi_command_test);
-//EXPORT_SYMBOL(comedi_do_insnlist);
-EXPORT_SYMBOL(comedi_do_insn);
-EXPORT_SYMBOL(comedi_lock);
-EXPORT_SYMBOL(comedi_unlock);
-//EXPORT_SYMBOL(comedi_to_phys);
-//EXPORT_SYMBOL(comedi_from_phys);
-EXPORT_SYMBOL(comedi_data_read);
-EXPORT_SYMBOL(comedi_data_write);
-//EXPORT_SYMBOL(comedi_sv_init);
-//EXPORT_SYMBOL(comedi_sv_update);
-//EXPORT_SYMBOL(comedi_sv_measure);
-EXPORT_SYMBOL(comedi_dio_config);
-EXPORT_SYMBOL(comedi_dio_read);
-EXPORT_SYMBOL(comedi_dio_write);
-EXPORT_SYMBOL(comedi_dio_bitfield);
-//EXPORT_SYMBOL(comedi_get_timer);
-//EXPORT_SYMBOL(comedi_timed_1chan);
-//EXPORT_SYMBOL(comedi_set_global_oor_behavior);
-
-
-#endif
-
diff --git a/comedi/kcomedilib/ksyms.c b/comedi/kcomedilib/ksyms.c
new file mode 100644 (file)
index 0000000..4ca27a8
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+    comedi/kcomedilib/ksyms.c
+    a comedlib interface for kernel modules
+
+    COMEDI - Linux Control and Measurement Device Interface
+    Copyright (C) 1997-2001 David A. Schleef <ds@stm.lbl.gov>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+
+
+#include <linux/comedi.h>
+#include <linux/comedidev.h>
+#include <linux/comedilib.h>
+
+#include <linux/module.h>
+
+#include <linux/errno.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/fcntl.h>
+#include <linux/delay.h>
+#include <linux/ioport.h>
+#include <linux/mm.h>
+#include <linux/malloc.h>
+
+
+#ifdef LINUX_V22
+
+/* functions specific to kcomedilib */
+
+EXPORT_SYMBOL(__comedi_trigger);
+EXPORT_SYMBOL(comedi_register_callback);
+EXPORT_SYMBOL(comedi_get_subdevice_flags);
+EXPORT_SYMBOL(comedi_get_len_chanlist);
+EXPORT_SYMBOL(comedi_get_krange);
+EXPORT_SYMBOL(comedi_get_buf_head_pos);
+EXPORT_SYMBOL(comedi_set_user_int_count);
+
+/* er?  why not in user-space? */
+EXPORT_SYMBOL(comedi_get_version_code);
+EXPORT_SYMBOL(comedi_get_driver_name);
+EXPORT_SYMBOL(comedi_get_board_name);
+EXPORT_SYMBOL(comedi_get_subdevice_type);
+
+/* This list comes from user-space comedilib, to show which
+ * functions are not ported yet. */
+
+EXPORT_SYMBOL(comedi_open);
+EXPORT_SYMBOL(comedi_close);
+//EXPORT_SYMBOL(comedi_loglevel);
+//EXPORT_SYMBOL(comedi_perror);
+//EXPORT_SYMBOL(comedi_strerror);
+//EXPORT_SYMBOL(comedi_errno);
+//EXPORT_SYMBOL(comedi_fileno);
+EXPORT_SYMBOL(comedi_get_n_subdevices);
+EXPORT_SYMBOL(comedi_find_subdevice_by_type);
+EXPORT_SYMBOL(comedi_get_n_channels);
+EXPORT_SYMBOL(comedi_get_maxdata);
+EXPORT_SYMBOL(comedi_get_rangetype);
+//EXPORT_SYMBOL(comedi_get_range);
+//EXPORT_SYMBOL(comedi_find_range);
+EXPORT_SYMBOL(comedi_get_n_ranges);
+//EXPORT_SYMBOL(comedi_range_is_chan_specific);
+//EXPORT_SYMBOL(comedi_maxdata_is_chan_specific);
+EXPORT_SYMBOL(comedi_cancel);
+EXPORT_SYMBOL(comedi_trigger);
+//EXPORT_SYMBOL(comedi_command);
+//EXPORT_SYMBOL(comedi_command_test);
+//EXPORT_SYMBOL(comedi_do_insnlist);
+EXPORT_SYMBOL(comedi_do_insn);
+EXPORT_SYMBOL(comedi_lock);
+EXPORT_SYMBOL(comedi_unlock);
+//EXPORT_SYMBOL(comedi_to_phys);
+//EXPORT_SYMBOL(comedi_from_phys);
+EXPORT_SYMBOL(comedi_data_read);
+EXPORT_SYMBOL(comedi_data_write);
+//EXPORT_SYMBOL(comedi_sv_init);
+//EXPORT_SYMBOL(comedi_sv_update);
+//EXPORT_SYMBOL(comedi_sv_measure);
+EXPORT_SYMBOL(comedi_dio_config);
+EXPORT_SYMBOL(comedi_dio_read);
+EXPORT_SYMBOL(comedi_dio_write);
+EXPORT_SYMBOL(comedi_dio_bitfield);
+//EXPORT_SYMBOL(comedi_get_timer);
+//EXPORT_SYMBOL(comedi_timed_1chan);
+//EXPORT_SYMBOL(comedi_set_global_oor_behavior);
+
+
+#endif
+
index 487dbb2a237b9ef77ad62cf925f32129f4b1a08e..83115a9ee1077e56ac81ac1dc3678f2908abd4b5 100644 (file)
@@ -301,11 +301,8 @@ struct comedi_devconfig_struct{
 #define UNIT_none              2
 
 
-/* Kernel internal stuff.  Needed by RTLinux modules and such. */
-
-#ifdef __KERNEL__
-
 /* callback stuff */
+/* only relevant to kernel modules. */
 
 #define COMEDI_CB_EOS          1       /* end of scan */
 #define COMEDI_CB_EOA          2       /* end of acquisition */
@@ -313,69 +310,6 @@ struct comedi_devconfig_struct{
 #define COMEDI_CB_EOBUF                8       /* end of buffer */
 #define COMEDI_CB_ERROR                16      /* card error during acquisition */
 
-/* exported functions */
-
-/* these functions may not be called at real-time priority */
-
-int comedi_open(unsigned int minor);
-void comedi_close(unsigned int minor);
-
-/* these functions may be called at any priority, but may fail at
-   real-time priority */
-
-int comedi_lock_ioctl(unsigned int minor,unsigned int subdev);
-int comedi_unlock_ioctl(unsigned int minor,unsigned int subdev);
-
-/* these functions may be called at any priority, but you must hold
-   the lock for the subdevice */
-
-int comedi_cancel_ioctl(unsigned int minor,unsigned int subdev);
-int comedi_register_callback(unsigned int minor,unsigned int subdev,
-               unsigned int mask,int (*cb)(unsigned int,void *),void *arg);
-
-int comedi_trig_ioctl(unsigned int minor,unsigned int subdev,comedi_trig *it);
-int __comedi_trig_ioctl(unsigned int minor,unsigned int subdev,comedi_trig *it);
-int comedi_data_write(unsigned int dev,unsigned int subdev,unsigned int chan,
-       unsigned int range,unsigned int aref,lsampl_t data);
-int comedi_data_read(unsigned int dev,unsigned int subdev,unsigned int chan,
-       unsigned int range,unsigned int aref,lsampl_t *data);
-int comedi_dio_config(unsigned int dev,unsigned int subdev,unsigned int chan,
-       unsigned int io);
-int comedi_dio_read(unsigned int dev,unsigned int subdev,unsigned int chan,
-       unsigned int *val);
-int comedi_dio_write(unsigned int dev,unsigned int subdev,unsigned int chan,
-       unsigned int val);
-int comedi_dio_bitfield(unsigned int dev,unsigned int subdev,unsigned int mask,
-       unsigned int *bits);
-int comedi_get_n_subdevices(unsigned int dev);
-int comedi_get_version_code(unsigned int dev);
-char *comedi_get_driver_name(unsigned int dev);
-char *comedi_get_board_name(unsigned int minor);
-int comedi_get_subdevice_type(unsigned int minor,unsigned int subdevice);
-int comedi_find_subdevice_by_type(unsigned int minor,int type,unsigned int subd);
-int comedi_get_n_channels(unsigned int minor,unsigned int subdevice);
-lsampl_t comedi_get_maxdata(unsigned int minor,unsigned int subdevice,unsigned
-       int chan);
-int comedi_get_n_ranges(unsigned int minor,unsigned int subdevice,unsigned int
-       chan);
-int comedi_do_insn(unsigned int minor,comedi_insn *insn);
-
-
-
-/* ALPHA functions */
-unsigned int comedi_get_subdevice_flags(unsigned int minor,unsigned int
-       subdevice);
-int comedi_get_len_chanlist(unsigned int minor,unsigned int subdevice);
-int comedi_get_krange(unsigned int minor,unsigned int subdevice,unsigned int
-       chan, unsigned int range, comedi_krange *krange);
-unsigned int comedi_get_buf_head_pos(unsigned int minor,unsigned int
-       subdevice);
-int comedi_set_user_int_count(unsigned int minor,unsigned int subdevice,
-       unsigned int buf_user_count);
-
-#endif
-
-
 
 #ifdef __cplusplus
 }
diff --git a/include/linux/comedilib.h b/include/linux/comedilib.h
new file mode 100644 (file)
index 0000000..78f97d7
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+    linux/include/comedilib.h
+    header file for kcomedilib
+
+    COMEDI - Linux Control and Measurement Device Interface
+    Copyright (C) 1998-2001 David A. Schleef <ds@schleef.org>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+
+#ifndef _LINUX_COMEDILIB_H
+#define _LINUX_COMEDILIB_H
+
+#include <linux/comedi.h>
+
+/* Kernel internal stuff.  Needed by real-time modules and such. */
+
+#ifndef __KERNEL__
+#error linux/comedilib.h should not be included by non-kernel-space code
+#endif
+
+/* callback stuff */
+
+#define COMEDI_CB_EOS          1       /* end of scan */
+#define COMEDI_CB_EOA          2       /* end of acquisition */
+#define COMEDI_CB_BLOCK                4       /* convenient block size */
+#define COMEDI_CB_EOBUF                8       /* end of buffer */
+#define COMEDI_CB_ERROR                16      /* card error during acquisition */
+
+/* exported functions */
+
+/* these functions may not be called at real-time priority */
+
+int comedi_open(unsigned int minor);
+void comedi_close(unsigned int minor);
+
+/* these functions may be called at any priority, but may fail at
+   real-time priority */
+
+int comedi_lock(unsigned int minor,unsigned int subdev);
+int comedi_unlock(unsigned int minor,unsigned int subdev);
+
+/* these functions may be called at any priority, but you must hold
+   the lock for the subdevice */
+
+int comedi_cancel(unsigned int minor,unsigned int subdev);
+int comedi_register_callback(unsigned int minor,unsigned int subdev,
+               unsigned int mask,int (*cb)(unsigned int,void *),void *arg);
+
+int comedi_trigger(unsigned int minor,unsigned int subdev,comedi_trig *it);
+int __comedi_trigger(unsigned int minor,unsigned int subdev,comedi_trig *it);
+int comedi_data_write(unsigned int dev,unsigned int subdev,unsigned int chan,
+       unsigned int range,unsigned int aref,lsampl_t data);
+int comedi_data_read(unsigned int dev,unsigned int subdev,unsigned int chan,
+       unsigned int range,unsigned int aref,lsampl_t *data);
+int comedi_dio_config(unsigned int dev,unsigned int subdev,unsigned int chan,
+       unsigned int io);
+int comedi_dio_read(unsigned int dev,unsigned int subdev,unsigned int chan,
+       unsigned int *val);
+int comedi_dio_write(unsigned int dev,unsigned int subdev,unsigned int chan,
+       unsigned int val);
+int comedi_dio_bitfield(unsigned int dev,unsigned int subdev,unsigned int mask,
+       unsigned int *bits);
+int comedi_get_n_subdevices(unsigned int dev);
+int comedi_get_version_code(unsigned int dev);
+char *comedi_get_driver_name(unsigned int dev);
+char *comedi_get_board_name(unsigned int minor);
+int comedi_get_subdevice_type(unsigned int minor,unsigned int subdevice);
+int comedi_find_subdevice_by_type(unsigned int minor,int type,unsigned int subd);
+int comedi_get_n_channels(unsigned int minor,unsigned int subdevice);
+lsampl_t comedi_get_maxdata(unsigned int minor,unsigned int subdevice,unsigned
+       int chan);
+int comedi_get_n_ranges(unsigned int minor,unsigned int subdevice,unsigned int
+       chan);
+int comedi_do_insn(unsigned int minor,comedi_insn *insn);
+
+
+/* DEPRECATED functions */
+int comedi_get_rangetype(unsigned int minor,unsigned int subdevice,unsigned int chan);
+
+
+/* ALPHA functions */
+unsigned int comedi_get_subdevice_flags(unsigned int minor,unsigned int
+       subdevice);
+int comedi_get_len_chanlist(unsigned int minor,unsigned int subdevice);
+int comedi_get_krange(unsigned int minor,unsigned int subdevice,unsigned int
+       chan, unsigned int range, comedi_krange *krange);
+unsigned int comedi_get_buf_head_pos(unsigned int minor,unsigned int
+       subdevice);
+int comedi_set_user_int_count(unsigned int minor,unsigned int subdevice,
+       unsigned int buf_user_count);
+
+#endif
+