Staging: comedi: fix up a lot of checkpatch.pl warnings
Only clean up some of the easier ones in the .h files Cc: Ian Abbott <abbotti@mev.co.uk> Cc: Frank Mori Hess <fmhess@users.sourceforge.net> Cc: David Schleef <ds@schleef.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
ed9eccbe89
commit
e0dcef71f6
7 changed files with 703 additions and 671 deletions
File diff suppressed because it is too large
Load diff
|
@ -36,8 +36,8 @@
|
||||||
|
|
||||||
extern long comedi_compat_ioctl(struct file *file, unsigned int cmd,
|
extern long comedi_compat_ioctl(struct file *file, unsigned int cmd,
|
||||||
unsigned long arg);
|
unsigned long arg);
|
||||||
#define comedi_register_ioctl32() do{}while(0)
|
#define comedi_register_ioctl32() do {} while (0)
|
||||||
#define comedi_unregister_ioctl32() do{}while(0)
|
#define comedi_unregister_ioctl32() do {} while (0)
|
||||||
|
|
||||||
#else /* HAVE_COMPAT_IOCTL */
|
#else /* HAVE_COMPAT_IOCTL */
|
||||||
|
|
||||||
|
@ -50,8 +50,8 @@ extern void comedi_unregister_ioctl32(void);
|
||||||
#else /* CONFIG_COMPAT */
|
#else /* CONFIG_COMPAT */
|
||||||
|
|
||||||
#define comedi_compat_ioctl 0 /* NULL */
|
#define comedi_compat_ioctl 0 /* NULL */
|
||||||
#define comedi_register_ioctl32() do{}while(0)
|
#define comedi_register_ioctl32() do {} while (0)
|
||||||
#define comedi_unregister_ioctl32() do{}while(0)
|
#define comedi_unregister_ioctl32() do {} while (0)
|
||||||
|
|
||||||
#endif /* CONFIG_COMPAT */
|
#endif /* CONFIG_COMPAT */
|
||||||
|
|
||||||
|
|
|
@ -5,4 +5,4 @@
|
||||||
extern struct class *comedi_class;
|
extern struct class *comedi_class;
|
||||||
extern const struct file_operations comedi_fops;
|
extern const struct file_operations comedi_fops;
|
||||||
|
|
||||||
#endif //_COMEDI_FOPS_H
|
#endif /* _COMEDI_FOPS_H */
|
||||||
|
|
|
@ -45,13 +45,13 @@
|
||||||
#ifdef CONFIG_COMEDI_RTL
|
#ifdef CONFIG_COMEDI_RTL
|
||||||
#include <rtl_core.h>
|
#include <rtl_core.h>
|
||||||
#include <rtl_time.h>
|
#include <rtl_time.h>
|
||||||
//#ifdef RTLINUX_VERSION_CODE
|
/* #ifdef RTLINUX_VERSION_CODE */
|
||||||
#include <rtl_sync.h>
|
#include <rtl_sync.h>
|
||||||
//#endif
|
/* #endif */
|
||||||
#define rt_printk rtl_printf
|
#define rt_printk rtl_printf
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_COMEDI_FUSION
|
#ifdef CONFIG_COMEDI_FUSION
|
||||||
#define rt_printk(format, args...) printk(format , ## args )
|
#define rt_printk(format, args...) printk(format , ## args)
|
||||||
#endif /* CONFIG_COMEDI_FUSION */
|
#endif /* CONFIG_COMEDI_FUSION */
|
||||||
#ifdef CONFIG_PRIORITY_IRQ
|
#ifdef CONFIG_PRIORITY_IRQ
|
||||||
#define rt_printk printk
|
#define rt_printk printk
|
||||||
|
@ -59,27 +59,27 @@
|
||||||
|
|
||||||
int comedi_request_irq(unsigned int irq, irqreturn_t(*handler) (int,
|
int comedi_request_irq(unsigned int irq, irqreturn_t(*handler) (int,
|
||||||
void *PT_REGS_ARG), unsigned long flags, const char *device,
|
void *PT_REGS_ARG), unsigned long flags, const char *device,
|
||||||
comedi_device * dev_id);
|
comedi_device *dev_id);
|
||||||
void comedi_free_irq(unsigned int irq, comedi_device * dev_id);
|
void comedi_free_irq(unsigned int irq, comedi_device *dev_id);
|
||||||
void comedi_rt_init(void);
|
void comedi_rt_init(void);
|
||||||
void comedi_rt_cleanup(void);
|
void comedi_rt_cleanup(void);
|
||||||
int comedi_switch_to_rt(comedi_device * dev);
|
int comedi_switch_to_rt(comedi_device *dev);
|
||||||
void comedi_switch_to_non_rt(comedi_device * dev);
|
void comedi_switch_to_non_rt(comedi_device *dev);
|
||||||
void comedi_rt_pend_wakeup(wait_queue_head_t * q);
|
void comedi_rt_pend_wakeup(wait_queue_head_t *q);
|
||||||
extern int rt_pend_call(void (*func) (int arg1, void *arg2), int arg1,
|
extern int rt_pend_call(void (*func) (int arg1, void *arg2), int arg1,
|
||||||
void *arg2);
|
void *arg2);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define comedi_request_irq(a,b,c,d,e) request_irq(a,b,c,d,e)
|
#define comedi_request_irq(a, b, c, d, e) request_irq(a, b, c, d, e)
|
||||||
#define comedi_free_irq(a,b) free_irq(a,b)
|
#define comedi_free_irq(a, b) free_irq(a, b)
|
||||||
#define comedi_rt_init() do{}while(0)
|
#define comedi_rt_init() do {} while (0)
|
||||||
#define comedi_rt_cleanup() do{}while(0)
|
#define comedi_rt_cleanup() do {} while (0)
|
||||||
#define comedi_switch_to_rt(a) (-1)
|
#define comedi_switch_to_rt(a) (-1)
|
||||||
#define comedi_switch_to_non_rt(a) do{}while(0)
|
#define comedi_switch_to_non_rt(a) do {} while (0)
|
||||||
#define comedi_rt_pend_wakeup(a) do{}while(0)
|
#define comedi_rt_pend_wakeup(a) do {} while (0)
|
||||||
|
|
||||||
#define rt_printk(format,args...) printk(format,##args)
|
#define rt_printk(format, args...) printk(format, ##args)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ extern int rt_pend_call(void (*func) (int arg1, void *arg2), int arg1,
|
||||||
#define comedi_spin_lock_irqsave(lock_ptr, flags) \
|
#define comedi_spin_lock_irqsave(lock_ptr, flags) \
|
||||||
(flags = __comedi_spin_lock_irqsave(lock_ptr))
|
(flags = __comedi_spin_lock_irqsave(lock_ptr))
|
||||||
|
|
||||||
static inline unsigned long __comedi_spin_lock_irqsave(spinlock_t * lock_ptr)
|
static inline unsigned long __comedi_spin_lock_irqsave(spinlock_t *lock_ptr)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ static inline unsigned long __comedi_spin_lock_irqsave(spinlock_t * lock_ptr)
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void comedi_spin_unlock_irqrestore(spinlock_t * lock_ptr,
|
static inline void comedi_spin_unlock_irqrestore(spinlock_t *lock_ptr,
|
||||||
unsigned long flags)
|
unsigned long flags)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -39,17 +39,18 @@
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/dma-mapping.h>
|
#include <linux/dma-mapping.h>
|
||||||
#include <asm/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
#include <asm/io.h>
|
#include <linux/io.h>
|
||||||
|
|
||||||
#include "comedi.h"
|
#include "comedi.h"
|
||||||
|
|
||||||
#define DPRINTK(format, args...) do{ \
|
#define DPRINTK(format, args...) do { \
|
||||||
if(comedi_debug)printk("comedi: " format , ## args ); \
|
if (comedi_debug) \
|
||||||
} while(0)
|
printk(KERN_DEBUG "comedi: " format , ## args); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#define COMEDI_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
|
#define COMEDI_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
|
||||||
#define COMEDI_VERSION_CODE COMEDI_VERSION(COMEDI_MAJORVERSION,COMEDI_MINORVERSION,COMEDI_MICROVERSION)
|
#define COMEDI_VERSION_CODE COMEDI_VERSION(COMEDI_MAJORVERSION, COMEDI_MINORVERSION, COMEDI_MICROVERSION)
|
||||||
#define COMEDI_RELEASE VERSION
|
#define COMEDI_RELEASE VERSION
|
||||||
|
|
||||||
#define COMEDI_INITCLEANUP_NOMODULE(x) \
|
#define COMEDI_INITCLEANUP_NOMODULE(x) \
|
||||||
|
@ -82,21 +83,22 @@
|
||||||
static struct pci_driver comedi_driver ## _pci_driver = \
|
static struct pci_driver comedi_driver ## _pci_driver = \
|
||||||
{ \
|
{ \
|
||||||
.id_table = pci_id_table, \
|
.id_table = pci_id_table, \
|
||||||
.probe = & comedi_driver ## _pci_probe, \
|
.probe = &comedi_driver ## _pci_probe, \
|
||||||
.remove = __devexit_p(& comedi_driver ## _pci_remove) \
|
.remove = __devexit_p(&comedi_driver ## _pci_remove) \
|
||||||
}; \
|
}; \
|
||||||
static int __init comedi_driver ## _init_module(void) \
|
static int __init comedi_driver ## _init_module(void) \
|
||||||
{ \
|
{ \
|
||||||
int retval; \
|
int retval; \
|
||||||
retval = comedi_driver_register(& comedi_driver); \
|
retval = comedi_driver_register(&comedi_driver); \
|
||||||
if(retval < 0) return retval; \
|
if (retval < 0) \
|
||||||
comedi_driver ## _pci_driver.name = (char*)comedi_driver.driver_name; \
|
return retval; \
|
||||||
return pci_register_driver(& comedi_driver ## _pci_driver); \
|
comedi_driver ## _pci_driver.name = (char *)comedi_driver.driver_name; \
|
||||||
|
return pci_register_driver(&comedi_driver ## _pci_driver); \
|
||||||
} \
|
} \
|
||||||
static void __exit comedi_driver ## _cleanup_module(void) \
|
static void __exit comedi_driver ## _cleanup_module(void) \
|
||||||
{ \
|
{ \
|
||||||
pci_unregister_driver(& comedi_driver ## _pci_driver); \
|
pci_unregister_driver(&comedi_driver ## _pci_driver); \
|
||||||
comedi_driver_unregister(& comedi_driver); \
|
comedi_driver_unregister(&comedi_driver); \
|
||||||
} \
|
} \
|
||||||
module_init(comedi_driver ## _init_module); \
|
module_init(comedi_driver ## _init_module); \
|
||||||
module_exit(comedi_driver ## _cleanup_module);
|
module_exit(comedi_driver ## _cleanup_module);
|
||||||
|
@ -177,14 +179,14 @@ struct comedi_subdevice_struct {
|
||||||
int (*do_cmdtest) (comedi_device *, comedi_subdevice *, comedi_cmd *);
|
int (*do_cmdtest) (comedi_device *, comedi_subdevice *, comedi_cmd *);
|
||||||
int (*poll) (comedi_device *, comedi_subdevice *);
|
int (*poll) (comedi_device *, comedi_subdevice *);
|
||||||
int (*cancel) (comedi_device *, comedi_subdevice *);
|
int (*cancel) (comedi_device *, comedi_subdevice *);
|
||||||
//int (*do_lock)(comedi_device *,comedi_subdevice *);
|
/* int (*do_lock)(comedi_device *,comedi_subdevice *); */
|
||||||
//int (*do_unlock)(comedi_device *,comedi_subdevice *);
|
/* int (*do_unlock)(comedi_device *,comedi_subdevice *); */
|
||||||
|
|
||||||
/* called when the buffer changes */
|
/* called when the buffer changes */
|
||||||
int (*buf_change) (comedi_device * dev, comedi_subdevice * s,
|
int (*buf_change) (comedi_device *dev, comedi_subdevice *s,
|
||||||
unsigned long new_size);
|
unsigned long new_size);
|
||||||
|
|
||||||
void (*munge) (comedi_device * dev, comedi_subdevice * s, void *data,
|
void (*munge) (comedi_device *dev, comedi_subdevice *s, void *data,
|
||||||
unsigned int num_bytes, unsigned int start_chan_index);
|
unsigned int num_bytes, unsigned int start_chan_index);
|
||||||
enum dma_data_direction async_dma_dir;
|
enum dma_data_direction async_dma_dir;
|
||||||
|
|
||||||
|
@ -234,13 +236,13 @@ struct comedi_async_struct {
|
||||||
|
|
||||||
wait_queue_head_t wait_head;
|
wait_queue_head_t wait_head;
|
||||||
|
|
||||||
// callback stuff
|
/* callback stuff */
|
||||||
unsigned int cb_mask;
|
unsigned int cb_mask;
|
||||||
int (*cb_func) (unsigned int flags, void *);
|
int (*cb_func) (unsigned int flags, void *);
|
||||||
void *cb_arg;
|
void *cb_arg;
|
||||||
|
|
||||||
int (*inttrig) (comedi_device * dev, comedi_subdevice * s,
|
int (*inttrig) (comedi_device *dev, comedi_subdevice *s,
|
||||||
unsigned int x);
|
unsigned int x);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct comedi_driver_struct {
|
struct comedi_driver_struct {
|
||||||
|
@ -265,8 +267,9 @@ struct comedi_device_struct {
|
||||||
|
|
||||||
device_create_result_type *class_dev;
|
device_create_result_type *class_dev;
|
||||||
int minor;
|
int minor;
|
||||||
/* hw_dev is passed to dma_alloc_coherent when allocating async buffers for subdevices
|
/* hw_dev is passed to dma_alloc_coherent when allocating async buffers
|
||||||
that have async_dma_dir set to something other than DMA_NONE */
|
* for subdevices that have async_dma_dir set to something other than
|
||||||
|
* DMA_NONE */
|
||||||
struct device *hw_dev;
|
struct device *hw_dev;
|
||||||
|
|
||||||
const char *board_name;
|
const char *board_name;
|
||||||
|
@ -289,8 +292,8 @@ struct comedi_device_struct {
|
||||||
|
|
||||||
struct fasync_struct *async_queue;
|
struct fasync_struct *async_queue;
|
||||||
|
|
||||||
void (*open) (comedi_device * dev);
|
void (*open) (comedi_device *dev);
|
||||||
void (*close) (comedi_device * dev);
|
void (*close) (comedi_device *dev);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct comedi_device_file_info {
|
struct comedi_device_file_info {
|
||||||
|
@ -302,15 +305,15 @@ struct comedi_device_file_info {
|
||||||
#ifdef CONFIG_COMEDI_DEBUG
|
#ifdef CONFIG_COMEDI_DEBUG
|
||||||
extern int comedi_debug;
|
extern int comedi_debug;
|
||||||
#else
|
#else
|
||||||
static const int comedi_debug = 0;
|
static const int comedi_debug;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* function prototypes
|
* function prototypes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void comedi_event(comedi_device * dev, comedi_subdevice * s);
|
void comedi_event(comedi_device *dev, comedi_subdevice *s);
|
||||||
void comedi_error(const comedi_device * dev, const char *s);
|
void comedi_error(const comedi_device *dev, const char *s);
|
||||||
|
|
||||||
/* we can expand the number of bits used to encode devices/subdevices into
|
/* we can expand the number of bits used to encode devices/subdevices into
|
||||||
the minor number soon, after more distros support > 8 bit minor numbers
|
the minor number soon, after more distros support > 8 bit minor numbers
|
||||||
|
@ -322,24 +325,30 @@ enum comedi_minor_bits {
|
||||||
static const unsigned COMEDI_SUBDEVICE_MINOR_SHIFT = 4;
|
static const unsigned COMEDI_SUBDEVICE_MINOR_SHIFT = 4;
|
||||||
static const unsigned COMEDI_SUBDEVICE_MINOR_OFFSET = 1;
|
static const unsigned COMEDI_SUBDEVICE_MINOR_OFFSET = 1;
|
||||||
|
|
||||||
struct comedi_device_file_info* comedi_get_device_file_info(unsigned minor);
|
struct comedi_device_file_info *comedi_get_device_file_info(unsigned minor);
|
||||||
|
|
||||||
static inline comedi_subdevice* comedi_get_read_subdevice(const struct comedi_device_file_info *info)
|
static inline comedi_subdevice *comedi_get_read_subdevice(
|
||||||
|
const struct comedi_device_file_info *info)
|
||||||
{
|
{
|
||||||
if(info->read_subdevice) return info->read_subdevice;
|
if (info->read_subdevice)
|
||||||
if(info->device == NULL) return NULL;
|
return info->read_subdevice;
|
||||||
|
if (info->device == NULL)
|
||||||
|
return NULL;
|
||||||
return info->device->read_subdev;
|
return info->device->read_subdev;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline comedi_subdevice* comedi_get_write_subdevice(const struct comedi_device_file_info *info)
|
static inline comedi_subdevice *comedi_get_write_subdevice(
|
||||||
|
const struct comedi_device_file_info *info)
|
||||||
{
|
{
|
||||||
if(info->write_subdevice) return info->write_subdevice;
|
if (info->write_subdevice)
|
||||||
if(info->device == NULL) return NULL;
|
return info->write_subdevice;
|
||||||
|
if (info->device == NULL)
|
||||||
|
return NULL;
|
||||||
return info->device->write_subdev;
|
return info->device->write_subdev;
|
||||||
}
|
}
|
||||||
|
|
||||||
void comedi_device_detach(comedi_device * dev);
|
void comedi_device_detach(comedi_device *dev);
|
||||||
int comedi_device_attach(comedi_device * dev, comedi_devconfig * it);
|
int comedi_device_attach(comedi_device *dev, comedi_devconfig *it);
|
||||||
int comedi_driver_register(comedi_driver *);
|
int comedi_driver_register(comedi_driver *);
|
||||||
int comedi_driver_unregister(comedi_driver *);
|
int comedi_driver_unregister(comedi_driver *);
|
||||||
|
|
||||||
|
@ -348,7 +357,7 @@ void cleanup_polling(void);
|
||||||
void start_polling(comedi_device *);
|
void start_polling(comedi_device *);
|
||||||
void stop_polling(comedi_device *);
|
void stop_polling(comedi_device *);
|
||||||
|
|
||||||
int comedi_buf_alloc(comedi_device * dev, comedi_subdevice * s, unsigned long
|
int comedi_buf_alloc(comedi_device *dev, comedi_subdevice *s, unsigned long
|
||||||
new_size);
|
new_size);
|
||||||
|
|
||||||
#ifdef CONFIG_PROC_FS
|
#ifdef CONFIG_PROC_FS
|
||||||
|
@ -367,7 +376,8 @@ static inline void comedi_proc_cleanup(void)
|
||||||
enum subdevice_runflags {
|
enum subdevice_runflags {
|
||||||
SRF_USER = 0x00000001,
|
SRF_USER = 0x00000001,
|
||||||
SRF_RT = 0x00000002,
|
SRF_RT = 0x00000002,
|
||||||
/* indicates an COMEDI_CB_ERROR event has occurred since the last command was started */
|
/* indicates an COMEDI_CB_ERROR event has occurred since the last
|
||||||
|
* command was started */
|
||||||
SRF_ERROR = 0x00000004,
|
SRF_ERROR = 0x00000004,
|
||||||
SRF_RUNNING = 0x08000000
|
SRF_RUNNING = 0x08000000
|
||||||
};
|
};
|
||||||
|
@ -376,22 +386,22 @@ enum subdevice_runflags {
|
||||||
various internal comedi functions
|
various internal comedi functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int do_rangeinfo_ioctl(comedi_device * dev, comedi_rangeinfo * arg);
|
int do_rangeinfo_ioctl(comedi_device *dev, comedi_rangeinfo *arg);
|
||||||
int check_chanlist(comedi_subdevice * s, int n, unsigned int *chanlist);
|
int check_chanlist(comedi_subdevice *s, int n, unsigned int *chanlist);
|
||||||
void comedi_set_subdevice_runflags(comedi_subdevice * s, unsigned mask,
|
void comedi_set_subdevice_runflags(comedi_subdevice *s, unsigned mask,
|
||||||
unsigned bits);
|
unsigned bits);
|
||||||
unsigned comedi_get_subdevice_runflags(comedi_subdevice * s);
|
unsigned comedi_get_subdevice_runflags(comedi_subdevice *s);
|
||||||
int insn_inval(comedi_device * dev, comedi_subdevice * s,
|
int insn_inval(comedi_device *dev, comedi_subdevice *s,
|
||||||
comedi_insn * insn, lsampl_t * data);
|
comedi_insn *insn, lsampl_t *data);
|
||||||
|
|
||||||
/* range stuff */
|
/* range stuff */
|
||||||
|
|
||||||
#define RANGE(a,b) {(a)*1e6,(b)*1e6,0}
|
#define RANGE(a, b) {(a)*1e6, (b)*1e6, 0}
|
||||||
#define RANGE_ext(a,b) {(a)*1e6,(b)*1e6,RF_EXTERNAL}
|
#define RANGE_ext(a, b) {(a)*1e6, (b)*1e6, RF_EXTERNAL}
|
||||||
#define RANGE_mA(a,b) {(a)*1e6,(b)*1e6,UNIT_mA}
|
#define RANGE_mA(a, b) {(a)*1e6, (b)*1e6, UNIT_mA}
|
||||||
#define RANGE_unitless(a,b) {(a)*1e6,(b)*1e6,0} /* XXX */
|
#define RANGE_unitless(a, b) {(a)*1e6, (b)*1e6, 0} /* XXX */
|
||||||
#define BIP_RANGE(a) {-(a)*1e6,(a)*1e6,0}
|
#define BIP_RANGE(a) {-(a)*1e6, (a)*1e6, 0}
|
||||||
#define UNI_RANGE(a) {0,(a)*1e6,0}
|
#define UNI_RANGE(a) {0, (a)*1e6, 0}
|
||||||
|
|
||||||
extern const comedi_lrange range_bipolar10;
|
extern const comedi_lrange range_bipolar10;
|
||||||
extern const comedi_lrange range_bipolar5;
|
extern const comedi_lrange range_bipolar5;
|
||||||
|
@ -415,8 +425,8 @@ struct comedi_lrange_struct {
|
||||||
|
|
||||||
/* some silly little inline functions */
|
/* some silly little inline functions */
|
||||||
|
|
||||||
static inline int alloc_subdevices(comedi_device * dev,
|
static inline int alloc_subdevices(comedi_device *dev,
|
||||||
unsigned int num_subdevices)
|
unsigned int num_subdevices)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
|
@ -434,7 +444,7 @@ static inline int alloc_subdevices(comedi_device * dev,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int alloc_private(comedi_device * dev, int size)
|
static inline int alloc_private(comedi_device *dev, int size)
|
||||||
{
|
{
|
||||||
dev->private = kzalloc(size, GFP_KERNEL);
|
dev->private = kzalloc(size, GFP_KERNEL);
|
||||||
if (!dev->private)
|
if (!dev->private)
|
||||||
|
@ -442,7 +452,7 @@ static inline int alloc_private(comedi_device * dev, int size)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned int bytes_per_sample(const comedi_subdevice * subd)
|
static inline unsigned int bytes_per_sample(const comedi_subdevice *subd)
|
||||||
{
|
{
|
||||||
if (subd->subdev_flags & SDF_LSAMPL)
|
if (subd->subdev_flags & SDF_LSAMPL)
|
||||||
return sizeof(lsampl_t);
|
return sizeof(lsampl_t);
|
||||||
|
@ -452,11 +462,11 @@ static inline unsigned int bytes_per_sample(const comedi_subdevice * subd)
|
||||||
|
|
||||||
/* must be used in attach to set dev->hw_dev if you wish to dma directly
|
/* must be used in attach to set dev->hw_dev if you wish to dma directly
|
||||||
into comedi's buffer */
|
into comedi's buffer */
|
||||||
static inline void comedi_set_hw_dev(comedi_device * dev, struct device *hw_dev)
|
static inline void comedi_set_hw_dev(comedi_device *dev, struct device *hw_dev)
|
||||||
{
|
{
|
||||||
if (dev->hw_dev) {
|
if (dev->hw_dev)
|
||||||
put_device(dev->hw_dev);
|
put_device(dev->hw_dev);
|
||||||
}
|
|
||||||
dev->hw_dev = hw_dev;
|
dev->hw_dev = hw_dev;
|
||||||
if (dev->hw_dev) {
|
if (dev->hw_dev) {
|
||||||
dev->hw_dev = get_device(dev->hw_dev);
|
dev->hw_dev = get_device(dev->hw_dev);
|
||||||
|
@ -464,31 +474,31 @@ static inline void comedi_set_hw_dev(comedi_device * dev, struct device *hw_dev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int comedi_buf_put(comedi_async * async, sampl_t x);
|
int comedi_buf_put(comedi_async *async, sampl_t x);
|
||||||
int comedi_buf_get(comedi_async * async, sampl_t * x);
|
int comedi_buf_get(comedi_async *async, sampl_t *x);
|
||||||
|
|
||||||
unsigned int comedi_buf_write_n_available(comedi_async * async);
|
unsigned int comedi_buf_write_n_available(comedi_async *async);
|
||||||
unsigned int comedi_buf_write_alloc(comedi_async * async, unsigned int nbytes);
|
unsigned int comedi_buf_write_alloc(comedi_async *async, unsigned int nbytes);
|
||||||
unsigned int comedi_buf_write_alloc_strict(comedi_async * async,
|
unsigned int comedi_buf_write_alloc_strict(comedi_async *async,
|
||||||
unsigned int nbytes);
|
unsigned int nbytes);
|
||||||
unsigned comedi_buf_write_free(comedi_async * async, unsigned int nbytes);
|
unsigned comedi_buf_write_free(comedi_async *async, unsigned int nbytes);
|
||||||
unsigned comedi_buf_read_alloc(comedi_async * async, unsigned nbytes);
|
unsigned comedi_buf_read_alloc(comedi_async *async, unsigned nbytes);
|
||||||
unsigned comedi_buf_read_free(comedi_async * async, unsigned int nbytes);
|
unsigned comedi_buf_read_free(comedi_async *async, unsigned int nbytes);
|
||||||
unsigned int comedi_buf_read_n_available(comedi_async * async);
|
unsigned int comedi_buf_read_n_available(comedi_async *async);
|
||||||
void comedi_buf_memcpy_to(comedi_async * async, unsigned int offset,
|
void comedi_buf_memcpy_to(comedi_async *async, unsigned int offset,
|
||||||
const void *source, unsigned int num_bytes);
|
const void *source, unsigned int num_bytes);
|
||||||
void comedi_buf_memcpy_from(comedi_async * async, unsigned int offset,
|
void comedi_buf_memcpy_from(comedi_async *async, unsigned int offset,
|
||||||
void *destination, unsigned int num_bytes);
|
void *destination, unsigned int num_bytes);
|
||||||
static inline unsigned comedi_buf_write_n_allocated(comedi_async * async)
|
static inline unsigned comedi_buf_write_n_allocated(comedi_async *async)
|
||||||
{
|
{
|
||||||
return async->buf_write_alloc_count - async->buf_write_count;
|
return async->buf_write_alloc_count - async->buf_write_count;
|
||||||
}
|
}
|
||||||
static inline unsigned comedi_buf_read_n_allocated(comedi_async * async)
|
static inline unsigned comedi_buf_read_n_allocated(comedi_async *async)
|
||||||
{
|
{
|
||||||
return async->buf_read_alloc_count - async->buf_read_count;
|
return async->buf_read_alloc_count - async->buf_read_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
void comedi_reset_async_buf(comedi_async * async);
|
void comedi_reset_async_buf(comedi_async *async);
|
||||||
|
|
||||||
static inline void *comedi_aux_data(int options[], int n)
|
static inline void *comedi_aux_data(int options[], int n)
|
||||||
{
|
{
|
||||||
|
@ -522,8 +532,6 @@ void comedi_free_subdevice_minor(comedi_subdevice *s);
|
||||||
int comedi_pci_auto_config(struct pci_dev *pcidev, const char *board_name);
|
int comedi_pci_auto_config(struct pci_dev *pcidev, const char *board_name);
|
||||||
void comedi_pci_auto_unconfig(struct pci_dev *pcidev);
|
void comedi_pci_auto_unconfig(struct pci_dev *pcidev);
|
||||||
|
|
||||||
//#ifdef CONFIG_COMEDI_RT
|
|
||||||
#include "comedi_rt.h"
|
#include "comedi_rt.h"
|
||||||
//#endif
|
|
||||||
|
|
||||||
#endif /* _COMEDIDEV_H */
|
#endif /* _COMEDIDEV_H */
|
||||||
|
|
|
@ -41,13 +41,13 @@ typedef void comedi_t;
|
||||||
/* these functions may not be called at real-time priority */
|
/* these functions may not be called at real-time priority */
|
||||||
|
|
||||||
comedi_t *comedi_open(const char *path);
|
comedi_t *comedi_open(const char *path);
|
||||||
int comedi_close(comedi_t * dev);
|
int comedi_close(comedi_t *dev);
|
||||||
|
|
||||||
/* these functions may be called at any priority, but may fail at
|
/* these functions may be called at any priority, but may fail at
|
||||||
real-time priority */
|
real-time priority */
|
||||||
|
|
||||||
int comedi_lock(comedi_t * dev, unsigned int subdev);
|
int comedi_lock(comedi_t *dev, unsigned int subdev);
|
||||||
int comedi_unlock(comedi_t * dev, unsigned int subdev);
|
int comedi_unlock(comedi_t *dev, unsigned int subdev);
|
||||||
|
|
||||||
/* these functions may be called at any priority, but you must hold
|
/* these functions may be called at any priority, but you must hold
|
||||||
the lock for the subdevice */
|
the lock for the subdevice */
|
||||||
|
@ -56,68 +56,68 @@ int comedi_loglevel(int loglevel);
|
||||||
void comedi_perror(const char *s);
|
void comedi_perror(const char *s);
|
||||||
char *comedi_strerror(int errnum);
|
char *comedi_strerror(int errnum);
|
||||||
int comedi_errno(void);
|
int comedi_errno(void);
|
||||||
int comedi_fileno(comedi_t * dev);
|
int comedi_fileno(comedi_t *dev);
|
||||||
|
|
||||||
int comedi_cancel(comedi_t * dev, unsigned int subdev);
|
int comedi_cancel(comedi_t *dev, unsigned int subdev);
|
||||||
int comedi_register_callback(comedi_t * dev, unsigned int subdev,
|
int comedi_register_callback(comedi_t *dev, unsigned int subdev,
|
||||||
unsigned int mask, int (*cb) (unsigned int, void *), void *arg);
|
unsigned int mask, int (*cb) (unsigned int, void *), void *arg);
|
||||||
|
|
||||||
int comedi_command(comedi_t * dev, comedi_cmd * cmd);
|
int comedi_command(comedi_t *dev, comedi_cmd *cmd);
|
||||||
int comedi_command_test(comedi_t * dev, comedi_cmd * cmd);
|
int comedi_command_test(comedi_t *dev, comedi_cmd *cmd);
|
||||||
int comedi_trigger(comedi_t * dev, unsigned int subdev, comedi_trig * it);
|
int comedi_trigger(comedi_t *dev, unsigned int subdev, comedi_trig *it);
|
||||||
int __comedi_trigger(comedi_t * dev, unsigned int subdev, comedi_trig * it);
|
int __comedi_trigger(comedi_t *dev, unsigned int subdev, comedi_trig *it);
|
||||||
int comedi_data_write(comedi_t * dev, unsigned int subdev, unsigned int chan,
|
int comedi_data_write(comedi_t *dev, unsigned int subdev, unsigned int chan,
|
||||||
unsigned int range, unsigned int aref, lsampl_t data);
|
unsigned int range, unsigned int aref, lsampl_t data);
|
||||||
int comedi_data_read(comedi_t * dev, unsigned int subdev, unsigned int chan,
|
int comedi_data_read(comedi_t *dev, unsigned int subdev, unsigned int chan,
|
||||||
unsigned int range, unsigned int aref, lsampl_t * data);
|
unsigned int range, unsigned int aref, lsampl_t *data);
|
||||||
int comedi_data_read_hint(comedi_t * dev, unsigned int subdev,
|
int comedi_data_read_hint(comedi_t *dev, unsigned int subdev,
|
||||||
unsigned int chan, unsigned int range, unsigned int aref);
|
unsigned int chan, unsigned int range, unsigned int aref);
|
||||||
int comedi_data_read_delayed(comedi_t * dev, unsigned int subdev,
|
int comedi_data_read_delayed(comedi_t *dev, unsigned int subdev,
|
||||||
unsigned int chan, unsigned int range, unsigned int aref,
|
unsigned int chan, unsigned int range, unsigned int aref,
|
||||||
lsampl_t * data, unsigned int nano_sec);
|
lsampl_t *data, unsigned int nano_sec);
|
||||||
int comedi_dio_config(comedi_t * dev, unsigned int subdev, unsigned int chan,
|
int comedi_dio_config(comedi_t *dev, unsigned int subdev, unsigned int chan,
|
||||||
unsigned int io);
|
unsigned int io);
|
||||||
int comedi_dio_read(comedi_t * dev, unsigned int subdev, unsigned int chan,
|
int comedi_dio_read(comedi_t *dev, unsigned int subdev, unsigned int chan,
|
||||||
unsigned int *val);
|
unsigned int *val);
|
||||||
int comedi_dio_write(comedi_t * dev, unsigned int subdev, unsigned int chan,
|
int comedi_dio_write(comedi_t *dev, unsigned int subdev, unsigned int chan,
|
||||||
unsigned int val);
|
unsigned int val);
|
||||||
int comedi_dio_bitfield(comedi_t * dev, unsigned int subdev, unsigned int mask,
|
int comedi_dio_bitfield(comedi_t *dev, unsigned int subdev, unsigned int mask,
|
||||||
unsigned int *bits);
|
unsigned int *bits);
|
||||||
int comedi_get_n_subdevices(comedi_t * dev);
|
int comedi_get_n_subdevices(comedi_t *dev);
|
||||||
int comedi_get_version_code(comedi_t * dev);
|
int comedi_get_version_code(comedi_t *dev);
|
||||||
const char *comedi_get_driver_name(comedi_t * dev);
|
const char *comedi_get_driver_name(comedi_t *dev);
|
||||||
const char *comedi_get_board_name(comedi_t * dev);
|
const char *comedi_get_board_name(comedi_t *dev);
|
||||||
int comedi_get_subdevice_type(comedi_t * dev, unsigned int subdevice);
|
int comedi_get_subdevice_type(comedi_t *dev, unsigned int subdevice);
|
||||||
int comedi_find_subdevice_by_type(comedi_t * dev, int type, unsigned int subd);
|
int comedi_find_subdevice_by_type(comedi_t *dev, int type, unsigned int subd);
|
||||||
int comedi_get_n_channels(comedi_t * dev, unsigned int subdevice);
|
int comedi_get_n_channels(comedi_t *dev, unsigned int subdevice);
|
||||||
lsampl_t comedi_get_maxdata(comedi_t * dev, unsigned int subdevice, unsigned
|
lsampl_t comedi_get_maxdata(comedi_t *dev, unsigned int subdevice, unsigned
|
||||||
int chan);
|
int chan);
|
||||||
int comedi_get_n_ranges(comedi_t * dev, unsigned int subdevice, unsigned int
|
int comedi_get_n_ranges(comedi_t *dev, unsigned int subdevice, unsigned int
|
||||||
chan);
|
chan);
|
||||||
int comedi_do_insn(comedi_t * dev, comedi_insn * insn);
|
int comedi_do_insn(comedi_t *dev, comedi_insn *insn);
|
||||||
int comedi_poll(comedi_t * dev, unsigned int subdev);
|
int comedi_poll(comedi_t *dev, unsigned int subdev);
|
||||||
|
|
||||||
/* DEPRECATED functions */
|
/* DEPRECATED functions */
|
||||||
int comedi_get_rangetype(comedi_t * dev, unsigned int subdevice,
|
int comedi_get_rangetype(comedi_t *dev, unsigned int subdevice,
|
||||||
unsigned int chan);
|
unsigned int chan);
|
||||||
|
|
||||||
/* ALPHA functions */
|
/* ALPHA functions */
|
||||||
unsigned int comedi_get_subdevice_flags(comedi_t * dev, unsigned int subdevice);
|
unsigned int comedi_get_subdevice_flags(comedi_t *dev, unsigned int subdevice);
|
||||||
int comedi_get_len_chanlist(comedi_t * dev, unsigned int subdevice);
|
int comedi_get_len_chanlist(comedi_t *dev, unsigned int subdevice);
|
||||||
int comedi_get_krange(comedi_t * dev, unsigned int subdevice, unsigned int
|
int comedi_get_krange(comedi_t *dev, unsigned int subdevice, unsigned int
|
||||||
chan, unsigned int range, comedi_krange * krange);
|
chan, unsigned int range, comedi_krange *krange);
|
||||||
unsigned int comedi_get_buf_head_pos(comedi_t * dev, unsigned int subdevice);
|
unsigned int comedi_get_buf_head_pos(comedi_t *dev, unsigned int subdevice);
|
||||||
int comedi_set_user_int_count(comedi_t * dev, unsigned int subdevice,
|
int comedi_set_user_int_count(comedi_t *dev, unsigned int subdevice,
|
||||||
unsigned int buf_user_count);
|
unsigned int buf_user_count);
|
||||||
int comedi_map(comedi_t * dev, unsigned int subdev, void *ptr);
|
int comedi_map(comedi_t *dev, unsigned int subdev, void *ptr);
|
||||||
int comedi_unmap(comedi_t * dev, unsigned int subdev);
|
int comedi_unmap(comedi_t *dev, unsigned int subdev);
|
||||||
int comedi_get_buffer_size(comedi_t * dev, unsigned int subdev);
|
int comedi_get_buffer_size(comedi_t *dev, unsigned int subdev);
|
||||||
int comedi_mark_buffer_read(comedi_t * dev, unsigned int subdevice,
|
int comedi_mark_buffer_read(comedi_t *dev, unsigned int subdevice,
|
||||||
unsigned int num_bytes);
|
unsigned int num_bytes);
|
||||||
int comedi_mark_buffer_written(comedi_t * d, unsigned int subdevice,
|
int comedi_mark_buffer_written(comedi_t *d, unsigned int subdevice,
|
||||||
unsigned int num_bytes);
|
unsigned int num_bytes);
|
||||||
int comedi_get_buffer_contents(comedi_t * dev, unsigned int subdevice);
|
int comedi_get_buffer_contents(comedi_t *dev, unsigned int subdevice);
|
||||||
int comedi_get_buffer_offset(comedi_t * dev, unsigned int subdevice);
|
int comedi_get_buffer_offset(comedi_t *dev, unsigned int subdevice);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -139,14 +139,14 @@ int comedi_cancel(unsigned int minor, unsigned int subdev);
|
||||||
int comedi_register_callback(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);
|
unsigned int mask, int (*cb) (unsigned int, void *), void *arg);
|
||||||
|
|
||||||
int comedi_command(unsigned int minor, comedi_cmd * cmd);
|
int comedi_command(unsigned int minor, comedi_cmd *cmd);
|
||||||
int comedi_command_test(unsigned int minor, comedi_cmd * cmd);
|
int comedi_command_test(unsigned int minor, comedi_cmd *cmd);
|
||||||
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_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,
|
int comedi_data_write(unsigned int dev, unsigned int subdev, unsigned int chan,
|
||||||
unsigned int range, unsigned int aref, lsampl_t data);
|
unsigned int range, unsigned int aref, lsampl_t data);
|
||||||
int comedi_data_read(unsigned int dev, unsigned int subdev, unsigned int chan,
|
int comedi_data_read(unsigned int dev, unsigned int subdev, unsigned int chan,
|
||||||
unsigned int range, unsigned int aref, lsampl_t * data);
|
unsigned int range, unsigned int aref, lsampl_t *data);
|
||||||
int comedi_dio_config(unsigned int dev, unsigned int subdev, unsigned int chan,
|
int comedi_dio_config(unsigned int dev, unsigned int subdev, unsigned int chan,
|
||||||
unsigned int io);
|
unsigned int io);
|
||||||
int comedi_dio_read(unsigned int dev, unsigned int subdev, unsigned int chan,
|
int comedi_dio_read(unsigned int dev, unsigned int subdev, unsigned int chan,
|
||||||
|
@ -167,7 +167,7 @@ lsampl_t comedi_get_maxdata(unsigned int minor, unsigned int subdevice, unsigned
|
||||||
int chan);
|
int chan);
|
||||||
int comedi_get_n_ranges(unsigned int minor, unsigned int subdevice, unsigned int
|
int comedi_get_n_ranges(unsigned int minor, unsigned int subdevice, unsigned int
|
||||||
chan);
|
chan);
|
||||||
int comedi_do_insn(unsigned int minor, comedi_insn * insn);
|
int comedi_do_insn(unsigned int minor, comedi_insn *insn);
|
||||||
int comedi_poll(unsigned int minor, unsigned int subdev);
|
int comedi_poll(unsigned int minor, unsigned int subdev);
|
||||||
|
|
||||||
/* DEPRECATED functions */
|
/* DEPRECATED functions */
|
||||||
|
@ -179,7 +179,7 @@ unsigned int comedi_get_subdevice_flags(unsigned int minor, unsigned int
|
||||||
subdevice);
|
subdevice);
|
||||||
int comedi_get_len_chanlist(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
|
int comedi_get_krange(unsigned int minor, unsigned int subdevice, unsigned int
|
||||||
chan, unsigned int range, comedi_krange * krange);
|
chan, unsigned int range, comedi_krange *krange);
|
||||||
unsigned int comedi_get_buf_head_pos(unsigned int minor, unsigned int
|
unsigned int comedi_get_buf_head_pos(unsigned int minor, unsigned int
|
||||||
subdevice);
|
subdevice);
|
||||||
int comedi_set_user_int_count(unsigned int minor, unsigned int subdevice,
|
int comedi_set_user_int_count(unsigned int minor, unsigned int subdevice,
|
||||||
|
|
|
@ -19,13 +19,7 @@
|
||||||
#ifndef __COMPAT_LINUX_WRAPPER_H_
|
#ifndef __COMPAT_LINUX_WRAPPER_H_
|
||||||
#define __COMPAT_LINUX_WRAPPER_H_
|
#define __COMPAT_LINUX_WRAPPER_H_
|
||||||
|
|
||||||
#include <linux/version.h>
|
|
||||||
|
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
|
|
||||||
#define mem_map_reserve(p) set_bit(PG_reserved, &((p)->flags))
|
#define mem_map_reserve(p) set_bit(PG_reserved, &((p)->flags))
|
||||||
#define mem_map_unreserve(p) clear_bit(PG_reserved, &((p)->flags))
|
#define mem_map_unreserve(p) clear_bit(PG_reserved, &((p)->flags))
|
||||||
#else
|
|
||||||
#include_next <linux/wrapper.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __COMPAT_LINUX_WRAPPER_H_ */
|
#endif /* __COMPAT_LINUX_WRAPPER_H_ */
|
||||||
|
|
Loading…
Add table
Reference in a new issue