Revision 57
working
mouse_func.c | ||
---|---|---|
12 | 12 |
return SUCCESS; |
13 | 13 |
} |
14 | 14 |
|
15 |
int (unsubscribe_interrupt)(int *interrupt_id) { |
|
16 |
if (interrupt_id == NULL) return NULL_PTR; |
|
17 |
if (sys_irqrmpolicy(interrupt_id)) return UNSBCR_ERROR; |
|
18 |
return SUCCESS; |
|
19 |
} |
|
20 |
|
|
21 |
int got_error = 0; |
|
15 |
int got_error_mouse_ih = 0; |
|
22 | 16 |
uint8_t packet[3]; |
23 | 17 |
int counter = 0; |
24 | 18 |
|
25 | 19 |
void (mouse_ih)(void) { |
26 | 20 |
uint8_t status = 0; |
27 |
got_error = 0; |
|
21 |
got_error_mouse_ih = 0;
|
|
28 | 22 |
|
29 | 23 |
if (util_sys_inb(STATUS_REG, &status)) { |
30 |
got_error = 1; |
|
24 |
got_error_mouse_ih = 1;
|
|
31 | 25 |
return; |
32 | 26 |
} |
33 | 27 |
|
34 | 28 |
if (status & (TIME_OUT_REC | PARITY_ERROR)) { |
35 |
got_error = 1; |
|
29 |
got_error_mouse_ih = 1;
|
|
36 | 30 |
return; |
37 | 31 |
} |
38 | 32 |
|
39 | 33 |
uint8_t byte = 0; |
40 | 34 |
|
41 | 35 |
if (util_sys_inb(OUTPUT_BUF, &byte)) { |
42 |
got_error = 1; |
|
36 |
got_error_mouse_ih = 1;
|
|
43 | 37 |
return; |
44 | 38 |
} |
45 | 39 |
|
... | ... | |
57 | 51 |
pp.rb = pp.bytes[0] & RIGHT_BUTTON; |
58 | 52 |
pp.mb = pp.bytes[0] & MIDDLE_BUTTON; |
59 | 53 |
pp.lb = pp.bytes[0] & LEFT_BUTTON; |
60 |
//pp.delta_x = |
|
54 |
pp.delta_x = pp.bytes[1]; |
|
55 |
pp.delta_y = pp.bytes[2]; |
|
56 |
pp.x_ov = pp.bytes[0] & X_OVERFLOW; |
|
57 |
pp.y_ov = pp.bytes[0] & Y_OVERFLOW; |
|
61 | 58 |
return pp; |
62 | 59 |
} |
Also available in: Unified diff