Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4002 → Rev 4154

/trunk/uspace/lib/libc/generic/console.c/console.c
1,4 → 1,6
/*
* Copyright (c) 2006 Josef Cejka
* Copyright (c) 2006 Jakub Vana
* Copyright (c) 2008 Jiri Svoboda
* All rights reserved.
*
35,29 → 37,70
#include <async.h>
#include <io/stream.h>
#include <ipc/console.h>
#include <ipc/services.h>
#include <console.h>
 
static int console_phone = -1;
 
void console_open(void)
{
if (console_phone < 0) {
int phone = ipc_connect_me_to(PHONE_NS, SERVICE_CONSOLE, 0, 0);
if (phone >= 0)
console_phone = phone;
}
}
 
void console_close(void)
{
if (console_phone >= 0) {
if (ipc_hangup(console_phone) == 0) {
console_phone = -1;
}
}
}
 
int console_phone_get(void)
{
if (console_phone < 0)
console_open();
return console_phone;
}
 
void console_wait(void)
{
while (console_phone < 0)
console_open();
}
 
void console_clear(void)
{
int cons_phone = get_console_phone();
int cons_phone = console_phone_get();
async_msg_0(cons_phone, CONSOLE_CLEAR);
}
 
void console_goto(int row, int col)
{
int cons_phone = get_console_phone();
int cons_phone = console_phone_get();
async_msg_2(cons_phone, CONSOLE_GOTO, row, col);
}
 
void console_putchar(int c)
{
int cons_phone = console_phone_get();
async_msg_1(cons_phone, CONSOLE_PUTCHAR, c);
}
 
void console_flush(void)
{
int cons_phone = get_console_phone();
int cons_phone = console_phone_get();
async_msg_0(cons_phone, CONSOLE_FLUSH);
}
 
int console_get_size(int *rows, int *cols)
{
int cons_phone = get_console_phone();
int cons_phone = console_phone_get();
ipcarg_t r, c;
int rc;
 
71,25 → 114,25
 
void console_set_style(int style)
{
int cons_phone = get_console_phone();
int cons_phone = console_phone_get();
async_msg_1(cons_phone, CONSOLE_SET_STYLE, style);
}
 
void console_set_color(int fg_color, int bg_color, int flags)
{
int cons_phone = get_console_phone();
int cons_phone = console_phone_get();
async_msg_3(cons_phone, CONSOLE_SET_COLOR, fg_color, bg_color, flags);
}
 
void console_set_rgb_color(int fg_color, int bg_color)
{
int cons_phone = get_console_phone();
int cons_phone = console_phone_get();
async_msg_2(cons_phone, CONSOLE_SET_RGB_COLOR, fg_color, bg_color);
}
 
void console_cursor_visibility(int show)
{
int cons_phone = get_console_phone();
int cons_phone = console_phone_get();
async_msg_1(cons_phone, CONSOLE_CURSOR_VISIBILITY, show != 0);
}