Working PS/2 keyboard driver
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m19s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m19s
This commit is contained in:
@@ -4,9 +4,15 @@
|
||||
#include <libk/rbtree.h>
|
||||
#include <libk/std.h>
|
||||
#include <libk/string.h>
|
||||
#include <m/kb_device.h>
|
||||
#include <m/terminal_device.h>
|
||||
#include <mm/liballoc.h>
|
||||
#include <sync/spin_lock.h>
|
||||
#include <sys/debug.h>
|
||||
|
||||
#if defined(__x86_64__)
|
||||
#include <device/ps2_kb.h>
|
||||
#endif
|
||||
|
||||
static struct rb_node_link* device_tree = NULL;
|
||||
static spin_lock_t device_tree_lock;
|
||||
@@ -26,7 +32,9 @@ struct device* device_create (int id, device_op_func_t* ops, size_t ops_len,
|
||||
device->id = id;
|
||||
device->init = init;
|
||||
device->fini = fini;
|
||||
memcpy (device->ops, ops, ops_len * sizeof (device_op_func_t));
|
||||
|
||||
if (ops != NULL)
|
||||
memcpy (device->ops, ops, ops_len * sizeof (device_op_func_t));
|
||||
|
||||
if (!device->init (arg)) {
|
||||
free (device);
|
||||
@@ -67,6 +75,14 @@ void devices_init (void) {
|
||||
device_op_func_t ops[] = {
|
||||
[TERMINAL_PUTSTR] = &terminal_putstr,
|
||||
};
|
||||
device_create (1, ops, lengthof (ops), &terminal_init, &terminal_fini, NULL);
|
||||
device_create (TERMINAL_DEVICE, ops, lengthof (ops), &terminal_init, &terminal_fini, NULL);
|
||||
}
|
||||
#if defined(__x86_64__)
|
||||
{
|
||||
device_op_func_t ops[] = {
|
||||
[KB_READ_KEY] = &ps2kb_read_key,
|
||||
};
|
||||
device_create (KB_DEVICE, ops, lengthof (ops), &ps2kb_init, &ps2kb_fini, NULL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user