Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / amiga / dev / kbdmap.c
blob62242661ece50df247e683c72662cb4781a2aea4
1 /* $NetBSD: kbdmap.c,v 1.11 2002/01/26 13:40:58 aymeric Exp $ */
3 /*
4 * Copyright (c) 1993 Markus Wild
5 * All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Markus Wild.
18 * 4. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #include <sys/cdefs.h>
34 __KERNEL_RCSID(0, "$NetBSD$");
36 #include <amiga/dev/kbdmap.h>
38 /* define a default keymap. This can be changed by keyboard ioctl's
39 (later at least..) */
41 /* mode shortcuts: */
42 #define S KBD_MODE_STRING
43 #define DG (KBD_MODE_DEAD | KBD_MODE_GRAVE)
44 #define DA (KBD_MODE_DEAD | KBD_MODE_ACUTE)
45 #define DC (KBD_MODE_DEAD | KBD_MODE_CIRC)
46 #define DT (KBD_MODE_DEAD | KBD_MODE_TILDE)
47 #define DD (KBD_MODE_DEAD | KBD_MODE_DIER)
48 #define C KBD_MODE_CAPS
49 #define K KBD_MODE_KPAD
51 struct kbdmap kbdmap;
52 struct kbdmap ascii_kbdmap = {
53 /* normal map */
55 { 0, '`' }, /* 0x00 */
56 { 0, '1' },
57 { 0, '2' },
58 { 0, '3' },
59 { 0, '4' },
60 { 0, '5' },
61 { 0, '6' },
62 { 0, '7' },
63 { 0, '8' }, /* 0x08 */
64 { 0, '9' },
65 { 0, '0' },
66 { 0, '-' },
67 { 0, '=' },
68 { 0, '\\' },
69 { 0, 0 },
70 { K, '0' },
71 { C, 'q' }, /* 0x10 */
72 { C, 'w' },
73 { C, 'e' },
74 { C, 'r' },
75 { C, 't' },
76 { C, 'y' },
77 { C, 'u' },
78 { C, 'i' },
79 { C, 'o' }, /* 0x18 */
80 { C, 'p' },
81 { 0, '[' },
82 { 0, ']' },
83 { 0, 0 },
84 { K, '1' },
85 { K, '2' },
86 { K, '3' },
87 { C, 'a' }, /* 0x20 */
88 { C, 's' },
89 { C, 'd' },
90 { C, 'f' },
91 { C, 'g' },
92 { C, 'h' },
93 { C, 'j' },
94 { C, 'k' },
95 { C, 'l' }, /* 0x28 */
96 { 0, ';' },
97 { 0, '\'' },
98 { 0, 0 },
99 { 0, 0 },
100 { K, '4' },
101 { K, '5' },
102 { K, '6' },
103 { 0, 0 }, /* 0x30 */
104 { C, 'z' },
105 { C, 'x' },
106 { C, 'c' },
107 { C, 'v' },
108 { C, 'b' },
109 { C, 'n' },
110 { C, 'm' },
111 { 0, ',' }, /* 0x38 */
112 { 0, '.' },
113 { 0, '/' },
114 { 0, 0 },
115 { K, '.' },
116 { K, '7' },
117 { K, '8' },
118 { K, '9' },
119 { 0, ' ' }, /* 0x40 */
120 { 0, DEL }, /* really BS, DEL & BS swapped */
121 { 0, '\t' },
122 { K, '\r' }, /* enter */
123 { 0, '\r' }, /* return */
124 { 0, ESC },
125 { 0, '\b' }, /* really DEL, BS & DEL swapped */
126 { 0, 0 },
127 { 0, 0 }, /* 0x48 */
128 { 0, 0 },
129 { K, '-' },
130 { 0, 0 },
131 { S, 0x00 }, /* now it gets hairy.. CRSR UP */
132 { S, 0x04 }, /* CRSR DOWN */
133 { S, 0x08 }, /* CRSR RIGHT */
134 { S, 0x0C }, /* CRSR LEFT */
135 { S, 0x10 }, /* 0x50 F1 */
136 { S, 0x15 }, /* F2 */
137 { S, 0x1A }, /* F3 */
138 { S, 0x1F }, /* F4 */
139 { S, 0x24 }, /* F5 */
140 { S, 0x29 }, /* F6 */
141 { S, 0x2E }, /* F7 */
142 { S, 0x33 }, /* F8 */
143 { S, 0x38 }, /* 0x58 F9 */
144 { S, 0x3D }, /* F10 */
145 { K, '(' },
146 { K, ')' },
147 { K, '/' },
148 { K, '*' },
149 { K, '+' },
150 { S, 0x42 } /* HELP */
153 /* shifted map */
155 { 0, '~' }, /* 0x00 */
156 { 0, '!' },
157 { 0, '@' },
158 { 0, '#' },
159 { 0, '$' },
160 { 0, '%' },
161 { 0, '^' },
162 { 0, '&' },
163 { 0, '*' }, /* 0x08 */
164 { 0, '(' },
165 { 0, ')' },
166 { 0, '_' },
167 { 0, '+' },
168 { 0, '|' },
169 { 0, 0 },
170 { K, '0' },
171 { C, 'Q' }, /* 0x10 */
172 { C, 'W' },
173 { C, 'E' },
174 { C, 'R' },
175 { C, 'T' },
176 { C, 'Y' },
177 { C, 'U' },
178 { C, 'I' },
179 { C, 'O' }, /* 0x18 */
180 { C, 'P' },
181 { 0, '{' },
182 { 0, '}' },
183 { 0, 0 },
184 { K, '1' },
185 { K, '2' },
186 { K, '3' },
187 { C, 'A' }, /* 0x20 */
188 { C, 'S' },
189 { C, 'D' },
190 { C, 'F' },
191 { C, 'G' },
192 { C, 'H' },
193 { C, 'J' },
194 { C, 'K' },
195 { C, 'L' }, /* 0x28 */
196 { 0, ':' },
197 { 0, '\"' },
198 { 0, 0 },
199 { 0, 0 },
200 { K, '4' },
201 { K, '5' },
202 { K, '6' },
203 { 0, 0 }, /* 0x30 */
204 { C, 'Z' },
205 { C, 'X' },
206 { C, 'C' },
207 { C, 'V' },
208 { C, 'B' },
209 { C, 'N' },
210 { C, 'M' },
211 { 0, '<' }, /* 0x38 */
212 { 0, '>' },
213 { 0, '?' },
214 { 0, 0 },
215 { K, '.' },
216 { K, '7' },
217 { K, '8' },
218 { K, '9' },
219 { 0, ' ' }, /* 0x40 */
220 { 0, DEL }, /* really BS, DEL & BS swapped */
221 { S, 0x99 }, /* shift TAB */
222 { K, '\r' }, /* enter */
223 { 0, '\r' }, /* return */
224 { 0, ESC },
225 { 0, '\b' }, /* really DEL, BS & DEL swapped */
226 { 0, 0 },
227 { 0, 0 }, /* 0x48 */
228 { 0, 0 },
229 { K, '-' },
230 { 0, 0 },
231 { S, 0x47 }, /* shift CRSR UP */
232 { S, 0x4C }, /* shift CRSR DOWN */
233 { S, 0x51 }, /* shift CRSR RIGHT */
234 { S, 0x57 }, /* shift CRSR LEFT */
235 { S, 0x5D }, /* 0x50 shift F1 */
236 { S, 0x63 }, /* shift F2 */
237 { S, 0x69 }, /* shift F3 */
238 { S, 0x6F }, /* shift F4 */
239 { S, 0x75 }, /* shift F5 */
240 { S, 0x7B }, /* shift F6 */
241 { S, 0x81 }, /* shift F7 */
242 { S, 0x87 }, /* shift F8 */
243 { S, 0x8D }, /* 0x58 shift F9 */
244 { S, 0x93 }, /* shift F10 */
245 { K, '(' },
246 { K, ')' },
247 { K, '/' },
248 { K, '*' },
249 { K, '+' },
250 { S, 0x42 } /* HELP (no special shift code) */
254 /* alt map */
256 { 0, '`' }, /* 0x00 */
257 { 0, '¹' },
258 { 0, '²' },
259 { 0, '³' },
260 { 0, '¢' },
261 { 0, '¼' },
262 { 0, '½' },
263 { 0, '¾' },
264 { 0, '·' }, /* 0x08 */
265 { 0, '«' },
266 { 0, '»' },
267 { 0, '-' },
268 { 0, '=' },
269 { 0, '\\' },
270 { 0, 0 },
271 { K, '0' },
272 { C, 'å' }, /* 0x10 */
273 { 0, '°' },
274 { 0, '©' },
275 { 0, '®' },
276 { C, 'þ' },
277 { 0, '¤' },
278 { 0, 'µ' },
279 { 0, '¡' },
280 { C, 'ø' }, /* 0x18 */
281 { 0, '¶' },
282 { 0, '[' },
283 { 0, ']' },
284 { 0, 0 },
285 { K, '1' },
286 { K, '2' },
287 { K, '3' },
288 { C, 'æ' }, /* 0x20 */
289 { 0, 'ß' },
290 { C, 'ð' },
291 { DA, '´' },
292 { DG, '`' },
293 { DC, '^' },
294 { DT, '~' },
295 { DD, '¨' },
296 { 0, '£' }, /* 0x28 */
297 { 0, ';' },
298 { 0, '\'' },
299 { 0, 0 },
300 { 0, 0 },
301 { K, '4' },
302 { K, '5' },
303 { K, '6' },
304 { 0, 0 }, /* 0x30 */
305 { 0, '±' },
306 { 0, '×' },
307 { C, 'ç' },
308 { 0, 'ª' },
309 { 0, 'º' },
310 { 0, '­' },
311 { 0, '¸' },
312 { 0, ',' }, /* 0x38 */
313 { 0, '.' },
314 { 0, '/' },
315 { 0, 0 },
316 { K, '.' },
317 { K, '7' },
318 { K, '8' },
319 { K, '9' },
320 { 0, ' ' }, /* 0x40 */
321 { 0, DEL }, /* really BS, DEL & BS swapped */
322 { 0, '\t' },
323 { K, '\r' }, /* enter */
324 { 0, '\r' }, /* return */
325 { S, 0x9d }, /* CSI */
326 { 0, '\b' }, /* really DEL, BS & DEL swapped */
327 { 0, 0 },
328 { 0, 0 }, /* 0x48 */
329 { 0, 0 },
330 { K, '-' },
331 { 0, 0 },
332 { S, 0x00 }, /* now it gets hairy.. CRSR UP */
333 { S, 0x04 }, /* CRSR DOWN */
334 { S, 0x08 }, /* CRSR RIGHT */
335 { S, 0x0C }, /* CRSR LEFT */
336 { S, 0x10 }, /* 0x50 F1 */
337 { S, 0x15 }, /* F2 */
338 { S, 0x1A }, /* F3 */
339 { S, 0x1F }, /* F4 */
340 { S, 0x24 }, /* F5 */
341 { S, 0x29 }, /* F6 */
342 { S, 0x2E }, /* F7 */
343 { S, 0x33 }, /* F8 */
344 { S, 0x38 }, /* 0x58 F9 */
345 { S, 0x3D }, /* F10 */
346 { K, '(' },
347 { K, ')' },
348 { K, '/' },
349 { K, '*' },
350 { K, '+' },
351 { S, 0x42 } /* HELP */
354 /* shift alt map */
356 { 0, '~' }, /* 0x00 */
357 { 0, '!' },
358 { 0, '@' },
359 { 0, '#' },
360 { 0, '$' },
361 { 0, '%' },
362 { 0, '^' },
363 { 0, '&' },
364 { 0, '*' }, /* 0x08 */
365 { 0, '(' },
366 { 0, ')' },
367 { 0, '_' },
368 { 0, '+' },
369 { 0, '|' },
370 { 0, 0 },
371 { K, '0' },
372 { C, 'Å' }, /* 0x10 */
373 { 0, '°' },
374 { 0, '©' },
375 { 0, '®' },
376 { C, 'Þ' },
377 { 0, '¥' },
378 { 0, 'µ' },
379 { 0, '¦' },
380 { C, 'Ø' }, /* 0x18 */
381 { 0, '¶' },
382 { 0, '[' },
383 { 0, ']' },
384 { 0, 0 },
385 { K, '1' },
386 { K, '2' },
387 { K, '3' },
388 { C, 'Æ' }, /* 0x20 */
389 { 0, '§' },
390 { C, 'Ð' },
391 { DA, '´' },
392 { DG, '`' },
393 { DC, '^' },
394 { DT, '~' },
395 { DD, '¨' },
396 { 0, '£' }, /* 0x28 */
397 { 0, ';' },
398 { 0, '\'' },
399 { 0, 0 },
400 { 0, 0 },
401 { K, '4' },
402 { K, '5' },
403 { K, '6' },
404 { 0, 0 }, /* 0x30 */
405 { 0, '±' },
406 { 0, '×' },
407 { C, 'ç' },
408 { 0, 'ª' },
409 { 0, 'º' },
410 { 0, '­' },
411 { 0, '¸' },
412 { 0, ',' }, /* 0x38 */
413 { 0, '.' },
414 { 0, '/' },
415 { 0, 0 },
416 { K, '.' },
417 { K, '7' },
418 { K, '8' },
419 { K, '9' },
420 { 0, ' ' }, /* 0x40 */
421 { 0, DEL }, /* really BS, DEL & BS swapped */
422 { 0, '\t' },
423 { K, '\r' }, /* enter */
424 { 0, '\r' }, /* return */
425 { S, 0x9d }, /* CSI */
426 { 0, '\b' }, /* really DEL, BS & DEL swapped */
427 { 0, 0 },
428 { 0, 0 }, /* 0x48 */
429 { 0, 0 },
430 { K, '-' },
431 { 0, 0 },
432 { S, 0x00 }, /* now it gets hairy.. CRSR UP */
433 { S, 0x04 }, /* CRSR DOWN */
434 { S, 0x08 }, /* CRSR RIGHT */
435 { S, 0x0C }, /* CRSR LEFT */
436 { S, 0x10 }, /* 0x50 F1 */
437 { S, 0x15 }, /* F2 */
438 { S, 0x1A }, /* F3 */
439 { S, 0x1F }, /* F4 */
440 { S, 0x24 }, /* F5 */
441 { S, 0x29 }, /* F6 */
442 { S, 0x2E }, /* F7 */
443 { S, 0x33 }, /* F8 */
444 { S, 0x38 }, /* 0x58 F9 */
445 { S, 0x3D }, /* F10 */
446 { K, '(' },
447 { K, ')' },
448 { K, '/' },
449 { K, '*' },
450 { K, '+' },
451 { S, 0x42 } /* HELP */
455 /* string table. If there's a better way to get the offsets into the
456 above table, please tell me..
458 NOTE: save yourself and others a lot of grief by *not* using
459 CSI == 0x9b, using the two-character sequence gives
460 much less trouble, especially in GNU-Emacs.. */
462 3, ESC, '[', 'A', /* 0x00: CRSR UP */
463 3, ESC, '[', 'B', /* 0x04: CRSR DOWN */
464 3, ESC, '[', 'C', /* 0x08: CRSR RIGHT */
465 3, ESC, '[', 'D', /* 0x0C: CRSR LEFT */
466 4, ESC, '[', '0', '~', /* 0x10: F1 */
467 4, ESC, '[', '1', '~', /* 0x15: F2 */
468 4, ESC, '[', '2', '~', /* 0x1A: F3 */
469 4, ESC, '[', '3', '~', /* 0x1F: F4 */
470 4, ESC, '[', '4', '~', /* 0x24: F5 */
471 4, ESC, '[', '5', '~', /* 0x29: F6 */
472 4, ESC, '[', '6', '~', /* 0x2E: F7 */
473 4, ESC, '[', '7', '~', /* 0x33: F8 */
474 4, ESC, '[', '8', '~', /* 0x38: F9 */
475 4, ESC, '[', '9', '~', /* 0x3D: F10 */
476 4, ESC, '[', '?', '~', /* 0x42: HELP */
478 4, ESC, '[', 'T', '~', /* 0x47: shift CRSR UP */
479 4, ESC, '[', 'S', '~', /* 0x4C: shift CRSR DOWN */
480 5, ESC, '[', ' ', '@', '~', /* 0x51: shift CRSR RIGHT */
481 5, ESC, '[', ' ', 'A', '~', /* 0x57: shift CRSR LEFT */
482 5, ESC, '[', '1', '0', '~', /* 0x5D: shift F1 */
483 5, ESC, '[', '1', '1', '~', /* 0x63: shift F2 */
484 5, ESC, '[', '1', '2', '~', /* 0x69: shift F3 */
485 5, ESC, '[', '1', '3', '~', /* 0x6F: shift F4 */
486 5, ESC, '[', '1', '4', '~', /* 0x75: shift F5 */
487 5, ESC, '[', '1', '5', '~', /* 0x7B: shift F6 */
488 5, ESC, '[', '1', '6', '~', /* 0x81: shift F7 */
489 5, ESC, '[', '1', '7', '~', /* 0x87: shift F8 */
490 5, ESC, '[', '1', '8', '~', /* 0x8D: shift F9 */
491 5, ESC, '[', '1', '9', '~', /* 0x93: shift F10 */
492 3, ESC, '[', 'Z', /* 0x99: shift TAB */
493 2, ESC, '[', /* 0x9d: alt ESC == CSI */
497 unsigned char acctable[KBD_NUM_ACC][64] = {
498 { "@ÀBCDÈFGHÌJKLMNÒPQRSTÙVWXYZ[\\]^_"
499 "`àbcdèfghìjklmnòpqrstùvwxyz{|}~\177"}, /* KBD_ACC_GRAVE */
501 { "@ÁBCDÉFGHÍJKLMNÓPQRSTÚVWXYZ[\\]^_"
502 "`ábcdéfghíjklmnópqrstúvwxyz{|}~\177"}, /* KBD_ACC_ACUTE */
504 { "@ÂBCDÊFGHÎJKLMNÔPQRSTÛVWXYZ[\\]^_"
505 "`âbcdêfghîjklmnôpqrstûvwxyz{|}~\177"}, /* KBD_ACC_CIRC */
507 { "@ÃBCDEFGHIJKLMÑÕPQRSTUVWXYZ[\\]^_"
508 "`ãbcdefghijklmñÕpqrstuvwxyz{|}~\177"}, /* KBD_ACC_TILDE */
510 { "@ÄBCDËFGHÏJKLMNÖPQRSTÜVWXYZ[\\]^_"
511 "`äbcdëfghïjklmnöpqrstüvwxyz{|}~\177"}, /* KBD_ACC_DIER */