Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4222 → Rev 4223

/trunk/kernel/genarch/include/kbrd/scanc_pc.h
26,30 → 26,21
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup genarch
/** @addtogroup genarch
* @{
*/
/**
* @file
* @brief Scan codes for pc keyboards.
* @brief Scan codes for PC keyboards.
*/
 
#ifndef KERN_SCANC_PC_H_
#define KERN_SCANC_PC_H_
 
#define SC_ESC 0x01
#define SC_BACKSPACE 0x0e
#define SC_LSHIFT 0x2a
#define SC_RSHIFT 0x36
#define SC_CAPSLOCK 0x3a
#define SC_SPEC_ESCAPE 0xe0
#define SC_LEFTARR 0x4b
#define SC_RIGHTARR 0x4d
#define SC_UPARR 0x48
#define SC_DOWNARR 0x50
#define SC_DELETE 0x53
#define SC_HOME 0x47
#define SC_END 0x4f
#define SC_SCAN_ESCAPE 0xe0
 
#endif
 
/trunk/kernel/genarch/include/kbrd/scanc_sun.h
26,30 → 26,21
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup genarch
/** @addtogroup genarch
* @{
*/
/**
* @file
* @brief Scan codes for sun keyboards.
* @brief Scan codes for Sun keyboards.
*/
 
#ifndef KERN_SCANC_SUN_H_
#define KERN_SCANC_SUN_H_
 
#define SC_ESC 0x1d
#define SC_BACKSPACE 0x2b
#define SC_LSHIFT 0x63
#define SC_RSHIFT 0x6e
#define SC_CAPSLOCK 0x77
#define SC_SPEC_ESCAPE 0xe0 /* ??? */
#define SC_LEFTARR 0x18
#define SC_RIGHTARR 0x1c
#define SC_UPARR 0x14
#define SC_DOWNARR 0x1b
#define SC_DELETE 0x42
#define SC_HOME 0x34
#define SC_END 0x4a
#define SC_SCAN_ESCAPE 0xe0
 
#endif
 
/trunk/kernel/genarch/include/kbrd/scanc.h
26,7 → 26,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup genarch
/** @addtogroup genarch
* @{
*/
/**
36,11 → 36,13
#ifndef KERN_SCANC_H_
#define KERN_SCANC_H_
 
#define SPECIAL '?'
#include <typedefs.h>
 
extern char sc_primary_map[];
extern char sc_secondary_map[];
#define SCANCODES 128
 
extern wchar_t sc_primary_map[SCANCODES];
extern wchar_t sc_secondary_map[SCANCODES];
 
#endif
 
/** @}
/trunk/kernel/genarch/src/kbrd/kbrd.c
52,10 → 52,7
#include <arch.h>
#include <macros.h>
 
#ifdef CONFIG_SUN_KBD
#define IGNORE_CODE 0x7f
#endif
 
#define IGNORE_CODE 0x7f
#define KEY_RELEASE 0x80
 
#define PRESSED_SHIFT (1 << 0)
72,45 → 69,11
static volatile int keyflags; /**< Tracking of multiple keypresses. */
static volatile int lockflags; /**< Tracking of multiple keys lockings. */
 
static void key_released(uint8_t);
static void key_pressed(uint8_t);
 
static void kkbrd(void *arg)
{
indev_t *in = (indev_t *) arg;
while (true) {
uint8_t sc = _getc(in);
#ifdef CONFIG_SUN_KBD
if (sc == IGNORE_CODE)
continue;
#endif
if (sc & KEY_RELEASE)
key_released(sc ^ KEY_RELEASE);
else
key_pressed(sc);
}
}
 
void kbrd_init(indev_t *devin)
{
indev_initialize("kbrd", &kbrdout, &kbrdout_ops);
thread_t *thread
= thread_create(kkbrd, devin, TASK, 0, "kkbrd", false);
if (thread) {
stdin = &kbrdout;
thread_ready(thread);
}
}
 
