Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2621 → Rev 2620

/trunk/uspace/srv/console/console.c
105,12 → 105,12
 
static void clrscr(void)
{
async_msg_0(fb_info.phone, FB_CLEAR);
async_msg(fb_info.phone, FB_CLEAR, 0);
}
 
static void curs_visibility(int v)
{
async_msg_1(fb_info.phone, FB_CURSOR_VISIBILITY, v);
async_msg(fb_info.phone, FB_CURSOR_VISIBILITY, v);
}
 
static void curs_goto(int row, int col)
176,7 → 176,7
screenbuffer_clear_line(scr, scr->top_line);
scr->top_line = (scr->top_line + 1) % scr->size_y;
if (console == active_console)
async_msg_1(fb_info.phone, FB_SCROLL, 1);
async_msg(fb_info.phone, FB_SCROLL, 1);
}
scr->position_x = scr->position_x % scr->size_x;
196,7 → 196,7
int newpmap;
/* Save screen */
newpmap = async_req_0_0(fb_info.phone, FB_VP2PIXMAP);
newpmap = async_req(fb_info.phone, FB_VP2PIXMAP, 0, NULL);
if (newpmap < 0)
return -1;
 
204,7 → 204,7
/* Show old screen */
async_msg_2(fb_info.phone, FB_VP_DRAW_PIXMAP, 0, oldpixmap);
/* Drop old pixmap */
async_msg_1(fb_info.phone, FB_DROP_PIXMAP, oldpixmap);
async_msg(fb_info.phone, FB_DROP_PIXMAP, oldpixmap);
}
return newpmap;
266,7 → 266,8
*get_field_at(&conn->screenbuffer, i, j);
}
/* This call can preempt, but we are already at the end */
rc = async_req_0_0(fb_info.phone, FB_DRAW_TEXT_DATA);
rc = async_req_2(fb_info.phone, FB_DRAW_TEXT_DATA, 0, 0, NULL,
NULL);
}
if ((!interbuffer) || (rc != 0)) {
414,7 → 415,7
case CONSOLE_CLEAR:
/* Send message to fb */
if (consnum == active_console) {
async_msg_0(fb_info.phone, FB_CLEAR);
async_msg(fb_info.phone, FB_CLEAR, 0);
}
screenbuffer_clear(&conn->screenbuffer);
433,7 → 434,8
break;
case CONSOLE_FLUSH:
if (consnum == active_console)
async_req_0_0(fb_info.phone, FB_FLUSH);
async_req_2(fb_info.phone, FB_FLUSH, 0, 0,
NULL, NULL);
break;
case CONSOLE_SET_STYLE:
arg1 = IPC_GET_ARG1(call);
506,11 → 508,11
/* Initialize gcons */
gcons_init(fb_info.phone);
/* Synchronize, the gcons can have something in queue */
async_req_0_0(fb_info.phone, FB_FLUSH);
async_req(fb_info.phone, FB_FLUSH, 0, NULL);
/* Enable double buffering */
async_msg_2(fb_info.phone, FB_VIEWPORT_DB, (sysarg_t) -1, 1);
async_req_0_2(fb_info.phone, FB_GET_CSIZE, &fb_info.rows,
async_req_2(fb_info.phone, FB_GET_CSIZE, 0, 0, &fb_info.rows,
&fb_info.cols);
set_style_col(DEFAULT_FOREGROUND, DEFAULT_BACKGROUND);
clrscr();
537,8 → 539,9
sizeof(keyfield_t) * fb_info.cols * fb_info.rows,
PROTO_READ | PROTO_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
if (!interbuffer) {
if (async_req_3_0(fb_info.phone, IPC_M_AS_AREA_SEND,
(ipcarg_t) interbuffer, 0, AS_AREA_READ) != 0) {
if (async_req_3(fb_info.phone, IPC_M_AS_AREA_SEND,
(ipcarg_t) interbuffer, 0, AS_AREA_READ, NULL, NULL,
NULL) != 0) {
munmap(interbuffer,
sizeof(keyfield_t) * fb_info.cols * fb_info.rows);
interbuffer = NULL;
/trunk/uspace/srv/console/gcons.c
81,20 → 81,20
 
static void vp_switch(int vp)
{
async_msg_1(fbphone,FB_VIEWPORT_SWITCH, vp);
async_msg(fbphone,FB_VIEWPORT_SWITCH, vp);
}
 
/** Create view port */
static int vp_create(unsigned int x, unsigned int y, unsigned int width,
unsigned int height)
static int vp_create(unsigned int x, unsigned int y,
unsigned int width, unsigned int height)
{
return async_req_2_0(fbphone, FB_VIEWPORT_CREATE, (x << 16) | y,
(width << 16) | height);
return async_req_2(fbphone, FB_VIEWPORT_CREATE,
(x << 16) | y, (width << 16) | height, NULL, NULL);
}
 
static void clear(void)
{
async_msg_0(fbphone, FB_CLEAR);
async_msg(fbphone, FB_CLEAR, 0);
}
 
static void set_style(int fgcolor, int bgcolor)
118,7 → 118,7
vp_switch(cstatus_vp[consnum]);
if (ic_pixmaps[state] != -1)
async_msg_2(fbphone, FB_VP_DRAW_PIXMAP, cstatus_vp[consnum],
ic_pixmaps[state]);
ic_pixmaps[state]);
 
if (state != CONS_DISCONNECTED && state != CONS_KERNEL &&
state != CONS_DISCONNECTED_SEL) {
140,7 → 140,7
for (i = 0; i < CONSOLE_COUNT; i++)
redraw_state(i);
if (animation != -1)
async_msg_1(fbphone, FB_ANIM_START, animation);
async_msg(fbphone, FB_ANIM_START, animation);
} else {
if (console_state[active_console] == CONS_DISCONNECTED_SEL)
console_state[active_console] = CONS_DISCONNECTED;
224,7 → 224,7
redraw_state(active_console);
 
if (animation != -1)
async_msg_1(fbphone, FB_ANIM_STOP, animation);
async_msg(fbphone, FB_ANIM_STOP, animation);
 
active_console = KERNEL_CONSOLE; /* Set to kernel console */
vp_switch(0);
316,17 → 316,18
 
/* Create area */
shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED |
MAP_ANONYMOUS, 0, 0);
MAP_ANONYMOUS, 0, 0);
if (shm == MAP_FAILED)
return;
 
memcpy(shm, logo, size);
/* Send area */
rc = async_req_1_0(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm);
rc = async_req_2(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm, 0, NULL,
NULL);
if (rc)
goto exit;
rc = async_req_3_0(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t) shm, 0,
PROTO_READ);
rc = async_req_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t) shm, 0,
PROTO_READ, NULL, NULL, NULL);
if (rc)
goto drop;
/* Draw logo */
333,7 → 334,7
async_msg_2(fbphone, FB_DRAW_PPM, x, y);
drop:
/* Drop area */
async_msg_0(fbphone, FB_DROP_SHM);
async_msg(fbphone, FB_DROP_SHM, 0);
exit:
/* Remove area */
munmap(shm, size);
355,11 → 356,11
set_style(MAIN_COLOR, MAIN_COLOR);
clear();
draw_pixmap(_binary_helenos_ppm_start,
(size_t) &_binary_helenos_ppm_size, xres - 66, 2);
(size_t) &_binary_helenos_ppm_size, xres - 66, 2);
draw_pixmap(_binary_nameic_ppm_start,
(size_t) &_binary_nameic_ppm_size, 5, 17);
(size_t) &_binary_nameic_ppm_size, 5, 17);
 
