/branches/sparc/uspace/srv/kbd/genarch/src/nofb.c |
---|
36,7 → 36,6 |
*/ |
#include <genarch/nofb.h> |
#include <stdio.h> // DELETE!!! |
#define KEY_F1 0x504f1bL |
#define KEY_F2 0x514f1bL |
179,7 → 178,6 |
buf = count = 0; |
return 1; |
} |
return 1; |
} |
/branches/sparc/uspace/srv/kbd/arch/sparc64/src/sgcn.c |
---|
67,6 → 67,18 |
/** offset within the SGCN buffer of the input buffer write pointer */ |
uint32_t in_wrptr; |
/** offset within the SGCN buffer of the output buffer start */ |
uint32_t out_begin; |
/** offset within the SGCN buffer of the output buffer end */ |
uint32_t out_end; |
/** offset within the SGCN buffer of the output buffer read pointer */ |
uint32_t out_rdptr; |
/** offset within the SGCN buffer of the output buffer write pointer */ |
uint32_t out_wrptr; |
} __attribute__ ((packed)) sgcn_buffer_header_t; |
/* |
113,6 → 125,8 |
0, (void *) 0); |
} |
/** |
* Handler of the "key pressed" event. Reads codes of all the pressed keys from |
* the buffer. |
139,6 → 153,7 |
if (c == '\r') { |
c = '\n'; |
} |
//keybuffer_push(&keybuffer, c); |
kbd_process_no_fb(&keybuffer, c); |
} |
} |
/branches/sparc/uspace/srv/fb/serial_console.c |
---|
File deleted |
\ No newline at end of file |
/branches/sparc/uspace/srv/fb/serial_console.h |
---|
File deleted |
\ No newline at end of file |
/branches/sparc/uspace/srv/fb/sgcn.c |
---|
44,12 → 44,13 |
#include <stdio.h> |
#include <ddi.h> |
#include "serial_console.h" |
#include "sgcn.h" |
#define WIDTH 80 |
#define HEIGHT 24 |
#define MAX_CONTROL 20 |
/** |
* Virtual address mapped to SRAM. |
*/ |
72,7 → 73,19 |
char magic[4]; |
/** we don't need this */ |
char unused[24]; |
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; |
/** offset within the SGCN buffer of the output buffer start */ |
uint32_t out_begin; |
87,6 → 100,8 |
uint32_t out_wrptr; |
} __attribute__ ((packed)) sgcn_buffer_header_t; |
// TODO it is suggested to extract the common parts of this file and the msim.c file |
// into a separate file and place that file to the genarch directory |
/* |
* Returns a pointer to the object of a given type which is placed at the given |
117,6 → 132,57 |
*out_wrptr_ptr = new_wrptr; |
} |
static void sgcn_puts(char *str) |
{ |
while (*str) |
sgcn_putc(*(str++)); |
} |
static void sgcn_goto(const unsigned int row, const unsigned int col) |
{ |
if ((row > HEIGHT) || (col > WIDTH)) |
return; |
char control[20]; |
snprintf(control, 20, "\033[%u;%uf", row + 1, col + 1); |
sgcn_puts(control); |
} |
static void sgcn_clrscr(void) |
{ |
sgcn_puts("\033[2J"); |
} |
static void sgcn_scroll(int i) |
{ |
if (i > 0) { |
sgcn_goto(HEIGHT - 1, 0); |
while (i--) |
sgcn_puts("\033D"); |
} else if (i < 0) { |
sgcn_goto(0, 0); |
while (i++) |
sgcn_puts("\033M"); |
} |
} |
static void sgcn_set_style(const unsigned int mode) |
{ |
char control[MAX_CONTROL]; |
snprintf(control, MAX_CONTROL, "\033[%um", mode); |
sgcn_puts(control); |
} |
static void sgcn_cursor_disable(void) |
{ |
sgcn_puts("\033[?25l"); |
} |
static void sgcn_cursor_enable(void) |
{ |
sgcn_puts("\033[?25h"); |
} |
static void sgcn_client_connection(ipc_callid_t iid, ipc_call_t *icall) |
{ |
int retval; |
141,9 → 207,9 |
/* Clear the terminal, set scrolling region |
to 0 - 24 lines */ |
serial_clrscr(); |
serial_goto(0, 0); |
serial_puts("\033[0;24r"); |
sgcn_clrscr(); |
sgcn_goto(0, 0); |
sgcn_puts("\033[0;24r"); |
while (true) { |
callid = async_get_call(&call); |
157,7 → 223,7 |
newrow = IPC_GET_ARG2(call); |
newcol = IPC_GET_ARG3(call); |
if ((lastcol != newcol) || (lastrow != newrow)) |
serial_goto(newrow, newcol); |
sgcn_goto(newrow, newcol); |
lastcol = newcol + 1; |
lastrow = newrow; |
sgcn_putc(c); |
166,7 → 232,7 |
case FB_CURSOR_GOTO: |
newrow = IPC_GET_ARG1(call); |
newcol = IPC_GET_ARG2(call); |
serial_goto(newrow, newcol); |
sgcn_goto(newrow, newcol); |
lastrow = newrow; |
lastcol = newcol; |
retval = 0; |
175,7 → 241,7 |
ipc_answer_2(callid, EOK, HEIGHT, WIDTH); |
continue; |
case FB_CLEAR: |
serial_clrscr(); |
sgcn_clrscr(); |
retval = 0; |
break; |
case FB_SET_STYLE: |
182,9 → 248,9 |
fgcolor = IPC_GET_ARG1(call); |
bgcolor = IPC_GET_ARG2(call); |
if (fgcolor < bgcolor) |
serial_set_style(0); |
sgcn_set_style(0); |
else |
serial_set_style(7); |
sgcn_set_style(7); |
retval = 0; |
break; |
case FB_SCROLL: |
193,15 → 259,15 |
retval = EINVAL; |
break; |
} |
serial_scroll(i); |
serial_goto(lastrow, lastcol); |
sgcn_scroll(i); |
sgcn_goto(lastrow, lastcol); |
retval = 0; |
break; |
case FB_CURSOR_VISIBILITY: |
if(IPC_GET_ARG1(call)) |
serial_cursor_enable(); |
sgcn_cursor_enable(); |
else |
serial_cursor_disable(); |
sgcn_cursor_disable(); |
retval = 0; |
break; |
default: |
225,8 → 291,6 |
result); |
} |
serial_console_init(sgcn_putc, WIDTH, HEIGHT); |
sram_buffer_offset = sysinfo_value("sram.buffer.offset"); |
async_set_client_connection(sgcn_client_connection); |
/branches/sparc/uspace/srv/fb/Makefile |
---|
59,13 → 59,11 |
CFLAGS += -DEGA_ENABLED |
endif |
ifeq ($(ARCH), mips32) |
SOURCES += msim.c \ |
serial_console.c |
SOURCES += msim.c |
CFLAGS += -DMSIM_ENABLED -DFB_INVERT_ENDIAN |
endif |
ifeq ($(ARCH), sparc64) |
SOURCES += sgcn.c \ |
serial_console.c |
SOURCES += sgcn.c |
CFLAGS += -DSGCN_ENABLED |
endif |
/branches/sparc/uspace/srv/fb/msim.c |
---|
49,7 → 49,6 |
#include <align.h> |
#include <ddi.h> |
#include "serial_console.h" |
#include "msim.h" |
#define WIDTH 80 |
67,6 → 66,57 |
*virt_addr = c; |
} |
static void msim_puts(char *str) |
{ |
while (*str) |
*virt_addr = *(str++); |
} |
static void msim_clrscr(void) |
{ |
msim_puts("\033[2J"); |
} |
static void msim_goto(const unsigned int row, const unsigned int col) |
{ |
if ((row > HEIGHT) || (col > WIDTH)) |
return; |
char control[MAX_CONTROL]; |
snprintf(control, MAX_CONTROL, "\033[%u;%uf", row + 1, col + 1); |
msim_puts(control); |
} |
static void msim_set_style(const unsigned int mode) |
{ |
char control[MAX_CONTROL]; |
snprintf(control, MAX_CONTROL, "\033[%um", mode); |
msim_puts(control); |
} |
static void msim_cursor_disable(void) |
{ |
msim_puts("\033[?25l"); |
} |
static void msim_cursor_enable(void) |
{ |
msim_puts("\033[?25h"); |
} |
static void msim_scroll(int i) |
{ |
if (i > 0) { |
msim_goto(HEIGHT - 1, 0); |
while (i--) |
msim_puts("\033D"); |
} else if (i < 0) { |
msim_goto(0, 0); |
while (i++) |
msim_puts("\033M"); |
} |
} |
static void msim_client_connection(ipc_callid_t iid, ipc_call_t *icall) |
{ |
int retval; |
91,9 → 141,9 |
/* Clear the terminal, set scrolling region |
to 0 - 25 lines */ |
serial_clrscr(); |
serial_goto(0, 0); |
serial_puts("\033[0;25r"); |
msim_clrscr(); |
msim_goto(0, 0); |
msim_puts("\033[0;25r"); |
while (true) { |
callid = async_get_call(&call); |
107,7 → 157,7 |
newrow = IPC_GET_ARG2(call); |
newcol = IPC_GET_ARG3(call); |
if ((lastcol != newcol) || (lastrow != newrow)) |
serial_goto(newrow, newcol); |
msim_goto(newrow, newcol); |
lastcol = newcol + 1; |
lastrow = newrow; |
msim_putc(c); |
116,7 → 166,7 |
case FB_CURSOR_GOTO: |
newrow = IPC_GET_ARG1(call); |
newcol = IPC_GET_ARG2(call); |
serial_goto(newrow, newcol); |
msim_goto(newrow, newcol); |
lastrow = newrow; |
lastcol = newcol; |
retval = 0; |
125,7 → 175,7 |
ipc_answer_2(callid, EOK, HEIGHT, WIDTH); |
continue; |
case FB_CLEAR: |
serial_clrscr(); |
msim_clrscr(); |
retval = 0; |
break; |
case FB_SET_STYLE: |
132,9 → 182,9 |
fgcolor = IPC_GET_ARG1(call); |
bgcolor = IPC_GET_ARG2(call); |
if (fgcolor < bgcolor) |
serial_set_style(0); |
msim_set_style(0); |
else |
serial_set_style(7); |
msim_set_style(7); |
retval = 0; |
break; |
case FB_SCROLL: |
143,15 → 193,15 |
retval = EINVAL; |
break; |
} |
serial_scroll(i); |
serial_goto(lastrow, lastcol); |
msim_scroll(i); |
msim_goto(lastrow, lastcol); |
retval = 0; |
break; |
case FB_CURSOR_VISIBILITY: |
if(IPC_GET_ARG1(call)) |
serial_cursor_enable(); |
msim_cursor_enable(); |
else |
serial_cursor_disable(); |
msim_cursor_disable(); |
retval = 0; |
break; |
default: |
168,8 → 218,6 |
physmem_map(phys_addr, virt_addr, 1, AS_AREA_READ | AS_AREA_WRITE); |
serial_console_init(msim_putc, WIDTH, HEIGHT); |
async_set_client_connection(msim_client_connection); |
return 0; |
} |
/branches/sparc/uspace/app/init/init.c |
---|
114,11 → 114,6 |
spawn("/app/bdsh"); |
while (1) |
{ |
putchar(getchar()); |
} |
return 0; |
} |