summaryrefslogtreecommitdiff
path: root/sys/arch/macppc/dev/keyboard.h
blob: b73c1a61fd7792d612d8cbbc04994c8cdc1ec34e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
/*	$OpenBSD: keyboard.h,v 1.8 2002/05/09 09:56:57 maja Exp $	*/
/*	$NetBSD: keyboard.h,v 1.1 1998/05/15 10:15:54 tsubai Exp $	*/

/*-
 * Copyright (C) 1993	Allen K. Briggs, Chris P. Caputo,
 *			Michael L. Finch, Bradley A. Grantham, and
 *			Lawrence A. Kesteloot
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed by the Alice Group.
 * 4. The names of the Alice Group or any of its members may not be used
 *    to endorse or promote products derived from this software without
 *    specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE ALICE GROUP BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#define ADBK_LEFT	0x3B
#define ADBK_RIGHT	0x3C
#define ADBK_UP		0x3E
#define ADBK_DOWN	0x3D
#define ADBK_PGUP	0x74
#define ADBK_PGDN	0x79
#define ADBK_HOME	0x73
#define ADBK_END	0x77
#define ADBK_CONTROL	0x36
#define ADBK_FLOWER	0x37
#define ADBK_SHIFT	0x38
#define ADBK_CAPSLOCK	0x39
#define ADBK_OPTION	0x3A
#define ADBK_F		0x03
#define ADBK_O		0x1F
#define ADBK_P		0x23
#define ADBK_Q		0x0C
#define ADBK_V		0x09
#define ADBK_1		0x12
#define ADBK_2		0x13
#define ADBK_3		0x14
#define ADBK_4		0x15
#define ADBK_5		0x17
#define ADBK_6		0x16
#define ADBK_7		0x1A
#define ADBK_8		0x1C
#define ADBK_9		0x19
#define ADBK_0		0x1D

#define ADBK_KEYVAL(key)	((key) & 0x7f)
#define ADBK_PRESS(key)		(((key) & 0x80) == 0)
#define ADBK_KEYDOWN(key)	(key)
#define ADBK_KEYUP(key)		((key) | 0x80)
#define ADBK_MODIFIER(key)	((((key) & 0x7f) == ADBK_SHIFT) || \
				 (((key) & 0x7f) == ADBK_CONTROL) || \
				 (((key) & 0x7f) == ADBK_FLOWER) || \
				 (((key) & 0x7f) == ADBK_OPTION))

#ifndef KEYBOARD_ARRAY
extern unsigned char keyboard[128][4];
#else
unsigned char keyboard[128][4] = {
	  /* Scan code      Normal     Shifted     Controlled   XT */
	{ /*   0x00, */       'a',       'A',         0x01,	 30 },
	{ /*   0x01, */       's',       'S',         0x13,	 31 },
	{ /*   0x02, */       'd',       'D',         0x04,	 32 },
	{ /*   0x03, */       'f',       'F',         0x06,	 33 },
	{ /*   0x04, */       'h',       'H',         0x08,	 35 },
	{ /*   0x05, */       'g',       'G',         0x07,	 34 },
	{ /*   0x06, */       'z',       'Z',         0x1A,	 44 },
	{ /*   0x07, */       'x',       'X',         0x18,	 45 },
	{ /*   0x08, */       'c',       'C',         0x03,	 46 },
	{ /*   0x09, */       'v',       'V',         0x16,	 47 },
#ifdef FIX_SV_X_KBDBUG
	{ /*   0x0A, */      0x00,      0x00,         0x00,	 41 },
#else
	{ /*   0x0A, */      0x00,      0x00,         0x00,	 86 },
