Subversion Repositories shark

Rev

Rev 547 | Rev 1056 | 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
 
30
static KEYB_MAP keyMaps[] = {
31
        /* US International Map */
32
        { FALSE,
33
                /* Plain Map */
555 mauro 34
                { 0x00, 0x1b, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x2d, 0x3d, 0x08, 0x09,
519 mauro 35
                  0x71, 0x77, 0x65, 0x72, 0x74, 0x79, 0x75, 0x69, 0x6f, 0x70, 0x5b, 0x5d, 0x0d, 0x00, 0x61, 0x73,
36
                  0x64, 0x66, 0x67, 0x68, 0x6a, 0x6b, 0x6c, 0x3b, 0x27, 0x60, 0x00, 0x5c, 0x7a, 0x78, 0x63, 0x76,
37
                  0x62, 0x6e, 0x6d, 0x2c, 0x2e, 0x2f, 0x00, 0x2a, 0x00, 0x20},
38
                /* Shift Map */
555 mauro 39
                { 0x00, 0x1b, 0x21, 0x40, 0x23, 0x24, 0x25, 0x5e, 0x26, 0x2a, 0x28, 0x29, 0x5f, 0x2b, 0x08, 0x09,
519 mauro 40
                  0x51, 0x57, 0x45, 0x52, 0x54, 0x59, 0x55, 0x49, 0x4f, 0x50, 0x7b, 0x7d, 0x0d, 0x00, 0x41, 0x53,
41
                  0x44, 0x46, 0x47, 0x48, 0x4a, 0x4b, 0x4c, 0x3a, 0x22, 0x7e, 0x00, 0x7c, 0x5a, 0x58, 0x43, 0x56,
42
                  0x42, 0x4e, 0x4d, 0x3c, 0x3e, 0x3f, 0x00, 0x2a, 0x00, 0x20},
43
                /* AltGr Map */
44
                { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
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}
48
        },
49
        /* Italian Map */
50
        { TRUE,
51
                /* Plain Map */
555 mauro 52
                { 0x00, 0x1b, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x27, 0xec, 0x08, 0x09,
519 mauro 53
                  0x71, 0x77, 0x65, 0x72, 0x74, 0x79, 0x75, 0x69, 0x6f, 0x70, 0xe7, 0x2b, 0x0d, 0x00, 0x61, 0x73,
54
                  0x64, 0x66, 0x67, 0x68, 0x6a, 0x6b, 0x6c, 0xf2, 0xe0, 0x5c, 0x00, 0xf8, 0x7a, 0x78, 0x63, 0x76,
55
                  0x62, 0x6e, 0x6d, 0x2c, 0x2e, 0x2d, 0x00, 0x2a, 0x00, 0x20},
56
                /* Shift Map */
555 mauro 57
                { 0x00, 0x1b, 0x21, 0x22, 0x9c, 0x24, 0x25, 0x26, 0x2f, 0x28, 0x29, 0x3d, 0x3f, 0x5e, 0x08, 0x09,
519 mauro 58
                  0x51, 0x57, 0x45, 0x52, 0x54, 0x59, 0x55, 0x49, 0x4f, 0x50, 0xe9, 0x2a, 0x0d, 0x00, 0x41, 0x53,
59
                  0x44, 0x46, 0x47, 0x48, 0x4a, 0x4b, 0x4c, 0xe7, 0xb0, 0x7c, 0x00, 0xa7, 0x5a, 0x58, 0x43, 0x56,
60
                  0x42, 0x4e, 0x4d, 0x3b, 0x3a, 0x5f, 0x00, 0x2a, 0x00, 0x20},
61
                /* AltGr Map */
62
                { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7b, 0x7d, 0x7e, 0x60, 0xed, 0x00, 0x00,
63
                  0x71, 0x77, 0x65, 0x72, 0x74, 0x79, 0x75, 0x69, 0x6f, 0x70, 0x5b, 0x5d, 0x0d, 0x00, 0x61, 0x73,
64
                  0x64, 0x66, 0x67, 0x68, 0x6a, 0x6b, 0x6c, 0x40, 0x23, 0x00, 0x00, 0xfa, 0x7a, 0x78, 0x63, 0x76,
65
                  0x62, 0x6e, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x20}
66
        }
67
};
68
 
69
#define NUM_OF_MAPS     (sizeof keyMaps / sizeof keyMaps[0])
70
 
71
int keyb_get_map(void)
72
{
73
        return actualMap;
74
}
75
 
76
int keyb_set_map(unsigned char m)
77
{
78
        register int i = 0;
79
 
80
        /* If keyMaps[m] not available then set US */
81
        if (m >= NUM_OF_MAPS)
82
                actualMap = KEYMAP_US;
83
        else
84
                actualMap = m;
85
 
86
        useAltGr = keyMaps[i].useAltGr;
87
        for (i=0; i < TABLE_KEY_SIZE; i++) {
88
                keyTable[i]      = keyMaps[actualMap].keyMap[i];
89
                keyShiftTable[i] = keyMaps[actualMap].keyShiftMap[i];
90
        }
91
        if (useAltGr)
92
                for (i=0; i < TABLE_KEY_SIZE; i++)
93
                        keyAltGrTable[i] = keyMaps[actualMap].keyAltGrMap[i];
94
 
95
        return actualMap;
96
}