summaryrefslogtreecommitdiffstats
path: root/driver/common.h
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2011-07-16 06:18:05 +0200
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2011-07-16 06:18:05 +0200
commit7ac0539951ff0eba200e64b850b5181a82915c86 (patch)
tree6d41563807fcadcbf03eb756d8d7d191d3d4446c /driver/common.h
parentb3e8d49f41b18d17b40bd8f6926d7db54981e89e (diff)
downloadipecamera-7ac0539951ff0eba200e64b850b5181a82915c86.tar.gz
ipecamera-7ac0539951ff0eba200e64b850b5181a82915c86.tar.bz2
ipecamera-7ac0539951ff0eba200e64b850b5181a82915c86.tar.xz
ipecamera-7ac0539951ff0eba200e64b850b5181a82915c86.zip
Implement DMA access synchronization in the driver
Diffstat (limited to 'driver/common.h')
-rw-r--r--driver/common.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/driver/common.h b/driver/common.h
index e45ae25..b79d5ec 100644
--- a/driver/common.h
+++ b/driver/common.h
@@ -6,6 +6,14 @@
/*************************************************************************/
/* Private data types and structures */
+#define KMEM_REF_HW 0x80000000 /**< Special reference to indicate hardware access */
+#define KMEM_REF_COUNT 0x0FFFFFFF /**< Mask of reference counter (mmap/munmap) */
+
+#define KMEM_MODE_REUSABLE 0x80000000 /**< Indicates reusable buffer */
+#define KMEM_MODE_EXCLUSIVE 0x40000000 /**< Only a single process is allowed to mmap the buffer */
+#define KMEM_MODE_PERSISTENT 0x20000000 /**< Persistent mode instructs kmem_free to preserve buffer in memory */
+#define KMEM_MODE_COUNT 0x0FFFFFFF /**< Mask of reuse counter (alloc/free) */
+
/* Define an entry in the kmem list (this list is per device) */
/* This list keeps references to the allocated kernel buffers */
typedef struct {
@@ -15,8 +23,14 @@ typedef struct {
unsigned long cpua;
unsigned long size;
unsigned long type;
+
unsigned long use;
unsigned long item;
+
+ spinlock_t lock;
+ unsigned long mode;
+ unsigned long refs;
+
struct class_device_attribute sysfs_attr; /* initialized when adding the entry */
} pcidriver_kmem_entry_t;
@@ -57,7 +71,7 @@ typedef struct {
struct list_head kmem_list; /* List of 'kmem_list_entry's associated with this device */
atomic_t kmem_count; /* id for next kmem entry */
- pcidriver_kmem_entry_t *kmem_cur; /* Currently selected kmem buffer, for mmap */
+ 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 */