Staging: strip: delete the driver
[safe/jmp/linux-2.6] / drivers / staging / comedi / comedidev.h
index 414a2cf..c38ebb4 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/module.h>
 #include <linux/kdev_t.h>
 #include <linux/slab.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/spinlock.h>
 #include <linux/mutex.h>
@@ -38,6 +39,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/uaccess.h>
 #include <linux/io.h>
+#include <linux/timer.h>
 
 #include "comedi.h"
 
 } while (0)
 
 #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_INITCLEANUP_NOMODULE(x)                                 \
        static int __init x ## _init_module(void)                       \
                {return comedi_driver_register(&(x)); }                 \
        static void __exit x ## _cleanup_module(void)                   \
-               {comedi_driver_unregister(&(x)); }                      \
+               {comedi_driver_unregister(&(x)); }                      \
        module_init(x ## _init_module);                                 \
-       module_exit(x ## _cleanup_module);                                      \
+       module_exit(x ## _cleanup_module);
 
 #define COMEDI_MODULE_MACROS                                           \
        MODULE_AUTHOR("Comedi http://www.comedi.org");          \
        MODULE_DESCRIPTION("Comedi low-level driver");                  \
-       MODULE_LICENSE("GPL");                                          \
+       MODULE_LICENSE("GPL");
 
 #define COMEDI_INITCLEANUP(x)                                          \
        COMEDI_MODULE_MACROS            \
@@ -73,7 +76,8 @@
        { \
                return comedi_pci_auto_config(dev, comedi_driver.driver_name); \
        } \
-       static void __devexit comedi_driver ## _pci_remove(struct pci_dev *dev) \
+       static void __devexit comedi_driver ## _pci_remove(\
+               struct pci_dev *dev) \
        { \
                comedi_pci_auto_unconfig(dev); \
        } \
@@ -89,7 +93,8 @@
                retval = comedi_driver_register(&comedi_driver); \
                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); \
        } \
        static void __exit comedi_driver ## _cleanup_module(void) \
        COMEDI_MODULE_MACROS \
        COMEDI_PCI_INITCLEANUP_NOMODULE(comedi_driver, pci_id_table)
 
-#define PCI_VENDOR_ID_INOVA            0x104c
-#define PCI_VENDOR_ID_NATINST          0x1093
-#define PCI_VENDOR_ID_DATX             0x1116
-#define PCI_VENDOR_ID_COMPUTERBOARDS   0x1307
-#define PCI_VENDOR_ID_ADVANTECH                0x13fe
-#define PCI_VENDOR_ID_RTD              0x1435
-#define PCI_VENDOR_ID_AMPLICON         0x14dc
 #define PCI_VENDOR_ID_ADLINK           0x144a
 #define PCI_VENDOR_ID_ICP              0x104c
 #define PCI_VENDOR_ID_CONTEC           0x1221
-#define PCI_VENDOR_ID_MEILHAUS         0x1402
 
 #define COMEDI_NUM_MINORS 0x100
 #define COMEDI_NUM_BOARD_MINORS 0x30
