00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
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