/branches/dynload/uspace/app/init/init.c |
---|
82,12 → 82,12 |
argv[0] = fname; |
argv[1] = NULL; |
if (task_spawn(fname, argv)) { |
/* Add reasonable delay to avoid intermixed klog output. */ |
if (task_spawn(fname, argv)) |
/* Add reasonable delay to avoid |
intermixed klog output */ |
usleep(10000); |
} else { |
else |
printf(NAME ": Error spawning %s\n", fname); |
} |
} |
int main(int argc, char *argv[]) |
/branches/dynload/uspace/app/init/version.c |
---|
61,8 → 61,7 |
/** Print version information. */ |
void version_print(void) |
{ |
printf("HelenOS init\nRelease %s%s%s\n", release, revision, timestamp); |
printf("Copyright (c) 2001-2009 HelenOS project\n"); |
printf("HelenOS init\nRelease %s%s%s\nCopyright (c) 2006 HelenOS project\n", release, revision, timestamp); |
} |
/** @} |
/branches/dynload/uspace/app/bdsh/exec.c |
---|
121,7 → 121,7 |
free(tmp); |
if (tid == 0) { |
cli_error(CL_EEXEC, "Cannot spawn `%s'.", cmd); |
cli_error(CL_EEXEC, "Can not spawn %s", cmd); |
return 1; |
} else { |
return 0; |
/branches/dynload/uspace/lib/libc/arch/mips32eb/Makefile.inc |
---|
29,9 → 29,9 |
## Toolchain configuration |
# |
TARGET = mips-linux-gnu |
TARGET = mips-sgi-irix5 |
TOOLCHAIN_DIR = $(CROSS_PREFIX)/mips/bin |
CFLAGS += -mips3 |
CFLAGS += -mips3 |
ARCH_SOURCES += arch/$(UARCH)/src/syscall.c \ |
arch/$(UARCH)/src/fibril.S \ |
40,4 → 40,4 |
LFLAGS += -N |
BFD_ARCH = mips |
BFD_NAME = elf32-tradbigmips |
BFD_NAME = elf32-big |
/branches/dynload/uspace/lib/libc/arch/mips32eb/include/ddi.h |
---|
File deleted |
\ No newline at end of file |
Property changes: |
Deleted: svn:special |
-* |
\ No newline at end of property |
/branches/dynload/uspace/srv/kbd/genarch/stroke.c |
---|
File deleted |
/branches/dynload/uspace/srv/kbd/genarch/gsp.c |
---|
File deleted |
/branches/dynload/uspace/srv/kbd/port/ski.c |
---|
File deleted |
/branches/dynload/uspace/srv/kbd/port/sgcn.c |
---|
36,15 → 36,13 |
#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. |
89,16 → 87,16 |
*/ |
static uintptr_t sram_buffer_offset; |
/* polling thread */ |
static void *sgcn_thread_impl(void *arg); |
static void sgcn_irq_handler(ipc_callid_t iid, ipc_call_t *call); |
/** |
* Initializes the SGCN driver. |
* Maps the physical memory (SRAM) and creates the polling thread. |
* 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, |
108,15 → 106,8 |
} |
sram_buffer_offset = sysinfo_value("sram.buffer.offset"); |
thread_id_t tid; |
int rc; |
rc = thread_create(sgcn_thread_impl, NULL, "kbd_poll", &tid); |
if (rc != 0) { |
return rc; |
} |
ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"), |
0, (void *) 0); |
return 0; |
} |
124,7 → 115,7 |
* Handler of the "key pressed" event. Reads codes of all the pressed keys from |
* the buffer. |
*/ |
static void sgcn_key_pressed(void) |
static void sgcn_irq_handler(ipc_callid_t iid, ipc_call_t *call) |
{ |
char c; |
146,19 → 137,5 |
} |
} |
/** |
* Thread to poll SGCN for keypresses. |
*/ |
static void *sgcn_thread_impl(void *arg) |
{ |
(void) arg; |
while (1) { |
sgcn_key_pressed(); |
usleep(POLL_INTERVAL); |
} |
} |
/** @} |
*/ |
/branches/dynload/uspace/srv/kbd/generic/kbd.c |
---|
189,12 → 189,8 |
} |
/* Initialize port driver. */ |
if (kbd_port_init() != 0) |
if (kbd_port_init()) |
return -1; |
/* Initialize controller driver. */ |
if (kbd_ctl_init() != 0) |
return -1; |
/* Initialize key buffer */ |
keybuffer_init(&keybuffer); |
/branches/dynload/uspace/srv/kbd/ctl/pc.c |
---|
39,7 → 39,6 |
#include <kbd/kbd.h> |
#include <kbd/keycode.h> |
#include <kbd_ctl.h> |
#include <gsp.h> |
enum dec_state { |
ds_s, |
46,7 → 45,7 |
ds_e |
}; |
static enum dec_state ds; |
static enum dec_state ds = ds_s; |
static int scanmap_simple[] = { |
180,11 → 179,6 |
[0x1c] = KC_NENTER |
}; |
int kbd_ctl_init(void) |
{ |
ds = ds_s; |
return 0; |
} |
void kbd_ctl_parse_scancode(int scancode) |
{ |
/branches/dynload/uspace/srv/kbd/ctl/stty.c |
---|
39,191 → 39,291 |
#include <kbd/kbd.h> |
#include <kbd/keycode.h> |
#include <kbd_ctl.h> |
#include <gsp.h> |
#include <stroke.h> |
/** Scancode parser */ |
static gsp_t sp; |
static void parse_ds_start(int scancode); |
static void parse_ds_e(int scancode); |
static void parse_ds_e1(int scancode); |
static void parse_ds_e2(int scancode); |
static void parse_ds_e2a(int scancode); |
static void parse_ds_e2b(int scancode); |
/** Current parser state */ |
static int ds; |
static void parse_leaf(int scancode, int (*map)[2], size_t map_length); |
#include <stdio.h> |
enum dec_state { |
ds_start, |
ds_e, |
ds_e1, |
ds_e2, |
ds_e2a, |
ds_e2b |
}; |
int seq_defs[] = { |
/* Not shifted */ |
static int map_start[][2] = { |
0, KC_BACKTICK, 0x60, GSP_END, |
[0x60] = { 0, KC_BACKTICK }, |
0, KC_1, 0x31, GSP_END, |
0, KC_2, 0x32, GSP_END, |
0, KC_3, 0x33, GSP_END, |
0, KC_4, 0x34, GSP_END, |
0, KC_5, 0x35, GSP_END, |
0, KC_6, 0x36, GSP_END, |
0, KC_7, 0x37, GSP_END, |
0, KC_8, 0x38, GSP_END, |
0, KC_9, 0x39, GSP_END, |
0, KC_0, 0x30, GSP_END, |
[0x31] = { 0, KC_1 }, |
[0x32] = { 0, KC_2 }, |
[0x33] = { 0, KC_3 }, |
[0x34] = { 0, KC_4 }, |
[0x35] = { 0, KC_5 }, |
[0x36] = { 0, KC_6 }, |
[0x37] = { 0, KC_7 }, |
[0x38] = { 0, KC_8 }, |
[0x39] = { 0, KC_9 }, |
[0x30] = { 0, KC_0 }, |
0, KC_MINUS, 0x2d, GSP_END, |
0, KC_EQUALS, 0x3d, GSP_END, |
0, KC_BACKSPACE, 0x08, GSP_END, |
[0x2d] = { 0, KC_MINUS }, |
[0x3d] = { 0, KC_EQUALS }, |
[0x08] = { 0, KC_BACKSPACE }, |
0, KC_TAB, 0x09, GSP_END, |
[0x0f] = { 0, KC_TAB }, |
0, KC_Q, 0x71, GSP_END, |
0, KC_W, 0x77, GSP_END, |
0, KC_E, 0x65, GSP_END, |
0, KC_R, 0x72, GSP_END, |
0, KC_T, 0x74, GSP_END, |
0, KC_Y, 0x79, GSP_END, |
0, KC_U, 0x75, GSP_END, |
0, KC_I, 0x69, GSP_END, |
0, KC_O, 0x6f, GSP_END, |
0, KC_P, 0x70, GSP_END, |
[0x71] = { 0, KC_Q }, |
[0x77] = { 0, KC_W }, |
[0x65] = { 0, KC_E }, |
[0x72] = { 0, KC_R }, |
[0x74] = { 0, KC_T }, |
[0x79] = { 0, KC_Y }, |
[0x75] = { 0, KC_U }, |
[0x69] = { 0, KC_I }, |
[0x6f] = { 0, KC_O }, |
[0x70] = { 0, KC_P }, |
0, KC_LBRACKET, 0x5b, GSP_END, |
0, KC_RBRACKET, 0x5d, GSP_END, |
[0x5b] = { 0, KC_LBRACKET }, |
[0x5d] = { 0, KC_RBRACKET }, |
0, KC_A, 0x61, GSP_END, |
0, KC_S, 0x73, GSP_END, |
0, KC_D, 0x64, GSP_END, |
0, KC_F, 0x66, GSP_END, |
0, KC_G, 0x67, GSP_END, |
0, KC_H, 0x68, GSP_END, |
0, KC_J, 0x6a, GSP_END, |
0, KC_K, 0x6b, GSP_END, |
0, KC_L, 0x6c, GSP_END, |
[0x61] = { 0, KC_A }, |
[0x73] = { 0, KC_S }, |
[0x64] = { 0, KC_D }, |
[0x66] = { 0, KC_F }, |
[0x67] = { 0, KC_G }, |
[0x68] = { 0, KC_H }, |
[0x6a] = { 0, KC_J }, |
[0x6b] = { 0, KC_K }, |
[0x6c] = { 0, KC_L }, |
0, KC_SEMICOLON, 0x3b, GSP_END, |
0, KC_QUOTE, 0x27, GSP_END, |
0, KC_BACKSLASH, 0x5c, GSP_END, |
[0x3b] = { 0, KC_SEMICOLON }, |
[0x27] = { 0, KC_QUOTE }, |
[0x5c] = { 0, KC_BACKSLASH }, |
0, KC_Z, 0x7a, GSP_END, |
0, KC_X, 0x78, GSP_END, |
0, KC_C, 0x63, GSP_END, |
0, KC_V, 0x76, GSP_END, |
0, KC_B, 0x62, GSP_END, |
0, KC_N, 0x6e, GSP_END, |
0, KC_M, 0x6d, GSP_END, |
[0x7a] = { 0, KC_Z }, |
[0x78] = { 0, KC_X }, |
[0x63] = { 0, KC_C }, |
[0x76] = { 0, KC_V }, |
[0x62] = { 0, KC_B }, |
[0x6e] = { 0, KC_N }, |
[0x6d] = { 0, KC_M }, |
0, KC_COMMA, 0x2c, GSP_END, |
0, KC_PERIOD, 0x2e, GSP_END, |
0, KC_SLASH, 0x2f, GSP_END, |
[0x2c] = { 0, KC_COMMA }, |
[0x2e] = { 0, KC_PERIOD }, |
[0x2f] = { 0, KC_SLASH }, |
/* Shifted */ |
[0x20] = { 0, KC_SPACE }, |
KM_SHIFT, KC_BACKTICK, 0x7e, GSP_END, |
[0x1b] = { 0, KC_ESCAPE }, |
KM_SHIFT, KC_1, 0x21, GSP_END, |
KM_SHIFT, KC_2, 0x40, GSP_END, |
KM_SHIFT, KC_3, 0x23, GSP_END, |
KM_SHIFT, KC_4, 0x24, GSP_END, |
KM_SHIFT, KC_5, 0x25, GSP_END, |
KM_SHIFT, KC_6, 0x5e, GSP_END, |
KM_SHIFT, KC_7, 0x26, GSP_END, |
KM_SHIFT, KC_8, 0x2a, GSP_END, |
KM_SHIFT, KC_9, 0x28, GSP_END, |
KM_SHIFT, KC_0, 0x29, GSP_END, |
[0x0a] = { 0, KC_ENTER }, |
[0x0d] = { 0, KC_ENTER }, |
KM_SHIFT, KC_MINUS, 0x5f, GSP_END, |
KM_SHIFT, KC_EQUALS, 0x2b, GSP_END, |
/* with Shift pressed */ |
KM_SHIFT, KC_Q, 0x51, GSP_END, |
KM_SHIFT, KC_W, 0x57, GSP_END, |
KM_SHIFT, KC_E, 0x45, GSP_END, |
KM_SHIFT, KC_R, 0x52, GSP_END, |
KM_SHIFT, KC_T, 0x54, GSP_END, |
KM_SHIFT, KC_Y, 0x59, GSP_END, |
KM_SHIFT, KC_U, 0x55, GSP_END, |
KM_SHIFT, KC_I, 0x49, GSP_END, |
KM_SHIFT, KC_O, 0x4f, GSP_END, |
KM_SHIFT, KC_P, 0x50, GSP_END, |
[0x7e] = { KM_LSHIFT, KC_BACKTICK }, |
KM_SHIFT, KC_LBRACKET, 0x7b, GSP_END, |
KM_SHIFT, KC_RBRACKET, 0x7d, GSP_END, |
[0x21] = { KM_LSHIFT, KC_1 }, |
[0x40] = { KM_LSHIFT, KC_2 }, |
[0x23] = { KM_LSHIFT, KC_3 }, |
[0x24] = { KM_LSHIFT, KC_4 }, |
[0x25] = { KM_LSHIFT, KC_5 }, |
[0x5e] = { KM_LSHIFT, KC_6 }, |
[0x26] = { KM_LSHIFT, KC_7 }, |
[0x2a] = { KM_LSHIFT, KC_8 }, |
[0x28] = { KM_LSHIFT, KC_9 }, |
[0x29] = { KM_LSHIFT, KC_0 }, |
KM_SHIFT, KC_A, 0x41, GSP_END, |
KM_SHIFT, KC_S, 0x53, GSP_END, |
KM_SHIFT, KC_D, 0x44, GSP_END, |
KM_SHIFT, KC_F, 0x46, GSP_END, |
KM_SHIFT, KC_G, 0x47, GSP_END, |
KM_SHIFT, KC_H, 0x48, GSP_END, |
KM_SHIFT, KC_J, 0x4a, GSP_END, |
KM_SHIFT, KC_K, 0x4b, GSP_END, |
KM_SHIFT, KC_L, 0x4c, GSP_END, |
[0x5f] = { KM_LSHIFT, KC_MINUS }, |
[0x2b] = { KM_LSHIFT, KC_EQUALS }, |
KM_SHIFT, KC_SEMICOLON, 0x3a, GSP_END, |
KM_SHIFT, KC_QUOTE, 0x22, GSP_END, |
KM_SHIFT, KC_BACKSLASH, 0x7c, GSP_END, |
[0x51] = { KM_LSHIFT, KC_Q }, |
[0x57] = { KM_LSHIFT, KC_W }, |
[0x45] = { KM_LSHIFT, KC_E }, |
[0x52] = { KM_LSHIFT, KC_R }, |
[0x54] = { KM_LSHIFT, KC_T }, |
[0x59] = { KM_LSHIFT, KC_Y }, |
[0x55] = { KM_LSHIFT, KC_U }, |
[0x49] = { KM_LSHIFT, KC_I }, |
[0x4f] = { KM_LSHIFT, KC_O }, |
[0x50] = { KM_LSHIFT, KC_P }, |
KM_SHIFT, KC_Z, 0x5a, GSP_END, |
KM_SHIFT, KC_X, 0x58, GSP_END, |
KM_SHIFT, KC_C, 0x43, GSP_END, |
KM_SHIFT, KC_V, 0x56, GSP_END, |
KM_SHIFT, KC_B, 0x42, GSP_END, |
KM_SHIFT, KC_N, 0x4e, GSP_END, |
KM_SHIFT, KC_M, 0x4d, GSP_END, |
[0x7b] = { KM_LSHIFT, KC_LBRACKET }, |
[0x7d] = { KM_LSHIFT, KC_RBRACKET }, |
KM_SHIFT, KC_COMMA, 0x3c, GSP_END, |
KM_SHIFT, KC_PERIOD, 0x3e, GSP_END, |
KM_SHIFT, KC_SLASH, 0x3f, GSP_END, |
[0x41] = { KM_LSHIFT, KC_A }, |
[0x53] = { KM_LSHIFT, KC_S }, |
[0x44] = { KM_LSHIFT, KC_D }, |
[0x46] = { KM_LSHIFT, KC_F }, |
[0x47] = { KM_LSHIFT, KC_G }, |
[0x48] = { KM_LSHIFT, KC_H }, |
[0x4a] = { KM_LSHIFT, KC_J }, |
[0x4b] = { KM_LSHIFT, KC_K }, |
[0x4c] = { KM_LSHIFT, KC_L }, |
/* ... */ |
[0x3a] = { KM_LSHIFT, KC_SEMICOLON }, |
[0x22] = { KM_LSHIFT, KC_QUOTE }, |
[0x7c] = { KM_LSHIFT, KC_BACKSLASH }, |
0, KC_SPACE, 0x20, GSP_END, |
0, KC_ENTER, 0x0a, GSP_END, |
0, KC_ENTER, 0x0d, GSP_END, |
[0x5a] = { KM_LSHIFT, KC_Z }, |
[0x58] = { KM_LSHIFT, KC_X }, |
[0x43] = { KM_LSHIFT, KC_C }, |
[0x56] = { KM_LSHIFT, KC_V }, |
[0x42] = { KM_LSHIFT, KC_B }, |
[0x4e] = { KM_LSHIFT, KC_N }, |
[0x4d] = { KM_LSHIFT, KC_M }, |
0, KC_ESCAPE, 0x1b, 0x1b, GSP_END, |
[0x3c] = { KM_LSHIFT, KC_COMMA }, |
[0x3e] = { KM_LSHIFT, KC_PERIOD }, |
[0x3f] = { KM_LSHIFT, KC_SLASH } |
}; |
0, KC_F1, 0x1b, 0x4f, 0x50, GSP_END, |
0, KC_F2, 0x1b, 0x4f, 0x51, GSP_END, |
0, KC_F3, 0x1b, 0x4f, 0x52, GSP_END, |
0, KC_F4, 0x1b, 0x4f, 0x53, GSP_END, |
0, KC_F5, 0x1b, 0x5b, 0x31, 0x35, 0x7e, GSP_END, |
0, KC_F6, 0x1b, 0x5b, 0x31, 0x37, 0x7e, GSP_END, |
0, KC_F7, 0x1b, 0x5b, 0x31, 0x38, 0x7e, GSP_END, |
0, KC_F8, 0x1b, 0x5b, 0x31, 0x39, 0x7e, GSP_END, |
0, KC_F9, 0x1b, 0x5b, 0x32, 0x30, 0x7e, GSP_END, |
0, KC_F10, 0x1b, 0x5b, 0x32, 0x31, 0x7e, GSP_END, |
0, KC_F11, 0x1b, 0x5b, 0x32, 0x33, 0x7e, GSP_END, |
0, KC_F12, 0x1b, 0x5b, 0x32, 0x34, 0x7e, GSP_END, |
static int map_e1[][2] = |
{ |
[0x50] = { 0, KC_F1 }, |
[0x51] = { 0, KC_F2 }, |
[0x52] = { 0, KC_F3 }, |
[0x53] = { 0, KC_F4 }, |
}; |
0, KC_INSERT, 0x1b, 0x5b, 0x32, 0x7e, GSP_END, |
0, KC_HOME, 0x1b, 0x5b, 0x48, GSP_END, |
0, KC_PAGE_UP, 0x1b, 0x5b, 0x35, 0x7e, GSP_END, |
0, KC_DELETE, 0x1b, 0x5b, 0x33, 0x7e, GSP_END, |
0, KC_END, 0x1b, 0x5b, 0x46, GSP_END, |
0, KC_PAGE_DOWN, 0x1b, 0x5b, 0x36, 0x7e, GSP_END, |
static int map_e2[][2] = |
{ |
[0x41] = { 0, KC_UP }, |
[0x42] = { 0, KC_DOWN }, |
[0x44] = { 0, KC_LEFT }, |
[0x43] = { 0, KC_RIGHT }, |
}; |
0, KC_UP, 0x1b, 0x5b, 0x41, GSP_END, |
0, KC_LEFT, 0x1b, 0x5b, 0x44, GSP_END, |
0, KC_DOWN, 0x1b, 0x5b, 0x42, GSP_END, |
0, KC_RIGHT, 0x1b, 0x5b, 0x43, GSP_END, |
static int map_e2a[][2] = |
{ |
[0x35] = { 0, KC_F5 }, |
[0x37] = { 0, KC_F6 }, |
[0x38] = { 0, KC_F7 }, |
[0x39] = { 0, KC_F8 }, |
}; |
0, 0 |
static int map_e2b[][2] = |
{ |
[0x30] = { 0, KC_F9 }, |
[0x31] = { 0, KC_F10 }, |
[0x32] = { 0, KC_F11 }, |
[0x33] = { 0, KC_F12 }, |
}; |
int kbd_ctl_init(void) |
static unsigned int mods_keys[][2] = { |
{ KM_LSHIFT, KC_LSHIFT }, |
{ 0, 0 } |
}; |
static enum dec_state ds; |
void kbd_ctl_parse_scancode(int scancode) |
{ |
ds = 0; |
switch (ds) { |
case ds_start: parse_ds_start(scancode); break; |
case ds_e: parse_ds_e(scancode); break; |
case ds_e1: parse_ds_e1(scancode); break; |
case ds_e2: parse_ds_e2(scancode); break; |
case ds_e2a: parse_ds_e2a(scancode); break; |
case ds_e2b: parse_ds_e2b(scancode); break; |
} |
} |
gsp_init(&sp); |
return gsp_insert_defs(&sp, seq_defs); |
static void parse_ds_start(int scancode) |
{ |
if (scancode == 0x1b) { |
ds = ds_e; |
return; |
} |
parse_leaf(scancode, map_start, sizeof(map_start) / (2 * sizeof(int))); |
} |
void kbd_ctl_parse_scancode(int scancode) |
static void parse_ds_e(int scancode) |
{ |
unsigned mods, key; |
if (scancode < 0 || scancode >= 0x80) return; |
ds = gsp_step(&sp, ds, scancode, &mods, &key); |
switch (scancode) { |
case 0x4f: ds = ds_e1; return; |
case 0x5b: ds = ds_e2; return; |
case 0x1b: ds = ds_start; break; |
default: ds = ds_start; return; |
} |
kbd_push_ev(KE_PRESS, KC_ESCAPE); |
} |
static void parse_ds_e1(int scancode) |
{ |
parse_leaf(scancode, map_e1, sizeof(map_e1) / (2 * sizeof(int))); |
} |
static void parse_ds_e2(int scancode) |
{ |
switch (scancode) { |
case 0x31: ds = ds_e2a; break; |
case 0x32: ds = ds_e2b; break; |
default: ds = ds_start; break; |
} |
parse_leaf(scancode, map_e2, sizeof(map_e2) / (2 * sizeof(int))); |
} |
static void parse_ds_e2a(int scancode) |
{ |
parse_leaf(scancode, map_e2a, sizeof(map_e2a) / (2 * sizeof(int))); |
} |
static void parse_ds_e2b(int scancode) |
{ |
parse_leaf(scancode, map_e2b, sizeof(map_e2b) / (2 * sizeof(int))); |
} |
static void parse_leaf(int scancode, int (*map)[2], size_t map_length) |
{ |
unsigned int key, mod; |
int i; |
ds = ds_start; |
if (scancode < 0 || scancode >= map_length) |
return; |
mod = map[scancode][0]; |
key = map[scancode][1]; |
/* Simulate modifier pressing. */ |
i = 0; |
while (mods_keys[i][0] != 0) { |
if (mod & mods_keys[i][0]) { |
kbd_push_ev(KE_PRESS, mods_keys[i][1]); |
} |
++i; |
} |
if (key != 0) { |
stroke_sim(mods, key); |
kbd_push_ev(KE_PRESS, key); |
kbd_push_ev(KE_RELEASE, key); |
} |
/* Simulate modifier releasing. */ |
i = 0; |
while (mods_keys[i][0] != 0) { |
if (mod & mods_keys[i][0]) { |
kbd_push_ev(KE_RELEASE, mods_keys[i][1]); |
} |
++i; |
} |
} |
/** |
* @} |
*/ |
/branches/dynload/uspace/srv/kbd/ctl/sun.c |
---|
45,11 → 45,6 |
static int scanmap_simple[]; |
int kbd_ctl_init(void) |
{ |
return 0; |
} |
void kbd_ctl_parse_scancode(int scancode) |
{ |
kbd_ev_type_t type; |
/branches/dynload/uspace/srv/kbd/ctl/gxe_fb.c |
---|
39,189 → 39,282 |
#include <kbd/kbd.h> |
#include <kbd/keycode.h> |
#include <kbd_ctl.h> |
#include <gsp.h> |
#include <stroke.h> |
/** Scancode parser */ |
static gsp_t sp; |
static void parse_ds_start(int scancode); |
static void parse_ds_e(int scancode); |
static void parse_ds_e1(int scancode); |
static void parse_ds_e1a(int scancode); |
static void parse_ds_e1b(int scancode); |
static void parse_ds_e1c(int scancode); |
/** Current parser state */ |
static int ds; |
static void parse_leaf(int scancode, int (*map)[2], size_t map_length); |
#include <stdio.h> |
enum dec_state { |
ds_start, |
ds_e, |
ds_e1, |
ds_e1a, |
ds_e1b, |
ds_e1c |
}; |
int seq_defs[] = { |
/* Not shifted */ |
static int map_start[][2] = { |
0, KC_BACKTICK, 0x60, GSP_END, |
[0x60] = { 0, KC_BACKTICK }, |
0, KC_1, 0x31, GSP_END, |
0, KC_2, 0x32, GSP_END, |
0, KC_3, 0x33, GSP_END, |
0, KC_4, 0x34, GSP_END, |
0, KC_5, 0x35, GSP_END, |
0, KC_6, 0x36, GSP_END, |
0, KC_7, 0x37, GSP_END, |
0, KC_8, 0x38, GSP_END, |
0, KC_9, 0x39, GSP_END, |
0, KC_0, 0x30, GSP_END, |
[0x31] = { 0, KC_1 }, |
[0x32] = { 0, KC_2 }, |
[0x33] = { 0, KC_3 }, |
[0x34] = { 0, KC_4 }, |
[0x35] = { 0, KC_5 }, |
[0x36] = { 0, KC_6 }, |
[0x37] = { 0, KC_7 }, |
[0x38] = { 0, KC_8 }, |
[0x39] = { 0, KC_9 }, |
[0x30] = { 0, KC_0 }, |
0, KC_MINUS, 0x2d, GSP_END, |
0, KC_EQUALS, 0x3d, GSP_END, |
0, KC_BACKSPACE, 0x08, GSP_END, |
[0x2d] = { 0, KC_MINUS }, |
[0x3d] = { 0, KC_EQUALS }, |
[0x08] = { 0, KC_BACKSPACE }, |
0, KC_TAB, 0x09, GSP_END, |
[0x0f] = { 0, KC_TAB }, |
0, KC_Q, 0x71, GSP_END, |
0, KC_W, 0x77, GSP_END, |
0, KC_E, 0x65, GSP_END, |
0, KC_R, 0x72, GSP_END, |
0, KC_T, 0x74, GSP_END, |
0, KC_Y, 0x79, GSP_END, |
0, KC_U, 0x75, GSP_END, |
0, KC_I, 0x69, GSP_END, |
0, KC_O, 0x6f, GSP_END, |
0, KC_P, 0x70, GSP_END, |
[0x71] = { 0, KC_Q }, |
[0x77] = { 0, KC_W }, |
[0x65] = { 0, KC_E }, |
[0x72] = { 0, KC_R }, |
[0x74] = { 0, KC_T }, |
[0x79] = { 0, KC_Y }, |
[0x75] = { 0, KC_U }, |
[0x69] = { 0, KC_I }, |
[0x6f] = { 0, KC_O }, |
[0x70] = { 0, KC_P }, |
0, KC_LBRACKET, 0x5b, GSP_END, |
0, KC_RBRACKET, 0x5d, GSP_END, |
[0x5b] = { 0, KC_LBRACKET }, |
[0x5d] = { 0, KC_RBRACKET }, |
0, KC_A, 0x61, GSP_END, |
0, KC_S, 0x73, GSP_END, |
0, KC_D, 0x64, GSP_END, |
0, KC_F, 0x66, GSP_END, |
0, KC_G, 0x67, GSP_END, |
0, KC_H, 0x68, GSP_END, |
0, KC_J, 0x6a, GSP_END, |
0, KC_K, 0x6b, GSP_END, |
0, KC_L, 0x6c, GSP_END, |
[0x61] = { 0, KC_A }, |
[0x73] = { 0, KC_S }, |
[0x64] = { 0, KC_D }, |
[0x66] = { 0, KC_F }, |
[0x67] = { 0, KC_G }, |
[0x68] = { 0, KC_H }, |
[0x6a] = { 0, KC_J }, |
[0x6b] = { 0, KC_K }, |
[0x6c] = { 0, KC_L }, |
0, KC_SEMICOLON, 0x3b, GSP_END, |
0, KC_QUOTE, 0x27, GSP_END, |
0, KC_BACKSLASH, 0x5c, GSP_END, |
[0x3b] = { 0, KC_SEMICOLON }, |
[0x27] = { 0, KC_QUOTE }, |
[0x5c] = { 0, KC_BACKSLASH }, |
0, KC_Z, 0x7a, GSP_END, |
0, KC_X, 0x78, GSP_END, |
0, KC_C, 0x63, GSP_END, |
0, KC_V, 0x76, GSP_END, |
0, KC_B, 0x62, GSP_END, |
0, KC_N, 0x6e, GSP_END, |
0, KC_M, 0x6d, GSP_END, |
[0x7a] = { 0, KC_Z }, |
[0x78] = { 0, KC_X }, |
[0x63] = { 0, KC_C }, |
[0x76] = { 0, KC_V }, |
[0x62] = { 0, KC_B }, |
[0x6e] = { 0, KC_N }, |
[0x6d] = { 0, KC_M }, |
0, KC_COMMA, 0x2c, GSP_END, |
0, KC_PERIOD, 0x2e, GSP_END, |
0, KC_SLASH, 0x2f, GSP_END, |
[0x2c] = { 0, KC_COMMA }, |
[0x2e] = { 0, KC_PERIOD }, |
[0x2f] = { 0, KC_SLASH }, |
/* Shifted */ |
[0x20] = { 0, KC_SPACE }, |
KM_SHIFT, KC_BACKTICK, 0x7e, GSP_END, |
[0x1b] = { 0, KC_ESCAPE }, |
KM_SHIFT, KC_1, 0x21, GSP_END, |
KM_SHIFT, KC_2, 0x40, GSP_END, |
KM_SHIFT, KC_3, 0x23, GSP_END, |
KM_SHIFT, KC_4, 0x24, GSP_END, |
KM_SHIFT, KC_5, 0x25, GSP_END, |
KM_SHIFT, KC_6, 0x5e, GSP_END, |
KM_SHIFT, KC_7, 0x26, GSP_END, |
KM_SHIFT, KC_8, 0x2a, GSP_END, |
KM_SHIFT, KC_9, 0x28, GSP_END, |
KM_SHIFT, KC_0, 0x29, GSP_END, |
[0x0a] = { 0, KC_ENTER }, |
[0x0d] = { 0, KC_ENTER }, |
KM_SHIFT, KC_MINUS, 0x5f, GSP_END, |
KM_SHIFT, KC_EQUALS, 0x2b, GSP_END, |
/* with Shift pressed */ |
KM_SHIFT, KC_Q, 0x51, GSP_END, |
KM_SHIFT, KC_W, 0x57, GSP_END, |
KM_SHIFT, KC_E, 0x45, GSP_END, |
KM_SHIFT, KC_R, 0x52, GSP_END, |
KM_SHIFT, KC_T, 0x54, GSP_END, |
KM_SHIFT, KC_Y, 0x59, GSP_END, |
KM_SHIFT, KC_U, 0x55, GSP_END, |
KM_SHIFT, KC_I, 0x49, GSP_END, |
KM_SHIFT, KC_O, 0x4f, GSP_END, |
KM_SHIFT, KC_P, 0x50, GSP_END, |
[0x7e] = { KM_LSHIFT, KC_BACKTICK }, |
KM_SHIFT, KC_LBRACKET, 0x7b, GSP_END, |
KM_SHIFT, KC_RBRACKET, 0x7d, GSP_END, |
[0x21] = { KM_LSHIFT, KC_1 }, |
[0x40] = { KM_LSHIFT, KC_2 }, |
[0x23] = { KM_LSHIFT, KC_3 }, |
[0x24] = { KM_LSHIFT, KC_4 }, |
[0x25] = { KM_LSHIFT, KC_5 }, |
[0x5e] = { KM_LSHIFT, KC_6 }, |
[0x26] = { KM_LSHIFT, KC_7 }, |
[0x2a] = { KM_LSHIFT, KC_8 }, |
[0x28] = { KM_LSHIFT, KC_9 }, |
[0x29] = { KM_LSHIFT, KC_0 }, |
KM_SHIFT, KC_A, 0x41, GSP_END, |
KM_SHIFT, KC_S, 0x53, GSP_END, |
KM_SHIFT, KC_D, 0x44, GSP_END, |
KM_SHIFT, KC_F, 0x46, GSP_END, |
KM_SHIFT, KC_G, 0x47, GSP_END, |
KM_SHIFT, KC_H, 0x48, GSP_END, |
KM_SHIFT, KC_J, 0x4a, GSP_END, |
KM_SHIFT, KC_K, 0x4b, GSP_END, |
KM_SHIFT, KC_L, 0x4c, GSP_END, |
[0x5f] = { KM_LSHIFT, KC_MINUS }, |
[0x2b] = { KM_LSHIFT, KC_EQUALS }, |
KM_SHIFT, KC_SEMICOLON, 0x3a, GSP_END, |
KM_SHIFT, KC_QUOTE, 0x22, GSP_END, |
KM_SHIFT, KC_BACKSLASH, 0x7c, GSP_END, |
[0x51] = { KM_LSHIFT, KC_Q }, |
[0x57] = { KM_LSHIFT, KC_W }, |
[0x45] = { KM_LSHIFT, KC_E }, |
[0x52] = { KM_LSHIFT, KC_R }, |
[0x54] = { KM_LSHIFT, KC_T }, |
[0x59] = { KM_LSHIFT, KC_Y }, |
[0x55] = { KM_LSHIFT, KC_U }, |
[0x49] = { KM_LSHIFT, KC_I }, |
[0x4f] = { KM_LSHIFT, KC_O }, |
[0x50] = { KM_LSHIFT, KC_P }, |
KM_SHIFT, KC_Z, 0x5a, GSP_END, |
KM_SHIFT, KC_X, 0x58, GSP_END, |
KM_SHIFT, KC_C, 0x43, GSP_END, |
KM_SHIFT, KC_V, 0x56, GSP_END, |
KM_SHIFT, KC_B, 0x42, GSP_END, |
KM_SHIFT, KC_N, 0x4e, GSP_END, |
KM_SHIFT, KC_M, 0x4d, GSP_END, |
[0x7b] = { KM_LSHIFT, KC_LBRACKET }, |
[0x7d] = { KM_LSHIFT, KC_RBRACKET }, |
KM_SHIFT, KC_COMMA, 0x3c, GSP_END, |
KM_SHIFT, KC_PERIOD, 0x3e, GSP_END, |
KM_SHIFT, KC_SLASH, 0x3f, GSP_END, |
[0x41] = { KM_LSHIFT, KC_A }, |
[0x53] = { KM_LSHIFT, KC_S }, |
[0x44] = { KM_LSHIFT, KC_D }, |
[0x46] = { KM_LSHIFT, KC_F }, |
[0x47] = { KM_LSHIFT, KC_G }, |
[0x48] = { KM_LSHIFT, KC_H }, |
[0x4a] = { KM_LSHIFT, KC_J }, |
[0x4b] = { KM_LSHIFT, KC_K }, |
[0x4c] = { KM_LSHIFT, KC_L }, |
/* ... */ |
[0x3a] = { KM_LSHIFT, KC_SEMICOLON }, |
[0x22] = { KM_LSHIFT, KC_QUOTE }, |
[0x7c] = { KM_LSHIFT, KC_BACKSLASH }, |
0, KC_SPACE, 0x20, GSP_END, |
0, KC_ENTER, 0x0a, GSP_END, |
0, KC_ENTER, 0x0d, GSP_END, |
[0x5a] = { KM_LSHIFT, KC_Z }, |
[0x58] = { KM_LSHIFT, KC_X }, |
[0x43] = { KM_LSHIFT, KC_C }, |
[0x56] = { KM_LSHIFT, KC_V }, |
[0x42] = { KM_LSHIFT, KC_B }, |
[0x4e] = { KM_LSHIFT, KC_N }, |
[0x4d] = { KM_LSHIFT, KC_M }, |
0, KC_ESCAPE, 0x1b, 0x1b, GSP_END, |
[0x3c] = { KM_LSHIFT, KC_COMMA }, |
[0x3e] = { KM_LSHIFT, KC_PERIOD }, |
[0x3f] = { KM_LSHIFT, KC_SLASH } |
}; |
0, KC_F1, 0x1b, 0x5b, 0x4f, 0x50, GSP_END, |
0, KC_F2, 0x1b, 0x5b, 0x4f, 0x51, GSP_END, |
0, KC_F3, 0x1b, 0x5b, 0x4f, 0x52, GSP_END, |
0, KC_F4, 0x1b, 0x5b, 0x4f, 0x53, GSP_END, |
0, KC_F5, 0x1b, 0x5b, 0x31, 0x35, GSP_END, |
0, KC_F6, 0x1b, 0x5b, 0x31, 0x37, GSP_END, |
0, KC_F7, 0x1b, 0x5b, 0x31, 0x38, GSP_END, |
0, KC_F8, 0x1b, 0x5b, 0x31, 0x39, GSP_END, |
0, KC_F9, 0x1b, 0x5b, 0x32, 0x38, GSP_END, |
0, KC_F10, 0x1b, 0x5b, 0x32, 0x39, GSP_END, |
0, KC_F11, 0x1b, 0x5b, 0x32, 0x33, GSP_END, |
0, KC_F12, 0x1b, 0x5b, 0x32, 0x34, GSP_END, |
static int map_e1[][2] = |
{ |
}; |
0, KC_INSERT, 0x1b, 0x5b, 0x32, 0x7e, GSP_END, |
0, KC_HOME, 0x1b, 0x5b, 0x48, GSP_END, |
0, KC_PAGE_UP, 0x1b, 0x5b, 0x35, 0x7e, GSP_END, |
0, KC_DELETE, 0x1b, 0x5b, 0x33, 0x7e, GSP_END, |
0, KC_END, 0x1b, 0x5b, 0x46, GSP_END, |
0, KC_PAGE_DOWN, 0x1b, 0x5b, 0x36, 0x7e, GSP_END, |
static int map_e1a[][2] = |
{ |
[0x50] = { 0, KC_F1 }, |
[0x51] = { 0, KC_F2 }, |
[0x52] = { 0, KC_F3 }, |
[0x53] = { 0, KC_F4 }, |
}; |
0, KC_UP, 0x1b, 0x5b, 0x41, GSP_END, |
0, KC_LEFT, 0x1b, 0x5b, 0x44, GSP_END, |
0, KC_DOWN, 0x1b, 0x5b, 0x42, GSP_END, |
0, KC_RIGHT, 0x1b, 0x5b, 0x43, GSP_END, |
static int map_e1b[][2] = |
{ |
[0x33] = { 0, KC_F5 }, |
[0x37] = { 0, KC_F6 }, |
[0x38] = { 0, KC_F7 }, |
[0x39] = { 0, KC_F8 }, |
}; |
0, 0 |
static int map_e1c[][2] = |
{ |
[0x38] = { 0, KC_F9 }, |
[0x39] = { 0, KC_F10 }, |
[0x33] = { 0, KC_F11 }, |
[0x34] = { 0, KC_F12 }, |
}; |
int kbd_ctl_init(void) |
static unsigned int mods_keys[][2] = { |
{ KM_LSHIFT, KC_LSHIFT }, |
{ 0, 0 } |
}; |
static enum dec_state ds = ds_start; |
void kbd_ctl_parse_scancode(int scancode) |
{ |
ds = 0; |
switch (ds) { |
case ds_start: parse_ds_start(scancode); break; |
case ds_e: parse_ds_e(scancode); break; |
case ds_e1: parse_ds_e1(scancode); break; |
case ds_e1a: parse_ds_e1a(scancode); break; |
case ds_e1b: parse_ds_e1b(scancode); break; |
case ds_e1c: parse_ds_e1c(scancode); break; |
} |
} |
gsp_init(&sp); |
return gsp_insert_defs(&sp, seq_defs); |
static void parse_ds_start(int scancode) |
{ |
if (scancode == 0x1b) { |
ds = ds_e; |
return; |
} |
parse_leaf(scancode, map_start, sizeof(map_start) / (2 * sizeof(int))); |
} |
void kbd_ctl_parse_scancode(int scancode) |
static void parse_ds_e(int scancode) |
{ |
unsigned mods, key; |
switch (scancode) { |
case 0x5b: ds = ds_e1; return; |
case 0x1b: ds = ds_start; break; |
default: ds = ds_start; return; |
} |
ds = gsp_step(&sp, ds, scancode, &mods, &key); |
kbd_push_ev(KE_PRESS, KC_ESCAPE); |
} |
static void parse_ds_e1(int scancode) |
{ |
switch (scancode) { |
case 0x4f: ds = ds_e1a; return; |
case 0x31: ds = ds_e1b; return; |
case 0x32: ds = ds_e1c; return; |
default: ds = ds_start; break; |
} |
parse_leaf(scancode, map_e1, sizeof(map_e1) / (2 * sizeof(int))); |
} |
static void parse_ds_e1a(int scancode) |
{ |
parse_leaf(scancode, map_e1a, sizeof(map_e1a) / (2 * sizeof(int))); |
} |
static void parse_ds_e1b(int scancode) |
{ |
parse_leaf(scancode, map_e1b, sizeof(map_e1b) / (2 * sizeof(int))); |
} |
static void parse_ds_e1c(int scancode) |
{ |
parse_leaf(scancode, map_e1c, sizeof(map_e1c) / (2 * sizeof(int))); |
} |
static void parse_leaf(int scancode, int (*map)[2], size_t map_length) |
{ |
unsigned int key, mod; |
int i; |
ds = ds_start; |
if (scancode < 0 || scancode >= map_length) |
return; |
mod = map[scancode][0]; |
key = map[scancode][1]; |
/* Simulate modifier pressing. */ |
i = 0; |
while (mods_keys[i][0] != 0) { |
if (mod & mods_keys[i][0]) { |
kbd_push_ev(KE_PRESS, mods_keys[i][1]); |
} |
++i; |
} |
if (key != 0) { |
stroke_sim(mods, key); |
kbd_push_ev(KE_PRESS, key); |
kbd_push_ev(KE_RELEASE, key); |
} |
/* Simulate modifier releasing. */ |
i = 0; |
while (mods_keys[i][0] != 0) { |
if (mod & mods_keys[i][0]) { |
kbd_push_ev(KE_RELEASE, mods_keys[i][1]); |
} |
++i; |
} |
} |
/** |
/branches/dynload/uspace/srv/kbd/include/gsp.h |
---|
File deleted |
/branches/dynload/uspace/srv/kbd/include/stroke.h |
---|
File deleted |
/branches/dynload/uspace/srv/kbd/include/kbd_ctl.h |
---|
38,9 → 38,7 |
#define KBD_CTL_H_ |
extern void kbd_ctl_parse_scancode(int); |
extern int kbd_ctl_init(void); |
#endif |
/** |
/branches/dynload/uspace/srv/kbd/Makefile |
---|
44,8 → 44,6 |
OUTPUT = kbd |
GENERIC_SOURCES = \ |
generic/kbd.c \ |
genarch/gsp.c \ |
genarch/stroke.c \ |
generic/key_buffer.c |
ARCH_SOURCES = |
79,16 → 77,11 |
port/i8042.c \ |
ctl/pc.c |
endif |
ifeq ($(MACHINE), i460GX) |
ifeq ($(UARCH), ia64) |
GENARCH_SOURCES += \ |
port/i8042.c \ |
ctl/pc.c |
endif |
ifeq ($(MACHINE), ski) |
GENARCH_SOURCES += \ |
port/ski.c \ |
ctl/stty.c |
endif |
ifeq ($(MACHINE), msim) |
GENARCH_SOURCES += \ |
port/msim.c \ |
116,15 → 109,9 |
ctl/stty.c |
endif |
ifeq ($(UARCH), sparc64) |
ifeq ($(MACHINE),serengeti) |
GENARCH_SOURCES += \ |
port/sgcn.c \ |
ctl/stty.c |
else |
GENARCH_SOURCES += \ |
port/z8530.c \ |
ctl/sun.c |
endif |
endif |
GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES))) |
135,12 → 122,16 |
.PHONY: all clean depend disasm links |
all: $(OUTPUT) $(OUTPUT).disasm |
all: links $(OUTPUT) $(OUTPUT).disasm |
-include Makefile.depend |
links: |
ln -sfn ../arch/$(UARCH)/include include/arch |
ln -sfn ../genarch/include include/genarch |
clean: |
-rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend $(OBJECTS) |
-rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend include/arch include/genarch $(OBJECTS) |
depend: |
$(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend |
/branches/dynload/uspace/srv/fb/serial_console.c |
---|
46,8 → 46,6 |
#include <console/color.h> |
#include <console/style.h> |
#include "../console/screenbuffer.h" |
#include "main.h" |
#include "serial_console.h" |
#define MAX_CONTROL 20 |
54,8 → 52,8 |
static void serial_sgr(const unsigned int mode); |
static int scr_width; |
static int scr_height; |
static int width; |
static int height; |
static bool color = true; /** True if producing color output. */ |
static putc_function_t putc_function; |
104,7 → 102,7 |
void serial_goto(const unsigned int row, const unsigned int col) |
{ |
if ((row > scr_height) || (col > scr_width)) |
if ((row > height) || (col > width)) |
return; |
char control[MAX_CONTROL]; |
127,7 → 125,7 |
void serial_scroll(int i) |
{ |
if (i > 0) { |
serial_goto(scr_height - 1, 0); |
serial_goto(height - 1, 0); |
while (i--) |
serial_puts("\033D"); |
} else if (i < 0) { |
165,84 → 163,11 |
void serial_console_init(putc_function_t putc_fn, uint32_t w, uint32_t h) |
{ |
scr_width = w; |
scr_height = h; |
width = w; |
height = h; |
putc_function = putc_fn; |
} |
static void serial_set_style(int style) |
{ |
if (style == STYLE_EMPHASIS) { |
if (color) { |
serial_sgr(SGR_RESET); |
serial_sgr(SGR_FGCOLOR + CI_RED); |
serial_sgr(SGR_BGCOLOR + CI_WHITE); |
} |
serial_sgr(SGR_BOLD); |
} else { |
if (color) { |
serial_sgr(SGR_RESET); |
serial_sgr(SGR_FGCOLOR + CI_BLACK); |
serial_sgr(SGR_BGCOLOR + CI_WHITE); |
} |
serial_sgr(SGR_NORMAL_INT); |
} |
} |
static void serial_set_idx(unsigned fgcolor, unsigned bgcolor, |
unsigned flags) |
{ |
if (color) { |
serial_sgr(SGR_RESET); |
serial_sgr(SGR_FGCOLOR + color_map[fgcolor]); |
serial_sgr(SGR_BGCOLOR + color_map[bgcolor]); |
} else { |
if (fgcolor < bgcolor) |
serial_sgr(SGR_RESET); |
else |
serial_sgr(SGR_REVERSE); |
} |
} |
static void serial_set_rgb(uint32_t fgcolor, uint32_t bgcolor) |
{ |
if (fgcolor < bgcolor) |
serial_sgr(SGR_REVERSE_OFF); |
else |
serial_sgr(SGR_REVERSE); |
} |
static void serial_set_attrs(const attrs_t *a) |
{ |
switch (a->t) { |
case at_style: serial_set_style(a->a.s.style); break; |
case at_rgb: serial_set_rgb(a->a.r.fg_color, a->a.r.bg_color); break; |
case at_idx: serial_set_idx(a->a.i.fg_color, |
a->a.i.bg_color, a->a.i.flags); break; |
default: break; |
} |
} |
static void draw_text_data(keyfield_t *data) |
{ |
int i, j; |
attrs_t *a0, *a1; |
serial_goto(0, 0); |
a0 = &data[0].attrs; |
serial_set_attrs(a0); |
for (i = 0; i < scr_height; i++) { |
for (j = 0; j < scr_width; j++) { |
a1 = &data[i * scr_width + j].attrs; |
if (!attrs_same(*a0, *a1)) |
serial_set_attrs(a1); |
(*putc_function)(data[i * scr_width + j].character); |
a0 = a1; |
} |
} |
} |
/** |
* Main function of the thread serving client connections. |
*/ |
251,9 → 176,6 |
int retval; |
ipc_callid_t callid; |
ipc_call_t call; |
keyfield_t *interbuf = NULL; |
size_t intersize = 0; |
char c; |
int lastcol = 0; |
int lastrow = 0; |
261,10 → 183,8 |
int newrow; |
int fgcolor; |
int bgcolor; |
int flags; |
int style; |
int i; |
if (client_connected) { |
ipc_answer_0(iid, ELIMIT); |
278,7 → 198,7 |
to 0 - height rows. */ |
serial_clrscr(); |
serial_goto(0, 0); |
serial_set_scroll_region(scr_height); |
serial_set_scroll_region(height); |
while (true) { |
callid = async_get_call(&call); |
287,25 → 207,6 |
client_connected = 0; |
ipc_answer_0(callid, EOK); |
return; |
case IPC_M_SHARE_OUT: |
/* We accept one area for data interchange */ |
intersize = IPC_GET_ARG2(call); |
if (intersize >= scr_width * scr_height * |
sizeof(*interbuf)) { |
receive_comm_area(callid, &call, |
(void *) &interbuf); |
continue; |
} |
retval = EINVAL; |
break; |
case FB_DRAW_TEXT_DATA: |
if (!interbuf) { |
retval = EINVAL; |
break; |
} |
draw_text_data(interbuf); |
retval = 0; |
break; |
case FB_PUTCHAR: |
c = IPC_GET_ARG1(call); |
newrow = IPC_GET_ARG2(call); |
326,7 → 227,7 |
retval = 0; |
break; |
case FB_GET_CSIZE: |
ipc_answer_2(callid, EOK, scr_height, scr_width); |
ipc_answer_2(callid, EOK, height, width); |
continue; |
case FB_CLEAR: |
serial_clrscr(); |
333,28 → 234,52 |
retval = 0; |
break; |
case FB_SET_STYLE: |
style = IPC_GET_ARG1(call); |
serial_set_style(style); |
style = IPC_GET_ARG1(call); |
if (style == STYLE_EMPHASIS) { |
if (color) { |
serial_sgr(SGR_RESET); |
serial_sgr(SGR_FGCOLOR + CI_RED); |
serial_sgr(SGR_BGCOLOR + CI_WHITE); |
} |
serial_sgr(SGR_BOLD); |
} else { |
if (color) { |
serial_sgr(SGR_RESET); |
serial_sgr(SGR_FGCOLOR + CI_BLACK); |
serial_sgr(SGR_BGCOLOR + CI_WHITE); |
} |
serial_sgr(SGR_NORMAL_INT); |
} |
retval = 0; |
break; |
case FB_SET_COLOR: |
fgcolor = IPC_GET_ARG1(call); |
bgcolor = IPC_GET_ARG2(call); |
flags = IPC_GET_ARG3(call); |
serial_set_idx(fgcolor, bgcolor, flags); |
if (color) { |
serial_sgr(SGR_RESET); |
serial_sgr(SGR_FGCOLOR + color_map[fgcolor]); |
serial_sgr(SGR_BGCOLOR + color_map[bgcolor]); |
} else { |
if (fgcolor < bgcolor) |
serial_sgr(SGR_RESET); |
else |
serial_sgr(SGR_REVERSE); |
} |
retval = 0; |
break; |
case FB_SET_RGB_COLOR: |
fgcolor = IPC_GET_ARG1(call); |
bgcolor = IPC_GET_ARG2(call); |
serial_set_rgb(fgcolor, bgcolor); |
if (fgcolor < bgcolor) |
serial_sgr(SGR_REVERSE_OFF); |
else |
serial_sgr(SGR_REVERSE); |
retval = 0; |
break; |
case FB_SCROLL: |
i = IPC_GET_ARG1(call); |
if ((i > scr_height) || (i < -scr_height)) { |
if ((i > height) || (i < -height)) { |
retval = EINVAL; |
break; |
} |
/branches/dynload/uspace/srv/fb/serial_console.h |
---|
46,6 → 46,7 |
void serial_goto(const unsigned int row, const unsigned int col); |
void serial_clrscr(void); |
void serial_scroll(int i); |
void serial_set_style(const unsigned int mode); |
void serial_cursor_disable(void); |
void serial_cursor_enable(void); |
void serial_set_scroll_region(unsigned height); |
/branches/dynload/uspace/srv/obio/obio.c |
---|
94,7 → 94,7 |
switch (IPC_GET_METHOD(call)) { |
case BUS_CLEAR_INTERRUPT: |
inr = IPC_GET_ARG1(call); |
base_virt[OBIO_CIR(inr & INO_MASK)] = 0; |
base_virt[OBIO_CIR(inr) & INO_MASK] = 0; |
ipc_answer_0(callid, EOK); |
break; |
default: |