kbdmap.h revision 1.6 1 1.6 christos /* $NetBSD: kbdmap.h,v 1.6 2005/12/11 12:16:54 christos Exp $ */
2 1.1 leo
3 1.1 leo /*
4 1.1 leo * Copyright (c) 1993 Markus Wild
5 1.1 leo * All rights reserved.
6 1.1 leo *
7 1.1 leo * Redistribution and use in source and binary forms, with or without
8 1.1 leo * modification, are permitted provided that the following conditions
9 1.1 leo * are met:
10 1.1 leo * 1. Redistributions of source code must retain the above copyright
11 1.1 leo * notice, this list of conditions and the following disclaimer.
12 1.1 leo * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 leo * notice, this list of conditions and the following disclaimer in the
14 1.1 leo * documentation and/or other materials provided with the distribution.
15 1.1 leo * 3. All advertising materials mentioning features or use of this software
16 1.1 leo * must display the following acknowledgement:
17 1.1 leo * This product includes software developed by Markus Wild.
18 1.1 leo * 4. The name of the author may not be used to endorse or promote products
19 1.1 leo * derived from this software without specific prior written permission
20 1.1 leo *
21 1.1 leo * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 1.1 leo * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 1.1 leo * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 1.1 leo * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 1.1 leo * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 1.1 leo * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 1.1 leo * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 1.1 leo * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 1.1 leo * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 1.1 leo * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 1.1 leo */
32 1.1 leo
33 1.5 he #ifndef _MACHINE_KBDMAP_H_
34 1.5 he #define _MACHINE_KBDMAP_H_
35 1.5 he
36 1.1 leo #define NUL 0
37 1.1 leo #define SOH 1
38 1.1 leo #define STX 2
39 1.1 leo #define ETX 3
40 1.1 leo #define EOT 4
41 1.1 leo #define ENQ 5
42 1.1 leo #define ACK 6
43 1.1 leo #define BEL 7
44 1.1 leo #define BS 8
45 1.1 leo #define HT 9
46 1.1 leo #define LF 10
47 1.1 leo #define VT 11
48 1.1 leo #define FF 12
49 1.1 leo #define CR 13
50 1.1 leo #define SO 14
51 1.1 leo #define SI 15
52 1.1 leo #define DLE 16
53 1.1 leo #define DC1 17
54 1.1 leo #define DC2 18
55 1.1 leo #define DC3 19
56 1.1 leo #define DC4 20
57 1.1 leo #define NAK 21
58 1.1 leo #define SYN 22
59 1.1 leo #define ETB 23
60 1.1 leo #define CAN 24
61 1.1 leo #define EM 25
62 1.1 leo #define SUB 26
63 1.1 leo #define ESC 27
64 1.1 leo #define FS 28
65 1.1 leo #define GS 29
66 1.1 leo #define RS 30
67 1.1 leo #define US 31
68 1.1 leo #define DEL 127
69 1.1 leo #define IND 132
70 1.1 leo #define NEL 133
71 1.1 leo #define SSA 134
72 1.1 leo #define ESA 135
73 1.1 leo #define HTS 136
74 1.1 leo #define HTJ 137
75 1.1 leo #define VTS 138
76 1.1 leo #define PLD 139
77 1.1 leo #define PLU 140
78 1.1 leo #define RI 141
79 1.1 leo #define SS2 142
80 1.1 leo #define SS3 143
81 1.1 leo #define DCS 144
82 1.1 leo #define PU1 145
83 1.1 leo #define PU2 146
84 1.1 leo #define STS 147
85 1.1 leo #define CCH 148
86 1.1 leo #define MW 149
87 1.1 leo #define SPA 150
88 1.1 leo #define EPA 151
89 1.1 leo #define CSI 155
90 1.1 leo #define ST 156
91 1.1 leo #define OSC 157
92 1.1 leo #define PM 158
93 1.1 leo #define APC 159
94 1.1 leo
95 1.1 leo
96 1.1 leo /*
97 1.1 leo * A total of 0x80 scancode are defined for the atari keyboard.
98 1.1 leo */
99 1.1 leo #define KBD_NUM_KEYS 0x80
100 1.1 leo
101 1.1 leo /* size of string table */
102 1.1 leo #define KBD_STRTAB_SIZE 255
103 1.1 leo
104 1.1 leo /* for dead keys, index into acctable */
105 1.1 leo /* FIXME: What the hell are dead keys?? */
106 1.1 leo #define KBD_ACC_GRAVE 0
107 1.1 leo #define KBD_ACC_ACUTE 1
108 1.1 leo #define KBD_ACC_CIRC 2
109 1.1 leo #define KBD_ACC_TILDE 3
110 1.1 leo #define KBD_ACC_DIER 4
111 1.1 leo #define KBD_NUM_ACC 5
112 1.1 leo
113 1.1 leo
114 1.1 leo struct key {
115 1.1 leo unsigned char mode; /* see possible values below */
116 1.1 leo unsigned char code;
117 1.1 leo };
118 1.1 leo
119 1.1 leo #define KBD_MODE_STRING (0x01) /* code is index into strings[] */
120 1.1 leo #define KBD_MODE_DEAD (0x02) /* acc-index in upper nibble, code = plain acc */
121 1.1 leo #define KBD_MODE_CAPS (0x04) /* key is capsable. Only in non-shifted maps */
122 1.1 leo #define KBD_MODE_KPAD (0x08) /* key is on keypad */
123 1.1 leo #define KBD_MODE_GRAVE (KBD_ACC_GRAVE << 4)
124 1.1 leo #define KBD_MODE_ACUTE (KBD_ACC_ACUTE << 4)
125 1.1 leo #define KBD_MODE_CIRC (KBD_ACC_CIRC << 4)
126 1.1 leo #define KBD_MODE_TILDE (KBD_ACC_TILDE << 4)
127 1.1 leo #define KBD_MODE_DIER (KBD_ACC_DIER << 4)
128 1.1 leo #define KBD_MODE_ACCENT(m) ((m) >> 4) /* get accent from mode */
129 1.1 leo #define KBD_MODE_ACCMASK (0xf0)
130 1.1 leo
131 1.1 leo #define KBD_SCANCODE(code) (code & 0x7f)
132 1.1 leo #define KBD_RELEASED(code) (code & 0x80 ? 1 : 0)
133 1.4 leo #define KBD_IS_KEY(code) ((u_char)(code) < 0xf6)
134 1.1 leo
135 1.1 leo struct kbdmap {
136 1.1 leo struct key keys[KBD_NUM_KEYS],
137 1.1 leo shift_keys[KBD_NUM_KEYS],
138 1.1 leo alt_keys[KBD_NUM_KEYS],
139 1.1 leo alt_shift_keys[KBD_NUM_KEYS];
140 1.1 leo unsigned char strings[KBD_STRTAB_SIZE];
141 1.1 leo };
142 1.1 leo
143 1.1 leo
144 1.2 leo #ifdef _KERNEL
145 1.1 leo /* XXX: ITE interface */
146 1.3 leo extern struct kbdmap ascii_kbdmap;
147 1.1 leo extern unsigned char acctable[KBD_NUM_ACC][64];
148 1.1 leo #endif
149 1.5 he
150 1.5 he #endif /* _MACHINE_KBDMAP_H_ */
151