2
* Copyright (c) 2006 Jakub Jermar
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
9
* - Redistributions of source code must retain the above copyright
10
* notice, this list of conditions and the following disclaimer.
11
* - Redistributions in binary form must reproduce the above copyright
12
* notice, this list of conditions and the following disclaimer in the
13
* documentation and/or other materials provided with the distribution.
14
* - The name of the author may not be used to endorse or promote products
15
* derived from this software without specific prior written permission.
17
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
/** @addtogroup kbd_ctl
35
* @brief Sun keyboard controller driver.
39
#include <io/console.h>
40
#include <io/keycode.h>
43
#define KBD_KEY_RELEASE 0x80
44
#define KBD_ALL_KEYS_UP 0x7f
46
static int scanmap_simple[];
48
int kbd_ctl_init(void)
53
void kbd_ctl_parse_scancode(int scancode)
55
console_ev_type_t type;
58
if (scancode < 0 || scancode >= 0x100)
61
if (scancode == KBD_ALL_KEYS_UP)
64
if (scancode & KBD_KEY_RELEASE) {
65
scancode &= ~KBD_KEY_RELEASE;
71
key = scanmap_simple[scancode];
73
kbd_push_ev(type, key);
76
/** Primary meaning of scancodes. */
77
static int scanmap_simple[] = {
101
[0x17] = KC_SCROLL_LOCK,
120
[0x2a] = KC_BACKTICK,
121
[0x2b] = KC_BACKSPACE,
142
[0x40] = KC_LBRACKET,
143
[0x41] = KC_RBRACKET,
164
[0x56] = KC_SEMICOLON,
166
[0x58] = KC_BACKSLASH,
176
[0x62] = KC_NUM_LOCK,
197
[0x77] = KC_CAPS_LOCK,
201
[0x7b] = KC_PAGE_DOWN,