Changeset 3993b3d in mainline for console/console.c
- Timestamp:
- 2006-06-01T15:32:19Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c1d2c9d
- Parents:
- 88c3151
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
console/console.c
r88c3151 r3993b3d 39 39 #include <async.h> 40 40 #include <libadt/fifo.h> 41 #include <screenbuffer.h> 41 42 42 43 static void sysput(char c) 43 44 { 44 45 __SYSCALL3(SYS_IO, 1, &c, 1); 45 46 } 46 } 47 47 48 //#define CONSOLE_COUNT VFB_CONNECTIONS 48 49 #define CONSOLE_COUNT 8 … … 52 53 53 54 int active_console = 1; 55 56 struct { 57 int phone; /**< Framebuffer phone */ 58 int rows; /**< Framebuffer rows */ 59 int cols; /**< Framebuffer columns */ 60 } fb_info; 54 61 55 62 typedef struct { … … 58 65 int keyrequest_counter; 59 66 int client_phone; 60 int vfb_phone;61 67 int used; 68 screenbuffer_t screenbuffer; 62 69 } connection_t; 63 70 … … 95 102 ipc_call_t call; 96 103 int retval; 97 int i ;104 int i, j; 98 105 char c; 99 106 … … 116 123 117 124 if ((c >= KBD_KEY_F1) && (c < KBD_KEY_F1 + CONSOLE_COUNT)) { 125 /*FIXME: draw another console content from buffer */ 126 118 127 active_console = c - KBD_KEY_F1; 128 ipc_call_async_2(fb_info.phone, FB_CLEAR, 0, 0, NULL, NULL); 129 ipc_call_sync_3(fb_info.phone, FB_PUTCHAR, 'a', 0, 0,NULL,NULL, NULL); 130 131 for (i = 0; i < connections[active_console].screenbuffer.size_x; i++) 132 for (j = 0; j < connections[active_console].screenbuffer.size_y; j++) { 133 134 ipc_call_async_3(fb_info.phone, FB_PUTCHAR, get_field_at(&(connections[active_console].screenbuffer),\ 135 i, j)->character, j, i, NULL, NULL, NULL); 136 } 137 119 138 break; 120 139 } … … 154 173 return; 155 174 } 175 156 176 connections[consnum].used = 1; 157 177 connections[consnum].client_phone = IPC_GET_ARG3(call); 178 screenbuffer_clear(&(connections[consnum].screenbuffer)); 158 179 159 180 /* Accept the connection */ … … 168 189 return; 169 190 case CONSOLE_PUTCHAR: 170 if (consnum != active_console) { 171 } 191 172 192 /* Send message to fb */ 173 ipc_call_sync_2(connections[consnum].vfb_phone, FB_PUTCHAR, IPC_GET_ARG1(call), IPC_GET_ARG2(call), NULL, NULL); 174 // ipc_call_sync_2(connections[6].vfb_phone, FB_PUTCHAR, 0, IPC_GET_ARG2(call),NULL,NULL); 193 if (consnum == active_console) { 194 ipc_call_sync_3(fb_info.phone, FB_PUTCHAR, IPC_GET_ARG2(call), connections[consnum].screenbuffer.position_y, \ 195 connections[consnum].screenbuffer.position_x, NULL, NULL, NULL); 196 } 197 198 screenbuffer_putchar(&(connections[consnum].screenbuffer), IPC_GET_ARG2(call)); 175 199 break; 176 200 case CONSOLE_CLEAR: 201 /* Send message to fb */ 202 if (consnum == active_console) { 203 ipc_call_async_2(fb_info.phone, FB_CLEAR, 0, 0, NULL, NULL); 204 } 205 206 screenbuffer_clear(&(connections[consnum].screenbuffer)); 207 177 208 break; 178 209 case CONSOLE_GOTO: 210 211 screenbuffer_goto(&(connections[consnum].screenbuffer), IPC_GET_ARG1(call), IPC_GET_ARG2(call)); 212 179 213 break; 180 214 … … 220 254 /* Connect to framebuffer driver */ 221 255 256 while ((fb_info.phone = ipc_connect_me_to(PHONE_NS, SERVICE_VIDEO, 0)) < 0) { 257 usleep(10000); 258 } 259 260 ipc_call_sync_3(fb_info.phone, FB_PUTCHAR, '1', 0, 0,NULL,NULL, NULL); 261 ipc_call_sync_2(fb_info.phone, FB_GET_CSIZE, 0, 0, &(fb_info.rows), &(fb_info.cols)); 262 263 /* Init virtual consoles */ 222 264 for (i = 0; i < CONSOLE_COUNT; i++) { 265 ipc_call_sync_3(fb_info.phone, FB_PUTCHAR, '$', 2*i, 1,NULL,NULL, NULL); 223 266 connections[i].used = 0; 224 267 keybuffer_init(&(connections[i].keybuffer)); 268 ipc_call_sync_3(fb_info.phone, FB_PUTCHAR, '>', 2*i+1, 1,NULL,NULL, NULL); 225 269 226 /* TODO: init key_buffer */227 while ((connections[i].vfb_phone = ipc_connect_me_to(PHONE_NS, SERVICE_VIDEO, 0)) < 0) {228 usleep(10000);229 }230 270 connections[i].keyrequests.head = connections[i].keyrequests.tail = 0; 231 271 connections[i].keyrequests.items = MAX_KEYREQUESTS_BUFFERED; 232 272 connections[i].keyrequest_counter = 0; 273 274 ipc_call_sync_3(fb_info.phone, FB_PUTCHAR, '?', 2*i+1, 1,NULL,NULL, NULL); 275 if (screenbuffer_init(&(connections[i].screenbuffer), fb_info.cols, fb_info.rows ) == NULL) { 276 /*FIXME: handle error */ 277 return -1; 278 } 233 279 } 234 280 … … 237 283 }; 238 284 285 ipc_call_sync_3(fb_info.phone, FB_PUTCHAR, 'M', 3, 3,NULL,NULL, NULL); 239 286 async_manager(); 240 287
Note:
See TracChangeset
for help on using the changeset viewer.