git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rewrite the device subsystem interfaces (#48)
[lunaix-os.git]
/
lunaix-os
/
hal
/
char
/
lxconsole.c
diff --git
a/lunaix-os/hal/char/lxconsole.c
b/lunaix-os/hal/char/lxconsole.c
index 53d01bbb50810360e3103eb6efadaa1e3510aaef..aa4136a65181c09ca474de4cc2119593baee1eab 100644
(file)
--- a/
lunaix-os/hal/char/lxconsole.c
+++ b/
lunaix-os/hal/char/lxconsole.c
@@
-27,6
+27,7
@@
struct console
{
struct console
{
+ struct potens_meta* tp_cap;
struct lx_timer* flush_timer;
struct fifo_buf output;
struct fifo_buf input;
struct lx_timer* flush_timer;
struct fifo_buf output;
struct fifo_buf input;
@@
-90,8
+91,12
@@
__lxconsole_listener(struct input_device* dev)
}
fifo_putone(&lx_console.input, ttychr);
}
fifo_putone(&lx_console.input, ttychr);
- pwake_all(&lx_reader);
+ struct termport_potens* tpcap;
+ tpcap = get_potens(lx_console.tp_cap, typeof(*tpcap));
+ term_notify_data_avaliable(tpcap);
+
+ pwake_all(&lx_reader);
done:
return INPUT_EVT_NEXT;
}
done:
return INPUT_EVT_NEXT;
}
@@
-99,13
+104,13
@@
done:
int
__tty_write_pg(struct device* dev, void* buf, size_t offset)
{
int
__tty_write_pg(struct device* dev, void* buf, size_t offset)
{
- return __tty_write(dev, buf, offset, P
G
_SIZE);
+ return __tty_write(dev, buf, offset, P
AGE
_SIZE);
}
int
__tty_read_pg(struct device* dev, void* buf, size_t offset)
{
}
int
__tty_read_pg(struct device* dev, void* buf, size_t offset)
{
- return __tty_read(dev, buf, offset, P
G
_SIZE);
+ return __tty_read(dev, buf, offset, P
AGE
_SIZE);
}
int
}
int
@@
-132,6
+137,14
@@
__tty_read(struct device* dev, void* buf, size_t offset, size_t len)
return count + fifo_read(&console->input, buf + count, len - count);
}
return count + fifo_read(&console->input, buf + count, len - count);
}
+int
+__tty_read_async(struct device* dev, void* buf, size_t offset, size_t len)
+{
+ struct console* console = (struct console*)dev->underlay;
+
+ return fifo_read(&console->input, buf, len);
+}
+
size_t
__find_next_line(size_t start)
{
size_t
__find_next_line(size_t start)
{
@@
-279,21
+292,22
@@
lxconsole_spawn_ttydev(struct device_def* devdef)
tty_dev->ops.write_page = __tty_write_pg;
tty_dev->ops.read = __tty_read;
tty_dev->ops.read_page = __tty_read_pg;
tty_dev->ops.write_page = __tty_write_pg;
tty_dev->ops.read = __tty_read;
tty_dev->ops.read_page = __tty_read_pg;
+ tty_dev->ops.write_async = __tty_write;
+ tty_dev->ops.read_async = __tty_read_async;
waitq_init(&lx_reader);
input_add_listener(__lxconsole_listener);
register_device(tty_dev, &devdef->class, "vcon");
waitq_init(&lx_reader);
input_add_listener(__lxconsole_listener);
register_device(tty_dev, &devdef->class, "vcon");
- term_
create(tty_dev, "FB
");
+ term_
attach_potens(tty_dev, NULL, "VCON
");
return 0;
}
static struct device_def lxconsole_def = {
return 0;
}
static struct device_def lxconsole_def = {
-
.name = "Lunaix Virtual Console"
,
-
.class = DEVCLASS(DEVIF_NON, DEVFN_TTY, DEV_BUILTIN
),
- .init = lxconsole_spawn_ttydev
+
def_device_name("Lunaix Virtual Console")
,
+
def_device_class(LUNAIX, TTY, VTERM
),
+ def_on_load(lxconsole_spawn_ttydev)
};
};
-// FIXME
EXPORT_DEVICE(lxconsole, &lxconsole_def, load_onboot);
\ No newline at end of file
EXPORT_DEVICE(lxconsole, &lxconsole_def, load_onboot);
\ No newline at end of file