root / lab4 / mouse.h @ 16
History | View | Annotate | Download (1.57 KB)
1 | 15 | up20180645 | #ifndef _MOUSE_H
|
---|---|---|---|
2 | #define _MOUSE_H
|
||
3 | |||
4 | 16 | up20180645 | |
5 | 15 | up20180645 | #include <stdbool.h> |
6 | #include <stdint.h> |
||
7 | #include <minix/syslib.h> |
||
8 | #include <minix/sysutil.h> |
||
9 | |||
10 | #include "i8042.h" |
||
11 | |||
12 | /**
|
||
13 | * @brief Handles mouse interrupts
|
||
14 | *
|
||
15 | * Reads the status register, the output buffer and the mouse data
|
||
16 | * If there was some error, the byte read from the OB should be discarded
|
||
17 | *
|
||
18 | * All communication with other code must be done via global variables, static if possible
|
||
19 | *
|
||
20 | * Must be defined using parenthesis around the function name:
|
||
21 | */
|
||
22 | void (mouse_ih)(void); |
||
23 | /**
|
||
24 | * @brief Invokes sys_inb() system call but reads the value into a uint8_t variable.
|
||
25 | *
|
||
26 | * @param port the input port that is to be read
|
||
27 | * @param value address of 8-bit variable to be update with the value read
|
||
28 | * @return Return 0 upon success and non-zero otherwise
|
||
29 | */
|
||
30 | int (util_sys_inb)(int port, uint8_t *value); |
||
31 | /**
|
||
32 | * @brief Subscribes and enables mouse interrupts
|
||
33 | *
|
||
34 | * @param bit_no address of memory to be initialized with the bit number to be set in the mask returned upon an interrupt
|
||
35 | * @return Return 0 upon success and non-zero otherwise
|
||
36 | */
|
||
37 | int(mouse_subscribe_int)(uint8_t *bit_no);
|
||
38 | |||
39 | /**
|
||
40 | * @brief Unsubscribes mouse interrupts
|
||
41 | *
|
||
42 | * @return Return 0 upon success and non-zero otherwise
|
||
43 | */
|
||
44 | int(mouse_unsubscribe_int)();
|
||
45 | /**
|
||
46 | 16 | up20180645 | * @brief Sets up packet
|
47 | 15 | up20180645 | *
|
48 | 16 | up20180645 | * @return Return 0 upon success and non-zero otherwise
|
49 | 15 | up20180645 | */
|
50 | 16 | up20180645 | int(parse_packet)(struct packet *pp); |
51 | /**
|
||
52 | * @brief Writes commands to the mouse
|
||
53 | *
|
||
54 | * @return Return 0 upon success and non-zero otherwise
|
||
55 | */
|
||
56 | int(write_cmd_mouse)(uint8_t cmd);
|
||
57 | /**
|
||
58 | *
|
||
59 | *
|
||
60 | *
|
||
61 | */
|
||
62 | int kbc_write(int port, uint8_t cmd); |
||
63 | /**
|
||
64 | *
|
||
65 | *
|
||
66 | *
|
||
67 | */
|
||
68 | #endif /*_MOUSE_H */ |