Module: xenomai-abe Branch: analogy Commit: 98ec6933c21efae1211c062989ed35f32bab93dc URL: http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=98ec6933c21efae1211c062989ed35f32bab93dc
Author: Alexis Berlemont <alexis.berlem...@gmail.com> Date: Thu Oct 15 00:49:49 2009 +0200 Comedi4RTDM -> Analogy (second part) --- include/analogy/Makefile.am | 6 +- include/analogy/analogy.h | 144 ++++++++++++++++---------------- include/analogy/command.h | 14 ++-- include/analogy/context.h | 2 +- include/analogy/descriptor.h | 28 +++--- include/analogy/device.h | 58 +++++++------- include/analogy/driver.h | 34 ++++---- include/analogy/instruction.h | 174 +++++++++++++++++++------------------- include/analogy/ioctl.h | 40 +++++----- include/analogy/os_facilities.h | 138 +++++++++++++++--------------- include/analogy/subdevice.h | 172 +++++++++++++++++++------------------- include/analogy/transfer.h | 84 ++++++++++---------- include/analogy/types.h | 14 ++-- 13 files changed, 454 insertions(+), 454 deletions(-) diff --git a/include/analogy/Makefile.am b/include/analogy/Makefile.am index 4ea560e..d9344ad 100644 --- a/include/analogy/Makefile.am +++ b/include/analogy/Makefile.am @@ -1,10 +1,10 @@ -includesubdir = $(includedir)/comedi +includesubdir = $(includedir)/analogy includesub_HEADERS = \ buffer.h \ channel_range.h \ - comedi_driver.h \ - comedi.h \ + analogy_driver.h \ + analogy.h \ command.h \ context.h \ descriptor.h \ diff --git a/include/analogy/analogy.h b/include/analogy/analogy.h index 754d001..8d11047 100644 --- a/include/analogy/analogy.h +++ b/include/analogy/analogy.h @@ -1,6 +1,6 @@ /** * @file - * Analogy, library facilities + * Analogy for Linux, library facilities * @note Copyright (C) 1997-2000 David A. Schleef <d...@schleef.org> * @note Copyright (C) 2008 Alexis Berlemont <alexis.berlem...@free.fr> * @@ -35,114 +35,114 @@ extern "C" { /* --- Level 0 API (not supposed to be used) --- */ -int analogy_sys_open(const char *fname); +int a4l_sys_open(const char *fname); -int analogy_sys_close(int fd); +int a4l_sys_close(int fd); -int analogy_sys_read(int fd, void *buf, size_t nbyte); +int a4l_sys_read(int fd, void *buf, size_t nbyte); -int analogy_sys_write(int fd, void *buf, size_t nbyte); +int a4l_sys_write(int fd, void *buf, size_t nbyte); -int analogy_sys_attach(int fd, analogy_lnkdesc_t * arg); +int a4l_sys_attach(int fd, a4l_lnkdesc_t * arg); -int analogy_sys_detach(int fd); +int a4l_sys_detach(int fd); -int analogy_sys_desc(int fd, analogy_desc_t * dsc, int pass); +int a4l_sys_desc(int fd, a4l_desc_t * dsc, int pass); -int analogy_sys_devinfo(int fd, analogy_dvinfo_t * info); +int a4l_sys_devinfo(int fd, a4l_dvinfo_t * info); -int analogy_sys_subdinfo(int fd, analogy_sbinfo_t * info); +int a4l_sys_subdinfo(int fd, a4l_sbinfo_t * info); -int analogy_sys_nbchaninfo(int fd, unsigned int idx_subd, unsigned int *nb); +int a4l_sys_nbchaninfo(int fd, unsigned int idx_subd, unsigned int *nb); -int analogy_sys_chaninfo(int fd, - unsigned int idx_subd, analogy_chinfo_t * info); +int a4l_sys_chaninfo(int fd, + unsigned int idx_subd, a4l_chinfo_t * info); -int analogy_sys_nbrnginfo(int fd, - unsigned int idx_subd, - unsigned int idx_chan, unsigned int *nb); +int a4l_sys_nbrnginfo(int fd, + unsigned int idx_subd, + unsigned int idx_chan, unsigned int *nb); -int analogy_sys_rnginfo(int fd, - unsigned int idx_subd, - unsigned int idx_chan, analogy_rnginfo_t * info); +int a4l_sys_rnginfo(int fd, + unsigned int idx_subd, + unsigned int idx_chan, a4l_rnginfo_t * info); /* --- Level 1 API (supposed to be used) --- */ -int analogy_get_desc(int fd, analogy_desc_t * dsc, int pass); +int a4l_get_desc(int fd, a4l_desc_t * dsc, int pass); -int analogy_open(analogy_desc_t * dsc, const char *fname); +int a4l_open(a4l_desc_t * dsc, const char *fname); -int analogy_close(analogy_desc_t * dsc); +int a4l_close(a4l_desc_t * dsc); -int analogy_fill_desc(analogy_desc_t * dsc); +int a4l_fill_desc(a4l_desc_t * dsc); -int analogy_get_subdinfo(analogy_desc_t * dsc, - unsigned int subd, analogy_sbinfo_t ** info); +int a4l_get_subdinfo(a4l_desc_t * dsc, + unsigned int subd, a4l_sbinfo_t ** info); -int analogy_get_chinfo(analogy_desc_t * dsc, - unsigned int subd, - unsigned int chan, analogy_chinfo_t ** info); +int a4l_get_chinfo(a4l_desc_t * dsc, + unsigned int subd, + unsigned int chan, a4l_chinfo_t ** info); -#define analogy_get_chan_max(x) (1ULL << (x)->nb_bits) +#define a4l_get_chan_max(x) (1ULL << (x)->nb_bits) -#define analogy_is_chan_global(x) ((x)->chan_flags & A4L_CHAN_GLOBAL) +#define a4l_is_chan_global(x) ((x)->chan_flags & A4L_CHAN_GLOBAL) -int analogy_get_rnginfo(analogy_desc_t * dsc, - unsigned int subd, - unsigned int chan, - unsigned int rng, analogy_rnginfo_t ** info); +int a4l_get_rnginfo(a4l_desc_t * dsc, + unsigned int subd, + unsigned int chan, + unsigned int rng, a4l_rnginfo_t ** info); -#define analogy_is_rng_global(x) ((x)->flags & A4L_RNG_GLOBAL) +#define a4l_is_rng_global(x) ((x)->flags & A4L_RNG_GLOBAL) -int analogy_snd_command(analogy_desc_t * dsc, analogy_cmd_t * cmd); +int a4l_snd_command(a4l_desc_t * dsc, a4l_cmd_t * cmd); -int analogy_snd_cancel(analogy_desc_t * dsc, unsigned int idx_subd); +int a4l_snd_cancel(a4l_desc_t * dsc, unsigned int idx_subd); -int analogy_set_bufsize(analogy_desc_t * dsc, - unsigned int idx_subd, unsigned long size); +int a4l_set_bufsize(a4l_desc_t * dsc, + unsigned int idx_subd, unsigned long size); -int analogy_get_bufsize(analogy_desc_t * dsc, - unsigned int idx_subd, unsigned long *size); +int a4l_get_bufsize(a4l_desc_t * dsc, + unsigned int idx_subd, unsigned long *size); -int analogy_mark_bufrw(analogy_desc_t * dsc, - unsigned int idx_subd, - unsigned long cur, unsigned long *newp); +int a4l_mark_bufrw(a4l_desc_t * dsc, + unsigned int idx_subd, + unsigned long cur, unsigned long *newp); -int analogy_poll(analogy_desc_t * dsc, - unsigned int idx_subd, unsigned long ms_timeout); +int a4l_poll(a4l_desc_t * dsc, + unsigned int idx_subd, unsigned long ms_timeout); -int analogy_mmap(analogy_desc_t * dsc, - unsigned int idx_subd, unsigned long size, void **ptr); +int a4l_mmap(a4l_desc_t * dsc, + unsigned int idx_subd, unsigned long size, void **ptr); -int analogy_snd_insnlist(analogy_desc_t * dsc, analogy_insnlst_t * arg); +int a4l_snd_insnlist(a4l_desc_t * dsc, a4l_insnlst_t * arg); -int analogy_snd_insn(analogy_desc_t * dsc, analogy_insn_t * arg); +int a4l_snd_insn(a4l_desc_t * dsc, a4l_insn_t * arg); /* --- Level 2 API (supposed to be used) --- */ -int analogy_sync_write(analogy_desc_t * dsc, - unsigned int idx_subd, - unsigned int chan_desc, - unsigned int delay, void *buf, size_t nbyte); - -int analogy_sync_read(analogy_desc_t * dsc, - unsigned int idx_subd, - unsigned int chan_desc, - unsigned int delay, void *buf, size_t nbyte); - -int analogy_find_range(analogy_desc_t * dsc, - unsigned int idx_subd, - unsigned int idx_chan, - unsigned long unit, - double min, double max, analogy_rnginfo_t ** rng); - -int analogy_to_phys(analogy_chinfo_t * chan, - analogy_rnginfo_t * rng, double *dst, void *src, - int cnt); +int a4l_sync_write(a4l_desc_t * dsc, + unsigned int idx_subd, + unsigned int chan_desc, + unsigned int delay, void *buf, size_t nbyte); + +int a4l_sync_read(a4l_desc_t * dsc, + unsigned int idx_subd, + unsigned int chan_desc, + unsigned int delay, void *buf, size_t nbyte); + +int a4l_find_range(a4l_desc_t * dsc, + unsigned int idx_subd, + unsigned int idx_chan, + unsigned long unit, + double min, double max, a4l_rnginfo_t ** rng); + +int a4l_to_phys(a4l_chinfo_t * chan, + a4l_rnginfo_t * rng, double *dst, void *src, + int cnt); -int analogy_from_phys(analogy_chinfo_t * chan, - analogy_rnginfo_t * rng, void *dst, double *src, - int cnt); +int a4l_from_phys(a4l_chinfo_t * chan, + a4l_rnginfo_t * rng, void *dst, double *src, + int cnt); #endif /* !DOXYGEN_CPP */ diff --git a/include/analogy/command.h b/include/analogy/command.h index b801cf6..913ff19 100644 --- a/include/analogy/command.h +++ b/include/analogy/command.h @@ -23,7 +23,7 @@ #ifndef __ANALOGY_CMD__ #define __ANALOGY_CMD__ -#include <comedi/context.h> +#include <analogy/context.h> /*! * @addtogroup async1_lib @@ -86,7 +86,7 @@ */ #define TRIG_EXT 0x00000040 /** - * Trigger on comedi-internal signal N + * Trigger on analogy-internal signal N */ #define TRIG_INT 0x00000080 /** @@ -187,10 +187,10 @@ /*! * @brief Structure describing the asynchronous instruction - * @see analogy_snd_command() + * @see a4l_snd_command() */ -struct analogy_cmd_desc { +struct a4l_cmd_desc { unsigned char idx_subd; /**< Subdevice to which the command will be applied. */ @@ -230,17 +230,17 @@ struct analogy_cmd_desc { sampl_t *data; /**< Driver specific buffer pointer */ }; -typedef struct analogy_cmd_desc analogy_cmd_t; +typedef struct a4l_cmd_desc a4l_cmd_t; /*! @} async1_lib */ #if defined(__KERNEL__) && !defined(DOXYGEN_CPP) /* --- Command related function --- */ -void a4l_free_cmddesc(analogy_cmd_t * desc); +void a4l_free_cmddesc(a4l_cmd_t * desc); /* --- Upper layer functions --- */ -int a4l_check_cmddesc(a4l_cxt_t * cxt, analogy_cmd_t * desc); +int a4l_check_cmddesc(a4l_cxt_t * cxt, a4l_cmd_t * desc); int a4l_ioctl_cmd(a4l_cxt_t * cxt, void *arg); #endif /* __KERNEL__ && !DOXYGEN_CPP */ diff --git a/include/analogy/context.h b/include/analogy/context.h index 8c9b50c..7bd225a 100644 --- a/include/analogy/context.h +++ b/include/analogy/context.h @@ -25,7 +25,7 @@ #if defined(__KERNEL__) && !defined(DOXYGEN_CPP) -#include <comedi/os_facilities.h> +#include <analogy/os_facilities.h> struct a4l_device; diff --git a/include/analogy/descriptor.h b/include/analogy/descriptor.h index 90fc9ef..fcf8559 100644 --- a/include/analogy/descriptor.h +++ b/include/analogy/descriptor.h @@ -1,6 +1,6 @@ /** * @file - * Comedilib for RTDM, descriptor related features + * Analogy for Linux, descriptor related features * @note Copyright (C) 1997-2000 David A. Schleef <d...@schleef.org> * @note Copyright (C) 2008 Alexis Berlemont <alexis.berlem...@free.fr> * @@ -19,11 +19,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#ifndef __COMEDI_LIB_CORE__ -#define __COMEDI_LIB_CORE__ +#ifndef __ANALOGY_LIB_CORE__ +#define __ANALOGY_LIB_CORE__ -#include <comedi/subdevice.h> -#include <comedi/device.h> +#include <analogy/subdevice.h> +#include <analogy/device.h> /* --- Descriptor precompilation constants --- */ @@ -37,7 +37,7 @@ */ /*! - * @anchor COMEDI_xxx_DESC @name COMEDI_xxx_DESC + * @anchor ANALOGY_xxx_DESC @name ANALOGY_xxx_DESC * @brief Constants used as argument so as to define the description * depth to recover * @{ @@ -46,25 +46,25 @@ /** * BSC stands for basic descriptor (device data) */ -#define COMEDI_BSC_DESC 0x0 +#define BSC_DESC 0x0 /** * CPLX stands for complex descriptor (subdevice + channel + range * data) */ -#define COMEDI_CPLX_DESC 0x1 +#define CPLX_DESC 0x1 - /*! @} COMEDI_xxx_DESC */ + /*! @} ANALOGY_xxx_DESC */ /* --- Descriptor structure --- */ /*! * @brief Structure containing device-information useful to users - * @see comedi_get_desc() + * @see a4l_get_desc() */ -struct comedi_descriptor { - char board_name[COMEDI_NAMELEN]; +struct a4l_descriptor { + char board_name[A4L_NAMELEN]; /**< Board name. */ int nb_subd; /**< Subdevices count. */ @@ -81,8 +81,8 @@ struct comedi_descriptor { void *sbdata; /**< Data buffer pointer. */ }; -typedef struct comedi_descriptor comedi_desc_t; +typedef struct a4l_descriptor a4l_desc_t; /*! @} descriptor_sys */ -#endif /* __COMEDI_LIB_CORE__ */ +#endif /* __ANALOGY_LIB_CORE__ */ diff --git a/include/analogy/device.h b/include/analogy/device.h index 4d396c9..27a3bd0 100644 --- a/include/analogy/device.h +++ b/include/analogy/device.h @@ -1,6 +1,6 @@ /** * @file - * Comedi for RTDM, device related features + * Analogy for Linux, device related features * * Copyright (C) 1997-2000 David A. Schleef <d...@schleef.org> * Copyright (C) 2008 Alexis Berlemont <alexis.berlem...@free.fr> @@ -20,86 +20,86 @@ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __COMEDI_DEVICE__ -#define __COMEDI_DEVICE__ +#ifndef __ANALOGY_DEVICE__ +#define __ANALOGY_DEVICE__ #ifndef DOXYGEN_CPP -#include <comedi/context.h> -#include <comedi/driver.h> -#include <comedi/transfer.h> +#include <analogy/context.h> +#include <analogy/driver.h> +#include <analogy/transfer.h> #ifdef __KERNEL__ -#define COMEDI_NB_DEVICES 10 +#define A4L_NB_DEVICES 10 -#define COMEDI_DEV_ATTACHED 0 +#define A4L_DEV_ATTACHED 0 -struct comedi_device { +struct a4l_device { /* Spinlock for global device use */ - comedi_lock_t lock; + a4l_lock_t lock; /* Device specific flags */ unsigned long flags; /* Driver assigned to this device thanks to attaching procedure */ - comedi_drv_t *driver; + a4l_drv_t *driver; /* Hidden description stuff */ struct list_head subdvsq; /* Context-dependent stuff */ - comedi_trf_t transfer; + a4l_trf_t transfer; /* Private data useful for drivers functioning */ void *priv; }; -typedef struct comedi_device comedi_dev_t; +typedef struct a4l_device a4l_dev_t; #endif /* __KERNEL__ */ /* DEVCFG ioctl argument structure */ -struct comedi_link_desc { +struct a4l_link_desc { unsigned char bname_size; char *bname; unsigned int opts_size; void *opts; }; -typedef struct comedi_link_desc comedi_lnkdesc_t; +typedef struct a4l_link_desc a4l_lnkdesc_t; /* DEVINFO ioctl argument structure */ -struct comedi_dev_info { - char board_name[COMEDI_NAMELEN]; +struct a4l_dev_info { + char board_name[A4L_NAMELEN]; int nb_subd; int idx_read_subd; int idx_write_subd; }; -typedef struct comedi_dev_info comedi_dvinfo_t; +typedef struct a4l_dev_info a4l_dvinfo_t; #ifdef __KERNEL__ /* --- Device related macro --- */ -#define comedi_check_dev(x) test_bit(COMEDI_DEV_ATTACHED, &(x->flags)) +#define a4l_check_dev(x) test_bit(A4L_DEV_ATTACHED, &(x->flags)) /* --- Devices tab related functions --- */ -void comedi_init_devs(void); -int comedi_check_cleanup_devs(void); -int comedi_rdproc_devs(char *page, - char **start, - off_t off, int count, int *eof, void *data); +void a4l_init_devs(void); +int a4l_check_cleanup_devs(void); +int a4l_rdproc_devs(char *page, + char **start, + off_t off, int count, int *eof, void *data); /* --- Context related function / macro --- */ -void comedi_set_dev(comedi_cxt_t * cxt); -#define comedi_get_dev(x) ((x)->dev) +void a4l_set_dev(a4l_cxt_t * cxt); +#define a4l_get_dev(x) ((x)->dev) /* --- Upper layer functions --- */ -int comedi_ioctl_devcfg(comedi_cxt_t * cxt, void *arg); -int comedi_ioctl_devinfo(comedi_cxt_t * cxt, void *arg); +int a4l_ioctl_devcfg(a4l_cxt_t * cxt, void *arg); +int a4l_ioctl_devinfo(a4l_cxt_t * cxt, void *arg); #endif /* __KERNEL__ */ #endif /* !DOXYGEN_CPP */ -#endif /* __COMEDI_DEVICE__ */ +#endif /* __ANALOGY_DEVICE__ */ diff --git a/include/analogy/driver.h b/include/analogy/driver.h index f07ee80..a7abb00 100644 --- a/include/analogy/driver.h +++ b/include/analogy/driver.h @@ -1,6 +1,6 @@ /** * @file - * Comedi for RTDM, driver related features + * Analogy for Linux, driver related features * * @note Copyright (C) 1997-2000 David A. Schleef <d...@schleef.org> * @note Copyright (C) 2008 Alexis Berlemont <alexis.berlem...@free.fr> @@ -20,22 +20,22 @@ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __COMEDI_DRIVER__ -#define __COMEDI_DRIVER__ +#ifndef __ANALOGY_DRIVER__ +#define __ANALOGY_DRIVER__ #ifdef __KERNEL__ #include <linux/list.h> -struct comedi_link_desc; -struct comedi_device; +struct a4l_link_desc; +struct a4l_device; /** Structure containing driver declaration data. * * @see rt_task_inquire() */ -/* Comedi driver descriptor */ -struct comedi_driver { +/* Analogy driver descriptor */ +struct a4l_driver { /* List stuff */ struct list_head list; @@ -52,29 +52,29 @@ struct comedi_driver { /**< Size of the driver's private data */ /* Init/destroy procedures */ - int (*attach) (struct comedi_device *, struct comedi_link_desc *); + int (*attach) (struct a4l_device *, struct a4l_link_desc *); /**< Attach procedure */ - int (*detach) (struct comedi_device *); + int (*detach) (struct a4l_device *); /**< Detach procedure */ }; -typedef struct comedi_driver comedi_drv_t; +typedef struct a4l_driver a4l_drv_t; #ifndef DOXYGEN_CPP /* Driver list related functions */ -int comedi_register_drv(comedi_drv_t * drv); -int comedi_unregister_drv(comedi_drv_t * drv); -int comedi_lct_drv(char *pin, comedi_drv_t ** pio); +int a4l_register_drv(a4l_drv_t * drv); +int a4l_unregister_drv(a4l_drv_t * drv); +int a4l_lct_drv(char *pin, a4l_drv_t ** pio); #ifdef CONFIG_PROC_FS -int comedi_rdproc_drvs(char *page, - char **start, - off_t off, int count, int *eof, void *data); +int a4l_rdproc_drvs(char *page, + char **start, + off_t off, int count, int *eof, void *data); #endif /* CONFIG_PROC_FS */ #endif /* !DOXYGEN_CPP */ #endif /* __KERNEL__ */ -#endif /* __COMEDI_DRIVER__ */ +#endif /* __ANALOGY_DRIVER__ */ diff --git a/include/analogy/instruction.h b/include/analogy/instruction.h index 751662e..ea3e1e3 100644 --- a/include/analogy/instruction.h +++ b/include/analogy/instruction.h @@ -1,6 +1,6 @@ /** * @file - * Comedi for RTDM, instruction related features + * Analogy for Linux, instruction related features * * @note Copyright (C) 1997-2000 David A. Schleef <d...@schleef.org> * @note Copyright (C) 2008 Alexis Berlemont <alexis.berlem...@free.fr> @@ -20,15 +20,15 @@ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __COMEDI_INSTRUCTION__ -#define __COMEDI_INSTRUCTION__ +#ifndef __ANALOGY_INSTRUCTION__ +#define __ANALOGY_INSTRUCTION__ -#include <comedi/types.h> -#include <comedi/context.h> +#include <analogy/types.h> +#include <analogy/context.h> -#define COMEDI_INSN_MASK_READ 0x8000000 -#define COMEDI_INSN_MASK_WRITE 0x4000000 -#define COMEDI_INSN_MASK_SPECIAL 0x2000000 +#define A4L_INSN_MASK_READ 0x8000000 +#define A4L_INSN_MASK_WRITE 0x4000000 +#define A4L_INSN_MASK_SPECIAL 0x2000000 /*! * @addtogroup sync1_lib @@ -36,7 +36,7 @@ */ /*! - * @anchor COMEDI_INSN_xxx @name Instruction type + * @anchor ANALOGY_INSN_xxx @name Instruction type * @brief Flags to define the type of instruction * @{ */ @@ -44,43 +44,43 @@ /** * Read instruction */ -#define COMEDI_INSN_READ (0 | COMEDI_INSN_MASK_READ) +#define A4L_INSN_READ (0 | A4L_INSN_MASK_READ) /** * Write instruction */ -#define COMEDI_INSN_WRITE (1 | COMEDI_INSN_MASK_WRITE) +#define A4L_INSN_WRITE (1 | A4L_INSN_MASK_WRITE) /** * "Bits" instruction */ -#define COMEDI_INSN_BITS (2 | COMEDI_INSN_MASK_READ | \ - COMEDI_INSN_MASK_WRITE) +#define A4L_INSN_BITS (2 | A4L_INSN_MASK_READ | \ + A4L_INSN_MASK_WRITE) /** * Configuration instruction */ -#define COMEDI_INSN_CONFIG (3 | COMEDI_INSN_MASK_READ | \ - COMEDI_INSN_MASK_WRITE) +#define A4L_INSN_CONFIG (3 | A4L_INSN_MASK_READ | \ + A4L_INSN_MASK_WRITE) /** * Get time instruction */ -#define COMEDI_INSN_GTOD (4 | COMEDI_INSN_MASK_READ | \ - COMEDI_INSN_MASK_SPECIAL) +#define A4L_INSN_GTOD (4 | A4L_INSN_MASK_READ | \ + A4L_INSN_MASK_SPECIAL) /** * Wait instruction */ -#define COMEDI_INSN_WAIT (5 | COMEDI_INSN_MASK_WRITE | \ - COMEDI_INSN_MASK_SPECIAL) +#define A4L_INSN_WAIT (5 | A4L_INSN_MASK_WRITE | \ + A4L_INSN_MASK_SPECIAL) /** * Trigger instruction (to start asynchronous acquisition) */ -#define COMEDI_INSN_INTTRIG (6 | COMEDI_INSN_MASK_WRITE | \ - COMEDI_INSN_MASK_SPECIAL) +#define A4L_INSN_INTTRIG (6 | A4L_INSN_MASK_WRITE | \ + A4L_INSN_MASK_SPECIAL) - /*! @} COMEDI_INSN_xxx */ + /*! @} ANALOGY_INSN_xxx */ /** * Maximal wait duration */ -#define COMEDI_INSN_WAIT_MAX 100000 +#define A4L_INSN_WAIT_MAX 100000 /*! * @anchor INSN_CONFIG_xxx @name Configuration instruction type @@ -88,85 +88,85 @@ * @{ */ -#define INSN_CONFIG_DIO_INPUT 0 -#define INSN_CONFIG_DIO_OUTPUT 1 -#define INSN_CONFIG_DIO_OPENDRAIN 2 -#define INSN_CONFIG_ANALOG_TRIG 16 -#define INSN_CONFIG_ALT_SOURCE 20 -#define INSN_CONFIG_DIGITAL_TRIG 21 -#define INSN_CONFIG_BLOCK_SIZE 22 -#define INSN_CONFIG_TIMER_1 23 -#define INSN_CONFIG_FILTER 24 -#define INSN_CONFIG_CHANGE_NOTIFY 25 -#define INSN_CONFIG_SERIAL_CLOCK 26 -#define INSN_CONFIG_BIDIRECTIONAL_DATA 27 -#define INSN_CONFIG_DIO_QUERY 28 -#define INSN_CONFIG_PWM_OUTPUT 29 -#define INSN_CONFIG_GET_PWM_OUTPUT 30 -#define INSN_CONFIG_ARM 31 -#define INSN_CONFIG_DISARM 32 -#define INSN_CONFIG_GET_COUNTER_STATUS 33 -#define INSN_CONFIG_RESET 34 -#define INSN_CONFIG_GPCT_SINGLE_PULSE_GENERATOR 1001 /* Use CTR as single pulsegenerator */ -#define INSN_CONFIG_GPCT_PULSE_TRAIN_GENERATOR 1002 /* Use CTR as pulsetraingenerator */ -#define INSN_CONFIG_GPCT_QUADRATURE_ENCODER 1003 /* Use the counter as encoder */ -#define INSN_CONFIG_SET_GATE_SRC 2001 /* Set gate source */ -#define INSN_CONFIG_GET_GATE_SRC 2002 /* Get gate source */ -#define INSN_CONFIG_SET_CLOCK_SRC 2003 /* Set master clock source */ -#define INSN_CONFIG_GET_CLOCK_SRC 2004 /* Get master clock source */ -#define INSN_CONFIG_SET_OTHER_SRC 2005 /* Set other source */ -#define INSN_CONFIG_SET_COUNTER_MODE 4097 -#define INSN_CONFIG_SET_ROUTING 4099 -#define INSN_CONFIG_GET_ROUTING 4109 +#define A4L_INSN_CONFIG_DIO_INPUT 0 +#define A4L_INSN_CONFIG_DIO_OUTPU 1 +#define A4L_INSN_CONFIG_DIO_OPENDRAIN 2 +#define A4L_INSN_CONFIG_ANALOG_TRIG 16 +#define A4L_INSN_CONFIG_ALT_SOURCE 20 +#define A4L_INSN_CONFIG_DIGITAL_TRIG 21 +#define A4L_INSN_CONFIG_BLOCK_SIZE 22 +#define A4L_INSN_CONFIG_TIMER_1 23 +#define A4L_INSN_CONFIG_FILTER 24 +#define A4L_INSN_CONFIG_CHANGE_NOTIFY 25 +#define A4L_INSN_CONFIG_SERIAL_CLOCK 26 +#define A4L_INSN_CONFIG_BIDIRECTIONAL_DATA 27 +#define A4L_INSN_CONFIG_DIO_QUERY 28 +#define A4L_INSN_CONFIG_PWM_OUTPUT 29 +#define A4L_INSN_CONFIG_GET_PWM_OUTPUT 30 +#define A4L_INSN_CONFIG_ARM 31 +#define A4L_INSN_CONFIG_DISARM 32 +#define A4L_INSN_CONFIG_GET_COUNTER_STATUS 33 +#define A4L_INSN_CONFIG_RESET 34 +#define A4L_INSN_CONFIG_GPCT_SINGLE_PULSE_GENERATOR 1001 /* Use CTR as single pulsegenerator */ +#define A4L_INSN_CONFIG_GPCT_PULSE_TRAIN_GENERATOR 1002 /* Use CTR as pulsetraingenerator */ +#define A4L_INSN_CONFIG_GPCT_QUADRATURE_ENCODER 1003 /* Use the counter as encoder */ +#define A4L_INSN_CONFIG_SET_GATE_SRC 2001 /* Set gate source */ +#define A4L_INSN_CONFIG_GET_GATE_SRC 2002 /* Get gate source */ +#define A4L_INSN_CONFIG_SET_CLOCK_SRC 2003 /* Set master clock source */ +#define A4L_INSN_CONFIG_GET_CLOCK_SRC 2004 /* Get master clock source */ +#define A4L_INSN_CONFIG_SET_OTHER_SRC 2005 /* Set other source */ +#define A4L_INSN_CONFIG_SET_COUNTER_MODE 4097 +#define A4L_INSN_CONFIG_SET_ROUTING 4099 +#define A4L_INSN_CONFIG_GET_ROUTING 4109 /*! @} INSN_CONFIG_xxx */ /*! - * @anchor COMEDI_COUNTER_xxx @name Counter status bits + * @anchor ANALOGY_COUNTER_xxx @name Counter status bits * @brief Status bits for INSN_CONFIG_GET_COUNTER_STATUS * @{ */ -#define COMEDI_COUNTER_ARMED 0x1 -#define COMEDI_COUNTER_COUNTING 0x2 -#define COMEDI_COUNTER_TERMINAL_COUNT 0x4 +#define COUNTER_ARMED 0x1 +#define COUNTER_COUNTING 0x2 +#define COUNTER_TERMINAL_COUNT 0x4 - /*! @} COMEDI_COUNTER_xxx */ + /*! @} ANALOGY_COUNTER_xxx */ /*! - * @anchor COMEDI_IO_DIRECTION @name IO direction + * @anchor ANALOGY_IO_DIRECTION @name IO direction * @brief Values to define the IO polarity * @{ */ -#define COMEDI_INPUT 0 -#define COMEDI_OUTPUT 1 -#define COMEDI_OPENDRAIN 2 +#define A4L_INPUT 0 +#define A4L_OUTPUT 1 +#define A4L_OPENDRAIN 2 - /*! @} COMEDI_IO_DIRECTION */ + /*! @} ANALOGY_IO_DIRECTION */ /*! - * @anchor COMEDI_EV_xxx @name Events types - * @brief Values to define the Comedi events. They might used to send + * @anchor ANALOGY_EV_xxx @name Events types + * @brief Values to define the Analogy events. They might used to send * some specific events through the instruction interface. * @{ */ -#define COMEDI_EV_START 0x00040000 -#define COMEDI_EV_SCAN_BEGIN 0x00080000 -#define COMEDI_EV_CONVERT 0x00100000 -#define COMEDI_EV_SCAN_END 0x00200000 -#define COMEDI_EV_STOP 0x00400000 +#define A4L_EV_START 0x00040000 +#define A4L_EV_SCAN_BEGIN 0x00080000 +#define A4L_EV_CONVERT 0x00100000 +#define A4L_EV_SCAN_END 0x00200000 +#define A4L_EV_STOP 0x00400000 - /*! @} COMEDI_EV_xxx */ + /*! @} ANALOGY_EV_xxx */ /*! * @brief Structure describing the synchronous instruction - * @see comedi_snd_insn() + * @see a4l_snd_insn() */ -struct comedi_instruction { +struct a4l_instruction { unsigned int type; /**< Instruction type */ unsigned int idx_subd; @@ -178,26 +178,26 @@ struct comedi_instruction { lsampl_t *data; /**< Instruction data */ }; -typedef struct comedi_instruction comedi_insn_t; +typedef struct a4l_instruction a4l_insn_t; /*! * @brief Structure describing the list of synchronous instructions - * @see comedi_snd_insnlist() + * @see a4l_snd_insnlist() */ -struct comedi_instruction_list { +struct a4l_instruction_list { unsigned int count; /**< Instructions count */ - comedi_insn_t *insns; + a4l_insn_t *insns; /**< Tab containing the instructions pointers */ }; -typedef struct comedi_instruction_list comedi_insnlst_t; +typedef struct a4l_instruction_list a4l_insnlst_t; /*! @} sync1_lib */ #if defined(__KERNEL__) && !defined(DOXYGEN_CPP) -struct comedi_kernel_instruction { +struct a4l_kernel_instruction { unsigned int type; unsigned int idx_subd; unsigned int chan_desc; @@ -205,21 +205,21 @@ struct comedi_kernel_instruction { lsampl_t *data; lsampl_t *__udata; }; -typedef struct comedi_kernel_instruction comedi_kinsn_t; +typedef struct a4l_kernel_instruction a4l_kinsn_t; -struct comedi_kernel_instruction_list { +struct a4l_kernel_instruction_list { unsigned int count; - comedi_kinsn_t *insns; - comedi_kinsn_t *__uinsns; + a4l_kinsn_t *insns; + a4l_kinsn_t *__uinsns; }; -typedef struct comedi_kernel_instruction_list comedi_kilst_t; +typedef struct a4l_kernel_instruction_list a4l_kilst_t; /* Instruction related functions */ /* Upper layer functions */ -int comedi_ioctl_insnlist(comedi_cxt_t * cxt, void *arg); -int comedi_ioctl_insn(comedi_cxt_t * cxt, void *arg); +int a4l_ioctl_insnlist(a4l_cxt_t * cxt, void *arg); +int a4l_ioctl_insn(a4l_cxt_t * cxt, void *arg); #endif /* __KERNEL__ && !DOXYGEN_CPP */ -#endif /* __COMEDI_INSTRUCTION__ */ +#endif /* __ANALOGY_INSTRUCTION__ */ diff --git a/include/analogy/ioctl.h b/include/analogy/ioctl.h index 816a1a2..ae9f2b8 100644 --- a/include/analogy/ioctl.h +++ b/include/analogy/ioctl.h @@ -1,6 +1,6 @@ /** * @file - * Comedi for RTDM, IOCTLs declarations + * Analogy for Linux, IOCTLs declarations * * Copyright (C) 1997-2000 David A. Schleef <d...@schleef.org> * Copyright (C) 2008 Alexis Berlemont <alexis.berlem...@free.fr> @@ -20,8 +20,8 @@ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __COMEDI_IOCTL__ -#define __COMEDI_IOCTL__ +#ifndef __ANALOGY_IOCTL__ +#define __ANALOGY_IOCTL__ #ifndef DOXYGEN_CPP @@ -33,25 +33,25 @@ #endif /* __KERNEL__ */ -#include <comedi/device.h> +#include <analogy/device.h> #define CIO 'd' -#define COMEDI_DEVCFG _IOW(CIO,0,comedi_lnkdesc_t) -#define COMEDI_DEVINFO _IOR(CIO,1,comedi_dvinfo_t) -#define COMEDI_SUBDINFO _IOR(CIO,2,comedi_sbinfo_t) -#define COMEDI_CHANINFO _IOR(CIO,3,comedi_chinfo_arg_t) -#define COMEDI_RNGINFO _IOR(CIO,4,comedi_rnginfo_arg_t) -#define COMEDI_CMD _IOWR(CIO,5,comedi_cmd_t) -#define COMEDI_CANCEL _IOR(CIO,6,unsigned int) -#define COMEDI_INSNLIST _IOR(CIO,7,unsigned int) -#define COMEDI_INSN _IOR(CIO,8,unsigned int) -#define COMEDI_BUFCFG _IOR(CIO,9,comedi_bufcfg_t) -#define COMEDI_BUFINFO _IOWR(CIO,10,comedi_bufinfo_t) -#define COMEDI_POLL _IOR(CIO,11,unsigned int) -#define COMEDI_MMAP _IOWR(CIO,12,unsigned int) -#define COMEDI_NBCHANINFO _IOR(CIO,13,comedi_chinfo_arg_t) -#define COMEDI_NBRNGINFO _IOR(CIO,14,comedi_rnginfo_arg_t) +#define A4L_DEVCFG _IOW(CIO,0,a4l_lnkdesc_t) +#define A4L_DEVINFO _IOR(CIO,1,a4l_dvinfo_t) +#define A4L_SUBDINFO _IOR(CIO,2,a4l_sbinfo_t) +#define A4L_CHANINFO _IOR(CIO,3,a4l_chinfo_arg_t) +#define A4L_RNGINFO _IOR(CIO,4,a4l_rnginfo_arg_t) +#define A4L_CMD _IOWR(CIO,5,a4l_cmd_t) +#define A4L_CANCEL _IOR(CIO,6,unsigned int) +#define A4L_INSNLIST _IOR(CIO,7,unsigned int) +#define A4L_INSN _IOR(CIO,8,unsigned int) +#define A4L_BUFCFG _IOR(CIO,9,a4l_bufcfg_t) +#define A4L_BUFINFO _IOWR(CIO,10,a4l_bufinfo_t) +#define A4L_POLL _IOR(CIO,11,unsigned int) +#define A4L_MMAP _IOWR(CIO,12,unsigned int) +#define A4L_NBCHANINFO _IOR(CIO,13,a4l_chinfo_arg_t) +#define A4L_NBRNGINFO _IOR(CIO,14,a4l_rnginfo_arg_t) #endif /* !DOXYGEN_CPP */ -#endif /* __COMEDI_IOCTL__ */ +#endif /* __ANALOGY_IOCTL__ */ diff --git a/include/analogy/os_facilities.h b/include/analogy/os_facilities.h index 405c9d4..f2f6c91 100644 --- a/include/analogy/os_facilities.h +++ b/include/analogy/os_facilities.h @@ -1,6 +1,6 @@ /** * @file - * Comedi for RTDM, Operation system facilities + * Analogy for Linux, Operation system facilities * * Copyright (C) 1997-2000 David A. Schleef <d...@schleef.org> * Copyright (C) 2008 Alexis Berlemont <alexis.berlem...@free.fr> @@ -20,8 +20,8 @@ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __COMEDI_OS_FACILITIES__ -#define __COMEDI_OS_FACILITIES__ +#ifndef __ANALOGY_OS_FACILITIES__ +#define __ANALOGY_OS_FACILITIES__ #if defined(__KERNEL__) && !defined(DOXYGEN_CPP) @@ -35,7 +35,7 @@ #if !(defined(CONFIG_XENO_SKIN_RTDM) || \ defined(CONFIG_XENO_SKIN_RTDM_MODULE)) -#error Comedi4RTDM needs RTDM enabled \ +#error Analogy needs RTDM enabled \ (statically or as amodule) to compile properly #endif /* !(CONFIG_XENO_SKIN_RTDM || CONFIG_XENO_SKIN_RTDM_MODULE */ @@ -44,119 +44,119 @@ /* --- Kernel traces functions --- */ -#define COMEDI_PROMPT "Comedi: " +#define AL4_PROMPT "a4l: " -#define RTDM_SUBCLASS_COMEDI 0 +#define RTDM_SUBCLASS_ANALOGY 0 -#define __comedi_err(fmt, args...) \ - rtdm_printk(KERN_ERR COMEDI_PROMPT fmt, ##args) +#define __a4l_err(fmt, args...) \ + rtdm_printk(KERN_ERR A4L_PROMPT fmt, ##args) -#define __comedi_warn(fmt, args...) \ - rtdm_printk(KERN_WARNING COMEDI_PROMPT fmt, ##args) +#define __a4l_warn(fmt, args...) \ + rtdm_printk(KERN_WARNING A4L_PROMPT fmt, ##args) -#define __comedi_info(fmt, args...) \ - rtdm_printk(KERN_INFO COMEDI_PROMPT fmt, ##args) +#define __a4l_info(fmt, args...) \ + rtdm_printk(KERN_INFO A4L_PROMPT fmt, ##args) -#ifdef CONFIG_XENO_DRIVERS_COMEDI_DEBUG +#ifdef CONFIG_XENO_DRIVERS_A4L_DEBUG -#define __comedi_dbg(level, debug, fmt, args...) \ +#define __a4l_dbg(level, debug, fmt, args...) \ do { \ if ((debug) >= (level)) \ - rtdm_printk(KERN_DEBUG COMEDI_PROMPT fmt, ##args); \ + rtdm_printk(KERN_DEBUG A4L_PROMPT fmt, ##args); \ } while (0) -#define core_dbg CONFIG_XENO_DRIVERS_COMEDI_DEBUG_LEVEL +#define core_dbg CONFIG_XENO_DRIVERS_ANALOGY_DEBUG_LEVEL -#else /* !CONFIG_XENO_DRIVERS_COMEDI_DEBUG */ +#else /* !CONFIG_XENO_DRIVERS_A4L_DEBUG */ -#define __comedi_dbg(level, debug, fmt, args...) -#endif /* CONFIG_XENO_DRIVERS_COMEDI_DEBUG */ +#define __a4l_dbg(level, debug, fmt, args...) +#endif /* CONFIG_XENO_DRIVERS_A4L_DEBUG */ -#define __comedi_dev_name(dev) \ +#define __a4l_dev_name(dev) \ (dev->driver == NULL) ? "unattached dev" : dev->driver->board_name -#define comedi_err(dev, fmt, args...) \ - __comedi_err("%s: " fmt, __comedi_dev_name(dev), ##args) +#define a4l_err(dev, fmt, args...) \ + __a4l_err("%s: " fmt, __a4l_dev_name(dev), ##args) -#define comedi_warn(dev, fmt, args...) \ - __comedi_warn("%s: " fmt, __comedi_dev_name(dev), ##args) +#define a4l_warn(dev, fmt, args...) \ + __a4l_warn("%s: " fmt, __a4l_dev_name(dev), ##args) -#define comedi_info(dev, fmt, args...) \ - __comedi_info("%s: " fmt, __comedi_dev_name(dev), ##args) +#define a4l_info(dev, fmt, args...) \ + __a4l_info("%s: " fmt, __a4l_dev_name(dev), ##args) -#define comedi_dbg(level, debug, dev, fmt, args...) \ - __comedi_dbg(level, debug, "%s: " fmt, __comedi_dev_name(dev), ##args) +#define a4l_dbg(level, debug, dev, fmt, args...) \ + __a4l_dbg(level, debug, "%s: " fmt, __a4l_dev_name(dev), ##args) /* --- Spinlock section --- */ -typedef rtdm_lock_t comedi_lock_t; +typedef rtdm_lock_t a4l_lock_t; -#define COMEDI_LOCK_UNLOCKED RTDM_LOCK_UNLOCKED +#define A4L_LOCK_UNLOCKED RTDM_LOCK_UNLOCKED -#define comedi_lock_init(lock) rtdm_lock_init(lock) -#define comedi_lock(lock) rtdm_lock_get(lock) -#define comedi_unlock(lock) rtdm_lock_put(lock) -#define comedi_lock_irqsave(lock, context) \ +#define a4l_lock_init(lock) rtdm_lock_init(lock) +#define a4l_lock(lock) rtdm_lock_get(lock) +#define a4l_unlock(lock) rtdm_lock_put(lock) +#define a4l_lock_irqsave(lock, context) \ rtdm_lock_get_irqsave(lock, context) -#define comedi_unlock_irqrestore(lock, context) \ +#define a4l_unlock_irqrestore(lock, context) \ rtdm_lock_put_irqrestore(lock, context) /* --- Task section --- */ -#define COMEDI_TASK_LOWEST_PRIORITY RTDM_TASK_LOWEST_PRIORITY -#define COMEDI_TASK_HIGHEST_PRIORITY RTDM_TASK_HIGHEST_PRIORITY +#define A4L_TASK_LOWEST_PRIORITY RTDM_TASK_LOWEST_PRIORITY +#define A4L_TASK_HIGHEST_PRIORITY RTDM_TASK_HIGHEST_PRIORITY -typedef rtdm_task_t comedi_task_t; -typedef rtdm_task_proc_t comedi_task_proc_t; +typedef rtdm_task_t a4l_task_t; +typedef rtdm_task_proc_t a4l_task_proc_t; -#define comedi_task_init(tsk, name, proc, arg, priority) \ +#define a4l_task_init(tsk, name, proc, arg, priority) \ rtdm_task_init(tsk, name, proc, arg, priority, 0) -#define comedi_task_destroy(tsk) rtdm_task_destroy(tsk) +#define a4l_task_destroy(tsk) rtdm_task_destroy(tsk) -#define comedi_task_sleep(delay) rtdm_task_sleep(delay) +#define a4l_task_sleep(delay) rtdm_task_sleep(delay) /* --- Time section --- */ -static inline void comedi_udelay(unsigned int us) +static inline void a4l_udelay(unsigned int us) { rtdm_task_busy_sleep(((nanosecs_rel_t) us) * 1000); } -static inline unsigned long long comedi_get_rawtime(void) +static inline unsigned long long a4l_get_rawtime(void) { return rtdm_clock_read(); } /* Function which gives absolute time */ -unsigned long long comedi_get_time(void); +unsigned long long a4l_get_time(void); /* Function for setting up the absolute time recovery */ -void comedi_init_time(void); +void a4l_init_time(void); /* --- IRQ section --- */ -#define COMEDI_IRQ_SHARED RTDM_IRQTYPE_SHARED -#define COMEDI_IRQ_EDGE RTDM_IRQTYPE_EDGE -#define COMEDI_IRQ_DISABLED 0 +#define A4L_IRQ_SHARED RTDM_IRQTYPE_SHARED +#define A4L_IRQ_EDGE RTDM_IRQTYPE_EDGE +#define A4L_IRQ_DISABLED 0 -typedef int (*comedi_irq_hdlr_t) (unsigned int irq, void *d); +typedef int (*a4l_irq_hdlr_t) (unsigned int irq, void *d); -struct comedi_irq_descriptor { +struct a4l_irq_descriptor { /* These fields are useful to launch the IRQ trampoline; that is the reason why a structure has been defined */ - comedi_irq_hdlr_t handler; + a4l_irq_hdlr_t handler; unsigned int irq; void *cookie; rtdm_irq_t rtdm_desc; }; -typedef struct comedi_irq_descriptor comedi_irq_desc_t; +typedef struct a4l_irq_descriptor a4l_irq_desc_t; -int __comedi_request_irq(comedi_irq_desc_t * dsc, - unsigned int irq, - comedi_irq_hdlr_t handler, - unsigned long flags, void *cookie); -int __comedi_free_irq(comedi_irq_desc_t * dsc); +int __a4l_request_irq(a4l_irq_desc_t * dsc, + unsigned int irq, + a4l_irq_hdlr_t handler, + unsigned long flags, void *cookie); +int __a4l_free_irq(a4l_irq_desc_t * dsc); /* --- Synchronization section --- */ @@ -164,28 +164,28 @@ int __comedi_free_irq(comedi_irq_desc_t * dsc); #define __RT_WAITER 2 #define __EVT_PDING 3 -struct comedi_sync { +struct a4l_sync { unsigned long status; rtdm_event_t rtdm_evt; rtdm_nrtsig_t nrt_sig; wait_queue_head_t wq; }; -typedef struct comedi_sync comedi_sync_t; +typedef struct a4l_sync a4l_sync_t; -#define comedi_select_sync(snc, slr, type, fd) \ +#define a4l_select_sync(snc, slr, type, fd) \ rtdm_event_select_bind(&((snc)->rtdm_evt), slr, type, fd) -int comedi_init_sync(comedi_sync_t * snc); -void comedi_cleanup_sync(comedi_sync_t * snc); -int comedi_wait_sync(comedi_sync_t * snc, int rt); -int comedi_timedwait_sync(comedi_sync_t * snc, - int rt, unsigned long long ns_timeout); -void comedi_signal_sync(comedi_sync_t * snc); +int a4l_init_sync(a4l_sync_t * snc); +void a4l_cleanup_sync(a4l_sync_t * snc); +int a4l_wait_sync(a4l_sync_t * snc, int rt); +int a4l_timedwait_sync(a4l_sync_t * snc, + int rt, unsigned long long ns_timeout); +void a4l_signal_sync(a4l_sync_t * snc); /* --- Misc section --- */ -#define comedi_test_rt() rtdm_in_rt_context() +#define a4l_test_rt() rtdm_in_rt_context() #endif /* __KERNEL__ && !DOXYGEN_CPP */ -#endif /* __COMEDI_OS_FACILITIES__ */ +#endif /* __ANALOGY_OS_FACILITIES__ */ diff --git a/include/analogy/subdevice.h b/include/analogy/subdevice.h index 1a921d0..1c3bcd4 100644 --- a/include/analogy/subdevice.h +++ b/include/analogy/subdevice.h @@ -1,6 +1,6 @@ /** * @file - * Comedi for RTDM, subdevice related features + * Analogy for Linux, subdevice related features * * Copyright (C) 1997-2000 David A. Schleef <d...@schleef.org> * Copyright (C) 2008 Alexis Berlemont <alexis.berlem...@free.fr> @@ -20,28 +20,28 @@ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __COMEDI_SUBDEVICE__ -#define __COMEDI_SUBDEVICE__ +#ifndef __ANALOGY_SUBDEVICE__ +#define __ANALOGY_SUBDEVICE__ #ifdef __KERNEL__ #include <linux/list.h> #endif /* __KERNEL__ */ -#include <comedi/types.h> -#include <comedi/context.h> -#include <comedi/instruction.h> -#include <comedi/command.h> -#include <comedi/channel_range.h> +#include <analogy/types.h> +#include <analogy/context.h> +#include <analogy/instruction.h> +#include <analogy/command.h> +#include <analogy/channel_range.h> /* --- Subdevice flags desc stuff --- */ -/* TODO: replace COMEDI_SUBD_AI with COMEDI_SUBD_ANALOG - and COMEDI_SUBD_INPUT */ +/* TODO: replace ANALOGY_SUBD_AI with ANALOGY_SUBD_ANALOG + and ANALOGY_SUBD_INPUT */ /* Subdevice types masks */ -#define COMEDI_SUBD_MASK_READ 0x80000000 -#define COMEDI_SUBD_MASK_WRITE 0x40000000 -#define COMEDI_SUBD_MASK_SPECIAL 0x20000000 +#define A4L_SUBD_MASK_READ 0x80000000 +#define A4L_SUBD_MASK_WRITE 0x40000000 +#define A4L_SUBD_MASK_SPECIAL 0x20000000 /*! * @addtogroup subdevice @@ -49,7 +49,7 @@ */ /*! - * @anchor COMEDI_SUBD_xxx @name Subdevices types + * @anchor ANALOGY_SUBD_xxx @name Subdevices types * @brief Flags to define the subdevice type * @{ */ @@ -57,71 +57,71 @@ /** * Unused subdevice */ -#define COMEDI_SUBD_UNUSED (COMEDI_SUBD_MASK_SPECIAL|0x1) +#define A4L_SUBD_UNUSED (A4L_SUBD_MASK_SPECIAL|0x1) /** * Analog input subdevice */ -#define COMEDI_SUBD_AI (COMEDI_SUBD_MASK_READ|0x2) +#define A4L_SUBD_AI (A4L_SUBD_MASK_READ|0x2) /** * Analog output subdevice */ -#define COMEDI_SUBD_AO (COMEDI_SUBD_MASK_WRITE|0x4) +#define A4L_SUBD_AO (A4L_SUBD_MASK_WRITE|0x4) /** * Digital input subdevice */ -#define COMEDI_SUBD_DI (COMEDI_SUBD_MASK_READ|0x8) +#define A4L_SUBD_DI (A4L_SUBD_MASK_READ|0x8) /** * Digital output subdevice */ -#define COMEDI_SUBD_DO (COMEDI_SUBD_MASK_WRITE|0x10) +#define A4L_SUBD_DO (A4L_SUBD_MASK_WRITE|0x10) /** * Digital input/output subdevice */ -#define COMEDI_SUBD_DIO (COMEDI_SUBD_MASK_SPECIAL|0x20) +#define A4L_SUBD_DIO (A4L_SUBD_MASK_SPECIAL|0x20) /** * Counter subdevice */ -#define COMEDI_SUBD_COUNTER (COMEDI_SUBD_MASK_SPECIAL|0x40) +#define A4L_SUBD_COUNTER (A4L_SUBD_MASK_SPECIAL|0x40) /** * Timer subdevice */ -#define COMEDI_SUBD_TIMER (COMEDI_SUBD_MASK_SPECIAL|0x80) +#define A4L_SUBD_TIMER (A4L_SUBD_MASK_SPECIAL|0x80) /** * Memory, EEPROM, DPRAM */ -#define COMEDI_SUBD_MEMORY (COMEDI_SUBD_MASK_SPECIAL|0x100) +#define A4L_SUBD_MEMORY (A4L_SUBD_MASK_SPECIAL|0x100) /** * Calibration subdevice DACs */ -#define COMEDI_SUBD_CALIB (COMEDI_SUBD_MASK_SPECIAL|0x200) +#define A4L_SUBD_CALIB (A4L_SUBD_MASK_SPECIAL|0x200) /** * Processor, DSP */ -#define COMEDI_SUBD_PROC (COMEDI_SUBD_MASK_SPECIAL|0x400) +#define A4L_SUBD_PROC (A4L_SUBD_MASK_SPECIAL|0x400) /** * Serial IO subdevice */ -#define COMEDI_SUBD_SERIAL (COMEDI_SUBD_MASK_SPECIAL|0x800) +#define A4L_SUBD_SERIAL (A4L_SUBD_MASK_SPECIAL|0x800) /** * Mask which gathers all the types */ -#define COMEDI_SUBD_TYPES (COMEDI_SUBD_UNUSED | \ - COMEDI_SUBD_AI | \ - COMEDI_SUBD_AO | \ - COMEDI_SUBD_DI | \ - COMEDI_SUBD_DO | \ - COMEDI_SUBD_DIO | \ - COMEDI_SUBD_COUNTER | \ - COMEDI_SUBD_TIMER | \ - COMEDI_SUBD_MEMORY | \ - COMEDI_SUBD_CALIB | \ - COMEDI_SUBD_PROC | \ - COMEDI_SUBD_SERIAL) - - /*! @} COMEDI_SUBD_xxx */ +#define A4L_SUBD_TYPES (A4L_SUBD_UNUSED | \ + A4L_SUBD_AI | \ + A4L_SUBD_AO | \ + A4L_SUBD_DI | \ + A4L_SUBD_DO | \ + A4L_SUBD_DIO | \ + A4L_SUBD_COUNTER | \ + A4L_SUBD_TIMER | \ + A4L_SUBD_MEMORY | \ + A4L_SUBD_CALIB | \ + A4L_SUBD_PROC | \ + A4L_SUBD_SERIAL) + + /*! @} ANALOGY_SUBD_xxx */ /*! - * @anchor COMEDI_SUBD_FT_xxx @name Subdevice features + * @anchor ANALOGY_SUBD_FT_xxx @name Subdevice features * @brief Flags to define the subdevice's capabilities * @{ */ @@ -131,34 +131,34 @@ * The subdevice can handle command (i.e it can perform asynchronous * acquisition) */ -#define COMEDI_SUBD_CMD 0x1000 +#define A4L_SUBD_CMD 0x1000 /** * The subdevice support mmap operations (technically, any driver can * do it; however, the developer might want that his driver must be * accessed through read / write */ -#define COMEDI_SUBD_MMAP 0x8000 +#define A4L_SUBD_MMAP 0x8000 - /*! @} COMEDI_SUBD_FT_xxx */ + /*! @} ANALOGY_SUBD_FT_xxx */ #ifdef __KERNEL__ /* --- Subdevice descriptor structure --- */ -struct comedi_device; -struct comedi_driver; +struct a4l_device; +struct a4l_driver; /*! * @brief Structure describing the subdevice - * @see comedi_add_subd() + * @see a4l_add_subd() */ -struct comedi_subdevice { +struct a4l_subdevice { struct list_head list; /**< List stuff */ - struct comedi_device *dev; + struct a4l_device *dev; /**< Containing device */ unsigned int idx; /**< Subdevice index */ @@ -166,37 +166,37 @@ struct comedi_subdevice { /* Descriptors stuff */ unsigned long flags; /**< Type flags */ - comedi_chdesc_t *chan_desc; + a4l_chdesc_t *chan_desc; /**< Tab of channels descriptors pointers */ - comedi_rngdesc_t *rng_desc; + a4l_rngdesc_t *rng_desc; /**< Tab of ranges descriptors pointers */ - comedi_cmd_t *cmd_mask; + a4l_cmd_t *cmd_mask; /**< Command capabilities mask */ /* Functions stuff */ - int (*insn_read) (struct comedi_subdevice *, comedi_kinsn_t *); + int (*insn_read) (struct a4l_subdevice *, a4l_kinsn_t *); /**< Callback for the instruction "read" */ - int (*insn_write) (struct comedi_subdevice *, comedi_kinsn_t *); + int (*insn_write) (struct a4l_subdevice *, a4l_kinsn_t *); /**< Callback for the instruction "write" */ - int (*insn_bits) (struct comedi_subdevice *, comedi_kinsn_t *); + int (*insn_bits) (struct a4l_subdevice *, a4l_kinsn_t *); /**< Callback for the instruction "bits" */ - int (*insn_config) (struct comedi_subdevice *, comedi_kinsn_t *); + int (*insn_config) (struct a4l_subdevice *, a4l_kinsn_t *); /**< Callback for the configuration instruction */ - int (*do_cmd) (struct comedi_subdevice *, comedi_cmd_t *); + int (*do_cmd) (struct a4l_subdevice *, a4l_cmd_t *); /**< Callback for command handling */ - int (*do_cmdtest) (struct comedi_subdevice *, comedi_cmd_t *); + int (*do_cmdtest) (struct a4l_subdevice *, a4l_cmd_t *); /**< Callback for command checking */ - int (*cancel) (struct comedi_subdevice *); + int (*cancel) (struct a4l_subdevice *); /**< Callback for asynchronous transfer cancellation */ - void (*munge) (struct comedi_subdevice *, void *, unsigned long); + void (*munge) (struct a4l_subdevice *, void *, unsigned long); /**< Callback for munge operation */ - int (*trigger) (struct comedi_subdevice *, lsampl_t); + int (*trigger) (struct a4l_subdevice *, lsampl_t); /**< Callback for trigger operation */ char priv[0]; /**< Private data */ }; -typedef struct comedi_subdevice comedi_subd_t; +typedef struct a4l_subdevice a4l_subd_t; #endif /* __KERNEL__ */ @@ -207,65 +207,65 @@ typedef struct comedi_subdevice comedi_subd_t; /* --- Subdevice related IOCTL arguments structures --- */ /* SUDBINFO IOCTL argument */ -struct comedi_subd_info { +struct a4l_subd_info { unsigned long flags; unsigned long status; unsigned char nb_chan; }; -typedef struct comedi_subd_info comedi_sbinfo_t; +typedef struct a4l_subd_info a4l_sbinfo_t; /* CHANINFO / NBCHANINFO IOCTL arguments */ -struct comedi_chan_info { +struct a4l_chan_info { unsigned long chan_flags; unsigned char nb_rng; unsigned char nb_bits; }; -typedef struct comedi_chan_info comedi_chinfo_t; +typedef struct a4l_chan_info a4l_chinfo_t; -struct comedi_chinfo_arg { +struct a4l_chinfo_arg { unsigned int idx_subd; void *info; }; -typedef struct comedi_chinfo_arg comedi_chinfo_arg_t; +typedef struct a4l_chinfo_arg a4l_chinfo_arg_t; /* RNGINFO / NBRNGINFO IOCTL arguments */ -struct comedi_rng_info { +struct a4l_rng_info { long min; long max; unsigned long flags; }; -typedef struct comedi_rng_info comedi_rnginfo_t; +typedef struct a4l_rng_info a4l_rnginfo_t; -struct comedi_rng_info_arg { +struct a4l_rng_info_arg { unsigned int idx_subd; unsigned int idx_chan; void *info; }; -typedef struct comedi_rng_info_arg comedi_rnginfo_arg_t; +typedef struct a4l_rng_info_arg a4l_rnginfo_arg_t; #ifdef __KERNEL__ /* --- Subdevice related functions --- */ -comedi_chan_t *comedi_get_chfeat(comedi_subd_t * sb, int idx); -comedi_rng_t *comedi_get_rngfeat(comedi_subd_t * sb, +a4l_chan_t *a4l_get_chfeat(a4l_subd_t * sb, int idx); +a4l_rng_t *a4l_get_rngfeat(a4l_subd_t * sb, int chidx, int rngidx); -int comedi_check_chanlist(comedi_subd_t * subd, - unsigned char nb_chan, unsigned int *chans); +int a4l_check_chanlist(a4l_subd_t * subd, + unsigned char nb_chan, unsigned int *chans); /* --- Upper layer functions --- */ -comedi_subd_t * comedi_get_subd(struct comedi_device *dev, int idx); -comedi_subd_t * comedi_alloc_subd(int sizeof_priv, - void (*setup)(comedi_subd_t *)); -int comedi_add_subd(struct comedi_device *dev, comedi_subd_t * subd); -int comedi_ioctl_subdinfo(comedi_cxt_t * cxt, void *arg); -int comedi_ioctl_chaninfo(comedi_cxt_t * cxt, void *arg); -int comedi_ioctl_rnginfo(comedi_cxt_t * cxt, void *arg); -int comedi_ioctl_nbchaninfo(comedi_cxt_t * cxt, void *arg); -int comedi_ioctl_nbrnginfo(comedi_cxt_t * cxt, void *arg); +a4l_subd_t * a4l_get_subd(struct a4l_device *dev, int idx); +a4l_subd_t * a4l_alloc_subd(int sizeof_priv, + void (*setup)(a4l_subd_t *)); +int a4l_add_subd(struct a4l_device *dev, a4l_subd_t * subd); +int a4l_ioctl_subdinfo(a4l_cxt_t * cxt, void *arg); +int a4l_ioctl_chaninfo(a4l_cxt_t * cxt, void *arg); +int a4l_ioctl_rnginfo(a4l_cxt_t * cxt, void *arg); +int a4l_ioctl_nbchaninfo(a4l_cxt_t * cxt, void *arg); +int a4l_ioctl_nbrnginfo(a4l_cxt_t * cxt, void *arg); #endif /* __KERNEL__ */ #endif /* !DOXYGEN_CPP */ -#endif /* __COMEDI_SUBDEVICE__ */ +#endif /* __ANALOGY_SUBDEVICE__ */ diff --git a/include/analogy/transfer.h b/include/analogy/transfer.h index d0d5d04..e50d574 100644 --- a/include/analogy/transfer.h +++ b/include/analogy/transfer.h @@ -1,6 +1,6 @@ /** * @file - * Comedi for RTDM, transfer related features + * Analogy for Linux, transfer related features * * Copyright (C) 1997-2000 David A. Schleef <d...@schleef.org> * Copyright (C) 2008 Alexis Berlemont <alexis.berlem...@free.fr> @@ -20,86 +20,86 @@ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __COMEDI_TRANSFER__ -#define __COMEDI_TRANSFER__ +#ifndef __ANALOGY_TRANSFER__ +#define __ANALOGY_TRANSFER__ #ifndef DOXYGEN_CPP -#include <comedi/context.h> -#include <comedi/subdevice.h> -#include <comedi/buffer.h> +#include <analogy/context.h> +#include <analogy/subdevice.h> +#include <analogy/buffer.h> /* Status flags / bits */ -#define COMEDI_TSF_BUSY 0 -#define COMEDI_TSF_BULK 1 -#define COMEDI_TSF_MMAP 2 +#define A4L_TSF_BUSY 0 +#define A4L_TSF_BULK 1 +#define A4L_TSF_MMAP 2 /* Fields init values */ -#define COMEDI_IRQ_UNUSED (unsigned int)((unsigned short)(~0)) -#define COMEDI_IDX_UNUSED (unsigned int)(~0) +#define A4L_IRQ_UNUSED (unsigned int)((unsigned short)(~0)) +#define A4L_IDX_UNUSED (unsigned int)(~0) /* IRQ types */ -#define COMEDI_IRQ_SHARED RTDM_IRQTYPE_SHARED -#define COMEDI_IRQ_EDGE RTDM_IRQTYPE_EDGE -#define COMEDI_IRQ_DISABLED 0 +#define A4L_IRQ_SHARED RTDM_IRQTYPE_SHARED +#define A4L_IRQ_EDGE RTDM_IRQTYPE_EDGE +#define A4L_IRQ_DISABLED 0 /* Poll timeout values */ -#define COMEDI_INFINITE 0 -#define COMEDI_NONBLOCK (-1) +#define A4L_INFINITE 0 +#define A4L_NONBLOCK (-1) #ifdef __KERNEL__ -struct comedi_device; +struct a4l_device; -/* Comedi transfer descriptor */ -struct comedi_transfer { +/* Analogy transfer descriptor */ +struct a4l_transfer { /* Subdevices desc */ unsigned int nb_subd; - comedi_subd_t **subds; + a4l_subd_t **subds; int idx_read_subd; int idx_write_subd; /* Buffer desc */ - comedi_buf_t **bufs; + a4l_buf_t **bufs; /* IRQ in use */ - comedi_irq_desc_t irq_desc; + a4l_irq_desc_t irq_desc; /* Events/status desc */ unsigned long *status; }; -typedef struct comedi_transfer comedi_trf_t; +typedef struct a4l_transfer a4l_trf_t; /* --- Proc function --- */ -int comedi_rdproc_transfer(char *page, - char **start, - off_t off, int count, int *eof, void *data); +int a4l_rdproc_transfer(char *page, + char **start, + off_t off, int count, int *eof, void *data); /* --- Upper layer functions --- */ -void comedi_presetup_transfer(comedi_cxt_t * cxt); -int comedi_setup_transfer(comedi_cxt_t * cxt); -int comedi_cleanup_transfer(comedi_cxt_t * cxt); -int comedi_reserve_transfer(comedi_cxt_t * cxt, int idx_subd); -int comedi_init_transfer(comedi_cxt_t * cxt, comedi_cmd_t * cmd); -int comedi_cancel_transfer(comedi_cxt_t * cxt, int idx_subd); +void a4l_presetup_transfer(a4l_cxt_t * cxt); +int a4l_setup_transfer(a4l_cxt_t * cxt); +int a4l_cleanup_transfer(a4l_cxt_t * cxt); +int a4l_reserve_transfer(a4l_cxt_t * cxt, int idx_subd); +int a4l_init_transfer(a4l_cxt_t * cxt, a4l_cmd_t * cmd); +int a4l_cancel_transfer(a4l_cxt_t * cxt, int idx_subd); -ssize_t comedi_put(comedi_cxt_t * cxt, void *buf, size_t nbytes); -ssize_t comedi_get(comedi_cxt_t * cxt, void *buf, size_t nbytes); +ssize_t a4l_put(a4l_cxt_t * cxt, void *buf, size_t nbytes); +ssize_t a4l_get(a4l_cxt_t * cxt, void *buf, size_t nbytes); -int comedi_request_irq(struct comedi_device *dev, - unsigned int irq, - comedi_irq_hdlr_t handler, - unsigned long flags, void *cookie); -int comedi_free_irq(struct comedi_device *dev, unsigned int irq); -unsigned int comedi_get_irq(struct comedi_device *dev); +int a4l_request_irq(struct a4l_device *dev, + unsigned int irq, + a4l_irq_hdlr_t handler, + unsigned long flags, void *cookie); +int a4l_free_irq(struct a4l_device *dev, unsigned int irq); +unsigned int a4l_get_irq(struct a4l_device *dev); -int comedi_ioctl_cancel(comedi_cxt_t * cxt, void *arg); +int a4l_ioctl_cancel(a4l_cxt_t * cxt, void *arg); #endif /* __KERNEL__ */ #endif /* !DOXYGEN_CPP */ -#endif /* __COMEDI_TRANSFER__ */ +#endif /* __ANALOGY_TRANSFER__ */ diff --git a/include/analogy/types.h b/include/analogy/types.h index 764d1ef..eec4ad0 100644 --- a/include/analogy/types.h +++ b/include/analogy/types.h @@ -1,6 +1,6 @@ /** * @file - * Comedi for RTDM, misc declarations + * Analogy for Linux, misc declarations * * Copyright (C) 1997-2000 David A. Schleef <d...@schleef.org> * Copyright (C) 2008 Alexis Berlemont <alexis.berlem...@free.fr> @@ -20,21 +20,21 @@ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __COMEDI_TYPES__ -#define __COMEDI_TYPES__ +#ifndef __ANALOGY_TYPES__ +#define __ANALOGY_TYPES__ #ifndef DOXYGEN_CPP /* --- Misc precompilation constants --- */ -#define COMEDI_DEFAULT_BFSIZE 0x1000 -#define COMEDI_NAMELEN 20 +#define A4L_DEFAULT_BFSIZE 0x1000 +#define A4L_NAMELEN 20 -/* --- Common Comedi types --- */ +/* --- Common Analogy types --- */ typedef unsigned short sampl_t; typedef unsigned long lsampl_t; #endif /* !DOXYGEN_CPP */ -#endif /* __COMEDI_TYPES__ */ +#endif /* __ANALOGY_TYPES__ */ _______________________________________________ Xenomai-git mailing list Xenomai-git@gna.org https://mail.gna.org/listinfo/xenomai-git