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:
Greg Kroah-Hartman 2008-11-13 16:36:22 -08:00
parent ed9eccbe89
commit e0dcef71f6
7 changed files with 703 additions and 671 deletions

View file

@ -124,10 +124,10 @@ extern "C" {
#define TRIG_BOGUS 0x0001 /* do the motions */ #define TRIG_BOGUS 0x0001 /* do the motions */
#define TRIG_DITHER 0x0002 /* enable dithering */ #define TRIG_DITHER 0x0002 /* enable dithering */
#define TRIG_DEGLITCH 0x0004 /* enable deglitching */ #define TRIG_DEGLITCH 0x0004 /* enable deglitching */
//#define TRIG_RT 0x0008 /* perform op in real time */ /*#define TRIG_RT 0x0008 */ /* perform op in real time */
#define TRIG_CONFIG 0x0010 /* perform configuration, not triggering */ #define TRIG_CONFIG 0x0010 /* perform configuration, not triggering */
#define TRIG_WAKE_EOS 0x0020 /* wake up on end-of-scan events */ #define TRIG_WAKE_EOS 0x0020 /* wake up on end-of-scan events */
//#define TRIG_WRITE 0x0040 /* write to bidirectional devices */ /*#define TRIG_WRITE 0x0040*/ /* write to bidirectional devices */
/* command flags */ /* command flags */
/* These flags are used in comedi_cmd structures */ /* These flags are used in comedi_cmd structures */
@ -233,9 +233,9 @@ extern "C" {
INSN_CONFIG_DIO_OUTPUT = 1, INSN_CONFIG_DIO_OUTPUT = 1,
INSN_CONFIG_DIO_OPENDRAIN = 2, INSN_CONFIG_DIO_OPENDRAIN = 2,
INSN_CONFIG_ANALOG_TRIG = 16, INSN_CONFIG_ANALOG_TRIG = 16,
// INSN_CONFIG_WAVEFORM = 17, /* INSN_CONFIG_WAVEFORM = 17, */
// INSN_CONFIG_TRIG = 18, /* INSN_CONFIG_TRIG = 18, */
// INSN_CONFIG_COUNTER = 19, /* INSN_CONFIG_COUNTER = 19, */
INSN_CONFIG_ALT_SOURCE = 20, INSN_CONFIG_ALT_SOURCE = 20,
INSN_CONFIG_DIGITAL_TRIG = 21, INSN_CONFIG_DIGITAL_TRIG = 21,
INSN_CONFIG_BLOCK_SIZE = 22, INSN_CONFIG_BLOCK_SIZE = 22,
@ -252,16 +252,19 @@ extern "C" {
INSN_CONFIG_DISARM = 32, INSN_CONFIG_DISARM = 32,
INSN_CONFIG_GET_COUNTER_STATUS = 33, INSN_CONFIG_GET_COUNTER_STATUS = 33,
INSN_CONFIG_RESET = 34, INSN_CONFIG_RESET = 34,
INSN_CONFIG_GPCT_SINGLE_PULSE_GENERATOR = 1001, // Use CTR as single pulsegenerator INSN_CONFIG_GPCT_SINGLE_PULSE_GENERATOR = 1001, /* Use CTR as single pulsegenerator */
INSN_CONFIG_GPCT_PULSE_TRAIN_GENERATOR = 1002, // Use CTR as pulsetraingenerator INSN_CONFIG_GPCT_PULSE_TRAIN_GENERATOR = 1002, /* Use CTR as pulsetraingenerator */
INSN_CONFIG_GPCT_QUADRATURE_ENCODER = 1003, // Use the counter as encoder INSN_CONFIG_GPCT_QUADRATURE_ENCODER = 1003, /* Use the counter as encoder */
INSN_CONFIG_SET_GATE_SRC = 2001, // Set gate source INSN_CONFIG_SET_GATE_SRC = 2001, /* Set gate source */
INSN_CONFIG_GET_GATE_SRC = 2002, // Get gate source INSN_CONFIG_GET_GATE_SRC = 2002, /* Get gate source */
INSN_CONFIG_SET_CLOCK_SRC = 2003, // Set master clock source INSN_CONFIG_SET_CLOCK_SRC = 2003, /* Set master clock source */
INSN_CONFIG_GET_CLOCK_SRC = 2004, // Get master clock source INSN_CONFIG_GET_CLOCK_SRC = 2004, /* Get master clock source */
INSN_CONFIG_SET_OTHER_SRC = 2005, // Set other source INSN_CONFIG_SET_OTHER_SRC = 2005, /* Set other source */
// INSN_CONFIG_GET_OTHER_SRC = 2006, // Get other source /* INSN_CONFIG_GET_OTHER_SRC = 2006,*/ /* Get other source */
INSN_CONFIG_GET_HARDWARE_BUFFER_SIZE, // Get size in bytes of subdevice's on-board fifos used during streaming input/output INSN_CONFIG_GET_HARDWARE_BUFFER_SIZE, /* Get size in bytes of
subdevice's on-board fifos
used during streaming
input/output */
INSN_CONFIG_SET_COUNTER_MODE = 4097, INSN_CONFIG_SET_COUNTER_MODE = 4097,
INSN_CONFIG_8254_SET_MODE = INSN_CONFIG_SET_COUNTER_MODE, /* deprecated */ INSN_CONFIG_8254_SET_MODE = INSN_CONFIG_SET_COUNTER_MODE, /* deprecated */
INSN_CONFIG_8254_READ_STATUS = 4098, INSN_CONFIG_8254_READ_STATUS = 4098,
@ -281,8 +284,7 @@ extern "C" {
COMEDI_OPENDRAIN = 2 COMEDI_OPENDRAIN = 2
}; };
enum comedi_support_level enum comedi_support_level {
{
COMEDI_UNKNOWN_SUPPORT = 0, COMEDI_UNKNOWN_SUPPORT = 0,
COMEDI_SUPPORTED, COMEDI_SUPPORTED,
COMEDI_UNSUPPORTED COMEDI_UNSUPPORTED
@ -511,18 +513,22 @@ extern "C" {
I8254_BINARY = 0 I8254_BINARY = 0
}; };
static inline unsigned NI_USUAL_PFI_SELECT(unsigned pfi_channel) { static inline unsigned NI_USUAL_PFI_SELECT(unsigned pfi_channel)
{
if (pfi_channel < 10) if (pfi_channel < 10)
return 0x1 + pfi_channel; return 0x1 + pfi_channel;
else else
return 0xb + pfi_channel; return 0xb + pfi_channel;
} static inline unsigned NI_USUAL_RTSI_SELECT(unsigned rtsi_channel) { }
static inline unsigned NI_USUAL_RTSI_SELECT(unsigned rtsi_channel)
{
if (rtsi_channel < 7) if (rtsi_channel < 7)
return 0xb + rtsi_channel; return 0xb + rtsi_channel;
else else
return 0x1b; return 0x1b;
} }
/* mode bits for NI general-purpose counters, set with INSN_CONFIG_SET_COUNTER_MODE */ /* mode bits for NI general-purpose counters, set with
* INSN_CONFIG_SET_COUNTER_MODE */
#define NI_GPCT_COUNTING_MODE_SHIFT 16 #define NI_GPCT_COUNTING_MODE_SHIFT 16
#define NI_GPCT_INDEX_PHASE_BITSHIFT 20 #define NI_GPCT_INDEX_PHASE_BITSHIFT 20
#define NI_GPCT_COUNTING_DIRECTION_SHIFT 24 #define NI_GPCT_COUNTING_DIRECTION_SHIFT 24
@ -610,13 +616,18 @@ extern "C" {
NI_GPCT_PRESCALE_X8_CLOCK_SRC_BITS = 0x20000000, /* divide source by 8 */ NI_GPCT_PRESCALE_X8_CLOCK_SRC_BITS = 0x20000000, /* divide source by 8 */
NI_GPCT_INVERT_CLOCK_SRC_BIT = 0x80000000 NI_GPCT_INVERT_CLOCK_SRC_BIT = 0x80000000
}; };
static inline unsigned NI_GPCT_SOURCE_PIN_CLOCK_SRC_BITS(unsigned n) { /* NI 660x-specific */ static inline unsigned NI_GPCT_SOURCE_PIN_CLOCK_SRC_BITS(unsigned n)
{
/* NI 660x-specific */
return 0x10 + n; return 0x10 + n;
} }
static inline unsigned NI_GPCT_RTSI_CLOCK_SRC_BITS(unsigned n) { static inline unsigned NI_GPCT_RTSI_CLOCK_SRC_BITS(unsigned n)
{
return 0x18 + n; return 0x18 + n;
} }
static inline unsigned NI_GPCT_PFI_CLOCK_SRC_BITS(unsigned n) { /* no pfi on NI 660x */ static inline unsigned NI_GPCT_PFI_CLOCK_SRC_BITS(unsigned n)
{
/* no pfi on NI 660x */
return 0x20 + n; return 0x20 + n;
} }
@ -643,16 +654,20 @@ May be bitwise-or'd with CR_EDGE or CR_INVERT. */
we should add them here with an offset of 0x300 when known. */ we should add them here with an offset of 0x300 when known. */
NI_GPCT_DISABLED_GATE_SELECT = 0x8000, NI_GPCT_DISABLED_GATE_SELECT = 0x8000,
}; };
static inline unsigned NI_GPCT_GATE_PIN_GATE_SELECT(unsigned n) { static inline unsigned NI_GPCT_GATE_PIN_GATE_SELECT(unsigned n)
{
return 0x102 + n; return 0x102 + n;
} }
static inline unsigned NI_GPCT_RTSI_GATE_SELECT(unsigned n) { static inline unsigned NI_GPCT_RTSI_GATE_SELECT(unsigned n)
{
return NI_USUAL_RTSI_SELECT(n); return NI_USUAL_RTSI_SELECT(n);
} }
static inline unsigned NI_GPCT_PFI_GATE_SELECT(unsigned n) { static inline unsigned NI_GPCT_PFI_GATE_SELECT(unsigned n)
{
return NI_USUAL_PFI_SELECT(n); return NI_USUAL_PFI_SELECT(n);
} }
static inline unsigned NI_GPCT_UP_DOWN_PIN_GATE_SELECT(unsigned n) { static inline unsigned NI_GPCT_UP_DOWN_PIN_GATE_SELECT(unsigned n)
{
return 0x202 + n; return 0x202 + n;
} }
@ -665,10 +680,11 @@ INSN_CONFIG_SET_OTHER_SRC when using NI general-purpose counters. */
}; };
enum ni_gpct_other_select { enum ni_gpct_other_select {
/* m-series gates */ /* m-series gates */
// Still unknown, probably only need NI_GPCT_PFI_OTHER_SELECT /* Still unknown, probably only need NI_GPCT_PFI_OTHER_SELECT */
NI_GPCT_DISABLED_OTHER_SELECT = 0x8000, NI_GPCT_DISABLED_OTHER_SELECT = 0x8000,
}; };
static inline unsigned NI_GPCT_PFI_OTHER_SELECT(unsigned n) { static inline unsigned NI_GPCT_PFI_OTHER_SELECT(unsigned n)
{
return NI_USUAL_PFI_SELECT(n); return NI_USUAL_PFI_SELECT(n);
} }
@ -676,11 +692,14 @@ INSN_CONFIG_SET_OTHER_SRC when using NI general-purpose counters. */
INSN_CONFIG_ARM */ INSN_CONFIG_ARM */
enum ni_gpct_arm_source { enum ni_gpct_arm_source {
NI_GPCT_ARM_IMMEDIATE = 0x0, NI_GPCT_ARM_IMMEDIATE = 0x0,
NI_GPCT_ARM_PAIRED_IMMEDIATE = 0x1, /* Start both the counter and the adjacent paired counter simultaneously */ NI_GPCT_ARM_PAIRED_IMMEDIATE = 0x1, /* Start both the counter and
the adjacent paired counter
simultaneously */
/* NI doesn't document bits for selecting hardware arm triggers. If /* NI doesn't document bits for selecting hardware arm triggers. If
the NI_GPCT_ARM_UNKNOWN bit is set, we will pass the least significant * the NI_GPCT_ARM_UNKNOWN bit is set, we will pass the least
bits (3 bits for 660x or 5 bits for m-series) through to the hardware. * significant bits (3 bits for 660x or 5 bits for m-series) through to
This will at least allow someone to figure out what the bits do later. */ * the hardware. This will at least allow someone to figure out what
* the bits do later. */
NI_GPCT_ARM_UNKNOWN = 0x1000, NI_GPCT_ARM_UNKNOWN = 0x1000,
}; };
@ -695,7 +714,8 @@ INSN_CONFIG_ARM */
NI_GPCT_FILTER_2x_TIMEBASE_3 = 0x6 NI_GPCT_FILTER_2x_TIMEBASE_3 = 0x6
}; };
/* PFI digital filtering options for ni m-series for use with INSN_CONFIG_FILTER. */ /* PFI digital filtering options for ni m-series for use with
* INSN_CONFIG_FILTER. */
enum ni_pfi_filter_select { enum ni_pfi_filter_select {
NI_PFI_FILTER_OFF = 0x0, NI_PFI_FILTER_OFF = 0x0,
NI_PFI_FILTER_125ns = 0x1, NI_PFI_FILTER_125ns = 0x1,
@ -706,13 +726,15 @@ INSN_CONFIG_ARM */
/* master clock sources for ni mio boards and INSN_CONFIG_SET_CLOCK_SRC */ /* master clock sources for ni mio boards and INSN_CONFIG_SET_CLOCK_SRC */
enum ni_mio_clock_source { enum ni_mio_clock_source {
NI_MIO_INTERNAL_CLOCK = 0, NI_MIO_INTERNAL_CLOCK = 0,
NI_MIO_RTSI_CLOCK = 1, /* doesn't work for m-series, use NI_MIO_PLL_RTSI_CLOCK() */ NI_MIO_RTSI_CLOCK = 1, /* doesn't work for m-series, use
NI_MIO_PLL_RTSI_CLOCK() */
/* the NI_MIO_PLL_* sources are m-series only */ /* the NI_MIO_PLL_* sources are m-series only */
NI_MIO_PLL_PXI_STAR_TRIGGER_CLOCK = 2, NI_MIO_PLL_PXI_STAR_TRIGGER_CLOCK = 2,
NI_MIO_PLL_PXI10_CLOCK = 3, NI_MIO_PLL_PXI10_CLOCK = 3,
NI_MIO_PLL_RTSI0_CLOCK = 4 NI_MIO_PLL_RTSI0_CLOCK = 4
}; };
static inline unsigned NI_MIO_PLL_RTSI_CLOCK(unsigned rtsi_channel) { static inline unsigned NI_MIO_PLL_RTSI_CLOCK(unsigned rtsi_channel)
{
return NI_MIO_PLL_RTSI0_CLOCK + rtsi_channel; return NI_MIO_PLL_RTSI0_CLOCK + rtsi_channel;
} }
@ -729,18 +751,19 @@ INSN_CONFIG_ARM */
NI_RTSI_OUTPUT_G_GATE0 = 6, NI_RTSI_OUTPUT_G_GATE0 = 6,
NI_RTSI_OUTPUT_RGOUT0 = 7, NI_RTSI_OUTPUT_RGOUT0 = 7,
NI_RTSI_OUTPUT_RTSI_BRD_0 = 8, NI_RTSI_OUTPUT_RTSI_BRD_0 = 8,
NI_RTSI_OUTPUT_RTSI_OSC = 12 /* pre-m-series always have RTSI clock on line 7 */ NI_RTSI_OUTPUT_RTSI_OSC = 12 /* pre-m-series always have RTSI clock
on line 7 */
}; };
static inline unsigned NI_RTSI_OUTPUT_RTSI_BRD(unsigned n) { static inline unsigned NI_RTSI_OUTPUT_RTSI_BRD(unsigned n)
{
return NI_RTSI_OUTPUT_RTSI_BRD_0 + n; return NI_RTSI_OUTPUT_RTSI_BRD_0 + n;
} }
/* Signals which can be routed to an NI PFI pin on an m-series board /* Signals which can be routed to an NI PFI pin on an m-series board with
with INSN_CONFIG_SET_ROUTING. These numbers are also returned * INSN_CONFIG_SET_ROUTING. These numbers are also returned by
by INSN_CONFIG_GET_ROUTING on pre-m-series boards, even though * INSN_CONFIG_GET_ROUTING on pre-m-series boards, even though their routing
their routing cannot be changed. The numbers assigned are * cannot be changed. The numbers assigned are not arbitrary, they correspond
not arbitrary, they correspond to the bits required * to the bits required to program the board. */
to program the board. */
enum ni_pfi_routing { enum ni_pfi_routing {
NI_PFI_OUTPUT_PFI_DEFAULT = 0, NI_PFI_OUTPUT_PFI_DEFAULT = 0,
NI_PFI_OUTPUT_AI_START1 = 1, NI_PFI_OUTPUT_AI_START1 = 1,
@ -767,7 +790,8 @@ INSN_CONFIG_ARM */
NI_PFI_OUTPUT_CDI_SAMPLE = 29, NI_PFI_OUTPUT_CDI_SAMPLE = 29,
NI_PFI_OUTPUT_CDO_UPDATE = 30 NI_PFI_OUTPUT_CDO_UPDATE = 30
}; };
static inline unsigned NI_PFI_OUTPUT_RTSI(unsigned rtsi_channel) { static inline unsigned NI_PFI_OUTPUT_RTSI(unsigned rtsi_channel)
{
return NI_PFI_OUTPUT_RTSI0 + rtsi_channel; return NI_PFI_OUTPUT_RTSI0 + rtsi_channel;
} }
@ -778,16 +802,19 @@ INSN_CONFIG_ARM */
NI_660X_PFI_OUTPUT_DIO. Lines 32 to 39 can only be set to NI_660X_PFI_OUTPUT_DIO. Lines 32 to 39 can only be set to
NI_660X_PFI_OUTPUT_COUNTER. */ NI_660X_PFI_OUTPUT_COUNTER. */
enum ni_660x_pfi_routing { enum ni_660x_pfi_routing {
NI_660X_PFI_OUTPUT_COUNTER = 1, // counter NI_660X_PFI_OUTPUT_COUNTER = 1, /* counter */
NI_660X_PFI_OUTPUT_DIO = 2, // static digital output NI_660X_PFI_OUTPUT_DIO = 2, /* static digital output */
}; };
/* NI External Trigger lines. These values are not arbitrary, but are related to /* NI External Trigger lines. These values are not arbitrary, but are related
the bits required to program the board (offset by 1 for historical reasons). */ * to the bits required to program the board (offset by 1 for historical
static inline unsigned NI_EXT_PFI(unsigned pfi_channel) { * reasons). */
static inline unsigned NI_EXT_PFI(unsigned pfi_channel)
{
return NI_USUAL_PFI_SELECT(pfi_channel) - 1; return NI_USUAL_PFI_SELECT(pfi_channel) - 1;
} }
static inline unsigned NI_EXT_RTSI(unsigned rtsi_channel) { static inline unsigned NI_EXT_RTSI(unsigned rtsi_channel)
{
return NI_USUAL_RTSI_SELECT(rtsi_channel) - 1; return NI_USUAL_RTSI_SELECT(rtsi_channel) - 1;
} }
@ -798,9 +825,9 @@ INSN_CONFIG_ARM */
COMEDI_COUNTER_TERMINAL_COUNT = 0x4, COMEDI_COUNTER_TERMINAL_COUNT = 0x4,
}; };
/* Clock sources for CDIO subdevice on NI m-series boards. /* Clock sources for CDIO subdevice on NI m-series boards. Used as the
Used as the scan_begin_arg for a comedi_command. These * scan_begin_arg for a comedi_command. These sources may also be bitwise-or'd
sources may also be bitwise-or'd with CR_INVERT to change polarity. */ * with CR_INVERT to change polarity. */
enum ni_m_series_cdio_scan_begin_src { enum ni_m_series_cdio_scan_begin_src {
NI_CDIO_SCAN_BEGIN_SRC_GROUND = 0, NI_CDIO_SCAN_BEGIN_SRC_GROUND = 0,
NI_CDIO_SCAN_BEGIN_SRC_AI_START = 18, NI_CDIO_SCAN_BEGIN_SRC_AI_START = 18,
@ -813,29 +840,32 @@ sources may also be bitwise-or'd with CR_INVERT to change polarity. */
NI_CDIO_SCAN_BEGIN_SRC_FREQ_OUT = 32, NI_CDIO_SCAN_BEGIN_SRC_FREQ_OUT = 32,
NI_CDIO_SCAN_BEGIN_SRC_DIO_CHANGE_DETECT_IRQ = 33 NI_CDIO_SCAN_BEGIN_SRC_DIO_CHANGE_DETECT_IRQ = 33
}; };
static inline unsigned NI_CDIO_SCAN_BEGIN_SRC_PFI(unsigned pfi_channel) { static inline unsigned NI_CDIO_SCAN_BEGIN_SRC_PFI(unsigned pfi_channel)
{
return NI_USUAL_PFI_SELECT(pfi_channel); return NI_USUAL_PFI_SELECT(pfi_channel);
} }
static inline unsigned NI_CDIO_SCAN_BEGIN_SRC_RTSI(unsigned static inline unsigned NI_CDIO_SCAN_BEGIN_SRC_RTSI(unsigned rtsi_channel)
rtsi_channel) { {
return NI_USUAL_RTSI_SELECT(rtsi_channel); return NI_USUAL_RTSI_SELECT(rtsi_channel);
} }
/* scan_begin_src for scan_begin_arg==TRIG_EXT with analog output command /* scan_begin_src for scan_begin_arg==TRIG_EXT with analog output command on NI
on NI boards. These scan begin sources can also be bitwise-or'd with * boards. These scan begin sources can also be bitwise-or'd with CR_INVERT to
CR_INVERT to change polarity. */ * change polarity. */
static inline unsigned NI_AO_SCAN_BEGIN_SRC_PFI(unsigned pfi_channel) { static inline unsigned NI_AO_SCAN_BEGIN_SRC_PFI(unsigned pfi_channel)
{
return NI_USUAL_PFI_SELECT(pfi_channel); return NI_USUAL_PFI_SELECT(pfi_channel);
} }
static inline unsigned NI_AO_SCAN_BEGIN_SRC_RTSI(unsigned rtsi_channel) { static inline unsigned NI_AO_SCAN_BEGIN_SRC_RTSI(unsigned rtsi_channel)
{
return NI_USUAL_RTSI_SELECT(rtsi_channel); return NI_USUAL_RTSI_SELECT(rtsi_channel);
} }
/* Bits for setting a clock source with /* Bits for setting a clock source with
* INSN_CONFIG_SET_CLOCK_SRC when using NI frequency output subdevice. */ * INSN_CONFIG_SET_CLOCK_SRC when using NI frequency output subdevice. */
enum ni_freq_out_clock_source_bits { enum ni_freq_out_clock_source_bits {
NI_FREQ_OUT_TIMEBASE_1_DIV_2_CLOCK_SRC, // 10 MHz NI_FREQ_OUT_TIMEBASE_1_DIV_2_CLOCK_SRC, /* 10 MHz */
NI_FREQ_OUT_TIMEBASE_2_CLOCK_SRC // 100 KHz NI_FREQ_OUT_TIMEBASE_2_CLOCK_SRC /* 100 KHz */
}; };
/* Values for setting a clock source with INSN_CONFIG_SET_CLOCK_SRC for /* Values for setting a clock source with INSN_CONFIG_SET_CLOCK_SRC for

View file

@ -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 */

View file

@ -45,9 +45,9 @@
#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

View file

@ -39,13 +39,14 @@
#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) \
printk(KERN_DEBUG "comedi: " format , ## args); \
} while (0) } while (0)
#define COMEDI_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c)) #define COMEDI_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
@ -89,7 +90,8 @@
{ \ { \
int retval; \ int retval; \
retval = comedi_driver_register(&comedi_driver); \ retval = comedi_driver_register(&comedi_driver); \
if(retval < 0) return retval; \ if (retval < 0) \
return retval; \
comedi_driver ## _pci_driver.name = (char *)comedi_driver.driver_name; \ comedi_driver ## _pci_driver.name = (char *)comedi_driver.driver_name; \
return pci_register_driver(&comedi_driver ## _pci_driver); \ return pci_register_driver(&comedi_driver ## _pci_driver); \
} \ } \
@ -177,8 +179,8 @@ 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,
@ -234,7 +236,7 @@ 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;
@ -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;
@ -302,7 +305,7 @@ 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
/* /*
@ -324,17 +327,23 @@ 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;
} }
@ -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
}; };
@ -454,9 +464,9 @@ static inline unsigned int bytes_per_sample(const comedi_subdevice * subd)
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);
@ -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 */

View file

@ -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_ */