xref: /haiku/src/add-ons/kernel/bus_managers/ps2/ps2_common.h (revision d3d8b26997fac34a84981e6d2b649521de2cc45a)
1 /*
2  * Copyright 2004-2006 Haiku, Inc.
3  * Distributed under the terms of the MIT License.
4  *
5  * PS/2 hid device driver
6  *
7  * Authors (in chronological order):
8  *		Elad Lahav (elad@eldarshany.com)
9  *		Stefano Ceccherini (burton666@libero.it)
10  *		Axel Dörfler, axeld@pinc-software.de
11  *      Marcus Overhagen <marcus@overhagen.de>
12  */
13 #ifndef __PS2_COMMON_H
14 #define __PS2_COMMON_H
15 
16 
17 #include <ISA.h>
18 #include <Drivers.h>
19 #include <KernelExport.h>
20 #include <OS.h>
21 
22 #include "ps2_defs.h"
23 #include "ps2_dev.h"
24 
25 
26 // debug defines
27 #ifdef DEBUG
28 #	define TRACE(x) dprintf x
29 #else
30 #	define TRACE(x) ;
31 #endif
32 
33 // global variables
34 extern isa_module_info *gIsa;
35 
36 extern device_hooks gKeyboardDeviceHooks;
37 extern device_hooks gMouseDeviceHooks;
38 
39 extern bool gActiveMultiplexingEnabled;
40 extern sem_id gControllerSem;
41 
42 // prototypes from common.c
43 
44 status_t		ps2_init(void);
45 void			ps2_uninit(void);
46 
47 uint8			ps2_read_ctrl(void);
48 uint8			ps2_read_data(void);
49 void			ps2_write_ctrl(uint8 ctrl);
50 void			ps2_write_data(uint8 data);
51 status_t		ps2_wait_read(void);
52 status_t		ps2_wait_write(void);
53 
54 void			ps2_flush(void);
55 
56 extern status_t ps2_command(uint8 cmd, const uint8 *out, int out_count, uint8 *in, int in_count);
57 
58 // prototypes from keyboard.c & mouse.c
59 extern status_t probe_keyboard(void);
60 
61 #endif /* __PS2_COMMON_H */
62