Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 1497 → Rev 1498

/uspace/trunk/fb/sysio.c
40,8 → 40,6
/* Allow only 1 connection */
static int client_connected = 0;
 
#define CLRSCR "\033[2J"
 
static void sysput(char c)
{
__SYSCALL3(SYS_IO, 1, (sysarg_t)&c, (sysarg_t) 1);
52,11 → 50,18
__SYSCALL3(SYS_IO, 1, (sysarg_t)s, strlen(s));
}
 
/** Send clearscreen sequence to console */
static void clrscr(void)
{
sysputs("\033[2J");
}
 
/** Send ansi sequence to console to change cursor position */
static void curs_goto(unsigned int row, unsigned int col)
{
char control[20];
 
if (row > 100 || col > 100)
if (row > 200 || col > 200)
return;
 
snprintf(control, 20, "\033[%d;%df",row, col);
63,6 → 68,7
sysputs(control);
}
 
/** ANSI terminal emulation main thread */
static void sysio_client_connection(ipc_callid_t iid, ipc_call_t *icall)
{
int retval;
106,7 → 112,7
ipc_answer_fast(callid, 0, 25, 80);
continue;
case FB_CLEAR:
sysputs(CLRSCR);
clrscr();
retval = 0;
break;
default:
116,9 → 122,10
}
}
 
/** ANSI terminal emulation initialization */
void sysio_init(void)
{
async_set_client_connection(sysio_client_connection);
sysputs(CLRSCR);
clrscr();
curs_goto(0,0);
}
/uspace/trunk/fb/fb.c
165,10 → 165,18
return (((color >> 5) & 0x7) << (16 + 5)) | (((color >> 3) & 0x3) << (8 + 6)) | ((color & 0x7) << 5);
}
 
/** Put pixel into viewport
*
* @param vp Viewport identification
* @param x X coord relative to viewport
* @param y Y coord relative to viewport
* @param color RGB color
*/
static void putpixel(int vp, unsigned int x, unsigned int y, int color)
{
screen.putpixel(viewports[vp].x + x, viewports[vp].y + y, color);
}
/** Get pixel from viewport */
static int getpixel(int vp, unsigned int x, unsigned int y)
{
return screen.getpixel(viewports[vp].x + x, viewports[vp].y + y);
257,12 → 265,12
/* Character-console functions */
 
/** Draw character at given position */
static void draw_glyph(int vp,__u8 glyph, unsigned int row, unsigned int col)
static void draw_glyph(int vp,__u8 glyph, unsigned int sx, unsigned int sy)
{
unsigned int y;
 
for (y = 0; y < FONT_SCANLINES; y++)
draw_glyph_line(vp ,fb_font[glyph * FONT_SCANLINES + y], col * COL_WIDTH, row * FONT_SCANLINES + y);
draw_glyph_line(vp ,fb_font[glyph * FONT_SCANLINES + y], sx, sy + y);
}
 
/** Invert character at given position */
307,7 → 315,7
{
int i;
 
for (i=0; i < MAX_VIEWPORTS; i++) {
for (i=0; i < MAX_VIEWPORTS; i++) {
if (!viewports[i].initialized)
break;
}
387,6 → 395,13
clear_port(0);
}
 
/** Draw character at given position relative to viewport
*
* @param vp Viewport identification
* @param c Character to print
* @param row Screen position relative to viewport
* @param col Screen position relative to viewport
*/
static void draw_char(int vp, char c, unsigned int row, unsigned int col)
{
viewport_t *vport = &viewports[vp];
394,7 → 409,7
if (vport->cursor_active && (vport->cur_col != col || vport->cur_row != row))
invert_char(vp, vport->cur_row, vport->cur_col);
draw_glyph(vp, c, row, col);
draw_glyph(vp, c, col * COL_WIDTH, row * FONT_SCANLINES);
 
vport->cur_col = col;
vport->cur_row = row;
410,6 → 425,9
invert_char(vp, vport->cur_row, vport->cur_col);
}
 
/** Function for handling connections to FB
*
*/
static void fb_client_connection(ipc_callid_t iid, ipc_call_t *icall)
{
ipc_callid_t callid;
545,6 → 563,7
}
}
 
/** Initialization of framebuffer */
int fb_init(void)
{
__address fb_ph_addr;
/uspace/trunk/fb/ega.c
122,7 → 122,7
if (ega_ph_addr != ALIGN_DOWN((unsigned long)ega_ph_addr, PAGE_SIZE))
return -1;
map_physmem(ega_ph_addr, scr_addr, (scr_width*scr_height+PAGE_SIZE-1)>>PAGE_WIDTH,
map_physmem(ega_ph_addr, scr_addr, (scr_width*scr_height*2+PAGE_SIZE-1)>>PAGE_WIDTH,
AS_AREA_READ | AS_AREA_WRITE);