/** Process release of key.
*
* @param sc Scancode of the key being released.
*/
void key_released(uint8_t sc)
static void key_released(wchar_t sc)
{
spinlock_lock(&keylock);
switch (sc) {
135,12 → 98,11
*
* @param sc Scancode of the key being pressed.
*/
void key_pressed(uint8_t sc)
static void key_pressed(wchar_t sc)
{
char *map = sc_primary_map;
char ascii = sc_primary_map[sc];
bool shift, capslock;
bool letter = false;
bool letter;
bool shift;
bool capslock;
spinlock_lock(&keylock);
switch (sc) {
151,58 → 113,54
case SC_CAPSLOCK:
keyflags |= PRESSED_CAPSLOCK;
break;
case SC_SPEC_ESCAPE:
case SC_SCAN_ESCAPE:
break;
case SC_LEFTARR:
indev_push_character(stdin, 0x1b);
indev_push_character(stdin, 0x5b);
indev_push_character(stdin, 0x44);
break;
case SC_RIGHTARR:
indev_push_character(stdin, 0x1b);
indev_push_character(stdin, 0x5b);
indev_push_character(stdin, 0x43);
break;
case SC_UPARR:
indev_push_character(stdin, 0x1b);
indev_push_character(stdin, 0x5b);
indev_push_character(stdin, 0x41);
break;
case SC_DOWNARR:
indev_push_character(stdin, 0x1b);
indev_push_character(stdin, 0x5b);
indev_push_character(stdin, 0x42);
break;
case SC_HOME:
indev_push_character(stdin, 0x1b);
indev_push_character(stdin, 0x4f);
indev_push_character(stdin, 0x48);
break;
case SC_END:
indev_push_character(stdin, 0x1b);
indev_push_character(stdin, 0x4f);
indev_push_character(stdin, 0x46);
break;
case SC_DELETE:
indev_push_character(stdin, 0x1b);
indev_push_character(stdin, 0x5b);
indev_push_character(stdin, 0x33);
indev_push_character(stdin, 0x7e);
break;
default:
letter = islower(ascii);
letter = islower(sc_primary_map[sc]);
shift = keyflags & PRESSED_SHIFT;
capslock = (keyflags & PRESSED_CAPSLOCK) ||
(lockflags & LOCKED_CAPSLOCK);
shift = keyflags & PRESSED_SHIFT;
if (letter && capslock)
if ((letter) && (capslock))
shift = !shift;
if (shift)
map = sc_secondary_map;
indev_push_character(stdin, map[sc]);
indev_push_character(stdin, sc_secondary_map[sc]);
else
indev_push_character(stdin, sc_primary_map[sc]);
break;
}
spinlock_unlock(&keylock);
}
 
static void kkbrd(void *arg)
{
indev_t *in = (indev_t *) arg;
while (true) {
wchar_t sc = _getc(in);
if ((sc == IGNORE_CODE) || (sc >= SCANCODES))
continue;
if (sc & KEY_RELEASE)
key_released(sc ^ KEY_RELEASE);
else
key_pressed(sc);
}
}
 
void kbrd_init(indev_t *devin)
{
indev_initialize("kbrd", &kbrdout, &kbrdout_ops);
thread_t *thread
= thread_create(kkbrd, devin, TASK, 0, "kkbrd", false);
if (thread) {
stdin = &kbrdout;
thread_ready(thread);
}
}
 
/** @}
*/
/trunk/kernel/genarch/src/kbrd/scanc_pc.c
26,174 → 26,195
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup genarch
/** @addtogroup genarch
* @{
*/
/**
* @file
* @brief Scan codes for pc keyboards.
* @brief Scan codes for PC keyboards.
*/
 
#include <genarch/kbrd/scanc.h>
#include <typedefs.h>
#include <string.h>
 
/** Primary meaning of scancodes. */
char sc_primary_map[] = {
SPECIAL, /* 0x00 */
SPECIAL, /* 0x01 - Esc */
wchar_t sc_primary_map[SCANCODES] = {
U_NULL, /* 0x00 - undefined */
U_ESCAPE, /* 0x01 - Esc */
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=',
'\b', /* 0x0e - Backspace */
'\t', 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n',
SPECIAL, /* 0x1d - LCtrl */
'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'',
'`',
SPECIAL, /* 0x2a - LShift */
'\\',
'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/',
SPECIAL, /* 0x36 - RShift */
'*',
SPECIAL, /* 0x38 - LAlt */
'\b', /* 0x0e - Backspace */
'\t', /* 0x0f - Tab */
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']',
'\n', /* 0x1e - Enter */
U_SPECIAL, /* 0x1d - Left Ctrl */
'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`',
U_SPECIAL, /* 0x2a - Left Shift */
'\\', 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/',
U_SPECIAL, /* 0x36 - Right Shift */
U_SPECIAL, /* 0x37 - Print Screen */
U_SPECIAL, /* 0x38 - Left Alt */
' ',
SPECIAL, /* 0x3a - CapsLock */
SPECIAL, /* 0x3b - F1 */
SPECIAL, /* 0x3c - F2 */
SPECIAL, /* 0x3d - F3 */
SPECIAL, /* 0x3e - F4 */
SPECIAL, /* 0x3f - F5 */
SPECIAL, /* 0x40 - F6 */
SPECIAL, /* 0x41 - F7 */
SPECIAL, /* 0x42 - F8 */
SPECIAL, /* 0x43 - F9 */
SPECIAL, /* 0x44 - F10 */
SPECIAL, /* 0x45 - NumLock */
SPECIAL, /* 0x46 - ScrollLock */
'7', '8', '9', '-',
'4', '5', '6', '+',
'1', '2', '3',
'0', '.',
SPECIAL, /* 0x54 - Alt-SysRq */
SPECIAL, /* 0x55 - F11/F12/PF1/FN */
SPECIAL, /* 0x56 - unlabelled key next to LAlt */
SPECIAL, /* 0x57 - F11 */
SPECIAL, /* 0x58 - F12 */
SPECIAL, /* 0x59 */
SPECIAL, /* 0x5a */
SPECIAL, /* 0x5b */
SPECIAL, /* 0x5c */
SPECIAL, /* 0x5d */
SPECIAL, /* 0x5e */
SPECIAL, /* 0x5f */
SPECIAL, /* 0x60 */
SPECIAL, /* 0x61 */
SPECIAL, /* 0x62 */
SPECIAL, /* 0x63 */
SPECIAL, /* 0x64 */
SPECIAL, /* 0x65 */
SPECIAL, /* 0x66 */
SPECIAL, /* 0x67 */
SPECIAL, /* 0x68 */
SPECIAL, /* 0x69 */
SPECIAL, /* 0x6a */
SPECIAL, /* 0x6b */
SPECIAL, /* 0x6c */
SPECIAL, /* 0x6d */
SPECIAL, /* 0x6e */
SPECIAL, /* 0x6f */
SPECIAL, /* 0x70 */
SPECIAL, /* 0x71 */
SPECIAL, /* 0x72 */
SPECIAL, /* 0x73 */
SPECIAL, /* 0x74 */
SPECIAL, /* 0x75 */
SPECIAL, /* 0x76 */
SPECIAL, /* 0x77 */
SPECIAL, /* 0x78 */
SPECIAL, /* 0x79 */
SPECIAL, /* 0x7a */
SPECIAL, /* 0x7b */
SPECIAL, /* 0x7c */
SPECIAL, /* 0x7d */
SPECIAL, /* 0x7e */
SPECIAL, /* 0x7f */
U_SPECIAL, /* 0x3a - CapsLock */
U_SPECIAL, /* 0x3b - F1 */
U_SPECIAL, /* 0x3c - F2 */
U_SPECIAL, /* 0x3d - F3 */
U_SPECIAL, /* 0x3e - F4 */
U_SPECIAL, /* 0x3f - F5 */
U_SPECIAL, /* 0x40 - F6 */
U_SPECIAL, /* 0x41 - F7 */
U_SPECIAL, /* 0x42 - F8 */
U_SPECIAL, /* 0x43 - F9 */
U_SPECIAL, /* 0x44 - F10 */
U_SPECIAL, /* 0x45 - NumLock */
U_SPECIAL, /* 0x46 - ScrollLock */
U_HOME_ARROW, /* 0x47 - Home */
U_UP_ARROW, /* 0x48 - Up Arrow */
U_PAGE_UP, /* 0x49 - Page Up */
'-',
U_LEFT_ARROW, /* 0x4b - Left Arrow */
'5', /* 0x4c - Numpad Center */
U_RIGHT_ARROW, /* 0x4d - Right Arrow */
'+',
U_END_ARROW, /* 0x4f - End */
U_DOWN_ARROW, /* 0x50 - Down Arrow */
U_PAGE_DOWN, /* 0x51 - Page Down */
'0', /* 0x52 - Numpad Insert */
U_DELETE, /* 0x53 - Delete */
U_SPECIAL, /* 0x54 - Alt-SysRq */
U_SPECIAL, /* 0x55 - F11/F12/PF1/FN */
U_SPECIAL, /* 0x56 - unlabelled key next to LAlt */
U_SPECIAL, /* 0x57 - F11 */
U_SPECIAL, /* 0x58 - F12 */
U_SPECIAL, /* 0x59 */
U_SPECIAL, /* 0x5a */
U_SPECIAL, /* 0x5b */
U_SPECIAL, /* 0x5c */
U_SPECIAL, /* 0x5d */
U_SPECIAL, /* 0x5e */
U_SPECIAL, /* 0x5f */
U_SPECIAL, /* 0x60 */
U_SPECIAL, /* 0x61 */
U_SPECIAL, /* 0x62 */
U_SPECIAL, /* 0x63 */
U_SPECIAL, /* 0x64 */
U_SPECIAL, /* 0x65 */
U_SPECIAL, /* 0x66 */
U_SPECIAL, /* 0x67 */
U_SPECIAL, /* 0x68 */
U_SPECIAL, /* 0x69 */
U_SPECIAL, /* 0x6a */
U_SPECIAL, /* 0x6b */
U_SPECIAL, /* 0x6c */
U_SPECIAL, /* 0x6d */
U_SPECIAL, /* 0x6e */
U_SPECIAL, /* 0x6f */
U_SPECIAL, /* 0x70 */
U_SPECIAL, /* 0x71 */
U_SPECIAL, /* 0x72 */
U_SPECIAL, /* 0x73 */
U_SPECIAL, /* 0x74 */
U_SPECIAL, /* 0x75 */
U_SPECIAL, /* 0x76 */
U_SPECIAL, /* 0x77 */
U_SPECIAL, /* 0x78 */
U_SPECIAL, /* 0x79 */
U_SPECIAL, /* 0x7a */
U_SPECIAL, /* 0x7b */
U_SPECIAL, /* 0x7c */
U_SPECIAL, /* 0x7d */
U_SPECIAL, /* 0x7e */
U_SPECIAL /* 0x7f */
};
 
/** Secondary meaning of scancodes. */
char sc_secondary_map[] = {
SPECIAL, /* 0x00 */
SPECIAL, /* 0x01 - Esc */
wchar_t sc_secondary_map[SCANCODES] = {
U_NULL, /* 0x00 - undefined */
U_ESCAPE, /* 0x01 - Esc */
'!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+',
SPECIAL, /* 0x0e - Backspace */
'\t', 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', '\n',
SPECIAL, /* 0x1d - LCtrl */
'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"',
'~',
SPECIAL, /* 0x2a - LShift */
'|',
'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?',
SPECIAL, /* 0x36 - RShift */
'*',
SPECIAL, /* 0x38 - LAlt */
'\b', /* 0x0e - Backspace */
'\t', /* 0x0f - Tab */
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}',
'\n', /* 0x1e - Enter */
U_SPECIAL, /* 0x1d - Left Ctrl */
'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"', '~',
U_SPECIAL, /* 0x2a - Left Shift */
'|', 'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?',
U_SPECIAL, /* 0x36 - Right Shift */
U_SPECIAL, /* 0x37 - Print Screen */
U_SPECIAL, /* 0x38 - Left Alt */
' ',
SPECIAL, /* 0x3a - CapsLock */
SPECIAL, /* 0x3b - F1 */
SPECIAL, /* 0x3c - F2 */
SPECIAL, /* 0x3d - F3 */
SPECIAL, /* 0x3e - F4 */
SPECIAL, /* 0x3f - F5 */
SPECIAL, /* 0x40 - F6 */
SPECIAL, /* 0x41 - F7 */
SPECIAL, /* 0x42 - F8 */
SPECIAL, /* 0x43 - F9 */
SPECIAL, /* 0x44 - F10 */
SPECIAL, /* 0x45 - NumLock */
SPECIAL, /* 0x46 - ScrollLock */
'7', '8', '9', '-',
'4', '5', '6', '+',
'1', '2', '3',
'0', '.',
SPECIAL, /* 0x54 - Alt-SysRq */
SPECIAL, /* 0x55 - F11/F12/PF1/FN */
SPECIAL, /* 0x56 - unlabelled key next to LAlt */
SPECIAL, /* 0x57 - F11 */
SPECIAL, /* 0x58 - F12 */
SPECIAL, /* 0x59 */
SPECIAL, /* 0x5a */
SPECIAL, /* 0x5b */
SPECIAL, /* 0x5c */
SPECIAL, /* 0x5d */
SPECIAL, /* 0x5e */
SPECIAL, /* 0x5f */
SPECIAL, /* 0x60 */
SPECIAL, /* 0x61 */
SPECIAL, /* 0x62 */
SPECIAL, /* 0x63 */
SPECIAL, /* 0x64 */
SPECIAL, /* 0x65 */
SPECIAL, /* 0x66 */
SPECIAL, /* 0x67 */
SPECIAL, /* 0x68 */
SPECIAL, /* 0x69 */
SPECIAL, /* 0x6a */
SPECIAL, /* 0x6b */
SPECIAL, /* 0x6c */
SPECIAL, /* 0x6d */
SPECIAL, /* 0x6e */
SPECIAL, /* 0x6f */
SPECIAL, /* 0x70 */
SPECIAL, /* 0x71 */
SPECIAL, /* 0x72 */
SPECIAL, /* 0x73 */
SPECIAL, /* 0x74 */
SPECIAL, /* 0x75 */
SPECIAL, /* 0x76 */
SPECIAL, /* 0x77 */
SPECIAL, /* 0x78 */
SPECIAL, /* 0x79 */
SPECIAL, /* 0x7a */
SPECIAL, /* 0x7b */
SPECIAL, /* 0x7c */
SPECIAL, /* 0x7d */
SPECIAL, /* 0x7e */
SPECIAL, /* 0x7f */
U_SPECIAL, /* 0x3a - CapsLock */
U_SPECIAL, /* 0x3b - F1 */
U_SPECIAL, /* 0x3c - F2 */
U_SPECIAL, /* 0x3d - F3 */
U_SPECIAL, /* 0x3e - F4 */
U_SPECIAL, /* 0x3f - F5 */
U_SPECIAL, /* 0x40 - F6 */
U_SPECIAL, /* 0x41 - F7 */
U_SPECIAL, /* 0x42 - F8 */
U_SPECIAL, /* 0x43 - F9 */
U_SPECIAL, /* 0x44 - F10 */
U_SPECIAL, /* 0x45 - NumLock */
U_SPECIAL, /* 0x46 - ScrollLock */
U_HOME_ARROW, /* 0x47 - Home */
U_UP_ARROW, /* 0x48 - Up Arrow */
U_PAGE_UP, /* 0x49 - Page Up */
'-',
U_LEFT_ARROW, /* 0x4b - Left Arrow */
'5', /* 0x4c - Numpad Center */
U_RIGHT_ARROW, /* 0x4d - Right Arrow */
'+',
U_END_ARROW, /* 0x4f - End */
U_DOWN_ARROW, /* 0x50 - Down Arrow */
U_PAGE_DOWN, /* 0x51 - Page Down */
'0', /* 0x52 - Numpad Insert */
U_DELETE, /* 0x53 - Delete */
U_SPECIAL, /* 0x54 - Alt-SysRq */
U_SPECIAL, /* 0x55 - F11/F12/PF1/FN */
U_SPECIAL, /* 0x56 - unlabelled key next to LAlt */
U_SPECIAL, /* 0x57 - F11 */
U_SPECIAL, /* 0x58 - F12 */
U_SPECIAL, /* 0x59 */
U_SPECIAL, /* 0x5a */
U_SPECIAL, /* 0x5b */
U_SPECIAL, /* 0x5c */
U_SPECIAL, /* 0x5d */
U_SPECIAL, /* 0x5e */
U_SPECIAL, /* 0x5f */
U_SPECIAL, /* 0x60 */
U_SPECIAL, /* 0x61 */
U_SPECIAL, /* 0x62 */
U_SPECIAL, /* 0x63 */
U_SPECIAL, /* 0x64 */
U_SPECIAL, /* 0x65 */
U_SPECIAL, /* 0x66 */
U_SPECIAL, /* 0x67 */
U_SPECIAL, /* 0x68 */
U_SPECIAL, /* 0x69 */
U_SPECIAL, /* 0x6a */
U_SPECIAL, /* 0x6b */
U_SPECIAL, /* 0x6c */
U_SPECIAL, /* 0x6d */
U_SPECIAL, /* 0x6e */
U_SPECIAL, /* 0x6f */
U_SPECIAL, /* 0x70 */
U_SPECIAL, /* 0x71 */
U_SPECIAL, /* 0x72 */
U_SPECIAL, /* 0x73 */
U_SPECIAL, /* 0x74 */
U_SPECIAL, /* 0x75 */
U_SPECIAL, /* 0x76 */
U_SPECIAL, /* 0x77 */
U_SPECIAL, /* 0x78 */
U_SPECIAL, /* 0x79 */
U_SPECIAL, /* 0x7a */
U_SPECIAL, /* 0x7b */
U_SPECIAL, /* 0x7c */
U_SPECIAL, /* 0x7d */
U_SPECIAL, /* 0x7e */
U_SPECIAL /* 0x7f */
};
 
/** @}
/trunk/kernel/genarch/src/kbrd/scanc_sun.c
26,48 → 26,50
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup genarch
/** @addtogroup genarch
* @{
*/
/**
* @file
* @brief Scan codes for Sun keyboards.
* @brief Scan codes for Sun keyboards.
*/
 
#include <genarch/kbrd/scanc.h>
#include <typedefs.h>
#include <string.h>
 
/** Primary meaning of scancodes. */
char sc_primary_map[] = {
[0x00] = SPECIAL,
[0x01] = SPECIAL,
[0x02] = SPECIAL,
[0x03] = SPECIAL,
[0x04] = SPECIAL,
[0x05] = SPECIAL, /* F1 */
[0x06] = SPECIAL, /* F2 */
[0x07] = SPECIAL, /* F10 */
[0x08] = SPECIAL, /* F3 */
[0x09] = SPECIAL, /* F11 */
[0x0a] = SPECIAL, /* F4 */
[0x0b] = SPECIAL, /* F12 */
[0x0c] = SPECIAL, /* F5 */
[0x0d] = SPECIAL, /* RAlt */
[0x0e] = SPECIAL, /* F6 */
[0x0f] = SPECIAL,
[0x10] = SPECIAL, /* F7 */
[0x11] = SPECIAL, /* F8 */
[0x12] = SPECIAL, /* F9 */
[0x13] = SPECIAL, /* LAlt */
[0x14] = SPECIAL, /* Up Arrow */
[0x15] = SPECIAL, /* Pause */
[0x16] = SPECIAL,
[0x17] = SPECIAL, /* Scroll Lock */
[0x18] = SPECIAL, /* Left Arrow */
[0x19] = SPECIAL,
[0x1a] = SPECIAL,
[0x1b] = SPECIAL, /* Down Arrow */
[0x1c] = SPECIAL, /* Right Arrow */
[0x1d] = SPECIAL, /* Esc */
wchar_t sc_primary_map[SCANCODES] = {
[0x00] = U_SPECIAL,
[0x01] = U_SPECIAL,
[0x02] = U_SPECIAL,
[0x03] = U_SPECIAL,
[0x04] = U_SPECIAL,
[0x05] = U_SPECIAL, /* F1 */
[0x06] = U_SPECIAL, /* F2 */
[0x07] = U_SPECIAL, /* F10 */
[0x08] = U_SPECIAL, /* F3 */
[0x09] = U_SPECIAL, /* F11 */
[0x0a] = U_SPECIAL, /* F4 */
[0x0b] = U_SPECIAL, /* F12 */
[0x0c] = U_SPECIAL, /* F5 */
[0x0d] = U_SPECIAL, /* Right Alt */
[0x0e] = U_SPECIAL, /* F6 */
[0x0f] = U_SPECIAL,
[0x10] = U_SPECIAL, /* F7 */
[0x11] = U_SPECIAL, /* F8 */
[0x12] = U_SPECIAL, /* F9 */
[0x13] = U_SPECIAL, /* Left Alt */
[0x14] = U_UP_ARROW, /* Up Arrow */
[0x15] = U_SPECIAL, /* Pause */
[0x16] = U_SPECIAL,
[0x17] = U_SPECIAL, /* Scroll Lock */
[0x18] = U_LEFT_ARROW, /* Left Arrow */
[0x19] = U_SPECIAL,
[0x1a] = U_SPECIAL,
[0x1b] = U_DOWN_ARROW, /* Down Arrow */
[0x1c] = U_RIGHT_ARROW, /* Right Arrow */
[0x1d] = U_ESCAPE, /* Esc */
[0x1e] = '1',
[0x1f] = '2',
[0x20] = '3',
81,17 → 83,17
[0x28] = '-',
[0x29] = '=',
[0x2a] = '`',
[0x2b] = '\b', /* Backspace */
[0x2c] = SPECIAL, /* Insert */
[0x2d] = SPECIAL,
[0x2e] = '/', /* numeric keypad */
[0x2f] = '*', /* numeric keypad */
[0x30] = SPECIAL,
[0x31] = SPECIAL,
[0x32] = '.', /* numeric keypad */
[0x33] = SPECIAL,
[0x34] = SPECIAL, /* Home */
[0x35] = '\t', /* Tab */
[0x2b] = '\b', /* Backspace */
[0x2c] = U_SPECIAL, /* Insert */
[0x2d] = U_SPECIAL,
[0x2e] = '/', /* Numpad / */
[0x2f] = '*', /* Numpad * */
[0x30] = U_SPECIAL,
[0x31] = U_SPECIAL,
[0x32] = '.', /* Numpad . */
[0x33] = U_SPECIAL,
[0x34] = U_HOME_ARROW, /* Home */
[0x35] = '\t', /* Tab */
[0x36] = 'q',
[0x37] = 'w',
[0x38] = 'e',
104,17 → 106,17
[0x3f] = 'p',
[0x40] = '[',
[0x41] = ']',
[0x42] = SPECIAL, /* Del */
[0x43] = SPECIAL,
[0x44] = '7', /* numeric keypad */
[0x45] = '8', /* numeric keypad */
[0x46] = '9', /* numeric keypad */
[0x47] = '-', /* numeric keypad */
[0x48] = SPECIAL,
[0x49] = SPECIAL,
[0x4a] = SPECIAL, /* End */
[0x4b] = SPECIAL,
[0x4c] = SPECIAL, /* Control */
[0x42] = U_DELETE, /* Delete */
[0x43] = U_SPECIAL,
[0x44] = '7', /* Numpad 7 */
[0x45] = '8', /* Numpad 8 */
[0x46] = '9', /* Numpad 9 */
[0x47] = '-', /* Numpad - */
[0x48] = U_SPECIAL,
[0x49] = U_SPECIAL,
[0x4a] = U_END_ARROW, /* End */
[0x4b] = U_SPECIAL,
[0x4c] = U_SPECIAL, /* Control */
[0x4d] = 'a',
[0x4e] = 's',
[0x4f] = 'd',
127,17 → 129,17
[0x56] = ';',
[0x57] = '\'',
[0x58] = '\\',
[0x59] = '\n', /* Enter */
[0x5a] = '\n', /* Enter on numeric keypad */
[0x5b] = '4', /* numeric keypad */
[0x5c] = '5', /* numeric keypad */
[0x5d] = '6', /* numeric keypad */
[0x5e] = '0', /* numeric keypad */
[0x5f] = SPECIAL,
[0x60] = SPECIAL, /* Page Up */
[0x61] = SPECIAL,
[0x62] = SPECIAL, /* Num Lock */
[0x63] = SPECIAL, /* LShift */
[0x59] = '\n', /* Enter */
[0x5a] = '\n', /* Numpad Enter */
[0x5b] = '4', /* Numpad 4 */
[0x5c] = '5', /* Numpad 5 */
[0x5d] = '6', /* Numpad 6 */
[0x5e] = '0', /* Numpad 0 */
[0x5f] = U_SPECIAL,
[0x60] = U_PAGE_UP, /* Page Up */
[0x61] = U_SPECIAL,
[0x62] = U_SPECIAL, /* NumLock */
[0x63] = U_SPECIAL, /* Left Shift */
[0x64] = 'z',
[0x65] = 'x',
[0x66] = 'c',
148,58 → 150,58
[0x6b] = ',',
[0x6c] = '.',
[0x6d] = '/',
[0x6e] = SPECIAL, /* RShift */
[0x6f] = SPECIAL,
[0x70] = '1', /* numeric keypad */
[0x71] = '2', /* numeric keypad */
[0x72] = '3', /* numeric keypad */
[0x73] = SPECIAL,
[0x74] = SPECIAL,
[0x75] = SPECIAL,
[0x76] = SPECIAL,
[0x77] = SPECIAL, /* Caps Lock */
[0x78] = SPECIAL,
[0x6e] = U_SPECIAL, /* Right Shift */
[0x6f] = U_SPECIAL,
[0x70] = '1', /* Numpad 1 */
[0x71] = '2', /* Numpad 2 */
[0x72] = '3', /* Numpad 3 */
[0x73] = U_SPECIAL,
[0x74] = U_SPECIAL,
[0x75] = U_SPECIAL,
[0x76] = U_SPECIAL,
[0x77] = U_SPECIAL, /* CapsLock */
[0x78] = U_SPECIAL,
[0x79] = ' ',
[0x7a] = SPECIAL,
[0x7b] = SPECIAL, /* Page Down */
[0x7c] = SPECIAL,
[0x7d] = '+', /* numeric key pad */
[0x7e] = SPECIAL,
[0x7f] = SPECIAL
[0x7a] = U_SPECIAL,
[0x7b] = U_PAGE_DOWN, /* Page Down */
[0x7c] = U_SPECIAL,
[0x7d] = '+', /* Numpad + */
[0x7e] = U_SPECIAL,
[0x7f] = U_SPECIAL
};
 
/** Secondary meaning of scancodes. */
char sc_secondary_map[] = {
[0x00] = SPECIAL,
[0x01] = SPECIAL,
[0x02] = SPECIAL,
[0x03] = SPECIAL,
[0x04] = SPECIAL,
[0x05] = SPECIAL, /* F1 */
[0x06] = SPECIAL, /* F2 */
[0x07] = SPECIAL, /* F10 */
[0x08] = SPECIAL, /* F3 */
[0x09] = SPECIAL, /* F11 */
[0x0a] = SPECIAL, /* F4 */
[0x0b] = SPECIAL, /* F12 */
[0x0c] = SPECIAL, /* F5 */
[0x0d] = SPECIAL, /* RAlt */
[0x0e] = SPECIAL, /* F6 */
[0x0f] = SPECIAL,
[0x10] = SPECIAL, /* F7 */
[0x11] = SPECIAL, /* F8 */
[0x12] = SPECIAL, /* F9 */
[0x13] = SPECIAL, /* LAlt */
[0x14] = SPECIAL, /* Up Arrow */
[0x15] = SPECIAL, /* Pause */
[0x16] = SPECIAL,
[0x17] = SPECIAL, /* Scroll Lock */
[0x18] = SPECIAL, /* Left Arrow */
[0x19] = SPECIAL,
[0x1a] = SPECIAL,
[0x1b] = SPECIAL, /* Down Arrow */
[0x1c] = SPECIAL, /* Right Arrow */
[0x1d] = SPECIAL, /* Esc */
wchar_t sc_secondary_map[SCANCODES] = {
[0x00] = U_SPECIAL,
[0x01] = U_SPECIAL,
[0x02] = U_SPECIAL,
[0x03] = U_SPECIAL,
[0x04] = U_SPECIAL,
[0x05] = U_SPECIAL, /* F1 */
[0x06] = U_SPECIAL, /* F2 */
[0x07] = U_SPECIAL, /* F10 */
[0x08] = U_SPECIAL, /* F3 */
[0x09] = U_SPECIAL, /* F11 */
[0x0a] = U_SPECIAL, /* F4 */
[0x0b] = U_SPECIAL, /* F12 */
[0x0c] = U_SPECIAL, /* F5 */
[0x0d] = U_SPECIAL, /* Right Alt */
[0x0e] = U_SPECIAL, /* F6 */
[0x0f] = U_SPECIAL,
[0x10] = U_SPECIAL, /* F7 */
[0x11] = U_SPECIAL, /* F8 */
[0x12] = U_SPECIAL, /* F9 */
[0x13] = U_SPECIAL, /* Left Alt */
[0x14] = U_UP_ARROW, /* Up Arrow */
[0x15] = U_SPECIAL, /* Pause */
[0x16] = U_SPECIAL,
[0x17] = U_SPECIAL, /* Scroll Lock */
[0x18] = U_LEFT_ARROW, /* Left Arrow */
[0x19] = U_SPECIAL,
[0x1a] = U_SPECIAL,
[0x1b] = U_DOWN_ARROW, /* Down Arrow */
[0x1c] = U_RIGHT_ARROW, /* Right Arrow */
[0x1d] = U_ESCAPE, /* Esc */
[0x1e] = '!',
[0x1f] = '@',
[0x20] = '#',
213,17 → 215,17
[0x28] = '_',
[0x29] = '+',
[0x2a] = '~',
[0x2b] = SPECIAL, /* Backspace */
[0x2c] = SPECIAL, /* Insert */
[0x2d] = SPECIAL,
[0x2e] = '/', /* numeric keypad */
[0x2f] = '*', /* numeric keypad */
[0x30] = SPECIAL,
[0x31] = SPECIAL,
[0x32] = '.', /* numeric keypad */
[0x33] = SPECIAL,
[0x34] = SPECIAL, /* Home */
[0x35] = SPECIAL, /* Tab */
[0x2b] = '\b', /* Backspace */
[0x2c] = U_SPECIAL, /* Insert */
[0x2d] = U_SPECIAL,
[0x2e] = '/', /* Numpad / */
[0x2f] = '*', /* Numpad * */
[0x30] = U_SPECIAL,
[0x31] = U_SPECIAL,
[0x32] = '.', /* Numpad . */
[0x33] = U_SPECIAL,
[0x34] = U_HOME_ARROW, /* Home */
[0x35] = '\t', /* Tab */
[0x36] = 'Q',
[0x37] = 'W',
[0x38] = 'E',
236,17 → 238,17
[0x3f] = 'P',
[0x40] = '{',
[0x41] = '}',
[0x42] = SPECIAL, /* Del */
[0x43] = SPECIAL,
[0x44] = '7', /* numeric keypad */
[0x45] = '8', /* numeric keypad */
[0x46] = '9', /* numeric keypad */
[0x47] = '-', /* numeric keypad */
[0x48] = SPECIAL,
[0x49] = SPECIAL,
[0x4a] = SPECIAL, /* End */
[0x4b] = SPECIAL,
[0x4c] = SPECIAL, /* Control */
[0x42] = U_DELETE, /* Delete */
[0x43] = U_SPECIAL,
[0x44] = '7', /* Numpad 7 */
[0x45] = '8', /* Numpad 8 */
[0x46] = '9', /* Numpad 9 */
[0x47] = '-', /* Numpad - */
[0x48] = U_SPECIAL,
[0x49] = U_SPECIAL,
[0x4a] = U_END_ARROW, /* End */
[0x4b] = U_SPECIAL,
[0x4c] = U_SPECIAL, /* Control */
[0x4d] = 'A',
[0x4e] = 'S',
[0x4f] = 'D',
259,17 → 261,17
[0x56] = ':',
[0x57] = '"',
[0x58] = '|',
[0x59] = SPECIAL, /* Enter */
[0x5a] = SPECIAL, /* Enter on numeric keypad */
[0x5b] = '4', /* numeric keypad */
[0x5c] = '5', /* numeric keypad */
[0x5d] = '6', /* numeric keypad */
[0x5e] = '0', /* numeric keypad */
[0x5f] = SPECIAL,
[0x60] = SPECIAL, /* Page Up */
[0x61] = SPECIAL,
[0x62] = SPECIAL, /* Num Lock */
[0x63] = SPECIAL, /* LShift */
[0x59] = '\n', /* Enter */
[0x5a] = '\n', /* Numpad Enter */
[0x5b] = '4', /* Numpad 4 */
[0x5c] = '5', /* Numpad 5 */
[0x5d] = '6', /* Numpad 6 */
[0x5e] = '0', /* Numpad 0 */
[0x5f] = U_SPECIAL,
[0x60] = U_PAGE_UP, /* Page Up */
[0x61] = U_SPECIAL,
[0x62] = U_SPECIAL, /* NumLock */
[0x63] = U_SPECIAL, /* Left Shift */
[0x64] = 'Z',
[0x65] = 'X',
[0x66] = 'C',
280,24 → 282,24
[0x6b] = '<',
[0x6c] = '>',
[0x6d] = '?',
[0x6e] = SPECIAL, /* RShift */
[0x6f] = SPECIAL,
[0x70] = '1', /* numeric keypad */
[0x71] = '2', /* numeric keypad */
[0x72] = '3', /* numeric keypad */
[0x73] = SPECIAL,
[0x74] = SPECIAL,
[0x75] = SPECIAL,
[0x76] = SPECIAL,
[0x77] = SPECIAL, /* Caps Lock */
[0x78] = SPECIAL,
[0x6e] = U_SPECIAL, /* Right Shift */
[0x6f] = U_SPECIAL,
[0x70] = '1', /* Numpad 1 */
[0x71] = '2', /* Numpad 2 */
[0x72] = '3', /* Numpad 3 */
[0x73] = U_SPECIAL,
[0x74] = U_SPECIAL,
[0x75] = U_SPECIAL,
[0x76] = U_SPECIAL,
[0x77] = U_SPECIAL, /* CapsLock */
[0x78] = U_SPECIAL,
[0x79] = ' ',
[0x7a] = SPECIAL,
[0x7b] = SPECIAL, /* Page Down */
[0x7c] = SPECIAL,
[0x7d] = '+', /* numeric key pad */
[0x7e] = SPECIAL,
[0x7f] = SPECIAL
[0x7a] = U_SPECIAL,
[0x7b] = U_PAGE_DOWN, /* Page Down */
[0x7c] = U_SPECIAL,
[0x7d] = '+', /* Numpad + */
[0x7e] = U_SPECIAL,
[0x7f] = U_SPECIAL
};
 
/** @}
/trunk/kernel/genarch/src/fb/fb.c
47,6 → 47,7
#include <config.h>
#include <bitops.h>
#include <print.h>
#include <string.h>
#include <ddi/ddi.h>
#include <arch/types.h>
 
79,8 → 80,6
#define FG_COLOR 0xffff00
#define INV_COLOR 0xaaaaaa
 
#define CURSOR 0x2588
 
#define RED(x, bits) ((x >> (8 + 8 + 8 - bits)) & ((1 << bits) - 1))
#define GREEN(x, bits) ((x >> (8 + 8 - bits)) & ((1 << bits) - 1))
#define BLUE(x, bits) ((x >> (8 - bits)) & ((1 << bits) - 1))
200,7 → 199,7
/** Draw character at given position
*
*/
static void glyph_draw(uint16_t glyph, unsigned int col, unsigned int row, bool silent)
static void glyph_draw(uint16_t glyph, unsigned int col, unsigned int row, bool silent, bool overlay)
{
unsigned int x = COL2X(col);
unsigned int y = ROW2Y(row);
209,7 → 208,8
if (y >= ytrim)
logo_hide(silent);
backbuf[BB_POS(col, row)] = glyph;
if (!overlay)
backbuf[BB_POS(col, row)] = glyph;
if (!silent) {
for (yd = 0; yd < FONT_SCANLINES; yd++)
269,13 → 269,19
 
static void cursor_put(bool silent)
{
glyph_draw(fb_font_glyph(CURSOR), position % cols, position / cols, silent);
unsigned int col = position % cols;
unsigned int row = position / cols;
glyph_draw(fb_font_glyph(U_CURSOR), col, row, silent, true);
}
 
 
static void cursor_remove(bool silent)
{
glyph_draw(fb_font_glyph(0), position % cols, position / cols, silent);
unsigned int col = position % cols;
unsigned int row = position / cols;
glyph_draw(backbuf[BB_POS(col, row)], col, row, silent, true);
}
 
 
307,13 → 313,13
cursor_remove(silent);
do {
glyph_draw(fb_font_glyph(' '), position % cols,
position / cols, silent);
position / cols, silent, false);
position++;
} while ((position % 8) && (position < cols * rows));
break;
default:
glyph_draw(fb_font_glyph(ch), position % cols,
position / cols, silent);
position / cols, silent, false);
position++;
}
/trunk/kernel/genarch/src/drivers/dsrln/dsrlnout.c
50,7 → 50,7
if (ascii_check(ch))
pio_write_8(dsrlnout_base, ch);
else
pio_write_8(dsrlnout_base, invalch);
pio_write_8(dsrlnout_base, U_SPECIAL);
}
}
 
/trunk/kernel/genarch/src/drivers/i8042/i8042.c
34,6 → 34,7
* @brief i8042 processor driver
*
* It takes care of the i8042 serial communication.
*
*/
 
#include <genarch/drivers/i8042/i8042.h>
/trunk/kernel/genarch/src/drivers/ega/ega.c
44,6 → 44,7
#include <arch/types.h>
#include <arch/asm.h>
#include <memstr.h>
#include <string.h>
#include <console/chardev.h>
#include <console/console.h>
#include <sysinfo/sysinfo.h>
485,7 → 486,7
uint8_t style;
if ((index >> 8)) {
glyph = '?';
glyph = U_SPECIAL;
style = INVAL;
} else {
glyph = index & 0xff;
/trunk/kernel/genarch/src/srln/srln.c
39,6 → 39,7
#include <console/console.h>
#include <proc/thread.h>
#include <arch.h>
#include <string.h>
 
static indev_t srlnout;
 
50,10 → 51,62
{
indev_t *in = (indev_t *) arg;
bool cr = false;
uint32_t escape = 0;
while (true) {
uint8_t ch = _getc(in);
wchar_t ch = _getc(in);
/* ANSI escape sequence processing */
if (escape != 0) {
escape <<= 8;
escape |= ch & 0xff;
if ((escape == 0x1b4f) || (escape == 0x1b5b) || (escape == 0x1b5b33))
continue;
switch (escape) {
case 0x1b4f46:
case 0x1b5b46:
ch = U_END_ARROW;
escape = 0;
break;
case 0x1b4f48:
case 0x1b5b48:
ch = U_HOME_ARROW;
escape = 0;
break;
case 0x1b5b41:
ch = U_UP_ARROW;
escape = 0;
break;
case 0x1b5b42:
ch = U_DOWN_ARROW;
escape = 0;
break;
case 0x1b5b43:
ch = U_RIGHT_ARROW;
escape = 0;
break;
case 0x1b5b44:
ch = U_LEFT_ARROW;
escape = 0;
break;
case 0x1b5b337e:
ch = U_DELETE;
escape = 0;
break;
default:
escape = 0;
}
}
if (ch == 0x1b) {
escape = ch & 0xff;
continue;
}
/* Replace carriage return with line feed
and suppress any following line feed */
if ((ch == '\n') && (cr)) {
cr = false;
continue;
65,6 → 118,7
} else
cr = false;
/* Backspace */
if (ch == 0x7f)
ch = '\b';