console.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2006 Josef Cejka
00003  * Copyright (c) 2006 Jakub Vana
00004  * Copyright (c) 2008 Jiri Svoboda
00005  * All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  *
00011  * - Redistributions of source code must retain the above copyright
00012  *   notice, this list of conditions and the following disclaimer.
00013  * - Redistributions in binary form must reproduce the above copyright
00014  *   notice, this list of conditions and the following disclaimer in the
00015  *   documentation and/or other materials provided with the distribution.
00016  * - The name of the author may not be used to endorse or promote products
00017  *   derived from this software without specific prior written permission.
00018  *
00019  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00020  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00021  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00022  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
00023  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00024  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00025  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00026  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00027  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00028  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029  */
00030 
00037 #include <libc.h>
00038 #include <async.h>
00039 #include <io/console.h>
00040 #include <ipc/console.h>
00041 
00042 void console_clear(int phone)
00043 {
00044         async_msg_0(phone, CONSOLE_CLEAR);
00045 }
00046 
00047 int console_get_size(int phone, sysarg_t *cols, sysarg_t *rows)
00048 {
00049         return async_req_0_2(phone, CONSOLE_GET_SIZE, cols, rows);
00050 }
00051 
00052 void console_set_style(int phone, uint8_t style)
00053 {
00054         async_msg_1(phone, CONSOLE_SET_STYLE, style);
00055 }
00056 
00057 void console_set_color(int phone, uint8_t fg_color, uint8_t bg_color,
00058     uint8_t flags)
00059 {
00060         async_msg_3(phone, CONSOLE_SET_COLOR, fg_color, bg_color, flags);
00061 }
00062 
00063 void console_set_rgb_color(int phone, uint32_t fg_color, uint32_t bg_color)
00064 {
00065         async_msg_2(phone, CONSOLE_SET_RGB_COLOR, fg_color, bg_color);
00066 }
00067 
00068 void console_cursor_visibility(int phone, bool show)
00069 {
00070         async_msg_1(phone, CONSOLE_CURSOR_VISIBILITY, (show != false));
00071 }
00072 
00073 int console_get_color_cap(int phone, sysarg_t *ccap)
00074 {
00075         return async_req_0_1(phone, CONSOLE_GET_COLOR_CAP, ccap);
00076 }
00077 
00078 void console_kcon_enable(int phone)
00079 {
00080         async_msg_0(phone, CONSOLE_KCON_ENABLE);
00081 }
00082 
00083 int console_get_pos(int phone, sysarg_t *col, sysarg_t *row)
00084 {
00085         return async_req_0_2(phone, CONSOLE_GET_POS, col, row);
00086 }
00087 
00088 void console_set_pos(int phone, sysarg_t col, sysarg_t row)
00089 {
00090         async_msg_2(phone, CONSOLE_GOTO, col, row);
00091 }
00092 
00093 bool console_get_event(int phone, console_event_t *event)
00094 {
00095         sysarg_t type;
00096         sysarg_t key;
00097         sysarg_t mods;
00098         sysarg_t c;
00099         
00100         int rc = async_req_0_4(phone, CONSOLE_GET_EVENT, &type, &key, &mods, &c);
00101         if (rc < 0)
00102                 return false;
00103         
00104         event->type = type;
00105         event->key = key;
00106         event->mods = mods;
00107         event->c = c;
00108         
00109         return true;
00110 }
00111 

Generated on Thu Jun 2 07:45:46 2011 for HelenOS/USB by  doxygen 1.4.7