Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4110 → Rev 4111

/trunk/kernel/arch/sparc64/src/drivers/sgcn.c
130,23 → 130,20
 
 
/* functions referenced from definitions of I/O operations structures */
static void sgcn_noop(chardev_t *);
static void sgcn_putchar(chardev_t *, const char, bool);
static char sgcn_key_read(chardev_t *);
static void sgcn_putchar(outdev_t *, const char, bool);
 
/** character device operations */
static chardev_operations_t sgcn_ops = {
.suspend = sgcn_noop,
.resume = sgcn_noop,
.read = sgcn_key_read,
/** SGCN output device operations */
static outdev_operations_t sgcnout_ops = {
.write = sgcn_putchar
};
 
/** SGCN character device */
chardev_t sgcn_io;
/** SGCN input device operations */
static indev_operations_t sgcnin_ops = {
.poll = NULL
};
 
/** Address of the chardev, which is connected to SGCN. */
static chardev_t *sgcnout;
static indev_t sgcnin; /**< SGCN input device. */
static outdev_t sgcnout; /**< SGCN output device. */
 
/**
* Set some sysinfo values (SRAM address and SRAM size).
203,6 → 200,11
*/
static void sgcn_buffer_begin_init(void)
{
static bool initialized;
if (initialized)
return;
 
init_sram_begin();
ASSERT(strcmp(SRAM_TOC->magic, SRAM_TOC_MAGIC) == 0);
219,16 → 221,11
sysinfo_set_item_val("sram.buffer.offset", NULL,
SRAM_TOC->keys[i].offset);
initialized = true;
}
 
/**
* Default suspend/resume operation for the input device.
*/
static void sgcn_noop(chardev_t *d)
{
}
 
/**
* Writes a single character to the SGCN (circular) output buffer
* and updates the output write pointer so that SGCN gets to know
* that the character has been written.
271,7 → 268,7
* feed character is written ('\n'), the carriage return character ('\r') is
* written straight away.
*/
static void sgcn_putchar(struct chardev * cd, const char c, bool silent)
static void sgcn_putchar(outdev_t *od, const char c, bool silent)
{
if (!silent) {
spinlock_lock(&sgcn_output_lock);
285,14 → 282,6
}
 
/**
* Called when actively reading the character. Not implemented yet.
*/
static char sgcn_key_read(chardev_t *d)
{
return (char) 0;
}
 
/**
* Grabs the input for kernel.
*/
void sgcn_grab(void)
337,8 → 326,7
char c = *buf_ptr;
*in_rdptr_ptr = (((*in_rdptr_ptr) - begin + 1) % size) + begin;
if (sgcnout)
chardev_push_character(sgcnout, c);
indev_push_character(&sgcnin, c);
}
 
spinlock_unlock(&sgcn_input_lock);
357,10 → 345,9
}
 
/**
* A public function which initializes I/O from/to Serengeti console
* and sets it as a default input/output.
* A public function which initializes input from the Serengeti console.
*/
void sgcn_init(chardev_t *devout)
indev_t *sgcnin_init(void)
{
sgcn_buffer_begin_init();
 
368,7 → 355,6
 
sysinfo_set_item_val("kbd", NULL, true);
sysinfo_set_item_val("kbd.type", NULL, KBD_SGCN);
sysinfo_set_item_val("fb.kind", NULL, 4);
 
thread_t *t = thread_create(kkbdpoll, NULL, TASK, 0, "kkbdpoll", true);
if (!t)
375,11 → 361,23
panic("Cannot create kkbdpoll.");
thread_ready(t);
chardev_initialize("sgcn_io", &sgcn_io, &sgcn_ops);
stdout = &sgcn_io;
indev_initialize("sgcnin", &sgcnin, &sgcnin_ops);
 
sgcnout = devout;
return &sgcnin;
}
 
/**
* A public function which initializes output to the Serengeti console.
*/
void sgcnout_init(void)
{
sgcn_buffer_begin_init();
 
sysinfo_set_item_val("fb.kind", NULL, 4);
 
outdev_initialize("sgcnout", &sgcnout, &sgcnout_ops);
stdout = &sgcnout;
}
 
/** @}
*/