Project

General

Profile

Statistics
| Revision:

root / lab3 / keyboard.h @ 9

History | View | Annotate | Download (1.19 KB)

1 9 up20180645
#include <lcom/lcf.h>
2
3
#include <lcom/lab3.h>
4
5
#include <stdbool.h>
6
#include <stdint.h>
7
/**
8
* @brief Handles keyboard interrupts (C implementation)
9
*
10
* Reads the status register and the output buffer (OB).
11
* If there was some error, the byte read from the OB should be discarded.
12
*
13
* All communication with other code must be done via global variables, static if possible.
14
*
15
* Must be defined using parenthesis around the function name:
16
*/
17
void (kbc_ih)(void);
18
/**
19
 * @brief Invokes sys_inb() system call but reads the value into a uint8_t variable.
20
 *
21
 * @param port the input port that is to be read
22
 * @param value address of 8-bit variable to be update with the value read
23
 * @return Return 0 upon success and non-zero otherwise
24
 */
25
int (util_sys_inb)(int port, uint8_t *value);
26
/**
27
 * @brief Subscribes and enables Keyboard interrupts
28
 *
29
 * @param bit_no address of memory to be initialized with the
30
 *         bit number to be set in the mask returned upon an interrupt
31
 * @return Return 0 upon success and non-zero otherwise
32
 */
33
int(kbc_subscribe_int)(uint8_t *bit_no);
34
35
/**
36
 * @brief Unsubscribes Keyboard interrupts
37
 *
38
 * @return Return 0 upon success and non-zero otherwise
39
 */
40
int(kbc_unsubscribe_int)();