Revision 43
minor changes. added compile.sh
lab3/compile.sh | ||
---|---|---|
1 |
reset |
|
2 |
make depend |
|
3 |
make |
|
0 | 4 |
lab3/kbc.c | ||
---|---|---|
77 | 77 |
return 0; |
78 | 78 |
} |
79 | 79 |
|
80 |
int (kbc_restore_kbd)(){ |
|
81 |
uint8_t cmd = 0; |
|
82 |
if(kbc_read_cmd(&cmd)) return 1; |
|
83 |
cmd = (cmd | INT_KBD) & (~DIS_KBD); |
|
84 |
if(kbc_change_cmd(cmd)) return 1; |
|
85 |
return 0; |
|
86 |
} |
|
87 |
|
|
80 | 88 |
int (kbc_issue_cmd)(uint8_t cmd){ |
81 | 89 |
uint8_t stat; |
82 | 90 |
for(int i = 0; i < KBC_NUM_TRIES; ++i){ |
lab3/kbc_func.h | ||
---|---|---|
52 | 52 |
int (kbc_change_cmd)(uint8_t cmd); |
53 | 53 |
|
54 | 54 |
/** |
55 |
* @brief High-level function that restores KBC to normal state |
|
56 |
* High-level function that restores KBC to normal state, because lcf_start |
|
57 |
* changes the command byte of KBC. If this function is not used, there is a |
|
58 |
* chance that the keyboard and keyboard interrupts remain disabled. |
|
59 |
* @return 1 if operation was successful, 1 otherwise |
|
60 |
*/ |
|
61 |
int (kbc_restore_kbd)(); |
|
62 |
|
|
63 |
/** |
|
55 | 64 |
* @brief Low-level function to issue a command to keyboard |
56 | 65 |
* @param cmd command to be issued |
57 | 66 |
* @return 0 if operation was successful, 1 otherwise |
lab3/lab3.c | ||
---|---|---|
98 | 98 |
if(kbd_print_scancode((~c[0])&BREAK_CODE_BIT, size, c)) return 1; |
99 | 99 |
}while(!(size == 1 && c[0] == ESC_BREAK_CODE)); |
100 | 100 |
|
101 |
uint8_t cmd = 0; |
|
102 |
if(kbc_read_cmd(&cmd)) return 1; |
|
103 |
cmd = (cmd | INT_KBD) & (~DIS_KBD); |
|
104 |
if(kbc_change_cmd(cmd)) return 1; |
|
101 |
if(kbc_restore_kbd()) return 1; |
|
105 | 102 |
|
106 |
if (kbd_print_no_sysinb(sys_inb_counter)) return 1;
|
|
103 |
if(kbd_print_no_sysinb(sys_inb_counter)) return 1; |
|
107 | 104 |
|
108 | 105 |
return 0; |
109 | 106 |
} |
Also available in: Unified diff