Revision 68
working decently
kbc.h | ||
---|---|---|
1 |
#ifndef _KBC_FUNC_H_ |
|
2 |
#define _KBC_FUNC_H_ |
|
3 |
|
|
4 |
#include <stdint.h> |
|
5 |
|
|
6 |
#define GET 0 /* @brief Argument to get counter without incrementing */ |
|
7 |
#define INCREMENT 1 /* @brief Argument for incrementing counter */ |
|
8 |
|
|
9 | 1 |
/** |
10 |
* @brief Subscribes KBC Interrupts and disables Minix Default Keyboard IH |
|
11 |
* @param interrupt_bit Bit of Interrupt Vector that will be set when KBC Interrupt is pending |
|
12 |
* @param interrupt_id KBC Interrupt ID to specify the KBC Interrupt in other calls |
|
13 |
* @return Whether operation was sucessful or not |
|
2 |
* This file concerns everything related to the KBC (KeyBoard Controller, which |
|
3 |
* actually also manages the mouse) |
|
14 | 4 |
*/ |
15 |
int (subscribe_kbc_interrupt)(uint8_t interrupt_bit, int *interrupt_id); |
|
16 | 5 |
|
6 |
#ifndef KBC_H_INCLUDED |
|
7 |
#define KBC_H_INCLUDED |
|
8 |
|
|
17 | 9 |
/** |
18 | 10 |
* @brief Unsubcribes Interrupts |
19 | 11 |
* @param interrupt_id Interrupt ID, value via arguments on subscription of the interrupt_id |
... | ... | |
23 | 15 |
int (unsubscribe_interrupt)(int *interrupt_id); |
24 | 16 |
|
25 | 17 |
/** |
26 |
* @brief KBC Interrupt Handler |
|
27 |
*/ |
|
28 |
void (kbc_ih)(void); |
|
29 |
|
|
30 |
/** |
|
31 |
* @brief High-level function that polls keyboard for scancode |
|
32 |
* High-level function that polls keyboard for scancode of up to 2 bytes. If |
|
33 |
* scancode has only 1 byte, the second byte is set to 0x00. |
|
34 |
* @param bytes Array of at least 2 bytes to store scancode |
|
35 |
* @param size Size of scancode in bytes |
|
36 |
* @return 0 if operation was successful, 1 otherwise |
|
37 |
*/ |
|
38 |
int (kbd_poll)(uint8_t bytes[], uint8_t *size); |
|
39 |
|
|
40 |
/** |
|
41 | 18 |
* @brief High-level function that reads the command byte of the KBC |
42 | 19 |
* @param cmd Pointer to variable where command byte read from KBC will be stored |
43 | 20 |
* @return 0 if operation was successful, 1 otherwise |
... | ... | |
58 | 35 |
* chance that the keyboard and keyboard interrupts remain disabled. |
59 | 36 |
* @return 1 if operation was successful, 1 otherwise |
60 | 37 |
*/ |
61 |
int (kbc_restore_kbd)();
|
|
38 |
int (kbc_restore_keyboard)();
|
|
62 | 39 |
|
63 | 40 |
/** |
64 | 41 |
* @brief Low-level function to issue a command to keyboard |
... | ... | |
68 | 45 |
int (kbc_issue_cmd)(uint8_t cmd); |
69 | 46 |
|
70 | 47 |
/** |
48 |
* @brief Low-level function to issue an argument of a command |
|
49 |
* @param cmd argument to be issued |
|
50 |
* @return 0 if operation was successful, 1 otherwise |
|
51 |
*/ |
|
52 |
int (kbc_issue_arg)(uint8_t arg); |
|
53 |
|
|
54 |
/** |
|
71 | 55 |
* @brief Low-level function for reading byte from keyboard |
72 | 56 |
* Low-level function for reading byte from keyboard. Waits until output buffer |
73 | 57 |
* is full |
... | ... | |
76 | 60 |
*/ |
77 | 61 |
int (kbc_read_byte)(uint8_t *byte); |
78 | 62 |
|
79 |
|
|
80 |
#endif |
|
63 |
#endif //KBC_H_INCLUDED |
Also available in: Unified diff