1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef _UIO_DRIVER_H_
15#define _UIO_DRIVER_H_
16
17#include <linux/module.h>
18#include <linux/fs.h>
19#include <linux/interrupt.h>
20
21struct uio_map;
22
23
24
25
26
27
28
29
30
31
32struct uio_mem {
33 const char *name;
34 unsigned long addr;
35 unsigned long size;
36 int memtype;
37 void __iomem *internal_addr;
38 struct uio_map *map;
39};
40
41#define MAX_UIO_MAPS 5
42
43struct uio_portio;
44
45
46
47
48
49
50
51
52
53struct uio_port {
54 const char *name;
55 unsigned long start;
56 unsigned long size;
57 int porttype;
58 struct uio_portio *portio;
59};
60
61#define MAX_UIO_PORT_REGIONS 5
62
63struct uio_device;
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81struct uio_info {
82 struct uio_device *uio_dev;
83 const char *name;
84 const char *version;
85 struct uio_mem mem[MAX_UIO_MAPS];
86 struct uio_port port[MAX_UIO_PORT_REGIONS];
87 long irq;
88 unsigned long irq_flags;
89 void *priv;
90 irqreturn_t (*handler)(int irq, struct uio_info *dev_info);
91 int (*mmap)(struct uio_info *info, struct vm_area_struct *vma);
92 int (*open)(struct uio_info *info, struct inode *inode);
93 int (*release)(struct uio_info *info, struct inode *inode);
94 int (*irqcontrol)(struct uio_info *info, s32 irq_on);
95};
96
97extern int __must_check
98 __uio_register_device(struct module *owner,
99 struct device *parent,
100 struct uio_info *info);
101static inline int __must_check
102 uio_register_device(struct device *parent, struct uio_info *info)
103{
104 return __uio_register_device(THIS_MODULE, parent, info);
105}
106extern void uio_unregister_device(struct uio_info *info);
107extern void uio_event_notify(struct uio_info *info);
108
109
110#define UIO_IRQ_CUSTOM -1
111#define UIO_IRQ_NONE 0
112
113
114#define UIO_MEM_NONE 0
115#define UIO_MEM_PHYS 1
116#define UIO_MEM_LOGICAL 2
117#define UIO_MEM_VIRTUAL 3
118
119
120#define UIO_PORT_NONE 0
121#define UIO_PORT_X86 1
122#define UIO_PORT_GPIO 2
123#define UIO_PORT_OTHER 3
124
125#endif
126