73,7 → 73,7 |
* that the OBP console buffer is not the only console buffer |
* which can be used. It is, however, used because when the kernel |
* is running, the OBP buffer is not used by OBP any more but OBP |
* has already made neccessary arangements so that the output will |
* has already made necessary arrangements so that the output will |
* be read from the OBP buffer and input will go to the OBP buffer. |
* Therefore HelenOS needs to make no such arrangements any more. |
*/ |
145,6 → 145,9 |
/** SGCN character device */ |
chardev_t sgcn_io; |
|
/** Address of the chardev, which is connected to SGCN. */ |
static chardev_t *sgcnout; |
|
/** |
* Set some sysinfo values (SRAM address and SRAM size). |
*/ |
163,9 → 166,6 |
* property of the "/chosen" OBP node. The sram_begin variable will |
* be set to the virtual address which maps to the SRAM physical |
* address. |
* |
* It also registers the physical area of SRAM and sets some sysinfo |
* values (SRAM address and SRAM size). |
*/ |
static void init_sram_begin(void) |
{ |
319,15 → 319,11 |
uint32_t end = SGCN_BUFFER_HEADER->in_end; |
uint32_t size = end - begin; |
|
if (kbd_disabled) |
return; |
|
spinlock_lock(&sgcn_input_lock); |
|
ipl_t ipl = interrupts_disable(); |
|
if (kbd_disabled) { |
interrupts_restore(ipl); |
return; |
} |
|
/* we need pointers to volatile variables */ |
volatile char *buf_ptr = (volatile char *) |
SGCN_BUFFER(char, SGCN_BUFFER_HEADER->in_rdptr); |
341,13 → 337,10 |
char c = *buf_ptr; |
*in_rdptr_ptr = (((*in_rdptr_ptr) - begin + 1) % size) + begin; |
|
if (c == '\r') { |
c = '\n'; |
if (sgcnout) |
chardev_push_character(sgcnout, c); |
} |
chardev_push_character(&sgcn_io, c); |
} |
|
interrupts_restore(ipl); |
spinlock_unlock(&sgcn_input_lock); |
} |
|
367,7 → 360,7 |
* A public function which initializes I/O from/to Serengeti console |
* and sets it as a default input/output. |
*/ |
void sgcn_init(void) |
void sgcn_init(chardev_t *devout) |
{ |
sgcn_buffer_begin_init(); |
|
383,8 → 376,9 |
thread_ready(t); |
|
chardev_initialize("sgcn_io", &sgcn_io, &sgcn_ops); |
stdin = &sgcn_io; |
stdout = &sgcn_io; |
|
sgcnout = devout; |
} |
|
/** @} |