summaryrefslogtreecommitdiffstats
path: root/driver/dev.h
diff options
context:
space:
mode:
authorVasilii Chernov <vchernov@inr.ru>2016-03-03 10:34:49 +0100
committerVasilii Chernov <vchernov@inr.ru>2016-03-03 10:34:49 +0100
commitee16e47966afe180d3c32e2b1d93301052894fac (patch)
tree56aecf261aaae57e28c08cef573ae6642ec5394d /driver/dev.h
parent02d0026e2df2ba5c68c0c1a67aec4437c9e8e8f3 (diff)
parent195c28f3074486165b6e0935362810f8a1fb9531 (diff)
downloadpcitool-ee16e47966afe180d3c32e2b1d93301052894fac.tar.gz
pcitool-ee16e47966afe180d3c32e2b1d93301052894fac.tar.bz2
pcitool-ee16e47966afe180d3c32e2b1d93301052894fac.tar.xz
pcitool-ee16e47966afe180d3c32e2b1d93301052894fac.zip
Merge with http://ufo.kit.edu/ufo/log/csa/pcitool 369 revision
Diffstat (limited to 'driver/dev.h')
-rw-r--r--driver/dev.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/driver/dev.h b/driver/dev.h
new file mode 100644
index 0000000..5e95365
--- /dev/null
+++ b/driver/dev.h
@@ -0,0 +1,52 @@
+#ifndef _PCIDRIVER_DEV_H
+#define _PCIDRIVER_DEV_H
+
+typedef struct pcidriver_privdata_s pcidriver_privdata_t;
+
+#include "kmem.h"
+#include "umem.h"
+
+
+/* Hold the driver private data */
+struct pcidriver_privdata_s {
+ int devid; /* the device id */
+ dev_t devno; /* device number (major and minor) */
+ struct pci_dev *pdev; /* PCI device */
+ struct device *class_dev; /* Class device */
+ struct cdev cdev; /* char device struct */
+ int mmap_mode; /* current mmap mode */
+ int mmap_area; /* current PCI mmap area */
+
+#ifdef ENABLE_IRQ
+ int irq_enabled; /* Non-zero if IRQ is enabled */
+ int irq_count; /* Just an IRQ counter */
+
+ wait_queue_head_t irq_queues[ PCIDRIVER_INT_MAXSOURCES ]; /* One queue per interrupt source */
+ atomic_t irq_outstanding[ PCIDRIVER_INT_MAXSOURCES ]; /* Outstanding interrupts per queue */
+ volatile unsigned int *bars_kmapped[6]; /* PCI BARs mmapped in kernel space */
+#endif
+
+ spinlock_t kmemlist_lock; /* Spinlock to lock kmem list operations */
+ struct list_head kmem_list; /* List of 'kmem_list_entry's associated with this device */
+ pcidriver_kmem_entry_t *kmem_last_sync; /* Last accessed kmem entry */
+ atomic_t kmem_count; /* id for next kmem entry */
+
+ int kmem_cur_id; /* Currently selected kmem buffer, for mmap */
+
+ spinlock_t umemlist_lock; /* Spinlock to lock umem list operations */
+ struct list_head umem_list; /* List of 'umem_list_entry's associated with this device */
+ atomic_t umem_count; /* id for next umem entry */
+
+ int msi_mode; /* Flag specifying if interrupt have been initialized in MSI mode */
+ atomic_t refs; /* Reference counter */
+};
+
+const struct file_operations *pcidriver_get_fops(void);
+
+void pcidriver_module_get(pcidriver_privdata_t *privdata);
+void pcidriver_module_put(pcidriver_privdata_t *privdata);
+
+long pcidriver_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
+
+#endif /* _PCIDRIVER_DEV_H */
+