root / lab3 / keyboard.h @ 15
History | View | Annotate | Download (1.44 KB)
1 | 10 | up20180645 | #ifndef _KEYBOARD_H
|
---|---|---|---|
2 | #define _KEYBOARD_H
|
||
3 | 9 | up20180645 | |
4 | |||
5 | 10 | up20180645 | #include <lcom/lcf.h> |
6 | 9 | up20180645 | #include <stdbool.h> |
7 | #include <stdint.h> |
||
8 | 11 | up20180645 | #include <minix/syslib.h> |
9 | #include <minix/sysutil.h> |
||
10 | 10 | up20180645 | |
11 | #include "i8042.h" |
||
12 | 9 | up20180645 | /**
|
13 | 11 | up20180645 | * @brief Handles keyboard interrupts
|
14 | 9 | up20180645 | *
|
15 | 11 | up20180645 | * 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 | 9 | up20180645 | *
|
18 | 11 | up20180645 | * All communication with other code must be done via global variables, static if possible
|
19 | 9 | up20180645 | *
|
20 | * Must be defined using parenthesis around the function name:
|
||
21 | */
|
||
22 | void (kbc_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 Keyboard interrupts
|
||
33 | *
|
||
34 | * @param bit_no address of memory to be initialized with the
|
||
35 | * bit number to be set in the mask returned upon an interrupt
|
||
36 | * @return Return 0 upon success and non-zero otherwise
|
||
37 | */
|
||
38 | int(kbc_subscribe_int)(uint8_t *bit_no);
|
||
39 | |||
40 | /**
|
||
41 | * @brief Unsubscribes Keyboard interrupts
|
||
42 | *
|
||
43 | * @return Return 0 upon success and non-zero otherwise
|
||
44 | */
|
||
45 | 10 | up20180645 | int(kbc_unsubscribe_int)();
|
46 | 11 | up20180645 | /**
|
47 | * @brief Enables interrupts (used when polling function ends)
|
||
48 | *
|
||
49 | * @return Return 0 upon success and non-zero otherwise
|
||
50 | */
|
||
51 | 12 | up20180645 | int (reenable_interrupt)();
|
52 | 10 | up20180645 | |
53 | #endif /*_KEYBOARD_H */ |