Subversion Repositories shark

Rev

Rev 547 | Go to most recent revision | Details | 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
/*
20
 * Copyright (C) 2000 Paolo Gai
21
 *
22
 * This program is free software; you can redistribute it and/or modify
23
 * it under the terms of the GNU General Public License as published by
24
 * the Free Software Foundation; either version 2 of the License, or
25
 * (at your option) any later version.
26
 *
27
 * This program is distributed in the hope that it will be useful,
28
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
30
 * GNU General Public License for more details.
31
 *
32
 * You should have received a copy of the GNU General Public License
33
 * along with this program; if not, write to the Free Software
34
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
35
 *
36
 */
37
 
38
#include <kernel/kern.h>
39
 
40
#include "../include/drivers/shark_keyb26.h"
41
 
42
extern BYTE useAltGr;
43
extern char keyTable     [TABLE_KEY_SIZE];
44
extern char keyShiftTable[TABLE_KEY_SIZE];
45
extern char keyAltGrTable[TABLE_KEY_SIZE];
46
 
47
static unsigned char actualMap;
48
 
49
static KEYB_MAP keyMaps[] = {
50
        /* US International Map */
51
        { FALSE,
52
                /* Plain Map */
53
                { 0x00, 0x1b, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x2d, 0x3d, 0x7f, 0x09,
54
                  0x71, 0x77, 0x65, 0x72, 0x74, 0x79, 0x75, 0x69, 0x6f, 0x70, 0x5b, 0x5d, 0x0d, 0x00, 0x61, 0x73,
55
                  0x64, 0x66, 0x67, 0x68, 0x6a, 0x6b, 0x6c, 0x3b, 0x27, 0x60, 0x00, 0x5c, 0x7a, 0x78, 0x63, 0x76,
56
                  0x62, 0x6e, 0x6d, 0x2c, 0x2e, 0x2f, 0x00, 0x2a, 0x00, 0x20},
57
                /* Shift Map */
58
                { 0x00, 0x1b, 0x21, 0x40, 0x23, 0x24, 0x25, 0x5e, 0x26, 0x2a, 0x28, 0x29, 0x5f, 0x2b, 0x7f, 0x09,
59
                  0x51, 0x57, 0x45, 0x52, 0x54, 0x59, 0x55, 0x49, 0x4f, 0x50, 0x7b, 0x7d, 0x0d, 0x00, 0x41, 0x53,
60
                  0x44, 0x46, 0x47, 0x48, 0x4a, 0x4b, 0x4c, 0x3a, 0x22, 0x7e, 0x00, 0x7c, 0x5a, 0x58, 0x43, 0x56,
61
                  0x42, 0x4e, 0x4d, 0x3c, 0x3e, 0x3f, 0x00, 0x2a, 0x00, 0x20},
62
                /* AltGr Map */
63
                { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
64
                  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
65
                  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
66
                  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
67
        },
68
        /* Italian Map */
69
        { TRUE,
70
                /* Plain Map */
71
                { 0x00, 0x1b, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x27, 0xec, 0x7f, 0x09,
72
                  0x71, 0x77, 0x65, 0x72, 0x74, 0x79, 0x75, 0x69, 0x6f, 0x70, 0xe7, 0x2b, 0x0d, 0x00, 0x61, 0x73,
73
                  0x64, 0x66, 0x67, 0x68, 0x6a, 0x6b, 0x6c, 0xf2, 0xe0, 0x5c, 0x00, 0xf8, 0x7a, 0x78, 0x63, 0x76,
74
                  0x62, 0x6e, 0x6d, 0x2c, 0x2e, 0x2d, 0x00, 0x2a, 0x00, 0x20},
75
                /* Shift Map */
76
                { 0x00, 0x1b, 0x21, 0x22, 0x9c, 0x24, 0x25, 0x26, 0x2f, 0x28, 0x29, 0x3d, 0x3f, 0x5e, 0x7f, 0x09,
77
                  0x51, 0x57, 0x45, 0x52, 0x54, 0x59, 0x55, 0x49, 0x4f, 0x50, 0xe9, 0x2a, 0x0d, 0x00, 0x41, 0x53,
78
                  0x44, 0x46, 0x47, 0x48, 0x4a, 0x4b, 0x4c, 0xe7, 0xb0, 0x7c, 0x00, 0xa7, 0x5a, 0x58, 0x43, 0x56,
79
                  0x42, 0x4e, 0x4d, 0x3b, 0x3a, 0x5f, 0x00, 0x2a, 0x00, 0x20},
80
                /* AltGr Map */
81
                { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7b, 0x7d, 0x7e, 0x60, 0xed, 0x00, 0x00,
82
                  0x71, 0x77, 0x65, 0x72, 0x74, 0x79, 0x75, 0x69, 0x6f, 0x70, 0x5b, 0x5d, 0x0d, 0x00, 0x61, 0x73,
83
                  0x64, 0x66, 0x67, 0x68, 0x6a, 0x6b, 0x6c, 0x40, 0x23, 0x00, 0x00, 0xfa, 0x7a, 0x78, 0x63, 0x76,
84
                  0x62, 0x6e, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x20}
85
        }
86
};
87
 
88
#define NUM_OF_MAPS     (sizeof keyMaps / sizeof keyMaps[0])
89
 
90
int keyb_get_map(void)
91
{
92
        return actualMap;
93
}
94
 
95
int keyb_set_map(unsigned char m)
96
{
97
        register int i = 0;
98
 
99
        /* If keyMaps[m] not available then set US */
100
        if (m >= NUM_OF_MAPS)
101
                actualMap = KEYMAP_US;
102
        else
103
                actualMap = m;
104
 
105
        useAltGr = keyMaps[i].useAltGr;
106
        for (i=0; i < TABLE_KEY_SIZE; i++) {
107
                keyTable[i]      = keyMaps[actualMap].keyMap[i];
108
                keyShiftTable[i] = keyMaps[actualMap].keyShiftMap[i];
109
        }
110
        if (useAltGr)
111
                for (i=0; i < TABLE_KEY_SIZE; i++)
112
                        keyAltGrTable[i] = keyMaps[actualMap].keyAltGrMap[i];
113
 
114
        return actualMap;
115
}