1 #ifndef _SERIO_H
2 #define _SERIO_H
3
4 /*
5 * $Id: serio.h,v 1.11 2001/05/29 02:58:50 jsimmons Exp $
6 *
7 * Copyright (C) 1999 Vojtech Pavlik
8 *
9 * Sponsored by SuSE
10 */
11
12 /*
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 *
27 * Should you need to contact me, the author, you can do so either by
28 * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
29 * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
30 */
31
32 /*
33 * The serial port set type ioctl.
34 */
35
36 #include <linux/ioctl.h>
37 #define SPIOCSTYPE _IOW('q', 0x01, unsigned long)
38
39 struct serio;
40
41 struct serio {
42
43 void *private;
44 void *driver;
45
46 unsigned long type;
47 int number;
48
49 int (*write)(struct serio *, unsigned char);
50 int (*open)(struct serio *);
51 void (*close)(struct serio *);
52
53 struct serio_dev *dev;
54
55 struct serio *next;
56 };
57
58 struct serio_dev {
59
60 void *private;
61
62 void (*interrupt)(struct serio *, unsigned char, unsigned int);
63 void (*connect)(struct serio *, struct serio_dev *dev);
64 void (*disconnect)(struct serio *);
65
66 struct serio_dev *next;
67 };
68
69 int serio_open(struct serio *serio, struct serio_dev *dev);
70 void serio_close(struct serio *serio);
71 void serio_rescan(struct serio *serio);
72
73 void serio_register_port(struct serio *serio);
74 void serio_unregister_port(struct serio *serio);
75 void serio_register_device(struct serio_dev *dev);
76 void serio_unregister_device(struct serio_dev *dev);
77
serio_write(struct serio * serio,unsigned char data)78 static __inline__ int serio_write(struct serio *serio, unsigned char data)
79 {
80 return serio->write(serio, data);
81 }
82
83 #define SERIO_TIMEOUT 1
84 #define SERIO_PARITY 2
85
86 #define SERIO_TYPE 0xff000000UL
87 #define SERIO_XT 0x00000000UL
88 #define SERIO_8042 0x01000000UL
89 #define SERIO_RS232 0x02000000UL
90 #define SERIO_HIL_MLC 0x03000000UL
91
92 #define SERIO_PROTO 0xFFUL
93 #define SERIO_MSC 0x01
94 #define SERIO_SUN 0x02
95 #define SERIO_MS 0x03
96 #define SERIO_MP 0x04
97 #define SERIO_MZ 0x05
98 #define SERIO_MZP 0x06
99 #define SERIO_MZPP 0x07
100 #define SERIO_SUNKBD 0x10
101 #define SERIO_WARRIOR 0x18
102 #define SERIO_SPACEORB 0x19
103 #define SERIO_MAGELLAN 0x1a
104 #define SERIO_SPACEBALL 0x1b
105 #define SERIO_GUNZE 0x1c
106 #define SERIO_IFORCE 0x1d
107 #define SERIO_STINGER 0x1e
108 #define SERIO_NEWTON 0x1f
109 #define SERIO_STOWAWAY 0x20
110 #define SERIO_H3600 0x21
111 #define SERIO_PS2SER 0x22
112 #define SERIO_HIL 0x25
113
114 #define SERIO_ID 0xff00UL
115 #define SERIO_EXTRA 0xff0000UL
116
117 #endif
118