for (i = 0; i < CONSOLE_COUNT; i++)
for (i = 0;i < CONSOLE_COUNT; i++)
redraw_state(i);
vp_switch(console_vp);
}
378,28 → 379,29
 
/* Create area */
shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED |
MAP_ANONYMOUS, 0, 0);
MAP_ANONYMOUS, 0, 0);
if (shm == MAP_FAILED)
return -1;
 
memcpy(shm, data, size);
/* Send area */
rc = async_req_1_0(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm);
rc = async_req_2(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm, 0, NULL,
NULL);
if (rc)
goto exit;
rc = async_req_3_0(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t) shm, 0,
PROTO_READ);
rc = async_req_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t) shm, 0,
PROTO_READ, NULL, NULL, NULL);
if (rc)
goto drop;
 
/* Obtain pixmap */
rc = async_req_0_0(fbphone, FB_SHM2PIXMAP);
rc = async_req(fbphone, FB_SHM2PIXMAP, 0, NULL);
if (rc < 0)
goto drop;
pxid = rc;
drop:
/* Drop area */
async_msg_0(fbphone, FB_DROP_SHM);
async_msg(fbphone, FB_DROP_SHM, 0);
exit:
/* Remove area */
munmap(shm, size);
421,27 → 423,28
int an;
int pm;
 
