Subversion Repositories HelenOS

Compare Revisions

Regard whitespace Rev 3760 → Rev 3761

/trunk/kernel/generic/include/console/kconsole.h
37,6 → 37,7
 
#include <adt/list.h>
#include <synch/spinlock.h>
#include <ipc/irq.h>
 
#define MAX_CMDLINE 256
#define KCONSOLE_HISTORY 10
83,10 → 84,14
void (* help)(void);
} cmd_info_t;
 
extern bool kconsole_notify;
extern irq_t kconsole_irq;
 
SPINLOCK_EXTERN(cmd_lock);
extern link_t cmd_head;
 
extern void kconsole_init(void);
extern void kconsole_notify_init(void);
extern void kconsole(char *prompt, char *msg, bool kcon);
extern void kconsole_thread(void *data);
 
/trunk/kernel/generic/include/ipc/irq.h
53,6 → 53,8
* User friendly wrappers for ipc_irq_send_msg(). They are in the form
* ipc_irq_send_msg_m(), where m is the number of payload arguments.
*/
#define ipc_irq_send_msg_0(irq) \
ipc_irq_send_msg((irq), 0, 0, 0, 0, 0)
#define ipc_irq_send_msg_1(irq, a1) \
ipc_irq_send_msg((irq), (a1), 0, 0, 0, 0)
#define ipc_irq_send_msg_2(irq, a1, a2) \
/trunk/kernel/generic/src/main/main.c
260,6 → 260,10
LOG_EXEC(ipc_init());
LOG_EXEC(klog_init());
 
#ifdef CONFIG_KCONSOLE
LOG_EXEC(kconsole_notify_init());
#endif
/*
* Create kernel task.
*/
/trunk/kernel/generic/src/console/cmd.c
976,8 → 976,11
int cmd_continue(cmd_arg_t *argv)
{
printf("The kernel will now relinquish the console.\n");
printf("Use userspace controls to redraw the screen.\n");
arch_release_console();
if ((kconsole_notify) && (kconsole_irq.notif_cfg.notify))
ipc_irq_send_msg_0(&kconsole_irq);
return 1;
}
 
/trunk/kernel/generic/src/console/kconsole.c
51,6 → 51,8
#include <func.h>
#include <symtab.h>
#include <macros.h>
#include <sysinfo/sysinfo.h>
#include <ddi/device.h>
 
/** Simple kernel console.
*
83,10 → 85,39
index_t *end);
static char history[KCONSOLE_HISTORY][MAX_CMDLINE] = {};
 
/** Initialize kconsole data structures. */
/*
* For now, we use 0 as INR.
* However, it is therefore desirable to have architecture specific
* definition of KCONSOLE_VIRT_INR in the future.
*/
#define KCONSOLE_VIRT_INR 0
 
bool kconsole_notify = false;
irq_t kconsole_irq;
 
 
/** Allways refuse IRQ ownership.
*
* This is not a real IRQ, so we always decline.
*
* @return Always returns IRQ_DECLINE.
*
*/
static irq_ownership_t kconsole_claim(void)
{
return IRQ_DECLINE;
}
 
 
/** Initialize kconsole data structures
*
* This is the most basic initialization, almost no
* other kernel subsystem is ready yet.
*
*/
void kconsole_init(void)
{
int i;
unsigned int i;
 
cmd_init();
for (i = 0; i < KCONSOLE_HISTORY; i++)
94,6 → 125,29
}
 
 
/** Initialize kconsole notification mechanism
*
* Initialize the virtual IRQ notification mechanism.
*
*/
void kconsole_notify_init(void)
{
devno_t devno = device_assign_devno();
sysinfo_set_item_val("kconsole.present", NULL, true);
sysinfo_set_item_val("kconsole.devno", NULL, devno);
sysinfo_set_item_val("kconsole.inr", NULL, KCONSOLE_VIRT_INR);
irq_initialize(&kconsole_irq);
kconsole_irq.devno = devno;
kconsole_irq.inr = KCONSOLE_VIRT_INR;
kconsole_irq.claim = kconsole_claim;
irq_register(&kconsole_irq);
kconsole_notify = true;
}
 
 
/** Register kconsole command.
*
* @param cmd Structure describing the command.
/trunk/uspace/app/klog/klog.c
87,8 → 87,8
return -1;
}
 
int devno = sysinfo_value("klog.devno");
int inr = sysinfo_value("klog.inr");
int devno = sysinfo_value("klog.devno");
if (ipc_register_irq(inr, devno, 0, NULL) != EOK) {
printf(NAME ": Error registering klog notifications\n");
return -1;
/trunk/uspace/srv/console/console.c
48,6 → 48,7
#include <screenbuffer.h>
#include <sys/mman.h>
#include <stdio.h>
#include <sysinfo.h>
 
#include "gcons.h"
 
58,6 → 59,7
/** Index of currently used virtual console.
*/
int active_console = 0;
int prev_console = 0;
 
/** Information about framebuffer
*/
207,9 → 209,10
gcons_in_kernel();
async_serialize_end();
if (__SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE))
if (__SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE)) {
prev_console = active_console;
active_console = KERNEL_CONSOLE;
else
} else
newcons = active_console;
}
443,6 → 446,11
}
}
 
static void interrupt_received(ipc_callid_t callid, ipc_call_t *call)
{
change_console(prev_console);
}
 
int main(int argc, char *argv[])
{
printf(NAME ": HelenOS Console service\n");
520,6 → 528,16
if (ipc_connect_to_me(PHONE_NS, SERVICE_CONSOLE, 0, 0, &phonehash) != 0)
return -1;
/* Receive kernel notifications */
if (sysinfo_value("kconsole.present")) {
int devno = sysinfo_value("kconsole.devno");
int inr = sysinfo_value("kconsole.inr");
if (ipc_register_irq(inr, devno, 0, NULL) != EOK)
printf(NAME ": Error registering kconsole notifications\n");
async_set_interrupt_received(interrupt_received);
}
// FIXME: avoid connectiong to itself, keep using klog
// printf(NAME ": Accepting connections\n");
async_manager();