timer.c
1 |
#include <minix/syslib.h> |
---|---|
2 |
#include <minix/drivers.h> |
3 |
|
4 |
int timer_set_rate(unsigned long timer, unsigned long rate) { |
5 |
if(timer==0) |
6 |
{ |
7 |
sys_outb(TIMER_CTRL,(TIMER_SQR_WAVE|TIMER_0|TIMER_LSB_MSB| |
8 |
TIMER_BIN)); |
9 |
sys_outb(TIMER_0,((rate) & 0xFF)); /* LSB */ |
10 |
sys_outb(TIMER_0,((rate) >> 8)); /* MSB */ |
11 |
return 0; |
12 |
} |
13 |
else if(timer==1) |
14 |
{ |
15 |
sys_outb(TIMER_CTRL,(TIMER_SQR_WAVE|TIMER_1|TIMER_LSB_MSB| |
16 |
TIMER_BIN)); |
17 |
sys_outb(TIMER_1,((rate) & 0xFF)); /* LSB */ |
18 |
sys_outb(TIMER_1,((rate) >> 8)); /* MSB */ |
19 |
return 0; |
20 |
} |
21 |
else if(timer==2) |
22 |
{ |
23 |
sys_outb(TIMER_CTRL,(TIMER_SQR_WAVE|TIMER_2|TIMER_LSB_MSB| |
24 |
TIMER_BIN)); |
25 |
sys_outb(TIMER_2,((rate) & 0xFF)); /* LSB */ |
26 |
sys_outb(TIMER_2,((rate) >> 8)); /* MSB */ |
27 |
return 0; |
28 |
} |
29 |
|
30 |
int timer_get_status(unsigned long timer, u8_t *st) { |
31 |
/* To complete ... */
|
32 |
} |
33 |
|
34 |
int timer_show_status(unsigned long timer) { |
35 |
/* To complete ... */
|
36 |
} |
37 |
|
38 |
unsigned long timer_subscribe_int(void ) { |
39 |
/* To complete ... */
|
40 |
} |
41 |
|
42 |
int timer_unsubscribe_int() {
|
43 |
/* To complete ... */
|
44 |
} |