an = async_req_1_0(fbphone, FB_ANIM_CREATE, cstatus_vp[KERNEL_CONSOLE]);
an = async_req(fbphone, FB_ANIM_CREATE, cstatus_vp[KERNEL_CONSOLE],
NULL);
if (an < 0)
return;
 
pm = make_pixmap(_binary_anim_1_ppm_start,
(int) &_binary_anim_1_ppm_size);
(int) &_binary_anim_1_ppm_size);
async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
 
pm = make_pixmap(_binary_anim_2_ppm_start,
(int) &_binary_anim_2_ppm_size);
(int) &_binary_anim_2_ppm_size);
async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
 
pm = make_pixmap(_binary_anim_3_ppm_start,
(int) &_binary_anim_3_ppm_size);
(int) &_binary_anim_3_ppm_size);
async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
 
pm = make_pixmap(_binary_anim_4_ppm_start,
(int) &_binary_anim_4_ppm_size);
(int) &_binary_anim_4_ppm_size);
async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm);
 
async_msg_1(fbphone, FB_ANIM_START, an);
async_msg(fbphone, FB_ANIM_START, an);
 
animation = an;
}
464,7 → 467,7
 
fbphone = phone;
 
rc = async_req_0_2(phone, FB_GET_RESOLUTION, &xres, &yres);
rc = async_req_2(phone, FB_GET_RESOLUTION, 0, 0, &xres, &yres);
if (rc)
return;
474,8 → 477,8
/* create console viewport */
/* Align width & height to character size */
console_vp = vp_create(CONSOLE_MARGIN, CONSOLE_TOP,
ALIGN_DOWN(xres - 2 * CONSOLE_MARGIN, 8),
ALIGN_DOWN(yres - (CONSOLE_TOP + CONSOLE_MARGIN), 16));
ALIGN_DOWN(xres - 2 * CONSOLE_MARGIN, 8),
ALIGN_DOWN(yres - (CONSOLE_TOP + CONSOLE_MARGIN), 16));
if (console_vp < 0)
return;
483,8 → 486,8
status_start += (xres - 800) / 2;
for (i = 0; i < CONSOLE_COUNT; i++) {
cstatus_vp[i] = vp_create(status_start + CONSOLE_MARGIN +
i * (STATUS_WIDTH + STATUS_SPACE), STATUS_TOP,
STATUS_WIDTH, STATUS_HEIGHT);
i * (STATUS_WIDTH + STATUS_SPACE), STATUS_TOP,
STATUS_WIDTH, STATUS_HEIGHT);
if (cstatus_vp[i] < 0)
return;
vp_switch(cstatus_vp[i]);
493,18 → 496,18
/* Initialize icons */
ic_pixmaps[CONS_SELECTED] =
make_pixmap(_binary_cons_selected_ppm_start,
(int) &_binary_cons_selected_ppm_size);
make_pixmap(_binary_cons_selected_ppm_start,
(int) &_binary_cons_selected_ppm_size);
ic_pixmaps[CONS_IDLE] = make_pixmap(_binary_cons_idle_ppm_start,
(int) &_binary_cons_idle_ppm_size);
(int) &_binary_cons_idle_ppm_size);
ic_pixmaps[CONS_HAS_DATA] =
make_pixmap(_binary_cons_has_data_ppm_start,
(int) &_binary_cons_has_data_ppm_size);
make_pixmap(_binary_cons_has_data_ppm_start,
(int) &_binary_cons_has_data_ppm_size);
ic_pixmaps[CONS_DISCONNECTED] =
make_pixmap(_binary_cons_idle_ppm_start,
(int) &_binary_cons_idle_ppm_size);
make_pixmap(_binary_cons_idle_ppm_start,
(int) &_binary_cons_idle_ppm_size);
ic_pixmaps[CONS_KERNEL] = make_pixmap(_binary_cons_kernel_ppm_start,
(int) &_binary_cons_kernel_ppm_size);
(int) &_binary_cons_kernel_ppm_size);
ic_pixmaps[CONS_DISCONNECTED_SEL] = ic_pixmaps[CONS_SELECTED];
make_anim();