root / lab3 / keyboard.h @ 15
History | View | Annotate | Download (1.44 KB)
1 |
#ifndef _KEYBOARD_H
|
---|---|
2 |
#define _KEYBOARD_H
|
3 |
|
4 |
|
5 |
#include <lcom/lcf.h> |
6 |
#include <stdbool.h> |
7 |
#include <stdint.h> |
8 |
#include <minix/syslib.h> |
9 |
#include <minix/sysutil.h> |
10 |
|
11 |
#include "i8042.h" |
12 |
/**
|
13 |
* @brief Handles keyboard 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 (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 |
int(kbc_unsubscribe_int)();
|
46 |
/**
|
47 |
* @brief Enables interrupts (used when polling function ends)
|
48 |
*
|
49 |
* @return Return 0 upon success and non-zero otherwise
|
50 |
*/
|
51 |
int (reenable_interrupt)();
|
52 |
|
53 |
#endif /*_KEYBOARD_H */ |