Changeset 10569b1 in mainline
- Timestamp:
- 2006-06-02T08:44:26Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1180a88e
- Parents:
- df688cd
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
console/console.c
rdf688cd r10569b1 41 41 #include <screenbuffer.h> 42 42 43 #define CONSOLE_COUNT 843 #define CONSOLE_COUNT 12 44 44 #define MAX_KEYREQUESTS_BUFFERED 32 45 45 … … 89 89 return CONSOLE_COUNT; 90 90 } 91 92 /** Check key and process special keys. 93 * 94 * */ 95 static void write_char(int console, char key) 96 { 97 screenbuffer_t *scr = &(connections[console].screenbuffer); 98 99 switch (key) { 100 case '\n': 101 scr->position_y += 1; 102 scr->position_x = 0; 103 break; 104 case '\r': 105 break; 106 case '\t': 107 scr->position_x += 8; 108 scr->position_x -= scr->position_x % 8; 109 break; 110 case '\b': 111 if (scr->position_x == 0) 112 break; 113 114 scr->position_x--; 115 116 if (console == active_console) { 117 ipc_call_async_3(fb_info.phone, FB_PUTCHAR, ' ', scr->position_y, scr->position_x, NULL, NULL); 118 } 119 120 screenbuffer_putchar(scr, ' '); 121 122 break; 123 default: 124 if (console == active_console) { 125 ipc_call_async_3(fb_info.phone, FB_PUTCHAR, key, scr->position_y, scr->position_x, NULL, NULL); 126 } 127 128 screenbuffer_putchar(scr, key); 129 scr->position_x++; 130 } 131 132 scr->position_y += (scr->position_x >= scr->size_x); 133 134 if (scr->position_y >= scr->size_y) { 135 scr->position_y = scr->size_y - 1; 136 screenbuffer_clear_line(scr, scr->top_line++); 137 ipc_call_async(fb_info.phone, FB_SCROLL, 1, NULL, NULL); 138 } 139 140 scr->position_x = scr->position_x % scr->size_x; 141 scr->position_y = scr->position_y % scr->size_y; 142 143 } 144 91 145 92 146 /* Handler for keyboard */ … … 119 173 if ((c >= '1') && (c < '1' + CONSOLE_COUNT)) { 120 174 /*FIXME: draw another console content from buffer */ 121 175 if (c - KBD_KEY_F1 == active_console) 176 break; 122 177 active_console = c - '1'; 123 178 conn = &connections[active_console]; … … 125 180 ipc_call_async(fb_info.phone, FB_CURSOR_VISIBILITY, 0, NULL, NULL); 126 181 ipc_call_async_2(fb_info.phone, FB_CLEAR, 0, 0, NULL, NULL); 182 127 183 for (i = 0; i < conn->screenbuffer.size_x; i++) 128 184 for (j = 0; j < conn->screenbuffer.size_y; j++) { … … 167 223 return; 168 224 } 169 225 170 226 connections[consnum].used = 1; 171 227 connections[consnum].client_phone = IPC_GET_ARG3(call); 172 228 screenbuffer_clear(&(connections[consnum].screenbuffer)); 173 229 174 230 /* Accept the connection */ 175 231 ipc_answer_fast(iid,0,0,0); … … 183 239 return; 184 240 case CONSOLE_PUTCHAR: 185 186 /* Send message to fb */ 187 if (consnum == active_console) { 188 ipc_call_async_3(fb_info.phone, FB_PUTCHAR, IPC_GET_ARG2(call), connections[consnum].screenbuffer.position_y, \ 189 connections[consnum].screenbuffer.position_x, NULL, NULL); 190 } 191 192 screenbuffer_putchar(&(connections[consnum].screenbuffer), IPC_GET_ARG2(call)); 241 write_char(consnum, IPC_GET_ARG1(call)); 193 242 break; 194 243 case CONSOLE_CLEAR: … … 271 320 } 272 321 322 273 323 if (ipc_connect_to_me(PHONE_NS, SERVICE_CONSOLE, 0, &phonehash) != 0) { 274 324 return -1; -
console/screenbuffer.c
rdf688cd r10569b1 44 44 field->style = scr->style; 45 45 46 scr->position_x++;47 if (scr->position_x == scr->size_x) {48 scr->position_x = 0;49 scr->position_y++;50 if (scr->position_y == scr->size_y) {51 /* scroll */52 scr->position_y--;53 screenbuffer_clear_line(scr, scr->top_line++);54 }55 }56 57 46 return 1; 58 47 } … … 66 55 scr->size_x = size_x; 67 56 scr->size_y = size_y; 68 scr->position_y = 0;69 scr->position_x = 0;70 57 scr->style.fg_color = DEFAULT_FOREGROUND_COLOR; 71 58 scr->style.bg_color = DEFAULT_BACKGROUND_COLOR; 72 scr->top_line = 0; 59 60 screenbuffer_clear(scr); 61 73 62 return scr; 74 63 } … … 78 67 unsigned int i; 79 68 80 for (i = 0; i < scr->size_x * scr->size_y; i++) {69 for (i = 0; i < (scr->size_x * scr->size_y); i++) { 81 70 scr->buffer[i].character = ' '; 82 71 scr->buffer[i].style = scr->style; … … 114 103 { 115 104 scr->position_x = x % scr->size_x; 116 scr->position_y = (y + scr->top_line)% scr->size_y;105 scr->position_y = y % scr->size_y; 117 106 } 118 107 -
libc/generic/io/stream.c
rdf688cd r10569b1 78 78 79 79 for (i = 0; i < count; i++) 80 ipc_call_ sync_2(console_phone, CONSOLE_PUTCHAR, 0, ((const char *)buf)[i], &r0, &r1);80 ipc_call_async_2(console_phone, CONSOLE_PUTCHAR, ((const char *)buf)[i], 0, NULL, NULL); 81 81 82 82 return count;
Note:
See TracChangeset
for help on using the changeset viewer.