Revision 26
minor changes
timer.c | ||
---|---|---|
51 | 51 |
int hook_id = 2; |
52 | 52 |
|
53 | 53 |
int (timer_subscribe_int)(uint8_t *bit_no) { |
54 |
if(bit_no == NULL) return 1; |
|
54 | 55 |
*bit_no = hook_id; |
55 | 56 |
if(sys_irqsetpolicy(TIMER0_IRQ, IRQ_REENABLE, &hook_id)) return 1; |
56 | 57 |
return 0; |
... | ... | |
61 | 62 |
return 0; |
62 | 63 |
} |
63 | 64 |
|
64 |
uint32_t no_interrupts = 0;
|
|
65 |
int no_interrupts = 0;
|
|
65 | 66 |
void (timer_int_handler)() { |
66 | 67 |
no_interrupts++; |
67 | 68 |
} |
68 | 69 |
|
69 | 70 |
int (timer_get_conf)(uint8_t timer, uint8_t *st) { |
71 |
if(st == NULL) return 1; |
|
70 | 72 |
// Write read-back command to TIMER_CTRL |
71 | 73 |
u32_t cmd = TIMER_RB_CMD | TIMER_RB_COUNT_ | TIMER_RB_SEL(timer); |
72 | 74 |
if(sys_outb(TIMER_CTRL, cmd)) return 1; |
73 |
|
|
74 | 75 |
int read_port; |
75 | 76 |
switch(timer) { |
76 | 77 |
case 0: read_port = TIMER_0; break; |
Also available in: Unified diff