Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
uio_driver.h
Go to the documentation of this file.
1 /*
2  * include/linux/uio_driver.h
3  *
4  * Copyright(C) 2005, Benedikt Spranger <[email protected]>
5  * Copyright(C) 2005, Thomas Gleixner <[email protected]>
6  * Copyright(C) 2006, Hans J. Koch <[email protected]>
7  * Copyright(C) 2006, Greg Kroah-Hartman <[email protected]>
8  *
9  * Userspace IO driver.
10  *
11  * Licensed under the GPLv2 only.
12  */
13 
14 #ifndef _UIO_DRIVER_H_
15 #define _UIO_DRIVER_H_
16 
17 #include <linux/fs.h>
18 #include <linux/interrupt.h>
19 
20 struct module;
21 struct uio_map;
22 
35 struct uio_mem {
36  const char *name;
38  unsigned long size;
39  int memtype;
41  struct uio_map *map;
42 };
43 
44 #define MAX_UIO_MAPS 5
45 
46 struct uio_portio;
47 
56 struct uio_port {
57  const char *name;
58  unsigned long start;
59  unsigned long size;
60  int porttype;
61  struct uio_portio *portio;
62 };
63 
64 #define MAX_UIO_PORT_REGIONS 5
65 
66 struct uio_device;
67 
84 struct uio_info {
86  const char *name;
87  const char *version;
90  long irq;
91  unsigned long irq_flags;
92  void *priv;
94  int (*mmap)(struct uio_info *info, struct vm_area_struct *vma);
95  int (*open)(struct uio_info *info, struct inode *inode);
96  int (*release)(struct uio_info *info, struct inode *inode);
97  int (*irqcontrol)(struct uio_info *info, s32 irq_on);
98 };
99 
100 extern int __must_check
102  struct device *parent,
103  struct uio_info *info);
104 
105 /* use a define to avoid include chaining to get THIS_MODULE */
106 #define uio_register_device(parent, info) \
107  __uio_register_device(THIS_MODULE, parent, info)
108 
109 extern void uio_unregister_device(struct uio_info *info);
110 extern void uio_event_notify(struct uio_info *info);
111 
112 /* defines for uio_info->irq */
113 #define UIO_IRQ_CUSTOM -1
114 #define UIO_IRQ_NONE 0
115 
116 /* defines for uio_mem->memtype */
117 #define UIO_MEM_NONE 0
118 #define UIO_MEM_PHYS 1
119 #define UIO_MEM_LOGICAL 2
120 #define UIO_MEM_VIRTUAL 3
121 
122 /* defines for uio_port->porttype */
123 #define UIO_PORT_NONE 0
124 #define UIO_PORT_X86 1
125 #define UIO_PORT_GPIO 2
126 #define UIO_PORT_OTHER 3
127 
128 #endif /* _LINUX_UIO_DRIVER_H_ */