Revision 26
minor changes
lab2.c | ||
---|---|---|
40 | 40 |
return 0; |
41 | 41 |
} |
42 | 42 |
|
43 |
extern uint32_t no_interrupts;
|
|
43 |
extern int no_interrupts;
|
|
44 | 44 |
|
45 | 45 |
int(timer_test_int)(uint8_t time) { |
46 | 46 |
int ipc_status, r; |
... | ... | |
48 | 48 |
uint8_t hook = 0; |
49 | 49 |
no_interrupts = 0; |
50 | 50 |
int freq = 60; // better way to get the frequency of the timer??? |
51 |
printf("Hook pre: %x\n", hook); |
|
52 | 51 |
timer_subscribe_int(&hook); |
53 |
printf("Hook pos: %x\n", hook); |
|
54 | 52 |
int irq_set = BIT(hook); |
55 |
|
|
56 | 53 |
while (time) { |
57 | 54 |
/* Get a request message. */ |
58 | 55 |
if ((r = driver_receive(ANY, &msg, &ipc_status)) != 0) { |
... | ... | |
62 | 59 |
if (is_ipc_notify(ipc_status)) { /* received notification */ |
63 | 60 |
switch (_ENDPOINT_P(msg.m_source)) { |
64 | 61 |
case HARDWARE: /* hardware interrupt notification */ |
65 |
printf("%x\n", msg.m_notify.interrupts); |
|
66 | 62 |
if (msg.m_notify.interrupts & irq_set) { /* subscribed interrupt */ |
67 | 63 |
timer_int_handler(); |
68 |
|
|
69 | 64 |
if (!(no_interrupts % freq)) { |
70 | 65 |
timer_print_elapsed_time(); |
71 | 66 |
time--; |
... | ... | |
79 | 74 |
/* no standart message expected: do nothing */ |
80 | 75 |
} |
81 | 76 |
} |
82 |
|
|
83 | 77 |
timer_unsubscribe_int(); |
84 |
|
|
85 | 78 |
return 0; |
86 | 79 |
} |
Also available in: Unified diff