5 * Copyright (C) 1999-2002 Vojtech Pavlik
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.
12 #include <linux/ioctl.h>
13 #include <linux/interrupt.h>
15 #define SPIOCSTYPE _IOW('q', 0x01, unsigned long)
19 #include <linux/list.h>
31 unsigned short idvendor
;
32 unsigned short idproduct
;
33 unsigned short idversion
;
38 int (*write
)(struct serio
*, unsigned char);
39 int (*open
)(struct serio
*);
40 void (*close
)(struct serio
*);
42 struct serio_dev
*dev
;
44 struct list_head node
;
52 void (*write_wakeup
)(struct serio
*);
53 irqreturn_t (*interrupt
)(struct serio
*, unsigned char,
54 unsigned int, struct pt_regs
*);
55 void (*connect
)(struct serio
*, struct serio_dev
*dev
);
56 void (*disconnect
)(struct serio
*);
57 void (*cleanup
)(struct serio
*);
59 struct list_head node
;
62 int serio_open(struct serio
*serio
, struct serio_dev
*dev
);
63 void serio_close(struct serio
*serio
);
64 void serio_rescan(struct serio
*serio
);
65 irqreturn_t
serio_interrupt(struct serio
*serio
, unsigned char data
, unsigned int flags
, struct pt_regs
*regs
);
67 void serio_register_port(struct serio
*serio
);
68 void serio_unregister_port(struct serio
*serio
);
69 void serio_register_device(struct serio_dev
*dev
);
70 void serio_unregister_device(struct serio_dev
*dev
);
72 static __inline__
int serio_write(struct serio
*serio
, unsigned char data
)
75 return serio
->write(serio
, data
);
80 static __inline__
void serio_dev_write_wakeup(struct serio
*serio
)
82 if (serio
->dev
&& serio
->dev
->write_wakeup
)
83 serio
->dev
->write_wakeup(serio
);
86 static __inline__
void serio_cleanup(struct serio
*serio
)
88 if (serio
->dev
&& serio
->dev
->cleanup
)
89 serio
->dev
->cleanup(serio
);
95 * bit masks for use in "interrupt" flags (3rd argument)
97 #define SERIO_TIMEOUT 1
98 #define SERIO_PARITY 2
101 #define SERIO_TYPE 0xff000000UL
102 #define SERIO_XT 0x00000000UL
103 #define SERIO_8042 0x01000000UL
104 #define SERIO_RS232 0x02000000UL
105 #define SERIO_HIL_MLC 0x03000000UL
106 #define SERIO_PC9800 0x04000000UL
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
134 #define SERIO_ID 0xff00UL
135 #define SERIO_EXTRA 0xff0000UL