Rev 422 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
422 | giacomo | 1 | #ifndef _SERIO_H |
2 | #define _SERIO_H |
||
3 | |||
4 | /* |
||
5 | * Copyright (C) 1999-2002 Vojtech Pavlik |
||
6 | * |
||
7 | * This program is free software; you can redistribute it and/or modify it |
||
8 | * under the terms of the GNU General Public License version 2 as published by |
||
9 | * the Free Software Foundation. |
||
10 | */ |
||
11 | |||
12 | #include <linux/ioctl.h> |
||
13 | #include <linux/interrupt.h> |
||
14 | |||
15 | #define SPIOCSTYPE _IOW('q', 0x01, unsigned long) |
||
16 | |||
17 | #ifdef __KERNEL__ |
||
18 | |||
19 | #include <linux/list.h> |
||
20 | |||
21 | struct serio { |
||
22 | void *private; |
||
23 | void *driver; |
||
24 | char *name; |
||
25 | char *phys; |
||
26 | |||
27 | unsigned short idbus; |
||
28 | unsigned short idvendor; |
||
29 | unsigned short idproduct; |
||
30 | unsigned short idversion; |
||
31 | |||
32 | unsigned long type; |
||
33 | unsigned long event; |
||
34 | |||
35 | int (*write)(struct serio *, unsigned char); |
||
36 | int (*open)(struct serio *); |
||
37 | void (*close)(struct serio *); |
||
38 | |||
39 | struct serio_dev *dev; |
||
40 | |||
41 | struct list_head node; |
||
42 | }; |
||
43 | |||
44 | struct serio_dev { |
||
45 | void *private; |
||
46 | char *name; |
||
47 | |||
48 | void (*write_wakeup)(struct serio *); |
||
49 | irqreturn_t (*interrupt)(struct serio *, unsigned char, |
||
50 | unsigned int, struct pt_regs *); |
||
51 | void (*connect)(struct serio *, struct serio_dev *dev); |
||
52 | void (*disconnect)(struct serio *); |
||
53 | void (*cleanup)(struct serio *); |
||
54 | |||
55 | struct list_head node; |
||
56 | }; |
||
57 | |||
58 | int serio_open(struct serio *serio, struct serio_dev *dev); |
||
59 | void serio_close(struct serio *serio); |
||
60 | void serio_rescan(struct serio *serio); |
||
61 | irqreturn_t serio_interrupt(struct serio *serio, unsigned char data, unsigned int flags, struct pt_regs *regs); |
||
62 | |||
63 | void serio_register_port(struct serio *serio); |
||
64 | void serio_register_slave_port(struct serio *serio); |
||
65 | void serio_unregister_port(struct serio *serio); |
||
66 | void serio_unregister_slave_port(struct serio *serio); |
||
67 | void serio_register_device(struct serio_dev *dev); |
||
68 | void serio_unregister_device(struct serio_dev *dev); |
||
69 | |||
70 | static __inline__ int serio_write(struct serio *serio, unsigned char data) |
||
71 | { |
||
72 | if (serio->write) |
||
73 | return serio->write(serio, data); |
||
74 | else |
||
75 | return -1; |
||
76 | } |
||
77 | |||
78 | static __inline__ void serio_dev_write_wakeup(struct serio *serio) |
||
79 | { |
||
80 | if (serio->dev && serio->dev->write_wakeup) |
||
81 | serio->dev->write_wakeup(serio); |
||
82 | } |
||
83 | |||
84 | static __inline__ void serio_cleanup(struct serio *serio) |
||
85 | { |
||
86 | if (serio->dev && serio->dev->cleanup) |
||
87 | serio->dev->cleanup(serio); |
||
88 | } |
||
89 | |||
90 | #endif |
||
91 | |||
92 | /* |
||
93 | * bit masks for use in "interrupt" flags (3rd argument) |
||
94 | */ |
||
95 | #define SERIO_TIMEOUT 1 |
||
96 | #define SERIO_PARITY 2 |
||
97 | #define SERIO_FRAME 4 |
||
98 | |||
99 | #define SERIO_TYPE 0xff000000UL |
||
100 | #define SERIO_XT 0x00000000UL |
||
101 | #define SERIO_8042 0x01000000UL |
||
102 | #define SERIO_RS232 0x02000000UL |
||
103 | #define SERIO_HIL_MLC 0x03000000UL |
||
104 | #define SERIO_PC9800 0x04000000UL |
||
105 | #define SERIO_PS_PSTHRU 0x05000000UL |
||
106 | #define SERIO_8042_XL 0x06000000UL |
||
107 | |||
108 | #define SERIO_PROTO 0xFFUL |
||
109 | #define SERIO_MSC 0x01 |
||
110 | #define SERIO_SUN 0x02 |
||
111 | #define SERIO_MS 0x03 |
||
112 | #define SERIO_MP 0x04 |
||
113 | #define SERIO_MZ 0x05 |
||
114 | #define SERIO_MZP 0x06 |
||
115 | #define SERIO_MZPP 0x07 |
||
116 | #define SERIO_SUNKBD 0x10 |
||
117 | #define SERIO_WARRIOR 0x18 |
||
118 | #define SERIO_SPACEORB 0x19 |
||
119 | #define SERIO_MAGELLAN 0x1a |
||
120 | #define SERIO_SPACEBALL 0x1b |
||
121 | #define SERIO_GUNZE 0x1c |
||
122 | #define SERIO_IFORCE 0x1d |
||
123 | #define SERIO_STINGER 0x1e |
||
124 | #define SERIO_NEWTON 0x1f |
||
125 | #define SERIO_STOWAWAY 0x20 |
||
126 | #define SERIO_H3600 0x21 |
||
127 | #define SERIO_PS2SER 0x22 |
||
128 | #define SERIO_TWIDKBD 0x23 |
||
129 | #define SERIO_TWIDJOY 0x24 |
||
130 | #define SERIO_HIL 0x25 |
||
131 | #define SERIO_SNES232 0x26 |
||
132 | #define SERIO_SEMTECH 0x27 |
||
133 | |||
134 | #define SERIO_ID 0xff00UL |
||
135 | #define SERIO_EXTRA 0xff0000UL |
||
136 | |||
137 | #endif |