Project

General

Profile

Revision 31

Minor changes

View differences:

kbc.c
16 16

  
17 17
uint8_t scancode[2];
18 18
int two_byte_scancode = 0;
19
int got_error = 0;
19 20

  
20 21
void (kbc_ih)(void) {
21 22
    uint8_t status = 0;
23
    got_error = 0;
22 24

  
23 25
    #ifdef LAB3
24 26
    sys_inb_counter(INCREMENT);
25 27
    #endif
26 28

  
27
    if (util_sys_inb(STATUS_REG, &status)) return;
29
    if (util_sys_inb(STATUS_REG, &status)) {
30
        got_error = 1;
31
        return;
32
    }
28 33

  
29
    if (status & (TIME_OUT_REC | PARITY_ERROR)) return;
34
    if (status & (TIME_OUT_REC | PARITY_ERROR)) {
35
        got_error = 1;
36
        return;
37
    }
30 38

  
31 39
    #ifdef LAB3
32 40
    sys_inb_counter(INCREMENT);
......
34 42

  
35 43
    uint8_t byte = 0;
36 44

  
37
    if (util_sys_inb(OUTPUT_BUF, &byte)) return;
45
    if (util_sys_inb(OUTPUT_BUF, &byte)) {
46
        got_error = 1;
47
        return;
48
    }
38 49

  
39 50
    if (two_byte_scancode) {
40 51
        scancode[1] = byte;
......
46 57

  
47 58
}
48 59

  
49
uint32_t sys_inb_counter(int increment) {
60
uint32_t (sys_inb_counter)(int increment) {
50 61
    static uint32_t counter = 0;
51 62
    if (increment) return ++counter;
52 63
    return counter;

Also available in: Unified diff