root / lab4 / mouse.h @ 15
History | View | Annotate | Download (1.3 KB)
1 | 15 | up20180645 | #ifndef _MOUSE_H
|
---|---|---|---|
2 | #define _MOUSE_H
|
||
3 | |||
4 | #include <lcom/lcf.h> |
||
5 | #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 | *
|
||
47 | *
|
||
48 | *
|
||
49 | */
|
||
50 | int(parse_packet)(struct packet *pp); |