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
Introducing LunaBuild to the build flow (#36)
[lunaix-os.git]
/
lunaix-os
/
hal
/
char
/
serial.c
diff --git
a/lunaix-os/hal/char/serial.c
b/lunaix-os/hal/char/serial.c
index d93ff398b81231019595c332bf8daaae1ad5e1a6..826b3a6d5984a90166e52bd89bcc12532e68b77c 100644
(file)
--- a/
lunaix-os/hal/char/serial.c
+++ b/
lunaix-os/hal/char/serial.c
@@
-1,6
+1,7
@@
#include <lunaix/device.h>
#include <lunaix/mm/valloc.h>
#include <lunaix/spike.h>
#include <lunaix/device.h>
#include <lunaix/mm/valloc.h>
#include <lunaix/spike.h>
+#include <lunaix/owloysius.h>
#include <lunaix/status.h>
#include <sys/mm/mempart.h>
#include <lunaix/status.h>
#include <sys/mm/mempart.h>
@@
-20,6
+21,8
@@
static DEFINE_LLIST(serial_devs);
static int serial_idx = 0;
static DEFINE_LLIST(serial_devs);
static int serial_idx = 0;
+static struct device_cat* serial_cat;
+
#define serial_device(dev) ((struct serial_dev*)(dev)->underlay)
int
#define serial_device(dev) ((struct serial_dev*)(dev)->underlay)
int
@@
-239,7
+242,7
@@
struct serial_dev*
serial_create(struct devclass* class, char* if_ident)
{
struct serial_dev* sdev = valloc(sizeof(struct serial_dev));
serial_create(struct devclass* class, char* if_ident)
{
struct serial_dev* sdev = valloc(sizeof(struct serial_dev));
- struct device* dev = device_allocseq(
NULL
, sdev);
+ struct device* dev = device_allocseq(
dev_meta(serial_cat)
, sdev);
dev->ops.read = __serial_read;
dev->ops.read_page = __serial_read_page;
dev->ops.read_async = __serial_read_async;
dev->ops.read = __serial_read;
dev->ops.read_page = __serial_read_page;
dev->ops.read_async = __serial_read_async;
@@
-264,7
+267,7
@@
serial_create(struct devclass* class, char* if_ident)
device_grant_capability(dev, cap_meta(tp_cap));
device_grant_capability(dev, cap_meta(tp_cap));
- register_device(dev, class, "s
erial
%d", class->variant);
+ register_device(dev, class, "s%d", class->variant);
term_create(dev, if_ident);
term_create(dev, if_ident);
@@
-284,4
+287,13
@@
serial_get_avilable()
}
return NULL;
}
return NULL;
-}
\ No newline at end of file
+}
+
+static void
+init_serial_dev()
+{
+ serial_cat = device_addcat(NULL, "serial");
+
+ assert(serial_cat);
+}
+owloysius_fetch_init(init_serial_dev, on_earlyboot)
\ No newline at end of file