#endif
	{ /*   0x0B, */       'b',       'B',         0x02,	 48 },
	{ /*   0x0C, */       'q',       'Q',         0x11,	 16 },
	{ /*   0x0D, */       'w',       'W',         0x17,	 17 },
	{ /*   0x0E, */       'e',       'E',         0x05,	 18 },
	{ /*   0x0F, */       'r',       'R',         0x12,	 19 },
	{ /*   0x10, */       'y',       'Y',         0x19,	 21 },
	{ /*   0x11, */       't',       'T',         0x14,	 20 },
	{ /*   0x12, */       '1',       '!',         0x00,	  2 },
	{ /*   0x13, */       '2',       '@',         0x00,	  3 },
	{ /*   0x14, */       '3',       '#',         0x00,	  4 },
	{ /*   0x15, */       '4',       '$',         0x00,	  5 },
	{ /*   0x16, */       '6',       '^',         0x1E,	  7 },
	{ /*   0x17, */       '5',       '%',         0x00,	  6 },
	{ /*   0x18, */       '=',       '+',         0x00,	 13 },
	{ /*   0x19, */       '9',       '(',         0x00,	 10 },
	{ /*   0x1A, */       '7',       '&',         0x00,	  8 },
	{ /*   0x1B, */       '-',       '_',         0x1F,	 12 },
	{ /*   0x1C, */       '8',       '*',         0x00,	  9 },
	{ /*   0x1D, */       '0',       ')',         0x00,	 11 },
	{ /*   0x1E, */       ']',       '}',         0x1D,	 27 },
	{ /*   0x1F, */       'o',       'O',         0x0F,	 24 },
	{ /*   0x20, */       'u',       'U',         0x15,	 22 },
	{ /*   0x21, */       '[',       '{',         0x1B,	 26 },
	{ /*   0x22, */       'i',       'I',         0x09,	 23 },
	{ /*   0x23, */       'p',       'P',         0x10,	 25 },
	{ /*   0x24, */      0x0D,      0x0D,         0x0D,	 28 },
	{ /*   0x25, */       'l',       'L',         0x0C,	 38 },
	{ /*   0x26, */       'j',       'J',         0x0A,	 36 },
	{ /*   0x27, */       '\'',      '"',         0x00,	 40 },
	{ /*   0x28, */       'k',       'K',         0x0B,	 37 },
	{ /*   0x29, */       ';',       ':',         0x00,	 39 },
	{ /*   0x2A, */      '\\',       '|',         0x1C,	 43 },
	{ /*   0x2B, */       ',',       '<',         0x00,	 51 },
	{ /*   0x2C, */       '/',       '?',         0x00,	 53 },
	{ /*   0x2D, */       'n',       'N',         0x0E,	 49 },
	{ /*   0x2E, */       'm',       'M',         0x0D,	 50 },
	{ /*   0x2F, */       '.',       '>',         0x00,	 52 },
	{ /*   0x30, */      0x09,      0x09,         0x09,	 15 },
	{ /*   0x31, */       ' ',       ' ',         0x00,	 57 },
#ifdef FIX_SV_X_KBDBUG
	{ /*   0x32, */       '`',       '~',         0x00,	 86 },
#else
	{ /*   0x32, */       '`',       '~',         0x00,	 41 },
