/trunk/uspace/srv/kbd/arch/sparc64/include/sgcn.h |
---|
File deleted |
\ No newline at end of file |
/trunk/uspace/srv/kbd/arch/sparc64/include/kbd.h |
---|
File deleted |
/trunk/uspace/srv/kbd/arch/sparc64/include/scanc.h |
---|
File deleted |
/trunk/uspace/srv/kbd/arch/sparc64/src/sgcn.c |
---|
File deleted |
/trunk/uspace/srv/kbd/arch/sparc64/src/kbd.c |
---|
File deleted |
/trunk/uspace/srv/kbd/arch/sparc64/src/scanc.c |
---|
File deleted |
/trunk/uspace/srv/kbd/arch/ia64/src/lkbd.c |
---|
File deleted |
/trunk/uspace/srv/kbd/arch/ia64/src/kbd.c |
---|
File deleted |
\ No newline at end of file |
/trunk/uspace/srv/kbd/arch/ia64/src/scanc.c |
---|
File deleted |
/trunk/uspace/srv/kbd/arch/ia64/src/mouse.c |
---|
File deleted |
/trunk/uspace/srv/kbd/arch/ia64/include/scanc.h |
---|
File deleted |
/trunk/uspace/srv/kbd/arch/ia64/include/lkbd.h |
---|
File deleted |
/trunk/uspace/srv/kbd/arch/ia64/include/kbd.h |
---|
File deleted |
/trunk/uspace/srv/kbd/arch/arm32/include/kbd.h |
---|
File deleted |
/trunk/uspace/srv/kbd/arch/arm32/src/kbd.c |
---|
File deleted |
/trunk/uspace/srv/kbd/arch/arm32/src/kbd_gxemul.c |
---|
File deleted |
/trunk/uspace/srv/kbd/arch/mips32eb |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:special |
-* |
\ No newline at end of property |
/trunk/uspace/srv/kbd/arch/ppc32/include/kbd.h |
---|
File deleted |
/trunk/uspace/srv/kbd/arch/ppc32/src/kbd.c |
---|
File deleted |
/trunk/uspace/srv/kbd/arch/amd64 |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:special |
-* |
\ No newline at end of property |
/trunk/uspace/srv/kbd/arch/mips32/include/kbd.h |
---|
File deleted |
/trunk/uspace/srv/kbd/arch/mips32/src/kbd.c |
---|
File deleted |
/trunk/uspace/srv/kbd/arch/ia32/src/scanc.c |
---|
File deleted |
/trunk/uspace/srv/kbd/arch/ia32/src/mouse.c |
---|
File deleted |
/trunk/uspace/srv/kbd/arch/ia32/src/kbd.c |
---|
File deleted |
/trunk/uspace/srv/kbd/arch/ia32/include/scanc.h |
---|
File deleted |
/trunk/uspace/srv/kbd/arch/ia32/include/kbd.h |
---|
File deleted |
/trunk/uspace/srv/kbd/genarch/src/kbd.c |
---|
File deleted |
/trunk/uspace/srv/kbd/genarch/src/nofb.c |
---|
File deleted |
\ No newline at end of file |
/trunk/uspace/srv/kbd/genarch/include/kbd.h |
---|
File deleted |
/trunk/uspace/srv/kbd/genarch/include/nofb.h |
---|
File deleted |
/trunk/uspace/srv/kbd/genarch/include/scanc.h |
---|
File deleted |
/trunk/uspace/srv/kbd/ctl/pc.c |
---|
26,10 → 26,14 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup kbd |
* @brief PC keyboard controller driver. |
/** @addtogroup kbd_ctl |
* @ingroup kbd |
* @{ |
*/ |
/** |
* @file |
* @brief PC keyboard controller driver. |
*/ |
#include <kbd.h> |
#include <kbd/kbd.h> |
36,7 → 40,7 |
#include <kbd/keycode.h> |
#include <kbd_ctl.h> |
int scanmap_simple[]; |
static int scanmap_simple[]; |
void kbd_ctl_parse_scancode(int scancode) |
{ |
43,7 → 47,8 |
kbd_ev_type_t type; |
unsigned int key; |
if (scancode < 0 || scancode >= 0x100) return; |
if (scancode < 0 || scancode >= 0x100) |
return; |
if (scancode & 0x80) { |
scancode &= ~0x80; |
57,7 → 62,7 |
kbd_push_ev(type, key, 0); |
} |
int scanmap_simple[128] = { |
static int scanmap_simple[128] = { |
[0x29] = KC_BACKTICK, |
/trunk/uspace/srv/kbd/ctl/stty.c |
---|
26,10 → 26,14 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup kbd |
* @brief Serial TTY-like keyboard controller driver. |
/** @addtogroup kbd_ctl |
* @ingroup kbd |
* @{ |
*/ |
/** |
* @file |
* @brief Serial TTY-like keyboard controller driver. |
*/ |
#include <kbd.h> |
#include <kbd/kbd.h> |
/trunk/uspace/srv/kbd/ctl/sun.c |
---|
0,0 → 1,204 |
/* |
* Copyright (c) 2006 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup kbd_ctl |
* @ingroup kbd |
* @{ |
*/ |
/** |
* @file |
* @brief Sun keyboard controller driver. |
*/ |
#include <kbd.h> |
#include <kbd/kbd.h> |
#include <kbd/keycode.h> |
#include <kbd_ctl.h> |
#define KBD_KEY_RELEASE 0x80 |
#define KBD_ALL_KEYS_UP 0x7f |
static int scanmap_simple[]; |
void kbd_ctl_parse_scancode(int scancode) |
{ |
kbd_ev_type_t type; |
unsigned int key; |
if (scancode < 0 || scancode >= 0x100) |
return; |
if (scancode == KBD_ALL_KEYS_UP) |
return; |
if (scancode & KBD_KEY_RELEASE) { |
scancode &= ~KBD_KEY_RELEASE; |
type = KE_RELEASE; |
} else { |
type = KE_PRESS; |
} |
key = scanmap_simple[scancode]; |
if (key != 0) |
kbd_push_ev(type, key, 0); |
} |
/** Primary meaning of scancodes. */ |
static int scanmap_simple[] = { |
[0x00] = 0, |
[0x01] = 0, |
[0x02] = 0, |
[0x03] = 0, |
[0x04] = 0, |
[0x05] = KC_F1, |
[0x06] = KC_F2, |
[0x07] = KC_F10, |
[0x08] = KC_F3, |
[0x09] = KC_F11, |
[0x0a] = KC_F4, |
[0x0b] = KC_F12, |
[0x0c] = KC_F5, |
[0x0d] = KC_RALT, |
[0x0e] = KC_F6, |
[0x0f] = 0, |
[0x10] = KC_F7, |
[0x11] = KC_F8, |
[0x12] = KC_F9, |
[0x13] = KC_LALT, |
[0x14] = KC_UP, |
[0x15] = KC_PAUSE, |
[0x16] = 0, |
[0x17] = KC_SCROLL_LOCK, |
[0x18] = KC_LEFT, |
[0x19] = 0, |
[0x1a] = 0, |
[0x1b] = KC_DOWN, |
[0x1c] = KC_RIGHT, |
[0x1d] = KC_ESCAPE, |
[0x1e] = KC_1, |
[0x1f] = KC_2, |
[0x20] = KC_3, |
[0x21] = KC_4, |
[0x22] = KC_5, |
[0x23] = KC_6, |
[0x24] = KC_7, |
[0x25] = KC_8, |
[0x26] = KC_9, |
[0x27] = KC_0, |
[0x28] = KC_MINUS, |
[0x29] = KC_EQUALS, |
[0x2a] = KC_BACKTICK, |
[0x2b] = KC_BACKSPACE, |
[0x2c] = KC_INSERT, |
[0x2d] = 0, |
[0x2e] = KC_NSLASH, |
[0x2f] = KC_NTIMES, |
[0x30] = 0, |
[0x31] = 0, |
[0x32] = KC_NPERIOD, |
[0x33] = 0, |
[0x34] = KC_HOME, |
[0x35] = KC_TAB, |
[0x36] = KC_Q, |
[0x37] = KC_W, |
[0x38] = KC_E, |
[0x39] = KC_R, |
[0x3a] = KC_T, |
[0x3b] = KC_Y, |
[0x3c] = KC_U, |
[0x3d] = KC_I, |
[0x3e] = KC_O, |
[0x3f] = KC_P, |
[0x40] = KC_LBRACKET, |
[0x41] = KC_RBRACKET, |
[0x42] = KC_DELETE, |
[0x43] = 0, |
[0x44] = KC_N7, |
[0x45] = KC_N8, |
[0x46] = KC_N9, |
[0x47] = KC_NMINUS, |
[0x48] = 0, |
[0x49] = 0, |
[0x4a] = KC_END, |
[0x4b] = 0, |
[0x4c] = KC_LCTRL, |
[0x4d] = KC_A, |
[0x4e] = KC_S, |
[0x4f] = KC_D, |
[0x50] = KC_F, |
[0x51] = KC_G, |
[0x52] = KC_H, |
[0x53] = KC_J, |
[0x54] = KC_K, |
[0x55] = KC_L, |
[0x56] = KC_SEMICOLON, |
[0x57] = KC_QUOTE, |
[0x58] = KC_BACKSLASH, |
[0x59] = KC_ENTER, |
[0x5a] = KC_NENTER, |
[0x5b] = KC_N4, |
[0x5c] = KC_N5, |
[0x5d] = KC_N6, |
[0x5e] = KC_N0, |
[0x5f] = 0, |
[0x60] = KC_PAGE_UP, |
[0x61] = 0, |
[0x62] = KC_NUM_LOCK, |
[0x63] = KC_LSHIFT, |
[0x64] = KC_Z, |
[0x65] = KC_X, |
[0x66] = KC_C, |
[0x67] = KC_V, |
[0x68] = KC_B, |
[0x69] = KC_N, |
[0x6a] = KC_M, |
[0x6b] = KC_COMMA, |
[0x6c] = KC_PERIOD, |
[0x6d] = KC_SLASH, |
[0x6e] = KC_RSHIFT, |
[0x6f] = 0, |
[0x70] = KC_N1, |
[0x71] = KC_N2, |
[0x72] = KC_N3, |
[0x73] = 0, |
[0x74] = 0, |
[0x75] = 0, |
[0x76] = 0, |
[0x77] = KC_CAPS_LOCK, |
[0x78] = 0, |
[0x79] = KC_SPACE, |
[0x7a] = 0, |
[0x7b] = KC_PAGE_DOWN, |
[0x7c] = 0, |
[0x7d] = KC_NPLUS, |
[0x7e] = 0, |
[0x7f] = 0 |
}; |
/** @} |
*/ |
/trunk/uspace/srv/kbd/ctl/gxe_fb.c |
---|
26,10 → 26,14 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup kbd |
* @brief GXEmul framebuffer-mode keyboard controller driver. |
/** @addtogroup kbd_ctl |
* @ingroup kbd |
* @{ |
*/ |
/** |
* @file |
* @brief GXEmul framebuffer-mode keyboard controller driver. |
*/ |
#include <kbd.h> |
#include <kbd/kbd.h> |
/trunk/uspace/srv/kbd/include/keys.h |
---|
File deleted |
/trunk/uspace/srv/kbd/port/gxemul.c |
---|
26,8 → 26,9 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup kbd |
/** @addtogroup kbd_port |
* @{ |
* @ingroup kbd |
*/ |
/** @file |
* @brief GXEmul keyboard port driver. |
/trunk/uspace/srv/kbd/port/ns16550.c |
---|
0,0 → 1,89 |
/* |
* Copyright (c) 2006 Josef Cejka |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup kbd_port |
* @ingroup kbd |
* @{ |
*/ |
/** @file |
* @brief NS16550 port driver. |
*/ |
#include <ipc/ipc.h> |
#include <async.h> |
#include <sysinfo.h> |
#include <kbd.h> |
#include <kbd_port.h> |
#include <ddi.h> |
/* NS16550 registers */ |
#define RBR_REG 0 /** Receiver Buffer Register. */ |
#define IER_REG 1 /** Interrupt Enable Register. */ |
#define IIR_REG 2 /** Interrupt Ident Register (read). */ |
#define FCR_REG 2 /** FIFO control register (write). */ |
#define LCR_REG 3 /** Line Control register. */ |
#define MCR_REG 4 /** Modem Control Register. */ |
#define LSR_REG 5 /** Line Status Register. */ |
irq_cmd_t ns16550_cmds[1] = { |
{ CMD_PORT_READ_1, 0, 0, 2 }, |
}; |
irq_code_t ns16550_kbd = { |
1, |
ns16550_cmds |
}; |
static void ns16550_irq_handler(ipc_callid_t iid, ipc_call_t *call); |
uint16_t ns16550_port; |
int kbd_port_init(void) |
{ |
async_set_interrupt_received(ns16550_irq_handler); |
ns16550_port = sysinfo_value("kbd.port"); |
ns16550_kbd.cmds[0].addr = (void *) (ns16550_port + RBR_REG); |
ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"), |
0, &ns16550_kbd); |
iospace_enable(task_get_id(), ns16550_port, 8); |
return 0; |
} |
#define LSR_DATA_READY 0x01 |
static void ns16550_irq_handler(ipc_callid_t iid, ipc_call_t *call) |
{ |
int scan_code = IPC_GET_ARG2(*call); |
kbd_push_scancode(scan_code); |
} |
/** |
* @} |
*/ |
/trunk/uspace/srv/kbd/port/msim.c |
---|
26,11 → 26,12 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup kbd |
* @brief Msim keyboard port driver. |
/** @addtogroup kbd_port |
* @ingroup kbd |
* @{ |
*/ |
/** @file |
* @brief Msim keyboard port driver. |
*/ |
#include <ipc/ipc.h> |
/trunk/uspace/srv/kbd/port/i8042.c |
---|
27,10 → 27,12 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup kbd |
/** @addtogroup kbd_port |
* @ingroup kbd |
* @{ |
*/ |
/** @file |
* @brief i8042 port driver. |
*/ |
#include <ipc/ipc.h> |
/trunk/uspace/srv/kbd/port/z8530.c |
---|
0,0 → 1,78 |
/* |
* Copyright (c) 2006 Martin Decky |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup kbd_port |
* @ingroup kbd |
* @{ |
*/ |
/** @file |
* @brief Z8350 keyboard port driver. |
*/ |
#include <ipc/ipc.h> |
#include <async.h> |
#include <sysinfo.h> |
#include <kbd.h> |
#include <kbd_port.h> |
#include <sys/types.h> |
/** Top-half pseudocode for z8530. */ |
irq_cmd_t z8530_cmds[] = { |
{ |
CMD_MEM_READ_1, |
0, /**< Address. Will be patched in run-time. */ |
0, /**< Value. Not used. */ |
1 /**< Arg 1 will contain the result. */ |
} |
}; |
irq_code_t z8530_kbd = { |
1, |
z8530_cmds |
}; |
static void z8530_irq_handler(ipc_callid_t iid, ipc_call_t *call); |
int kbd_port_init(void) |
{ |
async_set_interrupt_received(z8350_irq_handler); |
z8530_cmds[0].addr = (void *) sysinfo_value("kbd.address.virtual") + 6; |
ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"), |
0, &z8530_kbd); |
return 0; |
} |
static void z8530_irq_handler(ipc_callid_t iid, ipc_call_t *call) |
{ |
int scan_code = IPC_GET_ARG1(*call); |
kbd_push_scancode(scan_code); |
} |
/** @} |
*/ |
/trunk/uspace/srv/kbd/port/sgcn.c |
---|
0,0 → 1,142 |
/* |
* Copyright (c) 2008 Pavel Rimsky |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup kbd_port |
* @ingroup kbd |
* @{ |
*/ |
/** @file |
* @brief Z8350 keyboard port driver. |
* @brief SGCN (Serengeti Console) keyboard port driver. |
*/ |
#include <as.h> |
#include <ddi.h> |
#include <ipc/ipc.h> |
#include <async.h> |
#include <kbd.h> |
#include <kbd_port.h> |
#include <sysinfo.h> |
#include <stdio.h> |
/** |
* SGCN buffer header. It is placed at the very beginning of the SGCN |
* buffer. |
*/ |
typedef struct { |
/** hard-wired to "CON" */ |
char magic[4]; |
/** we don't need this */ |
char unused[8]; |
/** offset within the SGCN buffer of the input buffer start */ |
uint32_t in_begin; |
/** offset within the SGCN buffer of the input buffer end */ |
uint32_t in_end; |
/** offset within the SGCN buffer of the input buffer read pointer */ |
uint32_t in_rdptr; |
/** offset within the SGCN buffer of the input buffer write pointer */ |
uint32_t in_wrptr; |
} __attribute__ ((packed)) sgcn_buffer_header_t; |
/* |
* Returns a pointer to the object of a given type which is placed at the given |
* offset from the console buffer beginning. |
*/ |
#define SGCN_BUFFER(type, offset) \ |
((type *) (sram_virt_addr + sram_buffer_offset + (offset))) |
/** Returns a pointer to the console buffer header. */ |
#define SGCN_BUFFER_HEADER (SGCN_BUFFER(sgcn_buffer_header_t, 0)) |
/** |
* Virtual address mapped to SRAM. |
*/ |
static uintptr_t sram_virt_addr; |
/** |
* SGCN buffer offset within SGCN. |
*/ |
static uintptr_t sram_buffer_offset; |
static void sgcn_irq_handler(ipc_callid_t iid, ipc_call_t *call); |
/** |
* Initializes the SGCN driver. |
* Maps the physical memory (SRAM) and registers the interrupt. |
*/ |
int kbd_port_init(void) |
{ |
async_set_interrupt_received(sgcn_irq_handler); |
sram_virt_addr = (uintptr_t) as_get_mappable_page(sysinfo_value("sram.area.size")); |
if (physmem_map((void *) sysinfo_value("sram.address.physical"), |
(void *) sram_virt_addr, sysinfo_value("sram.area.size") / PAGE_SIZE, |
AS_AREA_READ | AS_AREA_WRITE) != 0) { |
printf("SGCN: uspace driver could not map physical memory."); |
return -1; |
} |
sram_buffer_offset = sysinfo_value("sram.buffer.offset"); |
ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"), |
0, (void *) 0); |
return 0; |
} |
/** |
* Handler of the "key pressed" event. Reads codes of all the pressed keys from |
* the buffer. |
*/ |
static void sgcn_irq_handler(ipc_callid_t iid, ipc_call_t *call) |
{ |
char c; |
uint32_t begin = SGCN_BUFFER_HEADER->in_begin; |
uint32_t end = SGCN_BUFFER_HEADER->in_end; |
uint32_t size = end - begin; |
volatile char *buf_ptr = (volatile char *) |
SGCN_BUFFER(char, SGCN_BUFFER_HEADER->in_rdptr); |
volatile uint32_t *in_wrptr_ptr = &(SGCN_BUFFER_HEADER->in_wrptr); |
volatile uint32_t *in_rdptr_ptr = &(SGCN_BUFFER_HEADER->in_rdptr); |
while (*in_rdptr_ptr != *in_wrptr_ptr) { |
c = *buf_ptr; |
*in_rdptr_ptr = (((*in_rdptr_ptr) - begin + 1) % size) + begin; |
buf_ptr = (volatile char *) |
SGCN_BUFFER(char, SGCN_BUFFER_HEADER->in_rdptr); |
kbd_push_scancode(c); |
} |
} |
/** @} |
*/ |
/trunk/uspace/srv/kbd/port/dummy.c |
---|
26,8 → 26,9 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup kbd |
/** @addtogroup kbd_port |
* @brief Dummy keyboard port driver. |
* @ingroup kbd |
* @{ |
*/ |
/** @file |
/trunk/uspace/srv/kbd/port/i8042.h |
---|
26,14 → 26,13 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup kbdamd64 amd64 |
* @brief HelenOS ia32 / amd64 arch dependent parts of uspace keyboard and mouse handler. |
/** @addtogroup kbd_port |
* @ingroup kbd |
* @{ |
*/ |
/** @file |
* @ingroup kbdia32 |
* @brief i8042 port driver. |
*/ |
#ifndef KBD_PORT_i8042_H_ |
/trunk/uspace/srv/kbd/Makefile |
---|
110,8 → 110,8 |
endif |
ifeq ($(UARCH), sparc64) |
GENARCH_SOURCES += \ |
port/dummy.c \ |
ctl/stty.c |
port/z8350.c \ |
ctl/sun.c |
endif |
# ifeq ($(UARCH), ia32) |
/trunk/uspace/srv/console/console.c |
---|
35,7 → 35,7 |
#include <libc.h> |
#include <fb.h> |
#include <ipc/ipc.h> |
#include <keys.h> |
#include <kbd.h> |
#include <kbd/keycode.h> |
#include <ipc/fb.h> |
#include <ipc/services.h> |