Project

General

Profile

Statistics
| Revision:

root / lab3 / keyboard.h @ 10

History | View | Annotate | Download (1.25 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

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

    
38
/**
39
 * @brief Unsubscribes Keyboard interrupts
40
 *
41
 * @return Return 0 upon success and non-zero otherwise
42
 */
43
int(kbc_unsubscribe_int)();
44

    
45
#endif /*_KEYBOARD_H */