Rev 547 |
Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
/*
* Project: S.Ha.R.K.
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors :
* Mauro Marinoni <muro.marinoi@unipv.it>
* (see the web pages for full authors list)
*
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
*
* http://www.sssup.it
* http://retis.sssup.it
* http://shark.sssup.it
*/
#include <kernel/kern.h>
#include "../include/drivers/shark_keyb26.h"
extern BYTE useAltGr;
extern char keyTable [TABLE_KEY_SIZE];
extern char keyShiftTable[TABLE_KEY_SIZE];
extern char keyAltGrTable[TABLE_KEY_SIZE];
static unsigned char actualMap;
static KEYB_MAP keyMaps[] = {
/* US International Map */
{ FALSE,
/* Plain Map */
{ 0x00, 0x1b, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x2d, 0x3d, 0x08, 0x09,
0x71, 0x77, 0x65, 0x72, 0x74, 0x79, 0x75, 0x69, 0x6f, 0x70, 0x5b, 0x5d, 0x0d, 0x00, 0x61, 0x73,
0x64, 0x66, 0x67, 0x68, 0x6a, 0x6b, 0x6c, 0x3b, 0x27, 0x60, 0x00, 0x5c, 0x7a, 0x78, 0x63, 0x76,
0x62, 0x6e, 0x6d, 0x2c, 0x2e, 0x2f, 0x00, 0x2a, 0x00, 0x20},
/* Shift Map */
{ 0x00, 0x1b, 0x21, 0x40, 0x23, 0x24, 0x25, 0x5e, 0x26, 0x2a, 0x28, 0x29, 0x5f, 0x2b, 0x08, 0x09,
0x51, 0x57, 0x45, 0x52, 0x54, 0x59, 0x55, 0x49, 0x4f, 0x50, 0x7b, 0x7d, 0x0d, 0x00, 0x41, 0x53,
0x44, 0x46, 0x47, 0x48, 0x4a, 0x4b, 0x4c, 0x3a, 0x22, 0x7e, 0x00, 0x7c, 0x5a, 0x58, 0x43, 0x56,
0x42, 0x4e, 0x4d, 0x3c, 0x3e, 0x3f, 0x00, 0x2a, 0x00, 0x20},
/* AltGr Map */
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
},
/* Italian Map */
{ TRUE,
/* Plain Map */
{ 0x00, 0x1b, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x27, 0xec, 0x08, 0x09,
0x71, 0x77, 0x65, 0x72, 0x74, 0x79, 0x75, 0x69, 0x6f, 0x70, 0xe7, 0x2b, 0x0d, 0x00, 0x61, 0x73,
0x64, 0x66, 0x67, 0x68, 0x6a, 0x6b, 0x6c, 0xf2, 0xe0, 0x5c, 0x00, 0xf8, 0x7a, 0x78, 0x63, 0x76,
0x62, 0x6e, 0x6d, 0x2c, 0x2e, 0x2d, 0x00, 0x2a, 0x00, 0x20},
/* Shift Map */
{ 0x00, 0x1b, 0x21, 0x22, 0x9c, 0x24, 0x25, 0x26, 0x2f, 0x28, 0x29, 0x3d, 0x3f, 0x5e, 0x08, 0x09,
0x51, 0x57, 0x45, 0x52, 0x54, 0x59, 0x55, 0x49, 0x4f, 0x50, 0xe9, 0x2a, 0x0d, 0x00, 0x41, 0x53,
0x44, 0x46, 0x47, 0x48, 0x4a, 0x4b, 0x4c, 0xe7, 0xb0, 0x7c, 0x00, 0xa7, 0x5a, 0x58, 0x43, 0x56,
0x42, 0x4e, 0x4d, 0x3b, 0x3a, 0x5f, 0x00, 0x2a, 0x00, 0x20},
/* AltGr Map */
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7b, 0x7d, 0x7e, 0x60, 0xed, 0x00, 0x00,
0x71, 0x77, 0x65, 0x72, 0x74, 0x79, 0x75, 0x69, 0x6f, 0x70, 0x5b, 0x5d, 0x0d, 0x00, 0x61, 0x73,
0x64, 0x66, 0x67, 0x68, 0x6a, 0x6b, 0x6c, 0x40, 0x23, 0x00, 0x00, 0xfa, 0x7a, 0x78, 0x63, 0x76,
0x62, 0x6e, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x20}
}
};
#define NUM_OF_MAPS (sizeof keyMaps / sizeof keyMaps[0])
int keyb_get_map(void)
{
return actualMap;
}
int keyb_set_map(unsigned char m)
{
register int i = 0;
/* If keyMaps[m] not available then set US */
if (m >= NUM_OF_MAPS)
actualMap = KEYMAP_US;
else
actualMap = m;
useAltGr = keyMaps[i].useAltGr;
for (i=0; i < TABLE_KEY_SIZE; i++) {
keyTable[i] = keyMaps[actualMap].keyMap[i];
keyShiftTable[i] = keyMaps[actualMap].keyShiftMap[i];
}
if (useAltGr)
for (i=0; i < TABLE_KEY_SIZE; i++)
keyAltGrTable[i] = keyMaps[actualMap].keyAltGrMap[i];
return actualMap;
}