Changeset 907bb49 in mainline for uspace/lib/libc/generic/console.c
- Timestamp:
- 2009-03-18T22:22:31Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 266daf5a
- Parents:
- eada065e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/generic/console.c
reada065e r907bb49 1 1 /* 2 * Copyright (c) 2006 Josef Cejka 3 * Copyright (c) 2006 Jakub Vana 2 4 * Copyright (c) 2008 Jiri Svoboda 3 5 * All rights reserved. … … 36 38 #include <io/stream.h> 37 39 #include <ipc/console.h> 40 #include <ipc/services.h> 38 41 #include <console.h> 42 43 static int console_phone = -1; 44 45 void console_open(void) 46 { 47 if (console_phone < 0) { 48 int phone = ipc_connect_me_to(PHONE_NS, SERVICE_CONSOLE, 0, 0); 49 if (phone >= 0) 50 console_phone = phone; 51 } 52 } 53 54 void console_close(void) 55 { 56 if (console_phone >= 0) { 57 if (ipc_hangup(console_phone) == 0) { 58 console_phone = -1; 59 } 60 } 61 } 62 63 int console_phone_get(void) 64 { 65 if (console_phone < 0) 66 console_open(); 67 68 return console_phone; 69 } 70 71 void console_wait(void) 72 { 73 while (console_phone < 0) 74 console_open(); 75 } 39 76 40 77 void console_clear(void) 41 78 { 42 int cons_phone = get_console_phone();79 int cons_phone = console_phone_get(); 43 80 async_msg_0(cons_phone, CONSOLE_CLEAR); 44 81 } … … 46 83 void console_goto(int row, int col) 47 84 { 48 int cons_phone = get_console_phone();85 int cons_phone = console_phone_get(); 49 86 async_msg_2(cons_phone, CONSOLE_GOTO, row, col); 87 } 88 89 void console_putchar(int c) 90 { 91 int cons_phone = console_phone_get(); 92 async_msg_1(cons_phone, CONSOLE_PUTCHAR, c); 50 93 } 51 94 52 95 void console_flush(void) 53 96 { 54 int cons_phone = get_console_phone();97 int cons_phone = console_phone_get(); 55 98 async_msg_0(cons_phone, CONSOLE_FLUSH); 56 99 } … … 58 101 int console_get_size(int *rows, int *cols) 59 102 { 60 int cons_phone = get_console_phone();103 int cons_phone = console_phone_get(); 61 104 ipcarg_t r, c; 62 105 int rc; … … 72 115 void console_set_style(int style) 73 116 { 74 int cons_phone = get_console_phone();117 int cons_phone = console_phone_get(); 75 118 async_msg_1(cons_phone, CONSOLE_SET_STYLE, style); 76 119 } … … 78 121 void console_set_color(int fg_color, int bg_color, int flags) 79 122 { 80 int cons_phone = get_console_phone();123 int cons_phone = console_phone_get(); 81 124 async_msg_3(cons_phone, CONSOLE_SET_COLOR, fg_color, bg_color, flags); 82 125 } … … 84 127 void console_set_rgb_color(int fg_color, int bg_color) 85 128 { 86 int cons_phone = get_console_phone();129 int cons_phone = console_phone_get(); 87 130 async_msg_2(cons_phone, CONSOLE_SET_RGB_COLOR, fg_color, bg_color); 88 131 } … … 90 133 void console_cursor_visibility(int show) 91 134 { 92 int cons_phone = get_console_phone();135 int cons_phone = console_phone_get(); 93 136 async_msg_1(cons_phone, CONSOLE_CURSOR_VISIBILITY, show != 0); 94 137 }
Note:
See TracChangeset
for help on using the changeset viewer.