Changeset 3ad953c in mainline
- Timestamp:
- 2008-12-30T19:55:10Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f58321c4
- Parents:
- 6b21292
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/console/kconsole.h
r6b21292 r3ad953c 38 38 #include <adt/list.h> 39 39 #include <synch/spinlock.h> 40 #include <ipc/irq.h> 40 41 41 42 #define MAX_CMDLINE 256 … … 84 85 } cmd_info_t; 85 86 87 extern bool kconsole_notify; 88 extern irq_t kconsole_irq; 89 86 90 SPINLOCK_EXTERN(cmd_lock); 87 91 extern link_t cmd_head; 88 92 89 93 extern void kconsole_init(void); 94 extern void kconsole_notify_init(void); 90 95 extern void kconsole(char *prompt, char *msg, bool kcon); 91 96 extern void kconsole_thread(void *data); -
kernel/generic/include/ipc/irq.h
r6b21292 r3ad953c 54 54 * ipc_irq_send_msg_m(), where m is the number of payload arguments. 55 55 */ 56 #define ipc_irq_send_msg_0(irq) \ 57 ipc_irq_send_msg((irq), 0, 0, 0, 0, 0) 56 58 #define ipc_irq_send_msg_1(irq, a1) \ 57 59 ipc_irq_send_msg((irq), (a1), 0, 0, 0, 0) -
kernel/generic/src/console/cmd.c
r6b21292 r3ad953c 977 977 { 978 978 printf("The kernel will now relinquish the console.\n"); 979 printf("Use userspace controls to redraw the screen.\n");980 979 arch_release_console(); 980 981 if ((kconsole_notify) && (kconsole_irq.notif_cfg.notify)) 982 ipc_irq_send_msg_0(&kconsole_irq); 983 981 984 return 1; 982 985 } -
kernel/generic/src/console/kconsole.c
r6b21292 r3ad953c 52 52 #include <symtab.h> 53 53 #include <macros.h> 54 #include <sysinfo/sysinfo.h> 55 #include <ddi/device.h> 54 56 55 57 /** Simple kernel console. … … 84 86 static char history[KCONSOLE_HISTORY][MAX_CMDLINE] = {}; 85 87 86 /** Initialize kconsole data structures. */ 88 /* 89 * For now, we use 0 as INR. 90 * However, it is therefore desirable to have architecture specific 91 * definition of KCONSOLE_VIRT_INR in the future. 92 */ 93 #define KCONSOLE_VIRT_INR 0 94 95 bool kconsole_notify = false; 96 irq_t kconsole_irq; 97 98 99 /** Allways refuse IRQ ownership. 100 * 101 * This is not a real IRQ, so we always decline. 102 * 103 * @return Always returns IRQ_DECLINE. 104 * 105 */ 106 static irq_ownership_t kconsole_claim(void) 107 { 108 return IRQ_DECLINE; 109 } 110 111 112 /** Initialize kconsole data structures 113 * 114 * This is the most basic initialization, almost no 115 * other kernel subsystem is ready yet. 116 * 117 */ 87 118 void kconsole_init(void) 88 119 { 89 int i;120 unsigned int i; 90 121 91 122 cmd_init(); 92 123 for (i = 0; i < KCONSOLE_HISTORY; i++) 93 124 history[i][0] = '\0'; 125 } 126 127 128 /** Initialize kconsole notification mechanism 129 * 130 * Initialize the virtual IRQ notification mechanism. 131 * 132 */ 133 void kconsole_notify_init(void) 134 { 135 devno_t devno = device_assign_devno(); 136 137 sysinfo_set_item_val("kconsole.present", NULL, true); 138 sysinfo_set_item_val("kconsole.devno", NULL, devno); 139 sysinfo_set_item_val("kconsole.inr", NULL, KCONSOLE_VIRT_INR); 140 141 irq_initialize(&kconsole_irq); 142 kconsole_irq.devno = devno; 143 kconsole_irq.inr = KCONSOLE_VIRT_INR; 144 kconsole_irq.claim = kconsole_claim; 145 irq_register(&kconsole_irq); 146 147 kconsole_notify = true; 94 148 } 95 149 -
kernel/generic/src/main/main.c
r6b21292 r3ad953c 199 199 config.base, config.kernel_size, config.stack_base, 200 200 config.stack_size); 201 201 202 202 #ifdef CONFIG_KCONSOLE 203 203 /* … … 214 214 */ 215 215 LOG_EXEC(exc_init()); 216 216 217 217 /* 218 218 * Memory management subsystems initialization. … … 260 260 LOG_EXEC(ipc_init()); 261 261 LOG_EXEC(klog_init()); 262 262 263 #ifdef CONFIG_KCONSOLE 264 LOG_EXEC(kconsole_notify_init()); 265 #endif 266 263 267 /* 264 268 * Create kernel task. -
uspace/app/klog/klog.c
r6b21292 r3ad953c 87 87 return -1; 88 88 } 89 89 90 int devno = sysinfo_value("klog.devno"); 90 91 int inr = sysinfo_value("klog.inr"); 91 int devno = sysinfo_value("klog.devno");92 92 if (ipc_register_irq(inr, devno, 0, NULL) != EOK) { 93 93 printf(NAME ": Error registering klog notifications\n"); -
uspace/srv/console/console.c
r6b21292 r3ad953c 49 49 #include <sys/mman.h> 50 50 #include <stdio.h> 51 #include <sysinfo.h> 51 52 52 53 #include "gcons.h" … … 59 60 */ 60 61 int active_console = 0; 62 int prev_console = 0; 61 63 62 64 /** Information about framebuffer … … 208 210 async_serialize_end(); 209 211 210 if (__SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE)) 212 if (__SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE)) { 213 prev_console = active_console; 211 214 active_console = KERNEL_CONSOLE; 212 else215 } else 213 216 newcons = active_console; 214 217 } … … 236 239 } 237 240 /* This call can preempt, but we are already at the end */ 238 rc = async_req_0_0(fb_info.phone, FB_DRAW_TEXT_DATA); 241 rc = async_req_0_0(fb_info.phone, FB_DRAW_TEXT_DATA); 239 242 } 240 243 … … 244 247 style = &conn->screenbuffer.style; 245 248 246 for (j = 0; j < conn->screenbuffer.size_y; j++) 249 for (j = 0; j < conn->screenbuffer.size_y; j++) 247 250 for (i = 0; i < conn->screenbuffer.size_x; i++) { 248 251 field = get_field_at(&conn->screenbuffer, i, j); … … 341 344 ipcarg_t arg1, arg2; 342 345 connection_t *conn; 343 346 344 347 if ((consnum = find_free_connection()) == -1) { 345 348 ipc_answer_0(iid, ELIMIT); … … 356 359 /* Accept the connection */ 357 360 ipc_answer_0(iid, EOK); 358 361 359 362 while (1) { 360 363 async_serialize_end(); 361 364 callid = async_get_call(&call); 362 365 async_serialize_start(); 363 366 364 367 arg1 = 0; 365 368 arg2 = 0; … … 369 372 370 373 /* Answer all pending requests */ 371 while (conn->keyrequest_counter > 0) { 374 while (conn->keyrequest_counter > 0) { 372 375 conn->keyrequest_counter--; 373 376 ipc_answer_0(fifo_pop(conn->keyrequests), … … 444 447 } 445 448 449 static void interrupt_received(ipc_callid_t callid, ipc_call_t *call) 450 { 451 change_console(prev_console); 452 } 453 446 454 int main(int argc, char *argv[]) 447 455 { … … 451 459 int kbd_phone; 452 460 int i; 453 461 454 462 async_set_client_connection(client_connection); 455 463 456 464 /* Connect to keyboard driver */ 457 465 458 466 kbd_phone = ipc_connect_me_to(PHONE_NS, SERVICE_KEYBOARD, 0, 0); 459 467 while (kbd_phone < 0) { … … 512 520 } 513 521 } 514 522 515 523 curs_goto(0, 0); 516 524 curs_visibility( 517 525 connections[active_console].screenbuffer.is_cursor_visible); 518 526 519 527 /* Register at NS */ 520 528 if (ipc_connect_to_me(PHONE_NS, SERVICE_CONSOLE, 0, 0, &phonehash) != 0) 521 529 return -1; 522 530 531 /* Receive kernel notifications */ 532 if (sysinfo_value("kconsole.present")) { 533 int devno = sysinfo_value("kconsole.devno"); 534 int inr = sysinfo_value("kconsole.inr"); 535 if (ipc_register_irq(inr, devno, 0, NULL) != EOK) 536 printf(NAME ": Error registering kconsole notifications\n"); 537 538 async_set_interrupt_received(interrupt_received); 539 } 540 523 541 // FIXME: avoid connectiong to itself, keep using klog 524 542 // printf(NAME ": Accepting connections\n"); 525 543 async_manager(); 526 527 return 0; 544 545 return 0; 528 546 } 529 547
Note:
See TracChangeset
for help on using the changeset viewer.