From 7b8a733986ce00e21433137a790a998b205e5cf4 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Tue, 16 Jan 2001 22:21:29 +0000 Subject: [PATCH] bunch of changes for kcomedilib --- comedi/kcomedilib/Makefile | 8 +-- comedi/kcomedilib/data.c | 2 + comedi/kcomedilib/dio.c | 2 + comedi/kcomedilib/kcomedilib_main.c | 47 +----------- comedi/kcomedilib/ksyms.c | 105 +++++++++++++++++++++++++++ include/linux/comedi.h | 68 +----------------- include/linux/comedilib.h | 108 ++++++++++++++++++++++++++++ 7 files changed, 223 insertions(+), 117 deletions(-) create mode 100644 comedi/kcomedilib/ksyms.c create mode 100644 include/linux/comedilib.h diff --git a/comedi/kcomedilib/Makefile b/comedi/kcomedilib/Makefile index 02f64c72..e2368532 100644 --- a/comedi/kcomedilib/Makefile +++ b/comedi/kcomedilib/Makefile @@ -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 diff --git a/comedi/kcomedilib/data.c b/comedi/kcomedilib/data.c index 6aa42f33..a9e6fe03 100644 --- a/comedi/kcomedilib/data.c +++ b/comedi/kcomedilib/data.c @@ -23,7 +23,9 @@ +#include #include +#include #include #include diff --git a/comedi/kcomedilib/dio.c b/comedi/kcomedilib/dio.c index cfffa260..01a54560 100644 --- a/comedi/kcomedilib/dio.c +++ b/comedi/kcomedilib/dio.c @@ -23,7 +23,9 @@ +#include #include +#include #include #include diff --git a/comedi/kcomedilib/kcomedilib_main.c b/comedi/kcomedilib/kcomedilib_main.c index 0c78ec76..ecf0c501 100644 --- a/comedi/kcomedilib/kcomedilib_main.c +++ b/comedi/kcomedilib/kcomedilib_main.c @@ -25,6 +25,7 @@ #include #include +#include #include @@ -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 index 00000000..4ca27a8a --- /dev/null +++ b/comedi/kcomedilib/ksyms.c @@ -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 + + 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 +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + + +#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 + diff --git a/include/linux/comedi.h b/include/linux/comedi.h index 487dbb2a..83115a9e 100644 --- a/include/linux/comedi.h +++ b/include/linux/comedi.h @@ -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 index 00000000..78f97d76 --- /dev/null +++ b/include/linux/comedilib.h @@ -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 + + 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 + +/* 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 + -- 2.26.2