#endif
	{ /*   0x33, */      0x7F,      0x7F,         0x7F,	211 }, /* Delete */
	{ /*   0x34, */      0x00,      0x00,         0x00,	105 }, /* MODE/KP_Enter */
	{ /*   0x35, */      0x1B,      0x1B,         0x1B,	  1 },
	{ /*   0x36, */      0x00,      0x00,         0x00,	 29 },
	{ /*   0x37, */      0x00,      0x00,         0x00,	219 },
	{ /*   0x38, */      0x00,      0x00,         0x00,	 42 },
	{ /*   0x39, */      0x00,      0x00,         0x00,	 58 },
	{ /*   0x3A, */      0x00,      0x00,         0x00,	 56 }, /* L Alt */
	{ /*   0x3B, */       'h',      0x00,         0x00,	203 },  /* Left */
	{ /*   0x3C, */       'l',      0x00,         0x00,	205 },  /* Right */
	{ /*   0x3D, */       'j',      0x00,         0x00,	208 },  /* Down */
	{ /*   0x3E, */       'k',      0x00,         0x00,	200 },  /* Up */
	{ /*   0x3F, */      0x00,      0x00,         0x00,	  0 }, /* Fn */
	{ /*   0x40, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x41, */       '.',       '.',         0x00,	 83 },
	{ /*   0x42, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x43, */       '*',       '*',         0x00,	 55 },
	{ /*   0x44, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x45, */       '+',       '+',         0x00,	 78 },
	{ /*   0x46, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x47, */      0x00,      0x00,         0x00,	 69 },
	{ /*   0x48, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x49, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x4A, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x4B, */       '/',       '/',         0x00,	181 },
	{ /*   0x4C, */      0x0D,      0x0D,         0x0D,	156 },
	{ /*   0x4D, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x4E, */       '-',       '-',         0x00,	 74 },
	{ /*   0x4F, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x50, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x51, */       '=',       '=',         0x00,	118 },
	{ /*   0x52, */       '0',       '0',         0x00,	 82 },
	{ /*   0x53, */       '1',       '1',         0x00,	 79 },
	{ /*   0x54, */       '2',       '2',         0x00,	 80 },
	{ /*   0x55, */       '3',       '3',         0x00,	 81 },
	{ /*   0x56, */       '4',       '4',         0x00,	 75 },
	{ /*   0x57, */       '5',       '5',         0x00,	 76 },
	{ /*   0x58, */       '6',       '6',         0x00,	 77 },
	{ /*   0x59, */       '7',       '7',         0x00,	 71 },
	{ /*   0x5A, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x5B, */       '8',       '8',         0x00,	 72 },
	{ /*   0x5C, */       '9',       '9',         0x00,	 73 },
	{ /*   0x5D, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x5E, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x5F, */      0x00,      0x00,         0x00,	 51 },
	{ /*   0x60, */      0x00,      0x00,         0x00,	 63 }, /* F5 */
	{ /*   0x61, */      0x00,      0x00,         0x00,	 64 }, /* F6 */
	{ /*   0x62, */      0x00,      0x00,         0x00,	 65 }, /* F7 */
	{ /*   0x63, */      0x00,      0x00,         0x00,	 61 }, /* F3 */
	{ /*   0x64, */      0x00,      0x00,         0x00,	 66 }, /* F8 */
	{ /*   0x65, */      0x00,      0x00,         0x00,	 67 }, /* F9 */
	{ /*   0x66, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x67, */      0x00,      0x00,         0x00,	 87 }, /* F11 */
	{ /*   0x68, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x69, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x6A, */      0x00,      0x00,         0x00,	156 },
	{ /*   0x6B, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x6C, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x6D, */      0x00,      0x00,         0x00,	 68 }, /* F10 */
	{ /*   0x6E, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x6F, */      0x00,      0x00,         0x00,	 88 }, /* F12 */
	{ /*   0x70, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x71, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x72, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x73, */      0x00,      0x00,         0x00,	199 },
	{ /*   0x74, */      0x00,      0x00,         0x00,	201 },
	{ /*   0x75, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x76, */      0x00,      0x00,         0x00,	 62 }, /* F4 */
	{ /*   0x77, */      0x00,      0x00,         0x00,	207 },
	{ /*   0x78, */      0x00,      0x00,         0x00,	 60 }, /* F2 */
	{ /*   0x79, */      0x00,      0x00,         0x00,	209 },
	{ /*   0x7A, */      0x00,      0x00,         0x00,	 59 }, /* F1 */
	{ /*   0x7B, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x7C, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x7D, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x7E, */      0x00,      0x00,         0x00,	  0 },
	{ /*   0x7F, */      0x00,      0x00,         0x00,	  0 } /* pwr */
};
#endif /* KEYBOARD_ARRAY */