Commit 0a85b6f0 authored by Mithlesh Thukral's avatar Mithlesh Thukral Committed by Greg Kroah-Hartman

Staging: Comedi: Lindent changes to comdi driver in staging tree

Lindent changes to comdi driver in staging tree.
This patch is followed by the checkpatch.pl error fixes.
Did not make them part of this patch as the patch size is already huge.
Signed-off-by: default avatarMithlesh Thukral <mithlesh@linsyssoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent df678568
This diff is collapsed.
......@@ -51,7 +51,7 @@
struct comedi32_chaninfo_struct {
unsigned int subdev;
compat_uptr_t maxdata_list; /* 32-bit 'unsigned int *' */
compat_uptr_t flaglist; /* 32-bit 'unsigned int *' */
compat_uptr_t flaglist; /* 32-bit 'unsigned int *' */
compat_uptr_t rangelist; /* 32-bit 'unsigned int *' */
unsigned int unused[4];
};
......@@ -74,16 +74,16 @@ struct comedi32_cmd_struct {
unsigned int scan_end_arg;
unsigned int stop_src;
unsigned int stop_arg;
compat_uptr_t chanlist; /* 32-bit 'unsigned int *' */
compat_uptr_t chanlist; /* 32-bit 'unsigned int *' */
unsigned int chanlist_len;
compat_uptr_t data; /* 32-bit 'short *' */
compat_uptr_t data; /* 32-bit 'short *' */
unsigned int data_len;
};
struct comedi32_insn_struct {
unsigned int insn;
unsigned int n;
compat_uptr_t data; /* 32-bit 'unsigned int *' */
compat_uptr_t data; /* 32-bit 'unsigned int *' */
unsigned int subdev;
unsigned int chanspec;
unsigned int unused[3];
......@@ -91,19 +91,19 @@ struct comedi32_insn_struct {
struct comedi32_insnlist_struct {
unsigned int n_insns;
compat_uptr_t insns; /* 32-bit 'struct comedi_insn *' */
compat_uptr_t insns; /* 32-bit 'struct comedi_insn *' */
};
/* Handle translated ioctl. */
static int translated_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
unsigned long arg)
{
if (!file->f_op)
return -ENOTTY;
#ifdef HAVE_UNLOCKED_IOCTL
if (file->f_op->unlocked_ioctl) {
int rc = (int)(*file->f_op->unlocked_ioctl)(file, cmd, arg);
int rc = (int)(*file->f_op->unlocked_ioctl) (file, cmd, arg);
if (rc == -ENOIOCTLCMD)
rc = -ENOTTY;
return rc;
......@@ -112,8 +112,8 @@ static int translated_ioctl(struct file *file, unsigned int cmd,
if (file->f_op->ioctl) {
int rc;
lock_kernel();
rc = (*file->f_op->ioctl)(file->f_dentry->d_inode,
file, cmd, arg);
rc = (*file->f_op->ioctl) (file->f_dentry->d_inode,
file, cmd, arg);
unlock_kernel();
return rc;
}
......@@ -136,8 +136,7 @@ static int compat_chaninfo(struct file *file, unsigned long arg)
/* Copy chaninfo structure. Ignore unused members. */
if (!access_ok(VERIFY_READ, chaninfo32, sizeof(*chaninfo32))
|| !access_ok(VERIFY_WRITE, chaninfo,
sizeof(*chaninfo))) {
|| !access_ok(VERIFY_WRITE, chaninfo, sizeof(*chaninfo))) {
return -EFAULT;
}
err = 0;
......@@ -171,8 +170,7 @@ static int compat_rangeinfo(struct file *file, unsigned long arg)
/* Copy rangeinfo structure. */
if (!access_ok(VERIFY_READ, rangeinfo32, sizeof(*rangeinfo32))
|| !access_ok(VERIFY_WRITE, rangeinfo,
sizeof(*rangeinfo))) {
|| !access_ok(VERIFY_WRITE, rangeinfo, sizeof(*rangeinfo))) {
return -EFAULT;
}
err = 0;
......@@ -184,12 +182,12 @@ static int compat_rangeinfo(struct file *file, unsigned long arg)
return -EFAULT;
return translated_ioctl(file, COMEDI_RANGEINFO,
(unsigned long)rangeinfo);
(unsigned long)rangeinfo);
}
/* Copy 32-bit cmd structure to native cmd structure. */
static int get_compat_cmd(struct comedi_cmd __user *cmd,
struct comedi32_cmd_struct __user *cmd32)
static int get_compat_cmd(struct comedi_cmd __user * cmd,
struct comedi32_cmd_struct __user * cmd32)
{
int err;
union {
......@@ -199,7 +197,7 @@ static int get_compat_cmd(struct comedi_cmd __user *cmd,
/* Copy cmd structure. */
if (!access_ok(VERIFY_READ, cmd32, sizeof(*cmd32))
|| !access_ok(VERIFY_WRITE, cmd, sizeof(*cmd))) {
|| !access_ok(VERIFY_WRITE, cmd, sizeof(*cmd))) {
return -EFAULT;
}
err = 0;
......@@ -239,7 +237,8 @@ static int get_compat_cmd(struct comedi_cmd __user *cmd,
}
/* Copy native cmd structure to 32-bit cmd structure. */
static int put_compat_cmd(struct comedi32_cmd_struct __user *cmd32, struct comedi_cmd __user *cmd)
static int put_compat_cmd(struct comedi32_cmd_struct __user * cmd32,
struct comedi_cmd __user * cmd)
{
int err;
unsigned int temp;
......@@ -249,7 +248,7 @@ static int put_compat_cmd(struct comedi32_cmd_struct __user *cmd32, struct comed
/* (Could use ptr_to_compat() to set them, but that wasn't implemented
* until kernel version 2.6.11.) */
if (!access_ok(VERIFY_READ, cmd, sizeof(*cmd))
|| !access_ok(VERIFY_WRITE, cmd32, sizeof(*cmd32))) {
|| !access_ok(VERIFY_WRITE, cmd32, sizeof(*cmd32))) {
return -EFAULT;
}
err = 0;
......@@ -329,8 +328,8 @@ static int compat_cmdtest(struct file *file, unsigned long arg)
}
/* Copy 32-bit insn structure to native insn structure. */
static int get_compat_insn(struct comedi_insn __user *insn,
struct comedi32_insn_struct __user *insn32)
static int get_compat_insn(struct comedi_insn __user * insn,
struct comedi32_insn_struct __user * insn32)
{
int err;
union {
......@@ -341,7 +340,7 @@ static int get_compat_insn(struct comedi_insn __user *insn,
/* Copy insn structure. Ignore the unused members. */
err = 0;
if (!access_ok(VERIFY_READ, insn32, sizeof(*insn32))
|| !access_ok(VERIFY_WRITE, insn, sizeof(*insn)))
|| !access_ok(VERIFY_WRITE, insn, sizeof(*insn)))
return -EFAULT;
err |= __get_user(temp.uint, &insn32->insn);
......@@ -385,7 +384,7 @@ static int compat_insnlist(struct file *file, unsigned long arg)
/* Allocate user memory to copy insnlist and insns into. */
s = compat_alloc_user_space(offsetof(struct combined_insnlist,
insn[n_insns]));
insn[n_insns]));
/* Set native insnlist structure. */
if (!access_ok(VERIFY_WRITE, &s->insnlist, sizeof(s->insnlist))) {
......@@ -404,7 +403,7 @@ static int compat_insnlist(struct file *file, unsigned long arg)
}
return translated_ioctl(file, COMEDI_INSNLIST,
(unsigned long)&s->insnlist);
(unsigned long)&s->insnlist);
}
/* Handle 32-bit COMEDI_INSN ioctl. */
......@@ -427,7 +426,7 @@ static int compat_insn(struct file *file, unsigned long arg)
/* Process untranslated ioctl. */
/* Returns -ENOIOCTLCMD for unrecognised ioctl codes. */
static inline int raw_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
unsigned long arg)
{
int rc;
......@@ -477,8 +476,7 @@ static inline int raw_ioctl(struct file *file, unsigned int cmd,
/* compat_ioctl file operation. */
/* Returns -ENOIOCTLCMD for unrecognised ioctl codes. */
long comedi_compat_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
long comedi_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
return raw_ioctl(file, cmd, arg);
}
......@@ -497,7 +495,7 @@ long comedi_compat_ioctl(struct file *file, unsigned int cmd,
/* Handler for all 32-bit ioctl codes registered by this driver. */
static int mapped_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg,
struct file *file)
struct file *file)
{
int rc;
......@@ -515,27 +513,27 @@ static int mapped_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg,
struct ioctl32_map {
unsigned int cmd;
int (*handler)(unsigned int, unsigned int, unsigned long,
int (*handler) (unsigned int, unsigned int, unsigned long,
struct file *);
int registered;
};
static struct ioctl32_map comedi_ioctl32_map[] = {
{ COMEDI_DEVCONFIG, mapped_ioctl, 0 },
{ COMEDI_DEVINFO, mapped_ioctl, 0 },
{ COMEDI_SUBDINFO, mapped_ioctl, 0 },
{ COMEDI_BUFCONFIG, mapped_ioctl, 0 },
{ COMEDI_BUFINFO, mapped_ioctl, 0 },
{ COMEDI_LOCK, mapped_ioctl, 0 },
{ COMEDI_UNLOCK, mapped_ioctl, 0 },
{ COMEDI_CANCEL, mapped_ioctl, 0 },
{ COMEDI_POLL, mapped_ioctl, 0 },
{ COMEDI32_CHANINFO, mapped_ioctl, 0 },
{ COMEDI32_RANGEINFO, mapped_ioctl, 0 },
{ COMEDI32_CMD, mapped_ioctl, 0 },
{ COMEDI32_CMDTEST, mapped_ioctl, 0 },
{ COMEDI32_INSNLIST, mapped_ioctl, 0 },
{ COMEDI32_INSN, mapped_ioctl, 0 },
{COMEDI_DEVCONFIG, mapped_ioctl, 0},
{COMEDI_DEVINFO, mapped_ioctl, 0},
{COMEDI_SUBDINFO, mapped_ioctl, 0},
{COMEDI_BUFCONFIG, mapped_ioctl, 0},
{COMEDI_BUFINFO, mapped_ioctl, 0},
{COMEDI_LOCK, mapped_ioctl, 0},
{COMEDI_UNLOCK, mapped_ioctl, 0},
{COMEDI_CANCEL, mapped_ioctl, 0},
{COMEDI_POLL, mapped_ioctl, 0},
{COMEDI32_CHANINFO, mapped_ioctl, 0},
{COMEDI32_RANGEINFO, mapped_ioctl, 0},
{COMEDI32_CMD, mapped_ioctl, 0},
{COMEDI32_CMDTEST, mapped_ioctl, 0},
{COMEDI32_INSNLIST, mapped_ioctl, 0},
{COMEDI32_INSN, mapped_ioctl, 0},
};
#define NUM_IOCTL32_MAPS ARRAY_SIZE(comedi_ioctl32_map)
......@@ -547,13 +545,13 @@ void comedi_register_ioctl32(void)
for (n = 0; n < NUM_IOCTL32_MAPS; n++) {
rc = register_ioctl32_conversion(comedi_ioctl32_map[n].cmd,
comedi_ioctl32_map[n].handler);
comedi_ioctl32_map[n].handler);
if (rc) {
printk(KERN_WARNING
"comedi: failed to register 32-bit "
"compatible ioctl handler for 0x%X - "
"expect bad things to happen!\n",
comedi_ioctl32_map[n].cmd);
"comedi: failed to register 32-bit "
"compatible ioctl handler for 0x%X - "
"expect bad things to happen!\n",
comedi_ioctl32_map[n].cmd);
}
comedi_ioctl32_map[n].registered = !rc;
}
......@@ -566,15 +564,16 @@ void comedi_unregister_ioctl32(void)
for (n = 0; n < NUM_IOCTL32_MAPS; n++) {
if (comedi_ioctl32_map[n].registered) {
rc = unregister_ioctl32_conversion(
comedi_ioctl32_map[n].cmd,
comedi_ioctl32_map[n].handler);
rc = unregister_ioctl32_conversion(comedi_ioctl32_map
[n].cmd,
comedi_ioctl32_map
[n].handler);
if (rc) {
printk(KERN_ERR
"comedi: failed to unregister 32-bit "
"compatible ioctl handler for 0x%X - "
"expect kernel Oops!\n",
comedi_ioctl32_map[n].cmd);
"comedi: failed to unregister 32-bit "
"compatible ioctl handler for 0x%X - "
"expect kernel Oops!\n",
comedi_ioctl32_map[n].cmd);
} else {
comedi_ioctl32_map[n].registered = 0;
}
......@@ -582,6 +581,6 @@ void comedi_unregister_ioctl32(void)
}
}
#endif /* HAVE_COMPAT_IOCTL */
#endif /* HAVE_COMPAT_IOCTL */
#endif /* CONFIG_COMPAT */
#endif /* CONFIG_COMPAT */
......@@ -28,14 +28,14 @@
#define _COMEDI_COMPAT32_H
#include <linux/compat.h>
#include <linux/fs.h> /* For HAVE_COMPAT_IOCTL and HAVE_UNLOCKED_IOCTL */
#include <linux/fs.h> /* For HAVE_COMPAT_IOCTL and HAVE_UNLOCKED_IOCTL */
#ifdef CONFIG_COMPAT
#ifdef HAVE_COMPAT_IOCTL
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_unregister_ioctl32() do {} while (0)
......
This diff is collapsed.
......@@ -156,28 +156,30 @@ 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 *); */
/* 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;
......@@ -231,7 +233,7 @@ struct comedi_async {
int (*cb_func) (unsigned int flags, void *);
void *cb_arg;
int (*inttrig) (struct comedi_device *dev, struct comedi_subdevice *s,
int (*inttrig) (struct comedi_device * dev, struct comedi_subdevice * s,
unsigned int x);
};
......@@ -281,8 +283,8 @@ struct comedi_device {
struct fasync_struct *async_queue;
void (*open) (struct comedi_device *dev);
void (*close) (struct comedi_device *dev);
void (*open) (struct comedi_device * dev);
void (*close) (struct comedi_device * dev);
};
struct comedi_device_file_info {
......@@ -316,8 +318,9 @@ 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)
static inline struct comedi_subdevice *comedi_get_read_subdevice(const struct
comedi_device_file_info
*info)
{
if (info->read_subdevice)
return info->read_subdevice;
......@@ -326,8 +329,9 @@ static inline struct comedi_subdevice *comedi_get_read_subdevice(
return info->device->read_subdev;
}
static inline struct comedi_subdevice *comedi_get_write_subdevice(
const struct comedi_device_file_info *info)
static inline struct comedi_subdevice *comedi_get_write_subdevice(const struct
comedi_device_file_info
*info)
{
if (info->write_subdevice)
return info->write_subdevice;
......@@ -337,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 *);
......@@ -346,8 +351,8 @@ 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);
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);
......@@ -356,6 +361,7 @@ void comedi_proc_cleanup(void);
static inline void comedi_proc_init(void)
{
}
static inline void comedi_proc_cleanup(void)
{
}
......@@ -378,10 +384,10 @@ enum subdevice_runflags {
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);
unsigned bits);
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);
struct comedi_insn *insn, unsigned int *data);
/* range stuff */
......@@ -421,7 +427,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) {
......@@ -451,7 +458,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);
......@@ -467,21 +475,23 @@ 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;
......@@ -516,25 +526,26 @@ static inline void *comedi_aux_data(int options[], int n)
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);
#ifdef CONFIG_COMEDI_PCI_DRIVERS
#define CONFIG_COMEDI_PCI
#define CONFIG_COMEDI_PCI
#endif
#ifdef CONFIG_COMEDI_PCI_DRIVERS_MODULE
#define CONFIG_COMEDI_PCI
#define CONFIG_COMEDI_PCI
#endif
#ifdef CONFIG_COMEDI_PCMCIA_DRIVERS
#define CONFIG_COMEDI_PCMCIA
#define CONFIG_COMEDI_PCMCIA
#endif
#ifdef CONFIG_COMEDI_PCMCIA_DRIVERS_MODULE
#define CONFIG_COMEDI_PCMCIA
#define CONFIG_COMEDI_PCMCIA
#endif
#endif /* _COMEDIDEV_H */
......@@ -58,29 +58,31 @@ int comedi_fileno(void *dev);
int comedi_cancel(void *dev, unsigned int subdev);
int comedi_register_callback(void *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(void *dev, struct comedi_cmd *cmd);
int comedi_command_test(void *dev, struct comedi_cmd *cmd);
int comedi_trigger(void *dev, unsigned int subdev, struct comedi_trig *it);
int __comedi_trigger(void *dev, unsigned int subdev, struct comedi_trig *it);
int comedi_data_write(void *dev, unsigned int subdev, unsigned int chan,
unsigned int range, unsigned int aref, unsigned int data);
unsigned int range, unsigned int aref, unsigned int data);
int comedi_data_read(void *dev, unsigned int subdev, unsigned int chan,
unsigned int range, unsigned int aref, unsigned int *data);
unsigned int range, unsigned int aref, unsigned int *data);
int comedi_data_read_hint(void *dev, unsigned int subdev,
unsigned int chan, unsigned int range, unsigned int aref);
int comedi_data_read_delayed(void *dev, unsigned int subdev,
unsigned int chan, unsigned int range, unsigned int aref,
unsigned int *data, unsigned int nano_sec);
unsigned int chan, unsigned int range,
unsigned int aref);
int comedi_data_read_delayed(void *dev, unsigned int subdev, unsigned int chan,
unsigned int range, unsigned int aref,
unsigned int *data, unsigned int nano_sec);
int comedi_dio_config(void *dev, unsigned int subdev, unsigned int chan,
unsigned int io);
unsigned int io);
int comedi_dio_read(void *dev, unsigned int subdev, unsigned int chan,
unsigned int *val);
unsigned int *val);
int comedi_dio_write(void *dev, unsigned int subdev, unsigned int chan,
unsigned int val);
unsigned int val);
int comedi_dio_bitfield(void *dev, unsigned int subdev, unsigned int mask,
unsigned int *bits);
unsigned int *bits);
int comedi_get_n_subdevices(void *dev);
int comedi_get_version_code(void *dev);
const char *comedi_get_driver_name(void *dev);
......@@ -89,31 +91,29 @@ int comedi_get_subdevice_type(void *dev, unsigned int subdevice);
int comedi_find_subdevice_by_type(void *dev, int type, unsigned int subd);
int comedi_get_n_channels(void *dev, unsigned int subdevice);
unsigned int comedi_get_maxdata(void *dev, unsigned int subdevice, unsigned
int chan);
int comedi_get_n_ranges(void *dev, unsigned int subdevice, unsigned int
chan);
int chan);
int comedi_get_n_ranges(void *dev, unsigned int subdevice, unsigned int chan);
int comedi_do_insn(void *dev, struct comedi_insn *insn);
int comedi_poll(void *dev, unsigned int subdev);
/* DEPRECATED functions */
int comedi_get_rangetype(void *dev, unsigned int subdevice,
unsigned int chan);
int comedi_get_rangetype(void *dev, unsigned int subdevice, unsigned int chan);
/* ALPHA functions */
unsigned int comedi_get_subdevice_flags(void *dev, unsigned int subdevice);
int comedi_get_len_chanlist(void *dev, unsigned int subdevice);
int comedi_get_krange(void *dev, unsigned int subdevice, unsigned int
chan, unsigned int range, struct comedi_krange *krange);
chan, unsigned int range, struct comedi_krange *krange);
unsigned int comedi_get_buf_head_pos(void *dev, unsigned int subdevice);
int comedi_set_user_int_count(void *dev, unsigned int subdevice,
unsigned int buf_user_count);
unsigned int buf_user_count);
int comedi_map(void *dev, unsigned int subdev, void *ptr);
int comedi_unmap(void *dev, unsigned int subdev);
int comedi_get_buffer_size(void *dev, unsigned int subdev);
int comedi_mark_buffer_read(void *dev, unsigned int subdevice,
unsigned int num_bytes);
unsigned int num_bytes);
int comedi_mark_buffer_written(void *d, unsigned int subdevice,
unsigned int num_bytes);
unsigned int num_bytes);
int comedi_get_buffer_contents(void *dev, unsigned int subdevice);
int comedi_get_buffer_offset(void *dev, unsigned int subdevice);
......@@ -135,53 +135,56 @@ int comedi_unlock(unsigned int minor, unsigned int subdev);
int comedi_cancel(unsigned int minor, unsigned int subdev);
int comedi_register_callback(unsigned int minor, unsigned int subdev,
unsigned int mask, int (*cb) (unsigned int, void *), void *arg);
unsigned int mask, int (*cb) (unsigned int,
void *), void *arg);
int comedi_command(unsigned int minor, struct comedi_cmd *cmd);
int comedi_command_test(unsigned int minor, struct comedi_cmd *cmd);
int comedi_trigger(unsigned int minor, unsigned int subdev, struct comedi_trig *it);
int __comedi_trigger(unsigned int minor, unsigned int subdev, struct comedi_trig *it);
int comedi_trigger(unsigned int minor, unsigned int subdev,
struct comedi_trig *it);
int __comedi_trigger(unsigned int minor, unsigned int subdev,
struct comedi_trig *it);
int comedi_data_write(unsigned int dev, unsigned int subdev, unsigned int chan,
unsigned int range, unsigned int aref, unsigned int data);
unsigned int range, unsigned int aref, unsigned int data);
int comedi_data_read(unsigned int dev, unsigned int subdev, unsigned int chan,
unsigned int range, unsigned int aref, unsigned int *data);
unsigned int range, unsigned int aref, unsigned int *data);
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,
unsigned int *val);
unsigned int *val);
int comedi_dio_write(unsigned int dev, unsigned int subdev, unsigned int chan,
unsigned int val);
unsigned int val);
int comedi_dio_bitfield(unsigned int dev, unsigned int subdev,
unsigned int mask, unsigned int *bits);
unsigned int mask, unsigned int *bits);
int comedi_get_n_subdevices(unsigned int dev);
int comedi_get_version_code(unsigned int dev);
char *comedi_get_driver_name(unsigned int dev);
char *comedi_get_board_name(unsigned int minor);
int comedi_get_subdevice_type(unsigned int minor, unsigned int subdevice);
int comedi_find_subdevice_by_type(unsigned int minor, int type,
unsigned int subd);
unsigned int subd);
int comedi_get_n_channels(unsigned int minor, unsigned int subdevice);
unsigned int 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
chan);
chan);
int comedi_do_insn(unsigned int minor, struct comedi_insn *insn);
int comedi_poll(unsigned int minor, unsigned int subdev);
/* DEPRECATED functions */
int comedi_get_rangetype(unsigned int minor, unsigned int subdevice,
unsigned int chan);
unsigned int chan);
/* ALPHA functions */
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_krange(unsigned int minor, unsigned int subdevice, unsigned int
chan, unsigned int range, struct comedi_krange *krange);
chan, unsigned int range, struct comedi_krange *krange);
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,
unsigned int buf_user_count);
unsigned int buf_user_count);
int comedi_map(unsigned int minor, unsigned int subdev, void **ptr);
int comedi_unmap(unsigned int minor, unsigned int subdev);
......
This diff is collapsed.
......@@ -29,8 +29,10 @@
#define i8253_cascade_ns_to_timer i8253_cascade_ns_to_timer_2div
static inline void i8253_cascade_ns_to_timer_2div_old(int i8253_osc_base,
unsigned int *d1, unsigned int *d2, unsigned int *nanosec,
int round_mode)
unsigned int *d1,
unsigned int *d2,
unsigned int *nanosec,
int round_mode)
{
int divider;
int div1, div2;
......@@ -78,8 +80,10 @@ static inline void i8253_cascade_ns_to_timer_2div_old(int i8253_osc_base,
}
static inline void i8253_cascade_ns_to_timer_power(int i8253_osc_base,
unsigned int *d1, unsigned int *d2, unsigned int *nanosec,
int round_mode)
unsigned int *d1,
unsigned int *d2,
unsigned int *nanosec,
int round_mode)
{
int div1, div2;
int base;
......@@ -118,8 +122,10 @@ static inline void i8253_cascade_ns_to_timer_power(int i8253_osc_base,
}
static inline void i8253_cascade_ns_to_timer_2div(int i8253_osc_base,
unsigned int *d1, unsigned int *d2, unsigned int *nanosec,
int round_mode)
unsigned int *d1,
unsigned int *d2,
unsigned int *nanosec,
int round_mode)
{
unsigned int divider;
unsigned int div1, div2;
......@@ -136,12 +142,11 @@ static inline void i8253_cascade_ns_to_timer_2div(int i8253_osc_base,
div2 = *d2 ? *d2 : max_count;
divider = div1 * div2;
if (div1 * div2 * i8253_osc_base == *nanosec &&
div1 > 1 && div1 <= max_count &&
div2 > 1 && div2 <= max_count &&
/* check for overflow */
divider > div1 && divider > div2 &&
divider * i8253_osc_base > divider &&
divider * i8253_osc_base > i8253_osc_base) {
div1 > 1 && div1 <= max_count && div2 > 1 && div2 <= max_count &&
/* check for overflow */
divider > div1 && divider > div2 &&
divider * i8253_osc_base > divider &&
divider * i8253_osc_base > i8253_osc_base) {
return;
}
......@@ -158,10 +163,10 @@ static inline void i8253_cascade_ns_to_timer_2div(int i8253_osc_base,
if (start < 2)
start = 2;
for (div1 = start; div1 <= divider / div1 + 1 && div1 <= max_count;
div1++) {
div1++) {
for (div2 = divider / div1;
div1 * div2 <= divider + div1 + 1 && div2 <= max_count;
div2++) {
div1 * div2 <= divider + div1 + 1 && div2 <= max_count;
div2++) {
ns = i8253_osc_base * div1 * div2;
if (ns <= *nanosec && ns > ns_glb) {
ns_glb = ns;
......@@ -229,7 +234,8 @@ static inline void i8253_cascade_ns_to_timer_2div(int i8253_osc_base,
#define i8254_control_reg 3
static inline int i8254_load(unsigned long base_address, unsigned int regshift,
unsigned int counter_number, unsigned int count, unsigned int mode)
unsigned int counter_number, unsigned int count,
unsigned int mode)
{
unsigned int byte;
......@@ -255,7 +261,8 @@ static inline int i8254_load(unsigned long base_address, unsigned int regshift,
}
static inline int i8254_mm_load(void *base_address, unsigned int regshift,
unsigned int counter_number, unsigned int count, unsigned int mode)
unsigned int counter_number, unsigned int count,
unsigned int mode)
{
unsigned int byte;
......@@ -282,7 +289,7 @@ static inline int i8254_mm_load(void *base_address, unsigned int regshift,
/* Returns 16 bit counter value, should work for 8253 also.*/
static inline int i8254_read(unsigned long base_address, unsigned int regshift,
unsigned int counter_number)
unsigned int counter_number)
{
unsigned int byte;
int ret;
......@@ -303,7 +310,7 @@ static inline int i8254_read(unsigned long base_address, unsigned int regshift,
}
static inline int i8254_mm_read(void *base_address, unsigned int regshift,
unsigned int counter_number)
unsigned int counter_number)
{
unsigned int byte;
int ret;
......@@ -325,7 +332,8 @@ static inline int i8254_mm_read(void *base_address, unsigned int regshift,
/* Loads 16 bit initial counter value, should work for 8253 also. */
static inline void i8254_write(unsigned long base_address,
unsigned int regshift, unsigned int counter_number, unsigned int count)
unsigned int regshift,
unsigned int counter_number, unsigned int count)
{
unsigned int byte;
......@@ -339,7 +347,9 @@ static inline void i8254_write(unsigned long base_address,
}
static inline void i8254_mm_write(void *base_address,
unsigned int regshift, unsigned int counter_number, unsigned int count)
unsigned int regshift,
unsigned int counter_number,
unsigned int count)
{
unsigned int byte;
......@@ -360,7 +370,8 @@ static inline void i8254_mm_write(void *base_address,
* I8254_BCD, I8254_BINARY
*/
static inline int i8254_set_mode(unsigned long base_address,
unsigned int regshift, unsigned int counter_number, unsigned int mode)
unsigned int regshift,
unsigned int counter_number, unsigned int mode)
{
unsigned int byte;
......@@ -378,7 +389,9 @@ static inline int i8254_set_mode(unsigned long base_address,
}
static inline int i8254_mm_set_mode(void *base_address,
unsigned int regshift, unsigned int counter_number, unsigned int mode)
unsigned int regshift,
unsigned int counter_number,
unsigned int mode)
{
unsigned int byte;
......@@ -396,18 +409,20 @@ static inline int i8254_mm_set_mode(void *base_address,
}
static inline int i8254_status(unsigned long base_address,
unsigned int regshift, unsigned int counter_number)
unsigned int regshift,
unsigned int counter_number)
{
outb(0xE0 | (2 << counter_number),
base_address + (i8254_control_reg << regshift));
base_address + (i8254_control_reg << regshift));
return inb(base_address + (counter_number << regshift));
}
static inline int i8254_mm_status(void *base_address,
unsigned int regshift, unsigned int counter_number)
unsigned int regshift,
unsigned int counter_number)
{
writeb(0xE0 | (2 << counter_number),
base_address + (i8254_control_reg << regshift));
base_address + (i8254_control_reg << regshift));
return readb(base_address + (counter_number << regshift));
}
......
......@@ -105,7 +105,8 @@ struct subdev_8255_struct {
#define CALLBACK_FUNC (((struct subdev_8255_struct *)s->private)->cb_func)
#define subdevpriv ((struct subdev_8255_struct *)s->private)
static int dev_8255_attach(struct comedi_device *dev, struct comedi_devconfig * it);
static int dev_8255_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static int dev_8255_detach(struct comedi_device *dev);
static struct comedi_driver driver_8255 = {
.driver_name = "8255",
......@@ -116,9 +117,10 @@ static struct comedi_driver driver_8255 = {
COMEDI_INITCLEANUP(driver_8255);
static void do_config(struct comedi_device *dev, struct comedi_subdevice * s);
static void do_config(struct comedi_device *dev, struct comedi_subdevice *s);
void subdev_8255_interrupt(struct comedi_device *dev, struct comedi_subdevice * s)
void subdev_8255_interrupt(struct comedi_device *dev,
struct comedi_subdevice *s)
{
short d;
......@@ -143,8 +145,9 @@ static int subdev_8255_cb(int dir, int port, int data, unsigned long arg)
}
}
static int subdev_8255_insn(struct comedi_device *dev, struct comedi_subdevice * s,
struct comedi_insn *insn, unsigned int *data)
static int subdev_8255_insn(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
if (data[0]) {
s->state &= ~data[0];
......@@ -152,13 +155,13 @@ static int subdev_8255_insn(struct comedi_device *dev, struct comedi_subdevice *
if (data[0] & 0xff)
CALLBACK_FUNC(1, _8255_DATA, s->state & 0xff,
CALLBACK_ARG);
CALLBACK_ARG);
if (data[0] & 0xff00)
CALLBACK_FUNC(1, _8255_DATA + 1, (s->state >> 8) & 0xff,
CALLBACK_ARG);
CALLBACK_ARG);
if (data[0] & 0xff0000)
CALLBACK_FUNC(1, _8255_DATA + 2,
(s->state >> 16) & 0xff, CALLBACK_ARG);
(s->state >> 16) & 0xff, CALLBACK_ARG);
}
data[1] = CALLBACK_FUNC(0, _8255_DATA, 0, CALLBACK_ARG);
......@@ -168,8 +171,9 @@ static int subdev_8255_insn(struct comedi_device *dev, struct comedi_subdevice *
return 2;
}
static int subdev_8255_insn_config(struct comedi_device *dev, struct comedi_subdevice * s,
struct comedi_insn *insn, unsigned int *data)
static int subdev_8255_insn_config(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
unsigned int mask;
unsigned int bits;
......@@ -205,7 +209,7 @@ static int subdev_8255_insn_config(struct comedi_device *dev, struct comedi_subd
return 1;
}
static void do_config(struct comedi_device *dev, struct comedi_subdevice * s)
static void do_config(struct comedi_device *dev, struct comedi_subdevice *s)
{
int config;
......@@ -222,8 +226,9 @@ static void do_config(struct comedi_device *dev, struct comedi_subdevice * s)
CALLBACK_FUNC(1, _8255_CR, config, CALLBACK_ARG);
}
static int subdev_8255_cmdtest(struct comedi_device *dev, struct comedi_subdevice * s,
struct comedi_cmd *cmd)
static int subdev_8255_cmdtest(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_cmd *cmd)
{
int err = 0;
unsigned int tmp;
......@@ -297,22 +302,25 @@ static int subdev_8255_cmdtest(struct comedi_device *dev, struct comedi_subdevic
return 0;
}
static int subdev_8255_cmd(struct comedi_device *dev, struct comedi_subdevice * s)
static int subdev_8255_cmd(struct comedi_device *dev,
struct comedi_subdevice *s)
{
/* FIXME */
return 0;
}
static int subdev_8255_cancel(struct comedi_device *dev, struct comedi_subdevice * s)
static int subdev_8255_cancel(struct comedi_device *dev,
struct comedi_subdevice *s)
{
/* FIXME */
return 0;
}
int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice * s, int (*cb) (int,
int, int, unsigned long), unsigned long arg)
int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s,
int (*cb) (int, int, int, unsigned long),
unsigned long arg)
{
s->type = COMEDI_SUBD_DIO;
s->subdev_flags = SDF_READABLE | SDF_WRITABLE;
......@@ -340,8 +348,9 @@ int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice * s, int
return 0;
}
int subdev_8255_init_irq(struct comedi_device *dev, struct comedi_subdevice * s,
int (*cb) (int, int, int, unsigned long), unsigned long arg)
int subdev_8255_init_irq(struct comedi_device *dev, struct comedi_subdevice *s,
int (*cb) (int, int, int, unsigned long),
unsigned long arg)
{
int ret;
......@@ -358,7 +367,7 @@ int subdev_8255_init_irq(struct comedi_device *dev, struct comedi_subdevice * s,
return 0;
}
void subdev_8255_cleanup(struct comedi_device *dev, struct comedi_subdevice * s)
void subdev_8255_cleanup(struct comedi_device *dev, struct comedi_subdevice *s)
{
if (s->private) {
/* this test does nothing, so comment it out
......@@ -376,7 +385,8 @@ void subdev_8255_cleanup(struct comedi_device *dev, struct comedi_subdevice * s)
*/
static int dev_8255_attach(struct comedi_device *dev, struct comedi_devconfig * it)
static int dev_8255_attach(struct comedi_device *dev,
struct comedi_devconfig *it)
{
int ret;
unsigned long iobase;
......@@ -410,7 +420,7 @@ static int dev_8255_attach(struct comedi_device *dev, struct comedi_devconfig *
dev->subdevices[i].type = COMEDI_SUBD_UNUSED;
} else {
subdev_8255_init(dev, dev->subdevices + i, NULL,
iobase);
iobase);
}
}
......
......@@ -29,16 +29,20 @@
#if defined(CONFIG_COMEDI_8255) || defined(CONFIG_COMEDI_8255_MODULE)
int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s,
int (*cb) (int, int, int, unsigned long), unsigned long arg);
int (*cb) (int, int, int, unsigned long),
unsigned long arg);
int subdev_8255_init_irq(struct comedi_device *dev, struct comedi_subdevice *s,
int (*cb) (int, int, int, unsigned long), unsigned long arg);
int (*cb) (int, int, int, unsigned long),
unsigned long arg);
void subdev_8255_cleanup(struct comedi_device *dev, struct comedi_subdevice *s);
void subdev_8255_interrupt(struct comedi_device *dev, struct comedi_subdevice *s);
void subdev_8255_interrupt(struct comedi_device *dev,
struct comedi_subdevice *s);
#else
static inline int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s,
void *x, unsigned long y)
static inline int subdev_8255_init(struct comedi_device *dev,
struct comedi_subdevice *s, void *x,
unsigned long y)
{
printk("8255 support not configured -- disabling subdevice\n");
......@@ -48,7 +52,7 @@ static inline int subdev_8255_init(struct comedi_device *dev, struct comedi_subd
}
static inline void subdev_8255_cleanup(struct comedi_device *dev,
struct comedi_subdevice *s)
struct comedi_subdevice *s)
{
}
......
......@@ -22,7 +22,8 @@ Devices: [Adlink] ACL-7225b (acl7225b), [ICP] P16R16DIO (p16r16dio)
#define ACL7225_DI_LO 2 /* Digital input low byte (DI0-DI7) */
#define ACL7225_DI_HI 3 /* Digital input high byte (DI8-DI15) */
static int acl7225b_attach(struct comedi_device *dev, struct comedi_devconfig * it);
static int acl7225b_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static int acl7225b_detach(struct comedi_device *dev);
struct boardtype {
......@@ -50,8 +51,9 @@ static struct comedi_driver driver_acl7225b = {
COMEDI_INITCLEANUP(driver_acl7225b);
static int acl7225b_do_insn(struct comedi_device *dev, struct comedi_subdevice * s,
struct comedi_insn *insn, unsigned int *data)
static int acl7225b_do_insn(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
if (insn->n != 2)
return -EINVAL;
......@@ -64,26 +66,28 @@ static int acl7225b_do_insn(struct comedi_device *dev, struct comedi_subdevice *
outb(s->state & 0xff, dev->iobase + (unsigned long)s->private);
if (data[0] & 0xff00)
outb((s->state >> 8),
dev->iobase + (unsigned long)s->private + 1);
dev->iobase + (unsigned long)s->private + 1);
data[1] = s->state;
return 2;
}
static int acl7225b_di_insn(struct comedi_device *dev, struct comedi_subdevice * s,
struct comedi_insn *insn, unsigned int *data)
static int acl7225b_di_insn(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
if (insn->n != 2)
return -EINVAL;
data[1] = inb(dev->iobase + (unsigned long)s->private) |
(inb(dev->iobase + (unsigned long)s->private + 1) << 8);
(inb(dev->iobase + (unsigned long)s->private + 1) << 8);
return 2;
}
static int acl7225b_attach(struct comedi_device *dev, struct comedi_devconfig * it)
static int acl7225b_attach(struct comedi_device *dev,
struct comedi_devconfig *it)
{
struct comedi_subdevice *s;
int iobase, iorange;
......@@ -91,7 +95,7 @@ static int acl7225b_attach(struct comedi_device *dev, struct comedi_devconfig *
iobase = it->options[0];
iorange = this_board->io_range;
printk("comedi%d: acl7225b: board=%s 0x%04x ", dev->minor,
this_board->name, iobase);
this_board->name, iobase);
if (!request_region(iobase, iorange, "acl7225b")) {
printk("I/O port conflict\n");
return -EIO;
......
......@@ -66,23 +66,23 @@ struct pci6208_board {
static const struct pci6208_board pci6208_boards[] = {
/*{
.name = "pci6208v",
.dev_id = 0x6208, // not sure
.ao_chans = 8
// , .ao_bits = 16
.name = "pci6208v",
.dev_id = 0x6208, // not sure
.ao_chans = 8
// , .ao_bits = 16
},
{
.name = "pci6216v",
.dev_id = 0x6208, // not sure
.ao_chans = 16
// , .ao_bits = 16
.name = "pci6216v",
.dev_id = 0x6208, // not sure
.ao_chans = 16
// , .ao_bits = 16
}, */
{
.name = "pci6208a",
.dev_id = 0x6208,
.ao_chans = 8
/* , .ao_bits = 16 */
}
.name = "pci6208a",
.dev_id = 0x6208,
.ao_chans = 8
/* , .ao_bits = 16 */
}
};
/* This is used by modprobe to translate PCI IDs to drivers. Should
......@@ -90,8 +90,9 @@ static const struct pci6208_board pci6208_boards[] = {
static DEFINE_PCI_DEVICE_TABLE(pci6208_pci_table) = {
/* { PCI_VENDOR_ID_ADLINK, 0x6208, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, */
/* { PCI_VENDOR_ID_ADLINK, 0x6208, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, */
{PCI_VENDOR_ID_ADLINK, 0x6208, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{0}
{
PCI_VENDOR_ID_ADLINK, 0x6208, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
0}
};
MODULE_DEVICE_TABLE(pci, pci6208_pci_table);
......@@ -107,7 +108,8 @@ struct pci6208_private {
#define devpriv ((struct pci6208_private *)dev->private)
static int pci6208_attach(struct comedi_device *dev, struct comedi_devconfig *it);
static int pci6208_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static int pci6208_detach(struct comedi_device *dev);
static struct comedi_driver driver_pci6208 = {
......@@ -122,13 +124,15 @@ COMEDI_PCI_INITCLEANUP(driver_pci6208, pci6208_pci_table);
static int pci6208_find_device(struct comedi_device *dev, int bus, int slot);
static int
pci6208_pci_setup(struct pci_dev *pci_dev, unsigned long *io_base_ptr,
int dev_minor);
int dev_minor);
/*read/write functions*/
static int pci6208_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data);
static int pci6208_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data);
static int pci6208_ao_winsn(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data);
static int pci6208_ao_rinsn(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data);
/* static int pci6208_dio_insn_bits(struct comedi_device *dev,struct comedi_subdevice *s, */
/* struct comedi_insn *insn,unsigned int *data); */
/* static int pci6208_dio_insn_config(struct comedi_device *dev,struct comedi_subdevice *s, */
......@@ -140,7 +144,8 @@ static int pci6208_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *
* in the driver structure, dev->board_ptr contains that
* address.
*/
static int pci6208_attach(struct comedi_device *dev, struct comedi_devconfig *it)
static int pci6208_attach(struct comedi_device *dev,
struct comedi_devconfig *it)
{
struct comedi_subdevice *s;
int retval;
......@@ -217,8 +222,9 @@ static int pci6208_detach(struct comedi_device *dev)
return 0;
}
static int pci6208_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
static int pci6208_ao_winsn(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
int i = 0, Data_Read;
unsigned short chan = CR_CHAN(insn->chanspec);
......@@ -242,8 +248,9 @@ static int pci6208_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *
/* AO subdevices should have a read insn as well as a write insn.
* Usually this means copying a value stored in devpriv. */
static int pci6208_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
static int pci6208_ao_rinsn(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
int i;
int chan = CR_CHAN(insn->chanspec);
......@@ -309,8 +316,8 @@ static int pci6208_find_device(struct comedi_device *dev, int bus, int slot)
int i;
for (pci_dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL);
pci_dev != NULL;
pci_dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pci_dev)) {
pci_dev != NULL;
pci_dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pci_dev)) {
if (pci_dev->vendor == PCI_VENDOR_ID_ADLINK) {
for (i = 0; i < ARRAY_SIZE(pci6208_boards); i++) {
if (pci6208_boards[i].dev_id == pci_dev->device) {
......@@ -318,9 +325,9 @@ static int pci6208_find_device(struct comedi_device *dev, int bus, int slot)
if ((bus != 0) || (slot != 0)) {
/* are we on the wrong bus/slot? */
if (pci_dev->bus->number
!= bus ||
PCI_SLOT(pci_dev->devfn)
!= slot) {
!= bus ||
PCI_SLOT(pci_dev->devfn)
!= slot) {
continue;
}
}
......@@ -332,16 +339,16 @@ static int pci6208_find_device(struct comedi_device *dev, int bus, int slot)
}
printk("comedi%d: no supported board found! (req. bus/slot : %d/%d)\n",
dev->minor, bus, slot);
dev->minor, bus, slot);
return -EIO;
found:
found:
printk("comedi%d: found %s (b:s:f=%d:%d:%d) , irq=%d\n",
dev->minor,
pci6208_boards[i].name,
pci_dev->bus->number,
PCI_SLOT(pci_dev->devfn),
PCI_FUNC(pci_dev->devfn), pci_dev->irq);
dev->minor,
pci6208_boards[i].name,
pci_dev->bus->number,
PCI_SLOT(pci_dev->devfn),
PCI_FUNC(pci_dev->devfn), pci_dev->irq);
/* TODO: Warn about non-tested boards. */
/* switch(board->device_id) */
......@@ -355,13 +362,15 @@ static int pci6208_find_device(struct comedi_device *dev, int bus, int slot)
static int
pci6208_pci_setup(struct pci_dev *pci_dev, unsigned long *io_base_ptr,
int dev_minor)
int dev_minor)
{
unsigned long io_base, io_range, lcr_io_base, lcr_io_range;
/* Enable PCI device and request regions */
if (comedi_pci_enable(pci_dev, PCI6208_DRIVER_NAME) < 0) {
printk("comedi%d: Failed to enable PCI device and request regions\n", dev_minor);
printk
("comedi%d: Failed to enable PCI device and request regions\n",
dev_minor);
return -EIO;
}
/* Read local configuration register base address [PCI_BASE_ADDRESS #1]. */
......@@ -369,14 +378,14 @@ pci6208_pci_setup(struct pci_dev *pci_dev, unsigned long *io_base_ptr,
lcr_io_range = pci_resource_len(pci_dev, 1);
printk("comedi%d: local config registers at address 0x%4lx [0x%4lx]\n",
dev_minor, lcr_io_base, lcr_io_range);
dev_minor, lcr_io_base, lcr_io_range);
/* Read PCI6208 register base address [PCI_BASE_ADDRESS #2]. */
io_base = pci_resource_start(pci_dev, 2);
io_range = pci_resource_end(pci_dev, 2) - io_base + 1;
printk("comedi%d: 6208 registers at address 0x%4lx [0x%4lx]\n",
dev_minor, io_base, io_range);
dev_minor, io_base, io_range);
*io_base_ptr = io_base;
/* devpriv->io_range = io_range; */
......
......@@ -49,9 +49,10 @@ Configuration Options:
#define PCI_DEVICE_ID_PCI7296 0x7296
static DEFINE_PCI_DEVICE_TABLE(adl_pci7296_pci_table) = {
{PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7296, PCI_ANY_ID, PCI_ANY_ID, 0,
0, 0},
{0}
{
PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7296, PCI_ANY_ID,
PCI_ANY_ID, 0, 0, 0}, {
0}
};
MODULE_DEVICE_TABLE(pci, adl_pci7296_pci_table);
......@@ -61,10 +62,10 @@ struct adl_pci7296_private {
struct pci_dev *pci_dev;
};
#define devpriv ((struct adl_pci7296_private *)dev->private)
static int adl_pci7296_attach(struct comedi_device *dev, struct comedi_devconfig *it);
static int adl_pci7296_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static int adl_pci7296_detach(struct comedi_device *dev);
static struct comedi_driver driver_adl_pci7296 = {
.driver_name = "adl_pci7296",
......@@ -73,7 +74,8 @@ static struct comedi_driver driver_adl_pci7296 = {
.detach = adl_pci7296_detach,
};
static int adl_pci7296_attach(struct comedi_device *dev, struct comedi_devconfig *it)
static int adl_pci7296_attach(struct comedi_device *dev,
struct comedi_devconfig *it)
{
struct pci_dev *pcidev;
struct comedi_subdevice *s;
......@@ -94,21 +96,23 @@ static int adl_pci7296_attach(struct comedi_device *dev, struct comedi_devconfig
return -ENOMEM;
for (pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL);
pcidev != NULL;
pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) {
pcidev != NULL;
pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) {
if (pcidev->vendor == PCI_VENDOR_ID_ADLINK &&
pcidev->device == PCI_DEVICE_ID_PCI7296) {
pcidev->device == PCI_DEVICE_ID_PCI7296) {
if (bus || slot) {
/* requested particular bus/slot */
if (pcidev->bus->number != bus
|| PCI_SLOT(pcidev->devfn) != slot) {
|| PCI_SLOT(pcidev->devfn) != slot) {
continue;
}
}
devpriv->pci_dev = pcidev;
if (comedi_pci_enable(pcidev, "adl_pci7296") < 0) {
printk("comedi%d: Failed to enable PCI device and request regions\n", dev->minor);
printk
("comedi%d: Failed to enable PCI device and request regions\n",
dev->minor);
return -EIO;
}
......@@ -118,23 +122,26 @@ static int adl_pci7296_attach(struct comedi_device *dev, struct comedi_devconfig
/* four 8255 digital io subdevices */
s = dev->subdevices + 0;
subdev_8255_init(dev, s, NULL,
(unsigned long)(dev->iobase));
(unsigned long)(dev->iobase));
s = dev->subdevices + 1;
ret = subdev_8255_init(dev, s, NULL,
(unsigned long)(dev->iobase + PORT2A));
(unsigned long)(dev->iobase +
PORT2A));
if (ret < 0)
return ret;
s = dev->subdevices + 2;
ret = subdev_8255_init(dev, s, NULL,
(unsigned long)(dev->iobase + PORT3A));
(unsigned long)(dev->iobase +
PORT3A));
if (ret < 0)
return ret;
s = dev->subdevices + 3;
ret = subdev_8255_init(dev, s, NULL,
(unsigned long)(dev->iobase + PORT4A));
(unsigned long)(dev->iobase +
PORT4A));
if (ret < 0)
return ret;
......@@ -145,7 +152,7 @@ static int adl_pci7296_attach(struct comedi_device *dev, struct comedi_devconfig
}
printk("comedi%d: no supported board found! (req. bus/slot : %d/%d)\n",
dev->minor, bus, slot);
dev->minor, bus, slot);
return -EIO;
}
......
......@@ -44,9 +44,10 @@ Configuration Options:
#define PCI_DEVICE_ID_PCI7432 0x7432
static DEFINE_PCI_DEVICE_TABLE(adl_pci7432_pci_table) = {
{PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7432, PCI_ANY_ID, PCI_ANY_ID, 0,
0, 0},
{0}
{
PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7432, PCI_ANY_ID,
PCI_ANY_ID, 0, 0, 0}, {
0}
};
MODULE_DEVICE_TABLE(pci, adl_pci7432_pci_table);
......@@ -58,7 +59,8 @@ struct adl_pci7432_private {
#define devpriv ((struct adl_pci7432_private *)dev->private)
static int adl_pci7432_attach(struct comedi_device *dev, struct comedi_devconfig *it);
static int adl_pci7432_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static int adl_pci7432_detach(struct comedi_device *dev);
static struct comedi_driver driver_adl_pci7432 = {
.driver_name = "adl_pci7432",
......@@ -69,15 +71,20 @@ static struct comedi_driver driver_adl_pci7432 = {
/* Digital IO */
static int adl_pci7432_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data);
static int adl_pci7432_di_insn_bits(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data);
static int adl_pci7432_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data);
static int adl_pci7432_do_insn_bits(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data);
/* */
static int adl_pci7432_attach(struct comedi_device *dev, struct comedi_devconfig *it)
static int adl_pci7432_attach(struct comedi_device *dev,
struct comedi_devconfig *it)
{
struct pci_dev *pcidev;
struct comedi_subdevice *s;
......@@ -97,21 +104,23 @@ static int adl_pci7432_attach(struct comedi_device *dev, struct comedi_devconfig
return -ENOMEM;
for (pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL);
pcidev != NULL;
pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) {
pcidev != NULL;
pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) {
if (pcidev->vendor == PCI_VENDOR_ID_ADLINK &&
pcidev->device == PCI_DEVICE_ID_PCI7432) {
pcidev->device == PCI_DEVICE_ID_PCI7432) {
if (bus || slot) {
/* requested particular bus/slot */
if (pcidev->bus->number != bus
|| PCI_SLOT(pcidev->devfn) != slot) {
|| PCI_SLOT(pcidev->devfn) != slot) {
continue;
}
}
devpriv->pci_dev = pcidev;
if (comedi_pci_enable(pcidev, "adl_pci7432") < 0) {
printk("comedi%d: Failed to enable PCI device and request regions\n", dev->minor);
printk
("comedi%d: Failed to enable PCI device and request regions\n",
dev->minor);
return -EIO;
}
dev->iobase = pci_resource_start(pcidev, 2);
......@@ -120,7 +129,7 @@ static int adl_pci7432_attach(struct comedi_device *dev, struct comedi_devconfig
s = dev->subdevices + 0;
s->type = COMEDI_SUBD_DI;
s->subdev_flags =
SDF_READABLE | SDF_GROUND | SDF_COMMON;
SDF_READABLE | SDF_GROUND | SDF_COMMON;
s->n_chan = 32;
s->maxdata = 1;
s->len_chanlist = 32;
......@@ -131,7 +140,7 @@ static int adl_pci7432_attach(struct comedi_device *dev, struct comedi_devconfig
s = dev->subdevices + 1;
s->type = COMEDI_SUBD_DO;
s->subdev_flags =
SDF_WRITABLE | SDF_GROUND | SDF_COMMON;
SDF_WRITABLE | SDF_GROUND | SDF_COMMON;
s->n_chan = 32;
s->maxdata = 1;
s->len_chanlist = 32;
......@@ -146,7 +155,7 @@ static int adl_pci7432_attach(struct comedi_device *dev, struct comedi_devconfig
}
printk("comedi%d: no supported board found! (req. bus/slot : %d/%d)\n",
dev->minor, bus, slot);
dev->minor, bus, slot);
return -EIO;
}
......@@ -164,8 +173,10 @@ static int adl_pci7432_detach(struct comedi_device *dev)
return 0;
}
static int adl_pci7432_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
static int adl_pci7432_do_insn_bits(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{
printk("comedi: pci7432_do_insn_bits called\n");
printk("comedi: data0: %8x data1: %8x\n", data[0], data[1]);
......@@ -178,14 +189,16 @@ static int adl_pci7432_do_insn_bits(struct comedi_device *dev, struct comedi_sub
s->state |= (data[0] & data[1]);
printk("comedi: out: %8x on iobase %4lx\n", s->state,
dev->iobase + PCI7432_DO);
dev->iobase + PCI7432_DO);
outl(s->state & 0xffffffff, dev->iobase + PCI7432_DO);
}
return 2;
}
static int adl_pci7432_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
static int adl_pci7432_di_insn_bits(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{
printk("comedi: pci7432_di_insn_bits called\n");
printk("comedi: data0: %8x data1: %8x\n", data[0], data[1]);
......
......@@ -56,9 +56,10 @@ Configuration Options:
#define PCI_DEVICE_ID_PCI8164 0x8164
static DEFINE_PCI_DEVICE_TABLE(adl_pci8164_pci_table) = {
{PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI8164, PCI_ANY_ID, PCI_ANY_ID, 0,
0, 0},
{0}
{
PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI8164, PCI_ANY_ID,
PCI_ANY_ID, 0, 0, 0}, {
0}
};
MODULE_DEVICE_TABLE(pci, adl_pci8164_pci_table);
......@@ -70,7 +71,8 @@ struct adl_pci8164_private {
#define devpriv ((struct adl_pci8164_private *)dev->private)
static int adl_pci8164_attach(struct comedi_device *dev, struct comedi_devconfig *it);
static int adl_pci8164_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static int adl_pci8164_detach(struct comedi_device *dev);
static struct comedi_driver driver_adl_pci8164 = {
.driver_name = "adl_pci8164",
......@@ -79,31 +81,48 @@ static struct comedi_driver driver_adl_pci8164 = {
.detach = adl_pci8164_detach,
};
static int adl_pci8164_insn_read_msts(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data);
static int adl_pci8164_insn_read_msts(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data);
static int adl_pci8164_insn_read_ssts(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data);
static int adl_pci8164_insn_read_ssts(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data);
static int adl_pci8164_insn_read_buf0(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data);
static int adl_pci8164_insn_read_buf0(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data);
static int adl_pci8164_insn_read_buf1(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data);
static int adl_pci8164_insn_read_buf1(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data);
static int adl_pci8164_insn_write_cmd(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data);
static int adl_pci8164_insn_write_cmd(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data);
static int adl_pci8164_insn_write_otp(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data);
static int adl_pci8164_insn_write_otp(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data);
static int adl_pci8164_insn_write_buf0(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data);
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data);
static int adl_pci8164_insn_write_buf1(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data);
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data);
static int adl_pci8164_attach(struct comedi_device *dev, struct comedi_devconfig *it)
static int adl_pci8164_attach(struct comedi_device *dev,
struct comedi_devconfig *it)
{
struct pci_dev *pcidev;
struct comedi_subdevice *s;
......@@ -123,21 +142,23 @@ static int adl_pci8164_attach(struct comedi_device *dev, struct comedi_devconfig
return -ENOMEM;
for (pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL);
pcidev != NULL;
pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) {
pcidev != NULL;
pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) {
if (pcidev->vendor == PCI_VENDOR_ID_ADLINK &&
pcidev->device == PCI_DEVICE_ID_PCI8164) {
pcidev->device == PCI_DEVICE_ID_PCI8164) {
if (bus || slot) {
/* requested particular bus/slot */
if (pcidev->bus->number != bus
|| PCI_SLOT(pcidev->devfn) != slot) {
|| PCI_SLOT(pcidev->devfn) != slot) {
continue;
}
}
devpriv->pci_dev = pcidev;
if (comedi_pci_enable(pcidev, "adl_pci8164") < 0) {
printk("comedi%d: Failed to enable PCI device and request regions\n", dev->minor);
printk
("comedi%d: Failed to enable PCI device and request regions\n",
dev->minor);
return -EIO;
}
dev->iobase = pci_resource_start(pcidev, 2);
......@@ -190,7 +211,7 @@ static int adl_pci8164_attach(struct comedi_device *dev, struct comedi_devconfig
}
printk("comedi%d: no supported board found! (req. bus/slot : %d/%d)\n",
dev->minor, bus, slot);
dev->minor, bus, slot);
return -EIO;
}
......@@ -216,8 +237,7 @@ static void adl_pci8164_insn_read(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data,
char *action,
unsigned short offset)
char *action, unsigned short offset)
{
int axis, axis_reg;
char *axisname;
......@@ -247,8 +267,8 @@ static void adl_pci8164_insn_read(struct comedi_device *dev,
}
data[0] = inw(dev->iobase + axis_reg + offset);
printk("comedi: pci8164 %s read -> %04X:%04X on axis %s\n", action, data[0],
data[1], axisname);
printk("comedi: pci8164 %s read -> %04X:%04X on axis %s\n", action,
data[0], data[1], axisname);
}
static int adl_pci8164_insn_read_msts(struct comedi_device *dev,
......@@ -260,22 +280,28 @@ static int adl_pci8164_insn_read_msts(struct comedi_device *dev,
return 2;
}
static int adl_pci8164_insn_read_ssts(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
static int adl_pci8164_insn_read_ssts(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{
adl_pci8164_insn_read(dev, s, insn, data, "SSTS", PCI8164_SSTS);
return 2;
}
static int adl_pci8164_insn_read_buf0(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
static int adl_pci8164_insn_read_buf0(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{
adl_pci8164_insn_read(dev, s, insn, data, "BUF0", PCI8164_BUF0);
return 2;
}
static int adl_pci8164_insn_read_buf1(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
static int adl_pci8164_insn_read_buf1(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{
adl_pci8164_insn_read(dev, s, insn, data, "BUF1", PCI8164_BUF1);
return 2;
......@@ -286,11 +312,10 @@ static int adl_pci8164_insn_read_buf1(struct comedi_device *dev, struct comedi_s
* const to the data for outw()
*/
static void adl_pci8164_insn_out(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data,
char *action,
unsigned short offset)
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data,
char *action, unsigned short offset)
{
unsigned int axis, axis_reg;
......@@ -327,30 +352,37 @@ static void adl_pci8164_insn_out(struct comedi_device *dev,
}
static int adl_pci8164_insn_write_cmd(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
static int adl_pci8164_insn_write_cmd(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{
adl_pci8164_insn_out(dev, s, insn, data, "CMD", PCI8164_CMD);
return 2;
}
static int adl_pci8164_insn_write_otp(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
static int adl_pci8164_insn_write_otp(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{
adl_pci8164_insn_out(dev, s, insn, data, "OTP", PCI8164_OTP);
return 2;
}
static int adl_pci8164_insn_write_buf0(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{
adl_pci8164_insn_out(dev, s, insn, data, "BUF0", PCI8164_BUF0);
return 2;
}
static int adl_pci8164_insn_write_buf1(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{
adl_pci8164_insn_out(dev, s, insn, data, "BUF1", PCI8164_BUF1);
return 2;
......
This diff is collapsed.
......@@ -95,8 +95,8 @@ TODO:
/* static unsigned short pci_list_builded=0; =1 list of card is know */
static const struct comedi_lrange range_pci1723 = { 1, {
BIP_RANGE(10)
}
BIP_RANGE(10)
}
};
/*
......@@ -116,23 +116,24 @@ struct pci1723_board {
static const struct pci1723_board boardtypes[] = {
{
.name = "pci1723",
.vendor_id = ADVANTECH_VENDOR,
.device_id = 0x1723,
.iorange = IORANGE_1723,
.cardtype = TYPE_PCI1723,
.n_aochan = 8,
.n_diochan = 16,
.ao_maxdata = 0xffff,
.rangelist_ao = &range_pci1723,
},
.name = "pci1723",
.vendor_id = ADVANTECH_VENDOR,
.device_id = 0x1723,
.iorange = IORANGE_1723,
.cardtype = TYPE_PCI1723,
.n_aochan = 8,
.n_diochan = 16,
.ao_maxdata = 0xffff,
.rangelist_ao = &range_pci1723,
},
};
/* This is used by modprobe to translate PCI IDs to drivers. Should
* only be used for PCI and ISA-PnP devices */
static DEFINE_PCI_DEVICE_TABLE(pci1723_pci_table) = {
{PCI_VENDOR_ID_ADVANTECH, 0x1723, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
{0}
{
PCI_VENDOR_ID_ADVANTECH, 0x1723, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {
0}
};
MODULE_DEVICE_TABLE(pci, pci1723_pci_table);
......@@ -143,7 +144,8 @@ MODULE_DEVICE_TABLE(pci, pci1723_pci_table);
* the board, and also about the kernel module that contains
* the device code.
*/
static int pci1723_attach(struct comedi_device *dev, struct comedi_devconfig *it);
static int pci1723_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static int pci1723_detach(struct comedi_device *dev);
#define n_boardtypes (sizeof(boardtypes)/sizeof(struct pci1723_board))
......@@ -189,7 +191,7 @@ static int pci1723_reset(struct comedi_device *dev)
/* set all ranges to +/- 10V */
devpriv->da_range[i] = 0;
outw(((devpriv->da_range[i] << 4) | i),
PCI1723_RANGE_CALIBRATION_MODE);
PCI1723_RANGE_CALIBRATION_MODE);
}
outw(0, dev->iobase + PCI1723_CHANGE_CHA_OUTPUT_TYPE_STROBE); /* update ranges */
......@@ -202,8 +204,9 @@ static int pci1723_reset(struct comedi_device *dev)
return 0;
}
static int pci1723_insn_read_ao(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
static int pci1723_insn_read_ao(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
int n, chan;
......@@ -218,8 +221,9 @@ static int pci1723_insn_read_ao(struct comedi_device *dev, struct comedi_subdevi
/*
analog data output;
*/
static int pci1723_ao_write_winsn(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
static int pci1723_ao_write_winsn(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
int n, chan;
chan = CR_CHAN(insn->chanspec);
......@@ -238,8 +242,9 @@ static int pci1723_ao_write_winsn(struct comedi_device *dev, struct comedi_subde
/*
digital i/o config/query
*/
static int pci1723_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
static int pci1723_dio_insn_config(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
unsigned int mask;
unsigned int bits;
......@@ -278,8 +283,9 @@ static int pci1723_dio_insn_config(struct comedi_device *dev, struct comedi_subd
/*
digital i/o bits read/write
*/
static int pci1723_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
static int pci1723_dio_insn_bits(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
if (data[0]) {
s->state &= ~data[0];
......@@ -294,7 +300,8 @@ static int pci1723_dio_insn_bits(struct comedi_device *dev, struct comedi_subdev
* Attach is called by the Comedi core to configure the driver
* for a pci1723 board.
*/
static int pci1723_attach(struct comedi_device *dev, struct comedi_devconfig *it)
static int pci1723_attach(struct comedi_device *dev,
struct comedi_devconfig *it)
{
struct comedi_subdevice *s;
int ret, subdev, n_subdevices;
......@@ -304,8 +311,7 @@ static int pci1723_attach(struct comedi_device *dev, struct comedi_devconfig *it
int opt_bus, opt_slot;
const char *errstr;
printk("comedi%d: adv_pci1723: board=%s", dev->minor,
this_board->name);
printk("comedi%d: adv_pci1723: board=%s", dev->minor, this_board->name);
opt_bus = it->options[0];
opt_slot = it->options[1];
......@@ -321,12 +327,12 @@ static int pci1723_attach(struct comedi_device *dev, struct comedi_devconfig *it
pcidev = NULL;
while (NULL != (pcidev =
pci_get_device(PCI_VENDOR_ID_ADVANTECH,
this_board->device_id, pcidev))) {
this_board->device_id, pcidev))) {
/* Found matching vendor/device. */
if (opt_bus || opt_slot) {
/* Check bus/slot. */
if (opt_bus != pcidev->bus->number
|| opt_slot != PCI_SLOT(pcidev->devfn))
|| opt_slot != PCI_SLOT(pcidev->devfn))
continue; /* no match */
}
/*
......@@ -334,7 +340,8 @@ static int pci1723_attach(struct comedi_device *dev, struct comedi_devconfig *it
* Enable PCI device and request regions.
*/
if (comedi_pci_enable(pcidev, "adv_pci1723")) {
errstr = "failed to enable PCI device and request regions!";
errstr =
"failed to enable PCI device and request regions!";
continue;
}
break;
......@@ -343,7 +350,7 @@ static int pci1723_attach(struct comedi_device *dev, struct comedi_devconfig *it
if (!pcidev) {
if (opt_bus || opt_slot) {
printk(" - Card at b:s %d:%d %s\n",
opt_bus, opt_slot, errstr);
opt_bus, opt_slot, errstr);
} else {
printk(" - Card %s\n", errstr);
}
......@@ -356,7 +363,7 @@ static int pci1723_attach(struct comedi_device *dev, struct comedi_devconfig *it
iobase = pci_resource_start(pcidev, 2);
printk(", b:s:f=%d:%d:%d, io=0x%4x", pci_bus, pci_slot, pci_func,
iobase);
iobase);
dev->iobase = iobase;
......@@ -416,7 +423,7 @@ static int pci1723_attach(struct comedi_device *dev, struct comedi_devconfig *it
s = dev->subdevices + subdev;
s->type = COMEDI_SUBD_DIO;
s->subdev_flags =
SDF_READABLE | SDF_WRITABLE | SDF_GROUND | SDF_COMMON;
SDF_READABLE | SDF_WRITABLE | SDF_GROUND | SDF_COMMON;
s->n_chan = this_board->n_diochan;
s->maxdata = 1;
s->len_chanlist = this_board->n_diochan;
......
......@@ -77,7 +77,7 @@ struct aio12_8_boardtype {
static const struct aio12_8_boardtype board_types[] = {
{
.name = "aio_aio12_8"},
.name = "aio_aio12_8"},
};
#define thisboard ((const struct aio12_8_boardtype *) dev->board_ptr)
......@@ -88,13 +88,14 @@ struct aio12_8_private {
#define devpriv ((struct aio12_8_private *) dev->private)
static int aio_aio12_8_ai_read(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
static int aio_aio12_8_ai_read(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
int n;
unsigned char control =
ADC_MODE_NORMAL |
(CR_RANGE(insn->chanspec) << 3) | CR_CHAN(insn->chanspec);
ADC_MODE_NORMAL |
(CR_RANGE(insn->chanspec) << 3) | CR_CHAN(insn->chanspec);
/* read status to clear EOC latch */
inb(dev->iobase + AIO12_8_STATUS);
......@@ -107,7 +108,7 @@ static int aio_aio12_8_ai_read(struct comedi_device *dev, struct comedi_subdevic
/* Wait for conversion to complete */
while (timeout &&
!(inb(dev->iobase + AIO12_8_STATUS) & STATUS_ADC_EOC)) {
!(inb(dev->iobase + AIO12_8_STATUS) & STATUS_ADC_EOC)) {
timeout--;
printk("timeout %d\n", timeout);
udelay(1);
......@@ -122,8 +123,9 @@ static int aio_aio12_8_ai_read(struct comedi_device *dev, struct comedi_subdevic
return n;
}
static int aio_aio12_8_ao_read(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
static int aio_aio12_8_ao_read(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
int i;
int val = devpriv->ao_readback[CR_CHAN(insn->chanspec)];
......@@ -133,8 +135,9 @@ static int aio_aio12_8_ao_read(struct comedi_device *dev, struct comedi_subdevic
return insn->n;
}
static int aio_aio12_8_ao_write(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
static int aio_aio12_8_ao_write(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
int i;
int chan = CR_CHAN(insn->chanspec);
......@@ -154,14 +157,15 @@ static int aio_aio12_8_ao_write(struct comedi_device *dev, struct comedi_subdevi
static const struct comedi_lrange range_aio_aio12_8 = {
4,
{
UNI_RANGE(5),
BIP_RANGE(5),
UNI_RANGE(10),
BIP_RANGE(10),
}
UNI_RANGE(5),
BIP_RANGE(5),
UNI_RANGE(10),
BIP_RANGE(10),
}
};
static int aio_aio12_8_attach(struct comedi_device *dev, struct comedi_devconfig *it)
static int aio_aio12_8_attach(struct comedi_device *dev,
struct comedi_devconfig *it)
{
int iobase;
struct comedi_subdevice *s;
......
......@@ -52,9 +52,9 @@ struct aio_iiro_16_board {
static const struct aio_iiro_16_board aio_iiro_16_boards[] = {
{
.name = "aio_iiro_16",
.di = 16,
.do_ = 16},
.name = "aio_iiro_16",
.di = 16,
.do_ = 16},
};
#define thisboard ((const struct aio_iiro_16_board *) dev->board_ptr)
......@@ -67,7 +67,8 @@ struct aio_iiro_16_private {
#define devpriv ((struct aio_iiro_16_private *) dev->private)
static int aio_iiro_16_attach(struct comedi_device *dev, struct comedi_devconfig *it);
static int aio_iiro_16_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static int aio_iiro_16_detach(struct comedi_device *dev);
......@@ -82,12 +83,17 @@ static struct comedi_driver driver_aio_iiro_16 = {
};
static int aio_iiro_16_dio_insn_bits_read(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data);
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data);
static int aio_iiro_16_dio_insn_bits_write(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data);
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data);
static int aio_iiro_16_attach(struct comedi_device *dev, struct comedi_devconfig *it)
static int aio_iiro_16_attach(struct comedi_device *dev,
struct comedi_devconfig *it)
{
int iobase;
struct comedi_subdevice *s;
......@@ -143,7 +149,9 @@ static int aio_iiro_16_detach(struct comedi_device *dev)
}
static int aio_iiro_16_dio_insn_bits_write(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{
if (insn->n != 2)
return -EINVAL;
......@@ -153,7 +161,7 @@ static int aio_iiro_16_dio_insn_bits_write(struct comedi_device *dev,
s->state |= data[0] & data[1];
outb(s->state & 0xff, dev->iobase + AIO_IIRO_16_RELAY_0_7);
outb((s->state >> 8) & 0xff,
dev->iobase + AIO_IIRO_16_RELAY_8_15);
dev->iobase + AIO_IIRO_16_RELAY_8_15);
}
data[1] = s->state;
......@@ -162,7 +170,9 @@ static int aio_iiro_16_dio_insn_bits_write(struct comedi_device *dev,
}
static int aio_iiro_16_dio_insn_bits_read(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{
if (insn->n != 2)
return -EINVAL;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -42,8 +42,8 @@ static void increment_scan_progress(struct comedi_subdevice *subd,
}
/* Writes an array of data points to comedi's buffer */
unsigned int cfc_write_array_to_buffer(struct comedi_subdevice *subd, void *data,
unsigned int num_bytes)
unsigned int cfc_write_array_to_buffer(struct comedi_subdevice *subd,
void *data, unsigned int num_bytes)
{
struct comedi_async *async = subd->async;
unsigned int retval;
......@@ -65,10 +65,11 @@ unsigned int cfc_write_array_to_buffer(struct comedi_subdevice *subd, void *data
return num_bytes;
}
EXPORT_SYMBOL(cfc_write_array_to_buffer);
unsigned int cfc_read_array_from_buffer(struct comedi_subdevice *subd, void *data,
unsigned int num_bytes)
unsigned int cfc_read_array_from_buffer(struct comedi_subdevice *subd,
void *data, unsigned int num_bytes)
{
struct comedi_async *async = subd->async;
......@@ -83,9 +84,11 @@ unsigned int cfc_read_array_from_buffer(struct comedi_subdevice *subd, void *dat
return num_bytes;
}
EXPORT_SYMBOL(cfc_read_array_from_buffer);
unsigned int cfc_handle_events(struct comedi_device *dev, struct comedi_subdevice *subd)
unsigned int cfc_handle_events(struct comedi_device *dev,
struct comedi_subdevice *subd)
{
unsigned int events = subd->async->events;
......@@ -99,6 +102,7 @@ unsigned int cfc_handle_events(struct comedi_device *dev, struct comedi_subdevic
return events;
}
EXPORT_SYMBOL(cfc_handle_events);
MODULE_AUTHOR("Frank Mori Hess <fmhess@users.sourceforge.net>");
......
......@@ -40,8 +40,8 @@ static inline unsigned int cfc_write_to_buffer(struct comedi_subdevice *subd,
return cfc_write_array_to_buffer(subd, &data, sizeof(data));
};
static inline unsigned int cfc_write_long_to_buffer(struct comedi_subdevice *subd,
unsigned int data)
static inline unsigned int cfc_write_long_to_buffer(struct comedi_subdevice
*subd, unsigned int data)
{
return cfc_write_array_to_buffer(subd, &data, sizeof(data));
};
......
This diff is collapsed.
......@@ -28,7 +28,8 @@ enum das08_bustype { isa, pci, pcmcia, pc104 };
/* different ways ai data is encoded in first two registers */
enum das08_ai_encoding { das08_encode12, das08_encode16, das08_pcm_encode12 };
enum das08_lrange { das08_pg_none, das08_bipolar5, das08_pgh, das08_pgl,
das08_pgm };
das08_pgm
};
struct das08_board_struct {
const char *name;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -60,7 +60,8 @@ addition, the clock does not seem to be very accurate.
#define DT2814_ENB 0x10
#define DT2814_CHANMASK 0x0f
static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it);
static int dt2814_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static int dt2814_detach(struct comedi_device *dev);
static struct comedi_driver driver_dt2814 = {
.driver_name = "dt2814",
......@@ -84,8 +85,9 @@ struct dt2814_private {
#define DT2814_TIMEOUT 10
#define DT2814_MAX_SPEED 100000 /* Arbitrary 10 khz limit */
static int dt2814_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
static int dt2814_ai_insn_read(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
int n, i, hi, lo;
int chan;
......@@ -135,8 +137,8 @@ static int dt2814_ns_to_timer(unsigned int *ns, unsigned int flags)
return i;
}
static int dt2814_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_cmd *cmd)
static int dt2814_ai_cmdtest(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_cmd *cmd)
{
int err = 0;
int tmp;
......@@ -234,8 +236,8 @@ static int dt2814_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
int trigvar;
trigvar =
dt2814_ns_to_timer(&cmd->scan_begin_arg,
cmd->flags & TRIG_ROUND_MASK);
dt2814_ns_to_timer(&cmd->scan_begin_arg,
cmd->flags & TRIG_ROUND_MASK);
chan = CR_CHAN(cmd->chanlist[0]);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment