Rev 555 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
519 | mauro | 1 | /* |
2 | * Project: S.Ha.R.K. |
||
3 | * |
||
4 | * Coordinators: |
||
5 | * Giorgio Buttazzo <giorgio@sssup.it> |
||
6 | * Paolo Gai <pj@gandalf.sssup.it> |
||
7 | * |
||
8 | * Authors : |
||
9 | * Mauro Marinoni <muro.marinoi@unipv.it> |
||
10 | * (see the web pages for full authors list) |
||
11 | * |
||
12 | * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
||
13 | * |
||
14 | * http://www.sssup.it |
||
15 | * http://retis.sssup.it |
||
16 | * http://shark.sssup.it |
||
17 | */ |
||
18 | |||
19 | #include <kernel/kern.h> |
||
20 | |||
21 | #include "../include/drivers/shark_keyb26.h" |
||
22 | |||
23 | extern BYTE useAltGr; |
||
24 | extern char keyTable [TABLE_KEY_SIZE]; |
||
25 | extern char keyShiftTable[TABLE_KEY_SIZE]; |
||
26 | extern char keyAltGrTable[TABLE_KEY_SIZE]; |
||
27 | |||
28 | static unsigned char actualMap; |
||
29 | |||
1056 | tullio | 30 | // made non-static for gcc4 compatibility |
31 | KEYB_MAP keyMaps[] = { |
||
519 | mauro | 32 | /* US International Map */ |
33 | { FALSE, |
||
34 | /* Plain Map */ |
||
555 | mauro | 35 | { 0x00, 0x1b, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x2d, 0x3d, 0x08, 0x09, |
519 | mauro | 36 | 0x71, 0x77, 0x65, 0x72, 0x74, 0x79, 0x75, 0x69, 0x6f, 0x70, 0x5b, 0x5d, 0x0d, 0x00, 0x61, 0x73, |
37 | 0x64, 0x66, 0x67, 0x68, 0x6a, 0x6b, 0x6c, 0x3b, 0x27, 0x60, 0x00, 0x5c, 0x7a, 0x78, 0x63, 0x76, |
||
38 | 0x62, 0x6e, 0x6d, 0x2c, 0x2e, 0x2f, 0x00, 0x2a, 0x00, 0x20}, |
||
39 | /* Shift Map */ |
||
555 | mauro | 40 | { 0x00, 0x1b, 0x21, 0x40, 0x23, 0x24, 0x25, 0x5e, 0x26, 0x2a, 0x28, 0x29, 0x5f, 0x2b, 0x08, 0x09, |
519 | mauro | 41 | 0x51, 0x57, 0x45, 0x52, 0x54, 0x59, 0x55, 0x49, 0x4f, 0x50, 0x7b, 0x7d, 0x0d, 0x00, 0x41, 0x53, |
42 | 0x44, 0x46, 0x47, 0x48, 0x4a, 0x4b, 0x4c, 0x3a, 0x22, 0x7e, 0x00, 0x7c, 0x5a, 0x58, 0x43, 0x56, |
||
43 | 0x42, 0x4e, 0x4d, 0x3c, 0x3e, 0x3f, 0x00, 0x2a, 0x00, 0x20}, |
||
44 | /* AltGr Map */ |
||
45 | { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||
46 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||
47 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
||
48 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} |
||
49 | }, |
||
50 | /* Italian Map */ |
||
51 | { TRUE, |
||
52 | /* Plain Map */ |
||
555 | mauro | 53 | { 0x00, 0x1b, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x27, 0xec, 0x08, 0x09, |
519 | mauro | 54 | 0x71, 0x77, 0x65, 0x72, 0x74, 0x79, 0x75, 0x69, 0x6f, 0x70, 0xe7, 0x2b, 0x0d, 0x00, 0x61, 0x73, |
55 | 0x64, 0x66, 0x67, 0x68, 0x6a, 0x6b, 0x6c, 0xf2, 0xe0, 0x5c, 0x00, 0xf8, 0x7a, 0x78, 0x63, 0x76, |
||
56 | 0x62, 0x6e, 0x6d, 0x2c, 0x2e, 0x2d, 0x00, 0x2a, 0x00, 0x20}, |
||
57 | /* Shift Map */ |
||
555 | mauro | 58 | { 0x00, 0x1b, 0x21, 0x22, 0x9c, 0x24, 0x25, 0x26, 0x2f, 0x28, 0x29, 0x3d, 0x3f, 0x5e, 0x08, 0x09, |
519 | mauro | 59 | 0x51, 0x57, 0x45, 0x52, 0x54, 0x59, 0x55, 0x49, 0x4f, 0x50, 0xe9, 0x2a, 0x0d, 0x00, 0x41, 0x53, |
60 | 0x44, 0x46, 0x47, 0x48, 0x4a, 0x4b, 0x4c, 0xe7, 0xb0, 0x7c, 0x00, 0xa7, 0x5a, 0x58, 0x43, 0x56, |
||
61 | 0x42, 0x4e, 0x4d, 0x3b, 0x3a, 0x5f, 0x00, 0x2a, 0x00, 0x20}, |
||
62 | /* AltGr Map */ |
||
63 | { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7b, 0x7d, 0x7e, 0x60, 0xed, 0x00, 0x00, |
||
64 | 0x71, 0x77, 0x65, 0x72, 0x74, 0x79, 0x75, 0x69, 0x6f, 0x70, 0x5b, 0x5d, 0x0d, 0x00, 0x61, 0x73, |
||
65 | 0x64, 0x66, 0x67, 0x68, 0x6a, 0x6b, 0x6c, 0x40, 0x23, 0x00, 0x00, 0xfa, 0x7a, 0x78, 0x63, 0x76, |
||
66 | 0x62, 0x6e, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x20} |
||
67 | } |
||
68 | }; |
||
69 | |||
70 | #define NUM_OF_MAPS (sizeof keyMaps / sizeof keyMaps[0]) |
||
71 | |||
72 | int keyb_get_map(void) |
||
73 | { |
||
74 | return actualMap; |
||
75 | } |
||
76 | |||
77 | int keyb_set_map(unsigned char m) |
||
78 | { |
||
79 | register int i = 0; |
||
80 | |||
81 | /* If keyMaps[m] not available then set US */ |
||
82 | if (m >= NUM_OF_MAPS) |
||
83 | actualMap = KEYMAP_US; |
||
84 | else |
||
85 | actualMap = m; |
||
86 | |||
87 | useAltGr = keyMaps[i].useAltGr; |
||
88 | for (i=0; i < TABLE_KEY_SIZE; i++) { |
||
89 | keyTable[i] = keyMaps[actualMap].keyMap[i]; |
||
90 | keyShiftTable[i] = keyMaps[actualMap].keyShiftMap[i]; |
||
91 | } |
||
92 | if (useAltGr) |
||
93 | for (i=0; i < TABLE_KEY_SIZE; i++) |
||
94 | keyAltGrTable[i] = keyMaps[actualMap].keyAltGrMap[i]; |
||
95 | |||
96 | return actualMap; |
||
97 | } |