summaryrefslogtreecommitdiff
path: root/src/drivers/hdi/keyboard.c
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2017-07-20 09:31:30 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2017-07-20 09:31:30 +0200
commit7eae4edb86fc65b2e99bf81757aeb00392d8a60d (patch)
tree2ee5c92be2ca55dcd30dc3e9632bcfa4dfd9a095 /src/drivers/hdi/keyboard.c
parent43fcc1ca57149c5a87502f0c23a2c85e4d28264a (diff)
downloadabaos-7eae4edb86fc65b2e99bf81757aeb00392d8a60d.tar.gz
abaos-7eae4edb86fc65b2e99bf81757aeb00392d8a60d.tar.bz2
added a virtual keyboard driver interface, made the PS/2 keyboard a specialization of it
Diffstat (limited to 'src/drivers/hdi/keyboard.c')
-rw-r--r--src/drivers/hdi/keyboard.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/drivers/hdi/keyboard.c b/src/drivers/hdi/keyboard.c
new file mode 100644
index 0000000..dd7ff65
--- /dev/null
+++ b/src/drivers/hdi/keyboard.c
@@ -0,0 +1,44 @@
+#include "keyboard.h"
+
+#include "string.h"
+#include "kernel.h"
+
+static keyboard_vtable_t const keyboard_vtable = {
+ {
+ keyboard_activate,
+ keyboard_deactivate,
+ keyboard_deinit,
+ keyboard_print_info
+ }
+};
+
+void keyboard_init( keyboard_t *keyboard, keyboard_event_handler_t handler, interrupt_t *interrupt, void *context )
+{
+ memset( keyboard, 0, sizeof( keyboard_t ) );
+
+ driver_init( (driver_t *)keyboard, DRIVER_TYPE_KEYBOARD, interrupt, context );
+
+ keyboard->handler = handler;
+
+ ((driver_t *)keyboard)->vtable = (driver_vtable_t *)&keyboard_vtable;
+}
+
+void keyboard_deinit( void *obj )
+{
+ // nothing to be done
+}
+
+void keyboard_activate( void *obj )
+{
+ kernel_panic( "Activating generic keyboard driver should not be called directly." );
+}
+
+void keyboard_deactivate( void *obj )
+{
+ kernel_panic( "Deactivating generic keyboard driver should not be called directly." );
+}
+
+void keyboard_print_info( void *obj )
+{
+ kernel_panic( "Printing info of generic keyboard driver should not be called directly." );
+}