summaryrefslogtreecommitdiff
path: root/src/drivers/hdi/mouse.h
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2017-07-18 21:23:22 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2017-07-18 21:23:22 +0200
commitee3e51aa1624693217b1a4ae7bfb2730424c08f2 (patch)
treebebd430417bad79c9cd1aa91f48d168f90795621 /src/drivers/hdi/mouse.h
parent3a1570d0e6531e3f49e79bbbe4e24d6280e49b1a (diff)
downloadabaos-ee3e51aa1624693217b1a4ae7bfb2730424c08f2.tar.gz
abaos-ee3e51aa1624693217b1a4ae7bfb2730424c08f2.tar.bz2
added a virtual mouse driver interface, made the PS/2 mouse a specialization of it
Diffstat (limited to 'src/drivers/hdi/mouse.h')
-rw-r--r--src/drivers/hdi/mouse.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/drivers/hdi/mouse.h b/src/drivers/hdi/mouse.h
new file mode 100644
index 0000000..90417f3
--- /dev/null
+++ b/src/drivers/hdi/mouse.h
@@ -0,0 +1,55 @@
+#ifndef MOUSE_H
+#define MOUSE_H
+
+#include "driver.h"
+
+typedef enum {
+ MOUSE_EVENT_TYPE_BUTTON_UP,
+ MOUSE_EVENT_TYPE_BUTTON_DOWN,
+ MOUSE_EVENT_TYPE_MOVE
+} mouse_event_type_t;
+
+typedef enum {
+ MOUSE_BUTTON_LEFT = 1,
+ MOUSE_BUTTON_RIGHT = 2,
+ MOUSE_BUTTON_MIDDLE = 3
+} mouse_button_t;
+
+typedef struct {
+ mouse_event_type_t type;
+ mouse_button_t button;
+ int32_t old_cursor_x;
+ int32_t old_cursor_y;
+ int32_t cursor_x;
+ int32_t cursor_y;
+} mouse_event_t;
+
+typedef void (*mouse_event_handler_t)( mouse_event_t *event, void *context );
+
+typedef struct {
+ driver_t base;
+ uint32_t res_x;
+ uint32_t res_y;
+ int32_t cursor_x;
+ int32_t cursor_y;
+ mouse_event_handler_t handler;
+} mouse_t;
+
+typedef struct {
+ driver_vtable_t base;
+ void (*set_resolution)( void *obj, const uint32_t x, const uint32_t y );
+ void (*set_position)( void *obj, const uint32_t x, const uint32_t y );
+} mouse_vtable_t;
+
+void mouse_init( mouse_t *mouse, mouse_event_handler_t handler, interrupt_t *interrupt, void *context );
+void mouse_activate( void *obj );
+void mouse_deactivate( void *obj );
+void mouse_deinit( void *obj );
+void mouse_print_info( void *obj );
+
+void mouse_set_resolution( void *obj, const uint32_t x, const uint32_t y );
+void mouse_set_position( void *obj, const uint32_t x, const uint32_t y );
+
+uint32_t mouse_handle_interrupt( interrupt_handler_t *handler, uint32_t esp );
+
+#endif // MOUSE_H