@@ -127,7 +124,7 @@ struct comedi_subdevice {
        struct comedi_device *device;
        int type;
        int n_chan;
-       volatile int subdev_flags;
+       int subdev_flags;
        int len_chanlist;       /* maximum length of channel/gain list */
 
        void *private;
@@ -154,28 +151,31 @@ struct comedi_subdevice {
 
        unsigned int *chanlist; /* driver-owned chanlist (not used) */
 
-       int (*insn_read) (struct comedi_device *, struct comedi_subdevice *, struct comedi_insn *,
-               unsigned int *);
-       int (*insn_write) (struct comedi_device *, struct comedi_subdevice *, struct comedi_insn *,
-               unsigned int *);
-       int (*insn_bits) (struct comedi_device *, struct comedi_subdevice *, struct comedi_insn *,
-               unsigned int *);
-       int (*insn_config) (struct comedi_device *, struct comedi_subdevice *, struct comedi_insn *,
-               unsigned int *);
+       int (*insn_read) (struct comedi_device *, struct comedi_subdevice *,
+                         struct comedi_insn *, unsigned int *);
+       int (*insn_write) (struct comedi_device *, struct comedi_subdevice *,
+                          struct comedi_insn *, unsigned int *);
+       int (*insn_bits) (struct comedi_device *, struct comedi_subdevice *,
+                         struct comedi_insn *, unsigned int *);
+       int (*insn_config) (struct comedi_device *, struct comedi_subdevice *,
+                           struct comedi_insn *, unsigned int *);
 
        int (*do_cmd) (struct comedi_device *, struct comedi_subdevice *);
-       int (*do_cmdtest) (struct comedi_device *, struct comedi_subdevice *, struct comedi_cmd *);
+       int (*do_cmdtest) (struct comedi_device *, struct comedi_subdevice *,
+                          struct comedi_cmd *);
        int (*poll) (struct comedi_device *, struct comedi_subdevice *);
        int (*cancel) (struct comedi_device *, struct comedi_subdevice *);
-       /* int (*do_lock)(struct comedi_device *,struct comedi_subdevice *); */
-       /* int (*do_unlock)(struct comedi_device *,struct comedi_subdevice *); */
+       /* int (*do_lock)(struct comedi_device *, struct comedi_subdevice *); */
+       /* int (*do_unlock)(struct comedi_device *, \
+                       struct comedi_subdevice *); */
 
        /* called when the buffer changes */
-       int (*buf_change) (struct comedi_device *dev, struct comedi_subdevice *s,
-               unsigned long new_size);
+       int (*buf_change) (struct comedi_device *dev,
+                          struct comedi_subdevice *s, unsigned long new_size);
 
-       void (*munge) (struct comedi_device *dev, struct comedi_subdevice *s, void *data,
-               unsigned int num_bytes, unsigned int start_chan_index);
+       void (*munge) (struct comedi_device *dev, struct comedi_subdevice *s,
+                      void *data, unsigned int num_bytes,
+                      unsigned int start_chan_index);
        enum dma_data_direction async_dma_dir;
 
        unsigned int state;
@@ -194,16 +194,22 @@ struct comedi_async {
 
        void *prealloc_buf;     /* pre-allocated buffer */
        unsigned int prealloc_bufsz;    /* buffer size, in bytes */
-       struct comedi_buf_page *buf_page_list;  /* virtual and dma address of each page */
+       /* virtual and dma address of each page */
+       struct comedi_buf_page *buf_page_list;
        unsigned n_buf_pages;   /* num elements in buf_page_list */
 
        unsigned int max_bufsize;       /* maximum buffer size, bytes */
-       unsigned int mmap_count;        /* current number of mmaps of prealloc_buf */
-
-       unsigned int buf_write_count;   /* byte count for writer (write completed) */
-       unsigned int buf_write_alloc_count;     /* byte count for writer (allocated for writing) */
-       unsigned int buf_read_count;    /* byte count for reader (read completed) */
-       unsigned int buf_read_alloc_count;      /* byte count for reader (allocated for reading) */
+       /* current number of mmaps of prealloc_buf */
+       unsigned int mmap_count;
+
+       /* byte count for writer (write completed) */
+       unsigned int buf_write_count;
+       /* byte count for writer (allocated for writing) */
+       unsigned int buf_write_alloc_count;
+       /* byte count for reader (read completed) */
+       unsigned int buf_read_count;
+       /* byte count for reader (allocated for reading) */
+       unsigned int buf_read_alloc_count;
 
        unsigned int buf_write_ptr;     /* buffer marker for writer */
        unsigned int buf_read_ptr;      /* buffer marker for reader */
@@ -263,7 +269,6 @@ struct comedi_device {
        const char *board_name;
        const void *board_ptr;
        int attached;
-       int rt;
        spinlock_t spinlock;
        struct mutex mutex;
        int in_request_module;
@@ -316,7 +321,7 @@ static const unsigned COMEDI_SUBDEVICE_MINOR_OFFSET = 1;
 struct comedi_device_file_info *comedi_get_device_file_info(unsigned minor);
 
 static inline struct comedi_subdevice *comedi_get_read_subdevice(
-                               const struct comedi_device_file_info *info)
+       const struct comedi_device_file_info *info)
 {
        if (info->read_subdevice)
                return info->read_subdevice;
@@ -326,7 +331,7 @@ static inline struct comedi_subdevice *comedi_get_read_subdevice(
 }
 
 static inline struct comedi_subdevice *comedi_get_write_subdevice(
-                               const struct comedi_device_file_info *info)
+       const struct comedi_device_file_info *info)
 {
        if (info->write_subdevice)
                return info->write_subdevice;
@@ -336,7 +341,8 @@ static inline struct comedi_subdevice *comedi_get_write_subdevice(
 }
 
 void comedi_device_detach(struct comedi_device *dev);
-int comedi_device_attach(struct comedi_device *dev, struct comedi_devconfig *it);
+int comedi_device_attach(struct comedi_device *dev,
+                        struct comedi_devconfig *it);
 int comedi_driver_register(struct comedi_driver *);
 int comedi_driver_unregister(struct comedi_driver *);
 
@@ -345,9 +351,6 @@ void cleanup_polling(void);
 void start_polling(struct comedi_device *);
 void stop_polling(struct comedi_device *);
 
-int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, unsigned long
-       new_size);
-
 #ifdef CONFIG_PROC_FS
 void comedi_proc_init(void);
 void comedi_proc_cleanup(void);
@@ -355,6 +358,7 @@ void comedi_proc_cleanup(void);
 static inline void comedi_proc_init(void)
 {
 }
+
 static inline void comedi_proc_cleanup(void)
 {
 }
@@ -370,24 +374,15 @@ enum subdevice_runflags {
        SRF_RUNNING = 0x08000000
 };
 
-/*
-   various internal comedi functions
- */
-
-int do_rangeinfo_ioctl(struct comedi_device *dev, struct comedi_rangeinfo *arg);
-int check_chanlist(struct comedi_subdevice *s, int n, unsigned int *chanlist);
-void comedi_set_subdevice_runflags(struct comedi_subdevice *s, unsigned mask,
-       unsigned bits);
+int comedi_check_chanlist(struct comedi_subdevice *s, int n, unsigned int *chanlist);
 unsigned comedi_get_subdevice_runflags(struct comedi_subdevice *s);
-int insn_inval(struct comedi_device *dev, struct comedi_subdevice *s,
-       struct comedi_insn *insn, unsigned int *data);
 
 /* range stuff */
 
 #define RANGE(a, b)            {(a)*1e6, (b)*1e6, 0}
 #define RANGE_ext(a, b)                {(a)*1e6, (b)*1e6, RF_EXTERNAL}
 #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}
 #define BIP_RANGE(a)           {-(a)*1e6, (a)*1e6, 0}
 #define UNI_RANGE(a)           {0, (a)*1e6, 0}
 
@@ -420,7 +415,8 @@ static inline int alloc_subdevices(struct comedi_device *dev,
 
        dev->n_subdevices = num_subdevices;
        dev->subdevices =
-               kcalloc(num_subdevices, sizeof(struct comedi_subdevice), GFP_KERNEL);
+           kcalloc(num_subdevices, sizeof(struct comedi_subdevice),
+                   GFP_KERNEL);
        if (!dev->subdevices)
                return -ENOMEM;
        for (i = 0; i < num_subdevices; ++i) {
@@ -450,7 +446,8 @@ static inline unsigned int bytes_per_sample(const struct comedi_subdevice *subd)
 
 /* must be used in attach to set dev->hw_dev if you wish to dma directly
 into comedi's buffer */
-static inline void comedi_set_hw_dev(struct comedi_device *dev, struct device *hw_dev)
+static inline void comedi_set_hw_dev(struct comedi_device *dev,
+                                    struct device *hw_dev)
 {
        if (dev->hw_dev)
                put_device(dev->hw_dev);
@@ -466,28 +463,28 @@ int comedi_buf_put(struct comedi_async *async, short x);
 int comedi_buf_get(struct comedi_async *async, short *x);
 
 unsigned int comedi_buf_write_n_available(struct comedi_async *async);
-unsigned int comedi_buf_write_alloc(struct comedi_async *async, unsigned int nbytes);
+unsigned int comedi_buf_write_alloc(struct comedi_async *async,
+                                   unsigned int nbytes);
 unsigned int comedi_buf_write_alloc_strict(struct comedi_async *async,
-       unsigned int nbytes);
+                                          unsigned int nbytes);
 unsigned comedi_buf_write_free(struct comedi_async *async, unsigned int nbytes);
 unsigned comedi_buf_read_alloc(struct comedi_async *async, unsigned nbytes);
 unsigned comedi_buf_read_free(struct comedi_async *async, unsigned int nbytes);
 unsigned int comedi_buf_read_n_available(struct comedi_async *async);
 void comedi_buf_memcpy_to(struct 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(struct 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(struct comedi_async *async)
 {
        return async->buf_write_alloc_count - async->buf_write_count;
 }
+
 static inline unsigned comedi_buf_read_n_allocated(struct comedi_async *async)
 {
        return async->buf_read_alloc_count - async->buf_read_count;
 }
 
-void comedi_reset_async_buf(struct comedi_async *async);
-
 static inline void *comedi_aux_data(int options[], int n)
 {
        unsigned long address;
@@ -513,16 +510,26 @@ static inline void *comedi_aux_data(int options[], int n)
        return (void *)address;
 }
 
-int comedi_alloc_board_minor(struct device *hardware_device);
-void comedi_free_board_minor(unsigned minor);
-int comedi_alloc_subdevice_minor(struct comedi_device *dev, struct comedi_subdevice *s);
+int comedi_alloc_subdevice_minor(struct comedi_device *dev,
+                                struct comedi_subdevice *s);
 void comedi_free_subdevice_minor(struct comedi_subdevice *s);
 int comedi_pci_auto_config(struct pci_dev *pcidev, const char *board_name);
 void comedi_pci_auto_unconfig(struct pci_dev *pcidev);
-struct usb_device;     /* forward declaration */
+struct usb_device;             /* forward declaration */
 int comedi_usb_auto_config(struct usb_device *usbdev, const char *board_name);
 void comedi_usb_auto_unconfig(struct usb_device *usbdev);
 
-#include "comedi_rt.h"
+#ifdef CONFIG_COMEDI_PCI_DRIVERS
+#define CONFIG_COMEDI_PCI
+#endif
+#ifdef CONFIG_COMEDI_PCI_DRIVERS_MODULE
+#define CONFIG_COMEDI_PCI
+#endif
+#ifdef CONFIG_COMEDI_PCMCIA_DRIVERS
+#define CONFIG_COMEDI_PCMCIA
+#endif
+#ifdef CONFIG_COMEDI_PCMCIA_DRIVERS_MODULE
+#define CONFIG_COMEDI_PCMCIA
+#endif
 
 #endif /* _COMEDIDEV_H */