Revision 55
added code to mouse_test_packet
lab4/lab4.c | ||
---|---|---|
31 | 31 |
|
32 | 32 |
|
33 | 33 |
int (mouse_test_packet)(uint32_t cnt) { |
34 |
return 1; |
|
34 |
/// loop stuff |
|
35 |
int ipc_status, r; |
|
36 |
message msg; |
|
37 |
/// Keyboard interrupt handling |
|
38 |
uint8_t mouse_irq_bit = 12; |
|
39 |
int mouse_id = 0; |
|
40 |
int mouse_irq = BIT(mouse_irq_bit); |
|
41 |
if (subscribe_mouse_interrupt(mouse_irq_bit, &mouse_id)) return 1; |
|
42 |
if(mouse_enable_data_reporting()) return 1; |
|
43 |
/// cycle |
|
44 |
int good = 1; |
|
45 |
while (good) { |
|
46 |
/* Get a request message. */ |
|
47 |
if ((r = driver_receive(ANY, &msg, &ipc_status)) != 0) { |
|
48 |
printf("driver_receive failed with %d", r); |
|
49 |
continue; |
|
50 |
} |
|
51 |
if (is_ipc_notify(ipc_status)) { /* received notification */ |
|
52 |
switch (_ENDPOINT_P(msg.m_source)) { |
|
53 |
case HARDWARE: /* hardware interrupt notification */ |
|
54 |
if (msg.m_notify.interrupts & mouse_irq) { /* subscribed interrupt */ |
|
55 |
mouse_ih(); |
|
56 |
/* |
|
57 |
if (!(two_byte_scancode || got_error)) { // finished processing a scancode |
|
58 |
if (scancode[0] == TWO_BYTE_CODE) kbd_print_scancode(!(scancode[1] & BREAK_CODE_BIT), 2, scancode); |
|
59 |
else kbd_print_scancode(!(scancode[0] & BREAK_CODE_BIT), 1, scancode); |
|
60 |
} else { break; } |
|
61 |
if (scancode[0] == ESC_BREAK_CODE) good = 0; |
|
62 |
*/ |
|
63 |
} |
|
64 |
break; |
|
65 |
default: |
|
66 |
break; /* no other notifications expected: do nothing */ |
|
67 |
} |
|
68 |
} else { /* received standart message, not a notification */ |
|
69 |
/* no standart message expected: do nothing */ |
|
70 |
} |
|
71 |
} |
|
72 |
|
|
73 |
if (unsubscribe_interrupt(&mouse_id)) return 1; |
|
74 |
|
|
75 |
return 0; |
|
35 | 76 |
} |
36 | 77 |
|
37 | 78 |
int (mouse_test_remote)(uint16_t period, uint8_t cnt) { |
Also available in: Unified diff