/branches/dd/uspace/srv/kbd/port/gxemul.c |
---|
39,6 → 39,7 |
#include <sysinfo.h> |
#include <kbd_port.h> |
#include <kbd.h> |
#include <ddi.h> |
static irq_cmd_t gxemul_cmds[] = { |
{ |
63,7 → 64,7 |
{ |
async_set_interrupt_received(gxemul_irq_handler); |
gxemul_cmds[0].addr = (void *) sysinfo_value("kbd.address.virtual"); |
ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"), |
ipc_register_irq(sysinfo_value("kbd.inr"), device_assign_devno(), |
0, &gxemul_kbd); |
return 0; |
} |
/branches/dd/uspace/srv/kbd/port/ns16550.c |
---|
99,7 → 99,7 |
ns16550_kernel = sysinfo_value("kbd.address.kernel"); |
ns16550_kbd.cmds[0].addr = (void *) (ns16550_kernel + LSR_REG); |
ns16550_kbd.cmds[3].addr = (void *) (ns16550_kernel + RBR_REG); |
ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"), |
ipc_register_irq(sysinfo_value("kbd.inr"), device_assign_devno(), |
0, &ns16550_kbd); |
return pio_enable((void *) ns16550_physical, 8, &vaddr); |
} |
/branches/dd/uspace/srv/kbd/port/msim.c |
---|
39,6 → 39,7 |
#include <sysinfo.h> |
#include <kbd_port.h> |
#include <kbd.h> |
#include <ddi.h> |
irq_cmd_t msim_cmds[] = { |
{ |
63,7 → 64,7 |
{ |
async_set_interrupt_received(msim_irq_handler); |
msim_cmds[0].addr = sysinfo_value("kbd.address.virtual"); |
ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"), |
ipc_register_irq(sysinfo_value("kbd.inr"), device_assign_devno(), |
0, &msim_kbd); |
return 0; |
} |
/branches/dd/uspace/srv/kbd/port/i8042.c |
---|
43,6 → 43,7 |
#include <sysinfo.h> |
#include <kbd_port.h> |
#include <kbd.h> |
#include <ddi.h> |
#include "i8042.h" |
/* Interesting bits for status register */ |
136,7 → 137,7 |
/* Enable kbd */ |
i8042_kbd.cmds[0].addr = &((i8042_t *) i8042_kernel)->status; |
i8042_kbd.cmds[3].addr = &((i8042_t *) i8042_kernel)->data; |
ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"), 0, &i8042_kbd); |
ipc_register_irq(sysinfo_value("kbd.inr"), device_assign_devno(), 0, &i8042_kbd); |
int newcontrol = i8042_KBD_IE | i8042_KBD_TRANSLATE; |
if (mouseenabled) |
/branches/dd/uspace/srv/kbd/port/ski.c |
---|
71,9 → 71,12 |
(void) arg; |
while (1) { |
c = ski_getchar(); |
if (c != 0) |
while (1) { |
c = ski_getchar(); |
if (c == 0) |
break; |
kbd_push_scancode(c); |
} |
usleep(POLL_INTERVAL); |
} |
/branches/dd/uspace/srv/kbd/port/z8530.c |
---|
89,7 → 89,7 |
CHAN_A_STATUS; |
z8530_cmds[3].addr = (void *) sysinfo_value("kbd.address.kernel") + |
CHAN_A_DATA; |
ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"), |
ipc_register_irq(sysinfo_value("kbd.inr"), device_assign_devno(), |
sysinfo_value("kbd.inr"), &z8530_kbd); |
return 0; |
} |
/branches/dd/uspace/srv/kbd/port/sgcn.c |
---|
36,13 → 36,15 |
#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> |
#include <thread.h> |
#define POLL_INTERVAL 10000 |
/** |
* SGCN buffer header. It is placed at the very beginning of the SGCN |
* buffer. |
87,16 → 89,16 |
*/ |
static uintptr_t sram_buffer_offset; |
static void sgcn_irq_handler(ipc_callid_t iid, ipc_call_t *call); |
/* polling thread */ |
static void *sgcn_thread_impl(void *arg); |
/** |
* Initializes the SGCN driver. |
* Maps the physical memory (SRAM) and registers the interrupt. |
* Maps the physical memory (SRAM) and creates the polling thread. |
*/ |
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, |
106,8 → 108,15 |
} |
sram_buffer_offset = sysinfo_value("sram.buffer.offset"); |
ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"), |
0, (void *) 0); |
thread_id_t tid; |
int rc; |
rc = thread_create(sgcn_thread_impl, NULL, "kbd_poll", &tid); |
if (rc != 0) { |
return rc; |
} |
return 0; |
} |
115,7 → 124,7 |
* 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) |
static void sgcn_key_pressed(void) |
{ |
char c; |
137,5 → 146,19 |
} |
} |
/** |
* Thread to poll SGCN for keypresses. |
*/ |
static void *sgcn_thread_impl(void *arg) |
{ |
(void) arg; |
while (1) { |
sgcn_key_pressed(); |
usleep(POLL_INTERVAL); |
} |
} |
/** @} |
*/ |