Revision 12
All functions working, errors dealt with
keyboard.c | ||
---|---|---|
24 | 24 |
uint8_t status_reg; |
25 | 25 |
|
26 | 26 |
if(util_sys_inb(STATUS_REG,&status_reg)!=0){ //checks if there is an error |
27 |
printf("Error reading status register in the keyboard interruption\n"); |
|
27 | 28 |
return; |
28 | 29 |
} |
29 | 30 |
if(((status_reg & STAT_REG_OBF)==0) ||((status_reg&(STAT_REG_PAR|STAT_REG_TIMEOUT))!=0)|| ((status_reg&STAT_REG_AUX)!=0)){ //checks if there is a parity or timeout error (mask -> 0xC0, bit 7 and 6 set), checks if output buffer is empty and checks if there is data coming from the mouse |
31 |
printf("Parity/Timeout error or output buffer is empty or data coming from the mouse\n"); |
|
30 | 32 |
return; |
31 | 33 |
} |
32 |
util_sys_inb(OUTPUT_BUF,&scan_code); |
|
34 |
if(util_sys_inb(OUTPUT_BUF,&scan_code)!=0){//checks if there is an error |
|
35 |
printf("Error reading output buffer in the keyboard interruption\n"); |
|
36 |
return; |
|
37 |
} |
|
33 | 38 |
|
34 | 39 |
} |
35 | 40 |
|
36 | 41 |
|
37 | 42 |
int (kbc_subscribe_int)(uint8_t *bit_no) { //similar function to that of timer_subscribe_int |
38 | 43 |
*bit_no = BIT(keyboard_id); |
39 |
if(sys_irqsetpolicy(KEYBOARD_IRQ,(IRQ_REENABLE|IRQ_EXCLUSIVE),&keyboard_id)==1){ //operation to subscribe int
|
|
44 |
if(sys_irqsetpolicy(KEYBOARD_IRQ,(IRQ_REENABLE|IRQ_EXCLUSIVE),&keyboard_id)==1){ //operation to subscribe int |
|
40 | 45 |
printf("Error subscribing int\n"); |
41 | 46 |
return 1; |
42 | 47 |
} |
... | ... | |
51 | 56 |
return 0; |
52 | 57 |
} |
53 | 58 |
|
54 |
int (enable_interrupt)() |
|
59 |
int (reenable_interrupt)()
|
|
55 | 60 |
{ |
56 | 61 |
uint8_t command; |
57 | 62 |
|
... | ... | |
61 | 66 |
} |
62 | 67 |
|
63 | 68 |
if(util_sys_inb(OUTPUT_BUF, &command)!=0){ |
64 |
printf("Error reading output buffer\n"); |
|
69 |
printf("Error reading output buffer in enable_interrupt\n");
|
|
65 | 70 |
return 1; |
66 | 71 |
} |
67 | 72 |
|
Also available in: Unified diff