Project

General

Profile

Statistics
| Revision:

root / lab3 / keyboard.h @ 60

History | View | Annotate | Download (1.07 KB)

1
/**
2
 * This file concerns everything related to the keyboard
3
 */
4

    
5
#ifndef KEYBOARD_H_INCLUDED
6
#define KEYBOARD_H_INCLUDED
7

    
8
/**
9
 * @brief Subscribes KBC Interrupts and disables Minix Default Keyboard IH
10
 * @param interrupt_bit Bit of Interrupt Vector that will be set when KBC Interrupt is pending
11
 * @param interrupt_id KBC Interrupt ID to specify the KBC Interrupt in other calls
12
 * @return Whether operation was sucessful or not
13
 */
14
int (subscribe_keyboard_interrupt)(uint8_t interrupt_bit, int *interrupt_id);
15

    
16
uint8_t scancode[2];
17
int two_byte_scancode;
18
int got_error_keyboard;
19

    
20
/**
21
 * @brief KBC Interrupt Handler
22
 */
23
void (kbc_ih)(void);
24

    
25
/**
26
 * @brief High-level function that polls keyboard for scancode
27
 * High-level function that polls keyboard for scancode of up to 2 bytes. If
28
 * scancode has only 1 byte, the second byte is set to 0x00.
29
 * @param bytes Array of at least 2 bytes to store scancode
30
 * @param size Size of scancode in bytes
31
 * @return 0 if operation was successful, 1 otherwise
32
 */
33
int (keyboard_poll)(uint8_t bytes[], uint8_t *size);
34

    
35
#endif //KEYBOARD_H_INCLUDED